func_before,vul "void PushMessagingServiceImpl::DidSubscribeWithEncryptionInfo( const PushMessagingAppIdentifier& app_identifier, const RegisterCallback& callback, const std::string& subscription_id, const std::string& p256dh, const std::string& auth_secret) { if (p256dh.empty()) { SubscribeEndWithError( callback, content::mojom::PushRegistrationStatus::PUBLIC_KEY_UNAVAILABLE); return; } app_identifier.PersistToPrefs(profile_); IncreasePushSubscriptionCount(1, false /* is_pending */); SubscribeEnd( callback, subscription_id, std::vector(p256dh.begin(), p256dh.end()), std::vector(auth_secret.begin(), auth_secret.end()), content::mojom::PushRegistrationStatus::SUCCESS_FROM_PUSH_SERVICE); } ",0 "ScriptableHandle* ScriptableHandle::NewDescHandle( DescBasedHandle* desc_handle) { PLUGIN_PRINTF((""ScriptableHandle::NewDescHandle (desc_handle=%p)\n"", static_cast(desc_handle))); if (desc_handle == NULL) { return NULL; } ScriptableHandle* scriptable_handle = new(std::nothrow) ScriptableHandle(desc_handle); if (scriptable_handle == NULL) { return NULL; } PLUGIN_PRINTF((""ScriptableHandle::NewDescHandle (return %p)\n"", static_cast(scriptable_handle))); return scriptable_handle; } ",0 "static void sas_chain_event(int event, unsigned long *pending, struct sas_work *sw, struct sas_ha_struct *ha) { if (!test_and_set_bit(event, pending)) { unsigned long flags; spin_lock_irqsave(&ha->lock, flags); sas_chain_work(ha, sw); spin_unlock_irqrestore(&ha->lock, flags); } } ",0 "void BrowserRenderProcessHost::ClearTransportDIBCache() { STLDeleteContainerPairSecondPointers( cached_dibs_.begin(), cached_dibs_.end()); cached_dibs_.clear(); } ",0 "static int _nfs4_proc_open(struct nfs4_opendata *data) { struct inode *dir = data->dir->d_inode; struct nfs_server *server = NFS_SERVER(dir); struct nfs_openargs *o_arg = &data->o_arg; struct nfs_openres *o_res = &data->o_res; int status; status = nfs4_run_open_task(data, 0); if (!data->rpc_done) return status; if (status != 0) { if (status == -NFS4ERR_BADNAME && !(o_arg->open_flags & O_CREAT)) return -ENOENT; return status; } nfs_fattr_map_and_free_names(server, &data->f_attr); if (o_arg->open_flags & O_CREAT) update_changeattr(dir, &o_res->cinfo); if ((o_res->rflags & NFS4_OPEN_RESULT_LOCKTYPE_POSIX) == 0) server->caps &= ~NFS_CAP_POSIX_LOCK; if(o_res->rflags & NFS4_OPEN_RESULT_CONFIRM) { status = _nfs4_proc_open_confirm(data); if (status != 0) return status; } if (!(o_res->f_attr->valid & NFS_ATTR_FATTR)) _nfs4_proc_getattr(server, &o_res->fh, o_res->f_attr); return 0; } ",0 "void Browser::RemoveScheduledUpdatesFor(TabContents* contents) { if (!contents) return; UpdateMap::iterator i = scheduled_updates_.find(contents); if (i != scheduled_updates_.end()) scheduled_updates_.erase(i); } ",0 "void LayoutBlockFlow::styleWillChange(StyleDifference diff, const ComputedStyle& newStyle) { const ComputedStyle* oldStyle = style(); s_canPropagateFloatIntoSibling = oldStyle ? !isFloatingOrOutOfFlowPositioned() && !avoidsFloats() : false; if (oldStyle && parent() && diff.needsFullLayout() && oldStyle->position() != newStyle.position() && containsFloats() && !isFloating() && !isOutOfFlowPositioned() && newStyle.hasOutOfFlowPosition()) markAllDescendantsWithFloatsForLayout(); LayoutBlock::styleWillChange(diff, newStyle); } ",0 "u64 kvm_get_apic_base(struct kvm_vcpu *vcpu) { if (irqchip_in_kernel(vcpu->kvm)) return vcpu->arch.apic_base; else return vcpu->arch.apic_base; } ",0 "static int nsv_probe(AVProbeData *p) { int i, score = 0; /* check file header */ /* streamed files might not have any header */ if (p->buf[0] == 'N' && p->buf[1] == 'S' && p->buf[2] == 'V' && (p->buf[3] == 'f' || p->buf[3] == 's')) return AVPROBE_SCORE_MAX; /* XXX: do streamed files always start at chunk boundary ?? */ /* or do we need to search NSVs in the byte stream ? */ /* seems the servers don't bother starting clean chunks... */ /* sometimes even the first header is at 9KB or something :^) */ for (i = 1; i < p->buf_size - 3; i++) { if (AV_RL32(p->buf + i) == AV_RL32(""NSVs"")) { /* Get the chunk size and check if at the end we are getting 0xBEEF */ int vsize = AV_RL24(p->buf+i+19) >> 4; int asize = AV_RL16(p->buf+i+22); int offset = i + 23 + asize + vsize + 1; if (offset <= p->buf_size - 2 && AV_RL16(p->buf + offset) == 0xBEEF) return 4*AVPROBE_SCORE_MAX/5; score = AVPROBE_SCORE_MAX/5; } } /* so we'll have more luck on extension... */ if (av_match_ext(p->filename, ""nsv"")) return AVPROBE_SCORE_EXTENSION; /* FIXME: add mime-type check */ return score; } ",0 "bool HTMLFormElement::noValidate() const { return fastHasAttribute(novalidateAttr); } ",0 "HWND AppListController::GetAppListHWND() const { #if defined(USE_AURA) gfx::NativeWindow window = current_view_->GetWidget()->GetTopLevelWidget()->GetNativeWindow(); return window->GetRootWindow()->GetAcceleratedWidget(); #else return current_view_->GetWidget()->GetTopLevelWidget()->GetNativeWindow(); #endif } ",0 "cached_NPN_UTF8FromIdentifier(NPIdentifier identifier) { NPUTF8 *str; if (!use_npidentifier_cache()) str = invoke_NPN_UTF8FromIdentifier(identifier); else { #if USE_NPIDENTIFIER_CACHE str = npidentifier_cache_get_string_copy(identifier); if (str == NULL) { str = invoke_NPN_UTF8FromIdentifier(identifier); npidentifier_cache_reserve(1); npidentifier_cache_add_string(identifier, str); } #endif } return str; } ",0 "void RenderFrameImpl::PluginDidStopLoading() { DidStopLoading(); } ",0 " tt_cmap14_char_index( TT_CMap cmap, FT_UInt32 char_code ) { FT_UNUSED( cmap ); FT_UNUSED( char_code ); /* This can't happen */ return 0; } ",0 "XRRDeleteMonitor(Display *dpy, Window window, Atom name) { XExtDisplayInfo *info = XRRFindDisplay(dpy); xRRDeleteMonitorReq *req; RRSimpleCheckExtension (dpy, info); LockDisplay(dpy); GetReq (RRDeleteMonitor, req); req->reqType = info->codes->major_opcode; req->randrReqType = X_RRDeleteMonitor; req->window = window; req->name = name; UnlockDisplay (dpy); SyncHandle (); } ",0 "int __kvm_set_memory_region(struct kvm *kvm, struct kvm_userspace_memory_region *mem, int user_alloc) { int r; gfn_t base_gfn; unsigned long npages; unsigned long i; struct kvm_memory_slot *memslot; struct kvm_memory_slot old, new; struct kvm_memslots *slots, *old_memslots; r = -EINVAL; /* General sanity checks */ if (mem->memory_size & (PAGE_SIZE - 1)) goto out; if (mem->guest_phys_addr & (PAGE_SIZE - 1)) goto out; /* We can read the guest memory with __xxx_user() later on. */ if (user_alloc && ((mem->userspace_addr & (PAGE_SIZE - 1)) || !access_ok(VERIFY_WRITE, (void __user *)(unsigned long)mem->userspace_addr, mem->memory_size))) goto out; if (mem->slot >= KVM_MEM_SLOTS_NUM) goto out; if (mem->guest_phys_addr + mem->memory_size < mem->guest_phys_addr) goto out; memslot = id_to_memslot(kvm->memslots, mem->slot); base_gfn = mem->guest_phys_addr >> PAGE_SHIFT; npages = mem->memory_size >> PAGE_SHIFT; r = -EINVAL; if (npages > KVM_MEM_MAX_NR_PAGES) goto out; if (!npages) mem->flags &= ~KVM_MEM_LOG_DIRTY_PAGES; new = old = *memslot; new.id = mem->slot; new.base_gfn = base_gfn; new.npages = npages; new.flags = mem->flags; /* Disallow changing a memory slot's size. */ r = -EINVAL; if (npages && old.npages && npages != old.npages) goto out_free; /* Check for overlaps */ r = -EEXIST; for (i = 0; i < KVM_MEMORY_SLOTS; ++i) { struct kvm_memory_slot *s = &kvm->memslots->memslots[i]; if (s == memslot || !s->npages) continue; if (!((base_gfn + npages <= s->base_gfn) || (base_gfn >= s->base_gfn + s->npages))) goto out_free; } /* Free page dirty bitmap if unneeded */ if (!(new.flags & KVM_MEM_LOG_DIRTY_PAGES)) new.dirty_bitmap = NULL; r = -ENOMEM; /* Allocate if a slot is being created */ #ifndef CONFIG_S390 if (npages && !new.rmap) { new.rmap = vzalloc(npages * sizeof(*new.rmap)); if (!new.rmap) goto out_free; new.user_alloc = user_alloc; new.userspace_addr = mem->userspace_addr; } if (!npages) goto skip_lpage; for (i = 0; i < KVM_NR_PAGE_SIZES - 1; ++i) { unsigned long ugfn; unsigned long j; int lpages; int level = i + 2; /* Avoid unused variable warning if no large pages */ (void)level; if (new.lpage_info[i]) continue; lpages = 1 + ((base_gfn + npages - 1) >> KVM_HPAGE_GFN_SHIFT(level)); lpages -= base_gfn >> KVM_HPAGE_GFN_SHIFT(level); new.lpage_info[i] = vzalloc(lpages * sizeof(*new.lpage_info[i])); if (!new.lpage_info[i]) goto out_free; if (base_gfn & (KVM_PAGES_PER_HPAGE(level) - 1)) new.lpage_info[i][0].write_count = 1; if ((base_gfn+npages) & (KVM_PAGES_PER_HPAGE(level) - 1)) new.lpage_info[i][lpages - 1].write_count = 1; ugfn = new.userspace_addr >> PAGE_SHIFT; /* * If the gfn and userspace address are not aligned wrt each * other, or if explicitly asked to, disable large page * support for this slot */ if ((base_gfn ^ ugfn) & (KVM_PAGES_PER_HPAGE(level) - 1) || !largepages_enabled) for (j = 0; j < lpages; ++j) new.lpage_info[i][j].write_count = 1; } skip_lpage: /* Allocate page dirty bitmap if needed */ if ((new.flags & KVM_MEM_LOG_DIRTY_PAGES) && !new.dirty_bitmap) { if (kvm_create_dirty_bitmap(&new) < 0) goto out_free; /* destroy any largepage mappings for dirty tracking */ } #else /* not defined CONFIG_S390 */ new.user_alloc = user_alloc; if (user_alloc) new.userspace_addr = mem->userspace_addr; #endif /* not defined CONFIG_S390 */ if (!npages) { struct kvm_memory_slot *slot; r = -ENOMEM; slots = kmemdup(kvm->memslots, sizeof(struct kvm_memslots), GFP_KERNEL); if (!slots) goto out_free; slot = id_to_memslot(slots, mem->slot); slot->flags |= KVM_MEMSLOT_INVALID; update_memslots(slots, NULL); old_memslots = kvm->memslots; rcu_assign_pointer(kvm->memslots, slots); synchronize_srcu_expedited(&kvm->srcu); /* From this point no new shadow pages pointing to a deleted * memslot will be created. * * validation of sp->gfn happens in: * - gfn_to_hva (kvm_read_guest, gfn_to_pfn) * - kvm_is_visible_gfn (mmu_check_roots) */ kvm_arch_flush_shadow(kvm); kfree(old_memslots); } r = kvm_arch_prepare_memory_region(kvm, &new, old, mem, user_alloc); if (r) goto out_free; /* map/unmap the pages in iommu page table */ if (npages) { r = kvm_iommu_map_pages(kvm, &new); if (r) goto out_free; } else kvm_iommu_unmap_pages(kvm, &old); r = -ENOMEM; slots = kmemdup(kvm->memslots, sizeof(struct kvm_memslots), GFP_KERNEL); if (!slots) goto out_free; /* actual memory is freed via old in kvm_free_physmem_slot below */ if (!npages) { new.rmap = NULL; new.dirty_bitmap = NULL; for (i = 0; i < KVM_NR_PAGE_SIZES - 1; ++i) new.lpage_info[i] = NULL; } update_memslots(slots, &new); old_memslots = kvm->memslots; rcu_assign_pointer(kvm->memslots, slots); synchronize_srcu_expedited(&kvm->srcu); kvm_arch_commit_memory_region(kvm, mem, old, user_alloc); /* * If the new memory slot is created, we need to clear all * mmio sptes. */ if (npages && old.base_gfn != mem->guest_phys_addr >> PAGE_SHIFT) kvm_arch_flush_shadow(kvm); kvm_free_physmem_slot(&old, &new); kfree(old_memslots); return 0; out_free: kvm_free_physmem_slot(&new, &old); out: return r; } ",0 "void WebstoreStandaloneInstaller::OnExtensionInstallSuccess( const std::string& id) { CHECK_EQ(id_, id); CompleteInstall(webstore_install::SUCCESS, std::string()); } ",0 "static MagickBooleanType ApplyPSDLayerOpacity(Image *image,Quantum opacity, MagickBooleanType revert,ExceptionInfo *exception) { MagickBooleanType status; ssize_t y; if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" applying layer opacity %.20g"", (double) opacity); if (opacity == OpaqueAlpha) return(MagickTrue); if (image->alpha_trait != BlendPixelTrait) (void) SetImageAlphaChannel(image,OpaqueAlphaChannel,exception); status=MagickTrue; #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static) shared(status) \ magick_number_threads(image,image,image->rows,1) #endif for (y=0; y < (ssize_t) image->rows; y++) { register Quantum *magick_restrict q; register ssize_t x; if (status == MagickFalse) continue; q=GetAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) { status=MagickFalse; continue; } for (x=0; x < (ssize_t) image->columns; x++) { if (revert == MagickFalse) SetPixelAlpha(image,(Quantum) (QuantumScale*(GetPixelAlpha(image,q))* opacity),q); else if (opacity > 0) SetPixelAlpha(image,(Quantum) (QuantumRange*(GetPixelAlpha(image,q)/ (MagickRealType) opacity)),q); q+=GetPixelChannels(image); } if (SyncAuthenticPixels(image,exception) == MagickFalse) status=MagickFalse; } return(status); } ",0 "BGD_DECLARE(gdImagePtr) gdImageScale(const gdImagePtr src, const unsigned int new_width, const unsigned int new_height) { gdImagePtr im_scaled = NULL; if (src == NULL || src->interpolation_id < 0 || src->interpolation_id > GD_METHOD_COUNT) { return 0; } switch (src->interpolation_id) { /*Special cases, optimized implementations */ case GD_NEAREST_NEIGHBOUR: im_scaled = gdImageScaleNearestNeighbour(src, new_width, new_height); break; case GD_BILINEAR_FIXED: im_scaled = gdImageScaleBilinear(src, new_width, new_height); break; case GD_BICUBIC_FIXED: im_scaled = gdImageScaleBicubicFixed(src, new_width, new_height); break; /* generic */ default: if (src->interpolation == NULL) { return NULL; } im_scaled = gdImageScaleTwoPass(src, new_width, new_height); break; } return im_scaled; } ",0 "static int dvd_read_disckey(struct cdrom_device_info *cdi, dvd_struct *s, struct packet_command *cgc) { int ret, size; u_char *buf; const struct cdrom_device_ops *cdo = cdi->ops; size = sizeof(s->disckey.value) + 4; buf = kmalloc(size, GFP_KERNEL); if (!buf) return -ENOMEM; init_cdrom_command(cgc, buf, size, CGC_DATA_READ); cgc->cmd[0] = GPCMD_READ_DVD_STRUCTURE; cgc->cmd[7] = s->type; cgc->cmd[8] = size >> 8; cgc->cmd[9] = size & 0xff; cgc->cmd[10] = s->disckey.agid << 6; ret = cdo->generic_packet(cdi, cgc); if (!ret) memcpy(s->disckey.value, &buf[4], sizeof(s->disckey.value)); kfree(buf); return ret; } ",0 "void WebGLRenderingContextBase::drawElements(GLenum mode, GLsizei count, GLenum type, int64_t offset) { if (!ValidateDrawElements(""drawElements"", type, offset)) return; if (!bound_vertex_array_object_->IsAllEnabledAttribBufferBound()) { SynthesizeGLError(GL_INVALID_OPERATION, ""drawElements"", ""no buffer is bound to enabled attribute""); return; } ScopedRGBEmulationColorMask emulation_color_mask(this, color_mask_, drawing_buffer_.get()); OnBeforeDrawCall(); ContextGL()->DrawElements( mode, count, type, reinterpret_cast(static_cast(offset))); } ",0 "static int addrconf_ifid_infiniband(u8 *eui, struct net_device *dev) { if (dev->addr_len != INFINIBAND_ALEN) return -1; memcpy(eui, dev->dev_addr + 12, 8); eui[0] |= 2; return 0; } ",0 "PrepareFrameAndViewForPrint::PrepareFrameAndViewForPrint( const PrintMsg_Print_Params& params, blink::WebLocalFrame* frame, const blink::WebNode& node, bool ignore_css_margins) : frame_(frame), node_to_print_(node), owns_web_view_(false), expected_pages_count_(0), should_print_backgrounds_(params.should_print_backgrounds), should_print_selection_only_(params.selection_only), is_printing_started_(false), weak_ptr_factory_(this) { PrintMsg_Print_Params print_params = params; if (!should_print_selection_only_ || !PrintingNodeOrPdfFrame(frame, node_to_print_)) { bool fit_to_page = ignore_css_margins && print_params.print_scaling_option == blink::WebPrintScalingOptionFitToPrintableArea; ComputeWebKitPrintParamsInDesiredDpi(params, &web_print_params_); frame->printBegin(web_print_params_, node_to_print_); print_params = CalculatePrintParamsForCss( frame, 0, print_params, ignore_css_margins, fit_to_page, NULL); frame->printEnd(); } ComputeWebKitPrintParamsInDesiredDpi(print_params, &web_print_params_); } ",0 "expand(const char *s, guint recurse) { uzbl_cmdprop *c; enum exp_type etype; char *end_simple_var = ""^°!\""§$%&/()=?'`'+~*'#-.:,;@<>| \\{}[]¹²³¼½""; char *ret = NULL; char *vend = NULL; GError *err = NULL; gchar *cmd_stdout = NULL; gchar *mycmd = NULL; GString *buf = g_string_new(""""); GString *js_ret = g_string_new(""""); while(s && *s) { switch(*s) { case '\\': g_string_append_c(buf, *++s); s++; break; case '@': etype = get_exp_type(s); s++; switch(etype) { case EXP_SIMPLE_VAR: vend = strpbrk(s, end_simple_var); if(!vend) vend = strchr(s, '\0'); break; case EXP_BRACED_VAR: s++; vend = strchr(s, '}'); if(!vend) vend = strchr(s, '\0'); break; case EXP_EXPR: s++; vend = strstr(s, "")@""); if(!vend) vend = strchr(s, '\0'); break; case EXP_JS: s++; vend = strstr(s, "">@""); if(!vend) vend = strchr(s, '\0'); break; case EXP_ESCAPE: s++; vend = strstr(s, ""]@""); if(!vend) vend = strchr(s, '\0'); break; /*@notreached@*/ case EXP_ERR: break; } assert(vend); ret = g_strndup(s, vend-s); if(etype == EXP_SIMPLE_VAR || etype == EXP_BRACED_VAR) { if( (c = g_hash_table_lookup(uzbl.comm.proto_var, ret)) ) { if(c->type == TYPE_STR && *c->ptr.s != NULL) { g_string_append(buf, (gchar *)*c->ptr.s); } else if(c->type == TYPE_INT) { g_string_append_printf(buf, ""%d"", *c->ptr.i); } else if(c->type == TYPE_FLOAT) { g_string_append_printf(buf, ""%f"", *c->ptr.f); } } if(etype == EXP_SIMPLE_VAR) s = vend; else s = vend+1; } else if(recurse != 1 && etype == EXP_EXPR) { /* execute program directly */ if(ret[0] == '+') { mycmd = expand(ret+1, 1); g_spawn_command_line_sync(mycmd, &cmd_stdout, NULL, NULL, &err); g_free(mycmd); } /* execute program through shell, quote it first */ else { mycmd = expand(ret, 1); gchar *quoted = g_shell_quote(mycmd); gchar *tmp = g_strdup_printf(""%s %s"", uzbl.behave.shell_cmd?uzbl.behave.shell_cmd:""/bin/sh -c"", quoted); g_spawn_command_line_sync(tmp, &cmd_stdout, NULL, NULL, &err); g_free(mycmd); g_free(quoted); g_free(tmp); } if (err) { g_printerr(""error on running command: %s\n"", err->message); g_error_free (err); } else if (*cmd_stdout) { size_t len = strlen(cmd_stdout); if(len > 0 && cmd_stdout[len-1] == '\n') cmd_stdout[--len] = '\0'; /* strip trailing newline */ g_string_append(buf, cmd_stdout); g_free(cmd_stdout); } s = vend+2; } else if(recurse != 2 && etype == EXP_JS) { /* read JS from file */ if(ret[0] == '+') { GArray *tmp = g_array_new(TRUE, FALSE, sizeof(gchar *)); mycmd = expand(ret+1, 2); g_array_append_val(tmp, mycmd); run_external_js(uzbl.gui.web_view, tmp, js_ret); g_array_free(tmp, TRUE); } /* JS from string */ else { mycmd = expand(ret, 2); eval_js(uzbl.gui.web_view, mycmd, js_ret); g_free(mycmd); } if(js_ret->str) { g_string_append(buf, js_ret->str); g_string_free(js_ret, TRUE); js_ret = g_string_new(""""); } s = vend+2; } else if(etype == EXP_ESCAPE) { mycmd = expand(ret, 0); char *escaped = g_markup_escape_text(mycmd, strlen(mycmd)); g_string_append(buf, escaped); g_free(escaped); g_free(mycmd); s = vend+2; } g_free(ret); ret = NULL; break; default: g_string_append_c(buf, *s); s++; break; } } ",0 "static inline struct sched_entity *parent_entity(struct sched_entity *se) { return se->parent; } ",0 "bool HTMLMediaElement::IsFullscreen() const { return Fullscreen::IsFullscreenElement(*this); } ",0 " void SetUserLevelPrefValue(const std::string& app_id, bool enabled_on_lock_screen) { chromeos::NoteTakingHelper* helper = chromeos::NoteTakingHelper::Get(); ASSERT_TRUE(helper); helper->SetPreferredApp(browser()->profile(), app_id); helper->SetPreferredAppEnabledOnLockScreen(browser()->profile(), enabled_on_lock_screen); } ",0 "static ssize_t local_lgetxattr(FsContext *ctx, V9fsPath *fs_path, const char *name, void *value, size_t size) { char *path = fs_path->data; return v9fs_get_xattr(ctx, path, name, value, size); } ",0 "static int sctp_msghdr_parse(const struct msghdr *msg, sctp_cmsgs_t *cmsgs) { struct cmsghdr *cmsg; struct msghdr *my_msg = (struct msghdr *)msg; for_each_cmsghdr(cmsg, my_msg) { if (!CMSG_OK(my_msg, cmsg)) return -EINVAL; /* Should we parse this header or ignore? */ if (cmsg->cmsg_level != IPPROTO_SCTP) continue; /* Strictly check lengths following example in SCM code. */ switch (cmsg->cmsg_type) { case SCTP_INIT: /* SCTP Socket API Extension * 5.3.1 SCTP Initiation Structure (SCTP_INIT) * * This cmsghdr structure provides information for * initializing new SCTP associations with sendmsg(). * The SCTP_INITMSG socket option uses this same data * structure. This structure is not used for * recvmsg(). * * cmsg_level cmsg_type cmsg_data[] * ------------ ------------ ---------------------- * IPPROTO_SCTP SCTP_INIT struct sctp_initmsg */ if (cmsg->cmsg_len != CMSG_LEN(sizeof(struct sctp_initmsg))) return -EINVAL; cmsgs->init = CMSG_DATA(cmsg); break; case SCTP_SNDRCV: /* SCTP Socket API Extension * 5.3.2 SCTP Header Information Structure(SCTP_SNDRCV) * * This cmsghdr structure specifies SCTP options for * sendmsg() and describes SCTP header information * about a received message through recvmsg(). * * cmsg_level cmsg_type cmsg_data[] * ------------ ------------ ---------------------- * IPPROTO_SCTP SCTP_SNDRCV struct sctp_sndrcvinfo */ if (cmsg->cmsg_len != CMSG_LEN(sizeof(struct sctp_sndrcvinfo))) return -EINVAL; cmsgs->srinfo = CMSG_DATA(cmsg); if (cmsgs->srinfo->sinfo_flags & ~(SCTP_UNORDERED | SCTP_ADDR_OVER | SCTP_SACK_IMMEDIATELY | SCTP_PR_SCTP_MASK | SCTP_ABORT | SCTP_EOF)) return -EINVAL; break; case SCTP_SNDINFO: /* SCTP Socket API Extension * 5.3.4 SCTP Send Information Structure (SCTP_SNDINFO) * * This cmsghdr structure specifies SCTP options for * sendmsg(). This structure and SCTP_RCVINFO replaces * SCTP_SNDRCV which has been deprecated. * * cmsg_level cmsg_type cmsg_data[] * ------------ ------------ --------------------- * IPPROTO_SCTP SCTP_SNDINFO struct sctp_sndinfo */ if (cmsg->cmsg_len != CMSG_LEN(sizeof(struct sctp_sndinfo))) return -EINVAL; cmsgs->sinfo = CMSG_DATA(cmsg); if (cmsgs->sinfo->snd_flags & ~(SCTP_UNORDERED | SCTP_ADDR_OVER | SCTP_SACK_IMMEDIATELY | SCTP_PR_SCTP_MASK | SCTP_ABORT | SCTP_EOF)) return -EINVAL; break; default: return -EINVAL; } } return 0; } ",0 "xsltApplySequenceConstructor(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, xmlNodePtr list, xsltTemplatePtr templ) { xmlNodePtr oldInsert, oldInst, oldCurInst, oldContextNode; xmlNodePtr cur, insert, copy = NULL; int level = 0, oldVarsNr; xmlDocPtr oldLocalFragmentTop, oldLocalFragmentBase; #ifdef XSLT_REFACTORED xsltStylePreCompPtr info; #endif #ifdef WITH_DEBUGGER int addCallResult = 0; xmlNodePtr debuggedNode = NULL; #endif if (ctxt == NULL) return; #ifdef WITH_DEBUGGER if (ctxt->debugStatus != XSLT_DEBUG_NONE) { debuggedNode = xsltDebuggerStartSequenceConstructor(ctxt, contextNode, list, templ, &addCallResult); if (debuggedNode == NULL) return; } #endif if (list == NULL) return; CHECK_STOPPED; oldLocalFragmentTop = ctxt->localRVT; oldInsert = insert = ctxt->insert; oldInst = oldCurInst = ctxt->inst; oldContextNode = ctxt->node; /* * Save current number of variables on the stack; new vars are popped when * exiting. */ oldVarsNr = ctxt->varsNr; /* * Process the sequence constructor. */ cur = list; while (cur != NULL) { ctxt->inst = cur; #ifdef WITH_DEBUGGER switch (ctxt->debugStatus) { case XSLT_DEBUG_RUN_RESTART: case XSLT_DEBUG_QUIT: break; } #endif /* * Test; we must have a valid insertion point. */ if (insert == NULL) { #ifdef WITH_XSLT_DEBUG_PROCESS XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATE,xsltGenericDebug(xsltGenericDebugContext, ""xsltApplySequenceConstructor: insert == NULL !\n"")); #endif goto error; } #ifdef WITH_DEBUGGER if ((ctxt->debugStatus != XSLT_DEBUG_NONE) && (debuggedNode != cur)) xslHandleDebugger(cur, contextNode, templ, ctxt); #endif #ifdef XSLT_REFACTORED if (cur->type == XML_ELEMENT_NODE) { info = (xsltStylePreCompPtr) cur->psvi; /* * We expect a compiled representation on: * 1) XSLT instructions of this XSLT version (1.0) * (with a few exceptions) * 2) Literal result elements * 3) Extension instructions * 4) XSLT instructions of future XSLT versions * (forwards-compatible mode). */ if (info == NULL) { /* * Handle the rare cases where we don't expect a compiled * representation on an XSLT element. */ if (IS_XSLT_ELEM_FAST(cur) && IS_XSLT_NAME(cur, ""message"")) { xsltMessage(ctxt, contextNode, cur); goto skip_children; } /* * Something really went wrong: */ xsltTransformError(ctxt, NULL, cur, ""Internal error in xsltApplySequenceConstructor(): "" ""The element '%s' in the stylesheet has no compiled "" ""representation.\n"", cur->name); goto skip_children; } if (info->type == XSLT_FUNC_LITERAL_RESULT_ELEMENT) { xsltStyleItemLRElementInfoPtr lrInfo = (xsltStyleItemLRElementInfoPtr) info; /* * Literal result elements * -------------------------------------------------------- */ #ifdef WITH_XSLT_DEBUG_PROCESS XSLT_TRACE(ctxt, XSLT_TRACE_APPLY_TEMPLATE, xsltGenericDebug(xsltGenericDebugContext, ""xsltApplySequenceConstructor: copy literal result "" ""element '%s'\n"", cur->name)); #endif /* * Copy the raw element-node. * OLD: if ((copy = xsltShallowCopyElem(ctxt, cur, insert)) * == NULL) * goto error; */ copy = xmlDocCopyNode(cur, insert->doc, 0); if (copy == NULL) { xsltTransformError(ctxt, NULL, cur, ""Internal error in xsltApplySequenceConstructor(): "" ""Failed to copy literal result element '%s'.\n"", cur->name); goto error; } else { /* * Add the element-node to the result tree. */ copy->doc = ctxt->output; copy = xsltAddChild(insert, copy); /* * Create effective namespaces declarations. * OLD: xsltCopyNamespaceList(ctxt, copy, cur->nsDef); */ if (lrInfo->effectiveNs != NULL) { xsltEffectiveNsPtr effNs = lrInfo->effectiveNs; xmlNsPtr ns, lastns = NULL; while (effNs != NULL) { /* * Avoid generating redundant namespace * declarations; thus lookup if there is already * such a ns-decl in the result. */ ns = xmlSearchNs(copy->doc, copy, effNs->prefix); if ((ns != NULL) && (xmlStrEqual(ns->href, effNs->nsName))) { effNs = effNs->next; continue; } ns = xmlNewNs(copy, effNs->nsName, effNs->prefix); if (ns == NULL) { xsltTransformError(ctxt, NULL, cur, ""Internal error in "" ""xsltApplySequenceConstructor(): "" ""Failed to copy a namespace "" ""declaration.\n""); goto error; } if (lastns == NULL) copy->nsDef = ns; else lastns->next =ns; lastns = ns; effNs = effNs->next; } } /* * NOTE that we don't need to apply ns-alising: this was * already done at compile-time. */ if (cur->ns != NULL) { /* * If there's no such ns-decl in the result tree, * then xsltGetSpecialNamespace() will * create a ns-decl on the copied node. */ copy->ns = xsltGetSpecialNamespace(ctxt, cur, cur->ns->href, cur->ns->prefix, copy); } else { /* * Undeclare the default namespace if needed. * This can be skipped, if the result element has * no ns-decls, in which case the result element * obviously does not declare a default namespace; * AND there's either no parent, or the parent * element is in no namespace; this means there's no * default namespace is scope to care about. * * REVISIT: This might result in massive * generation of ns-decls if nodes in a default * namespaces are mixed with nodes in no namespace. * */ if (copy->nsDef || ((insert != NULL) && (insert->type == XML_ELEMENT_NODE) && (insert->ns != NULL))) { xsltGetSpecialNamespace(ctxt, cur, NULL, NULL, copy); } } } /* * SPEC XSLT 2.0 ""Each attribute of the literal result * element, other than an attribute in the XSLT namespace, * is processed to produce an attribute for the element in * the result tree."" * NOTE: See bug #341325. */ if (cur->properties != NULL) { xsltAttrListTemplateProcess(ctxt, copy, cur->properties); } } else if (IS_XSLT_ELEM_FAST(cur)) { /* * XSLT instructions * -------------------------------------------------------- */ if (info->type == XSLT_FUNC_UNKOWN_FORWARDS_COMPAT) { /* * We hit an unknown XSLT element. * Try to apply one of the fallback cases. */ ctxt->insert = insert; if (!xsltApplyFallbacks(ctxt, contextNode, cur)) { xsltTransformError(ctxt, NULL, cur, ""The is no fallback behaviour defined for "" ""the unknown XSLT element '%s'.\n"", cur->name); } ctxt->insert = oldInsert; } else if (info->func != NULL) { /* * Execute the XSLT instruction. */ ctxt->insert = insert; info->func(ctxt, contextNode, cur, (xsltElemPreCompPtr) info); /* * Cleanup temporary tree fragments. */ if (oldLocalFragmentTop != ctxt->localRVT) xsltReleaseLocalRVTs(ctxt, oldLocalFragmentTop); ctxt->insert = oldInsert; } else if (info->type == XSLT_FUNC_VARIABLE) { xsltStackElemPtr tmpvar = ctxt->vars; xsltParseStylesheetVariable(ctxt, cur); if (tmpvar != ctxt->vars) { /* * TODO: Using a @tmpvar is an annoying workaround, but * the current mechanisms do not provide any other way * of knowing if the var was really pushed onto the * stack. */ ctxt->vars->level = level; } } else if (info->type == XSLT_FUNC_MESSAGE) { /* * TODO: Won't be hit, since we don't compile xsl:message. */ xsltMessage(ctxt, contextNode, cur); } else { xsltTransformError(ctxt, NULL, cur, ""Unexpected XSLT element '%s'.\n"", cur->name); } goto skip_children; } else { xsltTransformFunction func; /* * Extension intructions (elements) * -------------------------------------------------------- */ if (cur->psvi == xsltExtMarker) { /* * The xsltExtMarker was set during the compilation * of extension instructions if there was no registered * handler for this specific extension function at * compile-time. * Libxslt will now lookup if a handler is * registered in the context of this transformation. */ func = (xsltTransformFunction) xsltExtElementLookup(ctxt, cur->name, cur->ns->href); } else func = ((xsltElemPreCompPtr) cur->psvi)->func; if (func == NULL) { /* * No handler available. * Try to execute fallback behaviour via xsl:fallback. */ #ifdef WITH_XSLT_DEBUG_PROCESS XSLT_TRACE(ctxt, XSLT_TRACE_APPLY_TEMPLATE, xsltGenericDebug(xsltGenericDebugContext, ""xsltApplySequenceConstructor: unknown extension %s\n"", cur->name)); #endif ctxt->insert = insert; if (!xsltApplyFallbacks(ctxt, contextNode, cur)) { xsltTransformError(ctxt, NULL, cur, ""Unknown extension instruction '{%s}%s'.\n"", cur->ns->href, cur->name); } ctxt->insert = oldInsert; } else { /* * Execute the handler-callback. */ #ifdef WITH_XSLT_DEBUG_PROCESS XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATE,xsltGenericDebug(xsltGenericDebugContext, ""xsltApplySequenceConstructor: extension construct %s\n"", cur->name)); #endif ctxt->insert = insert; /* * We need the fragment base for extension instructions * which return values (like EXSLT's function). */ oldLocalFragmentBase = ctxt->localRVTBase; ctxt->localRVTBase = NULL; func(ctxt, contextNode, cur, cur->psvi); ctxt->localRVTBase = oldLocalFragmentBase; /* * Cleanup temporary tree fragments. */ if (oldLocalFragmentTop != ctxt->localRVT) xsltReleaseLocalRVTs(ctxt, oldLocalFragmentTop); ctxt->insert = oldInsert; } goto skip_children; } } else if (XSLT_IS_TEXT_NODE(cur)) { /* * Text * ------------------------------------------------------------ */ #ifdef WITH_XSLT_DEBUG_PROCESS if (cur->name == xmlStringTextNoenc) { XSLT_TRACE(ctxt, XSLT_TRACE_APPLY_TEMPLATE, xsltGenericDebug(xsltGenericDebugContext, ""xsltApplySequenceConstructor: copy unescaped text '%s'\n"", cur->content)); } else { XSLT_TRACE(ctxt, XSLT_TRACE_APPLY_TEMPLATE, xsltGenericDebug(xsltGenericDebugContext, ""xsltApplySequenceConstructor: copy text '%s'\n"", cur->content)); } #endif if (xsltCopyText(ctxt, insert, cur, ctxt->internalized) == NULL) goto error; } #else /* XSLT_REFACTORED */ if (IS_XSLT_ELEM(cur)) { /* * This is an XSLT node */ xsltStylePreCompPtr info = (xsltStylePreCompPtr) cur->psvi; if (info == NULL) { if (IS_XSLT_NAME(cur, ""message"")) { xsltMessage(ctxt, contextNode, cur); } else { /* * That's an error try to apply one of the fallback cases */ ctxt->insert = insert; if (!xsltApplyFallbacks(ctxt, contextNode, cur)) { xsltGenericError(xsltGenericErrorContext, ""xsltApplySequenceConstructor: %s was not compiled\n"", cur->name); } ctxt->insert = oldInsert; } goto skip_children; } if (info->func != NULL) { oldCurInst = ctxt->inst; ctxt->inst = cur; ctxt->insert = insert; oldLocalFragmentBase = ctxt->localRVTBase; ctxt->localRVTBase = NULL; info->func(ctxt, contextNode, cur, (xsltElemPreCompPtr) info); ctxt->localRVTBase = oldLocalFragmentBase; /* * Cleanup temporary tree fragments. */ if (oldLocalFragmentTop != ctxt->localRVT) xsltReleaseLocalRVTs(ctxt, oldLocalFragmentTop); ctxt->insert = oldInsert; ctxt->inst = oldCurInst; goto skip_children; } if (IS_XSLT_NAME(cur, ""variable"")) { xsltStackElemPtr tmpvar = ctxt->vars; oldCurInst = ctxt->inst; ctxt->inst = cur; xsltParseStylesheetVariable(ctxt, cur); ctxt->inst = oldCurInst; if (tmpvar != ctxt->vars) { /* * TODO: Using a @tmpvar is an annoying workaround, but * the current mechanisms do not provide any other way * of knowing if the var was really pushed onto the * stack. */ ctxt->vars->level = level; } } else if (IS_XSLT_NAME(cur, ""message"")) { xsltMessage(ctxt, contextNode, cur); } else { xsltTransformError(ctxt, NULL, cur, ""Unexpected XSLT element '%s'.\n"", cur->name); } goto skip_children; } else if ((cur->type == XML_TEXT_NODE) || (cur->type == XML_CDATA_SECTION_NODE)) { /* * This text comes from the stylesheet * For stylesheets, the set of whitespace-preserving * element names consists of just xsl:text. */ #ifdef WITH_XSLT_DEBUG_PROCESS if (cur->type == XML_CDATA_SECTION_NODE) { XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATE,xsltGenericDebug(xsltGenericDebugContext, ""xsltApplySequenceConstructor: copy CDATA text %s\n"", cur->content)); } else if (cur->name == xmlStringTextNoenc) { XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATE,xsltGenericDebug(xsltGenericDebugContext, ""xsltApplySequenceConstructor: copy unescaped text %s\n"", cur->content)); } else { XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATE,xsltGenericDebug(xsltGenericDebugContext, ""xsltApplySequenceConstructor: copy text %s\n"", cur->content)); } #endif if (xsltCopyText(ctxt, insert, cur, ctxt->internalized) == NULL) goto error; } else if ((cur->type == XML_ELEMENT_NODE) && (cur->ns != NULL) && (cur->psvi != NULL)) { xsltTransformFunction function; oldCurInst = ctxt->inst; ctxt->inst = cur; /* * Flagged as an extension element */ if (cur->psvi == xsltExtMarker) function = (xsltTransformFunction) xsltExtElementLookup(ctxt, cur->name, cur->ns->href); else function = ((xsltElemPreCompPtr) cur->psvi)->func; if (function == NULL) { xmlNodePtr child; int found = 0; #ifdef WITH_XSLT_DEBUG_PROCESS XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATE,xsltGenericDebug(xsltGenericDebugContext, ""xsltApplySequenceConstructor: unknown extension %s\n"", cur->name)); #endif /* * Search if there are fallbacks */ child = cur->children; while (child != NULL) { if ((IS_XSLT_ELEM(child)) && (IS_XSLT_NAME(child, ""fallback""))) { found = 1; xsltApplySequenceConstructor(ctxt, contextNode, child->children, NULL); } child = child->next; } if (!found) { xsltTransformError(ctxt, NULL, cur, ""xsltApplySequenceConstructor: failed to find extension %s\n"", cur->name); } } else { #ifdef WITH_XSLT_DEBUG_PROCESS XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATE,xsltGenericDebug(xsltGenericDebugContext, ""xsltApplySequenceConstructor: extension construct %s\n"", cur->name)); #endif ctxt->insert = insert; /* * We need the fragment base for extension instructions * which return values (like EXSLT's function). */ oldLocalFragmentBase = ctxt->localRVTBase; ctxt->localRVTBase = NULL; function(ctxt, contextNode, cur, cur->psvi); /* * Cleanup temporary tree fragments. */ if (oldLocalFragmentTop != ctxt->localRVT) xsltReleaseLocalRVTs(ctxt, oldLocalFragmentTop); ctxt->localRVTBase = oldLocalFragmentBase; ctxt->insert = oldInsert; } ctxt->inst = oldCurInst; goto skip_children; } else if (cur->type == XML_ELEMENT_NODE) { #ifdef WITH_XSLT_DEBUG_PROCESS XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATE,xsltGenericDebug(xsltGenericDebugContext, ""xsltApplySequenceConstructor: copy node %s\n"", cur->name)); #endif oldCurInst = ctxt->inst; ctxt->inst = cur; if ((copy = xsltShallowCopyElem(ctxt, cur, insert, 1)) == NULL) goto error; /* * Add extra namespaces inherited from the current template * if we are in the first level children and this is a * ""real"" template. */ if ((templ != NULL) && (oldInsert == insert) && (ctxt->templ != NULL) && (ctxt->templ->inheritedNs != NULL)) { int i; xmlNsPtr ns, ret; for (i = 0; i < ctxt->templ->inheritedNsNr; i++) { const xmlChar *URI = NULL; xsltStylesheetPtr style; ns = ctxt->templ->inheritedNs[i]; /* Note that the XSLT namespace was already excluded * in xsltGetInheritedNsList(). */ #if 0 if (xmlStrEqual(ns->href, XSLT_NAMESPACE)) continue; #endif style = ctxt->style; while (style != NULL) { if (style->nsAliases != NULL) URI = (const xmlChar *) xmlHashLookup(style->nsAliases, ns->href); if (URI != NULL) break; style = xsltNextImport(style); } if (URI == UNDEFINED_DEFAULT_NS) continue; if (URI == NULL) URI = ns->href; /* * TODO: The following will still be buggy for the * non-refactored code. */ ret = xmlSearchNs(copy->doc, copy, ns->prefix); if ((ret == NULL) || (!xmlStrEqual(ret->href, URI))) { xmlNewNs(copy, URI, ns->prefix); } } if (copy->ns != NULL) { /* * Fix the node namespace if needed */ copy->ns = xsltGetNamespace(ctxt, cur, copy->ns, copy); } } /* * all the attributes are directly inherited */ if (cur->properties != NULL) { xsltAttrListTemplateProcess(ctxt, copy, cur->properties); } ctxt->inst = oldCurInst; } #endif /* else of XSLT_REFACTORED */ /* * Descend into content in document order. */ if (cur->children != NULL) { if (cur->children->type != XML_ENTITY_DECL) { cur = cur->children; level++; if (copy != NULL) insert = copy; continue; } } skip_children: /* * If xslt:message was just processed, we might have hit a * terminate='yes'; if so, then break the loop and clean up. * TODO: Do we need to check this also before trying to descend * into the content? */ if (ctxt->state == XSLT_STATE_STOPPED) break; if (cur->next != NULL) { cur = cur->next; continue; } do { cur = cur->parent; level--; /* * Pop variables/params (xsl:variable and xsl:param). */ if ((ctxt->varsNr > oldVarsNr) && (ctxt->vars->level > level)) { xsltLocalVariablePop(ctxt, oldVarsNr, level); } insert = insert->parent; if (cur == NULL) break; if (cur == list->parent) { cur = NULL; break; } if (cur->next != NULL) { cur = cur->next; break; } } while (cur != NULL); } error: /* * In case of errors: pop remaining variables. */ if (ctxt->varsNr > oldVarsNr) xsltLocalVariablePop(ctxt, oldVarsNr, -1); ctxt->node = oldContextNode; ctxt->inst = oldInst; ctxt->insert = oldInsert; #ifdef WITH_DEBUGGER if ((ctxt->debugStatus != XSLT_DEBUG_NONE) && (addCallResult)) { xslDropCall(); } #endif } ",0 "bool RenderFrameHostManager::InitRenderView( RenderViewHostImpl* render_view_host, RenderFrameProxyHost* proxy) { if (!render_view_host->GetProcess()->Init()) return false; if (render_view_host->IsRenderViewLive()) return true; int opener_frame_routing_id = GetOpenerRoutingID(render_view_host->GetSiteInstance()); bool created = delegate_->CreateRenderViewForRenderManager( render_view_host, opener_frame_routing_id, proxy ? proxy->GetRoutingID() : MSG_ROUTING_NONE, frame_tree_node_->devtools_frame_token(), frame_tree_node_->current_replication_state()); if (created && proxy) proxy->set_render_frame_proxy_created(true); return created; } ",0 "static int xfrm_add_acquire(struct sk_buff *skb, struct nlmsghdr *nlh, struct nlattr **attrs) { struct net *net = sock_net(skb->sk); struct xfrm_policy *xp; struct xfrm_user_tmpl *ut; int i; struct nlattr *rt = attrs[XFRMA_TMPL]; struct xfrm_mark mark; struct xfrm_user_acquire *ua = nlmsg_data(nlh); struct xfrm_state *x = xfrm_state_alloc(net); int err = -ENOMEM; if (!x) goto nomem; xfrm_mark_get(attrs, &mark); err = verify_newpolicy_info(&ua->policy); if (err) goto bad_policy; /* build an XP */ xp = xfrm_policy_construct(net, &ua->policy, attrs, &err); if (!xp) goto free_state; memcpy(&x->id, &ua->id, sizeof(ua->id)); memcpy(&x->props.saddr, &ua->saddr, sizeof(ua->saddr)); memcpy(&x->sel, &ua->sel, sizeof(ua->sel)); xp->mark.m = x->mark.m = mark.m; xp->mark.v = x->mark.v = mark.v; ut = nla_data(rt); /* extract the templates and for each call km_key */ for (i = 0; i < xp->xfrm_nr; i++, ut++) { struct xfrm_tmpl *t = &xp->xfrm_vec[i]; memcpy(&x->id, &t->id, sizeof(x->id)); x->props.mode = t->mode; x->props.reqid = t->reqid; x->props.family = ut->family; t->aalgos = ua->aalgos; t->ealgos = ua->ealgos; t->calgos = ua->calgos; err = km_query(x, t, xp); } kfree(x); kfree(xp); return 0; bad_policy: WARN(1, ""BAD policy passed\n""); free_state: kfree(x); nomem: return err; } ",0 "PasswordAccessoryControllerImpl::GetManualFillingController() { if (!mf_controller_) mf_controller_ = ManualFillingController::GetOrCreate(web_contents_); DCHECK(mf_controller_); return mf_controller_; } ",0 "int HarfBuzzShaper::offsetForPosition(float targetX) { int charactersSoFar = 0; float currentX = 0; if (m_run.rtl()) { charactersSoFar = m_normalizedBufferLength; for (int i = m_harfBuzzRuns.size() - 1; i >= 0; --i) { charactersSoFar -= m_harfBuzzRuns[i]->numCharacters(); float nextX = currentX + m_harfBuzzRuns[i]->width(); float offsetForRun = targetX - currentX; if (offsetForRun >= 0 && offsetForRun <= m_harfBuzzRuns[i]->width()) { const unsigned index = m_harfBuzzRuns[i]->characterIndexForXPosition(offsetForRun); return charactersSoFar + index; } currentX = nextX; } } else { for (unsigned i = 0; i < m_harfBuzzRuns.size(); ++i) { float nextX = currentX + m_harfBuzzRuns[i]->width(); float offsetForRun = targetX - currentX; if (offsetForRun >= 0 && offsetForRun <= m_harfBuzzRuns[i]->width()) { const unsigned index = m_harfBuzzRuns[i]->characterIndexForXPosition(offsetForRun); return charactersSoFar + index; } charactersSoFar += m_harfBuzzRuns[i]->numCharacters(); currentX = nextX; } } return charactersSoFar; } ",0 "static MemPage *btreePageFromDbPage(DbPage *pDbPage, Pgno pgno, BtShared *pBt){ MemPage *pPage = (MemPage*)sqlite3PagerGetExtra(pDbPage); if( pgno!=pPage->pgno ){ pPage->aData = sqlite3PagerGetData(pDbPage); pPage->pDbPage = pDbPage; pPage->pBt = pBt; pPage->pgno = pgno; pPage->hdrOffset = pgno==1 ? 100 : 0; } assert( pPage->aData==sqlite3PagerGetData(pDbPage) ); return pPage; } ",0 "void Element::setRegionOversetState(RegionOversetState state) { ensureElementRareData()->setRegionOversetState(state); } ",0 "static int fuse_readpages_fill(void *_data, struct page *page) { struct fuse_fill_data *data = _data; struct fuse_req *req = data->req; struct inode *inode = data->inode; struct fuse_conn *fc = get_fuse_conn(inode); fuse_wait_on_page_writeback(inode, page->index); if (req->num_pages && (req->num_pages == FUSE_MAX_PAGES_PER_REQ || (req->num_pages + 1) * PAGE_CACHE_SIZE > fc->max_read || req->pages[req->num_pages - 1]->index + 1 != page->index)) { fuse_send_readpages(req, data->file); data->req = req = fuse_get_req(fc); if (IS_ERR(req)) { unlock_page(page); return PTR_ERR(req); } } page_cache_get(page); req->pages[req->num_pages] = page; req->num_pages++; return 0; } ",0 "GF_Err nump_Size(GF_Box *s) { s->size += 8; return GF_OK; } ",0 "HeadlessWebContentsImpl::~HeadlessWebContentsImpl() { agent_host_->RemoveObserver(this); if (render_process_host_) render_process_host_->RemoveObserver(this); if (begin_frame_control_enabled_) { ui::Compositor* compositor = browser()->PlatformGetCompositor(this); DCHECK(compositor); compositor->SetExternalBeginFrameClient(nullptr); } } ",0 " void testIpSixPass() { URI_TEST_IP_SIX_PASS(""abcd::""); URI_TEST_IP_SIX_PASS(""abcd::1""); URI_TEST_IP_SIX_PASS(""abcd::12""); URI_TEST_IP_SIX_PASS(""abcd::123""); URI_TEST_IP_SIX_PASS(""abcd::1234""); URI_TEST_IP_SIX_PASS(""2001:0db8:0100:f101:0210:a4ff:fee3:9566""); // lower hex URI_TEST_IP_SIX_PASS(""2001:0DB8:0100:F101:0210:A4FF:FEE3:9566""); // Upper hex URI_TEST_IP_SIX_PASS(""2001:db8:100:f101:210:a4ff:fee3:9566""); URI_TEST_IP_SIX_PASS(""2001:0db8:100:f101:0:0:0:1""); URI_TEST_IP_SIX_PASS(""1:2:3:4:5:6:255.255.255.255""); URI_TEST_IP_SIX_PASS(""::1.2.3.4""); URI_TEST_IP_SIX_PASS(""3:4::5:1.2.3.4""); URI_TEST_IP_SIX_PASS(""::ffff:1.2.3.4""); URI_TEST_IP_SIX_PASS(""::0.0.0.0""); // Min IPv4 URI_TEST_IP_SIX_PASS(""::255.255.255.255""); // Max IPv4 URI_TEST_IP_SIX_PASS(""::1:2:3:4:5:6:7""); URI_TEST_IP_SIX_PASS(""1::1:2:3:4:5:6""); URI_TEST_IP_SIX_PASS(""1:2::1:2:3:4:5""); URI_TEST_IP_SIX_PASS(""1:2:3::1:2:3:4""); URI_TEST_IP_SIX_PASS(""1:2:3:4::1:2:3""); URI_TEST_IP_SIX_PASS(""1:2:3:4:5::1:2""); URI_TEST_IP_SIX_PASS(""1:2:3:4:5:6::1""); URI_TEST_IP_SIX_PASS(""1:2:3:4:5:6:7::""); URI_TEST_IP_SIX_PASS(""1:1:1::1:1:1:1""); URI_TEST_IP_SIX_PASS(""1:1:1::1:1:1""); URI_TEST_IP_SIX_PASS(""1:1:1::1:1""); URI_TEST_IP_SIX_PASS(""1:1::1:1""); URI_TEST_IP_SIX_PASS(""1:1::1""); URI_TEST_IP_SIX_PASS(""1::1""); URI_TEST_IP_SIX_PASS(""::1""); // == localhost URI_TEST_IP_SIX_PASS(""::""); // == all addresses URI_TEST_IP_SIX_PASS(""21ff:abcd::1""); URI_TEST_IP_SIX_PASS(""2001:db8:100:f101::1""); URI_TEST_IP_SIX_PASS(""a:b:c::12:1""); URI_TEST_IP_SIX_PASS(""a:b::0:1:2:3""); } ",0 "bool PermissionsData::HasEffectiveAccessToAllHosts() const { base::AutoLock auto_lock(runtime_lock_); return active_permissions_unsafe_->HasEffectiveAccessToAllHosts(); } ",0 " WebContents* OpenBackgroundTab(const GURL& page) { ui_test_utils::NavigateToURLWithDisposition( browser(), page, WindowOpenDisposition::NEW_BACKGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); TabStripModel* tab_strip = browser()->tab_strip_model(); WebContents* wc = tab_strip->GetWebContentsAt(tab_strip->active_index() + 1); CHECK(wc->GetVisibleURL() == page); WaitForLauncherThread(); WaitForMessageProcessing(wc); return wc; } ",0 "void PageInfoBubbleView::WebContentsDestroyed() { weak_factory_.InvalidateWeakPtrs(); } ",0 "int yr_object_structure_set_member( YR_OBJECT* object, YR_OBJECT* member) { YR_STRUCTURE_MEMBER* sm; assert(object->type == OBJECT_TYPE_STRUCTURE); if (yr_object_lookup_field(object, member->identifier) != NULL) return ERROR_DUPLICATED_STRUCTURE_MEMBER; sm = (YR_STRUCTURE_MEMBER*) yr_malloc(sizeof(YR_STRUCTURE_MEMBER)); if (sm == NULL) return ERROR_INSUFFICIENT_MEMORY; member->parent = object; sm->object = member; sm->next = ((YR_OBJECT_STRUCTURE*) object)->members; ((YR_OBJECT_STRUCTURE*) object)->members = sm; return ERROR_SUCCESS; } ",0 "ZEND_API int zend_ts_hash_compare(TsHashTable *ht1, TsHashTable *ht2, compare_func_t compar, zend_bool ordered TSRMLS_DC) { int retval; begin_read(ht1); begin_read(ht2); retval = zend_hash_compare(TS_HASH(ht1), TS_HASH(ht2), compar, ordered TSRMLS_CC); end_read(ht2); end_read(ht1); return retval; } ",0 "static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p, struct mm_struct *mm) { const struct cred *cred; unsigned int i, len; /* first copy the parameters from user space */ memset(psinfo, 0, sizeof(struct elf_prpsinfo)); len = mm->arg_end - mm->arg_start; if (len >= ELF_PRARGSZ) len = ELF_PRARGSZ-1; if (copy_from_user(&psinfo->pr_psargs, (const char __user *)mm->arg_start, len)) return -EFAULT; for(i = 0; i < len; i++) if (psinfo->pr_psargs[i] == 0) psinfo->pr_psargs[i] = ' '; psinfo->pr_psargs[len] = 0; rcu_read_lock(); psinfo->pr_ppid = task_pid_vnr(rcu_dereference(p->real_parent)); rcu_read_unlock(); psinfo->pr_pid = task_pid_vnr(p); psinfo->pr_pgrp = task_pgrp_vnr(p); psinfo->pr_sid = task_session_vnr(p); i = p->state ? ffz(~p->state) + 1 : 0; psinfo->pr_state = i; psinfo->pr_sname = (i > 5) ? '.' : ""RSDTZW""[i]; psinfo->pr_zomb = psinfo->pr_sname == 'Z'; psinfo->pr_nice = task_nice(p); psinfo->pr_flag = p->flags; rcu_read_lock(); cred = __task_cred(p); SET_UID(psinfo->pr_uid, from_kuid_munged(cred->user_ns, cred->uid)); SET_GID(psinfo->pr_gid, from_kgid_munged(cred->user_ns, cred->gid)); rcu_read_unlock(); strncpy(psinfo->pr_fname, p->comm, sizeof(psinfo->pr_fname)); return 0; } ",0 " void __init proc_root_init(void) { struct vfsmount *mnt; int err; proc_init_inodecache(); err = register_filesystem(&proc_fs_type); if (err) return; mnt = kern_mount_data(&proc_fs_type, &init_pid_ns); if (IS_ERR(mnt)) { unregister_filesystem(&proc_fs_type); return; } init_pid_ns.proc_mnt = mnt; proc_symlink(""mounts"", NULL, ""self/mounts""); proc_net_init(); #ifdef CONFIG_SYSVIPC proc_mkdir(""sysvipc"", NULL); #endif proc_mkdir(""fs"", NULL); proc_mkdir(""driver"", NULL); proc_mkdir(""fs/nfsd"", NULL); /* somewhere for the nfsd filesystem to be mounted */ #if defined(CONFIG_SUN_OPENPROMFS) || defined(CONFIG_SUN_OPENPROMFS_MODULE) /* just give it a mountpoint */ proc_mkdir(""openprom"", NULL); #endif proc_tty_init(); #ifdef CONFIG_PROC_DEVICETREE proc_device_tree_init(); #endif proc_mkdir(""bus"", NULL); proc_sys_init(); } ",1 "static void igmp_timer_expire(unsigned long data) { struct ip_mc_list *im=(struct ip_mc_list *)data; struct in_device *in_dev = im->interface; spin_lock(&im->lock); im->tm_running = 0; if (im->unsolicit_count) { im->unsolicit_count--; igmp_start_timer(im, IGMP_Unsolicited_Report_Interval); } im->reporter = 1; spin_unlock(&im->lock); if (IGMP_V1_SEEN(in_dev)) igmp_send_report(in_dev, im, IGMP_HOST_MEMBERSHIP_REPORT); else if (IGMP_V2_SEEN(in_dev)) igmp_send_report(in_dev, im, IGMPV2_HOST_MEMBERSHIP_REPORT); else igmp_send_report(in_dev, im, IGMPV3_HOST_MEMBERSHIP_REPORT); ip_ma_put(im); } ",0 "static void DisableLSOv4Permanently(PARANDIS_ADAPTER *pContext, LPCSTR procname, LPCSTR reason) { if (pContext->Offload.flagsValue & osbT4Lso) { DPrintf(0, (""[%s] Warning: %s"", procname, reason)); pContext->Offload.flagsValue &= ~osbT4Lso; ParaNdis_ResetOffloadSettings(pContext, NULL, NULL); } } ",0 "BrowserContext* DownloadItemImpl::GetBrowserContext() const { return delegate_->GetBrowserContext(); } ",0 "std::string RenderThreadImpl::GetLocale() { const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); const std::string& lang = parsed_command_line.GetSwitchValueASCII(switches::kLang); DCHECK(!lang.empty() || (!parsed_command_line.HasSwitch(switches::kRendererProcess) && !parsed_command_line.HasSwitch(switches::kPluginProcess))); return lang; } ",0 "service_manager::Connector* ServiceManagerContext::GetConnectorForIOThread() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); return g_io_thread_connector.Get().get(); } ",0 "static loff_t ui_lseek(struct file *filp, loff_t offset, int whence) { struct hfi1_devdata *dd = filp->private_data; return fixed_size_llseek(filp, offset, whence, (dd->kregend - dd->kregbase) + DC8051_DATA_MEM_SIZE); } ",0 "void tty_hangup(struct tty_struct *tty) { tty_debug_hangup(tty, ""hangup\n""); schedule_work(&tty->hangup_work); } ",0 "static void s_wrpkt(Ssh ssh, struct Packet *pkt) { int len, backlog, offset; len = s_wrpkt_prepare(ssh, pkt, &offset); backlog = s_write(ssh, pkt->data + offset, len); if (backlog > SSH_MAX_BACKLOG) ssh_throttle_all(ssh, 1, backlog); ssh_free_packet(pkt); } ",0 "LoginBubble* LockContentsView::TestApi::tooltip_bubble() const { return view_->tooltip_bubble_.get(); } ",0 "void Shell::OnWindowActivated( aura::client::ActivationChangeObserver::ActivationReason reason, aura::Window* gained_active, aura::Window* lost_active) { if (gained_active) target_root_window_ = gained_active->GetRootWindow(); } ",0 "ImageCapture* ImageCapture::Create(ExecutionContext* context, MediaStreamTrack* track, ExceptionState& exception_state) { if (track->kind() != ""video"") { exception_state.ThrowDOMException( kNotSupportedError, ""Cannot create an ImageCapturer from a non-video Track.""); return nullptr; } return new ImageCapture(context, track); } ",0 "static const TagTable_t* TagToTagTableEntry(unsigned short tag) { unsigned int i; for (i = 0; i < TAG_TABLE_SIZE; i++) { if (TagTable[i].Tag == tag) { printf(""found tag %d"", tag); int format = TagTable[i].Format; if (format == 0) { printf(""tag %s format not defined ***** YOU MUST ADD THE FORMAT TO THE TagTable in exif.c!!!!"", TagTable[i].Desc); return NULL; } return &TagTable[i]; } } printf(""tag %d NOT FOUND"", tag); return NULL; } ",0 "void rtnl_register(int protocol, int msgtype, rtnl_doit_func doit, rtnl_dumpit_func dumpit, rtnl_calcit_func calcit) { if (__rtnl_register(protocol, msgtype, doit, dumpit, calcit) < 0) panic(""Unable to register rtnetlink message handler, "" ""protocol = %d, message type = %d\n"", protocol, msgtype); } ",0 "void Document::dispose() { ASSERT_WITH_SECURITY_IMPLICATION(!m_deletionHasBegun); m_docType = 0; m_focusedElement = 0; m_hoverNode = 0; m_activeElement = 0; m_titleElement = 0; m_documentElement = 0; m_contextFeatures = ContextFeatures::defaultSwitch(); m_userActionElements.documentDidRemoveLastRef(); m_associatedFormControls.clear(); detachParser(); m_registrationContext.clear(); if (m_import) { m_import->wasDetachedFromDocument(); m_import = 0; } destroyTreeScopeData(); removeDetachedChildren(); m_formController.clear(); m_markers->detach(); m_cssCanvasElements.clear(); if (m_scriptedAnimationController) m_scriptedAnimationController->clearDocumentPointer(); m_scriptedAnimationController.clear(); if (svgExtensions()) accessSVGExtensions()->pauseAnimations(); m_lifecyle.advanceTo(DocumentLifecycle::Disposed); lifecycleNotifier()->notifyDocumentWasDisposed(); } ",0 "void WebMediaPlayerImpl::OnPictureInPictureModeEnded() { if (!client_ || client_->DisplayType() != WebMediaPlayer::DisplayType::kPictureInPicture) { return; } client_->PictureInPictureStopped(); } ",0 "poly_right(PG_FUNCTION_ARGS) { POLYGON *polya = PG_GETARG_POLYGON_P(0); POLYGON *polyb = PG_GETARG_POLYGON_P(1); bool result; result = polya->boundbox.low.x > polyb->boundbox.high.x; /* * Avoid leaking memory for toasted inputs ... needed for rtree indexes */ PG_FREE_IF_COPY(polya, 0); PG_FREE_IF_COPY(polyb, 1); PG_RETURN_BOOL(result); } ",0 "void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, int resource_id) { if (!plugin_) return; plugin_->URLRedirectResponse(allow, resource_id); } ",0 "static int xen_blkbk_map(struct xen_blkif_ring *ring, struct grant_page *pages[], int num, bool ro) { struct gnttab_map_grant_ref map[BLKIF_MAX_SEGMENTS_PER_REQUEST]; struct page *pages_to_gnt[BLKIF_MAX_SEGMENTS_PER_REQUEST]; struct persistent_gnt *persistent_gnt = NULL; phys_addr_t addr = 0; int i, seg_idx, new_map_idx; int segs_to_map = 0; int ret = 0; int last_map = 0, map_until = 0; int use_persistent_gnts; struct xen_blkif *blkif = ring->blkif; use_persistent_gnts = (blkif->vbd.feature_gnt_persistent); /* * Fill out preq.nr_sects with proper amount of sectors, and setup * assign map[..] with the PFN of the page in our domain with the * corresponding grant reference for each page. */ again: for (i = map_until; i < num; i++) { uint32_t flags; if (use_persistent_gnts) { persistent_gnt = get_persistent_gnt( ring, pages[i]->gref); } if (persistent_gnt) { /* * We are using persistent grants and * the grant is already mapped */ pages[i]->page = persistent_gnt->page; pages[i]->persistent_gnt = persistent_gnt; } else { if (get_free_page(ring, &pages[i]->page)) goto out_of_memory; addr = vaddr(pages[i]->page); pages_to_gnt[segs_to_map] = pages[i]->page; pages[i]->persistent_gnt = NULL; flags = GNTMAP_host_map; if (!use_persistent_gnts && ro) flags |= GNTMAP_readonly; gnttab_set_map_op(&map[segs_to_map++], addr, flags, pages[i]->gref, blkif->domid); } map_until = i + 1; if (segs_to_map == BLKIF_MAX_SEGMENTS_PER_REQUEST) break; } if (segs_to_map) { ret = gnttab_map_refs(map, NULL, pages_to_gnt, segs_to_map); BUG_ON(ret); } /* * Now swizzle the MFN in our domain with the MFN from the other domain * so that when we access vaddr(pending_req,i) it has the contents of * the page from the other domain. */ for (seg_idx = last_map, new_map_idx = 0; seg_idx < map_until; seg_idx++) { if (!pages[seg_idx]->persistent_gnt) { /* This is a newly mapped grant */ BUG_ON(new_map_idx >= segs_to_map); if (unlikely(map[new_map_idx].status != 0)) { pr_debug(""invalid buffer -- could not remap it\n""); put_free_pages(ring, &pages[seg_idx]->page, 1); pages[seg_idx]->handle = BLKBACK_INVALID_HANDLE; ret |= 1; goto next; } pages[seg_idx]->handle = map[new_map_idx].handle; } else { continue; } if (use_persistent_gnts && ring->persistent_gnt_c < xen_blkif_max_pgrants) { /* * We are using persistent grants, the grant is * not mapped but we might have room for it. */ persistent_gnt = kmalloc(sizeof(struct persistent_gnt), GFP_KERNEL); if (!persistent_gnt) { /* * If we don't have enough memory to * allocate the persistent_gnt struct * map this grant non-persistenly */ goto next; } persistent_gnt->gnt = map[new_map_idx].ref; persistent_gnt->handle = map[new_map_idx].handle; persistent_gnt->page = pages[seg_idx]->page; if (add_persistent_gnt(ring, persistent_gnt)) { kfree(persistent_gnt); persistent_gnt = NULL; goto next; } pages[seg_idx]->persistent_gnt = persistent_gnt; pr_debug(""grant %u added to the tree of persistent grants, using %u/%u\n"", persistent_gnt->gnt, ring->persistent_gnt_c, xen_blkif_max_pgrants); goto next; } if (use_persistent_gnts && !blkif->vbd.overflow_max_grants) { blkif->vbd.overflow_max_grants = 1; pr_debug(""domain %u, device %#x is using maximum number of persistent grants\n"", blkif->domid, blkif->vbd.handle); } /* * We could not map this grant persistently, so use it as * a non-persistent grant. */ next: new_map_idx++; } segs_to_map = 0; last_map = map_until; if (map_until != num) goto again; return ret; out_of_memory: pr_alert(""%s: out of memory\n"", __func__); put_free_pages(ring, pages_to_gnt, segs_to_map); return -ENOMEM; } ",0 "_dbus_header_set_field_basic (DBusHeader *header, int field, int type, const void *value) { _dbus_assert (field <= DBUS_HEADER_FIELD_LAST); if (!reserve_header_padding (header)) return FALSE; /* If the field exists we set, otherwise we append */ if (_dbus_header_cache_check (header, field)) { DBusTypeReader reader; DBusTypeReader realign_root; if (!find_field_for_modification (header, field, &reader, &realign_root)) _dbus_assert_not_reached (""field was marked present in cache but wasn't found""); if (!set_basic_field (&reader, field, type, value, &realign_root)) return FALSE; } else { DBusTypeWriter writer; DBusTypeWriter array; _dbus_type_writer_init_values_only (&writer, header->byte_order, &_dbus_header_signature_str, FIELDS_ARRAY_SIGNATURE_OFFSET, &header->data, FIELDS_ARRAY_LENGTH_OFFSET); /* recurse into array without creating a new length, and jump to * end of array. */ if (!_dbus_type_writer_append_array (&writer, &_dbus_header_signature_str, FIELDS_ARRAY_ELEMENT_SIGNATURE_OFFSET, &array)) _dbus_assert_not_reached (""recurse into ARRAY should not have used memory""); _dbus_assert (array.u.array.len_pos == FIELDS_ARRAY_LENGTH_OFFSET); _dbus_assert (array.u.array.start_pos == FIRST_FIELD_OFFSET); _dbus_assert (array.value_pos == HEADER_END_BEFORE_PADDING (header)); if (!write_basic_field (&array, field, type, value)) return FALSE; if (!_dbus_type_writer_unrecurse (&writer, &array)) _dbus_assert_not_reached (""unrecurse from ARRAY should not have used memory""); } correct_header_padding (header); /* We could be smarter about this (only invalidate fields after the * one we modified, or even only if the one we modified changed * length). But this hack is a start. */ _dbus_header_cache_invalidate_all (header); return TRUE; } ",0 "void TabLifecycleUnitSource::TabLifecycleUnit::SetAutoDiscardable( bool auto_discardable) { if (auto_discardable_ == auto_discardable) return; auto_discardable_ = auto_discardable; for (auto& observer : *observers_) observer.OnAutoDiscardableStateChange(GetWebContents(), auto_discardable_); } ",0 "JSTestInterfaceConstructor::JSTestInterfaceConstructor(Structure* structure, JSDOMGlobalObject* globalObject) : DOMConstructorObject(structure, globalObject) { } ",0 "int HttpProxyClientSocket::RestartWithAuth(const CompletionCallback& callback) { DCHECK_EQ(STATE_NONE, next_state_); DCHECK(user_callback_.is_null()); int rv = PrepareForAuthRestart(); if (rv != OK) return rv; rv = DoLoop(OK); if (rv == ERR_IO_PENDING) { if (!callback.is_null()) user_callback_ = callback; } return rv; } ",0 "ssh_packet_have_data_to_write(struct ssh *ssh) { return sshbuf_len(ssh->state->output) != 0; } ",0 "bool RequestFrame(WebContents* web_contents) { DCHECK(web_contents); return RenderWidgetHostImpl::From( web_contents->GetRenderViewHost()->GetWidget()) ->ScheduleComposite(); } ",0 " ExtensionsGuestViewMessageFilter::~ExtensionsGuestViewMessageFilter() { DCHECK_CURRENTLY_ON(BrowserThread::IO); (*GetProcessIdToFilterMap())[render_process_id_] = nullptr; base::PostTaskWithTraits( FROM_HERE, BrowserThread::UI, base::BindOnce(RemoveProcessIdFromGlobalMap, render_process_id_)); } ",1 "static ssize_t show_port_name(struct device *dev, struct device_attribute *attr, char *buffer) { struct port *port; port = dev_get_drvdata(dev); return sprintf(buffer, ""%s\n"", port->name); } ",0 "void Location::setHash(LocalDOMWindow* current_window, LocalDOMWindow* entered_window, const String& hash, ExceptionState& exception_state) { KURL url = GetDocument()->Url(); String old_fragment_identifier = url.FragmentIdentifier(); String new_fragment_identifier = hash; if (hash[0] == '#') new_fragment_identifier = hash.Substring(1); url.SetFragmentIdentifier(new_fragment_identifier); if (EqualIgnoringNullity(old_fragment_identifier, url.FragmentIdentifier())) return; SetLocation(url.GetString(), current_window, entered_window, &exception_state); } ",0 "bool PrintRenderFrameHelper::UpdatePrintSettings( blink::WebLocalFrame* frame, const blink::WebNode& node, const base::DictionaryValue& passed_job_settings) { const base::DictionaryValue* job_settings = &passed_job_settings; base::DictionaryValue modified_job_settings; if (job_settings->empty()) { print_preview_context_.set_error(PREVIEW_ERROR_BAD_SETTING); return false; } bool source_is_html = !PrintingNodeOrPdfFrame(frame, node); if (!source_is_html) { modified_job_settings.MergeDictionary(job_settings); modified_job_settings.SetBoolean(kSettingHeaderFooterEnabled, false); modified_job_settings.SetInteger(kSettingMarginsType, NO_MARGINS); job_settings = &modified_job_settings; } int cookie = print_pages_params_ ? print_pages_params_->params.document_cookie : 0; PrintMsg_PrintPages_Params settings; bool canceled = false; Send(new PrintHostMsg_UpdatePrintSettings(routing_id(), cookie, *job_settings, &settings, &canceled)); if (canceled) { notify_browser_of_print_failure_ = false; return false; } if (!job_settings->GetInteger(kPreviewUIID, &settings.params.preview_ui_id)) { NOTREACHED(); print_preview_context_.set_error(PREVIEW_ERROR_BAD_SETTING); return false; } if (!job_settings->GetInteger(kPreviewRequestID, &settings.params.preview_request_id) || !job_settings->GetBoolean(kIsFirstRequest, &settings.params.is_first_request)) { NOTREACHED(); print_preview_context_.set_error(PREVIEW_ERROR_BAD_SETTING); return false; } settings.params.print_to_pdf = IsPrintToPdfRequested(*job_settings); UpdateFrameMarginsCssInfo(*job_settings); settings.params.print_scaling_option = GetPrintScalingOption( frame, node, source_is_html, *job_settings, settings.params); SetPrintPagesParams(settings); if (PrintMsg_Print_Params_IsValid(settings.params)) return true; print_preview_context_.set_error(PREVIEW_ERROR_INVALID_PRINTER_SETTINGS); return false; } ",0 " StatusController* status() { return session_->status_controller(); } ",0 "void AssignGLRectangle(GLint rectangle[4], GLint x, GLint y, GLint width, GLint height) { rectangle[0] = x; rectangle[1] = y; rectangle[2] = width; rectangle[3] = height; } ",0 "PPB_URLLoader_API* PPB_URLLoader_Impl::AsPPB_URLLoader_API() { return this; } ",0 " void ClickResetButton() { ASSERT_TRUE(JSExecuted(""$('reset-button').click();"")); } ",0 "void RenderFrameImpl::didClearWindowObject(blink::WebLocalFrame* frame) { DCHECK(!frame_ || frame_ == frame); int enabled_bindings = render_view_->GetEnabledBindings(); if (enabled_bindings & BINDINGS_POLICY_WEB_UI) WebUIExtension::Install(frame); if (enabled_bindings & BINDINGS_POLICY_DOM_AUTOMATION) DomAutomationController::Install(this, frame); if (enabled_bindings & BINDINGS_POLICY_STATS_COLLECTION) StatsCollectionController::Install(frame); const base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess(); if (command_line.HasSwitch(cc::switches::kEnableGpuBenchmarking)) GpuBenchmarking::Install(frame); if (command_line.HasSwitch(switches::kEnableMemoryBenchmarking)) MemoryBenchmarkingExtension::Install(frame); if (command_line.HasSwitch(switches::kEnableSkiaBenchmarking)) SkiaBenchmarking::Install(frame); FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), DidClearWindowObject(frame)); FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidClearWindowObject()); } ",0 "release_files(struct iso9660 *iso9660) { struct content *con, *connext; struct file_info *file; file = iso9660->use_files; while (file != NULL) { struct file_info *next = file->use_next; archive_string_free(&file->name); archive_string_free(&file->symlink); free(file->utf16be_name); con = file->contents.first; while (con != NULL) { connext = con->next; free(con); con = connext; } free(file); file = next; } } ",0 "bool StreamingProcessor::haveValidPreviewWindow() const { Mutex::Autolock m(mMutex); return mPreviewWindow != 0; } ",0 "void AppendGzippedResource(const base::RefCountedMemory& encoded, std::string* to_append) { std::unique_ptr source_stream( new net::MockSourceStream()); source_stream->AddReadResult(encoded.front_as(), encoded.size(), net::OK, net::MockSourceStream::SYNC); source_stream->AddReadResult(encoded.front_as() + encoded.size(), 0, net::OK, net::MockSourceStream::SYNC); std::unique_ptr filter = net::GzipSourceStream::Create( std::move(source_stream), net::SourceStream::TYPE_GZIP); scoped_refptr dest_buffer = new net::IOBufferWithSize(4096); net::CompletionCallback callback; while (true) { int rv = filter->Read(dest_buffer.get(), dest_buffer->size(), callback); ASSERT_LE(0, rv); if (rv <= 0) break; to_append->append(dest_buffer->data(), rv); } } ",0 "QList Smb4KGlobal::sharedResources(Smb4KHost *host) { QList shares; mutex.lock(); for (Smb4KShare *s : p->sharesList) { if (QString::compare(s->hostName(), host->hostName(), Qt::CaseInsensitive) == 0 && QString::compare(s->workgroupName(), host->workgroupName(), Qt::CaseInsensitive) == 0) { shares += s; } else { } } mutex.unlock(); return shares; } ",0 "void PDFiumEngine::AddFindResult(const PDFiumRange& result) { size_t result_index; int page_index = result.page_index(); int char_index = result.char_index(); for (result_index = 0; result_index < find_results_.size(); ++result_index) { if (find_results_[result_index].page_index() > page_index || (find_results_[result_index].page_index() == page_index && find_results_[result_index].char_index() > char_index)) { break; } } find_results_.insert(find_results_.begin() + result_index, result); UpdateTickMarks(); client_->NotifyNumberOfFindResultsChanged(find_results_.size(), false); } ",0 " void Finalize() { manager_->EndSession(client_.get()); } ",0 "IntPoint WebPagePrivate::scrollPosition() const { return m_backingStoreClient->scrollPosition(); } ",0 "static inline void VectorClamp3(DDSVector3 *value) { value->x = MinF(1.0f,MaxF(0.0f,value->x)); value->y = MinF(1.0f,MaxF(0.0f,value->y)); value->z = MinF(1.0f,MaxF(0.0f,value->z)); } ",0 "static int nbd_errno_to_system_errno(int err) { int ret; switch (err) { case NBD_SUCCESS: ret = 0; break; case NBD_EPERM: ret = EPERM; break; case NBD_EIO: ret = EIO; break; case NBD_ENOMEM: ret = ENOMEM; break; case NBD_ENOSPC: ret = ENOSPC; break; case NBD_ESHUTDOWN: ret = ESHUTDOWN; break; default: TRACE(""Squashing unexpected error %d to EINVAL"", err); /* fallthrough */ case NBD_EINVAL: ret = EINVAL; break; } return ret; } ",0 "static int oppop(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; int offset = 0; int mod = 0; if (op->operands[0].type & OT_GPREG) { if (op->operands[0].type & OT_MEMORY) { return -1; } if (op->operands[0].type & OT_REGTYPE & OT_SEGMENTREG) { ut8 base; if (op->operands[0].reg & X86R_FS) { data[l++] = 0x0f; base = 0x81; } else { base = 0x7; } data[l++] = base + (8 * op->operands[0].reg); } else { ut8 base = 0x58; data[l++] = base + op->operands[0].reg; } } else if (op->operands[0].type & OT_MEMORY) { data[l++] = 0x8f; offset = op->operands[0].offset * op->operands[0].offset_sign; if (offset != 0 || op->operands[0].regs[0] == X86R_EBP) { mod = 1; if (offset >= 128 || offset < -128) { mod = 2; } data[l++] = mod << 6 | op->operands[0].regs[0]; if (op->operands[0].regs[0] == X86R_ESP) { data[l++] = 0x24; } data[l++] = offset; if (mod == 2) { data[l++] = offset >> 8; data[l++] = offset >> 16; data[l++] = offset >> 24; } } else { data[l++] = op->operands[0].regs[0]; if (op->operands[0].regs[0] == X86R_ESP) { data[l++] = 0x24; } } } return l; } ",0 "static int dsa_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey) { DSA *dsa; int ptype; unsigned char *penc = NULL; int penclen; ASN1_STRING *str = NULL; dsa = pkey->pkey.dsa; if (pkey->save_parameters && dsa->p && dsa->q && dsa->g) { str = ASN1_STRING_new(); if (!str) { DSAerr(DSA_F_DSA_PUB_ENCODE, ERR_R_MALLOC_FAILURE); goto err; } str->length = i2d_DSAparams(dsa, &str->data); if (str->length <= 0) { DSAerr(DSA_F_DSA_PUB_ENCODE, ERR_R_MALLOC_FAILURE); goto err; } ptype = V_ASN1_SEQUENCE; } else ptype = V_ASN1_UNDEF; dsa->write_params = 0; penclen = i2d_DSAPublicKey(dsa, &penc); if (penclen <= 0) { DSAerr(DSA_F_DSA_PUB_ENCODE, ERR_R_MALLOC_FAILURE); goto err; } if (X509_PUBKEY_set0_param(pk, OBJ_nid2obj(EVP_PKEY_DSA), ptype, str, penc, penclen)) return 1; err: if (penc) OPENSSL_free(penc); if (str) ASN1_STRING_free(str); return 0; } ",0 "int SocketStream::DoSOCKSConnectComplete(int result) { DCHECK_EQ(kSOCKSProxy, proxy_mode_); if (result == OK) { if (is_secure()) next_state_ = STATE_SSL_CONNECT; else result = DidEstablishConnection(); } else { next_state_ = STATE_CLOSE; } return result; } ",0 "void BlinkTestRunner::Reset() { proxy_->set_widget(render_view()->GetWebView()); proxy_->Reset(); prefs_.Reset(); routing_ids_.clear(); session_histories_.clear(); current_entry_indexes_.clear(); render_view()->ClearEditCommands(); if (render_view()->GetWebView()->mainFrame()->isWebLocalFrame()) render_view()->GetWebView()->mainFrame()->setName(WebString()); render_view()->GetWebView()->mainFrame()->clearOpener(); if (render_view()->GetWebView()->mainFrame()->isWebLocalFrame()) { WebTestingSupport::resetInternalsObject( render_view()->GetWebView()->mainFrame()->toWebLocalFrame()); render_view()->SetWebkitPreferences(render_view()->GetWebkitPreferences()); } } ",0 "void Document::maybeHandleHttpRefresh(const String& content, HttpRefreshType httpRefreshType) { if (m_isViewSource || !m_frame) return; double delay; String refreshURL; if (!parseHTTPRefresh(content, httpRefreshType == HttpRefreshFromMetaTag, delay, refreshURL)) return; if (refreshURL.isEmpty()) refreshURL = url().string(); else refreshURL = completeURL(refreshURL).string(); if (protocolIsJavaScript(refreshURL)) { String message = ""Refused to refresh "" + m_url.elidedString() + "" to a javascript: URL""; addConsoleMessage(ConsoleMessage::create(SecurityMessageSource, ErrorMessageLevel, message)); return; } if (httpRefreshType == HttpRefreshFromMetaTag && isSandboxed(SandboxAutomaticFeatures)) { String message = ""Refused to execute the redirect specified via ''. The document is sandboxed, and the 'allow-scripts' keyword is not set.""; addConsoleMessage(ConsoleMessage::create(SecurityMessageSource, ErrorMessageLevel, message)); return; } m_frame->navigationScheduler().scheduleRedirect(delay, refreshURL); } ",0 "void UserSelectionScreen::SendUserList() { std::unique_ptr users_list = UpdateAndReturnUserListForWebUI(); handler_->LoadUsers(users_to_send_, *users_list); } ",0 "void MarkingVisitor::ConservativelyMarkAddress( BasePage* page, Address address, MarkedPointerCallbackForTesting callback) { DCHECK(page->Contains(address)); HeapObjectHeader* const header = page->IsLargeObjectPage() ? static_cast(page)->GetHeapObjectHeader() : static_cast(page)->FindHeaderFromAddress(address); if (!header) return; if (!callback(header)) ConservativelyMarkHeader(header); } ",0 "bool NormalizeFilePath(const FilePath& path, FilePath* normalized_path) { FilePath real_path_result; if (!RealPath(path, &real_path_result)) return false; stat_wrapper_t file_info; if (CallStat(real_path_result.value().c_str(), &file_info) != 0 || S_ISDIR(file_info.st_mode)) return false; *normalized_path = real_path_result; return true; } ",0 "static void tcp_sack_remove(struct tcp_sock *tp) { struct tcp_sack_block *sp = &tp->selective_acks[0]; int num_sacks = tp->rx_opt.num_sacks; int this_sack; /* Empty ofo queue, hence, all the SACKs are eaten. Clear. */ if (skb_queue_empty(&tp->out_of_order_queue)) { tp->rx_opt.num_sacks = 0; return; } for (this_sack = 0; this_sack < num_sacks;) { /* Check if the start of the sack is covered by RCV.NXT. */ if (!before(tp->rcv_nxt, sp->start_seq)) { int i; /* RCV.NXT must cover all the block! */ WARN_ON(before(tp->rcv_nxt, sp->end_seq)); /* Zap this SACK, by moving forward any other SACKS. */ for (i=this_sack+1; i < num_sacks; i++) tp->selective_acks[i-1] = tp->selective_acks[i]; num_sacks--; continue; } this_sack++; sp++; } tp->rx_opt.num_sacks = num_sacks; } ",0 "LinkImport* HTMLLinkElement::GetLinkImport() const { if (!link_ || link_->GetType() != LinkResource::kImport) return nullptr; return static_cast(link_.Get()); } ",0 "hook_config_exec (const char *option, const char *value) { struct t_hook *ptr_hook, *next_hook; hook_exec_start (); ptr_hook = weechat_hooks[HOOK_TYPE_CONFIG]; while (ptr_hook) { next_hook = ptr_hook->next_hook; if (!ptr_hook->deleted && !ptr_hook->running && (!HOOK_CONFIG(ptr_hook, option) || (string_match (option, HOOK_CONFIG(ptr_hook, option), 0)))) { ptr_hook->running = 1; (void) (HOOK_CONFIG(ptr_hook, callback)) (ptr_hook->callback_data, option, value); ptr_hook->running = 0; } ptr_hook = next_hook; } hook_exec_end (); } ",0 "struct key *request_key_and_link(struct key_type *type, const char *description, const void *callout_info, size_t callout_len, void *aux, struct key *dest_keyring, unsigned long flags) { struct keyring_search_context ctx = { .index_key.type = type, .index_key.description = description, .cred = current_cred(), .match_data.cmp = key_default_cmp, .match_data.raw_data = description, .match_data.lookup_type = KEYRING_SEARCH_LOOKUP_DIRECT, .flags = (KEYRING_SEARCH_DO_STATE_CHECK | KEYRING_SEARCH_SKIP_EXPIRED), }; struct key *key; key_ref_t key_ref; int ret; kenter(""%s,%s,%p,%zu,%p,%p,%lx"", ctx.index_key.type->name, ctx.index_key.description, callout_info, callout_len, aux, dest_keyring, flags); if (type->match_preparse) { ret = type->match_preparse(&ctx.match_data); if (ret < 0) { key = ERR_PTR(ret); goto error; } } /* search all the process keyrings for a key */ key_ref = search_process_keyrings(&ctx); if (!IS_ERR(key_ref)) { key = key_ref_to_ptr(key_ref); if (dest_keyring) { ret = key_link(dest_keyring, key); if (ret < 0) { key_put(key); key = ERR_PTR(ret); goto error_free; } } } else if (PTR_ERR(key_ref) != -EAGAIN) { key = ERR_CAST(key_ref); } else { /* the search failed, but the keyrings were searchable, so we * should consult userspace if we can */ key = ERR_PTR(-ENOKEY); if (!callout_info) goto error_free; key = construct_key_and_link(&ctx, callout_info, callout_len, aux, dest_keyring, flags); } error_free: if (type->match_free) type->match_free(&ctx.match_data); error: kleave("" = %p"", key); return key; } ",0 "bool HTMLTextAreaElement::tooLong(const String& value, NeedsToCheckDirtyFlag check) const { if (check == CheckDirtyFlag && !lastChangeWasUserEdit()) return false; int max = maxLength(); if (max < 0) return false; return computeLengthForSubmission(value) > static_cast(max); } ",0 "nfssvc_decode_readargs(struct svc_rqst *rqstp, __be32 *p, struct nfsd_readargs *args) { unsigned int len; int v; p = decode_fh(p, &args->fh); if (!p) return 0; args->offset = ntohl(*p++); len = args->count = ntohl(*p++); p++; /* totalcount - unused */ len = min_t(unsigned int, len, NFSSVC_MAXBLKSIZE_V2); /* set up somewhere to store response. * We take pages, put them on reslist and include in iovec */ v=0; while (len > 0) { struct page *p = *(rqstp->rq_next_page++); rqstp->rq_vec[v].iov_base = page_address(p); rqstp->rq_vec[v].iov_len = min_t(unsigned int, len, PAGE_SIZE); len -= rqstp->rq_vec[v].iov_len; v++; } args->vlen = v; return xdr_argsize_check(rqstp, p); } ",0 "SkBitmap Browser::GetCurrentPageIcon() const { TabContents* contents = GetSelectedTabContents(); return contents ? contents->GetFavicon() : SkBitmap(); } ",0 "bool ChromeContentBrowserClient::WillCreateURLLoaderFactory( content::BrowserContext* browser_context, content::RenderFrameHost* frame, bool is_navigation, const url::Origin& request_initiator, network::mojom::URLLoaderFactoryRequest* factory_request, bool* bypass_redirect_checks) { DCHECK(base::FeatureList::IsEnabled(network::features::kNetworkService)); bool use_proxy = false; #if BUILDFLAG(ENABLE_EXTENSIONS) auto* web_request_api = extensions::BrowserContextKeyedAPIFactory::Get( browser_context); if (web_request_api) { bool use_proxy_for_web_request = web_request_api->MaybeProxyURLLoaderFactory(frame, is_navigation, factory_request); if (bypass_redirect_checks) *bypass_redirect_checks = use_proxy_for_web_request; use_proxy |= use_proxy_for_web_request; } #endif use_proxy |= signin::ProxyingURLLoaderFactory::MaybeProxyRequest( frame, is_navigation, request_initiator, factory_request); return use_proxy; } ",0 "nvmet_fc_alloc_tgt_pgs(struct nvmet_fc_fcp_iod *fod) { struct scatterlist *sg; struct page *page; unsigned int nent; u32 page_len, length; int i = 0; length = fod->total_length; nent = DIV_ROUND_UP(length, PAGE_SIZE); sg = kmalloc_array(nent, sizeof(struct scatterlist), GFP_KERNEL); if (!sg) goto out; sg_init_table(sg, nent); while (length) { page_len = min_t(u32, length, PAGE_SIZE); page = alloc_page(GFP_KERNEL); if (!page) goto out_free_pages; sg_set_page(&sg[i], page, page_len, 0); length -= page_len; i++; } fod->data_sg = sg; fod->data_sg_cnt = nent; fod->data_sg_cnt = fc_dma_map_sg(fod->tgtport->dev, sg, nent, ((fod->io_dir == NVMET_FCP_WRITE) ? DMA_FROM_DEVICE : DMA_TO_DEVICE)); /* note: write from initiator perspective */ return 0; out_free_pages: while (i > 0) { i--; __free_page(sg_page(&sg[i])); } kfree(sg); fod->data_sg = NULL; fod->data_sg_cnt = 0; out: return NVME_SC_INTERNAL; } ",0 "void IndexedDBDatabase::OpenConnection( std::unique_ptr connection) { AppendRequest(std::make_unique(this, std::move(connection))); } ",0 "struct dentry *lock_rename(struct dentry *p1, struct dentry *p2) { struct dentry *p; if (p1 == p2) { inode_lock_nested(p1->d_inode, I_MUTEX_PARENT); return NULL; } mutex_lock(&p1->d_sb->s_vfs_rename_mutex); p = d_ancestor(p2, p1); if (p) { inode_lock_nested(p2->d_inode, I_MUTEX_PARENT); inode_lock_nested(p1->d_inode, I_MUTEX_CHILD); return p; } p = d_ancestor(p1, p2); if (p) { inode_lock_nested(p1->d_inode, I_MUTEX_PARENT); inode_lock_nested(p2->d_inode, I_MUTEX_CHILD); return p; } inode_lock_nested(p1->d_inode, I_MUTEX_PARENT); inode_lock_nested(p2->d_inode, I_MUTEX_PARENT2); return NULL; } ",0 "static int mxf_get_sorted_table_segments(MXFContext *mxf, int *nb_sorted_segments, MXFIndexTableSegment ***sorted_segments) { int i, j, nb_segments = 0; MXFIndexTableSegment **unsorted_segments; int last_body_sid = -1, last_index_sid = -1, last_index_start = -1; /* count number of segments, allocate arrays and copy unsorted segments */ for (i = 0; i < mxf->metadata_sets_count; i++) if (mxf->metadata_sets[i]->type == IndexTableSegment) nb_segments++; if (!nb_segments) return AVERROR_INVALIDDATA; if (!(unsorted_segments = av_calloc(nb_segments, sizeof(*unsorted_segments))) || !(*sorted_segments = av_calloc(nb_segments, sizeof(**sorted_segments)))) { av_freep(sorted_segments); av_free(unsorted_segments); return AVERROR(ENOMEM); } for (i = j = 0; i < mxf->metadata_sets_count; i++) if (mxf->metadata_sets[i]->type == IndexTableSegment) unsorted_segments[j++] = (MXFIndexTableSegment*)mxf->metadata_sets[i]; *nb_sorted_segments = 0; /* sort segments by {BodySID, IndexSID, IndexStartPosition}, remove duplicates while we're at it */ for (i = 0; i < nb_segments; i++) { int best = -1, best_body_sid = -1, best_index_sid = -1, best_index_start = -1; uint64_t best_index_duration = 0; for (j = 0; j < nb_segments; j++) { MXFIndexTableSegment *s = unsorted_segments[j]; /* Require larger BosySID, IndexSID or IndexStartPosition then the previous entry. This removes duplicates. * We want the smallest values for the keys than what we currently have, unless this is the first such entry this time around. * If we come across an entry with the same IndexStartPosition but larger IndexDuration, then we'll prefer it over the one we currently have. */ if ((i == 0 || s->body_sid > last_body_sid || s->body_sid == last_body_sid && s->index_sid > last_index_sid || s->body_sid == last_body_sid && s->index_sid == last_index_sid && s->index_start_position > last_index_start) && (best == -1 || s->body_sid < best_body_sid || s->body_sid == best_body_sid && s->index_sid < best_index_sid || s->body_sid == best_body_sid && s->index_sid == best_index_sid && s->index_start_position < best_index_start || s->body_sid == best_body_sid && s->index_sid == best_index_sid && s->index_start_position == best_index_start && s->index_duration > best_index_duration)) { best = j; best_body_sid = s->body_sid; best_index_sid = s->index_sid; best_index_start = s->index_start_position; best_index_duration = s->index_duration; } } /* no suitable entry found -> we're done */ if (best == -1) break; (*sorted_segments)[(*nb_sorted_segments)++] = unsorted_segments[best]; last_body_sid = best_body_sid; last_index_sid = best_index_sid; last_index_start = best_index_start; } av_free(unsorted_segments); return 0; } ",0 "bool SVGImage::dataChanged(bool allDataReceived) { TRACE_EVENT0(""webkit"", ""SVGImage::dataChanged""); if (!data()->size()) return true; if (allDataReceived) { static FrameLoaderClient* dummyFrameLoaderClient = new EmptyFrameLoaderClient; Page::PageClients pageClients; fillWithEmptyClients(pageClients); m_chromeClient = adoptPtr(new SVGImageChromeClient(this)); pageClients.chromeClient = m_chromeClient.get(); m_page = adoptPtr(new Page(pageClients)); m_page->settings().setScriptEnabled(false); m_page->settings().setPluginsEnabled(false); m_page->settings().setAcceleratedCompositingEnabled(false); RefPtr frame = LocalFrame::create(FrameInit::create(&m_page->frameHost(), dummyFrameLoaderClient)); frame->setView(FrameView::create(frame.get())); frame->init(); FrameLoader& loader = frame->loader(); loader.forceSandboxFlags(SandboxAll); frame->view()->setScrollbarsSuppressed(true); frame->view()->setCanHaveScrollbars(false); // SVG Images will always synthesize a viewBox, if it's not available, and thus never see scrollbars. frame->view()->setTransparent(true); // SVG Images are transparent. loader.load(FrameLoadRequest(0, blankURL(), SubstituteData(data(), ""image/svg+xml"", ""UTF-8"", KURL(), ForceSynchronousLoad))); m_intrinsicSize = containerSize(); } return m_page; } ",0 "int64 MakeServerNode(UserShare* share, ModelType model_type, const std::string& client_tag, const std::string& hashed_tag, const sync_pb::EntitySpecifics& specifics) { syncable::WriteTransaction trans( FROM_HERE, syncable::UNITTEST, share->directory.get()); syncable::Entry root_entry(&trans, syncable::GET_BY_SERVER_TAG, syncable::ModelTypeToRootTag(model_type)); EXPECT_TRUE(root_entry.good()); syncable::Id root_id = root_entry.Get(syncable::ID); syncable::Id node_id = syncable::Id::CreateFromServerId(client_tag); syncable::MutableEntry entry(&trans, syncable::CREATE_NEW_UPDATE_ITEM, node_id); EXPECT_TRUE(entry.good()); entry.Put(syncable::BASE_VERSION, 1); entry.Put(syncable::SERVER_VERSION, 1); entry.Put(syncable::IS_UNAPPLIED_UPDATE, false); entry.Put(syncable::SERVER_PARENT_ID, root_id); entry.Put(syncable::PARENT_ID, root_id); entry.Put(syncable::SERVER_IS_DIR, false); entry.Put(syncable::IS_DIR, false); entry.Put(syncable::SERVER_SPECIFICS, specifics); entry.Put(syncable::NON_UNIQUE_NAME, client_tag); entry.Put(syncable::UNIQUE_CLIENT_TAG, hashed_tag); entry.Put(syncable::IS_DEL, false); entry.Put(syncable::SPECIFICS, specifics); return entry.Get(syncable::META_HANDLE); } ",0 "static int cp2112_i2c_write_req(void *buf, u8 slave_address, u8 *data, u8 data_length) { struct cp2112_write_req_report *report = buf; if (data_length > sizeof(report->data)) return -EINVAL; report->report = CP2112_DATA_WRITE_REQUEST; report->slave_address = slave_address << 1; report->length = data_length; memcpy(report->data, data, data_length); return data_length + 3; } ",0 "static void php_free_ps_enc(zend_rsrc_list_entry *rsrc TSRMLS_DC) { char **enc = (char **) rsrc->ptr; T1_DeleteEncoding(enc); } ",0 "ExtensionInfo* ExtensionPrefs::GetInstalledExtensionInfo( const std::string& extension_id) { scoped_ptr extension_data(CopyCurrentExtensions()); for (DictionaryValue::key_iterator extension_iter( extension_data->begin_keys()); extension_iter != extension_data->end_keys(); ++extension_iter) { if (*extension_iter == extension_id) { return GetInstalledExtensionInfoImpl(extension_data.get(), extension_iter); } } return NULL; } ",0 "MagickExport MagickBooleanType ContrastStretchImage(Image *image, const double black_point,const double white_point,ExceptionInfo *exception) { #define MaxRange(color) ((double) ScaleQuantumToMap((Quantum) (color))) #define ContrastStretchImageTag ""ContrastStretch/Image"" CacheView *image_view; double *black, *histogram, *stretch_map, *white; MagickBooleanType status; MagickOffsetType progress; register ssize_t i; ssize_t y; /* Allocate histogram and stretch map. */ assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"",image->filename); if (SetImageGray(image,exception) != MagickFalse) (void) SetImageColorspace(image,GRAYColorspace,exception); black=(double *) AcquireQuantumMemory(MaxPixelChannels,sizeof(*black)); white=(double *) AcquireQuantumMemory(MaxPixelChannels,sizeof(*white)); histogram=(double *) AcquireQuantumMemory(MaxMap+1UL,MaxPixelChannels* sizeof(*histogram)); stretch_map=(double *) AcquireQuantumMemory(MaxMap+1UL,MaxPixelChannels* sizeof(*stretch_map)); if ((black == (double *) NULL) || (white == (double *) NULL) || (histogram == (double *) NULL) || (stretch_map == (double *) NULL)) { if (stretch_map != (double *) NULL) stretch_map=(double *) RelinquishMagickMemory(stretch_map); if (histogram != (double *) NULL) histogram=(double *) RelinquishMagickMemory(histogram); if (white != (double *) NULL) white=(double *) RelinquishMagickMemory(white); if (black != (double *) NULL) black=(double *) RelinquishMagickMemory(black); ThrowBinaryException(ResourceLimitError,""MemoryAllocationFailed"", image->filename); } /* Form histogram. */ status=MagickTrue; (void) memset(histogram,0,(MaxMap+1)*GetPixelChannels(image)* sizeof(*histogram)); image_view=AcquireVirtualCacheView(image,exception); for (y=0; y < (ssize_t) image->rows; y++) { register const Quantum *magick_restrict p; register ssize_t x; if (status == MagickFalse) continue; p=GetCacheViewVirtualPixels(image_view,0,y,image->columns,1,exception); if (p == (const Quantum *) NULL) { status=MagickFalse; continue; } for (x=0; x < (ssize_t) image->columns; x++) { double pixel; pixel=GetPixelIntensity(image,p); for (i=0; i < (ssize_t) GetPixelChannels(image); i++) { if (image->channel_mask != DefaultChannels) pixel=(double) p[i]; histogram[GetPixelChannels(image)*ScaleQuantumToMap( ClampToQuantum(pixel))+i]++; } p+=GetPixelChannels(image); } } image_view=DestroyCacheView(image_view); /* Find the histogram boundaries by locating the black/white levels. */ for (i=0; i < (ssize_t) GetPixelChannels(image); i++) { double intensity; register ssize_t j; black[i]=0.0; white[i]=MaxRange(QuantumRange); intensity=0.0; for (j=0; j <= (ssize_t) MaxMap; j++) { intensity+=histogram[GetPixelChannels(image)*j+i]; if (intensity > black_point) break; } black[i]=(double) j; intensity=0.0; for (j=(ssize_t) MaxMap; j != 0; j--) { intensity+=histogram[GetPixelChannels(image)*j+i]; if (intensity > ((double) image->columns*image->rows-white_point)) break; } white[i]=(double) j; } histogram=(double *) RelinquishMagickMemory(histogram); /* Stretch the histogram to create the stretched image mapping. */ (void) memset(stretch_map,0,(MaxMap+1)*GetPixelChannels(image)* sizeof(*stretch_map)); for (i=0; i < (ssize_t) GetPixelChannels(image); i++) { register ssize_t j; for (j=0; j <= (ssize_t) MaxMap; j++) { double gamma; gamma=PerceptibleReciprocal(white[i]-black[i]); if (j < (ssize_t) black[i]) stretch_map[GetPixelChannels(image)*j+i]=0.0; else if (j > (ssize_t) white[i]) stretch_map[GetPixelChannels(image)*j+i]=(double) QuantumRange; else if (black[i] != white[i]) stretch_map[GetPixelChannels(image)*j+i]=(double) ScaleMapToQuantum( (double) (MaxMap*gamma*(j-black[i]))); } } if (image->storage_class == PseudoClass) { register ssize_t j; /* Stretch-contrast colormap. */ for (j=0; j < (ssize_t) image->colors; j++) { if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0) { i=GetPixelChannelOffset(image,RedPixelChannel); image->colormap[j].red=stretch_map[GetPixelChannels(image)* ScaleQuantumToMap(ClampToQuantum(image->colormap[j].red))+i]; } if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0) { i=GetPixelChannelOffset(image,GreenPixelChannel); image->colormap[j].green=stretch_map[GetPixelChannels(image)* ScaleQuantumToMap(ClampToQuantum(image->colormap[j].green))+i]; } if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0) { i=GetPixelChannelOffset(image,BluePixelChannel); image->colormap[j].blue=stretch_map[GetPixelChannels(image)* ScaleQuantumToMap(ClampToQuantum(image->colormap[j].blue))+i]; } if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0) { i=GetPixelChannelOffset(image,AlphaPixelChannel); image->colormap[j].alpha=stretch_map[GetPixelChannels(image)* ScaleQuantumToMap(ClampToQuantum(image->colormap[j].alpha))+i]; } } } /* Stretch-contrast image. */ status=MagickTrue; progress=0; image_view=AcquireAuthenticCacheView(image,exception); #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static) shared(progress,status) \ magick_number_threads(image,image,image->rows,1) #endif for (y=0; y < (ssize_t) image->rows; y++) { register Quantum *magick_restrict q; register ssize_t x; if (status == MagickFalse) continue; q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) { status=MagickFalse; continue; } for (x=0; x < (ssize_t) image->columns; x++) { register ssize_t j; for (j=0; j < (ssize_t) GetPixelChannels(image); j++) { PixelChannel channel = GetPixelChannelChannel(image,j); PixelTrait traits = GetPixelChannelTraits(image,channel); if ((traits & UpdatePixelTrait) == 0) continue; if (black[j] == white[j]) continue; q[j]=ClampToQuantum(stretch_map[GetPixelChannels(image)* ScaleQuantumToMap(q[j])+j]); } q+=GetPixelChannels(image); } if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse) status=MagickFalse; if (image->progress_monitor != (MagickProgressMonitor) NULL) { MagickBooleanType proceed; #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp atomic #endif progress++; proceed=SetImageProgress(image,ContrastStretchImageTag,progress, image->rows); if (proceed == MagickFalse) status=MagickFalse; } } image_view=DestroyCacheView(image_view); stretch_map=(double *) RelinquishMagickMemory(stretch_map); white=(double *) RelinquishMagickMemory(white); black=(double *) RelinquishMagickMemory(black); return(status); } ",0 "static int _nfs4_proc_mknod(struct inode *dir, struct dentry *dentry, struct iattr *sattr, dev_t rdev) { struct nfs4_createdata *data; int mode = sattr->ia_mode; int status = -ENOMEM; BUG_ON(!(sattr->ia_valid & ATTR_MODE)); BUG_ON(!S_ISFIFO(mode) && !S_ISBLK(mode) && !S_ISCHR(mode) && !S_ISSOCK(mode)); data = nfs4_alloc_createdata(dir, &dentry->d_name, sattr, NF4SOCK); if (data == NULL) goto out; if (S_ISFIFO(mode)) data->arg.ftype = NF4FIFO; else if (S_ISBLK(mode)) { data->arg.ftype = NF4BLK; data->arg.u.device.specdata1 = MAJOR(rdev); data->arg.u.device.specdata2 = MINOR(rdev); } else if (S_ISCHR(mode)) { data->arg.ftype = NF4CHR; data->arg.u.device.specdata1 = MAJOR(rdev); data->arg.u.device.specdata2 = MINOR(rdev); } status = nfs4_do_create(dir, dentry, data); nfs4_free_createdata(data); out: return status; } ",0 "static int list_entry_comparator(const void *p1, const void *p2) { const struct list_entry *e1 = (struct list_entry *)p1; const struct list_entry *e2 = (struct list_entry *)p2; return bsearch_compare_mbox(e1->name, e2->name); } ",0 "static inline unsigned int *fps_regaddr(struct fpustate *f, unsigned int insn_regnum) { return &f->regs[insn_regnum]; } ",0 "void skip_mem_dump(void) { skip_mem_check_final = true; } ",0 "GLvoid StubGLUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { glUniformMatrix3fv(location, count, transpose, value); } ",0 "void AutocompleteEditModel::OnChanged() { const AutocompleteMatch& current_match = user_input_in_progress_ ? CurrentMatch() : AutocompleteMatch(); AutocompleteActionPredictor::Action recommended_action = AutocompleteActionPredictor::ACTION_NONE; AutocompleteActionPredictor* action_predictor = user_input_in_progress_ ? AutocompleteActionPredictorFactory::GetForProfile(profile_) : NULL; if (action_predictor) { action_predictor->RegisterTransitionalMatches(user_text_, result()); recommended_action = action_predictor->RecommendAction(user_text_, current_match); } UMA_HISTOGRAM_ENUMERATION(""AutocompleteActionPredictor.Action"", recommended_action, AutocompleteActionPredictor::LAST_PREDICT_ACTION); string16 suggested_text; if (DoInstant(current_match, &suggested_text)) { SetSuggestedText(suggested_text, instant_complete_behavior_); } else { switch (recommended_action) { case AutocompleteActionPredictor::ACTION_PRERENDER: DoPrerender(current_match); break; case AutocompleteActionPredictor::ACTION_PRECONNECT: DoPreconnect(current_match); break; case AutocompleteActionPredictor::ACTION_NONE: break; default: NOTREACHED() << ""Unexpected recommended action: "" << recommended_action; break; } view_->SetInstantSuggestion(string16(), false); FinalizeInstantQuery(string16(), string16(), false); } controller_->OnChanged(); } ",0 "static __init int hardware_setup(void) { if (setup_vmcs_config(&vmcs_config) < 0) return -EIO; if (boot_cpu_has(X86_FEATURE_NX)) kvm_enable_efer_bits(EFER_NX); if (!cpu_has_vmx_vpid()) enable_vpid = 0; if (!cpu_has_vmx_shadow_vmcs()) enable_shadow_vmcs = 0; if (!cpu_has_vmx_ept() || !cpu_has_vmx_ept_4levels()) { enable_ept = 0; enable_unrestricted_guest = 0; enable_ept_ad_bits = 0; } if (!cpu_has_vmx_ept_ad_bits()) enable_ept_ad_bits = 0; if (!cpu_has_vmx_unrestricted_guest()) enable_unrestricted_guest = 0; if (!cpu_has_vmx_flexpriority()) flexpriority_enabled = 0; if (!cpu_has_vmx_tpr_shadow()) kvm_x86_ops->update_cr8_intercept = NULL; if (enable_ept && !cpu_has_vmx_ept_2m_page()) kvm_disable_largepages(); if (!cpu_has_vmx_ple()) ple_gap = 0; if (!cpu_has_vmx_apicv()) enable_apicv = 0; if (enable_apicv) kvm_x86_ops->update_cr8_intercept = NULL; else { kvm_x86_ops->hwapic_irr_update = NULL; kvm_x86_ops->deliver_posted_interrupt = NULL; kvm_x86_ops->sync_pir_to_irr = vmx_sync_pir_to_irr_dummy; } if (nested) nested_vmx_setup_ctls_msrs(); return alloc_kvm_area(); } ",0 "xmlParseSystemLiteral(xmlParserCtxtPtr ctxt) { xmlChar *buf = NULL; int len = 0; int size = XML_PARSER_BUFFER_SIZE; int cur, l; xmlChar stop; int state = ctxt->instate; int count = 0; SHRINK; if (RAW == '""') { NEXT; stop = '""'; } else if (RAW == '\'') { NEXT; stop = '\''; } else { xmlFatalErr(ctxt, XML_ERR_LITERAL_NOT_STARTED, NULL); return(NULL); } buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar)); if (buf == NULL) { xmlErrMemory(ctxt, NULL); return(NULL); } ctxt->instate = XML_PARSER_SYSTEM_LITERAL; cur = CUR_CHAR(l); while ((IS_CHAR(cur)) && (cur != stop)) { /* checked */ if (len + 5 >= size) { xmlChar *tmp; if ((size > XML_MAX_NAME_LENGTH) && ((ctxt->options & XML_PARSE_HUGE) == 0)) { xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, ""SystemLiteral""); xmlFree(buf); ctxt->instate = (xmlParserInputState) state; return(NULL); } size *= 2; tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar)); if (tmp == NULL) { xmlFree(buf); xmlErrMemory(ctxt, NULL); ctxt->instate = (xmlParserInputState) state; return(NULL); } buf = tmp; } count++; if (count > 50) { GROW; count = 0; if (ctxt->instate == XML_PARSER_EOF) { xmlFree(buf); return(NULL); } } COPY_BUF(l,buf,len,cur); NEXTL(l); cur = CUR_CHAR(l); if (cur == 0) { GROW; SHRINK; cur = CUR_CHAR(l); } } buf[len] = 0; ctxt->instate = (xmlParserInputState) state; if (!IS_CHAR(cur)) { xmlFatalErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED, NULL); } else { NEXT; } return(buf); } ",0 "static void ims_pcu_backlight_set_brightness(struct led_classdev *cdev, enum led_brightness value) { struct ims_pcu_backlight *backlight = container_of(cdev, struct ims_pcu_backlight, cdev); backlight->desired_brightness = value; schedule_work(&backlight->work); } ",0 "void HTMLSelectElement::setSize(int size) { setAttribute(sizeAttr, String::number(size)); } ",0 "__be32 * xdr_inline_decode(struct xdr_stream *xdr, size_t nbytes) { __be32 *p; if (nbytes == 0) return xdr->p; if (xdr->p == xdr->end && !xdr_set_next_buffer(xdr)) return NULL; p = __xdr_inline_decode(xdr, nbytes); if (p != NULL) return p; return xdr_copy_to_scratch(xdr, nbytes); } ",0 " DriveTestVolume() : TestVolume(""drive"") {} ",0 "void WebMediaPlayerImpl::ExitPictureInPicture( blink::WebMediaPlayer::PipWindowClosedCallback callback) { delegate_->DidPictureInPictureModeEnd(delegate_id_, std::move(callback)); OnPictureInPictureModeEnded(); } ",0 "static void cassign(JF, js_Ast *exp) { js_Ast *lhs = exp->a; js_Ast *rhs = exp->b; switch (lhs->type) { case EXP_IDENTIFIER: cexp(J, F, rhs); emitline(J, F, exp); emitlocal(J, F, OP_SETLOCAL, OP_SETVAR, lhs); break; case EXP_INDEX: cexp(J, F, lhs->a); cexp(J, F, lhs->b); cexp(J, F, rhs); emitline(J, F, exp); emit(J, F, OP_SETPROP); break; case EXP_MEMBER: cexp(J, F, lhs->a); cexp(J, F, rhs); emitline(J, F, exp); emitstring(J, F, OP_SETPROP_S, lhs->b->string); break; default: jsC_error(J, lhs, ""invalid l-value in assignment""); } } ",0 "static int rdp_recv_pdu(rdpRdp* rdp, STREAM* s) { if (tpkt_verify_header(s)) return rdp_recv_tpkt_pdu(rdp, s); else return rdp_recv_fastpath_pdu(rdp, s); } ",0 "int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb), void *from, int length, int transhdrlen, int hlimit, int tclass, struct ipv6_txoptions *opt, struct flowi6 *fl6, struct rt6_info *rt, unsigned int flags, int dontfrag) { struct inet_sock *inet = inet_sk(sk); struct ipv6_pinfo *np = inet6_sk(sk); struct inet_cork *cork; struct sk_buff *skb, *skb_prev = NULL; unsigned int maxfraglen, fragheaderlen; int exthdrlen; int dst_exthdrlen; int hh_len; int mtu; int copy; int err; int offset = 0; __u8 tx_flags = 0; if (flags&MSG_PROBE) return 0; cork = &inet->cork.base; if (skb_queue_empty(&sk->sk_write_queue)) { /* * setup for corking */ if (opt) { if (WARN_ON(np->cork.opt)) return -EINVAL; np->cork.opt = kzalloc(opt->tot_len, sk->sk_allocation); if (unlikely(np->cork.opt == NULL)) return -ENOBUFS; np->cork.opt->tot_len = opt->tot_len; np->cork.opt->opt_flen = opt->opt_flen; np->cork.opt->opt_nflen = opt->opt_nflen; np->cork.opt->dst0opt = ip6_opt_dup(opt->dst0opt, sk->sk_allocation); if (opt->dst0opt && !np->cork.opt->dst0opt) return -ENOBUFS; np->cork.opt->dst1opt = ip6_opt_dup(opt->dst1opt, sk->sk_allocation); if (opt->dst1opt && !np->cork.opt->dst1opt) return -ENOBUFS; np->cork.opt->hopopt = ip6_opt_dup(opt->hopopt, sk->sk_allocation); if (opt->hopopt && !np->cork.opt->hopopt) return -ENOBUFS; np->cork.opt->srcrt = ip6_rthdr_dup(opt->srcrt, sk->sk_allocation); if (opt->srcrt && !np->cork.opt->srcrt) return -ENOBUFS; /* need source address above miyazawa*/ } dst_hold(&rt->dst); cork->dst = &rt->dst; inet->cork.fl.u.ip6 = *fl6; np->cork.hop_limit = hlimit; np->cork.tclass = tclass; if (rt->dst.flags & DST_XFRM_TUNNEL) mtu = np->pmtudisc == IPV6_PMTUDISC_PROBE ? rt->dst.dev->mtu : dst_mtu(&rt->dst); else mtu = np->pmtudisc == IPV6_PMTUDISC_PROBE ? rt->dst.dev->mtu : dst_mtu(rt->dst.path); if (np->frag_size < mtu) { if (np->frag_size) mtu = np->frag_size; } cork->fragsize = mtu; if (dst_allfrag(rt->dst.path)) cork->flags |= IPCORK_ALLFRAG; cork->length = 0; exthdrlen = (opt ? opt->opt_flen : 0); length += exthdrlen; transhdrlen += exthdrlen; dst_exthdrlen = rt->dst.header_len - rt->rt6i_nfheader_len; } else { rt = (struct rt6_info *)cork->dst; fl6 = &inet->cork.fl.u.ip6; opt = np->cork.opt; transhdrlen = 0; exthdrlen = 0; dst_exthdrlen = 0; mtu = cork->fragsize; } hh_len = LL_RESERVED_SPACE(rt->dst.dev); fragheaderlen = sizeof(struct ipv6hdr) + rt->rt6i_nfheader_len + (opt ? opt->opt_nflen : 0); maxfraglen = ((mtu - fragheaderlen) & ~7) + fragheaderlen - sizeof(struct frag_hdr); if (mtu <= sizeof(struct ipv6hdr) + IPV6_MAXPLEN) { if (cork->length + length > sizeof(struct ipv6hdr) + IPV6_MAXPLEN - fragheaderlen) { ipv6_local_error(sk, EMSGSIZE, fl6, mtu-exthdrlen); return -EMSGSIZE; } } /* For UDP, check if TX timestamp is enabled */ if (sk->sk_type == SOCK_DGRAM) sock_tx_timestamp(sk, &tx_flags); /* * Let's try using as much space as possible. * Use MTU if total length of the message fits into the MTU. * Otherwise, we need to reserve fragment header and * fragment alignment (= 8-15 octects, in total). * * Note that we may need to ""move"" the data from the tail of * of the buffer to the new fragment when we split * the message. * * FIXME: It may be fragmented into multiple chunks * at once if non-fragmentable extension headers * are too large. * --yoshfuji */ cork->length += length; if (length > mtu) { int proto = sk->sk_protocol; if (dontfrag && (proto == IPPROTO_UDP || proto == IPPROTO_RAW)){ ipv6_local_rxpmtu(sk, fl6, mtu-exthdrlen); return -EMSGSIZE; } if (proto == IPPROTO_UDP && (rt->dst.dev->features & NETIF_F_UFO)) { err = ip6_ufo_append_data(sk, getfrag, from, length, hh_len, fragheaderlen, transhdrlen, mtu, flags, rt); if (err) goto error; return 0; } } if ((skb = skb_peek_tail(&sk->sk_write_queue)) == NULL) goto alloc_new_skb; while (length > 0) { /* Check if the remaining data fits into current packet. */ copy = (cork->length <= mtu && !(cork->flags & IPCORK_ALLFRAG) ? mtu : maxfraglen) - skb->len; if (copy < length) copy = maxfraglen - skb->len; if (copy <= 0) { char *data; unsigned int datalen; unsigned int fraglen; unsigned int fraggap; unsigned int alloclen; alloc_new_skb: /* There's no room in the current skb */ if (skb) fraggap = skb->len - maxfraglen; else fraggap = 0; /* update mtu and maxfraglen if necessary */ if (skb == NULL || skb_prev == NULL) ip6_append_data_mtu(&mtu, &maxfraglen, fragheaderlen, skb, rt); skb_prev = skb; /* * If remaining data exceeds the mtu, * we know we need more fragment(s). */ datalen = length + fraggap; if (datalen > (cork->length <= mtu && !(cork->flags & IPCORK_ALLFRAG) ? mtu : maxfraglen) - fragheaderlen) datalen = maxfraglen - fragheaderlen - rt->dst.trailer_len; if ((flags & MSG_MORE) && !(rt->dst.dev->features&NETIF_F_SG)) alloclen = mtu; else alloclen = datalen + fragheaderlen; alloclen += dst_exthdrlen; if (datalen != length + fraggap) { /* * this is not the last fragment, the trailer * space is regarded as data space. */ datalen += rt->dst.trailer_len; } alloclen += rt->dst.trailer_len; fraglen = datalen + fragheaderlen; /* * We just reserve space for fragment header. * Note: this may be overallocation if the message * (without MSG_MORE) fits into the MTU. */ alloclen += sizeof(struct frag_hdr); if (transhdrlen) { skb = sock_alloc_send_skb(sk, alloclen + hh_len, (flags & MSG_DONTWAIT), &err); } else { skb = NULL; if (atomic_read(&sk->sk_wmem_alloc) <= 2 * sk->sk_sndbuf) skb = sock_wmalloc(sk, alloclen + hh_len, 1, sk->sk_allocation); if (unlikely(skb == NULL)) err = -ENOBUFS; else { /* Only the initial fragment * is time stamped. */ tx_flags = 0; } } if (skb == NULL) goto error; /* * Fill in the control structures */ skb->ip_summed = CHECKSUM_NONE; skb->csum = 0; /* reserve for fragmentation and ipsec header */ skb_reserve(skb, hh_len + sizeof(struct frag_hdr) + dst_exthdrlen); if (sk->sk_type == SOCK_DGRAM) skb_shinfo(skb)->tx_flags = tx_flags; /* * Find where to start putting bytes */ data = skb_put(skb, fraglen); skb_set_network_header(skb, exthdrlen); data += fragheaderlen; skb->transport_header = (skb->network_header + fragheaderlen); if (fraggap) { skb->csum = skb_copy_and_csum_bits( skb_prev, maxfraglen, data + transhdrlen, fraggap, 0); skb_prev->csum = csum_sub(skb_prev->csum, skb->csum); data += fraggap; pskb_trim_unique(skb_prev, maxfraglen); } copy = datalen - transhdrlen - fraggap; if (copy < 0) { err = -EINVAL; kfree_skb(skb); goto error; } else if (copy > 0 && getfrag(from, data + transhdrlen, offset, copy, fraggap, skb) < 0) { err = -EFAULT; kfree_skb(skb); goto error; } offset += copy; length -= datalen - fraggap; transhdrlen = 0; exthdrlen = 0; dst_exthdrlen = 0; /* * Put the packet on the pending queue */ __skb_queue_tail(&sk->sk_write_queue, skb); continue; } if (copy > length) copy = length; if (!(rt->dst.dev->features&NETIF_F_SG)) { unsigned int off; off = skb->len; if (getfrag(from, skb_put(skb, copy), offset, copy, off, skb) < 0) { __skb_trim(skb, off); err = -EFAULT; goto error; } } else { int i = skb_shinfo(skb)->nr_frags; struct page_frag *pfrag = sk_page_frag(sk); err = -ENOMEM; if (!sk_page_frag_refill(sk, pfrag)) goto error; if (!skb_can_coalesce(skb, i, pfrag->page, pfrag->offset)) { err = -EMSGSIZE; if (i == MAX_SKB_FRAGS) goto error; __skb_fill_page_desc(skb, i, pfrag->page, pfrag->offset, 0); skb_shinfo(skb)->nr_frags = ++i; get_page(pfrag->page); } copy = min_t(int, copy, pfrag->size - pfrag->offset); if (getfrag(from, page_address(pfrag->page) + pfrag->offset, offset, copy, skb->len, skb) < 0) goto error_efault; pfrag->offset += copy; skb_frag_size_add(&skb_shinfo(skb)->frags[i - 1], copy); skb->len += copy; skb->data_len += copy; skb->truesize += copy; atomic_add(copy, &sk->sk_wmem_alloc); } offset += copy; length -= copy; } return 0; error_efault: err = -EFAULT; error: cork->length -= length; IP6_INC_STATS(sock_net(sk), rt->rt6i_idev, IPSTATS_MIB_OUTDISCARDS); return err; } ",1 "bool IDNSpoofChecker::SafeToDisplayAsUnicode(base::StringPiece16 label, bool is_tld_ascii) { UErrorCode status = U_ZERO_ERROR; int32_t result = uspoof_check(checker_, label.data(), base::checked_cast(label.size()), nullptr, &status); if (U_FAILURE(status) || (result & USPOOF_ALL_CHECKS)) return false; icu::UnicodeString label_string(FALSE, label.data(), base::checked_cast(label.size())); if (deviation_characters_.containsSome(label_string)) return false; result &= USPOOF_RESTRICTION_LEVEL_MASK; if (result == USPOOF_ASCII) return true; if (result == USPOOF_SINGLE_SCRIPT_RESTRICTIVE && kana_letters_exceptions_.containsNone(label_string) && combining_diacritics_exceptions_.containsNone(label_string)) { return !is_tld_ascii || !IsMadeOfLatinAlikeCyrillic(label_string); } if (non_ascii_latin_letters_.containsSome(label_string) && !lgc_letters_n_ascii_.containsAll(label_string)) return false; icu::RegexMatcher* dangerous_pattern = reinterpret_cast(DangerousPatternTLS().Get()); if (!dangerous_pattern) { icu::UnicodeString( R""([^\p{scx=kana}\p{scx=hira}\p{scx=hani}])"" R""([\u30ce\u30f3\u30bd\u30be])"" R""([^\p{scx=kana}\p{scx=hira}\p{scx=hani}]|)"" R""([^\p{scx=kana}\p{scx=hira}]\u30fc|^\u30fc|)"" R""([^\p{scx=kana}][\u30fd\u30fe]|^[\u30fd\u30fe]|)"" R""(^[\p{scx=kana}]+[\u3078-\u307a][\p{scx=kana}]+$|)"" R""(^[\p{scx=hira}]+[\u30d8-\u30da][\p{scx=hira}]+$|)"" R""([a-z]\u30fb|\u30fb[a-z]|)"" R""([^\p{scx=latn}\p{scx=grek}\p{scx=cyrl}][\u0300-\u0339]|)"" R""(\u0131[\u0300-\u0339]|)"" R""([ijl]\u0307)"", -1, US_INV), 0, status); DangerousPatternTLS().Set(dangerous_pattern); } dangerous_pattern->reset(label_string); return !dangerous_pattern->find(); } ",1 "void PepperVideoRenderer2D::AllocateBuffers() { if (clip_area_.width() == 0 || clip_area_.height() == 0) return; while (buffers_.size() < kMaxPendingBuffersCount) { pp::ImageData buffer_data(instance_, PP_IMAGEDATAFORMAT_BGRA_PREMUL, pp::Size(clip_area_.width(), clip_area_.height()), false); if (buffer_data.is_null()) { LOG(WARNING) << ""Not enough memory for frame buffers.""; break; } webrtc::DesktopFrame* buffer = new PepperDesktopFrame(buffer_data); buffers_.push_back(buffer); software_video_renderer_->DrawBuffer(buffer); } } ",0 "static void agraph_print_edge_dot(RANode *from, RANode *to, void *user) { r_cons_printf (""\""%s\"" -> \""%s\""\n"", from->title, to->title); } ",0 "bool WindowsGetLastFocusedFunction::RunImpl() { scoped_ptr params( GetLastFocused::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); bool populate_tabs = false; if (params->get_info.get() && params->get_info->populate.get()) populate_tabs = *params->get_info->populate; Browser* browser = chrome::FindAnyBrowser( profile(), include_incognito(), chrome::GetActiveDesktop()); if (!browser || !browser->window()) { error_ = keys::kNoLastFocusedWindowError; return false; } WindowController* controller = browser->extension_window_controller(); if (populate_tabs) SetResult(controller->CreateWindowValueWithTabs(GetExtension())); else SetResult(controller->CreateWindowValue()); return true; } ",0 "bool terminal_is_dumb(void) { if (!on_tty()) return true; return getenv_terminal_is_dumb(); } ",0 "const char *cJSON_GetErrorPtr(void) {return global_ep;} ",0 "ossl_cipher_block_size(VALUE self) { EVP_CIPHER_CTX *ctx; GetCipher(self, ctx); return INT2NUM(EVP_CIPHER_CTX_block_size(ctx)); } ",0 "static DNLI_t dnlFreeIterator(DNLI_t dnli) { if (dnli) { if (dnli->active) free(dnli->active); free(dnli); } return NULL; } ",0 "void WebContentsImpl::CopyToFindPboard() { #if defined(OS_MACOSX) RenderFrameHost* focused_frame = GetFocusedFrame(); if (!focused_frame) return; focused_frame->Send( new InputMsg_CopyToFindPboard(focused_frame->GetRoutingID())); RecordAction(base::UserMetricsAction(""CopyToFindPboard"")); #endif } ",0 "GSList *nicklist_find_multiple(CHANNEL_REC *channel, const char *mask) { GSList *nicks; NICK_REC *nick; GHashTableIter iter; g_return_val_if_fail(IS_CHANNEL(channel), NULL); g_return_val_if_fail(mask != NULL, NULL); nicks = NULL; g_hash_table_iter_init(&iter, channel->nicks); while (g_hash_table_iter_next(&iter, NULL, (void*)&nick)) { for (; nick != NULL; nick = nick->next) { if (mask_match_address(channel->server, mask, nick->nick, nick->host)) nicks = g_slist_prepend(nicks, nick); } } return nicks; } ",0 "static int fr_ioctl(struct net_device *dev, struct ifreq *ifr) { fr_proto __user *fr_s = ifr->ifr_settings.ifs_ifsu.fr; const size_t size = sizeof(fr_proto); fr_proto new_settings; hdlc_device *hdlc = dev_to_hdlc(dev); fr_proto_pvc pvc; int result; switch (ifr->ifr_settings.type) { case IF_GET_PROTO: if (dev_to_hdlc(dev)->proto != &proto) /* Different proto */ return -EINVAL; ifr->ifr_settings.type = IF_PROTO_FR; if (ifr->ifr_settings.size < size) { ifr->ifr_settings.size = size; /* data size wanted */ return -ENOBUFS; } if (copy_to_user(fr_s, &state(hdlc)->settings, size)) return -EFAULT; return 0; case IF_PROTO_FR: if (!capable(CAP_NET_ADMIN)) return -EPERM; if (dev->flags & IFF_UP) return -EBUSY; if (copy_from_user(&new_settings, fr_s, size)) return -EFAULT; if (new_settings.lmi == LMI_DEFAULT) new_settings.lmi = LMI_ANSI; if ((new_settings.lmi != LMI_NONE && new_settings.lmi != LMI_ANSI && new_settings.lmi != LMI_CCITT && new_settings.lmi != LMI_CISCO) || new_settings.t391 < 1 || new_settings.t392 < 2 || new_settings.n391 < 1 || new_settings.n392 < 1 || new_settings.n393 < new_settings.n392 || new_settings.n393 > 32 || (new_settings.dce != 0 && new_settings.dce != 1)) return -EINVAL; result=hdlc->attach(dev, ENCODING_NRZ,PARITY_CRC16_PR1_CCITT); if (result) return result; if (dev_to_hdlc(dev)->proto != &proto) { /* Different proto */ result = attach_hdlc_protocol(dev, &proto, sizeof(struct frad_state)); if (result) return result; state(hdlc)->first_pvc = NULL; state(hdlc)->dce_pvc_count = 0; } memcpy(&state(hdlc)->settings, &new_settings, size); dev->type = ARPHRD_FRAD; return 0; case IF_PROTO_FR_ADD_PVC: case IF_PROTO_FR_DEL_PVC: case IF_PROTO_FR_ADD_ETH_PVC: case IF_PROTO_FR_DEL_ETH_PVC: if (dev_to_hdlc(dev)->proto != &proto) /* Different proto */ return -EINVAL; if (!capable(CAP_NET_ADMIN)) return -EPERM; if (copy_from_user(&pvc, ifr->ifr_settings.ifs_ifsu.fr_pvc, sizeof(fr_proto_pvc))) return -EFAULT; if (pvc.dlci <= 0 || pvc.dlci >= 1024) return -EINVAL; /* Only 10 bits, DLCI 0 reserved */ if (ifr->ifr_settings.type == IF_PROTO_FR_ADD_ETH_PVC || ifr->ifr_settings.type == IF_PROTO_FR_DEL_ETH_PVC) result = ARPHRD_ETHER; /* bridged Ethernet device */ else result = ARPHRD_DLCI; if (ifr->ifr_settings.type == IF_PROTO_FR_ADD_PVC || ifr->ifr_settings.type == IF_PROTO_FR_ADD_ETH_PVC) return fr_add_pvc(dev, pvc.dlci, result); else return fr_del_pvc(hdlc, pvc.dlci, result); } return -EINVAL; } ",0 "static int count_subheaders(struct ctl_table *table) { int has_files = 0; int nr_subheaders = 0; struct ctl_table *entry; /* special case: no directory and empty directory */ if (!table || !table->procname) return 1; for (entry = table; entry->procname; entry++) { if (entry->child) nr_subheaders += count_subheaders(entry->child); else has_files = 1; } return nr_subheaders + has_files; } ",0 "static void rmap_remove(struct kvm *kvm, u64 *spte) { struct kvm_mmu_page *sp; gfn_t gfn; unsigned long *rmapp; sp = page_header(__pa(spte)); gfn = kvm_mmu_page_get_gfn(sp, spte - sp->spt); rmapp = gfn_to_rmap(kvm, gfn, sp->role.level); pte_list_remove(spte, rmapp); } ",0 "int DTLS_RECORD_LAYER_new(RECORD_LAYER *rl) { DTLS_RECORD_LAYER *d; if ((d = OPENSSL_malloc(sizeof(*d))) == NULL) return (0); rl->d = d; d->unprocessed_rcds.q = pqueue_new(); d->processed_rcds.q = pqueue_new(); d->buffered_app_data.q = pqueue_new(); if (d->unprocessed_rcds.q == NULL || d->processed_rcds.q == NULL || d->buffered_app_data.q == NULL) { pqueue_free(d->unprocessed_rcds.q); pqueue_free(d->processed_rcds.q); pqueue_free(d->buffered_app_data.q); OPENSSL_free(d); rl->d = NULL; return (0); } return 1; } ",0 " StatisticsRecorderTest() : use_persistent_histogram_allocator_(GetParam()) { PersistentHistogramAllocator::GetCreateHistogramResultHistogram(); InitializeStatisticsRecorder(); if (use_persistent_histogram_allocator_) { GlobalHistogramAllocator::CreateWithLocalMemory(kAllocatorMemorySize, 0, ""StatisticsRecorderTest""); } } ",1 "static struct cgroup_subsys_state *perf_cgroup_css_alloc(struct cgroup *cont) { struct perf_cgroup *jc; jc = kzalloc(sizeof(*jc), GFP_KERNEL); if (!jc) return ERR_PTR(-ENOMEM); jc->info = alloc_percpu(struct perf_cgroup_info); if (!jc->info) { kfree(jc); return ERR_PTR(-ENOMEM); } return &jc->css; } ",0 "void WebGLRenderingContextBase::DidDraw(const SkIRect& dirty_rect) { MarkContextChanged(kCanvasChanged); CanvasRenderingContext::DidDraw(dirty_rect); } ",0 "get_entries(struct net *net, struct ipt_get_entries __user *uptr, const int *len) { int ret; struct ipt_get_entries get; struct xt_table *t; if (*len < sizeof(get)) { duprintf(""get_entries: %u < %zu\n"", *len, sizeof(get)); return -EINVAL; } if (copy_from_user(&get, uptr, sizeof(get)) != 0) return -EFAULT; if (*len != sizeof(struct ipt_get_entries) + get.size) { duprintf(""get_entries: %u != %zu\n"", *len, sizeof(get) + get.size); return -EINVAL; } t = xt_find_table_lock(net, AF_INET, get.name); if (!IS_ERR_OR_NULL(t)) { const struct xt_table_info *private = t->private; duprintf(""t->private->number = %u\n"", private->number); if (get.size == private->size) ret = copy_entries_to_user(private->size, t, uptr->entrytable); else { duprintf(""get_entries: I've got %u not %u!\n"", private->size, get.size); ret = -EAGAIN; } module_put(t->me); xt_table_unlock(t); } else ret = t ? PTR_ERR(t) : -ENOENT; return ret; } ",0 "bool VideoCaptureManager::GetDeviceFormatsInUse( media::VideoCaptureSessionId capture_session_id, media::VideoCaptureFormats* formats_in_use) { DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK(formats_in_use->empty()); auto it = sessions_.find(capture_session_id); if (it == sessions_.end()) return false; std::ostringstream string_stream; string_stream << ""GetDeviceFormatsInUse for device: "" << it->second.name; EmitLogMessage(string_stream.str(), 1); base::Optional format = GetDeviceFormatInUse(it->second.type, it->second.id); if (format.has_value()) formats_in_use->push_back(format.value()); return true; } ",0 "void dm_init_md_queue(struct mapped_device *md) { /* * Request-based dm devices cannot be stacked on top of bio-based dm * devices. The type of this dm device may not have been decided yet. * The type is decided at the first table loading time. * To prevent problematic device stacking, clear the queue flag * for request stacking support until then. * * This queue is new, so no concurrency on the queue_flags. */ queue_flag_clear_unlocked(QUEUE_FLAG_STACKABLE, md->queue); /* * Initialize data that will only be used by a non-blk-mq DM queue * - must do so here (in alloc_dev callchain) before queue is used */ md->queue->queuedata = md; md->queue->backing_dev_info->congested_data = md; } ",0 "static int search_chunk(struct mschmd_header *chm, const unsigned char *chunk, const char *filename, const unsigned char **result, const unsigned char **result_end) { const unsigned char *start, *end, *p; unsigned int qr_size, num_entries, qr_entries, qr_density, name_len; unsigned int L, R, M, fname_len, entries_off, is_pmgl; int cmp; fname_len = strlen(filename); /* PMGL chunk or PMGI chunk? (note: read_chunk() has already * checked the rest of the characters in the chunk signature) */ if (chunk[3] == 0x4C) { is_pmgl = 1; entries_off = pmgl_Entries; } else { is_pmgl = 0; entries_off = pmgi_Entries; } /* Step 1: binary search first filename of each QR entry * - target filename == entry * found file * - target filename < all entries * file not found * - target filename > all entries * proceed to step 2 using final entry * - target filename between two searched entries * proceed to step 2 */ qr_size = EndGetI32(&chunk[pmgl_QuickRefSize]); start = &chunk[chm->chunk_size - 2]; end = &chunk[chm->chunk_size - qr_size]; num_entries = EndGetI16(start); qr_density = 1 + (1 << chm->density); qr_entries = (num_entries + qr_density-1) / qr_density; if (num_entries == 0) { D((""chunk has no entries"")) return -1; } if (qr_size > chm->chunk_size) { D((""quickref size > chunk size"")) return -1; } *result_end = end; if (((int)qr_entries * 2) > (start - end)) { D((""WARNING; more quickrefs than quickref space"")) qr_entries = 0; /* but we can live with it */ } if (qr_entries > 0) { L = 0; R = qr_entries - 1; do { /* pick new midpoint */ M = (L + R) >> 1; /* compare filename with entry QR points to */ p = &chunk[entries_off + (M ? EndGetI16(start - (M << 1)) : 0)]; READ_ENCINT(name_len); if (name_len > (unsigned int) (end - p)) goto chunk_end; cmp = compare(filename, (char *)p, fname_len, name_len); if (cmp == 0) break; else if (cmp < 0) { if (M) R = M - 1; else return 0; } else if (cmp > 0) L = M + 1; } while (L <= R); M = (L + R) >> 1; if (cmp == 0) { /* exact match! */ p += name_len; *result = p; return 1; } /* otherwise, read the group of entries for QR entry M */ p = &chunk[entries_off + (M ? EndGetI16(start - (M << 1)) : 0)]; num_entries -= (M * qr_density); if (num_entries > qr_density) num_entries = qr_density; } else { p = &chunk[entries_off]; } /* Step 2: linear search through the set of entries reached in step 1. * - filename == any entry * found entry * - filename < all entries (PMGI) or any entry (PMGL) * entry not found, stop now * - filename > all entries * entry not found (PMGL) / maybe found (PMGI) * - */ *result = NULL; while (num_entries-- > 0) { READ_ENCINT(name_len); if (name_len > (unsigned int) (end - p)) goto chunk_end; cmp = compare(filename, (char *)p, fname_len, name_len); p += name_len; if (cmp == 0) { /* entry found */ *result = p; return 1; } if (cmp < 0) { /* entry not found (PMGL) / maybe found (PMGI) */ break; } /* read and ignore the rest of this entry */ if (is_pmgl) { READ_ENCINT(R); /* skip section */ READ_ENCINT(R); /* skip offset */ READ_ENCINT(R); /* skip length */ } else { *result = p; /* store potential final result */ READ_ENCINT(R); /* skip chunk number */ } } /* PMGL? not found. PMGI? maybe found */ return (is_pmgl) ? 0 : (*result ? 1 : 0); chunk_end: D((""reached end of chunk data while searching"")) return -1; } ",0 "void GLES2DecoderPassthroughImpl::ApplySurfaceDrawOffset() { if (offscreen_ || !surface_->SupportsDCLayers()) { return; } gfx::Vector2d framebuffer_offset = GetSurfaceDrawOffset(); api()->glViewportFn(viewport_[0] + framebuffer_offset.x(), viewport_[1] + framebuffer_offset.y(), viewport_[2], viewport_[3]); api()->glScissorFn(scissor_[0] + framebuffer_offset.x(), scissor_[1] + framebuffer_offset.y(), scissor_[2], scissor_[3]); } ",0 "VarCreate(ExprDef *name, ExprDef *value) { VarDef *def = malloc(sizeof(*def)); if (!def) return NULL; def->common.type = STMT_VAR; def->common.next = NULL; def->name = name; def->value = value; return def; } ",0 "void XmlConfigParser::CharactersImpl(void* ctx, const xmlChar* ch, int len) { XmlConfigParser* context = FromContext(ctx); if (context->IsParsingData()) { context->master_prefs_ += std::string(reinterpret_cast(ch), len); } } ",0 "void OutOfProcessInstance::DocumentHasUnsupportedFeature( const std::string& feature) { std::string metric(""PDF_Unsupported_""); metric += feature; if (!unsupported_features_reported_.count(metric)) { unsupported_features_reported_.insert(metric); UserMetricsRecordAction(metric); } if (!full_) return; if (told_browser_about_unsupported_feature_) return; told_browser_about_unsupported_feature_ = true; pp::PDF::HasUnsupportedFeature(this); } ",0 "static sctp_disposition_t sctp_sf_violation_chunklen( struct net *net, const struct sctp_endpoint *ep, const struct sctp_association *asoc, const sctp_subtype_t type, void *arg, sctp_cmd_seq_t *commands) { static const char err_str[]=""The following chunk had invalid length:""; return sctp_sf_abort_violation(net, ep, asoc, arg, commands, err_str, sizeof(err_str)); } ",0 "bool WebLocalFrameImpl::IsLoading() const { if (!GetFrame() || !GetFrame()->GetDocument()) return false; return GetFrame() ->Loader() .StateMachine() ->IsDisplayingInitialEmptyDocument() || GetFrame()->Loader().HasProvisionalNavigation() || !GetFrame()->GetDocument()->LoadEventFinished(); } ",0 "static ImageEventSender& beforeLoadEventSender() { DEFINE_STATIC_LOCAL(ImageEventSender, sender, (eventNames().beforeloadEvent)); return sender; } ",0 "static void tcp_store_ts_recent(struct tcp_sock *tp) { tp->rx_opt.ts_recent = tp->rx_opt.rcv_tsval; tp->rx_opt.ts_recent_stamp = get_seconds(); } ",0 "void RenderView::didClearWindowObject(WebFrame* frame) { if (BindingsPolicy::is_dom_automation_enabled(enabled_bindings_)) BindDOMAutomationController(frame); if (BindingsPolicy::is_dom_ui_enabled(enabled_bindings_)) { dom_ui_bindings_.set_message_sender(this); dom_ui_bindings_.set_routing_id(routing_id_); dom_ui_bindings_.BindToJavascript(frame, L""chrome""); } if (BindingsPolicy::is_external_host_enabled(enabled_bindings_)) { external_host_bindings_.set_message_sender(this); external_host_bindings_.set_routing_id(routing_id_); external_host_bindings_.BindToJavascript(frame, L""externalHost""); } } ",0 "static int read_quant_table(RangeCoder *c, int16_t *quant_table, int scale) { int v; int i = 0; uint8_t state[CONTEXT_SIZE]; memset(state, 128, sizeof(state)); for (v = 0; i < 128; v++) { unsigned len = get_symbol(c, state, 0) + 1; if (len > 128 - i) return AVERROR_INVALIDDATA; while (len--) { quant_table[i] = scale * v; i++; } } for (i = 1; i < 128; i++) quant_table[256 - i] = -quant_table[i]; quant_table[128] = -quant_table[127]; return 2 * v - 1; } ",0 "void dtls1_hm_fragment_free(hm_fragment *frag) { if (!frag) return; if (frag->msg_header.is_ccs) { EVP_CIPHER_CTX_free(frag->msg_header. saved_retransmit_state.enc_write_ctx); EVP_MD_CTX_free(frag->msg_header.saved_retransmit_state.write_hash); } OPENSSL_free(frag->fragment); OPENSSL_free(frag->reassembly); OPENSSL_free(frag); } ",0 "bool CreateTemporaryFile(FilePath* path) { base::ThreadRestrictions::AssertIOAllowed(); // For call to close(). FilePath directory; if (!GetTempDir(&directory)) return false; int fd = CreateAndOpenFdForTemporaryFile(directory, path); if (fd < 0) return false; ignore_result(HANDLE_EINTR(close(fd))); return true; } ",0 "int ext4_map_blocks(handle_t *handle, struct inode *inode, struct ext4_map_blocks *map, int flags) { struct extent_status es; int retval; int ret = 0; #ifdef ES_AGGRESSIVE_TEST struct ext4_map_blocks orig_map; memcpy(&orig_map, map, sizeof(*map)); #endif map->m_flags = 0; ext_debug(""ext4_map_blocks(): inode %lu, flag %d, max_blocks %u,"" ""logical block %lu\n"", inode->i_ino, flags, map->m_len, (unsigned long) map->m_lblk); /* * ext4_map_blocks returns an int, and m_len is an unsigned int */ if (unlikely(map->m_len > INT_MAX)) map->m_len = INT_MAX; /* We can handle the block number less than EXT_MAX_BLOCKS */ if (unlikely(map->m_lblk >= EXT_MAX_BLOCKS)) return -EFSCORRUPTED; /* Lookup extent status tree firstly */ if (ext4_es_lookup_extent(inode, map->m_lblk, &es)) { if (ext4_es_is_written(&es) || ext4_es_is_unwritten(&es)) { map->m_pblk = ext4_es_pblock(&es) + map->m_lblk - es.es_lblk; map->m_flags |= ext4_es_is_written(&es) ? EXT4_MAP_MAPPED : EXT4_MAP_UNWRITTEN; retval = es.es_len - (map->m_lblk - es.es_lblk); if (retval > map->m_len) retval = map->m_len; map->m_len = retval; } else if (ext4_es_is_delayed(&es) || ext4_es_is_hole(&es)) { map->m_pblk = 0; retval = es.es_len - (map->m_lblk - es.es_lblk); if (retval > map->m_len) retval = map->m_len; map->m_len = retval; retval = 0; } else { BUG_ON(1); } #ifdef ES_AGGRESSIVE_TEST ext4_map_blocks_es_recheck(handle, inode, map, &orig_map, flags); #endif goto found; } /* * Try to see if we can get the block without requesting a new * file system block. */ down_read(&EXT4_I(inode)->i_data_sem); if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) { retval = ext4_ext_map_blocks(handle, inode, map, flags & EXT4_GET_BLOCKS_KEEP_SIZE); } else { retval = ext4_ind_map_blocks(handle, inode, map, flags & EXT4_GET_BLOCKS_KEEP_SIZE); } if (retval > 0) { unsigned int status; if (unlikely(retval != map->m_len)) { ext4_warning(inode->i_sb, ""ES len assertion failed for inode "" ""%lu: retval %d != map->m_len %d"", inode->i_ino, retval, map->m_len); WARN_ON(1); } status = map->m_flags & EXT4_MAP_UNWRITTEN ? EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN; if (!(flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE) && !(status & EXTENT_STATUS_WRITTEN) && ext4_find_delalloc_range(inode, map->m_lblk, map->m_lblk + map->m_len - 1)) status |= EXTENT_STATUS_DELAYED; ret = ext4_es_insert_extent(inode, map->m_lblk, map->m_len, map->m_pblk, status); if (ret < 0) retval = ret; } up_read((&EXT4_I(inode)->i_data_sem)); found: if (retval > 0 && map->m_flags & EXT4_MAP_MAPPED) { ret = check_block_validity(inode, map); if (ret != 0) return ret; } /* If it is only a block(s) look up */ if ((flags & EXT4_GET_BLOCKS_CREATE) == 0) return retval; /* * Returns if the blocks have already allocated * * Note that if blocks have been preallocated * ext4_ext_get_block() returns the create = 0 * with buffer head unmapped. */ if (retval > 0 && map->m_flags & EXT4_MAP_MAPPED) /* * If we need to convert extent to unwritten * we continue and do the actual work in * ext4_ext_map_blocks() */ if (!(flags & EXT4_GET_BLOCKS_CONVERT_UNWRITTEN)) return retval; /* * Here we clear m_flags because after allocating an new extent, * it will be set again. */ map->m_flags &= ~EXT4_MAP_FLAGS; /* * New blocks allocate and/or writing to unwritten extent * will possibly result in updating i_data, so we take * the write lock of i_data_sem, and call get_block() * with create == 1 flag. */ down_write(&EXT4_I(inode)->i_data_sem); /* * We need to check for EXT4 here because migrate * could have changed the inode type in between */ if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) { retval = ext4_ext_map_blocks(handle, inode, map, flags); } else { retval = ext4_ind_map_blocks(handle, inode, map, flags); if (retval > 0 && map->m_flags & EXT4_MAP_NEW) { /* * We allocated new blocks which will result in * i_data's format changing. Force the migrate * to fail by clearing migrate flags */ ext4_clear_inode_state(inode, EXT4_STATE_EXT_MIGRATE); } /* * Update reserved blocks/metadata blocks after successful * block allocation which had been deferred till now. We don't * support fallocate for non extent files. So we can update * reserve space here. */ if ((retval > 0) && (flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE)) ext4_da_update_reserve_space(inode, retval, 1); } if (retval > 0) { unsigned int status; if (unlikely(retval != map->m_len)) { ext4_warning(inode->i_sb, ""ES len assertion failed for inode "" ""%lu: retval %d != map->m_len %d"", inode->i_ino, retval, map->m_len); WARN_ON(1); } /* * We have to zeroout blocks before inserting them into extent * status tree. Otherwise someone could look them up there and * use them before they are really zeroed. */ if (flags & EXT4_GET_BLOCKS_ZERO && map->m_flags & EXT4_MAP_MAPPED && map->m_flags & EXT4_MAP_NEW) { ret = ext4_issue_zeroout(inode, map->m_lblk, map->m_pblk, map->m_len); if (ret) { retval = ret; goto out_sem; } } /* * If the extent has been zeroed out, we don't need to update * extent status tree. */ if ((flags & EXT4_GET_BLOCKS_PRE_IO) && ext4_es_lookup_extent(inode, map->m_lblk, &es)) { if (ext4_es_is_written(&es)) goto out_sem; } status = map->m_flags & EXT4_MAP_UNWRITTEN ? EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN; if (!(flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE) && !(status & EXTENT_STATUS_WRITTEN) && ext4_find_delalloc_range(inode, map->m_lblk, map->m_lblk + map->m_len - 1)) status |= EXTENT_STATUS_DELAYED; ret = ext4_es_insert_extent(inode, map->m_lblk, map->m_len, map->m_pblk, status); if (ret < 0) { retval = ret; goto out_sem; } } out_sem: up_write((&EXT4_I(inode)->i_data_sem)); if (retval > 0 && map->m_flags & EXT4_MAP_MAPPED) { ret = check_block_validity(inode, map); if (ret != 0) return ret; } return retval; } ",1 "static bool ldtr_valid(struct kvm_vcpu *vcpu) { struct kvm_segment ldtr; vmx_get_segment(vcpu, &ldtr, VCPU_SREG_LDTR); if (ldtr.unusable) return true; if (ldtr.selector & SEGMENT_TI_MASK) /* TI = 1 */ return false; if (ldtr.type != 2) return false; if (!ldtr.present) return false; return true; } ",0 "void WebKitTestController::PluginCrashed(const base::FilePath& plugin_path, base::ProcessId plugin_pid) { DCHECK(CalledOnValidThread()); printer_->AddErrorMessage( base::StringPrintf(""#CRASHED - plugin (pid %d)"", plugin_pid)); base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(base::IgnoreResult(&WebKitTestController::DiscardMainWindow), base::Unretained(this))); } ",0 "void HWNDMessageHandler::DispatchKeyEventPostIME(const ui::KeyEvent& key) { SetMsgHandled(delegate_->HandleKeyEvent(key)); } ",0 "void webkit_web_frame_core_frame_gone(WebKitWebFrame* frame) { ASSERT(WEBKIT_IS_WEB_FRAME(frame)); frame->priv->coreFrame = 0; } ",0 "autofill::Suggestion PasswordAutofillManager::CreateFormNotSecureWarning() { autofill::Suggestion http_warning_suggestion( l10n_util::GetStringUTF8(IDS_AUTOFILL_LOGIN_HTTP_WARNING_MESSAGE), l10n_util::GetStringUTF8(IDS_AUTOFILL_HTTP_WARNING_LEARN_MORE), ""httpWarning"", autofill::POPUP_ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE); if (!did_show_form_not_secure_warning_) { did_show_form_not_secure_warning_ = true; metrics_util::LogShowedFormNotSecureWarningOnCurrentNavigation(); } return http_warning_suggestion; } ",0 "decode_OFPAT_RAW_SET_DL_SRC(const struct ofp_action_dl_addr *a, enum ofp_version ofp_version OVS_UNUSED, struct ofpbuf *out) { ofpact_put_SET_ETH_SRC(out)->mac = a->dl_addr; return 0; } ",0 "bool xmp_files_get_xmp_xmpstring(XmpFilePtr xf, XmpStringPtr xmp_packet, XmpPacketInfo* packet_info) { CHECK_PTR(xf, false); CHECK_PTR(xmp_packet, false); RESET_ERROR; bool result = false; try { SXMPFiles *txf = reinterpret_cast(xf); XMP_PacketInfo xmp_packet_info; result = txf->GetXMP(NULL, reinterpret_cast(xmp_packet), &xmp_packet_info); if (packet_info) { packet_info->offset = xmp_packet_info.offset; packet_info->length = xmp_packet_info.length; packet_info->padSize = xmp_packet_info.padSize; packet_info->charForm = xmp_packet_info.charForm; packet_info->writeable = xmp_packet_info.writeable; packet_info->hasWrapper = xmp_packet_info.hasWrapper; packet_info->pad = xmp_packet_info.pad; } } catch(const XMP_Error & e) { set_error(e); } return result; } ",0 "static void skb_drop_list(struct sk_buff **listp) { kfree_skb_list(*listp); *listp = NULL; } ",0 "static int bprm_mm_init(struct linux_binprm *bprm) { int err; struct mm_struct *mm = NULL; bprm->mm = mm = mm_alloc(); err = -ENOMEM; if (!mm) goto err; err = __bprm_mm_init(bprm); if (err) goto err; return 0; err: if (mm) { bprm->mm = NULL; mmdrop(mm); } return err; } ",0 "WM_SYMBOL int WildMidi_ConvertBufferToMidi (uint8_t *in, uint32_t insize, uint8_t **out, uint32_t *outsize) { if (!in || !out || !outsize) { _WM_GLOBAL_ERROR(__FUNCTION__, __LINE__, WM_ERR_INVALID_ARG, ""(NULL params)"", 0); return (-1); } if (!memcmp(in, ""FORM"", 4)) { if (_WM_xmi2midi(in, insize, out, outsize, _cvt_get_option(WM_CO_XMI_TYPE)) < 0) { return (-1); } } else if (!memcmp(in, ""MUS"", 3)) { if (_WM_mus2midi(in, insize, out, outsize, _cvt_get_option(WM_CO_FREQUENCY)) < 0) { return (-1); } } else if (!memcmp(in, ""MThd"", 4)) { _WM_GLOBAL_ERROR(__FUNCTION__, __LINE__, 0, ""Already a midi file"", 0); return (-1); } else { _WM_GLOBAL_ERROR(__FUNCTION__, __LINE__, WM_ERR_INVALID, NULL, 0); return (-1); } return (0); } ",0 "PHP_FUNCTION(snmp2_real_walk) { php_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU, SNMP_CMD_WALK, SNMP_VERSION_2c); } ",0 "static void tcp_v4_reqsk_send_ack(const struct sock *sk, struct sk_buff *skb, struct request_sock *req) { /* sk->sk_state == TCP_LISTEN -> for regular TCP_SYN_RECV * sk->sk_state == TCP_SYN_RECV -> for Fast Open. */ u32 seq = (sk->sk_state == TCP_LISTEN) ? tcp_rsk(req)->snt_isn + 1 : tcp_sk(sk)->snd_nxt; /* RFC 7323 2.3 * The window field (SEG.WND) of every outgoing segment, with the * exception of segments, MUST be right-shifted by * Rcv.Wind.Shift bits: */ tcp_v4_send_ack(sock_net(sk), skb, seq, tcp_rsk(req)->rcv_nxt, req->rsk_rcv_wnd >> inet_rsk(req)->rcv_wscale, tcp_time_stamp, req->ts_recent, 0, tcp_md5_do_lookup(sk, (union tcp_md5_addr *)&ip_hdr(skb)->daddr, AF_INET), inet_rsk(req)->no_srccheck ? IP_REPLY_ARG_NOSRCCHECK : 0, ip_hdr(skb)->tos); } ",0 "bool BitStack::top() const { if (!m_size) return false; unsigned shift = (m_size - 1) & bitInWordMask; return m_words.last() & (1U << shift); } ",0 "void DownloadItemImpl::SetHashState( std::unique_ptr hash_state) { hash_state_ = std::move(hash_state); if (!hash_state_) { destination_info_.hash.clear(); return; } std::unique_ptr clone_of_hash_state(hash_state_->Clone()); std::vector hash_value(clone_of_hash_state->GetHashLength()); clone_of_hash_state->Finish(&hash_value.front(), hash_value.size()); destination_info_.hash.assign(hash_value.begin(), hash_value.end()); } ",0 " psh_corner_is_flat( FT_Pos x_in, FT_Pos y_in, FT_Pos x_out, FT_Pos y_out ) { FT_Pos ax = x_in; FT_Pos ay = y_in; FT_Pos d_in, d_out, d_corner; if ( ax < 0 ) ax = -ax; if ( ay < 0 ) ay = -ay; d_in = ax + ay; ax = x_out; if ( ax < 0 ) ax = -ax; ay = y_out; if ( ay < 0 ) ay = -ay; d_out = ax + ay; ax = x_out + x_in; if ( ax < 0 ) ax = -ax; ay = y_out + y_in; if ( ay < 0 ) ay = -ay; d_corner = ax + ay; return ( d_in + d_out - d_corner ) < ( d_corner >> 4 ); } ",0 "void RenderViewImpl::didCreateDataSource(WebFrame* frame, WebDataSource* ds) { DocumentState* document_state = DocumentState::FromDataSource(ds); if (!document_state) { document_state = new DocumentState; ds->setExtraData(document_state); } bool content_initiated = !pending_navigation_params_.get(); if (content_initiated) document_state->set_navigation_state( NavigationState::CreateContentInitiated()); else PopulateStateFromPendingNavigationParams(document_state); if (webview()) { if (WebFrame* old_frame = webview()->mainFrame()) { const WebURLRequest& original_request = ds->originalRequest(); const GURL referrer( original_request.httpHeaderField(WebString::fromUTF8(""Referer""))); if (!referrer.is_empty() && DocumentState::FromDataSource( old_frame->dataSource())->was_prefetcher()) { for (;old_frame;old_frame = old_frame->traverseNext(false)) { WebDataSource* old_frame_ds = old_frame->dataSource(); if (old_frame_ds && referrer == GURL(old_frame_ds->request().url())) { document_state->set_was_referred_by_prefetcher(true); break; } } } } } if (content_initiated) { const WebURLRequest& request = ds->request(); switch (request.cachePolicy()) { case WebURLRequest::UseProtocolCachePolicy: // normal load. document_state->set_load_type(DocumentState::LINK_LOAD_NORMAL); break; case WebURLRequest::ReloadIgnoringCacheData: // reload. document_state->set_load_type(DocumentState::LINK_LOAD_RELOAD); break; case WebURLRequest::ReturnCacheDataElseLoad: // allow stale data. document_state->set_load_type( DocumentState::LINK_LOAD_CACHE_STALE_OK); break; case WebURLRequest::ReturnCacheDataDontLoad: // Don't re-post. document_state->set_load_type(DocumentState::LINK_LOAD_CACHE_ONLY); break; } } FOR_EACH_OBSERVER( RenderViewObserver, observers_, DidCreateDataSource(frame, ds)); } ",0 "void HTMLMediaElement::AudioClientImpl::setFormat(size_t numberOfChannels, float sampleRate) { if (m_client) m_client->setFormat(numberOfChannels, sampleRate); } ",0 "match_principals_file(struct ssh *ssh, struct passwd *pw, char *file, struct sshkey_cert *cert, struct sshauthopt **authoptsp) { FILE *f; int success; if (authoptsp != NULL) *authoptsp = NULL; temporarily_use_uid(pw); debug(""trying authorized principals file %s"", file); if ((f = auth_openprincipals(file, pw, options.strict_modes)) == NULL) { restore_uid(); return 0; } success = process_principals(ssh, f, file, cert, authoptsp); fclose(f); restore_uid(); return success; } ",0 "make_spnego_token(const char *name) { return (spnego_token_t)strdup(name); } ",0 "int TabStrip::tab_area_width() const { return width() - new_tab_button_width(); } ",0 "bool InputWindowInfo::touchableRegionContainsPoint(int32_t x, int32_t y) const { return touchableRegion.contains(x,y); } ",0 "grub_disk_dev_register (grub_disk_dev_t dev) { dev->next = grub_disk_dev_list; grub_disk_dev_list = dev; } ",0 "static int ext4_ext_zeroout(struct inode *inode, struct ext4_extent *ex) { ext4_fsblk_t ee_pblock; unsigned int ee_len; int ret; ee_len = ext4_ext_get_actual_len(ex); ee_pblock = ext4_ext_pblock(ex); ret = sb_issue_zeroout(inode->i_sb, ee_pblock, ee_len, GFP_NOFS); if (ret > 0) ret = 0; return ret; } ",0 "HTMLConstructionSite::HTMLConstructionSite(Document* document, FragmentScriptingPermission scriptingPermission, bool isParsingFragment) : m_document(document) , m_fragmentScriptingPermission(scriptingPermission) , m_isParsingFragment(isParsingFragment) , m_redirectAttachToFosterParent(false) { } ",0 "hfs_write_data_block(struct archive_write_disk *a, const char *buff, size_t size) { uint64_t start_size = size; ssize_t bytes_written = 0; ssize_t bytes_to_write; if (size == 0) return (ARCHIVE_OK); if (a->filesize == 0 || a->fd < 0) { archive_set_error(&a->archive, 0, ""Attempt to write to an empty file""); return (ARCHIVE_WARN); } /* If this write would run beyond the file size, truncate it. */ if (a->filesize >= 0 && (int64_t)(a->offset + size) > a->filesize) start_size = size = (size_t)(a->filesize - a->offset); /* Write the data. */ while (size > 0) { bytes_to_write = size; /* Seek if necessary to the specified offset. */ if (a->offset < a->fd_offset) { /* Can't support backword move. */ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, ""Seek failed""); return (ARCHIVE_FATAL); } else if (a->offset > a->fd_offset) { int64_t skip = a->offset - a->fd_offset; char nullblock[1024]; memset(nullblock, 0, sizeof(nullblock)); while (skip > 0) { if (skip > (int64_t)sizeof(nullblock)) bytes_written = hfs_write_decmpfs_block( a, nullblock, sizeof(nullblock)); else bytes_written = hfs_write_decmpfs_block( a, nullblock, skip); if (bytes_written < 0) { archive_set_error(&a->archive, errno, ""Write failed""); return (ARCHIVE_WARN); } skip -= bytes_written; } a->fd_offset = a->offset; } bytes_written = hfs_write_decmpfs_block(a, buff, bytes_to_write); if (bytes_written < 0) return (bytes_written); buff += bytes_written; size -= bytes_written; a->total_bytes_written += bytes_written; a->offset += bytes_written; a->fd_offset = a->offset; } return (start_size - size); } ",0 "String Document::compatMode() const { return inQuirksMode() ? ""BackCompat"" : ""CSS1Compat""; } ",0 "static int __tipc_nl_compat_publ_dump(struct tipc_nl_compat_msg *msg, struct nlattr **attrs) { u32 type, lower, upper; struct nlattr *publ[TIPC_NLA_PUBL_MAX + 1]; int err; if (!attrs[TIPC_NLA_PUBL]) return -EINVAL; err = nla_parse_nested(publ, TIPC_NLA_PUBL_MAX, attrs[TIPC_NLA_PUBL], NULL); if (err) return err; type = nla_get_u32(publ[TIPC_NLA_PUBL_TYPE]); lower = nla_get_u32(publ[TIPC_NLA_PUBL_LOWER]); upper = nla_get_u32(publ[TIPC_NLA_PUBL_UPPER]); if (lower == upper) tipc_tlv_sprintf(msg->rep, "" {%u,%u}"", type, lower); else tipc_tlv_sprintf(msg->rep, "" {%u,%u,%u}"", type, lower, upper); return 0; } ",0 "void HeadlessWebContentsImpl::DetachClient(HeadlessDevToolsClient* client) { DCHECK(agent_host_); HeadlessDevToolsClientImpl::From(client)->DetachFromHost(agent_host_.get()); } ",0 "static void EnterNamespaceSandbox(LinuxSandbox* linux_sandbox, base::Closure* post_fork_parent_callback) { linux_sandbox->EngageNamespaceSandbox(); if (getpid() == 1) { base::Closure drop_all_caps_callback = base::Bind(&DropAllCapabilities, linux_sandbox->proc_fd()); base::Closure callback = base::Bind( &RunTwoClosures, &drop_all_caps_callback, post_fork_parent_callback); CHECK(CreateInitProcessReaper(&callback)); } } ",0 "PHP_FUNCTION(pg_meta_data) { zval *pgsql_link; char *table_name; size_t table_name_len; zend_bool extended=0; PGconn *pgsql; int id = -1; if (zend_parse_parameters(ZEND_NUM_ARGS(), ""rs|b"", &pgsql_link, &table_name, &table_name_len, &extended) == FAILURE) { return; } ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, ""PostgreSQL link"", le_link, le_plink); array_init(return_value); if (php_pgsql_meta_data(pgsql, table_name, return_value, extended) == FAILURE) { zval_dtor(return_value); /* destroy array */ RETURN_FALSE; } } ",0 "int XMLRPC_GetValueInt(XMLRPC_VALUE value) { return ((value && value->type == xmlrpc_int) ? value->i : 0); } ",0 "void RenderWidgetHostImpl::DidUpdateVisualProperties( const cc::RenderFrameMetadata& metadata) { TRACE_EVENT0(""renderer_host"", ""RenderWidgetHostImpl::DidUpdateVisualProperties""); DCHECK(!metadata.viewport_size_in_pixels.IsEmpty()); visual_properties_ack_pending_ = false; NotificationService::current()->Notify( NOTIFICATION_RENDER_WIDGET_HOST_DID_UPDATE_VISUAL_PROPERTIES, Source(this), NotificationService::NoDetails()); if (!view_ || is_hidden_) return; viz::ScopedSurfaceIdAllocator scoped_allocator = view_->DidUpdateVisualProperties(metadata); if (auto_resize_enabled_ && delegate_) { gfx::Size viewport_size_in_dip = gfx::ScaleToCeiledSize( metadata.viewport_size_in_pixels, 1.f / metadata.device_scale_factor); delegate_->ResizeDueToAutoResize(this, viewport_size_in_dip); } } ",0 "static int opbswap(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; if (op->operands[0].type & OT_REGALL) { if (op->operands[0].reg == X86R_UNDEFINED) { return -1; } if (op->operands[0].type & OT_QWORD) { data[l++] = 0x48; data[l++] = 0x0f; data[l++] = 0xc8 + op->operands[0].reg; } else if (op->operands[0].type & OT_DWORD) { data[l++] = 0x0f; data[l++] = 0xc8 + op->operands[0].reg; } else { return -1; } } return l; } ",0 " CreateObserverForSession(int render_process_id, int render_frame_id, int session_id) { DCHECK_CURRENTLY_ON(BrowserThread::UI); RenderFrameHost* render_frame_host = RenderFrameHost::FromID(render_process_id, render_frame_id); if (!render_frame_host) return; WebContents* web_contents = WebContents::FromRenderFrameHost(render_frame_host); if (!web_contents) return; auto& observer = contents_observers_[web_contents]; if (!observer) observer = std::make_unique(web_contents, this); observer->AddObservedFrame(render_frame_host, session_id); } ",0 "static int atomic_open(struct nameidata *nd, struct dentry *dentry, struct path *path, struct file *file, const struct open_flags *op, bool got_write, bool need_lookup, int *opened) { struct inode *dir = nd->path.dentry->d_inode; unsigned open_flag = open_to_namei_flags(op->open_flag); umode_t mode; int error; int acc_mode; int create_error = 0; struct dentry *const DENTRY_NOT_SET = (void *) -1UL; bool excl; BUG_ON(dentry->d_inode); /* Don't create child dentry for a dead directory. */ if (unlikely(IS_DEADDIR(dir))) { error = -ENOENT; goto out; } mode = op->mode; if ((open_flag & O_CREAT) && !IS_POSIXACL(dir)) mode &= ~current_umask(); excl = (open_flag & (O_EXCL | O_CREAT)) == (O_EXCL | O_CREAT); if (excl) open_flag &= ~O_TRUNC; /* * Checking write permission is tricky, bacuse we don't know if we are * going to actually need it: O_CREAT opens should work as long as the * file exists. But checking existence breaks atomicity. The trick is * to check access and if not granted clear O_CREAT from the flags. * * Another problem is returing the ""right"" error value (e.g. for an * O_EXCL open we want to return EEXIST not EROFS). */ if (((open_flag & (O_CREAT | O_TRUNC)) || (open_flag & O_ACCMODE) != O_RDONLY) && unlikely(!got_write)) { if (!(open_flag & O_CREAT)) { /* * No O_CREATE -> atomicity not a requirement -> fall * back to lookup + open */ goto no_open; } else if (open_flag & (O_EXCL | O_TRUNC)) { /* Fall back and fail with the right error */ create_error = -EROFS; goto no_open; } else { /* No side effects, safe to clear O_CREAT */ create_error = -EROFS; open_flag &= ~O_CREAT; } } if (open_flag & O_CREAT) { error = may_o_create(&nd->path, dentry, mode); if (error) { create_error = error; if (open_flag & O_EXCL) goto no_open; open_flag &= ~O_CREAT; } } if (nd->flags & LOOKUP_DIRECTORY) open_flag |= O_DIRECTORY; file->f_path.dentry = DENTRY_NOT_SET; file->f_path.mnt = nd->path.mnt; error = dir->i_op->atomic_open(dir, dentry, file, open_flag, mode, opened); if (error < 0) { if (create_error && error == -ENOENT) error = create_error; goto out; } if (error) { /* returned 1, that is */ if (WARN_ON(file->f_path.dentry == DENTRY_NOT_SET)) { error = -EIO; goto out; } if (file->f_path.dentry) { dput(dentry); dentry = file->f_path.dentry; } if (*opened & FILE_CREATED) fsnotify_create(dir, dentry); if (!dentry->d_inode) { WARN_ON(*opened & FILE_CREATED); if (create_error) { error = create_error; goto out; } } else { if (excl && !(*opened & FILE_CREATED)) { error = -EEXIST; goto out; } } goto looked_up; } /* * We didn't have the inode before the open, so check open permission * here. */ acc_mode = op->acc_mode; if (*opened & FILE_CREATED) { WARN_ON(!(open_flag & O_CREAT)); fsnotify_create(dir, dentry); acc_mode = MAY_OPEN; } error = may_open(&file->f_path, acc_mode, open_flag); if (error) fput(file); out: dput(dentry); return error; no_open: if (need_lookup) { dentry = lookup_real(dir, dentry, nd->flags); if (IS_ERR(dentry)) return PTR_ERR(dentry); if (create_error) { int open_flag = op->open_flag; error = create_error; if ((open_flag & O_EXCL)) { if (!dentry->d_inode) goto out; } else if (!dentry->d_inode) { goto out; } else if ((open_flag & O_TRUNC) && d_is_reg(dentry)) { goto out; } /* will fail later, go on to get the right error */ } } looked_up: path->dentry = dentry; path->mnt = nd->path.mnt; return 1; } ",0 "static bool __follow_mount_rcu(struct nameidata *nd, struct path *path, struct inode **inode) { for (;;) { struct mount *mounted; /* * Don't forget we might have a non-mountpoint managed dentry * that wants to block transit. */ switch (managed_dentry_rcu(path->dentry)) { case -ECHILD: default: return false; case -EISDIR: return true; case 0: break; } if (!d_mountpoint(path->dentry)) return !(path->dentry->d_flags & DCACHE_NEED_AUTOMOUNT); mounted = __lookup_mnt(path->mnt, path->dentry); if (!mounted) break; path->mnt = &mounted->mnt; path->dentry = mounted->mnt.mnt_root; nd->flags |= LOOKUP_JUMPED; nd->seq = read_seqcount_begin(&path->dentry->d_seq); /* * Update the inode too. We don't need to re-check the * dentry sequence number here after this d_inode read, * because a mount-point is always pinned. */ *inode = path->dentry->d_inode; } return !read_seqretry(&mount_lock, nd->m_seq) && !(path->dentry->d_flags & DCACHE_NEED_AUTOMOUNT); } ",0 "ChromePluginServiceFilter* ChromePluginServiceFilter::GetInstance() { return Singleton::get(); } ",0 "static int asf_read_marker(AVFormatContext *s, const GUIDParseTable *g) { ASFContext *asf = s->priv_data; AVIOContext *pb = s->pb; uint64_t size = avio_rl64(pb); int i, nb_markers, ret; size_t len; char name[1024]; avio_skip(pb, 8); avio_skip(pb, 8); // skip reserved GUID nb_markers = avio_rl32(pb); avio_skip(pb, 2); // skip reserved field len = avio_rl16(pb); for (i = 0; i < len; i++) avio_skip(pb, 1); for (i = 0; i < nb_markers; i++) { int64_t pts; avio_skip(pb, 8); pts = avio_rl64(pb); pts -= asf->preroll * 10000; avio_skip(pb, 2); // entry length avio_skip(pb, 4); // send time avio_skip(pb, 4); // flags len = avio_rl32(pb); if ((ret = avio_get_str16le(pb, len, name, sizeof(name))) < len) avio_skip(pb, len - ret); avpriv_new_chapter(s, i, (AVRational) { 1, 10000000 }, pts, AV_NOPTS_VALUE, name); } align_position(pb, asf->offset, size); return 0; } ",0 "void Browser::FocusSearch() { UserMetrics::RecordAction(UserMetricsAction(""FocusSearch""), profile_); window_->GetLocationBar()->FocusSearch(); } ",0 "void vga_init(VGACommonState *s, Object *obj, MemoryRegion *address_space, MemoryRegion *address_space_io, bool init_vga_ports) { MemoryRegion *vga_io_memory; const MemoryRegionPortio *vga_ports, *vbe_ports; qemu_register_reset(vga_reset, s); s->bank_offset = 0; s->legacy_address_space = address_space; vga_io_memory = vga_init_io(s, obj, &vga_ports, &vbe_ports); memory_region_add_subregion_overlap(address_space, 0x000a0000, vga_io_memory, 1); memory_region_set_coalescing(vga_io_memory); if (init_vga_ports) { portio_list_init(&s->vga_port_list, obj, vga_ports, s, ""vga""); portio_list_set_flush_coalesced(&s->vga_port_list); portio_list_add(&s->vga_port_list, address_space_io, 0x3b0); } if (vbe_ports) { portio_list_init(&s->vbe_port_list, obj, vbe_ports, s, ""vbe""); portio_list_add(&s->vbe_port_list, address_space_io, 0x1ce); } } ",0 "void ImageLoader::SetImageForTest(ImageResourceContent* new_image) { DCHECK(new_image); SetImageWithoutConsideringPendingLoadEvent(new_image); } ",0 "static int do_xconvfetch(struct dlist *cidlist, modseq_t ifchangedsince, struct fetchargs *fetchargs) { struct conversations_state *state = NULL; int r = 0; struct index_state *index_state = NULL; struct dlist *dl; hash_table wanted_cids = HASH_TABLE_INITIALIZER; strarray_t folder_list = STRARRAY_INITIALIZER; struct index_init init; int i; r = conversations_open_user(imapd_userid, &state); if (r) goto out; construct_hash_table(&wanted_cids, 1024, 0); for (dl = cidlist->head; dl; dl = dl->next) { r = xconvfetch_lookup(state, dlist_num(dl), ifchangedsince, &wanted_cids, &folder_list); if (r) goto out; } /* unchanged, woot */ if (!folder_list.count) goto out; fetchargs->cidhash = &wanted_cids; memset(&init, 0, sizeof(struct index_init)); init.userid = imapd_userid; init.authstate = imapd_authstate; init.out = imapd_out; for (i = 0; i < folder_list.count; i++) { const char *mboxname = folder_list.data[i]; r = index_open(mboxname, &init, &index_state); if (r == IMAP_MAILBOX_NONEXISTENT) continue; if (r) goto out; index_checkflags(index_state, 0, 0); /* make sure \Deleted messages are expunged. Will also lock the * mailbox state and read any new information */ r = index_expunge(index_state, NULL, 1); if (!r) index_fetchresponses(index_state, NULL, /*usinguid*/1, fetchargs, NULL); index_close(&index_state); if (r) goto out; } r = 0; out: index_close(&index_state); conversations_commit(&state); free_hash_table(&wanted_cids, NULL); strarray_fini(&folder_list); return r; } ",0 "HTMLDataListElement* HTMLInputElement::dataList() const { if (!m_hasNonEmptyList) return 0; if (!m_inputType->shouldRespectListAttribute()) return 0; Element* element = treeScope().getElementById(fastGetAttribute(listAttr)); if (!element) return 0; if (!element->hasTagName(datalistTag)) return 0; return toHTMLDataListElement(element); } ",0 "dissect_FORM_1(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { proto_tree *subtree; guint32 flags; subtree = proto_tree_add_subtree(tree, tvb, offset, 0, ett_FORM_1, NULL, ""Form level 1""); offset = dissect_ndr_str_pointer_item( tvb, offset, pinfo, subtree, di, drep, NDR_POINTER_UNIQUE, ""Name"", hf_form_name, 0); /* Eek - we need to know whether this pointer was NULL or not. Currently there is not any way to do this. */ if (tvb_reported_length_remaining(tvb, offset) <= 0) goto done; offset = dissect_ndr_uint32( tvb, offset, pinfo, subtree, di, drep, hf_form_flags, &flags); offset = dissect_ndr_uint32( tvb, offset, pinfo, subtree, di, drep, hf_form_unknown, NULL); offset = dissect_ndr_uint32( tvb, offset, pinfo, subtree, di, drep, hf_form_width, NULL); offset = dissect_ndr_uint32( tvb, offset, pinfo, subtree, di, drep, hf_form_height, NULL); offset = dissect_ndr_uint32( tvb, offset, pinfo, subtree, di, drep, hf_form_left_margin, NULL); offset = dissect_ndr_uint32( tvb, offset, pinfo, subtree, di, drep, hf_form_top_margin, NULL); offset = dissect_ndr_uint32( tvb, offset, pinfo, subtree, di, drep, hf_form_horiz_len, NULL); offset = dissect_ndr_uint32( tvb, offset, pinfo, subtree, di, drep, hf_form_vert_len, NULL); done: return offset; } ",0 "pcmkDeregisterNode(xmlNodePtr node) { __xml_private_free(node->_private); } ",0 "static void gen_shiftd_rm_T1(DisasContext *s, TCGMemOp ot, int op1, bool is_right, TCGv count_in) { target_ulong mask = (ot == MO_64 ? 63 : 31); TCGv count; /* load */ if (op1 == OR_TMP0) { gen_op_ld_v(s, ot, cpu_T0, cpu_A0); } else { gen_op_mov_v_reg(ot, cpu_T0, op1); } count = tcg_temp_new(); tcg_gen_andi_tl(count, count_in, mask); switch (ot) { case MO_16: /* Note: we implement the Intel behaviour for shift count > 16. This means ""shrdw C, B, A"" shifts A:B:A >> C. Build the B:A portion by constructing it as a 32-bit value. */ if (is_right) { tcg_gen_deposit_tl(cpu_tmp0, cpu_T0, cpu_T1, 16, 16); tcg_gen_mov_tl(cpu_T1, cpu_T0); tcg_gen_mov_tl(cpu_T0, cpu_tmp0); } else { tcg_gen_deposit_tl(cpu_T1, cpu_T0, cpu_T1, 16, 16); } /* FALLTHRU */ #ifdef TARGET_X86_64 case MO_32: /* Concatenate the two 32-bit values and use a 64-bit shift. */ tcg_gen_subi_tl(cpu_tmp0, count, 1); if (is_right) { tcg_gen_concat_tl_i64(cpu_T0, cpu_T0, cpu_T1); tcg_gen_shr_i64(cpu_tmp0, cpu_T0, cpu_tmp0); tcg_gen_shr_i64(cpu_T0, cpu_T0, count); } else { tcg_gen_concat_tl_i64(cpu_T0, cpu_T1, cpu_T0); tcg_gen_shl_i64(cpu_tmp0, cpu_T0, cpu_tmp0); tcg_gen_shl_i64(cpu_T0, cpu_T0, count); tcg_gen_shri_i64(cpu_tmp0, cpu_tmp0, 32); tcg_gen_shri_i64(cpu_T0, cpu_T0, 32); } break; #endif default: tcg_gen_subi_tl(cpu_tmp0, count, 1); if (is_right) { tcg_gen_shr_tl(cpu_tmp0, cpu_T0, cpu_tmp0); tcg_gen_subfi_tl(cpu_tmp4, mask + 1, count); tcg_gen_shr_tl(cpu_T0, cpu_T0, count); tcg_gen_shl_tl(cpu_T1, cpu_T1, cpu_tmp4); } else { tcg_gen_shl_tl(cpu_tmp0, cpu_T0, cpu_tmp0); if (ot == MO_16) { /* Only needed if count > 16, for Intel behaviour. */ tcg_gen_subfi_tl(cpu_tmp4, 33, count); tcg_gen_shr_tl(cpu_tmp4, cpu_T1, cpu_tmp4); tcg_gen_or_tl(cpu_tmp0, cpu_tmp0, cpu_tmp4); } tcg_gen_subfi_tl(cpu_tmp4, mask + 1, count); tcg_gen_shl_tl(cpu_T0, cpu_T0, count); tcg_gen_shr_tl(cpu_T1, cpu_T1, cpu_tmp4); } tcg_gen_movi_tl(cpu_tmp4, 0); tcg_gen_movcond_tl(TCG_COND_EQ, cpu_T1, count, cpu_tmp4, cpu_tmp4, cpu_T1); tcg_gen_or_tl(cpu_T0, cpu_T0, cpu_T1); break; } /* store */ gen_op_st_rm_T0_A0(s, ot, op1); gen_shift_flags(s, ot, cpu_T0, cpu_tmp0, count, is_right); tcg_temp_free(count); } ",0 "int expand_upwards(struct vm_area_struct *vma, unsigned long address) { struct mm_struct *mm = vma->vm_mm; struct vm_area_struct *next; unsigned long gap_addr; int error = 0; if (!(vma->vm_flags & VM_GROWSUP)) return -EFAULT; /* Guard against exceeding limits of the address space. */ address &= PAGE_MASK; if (address >= (TASK_SIZE & PAGE_MASK)) return -ENOMEM; address += PAGE_SIZE; /* Enforce stack_guard_gap */ gap_addr = address + stack_guard_gap; /* Guard against overflow */ if (gap_addr < address || gap_addr > TASK_SIZE) gap_addr = TASK_SIZE; next = vma->vm_next; if (next && next->vm_start < gap_addr && (next->vm_flags & (VM_WRITE|VM_READ|VM_EXEC))) { if (!(next->vm_flags & VM_GROWSUP)) return -ENOMEM; /* Check that both stack segments have the same anon_vma? */ } /* We must make sure the anon_vma is allocated. */ if (unlikely(anon_vma_prepare(vma))) return -ENOMEM; /* * vma->vm_start/vm_end cannot change under us because the caller * is required to hold the mmap_sem in read mode. We need the * anon_vma lock to serialize against concurrent expand_stacks. */ anon_vma_lock_write(vma->anon_vma); /* Somebody else might have raced and expanded it already */ if (address > vma->vm_end) { unsigned long size, grow; size = address - vma->vm_start; grow = (address - vma->vm_end) >> PAGE_SHIFT; error = -ENOMEM; if (vma->vm_pgoff + (size >> PAGE_SHIFT) >= vma->vm_pgoff) { error = acct_stack_growth(vma, size, grow); if (!error) { /* * vma_gap_update() doesn't support concurrent * updates, but we only hold a shared mmap_sem * lock here, so we need to protect against * concurrent vma expansions. * anon_vma_lock_write() doesn't help here, as * we don't guarantee that all growable vmas * in a mm share the same root anon vma. * So, we reuse mm->page_table_lock to guard * against concurrent vma expansions. */ spin_lock(&mm->page_table_lock); if (vma->vm_flags & VM_LOCKED) mm->locked_vm += grow; vm_stat_account(mm, vma->vm_flags, grow); anon_vma_interval_tree_pre_update_vma(vma); vma->vm_end = address; anon_vma_interval_tree_post_update_vma(vma); if (vma->vm_next) vma_gap_update(vma->vm_next); else mm->highest_vm_end = vm_end_gap(vma); spin_unlock(&mm->page_table_lock); perf_event_mmap(vma); } } } anon_vma_unlock_write(vma->anon_vma); khugepaged_enter_vma_merge(vma, vma->vm_flags); validate_mm(mm); return error; } ",0 "RegistrationManager::PendingRegistrationInfo::PendingRegistrationInfo() {} ",0 "void PageInfoWindowGtk::Show() { gtk_widget_show(dialog_); } ",0 "ReadUserLogStateAccess::getEventNumberDiff( const ReadUserLogStateAccess &other, long &diff) const { const ReadUserLogFileState *ostate; if ( !other.getState( ostate ) ) { return false; } int64_t my_recno, other_recno; if ( !m_state->getLogRecordNo(my_recno) || ! ostate->getLogRecordNo(other_recno) ) { return false; } int64_t idiff = my_recno - other_recno; diff = (long) idiff; return true; } ",0 "static void conn_set_state(conn *c, enum conn_states state) { assert(c != NULL); assert(state >= conn_listening && state < conn_max_state); if (state != c->state) { if (settings.verbose > 2) { fprintf(stderr, ""%d: going from %s to %s\n"", c->sfd, state_text(c->state), state_text(state)); } if (state == conn_write || state == conn_mwrite) { MEMCACHED_PROCESS_COMMAND_END(c->sfd, c->wbuf, c->wbytes); } c->state = state; } } ",0 "void ResourcePrefetchPredictorTest::TearDown() { EXPECT_EQ(*predictor_->host_redirect_data_->data_cache_, mock_tables_->host_redirect_table_.data_); EXPECT_EQ(*predictor_->origin_data_->data_cache_, mock_tables_->origin_table_.data_); loading_predictor_->Shutdown(); } ",0 "void MediaStreamManager::ChangeMediaStreamSourceFromBrowser( const std::string& label) { DCHECK_CURRENTLY_ON(BrowserThread::IO); DeviceRequest* request = FindRequest(label); if (!request) return; SetUpDesktopCaptureChangeSourceRequest(request, label); IncrementDesktopCaptureCounter(DESKTOP_CAPTURE_NOTIFICATION_CHANGE_SOURCE); } ",0 " *create_render_view_impl)(CompositorDependencies* compositor_deps, const mojom::CreateViewParams&)) { CHECK(!g_create_render_view_impl); g_create_render_view_impl = create_render_view_impl; } ",0 "void RenderFrameImpl::PepperTextInputTypeChanged( PepperPluginInstanceImpl* instance) { if (instance != focused_pepper_plugin_) return; GetLocalRootRenderWidget()->UpdateTextInputState(); FocusedNodeChangedForAccessibility(WebNode()); } ",0 "void GLES2DecoderImpl::RestoreStateForSimulatedAttrib0() { const VertexAttribManager::VertexAttribInfo* info = vertex_attrib_manager_.GetVertexAttribInfo(0); const void* ptr = reinterpret_cast(info->offset()); BufferManager::BufferInfo* buffer_info = info->buffer(); glBindBuffer(GL_ARRAY_BUFFER, buffer_info ? buffer_info->service_id() : 0); glVertexAttribPointer( 0, info->size(), info->type(), info->normalized(), info->gl_stride(), ptr); glBindBuffer(GL_ARRAY_BUFFER, bound_array_buffer_ ? bound_array_buffer_->service_id() : 0); } ",0 "void SelectionEditor::ContextDestroyed(Document*) { Dispose(); style_version_for_dom_tree_ = static_cast(-1); style_version_for_flat_tree_ = static_cast(-1); selection_ = SelectionInDOMTree(); cached_visible_selection_in_dom_tree_ = VisibleSelection(); cached_visible_selection_in_flat_tree_ = VisibleSelectionInFlatTree(); cached_visible_selection_in_dom_tree_is_dirty_ = false; cached_visible_selection_in_flat_tree_is_dirty_ = false; } ",0 "xfs_attr3_leaf_to_node( struct xfs_da_args *args) { struct xfs_attr_leafblock *leaf; struct xfs_attr3_icleaf_hdr icleafhdr; struct xfs_attr_leaf_entry *entries; struct xfs_da_node_entry *btree; struct xfs_da3_icnode_hdr icnodehdr; struct xfs_da_intnode *node; struct xfs_inode *dp = args->dp; struct xfs_mount *mp = dp->i_mount; struct xfs_buf *bp1 = NULL; struct xfs_buf *bp2 = NULL; xfs_dablk_t blkno; int error; trace_xfs_attr_leaf_to_node(args); error = xfs_da_grow_inode(args, &blkno); if (error) goto out; error = xfs_attr3_leaf_read(args->trans, dp, 0, -1, &bp1); if (error) goto out; error = xfs_da_get_buf(args->trans, dp, blkno, -1, &bp2, XFS_ATTR_FORK); if (error) goto out; /* copy leaf to new buffer, update identifiers */ xfs_trans_buf_set_type(args->trans, bp2, XFS_BLFT_ATTR_LEAF_BUF); bp2->b_ops = bp1->b_ops; memcpy(bp2->b_addr, bp1->b_addr, args->geo->blksize); if (xfs_sb_version_hascrc(&mp->m_sb)) { struct xfs_da3_blkinfo *hdr3 = bp2->b_addr; hdr3->blkno = cpu_to_be64(bp2->b_bn); } xfs_trans_log_buf(args->trans, bp2, 0, args->geo->blksize - 1); /* * Set up the new root node. */ error = xfs_da3_node_create(args, 0, 1, &bp1, XFS_ATTR_FORK); if (error) goto out; node = bp1->b_addr; dp->d_ops->node_hdr_from_disk(&icnodehdr, node); btree = dp->d_ops->node_tree_p(node); leaf = bp2->b_addr; xfs_attr3_leaf_hdr_from_disk(args->geo, &icleafhdr, leaf); entries = xfs_attr3_leaf_entryp(leaf); /* both on-disk, don't endian-flip twice */ btree[0].hashval = entries[icleafhdr.count - 1].hashval; btree[0].before = cpu_to_be32(blkno); icnodehdr.count = 1; dp->d_ops->node_hdr_to_disk(node, &icnodehdr); xfs_trans_log_buf(args->trans, bp1, 0, args->geo->blksize - 1); error = 0; out: return error; } ",0 " static long vma_needs_reservation(struct hstate *h, struct vm_area_struct *vma, unsigned long addr) { struct address_space *mapping = vma->vm_file->f_mapping; struct inode *inode = mapping->host; if (vma->vm_flags & VM_MAYSHARE) { pgoff_t idx = vma_hugecache_offset(h, vma, addr); return region_chg(&inode->i_mapping->private_list, idx, idx + 1); } else if (!is_vma_resv_set(vma, HPAGE_RESV_OWNER)) { return 1; } else { long err; pgoff_t idx = vma_hugecache_offset(h, vma, addr); struct resv_map *reservations = vma_resv_map(vma); err = region_chg(&reservations->regions, idx, idx + 1); if (err < 0) return err; return 0; } } ",0 "void ParamTraits::Log(const gfx::PointF& v, std::string* l) { l->append(base::StringPrintf(""(%f, %f)"", v.x(), v.y())); } ",0 "void MediaStreamManager::WillDestroyCurrentMessageLoop() { DVLOG(3) << ""MediaStreamManager::WillDestroyCurrentMessageLoop()""; DCHECK(CalledOnIOThread()); if (media_devices_manager_) media_devices_manager_->StopMonitoring(); if (video_capture_manager_) video_capture_manager_->UnregisterListener(this); if (audio_input_device_manager_) audio_input_device_manager_->UnregisterListener(this); audio_input_device_manager_ = nullptr; video_capture_manager_ = nullptr; media_devices_manager_ = nullptr; g_media_stream_manager_tls_ptr.Pointer()->Set(nullptr); requests_.clear(); } ",0 " void remove_socket(asocket* s) { if (s->prev && s->next) { s->prev->next = s->next; s->next->prev = s->prev; s->next = 0; s->prev = 0; s->id = 0; } } ",0 "bool LayoutSVGViewportContainer::calculateLocalTransform() { if (!m_needsTransformUpdate) return false; m_localToParentTransform = AffineTransform::translation(m_viewport.x(), m_viewport.y()) * viewportTransform(); m_needsTransformUpdate = false; return true; } ",1 "static void InsertTabContentses(TabStripModel* tabstrip, TabContentsWrapper* contents1, TabContentsWrapper* contents2, TabContentsWrapper* contents3) { tabstrip->InsertTabContentsAt(GetInsertionIndex(tabstrip, contents1), contents1, TabStripModel::ADD_INHERIT_GROUP); tabstrip->InsertTabContentsAt(GetInsertionIndex(tabstrip, contents2), contents2, TabStripModel::ADD_INHERIT_GROUP); tabstrip->InsertTabContentsAt(GetInsertionIndex(tabstrip, contents3), contents3, TabStripModel::ADD_INHERIT_GROUP); } ",0 "static int crypto_xcbc_digest_init(struct shash_desc *pdesc) { unsigned long alignmask = crypto_shash_alignmask(pdesc->tfm); struct xcbc_desc_ctx *ctx = shash_desc_ctx(pdesc); int bs = crypto_shash_blocksize(pdesc->tfm); u8 *prev = PTR_ALIGN(&ctx->ctx[0], alignmask + 1) + bs; ctx->len = 0; memset(prev, 0, bs); return 0; } ",0 "int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize) { unsigned long npages, xpages, loop; struct page *pages; unsigned order; void *data; int ret; /* make various checks */ order = get_order(newsize); if (unlikely(order >= MAX_ORDER)) return -EFBIG; ret = inode_newsize_ok(inode, newsize); if (ret) return ret; i_size_write(inode, newsize); /* allocate enough contiguous pages to be able to satisfy the * request */ pages = alloc_pages(mapping_gfp_mask(inode->i_mapping), order); if (!pages) return -ENOMEM; /* split the high-order page into an array of single pages */ xpages = 1UL << order; npages = (newsize + PAGE_SIZE - 1) >> PAGE_SHIFT; split_page(pages, order); /* trim off any pages we don't actually require */ for (loop = npages; loop < xpages; loop++) __free_page(pages + loop); /* clear the memory we allocated */ newsize = PAGE_SIZE * npages; data = page_address(pages); memset(data, 0, newsize); /* attach all the pages to the inode's address space */ for (loop = 0; loop < npages; loop++) { struct page *page = pages + loop; ret = add_to_page_cache_lru(page, inode->i_mapping, loop, GFP_KERNEL); if (ret < 0) goto add_error; /* prevent the page from being discarded on memory pressure */ SetPageDirty(page); SetPageUptodate(page); unlock_page(page); put_page(page); } return 0; add_error: while (loop < npages) __free_page(pages + loop++); return ret; } ",0 "void PaletteTray::SessionStateChanged( SessionStateDelegate::SessionState state) { UpdateIconVisibility(); } ",0 "interruptible_sleep_on_timeout(wait_queue_head_t *q, long timeout) { return sleep_on_common(q, TASK_INTERRUPTIBLE, timeout); } ",0 "static inline struct hlist_head *bsg_dev_idx_hash(int index) { return &bsg_device_list[index & (BSG_LIST_ARRAY_SIZE - 1)]; } ",0 "static bool ExecuteSubscript(LocalFrame& frame, Event*, EditorCommandSource source, const String&) { return ExecuteToggleStyle(frame, source, InputEvent::InputType::kFormatSubscript, CSSPropertyVerticalAlign, ""baseline"", ""sub""); } ",0 "void inode_add_lru(struct inode *inode) { if (!(inode->i_state & (I_DIRTY_ALL | I_SYNC | I_FREEING | I_WILL_FREE)) && !atomic_read(&inode->i_count) && inode->i_sb->s_flags & SB_ACTIVE) inode_lru_list_add(inode); } ",0 "int skb_copy_datagram_iovec(const struct sk_buff *skb, int offset, struct iovec *to, int len) { int start = skb_headlen(skb); int i, copy = start - offset; struct sk_buff *frag_iter; trace_skb_copy_datagram_iovec(skb, len); /* Copy header. */ if (copy > 0) { if (copy > len) copy = len; if (memcpy_toiovec(to, skb->data + offset, copy)) goto fault; if ((len -= copy) == 0) return 0; offset += copy; } /* Copy paged appendix. Hmm... why does this look so complicated? */ for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { int end; const skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; WARN_ON(start > offset + len); end = start + skb_frag_size(frag); if ((copy = end - offset) > 0) { int err; u8 *vaddr; struct page *page = skb_frag_page(frag); if (copy > len) copy = len; vaddr = kmap(page); err = memcpy_toiovec(to, vaddr + frag->page_offset + offset - start, copy); kunmap(page); if (err) goto fault; if (!(len -= copy)) return 0; offset += copy; } start = end; } skb_walk_frags(skb, frag_iter) { int end; WARN_ON(start > offset + len); end = start + frag_iter->len; if ((copy = end - offset) > 0) { if (copy > len) copy = len; if (skb_copy_datagram_iovec(frag_iter, offset - start, to, copy)) goto fault; if ((len -= copy) == 0) return 0; offset += copy; } start = end; } if (!len) return 0; fault: return -EFAULT; } ",0 "int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx) { int ret; bn_check_top(a); bn_check_top(p); bn_check_top(m); /*- * For even modulus m = 2^k*m_odd, it might make sense to compute * a^p mod m_odd and a^p mod 2^k separately (with Montgomery * exponentiation for the odd part), using appropriate exponent * reductions, and combine the results using the CRT. * * For now, we use Montgomery only if the modulus is odd; otherwise, * exponentiation using the reciprocal-based quick remaindering * algorithm is used. * * (Timing obtained with expspeed.c [computations a^p mod m * where a, p, m are of the same length: 256, 512, 1024, 2048, * 4096, 8192 bits], compared to the running time of the * standard algorithm: * * BN_mod_exp_mont 33 .. 40 % [AMD K6-2, Linux, debug configuration] * 55 .. 77 % [UltraSparc processor, but * debug-solaris-sparcv8-gcc conf.] * * BN_mod_exp_recp 50 .. 70 % [AMD K6-2, Linux, debug configuration] * 62 .. 118 % [UltraSparc, debug-solaris-sparcv8-gcc] * * On the Sparc, BN_mod_exp_recp was faster than BN_mod_exp_mont * at 2048 and more bits, but at 512 and 1024 bits, it was * slower even than the standard algorithm! * * ""Real"" timings [linux-elf, solaris-sparcv9-gcc configurations] * should be obtained when the new Montgomery reduction code * has been integrated into OpenSSL.) */ #define MONT_MUL_MOD #define MONT_EXP_WORD #define RECP_MUL_MOD #ifdef MONT_MUL_MOD /* * I have finally been able to take out this pre-condition of the top bit * being set. It was caused by an error in BN_div with negatives. There * was also another problem when for a^b%m a >= m. eay 07-May-97 */ /* if ((m->d[m->top-1]&BN_TBIT) && BN_is_odd(m)) */ if (BN_is_odd(m)) { # ifdef MONT_EXP_WORD if (a->top == 1 && !a->neg && (BN_get_flags(p, BN_FLG_CONSTTIME) == 0)) { BN_ULONG A = a->d[0]; ret = BN_mod_exp_mont_word(r, A, p, m, ctx, NULL); } else # endif ret = BN_mod_exp_mont(r, a, p, m, ctx, NULL); } else #endif #ifdef RECP_MUL_MOD { ret = BN_mod_exp_recp(r, a, p, m, ctx); } #else { ret = BN_mod_exp_simple(r, a, p, m, ctx); } #endif bn_check_top(r); return (ret); } ",0 "static apr_status_t lua_input_filter_handle(ap_filter_t *f, apr_bucket_brigade *pbbOut, ap_input_mode_t eMode, apr_read_type_e eBlock, apr_off_t nBytes) { request_rec *r = f->r; int rc, lastCall = 0; lua_State *L; lua_filter_ctx* ctx; conn_rec *c = r->connection; apr_status_t ret; /* Set up the initial filter context and acquire the function. * The corresponding Lua function should yield here. */ if (!f->ctx) { rc = lua_setup_filter_ctx(f,r,&ctx); f->ctx = ctx; if (rc == APR_EGENERAL) { ctx->broken = 1; ap_remove_input_filter(f); return HTTP_INTERNAL_SERVER_ERROR; } if (rc == APR_ENOENT ) { ap_remove_input_filter(f); ctx->broken = 1; } if (rc == APR_SUCCESS) { ctx->tmpBucket = apr_brigade_create(r->pool, c->bucket_alloc); } } ctx = (lua_filter_ctx*) f->ctx; L = ctx->L; /* If the Lua script broke or denied serving the request, just pass the buckets through */ if (ctx->broken) { return ap_get_brigade(f->next, pbbOut, eMode, eBlock, nBytes); } if (APR_BRIGADE_EMPTY(ctx->tmpBucket)) { ret = ap_get_brigade(f->next, ctx->tmpBucket, eMode, eBlock, nBytes); if (eMode == AP_MODE_EATCRLF || ret != APR_SUCCESS) return ret; } /* While the Lua function is still yielding, pass buckets to the coroutine */ if (!ctx->broken) { lastCall = 0; while(!APR_BRIGADE_EMPTY(ctx->tmpBucket)) { apr_bucket *pbktIn = APR_BRIGADE_FIRST(ctx->tmpBucket); apr_bucket *pbktOut; const char *data; apr_size_t len; if (APR_BUCKET_IS_EOS(pbktIn)) { APR_BUCKET_REMOVE(pbktIn); break; } /* read the bucket */ ret = apr_bucket_read(pbktIn, &data, &len, eBlock); if (ret != APR_SUCCESS) return ret; /* Push the bucket onto the Lua stack as a global var */ lastCall++; lua_pushlstring(L, data, len); lua_setglobal(L, ""bucket""); /* If Lua yielded, it means we have something to pass on */ if (lua_resume(L, 0) == LUA_YIELD) { size_t olen; const char* output = lua_tolstring(L, 1, &olen); pbktOut = apr_bucket_heap_create(output, olen, 0, c->bucket_alloc); APR_BRIGADE_INSERT_TAIL(pbbOut, pbktOut); apr_bucket_delete(pbktIn); return APR_SUCCESS; } else { ctx->broken = 1; ap_lua_release_state(L, ctx->spec, r); ap_remove_input_filter(f); apr_bucket_delete(pbktIn); return HTTP_INTERNAL_SERVER_ERROR; } } /* If we've safely reached the end, do a final call to Lua to allow for any finishing moves by the script, such as appending a tail. */ if (lastCall == 0) { apr_bucket *pbktEOS = apr_bucket_eos_create(c->bucket_alloc); lua_pushnil(L); lua_setglobal(L, ""bucket""); if (lua_resume(L, 0) == LUA_YIELD) { apr_bucket *pbktOut; size_t olen; const char* output = lua_tolstring(L, 1, &olen); pbktOut = apr_bucket_heap_create(output, olen, 0, c->bucket_alloc); APR_BRIGADE_INSERT_TAIL(pbbOut, pbktOut); } APR_BRIGADE_INSERT_TAIL(pbbOut,pbktEOS); ap_lua_release_state(L, ctx->spec, r); } } return APR_SUCCESS; } ",0 "unsigned int bt_sock_poll(struct file *file, struct socket *sock, poll_table *wait) { struct sock *sk = sock->sk; unsigned int mask = 0; BT_DBG(""sock %p, sk %p"", sock, sk); poll_wait(file, sk_sleep(sk), wait); if (sk->sk_state == BT_LISTEN) return bt_accept_poll(sk); if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) mask |= POLLERR | (sock_flag(sk, SOCK_SELECT_ERR_QUEUE) ? POLLPRI : 0); if (sk->sk_shutdown & RCV_SHUTDOWN) mask |= POLLRDHUP | POLLIN | POLLRDNORM; if (sk->sk_shutdown == SHUTDOWN_MASK) mask |= POLLHUP; if (!skb_queue_empty(&sk->sk_receive_queue)) mask |= POLLIN | POLLRDNORM; if (sk->sk_state == BT_CLOSED) mask |= POLLHUP; if (sk->sk_state == BT_CONNECT || sk->sk_state == BT_CONNECT2 || sk->sk_state == BT_CONFIG) return mask; if (!test_bit(BT_SK_SUSPEND, &bt_sk(sk)->flags) && sock_writeable(sk)) mask |= POLLOUT | POLLWRNORM | POLLWRBAND; else set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags); return mask; } ",0 "static void readonlyDOMTimeStampMethodMethod(const v8::FunctionCallbackInfo& info) { TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); v8SetReturnValue(info, static_cast(imp->readonlyDOMTimeStampMethod())); } ",0 "static void rollback_registered(struct net_device *dev) { LIST_HEAD(single); list_add(&dev->unreg_list, &single); rollback_registered_many(&single); } ",0 "void ExtensionTabUtil::CreateTab(WebContents* web_contents, const std::string& extension_id, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture) { Profile* profile = Profile::FromBrowserContext(web_contents->GetBrowserContext()); chrome::HostDesktopType active_desktop = chrome::GetActiveDesktop(); Browser* browser = chrome::FindTabbedBrowser(profile, false, active_desktop); const bool browser_created = !browser; if (!browser) browser = new Browser(Browser::CreateParams(profile, active_desktop)); chrome::NavigateParams params(browser, web_contents); if (disposition == NEW_POPUP) params.extension_app_id = extension_id; params.disposition = disposition; params.window_bounds = initial_pos; params.window_action = chrome::NavigateParams::SHOW_WINDOW; params.user_gesture = user_gesture; chrome::Navigate(¶ms); if (browser_created && (browser != params.browser)) browser->window()->Close(); } ",0 "mm_answer_term(int sock, Buffer *req) { extern struct monitor *pmonitor; int res, status; debug3(""%s: tearing down sessions"", __func__); /* The child is terminating */ session_destroy_all(&mm_session_close); while (waitpid(pmonitor->m_pid, &status, 0) == -1) if (errno != EINTR) exit(1); res = WIFEXITED(status) ? WEXITSTATUS(status) : 1; /* Terminate process */ exit(res); } ",0 "void AutofillDialogViews::OnDidChangeFocus( views::View* focused_before, views::View* focused_now) { if (focused_before) { DetailsGroup* group = GroupForView(focused_before); if (group && group->container->visible()) ValidateGroup(*group, VALIDATE_EDIT); } if (focused_now) { focused_now->ScrollRectToVisible(focused_now->GetLocalBounds()); ShowErrorBubbleForViewIfNecessary(focused_now); } } ",0 "void PrintWebViewHelper::OnPrintPages() { WebKit::WebFrame* frame; if (GetPrintFrame(&frame)) Print(frame, WebKit::WebNode()); } ",0 "static void update_write_suppress_output(wStream* s, BYTE allow, const RECTANGLE_16* area) { Stream_Write_UINT8(s, allow); /* allowDisplayUpdates (1 byte) */ /* Use zeros for padding (like mstsc) for compatibility with legacy servers */ Stream_Zero(s, 3); /* pad3Octets (3 bytes) */ if (allow > 0) { Stream_Write_UINT16(s, area->left); /* left (2 bytes) */ Stream_Write_UINT16(s, area->top); /* top (2 bytes) */ Stream_Write_UINT16(s, area->right); /* right (2 bytes) */ Stream_Write_UINT16(s, area->bottom); /* bottom (2 bytes) */ } } ",0 "static inline u32 armv7_pmnc_disable_counter(unsigned int idx) { u32 val; if ((idx != ARMV7_CYCLE_COUNTER) && ((idx < ARMV7_COUNTER0) || (idx > ARMV7_COUNTER_LAST))) { pr_err(""CPU%u disabling wrong PMNC counter"" "" %d\n"", smp_processor_id(), idx); return -1; } if (idx == ARMV7_CYCLE_COUNTER) val = ARMV7_CNTENC_C; else val = ARMV7_CNTENC_P(idx); asm volatile(""mcr p15, 0, %0, c9, c12, 2"" : : ""r"" (val)); return idx; } ",0 "my_accept(ftpbuf_t *ftp, php_socket_t s, struct sockaddr *addr, socklen_t *addrlen) { int n; n = php_pollfd_for_ms(s, PHP_POLLREADABLE, ftp->timeout_sec * 1000); if (n < 1) { #if !defined(PHP_WIN32) && !(defined(NETWARE) && defined(USE_WINSOCK)) if (n == 0) { errno = ETIMEDOUT; } #endif return -1; } return accept(s, addr, addrlen); } ",0 "static void ActivityLoggingGetterForIsolatedWorldsPerWorldBindingsLongAttributeAttributeGetterForMainWorld(const v8::FunctionCallbackInfo& info) { v8::Local holder = info.Holder(); TestObject* impl = V8TestObject::ToImpl(holder); V8SetReturnValueInt(info, impl->activityLoggingGetterForIsolatedWorldsPerWorldBindingsLongAttribute()); } ",0 "print_lladdr(netdissect_options *ndo, const uint8_t *p, size_t l) { const uint8_t *ep, *q; q = p; ep = p + l; while (l > 0 && q < ep) { if (q > p) ND_PRINT((ndo,"":"")); ND_PRINT((ndo,""%02x"", *q++)); l--; } } ",0 "PHP_FUNCTION(gmdate) { php_date(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); } ",0 "void HTMLMediaElement::ProgressEventTimerFired(TimerBase*) { if (network_state_ != kNetworkLoading) return; if (MediaShouldBeOpaque()) return; double time = WTF::CurrentTime(); double timedelta = time - previous_progress_time_; if (GetWebMediaPlayer() && GetWebMediaPlayer()->DidLoadingProgress()) { ScheduleEvent(EventTypeNames::progress); previous_progress_time_ = time; sent_stalled_event_ = false; if (GetLayoutObject()) GetLayoutObject()->UpdateFromElement(); } else if (!media_source_ && timedelta > 3.0 && !sent_stalled_event_) { ScheduleEvent(EventTypeNames::stalled); sent_stalled_event_ = true; SetShouldDelayLoadEvent(false); } } ",0 "parserddires(netdissect_options *ndo, const uint32_t *dp) { int er; dp = parsestatus(ndo, dp, &er); if (dp == NULL) return (0); if (er) return (1); if (ndo->ndo_qflag) return (1); ND_TCHECK(dp[2]); ND_PRINT((ndo, "" offset 0x%x size %d "", EXTRACT_32BITS(&dp[0]), EXTRACT_32BITS(&dp[1]))); if (dp[2] != 0) ND_PRINT((ndo, "" eof"")); return (1); trunc: return (0); } ",0 "void tracing_record_cmdline(struct task_struct *task) { tracing_record_taskinfo(task, TRACE_RECORD_CMDLINE); } ",0 "lazy_stat(struct archive_write_disk *a) { if (a->pst != NULL) { /* Already have stat() data available. */ return (ARCHIVE_OK); } #ifdef HAVE_FSTAT if (a->fd >= 0 && fstat(a->fd, &a->st) == 0) { a->pst = &a->st; return (ARCHIVE_OK); } #endif /* * XXX At this point, symlinks should not be hit, otherwise * XXX a race occurred. Do we want to check explicitly for that? */ if (lstat(a->name, &a->st) == 0) { a->pst = &a->st; return (ARCHIVE_OK); } archive_set_error(&a->archive, errno, ""Couldn't stat file""); return (ARCHIVE_WARN); } ",0 "void GLES2DecoderImpl::DeleteFramebuffersHelper( GLsizei n, const GLuint* client_ids) { bool supports_seperate_framebuffer_binds = feature_info_->feature_flags().chromium_framebuffer_multisample; for (GLsizei ii = 0; ii < n; ++ii) { FramebufferManager::FramebufferInfo* framebuffer = GetFramebufferInfo(client_ids[ii]); if (framebuffer && !framebuffer->IsDeleted()) { if (framebuffer == bound_draw_framebuffer_) { bound_draw_framebuffer_ = NULL; state_dirty_ = true; GLenum target = supports_seperate_framebuffer_binds ? GL_DRAW_FRAMEBUFFER : GL_FRAMEBUFFER; glBindFramebufferEXT(target, GetBackbufferServiceId()); } if (framebuffer == bound_read_framebuffer_) { bound_read_framebuffer_ = NULL; GLenum target = supports_seperate_framebuffer_binds ? GL_READ_FRAMEBUFFER : GL_FRAMEBUFFER; glBindFramebufferEXT(target, GetBackbufferServiceId()); } RemoveFramebufferInfo(client_ids[ii]); } } } ",0 "static void ssl_write_hostname_ext( mbedtls_ssl_context *ssl, unsigned char *buf, size_t *olen ) { unsigned char *p = buf; const unsigned char *end = ssl->out_msg + MBEDTLS_SSL_MAX_CONTENT_LEN; size_t hostname_len; *olen = 0; if( ssl->hostname == NULL ) return; MBEDTLS_SSL_DEBUG_MSG( 3, ( ""client hello, adding server name extension: %s"", ssl->hostname ) ); hostname_len = strlen( ssl->hostname ); if( end < p || (size_t)( end - p ) < hostname_len + 9 ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( ""buffer too small"" ) ); return; } /* * Sect. 3, RFC 6066 (TLS Extensions Definitions) * * In order to provide any of the server names, clients MAY include an * extension of type ""server_name"" in the (extended) client hello. The * ""extension_data"" field of this extension SHALL contain * ""ServerNameList"" where: * * struct { * NameType name_type; * select (name_type) { * case host_name: HostName; * } name; * } ServerName; * * enum { * host_name(0), (255) * } NameType; * * opaque HostName<1..2^16-1>; * * struct { * ServerName server_name_list<1..2^16-1> * } ServerNameList; * */ *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_SERVERNAME >> 8 ) & 0xFF ); *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_SERVERNAME ) & 0xFF ); *p++ = (unsigned char)( ( (hostname_len + 5) >> 8 ) & 0xFF ); *p++ = (unsigned char)( ( (hostname_len + 5) ) & 0xFF ); *p++ = (unsigned char)( ( (hostname_len + 3) >> 8 ) & 0xFF ); *p++ = (unsigned char)( ( (hostname_len + 3) ) & 0xFF ); *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_SERVERNAME_HOSTNAME ) & 0xFF ); *p++ = (unsigned char)( ( hostname_len >> 8 ) & 0xFF ); *p++ = (unsigned char)( ( hostname_len ) & 0xFF ); memcpy( p, ssl->hostname, hostname_len ); *olen = hostname_len + 9; } ",0 "void readpng2_cleanup(mainprog_info *mainprog_ptr) { png_structp png_ptr = (png_structp)mainprog_ptr->png_ptr; png_infop info_ptr = (png_infop)mainprog_ptr->info_ptr; if (png_ptr && info_ptr) png_destroy_read_struct(&png_ptr, &info_ptr, NULL); mainprog_ptr->png_ptr = NULL; mainprog_ptr->info_ptr = NULL; } ",0 "PHP_METHOD(Phar, copy) { char *oldfile, *newfile, *error; const char *pcr_error; size_t oldfile_len, newfile_len; phar_entry_info *oldentry, newentry = {0}, *temp; int tmp_len = 0; PHAR_ARCHIVE_OBJECT(); if (zend_parse_parameters(ZEND_NUM_ARGS(), ""ss"", &oldfile, &oldfile_len, &newfile, &newfile_len) == FAILURE) { return; } if (PHAR_G(readonly) && !phar_obj->archive->is_data) { zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, ""Cannot copy \""%s\"" to \""%s\"", phar is read-only"", oldfile, newfile); RETURN_FALSE; } if (oldfile_len >= sizeof("".phar"")-1 && !memcmp(oldfile, "".phar"", sizeof("".phar"")-1)) { /* can't copy a meta file */ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, ""file \""%s\"" cannot be copied to file \""%s\"", cannot copy Phar meta-file in %s"", oldfile, newfile, phar_obj->archive->fname); RETURN_FALSE; } if (newfile_len >= sizeof("".phar"")-1 && !memcmp(newfile, "".phar"", sizeof("".phar"")-1)) { /* can't copy a meta file */ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, ""file \""%s\"" cannot be copied to file \""%s\"", cannot copy to Phar meta-file in %s"", oldfile, newfile, phar_obj->archive->fname); RETURN_FALSE; } if (!zend_hash_str_exists(&phar_obj->archive->manifest, oldfile, (uint) oldfile_len) || NULL == (oldentry = zend_hash_str_find_ptr(&phar_obj->archive->manifest, oldfile, (uint) oldfile_len)) || oldentry->is_deleted) { zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, ""file \""%s\"" cannot be copied to file \""%s\"", file does not exist in %s"", oldfile, newfile, phar_obj->archive->fname); RETURN_FALSE; } if (zend_hash_str_exists(&phar_obj->archive->manifest, newfile, (uint) newfile_len)) { if (NULL != (temp = zend_hash_str_find_ptr(&phar_obj->archive->manifest, newfile, (uint) newfile_len)) || !temp->is_deleted) { zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, ""file \""%s\"" cannot be copied to file \""%s\"", file must not already exist in phar %s"", oldfile, newfile, phar_obj->archive->fname); RETURN_FALSE; } } tmp_len = (int)newfile_len; if (phar_path_check(&newfile, &tmp_len, &pcr_error) > pcr_is_ok) { zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, ""file \""%s\"" contains invalid characters %s, cannot be copied from \""%s\"" in phar %s"", newfile, pcr_error, oldfile, phar_obj->archive->fname); RETURN_FALSE; } newfile_len = tmp_len; if (phar_obj->archive->is_persistent) { if (FAILURE == phar_copy_on_write(&(phar_obj->archive))) { zend_throw_exception_ex(phar_ce_PharException, 0, ""phar \""%s\"" is persistent, unable to copy on write"", phar_obj->archive->fname); return; } /* re-populate with copied-on-write entry */ oldentry = zend_hash_str_find_ptr(&phar_obj->archive->manifest, oldfile, (uint) oldfile_len); } memcpy((void *) &newentry, oldentry, sizeof(phar_entry_info)); if (Z_TYPE(newentry.metadata) != IS_UNDEF) { zval_copy_ctor(&newentry.metadata); newentry.metadata_str.s = NULL; } newentry.filename = estrndup(newfile, newfile_len); newentry.filename_len = newfile_len; newentry.fp_refcount = 0; if (oldentry->fp_type != PHAR_FP) { if (FAILURE == phar_copy_entry_fp(oldentry, &newentry, &error)) { efree(newentry.filename); php_stream_close(newentry.fp); zend_throw_exception_ex(phar_ce_PharException, 0, ""%s"", error); efree(error); return; } } zend_hash_str_add_mem(&oldentry->phar->manifest, newfile, newfile_len, &newentry, sizeof(phar_entry_info)); phar_obj->archive->is_modified = 1; phar_flush(phar_obj->archive, 0, 0, 0, &error); if (error) { zend_throw_exception_ex(phar_ce_PharException, 0, ""%s"", error); efree(error); } RETURN_TRUE; } ",1 "raptor_rss_start_element_handler(void *user_data, raptor_xml_element* xml_element) { raptor_parser *rdf_parser; raptor_rss_parser *rss_parser; raptor_rss_block *block = NULL; raptor_uri* base_uri; raptor_qname *el_qname; const unsigned char *name; int ns_attributes_count; raptor_qname** named_attrs; const raptor_namespace* el_nspace; raptor_rss_element* rss_element; int i; rdf_parser = (raptor_parser*)user_data; rss_parser = (raptor_rss_parser*)rdf_parser->context; rss_element = RAPTOR_CALLOC(raptor_rss_element*, 1, sizeof(*rss_element)); if(!rss_element) { rdf_parser->failed = 1; return; } rss_element->world = rdf_parser->world; rss_element->sb = raptor_new_stringbuffer(); xml_element->user_data = rss_element; if(xml_element->parent) { raptor_rss_element* parent_rss_element; parent_rss_element = (raptor_rss_element*)(xml_element->parent->user_data); if(parent_rss_element->xml_writer) rss_element->xml_writer = parent_rss_element->xml_writer; } if(rss_element->xml_writer) { raptor_xml_writer_start_element(rss_element->xml_writer, xml_element); return; } el_qname = raptor_xml_element_get_name(xml_element); name = el_qname->local_name; el_nspace = el_qname->nspace; named_attrs = raptor_xml_element_get_attributes(xml_element); ns_attributes_count = raptor_xml_element_get_attributes_count(xml_element); base_uri = raptor_sax2_inscope_base_uri(rss_parser->sax2); /* No container type - identify and record in rss_parser->current_type * either as a top-level container or an inner-container */ if(!raptor_rss_add_container(rss_parser, (const char*)name)) { #ifdef RAPTOR_DEBUG if(1) { raptor_rss_type old_type = rss_parser->prev_type; if(old_type != rss_parser->current_type && old_type != RAPTOR_RSS_NONE) RAPTOR_DEBUG5(""FOUND inner container type %d - %s INSIDE current container type %d - %s\n"", rss_parser->current_type, raptor_rss_items_info[rss_parser->current_type].name, old_type, raptor_rss_items_info[old_type].name); else RAPTOR_DEBUG3(""FOUND container type %d - %s\n"", rss_parser->current_type, raptor_rss_items_info[rss_parser->current_type].name); } #endif /* check a few container attributes */ if(named_attrs) { raptor_rss_item* update_item = raptor_rss_get_current_item(rss_parser); for(i = 0; i < ns_attributes_count; i++) { raptor_qname* attr = named_attrs[i]; const char* attrName = (const char*)attr->local_name; const unsigned char* attrValue = attr->value; RAPTOR_DEBUG3("" container attribute %s=%s\n"", attrName, attrValue); if(!strcmp(attrName, ""about"")) { if(update_item) { update_item->uri = raptor_new_uri(rdf_parser->world, attrValue); update_item->term = raptor_new_term_from_uri(rdf_parser->world, update_item->uri); } } } } return; } else if(rss_parser->current_type == RAPTOR_RSS_NONE) { RAPTOR_DEBUG2(""Unknown container element named %s\n"", name); /* Nothing more that can be done with unknown element - skip it */ return; } /* have container (current_type) so this element is inside it is either: * 1. a metadata block element (such as rss:enclosure) * 2. a field (such as atom:title) */ /* Find field ID */ rss_parser->current_field = RAPTOR_RSS_FIELD_UNKNOWN; for(i = 0; i < RAPTOR_RSS_FIELDS_SIZE; i++) { raptor_uri* nspace_URI; raptor_uri* field_nspace_URI; rss_info_namespace nsid = raptor_rss_fields_info[i].nspace; if(strcmp((const char*)name, raptor_rss_fields_info[i].name)) continue; if(!el_nspace) { if(nsid != RSS_NO_NS && nsid != RSS1_0_NS && nsid != RSS0_91_NS && nsid != RSS0_9_NS && nsid != RSS1_1_NS) continue; /* Matches if the element has no namespace and field is not atom */ rss_parser->current_field = (raptor_rss_fields_type)i; break; } /* Promote element namespaces */ nspace_URI = raptor_rss_promote_namespace_uri(rdf_parser->world, raptor_namespace_get_uri(el_nspace)); field_nspace_URI = rdf_parser->world->rss_namespaces_info_uris[raptor_rss_fields_info[i].nspace]; if(raptor_uri_equals(nspace_URI, field_nspace_URI)) { rss_parser->current_field = (raptor_rss_fields_type)i; break; } } if(rss_parser->current_field == RAPTOR_RSS_FIELD_UNKNOWN) { RAPTOR_DEBUG3(""Unknown field element named %s inside type %s\n"", name, raptor_rss_items_info[rss_parser->current_type].name); return; } /* Found a block element to process */ if(raptor_rss_fields_info[rss_parser->current_field].flags & RAPTOR_RSS_INFO_FLAG_BLOCK_VALUE) { raptor_rss_type block_type; raptor_rss_item* update_item; const unsigned char *id; raptor_term* block_term; block_type = raptor_rss_fields_info[rss_parser->current_field].block_type; RAPTOR_DEBUG3(""FOUND new block type %d - %s\n"", block_type, raptor_rss_items_info[block_type].name); update_item = raptor_rss_get_current_item(rss_parser); id = raptor_world_generate_bnodeid(rdf_parser->world); block_term = raptor_new_term_from_blank(rdf_parser->world, id); RAPTOR_FREE(char*, id); block = raptor_new_rss_block(rdf_parser->world, block_type, block_term); raptor_free_term(block_term); raptor_rss_item_add_block(update_item, block); rss_parser->current_block = block; rss_parser->nspaces_seen[raptor_rss_items_info[block_type].nspace] = 'Y'; /* Now check block attributes */ if(named_attrs) { for(i = 0; i < ns_attributes_count; i++) { raptor_qname* attr = named_attrs[i]; const char* attrName = (const char*)attr->local_name; const unsigned char* attrValue = attr->value; const raptor_rss_block_field_info *bfi; int offset = -1; for(bfi = &raptor_rss_block_fields_info[0]; bfi->type != RAPTOR_RSS_NONE; bfi++) { if(!bfi->attribute) continue; if(bfi->type == block_type && !strcmp(attrName, bfi->attribute)) { offset = bfi->offset; break; } } if(offset < 0) continue; /* Found attribute for this block type */ RAPTOR_DEBUG3("" found block attribute %s=%s\n"", attrName, attrValue); if(raptor_rss_block_set_field(rdf_parser->world, base_uri, block, bfi, (const char*)attrValue)) { rdf_parser->failed = 1; return; } } } return; } /* Process field */ RAPTOR_DEBUG4(""FOUND field %d - %s inside type %s\n"", rss_parser->current_field, raptor_rss_fields_info[rss_parser->current_field].name, raptor_rss_items_info[rss_parser->current_type].name); /* Mark namespace seen in new field */ if(1) { rss_info_namespace ns_index; ns_index = raptor_rss_fields_info[rss_parser->current_field].nspace; rss_parser->nspaces_seen[ns_index] = 'Y'; } /* Now check for field attributes */ if(named_attrs) { for(i = 0; i < ns_attributes_count; i++) { raptor_qname* attr = named_attrs[i]; const unsigned char* attrName = attr->local_name; const unsigned char* attrValue = attr->value; RAPTOR_DEBUG3("" attribute %s=%s\n"", attrName, attrValue); /* Pick a few attributes to care about */ if(!strcmp((const char*)attrName, ""isPermaLink"")) { raptor_rss_item* update_item = rss_parser->model.last; if(!strcmp((const char*)name, ""guid"")) { /* */ if(update_item) { raptor_rss_field* field = raptor_rss_new_field(rdf_parser->world); RAPTOR_DEBUG1(""fa1 - ""); raptor_rss_item_add_field(update_item, RAPTOR_RSS_FIELD_GUID, field); if(!strcmp((const char*)attrValue, ""true"")) { RAPTOR_DEBUG2("" setting guid to URI '%s'\n"", attrValue); field->uri = raptor_new_uri_relative_to_base(rdf_parser->world, base_uri, (const unsigned char*)attrValue); } else { size_t len = strlen((const char*)attrValue); RAPTOR_DEBUG2("" setting guid to string '%s'\n"", attrValue); field->value = RAPTOR_MALLOC(unsigned char*, len + 1); if(!field->value) { rdf_parser->failed = 1; return; } memcpy(field->value, attrValue, len + 1); } } } } else if(!strcmp((const char*)attrName, ""href"")) { if(rss_parser->current_field == RAPTOR_RSS_FIELD_LINK || rss_parser->current_field == RAPTOR_RSS_FIELD_ATOM_LINK) { RAPTOR_DEBUG2("" setting href as URI string for type %s\n"", raptor_rss_items_info[rss_parser->current_type].name); if(rss_element->uri) raptor_free_uri(rss_element->uri); rss_element->uri = raptor_new_uri_relative_to_base(rdf_parser->world, base_uri, (const unsigned char*)attrValue); } } else if(!strcmp((const char*)attrName, ""type"")) { if(rss_parser->current_field == RAPTOR_RSS_FIELD_ATOM_LINK) { /* do nothing with atom link attribute type */ } else if(rss_parser->is_atom) { /* Atom only typing */ if(!strcmp((const char*)attrValue, ""xhtml"") || !strcmp((const char*)attrValue, ""xml"") || strstr((const char*)attrValue, ""+xml"")) { RAPTOR_DEBUG2("" found type '%s', making an XML writer\n"", attrValue); rss_element->type = RAPTOR_RSS_CONTENT_TYPE_XML; rss_element->iostream = raptor_new_iostream_to_string(rdf_parser->world, &rss_element->xml_content, &rss_element->xml_content_length, raptor_alloc_memory); rss_element->xml_writer = raptor_new_xml_writer(rdf_parser->world, NULL, rss_element->iostream); raptor_xml_writer_set_option(rss_element->xml_writer, RAPTOR_OPTION_WRITER_XML_DECLARATION, NULL, 0); raptor_free_stringbuffer(rss_element->sb); rss_element->sb = NULL; } } } else if(!strcmp((const char*)attrName, ""version"")) { if(!raptor_strcasecmp((const char*)name, ""feed"")) { if(!strcmp((const char*)attrValue, ""0.3"")) rss_parser->is_atom = 1; } } } } /* if have field attributes */ } ",0 "unsigned int getLRUClock(void) { return (mstime()/LRU_CLOCK_RESOLUTION) & LRU_CLOCK_MAX; } ",0 "bool HasWarning(const WarningSet& warnings, const std::string& extension_id) { for (WarningSet::const_iterator i = warnings.begin(); i != warnings.end(); ++i) { if (i->extension_id() == extension_id) return true; } return false; } ",0 "raptor_turtle_writer_raw(raptor_turtle_writer* turtle_writer, const unsigned char *s) { raptor_iostream_string_write(s, turtle_writer->iostr); } ",0 "void blk_mq_requeue_request(struct request *rq) { __blk_mq_requeue_request(rq); BUG_ON(blk_queued_rq(rq)); blk_mq_add_to_requeue_list(rq, true); } ",0 "rpc_init_mempool(void) { /* * The following is not strictly a mempool initialisation, * but there is no harm in doing it here */ rpc_init_wait_queue(&delay_queue, ""delayq""); if (!rpciod_start()) goto err_nomem; rpc_task_slabp = kmem_cache_create(""rpc_tasks"", sizeof(struct rpc_task), 0, SLAB_HWCACHE_ALIGN, NULL); if (!rpc_task_slabp) goto err_nomem; rpc_buffer_slabp = kmem_cache_create(""rpc_buffers"", RPC_BUFFER_MAXSIZE, 0, SLAB_HWCACHE_ALIGN, NULL); if (!rpc_buffer_slabp) goto err_nomem; rpc_task_mempool = mempool_create_slab_pool(RPC_TASK_POOLSIZE, rpc_task_slabp); if (!rpc_task_mempool) goto err_nomem; rpc_buffer_mempool = mempool_create_slab_pool(RPC_BUFFER_POOLSIZE, rpc_buffer_slabp); if (!rpc_buffer_mempool) goto err_nomem; return 0; err_nomem: rpc_destroy_mempool(); return -ENOMEM; } ",0 "DiceTurnSyncOnHelper::DiceTurnSyncOnHelper( Profile* profile, Browser* browser, signin_metrics::AccessPoint signin_access_point, signin_metrics::PromoAction signin_promo_action, signin_metrics::Reason signin_reason, const std::string& account_id, SigninAbortedMode signin_aborted_mode) : DiceTurnSyncOnHelper( profile, signin_access_point, signin_promo_action, signin_reason, account_id, signin_aborted_mode, std::make_unique(browser)) {} ",0 "static int ssl_decompress_buf( ssl_context *ssl ) { int ret; unsigned char *msg_post = ssl->in_msg; size_t len_pre = ssl->in_msglen; unsigned char *msg_pre; SSL_DEBUG_MSG( 2, ( ""=> decompress buf"" ) ); msg_pre = (unsigned char*) malloc( len_pre ); if( msg_pre == NULL ) { SSL_DEBUG_MSG( 1, ( ""malloc(%d bytes) failed"", len_pre ) ); return( POLARSSL_ERR_SSL_MALLOC_FAILED ); } memcpy( msg_pre, ssl->in_msg, len_pre ); SSL_DEBUG_MSG( 3, ( ""before decompression: msglen = %d, "", ssl->in_msglen ) ); SSL_DEBUG_BUF( 4, ""before decompression: input payload"", ssl->in_msg, ssl->in_msglen ); ssl->transform_in->ctx_inflate.next_in = msg_pre; ssl->transform_in->ctx_inflate.avail_in = len_pre; ssl->transform_in->ctx_inflate.next_out = msg_post; ssl->transform_in->ctx_inflate.avail_out = SSL_MAX_CONTENT_LEN; ret = inflate( &ssl->transform_in->ctx_inflate, Z_SYNC_FLUSH ); if( ret != Z_OK ) { SSL_DEBUG_MSG( 1, ( ""failed to perform decompression (%d)"", ret ) ); return( POLARSSL_ERR_SSL_COMPRESSION_FAILED ); } ssl->in_msglen = SSL_MAX_CONTENT_LEN - ssl->transform_in->ctx_inflate.avail_out; free( msg_pre ); SSL_DEBUG_MSG( 3, ( ""after decompression: msglen = %d, "", ssl->in_msglen ) ); SSL_DEBUG_BUF( 4, ""after decompression: input payload"", ssl->in_msg, ssl->in_msglen ); SSL_DEBUG_MSG( 2, ( ""<= decompress buf"" ) ); return( 0 ); } ",0 "static void decode_rgb_frame(FFV1Context *s, uint8_t *src[3], int w, int h, int stride[3]) { int x, y, p; int16_t *sample[4][2]; int lbd = s->avctx->bits_per_raw_sample <= 8; int bits = s->avctx->bits_per_raw_sample > 0 ? s->avctx->bits_per_raw_sample : 8; int offset = 1 << bits; for (x = 0; x < 4; x++) { sample[x][0] = s->sample_buffer + x * 2 * (w + 6) + 3; sample[x][1] = s->sample_buffer + (x * 2 + 1) * (w + 6) + 3; } s->run_index = 0; memset(s->sample_buffer, 0, 8 * (w + 6) * sizeof(*s->sample_buffer)); for (y = 0; y < h; y++) { for (p = 0; p < 3 + s->transparency; p++) { int16_t *temp = sample[p][0]; // FIXME: try a normal buffer sample[p][0] = sample[p][1]; sample[p][1] = temp; sample[p][1][-1]= sample[p][0][0 ]; sample[p][0][ w]= sample[p][0][w-1]; if (lbd) decode_line(s, w, sample[p], (p + 1)/2, 9); else decode_line(s, w, sample[p], (p + 1)/2, bits + 1); } for (x = 0; x < w; x++) { int g = sample[0][1][x]; int b = sample[1][1][x]; int r = sample[2][1][x]; int a = sample[3][1][x]; b -= offset; r -= offset; g -= (b + r) >> 2; b += g; r += g; if (lbd) *((uint32_t*)(src[0] + x*4 + stride[0]*y)) = b + (g<<8) + (r<<16) + (a<<24); else { *((uint16_t*)(src[0] + x*2 + stride[0]*y)) = b; *((uint16_t*)(src[1] + x*2 + stride[1]*y)) = g; *((uint16_t*)(src[2] + x*2 + stride[2]*y)) = r; } } } } ",0 "long SSL_CTX_set_timeout(SSL_CTX *s, long t) { long l; if (s == NULL) return (0); l = s->session_timeout; s->session_timeout = t; return (l); } ",0 "void WebGLRenderingContextBase::stencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) { if (isContextLost()) return; if (!ValidateStencilOrDepthFunc(""stencilFuncSeparate"", func)) return; switch (face) { case GL_FRONT_AND_BACK: stencil_func_ref_ = ref; stencil_func_ref_back_ = ref; stencil_func_mask_ = mask; stencil_func_mask_back_ = mask; break; case GL_FRONT: stencil_func_ref_ = ref; stencil_func_mask_ = mask; break; case GL_BACK: stencil_func_ref_back_ = ref; stencil_func_mask_back_ = mask; break; default: SynthesizeGLError(GL_INVALID_ENUM, ""stencilFuncSeparate"", ""invalid face""); return; } ContextGL()->StencilFuncSeparate(face, func, ref, mask); } ",0 "void DiceTurnSyncOnHelper::OnMergeAccountConfirmation(SigninChoice choice) { switch (choice) { case SIGNIN_CHOICE_NEW_PROFILE: base::RecordAction( base::UserMetricsAction(""Signin_ImportDataPrompt_DontImport"")); TurnSyncOnWithProfileMode(ProfileMode::NEW_PROFILE); break; case SIGNIN_CHOICE_CONTINUE: base::RecordAction( base::UserMetricsAction(""Signin_ImportDataPrompt_ImportData"")); TurnSyncOnWithProfileMode(ProfileMode::CURRENT_PROFILE); break; case SIGNIN_CHOICE_CANCEL: base::RecordAction( base::UserMetricsAction(""Signin_ImportDataPrompt_Cancel"")); AbortAndDelete(); break; case SIGNIN_CHOICE_SIZE: NOTREACHED(); AbortAndDelete(); break; } } ",0 "static bool NeedsFilter(const LayoutObject& object) { if (object.IsBoxModelObject() && ToLayoutBoxModelObject(object).Layer() && (object.StyleRef().HasFilter() || object.HasReflection())) return true; if (object.IsLayoutImage() && ToLayoutImage(object).ShouldInvertColor()) return true; return false; } ",0 " AccessType GetExtensionAccess(const Extension* extension, const GURL& url, int tab_id) { bool allowed_script = IsAllowedScript(extension, url, tab_id); bool allowed_capture = extension->permissions_data()->CanCaptureVisiblePage(tab_id, nullptr); if (allowed_script && allowed_capture) return ALLOWED_SCRIPT_AND_CAPTURE; if (allowed_script) return ALLOWED_SCRIPT_ONLY; if (allowed_capture) return ALLOWED_CAPTURE_ONLY; return DISALLOWED; } ",1 "vips_foreign_load_generate( VipsRegion *or, void *seq, void *a, void *b, gboolean *stop ) { VipsRegion *ir = (VipsRegion *) seq; VipsRect *r = &or->valid; /* Ask for input we need. */ if( vips_region_prepare( ir, r ) ) return( -1 ); /* Attach output region to that. */ if( vips_region_region( or, ir, r, r->left, r->top ) ) return( -1 ); return( 0 ); } ",0 "static void brcmf_configure_wowl(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp, struct cfg80211_wowlan *wowl) { u32 wowl_config; u32 i; brcmf_dbg(TRACE, ""Suspend, wowl config.\n""); if (!brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL_ARP_ND)) brcmf_configure_arp_nd_offload(ifp, false); brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_PM, &cfg->wowl.pre_pmmode); brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM, PM_MAX); wowl_config = 0; if (wowl->disconnect) wowl_config = BRCMF_WOWL_DIS | BRCMF_WOWL_BCN | BRCMF_WOWL_RETR; if (wowl->magic_pkt) wowl_config |= BRCMF_WOWL_MAGIC; if ((wowl->patterns) && (wowl->n_patterns)) { wowl_config |= BRCMF_WOWL_NET; for (i = 0; i < wowl->n_patterns; i++) { brcmf_config_wowl_pattern(ifp, ""add"", (u8 *)wowl->patterns[i].pattern, wowl->patterns[i].pattern_len, (u8 *)wowl->patterns[i].mask, wowl->patterns[i].pkt_offset); } } if (wowl->nd_config) { brcmf_cfg80211_sched_scan_start(cfg->wiphy, ifp->ndev, wowl->nd_config); wowl_config |= BRCMF_WOWL_PFN_FOUND; cfg->wowl.nd_data_completed = false; cfg->wowl.nd_enabled = true; /* Now reroute the event for PFN to the wowl function. */ brcmf_fweh_unregister(cfg->pub, BRCMF_E_PFN_NET_FOUND); brcmf_fweh_register(cfg->pub, BRCMF_E_PFN_NET_FOUND, brcmf_wowl_nd_results); } if (wowl->gtk_rekey_failure) wowl_config |= BRCMF_WOWL_GTK_FAILURE; if (!test_bit(BRCMF_VIF_STATUS_CONNECTED, &ifp->vif->sme_state)) wowl_config |= BRCMF_WOWL_UNASSOC; brcmf_fil_iovar_data_set(ifp, ""wowl_wakeind"", ""clear"", sizeof(struct brcmf_wowl_wakeind_le)); brcmf_fil_iovar_int_set(ifp, ""wowl"", wowl_config); brcmf_fil_iovar_int_set(ifp, ""wowl_activate"", 1); brcmf_bus_wowl_config(cfg->pub->bus_if, true); cfg->wowl.active = true; } ",0 "static void stroke_status(private_stroke_socket_t *this, stroke_msg_t *msg, FILE *out, bool all, bool wait) { pop_string(msg, &(msg->status.name)); this->list->status(this->list, msg, out, all, wait); } ",0 "void TabStrip::UpdateStackedLayoutFromMouseEvent(views::View* source, const ui::MouseEvent& event) { if (!adjust_layout_) return; #if !defined(OS_CHROMEOS) constexpr auto kMouseMoveTime = base::TimeDelta::FromMilliseconds(200); constexpr int kMouseMoveCountBeforeConsiderReal = 3; #endif switch (event.type()) { case ui::ET_MOUSE_PRESSED: mouse_move_count_ = 0; last_mouse_move_time_ = base::TimeTicks(); SetResetToShrinkOnExit((event.flags() & ui::EF_FROM_TOUCH) == 0); if (reset_to_shrink_on_exit_ && touch_layout_) { gfx::Point tab_strip_point(event.location()); views::View::ConvertPointToTarget(source, this, &tab_strip_point); Tab* tab = FindTabForEvent(tab_strip_point); if (tab && touch_layout_->IsStacked(GetModelIndexOfTab(tab))) { SetStackedLayout(false); controller_->StackedLayoutMaybeChanged(); } } break; case ui::ET_MOUSE_MOVED: { #if defined(OS_CHROMEOS) SetResetToShrinkOnExit(true); #else gfx::Point location(event.location()); ConvertPointToTarget(source, this, &location); if (location == last_mouse_move_location_) return; // Ignore spurious moves. last_mouse_move_location_ = location; if ((event.flags() & ui::EF_FROM_TOUCH) || (event.flags() & ui::EF_IS_SYNTHESIZED)) { last_mouse_move_time_ = base::TimeTicks(); } else if ((base::TimeTicks::Now() - last_mouse_move_time_) >= kMouseMoveTime) { mouse_move_count_ = 1; last_mouse_move_time_ = base::TimeTicks::Now(); } else if (mouse_move_count_ < kMouseMoveCountBeforeConsiderReal) { ++mouse_move_count_; } else { SetResetToShrinkOnExit(true); } #endif break; } case ui::ET_MOUSE_RELEASED: { gfx::Point location(event.location()); ConvertPointToTarget(source, this, &location); last_mouse_move_location_ = location; mouse_move_count_ = 0; last_mouse_move_time_ = base::TimeTicks(); if ((event.flags() & ui::EF_FROM_TOUCH) == ui::EF_FROM_TOUCH) { SetStackedLayout(true); controller_->StackedLayoutMaybeChanged(); } break; } default: break; } } ",0 "static inline int put_dwords(EHCIState *ehci, uint32_t addr, uint32_t *buf, int num) { int i; if (!ehci->as) { ehci_raise_irq(ehci, USBSTS_HSE); ehci->usbcmd &= ~USBCMD_RUNSTOP; trace_usb_ehci_dma_error(); return -1; } for (i = 0; i < num; i++, buf++, addr += sizeof(*buf)) { uint32_t tmp = cpu_to_le32(*buf); dma_memory_write(ehci->as, addr, &tmp, sizeof(tmp)); } return num; } ",0 "void WebGLRenderingContextBase::RenderbufferStorageImpl( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, const char* function_name) { DCHECK(!samples); // |samples| > 0 is only valid in WebGL2's DCHECK(!IsWebGL2OrHigher()); // Make sure this is overridden in WebGL 2. switch (internalformat) { case GL_DEPTH_COMPONENT16: case GL_RGBA4: case GL_RGB5_A1: case GL_RGB565: case GL_STENCIL_INDEX8: ContextGL()->RenderbufferStorage(target, internalformat, width, height); renderbuffer_binding_->SetInternalFormat(internalformat); renderbuffer_binding_->SetSize(width, height); break; case GL_SRGB8_ALPHA8_EXT: if (!ExtensionEnabled(kEXTsRGBName)) { SynthesizeGLError(GL_INVALID_ENUM, function_name, ""sRGB not enabled""); break; } ContextGL()->RenderbufferStorage(target, internalformat, width, height); renderbuffer_binding_->SetInternalFormat(internalformat); renderbuffer_binding_->SetSize(width, height); break; case GL_DEPTH_STENCIL_OES: DCHECK(IsDepthStencilSupported()); ContextGL()->RenderbufferStorage(target, GL_DEPTH24_STENCIL8_OES, width, height); renderbuffer_binding_->SetSize(width, height); renderbuffer_binding_->SetInternalFormat(internalformat); break; default: SynthesizeGLError(GL_INVALID_ENUM, function_name, ""invalid internalformat""); break; } } ",0 "static void set_vma_resv_map(struct vm_area_struct *vma, struct resv_map *map) { VM_BUG_ON_VMA(!is_vm_hugetlb_page(vma), vma); VM_BUG_ON_VMA(vma->vm_flags & VM_MAYSHARE, vma); set_vma_private_data(vma, (get_vma_private_data(vma) & HPAGE_RESV_MASK) | (unsigned long)map); } ",0 "static inline bool cpu_has_vmx_virtualize_apic_accesses(void) { return vmcs_config.cpu_based_2nd_exec_ctrl & SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES; } ",0 "static inline void update_load_set(struct load_weight *lw, unsigned long w) { lw->weight = w; lw->inv_weight = 0; } ",0 "int pm_reset_counters(p_fm_config_conx_hdlt hdl, fm_mgr_type_t mgr, int argc, char *argv[]) { fm_mgr_config_errno_t res; fm_msg_ret_code_t ret_code; if((res = fm_mgr_simple_query(hdl, FM_ACT_GET, FM_DT_PM_RESET_COUNTERS, mgr, 0, NULL, &ret_code)) != FM_CONF_OK) { fprintf(stderr, ""pm_reset_counters: Failed to retrieve data: \n"" ""\tError:(%d) %s \n\tRet code:(%d) %s\n"", res, fm_mgr_get_error_str(res),ret_code, fm_mgr_get_resp_error_str(ret_code)); } else { printf(""pm_reset_counters: Successfully sent reset command "" ""to the PM\n""); } return 0; } ",0 "static int oidc_check_userid_openidc(request_rec *r, oidc_cfg *c) { if (c->redirect_uri == NULL) { oidc_error(r, ""configuration error: the authentication type is set to \""openid-connect\"" but OIDCRedirectURI has not been set""); return HTTP_INTERNAL_SERVER_ERROR; } /* check if this is a sub-request or an initial request */ if (ap_is_initial_req(r)) { int rc = OK; /* load the session from the request state; this will be a new ""empty"" session if no state exists */ oidc_session_t *session = NULL; oidc_session_load(r, &session); /* see if the initial request is to the redirect URI; this handles potential logout too */ if (oidc_util_request_matches_url(r, c->redirect_uri)) { /* handle request to the redirect_uri */ rc = oidc_handle_redirect_uri_request(r, c, session); /* free resources allocated for the session */ oidc_session_free(r, session); return rc; /* initial request to non-redirect URI, check if we have an existing session */ } else if (session->remote_user != NULL) { /* set the user in the main request for further (incl. sub-request) processing */ r->user = (char *) session->remote_user; /* this is initial request and we already have a session */ rc = oidc_handle_existing_session(r, c, session); /* free resources allocated for the session */ oidc_session_free(r, session); /* strip any cookies that we need to */ oidc_strip_cookies(r); return rc; } /* free resources allocated for the session */ oidc_session_free(r, session); /* * else: initial request, we have no session and it is not an authorization or * discovery response: just hit the default flow for unauthenticated users */ } else { /* not an initial request, try to recycle what we've already established in the main request */ if (r->main != NULL) r->user = r->main->user; else if (r->prev != NULL) r->user = r->prev->user; if (r->user != NULL) { /* this is a sub-request and we have a session (headers will have been scrubbed and set already) */ oidc_debug(r, ""recycling user '%s' from initial request for sub-request"", r->user); /* * apparently request state can get lost in sub-requests, so let's see * if we need to restore id_token and/or claims from the session cache */ const char *s_id_token = oidc_request_state_get(r, OIDC_IDTOKEN_CLAIMS_SESSION_KEY); if (s_id_token == NULL) { oidc_session_t *session = NULL; oidc_session_load(r, &session); oidc_copy_tokens_to_request_state(r, session, NULL, NULL); /* free resources allocated for the session */ oidc_session_free(r, session); } /* strip any cookies that we need to */ oidc_strip_cookies(r); return OK; } /* * else: not initial request, but we could not find a session, so: * just hit the default flow for unauthenticated users */ } /* find out which action we need to take when encountering an unauthenticated request */ switch (oidc_dir_cfg_unauth_action(r)) { case OIDC_UNAUTH_RETURN410: return HTTP_GONE; case OIDC_UNAUTH_RETURN401: return HTTP_UNAUTHORIZED; case OIDC_UNAUTH_PASS: r->user = """"; return OK; case OIDC_UNAUTH_AUTHENTICATE: /* if this is a Javascript path we won't redirect the user and create a state cookie */ if (apr_table_get(r->headers_in, ""X-Requested-With"") != NULL) return HTTP_UNAUTHORIZED; break; } /* else: no session (regardless of whether it is main or sub-request), go and authenticate the user */ return oidc_authenticate_user(r, c, NULL, oidc_get_current_url(r), NULL, NULL, NULL, NULL); } ",0 "static char *pick_controller_from_path(struct fuse_context *fc, const char *path) { const char *p1; char *contr, *slash; if (strlen(path) < 9) return NULL; if (*(path+7) != '/') return NULL; p1 = path+8; contr = strdupa(p1); if (!contr) return NULL; slash = strstr(contr, ""/""); if (slash) *slash = '\0'; int i; for (i = 0; i < num_hierarchies; i++) { if (hierarchies[i] && strcmp(hierarchies[i], contr) == 0) return hierarchies[i]; } return NULL; } ",0 "void FileBrowserHandlerCustomBindings::GetEntryURL( const v8::FunctionCallbackInfo& args) { CHECK(args.Length() == 1); CHECK(args[0]->IsObject()); const blink::WebURL& url = blink::WebDOMFileSystem::createFileSystemURL(args[0]); args.GetReturnValue().Set(v8_helpers::ToV8StringUnsafe( args.GetIsolate(), url.string().utf8().c_str())); } ",1 "void Type_MPE_Free(struct _cms_typehandler_struct* self, void *Ptr) { cmsPipelineFree((cmsPipeline*) Ptr); return; cmsUNUSED_PARAMETER(self); } ",0 "int btrfs_readpage(struct file *file, struct page *page) { struct extent_io_tree *tree; tree = &BTRFS_I(page->mapping->host)->io_tree; return extent_read_full_page(tree, page, btrfs_get_extent, 0); } ",0 " explicit RendererMainThread(const std::string& channel_id) : Thread(""Chrome_InProcRendererThread""), channel_id_(channel_id) { } ",0 "static int mov_seek_fragment(AVFormatContext *s, AVStream *st, int64_t timestamp) { MOVContext *mov = s->priv_data; MOVStreamContext *sc = st->priv_data; int i, j; if (!mov->fragment_index_complete) return 0; for (i = 0; i < mov->fragment_index_count; i++) { if (mov->fragment_index_data[i]->track_id == st->id || !sc->has_sidx) { MOVFragmentIndex *index = mov->fragment_index_data[i]; for (j = index->item_count - 1; j >= 0; j--) { if (index->items[j].time <= timestamp) { if (index->items[j].headers_read) return 0; return mov_switch_root(s, index->items[j].moof_offset); } } } } return 0; } ",0 "static inline void kvmppc_set_vsr_word(struct kvm_vcpu *vcpu, u32 gpr32) { union kvmppc_one_reg val; int offset = kvmppc_get_vsr_word_offset(vcpu->arch.mmio_vsx_offset); int index = vcpu->arch.io_gpr & KVM_MMIO_REG_MASK; int dword_offset, word_offset; if (offset == -1) return; if (vcpu->arch.mmio_vsx_tx_sx_enabled) { val.vval = VCPU_VSX_VR(vcpu, index); val.vsx32val[offset] = gpr32; VCPU_VSX_VR(vcpu, index) = val.vval; } else { dword_offset = offset / 2; word_offset = offset % 2; val.vsxval[0] = VCPU_VSX_FPR(vcpu, index, dword_offset); val.vsx32val[word_offset] = gpr32; VCPU_VSX_FPR(vcpu, index, dword_offset) = val.vsxval[0]; } } ",0 "bool AutomationProvider::InitializeChannel(const std::string& channel_id) { TRACE_EVENT_BEGIN(""AutomationProvider::InitializeChannel"", 0, """"); std::string effective_channel_id = channel_id; bool use_named_interface = channel_id.find(automation::kNamedInterfacePrefix) == 0; if (use_named_interface) { effective_channel_id = channel_id.substr( strlen(automation::kNamedInterfacePrefix)); if (effective_channel_id.length() <= 0) return false; } if (!automation_resource_message_filter_.get()) { automation_resource_message_filter_ = new AutomationResourceMessageFilter; } channel_.reset(new IPC::SyncChannel( effective_channel_id, use_named_interface ? IPC::Channel::MODE_NAMED_SERVER : IPC::Channel::MODE_CLIENT, this, g_browser_process->io_thread()->message_loop(), true, g_browser_process->shutdown_event())); channel_->AddFilter(automation_resource_message_filter_); TRACE_EVENT_END(""AutomationProvider::InitializeChannel"", 0, """"); return true; } ",0 "std::vector GetTestCredentialRawIdBytes() { return fido_parsing_utils::Materialize(test_data::kU2fSignKeyHandle); } ",0 "static void vmx_sched_in(struct kvm_vcpu *vcpu, int cpu) { if (!kvm_pause_in_guest(vcpu->kvm)) shrink_ple_window(vcpu); } ",0 "static void nfs4_locku_prepare(struct rpc_task *task, void *data) { struct nfs4_unlockdata *calldata = data; if (nfs_wait_on_sequence(calldata->arg.seqid, task) != 0) return; if (test_bit(NFS_LOCK_INITIALIZED, &calldata->lsp->ls_flags) == 0) { /* Note: exit _without_ running nfs4_locku_done */ task->tk_action = NULL; return; } calldata->timestamp = jiffies; if (nfs4_setup_sequence(calldata->server, &calldata->arg.seq_args, &calldata->res.seq_res, task) != 0) nfs_release_seqid(calldata->arg.seqid); else rpc_call_start(task); } ",0 "smp_fetch_rqver(const struct arg *args, struct sample *smp, const char *kw, void *private) { struct http_txn *txn; char *ptr; int len; CHECK_HTTP_MESSAGE_FIRST(); txn = smp->strm->txn; len = txn->req.sl.rq.v_l; ptr = txn->req.chn->buf->p + txn->req.sl.rq.v; while ((len-- > 0) && (*ptr++ != '/')); if (len <= 0) return 0; smp->data.type = SMP_T_STR; smp->data.u.str.str = ptr; smp->data.u.str.len = len; smp->flags = SMP_F_VOL_1ST | SMP_F_CONST; return 1; } ",0 "querySiteconf(const ParsedURL *query_pu, int field) { const struct siteconf_rec *ent; Str u; char *firstp, *lastp; if (field < 0 || field >= SCONF_N_FIELD) return NULL; if (!query_pu || IS_EMPTY_PARSED_URL(query_pu)) return NULL; u = parsedURL2Str((ParsedURL *)query_pu); if (u->length == 0) return NULL; for (ent = siteconf_head; ent; ent = ent->next) { if (!SCONF_TEST(ent, field)) continue; if (ent->re_url) { if (RegexMatch(ent->re_url, u->ptr, u->length, 1)) { MatchedPosition(ent->re_url, &firstp, &lastp); if (!ent->url_exact) goto url_found; if (firstp != u->ptr || lastp == firstp) continue; if (*lastp == 0 || *lastp == '?' || *(lastp - 1) == '?' || *lastp == '#' || *(lastp - 1) == '#') goto url_found; } } else { int matchlen = strmatchlen(ent->url, u->ptr, u->length); if (matchlen == 0 || ent->url[matchlen] != 0) continue; firstp = u->ptr; lastp = u->ptr + matchlen; if (*lastp == 0 || *lastp == '?' || *(lastp - 1) == '?' || *lastp == '#' || *(lastp - 1) == '#') goto url_found; if (!ent->url_exact && (*lastp == '/' || *(lastp - 1) == '/')) goto url_found; } } return NULL; url_found: switch (field) { case SCONF_SUBSTITUTE_URL: if (ent->substitute_url && *ent->substitute_url) { Str tmp = Strnew_charp_n(u->ptr, firstp - u->ptr); Strcat_charp(tmp, ent->substitute_url); Strcat_charp(tmp, lastp); return tmp->ptr; } return NULL; #ifdef USE_M17N case SCONF_URL_CHARSET: return &ent->url_charset; #endif case SCONF_NO_REFERER_FROM: return &ent->no_referer_from; case SCONF_NO_REFERER_TO: return &ent->no_referer_to; } return NULL; } ",0 "static int __init packet_init(void) { int rc = proto_register(&packet_proto, 0); if (rc != 0) goto out; sock_register(&packet_family_ops); register_pernet_subsys(&packet_net_ops); register_netdevice_notifier(&packet_netdev_notifier); out: return rc; } ",0 "SCTP_STATIC int sctp_do_peeloff(struct sctp_association *asoc, struct socket **sockp) { struct sock *sk = asoc->base.sk; struct socket *sock; struct inet_sock *inetsk; int err = 0; /* An association cannot be branched off from an already peeled-off * socket, nor is this supported for tcp style sockets. */ if (!sctp_style(sk, UDP)) return -EINVAL; /* Create a new socket. */ err = sock_create(sk->sk_family, SOCK_SEQPACKET, IPPROTO_SCTP, &sock); if (err < 0) return err; /* Populate the fields of the newsk from the oldsk and migrate the * asoc to the newsk. */ sctp_sock_migrate(sk, sock->sk, asoc, SCTP_SOCKET_UDP_HIGH_BANDWIDTH); /* Make peeled-off sockets more like 1-1 accepted sockets. * Set the daddr and initialize id to something more random */ inetsk = inet_sk(sock->sk); inetsk->daddr = asoc->peer.primary_addr.v4.sin_addr.s_addr; inetsk->id = asoc->next_tsn ^ jiffies; *sockp = sock; return err; } ",0 "static void yam_arbitrate(struct net_device *dev) { struct yam_port *yp = netdev_priv(dev); if (yp->magic != YAM_MAGIC || yp->tx_state != TX_OFF || skb_queue_empty(&yp->send_queue)) return; /* tx_state is TX_OFF and there is data to send */ if (yp->dupmode) { /* Full duplex mode, don't wait */ yam_start_tx(dev, yp); return; } if (yp->dcd) { /* DCD on, wait slotime ... */ yp->slotcnt = yp->slot / 10; return; } /* Is slottime passed ? */ if ((--yp->slotcnt) > 0) return; yp->slotcnt = yp->slot / 10; /* is random > persist ? */ if ((prandom_u32() % 256) > yp->pers) return; yam_start_tx(dev, yp); } ",0 " virtual void SetUp() { InitializeConfig(); SetMode(GET_PARAM(1)); ResetModel(); } ",0 "ModuleExport size_t RegisterSGIImage(void) { MagickInfo *entry; entry=SetMagickInfo(""SGI""); entry->decoder=(DecodeImageHandler *) ReadSGIImage; entry->encoder=(EncodeImageHandler *) WriteSGIImage; entry->magick=(IsImageFormatHandler *) IsSGI; entry->description=ConstantString(""Irix RGB image""); entry->module=ConstantString(""SGI""); entry->seekable_stream=MagickTrue; (void) RegisterMagickInfo(entry); return(MagickImageCoderSignature); } ",0 "static IHEVCD_ERROR_T ihevcd_parse_profile_tier_level_layer(bitstrm_t *ps_bitstrm, profile_tier_lvl_t *ps_ptl) { WORD32 value; WORD32 i; IHEVCD_ERROR_T ret = (IHEVCD_ERROR_T)IHEVCD_SUCCESS; BITS_PARSE(""XXX_profile_space[]"", value, ps_bitstrm, 2); ps_ptl->i1_profile_space = value; BITS_PARSE(""XXX_tier_flag[]"", value, ps_bitstrm, 1); ps_ptl->i1_tier_flag = value; BITS_PARSE(""XXX_profile_idc[]"", value, ps_bitstrm, 5); ps_ptl->i1_profile_idc = value; for(i = 0; i < MAX_PROFILE_COMPATBLTY; i++) { BITS_PARSE(""XXX_profile_compatibility_flag[][j]"", value, ps_bitstrm, 1); ps_ptl->ai1_profile_compatibility_flag[i] = value; } BITS_PARSE(""general_progressive_source_flag"", value, ps_bitstrm, 1); ps_ptl->i1_general_progressive_source_flag = value; BITS_PARSE(""general_interlaced_source_flag"", value, ps_bitstrm, 1); ps_ptl->i1_general_progressive_source_flag = value; BITS_PARSE(""general_non_packed_constraint_flag"", value, ps_bitstrm, 1); ps_ptl->i1_general_progressive_source_flag = value; BITS_PARSE(""general_frame_only_constraint_flag"", value, ps_bitstrm, 1); ps_ptl->i1_general_progressive_source_flag = value; BITS_PARSE(""XXX_reserved_zero_44bits[0..15]"", value, ps_bitstrm, 16); BITS_PARSE(""XXX_reserved_zero_44bits[16..31]"", value, ps_bitstrm, 16); BITS_PARSE(""XXX_reserved_zero_44bits[32..43]"", value, ps_bitstrm, 12); return ret; } ",0 "device::GeolocationContext* WebContentsImpl::GetGeolocationContext() { return geolocation_context_.get(); } ",0 "void InputMethodBase::NotifyTextInputStateChanged( const TextInputClient* client) { FOR_EACH_OBSERVER(InputMethodObserver, observer_list_, OnTextInputStateChanged(client)); } ",0 "static void unix_detach_fds(struct scm_cookie *scm, struct sk_buff *skb) { int i; scm->fp = UNIXCB(skb).fp; UNIXCB(skb).fp = NULL; for (i = scm->fp->count-1; i >= 0; i--) unix_notinflight(scm->fp->fp[i]); } ",0 "void OffscreenCanvas::UpdateMemoryUsage() { int bytes_per_pixel = ColorParams().BytesPerPixel(); base::CheckedNumeric memory_usage_checked = bytes_per_pixel; memory_usage_checked *= Size().Width(); memory_usage_checked *= Size().Height(); int32_t new_memory_usage = memory_usage_checked.ValueOrDefault(std::numeric_limits::max()); v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory( new_memory_usage - memory_usage_); memory_usage_ = new_memory_usage; } ",0 "static int setkey(struct crypto_tfm *parent, const u8 *key, unsigned int keylen) { struct priv *ctx = crypto_tfm_ctx(parent); struct crypto_cipher *child = ctx->child; int err, bsize = LRW_BLOCK_SIZE; const u8 *tweak = key + keylen - bsize; crypto_cipher_clear_flags(child, CRYPTO_TFM_REQ_MASK); crypto_cipher_set_flags(child, crypto_tfm_get_flags(parent) & CRYPTO_TFM_REQ_MASK); err = crypto_cipher_setkey(child, key, keylen - bsize); if (err) return err; crypto_tfm_set_flags(parent, crypto_cipher_get_flags(child) & CRYPTO_TFM_RES_MASK); return lrw_init_table(&ctx->table, tweak); } ",0 " void Document::detach(const AttachContext& context) { TRACE_EVENT0(""blink"", ""Document::detach""); ASSERT(!m_frame || m_frame->tree().childCount() == 0); if (!isActive()) return; FrameNavigationDisabler navigationDisabler(*m_frame); HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates; ScriptForbiddenScope forbidScript; view()->dispose(); m_markers->prepareForDestruction(); if (LocalDOMWindow* window = this->domWindow()) window->willDetachDocumentFromFrame(); m_lifecycle.advanceTo(DocumentLifecycle::Stopping); if (page()) page()->documentDetached(this); InspectorInstrumentation::documentDetached(this); if (m_frame->loader().client()->sharedWorkerRepositoryClient()) m_frame->loader().client()->sharedWorkerRepositoryClient()->documentDetached(this); stopActiveDOMObjects(); if (m_scriptedAnimationController) m_scriptedAnimationController->clearDocumentPointer(); m_scriptedAnimationController.clear(); m_scriptedIdleTaskController.clear(); if (svgExtensions()) accessSVGExtensions().pauseAnimations(); if (m_domWindow) m_domWindow->clearEventQueue(); if (m_layoutView) m_layoutView->setIsInWindow(false); if (registrationContext()) registrationContext()->documentWasDetached(); m_hoverNode = nullptr; m_activeHoverElement = nullptr; m_autofocusElement = nullptr; if (m_focusedElement.get()) { RefPtrWillBeRawPtr oldFocusedElement = m_focusedElement; m_focusedElement = nullptr; if (frameHost()) frameHost()->chromeClient().focusedNodeChanged(oldFocusedElement.get(), nullptr); } if (this == &axObjectCacheOwner()) clearAXObjectCache(); m_layoutView = nullptr; ContainerNode::detach(context); if (this != &axObjectCacheOwner()) { if (AXObjectCache* cache = existingAXObjectCache()) { for (Node& node : NodeTraversal::descendantsOf(*this)) { cache->remove(&node); } } } styleEngine().didDetach(); frameHost()->eventHandlerRegistry().documentDetached(*this); m_frame->inputMethodController().documentDetached(); if (!loader()) m_fetcher->clearContext(); if (m_importsController) HTMLImportsController::removeFrom(*this); m_timers.setTimerTaskRunner( Platform::current()->currentThread()->scheduler()->timerTaskRunner()->adoptClone()); m_frame = nullptr; if (m_mediaQueryMatcher) m_mediaQueryMatcher->documentDetached(); DocumentLifecycleNotifier::notifyDocumentWasDetached(); m_lifecycle.advanceTo(DocumentLifecycle::Stopped); DocumentLifecycleNotifier::notifyContextDestroyed(); ExecutionContext::notifyContextDestroyed(); } ",1 "static void ion_handle_get(struct ion_handle *handle) { kref_get(&handle->ref); } ",0 "static int handle_rdmsr(struct kvm_vcpu *vcpu) { u32 ecx = vcpu->arch.regs[VCPU_REGS_RCX]; struct msr_data msr_info; msr_info.index = ecx; msr_info.host_initiated = false; if (vmx_get_msr(vcpu, &msr_info)) { trace_kvm_msr_read_ex(ecx); kvm_inject_gp(vcpu, 0); return 1; } trace_kvm_msr_read(ecx, msr_info.data); /* FIXME: handling of bits 32:63 of rax, rdx */ vcpu->arch.regs[VCPU_REGS_RAX] = msr_info.data & -1u; vcpu->arch.regs[VCPU_REGS_RDX] = (msr_info.data >> 32) & -1u; return kvm_skip_emulated_instruction(vcpu); } ",0 "void virtio_gpu_get_display_info(VirtIOGPU *g, struct virtio_gpu_ctrl_command *cmd) { struct virtio_gpu_resp_display_info display_info; trace_virtio_gpu_cmd_get_display_info(); memset(&display_info, 0, sizeof(display_info)); display_info.hdr.type = VIRTIO_GPU_RESP_OK_DISPLAY_INFO; virtio_gpu_fill_display_info(g, &display_info); virtio_gpu_ctrl_response(g, cmd, &display_info.hdr, sizeof(display_info)); } ",0 "static int jpc_cod_getparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *in) { jpc_cod_t *cod = &ms->parms.cod; if (jpc_getuint8(in, &cod->csty)) { return -1; } if (jpc_getuint8(in, &cod->prg) || jpc_getuint16(in, &cod->numlyrs) || jpc_getuint8(in, &cod->mctrans)) { return -1; } if (jpc_cox_getcompparms(ms, cstate, in, (cod->csty & JPC_COX_PRT) != 0, &cod->compparms)) { return -1; } if (jas_stream_eof(in)) { jpc_cod_destroyparms(ms); return -1; } return 0; } ",0 "static void reflectedCustomIntegralAttrAttrSetter(v8::Local name, v8::Local value, const v8::AccessorInfo& info) { INC_STATS(""DOM.TestObj.reflectedCustomIntegralAttr._set""); TestObj* imp = V8TestObj::toNative(info.Holder()); int v = toInt32(value); imp->setIntegralAttribute(WebCore::HTMLNames::customContentIntegralAttrAttr, v); return; } ",0 "void SessionModelAssociator::PopulateSessionHeaderFromSpecifics( const sync_pb::SessionHeader& header_specifics, SyncedSession* session_header) { if (header_specifics.has_client_name()) { session_header->session_name = header_specifics.client_name(); } if (header_specifics.has_device_type()) { switch (header_specifics.device_type()) { case sync_pb::SessionHeader_DeviceType_TYPE_WIN: session_header->device_type = SyncedSession::TYPE_WIN; break; case sync_pb::SessionHeader_DeviceType_TYPE_MAC: session_header->device_type = SyncedSession::TYPE_MACOSX; break; case sync_pb::SessionHeader_DeviceType_TYPE_LINUX: session_header->device_type = SyncedSession::TYPE_LINUX; break; case sync_pb::SessionHeader_DeviceType_TYPE_CROS: session_header->device_type = SyncedSession::TYPE_CHROMEOS; break; case sync_pb::SessionHeader_DeviceType_TYPE_OTHER: default: session_header->device_type = SyncedSession::TYPE_OTHER; break; } } } ",0 "MagickExport ChannelFeatures *GetImageChannelFeatures(const Image *image, const size_t distance,ExceptionInfo *exception) { typedef struct _ChannelStatistics { DoublePixelPacket direction[4]; /* horizontal, vertical, left and right diagonals */ } ChannelStatistics; CacheView *image_view; ChannelFeatures *channel_features; ChannelStatistics **cooccurrence, correlation, *density_x, *density_xy, *density_y, entropy_x, entropy_xy, entropy_xy1, entropy_xy2, entropy_y, mean, **Q, *sum, sum_squares, variance; LongPixelPacket gray, *grays; MagickBooleanType status; register ssize_t i; size_t length; ssize_t y; unsigned int number_grays; assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"",image->filename); if ((image->columns < (distance+1)) || (image->rows < (distance+1))) return((ChannelFeatures *) NULL); length=CompositeChannels+1UL; channel_features=(ChannelFeatures *) AcquireQuantumMemory(length, sizeof(*channel_features)); if (channel_features == (ChannelFeatures *) NULL) ThrowFatalException(ResourceLimitFatalError,""MemoryAllocationFailed""); (void) memset(channel_features,0,length* sizeof(*channel_features)); /* Form grays. */ grays=(LongPixelPacket *) AcquireQuantumMemory(MaxMap+1UL,sizeof(*grays)); if (grays == (LongPixelPacket *) NULL) { channel_features=(ChannelFeatures *) RelinquishMagickMemory( channel_features); (void) ThrowMagickException(exception,GetMagickModule(), ResourceLimitError,""MemoryAllocationFailed"",""`%s'"",image->filename); return(channel_features); } for (i=0; i <= (ssize_t) MaxMap; i++) { grays[i].red=(~0U); grays[i].green=(~0U); grays[i].blue=(~0U); grays[i].opacity=(~0U); grays[i].index=(~0U); } status=MagickTrue; image_view=AcquireVirtualCacheView(image,exception); #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static) shared(status) \ magick_number_threads(image,image,image->rows,1) #endif for (y=0; y < (ssize_t) image->rows; y++) { register const IndexPacket *magick_restrict indexes; register const PixelPacket *magick_restrict p; register ssize_t x; if (status == MagickFalse) continue; p=GetCacheViewVirtualPixels(image_view,0,y,image->columns,1,exception); if (p == (const PixelPacket *) NULL) { status=MagickFalse; continue; } indexes=GetCacheViewVirtualIndexQueue(image_view); for (x=0; x < (ssize_t) image->columns; x++) { grays[ScaleQuantumToMap(GetPixelRed(p))].red= ScaleQuantumToMap(GetPixelRed(p)); grays[ScaleQuantumToMap(GetPixelGreen(p))].green= ScaleQuantumToMap(GetPixelGreen(p)); grays[ScaleQuantumToMap(GetPixelBlue(p))].blue= ScaleQuantumToMap(GetPixelBlue(p)); if (image->colorspace == CMYKColorspace) grays[ScaleQuantumToMap(GetPixelIndex(indexes+x))].index= ScaleQuantumToMap(GetPixelIndex(indexes+x)); if (image->matte != MagickFalse) grays[ScaleQuantumToMap(GetPixelOpacity(p))].opacity= ScaleQuantumToMap(GetPixelOpacity(p)); p++; } } image_view=DestroyCacheView(image_view); if (status == MagickFalse) { grays=(LongPixelPacket *) RelinquishMagickMemory(grays); channel_features=(ChannelFeatures *) RelinquishMagickMemory( channel_features); return(channel_features); } (void) memset(&gray,0,sizeof(gray)); for (i=0; i <= (ssize_t) MaxMap; i++) { if (grays[i].red != ~0U) grays[(ssize_t) gray.red++].red=grays[i].red; if (grays[i].green != ~0U) grays[(ssize_t) gray.green++].green=grays[i].green; if (grays[i].blue != ~0U) grays[(ssize_t) gray.blue++].blue=grays[i].blue; if (image->colorspace == CMYKColorspace) if (grays[i].index != ~0U) grays[(ssize_t) gray.index++].index=grays[i].index; if (image->matte != MagickFalse) if (grays[i].opacity != ~0U) grays[(ssize_t) gray.opacity++].opacity=grays[i].opacity; } /* Allocate spatial dependence matrix. */ number_grays=gray.red; if (gray.green > number_grays) number_grays=gray.green; if (gray.blue > number_grays) number_grays=gray.blue; if (image->colorspace == CMYKColorspace) if (gray.index > number_grays) number_grays=gray.index; if (image->matte != MagickFalse) if (gray.opacity > number_grays) number_grays=gray.opacity; cooccurrence=(ChannelStatistics **) AcquireQuantumMemory(number_grays, sizeof(*cooccurrence)); density_x=(ChannelStatistics *) AcquireQuantumMemory(2*(number_grays+1), sizeof(*density_x)); density_xy=(ChannelStatistics *) AcquireQuantumMemory(2*(number_grays+1), sizeof(*density_xy)); density_y=(ChannelStatistics *) AcquireQuantumMemory(2*(number_grays+1), sizeof(*density_y)); Q=(ChannelStatistics **) AcquireQuantumMemory(number_grays,sizeof(*Q)); sum=(ChannelStatistics *) AcquireQuantumMemory(number_grays,sizeof(*sum)); if ((cooccurrence == (ChannelStatistics **) NULL) || (density_x == (ChannelStatistics *) NULL) || (density_xy == (ChannelStatistics *) NULL) || (density_y == (ChannelStatistics *) NULL) || (Q == (ChannelStatistics **) NULL) || (sum == (ChannelStatistics *) NULL)) { if (Q != (ChannelStatistics **) NULL) { for (i=0; i < (ssize_t) number_grays; i++) Q[i]=(ChannelStatistics *) RelinquishMagickMemory(Q[i]); Q=(ChannelStatistics **) RelinquishMagickMemory(Q); } if (sum != (ChannelStatistics *) NULL) sum=(ChannelStatistics *) RelinquishMagickMemory(sum); if (density_y != (ChannelStatistics *) NULL) density_y=(ChannelStatistics *) RelinquishMagickMemory(density_y); if (density_xy != (ChannelStatistics *) NULL) density_xy=(ChannelStatistics *) RelinquishMagickMemory(density_xy); if (density_x != (ChannelStatistics *) NULL) density_x=(ChannelStatistics *) RelinquishMagickMemory(density_x); if (cooccurrence != (ChannelStatistics **) NULL) { for (i=0; i < (ssize_t) number_grays; i++) cooccurrence[i]=(ChannelStatistics *) RelinquishMagickMemory(cooccurrence[i]); cooccurrence=(ChannelStatistics **) RelinquishMagickMemory( cooccurrence); } grays=(LongPixelPacket *) RelinquishMagickMemory(grays); channel_features=(ChannelFeatures *) RelinquishMagickMemory( channel_features); (void) ThrowMagickException(exception,GetMagickModule(), ResourceLimitError,""MemoryAllocationFailed"",""`%s'"",image->filename); return(channel_features); } (void) memset(&correlation,0,sizeof(correlation)); (void) memset(density_x,0,2*(number_grays+1)*sizeof(*density_x)); (void) memset(density_xy,0,2*(number_grays+1)*sizeof(*density_xy)); (void) memset(density_y,0,2*(number_grays+1)*sizeof(*density_y)); (void) memset(&mean,0,sizeof(mean)); (void) memset(sum,0,number_grays*sizeof(*sum)); (void) memset(&sum_squares,0,sizeof(sum_squares)); (void) memset(density_xy,0,2*number_grays*sizeof(*density_xy)); (void) memset(&entropy_x,0,sizeof(entropy_x)); (void) memset(&entropy_xy,0,sizeof(entropy_xy)); (void) memset(&entropy_xy1,0,sizeof(entropy_xy1)); (void) memset(&entropy_xy2,0,sizeof(entropy_xy2)); (void) memset(&entropy_y,0,sizeof(entropy_y)); (void) memset(&variance,0,sizeof(variance)); for (i=0; i < (ssize_t) number_grays; i++) { cooccurrence[i]=(ChannelStatistics *) AcquireQuantumMemory(number_grays, sizeof(**cooccurrence)); Q[i]=(ChannelStatistics *) AcquireQuantumMemory(number_grays,sizeof(**Q)); if ((cooccurrence[i] == (ChannelStatistics *) NULL) || (Q[i] == (ChannelStatistics *) NULL)) break; (void) memset(cooccurrence[i],0,number_grays* sizeof(**cooccurrence)); (void) memset(Q[i],0,number_grays*sizeof(**Q)); } if (i < (ssize_t) number_grays) { for (i--; i >= 0; i--) { if (Q[i] != (ChannelStatistics *) NULL) Q[i]=(ChannelStatistics *) RelinquishMagickMemory(Q[i]); if (cooccurrence[i] != (ChannelStatistics *) NULL) cooccurrence[i]=(ChannelStatistics *) RelinquishMagickMemory(cooccurrence[i]); } Q=(ChannelStatistics **) RelinquishMagickMemory(Q); cooccurrence=(ChannelStatistics **) RelinquishMagickMemory(cooccurrence); sum=(ChannelStatistics *) RelinquishMagickMemory(sum); density_y=(ChannelStatistics *) RelinquishMagickMemory(density_y); density_xy=(ChannelStatistics *) RelinquishMagickMemory(density_xy); density_x=(ChannelStatistics *) RelinquishMagickMemory(density_x); grays=(LongPixelPacket *) RelinquishMagickMemory(grays); channel_features=(ChannelFeatures *) RelinquishMagickMemory( channel_features); (void) ThrowMagickException(exception,GetMagickModule(), ResourceLimitError,""MemoryAllocationFailed"",""`%s'"",image->filename); return(channel_features); } /* Initialize spatial dependence matrix. */ status=MagickTrue; image_view=AcquireVirtualCacheView(image,exception); for (y=0; y < (ssize_t) image->rows; y++) { register const IndexPacket *magick_restrict indexes; register const PixelPacket *magick_restrict p; register ssize_t x; ssize_t i, offset, u, v; if (status == MagickFalse) continue; p=GetCacheViewVirtualPixels(image_view,-(ssize_t) distance,y,image->columns+ 2*distance,distance+2,exception); if (p == (const PixelPacket *) NULL) { status=MagickFalse; continue; } indexes=GetCacheViewVirtualIndexQueue(image_view); p+=distance; indexes+=distance; for (x=0; x < (ssize_t) image->columns; x++) { for (i=0; i < 4; i++) { switch (i) { case 0: default: { /* Horizontal adjacency. */ offset=(ssize_t) distance; break; } case 1: { /* Vertical adjacency. */ offset=(ssize_t) (image->columns+2*distance); break; } case 2: { /* Right diagonal adjacency. */ offset=(ssize_t) ((image->columns+2*distance)-distance); break; } case 3: { /* Left diagonal adjacency. */ offset=(ssize_t) ((image->columns+2*distance)+distance); break; } } u=0; v=0; while (grays[u].red != ScaleQuantumToMap(GetPixelRed(p))) u++; while (grays[v].red != ScaleQuantumToMap(GetPixelRed(p+offset))) v++; cooccurrence[u][v].direction[i].red++; cooccurrence[v][u].direction[i].red++; u=0; v=0; while (grays[u].green != ScaleQuantumToMap(GetPixelGreen(p))) u++; while (grays[v].green != ScaleQuantumToMap(GetPixelGreen(p+offset))) v++; cooccurrence[u][v].direction[i].green++; cooccurrence[v][u].direction[i].green++; u=0; v=0; while (grays[u].blue != ScaleQuantumToMap(GetPixelBlue(p))) u++; while (grays[v].blue != ScaleQuantumToMap((p+offset)->blue)) v++; cooccurrence[u][v].direction[i].blue++; cooccurrence[v][u].direction[i].blue++; if (image->colorspace == CMYKColorspace) { u=0; v=0; while (grays[u].index != ScaleQuantumToMap(GetPixelIndex(indexes+x))) u++; while (grays[v].index != ScaleQuantumToMap(GetPixelIndex(indexes+x+offset))) v++; cooccurrence[u][v].direction[i].index++; cooccurrence[v][u].direction[i].index++; } if (image->matte != MagickFalse) { u=0; v=0; while (grays[u].opacity != ScaleQuantumToMap(GetPixelOpacity(p))) u++; while (grays[v].opacity != ScaleQuantumToMap((p+offset)->opacity)) v++; cooccurrence[u][v].direction[i].opacity++; cooccurrence[v][u].direction[i].opacity++; } } p++; } } grays=(LongPixelPacket *) RelinquishMagickMemory(grays); image_view=DestroyCacheView(image_view); if (status == MagickFalse) { for (i=0; i < (ssize_t) number_grays; i++) cooccurrence[i]=(ChannelStatistics *) RelinquishMagickMemory(cooccurrence[i]); cooccurrence=(ChannelStatistics **) RelinquishMagickMemory(cooccurrence); channel_features=(ChannelFeatures *) RelinquishMagickMemory( channel_features); (void) ThrowMagickException(exception,GetMagickModule(), ResourceLimitError,""MemoryAllocationFailed"",""`%s'"",image->filename); return(channel_features); } /* Normalize spatial dependence matrix. */ for (i=0; i < 4; i++) { double normalize; register ssize_t y; switch (i) { case 0: default: { /* Horizontal adjacency. */ normalize=2.0*image->rows*(image->columns-distance); break; } case 1: { /* Vertical adjacency. */ normalize=2.0*(image->rows-distance)*image->columns; break; } case 2: { /* Right diagonal adjacency. */ normalize=2.0*(image->rows-distance)*(image->columns-distance); break; } case 3: { /* Left diagonal adjacency. */ normalize=2.0*(image->rows-distance)*(image->columns-distance); break; } } normalize=PerceptibleReciprocal(normalize); for (y=0; y < (ssize_t) number_grays; y++) { register ssize_t x; for (x=0; x < (ssize_t) number_grays; x++) { cooccurrence[x][y].direction[i].red*=normalize; cooccurrence[x][y].direction[i].green*=normalize; cooccurrence[x][y].direction[i].blue*=normalize; if (image->colorspace == CMYKColorspace) cooccurrence[x][y].direction[i].index*=normalize; if (image->matte != MagickFalse) cooccurrence[x][y].direction[i].opacity*=normalize; } } } /* Compute texture features. */ #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static) shared(status) \ magick_number_threads(image,image,number_grays,1) #endif for (i=0; i < 4; i++) { register ssize_t y; for (y=0; y < (ssize_t) number_grays; y++) { register ssize_t x; for (x=0; x < (ssize_t) number_grays; x++) { /* Angular second moment: measure of homogeneity of the image. */ channel_features[RedChannel].angular_second_moment[i]+= cooccurrence[x][y].direction[i].red* cooccurrence[x][y].direction[i].red; channel_features[GreenChannel].angular_second_moment[i]+= cooccurrence[x][y].direction[i].green* cooccurrence[x][y].direction[i].green; channel_features[BlueChannel].angular_second_moment[i]+= cooccurrence[x][y].direction[i].blue* cooccurrence[x][y].direction[i].blue; if (image->colorspace == CMYKColorspace) channel_features[BlackChannel].angular_second_moment[i]+= cooccurrence[x][y].direction[i].index* cooccurrence[x][y].direction[i].index; if (image->matte != MagickFalse) channel_features[OpacityChannel].angular_second_moment[i]+= cooccurrence[x][y].direction[i].opacity* cooccurrence[x][y].direction[i].opacity; /* Correlation: measure of linear-dependencies in the image. */ sum[y].direction[i].red+=cooccurrence[x][y].direction[i].red; sum[y].direction[i].green+=cooccurrence[x][y].direction[i].green; sum[y].direction[i].blue+=cooccurrence[x][y].direction[i].blue; if (image->colorspace == CMYKColorspace) sum[y].direction[i].index+=cooccurrence[x][y].direction[i].index; if (image->matte != MagickFalse) sum[y].direction[i].opacity+=cooccurrence[x][y].direction[i].opacity; correlation.direction[i].red+=x*y*cooccurrence[x][y].direction[i].red; correlation.direction[i].green+=x*y* cooccurrence[x][y].direction[i].green; correlation.direction[i].blue+=x*y* cooccurrence[x][y].direction[i].blue; if (image->colorspace == CMYKColorspace) correlation.direction[i].index+=x*y* cooccurrence[x][y].direction[i].index; if (image->matte != MagickFalse) correlation.direction[i].opacity+=x*y* cooccurrence[x][y].direction[i].opacity; /* Inverse Difference Moment. */ channel_features[RedChannel].inverse_difference_moment[i]+= cooccurrence[x][y].direction[i].red/((y-x)*(y-x)+1); channel_features[GreenChannel].inverse_difference_moment[i]+= cooccurrence[x][y].direction[i].green/((y-x)*(y-x)+1); channel_features[BlueChannel].inverse_difference_moment[i]+= cooccurrence[x][y].direction[i].blue/((y-x)*(y-x)+1); if (image->colorspace == CMYKColorspace) channel_features[IndexChannel].inverse_difference_moment[i]+= cooccurrence[x][y].direction[i].index/((y-x)*(y-x)+1); if (image->matte != MagickFalse) channel_features[OpacityChannel].inverse_difference_moment[i]+= cooccurrence[x][y].direction[i].opacity/((y-x)*(y-x)+1); /* Sum average. */ density_xy[y+x+2].direction[i].red+= cooccurrence[x][y].direction[i].red; density_xy[y+x+2].direction[i].green+= cooccurrence[x][y].direction[i].green; density_xy[y+x+2].direction[i].blue+= cooccurrence[x][y].direction[i].blue; if (image->colorspace == CMYKColorspace) density_xy[y+x+2].direction[i].index+= cooccurrence[x][y].direction[i].index; if (image->matte != MagickFalse) density_xy[y+x+2].direction[i].opacity+= cooccurrence[x][y].direction[i].opacity; /* Entropy. */ channel_features[RedChannel].entropy[i]-= cooccurrence[x][y].direction[i].red* MagickLog10(cooccurrence[x][y].direction[i].red); channel_features[GreenChannel].entropy[i]-= cooccurrence[x][y].direction[i].green* MagickLog10(cooccurrence[x][y].direction[i].green); channel_features[BlueChannel].entropy[i]-= cooccurrence[x][y].direction[i].blue* MagickLog10(cooccurrence[x][y].direction[i].blue); if (image->colorspace == CMYKColorspace) channel_features[IndexChannel].entropy[i]-= cooccurrence[x][y].direction[i].index* MagickLog10(cooccurrence[x][y].direction[i].index); if (image->matte != MagickFalse) channel_features[OpacityChannel].entropy[i]-= cooccurrence[x][y].direction[i].opacity* MagickLog10(cooccurrence[x][y].direction[i].opacity); /* Information Measures of Correlation. */ density_x[x].direction[i].red+=cooccurrence[x][y].direction[i].red; density_x[x].direction[i].green+=cooccurrence[x][y].direction[i].green; density_x[x].direction[i].blue+=cooccurrence[x][y].direction[i].blue; if (image->colorspace == CMYKColorspace) density_x[x].direction[i].index+= cooccurrence[x][y].direction[i].index; if (image->matte != MagickFalse) density_x[x].direction[i].opacity+= cooccurrence[x][y].direction[i].opacity; density_y[y].direction[i].red+=cooccurrence[x][y].direction[i].red; density_y[y].direction[i].green+=cooccurrence[x][y].direction[i].green; density_y[y].direction[i].blue+=cooccurrence[x][y].direction[i].blue; if (image->colorspace == CMYKColorspace) density_y[y].direction[i].index+= cooccurrence[x][y].direction[i].index; if (image->matte != MagickFalse) density_y[y].direction[i].opacity+= cooccurrence[x][y].direction[i].opacity; } mean.direction[i].red+=y*sum[y].direction[i].red; sum_squares.direction[i].red+=y*y*sum[y].direction[i].red; mean.direction[i].green+=y*sum[y].direction[i].green; sum_squares.direction[i].green+=y*y*sum[y].direction[i].green; mean.direction[i].blue+=y*sum[y].direction[i].blue; sum_squares.direction[i].blue+=y*y*sum[y].direction[i].blue; if (image->colorspace == CMYKColorspace) { mean.direction[i].index+=y*sum[y].direction[i].index; sum_squares.direction[i].index+=y*y*sum[y].direction[i].index; } if (image->matte != MagickFalse) { mean.direction[i].opacity+=y*sum[y].direction[i].opacity; sum_squares.direction[i].opacity+=y*y*sum[y].direction[i].opacity; } } /* Correlation: measure of linear-dependencies in the image. */ channel_features[RedChannel].correlation[i]= (correlation.direction[i].red-mean.direction[i].red* mean.direction[i].red)/(sqrt(sum_squares.direction[i].red- (mean.direction[i].red*mean.direction[i].red))*sqrt( sum_squares.direction[i].red-(mean.direction[i].red* mean.direction[i].red))); channel_features[GreenChannel].correlation[i]= (correlation.direction[i].green-mean.direction[i].green* mean.direction[i].green)/(sqrt(sum_squares.direction[i].green- (mean.direction[i].green*mean.direction[i].green))*sqrt( sum_squares.direction[i].green-(mean.direction[i].green* mean.direction[i].green))); channel_features[BlueChannel].correlation[i]= (correlation.direction[i].blue-mean.direction[i].blue* mean.direction[i].blue)/(sqrt(sum_squares.direction[i].blue- (mean.direction[i].blue*mean.direction[i].blue))*sqrt( sum_squares.direction[i].blue-(mean.direction[i].blue* mean.direction[i].blue))); if (image->colorspace == CMYKColorspace) channel_features[IndexChannel].correlation[i]= (correlation.direction[i].index-mean.direction[i].index* mean.direction[i].index)/(sqrt(sum_squares.direction[i].index- (mean.direction[i].index*mean.direction[i].index))*sqrt( sum_squares.direction[i].index-(mean.direction[i].index* mean.direction[i].index))); if (image->matte != MagickFalse) channel_features[OpacityChannel].correlation[i]= (correlation.direction[i].opacity-mean.direction[i].opacity* mean.direction[i].opacity)/(sqrt(sum_squares.direction[i].opacity- (mean.direction[i].opacity*mean.direction[i].opacity))*sqrt( sum_squares.direction[i].opacity-(mean.direction[i].opacity* mean.direction[i].opacity))); } /* Compute more texture features. */ #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static) shared(status) \ magick_number_threads(image,image,number_grays,1) #endif for (i=0; i < 4; i++) { register ssize_t x; for (x=2; x < (ssize_t) (2*number_grays); x++) { /* Sum average. */ channel_features[RedChannel].sum_average[i]+= x*density_xy[x].direction[i].red; channel_features[GreenChannel].sum_average[i]+= x*density_xy[x].direction[i].green; channel_features[BlueChannel].sum_average[i]+= x*density_xy[x].direction[i].blue; if (image->colorspace == CMYKColorspace) channel_features[IndexChannel].sum_average[i]+= x*density_xy[x].direction[i].index; if (image->matte != MagickFalse) channel_features[OpacityChannel].sum_average[i]+= x*density_xy[x].direction[i].opacity; /* Sum entropy. */ channel_features[RedChannel].sum_entropy[i]-= density_xy[x].direction[i].red* MagickLog10(density_xy[x].direction[i].red); channel_features[GreenChannel].sum_entropy[i]-= density_xy[x].direction[i].green* MagickLog10(density_xy[x].direction[i].green); channel_features[BlueChannel].sum_entropy[i]-= density_xy[x].direction[i].blue* MagickLog10(density_xy[x].direction[i].blue); if (image->colorspace == CMYKColorspace) channel_features[IndexChannel].sum_entropy[i]-= density_xy[x].direction[i].index* MagickLog10(density_xy[x].direction[i].index); if (image->matte != MagickFalse) channel_features[OpacityChannel].sum_entropy[i]-= density_xy[x].direction[i].opacity* MagickLog10(density_xy[x].direction[i].opacity); /* Sum variance. */ channel_features[RedChannel].sum_variance[i]+= (x-channel_features[RedChannel].sum_entropy[i])* (x-channel_features[RedChannel].sum_entropy[i])* density_xy[x].direction[i].red; channel_features[GreenChannel].sum_variance[i]+= (x-channel_features[GreenChannel].sum_entropy[i])* (x-channel_features[GreenChannel].sum_entropy[i])* density_xy[x].direction[i].green; channel_features[BlueChannel].sum_variance[i]+= (x-channel_features[BlueChannel].sum_entropy[i])* (x-channel_features[BlueChannel].sum_entropy[i])* density_xy[x].direction[i].blue; if (image->colorspace == CMYKColorspace) channel_features[IndexChannel].sum_variance[i]+= (x-channel_features[IndexChannel].sum_entropy[i])* (x-channel_features[IndexChannel].sum_entropy[i])* density_xy[x].direction[i].index; if (image->matte != MagickFalse) channel_features[OpacityChannel].sum_variance[i]+= (x-channel_features[OpacityChannel].sum_entropy[i])* (x-channel_features[OpacityChannel].sum_entropy[i])* density_xy[x].direction[i].opacity; } } /* Compute more texture features. */ #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static) shared(status) \ magick_number_threads(image,image,number_grays,1) #endif for (i=0; i < 4; i++) { register ssize_t y; for (y=0; y < (ssize_t) number_grays; y++) { register ssize_t x; for (x=0; x < (ssize_t) number_grays; x++) { /* Sum of Squares: Variance */ variance.direction[i].red+=(y-mean.direction[i].red+1)* (y-mean.direction[i].red+1)*cooccurrence[x][y].direction[i].red; variance.direction[i].green+=(y-mean.direction[i].green+1)* (y-mean.direction[i].green+1)*cooccurrence[x][y].direction[i].green; variance.direction[i].blue+=(y-mean.direction[i].blue+1)* (y-mean.direction[i].blue+1)*cooccurrence[x][y].direction[i].blue; if (image->colorspace == CMYKColorspace) variance.direction[i].index+=(y-mean.direction[i].index+1)* (y-mean.direction[i].index+1)*cooccurrence[x][y].direction[i].index; if (image->matte != MagickFalse) variance.direction[i].opacity+=(y-mean.direction[i].opacity+1)* (y-mean.direction[i].opacity+1)* cooccurrence[x][y].direction[i].opacity; /* Sum average / Difference Variance. */ density_xy[MagickAbsoluteValue(y-x)].direction[i].red+= cooccurrence[x][y].direction[i].red; density_xy[MagickAbsoluteValue(y-x)].direction[i].green+= cooccurrence[x][y].direction[i].green; density_xy[MagickAbsoluteValue(y-x)].direction[i].blue+= cooccurrence[x][y].direction[i].blue; if (image->colorspace == CMYKColorspace) density_xy[MagickAbsoluteValue(y-x)].direction[i].index+= cooccurrence[x][y].direction[i].index; if (image->matte != MagickFalse) density_xy[MagickAbsoluteValue(y-x)].direction[i].opacity+= cooccurrence[x][y].direction[i].opacity; /* Information Measures of Correlation. */ entropy_xy.direction[i].red-=cooccurrence[x][y].direction[i].red* MagickLog10(cooccurrence[x][y].direction[i].red); entropy_xy.direction[i].green-=cooccurrence[x][y].direction[i].green* MagickLog10(cooccurrence[x][y].direction[i].green); entropy_xy.direction[i].blue-=cooccurrence[x][y].direction[i].blue* MagickLog10(cooccurrence[x][y].direction[i].blue); if (image->colorspace == CMYKColorspace) entropy_xy.direction[i].index-=cooccurrence[x][y].direction[i].index* MagickLog10(cooccurrence[x][y].direction[i].index); if (image->matte != MagickFalse) entropy_xy.direction[i].opacity-= cooccurrence[x][y].direction[i].opacity*MagickLog10( cooccurrence[x][y].direction[i].opacity); entropy_xy1.direction[i].red-=(cooccurrence[x][y].direction[i].red* MagickLog10(density_x[x].direction[i].red* density_y[y].direction[i].red)); entropy_xy1.direction[i].green-=(cooccurrence[x][y].direction[i].green* MagickLog10(density_x[x].direction[i].green* density_y[y].direction[i].green)); entropy_xy1.direction[i].blue-=(cooccurrence[x][y].direction[i].blue* MagickLog10(density_x[x].direction[i].blue* density_y[y].direction[i].blue)); if (image->colorspace == CMYKColorspace) entropy_xy1.direction[i].index-=( cooccurrence[x][y].direction[i].index*MagickLog10( density_x[x].direction[i].index*density_y[y].direction[i].index)); if (image->matte != MagickFalse) entropy_xy1.direction[i].opacity-=( cooccurrence[x][y].direction[i].opacity*MagickLog10( density_x[x].direction[i].opacity* density_y[y].direction[i].opacity)); entropy_xy2.direction[i].red-=(density_x[x].direction[i].red* density_y[y].direction[i].red*MagickLog10( density_x[x].direction[i].red*density_y[y].direction[i].red)); entropy_xy2.direction[i].green-=(density_x[x].direction[i].green* density_y[y].direction[i].green*MagickLog10( density_x[x].direction[i].green*density_y[y].direction[i].green)); entropy_xy2.direction[i].blue-=(density_x[x].direction[i].blue* density_y[y].direction[i].blue*MagickLog10( density_x[x].direction[i].blue*density_y[y].direction[i].blue)); if (image->colorspace == CMYKColorspace) entropy_xy2.direction[i].index-=(density_x[x].direction[i].index* density_y[y].direction[i].index*MagickLog10( density_x[x].direction[i].index*density_y[y].direction[i].index)); if (image->matte != MagickFalse) entropy_xy2.direction[i].opacity-=(density_x[x].direction[i].opacity* density_y[y].direction[i].opacity*MagickLog10( density_x[x].direction[i].opacity* density_y[y].direction[i].opacity)); } } channel_features[RedChannel].variance_sum_of_squares[i]= variance.direction[i].red; channel_features[GreenChannel].variance_sum_of_squares[i]= variance.direction[i].green; channel_features[BlueChannel].variance_sum_of_squares[i]= variance.direction[i].blue; if (image->colorspace == CMYKColorspace) channel_features[RedChannel].variance_sum_of_squares[i]= variance.direction[i].index; if (image->matte != MagickFalse) channel_features[RedChannel].variance_sum_of_squares[i]= variance.direction[i].opacity; } /* Compute more texture features. */ (void) memset(&variance,0,sizeof(variance)); (void) memset(&sum_squares,0,sizeof(sum_squares)); #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static) shared(status) \ magick_number_threads(image,image,number_grays,1) #endif for (i=0; i < 4; i++) { register ssize_t x; for (x=0; x < (ssize_t) number_grays; x++) { /* Difference variance. */ variance.direction[i].red+=density_xy[x].direction[i].red; variance.direction[i].green+=density_xy[x].direction[i].green; variance.direction[i].blue+=density_xy[x].direction[i].blue; if (image->colorspace == CMYKColorspace) variance.direction[i].index+=density_xy[x].direction[i].index; if (image->matte != MagickFalse) variance.direction[i].opacity+=density_xy[x].direction[i].opacity; sum_squares.direction[i].red+=density_xy[x].direction[i].red* density_xy[x].direction[i].red; sum_squares.direction[i].green+=density_xy[x].direction[i].green* density_xy[x].direction[i].green; sum_squares.direction[i].blue+=density_xy[x].direction[i].blue* density_xy[x].direction[i].blue; if (image->colorspace == CMYKColorspace) sum_squares.direction[i].index+=density_xy[x].direction[i].index* density_xy[x].direction[i].index; if (image->matte != MagickFalse) sum_squares.direction[i].opacity+=density_xy[x].direction[i].opacity* density_xy[x].direction[i].opacity; /* Difference entropy. */ channel_features[RedChannel].difference_entropy[i]-= density_xy[x].direction[i].red* MagickLog10(density_xy[x].direction[i].red); channel_features[GreenChannel].difference_entropy[i]-= density_xy[x].direction[i].green* MagickLog10(density_xy[x].direction[i].green); channel_features[BlueChannel].difference_entropy[i]-= density_xy[x].direction[i].blue* MagickLog10(density_xy[x].direction[i].blue); if (image->colorspace == CMYKColorspace) channel_features[IndexChannel].difference_entropy[i]-= density_xy[x].direction[i].index* MagickLog10(density_xy[x].direction[i].index); if (image->matte != MagickFalse) channel_features[OpacityChannel].difference_entropy[i]-= density_xy[x].direction[i].opacity* MagickLog10(density_xy[x].direction[i].opacity); /* Information Measures of Correlation. */ entropy_x.direction[i].red-=(density_x[x].direction[i].red* MagickLog10(density_x[x].direction[i].red)); entropy_x.direction[i].green-=(density_x[x].direction[i].green* MagickLog10(density_x[x].direction[i].green)); entropy_x.direction[i].blue-=(density_x[x].direction[i].blue* MagickLog10(density_x[x].direction[i].blue)); if (image->colorspace == CMYKColorspace) entropy_x.direction[i].index-=(density_x[x].direction[i].index* MagickLog10(density_x[x].direction[i].index)); if (image->matte != MagickFalse) entropy_x.direction[i].opacity-=(density_x[x].direction[i].opacity* MagickLog10(density_x[x].direction[i].opacity)); entropy_y.direction[i].red-=(density_y[x].direction[i].red* MagickLog10(density_y[x].direction[i].red)); entropy_y.direction[i].green-=(density_y[x].direction[i].green* MagickLog10(density_y[x].direction[i].green)); entropy_y.direction[i].blue-=(density_y[x].direction[i].blue* MagickLog10(density_y[x].direction[i].blue)); if (image->colorspace == CMYKColorspace) entropy_y.direction[i].index-=(density_y[x].direction[i].index* MagickLog10(density_y[x].direction[i].index)); if (image->matte != MagickFalse) entropy_y.direction[i].opacity-=(density_y[x].direction[i].opacity* MagickLog10(density_y[x].direction[i].opacity)); } /* Difference variance. */ channel_features[RedChannel].difference_variance[i]= (((double) number_grays*number_grays*sum_squares.direction[i].red)- (variance.direction[i].red*variance.direction[i].red))/ ((double) number_grays*number_grays*number_grays*number_grays); channel_features[GreenChannel].difference_variance[i]= (((double) number_grays*number_grays*sum_squares.direction[i].green)- (variance.direction[i].green*variance.direction[i].green))/ ((double) number_grays*number_grays*number_grays*number_grays); channel_features[BlueChannel].difference_variance[i]= (((double) number_grays*number_grays*sum_squares.direction[i].blue)- (variance.direction[i].blue*variance.direction[i].blue))/ ((double) number_grays*number_grays*number_grays*number_grays); if (image->matte != MagickFalse) channel_features[OpacityChannel].difference_variance[i]= (((double) number_grays*number_grays*sum_squares.direction[i].opacity)- (variance.direction[i].opacity*variance.direction[i].opacity))/ ((double) number_grays*number_grays*number_grays*number_grays); if (image->colorspace == CMYKColorspace) channel_features[IndexChannel].difference_variance[i]= (((double) number_grays*number_grays*sum_squares.direction[i].index)- (variance.direction[i].index*variance.direction[i].index))/ ((double) number_grays*number_grays*number_grays*number_grays); /* Information Measures of Correlation. */ channel_features[RedChannel].measure_of_correlation_1[i]= (entropy_xy.direction[i].red-entropy_xy1.direction[i].red)/ (entropy_x.direction[i].red > entropy_y.direction[i].red ? entropy_x.direction[i].red : entropy_y.direction[i].red); channel_features[GreenChannel].measure_of_correlation_1[i]= (entropy_xy.direction[i].green-entropy_xy1.direction[i].green)/ (entropy_x.direction[i].green > entropy_y.direction[i].green ? entropy_x.direction[i].green : entropy_y.direction[i].green); channel_features[BlueChannel].measure_of_correlation_1[i]= (entropy_xy.direction[i].blue-entropy_xy1.direction[i].blue)/ (entropy_x.direction[i].blue > entropy_y.direction[i].blue ? entropy_x.direction[i].blue : entropy_y.direction[i].blue); if (image->colorspace == CMYKColorspace) channel_features[IndexChannel].measure_of_correlation_1[i]= (entropy_xy.direction[i].index-entropy_xy1.direction[i].index)/ (entropy_x.direction[i].index > entropy_y.direction[i].index ? entropy_x.direction[i].index : entropy_y.direction[i].index); if (image->matte != MagickFalse) channel_features[OpacityChannel].measure_of_correlation_1[i]= (entropy_xy.direction[i].opacity-entropy_xy1.direction[i].opacity)/ (entropy_x.direction[i].opacity > entropy_y.direction[i].opacity ? entropy_x.direction[i].opacity : entropy_y.direction[i].opacity); channel_features[RedChannel].measure_of_correlation_2[i]= (sqrt(fabs(1.0-exp(-2.0*(entropy_xy2.direction[i].red- entropy_xy.direction[i].red))))); channel_features[GreenChannel].measure_of_correlation_2[i]= (sqrt(fabs(1.0-exp(-2.0*(entropy_xy2.direction[i].green- entropy_xy.direction[i].green))))); channel_features[BlueChannel].measure_of_correlation_2[i]= (sqrt(fabs(1.0-exp(-2.0*(entropy_xy2.direction[i].blue- entropy_xy.direction[i].blue))))); if (image->colorspace == CMYKColorspace) channel_features[IndexChannel].measure_of_correlation_2[i]= (sqrt(fabs(1.0-exp(-2.0*(entropy_xy2.direction[i].index- entropy_xy.direction[i].index))))); if (image->matte != MagickFalse) channel_features[OpacityChannel].measure_of_correlation_2[i]= (sqrt(fabs(1.0-exp(-2.0*(entropy_xy2.direction[i].opacity- entropy_xy.direction[i].opacity))))); } /* Compute more texture features. */ #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static) shared(status) \ magick_number_threads(image,image,number_grays,1) #endif for (i=0; i < 4; i++) { register ssize_t z; for (z=0; z < (ssize_t) number_grays; z++) { register ssize_t y; ChannelStatistics pixel; (void) memset(&pixel,0,sizeof(pixel)); for (y=0; y < (ssize_t) number_grays; y++) { register ssize_t x; for (x=0; x < (ssize_t) number_grays; x++) { /* Contrast: amount of local variations present in an image. */ if (((y-x) == z) || ((x-y) == z)) { pixel.direction[i].red+=cooccurrence[x][y].direction[i].red; pixel.direction[i].green+=cooccurrence[x][y].direction[i].green; pixel.direction[i].blue+=cooccurrence[x][y].direction[i].blue; if (image->colorspace == CMYKColorspace) pixel.direction[i].index+=cooccurrence[x][y].direction[i].index; if (image->matte != MagickFalse) pixel.direction[i].opacity+= cooccurrence[x][y].direction[i].opacity; } /* Maximum Correlation Coefficient. */ Q[z][y].direction[i].red+=cooccurrence[z][x].direction[i].red* cooccurrence[y][x].direction[i].red/density_x[z].direction[i].red/ density_y[x].direction[i].red; Q[z][y].direction[i].green+=cooccurrence[z][x].direction[i].green* cooccurrence[y][x].direction[i].green/ density_x[z].direction[i].green/density_y[x].direction[i].red; Q[z][y].direction[i].blue+=cooccurrence[z][x].direction[i].blue* cooccurrence[y][x].direction[i].blue/density_x[z].direction[i].blue/ density_y[x].direction[i].blue; if (image->colorspace == CMYKColorspace) Q[z][y].direction[i].index+=cooccurrence[z][x].direction[i].index* cooccurrence[y][x].direction[i].index/ density_x[z].direction[i].index/density_y[x].direction[i].index; if (image->matte != MagickFalse) Q[z][y].direction[i].opacity+= cooccurrence[z][x].direction[i].opacity* cooccurrence[y][x].direction[i].opacity/ density_x[z].direction[i].opacity/ density_y[x].direction[i].opacity; } } channel_features[RedChannel].contrast[i]+=z*z*pixel.direction[i].red; channel_features[GreenChannel].contrast[i]+=z*z*pixel.direction[i].green; channel_features[BlueChannel].contrast[i]+=z*z*pixel.direction[i].blue; if (image->colorspace == CMYKColorspace) channel_features[BlackChannel].contrast[i]+=z*z* pixel.direction[i].index; if (image->matte != MagickFalse) channel_features[OpacityChannel].contrast[i]+=z*z* pixel.direction[i].opacity; } /* Maximum Correlation Coefficient. Future: return second largest eigenvalue of Q. */ channel_features[RedChannel].maximum_correlation_coefficient[i]= sqrt((double) -1.0); channel_features[GreenChannel].maximum_correlation_coefficient[i]= sqrt((double) -1.0); channel_features[BlueChannel].maximum_correlation_coefficient[i]= sqrt((double) -1.0); if (image->colorspace == CMYKColorspace) channel_features[IndexChannel].maximum_correlation_coefficient[i]= sqrt((double) -1.0); if (image->matte != MagickFalse) channel_features[OpacityChannel].maximum_correlation_coefficient[i]= sqrt((double) -1.0); } /* Relinquish resources. */ sum=(ChannelStatistics *) RelinquishMagickMemory(sum); for (i=0; i < (ssize_t) number_grays; i++) Q[i]=(ChannelStatistics *) RelinquishMagickMemory(Q[i]); Q=(ChannelStatistics **) RelinquishMagickMemory(Q); density_y=(ChannelStatistics *) RelinquishMagickMemory(density_y); density_xy=(ChannelStatistics *) RelinquishMagickMemory(density_xy); density_x=(ChannelStatistics *) RelinquishMagickMemory(density_x); for (i=0; i < (ssize_t) number_grays; i++) cooccurrence[i]=(ChannelStatistics *) RelinquishMagickMemory(cooccurrence[i]); cooccurrence=(ChannelStatistics **) RelinquishMagickMemory(cooccurrence); return(channel_features); } ",0 "LocalFrameClient* FrameFetchContext::GetLocalFrameClient() const { return GetFrame()->Client(); } ",0 "int brnf_sysctl_call_tables(ctl_table * ctl, int write, void __user * buffer, size_t * lenp, loff_t * ppos) { int ret; ret = proc_dointvec(ctl, write, buffer, lenp, ppos); if (write && *(int *)(ctl->data)) *(int *)(ctl->data) = 1; return ret; } ",0 "gfx::Rect Browser::GetSavedWindowBounds() const { const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); bool record_mode = parsed_command_line.HasSwitch(switches::kRecordMode); bool playback_mode = parsed_command_line.HasSwitch(switches::kPlaybackMode); if (record_mode || playback_mode) { return gfx::Rect(0, 0, 800, 600); } gfx::Rect restored_bounds = override_bounds_; bool maximized; WindowSizer::GetBrowserWindowBounds(app_name_, restored_bounds, this, &restored_bounds, &maximized); return restored_bounds; } ",0 "xfs_imap_to_bp( struct xfs_mount *mp, struct xfs_trans *tp, struct xfs_imap *imap, struct xfs_dinode **dipp, struct xfs_buf **bpp, uint buf_flags, uint iget_flags) { struct xfs_buf *bp; int error; buf_flags |= XBF_UNMAPPED; error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, imap->im_blkno, (int)imap->im_len, buf_flags, &bp, &xfs_inode_buf_ops); if (error) { if (error == -EAGAIN) { ASSERT(buf_flags & XBF_TRYLOCK); return error; } xfs_warn(mp, ""%s: xfs_trans_read_buf() returned error %d."", __func__, error); return error; } *bpp = bp; *dipp = xfs_buf_offset(bp, imap->im_boffset); return 0; } ",0 "dissect_u3v_read_mem_cmd(proto_tree *u3v_telegram_tree, tvbuff_t *tvb, packet_info *pinfo, gint startoffset, gint length, u3v_conv_info_t *u3v_conv_info, gencp_transaction_t * gencp_trans) { guint64 addr = 0; const gchar* address_string = NULL; gboolean is_custom_register = FALSE; guint16 count = 0; gint offset = startoffset; proto_item *item = NULL; addr = tvb_get_letoh64(tvb, offset); gencp_trans->address = addr; address_string = get_register_name_from_address(addr, &is_custom_register, u3v_conv_info); count = tvb_get_letohs(tvb, offset + 10); /* Number of bytes to read from memory */ gencp_trans->count = count; if ( 0xffffffff00000000 & addr ) { col_append_fstr(pinfo->cinfo, COL_INFO, "" (0x%016"" G_GINT64_MODIFIER ""X (%d) bytes) %s"", addr, count, address_string); } else { col_append_fstr(pinfo->cinfo, COL_INFO, "" (0x%08X (%d) bytes)"", (guint32)addr, count); } item = proto_tree_add_item(u3v_telegram_tree, hf_u3v_scd_readmem_cmd, tvb, offset, length, ENC_NA); u3v_telegram_tree = proto_item_add_subtree(item, ett_u3v_payload_cmd); /* address */ if (is_known_bootstrap_register(addr, u3v_conv_info)) { item = proto_tree_add_uint64(u3v_telegram_tree, hf_u3v_address, tvb, offset, 8, addr); proto_item_append_text(item, "" %s"", address_string); } else { proto_tree_add_item(u3v_telegram_tree, hf_u3v_custom_memory_addr, tvb, offset, 8, ENC_LITTLE_ENDIAN); } offset += 8; /* reserved field */ proto_tree_add_item(u3v_telegram_tree, hf_u3v_reserved, tvb, offset, 2, ENC_NA); offset += 2; /* count */ proto_tree_add_item(u3v_telegram_tree, hf_u3v_count, tvb, offset, 2, ENC_LITTLE_ENDIAN); } ",0 "bool RenderFrameHostImpl::CreateRenderFrame(int proxy_routing_id, int opener_routing_id, int parent_routing_id, int previous_sibling_routing_id) { TRACE_EVENT0(""navigation"", ""RenderFrameHostImpl::CreateRenderFrame""); DCHECK(!IsRenderFrameLive()) << ""Creating frame twice""; if (!GetProcess()->Init()) return false; DCHECK(GetProcess()->IsInitializedAndNotDead()); service_manager::mojom::InterfaceProviderPtr interface_provider; BindInterfaceProviderRequest(mojo::MakeRequest(&interface_provider)); mojom::CreateFrameParamsPtr params = mojom::CreateFrameParams::New(); params->interface_provider = interface_provider.PassInterface(); params->routing_id = routing_id_; params->proxy_routing_id = proxy_routing_id; params->opener_routing_id = opener_routing_id; params->parent_routing_id = parent_routing_id; params->previous_sibling_routing_id = previous_sibling_routing_id; params->replication_state = frame_tree_node()->current_replication_state(); params->devtools_frame_token = frame_tree_node()->devtools_frame_token(); params->replication_state.frame_policy = frame_tree_node()->pending_frame_policy(); params->frame_owner_properties = FrameOwnerProperties(frame_tree_node()->frame_owner_properties()); params->has_committed_real_load = frame_tree_node()->has_committed_real_load(); params->widget_params = mojom::CreateFrameWidgetParams::New(); if (render_widget_host_) { params->widget_params->routing_id = render_widget_host_->GetRoutingID(); params->widget_params->hidden = render_widget_host_->is_hidden(); } else { params->widget_params->routing_id = MSG_ROUTING_NONE; params->widget_params->hidden = true; } GetProcess()->GetRendererInterface()->CreateFrame(std::move(params)); if (parent_routing_id != MSG_ROUTING_NONE && render_widget_host_) { RenderWidgetHostView* rwhv = RenderWidgetHostViewChildFrame::Create(render_widget_host_); rwhv->Hide(); } if (proxy_routing_id != MSG_ROUTING_NONE) { RenderFrameProxyHost* proxy = RenderFrameProxyHost::FromID( GetProcess()->GetID(), proxy_routing_id); proxy->set_render_frame_proxy_created(true); } SetRenderFrameCreated(true); return true; } ",0 "static int __sctp_connect(struct sock* sk, struct sockaddr *kaddrs, int addrs_size, sctp_assoc_t *assoc_id) { struct net *net = sock_net(sk); struct sctp_sock *sp; struct sctp_endpoint *ep; struct sctp_association *asoc = NULL; struct sctp_association *asoc2; struct sctp_transport *transport; union sctp_addr to; struct sctp_af *af; sctp_scope_t scope; long timeo; int err = 0; int addrcnt = 0; int walk_size = 0; union sctp_addr *sa_addr = NULL; void *addr_buf; unsigned short port; unsigned int f_flags = 0; sp = sctp_sk(sk); ep = sp->ep; /* connect() cannot be done on a socket that is already in ESTABLISHED * state - UDP-style peeled off socket or a TCP-style socket that * is already connected. * It cannot be done even on a TCP-style listening socket. */ if (sctp_sstate(sk, ESTABLISHED) || (sctp_style(sk, TCP) && sctp_sstate(sk, LISTENING))) { err = -EISCONN; goto out_free; } /* Walk through the addrs buffer and count the number of addresses. */ addr_buf = kaddrs; while (walk_size < addrs_size) { if (walk_size + sizeof(sa_family_t) > addrs_size) { err = -EINVAL; goto out_free; } sa_addr = addr_buf; af = sctp_get_af_specific(sa_addr->sa.sa_family); /* If the address family is not supported or if this address * causes the address buffer to overflow return EINVAL. */ if (!af || (walk_size + af->sockaddr_len) > addrs_size) { err = -EINVAL; goto out_free; } port = ntohs(sa_addr->v4.sin_port); /* Save current address so we can work with it */ memcpy(&to, sa_addr, af->sockaddr_len); err = sctp_verify_addr(sk, &to, af->sockaddr_len); if (err) goto out_free; /* Make sure the destination port is correctly set * in all addresses. */ if (asoc && asoc->peer.port && asoc->peer.port != port) goto out_free; /* Check if there already is a matching association on the * endpoint (other than the one created here). */ asoc2 = sctp_endpoint_lookup_assoc(ep, &to, &transport); if (asoc2 && asoc2 != asoc) { if (asoc2->state >= SCTP_STATE_ESTABLISHED) err = -EISCONN; else err = -EALREADY; goto out_free; } /* If we could not find a matching association on the endpoint, * make sure that there is no peeled-off association matching * the peer address even on another socket. */ if (sctp_endpoint_is_peeled_off(ep, &to)) { err = -EADDRNOTAVAIL; goto out_free; } if (!asoc) { /* If a bind() or sctp_bindx() is not called prior to * an sctp_connectx() call, the system picks an * ephemeral port and will choose an address set * equivalent to binding with a wildcard address. */ if (!ep->base.bind_addr.port) { if (sctp_autobind(sk)) { err = -EAGAIN; goto out_free; } } else { /* * If an unprivileged user inherits a 1-many * style socket with open associations on a * privileged port, it MAY be permitted to * accept new associations, but it SHOULD NOT * be permitted to open new associations. */ if (ep->base.bind_addr.port < PROT_SOCK && !ns_capable(net->user_ns, CAP_NET_BIND_SERVICE)) { err = -EACCES; goto out_free; } } scope = sctp_scope(&to); asoc = sctp_association_new(ep, sk, scope, GFP_KERNEL); if (!asoc) { err = -ENOMEM; goto out_free; } err = sctp_assoc_set_bind_addr_from_ep(asoc, scope, GFP_KERNEL); if (err < 0) { goto out_free; } } /* Prime the peer's transport structures. */ transport = sctp_assoc_add_peer(asoc, &to, GFP_KERNEL, SCTP_UNKNOWN); if (!transport) { err = -ENOMEM; goto out_free; } addrcnt++; addr_buf += af->sockaddr_len; walk_size += af->sockaddr_len; } /* In case the user of sctp_connectx() wants an association * id back, assign one now. */ if (assoc_id) { err = sctp_assoc_set_id(asoc, GFP_KERNEL); if (err < 0) goto out_free; } err = sctp_primitive_ASSOCIATE(net, asoc, NULL); if (err < 0) { goto out_free; } /* Initialize sk's dport and daddr for getpeername() */ inet_sk(sk)->inet_dport = htons(asoc->peer.port); af = sctp_get_af_specific(sa_addr->sa.sa_family); af->to_sk_daddr(sa_addr, sk); sk->sk_err = 0; /* in-kernel sockets don't generally have a file allocated to them * if all they do is call sock_create_kern(). */ if (sk->sk_socket->file) f_flags = sk->sk_socket->file->f_flags; timeo = sock_sndtimeo(sk, f_flags & O_NONBLOCK); err = sctp_wait_for_connect(asoc, &timeo); if ((err == 0 || err == -EINPROGRESS) && assoc_id) *assoc_id = asoc->assoc_id; /* Don't free association on exit. */ asoc = NULL; out_free: SCTP_DEBUG_PRINTK(""About to exit __sctp_connect() free asoc: %p"" "" kaddrs: %p err: %d\n"", asoc, kaddrs, err); if (asoc) { /* sctp_primitive_ASSOCIATE may have added this association * To the hash table, try to unhash it, just in case, its a noop * if it wasn't hashed so we're safe */ sctp_unhash_established(asoc); sctp_association_free(asoc); } return err; } ",0 "static void tcp_v4_reqsk_destructor(struct request_sock *req) { kfree(inet_rsk(req)->opt); } ",0 " UsageAndQuotaDispatcherTask( QuotaManager* manager, const HostAndType& host_and_type) : QuotaTask(manager), host_and_type_(host_and_type), started_(false), host_quota_(-1), global_usage_(-1), global_unlimited_usage_(-1), host_usage_(-1), available_space_(-1), quota_status_(kQuotaStatusUnknown), waiting_callbacks_(1), weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {} ",0 "int XI2ModeToXMode(int xi2_mode) { switch (xi2_mode) { case XINotifyNormal: return NotifyNormal; case XINotifyGrab: case XINotifyPassiveGrab: return NotifyGrab; case XINotifyUngrab: case XINotifyPassiveUngrab: return NotifyUngrab; case XINotifyWhileGrabbed: return NotifyWhileGrabbed; default: NOTREACHED(); return NotifyNormal; } } ",0 " void set_run_callback(const RunFromHostProxyCallback& run_callback) { run_callback_ = run_callback; } ",0 " void EnableDatatype(syncable::ModelType model_type) { enabled_datatypes_.Put(model_type); mock_server_->ExpectGetUpdatesRequestTypes(enabled_datatypes_); } ",0 "void SVGDocumentExtensions::registerPendingSVGFontFaceElementsForRemoval(PassRefPtrWillBeRawPtr font) { m_pendingSVGFontFaceElementsForRemoval.add(font); } ",0 "parse_OUTPUT(const char *arg, struct ofpbuf *ofpacts, enum ofputil_protocol *usable_protocols OVS_UNUSED) { if (strstr(arg, ""port"") && strstr(arg, ""max_len"")) { struct ofpact_output_trunc *output_trunc; output_trunc = ofpact_put_OUTPUT_TRUNC(ofpacts); return parse_truncate_subfield(output_trunc, arg); } ofp_port_t port; if (ofputil_port_from_string(arg, &port)) { struct ofpact_output *output = ofpact_put_OUTPUT(ofpacts); output->port = port; output->max_len = output->port == OFPP_CONTROLLER ? UINT16_MAX : 0; return NULL; } struct mf_subfield src; char *error = mf_parse_subfield(&src, arg); if (!error) { struct ofpact_output_reg *output_reg; output_reg = ofpact_put_OUTPUT_REG(ofpacts); output_reg->max_len = UINT16_MAX; output_reg->src = src; return NULL; } free(error); return xasprintf(""%s: output to unknown port"", arg); } ",0 "const GURL& WebContentsImpl::GetMainFrameLastCommittedURL() const { return GetLastCommittedURL(); } ",0 "xmlXPtrFreeLocationSet(xmlLocationSetPtr obj) { int i; if (obj == NULL) return; if (obj->locTab != NULL) { for (i = 0;i < obj->locNr; i++) { xmlXPathFreeObject(obj->locTab[i]); } xmlFree(obj->locTab); } xmlFree(obj); } ",0 "void RendererSchedulerImpl::BeginFrameNotExpectedSoon() { TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT(""renderer.scheduler""), ""RendererSchedulerImpl::BeginFrameNotExpectedSoon""); helper_.CheckOnValidThread(); if (helper_.IsShutdown()) return; main_thread_only().begin_frame_not_expected_soon = true; idle_helper_.EnableLongIdlePeriod(); { base::AutoLock lock(any_thread_lock_); any_thread().begin_main_frame_on_critical_path = false; } } ",0 "void ReadableStreamBytesConsumer::ClearClient() { client_ = nullptr; } ",0 "decode_NXAST_RAW_LEARN(const struct nx_action_learn *nal, enum ofp_version ofp_version OVS_UNUSED, const struct vl_mff_map *vl_mff_map, uint64_t *tlv_bitmap, struct ofpbuf *ofpacts) { struct ofpact_learn *learn; const void *p, *end; if (nal->pad) { return OFPERR_OFPBAC_BAD_ARGUMENT; } learn = ofpact_put_LEARN(ofpacts); learn->idle_timeout = ntohs(nal->idle_timeout); learn->hard_timeout = ntohs(nal->hard_timeout); learn->priority = ntohs(nal->priority); learn->cookie = nal->cookie; learn->table_id = nal->table_id; learn->fin_idle_timeout = ntohs(nal->fin_idle_timeout); learn->fin_hard_timeout = ntohs(nal->fin_hard_timeout); learn->flags = ntohs(nal->flags); if (learn->flags & ~(NX_LEARN_F_SEND_FLOW_REM | NX_LEARN_F_DELETE_LEARNED)) { return OFPERR_OFPBAC_BAD_ARGUMENT; } if (learn->table_id == 0xff) { return OFPERR_OFPBAC_BAD_ARGUMENT; } end = (char *) nal + ntohs(nal->len); for (p = nal + 1; p != end; ) { struct ofpact_learn_spec *spec; uint16_t header = ntohs(get_be16(&p)); if (!header) { break; } spec = ofpbuf_put_zeros(ofpacts, sizeof *spec); learn = ofpacts->header; spec->src_type = header & NX_LEARN_SRC_MASK; spec->dst_type = header & NX_LEARN_DST_MASK; spec->n_bits = header & NX_LEARN_N_BITS_MASK; /* Check for valid src and dst type combination. */ if (spec->dst_type == NX_LEARN_DST_MATCH || spec->dst_type == NX_LEARN_DST_LOAD || (spec->dst_type == NX_LEARN_DST_OUTPUT && spec->src_type == NX_LEARN_SRC_FIELD)) { /* OK. */ } else { return OFPERR_OFPBAC_BAD_ARGUMENT; } /* Check that the arguments don't overrun the end of the action. */ if ((char *) end - (char *) p < learn_min_len(header)) { return OFPERR_OFPBAC_BAD_LEN; } /* Get the source. */ const uint8_t *imm = NULL; unsigned int imm_bytes = 0; enum ofperr error; if (spec->src_type == NX_LEARN_SRC_FIELD) { error = get_subfield(spec->n_bits, &p, &spec->src, vl_mff_map, tlv_bitmap); if (error) { return error; } } else { int p_bytes = 2 * DIV_ROUND_UP(spec->n_bits, 16); p = (const uint8_t *) p + p_bytes; imm_bytes = DIV_ROUND_UP(spec->n_bits, 8); imm = (const uint8_t *) p - imm_bytes; } /* Get the destination. */ if (spec->dst_type == NX_LEARN_DST_MATCH || spec->dst_type == NX_LEARN_DST_LOAD) { error = get_subfield(spec->n_bits, &p, &spec->dst, vl_mff_map, tlv_bitmap); if (error) { return error; } } if (imm) { uint8_t *src_imm = ofpbuf_put_zeros(ofpacts, OFPACT_ALIGN(imm_bytes)); memcpy(src_imm, imm, imm_bytes); learn = ofpacts->header; } } ofpact_finish_LEARN(ofpacts, &learn); if (!is_all_zeros(p, (char *) end - (char *) p)) { return OFPERR_OFPBAC_BAD_ARGUMENT; } return 0; } ",0 "static int pix_abs16_y2_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) { int s, i; uint8_t *pix3 = pix2 + line_size; s = 0; for(i=0;iphdr_symbols) { return bin->phdr_symbols; } bin->phdr_symbols = get_symbols_from_phdr (bin, R_BIN_ELF_SYMBOLS); return bin->phdr_symbols; } ",0 "error::Error GLES2DecoderPassthroughImpl::DoTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLsizei image_size, const void* pixels) { ScopedUnpackStateButAlignmentReset reset_unpack( api(), image_size != 0 && feature_info_->gl_version_info().is_es3, false); CheckErrorCallbackState(); api()->glTexImage2DRobustANGLEFn(target, level, internalformat, width, height, border, format, type, image_size, pixels); if (CheckErrorCallbackState()) { return error::kNoError; } UpdateTextureSizeFromTarget(target); ExitCommandProcessingEarly(); return error::kNoError; } ",0 " FLAC__uint64 getTotalSamples() const { return mStreamInfo.total_samples; } ",0 "scoped_ptr PixelBufferRasterWorkerPool::StateAsValue() const { scoped_ptr state(new base::DictionaryValue); state->SetInteger(""completed_count"", completed_tasks_.size()); state->SetInteger(""pending_count"", pixel_buffer_tasks_.size()); state->SetInteger(""pending_upload_count"", tasks_with_pending_upload_.size()); state->SetInteger(""required_for_activation_count"", tasks_required_for_activation_.size()); state->Set(""scheduled_state"", ScheduledStateAsValue().release()); state->Set(""throttle_state"", ThrottleStateAsValue().release()); return state.PassAs(); } ",0 "void ExtensionPrefs::SetExtensionPrefPermissionSet( const std::string& extension_id, const std::string& pref_key, const ExtensionPermissionSet* new_value) { ListValue* api_values = new ListValue(); ExtensionAPIPermissionSet apis = new_value->apis(); ExtensionPermissionsInfo* info = ExtensionPermissionsInfo::GetInstance(); std::string api_pref = JoinPrefs(pref_key, kPrefAPIs); for (ExtensionAPIPermissionSet::const_iterator i = apis.begin(); i != apis.end(); ++i) { ExtensionAPIPermission* perm = info->GetByID(*i); if (perm) api_values->Append(Value::CreateStringValue(perm->name())); } UpdateExtensionPref(extension_id, api_pref, api_values); if (!new_value->explicit_hosts().is_empty()) { SetExtensionPrefURLPatternSet(extension_id, JoinPrefs(pref_key, kPrefExplicitHosts), new_value->explicit_hosts()); } if (!new_value->scriptable_hosts().is_empty()) { SetExtensionPrefURLPatternSet(extension_id, JoinPrefs(pref_key, kPrefScriptableHosts), new_value->scriptable_hosts()); } } ",0 "void NormalPageArena::takeFreelistSnapshot(const String& dumpName) { if (m_freeList.takeSnapshot(dumpName)) { base::trace_event::MemoryAllocatorDump* bucketsDump = BlinkGCMemoryDumpProvider::instance() ->createMemoryAllocatorDumpForCurrentGC(dumpName + ""/buckets""); base::trace_event::MemoryAllocatorDump* pagesDump = BlinkGCMemoryDumpProvider::instance() ->createMemoryAllocatorDumpForCurrentGC(dumpName + ""/pages""); BlinkGCMemoryDumpProvider::instance() ->currentProcessMemoryDump() ->AddOwnershipEdge(pagesDump->guid(), bucketsDump->guid()); } } ",0 "CustomDrag::~CustomDrag() { if (pixbuf_) g_object_unref(pixbuf_); g_object_unref(drag_widget_); } ",0 "void FindFormElements(content::RenderFrame* render_frame, const PasswordFormFillData& data, bool ambiguous_or_empty_names, FormElementsList* results) { DCHECK(results); blink::WebDocument doc = render_frame->GetWebFrame()->document(); if (!doc.isHTMLDocument()) return; if (data.origin != form_util::GetCanonicalOriginForDocument(doc)) return; blink::WebVector forms; doc.forms(forms); for (size_t i = 0; i < forms.size(); ++i) { blink::WebFormElement fe = forms[i]; if (data.action != form_util::GetCanonicalActionForForm(fe)) continue; std::vector control_elements = form_util::ExtractAutofillableElementsInForm(fe); FormInputElementMap cur_map; if (FindFormInputElements(control_elements, data, ambiguous_or_empty_names, &cur_map)) results->push_back(cur_map); } if (data.action != data.origin) return; std::vector control_elements = form_util::GetUnownedAutofillableFormFieldElements(doc.all(), nullptr); FormInputElementMap unowned_elements_map; if (FindFormInputElements(control_elements, data, ambiguous_or_empty_names, &unowned_elements_map)) results->push_back(unowned_elements_map); } ",0 "void HTMLFormControlElement::dispatchFormControlInputEvent() { setChangedSinceLastFormControlChangeEvent(true); HTMLElement::dispatchInputEvent(); } ",0 "static MagickBooleanType ReadRectangle(Image *image,PICTRectangle *rectangle) { rectangle->top=(short) ReadBlobMSBShort(image); rectangle->left=(short) ReadBlobMSBShort(image); rectangle->bottom=(short) ReadBlobMSBShort(image); rectangle->right=(short) ReadBlobMSBShort(image); if ((EOFBlob(image) != MagickFalse) || (rectangle->left > rectangle->right) || (rectangle->top > rectangle->bottom)) return(MagickFalse); return(MagickTrue); } ",0 "static int init_ehdr(ELFOBJ *bin) { ut8 e_ident[EI_NIDENT]; ut8 ehdr[sizeof (Elf_(Ehdr))] = {0}; int i, len; if (r_buf_read_at (bin->b, 0, e_ident, EI_NIDENT) == -1) { bprintf (""Warning: read (magic)\n""); return false; } sdb_set (bin->kv, ""elf_type.cparse"", ""enum elf_type { ET_NONE=0, ET_REL=1,"" "" ET_EXEC=2, ET_DYN=3, ET_CORE=4, ET_LOOS=0xfe00, ET_HIOS=0xfeff,"" "" ET_LOPROC=0xff00, ET_HIPROC=0xffff };"", 0); sdb_set (bin->kv, ""elf_machine.cparse"", ""enum elf_machine{EM_NONE=0, EM_M32=1,"" "" EM_SPARC=2, EM_386=3, EM_68K=4, EM_88K=5, EM_486=6, "" "" EM_860=7, EM_MIPS=8, EM_S370=9, EM_MIPS_RS3_LE=10, EM_RS6000=11,"" "" EM_UNKNOWN12=12, EM_UNKNOWN13=13, EM_UNKNOWN14=14, "" "" EM_PA_RISC=15, EM_PARISC=EM_PA_RISC, EM_nCUBE=16, EM_VPP500=17,"" "" EM_SPARC32PLUS=18, EM_960=19, EM_PPC=20, EM_PPC64=21, "" "" EM_S390=22, EM_UNKNOWN22=EM_S390, EM_UNKNOWN23=23, EM_UNKNOWN24=24,"" "" EM_UNKNOWN25=25, EM_UNKNOWN26=26, EM_UNKNOWN27=27, EM_UNKNOWN28=28,"" "" EM_UNKNOWN29=29, EM_UNKNOWN30=30, EM_UNKNOWN31=31, EM_UNKNOWN32=32,"" "" EM_UNKNOWN33=33, EM_UNKNOWN34=34, EM_UNKNOWN35=35, EM_V800=36,"" "" EM_FR20=37, EM_RH32=38, EM_RCE=39, EM_ARM=40, EM_ALPHA=41, EM_SH=42,"" "" EM_SPARCV9=43, EM_TRICORE=44, EM_ARC=45, EM_H8_300=46, EM_H8_300H=47,"" "" EM_H8S=48, EM_H8_500=49, EM_IA_64=50, EM_MIPS_X=51, EM_COLDFIRE=52,"" "" EM_68HC12=53, EM_MMA=54, EM_PCP=55, EM_NCPU=56, EM_NDR1=57,"" "" EM_STARCORE=58, EM_ME16=59, EM_ST100=60, EM_TINYJ=61, EM_AMD64=62,"" "" EM_X86_64=EM_AMD64, EM_PDSP=63, EM_UNKNOWN64=64, EM_UNKNOWN65=65,"" "" EM_FX66=66, EM_ST9PLUS=67, EM_ST7=68, EM_68HC16=69, EM_68HC11=70,"" "" EM_68HC08=71, EM_68HC05=72, EM_SVX=73, EM_ST19=74, EM_VAX=75, "" "" EM_CRIS=76, EM_JAVELIN=77, EM_FIREPATH=78, EM_ZSP=79, EM_MMIX=80,"" "" EM_HUANY=81, EM_PRISM=82, EM_AVR=83, EM_FR30=84, EM_D10V=85, EM_D30V=86,"" "" EM_V850=87, EM_M32R=88, EM_MN10300=89, EM_MN10200=90, EM_PJ=91,"" "" EM_OPENRISC=92, EM_ARC_A5=93, EM_XTENSA=94, EM_NUM=95};"", 0); sdb_num_set (bin->kv, ""elf_header.offset"", 0, 0); sdb_num_set (bin->kv, ""elf_header.size"", sizeof (Elf_(Ehdr)), 0); #if R_BIN_ELF64 sdb_set (bin->kv, ""elf_header.format"", ""[16]z[2]E[2]Exqqqxwwwwww"" "" ident (elf_type)type (elf_machine)machine version entry phoff shoff flags ehsize"" "" phentsize phnum shentsize shnum shstrndx"", 0); #else sdb_set (bin->kv, ""elf_header.format"", ""[16]z[2]E[2]Exxxxxwwwwww"" "" ident (elf_type)type (elf_machine)machine version entry phoff shoff flags ehsize"" "" phentsize phnum shentsize shnum shstrndx"", 0); #endif bin->endian = (e_ident[EI_DATA] == ELFDATA2MSB)? 1: 0; memset (&bin->ehdr, 0, sizeof (Elf_(Ehdr))); len = r_buf_read_at (bin->b, 0, ehdr, sizeof (Elf_(Ehdr))); if (len < 1) { bprintf (""Warning: read (ehdr)\n""); return false; } memcpy (&bin->ehdr.e_ident, ehdr, 16); i = 16; bin->ehdr.e_type = READ16 (ehdr, i) bin->ehdr.e_machine = READ16 (ehdr, i) bin->ehdr.e_version = READ32 (ehdr, i) #if R_BIN_ELF64 bin->ehdr.e_entry = READ64 (ehdr, i) bin->ehdr.e_phoff = READ64 (ehdr, i) bin->ehdr.e_shoff = READ64 (ehdr, i) #else bin->ehdr.e_entry = READ32 (ehdr, i) bin->ehdr.e_phoff = READ32 (ehdr, i) bin->ehdr.e_shoff = READ32 (ehdr, i) #endif bin->ehdr.e_flags = READ32 (ehdr, i) bin->ehdr.e_ehsize = READ16 (ehdr, i) bin->ehdr.e_phentsize = READ16 (ehdr, i) bin->ehdr.e_phnum = READ16 (ehdr, i) bin->ehdr.e_shentsize = READ16 (ehdr, i) bin->ehdr.e_shnum = READ16 (ehdr, i) bin->ehdr.e_shstrndx = READ16 (ehdr, i) return handle_e_ident (bin); } ",0 "void bat_socket_receive_packet(struct icmp_packet_rr *icmp_packet, size_t icmp_len) { struct socket_client *hash = socket_client_hash[icmp_packet->uid]; if (hash) bat_socket_add_packet(hash, icmp_packet, icmp_len); } ",0 "void set_mm_exe_file(struct mm_struct *mm, struct file *new_exe_file) { if (new_exe_file) get_file(new_exe_file); if (mm->exe_file) fput(mm->exe_file); mm->exe_file = new_exe_file; } ",0 "static struct discard_cmd *__insert_discard_tree(struct f2fs_sb_info *sbi, struct block_device *bdev, block_t lstart, block_t start, block_t len, struct rb_node **insert_p, struct rb_node *insert_parent) { struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; struct rb_node **p = &dcc->root.rb_node; struct rb_node *parent = NULL; struct discard_cmd *dc = NULL; if (insert_p && insert_parent) { parent = insert_parent; p = insert_p; goto do_insert; } p = __lookup_rb_tree_for_insert(sbi, &dcc->root, &parent, lstart); do_insert: dc = __attach_discard_cmd(sbi, bdev, lstart, start, len, parent, p); if (!dc) return NULL; return dc; } ",0 "void skip_blanks(char **p) { while (**p == ' ') (*p)++; } ",0 "void RecordDownloadContentDisposition( const std::string& content_disposition_string) { if (content_disposition_string.empty()) return; net::HttpContentDisposition content_disposition(content_disposition_string, std::string()); int result = content_disposition.parse_result_flags(); bool is_valid = !content_disposition.filename().empty(); RecordContentDispositionCount(CONTENT_DISPOSITION_HEADER_PRESENT, true); RecordContentDispositionCount(CONTENT_DISPOSITION_IS_VALID, is_valid); if (!is_valid) return; RecordContentDispositionCountFlag( CONTENT_DISPOSITION_HAS_DISPOSITION_TYPE, result, net::HttpContentDisposition::HAS_DISPOSITION_TYPE); RecordContentDispositionCountFlag( CONTENT_DISPOSITION_HAS_UNKNOWN_TYPE, result, net::HttpContentDisposition::HAS_UNKNOWN_DISPOSITION_TYPE); RecordContentDispositionCountFlag(CONTENT_DISPOSITION_HAS_FILENAME, result, net::HttpContentDisposition::HAS_FILENAME); RecordContentDispositionCountFlag( CONTENT_DISPOSITION_HAS_EXT_FILENAME, result, net::HttpContentDisposition::HAS_EXT_FILENAME); RecordContentDispositionCountFlag( CONTENT_DISPOSITION_HAS_NON_ASCII_STRINGS, result, net::HttpContentDisposition::HAS_NON_ASCII_STRINGS); RecordContentDispositionCountFlag( CONTENT_DISPOSITION_HAS_PERCENT_ENCODED_STRINGS, result, net::HttpContentDisposition::HAS_PERCENT_ENCODED_STRINGS); RecordContentDispositionCountFlag( CONTENT_DISPOSITION_HAS_RFC2047_ENCODED_STRINGS, result, net::HttpContentDisposition::HAS_RFC2047_ENCODED_STRINGS); RecordContentDispositionCountFlag( CONTENT_DISPOSITION_HAS_SINGLE_QUOTED_FILENAME, result, net::HttpContentDisposition::HAS_SINGLE_QUOTED_FILENAME); } ",0 "void OfflinePageModelImpl::DeleteOrphanedArchives( const std::set& archive_paths) { std::set orphaned_archive_set(archive_paths); for (const auto& id_page_pair : offline_pages_) orphaned_archive_set.erase(id_page_pair.second.file_path); if (orphaned_archive_set.empty()) return; std::vector orphaned_archives(orphaned_archive_set.begin(), orphaned_archive_set.end()); archive_manager_->DeleteMultipleArchives( orphaned_archives, base::Bind(&OfflinePageModelImpl::OnDeleteOrphanedArchivesDone, weak_ptr_factory_.GetWeakPtr(), orphaned_archives)); } ",0 "uint32_t GetLiveVars(PP_Var live_vars[], uint32_t array_size) { std::vector vars = PpapiGlobals::Get()->GetVarTracker()->GetLiveVars(); for (size_t i = 0u; i < std::min(static_cast(array_size), vars.size()); ++i) live_vars[i] = vars[i]; return vars.size(); } ",0 "static void png_flush_data(png_structp png_ptr) { (void) png_ptr; } ",0 "XML_SetCommentHandler(XML_Parser parser, XML_CommentHandler handler) { if (parser != NULL) parser->m_commentHandler = handler; } ",0 "cmsBool Type_ProfileSequenceId_Write(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, void* Ptr, cmsUInt32Number nItems) { cmsSEQ* Seq = (cmsSEQ*) Ptr; cmsUInt32Number BaseOffset; BaseOffset = io ->Tell(io) - sizeof(_cmsTagBase); if (!_cmsWriteUInt32Number(io, Seq ->n)) return FALSE; if (!WritePositionTable(self, io, 0, Seq ->n, BaseOffset, Seq, WriteSeqID)) return FALSE; return TRUE; cmsUNUSED_PARAMETER(nItems); } ",0 "void ChromeClientImpl::ClearCompositedSelection(LocalFrame* frame) { LocalFrame& local_root = frame->LocalFrameRoot(); WebFrameWidgetBase* widget = WebLocalFrameImpl::FromFrame(&local_root)->FrameWidget(); WebWidgetClient* client = widget->Client(); if (!client) return; if (WebLayerTreeView* layer_tree_view = widget->GetLayerTreeView()) layer_tree_view->ClearSelection(); } ",0 "error::Error GLES2DecoderImpl::HandleTexImage2DImmediate( uint32 immediate_data_size, const gles2::TexImage2DImmediate& c) { GLenum target = static_cast(c.target); GLint level = static_cast(c.level); GLint internal_format = static_cast(c.internalformat); GLsizei width = static_cast(c.width); GLsizei height = static_cast(c.height); GLint border = static_cast(c.border); GLenum format = static_cast(c.format); GLenum type = static_cast(c.type); uint32 size; if (!GLES2Util::ComputeImageDataSize( width, height, format, type, unpack_alignment_, &size)) { return error::kOutOfBounds; } const void* pixels = GetImmediateDataAs( c, size, immediate_data_size); if (!pixels) { return error::kOutOfBounds; } DoTexImage2D( target, level, internal_format, width, height, border, format, type, pixels, size); return error::kNoError; } ",0 "static int __net_init ip4_frags_ns_ctl_register(struct net *net) { struct ctl_table *table; struct ctl_table_header *hdr; table = ip4_frags_ns_ctl_table; if (!net_eq(net, &init_net)) { table = kmemdup(table, sizeof(ip4_frags_ns_ctl_table), GFP_KERNEL); if (table == NULL) goto err_alloc; table[0].data = &net->ipv4.frags.high_thresh; table[1].data = &net->ipv4.frags.low_thresh; table[2].data = &net->ipv4.frags.timeout; } hdr = register_net_sysctl_table(net, net_ipv4_ctl_path, table); if (hdr == NULL) goto err_reg; net->ipv4.frags_hdr = hdr; return 0; err_reg: if (!net_eq(net, &init_net)) kfree(table); err_alloc: return -ENOMEM; } ",0 "BOOLEAN btif_hl_find_mcl_idx_using_handle( tBTA_HL_MCL_HANDLE mcl_handle, UINT8 *p_app_idx, UINT8 *p_mcl_idx){ btif_hl_app_cb_t *p_acb; BOOLEAN found=FALSE; UINT8 i,j; for (i=0; imcb[j].in_use) BTIF_TRACE_DEBUG(""btif_hl_find_mcl_idx_using_handle:app_idx=%d,"" ""mcl_idx =%d mcl_handle=%d"",i,j,p_acb->mcb[j].mcl_handle); if (p_acb->mcb[j].in_use && (p_acb->mcb[j].mcl_handle == mcl_handle)) { found = TRUE; *p_app_idx = i; *p_mcl_idx = j; break; } } } BTIF_TRACE_DEBUG(""%s found=%d app_idx=%d mcl_idx=%d"",__FUNCTION__, found, i, j); return found; } ",0 "void AutoFillManager::set_metric_logger( const AutoFillMetrics* metric_logger) { metric_logger_.reset(metric_logger); } ",0 " void SendCtrlKey(ui::KeyboardCode key) { ui::test::EventGenerator event_generator(Shell::GetPrimaryRootWindow()); event_generator.PressKey(ui::VKEY_CONTROL, ui::EF_CONTROL_DOWN); event_generator.PressKey(key, ui::EF_CONTROL_DOWN); event_generator.ReleaseKey(key, ui::EF_CONTROL_DOWN); event_generator.ReleaseKey(ui::VKEY_CONTROL, ui::EF_NONE); } ",0 "bool RenderFrameDevToolsAgentHost::AttachSession(DevToolsSession* session) { if (!ShouldAllowSession(session)) return false; protocol::EmulationHandler* emulation_handler = new protocol::EmulationHandler(); session->AddHandler(base::WrapUnique(new protocol::BrowserHandler())); session->AddHandler(base::WrapUnique(new protocol::DOMHandler())); session->AddHandler(base::WrapUnique(emulation_handler)); session->AddHandler(base::WrapUnique(new protocol::InputHandler())); session->AddHandler(base::WrapUnique(new protocol::InspectorHandler())); session->AddHandler(base::WrapUnique(new protocol::IOHandler( GetIOContext()))); session->AddHandler(base::WrapUnique(new protocol::MemoryHandler())); session->AddHandler(base::WrapUnique(new protocol::NetworkHandler( GetId(), frame_tree_node_ ? frame_tree_node_->devtools_frame_token() : base::UnguessableToken(), GetIOContext()))); session->AddHandler(base::WrapUnique(new protocol::SchemaHandler())); session->AddHandler(base::WrapUnique(new protocol::ServiceWorkerHandler())); session->AddHandler(base::WrapUnique(new protocol::StorageHandler())); session->AddHandler(base::WrapUnique(new protocol::TargetHandler( session->client()->MayAttachToBrowser() ? protocol::TargetHandler::AccessMode::kRegular : protocol::TargetHandler::AccessMode::kAutoAttachOnly, GetId(), GetRendererChannel(), session->GetRootSession()))); session->AddHandler(base::WrapUnique(new protocol::PageHandler( emulation_handler, session->client()->MayAffectLocalFiles()))); session->AddHandler(base::WrapUnique(new protocol::SecurityHandler())); if (!frame_tree_node_ || !frame_tree_node_->parent()) { session->AddHandler(base::WrapUnique( new protocol::TracingHandler(frame_tree_node_, GetIOContext()))); } if (sessions().empty()) { bool use_video_capture_api = true; #ifdef OS_ANDROID if (!CompositorImpl::IsInitialized()) use_video_capture_api = false; #endif if (!use_video_capture_api) frame_trace_recorder_.reset(new DevToolsFrameTraceRecorder()); GrantPolicy(); #if defined(OS_ANDROID) GetWakeLock()->RequestWakeLock(); #endif } return true; } ",1 "fep_client_send_data (FepClient *client, const char *data, size_t length) { FepControlMessage message; message.command = FEP_CONTROL_SEND_DATA; _fep_control_message_alloc_args (&message, 1); _fep_control_message_write_string_arg (&message, 0, data, length); if (client->filter_running) client->messages = _fep_append_control_message (client->messages, &message); else _fep_write_control_message (client->control, &message); _fep_control_message_free_args (&message); } ",0 "static int fib6_dump_done(struct netlink_callback *cb) { fib6_dump_end(cb); return cb->done ? cb->done(cb) : 0; } ",0 "error::Error GLES2DecoderPassthroughImpl::DoIsVertexArrayOES(GLuint array, uint32_t* result) { *result = api()->glIsVertexArrayOESFn( GetVertexArrayServiceID(array, &vertex_array_id_map_)); return error::kNoError; } ",0 "void GLES2Implementation::ActiveTexture(GLenum texture) { GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG(""["" << GetLogPrefix() << ""] glActiveTexture("" << GLES2Util::GetStringEnum(texture) << "")""); GLuint texture_index = texture - GL_TEXTURE0; if (texture_index >= static_cast(capabilities_.max_combined_texture_image_units)) { SetGLErrorInvalidEnum(""glActiveTexture"", texture, ""texture""); return; } active_texture_unit_ = texture_index; helper_->ActiveTexture(texture); CheckGLError(); } ",0 "TestAddAppWindowObserver::TestAddAppWindowObserver( extensions::AppWindowRegistry* registry) : registry_(registry), window_(NULL) { registry_->AddObserver(this); } ",0 " DrawingBufferClientRestorePixelPackParameters() { if (!ContextGL()) return; ContextGL()->PixelStorei(GL_PACK_ALIGNMENT, pack_alignment_); } ",0 "int socket_create_unix(const char *filename) { struct sockaddr_un name; int sock; size_t size; #ifdef SO_NOSIGPIPE int yes = 1; #endif unlink(filename); /* Create the socket. */ sock = socket(PF_LOCAL, SOCK_STREAM, 0); if (sock < 0) { perror(""socket""); return -1; } #ifdef SO_NOSIGPIPE if (setsockopt(sock, SOL_SOCKET, SO_NOSIGPIPE, (void*)&yes, sizeof(int)) == -1) { perror(""setsockopt()""); socket_close(sock); return -1; } #endif /* Bind a name to the socket. */ name.sun_family = AF_LOCAL; strncpy(name.sun_path, filename, sizeof(name.sun_path)); name.sun_path[sizeof(name.sun_path) - 1] = '\0'; /* The size of the address is the offset of the start of the filename, plus its length, plus one for the terminating null byte. Alternatively you can just do: size = SUN_LEN (&name); */ size = (offsetof(struct sockaddr_un, sun_path) + strlen(name.sun_path) + 1); if (bind(sock, (struct sockaddr *) &name, size) < 0) { perror(""bind""); socket_close(sock); return -1; } if (listen(sock, 10) < 0) { perror(""listen""); socket_close(sock); return -1; } return sock; } ",0 "handle_assoc_response(netdissect_options *ndo, const u_char *p, u_int length) { struct mgmt_body_t pbody; int offset = 0; int ret; memset(&pbody, 0, sizeof(pbody)); if (!ND_TTEST2(*p, IEEE802_11_CAPINFO_LEN + IEEE802_11_STATUS_LEN + IEEE802_11_AID_LEN)) return 0; if (length < IEEE802_11_CAPINFO_LEN + IEEE802_11_STATUS_LEN + IEEE802_11_AID_LEN) return 0; pbody.capability_info = EXTRACT_LE_16BITS(p); offset += IEEE802_11_CAPINFO_LEN; length -= IEEE802_11_CAPINFO_LEN; pbody.status_code = EXTRACT_LE_16BITS(p+offset); offset += IEEE802_11_STATUS_LEN; length -= IEEE802_11_STATUS_LEN; pbody.aid = EXTRACT_LE_16BITS(p+offset); offset += IEEE802_11_AID_LEN; length -= IEEE802_11_AID_LEN; ret = parse_elements(ndo, &pbody, p, offset, length); ND_PRINT((ndo, "" AID(%x) :%s: %s"", ((uint16_t)(pbody.aid << 2 )) >> 2 , CAPABILITY_PRIVACY(pbody.capability_info) ? "" PRIVACY "" : """", (pbody.status_code < NUM_STATUSES ? status_text[pbody.status_code] : ""n/a""))); return ret; } ",0 "static void __net_exit ipgre_exit_net(struct net *net) { struct ipgre_net *ign; LIST_HEAD(list); ign = net_generic(net, ipgre_net_id); rtnl_lock(); ipgre_destroy_tunnels(ign, &list); unregister_netdevice_many(&list); rtnl_unlock(); } ",0 "void WorkerFetchContext::PopulateResourceRequest( Resource::Type type, const ClientHintsPreferences& hints_preferences, const FetchParameters::ResourceWidth& resource_width, ResourceRequest& out_request) { SetFirstPartyCookieAndRequestorOrigin(out_request); } ",0 "size_t ZSTD_estimateCStreamSize_usingCParams(ZSTD_compressionParameters cParams) { ZSTD_CCtx_params const params = ZSTD_makeCCtxParamsFromCParams(cParams); return ZSTD_estimateCStreamSize_usingCCtxParams(¶ms); } ",0 "XineramaXvPutImage(ClientPtr client) { REQUEST(xvPutImageReq); PanoramiXRes *draw, *gc, *port; Bool isRoot; int result, i, x, y; REQUEST_AT_LEAST_SIZE(xvPutImageReq); result = dixLookupResourceByClass((void **) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); if (result != Success) return (result == BadValue) ? BadDrawable : result; result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) return result; result = dixLookupResourceByType((void **) &port, stuff->port, XvXRTPort, client, DixReadAccess); if (result != Success) return result; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; x = stuff->drw_x; y = stuff->drw_y; FOR_NSCREENS_BACKWARD(i) { if (port->info[i].id) { stuff->drawable = draw->info[i].id; stuff->port = port->info[i].id; stuff->gc = gc->info[i].id; stuff->drw_x = x; stuff->drw_y = y; if (isRoot) { stuff->drw_x -= screenInfo.screens[i]->x; stuff->drw_y -= screenInfo.screens[i]->y; } result = ProcXvPutImage(client); } } return result; } ",0 " void testNoFallbackWithClear() { m_testSurface->initializeCurrentFrame(); m_testSurface->willOverwriteCanvas(); m_testSurface->getPicture(); EXPECT_EQ(1, m_fakeImageBufferClient->frameCount()); expectDisplayListEnabled(true); } ",0 "char* Elf_(r_bin_elf_get_file_type)(ELFOBJ *bin) { ut32 e_type; if (!bin) { return NULL; } e_type = (ut32)bin->ehdr.e_type; // cast to avoid warn in iphone-gcc, must be ut16 switch (e_type) { case ET_NONE: return strdup (""NONE (None)""); case ET_REL: return strdup (""REL (Relocatable file)""); case ET_EXEC: return strdup (""EXEC (Executable file)""); case ET_DYN: return strdup (""DYN (Shared object file)""); case ET_CORE: return strdup (""CORE (Core file)""); } if ((e_type >= ET_LOPROC) && (e_type <= ET_HIPROC)) { return r_str_newf (""Processor Specific: %x"", e_type); } if ((e_type >= ET_LOOS) && (e_type <= ET_HIOS)) { return r_str_newf (""OS Specific: %x"", e_type); } return r_str_newf ("": %x"", e_type); } ",0 " void DOMStorageContextWrapper::Flush() { DCHECK(context_.get()); context_->task_runner()->PostShutdownBlockingTask( FROM_HERE, DOMStorageTaskRunner::PRIMARY_SEQUENCE, base::BindOnce(&DOMStorageContextImpl::Flush, context_)); mojo_task_runner_->PostTask(FROM_HERE, base::BindOnce(&LocalStorageContextMojo::Flush, base::Unretained(mojo_state_))); if (mojo_session_state_) { mojo_task_runner_->PostTask( FROM_HERE, base::BindOnce(&SessionStorageContextMojo::Flush, base::Unretained(mojo_session_state_))); } } ",0 "static Image *ReadJNGImage(const ImageInfo *image_info,ExceptionInfo *exception) { Image *image; MagickBooleanType logging, status; MngInfo *mng_info; char magic_number[MaxTextExtent]; size_t count; /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickCoreSignature); (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"",image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); logging=LogMagickEvent(CoderEvent,GetMagickModule(),""Enter ReadJNGImage()""); image=AcquireImage(image_info); mng_info=(MngInfo *) NULL; status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) return((Image *) NULL); if (LocaleCompare(image_info->magick,""JNG"") != 0) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); /* Verify JNG signature. */ count=(size_t) ReadBlob(image,8,(unsigned char *) magic_number); if (count < 8 || memcmp(magic_number,""\213JNG\r\n\032\n"",8) != 0) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); /* Verify that file size large enough to contain a JNG datastream. */ if (GetBlobSize(image) < 147) ThrowReaderException(CorruptImageError,""InsufficientImageDataInFile""); /* Allocate a MngInfo structure. */ mng_info=(MngInfo *) AcquireMagickMemory(sizeof(*mng_info)); if (mng_info == (MngInfo *) NULL) ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); /* Initialize members of the MngInfo structure. */ (void) memset(mng_info,0,sizeof(MngInfo)); mng_info->image=image; image=ReadOneJNGImage(mng_info,image_info,exception); mng_info=MngInfoFreeStruct(mng_info); if (image == (Image *) NULL) { if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""exit ReadJNGImage() with error""); return((Image *) NULL); } (void) CloseBlob(image); if (image->columns == 0 || image->rows == 0) { if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""exit ReadJNGImage() with error""); ThrowReaderException(CorruptImageError,""CorruptImage""); } if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(),""exit ReadJNGImage()""); return(image); } ",0 "static unsigned int btrfs_flags_to_ioctl(unsigned int flags) { unsigned int iflags = 0; if (flags & BTRFS_INODE_SYNC) iflags |= FS_SYNC_FL; if (flags & BTRFS_INODE_IMMUTABLE) iflags |= FS_IMMUTABLE_FL; if (flags & BTRFS_INODE_APPEND) iflags |= FS_APPEND_FL; if (flags & BTRFS_INODE_NODUMP) iflags |= FS_NODUMP_FL; if (flags & BTRFS_INODE_NOATIME) iflags |= FS_NOATIME_FL; if (flags & BTRFS_INODE_DIRSYNC) iflags |= FS_DIRSYNC_FL; if (flags & BTRFS_INODE_NODATACOW) iflags |= FS_NOCOW_FL; if ((flags & BTRFS_INODE_COMPRESS) && !(flags & BTRFS_INODE_NOCOMPRESS)) iflags |= FS_COMPR_FL; else if (flags & BTRFS_INODE_NOCOMPRESS) iflags |= FS_NOCOMP_FL; return iflags; } ",0 "static int replace_map_fd_with_map_ptr(struct verifier_env *env) { struct bpf_insn *insn = env->prog->insnsi; int insn_cnt = env->prog->len; int i, j; for (i = 0; i < insn_cnt; i++, insn++) { if (BPF_CLASS(insn->code) == BPF_LDX && (BPF_MODE(insn->code) != BPF_MEM || insn->imm != 0)) { verbose(""BPF_LDX uses reserved fields\n""); return -EINVAL; } if (BPF_CLASS(insn->code) == BPF_STX && ((BPF_MODE(insn->code) != BPF_MEM && BPF_MODE(insn->code) != BPF_XADD) || insn->imm != 0)) { verbose(""BPF_STX uses reserved fields\n""); return -EINVAL; } if (insn[0].code == (BPF_LD | BPF_IMM | BPF_DW)) { struct bpf_map *map; struct fd f; if (i == insn_cnt - 1 || insn[1].code != 0 || insn[1].dst_reg != 0 || insn[1].src_reg != 0 || insn[1].off != 0) { verbose(""invalid bpf_ld_imm64 insn\n""); return -EINVAL; } if (insn->src_reg == 0) /* valid generic load 64-bit imm */ goto next_insn; if (insn->src_reg != BPF_PSEUDO_MAP_FD) { verbose(""unrecognized bpf_ld_imm64 insn\n""); return -EINVAL; } f = fdget(insn->imm); map = __bpf_map_get(f); if (IS_ERR(map)) { verbose(""fd %d is not pointing to valid bpf_map\n"", insn->imm); fdput(f); return PTR_ERR(map); } /* store map pointer inside BPF_LD_IMM64 instruction */ insn[0].imm = (u32) (unsigned long) map; insn[1].imm = ((u64) (unsigned long) map) >> 32; /* check whether we recorded this map already */ for (j = 0; j < env->used_map_cnt; j++) if (env->used_maps[j] == map) { fdput(f); goto next_insn; } if (env->used_map_cnt >= MAX_USED_MAPS) { fdput(f); return -E2BIG; } /* remember this map */ env->used_maps[env->used_map_cnt++] = map; /* hold the map. If the program is rejected by verifier, * the map will be released by release_maps() or it * will be used by the valid program until it's unloaded * and all maps are released in free_bpf_prog_info() */ bpf_map_inc(map, false); fdput(f); next_insn: insn++; i++; } } /* now all pseudo BPF_LD_IMM64 instructions load valid * 'struct bpf_map *' into a register instead of user map_fd. * These pointers will be used later by verifier to validate map access. */ return 0; } ",1 "void RenderFrameImpl::SetMouseCapture(bool capture) { GetLocalRootRenderWidget()->SetMouseCapture(capture); } ",0 "start_keepalived(void) { bool have_child = false; #ifdef _WITH_BFD_ /* must be opened before vrrp and bfd start */ open_bfd_pipes(); #endif #ifdef _WITH_LVS_ /* start healthchecker child */ if (running_checker()) { start_check_child(); have_child = true; } #endif #ifdef _WITH_VRRP_ /* start vrrp child */ if (running_vrrp()) { start_vrrp_child(); have_child = true; } #endif #ifdef _WITH_BFD_ /* start bfd child */ if (running_bfd()) { start_bfd_child(); have_child = true; } #endif return have_child; } ",0 "MagickExport Image *CropImage(const Image *image,const RectangleInfo *geometry, ExceptionInfo *exception) { #define CropImageTag ""Crop/Image"" CacheView *crop_view, *image_view; Image *crop_image; MagickBooleanType status; MagickOffsetType progress; OffsetInfo offset; RectangleInfo bounding_box, page; ssize_t y; /* Check crop geometry. */ assert(image != (const Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"",image->filename); assert(geometry != (const RectangleInfo *) NULL); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); bounding_box=image->page; if ((bounding_box.width == 0) || (bounding_box.height == 0)) { bounding_box.width=image->columns; bounding_box.height=image->rows; } page=(*geometry); if (page.width == 0) page.width=bounding_box.width; if (page.height == 0) page.height=bounding_box.height; if (((bounding_box.x-page.x) >= (ssize_t) page.width) || ((bounding_box.y-page.y) >= (ssize_t) page.height) || ((page.x-bounding_box.x) > (ssize_t) image->columns) || ((page.y-bounding_box.y) > (ssize_t) image->rows)) { /* Crop is not within virtual canvas, return 1 pixel transparent image. */ (void) ThrowMagickException(exception,GetMagickModule(),OptionWarning, ""GeometryDoesNotContainImage"",""`%s'"",image->filename); crop_image=CloneImage(image,1,1,MagickTrue,exception); if (crop_image == (Image *) NULL) return((Image *) NULL); crop_image->background_color.alpha=(Quantum) TransparentAlpha; crop_image->alpha_trait=BlendPixelTrait; (void) SetImageBackgroundColor(crop_image,exception); crop_image->page=bounding_box; crop_image->page.x=(-1); crop_image->page.y=(-1); if (crop_image->dispose == BackgroundDispose) crop_image->dispose=NoneDispose; return(crop_image); } if ((page.x < 0) && (bounding_box.x >= 0)) { page.width+=page.x-bounding_box.x; page.x=0; } else { page.width-=bounding_box.x-page.x; page.x-=bounding_box.x; if (page.x < 0) page.x=0; } if ((page.y < 0) && (bounding_box.y >= 0)) { page.height+=page.y-bounding_box.y; page.y=0; } else { page.height-=bounding_box.y-page.y; page.y-=bounding_box.y; if (page.y < 0) page.y=0; } if ((page.x+(ssize_t) page.width) > (ssize_t) image->columns) page.width=image->columns-page.x; if ((geometry->width != 0) && (page.width > geometry->width)) page.width=geometry->width; if ((page.y+(ssize_t) page.height) > (ssize_t) image->rows) page.height=image->rows-page.y; if ((geometry->height != 0) && (page.height > geometry->height)) page.height=geometry->height; bounding_box.x+=page.x; bounding_box.y+=page.y; if ((page.width == 0) || (page.height == 0)) { (void) ThrowMagickException(exception,GetMagickModule(),OptionWarning, ""GeometryDoesNotContainImage"",""`%s'"",image->filename); return((Image *) NULL); } /* Initialize crop image attributes. */ crop_image=CloneImage(image,page.width,page.height,MagickTrue,exception); if (crop_image == (Image *) NULL) return((Image *) NULL); crop_image->page.width=image->page.width; crop_image->page.height=image->page.height; offset.x=(ssize_t) (bounding_box.x+bounding_box.width); offset.y=(ssize_t) (bounding_box.y+bounding_box.height); if ((offset.x > (ssize_t) image->page.width) || (offset.y > (ssize_t) image->page.height)) { crop_image->page.width=bounding_box.width; crop_image->page.height=bounding_box.height; } crop_image->page.x=bounding_box.x; crop_image->page.y=bounding_box.y; /* Crop image. */ status=MagickTrue; progress=0; image_view=AcquireVirtualCacheView(image,exception); crop_view=AcquireAuthenticCacheView(crop_image,exception); #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static,4) shared(status) \ magick_threads(image,crop_image,1,1) #endif for (y=0; y < (ssize_t) crop_image->rows; y++) { register const Quantum *restrict p; register Quantum *restrict q; register ssize_t x; if (status == MagickFalse) continue; p=GetCacheViewVirtualPixels(image_view,page.x,page.y+y,crop_image->columns, 1,exception); q=QueueCacheViewAuthenticPixels(crop_view,0,y,crop_image->columns,1, exception); if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL)) { status=MagickFalse; continue; } for (x=0; x < (ssize_t) crop_image->columns; x++) { register ssize_t i; if (GetPixelReadMask(image,p) == 0) { SetPixelBackgoundColor(crop_image,q); p+=GetPixelChannels(image); q+=GetPixelChannels(crop_image); continue; } for (i=0; i < (ssize_t) GetPixelChannels(image); i++) { PixelChannel channel=GetPixelChannelChannel(image,i); PixelTrait traits=GetPixelChannelTraits(image,channel); PixelTrait crop_traits=GetPixelChannelTraits(crop_image,channel); if ((traits == UndefinedPixelTrait) || (crop_traits == UndefinedPixelTrait)) continue; SetPixelChannel(crop_image,channel,p[i],q); } p+=GetPixelChannels(image); q+=GetPixelChannels(crop_image); } if (SyncCacheViewAuthenticPixels(crop_view,exception) == MagickFalse) status=MagickFalse; if (image->progress_monitor != (MagickProgressMonitor) NULL) { MagickBooleanType proceed; #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp critical (MagickCore_CropImage) #endif proceed=SetImageProgress(image,CropImageTag,progress++,image->rows); if (proceed == MagickFalse) status=MagickFalse; } } crop_view=DestroyCacheView(crop_view); image_view=DestroyCacheView(image_view); crop_image->type=image->type; if (status == MagickFalse) crop_image=DestroyImage(crop_image); return(crop_image); } ",0 " void BaseAudioContext::ContextDestroyed(ExecutionContext*) { destination()->GetAudioDestinationHandler().ContextDestroyed(); Uninitialize(); } ",0 "static void reflectLongAttributeAttributeSetterCallback(v8::Local, v8::Local jsValue, const v8::PropertyCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMSetter""); CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; TestObjectPythonV8Internal::reflectLongAttributeAttributeSetter(jsValue, info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "static int netif_alloc_rx_queues(struct net_device *dev) { unsigned int i, count = dev->num_rx_queues; struct netdev_rx_queue *rx; size_t sz = count * sizeof(*rx); BUG_ON(count < 1); rx = kzalloc(sz, GFP_KERNEL | __GFP_NOWARN | __GFP_REPEAT); if (!rx) { rx = vzalloc(sz); if (!rx) return -ENOMEM; } dev->_rx = rx; for (i = 0; i < count; i++) rx[i].dev = dev; return 0; } ",0 "void b58tobin(unsigned char *b58bin, const char *b58) { uint32_t c, bin32[7]; int len, i, j; uint64_t t; memset(bin32, 0, 7 * sizeof(uint32_t)); len = strlen(b58); for (i = 0; i < len; i++) { c = b58[i]; c = b58tobin_tbl[c]; for (j = 6; j >= 0; j--) { t = ((uint64_t)bin32[j]) * 58 + c; c = (t & 0x3f00000000ull) >> 32; bin32[j] = t & 0xffffffffull; } } *(b58bin++) = bin32[0] & 0xff; for (i = 1; i < 7; i++) { *((uint32_t *)b58bin) = htobe32(bin32[i]); b58bin += sizeof(uint32_t); } } ",0 "static void get_keyword(struct token *t) { int i; for (i = 0; keywords[i].val; i++) { if (!strcmp(t->val, keywords[i].val)) { t->type = keywords[i].type; break; } } } ",0 "HeadlessDevToolsManagerDelegate::DisposeBrowserContext( content::DevToolsAgentHost* agent_host, int session_id, int command_id, const base::DictionaryValue* params) { std::string browser_context_id; if (!params || !params->GetString(""browserContextId"", &browser_context_id)) return CreateInvalidParamResponse(command_id, ""browserContextId""); HeadlessBrowserContext* context = browser_->GetBrowserContextForId(browser_context_id); bool success = false; if (context && context != browser_->GetDefaultBrowserContext() && context->GetAllWebContents().empty()) { success = true; context->Close(); } std::unique_ptr result( target::DisposeBrowserContextResult::Builder() .SetSuccess(success) .Build() ->Serialize()); return CreateSuccessResponse(command_id, std::move(result)); } ",0 "Range* SelectionEditor::DocumentCachedRange() const { return cached_range_; } ",0 "static int read_uids_guids(long long *table_start) { int res, i; int bytes = SQUASHFS_ID_BYTES(sBlk.s.no_ids); int indexes = SQUASHFS_ID_BLOCKS(sBlk.s.no_ids); long long id_index_table[indexes]; TRACE(""read_uids_guids: no_ids %d\n"", sBlk.s.no_ids); id_table = malloc(bytes); if(id_table == NULL) { ERROR(""read_uids_guids: failed to allocate id table\n""); return FALSE; } res = read_fs_bytes(fd, sBlk.s.id_table_start, SQUASHFS_ID_BLOCK_BYTES(sBlk.s.no_ids), id_index_table); if(res == FALSE) { ERROR(""read_uids_guids: failed to read id index table\n""); return FALSE; } SQUASHFS_INSWAP_ID_BLOCKS(id_index_table, indexes); /* * id_index_table[0] stores the start of the compressed id blocks. * This by definition is also the end of the previous filesystem * table - this may be the exports table if it is present, or the * fragments table if it isn't. */ *table_start = id_index_table[0]; for(i = 0; i < indexes; i++) { int expected = (i + 1) != indexes ? SQUASHFS_METADATA_SIZE : bytes & (SQUASHFS_METADATA_SIZE - 1); res = read_block(fd, id_index_table[i], NULL, expected, ((char *) id_table) + i * SQUASHFS_METADATA_SIZE); if(res == FALSE) { ERROR(""read_uids_guids: failed to read id table block"" ""\n""); return FALSE; } } SQUASHFS_INSWAP_INTS(id_table, sBlk.s.no_ids); return TRUE; } ",1 "void Document::writeln(LocalDOMWindow* callingWindow, const Vector& text, ExceptionState& exceptionState) { DCHECK(callingWindow); StringBuilder builder; for (const String& string : text) builder.append(string); writeln(builder.toString(), callingWindow->document(), exceptionState); } ",0 "static void virgl_cmd_transfer_to_host_3d(VirtIOGPU *g, struct virtio_gpu_ctrl_command *cmd) { struct virtio_gpu_transfer_host_3d t3d; VIRTIO_GPU_FILL_CMD(t3d); trace_virtio_gpu_cmd_res_xfer_toh_3d(t3d.resource_id); virgl_renderer_transfer_write_iov(t3d.resource_id, t3d.hdr.ctx_id, t3d.level, t3d.stride, t3d.layer_stride, (struct virgl_box *)&t3d.box, t3d.offset, NULL, 0); } ",0 "void CrosLibrary::TestApi::SetUpdateLibrary( UpdateLibrary* library, bool own) { library_->update_lib_.SetImpl(library, own); } ",1 "void adjust_range_if_pmd_sharing_possible(struct vm_area_struct *vma, unsigned long *start, unsigned long *end) { unsigned long check_addr = *start; if (!(vma->vm_flags & VM_MAYSHARE)) return; for (check_addr = *start; check_addr < *end; check_addr += PUD_SIZE) { unsigned long a_start = check_addr & PUD_MASK; unsigned long a_end = a_start + PUD_SIZE; /* * If sharing is possible, adjust start/end if necessary. */ if (range_in_vma(vma, a_start, a_end)) { if (a_start < *start) *start = a_start; if (a_end > *end) *end = a_end; } } } ",0 "static int qeth_handle_send_error(struct qeth_card *card, struct qeth_qdio_out_buffer *buffer, unsigned int qdio_err) { int sbalf15 = buffer->buffer->element[15].sflags; QETH_CARD_TEXT(card, 6, ""hdsnderr""); if (card->info.type == QETH_CARD_TYPE_IQD) { if (sbalf15 == 0) { qdio_err = 0; } else { qdio_err = 1; } } qeth_check_qdio_errors(card, buffer->buffer, qdio_err, ""qouterr""); if (!qdio_err) return QETH_SEND_ERROR_NONE; if ((sbalf15 >= 15) && (sbalf15 <= 31)) return QETH_SEND_ERROR_RETRY; QETH_CARD_TEXT(card, 1, ""lnkfail""); QETH_CARD_TEXT_(card, 1, ""%04x %02x"", (u16)qdio_err, (u8)sbalf15); return QETH_SEND_ERROR_LINK_FAILURE; } ",0 "static int lxcfs_getattr(const char *path, struct stat *sb) { if (strcmp(path, ""/"") == 0) { sb->st_mode = S_IFDIR | 00755; sb->st_nlink = 2; return 0; } if (strncmp(path, ""/cgroup"", 7) == 0) { return cg_getattr(path, sb); } if (strncmp(path, ""/proc"", 5) == 0) { return proc_getattr(path, sb); } return -EINVAL; } ",0 "void Document::close() { if (!scriptableDocumentParser() || !scriptableDocumentParser()->wasCreatedByScript() || !scriptableDocumentParser()->isParsing()) return; explicitClose(); } ",0 "static void tun_disable_queue(struct tun_struct *tun, struct tun_file *tfile) { tfile->detached = tun; list_add_tail(&tfile->next, &tun->disabled); ++tun->numdisabled; } ",0 " static Handle ShiftImpl(Handle receiver) { UNREACHABLE(); return Handle(); } ",0 "void exit_creds(struct task_struct *tsk) { struct cred *cred; kdebug(""exit_creds(%u,%p,%p,{%d,%d})"", tsk->pid, tsk->real_cred, tsk->cred, atomic_read(&tsk->cred->usage), read_cred_subscribers(tsk->cred)); cred = (struct cred *) tsk->real_cred; tsk->real_cred = NULL; validate_creds(cred); alter_cred_subscribers(cred, -1); put_cred(cred); cred = (struct cred *) tsk->cred; tsk->cred = NULL; validate_creds(cred); alter_cred_subscribers(cred, -1); put_cred(cred); cred = (struct cred *) tsk->replacement_session_keyring; if (cred) { tsk->replacement_session_keyring = NULL; validate_creds(cred); put_cred(cred); } } ",0 "void ff_print_debug_info(MpegEncContext *s, Picture *p, AVFrame *pict) { ff_print_debug_info2(s->avctx, pict, s->mbskip_table, p->mb_type, p->qscale_table, p->motion_val, &s->low_delay, s->mb_width, s->mb_height, s->mb_stride, s->quarter_sample); } ",0 "static void uv__write_int(int fd, int val) { ssize_t n; do n = write(fd, &val, sizeof(val)); while (n == -1 && errno == EINTR); if (n == -1 && errno == EPIPE) return; /* parent process has quit */ assert(n == sizeof(val)); } ",0 "void BlinkTestRunner::Reload() { Send(new ShellViewHostMsg_Reload(routing_id())); } ",0 " virtual void notify( int msg, int ext1, int ext2, const Parcel *obj) { Parcel data, reply; data.writeInterfaceToken(IHDCPObserver::getInterfaceDescriptor()); data.writeInt32(msg); data.writeInt32(ext1); data.writeInt32(ext2); if (obj && obj->dataSize() > 0) { data.appendFrom(const_cast(obj), 0, obj->dataSize()); } remote()->transact(OBSERVER_NOTIFY, data, &reply, IBinder::FLAG_ONEWAY); } ",0 "JSObject* createRangeError(ExecState* exec, const UString& message) { return createRangeError(exec->lexicalGlobalObject(), message); } ",0 "static void XBZRLE_cache_lock(void) { if (migrate_use_xbzrle()) qemu_mutex_lock(&XBZRLE.lock); } ",0 "perf_mmap_to_page(struct ring_buffer *rb, unsigned long pgoff) { if (pgoff > (1UL << page_order(rb))) return NULL; return vmalloc_to_page((void *)rb->user_page + pgoff * PAGE_SIZE); } ",0 "void ServiceManagerConnectionImpl::OnConnectionLost() { if (!connection_lost_handler_.is_null()) connection_lost_handler_.Run(); } ",0 "void RenderWidgetHostViewAndroid::Focus() { host_->Focus(); host_->SetInputMethodActive(true); } ",0 "test_bson_append_oid (void) { bson_oid_t oid; bson_t *b; bson_t *b2; bson_oid_init_from_string (&oid, ""1234567890abcdef1234abcd""); b = bson_new (); BSON_ASSERT (bson_append_oid (b, ""oid"", -1, &oid)); b2 = get_bson (""test22.bson""); BSON_ASSERT_BSON_EQUAL (b, b2); bson_destroy (b); bson_destroy (b2); } ",0 "static void update_preds(struct prog_entry *prog, int N, int invert) { int t, s; t = prog[N].target; s = prog[t].target; prog[t].when_to_branch = invert; prog[t].target = N; prog[N].target = s; } ",0 " void callAndRemoveFirstCallback(XMLTokenizer* tokenizer) { OwnPtr callback(m_callbacks.first()); m_callbacks.removeFirst(); callback->call(tokenizer); } ",0 "static int msr_interception(struct vcpu_svm *svm) { if (svm->vmcb->control.exit_info_1) return wrmsr_interception(svm); else return rdmsr_interception(svm); } ",0 " void Create(const std::string& device_id, const url::Origin& security_origin, bool wait_for_auth, bool expect_onauthorized) { media::OutputDeviceStatus expected_device_status = device_id == kDefaultDeviceId || device_id == MediaStreamManager::GetHMACForMediaDeviceID( kSalt, url::Origin(GURL(kSecurityOrigin)), GetNondefaultIdExpectedToPassPermissionsCheck()) ? media::OUTPUT_DEVICE_STATUS_OK : device_id == kBadDeviceId ? media::OUTPUT_DEVICE_STATUS_ERROR_NOT_AUTHORIZED : media::OUTPUT_DEVICE_STATUS_ERROR_NOT_FOUND; if (expect_onauthorized) EXPECT_CALL(*host_.get(), OnDeviceAuthorized(kStreamId, expected_device_status, _, _)); if (expected_device_status == media::OUTPUT_DEVICE_STATUS_OK) { EXPECT_CALL(*host_.get(), WasNotifiedOfCreation(kStreamId, _)); EXPECT_CALL(mirroring_manager_, AddDiverter(render_process_host_.GetID(), kRenderFrameId, NotNull())) .RetiresOnSaturation(); } media::AudioParameters params( media::AudioParameters::AUDIO_FAKE, media::CHANNEL_LAYOUT_STEREO, media::AudioParameters::kAudioCDSampleRate, 16, media::AudioParameters::kAudioCDSampleRate / 10); int session_id = 0; host_->OnRequestDeviceAuthorization(kStreamId, kRenderFrameId, session_id, device_id, security_origin); if (wait_for_auth) auth_run_loop_.Run(); if (!wait_for_auth || expected_device_status == media::OUTPUT_DEVICE_STATUS_OK) host_->OnCreateStream(kStreamId, kRenderFrameId, params); if (expected_device_status == media::OUTPUT_DEVICE_STATUS_OK) EXPECT_CALL(mirroring_manager_, RemoveDiverter(NotNull())) .RetiresOnSaturation(); SyncWithAudioThread(); } ",0 "int i2d_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, PKCS8_PRIV_KEY_INFO *p8inf) { return ASN1_i2d_bio_of(PKCS8_PRIV_KEY_INFO,i2d_PKCS8_PRIV_KEY_INFO,bp, p8inf); } ",0 "void WebGLRenderingContextBase::uniform3iv(const WebGLUniformLocation* location, Vector& v) { if (isContextLost() || !ValidateUniformParameters(""uniform3iv"", location, v.data(), v.size(), 3, 0, v.size())) return; ContextGL()->Uniform3iv(location->Location(), v.size() / 3, v.data()); } ",0 "static int proxy_ioc_getversion(FsContext *fs_ctx, V9fsPath *path, mode_t st_mode, uint64_t *st_gen) { int err; /* Do not try to open special files like device nodes, fifos etc * we can get fd for regular files and directories only */ if (!S_ISREG(st_mode) && !S_ISDIR(st_mode)) { errno = ENOTTY; return -1; } err = v9fs_request(fs_ctx->private, T_GETVERSION, st_gen, path); if (err < 0) { errno = -err; err = -1; } return err; } ",0 "static char *get_http_header_value(char *headers, char *type) { char *pos, *tmp = NULL; int typelen, headerslen; typelen = strlen(type); headerslen = strlen(headers); /* header `titles' can be lower case, or any case combination, according * to the various RFC's. */ pos = headers; do { /* start of buffer or start of line */ if (strncasecmp(pos, type, typelen) == 0) { char *eol; /* match */ tmp = pos + typelen; eol = strchr(tmp, '\n'); if (eol == NULL) { eol = headers + headerslen; } else if (eol > tmp && *(eol-1) == '\r') { eol--; } return estrndup(tmp, eol - tmp); } /* find next line */ pos = strchr(pos, '\n'); if (pos) { pos++; } } while (pos); return NULL; } ",0 "void Clipboard::ReadBookmark(string16* title, std::string* url) const { NOTIMPLEMENTED(); } ",0 "fd_readline (int fdi, int fdo, char *b, int bsz) { int r; unsigned char c; unsigned char *bp, *bpe; bp = (unsigned char *)b; bpe = (unsigned char *)b + bsz - 1; while (1) { r = read(fdi, &c, 1); if ( r <= 0 ) { r = -1; goto out; } switch (c) { case '\b': case '\x7f': if ( bp > (unsigned char *)b ) { bp--; cput(fdo, '\b'); cput(fdo, ' '); cput(fdo, '\b'); } else { cput(fdo, '\x07'); } break; case '\x03': /* CTRL-c */ r = -1; errno = EINTR; goto out; case '\r': *bp = '\0'; r = bp - (unsigned char *)b; goto out; default: if ( bp < bpe ) { *bp++ = c; cput(fdo, c); } else { cput(fdo, '\x07'); } break; } } out: return r; } ",0 "void impeg2d_format_convert(dec_state_t *ps_dec, pic_buf_t *ps_src_pic, iv_yuv_buf_t *ps_disp_frm_buf, UWORD32 u4_start_row, UWORD32 u4_num_rows) { UWORD8 *pu1_src_y,*pu1_src_u,*pu1_src_v; UWORD8 *pu1_dst_y,*pu1_dst_u,*pu1_dst_v; if((NULL == ps_src_pic) || (NULL == ps_src_pic->pu1_y) || (0 == u4_num_rows)) return; pu1_src_y = ps_src_pic->pu1_y + (u4_start_row * ps_dec->u2_frame_width); pu1_src_u = ps_src_pic->pu1_u + ((u4_start_row >> 1) * (ps_dec->u2_frame_width >> 1)); pu1_src_v = ps_src_pic->pu1_v + ((u4_start_row >> 1) *(ps_dec->u2_frame_width >> 1)); pu1_dst_y = (UWORD8 *)ps_disp_frm_buf->pv_y_buf + (u4_start_row * ps_dec->u4_frm_buf_stride); pu1_dst_u = (UWORD8 *)ps_disp_frm_buf->pv_u_buf +((u4_start_row >> 1)*(ps_dec->u4_frm_buf_stride >> 1)); pu1_dst_v = (UWORD8 *)ps_disp_frm_buf->pv_v_buf +((u4_start_row >> 1)*(ps_dec->u4_frm_buf_stride >> 1)); if (IV_YUV_420P == ps_dec->i4_chromaFormat) { ps_dec->pf_copy_yuv420p_buf(pu1_src_y, pu1_src_u, pu1_src_v, pu1_dst_y, pu1_dst_u, pu1_dst_v, ps_dec->u2_frame_width, u4_num_rows, ps_dec->u4_frm_buf_stride, (ps_dec->u4_frm_buf_stride >> 1), (ps_dec->u4_frm_buf_stride >> 1), ps_dec->u2_frame_width, (ps_dec->u2_frame_width >> 1), (ps_dec->u2_frame_width >> 1)); } else if (IV_YUV_422ILE == ps_dec->i4_chromaFormat) { void *pv_yuv422i; UWORD32 u2_height,u2_width,u2_stride_y,u2_stride_u,u2_stride_v; UWORD32 u2_stride_yuv422i; pv_yuv422i = (UWORD8 *)ps_disp_frm_buf->pv_y_buf + ((ps_dec->u2_vertical_size)*(ps_dec->u4_frm_buf_stride)); u2_height = u4_num_rows; u2_width = ps_dec->u2_horizontal_size; u2_stride_y = ps_dec->u2_frame_width; u2_stride_u = u2_stride_y >> 1; u2_stride_v = u2_stride_u; u2_stride_yuv422i = (0 == ps_dec->u4_frm_buf_stride) ? ps_dec->u2_horizontal_size : ps_dec->u4_frm_buf_stride; ps_dec->pf_fmt_conv_yuv420p_to_yuv422ile(pu1_src_y, pu1_src_u, pu1_src_v, pv_yuv422i, u2_width, u2_height, u2_stride_y, u2_stride_u, u2_stride_v, u2_stride_yuv422i); } else if((ps_dec->i4_chromaFormat == IV_YUV_420SP_UV) || (ps_dec->i4_chromaFormat == IV_YUV_420SP_VU)) { UWORD32 dest_inc_Y=0,dest_inc_UV=0; WORD32 convert_uv_only; pu1_dst_u = (UWORD8 *)ps_disp_frm_buf->pv_u_buf +((u4_start_row >> 1)*(ps_dec->u4_frm_buf_stride)); dest_inc_Y = ps_dec->u4_frm_buf_stride; dest_inc_UV = ((ps_dec->u4_frm_buf_stride + 1) >> 1) << 1; convert_uv_only = 0; if(1 == ps_dec->u4_share_disp_buf) convert_uv_only = 1; if(ps_dec->i4_chromaFormat == IV_YUV_420SP_UV) { ps_dec->pf_fmt_conv_yuv420p_to_yuv420sp_uv(pu1_src_y, pu1_src_u, pu1_src_v, pu1_dst_y, pu1_dst_u, u4_num_rows, ps_dec->u2_horizontal_size, ps_dec->u2_frame_width, ps_dec->u2_frame_width >> 1, ps_dec->u2_frame_width >> 1, dest_inc_Y, dest_inc_UV, convert_uv_only); } else { ps_dec->pf_fmt_conv_yuv420p_to_yuv420sp_vu(pu1_src_y, pu1_src_u, pu1_src_v, pu1_dst_y, pu1_dst_u, u4_num_rows, ps_dec->u2_horizontal_size, ps_dec->u2_frame_width, ps_dec->u2_frame_width >> 1, ps_dec->u2_frame_width >> 1, dest_inc_Y, dest_inc_UV, convert_uv_only); } } } ",0 " event_size_change( int delta ) { status.ptsize += delta; if ( status.ptsize < 64 * 1 ) status.ptsize = 1 * 64; else if ( status.ptsize > MAXPTSIZE * 64 ) status.ptsize = MAXPTSIZE * 64; FTDemo_Set_Current_Charsize( handle, status.ptsize, status.res ); } ",0 "void BrowserWindowGtk::UnMaximize() { gtk_window_util::UnMaximize(window_, bounds_, restored_bounds_); } ",0 "bool PluginInstance::NPP_Print(NPPrint* platform_print) { DCHECK(npp_functions_ != 0); if (npp_functions_->print != 0) { npp_functions_->print(npp_, platform_print); return true; } return false; } ",0 "void ExtensionPrefs::SetAppNotificationDisabled( const std::string& extension_id, bool value) { DCHECK(Extension::IdIsValid(extension_id)); UpdateExtensionPref(extension_id, kPrefAppNotificationDisbaled, Value::CreateBooleanValue(value)); } ",0 "gst_tag_to_vorbis_tag (const gchar * gst_tag) { int i = 0; g_return_val_if_fail (gst_tag != NULL, NULL); gst_tag_register_musicbrainz_tags (); while (tag_matches[i].gstreamer_tag != NULL) { if (strcmp (gst_tag, tag_matches[i].gstreamer_tag) == 0) { return tag_matches[i].original_tag; } i++; } return NULL; } ",0 "WarmupURLFetcher::WarmupURLFetcher( CreateCustomProxyConfigCallback create_custom_proxy_config_callback, WarmupURLFetcherCallback callback, GetHttpRttCallback get_http_rtt_callback, scoped_refptr ui_task_runner, const std::string& user_agent) : is_fetch_in_flight_(false), previous_attempt_counts_(0), create_custom_proxy_config_callback_(create_custom_proxy_config_callback), callback_(callback), get_http_rtt_callback_(get_http_rtt_callback), user_agent_(user_agent), ui_task_runner_(ui_task_runner) { DCHECK(create_custom_proxy_config_callback); } ",1 " Observer(const base::WeakPtr& handler, scoped_refptr task_runner) : handler_(handler), main_thread_(task_runner) {} ",0 "PHP_FUNCTION(openssl_digest) { zend_bool raw_output = 0; char *data, *method; int data_len, method_len; const EVP_MD *mdtype; EVP_MD_CTX md_ctx; int siglen; unsigned char *sigbuf; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""ss|b"", &data, &data_len, &method, &method_len, &raw_output) == FAILURE) { return; } mdtype = EVP_get_digestbyname(method); if (!mdtype) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Unknown signature algorithm""); RETURN_FALSE; } siglen = EVP_MD_size(mdtype); sigbuf = emalloc(siglen + 1); EVP_DigestInit(&md_ctx, mdtype); EVP_DigestUpdate(&md_ctx, (unsigned char *)data, data_len); if (EVP_DigestFinal (&md_ctx, (unsigned char *)sigbuf, (unsigned int *)&siglen)) { if (raw_output) { sigbuf[siglen] = '\0'; RETVAL_STRINGL((char *)sigbuf, siglen, 0); } else { int digest_str_len = siglen * 2; char *digest_str = emalloc(digest_str_len + 1); make_digest_ex(digest_str, sigbuf, siglen); efree(sigbuf); RETVAL_STRINGL(digest_str, digest_str_len, 0); } } else { efree(sigbuf); RETVAL_FALSE; } } ",0 "bool SVGAnimateElement::animatedPropertyTypeSupportsAddition() const { switch (m_animatedPropertyType) { case AnimatedBoolean: case AnimatedEnumeration: case AnimatedPreserveAspectRatio: case AnimatedString: case AnimatedUnknown: return false; default: return true; } } ",0 "SYSCALL_DEFINE5(osf_setsysinfo, unsigned long, op, void __user *, buffer, unsigned long, nbytes, int __user *, start, void __user *, arg) { switch (op) { case SSI_IEEE_FP_CONTROL: { unsigned long swcr, fpcr; unsigned int *state; /* * Alpha Architecture Handbook 4.7.7.3: * To be fully IEEE compiant, we must track the current IEEE * exception state in software, because spurious bits can be * set in the trap shadow of a software-complete insn. */ if (get_user(swcr, (unsigned long __user *)buffer)) return -EFAULT; state = ¤t_thread_info()->ieee_state; /* Update softare trap enable bits. */ *state = (*state & ~IEEE_SW_MASK) | (swcr & IEEE_SW_MASK); /* Update the real fpcr. */ fpcr = rdfpcr() & FPCR_DYN_MASK; fpcr |= ieee_swcr_to_fpcr(swcr); wrfpcr(fpcr); return 0; } case SSI_IEEE_RAISE_EXCEPTION: { unsigned long exc, swcr, fpcr, fex; unsigned int *state; if (get_user(exc, (unsigned long __user *)buffer)) return -EFAULT; state = ¤t_thread_info()->ieee_state; exc &= IEEE_STATUS_MASK; /* Update softare trap enable bits. */ swcr = (*state & IEEE_SW_MASK) | exc; *state |= exc; /* Update the real fpcr. */ fpcr = rdfpcr(); fpcr |= ieee_swcr_to_fpcr(swcr); wrfpcr(fpcr); /* If any exceptions set by this call, and are unmasked, send a signal. Old exceptions are not signaled. */ fex = (exc >> IEEE_STATUS_TO_EXCSUM_SHIFT) & swcr; if (fex) { siginfo_t info; int si_code = 0; if (fex & IEEE_TRAP_ENABLE_DNO) si_code = FPE_FLTUND; if (fex & IEEE_TRAP_ENABLE_INE) si_code = FPE_FLTRES; if (fex & IEEE_TRAP_ENABLE_UNF) si_code = FPE_FLTUND; if (fex & IEEE_TRAP_ENABLE_OVF) si_code = FPE_FLTOVF; if (fex & IEEE_TRAP_ENABLE_DZE) si_code = FPE_FLTDIV; if (fex & IEEE_TRAP_ENABLE_INV) si_code = FPE_FLTINV; info.si_signo = SIGFPE; info.si_errno = 0; info.si_code = si_code; info.si_addr = NULL; /* FIXME */ send_sig_info(SIGFPE, &info, current); } return 0; } case SSI_IEEE_STATE_AT_SIGNAL: case SSI_IEEE_IGNORE_STATE_AT_SIGNAL: /* * Not sure anybody will ever use this weird stuff. These * ops can be used (under OSF/1) to set the fpcr that should * be used when a signal handler starts executing. */ break; case SSI_NVPAIRS: { unsigned long v, w, i; unsigned int old, new; for (i = 0; i < nbytes; ++i) { if (get_user(v, 2*i + (unsigned int __user *)buffer)) return -EFAULT; if (get_user(w, 2*i + 1 + (unsigned int __user *)buffer)) return -EFAULT; switch (v) { case SSIN_UACPROC: again: old = current_thread_info()->flags; new = old & ~(UAC_BITMASK << UAC_SHIFT); new = new | (w & UAC_BITMASK) << UAC_SHIFT; if (cmpxchg(¤t_thread_info()->flags, old, new) != old) goto again; break; default: return -EOPNOTSUPP; } } return 0; } default: break; } return -EOPNOTSUPP; } ",0 "static int gather_pte_stats(pmd_t *pmd, unsigned long addr, unsigned long end, struct mm_walk *walk) { struct numa_maps *md = walk->private; struct vm_area_struct *vma = walk->vma; spinlock_t *ptl; pte_t *orig_pte; pte_t *pte; if (pmd_trans_huge_lock(pmd, vma, &ptl) == 1) { pte_t huge_pte = *(pte_t *)pmd; struct page *page; page = can_gather_numa_stats(huge_pte, vma, addr); if (page) gather_stats(page, md, pte_dirty(huge_pte), HPAGE_PMD_SIZE/PAGE_SIZE); spin_unlock(ptl); return 0; } if (pmd_trans_unstable(pmd)) return 0; orig_pte = pte = pte_offset_map_lock(walk->mm, pmd, addr, &ptl); do { struct page *page = can_gather_numa_stats(*pte, vma, addr); if (!page) continue; gather_stats(page, md, pte_dirty(*pte), 1); } while (pte++, addr += PAGE_SIZE, addr != end); pte_unmap_unlock(orig_pte, ptl); return 0; } ",0 "bool LauncherView::SameDragType(LauncherItemType typea, LauncherItemType typeb) const { switch (typea) { case TYPE_TABBED: case TYPE_APP_PANEL: case TYPE_PLATFORM_APP: return (typeb == TYPE_TABBED || typeb == TYPE_APP_PANEL || typeb == TYPE_PLATFORM_APP); case TYPE_APP_SHORTCUT: case TYPE_APP_LIST: case TYPE_BROWSER_SHORTCUT: return typeb == typea; } NOTREACHED(); return false; } ",0 "virDomainOpenChannel(virDomainPtr dom, const char *name, virStreamPtr st, unsigned int flags) { virConnectPtr conn; VIR_DOMAIN_DEBUG(dom, ""name=%s, st=%p, flags=%x"", NULLSTR(name), st, flags); virResetLastError(); virCheckDomainReturn(dom, -1); conn = dom->conn; virCheckStreamGoto(st, error); virCheckReadOnlyGoto(conn->flags, error); if (conn != st->conn) { virReportInvalidArg(st, _(""stream must match connection of domain '%s'""), dom->name); goto error; } if (conn->driver->domainOpenChannel) { int ret; ret = conn->driver->domainOpenChannel(dom, name, st, flags); if (ret < 0) goto error; return ret; } virReportUnsupportedError(); error: virDispatchError(conn); return -1; } ",0 "static int ipip_rcv(struct sk_buff *skb) { return sit_tunnel_rcv(skb, IPPROTO_IPIP); } ",0 "static void pmcraid_release_chrdev(struct pmcraid_instance *pinstance) { pmcraid_release_minor(MINOR(pinstance->cdev.dev)); device_destroy(pmcraid_class, MKDEV(pmcraid_major, MINOR(pinstance->cdev.dev))); cdev_del(&pinstance->cdev); } ",0 " virtual status_t attachBuffer(int* slot, const sp& buffer) { Parcel data, reply; data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor()); data.write(*buffer.get()); status_t result = remote()->transact(ATTACH_BUFFER, data, &reply); if (result != NO_ERROR) { return result; } *slot = reply.readInt32(); result = reply.readInt32(); return result; } ",0 "void DownloadManagerImpl::SetDownloadFileFactoryForTesting( std::unique_ptr file_factory) { in_progress_manager_->set_file_factory(std::move(file_factory)); } ",0 "static int iccrange(i_ctx_t * i_ctx_p, ref *space, float *ptr) { int components, i, code = 0; ref *tempref, ICCdict, valref; code = array_get(imemory, space, 1, &ICCdict); if (code < 0) return code; code = dict_find_string(&ICCdict, ""N"", &tempref); if (code < 0) return code; if (code == 0) return gs_note_error(gs_error_undefined); components = tempref->value.intval; code = dict_find_string(&ICCdict, ""Range"", &tempref); if (code > 0 && !r_has_type(tempref, t_null)) { for (i=0;i= 0; i--) { if (keys[i].contents) { memset (keys[i].contents, 0, keys[i].length); free( keys[i].contents ); } } memset(keys, 0, n_key_data*sizeof(krb5_keyblock)); free(keys); return ret; } } *keyblocks = keys; if (n_keys) *n_keys = n_key_data; return 0; } ",0 "void ExtensionService::UnloadAllExtensions() { profile_->GetExtensionSpecialStoragePolicy()-> RevokeRightsForAllExtensions(); extensions_.clear(); disabled_extensions_.clear(); terminated_extension_ids_.clear(); terminated_extensions_.clear(); extension_runtime_data_.clear(); } ",0 "bool ClientControlledShellSurface::OnPreWidgetCommit() { if (!widget_) { if (!pending_geometry_.IsEmpty()) origin_ = pending_geometry_.origin(); CreateShellSurfaceWidget(ash::ToWindowShowState(pending_window_state_)); } ash::wm::WindowState* window_state = GetWindowState(); if (window_state->GetStateType() == pending_window_state_) { if (window_state->IsPip() && !window_state->is_dragged()) { client_controlled_state_->set_next_bounds_change_animation_type( ash::wm::ClientControlledState::kAnimationAnimated); } return true; } if (IsPinned(window_state)) { VLOG(1) << ""State change was requested while pinned""; return true; } auto animation_type = ash::wm::ClientControlledState::kAnimationNone; switch (pending_window_state_) { case ash::WindowStateType::kNormal: if (widget_->IsMaximized() || widget_->IsFullscreen()) { animation_type = ash::wm::ClientControlledState::kAnimationCrossFade; } break; case ash::WindowStateType::kMaximized: case ash::WindowStateType::kFullscreen: if (!window_state->IsPip()) animation_type = ash::wm::ClientControlledState::kAnimationCrossFade; break; default: break; } if (pending_window_state_ == ash::WindowStateType::kPip) { if (ash::features::IsPipRoundedCornersEnabled()) { decorator_ = std::make_unique( window_state->window(), host_window(), host_window()->layer(), ash::kPipRoundedCornerRadius); } } else { decorator_.reset(); // Remove rounded corners. } bool wasPip = window_state->IsPip(); if (client_controlled_state_->EnterNextState(window_state, pending_window_state_)) { client_controlled_state_->set_next_bounds_change_animation_type( animation_type); } if (wasPip && !window_state->IsMinimized()) { ash::Shell::Get()->split_view_controller()->EndSplitView( ash::SplitViewController::EndReason::kPipExpanded); window_state->Activate(); } return true; } ",1 "void IDNSpoofChecker::SetAllowedUnicodeSet(UErrorCode* status) { if (U_FAILURE(*status)) return; const icu::UnicodeSet* recommended_set = uspoof_getRecommendedUnicodeSet(status); icu::UnicodeSet allowed_set; allowed_set.addAll(*recommended_set); const icu::UnicodeSet* inclusion_set = uspoof_getInclusionUnicodeSet(status); allowed_set.addAll(*inclusion_set); allowed_set.remove(0x338u); allowed_set.remove(0x58au); // Armenian Hyphen allowed_set.remove(0x2010u); allowed_set.remove(0x2019u); // Right Single Quotation Mark allowed_set.remove(0x2027u); allowed_set.remove(0x30a0u); // Katakana-Hiragana Double Hyphen allowed_set.remove(0x2bbu); // Modifier Letter Turned Comma allowed_set.remove(0x2bcu); // Modifier Letter Apostrophe #if defined(OS_MACOSX) allowed_set.remove(0x0620u); allowed_set.remove(0x0F8Cu); allowed_set.remove(0x0F8Du); allowed_set.remove(0x0F8Eu); allowed_set.remove(0x0F8Fu); #endif uspoof_setAllowedUnicodeSet(checker_, &allowed_set, status); } ",0 "void RenderView::OnDelete() { if (!webview()) return; webview()->focusedFrame()->executeCommand(WebString::fromUTF8(""Delete"")); UserMetricsRecordAction(""DeleteSelection""); } ",0 "NavigationEntry* NavigationControllerImpl::GetTransientEntry() const { if (transient_entry_index_ == -1) return NULL; return entries_[transient_entry_index_].get(); } ",0 "vc4_get_hang_state_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv) { struct drm_vc4_get_hang_state *get_state = data; struct drm_vc4_get_hang_state_bo *bo_state; struct vc4_hang_state *kernel_state; struct drm_vc4_get_hang_state *state; struct vc4_dev *vc4 = to_vc4_dev(dev); unsigned long irqflags; u32 i; int ret = 0; spin_lock_irqsave(&vc4->job_lock, irqflags); kernel_state = vc4->hang_state; if (!kernel_state) { spin_unlock_irqrestore(&vc4->job_lock, irqflags); return -ENOENT; } state = &kernel_state->user_state; /* If the user's array isn't big enough, just return the * required array size. */ if (get_state->bo_count < state->bo_count) { get_state->bo_count = state->bo_count; spin_unlock_irqrestore(&vc4->job_lock, irqflags); return 0; } vc4->hang_state = NULL; spin_unlock_irqrestore(&vc4->job_lock, irqflags); /* Save the user's BO pointer, so we don't stomp it with the memcpy. */ state->bo = get_state->bo; memcpy(get_state, state, sizeof(*state)); bo_state = kcalloc(state->bo_count, sizeof(*bo_state), GFP_KERNEL); if (!bo_state) { ret = -ENOMEM; goto err_free; } for (i = 0; i < state->bo_count; i++) { struct vc4_bo *vc4_bo = to_vc4_bo(kernel_state->bo[i]); u32 handle; ret = drm_gem_handle_create(file_priv, kernel_state->bo[i], &handle); if (ret) { state->bo_count = i - 1; goto err; } bo_state[i].handle = handle; bo_state[i].paddr = vc4_bo->base.paddr; bo_state[i].size = vc4_bo->base.base.size; } if (copy_to_user((void __user *)(uintptr_t)get_state->bo, bo_state, state->bo_count * sizeof(*bo_state))) ret = -EFAULT; kfree(bo_state); err_free: vc4_free_hang_state(dev, kernel_state); err: return ret; } ",0 "static int br_mdb_fill_info(struct sk_buff *skb, struct netlink_callback *cb, struct net_device *dev) { struct net_bridge *br = netdev_priv(dev); struct net_bridge_mdb_htable *mdb; struct nlattr *nest, *nest2; int i, err = 0; int idx = 0, s_idx = cb->args[1]; if (br->multicast_disabled) return 0; mdb = rcu_dereference(br->mdb); if (!mdb) return 0; nest = nla_nest_start(skb, MDBA_MDB); if (nest == NULL) return -EMSGSIZE; for (i = 0; i < mdb->max; i++) { struct net_bridge_mdb_entry *mp; struct net_bridge_port_group *p, **pp; struct net_bridge_port *port; hlist_for_each_entry_rcu(mp, &mdb->mhash[i], hlist[mdb->ver]) { if (idx < s_idx) goto skip; nest2 = nla_nest_start(skb, MDBA_MDB_ENTRY); if (nest2 == NULL) { err = -EMSGSIZE; goto out; } for (pp = &mp->ports; (p = rcu_dereference(*pp)) != NULL; pp = &p->next) { port = p->port; if (port) { struct br_mdb_entry e; e.ifindex = port->dev->ifindex; e.state = p->state; if (p->addr.proto == htons(ETH_P_IP)) e.addr.u.ip4 = p->addr.u.ip4; #if IS_ENABLED(CONFIG_IPV6) if (p->addr.proto == htons(ETH_P_IPV6)) e.addr.u.ip6 = p->addr.u.ip6; #endif e.addr.proto = p->addr.proto; if (nla_put(skb, MDBA_MDB_ENTRY_INFO, sizeof(e), &e)) { nla_nest_cancel(skb, nest2); err = -EMSGSIZE; goto out; } } } nla_nest_end(skb, nest2); skip: idx++; } } out: cb->args[1] = idx; nla_nest_end(skb, nest); return err; } ",1 "void ReportPrintDestinationHistogram(enum PrintDestinationBuckets event) { UMA_HISTOGRAM_ENUMERATION(""PrintPreview.DestinationAction"", event, PRINT_DESTINATION_BUCKET_BOUNDARY); } ",0 "Response ServiceWorkerHandler::Unregister(const std::string& scope_url) { if (!enabled_) return CreateDomainNotEnabledErrorResponse(); if (!context_) return CreateContextErrorResponse(); context_->UnregisterServiceWorker(GURL(scope_url), base::Bind(&ResultNoOp)); return Response::OK(); } ",0 "void UserSelectionScreen::OnPasswordClearTimerExpired() { if (handler_) handler_->ClearUserPodPassword(); } ",0 "bool ContentBrowserClient::ShouldUseProcessPerSite( BrowserContext* browser_context, const GURL& effective_url) { return false; } ",0 "void recalc_sigpending(void) { if (!recalc_sigpending_tsk(current) && !freezing(current)) clear_thread_flag(TIF_SIGPENDING); } ",0 "bool TestRunner::AddRule(TargetPolicy::SubSystem subsystem, TargetPolicy::Semantics semantics, const wchar_t* pattern) { if (!is_init_) return false; return (SBOX_ALL_OK == policy_->AddRule(subsystem, semantics, pattern)); } ",0 "static void unhash_mnt(struct mount *mnt) { mnt->mnt_parent = mnt; mnt->mnt_mountpoint = mnt->mnt.mnt_root; list_del_init(&mnt->mnt_child); hlist_del_init_rcu(&mnt->mnt_hash); hlist_del_init(&mnt->mnt_mp_list); put_mountpoint(mnt->mnt_mp); mnt->mnt_mp = NULL; } ",0 "void PepperDeviceEnumerationHostHelper::OnNotifyDeviceChange( uint32_t callback_id, int /* request_id */, const std::vector& devices) { resource_host_->host()->SendUnsolicitedReply( resource_host_->pp_resource(), PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange(callback_id, devices)); } ",0 "ax25_cb *ax25_create_cb(void) { ax25_cb *ax25; if ((ax25 = kzalloc(sizeof(*ax25), GFP_ATOMIC)) == NULL) return NULL; atomic_set(&ax25->refcount, 1); skb_queue_head_init(&ax25->write_queue); skb_queue_head_init(&ax25->frag_queue); skb_queue_head_init(&ax25->ack_queue); skb_queue_head_init(&ax25->reseq_queue); ax25_setup_timers(ax25); ax25_fillin_cb(ax25, NULL); ax25->state = AX25_STATE_0; return ax25; } ",0 "void RenderViewImpl::willReleaseScriptContext(WebFrame* frame, v8::Handle context, int world_id) { content::GetContentClient()->renderer()->WillReleaseScriptContext( frame, context, world_id); } ",0 "void HTMLFormElement::submitFromJavaScript() { submit(nullptr, nullptr); } ",0 "void DevToolsSession::DispatchProtocolResponse( const std::string& message, int call_id, const base::Optional& state) { if (state.has_value()) state_cookie_ = state.value(); waiting_for_response_messages_.erase(call_id); client_->DispatchProtocolMessage(agent_host_, message); } ",0 "bool omx_vdec::align_pmem_buffers(int pmem_fd, OMX_U32 buffer_size, OMX_U32 alignment) { struct pmem_allocation allocation; allocation.size = buffer_size; allocation.align = clip2(alignment); if (allocation.align < 4096) { allocation.align = 4096; } if (ioctl(pmem_fd, PMEM_ALLOCATE_ALIGNED, &allocation) < 0) { DEBUG_PRINT_ERROR(""Aligment(%u) failed with pmem driver Sz(%lu)"", allocation.align, allocation.size); return false; } return true; } ",0 "WebUI* WebContentsImpl::GetWebUI() const { return render_manager_.web_ui() ? render_manager_.web_ui() : render_manager_.pending_web_ui(); } ",0 "static int sf_setstate(struct ip_mc_list *pmc) { struct ip_sf_list *psf, *dpsf; int mca_xcount = pmc->sfcount[MCAST_EXCLUDE]; int qrv = pmc->interface->mr_qrv; int new_in, rv; rv = 0; for (psf=pmc->sources; psf; psf=psf->sf_next) { if (pmc->sfcount[MCAST_EXCLUDE]) { new_in = mca_xcount == psf->sf_count[MCAST_EXCLUDE] && !psf->sf_count[MCAST_INCLUDE]; } else new_in = psf->sf_count[MCAST_INCLUDE] != 0; if (new_in) { if (!psf->sf_oldin) { struct ip_sf_list *prev = NULL; for (dpsf=pmc->tomb; dpsf; dpsf=dpsf->sf_next) { if (dpsf->sf_inaddr == psf->sf_inaddr) break; prev = dpsf; } if (dpsf) { if (prev) prev->sf_next = dpsf->sf_next; else pmc->tomb = dpsf->sf_next; kfree(dpsf); } psf->sf_crcount = qrv; rv++; } } else if (psf->sf_oldin) { psf->sf_crcount = 0; /* * add or update ""delete"" records if an active filter * is now inactive */ for (dpsf=pmc->tomb; dpsf; dpsf=dpsf->sf_next) if (dpsf->sf_inaddr == psf->sf_inaddr) break; if (!dpsf) { dpsf = kmalloc(sizeof(*dpsf), GFP_ATOMIC); if (!dpsf) continue; *dpsf = *psf; /* pmc->lock held by callers */ dpsf->sf_next = pmc->tomb; pmc->tomb = dpsf; } dpsf->sf_crcount = qrv; rv++; } } return rv; } ",0 "static int cmd_handle_untagged(struct ImapData *idata) { unsigned int count = 0; char *s = imap_next_word(idata->buf); char *pn = imap_next_word(s); if ((idata->state >= IMAP_SELECTED) && isdigit((unsigned char) *s)) { pn = s; s = imap_next_word(s); /* EXISTS and EXPUNGE are always related to the SELECTED mailbox for the * connection, so update that one. */ if (mutt_str_strncasecmp(""EXISTS"", s, 6) == 0) { mutt_debug(2, ""Handling EXISTS\n""); /* new mail arrived */ if (mutt_str_atoui(pn, &count) < 0) { mutt_debug(1, ""Malformed EXISTS: '%s'\n"", pn); } if (!(idata->reopen & IMAP_EXPUNGE_PENDING) && count < idata->max_msn) { /* Notes 6.0.3 has a tendency to report fewer messages exist than * it should. */ mutt_debug(1, ""Message count is out of sync\n""); return 0; } /* at least the InterChange server sends EXISTS messages freely, * even when there is no new mail */ else if (count == idata->max_msn) mutt_debug(3, ""superfluous EXISTS message.\n""); else { if (!(idata->reopen & IMAP_EXPUNGE_PENDING)) { mutt_debug(2, ""New mail in %s - %d messages total.\n"", idata->mailbox, count); idata->reopen |= IMAP_NEWMAIL_PENDING; } idata->new_mail_count = count; } } /* pn vs. s: need initial seqno */ else if (mutt_str_strncasecmp(""EXPUNGE"", s, 7) == 0) cmd_parse_expunge(idata, pn); else if (mutt_str_strncasecmp(""FETCH"", s, 5) == 0) cmd_parse_fetch(idata, pn); } else if (mutt_str_strncasecmp(""CAPABILITY"", s, 10) == 0) cmd_parse_capability(idata, s); else if (mutt_str_strncasecmp(""OK [CAPABILITY"", s, 14) == 0) cmd_parse_capability(idata, pn); else if (mutt_str_strncasecmp(""OK [CAPABILITY"", pn, 14) == 0) cmd_parse_capability(idata, imap_next_word(pn)); else if (mutt_str_strncasecmp(""LIST"", s, 4) == 0) cmd_parse_list(idata, s); else if (mutt_str_strncasecmp(""LSUB"", s, 4) == 0) cmd_parse_lsub(idata, s); else if (mutt_str_strncasecmp(""MYRIGHTS"", s, 8) == 0) cmd_parse_myrights(idata, s); else if (mutt_str_strncasecmp(""SEARCH"", s, 6) == 0) cmd_parse_search(idata, s); else if (mutt_str_strncasecmp(""STATUS"", s, 6) == 0) cmd_parse_status(idata, s); else if (mutt_str_strncasecmp(""ENABLED"", s, 7) == 0) cmd_parse_enabled(idata, s); else if (mutt_str_strncasecmp(""BYE"", s, 3) == 0) { mutt_debug(2, ""Handling BYE\n""); /* check if we're logging out */ if (idata->status == IMAP_BYE) return 0; /* server shut down our connection */ s += 3; SKIPWS(s); mutt_error(""%s"", s); cmd_handle_fatal(idata); return -1; } else if (ImapServernoise && (mutt_str_strncasecmp(""NO"", s, 2) == 0)) { mutt_debug(2, ""Handling untagged NO\n""); /* Display the warning message from the server */ mutt_error(""%s"", s + 3); } return 0; } ",1 " FT_Render_Glyph_Internal( FT_Library library, FT_GlyphSlot slot, FT_Render_Mode render_mode ) { FT_Error error = FT_Err_Ok; FT_Renderer renderer; /* if it is already a bitmap, no need to do anything */ switch ( slot->format ) { case FT_GLYPH_FORMAT_BITMAP: /* already a bitmap, don't do anything */ break; default: { FT_ListNode node = 0; FT_Bool update = 0; /* small shortcut for the very common case */ if ( slot->format == FT_GLYPH_FORMAT_OUTLINE ) { renderer = library->cur_renderer; node = library->renderers.head; } else renderer = FT_Lookup_Renderer( library, slot->format, &node ); error = FT_Err_Unimplemented_Feature; while ( renderer ) { error = renderer->render( renderer, slot, render_mode, NULL ); if ( !error || FT_ERROR_BASE( error ) != FT_Err_Cannot_Render_Glyph ) break; /* FT_Err_Cannot_Render_Glyph is returned if the render mode */ /* is unsupported by the current renderer for this glyph image */ /* format. */ /* now, look for another renderer that supports the same */ /* format. */ renderer = FT_Lookup_Renderer( library, slot->format, &node ); update = 1; } /* if we changed the current renderer for the glyph image format */ /* we need to select it as the next current one */ if ( !error && update && renderer ) FT_Set_Renderer( library, renderer, 0, 0 ); } } return error; } ",0 "bool WebviewInfo::IsResourceWebviewAccessible( const Extension* extension, const std::string& partition_id, const std::string& relative_path) { if (!extension) return false; const WebviewInfo* info = GetResourcesInfo(*extension); if (!info) return false; bool partition_is_privileged = false; for (size_t i = 0; i < info->webview_privileged_partitions_.size(); ++i) { if (MatchPattern(partition_id, info->webview_privileged_partitions_[i])) { partition_is_privileged = true; break; } } return partition_is_privileged && extension->ResourceMatches( info->webview_accessible_resources_, relative_path); } ",1 "static bool b43_rx_buffer_is_poisoned(struct b43_dmaring *ring, struct sk_buff *skb) { unsigned char *f = skb->data + ring->frameoffset; return ((f[0] & f[1] & f[2] & f[3] & f[4] & f[5] & f[6] & f[7]) == 0xFF); } ",0 "RenderObject* RenderBlockFlow::layoutSpecialExcludedChild(bool relayoutChildren, SubtreeLayoutScope& layoutScope) { RenderMultiColumnFlowThread* flowThread = multiColumnFlowThread(); if (!flowThread) return 0; setLogicalTopForChild(flowThread, borderBefore() + paddingBefore()); flowThread->layoutColumns(relayoutChildren, layoutScope); determineLogicalLeftPositionForChild(flowThread); return flowThread; } ",0 "httpd_start_request( httpd_conn* hc, struct timeval* nowP ) { int r; /* Really start the request. */ r = really_start_request( hc, nowP ); /* And return the status. */ return r; } ",0 "cmsBool ColorSpaceIsCompatible(cmsColorSpaceSignature a, cmsColorSpaceSignature b) { if (a == b) return TRUE; if ((a == cmsSig4colorData) && (b == cmsSigCmykData)) return TRUE; if ((a == cmsSigCmykData) && (b == cmsSig4colorData)) return TRUE; if ((a == cmsSigXYZData) && (b == cmsSigLabData)) return TRUE; if ((a == cmsSigLabData) && (b == cmsSigXYZData)) return TRUE; return FALSE; } ",0 " virtual bool wantsRawData() const { return true; } ",0 "mm_answer_rsa_challenge(int sock, Buffer *m) { Key *key = NULL; u_char *blob; u_int blen; debug3(""%s entering"", __func__); if (!authctxt->valid) fatal(""%s: authctxt not valid"", __func__); blob = buffer_get_string(m, &blen); if (!monitor_allowed_key(blob, blen)) fatal(""%s: bad key, not previously allowed"", __func__); if (key_blobtype != MM_RSAUSERKEY && key_blobtype != MM_RSAHOSTKEY) fatal(""%s: key type mismatch"", __func__); if ((key = key_from_blob(blob, blen)) == NULL) fatal(""%s: received bad key"", __func__); if (key->type != KEY_RSA) fatal(""%s: received bad key type %d"", __func__, key->type); key->type = KEY_RSA1; if (ssh1_challenge) BN_clear_free(ssh1_challenge); ssh1_challenge = auth_rsa_generate_challenge(key); buffer_clear(m); buffer_put_bignum2(m, ssh1_challenge); debug3(""%s sending reply"", __func__); mm_request_send(sock, MONITOR_ANS_RSACHALLENGE, m); monitor_permit(mon_dispatch, MONITOR_REQ_RSARESPONSE, 1); free(blob); key_free(key); return (0); } ",0 "void ResetScreenHandler::ShowWithParams() { int dialog_type; if (reboot_was_requested_) { dialog_type = rollback_available_ ? reset::DIALOG_SHORTCUT_CONFIRMING_POWERWASH_AND_ROLLBACK : reset::DIALOG_SHORTCUT_CONFIRMING_POWERWASH_ONLY; } else { dialog_type = rollback_available_ ? reset::DIALOG_SHORTCUT_OFFERING_ROLLBACK_AVAILABLE : reset::DIALOG_SHORTCUT_OFFERING_ROLLBACK_UNAVAILABLE; } UMA_HISTOGRAM_ENUMERATION(""Reset.ChromeOS.PowerwashDialogShown"", dialog_type, reset::DIALOG_VIEW_TYPE_SIZE); base::DictionaryValue reset_screen_params; reset_screen_params.SetBoolean(""showRestartMsg"", restart_required_); reset_screen_params.SetBoolean( ""showRollbackOption"", rollback_available_ && !reboot_was_requested_); reset_screen_params.SetBoolean( ""simpleConfirm"", reboot_was_requested_ && !rollback_available_); reset_screen_params.SetBoolean( ""rollbackConfirm"", reboot_was_requested_ && rollback_available_); PrefService* prefs = g_browser_process->local_state(); prefs->SetBoolean(prefs::kFactoryResetRequested, false); prefs->SetBoolean(prefs::kRollbackRequested, false); prefs->CommitPendingWrite(); ShowScreen(kResetScreen, &reset_screen_params); } ",0 "void SyncBackendHost::SetPassphrase(const std::string& passphrase, bool is_explicit) { if (!IsNigoriEnabled()) { SLOG(WARNING) << ""Silently dropping SetPassphrase request.""; return; } DCHECK_EQ(MessageLoop::current(), frontend_loop_); sync_thread_.message_loop()->PostTask(FROM_HERE, NewRunnableMethod(core_.get(), &SyncBackendHost::Core::DoSetPassphrase, passphrase, is_explicit)); } ",0 "void LayerTreeCoordinator::performScheduledLayerFlush() { if (m_isSuspended || m_waitingForUIProcess) return; syncDisplayState(); if (!m_isValid) return; if (flushPendingLayerChanges()) didPerformScheduledLayerFlush(); } ",0 "void Element::removeActiveAnimation(Animation* animation) { ElementRareData* rareData = elementRareData(); ASSERT(rareData); size_t position = rareData->activeAnimations()->find(animation); ASSERT(position != notFound); rareData->activeAnimations()->remove(position); } ",0 "static inline void vop_virtio_device_reset(struct vop_vdev *vdev) { int i; dev_dbg(vop_dev(vdev), ""%s: status %d device type %d RESET\n"", __func__, vdev->dd->status, vdev->virtio_id); for (i = 0; i < vdev->dd->num_vq; i++) /* * Avoid lockdep false positive. The + 1 is for the vop * mutex which is held in the reset devices code path. */ mutex_lock_nested(&vdev->vvr[i].vr_mutex, i + 1); /* 0 status means ""reset"" */ vdev->dd->status = 0; vdev->dc->vdev_reset = 0; vdev->dc->host_ack = 1; for (i = 0; i < vdev->dd->num_vq; i++) { struct vringh *vrh = &vdev->vvr[i].vrh; vdev->vvr[i].vring.info->avail_idx = 0; vrh->completed = 0; vrh->last_avail_idx = 0; vrh->last_used_idx = 0; } for (i = 0; i < vdev->dd->num_vq; i++) mutex_unlock(&vdev->vvr[i].vr_mutex); } ",0 "void CaptivePortalDetector::Cancel() { url_fetcher_.reset(); detection_callback_.Reset(); } ",0 "ssize_t expect_default(h2o_http2_conn_t *conn, const uint8_t *src, size_t len, const char **err_desc) { h2o_http2_frame_t frame; ssize_t ret; static int (*FRAME_HANDLERS[])(h2o_http2_conn_t *conn, h2o_http2_frame_t *frame, const char **err_desc) = { handle_data_frame, /* DATA */ handle_headers_frame, /* HEADERS */ handle_priority_frame, /* PRIORITY */ handle_rst_stream_frame, /* RST_STREAM */ handle_settings_frame, /* SETTINGS */ handle_push_promise_frame, /* PUSH_PROMISE */ handle_ping_frame, /* PING */ handle_goaway_frame, /* GOAWAY */ handle_window_update_frame, /* WINDOW_UPDATE */ handle_invalid_continuation_frame /* CONTINUATION */ }; if ((ret = h2o_http2_decode_frame(&frame, src, len, &H2O_HTTP2_SETTINGS_HOST, err_desc)) < 0) return ret; if (frame.type < sizeof(FRAME_HANDLERS) / sizeof(FRAME_HANDLERS[0])) { int hret = FRAME_HANDLERS[frame.type](conn, &frame, err_desc); if (hret != 0) ret = hret; } else { fprintf(stderr, ""skipping frame (type:%d)\n"", frame.type); } return ret; } ",0 "void FrameSelection::SetCaretBlinkingSuspended(bool suspended) { frame_caret_->SetCaretBlinkingSuspended(suspended); } ",0 "void CSoundFile::ApplyInstrumentPanning(ModChannel *pChn, const ModInstrument *instr, const ModSample *smp) const { int32 newPan = int32_min; if(instr != nullptr && instr->dwFlags[INS_SETPANNING]) newPan = instr->nPan; if(smp != nullptr && smp->uFlags[CHN_PANNING]) newPan = smp->nPan; if(newPan != int32_min) { pChn->nPan = newPan; if(m_playBehaviour[kPanOverride] && !m_SongFlags[SONG_SURROUNDPAN]) { pChn->dwFlags.reset(CHN_SURROUND); } } } ",0 "static struct dentry *proc_tid_base_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) { return proc_pident_lookup(dir, dentry, tid_base_stuff, ARRAY_SIZE(tid_base_stuff)); } ",0 "std::unique_ptr WorkerFetchContext::CreateURLLoader( const ResourceRequest& request, WebTaskRunner* task_runner) { CountUsage(WebFeature::kOffMainThreadFetch); WrappedResourceRequest wrapped(request); return web_context_->CreateURLLoader(wrapped, task_runner->ToSingleThreadTaskRunner()); } ",0 "static void vhash_update(const unsigned char *m, unsigned int mbytes, /* Pos multiple of VMAC_NHBYTES */ struct vmac_ctx *ctx) { u64 rh, rl, *mptr; const u64 *kptr = (u64 *)ctx->nhkey; int i; u64 ch, cl; u64 pkh = ctx->polykey[0]; u64 pkl = ctx->polykey[1]; if (!mbytes) return; BUG_ON(mbytes % VMAC_NHBYTES); mptr = (u64 *)m; i = mbytes / VMAC_NHBYTES; /* Must be non-zero */ ch = ctx->polytmp[0]; cl = ctx->polytmp[1]; if (!ctx->first_block_processed) { ctx->first_block_processed = 1; nh_vmac_nhbytes(mptr, kptr, VMAC_NHBYTES/8, rh, rl); rh &= m62; ADD128(ch, cl, rh, rl); mptr += (VMAC_NHBYTES/sizeof(u64)); i--; } while (i--) { nh_vmac_nhbytes(mptr, kptr, VMAC_NHBYTES/8, rh, rl); rh &= m62; poly_step(ch, cl, pkh, pkl, rh, rl); mptr += (VMAC_NHBYTES/sizeof(u64)); } ctx->polytmp[0] = ch; ctx->polytmp[1] = cl; } ",0 "void WebPluginProxy::SetCookie(const GURL& url, const GURL& first_party_for_cookies, const std::string& cookie) { Send(new PluginHostMsg_SetCookie(route_id_, url, first_party_for_cookies, cookie)); } ",0 "static bool stack_segment_valid(struct kvm_vcpu *vcpu) { struct kvm_segment ss; unsigned int ss_rpl; vmx_get_segment(vcpu, &ss, VCPU_SREG_SS); ss_rpl = ss.selector & SEGMENT_RPL_MASK; if (ss.unusable) return true; if (ss.type != 3 && ss.type != 7) return false; if (!ss.s) return false; if (ss.dpl != ss_rpl) /* DPL != RPL */ return false; if (!ss.present) return false; return true; } ",0 "void RenderFrameHostManager::CreateProxiesForChildFrame(FrameTreeNode* child) { RenderFrameProxyHost* outer_delegate_proxy = ForInnerDelegate() ? GetProxyToOuterDelegate() : nullptr; for (const auto& pair : proxy_hosts_) { if (pair.second.get() == outer_delegate_proxy) continue; child->render_manager()->CreateRenderFrameProxy( pair.second->GetSiteInstance()); } } ",0 "SYSCALL_DEFINE2(kill, pid_t, pid, int, sig) { struct siginfo info; info.si_signo = sig; info.si_errno = 0; info.si_code = SI_USER; info.si_pid = task_tgid_vnr(current); info.si_uid = from_kuid_munged(current_user_ns(), current_uid()); return kill_something_info(sig, &info, pid); } ",0 "lrmd_auth_timeout_cb(gpointer data) { crm_client_t *client = data; client->remote->auth_timeout = 0; if (client->remote->tls_handshake_complete == TRUE) { return FALSE; } mainloop_del_fd(client->remote->source); client->remote->source = NULL; crm_err(""Remote client authentication timed out""); return FALSE; } ",0 "static int nfs4_lock_expired(struct nfs4_state *state, struct file_lock *request) { struct nfs_server *server = NFS_SERVER(state->inode); struct nfs4_exception exception = { }; int err; err = nfs4_set_lock_state(state, request); if (err != 0) return err; do { if (test_bit(NFS_DELEGATED_STATE, &state->flags) != 0) return 0; err = _nfs4_do_setlk(state, F_SETLK, request, 0); if (err != -NFS4ERR_DELAY) break; nfs4_handle_exception(server, err, &exception); } while (exception.retry); return err; } ",0 "static int ftrace_function_set_filter_pred(struct filter_pred *pred, struct function_filter_data *data) { int ret; /* Checking the node is valid for function trace. */ ret = ftrace_function_check_pred(pred); if (ret) return ret; return __ftrace_function_set_filter(pred->op == OP_EQ, pred->regex.pattern, pred->regex.len, data); } ",0 "void __init init_mem_mapping(void) { unsigned long end; probe_page_size_mask(); #ifdef CONFIG_X86_64 end = max_pfn << PAGE_SHIFT; #else end = max_low_pfn << PAGE_SHIFT; #endif /* the ISA range is always mapped regardless of memory holes */ init_memory_mapping(0, ISA_END_ADDRESS); /* Init the trampoline, possibly with KASLR memory offset */ init_trampoline(); /* * If the allocation is in bottom-up direction, we setup direct mapping * in bottom-up, otherwise we setup direct mapping in top-down. */ if (memblock_bottom_up()) { unsigned long kernel_end = __pa_symbol(_end); /* * we need two separate calls here. This is because we want to * allocate page tables above the kernel. So we first map * [kernel_end, end) to make memory above the kernel be mapped * as soon as possible. And then use page tables allocated above * the kernel to map [ISA_END_ADDRESS, kernel_end). */ memory_map_bottom_up(kernel_end, end); memory_map_bottom_up(ISA_END_ADDRESS, kernel_end); } else { memory_map_top_down(ISA_END_ADDRESS, end); } #ifdef CONFIG_X86_64 if (max_pfn > max_low_pfn) { /* can we preseve max_low_pfn ?*/ max_low_pfn = max_pfn; } #else early_ioremap_page_table_range_init(); #endif load_cr3(swapper_pg_dir); __flush_tlb_all(); early_memtest(0, max_pfn_mapped << PAGE_SHIFT); } ",0 "static int cmykrange(i_ctx_t * i_ctx_p, ref *space, float *ptr) { int i; for (i = 0;i < 8;i+=2) { ptr[i] = 0; ptr[i+1] = 1; } return 0; } ",0 "BrowserContext* NavigationControllerImpl::GetBrowserContext() const { return browser_context_; } ",0 "void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( HTMLCanvasElementOrOffscreenCanvas& result) const { if (canvas()) { result.setHTMLCanvasElement(static_cast(host())); } else { result.setOffscreenCanvas(static_cast(host())); } } ",0 "void WebKitTestController::OnCloseRemainingWindows() { DevToolsAgentHost::DetachAllClients(); std::vector open_windows(Shell::windows()); Shell* devtools_shell = devtools_frontend_ ? devtools_frontend_->frontend_shell() : NULL; for (size_t i = 0; i < open_windows.size(); ++i) { if (open_windows[i] != main_window_ && open_windows[i] != devtools_shell) open_windows[i]->Close(); } base::MessageLoop::current()->RunUntilIdle(); } ",0 "LocalDOMWindow* LocalFrame::DomWindow() const { return ToLocalDOMWindow(dom_window_); } ",0 "ChunkedUploadDataStream::~ChunkedUploadDataStream() { } ",0 "void DrawingBuffer::Bind(GLenum target) { gl_->BindFramebuffer(target, WantExplicitResolve() ? multisample_fbo_ : fbo_); } ",0 "static MXFIndexTable *mxf_find_index_table(MXFContext *mxf, int index_sid) { int i; for (i = 0; i < mxf->nb_index_tables; i++) if (mxf->index_tables[i].index_sid == index_sid) return &mxf->index_tables[i]; return NULL; } ",0 "static bool task_participate_group_stop(struct task_struct *task) { struct signal_struct *sig = task->signal; bool consume = task->jobctl & JOBCTL_STOP_CONSUME; WARN_ON_ONCE(!(task->jobctl & JOBCTL_STOP_PENDING)); task_clear_jobctl_pending(task, JOBCTL_STOP_PENDING); if (!consume) return false; if (!WARN_ON_ONCE(sig->group_stop_count == 0)) sig->group_stop_count--; /* * Tell the caller to notify completion iff we are entering into a * fresh group stop. Read comment in do_signal_stop() for details. */ if (!sig->group_stop_count && !(sig->flags & SIGNAL_STOP_STOPPED)) { signal_set_stop_flags(sig, SIGNAL_STOP_STOPPED); return true; } return false; } ",0 "void Container::write(WEBP_MetaHandler* handler) { XMP_IO* file = handler->parent->ioRef; file->Rewind(); XIO::WriteUns32_LE(file, this->tag); XIO::WriteUns32_LE(file, (XMP_Uns32) this->size); XIO::WriteUns32_LE(file, kChunk_WEBP); size_t i, j; std::vector chunkVect; for (i = 0; i < WEBP_CHUNK_NIL; i++) { chunkVect = this->chunks[i]; for (j = 0; j < chunkVect.size(); j++) { chunkVect.at(j)->write(handler); } } XMP_Int64 lastOffset = file->Offset(); this->size = lastOffset - 8; file->Seek(this->pos + 4, kXMP_SeekFromStart); XIO::WriteUns32_LE(file, (XMP_Uns32) this->size); file->Seek(lastOffset, kXMP_SeekFromStart); if (lastOffset < handler->initialFileSize) { file->Truncate(lastOffset); } } ",0 "bool SSLClientSocketOpenSSL::UsingTCPFastOpen() const { if (transport_.get() && transport_->socket()) return transport_->socket()->UsingTCPFastOpen(); NOTREACHED(); return false; } ",0 "void CL_Init( void ) { Com_Printf( ""----- Client Initialization -----\n"" ); Con_Init(); if(!com_fullyInitialized) { CL_ClearState(); clc.state = CA_DISCONNECTED; // no longer CA_UNINITIALIZED cl_oldGameSet = qfalse; } cls.realtime = 0; CL_InitInput(); cl_noprint = Cvar_Get( ""cl_noprint"", ""0"", 0 ); #ifdef UPDATE_SERVER_NAME cl_motd = Cvar_Get( ""cl_motd"", ""1"", 0 ); #endif cl_timeout = Cvar_Get( ""cl_timeout"", ""200"", 0 ); cl_timeNudge = Cvar_Get( ""cl_timeNudge"", ""0"", CVAR_TEMP ); cl_shownet = Cvar_Get( ""cl_shownet"", ""0"", CVAR_TEMP ); cl_showSend = Cvar_Get( ""cl_showSend"", ""0"", CVAR_TEMP ); cl_showTimeDelta = Cvar_Get( ""cl_showTimeDelta"", ""0"", CVAR_TEMP ); cl_freezeDemo = Cvar_Get( ""cl_freezeDemo"", ""0"", CVAR_TEMP ); rcon_client_password = Cvar_Get( ""rconPassword"", """", CVAR_TEMP ); cl_activeAction = Cvar_Get( ""activeAction"", """", CVAR_TEMP ); cl_timedemo = Cvar_Get( ""timedemo"", ""0"", 0 ); cl_timedemoLog = Cvar_Get (""cl_timedemoLog"", """", CVAR_ARCHIVE); cl_autoRecordDemo = Cvar_Get (""cl_autoRecordDemo"", ""0"", CVAR_ARCHIVE); cl_aviFrameRate = Cvar_Get (""cl_aviFrameRate"", ""25"", CVAR_ARCHIVE); cl_aviMotionJpeg = Cvar_Get (""cl_aviMotionJpeg"", ""1"", CVAR_ARCHIVE); cl_avidemo = Cvar_Get( ""cl_avidemo"", ""0"", 0 ); cl_forceavidemo = Cvar_Get( ""cl_forceavidemo"", ""0"", 0 ); rconAddress = Cvar_Get( ""rconAddress"", """", 0 ); cl_yawspeed = Cvar_Get( ""cl_yawspeed"", ""140"", CVAR_ARCHIVE ); cl_pitchspeed = Cvar_Get( ""cl_pitchspeed"", ""140"", CVAR_ARCHIVE ); cl_anglespeedkey = Cvar_Get( ""cl_anglespeedkey"", ""1.5"", 0 ); cl_maxpackets = Cvar_Get( ""cl_maxpackets"", ""38"", CVAR_ARCHIVE ); cl_packetdup = Cvar_Get( ""cl_packetdup"", ""1"", CVAR_ARCHIVE ); cl_run = Cvar_Get( ""cl_run"", ""1"", CVAR_ARCHIVE ); cl_sensitivity = Cvar_Get( ""sensitivity"", ""5"", CVAR_ARCHIVE ); cl_mouseAccel = Cvar_Get( ""cl_mouseAccel"", ""0"", CVAR_ARCHIVE ); cl_freelook = Cvar_Get( ""cl_freelook"", ""1"", CVAR_ARCHIVE ); cl_mouseAccelStyle = Cvar_Get( ""cl_mouseAccelStyle"", ""0"", CVAR_ARCHIVE ); cl_mouseAccelOffset = Cvar_Get( ""cl_mouseAccelOffset"", ""5"", CVAR_ARCHIVE ); Cvar_CheckRange(cl_mouseAccelOffset, 0.001f, 50000.0f, qfalse); cl_showMouseRate = Cvar_Get( ""cl_showmouserate"", ""0"", 0 ); cl_allowDownload = Cvar_Get( ""cl_allowDownload"", ""0"", CVAR_ARCHIVE ); #ifdef USE_CURL_DLOPEN cl_cURLLib = Cvar_Get(""cl_cURLLib"", DEFAULT_CURL_LIB, CVAR_ARCHIVE); #endif Cvar_Get( ""cg_autoswitch"", ""2"", CVAR_ARCHIVE ); Cvar_Get( ""cg_wolfparticles"", ""1"", CVAR_ARCHIVE ); cl_conXOffset = Cvar_Get( ""cl_conXOffset"", ""0"", 0 ); cl_inGameVideo = Cvar_Get( ""r_inGameVideo"", ""1"", CVAR_ARCHIVE ); cl_serverStatusResendTime = Cvar_Get( ""cl_serverStatusResendTime"", ""750"", 0 ); cl_recoilPitch = Cvar_Get( ""cg_recoilPitch"", ""0"", CVAR_ROM ); m_pitch = Cvar_Get( ""m_pitch"", ""0.022"", CVAR_ARCHIVE ); m_yaw = Cvar_Get( ""m_yaw"", ""0.022"", CVAR_ARCHIVE ); m_forward = Cvar_Get( ""m_forward"", ""0.25"", CVAR_ARCHIVE ); m_side = Cvar_Get( ""m_side"", ""0.25"", CVAR_ARCHIVE ); m_filter = Cvar_Get( ""m_filter"", ""0"", CVAR_ARCHIVE ); j_pitch = Cvar_Get (""j_pitch"", ""0.022"", CVAR_ARCHIVE); j_yaw = Cvar_Get (""j_yaw"", ""-0.022"", CVAR_ARCHIVE); j_forward = Cvar_Get (""j_forward"", ""-0.25"", CVAR_ARCHIVE); j_side = Cvar_Get (""j_side"", ""0.25"", CVAR_ARCHIVE); j_up = Cvar_Get (""j_up"", ""0"", CVAR_ARCHIVE); j_pitch_axis = Cvar_Get (""j_pitch_axis"", ""3"", CVAR_ARCHIVE); j_yaw_axis = Cvar_Get (""j_yaw_axis"", ""2"", CVAR_ARCHIVE); j_forward_axis = Cvar_Get (""j_forward_axis"", ""1"", CVAR_ARCHIVE); j_side_axis = Cvar_Get (""j_side_axis"", ""0"", CVAR_ARCHIVE); j_up_axis = Cvar_Get (""j_up_axis"", ""4"", CVAR_ARCHIVE); Cvar_CheckRange(j_pitch_axis, 0, MAX_JOYSTICK_AXIS-1, qtrue); Cvar_CheckRange(j_yaw_axis, 0, MAX_JOYSTICK_AXIS-1, qtrue); Cvar_CheckRange(j_forward_axis, 0, MAX_JOYSTICK_AXIS-1, qtrue); Cvar_CheckRange(j_side_axis, 0, MAX_JOYSTICK_AXIS-1, qtrue); Cvar_CheckRange(j_up_axis, 0, MAX_JOYSTICK_AXIS-1, qtrue); cl_motdString = Cvar_Get( ""cl_motdString"", """", CVAR_ROM ); Cvar_Get( ""cl_maxPing"", ""800"", CVAR_ARCHIVE ); cl_lanForcePackets = Cvar_Get (""cl_lanForcePackets"", ""1"", CVAR_ARCHIVE); cl_guidServerUniq = Cvar_Get (""cl_guidServerUniq"", ""1"", CVAR_ARCHIVE); cl_consoleKeys = Cvar_Get( ""cl_consoleKeys"", ""~ ` 0x7e 0x60"", CVAR_ARCHIVE); Cvar_Get( ""name"", ""WolfPlayer"", CVAR_USERINFO | CVAR_ARCHIVE ); cl_rate = Cvar_Get( ""rate"", ""25000"", CVAR_USERINFO | CVAR_ARCHIVE ); // NERVE - SMF - changed from 3000 Cvar_Get( ""snaps"", ""20"", CVAR_USERINFO | CVAR_ARCHIVE ); Cvar_Get( ""model"", ""bj2"", CVAR_USERINFO | CVAR_ARCHIVE ); Cvar_Get( ""head"", ""default"", CVAR_USERINFO | CVAR_ARCHIVE ); Cvar_Get( ""color"", ""4"", CVAR_USERINFO | CVAR_ARCHIVE ); Cvar_Get( ""handicap"", ""100"", CVAR_USERINFO | CVAR_ARCHIVE ); Cvar_Get( ""sex"", ""male"", CVAR_USERINFO | CVAR_ARCHIVE ); Cvar_Get( ""cl_anonymous"", ""0"", CVAR_USERINFO | CVAR_ARCHIVE ); Cvar_Get( ""password"", """", CVAR_USERINFO ); Cvar_Get( ""cg_predictItems"", ""1"", CVAR_USERINFO | CVAR_ARCHIVE ); #ifdef USE_MUMBLE cl_useMumble = Cvar_Get (""cl_useMumble"", ""0"", CVAR_ARCHIVE | CVAR_LATCH); cl_mumbleScale = Cvar_Get (""cl_mumbleScale"", ""0.0254"", CVAR_ARCHIVE); #endif #ifdef USE_VOIP cl_voipSend = Cvar_Get (""cl_voipSend"", ""0"", 0); cl_voipSendTarget = Cvar_Get (""cl_voipSendTarget"", ""spatial"", 0); cl_voipGainDuringCapture = Cvar_Get (""cl_voipGainDuringCapture"", ""0.2"", CVAR_ARCHIVE); cl_voipCaptureMult = Cvar_Get (""cl_voipCaptureMult"", ""2.0"", CVAR_ARCHIVE); cl_voipUseVAD = Cvar_Get (""cl_voipUseVAD"", ""0"", CVAR_ARCHIVE); cl_voipVADThreshold = Cvar_Get (""cl_voipVADThreshold"", ""0.25"", CVAR_ARCHIVE); cl_voipShowMeter = Cvar_Get (""cl_voipShowMeter"", ""1"", CVAR_ARCHIVE); cl_voip = Cvar_Get (""cl_voip"", ""1"", CVAR_ARCHIVE); Cvar_CheckRange( cl_voip, 0, 1, qtrue ); cl_voipProtocol = Cvar_Get (""cl_voipProtocol"", cl_voip->integer ? ""opus"" : """", CVAR_USERINFO | CVAR_ROM); #endif Cvar_Get( ""cg_autoactivate"", ""1"", CVAR_USERINFO | CVAR_ARCHIVE ); Cvar_Get( ""cg_emptyswitch"", ""0"", CVAR_USERINFO | CVAR_ARCHIVE ); Cvar_Get( ""cg_viewsize"", ""100"", CVAR_ARCHIVE ); Cvar_Get (""cg_stereoSeparation"", ""0"", CVAR_ROM); cl_missionStats = Cvar_Get( ""g_missionStats"", ""0"", CVAR_ROM ); cl_waitForFire = Cvar_Get( ""cl_waitForFire"", ""0"", CVAR_ROM ); cl_language = Cvar_Get( ""cl_language"", ""0"", CVAR_ARCHIVE ); cl_debugTranslation = Cvar_Get( ""cl_debugTranslation"", ""0"", 0 ); Cmd_AddCommand( ""cmd"", CL_ForwardToServer_f ); Cmd_AddCommand( ""configstrings"", CL_Configstrings_f ); Cmd_AddCommand( ""clientinfo"", CL_Clientinfo_f ); Cmd_AddCommand( ""snd_restart"", CL_Snd_Restart_f ); Cmd_AddCommand( ""vid_restart"", CL_Vid_Restart_f ); Cmd_AddCommand( ""disconnect"", CL_Disconnect_f ); Cmd_AddCommand( ""record"", CL_Record_f ); Cmd_AddCommand( ""demo"", CL_PlayDemo_f ); Cmd_SetCommandCompletionFunc( ""demo"", CL_CompleteDemoName ); Cmd_AddCommand( ""cinematic"", CL_PlayCinematic_f ); Cmd_AddCommand( ""stoprecord"", CL_StopRecord_f ); Cmd_AddCommand( ""connect"", CL_Connect_f ); Cmd_AddCommand( ""reconnect"", CL_Reconnect_f ); Cmd_AddCommand( ""localservers"", CL_LocalServers_f ); Cmd_AddCommand( ""globalservers"", CL_GlobalServers_f ); Cmd_AddCommand( ""rcon"", CL_Rcon_f ); Cmd_SetCommandCompletionFunc( ""rcon"", CL_CompleteRcon ); Cmd_AddCommand( ""ping"", CL_Ping_f ); Cmd_AddCommand( ""serverstatus"", CL_ServerStatus_f ); Cmd_AddCommand( ""showip"", CL_ShowIP_f ); Cmd_AddCommand( ""fs_openedList"", CL_OpenedPK3List_f ); Cmd_AddCommand( ""fs_referencedList"", CL_ReferencedPK3List_f ); Cmd_AddCommand (""video"", CL_Video_f ); Cmd_AddCommand (""stopvideo"", CL_StopVideo_f ); Cmd_AddCommand( ""cache_startgather"", CL_Cache_StartGather_f ); Cmd_AddCommand( ""cache_usedfile"", CL_Cache_UsedFile_f ); Cmd_AddCommand( ""cache_setindex"", CL_Cache_SetIndex_f ); Cmd_AddCommand( ""cache_mapchange"", CL_Cache_MapChange_f ); Cmd_AddCommand( ""cache_endgather"", CL_Cache_EndGather_f ); Cmd_AddCommand( ""updatehunkusage"", CL_UpdateLevelHunkUsage ); Cmd_AddCommand( ""updatescreen"", SCR_UpdateScreen ); Cmd_AddCommand( ""cld"", CL_ClientDamageCommand ); Cmd_AddCommand( ""startMultiplayer"", CL_startMultiplayer_f ); // NERVE - SMF Cmd_AddCommand( ""shellExecute"", CL_ShellExecute_URL_f ); Cmd_AddCommand( ""map_restart"", CL_MapRestart_f ); Cmd_AddCommand( ""setRecommended"", CL_SetRecommended_f ); CL_InitRef(); SCR_Init(); Cvar_Set( ""cl_running"", ""1"" ); CL_GenerateQKey(); Cvar_Get( ""cl_guid"", """", CVAR_USERINFO | CVAR_ROM ); CL_UpdateGUID( NULL, 0 ); Com_Printf( ""----- Client Initialization Complete -----\n"" ); } ",1 "static inline bool is_icebp(u32 intr_info) { return (intr_info & (INTR_INFO_INTR_TYPE_MASK | INTR_INFO_VALID_MASK)) == (INTR_TYPE_PRIV_SW_EXCEPTION | INTR_INFO_VALID_MASK); } ",0 "GLES2DecoderImpl::GLES2DecoderImpl(ContextGroup* group) : GLES2Decoder(), group_(group), error_bits_(0), pack_alignment_(4), unpack_alignment_(4), attrib_0_buffer_id_(0), attrib_0_buffer_matches_value_(true), attrib_0_size_(0), fixed_attrib_buffer_id_(0), fixed_attrib_buffer_size_(0), active_texture_unit_(0), clear_red_(0), clear_green_(0), clear_blue_(0), clear_alpha_(0), mask_red_(true), mask_green_(true), mask_blue_(true), mask_alpha_(true), clear_stencil_(0), mask_stencil_front_(-1), mask_stencil_back_(-1), clear_depth_(1.0f), mask_depth_(true), enable_scissor_test_(false), enable_depth_test_(false), enable_stencil_test_(false), state_dirty_(true), offscreen_target_color_format_(0), offscreen_target_depth_format_(0), offscreen_target_stencil_format_(0), offscreen_target_samples_(0), offscreen_saved_color_format_(0), back_buffer_color_format_(0), back_buffer_has_depth_(false), back_buffer_has_stencil_(false), teximage2d_faster_than_texsubimage2d_(true), bufferdata_faster_than_buffersubdata_(true), current_decoder_error_(error::kNoError), use_shader_translator_(true), validators_(group_->feature_info()->validators()), feature_info_(group_->feature_info()), tex_image_2d_failed_(false), frame_number_(0), has_arb_robustness_(false), reset_status_(GL_NO_ERROR), needs_mac_nvidia_driver_workaround_(false) { DCHECK(group); attrib_0_value_.v[0] = 0.0f; attrib_0_value_.v[1] = 0.0f; attrib_0_value_.v[2] = 0.0f; attrib_0_value_.v[3] = 1.0f; if ((gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2 && !feature_info_->feature_flags().chromium_webglsl) || gfx::GetGLImplementation() == gfx::kGLImplementationMockGL) { use_shader_translator_ = false; } if (IsAngle()) { teximage2d_faster_than_texsubimage2d_ = false; bufferdata_faster_than_buffersubdata_ = false; } } ",0 "BOOLEAN btif_hl_is_reconnect_possible(UINT8 app_idx, UINT8 mcl_idx, int mdep_cfg_idx, tBTA_HL_DCH_OPEN_PARAM *p_dch_open_api, tBTA_HL_MDL_ID *p_mdl_id) { btif_hl_app_cb_t *p_acb = BTIF_HL_GET_APP_CB_PTR(app_idx); btif_hl_mcl_cb_t *p_mcb = BTIF_HL_GET_MCL_CB_PTR(app_idx, mcl_idx); tBTA_HL_DCH_CFG local_cfg = p_dch_open_api->local_cfg; tBTA_HL_DCH_MODE dch_mode = BTA_HL_DCH_MODE_RELIABLE; BOOLEAN use_mdl_dch_mode=FALSE; btif_hl_mdl_cfg_t *p_mdl; btif_hl_mdl_cfg_t *p_mdl1; UINT8 i, j; BOOLEAN is_reconnect_ok=FALSE; BOOLEAN stream_mode_avail=FALSE; UINT16 data_type = p_acb->sup_feature.mdep[mdep_cfg_idx].mdep_cfg.data_cfg[0].data_type; tBTA_HL_MDEP_ID peer_mdep_id = p_dch_open_api->peer_mdep_id; UINT8 mdl_idx; BTIF_TRACE_DEBUG(""%s app_idx=%d mcl_idx=%d mdep_cfg_idx=%d"", __FUNCTION__, app_idx, mcl_idx, mdep_cfg_idx ); switch (local_cfg) { case BTA_HL_DCH_CFG_NO_PREF: if (!btif_hl_is_the_first_reliable_existed(app_idx, mcl_idx)) { dch_mode = BTA_HL_DCH_MODE_RELIABLE; } else { use_mdl_dch_mode = TRUE; } break; case BTA_HL_DCH_CFG_RELIABLE: dch_mode = BTA_HL_DCH_MODE_RELIABLE; break; case BTA_HL_DCH_CFG_STREAMING: dch_mode = BTA_HL_DCH_MODE_STREAMING; break; default: BTIF_TRACE_ERROR(""Invalid local_cfg=%d"",local_cfg ); return is_reconnect_ok; break; } BTIF_TRACE_DEBUG(""local_cfg=%d use_mdl_dch_mode=%d dch_mode=%d "", local_cfg, use_mdl_dch_mode, dch_mode ); for (i=0, p_mdl=&p_acb->mdl_cfg[0] ; i< BTA_HL_NUM_MDL_CFGS; i++, p_mdl++ ) { if (p_mdl->base.active && p_mdl->extra.data_type ==data_type && (p_mdl->extra.peer_mdep_id != BTA_HL_INVALID_MDEP_ID && p_mdl->extra.peer_mdep_id == peer_mdep_id) && memcpy(p_mdl->base.peer_bd_addr, p_mcb->bd_addr,sizeof(BD_ADDR) ) && p_mdl->base.mdl_id && !btif_hl_find_mdl_idx(app_idx, mcl_idx,p_mdl->base.mdl_id, &mdl_idx)) { BTIF_TRACE_DEBUG(""i=%d Matched active=%d mdl_id =%d, mdl_dch_mode=%d"", i, p_mdl->base.active, p_mdl->base.mdl_id,p_mdl->base.dch_mode); if (!use_mdl_dch_mode) { if (p_mdl->base.dch_mode == dch_mode) { is_reconnect_ok = TRUE; *p_mdl_id = p_mdl->base.mdl_id; BTIF_TRACE_DEBUG(""reconnect is possible dch_mode=%d mdl_id=%d"", dch_mode, p_mdl->base.mdl_id ); break; } } else { is_reconnect_ok = TRUE; for (j=i, p_mdl1=&p_acb->mdl_cfg[i]; j< BTA_HL_NUM_MDL_CFGS; j++, p_mdl1++) { if (p_mdl1->base.active && p_mdl1->extra.data_type == data_type && (p_mdl1->extra.peer_mdep_id != BTA_HL_INVALID_MDEP_ID && p_mdl1->extra.peer_mdep_id == peer_mdep_id) && memcpy(p_mdl1->base.peer_bd_addr, p_mcb->bd_addr,sizeof(BD_ADDR)) && p_mdl1->base.dch_mode == BTA_HL_DCH_MODE_STREAMING) { stream_mode_avail = TRUE; BTIF_TRACE_DEBUG(""found streaming mode mdl index=%d"", j); break; } } if (stream_mode_avail) { dch_mode = BTA_HL_DCH_MODE_STREAMING; *p_mdl_id = p_mdl1->base.mdl_id; BTIF_TRACE_DEBUG(""reconnect is ok index=%d dch_mode=streaming mdl_id=%d"", j, *p_mdl_id); break; } else { dch_mode= p_mdl->base.dch_mode; *p_mdl_id = p_mdl->base.mdl_id; BTIF_TRACE_DEBUG(""reconnect is ok index=%d dch_mode=%d mdl_id=%d"", i, p_mdl->base.dch_mode, *p_mdl_id); break; } } } } BTIF_TRACE_DEBUG(""is_reconnect_ok dch_mode=%d mdl_id=%d"",is_reconnect_ok, dch_mode, *p_mdl_id); return is_reconnect_ok; } ",0 "static void do_reload(Cache* cache) { GSList* l; char buf[38]; int i; GFile* gf; int new_n_files; char **new_files = NULL; /* DEBUG(""Re-generation of cache is needed!""); */ /* DEBUG(""call menu-cache-gen to re-generate the cache""); */ memcpy( buf, ""REL:"", 4 ); memcpy( buf + 4, cache->md5, 32 ); buf[36] = '\n'; buf[37] = '\0'; if( ! regenerate_cache( cache->menu_name, cache->lang_name, cache->cache_file, cache->env, &new_n_files, &new_files ) ) { DEBUG(""regeneration of cache failed.""); return; } /* cancel old file monitors */ g_strfreev(cache->files); for( i = 0; i < cache->n_files; ++i ) { g_file_monitor_cancel( cache->mons[i] ); g_signal_handlers_disconnect_by_func( cache->mons[i], on_file_changed, cache ); g_object_unref( cache->mons[i] ); } /* g_file_monitor_cancel(cache->cache_mon); g_object_unref(cache->cache_mon); */ cache->n_files = new_n_files; cache->files = new_files; cache->mons = g_realloc( cache->mons, sizeof(GFileMonitor*)*(cache->n_files+1) ); /* create required file monitors */ for( i = 0; i < cache->n_files; ++i ) { gf = g_file_new_for_path( cache->files[i] + 1 ); if( cache->files[i][0] == 'D' ) cache->mons[i] = g_file_monitor_directory( gf, 0, NULL, NULL ); else cache->mons[i] = g_file_monitor_file( gf, 0, NULL, NULL ); g_signal_connect(cache->mons[i], ""changed"", G_CALLBACK(on_file_changed), cache); g_object_unref(gf); } /* gf = g_file_new_for_path( cache_file ); cache->cache_mon = g_file_monitor_file( gf, 0, NULL, NULL ); g_signal_connect( cache->cache_mon, ""changed"", on_file_changed, cache); g_object_unref(gf); */ /* notify the clients that reload is needed. */ for( l = cache->clients; l; ) { ClientIO *channel_io = (ClientIO *)l->data; GIOChannel* ch = channel_io->channel; l = l->next; /* do it beforehand, as client may be removed below */ if(write(g_io_channel_unix_get_fd(ch), buf, 37) < 37) { on_client_closed(channel_io); } } cache->need_reload = FALSE; } ",0 "static void sequenceStringMethodMethod(const v8::FunctionCallbackInfo& info) { TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); v8SetReturnValue(info, v8Array(imp->sequenceStringMethod(), info.GetIsolate())); } ",0 "void LayerTreeHost::SetPaintedDeviceScaleFactor( float painted_device_scale_factor) { if (painted_device_scale_factor_ == painted_device_scale_factor) return; painted_device_scale_factor_ = painted_device_scale_factor; SetNeedsCommit(); } ",0 "static int netlink_connect(struct socket *sock, struct sockaddr *addr, int alen, int flags) { int err = 0; struct sock *sk = sock->sk; struct netlink_sock *nlk = nlk_sk(sk); struct sockaddr_nl *nladdr = (struct sockaddr_nl *)addr; if (alen < sizeof(addr->sa_family)) return -EINVAL; if (addr->sa_family == AF_UNSPEC) { sk->sk_state = NETLINK_UNCONNECTED; nlk->dst_portid = 0; nlk->dst_group = 0; return 0; } if (addr->sa_family != AF_NETLINK) return -EINVAL; if ((nladdr->nl_groups || nladdr->nl_pid) && !netlink_allowed(sock, NL_CFG_F_NONROOT_SEND)) return -EPERM; /* No need for barriers here as we return to user-space without * using any of the bound attributes. */ if (!nlk->bound) err = netlink_autobind(sock); if (err == 0) { sk->sk_state = NETLINK_CONNECTED; nlk->dst_portid = nladdr->nl_pid; nlk->dst_group = ffs(nladdr->nl_groups); } return err; } ",0 "xt_register_matches(struct xt_match *match, unsigned int n) { unsigned int i; int err = 0; for (i = 0; i < n; i++) { err = xt_register_match(&match[i]); if (err) goto err; } return err; err: if (i > 0) xt_unregister_matches(match, i); return err; } ",0 "transit_hash_alloc (void *p) { /* Transit structure is already allocated. */ return p; } ",0 "static int validateseparationspace(i_ctx_t * i_ctx_p, ref **space) { int code = 0; ref *sepspace = *space; ref nameref, sref, sname, altspace, tref; if (!r_is_array(sepspace)) return_error(gs_error_typecheck); /* Validate parameters, check we have enough operands */ if (r_size(sepspace) != 4) return_error(gs_error_rangecheck); /* Check separation name is a string or name object */ code = array_get(imemory, sepspace, 1, &sname); if (code < 0) return code; if (!r_has_type(&sname, t_name)) { if (!r_has_type(&sname, t_string)) return_error(gs_error_typecheck); else { code = name_from_string(imemory, &sname, &sname); if (code < 0) return code; } } /* Check the tint transform is a procedure */ code = array_get(imemory, sepspace, 3, &tref); if (code < 0) return code; check_proc(tref); /* Get the name of the alternate space */ code = array_get(imemory, sepspace, 2, &altspace); if (code < 0) return code; if (r_has_type(&altspace, t_name)) ref_assign(&nameref, &altspace); else { /* Make sure the alternate space is an array */ if (!r_is_array(&altspace)) return_error(gs_error_typecheck); /* And has a name for its type */ code = array_get(imemory, &altspace, 0, &tref); if (code < 0) return code; if (!r_has_type(&tref, t_name)) return_error(gs_error_typecheck); ref_assign(&nameref, &tref); } /* Convert alternate space name to string */ name_string_ref(imemory, &nameref, &sref); /* Check its not /Indexed or /Pattern or /DeviceN */ if (r_size(&sref) == 7) { if (strncmp((const char *)sref.value.const_bytes, ""Indexed"", 7) == 0) return_error(gs_error_typecheck); if (strncmp((const char *)sref.value.const_bytes, ""Pattern"", 7) == 0) return_error(gs_error_typecheck); if (strncmp((const char *)sref.value.const_bytes, ""DeviceN"", 7) == 0) return_error(gs_error_typecheck); } /* and also not /Separation */ if (r_size(&sref) == 9 && strncmp((const char *)sref.value.const_bytes, ""Separation"", 9) == 0) return_error(gs_error_typecheck); ref_assign(*space, &altspace); return 0; } ",0 "bool LayoutSVGResourceMarker::calculateLocalTransform() { return selfNeedsLayout(); } ",1 "find_linfo(const struct bpf_verifier_env *env, u32 insn_off) { const struct bpf_line_info *linfo; const struct bpf_prog *prog; u32 i, nr_linfo; prog = env->prog; nr_linfo = prog->aux->nr_linfo; if (!nr_linfo || insn_off >= prog->len) return NULL; linfo = prog->aux->linfo; for (i = 1; i < nr_linfo; i++) if (insn_off < linfo[i].insn_off) break; return &linfo[i - 1]; } ",0 "static int kvm_vcpu_fault(struct vm_area_struct *vma, struct vm_fault *vmf) { struct kvm_vcpu *vcpu = vma->vm_file->private_data; struct page *page; if (vmf->pgoff == 0) page = virt_to_page(vcpu->run); #ifdef CONFIG_X86 else if (vmf->pgoff == KVM_PIO_PAGE_OFFSET) page = virt_to_page(vcpu->arch.pio_data); #endif #ifdef KVM_COALESCED_MMIO_PAGE_OFFSET else if (vmf->pgoff == KVM_COALESCED_MMIO_PAGE_OFFSET) page = virt_to_page(vcpu->kvm->coalesced_mmio_ring); #endif else return kvm_arch_vcpu_fault(vcpu, vmf); get_page(page); vmf->page = page; return 0; } ",0 "PredictorDecodeTile(TIFF* tif, uint8* op0, tmsize_t occ0, uint16 s) { TIFFPredictorState *sp = PredictorState(tif); assert(sp != NULL); assert(sp->decodetile != NULL); if ((*sp->decodetile)(tif, op0, occ0, s)) { tmsize_t rowsize = sp->rowsize; assert(rowsize > 0); assert((occ0%rowsize)==0); assert(sp->decodepfunc != NULL); while (occ0 > 0) { (*sp->decodepfunc)(tif, op0, rowsize); occ0 -= rowsize; op0 += rowsize; } return 1; } else return 0; } ",1 "void WindowTreeHostManager::PreDisplayConfigurationChange(bool clear_focus) { FOR_EACH_OBSERVER(Observer, observers_, OnDisplayConfigurationChanging()); focus_activation_store_->Store(clear_focus); display::Screen* screen = display::Screen::GetScreen(); gfx::Point point_in_screen = screen->GetCursorScreenPoint(); cursor_location_in_screen_coords_for_restore_ = point_in_screen; display::Display display = screen->GetDisplayNearestPoint(point_in_screen); cursor_display_id_for_restore_ = display.id(); gfx::Point point_in_native = point_in_screen; aura::Window* root_window = GetRootWindowForDisplayId(display.id()); ::wm::ConvertPointFromScreen(root_window, &point_in_native); root_window->GetHost()->ConvertPointToNativeScreen(&point_in_native); cursor_location_in_native_coords_for_restore_ = point_in_native; } ",0 "static netdev_features_t netdev_sync_upper_features(struct net_device *lower, struct net_device *upper, netdev_features_t features) { netdev_features_t upper_disables = NETIF_F_UPPER_DISABLES; netdev_features_t feature; int feature_bit; for_each_netdev_feature(&upper_disables, feature_bit) { feature = __NETIF_F_BIT(feature_bit); if (!(upper->wanted_features & feature) && (features & feature)) { netdev_dbg(lower, ""Dropping feature %pNF, upper dev %s has it off.\n"", &feature, upper->name); features &= ~feature; } } return features; } ",0 "void DataReductionProxyIOData::OnCacheCleared(const base::Time start, const base::Time end) { DCHECK(io_task_runner_->BelongsToCurrentThread()); network_properties_manager_->DeleteHistory(); } ",0 "svc_pool_map_put(void) { struct svc_pool_map *m = &svc_pool_map; mutex_lock(&svc_pool_map_mutex); if (!--m->count) { kfree(m->to_pool); m->to_pool = NULL; kfree(m->pool_to); m->pool_to = NULL; m->npools = 0; } mutex_unlock(&svc_pool_map_mutex); } ",0 "gs_currentlabicc(const gs_gstate * pgs, gs_param_string * pval) { static const char *const rfs = LAB_ICC; pval->data = (const byte *)( (pgs->icc_manager->lab_profile == NULL) ? rfs : pgs->icc_manager->lab_profile->name); pval->size = strlen((const char *)pval->data); pval->persistent = true; } ",0 "void WebSocketJob::SetWaiting() { waiting_ = true; } ",0 "static char *fgets_extending(char **buf, int *buflen, FILE *stream) { char *rc; char endchar; int offset = 0; char *newbuf; do{ rc = fgets(&((*buf)[offset]), *buflen-offset, stream); if(feof(stream)){ return rc; } endchar = (*buf)[strlen(*buf)-1]; if(endchar == '\n'){ return rc; } /* No EOL char found, so extend buffer */ offset = *buflen-1; *buflen += 1000; newbuf = realloc(*buf, *buflen); if(!newbuf){ return NULL; } *buf = newbuf; }while(1); } ",0 " void LayerWebKitThread::setNeedsCommit() { if (m_owner) m_owner->notifySyncRequired(); } ",1 "_tls_tl_close_sockinfo (struct _tls_stream *sockinfo) { if (sockinfo->socket > 0) { if (sockinfo->ssl_conn != NULL) { SSL_shutdown (sockinfo->ssl_conn); SSL_shutdown (sockinfo->ssl_conn); SSL_free (sockinfo->ssl_conn); } if (sockinfo->ssl_ctx != NULL) SSL_CTX_free (sockinfo->ssl_ctx); closesocket (sockinfo->socket); } if (sockinfo->buf != NULL) osip_free (sockinfo->buf); if (sockinfo->sendbuf != NULL) osip_free (sockinfo->sendbuf); #ifdef MULTITASKING_ENABLED if (sockinfo->readStream != NULL) { CFReadStreamClose (sockinfo->readStream); CFRelease (sockinfo->readStream); } if (sockinfo->writeStream != NULL) { CFWriteStreamClose (sockinfo->writeStream); CFRelease (sockinfo->writeStream); } #endif memset (sockinfo, 0, sizeof (*sockinfo)); } ",0 "static int skcipher_encrypt_blkcipher(struct skcipher_request *req) { struct crypto_skcipher *skcipher = crypto_skcipher_reqtfm(req); struct crypto_tfm *tfm = crypto_skcipher_tfm(skcipher); struct blkcipher_alg *alg = &tfm->__crt_alg->cra_blkcipher; return skcipher_crypt_blkcipher(req, alg->encrypt); } ",0 "do_os_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type, int swap, uint32_t namesz, uint32_t descsz, size_t noff, size_t doff, int *flags) { if (namesz == 5 && strcmp((char *)&nbuf[noff], ""SuSE"") == 0 && type == NT_GNU_VERSION && descsz == 2) { *flags |= FLAGS_DID_OS_NOTE; file_printf(ms, "", for SuSE %d.%d"", nbuf[doff], nbuf[doff + 1]); return 1; } if (namesz == 4 && strcmp((char *)&nbuf[noff], ""GNU"") == 0 && type == NT_GNU_VERSION && descsz == 16) { uint32_t desc[4]; (void)memcpy(desc, &nbuf[doff], sizeof(desc)); *flags |= FLAGS_DID_OS_NOTE; if (file_printf(ms, "", for GNU/"") == -1) return 1; switch (elf_getu32(swap, desc[0])) { case GNU_OS_LINUX: if (file_printf(ms, ""Linux"") == -1) return 1; break; case GNU_OS_HURD: if (file_printf(ms, ""Hurd"") == -1) return 1; break; case GNU_OS_SOLARIS: if (file_printf(ms, ""Solaris"") == -1) return 1; break; case GNU_OS_KFREEBSD: if (file_printf(ms, ""kFreeBSD"") == -1) return 1; break; case GNU_OS_KNETBSD: if (file_printf(ms, ""kNetBSD"") == -1) return 1; break; default: if (file_printf(ms, """") == -1) return 1; } if (file_printf(ms, "" %d.%d.%d"", elf_getu32(swap, desc[1]), elf_getu32(swap, desc[2]), elf_getu32(swap, desc[3])) == -1) return 1; return 1; } if (namesz == 7 && strcmp((char *)&nbuf[noff], ""NetBSD"") == 0) { if (type == NT_NETBSD_VERSION && descsz == 4) { *flags |= FLAGS_DID_OS_NOTE; do_note_netbsd_version(ms, swap, &nbuf[doff]); return 1; } } if (namesz == 8 && strcmp((char *)&nbuf[noff], ""FreeBSD"") == 0) { if (type == NT_FREEBSD_VERSION && descsz == 4) { *flags |= FLAGS_DID_OS_NOTE; do_note_freebsd_version(ms, swap, &nbuf[doff]); return 1; } } if (namesz == 8 && strcmp((char *)&nbuf[noff], ""OpenBSD"") == 0 && type == NT_OPENBSD_VERSION && descsz == 4) { *flags |= FLAGS_DID_OS_NOTE; if (file_printf(ms, "", for OpenBSD"") == -1) return 1; /* Content of note is always 0 */ return 1; } if (namesz == 10 && strcmp((char *)&nbuf[noff], ""DragonFly"") == 0 && type == NT_DRAGONFLY_VERSION && descsz == 4) { uint32_t desc; *flags |= FLAGS_DID_OS_NOTE; if (file_printf(ms, "", for DragonFly"") == -1) return 1; (void)memcpy(&desc, &nbuf[doff], sizeof(desc)); desc = elf_getu32(swap, desc); if (file_printf(ms, "" %d.%d.%d"", desc / 100000, desc / 10000 % 10, desc % 10000) == -1) return 1; return 1; } return 0; } ",0 " virtual void SetWebSocketHandshakeMessage( const char* request, const char* response) { handshake_request_ = request; handshake_response_ = response; } ",0 "standard_check_text(png_const_structp pp, png_const_textp tp, png_const_charp keyword, png_const_charp text) { char msg[1024]; size_t pos = safecat(msg, sizeof msg, 0, ""text: ""); size_t ok; pos = safecat(msg, sizeof msg, pos, keyword); pos = safecat(msg, sizeof msg, pos, "": ""); ok = pos; if (tp->compression != TEXT_COMPRESSION) { char buf[64]; sprintf(buf, ""compression [%d->%d], "", TEXT_COMPRESSION, tp->compression); pos = safecat(msg, sizeof msg, pos, buf); } if (tp->key == NULL || strcmp(tp->key, keyword) != 0) { pos = safecat(msg, sizeof msg, pos, ""keyword \""""); if (tp->key != NULL) { pos = safecat(msg, sizeof msg, pos, tp->key); pos = safecat(msg, sizeof msg, pos, ""\"", ""); } else pos = safecat(msg, sizeof msg, pos, ""null, ""); } if (tp->text == NULL) pos = safecat(msg, sizeof msg, pos, ""text lost, ""); else { if (tp->text_length != strlen(text)) { char buf[64]; sprintf(buf, ""text length changed[%lu->%lu], "", (unsigned long)strlen(text), (unsigned long)tp->text_length); pos = safecat(msg, sizeof msg, pos, buf); } if (strcmp(tp->text, text) != 0) { pos = safecat(msg, sizeof msg, pos, ""text becomes \""""); pos = safecat(msg, sizeof msg, pos, tp->text); pos = safecat(msg, sizeof msg, pos, ""\"" (was \""""); pos = safecat(msg, sizeof msg, pos, text); pos = safecat(msg, sizeof msg, pos, ""\""), ""); } } if (tp->itxt_length != 0) pos = safecat(msg, sizeof msg, pos, ""iTXt length set, ""); if (tp->lang != NULL) { pos = safecat(msg, sizeof msg, pos, ""iTXt language \""""); pos = safecat(msg, sizeof msg, pos, tp->lang); pos = safecat(msg, sizeof msg, pos, ""\"", ""); } if (tp->lang_key != NULL) { pos = safecat(msg, sizeof msg, pos, ""iTXt keyword \""""); pos = safecat(msg, sizeof msg, pos, tp->lang_key); pos = safecat(msg, sizeof msg, pos, ""\"", ""); } if (pos > ok) { msg[pos-2] = '\0'; /* Remove the "", "" at the end */ png_error(pp, msg); } } ",0 "static int _hid_get_report_descriptor(struct hid_device_priv* dev, void *data, size_t *size) { uint8_t d[MAX_HID_DESCRIPTOR_SIZE]; size_t i = 0; /* usage page (0xFFA0 == vendor defined) */ d[i++] = 0x06; d[i++] = 0xA0; d[i++] = 0xFF; /* usage (vendor defined) */ d[i++] = 0x09; d[i++] = 0x01; /* start collection (application) */ d[i++] = 0xA1; d[i++] = 0x01; /* input report */ if (dev->input_report_size) { /* usage (vendor defined) */ d[i++] = 0x09; d[i++] = 0x01; /* logical minimum (0) */ d[i++] = 0x15; d[i++] = 0x00; /* logical maximum (255) */ d[i++] = 0x25; d[i++] = 0xFF; /* report size (8 bits) */ d[i++] = 0x75; d[i++] = 0x08; /* report count */ d[i++] = 0x95; d[i++] = (uint8_t)dev->input_report_size - 1; /* input (data, variable, absolute) */ d[i++] = 0x81; d[i++] = 0x00; } /* output report */ if (dev->output_report_size) { /* usage (vendor defined) */ d[i++] = 0x09; d[i++] = 0x02; /* logical minimum (0) */ d[i++] = 0x15; d[i++] = 0x00; /* logical maximum (255) */ d[i++] = 0x25; d[i++] = 0xFF; /* report size (8 bits) */ d[i++] = 0x75; d[i++] = 0x08; /* report count */ d[i++] = 0x95; d[i++] = (uint8_t)dev->output_report_size - 1; /* output (data, variable, absolute) */ d[i++] = 0x91; d[i++] = 0x00; } /* feature report */ if (dev->feature_report_size) { /* usage (vendor defined) */ d[i++] = 0x09; d[i++] = 0x03; /* logical minimum (0) */ d[i++] = 0x15; d[i++] = 0x00; /* logical maximum (255) */ d[i++] = 0x25; d[i++] = 0xFF; /* report size (8 bits) */ d[i++] = 0x75; d[i++] = 0x08; /* report count */ d[i++] = 0x95; d[i++] = (uint8_t)dev->feature_report_size - 1; /* feature (data, variable, absolute) */ d[i++] = 0xb2; d[i++] = 0x02; d[i++] = 0x01; } /* end collection */ d[i++] = 0xC0; if (*size > i) *size = i; memcpy(data, d, *size); return LIBUSB_COMPLETED; } ",1 "float RenderViewImpl::GetZoomLevel() const { return page_zoom_level_; } ",0 "InspectorScheduleStyleInvalidationTrackingEvent::AttributeChange( Element& element, const InvalidationSet& invalidation_set, const QualifiedName& attribute_name) { std::unique_ptr value = FillCommonPart(element, invalidation_set, kAttribute); value->SetString(""changedAttribute"", attribute_name.ToString()); return value; } ",0 "static double pcerr(PNG_CONST png_modifier *pm, int in_depth, int out_depth) { /* Percentage error permitted in the linear values. Note that the specified * value is a percentage but this routine returns a simple number. */ if (pm->assume_16_bit_calculations || (pm->calculations_use_input_precision ? in_depth : out_depth) == 16) return pm->maxpc16 * .01; else return pm->maxpc8 * .01; } ",1 "void InterstitialPageImpl::Cut() { FrameTreeNode* focused_node = frame_tree_->GetFocusedFrame(); if (!focused_node) return; focused_node->current_frame_host()->GetFrameInputHandler()->Cut(); RecordAction(base::UserMetricsAction(""Cut"")); } ",0 "void InspectorAccessibilityAgent::fillCoreProperties( AXObject& axObject, AXObject* inspectedAXObject, bool fetchRelatives, AXNode& nodeObject, std::unique_ptr>& nodes, AXObjectCacheImpl& cache) const { AXNameFrom nameFrom; AXObject::AXObjectVector nameObjects; axObject.name(nameFrom, &nameObjects); AXDescriptionFrom descriptionFrom; AXObject::AXObjectVector descriptionObjects; String description = axObject.description(nameFrom, descriptionFrom, &descriptionObjects); if (!description.isEmpty()) { nodeObject.setDescription( createValue(description, AXValueTypeEnum::ComputedString)); } if (axObject.supportsRangeValue()) { nodeObject.setValue(createValue(axObject.valueForRange())); } else { String stringValue = axObject.stringValue(); if (!stringValue.isEmpty()) nodeObject.setValue(createValue(stringValue)); } if (fetchRelatives) populateRelatives(axObject, inspectedAXObject, nodeObject, nodes, cache); Node* node = axObject.getNode(); if (node) nodeObject.setBackendDOMNodeId(DOMNodeIds::idForNode(node)); } ",0 "void GLES2DecoderImpl::DoRegisterSharedIdsCHROMIUM( GLuint namespace_id, GLsizei n, const GLuint* ids) { IdAllocatorInterface* id_allocator = group_->GetIdAllocator(namespace_id); for (GLsizei ii = 0; ii < n; ++ii) { if (!id_allocator->MarkAsUsed(ids[ii])) { for (GLsizei jj = 0; jj < ii; ++jj) { id_allocator->FreeID(ids[jj]); } SetGLError( GL_INVALID_VALUE, ""RegisterSharedIdsCHROMIUM"", ""attempt to register id that already exists""); return; } } } ",0 "tracing_trace_options_write(struct file *filp, const char __user *ubuf, size_t cnt, loff_t *ppos) { struct seq_file *m = filp->private_data; struct trace_array *tr = m->private; char buf[64]; int ret; if (cnt >= sizeof(buf)) return -EINVAL; if (copy_from_user(buf, ubuf, cnt)) return -EFAULT; buf[cnt] = 0; ret = trace_set_options(tr, buf); if (ret < 0) return ret; *ppos += cnt; return cnt; } ",0 "ofputil_encode_flow_removed(const struct ofputil_flow_removed *fr, enum ofputil_protocol protocol) { struct ofpbuf *msg; enum ofp_flow_removed_reason reason = fr->reason; if (reason == OFPRR_METER_DELETE && !(protocol & OFPUTIL_P_OF14_UP)) { reason = OFPRR_DELETE; } switch (protocol) { case OFPUTIL_P_OF11_STD: case OFPUTIL_P_OF12_OXM: case OFPUTIL_P_OF13_OXM: case OFPUTIL_P_OF14_OXM: case OFPUTIL_P_OF15_OXM: case OFPUTIL_P_OF16_OXM: { struct ofp12_flow_removed *ofr; msg = ofpraw_alloc_xid(OFPRAW_OFPT11_FLOW_REMOVED, ofputil_protocol_to_ofp_version(protocol), htonl(0), ofputil_match_typical_len(protocol)); ofr = ofpbuf_put_zeros(msg, sizeof *ofr); ofr->cookie = fr->cookie; ofr->priority = htons(fr->priority); ofr->reason = reason; ofr->table_id = fr->table_id; ofr->duration_sec = htonl(fr->duration_sec); ofr->duration_nsec = htonl(fr->duration_nsec); ofr->idle_timeout = htons(fr->idle_timeout); ofr->hard_timeout = htons(fr->hard_timeout); ofr->packet_count = htonll(fr->packet_count); ofr->byte_count = htonll(fr->byte_count); ofputil_put_ofp11_match(msg, &fr->match, protocol); break; } case OFPUTIL_P_OF10_STD: case OFPUTIL_P_OF10_STD_TID: { struct ofp10_flow_removed *ofr; msg = ofpraw_alloc_xid(OFPRAW_OFPT10_FLOW_REMOVED, OFP10_VERSION, htonl(0), 0); ofr = ofpbuf_put_zeros(msg, sizeof *ofr); ofputil_match_to_ofp10_match(&fr->match, &ofr->match); ofr->cookie = fr->cookie; ofr->priority = htons(fr->priority); ofr->reason = reason; ofr->duration_sec = htonl(fr->duration_sec); ofr->duration_nsec = htonl(fr->duration_nsec); ofr->idle_timeout = htons(fr->idle_timeout); ofr->packet_count = htonll(unknown_to_zero(fr->packet_count)); ofr->byte_count = htonll(unknown_to_zero(fr->byte_count)); break; } case OFPUTIL_P_OF10_NXM: case OFPUTIL_P_OF10_NXM_TID: { struct nx_flow_removed *nfr; int match_len; msg = ofpraw_alloc_xid(OFPRAW_NXT_FLOW_REMOVED, OFP10_VERSION, htonl(0), NXM_TYPICAL_LEN); ofpbuf_put_zeros(msg, sizeof *nfr); match_len = nx_put_match(msg, &fr->match, 0, 0); nfr = msg->msg; nfr->cookie = fr->cookie; nfr->priority = htons(fr->priority); nfr->reason = reason; nfr->table_id = fr->table_id + 1; nfr->duration_sec = htonl(fr->duration_sec); nfr->duration_nsec = htonl(fr->duration_nsec); nfr->idle_timeout = htons(fr->idle_timeout); nfr->match_len = htons(match_len); nfr->packet_count = htonll(fr->packet_count); nfr->byte_count = htonll(fr->byte_count); break; } default: OVS_NOT_REACHED(); } return msg; } ",0 "static void nfs4_opendata_free(struct kref *kref) { struct nfs4_opendata *p = container_of(kref, struct nfs4_opendata, kref); struct super_block *sb = p->dentry->d_sb; nfs_free_seqid(p->o_arg.seqid); if (p->state != NULL) nfs4_put_open_state(p->state); nfs4_put_state_owner(p->owner); nfs4_label_free(p->a_label); nfs4_label_free(p->f_label); dput(p->dir); dput(p->dentry); nfs_sb_deactive(sb); nfs_fattr_free_names(&p->f_attr); kfree(p->f_attr.mdsthreshold); kfree(p); } ",0 "static void CacheThru_write(HTStream *me, const char *str, int l) { if (me->status == HT_OK && l != 0) { if (me->fp) { if (fwrite(str, (size_t) 1, (size_t) l, me->fp) < (size_t) l || ferror(me->fp)) { me->status = HT_ERROR; } } else if (me->chunk) { me->last_chunk = HTChunkPutb2(me->last_chunk, str, l); if (me->last_chunk == NULL || me->last_chunk->allocated == 0) me->status = HT_ERROR; } } (*me->actions->put_block) (me->target, str, l); } ",0 " bool PolicyKitBackend::isCallerAuthorized(const QString &action, QByteArray callerID) { QDataStream s(&callerID, QIODevice::ReadOnly); } ",0 "void RenderThreadImpl::AddFilter(IPC::MessageFilter* filter) { channel()->AddFilter(filter); } ",0 "static void sctp_control_release_owner(struct sk_buff *skb) { /*TODO: do memory release */ } ",0 "int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint16_t *flags, QCryptoTLSCreds *tlscreds, const char *hostname, QIOChannel **outioc, off_t *size, Error **errp) { char buf[256]; uint64_t magic, s; int rc; bool zeroes = true; TRACE(""Receiving negotiation tlscreds=%p hostname=%s."", tlscreds, hostname ? hostname : """"); rc = -EINVAL; if (outioc) { *outioc = NULL; } if (tlscreds && !outioc) { error_setg(errp, ""Output I/O channel required for TLS""); goto fail; } if (read_sync(ioc, buf, 8) != 8) { error_setg(errp, ""Failed to read data""); goto fail; } buf[8] = '\0'; if (strlen(buf) == 0) { error_setg(errp, ""Server connection closed unexpectedly""); goto fail; } TRACE(""Magic is %c%c%c%c%c%c%c%c"", qemu_isprint(buf[0]) ? buf[0] : '.', qemu_isprint(buf[1]) ? buf[1] : '.', qemu_isprint(buf[2]) ? buf[2] : '.', qemu_isprint(buf[3]) ? buf[3] : '.', qemu_isprint(buf[4]) ? buf[4] : '.', qemu_isprint(buf[5]) ? buf[5] : '.', qemu_isprint(buf[6]) ? buf[6] : '.', qemu_isprint(buf[7]) ? buf[7] : '.'); if (memcmp(buf, ""NBDMAGIC"", 8) != 0) { error_setg(errp, ""Invalid magic received""); goto fail; } if (read_sync(ioc, &magic, sizeof(magic)) != sizeof(magic)) { error_setg(errp, ""Failed to read magic""); goto fail; } magic = be64_to_cpu(magic); TRACE(""Magic is 0x%"" PRIx64, magic); if (magic == NBD_OPTS_MAGIC) { uint32_t clientflags = 0; uint16_t globalflags; bool fixedNewStyle = false; if (read_sync(ioc, &globalflags, sizeof(globalflags)) != sizeof(globalflags)) { error_setg(errp, ""Failed to read server flags""); goto fail; } globalflags = be16_to_cpu(globalflags); TRACE(""Global flags are %"" PRIx32, globalflags); if (globalflags & NBD_FLAG_FIXED_NEWSTYLE) { fixedNewStyle = true; TRACE(""Server supports fixed new style""); clientflags |= NBD_FLAG_C_FIXED_NEWSTYLE; } if (globalflags & NBD_FLAG_NO_ZEROES) { zeroes = false; TRACE(""Server supports no zeroes""); clientflags |= NBD_FLAG_C_NO_ZEROES; } /* client requested flags */ clientflags = cpu_to_be32(clientflags); if (write_sync(ioc, &clientflags, sizeof(clientflags)) != sizeof(clientflags)) { error_setg(errp, ""Failed to send clientflags field""); goto fail; } if (tlscreds) { if (fixedNewStyle) { *outioc = nbd_receive_starttls(ioc, tlscreds, hostname, errp); if (!*outioc) { goto fail; } ioc = *outioc; } else { error_setg(errp, ""Server does not support STARTTLS""); goto fail; } } if (!name) { TRACE(""Using default NBD export name \""\""""); name = """"; } if (fixedNewStyle) { /* Check our desired export is present in the * server export list. Since NBD_OPT_EXPORT_NAME * cannot return an error message, running this * query gives us good error reporting if the * server required TLS */ if (nbd_receive_query_exports(ioc, name, errp) < 0) { goto fail; } } /* write the export name request */ if (nbd_send_option_request(ioc, NBD_OPT_EXPORT_NAME, -1, name, errp) < 0) { goto fail; } /* Read the response */ if (read_sync(ioc, &s, sizeof(s)) != sizeof(s)) { error_setg(errp, ""Failed to read export length""); goto fail; } *size = be64_to_cpu(s); if (read_sync(ioc, flags, sizeof(*flags)) != sizeof(*flags)) { error_setg(errp, ""Failed to read export flags""); goto fail; } be16_to_cpus(flags); } else if (magic == NBD_CLIENT_MAGIC) { uint32_t oldflags; if (name) { error_setg(errp, ""Server does not support export names""); goto fail; } if (tlscreds) { error_setg(errp, ""Server does not support STARTTLS""); goto fail; } if (read_sync(ioc, &s, sizeof(s)) != sizeof(s)) { error_setg(errp, ""Failed to read export length""); goto fail; } *size = be64_to_cpu(s); TRACE(""Size is %"" PRIu64, *size); if (read_sync(ioc, &oldflags, sizeof(oldflags)) != sizeof(oldflags)) { error_setg(errp, ""Failed to read export flags""); goto fail; } be32_to_cpus(&oldflags); if (oldflags & ~0xffff) { error_setg(errp, ""Unexpected export flags %0x"" PRIx32, oldflags); goto fail; } *flags = oldflags; } else { error_setg(errp, ""Bad magic received""); goto fail; } TRACE(""Size is %"" PRIu64 "", export flags %"" PRIx16, *size, *flags); if (zeroes && drop_sync(ioc, 124) != 124) { error_setg(errp, ""Failed to read reserved block""); goto fail; } rc = 0; fail: return rc; } ",0 "void Editor::registerCommandGroup(CompositeEditCommand* commandGroupWrapper) { DCHECK(commandGroupWrapper->isCommandGroupWrapper()); m_lastEditCommand = commandGroupWrapper; } ",0 "ushort * CLASS ljpeg_row (int jrow, struct jhead *jh) { int col, c, diff, pred, spred=0; ushort mark=0, *row[3]; if (jrow * jh->wide % jh->restart == 0) { FORC(6) jh->vpred[c] = 1 << (jh->bits-1); if (jrow) { fseek (ifp, -2, SEEK_CUR); do mark = (mark << 8) + (c = fgetc(ifp)); while (c != EOF && mark >> 4 != 0xffd); } getbits(-1); } FORC3 row[c] = jh->row + jh->wide*jh->clrs*((jrow+c) & 1); for (col=0; col < jh->wide; col++) FORC(jh->clrs) { diff = ljpeg_diff (jh->huff[c]); if (jh->sraw && c <= jh->sraw && (col | c)) pred = spred; else if (col) pred = row[0][-jh->clrs]; else pred = (jh->vpred[c] += diff) - diff; if (jrow && col) switch (jh->psv) { case 1: break; case 2: pred = row[1][0]; break; case 3: pred = row[1][-jh->clrs]; break; case 4: pred = pred + row[1][0] - row[1][-jh->clrs]; break; case 5: pred = pred + ((row[1][0] - row[1][-jh->clrs]) >> 1); break; case 6: pred = row[1][0] + ((pred - row[1][-jh->clrs]) >> 1); break; case 7: pred = (pred + row[1][0]) >> 1; break; default: pred = 0; } if ((**row = pred + diff) >> jh->bits) derror(); if (c <= jh->sraw) spred = **row; row[0]++; row[1]++; } return row[2]; } ",0 "bool ChildProcessSecurityPolicyImpl::CanReadFileSystem( int child_id, const std::string& filesystem_id) { return HasPermissionsForFileSystem(child_id, filesystem_id, kReadFilePermissions); } ",0 "int armpmu_event_set_period(struct perf_event *event) { struct arm_pmu *armpmu = to_arm_pmu(event->pmu); struct hw_perf_event *hwc = &event->hw; s64 left = local64_read(&hwc->period_left); s64 period = hwc->sample_period; int ret = 0; /* The period may have been changed by PERF_EVENT_IOC_PERIOD */ if (unlikely(period != hwc->last_period)) left = period - (hwc->last_period - left); if (unlikely(left <= -period)) { left = period; local64_set(&hwc->period_left, left); hwc->last_period = period; ret = 1; } if (unlikely(left <= 0)) { left += period; local64_set(&hwc->period_left, left); hwc->last_period = period; ret = 1; } if (left > (s64)armpmu->max_period) left = armpmu->max_period; local64_set(&hwc->prev_count, (u64)-left); armpmu->write_counter(event, (u64)(-left) & 0xffffffff); perf_event_update_userpage(event); return ret; } ",0 "gboolean menu_cache_item_unref(MenuCacheItem* item) { /* DEBUG(""item_unref(%s): %d"", item->id, item->n_ref); */ /* We need a lock here unfortunately since another thread may have access to it via some child->parent which isn't protected by reference */ MENU_CACHE_LOCK; /* lock may be recursive here */ if( g_atomic_int_dec_and_test( &item->n_ref ) ) { /* DEBUG(""free item: %s"", item->id); */ g_free( item->id ); g_free( item->name ); g_free( item->comment ); g_free( item->icon ); menu_cache_file_dir_unref(item->file_dir); if( item->file_name && item->file_name != item->id ) g_free( item->file_name ); if( item->parent ) { /* DEBUG(""remove %s from parent %s"", item->id, MENU_CACHE_ITEM(item->parent)->id); */ /* remove ourselve from the parent node. */ item->parent->children = g_slist_remove(item->parent->children, item); } if( item->type == MENU_CACHE_TYPE_DIR ) { MenuCacheDir* dir = MENU_CACHE_DIR(item); GSList* l; for(l = dir->children; l; ) { MenuCacheItem* child = MENU_CACHE_ITEM(l->data); /* remove ourselve from the children. */ child->parent = NULL; l = l->next; menu_cache_item_unref(child); } g_slist_free( dir->children ); g_slice_free( MenuCacheDir, dir ); } else { MenuCacheApp* app = MENU_CACHE_APP(item); g_free( app->exec ); g_free(app->try_exec); g_free(app->working_dir); g_free(app->categories); g_free(app->keywords); g_slice_free( MenuCacheApp, app ); } } MENU_CACHE_UNLOCK; return FALSE; } ",0 "gfx::PointF PDFiumEngine::TransformPagePoint(int page_index, const gfx::PointF& page_xy) { DCHECK(PageIndexInBounds(page_index)); return pages_[page_index]->TransformPageToScreenXY(page_xy); } ",0 "static int jp2_colr_putdata(jp2_box_t *box, jas_stream_t *out) { jp2_colr_t *colr = &box->data.colr; if (jp2_putuint8(out, colr->method) || jp2_putuint8(out, colr->pri) || jp2_putuint8(out, colr->approx)) { return -1; } switch (colr->method) { case JP2_COLR_ENUM: if (jp2_putuint32(out, colr->csid)) { return -1; } break; case JP2_COLR_ICC: if (jas_stream_write(out, colr->iccp, JAS_CAST(int, colr->iccplen)) != JAS_CAST(int, colr->iccplen)) return -1; break; } return 0; } ",0 "int test_gf2m_mod_solve_quad(BIO *bp,BN_CTX *ctx) { BIGNUM *a,*b[2],*c,*d,*e; int i, j, s = 0, t, ret = 0; int p0[] = {163,7,6,3,0,-1}; int p1[] = {193,15,0,-1}; a=BN_new(); b[0]=BN_new(); b[1]=BN_new(); c=BN_new(); d=BN_new(); e=BN_new(); BN_GF2m_arr2poly(p0, b[0]); BN_GF2m_arr2poly(p1, b[1]); for (i=0; iapi_version)) { return (FALSE); } if (!xdr_krb5_principal(xdrs, &objp->princ)) { return (FALSE); } if (!xdr_krb5_boolean(xdrs, &objp->keepold)) { return (FALSE); } if (!xdr_array(xdrs, (caddr_t *)&objp->ks_tuple, (unsigned int*)&objp->n_ks_tuple, ~0, sizeof(krb5_key_salt_tuple), xdr_krb5_key_salt_tuple)) { return (FALSE); } if (!xdr_nullstring(xdrs, &objp->pass)) { return (FALSE); } return (TRUE); } ",0 "mstime_t mstime(void) { return ustime()/1000; } ",0 "static int analyze_baud_rate(struct usb_serial_port *port, speed_t new_rate) { struct cypress_private *priv; priv = usb_get_serial_port_data(port); if (unstable_bauds) return new_rate; /* FRWD Dongle uses 115200 bps */ if (is_frwd(port->serial->dev)) return new_rate; /* * The general purpose firmware for the Cypress M8 allows for * a maximum speed of 57600bps (I have no idea whether DeLorme * chose to use the general purpose firmware or not), if you * need to modify this speed setting for your own project * please add your own chiptype and modify the code likewise. * The Cypress HID->COM device will work successfully up to * 115200bps (but the actual throughput is around 3kBps). */ if (port->serial->dev->speed == USB_SPEED_LOW) { /* * Mike Isely 2-Feb-2008: The * Cypress app note that describes this mechanism * states the the low-speed part can't handle more * than 800 bytes/sec, in which case 4800 baud is the * safest speed for a part like that. */ if (new_rate > 4800) { dev_dbg(&port->dev, ""%s - failed setting baud rate, device incapable speed %d\n"", __func__, new_rate); return -1; } } switch (priv->chiptype) { case CT_EARTHMATE: if (new_rate <= 600) { /* 300 and 600 baud rates are supported under * the generic firmware, but are not used with * NMEA and SiRF protocols */ dev_dbg(&port->dev, ""%s - failed setting baud rate, unsupported speed of %d on Earthmate GPS\n"", __func__, new_rate); return -1; } break; default: break; } return new_rate; } ",0 "bool FrameCompareDepth(RenderFrameHostImpl* a, RenderFrameHostImpl* b) { return a->frame_tree_node()->depth() < b->frame_tree_node()->depth(); } ",0 "static void floppy_shutdown(struct work_struct *arg) { unsigned long flags; if (initialized) show_floppy(); cancel_activity(); flags = claim_dma_lock(); fd_disable_dma(); release_dma_lock(flags); /* avoid dma going to a random drive after shutdown */ if (initialized) DPRINT(""floppy timeout called\n""); FDCS->reset = 1; if (cont) { cont->done(0); cont->redo(); /* this will recall reset when needed */ } else { pr_info(""no cont in shutdown!\n""); process_fd_request(); } is_alive(__func__, """"); } ",0 "bool CommandBufferProxyImpl::SetSurfaceVisible(bool visible) { if (last_state_.error != gpu::error::kNoError) return false; return Send(new GpuCommandBufferMsg_SetSurfaceVisible(route_id_, visible)); } ",0 "void AutofillPopupItemView::GetAccessibleNodeData(ui::AXNodeData* node_data) { AutofillPopupController* controller = popup_view_->controller(); auto suggestion = controller->GetSuggestionAt(line_number_); std::vector text; text.push_back(suggestion.value); text.push_back(suggestion.label); text.push_back(suggestion.additional_label); base::string16 icon_description; if (!suggestion.icon.empty()) { const int id = controller->layout_model().GetIconAccessibleNameResourceId( suggestion.icon); if (id > 0) text.push_back(l10n_util::GetStringUTF16(id)); } node_data->SetName(base::JoinString(text, base::ASCIIToUTF16("" ""))); node_data->role = ax::mojom::Role::kMenuItem; node_data->AddBoolAttribute(ax::mojom::BoolAttribute::kSelected, is_selected_); int set_size = 0; int pos_in_set = line_number_ + 1; for (int i = 0; i < controller->GetLineCount(); ++i) { if (controller->GetSuggestionAt(i).frontend_id == autofill::POPUP_ITEM_ID_SEPARATOR) { if (i < line_number_) --pos_in_set; } else { ++set_size; } } node_data->AddIntAttribute(ax::mojom::IntAttribute::kSetSize, set_size); node_data->AddIntAttribute(ax::mojom::IntAttribute::kPosInSet, pos_in_set); } ",0 "int pid_delete_dentry(const struct dentry *dentry) { /* Is the task we represent dead? * If so, then don't put the dentry on the lru list, * kill it immediately. */ return proc_inode_is_dead(d_inode(dentry)); } ",0 "bool ServiceWorkerDevToolsAgentHost::Close() { BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::BindOnce(&TerminateServiceWorkerOnIO, context_weak_, version_id_)); return true; } ",0 "static bool cgm_setup_limits(void *hdata, struct lxc_list *cgroup_settings, bool do_devices) { struct cgm_data *d = hdata; struct lxc_list *iterator, *sorted_cgroup_settings, *next; struct lxc_cgroup *cg; bool ret = false; if (lxc_list_empty(cgroup_settings)) return true; if (!d || !d->cgroup_path) return false; if (!cgm_dbus_connect()) { ERROR(""Error connecting to cgroup manager""); return false; } sorted_cgroup_settings = sort_cgroup_settings(cgroup_settings); if (!sorted_cgroup_settings) { return false; } lxc_list_for_each(iterator, sorted_cgroup_settings) { char controller[100], *p; cg = iterator->elem; if (do_devices != !strncmp(""devices"", cg->subsystem, 7)) continue; if (strlen(cg->subsystem) > 100) // i smell a rat goto out; strcpy(controller, cg->subsystem); p = strchr(controller, '.'); if (p) *p = '\0'; if (cgmanager_set_value_sync(NULL, cgroup_manager, controller, d->cgroup_path, cg->subsystem, cg->value) != 0) { NihError *nerr; nerr = nih_error_get(); ERROR(""call to cgmanager_set_value_sync failed: %s"", nerr->message); nih_free(nerr); ERROR(""Error setting cgroup %s:%s limit type %s"", controller, d->cgroup_path, cg->subsystem); goto out; } DEBUG(""cgroup '%s' set to '%s'"", cg->subsystem, cg->value); } ret = true; INFO(""cgroup limits have been setup""); out: lxc_list_for_each_safe(iterator, sorted_cgroup_settings, next) { lxc_list_del(iterator); free(iterator); } free(sorted_cgroup_settings); cgm_dbus_disconnect(); return ret; } ",0 "void WebPageProxy::drawHeader(WebFrameProxy* frame, const FloatRect& rect) { m_uiClient.drawHeader(this, frame, rect); } ",0 "void LocalReaderProxy::OnGetContent(scoped_ptr data) { NOTREACHED(); } ",0 "bool PrintJobWorker::IsRunning() const { return thread_.IsRunning(); } ",0 "poppler_page_render_for_printing (PopplerPage *page, cairo_t *cairo) { g_return_if_fail (POPPLER_IS_PAGE (page)); _poppler_page_render (page, cairo, gTrue); } ",0 "v8::Local V8DOMWrapper::getConstructor(V8ClassIndex::V8WrapperType type, DOMWindow* window) { Frame* frame = window->frame(); if (!frame) return v8::Local(); v8::Handle context = getWrapperContext(frame); if (context.IsEmpty()) return v8::Local(); v8::Context::Scope scope(context); return getConstructor(type, V8Proxy::getHiddenObjectPrototype(context)); } ",0 "normalizePublicId(XML_Char *publicId) { XML_Char *p = publicId; XML_Char *s; for (s = publicId; *s; s++) { switch (*s) { case 0x20: case 0xD: case 0xA: if (p != publicId && p[-1] != 0x20) *p++ = 0x20; break; default: *p++ = *s; } } if (p != publicId && p[-1] == 0x20) --p; *p = XML_T('\0'); } ",0 "static int dcbnl_pgtx_getcfg(struct net_device *netdev, struct nlmsghdr *nlh, u32 seq, struct nlattr **tb, struct sk_buff *skb) { return __dcbnl_pg_getcfg(netdev, nlh, tb, skb, 0); } ",0 "mrb_instance_alloc(mrb_state *mrb, mrb_value cv) { struct RClass *c = mrb_class_ptr(cv); struct RObject *o; enum mrb_vtype ttype = MRB_INSTANCE_TT(c); if (c->tt == MRB_TT_SCLASS) mrb_raise(mrb, E_TYPE_ERROR, ""can't create instance of singleton class""); if (ttype == 0) ttype = MRB_TT_OBJECT; if (ttype <= MRB_TT_CPTR) { mrb_raisef(mrb, E_TYPE_ERROR, ""can't create instance of %S"", cv); } o = (struct RObject*)mrb_obj_alloc(mrb, ttype, c); return mrb_obj_value(o); } ",0 "struct mapped_device *dm_get_md(dev_t dev) { struct mapped_device *md; unsigned minor = MINOR(dev); if (MAJOR(dev) != _major || minor >= (1 << MINORBITS)) return NULL; spin_lock(&_minor_lock); md = idr_find(&_minor_idr, minor); if (md) { if ((md == MINOR_ALLOCED || (MINOR(disk_devt(dm_disk(md))) != minor) || dm_deleting_md(md) || test_bit(DMF_FREEING, &md->flags))) { md = NULL; goto out; } dm_get(md); } out: spin_unlock(&_minor_lock); return md; } ",0 "std::string GetDirectoryListingEntry(const string16& name, const std::string& raw_bytes, bool is_dir, int64 size, Time modified) { std::string result; result.append(""\n""); return result; } ",0 " bool ContainOnlyOneKeyboardLayout( const ImeConfigValue& value) { return (value.type == ImeConfigValue::kValueTypeStringList && value.string_list_value.size() == 1 && chromeos::input_method::IsKeyboardLayout( value.string_list_value[0])); } ",1 "ofproto_flush_flows(struct ofproto *ofproto) { COVERAGE_INC(ofproto_flush); ofproto_flush__(ofproto); connmgr_flushed(ofproto->connmgr); } ",0 "static inline void read_dev_bar(struct pci_dev *dev, struct pci_bar_info *bar_info, int offset, u32 len_mask) { int pos; struct resource *res = dev->resource; if (offset == PCI_ROM_ADDRESS || offset == PCI_ROM_ADDRESS1) pos = PCI_ROM_RESOURCE; else { pos = (offset - PCI_BASE_ADDRESS_0) / 4; if (pos && ((res[pos - 1].flags & (PCI_BASE_ADDRESS_SPACE | PCI_BASE_ADDRESS_MEM_TYPE_MASK)) == (PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_64))) { bar_info->val = res[pos - 1].start >> 32; bar_info->len_val = res[pos - 1].end >> 32; return; } } bar_info->val = res[pos].start | (res[pos].flags & PCI_REGION_FLAG_MASK); bar_info->len_val = resource_size(&res[pos]); } ",0 "void Document::UpdateTitle(const String& title) { if (raw_title_ == title) return; raw_title_ = title; String old_title = title_; if (raw_title_.IsEmpty()) title_ = String(); else if (raw_title_.Is8Bit()) title_ = CanonicalizedTitle(this, raw_title_); else title_ = CanonicalizedTitle(this, raw_title_); if (!frame_ || old_title == title_) return; DispatchDidReceiveTitle(); if (AXObjectCache* cache = ExistingAXObjectCache()) cache->DocumentTitleChanged(); } ",0 "void _WM_do_meta_endoftrack(struct _mdi *mdi, struct _event_data *data) { /* placeholder function so we can record eot in the event stream * for conversion function _WM_Event2Midi */ #ifdef DEBUG_MIDI uint8_t ch = data->channel; MIDI_EVENT_DEBUG(__FUNCTION__, ch, data->data.value); #else UNUSED(data); #endif _WM_Release_Allowance(mdi); return; } ",0 "static int do_recv_NPSetWindowCallbackStruct(rpc_message_t *message, void *p_value) { NPSetWindowCallbackStruct **ws_info_p = (NPSetWindowCallbackStruct **)p_value; NPSetWindowCallbackStruct *ws_info; int32_t type; uint32_t has_ws_info, visual_id, colormap, depth; int error; if (ws_info_p) *ws_info_p = NULL; if ((error = rpc_message_recv_uint32(message, &has_ws_info)) < 0) return error; if (has_ws_info) { if ((error = rpc_message_recv_int32(message, &type)) < 0) return error; if ((error = rpc_message_recv_uint32(message, &visual_id)) < 0) return error; if ((error = rpc_message_recv_uint32(message, &colormap)) < 0) return error; if ((error = rpc_message_recv_uint32(message, &depth)) < 0) return error; if (ws_info_p) { if ((ws_info = calloc(1, sizeof(*ws_info))) == NULL) return RPC_ERROR_NO_MEMORY; ws_info->type = type; ws_info->visual = (void *)(uintptr_t)visual_id; ws_info->colormap = colormap; ws_info->depth = depth; *ws_info_p = ws_info; } } return RPC_ERROR_NO_ERROR; } ",0 "static inline void cm_deref_id(struct cm_id_private *cm_id_priv) { if (atomic_dec_and_test(&cm_id_priv->refcount)) complete(&cm_id_priv->comp); } ",0 "static int atl2_configure(struct atl2_adapter *adapter) { struct atl2_hw *hw = &adapter->hw; u32 value; /* clear interrupt status */ ATL2_WRITE_REG(&adapter->hw, REG_ISR, 0xffffffff); /* set MAC Address */ value = (((u32)hw->mac_addr[2]) << 24) | (((u32)hw->mac_addr[3]) << 16) | (((u32)hw->mac_addr[4]) << 8) | (((u32)hw->mac_addr[5])); ATL2_WRITE_REG(hw, REG_MAC_STA_ADDR, value); value = (((u32)hw->mac_addr[0]) << 8) | (((u32)hw->mac_addr[1])); ATL2_WRITE_REG(hw, (REG_MAC_STA_ADDR+4), value); /* HI base address */ ATL2_WRITE_REG(hw, REG_DESC_BASE_ADDR_HI, (u32)((adapter->ring_dma & 0xffffffff00000000ULL) >> 32)); /* LO base address */ ATL2_WRITE_REG(hw, REG_TXD_BASE_ADDR_LO, (u32)(adapter->txd_dma & 0x00000000ffffffffULL)); ATL2_WRITE_REG(hw, REG_TXS_BASE_ADDR_LO, (u32)(adapter->txs_dma & 0x00000000ffffffffULL)); ATL2_WRITE_REG(hw, REG_RXD_BASE_ADDR_LO, (u32)(adapter->rxd_dma & 0x00000000ffffffffULL)); /* element count */ ATL2_WRITE_REGW(hw, REG_TXD_MEM_SIZE, (u16)(adapter->txd_ring_size/4)); ATL2_WRITE_REGW(hw, REG_TXS_MEM_SIZE, (u16)adapter->txs_ring_size); ATL2_WRITE_REGW(hw, REG_RXD_BUF_NUM, (u16)adapter->rxd_ring_size); /* config Internal SRAM */ /* ATL2_WRITE_REGW(hw, REG_SRAM_TXRAM_END, sram_tx_end); ATL2_WRITE_REGW(hw, REG_SRAM_TXRAM_END, sram_rx_end); */ /* config IPG/IFG */ value = (((u32)hw->ipgt & MAC_IPG_IFG_IPGT_MASK) << MAC_IPG_IFG_IPGT_SHIFT) | (((u32)hw->min_ifg & MAC_IPG_IFG_MIFG_MASK) << MAC_IPG_IFG_MIFG_SHIFT) | (((u32)hw->ipgr1 & MAC_IPG_IFG_IPGR1_MASK) << MAC_IPG_IFG_IPGR1_SHIFT)| (((u32)hw->ipgr2 & MAC_IPG_IFG_IPGR2_MASK) << MAC_IPG_IFG_IPGR2_SHIFT); ATL2_WRITE_REG(hw, REG_MAC_IPG_IFG, value); /* config Half-Duplex Control */ value = ((u32)hw->lcol & MAC_HALF_DUPLX_CTRL_LCOL_MASK) | (((u32)hw->max_retry & MAC_HALF_DUPLX_CTRL_RETRY_MASK) << MAC_HALF_DUPLX_CTRL_RETRY_SHIFT) | MAC_HALF_DUPLX_CTRL_EXC_DEF_EN | (0xa << MAC_HALF_DUPLX_CTRL_ABEBT_SHIFT) | (((u32)hw->jam_ipg & MAC_HALF_DUPLX_CTRL_JAMIPG_MASK) << MAC_HALF_DUPLX_CTRL_JAMIPG_SHIFT); ATL2_WRITE_REG(hw, REG_MAC_HALF_DUPLX_CTRL, value); /* set Interrupt Moderator Timer */ ATL2_WRITE_REGW(hw, REG_IRQ_MODU_TIMER_INIT, adapter->imt); ATL2_WRITE_REG(hw, REG_MASTER_CTRL, MASTER_CTRL_ITIMER_EN); /* set Interrupt Clear Timer */ ATL2_WRITE_REGW(hw, REG_CMBDISDMA_TIMER, adapter->ict); /* set MTU */ ATL2_WRITE_REG(hw, REG_MTU, adapter->netdev->mtu + ENET_HEADER_SIZE + VLAN_SIZE + ETHERNET_FCS_SIZE); /* 1590 */ ATL2_WRITE_REG(hw, REG_TX_CUT_THRESH, 0x177); /* flow control */ ATL2_WRITE_REGW(hw, REG_PAUSE_ON_TH, hw->fc_rxd_hi); ATL2_WRITE_REGW(hw, REG_PAUSE_OFF_TH, hw->fc_rxd_lo); /* Init mailbox */ ATL2_WRITE_REGW(hw, REG_MB_TXD_WR_IDX, (u16)adapter->txd_write_ptr); ATL2_WRITE_REGW(hw, REG_MB_RXD_RD_IDX, (u16)adapter->rxd_read_ptr); /* enable DMA read/write */ ATL2_WRITE_REGB(hw, REG_DMAR, DMAR_EN); ATL2_WRITE_REGB(hw, REG_DMAW, DMAW_EN); value = ATL2_READ_REG(&adapter->hw, REG_ISR); if ((value & ISR_PHY_LINKDOWN) != 0) value = 1; /* config failed */ else value = 0; /* clear all interrupt status */ ATL2_WRITE_REG(&adapter->hw, REG_ISR, 0x3fffffff); ATL2_WRITE_REG(&adapter->hw, REG_ISR, 0); return value; } ",0 "stack_param_enumerate(iparam_list * plist, gs_param_enumerator_t * penum, gs_param_key_t * key, ref_type * type) { int code; stack_param_list *const splist = (stack_param_list *) plist; int index = penum->intval; ref *stack_element; do { stack_element = ref_stack_index(splist->pstack, index + 1 + splist->skip); if (!stack_element) return 1; } while (index += 2, !r_has_type(stack_element, t_name)); *type = r_type(stack_element); code = ref_to_key(stack_element, key, plist); penum->intval = index; return code; } ",0 "static void disk_alloc_events(struct gendisk *disk) { struct disk_events *ev; if (!disk->fops->check_events) return; ev = kzalloc(sizeof(*ev), GFP_KERNEL); if (!ev) { pr_warn(""%s: failed to initialize events\n"", disk->disk_name); return; } INIT_LIST_HEAD(&ev->node); ev->disk = disk; spin_lock_init(&ev->lock); mutex_init(&ev->block_mutex); ev->block = 1; ev->poll_msecs = -1; INIT_DELAYED_WORK(&ev->dwork, disk_events_workfn); disk->ev = ev; } ",0 "void mremap_userfaultfd_complete(struct vm_userfaultfd_ctx *vm_ctx, unsigned long from, unsigned long to, unsigned long len) { struct userfaultfd_ctx *ctx = vm_ctx->ctx; struct userfaultfd_wait_queue ewq; if (!ctx) return; if (to & ~PAGE_MASK) { userfaultfd_ctx_put(ctx); return; } msg_init(&ewq.msg); ewq.msg.event = UFFD_EVENT_REMAP; ewq.msg.arg.remap.from = from; ewq.msg.arg.remap.to = to; ewq.msg.arg.remap.len = len; userfaultfd_event_wait_completion(ctx, &ewq); } ",0 "PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_len TSRMLS_DC) { pcre *re = NULL; pcre_extra *extra; int coptions = 0; int soptions = 0; const char *error; int erroffset; char delimiter; char start_delimiter; char end_delimiter; char *p, *pp; char *pattern; int do_study = 0; int poptions = 0; int count = 0; unsigned const char *tables = NULL; #if HAVE_SETLOCALE char *locale; #endif pcre_cache_entry *pce; pcre_cache_entry new_entry; char *tmp = NULL; #if HAVE_SETLOCALE # if defined(PHP_WIN32) && defined(ZTS) _configthreadlocale(_ENABLE_PER_THREAD_LOCALE); # endif locale = setlocale(LC_CTYPE, NULL); #endif /* Try to lookup the cached regex entry, and if successful, just pass back the compiled pattern, otherwise go on and compile it. */ if (zend_hash_find(&PCRE_G(pcre_cache), regex, regex_len+1, (void **)&pce) == SUCCESS) { /* * We use a quick pcre_fullinfo() check to see whether cache is corrupted, and if it * is, we flush it and compile the pattern from scratch. */ if (pcre_fullinfo(pce->re, NULL, PCRE_INFO_CAPTURECOUNT, &count) == PCRE_ERROR_BADMAGIC) { zend_hash_clean(&PCRE_G(pcre_cache)); } else { #if HAVE_SETLOCALE if (!strcmp(pce->locale, locale)) { #endif return pce; #if HAVE_SETLOCALE } #endif } } p = regex; /* Parse through the leading whitespace, and display a warning if we get to the end without encountering a delimiter. */ while (isspace((int)*(unsigned char *)p)) p++; if (*p == 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, p < regex + regex_len ? ""Null byte in regex"" : ""Empty regular expression""); return NULL; } /* Get the delimiter and display a warning if it is alphanumeric or a backslash. */ delimiter = *p++; if (isalnum((int)*(unsigned char *)&delimiter) || delimiter == '\\') { php_error_docref(NULL TSRMLS_CC,E_WARNING, ""Delimiter must not be alphanumeric or backslash""); return NULL; } start_delimiter = delimiter; if ((pp = strchr(""([{< )]}> )]}>"", delimiter))) ",0 "static int __orderly_poweroff(void) { int argc; char **argv; static char *envp[] = { ""HOME=/"", ""PATH=/sbin:/bin:/usr/sbin:/usr/bin"", NULL }; int ret; argv = argv_split(GFP_ATOMIC, poweroff_cmd, &argc); if (argv == NULL) { printk(KERN_WARNING ""%s failed to allocate memory for \""%s\""\n"", __func__, poweroff_cmd); return -ENOMEM; } ret = call_usermodehelper_fns(argv[0], argv, envp, UMH_WAIT_EXEC, NULL, argv_cleanup, NULL); if (ret == -ENOMEM) argv_free(argv); return ret; } ",0 "nfsreq_print_noaddr(netdissect_options *ndo, register const u_char *bp, u_int length, register const u_char *bp2) { register const struct sunrpc_msg *rp; register const uint32_t *dp; nfs_type type; int v3; uint32_t proc; uint32_t access_flags; struct nfsv3_sattr sa3; ND_PRINT((ndo, ""%d"", length)); nfserr = 0; /* assume no error */ rp = (const struct sunrpc_msg *)bp; if (!xid_map_enter(ndo, rp, bp2)) /* record proc number for later on */ goto trunc; v3 = (EXTRACT_32BITS(&rp->rm_call.cb_vers) == NFS_VER3); proc = EXTRACT_32BITS(&rp->rm_call.cb_proc); if (!v3 && proc < NFS_NPROCS) proc = nfsv3_procid[proc]; ND_PRINT((ndo, "" %s"", tok2str(nfsproc_str, ""proc-%u"", proc))); switch (proc) { case NFSPROC_GETATTR: case NFSPROC_SETATTR: case NFSPROC_READLINK: case NFSPROC_FSSTAT: case NFSPROC_FSINFO: case NFSPROC_PATHCONF: if ((dp = parsereq(ndo, rp, length)) != NULL && parsefh(ndo, dp, v3) != NULL) return; break; case NFSPROC_LOOKUP: case NFSPROC_CREATE: case NFSPROC_MKDIR: case NFSPROC_REMOVE: case NFSPROC_RMDIR: if ((dp = parsereq(ndo, rp, length)) != NULL && parsefhn(ndo, dp, v3) != NULL) return; break; case NFSPROC_ACCESS: if ((dp = parsereq(ndo, rp, length)) != NULL && (dp = parsefh(ndo, dp, v3)) != NULL) { ND_TCHECK(dp[0]); access_flags = EXTRACT_32BITS(&dp[0]); if (access_flags & ~NFSV3ACCESS_FULL) { /* NFSV3ACCESS definitions aren't up to date */ ND_PRINT((ndo, "" %04x"", access_flags)); } else if ((access_flags & NFSV3ACCESS_FULL) == NFSV3ACCESS_FULL) { ND_PRINT((ndo, "" NFS_ACCESS_FULL"")); } else { char separator = ' '; if (access_flags & NFSV3ACCESS_READ) { ND_PRINT((ndo, "" NFS_ACCESS_READ"")); separator = '|'; } if (access_flags & NFSV3ACCESS_LOOKUP) { ND_PRINT((ndo, ""%cNFS_ACCESS_LOOKUP"", separator)); separator = '|'; } if (access_flags & NFSV3ACCESS_MODIFY) { ND_PRINT((ndo, ""%cNFS_ACCESS_MODIFY"", separator)); separator = '|'; } if (access_flags & NFSV3ACCESS_EXTEND) { ND_PRINT((ndo, ""%cNFS_ACCESS_EXTEND"", separator)); separator = '|'; } if (access_flags & NFSV3ACCESS_DELETE) { ND_PRINT((ndo, ""%cNFS_ACCESS_DELETE"", separator)); separator = '|'; } if (access_flags & NFSV3ACCESS_EXECUTE) ND_PRINT((ndo, ""%cNFS_ACCESS_EXECUTE"", separator)); } return; } break; case NFSPROC_READ: if ((dp = parsereq(ndo, rp, length)) != NULL && (dp = parsefh(ndo, dp, v3)) != NULL) { if (v3) { ND_TCHECK(dp[2]); ND_PRINT((ndo, "" %u bytes @ %"" PRIu64, EXTRACT_32BITS(&dp[2]), EXTRACT_64BITS(&dp[0]))); } else { ND_TCHECK(dp[1]); ND_PRINT((ndo, "" %u bytes @ %u"", EXTRACT_32BITS(&dp[1]), EXTRACT_32BITS(&dp[0]))); } return; } break; case NFSPROC_WRITE: if ((dp = parsereq(ndo, rp, length)) != NULL && (dp = parsefh(ndo, dp, v3)) != NULL) { if (v3) { ND_TCHECK(dp[4]); ND_PRINT((ndo, "" %u (%u) bytes @ %"" PRIu64, EXTRACT_32BITS(&dp[4]), EXTRACT_32BITS(&dp[2]), EXTRACT_64BITS(&dp[0]))); if (ndo->ndo_vflag) { ND_PRINT((ndo, "" <%s>"", tok2str(nfsv3_writemodes, NULL, EXTRACT_32BITS(&dp[3])))); } } else { ND_TCHECK(dp[3]); ND_PRINT((ndo, "" %u (%u) bytes @ %u (%u)"", EXTRACT_32BITS(&dp[3]), EXTRACT_32BITS(&dp[2]), EXTRACT_32BITS(&dp[1]), EXTRACT_32BITS(&dp[0]))); } return; } break; case NFSPROC_SYMLINK: if ((dp = parsereq(ndo, rp, length)) != NULL && (dp = parsefhn(ndo, dp, v3)) != NULL) { ND_PRINT((ndo, "" ->"")); if (v3 && (dp = parse_sattr3(ndo, dp, &sa3)) == NULL) break; if (parsefn(ndo, dp) == NULL) break; if (v3 && ndo->ndo_vflag) print_sattr3(ndo, &sa3, ndo->ndo_vflag); return; } break; case NFSPROC_MKNOD: if ((dp = parsereq(ndo, rp, length)) != NULL && (dp = parsefhn(ndo, dp, v3)) != NULL) { ND_TCHECK(*dp); type = (nfs_type)EXTRACT_32BITS(dp); dp++; if ((dp = parse_sattr3(ndo, dp, &sa3)) == NULL) break; ND_PRINT((ndo, "" %s"", tok2str(type2str, ""unk-ft %d"", type))); if (ndo->ndo_vflag && (type == NFCHR || type == NFBLK)) { ND_TCHECK(dp[1]); ND_PRINT((ndo, "" %u/%u"", EXTRACT_32BITS(&dp[0]), EXTRACT_32BITS(&dp[1]))); dp += 2; } if (ndo->ndo_vflag) print_sattr3(ndo, &sa3, ndo->ndo_vflag); return; } break; case NFSPROC_RENAME: if ((dp = parsereq(ndo, rp, length)) != NULL && (dp = parsefhn(ndo, dp, v3)) != NULL) { ND_PRINT((ndo, "" ->"")); if (parsefhn(ndo, dp, v3) != NULL) return; } break; case NFSPROC_LINK: if ((dp = parsereq(ndo, rp, length)) != NULL && (dp = parsefh(ndo, dp, v3)) != NULL) { ND_PRINT((ndo, "" ->"")); if (parsefhn(ndo, dp, v3) != NULL) return; } break; case NFSPROC_READDIR: if ((dp = parsereq(ndo, rp, length)) != NULL && (dp = parsefh(ndo, dp, v3)) != NULL) { if (v3) { ND_TCHECK(dp[4]); /* * We shouldn't really try to interpret the * offset cookie here. */ ND_PRINT((ndo, "" %u bytes @ %"" PRId64, EXTRACT_32BITS(&dp[4]), EXTRACT_64BITS(&dp[0]))); if (ndo->ndo_vflag) ND_PRINT((ndo, "" verf %08x%08x"", dp[2], dp[3])); } else { ND_TCHECK(dp[1]); /* * Print the offset as signed, since -1 is * common, but offsets > 2^31 aren't. */ ND_PRINT((ndo, "" %u bytes @ %d"", EXTRACT_32BITS(&dp[1]), EXTRACT_32BITS(&dp[0]))); } return; } break; case NFSPROC_READDIRPLUS: if ((dp = parsereq(ndo, rp, length)) != NULL && (dp = parsefh(ndo, dp, v3)) != NULL) { ND_TCHECK(dp[4]); /* * We don't try to interpret the offset * cookie here. */ ND_PRINT((ndo, "" %u bytes @ %"" PRId64, EXTRACT_32BITS(&dp[4]), EXTRACT_64BITS(&dp[0]))); if (ndo->ndo_vflag) { ND_TCHECK(dp[5]); ND_PRINT((ndo, "" max %u verf %08x%08x"", EXTRACT_32BITS(&dp[5]), dp[2], dp[3])); } return; } break; case NFSPROC_COMMIT: if ((dp = parsereq(ndo, rp, length)) != NULL && (dp = parsefh(ndo, dp, v3)) != NULL) { ND_TCHECK(dp[2]); ND_PRINT((ndo, "" %u bytes @ %"" PRIu64, EXTRACT_32BITS(&dp[2]), EXTRACT_64BITS(&dp[0]))); return; } break; default: return; } trunc: if (!nfserr) ND_PRINT((ndo, ""%s"", tstr)); } ",0 "IteratorConcat(JsonbIterator **it1, JsonbIterator **it2, JsonbParseState **state) { uint32 r1, r2, rk1, rk2; JsonbValue v1, v2, *res = NULL; r1 = rk1 = JsonbIteratorNext(it1, &v1, false); r2 = rk2 = JsonbIteratorNext(it2, &v2, false); /* * Both elements are objects. */ if (rk1 == WJB_BEGIN_OBJECT && rk2 == WJB_BEGIN_OBJECT) { /* * Append the all tokens from v1 to res, except last WJB_END_OBJECT * (because res will not be finished yet). */ pushJsonbValue(state, r1, NULL); while ((r1 = JsonbIteratorNext(it1, &v1, true)) != WJB_END_OBJECT) pushJsonbValue(state, r1, &v1); /* * Append the all tokens from v2 to res, include last WJB_END_OBJECT * (the concatenation will be completed). */ while ((r2 = JsonbIteratorNext(it2, &v2, true)) != 0) res = pushJsonbValue(state, r2, r2 != WJB_END_OBJECT ? &v2 : NULL); } /* * Both elements are arrays (either can be scalar). */ else if (rk1 == WJB_BEGIN_ARRAY && rk2 == WJB_BEGIN_ARRAY) { pushJsonbValue(state, r1, NULL); while ((r1 = JsonbIteratorNext(it1, &v1, true)) != WJB_END_ARRAY) { Assert(r1 == WJB_ELEM); pushJsonbValue(state, r1, &v1); } while ((r2 = JsonbIteratorNext(it2, &v2, true)) != WJB_END_ARRAY) { Assert(r2 == WJB_ELEM); pushJsonbValue(state, WJB_ELEM, &v2); } res = pushJsonbValue(state, WJB_END_ARRAY, NULL /* signal to sort */ ); } /* have we got array || object or object || array? */ else if (((rk1 == WJB_BEGIN_ARRAY && !(*it1)->isScalar) && rk2 == WJB_BEGIN_OBJECT) || (rk1 == WJB_BEGIN_OBJECT && (rk2 == WJB_BEGIN_ARRAY && !(*it2)->isScalar))) { JsonbIterator **it_array = rk1 == WJB_BEGIN_ARRAY ? it1 : it2; JsonbIterator **it_object = rk1 == WJB_BEGIN_OBJECT ? it1 : it2; bool prepend = (rk1 == WJB_BEGIN_OBJECT); pushJsonbValue(state, WJB_BEGIN_ARRAY, NULL); if (prepend) { pushJsonbValue(state, WJB_BEGIN_OBJECT, NULL); while ((r1 = JsonbIteratorNext(it_object, &v1, true)) != 0) pushJsonbValue(state, r1, r1 != WJB_END_OBJECT ? &v1 : NULL); while ((r2 = JsonbIteratorNext(it_array, &v2, true)) != 0) res = pushJsonbValue(state, r2, r2 != WJB_END_ARRAY ? &v2 : NULL); } else { while ((r1 = JsonbIteratorNext(it_array, &v1, true)) != WJB_END_ARRAY) pushJsonbValue(state, r1, &v1); pushJsonbValue(state, WJB_BEGIN_OBJECT, NULL); while ((r2 = JsonbIteratorNext(it_object, &v2, true)) != 0) pushJsonbValue(state, r2, r2 != WJB_END_OBJECT ? &v2 : NULL); res = pushJsonbValue(state, WJB_END_ARRAY, NULL); } } else { /* * This must be scalar || object or object || scalar, as that's all * that's left. Both of these make no sense, so error out. */ ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg(""invalid concatenation of jsonb objects""))); } return res; } ",0 "static int ucm_validate_listen(__be64 service_id, __be64 service_mask) { service_id &= service_mask; if (((service_id & IB_CMA_SERVICE_ID_MASK) == IB_CMA_SERVICE_ID) || ((service_id & IB_SDP_SERVICE_ID_MASK) == IB_SDP_SERVICE_ID)) return -EINVAL; return 0; } ",0 "static inline bool IsMetadataImgRsrc ( XMP_Uns16 id ) { if ( id == 0 ) return false; int i; for ( i = 0; id < kPSIR_MetadataIDs[i]; ++i ) {} if ( id == kPSIR_MetadataIDs[i] ) return true; return false; } // IsMetadataImgRsrc ",0 "void Cache::insertInLiveDecodedResourcesList(CachedResource* resource) { ASSERT(!resource->m_nextInLiveResourcesList && !resource->m_prevInLiveResourcesList && !resource->m_inLiveDecodedResourcesList); resource->m_inLiveDecodedResourcesList = true; resource->m_nextInLiveResourcesList = m_liveDecodedResources.m_head; if (m_liveDecodedResources.m_head) m_liveDecodedResources.m_head->m_prevInLiveResourcesList = resource; m_liveDecodedResources.m_head = resource; if (!resource->m_nextInLiveResourcesList) m_liveDecodedResources.m_tail = resource; #ifndef NDEBUG bool found = false; for (CachedResource* current = m_liveDecodedResources.m_head; current; current = current->m_nextInLiveResourcesList) { if (current == resource) { found = true; break; } } ASSERT(found); #endif } ",0 "static void tcp_clamp_window(struct sock *sk) { struct tcp_sock *tp = tcp_sk(sk); struct inet_connection_sock *icsk = inet_csk(sk); icsk->icsk_ack.quick = 0; if (sk->sk_rcvbuf < sysctl_tcp_rmem[2] && !(sk->sk_userlocks & SOCK_RCVBUF_LOCK) && !tcp_memory_pressure && atomic_long_read(&tcp_memory_allocated) < sysctl_tcp_mem[0]) { sk->sk_rcvbuf = min(atomic_read(&sk->sk_rmem_alloc), sysctl_tcp_rmem[2]); } if (atomic_read(&sk->sk_rmem_alloc) > sk->sk_rcvbuf) tp->rcv_ssthresh = min(tp->window_clamp, 2U * tp->advmss); } ",0 "MojoResult Core::Watch(MojoHandle watcher_handle, MojoHandle handle, MojoHandleSignals signals, MojoWatchCondition condition, uintptr_t context) { RequestContext request_context; scoped_refptr watcher = GetDispatcher(watcher_handle); if (!watcher || watcher->GetType() != Dispatcher::Type::WATCHER) return MOJO_RESULT_INVALID_ARGUMENT; scoped_refptr dispatcher = GetDispatcher(handle); if (!dispatcher) return MOJO_RESULT_INVALID_ARGUMENT; return watcher->WatchDispatcher(std::move(dispatcher), signals, condition, context); } ",0 " static void pipe_advance(struct iov_iter *i, size_t size) { struct pipe_inode_info *pipe = i->pipe; struct pipe_buffer *buf; int idx = i->idx; size_t off = i->iov_offset, orig_sz; if (unlikely(i->count < size)) size = i->count; orig_sz = size; if (size) { if (off) /* make it relative to the beginning of buffer */ size += off - pipe->bufs[idx].offset; while (1) { buf = &pipe->bufs[idx]; if (size <= buf->len) break; size -= buf->len; idx = next_idx(idx, pipe); } buf->len = size; i->idx = idx; off = i->iov_offset = buf->offset + size; } if (off) idx = next_idx(idx, pipe); if (pipe->nrbufs) { int unused = (pipe->curbuf + pipe->nrbufs) & (pipe->buffers - 1); /* [curbuf,unused) is in use. Free [idx,unused) */ while (idx != unused) { pipe_buf_release(pipe, &pipe->bufs[idx]); idx = next_idx(idx, pipe); pipe->nrbufs--; } } i->count -= orig_sz; } ",1 "void iriap_connect_request(struct iriap_cb *self) { int ret; IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IAS_MAGIC, return;); ret = irlmp_connect_request(self->lsap, LSAP_IAS, self->saddr, self->daddr, NULL, NULL); if (ret < 0) { IRDA_DEBUG(0, ""%s(), connect failed!\n"", __func__); self->confirm(IAS_DISCONNECT, 0, NULL, self->priv); } } ",0 "std::string AffiliationFetcher::PreparePayload() const { affiliation_pb::LookupAffiliationRequest lookup_request; for (const FacetURI& uri : requested_facet_uris_) lookup_request.add_facet(uri.canonical_spec()); std::string serialized_request; bool success = lookup_request.SerializeToString(&serialized_request); DCHECK(success); return serialized_request; } ",0 "RendererSchedulerImpl::TaskQueuePolicy::GetTimeDomainType( MainThreadTaskQueue* task_queue) const { if (use_virtual_time) return TimeDomainType::kVirtual; if (is_throttled && task_queue->CanBeThrottled()) return TimeDomainType::kThrottled; return TimeDomainType::kReal; } ",0 "static struct qeth_cmd_buffer *qeth_get_adapter_cmd(struct qeth_card *card, __u32 command, __u32 cmdlen) { struct qeth_cmd_buffer *iob; struct qeth_ipa_cmd *cmd; iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SETADAPTERPARMS, QETH_PROT_IPV4); cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); cmd->data.setadapterparms.hdr.cmdlength = cmdlen; cmd->data.setadapterparms.hdr.command_code = command; cmd->data.setadapterparms.hdr.used_total = 1; cmd->data.setadapterparms.hdr.seq_no = 1; return iob; } ",0 "age_secs(long long int age_ms) { return (age_ms < 0 ? 0 : age_ms >= UINT16_MAX * 1000 ? UINT16_MAX : (unsigned int) age_ms / 1000); } ",0 " void Shell::PlatformSetContents() { WebContentsView* content_view = web_contents_->GetView(); gtk_container_add(GTK_CONTAINER(vbox_), content_view->GetNativeView()); content::RendererPreferences* prefs = web_contents_->GetMutableRendererPrefs(); prefs->focus_ring_color = SkColorSetARGB(255, 229, 151, 0); prefs->thumb_active_color = SkColorSetRGB(244, 244, 244); prefs->thumb_inactive_color = SkColorSetRGB(234, 234, 234); prefs->track_color = SkColorSetRGB(211, 211, 211); prefs->active_selection_bg_color = SkColorSetRGB(30, 144, 255); prefs->active_selection_fg_color = SK_ColorWHITE; prefs->inactive_selection_bg_color = SkColorSetRGB(200, 200, 200); prefs->inactive_selection_fg_color = SkColorSetRGB(50, 50, 50); } ",1 "status_t AudioFlinger::EffectModule::addHandle(EffectHandle *handle) { status_t status; Mutex::Autolock _l(mLock); int priority = handle->priority(); size_t size = mHandles.size(); EffectHandle *controlHandle = NULL; size_t i; for (i = 0; i < size; i++) { EffectHandle *h = mHandles[i]; if (h == NULL || h->destroyed_l()) { continue; } if (controlHandle == NULL) { controlHandle = h; } if (h->priority() <= priority) { break; } } if (i == 0) { bool enabled = false; if (controlHandle != NULL) { enabled = controlHandle->enabled(); controlHandle->setControl(false/*hasControl*/, true /*signal*/, enabled /*enabled*/); } handle->setControl(true /*hasControl*/, false /*signal*/, enabled /*enabled*/); status = NO_ERROR; } else { status = ALREADY_EXISTS; } ALOGV(""addHandle() %p added handle %p in position %d"", this, handle, i); mHandles.insertAt(handle, i); return status; } ",0 "static void erase_entry(struct ctl_table_header *head, struct ctl_table *entry) { struct rb_node *node = &head->node[entry - head->ctl_table].node; rb_erase(node, &head->parent->root); } ",0 " static inline void SetImpl(FixedArrayBase* backing_store, uint32_t entry, Object* value, WriteBarrierMode mode) { BackingStore::cast(backing_store)->SetValue(entry, value); } ",0 "static struct sock *unix_find_socket_byinode(struct inode *i) { struct sock *s; struct hlist_node *node; spin_lock(&unix_table_lock); sk_for_each(s, node, &unix_socket_table[i->i_ino & (UNIX_HASH_SIZE - 1)]) { struct dentry *dentry = unix_sk(s)->path.dentry; if (dentry && dentry->d_inode == i) { sock_hold(s); goto found; } } s = NULL; found: spin_unlock(&unix_table_lock); return s; } ",0 " bool IsDragStarted() const { return drag_controller_ && drag_controller_->started_drag(); } ",0 "void FrameLoader::continueFragmentScrollAfterNavigationPolicy(const ResourceRequest& request, bool shouldContinue) { m_quickRedirectComing = false; if (!shouldContinue) return; bool isRedirect = m_quickRedirectComing || policyChecker()->loadType() == FrameLoadTypeRedirectWithLockedBackForwardList; loadInSameDocument(request.url(), 0, !isRedirect); } ",0 "is_sysex_code(guint8 code) { return (code == 0x04 || code == 0x05 || code == 0x06 || code == 0x07); } ",0 "void qeth_release_buffer(struct qeth_channel *channel, struct qeth_cmd_buffer *iob) { unsigned long flags; QETH_CARD_TEXT(CARD_FROM_CDEV(channel->ccwdev), 6, ""relbuff""); spin_lock_irqsave(&channel->iob_lock, flags); memset(iob->data, 0, QETH_BUFSIZE); iob->state = BUF_STATE_FREE; iob->callback = qeth_send_control_data_cb; iob->rc = 0; spin_unlock_irqrestore(&channel->iob_lock, flags); wake_up(&channel->wait_q); } ",0 "R_API RList *r_bin_dwarf_parse_line(RBin *a, int mode) { ut8 *buf; RList *list = NULL; int len, ret; RBinSection *section = getsection (a, ""debug_line""); RBinFile *binfile = a ? a->cur: NULL; if (binfile && section) { len = section->size; if (len < 1) { return NULL; } buf = calloc (1, len + 1); if (!buf) { return NULL; } ret = r_buf_read_at (binfile->buf, section->paddr, buf, len); if (ret != len) { free (buf); return NULL; } list = r_list_new (); // always return empty list wtf if (!list) { free (buf); return NULL; } list->free = r_bin_dwarf_row_free; r_bin_dwarf_parse_line_raw2 (a, buf, len, mode); SdbListIter *iter; SdbKv *kv; SdbList *ls = sdb_foreach_list (binfile->sdb_addrinfo, false); ls_foreach (ls, iter, kv) { if (!strncmp (kv->key, ""0x"", 2)) { ut64 addr; RBinDwarfRow *row; int line; char *file = strdup (kv->value); if (!file) { free (buf); ls_free (ls); r_list_free (list); return NULL; } char *tok = strchr (file, '|'); if (tok) { *tok++ = 0; line = atoi (tok); addr = r_num_math (NULL, kv->key); row = r_bin_dwarf_row_new (addr, file, line, 0); r_list_append (list, row); } free (file); } } ls_free (ls); free (buf); } return list; } ",0 "static int csnmp_config_add_data_blacklist_match_inverted(data_definition_t *dd, oconfig_item_t *ci) { if ((ci->values_num != 1) || (ci->values[0].type != OCONFIG_TYPE_BOOLEAN)) { WARNING(""snmp plugin: `InvertMatch' needs exactly one boolean argument.""); return (-1); } dd->invert_match = ci->values[0].value.boolean ? 1 : 0; return (0); } /* int csnmp_config_add_data_blacklist_match_inverted */ ",0 "void _php_import_environment_variables(zval *array_ptr) { char buf[128]; char **env, *p, *t = buf; size_t alloc_size = sizeof(buf); unsigned long nlen; /* ptrdiff_t is not portable */ for (env = environ; env != NULL && *env != NULL; env++) { p = strchr(*env, '='); if (!p) { /* malformed entry? */ continue; } nlen = p - *env; if (nlen >= alloc_size) { alloc_size = nlen + 64; t = (t == buf ? emalloc(alloc_size): erealloc(t, alloc_size)); } memcpy(t, *env, nlen); t[nlen] = '\0'; php_register_variable(t, p + 1, array_ptr); } if (t != buf && t != NULL) { efree(t); } } ",0 "static int init_ssl_connection(SSL *con) { int i; const char *str; X509 *peer; long verify_error; MS_STATIC char buf[BUFSIZ]; #ifndef OPENSSL_NO_KRB5 char *client_princ; #endif #if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG) const unsigned char *next_proto_neg; unsigned next_proto_neg_len; #endif unsigned char *exportedkeymat; i = SSL_accept(con); #ifdef CERT_CB_TEST_RETRY { while (i <= 0 && SSL_get_error(con, i) == SSL_ERROR_WANT_X509_LOOKUP && SSL_state(con) == SSL3_ST_SR_CLNT_HELLO_C) { fprintf(stderr, ""LOOKUP from certificate callback during accept\n""); i = SSL_accept(con); } } #endif #ifndef OPENSSL_NO_SRP while (i <= 0 && SSL_get_error(con, i) == SSL_ERROR_WANT_X509_LOOKUP) { BIO_printf(bio_s_out, ""LOOKUP during accept %s\n"", srp_callback_parm.login); srp_callback_parm.user = SRP_VBASE_get_by_user(srp_callback_parm.vb, srp_callback_parm.login); if (srp_callback_parm.user) BIO_printf(bio_s_out, ""LOOKUP done %s\n"", while (i <= 0 && SSL_get_error(con, i) == SSL_ERROR_WANT_X509_LOOKUP) { BIO_printf(bio_s_out, ""LOOKUP during accept %s\n"", srp_callback_parm.login); srp_callback_parm.user = SRP_VBASE_get_by_user(srp_callback_parm.vb, srp_callback_parm.login); if (srp_callback_parm.user) BIO_printf(bio_s_out, ""LOOKUP done %s\n"", srp_callback_parm.user->info); return (1); } BIO_printf(bio_err, ""ERROR\n""); verify_error = SSL_get_verify_result(con); if (verify_error != X509_V_OK) { BIO_printf(bio_err, ""verify error:%s\n"", X509_verify_cert_error_string(verify_error)); } /* Always print any error messages */ ERR_print_errors(bio_err); return (0); } if (s_brief) print_ssl_summary(bio_err, con); PEM_write_bio_SSL_SESSION(bio_s_out, SSL_get_session(con)); peer = SSL_get_peer_certificate(con); if (peer != NULL) { BIO_printf(bio_s_out, ""Client certificate\n""); PEM_write_bio_X509(bio_s_out, peer); X509_NAME_oneline(X509_get_subject_name(peer), buf, sizeof buf); BIO_printf(bio_s_out, ""subject=%s\n"", buf); X509_NAME_oneline(X509_get_issuer_name(peer), buf, sizeof buf); BIO_printf(bio_s_out, ""issuer=%s\n"", buf); X509_free(peer); } if (SSL_get_shared_ciphers(con, buf, sizeof buf) != NULL) BIO_printf(bio_s_out, ""Shared ciphers:%s\n"", buf); str = SSL_CIPHER_get_name(SSL_get_current_cipher(con)); ssl_print_sigalgs(bio_s_out, con); #ifndef OPENSSL_NO_EC ssl_print_point_formats(bio_s_out, con); ssl_print_curves(bio_s_out, con, 0); #endif BIO_printf(bio_s_out, ""CIPHER is %s\n"", (str != NULL) ? str : ""(NONE)""); #if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG) SSL_get0_next_proto_negotiated(con, &next_proto_neg, &next_proto_neg_len); if (next_proto_neg) { BIO_printf(bio_s_out, ""NEXTPROTO is ""); BIO_write(bio_s_out, next_proto_neg, next_proto_neg_len); BIO_printf(bio_s_out, ""\n""); } #endif #ifndef OPENSSL_NO_SRTP { SRTP_PROTECTION_PROFILE *srtp_profile = SSL_get_selected_srtp_profile(con); if (srtp_profile) BIO_printf(bio_s_out, ""SRTP Extension negotiated, profile=%s\n"", srtp_profile->name); } #endif if (SSL_cache_hit(con)) BIO_printf(bio_s_out, ""Reused session-id\n""); if (SSL_ctrl(con, SSL_CTRL_GET_FLAGS, 0, NULL) & TLS1_FLAGS_TLS_PADDING_BUG) BIO_printf(bio_s_out, ""Peer has incorrect TLSv1 block padding\n""); #ifndef OPENSSL_NO_KRB5 client_princ = kssl_ctx_get0_client_princ(SSL_get0_kssl_ctx(con)); if (client_princ != NULL) { BIO_printf(bio_s_out, ""Kerberos peer principal is %s\n"", client_princ); } #endif /* OPENSSL_NO_KRB5 */ BIO_printf(bio_s_out, ""Secure Renegotiation IS%s supported\n"", SSL_get_secure_renegotiation_support(con) ? """" : "" NOT""); if (keymatexportlabel != NULL) { BIO_printf(bio_s_out, ""Keying material exporter:\n""); BIO_printf(bio_s_out, "" Label: '%s'\n"", keymatexportlabel); BIO_printf(bio_s_out, "" Length: %i bytes\n"", keymatexportlen); exportedkeymat = OPENSSL_malloc(keymatexportlen); if (exportedkeymat != NULL) { if (!SSL_export_keying_material(con, exportedkeymat, keymatexportlen, keymatexportlabel, strlen(keymatexportlabel), NULL, 0, 0)) { BIO_printf(bio_s_out, "" Error\n""); } else { BIO_printf(bio_s_out, "" Keying material: ""); for (i = 0; i < keymatexportlen; i++) BIO_printf(bio_s_out, ""%02X"", exportedkeymat[i]); BIO_printf(bio_s_out, ""\n""); } OPENSSL_free(exportedkeymat); } } return (1); } ",1 "QList Smb4KGlobal::findShareByUNC( const QString &unc ) { QList list; mutex.lock(); if ( !unc.isEmpty() && !p->mountedSharesList.isEmpty() ) { for ( int i = 0; i < p->mountedSharesList.size(); ++i ) { if ( QString::compare( unc, p->mountedSharesList.at( i )->unc(), Qt::CaseInsensitive ) == 0 || QString::compare( QString( unc ).replace( ' ', '_' ), p->mountedSharesList.at( i )->unc(), Qt::CaseInsensitive ) == 0 ) { list.append( p->mountedSharesList.at( i ) ); continue; } else { continue; } } } else { } mutex.unlock(); return list; } ",0 "void WebDevToolsAgentImpl::attach() { if (m_attached) return; inspectorController()->connectFrontend(this); inspectorController()->webViewResized(m_webViewImpl->size()); blink::Platform::current()->currentThread()->addTaskObserver(this); m_attached = true; } ",0 "cib_common_callback(qb_ipcs_connection_t *c, void *data, size_t size, gboolean privileged) { uint32_t id = 0; uint32_t flags = 0; int call_options = 0; xmlNode *op_request = crm_ipcs_recv(c, data, size, &id, &flags); cib_client_t *cib_client = qb_ipcs_context_get(c); if(op_request) { crm_element_value_int(op_request, F_CIB_CALLOPTS, &call_options); } crm_trace(""Inbound: %.200s"", data); if (op_request == NULL || cib_client == NULL) { crm_ipcs_send_ack(c, id, ""nack"", __FUNCTION__, __LINE__); return 0; } if(is_set(call_options, cib_sync_call)) { CRM_ASSERT(flags & crm_ipc_client_response); } if(flags & crm_ipc_client_response) { CRM_LOG_ASSERT(cib_client->request_id == 0); /* This means the client has two synchronous events in-flight */ cib_client->request_id = id; /* Reply only to the last one */ } if (cib_client->name == NULL) { const char *value = crm_element_value(op_request, F_CIB_CLIENTNAME); if (value == NULL) { cib_client->name = crm_itoa(crm_ipcs_client_pid(c)); } else { cib_client->name = strdup(value); } } if (cib_client->callback_id == NULL) { const char *value = crm_element_value(op_request, F_CIB_CALLBACK_TOKEN); if (value != NULL) { cib_client->callback_id = strdup(value); } else { cib_client->callback_id = strdup(cib_client->id); } } crm_xml_add(op_request, F_CIB_CLIENTID, cib_client->id); crm_xml_add(op_request, F_CIB_CLIENTNAME, cib_client->name); #if ENABLE_ACL determine_request_user(cib_client->user, op_request, F_CIB_USER); #endif crm_log_xml_trace(op_request, ""Client[inbound]""); cib_common_callback_worker(id, flags, op_request, cib_client, privileged); free_xml(op_request); return 0; } ",0 "png_push_crc_finish(png_structp png_ptr) { if (png_ptr->skip_length && png_ptr->save_buffer_size) { png_size_t save_size; if (png_ptr->skip_length < (png_uint_32)png_ptr->save_buffer_size) save_size = (png_size_t)png_ptr->skip_length; else save_size = png_ptr->save_buffer_size; png_calculate_crc(png_ptr, png_ptr->save_buffer_ptr, save_size); png_ptr->skip_length -= save_size; png_ptr->buffer_size -= save_size; png_ptr->save_buffer_size -= save_size; png_ptr->save_buffer_ptr += save_size; } if (png_ptr->skip_length && png_ptr->current_buffer_size) { png_size_t save_size; if (png_ptr->skip_length < (png_uint_32)png_ptr->current_buffer_size) save_size = (png_size_t)png_ptr->skip_length; else save_size = png_ptr->current_buffer_size; png_calculate_crc(png_ptr, png_ptr->current_buffer_ptr, save_size); png_ptr->skip_length -= save_size; png_ptr->buffer_size -= save_size; png_ptr->current_buffer_size -= save_size; png_ptr->current_buffer_ptr += save_size; } if (!png_ptr->skip_length) { if (png_ptr->buffer_size < 4) { png_push_save_buffer(png_ptr); return; } png_crc_finish(png_ptr, 0); png_ptr->process_mode = PNG_READ_CHUNK_MODE; } } ",0 "static int crypto_report_kpp(struct sk_buff *skb, struct crypto_alg *alg) { struct crypto_report_kpp rkpp; strlcpy(rkpp.type, ""kpp"", sizeof(rkpp.type)); if (nla_put(skb, CRYPTOCFGA_REPORT_KPP, sizeof(struct crypto_report_kpp), &rkpp)) goto nla_put_failure; return 0; nla_put_failure: return -EMSGSIZE; } ",1 "conv_backslash_value(OnigCodePoint c, ScanEnv* env) { if (IS_SYNTAX_OP(env->syntax, ONIG_SYN_OP_ESC_CONTROL_CHARS)) { switch (c) { case 'n': return '\n'; case 't': return '\t'; case 'r': return '\r'; case 'f': return '\f'; case 'a': return '\007'; case 'b': return '\010'; case 'e': return '\033'; case 'v': if (IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_ESC_V_VTAB)) return '\v'; break; default: if (('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z')) UNKNOWN_ESC_WARN(env, c); break; } } return c; } ",0 "PHP_FUNCTION(openssl_pkcs12_read) { zval *zout = NULL, *zextracerts, *zcert, *zpkey; char *pass, *zp12; int pass_len, zp12_len; PKCS12 * p12 = NULL; EVP_PKEY * pkey = NULL; X509 * cert = NULL; STACK_OF(X509) * ca = NULL; BIO * bio_in = NULL; int i; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""szs"", &zp12, &zp12_len, &zout, &pass, &pass_len) == FAILURE) return; RETVAL_FALSE; bio_in = BIO_new(BIO_s_mem()); if(!BIO_write(bio_in, zp12, zp12_len)) goto cleanup; if(d2i_PKCS12_bio(bio_in, &p12)) { if(PKCS12_parse(p12, pass, &pkey, &cert, &ca)) { BIO * bio_out; zval_dtor(zout); array_init(zout); bio_out = BIO_new(BIO_s_mem()); if (PEM_write_bio_X509(bio_out, cert)) { BUF_MEM *bio_buf; BIO_get_mem_ptr(bio_out, &bio_buf); MAKE_STD_ZVAL(zcert); ZVAL_STRINGL(zcert, bio_buf->data, bio_buf->length, 1); add_assoc_zval(zout, ""cert"", zcert); } BIO_free(bio_out); bio_out = BIO_new(BIO_s_mem()); if (PEM_write_bio_PrivateKey(bio_out, pkey, NULL, NULL, 0, 0, NULL)) { BUF_MEM *bio_buf; BIO_get_mem_ptr(bio_out, &bio_buf); MAKE_STD_ZVAL(zpkey); ZVAL_STRINGL(zpkey, bio_buf->data, bio_buf->length, 1); add_assoc_zval(zout, ""pkey"", zpkey); } BIO_free(bio_out); MAKE_STD_ZVAL(zextracerts); array_init(zextracerts); for (i=0;;i++) { zval * zextracert; X509* aCA = sk_X509_pop(ca); if (!aCA) break; bio_out = BIO_new(BIO_s_mem()); if (PEM_write_bio_X509(bio_out, aCA)) { BUF_MEM *bio_buf; BIO_get_mem_ptr(bio_out, &bio_buf); MAKE_STD_ZVAL(zextracert); ZVAL_STRINGL(zextracert, bio_buf->data, bio_buf->length, 1); add_index_zval(zextracerts, i, zextracert); } BIO_free(bio_out); X509_free(aCA); } if(ca) { sk_X509_free(ca); add_assoc_zval(zout, ""extracerts"", zextracerts); } else { zval_dtor(zextracerts); } RETVAL_TRUE; PKCS12_free(p12); } } cleanup: if (bio_in) { BIO_free(bio_in); } if (pkey) { EVP_PKEY_free(pkey); } if (cert) { X509_free(cert); } } ",0 "void ist_begin_non_atomic(struct pt_regs *regs) { BUG_ON(!user_mode(regs)); /* * Sanity check: we need to be on the normal thread stack. This * will catch asm bugs and any attempt to use ist_preempt_enable * from double_fault. */ BUG_ON(!on_thread_stack()); preempt_enable_no_resched(); } ",0 " void RegisterProcess(const std::string& site, RenderProcessHost* process) { map_[site] = process; } ",0 "bool ServiceWorkerDevToolsAgentHost::Activate() { return false; } ",0 "void RenderViewImpl::didCreateScriptContext(WebFrame* frame, v8::Handle context, int world_id) { content::GetContentClient()->renderer()->DidCreateScriptContext( frame, context, -1, world_id); } ",0 " static int sha384_init(struct shash_desc *desc) { struct s390_sha_ctx *ctx = shash_desc_ctx(desc); *(__u64 *)&ctx->state[0] = 0xcbbb9d5dc1059ed8ULL; *(__u64 *)&ctx->state[2] = 0x629a292a367cd507ULL; *(__u64 *)&ctx->state[4] = 0x9159015a3070dd17ULL; *(__u64 *)&ctx->state[6] = 0x152fecd8f70e5939ULL; *(__u64 *)&ctx->state[8] = 0x67332667ffc00b31ULL; *(__u64 *)&ctx->state[10] = 0x8eb44a8768581511ULL; *(__u64 *)&ctx->state[12] = 0xdb0c2e0d64f98fa7ULL; *(__u64 *)&ctx->state[14] = 0x47b5481dbefa4fa4ULL; ctx->count = 0; ctx->func = KIMD_SHA_512; return 0; } ",0 "GLES2DecoderPassthroughImpl::DoStencilThenCoverFillPathInstancedCHROMIUM( GLsizei numPaths, GLenum pathNameType, const GLvoid* paths, GLsizei pathsBufsize, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat* transformValues, GLsizei transformValuesBufsize) { NOTIMPLEMENTED(); return error::kNoError; } ",0 "void Document::enqueuePageshowEvent(PageshowEventPersistence persisted) { dispatchWindowEvent(PageTransitionEvent::create(EventTypeNames::pageshow, persisted), this); } ",0 "const uint16* GetPortFieldFromAddrinfo(const struct addrinfo* info) { DCHECK(info); const struct sockaddr* address = info->ai_addr; DCHECK(address); DCHECK_EQ(info->ai_family, address->sa_family); return GetPortFieldFromSockaddr(address, info->ai_addrlen); } ",0 "static void __init dcache_init(void) { unsigned int loop; /* * A constructor could be added for stable state like the lists, * but it is probably not worth it because of the cache nature * of the dcache. */ dentry_cache = KMEM_CACHE(dentry, SLAB_RECLAIM_ACCOUNT|SLAB_PANIC|SLAB_MEM_SPREAD); /* Hash may have been set up in dcache_init_early */ if (!hashdist) return; dentry_hashtable = alloc_large_system_hash(""Dentry cache"", sizeof(struct hlist_bl_head), dhash_entries, 13, 0, &d_hash_shift, &d_hash_mask, 0, 0); for (loop = 0; loop < (1U << d_hash_shift); loop++) INIT_HLIST_BL_HEAD(dentry_hashtable + loop); } ",0 " virtual GURL TestUrl() { return GURL(kAboutBlankURL); } ",0 "void WebMediaPlayerImpl::UpdatePlayState() { DCHECK(main_task_runner_->BelongsToCurrentThread()); #if defined(OS_ANDROID) // WMPI_CAST bool is_remote = IsRemote(); bool can_auto_suspend = true; #else bool is_remote = false; bool can_auto_suspend = !disable_pipeline_auto_suspend_; if (IsStreaming()) { bool at_beginning = ready_state_ == WebMediaPlayer::kReadyStateHaveNothing || CurrentTime() == 0.0; if (!at_beginning || GetPipelineMediaDuration() == kInfiniteDuration) can_auto_suspend = false; } #endif bool is_suspended = pipeline_controller_.IsSuspended(); bool is_backgrounded = IsBackgroundedSuspendEnabled() && IsHidden(); PlayState state = UpdatePlayState_ComputePlayState( is_remote, can_auto_suspend, is_suspended, is_backgrounded); SetDelegateState(state.delegate_state, state.is_idle); SetMemoryReportingState(state.is_memory_reporting_enabled); SetSuspendState(state.is_suspended || pending_suspend_resume_cycle_); } ",0 "CreateSession::CreateSession(const std::vector& path_segments, const DictionaryValue* const parameters) : Command(path_segments, parameters) {} ",0 " const pp::ImageData& buffer() const { return buffer_; } ",0 "void RenderFrameHostImpl::GetInterface( const std::string& interface_name, mojo::ScopedMessagePipeHandle interface_pipe) { if (!registry_ || !registry_->TryBindInterface(interface_name, &interface_pipe)) { delegate_->OnInterfaceRequest(this, interface_name, &interface_pipe); if (interface_pipe.is_valid() && !TryBindFrameInterface(interface_name, &interface_pipe, this)) { GetContentClient()->browser()->BindInterfaceRequestFromFrame( this, interface_name, std::move(interface_pipe)); } } } ",0 "void DownloadManagerImpl::OnUrlDownloadStopped(UrlDownloadHandler* downloader) { for (auto ptr = url_download_handlers_.begin(); ptr != url_download_handlers_.end(); ++ptr) { if (ptr->get() == downloader) { url_download_handlers_.erase(ptr); return; } } } ",0 " int GetSelectedIndex() { base::string16 script(base::ASCIIToUTF16(kSelectID)); script.append(base::ASCIIToUTF16("".selectedIndex"")); int selected_index = -1; ExecuteJavaScriptAndReturnIntValue(script, &selected_index); return selected_index; } ",0 " bool decode(const SharedBuffer& data, bool onlySize) { m_decodingSizeOnly = onlySize; unsigned newByteCount = data.size() - m_bufferLength; unsigned readOffset = m_bufferLength - m_info.src->bytes_in_buffer; m_info.src->bytes_in_buffer += newByteCount; m_info.src->next_input_byte = (JOCTET*)(data.data()) + readOffset; if (m_bytesToSkip) skipBytes(m_bytesToSkip); m_bufferLength = data.size(); if (setjmp(m_err.setjmp_buffer)) return m_decoder->setFailed(); switch (m_state) { case JPEG_HEADER: if (jpeg_read_header(&m_info, true) == JPEG_SUSPENDED) return false; // I/O suspension. switch (m_info.jpeg_color_space) { case JCS_GRAYSCALE: case JCS_RGB: case JCS_YCbCr: m_info.out_color_space = rgbOutputColorSpace(); #if defined(TURBO_JPEG_RGB_SWIZZLE) if (m_info.saw_JFIF_marker) break; if (m_info.saw_Adobe_marker && !m_info.Adobe_transform) m_info.out_color_space = JCS_RGB; #endif break; case JCS_CMYK: case JCS_YCCK: m_info.out_color_space = JCS_CMYK; break; default: return m_decoder->setFailed(); } m_state = JPEG_START_DECOMPRESS; if (!m_decoder->setSize(m_info.image_width, m_info.image_height)) return false; m_decoder->setOrientation(readImageOrientation(info())); #if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) && defined(TURBO_JPEG_RGB_SWIZZLE) if (m_decoder->willDownSample() && turboSwizzled(m_info.out_color_space)) m_info.out_color_space = JCS_RGB; #endif #if USE(QCMSLIB) if (!m_decoder->ignoresGammaAndColorProfile()) { ColorProfile colorProfile = readColorProfile(info()); createColorTransform(colorProfile, colorSpaceHasAlpha(m_info.out_color_space)); #if defined(TURBO_JPEG_RGB_SWIZZLE) if (m_transform && m_info.out_color_space == JCS_EXT_BGRA) m_info.out_color_space = JCS_EXT_RGBA; #endif } #endif m_info.buffered_image = jpeg_has_multiple_scans(&m_info); jpeg_calc_output_dimensions(&m_info); m_samples = (*m_info.mem->alloc_sarray)((j_common_ptr) &m_info, JPOOL_IMAGE, m_info.output_width * 4, 1); if (m_decodingSizeOnly) { m_bufferLength -= m_info.src->bytes_in_buffer; m_info.src->bytes_in_buffer = 0; return true; } case JPEG_START_DECOMPRESS: m_info.dct_method = dctMethod(); m_info.dither_mode = ditherMode(); m_info.do_fancy_upsampling = doFancyUpsampling(); m_info.enable_2pass_quant = false; m_info.do_block_smoothing = true; if (!jpeg_start_decompress(&m_info)) return false; // I/O suspension. m_state = (m_info.buffered_image) ? JPEG_DECOMPRESS_PROGRESSIVE : JPEG_DECOMPRESS_SEQUENTIAL; case JPEG_DECOMPRESS_SEQUENTIAL: if (m_state == JPEG_DECOMPRESS_SEQUENTIAL) { if (!m_decoder->outputScanlines()) return false; // I/O suspension. ASSERT(m_info.output_scanline == m_info.output_height); m_state = JPEG_DONE; } case JPEG_DECOMPRESS_PROGRESSIVE: if (m_state == JPEG_DECOMPRESS_PROGRESSIVE) { int status; do { status = jpeg_consume_input(&m_info); } while ((status != JPEG_SUSPENDED) && (status != JPEG_REACHED_EOI)); for (;;) { if (!m_info.output_scanline) { int scan = m_info.input_scan_number; if (!m_info.output_scan_number && (scan > 1) && (status != JPEG_REACHED_EOI)) --scan; if (!jpeg_start_output(&m_info, scan)) return false; // I/O suspension. } if (m_info.output_scanline == 0xffffff) m_info.output_scanline = 0; if (!m_decoder->outputScanlines()) { if (!m_info.output_scanline) m_info.output_scanline = 0xffffff; return false; // I/O suspension. } if (m_info.output_scanline == m_info.output_height) { if (!jpeg_finish_output(&m_info)) return false; // I/O suspension. if (jpeg_input_complete(&m_info) && (m_info.input_scan_number == m_info.output_scan_number)) break; m_info.output_scanline = 0; } } m_state = JPEG_DONE; } case JPEG_DONE: return jpeg_finish_decompress(&m_info); case JPEG_ERROR: return m_decoder->setFailed(); } return true; } ",1 "int TopSitesImpl::GetRedirectDistanceForURL(const MostVisitedURL& most_visited, const GURL& url) { for (size_t i = 0; i < most_visited.redirects.size(); i++) { if (most_visited.redirects[i] == url) return static_cast(most_visited.redirects.size() - i - 1); } NOTREACHED() << ""URL should always be found.""; return 0; } ",0 "IntPoint PaintLayerScrollableArea::ConvertFromRootFrame( const IntPoint& point_in_root_frame) const { LayoutView* view = GetLayoutBox()->View(); if (!view) return point_in_root_frame; return view->GetFrameView()->ConvertFromRootFrame(point_in_root_frame); } ",0 "bool AllRootWindowsHaveModalBackgroundsForContainer(int container_id) { aura::Window::Windows containers = wm::GetContainersFromAllRootWindows(container_id); bool has_modal_screen = !containers.empty(); for (aura::Window* container : containers) { has_modal_screen &= static_cast( container->layout_manager()) ->has_window_dimmer(); } return has_modal_screen; } ",0 "void DownloadResourceHandler::OnReadCompleted( int bytes_read, std::unique_ptr controller) { DCHECK(!has_controller()); bool defer = false; if (!core_.OnReadCompleted(bytes_read, &defer)) { controller->Cancel(); return; } if (defer) { HoldController(std::move(controller)); } else { controller->Resume(); } } ",0 "static MagickBooleanType Huffman2DEncodeImage(const ImageInfo *image_info, Image *image,Image *inject_image) { Image *group4_image; ImageInfo *write_info; MagickBooleanType status; size_t length; unsigned char *group4; status=MagickTrue; write_info=CloneImageInfo(image_info); (void) CopyMagickString(write_info->filename,""GROUP4:"",MaxTextExtent); (void) CopyMagickString(write_info->magick,""GROUP4"",MaxTextExtent); group4_image=CloneImage(inject_image,0,0,MagickTrue,&image->exception); if (group4_image == (Image *) NULL) return(MagickFalse); group4=(unsigned char *) ImageToBlob(write_info,group4_image,&length, &image->exception); group4_image=DestroyImage(group4_image); if (group4 == (unsigned char *) NULL) return(MagickFalse); write_info=DestroyImageInfo(write_info); if (WriteBlob(image,length,group4) != (ssize_t) length) status=MagickFalse; group4=(unsigned char *) RelinquishMagickMemory(group4); return(status); } ",0 "static inline void swap_words_in_key_and_bits_in_byte(const u8 *in, u8 *out, u32 len) { unsigned int i = 0; int j; int index = 0; j = len - BYTES_PER_WORD; while (j >= 0) { for (i = 0; i < BYTES_PER_WORD; i++) { index = len - j - BYTES_PER_WORD + i; out[j + i] = swap_bits_in_byte(in[index]); } j -= BYTES_PER_WORD; } } ",0 "Element* Editor::FindEventTargetFrom(const VisibleSelection& selection) const { Element* target = AssociatedElementOf(selection.Start()); if (!target) target = GetFrame().GetDocument()->body(); return target; } ",0 "int drm_framebuffer_init(struct drm_device *dev, struct drm_framebuffer *fb, const struct drm_framebuffer_funcs *funcs) { int ret; ret = drm_mode_object_get(dev, &fb->base, DRM_MODE_OBJECT_FB); if (ret) { return ret; } fb->dev = dev; fb->funcs = funcs; dev->mode_config.num_fb++; list_add(&fb->head, &dev->mode_config.fb_list); return 0; } ",0 "static int __init nf_tables_module_init(void) { int err; info = kmalloc(sizeof(struct nft_expr_info) * NFT_RULE_MAXEXPRS, GFP_KERNEL); if (info == NULL) { err = -ENOMEM; goto err1; } err = nf_tables_core_module_init(); if (err < 0) goto err2; err = nfnetlink_subsys_register(&nf_tables_subsys); if (err < 0) goto err3; pr_info(""nf_tables: (c) 2007-2009 Patrick McHardy \n""); return register_pernet_subsys(&nf_tables_net_ops); err3: nf_tables_core_module_exit(); err2: kfree(info); err1: return err; } ",0 "static int hns_nic_uc_unsync(struct net_device *netdev, const unsigned char *addr) { struct hns_nic_priv *priv = netdev_priv(netdev); struct hnae_handle *h = priv->ae_handle; if (h->dev->ops->rm_uc_addr) return h->dev->ops->rm_uc_addr(h, addr); return 0; } ",0 "void GLES2DecoderImpl::DoUniformMatrix2fv( GLint fake_location, GLsizei count, GLboolean transpose, const GLfloat* value) { GLenum type = 0; GLint real_location = -1; if (!PrepForSetUniformByLocation(fake_location, ""glUniformMatrix2fv"", Program::kUniformMatrix2f, &real_location, &type, &count)) { return; } glUniformMatrix2fv(real_location, count, transpose, value); } ",0 "void flush_sit_entries(struct f2fs_sb_info *sbi, struct cp_control *cpc) { struct sit_info *sit_i = SIT_I(sbi); unsigned long *bitmap = sit_i->dirty_sentries_bitmap; struct curseg_info *curseg = CURSEG_I(sbi, CURSEG_COLD_DATA); struct f2fs_journal *journal = curseg->journal; struct sit_entry_set *ses, *tmp; struct list_head *head = &SM_I(sbi)->sit_entry_set; bool to_journal = true; struct seg_entry *se; mutex_lock(&sit_i->sentry_lock); if (!sit_i->dirty_sentries) goto out; /* * add and account sit entries of dirty bitmap in sit entry * set temporarily */ add_sits_in_set(sbi); /* * if there are no enough space in journal to store dirty sit * entries, remove all entries from journal and add and account * them in sit entry set. */ if (!__has_cursum_space(journal, sit_i->dirty_sentries, SIT_JOURNAL)) remove_sits_in_journal(sbi); /* * there are two steps to flush sit entries: * #1, flush sit entries to journal in current cold data summary block. * #2, flush sit entries to sit page. */ list_for_each_entry_safe(ses, tmp, head, set_list) { struct page *page = NULL; struct f2fs_sit_block *raw_sit = NULL; unsigned int start_segno = ses->start_segno; unsigned int end = min(start_segno + SIT_ENTRY_PER_BLOCK, (unsigned long)MAIN_SEGS(sbi)); unsigned int segno = start_segno; if (to_journal && !__has_cursum_space(journal, ses->entry_cnt, SIT_JOURNAL)) to_journal = false; if (to_journal) { down_write(&curseg->journal_rwsem); } else { page = get_next_sit_page(sbi, start_segno); raw_sit = page_address(page); } /* flush dirty sit entries in region of current sit set */ for_each_set_bit_from(segno, bitmap, end) { int offset, sit_offset; se = get_seg_entry(sbi, segno); /* add discard candidates */ if (!(cpc->reason & CP_DISCARD)) { cpc->trim_start = segno; add_discard_addrs(sbi, cpc, false); } if (to_journal) { offset = lookup_journal_in_cursum(journal, SIT_JOURNAL, segno, 1); f2fs_bug_on(sbi, offset < 0); segno_in_journal(journal, offset) = cpu_to_le32(segno); seg_info_to_raw_sit(se, &sit_in_journal(journal, offset)); } else { sit_offset = SIT_ENTRY_OFFSET(sit_i, segno); seg_info_to_raw_sit(se, &raw_sit->entries[sit_offset]); } __clear_bit(segno, bitmap); sit_i->dirty_sentries--; ses->entry_cnt--; } if (to_journal) up_write(&curseg->journal_rwsem); else f2fs_put_page(page, 1); f2fs_bug_on(sbi, ses->entry_cnt); release_sit_entry_set(ses); } f2fs_bug_on(sbi, !list_empty(head)); f2fs_bug_on(sbi, sit_i->dirty_sentries); out: if (cpc->reason & CP_DISCARD) { __u64 trim_start = cpc->trim_start; for (; cpc->trim_start <= cpc->trim_end; cpc->trim_start++) add_discard_addrs(sbi, cpc, false); cpc->trim_start = trim_start; } mutex_unlock(&sit_i->sentry_lock); set_prefree_as_free_segments(sbi); } ",0 "bool ExecuteCodeInTabFunction::IsWebView() const { return false; } ",0 "void ContextState::SetMaxWindowRectangles(size_t max) { window_rectangles_ = std::vector(max * 4, 0); } ",0 "QWebNavigationHistory* QQuickWebViewExperimental::navigationHistory() const { return d_ptr->navigationHistory.get(); } ",0 "gfx::Vector2d BrowserViewRenderer::max_scroll_offset() const { DCHECK_GT(dip_scale_, 0.f); return gfx::ToCeiledVector2d(gfx::ScaleVector2d( max_scroll_offset_dip_, dip_scale_ * page_scale_factor_)); } ",0 "IOThread::Globals::Globals() : system_request_context_leak_checker(this), ignore_certificate_errors(false), http_pipelining_enabled(false), testing_fixed_http_port(0), testing_fixed_https_port(0), enable_user_alternate_protocol_ports(false) { } ",0 "static int sctp_getsockopt_peer_auth_chunks(struct sock *sk, int len, char __user *optval, int __user *optlen) { struct sctp_endpoint *ep = sctp_sk(sk)->ep; struct sctp_authchunks __user *p = (void __user *)optval; struct sctp_authchunks val; struct sctp_association *asoc; struct sctp_chunks_param *ch; u32 num_chunks = 0; char __user *to; if (!ep->auth_enable) return -EACCES; if (len < sizeof(struct sctp_authchunks)) return -EINVAL; if (copy_from_user(&val, optval, sizeof(struct sctp_authchunks))) return -EFAULT; to = p->gauth_chunks; asoc = sctp_id2assoc(sk, val.gauth_assoc_id); if (!asoc) return -EINVAL; ch = asoc->peer.peer_chunks; if (!ch) goto num; /* See if the user provided enough room for all the data */ num_chunks = ntohs(ch->param_hdr.length) - sizeof(sctp_paramhdr_t); if (len < num_chunks) return -EINVAL; if (copy_to_user(to, ch->chunks, num_chunks)) return -EFAULT; num: len = sizeof(struct sctp_authchunks) + num_chunks; if (put_user(len, optlen)) return -EFAULT; if (put_user(num_chunks, &p->gauth_number_of_chunks)) return -EFAULT; return 0; } ",0 "cifs_has_mand_locks(struct cifsInodeInfo *cinode) { struct cifs_fid_locks *cur; bool has_locks = false; down_read(&cinode->lock_sem); list_for_each_entry(cur, &cinode->llist, llist) { if (!list_empty(&cur->locks)) { has_locks = true; break; } } up_read(&cinode->lock_sem); return has_locks; } ",0 "unsigned int mnt_get_count(struct mount *mnt) { #ifdef CONFIG_SMP unsigned int count = 0; int cpu; for_each_possible_cpu(cpu) { count += per_cpu_ptr(mnt->mnt_pcp, cpu)->mnt_count; } return count; #else return mnt->mnt_count; #endif } ",0 "MODRET set_useralias(cmd_rec *cmd) { config_rec *c = NULL; CHECK_ARGS(cmd, 2); CHECK_CONF(cmd, CONF_ROOT|CONF_VIRTUAL|CONF_GLOBAL|CONF_ANON); /* Make sure that the given names differ. */ if (strcmp(cmd->argv[1], cmd->argv[2]) == 0) CONF_ERROR(cmd, ""alias and real user names must differ""); c = add_config_param_str(cmd->argv[0], 2, cmd->argv[1], cmd->argv[2]); /* Note: only merge this directive down if it is not appearing in an * context. */ if (!check_context(cmd, CONF_ANON)) { c->flags |= CF_MERGEDOWN_MULTI; } return PR_HANDLED(cmd); } ",0 "cmsBool Type_XYZ_Write(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, void* Ptr, cmsUInt32Number nItems) { return _cmsWriteXYZNumber(io, (cmsCIEXYZ*) Ptr); cmsUNUSED_PARAMETER(nItems); cmsUNUSED_PARAMETER(self); } ",0 "smp_fetch_base32(struct proxy *px, struct session *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw) { struct http_txn *txn = l7; struct hdr_ctx ctx; unsigned int hash = 0; char *ptr, *beg, *end; int len; CHECK_HTTP_MESSAGE_FIRST(); ctx.idx = 0; if (http_find_header2(""Host"", 4, txn->req.chn->buf->p, &txn->hdr_idx, &ctx)) { /* OK we have the header value in ctx.line+ctx.val for ctx.vlen bytes */ ptr = ctx.line + ctx.val; len = ctx.vlen; while (len--) hash = *(ptr++) + (hash << 6) + (hash << 16) - hash; } /* now retrieve the path */ end = txn->req.chn->buf->p + txn->req.sl.rq.u + txn->req.sl.rq.u_l; beg = http_get_path(txn); if (!beg) beg = end; for (ptr = beg; ptr < end && *ptr != '?'; ptr++); if (beg < ptr && *beg == '/') { while (beg < ptr) hash = *(beg++) + (hash << 6) + (hash << 16) - hash; } hash = full_hash(hash); smp->type = SMP_T_UINT; smp->data.uint = hash; smp->flags = SMP_F_VOL_1ST; return 1; } ",0 "scoped_refptr WebGLRenderingContextBase::CreateDrawingBuffer( std::unique_ptr context_provider, bool using_gpu_compositing) { bool premultiplied_alpha = CreationAttributes().premultiplied_alpha; bool want_alpha_channel = CreationAttributes().alpha; bool want_depth_buffer = CreationAttributes().depth; bool want_stencil_buffer = CreationAttributes().stencil; bool want_antialiasing = CreationAttributes().antialias; DrawingBuffer::PreserveDrawingBuffer preserve = CreationAttributes().preserve_drawing_buffer ? DrawingBuffer::kPreserve : DrawingBuffer::kDiscard; DrawingBuffer::WebGLVersion web_gl_version = DrawingBuffer::kWebGL1; if (Version() == 1) { web_gl_version = DrawingBuffer::kWebGL1; } else if (Version() == 2) { web_gl_version = DrawingBuffer::kWebGL2; } else { NOTREACHED(); } DrawingBuffer::ChromiumImageUsage chromium_image_usage = Host()->IsOffscreenCanvas() ? DrawingBuffer::kDisallowChromiumImage : DrawingBuffer::kAllowChromiumImage; return DrawingBuffer::Create( std::move(context_provider), using_gpu_compositing, this, ClampedCanvasSize(), premultiplied_alpha, want_alpha_channel, want_depth_buffer, want_stencil_buffer, want_antialiasing, preserve, web_gl_version, chromium_image_usage, ColorParams()); } ",0 "e1000e_intmgr_timer_resume(E1000IntrDelayTimer *timer) { if (timer->running) { e1000e_intrmgr_rearm_timer(timer); } } ",0 "static GLenum translate_blend_func(uint32_t pipe_blend) { switch(pipe_blend){ case PIPE_BLEND_ADD: return GL_FUNC_ADD; case PIPE_BLEND_SUBTRACT: return GL_FUNC_SUBTRACT; case PIPE_BLEND_REVERSE_SUBTRACT: return GL_FUNC_REVERSE_SUBTRACT; case PIPE_BLEND_MIN: return GL_MIN; case PIPE_BLEND_MAX: return GL_MAX; default: assert(""invalid blend token()"" == NULL); return 0; } } ",0 "void FrameLoader::CommitNavigation( std::unique_ptr navigation_params, std::unique_ptr extra_data) { DCHECK(frame_->GetDocument()); DCHECK(Client()->HasWebView()); if (in_stop_all_loaders_ || !frame_->IsNavigationAllowed() || frame_->GetDocument()->PageDismissalEventBeingDispatched() != Document::kNoDismissal) { return; } if (HTMLFrameOwnerElement* element = frame_->DeprecatedLocalOwner()) element->CancelPendingLazyLoad(); navigation_params->frame_load_type = DetermineFrameLoadType( navigation_params->url, navigation_params->http_method, nullptr /* origin_document */, navigation_params->unreachable_url, navigation_params->frame_load_type); RecordLatestRequiredCSP(); if (!CancelProvisionalLoaderForNewNavigation( false /* cancel_scheduled_navigations */, DocumentLoader::WillLoadUrlAsEmpty(navigation_params->url))) { return; } WebNavigationType navigation_type = DetermineNavigationType( navigation_params->frame_load_type, !navigation_params->http_body.IsNull(), false /* have_event */); HistoryItem* history_item = nullptr; if (IsBackForwardLoadType(navigation_params->frame_load_type)) { history_item = navigation_params->history_item; DCHECK(history_item); } provisional_document_loader_ = Client()->CreateDocumentLoader( frame_, navigation_type, std::move(navigation_params), std::move(extra_data)); if (history_item) provisional_document_loader_->SetItemForHistoryNavigation(history_item); frame_->GetFrameScheduler()->DidStartProvisionalLoad(frame_->IsMainFrame()); Client()->DispatchDidStartProvisionalLoad(provisional_document_loader_); probe::DidStartProvisionalLoad(frame_); virtual_time_pauser_.PauseVirtualTime(); provisional_document_loader_->StartLoading(); TakeObjectSnapshot(); } ",0 "void ExtensionInstallUI::Prompt::SetInlineInstallWebstoreData( const std::string& localized_user_count, double average_rating, int rating_count) { CHECK_EQ(INLINE_INSTALL_PROMPT, type_); localized_user_count_ = localized_user_count; average_rating_ = average_rating; rating_count_ = rating_count; } ",0 "static apr_status_t reset_request_notes(void *dummy) { num_request_notes = AP_NUM_STD_NOTES; return APR_SUCCESS; } ",0 "int skcipher_walk_virt(struct skcipher_walk *walk, struct skcipher_request *req, bool atomic) { int err; walk->flags &= ~SKCIPHER_WALK_PHYS; err = skcipher_walk_skcipher(walk, req); walk->flags &= atomic ? ~SKCIPHER_WALK_SLEEP : ~0; return err; } ",0 "asn1_decode_sequence_of_keys(krb5_data *in, ldap_seqof_key_data *out) { krb5_error_code err; ldap_seqof_key_data *p; int i; memset(out, 0, sizeof(*out)); /* * This should be pushed back into other library initialization * code. */ err = kldap_ensure_initialized (); if (err) return err; err = accessor.asn1_ldap_decode_sequence_of_keys(in, &p); if (err) return err; /* Set kvno and key_data_ver in each key_data element. */ for (i = 0; i < p->n_key_data; i++) { p->key_data[i].key_data_kvno = p->kvno; /* The decoder sets key_data_ver to 1 if no salt is present, but leaves * it at 0 if salt is present. */ if (p->key_data[i].key_data_ver == 0) p->key_data[i].key_data_ver = 2; } *out = *p; free(p); return 0; } ",0 "PassRefPtr AccessibilityUIElement::childAtIndex(unsigned index) { Vector > children; getChildrenWithRange(children, index, 1); if (children.size() == 1) return children[0]; return 0; } ",0 "fbCombineDisjointOutReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineDisjointGeneralC (dest, src, mask, width, CombineBOut); } ",0 "static int afiucv_netdev_event(struct notifier_block *this, unsigned long event, void *ptr) { struct net_device *event_dev = netdev_notifier_info_to_dev(ptr); struct sock *sk; struct iucv_sock *iucv; switch (event) { case NETDEV_REBOOT: case NETDEV_GOING_DOWN: sk_for_each(sk, &iucv_sk_list.head) { iucv = iucv_sk(sk); if ((iucv->hs_dev == event_dev) && (sk->sk_state == IUCV_CONNECTED)) { if (event == NETDEV_GOING_DOWN) iucv_send_ctrl(sk, AF_IUCV_FLAG_FIN); sk->sk_state = IUCV_DISCONN; sk->sk_state_change(sk); } } break; case NETDEV_DOWN: case NETDEV_UNREGISTER: default: break; } return NOTIFY_DONE; } ",0 "static ssize_t store_user_store(struct kmem_cache *s, const char *buf, size_t length) { if (any_slab_objects(s)) return -EBUSY; s->flags &= ~SLAB_STORE_USER; if (buf[0] == '1') s->flags |= SLAB_STORE_USER; calculate_sizes(s, -1); return length; } ",0 "defang( char* str, char* dfstr, int dfsize ) { char* cp1; char* cp2; for ( cp1 = str, cp2 = dfstr; *cp1 != '\0' && cp2 - dfstr < dfsize - 5; ++cp1, ++cp2 ) { switch ( *cp1 ) { case '<': *cp2++ = '&'; *cp2++ = 'l'; *cp2++ = 't'; *cp2 = ';'; break; case '>': *cp2++ = '&'; *cp2++ = 'g'; *cp2++ = 't'; *cp2 = ';'; break; default: *cp2 = *cp1; break; } } *cp2 = '\0'; } ",0 "static inline unsigned start_dir_add(struct inode *dir) { for (;;) { unsigned n = dir->i_dir_seq; if (!(n & 1) && cmpxchg(&dir->i_dir_seq, n, n + 1) == n) return n; cpu_relax(); } } ",0 "void* Type_Text_Description_Dup(struct _cms_typehandler_struct* self, const void *Ptr, cmsUInt32Number n) { return (void*) cmsMLUdup((cmsMLU*) Ptr); cmsUNUSED_PARAMETER(n); cmsUNUSED_PARAMETER(self); } ",0 "static const char *default_charset(void) { # if defined HAVE_LIBCHARSET_H && defined HAVE_LOCALE_CHARSET return locale_charset(); # elif defined HAVE_LANGINFO_H && defined HAVE_NL_LANGINFO return nl_langinfo(CODESET); # else return """"; /* Works with (at the very least) gnu iconv... */ # endif } ",0 "PHP_FUNCTION(openssl_encrypt) { long options = 0; char *data, *method, *password, *iv = """"; int data_len, method_len, password_len, iv_len = 0, max_iv_len; const EVP_CIPHER *cipher_type; EVP_CIPHER_CTX cipher_ctx; int i=0, outlen, keylen; unsigned char *outbuf, *key; zend_bool free_iv; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""sss|ls"", &data, &data_len, &method, &method_len, &password, &password_len, &options, &iv, &iv_len) == FAILURE) { return; } cipher_type = EVP_get_cipherbyname(method); if (!cipher_type) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Unknown cipher algorithm""); RETURN_FALSE; } keylen = EVP_CIPHER_key_length(cipher_type); if (keylen > password_len) { key = emalloc(keylen); memset(key, 0, keylen); memcpy(key, password, password_len); } else { key = (unsigned char*)password; } max_iv_len = EVP_CIPHER_iv_length(cipher_type); if (iv_len <= 0 && max_iv_len > 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Using an empty Initialization Vector (iv) is potentially insecure and not recommended""); } free_iv = php_openssl_validate_iv(&iv, &iv_len, max_iv_len TSRMLS_CC); outlen = data_len + EVP_CIPHER_block_size(cipher_type); outbuf = safe_emalloc(outlen, 1, 1); EVP_EncryptInit(&cipher_ctx, cipher_type, NULL, NULL); if (password_len > keylen) { EVP_CIPHER_CTX_set_key_length(&cipher_ctx, password_len); } EVP_EncryptInit_ex(&cipher_ctx, NULL, NULL, key, (unsigned char *)iv); if (options & OPENSSL_ZERO_PADDING) { EVP_CIPHER_CTX_set_padding(&cipher_ctx, 0); } if (data_len > 0) { EVP_EncryptUpdate(&cipher_ctx, outbuf, &i, (unsigned char *)data, data_len); } outlen = i; if (EVP_EncryptFinal(&cipher_ctx, (unsigned char *)outbuf + i, &i)) { outlen += i; if (options & OPENSSL_RAW_DATA) { outbuf[outlen] = '\0'; RETVAL_STRINGL_CHECK((char *)outbuf, outlen, 0); } else { int base64_str_len; char *base64_str; base64_str = (char*)php_base64_encode(outbuf, outlen, &base64_str_len); efree(outbuf); if (!base64_str) { RETVAL_FALSE; } else { RETVAL_STRINGL(base64_str, base64_str_len, 0); } } } else { efree(outbuf); RETVAL_FALSE; } if (key != (unsigned char*)password) { efree(key); } if (free_iv) { efree(iv); } EVP_CIPHER_CTX_cleanup(&cipher_ctx); } ",0 "bool GLES2Implementation::GetInteger64i_vHelper(GLenum pname, GLuint index, GLint64* data) { return false; } ",0 "struct dentry *debugfs_lookup(const char *name, struct dentry *parent) { struct dentry *dentry; if (IS_ERR(parent)) return NULL; if (!parent) parent = debugfs_mount->mnt_root; inode_lock(d_inode(parent)); dentry = lookup_one_len(name, parent, strlen(name)); inode_unlock(d_inode(parent)); if (IS_ERR(dentry)) return NULL; if (!d_really_is_positive(dentry)) { dput(dentry); return NULL; } return dentry; } ",0 "static int rsm_load_seg_32(struct x86_emulate_ctxt *ctxt, u64 smbase, int n) { struct desc_struct desc; int offset; u16 selector; selector = GET_SMSTATE(u32, smbase, 0x7fa8 + n * 4); if (n < 3) offset = 0x7f84 + n * 12; else offset = 0x7f2c + (n - 3) * 12; set_desc_base(&desc, GET_SMSTATE(u32, smbase, offset + 8)); set_desc_limit(&desc, GET_SMSTATE(u32, smbase, offset + 4)); rsm_set_desc_flags(&desc, GET_SMSTATE(u32, smbase, offset)); ctxt->ops->set_segment(ctxt, selector, &desc, 0, n); return X86EMUL_CONTINUE; } ",0 "void ClipboardMessageFilter::OnReadCustomData(ui::ClipboardType clipboard_type, const base::string16& type, base::string16* result) { GetClipboard()->ReadCustomData(clipboard_type, type, result); } ",0 "void blk_post_runtime_resume(struct request_queue *q, int err) { if (!q->dev) return; spin_lock_irq(q->queue_lock); if (!err) { q->rpm_status = RPM_ACTIVE; __blk_run_queue(q); pm_runtime_mark_last_busy(q->dev); pm_request_autosuspend(q->dev); } else { q->rpm_status = RPM_SUSPENDED; } spin_unlock_irq(q->queue_lock); } ",0 "MODRET set_allowchrootsymlinks(cmd_rec *cmd) { int b = -1; config_rec *c = NULL; CHECK_ARGS(cmd, 1); CHECK_CONF(cmd, CONF_ROOT|CONF_VIRTUAL|CONF_GLOBAL); b = get_boolean(cmd, 1); if (b == -1) { CONF_ERROR(cmd, ""expected Boolean parameter""); } c = add_config_param(cmd->argv[0], 1, NULL); c->argv[0] = pcalloc(c->pool, sizeof(int)); *((int *) c->argv[0]) = b; return PR_HANDLED(cmd); } ",0 "bool WebMediaPlayerImpl::DidLazyLoad() const { return did_lazy_load_; } ",0 "static gchar* webkit_web_view_real_choose_file(WebKitWebView*, WebKitWebFrame*, const gchar* old_name) { notImplemented(); return g_strdup(old_name); } ",0 "bool SpdyProxyClientSocket::IsUsingSpdy() const { return true; } ",0 "void nl80211_send_rx_auth(struct cfg80211_registered_device *rdev, struct net_device *netdev, const u8 *buf, size_t len, gfp_t gfp) { nl80211_send_mlme_event(rdev, netdev, buf, len, NL80211_CMD_AUTHENTICATE, gfp); } ",0 " static void Ins_ROUND( INS_ARG ) { args[0] = CUR_Func_round( args[0], CUR.metrics.compensations[CUR.opcode - 0x68] ); } ",0 "void V8TestObject::PerWorldBindingsReadonlyTestInterfaceEmptyAttributeAttributeGetterCallbackForMainWorld(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_perWorldBindingsReadonlyTestInterfaceEmptyAttribute_Getter""); test_object_v8_internal::PerWorldBindingsReadonlyTestInterfaceEmptyAttributeAttributeGetterForMainWorld(info); } ",0 "exsltDateParse (const xmlChar *dateTime) { exsltDateValPtr dt; int ret; const xmlChar *cur = dateTime; #define RETURN_TYPE_IF_VALID(t) \ if (IS_TZO_CHAR(*cur)) { \ ret = _exsltDateParseTimeZone(&(dt->value.date), &cur); \ if (ret == 0) { \ if (*cur != 0) \ goto error; \ dt->type = t; \ return dt; \ } \ } if (dateTime == NULL) return NULL; if ((*cur != '-') && (*cur < '0') && (*cur > '9')) return NULL; dt = exsltDateCreateDate(EXSLT_UNKNOWN); if (dt == NULL) return NULL; if ((cur[0] == '-') && (cur[1] == '-')) { /* * It's an incomplete date (xs:gMonthDay, xs:gMonth or * xs:gDay) */ cur += 2; /* is it an xs:gDay? */ if (*cur == '-') { ++cur; ret = _exsltDateParseGDay(&(dt->value.date), &cur); if (ret != 0) goto error; RETURN_TYPE_IF_VALID(XS_GDAY); goto error; } /* * it should be an xs:gMonthDay or xs:gMonth */ ret = _exsltDateParseGMonth(&(dt->value.date), &cur); if (ret != 0) goto error; if (*cur != '-') goto error; cur++; /* is it an xs:gMonth? */ if (*cur == '-') { cur++; RETURN_TYPE_IF_VALID(XS_GMONTH); goto error; } /* it should be an xs:gMonthDay */ ret = _exsltDateParseGDay(&(dt->value.date), &cur); if (ret != 0) goto error; RETURN_TYPE_IF_VALID(XS_GMONTHDAY); goto error; } /* * It's a right-truncated date or an xs:time. * Try to parse an xs:time then fallback on right-truncated dates. */ if ((*cur >= '0') && (*cur <= '9')) { ret = _exsltDateParseTime(&(dt->value.date), &cur); if (ret == 0) { /* it's an xs:time */ RETURN_TYPE_IF_VALID(XS_TIME); } } /* fallback on date parsing */ cur = dateTime; ret = _exsltDateParseGYear(&(dt->value.date), &cur); if (ret != 0) goto error; /* is it an xs:gYear? */ RETURN_TYPE_IF_VALID(XS_GYEAR); if (*cur != '-') goto error; cur++; ret = _exsltDateParseGMonth(&(dt->value.date), &cur); if (ret != 0) goto error; /* is it an xs:gYearMonth? */ RETURN_TYPE_IF_VALID(XS_GYEARMONTH); if (*cur != '-') goto error; cur++; ret = _exsltDateParseGDay(&(dt->value.date), &cur); if ((ret != 0) || !VALID_DATE((&(dt->value.date)))) goto error; /* is it an xs:date? */ RETURN_TYPE_IF_VALID(XS_DATE); if (*cur != 'T') goto error; cur++; /* it should be an xs:dateTime */ ret = _exsltDateParseTime(&(dt->value.date), &cur); if (ret != 0) goto error; ret = _exsltDateParseTimeZone(&(dt->value.date), &cur); if ((ret != 0) || (*cur != 0) || !VALID_DATETIME((&(dt->value.date)))) goto error; dt->type = XS_DATETIME; return dt; error: if (dt != NULL) exsltDateFreeDate(dt); return NULL; } ",0 "void V8TestObject::CachedStringOrNoneAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_cachedStringOrNoneAttribute_Getter""); test_object_v8_internal::CachedStringOrNoneAttributeAttributeGetter(info); } ",0 "GF_Err ssix_Read(GF_Box *s, GF_BitStream *bs) { u32 i,j; GF_SubsegmentIndexBox *ptr = (GF_SubsegmentIndexBox*)s; if (ptr->size < 4) return GF_BAD_PARAM; ptr->subsegment_count = gf_bs_read_u32(bs); ptr->size -= 4; ptr->subsegments = gf_malloc(ptr->subsegment_count*sizeof(GF_Subsegment)); for (i = 0; i < ptr->subsegment_count; i++) { GF_Subsegment *subseg = &ptr->subsegments[i]; if (ptr->size < 4) return GF_BAD_PARAM; subseg->range_count = gf_bs_read_u32(bs); ptr->size -= 4; if (ptr->size < subseg->range_count*4) return GF_BAD_PARAM; subseg->levels = gf_malloc(sizeof(u8)*subseg->range_count); subseg->range_sizes = gf_malloc(sizeof(u32)*subseg->range_count); for (j = 0; j < subseg->range_count; j++) { subseg->levels[j] = gf_bs_read_u8(bs); subseg->range_sizes[j] = gf_bs_read_u24(bs); ptr->size -= 4; } } return GF_OK; } ",0 "void RenderFrameDevToolsAgentHost::RenderProcessGone( base::TerminationStatus status) { switch(status) { case base::TERMINATION_STATUS_ABNORMAL_TERMINATION: case base::TERMINATION_STATUS_PROCESS_WAS_KILLED: #if defined(OS_CHROMEOS) case base::TERMINATION_STATUS_PROCESS_WAS_KILLED_BY_OOM: #endif case base::TERMINATION_STATUS_PROCESS_CRASHED: #if defined(OS_ANDROID) case base::TERMINATION_STATUS_OOM_PROTECTED: #endif case base::TERMINATION_STATUS_LAUNCH_FAILED: for (auto* inspector : protocol::InspectorHandler::ForAgentHost(this)) inspector->TargetCrashed(); break; default: for (auto* inspector : protocol::InspectorHandler::ForAgentHost(this)) inspector->TargetDetached(""Render process gone.""); break; } } ",0 "LayoutUnit NGColumnLayoutAlgorithm::CalculateBalancedColumnBlockSize( const LogicalSize& column_size, int column_count) { NGConstraintSpace space = CreateConstraintSpaceForBalancing(column_size); NGFragmentGeometry fragment_geometry = CalculateInitialFragmentGeometry(space, Node()); NGBlockLayoutAlgorithm balancing_algorithm( {Node(), fragment_geometry, space}); scoped_refptr result = balancing_algorithm.Layout(); LayoutUnit single_strip_block_size = NGFragment(space.GetWritingMode(), result->PhysicalFragment()) .BlockSize(); LayoutUnit block_size = LayoutUnit::FromFloatCeil( single_strip_block_size.ToFloat() / static_cast(column_count)); return ConstrainColumnBlockSize(block_size); } ",1 "static void kvm_get_time_scale(uint32_t scaled_khz, uint32_t base_khz, s8 *pshift, u32 *pmultiplier) { uint64_t scaled64; int32_t shift = 0; uint64_t tps64; uint32_t tps32; tps64 = base_khz * 1000LL; scaled64 = scaled_khz * 1000LL; while (tps64 > scaled64*2 || tps64 & 0xffffffff00000000ULL) { tps64 >>= 1; shift--; } tps32 = (uint32_t)tps64; while (tps32 <= scaled64 || scaled64 & 0xffffffff00000000ULL) { if (scaled64 & 0xffffffff00000000ULL || tps32 & 0x80000000) scaled64 >>= 1; else tps32 <<= 1; shift++; } *pshift = shift; *pmultiplier = div_frac(scaled64, tps32); pr_debug(""%s: base_khz %u => %u, shift %d, mul %u\n"", __func__, base_khz, scaled_khz, shift, *pmultiplier); } ",0 "void DevToolsUIBindings::AppendToFile(const std::string& url, const std::string& content) { file_helper_->Append(url, content, base::Bind(&DevToolsUIBindings::AppendedTo, weak_factory_.GetWeakPtr(), url)); } ",0 "static jlong Init(JNIEnv* env, jclass clazz, jobject obj, jobject java_web_contents) { content::WebContents* web_contents = content::WebContents::FromJavaWebContents(java_web_contents); return reinterpret_cast( new WebsiteSettingsPopupAndroid(env, obj, web_contents)); } ",0 "void FrameLoader::callContinueFragmentScrollAfterNavigationPolicy(void* argument, const ResourceRequest& request, PassRefPtr, bool shouldContinue) { FrameLoader* loader = static_cast(argument); loader->continueFragmentScrollAfterNavigationPolicy(request, shouldContinue); } ",0 "_zip_headercomp(const zip_dirent_t *central, const zip_dirent_t *local) { if ((central->version_needed < local->version_needed) #if 0 /* some zip-files have different values in local and global headers for the bitflags */ || (central->bitflags != local->bitflags) #endif || (central->comp_method != local->comp_method) || (central->last_mod != local->last_mod) || !_zip_string_equal(central->filename, local->filename)) return -1; if ((central->crc != local->crc) || (central->comp_size != local->comp_size) || (central->uncomp_size != local->uncomp_size)) { /* InfoZip stores valid values in local header even when data descriptor is used. This is in violation of the appnote. */ if (((local->bitflags & ZIP_GPBF_DATA_DESCRIPTOR) == 0 || local->crc != 0 || local->comp_size != 0 || local->uncomp_size != 0)) return -1; } return 0; } ",0 "void SSL_CTX_set_next_proto_select_cb(SSL_CTX *ctx, int (*cb) (SSL *s, unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg), void *arg) { ctx->next_proto_select_cb = cb; ctx->next_proto_select_cb_arg = arg; } ",0 "void FrameSelection::SetSelectionFromNone() { Document* document = frame_->GetDocument(); if (!ComputeVisibleSelectionInDOMTreeDeprecated().IsNone() || !(blink::HasEditableStyle(*document))) return; Element* document_element = document->documentElement(); if (!document_element) return; if (HTMLBodyElement* body = Traversal::FirstChild(*document_element)) { SetSelectionAndEndTyping(SelectionInDOMTree::Builder() .Collapse(FirstPositionInOrBeforeNode(*body)) .Build()); } } ",0 "unsigned long netdev_boot_base(const char *prefix, int unit) { const struct netdev_boot_setup *s = dev_boot_setup; char name[IFNAMSIZ]; int i; sprintf(name, ""%s%d"", prefix, unit); /* * If device already registered then return base of 1 * to indicate not to probe for this interface */ if (__dev_get_by_name(&init_net, name)) return 1; for (i = 0; i < NETDEV_BOOT_SETUP_MAX; i++) if (!strcmp(name, s[i].name)) return s[i].map.base_addr; return 0; } ",0 "void ClientControlledShellSurface::SetSnappedToRight() { TRACE_EVENT0(""exo"", ""ClientControlledShellSurface::SetSnappedToRight""); pending_window_state_ = ash::WindowStateType::kRightSnapped; } ",0 "void move_hugetlb_state(struct page *oldpage, struct page *newpage, int reason) { struct hstate *h = page_hstate(oldpage); hugetlb_cgroup_migrate(oldpage, newpage); set_page_owner_migrate_reason(newpage, reason); /* * transfer temporary state of the new huge page. This is * reverse to other transitions because the newpage is going to * be final while the old one will be freed so it takes over * the temporary status. * * Also note that we have to transfer the per-node surplus state * here as well otherwise the global surplus count will not match * the per-node's. */ if (PageHugeTemporary(newpage)) { int old_nid = page_to_nid(oldpage); int new_nid = page_to_nid(newpage); SetPageHugeTemporary(oldpage); ClearPageHugeTemporary(newpage); spin_lock(&hugetlb_lock); if (h->surplus_huge_pages_node[old_nid]) { h->surplus_huge_pages_node[old_nid]--; h->surplus_huge_pages_node[new_nid]++; } spin_unlock(&hugetlb_lock); } } ",0 "static inline int ioc_batching(struct request_queue *q, struct io_context *ioc) { if (!ioc) return 0; /* * Make sure the process is able to allocate at least 1 request * even if the batch times out, otherwise we could theoretically * lose wakeups. */ return ioc->nr_batch_requests == q->nr_batching || (ioc->nr_batch_requests > 0 && time_before(jiffies, ioc->last_waited + BLK_BATCH_TIME)); } ",0 "void RenderFrameImpl::didFinishResourceLoad(blink::WebLocalFrame* frame, unsigned identifier) { DCHECK(!frame_ || frame_ == frame); InternalDocumentStateData* internal_data = InternalDocumentStateData::FromDataSource(frame->dataSource()); if (!internal_data->use_error_page()) return; if (render_view_->devtools_agent_->IsAttached()) return; std::string error_domain = ""http""; int http_status_code = internal_data->http_status_code(); if (GetContentClient()->renderer()->HasErrorPage( http_status_code, &error_domain)) { WebURLError error; error.unreachableURL = frame->document().url(); error.domain = WebString::fromUTF8(error_domain); error.reason = http_status_code; LoadNavigationErrorPage(frame->dataSource()->request(), error, true); } } ",0 " SessionService* service() { return helper_.service(); } ",0 "void sc_file_free(sc_file_t *file) { unsigned int i; if (file == NULL || !sc_file_valid(file)) return; file->magic = 0; for (i = 0; i < SC_MAX_AC_OPS; i++) sc_file_clear_acl_entries(file, i); if (file->sec_attr) free(file->sec_attr); if (file->prop_attr) free(file->prop_attr); if (file->type_attr) free(file->type_attr); if (file->encoded_content) free(file->encoded_content); free(file); } ",0 "static void CheckCcScrollNode(const ScrollPaintPropertyNode& blink_scroll, const cc::ScrollNode& cc_scroll) { EXPECT_EQ(static_cast(blink_scroll.ContainerRect().Size()), cc_scroll.container_bounds); EXPECT_EQ(static_cast(blink_scroll.ContentsRect().Size()), cc_scroll.bounds); EXPECT_EQ(blink_scroll.UserScrollableHorizontal(), cc_scroll.user_scrollable_horizontal); EXPECT_EQ(blink_scroll.UserScrollableVertical(), cc_scroll.user_scrollable_vertical); EXPECT_EQ(blink_scroll.GetCompositorElementId(), cc_scroll.element_id); EXPECT_EQ(blink_scroll.GetMainThreadScrollingReasons(), cc_scroll.main_thread_scrolling_reasons); } ",0 "xfs_attr_calc_size( struct xfs_inode *ip, int namelen, int valuelen, int *local) { struct xfs_mount *mp = ip->i_mount; int size; int nblks; /* * Determine space new attribute will use, and if it would be * ""local"" or ""remote"" (note: local != inline). */ size = xfs_attr_leaf_newentsize(namelen, valuelen, mp->m_sb.sb_blocksize, local); nblks = XFS_DAENTER_SPACE_RES(mp, XFS_ATTR_FORK); if (*local) { if (size > (mp->m_sb.sb_blocksize >> 1)) { /* Double split possible */ nblks *= 2; } } else { /* * Out of line attribute, cannot double split, but * make room for the attribute value itself. */ uint dblocks = XFS_B_TO_FSB(mp, valuelen); nblks += dblocks; nblks += XFS_NEXTENTADD_SPACE_RES(mp, dblocks, XFS_ATTR_FORK); } return nblks; } ",1 "MagickExport void SetQuantumScale(QuantumInfo *quantum_info,const double scale) { assert(quantum_info != (QuantumInfo *) NULL); assert(quantum_info->signature == MagickSignature); quantum_info->scale=scale; } ",0 "static int decode_zbuf(AVBPrint *bp, const uint8_t *data, const uint8_t *data_end) { z_stream zstream; unsigned char *buf; unsigned buf_size; int ret; zstream.zalloc = ff_png_zalloc; zstream.zfree = ff_png_zfree; zstream.opaque = NULL; if (inflateInit(&zstream) != Z_OK) return AVERROR_EXTERNAL; zstream.next_in = (unsigned char *)data; zstream.avail_in = data_end - data; av_bprint_init(bp, 0, -1); while (zstream.avail_in > 0) { av_bprint_get_buffer(bp, 2, &buf, &buf_size); if (buf_size < 2) { ret = AVERROR(ENOMEM); goto fail; } zstream.next_out = buf; zstream.avail_out = buf_size - 1; ret = inflate(&zstream, Z_PARTIAL_FLUSH); if (ret != Z_OK && ret != Z_STREAM_END) { ret = AVERROR_EXTERNAL; goto fail; } bp->len += zstream.next_out - buf; if (ret == Z_STREAM_END) break; } inflateEnd(&zstream); bp->str[bp->len] = 0; return 0; fail: inflateEnd(&zstream); av_bprint_finalize(bp, NULL); return ret; } ",0 "void ArcVoiceInteractionFrameworkService::SetVoiceInteractionSetupCompleted() { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); SetVoiceInteractionSetupCompletedInternal(true); SetVoiceInteractionEnabled(true, base::BindOnce(&DoNothing)); SetVoiceInteractionContextEnabled(true); } ",0 "void WebProcessProxy::addBackForwardItem(uint64_t itemID, const String& originalURL, const String& url, const String& title, const CoreIPC::DataReference& backForwardData) { MESSAGE_CHECK_URL(originalURL); MESSAGE_CHECK_URL(url); WebBackForwardListItemMap::AddResult result = m_backForwardListItemMap.add(itemID, 0); if (result.isNewEntry) { result.iterator->value = WebBackForwardListItem::create(originalURL, url, title, backForwardData.data(), backForwardData.size(), itemID); return; } result.iterator->value->setOriginalURL(originalURL); result.iterator->value->setURL(url); result.iterator->value->setTitle(title); result.iterator->value->setBackForwardData(backForwardData.data(), backForwardData.size()); } ",0 "ProcXFixesCreateRegionFromWindow(ClientPtr client) { RegionPtr pRegion; Bool copy = TRUE; WindowPtr pWin; int rc; REQUEST(xXFixesCreateRegionFromWindowReq); REQUEST_SIZE_MATCH(xXFixesCreateRegionFromWindowReq); LEGAL_NEW_RESOURCE(stuff->region, client); rc = dixLookupResourceByType((void **) &pWin, stuff->window, RT_WINDOW, client, DixGetAttrAccess); if (rc != Success) { client->errorValue = stuff->window; return rc; } switch (stuff->kind) { case WindowRegionBounding: pRegion = wBoundingShape(pWin); if (!pRegion) { pRegion = CreateBoundingShape(pWin); copy = FALSE; } break; case WindowRegionClip: pRegion = wClipShape(pWin); if (!pRegion) { pRegion = CreateClipShape(pWin); copy = FALSE; } break; default: client->errorValue = stuff->kind; return BadValue; } if (copy && pRegion) pRegion = XFixesRegionCopy(pRegion); if (!pRegion) return BadAlloc; if (!AddResource(stuff->region, RegionResType, (void *) pRegion)) return BadAlloc; return Success; } ",0 "static int _nfs4_recover_proc_open(struct nfs4_opendata *data) { struct inode *dir = data->dir->d_inode; struct nfs_openres *o_res = &data->o_res; int status; status = nfs4_run_open_task(data, 1); if (status != 0 || !data->rpc_done) return status; nfs_fattr_map_and_free_names(NFS_SERVER(dir), &data->f_attr); nfs_refresh_inode(dir, o_res->dir_attr); if (o_res->rflags & NFS4_OPEN_RESULT_CONFIRM) { status = _nfs4_proc_open_confirm(data); if (status != 0) return status; } return status; } ",0 "static int annot_store_cb(annotate_state_t *astate, void *rock) { struct annot_store_rock *arock = rock; return annotate_state_store(astate, arock->entryatts); } ",0 "static int do_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig, siginfo_t *info) { /* This is only valid for single tasks */ if (pid <= 0 || tgid <= 0) return -EINVAL; /* Not even root can pretend to send signals from the kernel. * Nor can they impersonate a kill()/tgkill(), which adds source info. */ if (((info->si_code >= 0 || info->si_code == SI_TKILL)) && (task_pid_vnr(current) != pid)) { /* We used to allow any < 0 si_code */ WARN_ON_ONCE(info->si_code < 0); return -EPERM; } info->si_signo = sig; return do_send_specific(tgid, pid, sig, info); } ",0 "void jslInit(JsVar *var) { lex->sourceVar = jsvLockAgain(var); lex->tk = 0; lex->tokenStart.it.var = 0; lex->tokenStart.currCh = 0; lex->tokenLastStart = 0; lex->tokenl = 0; lex->tokenValue = 0; lex->lineNumberOffset = 0; jsvStringIteratorNew(&lex->it, lex->sourceVar, 0); jsvUnLock(lex->it.var); // see jslGetNextCh jslPreload(); } ",0 "static int check_oflag_copied(BlockDriverState *bs, BdrvCheckResult *res, BdrvCheckMode fix) { BDRVQcowState *s = bs->opaque; uint64_t *l2_table = qemu_blockalign(bs, s->cluster_size); int ret; int refcount; int i, j; for (i = 0; i < s->l1_size; i++) { uint64_t l1_entry = s->l1_table[i]; uint64_t l2_offset = l1_entry & L1E_OFFSET_MASK; bool l2_dirty = false; if (!l2_offset) { continue; } refcount = get_refcount(bs, l2_offset >> s->cluster_bits); if (refcount < 0) { /* don't print message nor increment check_errors */ continue; } if ((refcount == 1) != ((l1_entry & QCOW_OFLAG_COPIED) != 0)) { fprintf(stderr, ""%s OFLAG_COPIED L2 cluster: l1_index=%d "" ""l1_entry=%"" PRIx64 "" refcount=%d\n"", fix & BDRV_FIX_ERRORS ? ""Repairing"" : ""ERROR"", i, l1_entry, refcount); if (fix & BDRV_FIX_ERRORS) { s->l1_table[i] = refcount == 1 ? l1_entry | QCOW_OFLAG_COPIED : l1_entry & ~QCOW_OFLAG_COPIED; ret = qcow2_write_l1_entry(bs, i); if (ret < 0) { res->check_errors++; goto fail; } res->corruptions_fixed++; } else { res->corruptions++; } } ret = bdrv_pread(bs->file, l2_offset, l2_table, s->l2_size * sizeof(uint64_t)); if (ret < 0) { fprintf(stderr, ""ERROR: Could not read L2 table: %s\n"", strerror(-ret)); res->check_errors++; goto fail; } for (j = 0; j < s->l2_size; j++) { uint64_t l2_entry = be64_to_cpu(l2_table[j]); uint64_t data_offset = l2_entry & L2E_OFFSET_MASK; int cluster_type = qcow2_get_cluster_type(l2_entry); if ((cluster_type == QCOW2_CLUSTER_NORMAL) || ((cluster_type == QCOW2_CLUSTER_ZERO) && (data_offset != 0))) { refcount = get_refcount(bs, data_offset >> s->cluster_bits); if (refcount < 0) { /* don't print message nor increment check_errors */ continue; } if ((refcount == 1) != ((l2_entry & QCOW_OFLAG_COPIED) != 0)) { fprintf(stderr, ""%s OFLAG_COPIED data cluster: "" ""l2_entry=%"" PRIx64 "" refcount=%d\n"", fix & BDRV_FIX_ERRORS ? ""Repairing"" : ""ERROR"", l2_entry, refcount); if (fix & BDRV_FIX_ERRORS) { l2_table[j] = cpu_to_be64(refcount == 1 ? l2_entry | QCOW_OFLAG_COPIED : l2_entry & ~QCOW_OFLAG_COPIED); l2_dirty = true; res->corruptions_fixed++; } else { res->corruptions++; } } } } if (l2_dirty) { ret = qcow2_pre_write_overlap_check(bs, QCOW2_OL_ACTIVE_L2, l2_offset, s->cluster_size); if (ret < 0) { fprintf(stderr, ""ERROR: Could not write L2 table; metadata "" ""overlap check failed: %s\n"", strerror(-ret)); res->check_errors++; goto fail; } ret = bdrv_pwrite(bs->file, l2_offset, l2_table, s->cluster_size); if (ret < 0) { fprintf(stderr, ""ERROR: Could not write L2 table: %s\n"", strerror(-ret)); res->check_errors++; goto fail; } } } ret = 0; fail: qemu_vfree(l2_table); return ret; } ",0 "static void update_rq_clock_task(struct rq *rq, s64 delta) { s64 irq_delta; irq_delta = irq_time_read(cpu_of(rq)) - rq->prev_irq_time; /* * Since irq_time is only updated on {soft,}irq_exit, we might run into * this case when a previous update_rq_clock() happened inside a * {soft,}irq region. * * When this happens, we stop ->clock_task and only update the * prev_irq_time stamp to account for the part that fit, so that a next * update will consume the rest. This ensures ->clock_task is * monotonic. * * It does however cause some slight miss-attribution of {soft,}irq * time, a more accurate solution would be to update the irq_time using * the current rq->clock timestamp, except that would require using * atomic ops. */ if (irq_delta > delta) irq_delta = delta; rq->prev_irq_time += irq_delta; delta -= irq_delta; rq->clock_task += delta; if (irq_delta && sched_feat(NONIRQ_POWER)) sched_rt_avg_update(rq, irq_delta); } ",0 "void GLES2Implementation::EndQueryEXT(GLenum target) { QueryTracker::Query* query = nullptr; { GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG(""["" << GetLogPrefix() << ""] EndQueryEXT("" << GLES2Util::GetStringQueryTarget(target) << "")""); query = query_tracker_->GetCurrentQuery(target); if (!query_tracker_->EndQuery(target, this)) { return; } CheckGLError(); } // GPU_CLIENT_SINGLE_THREAD_CHECK ends here if (target == GL_READBACK_SHADOW_COPIES_UPDATED_CHROMIUM) { DCHECK(capabilities_.chromium_nonblocking_readback); DCHECK(query); auto serial = readback_buffer_shadow_tracker_->buffer_shadow_serial(); readback_buffer_shadow_tracker_->IncrementSerial(); auto buffers = readback_buffer_shadow_tracker_->TakeUnfencedBufferList(); query->SetCompletedCallback( base::BindOnce(&GLES2Implementation::BufferShadowWrittenCallback, std::move(buffers), serial)); } } ",0 "void GLES2DecoderImpl::ProduceFrontBuffer(const Mailbox& mailbox) { if (!offscreen_saved_color_texture_.get()) { LOG(ERROR) << ""Called ProduceFrontBuffer on a non-offscreen context""; return; } if (!offscreen_saved_color_texture_info_.get()) { GLuint service_id = offscreen_saved_color_texture_->id(); offscreen_saved_color_texture_info_ = TextureRef::Create( texture_manager(), 0, service_id); texture_manager()->SetTarget(offscreen_saved_color_texture_info_.get(), GL_TEXTURE_2D); UpdateParentTextureInfo(); } mailbox_manager()->ProduceTexture( mailbox, offscreen_saved_color_texture_info_->texture()); } ",0 "int BN_GF2m_arr2poly(const int p[], BIGNUM *a) { int i; bn_check_top(a); BN_zero(a); for (i = 0; p[i] != -1; i++) { if (BN_set_bit(a, p[i]) == 0) return 0; } bn_check_top(a); return 1; } ",0 "void GLES2Implementation::GetResultNameHelper(GLsizei bufsize, GLsizei* length, char* name) { GLsizei max_length = 0; if (name && (bufsize > 0)) { std::vector str; GetBucketContents(kResultBucketId, &str); if (!str.empty()) { DCHECK_LE(str.size(), static_cast(INT_MAX)); max_length = std::min(bufsize, static_cast(str.size())) - 1; } memcpy(name, str.data(), max_length); name[max_length] = '\0'; } if (length) { *length = max_length; } } ",0 "ResourceLoadPriority TypeToPriority(Resource::Type type) { switch (type) { case Resource::kMainResource: case Resource::kCSSStyleSheet: case Resource::kFont: return kResourceLoadPriorityVeryHigh; case Resource::kXSLStyleSheet: DCHECK(RuntimeEnabledFeatures::XSLTEnabled()); case Resource::kRaw: case Resource::kImportResource: case Resource::kScript: return kResourceLoadPriorityHigh; case Resource::kManifest: case Resource::kMock: return kResourceLoadPriorityMedium; case Resource::kImage: case Resource::kTextTrack: case Resource::kMedia: case Resource::kSVGDocument: return kResourceLoadPriorityLow; case Resource::kLinkPrefetch: return kResourceLoadPriorityVeryLow; } NOTREACHED(); return kResourceLoadPriorityUnresolved; } ",0 "status_t MediaPlayerService::Client::start() { ALOGV(""[%d] start"", mConnId); sp p = getPlayer(); if (p == 0) return UNKNOWN_ERROR; p->setLooping(mLoop); return p->start(); } ",0 "static int __init init_f2fs_fs(void) { int err; f2fs_build_trace_ios(); err = init_inodecache(); if (err) goto fail; err = create_node_manager_caches(); if (err) goto free_inodecache; err = create_segment_manager_caches(); if (err) goto free_node_manager_caches; err = create_checkpoint_caches(); if (err) goto free_segment_manager_caches; err = create_extent_cache(); if (err) goto free_checkpoint_caches; err = f2fs_init_sysfs(); if (err) goto free_extent_cache; err = register_shrinker(&f2fs_shrinker_info); if (err) goto free_sysfs; err = register_filesystem(&f2fs_fs_type); if (err) goto free_shrinker; err = f2fs_create_root_stats(); if (err) goto free_filesystem; return 0; free_filesystem: unregister_filesystem(&f2fs_fs_type); free_shrinker: unregister_shrinker(&f2fs_shrinker_info); free_sysfs: f2fs_exit_sysfs(); free_extent_cache: destroy_extent_cache(); free_checkpoint_caches: destroy_checkpoint_caches(); free_segment_manager_caches: destroy_segment_manager_caches(); free_node_manager_caches: destroy_node_manager_caches(); free_inodecache: destroy_inodecache(); fail: return err; } ",0 "struct dentry *tracing_init_dentry(void) { struct trace_array *tr = &global_trace; /* The top level trace array uses NULL as parent */ if (tr->dir) return NULL; if (WARN_ON(!tracefs_initialized()) || (IS_ENABLED(CONFIG_DEBUG_FS) && WARN_ON(!debugfs_initialized()))) return ERR_PTR(-ENODEV); /* * As there may still be users that expect the tracing * files to exist in debugfs/tracing, we must automount * the tracefs file system there, so older tools still * work with the newer kerenl. */ tr->dir = debugfs_create_automount(""tracing"", NULL, trace_automount, NULL); if (!tr->dir) { pr_warn_once(""Could not create debugfs directory 'tracing'\n""); return ERR_PTR(-ENOMEM); } return NULL; } ",0 "bool DownloadManagerImpl::ShouldOpenFileBasedOnExtension( const base::FilePath& path) { if (!delegate_) return false; return delegate_->ShouldOpenFileBasedOnExtension(path); } ",0 "static unsigned long added_obj_hash(const ADDED_OBJ *ca) { const ASN1_OBJECT *a; int i; unsigned long ret=0; unsigned char *p; a=ca->obj; switch (ca->type) { case ADDED_DATA: ret=a->length<<20L; p=(unsigned char *)a->data; for (i=0; ilength; i++) ret^=p[i]<<((i*3)%24); break; case ADDED_SNAME: ret=lh_strhash(a->sn); break; case ADDED_LNAME: ret=lh_strhash(a->ln); break; case ADDED_NID: ret=a->nid; break; default: /* abort(); */ return 0; } ret&=0x3fffffffL; ret|=((unsigned long)ca->type)<<30L; return(ret); } ",0 "bool WebContentsImpl::HideDownloadUI() const { return is_overlay_content_; } ",0 "static int fuse_copy_page(struct fuse_copy_state *cs, struct page **pagep, unsigned offset, unsigned count, int zeroing) { int err; struct page *page = *pagep; if (page && zeroing && count < PAGE_SIZE) clear_highpage(page); while (count) { if (cs->write && cs->pipebufs && page) { return fuse_ref_page(cs, page, offset, count); } else if (!cs->len) { if (cs->move_pages && page && offset == 0 && count == PAGE_SIZE) { err = fuse_try_move_page(cs, pagep); if (err <= 0) return err; } else { err = fuse_copy_fill(cs); if (err) return err; } } if (page) { void *mapaddr = kmap_atomic(page); void *buf = mapaddr + offset; offset += fuse_copy_do(cs, &buf, &count); kunmap_atomic(mapaddr); } else offset += fuse_copy_do(cs, NULL, &count); } if (page && !cs->write) flush_dcache_page(page); return 0; } ",0 "const config_section_node_t *config_section_end(const config_t *config) { assert(config != NULL); return (const config_section_node_t *)list_end(config->sections); } ",0 "int venc_dev::append_mbi_extradata(void *dst, struct msm_vidc_extradata_header* src) { OMX_QCOM_EXTRADATA_MBINFO *mbi = (OMX_QCOM_EXTRADATA_MBINFO *)dst; if (!dst || !src) return 0; /* TODO: Once Venus 3XX target names are known, nFormat should 2 for those * targets, since the payload format will be different */ mbi->nFormat = 1; mbi->nDataSize = src->data_size; memcpy(&mbi->data, &src->data, src->data_size); return mbi->nDataSize + sizeof(*mbi); } ",0 "static void l2cap_recv_frame(struct l2cap_conn *conn, struct sk_buff *skb) { struct l2cap_hdr *lh = (void *) skb->data; u16 cid, len; __le16 psm; skb_pull(skb, L2CAP_HDR_SIZE); cid = __le16_to_cpu(lh->cid); len = __le16_to_cpu(lh->len); BT_DBG(""len %d, cid 0x%4.4x"", len, cid); switch (cid) { case L2CAP_CID_SIGNALING: l2cap_sig_channel(conn, skb); break; case L2CAP_CID_CONN_LESS: psm = get_unaligned((__le16 *) skb->data); skb_pull(skb, 2); l2cap_conless_channel(conn, psm, skb); break; default: l2cap_data_channel(conn, cid, skb); break; } } ",0 "AutocompleteMatch::Type OmniboxEditModel::CurrentTextType() const { return CurrentMatch(NULL).type; } ",0 "static int follow_pfn_pte(struct vm_area_struct *vma, unsigned long address, pte_t *pte, unsigned int flags) { /* No page to get reference */ if (flags & FOLL_GET) return -EFAULT; if (flags & FOLL_TOUCH) { pte_t entry = *pte; if (flags & FOLL_WRITE) entry = pte_mkdirty(entry); entry = pte_mkyoung(entry); if (!pte_same(*pte, entry)) { set_pte_at(vma->vm_mm, address, pte, entry); update_mmu_cache(vma, address, pte); } } /* Proper page table entry exists, but no corresponding struct page */ return -EEXIST; } ",0 "static void restore_sigs(sigset_t *oldset) { sigprocmask(SIG_SETMASK, oldset, NULL); } ",0 "WebView* RenderViewImpl::createView( WebFrame* creator, const WebURLRequest& request, const WebWindowFeatures& features, const WebString& frame_name, WebNavigationPolicy policy) { if (shared_popup_counter_->data > kMaximumNumberOfUnacknowledgedPopups) return NULL; ViewHostMsg_CreateWindow_Params params; params.opener_id = routing_id_; params.user_gesture = creator->isProcessingUserGesture(); params.window_container_type = WindowFeaturesToContainerType(features); params.session_storage_namespace_id = session_storage_namespace_id_; if (frame_name != ""_blank"") params.frame_name = frame_name; params.opener_frame_id = creator->identifier(); params.opener_url = creator->document().url(); GURL security_url(creator->document().securityOrigin().toString().utf8()); if (!security_url.is_valid()) security_url = GURL(); params.opener_security_origin = security_url; params.opener_suppressed = creator->willSuppressOpenerInNewFrame(); params.disposition = NavigationPolicyToDisposition(policy); if (!request.isNull()) params.target_url = request.url(); int32 routing_id = MSG_ROUTING_NONE; int32 surface_id = 0; int64 cloned_session_storage_namespace_id; RenderThread::Get()->Send( new ViewHostMsg_CreateWindow(params, &routing_id, &surface_id, &cloned_session_storage_namespace_id)); if (routing_id == MSG_ROUTING_NONE) return NULL; creator->consumeUserGesture(); RenderViewImpl* view = RenderViewImpl::Create( routing_id_, renderer_preferences_, webkit_preferences_, shared_popup_counter_, routing_id, surface_id, cloned_session_storage_namespace_id, string16(), // WebCore will take care of setting the correct name. true, false, 1, screen_info_, accessibility_mode_); view->opened_by_user_gesture_ = params.user_gesture; view->opener_suppressed_ = params.opener_suppressed; view->alternate_error_page_url_ = alternate_error_page_url_; return view->webview(); } ",0 "void LocalFrameClientImpl::DispatchDidReceiveResponse( const ResourceResponse& response) { if (web_frame_->Client()) { WrappedResourceResponse webresp(response); web_frame_->Client()->DidReceiveResponse(webresp); } } ",0 "int proc_nr_files(ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos) { return -ENOSYS; } ",0 "static void keyring_revoke(struct key *keyring) { struct assoc_array_edit *edit; edit = assoc_array_clear(&keyring->keys, &keyring_assoc_array_ops); if (!IS_ERR(edit)) { if (edit) assoc_array_apply_edit(edit); key_payload_reserve(keyring, 0); } } ",0 "int ptrace_getregs(struct task_struct *child, void __user *uregs) { struct pt_regs *regs = task_pt_regs(child); xtensa_gregset_t __user *gregset = uregs; unsigned long wm = regs->wmask; unsigned long wb = regs->windowbase; int live, i; if (!access_ok(VERIFY_WRITE, uregs, sizeof(xtensa_gregset_t))) return -EIO; __put_user(regs->pc, &gregset->pc); __put_user(regs->ps & ~(1 << PS_EXCM_BIT), &gregset->ps); __put_user(regs->lbeg, &gregset->lbeg); __put_user(regs->lend, &gregset->lend); __put_user(regs->lcount, &gregset->lcount); __put_user(regs->windowstart, &gregset->windowstart); __put_user(regs->windowbase, &gregset->windowbase); live = (wm & 2) ? 4 : (wm & 4) ? 8 : (wm & 8) ? 12 : 16; for (i = 0; i < live; i++) __put_user(regs->areg[i],gregset->a+((wb*4+i)%XCHAL_NUM_AREGS)); for (i = XCHAL_NUM_AREGS - (wm >> 4) * 4; i < XCHAL_NUM_AREGS; i++) __put_user(regs->areg[i],gregset->a+((wb*4+i)%XCHAL_NUM_AREGS)); return 0; } ",0 "Node* Document::adoptNode(Node* source, ExceptionState& exception_state) { EventQueueScope scope; switch (source->getNodeType()) { case kDocumentNode: exception_state.ThrowDOMException(DOMExceptionCode::kNotSupportedError, ""The node provided is of type '"" + source->nodeName() + ""', which may not be adopted.""); return nullptr; case kAttributeNode: { Attr* attr = ToAttr(source); if (Element* owner_element = attr->ownerElement()) owner_element->removeAttributeNode(attr, exception_state); break; } default: if (source->IsShadowRoot()) { exception_state.ThrowDOMException( DOMExceptionCode::kHierarchyRequestError, ""The node provided is a shadow root, which may not be adopted.""); return nullptr; } if (source->IsFrameOwnerElement()) { HTMLFrameOwnerElement* frame_owner_element = ToHTMLFrameOwnerElement(source); if (GetFrame() && GetFrame()->Tree().IsDescendantOf( frame_owner_element->ContentFrame())) { exception_state.ThrowDOMException( DOMExceptionCode::kHierarchyRequestError, ""The node provided is a frame which contains this document.""); return nullptr; } } if (source->parentNode()) { source->parentNode()->RemoveChild(source, exception_state); if (exception_state.HadException()) return nullptr; if (source->parentNode()) { AddConsoleMessage(ConsoleMessage::Create( kJSMessageSource, kWarningMessageLevel, ExceptionMessages::FailedToExecute(""adoptNode"", ""Document"", ""Unable to remove the "" ""specified node from the "" ""original parent.""))); return nullptr; } } } AdoptIfNeeded(*source); return source; } ",0 "void ContainerNode::attach(const AttachContext& context) { attachChildren(context); clearChildNeedsStyleRecalc(); Node::attach(context); } ",0 "static int codeCursorHintFixExpr(Walker *pWalker, Expr *pExpr){ int rc = WRC_Continue; struct CCurHint *pHint = pWalker->u.pCCurHint; if( pExpr->op==TK_COLUMN ){ if( pExpr->iTable!=pHint->iTabCur ){ int reg = ++pWalker->pParse->nMem; /* Register for column value */ sqlite3ExprCode(pWalker->pParse, pExpr, reg); pExpr->op = TK_REGISTER; pExpr->iTable = reg; }else if( pHint->pIdx!=0 ){ pExpr->iTable = pHint->iIdxCur; pExpr->iColumn = sqlite3ColumnOfIndex(pHint->pIdx, pExpr->iColumn); assert( pExpr->iColumn>=0 ); } }else if( pExpr->op==TK_AGG_FUNCTION ){ /* An aggregate function in the WHERE clause of a query means this must ** be a correlated sub-query, and expression pExpr is an aggregate from ** the parent context. Do not walk the function arguments in this case. ** ** todo: It should be possible to replace this node with a TK_REGISTER ** expression, as the result of the expression must be stored in a ** register at this point. The same holds for TK_AGG_COLUMN nodes. */ rc = WRC_Prune; } return rc; } ",0 "void smp_proc_enc_info(tSMP_CB* p_cb, tSMP_INT_DATA* p_data) { uint8_t* p = p_data->p_data; SMP_TRACE_DEBUG(""%s"", __func__); STREAM_TO_ARRAY(p_cb->ltk, p, BT_OCTET16_LEN); smp_key_distribution(p_cb, NULL); } ",1 "bool xmp_iterator_skip(XmpIteratorPtr iter, XmpIterSkipOptions options) { CHECK_PTR(iter, false); RESET_ERROR; auto titer = reinterpret_cast(iter); titer->Skip(options); return true; } ",0 "void kvm_vcpu_uninit(struct kvm_vcpu *vcpu) { /* * no need for rcu_read_lock as VCPU_RUN is the only place that * will change the vcpu->pid pointer and on uninit all file * descriptors are already gone. */ put_pid(rcu_dereference_protected(vcpu->pid, 1)); kvm_arch_vcpu_uninit(vcpu); free_page((unsigned long)vcpu->run); } ",0 "static int __videobuf_copy_stream ( struct videobuf_queue *q, char __user *data, size_t count, size_t pos, int vbihack, int nonblocking ) { unsigned int *fc; struct videbuf_vmalloc_memory *mem=q->read_buf->priv; BUG_ON (!mem); MAGIC_CHECK(mem->magic,MAGIC_VMAL_MEM); if (vbihack) { /* dirty, undocumented hack -- pass the frame counter * within the last four bytes of each vbi data block. * We need that one to maintain backward compatibility * to all vbi decoding software out there ... */ fc = (unsigned int*)mem->vmalloc; fc += (q->read_buf->size>>2) -1; *fc = q->read_buf->field_count >> 1; dprintk(1,""vbihack: %d\n"",*fc); } /* copy stuff using the common method */ count = __videobuf_copy_to_user (q,data,count,nonblocking); if ( (count==-EFAULT) && (0 == pos) ) return -EFAULT; return count; } ",0 "pdf14_cmap_devicen_direct(const frac * pcc, gx_device_color * pdc, const gs_gstate * pgs, gx_device * dev, gs_color_select_t select) { int i, ncomps = dev->color_info.num_components; int num_spots = pdf14_get_num_spots(dev); frac cm_comps[GX_DEVICE_COLOR_MAX_COMPONENTS]; gx_color_value cv[GX_DEVICE_COLOR_MAX_COMPONENTS]; gx_color_index color; gx_device *trans_device; /* We may be coming from the clist writer which often forwards us the target device. If this occurs we actually need to get to the color space defined by the transparency group and we use the operators defined by the transparency device to do the job. */ if (pgs->trans_device != NULL){ trans_device = pgs->trans_device; } else { trans_device = dev; } ncomps = trans_device->color_info.num_components; /* map to the color model */ map_components_to_colorants(pcc, &(pgs->color_component_map), cm_comps);; /* apply the transfer function(s); convert to color values */ if (trans_device->color_info.polarity == GX_CINFO_POLARITY_ADDITIVE) { for (i = 0; i < ncomps; i++) cv[i] = frac2cv(gx_map_color_frac(pgs, cm_comps[i], effective_transfer[i])); /* We are in an additive mode (blend space) and drawing with a sep color into a sep device. Make sure we are drawing ""white"" with the process colorants */ for (i = 0; i < ncomps - num_spots; i++) cv[i] = gx_max_color_value; } else for (i = 0; i < ncomps; i++) cv[i] = frac2cv(frac_1 - gx_map_color_frac(pgs, (frac)(frac_1 - cm_comps[i]), effective_transfer[i])); /* if output device supports devn, we need to make sure we send it the proper color type */ if (dev_proc(trans_device, dev_spec_op)(trans_device, gxdso_supports_devn, NULL, 0)) { for (i = 0; i < ncomps; i++) pdc->colors.devn.values[i] = cv[i]; pdc->type = gx_dc_type_devn; } else { /* encode as a color index */ color = dev_proc(trans_device, encode_color)(trans_device, cv); /* check if the encoding was successful; we presume failure is rare */ if (color != gx_no_color_index) color_set_pure(pdc, color); } } ",0 "void ResourceMessageFilter::OnDidZoomURL(const GURL& url, int zoom_level) { ChromeThread::PostTask(ChromeThread::UI, FROM_HERE, NewRunnableMethod(this, &ResourceMessageFilter::UpdateHostZoomLevelsOnUIThread, url, zoom_level)); } ",0 "flatpak_proxy_client_update_unique_id_policy (FlatpakProxyClient *client, const char *unique_id, FlatpakPolicy policy) { if (policy > FLATPAK_POLICY_NONE) { FlatpakPolicy old_policy; old_policy = GPOINTER_TO_UINT (g_hash_table_lookup (client->unique_id_policy, unique_id)); if (policy > old_policy) g_hash_table_replace (client->unique_id_policy, g_strdup (unique_id), GINT_TO_POINTER (policy)); } } ",0 "change_mtu (struct net_device *dev, int new_mtu) { struct netdev_private *np = netdev_priv(dev); int max = (np->jumbo) ? MAX_JUMBO : 1536; if ((new_mtu < 68) || (new_mtu > max)) { return -EINVAL; } dev->mtu = new_mtu; return 0; } ",0 "static bool virtio_device_endian_needed(void *opaque) { VirtIODevice *vdev = opaque; assert(vdev->device_endian != VIRTIO_DEVICE_ENDIAN_UNKNOWN); if (!virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) { return vdev->device_endian != virtio_default_endian(); } /* Devices conforming to VIRTIO 1.0 or later are always LE. */ return vdev->device_endian != VIRTIO_DEVICE_ENDIAN_LITTLE; } ",0 "packed_cell_mem_cost(void) { return sizeof(packed_cell_t) + MP_POOL_ITEM_OVERHEAD; } ",0 " SaveCardBubbleControllerImplTest() {} ",0 "static u16 vmci_transport_new_proto_supported_versions(void) { if (PROTOCOL_OVERRIDE != -1) return PROTOCOL_OVERRIDE; return VSOCK_PROTO_ALL_SUPPORTED; } ",0 "sp FLACExtractor::getMetaData() { return mFileMetadata; } ",0 "static void emitjumpto(JF, int opcode, int dest) { emit(J, F, opcode); if (dest != (js_Instruction)dest) js_syntaxerror(J, ""jump address integer overflow""); emitarg(J, F, dest); } ",0 "static void processCommandsCallback(int fd, short flags, void *param) { RecordStream *p_rs; void *p_record; size_t recordlen; int ret; SocketListenParam *p_info = (SocketListenParam *)param; assert(fd == p_info->fdCommand); p_rs = p_info->p_rs; for (;;) { /* loop until EAGAIN/EINTR, end of stream, or other error */ ret = record_stream_get_next(p_rs, &p_record, &recordlen); if (ret == 0 && p_record == NULL) { /* end-of-stream */ break; } else if (ret < 0) { break; } else if (ret == 0) { /* && p_record != NULL */ processCommandBuffer(p_record, recordlen, p_info->socket_id); } } if (ret == 0 || !(errno == EAGAIN || errno == EINTR)) { /* fatal error or end-of-stream */ if (ret != 0) { RLOGE(""error on reading command socket errno:%d\n"", errno); } else { RLOGW(""EOS. Closing command socket.""); } close(fd); p_info->fdCommand = -1; ril_event_del(p_info->commands_event); record_stream_free(p_rs); /* start listening for new connections again */ rilEventAddWakeup(&s_listen_event); onCommandsSocketClosed(p_info->socket_id); } } ",0 "BackingStore* RenderWidgetHostViewAura::AllocBackingStore( const gfx::Size& size) { return new BackingStoreAura(host_, size); } ",0 "XRRScreenSize *XRRConfigSizes(XRRScreenConfiguration *config, int *nsizes) { *nsizes = config->nsizes; return config->sizes; } ",0 "int CSoundFile::FrequencyToTranspose(DWORD freq) { return int(1536*(log(freq/8363.0)/log(2.0))); #ifdef MSC_VER const float _f1_8363 = 1.0f / 8363.0f; const float _factor = 128 * 12; LONG result; if (!freq) return 0; _asm { fld _factor fild freq fld _f1_8363 fmulp st(1), st(0) fyl2x fistp result } return result; #endif } ",0 " virtual string16 Execute( const std::string& component_text, std::vector* offsets_into_component) const { return (unescape_rules_ == UnescapeRule::NONE) ? UTF8ToUTF16AndAdjustOffsets(component_text, offsets_into_component) : UnescapeAndDecodeUTF8URLComponentWithOffsets(component_text, unescape_rules_, offsets_into_component); } ",0 "static bool ExecuteStrikethrough(LocalFrame& frame, Event*, EditorCommandSource source, const String&) { CSSIdentifierValue* line_through = CSSIdentifierValue::Create(CSSValueLineThrough); return ExecuteToggleStyleInList( frame, source, InputEvent::InputType::kFormatStrikeThrough, CSSPropertyWebkitTextDecorationsInEffect, line_through); } ",0 "ssh_packet_send1(struct ssh *ssh) { struct session_state *state = ssh->state; u_char buf[8], *cp; int r, padding, len; u_int checksum; /* * If using packet compression, compress the payload of the outgoing * packet. */ if (state->packet_compression) { sshbuf_reset(state->compression_buffer); /* Skip padding. */ if ((r = sshbuf_consume(state->outgoing_packet, 8)) != 0) goto out; /* padding */ if ((r = sshbuf_put(state->compression_buffer, ""\0\0\0\0\0\0\0\0"", 8)) != 0) goto out; if ((r = compress_buffer(ssh, state->outgoing_packet, state->compression_buffer)) != 0) goto out; sshbuf_reset(state->outgoing_packet); if ((r = sshbuf_putb(state->outgoing_packet, state->compression_buffer)) != 0) goto out; } /* Compute packet length without padding (add checksum, remove padding). */ len = sshbuf_len(state->outgoing_packet) + 4 - 8; /* Insert padding. Initialized to zero in packet_start1() */ padding = 8 - len % 8; if (!state->send_context.plaintext) { cp = sshbuf_mutable_ptr(state->outgoing_packet); if (cp == NULL) { r = SSH_ERR_INTERNAL_ERROR; goto out; } arc4random_buf(cp + 8 - padding, padding); } if ((r = sshbuf_consume(state->outgoing_packet, 8 - padding)) != 0) goto out; /* Add check bytes. */ checksum = ssh_crc32(sshbuf_ptr(state->outgoing_packet), sshbuf_len(state->outgoing_packet)); POKE_U32(buf, checksum); if ((r = sshbuf_put(state->outgoing_packet, buf, 4)) != 0) goto out; #ifdef PACKET_DEBUG fprintf(stderr, ""packet_send plain: ""); sshbuf_dump(state->outgoing_packet, stderr); #endif /* Append to output. */ POKE_U32(buf, len); if ((r = sshbuf_put(state->output, buf, 4)) != 0) goto out; if ((r = sshbuf_reserve(state->output, sshbuf_len(state->outgoing_packet), &cp)) != 0) goto out; if ((r = cipher_crypt(&state->send_context, 0, cp, sshbuf_ptr(state->outgoing_packet), sshbuf_len(state->outgoing_packet), 0, 0)) != 0) goto out; #ifdef PACKET_DEBUG fprintf(stderr, ""encrypted: ""); sshbuf_dump(state->output, stderr); #endif state->p_send.packets++; state->p_send.bytes += len + sshbuf_len(state->outgoing_packet); sshbuf_reset(state->outgoing_packet); /* * Note that the packet is now only buffered in output. It won't be * actually sent until ssh_packet_write_wait or ssh_packet_write_poll * is called. */ r = 0; out: return r; } ",0 "void FileBrowserPrivateGetDownloadUrlFunction::OnGetResourceEntry( drive::FileError error, scoped_ptr entry) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (error != drive::FILE_ERROR_OK) { SetError(""Download Url for this item is not available.""); SetResult(new base::StringValue("""")); // Intentionally returns a blank. SendResponse(false); return; } download_url_ = google_apis::DriveApiUrlGenerator::kBaseDownloadUrlForProduction + entry->resource_id(); ProfileOAuth2TokenService* oauth2_token_service = ProfileOAuth2TokenServiceFactory::GetForProfile(GetProfile()); SigninManagerBase* signin_manager = SigninManagerFactory::GetForProfile(GetProfile()); const std::string& account_id = signin_manager->GetAuthenticatedAccountId(); std::vector scopes; scopes.push_back(""https://www.googleapis.com/auth/drive.readonly""); auth_service_.reset( new google_apis::AuthService(oauth2_token_service, account_id, GetProfile()->GetRequestContext(), scopes)); auth_service_->StartAuthentication(base::Bind( &FileBrowserPrivateGetDownloadUrlFunction::OnTokenFetched, this)); } ",0 "static int bounce_error_event(struct snd_seq_client *client, struct snd_seq_event *event, int err, int atomic, int hop) { struct snd_seq_event bounce_ev; int result; if (client == NULL || ! (client->filter & SNDRV_SEQ_FILTER_BOUNCE) || ! client->accept_input) return 0; /* ignored */ /* set up quoted error */ memset(&bounce_ev, 0, sizeof(bounce_ev)); bounce_ev.type = SNDRV_SEQ_EVENT_KERNEL_ERROR; bounce_ev.flags = SNDRV_SEQ_EVENT_LENGTH_FIXED; bounce_ev.queue = SNDRV_SEQ_QUEUE_DIRECT; bounce_ev.source.client = SNDRV_SEQ_CLIENT_SYSTEM; bounce_ev.source.port = SNDRV_SEQ_PORT_SYSTEM_ANNOUNCE; bounce_ev.dest.client = client->number; bounce_ev.dest.port = event->source.port; bounce_ev.data.quote.origin = event->dest; bounce_ev.data.quote.event = event; bounce_ev.data.quote.value = -err; /* use positive value */ result = snd_seq_deliver_single_event(NULL, &bounce_ev, 0, atomic, hop + 1); if (result < 0) { client->event_lost++; return result; } return result; } ",0 "static int ahci_start_transfer(IDEDMA *dma) { AHCIDevice *ad = DO_UPCAST(AHCIDevice, dma, dma); IDEState *s = &ad->port.ifs[0]; uint32_t size = (uint32_t)(s->data_end - s->data_ptr); /* write == ram -> device */ uint32_t opts = le32_to_cpu(ad->cur_cmd->opts); int is_write = opts & AHCI_CMD_WRITE; int is_atapi = opts & AHCI_CMD_ATAPI; int has_sglist = 0; if (is_atapi && !ad->done_atapi_packet) { /* already prepopulated iobuffer */ ad->done_atapi_packet = true; goto out; } if (!ahci_populate_sglist(ad, &s->sg, 0)) { has_sglist = 1; } DPRINTF(ad->port_no, ""%sing %d bytes on %s w/%s sglist\n"", is_write ? ""writ"" : ""read"", size, is_atapi ? ""atapi"" : ""ata"", has_sglist ? """" : ""o""); if (has_sglist && size) { if (is_write) { dma_buf_write(s->data_ptr, size, &s->sg); } else { dma_buf_read(s->data_ptr, size, &s->sg); } } /* update number of transferred bytes */ ad->cur_cmd->status = cpu_to_le32(le32_to_cpu(ad->cur_cmd->status) + size); out: /* declare that we processed everything */ s->data_ptr = s->data_end; if (has_sglist) { qemu_sglist_destroy(&s->sg); } s->end_transfer_func(s); if (!(s->status & DRQ_STAT)) { /* done with DMA */ ahci_trigger_irq(ad->hba, ad, PORT_IRQ_STAT_DSS); } return 0; } ",0 "void InputHandlerProxy::ReconcileElasticOverscrollAndRootScroll() { if (scroll_elasticity_controller_) scroll_elasticity_controller_->ReconcileStretchAndScroll(); } ",0 "int ras_validate(jas_stream_t *in) { uchar buf[RAS_MAGICLEN]; int i; int n; uint_fast32_t magic; assert(JAS_STREAM_MAXPUTBACK >= RAS_MAGICLEN); /* Read the validation data (i.e., the data used for detecting the format). */ if ((n = jas_stream_read(in, buf, RAS_MAGICLEN)) < 0) { return -1; } /* Put the validation data back onto the stream, so that the stream position will not be changed. */ for (i = n - 1; i >= 0; --i) { if (jas_stream_ungetc(in, buf[i]) == EOF) { return -1; } } /* Did we read enough data? */ if (n < RAS_MAGICLEN) { return -1; } magic = (JAS_CAST(uint_fast32_t, buf[0]) << 24) | (JAS_CAST(uint_fast32_t, buf[1]) << 16) | (JAS_CAST(uint_fast32_t, buf[2]) << 8) | buf[3]; /* Is the signature correct for the Sun Rasterfile format? */ if (magic != RAS_MAGIC) { return -1; } return 0; } ",0 "static void *default_alloc(void *ctx, void *p, int n) { return realloc(p, (size_t)n); } ",0 "static int mov_write_stts_tag(AVIOContext *pb, MOVTrack *track) { MOVStts *stts_entries = NULL; uint32_t entries = -1; uint32_t atom_size; int i; if (track->par->codec_type == AVMEDIA_TYPE_AUDIO && !track->audio_vbr) { stts_entries = av_malloc(sizeof(*stts_entries)); /* one entry */ if (!stts_entries) return AVERROR(ENOMEM); stts_entries[0].count = track->sample_count; stts_entries[0].duration = 1; entries = 1; } else { if (track->entry) { stts_entries = av_malloc_array(track->entry, sizeof(*stts_entries)); /* worst case */ if (!stts_entries) return AVERROR(ENOMEM); } for (i = 0; i < track->entry; i++) { int duration = get_cluster_duration(track, i); if (i && duration == stts_entries[entries].duration) { stts_entries[entries].count++; /* compress */ } else { entries++; stts_entries[entries].duration = duration; stts_entries[entries].count = 1; } } entries++; /* last one */ } atom_size = 16 + (entries * 8); avio_wb32(pb, atom_size); /* size */ ffio_wfourcc(pb, ""stts""); avio_wb32(pb, 0); /* version & flags */ avio_wb32(pb, entries); /* entry count */ for (i = 0; i < entries; i++) { avio_wb32(pb, stts_entries[i].count); avio_wb32(pb, stts_entries[i].duration); } av_free(stts_entries); return atom_size; } ",0 "static int mpeg4_get_block_length(MpegEncContext *s, int16_t *block, int n, int intra_dc, uint8_t *scan_table) { int i, last_non_zero; uint8_t *len_tab; const int last_index = s->block_last_index[n]; int len = 0; if (s->mb_intra) { // Note gcc (3.2.1 at least) will optimize this away /* MPEG-4 based DC predictor */ len += mpeg4_get_dc_length(intra_dc, n); if (last_index < 1) return len; i = 1; len_tab = uni_mpeg4_intra_rl_len; } else { if (last_index < 0) return 0; i = 0; len_tab = uni_mpeg4_inter_rl_len; } /* AC coefs */ last_non_zero = i - 1; for (; i < last_index; i++) { int level = block[scan_table[i]]; if (level) { int run = i - last_non_zero - 1; level += 64; if ((level & (~127)) == 0) { const int index = UNI_MPEG4_ENC_INDEX(0, run, level); len += len_tab[index]; } else { // ESC3 len += 7 + 2 + 1 + 6 + 1 + 12 + 1; } last_non_zero = i; } } /* if (i <= last_index) */ { int level = block[scan_table[i]]; int run = i - last_non_zero - 1; level += 64; if ((level & (~127)) == 0) { const int index = UNI_MPEG4_ENC_INDEX(1, run, level); len += len_tab[index]; } else { // ESC3 len += 7 + 2 + 1 + 6 + 1 + 12 + 1; } } return len; } ",0 " void Zoom(double factor, bool text_only) { if (ppp_zoom_ != NULL) { ppp_zoom_->Zoom(plugin_->pp_instance(), factor, PP_FromBool(text_only)); } } ",0 "static void catc_tx_done(struct urb *urb) { struct catc *catc = urb->context; unsigned long flags; int r, status = urb->status; if (status == -ECONNRESET) { dev_dbg(&urb->dev->dev, ""Tx Reset.\n""); urb->status = 0; netif_trans_update(catc->netdev); catc->netdev->stats.tx_errors++; clear_bit(TX_RUNNING, &catc->flags); netif_wake_queue(catc->netdev); return; } if (status) { dev_dbg(&urb->dev->dev, ""tx_done, status %d, length %d\n"", status, urb->actual_length); return; } spin_lock_irqsave(&catc->tx_lock, flags); if (catc->tx_ptr) { r = catc_tx_run(catc); if (unlikely(r < 0)) clear_bit(TX_RUNNING, &catc->flags); } else { clear_bit(TX_RUNNING, &catc->flags); } netif_wake_queue(catc->netdev); spin_unlock_irqrestore(&catc->tx_lock, flags); } ",0 "ChromeContentBrowserClientExtensionsPart::ShouldTryToUseExistingProcessHost( Profile* profile, const GURL& url) { ExtensionRegistry* registry = profile ? ExtensionRegistry::Get(profile) : NULL; if (!registry) return false; const Extension* extension = registry->enabled_extensions().GetExtensionOrAppByURL(url); if (!extension) return false; if (!BackgroundInfo::HasBackgroundPage(extension)) return false; std::set process_ids; size_t max_process_count = content::RenderProcessHost::GetMaxRendererProcessCount(); std::vector profiles = g_browser_process->profile_manager()-> GetLoadedProfiles(); for (size_t i = 0; i < profiles.size(); ++i) { ProcessManager* epm = ProcessManager::Get(profiles[i]); for (ExtensionHost* host : epm->background_hosts()) process_ids.insert(host->render_process_host()->GetID()); } return (process_ids.size() > (max_process_count * chrome::kMaxShareOfExtensionProcesses)); } ",0 "void BrowserRenderProcessHost::OnChannelConnected(int32 peer_pid) { if (!process_.handle()) { if (fast_shutdown_started_) { return; } else if (base::GetCurrentProcId() == peer_pid) { process_.set_handle(base::GetCurrentProcessHandle()); } else { #if defined(OS_WIN) process_.set_handle(OpenProcess(MAXIMUM_ALLOWED, FALSE, peer_pid)); #else NOTREACHED(); #endif DCHECK(process_.handle()); } } else { if (peer_pid != process_.pid()) { #if !defined(OS_LINUX) CHECK(peer_pid == process_.pid()) << peer_pid << "" "" << process_.pid(); #endif } mark_child_process_activity_time(); } #if defined(IPC_MESSAGE_LOG_ENABLED) bool enabled = IPC::Logging::current()->Enabled(); Send(new ViewMsg_SetIPCLoggingEnabled(enabled)); #endif } ",0 "static void activityLoggingForAllWorldsPerWorldBindingsVoidMethodMethodCallbackForMainWorld(const v8::FunctionCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMMethod""); V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->GetCurrentContext()); if (contextData && contextData->activityLogger()) { Vector > loggerArgs = toNativeArguments >(info, 0); contextData->activityLogger()->log(""TestObjectPython.activityLoggingForAllWorldsPerWorldBindingsVoidMethod"", info.Length(), loggerArgs.data(), ""Method""); } TestObjectPythonV8Internal::activityLoggingForAllWorldsPerWorldBindingsVoidMethodMethodForMainWorld(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "static void dccp_v6_reqsk_destructor(struct request_sock *req) { dccp_feat_list_purge(&dccp_rsk(req)->dreq_featneg); if (inet6_rsk(req)->pktopts != NULL) kfree_skb(inet6_rsk(req)->pktopts); } ",0 "void VideoCaptureManager::RegisterListener( MediaStreamProviderListener* listener) { DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK(listener); listeners_.AddObserver(listener); #if defined(OS_ANDROID) application_state_has_running_activities_ = true; app_status_listener_ = base::android::ApplicationStatusListener::New( base::BindRepeating(&VideoCaptureManager::OnApplicationStateChange, base::Unretained(this))); #endif } ",0 "SECURITY_STATUS SEC_ENTRY ImportSecurityContextW(SEC_WCHAR* pszPackage, PSecBuffer pPackedContext, HANDLE pToken, PCtxtHandle phContext) { return SEC_E_OK; } ",0 "static int video_get_buffer(AVCodecContext *s, AVFrame *pic) { FramePool *pool = s->internal->pool; const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pic->format); int i; if (pic->data[0] || pic->data[1] || pic->data[2] || pic->data[3]) { av_log(s, AV_LOG_ERROR, ""pic->data[*]!=NULL in avcodec_default_get_buffer\n""); return -1; } if (!desc) { av_log(s, AV_LOG_ERROR, ""Unable to get pixel format descriptor for format %s\n"", av_get_pix_fmt_name(pic->format)); return AVERROR(EINVAL); } memset(pic->data, 0, sizeof(pic->data)); pic->extended_data = pic->data; for (i = 0; i < 4 && pool->pools[i]; i++) { pic->linesize[i] = pool->linesize[i]; pic->buf[i] = av_buffer_pool_get(pool->pools[i]); if (!pic->buf[i]) goto fail; pic->data[i] = pic->buf[i]->data; } for (; i < AV_NUM_DATA_POINTERS; i++) { pic->data[i] = NULL; pic->linesize[i] = 0; } if (desc->flags & AV_PIX_FMT_FLAG_PAL || desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) avpriv_set_systematic_pal2((uint32_t *)pic->data[1], pic->format); if (s->debug & FF_DEBUG_BUFFERS) av_log(s, AV_LOG_DEBUG, ""default_get_buffer called on pic %p\n"", pic); return 0; fail: av_frame_unref(pic); return AVERROR(ENOMEM); } ",0 " virtual void SetUp() { download_manager_ = new TestDownloadManager(); request_handle_.reset(new MockDownloadRequestHandle(download_manager_)); download_file_factory_ = new MockDownloadFileFactory; download_file_manager_ = new DownloadFileManager(download_file_factory_); } ",0 "void WebRuntimeFeatures::EnableMediaCapture(bool enable) { RuntimeEnabledFeatures::SetMediaCaptureEnabled(enable); } ",0 "static int pv_eoi_put_user(struct kvm_vcpu *vcpu, u8 val) { return kvm_write_guest_cached(vcpu->kvm, &vcpu->arch.pv_eoi.data, &val, sizeof(val)); } ",0 "static int ctr_crypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) { return glue_ctr_crypt_128bit(&serpent_ctr, desc, dst, src, nbytes); } ",0 "static int veth_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) { cmd->supported = 0; cmd->advertising = 0; ethtool_cmd_speed_set(cmd, SPEED_10000); cmd->duplex = DUPLEX_FULL; cmd->port = PORT_TP; cmd->phy_address = 0; cmd->transceiver = XCVR_INTERNAL; cmd->autoneg = AUTONEG_DISABLE; cmd->maxtxpkt = 0; cmd->maxrxpkt = 0; return 0; } ",0 "MagickExport MagickBooleanType IsMonochromeImage(const Image *image, ExceptionInfo *exception) { assert(image != (Image *) NULL); assert(image->signature == MagickSignature); if (image->type == BilevelType) return(MagickTrue); return(MagickFalse); } ",0 "void WebSocket::OnConnected(SocketStream* socket_stream, int max_pending_send_allowed) { DCHECK(socket_stream == socket_stream_); max_pending_send_allowed_ = max_pending_send_allowed; current_read_buf_ = new GrowableIOBuffer(); current_read_buf_->SetCapacity(max_pending_send_allowed_); read_consumed_len_ = 0; DCHECK(!current_write_buf_); DCHECK(!handshake_.get()); handshake_.reset(new WebSocketHandshake( request_->url(), request_->origin(), request_->location(), request_->protocol())); const std::string msg = handshake_->CreateClientHandshakeMessage(); IOBufferWithSize* buf = new IOBufferWithSize(msg.size()); memcpy(buf->data(), msg.data(), msg.size()); pending_write_bufs_.push_back(buf); origin_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, &WebSocket::SendPending)); } ",1 "bool DirectoryBackingStore::MigrateVersion72To73() { int result = ExecQuery(load_dbhandle_, ""ALTER TABLE share_info ADD COLUMN notification_state BLOB""); if (result != SQLITE_DONE) return false; SetVersion(73); return true; } ",0 " static void unregisterBlobURLTask(void* context) { OwnPtr blobRegistryContext = adoptPtr(static_cast(context)); blobRegistry().unregisterBlobURL(blobRegistryContext->url); } ",1 "void BindColor(Model* model, V* view, C color, S setter) { view->AddBinding(base::MakeUnique>( base::Bind([](Model* m, C c) { return (m->color_scheme()).*c; }, base::Unretained(model), color), base::Bind([](V* v, S s, const SkColor& value) { (v->*s)(value); }, base::Unretained(view), setter))); } ",0 "dissect_NOTIFY_INFO_DATA(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { proto_item *item; proto_tree *subtree; guint32 count; guint16 type, field; const char *field_string; subtree = proto_tree_add_subtree(tree, tvb, offset, 0, ett_NOTIFY_INFO_DATA, &item, """"); offset = dissect_ndr_uint16( tvb, offset, pinfo, subtree, di, drep, hf_notify_info_data_type, &type); offset = dissect_notify_field( tvb, offset, pinfo, subtree, di, drep, type, &field); switch(type) { case PRINTER_NOTIFY_TYPE: field_string = val_to_str_ext( field, &printer_notify_option_data_vals_ext, ""Unknown (%d)""); break; case JOB_NOTIFY_TYPE: field_string = val_to_str_ext( field, &job_notify_option_data_vals_ext, ""Unknown (%d)""); break; default: field_string = ""Unknown field""; break; } proto_item_append_text( item, ""%s, %s"", val_to_str(type, printer_notify_types, ""Unknown (%d)""), field_string); offset = dissect_ndr_uint32( tvb, offset, pinfo, subtree, di, drep, hf_notify_info_data_count, &count); offset = dissect_ndr_uint32( tvb, offset, pinfo, subtree, di, drep, hf_notify_info_data_id, NULL); offset = dissect_ndr_uint32( tvb, offset, pinfo, subtree, di, drep, hf_notify_info_data_count, NULL); /* The value here depends on (type, field) */ switch (type) { case PRINTER_NOTIFY_TYPE: offset = dissect_NOTIFY_INFO_DATA_printer( tvb, offset, pinfo, subtree, item, di, drep, field); break; case JOB_NOTIFY_TYPE: offset = dissect_NOTIFY_INFO_DATA_job( tvb, offset, pinfo, subtree, item, di, drep, field); break; default: expert_add_info(pinfo, item, &ei_notify_info_data_type); break; } return offset; } ",0 "static TEE_Result user_ta_enter(TEE_ErrorOrigin *err, struct tee_ta_session *session, enum utee_entry_func func, uint32_t cmd, struct tee_ta_param *param) { TEE_Result res; struct utee_params *usr_params; uaddr_t usr_stack; struct user_ta_ctx *utc = to_user_ta_ctx(session->ctx); TEE_ErrorOrigin serr = TEE_ORIGIN_TEE; struct tee_ta_session *s __maybe_unused; void *param_va[TEE_NUM_PARAMS] = { NULL }; /* Map user space memory */ res = tee_mmu_map_param(utc, param, param_va); if (res != TEE_SUCCESS) goto cleanup_return; /* Switch to user ctx */ tee_ta_push_current_session(session); /* Make room for usr_params at top of stack */ usr_stack = utc->stack_addr + utc->mobj_stack->size; usr_stack -= ROUNDUP(sizeof(struct utee_params), STACK_ALIGNMENT); usr_params = (struct utee_params *)usr_stack; init_utee_param(usr_params, param, param_va); res = thread_enter_user_mode(func, tee_svc_kaddr_to_uref(session), (vaddr_t)usr_params, cmd, usr_stack, utc->entry_func, utc->is_32bit, &utc->ctx.panicked, &utc->ctx.panic_code); clear_vfp_state(utc); /* * According to GP spec the origin should allways be set to the * TA after TA execution */ serr = TEE_ORIGIN_TRUSTED_APP; if (utc->ctx.panicked) { DMSG(""tee_user_ta_enter: TA panicked with code 0x%x\n"", utc->ctx.panic_code); serr = TEE_ORIGIN_TEE; res = TEE_ERROR_TARGET_DEAD; } /* Copy out value results */ update_from_utee_param(param, usr_params); s = tee_ta_pop_current_session(); assert(s == session); cleanup_return: /* * Clear the cancel state now that the user TA has returned. The next * time the TA will be invoked will be with a new operation and should * not have an old cancellation pending. */ session->cancel = false; /* * Can't update *err until now since it may point to an address * mapped for the user mode TA. */ *err = serr; return res; } ",0 "options_for_tty() { char *dev, *path, *p; int ret; size_t pl; dev = devnam; if ((p = strstr(dev, ""/dev/"")) != NULL) dev = p + 5; if (dev[0] == 0 || strcmp(dev, ""tty"") == 0) return 1; /* don't look for /etc/ppp/options.tty */ pl = strlen(_PATH_TTYOPT) + strlen(dev) + 1; path = malloc(pl); if (path == NULL) novm(""tty init file name""); slprintf(path, pl, ""%s%s"", _PATH_TTYOPT, dev); /* Turn slashes into dots, for Solaris case (e.g. /dev/term/a) */ for (p = path + strlen(_PATH_TTYOPT); *p != 0; ++p) if (*p == '/') *p = '.'; option_priority = OPRIO_CFGFILE; ret = options_from_file(path, 0, 0, 1); free(path); return ret; } ",0 "static int _nfs4_proc_link(struct inode *inode, struct inode *dir, struct qstr *name) { struct nfs_server *server = NFS_SERVER(inode); struct nfs4_link_arg arg = { .fh = NFS_FH(inode), .dir_fh = NFS_FH(dir), .name = name, .bitmask = server->attr_bitmask, }; struct nfs_fattr fattr, dir_attr; struct nfs4_link_res res = { .server = server, .fattr = &fattr, .dir_attr = &dir_attr, }; struct rpc_message msg = { .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_LINK], .rpc_argp = &arg, .rpc_resp = &res, }; int status; nfs_fattr_init(res.fattr); nfs_fattr_init(res.dir_attr); status = rpc_call_sync(server->client, &msg, 0); if (!status) { update_changeattr(dir, &res.cinfo); nfs_post_op_update_inode(dir, res.dir_attr); nfs_post_op_update_inode(inode, res.fattr); } return status; } ",0 "void V8Debugger::allAsyncTasksCanceled() { m_asyncTaskStacks.clear(); m_recurringTasks.clear(); m_currentStacks.clear(); m_currentTasks.clear(); } ",0 "static void mptsas_scsi_init(PCIDevice *dev, Error **errp) { DeviceState *d = DEVICE(dev); MPTSASState *s = MPT_SAS(dev); dev->config[PCI_LATENCY_TIMER] = 0; dev->config[PCI_INTERRUPT_PIN] = 0x01; memory_region_init_io(&s->mmio_io, OBJECT(s), &mptsas_mmio_ops, s, ""mptsas-mmio"", 0x4000); memory_region_init_io(&s->port_io, OBJECT(s), &mptsas_port_ops, s, ""mptsas-io"", 256); memory_region_init_io(&s->diag_io, OBJECT(s), &mptsas_diag_ops, s, ""mptsas-diag"", 0x10000); if (s->msi_available && msi_init(dev, 0, 1, true, false) >= 0) { s->msi_in_use = true; } pci_register_bar(dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->port_io); pci_register_bar(dev, 1, PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_32, &s->mmio_io); pci_register_bar(dev, 2, PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_32, &s->diag_io); if (!s->sas_addr) { s->sas_addr = ((NAA_LOCALLY_ASSIGNED_ID << 24) | IEEE_COMPANY_LOCALLY_ASSIGNED) << 36; s->sas_addr |= (pci_bus_num(dev->bus) << 16); s->sas_addr |= (PCI_SLOT(dev->devfn) << 8); s->sas_addr |= PCI_FUNC(dev->devfn); } s->max_devices = MPTSAS_NUM_PORTS; s->request_bh = qemu_bh_new(mptsas_fetch_requests, s); QTAILQ_INIT(&s->pending); scsi_bus_new(&s->bus, sizeof(s->bus), &dev->qdev, &mptsas_scsi_info, NULL); if (!d->hotplugged) { scsi_bus_legacy_handle_cmdline(&s->bus, errp); } } ",0 "void BrowserWindowGtk::ShowPageInfo(content::WebContents* web_contents, const GURL& url, const SSLStatus& ssl, bool show_history) { chrome::ShowPageInfoBubble(window_, web_contents, url, ssl, show_history, browser_.get()); } ",0 "void ContextualSearchDelegate::GatherAndSaveSurroundingText( const std::string& selection, bool use_resolved_search_term, content::WebContents* web_contents, bool may_send_base_page_url) { GatherSurroundingTextWithCallback( selection, use_resolved_search_term, web_contents, may_send_base_page_url, base::Bind(&ContextualSearchDelegate::SaveSurroundingText, AsWeakPtr())); } ",0 "static void ext4_da_release_space(struct inode *inode, int to_free) { struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); struct ext4_inode_info *ei = EXT4_I(inode); if (!to_free) return; /* Nothing to release, exit */ spin_lock(&EXT4_I(inode)->i_block_reservation_lock); if (unlikely(to_free > ei->i_reserved_data_blocks)) { /* * if there aren't enough reserved blocks, then the * counter is messed up somewhere. Since this * function is called from invalidate page, it's * harmless to return without any action. */ ext4_msg(inode->i_sb, KERN_NOTICE, ""ext4_da_release_space: "" ""ino %lu, to_free %d with only %d reserved "" ""data blocks\n"", inode->i_ino, to_free, ei->i_reserved_data_blocks); WARN_ON(1); to_free = ei->i_reserved_data_blocks; } ei->i_reserved_data_blocks -= to_free; if (ei->i_reserved_data_blocks == 0) { /* * We can release all of the reserved metadata blocks * only when we have written all of the delayed * allocation blocks. */ to_free += ei->i_reserved_meta_blocks; ei->i_reserved_meta_blocks = 0; ei->i_da_metadata_calc_len = 0; } /* update fs dirty blocks counter */ percpu_counter_sub(&sbi->s_dirtyblocks_counter, to_free); spin_unlock(&EXT4_I(inode)->i_block_reservation_lock); vfs_dq_release_reservation_block(inode, to_free); } ",0 "static int start_decoder(vorb *f) { uint8 header[6], x,y; int len,i,j,k, max_submaps = 0; int longest_floorlist=0; if (!start_page(f)) return FALSE; if (!(f->page_flag & PAGEFLAG_first_page)) return error(f, VORBIS_invalid_first_page); if (f->page_flag & PAGEFLAG_last_page) return error(f, VORBIS_invalid_first_page); if (f->page_flag & PAGEFLAG_continued_packet) return error(f, VORBIS_invalid_first_page); if (f->segment_count != 1) return error(f, VORBIS_invalid_first_page); if (f->segments[0] != 30) return error(f, VORBIS_invalid_first_page); if (get8(f) != VORBIS_packet_id) return error(f, VORBIS_invalid_first_page); if (!getn(f, header, 6)) return error(f, VORBIS_unexpected_eof); if (!vorbis_validate(header)) return error(f, VORBIS_invalid_first_page); if (get32(f) != 0) return error(f, VORBIS_invalid_first_page); f->channels = get8(f); if (!f->channels) return error(f, VORBIS_invalid_first_page); if (f->channels > STB_VORBIS_MAX_CHANNELS) return error(f, VORBIS_too_many_channels); f->sample_rate = get32(f); if (!f->sample_rate) return error(f, VORBIS_invalid_first_page); get32(f); // bitrate_maximum get32(f); // bitrate_nominal get32(f); // bitrate_minimum x = get8(f); { int log0,log1; log0 = x & 15; log1 = x >> 4; f->blocksize_0 = 1 << log0; f->blocksize_1 = 1 << log1; if (log0 < 6 || log0 > 13) return error(f, VORBIS_invalid_setup); if (log1 < 6 || log1 > 13) return error(f, VORBIS_invalid_setup); if (log0 > log1) return error(f, VORBIS_invalid_setup); } x = get8(f); if (!(x & 1)) return error(f, VORBIS_invalid_first_page); if (!start_page(f)) return FALSE; if (!start_packet(f)) return FALSE; do { len = next_segment(f); skip(f, len); f->bytes_in_seg = 0; } while (len); if (!start_packet(f)) return FALSE; #ifndef STB_VORBIS_NO_PUSHDATA_API if (IS_PUSH_MODE(f)) { if (!is_whole_packet_present(f, TRUE)) { if (f->error == VORBIS_invalid_stream) f->error = VORBIS_invalid_setup; return FALSE; } } #endif crc32_init(); // always init it, to avoid multithread race conditions if (get8_packet(f) != VORBIS_packet_setup) return error(f, VORBIS_invalid_setup); for (i=0; i < 6; ++i) header[i] = get8_packet(f); if (!vorbis_validate(header)) return error(f, VORBIS_invalid_setup); f->codebook_count = get_bits(f,8) + 1; f->codebooks = (Codebook *) setup_malloc(f, sizeof(*f->codebooks) * f->codebook_count); if (f->codebooks == NULL) return error(f, VORBIS_outofmem); memset(f->codebooks, 0, sizeof(*f->codebooks) * f->codebook_count); for (i=0; i < f->codebook_count; ++i) { uint32 *values; int ordered, sorted_count; int total=0; uint8 *lengths; Codebook *c = f->codebooks+i; CHECK(f); x = get_bits(f, 8); if (x != 0x42) return error(f, VORBIS_invalid_setup); x = get_bits(f, 8); if (x != 0x43) return error(f, VORBIS_invalid_setup); x = get_bits(f, 8); if (x != 0x56) return error(f, VORBIS_invalid_setup); x = get_bits(f, 8); c->dimensions = (get_bits(f, 8)<<8) + x; x = get_bits(f, 8); y = get_bits(f, 8); c->entries = (get_bits(f, 8)<<16) + (y<<8) + x; ordered = get_bits(f,1); c->sparse = ordered ? 0 : get_bits(f,1); if (c->dimensions == 0 && c->entries != 0) return error(f, VORBIS_invalid_setup); if (c->sparse) lengths = (uint8 *) setup_temp_malloc(f, c->entries); else lengths = c->codeword_lengths = (uint8 *) setup_malloc(f, c->entries); if (!lengths) return error(f, VORBIS_outofmem); if (ordered) { int current_entry = 0; int current_length = get_bits(f,5) + 1; while (current_entry < c->entries) { int limit = c->entries - current_entry; int n = get_bits(f, ilog(limit)); if (current_entry + n > (int) c->entries) { return error(f, VORBIS_invalid_setup); } memset(lengths + current_entry, current_length, n); current_entry += n; ++current_length; } } else { for (j=0; j < c->entries; ++j) { int present = c->sparse ? get_bits(f,1) : 1; if (present) { lengths[j] = get_bits(f, 5) + 1; ++total; if (lengths[j] == 32) return error(f, VORBIS_invalid_setup); } else { lengths[j] = NO_CODE; } } } if (c->sparse && total >= c->entries >> 2) { if (c->entries > (int) f->setup_temp_memory_required) f->setup_temp_memory_required = c->entries; c->codeword_lengths = (uint8 *) setup_malloc(f, c->entries); if (c->codeword_lengths == NULL) return error(f, VORBIS_outofmem); memcpy(c->codeword_lengths, lengths, c->entries); setup_temp_free(f, lengths, c->entries); // note this is only safe if there have been no intervening temp mallocs! lengths = c->codeword_lengths; c->sparse = 0; } if (c->sparse) { sorted_count = total; } else { sorted_count = 0; #ifndef STB_VORBIS_NO_HUFFMAN_BINARY_SEARCH for (j=0; j < c->entries; ++j) if (lengths[j] > STB_VORBIS_FAST_HUFFMAN_LENGTH && lengths[j] != NO_CODE) ++sorted_count; #endif } c->sorted_entries = sorted_count; values = NULL; CHECK(f); if (!c->sparse) { c->codewords = (uint32 *) setup_malloc(f, sizeof(c->codewords[0]) * c->entries); if (!c->codewords) return error(f, VORBIS_outofmem); } else { unsigned int size; if (c->sorted_entries) { c->codeword_lengths = (uint8 *) setup_malloc(f, c->sorted_entries); if (!c->codeword_lengths) return error(f, VORBIS_outofmem); c->codewords = (uint32 *) setup_temp_malloc(f, sizeof(*c->codewords) * c->sorted_entries); if (!c->codewords) return error(f, VORBIS_outofmem); values = (uint32 *) setup_temp_malloc(f, sizeof(*values) * c->sorted_entries); if (!values) return error(f, VORBIS_outofmem); } size = c->entries + (sizeof(*c->codewords) + sizeof(*values)) * c->sorted_entries; if (size > f->setup_temp_memory_required) f->setup_temp_memory_required = size; } if (!compute_codewords(c, lengths, c->entries, values)) { if (c->sparse) setup_temp_free(f, values, 0); return error(f, VORBIS_invalid_setup); } if (c->sorted_entries) { c->sorted_codewords = (uint32 *) setup_malloc(f, sizeof(*c->sorted_codewords) * (c->sorted_entries+1)); if (c->sorted_codewords == NULL) return error(f, VORBIS_outofmem); c->sorted_values = ( int *) setup_malloc(f, sizeof(*c->sorted_values ) * (c->sorted_entries+1)); if (c->sorted_values == NULL) return error(f, VORBIS_outofmem); ++c->sorted_values; c->sorted_values[-1] = -1; compute_sorted_huffman(c, lengths, values); } if (c->sparse) { setup_temp_free(f, values, sizeof(*values)*c->sorted_entries); setup_temp_free(f, c->codewords, sizeof(*c->codewords)*c->sorted_entries); setup_temp_free(f, lengths, c->entries); c->codewords = NULL; } compute_accelerated_huffman(c); CHECK(f); c->lookup_type = get_bits(f, 4); if (c->lookup_type > 2) return error(f, VORBIS_invalid_setup); if (c->lookup_type > 0) { uint16 *mults; c->minimum_value = float32_unpack(get_bits(f, 32)); c->delta_value = float32_unpack(get_bits(f, 32)); c->value_bits = get_bits(f, 4)+1; c->sequence_p = get_bits(f,1); if (c->lookup_type == 1) { c->lookup_values = lookup1_values(c->entries, c->dimensions); } else { c->lookup_values = c->entries * c->dimensions; } if (c->lookup_values == 0) return error(f, VORBIS_invalid_setup); mults = (uint16 *) setup_temp_malloc(f, sizeof(mults[0]) * c->lookup_values); if (mults == NULL) return error(f, VORBIS_outofmem); for (j=0; j < (int) c->lookup_values; ++j) { int q = get_bits(f, c->value_bits); if (q == EOP) { setup_temp_free(f,mults,sizeof(mults[0])*c->lookup_values); return error(f, VORBIS_invalid_setup); } mults[j] = q; } #ifndef STB_VORBIS_DIVIDES_IN_CODEBOOK if (c->lookup_type == 1) { int len, sparse = c->sparse; float last=0; if (sparse) { if (c->sorted_entries == 0) goto skip; c->multiplicands = (codetype *) setup_malloc(f, sizeof(c->multiplicands[0]) * c->sorted_entries * c->dimensions); } else c->multiplicands = (codetype *) setup_malloc(f, sizeof(c->multiplicands[0]) * c->entries * c->dimensions); if (c->multiplicands == NULL) { setup_temp_free(f,mults,sizeof(mults[0])*c->lookup_values); return error(f, VORBIS_outofmem); } len = sparse ? c->sorted_entries : c->entries; for (j=0; j < len; ++j) { unsigned int z = sparse ? c->sorted_values[j] : j; unsigned int div=1; for (k=0; k < c->dimensions; ++k) { int off = (z / div) % c->lookup_values; float val = mults[off]; val = mults[off]*c->delta_value + c->minimum_value + last; c->multiplicands[j*c->dimensions + k] = val; if (c->sequence_p) last = val; if (k+1 < c->dimensions) { if (div > UINT_MAX / (unsigned int) c->lookup_values) { setup_temp_free(f, mults,sizeof(mults[0])*c->lookup_values); return error(f, VORBIS_invalid_setup); } div *= c->lookup_values; } } } c->lookup_type = 2; } else #endif { float last=0; CHECK(f); c->multiplicands = (codetype *) setup_malloc(f, sizeof(c->multiplicands[0]) * c->lookup_values); if (c->multiplicands == NULL) { setup_temp_free(f, mults,sizeof(mults[0])*c->lookup_values); return error(f, VORBIS_outofmem); } for (j=0; j < (int) c->lookup_values; ++j) { float val = mults[j] * c->delta_value + c->minimum_value + last; c->multiplicands[j] = val; if (c->sequence_p) last = val; } } #ifndef STB_VORBIS_DIVIDES_IN_CODEBOOK skip:; #endif setup_temp_free(f, mults, sizeof(mults[0])*c->lookup_values); CHECK(f); } CHECK(f); } x = get_bits(f, 6) + 1; for (i=0; i < x; ++i) { uint32 z = get_bits(f, 16); if (z != 0) return error(f, VORBIS_invalid_setup); } f->floor_count = get_bits(f, 6)+1; f->floor_config = (Floor *) setup_malloc(f, f->floor_count * sizeof(*f->floor_config)); if (f->floor_config == NULL) return error(f, VORBIS_outofmem); for (i=0; i < f->floor_count; ++i) { f->floor_types[i] = get_bits(f, 16); if (f->floor_types[i] > 1) return error(f, VORBIS_invalid_setup); if (f->floor_types[i] == 0) { Floor0 *g = &f->floor_config[i].floor0; g->order = get_bits(f,8); g->rate = get_bits(f,16); g->bark_map_size = get_bits(f,16); g->amplitude_bits = get_bits(f,6); g->amplitude_offset = get_bits(f,8); g->number_of_books = get_bits(f,4) + 1; for (j=0; j < g->number_of_books; ++j) g->book_list[j] = get_bits(f,8); return error(f, VORBIS_feature_not_supported); } else { stbv__floor_ordering p[31*8+2]; Floor1 *g = &f->floor_config[i].floor1; int max_class = -1; g->partitions = get_bits(f, 5); for (j=0; j < g->partitions; ++j) { g->partition_class_list[j] = get_bits(f, 4); if (g->partition_class_list[j] > max_class) max_class = g->partition_class_list[j]; } for (j=0; j <= max_class; ++j) { g->class_dimensions[j] = get_bits(f, 3)+1; g->class_subclasses[j] = get_bits(f, 2); if (g->class_subclasses[j]) { g->class_masterbooks[j] = get_bits(f, 8); if (g->class_masterbooks[j] >= f->codebook_count) return error(f, VORBIS_invalid_setup); } for (k=0; k < 1 << g->class_subclasses[j]; ++k) { g->subclass_books[j][k] = get_bits(f,8)-1; if (g->subclass_books[j][k] >= f->codebook_count) return error(f, VORBIS_invalid_setup); } } g->floor1_multiplier = get_bits(f,2)+1; g->rangebits = get_bits(f,4); g->Xlist[0] = 0; g->Xlist[1] = 1 << g->rangebits; g->values = 2; for (j=0; j < g->partitions; ++j) { int c = g->partition_class_list[j]; for (k=0; k < g->class_dimensions[c]; ++k) { g->Xlist[g->values] = get_bits(f, g->rangebits); ++g->values; } } for (j=0; j < g->values; ++j) { p[j].x = g->Xlist[j]; p[j].id = j; } qsort(p, g->values, sizeof(p[0]), point_compare); for (j=0; j < g->values; ++j) g->sorted_order[j] = (uint8) p[j].id; for (j=2; j < g->values; ++j) { int low,hi; neighbors(g->Xlist, j, &low,&hi); g->neighbors[j][0] = low; g->neighbors[j][1] = hi; } if (g->values > longest_floorlist) longest_floorlist = g->values; } } f->residue_count = get_bits(f, 6)+1; f->residue_config = (Residue *) setup_malloc(f, f->residue_count * sizeof(f->residue_config[0])); if (f->residue_config == NULL) return error(f, VORBIS_outofmem); memset(f->residue_config, 0, f->residue_count * sizeof(f->residue_config[0])); for (i=0; i < f->residue_count; ++i) { uint8 residue_cascade[64]; Residue *r = f->residue_config+i; f->residue_types[i] = get_bits(f, 16); if (f->residue_types[i] > 2) return error(f, VORBIS_invalid_setup); r->begin = get_bits(f, 24); r->end = get_bits(f, 24); if (r->end < r->begin) return error(f, VORBIS_invalid_setup); r->part_size = get_bits(f,24)+1; r->classifications = get_bits(f,6)+1; r->classbook = get_bits(f,8); if (r->classbook >= f->codebook_count) return error(f, VORBIS_invalid_setup); for (j=0; j < r->classifications; ++j) { uint8 high_bits=0; uint8 low_bits=get_bits(f,3); if (get_bits(f,1)) high_bits = get_bits(f,5); residue_cascade[j] = high_bits*8 + low_bits; } r->residue_books = (short (*)[8]) setup_malloc(f, sizeof(r->residue_books[0]) * r->classifications); if (r->residue_books == NULL) return error(f, VORBIS_outofmem); for (j=0; j < r->classifications; ++j) { for (k=0; k < 8; ++k) { if (residue_cascade[j] & (1 << k)) { r->residue_books[j][k] = get_bits(f, 8); if (r->residue_books[j][k] >= f->codebook_count) return error(f, VORBIS_invalid_setup); } else { r->residue_books[j][k] = -1; } } } r->classdata = (uint8 **) setup_malloc(f, sizeof(*r->classdata) * f->codebooks[r->classbook].entries); if (!r->classdata) return error(f, VORBIS_outofmem); memset(r->classdata, 0, sizeof(*r->classdata) * f->codebooks[r->classbook].entries); for (j=0; j < f->codebooks[r->classbook].entries; ++j) { int classwords = f->codebooks[r->classbook].dimensions; int temp = j; r->classdata[j] = (uint8 *) setup_malloc(f, sizeof(r->classdata[j][0]) * classwords); if (r->classdata[j] == NULL) return error(f, VORBIS_outofmem); for (k=classwords-1; k >= 0; --k) { r->classdata[j][k] = temp % r->classifications; temp /= r->classifications; } } } f->mapping_count = get_bits(f,6)+1; f->mapping = (Mapping *) setup_malloc(f, f->mapping_count * sizeof(*f->mapping)); if (f->mapping == NULL) return error(f, VORBIS_outofmem); memset(f->mapping, 0, f->mapping_count * sizeof(*f->mapping)); for (i=0; i < f->mapping_count; ++i) { Mapping *m = f->mapping + i; int mapping_type = get_bits(f,16); if (mapping_type != 0) return error(f, VORBIS_invalid_setup); m->chan = (MappingChannel *) setup_malloc(f, f->channels * sizeof(*m->chan)); if (m->chan == NULL) return error(f, VORBIS_outofmem); if (get_bits(f,1)) m->submaps = get_bits(f,4)+1; else m->submaps = 1; if (m->submaps > max_submaps) max_submaps = m->submaps; if (get_bits(f,1)) { m->coupling_steps = get_bits(f,8)+1; for (k=0; k < m->coupling_steps; ++k) { m->chan[k].magnitude = get_bits(f, ilog(f->channels-1)); m->chan[k].angle = get_bits(f, ilog(f->channels-1)); if (m->chan[k].magnitude >= f->channels) return error(f, VORBIS_invalid_setup); if (m->chan[k].angle >= f->channels) return error(f, VORBIS_invalid_setup); if (m->chan[k].magnitude == m->chan[k].angle) return error(f, VORBIS_invalid_setup); } } else m->coupling_steps = 0; if (get_bits(f,2)) return error(f, VORBIS_invalid_setup); if (m->submaps > 1) { for (j=0; j < f->channels; ++j) { m->chan[j].mux = get_bits(f, 4); if (m->chan[j].mux >= m->submaps) return error(f, VORBIS_invalid_setup); } } else for (j=0; j < f->channels; ++j) m->chan[j].mux = 0; for (j=0; j < m->submaps; ++j) { get_bits(f,8); // discard m->submap_floor[j] = get_bits(f,8); m->submap_residue[j] = get_bits(f,8); if (m->submap_floor[j] >= f->floor_count) return error(f, VORBIS_invalid_setup); if (m->submap_residue[j] >= f->residue_count) return error(f, VORBIS_invalid_setup); } } f->mode_count = get_bits(f, 6)+1; for (i=0; i < f->mode_count; ++i) { Mode *m = f->mode_config+i; m->blockflag = get_bits(f,1); m->windowtype = get_bits(f,16); m->transformtype = get_bits(f,16); m->mapping = get_bits(f,8); if (m->windowtype != 0) return error(f, VORBIS_invalid_setup); if (m->transformtype != 0) return error(f, VORBIS_invalid_setup); if (m->mapping >= f->mapping_count) return error(f, VORBIS_invalid_setup); } flush_packet(f); f->previous_length = 0; for (i=0; i < f->channels; ++i) { f->channel_buffers[i] = (float *) setup_malloc(f, sizeof(float) * f->blocksize_1); f->previous_window[i] = (float *) setup_malloc(f, sizeof(float) * f->blocksize_1/2); f->finalY[i] = (int16 *) setup_malloc(f, sizeof(int16) * longest_floorlist); if (f->channel_buffers[i] == NULL || f->previous_window[i] == NULL || f->finalY[i] == NULL) return error(f, VORBIS_outofmem); #ifdef STB_VORBIS_NO_DEFER_FLOOR f->floor_buffers[i] = (float *) setup_malloc(f, sizeof(float) * f->blocksize_1/2); if (f->floor_buffers[i] == NULL) return error(f, VORBIS_outofmem); #endif } if (!init_blocksize(f, 0, f->blocksize_0)) return FALSE; if (!init_blocksize(f, 1, f->blocksize_1)) return FALSE; f->blocksize[0] = f->blocksize_0; f->blocksize[1] = f->blocksize_1; #ifdef STB_VORBIS_DIVIDE_TABLE if (integer_divide_table[1][1]==0) for (i=0; i < DIVTAB_NUMER; ++i) for (j=1; j < DIVTAB_DENOM; ++j) integer_divide_table[i][j] = i / j; #endif { uint32 imdct_mem = (f->blocksize_1 * sizeof(float) >> 1); uint32 classify_mem; int i,max_part_read=0; for (i=0; i < f->residue_count; ++i) { Residue *r = f->residue_config + i; int n_read = r->end - r->begin; int part_read = n_read / r->part_size; if (part_read > max_part_read) max_part_read = part_read; } #ifndef STB_VORBIS_DIVIDES_IN_RESIDUE classify_mem = f->channels * (sizeof(void*) + max_part_read * sizeof(uint8 *)); #else classify_mem = f->channels * (sizeof(void*) + max_part_read * sizeof(int *)); #endif f->temp_memory_required = classify_mem; if (imdct_mem > f->temp_memory_required) f->temp_memory_required = imdct_mem; } f->first_decode = TRUE; if (f->alloc.alloc_buffer) { assert(f->temp_offset == f->alloc.alloc_buffer_length_in_bytes); if (f->setup_offset + sizeof(*f) + f->temp_memory_required > (unsigned) f->temp_offset) return error(f, VORBIS_outofmem); } f->first_audio_page_offset = stb_vorbis_get_file_offset(f); return TRUE; } ",1 "static void remove_notification(struct mqueue_inode_info *info) { if (info->notify_owner != NULL && info->notify.sigev_notify == SIGEV_THREAD) { set_cookie(info->notify_cookie, NOTIFY_REMOVED); netlink_sendskb(info->notify_sock, info->notify_cookie); } put_pid(info->notify_owner); put_user_ns(info->notify_user_ns); info->notify_owner = NULL; info->notify_user_ns = NULL; } ",0 "void CompositorImpl::InitializeDisplay( std::unique_ptr display_output_surface, scoped_refptr context_provider) { DCHECK(layer_tree_frame_sink_request_pending_); pending_frames_ = 0; if (context_provider) { gpu_capabilities_ = context_provider->ContextCapabilities(); } viz::FrameSinkManagerImpl* manager = GetFrameSinkManager(); scoped_refptr task_runner = base::ThreadTaskRunnerHandle::Get(); auto scheduler = std::make_unique( root_window_->GetBeginFrameSource(), task_runner.get(), display_output_surface->capabilities().max_frames_pending); viz::RendererSettings renderer_settings; renderer_settings.allow_antialiasing = false; renderer_settings.highp_threshold_min = 2048; renderer_settings.auto_resize_output_surface = false; renderer_settings.initial_screen_size = display::Screen::GetScreen() ->GetDisplayNearestWindow(root_window_) .GetSizeInPixel(); auto* gpu_memory_buffer_manager = BrowserMainLoop::GetInstance() ->gpu_channel_establish_factory() ->GetGpuMemoryBufferManager(); const bool should_register_begin_frame_source = !display_; display_ = std::make_unique( nullptr, renderer_settings, frame_sink_id_, std::move(display_output_surface), std::move(scheduler), task_runner); auto layer_tree_frame_sink = std::make_unique( frame_sink_id_, GetHostFrameSinkManager(), manager, display_.get(), nullptr /* display_client */, context_provider, nullptr /* worker_context_provider */, task_runner, gpu_memory_buffer_manager, features::IsVizHitTestingEnabled()); display_->SetVisible(true); display_->Resize(size_); display_->SetColorSpace(display_color_space_, display_color_space_); if (should_register_begin_frame_source) { GetFrameSinkManager()->RegisterBeginFrameSource( root_window_->GetBeginFrameSource(), frame_sink_id_); } host_->SetLayerTreeFrameSink(std::move(layer_tree_frame_sink)); } ",0 "mm_answer_audit_event(int socket, Buffer *m) { ssh_audit_event_t event; debug3(""%s entering"", __func__); event = buffer_get_int(m); switch(event) { case SSH_AUTH_FAIL_PUBKEY: case SSH_AUTH_FAIL_HOSTBASED: case SSH_AUTH_FAIL_GSSAPI: case SSH_LOGIN_EXCEED_MAXTRIES: case SSH_LOGIN_ROOT_DENIED: case SSH_CONNECTION_CLOSE: case SSH_INVALID_USER: audit_event(event); break; default: fatal(""Audit event type %d not permitted"", event); } return (0); } ",0 "static int crypto_cbcmac_digest_update(struct shash_desc *pdesc, const u8 *p, unsigned int len) { struct crypto_shash *parent = pdesc->tfm; struct cbcmac_tfm_ctx *tctx = crypto_shash_ctx(parent); struct cbcmac_desc_ctx *ctx = shash_desc_ctx(pdesc); struct crypto_cipher *tfm = tctx->child; int bs = crypto_shash_digestsize(parent); u8 *dg = (u8 *)ctx + crypto_shash_descsize(parent) - bs; while (len > 0) { unsigned int l = min(len, bs - ctx->len); crypto_xor(dg + ctx->len, p, l); ctx->len +=l; len -= l; p += l; if (ctx->len == bs) { crypto_cipher_encrypt_one(tfm, dg, dg); ctx->len = 0; } } return 0; } ",0 "ext4_ext_new_meta_block(handle_t *handle, struct inode *inode, struct ext4_ext_path *path, struct ext4_extent *ex, int *err) { ext4_fsblk_t goal, newblock; goal = ext4_ext_find_goal(inode, path, le32_to_cpu(ex->ee_block)); newblock = ext4_new_meta_blocks(handle, inode, goal, NULL, err); return newblock; } ",0 "void WebContentsImpl::ReplicatePageFocus(bool is_focused) { if (is_being_destroyed_) return; frame_tree_.ReplicatePageFocus(is_focused); } ",0 "BrowserTabStripController::BrowserTabStripController(Browser* browser, TabStripModel* model) : model_(model), tabstrip_(NULL), browser_(browser), hover_tab_selector_(model) { model_->AddObserver(this); local_pref_registrar_.Init(g_browser_process->local_state()); local_pref_registrar_.Add(prefs::kTabStripLayoutType, this); } ",0 "static ssize_t fuse_file_aio_read(struct kiocb *iocb, const struct iovec *iov, unsigned long nr_segs, loff_t pos) { struct inode *inode = iocb->ki_filp->f_mapping->host; if (pos + iov_length(iov, nr_segs) > i_size_read(inode)) { int err; /* * If trying to read past EOF, make sure the i_size * attribute is up-to-date. */ err = fuse_update_attributes(inode, NULL, iocb->ki_filp, NULL); if (err) return err; } return generic_file_aio_read(iocb, iov, nr_segs, pos); } ",0 "static inline void tg3_set_mtu(struct net_device *dev, struct tg3 *tp, int new_mtu) { dev->mtu = new_mtu; if (new_mtu > ETH_DATA_LEN) { if (tg3_flag(tp, 5780_CLASS)) { netdev_update_features(dev); tg3_flag_clear(tp, TSO_CAPABLE); } else { tg3_flag_set(tp, JUMBO_RING_ENABLE); } } else { if (tg3_flag(tp, 5780_CLASS)) { tg3_flag_set(tp, TSO_CAPABLE); netdev_update_features(dev); } tg3_flag_clear(tp, JUMBO_RING_ENABLE); } } ",0 "bool Extension::LoadPlugins(string16* error) { if (!manifest_->HasKey(keys::kPlugins)) return true; ListValue* list_value = NULL; if (!manifest_->GetList(keys::kPlugins, &list_value)) { *error = ASCIIToUTF16(errors::kInvalidPlugins); return false; } for (size_t i = 0; i < list_value->GetSize(); ++i) { DictionaryValue* plugin_value = NULL; if (!list_value->GetDictionary(i, &plugin_value)) { *error = ASCIIToUTF16(errors::kInvalidPlugins); return false; } std::string path_str; if (!plugin_value->GetString(keys::kPluginsPath, &path_str)) { *error = ErrorUtils::FormatErrorMessageUTF16( errors::kInvalidPluginsPath, base::IntToString(i)); return false; } bool is_public = false; if (plugin_value->HasKey(keys::kPluginsPublic)) { if (!plugin_value->GetBoolean(keys::kPluginsPublic, &is_public)) { *error = ErrorUtils::FormatErrorMessageUTF16( errors::kInvalidPluginsPublic, base::IntToString(i)); return false; } } #if defined(OS_CHROMEOS) continue; #elif defined(OS_WIN) if (base::win::IsMetroProcess()) { continue; } #endif // defined(OS_WIN). plugins_.push_back(PluginInfo()); plugins_.back().path = path().Append(FilePath::FromUTF8Unsafe(path_str)); plugins_.back().is_public = is_public; } return true; } ",0 "PHP_FUNCTION(exif_read_data) { char *p_name, *p_sections_needed = NULL; int p_name_len, p_sections_needed_len = 0; zend_bool sub_arrays=0, read_thumbnail=0, read_all=0; int i, ret, sections_needed=0; image_info_type ImageInfo; char tmp[64], *sections_str, *s; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""p|sbb"", &p_name, &p_name_len, &p_sections_needed, &p_sections_needed_len, &sub_arrays, &read_thumbnail) == FAILURE) { return; } memset(&ImageInfo, 0, sizeof(ImageInfo)); if (p_sections_needed) { spprintf(§ions_str, 0, "",%s,"", p_sections_needed); /* sections_str DOES start with , and SPACES are NOT allowed in names */ s = sections_str; while (*++s) { if (*s == ' ') { *s = ','; } } for (i = 0; i < SECTION_COUNT; i++) { snprintf(tmp, sizeof(tmp), "",%s,"", exif_get_sectionname(i)); if (strstr(sections_str, tmp)) { sections_needed |= 1<0 && ImageInfo.Height>0) { exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, ""html"" TSRMLS_CC, ""width=\""%d\"" height=\""%d\"""", ImageInfo.Width, ImageInfo.Height); exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, ""Height"", ImageInfo.Height TSRMLS_CC); exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, ""Width"", ImageInfo.Width TSRMLS_CC); } exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, ""IsColor"", ImageInfo.IsColor TSRMLS_CC); if (ImageInfo.motorola_intel != -1) { exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, ""ByteOrderMotorola"", ImageInfo.motorola_intel TSRMLS_CC); } if (ImageInfo.FocalLength) { exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, ""FocalLength"" TSRMLS_CC, ""%4.1Fmm"", ImageInfo.FocalLength); if(ImageInfo.CCDWidth) { exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, ""35mmFocalLength"" TSRMLS_CC, ""%dmm"", (int)(ImageInfo.FocalLength/ImageInfo.CCDWidth*35+0.5)); } } if(ImageInfo.CCDWidth) { exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, ""CCDWidth"" TSRMLS_CC, ""%dmm"", (int)ImageInfo.CCDWidth); } if(ImageInfo.ExposureTime>0) { if(ImageInfo.ExposureTime <= 0.5) { exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, ""ExposureTime"" TSRMLS_CC, ""%0.3F s (1/%d)"", ImageInfo.ExposureTime, (int)(0.5 + 1/ImageInfo.ExposureTime)); } else { exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, ""ExposureTime"" TSRMLS_CC, ""%0.3F s"", ImageInfo.ExposureTime); } } if(ImageInfo.ApertureFNumber) { exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, ""ApertureFNumber"" TSRMLS_CC, ""f/%.1F"", ImageInfo.ApertureFNumber); } if(ImageInfo.Distance) { if(ImageInfo.Distance<0) { exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, ""FocusDistance"", ""Infinite"" TSRMLS_CC); } else { exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, ""FocusDistance"" TSRMLS_CC, ""%0.2Fm"", ImageInfo.Distance); } } if (ImageInfo.UserComment) { exif_iif_add_buffer(&ImageInfo, SECTION_COMPUTED, ""UserComment"", ImageInfo.UserCommentLength, ImageInfo.UserComment TSRMLS_CC); if (ImageInfo.UserCommentEncoding && strlen(ImageInfo.UserCommentEncoding)) { exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, ""UserCommentEncoding"", ImageInfo.UserCommentEncoding TSRMLS_CC); } } exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, ""Copyright"", ImageInfo.Copyright TSRMLS_CC); exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, ""Copyright.Photographer"", ImageInfo.CopyrightPhotographer TSRMLS_CC); exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, ""Copyright.Editor"", ImageInfo.CopyrightEditor TSRMLS_CC); for (i=0; iproctitle.value) { buf = kmalloc(MAX_PROCTITLE_AUDIT_LEN, GFP_KERNEL); if (!buf) goto out; /* Historically called this from procfs naming */ res = get_cmdline(tsk, buf, MAX_PROCTITLE_AUDIT_LEN); if (res == 0) { kfree(buf); goto out; } res = audit_proctitle_rtrim(buf, res); if (res == 0) { kfree(buf); goto out; } context->proctitle.value = buf; context->proctitle.len = res; } msg = context->proctitle.value; len = context->proctitle.len; out: audit_log_n_untrustedstring(ab, msg, len); audit_log_end(ab); } ",0 "static void usb_net_handle_datain(USBNetState *s, USBPacket *p) { int len; if (s->in_ptr > s->in_len) { usb_net_reset_in_buf(s); p->status = USB_RET_NAK; return; } if (!s->in_len) { p->status = USB_RET_NAK; return; } len = s->in_len - s->in_ptr; if (len > p->iov.size) { len = p->iov.size; } usb_packet_copy(p, &s->in_buf[s->in_ptr], len); s->in_ptr += len; if (s->in_ptr >= s->in_len && (is_rndis(s) || (s->in_len & (64 - 1)) || !len)) { /* no short packet necessary */ usb_net_reset_in_buf(s); } #ifdef TRAFFIC_DEBUG fprintf(stderr, ""usbnet: data in len %zu return %d"", p->iov.size, len); iov_hexdump(p->iov.iov, p->iov.niov, stderr, ""usbnet"", len); #endif } ",0 "int Condor_Auth_SSL :: client_share_status( int client_status ) { int server_status; if( receive_status( server_status ) == AUTH_SSL_ERROR ) { return AUTH_SSL_ERROR; } if( send_status( client_status ) == AUTH_SSL_ERROR ) { return AUTH_SSL_ERROR; } return server_status; } ",0 "static inline bool isValidNameStart(UChar32 c) { if ((c >= 0x02BB && c <= 0x02C1) || c == 0x559 || c == 0x6E5 || c == 0x6E6) return true; if (c == ':' || c == '_') return true; const uint32_t nameStartMask = Letter_Lowercase | Letter_Uppercase | Letter_Other | Letter_Titlecase | Number_Letter; if (!(Unicode::category(c) & nameStartMask)) return false; if (c >= 0xF900 && c < 0xFFFE) return false; CharDecompositionType decompType = decompositionType(c); if (decompType == DecompositionFont || decompType == DecompositionCompat) return false; return true; } ",0 "static bool tsk_unreliable(struct tipc_sock *tsk) { return msg_src_droppable(&tsk->phdr) != 0; } ",0 "ScopedRenderBufferBinder::~ScopedRenderBufferBinder() { ScopedGLErrorSuppressor suppressor( ""ScopedRenderBufferBinder::dtor"", state_->GetErrorState()); state_->RestoreRenderbufferBindings(); } ",0 "bool OmniboxViewViews::OnInlineAutocompleteTextMaybeChanged( const base::string16& display_text, size_t user_text_length) { if (display_text == text()) return false; if (IsIMEComposing()) { location_bar_view_->SetImeInlineAutocompletion( display_text.substr(user_text_length)); } else { gfx::Range range(display_text.size(), user_text_length); SetTextAndSelectedRange(display_text, range); } TextChanged(); return true; } ",0 "void CL_ShutdownAll(qboolean shutdownRef) { if(CL_VideoRecording()) CL_CloseAVI(); if(clc.demorecording) CL_StopRecord_f(); #ifdef USE_CURL CL_cURL_Shutdown(); #endif S_DisableSounds(); CL_ShutdownCGame(); CL_ShutdownUI(); if(shutdownRef) CL_ShutdownRef(); else if(re.Shutdown) re.Shutdown(qfalse); // don't destroy window or context cls.uiStarted = qfalse; cls.cgameStarted = qfalse; cls.rendererStarted = qfalse; cls.soundRegistered = qfalse; } ",0 "static int fetch_tempfile(char *line, void *data) { FILE *fp = data; if (!line) rewind(fp); else if (fputs(line, fp) == EOF || fputc('\n', fp) == EOF) return -1; return 0; } ",0 " TextureUnit() : bind_target(GL_TEXTURE_2D) { } ",0 "ResourceFetcher* XSLStyleSheet::fetcher() { Document* document = ownerDocument(); if (!document) return 0; return document->fetcher(); } ",0 "PHP_FUNCTION(pg_get_notify) { zval *pgsql_link; int id = -1; long result_type = PGSQL_ASSOC; PGconn *pgsql; PGnotify *pgsql_notify; if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, ""r|l"", &pgsql_link, &result_type) == FAILURE) { RETURN_FALSE; } ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, ""PostgreSQL link"", le_link, le_plink); if (!(result_type & PGSQL_BOTH)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Invalid result type""); RETURN_FALSE; } PQconsumeInput(pgsql); pgsql_notify = PQnotifies(pgsql); if (!pgsql_notify) { /* no notify message */ RETURN_FALSE; } array_init(return_value); if (result_type & PGSQL_NUM) { add_index_string(return_value, 0, pgsql_notify->relname, 1); add_index_long(return_value, 1, pgsql_notify->be_pid); #if HAVE_PQPROTOCOLVERSION && HAVE_PQPARAMETERSTATUS if (PQprotocolVersion(pgsql) >= 3 && atof(PQparameterStatus(pgsql, ""server_version"")) >= 9.0) { #else if (atof(PG_VERSION) >= 9.0) { #endif #if HAVE_PQPARAMETERSTATUS add_index_string(return_value, 2, pgsql_notify->extra, 1); #endif } } if (result_type & PGSQL_ASSOC) { add_assoc_string(return_value, ""message"", pgsql_notify->relname, 1); add_assoc_long(return_value, ""pid"", pgsql_notify->be_pid); #if HAVE_PQPROTOCOLVERSION && HAVE_PQPARAMETERSTATUS if (PQprotocolVersion(pgsql) >= 3 && atof(PQparameterStatus(pgsql, ""server_version"")) >= 9.0) { #else if (atof(PG_VERSION) >= 9.0) { #endif #if HAVE_PQPARAMETERSTATUS add_assoc_string(return_value, ""payload"", pgsql_notify->extra, 1); #endif } } PQfreemem(pgsql_notify); } /* }}} */ /* {{{ proto int pg_get_pid([resource connection) Get backend(server) pid */ PHP_FUNCTION(pg_get_pid) { zval *pgsql_link; int id = -1; PGconn *pgsql; if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, ""r"", &pgsql_link) == FAILURE) { RETURN_FALSE; } ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, ""PostgreSQL link"", le_link, le_plink); RETURN_LONG(PQbackendPID(pgsql)); } /* }}} */ /* {{{ php_pgsql_meta_data * TODO: Add meta_data cache for better performance */ PHP_PGSQL_API int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, zval *meta TSRMLS_DC) { PGresult *pg_result; char *src, *tmp_name, *tmp_name2 = NULL; char *escaped; smart_str querystr = {0}; size_t new_len; int i, num_rows; zval *elem; if (!*table_name) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""The table name must be specified""); return FAILURE; } src = estrdup(table_name); tmp_name = php_strtok_r(src, ""."", &tmp_name2); if (!tmp_name2 || !*tmp_name2) { /* Default schema */ tmp_name2 = tmp_name; ""SELECT a.attname, a.attnum, t.typname, a.attlen, a.attnotnull, a.atthasdef, a.attndims, t.typtype = 'e' "" ""FROM pg_class as c, pg_attribute a, pg_type t, pg_namespace n "" ""WHERE a.attnum > 0 AND a.attrelid = c.oid AND c.relname = '""); escaped = (char *)safe_emalloc(strlen(tmp_name2), 2, 1); new_len = PQescapeStringConn(pg_link, escaped, tmp_name2, strlen(tmp_name2), NULL); if (new_len) { smart_str_appendl(&querystr, escaped, new_len); } efree(escaped); smart_str_appends(&querystr, ""' AND c.relnamespace = n.oid AND n.nspname = '""); escaped = (char *)safe_emalloc(strlen(tmp_name), 2, 1); new_len = PQescapeStringConn(pg_link, escaped, tmp_name, strlen(tmp_name), NULL); if (new_len) { smart_str_appendl(&querystr, escaped, new_len); } efree(escaped); smart_str_appends(&querystr, ""' AND a.atttypid = t.oid ORDER BY a.attnum;""); smart_str_0(&querystr); efree(src); pg_result = PQexec(pg_link, querystr.c); if (PQresultStatus(pg_result) != PGRES_TUPLES_OK || (num_rows = PQntuples(pg_result)) == 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Table '%s' doesn't exists"", table_name); smart_str_free(&querystr); PQclear(pg_result); return FAILURE; } smart_str_free(&querystr); for (i = 0; i < num_rows; i++) { char *name; MAKE_STD_ZVAL(elem); array_init(elem); add_assoc_long(elem, ""num"", atoi(PQgetvalue(pg_result,i,1))); add_assoc_string(elem, ""type"", PQgetvalue(pg_result,i,2), 1); add_assoc_long(elem, ""len"", atoi(PQgetvalue(pg_result,i,3))); if (!strcmp(PQgetvalue(pg_result,i,4), ""t"")) { add_assoc_bool(elem, ""not null"", 1); } else { add_assoc_bool(elem, ""not null"", 0); } if (!strcmp(PQgetvalue(pg_result,i,5), ""t"")) { add_assoc_bool(elem, ""has default"", 1); } else { add_assoc_bool(elem, ""has default"", 0); } add_assoc_long(elem, ""array dims"", atoi(PQgetvalue(pg_result,i,6))); if (!strcmp(PQgetvalue(pg_result,i,7), ""t"")) { add_assoc_bool(elem, ""is enum"", 1); } else { add_assoc_bool(elem, ""is enum"", 0); } name = PQgetvalue(pg_result,i,0); add_assoc_zval(meta, name, elem); } PQclear(pg_result); return SUCCESS; } /* }}} */ ",1 "ProfilingService::~ProfilingService() {} ",0 "_dbus_flush_caches (void) { } ",0 "void in_dev_finish_destroy(struct in_device *idev) { struct net_device *dev = idev->dev; WARN_ON(idev->ifa_list); WARN_ON(idev->mc_list); kfree(rcu_dereference_protected(idev->mc_hash, 1)); #ifdef NET_REFCNT_DEBUG pr_debug(""%s: %p=%s\n"", __func__, idev, dev ? dev->name : ""NIL""); #endif dev_put(dev); if (!idev->dead) pr_err(""Freeing alive in_device %p\n"", idev); else kfree(idev); } ",0 "void IndexedDBDispatcher::RequestIDBCursorPrefetchReset( int used_prefetches, int unused_prefetches, int32 idb_cursor_id) { Send(new IndexedDBHostMsg_CursorPrefetchReset(idb_cursor_id, used_prefetches, unused_prefetches)); } ",0 "static void fast_bgr_to_cmyk(fz_context *ctx, fz_pixmap *dst, fz_pixmap *src, fz_colorspace *prf, const fz_default_colorspaces *default_cs, const fz_color_params *color_params, int copy_spots) { unsigned char *s = src->samples; unsigned char *d = dst->samples; size_t w = src->w; int h = src->h; int sn = src->n; int ss = src->s; int sa = src->alpha; int dn = dst->n; int ds = dst->s; int da = dst->alpha; ptrdiff_t d_line_inc = dst->stride - w * dn; ptrdiff_t s_line_inc = src->stride - w * sn; /* Spots must match, and we can never drop alpha (but we can invent it) */ if ((copy_spots && ss != ds) || (!da && sa)) { assert(""This should never happen"" == NULL); fz_throw(ctx, FZ_ERROR_GENERIC, ""Cannot convert between incompatible pixmaps""); } if ((int)w < 0 || h < 0) return; if (d_line_inc == 0 && s_line_inc == 0) { w *= h; h = 1; } if (ss == 0 && ds == 0) { /* Common, no spots case */ if (da) { if (sa) { while (h--) { size_t ww = w; while (ww--) { unsigned char c = s[2]; unsigned char m = s[1]; unsigned char y = s[0]; unsigned char k = (unsigned char)fz_mini(c, fz_mini(m, y)); d[0] = c - k; d[1] = m - k; d[2] = y - k; d[3] = k; d[4] = s[3]; s += 4; d += 5; } d += d_line_inc; s += s_line_inc; } } else { while (h--) { size_t ww = w; while (ww--) { unsigned char c = s[2]; unsigned char m = s[1]; unsigned char y = s[0]; unsigned char k = (unsigned char)fz_mini(c, fz_mini(m, y)); d[0] = c - k; d[1] = m - k; d[2] = y - k; d[3] = k; d[4] = 255; s += 3; d += 5; } d += d_line_inc; s += s_line_inc; } } } else { while (h--) { size_t ww = w; while (ww--) { unsigned char c = s[2]; unsigned char m = s[1]; unsigned char y = s[0]; unsigned char k = (unsigned char)fz_mini(c, fz_mini(m, y)); d[0] = c - k; d[1] = m - k; d[2] = y - k; d[3] = k; s += 3; d += 4; } d += d_line_inc; s += s_line_inc; } } } else if (copy_spots) { /* Slower, spots capable version */ while (h--) { int i; size_t ww = w; while (ww--) { unsigned char c = s[2]; unsigned char m = s[1]; unsigned char y = s[0]; unsigned char k = (unsigned char)fz_mini(c, fz_mini(m, y)); d[0] = c - k; d[1] = m - k; d[2] = y - k; d[3] = k; s += 3; d += 4; for (i=ss; i > 0; i--) *d++ = *s++; if (da) *d++ = sa ? *s++ : 255; } d += d_line_inc; s += s_line_inc; } } else { while (h--) { size_t ww = w; while (ww--) { unsigned char c = s[2]; unsigned char m = s[1]; unsigned char y = s[0]; unsigned char k = (unsigned char)(255 - fz_maxi(c, fz_maxi(m, y))); d[0] = c + k; d[1] = m + k; d[2] = y + k; d[3] = 255 - k; s += sn; d += dn; if (da) d[-1] = sa ? s[-1] : 255; } d += d_line_inc; s += s_line_inc; } } } ",0 " int PreProcessingFx_ProcessReverse(effect_handle_t self, audio_buffer_t *inBuffer, audio_buffer_t *outBuffer) { preproc_effect_t * effect = (preproc_effect_t *)self; int status = 0; if (effect == NULL){ ALOGW(""PreProcessingFx_ProcessReverse() ERROR effect == NULL""); return -EINVAL; } preproc_session_t * session = (preproc_session_t *)effect->session; if (inBuffer == NULL || inBuffer->raw == NULL){ ALOGW(""PreProcessingFx_ProcessReverse() ERROR bad pointer""); return -EINVAL; } session->revProcessedMsk |= (1<procId); if ((session->revProcessedMsk & session->revEnabledMsk) == session->revEnabledMsk) { effect->session->revProcessedMsk = 0; if (session->revResampler != NULL) { size_t fr = session->frameCount - session->framesRev; if (inBuffer->frameCount < fr) { fr = inBuffer->frameCount; } if (session->revBufSize < session->framesRev + fr) { session->revBufSize = session->framesRev + fr; session->revBuf = (int16_t *)realloc(session->revBuf, session->revBufSize * session->inChannelCount * sizeof(int16_t)); } memcpy(session->revBuf + session->framesRev * session->inChannelCount, inBuffer->s16, fr * session->inChannelCount * sizeof(int16_t)); session->framesRev += fr; inBuffer->frameCount = fr; if (session->framesRev < session->frameCount) { return 0; } spx_uint32_t frIn = session->framesRev; spx_uint32_t frOut = session->apmFrameCount; if (session->inChannelCount == 1) { speex_resampler_process_int(session->revResampler, 0, session->revBuf, &frIn, session->revFrame->_payloadData, &frOut); } else { speex_resampler_process_interleaved_int(session->revResampler, session->revBuf, &frIn, session->revFrame->_payloadData, &frOut); } memcpy(session->revBuf, session->revBuf + frIn * session->inChannelCount, (session->framesRev - frIn) * session->inChannelCount * sizeof(int16_t)); session->framesRev -= frIn; } else { size_t fr = session->frameCount - session->framesRev; if (inBuffer->frameCount < fr) { fr = inBuffer->frameCount; } memcpy(session->revFrame->_payloadData + session->framesRev * session->inChannelCount, inBuffer->s16, fr * session->inChannelCount * sizeof(int16_t)); session->framesRev += fr; inBuffer->frameCount = fr; if (session->framesRev < session->frameCount) { return 0; } session->framesRev = 0; } session->revFrame->_payloadDataLengthInSamples = session->apmFrameCount * session->inChannelCount; effect->session->apm->AnalyzeReverseStream(session->revFrame); return 0; } else { return -ENODATA; } } ",1 "aura::Window::Windows WindowTreeHostManager::GetAllRootWindows() { aura::Window::Windows windows; for (WindowTreeHostMap::const_iterator it = window_tree_hosts_.begin(); it != window_tree_hosts_.end(); ++it) { DCHECK(it->second); if (GetRootWindowController(GetWindow(it->second))) windows.push_back(GetWindow(it->second)); } return windows; } ",0 "MYSQLND ** mysqlnd_stream_array_check_for_readiness(MYSQLND ** conn_array TSRMLS_DC) { int cnt = 0; MYSQLND **p = conn_array, **p_p; MYSQLND **ret = NULL; while (*p) { if (CONN_GET_STATE((*p)->data) <= CONN_READY || CONN_GET_STATE((*p)->data) == CONN_QUIT_SENT) { cnt++; } p++; } if (cnt) { MYSQLND **ret_p = ret = ecalloc(cnt + 1, sizeof(MYSQLND *)); p_p = p = conn_array; while (*p) { if (CONN_GET_STATE((*p)->data) <= CONN_READY || CONN_GET_STATE((*p)->data) == CONN_QUIT_SENT) { *ret_p = *p; *p = NULL; ret_p++; } else { *p_p = *p; p_p++; } p++; } *ret_p = NULL; } return ret; } ",0 "static int mov_read_header(AVFormatContext *s) { MOVContext *mov = s->priv_data; AVIOContext *pb = s->pb; int err; MOVAtom atom = { AV_RL32(""root"") }; mov->fc = s; /* .mov and .mp4 aren't streamable anyway (only progressive download if moov is before mdat) */ if (pb->seekable) atom.size = avio_size(pb); else atom.size = INT64_MAX; /* check MOV header */ if ((err = mov_read_default(mov, pb, atom)) < 0) { av_log(s, AV_LOG_ERROR, ""error reading header: %d\n"", err); mov_read_close(s); return err; } if (!mov->found_moov) { av_log(s, AV_LOG_ERROR, ""moov atom not found\n""); mov_read_close(s); return AVERROR_INVALIDDATA; } av_dlog(mov->fc, ""on_parse_exit_offset=%""PRId64""\n"", avio_tell(pb)); if (pb->seekable) { int i; if (mov->chapter_track > 0) mov_read_chapters(s); for (i = 0; i < s->nb_streams; i++) if (s->streams[i]->codec->codec_tag == AV_RL32(""tmcd"")) mov_read_timecode_track(s, s->streams[i]); } if (mov->trex_data) { int i; for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; MOVStreamContext *sc = st->priv_data; if (st->duration) st->codec->bit_rate = sc->data_size * 8 * sc->time_scale / st->duration; } } return 0; } ",0 "void AuthenticatorClientPinEntrySheetModel::SetDelegate(Delegate* delegate) { DCHECK(!delegate_); delegate_ = delegate; } ",0 "void RenderFrameHostImpl::DidNavigate( const FrameHostMsg_DidCommitProvisionalLoad_Params& params, bool is_same_document_navigation) { frame_tree_node_->SetCurrentURL(params.url); SetLastCommittedOrigin(params.origin); if (!params.url_is_unreachable) last_successful_url_ = params.url; if (!is_same_document_navigation) { ResetFeaturePolicy(); active_sandbox_flags_ = frame_tree_node()->active_sandbox_flags(); } } ",0 " hash_init( hashtable* ht, FT_Memory memory ) { int sz = INITIAL_HT_SIZE; FT_Error error = BDF_Err_Ok; ht->size = sz; ht->limit = sz / 3; ht->used = 0; if ( FT_NEW_ARRAY( ht->table, sz ) ) goto Exit; Exit: return error; } ",0 "util_get_pin(const char *input, const char **pin) { size_t inputlen = strlen(input); size_t pinlen = 0; if(inputlen > 4 && strncasecmp(input, ""env:"", 4) == 0) { *pin = getenv(input + 4); pinlen = *pin ? strlen(*pin) : 0; } else { *pin = input; pinlen = inputlen; } return pinlen; } ",0 "check_v8086_mode(struct pt_regs *regs, unsigned long address, struct task_struct *tsk) { unsigned long bit; if (!v8086_mode(regs)) return; bit = (address - 0xA0000) >> PAGE_SHIFT; if (bit < 32) tsk->thread.screen_bitmap |= 1 << bit; } ",0 "static int cma_use_port(struct idr *ps, struct rdma_id_private *id_priv) { struct rdma_bind_list *bind_list; unsigned short snum; int ret; snum = ntohs(cma_port(cma_src_addr(id_priv))); if (snum < PROT_SOCK && !capable(CAP_NET_BIND_SERVICE)) return -EACCES; bind_list = idr_find(ps, snum); if (!bind_list) { ret = cma_alloc_port(ps, id_priv, snum); } else { ret = cma_check_port(bind_list, id_priv, id_priv->reuseaddr); if (!ret) cma_bind_port(bind_list, id_priv); } return ret; } ",0 "getStringBuffer(int length) { int i; for (i = 0; i < stringBufferPool->size; i++) { if (!stringBufferPool->inUse[i]) { stringBufferPool->buffers[i] = stringBufferPool->alloc(i, length); stringBufferPool->inUse[i] = 1; return i; } } _lou_outOfMemory(); return -1; } ",0 " void setNegativeMargin(LayoutUnit n) { ASSERT(!m_discardMargin); m_negativeMargin = n; } ",0 "xfs_attr_leaf_entsize(xfs_attr_leafblock_t *leaf, int index) { struct xfs_attr_leaf_entry *entries; xfs_attr_leaf_name_local_t *name_loc; xfs_attr_leaf_name_remote_t *name_rmt; int size; entries = xfs_attr3_leaf_entryp(leaf); if (entries[index].flags & XFS_ATTR_LOCAL) { name_loc = xfs_attr3_leaf_name_local(leaf, index); size = xfs_attr_leaf_entsize_local(name_loc->namelen, be16_to_cpu(name_loc->valuelen)); } else { name_rmt = xfs_attr3_leaf_name_remote(leaf, index); size = xfs_attr_leaf_entsize_remote(name_rmt->namelen); } return size; } ",0 "static int _pmcraid_io_done(struct pmcraid_cmd *cmd, int reslen, int ioasc) { struct scsi_cmnd *scsi_cmd = cmd->scsi_cmd; int rc = 0; scsi_set_resid(scsi_cmd, reslen); pmcraid_info(""response(%d) CDB[0] = %x ioasc:result: %x:%x\n"", le32_to_cpu(cmd->ioa_cb->ioarcb.response_handle) >> 2, cmd->ioa_cb->ioarcb.cdb[0], ioasc, scsi_cmd->result); if (PMCRAID_IOASC_SENSE_KEY(ioasc) != 0) rc = pmcraid_error_handler(cmd); if (rc == 0) { scsi_dma_unmap(scsi_cmd); scsi_cmd->scsi_done(scsi_cmd); } return rc; } ",0 "void DumpWithoutCrashing() { if (g_is_browser) { CRASHPAD_SIMULATE_CRASH(); } else { siginfo_t siginfo; siginfo.si_signo = crashpad::Signals::kSimulatedSigno; siginfo.si_errno = 0; siginfo.si_code = 0; ucontext_t context; crashpad::CaptureContext(&context); crashpad::SandboxedHandler::Get()->HandleCrashNonFatal(siginfo.si_signo, &siginfo, &context); } } ",0 "static int lua_ap_unescape(lua_State *L) { const char *escaped; char *plain; size_t x, y; request_rec *r; r = ap_lua_check_request_rec(L, 1); luaL_checktype(L, 2, LUA_TSTRING); escaped = lua_tolstring(L, 2, &x); plain = apr_pstrdup(r->pool, escaped); y = ap_unescape_urlencoded(plain); if (!y) { lua_pushstring(L, plain); return 1; } return 0; } ",0 "void DesktopWindowTreeHostX11::SetSize(const gfx::Size& requested_size) { gfx::Size size_in_pixels = ToPixelRect(gfx::Rect(requested_size)).size(); size_in_pixels = AdjustSize(size_in_pixels); bool size_changed = bounds_in_pixels_.size() != size_in_pixels; XResizeWindow(xdisplay_, xwindow_, size_in_pixels.width(), size_in_pixels.height()); bounds_in_pixels_.set_size(size_in_pixels); if (size_changed) { OnHostResizedInPixels(size_in_pixels); ResetWindowRegion(); } } ",0 "int TextTrack::TrackIndexRelativeToRenderedTracks() { DCHECK(track_list_); if (rendered_track_index_ == kInvalidTrackIndex) rendered_track_index_ = track_list_->GetTrackIndexRelativeToRenderedTracks(this); return rendered_track_index_; } ",0 "void RenderViewHostImpl::ClosePage() { is_waiting_for_unload_ack_ = true; StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); if (IsRenderViewLive()) { increment_in_flight_event_count(); NotificationService::current()->Notify( NOTIFICATION_RENDER_VIEW_HOST_WILL_CLOSE_RENDER_VIEW, Source(this), NotificationService::NoDetails()); Send(new ViewMsg_ClosePage(GetRoutingID())); } else { ClosePageIgnoringUnloadEvents(); } } ",0 "get_info_state_free (GetInfoState *state) { g_object_unref (state->cancellable); g_free (state); } ",0 " void DidDeleteOriginData(QuotaStatusCode status) { DCHECK_GT(remaining_clients_, 0); if (status != kQuotaStatusOk) ++error_count_; if (--remaining_clients_ == 0) CallCompleted(); } ",0 "nfsd4_layoutcommit(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_layoutcommit *lcp) { const struct nfsd4_layout_seg *seg = &lcp->lc_seg; struct svc_fh *current_fh = &cstate->current_fh; const struct nfsd4_layout_ops *ops; loff_t new_size = lcp->lc_last_wr + 1; struct inode *inode; struct nfs4_layout_stateid *ls; __be32 nfserr; nfserr = fh_verify(rqstp, current_fh, 0, NFSD_MAY_WRITE); if (nfserr) goto out; nfserr = nfserr_layoutunavailable; ops = nfsd4_layout_verify(current_fh->fh_export, lcp->lc_layout_type); if (!ops) goto out; inode = d_inode(current_fh->fh_dentry); nfserr = nfserr_inval; if (new_size <= seg->offset) { dprintk(""pnfsd: last write before layout segment\n""); goto out; } if (new_size > seg->offset + seg->length) { dprintk(""pnfsd: last write beyond layout segment\n""); goto out; } if (!lcp->lc_newoffset && new_size > i_size_read(inode)) { dprintk(""pnfsd: layoutcommit beyond EOF\n""); goto out; } nfserr = nfsd4_preprocess_layout_stateid(rqstp, cstate, &lcp->lc_sid, false, lcp->lc_layout_type, &ls); if (nfserr) { trace_layout_commit_lookup_fail(&lcp->lc_sid); /* fixup error code as per RFC5661 */ if (nfserr == nfserr_bad_stateid) nfserr = nfserr_badlayout; goto out; } /* LAYOUTCOMMIT does not require any serialization */ mutex_unlock(&ls->ls_mutex); if (new_size > i_size_read(inode)) { lcp->lc_size_chg = 1; lcp->lc_newsize = new_size; } else { lcp->lc_size_chg = 0; } nfserr = ops->proc_layoutcommit(inode, lcp); nfs4_put_stid(&ls->ls_stid); out: return nfserr; } ",0 " BufferManager::BufferInfo* GetBufferInfo(GLuint client_id) { BufferManager::BufferInfo* info = buffer_manager()->GetBufferInfo(client_id); return (info && !info->IsDeleted()) ? info : NULL; } ",0 "ModuleSystem::~ModuleSystem() { } ",0 "void RenderFrameImpl::didFailLoad(blink::WebLocalFrame* frame, const blink::WebURLError& error, blink::WebHistoryCommitType commit_type) { TRACE_EVENT1(""navigation"", ""RenderFrameImpl::didFailLoad"", ""id"", routing_id_); DCHECK(!frame_ || frame_ == frame); WebDataSource* ds = frame->dataSource(); DCHECK(ds); FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), DidFailLoad(frame, error)); const WebURLRequest& failed_request = ds->request(); base::string16 error_description; GetContentClient()->renderer()->GetNavigationErrorStrings( render_view_.get(), frame, failed_request, error, NULL, &error_description); Send(new FrameHostMsg_DidFailLoadWithError(routing_id_, failed_request.url(), error.reason, error_description, error.wasIgnoredByHandler)); } ",0 "static void btm_send_link_key_notif (tBTM_SEC_DEV_REC *p_dev_rec) { if (btm_cb.api.p_link_key_callback) (*btm_cb.api.p_link_key_callback) (p_dev_rec->bd_addr, p_dev_rec->dev_class, p_dev_rec->sec_bd_name, p_dev_rec->link_key, p_dev_rec->link_key_type); } ",0 "search_make_new(const struct search_state *const state, int n, const char *const base_name) { const size_t base_len = strlen(base_name); const char need_to_append_dot = base_name[base_len - 1] == '.' ? 0 : 1; struct search_domain *dom; for (dom = state->head; dom; dom = dom->next) { if (!n--) { /* this is the postfix we want */ /* the actual postfix string is kept at the end of the structure */ const u8 *const postfix = ((u8 *) dom) + sizeof(struct search_domain); const int postfix_len = dom->len; char *const newname = (char *) mm_malloc(base_len + need_to_append_dot + postfix_len + 1); if (!newname) return NULL; memcpy(newname, base_name, base_len); if (need_to_append_dot) newname[base_len] = '.'; memcpy(newname + base_len + need_to_append_dot, postfix, postfix_len); newname[base_len + need_to_append_dot + postfix_len] = 0; return newname; } } /* we ran off the end of the list and still didn't find the requested string */ EVUTIL_ASSERT(0); return NULL; /* unreachable; stops warnings in some compilers. */ } ",0 "static int get_audio_frame_duration(enum AVCodecID id, int sr, int ch, int ba, uint32_t tag, int bits_per_coded_sample, int64_t bitrate, uint8_t * extradata, int frame_size, int frame_bytes) { int bps = av_get_exact_bits_per_sample(id); int framecount = (ba > 0 && frame_bytes / ba > 0) ? frame_bytes / ba : 1; /* codecs with an exact constant bits per sample */ if (bps > 0 && ch > 0 && frame_bytes > 0 && ch < 32768 && bps < 32768) return (frame_bytes * 8LL) / (bps * ch); bps = bits_per_coded_sample; /* codecs with a fixed packet duration */ switch (id) { case AV_CODEC_ID_ADPCM_ADX: return 32; case AV_CODEC_ID_ADPCM_IMA_QT: return 64; case AV_CODEC_ID_ADPCM_EA_XAS: return 128; case AV_CODEC_ID_AMR_NB: case AV_CODEC_ID_EVRC: case AV_CODEC_ID_GSM: case AV_CODEC_ID_QCELP: case AV_CODEC_ID_RA_288: return 160; case AV_CODEC_ID_AMR_WB: case AV_CODEC_ID_GSM_MS: return 320; case AV_CODEC_ID_MP1: return 384; case AV_CODEC_ID_ATRAC1: return 512; case AV_CODEC_ID_ATRAC3: return 1024 * framecount; case AV_CODEC_ID_ATRAC3P: return 2048; case AV_CODEC_ID_MP2: case AV_CODEC_ID_MUSEPACK7: return 1152; case AV_CODEC_ID_AC3: return 1536; } if (sr > 0) { /* calc from sample rate */ if (id == AV_CODEC_ID_TTA) return 256 * sr / 245; else if (id == AV_CODEC_ID_DST) return 588 * sr / 44100; if (ch > 0) { /* calc from sample rate and channels */ if (id == AV_CODEC_ID_BINKAUDIO_DCT) return (480 << (sr / 22050)) / ch; } } if (ba > 0) { /* calc from block_align */ if (id == AV_CODEC_ID_SIPR) { switch (ba) { case 20: return 160; case 19: return 144; case 29: return 288; case 37: return 480; } } else if (id == AV_CODEC_ID_ILBC) { switch (ba) { case 38: return 160; case 50: return 240; } } } if (frame_bytes > 0) { /* calc from frame_bytes only */ if (id == AV_CODEC_ID_TRUESPEECH) return 240 * (frame_bytes / 32); if (id == AV_CODEC_ID_NELLYMOSER) return 256 * (frame_bytes / 64); if (id == AV_CODEC_ID_RA_144) return 160 * (frame_bytes / 20); if (id == AV_CODEC_ID_G723_1) return 240 * (frame_bytes / 24); if (bps > 0) { /* calc from frame_bytes and bits_per_coded_sample */ if (id == AV_CODEC_ID_ADPCM_G726) return frame_bytes * 8 / bps; } if (ch > 0 && ch < INT_MAX/16) { /* calc from frame_bytes and channels */ switch (id) { case AV_CODEC_ID_ADPCM_AFC: return frame_bytes / (9 * ch) * 16; case AV_CODEC_ID_ADPCM_PSX: case AV_CODEC_ID_ADPCM_DTK: return frame_bytes / (16 * ch) * 28; case AV_CODEC_ID_ADPCM_4XM: case AV_CODEC_ID_ADPCM_IMA_DAT4: case AV_CODEC_ID_ADPCM_IMA_ISS: return (frame_bytes - 4 * ch) * 2 / ch; case AV_CODEC_ID_ADPCM_IMA_SMJPEG: return (frame_bytes - 4) * 2 / ch; case AV_CODEC_ID_ADPCM_IMA_AMV: return (frame_bytes - 8) * 2 / ch; case AV_CODEC_ID_ADPCM_THP: case AV_CODEC_ID_ADPCM_THP_LE: if (extradata) return frame_bytes * 14 / (8 * ch); break; case AV_CODEC_ID_ADPCM_XA: return (frame_bytes / 128) * 224 / ch; case AV_CODEC_ID_INTERPLAY_DPCM: return (frame_bytes - 6 - ch) / ch; case AV_CODEC_ID_ROQ_DPCM: return (frame_bytes - 8) / ch; case AV_CODEC_ID_XAN_DPCM: return (frame_bytes - 2 * ch) / ch; case AV_CODEC_ID_MACE3: return 3 * frame_bytes / ch; case AV_CODEC_ID_MACE6: return 6 * frame_bytes / ch; case AV_CODEC_ID_PCM_LXF: return 2 * (frame_bytes / (5 * ch)); case AV_CODEC_ID_IAC: case AV_CODEC_ID_IMC: return 4 * frame_bytes / ch; } if (tag) { /* calc from frame_bytes, channels, and codec_tag */ if (id == AV_CODEC_ID_SOL_DPCM) { if (tag == 3) return frame_bytes / ch; else return frame_bytes * 2 / ch; } } if (ba > 0) { /* calc from frame_bytes, channels, and block_align */ int blocks = frame_bytes / ba; switch (id) { case AV_CODEC_ID_ADPCM_IMA_WAV: if (bps < 2 || bps > 5) return 0; return blocks * (1 + (ba - 4 * ch) / (bps * ch) * 8); case AV_CODEC_ID_ADPCM_IMA_DK3: return blocks * (((ba - 16) * 2 / 3 * 4) / ch); case AV_CODEC_ID_ADPCM_IMA_DK4: return blocks * (1 + (ba - 4 * ch) * 2 / ch); case AV_CODEC_ID_ADPCM_IMA_RAD: return blocks * ((ba - 4 * ch) * 2 / ch); case AV_CODEC_ID_ADPCM_MS: return blocks * (2 + (ba - 7 * ch) * 2 / ch); case AV_CODEC_ID_ADPCM_MTAF: return blocks * (ba - 16) * 2 / ch; } } if (bps > 0) { /* calc from frame_bytes, channels, and bits_per_coded_sample */ switch (id) { case AV_CODEC_ID_PCM_DVD: if(bps<4) return 0; return 2 * (frame_bytes / ((bps * 2 / 8) * ch)); case AV_CODEC_ID_PCM_BLURAY: if(bps<4) return 0; return frame_bytes / ((FFALIGN(ch, 2) * bps) / 8); case AV_CODEC_ID_S302M: return 2 * (frame_bytes / ((bps + 4) / 4)) / ch; } } } } /* Fall back on using frame_size */ if (frame_size > 1 && frame_bytes) return frame_size; if (bitrate > 0 && frame_bytes > 0 && sr > 0 && ba > 1) { if (id == AV_CODEC_ID_WMAV1 || id == AV_CODEC_ID_WMAV2) return (frame_bytes * 8LL * sr) / bitrate; } return 0; } ",0 " void VarianceTest::RefTest() { for (int i = 0; i < 10; ++i) { for (int j = 0; j < block_size_; j++) { src_[j] = rnd.Rand8(); ref_[j] = rnd.Rand8(); } unsigned int sse1, sse2; unsigned int var1; REGISTER_STATE_CHECK(var1 = variance_(src_, width_, ref_, width_, &sse1)); const unsigned int var2 = variance_ref(src_, ref_, log2width_, log2height_, &sse2); EXPECT_EQ(sse1, sse2); EXPECT_EQ(var1, var2); } } ",1 "static struct CommandControlBlock *arcmsr_get_freeccb(struct AdapterControlBlock *acb) { struct list_head *head = &acb->ccb_free_list; struct CommandControlBlock *ccb = NULL; unsigned long flags; spin_lock_irqsave(&acb->ccblist_lock, flags); if (!list_empty(head)) { ccb = list_entry(head->next, struct CommandControlBlock, list); list_del_init(&ccb->list); }else{ spin_unlock_irqrestore(&acb->ccblist_lock, flags); return NULL; } spin_unlock_irqrestore(&acb->ccblist_lock, flags); return ccb; } ",0 "map_engine_get_talk_distance(void) { return s_talk_distance; } ",0 "static HashTable* spl_dllist_object_get_debug_info(zval *obj, int *is_temp) /* {{{{ */ { spl_dllist_object *intern = Z_SPLDLLIST_P(obj); spl_ptr_llist_element *current = intern->llist->head, *next; zval tmp, dllist_array; zend_string *pnstr; int i = 0; HashTable *debug_info; *is_temp = 1; if (!intern->std.properties) { rebuild_object_properties(&intern->std); } ALLOC_HASHTABLE(debug_info); zend_hash_init(debug_info, 1, NULL, ZVAL_PTR_DTOR, 0); zend_hash_copy(debug_info, intern->std.properties, (copy_ctor_func_t) zval_add_ref); pnstr = spl_gen_private_prop_name(spl_ce_SplDoublyLinkedList, ""flags"", sizeof(""flags"")-1); ZVAL_LONG(&tmp, intern->flags); zend_hash_add(debug_info, pnstr, &tmp); zend_string_release(pnstr); array_init(&dllist_array); while (current) { next = current->next; add_index_zval(&dllist_array, i, ¤t->data); if (Z_REFCOUNTED(current->data)) { Z_ADDREF(current->data); } i++; current = next; } pnstr = spl_gen_private_prop_name(spl_ce_SplDoublyLinkedList, ""dllist"", sizeof(""dllist"")-1); zend_hash_add(debug_info, pnstr, &dllist_array); zend_string_release(pnstr); return debug_info; } /* }}}} */ ",0 "bool SVGElement::IsAnimatableAttribute(const QualifiedName& name) const { DEFINE_THREAD_SAFE_STATIC_LOCAL(HashSet, animatable_attributes, ({ svg_names::kAmplitudeAttr, svg_names::kAzimuthAttr, svg_names::kBaseFrequencyAttr, svg_names::kBiasAttr, svg_names::kClipPathUnitsAttr, svg_names::kCxAttr, svg_names::kCyAttr, svg_names::kDiffuseConstantAttr, svg_names::kDivisorAttr, svg_names::kDxAttr, svg_names::kDyAttr, svg_names::kEdgeModeAttr, svg_names::kElevationAttr, svg_names::kExponentAttr, svg_names::kFilterUnitsAttr, svg_names::kFxAttr, svg_names::kFyAttr, svg_names::kGradientTransformAttr, svg_names::kGradientUnitsAttr, svg_names::kHeightAttr, svg_names::kHrefAttr, svg_names::kIn2Attr, svg_names::kInAttr, svg_names::kInterceptAttr, svg_names::kK1Attr, svg_names::kK2Attr, svg_names::kK3Attr, svg_names::kK4Attr, svg_names::kKernelMatrixAttr, svg_names::kKernelUnitLengthAttr, svg_names::kLengthAdjustAttr, svg_names::kLimitingConeAngleAttr, svg_names::kMarkerHeightAttr, svg_names::kMarkerUnitsAttr, svg_names::kMarkerWidthAttr, svg_names::kMaskContentUnitsAttr, svg_names::kMaskUnitsAttr, svg_names::kMethodAttr, svg_names::kModeAttr, svg_names::kNumOctavesAttr, svg_names::kOffsetAttr, svg_names::kOperatorAttr, svg_names::kOrderAttr, svg_names::kOrientAttr, svg_names::kPathLengthAttr, svg_names::kPatternContentUnitsAttr, svg_names::kPatternTransformAttr, svg_names::kPatternUnitsAttr, svg_names::kPointsAtXAttr, svg_names::kPointsAtYAttr, svg_names::kPointsAtZAttr, svg_names::kPreserveAlphaAttr, svg_names::kPreserveAspectRatioAttr, svg_names::kPrimitiveUnitsAttr, svg_names::kRadiusAttr, svg_names::kRAttr, svg_names::kRefXAttr, svg_names::kRefYAttr, svg_names::kResultAttr, svg_names::kRotateAttr, svg_names::kRxAttr, svg_names::kRyAttr, svg_names::kScaleAttr, svg_names::kSeedAttr, svg_names::kSlopeAttr, svg_names::kSpacingAttr, svg_names::kSpecularConstantAttr, svg_names::kSpecularExponentAttr, svg_names::kSpreadMethodAttr, svg_names::kStartOffsetAttr, svg_names::kStdDeviationAttr, svg_names::kStitchTilesAttr, svg_names::kSurfaceScaleAttr, svg_names::kTableValuesAttr, svg_names::kTargetAttr, svg_names::kTargetXAttr, svg_names::kTargetYAttr, svg_names::kTransformAttr, svg_names::kTypeAttr, svg_names::kValuesAttr, svg_names::kViewBoxAttr, svg_names::kWidthAttr, svg_names::kX1Attr, svg_names::kX2Attr, svg_names::kXAttr, svg_names::kXChannelSelectorAttr, svg_names::kY1Attr, svg_names::kY2Attr, svg_names::kYAttr, svg_names::kYChannelSelectorAttr, svg_names::kZAttr, })); if (name == kClassAttr) return true; return animatable_attributes.Contains(name); } ",0 "ModuleExport void UnregisterCUTImage(void) { (void) UnregisterMagickInfo(""CUT""); } ",0 "CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item, char *buf, const int len, const cJSON_bool fmt) { printbuffer p = { 0, 0, 0, 0, 0, 0, { 0, 0, 0 } }; if ((len < 0) || (buf == NULL)) { return false; } p.buffer = (unsigned char*)buf; p.length = (size_t)len; p.offset = 0; p.noalloc = true; p.format = fmt; p.hooks = global_hooks; return print_value(item, &p); } ",0 "encode_entry(struct readdir_cd *ccd, const char *name, int namlen, loff_t offset, u64 ino, unsigned int d_type, int plus) { struct nfsd3_readdirres *cd = container_of(ccd, struct nfsd3_readdirres, common); __be32 *p = cd->buffer; caddr_t curr_page_addr = NULL; struct page ** page; int slen; /* string (name) length */ int elen; /* estimated entry length in words */ int num_entry_words = 0; /* actual number of words */ if (cd->offset) { u64 offset64 = offset; if (unlikely(cd->offset1)) { /* we ended up with offset on a page boundary */ *cd->offset = htonl(offset64 >> 32); *cd->offset1 = htonl(offset64 & 0xffffffff); cd->offset1 = NULL; } else { xdr_encode_hyper(cd->offset, offset64); } } /* dprintk(""encode_entry(%.*s @%ld%s)\n"", namlen, name, (long) offset, plus? "" plus"" : """"); */ /* truncate filename if too long */ namlen = min(namlen, NFS3_MAXNAMLEN); slen = XDR_QUADLEN(namlen); elen = slen + NFS3_ENTRY_BAGGAGE + (plus? NFS3_ENTRYPLUS_BAGGAGE : 0); if (cd->buflen < elen) { cd->common.err = nfserr_toosmall; return -EINVAL; } /* determine which page in rq_respages[] we are currently filling */ for (page = cd->rqstp->rq_respages + 1; page < cd->rqstp->rq_next_page; page++) { curr_page_addr = page_address(*page); if (((caddr_t)cd->buffer >= curr_page_addr) && ((caddr_t)cd->buffer < curr_page_addr + PAGE_SIZE)) break; } if ((caddr_t)(cd->buffer + elen) < (curr_page_addr + PAGE_SIZE)) { /* encode entry in current page */ p = encode_entry_baggage(cd, p, name, namlen, ino); if (plus) p = encode_entryplus_baggage(cd, p, name, namlen, ino); num_entry_words = p - cd->buffer; } else if (*(page+1) != NULL) { /* temporarily encode entry into next page, then move back to * current and next page in rq_respages[] */ __be32 *p1, *tmp; int len1, len2; /* grab next page for temporary storage of entry */ p1 = tmp = page_address(*(page+1)); p1 = encode_entry_baggage(cd, p1, name, namlen, ino); if (plus) p1 = encode_entryplus_baggage(cd, p1, name, namlen, ino); /* determine entry word length and lengths to go in pages */ num_entry_words = p1 - tmp; len1 = curr_page_addr + PAGE_SIZE - (caddr_t)cd->buffer; if ((num_entry_words << 2) < len1) { /* the actual number of words in the entry is less * than elen and can still fit in the current page */ memmove(p, tmp, num_entry_words << 2); p += num_entry_words; /* update offset */ cd->offset = cd->buffer + (cd->offset - tmp); } else { unsigned int offset_r = (cd->offset - tmp) << 2; /* update pointer to offset location. * This is a 64bit quantity, so we need to * deal with 3 cases: * - entirely in first page * - entirely in second page * - 4 bytes in each page */ if (offset_r + 8 <= len1) { cd->offset = p + (cd->offset - tmp); } else if (offset_r >= len1) { cd->offset -= len1 >> 2; } else { /* sitting on the fence */ BUG_ON(offset_r != len1 - 4); cd->offset = p + (cd->offset - tmp); cd->offset1 = tmp; } len2 = (num_entry_words << 2) - len1; /* move from temp page to current and next pages */ memmove(p, tmp, len1); memmove(tmp, (caddr_t)tmp+len1, len2); p = tmp + (len2 >> 2); } } else { cd->common.err = nfserr_toosmall; return -EINVAL; } cd->buflen -= num_entry_words; cd->buffer = p; cd->common.err = nfs_ok; return 0; } ",0 "void AutofillDialogViews::DetailsContainerView::Layout() { if (!ignore_layouts_) views::View::Layout(); } ",0 "SYSCALL_DEFINE3(ioctl, unsigned int, fd, unsigned int, cmd, unsigned long, arg) { int error; struct fd f = fdget(fd); if (!f.file) return -EBADF; error = security_file_ioctl(f.file, cmd, arg); if (!error) error = do_vfs_ioctl(f.file, fd, cmd, arg); fdput(f); return error; } ",0 "static int dns_finalize_config(void) { struct dns_resolvers *resolvers; struct proxy *px; int err_code = 0; /* allocate pool of resolution per resolvers */ list_for_each_entry(resolvers, &dns_resolvers, list) { struct dns_nameserver *ns; struct task *t; /* Check if we can create the socket with nameservers info */ list_for_each_entry(ns, &resolvers->nameservers, list) { struct dgram_conn *dgram = NULL; int fd; /* Check nameserver info */ if ((fd = socket(ns->addr.ss_family, SOCK_DGRAM, IPPROTO_UDP)) == -1) { ha_alert(""config : resolvers '%s': can't create socket for nameserver '%s'.\n"", resolvers->id, ns->id); err_code |= (ERR_ALERT|ERR_ABORT); continue; } if (connect(fd, (struct sockaddr*)&ns->addr, get_addr_len(&ns->addr)) == -1) { ha_alert(""config : resolvers '%s': can't connect socket for nameserver '%s'.\n"", resolvers->id, ns->id); close(fd); err_code |= (ERR_ALERT|ERR_ABORT); continue; } close(fd); /* Create dgram structure that will hold the UPD socket * and attach it on the current nameserver */ if ((dgram = calloc(1, sizeof(*dgram))) == NULL) { ha_alert(""config: resolvers '%s' : out of memory.\n"", resolvers->id); err_code |= (ERR_ALERT|ERR_ABORT); goto err; } /* Leave dgram partially initialized, no FD attached for * now. */ dgram->owner = ns; dgram->data = &resolve_dgram_cb; dgram->t.sock.fd = -1; ns->dgram = dgram; } /* Create the task associated to the resolvers section */ if ((t = task_new(MAX_THREADS_MASK)) == NULL) { ha_alert(""config : resolvers '%s' : out of memory.\n"", resolvers->id); err_code |= (ERR_ALERT|ERR_ABORT); goto err; } /* Update task's parameters */ t->process = dns_process_resolvers; t->context = resolvers; resolvers->t = t; task_wakeup(t, TASK_WOKEN_INIT); } for (px = proxies_list; px; px = px->next) { struct server *srv; for (srv = px->srv; srv; srv = srv->next) { struct dns_resolvers *resolvers; if (!srv->resolvers_id) continue; if ((resolvers = find_resolvers_by_id(srv->resolvers_id)) == NULL) { ha_alert(""config : %s '%s', server '%s': unable to find required resolvers '%s'\n"", proxy_type_str(px), px->id, srv->id, srv->resolvers_id); err_code |= (ERR_ALERT|ERR_ABORT); continue; } srv->resolvers = resolvers; if (srv->srvrq && !srv->srvrq->resolvers) { srv->srvrq->resolvers = srv->resolvers; if (dns_link_resolution(srv->srvrq, OBJ_TYPE_SRVRQ, 0) == -1) { ha_alert(""config : %s '%s' : unable to set DNS resolution for server '%s'.\n"", proxy_type_str(px), px->id, srv->id); err_code |= (ERR_ALERT|ERR_ABORT); continue; } } if (dns_link_resolution(srv, OBJ_TYPE_SERVER, 0) == -1) { ha_alert(""config : %s '%s', unable to set DNS resolution for server '%s'.\n"", proxy_type_str(px), px->id, srv->id); err_code |= (ERR_ALERT|ERR_ABORT); continue; } } } if (err_code & (ERR_ALERT|ERR_ABORT)) goto err; return err_code; err: dns_deinit(); return err_code; } ",0 "void RenderLayerCompositor::updateRootLayerAttachment() { ensureRootLayer(); } ",0 " bool PropertyAddedOrRemoved() const { return property_added_or_removed_; } ",0 "gio_poll_destroy(gpointer data) { /* adaptor->source is valid but about to be destroyed (ref_count == 0) in gmain.c * adaptor->channel will still have ref_count > 0... should be == 1 */ struct gio_to_qb_poll *adaptor = (struct gio_to_qb_poll *)data; crm_trace(""Destroying adaptor %p channel %p (ref=%d)"", adaptor, adaptor->channel, gio_adapter_refcount(adaptor)); adaptor->is_used = QB_FALSE; adaptor->channel = NULL; adaptor->source = 0; } ",0 "void Browser::RegisterPrefs(PrefService* prefs) { prefs->RegisterIntegerPref(prefs::kOptionsWindowLastTabIndex, 0); prefs->RegisterIntegerPref(prefs::kExtensionSidebarWidth, -1); prefs->RegisterIntegerPref(prefs::kMultipleProfilePrefMigration, 0); #if defined(GOOGLE_CHROME_BUILD) prefs->RegisterBooleanPref(prefs::kClearPluginLSODataEnabled, true); #else prefs->RegisterBooleanPref(prefs::kClearPluginLSODataEnabled, false); #endif } ",0 "asmlinkage int printk(const char *fmt, ...) { va_list args; int r; #ifdef CONFIG_KGDB_KDB if (unlikely(kdb_trap_printk)) { va_start(args, fmt); r = vkdb_printf(fmt, args); va_end(args); return r; } #endif va_start(args, fmt); r = vprintk(fmt, args); va_end(args); return r; } ",0 "int virtqueue_avail_bytes(VirtQueue *vq, unsigned int in_bytes, unsigned int out_bytes) { unsigned int in_total, out_total; virtqueue_get_avail_bytes(vq, &in_total, &out_total, in_bytes, out_bytes); return in_bytes <= in_total && out_bytes <= out_total; } ",0 "static int calc_send_wqe(struct ib_qp_init_attr *attr) { int inl_size = 0; int size; size = sq_overhead(attr); if (size < 0) return size; if (attr->cap.max_inline_data) { inl_size = size + sizeof(struct mlx5_wqe_inline_seg) + attr->cap.max_inline_data; } size += attr->cap.max_send_sge * sizeof(struct mlx5_wqe_data_seg); if (attr->create_flags & IB_QP_CREATE_SIGNATURE_EN && ALIGN(max_t(int, inl_size, size), MLX5_SEND_WQE_BB) < MLX5_SIG_WQE_SIZE) return MLX5_SIG_WQE_SIZE; else return ALIGN(max_t(int, inl_size, size), MLX5_SEND_WQE_BB); } ",0 "g_utf8_normalize (const gchar * str, gssize len, GNormalizeMode mode) { gunichar *result_wc = _g_utf8_normalize_wc (str, len, mode); gchar *result; result = g_ucs4_to_utf8 (result_wc, -1, NULL, NULL); g_free (result_wc); return result; } ",0 "static noinline int btrfs_ioctl_tree_search(struct file *file, void __user *argp) { struct btrfs_ioctl_search_args *args; struct inode *inode; int ret; if (!capable(CAP_SYS_ADMIN)) return -EPERM; args = memdup_user(argp, sizeof(*args)); if (IS_ERR(args)) return PTR_ERR(args); inode = fdentry(file)->d_inode; ret = search_ioctl(inode, args); if (ret == 0 && copy_to_user(argp, args, sizeof(*args))) ret = -EFAULT; kfree(args); return ret; } ",0 "void TestUnwindFunctions::VirtualUnwind(DWORD64 image_base, DWORD64 program_counter, PRUNTIME_FUNCTION runtime_function, CONTEXT* context) { EXPECT_EQ(next_image_base_ - kImageBaseIncrement, image_base); EXPECT_EQ(supplied_program_counter_, program_counter); EXPECT_EQ(kNonNullRuntimeFunctionPointer, runtime_function); } ",0 "void bdt_enable(void) { bdt_log(""ENABLE BT""); if (bt_enabled) { bdt_log(""Bluetooth is already enabled""); return; } status = sBtInterface->enable(); check_return_status(status); } ",1 "bool ChildProcessSecurityPolicyImpl::IsPseudoScheme( const std::string& scheme) { base::AutoLock lock(lock_); return base::ContainsKey(pseudo_schemes_, scheme); } ",0 "parse_NOTE(const char *arg, struct ofpbuf *ofpacts, enum ofputil_protocol *usable_protocols OVS_UNUSED) { size_t start_ofs = ofpacts->size; ofpact_put_NOTE(ofpacts); arg = ofpbuf_put_hex(ofpacts, arg, NULL); if (arg[0]) { return xstrdup(""bad hex digit in `note' argument""); } struct ofpact_note *note = ofpbuf_at_assert(ofpacts, start_ofs, sizeof *note); note->length = ofpacts->size - (start_ofs + sizeof *note); ofpact_finish_NOTE(ofpacts, ¬e); return NULL; } ",0 "void V8TestObject::UnrestrictedFloatAttributeAttributeSetterCallback( const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_unrestrictedFloatAttribute_Setter""); v8::Local v8_value = info[0]; test_object_v8_internal::UnrestrictedFloatAttributeAttributeSetter(v8_value, info); } ",0 "static void GatherSecurityPolicyViolationEventData( SecurityPolicyViolationEventInit* init, ExecutionContext* context, const String& directive_text, const ContentSecurityPolicy::DirectiveType& effective_type, const KURL& blocked_url, const String& header, RedirectStatus redirect_status, ContentSecurityPolicyHeaderType header_type, ContentSecurityPolicy::ViolationType violation_type, std::unique_ptr source_location, const String& script_source) { if (effective_type == ContentSecurityPolicy::DirectiveType::kFrameAncestors) { String stripped_url = StripURLForUseInReport( context, blocked_url, RedirectStatus::kNoRedirect, ContentSecurityPolicy::DirectiveType::kDefaultSrc); init->setDocumentURI(stripped_url); init->setBlockedURI(stripped_url); } else { String stripped_url = StripURLForUseInReport( context, context->Url(), RedirectStatus::kNoRedirect, ContentSecurityPolicy::DirectiveType::kDefaultSrc); init->setDocumentURI(stripped_url); switch (violation_type) { case ContentSecurityPolicy::kInlineViolation: init->setBlockedURI(""inline""); break; case ContentSecurityPolicy::kEvalViolation: init->setBlockedURI(""eval""); break; case ContentSecurityPolicy::kURLViolation: init->setBlockedURI(StripURLForUseInReport( context, blocked_url, redirect_status, effective_type)); break; } } String effective_directive = ContentSecurityPolicy::GetDirectiveName(effective_type); init->setViolatedDirective(effective_directive); init->setEffectiveDirective(effective_directive); init->setOriginalPolicy(header); init->setDisposition(header_type == kContentSecurityPolicyHeaderTypeEnforce ? ""enforce"" : ""report""); init->setStatusCode(0); if (auto* document = DynamicTo(*context)) { init->setReferrer(document->referrer()); if (!SecurityOrigin::IsSecure(context->Url()) && document->Loader()) init->setStatusCode(document->Loader()->GetResponse().HttpStatusCode()); } if (!source_location) source_location = SourceLocation::Capture(context); if (source_location->LineNumber()) { KURL source = KURL(source_location->Url()); init->setSourceFile(StripURLForUseInReport(context, source, redirect_status, effective_type)); init->setLineNumber(source_location->LineNumber()); init->setColumnNumber(source_location->ColumnNumber()); } else { init->setSourceFile(String()); init->setLineNumber(0); init->setColumnNumber(0); } if (!script_source.IsEmpty()) { init->setSample(script_source.StripWhiteSpace().Left( ContentSecurityPolicy::kMaxSampleLength)); } } ",0 "void ax25_fillin_cb(ax25_cb *ax25, ax25_dev *ax25_dev) { ax25->ax25_dev = ax25_dev; if (ax25->ax25_dev != NULL) { ax25_fillin_cb_from_dev(ax25, ax25_dev); return; } /* * No device, use kernel / AX.25 spec default values */ ax25->rtt = msecs_to_jiffies(AX25_DEF_T1) / 2; ax25->t1 = msecs_to_jiffies(AX25_DEF_T1); ax25->t2 = msecs_to_jiffies(AX25_DEF_T2); ax25->t3 = msecs_to_jiffies(AX25_DEF_T3); ax25->n2 = AX25_DEF_N2; ax25->paclen = AX25_DEF_PACLEN; ax25->idle = msecs_to_jiffies(AX25_DEF_IDLE); ax25->backoff = AX25_DEF_BACKOFF; if (AX25_DEF_AXDEFMODE) { ax25->modulus = AX25_EMODULUS; ax25->window = AX25_DEF_EWINDOW; } else { ax25->modulus = AX25_MODULUS; ax25->window = AX25_DEF_WINDOW; } } ",0 "void InspectorResourceAgent::clearBrowserCookies(ErrorString*) { m_client->clearBrowserCookies(); } ",0 "static inline int wm_tolower(int c) { return ((wm_isupper(c)) ? (c | ('a' - 'A')) : c); } ",0 "ipN_print(netdissect_options *ndo, register const u_char *bp, register u_int length) { if (length < 1) { ND_PRINT((ndo, ""truncated-ip %d"", length)); return; } ND_TCHECK(*bp); switch (*bp & 0xF0) { case 0x40: ip_print (ndo, bp, length); break; case 0x60: ip6_print (ndo, bp, length); break; default: ND_PRINT((ndo, ""unknown ip %d"", (*bp & 0xF0) >> 4)); break; } return; trunc: ND_PRINT((ndo, ""%s"", tstr)); return; } ",0 "static v8::Handle objMethodCallback(const v8::Arguments& args) { INC_STATS(""DOM.TestObj.objMethod""); TestObj* imp = V8TestObj::toNative(args.Holder()); return toV8(imp->objMethod(), args.GetIsolate()); } ",0 "static int cx24116_sleep(struct dvb_frontend *fe) { struct cx24116_state *state = fe->demodulator_priv; struct cx24116_cmd cmd; int ret; dprintk(""%s()\n"", __func__); /* Firmware CMD 36: Power config */ cmd.args[0x00] = CMD_TUNERSLEEP; cmd.args[0x01] = 1; cmd.len = 0x02; ret = cx24116_cmd_execute(fe, &cmd); if (ret != 0) return ret; /* Power off (Shutdown clocks) */ cx24116_writereg(state, 0xea, 0xff); cx24116_writereg(state, 0xe1, 1); cx24116_writereg(state, 0xe0, 1); return 0; } ",0 "static ZIPARCHIVE_METHOD(unchangeName) { struct zip *intern; zval *self = getThis(); struct zip_stat sb; char *name; size_t name_len; if (!self) { RETURN_FALSE; } ZIP_FROM_OBJECT(intern, self); if (zend_parse_parameters(ZEND_NUM_ARGS(), ""s"", &name, &name_len) == FAILURE) { return; } if (name_len < 1) { RETURN_FALSE; } PHP_ZIP_STAT_PATH(intern, name, name_len, 0, sb); if (zip_unchange(intern, sb.index) != 0) { RETURN_FALSE; } else { RETURN_TRUE; } } ",0 "void update_rq_clock(struct rq *rq) { s64 delta; if (rq->skip_clock_update > 0) return; delta = sched_clock_cpu(cpu_of(rq)) - rq->clock; rq->clock += delta; update_rq_clock_task(rq, delta); } ",0 "static loff_t snd_disconnect_llseek(struct file *file, loff_t offset, int orig) { return -ENODEV; } ",0 "static int coroutine_fn v9fs_do_readdir(V9fsPDU *pdu, V9fsFidState *fidp, int32_t max_count) { size_t size; V9fsQID qid; V9fsString name; int len, err = 0; int32_t count = 0; off_t saved_dir_pos; struct dirent *dent; /* save the directory position */ saved_dir_pos = v9fs_co_telldir(pdu, fidp); if (saved_dir_pos < 0) { return saved_dir_pos; } while (1) { v9fs_readdir_lock(&fidp->fs.dir); err = v9fs_co_readdir(pdu, fidp, &dent); if (err || !dent) { break; } v9fs_string_init(&name); v9fs_string_sprintf(&name, ""%s"", dent->d_name); if ((count + v9fs_readdir_data_size(&name)) > max_count) { v9fs_readdir_unlock(&fidp->fs.dir); /* Ran out of buffer. Set dir back to old position and return */ v9fs_co_seekdir(pdu, fidp, saved_dir_pos); v9fs_string_free(&name); return count; } /* * Fill up just the path field of qid because the client uses * only that. To fill the entire qid structure we will have * to stat each dirent found, which is expensive */ size = MIN(sizeof(dent->d_ino), sizeof(qid.path)); memcpy(&qid.path, &dent->d_ino, size); /* Fill the other fields with dummy values */ qid.type = 0; qid.version = 0; /* 11 = 7 + 4 (7 = start offset, 4 = space for storing count) */ len = pdu_marshal(pdu, 11 + count, ""Qqbs"", &qid, dent->d_off, dent->d_type, &name); v9fs_readdir_unlock(&fidp->fs.dir); if (len < 0) { v9fs_co_seekdir(pdu, fidp, saved_dir_pos); v9fs_string_free(&name); return len; } count += len; v9fs_string_free(&name); saved_dir_pos = dent->d_off; } v9fs_readdir_unlock(&fidp->fs.dir); if (err < 0) { return err; } return count; } ",0 "static int handle_halt(struct kvm_vcpu *vcpu) { return kvm_emulate_halt(vcpu); } ",0 "NPError PluginInstance::PopUpContextMenu(NPMenu* menu) { NOTIMPLEMENTED(); return NPERR_GENERIC_ERROR; } ",0 " views::ImageView* artwork_view() const { return media_controls_view_->session_artwork_; } ",0 "static int __sha512_neon_update(struct shash_desc *desc, const u8 *data, unsigned int len, unsigned int partial) { struct sha512_state *sctx = shash_desc_ctx(desc); unsigned int done = 0; sctx->count[0] += len; if (sctx->count[0] < len) sctx->count[1]++; if (partial) { done = SHA512_BLOCK_SIZE - partial; memcpy(sctx->buf + partial, data, done); sha512_transform_neon(sctx->state, sctx->buf, sha512_k, 1); } if (len - done >= SHA512_BLOCK_SIZE) { const unsigned int rounds = (len - done) / SHA512_BLOCK_SIZE; sha512_transform_neon(sctx->state, data + done, sha512_k, rounds); done += rounds * SHA512_BLOCK_SIZE; } memcpy(sctx->buf, data + done, len - done); return 0; } ",0 " void EnumerateDevicesCallbackBody( int request_id, const std::vector& devices) { if (sync_call_) { base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&ScopedRequest::EnumerateDevicesCallbackBody, AsWeakPtr(), request_id, devices)); } else { DCHECK_EQ(request_id_, request_id); callback_.Run(request_id, devices); } } ",0 "int generic_permission(struct inode *inode, int mask, int (*check_acl)(struct inode *inode, int mask)) { int ret; /* * Do the basic POSIX ACL permission checks. */ ret = acl_permission_check(inode, mask, check_acl); if (ret != -EACCES) return ret; /* * Read/write DACs are always overridable. * Executable DACs are overridable if at least one exec bit is set. */ if (!(mask & MAY_EXEC) || execute_ok(inode)) if (capable(CAP_DAC_OVERRIDE)) return 0; /* * Searching includes executable on directories, else just read. */ mask &= MAY_READ | MAY_WRITE | MAY_EXEC; if (mask == MAY_READ || (S_ISDIR(inode->i_mode) && !(mask & MAY_WRITE))) if (capable(CAP_DAC_READ_SEARCH)) return 0; return -EACCES; } ",0 "GF_Err sgpd_Size(GF_Box *s) { u32 i; GF_SampleGroupDescriptionBox *p = (GF_SampleGroupDescriptionBox *)s; p->size += 8; p->version=1; p->size += 4; if (p->version>=2) p->size += 4; p->default_length = 0; for (i=0; igroup_descriptions); i++) { void *ptr = gf_list_get(p->group_descriptions, i); u32 size = sgpd_size_entry(p->grouping_type, ptr); p->size += size; if (!p->default_length) { p->default_length = size; } else if (p->default_length != size) { p->default_length = 0; } } if (p->version>=1) { if (!p->default_length) p->size += gf_list_count(p->group_descriptions)*4; } return GF_OK; } ",0 " psh_hint_table_deactivate( PSH_Hint_Table table ) { FT_UInt count = table->max_hints; PSH_Hint hint = table->hints; for ( ; count > 0; count--, hint++ ) { psh_hint_deactivate( hint ); hint->order = -1; } } ",0 "void ChildProcessSecurityPolicyImpl::RegisterWebSafeScheme( const std::string& scheme) { base::AutoLock lock(lock_); DCHECK(web_safe_schemes_.count(scheme) == 0) << ""Add schemes at most once.""; DCHECK(pseudo_schemes_.count(scheme) == 0) << ""Web-safe implies not pseudo.""; web_safe_schemes_.insert(scheme); } ",0 "void databasesCron(void) { /* Expire keys by random sampling. Not required for slaves * as master will synthesize DELs for us. */ if (server.active_expire_enabled && server.masterhost == NULL) activeExpireCycle(ACTIVE_EXPIRE_CYCLE_SLOW); /* Perform hash tables rehashing if needed, but only if there are no * other processes saving the DB on disk. Otherwise rehashing is bad * as will cause a lot of copy-on-write of memory pages. */ if (server.rdb_child_pid == -1 && server.aof_child_pid == -1) { /* We use global counters so if we stop the computation at a given * DB we'll be able to start from the successive in the next * cron loop iteration. */ static unsigned int resize_db = 0; static unsigned int rehash_db = 0; int dbs_per_call = CRON_DBS_PER_CALL; int j; /* Don't test more DBs than we have. */ if (dbs_per_call > server.dbnum) dbs_per_call = server.dbnum; /* Resize */ for (j = 0; j < dbs_per_call; j++) { tryResizeHashTables(resize_db % server.dbnum); resize_db++; } /* Rehash */ if (server.activerehashing) { for (j = 0; j < dbs_per_call; j++) { int work_done = incrementallyRehash(rehash_db % server.dbnum); rehash_db++; if (work_done) { /* If the function did some work, stop here, we'll do * more at the next cron loop. */ break; } } } } } ",0 "void WindowTreeHostManager::OnDisplayMetricsChanged( const display::Display& display, uint32_t metrics) { if (!(metrics & (DISPLAY_METRIC_BOUNDS | DISPLAY_METRIC_ROTATION | DISPLAY_METRIC_DEVICE_SCALE_FACTOR))) return; const DisplayInfo& display_info = GetDisplayManager()->GetDisplayInfo(display.id()); DCHECK(!display_info.bounds_in_native().IsEmpty()); AshWindowTreeHost* ash_host = window_tree_hosts_[display.id()]; ash_host->AsWindowTreeHost()->SetBounds(display_info.bounds_in_native()); SetDisplayPropertiesOnHost(ash_host, display); } ",0 "void AuthenticatorBlePowerOnAutomaticSheetModel::OnAccept() { busy_powering_on_ble_ = true; dialog_model()->OnSheetModelDidChange(); dialog_model()->PowerOnBleAdapter(); } ",0 "static int cdrom_dvdram_open_write(struct cdrom_device_info *cdi) { int ret = cdrom_media_erasable(cdi); /* * allow writable open if media info read worked and media is * erasable, _or_ if it fails since not all drives support it */ if (!ret) return 1; return 0; } ",0 "int add_swap_count_continuation(swp_entry_t entry, gfp_t gfp_mask) { struct swap_info_struct *si; struct page *head; struct page *page; struct page *list_page; pgoff_t offset; unsigned char count; /* * When debugging, it's easier to use __GFP_ZERO here; but it's better * for latency not to zero a page while GFP_ATOMIC and holding locks. */ page = alloc_page(gfp_mask | __GFP_HIGHMEM); si = swap_info_get(entry); if (!si) { /* * An acceptable race has occurred since the failing * __swap_duplicate(): the swap entry has been freed, * perhaps even the whole swap_map cleared for swapoff. */ goto outer; } offset = swp_offset(entry); count = si->swap_map[offset] & ~SWAP_HAS_CACHE; if ((count & ~COUNT_CONTINUED) != SWAP_MAP_MAX) { /* * The higher the swap count, the more likely it is that tasks * will race to add swap count continuation: we need to avoid * over-provisioning. */ goto out; } if (!page) { spin_unlock(&swap_lock); return -ENOMEM; } /* * We are fortunate that although vmalloc_to_page uses pte_offset_map, * no architecture is using highmem pages for kernel pagetables: so it * will not corrupt the GFP_ATOMIC caller's atomic pagetable kmaps. */ head = vmalloc_to_page(si->swap_map + offset); offset &= ~PAGE_MASK; /* * Page allocation does not initialize the page's lru field, * but it does always reset its private field. */ if (!page_private(head)) { BUG_ON(count & COUNT_CONTINUED); INIT_LIST_HEAD(&head->lru); set_page_private(head, SWP_CONTINUED); si->flags |= SWP_CONTINUED; } list_for_each_entry(list_page, &head->lru, lru) { unsigned char *map; /* * If the previous map said no continuation, but we've found * a continuation page, free our allocation and use this one. */ if (!(count & COUNT_CONTINUED)) goto out; map = kmap_atomic(list_page, KM_USER0) + offset; count = *map; kunmap_atomic(map, KM_USER0); /* * If this continuation count now has some space in it, * free our allocation and use this one. */ if ((count & ~COUNT_CONTINUED) != SWAP_CONT_MAX) goto out; } list_add_tail(&page->lru, &head->lru); page = NULL; /* now it's attached, don't free it */ out: spin_unlock(&swap_lock); outer: if (page) __free_page(page); return 0; } ",0 "int OxideQQuickWebViewPrivate::locationBarContentOffset() { if (!proxy_) { return 0; } return proxy_->locationBarContentOffset(); } ",0 "void Document::UpdateStyleAndLayout() { DCHECK(IsMainThread()); ScriptForbiddenScope forbid_script; LocalFrameView* frame_view = View(); if (frame_view && frame_view->IsInPerformLayout()) { NOTREACHED(); return; } if (HTMLFrameOwnerElement* owner = LocalOwner()) owner->GetDocument().UpdateStyleAndLayout(); UpdateStyleAndLayoutTree(); if (!IsActive()) return; if (frame_view->NeedsLayout()) frame_view->UpdateLayout(); if (Lifecycle().GetState() < DocumentLifecycle::kLayoutClean) Lifecycle().AdvanceTo(DocumentLifecycle::kLayoutClean); if (LocalFrameView* frame_view = View()) frame_view->PerformScrollAnchoringAdjustments(); } ",0 "static void zlib_decomp_exit(struct zlib_ctx *ctx) { struct z_stream_s *stream = &ctx->decomp_stream; if (stream->workspace) { zlib_inflateEnd(stream); vfree(stream->workspace); stream->workspace = NULL; } } ",0 "JsArgList GetNodeInfoById(const JsArgList& args, UserShare* user_share, DictionaryValue* (BaseNode::*info_getter)() const) { CHECK(info_getter); ListValue return_args; ListValue* node_summaries = new ListValue(); return_args.Append(node_summaries); ListValue* id_list = NULL; ReadTransaction trans(FROM_HERE, user_share); if (args.Get().GetList(0, &id_list)) { CHECK(id_list); for (size_t i = 0; i < id_list->GetSize(); ++i) { int64 id = GetId(*id_list, i); if (id == kInvalidId) { continue; } ReadNode node(&trans); if (!node.InitByIdLookup(id)) { continue; } node_summaries->Append((node.*info_getter)()); } } return JsArgList(&return_args); } ",0 "void show_ucode_info_early(void) { struct ucode_cpu_info uci; if (delay_ucode_info) { collect_cpu_info_early(&uci); print_ucode_info(&uci, current_mc_date); delay_ucode_info = 0; } } ",0 "static void aesni_ctr_enc_avx_tfm(struct crypto_aes_ctx *ctx, u8 *out, const u8 *in, unsigned int len, u8 *iv) { /* * based on key length, override with the by8 version * of ctr mode encryption/decryption for improved performance * aes_set_key_common() ensures that key length is one of * {128,192,256} */ if (ctx->key_length == AES_KEYSIZE_128) aes_ctr_enc_128_avx_by8(in, iv, (void *)ctx, out, len); else if (ctx->key_length == AES_KEYSIZE_192) aes_ctr_enc_192_avx_by8(in, iv, (void *)ctx, out, len); else aes_ctr_enc_256_avx_by8(in, iv, (void *)ctx, out, len); } ",0 "int __weak phys_mem_access_prot_allowed(struct file *file, unsigned long pfn, unsigned long size, pgprot_t *vma_prot) { return 1; } ",0 "void HTMLInputElement::setType(const String& type) { if (type.isEmpty()) removeAttribute(typeAttr); else setAttribute(typeAttr, type); } ",0 "static int mxf_read_sequence(void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset) { MXFSequence *sequence = arg; switch(tag) { case 0x0202: sequence->duration = avio_rb64(pb); break; case 0x0201: avio_read(pb, sequence->data_definition_ul, 16); break; case 0x4b02: sequence->origin = avio_r8(pb); break; case 0x1001: return mxf_read_strong_ref_array(pb, &sequence->structural_components_refs, &sequence->structural_components_count); } return 0; } ",0 "void NavigationController::RendererDidNavigateInPage( const ViewHostMsg_FrameNavigate_Params& params, bool* did_replace_entry) { DCHECK(content::PageTransitionIsMainFrame(params.transition)) << ""WebKit should only tell us about in-page navs for the main frame.""; NavigationEntry* existing_entry = GetEntryWithPageID( tab_contents_->GetSiteInstance(), params.page_id); existing_entry->set_url(params.url); if (existing_entry->update_virtual_url_with_url()) UpdateVirtualURLToURL(existing_entry, params.url); *did_replace_entry = true; if (pending_entry_) DiscardNonCommittedEntriesInternal(); last_committed_entry_index_ = GetEntryIndexWithPageID(tab_contents_->GetSiteInstance(), params.page_id); } ",0 "void TestingAutomationProvider::PerformActionOnInfobar( Browser* browser, DictionaryValue* args, IPC::Message* reply_message) { AutomationJSONReply reply(this, reply_message); int tab_index; int infobar_index_int; std::string action; if (!args->GetInteger(""tab_index"", &tab_index) || !args->GetInteger(""infobar_index"", &infobar_index_int) || !args->GetString(""action"", &action)) { reply.SendError(""Invalid or missing args""); return; } TabContentsWrapper* tab_contents = browser->GetTabContentsWrapperAt(tab_index); if (!tab_contents) { reply.SendError(StringPrintf(""No such tab at index %d"", tab_index)); return; } InfoBarTabHelper* infobar_helper = tab_contents->infobar_tab_helper(); InfoBarDelegate* infobar = NULL; size_t infobar_index = static_cast(infobar_index_int); if (infobar_index >= infobar_helper->infobar_count()) { reply.SendError(StringPrintf(""No such infobar at index %"" PRIuS, infobar_index)); return; } infobar = infobar_helper->GetInfoBarDelegateAt(infobar_index); if (""dismiss"" == action) { infobar->InfoBarDismissed(); infobar_helper->RemoveInfoBar(infobar); reply.SendSuccess(NULL); return; } if (""accept"" == action || ""cancel"" == action) { ConfirmInfoBarDelegate* confirm_infobar; if (!(confirm_infobar = infobar->AsConfirmInfoBarDelegate())) { reply.SendError(""Not a confirm infobar""); return; } if (""accept"" == action) { if (confirm_infobar->Accept()) infobar_helper->RemoveInfoBar(infobar); } else if (""cancel"" == action) { if (confirm_infobar->Cancel()) infobar_helper->RemoveInfoBar(infobar); } reply.SendSuccess(NULL); return; } reply.SendError(""Invalid action""); } ",0 "void LocalFrameClientImpl::DidSetFramePolicyHeaders( SandboxFlags sandbox_flags, const ParsedFeaturePolicy& parsed_header) { if (web_frame_->Client()) { web_frame_->Client()->DidSetFramePolicyHeaders( static_cast(sandbox_flags), parsed_header); } } ",0 "EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMutablePointFunction(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) return throwVMTypeError(exec); JSTestObj* castedThis = jsCast(asObject(thisValue)); ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info); TestObj* impl = static_cast(castedThis->impl()); JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(SVGPropertyTearOff::create(impl->mutablePointFunction()))); return JSValue::encode(result); } ",0 "svcauth_gss_set_svc_name(gss_name_t name) { OM_uint32 maj_stat, min_stat; log_debug(""in svcauth_gss_set_svc_name()""); if (svcauth_gss_name != NULL) { maj_stat = gss_release_name(&min_stat, &svcauth_gss_name); if (maj_stat != GSS_S_COMPLETE) { log_status(""gss_release_name"", maj_stat, min_stat); return (FALSE); } svcauth_gss_name = NULL; } if (svcauth_gss_name == GSS_C_NO_NAME) return (TRUE); maj_stat = gss_duplicate_name(&min_stat, name, &svcauth_gss_name); if (maj_stat != GSS_S_COMPLETE) { log_status(""gss_duplicate_name"", maj_stat, min_stat); return (FALSE); } return (TRUE); } ",0 "void Shell::CreateKeyboard() { if (in_mus_) return; InitKeyboard(); GetPrimaryRootWindowController()-> ActivateKeyboard(keyboard::KeyboardController::GetInstance()); } ",0 "void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) { /* Address WBINVD may be executed by guest */ if (need_emulate_wbinvd(vcpu)) { if (kvm_x86_ops->has_wbinvd_exit()) cpumask_set_cpu(cpu, vcpu->arch.wbinvd_dirty_mask); else if (vcpu->cpu != -1 && vcpu->cpu != cpu) smp_call_function_single(vcpu->cpu, wbinvd_ipi, NULL, 1); } kvm_x86_ops->vcpu_load(vcpu, cpu); /* Apply any externally detected TSC adjustments (due to suspend) */ if (unlikely(vcpu->arch.tsc_offset_adjustment)) { adjust_tsc_offset_host(vcpu, vcpu->arch.tsc_offset_adjustment); vcpu->arch.tsc_offset_adjustment = 0; kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu); } if (unlikely(vcpu->cpu != cpu) || check_tsc_unstable()) { s64 tsc_delta = !vcpu->arch.last_host_tsc ? 0 : rdtsc() - vcpu->arch.last_host_tsc; if (tsc_delta < 0) mark_tsc_unstable(""KVM discovered backwards TSC""); if (check_tsc_unstable()) { u64 offset = kvm_compute_tsc_offset(vcpu, vcpu->arch.last_guest_tsc); kvm_x86_ops->write_tsc_offset(vcpu, offset); vcpu->arch.tsc_catchup = 1; } /* * On a host with synchronized TSC, there is no need to update * kvmclock on vcpu->cpu migration */ if (!vcpu->kvm->arch.use_master_clock || vcpu->cpu == -1) kvm_make_request(KVM_REQ_GLOBAL_CLOCK_UPDATE, vcpu); if (vcpu->cpu != cpu) kvm_migrate_timers(vcpu); vcpu->cpu = cpu; } kvm_make_request(KVM_REQ_STEAL_UPDATE, vcpu); } ",0 "static int dns_packet_append_type_window(DnsPacket *p, uint8_t window, uint8_t length, const uint8_t *types, size_t *start) { size_t saved_size; int r; assert(p); assert(types); assert(length > 0); saved_size = p->size; r = dns_packet_append_uint8(p, window, NULL); if (r < 0) goto fail; r = dns_packet_append_uint8(p, length, NULL); if (r < 0) goto fail; r = dns_packet_append_blob(p, types, length, NULL); if (r < 0) goto fail; if (start) *start = saved_size; return 0; fail: dns_packet_truncate(p, saved_size); return r; } ",0 "void CodecHandler::onMessageReceived(const sp &msg) { switch (msg->what()) { case kWhatRequestActivityNotifications: { if (mCodec->mRequestedActivityNotification) { break; } mCodec->mCodec->requestActivityNotification(mCodec->mActivityNotification); mCodec->mRequestedActivityNotification = true; break; } case kWhatActivityNotify: { { int32_t generation; msg->findInt32(""generation"", &generation); if (generation != mCodec->mGeneration) { break; } mCodec->mRequestedActivityNotification = false; } if (mCodec->mCallback) { mCodec->mCallback(mCodec, mCodec->mCallbackUserData); } break; } case kWhatAsyncNotify: { int32_t cbID; if (!msg->findInt32(""callbackID"", &cbID)) { ALOGE(""kWhatAsyncNotify: callbackID is expected.""); break; } ALOGV(""kWhatAsyncNotify: cbID = %d"", cbID); switch (cbID) { case MediaCodec::CB_INPUT_AVAILABLE: { int32_t index; if (!msg->findInt32(""index"", &index)) { ALOGE(""CB_INPUT_AVAILABLE: index is expected.""); break; } Mutex::Autolock _l(mCodec->mAsyncCallbackLock); if (mCodec->mAsyncCallbackUserData != NULL || mCodec->mAsyncCallback.onAsyncInputAvailable != NULL) { mCodec->mAsyncCallback.onAsyncInputAvailable( mCodec, mCodec->mAsyncCallbackUserData, index); } break; } case MediaCodec::CB_OUTPUT_AVAILABLE: { int32_t index; size_t offset; size_t size; int64_t timeUs; int32_t flags; if (!msg->findInt32(""index"", &index)) { ALOGE(""CB_OUTPUT_AVAILABLE: index is expected.""); break; } if (!msg->findSize(""offset"", &offset)) { ALOGE(""CB_OUTPUT_AVAILABLE: offset is expected.""); break; } if (!msg->findSize(""size"", &size)) { ALOGE(""CB_OUTPUT_AVAILABLE: size is expected.""); break; } if (!msg->findInt64(""timeUs"", &timeUs)) { ALOGE(""CB_OUTPUT_AVAILABLE: timeUs is expected.""); break; } if (!msg->findInt32(""flags"", &flags)) { ALOGE(""CB_OUTPUT_AVAILABLE: flags is expected.""); break; } AMediaCodecBufferInfo bufferInfo = { (int32_t)offset, (int32_t)size, timeUs, (uint32_t)flags}; Mutex::Autolock _l(mCodec->mAsyncCallbackLock); if (mCodec->mAsyncCallbackUserData != NULL || mCodec->mAsyncCallback.onAsyncOutputAvailable != NULL) { mCodec->mAsyncCallback.onAsyncOutputAvailable( mCodec, mCodec->mAsyncCallbackUserData, index, &bufferInfo); } break; } case MediaCodec::CB_OUTPUT_FORMAT_CHANGED: { sp format; if (!msg->findMessage(""format"", &format)) { ALOGE(""CB_OUTPUT_FORMAT_CHANGED: format is expected.""); break; } AMediaFormat *aMediaFormat = AMediaFormat_fromMsg(&format); Mutex::Autolock _l(mCodec->mAsyncCallbackLock); if (mCodec->mAsyncCallbackUserData != NULL || mCodec->mAsyncCallback.onAsyncFormatChanged != NULL) { mCodec->mAsyncCallback.onAsyncFormatChanged( mCodec, mCodec->mAsyncCallbackUserData, aMediaFormat); } break; } case MediaCodec::CB_ERROR: { status_t err; int32_t actionCode; AString detail; if (!msg->findInt32(""err"", &err)) { ALOGE(""CB_ERROR: err is expected.""); break; } if (!msg->findInt32(""action"", &actionCode)) { ALOGE(""CB_ERROR: action is expected.""); break; } msg->findString(""detail"", &detail); ALOGE(""Decoder reported error(0x%x), actionCode(%d), detail(%s)"", err, actionCode, detail.c_str()); Mutex::Autolock _l(mCodec->mAsyncCallbackLock); if (mCodec->mAsyncCallbackUserData != NULL || mCodec->mAsyncCallback.onAsyncError != NULL) { mCodec->mAsyncCallback.onAsyncError( mCodec, mCodec->mAsyncCallbackUserData, translate_error(err), actionCode, detail.c_str()); } break; } default: { ALOGE(""kWhatAsyncNotify: callbackID(%d) is unexpected."", cbID); break; } } break; } case kWhatStopActivityNotifications: { sp replyID; msg->senderAwaitsResponse(&replyID); mCodec->mGeneration++; mCodec->mRequestedActivityNotification = false; sp response = new AMessage; response->postReply(replyID); break; } default: ALOGE(""shouldn't be here""); break; } } ",0 "char *FLTGetBinaryComparisonExpresssion(FilterEncodingNode *psFilterNode, layerObj *lp) { const size_t bufferSize = 1024; char szBuffer[1024]; int bString=0; char szTmp[256]; szBuffer[0] = '\0'; if (!psFilterNode || !FLTIsBinaryComparisonFilterType(psFilterNode->pszValue)) return NULL; /* -------------------------------------------------------------------- */ /* check if the value is a numeric value or alphanumeric. If it */ /* is alphanumeric, add quotes around attribute and values. */ /* -------------------------------------------------------------------- */ bString = 0; if (psFilterNode->psRightNode->pszValue) { const char* pszOFGType; snprintf(szTmp, sizeof(szTmp), ""%s_type"", psFilterNode->psLeftNode->pszValue); pszOFGType = msOWSLookupMetadata(&(lp->metadata), ""OFG"", szTmp); if (pszOFGType!= NULL && strcasecmp(pszOFGType, ""Character"") == 0) bString = 1; else if (FLTIsNumeric(psFilterNode->psRightNode->pszValue) == MS_FALSE) bString = 1; } /* specical case to be able to have empty strings in the expression. */ if (psFilterNode->psRightNode->pszValue == NULL) bString = 1; if (bString) strlcat(szBuffer, "" (\""["", bufferSize); else strlcat(szBuffer, "" (["", bufferSize); /* attribute */ strlcat(szBuffer, psFilterNode->psLeftNode->pszValue, bufferSize); if (bString) strlcat(szBuffer, ""]\"" "", bufferSize); else strlcat(szBuffer, ""] "", bufferSize); /* logical operator */ if (strcasecmp(psFilterNode->pszValue, ""PropertyIsEqualTo"") == 0) { /*case insensitive set ? */ if (psFilterNode->psRightNode->pOther && (*(int *)psFilterNode->psRightNode->pOther) == 1) { strlcat(szBuffer, ""IEQ"", bufferSize); } else strlcat(szBuffer, ""="", bufferSize); } else if (strcasecmp(psFilterNode->pszValue, ""PropertyIsNotEqualTo"") == 0) strlcat(szBuffer, ""!="", bufferSize); else if (strcasecmp(psFilterNode->pszValue, ""PropertyIsLessThan"") == 0) strlcat(szBuffer, ""<"", bufferSize); else if (strcasecmp(psFilterNode->pszValue, ""PropertyIsGreaterThan"") == 0) strlcat(szBuffer, "">"", bufferSize); else if (strcasecmp(psFilterNode->pszValue, ""PropertyIsLessThanOrEqualTo"") == 0) strlcat(szBuffer, ""<="", bufferSize); else if (strcasecmp(psFilterNode->pszValue, ""PropertyIsGreaterThanOrEqualTo"") == 0) strlcat(szBuffer, "">="", bufferSize); strlcat(szBuffer, "" "", bufferSize); /* value */ if (bString) strlcat(szBuffer, ""\"""", bufferSize); if (psFilterNode->psRightNode->pszValue) strlcat(szBuffer, psFilterNode->psRightNode->pszValue, bufferSize); if (bString) strlcat(szBuffer, ""\"""", bufferSize); strlcat(szBuffer, "") "", bufferSize); return msStrdup(szBuffer); } ",0 "bool AutofillDialogViews::ValidateGroup(const DetailsGroup& group, ValidationType validation_type) { DCHECK(group.container->visible()); FieldValueMap detail_outputs; if (group.manual_input->visible()) { for (TextfieldMap::const_iterator iter = group.textfields.begin(); iter != group.textfields.end(); ++iter) { if (!iter->second->editable()) continue; detail_outputs[iter->first] = iter->second->GetText(); } for (ComboboxMap::const_iterator iter = group.comboboxes.begin(); iter != group.comboboxes.end(); ++iter) { if (!iter->second->enabled()) continue; views::Combobox* combobox = iter->second; base::string16 item = combobox->model()->GetItemAt(combobox->selected_index()); detail_outputs[iter->first] = item; } } else if (group.section == GetCreditCardSection()) { ExpandingTextfield* cvc = group.suggested_info->textfield(); if (cvc->visible()) detail_outputs[CREDIT_CARD_VERIFICATION_CODE] = cvc->GetText(); } ValidityMessages validity = delegate_->InputsAreValid(group.section, detail_outputs); MarkInputsInvalid(group.section, validity, validation_type == VALIDATE_FINAL); return !validity.HasErrors(); } ",0 "void AudioContext::handleDirtyAudioNodeOutputs() { ASSERT(isGraphOwner()); for (HashSet::iterator i = m_dirtyAudioNodeOutputs.begin(); i != m_dirtyAudioNodeOutputs.end(); ++i) (*i)->updateRenderingState(); m_dirtyAudioNodeOutputs.clear(); } ",0 "int dns_packet_read_uint32(DnsPacket *p, uint32_t *ret, size_t *start) { const void *d; int r; assert(p); r = dns_packet_read(p, sizeof(uint32_t), &d, start); if (r < 0) return r; *ret = unaligned_read_be32(d); return 0; } ",0 "std::wstring GetBaseAppName() { return InstallDetails::Get().mode().base_app_name; } ",0 "void UserSelectionScreen::InitEasyUnlock() { proximity_auth::ScreenlockBridge::Get()->SetLockHandler(this); } ",0 "on_file_monitor_changed (GFileMonitor *file_monitor, GFile *file, GFile *other_file, GFileMonitorEvent event_type, gpointer user_data) { PolkitBackendSessionMonitor *monitor = POLKIT_BACKEND_SESSION_MONITOR (user_data); /* throw away cache */ if (monitor->database != NULL) { g_key_file_free (monitor->database); monitor->database = NULL; } g_signal_emit (monitor, signals[CHANGED_SIGNAL], 0); } ",0 "R_API void r_bin_bind(RBin *bin, RBinBind *b) { if (b) { b->bin = bin; b->get_offset = getoffset; b->get_name = getname; b->get_sections = r_bin_get_sections; b->get_vsect_at = _get_vsection_at; } } ",0 "static int scm_fp_copy(struct cmsghdr *cmsg, struct scm_fp_list **fplp) { int *fdp = (int*)CMSG_DATA(cmsg); struct scm_fp_list *fpl = *fplp; struct file **fpp; int i, num; num = (cmsg->cmsg_len - CMSG_ALIGN(sizeof(struct cmsghdr)))/sizeof(int); if (num <= 0) return 0; if (num > SCM_MAX_FD) return -EINVAL; if (!fpl) { fpl = kmalloc(sizeof(struct scm_fp_list), GFP_KERNEL); if (!fpl) return -ENOMEM; *fplp = fpl; fpl->count = 0; fpl->max = SCM_MAX_FD; } fpp = &fpl->fp[fpl->count]; if (fpl->count + num > fpl->max) return -EINVAL; /* * Verify the descriptors and increment the usage count. */ for (i=0; i< num; i++) { int fd = fdp[i]; struct file *file; if (fd < 0 || !(file = fget_raw(fd))) return -EBADF; *fpp++ = file; fpl->count++; } return num; } ",1 "static void *shmem_follow_short_symlink(struct dentry *dentry, struct nameidata *nd) { nd_set_link(nd, SHMEM_I(dentry->d_inode)->symlink); return NULL; } ",0 " void *atomic_thread(void *context) { struct atomic_test_s32_s *at = (struct atomic_test_s32_s *)context; for (int i = 0; i < at->max_val; i++) { usleep(1); atomic_inc_prefix_s32(&at->data[i]); } return NULL; } ",1 "void Con_Dump_f (void) { int l, x, i; short *line; fileHandle_t f; int bufferlen; char *buffer; char filename[MAX_QPATH]; if (Cmd_Argc() != 2) { Com_Printf (""usage: condump \n""); return; } Q_strncpyz( filename, Cmd_Argv( 1 ), sizeof( filename ) ); COM_DefaultExtension( filename, sizeof( filename ), "".txt"" ); f = FS_FOpenFileWrite( filename ); if (!f) { Com_Printf (""ERROR: couldn't open %s.\n"", filename); return; } Com_Printf (""Dumped console text to %s.\n"", filename ); for (l = con.current - con.totallines + 1 ; l <= con.current ; l++) { line = con.text + (l%con.totallines)*con.linewidth; for (x=0 ; x=0 ; x--) { if (buffer[x] == ' ') buffer[x] = 0; else break; } #ifdef _WIN32 Q_strcat(buffer, bufferlen, ""\r\n""); #else Q_strcat(buffer, bufferlen, ""\n""); #endif FS_Write(buffer, strlen(buffer), f); } Hunk_FreeTempMemory( buffer ); FS_FCloseFile( f ); } ",1 "SPL_METHOD(SplPriorityQueue, top) { zval *value, **value_out; spl_heap_object *intern; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, """") == FAILURE) { return; } intern = (spl_heap_object*)zend_object_store_get_object(getThis() TSRMLS_CC); if (intern->heap->flags & SPL_HEAP_CORRUPTED) { zend_throw_exception(spl_ce_RuntimeException, ""Heap is corrupted, heap properties are no longer ensured."", 0 TSRMLS_CC); return; } value = (zval *)spl_ptr_heap_top(intern->heap); if (!value) { zend_throw_exception(spl_ce_RuntimeException, ""Can't peek at an empty heap"", 0 TSRMLS_CC); return; } value_out = spl_pqueue_extract_helper(&value, intern->flags); if (!value_out) { zend_error(E_RECOVERABLE_ERROR, ""Unable to extract from the PriorityQueue node""); return; } RETURN_ZVAL(*value_out, 1, 0); } ",0 "bool UsbTabHelper::IsDeviceConnected() const { for (const auto& map_entry : frame_usb_services_) { if (map_entry.second->device_connection_count_ > 0) return true; } return false; } ",0 "void ResourceFetcher::WarnUnusedPreloads() { for (const auto& pair : preloads_) { Resource* resource = pair.value; if (resource && resource->IsLinkPreload() && resource->IsUnusedPreload()) { Context().AddWarningConsoleMessage( ""The resource "" + resource->Url().GetString() + "" was preloaded using link preload but not used within a few "" ""seconds from the window's load event. Please make sure it "" ""wasn't preloaded for nothing."", FetchContext::kJSSource); } } } ",0 "int git_delta_apply( void **out, size_t *out_len, const unsigned char *base, size_t base_len, const unsigned char *delta, size_t delta_len) { const unsigned char *delta_end = delta + delta_len; size_t base_sz, res_sz, alloc_sz; unsigned char *res_dp; *out = NULL; *out_len = 0; /* * Check that the base size matches the data we were given; * if not we would underflow while accessing data from the * base object, resulting in data corruption or segfault. */ if ((hdr_sz(&base_sz, &delta, delta_end) < 0) || (base_sz != base_len)) { giterr_set(GITERR_INVALID, ""failed to apply delta: base size does not match given data""); return -1; } if (hdr_sz(&res_sz, &delta, delta_end) < 0) { giterr_set(GITERR_INVALID, ""failed to apply delta: base size does not match given data""); return -1; } GITERR_CHECK_ALLOC_ADD(&alloc_sz, res_sz, 1); res_dp = git__malloc(alloc_sz); GITERR_CHECK_ALLOC(res_dp); res_dp[res_sz] = '\0'; *out = res_dp; *out_len = res_sz; while (delta < delta_end) { unsigned char cmd = *delta++; if (cmd & 0x80) { /* cmd is a copy instruction; copy from the base. */ size_t off = 0, len = 0; #define ADD_DELTA(o, shift) { if (delta < delta_end) (o) |= ((unsigned) *delta++ << shift); else goto fail; } if (cmd & 0x01) ADD_DELTA(off, 0UL); if (cmd & 0x02) ADD_DELTA(off, 8UL); if (cmd & 0x04) ADD_DELTA(off, 16UL); if (cmd & 0x08) ADD_DELTA(off, 24UL); if (cmd & 0x10) ADD_DELTA(len, 0UL); if (cmd & 0x20) ADD_DELTA(len, 8UL); if (cmd & 0x40) ADD_DELTA(len, 16UL); if (!len) len = 0x10000; #undef ADD_DELTA if (base_len < off + len || res_sz < len) goto fail; memcpy(res_dp, base + off, len); res_dp += len; res_sz -= len; } else if (cmd) { /* * cmd is a literal insert instruction; copy from * the delta stream itself. */ if (delta_end - delta < cmd || res_sz < cmd) goto fail; memcpy(res_dp, delta, cmd); delta += cmd; res_dp += cmd; res_sz -= cmd; } else { /* cmd == 0 is reserved for future encodings. */ goto fail; } } if (delta != delta_end || res_sz) goto fail; return 0; fail: git__free(*out); *out = NULL; *out_len = 0; giterr_set(GITERR_INVALID, ""failed to apply delta""); return -1; } ",1 "int test_div_recp(BIO *bp, BN_CTX *ctx) { BIGNUM a,b,c,d,e; BN_RECP_CTX recp; int i; BN_RECP_CTX_init(&recp); BN_init(&a); BN_init(&b); BN_init(&c); BN_init(&d); BN_init(&e); for (i=0; i::Read(const Message* m, PickleIterator* iter, param_type* r) { const char *data; int data_size = 0; bool result = m->ReadData(iter, &data, &data_size); if (result && data_size == sizeof(LOGFONT)) { memcpy(r, data, sizeof(LOGFONT)); } else { result = false; NOTREACHED(); } return result; } ",1 "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 "callout_name_entry(CalloutNameEntry** rentry, OnigEncoding enc, int is_not_single, UChar* name, UChar* name_end) { int r; CalloutNameEntry* e; CalloutNameTable* t = GlobalCalloutNameTable; *rentry = 0; if (name_end - name <= 0) return ONIGERR_INVALID_CALLOUT_NAME; e = callout_name_find(enc, is_not_single, name, name_end); if (IS_NULL(e)) { #ifdef USE_ST_LIBRARY if (IS_NULL(t)) { t = onig_st_init_callout_name_table_with_size(INIT_NAMES_ALLOC_NUM); CHECK_NULL_RETURN_MEMERR(t); GlobalCalloutNameTable = t; } e = (CalloutNameEntry* )xmalloc(sizeof(CalloutNameEntry)); CHECK_NULL_RETURN_MEMERR(e); e->name = onigenc_strdup(enc, name, name_end); if (IS_NULL(e->name)) { xfree(e); return ONIGERR_MEMORY; } r = st_insert_callout_name_table(t, enc, is_not_single, e->name, (e->name + (name_end - name)), (HashDataType )e); if (r < 0) return r; #else int alloc; if (IS_NULL(t)) { alloc = INIT_NAMES_ALLOC_NUM; t = (CalloutNameTable* )xmalloc(sizeof(CalloutNameTable)); CHECK_NULL_RETURN_MEMERR(t); t->e = NULL; t->alloc = 0; t->num = 0; t->e = (CalloutNameEntry* )xmalloc(sizeof(CalloutNameEntry) * alloc); if (IS_NULL(t->e)) { xfree(t); return ONIGERR_MEMORY; } t->alloc = alloc; GlobalCalloutNameTable = t; goto clear; } else if (t->num == t->alloc) { int i; alloc = t->alloc * 2; t->e = (CalloutNameEntry* )xrealloc(t->e, sizeof(CalloutNameEntry) * alloc); CHECK_NULL_RETURN_MEMERR(t->e); t->alloc = alloc; clear: for (i = t->num; i < t->alloc; i++) { t->e[i].name = NULL; t->e[i].name_len = 0; t->e[i].id = 0; } } e = &(t->e[t->num]); t->num++; e->name = onigenc_strdup(enc, name, name_end); if (IS_NULL(e->name)) return ONIGERR_MEMORY; #endif CalloutNameIDCounter++; e->id = CalloutNameIDCounter; e->name_len = (int )(name_end - name); } *rentry = e; return e->id; } ",0 "FLACParser::~FLACParser() { ALOGV(""FLACParser::~FLACParser""); if (mDecoder != NULL) { FLAC__stream_decoder_delete(mDecoder); mDecoder = NULL; } } ",0 "CJSON_PUBLIC(void) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item) { if (array == NULL) { return; } add_item_to_array(array, create_reference(item, &global_hooks)); } ",0 "static ssize_t show_country_codes (struct device *dev, struct device_attribute *attr, char *buf) { struct usb_interface *intf = to_usb_interface(dev); struct acm *acm = usb_get_intfdata(intf); memcpy(buf, acm->country_codes, acm->country_code_size); return acm->country_code_size; } ",0 "int snd_seq_queue_delete(int client, int queueid) { struct snd_seq_queue *q; if (queueid < 0 || queueid >= SNDRV_SEQ_MAX_QUEUES) return -EINVAL; q = queue_list_remove(queueid, client); if (q == NULL) return -EINVAL; queue_delete(q); return 0; } ",0 "SkCanvas* SkiaOutputSurfaceImpl::BeginPaintCurrentFrame() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(!current_paint_); if (initialize_waitable_event_) { initialize_waitable_event_->Wait(); initialize_waitable_event_ = nullptr; RecreateRootRecorder(); } DCHECK(root_recorder_); current_paint_.emplace(&root_recorder_.value()); if (!renderer_settings_.show_overdraw_feedback) return current_paint_->recorder()->getCanvas(); DCHECK(!overdraw_surface_recorder_); DCHECK(renderer_settings_.show_overdraw_feedback); SkSurfaceCharacterization characterization = CreateSkSurfaceCharacterization( gfx::Size(characterization_.width(), characterization_.height()), BGRA_8888, false /* mipmap */, characterization_.refColorSpace()); overdraw_surface_recorder_.emplace(characterization); overdraw_canvas_.emplace((overdraw_surface_recorder_->getCanvas())); nway_canvas_.emplace(characterization_.width(), characterization_.height()); nway_canvas_->addCanvas(current_paint_->recorder()->getCanvas()); nway_canvas_->addCanvas(&overdraw_canvas_.value()); return &nway_canvas_.value(); } ",0 "PHP_FUNCTION(parse_str) { char *arg; zval *arrayArg = NULL; char *res = NULL; size_t arglen; if (zend_parse_parameters(ZEND_NUM_ARGS(), ""s|z/"", &arg, &arglen, &arrayArg) == FAILURE) { return; } res = estrndup(arg, arglen); if (arrayArg == NULL) { zval tmp; zend_array *symbol_table = zend_rebuild_symbol_table(); ZVAL_ARR(&tmp, symbol_table); sapi_module.treat_data(PARSE_STRING, res, &tmp); } else { zval ret; /* Clear out the array that was passed in. */ zval_dtor(arrayArg); array_init(&ret); sapi_module.treat_data(PARSE_STRING, res, &ret); ZVAL_COPY_VALUE(arrayArg, &ret); } } ",0 "void ChromeDownloadManagerDelegate::ShouldCompleteDownloadInternal( int download_id, const base::Closure& user_complete_callback) { DownloadItem* item = download_manager_->GetDownload(download_id); if (!item) return; if (IsDownloadReadyForCompletion(item, base::Bind( &ChromeDownloadManagerDelegate::ShouldCompleteDownloadInternal, this, download_id, user_complete_callback))) user_complete_callback.Run(); } ",0 "static bool tcp_pause_early_retransmit(struct sock *sk, int flag) { struct tcp_sock *tp = tcp_sk(sk); unsigned long delay; /* Delay early retransmit and entering fast recovery for * max(RTT/4, 2msec) unless ack has ECE mark, no RTT samples * available, or RTO is scheduled to fire first. */ if (sysctl_tcp_early_retrans < 2 || sysctl_tcp_early_retrans > 3 || (flag & FLAG_ECE) || !tp->srtt_us) return false; delay = max(usecs_to_jiffies(tp->srtt_us >> 5), msecs_to_jiffies(2)); if (!time_after(inet_csk(sk)->icsk_timeout, (jiffies + delay))) return false; inet_csk_reset_xmit_timer(sk, ICSK_TIME_EARLY_RETRANS, delay, TCP_RTO_MAX); return true; } ",0 " const ChromeUserMetricsExtension& uma_proto() const { return *MetricsLog::uma_proto(); } ",0 "int snd_seq_queue_alloc(int client, int locked, unsigned int info_flags) { struct snd_seq_queue *q; q = queue_new(client, locked); if (q == NULL) return -ENOMEM; q->info_flags = info_flags; if (queue_list_add(q) < 0) { queue_delete(q); return -ENOMEM; } snd_seq_queue_use(q->queue, client, 1); /* use this queue */ return q->queue; } ",0 "static int sctp_v4_is_ce(const struct sk_buff *skb) { return INET_ECN_is_ce(ip_hdr(skb)->tos); } ",0 "void QtBuiltinBundlePage::setNavigatorQtObjectEnabled(bool enabled) { if (enabled == m_navigatorQtObjectEnabled) return; m_navigatorQtObjectEnabled = enabled; } ",0 "void WebGLRenderingContextBase::bufferSubData( GLenum target, int64_t offset, const FlexibleArrayBufferView& data) { if (isContextLost()) return; DCHECK(data); BufferSubDataImpl(target, offset, data.ByteLength(), data.BaseAddressMaybeOnStack()); } ",0 " bool HTMLMediaElement::IsMediaDataCORSSameOrigin( const SecurityOrigin* origin) const { if (GetWebMediaPlayer() && GetWebMediaPlayer()->DidGetOpaqueResponseFromServiceWorker()) { return false; } if (!HasSingleSecurityOrigin()) return false; return (GetWebMediaPlayer() && GetWebMediaPlayer()->DidPassCORSAccessCheck()) || origin->CanReadContent(currentSrc()); } ",1 "ServiceWorkerScriptContext::ServiceWorkerScriptContext( EmbeddedWorkerContextClient* embedded_context, blink::WebServiceWorkerContextProxy* proxy) : embedded_context_(embedded_context), proxy_(proxy), current_request_id_(kInvalidRequestId) { } ",0 "static void __munlock_isolated_page(struct page *page) { int ret = SWAP_AGAIN; /* * Optimization: if the page was mapped just once, that's our mapping * and we don't need to check all the other vmas. */ if (page_mapcount(page) > 1) ret = try_to_munlock(page); /* Did try_to_unlock() succeed or punt? */ if (ret != SWAP_MLOCK) count_vm_event(UNEVICTABLE_PGMUNLOCKED); putback_lru_page(page); } ",0 "bool DatabaseMessageFilter::OnMessageReceived( const IPC::Message& message, bool* message_was_ok) { bool handled = true; IPC_BEGIN_MESSAGE_MAP_EX(DatabaseMessageFilter, message, *message_was_ok) IPC_MESSAGE_HANDLER_DELAY_REPLY(DatabaseHostMsg_OpenFile, OnDatabaseOpenFile) IPC_MESSAGE_HANDLER_DELAY_REPLY(DatabaseHostMsg_DeleteFile, OnDatabaseDeleteFile) IPC_MESSAGE_HANDLER_DELAY_REPLY(DatabaseHostMsg_GetFileAttributes, OnDatabaseGetFileAttributes) IPC_MESSAGE_HANDLER_DELAY_REPLY(DatabaseHostMsg_GetFileSize, OnDatabaseGetFileSize) IPC_MESSAGE_HANDLER_DELAY_REPLY(DatabaseHostMsg_GetSpaceAvailable, OnDatabaseGetSpaceAvailable) IPC_MESSAGE_HANDLER(DatabaseHostMsg_Opened, OnDatabaseOpened) IPC_MESSAGE_HANDLER(DatabaseHostMsg_Modified, OnDatabaseModified) IPC_MESSAGE_HANDLER(DatabaseHostMsg_Closed, OnDatabaseClosed) IPC_MESSAGE_HANDLER(DatabaseHostMsg_HandleSqliteError, OnHandleSqliteError) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP_EX() return handled; } ",0 "static void tipc_sk_proto_rcv(struct tipc_sock *tsk, struct sk_buff *skb) { struct sock *sk = &tsk->sk; struct tipc_msg *hdr = buf_msg(skb); int mtyp = msg_type(hdr); bool conn_cong; /* Ignore if connection cannot be validated: */ if (!tsk_peer_msg(tsk, hdr)) goto exit; tsk->probing_state = TIPC_CONN_OK; if (mtyp == CONN_PROBE) { msg_set_type(hdr, CONN_PROBE_REPLY); tipc_sk_respond(sk, skb, TIPC_OK); return; } else if (mtyp == CONN_ACK) { conn_cong = tsk_conn_cong(tsk); tsk->snt_unacked -= msg_conn_ack(hdr); if (tsk->peer_caps & TIPC_BLOCK_FLOWCTL) tsk->snd_win = msg_adv_win(hdr); if (conn_cong) sk->sk_write_space(sk); } else if (mtyp != CONN_PROBE_REPLY) { pr_warn(""Received unknown CONN_PROTO msg\n""); } exit: kfree_skb(skb); } ",0 "OperationID FileSystemOperationRunner::Write( const FileSystemURL& url, mojo::ScopedDataPipeConsumerHandle data_pipe, int64_t offset, const WriteCallback& callback) { base::File::Error error = base::File::FILE_OK; std::unique_ptr operation = base::WrapUnique( file_system_context_->CreateFileSystemOperation(url, &error)); FileSystemOperation* operation_raw = operation.get(); OperationID id = BeginOperation(std::move(operation)); base::AutoReset beginning(&is_beginning_operation_, true); if (!operation_raw) { DidWrite(id, callback, error, 0, true); return id; } std::unique_ptr writer( file_system_context_->CreateFileStreamWriter(url, offset)); if (!writer) { DidWrite(id, callback, base::File::FILE_ERROR_SECURITY, 0, true); return id; } std::unique_ptr writer_delegate(new FileWriterDelegate( std::move(writer), url.mount_option().flush_policy())); PrepareForWrite(id, url); operation_raw->Write(url, std::move(writer_delegate), std::move(data_pipe), base::BindRepeating(&FileSystemOperationRunner::DidWrite, weak_ptr_, id, callback)); return id; } ",0 "int nfc_llcp_send_snl_sdreq(struct nfc_llcp_local *local, struct hlist_head *tlv_list, size_t tlvs_len) { struct nfc_llcp_sdp_tlv *sdreq; struct hlist_node *n; struct sk_buff *skb; skb = nfc_llcp_allocate_snl(local, tlvs_len); if (IS_ERR(skb)) return PTR_ERR(skb); mutex_lock(&local->sdreq_lock); if (hlist_empty(&local->pending_sdreqs)) mod_timer(&local->sdreq_timer, jiffies + msecs_to_jiffies(3 * local->remote_lto)); hlist_for_each_entry_safe(sdreq, n, tlv_list, node) { pr_debug(""tid %d for %s\n"", sdreq->tid, sdreq->uri); skb_put_data(skb, sdreq->tlv, sdreq->tlv_len); hlist_del(&sdreq->node); hlist_add_head(&sdreq->node, &local->pending_sdreqs); } mutex_unlock(&local->sdreq_lock); skb_queue_tail(&local->tx_queue, skb); return 0; } ",0 " string DecodeFile(const string& filename, int num_threads) { libvpx_test::WebMVideoSource video(filename); video.Init(); vpx_codec_dec_cfg_t cfg = {0}; cfg.threads = num_threads; libvpx_test::VP9Decoder decoder(cfg, 0); libvpx_test::MD5 md5; for (video.Begin(); video.cxdata(); video.Next()) { const vpx_codec_err_t res = decoder.DecodeFrame(video.cxdata(), video.frame_size()); if (res != VPX_CODEC_OK) { EXPECT_EQ(VPX_CODEC_OK, res) << decoder.DecodeError(); break; } libvpx_test::DxDataIterator dec_iter = decoder.GetDxData(); const vpx_image_t *img = NULL; while ((img = dec_iter.Next())) { md5.Add(img); } } return string(md5.Get()); } ",1 "bool PrintWebViewHelper::GetDefaultPrintSettings( WebFrame* frame, WebNode* node, ViewMsg_Print_Params* params) { IPC::SyncMessage* msg = new ViewHostMsg_GetDefaultPrintSettings(routing_id(), params); if (!Send(msg)) { NOTREACHED(); return false; } if (params->IsEmpty()) { render_view_->runModalAlertDialog( frame, l10n_util::GetStringUTF16(IDS_DEFAULT_PRINTER_NOT_FOUND_WARNING)); return false; } if (!(params->dpi && params->document_cookie)) { NOTREACHED(); return false; } UpdatePrintableSizeInPrintParameters(frame, node, params); return true; } ",0 "std::string FakeCentral::GetAddress() const { NOTREACHED(); return std::string(); } ",0 " bool error_called() const { return error_called_; } ",0 "rend_service_receive_introduction(origin_circuit_t *circuit, const uint8_t *request, size_t request_len) { /* Global status stuff */ int status = 0, result; const or_options_t *options = get_options(); char *err_msg = NULL; int err_msg_severity = LOG_WARN; const char *stage_descr = NULL, *rend_pk_digest; int reason = END_CIRC_REASON_TORPROTOCOL; /* Service/circuit/key stuff we can learn before parsing */ char serviceid[REND_SERVICE_ID_LEN_BASE32+1]; rend_service_t *service = NULL; rend_intro_point_t *intro_point = NULL; crypto_pk_t *intro_key = NULL; /* Parsed cell */ rend_intro_cell_t *parsed_req = NULL; /* Rendezvous point */ extend_info_t *rp = NULL; /* XXX not handled yet */ char buf[RELAY_PAYLOAD_SIZE]; char keys[DIGEST_LEN+CPATH_KEY_MATERIAL_LEN]; /* Holds KH, Df, Db, Kf, Kb */ int i; crypto_dh_t *dh = NULL; origin_circuit_t *launched = NULL; crypt_path_t *cpath = NULL; char hexcookie[9]; int circ_needs_uptime; time_t now = time(NULL); time_t elapsed; int replay; /* Do some initial validation and logging before we parse the cell */ if (circuit->base_.purpose != CIRCUIT_PURPOSE_S_INTRO) { log_warn(LD_PROTOCOL, ""Got an INTRODUCE2 over a non-introduction circuit %u."", (unsigned) circuit->base_.n_circ_id); goto err; } assert_circ_anonymity_ok(circuit, options); tor_assert(circuit->rend_data); /* XXX: This is version 2 specific (only one supported). */ rend_pk_digest = (char *) rend_data_get_pk_digest(circuit->rend_data, NULL); /* We'll use this in a bazillion log messages */ base32_encode(serviceid, REND_SERVICE_ID_LEN_BASE32+1, rend_pk_digest, REND_SERVICE_ID_LEN); /* look up service depending on circuit. */ service = rend_service_get_by_pk_digest(rend_pk_digest); if (!service) { log_warn(LD_BUG, ""Internal error: Got an INTRODUCE2 cell on an intro "" ""circ for an unrecognized service %s."", escaped(serviceid)); goto err; } intro_point = find_intro_point(circuit); if (intro_point == NULL) { intro_point = find_expiring_intro_point(service, circuit); if (intro_point == NULL) { log_warn(LD_BUG, ""Internal error: Got an INTRODUCE2 cell on an "" ""intro circ (for service %s) with no corresponding "" ""rend_intro_point_t."", escaped(serviceid)); goto err; } } log_info(LD_REND, ""Received INTRODUCE2 cell for service %s on circ %u."", escaped(serviceid), (unsigned)circuit->base_.n_circ_id); /* use intro key instead of service key. */ intro_key = circuit->intro_key; tor_free(err_msg); stage_descr = NULL; stage_descr = ""early parsing""; /* Early parsing pass (get pk, ciphertext); type 2 is INTRODUCE2 */ parsed_req = rend_service_begin_parse_intro(request, request_len, 2, &err_msg); if (!parsed_req) { goto log_error; } else if (err_msg) { log_info(LD_REND, ""%s on circ %u."", err_msg, (unsigned)circuit->base_.n_circ_id); tor_free(err_msg); } /* make sure service replay caches are present */ if (!service->accepted_intro_dh_parts) { service->accepted_intro_dh_parts = replaycache_new(REND_REPLAY_TIME_INTERVAL, REND_REPLAY_TIME_INTERVAL); } if (!intro_point->accepted_intro_rsa_parts) { intro_point->accepted_intro_rsa_parts = replaycache_new(0, 0); } /* check for replay of PK-encrypted portion. */ replay = replaycache_add_test_and_elapsed( intro_point->accepted_intro_rsa_parts, parsed_req->ciphertext, parsed_req->ciphertext_len, &elapsed); if (replay) { log_warn(LD_REND, ""Possible replay detected! We received an "" ""INTRODUCE2 cell with same PK-encrypted part %d "" ""seconds ago. Dropping cell."", (int)elapsed); goto err; } stage_descr = ""decryption""; /* Now try to decrypt it */ result = rend_service_decrypt_intro(parsed_req, intro_key, &err_msg); if (result < 0) { goto log_error; } else if (err_msg) { log_info(LD_REND, ""%s on circ %u."", err_msg, (unsigned)circuit->base_.n_circ_id); tor_free(err_msg); } stage_descr = ""late parsing""; /* Parse the plaintext */ result = rend_service_parse_intro_plaintext(parsed_req, &err_msg); if (result < 0) { goto log_error; } else if (err_msg) { log_info(LD_REND, ""%s on circ %u."", err_msg, (unsigned)circuit->base_.n_circ_id); tor_free(err_msg); } stage_descr = ""late validation""; /* Validate the parsed plaintext parts */ result = rend_service_validate_intro_late(parsed_req, &err_msg); if (result < 0) { goto log_error; } else if (err_msg) { log_info(LD_REND, ""%s on circ %u."", err_msg, (unsigned)circuit->base_.n_circ_id); tor_free(err_msg); } stage_descr = NULL; /* Increment INTRODUCE2 counter */ ++(intro_point->accepted_introduce2_count); /* Find the rendezvous point */ rp = find_rp_for_intro(parsed_req, &err_msg); if (!rp) { err_msg_severity = LOG_PROTOCOL_WARN; goto log_error; } /* Check if we'd refuse to talk to this router */ if (options->StrictNodes && routerset_contains_extendinfo(options->ExcludeNodes, rp)) { log_warn(LD_REND, ""Client asked to rendezvous at a relay that we "" ""exclude, and StrictNodes is set. Refusing service.""); reason = END_CIRC_REASON_INTERNAL; /* XXX might leak why we refused */ goto err; } base16_encode(hexcookie, 9, (const char *)(parsed_req->rc), 4); /* Check whether there is a past request with the same Diffie-Hellman, * part 1. */ replay = replaycache_add_test_and_elapsed( service->accepted_intro_dh_parts, parsed_req->dh, DH_KEY_LEN, &elapsed); if (replay) { /* A Tor client will send a new INTRODUCE1 cell with the same rend * cookie and DH public key as its previous one if its intro circ * times out while in state CIRCUIT_PURPOSE_C_INTRODUCE_ACK_WAIT . * If we received the first INTRODUCE1 cell (the intro-point relay * converts it into an INTRODUCE2 cell), we are already trying to * connect to that rend point (and may have already succeeded); * drop this cell. */ log_info(LD_REND, ""We received an "" ""INTRODUCE2 cell with same first part of "" ""Diffie-Hellman handshake %d seconds ago. Dropping "" ""cell."", (int) elapsed); goto err; } /* If the service performs client authorization, check included auth data. */ if (service->clients) { if (parsed_req->version == 3 && parsed_req->u.v3.auth_len > 0) { if (rend_check_authorization(service, (const char*)parsed_req->u.v3.auth_data, parsed_req->u.v3.auth_len)) { log_info(LD_REND, ""Authorization data in INTRODUCE2 cell are valid.""); } else { log_info(LD_REND, ""The authorization data that are contained in "" ""the INTRODUCE2 cell are invalid. Dropping cell.""); reason = END_CIRC_REASON_CONNECTFAILED; goto err; } } else { log_info(LD_REND, ""INTRODUCE2 cell does not contain authentication "" ""data, but we require client authorization. Dropping cell.""); reason = END_CIRC_REASON_CONNECTFAILED; goto err; } } /* Try DH handshake... */ dh = crypto_dh_new(DH_TYPE_REND); if (!dh || crypto_dh_generate_public(dh)<0) { log_warn(LD_BUG,""Internal error: couldn't build DH state "" ""or generate public key.""); reason = END_CIRC_REASON_INTERNAL; goto err; } if (crypto_dh_compute_secret(LOG_PROTOCOL_WARN, dh, (char *)(parsed_req->dh), DH_KEY_LEN, keys, DIGEST_LEN+CPATH_KEY_MATERIAL_LEN)<0) { log_warn(LD_BUG, ""Internal error: couldn't complete DH handshake""); reason = END_CIRC_REASON_INTERNAL; goto err; } circ_needs_uptime = rend_service_requires_uptime(service); /* help predict this next time */ rep_hist_note_used_internal(now, circ_needs_uptime, 1); /* Launch a circuit to the client's chosen rendezvous point. */ for (i=0;ibuild_state); /* Fill in the circuit's state. */ launched->rend_data = rend_data_service_create(service->service_id, rend_pk_digest, parsed_req->rc, service->auth_type); launched->build_state->service_pending_final_cpath_ref = tor_malloc_zero(sizeof(crypt_path_reference_t)); launched->build_state->service_pending_final_cpath_ref->refcount = 1; launched->build_state->service_pending_final_cpath_ref->cpath = cpath = tor_malloc_zero(sizeof(crypt_path_t)); cpath->magic = CRYPT_PATH_MAGIC; launched->build_state->expiry_time = now + MAX_REND_TIMEOUT; cpath->rend_dh_handshake_state = dh; dh = NULL; if (circuit_init_cpath_crypto(cpath,keys+DIGEST_LEN,1)<0) goto err; memcpy(cpath->rend_circ_nonce, keys, DIGEST_LEN); goto done; log_error: if (!err_msg) { if (stage_descr) { tor_asprintf(&err_msg, ""unknown %s error for INTRODUCE2"", stage_descr); } else { err_msg = tor_strdup(""unknown error for INTRODUCE2""); } } log_fn(err_msg_severity, LD_REND, ""%s on circ %u"", err_msg, (unsigned)circuit->base_.n_circ_id); err: status = -1; if (dh) crypto_dh_free(dh); if (launched) { circuit_mark_for_close(TO_CIRCUIT(launched), reason); } tor_free(err_msg); done: memwipe(keys, 0, sizeof(keys)); memwipe(buf, 0, sizeof(buf)); memwipe(serviceid, 0, sizeof(serviceid)); memwipe(hexcookie, 0, sizeof(hexcookie)); /* Free the parsed cell */ rend_service_free_intro(parsed_req); /* Free rp */ extend_info_free(rp); return status; } ",0 "check_log_dir() { const char *f; Directory dir(Log, PRIV_ROOT); StringList invalid; invalid.initializeFromString (InvalidLogFiles ? InvalidLogFiles : """"); while( (f = dir.Next()) ) { if( invalid.contains(f) ) { bad_file( Log, f, dir ); } else { good_file( Log, f ); } } } ",0 "bool ProfileSyncService::SetDecryptionPassphrase( const std::string& passphrase) { if (IsPassphraseRequired()) { DVLOG(1) << ""Setting passphrase for decryption.""; return backend_->SetDecryptionPassphrase(passphrase); } else { NOTREACHED() << ""SetDecryptionPassphrase must not be called when "" ""IsPassphraseRequired() is false.""; return false; } } ",0 "void RequestSender::OnNetworkFetcherComplete( const GURL& original_url, std::unique_ptr response_body, int net_error, const std::string& header_etag, int64_t xheader_retry_after_sec) { DCHECK(thread_checker_.CalledOnValidThread()); VLOG(1) << ""request completed from url: "" << original_url.spec(); int error = -1; if (response_body && response_code_ == 200) { DCHECK_EQ(0, net_error); error = 0; } else if (response_code_ != -1) { error = response_code_; } else { error = net_error; } int retry_after_sec = -1; if (original_url.SchemeIsCryptographic() && error > 0) retry_after_sec = base::saturated_cast(xheader_retry_after_sec); base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&RequestSender::SendInternalComplete, base::Unretained(this), error, response_body ? *response_body : std::string(), header_etag, retry_after_sec)); } ",1 "mailimf_optional_field_parse(const char * message, size_t length, size_t * indx, struct mailimf_optional_field ** result) { char * name; char * value; struct mailimf_optional_field * optional_field; size_t cur_token; int r; int res; cur_token = * indx; r = mailimf_field_name_parse(message, length, &cur_token, &name); if (r != MAILIMF_NO_ERROR) { res = r; goto err; } r = mailimf_colon_parse(message, length, &cur_token); if (r != MAILIMF_NO_ERROR) { res = r; goto free_name; } r = mailimf_unstructured_parse(message, length, &cur_token, &value); if (r != MAILIMF_NO_ERROR) { res = r; goto free_name; } r = mailimf_unstrict_crlf_parse(message, length, &cur_token); if (r != MAILIMF_NO_ERROR) { res = r; goto free_value; } optional_field = mailimf_optional_field_new(name, value); if (optional_field == NULL) { res = MAILIMF_ERROR_MEMORY; goto free_value; } * result = optional_field; * indx = cur_token; return MAILIMF_NO_ERROR; free_value: mailimf_unstructured_free(value); free_name: mailimf_field_name_free(name); err: return res; } ",0 "static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSbyteSlong(int32 value) { if ((value<-0x80)||(value>0x7F)) return(TIFFReadDirEntryErrRange); else return(TIFFReadDirEntryErrOk); } ",0 "static inline bool cpu_need_tpr_shadow(struct kvm_vcpu *vcpu) { return cpu_has_vmx_tpr_shadow() && lapic_in_kernel(vcpu); } ",0 "bool DoTitlesDiffer(const MostVisitedURLList& old_list, const MostVisitedURLList& new_list) { if (old_list.size() != new_list.size()) return true; return !std::equal(std::begin(old_list), std::end(old_list), std::begin(new_list), [](const auto& old_item_ptr, const auto& new_item_ptr) { return old_item_ptr.title == new_item_ptr.title; }); } ",0 "void AutofillDialogViews::UpdateButtonStripExtraView() { save_in_chrome_checkbox_container_->SetVisible( delegate_->ShouldOfferToSaveInChrome()); gfx::Image image = delegate_->ButtonStripImage(); button_strip_image_->SetVisible(!image.IsEmpty()); button_strip_image_->SetImage(image.AsImageSkia()); } ",0 "static int encrypt_and_sign_nss_2_2 ( struct crypto_instance *instance, const unsigned char *buf_in, const size_t buf_in_len, unsigned char *buf_out, size_t *buf_out_len) { if (encrypt_nss(instance, buf_in, buf_in_len, buf_out + sizeof(struct crypto_config_header), buf_out_len) < 0) { return -1; } *buf_out_len += sizeof(struct crypto_config_header); if (hash_to_nss[instance->crypto_hash_type]) { if (calculate_nss_hash(instance, buf_out, *buf_out_len, buf_out + *buf_out_len) < 0) { return -1; } *buf_out_len += hash_len[instance->crypto_hash_type]; } return 0; } ",0 "struct file *perf_event_get(unsigned int fd) { struct file *file; file = fget_raw(fd); if (!file) return ERR_PTR(-EBADF); if (file->f_op != &perf_fops) { fput(file); return ERR_PTR(-EBADF); } return file; } ",0 "void DevToolsDataSource::StartCustomDataRequest( const GURL& url, const content::URLDataSource::GotDataCallback& callback) { if (!url.is_valid()) { callback.Run( new base::RefCountedStaticMemory(kHttpNotFound, strlen(kHttpNotFound))); return; } net::URLFetcher* fetcher = net::URLFetcher::Create(url, net::URLFetcher::GET, this).release(); pending_[fetcher] = callback; fetcher->SetRequestContext(request_context_.get()); fetcher->SetLoadFlags(net::LOAD_DISABLE_CACHE); fetcher->Start(); } ",0 "bool InsertText(const base::string16& text) { keyboard::KeyboardController* controller = KeyboardController::GetInstance(); if (!controller) return false; ui::InputMethod* input_method = controller->proxy()->GetInputMethod(); if (!input_method) return false; ui::TextInputClient* tic = input_method->GetTextInputClient(); if (!tic || tic->GetTextInputType() == ui::TEXT_INPUT_TYPE_NONE) return false; tic->InsertText(text); return true; } ",0 "void ReleaseProcessIfNeeded() { content::UtilityThread::Get()->ReleaseProcessIfNeeded(); } ",0 "kvm_pfn_t gfn_to_pfn_memslot_atomic(struct kvm_memory_slot *slot, gfn_t gfn) { return __gfn_to_pfn_memslot(slot, gfn, true, NULL, true, NULL); } ",0 "ssize_t MediaHTTP::readAt(off64_t offset, void *data, size_t size) { if (mInitCheck != OK) { return mInitCheck; } int64_t startTimeUs = ALooper::GetNowUs(); size_t numBytesRead = 0; while (numBytesRead < size) { size_t copy = size - numBytesRead; if (copy > 64 * 1024) { copy = 64 * 1024; } ssize_t n = mHTTPConnection->readAt( offset + numBytesRead, (uint8_t *)data + numBytesRead, copy); if (n < 0) { return n; } else if (n == 0) { break; } numBytesRead += n; } int64_t delayUs = ALooper::GetNowUs() - startTimeUs; addBandwidthMeasurement(numBytesRead, delayUs); return numBytesRead; } ",0 "bool MediaElementAudioSourceHandler::PassesCORSAccessCheck() { DCHECK(MediaElement()); return (MediaElement()->GetWebMediaPlayer() && MediaElement()->GetWebMediaPlayer()->DidPassCORSAccessCheck()) || passes_current_src_cors_access_check_; } ",1 "String HTMLFormControlElement::nameForAutofill() const { String fullName = name(); String trimmedName = fullName.stripWhiteSpace(); if (!trimmedName.isEmpty()) return trimmedName; fullName = getIdAttribute(); trimmedName = fullName.stripWhiteSpace(); return trimmedName; } ",0 "dissect_rpcap_startcap_request (tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, gint offset) { proto_tree *tree, *field_tree; proto_item *ti, *field_ti; guint16 flags; ti = proto_tree_add_item (parent_tree, hf_startcap_request, tvb, offset, -1, ENC_NA); tree = proto_item_add_subtree (ti, ett_startcap_request); proto_tree_add_item (tree, hf_snaplen, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; proto_tree_add_item (tree, hf_read_timeout, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; flags = tvb_get_ntohs (tvb, offset); field_ti = proto_tree_add_uint_format (tree, hf_flags, tvb, offset, 2, flags, ""Flags""); field_tree = proto_item_add_subtree (field_ti, ett_startcap_flags); proto_tree_add_item (field_tree, hf_flags_promisc, tvb, offset, 2, ENC_BIG_ENDIAN); proto_tree_add_item (field_tree, hf_flags_dgram, tvb, offset, 2, ENC_BIG_ENDIAN); proto_tree_add_item (field_tree, hf_flags_serveropen, tvb, offset, 2, ENC_BIG_ENDIAN); proto_tree_add_item (field_tree, hf_flags_inbound, tvb, offset, 2, ENC_BIG_ENDIAN); proto_tree_add_item (field_tree, hf_flags_outbound, tvb, offset, 2, ENC_BIG_ENDIAN); if (flags & 0x1F) { gchar *flagstr = wmem_strdup_printf (wmem_packet_scope(), ""%s%s%s%s%s"", (flags & FLAG_PROMISC) ? "", Promiscuous"" : """", (flags & FLAG_DGRAM) ? "", Datagram"" : """", (flags & FLAG_SERVEROPEN) ? "", ServerOpen"" : """", (flags & FLAG_INBOUND) ? "", Inbound"" : """", (flags & FLAG_OUTBOUND) ? "", Outbound"" : """"); proto_item_append_text (field_ti, "":%s"", &flagstr[1]); } else { proto_item_append_text (field_ti, "" (none)""); } offset += 2; proto_tree_add_item (tree, hf_client_port, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; dissect_rpcap_filter (tvb, pinfo, tree, offset); } ",0 "static void mov_free(AVFormatContext *s) { MOVMuxContext *mov = s->priv_data; int i; if (mov->chapter_track) { if (mov->tracks[mov->chapter_track].par) av_freep(&mov->tracks[mov->chapter_track].par->extradata); av_freep(&mov->tracks[mov->chapter_track].par); } for (i = 0; i < mov->nb_streams; i++) { if (mov->tracks[i].tag == MKTAG('r','t','p',' ')) ff_mov_close_hinting(&mov->tracks[i]); else if (mov->tracks[i].tag == MKTAG('t','m','c','d') && mov->nb_meta_tmcd) av_freep(&mov->tracks[i].par); av_freep(&mov->tracks[i].cluster); av_freep(&mov->tracks[i].frag_info); av_packet_unref(&mov->tracks[i].cover_image); if (mov->tracks[i].vos_len) av_freep(&mov->tracks[i].vos_data); ff_mov_cenc_free(&mov->tracks[i].cenc); } av_freep(&mov->tracks); } ",0 "void VideoCaptureManager::ReleaseDevices() { DCHECK_CURRENTLY_ON(BrowserThread::IO); for (auto& controller : controllers_) { if (controller->stream_type() != MEDIA_DEVICE_VIDEO_CAPTURE) continue; DoStopDevice(controller.get()); } } ",0 "static inline u64 btrfs_inc_tree_mod_seq(struct btrfs_fs_info *fs_info) { return atomic64_inc_return(&fs_info->tree_mod_seq); } ",0 "void ProfileSyncService::OnUnrecoverableErrorImpl( const tracked_objects::Location& from_here, const std::string& message, bool delete_sync_database) { unrecoverable_error_detected_ = true; unrecoverable_error_message_ = message; unrecoverable_error_location_ = from_here; NotifyObservers(); std::string location; from_here.Write(true, true, &location); LOG(ERROR) << ""Unrecoverable error detected at "" << location << "" -- ProfileSyncService unusable: "" << message; MessageLoop::current()->PostTask(FROM_HERE, base::Bind(&ProfileSyncService::ShutdownImpl, weak_factory_.GetWeakPtr(), delete_sync_database)); } ",0 "e1000e_ring_head_descr(E1000ECore *core, const E1000E_RingInfo *r) { return e1000e_ring_base(core, r) + E1000_RING_DESC_LEN * core->mac[r->dh]; } ",0 "int bpf_check(struct bpf_prog **prog, union bpf_attr *attr, union bpf_attr __user *uattr) { struct bpf_verifier_env *env; struct bpf_verifier_log *log; int ret = -EINVAL; /* no program is valid */ if (ARRAY_SIZE(bpf_verifier_ops) == 0) return -EINVAL; /* 'struct bpf_verifier_env' can be global, but since it's not small, * allocate/free it every time bpf_check() is called */ env = kzalloc(sizeof(struct bpf_verifier_env), GFP_KERNEL); if (!env) return -ENOMEM; log = &env->log; env->insn_aux_data = vzalloc(array_size(sizeof(struct bpf_insn_aux_data), (*prog)->len)); ret = -ENOMEM; if (!env->insn_aux_data) goto err_free_env; env->prog = *prog; env->ops = bpf_verifier_ops[env->prog->type]; /* grab the mutex to protect few globals used by verifier */ mutex_lock(&bpf_verifier_lock); if (attr->log_level || attr->log_buf || attr->log_size) { /* user requested verbose verifier output * and supplied buffer to store the verification trace */ log->level = attr->log_level; log->ubuf = (char __user *) (unsigned long) attr->log_buf; log->len_total = attr->log_size; ret = -EINVAL; /* log attributes have to be sane */ if (log->len_total < 128 || log->len_total > UINT_MAX >> 8 || !log->level || !log->ubuf) goto err_unlock; } env->strict_alignment = !!(attr->prog_flags & BPF_F_STRICT_ALIGNMENT); if (!IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)) env->strict_alignment = true; if (attr->prog_flags & BPF_F_ANY_ALIGNMENT) env->strict_alignment = false; ret = replace_map_fd_with_map_ptr(env); if (ret < 0) goto skip_full_check; if (bpf_prog_is_dev_bound(env->prog->aux)) { ret = bpf_prog_offload_verifier_prep(env->prog); if (ret) goto skip_full_check; } env->explored_states = kcalloc(env->prog->len, sizeof(struct bpf_verifier_state_list *), GFP_USER); ret = -ENOMEM; if (!env->explored_states) goto skip_full_check; env->allow_ptr_leaks = capable(CAP_SYS_ADMIN); ret = check_subprogs(env); if (ret < 0) goto skip_full_check; ret = check_btf_info(env, attr, uattr); if (ret < 0) goto skip_full_check; ret = check_cfg(env); if (ret < 0) goto skip_full_check; ret = do_check(env); if (env->cur_state) { free_verifier_state(env->cur_state, true); env->cur_state = NULL; } if (ret == 0 && bpf_prog_is_dev_bound(env->prog->aux)) ret = bpf_prog_offload_finalize(env); skip_full_check: while (!pop_stack(env, NULL, NULL)); free_states(env); if (ret == 0) ret = check_max_stack_depth(env); /* instruction rewrites happen after this point */ if (ret == 0) sanitize_dead_code(env); if (ret == 0) /* program is valid, convert *(u32*)(ctx + off) accesses */ ret = convert_ctx_accesses(env); if (ret == 0) ret = fixup_bpf_calls(env); if (ret == 0) ret = fixup_call_args(env); if (log->level && bpf_verifier_log_full(log)) ret = -ENOSPC; if (log->level && !log->ubuf) { ret = -EFAULT; goto err_release_maps; } if (ret == 0 && env->used_map_cnt) { /* if program passed verifier, update used_maps in bpf_prog_info */ env->prog->aux->used_maps = kmalloc_array(env->used_map_cnt, sizeof(env->used_maps[0]), GFP_KERNEL); if (!env->prog->aux->used_maps) { ret = -ENOMEM; goto err_release_maps; } memcpy(env->prog->aux->used_maps, env->used_maps, sizeof(env->used_maps[0]) * env->used_map_cnt); env->prog->aux->used_map_cnt = env->used_map_cnt; /* program is valid. Convert pseudo bpf_ld_imm64 into generic * bpf_ld_imm64 instructions */ convert_pseudo_ld_imm64(env); } if (ret == 0) adjust_btf_func(env); err_release_maps: if (!env->prog->aux->used_maps) /* if we didn't copy map pointers into bpf_prog_info, release * them now. Otherwise free_used_maps() will release them. */ release_maps(env); *prog = env->prog; err_unlock: mutex_unlock(&bpf_verifier_lock); vfree(env->insn_aux_data); err_free_env: kfree(env); return ret; } ",0 "static void e1000e_update_flowctl_status(E1000ECore *core) { if (e1000e_have_autoneg(core) && core->phy[0][PHY_STATUS] & MII_SR_AUTONEG_COMPLETE) { trace_e1000e_link_autoneg_flowctl(true); core->mac[CTRL] |= E1000_CTRL_TFCE | E1000_CTRL_RFCE; } else { trace_e1000e_link_autoneg_flowctl(false); } } ",0 "void AutoFillManager::FillFormField(const AutoFillProfile* profile, AutoFillType type, webkit_glue::FormField* field) { DCHECK(profile); DCHECK(field); if (type.subgroup() == AutoFillType::PHONE_NUMBER) { FillPhoneNumberField(profile, field); } else { if (field->form_control_type() == ASCIIToUTF16(""select-one"")) FillSelectOneField(profile, type, field); else field->set_value(profile->GetFieldText(type)); } } ",0 "void WorkerThread::willEnterNestedLoop() { InspectorInstrumentation::willEnterNestedRunLoop(m_workerGlobalScope.get()); } ",0 "void Document::processViewport(const String& features, ViewportArguments::Type origin) { ASSERT(!features.isNull()); if (origin < m_viewportArguments.type) return; m_viewportArguments = ViewportArguments(origin); processArguments(features, (void*)&m_viewportArguments, &setViewportFeature); updateViewportArguments(); } ",0 "vcard_apdu_set_length(VCardAPDU *apdu) { int L, Le; /* process according to table 5 of the 7816-4 Part 4 spec. * variable names match the variables in the spec */ L = apdu->a_len-4; /* fixed APDU header */ apdu->a_Lc = 0; apdu->a_Le = 0; apdu->a_body = NULL; switch (L) { case 0: /* 1 minimal apdu */ return VCARD7816_STATUS_SUCCESS; case 1: /* 2S only return values apdu */ /* zero maps to 256 here */ apdu->a_Le = apdu->a_header->ah_Le ? apdu->a_header->ah_Le : 256; return VCARD7816_STATUS_SUCCESS; default: /* if the ah_Le byte is zero and we have more than * 1 byte in the header, then we must be using extended Le and Lc. * process the extended now. */ if (apdu->a_header->ah_Le == 0) { if (L < 3) { /* coding error, need at least 3 bytes */ return VCARD7816_STATUS_ERROR_WRONG_LENGTH; } /* calculate the first extended value. Could be either Le or Lc */ Le = (apdu->a_header->ah_body[0] << 8) | apdu->a_header->ah_body[1]; if (L == 3) { /* 2E extended, return data only */ /* zero maps to 65536 */ apdu->a_Le = Le ? Le : 65536; return VCARD7816_STATUS_SUCCESS; } if (Le == 0) { /* reserved for future use, probably for next time we need * to extend the lengths */ return VCARD7816_STATUS_ERROR_WRONG_LENGTH; } /* we know that the first extended value is Lc now */ apdu->a_Lc = Le; apdu->a_body = &apdu->a_header->ah_body[2]; if (L == Le+3) { /* 3E extended, only body parameters */ return VCARD7816_STATUS_SUCCESS; } if (L == Le+5) { /* 4E extended, parameters and return data */ Le = (apdu->a_data[apdu->a_len-2] << 8) | apdu->a_data[apdu->a_len-1]; apdu->a_Le = Le ? Le : 65536; return VCARD7816_STATUS_SUCCESS; } return VCARD7816_STATUS_ERROR_WRONG_LENGTH; } /* not extended */ apdu->a_Lc = apdu->a_header->ah_Le; apdu->a_body = &apdu->a_header->ah_body[0]; if (L == apdu->a_Lc + 1) { /* 3S only body parameters */ return VCARD7816_STATUS_SUCCESS; } if (L == apdu->a_Lc + 2) { /* 4S parameters and return data */ Le = apdu->a_data[apdu->a_len-1]; apdu->a_Le = Le ? Le : 256; return VCARD7816_STATUS_SUCCESS; } break; } return VCARD7816_STATUS_ERROR_WRONG_LENGTH; } ",0 "static int uio_get_minor(struct uio_device *idev) { int retval = -ENOMEM; mutex_lock(&minor_lock); retval = idr_alloc(&uio_idr, idev, 0, UIO_MAX_DEVICES, GFP_KERNEL); if (retval >= 0) { idev->minor = retval; retval = 0; } else if (retval == -ENOSPC) { dev_err(idev->dev, ""too many uio devices\n""); retval = -EINVAL; } mutex_unlock(&minor_lock); return retval; } ",0 "void CLASS phase_one_flat_field (int is_float, int nc) { ushort head[8]; unsigned wide, y, x, rend, cend, row, col; int c; 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 < (unsigned)(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 "static void mac80211_hwsim_get_et_strings(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u32 sset, u8 *data) { if (sset == ETH_SS_STATS) memcpy(data, *mac80211_hwsim_gstrings_stats, sizeof(mac80211_hwsim_gstrings_stats)); } ",0 "ui::ResourceManager& CompositorImpl::GetResourceManager() { return resource_manager_; } ",0 "void NuPlayer::GenericSource::schedulePollBuffering() { sp msg = new AMessage(kWhatPollBuffering, id()); msg->setInt32(""generation"", mPollBufferingGeneration); msg->post(1000000ll); } ",0 "poppler_color_free (PopplerColor *color) { g_free (color); } ",0 "do_get_write_access(handle_t *handle, struct journal_head *jh, int force_copy) { struct buffer_head *bh; transaction_t *transaction; journal_t *journal; int error; char *frozen_buffer = NULL; int need_copy = 0; if (is_handle_aborted(handle)) return -EROFS; transaction = handle->h_transaction; journal = transaction->t_journal; jbd_debug(5, ""journal_head %p, force_copy %d\n"", jh, force_copy); JBUFFER_TRACE(jh, ""entry""); repeat: bh = jh2bh(jh); /* @@@ Need to check for errors here at some point. */ lock_buffer(bh); jbd_lock_bh_state(bh); /* We now hold the buffer lock so it is safe to query the buffer * state. Is the buffer dirty? * * If so, there are two possibilities. The buffer may be * non-journaled, and undergoing a quite legitimate writeback. * Otherwise, it is journaled, and we don't expect dirty buffers * in that state (the buffers should be marked JBD_Dirty * instead.) So either the IO is being done under our own * control and this is a bug, or it's a third party IO such as * dump(8) (which may leave the buffer scheduled for read --- * ie. locked but not dirty) or tune2fs (which may actually have * the buffer dirtied, ugh.) */ if (buffer_dirty(bh)) { /* * First question: is this buffer already part of the current * transaction or the existing committing transaction? */ if (jh->b_transaction) { J_ASSERT_JH(jh, jh->b_transaction == transaction || jh->b_transaction == journal->j_committing_transaction); if (jh->b_next_transaction) J_ASSERT_JH(jh, jh->b_next_transaction == transaction); warn_dirty_buffer(bh); } /* * In any case we need to clean the dirty flag and we must * do it under the buffer lock to be sure we don't race * with running write-out. */ JBUFFER_TRACE(jh, ""Journalling dirty buffer""); clear_buffer_dirty(bh); set_buffer_jbddirty(bh); } unlock_buffer(bh); error = -EROFS; if (is_handle_aborted(handle)) { jbd_unlock_bh_state(bh); goto out; } error = 0; /* * The buffer is already part of this transaction if b_transaction or * b_next_transaction points to it */ if (jh->b_transaction == transaction || jh->b_next_transaction == transaction) goto done; /* * this is the first time this transaction is touching this buffer, * reset the modified flag */ jh->b_modified = 0; /* * If there is already a copy-out version of this buffer, then we don't * need to make another one */ if (jh->b_frozen_data) { JBUFFER_TRACE(jh, ""has frozen data""); J_ASSERT_JH(jh, jh->b_next_transaction == NULL); jh->b_next_transaction = transaction; goto done; } /* Is there data here we need to preserve? */ if (jh->b_transaction && jh->b_transaction != transaction) { JBUFFER_TRACE(jh, ""owned by older transaction""); J_ASSERT_JH(jh, jh->b_next_transaction == NULL); J_ASSERT_JH(jh, jh->b_transaction == journal->j_committing_transaction); /* There is one case we have to be very careful about. * If the committing transaction is currently writing * this buffer out to disk and has NOT made a copy-out, * then we cannot modify the buffer contents at all * right now. The essence of copy-out is that it is the * extra copy, not the primary copy, which gets * journaled. If the primary copy is already going to * disk then we cannot do copy-out here. */ if (jh->b_jlist == BJ_Shadow) { DEFINE_WAIT_BIT(wait, &bh->b_state, BH_Unshadow); wait_queue_head_t *wqh; wqh = bit_waitqueue(&bh->b_state, BH_Unshadow); JBUFFER_TRACE(jh, ""on shadow: sleep""); jbd_unlock_bh_state(bh); /* commit wakes up all shadow buffers after IO */ for ( ; ; ) { prepare_to_wait(wqh, &wait.wait, TASK_UNINTERRUPTIBLE); if (jh->b_jlist != BJ_Shadow) break; schedule(); } finish_wait(wqh, &wait.wait); goto repeat; } /* Only do the copy if the currently-owning transaction * still needs it. If it is on the Forget list, the * committing transaction is past that stage. The * buffer had better remain locked during the kmalloc, * but that should be true --- we hold the journal lock * still and the buffer is already on the BUF_JOURNAL * list so won't be flushed. * * Subtle point, though: if this is a get_undo_access, * then we will be relying on the frozen_data to contain * the new value of the committed_data record after the * transaction, so we HAVE to force the frozen_data copy * in that case. */ if (jh->b_jlist != BJ_Forget || force_copy) { JBUFFER_TRACE(jh, ""generate frozen data""); if (!frozen_buffer) { JBUFFER_TRACE(jh, ""allocate memory for buffer""); jbd_unlock_bh_state(bh); frozen_buffer = jbd2_alloc(jh2bh(jh)->b_size, GFP_NOFS); if (!frozen_buffer) { printk(KERN_EMERG ""%s: OOM for frozen_buffer\n"", __func__); JBUFFER_TRACE(jh, ""oom!""); error = -ENOMEM; jbd_lock_bh_state(bh); goto done; } goto repeat; } jh->b_frozen_data = frozen_buffer; frozen_buffer = NULL; need_copy = 1; } jh->b_next_transaction = transaction; } /* * Finally, if the buffer is not journaled right now, we need to make * sure it doesn't get written to disk before the caller actually * commits the new data */ if (!jh->b_transaction) { JBUFFER_TRACE(jh, ""no transaction""); J_ASSERT_JH(jh, !jh->b_next_transaction); JBUFFER_TRACE(jh, ""file as BJ_Reserved""); spin_lock(&journal->j_list_lock); __jbd2_journal_file_buffer(jh, transaction, BJ_Reserved); spin_unlock(&journal->j_list_lock); } done: if (need_copy) { struct page *page; int offset; char *source; J_EXPECT_JH(jh, buffer_uptodate(jh2bh(jh)), ""Possible IO failure.\n""); page = jh2bh(jh)->b_page; offset = offset_in_page(jh2bh(jh)->b_data); source = kmap_atomic(page, KM_USER0); /* Fire data frozen trigger just before we copy the data */ jbd2_buffer_frozen_trigger(jh, source + offset, jh->b_triggers); memcpy(jh->b_frozen_data, source+offset, jh2bh(jh)->b_size); kunmap_atomic(source, KM_USER0); /* * Now that the frozen data is saved off, we need to store * any matching triggers. */ jh->b_frozen_triggers = jh->b_triggers; } jbd_unlock_bh_state(bh); /* * If we are about to journal a buffer, then any revoke pending on it is * no longer valid */ jbd2_journal_cancel_revoke(handle, jh); out: if (unlikely(frozen_buffer)) /* It's usually NULL */ jbd2_free(frozen_buffer, bh->b_size); JBUFFER_TRACE(jh, ""exit""); return error; } ",0 "dissect_usb_vid_control_info(proto_tree *tree, tvbuff_t *tvb, int offset) { static const int *capability_bits[] = { &hf_usb_vid_control_info_D[0], &hf_usb_vid_control_info_D[1], &hf_usb_vid_control_info_D[2], &hf_usb_vid_control_info_D[3], &hf_usb_vid_control_info_D[4], &hf_usb_vid_control_info_D[5], &hf_usb_vid_control_info_D[6], NULL }; DISSECTOR_ASSERT(array_length(capability_bits) == (1+array_length(hf_usb_vid_control_info_D))); proto_tree_add_bitmask(tree, tvb, offset, hf_usb_vid_control_info, ett_control_capabilities, capability_bits, ENC_NA); return offset+1; } ",0 "static PHP_GINIT_FUNCTION(xml) { xml_globals->default_encoding = ""UTF-8""; } ",0 "bool Extension::GenerateId(const std::string& input, std::string* output) { DCHECK(output); uint8 hash[Extension::kIdSize]; crypto::SHA256HashString(input, hash, sizeof(hash)); *output = StringToLowerASCII(base::HexEncode(hash, sizeof(hash))); ConvertHexadecimalToIDAlphabet(output); return true; } ",0 " static void DeleteAtEnd(Handle obj, Handle backing_store, uint32_t entry) { uint32_t length = static_cast(backing_store->length()); Isolate* isolate = obj->GetIsolate(); for (; entry > 0; entry--) { if (!backing_store->is_the_hole(isolate, entry - 1)) break; } if (entry == 0) { FixedArray* empty = isolate->heap()->empty_fixed_array(); if (obj->GetElementsKind() == FAST_SLOPPY_ARGUMENTS_ELEMENTS) { FixedArray::cast(obj->elements())->set(1, empty); } else { obj->set_elements(empty); } return; } isolate->heap()->RightTrimFixedArray(*backing_store, length - entry); } ",0 "retr_rate (wgint bytes, double secs) { static char res[20]; static const char *rate_names[] = {""B/s"", ""KB/s"", ""MB/s"", ""GB/s"" }; static const char *rate_names_bits[] = {""b/s"", ""Kb/s"", ""Mb/s"", ""Gb/s"" }; int units; double dlrate = calc_rate (bytes, secs, &units); /* Use more digits for smaller numbers (regardless of unit used), e.g. ""1022"", ""247"", ""12.5"", ""2.38"". */ snprintf (res, sizeof(res), ""%.*f %s"", dlrate >= 99.95 ? 0 : dlrate >= 9.995 ? 1 : 2, dlrate, !opt.report_bps ? rate_names[units]: rate_names_bits[units]); return res; } ",0 "bool RenderProcessHostImpl::FastShutdownIfPossible() { if (run_renderer_in_process()) return false; // Single process mode never shuts down the renderer. if (!child_process_launcher_.get() || child_process_launcher_->IsStarting() || !GetHandle()) return false; // Render process hasn't started or is probably crashed. if (!SuddenTerminationAllowed()) return false; if (GetWorkerRefCount() != 0) { if (survive_for_worker_start_time_.is_null()) survive_for_worker_start_time_ = base::TimeTicks::Now(); return false; } fast_shutdown_started_ = true; ProcessDied(false /* already_dead */, nullptr); return true; } ",0 "static void usb_net_reset_in_buf(USBNetState *s) { s->in_ptr = s->in_len = 0; qemu_flush_queued_packets(qemu_get_queue(s->nic)); } ",0 "GahpClient::nordugrid_cancel(const char *hostname, const char *job_id) { static const char* command = ""NORDUGRID_CANCEL""; if (server->m_commands_supported->contains_anycase(command)==FALSE) { return GAHPCLIENT_COMMAND_NOT_SUPPORTED; } if (!hostname) hostname=NULLSTRING; if (!job_id) job_id=NULLSTRING; std::string reqline; char *esc1 = strdup( escapeGahpString(hostname) ); char *esc2 = strdup( escapeGahpString(job_id) ); int x = sprintf(reqline,""%s %s"", esc1, esc2 ); free( esc1 ); free( esc2 ); ASSERT( x > 0 ); const char *buf = reqline.c_str(); if ( !is_pending(command,buf) ) { if ( m_mode == results_only ) { return GAHPCLIENT_COMMAND_NOT_SUBMITTED; } now_pending(command,buf,deleg_proxy); } Gahp_Args* result = get_pending_result(command,buf); if ( result ) { if (result->argc != 3) { EXCEPT(""Bad %s Result"",command); } int rc = atoi(result->argv[1]); if ( strcasecmp(result->argv[2], NULLSTRING) ) { error_string = result->argv[2]; } else { error_string = """"; } delete result; return rc; } if ( check_pending_timeout(command,buf) ) { sprintf( error_string, ""%s timed out"", command ); return GAHPCLIENT_COMMAND_TIMED_OUT; } return GAHPCLIENT_COMMAND_PENDING; } ",0 "PropertyBag* ExtensionService::GetPropertyBag(const Extension* extension) { return &extension_runtime_data_[extension->id()].property_bag; } ",0 "rend_service_use_direct_connection_node(const or_options_t* options, const node_t* node) { /* We'll connect directly all reachable addresses, whether preferred or not. */ return (rend_service_allow_non_anonymous_connection(options) && fascist_firewall_allows_node(node, FIREWALL_OR_CONNECTION, 0)); } ",0 "DataReductionProxyConfig::GetNetworkPropertiesManager() const { DCHECK(thread_checker_.CalledOnValidThread()); return *network_properties_manager_; } ",0 "void kvm_write_tsc(struct kvm_vcpu *vcpu, struct msr_data *msr) { struct kvm *kvm = vcpu->kvm; u64 offset, ns, elapsed; unsigned long flags; s64 usdiff; bool matched; u64 data = msr->data; raw_spin_lock_irqsave(&kvm->arch.tsc_write_lock, flags); offset = kvm_x86_ops->compute_tsc_offset(vcpu, data); ns = get_kernel_ns(); elapsed = ns - kvm->arch.last_tsc_nsec; if (vcpu->arch.virtual_tsc_khz) { int faulted = 0; /* n.b - signed multiplication and division required */ usdiff = data - kvm->arch.last_tsc_write; #ifdef CONFIG_X86_64 usdiff = (usdiff * 1000) / vcpu->arch.virtual_tsc_khz; #else /* do_div() only does unsigned */ asm(""1: idivl %[divisor]\n"" ""2: xor %%edx, %%edx\n"" "" movl $0, %[faulted]\n"" ""3:\n"" "".section .fixup,\""ax\""\n"" ""4: movl $1, %[faulted]\n"" "" jmp 3b\n"" "".previous\n"" _ASM_EXTABLE(1b, 4b) : ""=A""(usdiff), [faulted] ""=r"" (faulted) : ""A""(usdiff * 1000), [divisor] ""rm""(vcpu->arch.virtual_tsc_khz)); #endif do_div(elapsed, 1000); usdiff -= elapsed; if (usdiff < 0) usdiff = -usdiff; /* idivl overflow => difference is larger than USEC_PER_SEC */ if (faulted) usdiff = USEC_PER_SEC; } else usdiff = USEC_PER_SEC; /* disable TSC match window below */ /* * Special case: TSC write with a small delta (1 second) of virtual * cycle time against real time is interpreted as an attempt to * synchronize the CPU. * * For a reliable TSC, we can match TSC offsets, and for an unstable * TSC, we add elapsed time in this computation. We could let the * compensation code attempt to catch up if we fall behind, but * it's better to try to match offsets from the beginning. */ if (usdiff < USEC_PER_SEC && vcpu->arch.virtual_tsc_khz == kvm->arch.last_tsc_khz) { if (!check_tsc_unstable()) { offset = kvm->arch.cur_tsc_offset; pr_debug(""kvm: matched tsc offset for %llu\n"", data); } else { u64 delta = nsec_to_cycles(vcpu, elapsed); data += delta; offset = kvm_x86_ops->compute_tsc_offset(vcpu, data); pr_debug(""kvm: adjusted tsc offset by %llu\n"", delta); } matched = true; } else { /* * We split periods of matched TSC writes into generations. * For each generation, we track the original measured * nanosecond time, offset, and write, so if TSCs are in * sync, we can match exact offset, and if not, we can match * exact software computation in compute_guest_tsc() * * These values are tracked in kvm->arch.cur_xxx variables. */ kvm->arch.cur_tsc_generation++; kvm->arch.cur_tsc_nsec = ns; kvm->arch.cur_tsc_write = data; kvm->arch.cur_tsc_offset = offset; matched = false; pr_debug(""kvm: new tsc generation %u, clock %llu\n"", kvm->arch.cur_tsc_generation, data); } /* * We also track th most recent recorded KHZ, write and time to * allow the matching interval to be extended at each write. */ kvm->arch.last_tsc_nsec = ns; kvm->arch.last_tsc_write = data; kvm->arch.last_tsc_khz = vcpu->arch.virtual_tsc_khz; vcpu->arch.last_guest_tsc = data; /* Keep track of which generation this VCPU has synchronized to */ vcpu->arch.this_tsc_generation = kvm->arch.cur_tsc_generation; vcpu->arch.this_tsc_nsec = kvm->arch.cur_tsc_nsec; vcpu->arch.this_tsc_write = kvm->arch.cur_tsc_write; if (guest_cpuid_has_tsc_adjust(vcpu) && !msr->host_initiated) update_ia32_tsc_adjust_msr(vcpu, offset); kvm_x86_ops->write_tsc_offset(vcpu, offset); raw_spin_unlock_irqrestore(&kvm->arch.tsc_write_lock, flags); spin_lock(&kvm->arch.pvclock_gtod_sync_lock); if (matched) kvm->arch.nr_vcpus_matched_tsc++; else kvm->arch.nr_vcpus_matched_tsc = 0; kvm_track_tsc_matching(vcpu); spin_unlock(&kvm->arch.pvclock_gtod_sync_lock); } ",0 "u32 h264bsdMarkDecRefPic( dpbStorage_t *dpb, decRefPicMarking_t *mark, image_t *image, u32 frameNum, i32 picOrderCnt, u32 isIdr, u32 currentPicId, u32 numErrMbs) { /* Variables */ u32 i, status; u32 markedAsLongTerm; u32 toBeDisplayed; /* Code */ ASSERT(dpb); ASSERT(mark || !isIdr); ASSERT(!isIdr || (frameNum == 0 && picOrderCnt == 0)); ASSERT(frameNum < dpb->maxFrameNum); if (image->data != dpb->currentOut->data) { EPRINT(""TRYING TO MARK NON-ALLOCATED IMAGE""); return(HANTRO_NOK); } dpb->lastContainsMmco5 = HANTRO_FALSE; status = HANTRO_OK; toBeDisplayed = dpb->noReordering ? HANTRO_FALSE : HANTRO_TRUE; /* non-reference picture, stored for display reordering purposes */ if (mark == NULL) { dpb->currentOut->status = UNUSED; dpb->currentOut->frameNum = frameNum; dpb->currentOut->picNum = (i32)frameNum; dpb->currentOut->picOrderCnt = picOrderCnt; dpb->currentOut->toBeDisplayed = toBeDisplayed; if (!dpb->noReordering) dpb->fullness++; } /* IDR picture */ else if (isIdr) { /* h264bsdCheckGapsInFrameNum not called for IDR pictures -> have to * reset numOut and outIndex here */ dpb->numOut = dpb->outIndex = 0; /* flush the buffer */ Mmcop5(dpb); /* if noOutputOfPriorPicsFlag was set -> the pictures preceding the * IDR picture shall not be output -> set output buffer empty */ if (mark->noOutputOfPriorPicsFlag || dpb->noReordering) { dpb->numOut = 0; dpb->outIndex = 0; } if (mark->longTermReferenceFlag) { dpb->currentOut->status = LONG_TERM; dpb->maxLongTermFrameIdx = 0; } else { dpb->currentOut->status = SHORT_TERM; dpb->maxLongTermFrameIdx = NO_LONG_TERM_FRAME_INDICES; } dpb->currentOut->frameNum = 0; dpb->currentOut->picNum = 0; dpb->currentOut->picOrderCnt = 0; dpb->currentOut->toBeDisplayed = toBeDisplayed; dpb->fullness = 1; dpb->numRefFrames = 1; } /* reference picture */ else { markedAsLongTerm = HANTRO_FALSE; if (mark->adaptiveRefPicMarkingModeFlag) { i = 0; while (mark->operation[i].memoryManagementControlOperation) { switch (mark->operation[i].memoryManagementControlOperation) { case 1: status = Mmcop1( dpb, frameNum, mark->operation[i].differenceOfPicNums); break; case 2: status = Mmcop2(dpb, mark->operation[i].longTermPicNum); break; case 3: status = Mmcop3( dpb, frameNum, mark->operation[i].differenceOfPicNums, mark->operation[i].longTermFrameIdx); break; case 4: status = Mmcop4( dpb, mark->operation[i].maxLongTermFrameIdx); break; case 5: status = Mmcop5(dpb); dpb->lastContainsMmco5 = HANTRO_TRUE; frameNum = 0; break; case 6: status = Mmcop6( dpb, frameNum, picOrderCnt, mark->operation[i].longTermFrameIdx); if (status == HANTRO_OK) markedAsLongTerm = HANTRO_TRUE; break; default: /* invalid memory management control operation */ status = HANTRO_NOK; break; } if (status != HANTRO_OK) { break; } i++; } } else { status = SlidingWindowRefPicMarking(dpb); } /* if current picture was not marked as long-term reference by * memory management control operation 6 -> mark current as short * term and insert it into dpb (if there is room) */ if (!markedAsLongTerm) { if (dpb->numRefFrames < dpb->maxRefFrames) { dpb->currentOut->frameNum = frameNum; dpb->currentOut->picNum = (i32)frameNum; dpb->currentOut->picOrderCnt = picOrderCnt; dpb->currentOut->status = SHORT_TERM; dpb->currentOut->toBeDisplayed = toBeDisplayed; dpb->fullness++; dpb->numRefFrames++; } /* no room */ else { status = HANTRO_NOK; } } } dpb->currentOut->isIdr = isIdr; dpb->currentOut->picId = currentPicId; dpb->currentOut->numErrMbs = numErrMbs; /* dpb was initialized to not to reorder the pictures -> output current * picture immediately */ if (dpb->noReordering) { ASSERT(dpb->numOut == 0); ASSERT(dpb->outIndex == 0); dpb->outBuf[dpb->numOut].data = dpb->currentOut->data; dpb->outBuf[dpb->numOut].isIdr = dpb->currentOut->isIdr; dpb->outBuf[dpb->numOut].picId = dpb->currentOut->picId; dpb->outBuf[dpb->numOut].numErrMbs = dpb->currentOut->numErrMbs; dpb->numOut++; } else { /* output pictures if buffer full */ while (dpb->fullness > dpb->dpbSize) { i = OutputPicture(dpb); ASSERT(i == HANTRO_OK); } } /* sort dpb */ ShellSort(dpb->buffer, dpb->dpbSize+1); return(status); } ",0 "static void smp_task_timedout(struct timer_list *t) { struct sas_task_slow *slow = from_timer(slow, t, timer); struct sas_task *task = slow->task; unsigned long flags; spin_lock_irqsave(&task->task_state_lock, flags); if (!(task->task_state_flags & SAS_TASK_STATE_DONE)) task->task_state_flags |= SAS_TASK_STATE_ABORTED; spin_unlock_irqrestore(&task->task_state_lock, flags); complete(&task->slow_task->completion); } ",1 " aura::Window* CreatePanelWindow(const gfx::Rect& bounds) { return CreatePanelWindowWithDelegate(nullptr, bounds); } ",0 "bool AXLayoutObject::isValidSelectionBound(const AXObject* boundObject) const { return getLayoutObject() && boundObject && !boundObject->isDetached() && boundObject->isAXLayoutObject() && boundObject->getLayoutObject() && boundObject->getLayoutObject()->frame() == getLayoutObject()->frame() && &boundObject->axObjectCache() == &axObjectCache(); } ",0 "constexpr bool IsInvalidDeletionLength(const int length) { return length == kInvalidDeletionLength; } ",0 "static int llcp_sock_create(struct net *net, struct socket *sock, const struct nfc_protocol *nfc_proto) { struct sock *sk; pr_debug(""%p\n"", sock); if (sock->type != SOCK_STREAM && sock->type != SOCK_DGRAM && sock->type != SOCK_RAW) return -ESOCKTNOSUPPORT; if (sock->type == SOCK_RAW) sock->ops = &llcp_rawsock_ops; else sock->ops = &llcp_sock_ops; sk = nfc_llcp_sock_alloc(sock, sock->type, GFP_ATOMIC); if (sk == NULL) return -ENOMEM; return 0; } ",0 " static OPJ_BOOL bmp_read_rle8_data(FILE* IN, OPJ_UINT8* pData, OPJ_UINT32 stride, OPJ_UINT32 width, OPJ_UINT32 height) { OPJ_UINT32 x, y; OPJ_UINT8 *pix; const OPJ_UINT8 *beyond; beyond = pData + stride * height; pix = pData; x = y = 0U; while (y < height) { int c = getc(IN); if (c == EOF) { return OPJ_FALSE; } if (c) { int j, c1_int; OPJ_UINT8 c1; c1_int = getc(IN); if (c1_int == EOF) { return OPJ_FALSE; } c1 = (OPJ_UINT8)c1_int; for (j = 0; (j < c) && (x < width) && ((OPJ_SIZE_T)pix < (OPJ_SIZE_T)beyond); j++, x++, pix++) { *pix = c1; } } else { c = getc(IN); if (c == EOF) { return OPJ_FALSE; } if (c == 0x00) { /* EOL */ x = 0; ++y; pix = pData + y * stride + x; } else if (c == 0x01) { /* EOP */ break; } else if (c == 0x02) { /* MOVE by dxdy */ c = getc(IN); if (c == EOF) { return OPJ_FALSE; } x += (OPJ_UINT32)c; c = getc(IN); if (c == EOF) { return OPJ_FALSE; } y += (OPJ_UINT32)c; pix = pData + y * stride + x; } else { /* 03 .. 255 */ int j; for (j = 0; (j < c) && (x < width) && ((OPJ_SIZE_T)pix < (OPJ_SIZE_T)beyond); j++, x++, pix++) { int c1_int; OPJ_UINT8 c1; c1_int = getc(IN); if (c1_int == EOF) { return OPJ_FALSE; } c1 = (OPJ_UINT8)c1_int; *pix = c1; } if ((OPJ_UINT32)c & 1U) { /* skip padding byte */ c = getc(IN); if (c == EOF) { return OPJ_FALSE; } } } } }/* while() */ return OPJ_TRUE; } ",1 "bool DesktopWindowTreeHostX11::ShouldUpdateWindowTransparency() const { return true; } ",0 "gen_init_key(struct sc_card *card, unsigned char *key_enc, unsigned char *key_mac, unsigned char *result, unsigned char key_type) { int r; struct sc_apdu apdu; unsigned char data[256] = { 0 }; unsigned char tmp_sm; unsigned long blocksize = 0; unsigned char cryptogram[256] = { 0 }; /* host cryptogram */ unsigned char iv[16] = { 0 }; epass2003_exdata *exdata = NULL; if (!card->drv_data) return SC_ERROR_INVALID_ARGUMENTS; exdata = (epass2003_exdata *)card->drv_data; LOG_FUNC_CALLED(card->ctx); sc_format_apdu(card, &apdu, SC_APDU_CASE_4_SHORT, 0x50, 0x00, 0x00); apdu.cla = 0x80; apdu.lc = apdu.datalen = sizeof(g_random); apdu.data = g_random; /* host random */ apdu.le = apdu.resplen = 28; apdu.resp = result; /* card random is result[12~19] */ tmp_sm = exdata->sm; exdata->sm = SM_PLAIN; r = epass2003_transmit_apdu(card, &apdu); exdata->sm = tmp_sm; LOG_TEST_RET(card->ctx, r, ""APDU gen_init_key failed""); r = sc_check_sw(card, apdu.sw1, apdu.sw2); LOG_TEST_RET(card->ctx, r, ""gen_init_key failed""); /* Step 1 - Generate Derivation data */ memcpy(data, &result[16], 4); memcpy(&data[4], g_random, 4); memcpy(&data[8], &result[12], 4); memcpy(&data[12], &g_random[4], 4); /* Step 2,3 - Create S-ENC/S-MAC Session Key */ if (KEY_TYPE_AES == key_type) { aes128_encrypt_ecb(key_enc, 16, data, 16, exdata->sk_enc); aes128_encrypt_ecb(key_mac, 16, data, 16, exdata->sk_mac); } else { des3_encrypt_ecb(key_enc, 16, data, 16, exdata->sk_enc); des3_encrypt_ecb(key_mac, 16, data, 16, exdata->sk_mac); } memcpy(data, g_random, 8); memcpy(&data[8], &result[12], 8); data[16] = 0x80; blocksize = (key_type == KEY_TYPE_AES ? 16 : 8); memset(&data[17], 0x00, blocksize - 1); /* calculate host cryptogram */ if (KEY_TYPE_AES == key_type) aes128_encrypt_cbc(exdata->sk_enc, 16, iv, data, 16 + blocksize, cryptogram); else des3_encrypt_cbc(exdata->sk_enc, 16, iv, data, 16 + blocksize, cryptogram); /* verify card cryptogram */ if (0 != memcmp(&cryptogram[16], &result[20], 8)) LOG_FUNC_RETURN(card->ctx, SC_ERROR_CARD_CMD_FAILED); LOG_FUNC_RETURN(card->ctx, SC_SUCCESS); } ",0 "inline void doMultiply(const AffineTransform& t1, const AffineTransform& t2, AffineTransform* res) { res->setA(t1.a() * t2.a() + t1.c() * t2.b()); res->setB(t1.b() * t2.a() + t1.d() * t2.b()); res->setC(t1.a() * t2.c() + t1.c() * t2.d()); res->setD(t1.b() * t2.c() + t1.d() * t2.d()); res->setE(t1.a() * t2.e() + t1.c() * t2.f() + t1.e()); res->setF(t1.b() * t2.e() + t1.d() * t2.f() + t1.f()); } ",0 "static int zlib_init(struct crypto_tfm *tfm) { return 0; } ",0 "void TraceEvent::UpdateDuration(const TraceTicks& now, const ThreadTicks& thread_now) { DCHECK_EQ(duration_.ToInternalValue(), -1); duration_ = now - timestamp_; if (thread_timestamp_ != ThreadTicks()) thread_duration_ = thread_now - thread_timestamp_; } ",0 "ModuleExport void UnregisterTILEImage(void) { (void) UnregisterMagickInfo(""TILE""); } ",0 "Response PageHandler::StopLoading() { WebContentsImpl* web_contents = GetWebContents(); if (!web_contents) return Response::InternalError(); web_contents->Stop(); return Response::OK(); } ",0 "bool ContainerNode::isChildTypeAllowed(const Node& child) const { if (!child.isDocumentFragment()) return childTypeAllowed(child.nodeType()); for (Node* node = toDocumentFragment(child).firstChild(); node; node = node->nextSibling()) { if (!childTypeAllowed(node->nodeType())) return false; } return true; } ",0 "UsbGetUserSelectedDevicesFunction::UsbGetUserSelectedDevicesFunction() { } ",0 "png_write_IDAT(png_structp png_ptr, png_bytep data, png_size_t length) { #ifdef PNG_USE_LOCAL_ARRAYS PNG_IDAT; #endif png_debug(1, ""in png_write_IDAT""); /* Optimize the CMF field in the zlib stream. */ /* This hack of the zlib stream is compliant to the stream specification. */ if (!(png_ptr->mode & PNG_HAVE_IDAT) && png_ptr->compression_type == PNG_COMPRESSION_TYPE_BASE) { unsigned int z_cmf = data[0]; /* zlib compression method and flags */ if ((z_cmf & 0x0f) == 8 && (z_cmf & 0xf0) <= 0x70) { /* Avoid memory underflows and multiplication overflows. * * The conditions below are practically always satisfied; * however, they still must be checked. */ if (length >= 2 && png_ptr->height < 16384 && png_ptr->width < 16384) { png_uint_32 uncompressed_idat_size = png_ptr->height * ((png_ptr->width * png_ptr->channels * png_ptr->bit_depth + 15) >> 3); unsigned int z_cinfo = z_cmf >> 4; unsigned int half_z_window_size = 1 << (z_cinfo + 7); while (uncompressed_idat_size <= half_z_window_size && half_z_window_size >= 256) { z_cinfo--; half_z_window_size >>= 1; } z_cmf = (z_cmf & 0x0f) | (z_cinfo << 4); if (data[0] != (png_byte)z_cmf) { data[0] = (png_byte)z_cmf; data[1] &= 0xe0; data[1] += (png_byte)(0x1f - ((z_cmf << 8) + data[1]) % 0x1f); } } } else png_error(png_ptr, ""Invalid zlib compression method or flags in IDAT""); } png_write_chunk(png_ptr, (png_bytep)png_IDAT, data, length); png_ptr->mode |= PNG_HAVE_IDAT; } ",0 "void HTMLMediaElement::SizeChanged() { BLINK_MEDIA_LOG << ""sizeChanged("" << (void*)this << "")""; DCHECK(HasVideo()); // ""resize"" makes no sense in absence of video. if (ready_state_ > kHaveNothing && IsHTMLVideoElement()) ScheduleEvent(EventTypeNames::resize); if (GetLayoutObject()) GetLayoutObject()->UpdateFromElement(); } ",0 "xmlBufCreateSize(size_t size) { xmlBufPtr ret; ret = (xmlBufPtr) xmlMalloc(sizeof(xmlBuf)); if (ret == NULL) { xmlBufMemoryError(NULL, ""creating buffer""); return(NULL); } ret->compat_use = 0; ret->use = 0; ret->error = 0; ret->buffer = NULL; ret->alloc = xmlBufferAllocScheme; ret->size = (size ? size+2 : 0); /* +1 for ending null */ ret->compat_size = (int) ret->size; if (ret->size){ ret->content = (xmlChar *) xmlMallocAtomic(ret->size * sizeof(xmlChar)); if (ret->content == NULL) { xmlBufMemoryError(ret, ""creating buffer""); xmlFree(ret); return(NULL); } ret->content[0] = 0; } else ret->content = NULL; ret->contentIO = NULL; return(ret); } ",0 "SProcRenderSetPictureFilter(ClientPtr client) { REQUEST(xRenderSetPictureFilterReq); REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq); swaps(&stuff->length); swapl(&stuff->picture); swaps(&stuff->nbytes); return (*ProcRenderVector[stuff->renderReqType]) (client); } ",0 "std::string NetAddressToString(const struct sockaddr* net_address, socklen_t address_len) { #if defined(OS_WIN) EnsureWinsockInit(); #endif char buffer[INET6_ADDRSTRLEN]; int result = getnameinfo(net_address, address_len, buffer, sizeof(buffer), NULL, 0, NI_NUMERICHOST); if (result != 0) { DVLOG(1) << ""getnameinfo() failed with "" << result << "": "" << gai_strerror(result); buffer[0] = '\0'; } return std::string(buffer); } ",0 "static int ath_compute_num_delims(struct ath_softc *sc, struct ath_atx_tid *tid, struct ath_buf *bf, u16 frmlen, bool first_subfrm) { #define FIRST_DESC_NDELIMS 60 u32 nsymbits, nsymbols; u16 minlen; u8 flags, rix; int width, streams, half_gi, ndelim, mindelim; struct ath_frame_info *fi = get_frame_info(bf->bf_mpdu); /* Select standard number of delimiters based on frame length alone */ ndelim = ATH_AGGR_GET_NDELIM(frmlen); /* * If encryption enabled, hardware requires some more padding between * subframes. * TODO - this could be improved to be dependent on the rate. * The hardware can keep up at lower rates, but not higher rates */ if ((fi->keyix != ATH9K_TXKEYIX_INVALID) && !(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)) ndelim += ATH_AGGR_ENCRYPTDELIM; /* * Add delimiter when using RTS/CTS with aggregation * and non enterprise AR9003 card */ if (first_subfrm && !AR_SREV_9580_10_OR_LATER(sc->sc_ah) && (sc->sc_ah->ent_mode & AR_ENT_OTP_MIN_PKT_SIZE_DISABLE)) ndelim = max(ndelim, FIRST_DESC_NDELIMS); /* * Convert desired mpdu density from microeconds to bytes based * on highest rate in rate series (i.e. first rate) to determine * required minimum length for subframe. Take into account * whether high rate is 20 or 40Mhz and half or full GI. * * If there is no mpdu density restriction, no further calculation * is needed. */ if (tid->an->mpdudensity == 0) return ndelim; rix = bf->rates[0].idx; flags = bf->rates[0].flags; width = (flags & IEEE80211_TX_RC_40_MHZ_WIDTH) ? 1 : 0; half_gi = (flags & IEEE80211_TX_RC_SHORT_GI) ? 1 : 0; if (half_gi) nsymbols = NUM_SYMBOLS_PER_USEC_HALFGI(tid->an->mpdudensity); else nsymbols = NUM_SYMBOLS_PER_USEC(tid->an->mpdudensity); if (nsymbols == 0) nsymbols = 1; streams = HT_RC_2_STREAMS(rix); nsymbits = bits_per_symbol[rix % 8][width] * streams; minlen = (nsymbols * nsymbits) / BITS_PER_BYTE; if (frmlen < minlen) { mindelim = (minlen - frmlen) / ATH_AGGR_DELIM_SZ; ndelim = max(mindelim, ndelim); } return ndelim; } ",0 "void netdev_run_todo(void) { struct list_head list; /* Snapshot list, allow later requests */ list_replace_init(&net_todo_list, &list); __rtnl_unlock(); /* Wait for rcu callbacks to finish before next phase */ if (!list_empty(&list)) rcu_barrier(); while (!list_empty(&list)) { struct net_device *dev = list_first_entry(&list, struct net_device, todo_list); list_del(&dev->todo_list); rtnl_lock(); call_netdevice_notifiers(NETDEV_UNREGISTER_FINAL, dev); __rtnl_unlock(); if (unlikely(dev->reg_state != NETREG_UNREGISTERING)) { pr_err(""network todo '%s' but state %d\n"", dev->name, dev->reg_state); dump_stack(); continue; } dev->reg_state = NETREG_UNREGISTERED; netdev_wait_allrefs(dev); /* paranoia */ BUG_ON(netdev_refcnt_read(dev)); BUG_ON(!list_empty(&dev->ptype_all)); BUG_ON(!list_empty(&dev->ptype_specific)); WARN_ON(rcu_access_pointer(dev->ip_ptr)); WARN_ON(rcu_access_pointer(dev->ip6_ptr)); WARN_ON(dev->dn_ptr); if (dev->priv_destructor) dev->priv_destructor(dev); if (dev->needs_free_netdev) free_netdev(dev); /* Report a network device has been unregistered */ rtnl_lock(); dev_net(dev)->dev_unreg_count--; __rtnl_unlock(); wake_up(&netdev_unregistering_wq); /* Free network device */ kobject_put(&dev->dev.kobj); } } ",0 "void CompositorImpl::AddChildFrameSink(const viz::FrameSinkId& frame_sink_id) { if (has_layer_tree_frame_sink_) { GetHostFrameSinkManager()->RegisterFrameSinkHierarchy(frame_sink_id_, frame_sink_id); } else { pending_child_frame_sink_ids_.insert(frame_sink_id); } } ",0 "static inline bool isAtShadowBoundary(const Element* element) { if (!element) return false; ContainerNode* parentNode = element->parentNode(); return parentNode && parentNode->isShadowRoot(); } ",0 "makepng_warning(png_structp png_ptr, png_const_charp message) { const char **ep = png_get_error_ptr(png_ptr); const char *name; if (ep != NULL && *ep != NULL) name = *ep; else name = ""makepng""; fprintf(stderr, ""%s: warning: %s\n"", name, message); } ",0 "static void p4_pmu_enable_all(int added) { struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); int idx; for (idx = 0; idx < x86_pmu.num_counters; idx++) { struct perf_event *event = cpuc->events[idx]; if (!test_bit(idx, cpuc->active_mask)) continue; p4_pmu_enable_event(event); } } ",0 "WORD32 ihevcd_delete(iv_obj_t *ps_codec_obj, void *pv_api_ip, void *pv_api_op) { codec_t *ps_dec; ihevcd_cxa_delete_ip_t *ps_ip = (ihevcd_cxa_delete_ip_t *)pv_api_ip; ihevcd_cxa_delete_op_t *ps_op = (ihevcd_cxa_delete_op_t *)pv_api_op; ps_dec = (codec_t *)(ps_codec_obj->pv_codec_handle); UNUSED(ps_ip); ps_op->s_ivd_delete_op_t.u4_error_code = 0; ihevcd_free_dynamic_bufs(ps_dec); ihevcd_free_static_bufs(ps_codec_obj); return IV_SUCCESS; } ",0 "RenderThreadImpl::GetIOTaskRunner() { return ChildProcess::current()->io_task_runner(); } ",0 "void RenderWidgetHostImpl::OnMsgSelectRangeAck() { select_range_pending_ = false; if (next_selection_range_.get()) { scoped_ptr next(next_selection_range_.Pass()); SelectRange(next->start, next->end); } } ",0 "static __be16 ipx_map_frame_type(unsigned char type) { __be16 rc = 0; switch (type) { case IPX_FRAME_ETHERII: rc = htons(ETH_P_IPX); break; case IPX_FRAME_8022: rc = htons(ETH_P_802_2); break; case IPX_FRAME_SNAP: rc = htons(ETH_P_SNAP); break; case IPX_FRAME_8023: rc = htons(ETH_P_802_3); break; } return rc; } ",0 "Locale& Document::getCachedLocale(const AtomicString& locale) { AtomicString localeKey = locale; if (locale.isEmpty() || !RuntimeEnabledFeatures::langAttributeAwareFormControlUIEnabled()) return Locale::defaultLocale(); LocaleIdentifierToLocaleMap::AddResult result = m_localeCache.add(localeKey, nullptr); if (result.isNewEntry) result.storedValue->value = Locale::create(localeKey); return *(result.storedValue->value); } ",0 "crm_ipc_ready(crm_ipc_t *client) { int rc; CRM_ASSERT(client != NULL); if (crm_ipc_connected(client) == FALSE) { return -ENOTCONN; } client->pfd.revents = 0; rc = poll(&(client->pfd), 1, 0); return (rc < 0)? -errno : rc; } ",0 " static void smp_task_done(struct sas_task *task) { if (!del_timer(&task->slow_task->timer)) return; complete(&task->slow_task->completion); } ",1 "xsltNumberFormatAlpha(xmlBufferPtr buffer, double number, int is_upper) { char temp_string[sizeof(double) * CHAR_BIT * sizeof(xmlChar) + 1]; char *pointer; int i; char *alpha_list; double alpha_size = (double)(sizeof(alpha_upper_list) - 1); /* Build buffer from back */ pointer = &temp_string[sizeof(temp_string)]; *(--pointer) = 0; alpha_list = (is_upper) ? alpha_upper_list : alpha_lower_list; for (i = 1; i < (int)sizeof(temp_string); i++) { number--; *(--pointer) = alpha_list[((int)fmod(number, alpha_size))]; number /= alpha_size; if (fabs(number) < 1.0) break; /* for */ } xmlBufferCCat(buffer, pointer); } ",1 "GC_INNER void * GC_generic_malloc_inner_ignore_off_page(size_t lb, int k) { word lb_adjusted; void * op; if (lb <= HBLKSIZE) return(GC_generic_malloc_inner(lb, k)); lb_adjusted = ADD_SLOP(lb); op = GC_alloc_large_and_clear(lb_adjusted, k, IGNORE_OFF_PAGE); GC_bytes_allocd += lb_adjusted; return op; } ",0 "write_png(struct display *dp, png_infop ip, int transforms) { display_clean_write(dp); /* safety */ buffer_start_write(&dp->written_file); dp->operation = ""write""; dp->transforms = transforms; dp->write_pp = png_create_write_struct(PNG_LIBPNG_VER_STRING, dp, display_error, display_warning); if (dp->write_pp == NULL) display_log(dp, APP_ERROR, ""failed to create write png_struct""); png_set_write_fn(dp->write_pp, &dp->written_file, write_function, NULL/*flush*/); # ifdef PNG_SET_USER_LIMITS_SUPPORTED /* Remove the user limits, if any */ png_set_user_limits(dp->write_pp, 0x7fffffff, 0x7fffffff); # endif /* Certain transforms require the png_info to be zapped to allow the * transform to work correctly. */ if (transforms & (PNG_TRANSFORM_PACKING| PNG_TRANSFORM_STRIP_FILLER| PNG_TRANSFORM_STRIP_FILLER_BEFORE)) { int ct = dp->color_type; if (transforms & (PNG_TRANSFORM_STRIP_FILLER| PNG_TRANSFORM_STRIP_FILLER_BEFORE)) ct &= ~PNG_COLOR_MASK_ALPHA; png_set_IHDR(dp->write_pp, ip, dp->width, dp->height, dp->bit_depth, ct, dp->interlace_method, dp->compression_method, dp->filter_method); } png_write_png(dp->write_pp, ip, transforms, NULL/*params*/); /* Clean it on the way out - if control returns to the caller then the * written_file contains the required data. */ display_clean_write(dp); } ",0 "int fz_colorspace_n(fz_context *ctx, const fz_colorspace *cs) { return cs ? cs->n : 0; } ",0 "void InspectorResourceAgent::applyUserAgentOverride(String* userAgent) { String userAgentOverride = m_state->getString(ResourceAgentState::userAgentOverride); if (!userAgentOverride.isEmpty()) *userAgent = userAgentOverride; } ",0 "void php_gd_error_method(int type, const char *format, va_list args) { TSRMLS_FETCH(); php_verror(NULL, """", type, format, args TSRMLS_CC); } ",0 "MagickExport MemoryInfo *AcquireVirtualMemory(const size_t count, const size_t quantum) { MemoryInfo *memory_info; size_t extent; if (CheckMemoryOverflow(count,quantum) != MagickFalse) return((MemoryInfo *) NULL); memory_info=(MemoryInfo *) MagickAssumeAligned(AcquireAlignedMemory(1, sizeof(*memory_info))); if (memory_info == (MemoryInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,""MemoryAllocationFailed""); (void) ResetMagickMemory(memory_info,0,sizeof(*memory_info)); extent=count*quantum; memory_info->length=extent; memory_info->signature=MagickSignature; if (AcquireMagickResource(MemoryResource,extent) != MagickFalse) { memory_info->blob=AcquireAlignedMemory(1,extent); if (memory_info->blob != NULL) { memory_info->type=AlignedVirtualMemory; return(memory_info); } } RelinquishMagickResource(MemoryResource,extent); if (AcquireMagickResource(MapResource,extent) != MagickFalse) { /* Heap memory failed, try anonymous memory mapping. */ memory_info->blob=MapBlob(-1,IOMode,0,extent); if (memory_info->blob != NULL) { memory_info->type=MapVirtualMemory; return(memory_info); } if (AcquireMagickResource(DiskResource,extent) != MagickFalse) { int file; /* Anonymous memory mapping failed, try file-backed memory mapping. If the MapResource request failed, there is no point in trying file-backed memory mapping. */ file=AcquireUniqueFileResource(memory_info->filename); if (file != -1) { MagickOffsetType offset; offset=(MagickOffsetType) lseek(file,extent-1,SEEK_SET); if ((offset == (MagickOffsetType) (extent-1)) && (write(file,"""",1) == 1)) { memory_info->blob=MapBlob(file,IOMode,0,extent); if (memory_info->blob != NULL) { (void) close(file); memory_info->type=MapVirtualMemory; return(memory_info); } } /* File-backed memory mapping failed, delete the temporary file. */ (void) close(file); (void) RelinquishUniqueFileResource(memory_info->filename); *memory_info->filename='\0'; } } RelinquishMagickResource(DiskResource,extent); } RelinquishMagickResource(MapResource,extent); if (memory_info->blob == NULL) { memory_info->blob=AcquireMagickMemory(extent); if (memory_info->blob != NULL) memory_info->type=UnalignedVirtualMemory; } if (memory_info->blob == NULL) memory_info=RelinquishVirtualMemory(memory_info); return(memory_info); } ",1 "int kvm_apic_match_dest(struct kvm_vcpu *vcpu, struct kvm_lapic *source, int short_hand, int dest, int dest_mode) { struct kvm_lapic *target = vcpu->arch.apic; return (dest_mode == 0) ? kvm_apic_match_physical_addr(target, dest) : kvm_apic_match_logical_addr(target, dest); } ",0 " static bool getCoverageFormat4(vector& coverage, const uint8_t* data, size_t size) { const size_t kSegCountOffset = 6; const size_t kEndCountOffset = 14; const size_t kHeaderSize = 16; const size_t kSegmentSize = 8; // total size of array elements for one segment if (kEndCountOffset > size) { return false; } size_t segCount = readU16(data, kSegCountOffset) >> 1; if (kHeaderSize + segCount * kSegmentSize > size) { return false; } for (size_t i = 0; i < segCount; i++) { int end = readU16(data, kEndCountOffset + 2 * i); int start = readU16(data, kHeaderSize + 2 * (segCount + i)); int rangeOffset = readU16(data, kHeaderSize + 2 * (3 * segCount + i)); if (rangeOffset == 0) { int delta = readU16(data, kHeaderSize + 2 * (2 * segCount + i)); if (((end + delta) & 0xffff) > end - start) { addRange(coverage, start, end + 1); } else { for (int j = start; j < end + 1; j++) { if (((j + delta) & 0xffff) != 0) { addRange(coverage, j, j + 1); } } } } else { for (int j = start; j < end + 1; j++) { uint32_t actualRangeOffset = kHeaderSize + 6 * segCount + rangeOffset + (i + j - start) * 2; if (actualRangeOffset + 2 > size) { return false; } int glyphId = readU16(data, actualRangeOffset); if (glyphId != 0) { addRange(coverage, j, j + 1); } } } } return true; } ",1 "GF_Err pmax_Size(GF_Box *s) { s->size += 4; return GF_OK; } ",0 "static int sco_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_len) { struct sockaddr_sco *sa = (struct sockaddr_sco *) addr; struct sock *sk = sock->sk; int err = 0; BT_DBG(""sk %p %pMR"", sk, &sa->sco_bdaddr); if (!addr || addr->sa_family != AF_BLUETOOTH) return -EINVAL; lock_sock(sk); if (sk->sk_state != BT_OPEN) { err = -EBADFD; goto done; } if (sk->sk_type != SOCK_SEQPACKET) { err = -EINVAL; goto done; } bacpy(&bt_sk(sk)->src, &sa->sco_bdaddr); sk->sk_state = BT_BOUND; done: release_sock(sk); return err; } ",0 "static void __exit sha1_powerpc_mod_fini(void) { crypto_unregister_shash(&alg); } ",0 "WebKitSecurityOrigin* webkit_web_frame_get_security_origin(WebKitWebFrame* frame) { WebKitWebFramePrivate* priv = frame->priv; if (!priv->coreFrame || !priv->coreFrame->document() || !priv->coreFrame->document()->securityOrigin()) return NULL; if (priv->origin && priv->origin->priv->coreOrigin.get() == priv->coreFrame->document()->securityOrigin()) return priv->origin; if (priv->origin) g_object_unref(priv->origin); priv->origin = kit(priv->coreFrame->document()->securityOrigin()); return priv->origin; } ",0 "static bool ExecuteSelectToMark(LocalFrame& frame, Event*, EditorCommandSource, const String&) { const EphemeralRange mark = frame.GetEditor().Mark().ToNormalizedEphemeralRange(); EphemeralRange selection = frame.GetEditor().SelectedRange(); if (mark.IsNull() || selection.IsNull()) return false; frame.Selection().SetSelection( SelectionInDOMTree::Builder() .SetBaseAndExtent(UnionEphemeralRanges(mark, selection)) .Build(), FrameSelection::kCloseTyping); return true; } ",0 "static int kvm_iommu_map_memslots(struct kvm *kvm) { int idx, r = 0; struct kvm_memslots *slots; struct kvm_memory_slot *memslot; idx = srcu_read_lock(&kvm->srcu); slots = kvm_memslots(kvm); kvm_for_each_memslot(memslot, slots) { r = kvm_iommu_map_pages(kvm, memslot); if (r) break; } srcu_read_unlock(&kvm->srcu, idx); return r; } ",0 "static inline unsigned int __inet_dev_addr_type(struct net *net, const struct net_device *dev, __be32 addr, u32 tb_id) { struct flowi4 fl4 = { .daddr = addr }; struct fib_result res; unsigned int ret = RTN_BROADCAST; struct fib_table *table; if (ipv4_is_zeronet(addr) || ipv4_is_lbcast(addr)) return RTN_BROADCAST; if (ipv4_is_multicast(addr)) return RTN_MULTICAST; rcu_read_lock(); table = fib_get_table(net, tb_id); if (table) { ret = RTN_UNICAST; if (!fib_table_lookup(table, &fl4, &res, FIB_LOOKUP_NOREF)) { if (!dev || dev == res.fi->fib_dev) ret = res.type; } } rcu_read_unlock(); return ret; } ",0 "static void reds_char_device_remove_state(SpiceCharDeviceState *st) { RingItem *item; RING_FOREACH(item, &reds->char_devs_states) { SpiceCharDeviceStateItem *st_item; st_item = SPICE_CONTAINEROF(item, SpiceCharDeviceStateItem, link); if (st_item->st == st) { ring_remove(item); free(st_item); return; } } spice_error(""char dev state not found %p"", st); } ",0 "bool GLES2DecoderImpl::ValidateCompressedTexFuncData(const char* function_name, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei size, const GLvoid* data) { GLsizei bytes_required = 0; if (!GetCompressedTexSizeInBytes(function_name, width, height, depth, format, &bytes_required, state_.GetErrorState())) { return false; } if (size != bytes_required) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, function_name, ""size is not correct for dimensions""); return false; } Buffer* buffer = state_.bound_pixel_unpack_buffer.get(); if (buffer && !buffer_manager()->RequestBufferAccess( state_.GetErrorState(), buffer, reinterpret_cast(data), static_cast(bytes_required), function_name, ""pixel unpack buffer"")) { return false; } return true; } ",0 "R_API RFlagItem *r_flag_get_i(RFlag *f, ut64 off) { const RList *list; if (!f) { return NULL; } list = r_flag_get_list (f, off); return list ? evalFlag (f, r_list_get_top (list)) : NULL; } ",0 "MagickExport Image *ComplexImages(const Image *images,const ComplexOperator op, ExceptionInfo *exception) { #define ComplexImageTag ""Complex/Image"" CacheView *Ai_view, *Ar_view, *Bi_view, *Br_view, *Ci_view, *Cr_view; const char *artifact; const Image *Ai_image, *Ar_image, *Bi_image, *Br_image; double snr; Image *Ci_image, *complex_images, *Cr_image, *image; MagickBooleanType status; MagickOffsetType progress; ssize_t y; assert(images != (Image *) NULL); assert(images->signature == MagickCoreSignature); if (images->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"",images->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); if (images->next == (Image *) NULL) { (void) ThrowMagickException(exception,GetMagickModule(),ImageError, ""ImageSequenceRequired"",""`%s'"",images->filename); return((Image *) NULL); } image=CloneImage(images,0,0,MagickTrue,exception); if (image == (Image *) NULL) return((Image *) NULL); if (SetImageStorageClass(image,DirectClass) == MagickFalse) { image=DestroyImageList(image); return(image); } image->depth=32UL; complex_images=NewImageList(); AppendImageToList(&complex_images,image); image=CloneImage(images,0,0,MagickTrue,exception); if (image == (Image *) NULL) { complex_images=DestroyImageList(complex_images); return(complex_images); } AppendImageToList(&complex_images,image); /* Apply complex mathematics to image pixels. */ artifact=GetImageArtifact(image,""complex:snr""); snr=0.0; if (artifact != (const char *) NULL) snr=StringToDouble(artifact,(char **) NULL); Ar_image=images; Ai_image=images->next; Br_image=images; Bi_image=images->next; if ((images->next->next != (Image *) NULL) && (images->next->next->next != (Image *) NULL)) { Br_image=images->next->next; Bi_image=images->next->next->next; } Cr_image=complex_images; Ci_image=complex_images->next; Ar_view=AcquireVirtualCacheView(Ar_image,exception); Ai_view=AcquireVirtualCacheView(Ai_image,exception); Br_view=AcquireVirtualCacheView(Br_image,exception); Bi_view=AcquireVirtualCacheView(Bi_image,exception); Cr_view=AcquireAuthenticCacheView(Cr_image,exception); Ci_view=AcquireAuthenticCacheView(Ci_image,exception); status=MagickTrue; progress=0; #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static) shared(progress,status) \ magick_number_threads(images,complex_images,images->rows,1L) #endif for (y=0; y < (ssize_t) images->rows; y++) { register const PixelPacket *magick_restrict Ai, *magick_restrict Ar, *magick_restrict Bi, *magick_restrict Br; register PixelPacket *magick_restrict Ci, *magick_restrict Cr; register ssize_t x; if (status == MagickFalse) continue; Ar=GetCacheViewVirtualPixels(Ar_view,0,y, MagickMax(Ar_image->columns,Cr_image->columns),1,exception); Ai=GetCacheViewVirtualPixels(Ai_view,0,y, MagickMax(Ai_image->columns,Ci_image->columns),1,exception); Br=GetCacheViewVirtualPixels(Br_view,0,y, MagickMax(Br_image->columns,Cr_image->columns),1,exception); Bi=GetCacheViewVirtualPixels(Bi_view,0,y, MagickMax(Bi_image->columns,Ci_image->columns),1,exception); Cr=QueueCacheViewAuthenticPixels(Cr_view,0,y,Cr_image->columns,1,exception); Ci=QueueCacheViewAuthenticPixels(Ci_view,0,y,Ci_image->columns,1,exception); if ((Ar == (const PixelPacket *) NULL) || (Ai == (const PixelPacket *) NULL) || (Br == (const PixelPacket *) NULL) || (Bi == (const PixelPacket *) NULL) || (Cr == (PixelPacket *) NULL) || (Ci == (PixelPacket *) NULL)) { status=MagickFalse; continue; } for (x=0; x < (ssize_t) images->columns; x++) { switch (op) { case AddComplexOperator: { Cr->red=Ar->red+Br->red; Ci->red=Ai->red+Bi->red; Cr->green=Ar->green+Br->green; Ci->green=Ai->green+Bi->green; Cr->blue=Ar->blue+Br->blue; Ci->blue=Ai->blue+Bi->blue; if (images->matte != MagickFalse) { Cr->opacity=Ar->opacity+Br->opacity; Ci->opacity=Ai->opacity+Bi->opacity; } break; } case ConjugateComplexOperator: default: { Cr->red=Ar->red; Ci->red=(-Bi->red); Cr->green=Ar->green; Ci->green=(-Bi->green); Cr->blue=Ar->blue; Ci->blue=(-Bi->blue); if (images->matte != MagickFalse) { Cr->opacity=Ar->opacity; Ci->opacity=(-Bi->opacity); } break; } case DivideComplexOperator: { double gamma; gamma=PerceptibleReciprocal(Br->red*Br->red+Bi->red*Bi->red+snr); Cr->red=gamma*(Ar->red*Br->red+Ai->red*Bi->red); Ci->red=gamma*(Ai->red*Br->red-Ar->red*Bi->red); gamma=PerceptibleReciprocal(Br->green*Br->green+Bi->green*Bi->green+ snr); Cr->green=gamma*(Ar->green*Br->green+Ai->green*Bi->green); Ci->green=gamma*(Ai->green*Br->green-Ar->green*Bi->green); gamma=PerceptibleReciprocal(Br->blue*Br->blue+Bi->blue*Bi->blue+snr); Cr->blue=gamma*(Ar->blue*Br->blue+Ai->blue*Bi->blue); Ci->blue=gamma*(Ai->blue*Br->blue-Ar->blue*Bi->blue); if (images->matte != MagickFalse) { gamma=PerceptibleReciprocal(Br->opacity*Br->opacity+Bi->opacity* Bi->opacity+snr); Cr->opacity=gamma*(Ar->opacity*Br->opacity+Ai->opacity* Bi->opacity); Ci->opacity=gamma*(Ai->opacity*Br->opacity-Ar->opacity* Bi->opacity); } break; } case MagnitudePhaseComplexOperator: { Cr->red=sqrt(Ar->red*Ar->red+Ai->red*Ai->red); Ci->red=atan2(Ai->red,Ar->red)/(2.0*MagickPI)+0.5; Cr->green=sqrt(Ar->green*Ar->green+Ai->green*Ai->green); Ci->green=atan2(Ai->green,Ar->green)/(2.0*MagickPI)+0.5; Cr->blue=sqrt(Ar->blue*Ar->blue+Ai->blue*Ai->blue); Ci->blue=atan2(Ai->blue,Ar->blue)/(2.0*MagickPI)+0.5; if (images->matte != MagickFalse) { Cr->opacity=sqrt(Ar->opacity*Ar->opacity+Ai->opacity*Ai->opacity); Ci->opacity=atan2(Ai->opacity,Ar->opacity)/(2.0*MagickPI)+0.5; } break; } case MultiplyComplexOperator: { Cr->red=QuantumScale*(Ar->red*Br->red-Ai->red*Bi->red); Ci->red=QuantumScale*(Ai->red*Br->red+Ar->red*Bi->red); Cr->green=QuantumScale*(Ar->green*Br->green-Ai->green*Bi->green); Ci->green=QuantumScale*(Ai->green*Br->green+Ar->green*Bi->green); Cr->blue=QuantumScale*(Ar->blue*Br->blue-Ai->blue*Bi->blue); Ci->blue=QuantumScale*(Ai->blue*Br->blue+Ar->blue*Bi->blue); if (images->matte != MagickFalse) { Cr->opacity=QuantumScale*(Ar->opacity*Br->opacity-Ai->opacity* Bi->opacity); Ci->opacity=QuantumScale*(Ai->opacity*Br->opacity+Ar->opacity* Bi->opacity); } break; } case RealImaginaryComplexOperator: { Cr->red=Ar->red*cos(2.0*MagickPI*(Ai->red-0.5)); Ci->red=Ar->red*sin(2.0*MagickPI*(Ai->red-0.5)); Cr->green=Ar->green*cos(2.0*MagickPI*(Ai->green-0.5)); Ci->green=Ar->green*sin(2.0*MagickPI*(Ai->green-0.5)); Cr->blue=Ar->blue*cos(2.0*MagickPI*(Ai->blue-0.5)); Ci->blue=Ar->blue*sin(2.0*MagickPI*(Ai->blue-0.5)); if (images->matte != MagickFalse) { Cr->opacity=Ar->opacity*cos(2.0*MagickPI*(Ai->opacity-0.5)); Ci->opacity=Ar->opacity*sin(2.0*MagickPI*(Ai->opacity-0.5)); } break; } case SubtractComplexOperator: { Cr->red=Ar->red-Br->red; Ci->red=Ai->red-Bi->red; Cr->green=Ar->green-Br->green; Ci->green=Ai->green-Bi->green; Cr->blue=Ar->blue-Br->blue; Ci->blue=Ai->blue-Bi->blue; if (images->matte != MagickFalse) { Cr->opacity=Ar->opacity-Br->opacity; Ci->opacity=Ai->opacity-Bi->opacity; } break; } } Ar++; Ai++; Br++; Bi++; Cr++; Ci++; } if (SyncCacheViewAuthenticPixels(Ci_view,exception) == MagickFalse) status=MagickFalse; if (SyncCacheViewAuthenticPixels(Cr_view,exception) == MagickFalse) status=MagickFalse; if (images->progress_monitor != (MagickProgressMonitor) NULL) { MagickBooleanType proceed; #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp atomic #endif progress++; proceed=SetImageProgress(images,ComplexImageTag,progress,images->rows); if (proceed == MagickFalse) status=MagickFalse; } } Cr_view=DestroyCacheView(Cr_view); Ci_view=DestroyCacheView(Ci_view); Br_view=DestroyCacheView(Br_view); Bi_view=DestroyCacheView(Bi_view); Ar_view=DestroyCacheView(Ar_view); Ai_view=DestroyCacheView(Ai_view); if (status == MagickFalse) complex_images=DestroyImageList(complex_images); return(complex_images); } ",1 "vbf_stp_fetchbody(struct worker *wrk, struct busyobj *bo) { ssize_t l; uint8_t *ptr; enum vfp_status vfps = VFP_ERROR; ssize_t est; struct vfp_ctx *vfc; CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); vfc = bo->vfc; CHECK_OBJ_NOTNULL(vfc, VFP_CTX_MAGIC); AN(vfc->vfp_nxt); est = bo->htc->content_length; if (est < 0) est = 0; do { if (vfc->oc->flags & OC_F_ABANDON) { /* * A pass object and delivery was terminated * We don't fail the fetch, in order for hit-for-pass * objects to be created. */ AN(vfc->oc->flags & OC_F_PASS); VSLb(wrk->vsl, SLT_FetchError, ""Pass delivery abandoned""); bo->htc->doclose = SC_RX_BODY; break; } AZ(vfc->failed); l = est; assert(l >= 0); if (VFP_GetStorage(vfc, &l, &ptr) != VFP_OK) { bo->htc->doclose = SC_RX_BODY; break; } AZ(vfc->failed); vfps = VFP_Suck(vfc, ptr, &l); if (l > 0 && vfps != VFP_ERROR) { bo->acct.beresp_bodybytes += l; VFP_Extend(vfc, l); if (est >= l) est -= l; else est = 0; } } while (vfps == VFP_OK); if (vfc->failed) { (void)VFP_Error(vfc, ""Fetch pipeline failed to process""); bo->htc->doclose = SC_RX_BODY; VFP_Close(vfc); VDI_Finish(wrk, bo); if (!bo->do_stream) { assert(bo->fetch_objcore->boc->state < BOS_STREAM); return (F_STP_ERROR); } else { wrk->stats->fetch_failed++; return (F_STP_FAIL); } } ObjTrimStore(wrk, vfc->oc); return (F_STP_FETCHEND); } ",0 "static int blk_mangle_minor(int minor) { #ifdef CONFIG_DEBUG_BLOCK_EXT_DEVT int i; for (i = 0; i < MINORBITS / 2; i++) { int low = minor & (1 << i); int high = minor & (1 << (MINORBITS - 1 - i)); int distance = MINORBITS - 1 - 2 * i; minor ^= low | high; /* clear both bits */ low <<= distance; /* swap the positions */ high >>= distance; minor |= low | high; /* and set */ } #endif return minor; } ",0 "Sample::Sample(int sampleID, int fd, int64_t offset, int64_t length) { init(); mSampleID = sampleID; mFd = dup(fd); mOffset = offset; mLength = length; ALOGV(""create sampleID=%d, fd=%d, offset=%"" PRId64 "" length=%"" PRId64, mSampleID, mFd, mLength, mOffset); } ",0 "CJSON_PUBLIC(cJSON*) cJSON_AddStringToObject(cJSON * const object, const char * const name, const char * const string) { cJSON *string_item = cJSON_CreateString(string); if (add_item_to_object(object, name, string_item, &global_hooks, false)) { return string_item; } cJSON_Delete(string_item); return NULL; } ",0 "SPL_METHOD(Array, count) { long count; spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(getThis() TSRMLS_CC); if (zend_parse_parameters_none() == FAILURE) { return; } spl_array_object_count_elements_helper(intern, &count TSRMLS_CC); RETURN_LONG(count); } /* }}} */ static void spl_array_method(INTERNAL_FUNCTION_PARAMETERS, char *fname, int fname_len, int use_arg) /* {{{ */ ",0 "bool InputHandler::setSelection(int start, int end, bool changeIsPartOfComposition) { if (!isActiveTextEdit()) return false; ASSERT(m_currentFocusElement->document() && m_currentFocusElement->document()->frame()); ProcessingChangeGuard guard(this); VisibleSelection newSelection = DOMSupport::visibleSelectionForRangeInputElement(m_currentFocusElement.get(), start, end); m_currentFocusElement->document()->frame()->selection()->setSelection(newSelection, changeIsPartOfComposition ? 0 : FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle); InputLog(LogLevelInfo, ""InputHandler::setSelection selectionStart=%u, selectionEnd=%u"", start, end); return start == selectionStart() && end == selectionEnd(); } ",0 "const TIFF_MemoryReader::TweakedIFDEntry* TIFF_MemoryReader::FindTagInIFD ( XMP_Uns8 ifd, XMP_Uns16 id ) const { if ( ifd == kTIFF_KnownIFD ) { } if ( ifd > kTIFF_LastRealIFD ) XMP_Throw ( ""Invalid IFD requested"", kXMPErr_InternalFailure ); const TweakedIFDInfo* thisIFD = &containedIFDs[ifd]; if ( thisIFD->count == 0 ) return 0; XMP_Uns32 spanLength = thisIFD->count; const TweakedIFDEntry* spanBegin = &(thisIFD->entries[0]); while ( spanLength > 1 ) { XMP_Uns32 halfLength = spanLength >> 1; // Since spanLength > 1, halfLength > 0. const TweakedIFDEntry* spanMiddle = spanBegin + halfLength; XMP_Uns16 middleID = GetUns16AsIs ( &spanMiddle->id ); if ( middleID == id ) { spanBegin = spanMiddle; break; } else if ( middleID > id ) { spanLength = halfLength; // Discard the middle. } else { spanBegin = spanMiddle; // Keep a valid spanBegin for the return check, don't use spanMiddle+1. spanLength -= halfLength; } } if ( GetUns16AsIs(&spanBegin->id) != id ) spanBegin = 0; return spanBegin; } // TIFF_MemoryReader::FindTagInIFD ",0 "GfxFont *GfxResources::lookupFont(char *name) { GfxFont *font; GfxResources *resPtr; for (resPtr = this; resPtr; resPtr = resPtr->next) { if (resPtr->fonts) { if ((font = resPtr->fonts->lookup(name))) return font; } } error(-1, ""Unknown font tag '%s'"", name); return NULL; } ",0 "void __init early_trap_pf_init(void) { #ifdef CONFIG_X86_64 set_intr_gate(X86_TRAP_PF, page_fault); #endif } ",0 "static unsigned char convert_num_notes_to_fanout(uintmax_t num_notes) { unsigned char fanout = 0; while ((num_notes >>= 8)) fanout++; return fanout; } ",0 "event_signal(void *eventhdl) { return (int)SetEvent((HANDLE)eventhdl); } ",0 "void HTMLLinkElement::attach() { if (m_shouldProcessAfterAttach) { m_shouldProcessAfterAttach = false; queuePostAttachCallback(&HTMLLinkElement::processCallback, this); } HTMLElement::attach(); } ",1 "void LoginDisplayHostWebUI::SetOobeProgressBarVisible(bool visible) { GetOobeUI()->ShowOobeUI(visible); } ",0 "static opj_bool pi_next_rlcp(opj_pi_iterator_t * pi) { opj_pi_comp_t *comp = NULL; opj_pi_resolution_t *res = NULL; long index = 0; if (!pi->first) { comp = &pi->comps[pi->compno]; res = &comp->resolutions[pi->resno]; goto LABEL_SKIP; } else { pi->first = 0; } for (pi->resno = pi->poc.resno0; pi->resno < pi->poc.resno1; pi->resno++) { for (pi->layno = pi->poc.layno0; pi->layno < pi->poc.layno1; pi->layno++) { for (pi->compno = pi->poc.compno0; pi->compno < pi->poc.compno1; pi->compno++) { comp = &pi->comps[pi->compno]; if (pi->resno >= comp->numresolutions) { continue; } res = &comp->resolutions[pi->resno]; if (!pi->tp_on) { pi->poc.precno1 = res->pw * res->ph; } for (pi->precno = pi->poc.precno0; pi->precno < pi->poc.precno1; pi->precno++) { index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno * pi->step_c + pi->precno * pi->step_p; if (!pi->include[index]) { pi->include[index] = 1; return OPJ_TRUE; } LABEL_SKIP: ; } } } } return OPJ_FALSE; } ",1 "bool GLES2DecoderPassthroughImpl::IsEmulatedFramebufferBound( GLenum target) const { if (!emulated_back_buffer_) { return false; } if ((target == GL_FRAMEBUFFER_EXT || target == GL_DRAW_FRAMEBUFFER) && bound_draw_framebuffer_ == 0) { return true; } if (target == GL_READ_FRAMEBUFFER && bound_read_framebuffer_ == 0) { return true; } return false; } ",0 " virtual void TearDown() { delete[] src_; delete[] ref_; libvpx_test::ClearSystemState(); } ",1 "IPC::SyncMessageFilter* RenderThreadImpl::GetSyncMessageFilter() { return sync_message_filter(); } ",0 "static int x86_pmu_handle_irq(struct pt_regs *regs) { struct perf_sample_data data; struct cpu_hw_events *cpuc; struct perf_event *event; int idx, handled = 0; u64 val; perf_sample_data_init(&data, 0); cpuc = &__get_cpu_var(cpu_hw_events); for (idx = 0; idx < x86_pmu.num_counters; idx++) { if (!test_bit(idx, cpuc->active_mask)) { /* * Though we deactivated the counter some cpus * might still deliver spurious interrupts still * in flight. Catch them: */ if (__test_and_clear_bit(idx, cpuc->running)) handled++; continue; } event = cpuc->events[idx]; val = x86_perf_event_update(event); if (val & (1ULL << (x86_pmu.cntval_bits - 1))) continue; /* * event overflow */ handled++; data.period = event->hw.last_period; if (!x86_perf_event_set_period(event)) continue; if (perf_event_overflow(event, 1, &data, regs)) x86_pmu_stop(event, 0); } if (handled) inc_irq_stat(apic_perf_irqs); return handled; } ",0 "log_result (PolkitBackendInteractiveAuthority *authority, const gchar *action_id, PolkitSubject *subject, PolkitSubject *caller, PolkitAuthorizationResult *result) { PolkitBackendInteractiveAuthorityPrivate *priv; PolkitIdentity *user_of_subject; const gchar *log_result_str; gchar *subject_str; gchar *user_of_subject_str; gchar *caller_str; gchar *subject_cmdline; gchar *caller_cmdline; priv = POLKIT_BACKEND_INTERACTIVE_AUTHORITY_GET_PRIVATE (authority); log_result_str = ""DENYING""; if (polkit_authorization_result_get_is_authorized (result)) log_result_str = ""ALLOWING""; user_of_subject = polkit_backend_session_monitor_get_user_for_subject (priv->session_monitor, subject, NULL); subject_str = polkit_subject_to_string (subject); if (user_of_subject != NULL) user_of_subject_str = polkit_identity_to_string (user_of_subject); else user_of_subject_str = g_strdup (""""); caller_str = polkit_subject_to_string (caller); subject_cmdline = _polkit_subject_get_cmdline (subject); if (subject_cmdline == NULL) subject_cmdline = g_strdup (""""); caller_cmdline = _polkit_subject_get_cmdline (caller); if (caller_cmdline == NULL) caller_cmdline = g_strdup (""""); polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), ""%s action %s for %s [%s] owned by %s (check requested by %s [%s])"", log_result_str, action_id, subject_str, subject_cmdline, user_of_subject_str, caller_str, caller_cmdline); if (user_of_subject != NULL) g_object_unref (user_of_subject); g_free (subject_str); g_free (user_of_subject_str); g_free (caller_str); g_free (subject_cmdline); g_free (caller_cmdline); } ",1 " LoginWidgetDelegate(views::Widget* widget, LoginDisplayHostWebUI* host) : widget_(widget), login_display_host_(host) { DCHECK(widget_); DCHECK(login_display_host_); } ",0 "static struct xfrm_policy *xfrm_policy_construct(struct net *net, struct xfrm_userpolicy_info *p, struct nlattr **attrs, int *errp) { struct xfrm_policy *xp = xfrm_policy_alloc(net, GFP_KERNEL); int err; if (!xp) { *errp = -ENOMEM; return NULL; } copy_from_user_policy(xp, p); err = copy_from_user_policy_type(&xp->type, attrs); if (err) goto error; if (!(err = copy_from_user_tmpl(xp, attrs))) err = copy_from_user_sec_ctx(xp, attrs); if (err) goto error; xfrm_mark_get(attrs, &xp->mark); return xp; error: *errp = err; xp->walk.dead = 1; xfrm_policy_destroy(xp); return NULL; } ",0 " bool ScrollStateIsContentConsuming() const { return scroll_state() == OverscrollController::ScrollState::CONTENT_CONSUMING; } ",0 "static int mailimf_unstrict_crlf_parse(const char * message, size_t length, size_t * indx) { size_t cur_token; int r; cur_token = * indx; mailimf_cfws_parse(message, length, &cur_token); r = mailimf_char_parse(message, length, &cur_token, '\r'); if ((r != MAILIMF_NO_ERROR) && (r != MAILIMF_ERROR_PARSE)) return r; r = mailimf_char_parse(message, length, &cur_token, '\n'); if (r != MAILIMF_NO_ERROR) return r; * indx = cur_token; return MAILIMF_NO_ERROR; } ",0 " void Shell::SizeTo(int width, int height) { content_width_ = width; content_height_ = height; if (web_contents_.get()) { gtk_widget_set_size_request(web_contents_->GetNativeView(), width, height); } } ",0 "static inline int tg_has_rt_tasks(struct task_group *tg) { struct task_struct *g, *p; do_each_thread(g, p) { if (rt_task(p) && task_rq(p)->rt.tg == tg) return 1; } while_each_thread(g, p); return 0; } ",0 "static void pmcraid_get_fwversion(struct pmcraid_cmd *cmd) { struct pmcraid_ioarcb *ioarcb = &cmd->ioa_cb->ioarcb; struct pmcraid_ioadl_desc *ioadl = ioarcb->add_data.u.ioadl; struct pmcraid_instance *pinstance = cmd->drv_inst; u16 data_size = sizeof(struct pmcraid_inquiry_data); pmcraid_reinit_cmdblk(cmd); ioarcb->request_type = REQ_TYPE_SCSI; ioarcb->resource_handle = cpu_to_le32(PMCRAID_IOA_RES_HANDLE); ioarcb->cdb[0] = INQUIRY; ioarcb->cdb[1] = 1; ioarcb->cdb[2] = 0xD0; ioarcb->cdb[3] = (data_size >> 8) & 0xFF; ioarcb->cdb[4] = data_size & 0xFF; /* Since entire inquiry data it can be part of IOARCB itself */ ioarcb->ioadl_bus_addr = cpu_to_le64((cmd->ioa_cb_bus_addr) + offsetof(struct pmcraid_ioarcb, add_data.u.ioadl[0])); ioarcb->ioadl_length = cpu_to_le32(sizeof(struct pmcraid_ioadl_desc)); ioarcb->ioarcb_bus_addr &= ~(0x1FULL); ioarcb->request_flags0 |= NO_LINK_DESCS; ioarcb->data_transfer_length = cpu_to_le32(data_size); ioadl = &(ioarcb->add_data.u.ioadl[0]); ioadl->flags = IOADL_FLAGS_LAST_DESC; ioadl->address = cpu_to_le64(pinstance->inq_data_baddr); ioadl->data_len = cpu_to_le32(data_size); pmcraid_send_cmd(cmd, pmcraid_get_fwversion_done, PMCRAID_INTERNAL_TIMEOUT, pmcraid_timeout_handler); } ",0 "bool jspIsConstructor(JsVar *constructor, const char *constructorName) { JsVar *objFunc = jsvObjectGetChild(execInfo.root, constructorName, 0); if (!objFunc) return false; bool isConstructor = objFunc == constructor; jsvUnLock(objFunc); return isConstructor; } ",0 "void WebSocketJob::OnReceivedHandshakeResponse( SocketStream* socket, const char* data, int len) { DCHECK_EQ(state_, CONNECTING); if (handshake_response_->HasResponse()) { receive_frame_handler_->AppendData(data, len); return; } size_t response_length = handshake_response_->ParseRawResponse(data, len); if (!handshake_response_->HasResponse()) { return; } socket_->net_log()->AddEvent( NetLog::TYPE_WEB_SOCKET_READ_RESPONSE_HEADERS, make_scoped_refptr(new NetLogWebSocketHandshakeParameter( handshake_response_->GetRawResponse()))); if (len - response_length > 0) { receive_frame_handler_->AppendData(data + response_length, len - response_length); } SaveCookiesAndNotifyHeaderComplete(); } ",0 "int RenderBox::perpendicularContainingBlockLogicalHeight() const { RenderBlock* cb = containingBlock(); RenderStyle* containingBlockStyle = cb->style(); Length logicalHeightLength = containingBlockStyle->logicalHeight(); if (!logicalHeightLength.isFixed()) { return containingBlockStyle->isHorizontalWritingMode() ? view()->frameView()->visibleHeight() : view()->frameView()->visibleWidth(); } return cb->computeContentBoxLogicalHeight(logicalHeightLength.value()); } ",0 "ext4_ext_shift_path_extents(struct ext4_ext_path *path, ext4_lblk_t shift, struct inode *inode, handle_t *handle, ext4_lblk_t *start) { int depth, err = 0; struct ext4_extent *ex_start, *ex_last; bool update = 0; depth = path->p_depth; while (depth >= 0) { if (depth == path->p_depth) { ex_start = path[depth].p_ext; if (!ex_start) return -EIO; ex_last = EXT_LAST_EXTENT(path[depth].p_hdr); err = ext4_access_path(handle, inode, path + depth); if (err) goto out; if (ex_start == EXT_FIRST_EXTENT(path[depth].p_hdr)) update = 1; *start = le32_to_cpu(ex_last->ee_block) + ext4_ext_get_actual_len(ex_last); while (ex_start <= ex_last) { le32_add_cpu(&ex_start->ee_block, -shift); /* Try to merge to the left. */ if ((ex_start > EXT_FIRST_EXTENT(path[depth].p_hdr)) && ext4_ext_try_to_merge_right(inode, path, ex_start - 1)) ex_last--; else ex_start++; } err = ext4_ext_dirty(handle, inode, path + depth); if (err) goto out; if (--depth < 0 || !update) break; } /* Update index too */ err = ext4_access_path(handle, inode, path + depth); if (err) goto out; le32_add_cpu(&path[depth].p_idx->ei_block, -shift); err = ext4_ext_dirty(handle, inode, path + depth); if (err) goto out; /* we are done if current index is not a starting index */ if (path[depth].p_idx != EXT_FIRST_INDEX(path[depth].p_hdr)) break; depth--; } out: return err; } ",0 "void Splash::vertFlipImage(SplashBitmap *img, int width, int height, int nComps) { Guchar *lineBuf; Guchar *p0, *p1; int w; if (unlikely(img->data == NULL)) { error(errInternal, -1, ""img->data is NULL in Splash::vertFlipImage""); return; } w = width * nComps; lineBuf = (Guchar *)gmalloc(w); for (p0 = img->data, p1 = img->data + (height - 1) * w; p0 < p1; p0 += w, p1 -= w) { memcpy(lineBuf, p0, w); memcpy(p0, p1, w); memcpy(p1, lineBuf, w); } if (img->alpha) { for (p0 = img->alpha, p1 = img->alpha + (height - 1) * width; p0 < p1; p0 += width, p1 -= width) { memcpy(lineBuf, p0, width); memcpy(p0, p1, width); memcpy(p1, lineBuf, width); } } gfree(lineBuf); } ",0 " bool InitSkBitmapFromData(SkBitmap* bitmap, const char* pixels, size_t total_pixels) const { if (total_pixels) { bitmap->setConfig(fConfig, fWidth, fHeight, 0); if (!bitmap->allocPixels()) return false; if (total_pixels != bitmap->getSize()) return false; memcpy(bitmap->getPixels(), pixels, total_pixels); } return true; } ",0 "void init_cfs_bandwidth(struct cfs_bandwidth *cfs_b) {} ",0 "DEFINE_TRACE(BaseFetchContext) { FetchContext::Trace(visitor); } ",0 "void __ext4_warning(struct super_block *sb, const char *function, const char *fmt, ...) { va_list args; va_start(args, fmt); printk(KERN_WARNING ""EXT4-fs warning (device %s): %s: "", sb->s_id, function); vprintk(fmt, args); printk(""\n""); va_end(args); } ",0 "static int decode_studiovisualobject(Mpeg4DecContext *ctx, GetBitContext *gb) { MpegEncContext *s = &ctx->m; int visual_object_type; skip_bits(gb, 4); /* visual_object_verid */ visual_object_type = get_bits(gb, 4); if (visual_object_type != VOT_VIDEO_ID) { avpriv_request_sample(s->avctx, ""VO type %u"", visual_object_type); return AVERROR_PATCHWELCOME; } next_start_code_studio(gb); extension_and_user_data(s, gb, 1); return 0; } ",0 "void InputMethodIBus::CancelComposition(const TextInputClient* client) { if (context_focused_ && IsTextInputClientFocused(client)) ResetContext(); } ",0 "void Con_MessageMode4_f( void ) { chat_playerNum = VM_Call( cgvm, CG_LAST_ATTACKER ); if ( chat_playerNum < 0 || chat_playerNum >= MAX_CLIENTS ) { chat_playerNum = -1; return; } chat_team = qfalse; Field_Clear( &chatField ); chatField.widthInChars = 30; Key_SetCatcher( Key_GetCatcher( ) ^ KEYCATCH_MESSAGE ); } ",0 "getname(netdissect_options *ndo, const u_char *ap) { register struct hostent *hp; uint32_t addr; struct hnamemem *p; memcpy(&addr, ap, sizeof(addr)); p = &hnametable[addr & (HASHNAMESIZE-1)]; for (; p->nxt; p = p->nxt) { if (p->addr == addr) return (p->name); } p->addr = addr; p->nxt = newhnamemem(ndo); /* * Print names unless: * (1) -n was given. * (2) Address is foreign and -f was given. (If -f was not * given, f_netmask and f_localnet are 0 and the test * evaluates to true) */ if (!ndo->ndo_nflag && (addr & f_netmask) == f_localnet) { #ifdef HAVE_CASPER if (capdns != NULL) { hp = cap_gethostbyaddr(capdns, (char *)&addr, 4, AF_INET); } else #endif hp = gethostbyaddr((char *)&addr, 4, AF_INET); if (hp) { char *dotp; p->name = strdup(hp->h_name); if (p->name == NULL) (*ndo->ndo_error)(ndo, ""getname: strdup(hp->h_name)""); if (ndo->ndo_Nflag) { /* Remove domain qualifications */ dotp = strchr(p->name, '.'); if (dotp) *dotp = '\0'; } return (p->name); } } p->name = strdup(intoa(addr)); if (p->name == NULL) (*ndo->ndo_error)(ndo, ""getname: strdup(intoa(addr))""); return (p->name); } ",0 "scoped_refptr RendererSchedulerImpl::NewTaskQueue( const MainThreadTaskQueue::QueueCreationParams& params) { helper_.CheckOnValidThread(); scoped_refptr task_queue(helper_.NewTaskQueue(params)); std::unique_ptr voter; if (params.can_be_blocked || params.can_be_paused || params.can_be_stopped) voter = task_queue->CreateQueueEnabledVoter(); auto insert_result = task_runners_.insert(std::make_pair(task_queue, std::move(voter))); auto queue_class = task_queue->queue_class(); if (queue_class == MainThreadTaskQueue::QueueClass::kTimer) { task_queue->AddTaskObserver(&main_thread_only().timer_task_cost_estimator); } else if (queue_class == MainThreadTaskQueue::QueueClass::kLoading) { task_queue->AddTaskObserver( &main_thread_only().loading_task_cost_estimator); } ApplyTaskQueuePolicy( task_queue.get(), insert_result.first->second.get(), TaskQueuePolicy(), main_thread_only().current_policy.GetQueuePolicy(queue_class)); if (task_queue->CanBeThrottled()) AddQueueToWakeUpBudgetPool(task_queue.get()); if (queue_class == MainThreadTaskQueue::QueueClass::kTimer) { if (main_thread_only().virtual_time_stopped) task_queue->InsertFence(TaskQueue::InsertFencePosition::kNow); } return task_queue; } ",0 "static WebURLRequest::RequestContext DetermineRequestContextFromNavigationType( const NavigationType navigation_type) { switch (navigation_type) { case kNavigationTypeLinkClicked: return WebURLRequest::kRequestContextHyperlink; case kNavigationTypeOther: return WebURLRequest::kRequestContextLocation; case kNavigationTypeFormResubmitted: case kNavigationTypeFormSubmitted: return WebURLRequest::kRequestContextForm; case kNavigationTypeBackForward: case kNavigationTypeReload: return WebURLRequest::kRequestContextInternal; } NOTREACHED(); return WebURLRequest::kRequestContextHyperlink; } ",0 "static void usbip_iso_packet_correct_endian( struct usbip_iso_packet_descriptor *iso, int send) { /* does not need all members. but copy all simply. */ if (send) { iso->offset = cpu_to_be32(iso->offset); iso->length = cpu_to_be32(iso->length); iso->status = cpu_to_be32(iso->status); iso->actual_length = cpu_to_be32(iso->actual_length); } else { iso->offset = be32_to_cpu(iso->offset); iso->length = be32_to_cpu(iso->length); iso->status = be32_to_cpu(iso->status); iso->actual_length = be32_to_cpu(iso->actual_length); } } ",0 " void RunMethod(Method method) { (this->*method)(); } ",0 "int __kill_pgrp_info(int sig, struct siginfo *info, struct pid *pgrp) { struct task_struct *p = NULL; int retval, success; success = 0; retval = -ESRCH; do_each_pid_task(pgrp, PIDTYPE_PGID, p) { int err = group_send_sig_info(sig, info, p); success |= !err; retval = err; } while_each_pid_task(pgrp, PIDTYPE_PGID, p); return success ? 0 : retval; } ",0 "static void skb_headers_offset_update(struct sk_buff *skb, int off) { /* Only adjust this if it actually is csum_start rather than csum */ if (skb->ip_summed == CHECKSUM_PARTIAL) skb->csum_start += off; /* {transport,network,mac}_header and tail are relative to skb->head */ skb->transport_header += off; skb->network_header += off; if (skb_mac_header_was_set(skb)) skb->mac_header += off; skb->inner_transport_header += off; skb->inner_network_header += off; skb->inner_mac_header += off; } ",0 "static void iw_set_auto_resizetype(struct iw_context *ctx, int size1, int size2, int dimension) { if(size2==size1 && !ctx->resize_settings[dimension].use_offset && !ctx->req.out_true_valid && ctx->resize_settings[dimension].translate==0.0) { iw_set_resize_alg(ctx, dimension, IW_RESIZETYPE_NULL, 1.0, 0.0, 0.0); return; } iw_set_resize_alg(ctx, dimension, IW_RESIZETYPE_CUBIC, 1.0, 0.0, 0.5); } ",0 "static PHP_METHOD(PDOStatement, getColumnMeta) { long colno; struct pdo_column_data *col; PHP_STMT_GET_OBJ; if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""l"", &colno)) { RETURN_FALSE; } if(colno < 0) { pdo_raise_impl_error(stmt->dbh, stmt, ""42P10"", ""column number must be non-negative"" TSRMLS_CC); RETURN_FALSE; } if (!stmt->methods->get_column_meta) { pdo_raise_impl_error(stmt->dbh, stmt, ""IM001"", ""driver doesn't support meta data"" TSRMLS_CC); RETURN_FALSE; } PDO_STMT_CLEAR_ERR(); if (FAILURE == stmt->methods->get_column_meta(stmt, colno, return_value TSRMLS_CC)) { PDO_HANDLE_STMT_ERR(); RETURN_FALSE; } /* add stock items */ col = &stmt->columns[colno]; add_assoc_string(return_value, ""name"", col->name, 1); add_assoc_long(return_value, ""len"", col->maxlen); /* FIXME: unsigned ? */ add_assoc_long(return_value, ""precision"", col->precision); if (col->param_type != PDO_PARAM_ZVAL) { /* if param_type is PDO_PARAM_ZVAL the driver has to provide correct data */ add_assoc_long(return_value, ""pdo_type"", col->param_type); } } ",0 "static Image *ReadBMPImage(const ImageInfo *image_info,ExceptionInfo *exception) { BMPInfo bmp_info; Image *image; MagickBooleanType status; MagickOffsetType offset, start_position; MemoryInfo *pixel_info; Quantum index; register Quantum *q; register ssize_t i, x; register unsigned char *p; size_t bit, bytes_per_line, length; ssize_t count, y; unsigned char magick[12], *pixels; unsigned int blue, green, offset_bits, red; /* 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,exception); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } /* Determine if this a BMP file. */ (void) memset(&bmp_info,0,sizeof(bmp_info)); bmp_info.ba_offset=0; start_position=0; offset_bits=0; count=ReadBlob(image,2,magick); if (count != 2) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); do { PixelInfo quantum_bits; PixelPacket shift; /* Verify BMP identifier. */ if (bmp_info.ba_offset == 0) start_position=TellBlob(image)-2; bmp_info.ba_offset=0; while (LocaleNCompare((char *) magick,""BA"",2) == 0) { bmp_info.file_size=ReadBlobLSBLong(image); bmp_info.ba_offset=ReadBlobLSBLong(image); bmp_info.offset_bits=ReadBlobLSBLong(image); count=ReadBlob(image,2,magick); if (count != 2) break; } if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(),"" Magick: %c%c"", magick[0],magick[1]); if ((count != 2) || ((LocaleNCompare((char *) magick,""BM"",2) != 0) && (LocaleNCompare((char *) magick,""CI"",2) != 0))) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); bmp_info.file_size=ReadBlobLSBLong(image); (void) ReadBlobLSBLong(image); bmp_info.offset_bits=ReadBlobLSBLong(image); bmp_info.size=ReadBlobLSBLong(image); if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(),"" BMP size: %u"", bmp_info.size); if (bmp_info.size == 12) { /* OS/2 BMP image file. */ (void) CopyMagickString(image->magick,""BMP2"",MagickPathExtent); bmp_info.width=(ssize_t) ((short) ReadBlobLSBShort(image)); bmp_info.height=(ssize_t) ((short) ReadBlobLSBShort(image)); bmp_info.planes=ReadBlobLSBShort(image); bmp_info.bits_per_pixel=ReadBlobLSBShort(image); bmp_info.x_pixels=0; bmp_info.y_pixels=0; bmp_info.number_colors=0; bmp_info.compression=BI_RGB; bmp_info.image_size=0; bmp_info.alpha_mask=0; if (image->debug != MagickFalse) { (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Format: OS/2 Bitmap""); (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Geometry: %.20gx%.20g"",(double) bmp_info.width,(double) bmp_info.height); } } else { /* Microsoft Windows BMP image file. */ if (bmp_info.size < 40) ThrowReaderException(CorruptImageError,""NonOS2HeaderSizeError""); bmp_info.width=(ssize_t) ReadBlobLSBSignedLong(image); bmp_info.height=(ssize_t) ReadBlobLSBSignedLong(image); bmp_info.planes=ReadBlobLSBShort(image); bmp_info.bits_per_pixel=ReadBlobLSBShort(image); bmp_info.compression=ReadBlobLSBLong(image); bmp_info.image_size=ReadBlobLSBLong(image); bmp_info.x_pixels=ReadBlobLSBLong(image); bmp_info.y_pixels=ReadBlobLSBLong(image); bmp_info.number_colors=ReadBlobLSBLong(image); bmp_info.colors_important=ReadBlobLSBLong(image); if (image->debug != MagickFalse) { (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Format: MS Windows bitmap""); (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Geometry: %.20gx%.20g"",(double) bmp_info.width,(double) bmp_info.height); (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Bits per pixel: %.20g"",(double) bmp_info.bits_per_pixel); switch (bmp_info.compression) { case BI_RGB: { (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Compression: BI_RGB""); break; } case BI_RLE4: { (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Compression: BI_RLE4""); break; } case BI_RLE8: { (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Compression: BI_RLE8""); break; } case BI_BITFIELDS: { (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Compression: BI_BITFIELDS""); break; } case BI_PNG: { (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Compression: BI_PNG""); break; } case BI_JPEG: { (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Compression: BI_JPEG""); break; } default: { (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Compression: UNKNOWN (%u)"",bmp_info.compression); } } (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Number of colors: %u"",bmp_info.number_colors); } bmp_info.red_mask=ReadBlobLSBLong(image); bmp_info.green_mask=ReadBlobLSBLong(image); bmp_info.blue_mask=ReadBlobLSBLong(image); if (bmp_info.size > 40) { double gamma; /* Read color management information. */ bmp_info.alpha_mask=ReadBlobLSBLong(image); bmp_info.colorspace=ReadBlobLSBSignedLong(image); /* Decode 2^30 fixed point formatted CIE primaries. */ # define BMP_DENOM ((double) 0x40000000) bmp_info.red_primary.x=(double) ReadBlobLSBLong(image)/BMP_DENOM; bmp_info.red_primary.y=(double) ReadBlobLSBLong(image)/BMP_DENOM; bmp_info.red_primary.z=(double) ReadBlobLSBLong(image)/BMP_DENOM; bmp_info.green_primary.x=(double) ReadBlobLSBLong(image)/BMP_DENOM; bmp_info.green_primary.y=(double) ReadBlobLSBLong(image)/BMP_DENOM; bmp_info.green_primary.z=(double) ReadBlobLSBLong(image)/BMP_DENOM; bmp_info.blue_primary.x=(double) ReadBlobLSBLong(image)/BMP_DENOM; bmp_info.blue_primary.y=(double) ReadBlobLSBLong(image)/BMP_DENOM; bmp_info.blue_primary.z=(double) ReadBlobLSBLong(image)/BMP_DENOM; gamma=bmp_info.red_primary.x+bmp_info.red_primary.y+ bmp_info.red_primary.z; gamma=PerceptibleReciprocal(gamma); bmp_info.red_primary.x*=gamma; bmp_info.red_primary.y*=gamma; image->chromaticity.red_primary.x=bmp_info.red_primary.x; image->chromaticity.red_primary.y=bmp_info.red_primary.y; gamma=bmp_info.green_primary.x+bmp_info.green_primary.y+ bmp_info.green_primary.z; gamma=PerceptibleReciprocal(gamma); bmp_info.green_primary.x*=gamma; bmp_info.green_primary.y*=gamma; image->chromaticity.green_primary.x=bmp_info.green_primary.x; image->chromaticity.green_primary.y=bmp_info.green_primary.y; gamma=bmp_info.blue_primary.x+bmp_info.blue_primary.y+ bmp_info.blue_primary.z; gamma=PerceptibleReciprocal(gamma); bmp_info.blue_primary.x*=gamma; bmp_info.blue_primary.y*=gamma; image->chromaticity.blue_primary.x=bmp_info.blue_primary.x; image->chromaticity.blue_primary.y=bmp_info.blue_primary.y; /* Decode 16^16 fixed point formatted gamma_scales. */ bmp_info.gamma_scale.x=(double) ReadBlobLSBLong(image)/0x10000; bmp_info.gamma_scale.y=(double) ReadBlobLSBLong(image)/0x10000; bmp_info.gamma_scale.z=(double) ReadBlobLSBLong(image)/0x10000; /* Compute a single gamma from the BMP 3-channel gamma. */ image->gamma=(bmp_info.gamma_scale.x+bmp_info.gamma_scale.y+ bmp_info.gamma_scale.z)/3.0; } else (void) CopyMagickString(image->magick,""BMP3"",MagickPathExtent); if (bmp_info.size > 108) { size_t intent; /* Read BMP Version 5 color management information. */ intent=ReadBlobLSBLong(image); switch ((int) intent) { case LCS_GM_BUSINESS: { image->rendering_intent=SaturationIntent; break; } case LCS_GM_GRAPHICS: { image->rendering_intent=RelativeIntent; break; } case LCS_GM_IMAGES: { image->rendering_intent=PerceptualIntent; break; } case LCS_GM_ABS_COLORIMETRIC: { image->rendering_intent=AbsoluteIntent; break; } } (void) ReadBlobLSBLong(image); /* Profile data */ (void) ReadBlobLSBLong(image); /* Profile size */ (void) ReadBlobLSBLong(image); /* Reserved byte */ } } if ((MagickSizeType) bmp_info.file_size > GetBlobSize(image)) (void) ThrowMagickException(exception,GetMagickModule(),CorruptImageError, ""LengthAndFilesizeDoNotMatch"",""`%s'"",image->filename); else if ((MagickSizeType) bmp_info.file_size < GetBlobSize(image)) (void) ThrowMagickException(exception,GetMagickModule(), CorruptImageWarning,""LengthAndFilesizeDoNotMatch"",""`%s'"", image->filename); if (bmp_info.width <= 0) ThrowReaderException(CorruptImageError,""NegativeOrZeroImageSize""); if (bmp_info.height == 0) ThrowReaderException(CorruptImageError,""NegativeOrZeroImageSize""); if (bmp_info.planes != 1) ThrowReaderException(CorruptImageError,""StaticPlanesValueNotEqualToOne""); if ((bmp_info.bits_per_pixel != 1) && (bmp_info.bits_per_pixel != 4) && (bmp_info.bits_per_pixel != 8) && (bmp_info.bits_per_pixel != 16) && (bmp_info.bits_per_pixel != 24) && (bmp_info.bits_per_pixel != 32)) ThrowReaderException(CorruptImageError,""UnrecognizedBitsPerPixel""); if (bmp_info.bits_per_pixel < 16 && bmp_info.number_colors > (1U << bmp_info.bits_per_pixel)) ThrowReaderException(CorruptImageError,""UnrecognizedNumberOfColors""); if ((bmp_info.compression == 1) && (bmp_info.bits_per_pixel != 8)) ThrowReaderException(CorruptImageError,""UnrecognizedBitsPerPixel""); if ((bmp_info.compression == 2) && (bmp_info.bits_per_pixel != 4)) ThrowReaderException(CorruptImageError,""UnrecognizedBitsPerPixel""); if ((bmp_info.compression == 3) && (bmp_info.bits_per_pixel < 16)) ThrowReaderException(CorruptImageError,""UnrecognizedBitsPerPixel""); switch (bmp_info.compression) { case BI_RGB: image->compression=NoCompression; break; case BI_RLE8: case BI_RLE4: image->compression=RLECompression; break; case BI_BITFIELDS: break; case BI_JPEG: ThrowReaderException(CoderError,""JPEGCompressNotSupported""); case BI_PNG: ThrowReaderException(CoderError,""PNGCompressNotSupported""); default: ThrowReaderException(CorruptImageError,""UnrecognizedImageCompression""); } image->columns=(size_t) MagickAbsoluteValue(bmp_info.width); image->rows=(size_t) MagickAbsoluteValue(bmp_info.height); image->depth=bmp_info.bits_per_pixel <= 8 ? bmp_info.bits_per_pixel : 8; image->alpha_trait=((bmp_info.alpha_mask != 0) && (bmp_info.compression == BI_BITFIELDS)) ? BlendPixelTrait : UndefinedPixelTrait; if (bmp_info.bits_per_pixel < 16) { size_t one; image->storage_class=PseudoClass; image->colors=bmp_info.number_colors; one=1; if (image->colors == 0) image->colors=one << bmp_info.bits_per_pixel; } image->resolution.x=(double) bmp_info.x_pixels/100.0; image->resolution.y=(double) bmp_info.y_pixels/100.0; image->units=PixelsPerCentimeterResolution; if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0)) if (image->scene >= (image_info->scene+image_info->number_scenes-1)) break; status=SetImageExtent(image,image->columns,image->rows,exception); if (status == MagickFalse) return(DestroyImageList(image)); if (image->storage_class == PseudoClass) { unsigned char *bmp_colormap; size_t packet_size; /* Read BMP raster colormap. */ if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Reading colormap of %.20g colors"",(double) image->colors); if (AcquireImageColormap(image,image->colors,exception) == MagickFalse) ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); bmp_colormap=(unsigned char *) AcquireQuantumMemory((size_t) image->colors,4*sizeof(*bmp_colormap)); if (bmp_colormap == (unsigned char *) NULL) ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); if ((bmp_info.size == 12) || (bmp_info.size == 64)) packet_size=3; else packet_size=4; offset=SeekBlob(image,start_position+14+bmp_info.size,SEEK_SET); if (offset < 0) { bmp_colormap=(unsigned char *) RelinquishMagickMemory(bmp_colormap); ThrowReaderException(CorruptImageError,""ImproperImageHeader""); } count=ReadBlob(image,packet_size*image->colors,bmp_colormap); if (count != (ssize_t) (packet_size*image->colors)) { bmp_colormap=(unsigned char *) RelinquishMagickMemory(bmp_colormap); ThrowReaderException(CorruptImageError, ""InsufficientImageDataInFile""); } p=bmp_colormap; for (i=0; i < (ssize_t) image->colors; i++) { image->colormap[i].blue=(MagickRealType) ScaleCharToQuantum(*p++); image->colormap[i].green=(MagickRealType) ScaleCharToQuantum(*p++); image->colormap[i].red=(MagickRealType) ScaleCharToQuantum(*p++); if (packet_size == 4) p++; } bmp_colormap=(unsigned char *) RelinquishMagickMemory(bmp_colormap); } /* Read image data. */ if (bmp_info.offset_bits == offset_bits) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); offset_bits=bmp_info.offset_bits; offset=SeekBlob(image,start_position+bmp_info.offset_bits,SEEK_SET); if (offset < 0) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); if (bmp_info.compression == BI_RLE4) bmp_info.bits_per_pixel<<=1; bytes_per_line=4*((image->columns*bmp_info.bits_per_pixel+31)/32); length=(size_t) bytes_per_line*image->rows; if (((MagickSizeType) length/8) > GetBlobSize(image)) ThrowReaderException(CorruptImageError,""InsufficientImageDataInFile""); if ((bmp_info.compression == BI_RGB) || (bmp_info.compression == BI_BITFIELDS)) { pixel_info=AcquireVirtualMemory(image->rows, MagickMax(bytes_per_line,image->columns+256UL)*sizeof(*pixels)); if (pixel_info == (MemoryInfo *) NULL) ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info); if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Reading pixels (%.20g bytes)"",(double) length); count=ReadBlob(image,length,pixels); if (count != (ssize_t) length) { pixel_info=RelinquishVirtualMemory(pixel_info); ThrowReaderException(CorruptImageError, ""InsufficientImageDataInFile""); } } else { /* Convert run-length encoded raster pixels. */ pixel_info=AcquireVirtualMemory(image->rows, MagickMax(bytes_per_line,image->columns+256UL)*sizeof(*pixels)); if (pixel_info == (MemoryInfo *) NULL) ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info); status=DecodeImage(image,bmp_info.compression,pixels, image->columns*image->rows); if (status == MagickFalse) { pixel_info=RelinquishVirtualMemory(pixel_info); ThrowReaderException(CorruptImageError, ""UnableToRunlengthDecodeImage""); } } /* Convert BMP raster image to pixel packets. */ if (bmp_info.compression == BI_RGB) { /* We should ignore the alpha value in BMP3 files but there have been reports about 32 bit files with alpha. We do a quick check to see if the alpha channel contains a value that is not zero (default value). If we find a non zero value we asume the program that wrote the file wants to use the alpha channel. */ if ((image->alpha_trait == UndefinedPixelTrait) && (bmp_info.size == 40) && (bmp_info.bits_per_pixel == 32)) { bytes_per_line=4*(image->columns); for (y=(ssize_t) image->rows-1; y >= 0; y--) { p=pixels+(image->rows-y-1)*bytes_per_line; for (x=0; x < (ssize_t) image->columns; x++) { if (*(p+3) != 0) { image->alpha_trait=BlendPixelTrait; y=-1; break; } p+=4; } } } bmp_info.alpha_mask=image->alpha_trait != UndefinedPixelTrait ? 0xff000000U : 0U; bmp_info.red_mask=0x00ff0000U; bmp_info.green_mask=0x0000ff00U; bmp_info.blue_mask=0x000000ffU; if (bmp_info.bits_per_pixel == 16) { /* RGB555. */ bmp_info.red_mask=0x00007c00U; bmp_info.green_mask=0x000003e0U; bmp_info.blue_mask=0x0000001fU; } } (void) memset(&shift,0,sizeof(shift)); (void) memset(&quantum_bits,0,sizeof(quantum_bits)); if ((bmp_info.bits_per_pixel == 16) || (bmp_info.bits_per_pixel == 32)) { register unsigned int sample; /* Get shift and quantum bits info from bitfield masks. */ if (bmp_info.red_mask != 0) while (((bmp_info.red_mask << shift.red) & 0x80000000UL) == 0) { shift.red++; if (shift.red >= 32U) break; } if (bmp_info.green_mask != 0) while (((bmp_info.green_mask << shift.green) & 0x80000000UL) == 0) { shift.green++; if (shift.green >= 32U) break; } if (bmp_info.blue_mask != 0) while (((bmp_info.blue_mask << shift.blue) & 0x80000000UL) == 0) { shift.blue++; if (shift.blue >= 32U) break; } if (bmp_info.alpha_mask != 0) while (((bmp_info.alpha_mask << shift.alpha) & 0x80000000UL) == 0) { shift.alpha++; if (shift.alpha >= 32U) break; } sample=shift.red; while (((bmp_info.red_mask << sample) & 0x80000000UL) != 0) { sample++; if (sample >= 32U) break; } quantum_bits.red=(MagickRealType) (sample-shift.red); sample=shift.green; while (((bmp_info.green_mask << sample) & 0x80000000UL) != 0) { sample++; if (sample >= 32U) break; } quantum_bits.green=(MagickRealType) (sample-shift.green); sample=shift.blue; while (((bmp_info.blue_mask << sample) & 0x80000000UL) != 0) { sample++; if (sample >= 32U) break; } quantum_bits.blue=(MagickRealType) (sample-shift.blue); sample=shift.alpha; while (((bmp_info.alpha_mask << sample) & 0x80000000UL) != 0) { sample++; if (sample >= 32U) break; } quantum_bits.alpha=(MagickRealType) (sample-shift.alpha); } switch (bmp_info.bits_per_pixel) { case 1: { /* Convert bitmap scanline. */ for (y=(ssize_t) image->rows-1; y >= 0; y--) { p=pixels+(image->rows-y-1)*bytes_per_line; q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) break; for (x=0; x < ((ssize_t) image->columns-7); x+=8) { for (bit=0; bit < 8; bit++) { index=(Quantum) (((*p) & (0x80 >> bit)) != 0 ? 0x01 : 0x00); SetPixelIndex(image,index,q); q+=GetPixelChannels(image); } p++; } if ((image->columns % 8) != 0) { for (bit=0; bit < (image->columns % 8); bit++) { index=(Quantum) (((*p) & (0x80 >> bit)) != 0 ? 0x01 : 0x00); SetPixelIndex(image,index,q); q+=GetPixelChannels(image); } p++; } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) (image->rows-y),image->rows); if (status == MagickFalse) break; } } (void) SyncImage(image,exception); break; } case 4: { /* Convert PseudoColor scanline. */ for (y=(ssize_t) image->rows-1; y >= 0; y--) { p=pixels+(image->rows-y-1)*bytes_per_line; q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) break; for (x=0; x < ((ssize_t) image->columns-1); x+=2) { ValidateColormapValue(image,(ssize_t) ((*p >> 4) & 0x0f),&index, exception); SetPixelIndex(image,index,q); q+=GetPixelChannels(image); ValidateColormapValue(image,(ssize_t) (*p & 0x0f),&index,exception); SetPixelIndex(image,index,q); q+=GetPixelChannels(image); p++; } if ((image->columns % 2) != 0) { ValidateColormapValue(image,(ssize_t) ((*p >> 4) & 0xf),&index, exception); SetPixelIndex(image,index,q); q+=GetPixelChannels(image); p++; x++; } if (x < (ssize_t) image->columns) break; if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) (image->rows-y),image->rows); if (status == MagickFalse) break; } } (void) SyncImage(image,exception); break; } case 8: { /* Convert PseudoColor scanline. */ if ((bmp_info.compression == BI_RLE8) || (bmp_info.compression == BI_RLE4)) bytes_per_line=image->columns; for (y=(ssize_t) image->rows-1; y >= 0; y--) { p=pixels+(image->rows-y-1)*bytes_per_line; q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) break; for (x=(ssize_t) image->columns; x != 0; --x) { ValidateColormapValue(image,(ssize_t) *p++,&index,exception); SetPixelIndex(image,index,q); q+=GetPixelChannels(image); } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; offset=(MagickOffsetType) (image->rows-y-1); if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) (image->rows-y),image->rows); if (status == MagickFalse) break; } } (void) SyncImage(image,exception); break; } case 16: { unsigned int alpha, pixel; /* Convert bitfield encoded 16-bit PseudoColor scanline. */ if ((bmp_info.compression != BI_RGB) && (bmp_info.compression != BI_BITFIELDS)) { pixel_info=RelinquishVirtualMemory(pixel_info); ThrowReaderException(CorruptImageError, ""UnrecognizedImageCompression""); } bytes_per_line=2*(image->columns+image->columns % 2); image->storage_class=DirectClass; for (y=(ssize_t) image->rows-1; y >= 0; y--) { p=pixels+(image->rows-y-1)*bytes_per_line; q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) break; for (x=0; x < (ssize_t) image->columns; x++) { pixel=(unsigned int) (*p++); pixel|=(*p++) << 8; red=((pixel & bmp_info.red_mask) << shift.red) >> 16; if (quantum_bits.red == 5) red|=((red & 0xe000) >> 5); if (quantum_bits.red <= 8) red|=((red & 0xff00) >> 8); green=((pixel & bmp_info.green_mask) << shift.green) >> 16; if (quantum_bits.green == 5) green|=((green & 0xe000) >> 5); if (quantum_bits.green == 6) green|=((green & 0xc000) >> 6); if (quantum_bits.green <= 8) green|=((green & 0xff00) >> 8); blue=((pixel & bmp_info.blue_mask) << shift.blue) >> 16; if (quantum_bits.blue == 5) blue|=((blue & 0xe000) >> 5); if (quantum_bits.blue <= 8) blue|=((blue & 0xff00) >> 8); SetPixelRed(image,ScaleShortToQuantum((unsigned short) red),q); SetPixelGreen(image,ScaleShortToQuantum((unsigned short) green),q); SetPixelBlue(image,ScaleShortToQuantum((unsigned short) blue),q); SetPixelAlpha(image,OpaqueAlpha,q); if (image->alpha_trait != UndefinedPixelTrait) { alpha=((pixel & bmp_info.alpha_mask) << shift.alpha) >> 16; if (quantum_bits.alpha <= 8) alpha|=((alpha & 0xff00) >> 8); SetPixelAlpha(image,ScaleShortToQuantum( (unsigned short) alpha),q); } q+=GetPixelChannels(image); } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; offset=(MagickOffsetType) (image->rows-y-1); if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) (image->rows-y),image->rows); if (status == MagickFalse) break; } } break; } case 24: { /* Convert DirectColor scanline. */ bytes_per_line=4*((image->columns*24+31)/32); for (y=(ssize_t) image->rows-1; y >= 0; y--) { p=pixels+(image->rows-y-1)*bytes_per_line; q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) break; for (x=0; x < (ssize_t) image->columns; x++) { SetPixelBlue(image,ScaleCharToQuantum(*p++),q); SetPixelGreen(image,ScaleCharToQuantum(*p++),q); SetPixelRed(image,ScaleCharToQuantum(*p++),q); SetPixelAlpha(image,OpaqueAlpha,q); q+=GetPixelChannels(image); } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; offset=(MagickOffsetType) (image->rows-y-1); if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) (image->rows-y),image->rows); if (status == MagickFalse) break; } } break; } case 32: { /* Convert bitfield encoded DirectColor scanline. */ if ((bmp_info.compression != BI_RGB) && (bmp_info.compression != BI_BITFIELDS)) { pixel_info=RelinquishVirtualMemory(pixel_info); ThrowReaderException(CorruptImageError, ""UnrecognizedImageCompression""); } bytes_per_line=4*(image->columns); for (y=(ssize_t) image->rows-1; y >= 0; y--) { unsigned int alpha, pixel; p=pixels+(image->rows-y-1)*bytes_per_line; q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) break; for (x=0; x < (ssize_t) image->columns; x++) { pixel=(unsigned int) (*p++); pixel|=((unsigned int) *p++ << 8); pixel|=((unsigned int) *p++ << 16); pixel|=((unsigned int) *p++ << 24); red=((pixel & bmp_info.red_mask) << shift.red) >> 16; if (quantum_bits.red == 8) red|=(red >> 8); green=((pixel & bmp_info.green_mask) << shift.green) >> 16; if (quantum_bits.green == 8) green|=(green >> 8); blue=((pixel & bmp_info.blue_mask) << shift.blue) >> 16; if (quantum_bits.blue == 8) blue|=(blue >> 8); SetPixelRed(image,ScaleShortToQuantum((unsigned short) red),q); SetPixelGreen(image,ScaleShortToQuantum((unsigned short) green),q); SetPixelBlue(image,ScaleShortToQuantum((unsigned short) blue),q); SetPixelAlpha(image,OpaqueAlpha,q); if (image->alpha_trait != UndefinedPixelTrait) { alpha=((pixel & bmp_info.alpha_mask) << shift.alpha) >> 16; if (quantum_bits.alpha == 8) alpha|=(alpha >> 8); SetPixelAlpha(image,ScaleShortToQuantum( (unsigned short) alpha),q); } q+=GetPixelChannels(image); } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; offset=(MagickOffsetType) (image->rows-y-1); if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) (image->rows-y),image->rows); if (status == MagickFalse) break; } } break; } default: { pixel_info=RelinquishVirtualMemory(pixel_info); ThrowReaderException(CorruptImageError,""ImproperImageHeader""); } } pixel_info=RelinquishVirtualMemory(pixel_info); if (y > 0) break; if (EOFBlob(image) != MagickFalse) { ThrowFileException(exception,CorruptImageError,""UnexpectedEndOfFile"", image->filename); break; } if (bmp_info.height < 0) { Image *flipped_image; /* Correct image orientation. */ flipped_image=FlipImage(image,exception); if (flipped_image != (Image *) NULL) { DuplicateBlob(flipped_image,image); ReplaceImageInList(&image, flipped_image); image=flipped_image; } } /* Proceed to next image. */ if (image_info->number_scenes != 0) if (image->scene >= (image_info->scene+image_info->number_scenes-1)) break; *magick='\0'; if (bmp_info.ba_offset != 0) { offset=SeekBlob(image,(MagickOffsetType) bmp_info.ba_offset,SEEK_SET); if (offset < 0) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); } count=ReadBlob(image,2,magick); if ((count == 2) && (IsBMP(magick,2) != MagickFalse)) { /* Acquire next image structure. */ AcquireNextImage(image_info,image,exception); if (GetNextImageInList(image) == (Image *) NULL) { status=MagickFalse; return((Image *) NULL); } image=SyncNextImageInList(image); status=SetImageProgress(image,LoadImagesTag,TellBlob(image), GetBlobSize(image)); if (status == MagickFalse) break; } } while (IsBMP(magick,2) != MagickFalse); (void) CloseBlob(image); if (status == MagickFalse) return(DestroyImageList(image)); return(GetFirstImageInList(image)); } ",1 "void zend_ts_hash_display_pListTail(TsHashTable *ht) { begin_read(ht); zend_hash_display_pListTail(TS_HASH(ht)); end_read(ht); } ",0 "ofproto_set_mac_table_config(struct ofproto *ofproto, unsigned idle_time, size_t max_entries) { if (ofproto->ofproto_class->set_mac_table_config) { ofproto->ofproto_class->set_mac_table_config(ofproto, idle_time, max_entries); } } ",0 "my_object_increment_val (MyObject *obj, GError **error) { obj->val++; return TRUE; } ",1 "void regulator_set_drvdata(struct regulator *regulator, void *data) { regulator->rdev->reg_data = data; } ",0 "SYSCALL_DEFINE3(fchmodat, int, dfd, const char __user *, filename, umode_t, mode) { struct path path; int error; unsigned int lookup_flags = LOOKUP_FOLLOW; retry: error = user_path_at(dfd, filename, lookup_flags, &path); if (!error) { error = chmod_common(&path, mode); path_put(&path); if (retry_estale(error, lookup_flags)) { lookup_flags |= LOOKUP_REVAL; goto retry; } } return error; } ",0 "void webkit_web_view_paste_clipboard(WebKitWebView* webView) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); if (webkit_web_view_can_paste_clipboard(webView)) g_signal_emit(webView, webkit_web_view_signals[PASTE_CLIPBOARD], 0); } ",0 "void ia64_patch_phys_stack_reg(unsigned long val) { s32 * offp = (s32 *) __start___phys_stack_reg_patchlist; s32 * end = (s32 *) __end___phys_stack_reg_patchlist; u64 ip, mask, imm; /* see instruction format A4: adds r1 = imm13, r3 */ mask = (0x3fUL << 27) | (0x7f << 13); imm = (((val >> 7) & 0x3f) << 27) | (val & 0x7f) << 13; while (offp < end) { ip = (u64) offp + *offp; ia64_patch(ip, mask, imm); ia64_fc(ip); ++offp; } ia64_sync_i(); ia64_srlz_i(); } ",0 "void ContextState::RestoreTextureUnitBindings( GLuint unit, const ContextState* prev_state) const { DCHECK_LT(unit, texture_units.size()); const TextureUnit& texture_unit = texture_units[unit]; GLuint service_id_2d = Get2dServiceId(texture_unit); GLuint service_id_cube = GetCubeServiceId(texture_unit); GLuint service_id_oes = GetOesServiceId(texture_unit); GLuint service_id_arb = GetArbServiceId(texture_unit); bool bind_texture_2d = true; bool bind_texture_cube = true; bool bind_texture_oes = feature_info_->feature_flags().oes_egl_image_external || feature_info_->feature_flags().nv_egl_stream_consumer_external; bool bind_texture_arb = feature_info_->feature_flags().arb_texture_rectangle; if (prev_state) { const TextureUnit& prev_unit = prev_state->texture_units[unit]; bind_texture_2d = service_id_2d != Get2dServiceId(prev_unit); bind_texture_cube = service_id_cube != GetCubeServiceId(prev_unit); bind_texture_oes = bind_texture_oes && service_id_oes != GetOesServiceId(prev_unit); bind_texture_arb = bind_texture_arb && service_id_arb != GetArbServiceId(prev_unit); } if (!bind_texture_2d && !bind_texture_cube && !bind_texture_oes && !bind_texture_arb) { return; } api()->glActiveTextureFn(GL_TEXTURE0 + unit); if (bind_texture_2d) { api()->glBindTextureFn(GL_TEXTURE_2D, service_id_2d); } if (bind_texture_cube) { api()->glBindTextureFn(GL_TEXTURE_CUBE_MAP, service_id_cube); } if (bind_texture_oes) { api()->glBindTextureFn(GL_TEXTURE_EXTERNAL_OES, service_id_oes); } if (bind_texture_arb) { api()->glBindTextureFn(GL_TEXTURE_RECTANGLE_ARB, service_id_arb); } } ",1 "static inline void ftrace_trace_stack(struct trace_array *tr, struct ring_buffer *buffer, unsigned long flags, int skip, int pc, struct pt_regs *regs) { if (!(tr->trace_flags & TRACE_ITER_STACKTRACE)) return; __ftrace_trace_stack(buffer, flags, skip, pc, regs); } ",0 "bool SVGElement::InstanceUpdatesBlocked() const { return HasSVGRareData() && SvgRareData()->InstanceUpdatesBlocked(); } ",0 "static int StreamTcpHandleFin(ThreadVars *tv, StreamTcpThread *stt, TcpSession *ssn, Packet *p, PacketQueue *pq) { if (PKT_IS_TOSERVER(p)) { SCLogDebug(""ssn %p: pkt (%"" PRIu32 "") is to server: SEQ %"" PRIu32 "","" "" ACK %"" PRIu32 """", ssn, p->payload_len, TCP_GET_SEQ(p), TCP_GET_ACK(p)); if (StreamTcpValidateAck(ssn, &ssn->server, p) == -1) { SCLogDebug(""ssn %p: rejecting because of invalid ack value"", ssn); StreamTcpSetEvent(p, STREAM_FIN_INVALID_ACK); return -1; } if (SEQ_LT(TCP_GET_SEQ(p), ssn->client.next_seq) || SEQ_GT(TCP_GET_SEQ(p), (ssn->client.last_ack + ssn->client.window))) { SCLogDebug(""ssn %p: -> SEQ mismatch, packet SEQ %"" PRIu32 "" != "" ""%"" PRIu32 "" from stream"", ssn, TCP_GET_SEQ(p), ssn->client.next_seq); StreamTcpSetEvent(p, STREAM_FIN_OUT_OF_WINDOW); return -1; } StreamTcpPacketSetState(p, ssn, TCP_CLOSE_WAIT); SCLogDebug(""ssn %p: state changed to TCP_CLOSE_WAIT"", ssn); if (SEQ_EQ(TCP_GET_SEQ(p), ssn->client.next_seq)) ssn->client.next_seq = TCP_GET_SEQ(p) + p->payload_len; SCLogDebug(""ssn %p: ssn->client.next_seq %"" PRIu32 """", ssn, ssn->client.next_seq); ssn->server.window = TCP_GET_WINDOW(p) << ssn->server.wscale; StreamTcpUpdateLastAck(ssn, &ssn->server, TCP_GET_ACK(p)); if (ssn->flags & STREAMTCP_FLAG_TIMESTAMP) { StreamTcpHandleTimestamp(ssn, p); } /* Update the next_seq, in case if we have missed the client packet and server has already received and acked it */ if (SEQ_LT(ssn->server.next_seq, TCP_GET_ACK(p))) ssn->server.next_seq = TCP_GET_ACK(p); StreamTcpReassembleHandleSegment(tv, stt->ra_ctx, ssn, &ssn->client, p, pq); SCLogDebug(""ssn %p: =+ next SEQ %"" PRIu32 "", last ACK %"" PRIu32 """", ssn, ssn->client.next_seq, ssn->server.last_ack); } else { /* implied to client */ SCLogDebug(""ssn %p: pkt (%"" PRIu32 "") is to client: SEQ %"" PRIu32 "", "" ""ACK %"" PRIu32 """", ssn, p->payload_len, TCP_GET_SEQ(p), TCP_GET_ACK(p)); if (StreamTcpValidateAck(ssn, &ssn->client, p) == -1) { SCLogDebug(""ssn %p: rejecting because of invalid ack value"", ssn); StreamTcpSetEvent(p, STREAM_FIN_INVALID_ACK); return -1; } if (SEQ_LT(TCP_GET_SEQ(p), ssn->server.next_seq) || SEQ_GT(TCP_GET_SEQ(p), (ssn->server.last_ack + ssn->server.window))) { SCLogDebug(""ssn %p: -> SEQ mismatch, packet SEQ %"" PRIu32 "" != "" ""%"" PRIu32 "" from stream (last_ack %u win %u = %u)"", ssn, TCP_GET_SEQ(p), ssn->server.next_seq, ssn->server.last_ack, ssn->server.window, (ssn->server.last_ack + ssn->server.window)); StreamTcpSetEvent(p, STREAM_FIN_OUT_OF_WINDOW); return -1; } StreamTcpPacketSetState(p, ssn, TCP_FIN_WAIT1); SCLogDebug(""ssn %p: state changed to TCP_FIN_WAIT1"", ssn); if (SEQ_EQ(TCP_GET_SEQ(p), ssn->server.next_seq)) ssn->server.next_seq = TCP_GET_SEQ(p) + p->payload_len; SCLogDebug(""ssn %p: ssn->server.next_seq %"" PRIu32 """", ssn, ssn->server.next_seq); ssn->client.window = TCP_GET_WINDOW(p) << ssn->client.wscale; StreamTcpUpdateLastAck(ssn, &ssn->client, TCP_GET_ACK(p)); if (ssn->flags & STREAMTCP_FLAG_TIMESTAMP) { StreamTcpHandleTimestamp(ssn, p); } /* Update the next_seq, in case if we have missed the client packet and server has already received and acked it */ if (SEQ_LT(ssn->client.next_seq, TCP_GET_ACK(p))) ssn->client.next_seq = TCP_GET_ACK(p); StreamTcpReassembleHandleSegment(tv, stt->ra_ctx, ssn, &ssn->server, p, pq); SCLogDebug(""ssn %p: =+ next SEQ %"" PRIu32 "", last ACK %"" PRIu32 """", ssn, ssn->server.next_seq, ssn->client.last_ack); } return 0; } ",0 "void QuotaManager::DidSetPersistentHostQuota(const std::string& host, const HostQuotaCallback& callback, const int64* new_quota, bool success) { DidDatabaseWork(success); callback.Run(success ? kQuotaStatusOk : kQuotaErrorInvalidAccess, host, kStorageTypePersistent, *new_quota); } ",0 " MidiManagerUsbTest() : message_loop_(new base::MessageLoop) { scoped_ptr factory(new TestUsbMidiDeviceFactory); factory_ = factory.get(); manager_.reset(new MidiManagerUsbForTesting(factory.Pass())); } ",0 "alloc_size_is_ok(gs_memory_type_ptr_t stype) { return (stype->ssize > 0 && stype->ssize < 0x200000); } ",0 "do_bundle_commit(struct ofconn *ofconn, uint32_t id, uint16_t flags) { struct ofproto *ofproto = ofconn_get_ofproto(ofconn); ovs_version_t version = ofproto->tables_version + 1; struct ofp_bundle *bundle; struct ofp_bundle_entry *be; enum ofperr error; bundle = ofconn_get_bundle(ofconn, id); if (!bundle) { return OFPERR_OFPBFC_BAD_ID; } if (bundle->flags != flags) { error = OFPERR_OFPBFC_BAD_FLAGS; } else { bool prev_is_port_mod = false; error = 0; ovs_mutex_lock(&ofproto_mutex); /* 1. Begin. */ LIST_FOR_EACH (be, node, &bundle->msg_list) { if (be->type == OFPTYPE_PORT_MOD) { /* Our port mods are not atomic. */ if (flags & OFPBF_ATOMIC) { error = OFPERR_OFPBFC_MSG_FAILED; } else { prev_is_port_mod = true; error = port_mod_start(ofconn, &be->opm.pm, &be->opm.port); } } else { /* Flow & group mods between port mods are applied as a single * version, but the versions are published only after we know * the commit is successful. */ if (prev_is_port_mod) { prev_is_port_mod = false; ++version; } if (be->type == OFPTYPE_FLOW_MOD) { /* Store the version in which the changes should take * effect. */ be->ofm.version = version; error = ofproto_flow_mod_start(ofproto, &be->ofm); } else if (be->type == OFPTYPE_GROUP_MOD) { /* Store the version in which the changes should take * effect. */ be->ogm.version = version; error = ofproto_group_mod_start(ofproto, &be->ogm); } else if (be->type == OFPTYPE_PACKET_OUT) { be->opo.version = version; error = ofproto_packet_out_start(ofproto, &be->opo); } else { OVS_NOT_REACHED(); } } if (error) { break; } } if (error) { /* Send error referring to the original message. */ if (error) { ofconn_send_error(ofconn, &be->ofp_msg, error); error = OFPERR_OFPBFC_MSG_FAILED; } /* 2. Revert. Undo all the changes made above. */ LIST_FOR_EACH_REVERSE_CONTINUE(be, node, &bundle->msg_list) { if (be->type == OFPTYPE_FLOW_MOD) { ofproto_flow_mod_revert(ofproto, &be->ofm); } else if (be->type == OFPTYPE_GROUP_MOD) { ofproto_group_mod_revert(ofproto, &be->ogm); } else if (be->type == OFPTYPE_PACKET_OUT) { ofproto_packet_out_revert(ofproto, &be->opo); } /* Nothing needs to be reverted for a port mod. */ } } else { /* 4. Finish. */ LIST_FOR_EACH (be, node, &bundle->msg_list) { if (be->type == OFPTYPE_PORT_MOD) { /* Perform the actual port mod. This is not atomic, i.e., * the effects will be immediately seen by upcall * processing regardless of the lookup version. It should * be noted that port configuration changes can originate * also from OVSDB changes asynchronously to all upcall * processing. */ port_mod_finish(ofconn, &be->opm.pm, be->opm.port); } else { version = (be->type == OFPTYPE_FLOW_MOD) ? be->ofm.version : (be->type == OFPTYPE_GROUP_MOD) ? be->ogm.version : (be->type == OFPTYPE_PACKET_OUT) ? be->opo.version : version; /* Bump the lookup version to the one of the current * message. This makes all the changes in the bundle at * this version visible to lookups at once. */ if (ofproto->tables_version < version) { ofproto->tables_version = version; ofproto->ofproto_class->set_tables_version( ofproto, ofproto->tables_version); } struct openflow_mod_requester req = { ofconn, &be->ofp_msg }; if (be->type == OFPTYPE_FLOW_MOD) { ofproto_flow_mod_finish(ofproto, &be->ofm, &req); } else if (be->type == OFPTYPE_GROUP_MOD) { ofproto_group_mod_finish(ofproto, &be->ogm, &req); } else if (be->type == OFPTYPE_PACKET_OUT) { ofproto_packet_out_finish(ofproto, &be->opo); } } } } ofmonitor_flush(ofproto->connmgr); ovs_mutex_unlock(&ofproto_mutex); } /* The bundle is discarded regardless the outcome. */ ofp_bundle_remove__(ofconn, bundle); return error; } ",0 "IHEVCD_ERROR_T ihevcd_mv_buf_mgr_add_bufs(codec_t *ps_codec) { IHEVCD_ERROR_T ret = (IHEVCD_ERROR_T)IHEVCD_SUCCESS; WORD32 i; WORD32 max_dpb_size; WORD32 mv_bank_size_allocated; WORD32 pic_mv_bank_size; sps_t *ps_sps; UWORD8 *pu1_buf; mv_buf_t *ps_mv_buf; /* Initialize MV Bank buffer manager */ ps_sps = ps_codec->s_parse.ps_sps; /* Compute the number of MV Bank buffers needed */ max_dpb_size = ps_sps->ai1_sps_max_dec_pic_buffering[ps_sps->i1_sps_max_sub_layers - 1]; /* Allocate one extra MV Bank to handle current frame * In case of asynchronous parsing and processing, number of buffers should increase here * based on when parsing and processing threads are synchronized */ max_dpb_size++; pu1_buf = (UWORD8 *)ps_codec->pv_mv_bank_buf_base; ps_mv_buf = (mv_buf_t *)pu1_buf; pu1_buf += max_dpb_size * sizeof(mv_buf_t); ps_codec->ps_mv_buf = ps_mv_buf; mv_bank_size_allocated = ps_codec->i4_total_mv_bank_size - max_dpb_size * sizeof(mv_buf_t); /* Compute MV bank size per picture */ pic_mv_bank_size = ihevcd_get_pic_mv_bank_size(ALIGN64(ps_sps->i2_pic_width_in_luma_samples) * ALIGN64(ps_sps->i2_pic_height_in_luma_samples)); for(i = 0; i < max_dpb_size; i++) { WORD32 buf_ret; WORD32 num_pu; WORD32 num_ctb; WORD32 pic_size; pic_size = ALIGN64(ps_sps->i2_pic_width_in_luma_samples) * ALIGN64(ps_sps->i2_pic_height_in_luma_samples); num_pu = pic_size / (MIN_PU_SIZE * MIN_PU_SIZE); num_ctb = pic_size / (MIN_CTB_SIZE * MIN_CTB_SIZE); mv_bank_size_allocated -= pic_mv_bank_size; if(mv_bank_size_allocated < 0) { ps_codec->s_parse.i4_error_code = IHEVCD_INSUFFICIENT_MEM_MVBANK; return IHEVCD_INSUFFICIENT_MEM_MVBANK; } ps_mv_buf->pu4_pic_pu_idx = (UWORD32 *)pu1_buf; pu1_buf += (num_ctb + 1) * sizeof(WORD32); ps_mv_buf->pu1_pic_pu_map = pu1_buf; pu1_buf += num_pu; ps_mv_buf->pu1_pic_slice_map = (UWORD16 *)pu1_buf; pu1_buf += ALIGN4(num_ctb * sizeof(UWORD16)); ps_mv_buf->ps_pic_pu = (pu_t *)pu1_buf; pu1_buf += num_pu * sizeof(pu_t); buf_ret = ihevc_buf_mgr_add((buf_mgr_t *)ps_codec->pv_mv_buf_mgr, ps_mv_buf, i); if(0 != buf_ret) { ps_codec->s_parse.i4_error_code = IHEVCD_BUF_MGR_ERROR; return IHEVCD_BUF_MGR_ERROR; } ps_mv_buf++; } return ret; } ",1 "static int ecryptfs_init_lower_file(struct dentry *dentry, struct file **lower_file) { const struct cred *cred = current_cred(); struct path *path = ecryptfs_dentry_to_lower_path(dentry); int rc; rc = ecryptfs_privileged_open(lower_file, path->dentry, path->mnt, cred); if (rc) { printk(KERN_ERR ""Error opening lower file "" ""for lower_dentry [0x%p] and lower_mnt [0x%p]; "" ""rc = [%d]\n"", path->dentry, path->mnt, rc); (*lower_file) = NULL; } return rc; } ",0 "bool PDFiumEngine::OnMouseUp(const pp::MouseInputEvent& event) { if (event.GetButton() != PP_INPUTEVENT_MOUSEBUTTON_LEFT && event.GetButton() != PP_INPUTEVENT_MOUSEBUTTON_MIDDLE) { return false; } if (event.GetButton() == PP_INPUTEVENT_MOUSEBUTTON_LEFT) SetMouseLeftButtonDown(false); int page_index = -1; int char_index = -1; int form_type = FPDF_FORMFIELD_UNKNOWN; PDFiumPage::LinkTarget target; pp::Point point = event.GetPosition(); PDFiumPage::Area area = GetCharIndex(point, &page_index, &char_index, &form_type, &target); if (mouse_down_state_.Matches(area, target)) { if (area == PDFiumPage::WEBLINK_AREA) { uint32_t modifiers = event.GetModifiers(); bool middle_button = !!(modifiers & PP_INPUTEVENT_MODIFIER_MIDDLEBUTTONDOWN); bool alt_key = !!(modifiers & PP_INPUTEVENT_MODIFIER_ALTKEY); bool ctrl_key = !!(modifiers & PP_INPUTEVENT_MODIFIER_CONTROLKEY); bool meta_key = !!(modifiers & PP_INPUTEVENT_MODIFIER_METAKEY); bool shift_key = !!(modifiers & PP_INPUTEVENT_MODIFIER_SHIFTKEY); WindowOpenDisposition disposition = ui::DispositionFromClick( middle_button, alt_key, ctrl_key, meta_key, shift_key); client_->NavigateTo(target.url, disposition); SetInFormTextArea(false); return true; } if (area == PDFiumPage::DOCLINK_AREA) { pp::Rect page_rect(GetPageScreenRect(target.page)); int y = position_.y() + page_rect.y(); if (target.y_in_pixels) y += target.y_in_pixels.value() * current_zoom_; client_->ScrollToY(y, /*compensate_for_toolbar=*/true); SetInFormTextArea(false); return true; } } if (event.GetButton() == PP_INPUTEVENT_MOUSEBUTTON_MIDDLE) return false; if (page_index != -1) { double page_x; double page_y; DeviceToPage(page_index, point.x(), point.y(), &page_x, &page_y); FORM_OnLButtonUp(form_, pages_[page_index]->GetPage(), 0, page_x, page_y); } if (!selecting_) return false; SetSelecting(false); return true; } ",0 " void WaitForPanelActiveStates(const std::vector& old_states, const std::vector& new_states) { DCHECK(old_states.size() == new_states.size()); std::vector panels = PanelManager::GetInstance()->panels(); for (size_t i = 0; i < old_states.size(); i++) { if (old_states[i] != new_states[i]){ WaitForPanelActiveState( panels[i], new_states[i] ? SHOW_AS_ACTIVE : SHOW_AS_INACTIVE); } } } ",0 "void VideoCaptureImpl::GetDeviceFormatsInUse( const VideoCaptureDeviceFormatsCB& callback) { DCHECK(io_thread_checker_.CalledOnValidThread()); GetVideoCaptureHost()->GetDeviceFormatsInUse( device_id_, session_id_, base::BindOnce(&VideoCaptureImpl::OnDeviceFormatsInUse, weak_factory_.GetWeakPtr(), callback)); } ",0 "void RenderViewImpl::focusPrevious() { Send(new ViewHostMsg_TakeFocus(routing_id_, true)); } ",0 "string16 AutocompleteResultAsString(const AutocompleteResult& result) { std::string output(base::StringPrintf(""{%"" PRIuS ""} "", result.size())); for (size_t i = 0; i < result.size(); ++i) { AutocompleteMatch match = result.match_at(i); std::string provider_name = match.provider->name(); output.append(base::StringPrintf(""[\""%s\"" by \""%s\""] "", UTF16ToUTF8(match.contents).c_str(), provider_name.c_str())); } return UTF8ToUTF16(output); } ",0 "static void *saved_cmdlines_next(struct seq_file *m, void *v, loff_t *pos) { unsigned int *ptr = v; if (*pos || m->count) ptr++; (*pos)++; for (; ptr < &savedcmd->map_cmdline_to_pid[savedcmd->cmdline_num]; ptr++) { if (*ptr == -1 || *ptr == NO_CMDLINE_MAP) continue; return ptr; } return NULL; } ",0 " virtual ~MessageLoopRelay() {} ",0 "Response ServiceWorkerHandler::SetForceUpdateOnPageLoad( bool force_update_on_page_load) { if (!context_) return CreateContextErrorResponse(); context_->SetForceUpdateOnPageLoad(force_update_on_page_load); return Response::OK(); } ",0 "void AddAdditionalRequestHeaders( net::HttpRequestHeaders* headers, const GURL& url, FrameMsg_Navigate_Type::Value navigation_type, BrowserContext* browser_context, const std::string& method, const std::string user_agent_override, bool has_user_gesture, base::Optional initiator_origin, FrameTreeNode* frame_tree_node) { if (!url.SchemeIsHTTPOrHTTPS()) return; if (!base::GetFieldTrialParamByFeatureAsBool(features::kDataSaverHoldback, ""holdback_web"", false)) { bool is_reload = navigation_type == FrameMsg_Navigate_Type::RELOAD || navigation_type == FrameMsg_Navigate_Type::RELOAD_BYPASSING_CACHE || navigation_type == FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL; if (is_reload) headers->RemoveHeader(""Save-Data""); if (GetContentClient()->browser()->IsDataSaverEnabled(browser_context)) headers->SetHeaderIfMissing(""Save-Data"", ""on""); } headers->SetHeaderIfMissing(""Upgrade-Insecure-Requests"", ""1""); headers->SetHeaderIfMissing( net::HttpRequestHeaders::kUserAgent, user_agent_override.empty() ? GetContentClient()->browser()->GetUserAgent() : user_agent_override); if (IsSecMetadataEnabled() && IsOriginSecure(url)) { std::string site_value = ""cross-site""; if (initiator_origin) { url::Origin target_origin = url::Origin::Create(url); if (initiator_origin->IsSameOriginWith(target_origin)) { site_value = ""same-origin""; } else if (net::registry_controlled_domains::SameDomainOrHost( *initiator_origin, target_origin, net::registry_controlled_domains:: INCLUDE_PRIVATE_REGISTRIES)) { site_value = ""same-site""; } } std::string destination; std::string mode = ""navigate""; switch (frame_tree_node->frame_owner_element_type()) { case blink::FrameOwnerElementType::kNone: destination = ""document""; break; case blink::FrameOwnerElementType::kObject: destination = ""object""; mode = ""no-cors""; break; case blink::FrameOwnerElementType::kEmbed: destination = ""embed""; mode = ""no-cors""; break; case blink::FrameOwnerElementType::kIframe: case blink::FrameOwnerElementType::kFrame: case blink::FrameOwnerElementType::kPortal: destination = ""nested-document""; } headers->SetHeaderIfMissing(""Sec-Fetch-Dest"", destination.c_str()); headers->SetHeaderIfMissing(""Sec-Fetch-Mode"", mode.c_str()); headers->SetHeaderIfMissing(""Sec-Fetch-Site"", site_value.c_str()); headers->SetHeaderIfMissing(""Sec-Fetch-User"", has_user_gesture ? ""?T"" : ""?F""); } std::string origin_policy_request; if (OriginPolicyThrottle::ShouldRequestOriginPolicy(url, &origin_policy_request)) { headers->SetHeader(net::HttpRequestHeaders::kSecOriginPolicy, origin_policy_request); } if (!NeedsHTTPOrigin(headers, method)) return; url::Origin origin; if (frame_tree_node->IsMainFrame()) { origin = url::Origin::Create(url); } else if ((frame_tree_node->active_sandbox_flags() & blink::WebSandboxFlags::kOrigin) == blink::WebSandboxFlags::kNone) { origin = frame_tree_node->frame_tree()->root()->current_origin(); } headers->SetHeader(net::HttpRequestHeaders::kOrigin, origin.Serialize()); } ",0 "ofpacts_verify(const struct ofpact ofpacts[], size_t ofpacts_len, uint32_t allowed_ovsinsts, enum ofpact_type outer_action) { const struct ofpact *a; enum ovs_instruction_type inst; inst = OVSINST_OFPIT13_METER; OFPACT_FOR_EACH (a, ofpacts, ofpacts_len) { enum ovs_instruction_type next; enum ofperr error; if (a->type == OFPACT_CONJUNCTION) { OFPACT_FOR_EACH (a, ofpacts, ofpacts_len) { if (a->type != OFPACT_CONJUNCTION && a->type != OFPACT_NOTE) { VLOG_WARN(""\""conjunction\"" actions may be used along with "" ""\""note\"" but not any other kind of action "" ""(such as the \""%s\"" action used here)"", ofpact_name(a->type)); return OFPERR_NXBAC_BAD_CONJUNCTION; } } return 0; } error = ofpacts_verify_nested(a, outer_action); if (error) { return error; } next = ovs_instruction_type_from_ofpact_type(a->type); if (a > ofpacts && (inst == OVSINST_OFPIT11_APPLY_ACTIONS ? next < inst : next <= inst)) { const char *name = ovs_instruction_name_from_type(inst); const char *next_name = ovs_instruction_name_from_type(next); if (next == inst) { VLOG_WARN(""duplicate %s instruction not allowed, for OpenFlow "" ""1.1+ compatibility"", name); } else { VLOG_WARN(""invalid instruction ordering: %s must appear "" ""before %s, for OpenFlow 1.1+ compatibility"", next_name, name); } return OFPERR_OFPBAC_UNSUPPORTED_ORDER; } if (!((1u << next) & allowed_ovsinsts)) { const char *name = ovs_instruction_name_from_type(next); VLOG_WARN(""%s instruction not allowed here"", name); return OFPERR_OFPBIC_UNSUP_INST; } inst = next; } return 0; } ",0 "static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev) { struct tun_struct *tun = netdev_priv(dev); tun_debug(KERN_INFO, tun, ""tun_net_xmit %d\n"", skb->len); /* Drop packet if interface is not attached */ if (!tun->tfile) goto drop; /* Drop if the filter does not like it. * This is a noop if the filter is disabled. * Filter can be enabled only for the TAP devices. */ if (!check_filter(&tun->txflt, skb)) goto drop; if (tun->socket.sk->sk_filter && sk_filter(tun->socket.sk, skb)) goto drop; if (skb_queue_len(&tun->socket.sk->sk_receive_queue) >= dev->tx_queue_len) { if (!(tun->flags & TUN_ONE_QUEUE)) { /* Normal queueing mode. */ /* Packet scheduler handles dropping of further packets. */ netif_stop_queue(dev); /* We won't see all dropped packets individually, so overrun * error is more appropriate. */ dev->stats.tx_fifo_errors++; } else { /* Single queue mode. * Driver handles dropping of all packets itself. */ goto drop; } } /* Orphan the skb - required as we might hang on to it * for indefinite time. */ skb_orphan(skb); /* Enqueue packet */ skb_queue_tail(&tun->socket.sk->sk_receive_queue, skb); /* Notify and wake up reader process */ if (tun->flags & TUN_FASYNC) kill_fasync(&tun->fasync, SIGIO, POLL_IN); wake_up_interruptible_poll(&tun->wq.wait, POLLIN | POLLRDNORM | POLLRDBAND); return NETDEV_TX_OK; drop: dev->stats.tx_dropped++; kfree_skb(skb); return NETDEV_TX_OK; } ",0 "static int ext4_release_file(struct inode *inode, struct file *filp) { if (ext4_test_inode_state(inode, EXT4_STATE_DA_ALLOC_CLOSE)) { ext4_alloc_da_blocks(inode); ext4_clear_inode_state(inode, EXT4_STATE_DA_ALLOC_CLOSE); } /* if we are the last writer on the inode, drop the block reservation */ if ((filp->f_mode & FMODE_WRITE) && (atomic_read(&inode->i_writecount) == 1) && !EXT4_I(inode)->i_reserved_data_blocks) { down_write(&EXT4_I(inode)->i_data_sem); ext4_discard_preallocations(inode); up_write(&EXT4_I(inode)->i_data_sem); } if (is_dx(inode) && filp->private_data) ext4_htree_free_dir_info(filp->private_data); return 0; } ",0 "int yr_object_structure_set_member( YR_OBJECT* object, YR_OBJECT* member) { YR_STRUCTURE_MEMBER* sm; assert(object->type == OBJECT_TYPE_STRUCTURE); if (yr_object_lookup_field(object, member->identifier) != NULL) return ERROR_DUPLICATED_STRUCTURE_MEMBER; sm = (YR_STRUCTURE_MEMBER*) yr_malloc(sizeof(YR_STRUCTURE_MEMBER)); if (sm == NULL) return ERROR_INSUFFICIENT_MEMORY; member->parent = object; sm->object = member; sm->next = object_as_structure(object)->members; object_as_structure(object)->members = sm; return ERROR_SUCCESS; } ",0 "void HTMLInputElement::onSearch() { ASSERT(isSearchField()); if (m_inputType) static_cast(m_inputType.get())->stopSearchEventTimer(); dispatchEvent(Event::create(eventNames().searchEvent, true, false)); } ",0 "static void cm_process_work(struct cm_id_private *cm_id_priv, struct cm_work *work) { int ret; /* We will typically only have the current event to report. */ ret = cm_id_priv->id.cm_handler(&cm_id_priv->id, &work->cm_event); cm_free_work(work); while (!ret && !atomic_add_negative(-1, &cm_id_priv->work_count)) { spin_lock_irq(&cm_id_priv->lock); work = cm_dequeue_work(cm_id_priv); spin_unlock_irq(&cm_id_priv->lock); BUG_ON(!work); ret = cm_id_priv->id.cm_handler(&cm_id_priv->id, &work->cm_event); cm_free_work(work); } cm_deref_id(cm_id_priv); if (ret) cm_destroy_id(&cm_id_priv->id, ret); } ",0 "bool sk_net_capable(const struct sock *sk, int cap) { return sk_ns_capable(sk, sock_net(sk)->user_ns, cap); } ",0 "PHPAPI zend_string *php_addcslashes(zend_string *str, int should_free, char *what, size_t wlength) { char flags[256]; char *source, *target; char *end; char c; size_t newlen; zend_string *new_str = zend_string_alloc(4 * ZSTR_LEN(str), 0); php_charmask((unsigned char *)what, wlength, flags); for (source = (char*)ZSTR_VAL(str), end = source + ZSTR_LEN(str), target = ZSTR_VAL(new_str); source < end; source++) { c = *source; if (flags[(unsigned char)c]) { if ((unsigned char) c < 32 || (unsigned char) c > 126) { *target++ = '\\'; switch (c) { case '\n': *target++ = 'n'; break; case '\t': *target++ = 't'; break; case '\r': *target++ = 'r'; break; case '\a': *target++ = 'a'; break; case '\v': *target++ = 'v'; break; case '\b': *target++ = 'b'; break; case '\f': *target++ = 'f'; break; default: target += sprintf(target, ""%03o"", (unsigned char) c); } continue; } *target++ = '\\'; } *target++ = c; } *target = 0; newlen = target - ZSTR_VAL(new_str); if (newlen < ZSTR_LEN(str) * 4) { new_str = zend_string_truncate(new_str, newlen, 0); } if (should_free) { zend_string_release(str); } return new_str; } ",0 "void WallpaperManager::OnDeviceWallpaperDownloaded(const AccountId& account_id, const std::string& hash, bool success, const GURL& url) { if (!success) { LOG(ERROR) << ""Failed to download the device wallpaper. Fallback to "" ""default wallpaper.""; SetDefaultWallpaperDelayed(account_id); return; } base::PostTaskWithTraitsAndReplyWithResult( FROM_HERE, {base::MayBlock()}, base::Bind(&CheckDeviceWallpaperMatchHash, GetDeviceWallpaperFilePath(), hash), base::Bind(&WallpaperManager::OnCheckDeviceWallpaperMatchHash, weak_factory_.GetWeakPtr(), account_id, url.spec(), hash)); } ",0 "struct dvb_frontend* ttusbdecfe_dvbt_attach(const struct ttusbdecfe_config* config) { struct ttusbdecfe_state* state = NULL; /* allocate memory for the internal state */ state = kmalloc(sizeof(struct ttusbdecfe_state), GFP_KERNEL); if (state == NULL) return NULL; /* setup the state */ state->config = config; /* create dvb_frontend */ memcpy(&state->frontend.ops, &ttusbdecfe_dvbt_ops, sizeof(struct dvb_frontend_ops)); state->frontend.demodulator_priv = state; return &state->frontend; } ",0 "void WebContentsImpl::NotifyFrameSwapped(RenderFrameHost* old_host, RenderFrameHost* new_host) { for (auto& observer : observers_) observer.RenderFrameHostChanged(old_host, new_host); } ",0 "static inline int apic_lvt_vector(struct kvm_lapic *apic, int lvt_type) { return kvm_apic_get_reg(apic, lvt_type) & APIC_VECTOR_MASK; } ",0 "PepperPlatformAudioInput::~PepperPlatformAudioInput() { DCHECK(!ipc_); DCHECK(!client_); DCHECK(label_.empty()); DCHECK(!pending_open_device_); } ",0 "static void vhost_scsi_submission_work(struct work_struct *work) { struct vhost_scsi_cmd *cmd = container_of(work, struct vhost_scsi_cmd, work); struct vhost_scsi_nexus *tv_nexus; struct se_cmd *se_cmd = &cmd->tvc_se_cmd; struct scatterlist *sg_ptr, *sg_prot_ptr = NULL; int rc; /* FIXME: BIDI operation */ if (cmd->tvc_sgl_count) { sg_ptr = cmd->tvc_sgl; if (cmd->tvc_prot_sgl_count) sg_prot_ptr = cmd->tvc_prot_sgl; else se_cmd->prot_pto = true; } else { sg_ptr = NULL; } tv_nexus = cmd->tvc_nexus; rc = target_submit_cmd_map_sgls(se_cmd, tv_nexus->tvn_se_sess, cmd->tvc_cdb, &cmd->tvc_sense_buf[0], cmd->tvc_lun, cmd->tvc_exp_data_len, cmd->tvc_task_attr, cmd->tvc_data_direction, TARGET_SCF_ACK_KREF, sg_ptr, cmd->tvc_sgl_count, NULL, 0, sg_prot_ptr, cmd->tvc_prot_sgl_count); if (rc < 0) { transport_send_check_condition_and_sense(se_cmd, TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0); transport_generic_free_cmd(se_cmd, 0); } } ",0 "static void cmd_syncget(const char *tag, struct dlist *kin) { struct sync_state sync_state = { imapd_userid, imapd_userisadmin || imapd_userisproxyadmin, imapd_authstate, &imapd_namespace, imapd_out, 0 /* local_only */ }; /* administrators only please */ if (!imapd_userisadmin) { syslog(LOG_ERR, ""SYNCERROR: invalid user %s trying to sync"", imapd_userid); prot_printf(imapd_out, ""%s NO only admininstrators may use sync commands\r\n"", tag); return; } const char *resp = sync_get(kin, &sync_state); prot_printf(imapd_out, ""%s %s\r\n"", tag, resp); /* Reset inactivity timer in case we spent a long time processing data */ prot_resettimeout(imapd_in); } ",0 "static struct nft_af_info *nft_afinfo_lookup(struct net *net, int family) { struct nft_af_info *afi; list_for_each_entry(afi, &net->nft.af_info, list) { if (afi->family == family) return afi; } return NULL; } ",0 " event_gamma_change( double delta ) { status.gamma += delta; if ( status.gamma > 3.0 ) status.gamma = 3.0; else if ( status.gamma < 0.0 ) status.gamma = 0.0; grSetGlyphGamma( status.gamma ); sprintf( status.header_buffer, ""gamma changed to %.1f%s"", status.gamma, status.gamma == 0.0 ? "" (sRGB mode)"" : """" ); status.header = (const char *)status.header_buffer; } ",0 "void ResourceDispatcherHostImpl::MarkAsTransferredNavigation( net::URLRequest* transferred_request) { ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(transferred_request); GlobalRequestID transferred_request_id(info->GetChildID(), info->GetRequestID()); transferred_navigations_[transferred_request_id] = transferred_request; scoped_refptr transferred_resource_handler( new DoomedResourceHandler(info->resource_handler())); info->set_resource_handler(transferred_resource_handler.get()); } ",0 "int WebSocketExperimentTask::DoWebSocketKeepIdleComplete(int result) { if (result != net::ERR_TIMED_OUT) { if (result == net::OK) result = net::ERR_UNEXPECTED; return result; } DCHECK(websocket_); next_state_ = STATE_WEBSOCKET_RECV_PUSH_MESSAGE; SetTimeout(config_.websocket_receive_push_message_deadline_ms); return net::ERR_IO_PENDING; } ",0 "static int stop_audio_datapath(struct a2dp_stream_common *common) { int oldstate = common->state; INFO(""state %d"", common->state); if (common->ctrl_fd == AUDIO_SKT_DISCONNECTED) return -1; /* prevent any stray output writes from autostarting the stream while stopping audiopath */ common->state = AUDIO_A2DP_STATE_STOPPING; if (a2dp_command(common, A2DP_CTRL_CMD_STOP) < 0) { ERROR(""audiopath stop failed""); common->state = oldstate; return -1; } common->state = AUDIO_A2DP_STATE_STOPPED; /* disconnect audio path */ skt_disconnect(common->audio_fd); common->audio_fd = AUDIO_SKT_DISCONNECTED; return 0; } ",0 " void PrepareProfile(const std::string& username) { ChromeBrowserMainExtraPartsProfiles:: EnsureBrowserContextKeyedServiceFactoriesBuilt(); DeviceSettingsTestHelper device_settings_test_helper; DeviceSettingsService::Get()->SetSessionManager( &device_settings_test_helper, new MockOwnerKeyUtil()); EXPECT_CALL(*mock_async_method_caller_, AsyncMount(_, _, _, _)) .WillRepeatedly(Return()); EXPECT_CALL(*mock_async_method_caller_, AsyncGetSanitizedUsername(_, _)) .WillRepeatedly(Return()); scoped_refptr authenticator = LoginUtils::Get()->CreateAuthenticator(this); UserContext user_context(username); user_context.SetKey(Key(""password"")); user_context.SetUserIDHash(username); authenticator->CompleteLogin(ProfileHelper::GetSigninProfile(), user_context); const bool kHasAuthCookies = false; const bool kHasActiveSession = false; user_context.SetAuthFlow(UserContext::AUTH_FLOW_GAIA_WITHOUT_SAML); LoginUtils::Get()->PrepareProfile(user_context, kHasAuthCookies, kHasActiveSession, this); device_settings_test_helper.Flush(); RunUntilIdle(); DeviceSettingsService::Get()->UnsetSessionManager(); } ",0 "void WebPageProxy::clearAllEditCommands() { m_pageClient->clearAllEditCommands(); } ",0 "static struct rtable *__mkroute_output(const struct fib_result *res, const struct flowi4 *fl4, int orig_oif, struct net_device *dev_out, unsigned int flags) { struct fib_info *fi = res->fi; struct fib_nh_exception *fnhe; struct in_device *in_dev; u16 type = res->type; struct rtable *rth; bool do_cache; in_dev = __in_dev_get_rcu(dev_out); if (!in_dev) return ERR_PTR(-EINVAL); if (likely(!IN_DEV_ROUTE_LOCALNET(in_dev))) if (ipv4_is_loopback(fl4->saddr) && !(dev_out->flags & IFF_LOOPBACK) && !netif_is_l3_master(dev_out)) return ERR_PTR(-EINVAL); if (ipv4_is_lbcast(fl4->daddr)) type = RTN_BROADCAST; else if (ipv4_is_multicast(fl4->daddr)) type = RTN_MULTICAST; else if (ipv4_is_zeronet(fl4->daddr)) return ERR_PTR(-EINVAL); if (dev_out->flags & IFF_LOOPBACK) flags |= RTCF_LOCAL; do_cache = true; if (type == RTN_BROADCAST) { flags |= RTCF_BROADCAST | RTCF_LOCAL; fi = NULL; } else if (type == RTN_MULTICAST) { flags |= RTCF_MULTICAST | RTCF_LOCAL; if (!ip_check_mc_rcu(in_dev, fl4->daddr, fl4->saddr, fl4->flowi4_proto)) flags &= ~RTCF_LOCAL; else do_cache = false; /* If multicast route do not exist use * default one, but do not gateway in this case. * Yes, it is hack. */ if (fi && res->prefixlen < 4) fi = NULL; } else if ((type == RTN_LOCAL) && (orig_oif != 0) && (orig_oif != dev_out->ifindex)) { /* For local routes that require a particular output interface * we do not want to cache the result. Caching the result * causes incorrect behaviour when there are multiple source * addresses on the interface, the end result being that if the * intended recipient is waiting on that interface for the * packet he won't receive it because it will be delivered on * the loopback interface and the IP_PKTINFO ipi_ifindex will * be set to the loopback interface as well. */ do_cache = false; } fnhe = NULL; do_cache &= fi != NULL; if (fi) { struct rtable __rcu **prth; struct fib_nh *nh = &FIB_RES_NH(*res); fnhe = find_exception(nh, fl4->daddr); if (!do_cache) goto add; if (fnhe) { prth = &fnhe->fnhe_rth_output; } else { if (unlikely(fl4->flowi4_flags & FLOWI_FLAG_KNOWN_NH && !(nh->nh_gw && nh->nh_scope == RT_SCOPE_LINK))) { do_cache = false; goto add; } prth = raw_cpu_ptr(nh->nh_pcpu_rth_output); } rth = rcu_dereference(*prth); if (rt_cache_valid(rth) && dst_hold_safe(&rth->dst)) return rth; } add: rth = rt_dst_alloc(dev_out, flags, type, IN_DEV_CONF_GET(in_dev, NOPOLICY), IN_DEV_CONF_GET(in_dev, NOXFRM), do_cache); if (!rth) return ERR_PTR(-ENOBUFS); rth->rt_iif = orig_oif; RT_CACHE_STAT_INC(out_slow_tot); if (flags & (RTCF_BROADCAST | RTCF_MULTICAST)) { if (flags & RTCF_LOCAL && !(dev_out->flags & IFF_LOOPBACK)) { rth->dst.output = ip_mc_output; RT_CACHE_STAT_INC(out_slow_mc); } #ifdef CONFIG_IP_MROUTE if (type == RTN_MULTICAST) { if (IN_DEV_MFORWARD(in_dev) && !ipv4_is_local_multicast(fl4->daddr)) { rth->dst.input = ip_mr_input; rth->dst.output = ip_mc_output; } } #endif } rt_set_nexthop(rth, fl4->daddr, res, fnhe, fi, type, 0, do_cache); lwtunnel_set_redirect(&rth->dst); return rth; } ",0 "Element& DateTimeChooserImpl::ownerElement() { return m_client->ownerElement(); } ",0 "static void camellia_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) { camellia_dec_blk(crypto_tfm_ctx(tfm), dst, src); } ",0 "void nfs4_destroy_session(struct nfs4_session *session) { struct rpc_xprt *xprt; struct rpc_cred *cred; cred = nfs4_get_exchange_id_cred(session->clp); nfs4_proc_destroy_session(session, cred); if (cred) put_rpccred(cred); rcu_read_lock(); xprt = rcu_dereference(session->clp->cl_rpcclient->cl_xprt); rcu_read_unlock(); dprintk(""%s Destroy backchannel for xprt %p\n"", __func__, xprt); xprt_destroy_backchannel(xprt, NFS41_BC_MIN_CALLBACKS); nfs4_destroy_slot_tables(session); kfree(session); } ",0 "device_filesystem_set_label_authorized_cb (Daemon *daemon, Device *device, DBusGMethodInvocation *context, const gchar *action_id, guint num_user_data, gpointer *user_data_elements) { const gchar *new_label = user_data_elements[0]; int n; char *argv[10]; const Filesystem *fs_details; GError *error; error = NULL; if (device->priv->id_usage == NULL || strcmp (device->priv->id_usage, ""filesystem"") != 0) { throw_error (context, ERROR_FAILED, ""Not a mountable file system""); goto out; } fs_details = daemon_local_get_fs_details (device->priv->daemon, device->priv->id_type); if (fs_details == NULL) { throw_error (context, ERROR_BUSY, ""Unknown filesystem""); goto out; } if (!fs_details->supports_online_label_rename) { if (device_local_is_busy (device, FALSE, &error)) { dbus_g_method_return_error (context, error); g_error_free (error); goto out; } } n = 0; argv[n++] = ""udisks-helper-change-filesystem-label""; argv[n++] = device->priv->device_file; argv[n++] = device->priv->id_type; argv[n++] = (char *) new_label; argv[n++] = NULL; if (!job_new (context, ""FilesystemSetLabel"", FALSE, device, argv, NULL, filesystem_set_label_completed_cb, FALSE, g_strdup (new_label), g_free)) { goto out; } out: ; } ",0 "static spl_filesystem_object * spl_filesystem_object_create_info(spl_filesystem_object *source, char *file_path, int file_path_len, int use_copy, zend_class_entry *ce, zval *return_value TSRMLS_DC) /* {{{ */ { spl_filesystem_object *intern; zval *arg1; zend_error_handling error_handling; if (!file_path || !file_path_len) { #if defined(PHP_WIN32) zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, ""Cannot create SplFileInfo for empty path""); if (file_path && !use_copy) { efree(file_path); } #else if (file_path && !use_copy) { efree(file_path); } file_path_len = 1; file_path = ""/""; #endif return NULL; } zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, &error_handling TSRMLS_CC); ce = ce ? ce : source->info_class; zend_update_class_constants(ce TSRMLS_CC); return_value->value.obj = spl_filesystem_object_new_ex(ce, &intern TSRMLS_CC); Z_TYPE_P(return_value) = IS_OBJECT; if (ce->constructor->common.scope != spl_ce_SplFileInfo) { MAKE_STD_ZVAL(arg1); ZVAL_STRINGL(arg1, file_path, file_path_len, use_copy); zend_call_method_with_1_params(&return_value, ce, &ce->constructor, ""__construct"", NULL, arg1); zval_ptr_dtor(&arg1); } else { spl_filesystem_info_set_filename(intern, file_path, file_path_len, use_copy TSRMLS_CC); } zend_restore_error_handling(&error_handling TSRMLS_CC); return intern; } /* }}} */ ",1 "free_key_string(decryption_key_t *dk) { if (dk->key) g_string_free(dk->key, TRUE); if (dk->ssid) g_byte_array_free(dk->ssid, TRUE); g_free(dk); } ",0 "void WT_ProcessVoice (S_WT_VOICE *pWTVoice, S_WT_INT_FRAME *pWTIntFrame) { /* use noise generator */ if (pWTVoice->loopStart == WT_NOISE_GENERATOR) WT_NoiseGenerator(pWTVoice, pWTIntFrame); /* generate interpolated samples for looped waves */ else if (pWTVoice->loopStart != pWTVoice->loopEnd) WT_Interpolate(pWTVoice, pWTIntFrame); /* generate interpolated samples for unlooped waves */ else { WT_InterpolateNoLoop(pWTVoice, pWTIntFrame); } #ifdef _FILTER_ENABLED if (pWTIntFrame->frame.k != 0) WT_VoiceFilter(&pWTVoice->filter, pWTIntFrame); #endif #ifdef UNIFIED_MIXER { EAS_I32 gainLeft, gainIncLeft; #if (NUM_OUTPUT_CHANNELS == 2) EAS_I32 gainRight, gainIncRight; #endif gainLeft = (pWTIntFrame->prevGain * pWTVoice->gainLeft) << 1; gainIncLeft = (((pWTIntFrame->frame.gainTarget * pWTVoice->gainLeft) << 1) - gainLeft) >> SYNTH_UPDATE_PERIOD_IN_BITS; #if (NUM_OUTPUT_CHANNELS == 2) gainRight = (pWTIntFrame->prevGain * pWTVoice->gainRight) << 1; gainIncRight = (((pWTIntFrame->frame.gainTarget * pWTVoice->gainRight) << 1) - gainRight) >> SYNTH_UPDATE_PERIOD_IN_BITS; EAS_MixStream( pWTIntFrame->pAudioBuffer, pWTIntFrame->pMixBuffer, pWTIntFrame->numSamples, gainLeft, gainRight, gainIncLeft, gainIncRight, MIX_FLAGS_STEREO_OUTPUT); #else EAS_MixStream( pWTIntFrame->pAudioBuffer, pWTIntFrame->pMixBuffer, pWTIntFrame->numSamples, gainLeft, 0, gainIncLeft, 0, 0); #endif } #else /* apply gain, and left and right gain */ WT_VoiceGain(pWTVoice, pWTIntFrame); #endif } ",0 " virtual void EnableWifiNetworkDevice(bool enable) { EnableNetworkDeviceType(TYPE_WIFI, enable); } ",0 "WGC3Denum WebGraphicsContext3DCommandBufferImpl::getGraphicsResetStatusARB() { if (IsCommandBufferContextLost() && context_lost_reason_ == GL_NO_ERROR) { return GL_UNKNOWN_CONTEXT_RESET_ARB; } return context_lost_reason_; } ",0 "char *GfxColorSpace::getColorSpaceModeName(int idx) { return gfxColorSpaceModeNames[idx]; } ",0 "get_relocation_entries(Dwarf_Bool is_64bit, int endianness, int machine, Dwarf_Small *relocation_section, Dwarf_Unsigned relocation_section_size, Dwarf_Unsigned relocation_section_entrysize, struct Dwarf_Elf_Rela **relas, unsigned int *nrelas, int *error) { unsigned int relocation_size = 0; if (is_64bit) { #ifdef HAVE_ELF64_RELA relocation_size = sizeof(Elf64_Rela); #else *error = DW_DLE_MISSING_ELF64_SUPPORT; return DW_DLV_ERROR; #endif } else { relocation_size = sizeof(Elf32_Rela); } if (relocation_size != relocation_section_entrysize) { /* Means our struct definition does not match the real object. */ *error = DW_DLE_RELOC_SECTION_LENGTH_ODD; return DW_DLV_ERROR; } if (relocation_section == NULL) { *error = DW_DLE_RELOC_SECTION_PTR_NULL; return(DW_DLV_ERROR); } if ((relocation_section_size != 0)) { size_t bytescount = 0; if (relocation_section_size%relocation_size) { *error = DW_DLE_RELOC_SECTION_LENGTH_ODD; return DW_DLV_ERROR; } *nrelas = relocation_section_size/relocation_size; bytescount = (*nrelas) * sizeof(struct Dwarf_Elf_Rela); *relas = malloc(bytescount); if (!*relas) { *error = DW_DLE_MAF; return(DW_DLV_ERROR); } memset(*relas,0,bytescount); get_relocations_array(is_64bit,endianness,machine, relocation_section, *nrelas, *relas); } return(DW_DLV_OK); } ",0 "void RenderFrameImpl::PluginDidStartLoading() { DidStartLoading(); } ",0 "Text* FrameSelectionTest::AppendTextNode(const String& data) { Text* text = GetDocument().createTextNode(data); GetDocument().body()->AppendChild(text); return text; } ",0 "RunLoop::Delegate::Client* RunLoop::RegisterDelegateForCurrentThread( Delegate* delegate) { DCHECK(!delegate->bound_); DCHECK_CALLED_ON_VALID_THREAD(delegate->bound_thread_checker_); DCHECK(!tls_delegate.Get().Get()); tls_delegate.Get().Set(delegate); delegate->bound_ = true; return &delegate->client_interface_; } ",0 "RenderFrameSubmissionObserver::RenderFrameSubmissionObserver( RenderFrameMetadataProvider* render_frame_metadata_provider) : render_frame_metadata_provider_(render_frame_metadata_provider) { render_frame_metadata_provider_->AddObserver(this); render_frame_metadata_provider_->ReportAllFrameSubmissionsForTesting(true); } ",0 "void PermissionsData::SetUsesDefaultHostRestrictions() const { AutoLockOnValidThread lock(runtime_lock_, thread_checker_.get()); uses_default_policy_host_restrictions = true; } ",0 "void GLES2DecoderImpl::DoSetEnableDCLayersCHROMIUM(GLboolean enable) { Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER); if (framebuffer) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, ""glSetEnableDCLayersCHROMIUM"", ""framebuffer must not be bound""); return; } if (!supports_dc_layers_) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, ""glSetEnableDCLayersCHROMIUM"", ""surface doesn't support SetDrawRectangle""); return; } if (!surface_->SetEnableDCLayers(!!enable)) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, ""glSetEnableDCLayersCHROMIUM"", ""failed on surface""); } } ",0 "SYSCALL_DEFINE3(io_cancel, aio_context_t, ctx_id, struct iocb __user *, iocb, struct io_event __user *, result) { struct kioctx *ctx; struct aio_kiocb *kiocb; u32 key; int ret; ret = get_user(key, &iocb->aio_key); if (unlikely(ret)) return -EFAULT; ctx = lookup_ioctx(ctx_id); if (unlikely(!ctx)) return -EINVAL; spin_lock_irq(&ctx->ctx_lock); kiocb = lookup_kiocb(ctx, iocb, key); if (kiocb) ret = kiocb_cancel(kiocb); else ret = -EINVAL; spin_unlock_irq(&ctx->ctx_lock); if (!ret) { /* * The result argument is no longer used - the io_event is * always delivered via the ring buffer. -EINPROGRESS indicates * cancellation is progress: */ ret = -EINPROGRESS; } percpu_ref_put(&ctx->users); return ret; } ",0 "UpdateDerivedKeymapFields(struct xkb_keymap *keymap) { struct xkb_key *key; struct xkb_mod *mod; struct xkb_led *led; unsigned int i, j; /* Find all the interprets for the key and bind them to actions, * which will also update the vmodmap. */ xkb_keys_foreach(key, keymap) if (!ApplyInterpsToKey(keymap, key)) return false; /* Update keymap->mods, the virtual -> real mod mapping. */ xkb_keys_foreach(key, keymap) xkb_mods_enumerate(i, mod, &keymap->mods) if (key->vmodmap & (1u << i)) mod->mapping |= key->modmap; /* Now update the level masks for all the types to reflect the vmods. */ for (i = 0; i < keymap->num_types; i++) { ComputeEffectiveMask(keymap, &keymap->types[i].mods); for (j = 0; j < keymap->types[i].num_entries; j++) { ComputeEffectiveMask(keymap, &keymap->types[i].entries[j].mods); ComputeEffectiveMask(keymap, &keymap->types[i].entries[j].preserve); } } /* Update action modifiers. */ xkb_keys_foreach(key, keymap) for (i = 0; i < key->num_groups; i++) for (j = 0; j < XkbKeyNumLevels(key, i); j++) UpdateActionMods(keymap, &key->groups[i].levels[j].action, key->modmap); /* Update vmod -> led maps. */ xkb_leds_foreach(led, keymap) ComputeEffectiveMask(keymap, &led->mods); /* Find maximum number of groups out of all keys in the keymap. */ xkb_keys_foreach(key, keymap) keymap->num_groups = MAX(keymap->num_groups, key->num_groups); return true; } ",0 "static int tcm_loop_alloc_core_bus(void) { int ret; tcm_loop_primary = root_device_register(""tcm_loop_0""); if (IS_ERR(tcm_loop_primary)) { printk(KERN_ERR ""Unable to allocate tcm_loop_primary\n""); return PTR_ERR(tcm_loop_primary); } ret = bus_register(&tcm_loop_lld_bus); if (ret) { printk(KERN_ERR ""bus_register() failed for tcm_loop_lld_bus\n""); goto dev_unreg; } ret = driver_register(&tcm_loop_driverfs); if (ret) { printk(KERN_ERR ""driver_register() failed for"" ""tcm_loop_driverfs\n""); goto bus_unreg; } printk(KERN_INFO ""Initialized TCM Loop Core Bus\n""); return ret; bus_unreg: bus_unregister(&tcm_loop_lld_bus); dev_unreg: root_device_unregister(tcm_loop_primary); return ret; } ",0 "static void ahash_op_unaligned_done(struct crypto_async_request *req, int err) { struct ahash_request *areq = req->data; struct ahash_request_priv *priv = areq->priv; crypto_completion_t complete = priv->complete; void *data = priv->data; ahash_op_unaligned_finish(areq, err); complete(data, err); } ",0 "append_gen_fifo( void *fifo, void *entry ) { gen_fifo *pf; gen_node *pe; pf = fifo; pe = entry; if (NULL == pf) pf = emalloc_zero(sizeof(*pf)); if (pe != NULL) LINK_FIFO(*pf, pe, link); return pf; } ",0 "heap_get_entry(struct heap_queue *heap) { uint64_t a_key, b_key, c_key; int a, b, c; struct file_info *r, *tmp; if (heap->used < 1) return (NULL); /* * The first file in the list is the earliest; we'll return this. */ r = heap->files[0]; /* * Move the last item in the heap to the root of the tree */ heap->files[0] = heap->files[--(heap->used)]; /* * Rebalance the heap. */ a = 0; /* Starting element and its heap key */ a_key = heap->files[a]->key; for (;;) { b = a + a + 1; /* First child */ if (b >= heap->used) return (r); b_key = heap->files[b]->key; c = b + 1; /* Use second child if it is smaller. */ if (c < heap->used) { c_key = heap->files[c]->key; if (c_key < b_key) { b = c; b_key = c_key; } } if (a_key <= b_key) return (r); tmp = heap->files[a]; heap->files[a] = heap->files[b]; heap->files[b] = tmp; a = b; } } ",0 "_XcursorBuildThemeDir (const char *dir, const char *theme) { const char *colon; const char *tcolon; char *full; char *home; int dirlen; int homelen; int themelen; int len; if (!dir || !theme) return NULL; colon = strchr (dir, ':'); if (!colon) colon = dir + strlen (dir); dirlen = colon - dir; tcolon = strchr (theme, ':'); if (!tcolon) tcolon = theme + strlen (theme); themelen = tcolon - theme; home = NULL; homelen = 0; if (*dir == '~') { home = getenv (""HOME""); if (!home) return NULL; homelen = strlen (home); dir++; dirlen--; } /* * add space for any needed directory separators, one per component, * and one for the trailing null */ len = 1 + homelen + 1 + dirlen + 1 + themelen + 1; full = malloc (len); if (!full) return NULL; full[0] = '\0'; if (home) _XcursorAddPathElt (full, home, -1); _XcursorAddPathElt (full, dir, dirlen); _XcursorAddPathElt (full, theme, themelen); return full; } ",0 " static gboolean OnConfigureEvent(GtkWidget* widget, GdkEventConfigure* event, RenderWidgetHostViewGtk* host_view) { host_view->MarkCachedWidgetCenterStale(); host_view->UpdateScreenInfo(host_view->GetNativeView()); return FALSE; } ",0 "int sta_info_insert_rcu(struct sta_info *sta) __acquires(RCU) { struct ieee80211_local *local = sta->local; int err = 0; might_sleep(); err = sta_info_insert_check(sta); if (err) { rcu_read_lock(); goto out_free; } mutex_lock(&local->sta_mtx); err = sta_info_insert_finish(sta); if (err) goto out_free; return 0; out_free: BUG_ON(!err); sta_info_free(local, sta); return err; } ",0 "WebContentsImpl* WebContentsImpl::FromFrameTreeNode( const FrameTreeNode* frame_tree_node) { return static_cast( WebContents::FromRenderFrameHost(frame_tree_node->current_frame_host())); } ",0 "bt_status_t btsock_l2cap_init(int handle) { APPL_TRACE_DEBUG(""btsock_l2cap_init...""); pthread_mutex_lock(&state_lock); pth = handle; socks = NULL; pthread_mutex_unlock(&state_lock); return BT_STATUS_SUCCESS; } ",0 "RenderThreadImpl::~RenderThreadImpl() { for (std::map::iterator it = pending_render_frame_connects_.begin(); it != pending_render_frame_connects_.end(); ++it) { mojo::CloseRaw(it->second); } } ",0 "static void nested_svm_uninit_mmu_context(struct kvm_vcpu *vcpu) { vcpu->arch.walk_mmu = &vcpu->arch.mmu; } ",0 "sg_alloc(struct gendisk *disk, struct scsi_device *scsidp) { struct request_queue *q = scsidp->request_queue; Sg_device *sdp; unsigned long iflags; int error; u32 k; sdp = kzalloc(sizeof(Sg_device), GFP_KERNEL); if (!sdp) { sdev_printk(KERN_WARNING, scsidp, ""%s: kmalloc Sg_device "" ""failure\n"", __func__); return ERR_PTR(-ENOMEM); } idr_preload(GFP_KERNEL); write_lock_irqsave(&sg_index_lock, iflags); error = idr_alloc(&sg_index_idr, sdp, 0, SG_MAX_DEVS, GFP_NOWAIT); if (error < 0) { if (error == -ENOSPC) { sdev_printk(KERN_WARNING, scsidp, ""Unable to attach sg device type=%d, minor number exceeds %d\n"", scsidp->type, SG_MAX_DEVS - 1); error = -ENODEV; } else { sdev_printk(KERN_WARNING, scsidp, ""%s: idr "" ""allocation Sg_device failure: %d\n"", __func__, error); } goto out_unlock; } k = error; SCSI_LOG_TIMEOUT(3, sdev_printk(KERN_INFO, scsidp, ""sg_alloc: dev=%d \n"", k)); sprintf(disk->disk_name, ""sg%d"", k); disk->first_minor = k; sdp->disk = disk; sdp->device = scsidp; mutex_init(&sdp->open_rel_lock); INIT_LIST_HEAD(&sdp->sfds); init_waitqueue_head(&sdp->open_wait); atomic_set(&sdp->detaching, 0); rwlock_init(&sdp->sfd_lock); sdp->sg_tablesize = queue_max_segments(q); sdp->index = k; kref_init(&sdp->d_ref); error = 0; out_unlock: write_unlock_irqrestore(&sg_index_lock, iflags); idr_preload_end(); if (error) { kfree(sdp); return ERR_PTR(error); } return sdp; } ",0 "map_engine_exit(void) { s_exiting = true; } ",0 "static int check_hbh_len(struct sk_buff *skb) { unsigned char *raw = (u8 *)(ipv6_hdr(skb) + 1); u32 pkt_len; const unsigned char *nh = skb_network_header(skb); int off = raw - nh; int len = (raw[1] + 1) << 3; if ((raw + len) - skb->data > skb_headlen(skb)) goto bad; off += 2; len -= 2; while (len > 0) { int optlen = nh[off + 1] + 2; switch (nh[off]) { case IPV6_TLV_PAD0: optlen = 1; break; case IPV6_TLV_PADN: break; case IPV6_TLV_JUMBO: if (nh[off + 1] != 4 || (off & 3) != 2) goto bad; pkt_len = ntohl(*(__be32 *) (nh + off + 2)); if (pkt_len <= IPV6_MAXPLEN || ipv6_hdr(skb)->payload_len) goto bad; if (pkt_len > skb->len - sizeof(struct ipv6hdr)) goto bad; if (pskb_trim_rcsum(skb, pkt_len + sizeof(struct ipv6hdr))) goto bad; nh = skb_network_header(skb); break; default: if (optlen > len) goto bad; break; } off += optlen; len -= optlen; } if (len == 0) return 0; bad: return -1; } ",0 "static int encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) { struct priv *ctx = crypto_blkcipher_ctx(desc->tfm); struct blkcipher_walk w; blkcipher_walk_init(&w, dst, src, nbytes); return crypt(desc, &w, ctx, crypto_cipher_alg(ctx->child)->cia_encrypt); } ",0 "void Document::activeChainNodeDetached(Node* node) { if (!m_activeElement || (node != m_activeElement && (!m_activeElement->isTextNode() || node != m_activeElement->parentNode()))) return; m_activeElement = node->parentElement(); while (m_activeElement && !m_activeElement->renderer()) m_activeElement = m_activeElement->parentElement(); } ",0 " virtual void RemoveCellularDataPlanObserver( CellularDataPlanObserver* observer) { data_plan_observers_.RemoveObserver(observer); } ",0 "uint NotificationsEngine::Notify(const QString &app_name, uint replaces_id, const QString &app_icon, const QString &summary, const QString &body, const QStringList &actions, const QVariantMap &hints, int timeout) { uint partOf = 0; const QString appRealName = hints[QStringLiteral(""x-kde-appname"")].toString(); const QString eventId = hints[QStringLiteral(""x-kde-eventId"")].toString(); const bool skipGrouping = hints[QStringLiteral(""x-kde-skipGrouping"")].toBool(); if (!replaces_id && m_activeNotifications.values().contains(app_name + summary) && !skipGrouping && !m_alwaysReplaceAppsList.contains(app_name)) { partOf = m_activeNotifications.key(app_name + summary).midRef(13).toUInt(); } qDebug() << ""Currrent active notifications:"" << m_activeNotifications; qDebug() << ""Guessing partOf as:"" << partOf; qDebug() << "" New Notification: "" << summary << body << timeout << ""& Part of:"" << partOf; QString _body; if (partOf > 0) { const QString source = QStringLiteral(""notification %1"").arg(partOf); Plasma::DataContainer *container = containerForSource(source); if (container) { _body = container->data()[QStringLiteral(""body"")].toString(); if (_body != body) { _body.append(""\n"").append(body); } else { _body = body; } replaces_id = partOf; CloseNotification(partOf); } } uint id = replaces_id ? replaces_id : m_nextId++; if (m_alwaysReplaceAppsList.contains(app_name)) { if (m_notificationsFromReplaceableApp.contains(app_name)) { id = m_notificationsFromReplaceableApp.value(app_name); } else { m_notificationsFromReplaceableApp.insert(app_name, id); } } QString appname_str = app_name; if (appname_str.isEmpty()) { appname_str = i18n(""Unknown Application""); } bool isPersistent = timeout == 0; const int AVERAGE_WORD_LENGTH = 6; const int WORD_PER_MINUTE = 250; int count = summary.length() + body.length(); timeout = 60000 * count / AVERAGE_WORD_LENGTH / WORD_PER_MINUTE; timeout = 2000 + qMax(timeout, 3000); } ",1 "local unsigned syncsearch(have, buf, len) unsigned FAR *have; const unsigned char FAR *buf; unsigned len; { unsigned got; unsigned next; got = *have; next = 0; while (next < len && got < 4) { if ((int)(buf[next]) == (got < 2 ? 0 : 0xff)) got++; else if (buf[next]) got = 0; else got = 4 - got; next++; } *have = got; return next; } ",0 "error::Error GLES2DecoderImpl::HandlePixelStorei( uint32 immediate_data_size, const gles2::PixelStorei& c) { GLenum pname = c.pname; GLenum param = c.param; if (!validators_->pixel_store.IsValid(pname)) { SetGLError(GL_INVALID_ENUM, ""glPixelStorei: pname GL_INVALID_ENUM""); return error::kNoError; } if (!validators_->pixel_store_alignment.IsValid(param)) { SetGLError(GL_INVALID_VALUE, ""glPixelSTore: param GL_INVALID_VALUE""); return error::kNoError; } glPixelStorei(pname, param); switch (pname) { case GL_PACK_ALIGNMENT: pack_alignment_ = param; break; case GL_UNPACK_ALIGNMENT: unpack_alignment_ = param; break; default: NOTREACHED(); break; } return error::kNoError; } ",0 " ~MockObserver() { item_->RemoveObserver(this); } ",0 "void __init inet_initpeers(void) { struct sysinfo si; /* Use the straight interface to information about memory. */ si_meminfo(&si); /* The values below were suggested by Alexey Kuznetsov * . I don't have any opinion about the values * myself. --SAW */ if (si.totalram <= (32768*1024)/PAGE_SIZE) inet_peer_threshold >>= 1; /* max pool size about 1MB on IA32 */ if (si.totalram <= (16384*1024)/PAGE_SIZE) inet_peer_threshold >>= 1; /* about 512KB */ if (si.totalram <= (8192*1024)/PAGE_SIZE) inet_peer_threshold >>= 2; /* about 128KB */ peer_cachep = kmem_cache_create(""inet_peer_cache"", sizeof(struct inet_peer), 0, SLAB_HWCACHE_ALIGN | SLAB_PANIC, NULL); } ",0 "void vnc_start_worker_thread(void) { VncJobQueue *q; if (vnc_worker_thread_running()) return ; q = vnc_queue_init(); qemu_thread_create(&q->thread, vnc_worker_thread, q, QEMU_THREAD_DETACHED); queue = q; /* Set global queue */ } ",0 "ReturnOpenvpnOutput(HANDLE pipe, HANDLE ovpn_output, DWORD count, LPHANDLE events) { WCHAR *wide_output = NULL; CHAR output[512]; DWORD size; ReadFile(ovpn_output, output, sizeof(output), &size, NULL); if (size == 0) { return; } wide_output = malloc((size) * sizeof(WCHAR)); if (wide_output) { MultiByteToWideChar(CP_UTF8, 0, output, size, wide_output, size); wide_output[size - 1] = 0; } ReturnError(pipe, ERROR_OPENVPN_STARTUP, wide_output, count, events); free(wide_output); } ",0 "PassRefPtr Scrollbar::createNativeScrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize size) { return adoptRef(new Scrollbar(scrollableArea, orientation, size)); } ",0 "void MockInputMethod::ClearStates() { untranslated_ime_message_called_ = false; text_input_type_changed_ = false; cancel_composition_called_ = false; } ",0 "file_check_mem(struct magic_set *ms, unsigned int level) { size_t len; if (level >= ms->c.len) { len = (ms->c.len += 20) * sizeof(*ms->c.li); ms->c.li = CAST(struct level_info *, (ms->c.li == NULL) ? malloc(len) : realloc(ms->c.li, len)); if (ms->c.li == NULL) { file_oomem(ms, len); return -1; } } ms->c.li[level].got_match = 0; #ifdef ENABLE_CONDITIONALS ms->c.li[level].last_match = 0; ms->c.li[level].last_cond = COND_NONE; #endif /* ENABLE_CONDITIONALS */ return 0; } ",1 "PHP_METHOD(Phar, addFile) { char *fname, *localname = NULL; size_t fname_len, localname_len = 0; php_stream *resource; zval zresource; PHAR_ARCHIVE_OBJECT(); if (zend_parse_parameters(ZEND_NUM_ARGS(), ""s|s"", &fname, &fname_len, &localname, &localname_len) == FAILURE) { return; } #if PHP_API_VERSION < 20100412 if (PG(safe_mode) && (!php_checkuid(fname, NULL, CHECKUID_ALLOW_ONLY_FILE))) { zend_throw_exception_ex(spl_ce_RuntimeException, 0, ""phar error: unable to open file \""%s\"" to add to phar archive, safe_mode restrictions prevent this"", fname); return; } #endif if (!strstr(fname, ""://"") && php_check_open_basedir(fname)) { zend_throw_exception_ex(spl_ce_RuntimeException, 0, ""phar error: unable to open file \""%s\"" to add to phar archive, open_basedir restrictions prevent this"", fname); return; } if (!(resource = php_stream_open_wrapper(fname, ""rb"", 0, NULL))) { zend_throw_exception_ex(spl_ce_RuntimeException, 0, ""phar error: unable to open file \""%s\"" to add to phar archive"", fname); return; } if (localname) { fname = localname; fname_len = localname_len; } php_stream_to_zval(resource, &zresource); phar_add_file(&(phar_obj->archive), fname, fname_len, NULL, 0, &zresource); zval_ptr_dtor(&zresource); } ",1 "invoke_NPN_PopPopupsEnabledState(PluginInstance *plugin) { npw_return_if_fail(rpc_method_invoke_possible(g_rpc_connection)); int error = rpc_method_invoke(g_rpc_connection, RPC_METHOD_NPN_POP_POPUPS_ENABLED_STATE, RPC_TYPE_NPW_PLUGIN_INSTANCE, plugin, RPC_TYPE_INVALID); if (error != RPC_ERROR_NO_ERROR) { npw_perror(""NPN_PopPopupsEnabledState() invoke"", error); return; } error = rpc_method_wait_for_reply(g_rpc_connection, RPC_TYPE_INVALID); if (error != RPC_ERROR_NO_ERROR) npw_perror(""NPN_PopPopupsEnabledState() wait for reply"", error); } ",0 "bool HTMLLinkElement::isLoading() const { if (m_loading) return true; if (!m_sheet) return false; return static_cast(m_sheet.get())->isLoading(); } ",0 "void do_set_pte(struct vm_area_struct *vma, unsigned long address, struct page *page, pte_t *pte, bool write, bool anon) { pte_t entry; flush_icache_page(vma, page); entry = mk_pte(page, vma->vm_page_prot); if (write) entry = maybe_mkwrite(pte_mkdirty(entry), vma); if (anon) { inc_mm_counter_fast(vma->vm_mm, MM_ANONPAGES); page_add_new_anon_rmap(page, vma, address); } else { inc_mm_counter_fast(vma->vm_mm, MM_FILEPAGES); page_add_file_rmap(page); } set_pte_at(vma->vm_mm, address, pte, entry); /* no need to invalidate: a not-present page won't be cached */ update_mmu_cache(vma, address, pte); } ",0 "void Compositor::SetDisplayColorSpace(const gfx::ColorSpace& color_space, float sdr_white_level) { gfx::ColorSpace output_color_space = color_space; #if defined(OS_WIN) if (color_space.IsHDR()) { bool transparent = SkColorGetA(host_->background_color()) != SK_AlphaOPAQUE; output_color_space = transparent ? gfx::ColorSpace::CreateSCRGBLinear() : gfx::ColorSpace::CreateHDR10(); output_color_space = output_color_space.GetScaledColorSpace( gfx::ColorSpace::kDefaultSDRWhiteLevel / sdr_white_level); } #endif // OS_WIN if (output_color_space_ == output_color_space && sdr_white_level_ == sdr_white_level) { return; } output_color_space_ = output_color_space; blending_color_space_ = output_color_space_.GetBlendingColorSpace(); sdr_white_level_ = sdr_white_level; host_->SetRasterColorSpace(gfx::ColorSpace::CreateSRGB()); host_->SetNeedsDisplayOnAllLayers(); if (context_factory_private_) { context_factory_private_->SetDisplayColorSpace(this, blending_color_space_, output_color_space_); } } ",0 "msg_dup (struct msg *msg) { struct msg *new; assert (msg); new = msg_new (msg->hdr.msgtype, STREAM_DATA (msg->s), ntohl (msg->hdr.msgseq), ntohs (msg->hdr.msglen)); return new; } ",0 "static int llc_ui_send_data(struct sock* sk, struct sk_buff *skb, int noblock) { struct llc_sock* llc = llc_sk(sk); int rc = 0; if (unlikely(llc_data_accept_state(llc->state) || llc->remote_busy_flag || llc->p_flag)) { long timeout = sock_sndtimeo(sk, noblock); rc = llc_ui_wait_for_busy_core(sk, timeout); } if (unlikely(!rc)) rc = llc_build_and_send_pkt(sk, skb); return rc; } ",0 "XMLRPC_VALUE XMLRPC_ServerCallMethod(XMLRPC_SERVER server, XMLRPC_REQUEST request, void* userData) { XMLRPC_VALUE xReturn = NULL; /* check for error set during request parsing / generation */ if(request && request->error) { xReturn = XMLRPC_CopyValue(request->error); } else if (server && request) { XMLRPC_Callback cb = XMLRPC_ServerFindMethod (server, request->methodName.str); if(cb) { xReturn = cb(server, request, userData); } else { xReturn = XMLRPC_UtilityCreateFault (xmlrpc_error_unknown_method, request->methodName.str); } } return xReturn; } ",0 "static void mtrr_lookup_fixed_next(struct mtrr_iter *iter) { /* terminate the lookup. */ if (fixed_mtrr_range_end_addr(iter->seg, iter->index) >= iter->end) { iter->fixed = false; iter->range = NULL; return; } iter->index++; /* have looked up for all fixed MTRRs. */ if (iter->index >= ARRAY_SIZE(iter->mtrr_state->fixed_ranges)) return mtrr_lookup_var_start(iter); /* switch to next segment. */ if (iter->index > fixed_mtrr_seg_end_range_index(iter->seg)) iter->seg++; } ",0 "png_handle_zTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) { png_const_charp errmsg = NULL; png_bytep buffer; png_uint_32 keyword_length; png_debug(1, ""in png_handle_zTXt""); #ifdef PNG_USER_LIMITS_SUPPORTED if (png_ptr->user_chunk_cache_max != 0) { if (png_ptr->user_chunk_cache_max == 1) { png_crc_finish(png_ptr, length); return; } if (--png_ptr->user_chunk_cache_max == 1) { png_crc_finish(png_ptr, length); png_chunk_benign_error(png_ptr, ""no space in chunk cache""); return; } } #endif if ((png_ptr->mode & PNG_HAVE_IHDR) == 0) png_chunk_error(png_ptr, ""missing IHDR""); if ((png_ptr->mode & PNG_HAVE_IDAT) != 0) png_ptr->mode |= PNG_AFTER_IDAT; /* Note, ""length"" is sufficient here; we won't be adding * a null terminator later. */ buffer = png_read_buffer(png_ptr, length, 2/*silent*/); if (buffer == NULL) { png_crc_finish(png_ptr, length); png_chunk_benign_error(png_ptr, ""out of memory""); return; } png_crc_read(png_ptr, buffer, length); if (png_crc_finish(png_ptr, 0) != 0) return; /* TODO: also check that the keyword contents match the spec! */ for (keyword_length = 0; keyword_length < length && buffer[keyword_length] != 0; ++keyword_length) /* Empty loop to find end of name */ ; if (keyword_length > 79 || keyword_length < 1) errmsg = ""bad keyword""; /* zTXt must have some LZ data after the keyword, although it may expand to * zero bytes; we need a '\0' at the end of the keyword, the compression type * then the LZ data: */ else if (keyword_length + 3 > length) errmsg = ""truncated""; else if (buffer[keyword_length+1] != PNG_COMPRESSION_TYPE_BASE) errmsg = ""unknown compression type""; else { png_alloc_size_t uncompressed_length = PNG_SIZE_MAX; /* TODO: at present png_decompress_chunk imposes a single application * level memory limit, this should be split to different values for iCCP * and text chunks. */ if (png_decompress_chunk(png_ptr, length, keyword_length+2, &uncompressed_length, 1/*terminate*/) == Z_STREAM_END) { png_text text; if (png_ptr->read_buffer == NULL) errmsg=""Read failure in png_handle_zTXt""; else { /* It worked; png_ptr->read_buffer now looks like a tEXt chunk * except for the extra compression type byte and the fact that * it isn't necessarily '\0' terminated. */ buffer = png_ptr->read_buffer; buffer[uncompressed_length+(keyword_length+2)] = 0; text.compression = PNG_TEXT_COMPRESSION_zTXt; text.key = (png_charp)buffer; text.text = (png_charp)(buffer + keyword_length+2); text.text_length = uncompressed_length; text.itxt_length = 0; text.lang = NULL; text.lang_key = NULL; if (png_set_text_2(png_ptr, info_ptr, &text, 1) != 0) errmsg = ""insufficient memory""; } } else errmsg = png_ptr->zstream.msg; } if (errmsg != NULL) png_chunk_benign_error(png_ptr, errmsg); } ",0 "void QQuickWebView::dragEnterEvent(QDragEnterEvent* event) { Q_D(QQuickWebView); d->pageView->eventHandler()->handleDragEnterEvent(event); } ",0 "void UserCloudPolicyManagerFactoryChromeOS::BrowserContextDestroyed( content::BrowserContext* context) { Profile* profile = static_cast(context); managers_.erase(profile); BrowserContextKeyedBaseFactory::BrowserContextDestroyed(context); } ",0 "static void reflectedTreatNullAsNullStringTreatUndefinedAsNullStringURLAttrAttributeSetterCallback(v8::Local, v8::Local jsValue, const v8::PropertyCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMSetter""); CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; TestObjectV8Internal::reflectedTreatNullAsNullStringTreatUndefinedAsNullStringURLAttrAttributeSetter(jsValue, info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "bgp_header_print(netdissect_options *ndo, const u_char *dat, int length) { struct bgp bgp; ND_TCHECK2(dat[0], BGP_SIZE); memcpy(&bgp, dat, BGP_SIZE); ND_PRINT((ndo, ""\n\t%s Message (%u), length: %u"", tok2str(bgp_msg_values, ""Unknown"", bgp.bgp_type), bgp.bgp_type, length)); switch (bgp.bgp_type) { case BGP_OPEN: bgp_open_print(ndo, dat, length); break; case BGP_UPDATE: bgp_update_print(ndo, dat, length); break; case BGP_NOTIFICATION: bgp_notification_print(ndo, dat, length); break; case BGP_KEEPALIVE: break; case BGP_ROUTE_REFRESH: bgp_route_refresh_print(ndo, dat, length); break; default: /* we have no decoder for the BGP message */ ND_TCHECK2(*dat, length); ND_PRINT((ndo, ""\n\t no Message %u decoder"", bgp.bgp_type)); print_unknown_data(ndo, dat, ""\n\t "", length); break; } return 1; trunc: ND_PRINT((ndo, ""[|BGP]"")); return 0; } ",0 "static void voidMethodLongArgTestInterfaceEmptyArgMethodCallback(const v8::FunctionCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMMethod""); TestObjectPythonV8Internal::voidMethodLongArgTestInterfaceEmptyArgMethod(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "void InspectorResourceAgent::canClearBrowserCookies(ErrorString*, bool* result) { *result = true; } ",0 "GF_Err rtp_hnti_Write(GF_Box *s, GF_BitStream *bs) { GF_Err e; GF_RTPBox *ptr = (GF_RTPBox *)s; if (ptr == NULL) return GF_BAD_PARAM; e = gf_isom_box_write_header(s, bs); if (e) return e; gf_bs_write_u32(bs, ptr->subType); gf_bs_write_data(bs, ptr->sdpText, (u32) strlen(ptr->sdpText)); return GF_OK; } ",0 " static x86newTokenType getToken(const char *str, size_t *begin, size_t *end) { while (begin && isspace ((ut8)str[*begin])) { ++(*begin); } if (!str[*begin]) { // null byte *end = *begin; return TT_EOF; } else if (isalpha ((ut8)str[*begin])) { // word token *end = *begin; while (end && isalnum ((ut8)str[*end])) { ++(*end); } return TT_WORD; } else if (isdigit ((ut8)str[*begin])) { // number token *end = *begin; while (end && isalnum ((ut8)str[*end])) { // accept alphanumeric characters, because hex. ++(*end); } return TT_NUMBER; } else { // special character: [, ], +, *, ... *end = *begin + 1; return TT_SPECIAL; } } ",1 "static void coroutine_fn v9fs_rename(void *opaque) { int32_t fid; ssize_t err = 0; size_t offset = 7; V9fsString name; int32_t newdirfid; V9fsFidState *fidp; V9fsPDU *pdu = opaque; V9fsState *s = pdu->s; v9fs_string_init(&name); err = pdu_unmarshal(pdu, offset, ""dds"", &fid, &newdirfid, &name); if (err < 0) { goto out_nofid; } if (name_is_illegal(name.data)) { err = -ENOENT; goto out_nofid; } if (!strcmp(""."", name.data) || !strcmp("".."", name.data)) { err = -EISDIR; goto out_nofid; } fidp = get_fid(pdu, fid); if (fidp == NULL) { err = -ENOENT; goto out_nofid; } BUG_ON(fidp->fid_type != P9_FID_NONE); /* if fs driver is not path based, return EOPNOTSUPP */ if (!(pdu->s->ctx.export_flags & V9FS_PATHNAME_FSCONTEXT)) { err = -EOPNOTSUPP; goto out; } v9fs_path_write_lock(s); err = v9fs_complete_rename(pdu, fidp, newdirfid, &name); v9fs_path_unlock(s); if (!err) { err = offset; } out: put_fid(pdu, fidp); out_nofid: pdu_complete(pdu, err); v9fs_string_free(&name); } ",0 "bool OmniboxViewViews::DeleteAtEndPressed() { return delete_at_end_pressed_; } ",0 "LogData::LogData() : routing_id(0), type(0), sent(0), receive(0), dispatch(0) { } ",0 "static void asymmetric_key_destroy(struct key *key) { struct asymmetric_key_subtype *subtype = asymmetric_key_subtype(key); if (subtype) { subtype->destroy(key->payload.data); module_put(subtype->owner); key->type_data.p[0] = NULL; } kfree(key->type_data.p[1]); key->type_data.p[1] = NULL; } ",0 "static inline int resolve_named_entity_html(const char *start, size_t length, const entity_ht *ht, unsigned *uni_cp1, unsigned *uni_cp2) { const entity_cp_map *s; ulong hash = zend_inline_hash_func(start, length); s = ht->buckets[hash % ht->num_elems]; while (s->entity) { if (s->entity_len == length) { if (memcmp(start, s->entity, length) == 0) { *uni_cp1 = s->codepoint1; *uni_cp2 = s->codepoint2; return SUCCESS; } } s++; } return FAILURE; } ",0 "void mpol_rebind_task(struct task_struct *tsk, const nodemask_t *new) { mpol_rebind_policy(tsk->mempolicy, new); } ",0 "static void put_persistent_gnt(struct xen_blkif *blkif, struct persistent_gnt *persistent_gnt) { if(!test_bit(PERSISTENT_GNT_ACTIVE, persistent_gnt->flags)) pr_alert_ratelimited(DRV_PFX "" freeing a grant already unused""); set_bit(PERSISTENT_GNT_WAS_ACTIVE, persistent_gnt->flags); clear_bit(PERSISTENT_GNT_ACTIVE, persistent_gnt->flags); atomic_dec(&blkif->persistent_gnt_in_use); } ",0 "static int decode_setattr(struct xdr_stream *xdr) { __be32 *p; uint32_t bmlen; int status; status = decode_op_hdr(xdr, OP_SETATTR); if (status) return status; p = xdr_inline_decode(xdr, 4); if (unlikely(!p)) goto out_overflow; bmlen = be32_to_cpup(p); p = xdr_inline_decode(xdr, bmlen << 2); if (likely(p)) return 0; out_overflow: print_overflow_msg(__func__, xdr); return -EIO; } ",0 "bool GetNextTest(const base::CommandLine::StringVector& args, size_t* position, std::string* test) { if (*position >= args.size()) return false; if (args[*position] == FILE_PATH_LITERAL(""-"")) return !!std::getline(std::cin, *test, '\n'); #if defined(OS_WIN) *test = base::WideToUTF8(args[(*position)++]); #else *test = args[(*position)++]; #endif return true; } ",0 "std::string GetIdFromImeSpec(const std::string& ime_spec) { static const std::string kPrefix(""m17n:""); return base::StartsWith(ime_spec, kPrefix, base::CompareCase::SENSITIVE) ? ime_spec.substr(kPrefix.length()) : std::string(); } ",0 "static int __dev_queue_xmit(struct sk_buff *skb, void *accel_priv) { struct net_device *dev = skb->dev; struct netdev_queue *txq; struct Qdisc *q; int rc = -ENOMEM; skb_reset_mac_header(skb); if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_SCHED_TSTAMP)) __skb_tstamp_tx(skb, NULL, skb->sk, SCM_TSTAMP_SCHED); /* Disable soft irqs for various locks below. Also * stops preemption for RCU. */ rcu_read_lock_bh(); skb_update_prio(skb); qdisc_pkt_len_init(skb); #ifdef CONFIG_NET_CLS_ACT skb->tc_at_ingress = 0; # ifdef CONFIG_NET_EGRESS if (static_key_false(&egress_needed)) { skb = sch_handle_egress(skb, &rc, dev); if (!skb) goto out; } # endif #endif /* If device/qdisc don't need skb->dst, release it right now while * its hot in this cpu cache. */ if (dev->priv_flags & IFF_XMIT_DST_RELEASE) skb_dst_drop(skb); else skb_dst_force(skb); txq = netdev_pick_tx(dev, skb, accel_priv); q = rcu_dereference_bh(txq->qdisc); trace_net_dev_queue(skb); if (q->enqueue) { rc = __dev_xmit_skb(skb, q, dev, txq); goto out; } /* The device has no queue. Common case for software devices: * loopback, all the sorts of tunnels... * Really, it is unlikely that netif_tx_lock protection is necessary * here. (f.e. loopback and IP tunnels are clean ignoring statistics * counters.) * However, it is possible, that they rely on protection * made by us here. * Check this and shot the lock. It is not prone from deadlocks. *Either shot noqueue qdisc, it is even simpler 8) */ if (dev->flags & IFF_UP) { int cpu = smp_processor_id(); /* ok because BHs are off */ if (txq->xmit_lock_owner != cpu) { if (unlikely(__this_cpu_read(xmit_recursion) > XMIT_RECURSION_LIMIT)) goto recursion_alert; skb = validate_xmit_skb(skb, dev); if (!skb) goto out; HARD_TX_LOCK(dev, txq, cpu); if (!netif_xmit_stopped(txq)) { __this_cpu_inc(xmit_recursion); skb = dev_hard_start_xmit(skb, dev, txq, &rc); __this_cpu_dec(xmit_recursion); if (dev_xmit_complete(rc)) { HARD_TX_UNLOCK(dev, txq); goto out; } } HARD_TX_UNLOCK(dev, txq); net_crit_ratelimited(""Virtual device %s asks to queue packet!\n"", dev->name); } else { /* Recursion is detected! It is possible, * unfortunately */ recursion_alert: net_crit_ratelimited(""Dead loop on virtual device %s, fix it urgently!\n"", dev->name); } } rc = -ENETDOWN; rcu_read_unlock_bh(); atomic_long_inc(&dev->tx_dropped); kfree_skb_list(skb); return rc; out: rcu_read_unlock_bh(); return rc; } ",0 "static int check_ptr_alignment(const struct bpf_reg_state *reg, int off, int size) { switch (reg->type) { case PTR_TO_PACKET: return IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) ? 0 : check_pkt_ptr_alignment(reg, off, size); case PTR_TO_MAP_VALUE_ADJ: return IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) ? 0 : check_val_ptr_alignment(reg, size); default: if (off % size != 0) { verbose(""misaligned access off %d size %d\n"", off, size); return -EACCES; } return 0; } } ",0 " JArithmeticDecoderStats *getRefinementRegionStats() { return refinementRegionStats; } ",0 "find_blocked_lock(struct nfs4_lockowner *lo, struct knfsd_fh *fh, struct nfsd_net *nn) { struct nfsd4_blocked_lock *cur, *found = NULL; spin_lock(&nn->blocked_locks_lock); list_for_each_entry(cur, &lo->lo_blocked, nbl_list) { if (fh_match(fh, &cur->nbl_fh)) { list_del_init(&cur->nbl_list); list_del_init(&cur->nbl_lru); found = cur; break; } } spin_unlock(&nn->blocked_locks_lock); if (found) posix_unblock_lock(&found->nbl_lock); return found; } ",0 "cli_config_update(xmlNode ** xml, int *best_version, gboolean to_logs) { gboolean rc = TRUE; const char *value = crm_element_value(*xml, XML_ATTR_VALIDATION); int version = get_schema_version(value); int min_version = xml_minimum_schema_index(); if (version < min_version) { xmlNode *converted = NULL; converted = copy_xml(*xml); update_validation(&converted, &version, 0, TRUE, to_logs); value = crm_element_value(converted, XML_ATTR_VALIDATION); if (version < min_version) { if (to_logs) { crm_config_err(""Your current configuration could only be upgraded to %s... "" ""the minimum requirement is %s.\n"", crm_str(value), get_schema_name(min_version)); } else { fprintf(stderr, ""Your current configuration could only be upgraded to %s... "" ""the minimum requirement is %s.\n"", crm_str(value), get_schema_name(min_version)); } free_xml(converted); converted = NULL; rc = FALSE; } else { free_xml(*xml); *xml = converted; if (version < xml_latest_schema_index()) { crm_config_warn(""Your configuration was internally updated to %s... "" ""which is acceptable but not the most recent"", get_schema_name(version)); } else if (to_logs) { crm_info(""Your configuration was internally updated to the latest version (%s)"", get_schema_name(version)); } } } else if (version >= get_schema_version(""none"")) { if (to_logs) { crm_config_warn(""Configuration validation is currently disabled."" "" It is highly encouraged and prevents many common cluster issues.""); } else { fprintf(stderr, ""Configuration validation is currently disabled."" "" It is highly encouraged and prevents many common cluster issues.\n""); } } if (best_version) { *best_version = version; } return rc; } ",0 "WebPerformance WebLocalFrameImpl::Performance() const { if (!GetFrame()) return WebPerformance(); return WebPerformance( DOMWindowPerformance::performance(*(GetFrame()->DomWindow()))); } ",0 "void Element::cloneDataFromElement(const Element& other) { cloneAttributesFromElement(other); copyNonAttributePropertiesFromElement(other); } ",0 "void SyncManager::RefreshNigori(const std::string& chrome_version, const base::Closure& done_callback) { DCHECK(thread_checker_.CalledOnValidThread()); data_->UpdateCryptographerAndNigori( chrome_version, done_callback); } ",0 "int Reverb_process(effect_handle_t self, audio_buffer_t *inBuffer, audio_buffer_t *outBuffer){ android::ReverbContext * pContext = (android::ReverbContext *) self; int status = 0; if (pContext == NULL){ ALOGV(""\tLVM_ERROR : Reverb_process() ERROR pContext == NULL""); return -EINVAL; } if (inBuffer == NULL || inBuffer->raw == NULL || outBuffer == NULL || outBuffer->raw == NULL || inBuffer->frameCount != outBuffer->frameCount){ ALOGV(""\tLVM_ERROR : Reverb_process() ERROR NULL INPUT POINTER OR FRAME COUNT IS WRONG""); return -EINVAL; } /* Process all the available frames, block processing is handled internalLY by the LVM bundle */ status = process( (LVM_INT16 *)inBuffer->raw, (LVM_INT16 *)outBuffer->raw, outBuffer->frameCount, pContext); if (pContext->bEnabled == LVM_FALSE) { if (pContext->SamplesToExitCount > 0) { pContext->SamplesToExitCount -= outBuffer->frameCount; } else { status = -ENODATA; } } return status; } /* end Reverb_process */ ",0 "void OmniboxEditModel::SetCaretVisibility(bool visible) { if (focus_state_ != OMNIBOX_FOCUS_NONE) { SetFocusState(visible ? OMNIBOX_FOCUS_VISIBLE : OMNIBOX_FOCUS_INVISIBLE, OMNIBOX_FOCUS_CHANGE_EXPLICIT); } } ",0 "GDataEntry* GDataDirectoryService::FindEntryByPathSync( const FilePath& file_path) { if (file_path == root_->GetFilePath()) return root_.get(); std::vector components; file_path.GetComponents(&components); GDataDirectory* current_dir = root_.get(); for (size_t i = 1; i < components.size() && current_dir; ++i) { GDataEntry* entry = current_dir->FindChild(components[i]); if (!entry) return NULL; if (i == components.size() - 1) // Last component. return entry; else current_dir = entry->AsGDataDirectory(); } return NULL; } ",0 "static int efx_ioctl(struct net_device *net_dev, struct ifreq *ifr, int cmd) { struct efx_nic *efx = netdev_priv(net_dev); struct mii_ioctl_data *data = if_mii(ifr); EFX_ASSERT_RESET_SERIALISED(efx); /* Convert phy_id from older PRTAD/DEVAD format */ if ((cmd == SIOCGMIIREG || cmd == SIOCSMIIREG) && (data->phy_id & 0xfc00) == 0x0400) data->phy_id ^= MDIO_PHY_ID_C45 | 0x0400; return mdio_mii_ioctl(&efx->mdio, data, cmd); } ",0 "static int btrfs_set_inode_index_count(struct inode *inode) { struct btrfs_root *root = BTRFS_I(inode)->root; struct btrfs_key key, found_key; struct btrfs_path *path; struct extent_buffer *leaf; int ret; key.objectid = btrfs_ino(inode); key.type = BTRFS_DIR_INDEX_KEY; key.offset = (u64)-1; path = btrfs_alloc_path(); if (!path) return -ENOMEM; ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); if (ret < 0) goto out; /* FIXME: we should be able to handle this */ if (ret == 0) goto out; ret = 0; /* * MAGIC NUMBER EXPLANATION: * since we search a directory based on f_pos we have to start at 2 * since '.' and '..' have f_pos of 0 and 1 respectively, so everybody * else has to start at 2 */ if (path->slots[0] == 0) { BTRFS_I(inode)->index_cnt = 2; goto out; } path->slots[0]--; leaf = path->nodes[0]; btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); if (found_key.objectid != btrfs_ino(inode) || found_key.type != BTRFS_DIR_INDEX_KEY) { BTRFS_I(inode)->index_cnt = 2; goto out; } BTRFS_I(inode)->index_cnt = found_key.offset + 1; out: btrfs_free_path(path); return ret; } ",0 "void AXTree::ComputeSetSizePosInSetAndCache(const AXNode& node, const AXNode* ordered_set) { DCHECK(ordered_set); std::vector items; bool node_is_radio_button = (node.data().role == ax::mojom::Role::kRadioButton); PopulateOrderedSetItems(ordered_set, ordered_set, items, node_is_radio_button); int32_t num_elements = 0; int32_t largest_assigned_set_size = 0; for (size_t i = 0; i < items.size(); ++i) { const AXNode* item = items[i]; ordered_set_info_map_[item->id()] = OrderedSetInfo(); int32_t pos_in_set_value = 0; pos_in_set_value = num_elements + 1; pos_in_set_value = std::max(pos_in_set_value, item->GetIntAttribute(ax::mojom::IntAttribute::kPosInSet)); ordered_set_info_map_[item->id()].pos_in_set = pos_in_set_value; num_elements = pos_in_set_value; if (item->HasIntAttribute(ax::mojom::IntAttribute::kSetSize)) largest_assigned_set_size = std::max(largest_assigned_set_size, item->GetIntAttribute(ax::mojom::IntAttribute::kSetSize)); } int32_t ordered_set_candidate = ordered_set->GetIntAttribute(ax::mojom::IntAttribute::kSetSize); int32_t set_size_value = std::max( std::max(num_elements, largest_assigned_set_size), ordered_set_candidate); if (ordered_set_info_map_.find(ordered_set->id()) == ordered_set_info_map_.end()) ordered_set_info_map_[ordered_set->id()] = OrderedSetInfo(); if (node.SetRoleMatchesItemRole(ordered_set) || ordered_set == &node) ordered_set_info_map_[ordered_set->id()].set_size = set_size_value; for (size_t j = 0; j < items.size(); ++j) { const AXNode* item = items[j]; ordered_set_info_map_[item->id()].set_size = set_size_value; } } ",0 "static void printPEEROpcodeVersion2(const uint8_t *buf) { char ext_addr[INET6_ADDRSTRLEN]; char peer_addr[INET6_ADDRSTRLEN]; syslog(LOG_DEBUG, ""PCP PEER: v2 Opcode specific information.""); syslog(LOG_DEBUG, ""nonce: \t%08x%08x%08x"", READNU32(buf), READNU32(buf+4), READNU32(buf+8)); syslog(LOG_DEBUG, ""Protocol: \t%d"", buf[12]); syslog(LOG_DEBUG, ""Internal port:\t%d"", READNU16(buf + 16)); syslog(LOG_DEBUG, ""External IP: \t%s"", inet_ntop(AF_INET6, buf + 20, ext_addr, INET6_ADDRSTRLEN)); syslog(LOG_DEBUG, ""External port:\t%d"", READNU16(buf + 18)); syslog(LOG_DEBUG, ""PEER IP: \t%s"", inet_ntop(AF_INET6, buf + 40, peer_addr, INET6_ADDRSTRLEN)); syslog(LOG_DEBUG, ""PEER port: \t%d"", READNU16(buf + 36)); } ",0 "static void __hidp_link_session(struct hidp_session *session) { list_add(&session->list, &hidp_session_list); } ",0 "PlatformSensorConfiguration PlatformSensorAndroid::GetDefaultConfiguration() { JNIEnv* env = AttachCurrentThread(); jdouble frequency = Java_PlatformSensor_getDefaultConfiguration(env, j_object_); return PlatformSensorConfiguration(frequency); } ",0 "IDNSpoofChecker::IDNSpoofChecker() { UErrorCode status = U_ZERO_ERROR; checker_ = uspoof_open(&status); if (U_FAILURE(status)) { checker_ = nullptr; return; } uspoof_setRestrictionLevel(checker_, USPOOF_HIGHLY_RESTRICTIVE); SetAllowedUnicodeSet(&status); int32_t checks = uspoof_getChecks(checker_, &status) | USPOOF_AUX_INFO; uspoof_setChecks(checker_, checks, &status); deviation_characters_ = icu::UnicodeSet( UNICODE_STRING_SIMPLE(""[\\u00df\\u03c2\\u200c\\u200d]""), status); deviation_characters_.freeze(); non_ascii_latin_letters_ = icu::UnicodeSet(UNICODE_STRING_SIMPLE(""[[:Latin:] - [a-zA-Z]]""), status); non_ascii_latin_letters_.freeze(); kana_letters_exceptions_ = icu::UnicodeSet( UNICODE_STRING_SIMPLE(""[\\u3078-\\u307a\\u30d8-\\u30da\\u30fb-\\u30fe]""), status); kana_letters_exceptions_.freeze(); combining_diacritics_exceptions_ = icu::UnicodeSet(UNICODE_STRING_SIMPLE(""[\\u0300-\\u0339]""), status); combining_diacritics_exceptions_.freeze(); cyrillic_letters_latin_alike_ = icu::UnicodeSet( icu::UnicodeString::fromUTF8(""[асԁеһіјӏорԛѕԝхуъЬҽпгѵѡ]""), status); cyrillic_letters_latin_alike_.freeze(); cyrillic_letters_ = icu::UnicodeSet(UNICODE_STRING_SIMPLE(""[[:Cyrl:]]""), status); cyrillic_letters_.freeze(); DCHECK(U_SUCCESS(status)); lgc_letters_n_ascii_ = icu::UnicodeSet( UNICODE_STRING_SIMPLE(""[[:Latin:][:Greek:][:Cyrillic:][0-9\\u002e_"" ""\\u002d][\\u0300-\\u0339]]""), status); lgc_letters_n_ascii_.freeze(); UParseError parse_error; diacritic_remover_.reset(icu::Transliterator::createFromRules( UNICODE_STRING_SIMPLE(""DropAcc""), icu::UnicodeString::fromUTF8(""::NFD; ::[:Nonspacing Mark:] Remove; ::NFC;"" "" ł > l; ø > o; đ > d;""), UTRANS_FORWARD, parse_error, status)); extra_confusable_mapper_.reset(icu::Transliterator::createFromRules( UNICODE_STRING_SIMPLE(""ExtraConf""), icu::UnicodeString::fromUTF8( ""[æӕ] > ae; [þϼҏ] > p; [ħнћңҥӈӊԋԧԩ] > h;"" ""[ĸκкқҝҟҡӄԟ] > k; [ŋпԥก] > n; œ > ce;"" ""[ŧтҭԏ] > t; [ƅьҍв] > b; [ωшщพฟພຟ] > w;"" ""[мӎ] > m; [єҽҿၔ] > e; ґ > r; [ғӻ] > f;"" ""[ҫင] > c; ұ > y; [χҳӽӿ] > x;"" ""ԃ > d; [ԍဌ] > g; [ടรຣຮ] > s; ၂ > j;"" ""[зҙӡउওဒვპ] > 3; [บບ] > u""), UTRANS_FORWARD, parse_error, status)); DCHECK(U_SUCCESS(status)) << ""Spoofchecker initalization failed due to an error: "" << u_errorName(status); } ",1 "zipx_bzip2_init(struct archive_read *a, struct zip *zip) { int r; /* Deallocate already existing BZ2 decompression context if it * exists. */ if(zip->bzstream_valid) { BZ2_bzDecompressEnd(&zip->bzstream); zip->bzstream_valid = 0; } /* Allocate a new BZ2 decompression context. */ memset(&zip->bzstream, 0, sizeof(bz_stream)); r = BZ2_bzDecompressInit(&zip->bzstream, 0, 1); if(r != BZ_OK) { archive_set_error(&(a->archive), ARCHIVE_ERRNO_MISC, ""bzip2 initialization failed(%d)"", r); return ARCHIVE_FAILED; } /* Mark the bzstream field to be released in cleanup phase. */ zip->bzstream_valid = 1; /* (Re)allocate the buffer that will contain decompressed bytes. */ free(zip->uncompressed_buffer); zip->uncompressed_buffer_size = 256 * 1024; zip->uncompressed_buffer = (uint8_t*) malloc(zip->uncompressed_buffer_size); if (zip->uncompressed_buffer == NULL) { archive_set_error(&a->archive, ENOMEM, ""No memory for bzip2 decompression""); return ARCHIVE_FATAL; } /* Initialization done. */ zip->decompress_init = 1; return ARCHIVE_OK; } ",0 "xfs_imap_valid( struct inode *inode, struct xfs_bmbt_irec *imap, xfs_off_t offset) { offset >>= inode->i_blkbits; return offset >= imap->br_startoff && offset < imap->br_startoff + imap->br_blockcount; } ",0 "FindBar* BrowserWindowGtk::CreateFindBar() { return new FindBarGtk(this); } ",0 "static __u32 tpacket_get_timestamp(struct sk_buff *skb, struct timespec *ts, unsigned int flags) { struct skb_shared_hwtstamps *shhwtstamps = skb_hwtstamps(skb); if (shhwtstamps && (flags & SOF_TIMESTAMPING_RAW_HARDWARE) && ktime_to_timespec_cond(shhwtstamps->hwtstamp, ts)) return TP_STATUS_TS_RAW_HARDWARE; if (ktime_to_timespec_cond(skb->tstamp, ts)) return TP_STATUS_TS_SOFTWARE; return 0; } ",0 "static pngquant_error rwpng_write_image_init(rwpng_png_image *mainprog_ptr, png_structpp png_ptr_p, png_infopp info_ptr_p, int fast_compression) { /* could also replace libpng warning-handler (final NULL), but no need: */ *png_ptr_p = png_create_write_struct(PNG_LIBPNG_VER_STRING, mainprog_ptr, rwpng_error_handler, NULL); if (!(*png_ptr_p)) { return LIBPNG_INIT_ERROR; /* out of memory */ } *info_ptr_p = png_create_info_struct(*png_ptr_p); if (!(*info_ptr_p)) { png_destroy_write_struct(png_ptr_p, NULL); return LIBPNG_INIT_ERROR; /* out of memory */ } /* setjmp() must be called in every function that calls a PNG-writing * libpng function, unless an alternate error handler was installed-- * but compatible error handlers must either use longjmp() themselves * (as in this program) or exit immediately, so here we go: */ if (setjmp(mainprog_ptr->jmpbuf)) { png_destroy_write_struct(png_ptr_p, info_ptr_p); return LIBPNG_INIT_ERROR; /* libpng error (via longjmp()) */ } png_set_compression_level(*png_ptr_p, fast_compression ? Z_BEST_SPEED : Z_BEST_COMPRESSION); png_set_compression_mem_level(*png_ptr_p, fast_compression ? 9 : 5); // judging by optipng results, smaller mem makes libpng compress slightly better return SUCCESS; } ",0 "void Document::open() { DCHECK(!ImportLoader()); DCHECK(!ignore_opens_during_unload_count_); if (ScriptableDocumentParser* parser = GetScriptableDocumentParser()) DCHECK(!parser->IsParsing() || !parser->IsExecutingScript()); if (frame_ && (frame_->Loader().HasProvisionalNavigation() || frame_->GetNavigationScheduler().IsNavigationScheduledWithin(0))) { frame_->Loader().StopAllLoaders(); if (frame_ && frame_->Client()) frame_->Client()->AbortClientNavigation(); } RemoveAllEventListenersRecursively(); ResetTreeScope(); if (frame_) frame_->Selection().Clear(); ImplicitOpen(kForceSynchronousParsing); if (ScriptableDocumentParser* parser = GetScriptableDocumentParser()) parser->SetWasCreatedByScript(true); if (frame_) frame_->Loader().DidExplicitOpen(); } ",0 "static int emulator_read_write_onepage(unsigned long addr, void *val, unsigned int bytes, struct x86_exception *exception, struct kvm_vcpu *vcpu, const struct read_write_emulator_ops *ops) { gpa_t gpa; int handled, ret; bool write = ops->write; struct kvm_mmio_fragment *frag; ret = vcpu_mmio_gva_to_gpa(vcpu, addr, &gpa, exception, write); if (ret < 0) return X86EMUL_PROPAGATE_FAULT; /* For APIC access vmexit */ if (ret) goto mmio; if (ops->read_write_emulate(vcpu, gpa, val, bytes)) return X86EMUL_CONTINUE; mmio: /* * Is this MMIO handled locally? */ handled = ops->read_write_mmio(vcpu, gpa, bytes, val); if (handled == bytes) return X86EMUL_CONTINUE; gpa += handled; bytes -= handled; val += handled; WARN_ON(vcpu->mmio_nr_fragments >= KVM_MAX_MMIO_FRAGMENTS); frag = &vcpu->mmio_fragments[vcpu->mmio_nr_fragments++]; frag->gpa = gpa; frag->data = val; frag->len = bytes; return X86EMUL_CONTINUE; } ",0 "static void *gid_m_start(struct seq_file *seq, loff_t *ppos) { struct user_namespace *ns = seq->private; return m_start(seq, ppos, &ns->gid_map); } ",0 "directory_count_start (NautilusDirectory *directory, NautilusFile *file, gboolean *doing_io) { DirectoryCountState *state; GFile *location; if (directory->details->count_in_progress != NULL) { *doing_io = TRUE; return; } if (!is_needy (file, should_get_directory_count_now, REQUEST_DIRECTORY_COUNT)) { return; } *doing_io = TRUE; if (!nautilus_file_is_directory (file)) { file->details->directory_count_is_up_to_date = TRUE; file->details->directory_count_failed = FALSE; file->details->got_directory_count = FALSE; nautilus_directory_async_state_changed (directory); return; } if (!async_job_start (directory, ""directory count"")) { return; } /* Start counting. */ state = g_new0 (DirectoryCountState, 1); state->count_file = file; state->directory = nautilus_directory_ref (directory); state->cancellable = g_cancellable_new (); directory->details->count_in_progress = state; location = nautilus_file_get_location (file); #ifdef DEBUG_LOAD_DIRECTORY { char *uri; uri = g_file_get_uri (location); g_message (""load_directory called to get shallow file count for %s"", uri); g_free (uri); } #endif g_file_enumerate_children_async (location, G_FILE_ATTRIBUTE_STANDARD_NAME "","" G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN "","" G_FILE_ATTRIBUTE_STANDARD_IS_BACKUP, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, /* flags */ G_PRIORITY_DEFAULT, /* prio */ state->cancellable, count_children_callback, state); g_object_unref (location); } ",0 "error::Error GLES2DecoderImpl::HandleSwapBuffers( uint32 immediate_data_size, const gles2::SwapBuffers& c) { bool is_offscreen = !!offscreen_target_frame_buffer_.get(); int this_frame_number = frame_number_++; TRACE_EVENT_INSTANT2(""test_gpu"", ""SwapBuffers"", ""GLImpl"", static_cast(gfx::GetGLImplementation()), ""width"", (is_offscreen ? offscreen_size_.width() : surface_->GetSize().width())); TRACE_EVENT2(""gpu"", ""GLES2DecoderImpl::HandleSwapBuffers"", ""offscreen"", is_offscreen, ""frame"", this_frame_number); if (is_offscreen) { if (offscreen_size_ != offscreen_saved_color_texture_->size()) { if (needs_mac_nvidia_driver_workaround_) { offscreen_saved_frame_buffer_->Create(); glFinish(); } DCHECK(offscreen_saved_color_format_); offscreen_saved_color_texture_->AllocateStorage( offscreen_size_, offscreen_saved_color_format_); UpdateBackbufferMemoryAccounting(); offscreen_saved_frame_buffer_->AttachRenderTexture( offscreen_saved_color_texture_.get()); if (offscreen_saved_frame_buffer_->CheckStatus() != GL_FRAMEBUFFER_COMPLETE) { LOG(ERROR) << ""GLES2DecoderImpl::ResizeOffscreenFrameBuffer failed "" << ""because offscreen saved FBO was incomplete.""; return error::kLostContext; } { ScopedFrameBufferBinder binder(this, offscreen_saved_frame_buffer_->id()); glClearColor(0, 0, 0, 0); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); glDisable(GL_SCISSOR_TEST); glClear(GL_COLOR_BUFFER_BIT); RestoreClearState(); } UpdateParentTextureInfo(); } ScopedGLErrorSuppressor suppressor(this); if (IsOffscreenBufferMultisampled()) { ScopedResolvedFrameBufferBinder binder(this, true, false); return error::kNoError; } else { ScopedFrameBufferBinder binder(this, offscreen_target_frame_buffer_->id()); if (offscreen_target_buffer_preserved_) { offscreen_saved_color_texture_->Copy( offscreen_saved_color_texture_->size(), offscreen_saved_color_format_); } else { if (!!offscreen_saved_color_texture_info_.get()) offscreen_saved_color_texture_info_-> SetServiceId(offscreen_target_color_texture_->id()); offscreen_saved_color_texture_.swap(offscreen_target_color_texture_); offscreen_target_frame_buffer_->AttachRenderTexture( offscreen_target_color_texture_.get()); } if (!IsAngle()) glFlush(); return error::kNoError; } } else { TRACE_EVENT1(""gpu"", ""GLContext::SwapBuffers"", ""frame"", this_frame_number); if (!surface_->SwapBuffers()) { LOG(ERROR) << ""Context lost because SwapBuffers failed.""; return error::kLostContext; } } return error::kNoError; } ",0 "void GDataFileSystem::GetFileByEntryOnUIThread( const GetFileCallback& get_file_callback, const GetDownloadDataCallback& get_download_data_callback, GDataEntry* entry) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); FilePath file_path; if (entry) { GDataFile* file = entry->AsGDataFile(); if (file) file_path = file->GetFilePath(); } if (file_path.empty()) { if (!get_file_callback.is_null()) { base::MessageLoopProxy::current()->PostTask( FROM_HERE, base::Bind(get_file_callback, GDATA_FILE_ERROR_NOT_FOUND, FilePath(), std::string(), REGULAR_FILE)); } return; } GetFileByPath(file_path, get_file_callback, get_download_data_callback); } ",0 "floor_at_intervals(int x, int step) { int mo = x % step; if (mo > 0) x -= mo; else if (mo < 0) x += step - mo; return x; } ",0 "void DelegatedFrameHost::SwapDelegatedFrame( uint32 output_surface_id, scoped_ptr frame_data, float frame_device_scale_factor, const std::vector& latency_info) { RenderWidgetHostImpl* host = client_->GetHost(); DCHECK(!frame_data->render_pass_list.empty()); cc::RenderPass* root_pass = frame_data->render_pass_list.back(); gfx::Size frame_size = root_pass->output_rect.size(); gfx::Size frame_size_in_dip = ConvertSizeToDIP(frame_device_scale_factor, frame_size); gfx::Rect damage_rect = gfx::ToEnclosingRect(root_pass->damage_rect); damage_rect.Intersect(gfx::Rect(frame_size)); gfx::Rect damage_rect_in_dip = ConvertRectToDIP(frame_device_scale_factor, damage_rect); if (ShouldSkipFrame(frame_size_in_dip)) { cc::CompositorFrameAck ack; cc::TransferableResource::ReturnResources(frame_data->resource_list, &ack.resources); skipped_latency_info_list_.insert(skipped_latency_info_list_.end(), latency_info.begin(), latency_info.end()); RenderWidgetHostImpl::SendSwapCompositorFrameAck( host->GetRoutingID(), output_surface_id, host->GetProcess()->GetID(), ack); skipped_frames_ = true; return; } if (skipped_frames_) { skipped_frames_ = false; damage_rect = gfx::Rect(frame_size); damage_rect_in_dip = gfx::Rect(frame_size_in_dip); cc::RenderPass* root_pass = frame_data->render_pass_list.back(); root_pass->damage_rect = damage_rect; } if (output_surface_id != last_output_surface_id_) { EvictDelegatedFrame(); if (resource_collection_.get()) { resource_collection_->SetClient(NULL); if (resource_collection_->LoseAllResources()) SendReturnedDelegatedResources(last_output_surface_id_); resource_collection_ = NULL; } last_output_surface_id_ = output_surface_id; } if (frame_size.IsEmpty()) { DCHECK(frame_data->resource_list.empty()); EvictDelegatedFrame(); } else { if (use_surfaces_) { if (!surface_factory_) { ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); cc::SurfaceManager* manager = factory->GetSurfaceManager(); id_allocator_ = factory->CreateSurfaceIdAllocator(); surface_factory_ = make_scoped_ptr(new cc::SurfaceFactory(manager, this)); } if (surface_id_.is_null() || frame_size != current_surface_size_ || frame_size_in_dip != current_frame_size_in_dip_) { if (!surface_id_.is_null()) surface_factory_->Destroy(surface_id_); surface_id_ = id_allocator_->GenerateId(); surface_factory_->Create(surface_id_, frame_size); client_->GetLayer()->SetShowSurface(surface_id_, frame_size_in_dip); current_surface_size_ = frame_size; } scoped_ptr compositor_frame = make_scoped_ptr(new cc::CompositorFrame()); compositor_frame->delegated_frame_data = frame_data.Pass(); surface_factory_->SubmitFrame(surface_id_, compositor_frame.Pass()); } else { if (!resource_collection_) { resource_collection_ = new cc::DelegatedFrameResourceCollection; resource_collection_->SetClient(this); } if (!frame_provider_.get() || frame_size != frame_provider_->frame_size() || frame_size_in_dip != current_frame_size_in_dip_) { frame_provider_ = new cc::DelegatedFrameProvider( resource_collection_.get(), frame_data.Pass()); client_->GetLayer()->SetShowDelegatedContent(frame_provider_.get(), frame_size_in_dip); } else { frame_provider_->SetFrameData(frame_data.Pass()); } } } released_front_lock_ = NULL; current_frame_size_in_dip_ = frame_size_in_dip; CheckResizeLock(); client_->SchedulePaintInRect(damage_rect_in_dip); pending_delegated_ack_count_++; ui::Compositor* compositor = client_->GetCompositor(); if (!compositor) { SendDelegatedFrameAck(output_surface_id); } else { std::vector::const_iterator it; for (it = latency_info.begin(); it != latency_info.end(); ++it) compositor->SetLatencyInfo(*it); for (it = skipped_latency_info_list_.begin(); it != skipped_latency_info_list_.end(); ++it) compositor->SetLatencyInfo(*it); skipped_latency_info_list_.clear(); AddOnCommitCallbackAndDisableLocks( base::Bind(&DelegatedFrameHost::SendDelegatedFrameAck, AsWeakPtr(), output_surface_id)); } DidReceiveFrameFromRenderer(); if (frame_provider_.get() || !surface_id_.is_null()) delegated_frame_evictor_->SwappedFrame(!host->is_hidden()); } ",0 "const AtomicString& InspectorPageAgent::resourceSourceMapURL(const String& url) { DEFINE_STATIC_LOCAL(const AtomicString, sourceMapHttpHeader, (""SourceMap"", AtomicString::ConstructFromLiteral)); DEFINE_STATIC_LOCAL(const AtomicString, deprecatedSourceMapHttpHeader, (""X-SourceMap"", AtomicString::ConstructFromLiteral)); if (url.isEmpty()) return nullAtom; Frame* frame = mainFrame(); if (!frame) return nullAtom; Resource* resource = cachedResource(frame, KURL(ParsedURLString, url)); if (!resource) return nullAtom; const AtomicString& deprecatedHeaderSourceMapURL = resource->response().httpHeaderField(deprecatedSourceMapHttpHeader); if (!deprecatedHeaderSourceMapURL.isEmpty()) { return deprecatedHeaderSourceMapURL; } return resource->response().httpHeaderField(sourceMapHttpHeader); } ",0 "check_auth (const struct url *u, char *user, char *passwd, struct response *resp, struct request *req, bool *ntlm_seen_ref, bool *retry, bool *basic_auth_finished_ref, bool *auth_finished_ref) { uerr_t auth_err = RETROK; bool basic_auth_finished = *basic_auth_finished_ref; bool auth_finished = *auth_finished_ref; bool ntlm_seen = *ntlm_seen_ref; *retry = false; if (!auth_finished && (user && passwd)) { /* IIS sends multiple copies of WWW-Authenticate, one with the value ""negotiate"", and other(s) with data. Loop over all the occurrences and pick the one we recognize. */ int wapos; char *buf; const char *www_authenticate = NULL; const char *wabeg, *waend; const char *digest = NULL, *basic = NULL, *ntlm = NULL; for (wapos = 0; !ntlm && (wapos = resp_header_locate (resp, ""WWW-Authenticate"", wapos, &wabeg, &waend)) != -1; ++wapos) { param_token name, value; BOUNDED_TO_ALLOCA (wabeg, waend, buf); www_authenticate = buf; for (;!ntlm;) { /* extract the auth-scheme */ while (c_isspace (*www_authenticate)) www_authenticate++; name.e = name.b = www_authenticate; while (*name.e && !c_isspace (*name.e)) name.e++; if (name.b == name.e) break; DEBUGP ((""Auth scheme found '%.*s'\n"", (int) (name.e - name.b), name.b)); if (known_authentication_scheme_p (name.b, name.e)) { if (BEGINS_WITH (name.b, ""NTLM"")) { ntlm = name.b; break; /* this is the most secure challenge, stop here */ } else if (!digest && BEGINS_WITH (name.b, ""Digest"")) digest = name.b; else if (!basic && BEGINS_WITH (name.b, ""Basic"")) basic = name.b; } /* now advance over the auth-params */ www_authenticate = name.e; DEBUGP ((""Auth param list '%s'\n"", www_authenticate)); while (extract_param (&www_authenticate, &name, &value, ',', NULL) && name.b && value.b) { DEBUGP ((""Auth param %.*s=%.*s\n"", (int) (name.e - name.b), name.b, (int) (value.e - value.b), value.b)); } } } if (!basic && !digest && !ntlm) { /* If the authentication header is missing or unrecognized, there's no sense in retrying. */ logputs (LOG_NOTQUIET, _(""Unknown authentication scheme.\n"")); } else if (!basic_auth_finished || !basic) { char *pth = url_full_path (u); const char *value; uerr_t *auth_stat; auth_stat = xmalloc (sizeof (uerr_t)); *auth_stat = RETROK; if (ntlm) www_authenticate = ntlm; else if (digest) www_authenticate = digest; else www_authenticate = basic; logprintf (LOG_NOTQUIET, _(""Authentication selected: %s\n""), www_authenticate); value = create_authorization_line (www_authenticate, user, passwd, request_method (req), pth, &auth_finished, auth_stat); auth_err = *auth_stat; if (auth_err == RETROK) { request_set_header (req, ""Authorization"", value, rel_value); if (BEGINS_WITH (www_authenticate, ""NTLM"")) ntlm_seen = true; else if (!u->user && BEGINS_WITH (www_authenticate, ""Basic"")) { /* Need to register this host as using basic auth, * so we automatically send creds next time. */ register_basic_auth_host (u->host); } xfree (pth); xfree (auth_stat); *retry = true; goto cleanup; } else { /* Creating the Authorization header went wrong */ } } else { /* We already did Basic auth, and it failed. Gotta * give up. */ } } cleanup: *ntlm_seen_ref = ntlm_seen; *basic_auth_finished_ref = basic_auth_finished; *auth_finished_ref = auth_finished; return auth_err; } ",0 "void RedirectNotificationObserver::Observe( int type, const NotificationSource& source, const NotificationDetails& details) { source_ = source; details_ = details; seen_twice_ = seen_; seen_ = true; if (!running_) return; message_loop_runner_->Quit(); running_ = false; } ",0 "static MagickBooleanType WriteJPEGImage(const ImageInfo *image_info, Image *image) { const char *option, *sampling_factor, *value; ErrorManager error_manager; ExceptionInfo *exception; Image *volatile volatile_image; int colorspace, quality; JSAMPLE *volatile jpeg_pixels; JSAMPROW scanline[1]; MagickBooleanType status; MemoryInfo *memory_info; register JSAMPLE *q; register ssize_t i; ssize_t y; struct jpeg_compress_struct jpeg_info; struct jpeg_error_mgr jpeg_error; unsigned short scale; /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickSignature); assert(image != (Image *) NULL); assert(image->signature == MagickSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"",image->filename); exception=(&image->exception); if ((LocaleCompare(image_info->magick,""JPS"") == 0) && (image->next != (Image *) NULL)) image=AppendImages(image,MagickFalse,exception); status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception); if (status == MagickFalse) return(status); /* Initialize JPEG parameters. */ (void) ResetMagickMemory(&error_manager,0,sizeof(error_manager)); (void) ResetMagickMemory(&jpeg_info,0,sizeof(jpeg_info)); (void) ResetMagickMemory(&jpeg_error,0,sizeof(jpeg_error)); volatile_image=image; jpeg_info.client_data=(void *) volatile_image; jpeg_info.err=jpeg_std_error(&jpeg_error); jpeg_info.err->emit_message=(void (*)(j_common_ptr,int)) JPEGWarningHandler; jpeg_info.err->error_exit=(void (*)(j_common_ptr)) JPEGErrorHandler; error_manager.image=volatile_image; memory_info=(MemoryInfo *) NULL; if (setjmp(error_manager.error_recovery) != 0) { jpeg_destroy_compress(&jpeg_info); (void) CloseBlob(volatile_image); return(MagickFalse); } jpeg_info.client_data=(void *) &error_manager; jpeg_create_compress(&jpeg_info); JPEGDestinationManager(&jpeg_info,image); if ((image->columns != (unsigned int) image->columns) || (image->rows != (unsigned int) image->rows)) ThrowWriterException(ImageError,""WidthOrHeightExceedsLimit""); jpeg_info.image_width=(unsigned int) image->columns; jpeg_info.image_height=(unsigned int) image->rows; jpeg_info.input_components=3; jpeg_info.data_precision=8; jpeg_info.in_color_space=JCS_RGB; switch (image->colorspace) { case CMYKColorspace: { jpeg_info.input_components=4; jpeg_info.in_color_space=JCS_CMYK; break; } case YCbCrColorspace: case Rec601YCbCrColorspace: case Rec709YCbCrColorspace: { jpeg_info.in_color_space=JCS_YCbCr; break; } case GRAYColorspace: case Rec601LumaColorspace: case Rec709LumaColorspace: { if (image_info->type == TrueColorType) break; jpeg_info.input_components=1; jpeg_info.in_color_space=JCS_GRAYSCALE; break; } default: { (void) TransformImageColorspace(image,sRGBColorspace); if (image_info->type == TrueColorType) break; if (SetImageGray(image,&image->exception) != MagickFalse) { jpeg_info.input_components=1; jpeg_info.in_color_space=JCS_GRAYSCALE; } break; } } jpeg_set_defaults(&jpeg_info); if (jpeg_info.in_color_space == JCS_CMYK) jpeg_set_colorspace(&jpeg_info,JCS_YCCK); if ((jpeg_info.data_precision != 12) && (image->depth <= 8)) jpeg_info.data_precision=8; else jpeg_info.data_precision=BITS_IN_JSAMPLE; if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Image resolution: %.20g,%.20g"",image->x_resolution,image->y_resolution); if ((image->x_resolution != 0.0) && (image->y_resolution != 0.0)) { /* Set image resolution. */ jpeg_info.write_JFIF_header=TRUE; jpeg_info.X_density=(UINT16) image->x_resolution; jpeg_info.Y_density=(UINT16) image->y_resolution; /* Set image resolution units. */ if (image->units == PixelsPerInchResolution) jpeg_info.density_unit=(UINT8) 1; if (image->units == PixelsPerCentimeterResolution) jpeg_info.density_unit=(UINT8) 2; } jpeg_info.dct_method=JDCT_FLOAT; option=GetImageOption(image_info,""jpeg:dct-method""); if (option != (const char *) NULL) switch (*option) { case 'D': case 'd': { if (LocaleCompare(option,""default"") == 0) jpeg_info.dct_method=JDCT_DEFAULT; break; } case 'F': case 'f': { if (LocaleCompare(option,""fastest"") == 0) jpeg_info.dct_method=JDCT_FASTEST; if (LocaleCompare(option,""float"") == 0) jpeg_info.dct_method=JDCT_FLOAT; break; } case 'I': case 'i': { if (LocaleCompare(option,""ifast"") == 0) jpeg_info.dct_method=JDCT_IFAST; if (LocaleCompare(option,""islow"") == 0) jpeg_info.dct_method=JDCT_ISLOW; break; } } option=GetImageOption(image_info,""jpeg:optimize-coding""); if (option != (const char *) NULL) jpeg_info.optimize_coding=IsStringTrue(option) != MagickFalse ? TRUE : FALSE; else { MagickSizeType length; length=(MagickSizeType) jpeg_info.input_components*image->columns* image->rows*sizeof(JSAMPLE); if (length == (MagickSizeType) ((size_t) length)) { /* Perform optimization only if available memory resources permit it. */ status=AcquireMagickResource(MemoryResource,length); RelinquishMagickResource(MemoryResource,length); jpeg_info.optimize_coding=status == MagickFalse ? FALSE : TRUE; } } #if (JPEG_LIB_VERSION >= 61) && defined(C_PROGRESSIVE_SUPPORTED) if ((LocaleCompare(image_info->magick,""PJPEG"") == 0) || (image_info->interlace != NoInterlace)) { if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Interlace: progressive""); jpeg_simple_progression(&jpeg_info); } else if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Interlace: non-progressive""); #else if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Interlace: nonprogressive""); #endif quality=92; if ((image_info->compression != LosslessJPEGCompression) && (image->quality <= 100)) { if (image->quality != UndefinedCompressionQuality) quality=(int) image->quality; if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(),""Quality: %.20g"", (double) image->quality); } else { #if !defined(C_LOSSLESS_SUPPORTED) quality=100; if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(),""Quality: 100""); #else if (image->quality < 100) (void) ThrowMagickException(&image->exception,GetMagickModule(), CoderWarning,""LosslessToLossyJPEGConversion"",""`%s'"",image->filename); else { int point_transform, predictor; predictor=image->quality/100; /* range 1-7 */ point_transform=image->quality % 20; /* range 0-15 */ jpeg_simple_lossless(&jpeg_info,predictor,point_transform); if (image->debug != MagickFalse) { (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Compression: lossless""); (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Predictor: %d"",predictor); (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Point Transform: %d"",point_transform); } } #endif } option=GetImageOption(image_info,""jpeg:extent""); if (option != (const char *) NULL) { Image *jpeg_image; ImageInfo *jpeg_info; jpeg_info=CloneImageInfo(image_info); jpeg_info->blob=NULL; jpeg_image=CloneImage(image,0,0,MagickTrue,&image->exception); if (jpeg_image != (Image *) NULL) { MagickSizeType extent; size_t maximum, minimum; /* Search for compression quality that does not exceed image extent. */ jpeg_image->quality=0; extent=(MagickSizeType) SiPrefixToDoubleInterval(option,100.0); (void) DeleteImageOption(jpeg_info,""jpeg:extent""); (void) DeleteImageArtifact(jpeg_image,""jpeg:extent""); maximum=image_info->quality; if (maximum < 2) maximum=101; for (minimum=2; minimum < maximum; ) { (void) AcquireUniqueFilename(jpeg_image->filename); jpeg_image->quality=minimum+(maximum-minimum+1)/2; (void) WriteJPEGImage(jpeg_info,jpeg_image); if (GetBlobSize(jpeg_image) <= extent) minimum=jpeg_image->quality+1; else maximum=jpeg_image->quality-1; (void) RelinquishUniqueFileResource(jpeg_image->filename); } quality=(int) minimum-1; jpeg_image=DestroyImage(jpeg_image); } jpeg_info=DestroyImageInfo(jpeg_info); } jpeg_set_quality(&jpeg_info,quality,TRUE); #if (JPEG_LIB_VERSION >= 70) option=GetImageOption(image_info,""quality""); if (option != (const char *) NULL) { GeometryInfo geometry_info; int flags; /* Set quality scaling for luminance and chrominance separately. */ flags=ParseGeometry(option,&geometry_info); if (((flags & RhoValue) != 0) && ((flags & SigmaValue) != 0)) { jpeg_info.q_scale_factor[0]=jpeg_quality_scaling((int) (geometry_info.rho+0.5)); jpeg_info.q_scale_factor[1]=jpeg_quality_scaling((int) (geometry_info.sigma+0.5)); jpeg_default_qtables(&jpeg_info,TRUE); } } #endif colorspace=jpeg_info.in_color_space; value=GetImageOption(image_info,""jpeg:colorspace""); if (value == (char *) NULL) value=GetImageProperty(image,""jpeg:colorspace""); if (value != (char *) NULL) colorspace=StringToInteger(value); sampling_factor=(const char *) NULL; if (colorspace == jpeg_info.in_color_space) { value=GetImageOption(image_info,""jpeg:sampling-factor""); if (value == (char *) NULL) value=GetImageProperty(image,""jpeg:sampling-factor""); if (value != (char *) NULL) { sampling_factor=value; if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Input sampling-factors=%s"",sampling_factor); } } if (image_info->sampling_factor != (char *) NULL) sampling_factor=image_info->sampling_factor; if (sampling_factor == (const char *) NULL) { if (quality >= 90) for (i=0; i < MAX_COMPONENTS; i++) { jpeg_info.comp_info[i].h_samp_factor=1; jpeg_info.comp_info[i].v_samp_factor=1; } } else { char **factors; GeometryInfo geometry_info; MagickStatusType flags; /* Set sampling factor. */ i=0; factors=SamplingFactorToList(sampling_factor); if (factors != (char **) NULL) { for (i=0; i < MAX_COMPONENTS; i++) { if (factors[i] == (char *) NULL) break; flags=ParseGeometry(factors[i],&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=geometry_info.rho; jpeg_info.comp_info[i].h_samp_factor=(int) geometry_info.rho; jpeg_info.comp_info[i].v_samp_factor=(int) geometry_info.sigma; factors[i]=(char *) RelinquishMagickMemory(factors[i]); } factors=(char **) RelinquishMagickMemory(factors); } for ( ; i < MAX_COMPONENTS; i++) { jpeg_info.comp_info[i].h_samp_factor=1; jpeg_info.comp_info[i].v_samp_factor=1; } } option=GetImageOption(image_info,""jpeg:q-table""); if (option != (const char *) NULL) { QuantizationTable *table; /* Custom quantization tables. */ table=GetQuantizationTable(option,""0"",&image->exception); if (table != (QuantizationTable *) NULL) { for (i=0; i < MAX_COMPONENTS; i++) jpeg_info.comp_info[i].quant_tbl_no=0; jpeg_add_quant_table(&jpeg_info,0,table->levels, jpeg_quality_scaling(quality),0); table=DestroyQuantizationTable(table); } table=GetQuantizationTable(option,""1"",&image->exception); if (table != (QuantizationTable *) NULL) { for (i=1; i < MAX_COMPONENTS; i++) jpeg_info.comp_info[i].quant_tbl_no=1; jpeg_add_quant_table(&jpeg_info,1,table->levels, jpeg_quality_scaling(quality),0); table=DestroyQuantizationTable(table); } table=GetQuantizationTable(option,""2"",&image->exception); if (table != (QuantizationTable *) NULL) { for (i=2; i < MAX_COMPONENTS; i++) jpeg_info.comp_info[i].quant_tbl_no=2; jpeg_add_quant_table(&jpeg_info,2,table->levels, jpeg_quality_scaling(quality),0); table=DestroyQuantizationTable(table); } table=GetQuantizationTable(option,""3"",&image->exception); if (table != (QuantizationTable *) NULL) { for (i=3; i < MAX_COMPONENTS; i++) jpeg_info.comp_info[i].quant_tbl_no=3; jpeg_add_quant_table(&jpeg_info,3,table->levels, jpeg_quality_scaling(quality),0); table=DestroyQuantizationTable(table); } } jpeg_start_compress(&jpeg_info,TRUE); if (image->debug != MagickFalse) { if (image->storage_class == PseudoClass) (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Storage class: PseudoClass""); else (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Storage class: DirectClass""); (void) LogMagickEvent(CoderEvent,GetMagickModule(),""Depth: %.20g"", (double) image->depth); if (image->colors != 0) (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Number of colors: %.20g"",(double) image->colors); else (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Number of colors: unspecified""); (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""JPEG data precision: %d"",(int) jpeg_info.data_precision); switch (image->colorspace) { case CMYKColorspace: { (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Storage class: DirectClass""); (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Colorspace: CMYK""); break; } case YCbCrColorspace: case Rec601YCbCrColorspace: case Rec709YCbCrColorspace: { (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Colorspace: YCbCr""); break; } default: break; } switch (image->colorspace) { case CMYKColorspace: { (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Colorspace: CMYK""); (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Sampling factors: %dx%d,%dx%d,%dx%d,%dx%d"", jpeg_info.comp_info[0].h_samp_factor, jpeg_info.comp_info[0].v_samp_factor, jpeg_info.comp_info[1].h_samp_factor, jpeg_info.comp_info[1].v_samp_factor, jpeg_info.comp_info[2].h_samp_factor, jpeg_info.comp_info[2].v_samp_factor, jpeg_info.comp_info[3].h_samp_factor, jpeg_info.comp_info[3].v_samp_factor); break; } case GRAYColorspace: case Rec601LumaColorspace: case Rec709LumaColorspace: { (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Colorspace: GRAY""); (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Sampling factors: %dx%d"",jpeg_info.comp_info[0].h_samp_factor, jpeg_info.comp_info[0].v_samp_factor); break; } case sRGBColorspace: case RGBColorspace: { (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Image colorspace is RGB""); (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Sampling factors: %dx%d,%dx%d,%dx%d"", jpeg_info.comp_info[0].h_samp_factor, jpeg_info.comp_info[0].v_samp_factor, jpeg_info.comp_info[1].h_samp_factor, jpeg_info.comp_info[1].v_samp_factor, jpeg_info.comp_info[2].h_samp_factor, jpeg_info.comp_info[2].v_samp_factor); break; } case YCbCrColorspace: case Rec601YCbCrColorspace: case Rec709YCbCrColorspace: { (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Colorspace: YCbCr""); (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Sampling factors: %dx%d,%dx%d,%dx%d"", jpeg_info.comp_info[0].h_samp_factor, jpeg_info.comp_info[0].v_samp_factor, jpeg_info.comp_info[1].h_samp_factor, jpeg_info.comp_info[1].v_samp_factor, jpeg_info.comp_info[2].h_samp_factor, jpeg_info.comp_info[2].v_samp_factor); break; } default: { (void) LogMagickEvent(CoderEvent,GetMagickModule(),""Colorspace: %d"", image->colorspace); (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Sampling factors: %dx%d,%dx%d,%dx%d,%dx%d"", jpeg_info.comp_info[0].h_samp_factor, jpeg_info.comp_info[0].v_samp_factor, jpeg_info.comp_info[1].h_samp_factor, jpeg_info.comp_info[1].v_samp_factor, jpeg_info.comp_info[2].h_samp_factor, jpeg_info.comp_info[2].v_samp_factor, jpeg_info.comp_info[3].h_samp_factor, jpeg_info.comp_info[3].v_samp_factor); break; } } } /* Write JPEG profiles. */ value=GetImageProperty(image,""comment""); if (value != (char *) NULL) for (i=0; i < (ssize_t) strlen(value); i+=65533L) jpeg_write_marker(&jpeg_info,JPEG_COM,(unsigned char *) value+i, (unsigned int) MagickMin((size_t) strlen(value+i),65533L)); if (image->profiles != (void *) NULL) WriteProfile(&jpeg_info,image); /* Convert MIFF to JPEG raster pixels. */ memory_info=AcquireVirtualMemory((size_t) image->columns, jpeg_info.input_components*sizeof(*jpeg_pixels)); if (memory_info == (MemoryInfo *) NULL) ThrowWriterException(ResourceLimitError,""MemoryAllocationFailed""); jpeg_pixels=(JSAMPLE *) GetVirtualMemoryBlob(memory_info); if (setjmp(error_manager.error_recovery) != 0) { jpeg_destroy_compress(&jpeg_info); if (memory_info != (MemoryInfo *) NULL) memory_info=RelinquishVirtualMemory(memory_info); (void) CloseBlob(image); return(MagickFalse); } scanline[0]=(JSAMPROW) jpeg_pixels; scale=65535/(unsigned short) GetQuantumRange((size_t) jpeg_info.data_precision); if (scale == 0) scale=1; if (jpeg_info.data_precision <= 8) { if ((jpeg_info.in_color_space == JCS_RGB) || (jpeg_info.in_color_space == JCS_YCbCr)) for (y=0; y < (ssize_t) image->rows; y++) { register const PixelPacket *p; register ssize_t x; p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception); if (p == (const PixelPacket *) NULL) break; q=jpeg_pixels; for (x=0; x < (ssize_t) image->columns; x++) { *q++=(JSAMPLE) ScaleQuantumToChar(GetPixelRed(p)); *q++=(JSAMPLE) ScaleQuantumToChar(GetPixelGreen(p)); *q++=(JSAMPLE) ScaleQuantumToChar(GetPixelBlue(p)); p++; } (void) jpeg_write_scanlines(&jpeg_info,scanline,1); status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } else if (jpeg_info.in_color_space == JCS_GRAYSCALE) for (y=0; y < (ssize_t) image->rows; y++) { register const PixelPacket *p; register ssize_t x; p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception); if (p == (const PixelPacket *) NULL) break; q=jpeg_pixels; for (x=0; x < (ssize_t) image->columns; x++) { *q++=(JSAMPLE) ScaleQuantumToChar(ClampToQuantum( GetPixelLuma(image,p))); p++; } (void) jpeg_write_scanlines(&jpeg_info,scanline,1); status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } else for (y=0; y < (ssize_t) image->rows; y++) { register const IndexPacket *indexes; register const PixelPacket *p; register ssize_t x; p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception); if (p == (const PixelPacket *) NULL) break; q=jpeg_pixels; indexes=GetVirtualIndexQueue(image); for (x=0; x < (ssize_t) image->columns; x++) { /* Convert DirectClass packets to contiguous CMYK scanlines. */ *q++=(JSAMPLE) (ScaleQuantumToChar((Quantum) (QuantumRange- GetPixelCyan(p)))); *q++=(JSAMPLE) (ScaleQuantumToChar((Quantum) (QuantumRange- GetPixelMagenta(p)))); *q++=(JSAMPLE) (ScaleQuantumToChar((Quantum) (QuantumRange- GetPixelYellow(p)))); *q++=(JSAMPLE) (ScaleQuantumToChar((Quantum) (QuantumRange- GetPixelBlack(indexes+x)))); p++; } (void) jpeg_write_scanlines(&jpeg_info,scanline,1); status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } } else if (jpeg_info.in_color_space == JCS_GRAYSCALE) for (y=0; y < (ssize_t) image->rows; y++) { register const PixelPacket *p; register ssize_t x; p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception); if (p == (const PixelPacket *) NULL) break; q=jpeg_pixels; for (x=0; x < (ssize_t) image->columns; x++) { *q++=(JSAMPLE) (ScaleQuantumToShort(ClampToQuantum( GetPixelLuma(image,p)))/scale); p++; } (void) jpeg_write_scanlines(&jpeg_info,scanline,1); status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } else if ((jpeg_info.in_color_space == JCS_RGB) || (jpeg_info.in_color_space == JCS_YCbCr)) for (y=0; y < (ssize_t) image->rows; y++) { register const PixelPacket *p; register ssize_t x; p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception); if (p == (const PixelPacket *) NULL) break; q=jpeg_pixels; for (x=0; x < (ssize_t) image->columns; x++) { *q++=(JSAMPLE) (ScaleQuantumToShort(GetPixelRed(p))/scale); *q++=(JSAMPLE) (ScaleQuantumToShort(GetPixelGreen(p))/scale); *q++=(JSAMPLE) (ScaleQuantumToShort(GetPixelBlue(p))/scale); p++; } (void) jpeg_write_scanlines(&jpeg_info,scanline,1); status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } else for (y=0; y < (ssize_t) image->rows; y++) { register const IndexPacket *indexes; register const PixelPacket *p; register ssize_t x; p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception); if (p == (const PixelPacket *) NULL) break; q=jpeg_pixels; indexes=GetVirtualIndexQueue(image); for (x=0; x < (ssize_t) image->columns; x++) { /* Convert DirectClass packets to contiguous CMYK scanlines. */ *q++=(JSAMPLE) (ScaleQuantumToShort(QuantumRange-GetPixelRed(p))/ scale); *q++=(JSAMPLE) (ScaleQuantumToShort(QuantumRange-GetPixelGreen(p))/ scale); *q++=(JSAMPLE) (ScaleQuantumToShort(QuantumRange-GetPixelBlue(p))/ scale); *q++=(JSAMPLE) (ScaleQuantumToShort(QuantumRange- GetPixelIndex(indexes+x))/scale); p++; } (void) jpeg_write_scanlines(&jpeg_info,scanline,1); status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } if (y == (ssize_t) image->rows) jpeg_finish_compress(&jpeg_info); /* Relinquish resources. */ jpeg_destroy_compress(&jpeg_info); memory_info=RelinquishVirtualMemory(memory_info); (void) CloseBlob(image); return(MagickTrue); } ",0 "void virtio_gpu_object_free_sg_table(struct virtio_gpu_object *bo) { sg_free_table(bo->pages); kfree(bo->pages); bo->pages = NULL; } ",0 "void DelegatedFrameHost::UnlockResources() { DCHECK(frame_provider_ || !surface_id_.is_null()); delegated_frame_evictor_->UnlockFrame(); } ",0 "static void ext4_sb_release(struct kobject *kobj) { struct ext4_sb_info *sbi = container_of(kobj, struct ext4_sb_info, s_kobj); complete(&sbi->s_kobj_unregister); } ",0 "void WebContentsImpl::NotifyMainFrameSwappedFromRenderManager( RenderViewHost* old_host, RenderViewHost* new_host) { NotifyViewSwapped(old_host, new_host); } ",0 "X509_VERIFY_PARAM_clear_flags(X509_VERIFY_PARAM *param, unsigned long flags) { param->flags &= ~flags; return 1; } ",0 "static void VoidMethodBooleanOrElementSequenceArgMethod(const v8::FunctionCallbackInfo& info) { ExceptionState exception_state(info.GetIsolate(), ExceptionState::kExecutionContext, ""TestObject"", ""voidMethodBooleanOrElementSequenceArg""); TestObject* impl = V8TestObject::ToImpl(info.Holder()); if (UNLIKELY(info.Length() < 1)) { exception_state.ThrowTypeError(ExceptionMessages::NotEnoughArguments(1, info.Length())); return; } BooleanOrElementSequence arg; V8BooleanOrElementSequence::ToImpl(info.GetIsolate(), info[0], arg, UnionTypeConversionMode::kNotNullable, exception_state); if (exception_state.HadException()) return; impl->voidMethodBooleanOrElementSequenceArg(arg); } ",0 "static apr_status_t h2_session_shutdown(h2_session *session, int error, const char *msg, int force_close) { apr_status_t status = APR_SUCCESS; ap_assert(session); if (session->local.shutdown) { return APR_SUCCESS; } if (!msg && error) { msg = nghttp2_strerror(error); } if (error || force_close) { /* not a graceful shutdown, we want to leave... * Do not start further streams that are waiting to be scheduled. * Find out the max stream id that we habe been processed or * are still actively working on. * Remove all streams greater than this number without submitting * a RST_STREAM frame, since that should be clear from the GOAWAY * we send. */ session->local.accepted_max = h2_mplx_shutdown(session->mplx); session->local.error = error; } else { /* graceful shutdown. we will continue processing all streams * we have, but no longer accept new ones. Report the max stream * we have received and discard all new ones. */ } nghttp2_submit_goaway(session->ngh2, NGHTTP2_FLAG_NONE, session->local.accepted_max, error, (uint8_t*)msg, msg? strlen(msg):0); session->local.accepting = 0; session->local.shutdown = 1; status = nghttp2_session_send(session->ngh2); if (status == APR_SUCCESS) { status = h2_conn_io_flush(&session->io); } ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, APLOGNO(03069) ""session(%ld): sent GOAWAY, err=%d, msg=%s"", session->id, error, msg? msg : """"); dispatch_event(session, H2_SESSION_EV_LOCAL_GOAWAY, error, msg); if (force_close) { apr_brigade_cleanup(session->bbtmp); h2_mplx_abort(session->mplx); } return status; } ",0 " OVS_EXCLUDED(ofproto_mutex) { struct ofproto *ofproto = ofconn_get_ofproto(ofconn); struct ofgroup *group; struct ovs_list replies; ofpmp_init(&replies, request); /* Must exclude modifications to guarantee iterating groups. */ ovs_mutex_lock(&ofproto_mutex); if (group_id == OFPG_ALL) { CMAP_FOR_EACH (group, cmap_node, &ofproto->groups) { if (versions_visible_in_version(&group->versions, OVS_VERSION_MAX)) { cb(group, &replies); } } } else { group = ofproto_group_lookup__(ofproto, group_id, OVS_VERSION_MAX); if (group) { cb(group, &replies); } } ovs_mutex_unlock(&ofproto_mutex); ofconn_send_replies(ofconn, &replies); } ",0 "static int __init tcm_loop_fabric_init(void) { int ret; tcm_loop_cmd_cache = kmem_cache_create(""tcm_loop_cmd_cache"", sizeof(struct tcm_loop_cmd), __alignof__(struct tcm_loop_cmd), 0, NULL); if (!tcm_loop_cmd_cache) { printk(KERN_ERR ""kmem_cache_create() for"" "" tcm_loop_cmd_cache failed\n""); return -ENOMEM; } ret = tcm_loop_alloc_core_bus(); if (ret) return ret; ret = tcm_loop_register_configfs(); if (ret) { tcm_loop_release_core_bus(); return ret; } return 0; } ",0 "static int tg3_phy_write_and_check_testpat(struct tg3 *tp, int *resetp) { static const u32 test_pat[4][6] = { { 0x00005555, 0x00000005, 0x00002aaa, 0x0000000a, 0x00003456, 0x00000003 }, { 0x00002aaa, 0x0000000a, 0x00003333, 0x00000003, 0x0000789a, 0x00000005 }, { 0x00005a5a, 0x00000005, 0x00002a6a, 0x0000000a, 0x00001bcd, 0x00000003 }, { 0x00002a5a, 0x0000000a, 0x000033c3, 0x00000003, 0x00002ef1, 0x00000005 } }; int chan; for (chan = 0; chan < 4; chan++) { int i; tg3_writephy(tp, MII_TG3_DSP_ADDRESS, (chan * 0x2000) | 0x0200); tg3_writephy(tp, MII_TG3_DSP_CONTROL, 0x0002); for (i = 0; i < 6; i++) tg3_writephy(tp, MII_TG3_DSP_RW_PORT, test_pat[chan][i]); tg3_writephy(tp, MII_TG3_DSP_CONTROL, 0x0202); if (tg3_wait_macro_done(tp)) { *resetp = 1; return -EBUSY; } tg3_writephy(tp, MII_TG3_DSP_ADDRESS, (chan * 0x2000) | 0x0200); tg3_writephy(tp, MII_TG3_DSP_CONTROL, 0x0082); if (tg3_wait_macro_done(tp)) { *resetp = 1; return -EBUSY; } tg3_writephy(tp, MII_TG3_DSP_CONTROL, 0x0802); if (tg3_wait_macro_done(tp)) { *resetp = 1; return -EBUSY; } for (i = 0; i < 6; i += 2) { u32 low, high; if (tg3_readphy(tp, MII_TG3_DSP_RW_PORT, &low) || tg3_readphy(tp, MII_TG3_DSP_RW_PORT, &high) || tg3_wait_macro_done(tp)) { *resetp = 1; return -EBUSY; } low &= 0x7fff; high &= 0x000f; if (low != test_pat[chan][i] || high != test_pat[chan][i+1]) { tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x000b); tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x4001); tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x4005); return -EBUSY; } } } return 0; } ",0 "key_ref_t key_create_or_update(key_ref_t keyring_ref, const char *type, const char *description, const void *payload, size_t plen, key_perm_t perm, unsigned long flags) { struct keyring_index_key index_key = { .description = description, }; struct key_preparsed_payload prep; struct assoc_array_edit *edit; const struct cred *cred = current_cred(); struct key *keyring, *key = NULL; key_ref_t key_ref; int ret; /* look up the key type to see if it's one of the registered kernel * types */ index_key.type = key_type_lookup(type); if (IS_ERR(index_key.type)) { key_ref = ERR_PTR(-ENODEV); goto error; } key_ref = ERR_PTR(-EINVAL); if (!index_key.type->match || !index_key.type->instantiate || (!index_key.description && !index_key.type->preparse)) goto error_put_type; keyring = key_ref_to_ptr(keyring_ref); key_check(keyring); key_ref = ERR_PTR(-ENOTDIR); if (keyring->type != &key_type_keyring) goto error_put_type; memset(&prep, 0, sizeof(prep)); prep.data = payload; prep.datalen = plen; prep.quotalen = index_key.type->def_datalen; prep.trusted = flags & KEY_ALLOC_TRUSTED; prep.expiry = TIME_T_MAX; if (index_key.type->preparse) { ret = index_key.type->preparse(&prep); if (ret < 0) { key_ref = ERR_PTR(ret); goto error_free_prep; } if (!index_key.description) index_key.description = prep.description; key_ref = ERR_PTR(-EINVAL); if (!index_key.description) goto error_free_prep; } index_key.desc_len = strlen(index_key.description); key_ref = ERR_PTR(-EPERM); if (!prep.trusted && test_bit(KEY_FLAG_TRUSTED_ONLY, &keyring->flags)) goto error_free_prep; flags |= prep.trusted ? KEY_ALLOC_TRUSTED : 0; ret = __key_link_begin(keyring, &index_key, &edit); if (ret < 0) { key_ref = ERR_PTR(ret); goto error_free_prep; } /* if we're going to allocate a new key, we're going to have * to modify the keyring */ ret = key_permission(keyring_ref, KEY_NEED_WRITE); if (ret < 0) { key_ref = ERR_PTR(ret); goto error_link_end; } /* if it's possible to update this type of key, search for an existing * key of the same type and description in the destination keyring and * update that instead if possible */ if (index_key.type->update) { key_ref = find_key_to_update(keyring_ref, &index_key); if (key_ref) goto found_matching_key; } /* if the client doesn't provide, decide on the permissions we want */ if (perm == KEY_PERM_UNDEF) { perm = KEY_POS_VIEW | KEY_POS_SEARCH | KEY_POS_LINK | KEY_POS_SETATTR; perm |= KEY_USR_VIEW; if (index_key.type->read) perm |= KEY_POS_READ; if (index_key.type == &key_type_keyring || index_key.type->update) perm |= KEY_POS_WRITE; } /* allocate a new key */ key = key_alloc(index_key.type, index_key.description, cred->fsuid, cred->fsgid, cred, perm, flags); if (IS_ERR(key)) { key_ref = ERR_CAST(key); goto error_link_end; } /* instantiate it and link it into the target keyring */ ret = __key_instantiate_and_link(key, &prep, keyring, NULL, &edit); if (ret < 0) { key_put(key); key_ref = ERR_PTR(ret); goto error_link_end; } key_ref = make_key_ref(key, is_key_possessed(keyring_ref)); error_link_end: __key_link_end(keyring, &index_key, edit); error_free_prep: if (index_key.type->preparse) index_key.type->free_preparse(&prep); error_put_type: key_type_put(index_key.type); error: return key_ref; found_matching_key: /* we found a matching key, so we're going to try to update it * - we can drop the locks first as we have the key pinned */ __key_link_end(keyring, &index_key, edit); key_ref = __key_update(key_ref, &prep); goto error_free_prep; } ",1 "static void webkitWebViewBaseChildAllocate(GtkWidget* child, gpointer userData) { if (!gtk_widget_get_visible(child)) return; WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(userData); WebKitWebViewBasePrivate* priv = webViewBase->priv; const IntRect& geometry = priv->children.get(child); if (geometry.isEmpty()) return; GtkAllocation childAllocation = geometry; gtk_widget_size_allocate(child, &childAllocation); priv->children.set(child, IntRect()); } ",0 "uint32_t smb2cli_conn_cc_max_chunks(struct smbXcli_conn *conn) { return conn->smb2.cc_max_chunks; } ",0 "GooString *LZWStream::getPSFilter(int psLevel, const char *indent) { GooString *s; if (psLevel < 2 || pred) { return NULL; } if (!(s = str->getPSFilter(psLevel, indent))) { return NULL; } s->append(indent)->append(""<< ""); if (!early) { s->append(""/EarlyChange 0 ""); } s->append("">> /LZWDecode filter\n""); return s; } ",0 "static bool access_pmuserenr(struct kvm_vcpu *vcpu, struct sys_reg_params *p, const struct sys_reg_desc *r) { if (!kvm_arm_pmu_v3_ready(vcpu)) return trap_raz_wi(vcpu, p, r); if (p->is_write) { if (!vcpu_mode_priv(vcpu)) return false; vcpu_sys_reg(vcpu, PMUSERENR_EL0) = p->regval & ARMV8_PMU_USERENR_MASK; } else { p->regval = vcpu_sys_reg(vcpu, PMUSERENR_EL0) & ARMV8_PMU_USERENR_MASK; } return true; } ",0 "set_gc_signal(i_ctx_t *i_ctx_p, int value) { gs_memory_gc_status_t stat; int i; for (i = 0; i < countof(idmemory->spaces_indexed); i++) { gs_ref_memory_t *mem = idmemory->spaces_indexed[i]; gs_ref_memory_t *mem_stable; if (mem == 0) continue; for (;; mem = mem_stable) { mem_stable = (gs_ref_memory_t *) gs_memory_stable((gs_memory_t *)mem); gs_memory_gc_status(mem, &stat); stat.signal_value = value; gs_memory_set_gc_status(mem, &stat); if (mem_stable == mem) break; } } } ",0 " static uint32_t GetKeyForEntryImpl(Isolate* isolate, Handle dictionary, int entry, PropertyFilter filter) { DisallowHeapAllocation no_gc; Object* raw_key = dictionary->KeyAt(entry); if (!dictionary->IsKey(isolate, raw_key)) return kMaxUInt32; return FilterKey(dictionary, entry, raw_key, filter); } ",0 "static struct mm_struct * mm_init(struct mm_struct * mm, struct task_struct *p) { atomic_set(&mm->mm_users, 1); atomic_set(&mm->mm_count, 1); init_rwsem(&mm->mmap_sem); INIT_LIST_HEAD(&mm->mmlist); mm->flags = (current->mm) ? (current->mm->flags & MMF_INIT_MASK) : default_dump_filter; mm->core_state = NULL; mm->nr_ptes = 0; memset(&mm->rss_stat, 0, sizeof(mm->rss_stat)); spin_lock_init(&mm->page_table_lock); mm->free_area_cache = TASK_UNMAPPED_BASE; mm->cached_hole_size = ~0UL; mm_init_aio(mm); mm_init_owner(mm, p); atomic_set(&mm->oom_disable_count, 0); if (likely(!mm_alloc_pgd(mm))) { mm->def_flags = 0; mmu_notifier_mm_init(mm); return mm; } free_mm(mm); return NULL; } ",0 "static void DoubleOrStringOrNullAttributeAttributeGetter(const v8::FunctionCallbackInfo& info) { v8::Local holder = info.Holder(); TestObject* impl = V8TestObject::ToImpl(holder); DoubleOrString result; impl->doubleOrStringOrNullAttribute(result); V8SetReturnValue(info, result); } ",0 "void Document::processHttpEquivXFrameOptions(const AtomicString& content) { if (!m_frame) return; unsigned long requestIdentifier = loader()->mainResourceIdentifier(); if (m_frame->loader().shouldInterruptLoadForXFrameOptions(content, url(), requestIdentifier)) { String message = ""Refused to display '"" + url().elidedString() + ""' in a frame because it set 'X-Frame-Options' to '"" + content + ""'.""; m_frame->loader().stopAllLoaders(); if (!m_frame) return; m_frame->navigate(*this, SecurityOrigin::urlWithUniqueSecurityOrigin(), true, UserGestureStatus::None); RefPtrWillBeRawPtr consoleMessage = ConsoleMessage::create(SecurityMessageSource, ErrorMessageLevel, message); consoleMessage->setRequestIdentifier(requestIdentifier); addConsoleMessage(consoleMessage.release()); } } ",0 "ReadUserLogFileState::convertState( ReadUserLog::FileState &state, ReadUserLogFileState::FileState *&internal ) { ReadUserLogFileState::FileStatePub *pub; convertState(state, pub); internal = &(pub->internal); return true; } ",0 " void OnLoginFailure(const chromeos::LoginFailure& error) { LOG(ERROR) << ""Login Failure: "" << error.GetErrorString(); delete this; } ",0 "void vga_common_init(VGACommonState *s, Object *obj, bool global_vmstate) { int i, j, v, b; for(i = 0;i < 256; i++) { v = 0; for(j = 0; j < 8; j++) { v |= ((i >> j) & 1) << (j * 4); } expand4[i] = v; v = 0; for(j = 0; j < 4; j++) { v |= ((i >> (2 * j)) & 3) << (j * 4); } expand2[i] = v; } for(i = 0; i < 16; i++) { v = 0; for(j = 0; j < 4; j++) { b = ((i >> j) & 1); v |= b << (2 * j); v |= b << (2 * j + 1); } expand4to8[i] = v; } s->vram_size_mb = uint_clamp(s->vram_size_mb, 1, 512); s->vram_size_mb = pow2ceil(s->vram_size_mb); s->vram_size = s->vram_size_mb << 20; if (!s->vbe_size) { s->vbe_size = s->vram_size; } s->is_vbe_vmstate = 1; memory_region_init_ram(&s->vram, obj, ""vga.vram"", s->vram_size, &error_fatal); vmstate_register_ram(&s->vram, global_vmstate ? NULL : DEVICE(obj)); xen_register_framebuffer(&s->vram); s->vram_ptr = memory_region_get_ram_ptr(&s->vram); s->get_bpp = vga_get_bpp; s->get_offsets = vga_get_offsets; s->get_resolution = vga_get_resolution; s->hw_ops = &vga_ops; switch (vga_retrace_method) { case VGA_RETRACE_DUMB: s->retrace = vga_dumb_retrace; s->update_retrace_info = vga_dumb_update_retrace_info; break; case VGA_RETRACE_PRECISE: s->retrace = vga_precise_retrace; s->update_retrace_info = vga_precise_update_retrace_info; break; } /* * Set default fb endian based on target, could probably be turned * into a device attribute set by the machine/platform to remove * all target endian dependencies from this file. */ #ifdef TARGET_WORDS_BIGENDIAN s->default_endian_fb = true; #else s->default_endian_fb = false; #endif vga_dirty_log_start(s); } ",0 "zisofs_rewind_boot_file(struct archive_write *a) { struct iso9660 *iso9660 = a->format_data; struct isofile *file; unsigned char *rbuff; ssize_t r; size_t remaining, rbuff_size; struct zisofs_extract zext; int64_t read_offset, write_offset, new_offset; int fd, ret = ARCHIVE_OK; file = iso9660->el_torito.boot->file; /* * There is nothing to do if this boot file does not have * zisofs header. */ if (file->zisofs.header_size == 0) return (ARCHIVE_OK); /* * Uncompress the zisofs'ed file contents. */ memset(&zext, 0, sizeof(zext)); zext.pz_uncompressed_size = file->zisofs.uncompressed_size; zext.pz_log2_bs = file->zisofs.log2_bs; fd = iso9660->temp_fd; new_offset = wb_offset(a); read_offset = file->content.offset_of_temp; remaining = (size_t)file->content.size; if (remaining > 1024 * 32) rbuff_size = 1024 * 32; else rbuff_size = remaining; rbuff = malloc(rbuff_size); if (rbuff == NULL) { archive_set_error(&a->archive, ENOMEM, ""Can't allocate memory""); return (ARCHIVE_FATAL); } while (remaining) { size_t rsize; ssize_t rs; /* Get the current file pointer. */ write_offset = lseek(fd, 0, SEEK_CUR); /* Change the file pointer to read. */ lseek(fd, read_offset, SEEK_SET); rsize = rbuff_size; if (rsize > remaining) rsize = remaining; rs = read(iso9660->temp_fd, rbuff, rsize); if (rs <= 0) { archive_set_error(&a->archive, errno, ""Can't read temporary file(%jd)"", (intmax_t)rs); ret = ARCHIVE_FATAL; break; } remaining -= rs; read_offset += rs; /* Put the file pointer back to write. */ lseek(fd, write_offset, SEEK_SET); r = zisofs_extract(a, &zext, rbuff, rs); if (r < 0) { ret = (int)r; break; } } if (ret == ARCHIVE_OK) { /* * Change the boot file content from zisofs'ed data * to plain data. */ file->content.offset_of_temp = new_offset; file->content.size = file->zisofs.uncompressed_size; archive_entry_set_size(file->entry, file->content.size); /* Set to be no zisofs. */ file->zisofs.header_size = 0; file->zisofs.log2_bs = 0; file->zisofs.uncompressed_size = 0; r = wb_write_padding_to_temp(a, file->content.size); if (r < 0) ret = ARCHIVE_FATAL; } /* * Free the resource we used in this function only. */ free(rbuff); free(zext.block_pointers); if (zext.stream_valid && inflateEnd(&(zext.stream)) != Z_OK) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, ""Failed to clean up compressor""); ret = ARCHIVE_FATAL; } return (ret); } ",0 "void RenderFrameHostImpl::PendingDeletionCheckCompleted() { if (unload_state_ == UnloadState::Completed && children_.empty()) { if (is_waiting_for_swapout_ack_) OnSwappedOut(); else parent_->RemoveChild(frame_tree_node_); } } ",0 "int main (int argc, char **argv) { int result; struct sockaddr_in si_me; struct sockaddr_in si_me_mndp; struct timeval timeout; struct mt_packet pdata; struct net_interface *interface; fd_set read_fds; int c,optval = 1; int print_help = 0; int foreground = 0; int interface_count = 0; setlocale(LC_ALL, """"); bindtextdomain(""mactelnet"",""/usr/share/locale""); textdomain(""mactelnet""); while ((c = getopt(argc, argv, ""fnvh?"")) != -1) { switch (c) { case 'f': foreground = 1; break; case 'n': use_raw_socket = 1; break; case 'v': print_version(); exit(0); break; case 'h': case '?': print_help = 1; break; } } if (print_help) { print_version(); fprintf(stderr, _(""Usage: %s [-f|-n|-h]\n""), argv[0]); if (print_help) { fprintf(stderr, _(""\nParameters:\n"" "" -f Run process in foreground.\n"" "" -n Do not use broadcast packets. Just a tad less insecure.\n"" "" -h This help.\n"" ""\n"")); } return 1; } if (geteuid() != 0) { fprintf(stderr, _(""You need to have root privileges to use %s.\n""), argv[0]); return 1; } /* Try to read user file */ read_userfile(); /* Seed randomizer */ srand(time(NULL)); if (use_raw_socket) { /* Transmit raw packets with this socket */ sockfd = net_init_raw_socket(); } /* Receive regular udp packets with this socket */ insockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); if (insockfd < 0) { perror(""insockfd""); return 1; } /* Set source port */ sourceport = MT_MACTELNET_PORT; /* Listen address*/ inet_pton(AF_INET, (char *)""0.0.0.0"", &sourceip); /* Set up global info about the connection */ inet_pton(AF_INET, (char *)""255.255.255.255"", &destip); /* Initialize receiving socket on the device chosen */ memset((char *) &si_me, 0, sizeof(si_me)); si_me.sin_family = AF_INET; si_me.sin_port = htons(sourceport); memcpy(&(si_me.sin_addr), &sourceip, IPV4_ALEN); setsockopt(insockfd, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof (optval)); /* Bind to udp port */ if (bind(insockfd, (struct sockaddr *)&si_me, sizeof(si_me))==-1) { fprintf(stderr, _(""Error binding to %s:%d, %s\n""), inet_ntoa(si_me.sin_addr), sourceport, strerror(errno)); return 1; } /* TODO: Move socket initialization out of main() */ /* Receive mndp udp packets with this socket */ mndpsockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); if (mndpsockfd < 0) { perror(""mndpsockfd""); return 1; } memset((char *)&si_me_mndp, 0, sizeof(si_me_mndp)); si_me_mndp.sin_family = AF_INET; si_me_mndp.sin_port = htons(MT_MNDP_PORT); memcpy(&(si_me_mndp.sin_addr), &sourceip, IPV4_ALEN); setsockopt(mndpsockfd, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof (optval)); /* Bind to udp port */ if (bind(mndpsockfd, (struct sockaddr *)&si_me_mndp, sizeof(si_me_mndp))==-1) { fprintf(stderr, _(""MNDP: Error binding to %s:%d, %s\n""), inet_ntoa(si_me_mndp.sin_addr), MT_MNDP_PORT, strerror(errno)); } openlog(""mactelnetd"", LOG_PID, LOG_DAEMON); syslog(LOG_NOTICE, _(""Bound to %s:%d""), inet_ntoa(si_me.sin_addr), sourceport); /* Enumerate available interfaces */ net_get_interfaces(&interfaces); setup_sockets(); if (!foreground) { daemon(0, 0); } /* Handle zombies etc */ signal(SIGCHLD,SIG_IGN); signal(SIGTSTP,SIG_IGN); signal(SIGTTOU,SIG_IGN); signal(SIGTTIN,SIG_IGN); signal(SIGHUP, sighup_handler); signal(SIGTERM, sigterm_handler); DL_FOREACH(interfaces, interface) { if (interface->has_mac) { interface_count++; } } if (interface_count == 0) { syslog(LOG_ERR, _(""Unable to find any valid network interfaces\n"")); exit(1); } while (1) { int reads; struct mt_connection *p; int maxfd=0; time_t now; /* Init select */ FD_ZERO(&read_fds); FD_SET(insockfd, &read_fds); FD_SET(mndpsockfd, &read_fds); maxfd = insockfd > mndpsockfd ? insockfd : mndpsockfd; /* Add active connections to select queue */ DL_FOREACH(connections_head, p) { if (p->state == STATE_ACTIVE && p->wait_for_ack == 0 && p->ptsfd > 0) { FD_SET(p->ptsfd, &read_fds); if (p->ptsfd > maxfd) { maxfd = p->ptsfd; } } } timeout.tv_sec = 1; timeout.tv_usec = 0; /* Wait for data or timeout */ reads = select(maxfd+1, &read_fds, NULL, NULL, &timeout); if (reads > 0) { /* Handle data from clients TODO: Enable broadcast support (without raw sockets) */ if (FD_ISSET(insockfd, &read_fds)) { unsigned char buff[MT_PACKET_LEN]; struct sockaddr_in saddress; unsigned int slen = sizeof(saddress); bzero(buff, MT_HEADER_LEN); result = recvfrom(insockfd, buff, sizeof(buff), 0, (struct sockaddr *)&saddress, &slen); handle_packet(buff, result, &saddress); } if (FD_ISSET(mndpsockfd, &read_fds)) { unsigned char buff[MT_PACKET_LEN]; struct sockaddr_in saddress; unsigned int slen = sizeof(saddress); result = recvfrom(mndpsockfd, buff, sizeof(buff), 0, (struct sockaddr *)&saddress, &slen); /* Handle MNDP broadcast request, max 1 rps */ if (result == 4 && time(NULL) - last_mndp_time > 0) { mndp_broadcast(); time(&last_mndp_time); } } /* Handle data from terminal sessions */ DL_FOREACH(connections_head, p) { /* Check if we have data ready in the pty buffer for the active session */ if (p->state == STATE_ACTIVE && p->ptsfd > 0 && p->wait_for_ack == 0 && FD_ISSET(p->ptsfd, &read_fds)) { unsigned char keydata[1024]; int datalen,plen; /* Read it */ datalen = read(p->ptsfd, &keydata, sizeof(keydata)); if (datalen > 0) { /* Send it */ init_packet(&pdata, MT_PTYPE_DATA, p->dstmac, p->srcmac, p->seskey, p->outcounter); plen = add_control_packet(&pdata, MT_CPTYPE_PLAINDATA, &keydata, datalen); p->outcounter += plen; p->wait_for_ack = 1; result = send_udp(p, &pdata); } else { /* Shell exited */ struct mt_connection tmp; init_packet(&pdata, MT_PTYPE_END, p->dstmac, p->srcmac, p->seskey, p->outcounter); send_udp(p, &pdata); if (p->username != NULL) { syslog(LOG_INFO, _(""(%d) Connection to user %s closed.""), p->seskey, p->username); } else { syslog(LOG_INFO, _(""(%d) Connection closed.""), p->seskey); } tmp.next = p->next; list_remove_connection(p); p = &tmp; } } else if (p->state == STATE_ACTIVE && p->ptsfd > 0 && p->wait_for_ack == 1 && FD_ISSET(p->ptsfd, &read_fds)) { printf(_(""(%d) Waiting for ack\n""), p->seskey); } } /* Handle select() timeout */ } time(&now); if (now - last_mndp_time > MT_MNDP_BROADCAST_INTERVAL) { pings = 0; mndp_broadcast(); last_mndp_time = now; } if (connections_head != NULL) { struct mt_connection *p,tmp; DL_FOREACH(connections_head, p) { if (now - p->lastdata >= MT_CONNECTION_TIMEOUT) { syslog(LOG_INFO, _(""(%d) Session timed out""), p->seskey); init_packet(&pdata, MT_PTYPE_DATA, p->dstmac, p->srcmac, p->seskey, p->outcounter); /*_ Please include both \r and \n in translation, this is needed for the terminal emulator. */ add_control_packet(&pdata, MT_CPTYPE_PLAINDATA, _(""Timeout\r\n""), 9); send_udp(p, &pdata); init_packet(&pdata, MT_PTYPE_END, p->dstmac, p->srcmac, p->seskey, p->outcounter); send_udp(p, &pdata); tmp.next = p->next; list_remove_connection(p); p = &tmp; } } } } /* Never reached */ return 0; } ",0 "static int check_boco2(void) { int ret; u8 id; ret = i2c_read(BOCO_ADDR, ID_REG, 1, &id, 1); if (ret) { printf(""%s: error reading the BOCO id !!\n"", __func__); return ret; } return (id == BOCO2_ID); } ",0 "person_ignored_by(const person_t* person, const person_t* other) { int i; if (other->ignore_all_persons || person->ignore_all_persons) return true; for (i = 0; i < other->num_ignores; ++i) if (strcmp(other->ignores[i], person->name) == 0) return true; for (i = 0; i < person->num_ignores; ++i) if (strcmp(person->ignores[i], other->name) == 0) return true; return false; } ",0 "bool RenderView::CaptureThumbnail(WebView* view, int w, int h, SkBitmap* thumbnail, ThumbnailScore* score) { base::TimeTicks beginning_time = base::TimeTicks::Now(); skia::PlatformCanvas canvas; if (!PaintViewIntoCanvas(view, canvas)) return false; skia::BitmapPlatformDevice& device = static_cast(canvas.getTopPlatformDevice()); const SkBitmap& src_bmp = device.accessBitmap(false); SkRect dest_rect = { 0, 0, SkIntToScalar(w), SkIntToScalar(h) }; float dest_aspect = dest_rect.width() / dest_rect.height(); SkIRect src_rect; if (src_bmp.width() < dest_rect.width() || src_bmp.height() < dest_rect.height()) { src_rect.set(0, 0, static_cast(dest_rect.width()), static_cast(dest_rect.height())); score->good_clipping = false; } else { float src_aspect = static_cast(src_bmp.width()) / src_bmp.height(); if (src_aspect > dest_aspect) { S16CPU new_width = static_cast(src_bmp.height() * dest_aspect); S16CPU x_offset = (src_bmp.width() - new_width) / 2; src_rect.set(x_offset, 0, new_width + x_offset, src_bmp.height()); score->good_clipping = false; } else { src_rect.set(0, 0, src_bmp.width(), static_cast(src_bmp.width() / dest_aspect)); score->good_clipping = true; } } score->at_top = (view->mainFrame()->scrollOffset().height == 0); SkBitmap subset; device.accessBitmap(false).extractSubset(&subset, src_rect); *thumbnail = skia::ImageOperations::Resize( subset, skia::ImageOperations::RESIZE_LANCZOS3, w, h); score->boring_score = CalculateBoringScore(thumbnail); HISTOGRAM_TIMES(""Renderer4.Thumbnail"", base::TimeTicks::Now() - beginning_time); return true; } ",0 "static inline void cpu_time_add(const clockid_t which_clock, union cpu_time_count *acc, union cpu_time_count val) { if (CPUCLOCK_WHICH(which_clock) == CPUCLOCK_SCHED) { acc->sched += val.sched; } else { acc->cpu = cputime_add(acc->cpu, val.cpu); } } ",0 "void CheckArrayAbuse(Handle obj, const char* op, uint32_t index, bool allow_appending) { DisallowHeapAllocation no_allocation; Object* raw_length = NULL; const char* elements_type = ""array""; if (obj->IsJSArray()) { JSArray* array = JSArray::cast(*obj); raw_length = array->length(); } else { raw_length = Smi::FromInt(obj->elements()->length()); elements_type = ""object""; } if (raw_length->IsNumber()) { double n = raw_length->Number(); if (FastI2D(FastD2UI(n)) == n) { int32_t int32_length = DoubleToInt32(n); uint32_t compare_length = static_cast(int32_length); if (allow_appending) compare_length++; if (index >= compare_length) { PrintF(""[OOB %s %s (%s length = %d, element accessed = %d) in "", elements_type, op, elements_type, static_cast(int32_length), static_cast(index)); TraceTopFrame(obj->GetIsolate()); PrintF(""]\n""); } } else { PrintF(""[%s elements length not integer value in "", elements_type); TraceTopFrame(obj->GetIsolate()); PrintF(""]\n""); } } else { PrintF(""[%s elements length not a number in "", elements_type); TraceTopFrame(obj->GetIsolate()); PrintF(""]\n""); } } ",0 "bool GLES2DecoderImpl::DoIsSampler(GLuint client_id) { const Sampler* sampler = GetSampler(client_id); return sampler && !sampler->IsDeleted(); } ",0 " parse_cmdline( int* argc, char*** argv ) { char* execname; int option; execname = ft_basename( (*argv)[0] ); while ( 1 ) { option = getopt( *argc, *argv, ""e:m:r:"" ); if ( option == -1 ) break; switch ( option ) { case 'e': status.encoding = FTDemo_Make_Encoding_Tag( optarg ); break; case 'r': status.res = atoi( optarg ); if ( status.res < 1 ) usage( execname ); break; case 'm': if ( *argc < 3 ) usage( execname ); Text = optarg; break; default: usage( execname ); break; } } *argc -= optind; *argv += optind; if ( *argc <= 1 ) usage( execname ); status.ptsize = (int)(atof( *argv[0] ) * 64.0); if ( status.ptsize == 0 ) status.ptsize = 64; (*argc)--; (*argv)++; } ",0 "PHP_FUNCTION(dom_document_save_html_file) { zval *id; xmlDoc *docp; int file_len, bytes, format; dom_object *intern; dom_doc_propsptr doc_props; char *file; const char *encoding; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), ""Os"", &id, dom_document_class_entry, &file, &file_len) == FAILURE) { return; } if (file_len == 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Invalid Filename""); RETURN_FALSE; } DOM_GET_OBJ(docp, id, xmlDocPtr, intern); encoding = (const char *) htmlGetMetaEncoding(docp); doc_props = dom_get_doc_props(intern->document); format = doc_props->formatoutput; bytes = htmlSaveFileFormat(file, docp, encoding, format); if (bytes == -1) { RETURN_FALSE; } RETURN_LONG(bytes); } ",0 "void Document::InitSecurityContext(const DocumentInit& initializer) { DCHECK(!GetSecurityOrigin()); if (!initializer.HasSecurityContext()) { cookie_url_ = KURL(g_empty_string); SetSecurityOrigin(SecurityOrigin::CreateUnique()); InitContentSecurityPolicy(); SetFeaturePolicy(g_empty_string); return; } SandboxFlags sandbox_flags = initializer.GetSandboxFlags(); if (fetcher_->Archive()) { sandbox_flags |= kSandboxAll & ~(kSandboxPopups | kSandboxPropagatesToAuxiliaryBrowsingContexts); } EnforceSandboxFlags(sandbox_flags); SetInsecureRequestPolicy(initializer.GetInsecureRequestPolicy()); if (initializer.InsecureNavigationsToUpgrade()) { for (auto to_upgrade : *initializer.InsecureNavigationsToUpgrade()) AddInsecureNavigationUpgrade(to_upgrade); } ContentSecurityPolicy* policy_to_inherit = nullptr; if (IsSandboxed(kSandboxOrigin)) { cookie_url_ = url_; SetSecurityOrigin(SecurityOrigin::CreateUnique()); Document* owner = initializer.OwnerDocument(); if (owner) { if (owner->GetSecurityOrigin()->IsPotentiallyTrustworthy()) GetSecurityOrigin()->SetUniqueOriginIsPotentiallyTrustworthy(true); if (owner->GetSecurityOrigin()->CanLoadLocalResources()) GetSecurityOrigin()->GrantLoadLocalResources(); policy_to_inherit = owner->GetContentSecurityPolicy(); } } else if (Document* owner = initializer.OwnerDocument()) { cookie_url_ = owner->CookieURL(); SetSecurityOrigin(owner->GetSecurityOrigin()); policy_to_inherit = owner->GetContentSecurityPolicy(); } else { cookie_url_ = url_; SetSecurityOrigin(SecurityOrigin::Create(url_)); } if (initializer.IsHostedInReservedIPRange()) { SetAddressSpace(GetSecurityOrigin()->IsLocalhost() ? kWebAddressSpaceLocal : kWebAddressSpacePrivate); } else if (GetSecurityOrigin()->IsLocal()) { SetAddressSpace(kWebAddressSpaceLocal); } else { SetAddressSpace(kWebAddressSpacePublic); } if (ImportsController()) { SetContentSecurityPolicy( ImportsController()->Master()->GetContentSecurityPolicy()); } else { InitContentSecurityPolicy(nullptr, policy_to_inherit); } if (GetSecurityOrigin()->HasSuborigin()) EnforceSuborigin(*GetSecurityOrigin()->GetSuborigin()); if (Settings* settings = initializer.GetSettings()) { if (!settings->GetWebSecurityEnabled()) { GetSecurityOrigin()->GrantUniversalAccess(); } else if (GetSecurityOrigin()->IsLocal()) { if (settings->GetAllowUniversalAccessFromFileURLs()) { GetSecurityOrigin()->GrantUniversalAccess(); } else if (!settings->GetAllowFileAccessFromFileURLs()) { GetSecurityOrigin()->BlockLocalAccessFromLocalOrigin(); } } } if (GetSecurityOrigin()->IsUnique() && SecurityOrigin::Create(url_)->IsPotentiallyTrustworthy()) GetSecurityOrigin()->SetUniqueOriginIsPotentiallyTrustworthy(true); if (GetSecurityOrigin()->HasSuborigin()) EnforceSuborigin(*GetSecurityOrigin()->GetSuborigin()); SetFeaturePolicy(g_empty_string); } ",0 "static int check_stack_write(struct bpf_verifier_env *env, struct bpf_verifier_state *state, int off, int size, int value_regno) { int i, slot = -off - 1, spi = slot / BPF_REG_SIZE, err; err = realloc_verifier_state(state, round_up(slot + 1, BPF_REG_SIZE), true); if (err) return err; /* caller checked that off % size == 0 and -MAX_BPF_STACK <= off < 0, * so it's aligned access and [off, off + size) are within stack limits */ if (!env->allow_ptr_leaks && state->stack[spi].slot_type[0] == STACK_SPILL && size != BPF_REG_SIZE) { verbose(env, ""attempt to corrupt spilled pointer on stack\n""); return -EACCES; } if (value_regno >= 0 && is_spillable_regtype(state->regs[value_regno].type)) { /* register containing pointer is being spilled into stack */ if (size != BPF_REG_SIZE) { verbose(env, ""invalid size of register spill\n""); return -EACCES; } /* save register state */ state->stack[spi].spilled_ptr = state->regs[value_regno]; state->stack[spi].spilled_ptr.live |= REG_LIVE_WRITTEN; for (i = 0; i < BPF_REG_SIZE; i++) state->stack[spi].slot_type[i] = STACK_SPILL; } else { /* regular write of data into stack */ state->stack[spi].spilled_ptr = (struct bpf_reg_state) {}; for (i = 0; i < size; i++) state->stack[spi].slot_type[(slot - i) % BPF_REG_SIZE] = STACK_MISC; } return 0; } ",0 "uint8_t rfc_parse_data(tRFC_MCB* p_mcb, MX_FRAME* p_frame, BT_HDR* p_buf) { uint8_t ead, eal, fcs; uint8_t* p_data = (uint8_t*)(p_buf + 1) + p_buf->offset; uint8_t* p_start = p_data; uint16_t len; if (p_buf->len < RFCOMM_CTRL_FRAME_LEN) { RFCOMM_TRACE_ERROR(""Bad Length1: %d"", p_buf->len); return (RFC_EVENT_BAD_FRAME); } RFCOMM_PARSE_CTRL_FIELD(ead, p_frame->cr, p_frame->dlci, p_data); if (!ead) { RFCOMM_TRACE_ERROR(""Bad Address(EA must be 1)""); return (RFC_EVENT_BAD_FRAME); } RFCOMM_PARSE_TYPE_FIELD(p_frame->type, p_frame->pf, p_data); eal = *(p_data)&RFCOMM_EA; len = *(p_data)++ >> RFCOMM_SHIFT_LENGTH1; if (eal == 0 && p_buf->len < RFCOMM_CTRL_FRAME_LEN) { len += (*(p_data)++ << RFCOMM_SHIFT_LENGTH2); } else if (eal == 0) { RFCOMM_TRACE_ERROR(""Bad Length when EAL = 0: %d"", p_buf->len); android_errorWriteLog(0x534e4554, ""78288018""); return RFC_EVENT_BAD_FRAME; } p_buf->len -= (3 + !ead + !eal + 1); /* Additional 1 for FCS */ p_buf->offset += (3 + !ead + !eal); /* handle credit if credit based flow control */ if ((p_mcb->flow == PORT_FC_CREDIT) && (p_frame->type == RFCOMM_UIH) && (p_frame->dlci != RFCOMM_MX_DLCI) && (p_frame->pf == 1)) { p_frame->credit = *p_data++; p_buf->len--; p_buf->offset++; } else p_frame->credit = 0; if (p_buf->len != len) { RFCOMM_TRACE_ERROR(""Bad Length2 %d %d"", p_buf->len, len); return (RFC_EVENT_BAD_FRAME); } fcs = *(p_data + len); /* All control frames that we are sending are sent with P=1, expect */ /* reply with F=1 */ /* According to TS 07.10 spec ivalid frames are discarded without */ /* notification to the sender */ switch (p_frame->type) { case RFCOMM_SABME: if (RFCOMM_FRAME_IS_RSP(p_mcb->is_initiator, p_frame->cr) || !p_frame->pf || len || !RFCOMM_VALID_DLCI(p_frame->dlci) || !rfc_check_fcs(RFCOMM_CTRL_FRAME_LEN, p_start, fcs)) { RFCOMM_TRACE_ERROR(""Bad SABME""); return (RFC_EVENT_BAD_FRAME); } else return (RFC_EVENT_SABME); case RFCOMM_UA: if (RFCOMM_FRAME_IS_CMD(p_mcb->is_initiator, p_frame->cr) || !p_frame->pf || len || !RFCOMM_VALID_DLCI(p_frame->dlci) || !rfc_check_fcs(RFCOMM_CTRL_FRAME_LEN, p_start, fcs)) { RFCOMM_TRACE_ERROR(""Bad UA""); return (RFC_EVENT_BAD_FRAME); } else return (RFC_EVENT_UA); case RFCOMM_DM: if (RFCOMM_FRAME_IS_CMD(p_mcb->is_initiator, p_frame->cr) || len || !RFCOMM_VALID_DLCI(p_frame->dlci) || !rfc_check_fcs(RFCOMM_CTRL_FRAME_LEN, p_start, fcs)) { RFCOMM_TRACE_ERROR(""Bad DM""); return (RFC_EVENT_BAD_FRAME); } else return (RFC_EVENT_DM); case RFCOMM_DISC: if (RFCOMM_FRAME_IS_RSP(p_mcb->is_initiator, p_frame->cr) || !p_frame->pf || len || !RFCOMM_VALID_DLCI(p_frame->dlci) || !rfc_check_fcs(RFCOMM_CTRL_FRAME_LEN, p_start, fcs)) { RFCOMM_TRACE_ERROR(""Bad DISC""); return (RFC_EVENT_BAD_FRAME); } else return (RFC_EVENT_DISC); case RFCOMM_UIH: if (!RFCOMM_VALID_DLCI(p_frame->dlci)) { RFCOMM_TRACE_ERROR(""Bad UIH - invalid DLCI""); return (RFC_EVENT_BAD_FRAME); } else if (!rfc_check_fcs(2, p_start, fcs)) { RFCOMM_TRACE_ERROR(""Bad UIH - FCS""); return (RFC_EVENT_BAD_FRAME); } else if (RFCOMM_FRAME_IS_RSP(p_mcb->is_initiator, p_frame->cr)) { /* we assume that this is ok to allow bad implementations to work */ RFCOMM_TRACE_ERROR(""Bad UIH - response""); return (RFC_EVENT_UIH); } else return (RFC_EVENT_UIH); } return (RFC_EVENT_BAD_FRAME); } ",1 " RenderWidgetHostViewAuraTest() : widget_host_uses_shutdown_to_destroy_(false), is_guest_view_hack_(false) { ui::GestureConfiguration::GetInstance()->set_scroll_debounce_interval_in_ms( 0); } ",0 "static RedClient *reds_get_client(void) { spice_assert(reds->num_clients <= 1); if (reds->num_clients == 0) { return NULL; } return SPICE_CONTAINEROF(ring_get_head(&reds->clients), RedClient, link); } ",0 "AirPDcapRsna4WHandshake( PAIRPDCAP_CONTEXT ctx, const UCHAR *data, AIRPDCAP_SEC_ASSOCIATION *sa, INT offset, const guint tot_len) { AIRPDCAP_KEY_ITEM *tmp_key, *tmp_pkt_key, pkt_key; AIRPDCAP_SEC_ASSOCIATION *tmp_sa; INT key_index; INT ret_value=1; UCHAR useCache=FALSE; UCHAR eapol[AIRPDCAP_EAPOL_MAX_LEN]; USHORT eapol_len; if (sa->key!=NULL) useCache=TRUE; /* a 4-way handshake packet use a Pairwise key type (IEEE 802.11i-2004, pg. 79) */ if (AIRPDCAP_EAP_KEY(data[offset+1])!=1) { AIRPDCAP_DEBUG_PRINT_LINE(""AirPDcapRsna4WHandshake"", ""Group/STAKey message (not used)"", AIRPDCAP_DEBUG_LEVEL_5); return AIRPDCAP_RET_NO_VALID_HANDSHAKE; } /* TODO timeouts? */ /* TODO consider key-index */ /* TODO considera Deauthentications */ AIRPDCAP_DEBUG_PRINT_LINE(""AirPDcapRsna4WHandshake"", ""4-way handshake..."", AIRPDCAP_DEBUG_LEVEL_5); /* manage 4-way handshake packets; this step completes the 802.1X authentication process (IEEE 802.11i-2004, pag. 85) */ /* message 1: Authenticator->Supplicant (Sec=0, Mic=0, Ack=1, Inst=0, Key=1(pairwise), KeyRSC=0, Nonce=ANonce, MIC=0) */ if (AIRPDCAP_EAP_INST(data[offset+1])==0 && AIRPDCAP_EAP_ACK(data[offset+1])==1 && AIRPDCAP_EAP_MIC(data[offset])==0) { AIRPDCAP_DEBUG_PRINT_LINE(""AirPDcapRsna4WHandshake"", ""4-way handshake message 1"", AIRPDCAP_DEBUG_LEVEL_3); /* On reception of Message 1, the Supplicant determines whether the Key Replay Counter field value has been */ /* used before with the current PMKSA. If the Key Replay Counter field value is less than or equal to the current */ /* local value, the Supplicant discards the message. */ /* -> not checked, the Authenticator will be send another Message 1 (hopefully!) */ /* This saves the sa since we are reauthenticating which will overwrite our current sa GCS*/ if( sa->handshake >= 2) { tmp_sa= g_new(AIRPDCAP_SEC_ASSOCIATION, 1); memcpy(tmp_sa, sa, sizeof(AIRPDCAP_SEC_ASSOCIATION)); sa->validKey=FALSE; sa->next=tmp_sa; } /* save ANonce (from authenticator) to derive the PTK with the SNonce (from the 2 message) */ memcpy(sa->wpa.nonce, data+offset+12, 32); /* get the Key Descriptor Version (to select algorithm used in decryption -CCMP or TKIP-) */ sa->wpa.key_ver=AIRPDCAP_EAP_KEY_DESCR_VER(data[offset+1]); sa->handshake=1; return AIRPDCAP_RET_SUCCESS_HANDSHAKE; } /* message 2|4: Supplicant->Authenticator (Sec=0|1, Mic=1, Ack=0, Inst=0, Key=1(pairwise), KeyRSC=0, Nonce=SNonce|0, MIC=MIC(KCK,EAPOL)) */ if (AIRPDCAP_EAP_INST(data[offset+1])==0 && AIRPDCAP_EAP_ACK(data[offset+1])==0 && AIRPDCAP_EAP_MIC(data[offset])==1) { /* Check key data length to differentiate between message 2 or 4, same as in epan/dissectors/packet-ieee80211.c */ if (pntoh16(data+offset+92)) { /* message 2 */ AIRPDCAP_DEBUG_PRINT_LINE(""AirPDcapRsna4WHandshake"", ""4-way handshake message 2"", AIRPDCAP_DEBUG_LEVEL_3); /* On reception of Message 2, the Authenticator checks that the key replay counter corresponds to the */ /* outstanding Message 1. If not, it silently discards the message. */ /* If the calculated MIC does not match the MIC that the Supplicant included in the EAPOL-Key frame, */ /* the Authenticator silently discards Message 2. */ /* -> not checked; the Supplicant will send another message 2 (hopefully!) */ /* now you can derive the PTK */ for (key_index=0; key_index<(INT)ctx->keys_nr || useCache; key_index++) { /* use the cached one, or try all keys */ if (!useCache) { AIRPDCAP_DEBUG_PRINT_LINE(""AirPDcapRsna4WHandshake"", ""Try WPA key..."", AIRPDCAP_DEBUG_LEVEL_3); tmp_key=&ctx->keys[key_index]; } else { /* there is a cached key in the security association, if it's a WPA key try it... */ if (sa->key!=NULL && (sa->key->KeyType==AIRPDCAP_KEY_TYPE_WPA_PWD || sa->key->KeyType==AIRPDCAP_KEY_TYPE_WPA_PSK || sa->key->KeyType==AIRPDCAP_KEY_TYPE_WPA_PMK)) { AIRPDCAP_DEBUG_PRINT_LINE(""AirPDcapRsna4WHandshake"", ""Try cached WPA key..."", AIRPDCAP_DEBUG_LEVEL_3); tmp_key=sa->key; } else { AIRPDCAP_DEBUG_PRINT_LINE(""AirPDcapRsna4WHandshake"", ""Cached key is of a wrong type, try WPA key..."", AIRPDCAP_DEBUG_LEVEL_3); tmp_key=&ctx->keys[key_index]; } } /* obviously, try only WPA keys... */ if (tmp_key->KeyType==AIRPDCAP_KEY_TYPE_WPA_PWD || tmp_key->KeyType==AIRPDCAP_KEY_TYPE_WPA_PSK || tmp_key->KeyType==AIRPDCAP_KEY_TYPE_WPA_PMK) { if (tmp_key->KeyType == AIRPDCAP_KEY_TYPE_WPA_PWD && tmp_key->UserPwd.SsidLen == 0 && ctx->pkt_ssid_len > 0 && ctx->pkt_ssid_len <= AIRPDCAP_WPA_SSID_MAX_LEN) { /* We have a ""wildcard"" SSID. Use the one from the packet. */ memcpy(&pkt_key, tmp_key, sizeof(pkt_key)); memcpy(&pkt_key.UserPwd.Ssid, ctx->pkt_ssid, ctx->pkt_ssid_len); pkt_key.UserPwd.SsidLen = ctx->pkt_ssid_len; AirPDcapRsnaPwd2Psk(pkt_key.UserPwd.Passphrase, pkt_key.UserPwd.Ssid, pkt_key.UserPwd.SsidLen, pkt_key.KeyData.Wpa.Psk); tmp_pkt_key = &pkt_key; } else { tmp_pkt_key = tmp_key; } /* derive the PTK from the BSSID, STA MAC, PMK, SNonce, ANonce */ AirPDcapRsnaPrfX(sa, /* authenticator nonce, bssid, station mac */ tmp_pkt_key->KeyData.Wpa.Psk, /* PSK == PMK */ data+offset+12, /* supplicant nonce */ 512, sa->wpa.ptk); /* verify the MIC (compare the MIC in the packet included in this message with a MIC calculated with the PTK) */ eapol_len=pntoh16(data+offset-3)+4; memcpy(eapol, &data[offset-5], (eapol_lenwpa.ptk, /* Key Confirmation Key */ AIRPDCAP_EAP_KEY_DESCR_VER(data[offset+1])); /* EAPOL-Key description version */ /* If the MIC is valid, the Authenticator checks that the RSN information element bit-wise matches */ /* that from the (Re)Association Request message. */ /* i) TODO If these are not exactly the same, the Authenticator uses MLME-DEAUTHENTICATE.request */ /* primitive to terminate the association. */ /* ii) If they do match bit-wise, the Authenticator constructs Message 3. */ } if (!ret_value && (tmp_key->KeyType==AIRPDCAP_KEY_TYPE_WPA_PWD || tmp_key->KeyType==AIRPDCAP_KEY_TYPE_WPA_PSK || tmp_key->KeyType==AIRPDCAP_KEY_TYPE_WPA_PMK)) { /* the temporary key is the correct one, cached in the Security Association */ sa->key=tmp_key; break; } else { /* the cached key was not valid, try other keys */ if (useCache==TRUE) { useCache=FALSE; key_index--; } } } if (ret_value) { AIRPDCAP_DEBUG_PRINT_LINE(""AirPDcapRsna4WHandshake"", ""handshake step failed"", AIRPDCAP_DEBUG_LEVEL_3); return AIRPDCAP_RET_NO_VALID_HANDSHAKE; } sa->handshake=2; sa->validKey=TRUE; /* we can use the key to decode, even if we have not captured the other eapol packets */ return AIRPDCAP_RET_SUCCESS_HANDSHAKE; } else { /* message 4 */ /* TODO ""Note that when the 4-Way Handshake is first used Message 4 is sent in the clear."" */ /* TODO check MIC and Replay Counter */ /* On reception of Message 4, the Authenticator verifies that the Key Replay Counter field value is one */ /* that it used on this 4-Way Handshake; if it is not, it silently discards the message. */ /* If the calculated MIC does not match the MIC that the Supplicant included in the EAPOL-Key frame, the */ /* Authenticator silently discards Message 4. */ AIRPDCAP_DEBUG_PRINT_LINE(""AirPDcapRsna4WHandshake"", ""4-way handshake message 4"", AIRPDCAP_DEBUG_LEVEL_3); sa->handshake=4; return AIRPDCAP_RET_SUCCESS_HANDSHAKE; } } /* message 3: Authenticator->Supplicant (Sec=1, Mic=1, Ack=1, Inst=0/1, Key=1(pairwise), KeyRSC=???, Nonce=ANonce, MIC=1) */ if (AIRPDCAP_EAP_ACK(data[offset+1])==1 && AIRPDCAP_EAP_MIC(data[offset])==1) { const EAPOL_RSN_KEY *pEAPKey; AIRPDCAP_DEBUG_PRINT_LINE(""AirPDcapRsna4WHandshake"", ""4-way handshake message 3"", AIRPDCAP_DEBUG_LEVEL_3); /* On reception of Message 3, the Supplicant silently discards the message if the Key Replay Counter field */ /* value has already been used or if the ANonce value in Message 3 differs from the ANonce value in Message 1. */ /* -> not checked, the Authenticator will send another message 3 (hopefully!) */ /* TODO check page 88 (RNS) */ /* If using WPA2 PSK, message 3 will contain an RSN for the group key (GTK KDE). In order to properly support decrypting WPA2-PSK packets, we need to parse this to get the group key. */ pEAPKey = (const EAPOL_RSN_KEY *)(&(data[offset-1])); if (pEAPKey->type == AIRPDCAP_RSN_WPA2_KEY_DESCRIPTOR){ PAIRPDCAP_SEC_ASSOCIATION broadcast_sa; AIRPDCAP_SEC_ASSOCIATION_ID id; /* Get broadcacst SA for the current BSSID */ memcpy(id.sta, broadcast_mac, AIRPDCAP_MAC_LEN); memcpy(id.bssid, sa->saId.bssid, AIRPDCAP_MAC_LEN); broadcast_sa = AirPDcapGetSaPtr(ctx, &id); if (broadcast_sa == NULL){ return AIRPDCAP_RET_REQ_DATA; } return (AirPDcapDecryptWPABroadcastKey(pEAPKey, sa->wpa.ptk+16, broadcast_sa, tot_len-offset+1)); } } return AIRPDCAP_RET_NO_VALID_HANDSHAKE; } ",0 "void DocumentWriter::clear() { m_decoder = 0; m_hasReceivedSomeData = false; if (!m_encodingWasChosenByUser) m_encoding = String(); } ",0 "gsf_infile_tar_class_init (GObjectClass *gobject_class) { GsfInputClass *input_class = GSF_INPUT_CLASS (gobject_class); GsfInfileClass *infile_class = GSF_INFILE_CLASS (gobject_class); gobject_class->constructor = gsf_infile_tar_constructor; gobject_class->finalize = gsf_infile_tar_finalize; gobject_class->dispose = gsf_infile_tar_dispose; gobject_class->get_property = gsf_infile_tar_get_property; gobject_class->set_property = gsf_infile_tar_set_property; input_class->Dup = gsf_infile_tar_dup; input_class->Read = gsf_infile_tar_read; input_class->Seek = gsf_infile_tar_seek; infile_class->num_children = gsf_infile_tar_num_children; infile_class->name_by_index = gsf_infile_tar_name_by_index; infile_class->child_by_index = gsf_infile_tar_child_by_index; infile_class->child_by_name = gsf_infile_tar_child_by_name; parent_class = g_type_class_peek_parent (gobject_class); g_object_class_install_property (gobject_class, PROP_SOURCE, g_param_spec_object (""source"", _(""Source""), _(""The archive being interpreted""), GSF_INPUT_TYPE, GSF_PARAM_STATIC | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); } ",0 "void ResourceFetcher::UpdateMemoryCacheStats(Resource* resource, RevalidationPolicy policy, const FetchParameters& params, const ResourceFactory& factory, bool is_static_data) const { if (is_static_data) return; if (params.IsSpeculativePreload() || params.IsLinkPreload()) { DEFINE_RESOURCE_HISTOGRAM(""Preload.""); } else { DEFINE_RESOURCE_HISTOGRAM(""""); } if (resource && !resource->IsAlive() && !ContainsAsPreload(resource)) { DEFINE_RESOURCE_HISTOGRAM(""Dead.""); } } ",0 "static int vop_mmap(struct file *f, struct vm_area_struct *vma) { struct vop_vdev *vdev = f->private_data; unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; unsigned long pa, size = vma->vm_end - vma->vm_start, size_rem = size; int i, err; err = vop_vdev_inited(vdev); if (err) goto ret; if (vma->vm_flags & VM_WRITE) { err = -EACCES; goto ret; } while (size_rem) { i = vop_query_offset(vdev, offset, &size, &pa); if (i < 0) { err = -EINVAL; goto ret; } err = remap_pfn_range(vma, vma->vm_start + offset, pa >> PAGE_SHIFT, size, vma->vm_page_prot); if (err) goto ret; size_rem -= size; offset += size; } ret: return err; } ",0 "RenderFrameProxyHost* RenderFrameHostManager::GetProxyToParent() { if (frame_tree_node_->IsMainFrame()) return nullptr; return GetRenderFrameProxyHost(frame_tree_node_->parent() ->render_manager() ->current_frame_host() ->GetSiteInstance()); } ",0 "status_t OMXNodeInstance::configureVideoTunnelMode( OMX_U32 portIndex, OMX_BOOL tunneled, OMX_U32 audioHwSync, native_handle_t **sidebandHandle) { Mutex::Autolock autolock(mLock); if (mSailed) { android_errorWriteLog(0x534e4554, ""29422020""); return INVALID_OPERATION; } CLOG_CONFIG(configureVideoTunnelMode, ""%s:%u tun=%d sync=%u"", portString(portIndex), portIndex, tunneled, audioHwSync); OMX_INDEXTYPE index; OMX_STRING name = const_cast( ""OMX.google.android.index.configureVideoTunnelMode""); OMX_ERRORTYPE err = OMX_GetExtensionIndex(mHandle, name, &index); if (err != OMX_ErrorNone) { CLOG_ERROR_IF(tunneled, getExtensionIndex, err, ""%s"", name); return StatusFromOMXError(err); } ConfigureVideoTunnelModeParams tunnelParams; InitOMXParams(&tunnelParams); tunnelParams.nPortIndex = portIndex; tunnelParams.bTunneled = tunneled; tunnelParams.nAudioHwSync = audioHwSync; err = OMX_SetParameter(mHandle, index, &tunnelParams); if (err != OMX_ErrorNone) { CLOG_ERROR(setParameter, err, ""%s(%#x): %s:%u tun=%d sync=%u"", name, index, portString(portIndex), portIndex, tunneled, audioHwSync); return StatusFromOMXError(err); } err = OMX_GetParameter(mHandle, index, &tunnelParams); if (err != OMX_ErrorNone) { CLOG_ERROR(getParameter, err, ""%s(%#x): %s:%u tun=%d sync=%u"", name, index, portString(portIndex), portIndex, tunneled, audioHwSync); return StatusFromOMXError(err); } if (sidebandHandle) { *sidebandHandle = (native_handle_t*)tunnelParams.pSidebandWindow; } return OK; } ",0 "static void xmessage_fork(struct proclistlist *pll){ char message[5000]; set_pid_priority(0,SCHED_FIFO,sched_get_priority_min(SCHED_FIFO),""Unable to set SCHED_FIFO for %d (\""%s\""). (%s)"", ""the xmessage fork""); setenv(""DISPLAY"","":0.0"",1); if( ! xmessage_found) sprintf(message,""xmessage \""WARNING! das_watchdog pauses realtime operations for %d seconds.\"""",waittime); else sprintf(message,""%s \""WARNING! das_watchdog pauses realtime operations for %d seconds.\"""",WHICH_XMESSAGE,waittime); if(send_xmessage_using_uids(pll,message)==0){ set_pid_priority(0,SCHED_OTHER,0,""Unable to set SCHED_OTHER for %d (\""%s\""). (%s)"", ""the xmessage fork""); // send_xmessage_using_XAUTHRITY is too heavy to run in realtime. send_xmessage_using_XAUTHORITY(pll,0,message); } pll_delete(pll); } ",0 "static int sctp_setsockopt(struct sock *sk, int level, int optname, char __user *optval, unsigned int optlen) { int retval = 0; pr_debug(""%s: sk:%p, optname:%d\n"", __func__, sk, optname); /* I can hardly begin to describe how wrong this is. This is * so broken as to be worse than useless. The API draft * REALLY is NOT helpful here... I am not convinced that the * semantics of setsockopt() with a level OTHER THAN SOL_SCTP * are at all well-founded. */ if (level != SOL_SCTP) { struct sctp_af *af = sctp_sk(sk)->pf->af; retval = af->setsockopt(sk, level, optname, optval, optlen); goto out_nounlock; } lock_sock(sk); switch (optname) { case SCTP_SOCKOPT_BINDX_ADD: /* 'optlen' is the size of the addresses buffer. */ retval = sctp_setsockopt_bindx(sk, (struct sockaddr __user *)optval, optlen, SCTP_BINDX_ADD_ADDR); break; case SCTP_SOCKOPT_BINDX_REM: /* 'optlen' is the size of the addresses buffer. */ retval = sctp_setsockopt_bindx(sk, (struct sockaddr __user *)optval, optlen, SCTP_BINDX_REM_ADDR); break; case SCTP_SOCKOPT_CONNECTX_OLD: /* 'optlen' is the size of the addresses buffer. */ retval = sctp_setsockopt_connectx_old(sk, (struct sockaddr __user *)optval, optlen); break; case SCTP_SOCKOPT_CONNECTX: /* 'optlen' is the size of the addresses buffer. */ retval = sctp_setsockopt_connectx(sk, (struct sockaddr __user *)optval, optlen); break; case SCTP_DISABLE_FRAGMENTS: retval = sctp_setsockopt_disable_fragments(sk, optval, optlen); break; case SCTP_EVENTS: retval = sctp_setsockopt_events(sk, optval, optlen); break; case SCTP_AUTOCLOSE: retval = sctp_setsockopt_autoclose(sk, optval, optlen); break; case SCTP_PEER_ADDR_PARAMS: retval = sctp_setsockopt_peer_addr_params(sk, optval, optlen); break; case SCTP_DELAYED_SACK: retval = sctp_setsockopt_delayed_ack(sk, optval, optlen); break; case SCTP_PARTIAL_DELIVERY_POINT: retval = sctp_setsockopt_partial_delivery_point(sk, optval, optlen); break; case SCTP_INITMSG: retval = sctp_setsockopt_initmsg(sk, optval, optlen); break; case SCTP_DEFAULT_SEND_PARAM: retval = sctp_setsockopt_default_send_param(sk, optval, optlen); break; case SCTP_DEFAULT_SNDINFO: retval = sctp_setsockopt_default_sndinfo(sk, optval, optlen); break; case SCTP_PRIMARY_ADDR: retval = sctp_setsockopt_primary_addr(sk, optval, optlen); break; case SCTP_SET_PEER_PRIMARY_ADDR: retval = sctp_setsockopt_peer_primary_addr(sk, optval, optlen); break; case SCTP_NODELAY: retval = sctp_setsockopt_nodelay(sk, optval, optlen); break; case SCTP_RTOINFO: retval = sctp_setsockopt_rtoinfo(sk, optval, optlen); break; case SCTP_ASSOCINFO: retval = sctp_setsockopt_associnfo(sk, optval, optlen); break; case SCTP_I_WANT_MAPPED_V4_ADDR: retval = sctp_setsockopt_mappedv4(sk, optval, optlen); break; case SCTP_MAXSEG: retval = sctp_setsockopt_maxseg(sk, optval, optlen); break; case SCTP_ADAPTATION_LAYER: retval = sctp_setsockopt_adaptation_layer(sk, optval, optlen); break; case SCTP_CONTEXT: retval = sctp_setsockopt_context(sk, optval, optlen); break; case SCTP_FRAGMENT_INTERLEAVE: retval = sctp_setsockopt_fragment_interleave(sk, optval, optlen); break; case SCTP_MAX_BURST: retval = sctp_setsockopt_maxburst(sk, optval, optlen); break; case SCTP_AUTH_CHUNK: retval = sctp_setsockopt_auth_chunk(sk, optval, optlen); break; case SCTP_HMAC_IDENT: retval = sctp_setsockopt_hmac_ident(sk, optval, optlen); break; case SCTP_AUTH_KEY: retval = sctp_setsockopt_auth_key(sk, optval, optlen); break; case SCTP_AUTH_ACTIVE_KEY: retval = sctp_setsockopt_active_key(sk, optval, optlen); break; case SCTP_AUTH_DELETE_KEY: retval = sctp_setsockopt_del_key(sk, optval, optlen); break; case SCTP_AUTO_ASCONF: retval = sctp_setsockopt_auto_asconf(sk, optval, optlen); break; case SCTP_PEER_ADDR_THLDS: retval = sctp_setsockopt_paddr_thresholds(sk, optval, optlen); break; case SCTP_RECVRCVINFO: retval = sctp_setsockopt_recvrcvinfo(sk, optval, optlen); break; case SCTP_RECVNXTINFO: retval = sctp_setsockopt_recvnxtinfo(sk, optval, optlen); break; default: retval = -ENOPROTOOPT; break; } release_sock(sk); out_nounlock: return retval; } ",0 "format_time (int seconds) { int minutes; int hours; char *res; if (seconds < 0) { /* Just to make sure... */ seconds = 0; } if (seconds < 60) { return g_strdup_printf (ngettext (""%'d second"", ""%'d seconds"", (int) seconds), (int) seconds); } if (seconds < 60 * 60) { minutes = seconds / 60; return g_strdup_printf (ngettext (""%'d minute"", ""%'d minutes"", minutes), minutes); } hours = seconds / (60 * 60); if (seconds < 60 * 60 * 4) { char *h, *m; minutes = (seconds - hours * 60 * 60) / 60; h = g_strdup_printf (ngettext (""%'d hour"", ""%'d hours"", hours), hours); m = g_strdup_printf (ngettext (""%'d minute"", ""%'d minutes"", minutes), minutes); res = g_strconcat (h, "", "", m, NULL); g_free (h); g_free (m); return res; } return g_strdup_printf (ngettext (""approximately %'d hour"", ""approximately %'d hours"", hours), hours); } ",0 "bool IsPortAllowedByFtp(int port) { int array_size = arraysize(kAllowedFtpPorts); for (int i = 0; i < array_size; i++) { if (kAllowedFtpPorts[i] == port) { return true; } } return IsPortAllowedByDefault(port); } ",0 "static char *parse_tmp_evals(RCore *core, const char *str) { char *s = strdup (str); int i, argc = r_str_split (s, ','); char *res = strdup (""""); if (!s || !res) { free (s); free (res); return NULL; } for (i = 0; i < argc; i++) { char *eq, *kv = (char *)r_str_word_get0 (s, i); if (!kv) { break; } eq = strchr (kv, '='); if (eq) { *eq = 0; const char *ov = r_config_get (core->config, kv); if (!ov) { continue; } char *cmd = r_str_newf (""e %s=%s;"", kv, ov); if (!cmd) { free (s); free (res); return NULL; } res = r_str_prepend (res, cmd); free (cmd); r_config_set (core->config, kv, eq + 1); *eq = '='; } else { eprintf (""Missing '=' in e: expression (%s)\n"", kv); } } free (s); return res; } ",0 "void RenderWidgetHostViewAura::ConfirmCompositionText() { if (text_input_manager_ && text_input_manager_->GetActiveWidget() && has_composition_text_) { text_input_manager_->GetActiveWidget()->ImeFinishComposingText(false); } has_composition_text_ = false; } ",0 "void Plugin::NaClManifestBufferReady(int32_t pp_error) { PLUGIN_PRINTF((""Plugin::NaClManifestBufferReady (pp_error=%"" NACL_PRId32"")\n"", pp_error)); ErrorInfo error_info; set_manifest_url(nexe_downloader_.url()); if (pp_error != PP_OK) { if (pp_error == PP_ERROR_ABORTED) { ReportLoadAbort(); } else { error_info.SetReport(ERROR_MANIFEST_LOAD_URL, ""could not load manifest url.""); ReportLoadError(error_info); } return; } const std::deque& buffer = nexe_downloader_.buffer(); size_t buffer_size = buffer.size(); if (buffer_size > kNaClManifestMaxFileBytes) { error_info.SetReport(ERROR_MANIFEST_TOO_LARGE, ""manifest file too large.""); ReportLoadError(error_info); return; } nacl::scoped_array json_buffer(new char[buffer_size + 1]); if (json_buffer == NULL) { error_info.SetReport(ERROR_MANIFEST_MEMORY_ALLOC, ""could not allocate manifest memory.""); ReportLoadError(error_info); return; } std::copy(buffer.begin(), buffer.begin() + buffer_size, &json_buffer[0]); json_buffer[buffer_size] = '\0'; ProcessNaClManifest(json_buffer.get()); } ",0 "static int kvm_handle_exit(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu) { u32 exit_reason = kvm_get_exit_reason(vcpu); vcpu->arch.last_exit = exit_reason; if (exit_reason < kvm_vti_max_exit_handlers && kvm_vti_exit_handlers[exit_reason]) return kvm_vti_exit_handlers[exit_reason](vcpu, kvm_run); else { kvm_run->exit_reason = KVM_EXIT_UNKNOWN; kvm_run->hw.hardware_exit_reason = exit_reason; } return 0; } ",0 "ofpact_raw_lookup(enum ofp_version ofp_version, enum ofp_raw_action_type raw) { const struct ofpact_raw_instance *inst; HMAP_FOR_EACH_WITH_HASH (inst, encode_node, hash_2words(raw, ofp_version), ofpact_encode_hmap()) { if (inst->raw == raw && inst->hdrs.ofp_version == ofp_version) { return inst; } } OVS_NOT_REACHED(); } ",0 "SVGDocumentExtensions& Document::AccessSVGExtensions() { if (!svg_extensions_) svg_extensions_ = new SVGDocumentExtensions(this); return *svg_extensions_; } ",0 "void TabStrip::StartMouseInitiatedRemoveTabAnimation(int model_index) { Tab* tab_closing = tab_at(model_index); int delta = tab_closing->width() + tab_h_offset(); DCHECK_NE(model_index + 1, tab_count()); if (tab_closing->data().mini && model_index + 1 < tab_count() && !tab_at(model_index + 1)->data().mini) { delta += kMiniToNonMiniGap; } for (int i = model_index + 1; i < tab_count(); ++i) { gfx::Rect bounds = ideal_bounds(i); bounds.set_x(bounds.x() - delta); set_ideal_bounds(i, bounds); } newtab_button_bounds_.set_x(newtab_button_bounds_.x() - delta); PrepareForAnimation(); tab_closing->set_closing(true); RemoveTabFromViewModel(model_index); AnimateToIdealBounds(); gfx::Rect tab_bounds = tab_closing->bounds(); tab_bounds.set_width(0); bounds_animator_.AnimateViewTo(tab_closing, tab_bounds); bounds_animator_.SetAnimationDelegate( tab_closing, new RemoveTabDelegate(this, tab_closing), true); } ",0 "static u64 sched_vslice(struct cfs_rq *cfs_rq, struct sched_entity *se) { return calc_delta_fair(sched_slice(cfs_rq, se), se); } ",0 "BrowserProcessMainImpl::~BrowserProcessMainImpl() { CHECK(state_ == STATE_NOT_STARTED || state_ == STATE_SHUTDOWN) << ""BrowserProcessMain::Shutdown() should be called before process exit""; } ",0 "static void intel_pmu_flush_branch_stack(void) { /* * Intel LBR does not tag entries with the * PID of the current task, then we need to * flush it on ctxsw * For now, we simply reset it */ if (x86_pmu.lbr_nr) intel_pmu_lbr_reset(); } ",0 "int vb2_ioctl_qbuf(struct file *file, void *priv, struct v4l2_buffer *p) { struct video_device *vdev = video_devdata(file); if (vb2_queue_is_busy(vdev, file)) return -EBUSY; return vb2_qbuf(vdev->queue, p); } ",0 "static int tg3_open(struct net_device *dev) { struct tg3 *tp = netdev_priv(dev); int err; if (tp->fw_needed) { err = tg3_request_firmware(tp); if (tg3_chip_rev_id(tp) == CHIPREV_ID_5701_A0) { if (err) return err; } else if (err) { netdev_warn(tp->dev, ""TSO capability disabled\n""); tg3_flag_clear(tp, TSO_CAPABLE); } else if (!tg3_flag(tp, TSO_CAPABLE)) { netdev_notice(tp->dev, ""TSO capability restored\n""); tg3_flag_set(tp, TSO_CAPABLE); } } tg3_carrier_off(tp); err = tg3_power_up(tp); if (err) return err; tg3_full_lock(tp, 0); tg3_disable_ints(tp); tg3_flag_clear(tp, INIT_COMPLETE); tg3_full_unlock(tp); err = tg3_start(tp, true, true, true); if (err) { tg3_frob_aux_power(tp, false); pci_set_power_state(tp->pdev, PCI_D3hot); } if (tg3_flag(tp, PTP_CAPABLE)) { tp->ptp_clock = ptp_clock_register(&tp->ptp_info, &tp->pdev->dev); if (IS_ERR(tp->ptp_clock)) tp->ptp_clock = NULL; } return err; } ",0 "onig_compile(regex_t* reg, const UChar* pattern, const UChar* pattern_end, OnigErrorInfo* einfo) { int r; Node* root; ScanEnv scan_env; #ifdef USE_CALL UnsetAddrList uslist; #endif root = 0; if (IS_NOT_NULL(einfo)) { einfo->enc = reg->enc; einfo->par = (UChar* )NULL; } #ifdef ONIG_DEBUG print_enc_string(stderr, reg->enc, pattern, pattern_end); #endif if (reg->ops_alloc == 0) { r = ops_init(reg, OPS_INIT_SIZE); if (r != 0) goto end; } else reg->ops_used = 0; reg->string_pool = 0; reg->string_pool_end = 0; reg->num_mem = 0; reg->num_repeat = 0; reg->num_null_check = 0; reg->repeat_range_alloc = 0; reg->repeat_range = (OnigRepeatRange* )NULL; r = onig_parse_tree(&root, pattern, pattern_end, reg, &scan_env); if (r != 0) goto err; /* mixed use named group and no-named group */ if (scan_env.num_named > 0 && IS_SYNTAX_BV(scan_env.syntax, ONIG_SYN_CAPTURE_ONLY_NAMED_GROUP) && ! ONIG_IS_OPTION_ON(reg->options, ONIG_OPTION_CAPTURE_GROUP)) { if (scan_env.num_named != scan_env.num_mem) r = disable_noname_group_capture(&root, reg, &scan_env); else r = numbered_ref_check(root); if (r != 0) goto err; } r = check_backrefs(root, &scan_env); if (r != 0) goto err; #ifdef USE_CALL if (scan_env.num_call > 0) { r = unset_addr_list_init(&uslist, scan_env.num_call); if (r != 0) goto err; scan_env.unset_addr_list = &uslist; r = setup_call(root, &scan_env, 0); if (r != 0) goto err_unset; r = setup_call2(root); if (r != 0) goto err_unset; r = recursive_call_check_trav(root, &scan_env, 0); if (r < 0) goto err_unset; r = infinite_recursive_call_check_trav(root, &scan_env); if (r != 0) goto err_unset; setup_called_state(root, 0); } reg->num_call = scan_env.num_call; #endif r = setup_tree(root, reg, 0, &scan_env); if (r != 0) goto err_unset; #ifdef ONIG_DEBUG_PARSE print_tree(stderr, root); #endif reg->capture_history = scan_env.capture_history; reg->bt_mem_start = scan_env.bt_mem_start; reg->bt_mem_start |= reg->capture_history; if (IS_FIND_CONDITION(reg->options)) MEM_STATUS_ON_ALL(reg->bt_mem_end); else { reg->bt_mem_end = scan_env.bt_mem_end; reg->bt_mem_end |= reg->capture_history; } reg->bt_mem_start |= reg->bt_mem_end; clear_optimize_info(reg); #ifndef ONIG_DONT_OPTIMIZE r = set_optimize_info_from_tree(root, reg, &scan_env); if (r != 0) goto err_unset; #endif if (IS_NOT_NULL(scan_env.mem_env_dynamic)) { xfree(scan_env.mem_env_dynamic); scan_env.mem_env_dynamic = (MemEnv* )NULL; } r = compile_tree(root, reg, &scan_env); if (r == 0) { if (scan_env.keep_num > 0) { r = add_op(reg, OP_UPDATE_VAR); if (r != 0) goto err; COP(reg)->update_var.type = UPDATE_VAR_KEEP_FROM_STACK_LAST; COP(reg)->update_var.id = 0; /* not used */ } r = add_op(reg, OP_END); if (r != 0) goto err; #ifdef USE_CALL if (scan_env.num_call > 0) { r = fix_unset_addr_list(&uslist, reg); unset_addr_list_end(&uslist); if (r != 0) goto err; } #endif if ((reg->num_repeat != 0) || (reg->bt_mem_end != 0) #ifdef USE_CALLOUT || (IS_NOT_NULL(reg->extp) && reg->extp->callout_num != 0) #endif ) reg->stack_pop_level = STACK_POP_LEVEL_ALL; else { if (reg->bt_mem_start != 0) reg->stack_pop_level = STACK_POP_LEVEL_MEM_START; else reg->stack_pop_level = STACK_POP_LEVEL_FREE; } r = ops_make_string_pool(reg); if (r != 0) goto err; } #ifdef USE_CALL else if (scan_env.num_call > 0) { unset_addr_list_end(&uslist); } #endif onig_node_free(root); #ifdef ONIG_DEBUG_COMPILE onig_print_names(stderr, reg); onig_print_compiled_byte_code_list(stderr, reg); #endif #ifdef USE_DIRECT_THREADED_CODE /* opcode -> opaddr */ onig_init_for_match_at(reg); #endif end: return r; err_unset: #ifdef USE_CALL if (scan_env.num_call > 0) { unset_addr_list_end(&uslist); } #endif err: if (IS_NOT_NULL(scan_env.error)) { if (IS_NOT_NULL(einfo)) { einfo->par = scan_env.error; einfo->par_end = scan_env.error_end; } } onig_node_free(root); if (IS_NOT_NULL(scan_env.mem_env_dynamic)) xfree(scan_env.mem_env_dynamic); return r; } ",0 " void SharedWorkerDevToolsAgentHost::WorkerDestroyed() { DCHECK_NE(WORKER_TERMINATED, state_); DCHECK(worker_host_); state_ = WORKER_TERMINATED; for (auto* inspector : protocol::InspectorHandler::ForAgentHost(this)) inspector->TargetCrashed(); for (DevToolsSession* session : sessions()) session->SetRenderer(nullptr, nullptr); worker_host_ = nullptr; agent_ptr_.reset(); } ",1 "void HeadlessWebContentsImpl::InitializeWindow( const gfx::Rect& initial_bounds) { static int window_id = 1; window_id_ = window_id++; window_state_ = ""normal""; browser()->PlatformInitializeWebContents(this); SetBounds(initial_bounds); if (begin_frame_control_enabled_) { ui::Compositor* compositor = browser()->PlatformGetCompositor(this); DCHECK(compositor); compositor->SetExternalBeginFrameClient(this); } } ",0 "xprt_rdma_bc_free(struct rpc_task *task) { struct rpc_rqst *rqst = task->tk_rqstp; kfree(rqst->rq_rbuffer); } ",0 "void Clipboard::ReadAvailableTypes(Clipboard::Buffer buffer, std::vector* types, bool* contains_filenames) const { if (!types || !contains_filenames) { NOTREACHED(); return; } types->clear(); if (IsFormatAvailable(GetPlainTextFormatType(), buffer)) types->push_back(UTF8ToUTF16(kMimeTypeText)); if (IsFormatAvailable(GetHtmlFormatType(), buffer)) types->push_back(UTF8ToUTF16(kMimeTypeHTML)); if (IsFormatAvailable(GetBitmapFormatType(), buffer)) types->push_back(UTF8ToUTF16(kMimeTypePNG)); *contains_filenames = false; } ",0 "static void UnscopableRuntimeEnabledLongAttributeAttributeGetter(const v8::FunctionCallbackInfo& info) { v8::Local holder = info.Holder(); TestObject* impl = V8TestObject::ToImpl(holder); V8SetReturnValueInt(info, impl->unscopableRuntimeEnabledLongAttribute()); } ",0 "static void rds_ib_send_unmap_rdma(struct rds_ib_connection *ic, struct rm_rdma_op *op, int wc_status) { if (op->op_mapped) { ib_dma_unmap_sg(ic->i_cm_id->device, op->op_sg, op->op_nents, op->op_write ? DMA_TO_DEVICE : DMA_FROM_DEVICE); op->op_mapped = 0; } /* If the user asked for a completion notification on this * message, we can implement three different semantics: * 1. Notify when we received the ACK on the RDS message * that was queued with the RDMA. This provides reliable * notification of RDMA status at the expense of a one-way * packet delay. * 2. Notify when the IB stack gives us the completion event for * the RDMA operation. * 3. Notify when the IB stack gives us the completion event for * the accompanying RDS messages. * Here, we implement approach #3. To implement approach #2, * we would need to take an event for the rdma WR. To implement #1, * don't call rds_rdma_send_complete at all, and fall back to the notify * handling in the ACK processing code. * * Note: There's no need to explicitly sync any RDMA buffers using * ib_dma_sync_sg_for_cpu - the completion for the RDMA * operation itself unmapped the RDMA buffers, which takes care * of synching. */ rds_ib_send_complete(container_of(op, struct rds_message, rdma), wc_status, rds_rdma_send_complete); if (op->op_write) rds_stats_add(s_send_rdma_bytes, op->op_bytes); else rds_stats_add(s_recv_rdma_bytes, op->op_bytes); } ",0 "void DevToolsEventForwarder::SetWhitelistedShortcuts( const std::string& message) { std::unique_ptr parsed_message = base::JSONReader::Read(message); base::ListValue* shortcut_list; if (!parsed_message || !parsed_message->GetAsList(&shortcut_list)) return; base::ListValue::iterator it = shortcut_list->begin(); for (; it != shortcut_list->end(); ++it) { base::DictionaryValue* dictionary; if (!(*it)->GetAsDictionary(&dictionary)) continue; int key_code = 0; dictionary->GetInteger(""keyCode"", &key_code); if (key_code == 0) continue; int modifiers = 0; dictionary->GetInteger(""modifiers"", &modifiers); if (!KeyWhitelistingAllowed(key_code, modifiers)) { LOG(WARNING) << ""Key whitelisting forbidden: "" << ""("" << key_code << "","" << modifiers << "")""; continue; } whitelisted_keys_.insert(CombineKeyCodeAndModifiers(key_code, modifiers)); } } ",0 " explicit WorkerCreationObserver(WorkerData* worker_data) : worker_data_(worker_data) { } ",0 "GF_Err saio_Read(GF_Box *s, GF_BitStream *bs) { GF_SampleAuxiliaryInfoOffsetBox *ptr = (GF_SampleAuxiliaryInfoOffsetBox *)s; if (ptr->flags & 1) { ptr->aux_info_type = gf_bs_read_u32(bs); ptr->aux_info_type_parameter = gf_bs_read_u32(bs); ISOM_DECREASE_SIZE(ptr, 8); } ptr->entry_count = gf_bs_read_u32(bs); ISOM_DECREASE_SIZE(ptr, 4); if (ptr->entry_count) { u32 i; if (ptr->version==0) { ptr->offsets = gf_malloc(sizeof(u32)*ptr->entry_count); for (i=0; ientry_count; i++) ptr->offsets[i] = gf_bs_read_u32(bs); ISOM_DECREASE_SIZE(ptr, 4*ptr->entry_count); } else { ptr->offsets_large = gf_malloc(sizeof(u64)*ptr->entry_count); for (i=0; ientry_count; i++) ptr->offsets_large[i] = gf_bs_read_u64(bs); ISOM_DECREASE_SIZE(ptr, 8*ptr->entry_count); } } return GF_OK; } ",0 "static void efx_fini_struct(struct efx_nic *efx) { int i; for (i = 0; i < EFX_MAX_CHANNELS; i++) kfree(efx->channel[i]); if (efx->workqueue) { destroy_workqueue(efx->workqueue); efx->workqueue = NULL; } } ",0 "static int pfkey_broadcast(struct sk_buff *skb, gfp_t allocation, int broadcast_flags, struct sock *one_sk, struct net *net) { struct netns_pfkey *net_pfkey = net_generic(net, pfkey_net_id); struct sock *sk; struct hlist_node *node; struct sk_buff *skb2 = NULL; int err = -ESRCH; /* XXX Do we need something like netlink_overrun? I think * XXX PF_KEY socket apps will not mind current behavior. */ if (!skb) return -ENOMEM; rcu_read_lock(); sk_for_each_rcu(sk, node, &net_pfkey->table) { struct pfkey_sock *pfk = pfkey_sk(sk); int err2; /* Yes, it means that if you are meant to receive this * pfkey message you receive it twice as promiscuous * socket. */ if (pfk->promisc) pfkey_broadcast_one(skb, &skb2, allocation, sk); /* the exact target will be processed later */ if (sk == one_sk) continue; if (broadcast_flags != BROADCAST_ALL) { if (broadcast_flags & BROADCAST_PROMISC_ONLY) continue; if ((broadcast_flags & BROADCAST_REGISTERED) && !pfk->registered) continue; if (broadcast_flags & BROADCAST_ONE) continue; } err2 = pfkey_broadcast_one(skb, &skb2, allocation, sk); /* Error is cleare after succecful sending to at least one * registered KM */ if ((broadcast_flags & BROADCAST_REGISTERED) && err) err = err2; } rcu_read_unlock(); if (one_sk != NULL) err = pfkey_broadcast_one(skb, &skb2, allocation, one_sk); kfree_skb(skb2); kfree_skb(skb); return err; } ",0 "int processEventsWhileBlocked(void) { int iterations = 4; /* See the function top-comment. */ int count = 0; while (iterations--) { int events = 0; events += aeProcessEvents(server.el, AE_FILE_EVENTS|AE_DONT_WAIT); events += handleClientsWithPendingWrites(); if (!events) break; count += events; } return count; } ",0 "status_t MediaRecorder::setVideoEncoder(int ve) { ALOGV(""setVideoEncoder(%d)"", ve); if (mMediaRecorder == NULL) { ALOGE(""media recorder is not initialized yet""); return INVALID_OPERATION; } if (!mIsVideoSourceSet) { ALOGE(""try to set the video encoder without setting the video source first""); return INVALID_OPERATION; } if (mIsVideoEncoderSet) { ALOGE(""video encoder has already been set""); return INVALID_OPERATION; } if (!(mCurrentState & MEDIA_RECORDER_DATASOURCE_CONFIGURED)) { ALOGE(""setVideoEncoder called in an invalid state(%d)"", mCurrentState); return INVALID_OPERATION; } status_t ret = mMediaRecorder->setVideoEncoder(ve); if (OK != ret) { ALOGV(""setVideoEncoder failed: %d"", ret); mCurrentState = MEDIA_RECORDER_ERROR; return ret; } mIsVideoEncoderSet = true; return ret; } ",0 "bool RenderViewImpl::runFileChooser( const WebKit::WebFileChooserParams& params, WebFileChooserCompletion* chooser_completion) { if (is_hidden()) return false; FileChooserParams ipc_params; if (params.directory) ipc_params.mode = FileChooserParams::OpenFolder; else if (params.multiSelect) ipc_params.mode = FileChooserParams::OpenMultiple; else if (params.saveAs) ipc_params.mode = FileChooserParams::Save; else ipc_params.mode = FileChooserParams::Open; ipc_params.title = params.title; ipc_params.default_file_name = webkit_base::WebStringToFilePath(params.initialValue); ipc_params.accept_types.reserve(params.acceptTypes.size()); for (size_t i = 0; i < params.acceptTypes.size(); ++i) ipc_params.accept_types.push_back(params.acceptTypes[i]); #if defined(OS_ANDROID) ipc_params.capture = params.capture; #endif return ScheduleFileChooser(ipc_params, chooser_completion); } ",0 "bool OSExchangeDataProviderAura::HasString() const { return (formats_ & OSExchangeData::STRING) != 0; } ",0 "static long region_chg(struct resv_map *resv, long f, long t) { struct list_head *head = &resv->regions; struct file_region *rg, *nrg = NULL; long chg = 0; retry: spin_lock(&resv->lock); retry_locked: resv->adds_in_progress++; /* * Check for sufficient descriptors in the cache to accommodate * the number of in progress add operations. */ if (resv->adds_in_progress > resv->region_cache_count) { struct file_region *trg; VM_BUG_ON(resv->adds_in_progress - resv->region_cache_count > 1); /* Must drop lock to allocate a new descriptor. */ resv->adds_in_progress--; spin_unlock(&resv->lock); trg = kmalloc(sizeof(*trg), GFP_KERNEL); if (!trg) { kfree(nrg); return -ENOMEM; } spin_lock(&resv->lock); list_add(&trg->link, &resv->region_cache); resv->region_cache_count++; goto retry_locked; } /* Locate the region we are before or in. */ list_for_each_entry(rg, head, link) if (f <= rg->to) break; /* If we are below the current region then a new region is required. * Subtle, allocate a new region at the position but make it zero * size such that we can guarantee to record the reservation. */ if (&rg->link == head || t < rg->from) { if (!nrg) { resv->adds_in_progress--; spin_unlock(&resv->lock); nrg = kmalloc(sizeof(*nrg), GFP_KERNEL); if (!nrg) return -ENOMEM; nrg->from = f; nrg->to = f; INIT_LIST_HEAD(&nrg->link); goto retry; } list_add(&nrg->link, rg->link.prev); chg = t - f; goto out_nrg; } /* Round our left edge to the current segment if it encloses us. */ if (f > rg->from) f = rg->from; chg = t - f; /* Check for and consume any regions we now overlap with. */ list_for_each_entry(rg, rg->link.prev, link) { if (&rg->link == head) break; if (rg->from > t) goto out; /* We overlap with this area, if it extends further than * us then we must extend ourselves. Account for its * existing reservation. */ if (rg->to > t) { chg += rg->to - t; t = rg->to; } chg -= rg->to - rg->from; } out: spin_unlock(&resv->lock); /* We already know we raced and no longer need the new region */ kfree(nrg); return chg; out_nrg: spin_unlock(&resv->lock); return chg; } ",0 "bool ACodec::describeColorFormat( const sp &omx, IOMX::node_id node, DescribeColorFormatParams &describeParams) { OMX_INDEXTYPE describeColorFormatIndex; if (omx->getExtensionIndex( node, ""OMX.google.android.index.describeColorFormat"", &describeColorFormatIndex) != OK || omx->getParameter( node, describeColorFormatIndex, &describeParams, sizeof(describeParams)) != OK) { return describeDefaultColorFormat(describeParams); } return describeParams.sMediaImage.mType != MediaImage::MEDIA_IMAGE_TYPE_UNKNOWN; } ",0 " void CopyToOMX(const OMX_BUFFERHEADERTYPE *header) { if (!mIsBackup) { return; } memcpy(header->pBuffer + header->nOffset, (const OMX_U8 *)mMem->pointer() + header->nOffset, header->nFilledLen); } ",0 "V4L2VP9Picture* VP9Picture::AsV4L2VP9Picture() { return nullptr; } ",0 "static int bochs_read(BlockDriverState *bs, int64_t sector_num, uint8_t *buf, int nb_sectors) { int ret; while (nb_sectors > 0) { int64_t block_offset = seek_to_sector(bs, sector_num); if (block_offset >= 0) { ret = bdrv_pread(bs->file, block_offset, buf, 512); if (ret != 512) { return -1; } } else memset(buf, 0, 512); nb_sectors--; sector_num++; buf += 512; } return 0; } ",0 "const char *ssl_get_ciphersuite_name( const int ciphersuite_id ) { switch( ciphersuite_id ) { #if defined(POLARSSL_ARC4_C) case TLS_RSA_WITH_RC4_128_MD5: return( ""TLS-RSA-WITH-RC4-128-MD5"" ); case TLS_RSA_WITH_RC4_128_SHA: return( ""TLS-RSA-WITH-RC4-128-SHA"" ); #endif #if defined(POLARSSL_DES_C) case TLS_RSA_WITH_3DES_EDE_CBC_SHA: return( ""TLS-RSA-WITH-3DES-EDE-CBC-SHA"" ); case TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA: return( ""TLS-DHE-RSA-WITH-3DES-EDE-CBC-SHA"" ); #endif #if defined(POLARSSL_AES_C) case TLS_RSA_WITH_AES_128_CBC_SHA: return( ""TLS-RSA-WITH-AES-128-CBC-SHA"" ); case TLS_DHE_RSA_WITH_AES_128_CBC_SHA: return( ""TLS-DHE-RSA-WITH-AES-128-CBC-SHA"" ); case TLS_RSA_WITH_AES_256_CBC_SHA: return( ""TLS-RSA-WITH-AES-256-CBC-SHA"" ); case TLS_DHE_RSA_WITH_AES_256_CBC_SHA: return( ""TLS-DHE-RSA-WITH-AES-256-CBC-SHA"" ); #if defined(POLARSSL_SHA2_C) case TLS_RSA_WITH_AES_128_CBC_SHA256: return( ""TLS-RSA-WITH-AES-128-CBC-SHA256"" ); case TLS_RSA_WITH_AES_256_CBC_SHA256: return( ""TLS-RSA-WITH-AES-256-CBC-SHA256"" ); case TLS_DHE_RSA_WITH_AES_128_CBC_SHA256: return( ""TLS-DHE-RSA-WITH-AES-128-CBC-SHA256"" ); case TLS_DHE_RSA_WITH_AES_256_CBC_SHA256: return( ""TLS-DHE-RSA-WITH-AES-256-CBC-SHA256"" ); #endif #if defined(POLARSSL_GCM_C) && defined(POLARSSL_SHA2_C) case TLS_RSA_WITH_AES_128_GCM_SHA256: return( ""TLS-RSA-WITH-AES-128-GCM-SHA256"" ); case TLS_RSA_WITH_AES_256_GCM_SHA384: return( ""TLS-RSA-WITH-AES-256-GCM-SHA384"" ); #endif #if defined(POLARSSL_GCM_C) && defined(POLARSSL_SHA4_C) case TLS_DHE_RSA_WITH_AES_128_GCM_SHA256: return( ""TLS-DHE-RSA-WITH-AES-128-GCM-SHA256"" ); case TLS_DHE_RSA_WITH_AES_256_GCM_SHA384: return( ""TLS-DHE-RSA-WITH-AES-256-GCM-SHA384"" ); #endif #endif /* POLARSSL_AES_C */ #if defined(POLARSSL_CAMELLIA_C) case TLS_RSA_WITH_CAMELLIA_128_CBC_SHA: return( ""TLS-RSA-WITH-CAMELLIA-128-CBC-SHA"" ); case TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA: return( ""TLS-DHE-RSA-WITH-CAMELLIA-128-CBC-SHA"" ); case TLS_RSA_WITH_CAMELLIA_256_CBC_SHA: return( ""TLS-RSA-WITH-CAMELLIA-256-CBC-SHA"" ); case TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA: return( ""TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA"" ); #if defined(POLARSSL_SHA2_C) case TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256: return( ""TLS-RSA-WITH-CAMELLIA-128-CBC-SHA256"" ); case TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256: return( ""TLS-DHE-RSA-WITH-CAMELLIA-128-CBC-SHA256"" ); case TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256: return( ""TLS-RSA-WITH-CAMELLIA-256-CBC-SHA256"" ); case TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256: return( ""TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA256"" ); #endif #endif #if defined(POLARSSL_ENABLE_WEAK_CIPHERSUITES) #if defined(POLARSSL_CIPHER_NULL_CIPHER) case TLS_RSA_WITH_NULL_MD5: return( ""TLS-RSA-WITH-NULL-MD5"" ); case TLS_RSA_WITH_NULL_SHA: return( ""TLS-RSA-WITH-NULL-SHA"" ); case TLS_RSA_WITH_NULL_SHA256: return( ""TLS-RSA-WITH-NULL-SHA256"" ); #endif /* defined(POLARSSL_CIPHER_NULL_CIPHER) */ #if defined(POLARSSL_DES_C) case TLS_RSA_WITH_DES_CBC_SHA: return( ""TLS-RSA-WITH-DES-CBC-SHA"" ); case TLS_DHE_RSA_WITH_DES_CBC_SHA: return( ""TLS-DHE-RSA-WITH-DES-CBC-SHA"" ); #endif #endif /* defined(POLARSSL_ENABLE_WEAK_CIPHERSUITES) */ default: break; } return( ""unknown"" ); } ",0 "static int do_recv_NPIdentifier(rpc_message_t *message, void *p_value) { int error; uint32_t id; if ((error = rpc_message_recv_uint32(message, &id)) < 0) return error; NPIdentifier ident = NULL; if (id) { #ifdef BUILD_WRAPPER ident = id_lookup(id); #endif #ifdef BUILD_VIEWER ident = (void *)(uintptr_t)id; #endif assert(ident != NULL); } *((NPIdentifier *)p_value) = ident; return RPC_ERROR_NO_ERROR; } ",0 "static int GetLayersUpdateTimeHistogramBucket(size_t numLayers) { if (numLayers < 10) return 0; if (numLayers < 30) return 1; if (numLayers < 70) return 2; if (numLayers < 150) return 3; return 4; } ",0 "void TopSitesCacheTest::BuildTopSites(const char** spec, size_t size) { std::set urls_seen; for (size_t i = 0; i < size; ++i) { const char* spec_item = spec[i]; while (*spec_item && *spec_item == ' ') // Eat indent. ++spec_item; if (urls_seen.find(spec_item) != urls_seen.end()) NOTREACHED() << ""Duplicate URL found: "" << spec_item; urls_seen.insert(spec_item); if (spec_item == spec[i]) { // No indent: add new MostVisitedURL. base::string16 title(base::ASCIIToUTF16(""Title "") + base::Uint64ToString16(top_sites_.size() + 1)); top_sites_.push_back(MostVisitedURL(GURL(spec_item), title)); } ASSERT_TRUE(!top_sites_.empty()); top_sites_.back().redirects.push_back(GURL(spec_item)); } } ",0 "void SoftVideoDecoderOMXComponent::updatePortDefinitions(bool updateCrop, bool updateInputSize) { OMX_PARAM_PORTDEFINITIONTYPE *outDef = &editPortInfo(kOutputPortIndex)->mDef; outDef->format.video.nFrameWidth = outputBufferWidth(); outDef->format.video.nFrameHeight = outputBufferHeight(); outDef->format.video.nStride = outDef->format.video.nFrameWidth; outDef->format.video.nSliceHeight = outDef->format.video.nFrameHeight; outDef->nBufferSize = (outDef->format.video.nStride * outDef->format.video.nSliceHeight * 3) / 2; OMX_PARAM_PORTDEFINITIONTYPE *inDef = &editPortInfo(kInputPortIndex)->mDef; inDef->format.video.nFrameWidth = mWidth; inDef->format.video.nFrameHeight = mHeight; inDef->format.video.nStride = 0; inDef->format.video.nSliceHeight = 0; if (updateInputSize) { inDef->nBufferSize = max( outDef->nBufferSize / mMinCompressionRatio, max(mMinInputBufferSize, inDef->nBufferSize)); } if (updateCrop) { mCropLeft = 0; mCropTop = 0; mCropWidth = mWidth; mCropHeight = mHeight; } } ",0 "static int pnm_getsint(jas_stream_t *in, int wordsize, int_fast32_t *val) { uint_fast32_t tmpval; if (pnm_getuint(in, wordsize, &tmpval)) { return -1; } if ((tmpval & (1 << (wordsize - 1))) != 0) { jas_eprintf(""PNM decoder does not fully support signed data\n""); return -1; } if (val) { *val = tmpval; } return 0; } ",0 "bool VaapiVideoDecodeAccelerator::VaapiVP9Accelerator::OutputPicture( const scoped_refptr& pic) { scoped_refptr dec_surface = VP9PictureToVaapiDecodeSurface(pic); vaapi_dec_->SurfaceReady(dec_surface); return true; } ",1 "WebContents* SavePackage::web_contents() const { return WebContentsObserver::web_contents(); } ",0 "static void coroutine_fn v9fs_flush(void *opaque) { ssize_t err; int16_t tag; size_t offset = 7; V9fsPDU *cancel_pdu = NULL; V9fsPDU *pdu = opaque; V9fsState *s = pdu->s; err = pdu_unmarshal(pdu, offset, ""w"", &tag); if (err < 0) { pdu_complete(pdu, err); return; } trace_v9fs_flush(pdu->tag, pdu->id, tag); if (pdu->tag == tag) { warn_report(""the guest sent a self-referencing 9P flush request""); } else { QLIST_FOREACH(cancel_pdu, &s->active_list, next) { if (cancel_pdu->tag == tag) { break; } } } if (cancel_pdu) { cancel_pdu->cancelled = 1; /* * Wait for pdu to complete. */ qemu_co_queue_wait(&cancel_pdu->complete, NULL); if (!qemu_co_queue_next(&cancel_pdu->complete)) { cancel_pdu->cancelled = 0; pdu_free(cancel_pdu); } } pdu_complete(pdu, 7); } ",0 "void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) { int need_software_tstamp = sock_flag(sk, SOCK_RCVTSTAMP); struct scm_timestamping tss; int empty = 1; struct skb_shared_hwtstamps *shhwtstamps = skb_hwtstamps(skb); /* Race occurred between timestamp enabling and packet receiving. Fill in the current time for now. */ if (need_software_tstamp && skb->tstamp == 0) __net_timestamp(skb); if (need_software_tstamp) { if (!sock_flag(sk, SOCK_RCVTSTAMPNS)) { struct timeval tv; skb_get_timestamp(skb, &tv); put_cmsg(msg, SOL_SOCKET, SCM_TIMESTAMP, sizeof(tv), &tv); } else { struct timespec ts; skb_get_timestampns(skb, &ts); put_cmsg(msg, SOL_SOCKET, SCM_TIMESTAMPNS, sizeof(ts), &ts); } } memset(&tss, 0, sizeof(tss)); if ((sk->sk_tsflags & SOF_TIMESTAMPING_SOFTWARE) && ktime_to_timespec_cond(skb->tstamp, tss.ts + 0)) empty = 0; if (shhwtstamps && (sk->sk_tsflags & SOF_TIMESTAMPING_RAW_HARDWARE) && ktime_to_timespec_cond(shhwtstamps->hwtstamp, tss.ts + 2)) empty = 0; if (!empty) { put_cmsg(msg, SOL_SOCKET, SCM_TIMESTAMPING, sizeof(tss), &tss); if (skb_is_err_queue(skb) && skb->len && (sk->sk_tsflags & SOF_TIMESTAMPING_OPT_STATS)) put_cmsg(msg, SOL_SOCKET, SCM_TIMESTAMPING_OPT_STATS, skb->len, skb->data); } } ",1 "void ManualFillingControllerImpl::RefreshSuggestionsForField( bool is_fillable, const AccessorySheetData& accessory_sheet_data) { view_->OnItemsAvailable(accessory_sheet_data); if (is_fillable) { view_->SwapSheetWithKeyboard(); } else { view_->CloseAccessorySheet(); } } ",0 "ssl_cb_verify (int ok, X509_STORE_CTX * ctx) { char subject[256]; char issuer[256]; char buf[512]; X509_NAME_oneline (X509_get_subject_name (ctx->current_cert), subject, sizeof (subject)); X509_NAME_oneline (X509_get_issuer_name (ctx->current_cert), issuer, sizeof (issuer)); snprintf (buf, sizeof (buf), ""* Subject: %s"", subject); EMIT_SIGNAL (XP_TE_SSLMESSAGE, g_sess, buf, NULL, NULL, NULL, 0); snprintf (buf, sizeof (buf), ""* Issuer: %s"", issuer); EMIT_SIGNAL (XP_TE_SSLMESSAGE, g_sess, buf, NULL, NULL, NULL, 0); return (TRUE); /* always ok */ } ",0 "static int __init multi_init(void) { int ret, i; struct pci_dev *dev = NULL; if(fcr_count==0) { for(i=0;i<256;i++) { fcr_arr[i] = 0x01; } } if(deep_count==0) { for(i=0;i<256;i++) { deep[i] = 1; } } if(rtr_count==0) { for(i=0;i<256;i++) { rtr[i] = 0x10; } } if(ttr_count==0) { for(i=0;i<256;i++) { ttr[i] = 0x38; } } printk(""MULTI INIT\n""); for( i=0; i< mp_nrpcibrds; i++) { while( (dev = pci_get_device(mp_pciboards[i].vendor_id, mp_pciboards[i].device_id, dev) ) ) { printk(""FOUND~~~\n""); { int status; pci_disable_device(dev); status = pci_enable_device(dev); if (status != 0) { printk(""Multiport Board Enable Fail !\n\n""); status = -ENXIO; return status; } } init_mp_dev(dev, mp_pciboards[i]); } } for (i = 0; i < NR_IRQS; i++) spin_lock_init(&irq_lists[i].lock); ret = mp_register_driver(&multi_reg); if (ret >= 0) multi_register_ports(&multi_reg); return ret; } ",0 "dbus_service_name_handler(vector_t *strvec) { FREE_PTR(global_data->dbus_service_name); global_data->dbus_service_name = set_value(strvec); } ",0 " virtual void TearDown() { session_.reset(); context_.reset(); } ",0 " void loadHTML(const WebData& html) { m_frame->loadHTMLString(html, toKURL(""about:blank"")); runPendingTasks(); } ",0 "void HTMLFormControlElement::ancestorDisabledStateWasChanged() { m_ancestorDisabledState = AncestorDisabledStateUnknown; disabledAttributeChanged(); } ",0 " content::ServiceWorkerContext* GetServiceWorkerContext() { return content::BrowserContext::GetDefaultStoragePartition( browser()->profile()) ->GetServiceWorkerContext(); } ",0 "void TabStripModel::ToggleSelectionAt(int index) { DCHECK(ContainsIndex(index)); TabStripSelectionModel new_model; new_model.Copy(selection_model()); if (selection_model_.IsSelected(index)) { if (selection_model_.size() == 1) { return; } new_model.RemoveIndexFromSelection(index); new_model.set_anchor(index); if (new_model.active() == index || new_model.active() == TabStripSelectionModel::kUnselectedIndex) new_model.set_active(new_model.selected_indices()[0]); } else { new_model.AddIndexToSelection(index); new_model.set_anchor(index); new_model.set_active(index); } SetSelection(new_model, NOTIFY_DEFAULT); } ",0 "static int tg3_init_rings(struct tg3 *tp) { int i; /* Free up all the SKBs. */ tg3_free_rings(tp); for (i = 0; i < tp->irq_cnt; i++) { struct tg3_napi *tnapi = &tp->napi[i]; tnapi->last_tag = 0; tnapi->last_irq_tag = 0; tnapi->hw_status->status = 0; tnapi->hw_status->status_tag = 0; memset(tnapi->hw_status, 0, TG3_HW_STATUS_SIZE); tnapi->tx_prod = 0; tnapi->tx_cons = 0; if (tnapi->tx_ring) memset(tnapi->tx_ring, 0, TG3_TX_RING_BYTES); tnapi->rx_rcb_ptr = 0; if (tnapi->rx_rcb) memset(tnapi->rx_rcb, 0, TG3_RX_RCB_RING_BYTES(tp)); if (tg3_rx_prodring_alloc(tp, &tnapi->prodring)) { tg3_free_rings(tp); return -ENOMEM; } } return 0; } ",0 "GF_Err lsrc_dump(GF_Box *a, FILE * trace) { GF_LASERConfigurationBox *p = (GF_LASERConfigurationBox *)a; gf_isom_box_dump_start(a, ""LASeRConfigurationBox"", trace); dump_data_attribute(trace, ""LASeRHeader"", p->hdr, p->hdr_size); fprintf(trace, "">""); gf_isom_box_dump_done(""LASeRConfigurationBox"", a, trace); return GF_OK; } ",0 "bool LayoutBlockFlow::hasOverhangingFloat(LayoutBox* layoutBox) { if (!m_floatingObjects || !parent()) return false; const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); FloatingObjectSetIterator it = floatingObjectSet.find(layoutBox); if (it == floatingObjectSet.end()) return false; return logicalBottomForFloat(*it->get()) > logicalHeight(); } ",0 "static inline uint32_t __nlm_alloc_pid(struct nlm_host *host) { uint32_t res; do { res = host->h_pidcount++; } while (nlm_pidbusy(host, res) < 0); return res; } ",0 "static void __set_sit_entry_type(struct f2fs_sb_info *sbi, int type, unsigned int segno, int modified) { struct seg_entry *se = get_seg_entry(sbi, segno); se->type = type; if (modified) __mark_sit_entry_dirty(sbi, segno); } ",0 "static void pmcraid_querycfg(struct pmcraid_cmd *cmd) { struct pmcraid_ioarcb *ioarcb = &cmd->ioa_cb->ioarcb; struct pmcraid_ioadl_desc *ioadl = ioarcb->add_data.u.ioadl; struct pmcraid_instance *pinstance = cmd->drv_inst; int cfg_table_size = cpu_to_be32(sizeof(struct pmcraid_config_table)); if (be16_to_cpu(pinstance->inq_data->fw_version) <= PMCRAID_FW_VERSION_1) pinstance->config_table_entry_size = sizeof(struct pmcraid_config_table_entry); else pinstance->config_table_entry_size = sizeof(struct pmcraid_config_table_entry_ext); ioarcb->request_type = REQ_TYPE_IOACMD; ioarcb->resource_handle = cpu_to_le32(PMCRAID_IOA_RES_HANDLE); ioarcb->cdb[0] = PMCRAID_QUERY_IOA_CONFIG; /* firmware requires 4-byte length field, specified in B.E format */ memcpy(&(ioarcb->cdb[10]), &cfg_table_size, sizeof(cfg_table_size)); /* Since entire config table can be described by single IOADL, it can * be part of IOARCB itself */ ioarcb->ioadl_bus_addr = cpu_to_le64((cmd->ioa_cb_bus_addr) + offsetof(struct pmcraid_ioarcb, add_data.u.ioadl[0])); ioarcb->ioadl_length = cpu_to_le32(sizeof(struct pmcraid_ioadl_desc)); ioarcb->ioarcb_bus_addr &= ~(0x1FULL); ioarcb->request_flags0 |= NO_LINK_DESCS; ioarcb->data_transfer_length = cpu_to_le32(sizeof(struct pmcraid_config_table)); ioadl = &(ioarcb->add_data.u.ioadl[0]); ioadl->flags = IOADL_FLAGS_LAST_DESC; ioadl->address = cpu_to_le64(pinstance->cfg_table_bus_addr); ioadl->data_len = cpu_to_le32(sizeof(struct pmcraid_config_table)); pmcraid_send_cmd(cmd, pmcraid_init_res_table, PMCRAID_INTERNAL_TIMEOUT, pmcraid_timeout_handler); } ",0 "bool ContentSecurityPolicy::allowScriptFromSource( const KURL& url, const String& nonce, ParserDisposition parserDisposition, RedirectStatus redirectStatus, SecurityViolationReportingPolicy reportingPolicy) const { if (shouldBypassContentSecurityPolicy(url)) { UseCounter::count( document(), parserDisposition == ParserInserted ? UseCounter::ScriptWithCSPBypassingSchemeParserInserted : UseCounter::ScriptWithCSPBypassingSchemeNotParserInserted); } return isAllowedByAll<&CSPDirectiveList::allowScriptFromSource>( m_policies, url, nonce, parserDisposition, redirectStatus, reportingPolicy); } ",0 "char *jas_stream_gets(jas_stream_t *stream, char *buf, int bufsize) { int c; char *bufptr; assert(bufsize > 0); bufptr = buf; while (bufsize > 1) { if ((c = jas_stream_getc(stream)) == EOF) { break; } *bufptr++ = c; --bufsize; if (c == '\n') { break; } } *bufptr = '\0'; return buf; } ",0 "String FrameFetchContext::GetUserAgent() const { if (IsDetached()) return frozen_state_->user_agent; return GetFrame()->Loader().UserAgent(); } ",0 "png_handle_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) { unsigned int num, i; png_uint_16 readbuf[PNG_MAX_PALETTE_LENGTH]; png_debug(1, ""in png_handle_hIST""); if (!(png_ptr->mode & PNG_HAVE_IHDR)) png_error(png_ptr, ""Missing IHDR before hIST""); else if (png_ptr->mode & PNG_HAVE_IDAT) { png_warning(png_ptr, ""Invalid hIST after IDAT""); png_crc_finish(png_ptr, length); return; } else if (!(png_ptr->mode & PNG_HAVE_PLTE)) { png_warning(png_ptr, ""Missing PLTE before hIST""); png_crc_finish(png_ptr, length); return; } else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST)) { png_warning(png_ptr, ""Duplicate hIST chunk""); png_crc_finish(png_ptr, length); return; } if (length > 2*PNG_MAX_PALETTE_LENGTH || length != (unsigned int) (2*png_ptr->num_palette)) { png_warning(png_ptr, ""Incorrect hIST chunk length""); png_crc_finish(png_ptr, length); return; } num = length / 2 ; for (i = 0; i < num; i++) { png_byte buf[2]; png_crc_read(png_ptr, buf, 2); readbuf[i] = png_get_uint_16(buf); } if (png_crc_finish(png_ptr, 0)) return; png_set_hIST(png_ptr, info_ptr, readbuf); } ",0 "av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx) { ff_dsputil_init(c, avctx); } ",0 "static void apic_manage_nmi_watchdog(struct kvm_lapic *apic, u32 lvt0_val) { int nmi_wd_enabled = apic_lvt_nmi_mode(kvm_apic_get_reg(apic, APIC_LVT0)); if (apic_lvt_nmi_mode(lvt0_val)) { if (!nmi_wd_enabled) { apic_debug(""Receive NMI setting on APIC_LVT0 "" ""for cpu %d\n"", apic->vcpu->vcpu_id); apic->vcpu->kvm->arch.vapics_in_nmi_mode++; } } else if (nmi_wd_enabled) apic->vcpu->kvm->arch.vapics_in_nmi_mode--; } ",0 "static int _php_pgsql_link_has_results(PGconn *pgsql) /* {{{ */ { PGresult *result; while ((result = PQgetResult(pgsql))) { PQclear(result); return 1; } return 0; } /* }}} */ ",0 "static AppLayerProtoDetectProbingParserElement *AppLayerProtoDetectProbingParserElementAlloc(void) { SCEnter(); AppLayerProtoDetectProbingParserElement *p = SCMalloc(sizeof(AppLayerProtoDetectProbingParserElement)); if (unlikely(p == NULL)) { exit(EXIT_FAILURE); } memset(p, 0, sizeof(AppLayerProtoDetectProbingParserElement)); SCReturnPtr(p, ""AppLayerProtoDetectProbingParserElement""); } ",0 "WORD32 ih264d_parse_sei(dec_struct_t * ps_dec, dec_bit_stream_t * ps_bitstrm) { UNUSED(ps_dec); UNUSED(ps_bitstrm); return (0); } ",0 "static void unix_detach_fds(struct scm_cookie *scm, struct sk_buff *skb) { int i; scm->fp = UNIXCB(skb).fp; UNIXCB(skb).fp = NULL; for (i = scm->fp->count-1; i >= 0; i--) unix_notinflight(scm->fp->fp[i]); } ",1 "bool Texture::AllocateStorage(const gfx::Size& size, GLenum format) { DCHECK_NE(id_, 0u); ScopedGLErrorSuppressor suppressor(decoder_); ScopedTexture2DBinder binder(decoder_, id_); WrappedTexImage2D(GL_TEXTURE_2D, 0, // mip level format, size.width(), size.height(), 0, // border format, GL_UNSIGNED_BYTE, NULL); size_ = size; bool success = glGetError() == GL_NO_ERROR; if (success) { uint32 image_size = 0; GLES2Util::ComputeImageDataSize( size.width(), size.height(), format, GL_UNSIGNED_BYTE, 4, &image_size); estimated_size_ = image_size; decoder_->UpdateBackbufferMemoryAccounting(); } return success; } ",0 "static char *addr_to_string(const char *format, struct sockaddr_storage *sa, socklen_t salen) { char *addr; char host[NI_MAXHOST]; char serv[NI_MAXSERV]; int err; size_t addrlen; if ((err = getnameinfo((struct sockaddr *)sa, salen, host, sizeof(host), serv, sizeof(serv), NI_NUMERICHOST | NI_NUMERICSERV)) != 0) { VNC_DEBUG(""Cannot resolve address %d: %s\n"", err, gai_strerror(err)); return NULL; } /* Enough for the existing format + the 2 vars we're * substituting in. */ addrlen = strlen(format) + strlen(host) + strlen(serv); addr = g_malloc(addrlen + 1); snprintf(addr, addrlen, format, host, serv); addr[addrlen] = '\0'; return addr; } ",0 "pick_next_entity(struct cfs_rq *cfs_rq, struct sched_entity *curr) { struct sched_entity *left = __pick_first_entity(cfs_rq); struct sched_entity *se; /* * If curr is set we have to see if its left of the leftmost entity * still in the tree, provided there was anything in the tree at all. */ if (!left || (curr && entity_before(curr, left))) left = curr; se = left; /* ideally we run the leftmost entity */ /* * Avoid running the skip buddy, if running something else can * be done without getting too unfair. */ if (cfs_rq->skip == se) { struct sched_entity *second; if (se == curr) { second = __pick_first_entity(cfs_rq); } else { second = __pick_next_entity(se); if (!second || (curr && entity_before(curr, second))) second = curr; } if (second && wakeup_preempt_entity(second, left) < 1) se = second; } /* * Prefer last buddy, try to return the CPU to a preempted task. */ if (cfs_rq->last && wakeup_preempt_entity(cfs_rq->last, left) < 1) se = cfs_rq->last; /* * Someone really wants this to run. If it's not unfair, run it. */ if (cfs_rq->next && wakeup_preempt_entity(cfs_rq->next, left) < 1) se = cfs_rq->next; clear_buddies(cfs_rq, se); return se; } ",0 " virtual void TearDown() { vpx_free(src_); delete[] ref_; vpx_free(sec_); libvpx_test::ClearSystemState(); } ",1 "NO_INLINE JsVar *jspeExpressionOrArrowFunction() { JsVar *a = 0; JsVar *funcVar = 0; bool allNames = true; while (lex->tk!=')' && !JSP_SHOULDNT_PARSE) { if (allNames && a) { funcVar = jspeAddNamedFunctionParameter(funcVar, a); } jsvUnLock(a); a = jspeAssignmentExpression(); if (!(jsvIsName(a) && jsvIsString(a))) allNames = false; if (lex->tk!=')') JSP_MATCH_WITH_CLEANUP_AND_RETURN(',', jsvUnLock2(a,funcVar), 0); } JSP_MATCH_WITH_CLEANUP_AND_RETURN(')', jsvUnLock2(a,funcVar), 0); if (allNames && lex->tk==LEX_ARROW_FUNCTION) { funcVar = jspeArrowFunction(funcVar, a); jsvUnLock(a); return funcVar; } else { jsvUnLock(funcVar); return a; } } ",0 "static RBinJavaObj * get_java_bin_obj(RAnal *anal) { RBin *b = anal->binb.bin; RBinPlugin *plugin = b->cur && b->cur->o ? b->cur->o->plugin : NULL; ut8 is_java = (plugin && strcmp (plugin->name, ""java"") == 0) ? 1 : 0; return is_java ? b->cur->o->bin_obj : NULL; } ",0 "PassRefPtr ScriptProfiler::takeHeapSnapshot(const String& title, HeapSnapshotProgress* control) { v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::HeapProfiler* profiler = isolate->GetHeapProfiler(); if (!profiler) return 0; v8::HandleScope handleScope(isolate); ASSERT(control); ActivityControlAdapter adapter(control); GlobalObjectNameResolver resolver; const v8::HeapSnapshot* snapshot = profiler->TakeHeapSnapshot(v8String(title, isolate), &adapter, &resolver); return snapshot ? ScriptHeapSnapshot::create(snapshot) : 0; } ",0 "int RenderBox::horizontalScrollbarHeight() const { return includeHorizontalScrollbarSize() ? layer()->horizontalScrollbarHeight() : 0; } ",0 "float BaseRenderingContext2D::GetFontBaseline( const FontMetrics& font_metrics) const { return TextMetrics::GetFontBaseline(GetState().GetTextBaseline(), font_metrics); } ",0 "static bool vmx_get_enable_apicv(void) { return enable_apicv; } ",0 "WindowTreeHostManager::WindowTreeHostManager() : primary_tree_host_for_replace_(nullptr), focus_activation_store_(new FocusActivationStore()), cursor_window_controller_(new CursorWindowController()), mirror_window_controller_(new MirrorWindowController()), cursor_display_id_for_restore_(display::Display::kInvalidDisplayID), weak_ptr_factory_(this) { primary_display_id = display::Display::kInvalidDisplayID; } ",0 " explicit MockFunction(const std::string& name) { set_name(name); } ",0 "static int inet_gro_complete(struct sk_buff *skb, int nhoff) { __be16 newlen = htons(skb->len - nhoff); struct iphdr *iph = (struct iphdr *)(skb->data + nhoff); const struct net_offload *ops; int proto = iph->protocol; int err = -ENOSYS; if (skb->encapsulation) skb_set_inner_network_header(skb, nhoff); csum_replace2(&iph->check, iph->tot_len, newlen); iph->tot_len = newlen; rcu_read_lock(); ops = rcu_dereference(inet_offloads[proto]); if (WARN_ON(!ops || !ops->callbacks.gro_complete)) goto out_unlock; /* Only need to add sizeof(*iph) to get to the next hdr below * because any hdr with option will have been flushed in * inet_gro_receive(). */ err = ops->callbacks.gro_complete(skb, nhoff + sizeof(*iph)); out_unlock: rcu_read_unlock(); return err; } ",0 "static void util_set_pen(wmfAPI * API, wmfDC * dc) { wmf_magick_t *ddata = WMF_MAGICK_GetData(API); wmfPen *pen = 0; double pen_width, pixel_width; unsigned int pen_style, pen_type; pen = WMF_DC_PEN(dc); pen_width = (WMF_PEN_WIDTH(pen) + WMF_PEN_HEIGHT(pen)) / 2; /* Pixel width is inverse of pixel scale */ pixel_width = (((double) 1 / (ddata->scale_x)) + ((double) 1 / (ddata->scale_y))) / 2; /* Don't allow pen_width to be much less than pixel_width in order to avoid dissapearing or spider-web lines */ pen_width = MagickMax(pen_width, pixel_width*0.8); pen_style = (unsigned int) WMF_PEN_STYLE(pen); pen_type = (unsigned int) WMF_PEN_TYPE(pen); (void) pen_type; /* Pen style specified? */ if (pen_style == PS_NULL) { draw_stroke_color_string(WmfDrawingWand,""none""); return; } DrawSetStrokeAntialias(WmfDrawingWand, MagickTrue ); DrawSetStrokeWidth(WmfDrawingWand, (unsigned long) MagickMax(0.0, pen_width)); { LineCap linecap; switch ((unsigned int) WMF_PEN_ENDCAP(pen)) { case PS_ENDCAP_SQUARE: linecap = SquareCap; break; case PS_ENDCAP_ROUND: linecap = RoundCap; break; case PS_ENDCAP_FLAT: default: linecap = ButtCap; break; } DrawSetStrokeLineCap(WmfDrawingWand, linecap); } { LineJoin linejoin; switch ((unsigned int) WMF_PEN_JOIN(pen)) { case PS_JOIN_BEVEL: linejoin = BevelJoin; break; case PS_JOIN_ROUND: linejoin = RoundJoin; break; case PS_JOIN_MITER: default: linejoin = MiterJoin; break; } DrawSetStrokeLineJoin(WmfDrawingWand,linejoin); } { double dasharray[7]; switch (pen_style) { case PS_DASH: /* ------- */ { /* Pattern 18,7 */ dasharray[0] = pixel_width * 18; dasharray[1] = pixel_width * 7; dasharray[2] = 0; DrawSetStrokeAntialias(WmfDrawingWand,MagickFalse); (void) DrawSetStrokeDashArray(WmfDrawingWand,2,dasharray); break; } case PS_ALTERNATE: case PS_DOT: /* ....... */ { /* Pattern 3,3 */ dasharray[0] = pixel_width * 3; dasharray[1] = pixel_width * 3; dasharray[2] = 0; DrawSetStrokeAntialias(WmfDrawingWand,MagickFalse); (void) DrawSetStrokeDashArray(WmfDrawingWand,2,dasharray); break; } case PS_DASHDOT: /* _._._._ */ { /* Pattern 9,6,3,6 */ dasharray[0] = pixel_width * 9; dasharray[1] = pixel_width * 6; dasharray[2] = pixel_width * 3; dasharray[3] = pixel_width * 6; dasharray[4] = 0; DrawSetStrokeAntialias(WmfDrawingWand,MagickFalse); (void) DrawSetStrokeDashArray(WmfDrawingWand,4,dasharray); break; } case PS_DASHDOTDOT: /* _.._.._ */ { /* Pattern 9,3,3,3,3,3 */ dasharray[0] = pixel_width * 9; dasharray[1] = pixel_width * 3; dasharray[2] = pixel_width * 3; dasharray[3] = pixel_width * 3; dasharray[4] = pixel_width * 3; dasharray[5] = pixel_width * 3; dasharray[6] = 0; DrawSetStrokeAntialias(WmfDrawingWand,MagickFalse); (void) DrawSetStrokeDashArray(WmfDrawingWand,6,dasharray); break; } case PS_INSIDEFRAME: /* There is nothing to do in this case... */ case PS_SOLID: default: { (void) DrawSetStrokeDashArray(WmfDrawingWand,0,(double *) NULL); break; } } } draw_stroke_color_rgb(API,WMF_PEN_COLOR(pen)); } ",0 "PHP_FUNCTION(curl_init) { php_curl *ch; CURL *cp; char *url = NULL; size_t url_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), ""|s"", &url, &url_len) == FAILURE) { return; } cp = curl_easy_init(); if (!cp) { php_error_docref(NULL, E_WARNING, ""Could not initialize a new cURL handle""); RETURN_FALSE; } ch = alloc_curl_handle(); ch->cp = cp; ch->handlers->write->method = PHP_CURL_STDOUT; ch->handlers->read->method = PHP_CURL_DIRECT; ch->handlers->write_header->method = PHP_CURL_IGNORE; _php_curl_set_default_options(ch); if (url) { if (php_curl_option_url(ch, url, url_len) == FAILURE) { _php_curl_close_ex(ch); RETURN_FALSE; } } ZEND_REGISTER_RESOURCE(return_value, ch, le_curl); ch->res = Z_RES_P(return_value); } ",0 "static int acquire_in_xmit(struct rds_connection *conn) { return test_and_set_bit(RDS_IN_XMIT, &conn->c_flags) == 0; } ",0 "static void netdev_adjacent_del_links(struct net_device *dev) { struct netdev_adjacent *iter; struct net *net = dev_net(dev); list_for_each_entry(iter, &dev->adj_list.upper, list) { if (!net_eq(net, dev_net(iter->dev))) continue; netdev_adjacent_sysfs_del(iter->dev, dev->name, &iter->dev->adj_list.lower); netdev_adjacent_sysfs_del(dev, iter->dev->name, &dev->adj_list.upper); } list_for_each_entry(iter, &dev->adj_list.lower, list) { if (!net_eq(net, dev_net(iter->dev))) continue; netdev_adjacent_sysfs_del(iter->dev, dev->name, &iter->dev->adj_list.upper); netdev_adjacent_sysfs_del(dev, iter->dev->name, &dev->adj_list.lower); } } ",0 "static int cxusb_dee1601_tuner_attach(struct dvb_usb_adapter *adap) { dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x61, NULL, DVB_PLL_THOMSON_DTT7579); return 0; } ",0 "static int get_valid_interface(struct libusb_device_handle *dev_handle, int api_id) { struct windows_device_handle_priv *handle_priv = _device_handle_priv(dev_handle); struct windows_device_priv *priv = _device_priv(dev_handle->dev); int i; if ((api_id < USB_API_WINUSBX) || (api_id > USB_API_HID)) { usbi_dbg(""unsupported API ID""); return -1; } for (i=0; iinterface_handle[i].dev_handle != 0) && (handle_priv->interface_handle[i].dev_handle != INVALID_HANDLE_VALUE) && (handle_priv->interface_handle[i].api_handle != 0) && (handle_priv->interface_handle[i].api_handle != INVALID_HANDLE_VALUE) && (priv->usb_interface[i].apib->id == api_id) ) { return i; } } return -1; } ",1 " void setGraphicBuffer(const sp &graphicBuffer) { mGraphicBuffer = graphicBuffer; } ",0 " ClientSharedBitmap( scoped_refptr shared_bitmap_allocation_notifier, std::unique_ptr shared_memory_holder, const SharedBitmapId& id, uint32_t sequence_number) : ClientSharedBitmap(std::move(shared_bitmap_allocation_notifier), shared_memory_holder.get(), id, sequence_number) { shared_memory_holder_ = std::move(shared_memory_holder); } ",0 "static int lrw_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) { struct twofish_lrw_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); be128 buf[TWOFISH_PARALLEL_BLOCKS]; struct crypt_priv crypt_ctx = { .ctx = &ctx->twofish_ctx, .fpu_enabled = false, }; struct lrw_crypt_req req = { .tbuf = buf, .tbuflen = sizeof(buf), .table_ctx = &ctx->lrw_table, .crypt_ctx = &crypt_ctx, .crypt_fn = encrypt_callback, }; int ret; desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; ret = lrw_crypt(desc, dst, src, nbytes, &req); twofish_fpu_end(crypt_ctx.fpu_enabled); return ret; } ",0 "static int create_vcpu_fd(struct kvm_vcpu *vcpu) { return anon_inode_getfd(""kvm-vcpu"", &kvm_vcpu_fops, vcpu, O_RDWR | O_CLOEXEC); } ",0 "ssize_t cpu_show_meltdown(struct device *dev, struct device_attribute *attr, char *buf) { return cpu_show_common(dev, attr, buf, X86_BUG_CPU_MELTDOWN); } ",0 "void BrowserRootView::DispatchGestureEvent(ui::GestureEvent* event) { if (event->type() == ui::ET_GESTURE_TAP && event->location().y() <= 0 && event->location().x() <= browser_view_->GetBounds().width()) { TouchUMA::RecordGestureAction(TouchUMA::GESTURE_ROOTVIEWTOP_TAP); } RootView::DispatchGestureEvent(event); } ",0 " virtual void TearDown() { loop_.RunAllPending(); service_.reset(); } ",0 "void Browser::ContentsMouseEvent( WebContents* source, const gfx::Point& location, bool motion) { if (!GetStatusBubble()) return; if (source == chrome::GetActiveWebContents(this)) { GetStatusBubble()->MouseMoved(location, !motion); if (!motion) GetStatusBubble()->SetURL(GURL(), std::string()); } } ",0 "void WebGLRenderingContextBase::framebufferRenderbuffer( GLenum target, GLenum attachment, GLenum renderbuffertarget, WebGLRenderbuffer* buffer) { if (isContextLost() || !ValidateFramebufferFuncParameters( ""framebufferRenderbuffer"", target, attachment)) return; if (renderbuffertarget != GL_RENDERBUFFER) { SynthesizeGLError(GL_INVALID_ENUM, ""framebufferRenderbuffer"", ""invalid target""); return; } if (!ValidateNullableWebGLObject(""framebufferRenderbuffer"", buffer)) return; if (buffer && (!buffer->HasEverBeenBound())) { SynthesizeGLError(GL_INVALID_OPERATION, ""framebufferRenderbuffer"", ""renderbuffer has never been bound""); return; } WebGLFramebuffer* framebuffer_binding = GetFramebufferBinding(target); if (!framebuffer_binding || !framebuffer_binding->Object()) { SynthesizeGLError(GL_INVALID_OPERATION, ""framebufferRenderbuffer"", ""no framebuffer bound""); return; } if (framebuffer_binding && framebuffer_binding->Opaque()) { SynthesizeGLError(GL_INVALID_OPERATION, ""framebufferRenderbuffer"", ""opaque framebuffer bound""); return; } framebuffer_binding->SetAttachmentForBoundFramebuffer(target, attachment, buffer); ApplyStencilTest(); } ",0 "static int tcp_check_dsack(struct sock *sk, const struct sk_buff *ack_skb, struct tcp_sack_block_wire *sp, int num_sacks, u32 prior_snd_una) { struct tcp_sock *tp = tcp_sk(sk); u32 start_seq_0 = get_unaligned_be32(&sp[0].start_seq); u32 end_seq_0 = get_unaligned_be32(&sp[0].end_seq); int dup_sack = 0; if (before(start_seq_0, TCP_SKB_CB(ack_skb)->ack_seq)) { dup_sack = 1; tcp_dsack_seen(tp); NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPDSACKRECV); } else if (num_sacks > 1) { u32 end_seq_1 = get_unaligned_be32(&sp[1].end_seq); u32 start_seq_1 = get_unaligned_be32(&sp[1].start_seq); if (!after(end_seq_0, end_seq_1) && !before(start_seq_0, start_seq_1)) { dup_sack = 1; tcp_dsack_seen(tp); NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPDSACKOFORECV); } } /* D-SACK for already forgotten data... Do dumb counting. */ if (dup_sack && tp->undo_marker && tp->undo_retrans && !after(end_seq_0, prior_snd_una) && after(end_seq_0, tp->undo_marker)) tp->undo_retrans--; return dup_sack; } ",0 "void InlineFlowBox::removeLineBoxFromRenderObject() { toRenderInline(renderer())->lineBoxes()->removeLineBox(this); } ",0 "void HTMLMediaElement::pause() { BLINK_MEDIA_LOG << ""pause("" << (void*)this << "")""; autoplay_policy_->StopAutoplayMutedWhenVisible(); PauseInternal(); } ",0 "void netlink_clear_multicast_users(struct sock *ksk, unsigned int group) { netlink_table_grab(); __netlink_clear_multicast_users(ksk, group); netlink_table_ungrab(); } ",0 "call_transmit_status(struct rpc_task *task) { task->tk_action = call_status; /* * Common case: success. Force the compiler to put this * test first. */ if (task->tk_status == 0) { xprt_end_transmit(task); rpc_task_force_reencode(task); return; } switch (task->tk_status) { case -EAGAIN: break; default: dprint_status(task); xprt_end_transmit(task); rpc_task_force_reencode(task); break; /* * Special cases: if we've been waiting on the * socket's write_space() callback, or if the * socket just returned a connection error, * then hold onto the transport lock. */ case -ECONNREFUSED: case -EHOSTDOWN: case -EHOSTUNREACH: case -ENETUNREACH: if (RPC_IS_SOFTCONN(task)) { xprt_end_transmit(task); rpc_exit(task, task->tk_status); break; } case -ECONNRESET: case -ENOTCONN: case -EPIPE: rpc_task_force_reencode(task); } } ",0 "static int __netdev_upper_dev_link(struct net_device *dev, struct net_device *upper_dev, bool master, void *upper_priv, void *upper_info) { struct netdev_notifier_changeupper_info changeupper_info; struct netdev_adjacent *i, *j, *to_i, *to_j; int ret = 0; ASSERT_RTNL(); if (dev == upper_dev) return -EBUSY; /* To prevent loops, check if dev is not upper device to upper_dev. */ if (__netdev_find_adj(dev, &upper_dev->all_adj_list.upper)) return -EBUSY; if (__netdev_find_adj(upper_dev, &dev->adj_list.upper)) return -EEXIST; if (master && netdev_master_upper_dev_get(dev)) return -EBUSY; changeupper_info.upper_dev = upper_dev; changeupper_info.master = master; changeupper_info.linking = true; changeupper_info.upper_info = upper_info; ret = call_netdevice_notifiers_info(NETDEV_PRECHANGEUPPER, dev, &changeupper_info.info); ret = notifier_to_errno(ret); if (ret) return ret; ret = __netdev_adjacent_dev_link_neighbour(dev, upper_dev, upper_priv, master); if (ret) return ret; /* Now that we linked these devs, make all the upper_dev's * all_adj_list.upper visible to every dev's all_adj_list.lower an * versa, and don't forget the devices itself. All of these * links are non-neighbours. */ list_for_each_entry(i, &dev->all_adj_list.lower, list) { list_for_each_entry(j, &upper_dev->all_adj_list.upper, list) { pr_debug(""Interlinking %s with %s, non-neighbour\n"", i->dev->name, j->dev->name); ret = __netdev_adjacent_dev_link(i->dev, j->dev); if (ret) goto rollback_mesh; } } /* add dev to every upper_dev's upper device */ list_for_each_entry(i, &upper_dev->all_adj_list.upper, list) { pr_debug(""linking %s's upper device %s with %s\n"", upper_dev->name, i->dev->name, dev->name); ret = __netdev_adjacent_dev_link(dev, i->dev); if (ret) goto rollback_upper_mesh; } /* add upper_dev to every dev's lower device */ list_for_each_entry(i, &dev->all_adj_list.lower, list) { pr_debug(""linking %s's lower device %s with %s\n"", dev->name, i->dev->name, upper_dev->name); ret = __netdev_adjacent_dev_link(i->dev, upper_dev); if (ret) goto rollback_lower_mesh; } ret = call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, dev, &changeupper_info.info); ret = notifier_to_errno(ret); if (ret) goto rollback_lower_mesh; return 0; rollback_lower_mesh: to_i = i; list_for_each_entry(i, &dev->all_adj_list.lower, list) { if (i == to_i) break; __netdev_adjacent_dev_unlink(i->dev, upper_dev); } i = NULL; rollback_upper_mesh: to_i = i; list_for_each_entry(i, &upper_dev->all_adj_list.upper, list) { if (i == to_i) break; __netdev_adjacent_dev_unlink(dev, i->dev); } i = j = NULL; rollback_mesh: to_i = i; to_j = j; list_for_each_entry(i, &dev->all_adj_list.lower, list) { list_for_each_entry(j, &upper_dev->all_adj_list.upper, list) { if (i == to_i && j == to_j) break; __netdev_adjacent_dev_unlink(i->dev, j->dev); } if (i == to_i) break; } __netdev_adjacent_dev_unlink_neighbour(dev, upper_dev); return ret; } ",0 "void HTMLMediaElement::textTrackModeChanged(TextTrack* track) { if (track->trackType() == TextTrack::TrackElement) track->setHasBeenConfigured(true); configureTextTrackDisplay(); DCHECK(textTracks()->contains(track)); textTracks()->scheduleChangeEvent(); } ",0 "IntRect PaintLayerScrollableArea::PaintLayerScrollableArea::CornerRect( const IntRect& bounds) const { int horizontal_thickness; int vertical_thickness; if (!VerticalScrollbar() && !HorizontalScrollbar()) { horizontal_thickness = GetPageScrollbarTheme().ScrollbarThickness(); vertical_thickness = horizontal_thickness; } else if (VerticalScrollbar() && !HorizontalScrollbar()) { horizontal_thickness = VerticalScrollbar()->ScrollbarThickness(); vertical_thickness = horizontal_thickness; } else if (HorizontalScrollbar() && !VerticalScrollbar()) { vertical_thickness = HorizontalScrollbar()->ScrollbarThickness(); horizontal_thickness = vertical_thickness; } else { horizontal_thickness = VerticalScrollbar()->ScrollbarThickness(); vertical_thickness = HorizontalScrollbar()->ScrollbarThickness(); } return IntRect(CornerStart(*GetLayoutBox(), bounds.X(), bounds.MaxX(), horizontal_thickness), bounds.MaxY() - vertical_thickness - GetLayoutBox()->StyleRef().BorderBottomWidth(), horizontal_thickness, vertical_thickness); } ",0 " BufferMeta(const sp &graphicBuffer, OMX_U32 portIndex) : mGraphicBuffer(graphicBuffer), mCopyFromOmx(false), mCopyToOmx(false), mPortIndex(portIndex), mBackup(NULL) { } ",0 "bool imap_code(const char *s) { return (cmd_status(s) == IMAP_CMD_OK); } ",0 "void __init *set_except_vector(int n, void *addr) { unsigned long handler = (unsigned long) addr; unsigned long old_handler = exception_handlers[n]; exception_handlers[n] = handler; if (n == 0 && cpu_has_divec) { unsigned long jump_mask = ~((1 << 28) - 1); u32 *buf = (u32 *)(ebase + 0x200); unsigned int k0 = 26; if ((handler & jump_mask) == ((ebase + 0x200) & jump_mask)) { uasm_i_j(&buf, handler & ~jump_mask); uasm_i_nop(&buf); } else { UASM_i_LA(&buf, k0, handler); uasm_i_jr(&buf, k0); uasm_i_nop(&buf); } local_flush_icache_range(ebase + 0x200, (unsigned long)buf); } return (void *)old_handler; } ",0 "void Browser::RegisterProtocolHandler(WebContents* web_contents, const std::string& protocol, const GURL& url, const string16& title, bool user_gesture) { RegisterProtocolHandlerHelper( web_contents, protocol, url, title, user_gesture, window()); } ",0 "static gboolean highlight_search_on_timeout(gpointer user_data) { g_timeout = 0; highlight_search(GTK_ENTRY(user_data)); /* returning false will make glib to remove this event */ return false; } ",0 " void PerformTestWithLeftRightRects(const gfx::Size& html_rect_size, const gfx::Rect& copy_rect, const gfx::Size& output_size, const gfx::Size& expected_bitmap_size, bool video_frame) { const gfx::Size box_size(html_rect_size.width() / 2, html_rect_size.height()); SetTestUrl(base::StringPrintf( ""data:text/html,"" ""
"" ""
"" ""
"" """" """", box_size.width(), box_size.height(), box_size.width(), box_size.width(), box_size.height())); SET_UP_SURFACE_OR_PASS_TEST(""\""DONE\""""); if (!ShouldContinueAfterTestURLLoad()) return; RenderWidgetHostViewPort* rwhvp = GetRenderWidgetHostViewPort(); if (video_frame && !rwhvp->CanCopyToVideoFrame()) { #if defined(OS_MACOSX) if (!content::GpuDataManager::GetInstance()->GpuAccessAllowed(NULL)) { LOG(WARNING) << (""Blindly passing this test because copying to "" ""video frames is not supported on this platform.""); return; } #endif NOTREACHED(); } uint32 frame = rwhvp->RendererFrameNumber(); while (!GetRenderWidgetHost()->ScheduleComposite()) GiveItSomeTime(); while (rwhvp->RendererFrameNumber() == frame) GiveItSomeTime(); SkBitmap expected_bitmap; SetupLeftRightBitmap(expected_bitmap_size, &expected_bitmap); SetExpectedCopyFromCompositingSurfaceResult(true, expected_bitmap); base::RunLoop run_loop; if (video_frame) { SetAllowableError(0x10); SetExcludeRect( gfx::Rect(output_size.width() / 2 - 1, 0, 2, output_size.height())); scoped_refptr video_frame = media::VideoFrame::CreateFrame(media::VideoFrame::YV12, expected_bitmap_size, gfx::Rect(expected_bitmap_size), expected_bitmap_size, base::TimeDelta()); base::Callback callback = base::Bind(&CompositingRenderWidgetHostViewBrowserTestTabCapture:: CopyFromCompositingSurfaceCallbackForVideo, base::Unretained(this), video_frame, run_loop.QuitClosure()); rwhvp->CopyFromCompositingSurfaceToVideoFrame(copy_rect, video_frame, callback); } else { #if defined(USE_AURA) if (!content::GpuDataManager::GetInstance() ->CanUseGpuBrowserCompositor()) { SetAllowableError(2); SetExcludeRect( gfx::Rect(output_size.width() / 2 - 1, 0, 2, output_size.height())); } #endif base::Callback callback = base::Bind(&CompositingRenderWidgetHostViewBrowserTestTabCapture:: CopyFromCompositingSurfaceCallback, base::Unretained(this), run_loop.QuitClosure()); rwhvp->CopyFromCompositingSurface(copy_rect, output_size, callback, SkBitmap::kARGB_8888_Config); } run_loop.Run(); } ",0 "apr_table_t *h2_stream_get_trailers(h2_stream *stream) { return NULL; } ",0 " TouchSelectionControllerClientTestWrapper* selection_controller_client() { return selection_controller_client_; } ",0 "void HTMLFormElement::copyNonAttributePropertiesFromElement( const Element& source) { m_wasDemoted = static_cast(source).m_wasDemoted; HTMLElement::copyNonAttributePropertiesFromElement(source); } ",0 " uint8* ptr() const { return ptr_.get(); } ",0 "void WebContentsImpl::OnWebContentsDestroyed(WebContentsImpl* web_contents) { RemoveDestructionObserver(web_contents); if (web_contents == opener_) { opener_ = NULL; return; } for (PendingContents::iterator iter = pending_contents_.begin(); iter != pending_contents_.end(); ++iter) { if (iter->second != web_contents) continue; pending_contents_.erase(iter); return; } NOTREACHED(); } ",0 "static void asciiFold(char *aOut, const char *aIn, int nByte){ int i; for(i=0; i='A' && c<='Z' ) c += 32; aOut[i] = c; } } ",0 "int main(int argc, char *argv[]) { int i, c, sd; int log_level = LOG_NOTICE; int log_opts = LOG_CONS | LOG_PID; int interval = NOTIFY_INTERVAL; int refresh = REFRESH_INTERVAL; time_t now, rtmo = 0, itmo = 0; while ((c = getopt(argc, argv, ""dhi:r:v"")) != EOF) { switch (c) { case 'd': debug = 1; break; case 'h': return usage(0); case 'i': interval = atoi(optarg); if (interval < 30 || interval > 900) errx(1, ""Invalid announcement interval (30-900).""); break; case 'r': refresh = atoi(optarg); if (refresh < 5 || refresh > 1800) errx(1, ""Invalid refresh interval (5-1800).""); break; case 'v': puts(PACKAGE_VERSION); return 0; default: break; } } signal_init(); if (debug) { log_level = LOG_DEBUG; log_opts |= LOG_PERROR; } openlog(PACKAGE_NAME, log_opts, LOG_DAEMON); setlogmask(LOG_UPTO(log_level)); uuidgen(); lsb_init(); web_init(); sd = multicast_init(); if (sd < 0) err(1, ""Failed creating multicast socket""); while (running) { now = time(NULL); if (rtmo <= now) { if (ssdp_init(sd, &argv[optind], argc - optind) > 0) announce(1); rtmo = now + refresh; } if (itmo <= now) { announce(0); itmo = now + interval; } wait_message(MIN(rtmo, itmo)); } closelog(); return close_socket(); } ",0 " HandleCacheRedirectRequest(const net::test_server::HttpRequest& request) { if (!base::StartsWith(request.relative_url, ""/cached-redirect?"", base::CompareCase::INSENSITIVE_ASCII)) { return std::unique_ptr(); } GURL request_url = request.GetURL(); std::string dest = net::UnescapeBinaryURLComponent(request_url.query_piece()); auto http_response = std::make_unique(); http_response->set_code(net::HTTP_MOVED_PERMANENTLY); http_response->AddCustomHeader(""Location"", dest); http_response->set_content_type(""text/html""); http_response->set_content(base::StringPrintf( ""Redirecting to %s"", dest.c_str())); http_response->AddCustomHeader(""Cache-Control"", ""max-age=6000""); return http_response; } ",0 "void RenderView::OnExecuteCode(const ViewMsg_ExecuteCode_Params& params) { WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL; if (!main_frame) { Send(new ViewMsg_ExecuteCodeFinished(routing_id_, params.request_id, false)); return; } WebDataSource* ds = main_frame->dataSource(); NavigationState* navigation_state = NavigationState::FromDataSource(ds); if (!navigation_state->user_script_idle_scheduler()->has_run()) { pending_code_execution_queue_.push( linked_ptr( new ViewMsg_ExecuteCode_Params(params))); return; } ExecuteCodeImpl(main_frame, params); } ",0 "void VirtualKeyboardController::UpdateDevices() { ui::DeviceDataManager* device_data_manager = ui::DeviceDataManager::GetInstance(); has_touchscreen_ = device_data_manager->touchscreen_devices().size() > 0; has_external_keyboard_ = false; has_internal_keyboard_ = false; for (const ui::KeyboardDevice& device : device_data_manager->keyboard_devices()) { if (has_internal_keyboard_ && has_external_keyboard_) break; ui::InputDeviceType type = device.type; if (type == ui::InputDeviceType::INPUT_DEVICE_INTERNAL) has_internal_keyboard_ = true; if (type == ui::InputDeviceType::INPUT_DEVICE_EXTERNAL) has_external_keyboard_ = true; } UpdateKeyboardEnabled(); } ",0 " static void Ins_LOOPCALL( INS_ARG ) { PCallRecord pTCR; if ( BOUNDS( args[1], CUR.numFDefs ) || !CUR.FDefs[args[1]].Active ) { CUR.error = TT_Err_Invalid_Reference; return; } if ( CUR.callTop >= CUR.callSize ) { CUR.error = TT_Err_Stack_Overflow; return; } if ( args[0] > 0 ) { pTCR = &CUR.callStack[CUR.callTop]; pTCR->Caller_Range = CUR.curRange; pTCR->Caller_IP = CUR.IP + 1; pTCR->Cur_Count = (Int)(args[0]); pTCR->Cur_Restart = CUR.FDefs[args[1]].Start; CUR.callTop++; INS_Goto_CodeRange( CUR.FDefs[args[1]].Range, CUR.FDefs[args[1]].Start ); CUR.step_ins = FALSE; } } ",0 "MetricsWebContentsObserver::NotifyAbortedProvisionalLoadsNewNavigation( content::NavigationHandle* new_navigation, UserInitiatedInfo user_initiated_info) { if (aborted_provisional_loads_.size() == 0) return nullptr; if (aborted_provisional_loads_.size() > 1) RecordInternalError(ERR_NAVIGATION_SIGNALS_MULIPLE_ABORTED_LOADS); std::unique_ptr last_aborted_load = std::move(aborted_provisional_loads_.back()); aborted_provisional_loads_.pop_back(); base::TimeTicks timestamp = new_navigation->NavigationStart(); if (last_aborted_load->IsLikelyProvisionalAbort(timestamp)) { last_aborted_load->UpdatePageEnd( EndReasonForPageTransition(new_navigation->GetPageTransition()), user_initiated_info, timestamp, false); } aborted_provisional_loads_.clear(); return last_aborted_load; } ",0 "void OSExchangeDataProviderWin::SetDragImage( const gfx::ImageSkia& image, const gfx::Vector2d& cursor_offset) { drag_image_ = image; drag_image_offset_ = cursor_offset; } ",0 "size_t Parcel::dataPosition() const { return mDataPos; } ",0 "WORD32 ih264d_init_dec_mb_grp(dec_struct_t *ps_dec) { dec_seq_params_t *ps_seq = ps_dec->ps_cur_sps; UWORD8 u1_frm = ps_seq->u1_frame_mbs_only_flag; ps_dec->u1_recon_mb_grp = ps_dec->u2_frm_wd_in_mbs << ps_seq->u1_mb_aff_flag; ps_dec->u1_recon_mb_grp_pair = ps_dec->u1_recon_mb_grp >> 1; if(!ps_dec->u1_recon_mb_grp) { return ERROR_MB_GROUP_ASSGN_T; } ps_dec->u4_num_mbs_prev_nmb = ps_dec->u1_recon_mb_grp; return OK; } ",0 "static void transit(h2_session *session, const char *action, h2_session_state nstate) { if (session->state != nstate) { int loglvl = APLOG_DEBUG; if ((session->state == H2_SESSION_ST_BUSY && nstate == H2_SESSION_ST_WAIT) || (session->state == H2_SESSION_ST_WAIT && nstate == H2_SESSION_ST_BUSY)){ loglvl = APLOG_TRACE1; } ap_log_cerror(APLOG_MARK, loglvl, 0, session->c, APLOGNO(03078) ""h2_session(%ld): transit [%s] -- %s --> [%s]"", session->id, state_name(session->state), action, state_name(nstate)); session->state = nstate; switch (session->state) { case H2_SESSION_ST_IDLE: update_child_status(session, (session->open_streams == 0? SERVER_BUSY_KEEPALIVE : SERVER_BUSY_READ), ""idle""); break; case H2_SESSION_ST_DONE: update_child_status(session, SERVER_CLOSING, ""done""); break; default: /* nop */ break; } } } ",0 "static void debug_print_fis(uint8_t *fis, int cmd_len) { #ifdef DEBUG_AHCI int i; fprintf(stderr, ""fis:""); for (i = 0; i < cmd_len; i++) { if ((i & 0xf) == 0) { fprintf(stderr, ""\n%02x:"",i); } fprintf(stderr, ""%02x "",fis[i]); } fprintf(stderr, ""\n""); #endif } ",0 "xfs_vm_releasepage( struct page *page, gfp_t gfp_mask) { int delalloc, unwritten; trace_xfs_releasepage(page->mapping->host, page, 0, 0); /* * mm accommodates an old ext3 case where clean pages might not have had * the dirty bit cleared. Thus, it can send actual dirty pages to * ->releasepage() via shrink_active_list(). Conversely, * block_invalidatepage() can send pages that are still marked dirty * but otherwise have invalidated buffers. * * We've historically freed buffers on the latter. Instead, quietly * filter out all dirty pages to avoid spurious buffer state warnings. * This can likely be removed once shrink_active_list() is fixed. */ if (PageDirty(page)) return 0; xfs_count_page_state(page, &delalloc, &unwritten); if (WARN_ON_ONCE(delalloc)) return 0; if (WARN_ON_ONCE(unwritten)) return 0; return try_to_free_buffers(page); } ",0 "static int hugetlb_vm_op_fault(struct vm_area_struct *vma, struct vm_fault *vmf) { BUG(); return 0; } ",0 "static MagickBooleanType ClonePixelCacheOnDisk( CacheInfo *magick_restrict cache_info,CacheInfo *magick_restrict clone_info, ExceptionInfo *exception) { MagickSizeType extent; size_t quantum; ssize_t count; struct stat file_stats; unsigned char *buffer; /* Clone pixel cache on disk with identical morphology. */ if ((OpenPixelCacheOnDisk(cache_info,ReadMode) == MagickFalse) || (OpenPixelCacheOnDisk(clone_info,IOMode) == MagickFalse)) return(MagickFalse); quantum=(size_t) MagickMaxBufferExtent; if ((fstat(cache_info->file,&file_stats) == 0) && (file_stats.st_size > 0)) quantum=(size_t) MagickMin(file_stats.st_size,MagickMaxBufferExtent); buffer=(unsigned char *) AcquireQuantumMemory(quantum,sizeof(*buffer)); if (buffer == (unsigned char *) NULL) ThrowFatalException(ResourceLimitFatalError,""MemoryAllocationFailed""); extent=0; while ((count=read(cache_info->file,buffer,quantum)) > 0) { ssize_t number_bytes; number_bytes=write(clone_info->file,buffer,(size_t) count); if (number_bytes != count) break; extent+=number_bytes; } buffer=(unsigned char *) RelinquishMagickMemory(buffer); if (extent != cache_info->length) return(MagickFalse); return(MagickTrue); } ",0 "static void cirrus_vga_register_types(void) { type_register_static(&isa_cirrus_vga_info); type_register_static(&cirrus_vga_info); } ",0 "void DownloadItemImpl::SetOpened(bool opened) { opened_ = opened; } ",0 "void mp_buf_append(lua_State *L, mp_buf *buf, const unsigned char *s, size_t len) { if (buf->free < len) { size_t newsize = (buf->len+len)*2; buf->b = (unsigned char*)mp_realloc(L, buf->b, buf->len + buf->free, newsize); buf->free = newsize - buf->len; } memcpy(buf->b+buf->len,s,len); buf->len += len; buf->free -= len; } ",0 "xfs_buf_bio_end_io( struct bio *bio, int error) { xfs_buf_t *bp = (xfs_buf_t *)bio->bi_private; /* * don't overwrite existing errors - otherwise we can lose errors on * buffers that require multiple bios to complete. */ if (!bp->b_error) xfs_buf_ioerror(bp, -error); if (!bp->b_error && xfs_buf_is_vmapped(bp) && (bp->b_flags & XBF_READ)) invalidate_kernel_vmap_range(bp->b_addr, xfs_buf_vmap_len(bp)); _xfs_buf_ioend(bp, 1); bio_put(bio); } ",0 "void TestRenderViewHost::SimulateWasShown() { GetWidget()->WasShown(ui::LatencyInfo()); } ",0 "alloc_list (struct net_device *dev) { struct netdev_private *np = netdev_priv(dev); int i; np->cur_rx = np->cur_tx = 0; np->old_rx = np->old_tx = 0; np->rx_buf_sz = (dev->mtu <= 1500 ? PACKET_SIZE : dev->mtu + 32); /* Initialize Tx descriptors, TFDListPtr leaves in start_xmit(). */ for (i = 0; i < TX_RING_SIZE; i++) { np->tx_skbuff[i] = NULL; np->tx_ring[i].status = cpu_to_le64 (TFDDone); np->tx_ring[i].next_desc = cpu_to_le64 (np->tx_ring_dma + ((i+1)%TX_RING_SIZE) * sizeof (struct netdev_desc)); } /* Initialize Rx descriptors */ for (i = 0; i < RX_RING_SIZE; i++) { np->rx_ring[i].next_desc = cpu_to_le64 (np->rx_ring_dma + ((i + 1) % RX_RING_SIZE) * sizeof (struct netdev_desc)); np->rx_ring[i].status = 0; np->rx_ring[i].fraginfo = 0; np->rx_skbuff[i] = NULL; } /* Allocate the rx buffers */ for (i = 0; i < RX_RING_SIZE; i++) { /* Allocated fixed size of skbuff */ struct sk_buff *skb; skb = netdev_alloc_skb_ip_align(dev, np->rx_buf_sz); np->rx_skbuff[i] = skb; if (skb == NULL) { printk (KERN_ERR ""%s: alloc_list: allocate Rx buffer error! "", dev->name); break; } /* Rubicon now supports 40 bits of addressing space. */ np->rx_ring[i].fraginfo = cpu_to_le64 ( pci_map_single ( np->pdev, skb->data, np->rx_buf_sz, PCI_DMA_FROMDEVICE)); np->rx_ring[i].fraginfo |= cpu_to_le64((u64)np->rx_buf_sz << 48); } /* Set RFDListPtr */ writel (np->rx_ring_dma, dev->base_addr + RFDListPtr0); writel (0, dev->base_addr + RFDListPtr1); } ",0 "static int decode_dds1(GetByteContext *gb, uint8_t *frame, int width, int height) { const uint8_t *frame_start = frame; const uint8_t *frame_end = frame + width * height; int mask = 0x10000, bitbuf = 0; int i, v, offset, count, segments; segments = bytestream2_get_le16(gb); while (segments--) { if (bytestream2_get_bytes_left(gb) < 2) return AVERROR_INVALIDDATA; if (mask == 0x10000) { bitbuf = bytestream2_get_le16u(gb); mask = 1; } if (bitbuf & mask) { v = bytestream2_get_le16(gb); offset = (v & 0x1FFF) << 2; count = ((v >> 13) + 2) << 1; if (frame - frame_start < offset || frame_end - frame < count*2 + width) return AVERROR_INVALIDDATA; for (i = 0; i < count; i++) { frame[0] = frame[1] = frame[width] = frame[width + 1] = frame[-offset]; frame += 2; } } else if (bitbuf & (mask << 1)) { v = bytestream2_get_le16(gb)*2; if (frame - frame_end < v) return AVERROR_INVALIDDATA; frame += v; } else { if (frame_end - frame < width + 3) return AVERROR_INVALIDDATA; frame[0] = frame[1] = frame[width] = frame[width + 1] = bytestream2_get_byte(gb); frame += 2; frame[0] = frame[1] = frame[width] = frame[width + 1] = bytestream2_get_byte(gb); frame += 2; } mask <<= 2; } return 0; } ",1 " void Verify_FindMainResponseWithMultipleHits5() { EXPECT_EQ(kFallbackTestUrl, delegate()->found_url_); EXPECT_EQ(kManifestUrl2, delegate()->found_manifest_url_); EXPECT_EQ(2, delegate()->found_cache_id_); EXPECT_EQ(2, delegate()->found_group_id_); EXPECT_FALSE(delegate()->found_entry_.has_response_id()); EXPECT_EQ(2 + kFallbackEntryIdOffset, delegate()->found_fallback_entry_.response_id()); EXPECT_TRUE(delegate()->found_fallback_entry_.IsFallback()); EXPECT_EQ(kEntryUrl2, delegate()->found_namespace_entry_url_); TestFinished(); } ",0 "static void __dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se) { rb_erase_cached(&se->run_node, &cfs_rq->tasks_timeline); } ",0 "static char *ask_new_field(struct chfn_control *ctl, const char *question, char *def_val) { int len; char *ans; char buf[MAX_FIELD_SIZE + 2]; if (!def_val) def_val = """"; while (true) { printf(""%s [%s]: "", question, def_val); __fpurge(stdin); if (fgets(buf, sizeof(buf), stdin) == NULL) errx(EXIT_FAILURE, _(""Aborted."")); ans = buf; /* remove white spaces from string end */ ltrim_whitespace((unsigned char *) ans); len = rtrim_whitespace((unsigned char *) ans); if (len == 0) return xstrdup(def_val); if (!strcasecmp(ans, ""none"")) { ctl->changed = 1; return xstrdup(""""); } if (check_gecos_string(question, ans) >= 0) break; } ctl->changed = 1; return xstrdup(ans); } ",0 "xsltParseExclResultPrefixes(xsltCompilerCtxtPtr cctxt, xmlNodePtr node, xsltPointerListPtr def, int instrCategory) { xsltPointerListPtr list = NULL; xmlChar *value; xmlAttrPtr attr; if ((cctxt == NULL) || (node == NULL)) return(NULL); if (instrCategory == XSLT_ELEMENT_CATEGORY_XSLT) attr = xmlHasNsProp(node, BAD_CAST ""exclude-result-prefixes"", NULL); else attr = xmlHasNsProp(node, BAD_CAST ""exclude-result-prefixes"", XSLT_NAMESPACE); if (attr == NULL) return(def); if (attr && (instrCategory == XSLT_ELEMENT_CATEGORY_LRE)) { /* * Mark the XSLT attr. */ attr->psvi = (void *) xsltXSLTAttrMarker; } if ((attr->children != NULL) && (attr->children->content != NULL)) value = attr->children->content; else { xsltTransformError(NULL, cctxt->style, node, ""Attribute 'exclude-result-prefixes': Invalid value.\n""); cctxt->style->errors++; return(def); } if (xsltParseNsPrefixList(cctxt, cctxt->tmpList, node, BAD_CAST value) != 0) goto exit; if (cctxt->tmpList->number == 0) goto exit; /* * Merge the list with the inherited list. */ list = xsltCompilerUtilsCreateMergedList(def, cctxt->tmpList); if (list == NULL) goto exit; /* * Store the list in the stylesheet/compiler context. */ if (xsltPointerListAddSize( cctxt->psData->exclResultNamespaces, list, 5) == -1) { xsltPointerListFree(list); list = NULL; goto exit; } /* * Notify of change in status wrt namespaces. */ if (cctxt->inode != NULL) cctxt->inode->nsChanged = 1; exit: if (list != NULL) return(list); else return(def); } ",0 "static int pmcraid_reset_bringdown(struct pmcraid_instance *pinstance) { return pmcraid_reset_reload(pinstance, SHUTDOWN_NORMAL, IOA_STATE_UNKNOWN); } ",0 "static int lua_map_handler_fixups(request_rec *r) { /* If there is no handler set yet, this might be a LuaMapHandler request */ if (r->handler == NULL) { int n = 0; ap_regmatch_t match[10]; const ap_lua_dir_cfg *cfg = ap_get_module_config(r->per_dir_config, &lua_module); for (n = 0; n < cfg->mapped_handlers->nelts; n++) { ap_lua_mapped_handler_spec *hook_spec = ((ap_lua_mapped_handler_spec **) cfg->mapped_handlers->elts)[n]; if (hook_spec == NULL) { continue; } if (!ap_regexec(hook_spec->uri_pattern, r->uri, 10, match, 0)) { r->handler = apr_pstrdup(r->pool, ""lua-map-handler""); return OK; } } } return DECLINED; } ",0 "SPL_METHOD(SplObjectStorage, valid) { spl_SplObjectStorage *intern = Z_SPLOBJSTORAGE_P(getThis()); if (zend_parse_parameters_none() == FAILURE) { return; } RETURN_BOOL(zend_hash_has_more_elements_ex(&intern->storage, &intern->pos) == SUCCESS); } /* }}} */ /* {{{ proto mixed SplObjectStorage::key() ",0 "void ExpectChildFrameCollapsed(Shell* shell, const std::string& frame_id, bool expect_collapsed) { ExpectChildFrameSetAsCollapsedInFTN(shell, expect_collapsed); ExpectChildFrameCollapsedInLayout(shell, frame_id, expect_collapsed); } ",0 "void printversion(const unsigned char * resp, int n) { int l; const unsigned char * p; p = resp; DECODELENGTH(l, p); if(resp + n < p + l) { printf(""get version error\n""); } printf(""MiniSSDPd version : %.*s\n"", l, p); } ",0 "void Document::setUseSecureKeyboardEntryWhenActive(bool usesSecureKeyboard) { if (m_useSecureKeyboardEntryWhenActive == usesSecureKeyboard) return; m_useSecureKeyboardEntryWhenActive = usesSecureKeyboard; m_frame->selection()->updateSecureKeyboardEntryIfActive(); } ",0 "void ImeObserver::OnSurroundingTextChanged(const std::string& component_id, const std::string& text, int cursor_pos, int anchor_pos, int offset_pos) { if (extension_id_.empty() || !HasListener(input_ime::OnSurroundingTextChanged::kEventName)) return; input_ime::OnSurroundingTextChanged::SurroundingInfo info; info.text = text; info.focus = cursor_pos; info.anchor = anchor_pos; info.offset = offset_pos; std::unique_ptr args( input_ime::OnSurroundingTextChanged::Create(component_id, info)); DispatchEventToExtension( extensions::events::INPUT_IME_ON_SURROUNDING_TEXT_CHANGED, input_ime::OnSurroundingTextChanged::kEventName, std::move(args)); } ",0 "v8::Local ModuleSystem::RunString(v8::Local code, v8::Local name) { return context_->RunScript( name, code, base::Bind(&ExceptionHandler::HandleUncaughtException, base::Unretained(exception_handler_.get()))); } ",0 "static int isnewline(int c) { return c == 0xA || c == 0xD || c == 0x2028 || c == 0x2029; } ",0 "static void pcrypt_free(struct crypto_instance *inst) { struct pcrypt_instance_ctx *ctx = crypto_instance_ctx(inst); crypto_drop_aead(&ctx->spawn); kfree(inst); } ",1 "static bool EnterSuidSandbox(sandbox::SetuidSandboxClient* setuid_sandbox, base::Closure* post_fork_parent_callback) { DCHECK(setuid_sandbox); DCHECK(setuid_sandbox->IsSuidSandboxChild()); if (!setuid_sandbox->IsSuidSandboxUpToDate()) { LOG(WARNING) << ""You are using a wrong version of the setuid binary!\n"" ""Please read "" ""https://chromium.googlesource.com/chromium/src/+/master/docs/linux_suid_sandbox_development.md."" ""\n\n""; } if (!setuid_sandbox->ChrootMe()) return false; if (setuid_sandbox->IsInNewPIDNamespace()) { CHECK_EQ(1, getpid()) << ""The SUID sandbox created a new PID namespace but Zygote "" ""is not the init process. Please, make sure the SUID "" ""binary is up to date.""; } if (getpid() == 1) { CHECK(CreateInitProcessReaper(post_fork_parent_callback)); } CHECK(SandboxDebugHandling::SetDumpableStatusAndHandlers()); return true; } ",0 "String HTMLInputElement::valueWithDefault() const { String value = this->value(); if (!value.isNull()) return value; return m_inputType->defaultValue(); } ",0 "void RenderViewImpl::OnPpapiBrokerPermissionResult( int request_id, bool result) { pepper_delegate_.OnPpapiBrokerPermissionResult(request_id, result); } ",0 "logger_command_cb (const void *pointer, void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { /* make C compiler happy */ (void) pointer; (void) data; (void) argv_eol; if ((argc == 1) || ((argc == 2) && (weechat_strcasecmp (argv[1], ""list"") == 0))) { logger_list (); return WEECHAT_RC_OK; } if (weechat_strcasecmp (argv[1], ""set"") == 0) { if (argc > 2) logger_set_buffer (buffer, argv[2]); return WEECHAT_RC_OK; } if (weechat_strcasecmp (argv[1], ""flush"") == 0) { logger_flush (); return WEECHAT_RC_OK; } if (weechat_strcasecmp (argv[1], ""disable"") == 0) { logger_set_buffer (buffer, ""0""); return WEECHAT_RC_OK; } WEECHAT_COMMAND_ERROR; } ",0 "bool venc_dev::venc_loaded_start_done() { return true; } ",0 "void VideoCaptureImpl::OnStateChanged(mojom::VideoCaptureState state) { DVLOG(1) << __func__ << "" state: "" << state; DCHECK(io_thread_checker_.CalledOnValidThread()); switch (state) { case mojom::VideoCaptureState::STARTED: state_ = VIDEO_CAPTURE_STATE_STARTED; for (const auto& client : clients_) client.second.state_update_cb.Run(VIDEO_CAPTURE_STATE_STARTED); RequestRefreshFrame(); break; case mojom::VideoCaptureState::STOPPED: state_ = VIDEO_CAPTURE_STATE_STOPPED; client_buffers_.clear(); weak_factory_.InvalidateWeakPtrs(); if (!clients_.empty() || !clients_pending_on_restart_.empty()) RestartCapture(); break; case mojom::VideoCaptureState::PAUSED: for (const auto& client : clients_) client.second.state_update_cb.Run(VIDEO_CAPTURE_STATE_PAUSED); break; case mojom::VideoCaptureState::RESUMED: for (const auto& client : clients_) client.second.state_update_cb.Run(VIDEO_CAPTURE_STATE_RESUMED); break; case mojom::VideoCaptureState::FAILED: for (const auto& client : clients_) client.second.state_update_cb.Run(VIDEO_CAPTURE_STATE_ERROR); clients_.clear(); state_ = VIDEO_CAPTURE_STATE_ERROR; break; case mojom::VideoCaptureState::ENDED: for (const auto& client : clients_) client.second.state_update_cb.Run(VIDEO_CAPTURE_STATE_STOPPED); clients_.clear(); state_ = VIDEO_CAPTURE_STATE_ENDED; break; } } ",0 "bool BackendImpl::CheckEntry(EntryImpl* cache_entry) { bool ok = block_files_.IsValid(cache_entry->entry()->address()); ok = ok && block_files_.IsValid(cache_entry->rankings()->address()); EntryStore* data = cache_entry->entry()->Data(); for (size_t i = 0; i < arraysize(data->data_addr); i++) { if (data->data_addr[i]) { Addr address(data->data_addr[i]); if (address.is_block_file()) ok = ok && block_files_.IsValid(address); } } return ok && cache_entry->rankings()->VerifyHash(); } ",0 "get_global_op_array(const gs_memory_t *mem) { gs_main_instance *minst = get_minst_from_memory(mem); return &minst->i_ctx_p->op_array_table_global; } ",0 "JSTestNamedConstructorConstructor::JSTestNamedConstructorConstructor(Structure* structure, JSDOMGlobalObject* globalObject) : DOMConstructorObject(structure, globalObject) { } ",0 "void ptrace_disable(struct task_struct *child) { /* Nothing to do.. */ } ",0 "static int vfio_pci_set_ctx_trigger_single(struct eventfd_ctx **ctx, unsigned int count, uint32_t flags, void *data) { /* DATA_NONE/DATA_BOOL enables loopback testing */ if (flags & VFIO_IRQ_SET_DATA_NONE) { if (*ctx) { if (count) { eventfd_signal(*ctx, 1); } else { eventfd_ctx_put(*ctx); *ctx = NULL; } return 0; } } else if (flags & VFIO_IRQ_SET_DATA_BOOL) { uint8_t trigger; if (!count) return -EINVAL; trigger = *(uint8_t *)data; if (trigger && *ctx) eventfd_signal(*ctx, 1); return 0; } else if (flags & VFIO_IRQ_SET_DATA_EVENTFD) { int32_t fd; if (!count) return -EINVAL; fd = *(int32_t *)data; if (fd == -1) { if (*ctx) eventfd_ctx_put(*ctx); *ctx = NULL; } else if (fd >= 0) { struct eventfd_ctx *efdctx; efdctx = eventfd_ctx_fdget(fd); if (IS_ERR(efdctx)) return PTR_ERR(efdctx); if (*ctx) eventfd_ctx_put(*ctx); *ctx = efdctx; } return 0; } return -EINVAL; } ",0 "bool HTMLFormControlElement::formNoValidate() const { return fastHasAttribute(formnovalidateAttr); } ",0 "bool Document::HaveImportsLoaded() const { if (!imports_controller_) return true; return !imports_controller_->ShouldBlockScriptExecution(*this); } ",0 "void Com_WriteConfig_f( void ) { char filename[MAX_QPATH]; if ( Cmd_Argc() != 2 ) { Com_Printf( ""Usage: writeconfig \n"" ); return; } Q_strncpyz( filename, Cmd_Argv(1), sizeof( filename ) ); COM_DefaultExtension( filename, sizeof( filename ), "".cfg"" ); Com_Printf( ""Writing %s.\n"", filename ); Com_WriteConfigToFile( filename ); } ",1 "void RenderThread::Resolve(const char* name, size_t length) { return dns_master_->Resolve(name, length); } ",0 "brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, const u8 *mac, struct station_info *sinfo) { struct brcmf_if *ifp = netdev_priv(ndev); struct brcmf_scb_val_le scb_val; s32 err = 0; struct brcmf_sta_info_le sta_info_le; u32 sta_flags; u32 is_tdls_peer; s32 total_rssi; s32 count_rssi; int rssi; u32 i; brcmf_dbg(TRACE, ""Enter, MAC %pM\n"", mac); if (!check_vif_up(ifp->vif)) return -EIO; if (brcmf_is_ibssmode(ifp->vif)) return brcmf_cfg80211_get_station_ibss(ifp, sinfo); memset(&sta_info_le, 0, sizeof(sta_info_le)); memcpy(&sta_info_le, mac, ETH_ALEN); err = brcmf_fil_iovar_data_get(ifp, ""tdls_sta_info"", &sta_info_le, sizeof(sta_info_le)); is_tdls_peer = !err; if (err) { err = brcmf_fil_iovar_data_get(ifp, ""sta_info"", &sta_info_le, sizeof(sta_info_le)); if (err < 0) { brcmf_err(""GET STA INFO failed, %d\n"", err); goto done; } } brcmf_dbg(TRACE, ""version %d\n"", le16_to_cpu(sta_info_le.ver)); sinfo->filled = BIT(NL80211_STA_INFO_INACTIVE_TIME); sinfo->inactive_time = le32_to_cpu(sta_info_le.idle) * 1000; sta_flags = le32_to_cpu(sta_info_le.flags); brcmf_convert_sta_flags(sta_flags, sinfo); sinfo->sta_flags.mask |= BIT(NL80211_STA_FLAG_TDLS_PEER); if (is_tdls_peer) sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_TDLS_PEER); else sinfo->sta_flags.set &= ~BIT(NL80211_STA_FLAG_TDLS_PEER); if (sta_flags & BRCMF_STA_ASSOC) { sinfo->filled |= BIT(NL80211_STA_INFO_CONNECTED_TIME); sinfo->connected_time = le32_to_cpu(sta_info_le.in); brcmf_fill_bss_param(ifp, sinfo); } if (sta_flags & BRCMF_STA_SCBSTATS) { sinfo->filled |= BIT(NL80211_STA_INFO_TX_FAILED); sinfo->tx_failed = le32_to_cpu(sta_info_le.tx_failures); sinfo->filled |= BIT(NL80211_STA_INFO_TX_PACKETS); sinfo->tx_packets = le32_to_cpu(sta_info_le.tx_pkts); sinfo->tx_packets += le32_to_cpu(sta_info_le.tx_mcast_pkts); sinfo->filled |= BIT(NL80211_STA_INFO_RX_PACKETS); sinfo->rx_packets = le32_to_cpu(sta_info_le.rx_ucast_pkts); sinfo->rx_packets += le32_to_cpu(sta_info_le.rx_mcast_pkts); if (sinfo->tx_packets) { sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE); sinfo->txrate.legacy = le32_to_cpu(sta_info_le.tx_rate) / 100; } if (sinfo->rx_packets) { sinfo->filled |= BIT(NL80211_STA_INFO_RX_BITRATE); sinfo->rxrate.legacy = le32_to_cpu(sta_info_le.rx_rate) / 100; } if (le16_to_cpu(sta_info_le.ver) >= 4) { sinfo->filled |= BIT(NL80211_STA_INFO_TX_BYTES); sinfo->tx_bytes = le64_to_cpu(sta_info_le.tx_tot_bytes); sinfo->filled |= BIT(NL80211_STA_INFO_RX_BYTES); sinfo->rx_bytes = le64_to_cpu(sta_info_le.rx_tot_bytes); } total_rssi = 0; count_rssi = 0; for (i = 0; i < BRCMF_ANT_MAX; i++) { if (sta_info_le.rssi[i]) { sinfo->chain_signal_avg[count_rssi] = sta_info_le.rssi[i]; sinfo->chain_signal[count_rssi] = sta_info_le.rssi[i]; total_rssi += sta_info_le.rssi[i]; count_rssi++; } } if (count_rssi) { sinfo->filled |= BIT(NL80211_STA_INFO_CHAIN_SIGNAL); sinfo->chains = count_rssi; sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL); total_rssi /= count_rssi; sinfo->signal = total_rssi; } else if (test_bit(BRCMF_VIF_STATUS_CONNECTED, &ifp->vif->sme_state)) { memset(&scb_val, 0, sizeof(scb_val)); err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI, &scb_val, sizeof(scb_val)); if (err) { brcmf_err(""Could not get rssi (%d)\n"", err); goto done; } else { rssi = le32_to_cpu(scb_val.val); sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL); sinfo->signal = rssi; brcmf_dbg(CONN, ""RSSI %d dBm\n"", rssi); } } } done: brcmf_dbg(TRACE, ""Exit\n""); return err; } ",0 "xsltMergeAttrElemList(xsltStylesheetPtr style, xsltAttrElemPtr list, xsltAttrElemPtr old) { xsltAttrElemPtr cur; int add; while (old != NULL) { if ((old->attr == NULL) && (old->set == NULL)) { old = old->next; continue; } /* * Check that the attribute is not yet in the list */ cur = list; add = 1; while (cur != NULL) { if ((cur->attr == NULL) && (cur->set == NULL)) { if (cur->next == NULL) break; cur = cur->next; continue; } if ((cur->set != NULL) && (cur->set == old->set)) { add = 0; break; } if (cur->set != NULL) { if (cur->next == NULL) break; cur = cur->next; continue; } if (old->set != NULL) { if (cur->next == NULL) break; cur = cur->next; continue; } if (cur->attr == old->attr) { xsltGenericError(xsltGenericErrorContext, ""xsl:attribute-set : use-attribute-sets recursion detected\n""); return(list); } if (cur->next == NULL) break; cur = cur->next; } if (add == 1) { /* * Changed to use the string-dict, rather than duplicating * @set and @ns; this fixes bug #340400. */ if (cur == NULL) { list = xsltNewAttrElem(old->attr); if (old->set != NULL) { list->set = xmlDictLookup(style->dict, old->set, -1); if (old->ns != NULL) list->ns = xmlDictLookup(style->dict, old->ns, -1); } } else if (add) { cur->next = xsltNewAttrElem(old->attr); if (old->set != NULL) { cur->next->set = xmlDictLookup(style->dict, old->set, -1); if (old->ns != NULL) cur->next->ns = xmlDictLookup(style->dict, old->ns, -1); } } } old = old->next; } return(list); } ",0 "vhost_scsi_do_plug(struct vhost_scsi_tpg *tpg, struct se_lun *lun, bool plug) { struct vhost_scsi *vs = tpg->vhost_scsi; struct vhost_virtqueue *vq; u32 reason; if (!vs) return; mutex_lock(&vs->dev.mutex); if (plug) reason = VIRTIO_SCSI_EVT_RESET_RESCAN; else reason = VIRTIO_SCSI_EVT_RESET_REMOVED; vq = &vs->vqs[VHOST_SCSI_VQ_EVT].vq; mutex_lock(&vq->mutex); if (vhost_has_feature(vq, VIRTIO_SCSI_F_HOTPLUG)) vhost_scsi_send_evt(vs, tpg, lun, VIRTIO_SCSI_T_TRANSPORT_RESET, reason); mutex_unlock(&vq->mutex); mutex_unlock(&vs->dev.mutex); } ",0 " virtual void TreeNodesRemoved(TreeModel* model, TreeModelNode* parent, int start, int count) { removed_count_++; } ",1 " void InitializeForSeekableStream(unsigned long resource_id, int range_request_id) { resource_id_ = resource_id; multibyte_response_expected_ = true; channel_->Send(new PluginMsg_HTTPRangeRequestReply( instance_id_, resource_id, range_request_id)); } ",0 "v8::Handle V8TestInterface::wrapSlow(PassRefPtr impl, v8::Isolate* isolate) { v8::Handle wrapper; V8Proxy* proxy = 0; wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl.get()); if (UNLIKELY(wrapper.IsEmpty())) return wrapper; v8::Persistent wrapperHandle = v8::Persistent::New(wrapper); if (!hasDependentLifetime) wrapperHandle.MarkIndependent(); V8DOMWrapper::setJSWrapperForActiveDOMObject(impl, wrapperHandle, isolate); return wrapper; } ",0 " void ChromeContentBrowserClient::UpdateRendererPreferencesForWorker( content::BrowserContext* browser_context, blink::mojom::RendererPreferences* out_prefs) { DCHECK(browser_context); DCHECK(out_prefs); renderer_preferences_util::UpdateFromSystemSettings( out_prefs, Profile::FromBrowserContext(browser_context)); } ",0 "bool Document::needsFullLayoutTreeUpdate() const { if (!isActive() || !view()) return false; if (!m_useElementsNeedingUpdate.isEmpty()) return true; if (!m_layerUpdateSVGFilterElements.isEmpty()) return true; if (needsStyleRecalc()) return true; if (needsStyleInvalidation()) return true; if (childNeedsDistributionRecalc()) return true; if (DocumentAnimations::needsOutdatedAnimationUpdate(*this)) return true; return false; } ",0 "void HomePageUndoBubble::LinkClicked(views::Link* source, int event_flags) { PrefService* prefs = user_prefs::UserPrefs::Get(browser_->profile()); prefs->SetBoolean(prefs::kHomePageIsNewTabPage, undo_value_is_ntp_); prefs->SetString(prefs::kHomePage, undo_url_.spec()); HideBubble(); } ",0 "error::Error GLES2DecoderImpl::HandleVertexAttribDivisorANGLE( uint32 immediate_data_size, const gles2::VertexAttribDivisorANGLE& c) { if (!feature_info_->feature_flags().angle_instanced_arrays) { SetGLError(GL_INVALID_OPERATION, ""glVertexAttribDivisorANGLE: function not available""); } GLuint index = c.index; GLuint divisor = c.divisor; if (index >= group_->max_vertex_attribs()) { SetGLError(GL_INVALID_VALUE, ""glVertexAttribDivisorANGLE: index out of range""); return error::kNoError; } vertex_attrib_manager_->SetDivisor( index, divisor); glVertexAttribDivisorANGLE(index, divisor); return error::kNoError; } ",0 "void BaseArena::removeAllPages() { clearFreeLists(); ASSERT(!m_firstUnsweptPage); while (m_firstPage) { BasePage* page = m_firstPage; page->unlink(&m_firstPage); page->removeFromHeap(); } } ",0 "modify_policy_2_svc(mpol_arg *arg, struct svc_req *rqstp) { static generic_ret ret; char *prime_arg; gss_buffer_desc client_name, service_name; OM_uint32 minor_stat; kadm5_server_handle_t handle; const char *errmsg = NULL; xdr_free(xdr_generic_ret, &ret); if ((ret.code = new_server_handle(arg->api_version, rqstp, &handle))) goto exit_func; if ((ret.code = check_handle((void *)handle))) goto exit_func; ret.api_version = handle->api_version; if (setup_gss_names(rqstp, &client_name, &service_name) < 0) { ret.code = KADM5_FAILURE; goto exit_func; } prime_arg = arg->rec.policy; if (CHANGEPW_SERVICE(rqstp) || !kadm5int_acl_check(handle->context, rqst2name(rqstp), ACL_MODIFY, NULL, NULL)) { log_unauth(""kadm5_modify_policy"", prime_arg, &client_name, &service_name, rqstp); ret.code = KADM5_AUTH_MODIFY; } else { ret.code = kadm5_modify_policy((void *)handle, &arg->rec, arg->mask); if( ret.code != 0 ) errmsg = krb5_get_error_message(handle->context, ret.code); log_done(""kadm5_modify_policy"", ((prime_arg == NULL) ? ""(null)"" : prime_arg), errmsg, &client_name, &service_name, rqstp); if (errmsg != NULL) krb5_free_error_message(handle->context, errmsg); } gss_release_buffer(&minor_stat, &client_name); gss_release_buffer(&minor_stat, &service_name); exit_func: free_server_handle(handle); return &ret; } ",1 "parse_toshiba_packet(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info) { union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header; char line[TOSHIBA_LINE_LENGTH]; int num_items_scanned; int pkt_len, pktnum, hr, min, sec, csec; char channel[10], direction[10]; int i, hex_lines; guint8 *pd; /* Our file pointer should be on the line containing the * summary information for a packet. Read in that line and * extract the useful information */ if (file_gets(line, TOSHIBA_LINE_LENGTH, fh) == NULL) { *err = file_error(fh, err_info); if (*err == 0) { *err = WTAP_ERR_SHORT_READ; } return FALSE; } /* Find text in line after ""[No."". Limit the length of the * two strings since we have fixed buffers for channel[] and * direction[] */ num_items_scanned = sscanf(line, ""%9d] %2d:%2d:%2d.%9d %9s %9s"", &pktnum, &hr, &min, &sec, &csec, channel, direction); if (num_items_scanned != 7) { *err = WTAP_ERR_BAD_FILE; *err_info = g_strdup(""toshiba: record header isn't valid""); return FALSE; } /* Scan lines until we find the OFFSET line. In a ""telnet"" trace, * this will be the next line. But if you save your telnet session * to a file from within a Windows-based telnet client, it may * put in line breaks at 80 columns (or however big your ""telnet"" box * is). CRT (a Windows telnet app from VanDyke) does this. * Here we assume that 80 columns will be the minimum size, and that * the OFFSET line is not broken in the middle. It's the previous * line that is normally long and can thus be broken at column 80. */ do { if (file_gets(line, TOSHIBA_LINE_LENGTH, fh) == NULL) { *err = file_error(fh, err_info); if (*err == 0) { *err = WTAP_ERR_SHORT_READ; } return FALSE; } /* Check for ""OFFSET 0001-0203"" at beginning of line */ line[16] = '\0'; } while (strcmp(line, ""OFFSET 0001-0203"") != 0); num_items_scanned = sscanf(line+64, ""LEN=%9d"", &pkt_len); if (num_items_scanned != 1) { *err = WTAP_ERR_BAD_FILE; *err_info = g_strdup(""toshiba: OFFSET line doesn't have valid LEN item""); return FALSE; } phdr->rec_type = REC_TYPE_PACKET; phdr->presence_flags = WTAP_HAS_TS|WTAP_HAS_CAP_LEN; phdr->ts.secs = hr * 3600 + min * 60 + sec; phdr->ts.nsecs = csec * 10000000; phdr->caplen = pkt_len; phdr->len = pkt_len; switch (channel[0]) { case 'B': phdr->pkt_encap = WTAP_ENCAP_ISDN; pseudo_header->isdn.uton = (direction[0] == 'T'); pseudo_header->isdn.channel = (guint8) strtol(&channel[1], NULL, 10); break; case 'D': phdr->pkt_encap = WTAP_ENCAP_ISDN; pseudo_header->isdn.uton = (direction[0] == 'T'); pseudo_header->isdn.channel = 0; break; default: phdr->pkt_encap = WTAP_ENCAP_ETHERNET; /* XXX - is there an FCS in the frame? */ pseudo_header->eth.fcs_len = -1; break; } /* Make sure we have enough room for the packet */ ws_buffer_assure_space(buf, TOSHIBA_MAX_PACKET_LEN); pd = ws_buffer_start_ptr(buf); /* Calculate the number of hex dump lines, each * containing 16 bytes of data */ hex_lines = pkt_len / 16 + ((pkt_len % 16) ? 1 : 0); for (i = 0; i < hex_lines; i++) { if (file_gets(line, TOSHIBA_LINE_LENGTH, fh) == NULL) { *err = file_error(fh, err_info); if (*err == 0) { *err = WTAP_ERR_SHORT_READ; } return FALSE; } if (!parse_single_hex_dump_line(line, pd, i * 16)) { *err = WTAP_ERR_BAD_FILE; *err_info = g_strdup(""toshiba: hex dump not valid""); return FALSE; } } return TRUE; } ",1 "int main(int argc,char **argv){ pid_t mypid=getpid(); pthread_t counter_thread={0}; int num_cpus=0; int *timerpids; #if TIMERCHECKS int force=0; #endif int testing=0; { while(gettimerpid(NULL,num_cpus)!=-1) num_cpus++; timerpids=malloc(sizeof(int)*num_cpus); { int cpu=0; for(cpu=0;cpu Prints out version.\n"" ""[--test] or [-te] -> Run a test to see if xmessage is working.\n"") { OPTARG(""--verbose"",""-v"") verbose=1; #if TIMERCHECKS OPTARG(""--force"",""-f"") force=1; OPTARG(""--checkirq"",""-c"") checkirq=1; return(checksoftirq(0)); #endif OPTARG(""--increasetime"",""-it"") increasetime=OPTARG_GETINT(); OPTARG(""--checktime"",""-ct"") checktime=OPTARG_GETINT(); OPTARG(""--waittime"",""-wt"") waittime=OPTARG_GETINT(); OPTARG(""--test"",""-te"") testing=1; verbose=1; OPTARG(""--version"",""-ve"") printf(""Das Version die Uhr Hund %s nach sein bist.\n"",VERSION);exit(0); }OPTARGS_END; { openlog(""das_watchdog"", 0, LOG_DAEMON); syslog(LOG_INFO, ""started""); } { #if TIMERCHECKS if(force && checksoftirq(force)<0) return -2; checksoftirq(force); #endif if(getuid()!=0){ print_error(stdout,""Warning, you are not running as root. das_watchdog should be run as an init-script at startup, and not as a normal user.\n""); } if(access(WHICH_XMESSAGE,X_OK)!=0){ print_error(stderr,""Warning, \""xmessage\"" is not found or is not an executable. I will try to use the $PATH instead. Hopefully that'll work,""); print_error(stderr,""but you might not receive messages to the screen in case das_watchdog has to take action.""); xmessage_found=0; } } if(1) { if( ! set_pid_priority(0,SCHED_FIFO,sched_get_priority_max(SCHED_FIFO), ""Unable to set SCHED_FIFO realtime priority for %d (\""%s\""). (%s). Exiting."", ""Der Gewinde nach die Uhr Hund"")) return 0; if(mlockall(MCL_CURRENT|MCL_FUTURE)==-1) print_error(stderr,""Could not call mlockalll(MCL_CURRENT|MCL_FUTURE) (%s)"",strerror(errno)); } { pthread_create(&counter_thread,NULL,counter_func,NULL); } for(;;){ int lastcounter=counter; sleep(checktime); if(verbose) print_error(stderr,"" counter read to be %d (lastcounter=%d)"",counter,lastcounter); if(lastcounter==counter || testing==1){ int changedsched=0; struct proclistlist *pll=pll_create(); int lokke; if(verbose) print_error(stdout,""Die Uhr Hund stossen sein!""); for(lokke=0;lokkelength;lokke++){ if(pll->proclist[lokke].policy!=SCHED_OTHER && pll->proclist[lokke].pid!=mypid && (!is_a_member(pll->proclist[lokke].pid,timerpids,num_cpus)) ) { struct sched_param par={0}; par.sched_priority=0; if(verbose) print_error(stdout,""Setting pid %d temporarily to SCHED_OTHER."",pll->proclist[lokke].pid); if(set_pid_priority(pll->proclist[lokke].pid,SCHED_OTHER,0,""Could not set pid %d (\""%s\"") to SCHED_OTHER (%s).\n"",""no name"")) changedsched++; } } if(changedsched>0 || testing==1){ print_error(NULL,""realtime operations paused for %d seconds."",waittime); if(fork()==0){ xmessage_fork(pll); return 0; } sleep(waittime); for(lokke=0;lokkelength;lokke++){ if(pll->proclist[lokke].policy != SCHED_OTHER && pll->proclist[lokke].pid != mypid && (!is_a_member(pll->proclist[lokke].pid,timerpids,num_cpus)) && pll->proclist[lokke].start_time == get_pid_start_time(pll->proclist[lokke].pid) ) { if(get_pid_priority(pll->proclist[lokke].pid) != 0 || sched_getscheduler(pll->proclist[lokke].pid) != SCHED_OTHER){ print_error(stderr, ""Seems like someone else has changed priority and/or scheduling policy for %d in the mean time. I'm not going to do anything."", pll->proclist[lokke].pid); }else{ struct sched_param par={0}; par.sched_priority=pll->proclist[lokke].priority; if(verbose) print_error(stdout,""Setting pid %d back to realtime priority."",pll->proclist[lokke].pid); set_pid_priority(pll->proclist[lokke].pid,pll->proclist[lokke].policy,pll->proclist[lokke].priority,""Could not set pid %d (\""%s\"") to SCHED_FIFO/SCHED_RR (%s).\n\n"", ""no name""); } } } } pll_delete(pll); } if(testing==1) break; } return 0; } ",0 "MagickExport Cache DestroyPixelCache(Cache cache) { CacheInfo *restrict cache_info; assert(cache != (Cache) NULL); cache_info=(CacheInfo *) cache; assert(cache_info->signature == MagickSignature); if (cache_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"", cache_info->filename); LockSemaphoreInfo(cache_info->semaphore); cache_info->reference_count--; if (cache_info->reference_count != 0) { UnlockSemaphoreInfo(cache_info->semaphore); return((Cache) NULL); } UnlockSemaphoreInfo(cache_info->semaphore); if (cache_info->debug != MagickFalse) { char message[MaxTextExtent]; (void) FormatLocaleString(message,MaxTextExtent,""destroy %s"", cache_info->filename); (void) LogMagickEvent(CacheEvent,GetMagickModule(),""%s"",message); } RelinquishPixelCachePixels(cache_info); if (cache_info->server_info != (DistributeCacheInfo *) NULL) cache_info->server_info=DestroyDistributeCacheInfo((DistributeCacheInfo *) cache_info->server_info); if (cache_info->nexus_info != (NexusInfo **) NULL) cache_info->nexus_info=DestroyPixelCacheNexus(cache_info->nexus_info, cache_info->number_threads); if (cache_info->random_info != (RandomInfo *) NULL) cache_info->random_info=DestroyRandomInfo(cache_info->random_info); if (cache_info->file_semaphore != (SemaphoreInfo *) NULL) DestroySemaphoreInfo(&cache_info->file_semaphore); if (cache_info->semaphore != (SemaphoreInfo *) NULL) DestroySemaphoreInfo(&cache_info->semaphore); cache_info->signature=(~MagickSignature); cache_info=(CacheInfo *) RelinquishMagickMemory(cache_info); cache=(Cache) NULL; return(cache); } ",0 "void RenderFrameImpl::UpdateEncoding(WebFrame* frame, const std::string& encoding_name) { if (!frame->Parent()) GetFrameHost()->UpdateEncoding(encoding_name); } ",0 "InfoBar* ExtensionInfoBarDelegate::CreateInfoBar() { return new ExtensionInfoBar(this); } ",0 "struct wif *net_open(char *iface) { struct wif *wi; struct priv_net *pn; int s; /* setup wi struct */ wi = wi_alloc(sizeof(*pn)); if (!wi) return NULL; wi->wi_read = net_read; wi->wi_write = net_write; wi->wi_set_channel = net_set_channel; wi->wi_get_channel = net_get_channel; wi->wi_set_rate = net_set_rate; wi->wi_get_rate = net_get_rate; wi->wi_close = net_close; wi->wi_fd = net_fd; wi->wi_get_mac = net_get_mac; wi->wi_get_monitor = net_get_monitor; /* setup iface */ s = do_net_open(iface); if (s == -1) { do_net_free(wi); return NULL; } /* setup private state */ pn = wi_priv(wi); pn->pn_s = s; pn->pn_queue.q_next = pn->pn_queue.q_prev = &pn->pn_queue; pn->pn_queue_free.q_next = pn->pn_queue_free.q_prev = &pn->pn_queue_free; return wi; } ",0 "void WebMediaPlayerImpl::SwitchToLocalRenderer( MediaObserverClient::ReasonToSwitchToLocal reason) { DCHECK(main_task_runner_->BelongsToCurrentThread()); DCHECK(disable_pipeline_auto_suspend_); disable_pipeline_auto_suspend_ = false; CreateVideoDecodeStatsReporter(); ScheduleRestart(); if (client_) client_->MediaRemotingStopped(GetSwitchToLocalMessage(reason)); } ",0 "void SpeechSynthesis::didStartSpeaking(PassRefPtr utterance) { if (utterance->client()) fireEvent(EventTypeNames::start, static_cast(utterance->client()), 0, String()); } ",0 "static int timerslack_ns_open(struct inode *inode, struct file *filp) { return single_open(filp, timerslack_ns_show, inode); } ",0 "InlineBoxPosition ComputeInlineBoxPosition(const Position& position, TextAffinity affinity, TextDirection primary_direction) { return ComputeInlineBoxPositionTemplate(position, affinity, primary_direction); } ",0 "void DeepScanningClientResponseToDownloadCheckResult( const DeepScanningClientResponse& response, DownloadCheckResult* download_result, DownloadCheckResultReason* download_reason) { if (response.has_malware_scan_verdict() && response.malware_scan_verdict().verdict() == MalwareDeepScanningVerdict::MALWARE) { *download_result = DownloadCheckResult::DANGEROUS; *download_reason = DownloadCheckResultReason::REASON_DOWNLOAD_DANGEROUS; return; } if (response.has_malware_scan_verdict() && response.malware_scan_verdict().verdict() == MalwareDeepScanningVerdict::UWS) { *download_result = DownloadCheckResult::POTENTIALLY_UNWANTED; *download_reason = DownloadCheckResultReason::REASON_DOWNLOAD_POTENTIALLY_UNWANTED; return; } if (response.has_dlp_scan_verdict()) { bool should_dlp_block = std::any_of( response.dlp_scan_verdict().triggered_rules().begin(), response.dlp_scan_verdict().triggered_rules().end(), [](const DlpDeepScanningVerdict::TriggeredRule& rule) { return rule.action() == DlpDeepScanningVerdict::TriggeredRule::BLOCK; }); if (should_dlp_block) { *download_result = DownloadCheckResult::SENSITIVE_CONTENT_BLOCK; *download_reason = DownloadCheckResultReason::REASON_SENSITIVE_CONTENT_BLOCK; return; } bool should_dlp_warn = std::any_of( response.dlp_scan_verdict().triggered_rules().begin(), response.dlp_scan_verdict().triggered_rules().end(), [](const DlpDeepScanningVerdict::TriggeredRule& rule) { return rule.action() == DlpDeepScanningVerdict::TriggeredRule::WARN; }); if (should_dlp_warn) { *download_result = DownloadCheckResult::SENSITIVE_CONTENT_WARNING; *download_reason = DownloadCheckResultReason::REASON_SENSITIVE_CONTENT_WARNING; return; } } *download_result = DownloadCheckResult::DEEP_SCANNED_SAFE; *download_reason = DownloadCheckResultReason::REASON_DEEP_SCANNED_SAFE; } ",0 "static void deactivate_task(struct rq *rq, struct task_struct *p, int flags) { if (task_contributes_to_load(p)) rq->nr_uninterruptible++; dequeue_task(rq, p, flags); dec_nr_running(rq); } ",0 "static int nfs4_xdr_dec_open_noattr(struct rpc_rqst *rqstp, __be32 *p, struct nfs_openres *res) { struct xdr_stream xdr; struct compound_hdr hdr; int status; xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); status = decode_compound_hdr(&xdr, &hdr); if (status) goto out; status = decode_putfh(&xdr); if (status) goto out; status = decode_open(&xdr, res); if (status) goto out; decode_getfattr(&xdr, res->f_attr, res->server); out: return status; } ",0 "static bool layerNeedsCompositedScrolling(const RenderLayer* layer) { return layer->scrollsOverflow() && layer->compositor()->preferCompositingToLCDTextEnabled() && !layer->hasDescendantWithClipPath() && !layer->hasAncestorWithClipPath(); } ",0 "void ResetScreenHandler::Hide() { DBusThreadManager::Get()->GetUpdateEngineClient()->RemoveObserver(this); } ",0 "std::string GetHostOrSpecFromURL(const GURL& url) { return url.has_host() ? TrimEndingDot(url.host()) : url.spec(); } ",0 "void RenderFrameSubmissionObserver::OnRenderFrameMetadataChanged() { Quit(); } ",0 "static int tty_copy_to_user(struct tty_struct *tty, void __user *to, size_t tail, size_t n) { struct n_tty_data *ldata = tty->disc_data; size_t size = N_TTY_BUF_SIZE - tail; const void *from = read_buf_addr(ldata, tail); int uncopied; if (n > size) { tty_audit_add_data(tty, from, size); uncopied = copy_to_user(to, from, size); if (uncopied) return uncopied; to += size; n -= size; from = ldata->read_buf; } tty_audit_add_data(tty, from, n); return copy_to_user(to, from, n); } ",0 "void PageInfoWindowView::Init(gfx::NativeWindow parent) { #if defined(OS_WIN) DWORD sys_color = ::GetSysColor(COLOR_3DFACE); SkColor color = SkColorSetRGB(GetRValue(sys_color), GetGValue(sys_color), GetBValue(sys_color)); set_background(views::Background::CreateSolidBackground(color)); #endif LayoutSections(); if (opened_window_count_ > 0) { gfx::Rect bounds; bool maximized = false; if (GetSavedWindowBounds(&bounds) && GetSavedMaximizedState(&maximized)) { CalculateWindowBounds(&bounds); SaveWindowPlacement(bounds, maximized); } } views::Window::CreateChromeWindow(parent, gfx::Rect(), this); } ",0 "bool Document::isInInvisibleSubframe() const { if (!ownerElement()) return false; // this is the root element ASSERT(frame()); return !frame()->ownerLayoutObject(); } ",0 "static vpx_codec_err_t ctrl_get_bit_depth(vpx_codec_alg_priv_t *ctx, va_list args) { unsigned int *const bit_depth = va_arg(args, unsigned int *); VPxWorker *const worker = &ctx->frame_workers[ctx->next_output_worker_id]; if (bit_depth) { if (worker) { FrameWorkerData *const frame_worker_data = (FrameWorkerData *)worker->data1; const VP9_COMMON *const cm = &frame_worker_data->pbi->common; *bit_depth = cm->bit_depth; return VPX_CODEC_OK; } else { return VPX_CODEC_ERROR; } } return VPX_CODEC_INVALID_PARAM; } ",0 "http_get_path_from_string(char *str) { char *ptr = str; /* RFC2616, par. 5.1.2 : * Request-URI = ""*"" | absuri | abspath | authority */ if (*ptr == '*') return NULL; if (isalpha((unsigned char)*ptr)) { /* this is a scheme as described by RFC3986, par. 3.1 */ ptr++; while (isalnum((unsigned char)*ptr) || *ptr == '+' || *ptr == '-' || *ptr == '.') ptr++; /* skip '://' */ if (*ptr == '\0' || *ptr++ != ':') return NULL; if (*ptr == '\0' || *ptr++ != '/') return NULL; if (*ptr == '\0' || *ptr++ != '/') return NULL; } /* skip [user[:passwd]@]host[:[port]] */ while (*ptr != '\0' && *ptr != ' ' && *ptr != '/') ptr++; if (*ptr == '\0' || *ptr == ' ') return NULL; /* OK, we got the '/' ! */ return ptr; } ",0 "void DataReductionProxyConfig::HandleWarmupFetcherResponse( const net::ProxyServer& proxy_server, WarmupURLFetcher::FetchResult success_response) { DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(IsFetchInFlight()); base::Optional proxy_type_info = FindConfiguredDataReductionProxy(proxy_server); if (!proxy_type_info && proxy_server.is_valid() && !proxy_server.is_direct()) { return; } bool is_secure_proxy = false; bool is_core_proxy = false; if (proxy_type_info) { DCHECK(proxy_server.is_valid()); DCHECK(!proxy_server.is_direct()); is_secure_proxy = proxy_server.is_https() || proxy_server.is_quic(); is_core_proxy = proxy_type_info->proxy_servers[proxy_type_info->proxy_index] .IsCoreProxy(); DCHECK(GetInFlightWarmupProxyDetails()); DCHECK_EQ(is_secure_proxy, GetInFlightWarmupProxyDetails()->first); DCHECK_EQ(is_core_proxy, GetInFlightWarmupProxyDetails()->second); } else { DCHECK(!proxy_server.is_valid() || proxy_server.is_direct()); is_secure_proxy = warmup_url_fetch_in_flight_secure_proxy_; is_core_proxy = warmup_url_fetch_in_flight_core_proxy_; } if (is_secure_proxy && is_core_proxy) { UMA_HISTOGRAM_BOOLEAN( ""DataReductionProxy.WarmupURLFetcherCallback.SuccessfulFetch."" ""SecureProxy.Core"", success_response == WarmupURLFetcher::FetchResult::kSuccessful); } else if (is_secure_proxy && !is_core_proxy) { UMA_HISTOGRAM_BOOLEAN( ""DataReductionProxy.WarmupURLFetcherCallback.SuccessfulFetch."" ""SecureProxy.NonCore"", success_response == WarmupURLFetcher::FetchResult::kSuccessful); } else if (!is_secure_proxy && is_core_proxy) { UMA_HISTOGRAM_BOOLEAN( ""DataReductionProxy.WarmupURLFetcherCallback.SuccessfulFetch."" ""InsecureProxy.Core"", success_response == WarmupURLFetcher::FetchResult::kSuccessful); } else { UMA_HISTOGRAM_BOOLEAN( ""DataReductionProxy.WarmupURLFetcherCallback.SuccessfulFetch."" ""InsecureProxy.NonCore"", success_response == WarmupURLFetcher::FetchResult::kSuccessful); } bool warmup_url_failed_past = network_properties_manager_->HasWarmupURLProbeFailed(is_secure_proxy, is_core_proxy); network_properties_manager_->SetHasWarmupURLProbeFailed( is_secure_proxy, is_core_proxy, success_response != WarmupURLFetcher::FetchResult::kSuccessful /* warmup failed */); if (warmup_url_failed_past != network_properties_manager_->HasWarmupURLProbeFailed(is_secure_proxy, is_core_proxy)) { ReloadConfig(); } io_task_runner_->PostTask( FROM_HERE, base::BindOnce(&DataReductionProxyConfig::FetchWarmupProbeURL, weak_factory_.GetWeakPtr())); } ",0 " WindowDragResponseTask(AutomationProvider* provider, IPC::Message* reply_message) : provider_(provider), reply_message_(reply_message) { DCHECK(provider_); DCHECK(reply_message_); } ",0 "static void sched_domain_debug(struct sched_domain *sd, int cpu) { cpumask_var_t groupmask; int level = 0; if (!sched_domain_debug_enabled) return; if (!sd) { printk(KERN_DEBUG ""CPU%d attaching NULL sched-domain.\n"", cpu); return; } printk(KERN_DEBUG ""CPU%d attaching sched-domain:\n"", cpu); if (!alloc_cpumask_var(&groupmask, GFP_KERNEL)) { printk(KERN_DEBUG ""Cannot load-balance (out of memory)\n""); return; } for (;;) { if (sched_domain_debug_one(sd, cpu, level, groupmask)) break; level++; sd = sd->parent; if (!sd) break; } free_cpumask_var(groupmask); } ",0 "status_t ACodec::allocateOutputBuffersFromNativeWindow() { OMX_U32 bufferCount, bufferSize, minUndequeuedBuffers; status_t err = configureOutputBuffersFromNativeWindow( &bufferCount, &bufferSize, &minUndequeuedBuffers); if (err != 0) return err; mNumUndequeuedBuffers = minUndequeuedBuffers; if (!storingMetadataInDecodedBuffers()) { static_cast(mNativeWindow.get()) ->getIGraphicBufferProducer()->allowAllocation(true); } ALOGV(""[%s] Allocating %u buffers from a native window of size %u on "" ""output port"", mComponentName.c_str(), bufferCount, bufferSize); for (OMX_U32 i = 0; i < bufferCount; i++) { ANativeWindowBuffer *buf; int fenceFd; err = mNativeWindow->dequeueBuffer(mNativeWindow.get(), &buf, &fenceFd); if (err != 0) { ALOGE(""dequeueBuffer failed: %s (%d)"", strerror(-err), -err); break; } sp graphicBuffer(new GraphicBuffer(buf, false)); BufferInfo info; info.mStatus = BufferInfo::OWNED_BY_US; info.mFenceFd = fenceFd; info.mIsReadFence = false; info.mRenderInfo = NULL; info.mData = new ABuffer(NULL /* data */, bufferSize /* capacity */); info.mGraphicBuffer = graphicBuffer; mBuffers[kPortIndexOutput].push(info); IOMX::buffer_id bufferId; err = mOMX->useGraphicBuffer(mNode, kPortIndexOutput, graphicBuffer, &bufferId); if (err != 0) { ALOGE(""registering GraphicBuffer %u with OMX IL component failed: "" ""%d"", i, err); break; } mBuffers[kPortIndexOutput].editItemAt(i).mBufferID = bufferId; ALOGV(""[%s] Registered graphic buffer with ID %u (pointer = %p)"", mComponentName.c_str(), bufferId, graphicBuffer.get()); } OMX_U32 cancelStart; OMX_U32 cancelEnd; if (err != 0) { cancelStart = 0; cancelEnd = mBuffers[kPortIndexOutput].size(); } else { cancelStart = bufferCount - minUndequeuedBuffers; cancelEnd = bufferCount; } for (OMX_U32 i = cancelStart; i < cancelEnd; i++) { BufferInfo *info = &mBuffers[kPortIndexOutput].editItemAt(i); if (info->mStatus == BufferInfo::OWNED_BY_US) { status_t error = cancelBufferToNativeWindow(info); if (err == 0) { err = error; } } } if (!storingMetadataInDecodedBuffers()) { static_cast(mNativeWindow.get()) ->getIGraphicBufferProducer()->allowAllocation(false); } return err; } ",0 "Document* LocalFrame::DocumentAtPoint(const LayoutPoint& point_in_root_frame) { if (!View()) return nullptr; LayoutPoint pt = View()->ConvertFromRootFrame(point_in_root_frame); if (!ContentLayoutObject()) return nullptr; HitTestResult result = GetEventHandler().HitTestResultAtPoint( pt, HitTestRequest::kReadOnly | HitTestRequest::kActive); return result.InnerNode() ? &result.InnerNode()->GetDocument() : nullptr; } ",0 " __acquires(rcu_bh) { rcu_read_lock_bh(); return if6_get_first(seq, *pos); } ",0 "ResourceError WebFrameLoaderClient::pluginWillHandleLoadError(const WebCore::ResourceResponse&) { return ResourceError(); } ",0 "const Track* Tracks::GetTrackByNumber(long tn) const { if (tn < 0) return NULL; Track** i = m_trackEntries; Track** const j = m_trackEntriesEnd; while (i != j) { Track* const pTrack = *i++; if (pTrack == NULL) continue; if (tn == pTrack->GetNumber()) return pTrack; } return NULL; // not found } ",0 "void ip6t_unregister_table(struct net *net, struct xt_table *table, const struct nf_hook_ops *ops) { nf_unregister_net_hooks(net, ops, hweight32(table->valid_hooks)); __ip6t_unregister_table(net, table); } ",0 "int rds_ib_xmit(struct rds_connection *conn, struct rds_message *rm, unsigned int hdr_off, unsigned int sg, unsigned int off) { struct rds_ib_connection *ic = conn->c_transport_data; struct ib_device *dev = ic->i_cm_id->device; struct rds_ib_send_work *send = NULL; struct rds_ib_send_work *first; struct rds_ib_send_work *prev; struct ib_send_wr *failed_wr; struct scatterlist *scat; u32 pos; u32 i; u32 work_alloc; u32 credit_alloc = 0; u32 posted; u32 adv_credits = 0; int send_flags = 0; int bytes_sent = 0; int ret; int flow_controlled = 0; int nr_sig = 0; BUG_ON(off % RDS_FRAG_SIZE); BUG_ON(hdr_off != 0 && hdr_off != sizeof(struct rds_header)); /* Do not send cong updates to IB loopback */ if (conn->c_loopback && rm->m_inc.i_hdr.h_flags & RDS_FLAG_CONG_BITMAP) { rds_cong_map_updated(conn->c_fcong, ~(u64) 0); return sizeof(struct rds_header) + RDS_CONG_MAP_BYTES; } /* FIXME we may overallocate here */ if (be32_to_cpu(rm->m_inc.i_hdr.h_len) == 0) i = 1; else i = ceil(be32_to_cpu(rm->m_inc.i_hdr.h_len), RDS_FRAG_SIZE); work_alloc = rds_ib_ring_alloc(&ic->i_send_ring, i, &pos); if (work_alloc == 0) { set_bit(RDS_LL_SEND_FULL, &conn->c_flags); rds_ib_stats_inc(s_ib_tx_ring_full); ret = -ENOMEM; goto out; } if (ic->i_flowctl) { credit_alloc = rds_ib_send_grab_credits(ic, work_alloc, &posted, 0, RDS_MAX_ADV_CREDIT); adv_credits += posted; if (credit_alloc < work_alloc) { rds_ib_ring_unalloc(&ic->i_send_ring, work_alloc - credit_alloc); work_alloc = credit_alloc; flow_controlled = 1; } if (work_alloc == 0) { set_bit(RDS_LL_SEND_FULL, &conn->c_flags); rds_ib_stats_inc(s_ib_tx_throttle); ret = -ENOMEM; goto out; } } /* map the message the first time we see it */ if (!ic->i_data_op) { if (rm->data.op_nents) { rm->data.op_count = ib_dma_map_sg(dev, rm->data.op_sg, rm->data.op_nents, DMA_TO_DEVICE); rdsdebug(""ic %p mapping rm %p: %d\n"", ic, rm, rm->data.op_count); if (rm->data.op_count == 0) { rds_ib_stats_inc(s_ib_tx_sg_mapping_failure); rds_ib_ring_unalloc(&ic->i_send_ring, work_alloc); ret = -ENOMEM; /* XXX ? */ goto out; } } else { rm->data.op_count = 0; } rds_message_addref(rm); ic->i_data_op = &rm->data; /* Finalize the header */ if (test_bit(RDS_MSG_ACK_REQUIRED, &rm->m_flags)) rm->m_inc.i_hdr.h_flags |= RDS_FLAG_ACK_REQUIRED; if (test_bit(RDS_MSG_RETRANSMITTED, &rm->m_flags)) rm->m_inc.i_hdr.h_flags |= RDS_FLAG_RETRANSMITTED; /* If it has a RDMA op, tell the peer we did it. This is * used by the peer to release use-once RDMA MRs. */ if (rm->rdma.op_active) { struct rds_ext_header_rdma ext_hdr; ext_hdr.h_rdma_rkey = cpu_to_be32(rm->rdma.op_rkey); rds_message_add_extension(&rm->m_inc.i_hdr, RDS_EXTHDR_RDMA, &ext_hdr, sizeof(ext_hdr)); } if (rm->m_rdma_cookie) { rds_message_add_rdma_dest_extension(&rm->m_inc.i_hdr, rds_rdma_cookie_key(rm->m_rdma_cookie), rds_rdma_cookie_offset(rm->m_rdma_cookie)); } /* Note - rds_ib_piggyb_ack clears the ACK_REQUIRED bit, so * we should not do this unless we have a chance of at least * sticking the header into the send ring. Which is why we * should call rds_ib_ring_alloc first. */ rm->m_inc.i_hdr.h_ack = cpu_to_be64(rds_ib_piggyb_ack(ic)); rds_message_make_checksum(&rm->m_inc.i_hdr); /* * Update adv_credits since we reset the ACK_REQUIRED bit. */ if (ic->i_flowctl) { rds_ib_send_grab_credits(ic, 0, &posted, 1, RDS_MAX_ADV_CREDIT - adv_credits); adv_credits += posted; BUG_ON(adv_credits > 255); } } /* Sometimes you want to put a fence between an RDMA * READ and the following SEND. * We could either do this all the time * or when requested by the user. Right now, we let * the application choose. */ if (rm->rdma.op_active && rm->rdma.op_fence) send_flags = IB_SEND_FENCE; /* Each frag gets a header. Msgs may be 0 bytes */ send = &ic->i_sends[pos]; first = send; prev = NULL; scat = &ic->i_data_op->op_sg[sg]; i = 0; do { unsigned int len = 0; /* Set up the header */ send->s_wr.send_flags = send_flags; send->s_wr.opcode = IB_WR_SEND; send->s_wr.num_sge = 1; send->s_wr.next = NULL; send->s_queued = jiffies; send->s_op = NULL; send->s_sge[0].addr = ic->i_send_hdrs_dma + (pos * sizeof(struct rds_header)); send->s_sge[0].length = sizeof(struct rds_header); memcpy(&ic->i_send_hdrs[pos], &rm->m_inc.i_hdr, sizeof(struct rds_header)); /* Set up the data, if present */ if (i < work_alloc && scat != &rm->data.op_sg[rm->data.op_count]) { len = min(RDS_FRAG_SIZE, ib_sg_dma_len(dev, scat) - off); send->s_wr.num_sge = 2; send->s_sge[1].addr = ib_sg_dma_address(dev, scat) + off; send->s_sge[1].length = len; bytes_sent += len; off += len; if (off == ib_sg_dma_len(dev, scat)) { scat++; off = 0; } } rds_ib_set_wr_signal_state(ic, send, 0); /* * Always signal the last one if we're stopping due to flow control. */ if (ic->i_flowctl && flow_controlled && i == (work_alloc-1)) send->s_wr.send_flags |= IB_SEND_SIGNALED | IB_SEND_SOLICITED; if (send->s_wr.send_flags & IB_SEND_SIGNALED) nr_sig++; rdsdebug(""send %p wr %p num_sge %u next %p\n"", send, &send->s_wr, send->s_wr.num_sge, send->s_wr.next); if (ic->i_flowctl && adv_credits) { struct rds_header *hdr = &ic->i_send_hdrs[pos]; /* add credit and redo the header checksum */ hdr->h_credit = adv_credits; rds_message_make_checksum(hdr); adv_credits = 0; rds_ib_stats_inc(s_ib_tx_credit_updates); } if (prev) prev->s_wr.next = &send->s_wr; prev = send; pos = (pos + 1) % ic->i_send_ring.w_nr; send = &ic->i_sends[pos]; i++; } while (i < work_alloc && scat != &rm->data.op_sg[rm->data.op_count]); /* Account the RDS header in the number of bytes we sent, but just once. * The caller has no concept of fragmentation. */ if (hdr_off == 0) bytes_sent += sizeof(struct rds_header); /* if we finished the message then send completion owns it */ if (scat == &rm->data.op_sg[rm->data.op_count]) { prev->s_op = ic->i_data_op; prev->s_wr.send_flags |= IB_SEND_SOLICITED; ic->i_data_op = NULL; } /* Put back wrs & credits we didn't use */ if (i < work_alloc) { rds_ib_ring_unalloc(&ic->i_send_ring, work_alloc - i); work_alloc = i; } if (ic->i_flowctl && i < credit_alloc) rds_ib_send_add_credits(conn, credit_alloc - i); if (nr_sig) atomic_add(nr_sig, &ic->i_signaled_sends); /* XXX need to worry about failed_wr and partial sends. */ failed_wr = &first->s_wr; ret = ib_post_send(ic->i_cm_id->qp, &first->s_wr, &failed_wr); rdsdebug(""ic %p first %p (wr %p) ret %d wr %p\n"", ic, first, &first->s_wr, ret, failed_wr); BUG_ON(failed_wr != &first->s_wr); if (ret) { printk(KERN_WARNING ""RDS/IB: ib_post_send to %pI4 "" ""returned %d\n"", &conn->c_faddr, ret); rds_ib_ring_unalloc(&ic->i_send_ring, work_alloc); rds_ib_sub_signaled(ic, nr_sig); if (prev->s_op) { ic->i_data_op = prev->s_op; prev->s_op = NULL; } rds_ib_conn_error(ic->conn, ""ib_post_send failed\n""); goto out; } ret = bytes_sent; out: BUG_ON(adv_credits); return ret; } ",1 "static inline int oo_objects(struct kmem_cache_order_objects x) { return x.x & ((1 << 16) - 1); } ",0 "int rds_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t size, int msg_flags) { struct sock *sk = sock->sk; struct rds_sock *rs = rds_sk_to_rs(sk); long timeo; int ret = 0, nonblock = msg_flags & MSG_DONTWAIT; struct sockaddr_in *sin; struct rds_incoming *inc = NULL; /* udp_recvmsg()->sock_recvtimeo() gets away without locking too.. */ timeo = sock_rcvtimeo(sk, nonblock); rdsdebug(""size %zu flags 0x%x timeo %ld\n"", size, msg_flags, timeo); if (msg_flags & MSG_OOB) goto out; while (1) { /* If there are pending notifications, do those - and nothing else */ if (!list_empty(&rs->rs_notify_queue)) { ret = rds_notify_queue_get(rs, msg); break; } if (rs->rs_cong_notify) { ret = rds_notify_cong(rs, msg); break; } if (!rds_next_incoming(rs, &inc)) { if (nonblock) { ret = -EAGAIN; break; } timeo = wait_event_interruptible_timeout(*sk_sleep(sk), (!list_empty(&rs->rs_notify_queue) || rs->rs_cong_notify || rds_next_incoming(rs, &inc)), timeo); rdsdebug(""recvmsg woke inc %p timeo %ld\n"", inc, timeo); if (timeo > 0 || timeo == MAX_SCHEDULE_TIMEOUT) continue; ret = timeo; if (ret == 0) ret = -ETIMEDOUT; break; } rdsdebug(""copying inc %p from %pI4:%u to user\n"", inc, &inc->i_conn->c_faddr, ntohs(inc->i_hdr.h_sport)); ret = inc->i_conn->c_trans->inc_copy_to_user(inc, msg->msg_iov, size); if (ret < 0) break; /* * if the message we just copied isn't at the head of the * recv queue then someone else raced us to return it, try * to get the next message. */ if (!rds_still_queued(rs, inc, !(msg_flags & MSG_PEEK))) { rds_inc_put(inc); inc = NULL; rds_stats_inc(s_recv_deliver_raced); continue; } if (ret < be32_to_cpu(inc->i_hdr.h_len)) { if (msg_flags & MSG_TRUNC) ret = be32_to_cpu(inc->i_hdr.h_len); msg->msg_flags |= MSG_TRUNC; } if (rds_cmsg_recv(inc, msg)) { ret = -EFAULT; goto out; } rds_stats_inc(s_recv_delivered); sin = (struct sockaddr_in *)msg->msg_name; if (sin) { sin->sin_family = AF_INET; sin->sin_port = inc->i_hdr.h_sport; sin->sin_addr.s_addr = inc->i_saddr; memset(sin->sin_zero, 0, sizeof(sin->sin_zero)); } break; } if (inc) rds_inc_put(inc); out: return ret; } ",1 " StateBase* writeFile(v8::Handle value, StateBase* next) { File* file = V8File::toNative(value.As()); if (!file) return 0; if (file->hasBeenClosed()) return handleError(DataCloneError, ""A File object has been closed, and could therefore not be cloned."", next); int blobIndex = -1; m_blobDataHandles.add(file->uuid(), file->blobDataHandle()); if (appendFileInfo(file, &blobIndex)) { ASSERT(blobIndex >= 0); m_writer.writeFileIndex(blobIndex); } else { m_writer.writeFile(*file); } return 0; } ",1 "static bool SniffCRX(const char* content, size_t size, const GURL& url, const std::string& type_hint, bool* have_enough_content, std::string* result) { static const struct MagicNumber kCRXMagicNumbers[] = { MAGIC_NUMBER(""application/x-chrome-extension"", ""Cr24\x02\x00\x00\x00"") }; if (!base::EndsWith(url.path_piece(), "".crx"", base::CompareCase::SENSITIVE)) return false; *have_enough_content &= TruncateSize(kBytesRequiredForMagic, &size); return CheckForMagicNumbers(content, size, kCRXMagicNumbers, arraysize(kCRXMagicNumbers), result); } ",0 "void GLES2DecoderImpl::DoBindAttribLocation(GLuint program_id, GLuint index, const std::string& name) { if (!StringIsValidForGLES(name)) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, ""glBindAttribLocation"", ""Invalid character""); return; } if (ProgramManager::HasBuiltInPrefix(name)) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, ""glBindAttribLocation"", ""reserved prefix""); return; } if (index >= group_->max_vertex_attribs()) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, ""glBindAttribLocation"", ""index out of range""); return; } Program* program = GetProgramInfoNotShader( program_id, ""glBindAttribLocation""); if (!program) { return; } program->SetAttribLocationBinding(name, static_cast(index)); } ",0 "static int jpc_sot_dumpparms(jpc_ms_t *ms, FILE *out) { jpc_sot_t *sot = &ms->parms.sot; fprintf(out, ""tileno = %""PRIuFAST16""; len = %""PRIuFAST32""; partno = %d; numparts = %d\n"", sot->tileno, sot->len, sot->partno, sot->numparts); return 0; } ",0 "static inline int sock_sendto(php_netstream_data_t *sock, const char *buf, size_t buflen, int flags, struct sockaddr *addr, socklen_t addrlen ) { int ret; if (addr) { ret = sendto(sock->socket, buf, XP_SOCK_BUF_SIZE(buflen), flags, addr, XP_SOCK_BUF_SIZE(addrlen)); return (ret == SOCK_CONN_ERR) ? -1 : ret; } #ifdef PHP_WIN32 return ((ret = send(sock->socket, buf, buflen > INT_MAX ? INT_MAX : (int)buflen, flags)) == SOCK_CONN_ERR) ? -1 : ret; #else return ((ret = send(sock->socket, buf, buflen, flags)) == SOCK_CONN_ERR) ? -1 : ret; #endif } ",0 "ssize_t NaClDescCustomRecvMsg(void* handle, NaClImcTypedMsgHdr* msg, int /* flags */) { if (msg->iov_length != 1) return -1; msg->ndesc_length = 0; // Messages with descriptors aren't supported yet. return static_cast( ToAdapter(handle)->BlockingReceive(static_cast(msg->iov[0].base), msg->iov[0].length)); } ",1 "static int sha384_sparc64_final(struct shash_desc *desc, u8 *hash) { u8 D[64]; sha512_sparc64_final(desc, D); memcpy(hash, D, 48); memset(D, 0, 64); return 0; } ",0 "xmlParseEncName(xmlParserCtxtPtr ctxt) { xmlChar *buf = NULL; int len = 0; int size = 10; xmlChar cur; cur = CUR; if (((cur >= 'a') && (cur <= 'z')) || ((cur >= 'A') && (cur <= 'Z'))) { buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar)); if (buf == NULL) { xmlErrMemory(ctxt, NULL); return(NULL); } buf[len++] = cur; NEXT; cur = CUR; while (((cur >= 'a') && (cur <= 'z')) || ((cur >= 'A') && (cur <= 'Z')) || ((cur >= '0') && (cur <= '9')) || (cur == '.') || (cur == '_') || (cur == '-')) { if (len + 1 >= size) { xmlChar *tmp; size *= 2; tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar)); if (tmp == NULL) { xmlErrMemory(ctxt, NULL); xmlFree(buf); return(NULL); } buf = tmp; } buf[len++] = cur; NEXT; cur = CUR; if (cur == 0) { SHRINK; GROW; cur = CUR; } } buf[len] = 0; } else { xmlFatalErr(ctxt, XML_ERR_ENCODING_NAME, NULL); } return(buf); } ",0 "bool GesturePoint::IsInVerticalRailWindow() const { int dx = x_delta(); int dy = y_delta(); return abs(dy) > kRailStartProportion * abs(dx); } ",0 "xsltGatherNamespaces(xsltStylesheetPtr style) { xmlNodePtr cur; const xmlChar *URI; if (style == NULL) return; /* * TODO: basically if the stylesheet uses the same prefix for different * patterns, well they may be in problem, hopefully they will get * a warning first. */ /* * TODO: Eliminate the use of the hash for XPath expressions. * An expression should be evaluated in the context of the in-scope * namespaces; eliminate the restriction of an XML document to contain * no duplicate prefixes for different namespace names. * */ cur = xmlDocGetRootElement(style->doc); while (cur != NULL) { if (cur->type == XML_ELEMENT_NODE) { xmlNsPtr ns = cur->nsDef; while (ns != NULL) { if (ns->prefix != NULL) { if (style->nsHash == NULL) { style->nsHash = xmlHashCreate(10); if (style->nsHash == NULL) { xsltTransformError(NULL, style, cur, ""xsltGatherNamespaces: failed to create hash table\n""); style->errors++; return; } } URI = xmlHashLookup(style->nsHash, ns->prefix); if ((URI != NULL) && (!xmlStrEqual(URI, ns->href))) { xsltTransformError(NULL, style, cur, ""Namespaces prefix %s used for multiple namespaces\n"",ns->prefix); style->warnings++; } else if (URI == NULL) { xmlHashUpdateEntry(style->nsHash, ns->prefix, (void *) ns->href, (xmlHashDeallocator)xmlFree); #ifdef WITH_XSLT_DEBUG_PARSING xsltGenericDebug(xsltGenericDebugContext, ""Added namespace: %s mapped to %s\n"", ns->prefix, ns->href); #endif } } ns = ns->next; } } /* * Skip to next node */ if (cur->children != NULL) { if (cur->children->type != XML_ENTITY_DECL) { cur = cur->children; continue; } } if (cur->next != NULL) { cur = cur->next; continue; } do { cur = cur->parent; if (cur == NULL) break; if (cur == (xmlNodePtr) style->doc) { cur = NULL; break; } if (cur->next != NULL) { cur = cur->next; break; } } while (cur != NULL); } } ",0 "bool RenderBlockFlow::mustDiscardMarginBefore() const { return style()->marginBeforeCollapse() == MDISCARD || (m_rareData && m_rareData->m_discardMarginBefore); } ",0 "blink::mojom::WebBluetoothResult TranslateConnectErrorAndRecord( device::BluetoothDevice::ConnectErrorCode error_code) { switch (error_code) { case device::BluetoothDevice::ERROR_UNKNOWN: RecordConnectGATTOutcome(UMAConnectGATTOutcome::UNKNOWN); return blink::mojom::WebBluetoothResult::CONNECT_UNKNOWN_ERROR; case device::BluetoothDevice::ERROR_INPROGRESS: RecordConnectGATTOutcome(UMAConnectGATTOutcome::IN_PROGRESS); return blink::mojom::WebBluetoothResult::CONNECT_ALREADY_IN_PROGRESS; case device::BluetoothDevice::ERROR_FAILED: RecordConnectGATTOutcome(UMAConnectGATTOutcome::FAILED); return blink::mojom::WebBluetoothResult::CONNECT_UNKNOWN_FAILURE; case device::BluetoothDevice::ERROR_AUTH_FAILED: RecordConnectGATTOutcome(UMAConnectGATTOutcome::AUTH_FAILED); return blink::mojom::WebBluetoothResult::CONNECT_AUTH_FAILED; case device::BluetoothDevice::ERROR_AUTH_CANCELED: RecordConnectGATTOutcome(UMAConnectGATTOutcome::AUTH_CANCELED); return blink::mojom::WebBluetoothResult::CONNECT_AUTH_CANCELED; case device::BluetoothDevice::ERROR_AUTH_REJECTED: RecordConnectGATTOutcome(UMAConnectGATTOutcome::AUTH_REJECTED); return blink::mojom::WebBluetoothResult::CONNECT_AUTH_REJECTED; case device::BluetoothDevice::ERROR_AUTH_TIMEOUT: RecordConnectGATTOutcome(UMAConnectGATTOutcome::AUTH_TIMEOUT); return blink::mojom::WebBluetoothResult::CONNECT_AUTH_TIMEOUT; case device::BluetoothDevice::ERROR_UNSUPPORTED_DEVICE: RecordConnectGATTOutcome(UMAConnectGATTOutcome::UNSUPPORTED_DEVICE); return blink::mojom::WebBluetoothResult::CONNECT_UNSUPPORTED_DEVICE; case device::BluetoothDevice::NUM_CONNECT_ERROR_CODES: NOTREACHED(); return blink::mojom::WebBluetoothResult::CONNECT_UNKNOWN_FAILURE; } NOTREACHED(); return blink::mojom::WebBluetoothResult::CONNECT_UNKNOWN_FAILURE; } ",0 "void idct_mb(VP8Context *s, VP8ThreadData *td, uint8_t *dst[3], VP8Macroblock *mb) { int x, y, ch; if (mb->mode != MODE_I4x4) { uint8_t *y_dst = dst[0]; for (y = 0; y < 4; y++) { uint32_t nnz4 = AV_RL32(td->non_zero_count_cache[y]); if (nnz4) { if (nnz4 & ~0x01010101) { for (x = 0; x < 4; x++) { if ((uint8_t) nnz4 == 1) s->vp8dsp.vp8_idct_dc_add(y_dst + 4 * x, td->block[y][x], s->linesize); else if ((uint8_t) nnz4 > 1) s->vp8dsp.vp8_idct_add(y_dst + 4 * x, td->block[y][x], s->linesize); nnz4 >>= 8; if (!nnz4) break; } } else { s->vp8dsp.vp8_idct_dc_add4y(y_dst, td->block[y], s->linesize); } } y_dst += 4 * s->linesize; } } for (ch = 0; ch < 2; ch++) { uint32_t nnz4 = AV_RL32(td->non_zero_count_cache[4 + ch]); if (nnz4) { uint8_t *ch_dst = dst[1 + ch]; if (nnz4 & ~0x01010101) { for (y = 0; y < 2; y++) { for (x = 0; x < 2; x++) { if ((uint8_t) nnz4 == 1) s->vp8dsp.vp8_idct_dc_add(ch_dst + 4 * x, td->block[4 + ch][(y << 1) + x], s->uvlinesize); else if ((uint8_t) nnz4 > 1) s->vp8dsp.vp8_idct_add(ch_dst + 4 * x, td->block[4 + ch][(y << 1) + x], s->uvlinesize); nnz4 >>= 8; if (!nnz4) goto chroma_idct_end; } ch_dst += 4 * s->uvlinesize; } } else { s->vp8dsp.vp8_idct_dc_add4uv(ch_dst, td->block[4 + ch], s->uvlinesize); } } chroma_idct_end: ; } } ",0 "static int curl_debug(CURL *cp, curl_infotype type, char *buf, size_t buf_len, void *ctx) /* {{{ */ { php_curl *ch = (php_curl *)ctx; if (type == CURLINFO_HEADER_OUT) { if (ch->header.str) { zend_string_release(ch->header.str); } if (buf_len > 0) { ch->header.str = zend_string_init(buf, buf_len, 0); } } return 0; } /* }}} */ ",0 "static int fanout_set_data_cbpf(struct packet_sock *po, char __user *data, unsigned int len) { struct bpf_prog *new; struct sock_fprog fprog; int ret; if (sock_flag(&po->sk, SOCK_FILTER_LOCKED)) return -EPERM; if (len != sizeof(fprog)) return -EINVAL; if (copy_from_user(&fprog, data, len)) return -EFAULT; ret = bpf_prog_create_from_user(&new, &fprog, NULL, false); if (ret) return ret; __fanout_set_data_bpf(po->fanout, new); return 0; } ",0 "mrb_mod_initialize(mrb_state *mrb, mrb_value mod) { mrb_value b; struct RClass *m = mrb_class_ptr(mod); boot_initmod(mrb, m); /* bootstrap a newly initialized module */ mrb_get_args(mrb, ""|&"", &b); if (!mrb_nil_p(b)) { mrb_yield_with_class(mrb, b, 1, &mod, mod, m); } return mod; } ",0 "static int cp2112_xfer_status(struct cp2112_device *dev) { struct hid_device *hdev = dev->hdev; u8 buf[2]; int ret; buf[0] = CP2112_TRANSFER_STATUS_REQUEST; buf[1] = 0x01; atomic_set(&dev->xfer_avail, 0); ret = cp2112_hid_output(hdev, buf, 2, HID_OUTPUT_REPORT); if (ret < 0) { hid_warn(hdev, ""Error requesting status: %d\n"", ret); return ret; } ret = cp2112_wait(dev, &dev->xfer_avail); if (ret) return ret; return dev->xfer_status; } ",0 "static int zend_parse_va_args(int num_args, const char *type_spec, va_list *va, int flags TSRMLS_DC) /* {{{ */ { const char *spec_walk; int c, i; int min_num_args = -1; int max_num_args = 0; int post_varargs = 0; zval **arg; int arg_count; int quiet = flags & ZEND_PARSE_PARAMS_QUIET; zend_bool have_varargs = 0; zval ****varargs = NULL; int *n_varargs = NULL; for (spec_walk = type_spec; *spec_walk; spec_walk++) { c = *spec_walk; switch (c) { case 'l': case 'd': case 's': case 'b': case 'r': case 'a': case 'o': case 'O': case 'z': case 'Z': case 'C': case 'h': case 'f': case 'A': case 'H': case 'p': max_num_args++; break; case '|': min_num_args = max_num_args; break; case '/': case '!': /* Pass */ break; case '*': case '+': if (have_varargs) { if (!quiet) { zend_function *active_function = EG(current_execute_data)->function_state.function; const char *class_name = active_function->common.scope ? active_function->common.scope->name : """"; zend_error(E_WARNING, ""%s%s%s(): only one varargs specifier (* or +) is permitted"", class_name, class_name[0] ? ""::"" : """", active_function->common.function_name); } return FAILURE; } have_varargs = 1; /* we expect at least one parameter in varargs */ if (c == '+') { max_num_args++; } /* mark the beginning of varargs */ post_varargs = max_num_args; break; default: if (!quiet) { zend_function *active_function = EG(current_execute_data)->function_state.function; const char *class_name = active_function->common.scope ? active_function->common.scope->name : """"; zend_error(E_WARNING, ""%s%s%s(): bad type specifier while parsing parameters"", class_name, class_name[0] ? ""::"" : """", active_function->common.function_name); } return FAILURE; } } if (min_num_args < 0) { min_num_args = max_num_args; } if (have_varargs) { /* calculate how many required args are at the end of the specifier list */ post_varargs = max_num_args - post_varargs; max_num_args = -1; } if (num_args < min_num_args || (num_args > max_num_args && max_num_args > 0)) { if (!quiet) { zend_function *active_function = EG(current_execute_data)->function_state.function; const char *class_name = active_function->common.scope ? active_function->common.scope->name : """"; zend_error(E_WARNING, ""%s%s%s() expects %s %d parameter%s, %d given"", class_name, class_name[0] ? ""::"" : """", active_function->common.function_name, min_num_args == max_num_args ? ""exactly"" : num_args < min_num_args ? ""at least"" : ""at most"", num_args < min_num_args ? min_num_args : max_num_args, (num_args < min_num_args ? min_num_args : max_num_args) == 1 ? """" : ""s"", num_args); } return FAILURE; } arg_count = (int)(zend_uintptr_t) *(zend_vm_stack_top(TSRMLS_C) - 1); if (num_args > arg_count) { zend_error(E_WARNING, ""%s(): could not obtain parameters for parsing"", get_active_function_name(TSRMLS_C)); return FAILURE; } i = 0; while (num_args-- > 0) { if (*type_spec == '|') { type_spec++; } if (*type_spec == '*' || *type_spec == '+') { int num_varargs = num_args + 1 - post_varargs; /* eat up the passed in storage even if it won't be filled in with varargs */ varargs = va_arg(*va, zval ****); n_varargs = va_arg(*va, int *); type_spec++; if (num_varargs > 0) { int iv = 0; zval **p = (zval **) (zend_vm_stack_top(TSRMLS_C) - 1 - (arg_count - i)); *n_varargs = num_varargs; /* allocate space for array and store args */ *varargs = safe_emalloc(num_varargs, sizeof(zval **), 0); while (num_varargs-- > 0) { (*varargs)[iv++] = p++; } /* adjust how many args we have left and restart loop */ num_args = num_args + 1 - iv; i += iv; continue; } else { *varargs = NULL; *n_varargs = 0; } } arg = (zval **) (zend_vm_stack_top(TSRMLS_C) - 1 - (arg_count-i)); if (zend_parse_arg(i+1, arg, va, &type_spec, quiet TSRMLS_CC) == FAILURE) { /* clean up varargs array if it was used */ if (varargs && *varargs) { efree(*varargs); *varargs = NULL; } return FAILURE; } i++; } return SUCCESS; } /* }}} */ ",0 "SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username) { int i; SRP_user_pwd *user; unsigned char digv[SHA_DIGEST_LENGTH]; unsigned char digs[SHA_DIGEST_LENGTH]; EVP_MD_CTX ctxt; if (vb == NULL) return NULL; for (i = 0; i < sk_SRP_user_pwd_num(vb->users_pwd); i++) { user = sk_SRP_user_pwd_value(vb->users_pwd, i); if (strcmp(user->id, username) == 0) return user; } } ",0 "void Document::registerEventFactory(PassOwnPtr eventFactory) { ASSERT(!eventFactories().contains(eventFactory.get())); eventFactories().add(eventFactory); } ",0 "static int cxusb_ctrl_msg(struct dvb_usb_device *d, u8 cmd, u8 *wbuf, int wlen, u8 *rbuf, int rlen) { struct cxusb_state *st = d->priv; int ret, wo; if (1 + wlen > MAX_XFER_SIZE) { warn(""i2c wr: len=%d is too big!\n"", wlen); return -EOPNOTSUPP; } wo = (rbuf == NULL || rlen == 0); /* write-only */ mutex_lock(&d->data_mutex); st->data[0] = cmd; memcpy(&st->data[1], wbuf, wlen); if (wo) ret = dvb_usb_generic_write(d, st->data, 1 + wlen); else ret = dvb_usb_generic_rw(d, st->data, 1 + wlen, rbuf, rlen, 0); mutex_unlock(&d->data_mutex); return ret; } ",1 "bool CCLayerTreeHost::initialize() { TRACE_EVENT(""CCLayerTreeHost::initialize"", this, 0); if (m_settings.enableCompositorThread) { m_settings.acceleratePainting = false; m_settings.showFPSCounter = false; m_settings.showPlatformLayerTree = false; m_proxy = CCThreadProxy::create(this); } else m_proxy = CCSingleThreadProxy::create(this); m_proxy->start(); if (!m_proxy->initializeLayerRenderer()) return false; m_compositorIdentifier = m_proxy->compositorIdentifier(); m_settings.acceleratePainting = m_proxy->layerRendererCapabilities().usingAcceleratedPainting; setNeedsCommitThenRedraw(); m_contentsTextureManager = TextureManager::create(TextureManager::highLimitBytes(), m_proxy->layerRendererCapabilities().maxTextureSize); return true; } ",1 "static int handle_vmread(struct kvm_vcpu *vcpu) { unsigned long field; u64 field_value; unsigned long exit_qualification = vmcs_readl(EXIT_QUALIFICATION); u32 vmx_instruction_info = vmcs_read32(VMX_INSTRUCTION_INFO); gva_t gva = 0; if (!nested_vmx_check_permission(vcpu)) return 1; if (!nested_vmx_check_vmcs12(vcpu)) return kvm_skip_emulated_instruction(vcpu); /* Decode instruction info and find the field to read */ field = kvm_register_readl(vcpu, (((vmx_instruction_info) >> 28) & 0xf)); /* Read the field, zero-extended to a u64 field_value */ if (vmcs12_read_any(vcpu, field, &field_value) < 0) { nested_vmx_failValid(vcpu, VMXERR_UNSUPPORTED_VMCS_COMPONENT); return kvm_skip_emulated_instruction(vcpu); } /* * Now copy part of this value to register or memory, as requested. * Note that the number of bits actually copied is 32 or 64 depending * on the guest's mode (32 or 64 bit), not on the given field's length. */ if (vmx_instruction_info & (1u << 10)) { kvm_register_writel(vcpu, (((vmx_instruction_info) >> 3) & 0xf), field_value); } else { if (get_vmx_mem_address(vcpu, exit_qualification, vmx_instruction_info, true, &gva)) return 1; /* _system ok, as nested_vmx_check_permission verified cpl=0 */ kvm_write_guest_virt_system(&vcpu->arch.emulate_ctxt, gva, &field_value, (is_long_mode(vcpu) ? 8 : 4), NULL); } nested_vmx_succeed(vcpu); return kvm_skip_emulated_instruction(vcpu); } ",0 "static __init void rb_ipi(void *ignore) { struct rb_test_data *data; int cpu = smp_processor_id(); data = &rb_data[cpu]; rb_write_something(data, true); } ",0 "static int rb_check_list(struct ring_buffer_per_cpu *cpu_buffer, struct list_head *list) { if (RB_WARN_ON(cpu_buffer, rb_list_head(list->prev) != list->prev)) return 1; if (RB_WARN_ON(cpu_buffer, rb_list_head(list->next) != list->next)) return 1; return 0; } ",0 "std::string Extension::GenerateIdForPath(const FilePath& path) { FilePath new_path = Extension::MaybeNormalizePath(path); std::string path_bytes = std::string(reinterpret_cast(new_path.value().data()), new_path.value().size() * sizeof(FilePath::CharType)); std::string id; return GenerateId(path_bytes, &id) ? id : """"; } ",0 "PHP_METHOD(SoapParam, SoapParam) { zval *data; char *name; int name_length; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""zs"", &data, &name, &name_length) == FAILURE) { return; } if (name_length == 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Invalid parameter name""); return; } add_property_stringl(this_ptr, ""param_name"", name, name_length, 1); add_property_zval(this_ptr, ""param_data"", data); } ",0 "ZEND_API void zend_ts_hash_reverse_apply(TsHashTable *ht, apply_func_t apply_func) { begin_write(ht); zend_hash_reverse_apply(TS_HASH(ht), apply_func); end_write(ht); } ",0 "String AXObject::textFromElements(bool inAriaLabelledbyTraversal, AXObjectSet& visited, HeapVector>& elements, AXRelatedObjectVector* relatedObjects) const { StringBuilder accumulatedText; bool foundValidElement = false; AXRelatedObjectVector localRelatedObjects; for (const auto& element : elements) { AXObject* axElement = axObjectCache().getOrCreate(element); if (axElement) { foundValidElement = true; String result = recursiveTextAlternative( *axElement, inAriaLabelledbyTraversal, visited); localRelatedObjects.push_back( new NameSourceRelatedObject(axElement, result)); if (!result.isEmpty()) { if (!accumulatedText.isEmpty()) accumulatedText.append(' '); accumulatedText.append(result); } } } if (!foundValidElement) return String(); if (relatedObjects) *relatedObjects = localRelatedObjects; return accumulatedText.toString(); } ",0 "static int __br_mdb_del(struct net_bridge *br, struct br_mdb_entry *entry) { struct net_bridge_mdb_htable *mdb; struct net_bridge_mdb_entry *mp; struct net_bridge_port_group *p; struct net_bridge_port_group __rcu **pp; struct br_ip ip; int err = -EINVAL; if (!netif_running(br->dev) || br->multicast_disabled) return -EINVAL; if (timer_pending(&br->multicast_querier_timer)) return -EBUSY; ip.proto = entry->addr.proto; if (ip.proto == htons(ETH_P_IP)) ip.u.ip4 = entry->addr.u.ip4; #if IS_ENABLED(CONFIG_IPV6) else ip.u.ip6 = entry->addr.u.ip6; #endif spin_lock_bh(&br->multicast_lock); mdb = mlock_dereference(br->mdb, br); mp = br_mdb_ip_get(mdb, &ip); if (!mp) goto unlock; for (pp = &mp->ports; (p = mlock_dereference(*pp, br)) != NULL; pp = &p->next) { if (!p->port || p->port->dev->ifindex != entry->ifindex) continue; if (p->port->state == BR_STATE_DISABLED) goto unlock; rcu_assign_pointer(*pp, p->next); hlist_del_init(&p->mglist); del_timer(&p->timer); call_rcu_bh(&p->rcu, br_multicast_free_pg); err = 0; if (!mp->ports && !mp->mglist && netif_running(br->dev)) mod_timer(&mp->timer, jiffies); break; } unlock: spin_unlock_bh(&br->multicast_lock); return err; } ",0 "static void overloadedMethod4Method(const v8::FunctionCallbackInfo& info) { if (UNLIKELY(info.Length() < 1)) { throwTypeError(ExceptionMessages::failedToExecute(""overloadedMethod"", ""TestObject"", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIsolate()); return; } TestObject* imp = V8TestObject::toNative(info.Holder()); V8TRYCATCH_VOID(Vector, arrayArg, toNativeArray(info[0], 1, info.GetIsolate())); imp->overloadedMethod(arrayArg); } ",0 "poolCopyStringN(STRING_POOL *pool, const XML_Char *s, int n) { if (!pool->ptr && !poolGrow(pool)) { /* The following line is unreachable given the current usage of * poolCopyStringN(). Currently it is called from exactly one * place to copy the text of a simple general entity. By that * point, the name of the entity is already stored in the pool, so * pool->ptr cannot be NULL. * * If poolCopyStringN() is used elsewhere as it well might be, * this line may well become executable again. Regardless, this * sort of check shouldn't be removed lightly, so we just exclude * it from the coverage statistics. */ return NULL; /* LCOV_EXCL_LINE */ } for (; n > 0; --n, s++) { if (!poolAppendChar(pool, *s)) return NULL; } s = pool->start; poolFinish(pool); return s; } ",0 "static int __tg3_writephy(struct tg3 *tp, unsigned int phy_addr, int reg, u32 val) { u32 frame_val; unsigned int loops; int ret; if ((tp->phy_flags & TG3_PHYFLG_IS_FET) && (reg == MII_CTRL1000 || reg == MII_TG3_AUX_CTRL)) return 0; if ((tp->mi_mode & MAC_MI_MODE_AUTO_POLL) != 0) { tw32_f(MAC_MI_MODE, (tp->mi_mode & ~MAC_MI_MODE_AUTO_POLL)); udelay(80); } tg3_ape_lock(tp, tp->phy_ape_lock); frame_val = ((phy_addr << MI_COM_PHY_ADDR_SHIFT) & MI_COM_PHY_ADDR_MASK); frame_val |= ((reg << MI_COM_REG_ADDR_SHIFT) & MI_COM_REG_ADDR_MASK); frame_val |= (val & MI_COM_DATA_MASK); frame_val |= (MI_COM_CMD_WRITE | MI_COM_START); tw32_f(MAC_MI_COM, frame_val); loops = PHY_BUSY_LOOPS; while (loops != 0) { udelay(10); frame_val = tr32(MAC_MI_COM); if ((frame_val & MI_COM_BUSY) == 0) { udelay(5); frame_val = tr32(MAC_MI_COM); break; } loops -= 1; } ret = -EBUSY; if (loops != 0) ret = 0; if ((tp->mi_mode & MAC_MI_MODE_AUTO_POLL) != 0) { tw32_f(MAC_MI_MODE, tp->mi_mode); udelay(80); } tg3_ape_unlock(tp, tp->phy_ape_lock); return ret; } ",0 " ACTION_P(ScheduleRenameCallback, new_path) { BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(arg3, new_path)); } ",0 "ChromeContentBrowserClient::OverrideRequestContextForURL( const GURL& url, const content::ResourceContext& context) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); if (url.SchemeIs(chrome::kExtensionScheme)) { ProfileIOData* io_data = reinterpret_cast(context.GetUserData(NULL)); return io_data->extensions_request_context(); } return NULL; } ",0 "static int dnxhd_decode_macroblock(const DNXHDContext *ctx, RowContext *row, AVFrame *frame, int x, int y) { int shift1 = ctx->bit_depth >= 10; int dct_linesize_luma = frame->linesize[0]; int dct_linesize_chroma = frame->linesize[1]; uint8_t *dest_y, *dest_u, *dest_v; int dct_y_offset, dct_x_offset; int qscale, i, act; int interlaced_mb = 0; if (ctx->mbaff) { interlaced_mb = get_bits1(&row->gb); qscale = get_bits(&row->gb, 10); } else { qscale = get_bits(&row->gb, 11); } act = get_bits1(&row->gb); if (act) { if (!ctx->act) { static int act_warned; if (!act_warned) { act_warned = 1; av_log(ctx->avctx, AV_LOG_ERROR, ""ACT flag set, in violation of frame header.\n""); } } else if (row->format == -1) { row->format = act; } else if (row->format != act) { row->format = 2; // Variable } } if (qscale != row->last_qscale) { for (i = 0; i < 64; i++) { row->luma_scale[i] = qscale * ctx->cid_table->luma_weight[i]; row->chroma_scale[i] = qscale * ctx->cid_table->chroma_weight[i]; } row->last_qscale = qscale; } for (i = 0; i < 8 + 4 * ctx->is_444; i++) { if (ctx->decode_dct_block(ctx, row, i) < 0) return AVERROR_INVALIDDATA; } if (frame->interlaced_frame) { dct_linesize_luma <<= 1; dct_linesize_chroma <<= 1; } dest_y = frame->data[0] + ((y * dct_linesize_luma) << 4) + (x << (4 + shift1)); dest_u = frame->data[1] + ((y * dct_linesize_chroma) << 4) + (x << (3 + shift1 + ctx->is_444)); dest_v = frame->data[2] + ((y * dct_linesize_chroma) << 4) + (x << (3 + shift1 + ctx->is_444)); if (frame->interlaced_frame && ctx->cur_field) { dest_y += frame->linesize[0]; dest_u += frame->linesize[1]; dest_v += frame->linesize[2]; } if (interlaced_mb) { dct_linesize_luma <<= 1; dct_linesize_chroma <<= 1; } dct_y_offset = interlaced_mb ? frame->linesize[0] : (dct_linesize_luma << 3); dct_x_offset = 8 << shift1; if (!ctx->is_444) { ctx->idsp.idct_put(dest_y, dct_linesize_luma, row->blocks[0]); ctx->idsp.idct_put(dest_y + dct_x_offset, dct_linesize_luma, row->blocks[1]); ctx->idsp.idct_put(dest_y + dct_y_offset, dct_linesize_luma, row->blocks[4]); ctx->idsp.idct_put(dest_y + dct_y_offset + dct_x_offset, dct_linesize_luma, row->blocks[5]); if (!(ctx->avctx->flags & AV_CODEC_FLAG_GRAY)) { dct_y_offset = interlaced_mb ? frame->linesize[1] : (dct_linesize_chroma << 3); ctx->idsp.idct_put(dest_u, dct_linesize_chroma, row->blocks[2]); ctx->idsp.idct_put(dest_v, dct_linesize_chroma, row->blocks[3]); ctx->idsp.idct_put(dest_u + dct_y_offset, dct_linesize_chroma, row->blocks[6]); ctx->idsp.idct_put(dest_v + dct_y_offset, dct_linesize_chroma, row->blocks[7]); } } else { ctx->idsp.idct_put(dest_y, dct_linesize_luma, row->blocks[0]); ctx->idsp.idct_put(dest_y + dct_x_offset, dct_linesize_luma, row->blocks[1]); ctx->idsp.idct_put(dest_y + dct_y_offset, dct_linesize_luma, row->blocks[6]); ctx->idsp.idct_put(dest_y + dct_y_offset + dct_x_offset, dct_linesize_luma, row->blocks[7]); if (!(ctx->avctx->flags & AV_CODEC_FLAG_GRAY)) { dct_y_offset = interlaced_mb ? frame->linesize[1] : (dct_linesize_chroma << 3); ctx->idsp.idct_put(dest_u, dct_linesize_chroma, row->blocks[2]); ctx->idsp.idct_put(dest_u + dct_x_offset, dct_linesize_chroma, row->blocks[3]); ctx->idsp.idct_put(dest_u + dct_y_offset, dct_linesize_chroma, row->blocks[8]); ctx->idsp.idct_put(dest_u + dct_y_offset + dct_x_offset, dct_linesize_chroma, row->blocks[9]); ctx->idsp.idct_put(dest_v, dct_linesize_chroma, row->blocks[4]); ctx->idsp.idct_put(dest_v + dct_x_offset, dct_linesize_chroma, row->blocks[5]); ctx->idsp.idct_put(dest_v + dct_y_offset, dct_linesize_chroma, row->blocks[10]); ctx->idsp.idct_put(dest_v + dct_y_offset + dct_x_offset, dct_linesize_chroma, row->blocks[11]); } } return 0; } ",0 " static void Delete(base::ConditionVariable* instance) { instance->~ConditionVariable(); } ",0 "static int ptrace_gethbpregs(struct task_struct *tsk, long num, unsigned long __user *data) { u32 reg; int idx, ret = 0; struct perf_event *bp; struct arch_hw_breakpoint_ctrl arch_ctrl; if (num == 0) { reg = ptrace_get_hbp_resource_info(); } else { idx = ptrace_hbp_num_to_idx(num); if (idx < 0 || idx >= ARM_MAX_HBP_SLOTS) { ret = -EINVAL; goto out; } bp = tsk->thread.debug.hbp[idx]; if (!bp) { reg = 0; goto put; } arch_ctrl = counter_arch_bp(bp)->ctrl; /* * Fix up the len because we may have adjusted it * to compensate for an unaligned address. */ while (!(arch_ctrl.len & 0x1)) arch_ctrl.len >>= 1; if (num & 0x1) reg = bp->attr.bp_addr; else reg = encode_ctrl_reg(arch_ctrl); } put: if (put_user(reg, data)) ret = -EFAULT; out: return ret; } ",0 "const net::LoadStateWithParam& WebContentsImpl::GetLoadState() const { return load_state_; } ",0 "GeolocationPosition* GeolocationInspectorAgent::overrideGeolocationPosition(GeolocationPosition* position) { if (m_geolocationOverridden) { if (position) m_platformGeolocationPosition = position; return m_geolocationPosition.get(); } return position; } ",0 "void WebPageProxy::didPerformDragControllerAction(uint64_t resultOperation) { m_currentDragOperation = static_cast(resultOperation); } ",0 "static int usb_dev_resume(struct device *dev) { return usb_resume(dev, PMSG_RESUME); } ",0 "int agent_exists(void) { HWND hwnd; hwnd = FindWindow(""Pageant"", ""Pageant""); if (!hwnd) return FALSE; else return TRUE; } ",0 "flac_write_header (SF_PRIVATE *psf, int UNUSED (calc_length)) { FLAC_PRIVATE* pflac = (FLAC_PRIVATE*) psf->codec_data ; int err ; flac_write_strings (psf, pflac) ; if ((err = FLAC__stream_encoder_init_stream (pflac->fse, sf_flac_enc_write_callback, sf_flac_enc_seek_callback, sf_flac_enc_tell_callback, NULL, psf)) != FLAC__STREAM_DECODER_INIT_STATUS_OK) { psf_log_printf (psf, ""Error : FLAC encoder init returned error : %s\n"", FLAC__StreamEncoderInitStatusString [err]) ; return SFE_FLAC_INIT_DECODER ; } ; if (psf->error == 0) psf->dataoffset = psf_ftell (psf) ; pflac->encbuffer = calloc (ENC_BUFFER_SIZE, sizeof (int32_t)) ; return psf->error ; } /* flac_write_header */ ",0 " void JingleSessionManager::Close() { DCHECK(CalledOnValidThread()); DCHECK(sessions_.empty()); if (!closed_) { cricket_session_manager_->RemoveClient(kChromotingXmlNamespace); jingle_signaling_connector_.reset(); cricket_session_manager_.reset(); closed_ = true; } } ",1 "void __sock_recv_wifi_status(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) { int ack; if (!sock_flag(sk, SOCK_WIFI_STATUS)) return; if (!skb->wifi_acked_valid) return; ack = skb->wifi_acked; put_cmsg(msg, SOL_SOCKET, SCM_WIFI_STATUS, sizeof(ack), &ack); } ",0 "static int edge_port_probe(struct usb_serial_port *port) { struct edgeport_port *edge_port; int ret; edge_port = kzalloc(sizeof(*edge_port), GFP_KERNEL); if (!edge_port) return -ENOMEM; ret = kfifo_alloc(&edge_port->write_fifo, EDGE_OUT_BUF_SIZE, GFP_KERNEL); if (ret) { kfree(edge_port); return -ENOMEM; } spin_lock_init(&edge_port->ep_lock); edge_port->port = port; edge_port->edge_serial = usb_get_serial_data(port->serial); edge_port->bUartMode = default_uart_mode; usb_set_serial_port_data(port, edge_port); ret = edge_create_sysfs_attrs(port); if (ret) { kfifo_free(&edge_port->write_fifo); kfree(edge_port); return ret; } return 0; } ",0 "static void *nested_svm_map(struct vcpu_svm *svm, u64 gpa, struct page **_page) { struct page *page; might_sleep(); page = kvm_vcpu_gfn_to_page(&svm->vcpu, gpa >> PAGE_SHIFT); if (is_error_page(page)) goto error; *_page = page; return kmap(page); error: kvm_inject_gp(&svm->vcpu, 0); return NULL; } ",0 "static void init_vmcs_shadow_fields(void) { int i, j; for (i = j = 0; i < max_shadow_read_only_fields; i++) { u16 field = shadow_read_only_fields[i]; if (vmcs_field_width(field) == VMCS_FIELD_WIDTH_U64 && (i + 1 == max_shadow_read_only_fields || shadow_read_only_fields[i + 1] != field + 1)) pr_err(""Missing field from shadow_read_only_field %x\n"", field + 1); clear_bit(field, vmx_vmread_bitmap); #ifdef CONFIG_X86_64 if (field & 1) continue; #endif if (j < i) shadow_read_only_fields[j] = field; j++; } max_shadow_read_only_fields = j; for (i = j = 0; i < max_shadow_read_write_fields; i++) { u16 field = shadow_read_write_fields[i]; if (vmcs_field_width(field) == VMCS_FIELD_WIDTH_U64 && (i + 1 == max_shadow_read_write_fields || shadow_read_write_fields[i + 1] != field + 1)) pr_err(""Missing field from shadow_read_write_field %x\n"", field + 1); /* * PML and the preemption timer can be emulated, but the * processor cannot vmwrite to fields that don't exist * on bare metal. */ switch (field) { case GUEST_PML_INDEX: if (!cpu_has_vmx_pml()) continue; break; case VMX_PREEMPTION_TIMER_VALUE: if (!cpu_has_vmx_preemption_timer()) continue; break; case GUEST_INTR_STATUS: if (!cpu_has_vmx_apicv()) continue; break; default: break; } clear_bit(field, vmx_vmwrite_bitmap); clear_bit(field, vmx_vmread_bitmap); #ifdef CONFIG_X86_64 if (field & 1) continue; #endif if (j < i) shadow_read_write_fields[j] = field; j++; } max_shadow_read_write_fields = j; } ",0 "static inline void get_strl(AVIOContext *pb, char *buf, int buf_size, int len) { int i; char *q, r; q = buf; for(i=0;i 0) *q = '\0'; } ",0 "daemon_linux_md_start_authorized_cb (Daemon *daemon, Device *device, DBusGMethodInvocation *context, const gchar *action_id, guint num_user_data, gpointer *user_data_elements) { gchar **components_as_strv = user_data_elements[0]; /* TODO: use options */ int n; int m; char *argv[128]; GError *error; char *uuid; char *md_device_file; uuid = NULL; md_device_file = NULL; error = NULL; /* check that all given components exist, that they are indeed linux-md-components and * that their uuid agrees */ for (n = 0; components_as_strv[n] != NULL; n++) { Device *slave; const char *component_objpath = components_as_strv[n]; slave = daemon_local_find_by_object_path (daemon, component_objpath); if (slave == NULL) { throw_error (context, ERROR_FAILED, ""Component %s doesn't exist"", component_objpath); goto out; } if (!slave->priv->device_is_linux_md_component) { throw_error (context, ERROR_FAILED, ""%s is not a linux-md component"", component_objpath); goto out; } if (n == 0) { uuid = g_strdup (slave->priv->linux_md_component_uuid); if (uuid == NULL) { throw_error (context, ERROR_FAILED, ""no uuid for one of the components""); goto out; } } else { const char *this_uuid; this_uuid = slave->priv->linux_md_component_uuid; if (this_uuid == NULL || strcmp (uuid, this_uuid) != 0) { throw_error (context, ERROR_FAILED, ""uuid mismatch between given components""); goto out; } } if (device_local_is_busy (slave, FALSE, &error)) { dbus_g_method_return_error (context, error); g_error_free (error); goto out; } } /* find an unused md minor... Man, I wish mdadm could do this itself; this is slightly racy */ for (n = 0; TRUE; n++) { char *native_path; char *array_state; /* TODO: move to /sys/class/block instead */ native_path = g_strdup_printf (""/sys/block/md%d"", n); if (!sysfs_file_exists (native_path, ""md/array_state"")) { /* Apparently this slot is free since there is no such file. So let's peruse it. */ g_free (native_path); break; } else { array_state = sysfs_get_string (native_path, ""md/array_state""); g_strstrip (array_state); if (strcmp (array_state, ""clear"") == 0) { /* It's clear! Let's use it! */ g_free (array_state); g_free (native_path); break; } g_free (array_state); } g_free (native_path); } md_device_file = g_strdup_printf (""/dev/md%d"", n); n = 0; argv[n++] = ""mdadm""; argv[n++] = ""--assemble""; argv[n++] = md_device_file; argv[n++] = ""--run""; for (m = 0; components_as_strv[m] != NULL; m++) { Device *slave; const char *component_objpath = components_as_strv[m]; slave = daemon_local_find_by_object_path (daemon, component_objpath); if (slave == NULL) { throw_error (context, ERROR_FAILED, ""Component %s doesn't exist"", component_objpath); goto out; } if (n >= (int) sizeof(argv) - 1) { throw_error (context, ERROR_FAILED, ""Too many components""); goto out; } argv[n++] = (char *) slave->priv->device_file; } argv[n++] = NULL; if (!job_new (context, ""LinuxMdStart"", TRUE, NULL, argv, NULL, linux_md_start_completed_cb, FALSE, linux_md_start_data_new (context, daemon, uuid), (GDestroyNotify) linux_md_start_data_unref)) { goto out; } out: g_free (uuid); g_free (md_device_file); } ",0 "static void page_cache_pipe_buf_release(struct pipe_inode_info *pipe, struct pipe_buffer *buf) { put_page(buf->page); buf->flags &= ~PIPE_BUF_FLAG_LRU; } ",0 "static void ext4_handle_error(struct super_block *sb) { if (sb->s_flags & MS_RDONLY) return; if (!test_opt(sb, ERRORS_CONT)) { journal_t *journal = EXT4_SB(sb)->s_journal; EXT4_SB(sb)->s_mount_flags |= EXT4_MF_FS_ABORTED; if (journal) jbd2_journal_abort(journal, -EIO); } if (test_opt(sb, ERRORS_RO)) { ext4_msg(sb, KERN_CRIT, ""Remounting filesystem read-only""); sb->s_flags |= MS_RDONLY; } if (test_opt(sb, ERRORS_PANIC)) panic(""EXT4-fs (device %s): panic forced after error\n"", sb->s_id); } ",0 "xsltDefaultProcessOneNode(xsltTransformContextPtr ctxt, xmlNodePtr node, xsltStackElemPtr params) { xmlNodePtr copy; xmlNodePtr delete = NULL, cur; int nbchild = 0, oldSize; int childno = 0, oldPos; xsltTemplatePtr template; CHECK_STOPPED; /* * Handling of leaves */ switch (node->type) { case XML_DOCUMENT_NODE: case XML_HTML_DOCUMENT_NODE: case XML_ELEMENT_NODE: break; case XML_CDATA_SECTION_NODE: #ifdef WITH_XSLT_DEBUG_PROCESS XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext, ""xsltDefaultProcessOneNode: copy CDATA %s\n"", node->content)); #endif copy = xsltCopyText(ctxt, ctxt->insert, node, 0); if (copy == NULL) { xsltTransformError(ctxt, NULL, node, ""xsltDefaultProcessOneNode: cdata copy failed\n""); } return; case XML_TEXT_NODE: #ifdef WITH_XSLT_DEBUG_PROCESS if (node->content == NULL) { XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext, ""xsltDefaultProcessOneNode: copy empty text\n"")); return; } else { XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext, ""xsltDefaultProcessOneNode: copy text %s\n"", node->content)); } #endif copy = xsltCopyText(ctxt, ctxt->insert, node, 0); if (copy == NULL) { xsltTransformError(ctxt, NULL, node, ""xsltDefaultProcessOneNode: text copy failed\n""); } return; case XML_ATTRIBUTE_NODE: cur = node->children; while ((cur != NULL) && (cur->type != XML_TEXT_NODE)) cur = cur->next; if (cur == NULL) { xsltTransformError(ctxt, NULL, node, ""xsltDefaultProcessOneNode: no text for attribute\n""); } else { #ifdef WITH_XSLT_DEBUG_PROCESS if (cur->content == NULL) { XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext, ""xsltDefaultProcessOneNode: copy empty text\n"")); } else { XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext, ""xsltDefaultProcessOneNode: copy text %s\n"", cur->content)); } #endif copy = xsltCopyText(ctxt, ctxt->insert, cur, 0); if (copy == NULL) { xsltTransformError(ctxt, NULL, node, ""xsltDefaultProcessOneNode: text copy failed\n""); } } return; default: return; } /* * Handling of Elements: first pass, cleanup and counting */ cur = node->children; while (cur != NULL) { switch (cur->type) { case XML_TEXT_NODE: case XML_CDATA_SECTION_NODE: case XML_DOCUMENT_NODE: case XML_HTML_DOCUMENT_NODE: case XML_ELEMENT_NODE: case XML_PI_NODE: case XML_COMMENT_NODE: nbchild++; break; case XML_DTD_NODE: /* Unlink the DTD, it's still reachable using doc->intSubset */ if (cur->next != NULL) cur->next->prev = cur->prev; if (cur->prev != NULL) cur->prev->next = cur->next; break; default: #ifdef WITH_XSLT_DEBUG_PROCESS XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext, ""xsltDefaultProcessOneNode: skipping node type %d\n"", cur->type)); #endif delete = cur; } cur = cur->next; if (delete != NULL) { #ifdef WITH_XSLT_DEBUG_PROCESS XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext, ""xsltDefaultProcessOneNode: removing ignorable blank node\n"")); #endif xmlUnlinkNode(delete); xmlFreeNode(delete); delete = NULL; } } if (delete != NULL) { #ifdef WITH_XSLT_DEBUG_PROCESS XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext, ""xsltDefaultProcessOneNode: removing ignorable blank node\n"")); #endif xmlUnlinkNode(delete); xmlFreeNode(delete); delete = NULL; } /* * Handling of Elements: second pass, actual processing */ oldSize = ctxt->xpathCtxt->contextSize; oldPos = ctxt->xpathCtxt->proximityPosition; cur = node->children; while (cur != NULL) { childno++; switch (cur->type) { case XML_DOCUMENT_NODE: case XML_HTML_DOCUMENT_NODE: case XML_ELEMENT_NODE: ctxt->xpathCtxt->contextSize = nbchild; ctxt->xpathCtxt->proximityPosition = childno; xsltProcessOneNode(ctxt, cur, params); break; case XML_CDATA_SECTION_NODE: template = xsltGetTemplate(ctxt, cur, NULL); if (template) { #ifdef WITH_XSLT_DEBUG_PROCESS XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext, ""xsltDefaultProcessOneNode: applying template for CDATA %s\n"", cur->content)); #endif /* * Instantiate the xsl:template. */ xsltApplyXSLTTemplate(ctxt, cur, template->content, template, params); } else /* if (ctxt->mode == NULL) */ { #ifdef WITH_XSLT_DEBUG_PROCESS XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext, ""xsltDefaultProcessOneNode: copy CDATA %s\n"", cur->content)); #endif copy = xsltCopyText(ctxt, ctxt->insert, cur, 0); if (copy == NULL) { xsltTransformError(ctxt, NULL, cur, ""xsltDefaultProcessOneNode: cdata copy failed\n""); } } break; case XML_TEXT_NODE: template = xsltGetTemplate(ctxt, cur, NULL); if (template) { #ifdef WITH_XSLT_DEBUG_PROCESS XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext, ""xsltDefaultProcessOneNode: applying template for text %s\n"", cur->content)); #endif ctxt->xpathCtxt->contextSize = nbchild; ctxt->xpathCtxt->proximityPosition = childno; /* * Instantiate the xsl:template. */ xsltApplyXSLTTemplate(ctxt, cur, template->content, template, params); } else /* if (ctxt->mode == NULL) */ { #ifdef WITH_XSLT_DEBUG_PROCESS if (cur->content == NULL) { XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext, ""xsltDefaultProcessOneNode: copy empty text\n"")); } else { XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext, ""xsltDefaultProcessOneNode: copy text %s\n"", cur->content)); } #endif copy = xsltCopyText(ctxt, ctxt->insert, cur, 0); if (copy == NULL) { xsltTransformError(ctxt, NULL, cur, ""xsltDefaultProcessOneNode: text copy failed\n""); } } break; case XML_PI_NODE: case XML_COMMENT_NODE: template = xsltGetTemplate(ctxt, cur, NULL); if (template) { #ifdef WITH_XSLT_DEBUG_PROCESS if (cur->type == XML_PI_NODE) { XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext, ""xsltDefaultProcessOneNode: template found for PI %s\n"", cur->name)); } else if (cur->type == XML_COMMENT_NODE) { XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext, ""xsltDefaultProcessOneNode: template found for comment\n"")); } #endif ctxt->xpathCtxt->contextSize = nbchild; ctxt->xpathCtxt->proximityPosition = childno; /* * Instantiate the xsl:template. */ xsltApplyXSLTTemplate(ctxt, cur, template->content, template, params); } break; default: break; } cur = cur->next; } ctxt->xpathCtxt->contextSize = oldSize; ctxt->xpathCtxt->proximityPosition = oldPos; } ",0 "GF_Err audio_sample_entry_AddBox(GF_Box *s, GF_Box *a) { GF_MPEGAudioSampleEntryBox *ptr = (GF_MPEGAudioSampleEntryBox *)s; switch (a->type) { case GF_ISOM_BOX_TYPE_ESDS: if (ptr->esd) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->esd = (GF_ESDBox *)a; break; case GF_ISOM_BOX_TYPE_SINF: gf_list_add(ptr->protections, a); break; case GF_ISOM_BOX_TYPE_DAMR: case GF_ISOM_BOX_TYPE_DEVC: case GF_ISOM_BOX_TYPE_DQCP: case GF_ISOM_BOX_TYPE_DSMV: ptr->cfg_3gpp = (GF_3GPPConfigBox *) a; /*for 3GP config, remember sample entry type in config*/ ptr->cfg_3gpp->cfg.type = ptr->type; break; case GF_ISOM_BOX_TYPE_DAC3: ptr->cfg_ac3 = (GF_AC3ConfigBox *) a; break; case GF_ISOM_BOX_TYPE_DEC3: ptr->cfg_ac3 = (GF_AC3ConfigBox *) a; break; case GF_ISOM_BOX_TYPE_MHA1: case GF_ISOM_BOX_TYPE_MHA2: case GF_ISOM_BOX_TYPE_MHM1: case GF_ISOM_BOX_TYPE_MHM2: ptr->cfg_mha = (GF_MHAConfigBox *) a; break; case GF_ISOM_BOX_TYPE_UNKNOWN: /*HACK for QT files: get the esds box from the track*/ if (s->type == GF_ISOM_BOX_TYPE_MP4A) { GF_UnknownBox *wave = (GF_UnknownBox *)a; if (ptr->esd) ERROR_ON_DUPLICATED_BOX(a, ptr) if ((wave->original_4cc == GF_QT_BOX_TYPE_WAVE) && gf_list_count(wave->other_boxes)) { u32 i; for (i =0; iother_boxes); i++) { GF_Box *inner_box = (GF_Box *)gf_list_get(wave->other_boxes, i); if (inner_box->type == GF_ISOM_BOX_TYPE_ESDS) { ptr->esd = (GF_ESDBox *)inner_box; } } return gf_isom_box_add_default(s, a); } if (wave->data != NULL) { u32 offset = 0; while (offset + 5 < wave->dataSize && (wave->data[offset + 4] != 'e') && (wave->data[offset + 5] != 's')) { offset++; } if (offset + 5 < wave->dataSize) { GF_Box *a; GF_Err e; GF_BitStream *bs = gf_bs_new(wave->data + offset, wave->dataSize - offset, GF_BITSTREAM_READ); e = gf_isom_box_parse(&a, bs); gf_bs_del(bs); if (e) return e; ptr->esd = (GF_ESDBox *)a; gf_isom_box_add_for_dump_mode((GF_Box *)ptr, a); gf_isom_box_del(a); return GF_OK; } GF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, (""[iso file] Cannot process box %s!\n"", gf_4cc_to_str(wave->original_4cc))); } } return gf_isom_box_add_default(s, a); default: return gf_isom_box_add_default(s, a); } return GF_OK; } ",0 "void rpc_destroy_wait_queue(struct rpc_wait_queue *queue) { del_timer_sync(&queue->timer_list.timer); } ",0 "iasecc_chv_cache_is_verified(struct sc_card *card, struct sc_pin_cmd_data *pin_cmd) { struct sc_context *ctx = card->ctx; struct iasecc_pin_status *current = NULL; unsigned char data_sha1[SHA_DIGEST_LENGTH]; LOG_FUNC_CALLED(ctx); if (pin_cmd->pin1.data) SHA1(pin_cmd->pin1.data, pin_cmd->pin1.len, data_sha1); else memset(data_sha1, 0, SHA_DIGEST_LENGTH); sc_log_hex(ctx, ""data_sha1: %s"", data_sha1, SHA_DIGEST_LENGTH); for(current = checked_pins; current; current = current->next) if (current->reference == pin_cmd->pin_reference) break; if (current && !memcmp(data_sha1, current->sha1, SHA_DIGEST_LENGTH)) { sc_log(ctx, ""PIN-%i status 'verified'"", pin_cmd->pin_reference); return current; } sc_log(ctx, ""PIN-%i status 'not verified'"", pin_cmd->pin_reference); return NULL; } ",0 "static inline void preempt_conditional_sti(struct pt_regs *regs) { preempt_count_inc(); if (regs->flags & X86_EFLAGS_IF) local_irq_enable(); } ",0 "import_new_stats_handle (void) { return xmalloc_clear ( sizeof (struct stats_s) ); } ",0 "void HTMLMediaElement::CloneNonAttributePropertiesFrom(const Element& other, CloneChildrenFlag flag) { HTMLElement::CloneNonAttributePropertiesFrom(other, flag); if (FastHasAttribute(mutedAttr)) muted_ = true; } ",0 "void LayerTreeCoordinator::notifyAnimationStarted(const WebCore::GraphicsLayer*, double time) { } ",0 "void NavigationControllerImpl::ReloadOriginalRequestURL(bool check_for_repost) { ReloadInternal(check_for_repost, RELOAD_ORIGINAL_REQUEST_URL); } ",0 "static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) { unsigned index = id->driver_data; struct Scsi_Host *shost; struct aac_dev *aac; struct list_head *insert = &aac_devices; int error = -ENODEV; int unique_id = 0; u64 dmamask; extern int aac_sync_mode; list_for_each_entry(aac, &aac_devices, entry) { if (aac->id > unique_id) break; insert = &aac->entry; unique_id++; } pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1 | PCIE_LINK_STATE_CLKPM); error = pci_enable_device(pdev); if (error) goto out; error = -ENODEV; /* * If the quirk31 bit is set, the adapter needs adapter * to driver communication memory to be allocated below 2gig */ if (aac_drivers[index].quirks & AAC_QUIRK_31BIT) dmamask = DMA_BIT_MASK(31); else dmamask = DMA_BIT_MASK(32); if (pci_set_dma_mask(pdev, dmamask) || pci_set_consistent_dma_mask(pdev, dmamask)) goto out_disable_pdev; pci_set_master(pdev); shost = scsi_host_alloc(&aac_driver_template, sizeof(struct aac_dev)); if (!shost) goto out_disable_pdev; shost->irq = pdev->irq; shost->unique_id = unique_id; shost->max_cmd_len = 16; aac = (struct aac_dev *)shost->hostdata; aac->base_start = pci_resource_start(pdev, 0); aac->scsi_host_ptr = shost; aac->pdev = pdev; aac->name = aac_driver_template.name; aac->id = shost->unique_id; aac->cardtype = index; INIT_LIST_HEAD(&aac->entry); aac->fibs = kzalloc(sizeof(struct fib) * (shost->can_queue + AAC_NUM_MGT_FIB), GFP_KERNEL); if (!aac->fibs) goto out_free_host; spin_lock_init(&aac->fib_lock); /* * Map in the registers from the adapter. */ aac->base_size = AAC_MIN_FOOTPRINT_SIZE; if ((*aac_drivers[index].init)(aac)) goto out_unmap; if (aac->sync_mode) { if (aac_sync_mode) printk(KERN_INFO ""%s%d: Sync. mode enforced "" ""by driver parameter. This will cause "" ""a significant performance decrease!\n"", aac->name, aac->id); else printk(KERN_INFO ""%s%d: Async. mode not supported "" ""by current driver, sync. mode enforced."" ""\nPlease update driver to get full performance.\n"", aac->name, aac->id); } /* * Start any kernel threads needed */ aac->thread = kthread_run(aac_command_thread, aac, AAC_DRIVERNAME); if (IS_ERR(aac->thread)) { printk(KERN_ERR ""aacraid: Unable to create command thread.\n""); error = PTR_ERR(aac->thread); aac->thread = NULL; goto out_deinit; } /* * If we had set a smaller DMA mask earlier, set it to 4gig * now since the adapter can dma data to at least a 4gig * address space. */ if (aac_drivers[index].quirks & AAC_QUIRK_31BIT) if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) goto out_deinit; aac->maximum_num_channels = aac_drivers[index].channels; error = aac_get_adapter_info(aac); if (error < 0) goto out_deinit; /* * Lets override negotiations and drop the maximum SG limit to 34 */ if ((aac_drivers[index].quirks & AAC_QUIRK_34SG) && (shost->sg_tablesize > 34)) { shost->sg_tablesize = 34; shost->max_sectors = (shost->sg_tablesize * 8) + 112; } if ((aac_drivers[index].quirks & AAC_QUIRK_17SG) && (shost->sg_tablesize > 17)) { shost->sg_tablesize = 17; shost->max_sectors = (shost->sg_tablesize * 8) + 112; } error = pci_set_dma_max_seg_size(pdev, (aac->adapter_info.options & AAC_OPT_NEW_COMM) ? (shost->max_sectors << 9) : 65536); if (error) goto out_deinit; /* * Firmware printf works only with older firmware. */ if (aac_drivers[index].quirks & AAC_QUIRK_34SG) aac->printf_enabled = 1; else aac->printf_enabled = 0; /* * max channel will be the physical channels plus 1 virtual channel * all containers are on the virtual channel 0 (CONTAINER_CHANNEL) * physical channels are address by their actual physical number+1 */ if (aac->nondasd_support || expose_physicals || aac->jbod) shost->max_channel = aac->maximum_num_channels; else shost->max_channel = 0; aac_get_config_status(aac, 0); aac_get_containers(aac); list_add(&aac->entry, insert); shost->max_id = aac->maximum_num_containers; if (shost->max_id < aac->maximum_num_physicals) shost->max_id = aac->maximum_num_physicals; if (shost->max_id < MAXIMUM_NUM_CONTAINERS) shost->max_id = MAXIMUM_NUM_CONTAINERS; else shost->this_id = shost->max_id; /* * dmb - we may need to move the setting of these parms somewhere else once * we get a fib that can report the actual numbers */ shost->max_lun = AAC_MAX_LUN; pci_set_drvdata(pdev, shost); error = scsi_add_host(shost, &pdev->dev); if (error) goto out_deinit; scsi_scan_host(shost); return 0; out_deinit: __aac_shutdown(aac); out_unmap: aac_fib_map_free(aac); if (aac->comm_addr) pci_free_consistent(aac->pdev, aac->comm_size, aac->comm_addr, aac->comm_phys); kfree(aac->queues); aac_adapter_ioremap(aac, 0); kfree(aac->fibs); kfree(aac->fsa_dev); out_free_host: scsi_host_put(shost); out_disable_pdev: pci_disable_device(pdev); out: return error; } ",0 "static rel_time_t realtime(const time_t exptime) { /* no. of seconds in 30 days - largest possible delta exptime */ if (exptime == 0) return 0; /* 0 means never expire */ if (exptime > REALTIME_MAXDELTA) { /* if item expiration is at/before the server started, give it an expiration time of 1 second after the server started. (because 0 means don't expire). without this, we'd underflow and wrap around to some large value way in the future, effectively making items expiring in the past really expiring never */ if (exptime <= process_started) return (rel_time_t)1; return (rel_time_t)(exptime - process_started); } else { return (rel_time_t)(exptime + current_time); } } ",0 "const char *ap_lua_ssl_val(apr_pool_t *p, server_rec *s, conn_rec *c, request_rec *r, const char *var) { if (lua_ssl_val) { return (const char *)lua_ssl_val(p, s, c, r, (char *)var); } return NULL; } ",0 "static __latent_entropy void run_rebalance_domains(struct softirq_action *h) { struct rq *this_rq = this_rq(); enum cpu_idle_type idle = this_rq->idle_balance ? CPU_IDLE : CPU_NOT_IDLE; /* * If this CPU has a pending nohz_balance_kick, then do the * balancing on behalf of the other idle CPUs whose ticks are * stopped. Do nohz_idle_balance *before* rebalance_domains to * give the idle CPUs a chance to load balance. Else we may * load balance only within the local sched_domain hierarchy * and abort nohz_idle_balance altogether if we pull some load. */ if (nohz_idle_balance(this_rq, idle)) return; /* normal load balance */ update_blocked_averages(this_rq->cpu); rebalance_domains(this_rq, idle); } ",0 "PHP_FUNCTION(openssl_encrypt) { zend_long options = 0; char *data, *method, *password, *iv = """"; size_t data_len, method_len, password_len, iv_len = 0, max_iv_len; const EVP_CIPHER *cipher_type; EVP_CIPHER_CTX *cipher_ctx; int i=0, keylen; size_t outlen; zend_string *outbuf; unsigned char *key; zend_bool free_iv; if (zend_parse_parameters(ZEND_NUM_ARGS(), ""sss|ls"", &data, &data_len, &method, &method_len, &password, &password_len, &options, &iv, &iv_len) == FAILURE) { return; } cipher_type = EVP_get_cipherbyname(method); if (!cipher_type) { php_error_docref(NULL, E_WARNING, ""Unknown cipher algorithm""); RETURN_FALSE; } PHP_OPENSSL_CHECK_SIZE_T_TO_INT(data_len, data); PHP_OPENSSL_CHECK_SIZE_T_TO_INT(password_len, password); cipher_ctx = EVP_CIPHER_CTX_new(); if (!cipher_ctx) { php_error_docref(NULL, E_WARNING, ""Failed to create cipher context""); RETURN_FALSE; } keylen = EVP_CIPHER_key_length(cipher_type); if (keylen > password_len) { key = emalloc(keylen); memset(key, 0, keylen); memcpy(key, password, password_len); } else { key = (unsigned char*)password; } max_iv_len = EVP_CIPHER_iv_length(cipher_type); if (iv_len == 0 && max_iv_len > 0) { php_error_docref(NULL, E_WARNING, ""Using an empty Initialization Vector (iv) is potentially insecure and not recommended""); } free_iv = php_openssl_validate_iv(&iv, &iv_len, max_iv_len); outlen = data_len + EVP_CIPHER_block_size(cipher_type); outbuf = zend_string_alloc(outlen, 0); EVP_EncryptInit(cipher_ctx, cipher_type, NULL, NULL); if (password_len > keylen) { EVP_CIPHER_CTX_set_key_length(cipher_ctx, (int)password_len); } EVP_EncryptInit_ex(cipher_ctx, NULL, NULL, key, (unsigned char *)iv); if (options & OPENSSL_ZERO_PADDING) { EVP_CIPHER_CTX_set_padding(cipher_ctx, 0); } if (data_len > 0) { EVP_EncryptUpdate(cipher_ctx, (unsigned char*)ZSTR_VAL(outbuf), &i, (unsigned char *)data, (int)data_len); } outlen = i; if (EVP_EncryptFinal(cipher_ctx, (unsigned char *)ZSTR_VAL(outbuf) + i, &i)) { outlen += i; if (options & OPENSSL_RAW_DATA) { ZSTR_VAL(outbuf)[outlen] = '\0'; ZSTR_LEN(outbuf) = outlen; RETVAL_STR(outbuf); } else { zend_string *base64_str; base64_str = php_base64_encode((unsigned char*)ZSTR_VAL(outbuf), outlen); zend_string_release(outbuf); RETVAL_STR(base64_str); } } else { zend_string_release(outbuf); RETVAL_FALSE; } if (key != (unsigned char*)password) { efree(key); } if (free_iv) { efree(iv); } EVP_CIPHER_CTX_free(cipher_ctx); } ",0 "static struct fsnotify_event *get_one_event(struct fsnotify_group *group, size_t count) { size_t event_size = sizeof(struct inotify_event); struct fsnotify_event *event; if (fsnotify_notify_queue_is_empty(group)) return NULL; event = fsnotify_peek_notify_event(group); pr_debug(""%s: group=%p event=%p\n"", __func__, group, event); if (event->name_len) event_size += roundup(event->name_len + 1, event_size); if (event_size > count) return ERR_PTR(-EINVAL); /* held the notification_mutex the whole time, so this is the * same event we peeked above */ fsnotify_remove_notify_event(group); return event; } ",0 "static int constraint_expr_eval(struct context *scontext, struct context *tcontext, struct context *xcontext, struct constraint_expr *cexpr) { u32 val1, val2; struct context *c; struct role_datum *r1, *r2; struct mls_level *l1, *l2; struct constraint_expr *e; int s[CEXPR_MAXDEPTH]; int sp = -1; for (e = cexpr; e; e = e->next) { switch (e->expr_type) { case CEXPR_NOT: BUG_ON(sp < 0); s[sp] = !s[sp]; break; case CEXPR_AND: BUG_ON(sp < 1); sp--; s[sp] &= s[sp + 1]; break; case CEXPR_OR: BUG_ON(sp < 1); sp--; s[sp] |= s[sp + 1]; break; case CEXPR_ATTR: if (sp == (CEXPR_MAXDEPTH - 1)) return 0; switch (e->attr) { case CEXPR_USER: val1 = scontext->user; val2 = tcontext->user; break; case CEXPR_TYPE: val1 = scontext->type; val2 = tcontext->type; break; case CEXPR_ROLE: val1 = scontext->role; val2 = tcontext->role; r1 = policydb.role_val_to_struct[val1 - 1]; r2 = policydb.role_val_to_struct[val2 - 1]; switch (e->op) { case CEXPR_DOM: s[++sp] = ebitmap_get_bit(&r1->dominates, val2 - 1); continue; case CEXPR_DOMBY: s[++sp] = ebitmap_get_bit(&r2->dominates, val1 - 1); continue; case CEXPR_INCOMP: s[++sp] = (!ebitmap_get_bit(&r1->dominates, val2 - 1) && !ebitmap_get_bit(&r2->dominates, val1 - 1)); continue; default: break; } break; case CEXPR_L1L2: l1 = &(scontext->range.level[0]); l2 = &(tcontext->range.level[0]); goto mls_ops; case CEXPR_L1H2: l1 = &(scontext->range.level[0]); l2 = &(tcontext->range.level[1]); goto mls_ops; case CEXPR_H1L2: l1 = &(scontext->range.level[1]); l2 = &(tcontext->range.level[0]); goto mls_ops; case CEXPR_H1H2: l1 = &(scontext->range.level[1]); l2 = &(tcontext->range.level[1]); goto mls_ops; case CEXPR_L1H1: l1 = &(scontext->range.level[0]); l2 = &(scontext->range.level[1]); goto mls_ops; case CEXPR_L2H2: l1 = &(tcontext->range.level[0]); l2 = &(tcontext->range.level[1]); goto mls_ops; mls_ops: switch (e->op) { case CEXPR_EQ: s[++sp] = mls_level_eq(l1, l2); continue; case CEXPR_NEQ: s[++sp] = !mls_level_eq(l1, l2); continue; case CEXPR_DOM: s[++sp] = mls_level_dom(l1, l2); continue; case CEXPR_DOMBY: s[++sp] = mls_level_dom(l2, l1); continue; case CEXPR_INCOMP: s[++sp] = mls_level_incomp(l2, l1); continue; default: BUG(); return 0; } break; default: BUG(); return 0; } switch (e->op) { case CEXPR_EQ: s[++sp] = (val1 == val2); break; case CEXPR_NEQ: s[++sp] = (val1 != val2); break; default: BUG(); return 0; } break; case CEXPR_NAMES: if (sp == (CEXPR_MAXDEPTH-1)) return 0; c = scontext; if (e->attr & CEXPR_TARGET) c = tcontext; else if (e->attr & CEXPR_XTARGET) { c = xcontext; if (!c) { BUG(); return 0; } } if (e->attr & CEXPR_USER) val1 = c->user; else if (e->attr & CEXPR_ROLE) val1 = c->role; else if (e->attr & CEXPR_TYPE) val1 = c->type; else { BUG(); return 0; } switch (e->op) { case CEXPR_EQ: s[++sp] = ebitmap_get_bit(&e->names, val1 - 1); break; case CEXPR_NEQ: s[++sp] = !ebitmap_get_bit(&e->names, val1 - 1); break; default: BUG(); return 0; } break; default: BUG(); return 0; } } BUG_ON(sp != 0); return s[0]; } ",0 "u32 hugetlb_fault_mutex_hash(struct hstate *h, struct mm_struct *mm, struct vm_area_struct *vma, struct address_space *mapping, pgoff_t idx, unsigned long address) { return 0; } ",0 "OMXCodec::BufferInfo *OMXCodec::findInputBufferByDataPointer(void *ptr) { Vector *infos = &mPortBuffers[kPortIndexInput]; for (size_t i = 0; i < infos->size(); ++i) { BufferInfo *info = &infos->editItemAt(i); if (info->mData == ptr) { CODEC_LOGV( ""input buffer data ptr = %p, buffer_id = %u"", ptr, info->mBuffer); return info; } } TRESPASS(); } ",0 "void RenderWidgetHostViewAura::SetTooltipsEnabled(bool enable) { if (enable) { tooltip_disabler_.reset(); } else { tooltip_disabler_.reset( new aura::client::ScopedTooltipDisabler(window_->GetRootWindow())); } } ",0 "IW_IMPL(const struct iw_palette*) iw_get_output_palette(struct iw_context *ctx) { return ctx->optctx.palette; } ",0 "unsigned ring_buffer_event_length(struct ring_buffer_event *event) { unsigned length; if (event->type_len == RINGBUF_TYPE_TIME_EXTEND) event = skip_time_extend(event); length = rb_event_length(event); if (event->type_len > RINGBUF_TYPE_DATA_TYPE_LEN_MAX) return length; length -= RB_EVNT_HDR_SIZE; if (length > RB_MAX_SMALL_DATA + sizeof(event->array[0])) length -= sizeof(event->array[0]); return length; } ",0 "int FS_GetModList( char *listbuf, int bufsize ) { int nMods, i, j, nTotal, nLen, nPaks, nPotential, nDescLen; char **pFiles = NULL; char **pPaks = NULL; char *name, *path; char description[MAX_OSPATH]; int dummy; char **pFiles0 = NULL; char **pFiles1 = NULL; #ifndef STANDALONE char **pFiles2 = NULL; char **pFiles3 = NULL; #endif qboolean bDrop = qfalse; *listbuf = 0; nMods = nTotal = 0; pFiles0 = Sys_ListFiles( fs_homepath->string, NULL, NULL, &dummy, qtrue ); pFiles1 = Sys_ListFiles( fs_basepath->string, NULL, NULL, &dummy, qtrue ); #ifndef STANDALONE pFiles2 = Sys_ListFiles( fs_steampath->string, NULL, NULL, &dummy, qtrue ); #endif #ifndef STANDALONE pFiles3 = Sys_ConcatenateFileLists( pFiles0, pFiles1 ); pFiles = Sys_ConcatenateFileLists( pFiles2, pFiles3 ); #else pFiles = Sys_ConcatenateFileLists( pFiles0, pFiles1 ); #endif nPotential = Sys_CountFileList(pFiles); for ( i = 0 ; i < nPotential ; i++ ) { name = pFiles[i]; if (i!=0) { bDrop = qfalse; for(j=0; jstring) && Q_stricmpn(name, ""."", 1)) { path = FS_BuildOSPath( fs_basepath->string, name, """" ); nPaks = 0; pPaks = Sys_ListFiles(path, "".pk3"", NULL, &nPaks, qfalse); Sys_FreeFileList( pPaks ); // we only use Sys_ListFiles to check wether .pk3 files are present /* try on home path */ if ( nPaks <= 0 ) { path = FS_BuildOSPath( fs_homepath->string, name, """" ); nPaks = 0; pPaks = Sys_ListFiles( path, "".pk3"", NULL, &nPaks, qfalse ); Sys_FreeFileList( pPaks ); } #ifndef STANDALONE /* try on steam path */ if ( nPaks <= 0 ) { path = FS_BuildOSPath( fs_steampath->string, name, """" ); nPaks = 0; pPaks = Sys_ListFiles( path, "".pk3"", NULL, &nPaks, qfalse ); Sys_FreeFileList( pPaks ); } #endif if (nPaks > 0) { nLen = strlen(name) + 1; FS_GetModDescription( name, description, sizeof( description ) ); nDescLen = strlen(description) + 1; if (nTotal + nLen + 1 + nDescLen + 1 < bufsize) { strcpy(listbuf, name); listbuf += nLen; strcpy(listbuf, description); listbuf += nDescLen; nTotal += nLen + nDescLen; nMods++; } else { break; } } } } Sys_FreeFileList( pFiles ); return nMods; } ",0 "GF_Err url_Write(GF_Box *s, GF_BitStream *bs) { GF_Err e; GF_DataEntryURLBox *ptr = (GF_DataEntryURLBox *)s; e = gf_isom_full_box_write(s, bs); if (e) return e; if ( !(ptr->flags & 1)) { if (ptr->location) { gf_bs_write_data(bs, ptr->location, (u32)strlen(ptr->location) + 1); } } return GF_OK; } ",0 "const cc::LayerTreeDebugState& Compositor::GetLayerTreeDebugState() const { return host_->GetDebugState(); } ",0 "static int handle_vmptrst(struct kvm_vcpu *vcpu) { unsigned long exit_qualification = vmcs_readl(EXIT_QUALIFICATION); u32 vmx_instruction_info = vmcs_read32(VMX_INSTRUCTION_INFO); gva_t vmcs_gva; struct x86_exception e; if (!nested_vmx_check_permission(vcpu)) return 1; if (get_vmx_mem_address(vcpu, exit_qualification, vmx_instruction_info, &vmcs_gva)) return 1; /* ok to use *_system, as nested_vmx_check_permission verified cpl=0 */ if (kvm_write_guest_virt_system(&vcpu->arch.emulate_ctxt, vmcs_gva, (void *)&to_vmx(vcpu)->nested.current_vmptr, sizeof(u64), &e)) { kvm_inject_page_fault(vcpu, &e); return 1; } nested_vmx_succeed(vcpu); skip_emulated_instruction(vcpu); return 1; } ",0 "const AtomicString& AXLayoutObject::liveRegionRelevant() const { DEFINE_STATIC_LOCAL(const AtomicString, defaultLiveRegionRelevant, (""additions text"")); const AtomicString& relevant = getAOMPropertyOrARIAAttribute(AOMStringProperty::kRelevant); if (relevant.isEmpty()) return defaultLiveRegionRelevant; return relevant; } ",0 "static void randomdelay(void) { usleep(rand() % 15000UL); /* dummy... no need for arc4 */ } ",0 "void GLES2Implementation::DrawElementsImpl(GLenum mode, GLsizei count, GLenum type, const void* indices, const char* func_name) { if (count < 0) { SetGLError(GL_INVALID_VALUE, func_name, ""count < 0""); return; } bool simulated = false; GLuint offset = ToGLuint(indices); if (count > 0) { if (vertex_array_object_manager_->bound_element_array_buffer() != 0 && !ValidateOffset(func_name, reinterpret_cast(indices))) { return; } if (!vertex_array_object_manager_->SetupSimulatedIndexAndClientSideBuffers( func_name, this, helper_, count, type, 0, indices, &offset, &simulated)) { return; } } helper_->DrawElements(mode, count, type, offset); RestoreElementAndArrayBuffers(simulated); CheckGLError(); } ",0 "Chunk::~Chunk() { } ",0 "void FrameLoader::load(const FrameLoadRequest& passedRequest, FrameLoadType frameLoadType, HistoryItem* historyItem, HistoryLoadType historyLoadType) { ASSERT(m_frame->document()); if (!m_frame->isNavigationAllowed()) return; if (m_inStopAllLoaders) return; if (m_frame->page()->defersLoading() && isBackForwardLoadType(frameLoadType)) { m_deferredHistoryLoad = DeferredHistoryLoad::create(passedRequest.resourceRequest(), historyItem, frameLoadType, historyLoadType); return; } FrameLoadRequest request(passedRequest); request.resourceRequest().setHasUserGesture(UserGestureIndicator::processingUserGesture()); if (!prepareRequestForThisFrame(request)) return; Frame* targetFrame = request.form() ? nullptr : m_frame->findFrameForNavigation(AtomicString(request.frameName()), *m_frame); if (isBackForwardLoadType(frameLoadType)) { ASSERT(historyItem); m_provisionalItem = historyItem; } if (targetFrame && targetFrame != m_frame) { bool wasInSamePage = targetFrame->page() == m_frame->page(); request.setFrameName(""_self""); targetFrame->navigate(request); Page* page = targetFrame->page(); if (!wasInSamePage && page) page->chromeClient().focus(); return; } setReferrerForFrameRequest(request); FrameLoadType newLoadType = (frameLoadType == FrameLoadTypeStandard) ? determineFrameLoadType(request) : frameLoadType; NavigationPolicy policy = navigationPolicyForRequest(request); if (shouldOpenInNewWindow(targetFrame, request, policy)) { if (policy == NavigationPolicyDownload) { client()->loadURLExternally(request.resourceRequest(), NavigationPolicyDownload, String(), false); } else { request.resourceRequest().setFrameType(WebURLRequest::FrameTypeAuxiliary); createWindowForRequest(request, *m_frame, policy); } return; } const KURL& url = request.resourceRequest().url(); bool sameDocumentHistoryNavigation = isBackForwardLoadType(newLoadType) && historyLoadType == HistorySameDocumentLoad; bool sameDocumentNavigation = policy == NavigationPolicyCurrentTab && shouldPerformFragmentNavigation( request.form(), request.resourceRequest().httpMethod(), newLoadType, url); if (sameDocumentHistoryNavigation || sameDocumentNavigation) { ASSERT(historyItem || !sameDocumentHistoryNavigation); RefPtr stateObject = sameDocumentHistoryNavigation ? historyItem->stateObject() : nullptr; if (!sameDocumentHistoryNavigation) { m_documentLoader->setNavigationType(determineNavigationType( newLoadType, false, request.triggeringEvent())); if (shouldTreatURLAsSameAsCurrent(url)) newLoadType = FrameLoadTypeReplaceCurrentItem; } loadInSameDocument(url, stateObject, newLoadType, historyLoadType, request.clientRedirect(), request.originDocument()); return; } startLoad(request, newLoadType, policy); } ",0 "static void burl_append_encode_nde (buffer * const b, const char * const str, const size_t len) { /* percent-encodes everything except unreserved - . 0-9 A-Z _ a-z ~ * unless already percent-encoded (does not double-encode) */ /* Note: not checking for invalid UTF-8 */ char * const p = buffer_string_prepare_append(b, len*3); unsigned int n1, n2; int j = 0; for (unsigned int i = 0; i < len; ++i, ++j) { if (str[i]=='%' && li_cton(str[i+1], n1) && li_cton(str[i+2], n2)) { const unsigned int x = (n1 << 4) | n2; if (burl_is_unreserved((int)x)) { p[j] = (char)x; } else { /* leave UTF-8, control chars, and required chars encoded */ p[j] = '%'; p[++j] = str[i+1]; p[++j] = str[i+2]; } i+=2; } else if (burl_is_unreserved(str[i])) { p[j] = str[i]; } else { p[j] = '%'; p[++j] = hex_chars_uc[(str[i] >> 4) & 0xF]; p[++j] = hex_chars_uc[str[i] & 0xF]; } } buffer_commit(b, j); } ",0 "int ssl_security_cert_chain(SSL *s, STACK_OF(X509) *sk, X509 *x, int vfy) { int rv, start_idx, i; if (x == NULL) { x = sk_X509_value(sk, 0); start_idx = 1; } else start_idx = 0; rv = ssl_security_cert(s, NULL, x, vfy, 1); if (rv != 1) return rv; for (i = start_idx; i < sk_X509_num(sk); i++) { x = sk_X509_value(sk, i); rv = ssl_security_cert(s, NULL, x, vfy, 0); if (rv != 1) return rv; } return 1; } ",0 "blink::WebString WebViewTestClient::AcceptLanguages() { return blink::WebString::FromUTF8(test_runner()->GetAcceptLanguages()); } ",0 "void ThreadableBlobRegistry::registerBlobURL(SecurityOrigin* origin, const KURL& url, const KURL& srcURL) { if (origin && BlobURL::getOrigin(url) == ""null"") originMap()->add(url.string(), origin); if (isMainThread()) blobRegistry().registerBlobURL(url, srcURL); else { OwnPtr context = adoptPtr(new BlobRegistryContext(url, srcURL)); callOnMainThread(®isterBlobURLFromTask, context.leakPtr()); } } ",1 "int update_write_order_info(rdpContext* context, wStream* s, ORDER_INFO* orderInfo, int offset) { size_t position; position = Stream_GetPosition(s); Stream_SetPosition(s, offset); Stream_Write_UINT8(s, orderInfo->controlFlags); /* controlFlags (1 byte) */ if (orderInfo->controlFlags & ORDER_TYPE_CHANGE) Stream_Write_UINT8(s, orderInfo->orderType); /* orderType (1 byte) */ update_write_field_flags(s, orderInfo->fieldFlags, orderInfo->controlFlags, PRIMARY_DRAWING_ORDER_FIELD_BYTES[orderInfo->orderType]); update_write_bounds(s, orderInfo); Stream_SetPosition(s, position); return 0; } ",0 "SyncBackendHost::DoInitializeOptions::DoInitializeOptions( MessageLoop* sync_loop, SyncBackendRegistrar* registrar, ExtensionsActivityMonitor* extensions_activity_monitor, const WeakHandle& event_handler, const GURL& service_url, MakeHttpBridgeFactoryFn make_http_bridge_factory_fn, const sync_api::SyncCredentials& credentials, ChromeSyncNotificationBridge* chrome_sync_notification_bridge, sync_notifier::SyncNotifierFactory* sync_notifier_factory, bool delete_sync_data_folder, const std::string& restored_key_for_bootstrapping, sync_api::SyncManager::TestingMode testing_mode, UnrecoverableErrorHandler* unrecoverable_error_handler, ReportUnrecoverableErrorFunction report_unrecoverable_error_function) : sync_loop(sync_loop), registrar(registrar), extensions_activity_monitor(extensions_activity_monitor), event_handler(event_handler), service_url(service_url), make_http_bridge_factory_fn(make_http_bridge_factory_fn), credentials(credentials), chrome_sync_notification_bridge(chrome_sync_notification_bridge), sync_notifier_factory(sync_notifier_factory), delete_sync_data_folder(delete_sync_data_folder), restored_key_for_bootstrapping(restored_key_for_bootstrapping), testing_mode(testing_mode), unrecoverable_error_handler(unrecoverable_error_handler), report_unrecoverable_error_function( report_unrecoverable_error_function) { } ",0 "static void Process_ipfix_templates(exporter_ipfix_domain_t *exporter, void *flowset_header, uint32_t size_left, FlowSource_t *fs) { ipfix_template_record_t *ipfix_template_record; void *DataPtr; uint32_t count; size_left -= 4; // subtract message header DataPtr = flowset_header + 4; ipfix_template_record = (ipfix_template_record_t *)DataPtr; count = ntohs(ipfix_template_record->FieldCount); if ( count == 0 ) { Process_ipfix_template_withdraw(exporter, DataPtr, size_left, fs); } else { Process_ipfix_template_add(exporter, DataPtr, size_left, fs); } } // End of Process_ipfix_templates ",0 "static void write_bulk_callback(struct urb *urb) { rtl8150_t *dev; int status = urb->status; dev = urb->context; if (!dev) return; dev_kfree_skb_irq(dev->tx_skb); if (!netif_device_present(dev->netdev)) return; if (status) dev_info(&urb->dev->dev, ""%s: Tx status %d\n"", dev->netdev->name, status); netif_trans_update(dev->netdev); netif_wake_queue(dev->netdev); } ",0 "SplashCoord *Splash::getMatrix() { return state->matrix; } ",0 "static void check_lifetime(struct work_struct *work) { unsigned long now, next, next_sec, next_sched; struct in_ifaddr *ifa; struct hlist_node *n; int i; now = jiffies; next = round_jiffies_up(now + ADDR_CHECK_FREQUENCY); for (i = 0; i < IN4_ADDR_HSIZE; i++) { bool change_needed = false; rcu_read_lock(); hlist_for_each_entry_rcu(ifa, &inet_addr_lst[i], hash) { unsigned long age; if (ifa->ifa_flags & IFA_F_PERMANENT) continue; /* We try to batch several events at once. */ age = (now - ifa->ifa_tstamp + ADDRCONF_TIMER_FUZZ_MINUS) / HZ; if (ifa->ifa_valid_lft != INFINITY_LIFE_TIME && age >= ifa->ifa_valid_lft) { change_needed = true; } else if (ifa->ifa_preferred_lft == INFINITY_LIFE_TIME) { continue; } else if (age >= ifa->ifa_preferred_lft) { if (time_before(ifa->ifa_tstamp + ifa->ifa_valid_lft * HZ, next)) next = ifa->ifa_tstamp + ifa->ifa_valid_lft * HZ; if (!(ifa->ifa_flags & IFA_F_DEPRECATED)) change_needed = true; } else if (time_before(ifa->ifa_tstamp + ifa->ifa_preferred_lft * HZ, next)) { next = ifa->ifa_tstamp + ifa->ifa_preferred_lft * HZ; } } rcu_read_unlock(); if (!change_needed) continue; rtnl_lock(); hlist_for_each_entry_safe(ifa, n, &inet_addr_lst[i], hash) { unsigned long age; if (ifa->ifa_flags & IFA_F_PERMANENT) continue; /* We try to batch several events at once. */ age = (now - ifa->ifa_tstamp + ADDRCONF_TIMER_FUZZ_MINUS) / HZ; if (ifa->ifa_valid_lft != INFINITY_LIFE_TIME && age >= ifa->ifa_valid_lft) { struct in_ifaddr **ifap; for (ifap = &ifa->ifa_dev->ifa_list; *ifap != NULL; ifap = &(*ifap)->ifa_next) { if (*ifap == ifa) { inet_del_ifa(ifa->ifa_dev, ifap, 1); break; } } } else if (ifa->ifa_preferred_lft != INFINITY_LIFE_TIME && age >= ifa->ifa_preferred_lft && !(ifa->ifa_flags & IFA_F_DEPRECATED)) { ifa->ifa_flags |= IFA_F_DEPRECATED; rtmsg_ifa(RTM_NEWADDR, ifa, NULL, 0); } } rtnl_unlock(); } next_sec = round_jiffies_up(next); next_sched = next; /* If rounded timeout is accurate enough, accept it. */ if (time_before(next_sec, next + ADDRCONF_TIMER_FUZZ)) next_sched = next_sec; now = jiffies; /* And minimum interval is ADDRCONF_TIMER_FUZZ_MAX. */ if (time_before(next_sched, now + ADDRCONF_TIMER_FUZZ_MAX)) next_sched = now + ADDRCONF_TIMER_FUZZ_MAX; queue_delayed_work(system_power_efficient_wq, &check_lifetime_work, next_sched - now); } ",0 "OverrideVideoCaptureDeviceFactory( std::unique_ptr platform_factory) { return base::WrapUnique( new VideoCaptureDeviceFactoryLinux(std::move(platform_factory))); } ",0 "call_ready_callbacks (NautilusDirectory *directory) { gboolean found_any; GList *node, *next; ReadyCallback *callback; found_any = FALSE; /* Check if any callbacks are satisifed and mark them for call them if they are. */ for (node = directory->details->call_when_ready_list; node != NULL; node = next) { next = node->next; callback = node->data; if (callback->active && request_is_satisfied (directory, callback->file, callback->request)) { callback->active = FALSE; found_any = TRUE; } } if (found_any) { schedule_call_ready_callbacks (directory); } return found_any; } ",0 "osf_procfs_mount(char *dirname, struct procfs_args __user *args, int flags) { struct procfs_args tmp; if (copy_from_user(&tmp, args, sizeof(tmp))) return -EFAULT; return do_mount("""", dirname, ""proc"", flags, NULL); } ",0 "png_do_gray_to_rgb(png_row_infop row_info, png_bytep row) { png_uint_32 i; png_uint_32 row_width = row_info->width; png_debug(1, ""in png_do_gray_to_rgb""); if (row_info->bit_depth >= 8 && #ifdef PNG_USELESS_TESTS_SUPPORTED row != NULL && row_info != NULL && #endif !(row_info->color_type & PNG_COLOR_MASK_COLOR)) { if (row_info->color_type == PNG_COLOR_TYPE_GRAY) { if (row_info->bit_depth == 8) { png_bytep sp = row + (png_size_t)row_width - 1; png_bytep dp = sp + (png_size_t)row_width * 2; for (i = 0; i < row_width; i++) { *(dp--) = *sp; *(dp--) = *sp; *(dp--) = *(sp--); } } else { png_bytep sp = row + (png_size_t)row_width * 2 - 1; png_bytep dp = sp + (png_size_t)row_width * 4; for (i = 0; i < row_width; i++) { *(dp--) = *sp; *(dp--) = *(sp - 1); *(dp--) = *sp; *(dp--) = *(sp - 1); *(dp--) = *(sp--); *(dp--) = *(sp--); } } } else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) { if (row_info->bit_depth == 8) { png_bytep sp = row + (png_size_t)row_width * 2 - 1; png_bytep dp = sp + (png_size_t)row_width * 2; for (i = 0; i < row_width; i++) { *(dp--) = *(sp--); *(dp--) = *sp; *(dp--) = *sp; *(dp--) = *(sp--); } } else { png_bytep sp = row + (png_size_t)row_width * 4 - 1; png_bytep dp = sp + (png_size_t)row_width * 4; for (i = 0; i < row_width; i++) { *(dp--) = *(sp--); *(dp--) = *(sp--); *(dp--) = *sp; *(dp--) = *(sp - 1); *(dp--) = *sp; *(dp--) = *(sp - 1); *(dp--) = *(sp--); *(dp--) = *(sp--); } } } row_info->channels += (png_byte)2; row_info->color_type |= PNG_COLOR_MASK_COLOR; row_info->pixel_depth = (png_byte)(row_info->channels * row_info->bit_depth); row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width); } } ",0 "static void jpg_start_output(j_decompress_ptr cinfo, jpg_dest_t *dinfo) { /* Avoid compiler warnings about unused parameters. */ cinfo = 0; JAS_DBGLOG(10, (""jpg_start_output(%p, %p)\n"", cinfo, dinfo)); dinfo->row = 0; } ",0 "void WebContentsImpl::LoadStateChanged( const GURL& url, const net::LoadStateWithParam& load_state, uint64 upload_position, uint64 upload_size) { load_state_ = load_state; upload_position_ = upload_position; upload_size_ = upload_size; load_state_host_ = net::IDNToUnicode(url.host(), GetContentClient()->browser()->GetAcceptLangs( GetBrowserContext())); if (load_state_.state == net::LOAD_STATE_READING_RESPONSE) SetNotWaitingForResponse(); if (IsLoading()) { NotifyNavigationStateChanged(INVALIDATE_TYPE_LOAD | INVALIDATE_TYPE_TAB); } } ",0 "void UDPSocketWin::AllowAddressReuse() { DCHECK(CalledOnValidThread()); DCHECK(!is_connected()); socket_options_ |= SOCKET_OPTION_REUSE_ADDRESS; } ",0 "int ndp_msgrcv_handler_register(struct ndp *ndp, ndp_msgrcv_handler_func_t func, enum ndp_msg_type msg_type, uint32_t ifindex, void *priv) { struct ndp_msgrcv_handler_item *handler_item; if (ndp_find_msgrcv_handler_item(ndp, func, msg_type, ifindex, priv)) return -EEXIST; if (!func) return -EINVAL; handler_item = malloc(sizeof(*handler_item)); if (!handler_item) return -ENOMEM; handler_item->func = func; handler_item->msg_type = msg_type; handler_item->ifindex = ifindex; handler_item->priv = priv; list_add_tail(&ndp->msgrcv_handler_list, &handler_item->list); return 0; } ",0 "bool ProcessNeedsProfileDir(const std::string& process_type) { return ProcessNeedsProfileDir(GetProcessType(UTF8ToUTF16(process_type))); } ",0 "tcp_sacktag_write_queue(struct sock *sk, const struct sk_buff *ack_skb, u32 prior_snd_una, struct tcp_sacktag_state *state) { struct tcp_sock *tp = tcp_sk(sk); const unsigned char *ptr = (skb_transport_header(ack_skb) + TCP_SKB_CB(ack_skb)->sacked); struct tcp_sack_block_wire *sp_wire = (struct tcp_sack_block_wire *)(ptr+2); struct tcp_sack_block sp[TCP_NUM_SACKS]; struct tcp_sack_block *cache; struct sk_buff *skb; int num_sacks = min(TCP_NUM_SACKS, (ptr[1] - TCPOLEN_SACK_BASE) >> 3); int used_sacks; bool found_dup_sack = false; int i, j; int first_sack_index; state->flag = 0; state->reord = tp->packets_out; if (!tp->sacked_out) { if (WARN_ON(tp->fackets_out)) tp->fackets_out = 0; tcp_highest_sack_reset(sk); } found_dup_sack = tcp_check_dsack(sk, ack_skb, sp_wire, num_sacks, prior_snd_una); if (found_dup_sack) state->flag |= FLAG_DSACKING_ACK; /* Eliminate too old ACKs, but take into * account more or less fresh ones, they can * contain valid SACK info. */ if (before(TCP_SKB_CB(ack_skb)->ack_seq, prior_snd_una - tp->max_window)) return 0; if (!tp->packets_out) goto out; used_sacks = 0; first_sack_index = 0; for (i = 0; i < num_sacks; i++) { bool dup_sack = !i && found_dup_sack; sp[used_sacks].start_seq = get_unaligned_be32(&sp_wire[i].start_seq); sp[used_sacks].end_seq = get_unaligned_be32(&sp_wire[i].end_seq); if (!tcp_is_sackblock_valid(tp, dup_sack, sp[used_sacks].start_seq, sp[used_sacks].end_seq)) { int mib_idx; if (dup_sack) { if (!tp->undo_marker) mib_idx = LINUX_MIB_TCPDSACKIGNOREDNOUNDO; else mib_idx = LINUX_MIB_TCPDSACKIGNOREDOLD; } else { /* Don't count olds caused by ACK reordering */ if ((TCP_SKB_CB(ack_skb)->ack_seq != tp->snd_una) && !after(sp[used_sacks].end_seq, tp->snd_una)) continue; mib_idx = LINUX_MIB_TCPSACKDISCARD; } NET_INC_STATS(sock_net(sk), mib_idx); if (i == 0) first_sack_index = -1; continue; } /* Ignore very old stuff early */ if (!after(sp[used_sacks].end_seq, prior_snd_una)) continue; used_sacks++; } /* order SACK blocks to allow in order walk of the retrans queue */ for (i = used_sacks - 1; i > 0; i--) { for (j = 0; j < i; j++) { if (after(sp[j].start_seq, sp[j + 1].start_seq)) { swap(sp[j], sp[j + 1]); /* Track where the first SACK block goes to */ if (j == first_sack_index) first_sack_index = j + 1; } } } skb = tcp_write_queue_head(sk); state->fack_count = 0; i = 0; if (!tp->sacked_out) { /* It's already past, so skip checking against it */ cache = tp->recv_sack_cache + ARRAY_SIZE(tp->recv_sack_cache); } else { cache = tp->recv_sack_cache; /* Skip empty blocks in at head of the cache */ while (tcp_sack_cache_ok(tp, cache) && !cache->start_seq && !cache->end_seq) cache++; } while (i < used_sacks) { u32 start_seq = sp[i].start_seq; u32 end_seq = sp[i].end_seq; bool dup_sack = (found_dup_sack && (i == first_sack_index)); struct tcp_sack_block *next_dup = NULL; if (found_dup_sack && ((i + 1) == first_sack_index)) next_dup = &sp[i + 1]; /* Skip too early cached blocks */ while (tcp_sack_cache_ok(tp, cache) && !before(start_seq, cache->end_seq)) cache++; /* Can skip some work by looking recv_sack_cache? */ if (tcp_sack_cache_ok(tp, cache) && !dup_sack && after(end_seq, cache->start_seq)) { /* Head todo? */ if (before(start_seq, cache->start_seq)) { skb = tcp_sacktag_skip(skb, sk, state, start_seq); skb = tcp_sacktag_walk(skb, sk, next_dup, state, start_seq, cache->start_seq, dup_sack); } /* Rest of the block already fully processed? */ if (!after(end_seq, cache->end_seq)) goto advance_sp; skb = tcp_maybe_skipping_dsack(skb, sk, next_dup, state, cache->end_seq); /* ...tail remains todo... */ if (tcp_highest_sack_seq(tp) == cache->end_seq) { /* ...but better entrypoint exists! */ skb = tcp_highest_sack(sk); if (!skb) break; state->fack_count = tp->fackets_out; cache++; goto walk; } skb = tcp_sacktag_skip(skb, sk, state, cache->end_seq); /* Check overlap against next cached too (past this one already) */ cache++; continue; } if (!before(start_seq, tcp_highest_sack_seq(tp))) { skb = tcp_highest_sack(sk); if (!skb) break; state->fack_count = tp->fackets_out; } skb = tcp_sacktag_skip(skb, sk, state, start_seq); walk: skb = tcp_sacktag_walk(skb, sk, next_dup, state, start_seq, end_seq, dup_sack); advance_sp: i++; } /* Clear the head of the cache sack blocks so we can skip it next time */ for (i = 0; i < ARRAY_SIZE(tp->recv_sack_cache) - used_sacks; i++) { tp->recv_sack_cache[i].start_seq = 0; tp->recv_sack_cache[i].end_seq = 0; } for (j = 0; j < used_sacks; j++) tp->recv_sack_cache[i++] = sp[j]; if ((state->reord < tp->fackets_out) && ((inet_csk(sk)->icsk_ca_state != TCP_CA_Loss) || tp->undo_marker)) tcp_update_reordering(sk, tp->fackets_out - state->reord, 0); tcp_verify_left_out(tp); out: #if FASTRETRANS_DEBUG > 0 WARN_ON((int)tp->sacked_out < 0); WARN_ON((int)tp->lost_out < 0); WARN_ON((int)tp->retrans_out < 0); WARN_ON((int)tcp_packets_in_flight(tp) < 0); #endif return state->flag; } ",0 "void AudioHandler::PrintNodeCounts() { fprintf(stderr, ""\n\n""); fprintf(stderr, ""===========================\n""); fprintf(stderr, ""AudioNode: reference counts\n""); fprintf(stderr, ""===========================\n""); for (unsigned i = 0; i < kNodeTypeEnd; ++i) fprintf(stderr, ""%2d: %d\n"", i, node_count_[i]); fprintf(stderr, ""===========================\n\n\n""); } ",0 "const char* Chapters::Display::GetLanguage() const { return m_language; } ",1 "DestroyConstructResourceBytesCtx(ConstructResourceBytesCtx *ctx) { DestroyFragments(&ctx->response); ht_destroy(ctx->visitedResources); } ",0 "bool PpapiPluginProcessHost::Init(const content::PepperPluginInfo& info) { plugin_path_ = info.path; if (info.name.empty()) { process_->SetName(plugin_path_.BaseName().LossyDisplayName()); } else { process_->SetName(UTF8ToUTF16(info.name)); } std::string channel_id = process_->GetHost()->CreateChannel(); if (channel_id.empty()) return false; const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); CommandLine::StringType plugin_launcher = browser_command_line.GetSwitchValueNative(switches::kPpapiPluginLauncher); #if defined(OS_LINUX) int flags = plugin_launcher.empty() ? ChildProcessHost::CHILD_ALLOW_SELF : ChildProcessHost::CHILD_NORMAL; #else int flags = ChildProcessHost::CHILD_NORMAL; #endif FilePath exe_path = ChildProcessHost::GetChildPath(flags); if (exe_path.empty()) return false; CommandLine* cmd_line = new CommandLine(exe_path); cmd_line->AppendSwitchASCII(switches::kProcessType, is_broker_ ? switches::kPpapiBrokerProcess : switches::kPpapiPluginProcess); cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id); static const char* kCommonForwardSwitches[] = { switches::kVModule }; cmd_line->CopySwitchesFrom(browser_command_line, kCommonForwardSwitches, arraysize(kCommonForwardSwitches)); if (!is_broker_) { static const char* kPluginForwardSwitches[] = { switches::kNoSandbox, switches::kDisableSeccompFilterSandbox, switches::kPpapiFlashArgs, switches::kPpapiStartupDialog }; cmd_line->CopySwitchesFrom(browser_command_line, kPluginForwardSwitches, arraysize(kPluginForwardSwitches)); } std::string locale = content::GetContentClient()->browser()->GetApplicationLocale(); if (!locale.empty()) { cmd_line->AppendSwitchASCII(switches::kLang, locale); } if (!plugin_launcher.empty()) cmd_line->PrependWrapper(plugin_launcher); #if defined(OS_POSIX) bool use_zygote = !is_broker_ && plugin_launcher.empty() && info.is_sandboxed; if (!info.is_sandboxed) cmd_line->AppendSwitchASCII(switches::kNoSandbox, """"); #endif // OS_POSIX process_->Launch( #if defined(OS_WIN) FilePath(), #elif defined(OS_POSIX) use_zygote, base::EnvironmentVector(), #endif cmd_line); return true; } ",0 "error::Error GLES2DecoderImpl::DoCompressedTexSubImage( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei image_size, const void * data, ContextState::Dimension dimension) { const char* func_name; if (dimension == ContextState::k2D) { func_name = ""glCompressedTexSubImage2D""; if (!validators_->texture_target.IsValid(target)) { LOCAL_SET_GL_ERROR_INVALID_ENUM(func_name, target, ""target""); return error::kNoError; } } else { DCHECK_EQ(ContextState::k3D, dimension); func_name = ""glCompressedTexSubImage3D""; if (!validators_->texture_3_d_target.IsValid(target)) { LOCAL_SET_GL_ERROR_INVALID_ENUM(func_name, target, ""target""); return error::kNoError; } } if (!validators_->compressed_texture_format.IsValid(format)) { LOCAL_SET_GL_ERROR_INVALID_ENUM(func_name, format, ""format""); return error::kNoError; } if (image_size < 0) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, ""imageSize < 0""); return error::kNoError; } if (!texture_manager()->ValidForTarget(target, level, width, height, depth)) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, ""dimensions out of range""); return error::kNoError; } TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( &state_, target); if (!texture_ref) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, func_name, ""no texture bound at target""); return error::kNoError; } Texture* texture = texture_ref->texture(); GLenum type = 0; GLenum internal_format = 0; if (!texture->GetLevelType(target, level, &type, &internal_format)) { std::string msg = base::StringPrintf(""level %d does not exist"", level); LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, msg.c_str()); return error::kNoError; } if (internal_format != format) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, ""format does not match internalformat.""); return error::kNoError; } if (!texture->ValidForTexture(target, level, xoffset, yoffset, zoffset, width, height, depth)) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, ""bad dimensions.""); return error::kNoError; } if (!ValidateCompressedTexFuncData( func_name, width, height, depth, format, image_size, data) || !ValidateCompressedTexSubDimensions( func_name, target, level, xoffset, yoffset, zoffset, width, height, depth, format, texture)) { return error::kNoError; } if (image_size > 0 && !state_.bound_pixel_unpack_buffer && !data) return error::kInvalidArguments; if (!texture->IsLevelCleared(target, level)) { DCHECK(texture->IsImmutable()); GLsizei level_width = 0, level_height = 0, level_depth = 0; bool success = texture->GetLevelSize( target, level, &level_width, &level_height, &level_depth); DCHECK(success); if (xoffset == 0 && width == level_width && yoffset == 0 && height == level_height && zoffset == 0 && depth == level_depth) { texture_manager()->SetLevelCleared(texture_ref, target, level, true); } else { texture_manager()->ClearTextureLevel(this, texture_ref, target, level); } DCHECK(texture->IsLevelCleared(target, level)); } const CompressedFormatInfo* format_info = GetCompressedFormatInfo(internal_format); if (format_info != nullptr && !format_info->support_check(*feature_info_)) { std::unique_ptr decompressed_data = DecompressTextureData( state_, *format_info, width, height, depth, image_size, data); if (!decompressed_data) { MarkContextLost(error::kGuilty); group_->LoseContexts(error::kInnocent); return error::kLostContext; } ScopedPixelUnpackState reset_restore(&state_); if (dimension == ContextState::k2D) { api()->glTexSubImage2DFn(target, level, xoffset, yoffset, width, height, format_info->decompressed_format, format_info->decompressed_type, decompressed_data.get()); } else { api()->glTexSubImage3DFn(target, level, xoffset, yoffset, zoffset, width, height, depth, format_info->decompressed_format, format_info->decompressed_type, decompressed_data.get()); } } else { if (dimension == ContextState::k2D) { api()->glCompressedTexSubImage2DFn(target, level, xoffset, yoffset, width, height, format, image_size, data); } else { api()->glCompressedTexSubImage3DFn(target, level, xoffset, yoffset, zoffset, width, height, depth, format, image_size, data); } } ExitCommandProcessingEarly(); return error::kNoError; } ",0 "static void voidMethodOptionalLongArgMethod(const v8::FunctionCallbackInfo& info) { ExceptionState exceptionState(ExceptionState::ExecutionContext, ""voidMethodOptionalLongArg"", ""TestObjectPython"", info.Holder(), info.GetIsolate()); TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); if (UNLIKELY(info.Length() <= 0)) { imp->voidMethodOptionalLongArg(); return; } V8TRYCATCH_EXCEPTION_VOID(int, optionalLongArg, toInt32(info[0], exceptionState), exceptionState); imp->voidMethodOptionalLongArg(optionalLongArg); } ",0 "static struct key *request_master_key(struct encrypted_key_payload *epayload, u8 **master_key, size_t *master_keylen) { struct key *mkey = NULL; if (!strncmp(epayload->master_desc, KEY_TRUSTED_PREFIX, KEY_TRUSTED_PREFIX_LEN)) { mkey = request_trusted_key(epayload->master_desc + KEY_TRUSTED_PREFIX_LEN, master_key, master_keylen); } else if (!strncmp(epayload->master_desc, KEY_USER_PREFIX, KEY_USER_PREFIX_LEN)) { mkey = request_user_key(epayload->master_desc + KEY_USER_PREFIX_LEN, master_key, master_keylen); } else goto out; if (IS_ERR(mkey)) { int ret = PTR_ERR(mkey); if (ret == -ENOTSUPP) pr_info(""encrypted_key: key %s not supported"", epayload->master_desc); else pr_info(""encrypted_key: key %s not found"", epayload->master_desc); goto out; } dump_master_key(*master_key, *master_keylen); out: return mkey; } ",0 "void TextTrack::CueDidChange(TextTrackCue* cue, bool update_cue_index) { DCHECK(cues_ && cue->track() == this); if (update_cue_index) cues_->UpdateCueIndex(cue); DCHECK(!cue->IsActive()); if (mode_ == DisabledKeyword()) return; if (GetCueTimeline()) GetCueTimeline()->AddCue(this, cue); } ",0 " bool ExtensionResourceRequestPolicy::CanRequestResource( const GURL& resource_url, const GURL& frame_url, const ExtensionSet* loaded_extensions) { CHECK(resource_url.SchemeIs(chrome::kExtensionScheme)); const Extension* extension = loaded_extensions->GetExtensionOrAppByURL(ExtensionURLInfo(resource_url)); if (!extension) { return true; } std::string resource_root_relative_path = resource_url.path().empty() ? """" : resource_url.path().substr(1); if (extension->is_hosted_app() && !extension->icons().ContainsPath(resource_root_relative_path)) { LOG(ERROR) << ""Denying load of "" << resource_url.spec() << "" from "" << ""hosted app.""; return false; } if (!CommandLine::ForCurrentProcess()->HasSwitch( switches::kDisableExtensionsResourceWhitelist) && !frame_url.is_empty() && !frame_url.SchemeIs(chrome::kExtensionScheme) && !extension->IsResourceWebAccessible(resource_url.path())) { LOG(ERROR) << ""Denying load of "" << resource_url.spec() << "" which "" << ""is not a web accessible resource.""; return false; } return true; } ",1 "bool GetScrollOffsets(const base::NativeEvent& native_event, float* x_offset, float* y_offset, float* x_offset_ordinal, float* y_offset_ordinal, int* finger_count) { if (native_event.message == WM_VSCROLL || native_event.message == WM_HSCROLL) return true; return false; } ",0 "__oldXMLWDcompatibility(void) { if (IS_MAIN_THREAD) return (&oldXMLWDcompatibility); else return (&xmlGetGlobalState()->oldXMLWDcompatibility); } ",0 " void CWebServer::Cmd_ClearSceneCodes(WebEmSession & session, const request& req, Json::Value &root) { if (session.rights != 2) { session.reply_status = reply::forbidden; return; //Only admin user allowed } std::string sceneidx = request::findValue(&req, ""sceneidx""); if (sceneidx.empty()) return; root[""status""] = ""OK""; root[""title""] = ""ClearSceneCode""; m_sql.safe_query(""UPDATE Scenes SET Activators='' WHERE (ID==%q)"", sceneidx.c_str()); } ",0 "static double get_final_sample_using_nc_tbl(struct iw_context *ctx, iw_tmpsample samp_lin) { unsigned int x; unsigned int d; x = 127; d = 64; while(1) { if(x>254 || ctx->nearest_color_table[x] > samp_lin) x -= d; else x += d; if(d==1) { if(x>254 || ctx->nearest_color_table[x] > samp_lin) return (double)(x); else return (double)(x+1); } d = d/2; } } ",0 "int snd_card_locked(int card) { int locked; mutex_lock(&snd_card_mutex); locked = test_bit(card, snd_cards_lock); mutex_unlock(&snd_card_mutex); return locked; } ",0 "GDataCache* GDataCache::CreateGDataCacheOnUIThread( const FilePath& cache_root_path, base::SequencedWorkerPool* pool, const base::SequencedWorkerPool::SequenceToken& sequence_token) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); return new GDataCache(cache_root_path, pool, sequence_token); } ",0 " void Stop() { decoder_->Stop(NewExpectedClosure()); message_loop_.RunAllPending(); } ",0 " int AskAllowCount() { return mock_permission_prompt_factory_->show_count(); } ",0 "extension_info_cancel (NautilusDirectory *directory) { if (directory->details->extension_info_in_progress != NULL) { if (directory->details->extension_info_idle) { g_source_remove (directory->details->extension_info_idle); } else { nautilus_info_provider_cancel_update (directory->details->extension_info_provider, directory->details->extension_info_in_progress); } directory->details->extension_info_in_progress = NULL; directory->details->extension_info_file = NULL; directory->details->extension_info_provider = NULL; directory->details->extension_info_idle = 0; async_job_end (directory, ""extension info""); } } ",0 "static size_t UTF8ToUTF16(const unsigned char *utf8,wchar_t *utf16) { register const unsigned char *p; if (utf16 != (wchar_t *) NULL) { register wchar_t *q; wchar_t c; /* Convert UTF-8 to UTF-16. */ q=utf16; for (p=utf8; *p != '\0'; p++) { if ((*p & 0x80) == 0) *q=(*p); else if ((*p & 0xE0) == 0xC0) { c=(*p); *q=(c & 0x1F) << 6; p++; if ((*p & 0xC0) != 0x80) return(0); *q|=(*p & 0x3F); } else if ((*p & 0xF0) == 0xE0) { c=(*p); *q=c << 12; p++; if ((*p & 0xC0) != 0x80) return(0); c=(*p); *q|=(c & 0x3F) << 6; p++; if ((*p & 0xC0) != 0x80) return(0); *q|=(*p & 0x3F); } else return(0); q++; } *q++='\0'; return(q-utf16); } /* Compute UTF-16 string length. */ for (p=utf8; *p != '\0'; p++) { if ((*p & 0x80) == 0) ; else if ((*p & 0xE0) == 0xC0) { p++; if ((*p & 0xC0) != 0x80) return(0); } else if ((*p & 0xF0) == 0xE0) { p++; if ((*p & 0xC0) != 0x80) return(0); p++; if ((*p & 0xC0) != 0x80) return(0); } else return(0); } return(p-utf8); } ",0 "SPL_METHOD(SplFileInfo, getFilename) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); int path_len; if (zend_parse_parameters_none() == FAILURE) { return; } spl_filesystem_object_get_path(intern, &path_len TSRMLS_CC); if (path_len && path_len < intern->file_name_len) { RETURN_STRINGL(intern->file_name + path_len + 1, intern->file_name_len - (path_len + 1), 1); } else { RETURN_STRINGL(intern->file_name, intern->file_name_len, 1); } } ",1 "SProcXvPutImage(ClientPtr client) { REQUEST(xvPutImageReq); REQUEST_AT_LEAST_SIZE(xvPutImageReq); swaps(&stuff->length); swapl(&stuff->port); swapl(&stuff->drawable); swapl(&stuff->gc); swapl(&stuff->id); swaps(&stuff->src_x); swaps(&stuff->src_y); swaps(&stuff->src_w); swaps(&stuff->src_h); swaps(&stuff->drw_x); swaps(&stuff->drw_y); swaps(&stuff->drw_w); swaps(&stuff->drw_h); swaps(&stuff->width); swaps(&stuff->height); return XvProcVector[xv_PutImage] (client); } ",0 "int Downmix_Configure(downmix_module_t *pDwmModule, effect_config_t *pConfig, bool init) { downmix_object_t *pDownmixer = &pDwmModule->context; if (pConfig->inputCfg.samplingRate != pConfig->outputCfg.samplingRate || pConfig->outputCfg.channels != DOWNMIX_OUTPUT_CHANNELS || pConfig->inputCfg.format != AUDIO_FORMAT_PCM_16_BIT || pConfig->outputCfg.format != AUDIO_FORMAT_PCM_16_BIT) { ALOGE(""Downmix_Configure error: invalid config""); return -EINVAL; } if (&pDwmModule->config != pConfig) { memcpy(&pDwmModule->config, pConfig, sizeof(effect_config_t)); } if (init) { pDownmixer->type = DOWNMIX_TYPE_FOLD; pDownmixer->apply_volume_correction = false; pDownmixer->input_channel_count = 8; // matches default input of AUDIO_CHANNEL_OUT_7POINT1 } else { if (!Downmix_validChannelMask(pConfig->inputCfg.channels)) { ALOGE(""Downmix_Configure error: input channel mask(0x%x) not supported"", pConfig->inputCfg.channels); return -EINVAL; } pDownmixer->input_channel_count = audio_channel_count_from_out_mask(pConfig->inputCfg.channels); } Downmix_Reset(pDownmixer, init); return 0; } ",0 "void GLES2DecoderImpl::DeleteFramebuffersHelper( GLsizei n, const GLuint* client_ids) { bool supports_separate_framebuffer_binds = features().chromium_framebuffer_multisample; for (GLsizei ii = 0; ii < n; ++ii) { Framebuffer* framebuffer = GetFramebuffer(client_ids[ii]); if (framebuffer && !framebuffer->IsDeleted()) { if (framebuffer == framebuffer_state_.bound_draw_framebuffer.get()) { GLenum target = supports_separate_framebuffer_binds ? GL_DRAW_FRAMEBUFFER_EXT : GL_FRAMEBUFFER; if (workarounds().unbind_attachments_on_bound_render_fbo_delete) framebuffer->DoUnbindGLAttachmentsForWorkaround(target); glBindFramebufferEXT(target, GetBackbufferServiceId()); framebuffer_state_.bound_draw_framebuffer = NULL; framebuffer_state_.clear_state_dirty = true; } if (framebuffer == framebuffer_state_.bound_read_framebuffer.get()) { framebuffer_state_.bound_read_framebuffer = NULL; GLenum target = supports_separate_framebuffer_binds ? GL_READ_FRAMEBUFFER_EXT : GL_FRAMEBUFFER; glBindFramebufferEXT(target, GetBackbufferServiceId()); } OnFboChanged(); RemoveFramebuffer(client_ids[ii]); } } } ",0 "static AVIndexEntry *mov_find_next_sample(AVFormatContext *s, AVStream **st) { AVIndexEntry *sample = NULL; int64_t best_dts = INT64_MAX; int i; for (i = 0; i < s->nb_streams; i++) { AVStream *avst = s->streams[i]; MOVStreamContext *msc = avst->priv_data; if (msc->pb && msc->current_sample < avst->nb_index_entries) { AVIndexEntry *current_sample = &avst->index_entries[msc->current_sample]; int64_t dts = av_rescale(current_sample->timestamp, AV_TIME_BASE, msc->time_scale); av_log(s, AV_LOG_TRACE, ""stream %d, sample %d, dts %""PRId64""\n"", i, msc->current_sample, dts); if (!sample || (!(s->pb->seekable & AVIO_SEEKABLE_NORMAL) && current_sample->pos < sample->pos) || ((s->pb->seekable & AVIO_SEEKABLE_NORMAL) && ((msc->pb != s->pb && dts < best_dts) || (msc->pb == s->pb && ((FFABS(best_dts - dts) <= AV_TIME_BASE && current_sample->pos < sample->pos) || (FFABS(best_dts - dts) > AV_TIME_BASE && dts < best_dts)))))) { sample = current_sample; best_dts = dts; *st = avst; } } } return sample; } ",0 "WebContentsImpl* WebContentsImpl::GetCreatedWindow( int process_id, int main_frame_widget_route_id) { auto key = std::make_pair(process_id, main_frame_widget_route_id); auto iter = pending_contents_.find(key); if (iter == pending_contents_.end()) return nullptr; WebContentsImpl* new_contents = iter->second; pending_contents_.erase(key); RemoveDestructionObserver(new_contents); if (BrowserPluginGuest::IsGuest(new_contents)) return new_contents; if (!new_contents->GetMainFrame()->GetProcess()->HasConnection() || !new_contents->GetMainFrame()->GetView()) { return nullptr; } return new_contents; } ",0 "IW_IMPL(void) iw_set_option(struct iw_context *ctx, const char *name, const char *val) { #define IW_MAX_OPTIONS 32 int i; if(val==NULL || val[0]=='\0') { val = ""1""; } if(!ctx->req.options) { ctx->req.options = iw_mallocz(ctx, IW_MAX_OPTIONS*sizeof(struct iw_option_struct)); if(!ctx->req.options) return; ctx->req.options_numalloc = IW_MAX_OPTIONS; ctx->req.options_count = 0; } for(i=0; ireq.options_count; i++) { if(ctx->req.options[i].name && !strcmp(ctx->req.options[i].name, name)) { iw_free(ctx, ctx->req.options[i].val); ctx->req.options[i].val = iw_strdup(ctx, val); return; } } if(ctx->req.options_count>=IW_MAX_OPTIONS) return; ctx->req.options[ctx->req.options_count].name = iw_strdup(ctx, name); ctx->req.options[ctx->req.options_count].val = iw_strdup(ctx, val); ctx->req.options_count++; } ",0 "pdf_unset_pattern(fz_context *ctx, pdf_run_processor *pr, int what) { pdf_gstate *gs = pr->gstate + pr->gtop; pdf_material *mat; mat = what == PDF_FILL ? &gs->fill : &gs->stroke; if (mat->kind == PDF_MAT_PATTERN) { pdf_drop_pattern(ctx, mat->pattern); mat->pattern = NULL; mat->kind = PDF_MAT_COLOR; } } ",0 "tsize_t t2p_sample_lab_signed_to_unsigned(tdata_t buffer, uint32 samplecount){ uint32 i=0; for(i=0;iocs + (reg->ops_curr - reg->ops)) = opcode; #else reg->ops_curr->opcode = opcode; #endif return 0; } ",0 "setparam(const char *p) { size_t i; char *s; if ((s = strchr(p, '=')) == NULL) goto badparm; for (i = 0; i < __arraycount(pm); i++) { if (strncmp(p, pm[i].name, s - p) != 0) continue; pm[i].value = atoi(s + 1); return; } badparm: (void)fprintf(stderr, ""%s: Unknown param %s\n"", progname, p); exit(1); } ",0 "void PrintPreviewHandler::OnPrintPreviewFailed() { if (reported_failed_preview_) return; reported_failed_preview_ = true; ReportUserActionHistogram(PREVIEW_FAILED); } ",0 "void TestingAutomationProvider::ImportSettings(Browser* browser, DictionaryValue* args, IPC::Message* reply_message) { std::map string_to_import_item; string_to_import_item[""HISTORY""] = importer::HISTORY; string_to_import_item[""FAVORITES""] = importer::FAVORITES; string_to_import_item[""COOKIES""] = importer::COOKIES; string_to_import_item[""PASSWORDS""] = importer::PASSWORDS; string_to_import_item[""SEARCH_ENGINES""] = importer::SEARCH_ENGINES; string_to_import_item[""HOME_PAGE""] = importer::HOME_PAGE; string_to_import_item[""ALL""] = importer::ALL; ListValue* import_items_list = NULL; if (!args->GetString(""import_from"", &import_settings_data_.browser_name) || !args->GetBoolean(""first_run"", &import_settings_data_.first_run) || !args->GetList(""import_items"", &import_items_list)) { AutomationJSONReply(this, reply_message) .SendError(""Incorrect type for one or more of the arguments.""); return; } import_settings_data_.import_items = 0; int num_items = import_items_list->GetSize(); for (int i = 0; i < num_items; i++) { std::string item; if (!import_items_list->GetString(i, &item) || !ContainsKey(string_to_import_item, item)) { AutomationJSONReply(this, reply_message) .SendError(""Invalid item string found in import_items.""); return; } import_settings_data_.import_items |= string_to_import_item[item]; } import_settings_data_.browser = browser; import_settings_data_.reply_message = reply_message; importer_list_ = new ImporterList(NULL); importer_list_->DetectSourceProfiles(this); } ",0 "int tipc_sock_create_local(int type, struct socket **res) { int rc; struct sock *sk; rc = sock_create_lite(AF_TIPC, type, 0, res); if (rc < 0) { pr_err(""Failed to create kernel socket\n""); return rc; } tipc_sk_create(&init_net, *res, 0, 1); sk = (*res)->sk; return 0; } ",0 "bool VerifySpecificPathControlledByUser(const FilePath& path, uid_t owner_uid, const std::set& group_gids) { stat_wrapper_t stat_info; if (CallLstat(path.value().c_str(), &stat_info) != 0) { DPLOG(ERROR) << ""Failed to get information on path "" << path.value(); return false; } if (S_ISLNK(stat_info.st_mode)) { DLOG(ERROR) << ""Path "" << path.value() << "" is a symbolic link.""; return false; } if (stat_info.st_uid != owner_uid) { DLOG(ERROR) << ""Path "" << path.value() << "" is owned by the wrong user.""; return false; } if ((stat_info.st_mode & S_IWGRP) && !ContainsKey(group_gids, stat_info.st_gid)) { DLOG(ERROR) << ""Path "" << path.value() << "" is writable by an unprivileged group.""; return false; } if (stat_info.st_mode & S_IWOTH) { DLOG(ERROR) << ""Path "" << path.value() << "" is writable by any user.""; return false; } return true; } ",0 "static int dev_ifsioc(struct net *net, struct socket *sock, unsigned int cmd, struct compat_ifreq __user *uifr32) { struct ifreq __user *uifr; int err; uifr = compat_alloc_user_space(sizeof(*uifr)); if (copy_in_user(uifr, uifr32, sizeof(*uifr32))) return -EFAULT; err = sock_do_ioctl(net, sock, cmd, (unsigned long)uifr); if (!err) { switch (cmd) { case SIOCGIFFLAGS: case SIOCGIFMETRIC: case SIOCGIFMTU: case SIOCGIFMEM: case SIOCGIFHWADDR: case SIOCGIFINDEX: case SIOCGIFADDR: case SIOCGIFBRDADDR: case SIOCGIFDSTADDR: case SIOCGIFNETMASK: case SIOCGIFPFLAGS: case SIOCGIFTXQLEN: case SIOCGMIIPHY: case SIOCGMIIREG: if (copy_in_user(uifr32, uifr, sizeof(*uifr32))) err = -EFAULT; break; } } return err; } ",0 "void Document::modifiedStyleSheet(StyleSheet* sheet, StyleResolverUpdateMode updateMode) { if (isActive()) styleEngine().modifiedStyleSheet(sheet); styleResolverChanged(updateMode); } ",0 "spnego_gss_unwrap_aead(OM_uint32 *minor_status, gss_ctx_id_t context_handle, gss_buffer_t input_message_buffer, gss_buffer_t input_assoc_buffer, gss_buffer_t output_payload_buffer, int *conf_state, gss_qop_t *qop_state) { OM_uint32 ret; ret = gss_unwrap_aead(minor_status, context_handle, input_message_buffer, input_assoc_buffer, output_payload_buffer, conf_state, qop_state); return (ret); } ",1 "static int ssl_scan_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d, int n, int *al) { unsigned short type; unsigned short size; unsigned short len; unsigned char *data = *p; int renegotiate_seen = 0; size_t i; s->servername_done = 0; s->tlsext_status_type = -1; #ifndef OPENSSL_NO_NEXTPROTONEG s->s3->next_proto_neg_seen = 0; #endif if (s->s3->alpn_selected) { OPENSSL_free(s->s3->alpn_selected); s->s3->alpn_selected = NULL; } /* Clear observed custom extensions */ s->s3->serverinfo_client_tlsext_custom_types_count = 0; if (s->s3->serverinfo_client_tlsext_custom_types != NULL) { OPENSSL_free(s->s3->serverinfo_client_tlsext_custom_types); s->s3->serverinfo_client_tlsext_custom_types = NULL; } #ifndef OPENSSL_NO_HEARTBEATS s->tlsext_heartbeat &= ~(SSL_TLSEXT_HB_ENABLED | SSL_TLSEXT_HB_DONT_SEND_REQUESTS); #endif #ifndef OPENSSL_NO_EC if (s->options & SSL_OP_SAFARI_ECDHE_ECDSA_BUG) ssl_check_for_safari(s, data, d, n); #endif /* !OPENSSL_NO_EC */ /* Clear any signature algorithms extension received */ if (s->cert->peer_sigalgs) { OPENSSL_free(s->cert->peer_sigalgs); s->cert->peer_sigalgs = NULL; } /* Clear any shared sigtnature algorithms */ if (s->cert->shared_sigalgs) { OPENSSL_free(s->cert->shared_sigalgs); s->cert->shared_sigalgs = NULL; } /* Clear certificate digests and validity flags */ for (i = 0; i < SSL_PKEY_NUM; i++) { s->cert->pkeys[i].digest = NULL; s->cert->pkeys[i].valid_flags = 0; } #ifdef TLSEXT_TYPE_encrypt_then_mac s->s3->flags &= ~TLS1_FLAGS_ENCRYPT_THEN_MAC; #endif if (data >= (d+n-2)) goto ri_check; n2s(data,len); if (data > (d+n-len)) goto ri_check; while (data <= (d+n-4)) { n2s(data,type); n2s(data,size); if (data+size > (d+n)) goto ri_check; #if 0 fprintf(stderr,""Received extension type %d size %d\n"",type,size); #endif if (s->tlsext_debug_cb) s->tlsext_debug_cb(s, 0, type, data, size, s->tlsext_debug_arg); /* The servername extension is treated as follows: - Only the hostname type is supported with a maximum length of 255. - The servername is rejected if too long or if it contains zeros, in which case an fatal alert is generated. - The servername field is maintained together with the session cache. - When a session is resumed, the servername call back invoked in order to allow the application to position itself to the right context. - The servername is acknowledged if it is new for a session or when it is identical to a previously used for the same session. Applications can control the behaviour. They can at any time set a 'desirable' servername for a new SSL object. This can be the case for example with HTTPS when a Host: header field is received and a renegotiation is requested. In this case, a possible servername presented in the new client hello is only acknowledged if it matches the value of the Host: field. - Applications must use SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION if they provide for changing an explicit servername context for the session, i.e. when the session has been established with a servername extension. - On session reconnect, the servername extension may be absent. */ if (type == TLSEXT_TYPE_server_name) { unsigned char *sdata; int servname_type; int dsize; if (size < 2) { *al = SSL_AD_DECODE_ERROR; return 0; } n2s(data,dsize); size -= 2; if (dsize > size ) { *al = SSL_AD_DECODE_ERROR; return 0; } sdata = data; while (dsize > 3) { servname_type = *(sdata++); n2s(sdata,len); dsize -= 3; if (len > dsize) { *al = SSL_AD_DECODE_ERROR; return 0; } if (s->servername_done == 0) switch (servname_type) { case TLSEXT_NAMETYPE_host_name: if (!s->hit) { if(s->session->tlsext_hostname) { *al = SSL_AD_DECODE_ERROR; return 0; } if (len > TLSEXT_MAXLEN_host_name) { *al = TLS1_AD_UNRECOGNIZED_NAME; return 0; } if ((s->session->tlsext_hostname = OPENSSL_malloc(len+1)) == NULL) { *al = TLS1_AD_INTERNAL_ERROR; return 0; } memcpy(s->session->tlsext_hostname, sdata, len); s->session->tlsext_hostname[len]='\0'; if (strlen(s->session->tlsext_hostname) != len) { OPENSSL_free(s->session->tlsext_hostname); s->session->tlsext_hostname = NULL; *al = TLS1_AD_UNRECOGNIZED_NAME; return 0; } s->servername_done = 1; } else s->servername_done = s->session->tlsext_hostname && strlen(s->session->tlsext_hostname) == len && strncmp(s->session->tlsext_hostname, (char *)sdata, len) == 0; break; default: break; } dsize -= len; } if (dsize != 0) { *al = SSL_AD_DECODE_ERROR; return 0; } } #ifndef OPENSSL_NO_SRP else if (type == TLSEXT_TYPE_srp) { if (size <= 0 || ((len = data[0])) != (size -1)) { *al = SSL_AD_DECODE_ERROR; return 0; } if (s->srp_ctx.login != NULL) { *al = SSL_AD_DECODE_ERROR; return 0; } if ((s->srp_ctx.login = OPENSSL_malloc(len+1)) == NULL) return -1; memcpy(s->srp_ctx.login, &data[1], len); s->srp_ctx.login[len]='\0'; if (strlen(s->srp_ctx.login) != len) { *al = SSL_AD_DECODE_ERROR; return 0; } } #endif #ifndef OPENSSL_NO_EC else if (type == TLSEXT_TYPE_ec_point_formats) { unsigned char *sdata = data; int ecpointformatlist_length = *(sdata++); if (ecpointformatlist_length != size - 1 || ecpointformatlist_length < 1) { *al = TLS1_AD_DECODE_ERROR; return 0; } if (!s->hit) { if(s->session->tlsext_ecpointformatlist) { OPENSSL_free(s->session->tlsext_ecpointformatlist); s->session->tlsext_ecpointformatlist = NULL; } s->session->tlsext_ecpointformatlist_length = 0; if ((s->session->tlsext_ecpointformatlist = OPENSSL_malloc(ecpointformatlist_length)) == NULL) { *al = TLS1_AD_INTERNAL_ERROR; return 0; } s->session->tlsext_ecpointformatlist_length = ecpointformatlist_length; memcpy(s->session->tlsext_ecpointformatlist, sdata, ecpointformatlist_length); } #if 0 fprintf(stderr,""ssl_parse_clienthello_tlsext s->session->tlsext_ecpointformatlist (length=%i) "", s->session->tlsext_ecpointformatlist_length); sdata = s->session->tlsext_ecpointformatlist; for (i = 0; i < s->session->tlsext_ecpointformatlist_length; i++) fprintf(stderr,""%i "",*(sdata++)); fprintf(stderr,""\n""); #endif } else if (type == TLSEXT_TYPE_elliptic_curves) { unsigned char *sdata = data; int ellipticcurvelist_length = (*(sdata++) << 8); ellipticcurvelist_length += (*(sdata++)); if (ellipticcurvelist_length != size - 2 || ellipticcurvelist_length < 1) { *al = TLS1_AD_DECODE_ERROR; return 0; } if (!s->hit) { if(s->session->tlsext_ellipticcurvelist) { *al = TLS1_AD_DECODE_ERROR; return 0; } s->session->tlsext_ellipticcurvelist_length = 0; if ((s->session->tlsext_ellipticcurvelist = OPENSSL_malloc(ellipticcurvelist_length)) == NULL) { *al = TLS1_AD_INTERNAL_ERROR; return 0; } s->session->tlsext_ellipticcurvelist_length = ellipticcurvelist_length; memcpy(s->session->tlsext_ellipticcurvelist, sdata, ellipticcurvelist_length); } #if 0 fprintf(stderr,""ssl_parse_clienthello_tlsext s->session->tlsext_ellipticcurvelist (length=%i) "", s->session->tlsext_ellipticcurvelist_length); sdata = s->session->tlsext_ellipticcurvelist; for (i = 0; i < s->session->tlsext_ellipticcurvelist_length; i++) fprintf(stderr,""%i "",*(sdata++)); fprintf(stderr,""\n""); #endif } #endif /* OPENSSL_NO_EC */ #ifdef TLSEXT_TYPE_opaque_prf_input else if (type == TLSEXT_TYPE_opaque_prf_input) { unsigned char *sdata = data; if (size < 2) { *al = SSL_AD_DECODE_ERROR; return 0; } n2s(sdata, s->s3->client_opaque_prf_input_len); if (s->s3->client_opaque_prf_input_len != size - 2) { *al = SSL_AD_DECODE_ERROR; return 0; } if (s->s3->client_opaque_prf_input != NULL) /* shouldn't really happen */ OPENSSL_free(s->s3->client_opaque_prf_input); if (s->s3->client_opaque_prf_input_len == 0) s->s3->client_opaque_prf_input = OPENSSL_malloc(1); /* dummy byte just to get non-NULL */ else s->s3->client_opaque_prf_input = BUF_memdup(sdata, s->s3->client_opaque_prf_input_len); if (s->s3->client_opaque_prf_input == NULL) { *al = TLS1_AD_INTERNAL_ERROR; return 0; } } #endif else if (type == TLSEXT_TYPE_session_ticket) { if (s->tls_session_ticket_ext_cb && !s->tls_session_ticket_ext_cb(s, data, size, s->tls_session_ticket_ext_cb_arg)) { *al = TLS1_AD_INTERNAL_ERROR; return 0; } } else if (type == TLSEXT_TYPE_renegotiate) { if(!ssl_parse_clienthello_renegotiate_ext(s, data, size, al)) return 0; renegotiate_seen = 1; } else if (type == TLSEXT_TYPE_signature_algorithms) { int dsize; if (s->cert->peer_sigalgs || size < 2) { *al = SSL_AD_DECODE_ERROR; return 0; } n2s(data,dsize); size -= 2; if (dsize != size || dsize & 1 || !dsize) { *al = SSL_AD_DECODE_ERROR; return 0; } if (!tls1_process_sigalgs(s, data, dsize)) { *al = SSL_AD_DECODE_ERROR; return 0; } /* If sigalgs received and no shared algorithms fatal * error. */ if (s->cert->peer_sigalgs && !s->cert->shared_sigalgs) { SSLerr(SSL_F_SSL_SCAN_CLIENTHELLO_TLSEXT, SSL_R_NO_SHARED_SIGATURE_ALGORITHMS); *al = SSL_AD_ILLEGAL_PARAMETER; return 0; } } else if (type == TLSEXT_TYPE_status_request) { if (size < 5) { *al = SSL_AD_DECODE_ERROR; return 0; } s->tlsext_status_type = *data++; size--; if (s->tlsext_status_type == TLSEXT_STATUSTYPE_ocsp) { const unsigned char *sdata; int dsize; /* Read in responder_id_list */ n2s(data,dsize); size -= 2; if (dsize > size ) { *al = SSL_AD_DECODE_ERROR; return 0; } while (dsize > 0) { OCSP_RESPID *id; int idsize; if (dsize < 4) { *al = SSL_AD_DECODE_ERROR; return 0; } n2s(data, idsize); dsize -= 2 + idsize; size -= 2 + idsize; if (dsize < 0) { *al = SSL_AD_DECODE_ERROR; return 0; } sdata = data; data += idsize; id = d2i_OCSP_RESPID(NULL, &sdata, idsize); if (!id) { *al = SSL_AD_DECODE_ERROR; return 0; } if (data != sdata) { OCSP_RESPID_free(id); *al = SSL_AD_DECODE_ERROR; return 0; } if (!s->tlsext_ocsp_ids && !(s->tlsext_ocsp_ids = sk_OCSP_RESPID_new_null())) { OCSP_RESPID_free(id); *al = SSL_AD_INTERNAL_ERROR; return 0; } if (!sk_OCSP_RESPID_push( s->tlsext_ocsp_ids, id)) { OCSP_RESPID_free(id); *al = SSL_AD_INTERNAL_ERROR; return 0; } } /* Read in request_extensions */ if (size < 2) { *al = SSL_AD_DECODE_ERROR; return 0; } n2s(data,dsize); size -= 2; if (dsize != size) { *al = SSL_AD_DECODE_ERROR; return 0; } sdata = data; if (dsize > 0) { if (s->tlsext_ocsp_exts) { sk_X509_EXTENSION_pop_free(s->tlsext_ocsp_exts, X509_EXTENSION_free); } s->tlsext_ocsp_exts = d2i_X509_EXTENSIONS(NULL, &sdata, dsize); if (!s->tlsext_ocsp_exts || (data + dsize != sdata)) { *al = SSL_AD_DECODE_ERROR; return 0; } } } /* We don't know what to do with any other type * so ignore it. */ else s->tlsext_status_type = -1; } #ifndef OPENSSL_NO_HEARTBEATS else if (type == TLSEXT_TYPE_heartbeat) { switch(data[0]) { case 0x01: /* Client allows us to send HB requests */ s->tlsext_heartbeat |= SSL_TLSEXT_HB_ENABLED; break; case 0x02: /* Client doesn't accept HB requests */ s->tlsext_heartbeat |= SSL_TLSEXT_HB_ENABLED; s->tlsext_heartbeat |= SSL_TLSEXT_HB_DONT_SEND_REQUESTS; break; default: *al = SSL_AD_ILLEGAL_PARAMETER; return 0; } } #endif #ifndef OPENSSL_NO_NEXTPROTONEG else if (type == TLSEXT_TYPE_next_proto_neg && s->s3->tmp.finish_md_len == 0 && s->s3->alpn_selected == NULL) { /* We shouldn't accept this extension on a * renegotiation. * * s->new_session will be set on renegotiation, but we * probably shouldn't rely that it couldn't be set on * the initial renegotation too in certain cases (when * there's some other reason to disallow resuming an * earlier session -- the current code won't be doing * anything like that, but this might change). * A valid sign that there's been a previous handshake * in this connection is if s->s3->tmp.finish_md_len > * 0. (We are talking about a check that will happen * in the Hello protocol round, well before a new * Finished message could have been computed.) */ s->s3->next_proto_neg_seen = 1; } #endif else if (type == TLSEXT_TYPE_application_layer_protocol_negotiation && s->ctx->alpn_select_cb && s->s3->tmp.finish_md_len == 0) { if (tls1_alpn_handle_client_hello(s, data, size, al) != 0) return 0; #ifndef OPENSSL_NO_NEXTPROTONEG /* ALPN takes precedence over NPN. */ s->s3->next_proto_neg_seen = 0; #endif } /* session ticket processed earlier */ else if (type == TLSEXT_TYPE_use_srtp) { if(ssl_parse_clienthello_use_srtp_ext(s, data, size, al)) return 0; } /* If this ClientHello extension was unhandled and this is * a nonresumed connection, check whether the extension is a * custom TLS Extension (has a custom_srv_ext_record), and if * so call the callback and record the extension number so that * an appropriate ServerHello may be later returned. */ else if (!s->hit && s->ctx->custom_srv_ext_records_count) { custom_srv_ext_record *record; for (i=0; i < s->ctx->custom_srv_ext_records_count; i++) { record = &s->ctx->custom_srv_ext_records[i]; if (type == record->ext_type) { if (record->fn1 && !record->fn1(s, type, data, size, al, record->arg)) return 0; } } } #ifdef TLSEXT_TYPE_encrypt_then_mac else if (type == TLSEXT_TYPE_encrypt_then_mac) s->s3->flags |= TLS1_FLAGS_ENCRYPT_THEN_MAC; #endif data+=size; } *p = data; ri_check: /* Need RI if renegotiating */ if (!renegotiate_seen && s->renegotiate && !(s->options & SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION)) { *al = SSL_AD_HANDSHAKE_FAILURE; SSLerr(SSL_F_SSL_SCAN_CLIENTHELLO_TLSEXT, SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED); return 0; } /* If no signature algorithms extension set default values */ if (!s->cert->peer_sigalgs) ssl_cert_set_default_md(s->cert); return 1; } ",0 "bgp_attr_as4_aggregator (struct bgp_attr_parser_args *args, as_t *as4_aggregator_as, struct in_addr *as4_aggregator_addr) { struct peer *const peer = args->peer; struct attr *const attr = args->attr; const bgp_size_t length = args->length; if (length != 8) { zlog (peer->log, LOG_ERR, ""New Aggregator length is not 8 [%d]"", length); return bgp_attr_malformed (args, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR, 0); } *as4_aggregator_as = stream_getl (peer->ibuf); as4_aggregator_addr->s_addr = stream_get_ipv4 (peer->ibuf); attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_AS4_AGGREGATOR); return BGP_ATTR_PARSE_PROCEED; } ",0 "static int asepcos_list_files(sc_card_t *card, u8 *buf, size_t blen) { int r, rv = 0, dfFID, efFID; sc_path_t bpath, tpath; sc_file_t *tfile = NULL; /* 1. get currently selected DF */ r = asepcos_get_current_df_path(card, &bpath); if (r != SC_SUCCESS) return r; /* 2. re-select DF to get the FID of the child EFs/DFs */ r = sc_select_file(card, &bpath, &tfile); if (r != SC_SUCCESS) return r; if (tfile->prop_attr_len != 6 || tfile->prop_attr == NULL) { sc_file_free(tfile); sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, ""unable to parse proprietary FCI attributes""); return SC_ERROR_INTERNAL; } dfFID = (tfile->prop_attr[2] << 8) | tfile->prop_attr[3]; efFID = (tfile->prop_attr[4] << 8) | tfile->prop_attr[5]; sc_file_free(tfile); /* 3. select every child DF to get the FID of the next child DF */ while (dfFID != 0) { /* put DF FID on the list */ if (blen < 2) return SC_ERROR_BUFFER_TOO_SMALL; *buf++ = (dfFID >> 8) & 0xff; *buf++ = dfFID & 0xff; rv += 2; blen -= 2; /* select DF to get next DF FID */ tpath = bpath; r = sc_append_file_id(&tpath, dfFID); if (r != SC_SUCCESS) return r; r = sc_select_file(card, &tpath, &tfile); if (r != SC_SUCCESS) return r; if (tfile->prop_attr_len != 6 || tfile->prop_attr == NULL) return SC_ERROR_INTERNAL; dfFID = (tfile->prop_attr[0] << 8) | tfile->prop_attr[1]; sc_file_free(tfile); } /* 4. select every child EF ... */ while (efFID != 0) { /* put DF FID on the list */ if (blen < 2) return SC_ERROR_BUFFER_TOO_SMALL; *buf++ = (efFID >> 8) & 0xff; *buf++ = efFID & 0xff; rv += 2; blen -= 2; /* select EF to get next EF FID */ tpath = bpath; r = sc_append_file_id(&tpath, efFID); if (r != SC_SUCCESS) return r; r = sc_select_file(card, &tpath, &tfile); if (r != SC_SUCCESS) return r; if (tfile->prop_attr_len < 2 || tfile->prop_attr == NULL) return SC_ERROR_INTERNAL; efFID = (tfile->prop_attr[0] << 8) | tfile->prop_attr[1]; sc_file_free(tfile); } return rv; } ",0 "cmsUInt32Number CMSEXPORT cmsMLUgetWide(const cmsMLU* mlu, const char LanguageCode[3], const char CountryCode[3], wchar_t* Buffer, cmsUInt32Number BufferSize) { const wchar_t *Wide; cmsUInt32Number StrLen = 0; cmsUInt16Number Lang = _cmsAdjustEndianess16(*(cmsUInt16Number*) LanguageCode); cmsUInt16Number Cntry = _cmsAdjustEndianess16(*(cmsUInt16Number*) CountryCode); if (mlu == NULL) return 0; Wide = _cmsMLUgetWide(mlu, &StrLen, Lang, Cntry, NULL, NULL); if (Wide == NULL) return 0; if (Buffer == NULL) return StrLen + sizeof(wchar_t); if (BufferSize <= 0) return 0; if (BufferSize < StrLen + sizeof(wchar_t)) StrLen = BufferSize - + sizeof(wchar_t); memmove(Buffer, Wide, StrLen); Buffer[StrLen / sizeof(wchar_t)] = 0; return StrLen + sizeof(wchar_t); } ",0 " Ins_DELTAP( INS_ARG ) { FT_ULong k, nump; FT_UShort A; FT_ULong C; FT_Long B; #ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING /* Delta hinting is covered by US Patent 5159668. */ if ( CUR.face->unpatented_hinting ) { FT_Long n = args[0] * 2; if ( CUR.args < n ) { CUR.error = TT_Err_Too_Few_Arguments; return; } CUR.args -= n; CUR.new_top = CUR.args; return; } #endif nump = (FT_ULong)args[0]; /* some points theoretically may occur more than once, thus UShort isn't enough */ for ( k = 1; k <= nump; k++ ) { if ( CUR.args < 2 ) { CUR.error = TT_Err_Too_Few_Arguments; return; } CUR.args -= 2; A = (FT_UShort)CUR.stack[CUR.args + 1]; B = CUR.stack[CUR.args]; /* XXX: Because some popular fonts contain some invalid DeltaP */ /* instructions, we simply ignore them when the stacked */ /* point reference is off limit, rather than returning an */ /* error. As a delta instruction doesn't change a glyph */ /* in great ways, this shouldn't be a problem. */ if ( !BOUNDS( A, CUR.zp0.n_points ) ) { C = ( (FT_ULong)B & 0xF0 ) >> 4; switch ( CUR.opcode ) { case 0x5D: break; case 0x71: C += 16; break; case 0x72: C += 32; break; } C += CUR.GS.delta_base; if ( CURRENT_Ppem() == (FT_Long)C ) { B = ( (FT_ULong)B & 0xF ) - 8; if ( B >= 0 ) B++; B = B * 64 / ( 1L << CUR.GS.delta_shift ); CUR_Func_move( &CUR.zp0, A, B ); } } else if ( CUR.pedantic_hinting ) CUR.error = TT_Err_Invalid_Reference; } CUR.new_top = CUR.args; } ",0 "void DevToolsUIBindings::SendMessageAck(int request_id, const base::Value* arg) { base::Value id_value(request_id); CallClientFunction(""DevToolsAPI.embedderMessageAck"", &id_value, arg, nullptr); } ",0 "int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) { AVStream *st; MOVStreamContext *sc; int j, pseudo_stream_id; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; for (pseudo_stream_id=0; pseudo_stream_id= 16) { avio_rb32(pb); /* reserved */ avio_rb16(pb); /* reserved */ dref_id = avio_rb16(pb); }else if (size <= 0){ av_log(c->fc, AV_LOG_ERROR, ""invalid size %d in stsd\n"", size); return -1; } if (st->codec->codec_tag && st->codec->codec_tag != format && (c->fc->video_codec_id ? ff_codec_get_id(ff_codec_movvideo_tags, format) != c->fc->video_codec_id : st->codec->codec_tag != MKTAG('j','p','e','g')) ){ /* Multiple fourcc, we skip JPEG. This is not correct, we should * export it as a separate AVStream but this needs a few changes * in the MOV demuxer, patch welcome. */ av_log(c->fc, AV_LOG_WARNING, ""multiple fourcc not supported\n""); avio_skip(pb, size - (avio_tell(pb) - start_pos)); continue; } /* we cannot demux concatenated h264 streams because of different extradata */ if (st->codec->codec_tag && st->codec->codec_tag == AV_RL32(""avc1"")) av_log(c->fc, AV_LOG_WARNING, ""Concatenated H.264 might not play corrently.\n""); sc->pseudo_stream_id = st->codec->codec_tag ? -1 : pseudo_stream_id; sc->dref_id= dref_id; st->codec->codec_tag = format; id = ff_codec_get_id(ff_codec_movaudio_tags, format); if (id<=0 && ((format&0xFFFF) == 'm'+('s'<<8) || (format&0xFFFF) == 'T'+('S'<<8))) id = ff_codec_get_id(ff_codec_wav_tags, av_bswap32(format)&0xFFFF); if (st->codec->codec_type != AVMEDIA_TYPE_VIDEO && id > 0) { st->codec->codec_type = AVMEDIA_TYPE_AUDIO; } else if (st->codec->codec_type != AVMEDIA_TYPE_AUDIO && /* do not overwrite codec type */ format && format != MKTAG('m','p','4','s')) { /* skip old asf mpeg4 tag */ id = ff_codec_get_id(ff_codec_movvideo_tags, format); if (id <= 0) id = ff_codec_get_id(ff_codec_bmp_tags, format); if (id > 0) st->codec->codec_type = AVMEDIA_TYPE_VIDEO; else if (st->codec->codec_type == AVMEDIA_TYPE_DATA || (st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE && st->codec->codec_id == CODEC_ID_NONE)){ id = ff_codec_get_id(ff_codec_movsubtitle_tags, format); if (id > 0) st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE; } } av_dlog(c->fc, ""size=%d 4CC= %c%c%c%c codec_type=%d\n"", size, (format >> 0) & 0xff, (format >> 8) & 0xff, (format >> 16) & 0xff, (format >> 24) & 0xff, st->codec->codec_type); if (st->codec->codec_type==AVMEDIA_TYPE_VIDEO) { unsigned int color_depth, len; int color_greyscale; int color_table_id; st->codec->codec_id = id; avio_rb16(pb); /* version */ avio_rb16(pb); /* revision level */ avio_rb32(pb); /* vendor */ avio_rb32(pb); /* temporal quality */ avio_rb32(pb); /* spatial quality */ st->codec->width = avio_rb16(pb); /* width */ st->codec->height = avio_rb16(pb); /* height */ avio_rb32(pb); /* horiz resolution */ avio_rb32(pb); /* vert resolution */ avio_rb32(pb); /* data size, always 0 */ avio_rb16(pb); /* frames per samples */ len = avio_r8(pb); /* codec name, pascal string */ if (len > 31) len = 31; mov_read_mac_string(c, pb, len, st->codec->codec_name, 32); if (len < 31) avio_skip(pb, 31 - len); /* codec_tag YV12 triggers an UV swap in rawdec.c */ if (!memcmp(st->codec->codec_name, ""Planar Y'CbCr 8-bit 4:2:0"", 25)) st->codec->codec_tag=MKTAG('I', '4', '2', '0'); st->codec->bits_per_coded_sample = avio_rb16(pb); /* depth */ color_table_id = avio_rb16(pb); /* colortable id */ av_dlog(c->fc, ""depth %d, ctab id %d\n"", st->codec->bits_per_coded_sample, color_table_id); /* figure out the palette situation */ color_depth = st->codec->bits_per_coded_sample & 0x1F; color_greyscale = st->codec->bits_per_coded_sample & 0x20; /* if the depth is 2, 4, or 8 bpp, file is palettized */ if ((color_depth == 2) || (color_depth == 4) || (color_depth == 8)) { /* for palette traversal */ unsigned int color_start, color_count, color_end; unsigned char a, r, g, b; if (color_greyscale) { int color_index, color_dec; /* compute the greyscale palette */ st->codec->bits_per_coded_sample = color_depth; color_count = 1 << color_depth; color_index = 255; color_dec = 256 / (color_count - 1); for (j = 0; j < color_count; j++) { if (id == CODEC_ID_CINEPAK){ r = g = b = color_count - 1 - color_index; }else r = g = b = color_index; sc->palette[j] = (0xFFU << 24) | (r << 16) | (g << 8) | (b); color_index -= color_dec; if (color_index < 0) color_index = 0; } } else if (color_table_id) { const uint8_t *color_table; /* if flag bit 3 is set, use the default palette */ color_count = 1 << color_depth; if (color_depth == 2) color_table = ff_qt_default_palette_4; else if (color_depth == 4) color_table = ff_qt_default_palette_16; else color_table = ff_qt_default_palette_256; for (j = 0; j < color_count; j++) { r = color_table[j * 3 + 0]; g = color_table[j * 3 + 1]; b = color_table[j * 3 + 2]; sc->palette[j] = (0xFFU << 24) | (r << 16) | (g << 8) | (b); } } else { /* load the palette from the file */ color_start = avio_rb32(pb); color_count = avio_rb16(pb); color_end = avio_rb16(pb); if ((color_start <= 255) && (color_end <= 255)) { for (j = color_start; j <= color_end; j++) { /* each A, R, G, or B component is 16 bits; * only use the top 8 bits */ a = avio_r8(pb); avio_r8(pb); r = avio_r8(pb); avio_r8(pb); g = avio_r8(pb); avio_r8(pb); b = avio_r8(pb); avio_r8(pb); sc->palette[j] = (a << 24 ) | (r << 16) | (g << 8) | (b); } } } sc->has_palette = 1; } } else if (st->codec->codec_type==AVMEDIA_TYPE_AUDIO) { int bits_per_sample, flags; uint16_t version = avio_rb16(pb); st->codec->codec_id = id; avio_rb16(pb); /* revision level */ avio_rb32(pb); /* vendor */ st->codec->channels = avio_rb16(pb); /* channel count */ av_dlog(c->fc, ""audio channels %d\n"", st->codec->channels); st->codec->bits_per_coded_sample = avio_rb16(pb); /* sample size */ sc->audio_cid = avio_rb16(pb); avio_rb16(pb); /* packet size = 0 */ st->codec->sample_rate = ((avio_rb32(pb) >> 16)); av_dlog(c->fc, ""version =%d, isom =%d\n"",version,c->isom); if (!c->isom) { if (version==1) { sc->samples_per_frame = avio_rb32(pb); avio_rb32(pb); /* bytes per packet */ sc->bytes_per_frame = avio_rb32(pb); avio_rb32(pb); /* bytes per sample */ } else if (version==2) { avio_rb32(pb); /* sizeof struct only */ st->codec->sample_rate = av_int2double(avio_rb64(pb)); /* float 64 */ st->codec->channels = avio_rb32(pb); avio_rb32(pb); /* always 0x7F000000 */ st->codec->bits_per_coded_sample = avio_rb32(pb); /* bits per channel if sound is uncompressed */ flags = avio_rb32(pb); /* lpcm format specific flag */ sc->bytes_per_frame = avio_rb32(pb); /* bytes per audio packet if constant */ sc->samples_per_frame = avio_rb32(pb); /* lpcm frames per audio packet if constant */ if (format == MKTAG('l','p','c','m')) st->codec->codec_id = ff_mov_get_lpcm_codec_id(st->codec->bits_per_coded_sample, flags); } } switch (st->codec->codec_id) { case CODEC_ID_PCM_S8: case CODEC_ID_PCM_U8: if (st->codec->bits_per_coded_sample == 16) st->codec->codec_id = CODEC_ID_PCM_S16BE; break; case CODEC_ID_PCM_S16LE: case CODEC_ID_PCM_S16BE: if (st->codec->bits_per_coded_sample == 8) st->codec->codec_id = CODEC_ID_PCM_S8; else if (st->codec->bits_per_coded_sample == 24) st->codec->codec_id = st->codec->codec_id == CODEC_ID_PCM_S16BE ? CODEC_ID_PCM_S24BE : CODEC_ID_PCM_S24LE; break; /* set values for old format before stsd version 1 appeared */ case CODEC_ID_MACE3: sc->samples_per_frame = 6; sc->bytes_per_frame = 2*st->codec->channels; break; case CODEC_ID_MACE6: sc->samples_per_frame = 6; sc->bytes_per_frame = 1*st->codec->channels; break; case CODEC_ID_ADPCM_IMA_QT: sc->samples_per_frame = 64; sc->bytes_per_frame = 34*st->codec->channels; break; case CODEC_ID_GSM: sc->samples_per_frame = 160; sc->bytes_per_frame = 33; break; default: break; } bits_per_sample = av_get_bits_per_sample(st->codec->codec_id); if (bits_per_sample) { st->codec->bits_per_coded_sample = bits_per_sample; sc->sample_size = (bits_per_sample >> 3) * st->codec->channels; } } else if (st->codec->codec_type==AVMEDIA_TYPE_SUBTITLE){ MOVAtom fake_atom = { .size = size - (avio_tell(pb) - start_pos) }; if (format != AV_RL32(""mp4s"")) // mp4s contains a regular esds atom mov_read_glbl(c, pb, fake_atom); st->codec->codec_id= id; st->codec->width = sc->width; st->codec->height = sc->height; } else { if (st->codec->codec_tag == MKTAG('t','m','c','d')) { MOVStreamContext *tmcd_ctx = st->priv_data; int val; avio_rb32(pb); /* reserved */ val = avio_rb32(pb); /* flags */ tmcd_ctx->tmcd_flags = val; if (val & 1) st->codec->flags2 |= CODEC_FLAG2_DROP_FRAME_TIMECODE; avio_rb32(pb); /* time scale */ avio_rb32(pb); /* frame duration */ st->codec->time_base.den = avio_r8(pb); /* number of frame */ st->codec->time_base.num = 1; } /* other codec type, just skip (rtp, mp4s, ...) */ avio_skip(pb, size - (avio_tell(pb) - start_pos)); } /* this will read extra atoms at the end (wave, alac, damr, avcC, SMI ...) */ a.size = size - (avio_tell(pb) - start_pos); if (a.size > 8) { int ret; if ((ret = mov_read_default(c, pb, a)) < 0) return ret; } else if (a.size > 0) avio_skip(pb, a.size); } if (st->codec->codec_type==AVMEDIA_TYPE_AUDIO && st->codec->sample_rate==0 && sc->time_scale>1) st->codec->sample_rate= sc->time_scale; /* special codec parameters handling */ switch (st->codec->codec_id) { #if CONFIG_DV_DEMUXER case CODEC_ID_DVAUDIO: c->dv_fctx = avformat_alloc_context(); c->dv_demux = avpriv_dv_init_demux(c->dv_fctx); if (!c->dv_demux) { av_log(c->fc, AV_LOG_ERROR, ""dv demux context init error\n""); return AVERROR(ENOMEM); } sc->dv_audio_container = 1; st->codec->codec_id = CODEC_ID_PCM_S16LE; break; #endif /* no ifdef since parameters are always those */ case CODEC_ID_QCELP: if (st->codec->codec_tag != MKTAG('Q','c','l','p')) st->codec->sample_rate = 8000; st->codec->channels= 1; /* really needed */ break; case CODEC_ID_AMR_NB: st->codec->channels= 1; /* really needed */ /* force sample rate for amr, stsd in 3gp does not store sample rate */ st->codec->sample_rate = 8000; break; case CODEC_ID_AMR_WB: st->codec->channels = 1; st->codec->sample_rate = 16000; break; case CODEC_ID_MP2: case CODEC_ID_MP3: st->codec->codec_type = AVMEDIA_TYPE_AUDIO; /* force type after stsd for m1a hdlr */ st->need_parsing = AVSTREAM_PARSE_FULL; break; case CODEC_ID_GSM: case CODEC_ID_ADPCM_MS: case CODEC_ID_ADPCM_IMA_WAV: st->codec->block_align = sc->bytes_per_frame; break; case CODEC_ID_ALAC: if (st->codec->extradata_size == 36) { st->codec->channels = AV_RB8 (st->codec->extradata+21); st->codec->sample_rate = AV_RB32(st->codec->extradata+32); } break; case CODEC_ID_AC3: st->need_parsing = AVSTREAM_PARSE_FULL; break; case CODEC_ID_MPEG1VIDEO: st->need_parsing = AVSTREAM_PARSE_FULL; break; default: break; } return 0; } ",0 "static void enable_nmi_window(struct kvm_vcpu *vcpu) { if (vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) & GUEST_INTR_STATE_STI) { enable_irq_window(vcpu); return; } vmcs_set_bits(CPU_BASED_VM_EXEC_CONTROL, CPU_BASED_VIRTUAL_NMI_PENDING); } ",0 "ltree_in(PG_FUNCTION_ARGS) { char *buf = (char *) PG_GETARG_POINTER(0); char *ptr; nodeitem *list, *lptr; int num = 0, totallen = 0; int state = LTPRS_WAITNAME; ltree *result; ltree_level *curlevel; int charlen; int pos = 0; ptr = buf; while (*ptr) { charlen = pg_mblen(ptr); if (charlen == 1 && t_iseq(ptr, '.')) num++; ptr += charlen; } list = lptr = (nodeitem *) palloc(sizeof(nodeitem) * (num + 1)); ptr = buf; while (*ptr) { charlen = pg_mblen(ptr); if (state == LTPRS_WAITNAME) { if (ISALNUM(ptr)) { lptr->start = ptr; lptr->wlen = 0; state = LTPRS_WAITDELIM; } else UNCHAR; } else if (state == LTPRS_WAITDELIM) { if (charlen == 1 && t_iseq(ptr, '.')) { lptr->len = ptr - lptr->start; if (lptr->wlen > 255) ereport(ERROR, (errcode(ERRCODE_NAME_TOO_LONG), errmsg(""name of level is too long""), errdetail(""Name length is %d, must "" ""be < 256, in position %d."", lptr->wlen, pos))); totallen += MAXALIGN(lptr->len + LEVEL_HDRSIZE); lptr++; state = LTPRS_WAITNAME; } else if (!ISALNUM(ptr)) UNCHAR; } else /* internal error */ elog(ERROR, ""internal error in parser""); ptr += charlen; lptr->wlen++; pos++; } if (state == LTPRS_WAITDELIM) { lptr->len = ptr - lptr->start; if (lptr->wlen > 255) ereport(ERROR, (errcode(ERRCODE_NAME_TOO_LONG), errmsg(""name of level is too long""), errdetail(""Name length is %d, must "" ""be < 256, in position %d."", lptr->wlen, pos))); totallen += MAXALIGN(lptr->len + LEVEL_HDRSIZE); lptr++; } else if (!(state == LTPRS_WAITNAME && lptr == list)) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg(""syntax error""), errdetail(""Unexpected end of line.""))); result = (ltree *) palloc0(LTREE_HDRSIZE + totallen); SET_VARSIZE(result, LTREE_HDRSIZE + totallen); result->numlevel = lptr - list; curlevel = LTREE_FIRST(result); lptr = list; while (lptr - list < result->numlevel) { curlevel->len = (uint16) lptr->len; memcpy(curlevel->name, lptr->start, lptr->len); curlevel = LEVEL_NEXT(curlevel); lptr++; } pfree(list); PG_RETURN_POINTER(result); } ",1 "static void ip6_nd_hdr(struct sk_buff *skb, const struct in6_addr *saddr, const struct in6_addr *daddr, int hop_limit, int len) { struct ipv6hdr *hdr; skb_push(skb, sizeof(*hdr)); skb_reset_network_header(skb); hdr = ipv6_hdr(skb); ip6_flow_hdr(hdr, 0, 0); hdr->payload_len = htons(len); hdr->nexthdr = IPPROTO_ICMPV6; hdr->hop_limit = hop_limit; hdr->saddr = *saddr; hdr->daddr = *daddr; } ",0 " const CompositedLayerRasterInvalidator* GetInternalRasterInvalidator( const GraphicsLayer& layer) { return layer.raster_invalidator_.get(); } ",0 "bool BackRenderbuffer::AllocateStorage(const gfx::Size& size, GLenum format, GLsizei samples) { ScopedGLErrorSuppressor suppressor(""BackRenderbuffer::AllocateStorage"", decoder_->state_.GetErrorState()); ScopedRenderBufferBinder binder(&decoder_->state_, id_); uint32_t estimated_size = 0; if (!decoder_->renderbuffer_manager()->ComputeEstimatedRenderbufferSize( size.width(), size.height(), samples, format, &estimated_size)) { return false; } decoder_->RenderbufferStorageMultisampleHelper(GL_RENDERBUFFER, samples, format, size.width(), size.height(), kDoNotForce); bool alpha_channel_needs_clear = (format == GL_RGBA || format == GL_RGBA8) && !decoder_->offscreen_buffer_should_have_alpha_; if (alpha_channel_needs_clear) { GLuint fbo; api()->glGenFramebuffersEXTFn(1, &fbo); { ScopedFramebufferBinder binder(decoder_, fbo); api()->glFramebufferRenderbufferEXTFn( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, id_); api()->glClearColorFn(0, 0, 0, decoder_->BackBufferAlphaClearColor()); decoder_->state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); decoder_->state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); decoder_->ClearDeviceWindowRectangles(); api()->glClearFn(GL_COLOR_BUFFER_BIT); decoder_->RestoreClearState(); } api()->glDeleteFramebuffersEXTFn(1, &fbo); } bool success = api()->glGetErrorFn() == GL_NO_ERROR; if (success) { memory_tracker_.TrackMemFree(bytes_allocated_); bytes_allocated_ = estimated_size; memory_tracker_.TrackMemAlloc(bytes_allocated_); } return success; } ",0 "static __init int test_ringbuffer(void) { struct task_struct *rb_hammer; struct ring_buffer *buffer; int cpu; int ret = 0; pr_info(""Running ring buffer tests...\n""); buffer = ring_buffer_alloc(RB_TEST_BUFFER_SIZE, RB_FL_OVERWRITE); if (WARN_ON(!buffer)) return 0; /* Disable buffer so that threads can't write to it yet */ ring_buffer_record_off(buffer); for_each_online_cpu(cpu) { rb_data[cpu].buffer = buffer; rb_data[cpu].cpu = cpu; rb_data[cpu].cnt = cpu; rb_threads[cpu] = kthread_create(rb_test, &rb_data[cpu], ""rbtester/%d"", cpu); if (WARN_ON(!rb_threads[cpu])) { pr_cont(""FAILED\n""); ret = -1; goto out_free; } kthread_bind(rb_threads[cpu], cpu); wake_up_process(rb_threads[cpu]); } /* Now create the rb hammer! */ rb_hammer = kthread_run(rb_hammer_test, NULL, ""rbhammer""); if (WARN_ON(!rb_hammer)) { pr_cont(""FAILED\n""); ret = -1; goto out_free; } ring_buffer_record_on(buffer); /* * Show buffer is enabled before setting rb_test_started. * Yes there's a small race window where events could be * dropped and the thread wont catch it. But when a ring * buffer gets enabled, there will always be some kind of * delay before other CPUs see it. Thus, we don't care about * those dropped events. We care about events dropped after * the threads see that the buffer is active. */ smp_wmb(); rb_test_started = true; set_current_state(TASK_INTERRUPTIBLE); /* Just run for 10 seconds */; schedule_timeout(10 * HZ); kthread_stop(rb_hammer); out_free: for_each_online_cpu(cpu) { if (!rb_threads[cpu]) break; kthread_stop(rb_threads[cpu]); } if (ret) { ring_buffer_free(buffer); return ret; } /* Report! */ pr_info(""finished\n""); for_each_online_cpu(cpu) { struct ring_buffer_event *event; struct rb_test_data *data = &rb_data[cpu]; struct rb_item *item; unsigned long total_events; unsigned long total_dropped; unsigned long total_written; unsigned long total_alloc; unsigned long total_read = 0; unsigned long total_size = 0; unsigned long total_len = 0; unsigned long total_lost = 0; unsigned long lost; int big_event_size; int small_event_size; ret = -1; total_events = data->events + data->events_nested; total_written = data->bytes_written + data->bytes_written_nested; total_alloc = data->bytes_alloc + data->bytes_alloc_nested; total_dropped = data->bytes_dropped + data->bytes_dropped_nested; big_event_size = data->max_size + data->max_size_nested; small_event_size = data->min_size + data->min_size_nested; pr_info(""CPU %d:\n"", cpu); pr_info("" events: %ld\n"", total_events); pr_info("" dropped bytes: %ld\n"", total_dropped); pr_info("" alloced bytes: %ld\n"", total_alloc); pr_info("" written bytes: %ld\n"", total_written); pr_info("" biggest event: %d\n"", big_event_size); pr_info("" smallest event: %d\n"", small_event_size); if (RB_WARN_ON(buffer, total_dropped)) break; ret = 0; while ((event = ring_buffer_consume(buffer, cpu, NULL, &lost))) { total_lost += lost; item = ring_buffer_event_data(event); total_len += ring_buffer_event_length(event); total_size += item->size + sizeof(struct rb_item); if (memcmp(&item->str[0], rb_string, item->size) != 0) { pr_info(""FAILED!\n""); pr_info(""buffer had: %.*s\n"", item->size, item->str); pr_info(""expected: %.*s\n"", item->size, rb_string); RB_WARN_ON(buffer, 1); ret = -1; break; } total_read++; } if (ret) break; ret = -1; pr_info("" read events: %ld\n"", total_read); pr_info("" lost events: %ld\n"", total_lost); pr_info("" total events: %ld\n"", total_lost + total_read); pr_info("" recorded len bytes: %ld\n"", total_len); pr_info("" recorded size bytes: %ld\n"", total_size); if (total_lost) pr_info("" With dropped events, record len and size may not match\n"" "" alloced and written from above\n""); if (!total_lost) { if (RB_WARN_ON(buffer, total_len != total_alloc || total_size != total_written)) break; } if (RB_WARN_ON(buffer, total_lost + total_read != total_events)) break; ret = 0; } if (!ret) pr_info(""Ring buffer PASSED!\n""); ring_buffer_free(buffer); return 0; } ",0 "void SkiaOutputSurfaceImpl::BindFramebuffer() { } ",0 "long do_sigpending(void __user *set, unsigned long sigsetsize) { long error = -EINVAL; sigset_t pending; if (sigsetsize > sizeof(sigset_t)) goto out; spin_lock_irq(¤t->sighand->siglock); sigorsets(&pending, ¤t->pending.signal, ¤t->signal->shared_pending.signal); spin_unlock_irq(¤t->sighand->siglock); /* Outside the lock because only this thread touches it. */ sigandsets(&pending, ¤t->blocked, &pending); error = -EFAULT; if (!copy_to_user(set, &pending, sigsetsize)) error = 0; out: return error; } ",0 "static MagickBooleanType ReadPSDChannelRLE(Image *image,const PSDInfo *psd_info, const ssize_t type,MagickOffsetType *sizes,ExceptionInfo *exception) { MagickBooleanType status; size_t length, row_size; ssize_t count, y; unsigned char *compact_pixels, *pixels; if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" layer data is RLE compressed""); row_size=GetPSDRowSize(image); pixels=(unsigned char *) AcquireQuantumMemory(row_size,sizeof(*pixels)); if (pixels == (unsigned char *) NULL) ThrowBinaryException(ResourceLimitError,""MemoryAllocationFailed"", image->filename); length=0; for (y=0; y < (ssize_t) image->rows; y++) if ((MagickOffsetType) length < sizes[y]) length=(size_t) sizes[y]; if (length > (row_size+2048)) /* arbitrary number */ { pixels=(unsigned char *) RelinquishMagickMemory(pixels); ThrowBinaryException(ResourceLimitError,""InvalidLength"",image->filename); } compact_pixels=(unsigned char *) AcquireQuantumMemory(length,sizeof(*pixels)); if (compact_pixels == (unsigned char *) NULL) { pixels=(unsigned char *) RelinquishMagickMemory(pixels); ThrowBinaryException(ResourceLimitError,""MemoryAllocationFailed"", image->filename); } (void) memset(compact_pixels,0,length*sizeof(*compact_pixels)); status=MagickTrue; for (y=0; y < (ssize_t) image->rows; y++) { status=MagickFalse; count=ReadBlob(image,(size_t) sizes[y],compact_pixels); if (count != (ssize_t) sizes[y]) break; count=DecodePSDPixels((size_t) sizes[y],compact_pixels, (ssize_t) (image->depth == 1 ? 123456 : image->depth),row_size,pixels); if (count != (ssize_t) row_size) break; status=ReadPSDChannelPixels(image,psd_info->channels,y,type,pixels, exception); if (status == MagickFalse) break; } compact_pixels=(unsigned char *) RelinquishMagickMemory(compact_pixels); pixels=(unsigned char *) RelinquishMagickMemory(pixels); return(status); } ",0 "void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key) { if (*key >= OPENSSL_CRYPTO_THREAD_LOCAL_KEY_MAX) return NULL; return thread_local_storage[*key]; } ",0 "void HTMLMediaElement::noneSupported() { BLINK_MEDIA_LOG << ""noneSupported("" << (void*)this << "")""; stopPeriodicTimers(); m_loadState = WaitingForSource; m_currentSourceNode = nullptr; m_error = MediaError::create(MediaError::kMediaErrSrcNotSupported); forgetResourceSpecificTracks(); setNetworkState(kNetworkNoSource); updateDisplayState(); scheduleEvent(EventTypeNames::error); scheduleRejectPlayPromises(NotSupportedError); closeMediaSource(); setShouldDelayLoadEvent(false); if (layoutObject()) layoutObject()->updateFromElement(); } ",0 "bool WebPagePrivate::dispatchMouseEventToFullScreenPlugin(PluginView* plugin, const Platform::MouseEvent& event) { NPEvent npEvent; NPMouseEvent mouseEvent; mouseEvent.x = event.screenPosition().x(); mouseEvent.y = event.screenPosition().y(); switch (event.type()) { case Platform::MouseEvent::MouseButtonDown: mouseEvent.type = MOUSE_BUTTON_DOWN; m_pluginMouseButtonPressed = true; break; case Platform::MouseEvent::MouseButtonUp: mouseEvent.type = MOUSE_BUTTON_UP; m_pluginMouseButtonPressed = false; break; case Platform::MouseEvent::MouseMove: mouseEvent.type = MOUSE_MOTION; break; default: return false; } mouseEvent.flags = 0; mouseEvent.button = m_pluginMouseButtonPressed; npEvent.type = NP_MouseEvent; npEvent.data = &mouseEvent; return plugin->dispatchFullScreenNPEvent(npEvent); } ",0 "void UDPSocketWin::Core::WriteDelegate::OnObjectSignaled(HANDLE object) { DCHECK_EQ(object, core_->write_overlapped_.hEvent); if (core_->socket_) core_->socket_->DidCompleteWrite(); core_->Release(); } ",0 "static int hmac_finup(struct shash_desc *pdesc, const u8 *data, unsigned int nbytes, u8 *out) { struct crypto_shash *parent = pdesc->tfm; int ds = crypto_shash_digestsize(parent); int ss = crypto_shash_statesize(parent); char *opad = crypto_shash_ctx_aligned(parent) + ss; struct shash_desc *desc = shash_desc_ctx(pdesc); desc->flags = pdesc->flags & CRYPTO_TFM_REQ_MAY_SLEEP; return crypto_shash_finup(desc, data, nbytes, out) ?: crypto_shash_import(desc, opad) ?: crypto_shash_finup(desc, out, ds, out); } ",0 "std::string LayerTreeHostImpl::LayerTreeAsJson() const { std::string str; if (active_tree_->root_layer_for_testing()) { std::unique_ptr json( active_tree_->root_layer_for_testing()->LayerTreeAsJson()); base::JSONWriter::WriteWithOptions( *json, base::JSONWriter::OPTIONS_PRETTY_PRINT, &str); } return str; } ",0 "void ewk_view_paint_context_paint(Ewk_View_Paint_Context* context, const Eina_Rectangle* area) { EINA_SAFETY_ON_NULL_RETURN(context); EINA_SAFETY_ON_NULL_RETURN(area); WebCore::IntRect rect(area->x, area->y, area->w, area->h); if (context->view->isTransparent()) context->graphicContext->clearRect(rect); context->view->paint(context->graphicContext, rect); } ",0 "bool omx_vdec::allocate_done(void) { bool bRet = false; bool bRet_In = false; bool bRet_Out = false; bRet_In = allocate_input_done(); bRet_Out = allocate_output_done(); if (bRet_In && bRet_Out) { bRet = true; } return bRet; } ",0 "int alloc_fair_sched_group(struct task_group *tg, struct task_group *parent) { struct cfs_rq *cfs_rq; struct sched_entity *se; struct rq *rq; int i; tg->cfs_rq = kzalloc(sizeof(cfs_rq) * nr_cpu_ids, GFP_KERNEL); if (!tg->cfs_rq) goto err; tg->se = kzalloc(sizeof(se) * nr_cpu_ids, GFP_KERNEL); if (!tg->se) goto err; tg->shares = NICE_0_LOAD; for_each_possible_cpu(i) { rq = cpu_rq(i); cfs_rq = kzalloc_node(sizeof(struct cfs_rq), GFP_KERNEL, cpu_to_node(i)); if (!cfs_rq) goto err; se = kzalloc_node(sizeof(struct sched_entity), GFP_KERNEL, cpu_to_node(i)); if (!se) goto err_free_rq; init_tg_cfs_entry(tg, cfs_rq, se, i, 0, parent->se[i]); } return 1; err_free_rq: kfree(cfs_rq); err: return 0; } ",0 " RenderWidgetHostViewAndroid* root_rwhv() { return root_rwhv_; } ",0 "inline void Splash::pipeSetXY(SplashPipe *pipe, int x, int y) { pipe->x = x; pipe->y = y; if (state->softMask) { pipe->softMaskPtr = &state->softMask->data[y * state->softMask->rowSize + x]; } switch (bitmap->mode) { case splashModeMono1: pipe->destColorPtr = &bitmap->data[y * bitmap->rowSize + (x >> 3)]; pipe->destColorMask = 0x80 >> (x & 7); break; case splashModeMono8: pipe->destColorPtr = &bitmap->data[y * bitmap->rowSize + x]; break; case splashModeRGB8: case splashModeBGR8: pipe->destColorPtr = &bitmap->data[y * bitmap->rowSize + 3 * x]; break; case splashModeXBGR8: pipe->destColorPtr = &bitmap->data[y * bitmap->rowSize + 4 * x]; break; #if SPLASH_CMYK case splashModeCMYK8: pipe->destColorPtr = &bitmap->data[y * bitmap->rowSize + 4 * x]; break; #endif } if (bitmap->alpha) { pipe->destAlphaPtr = &bitmap->alpha[y * bitmap->width + x]; } else { pipe->destAlphaPtr = NULL; } if (state->inNonIsolatedGroup && alpha0Bitmap->alpha) { pipe->alpha0Ptr = &alpha0Bitmap->alpha[(alpha0Y + y) * alpha0Bitmap->width + (alpha0X + x)]; } else { pipe->alpha0Ptr = NULL; } } ",0 "void cJSON_ReplaceItemInArray(cJSON *array,int which,cJSON *newitem) {cJSON *c=array->child;while (c && which>0) c=c->next,which--;if (!c) return; newitem->next=c->next;newitem->prev=c->prev;if (newitem->next) newitem->next->prev=newitem; if (c==array->child) array->child=newitem; else newitem->prev->next=newitem;c->next=c->prev=0;cJSON_Delete(c);} ",0 "status_t MediaRecorder::setParameters(const String8& params) { ALOGV(""setParameters(%s)"", params.string()); if (mMediaRecorder == NULL) { ALOGE(""media recorder is not initialized yet""); return INVALID_OPERATION; } bool isInvalidState = (mCurrentState & (MEDIA_RECORDER_PREPARED | MEDIA_RECORDER_RECORDING | MEDIA_RECORDER_ERROR)); if (isInvalidState) { ALOGE(""setParameters is called in an invalid state: %d"", mCurrentState); return INVALID_OPERATION; } status_t ret = mMediaRecorder->setParameters(params); if (OK != ret) { ALOGE(""setParameters(%s) failed: %d"", params.string(), ret); } return ret; } ",0 " explicit FrameTreeNodeObserverImpl(FrameTreeNode* owner) : owner_(owner) { owner->AddObserver(this); } ",0 "Evas_Object* ewk_frame_view_get(const Evas_Object* ewkFrame) { EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData, 0); return smartData->view; } ",0 "error::Error GLES2DecoderPassthroughImpl::DoStencilFillPathInstancedCHROMIUM( GLsizei numPaths, GLenum pathNameType, const GLvoid* paths, GLsizei pathsBufsize, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat* transformValues, GLsizei transformValuesBufsize) { NOTIMPLEMENTED(); return error::kNoError; } ",0 "static int magicmouse_probe(struct hid_device *hdev, const struct hid_device_id *id) { __u8 feature[] = { 0xd7, 0x01 }; struct magicmouse_sc *msc; struct hid_report *report; int ret; msc = devm_kzalloc(&hdev->dev, sizeof(*msc), GFP_KERNEL); if (msc == NULL) { hid_err(hdev, ""can't alloc magicmouse descriptor\n""); return -ENOMEM; } msc->scroll_accel = SCROLL_ACCEL_DEFAULT; msc->quirks = id->driver_data; hid_set_drvdata(hdev, msc); ret = hid_parse(hdev); if (ret) { hid_err(hdev, ""magicmouse hid parse failed\n""); return ret; } ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); if (ret) { hid_err(hdev, ""magicmouse hw start failed\n""); return ret; } if (!msc->input) { hid_err(hdev, ""magicmouse input not registered\n""); ret = -ENOMEM; goto err_stop_hw; } if (id->product == USB_DEVICE_ID_APPLE_MAGICMOUSE) report = hid_register_report(hdev, HID_INPUT_REPORT, MOUSE_REPORT_ID); else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */ report = hid_register_report(hdev, HID_INPUT_REPORT, TRACKPAD_REPORT_ID); report = hid_register_report(hdev, HID_INPUT_REPORT, DOUBLE_REPORT_ID); } if (!report) { hid_err(hdev, ""unable to register touch report\n""); ret = -ENOMEM; goto err_stop_hw; } report->size = 6; /* * Some devices repond with 'invalid report id' when feature * report switching it into multitouch mode is sent to it. * * This results in -EIO from the _raw low-level transport callback, * but there seems to be no other way of switching the mode. * Thus the super-ugly hacky success check below. */ ret = hid_hw_raw_request(hdev, feature[0], feature, sizeof(feature), HID_FEATURE_REPORT, HID_REQ_SET_REPORT); if (ret != -EIO && ret != sizeof(feature)) { hid_err(hdev, ""unable to request touch data (%d)\n"", ret); goto err_stop_hw; } return 0; err_stop_hw: hid_hw_stop(hdev); return ret; } ",0 "static MagickBooleanType GetTIFFInfo(const ImageInfo *image_info, TIFF *tiff,TIFFInfo *tiff_info) { const char *option; MagickStatusType flags; uint32 tile_columns, tile_rows; assert(tiff_info != (TIFFInfo *) NULL); (void) memset(tiff_info,0,sizeof(*tiff_info)); option=GetImageOption(image_info,""tiff:tile-geometry""); if (option == (const char *) NULL) { uint32 rows_per_strip; option=GetImageOption(image_info,""tiff:rows-per-strip""); if (option != (const char *) NULL) rows_per_strip=(size_t) strtol(option,(char **) NULL,10); else if (TIFFGetField(tiff,TIFFTAG_IMAGELENGTH,&rows_per_strip) == 0) rows_per_strip=0; /* use default */ rows_per_strip=TIFFDefaultStripSize(tiff,rows_per_strip); (void) TIFFSetField(tiff,TIFFTAG_ROWSPERSTRIP,rows_per_strip); return(MagickTrue); } /* Create tiled TIFF, ignore ""tiff:rows-per-strip"". */ flags=ParseAbsoluteGeometry(option,&tiff_info->tile_geometry); if ((flags & HeightValue) == 0) tiff_info->tile_geometry.height=tiff_info->tile_geometry.width; tile_columns=(uint32) tiff_info->tile_geometry.width; tile_rows=(uint32) tiff_info->tile_geometry.height; TIFFDefaultTileSize(tiff,&tile_columns,&tile_rows); (void) TIFFSetField(tiff,TIFFTAG_TILEWIDTH,tile_columns); (void) TIFFSetField(tiff,TIFFTAG_TILELENGTH,tile_rows); tiff_info->tile_geometry.width=tile_columns; tiff_info->tile_geometry.height=tile_rows; if ((TIFFScanlineSize(tiff) <= 0) || (TIFFTileSize(tiff) <= 0)) { DestroyTIFFInfo(tiff_info); return(MagickFalse); } tiff_info->scanlines=(unsigned char *) AcquireQuantumMemory((size_t) tile_rows*TIFFScanlineSize(tiff),sizeof(*tiff_info->scanlines)); tiff_info->pixels=(unsigned char *) AcquireQuantumMemory((size_t) tile_rows*TIFFTileSize(tiff),sizeof(*tiff_info->scanlines)); if ((tiff_info->scanlines == (unsigned char *) NULL) || (tiff_info->pixels == (unsigned char *) NULL)) { DestroyTIFFInfo(tiff_info); return(MagickFalse); } return(MagickTrue); } ",0 "void VideoCaptureManager::OnScreenLocked() { #if !defined(OS_ANDROID) DCHECK_CURRENTLY_ON(BrowserThread::IO); EmitLogMessage(""VideoCaptureManager::OnScreenLocked"", 1); std::vector desktopcapture_session_ids; for (auto it : sessions_) { if (IsDesktopCaptureMediaType(it.second.type)) desktopcapture_session_ids.push_back(it.first); } for (auto session_id : desktopcapture_session_ids) { Close(session_id); } #endif // OS_ANDROID } ",0 "static int cbc_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) { struct camellia_sparc64_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); struct blkcipher_walk walk; cbc_crypt_op *op; const u64 *key; int err; op = camellia_sparc64_cbc_decrypt_3_grand_rounds; if (ctx->key_len != 16) op = camellia_sparc64_cbc_decrypt_4_grand_rounds; blkcipher_walk_init(&walk, dst, src, nbytes); err = blkcipher_walk_virt(desc, &walk); desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; key = &ctx->decrypt_key[0]; camellia_sparc64_load_keys(key, ctx->key_len); while ((nbytes = walk.nbytes)) { unsigned int block_len = nbytes & CAMELLIA_BLOCK_MASK; if (likely(block_len)) { const u64 *src64; u64 *dst64; src64 = (const u64 *)walk.src.virt.addr; dst64 = (u64 *) walk.dst.virt.addr; op(src64, dst64, block_len, key, (u64 *) walk.iv); } nbytes &= CAMELLIA_BLOCK_SIZE - 1; err = blkcipher_walk_done(desc, &walk, nbytes); } fprs_write(0); return err; } ",0 "static void __sched_fork(struct task_struct *p) { p->se.exec_start = 0; p->se.sum_exec_runtime = 0; p->se.prev_sum_exec_runtime = 0; p->se.nr_migrations = 0; #ifdef CONFIG_SCHEDSTATS memset(&p->se.statistics, 0, sizeof(p->se.statistics)); #endif INIT_LIST_HEAD(&p->rt.run_list); p->se.on_rq = 0; INIT_LIST_HEAD(&p->se.group_node); #ifdef CONFIG_PREEMPT_NOTIFIERS INIT_HLIST_HEAD(&p->preempt_notifiers); #endif } ",0 "void Document::scheduleLayoutTreeUpdate() { ASSERT(!hasPendingStyleRecalc()); ASSERT(shouldScheduleLayoutTreeUpdate()); ASSERT(needsLayoutTreeUpdate()); page()->animator().scheduleVisualUpdate(); m_lifecycle.ensureStateAtMost(DocumentLifecycle::VisualUpdatePending); TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT(""devtools.timeline""), ""ScheduleStyleRecalculation"", TRACE_EVENT_SCOPE_THREAD, ""data"", InspectorRecalculateStylesEvent::data(frame())); InspectorInstrumentation::didScheduleStyleRecalculation(this); } ",0 "h2_stream *h2_stream_open(int id, apr_pool_t *pool, h2_session *session, int initiated_on) { h2_stream *stream = apr_pcalloc(pool, sizeof(h2_stream)); stream->id = id; stream->initiated_on = initiated_on; stream->created = apr_time_now(); stream->state = H2_STREAM_ST_IDLE; stream->pool = pool; stream->session = session; stream->can_be_cleaned = 1; h2_beam_create(&stream->input, pool, id, ""input"", H2_BEAM_OWNER_SEND, 0); h2_beam_create(&stream->output, pool, id, ""output"", H2_BEAM_OWNER_RECV, 0); set_state(stream, H2_STREAM_ST_OPEN); apr_pool_cleanup_register(pool, stream, stream_pool_cleanup, apr_pool_cleanup_null); ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, APLOGNO(03082) ""h2_stream(%ld-%d): opened"", session->id, stream->id); return stream; } ",0 " static gboolean OnMouseScrollEvent(GtkWidget* widget, GdkEventScroll* event, RenderWidgetHostViewGtk* host_view) { TRACE_EVENT0(""browser"", ""RenderWidgetHostViewGtkWidget::OnMouseScrollEvent""); if (event->state & GDK_SHIFT_MASK) { if (event->direction == GDK_SCROLL_UP) event->direction = GDK_SCROLL_LEFT; else if (event->direction == GDK_SCROLL_DOWN) event->direction = GDK_SCROLL_RIGHT; } WebMouseWheelEvent web_event = WebInputEventFactory::mouseWheelEvent(event); if (event->direction == GDK_SCROLL_UP || event->direction == GDK_SCROLL_DOWN) { if (event->direction == GDK_SCROLL_UP) web_event.deltaY = kDefaultScrollPixelsPerTick; else web_event.deltaY = -kDefaultScrollPixelsPerTick; web_event.deltaY += GetPendingScrollDelta(true, event->state); } else { if (event->direction == GDK_SCROLL_LEFT) web_event.deltaX = kDefaultScrollPixelsPerTick; else web_event.deltaX = -kDefaultScrollPixelsPerTick; web_event.deltaX += GetPendingScrollDelta(false, event->state); } RenderWidgetHostImpl::From( host_view->GetRenderWidgetHost())->ForwardWheelEvent(web_event); return FALSE; } ",0 "ZGFX_CONTEXT* zgfx_context_new(BOOL Compressor) { ZGFX_CONTEXT* zgfx; zgfx = (ZGFX_CONTEXT*) calloc(1, sizeof(ZGFX_CONTEXT)); if (zgfx) { zgfx->Compressor = Compressor; zgfx->HistoryBufferSize = sizeof(zgfx->HistoryBuffer); zgfx_context_reset(zgfx, FALSE); } return zgfx; } ",0 "void NavigationController::InsertOrReplaceEntry(NavigationEntry* entry, bool replace) { DCHECK(entry->transition_type() != PageTransition::AUTO_SUBFRAME); const NavigationEntry* const pending_entry = (pending_entry_index_ == -1) ? pending_entry_ : entries_[pending_entry_index_].get(); if (pending_entry) entry->set_unique_id(pending_entry->unique_id()); DiscardNonCommittedEntriesInternal(); int current_size = static_cast(entries_.size()); if (current_size > 0) { int prune_up_to = replace ? last_committed_entry_index_ - 1 : last_committed_entry_index_; int num_pruned = 0; while (prune_up_to < (current_size - 1)) { num_pruned++; entries_.pop_back(); current_size--; } if (num_pruned > 0) // Only notify if we did prune something. NotifyPrunedEntries(this, false, num_pruned); } if (entries_.size() >= max_entry_count_) { RemoveEntryAtIndex(0, GURL()); NotifyPrunedEntries(this, true, 1); } entries_.push_back(linked_ptr(entry)); last_committed_entry_index_ = static_cast(entries_.size()) - 1; tab_contents_->UpdateMaxPageID(entry->page_id()); } ",0 "advance_past_options(char **cpp) { char *cp = *cpp; int quoted = 0; for (; *cp && (quoted || (*cp != ' ' && *cp != '\t')); cp++) { if (*cp == '\\' && cp[1] == '""') cp++; /* Skip both */ else if (*cp == '""') quoted = !quoted; } *cpp = cp; /* return failure for unterminated quotes */ return (*cp == '\0' && quoted) ? -1 : 0; } ",0 " bool CacheFileExists(const std::string& resource_id, const std::string& md5) { const FilePath file_path = file_system_->GetCacheFilePath( resource_id, md5, GDataRootDirectory::CACHE_TYPE_TMP, GDataFileSystem::CACHED_FILE_FROM_SERVER); return file_util::PathExists(file_path); } ",0 "void Browser::WorkerCrashed(TabContents* source) { TabContentsWrapper* wrapper = TabContentsWrapper::GetCurrentWrapperForContents(source); wrapper->infobar_tab_helper()->AddInfoBar(new SimpleAlertInfoBarDelegate( source, NULL, l10n_util::GetStringUTF16(IDS_WEBWORKER_CRASHED_PROMPT), true)); } ",0 "void SiteInstanceImpl::SetSite(const GURL& url) { TRACE_EVENT2(""navigation"", ""SiteInstanceImpl::SetSite"", ""site id"", id_, ""url"", url.possibly_invalid_spec()); DCHECK(!has_site_); has_site_ = true; BrowserContext* browser_context = browsing_instance_->browser_context(); site_ = GetSiteForURL(browser_context, url); original_url_ = url; browsing_instance_->RegisterSiteInstance(this); bool should_use_process_per_site = RenderProcessHost::ShouldUseProcessPerSite(browser_context, site_); if (should_use_process_per_site) { process_reuse_policy_ = ProcessReusePolicy::PROCESS_PER_SITE; } if (process_) { LockToOriginIfNeeded(); if (should_use_process_per_site) { RenderProcessHostImpl::RegisterProcessHostForSite( browser_context, process_, site_); } } } ",0 "bool RenderView::MaybeLoadAlternateErrorPage(WebFrame* frame, const WebURLError& error, bool replace) { if (frame->parent()) return false; int ec = error.reason; if (ec != net::ERR_NAME_NOT_RESOLVED && ec != net::ERR_CONNECTION_FAILED && ec != net::ERR_CONNECTION_REFUSED && ec != net::ERR_ADDRESS_UNREACHABLE && ec != net::ERR_CONNECTION_TIMED_OUT) return false; const GURL& error_page_url = GetAlternateErrorPageURL(error.unreachableURL, ec == net::ERR_NAME_NOT_RESOLVED ? DNS_ERROR : CONNECTION_ERROR); if (!error_page_url.is_valid()) return false; frame->loadHTMLString(std::string(), GURL(kUnreachableWebDataURL), error.unreachableURL, replace); NavigationState* navigation_state = NavigationState::FromDataSource(frame->provisionalDataSource()); navigation_state->set_alt_error_page_fetcher( new AltErrorPageResourceFetcher( error_page_url, frame, error, NewCallback(this, &RenderView::AltErrorPageFinished))); return true; } ",0 "check_entry_size_and_hooks(struct ip6t_entry *e, struct xt_table_info *newinfo, const unsigned char *base, const unsigned char *limit, const unsigned int *hook_entries, const unsigned int *underflows, unsigned int valid_hooks) { unsigned int h; int err; if ((unsigned long)e % __alignof__(struct ip6t_entry) != 0 || (unsigned char *)e + sizeof(struct ip6t_entry) >= limit) { duprintf(""Bad offset %p\n"", e); return -EINVAL; } if (e->next_offset < sizeof(struct ip6t_entry) + sizeof(struct xt_entry_target)) { duprintf(""checking: element %p size %u\n"", e, e->next_offset); return -EINVAL; } err = check_entry(e); if (err) return err; /* Check hooks & underflows */ for (h = 0; h < NF_INET_NUMHOOKS; h++) { if (!(valid_hooks & (1 << h))) continue; if ((unsigned char *)e - base == hook_entries[h]) newinfo->hook_entry[h] = hook_entries[h]; if ((unsigned char *)e - base == underflows[h]) { if (!check_underflow(e)) { pr_err(""Underflows must be unconditional and "" ""use the STANDARD target with "" ""ACCEPT/DROP\n""); return -EINVAL; } newinfo->underflow[h] = underflows[h]; } } /* Clear counters and comefrom */ e->counters = ((struct xt_counters) { 0, 0 }); e->comefrom = 0; return 0; } ",1 "GF_Err dmed_dump(GF_Box *a, FILE * trace) { GF_DMEDBox *p; p = (GF_DMEDBox *)a; gf_isom_box_dump_start(a, ""BytesFromMediaTrackBox"", trace); fprintf(trace, ""BytesSent=\""""LLD""\"">\n"", LLD_CAST p->nbBytes); gf_isom_box_dump_done(""BytesFromMediaTrackBox"", a, trace); return GF_OK; } ",0 "static struct sem_undo *find_alloc_undo(struct ipc_namespace *ns, int semid) { struct sem_array *sma; struct sem_undo_list *ulp; struct sem_undo *un, *new; int nsems; int error; error = get_undo_list(&ulp); if (error) return ERR_PTR(error); rcu_read_lock(); spin_lock(&ulp->lock); un = lookup_undo(ulp, semid); spin_unlock(&ulp->lock); if (likely(un!=NULL)) goto out; /* no undo structure around - allocate one. */ /* step 1: figure out the size of the semaphore array */ sma = sem_obtain_object_check(ns, semid); if (IS_ERR(sma)) { rcu_read_unlock(); return ERR_CAST(sma); } nsems = sma->sem_nsems; ipc_rcu_getref(sma); rcu_read_unlock(); /* step 2: allocate new undo structure */ new = kzalloc(sizeof(struct sem_undo) + sizeof(short)*nsems, GFP_KERNEL); if (!new) { sem_putref(sma); return ERR_PTR(-ENOMEM); } /* step 3: Acquire the lock on semaphore array */ sem_lock_and_putref(sma); if (sma->sem_perm.deleted) { sem_unlock(sma); kfree(new); un = ERR_PTR(-EIDRM); goto out; } spin_lock(&ulp->lock); /* * step 4: check for races: did someone else allocate the undo struct? */ un = lookup_undo(ulp, semid); if (un) { kfree(new); goto success; } /* step 5: initialize & link new undo structure */ new->semadj = (short *) &new[1]; new->ulp = ulp; new->semid = semid; assert_spin_locked(&ulp->lock); list_add_rcu(&new->list_proc, &ulp->list_proc); assert_spin_locked(&sma->sem_perm.lock); list_add(&new->list_id, &sma->list_id); un = new; success: spin_unlock(&ulp->lock); rcu_read_lock(); sem_unlock(sma); out: return un; } ",1 "int stb_vorbis_get_sample_offset(stb_vorbis *f) { if (f->current_loc_valid) return f->current_loc; else return -1; } ",0 "static void rehighlight_forbidden_words(int page, GtkTextView *tev) { GList *forbidden_words = load_words_from_file(FORBIDDEN_WORDS_BLACKLLIST); GList *allowed_words = load_words_from_file(FORBIDDEN_WORDS_WHITELIST); highligh_words_in_textview(page, tev, forbidden_words, allowed_words, /*case sensitive*/false); list_free_with_free(forbidden_words); list_free_with_free(allowed_words); } ",0 "static int ip_vs_svc_unhash(struct ip_vs_service *svc) { if (!(svc->flags & IP_VS_SVC_F_HASHED)) { pr_err(""%s(): request for unhash flagged, called from %pF\n"", __func__, __builtin_return_address(0)); return 0; } if (svc->fwmark == 0) { /* Remove it from the ip_vs_svc_table table */ list_del(&svc->s_list); } else { /* Remove it from the ip_vs_svc_fwm_table table */ list_del(&svc->f_list); } svc->flags &= ~IP_VS_SVC_F_HASHED; atomic_dec(&svc->refcnt); return 1; } ",0 "static int proc_self_readlink(struct dentry *dentry, char __user *buffer, int buflen) { struct pid_namespace *ns = dentry->d_sb->s_fs_info; pid_t tgid = task_tgid_nr_ns(current, ns); char tmp[PROC_NUMBUF]; if (!tgid) return -ENOENT; sprintf(tmp, ""%d"", tgid); return vfs_readlink(dentry,buffer,buflen,tmp); } ",0 "dynamic_interfaces_handler(vector_t *strvec) { char *str; global_data->dynamic_interfaces = true; if (vector_size(strvec) >= 2) { str = strvec_slot(strvec, 1); if (!strcmp(str, ""allow_if_changes"")) global_data->allow_if_changes = true; else report_config_error(CONFIG_GENERAL_ERROR, ""Unknown dynamic_interfaces option '%s'"",str); } } ",0 "static inline int ebt_make_matchname(const struct ebt_entry_match *m, const char *base, char __user *ubase) { char __user *hlp = ubase + ((char *)m - base); if (copy_to_user(hlp, m->u.match->name, EBT_FUNCTION_MAXNAMELEN)) return -EFAULT; return 0; } ",0 "UsbResetDeviceFunction::~UsbResetDeviceFunction() { } ",0 "static MagickBooleanType IsLocaleTreeInstantiated(ExceptionInfo *exception) { if (locale_cache == (SplayTreeInfo *) NULL) { if (locale_semaphore == (SemaphoreInfo *) NULL) ActivateSemaphoreInfo(&locale_semaphore); LockSemaphoreInfo(locale_semaphore); if (locale_cache == (SplayTreeInfo *) NULL) { char *locale; register const char *p; locale=(char *) NULL; p=setlocale(LC_CTYPE,(const char *) NULL); if (p != (const char *) NULL) locale=ConstantString(p); if (locale == (char *) NULL) locale=GetEnvironmentValue(""LC_ALL""); if (locale == (char *) NULL) locale=GetEnvironmentValue(""LC_MESSAGES""); if (locale == (char *) NULL) locale=GetEnvironmentValue(""LC_CTYPE""); if (locale == (char *) NULL) locale=GetEnvironmentValue(""LANG""); if (locale == (char *) NULL) locale=ConstantString(""C""); locale_cache=AcquireLocaleSplayTree(LocaleFilename,locale,exception); locale=DestroyString(locale); } UnlockSemaphoreInfo(locale_semaphore); } return(locale_cache != (SplayTreeInfo *) NULL ? MagickTrue : MagickFalse); } ",0 "kadm5_setkey_principal_3(void *server_handle, krb5_principal principal, krb5_boolean keepold, int n_ks_tuple, krb5_key_salt_tuple *ks_tuple, krb5_keyblock *keyblocks, int n_keys) { kadm5_key_data *key_data; kadm5_ret_t ret; int i; if (keyblocks == NULL) return EINVAL; if (n_ks_tuple) { if (n_ks_tuple != n_keys) return KADM5_SETKEY3_ETYPE_MISMATCH; for (i = 0; i < n_ks_tuple; i++) { if (ks_tuple[i].ks_enctype != keyblocks[i].enctype) return KADM5_SETKEY3_ETYPE_MISMATCH; } } key_data = calloc(n_keys, sizeof(kadm5_key_data)); if (key_data == NULL) return ENOMEM; for (i = 0; i < n_keys; i++) { key_data[i].key = keyblocks[i]; key_data[i].salt.type = n_ks_tuple ? ks_tuple[i].ks_salttype : KRB5_KDB_SALTTYPE_NORMAL; } ret = kadm5_setkey_principal_4(server_handle, principal, keepold, key_data, n_keys); free(key_data); return ret; } ",0 " status_t NuPlayer::GenericSource::setBuffers( bool audio, Vector &buffers) { if (mIsSecure && !audio) { return mVideoTrack.mSource->setBuffers(buffers); } return INVALID_OPERATION; } ",1 " views::Widget* GetCloseButton(WindowSelectorItem* window) { return window->close_button_->GetWidget(); } ",0 "bool omx_vdec::release_output_done(void) { bool bRet = false; unsigned i=0,j=0; DEBUG_PRINT_LOW(""Value of m_out_mem_ptr %p"",m_out_mem_ptr); if (m_out_mem_ptr) { for (; j < drv_ctx.op_buf.actualcount ; j++) { if (BITMASK_PRESENT(&m_out_bm_count,j)) { break; } } if (j == drv_ctx.op_buf.actualcount) { m_out_bm_count = 0; bRet = true; } } else { m_out_bm_count = 0; bRet = true; } return bRet; } ",0 "void CL_StartHunkUsers( qboolean rendererOnly ) { if (!com_cl_running) { return; } if ( !com_cl_running->integer ) { return; } if ( !cls.rendererStarted ) { cls.rendererStarted = qtrue; CL_InitRenderer(); } if ( rendererOnly ) { return; } if ( !cls.soundStarted ) { cls.soundStarted = qtrue; S_Init(); } if ( !cls.soundRegistered ) { cls.soundRegistered = qtrue; S_BeginRegistration(); } if( com_dedicated->integer ) { return; } if ( !cls.uiStarted ) { cls.uiStarted = qtrue; CL_InitUI(); } } ",0 "set_str(unsigned char *p, const char *s, size_t l, char f, const char *map) { unsigned char c; if (s == NULL) s = """"; while ((c = *s++) != 0 && l > 0) { if (c >= 0x80 || map[c] == 0) { /* illegal character */ if (c >= 'a' && c <= 'z') { /* convert c from a-z to A-Z */ c -= 0x20; } else c = 0x5f; } *p++ = c; l--; } /* If l isn't zero, fill p buffer by the character * which indicated by f. */ if (l > 0) memset(p , f, l); } ",0 "static void vmx_set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3) { unsigned long guest_cr3; u64 eptp; guest_cr3 = cr3; if (enable_ept) { eptp = construct_eptp(cr3); vmcs_write64(EPT_POINTER, eptp); if (is_paging(vcpu) || is_guest_mode(vcpu)) guest_cr3 = kvm_read_cr3(vcpu); else guest_cr3 = vcpu->kvm->arch.ept_identity_map_addr; ept_load_pdptrs(vcpu); } vmx_flush_tlb(vcpu); vmcs_writel(GUEST_CR3, guest_cr3); } ",0 "void WebContentsImpl::GetManifest(const GetManifestCallback& callback) { manifest_manager_host_->GetManifest(callback); } ",0 "int csum_len_for_type(int cst) { switch (cst) { case CSUM_NONE: return 1; case CSUM_ARCHAIC: return 2; case CSUM_MD4: case CSUM_MD4_OLD: case CSUM_MD4_BUSTED: return MD4_DIGEST_LEN; case CSUM_MD5: return MD5_DIGEST_LEN; } return 0; } ",1 "static int get_manuf_info(struct edgeport_serial *serial, __u8 *buffer) { int status; int start_address; struct ti_i2c_desc *rom_desc; struct edge_ti_manuf_descriptor *desc; struct device *dev = &serial->serial->dev->dev; rom_desc = kmalloc(sizeof(*rom_desc), GFP_KERNEL); if (!rom_desc) { dev_err(dev, ""%s - out of memory\n"", __func__); return -ENOMEM; } start_address = get_descriptor_addr(serial, I2C_DESC_TYPE_ION, rom_desc); if (!start_address) { dev_dbg(dev, ""%s - Edge Descriptor not found in I2C\n"", __func__); status = -ENODEV; goto exit; } /* Read the descriptor data */ status = read_rom(serial, start_address+sizeof(struct ti_i2c_desc), rom_desc->Size, buffer); if (status) goto exit; status = valid_csum(rom_desc, buffer); desc = (struct edge_ti_manuf_descriptor *)buffer; dev_dbg(dev, ""%s - IonConfig 0x%x\n"", __func__, desc->IonConfig); dev_dbg(dev, ""%s - Version %d\n"", __func__, desc->Version); dev_dbg(dev, ""%s - Cpu/Board 0x%x\n"", __func__, desc->CpuRev_BoardRev); dev_dbg(dev, ""%s - NumPorts %d\n"", __func__, desc->NumPorts); dev_dbg(dev, ""%s - NumVirtualPorts %d\n"", __func__, desc->NumVirtualPorts); dev_dbg(dev, ""%s - TotalPorts %d\n"", __func__, desc->TotalPorts); exit: kfree(rom_desc); return status; } ",0 "static int in_set_gain(struct audio_stream_in *stream, float gain) { (void)stream; (void)gain; return 0; } ",0 "cifs_find_smb_ses(struct TCP_Server_Info *server, struct smb_vol *vol) { struct cifsSesInfo *ses; spin_lock(&cifs_tcp_ses_lock); list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) { switch (server->secType) { case Kerberos: if (vol->cred_uid != ses->cred_uid) continue; break; default: /* anything else takes username/password */ if (ses->user_name == NULL) continue; if (strncmp(ses->user_name, vol->username, MAX_USERNAME_SIZE)) continue; if (strlen(vol->username) != 0 && ses->password != NULL && strncmp(ses->password, vol->password ? vol->password : """", MAX_PASSWORD_SIZE)) continue; } ++ses->ses_count; spin_unlock(&cifs_tcp_ses_lock); return ses; } spin_unlock(&cifs_tcp_ses_lock); return NULL; } ",0 "add_gray_list(mrb_state *mrb, mrb_gc *gc, struct RBasic *obj) { #ifdef MRB_GC_STRESS if (obj->tt > MRB_TT_MAXDEFINE) { abort(); } #endif paint_gray(obj); obj->gcnext = gc->gray_list; gc->gray_list = obj; } ",0 "_zip_memmem(const unsigned char *big, size_t biglen, const unsigned char *little, size_t littlelen) { const unsigned char *p; if ((biglen < littlelen) || (littlelen == 0)) return NULL; p = big-1; while ((p=(const unsigned char *) memchr(p+1, little[0], (size_t)(big-(p+1))+(size_t)(biglen-littlelen)+1)) != NULL) { if (memcmp(p+1, little+1, littlelen-1)==0) return (unsigned char *)p; } return NULL; } ",0 "png_init_read_transformations(png_structp png_ptr) { png_debug(1, ""in png_init_read_transformations""); #ifdef PNG_USELESS_TESTS_SUPPORTED if (png_ptr != NULL) #endif { #if defined(PNG_READ_BACKGROUND_SUPPORTED) || \ defined(PNG_READ_SHIFT_SUPPORTED) || \ defined(PNG_READ_GAMMA_SUPPORTED) int color_type = png_ptr->color_type; #endif #if defined(PNG_READ_EXPAND_SUPPORTED) && defined(PNG_READ_BACKGROUND_SUPPORTED) #ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED /* Detect gray background and attempt to enable optimization * for gray --> RGB case * * Note: if PNG_BACKGROUND_EXPAND is set and color_type is either RGB or * RGB_ALPHA (in which case need_expand is superfluous anyway), the * background color might actually be gray yet not be flagged as such. * This is not a problem for the current code, which uses * PNG_BACKGROUND_IS_GRAY only to decide when to do the * png_do_gray_to_rgb() transformation. */ if ((png_ptr->transformations & PNG_BACKGROUND_EXPAND) && !(color_type & PNG_COLOR_MASK_COLOR)) { png_ptr->mode |= PNG_BACKGROUND_IS_GRAY; } else if ((png_ptr->transformations & PNG_BACKGROUND) && !(png_ptr->transformations & PNG_BACKGROUND_EXPAND) && (png_ptr->transformations & PNG_GRAY_TO_RGB) && png_ptr->background.red == png_ptr->background.green && png_ptr->background.red == png_ptr->background.blue) { png_ptr->mode |= PNG_BACKGROUND_IS_GRAY; png_ptr->background.gray = png_ptr->background.red; } #endif if ((png_ptr->transformations & PNG_BACKGROUND_EXPAND) && (png_ptr->transformations & PNG_EXPAND)) { if (!(color_type & PNG_COLOR_MASK_COLOR)) /* i.e., GRAY or GRAY_ALPHA */ { /* Expand background and tRNS chunks */ switch (png_ptr->bit_depth) { case 1: png_ptr->background.gray *= (png_uint_16)0xff; png_ptr->background.red = png_ptr->background.green = png_ptr->background.blue = png_ptr->background.gray; if (!(png_ptr->transformations & PNG_EXPAND_tRNS)) { png_ptr->trans_values.gray *= (png_uint_16)0xff; png_ptr->trans_values.red = png_ptr->trans_values.green = png_ptr->trans_values.blue = png_ptr->trans_values.gray; } break; case 2: png_ptr->background.gray *= (png_uint_16)0x55; png_ptr->background.red = png_ptr->background.green = png_ptr->background.blue = png_ptr->background.gray; if (!(png_ptr->transformations & PNG_EXPAND_tRNS)) { png_ptr->trans_values.gray *= (png_uint_16)0x55; png_ptr->trans_values.red = png_ptr->trans_values.green = png_ptr->trans_values.blue = png_ptr->trans_values.gray; } break; case 4: png_ptr->background.gray *= (png_uint_16)0x11; png_ptr->background.red = png_ptr->background.green = png_ptr->background.blue = png_ptr->background.gray; if (!(png_ptr->transformations & PNG_EXPAND_tRNS)) { png_ptr->trans_values.gray *= (png_uint_16)0x11; png_ptr->trans_values.red = png_ptr->trans_values.green = png_ptr->trans_values.blue = png_ptr->trans_values.gray; } break; case 8: case 16: png_ptr->background.red = png_ptr->background.green = png_ptr->background.blue = png_ptr->background.gray; break; } } else if (color_type == PNG_COLOR_TYPE_PALETTE) { png_ptr->background.red = png_ptr->palette[png_ptr->background.index].red; png_ptr->background.green = png_ptr->palette[png_ptr->background.index].green; png_ptr->background.blue = png_ptr->palette[png_ptr->background.index].blue; #ifdef PNG_READ_INVERT_ALPHA_SUPPORTED if (png_ptr->transformations & PNG_INVERT_ALPHA) { #ifdef PNG_READ_EXPAND_SUPPORTED if (!(png_ptr->transformations & PNG_EXPAND_tRNS)) #endif { /* Invert the alpha channel (in tRNS) unless the pixels are * going to be expanded, in which case leave it for later */ int i, istop; istop=(int)png_ptr->num_trans; for (i=0; itrans[i] = (png_byte)(255 - png_ptr->trans[i]); } } #endif } } #endif #if defined(PNG_READ_BACKGROUND_SUPPORTED) && defined(PNG_READ_GAMMA_SUPPORTED) png_ptr->background_1 = png_ptr->background; #endif #if defined(PNG_READ_GAMMA_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED) if ((color_type == PNG_COLOR_TYPE_PALETTE && png_ptr->num_trans != 0) && (fabs(png_ptr->screen_gamma * png_ptr->gamma - 1.0) < PNG_GAMMA_THRESHOLD)) { int i, k; k=0; for (i=0; inum_trans; i++) { if (png_ptr->trans[i] != 0 && png_ptr->trans[i] != 0xff) { k=1; /* Partial transparency is present */ break; } } if (k == 0) png_ptr->transformations &= ~PNG_GAMMA; } if ((png_ptr->transformations & (PNG_GAMMA | PNG_RGB_TO_GRAY)) && png_ptr->gamma != 0.0) { png_build_gamma_table(png_ptr); #ifdef PNG_READ_BACKGROUND_SUPPORTED if (png_ptr->transformations & PNG_BACKGROUND) { if (color_type == PNG_COLOR_TYPE_PALETTE) { /* Could skip if no transparency */ png_color back, back_1; png_colorp palette = png_ptr->palette; int num_palette = png_ptr->num_palette; int i; if (png_ptr->background_gamma_type == PNG_BACKGROUND_GAMMA_FILE) { back.red = png_ptr->gamma_table[png_ptr->background.red]; back.green = png_ptr->gamma_table[png_ptr->background.green]; back.blue = png_ptr->gamma_table[png_ptr->background.blue]; back_1.red = png_ptr->gamma_to_1[png_ptr->background.red]; back_1.green = png_ptr->gamma_to_1[png_ptr->background.green]; back_1.blue = png_ptr->gamma_to_1[png_ptr->background.blue]; } else { double g, gs; switch (png_ptr->background_gamma_type) { case PNG_BACKGROUND_GAMMA_SCREEN: g = (png_ptr->screen_gamma); gs = 1.0; break; case PNG_BACKGROUND_GAMMA_FILE: g = 1.0 / (png_ptr->gamma); gs = 1.0 / (png_ptr->gamma * png_ptr->screen_gamma); break; case PNG_BACKGROUND_GAMMA_UNIQUE: g = 1.0 / (png_ptr->background_gamma); gs = 1.0 / (png_ptr->background_gamma * png_ptr->screen_gamma); break; default: g = 1.0; /* back_1 */ gs = 1.0; /* back */ } if ( fabs(gs - 1.0) < PNG_GAMMA_THRESHOLD) { back.red = (png_byte)png_ptr->background.red; back.green = (png_byte)png_ptr->background.green; back.blue = (png_byte)png_ptr->background.blue; } else { back.red = (png_byte)(pow( (double)png_ptr->background.red/255, gs) * 255.0 + .5); back.green = (png_byte)(pow( (double)png_ptr->background.green/255, gs) * 255.0 + .5); back.blue = (png_byte)(pow( (double)png_ptr->background.blue/255, gs) * 255.0 + .5); } back_1.red = (png_byte)(pow( (double)png_ptr->background.red/255, g) * 255.0 + .5); back_1.green = (png_byte)(pow( (double)png_ptr->background.green/255, g) * 255.0 + .5); back_1.blue = (png_byte)(pow( (double)png_ptr->background.blue/255, g) * 255.0 + .5); } for (i = 0; i < num_palette; i++) { if (i < (int)png_ptr->num_trans && png_ptr->trans[i] != 0xff) { if (png_ptr->trans[i] == 0) { palette[i] = back; } else /* if (png_ptr->trans[i] != 0xff) */ { png_byte v, w; v = png_ptr->gamma_to_1[palette[i].red]; png_composite(w, v, png_ptr->trans[i], back_1.red); palette[i].red = png_ptr->gamma_from_1[w]; v = png_ptr->gamma_to_1[palette[i].green]; png_composite(w, v, png_ptr->trans[i], back_1.green); palette[i].green = png_ptr->gamma_from_1[w]; v = png_ptr->gamma_to_1[palette[i].blue]; png_composite(w, v, png_ptr->trans[i], back_1.blue); palette[i].blue = png_ptr->gamma_from_1[w]; } } else { palette[i].red = png_ptr->gamma_table[palette[i].red]; palette[i].green = png_ptr->gamma_table[palette[i].green]; palette[i].blue = png_ptr->gamma_table[palette[i].blue]; } } /* Prevent the transformations being done again, and make sure * that the now spurious alpha channel is stripped - the code * has just reduced background composition and gamma correction * to a simple alpha channel strip. */ png_ptr->transformations &= ~PNG_BACKGROUND; png_ptr->transformations &= ~PNG_GAMMA; png_ptr->transformations |= PNG_STRIP_ALPHA; } /* if (png_ptr->background_gamma_type!=PNG_BACKGROUND_GAMMA_UNKNOWN) */ else /* color_type != PNG_COLOR_TYPE_PALETTE */ { double m = (double)(((png_uint_32)1 << png_ptr->bit_depth) - 1); double g = 1.0; double gs = 1.0; switch (png_ptr->background_gamma_type) { case PNG_BACKGROUND_GAMMA_SCREEN: g = (png_ptr->screen_gamma); gs = 1.0; break; case PNG_BACKGROUND_GAMMA_FILE: g = 1.0 / (png_ptr->gamma); gs = 1.0 / (png_ptr->gamma * png_ptr->screen_gamma); break; case PNG_BACKGROUND_GAMMA_UNIQUE: g = 1.0 / (png_ptr->background_gamma); gs = 1.0 / (png_ptr->background_gamma * png_ptr->screen_gamma); break; } png_ptr->background_1.gray = (png_uint_16)(pow( (double)png_ptr->background.gray / m, g) * m + .5); png_ptr->background.gray = (png_uint_16)(pow( (double)png_ptr->background.gray / m, gs) * m + .5); if ((png_ptr->background.red != png_ptr->background.green) || (png_ptr->background.red != png_ptr->background.blue) || (png_ptr->background.red != png_ptr->background.gray)) { /* RGB or RGBA with color background */ png_ptr->background_1.red = (png_uint_16)(pow( (double)png_ptr->background.red / m, g) * m + .5); png_ptr->background_1.green = (png_uint_16)(pow( (double)png_ptr->background.green / m, g) * m + .5); png_ptr->background_1.blue = (png_uint_16)(pow( (double)png_ptr->background.blue / m, g) * m + .5); png_ptr->background.red = (png_uint_16)(pow( (double)png_ptr->background.red / m, gs) * m + .5); png_ptr->background.green = (png_uint_16)(pow( (double)png_ptr->background.green / m, gs) * m + .5); png_ptr->background.blue = (png_uint_16)(pow( (double)png_ptr->background.blue / m, gs) * m + .5); } else { /* GRAY, GRAY ALPHA, RGB, or RGBA with gray background */ png_ptr->background_1.red = png_ptr->background_1.green = png_ptr->background_1.blue = png_ptr->background_1.gray; png_ptr->background.red = png_ptr->background.green = png_ptr->background.blue = png_ptr->background.gray; } } } else /* Transformation does not include PNG_BACKGROUND */ #endif /* PNG_READ_BACKGROUND_SUPPORTED */ if (color_type == PNG_COLOR_TYPE_PALETTE) { png_colorp palette = png_ptr->palette; int num_palette = png_ptr->num_palette; int i; for (i = 0; i < num_palette; i++) { palette[i].red = png_ptr->gamma_table[palette[i].red]; palette[i].green = png_ptr->gamma_table[palette[i].green]; palette[i].blue = png_ptr->gamma_table[palette[i].blue]; } /* Done the gamma correction. */ png_ptr->transformations &= ~PNG_GAMMA; } } #ifdef PNG_READ_BACKGROUND_SUPPORTED else #endif #endif /* PNG_READ_GAMMA_SUPPORTED && PNG_FLOATING_POINT_SUPPORTED */ #ifdef PNG_READ_BACKGROUND_SUPPORTED /* No GAMMA transformation */ if ((png_ptr->transformations & PNG_BACKGROUND) && (color_type == PNG_COLOR_TYPE_PALETTE)) { int i; int istop = (int)png_ptr->num_trans; png_color back; png_colorp palette = png_ptr->palette; back.red = (png_byte)png_ptr->background.red; back.green = (png_byte)png_ptr->background.green; back.blue = (png_byte)png_ptr->background.blue; for (i = 0; i < istop; i++) { if (png_ptr->trans[i] == 0) { palette[i] = back; } else if (png_ptr->trans[i] != 0xff) { /* The png_composite() macro is defined in png.h */ png_composite(palette[i].red, palette[i].red, png_ptr->trans[i], back.red); png_composite(palette[i].green, palette[i].green, png_ptr->trans[i], back.green); png_composite(palette[i].blue, palette[i].blue, png_ptr->trans[i], back.blue); } } /* Handled alpha, still need to strip the channel. */ png_ptr->transformations &= ~PNG_BACKGROUND; png_ptr->transformations |= PNG_STRIP_ALPHA; } #endif /* PNG_READ_BACKGROUND_SUPPORTED */ #ifdef PNG_READ_SHIFT_SUPPORTED if ((png_ptr->transformations & PNG_SHIFT) && !(png_ptr->transformations & PNG_EXPAND) && (color_type == PNG_COLOR_TYPE_PALETTE)) { png_uint_16 i; png_uint_16 istop = png_ptr->num_palette; int sr = 8 - png_ptr->sig_bit.red; int sg = 8 - png_ptr->sig_bit.green; int sb = 8 - png_ptr->sig_bit.blue; if (sr < 0 || sr > 8) sr = 0; if (sg < 0 || sg > 8) sg = 0; if (sb < 0 || sb > 8) sb = 0; for (i = 0; i < istop; i++) { png_ptr->palette[i].red >>= sr; png_ptr->palette[i].green >>= sg; png_ptr->palette[i].blue >>= sb; } png_ptr->transformations &= ~PNG_SHIFT; } #endif /* PNG_READ_SHIFT_SUPPORTED */ } #if !defined(PNG_READ_GAMMA_SUPPORTED) && !defined(PNG_READ_SHIFT_SUPPORTED) \ && !defined(PNG_READ_BACKGROUND_SUPPORTED) if (png_ptr) return; #endif } ",0 "static void o2nm_node_release(struct config_item *item) { struct o2nm_node *node = to_o2nm_node(item); kfree(node); } ",0 "wStream* transport_send_stream_init(rdpTransport* transport, int size) { wStream* s; s = StreamPool_Take(transport->ReceivePool, size); Stream_EnsureCapacity(s, size); Stream_SetPosition(s, 0); return s; } ",0 "megasas_init_adapter_mfi(struct megasas_instance *instance) { u32 context_sz; u32 reply_q_sz; /* * Get various operational parameters from status register */ instance->max_fw_cmds = instance->instancet->read_fw_status_reg(instance) & 0x00FFFF; /* * Reduce the max supported cmds by 1. This is to ensure that the * reply_q_sz (1 more than the max cmd that driver may send) * does not exceed max cmds that the FW can support */ instance->max_fw_cmds = instance->max_fw_cmds-1; instance->max_mfi_cmds = instance->max_fw_cmds; instance->max_num_sge = (instance->instancet->read_fw_status_reg(instance) & 0xFF0000) >> 0x10; /* * For MFI skinny adapters, MEGASAS_SKINNY_INT_CMDS commands * are reserved for IOCTL + driver's internal DCMDs. */ if ((instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0073SKINNY) || (instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0071SKINNY)) { instance->max_scsi_cmds = (instance->max_fw_cmds - MEGASAS_SKINNY_INT_CMDS); sema_init(&instance->ioctl_sem, MEGASAS_SKINNY_INT_CMDS); } else { instance->max_scsi_cmds = (instance->max_fw_cmds - MEGASAS_INT_CMDS); sema_init(&instance->ioctl_sem, (MEGASAS_MFI_IOCTL_CMDS)); } instance->cur_can_queue = instance->max_scsi_cmds; /* * Create a pool of commands */ if (megasas_alloc_cmds(instance)) goto fail_alloc_cmds; /* * Allocate memory for reply queue. Length of reply queue should * be _one_ more than the maximum commands handled by the firmware. * * Note: When FW completes commands, it places corresponding contex * values in this circular reply queue. This circular queue is a fairly * typical producer-consumer queue. FW is the producer (of completed * commands) and the driver is the consumer. */ context_sz = sizeof(u32); reply_q_sz = context_sz * (instance->max_fw_cmds + 1); instance->reply_queue = dma_alloc_coherent(&instance->pdev->dev, reply_q_sz, &instance->reply_queue_h, GFP_KERNEL); if (!instance->reply_queue) { dev_printk(KERN_DEBUG, &instance->pdev->dev, ""Out of DMA mem for reply queue\n""); goto fail_reply_queue; } if (megasas_issue_init_mfi(instance)) goto fail_fw_init; if (megasas_get_ctrl_info(instance)) { dev_err(&instance->pdev->dev, ""(%d): Could get controller info "" ""Fail from %s %d\n"", instance->unique_id, __func__, __LINE__); goto fail_fw_init; } instance->fw_support_ieee = 0; instance->fw_support_ieee = (instance->instancet->read_fw_status_reg(instance) & 0x04000000); dev_notice(&instance->pdev->dev, ""megasas_init_mfi: fw_support_ieee=%d"", instance->fw_support_ieee); if (instance->fw_support_ieee) instance->flag_ieee = 1; return 0; fail_fw_init: dma_free_coherent(&instance->pdev->dev, reply_q_sz, instance->reply_queue, instance->reply_queue_h); fail_reply_queue: megasas_free_cmds(instance); fail_alloc_cmds: return 1; } ",0 "static void clean_live_states(struct bpf_verifier_env *env, int insn, struct bpf_verifier_state *cur) { struct bpf_verifier_state_list *sl; int i; sl = env->explored_states[insn]; if (!sl) return; while (sl != STATE_LIST_MARK) { if (sl->state.curframe != cur->curframe) goto next; for (i = 0; i <= cur->curframe; i++) if (sl->state.frame[i]->callsite != cur->frame[i]->callsite) goto next; clean_verifier_state(env, &sl->state); next: sl = sl->next; } } ",0 "bool ExecuteCodeInTabFunction::CanExecuteScriptOnPage(std::string* error) { content::WebContents* contents = nullptr; CHECK_GE(execute_tab_id_, 0); if (!GetTabById(execute_tab_id_, browser_context(), include_incognito_information(), nullptr, nullptr, &contents, nullptr, error)) { return false; } CHECK(contents); int frame_id = details_->frame_id ? *details_->frame_id : ExtensionApiFrameIdMap::kTopFrameId; content::RenderFrameHost* rfh = ExtensionApiFrameIdMap::GetRenderFrameHostById(contents, frame_id); if (!rfh) { *error = ErrorUtils::FormatErrorMessage(tabs_constants::kFrameNotFoundError, base::IntToString(frame_id), base::IntToString(execute_tab_id_)); return false; } GURL effective_document_url(rfh->GetLastCommittedURL()); bool is_about_url = effective_document_url.SchemeIs(url::kAboutScheme); if (is_about_url && details_->match_about_blank && *details_->match_about_blank) { effective_document_url = GURL(rfh->GetLastCommittedOrigin().Serialize()); } if (!effective_document_url.is_valid()) { return true; } if (!extension()->permissions_data()->CanAccessPage(effective_document_url, execute_tab_id_, error)) { if (is_about_url && extension()->permissions_data()->active_permissions().HasAPIPermission( APIPermission::kTab)) { *error = ErrorUtils::FormatErrorMessage( manifest_errors::kCannotAccessAboutUrl, rfh->GetLastCommittedURL().spec(), rfh->GetLastCommittedOrigin().Serialize()); } return false; } return true; } ",0 " void MagnetometerCallback(scoped_refptr sensor) { magnetometer_callback_called_ = true; magnetometer_ = static_cast(sensor.get()); } ",0 "static void perform_renew(void) { bb_info_msg(""Performing a DHCP renew""); switch (state) { case BOUND: change_listen_mode(LISTEN_KERNEL); case RENEWING: case REBINDING: state = RENEW_REQUESTED; break; case RENEW_REQUESTED: /* impatient are we? fine, square 1 */ udhcp_run_script(NULL, ""deconfig""); case REQUESTING: case RELEASED: change_listen_mode(LISTEN_RAW); state = INIT_SELECTING; break; case INIT_SELECTING: break; } } ",0 "TextTrackList* HTMLMediaElement::textTracks() { if (!m_textTracks) m_textTracks = TextTrackList::create(this); return m_textTracks.get(); } ",0 "static int available_error_type_open(struct inode *inode, struct file *file) { return single_open(file, available_error_type_show, NULL); } ",0 "qtdemux_tag_add_str (GstQTDemux * qtdemux, const char *tag, const char *dummy, GNode * node) { const gchar *env_vars[] = { ""GST_QT_TAG_ENCODING"", ""GST_TAG_ENCODING"", NULL }; GNode *data; char *s; int len; int type; int offset; data = qtdemux_tree_get_child_by_type (node, FOURCC_data); if (data) { len = QT_UINT32 (data->data); type = QT_UINT32 ((guint8 *) data->data + 8); if (type == 0x00000001) { s = gst_tag_freeform_string_to_utf8 ((char *) data->data + 16, len - 16, env_vars); if (s) { GST_DEBUG_OBJECT (qtdemux, ""adding tag %s"", GST_STR_NULL (s)); gst_tag_list_add (qtdemux->tag_list, GST_TAG_MERGE_REPLACE, tag, s, NULL); g_free (s); } else { GST_DEBUG_OBJECT (qtdemux, ""failed to convert %s tag to UTF-8"", tag); } } } else { len = QT_UINT32 (node->data); type = QT_UINT32 ((guint8 *) node->data + 4); if (type & 0xa9000000) { /* Type starts with the (C) symbol, so the next 32 bits are * the language code, which we ignore */ offset = 12; GST_DEBUG_OBJECT (qtdemux, ""found international text tag""); } else { offset = 8; GST_DEBUG_OBJECT (qtdemux, ""found normal text tag""); } s = gst_tag_freeform_string_to_utf8 ((char *) node->data + offset, len - offset, env_vars); if (s) { GST_DEBUG_OBJECT (qtdemux, ""adding tag %s"", GST_STR_NULL (s)); gst_tag_list_add (qtdemux->tag_list, GST_TAG_MERGE_REPLACE, tag, s, NULL); g_free (s); } else { GST_DEBUG_OBJECT (qtdemux, ""failed to convert %s tag to UTF-8"", tag); } } } ",0 "GF_AVCConfig *gf_isom_svc_config_get(GF_ISOFile *the_file, u32 trackNumber, u32 DescriptionIndex) { GF_TrackBox *trak; GF_MPEGVisualSampleEntryBox *entry; trak = gf_isom_get_track_from_file(the_file, trackNumber); if (!trak || !trak->Media || !DescriptionIndex) return NULL; if (gf_isom_get_avc_svc_type(the_file, trackNumber, DescriptionIndex)==GF_ISOM_AVCTYPE_NONE) return NULL; entry = (GF_MPEGVisualSampleEntryBox*)gf_list_get(trak->Media->information->sampleTable->SampleDescription->other_boxes, DescriptionIndex-1); if (!entry) return NULL; if (!entry->svc_config) return NULL; return AVC_DuplicateConfig(entry->svc_config->config); } ",0 "void br_multicast_del_port(struct net_bridge_port *port) { del_timer_sync(&port->multicast_router_timer); } ",0 "static int rfcomm_sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, int flags) { struct sock *sk = sock->sk; struct rfcomm_dlc *d = rfcomm_pi(sk)->dlc; int len; if (test_and_clear_bit(RFCOMM_DEFER_SETUP, &d->flags)) { rfcomm_dlc_accept(d); return 0; } len = bt_sock_stream_recvmsg(sock, msg, size, flags); lock_sock(sk); if (!(flags & MSG_PEEK) && len > 0) atomic_sub(len, &sk->sk_rmem_alloc); if (atomic_read(&sk->sk_rmem_alloc) <= (sk->sk_rcvbuf >> 2)) rfcomm_dlc_unthrottle(rfcomm_pi(sk)->dlc); release_sock(sk); return len; } ",0 "static void brcmf_init_conf(struct brcmf_cfg80211_conf *conf) { conf->frag_threshold = (u32)-1; conf->rts_threshold = (u32)-1; conf->retry_short = (u32)-1; conf->retry_long = (u32)-1; } ",0 "void ScreenRecorder::DoStopOnEncodeThread(const base::Closure& done_task) { DCHECK_EQ(encode_loop_, MessageLoop::current()); encoder_stopped_ = true; capture_loop_->PostTask(FROM_HERE, done_task); } ",0 "void GLES2DecoderImpl::RemoveBuffer(GLuint client_id) { buffer_manager()->RemoveBuffer(client_id); } ",0 "archive_read_set_open_callback(struct archive *_a, archive_open_callback *client_opener) { struct archive_read *a = (struct archive_read *)_a; archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_NEW, ""archive_read_set_open_callback""); a->client.opener = client_opener; return ARCHIVE_OK; } ",0 "static uint64_t cirrus_vga_ioport_read(void *opaque, hwaddr addr, unsigned size) { CirrusVGAState *c = opaque; VGACommonState *s = &c->vga; int val, index; addr += 0x3b0; if (vga_ioport_invalid(s, addr)) { val = 0xff; } else { switch (addr) { case 0x3c0: if (s->ar_flip_flop == 0) { val = s->ar_index; } else { val = 0; } break; case 0x3c1: index = s->ar_index & 0x1f; if (index < 21) val = s->ar[index]; else val = 0; break; case 0x3c2: val = s->st00; break; case 0x3c4: val = s->sr_index; break; case 0x3c5: val = cirrus_vga_read_sr(c); break; #ifdef DEBUG_VGA_REG printf(""vga: read SR%x = 0x%02x\n"", s->sr_index, val); #endif break; case 0x3c6: val = cirrus_read_hidden_dac(c); break; case 0x3c7: val = s->dac_state; break; case 0x3c8: val = s->dac_write_index; c->cirrus_hidden_dac_lockindex = 0; break; case 0x3c9: val = cirrus_vga_read_palette(c); break; case 0x3ca: val = s->fcr; break; case 0x3cc: val = s->msr; break; case 0x3ce: val = s->gr_index; break; case 0x3cf: val = cirrus_vga_read_gr(c, s->gr_index); #ifdef DEBUG_VGA_REG printf(""vga: read GR%x = 0x%02x\n"", s->gr_index, val); #endif break; case 0x3b4: case 0x3d4: val = s->cr_index; break; case 0x3b5: case 0x3d5: val = cirrus_vga_read_cr(c, s->cr_index); #ifdef DEBUG_VGA_REG printf(""vga: read CR%x = 0x%02x\n"", s->cr_index, val); #endif break; case 0x3ba: case 0x3da: /* just toggle to fool polling */ val = s->st01 = s->retrace(s); s->ar_flip_flop = 0; break; default: val = 0x00; break; } } #if defined(DEBUG_VGA) printf(""VGA: read addr=0x%04x data=0x%02x\n"", addr, val); #endif return val; } ",0 "static int alloc_retstack_tasklist(struct ftrace_ret_stack **ret_stack_list) { int i; int ret = 0; unsigned long flags; int start = 0, end = FTRACE_RETSTACK_ALLOC_SIZE; struct task_struct *g, *t; for (i = 0; i < FTRACE_RETSTACK_ALLOC_SIZE; i++) { ret_stack_list[i] = kmalloc(FTRACE_RETFUNC_DEPTH * sizeof(struct ftrace_ret_stack), GFP_KERNEL); if (!ret_stack_list[i]) { start = 0; end = i; ret = -ENOMEM; goto free; } } read_lock_irqsave(&tasklist_lock, flags); do_each_thread(g, t) { if (start == end) { ret = -EAGAIN; goto unlock; } if (t->ret_stack == NULL) { atomic_set(&t->tracing_graph_pause, 0); atomic_set(&t->trace_overrun, 0); t->curr_ret_stack = -1; /* Make sure the tasks see the -1 first: */ smp_wmb(); t->ret_stack = ret_stack_list[start++]; } } while_each_thread(g, t); unlock: read_unlock_irqrestore(&tasklist_lock, flags); free: for (i = start; i < end; i++) kfree(ret_stack_list[i]); return ret; } ",0 " virtual ~CodecObserver() {} ",0 "long tg_get_cfs_quota(struct task_group *tg) { u64 quota_us; if (tg->cfs_bandwidth.quota == RUNTIME_INF) return -1; quota_us = tg->cfs_bandwidth.quota; do_div(quota_us, NSEC_PER_USEC); return quota_us; } ",0 "void SystemClipboard::WritePlainText(const String& plain_text, SmartReplaceOption) { String text = plain_text; #if defined(OS_WIN) ReplaceNewlinesWithWindowsStyleNewlines(text); #endif clipboard_->WriteText(mojom::ClipboardBuffer::kStandard, NonNullString(text)); clipboard_->CommitWrite(mojom::ClipboardBuffer::kStandard); } ",0 "static void __dm_destroy(struct mapped_device *md, bool wait) { struct request_queue *q = dm_get_md_queue(md); struct dm_table *map; int srcu_idx; might_sleep(); spin_lock(&_minor_lock); idr_replace(&_minor_idr, MINOR_ALLOCED, MINOR(disk_devt(dm_disk(md)))); set_bit(DMF_FREEING, &md->flags); spin_unlock(&_minor_lock); blk_set_queue_dying(q); if (dm_request_based(md) && md->kworker_task) kthread_flush_worker(&md->kworker); /* * Take suspend_lock so that presuspend and postsuspend methods * do not race with internal suspend. */ mutex_lock(&md->suspend_lock); map = dm_get_live_table(md, &srcu_idx); if (!dm_suspended_md(md)) { dm_table_presuspend_targets(map); dm_table_postsuspend_targets(map); } /* dm_put_live_table must be before msleep, otherwise deadlock is possible */ dm_put_live_table(md, srcu_idx); mutex_unlock(&md->suspend_lock); /* * Rare, but there may be I/O requests still going to complete, * for example. Wait for all references to disappear. * No one should increment the reference count of the mapped_device, * after the mapped_device state becomes DMF_FREEING. */ if (wait) while (atomic_read(&md->holders)) msleep(1); else if (atomic_read(&md->holders)) DMWARN(""%s: Forcibly removing mapped_device still in use! (%d users)"", dm_device_name(md), atomic_read(&md->holders)); dm_sysfs_exit(md); dm_table_destroy(__unbind(md)); free_dev(md); } ",0 "bool AppCacheDatabase::RunCachedStatementWithIds( sql::StatementID statement_id, const char* sql, const std::vector& ids) { DCHECK(sql); if (!LazyOpen(kCreateIfNeeded)) return false; sql::Transaction transaction(db_.get()); if (!transaction.Begin()) return false; sql::Statement statement(db_->GetCachedStatement(statement_id, sql)); for (const auto& id : ids) { statement.BindInt64(0, id); if (!statement.Run()) return false; statement.Reset(true); } return transaction.Commit(); } ",0 "void shutdown() { if (Platform::current()->currentThread()) { delete s_endOfTaskRunner; s_endOfTaskRunner = 0; } ASSERT(s_isolateInterruptor); ThreadState::current()->removeInterruptor(s_isolateInterruptor); if (Platform::current()->currentThread()) { ASSERT(s_pendingGCRunner); delete s_pendingGCRunner; s_pendingGCRunner = 0; ASSERT(s_messageLoopInterruptor); ThreadState::current()->removeInterruptor(s_messageLoopInterruptor); delete s_messageLoopInterruptor; s_messageLoopInterruptor = 0; } ScriptStreamerThread::shutdown(); v8::Isolate* isolate = V8PerIsolateData::mainThreadIsolate(); V8PerIsolateData::willBeDestroyed(isolate); WorkerThread::terminateAndWaitForAllWorkers(); ModulesInitializer::terminateThreads(); ThreadState::detachMainThread(); V8PerIsolateData::destroy(isolate); shutdownWithoutV8(); } ",0 " LRUCanvasResourceProviderCache(wtf_size_t capacity) : resource_providers_(capacity) {} ",0 "static void megasas_reset_frames(MegasasState *s) { int i; MegasasCmd *cmd; for (i = 0; i < s->fw_cmds; i++) { cmd = &s->frames[i]; if (cmd->pa) { megasas_unmap_frame(s, cmd); } } bitmap_zero(s->frame_map, MEGASAS_MAX_FRAMES); } ",0 "ofputil_port_stats_from_ofp11(struct ofputil_port_stats *ops, const struct ofp11_port_stats *ps11) { enum ofperr error; error = ofputil_port_from_ofp11(ps11->port_no, &ops->port_no); if (error) { return error; } ops->stats.rx_packets = ntohll(ps11->rx_packets); ops->stats.tx_packets = ntohll(ps11->tx_packets); ops->stats.rx_bytes = ntohll(ps11->rx_bytes); ops->stats.tx_bytes = ntohll(ps11->tx_bytes); ops->stats.rx_dropped = ntohll(ps11->rx_dropped); ops->stats.tx_dropped = ntohll(ps11->tx_dropped); ops->stats.rx_errors = ntohll(ps11->rx_errors); ops->stats.tx_errors = ntohll(ps11->tx_errors); ops->stats.rx_frame_errors = ntohll(ps11->rx_frame_err); ops->stats.rx_over_errors = ntohll(ps11->rx_over_err); ops->stats.rx_crc_errors = ntohll(ps11->rx_crc_err); ops->stats.collisions = ntohll(ps11->collisions); ops->duration_sec = ops->duration_nsec = UINT32_MAX; return 0; } ",0 "void FrameLoader::scrollToFragmentWithParentBoundary(const KURL& url) { FrameView* view = m_frame->view(); if (!view) return; RefPtr boundaryFrame(url.hasFragmentIdentifier() ? m_frame->document()->findUnsafeParentScrollPropagationBoundary() : 0); if (boundaryFrame) boundaryFrame->view()->setSafeToPropagateScrollToParent(false); view->scrollToFragment(url); if (boundaryFrame) boundaryFrame->view()->setSafeToPropagateScrollToParent(true); } ",0 " aura::Window* CreatePanelWindow(const gfx::Point& origin) { gfx::Rect bounds(origin, gfx::Size(101, 101)); aura::Window* window = CreateTestWindowInShellWithDelegateAndType( NULL, aura::client::WINDOW_TYPE_PANEL, 0, bounds); static int id = 0; std::string shelf_id(ash::ShelfID(base::IntToString(id++)).Serialize()); window->SetProperty(kShelfIDKey, new std::string(shelf_id)); window->SetProperty(kShelfItemTypeKey, TYPE_APP_PANEL); shelf_view_test_->RunMessageLoopUntilAnimationsDone(); return window; } ",0 "static void mipspmu_stop(struct perf_event *event, int flags) { struct hw_perf_event *hwc = &event->hw; if (!mipspmu) return; if (!(hwc->state & PERF_HES_STOPPED)) { /* We are working on a local event. */ mipspmu->disable_event(hwc->idx); barrier(); mipspmu_event_update(event, hwc, hwc->idx); hwc->state |= PERF_HES_STOPPED | PERF_HES_UPTODATE; } } ",0 "static ut64 java_get_method_start () { return METHOD_START; } ",0 "int kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu, struct kvm_mp_state *mp_state) { return -EINVAL; } ",0 "static int __begin_wqe(struct mlx5_ib_qp *qp, void **seg, struct mlx5_wqe_ctrl_seg **ctrl, const struct ib_send_wr *wr, unsigned *idx, int *size, int nreq, bool send_signaled, bool solicited) { if (unlikely(mlx5_wq_overflow(&qp->sq, nreq, qp->ibqp.send_cq))) return -ENOMEM; *idx = qp->sq.cur_post & (qp->sq.wqe_cnt - 1); *seg = mlx5_get_send_wqe(qp, *idx); *ctrl = *seg; *(uint32_t *)(*seg + 8) = 0; (*ctrl)->imm = send_ieth(wr); (*ctrl)->fm_ce_se = qp->sq_signal_bits | (send_signaled ? MLX5_WQE_CTRL_CQ_UPDATE : 0) | (solicited ? MLX5_WQE_CTRL_SOLICITED : 0); *seg += sizeof(**ctrl); *size = sizeof(**ctrl) / 16; return 0; } ",0 "static void intrinsicLatencyModeStop(int s) { UNUSED(s); force_cancel_loop = 1; } ",0 "static void megasas_mmio_write(void *opaque, hwaddr addr, uint64_t val, unsigned size) { MegasasState *s = opaque; PCIDevice *pci_dev = PCI_DEVICE(s); uint64_t frame_addr; uint32_t frame_count; int i; switch (addr) { case MFI_IDB: trace_megasas_mmio_writel(""MFI_IDB"", val); if (val & MFI_FWINIT_ABORT) { /* Abort all pending cmds */ for (i = 0; i < s->fw_cmds; i++) { megasas_abort_command(&s->frames[i]); } } if (val & MFI_FWINIT_READY) { /* move to FW READY */ megasas_soft_reset(s); } if (val & MFI_FWINIT_MFIMODE) { /* discard MFIs */ } if (val & MFI_FWINIT_STOP_ADP) { /* Terminal error, stop processing */ s->fw_state = MFI_FWSTATE_FAULT; } break; case MFI_OMSK: trace_megasas_mmio_writel(""MFI_OMSK"", val); s->intr_mask = val; if (!megasas_intr_enabled(s) && !msi_enabled(pci_dev) && !msix_enabled(pci_dev)) { trace_megasas_irq_lower(); pci_irq_deassert(pci_dev); } if (megasas_intr_enabled(s)) { if (msix_enabled(pci_dev)) { trace_megasas_msix_enabled(0); } else if (msi_enabled(pci_dev)) { trace_megasas_msi_enabled(0); } else { trace_megasas_intr_enabled(); } } else { trace_megasas_intr_disabled(); megasas_soft_reset(s); } break; case MFI_ODCR0: trace_megasas_mmio_writel(""MFI_ODCR0"", val); s->doorbell = 0; if (megasas_intr_enabled(s)) { if (!msix_enabled(pci_dev) && !msi_enabled(pci_dev)) { trace_megasas_irq_lower(); pci_irq_deassert(pci_dev); } } break; case MFI_IQPH: trace_megasas_mmio_writel(""MFI_IQPH"", val); /* Received high 32 bits of a 64 bit MFI frame address */ s->frame_hi = val; break; case MFI_IQPL: trace_megasas_mmio_writel(""MFI_IQPL"", val); /* Received low 32 bits of a 64 bit MFI frame address */ /* Fallthrough */ case MFI_IQP: if (addr == MFI_IQP) { trace_megasas_mmio_writel(""MFI_IQP"", val); /* Received 64 bit MFI frame address */ s->frame_hi = 0; } frame_addr = (val & ~0x1F); /* Add possible 64 bit offset */ frame_addr |= ((uint64_t)s->frame_hi << 32); s->frame_hi = 0; frame_count = (val >> 1) & 0xF; megasas_handle_frame(s, frame_addr, frame_count); break; case MFI_SEQ: trace_megasas_mmio_writel(""MFI_SEQ"", val); /* Magic sequence to start ADP reset */ if (adp_reset_seq[s->adp_reset] == val) { s->adp_reset++; } else { s->adp_reset = 0; s->diag = 0; } if (s->adp_reset == 6) { s->diag = MFI_DIAG_WRITE_ENABLE; } break; case MFI_DIAG: trace_megasas_mmio_writel(""MFI_DIAG"", val); /* ADP reset */ if ((s->diag & MFI_DIAG_WRITE_ENABLE) && (val & MFI_DIAG_RESET_ADP)) { s->diag |= MFI_DIAG_RESET_ADP; megasas_soft_reset(s); s->adp_reset = 0; s->diag = 0; } break; default: trace_megasas_mmio_invalid_writel(addr, val); break; } } ",0 "void V8TestObject::NameAttributeSetterCallback( const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_name_Setter""); v8::Local v8_value = info[0]; test_object_v8_internal::NameAttributeSetter(v8_value, info); } ",0 "void WebPage::download(const Platform::NetworkRequest& request) { vector headers; Platform::NetworkRequest::HeaderList& list = request.getHeaderListRef(); for (unsigned i = 0; i < list.size(); i++) { headers.push_back(list[i].first.c_str()); headers.push_back(list[i].second.c_str()); } d->load(request.getUrlRef(), BlackBerry::Platform::String::emptyString(), ""GET"", Platform::NetworkRequest::UseProtocolCachePolicy, 0, 0, headers.empty() ? 0 : &headers[0], headers.size(), false, false, true, """", request.getSuggestedSaveName().c_str()); } ",0 "void V8TestObject::HighEntropyConstantConstantGetterCallback(v8::Local, const v8::PropertyCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_highEntropyConstant_ConstantGetter""); ExecutionContext* execution_context_for_measurement = CurrentExecutionContext(info.GetIsolate()); UseCounter::Count(execution_context_for_measurement, WebFeature::kTestFeatureHighEntropyConstant); Dactyloscoper::Record(execution_context_for_measurement, WebFeature::kTestFeatureHighEntropyConstant); V8SetReturnValueString(info, ""1""); } ",0 "mrb_mruby_fiber_gem_final(mrb_state* mrb) { } ",0 "void DataReductionProxyIOData::StoreSerializedConfig( const std::string& serialized_config) { DCHECK(io_task_runner_->BelongsToCurrentThread()); SetStringPref(prefs::kDataReductionProxyConfig, serialized_config); SetInt64Pref(prefs::kDataReductionProxyLastConfigRetrievalTime, (base::Time::Now() - base::Time()).InMicroseconds()); } ",0 "static bool atl2_spi_read(struct atl2_hw *hw, u32 addr, u32 *buf) { int i; u32 value; ATL2_WRITE_REG(hw, REG_SPI_DATA, 0); ATL2_WRITE_REG(hw, REG_SPI_ADDR, addr); value = SPI_FLASH_CTRL_WAIT_READY | (CUSTOM_SPI_CS_SETUP & SPI_FLASH_CTRL_CS_SETUP_MASK) << SPI_FLASH_CTRL_CS_SETUP_SHIFT | (CUSTOM_SPI_CLK_HI & SPI_FLASH_CTRL_CLK_HI_MASK) << SPI_FLASH_CTRL_CLK_HI_SHIFT | (CUSTOM_SPI_CLK_LO & SPI_FLASH_CTRL_CLK_LO_MASK) << SPI_FLASH_CTRL_CLK_LO_SHIFT | (CUSTOM_SPI_CS_HOLD & SPI_FLASH_CTRL_CS_HOLD_MASK) << SPI_FLASH_CTRL_CS_HOLD_SHIFT | (CUSTOM_SPI_CS_HI & SPI_FLASH_CTRL_CS_HI_MASK) << SPI_FLASH_CTRL_CS_HI_SHIFT | (0x1 & SPI_FLASH_CTRL_INS_MASK) << SPI_FLASH_CTRL_INS_SHIFT; ATL2_WRITE_REG(hw, REG_SPI_FLASH_CTRL, value); value |= SPI_FLASH_CTRL_START; ATL2_WRITE_REG(hw, REG_SPI_FLASH_CTRL, value); for (i = 0; i < 10; i++) { msleep(1); value = ATL2_READ_REG(hw, REG_SPI_FLASH_CTRL); if (!(value & SPI_FLASH_CTRL_START)) break; } if (value & SPI_FLASH_CTRL_START) return false; *buf = ATL2_READ_REG(hw, REG_SPI_DATA); return true; } ",0 "static void activityLoggedInIsolatedWorldMethodMethodCallbackForMainWorld(const v8::FunctionCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMMethod""); TestObjectV8Internal::activityLoggedInIsolatedWorldMethodMethodForMainWorld(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "SoftAVC::SoftAVC( const char *name, const OMX_CALLBACKTYPE *callbacks, OMX_PTR appData, OMX_COMPONENTTYPE **component) : SoftVideoDecoderOMXComponent( name, componentName, codingType, kProfileLevels, ARRAY_SIZE(kProfileLevels), 320 /* width */, 240 /* height */, callbacks, appData, component), mCodecCtx(NULL), mFlushOutBuffer(NULL), mOmxColorFormat(OMX_COLOR_FormatYUV420Planar), mIvColorFormat(IV_YUV_420P), mChangingResolution(false), mSignalledError(false), mStride(mWidth){ initPorts( kNumBuffers, INPUT_BUF_SIZE, kNumBuffers, CODEC_MIME_TYPE); GETTIME(&mTimeStart, NULL); GENERATE_FILE_NAMES(); CREATE_DUMP_FILE(mInFile); } ",0 "void GpuVideoDecodeAccelerator::NotifyFlushDone() { if (!Send(new AcceleratedVideoDecoderHostMsg_FlushDone(host_route_id_))) DLOG(ERROR) << ""Send(AcceleratedVideoDecoderHostMsg_FlushDone) failed""; } ",0 "static int mov_auto_flush_fragment(AVFormatContext *s, int force) { MOVMuxContext *mov = s->priv_data; int had_moov = mov->moov_written; int ret = mov_flush_fragment(s, force); if (ret < 0) return ret; if (!had_moov && mov->flags & FF_MOV_FLAG_DELAY_MOOV) ret = mov_flush_fragment(s, force); return ret; } ",0 "bool ScriptLoader::ignoresLoadRequest() const { return m_alreadyStarted || m_isExternalScript || m_parserInserted || !element() || !element()->inDocument(); } ",0 "stringprep_4zi (uint32_t * ucs4, size_t maxucs4len, Stringprep_profile_flags flags, const Stringprep_profile * profile) { size_t ucs4len; for (ucs4len = 0; ucs4len < maxucs4len && ucs4[ucs4len] != 0; ucs4len++) ; return stringprep_4zi_1 (ucs4, ucs4len, maxucs4len, flags, profile); } ",0 " void ActivateViewForTextInputManager(RenderWidgetHostViewBase* view, ui::TextInputType type) { DCHECK_NE(ui::TEXT_INPUT_TYPE_NONE, type); if (render_widget_host_delegate()->GetFocusedRenderWidgetHost( widget_host_) != view->GetRenderWidgetHost()) { render_widget_host_delegate()->set_focused_widget(view->host()); } TextInputManager* manager = static_cast(view->GetRenderWidgetHost()) ->delegate() ->GetTextInputManager(); if (manager->GetActiveWidget()) { manager->active_view_for_testing()->TextInputStateChanged( TextInputState()); } if (!view) return; TextInputState state_with_type_text; state_with_type_text.type = type; view->TextInputStateChanged(state_with_type_text); } ",0 "static void xen_netbk_tx_submit(struct xen_netbk *netbk) { struct gnttab_copy *gop = netbk->tx_copy_ops; struct sk_buff *skb; while ((skb = __skb_dequeue(&netbk->tx_queue)) != NULL) { struct xen_netif_tx_request *txp; struct xenvif *vif; u16 pending_idx; unsigned data_len; pending_idx = *((u16 *)skb->data); vif = netbk->pending_tx_info[pending_idx].vif; txp = &netbk->pending_tx_info[pending_idx].req; /* Check the remap error code. */ if (unlikely(xen_netbk_tx_check_gop(netbk, skb, &gop))) { netdev_dbg(vif->dev, ""netback grant failed.\n""); skb_shinfo(skb)->nr_frags = 0; kfree_skb(skb); continue; } data_len = skb->len; memcpy(skb->data, (void *)(idx_to_kaddr(netbk, pending_idx)|txp->offset), data_len); if (data_len < txp->size) { /* Append the packet payload as a fragment. */ txp->offset += data_len; txp->size -= data_len; } else { /* Schedule a response immediately. */ xen_netbk_idx_release(netbk, pending_idx); } if (txp->flags & XEN_NETTXF_csum_blank) skb->ip_summed = CHECKSUM_PARTIAL; else if (txp->flags & XEN_NETTXF_data_validated) skb->ip_summed = CHECKSUM_UNNECESSARY; xen_netbk_fill_frags(netbk, skb); /* * If the initial fragment was < PKT_PROT_LEN then * pull through some bytes from the other fragments to * increase the linear region to PKT_PROT_LEN bytes. */ if (skb_headlen(skb) < PKT_PROT_LEN && skb_is_nonlinear(skb)) { int target = min_t(int, skb->len, PKT_PROT_LEN); __pskb_pull_tail(skb, target - skb_headlen(skb)); } skb->dev = vif->dev; skb->protocol = eth_type_trans(skb, skb->dev); if (checksum_setup(vif, skb)) { netdev_dbg(vif->dev, ""Can't setup checksum in net_tx_action\n""); kfree_skb(skb); continue; } vif->dev->stats.rx_bytes += skb->len; vif->dev->stats.rx_packets++; xenvif_receive_skb(vif, skb); } } ",0 "void ManifestManager::DidCommitProvisionalLoad( bool is_new_navigation, bool is_same_document_navigation) { if (is_same_document_navigation) return; may_have_manifest_ = false; manifest_dirty_ = true; manifest_url_ = GURL(); } ",0 "const void* MaybeFixupFunctionAddressForILT(const void* function_address) { #if defined(_WIN64) const unsigned char* opcode = reinterpret_cast(function_address); if (*opcode == 0xe9) { const int32* offset = reinterpret_cast(opcode + 1); const unsigned char* next_instruction = reinterpret_cast(offset + 1); return next_instruction + *offset; } #endif return function_address; } ",0 "static int nr_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t size, int flags) { struct sock *sk = sock->sk; struct sockaddr_ax25 *sax = (struct sockaddr_ax25 *)msg->msg_name; size_t copied; struct sk_buff *skb; int er; /* * This works for seqpacket too. The receiver has ordered the queue for * us! We do one quick check first though */ lock_sock(sk); if (sk->sk_state != TCP_ESTABLISHED) { release_sock(sk); return -ENOTCONN; } /* Now we can treat all alike */ if ((skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, flags & MSG_DONTWAIT, &er)) == NULL) { release_sock(sk); return er; } skb_reset_transport_header(skb); copied = skb->len; if (copied > size) { copied = size; msg->msg_flags |= MSG_TRUNC; } er = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied); if (er < 0) { skb_free_datagram(sk, skb); release_sock(sk); return er; } if (sax != NULL) { sax->sax25_family = AF_NETROM; skb_copy_from_linear_data_offset(skb, 7, sax->sax25_call.ax25_call, AX25_ADDR_LEN); } msg->msg_namelen = sizeof(*sax); skb_free_datagram(sk, skb); release_sock(sk); return copied; } ",1 "void copy_huge_page(struct page *dst, struct page *src) { int i; struct hstate *h = page_hstate(src); if (unlikely(pages_per_huge_page(h) > MAX_ORDER_NR_PAGES)) { copy_gigantic_page(dst, src); return; } might_sleep(); for (i = 0; i < pages_per_huge_page(h); i++) { cond_resched(); copy_highpage(dst + i, src + i); } } ",0 "bool ChromeDownloadManagerDelegate::ShouldOpenFileBasedOnExtension( const FilePath& path) { FilePath::StringType extension = path.Extension(); if (extension.empty()) return false; if (extensions::Extension::IsExtension(path)) return false; DCHECK(extension[0] == FilePath::kExtensionSeparator); extension.erase(0, 1); return download_prefs_->IsAutoOpenEnabledForExtension(extension); } ",0 "static void inv_predict_1(uint8_t *p, const uint8_t *p_l, const uint8_t *p_tl, const uint8_t *p_t, const uint8_t *p_tr) { AV_COPY32(p, p_l); } ",0 "static int encode_lock(struct xdr_stream *xdr, const struct nfs_lock_args *args) { __be32 *p; RESERVE_SPACE(32); WRITE32(OP_LOCK); WRITE32(nfs4_lock_type(args->fl, args->block)); WRITE32(args->reclaim); WRITE64(args->fl->fl_start); WRITE64(nfs4_lock_length(args->fl)); WRITE32(args->new_lock_owner); if (args->new_lock_owner){ RESERVE_SPACE(4+NFS4_STATEID_SIZE+32); WRITE32(args->open_seqid->sequence->counter); WRITEMEM(args->open_stateid->data, NFS4_STATEID_SIZE); WRITE32(args->lock_seqid->sequence->counter); WRITE64(args->lock_owner.clientid); WRITE32(16); WRITEMEM(""lock id:"", 8); WRITE64(args->lock_owner.id); } else { RESERVE_SPACE(NFS4_STATEID_SIZE+4); WRITEMEM(args->lock_stateid->data, NFS4_STATEID_SIZE); WRITE32(args->lock_seqid->sequence->counter); } return 0; } ",0 "mii_set_media (struct net_device *dev) { __u16 pscr; __u16 bmcr; __u16 bmsr; __u16 anar; int phy_addr; struct netdev_private *np; np = netdev_priv(dev); phy_addr = np->phy_addr; /* Does user set speed? */ if (np->an_enable) { /* Advertise capabilities */ bmsr = mii_read (dev, phy_addr, MII_BMSR); anar = mii_read (dev, phy_addr, MII_ADVERTISE) & ~(ADVERTISE_100FULL | ADVERTISE_10FULL | ADVERTISE_100HALF | ADVERTISE_10HALF | ADVERTISE_100BASE4); if (bmsr & BMSR_100FULL) anar |= ADVERTISE_100FULL; if (bmsr & BMSR_100HALF) anar |= ADVERTISE_100HALF; if (bmsr & BMSR_100BASE4) anar |= ADVERTISE_100BASE4; if (bmsr & BMSR_10FULL) anar |= ADVERTISE_10FULL; if (bmsr & BMSR_10HALF) anar |= ADVERTISE_10HALF; anar |= ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM; mii_write (dev, phy_addr, MII_ADVERTISE, anar); /* Enable Auto crossover */ pscr = mii_read (dev, phy_addr, MII_PHY_SCR); pscr |= 3 << 5; /* 11'b */ mii_write (dev, phy_addr, MII_PHY_SCR, pscr); /* Soft reset PHY */ mii_write (dev, phy_addr, MII_BMCR, BMCR_RESET); bmcr = BMCR_ANENABLE | BMCR_ANRESTART | BMCR_RESET; mii_write (dev, phy_addr, MII_BMCR, bmcr); mdelay(1); } else { /* Force speed setting */ /* 1) Disable Auto crossover */ pscr = mii_read (dev, phy_addr, MII_PHY_SCR); pscr &= ~(3 << 5); mii_write (dev, phy_addr, MII_PHY_SCR, pscr); /* 2) PHY Reset */ bmcr = mii_read (dev, phy_addr, MII_BMCR); bmcr |= BMCR_RESET; mii_write (dev, phy_addr, MII_BMCR, bmcr); /* 3) Power Down */ bmcr = 0x1940; /* must be 0x1940 */ mii_write (dev, phy_addr, MII_BMCR, bmcr); mdelay (100); /* wait a certain time */ /* 4) Advertise nothing */ mii_write (dev, phy_addr, MII_ADVERTISE, 0); /* 5) Set media and Power Up */ bmcr = BMCR_PDOWN; if (np->speed == 100) { bmcr |= BMCR_SPEED100; printk (KERN_INFO ""Manual 100 Mbps, ""); } else if (np->speed == 10) { printk (KERN_INFO ""Manual 10 Mbps, ""); } if (np->full_duplex) { bmcr |= BMCR_FULLDPLX; printk (KERN_CONT ""Full duplex\n""); } else { printk (KERN_CONT ""Half duplex\n""); } #if 0 /* Set 1000BaseT Master/Slave setting */ mscr = mii_read (dev, phy_addr, MII_CTRL1000); mscr |= MII_MSCR_CFG_ENABLE; mscr &= ~MII_MSCR_CFG_VALUE = 0; #endif mii_write (dev, phy_addr, MII_BMCR, bmcr); mdelay(10); } return 0; } ",0 "void FileReaderLoader::OnStartLoading(uint64_t total_bytes) { total_bytes_ = total_bytes; DCHECK(!raw_data_); if (read_type_ != kReadByClient) { if (total_bytes > std::numeric_limits::max()) { Failed(FileError::kNotReadableErr); return; } raw_data_ = std::make_unique(total_bytes); if (!raw_data_->IsValid()) { Failed(FileError::kNotReadableErr); return; } raw_data_->SetVariableCapacity(false); } if (client_) client_->DidStartLoading(); } ",0 "int sctp_v6_protosw_init(void) { int rc; rc = proto_register(&sctpv6_prot, 1); if (rc) return rc; /* Add SCTPv6(UDP and TCP style) to inetsw6 linked list. */ inet6_register_protosw(&sctpv6_seqpacket_protosw); inet6_register_protosw(&sctpv6_stream_protosw); return 0; } ",0 "void HTMLInputElement::SetNonAttributeValue(const String& sanitized_value) { DCHECK_EQ(input_type_->GetValueMode(), ValueMode::kValue); non_attribute_value_ = sanitized_value; has_dirty_value_ = true; SetNeedsValidityCheck(); input_type_->InRangeChanged(); } ",0 "BaseShadow::terminateJob( update_style_t kind ) // has a default argument of US_NORMAL { int reason; bool signaled; MyString str; if( ! jobAd ) { dprintf( D_ALWAYS, ""In terminateJob() w/ NULL JobAd!"" ); } /* The first thing we do is record that we are in a termination pending state. */ if (kind == US_NORMAL) { str.sprintf(""%s = TRUE"", ATTR_TERMINATION_PENDING); jobAd->Insert(str.Value()); } if (kind == US_TERMINATE_PENDING) { int exited_by_signal = FALSE; int exit_signal = 0; int exit_code = 0; getJobAdExitedBySignal(jobAd, exited_by_signal); if (exited_by_signal == TRUE) { getJobAdExitSignal(jobAd, exit_signal); } else { getJobAdExitCode(jobAd, exit_code); } if (exited_by_signal == TRUE) { reason = JOB_COREDUMPED; str.sprintf(""%s = \""%s\"""", ATTR_JOB_CORE_FILENAME, core_file_name); jobAd->Insert(str.Value()); } else { reason = JOB_EXITED; } dprintf( D_ALWAYS, ""Job %d.%d terminated: %s %d\n"", getCluster(), getProc(), exited_by_signal? ""killed by signal"" : ""exited with status"", exited_by_signal ? exit_signal : exit_code ); logTerminateEvent( reason, kind ); emailTerminateEvent( reason, kind ); DC_Exit( reason ); } cleanUp(); reason = getExitReason(); signaled = exitedBySignal(); /* also store the corefilename into the jobad so we can recover this during a termination pending scenario. */ if( reason == JOB_COREDUMPED ) { str.sprintf(""%s = \""%s\"""", ATTR_JOB_CORE_FILENAME, getCoreName()); jobAd->Insert(str.Value()); } int last_ckpt_time = 0; jobAd->LookupInteger(ATTR_LAST_CKPT_TIME, last_ckpt_time); int current_start_time = 0; jobAd->LookupInteger(ATTR_JOB_CURRENT_START_DATE, current_start_time); int int_value = (last_ckpt_time > current_start_time) ? last_ckpt_time : current_start_time; if( int_value > 0 ) { int job_committed_time = 0; jobAd->LookupInteger(ATTR_JOB_COMMITTED_TIME, job_committed_time); int delta = (int)time(NULL) - int_value; job_committed_time += delta; jobAd->Assign(ATTR_JOB_COMMITTED_TIME, job_committed_time); float slot_weight = 1; jobAd->LookupFloat(ATTR_JOB_MACHINE_ATTR_SLOT_WEIGHT0, slot_weight); float slot_time = 0; jobAd->LookupFloat(ATTR_COMMITTED_SLOT_TIME, slot_time); slot_time += slot_weight * delta; jobAd->Assign(ATTR_COMMITTED_SLOT_TIME, slot_time); } CommitSuspensionTime(jobAd); if (m_num_cleanup_retries < 1 && param_boolean(""SHADOW_TEST_JOB_CLEANUP_RETRY"", false)) { dprintf( D_ALWAYS, ""Testing Failure to perform final update to job queue!\n""); retryJobCleanup(); return; } if( !updateJobInQueue(U_TERMINATE) ) { dprintf( D_ALWAYS, ""Failed to perform final update to job queue!\n""); retryJobCleanup(); return; } dprintf( D_ALWAYS, ""Job %d.%d terminated: %s %d\n"", getCluster(), getProc(), signaled ? ""killed by signal"" : ""exited with status"", signaled ? exitSignal() : exitCode() ); logTerminateEvent( reason ); emailTerminateEvent( reason ); if( reason == JOB_EXITED && claimIsClosing() ) { dprintf(D_FULLDEBUG,""Startd is closing claim, so no more jobs can be run on it.\n""); reason = JOB_EXITED_AND_CLAIM_CLOSING; } if( recycleShadow(reason) ) { return; } DC_Exit( reason ); } ",0 "void btrfs_set_item_key_safe(struct btrfs_root *root, struct btrfs_path *path, struct btrfs_key *new_key) { struct btrfs_disk_key disk_key; struct extent_buffer *eb; int slot; eb = path->nodes[0]; slot = path->slots[0]; if (slot > 0) { btrfs_item_key(eb, &disk_key, slot - 1); BUG_ON(comp_keys(&disk_key, new_key) >= 0); } if (slot < btrfs_header_nritems(eb) - 1) { btrfs_item_key(eb, &disk_key, slot + 1); BUG_ON(comp_keys(&disk_key, new_key) <= 0); } btrfs_cpu_key_to_disk(&disk_key, new_key); btrfs_set_item_key(eb, &disk_key, slot); btrfs_mark_buffer_dirty(eb); if (slot == 0) fixup_low_keys(root, path, &disk_key, 1); } ",0 "static int skcipher_wait_for_wmem(struct sock *sk, unsigned flags) { long timeout; DEFINE_WAIT(wait); int err = -ERESTARTSYS; if (flags & MSG_DONTWAIT) return -EAGAIN; sk_set_bit(SOCKWQ_ASYNC_NOSPACE, sk); for (;;) { if (signal_pending(current)) break; prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); timeout = MAX_SCHEDULE_TIMEOUT; if (sk_wait_event(sk, &timeout, skcipher_writable(sk))) { err = 0; break; } } finish_wait(sk_sleep(sk), &wait); return err; } ",0 "void PrintPreviewHandler::OnTabDestroyed() { TabContents* initiator_tab = GetInitiatorTab(); if (!initiator_tab) return; initiator_tab->print_view_manager()->set_observer(NULL); } ",0 "bool DebuggerDetachFunction::RunAsync() { std::unique_ptr params(Detach::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); CopyDebuggee(&debuggee_, params->target); if (!InitClientHost()) return false; client_host_->RespondDetachedToPendingRequests(); client_host_->Close(); SendResponse(true); return true; } ",0 "void qib_cdev_cleanup(struct cdev **cdevp, struct device **devp) { struct device *device = *devp; if (device) { device_unregister(device); *devp = NULL; } if (*cdevp) { cdev_del(*cdevp); *cdevp = NULL; } } ",0 "static int mem_open(struct inode* inode, struct file* file) { file->private_data = (void*)((long)current->self_exec_id); return 0; } ",0 "relay_header_unpack(relay_header_t *dest, const uint8_t *src) { dest->command = get_uint8(src); dest->recognized = ntohs(get_uint16(src+1)); dest->stream_id = ntohs(get_uint16(src+3)); memcpy(dest->integrity, src+5, 4); dest->length = ntohs(get_uint16(src+9)); } ",0 "static int read_extra_header(FFV1Context *f) { RangeCoder *const c = &f->c; uint8_t state[CONTEXT_SIZE]; int i, j, k, ret; uint8_t state2[32][CONTEXT_SIZE]; memset(state2, 128, sizeof(state2)); memset(state, 128, sizeof(state)); ff_init_range_decoder(c, f->avctx->extradata, f->avctx->extradata_size); ff_build_rac_states(c, 0.05 * (1LL << 32), 256 - 8); f->version = get_symbol(c, state, 0); if (f->version < 2) { av_log(f->avctx, AV_LOG_ERROR, ""Invalid version in global header\n""); return AVERROR_INVALIDDATA; } if (f->version > 2) { c->bytestream_end -= 4; f->micro_version = get_symbol(c, state, 0); } f->ac = f->avctx->coder_type = get_symbol(c, state, 0); if (f->ac > 1) { for (i = 1; i < 256; i++) f->state_transition[i] = get_symbol(c, state, 1) + c->one_state[i]; } f->colorspace = get_symbol(c, state, 0); //YUV cs type f->avctx->bits_per_raw_sample = get_symbol(c, state, 0); f->chroma_planes = get_rac(c, state); f->chroma_h_shift = get_symbol(c, state, 0); f->chroma_v_shift = get_symbol(c, state, 0); f->transparency = get_rac(c, state); f->plane_count = 1 + (f->chroma_planes || f->version<4) + f->transparency; f->num_h_slices = 1 + get_symbol(c, state, 0); f->num_v_slices = 1 + get_symbol(c, state, 0); if (f->num_h_slices > (unsigned)f->width || !f->num_h_slices || f->num_v_slices > (unsigned)f->height || !f->num_v_slices ) { av_log(f->avctx, AV_LOG_ERROR, ""slice count invalid\n""); return AVERROR_INVALIDDATA; } f->quant_table_count = get_symbol(c, state, 0); if (f->quant_table_count > (unsigned)MAX_QUANT_TABLES) return AVERROR_INVALIDDATA; for (i = 0; i < f->quant_table_count; i++) { f->context_count[i] = read_quant_tables(c, f->quant_tables[i]); if (f->context_count[i] < 0) { av_log(f->avctx, AV_LOG_ERROR, ""read_quant_table error\n""); return AVERROR_INVALIDDATA; } } if ((ret = ffv1_allocate_initial_states(f)) < 0) return ret; for (i = 0; i < f->quant_table_count; i++) if (get_rac(c, state)) { for (j = 0; j < f->context_count[i]; j++) for (k = 0; k < CONTEXT_SIZE; k++) { int pred = j ? f->initial_states[i][j - 1][k] : 128; f->initial_states[i][j][k] = (pred + get_symbol(c, state2[k], 1)) & 0xFF; } } if (f->version > 2) { f->ec = get_symbol(c, state, 0); if (f->micro_version > 2) f->intra = get_symbol(c, state, 0); } if (f->version > 2) { unsigned v; v = av_crc(av_crc_get_table(AV_CRC_32_IEEE), 0, f->avctx->extradata, f->avctx->extradata_size); if (v) { av_log(f->avctx, AV_LOG_ERROR, ""CRC mismatch %X!\n"", v); return AVERROR_INVALIDDATA; } } if (f->avctx->debug & FF_DEBUG_PICT_INFO) av_log(f->avctx, AV_LOG_DEBUG, ""global: ver:%d.%d, coder:%d, colorspace: %d bpr:%d chroma:%d(%d:%d), alpha:%d slices:%dx%d qtabs:%d ec:%d intra:%d\n"", f->version, f->micro_version, f->ac, f->colorspace, f->avctx->bits_per_raw_sample, f->chroma_planes, f->chroma_h_shift, f->chroma_v_shift, f->transparency, f->num_h_slices, f->num_v_slices, f->quant_table_count, f->ec, f->intra ); return 0; } ",0 "static int common_perm_create(int op, struct path *dir, struct dentry *dentry, u32 mask, umode_t mode) { struct path_cond cond = { current_fsuid(), mode }; if (!dir->mnt || !mediated_filesystem(dir->dentry->d_inode)) return 0; return common_perm_dir_dentry(op, dir, dentry, mask, &cond); } ",0 "static int output_open(h2_stream *stream) { switch (stream->state) { case H2_STREAM_ST_OPEN: case H2_STREAM_ST_CLOSED_INPUT: return 1; default: return 0; } } ",0 "double AccessibilityUIElement::clickPointY() { return 0.0f; } ",0 "int ext4_calculate_overhead(struct super_block *sb) { struct ext4_sb_info *sbi = EXT4_SB(sb); struct ext4_super_block *es = sbi->s_es; struct inode *j_inode; unsigned int j_blocks, j_inum = le32_to_cpu(es->s_journal_inum); ext4_group_t i, ngroups = ext4_get_groups_count(sb); ext4_fsblk_t overhead = 0; char *buf = (char *) get_zeroed_page(GFP_NOFS); if (!buf) return -ENOMEM; /* * Compute the overhead (FS structures). This is constant * for a given filesystem unless the number of block groups * changes so we cache the previous value until it does. */ /* * All of the blocks before first_data_block are overhead */ overhead = EXT4_B2C(sbi, le32_to_cpu(es->s_first_data_block)); /* * Add the overhead found in each block group */ for (i = 0; i < ngroups; i++) { int blks; blks = count_overhead(sb, i, buf); overhead += blks; if (blks) memset(buf, 0, PAGE_SIZE); cond_resched(); } /* * Add the internal journal blocks whether the journal has been * loaded or not */ if (sbi->s_journal && !sbi->journal_bdev) overhead += EXT4_NUM_B2C(sbi, sbi->s_journal->j_maxlen); else if (ext4_has_feature_journal(sb) && !sbi->s_journal) { j_inode = ext4_get_journal_inode(sb, j_inum); if (j_inode) { j_blocks = j_inode->i_size >> sb->s_blocksize_bits; overhead += EXT4_NUM_B2C(sbi, j_blocks); iput(j_inode); } else { ext4_msg(sb, KERN_ERR, ""can't get journal size""); } } sbi->s_overhead = overhead; smp_wmb(); free_page((unsigned long) buf); return 0; } ",0 " void PrintPreviewUI::OnCancelPendingPreviewRequest() { g_print_preview_request_id_map.Get().Set(preview_ui_addr_str_, -1); } ",1 "__be32 *xdr_encode_opaque(__be32 *p, const void *ptr, unsigned int nbytes) { *p++ = cpu_to_be32(nbytes); return xdr_encode_opaque_fixed(p, ptr, nbytes); } ",0 " JSValue JSDirectoryEntry::getFile(ExecState* exec) { if (exec->argumentCount() < 1) return throwError(exec, createTypeError(exec, ""Not enough arguments"")); DirectoryEntry* imp = static_cast(impl()); const String& path = valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0)); if (exec->hadException()) return jsUndefined(); int argsCount = exec->argumentCount(); if (argsCount <= 1) { imp->getFile(path); return jsUndefined(); } RefPtr flags; if (!exec->argument(1).isNull() && !exec->argument(1).isUndefined() && exec->argument(1).isObject()) { JSObject* object = exec->argument(1).getObject(); flags = WebKitFlags::create(); JSValue jsCreate = object->get(exec, Identifier(exec, ""create"")); flags->setCreate(jsCreate.toBoolean(exec)); JSValue jsExclusive = object->get(exec, Identifier(exec, ""exclusive"")); flags->setExclusive(jsExclusive.toBoolean(exec)); } if (exec->hadException()) return jsUndefined(); RefPtr successCallback; if (exec->argumentCount() > 2 && !exec->argument(2).isNull() && !exec->argument(2).isUndefined()) { if (!exec->argument(2).isObject()) { setDOMException(exec, TYPE_MISMATCH_ERR); return jsUndefined(); } successCallback = JSEntryCallback::create(asObject(exec->argument(2)), globalObject()); } RefPtr errorCallback; if (exec->argumentCount() > 3 && !exec->argument(3).isNull() && !exec->argument(3).isUndefined()) { if (!exec->argument(3).isObject()) { setDOMException(exec, TYPE_MISMATCH_ERR); return jsUndefined(); } errorCallback = JSErrorCallback::create(asObject(exec->argument(3)), globalObject()); } imp->getFile(path, flags, successCallback, errorCallback); return jsUndefined(); } ",1 " void GetCookieCallback(const std::string& cookies) { if (cookies == ""A=1"") { get_cookie_success_ = true; } else { EXPECT_EQ("""", cookies); get_cookie_success_ = false; } quit_closure_.Run(); } ",0 "static int check_chain_extensions(X509_STORE_CTX *ctx) { #ifdef OPENSSL_NO_CHAIN_VERIFY return 1; #else int i, ok = 0, must_be_ca, plen = 0; X509 *x; int (*cb) (int xok, X509_STORE_CTX *xctx); int proxy_path_length = 0; int purpose; int allow_proxy_certs; cb = ctx->verify_cb; /*- * must_be_ca can have 1 of 3 values: * -1: we accept both CA and non-CA certificates, to allow direct * use of self-signed certificates (which are marked as CA). * 0: we only accept non-CA certificates. This is currently not * used, but the possibility is present for future extensions. * 1: we only accept CA certificates. This is currently used for * all certificates in the chain except the leaf certificate. */ must_be_ca = -1; /* CRL path validation */ if (ctx->parent) { allow_proxy_certs = 0; purpose = X509_PURPOSE_CRL_SIGN; } else { allow_proxy_certs = ! !(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS); /* * A hack to keep people who don't want to modify their software * happy */ if (getenv(""OPENSSL_ALLOW_PROXY_CERTS"")) allow_proxy_certs = 1; purpose = ctx->param->purpose; } /* Check all untrusted certificates */ for (i = 0; i < ctx->last_untrusted; i++) { int ret; x = sk_X509_value(ctx->chain, i); if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL) && (x->ex_flags & EXFLAG_CRITICAL)) { ctx->error = X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION; ctx->error_depth = i; ctx->current_cert = x; ok = cb(0, ctx); if (!ok) goto end; } if (!allow_proxy_certs && (x->ex_flags & EXFLAG_PROXY)) { ctx->error = X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED; ctx->error_depth = i; ctx->current_cert = x; ok = cb(0, ctx); if (!ok) goto end; } ret = X509_check_ca(x); switch (must_be_ca) { case -1: if ((ctx->param->flags & X509_V_FLAG_X509_STRICT) && (ret != 1) && (ret != 0)) { ret = 0; ctx->error = X509_V_ERR_INVALID_CA; } else ret = 1; break; case 0: if (ret != 0) { ret = 0; ctx->error = X509_V_ERR_INVALID_NON_CA; } else ret = 1; break; default: if ((ret == 0) || ((ctx->param->flags & X509_V_FLAG_X509_STRICT) && (ret != 1))) { ret = 0; ctx->error = X509_V_ERR_INVALID_CA; } else ret = 1; break; } if (ret == 0) { ctx->error_depth = i; ctx->current_cert = x; ok = cb(0, ctx); if (!ok) goto end; } if (ctx->param->purpose > 0) { ret = X509_check_purpose(x, purpose, must_be_ca > 0); if ((ret == 0) || ((ctx->param->flags & X509_V_FLAG_X509_STRICT) && (ret != 1))) { ctx->error = X509_V_ERR_INVALID_PURPOSE; ctx->error_depth = i; ctx->current_cert = x; ok = cb(0, ctx); if (!ok) goto end; } } /* Check pathlen if not self issued */ if ((i > 1) && !(x->ex_flags & EXFLAG_SI) && (x->ex_pathlen != -1) && (plen > (x->ex_pathlen + proxy_path_length + 1))) { ctx->error = X509_V_ERR_PATH_LENGTH_EXCEEDED; ctx->error_depth = i; ctx->current_cert = x; ok = cb(0, ctx); if (!ok) goto end; } /* Increment path length if not self issued */ if (!(x->ex_flags & EXFLAG_SI)) plen++; /* * If this certificate is a proxy certificate, the next certificate * must be another proxy certificate or a EE certificate. If not, * the next certificate must be a CA certificate. */ if (x->ex_flags & EXFLAG_PROXY) { if (x->ex_pcpathlen != -1 && i > x->ex_pcpathlen) { ctx->error = X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED; ctx->error_depth = i; ctx->current_cert = x; ok = cb(0, ctx); if (!ok) goto end; } proxy_path_length++; must_be_ca = 0; } else must_be_ca = 1; } ok = 1; end: return ok; #endif } ",0 "static void free_firmware(struct xc2028_data *priv) { int i; tuner_dbg(""%s called\n"", __func__); if (!priv->firm) return; for (i = 0; i < priv->firm_size; i++) kfree(priv->firm[i].ptr); kfree(priv->firm); priv->firm = NULL; priv->firm_size = 0; priv->state = XC2028_NO_FIRMWARE; memset(&priv->cur_fw, 0, sizeof(priv->cur_fw)); } ",0 "bool ACodec::ExecutingState::onMessageReceived(const sp &msg) { bool handled = false; switch (msg->what()) { case kWhatShutdown: { int32_t keepComponentAllocated; CHECK(msg->findInt32( ""keepComponentAllocated"", &keepComponentAllocated)); mCodec->mShutdownInProgress = true; mCodec->mExplicitShutdown = true; mCodec->mKeepComponentAllocated = keepComponentAllocated; mActive = false; status_t err = mCodec->mOMX->sendCommand( mCodec->mNode, OMX_CommandStateSet, OMX_StateIdle); if (err != OK) { if (keepComponentAllocated) { mCodec->signalError(OMX_ErrorUndefined, FAILED_TRANSACTION); } } else { mCodec->changeState(mCodec->mExecutingToIdleState); } handled = true; break; } case kWhatFlush: { ALOGV(""[%s] ExecutingState flushing now "" ""(codec owns %zu/%zu input, %zu/%zu output)."", mCodec->mComponentName.c_str(), mCodec->countBuffersOwnedByComponent(kPortIndexInput), mCodec->mBuffers[kPortIndexInput].size(), mCodec->countBuffersOwnedByComponent(kPortIndexOutput), mCodec->mBuffers[kPortIndexOutput].size()); mActive = false; status_t err = mCodec->mOMX->sendCommand(mCodec->mNode, OMX_CommandFlush, OMX_ALL); if (err != OK) { mCodec->signalError(OMX_ErrorUndefined, FAILED_TRANSACTION); } else { mCodec->changeState(mCodec->mFlushingState); } handled = true; break; } case kWhatResume: { resume(); handled = true; break; } case kWhatRequestIDRFrame: { status_t err = mCodec->requestIDRFrame(); if (err != OK) { ALOGW(""Requesting an IDR frame failed.""); } handled = true; break; } case kWhatSetParameters: { sp params; CHECK(msg->findMessage(""params"", ¶ms)); status_t err = mCodec->setParameters(params); sp reply; if (msg->findMessage(""reply"", &reply)) { reply->setInt32(""err"", err); reply->post(); } handled = true; break; } case ACodec::kWhatSignalEndOfInputStream: { mCodec->onSignalEndOfInputStream(); handled = true; break; } case kWhatSubmitOutputMetadataBufferIfEOS: { if (mCodec->mPortEOS[kPortIndexInput] && !mCodec->mPortEOS[kPortIndexOutput]) { status_t err = mCodec->submitOutputMetadataBuffer(); if (err == OK) { mCodec->signalSubmitOutputMetadataBufferIfEOS_workaround(); } } return true; } default: handled = BaseState::onMessageReceived(msg); break; } return handled; } ",0 "static void tun_detach(struct tun_file *tfile, bool clean) { rtnl_lock(); __tun_detach(tfile, clean); rtnl_unlock(); } ",0 "void RenderFrameHostManager::OnEnforceInsecureNavigationsSet( const std::vector& insecure_navigations_set) { for (const auto& pair : proxy_hosts_) { pair.second->Send(new FrameMsg_EnforceInsecureNavigationsSet( pair.second->GetRoutingID(), insecure_navigations_set)); } } ",0 "static void ffs_func_eps_disable(struct ffs_function *func) { struct ffs_ep *ep = func->eps; struct ffs_epfile *epfile = func->ffs->epfiles; unsigned count = func->ffs->eps_count; unsigned long flags; spin_lock_irqsave(&func->ffs->eps_lock, flags); do { /* pending requests get nuked */ if (likely(ep->ep)) usb_ep_disable(ep->ep); ++ep; if (epfile) { epfile->ep = NULL; ++epfile; } } while (--count); spin_unlock_irqrestore(&func->ffs->eps_lock, flags); } ",0 "void InputMethodIBus::OnDestroy(IBusInputContext* context) { DCHECK_EQ(context_, context); g_object_unref(context_); context_ = NULL; context_focused_ = false; ConfirmCompositionText(); OnInputMethodChanged(); } ",0 "static int adjust_insn_aux_data(struct bpf_verifier_env *env, u32 prog_len, u32 off, u32 cnt) { struct bpf_insn_aux_data *new_data, *old_data = env->insn_aux_data; int i; if (cnt == 1) return 0; new_data = vzalloc(array_size(prog_len, sizeof(struct bpf_insn_aux_data))); if (!new_data) return -ENOMEM; memcpy(new_data, old_data, sizeof(struct bpf_insn_aux_data) * off); memcpy(new_data + off + cnt - 1, old_data + off, sizeof(struct bpf_insn_aux_data) * (prog_len - off - cnt + 1)); for (i = off; i < off + cnt - 1; i++) new_data[i].seen = true; env->insn_aux_data = new_data; vfree(old_data); return 0; } ",0 " wm::WorkspaceWindowState GetWorkspaceWindowState() const { const auto* shelf_window = GetShelfWidget()->GetNativeWindow(); return RootWindowController::ForWindow(shelf_window) ->GetWorkspaceWindowState(); } ",0 "get_body_files (const char* filename, const char pref, const MessageBody* body) { File **files = NULL; VarLenData **data; char *ext = """"; char *type = ""unknown""; int i; switch (pref) { case 'r': data = body->rtf_bodies; ext = "".rtf""; type = ""text/rtf""; break; case 'h': data = body->html_bodies; ext = "".html""; type = ""text/html""; break; case 't': data = body->text_body; ext = "".txt""; type = ""text/plain""; break; default: data = NULL; break; } if (data) { int count = 0; char *tmp = CHECKED_XCALLOC(char, strlen(filename) + strlen(ext) + 1); strcpy (tmp, filename); strcat (tmp, ext); char *mime = CHECKED_XCALLOC(char, strlen(type) + 1); strcpy (mime, type); /* first get a count */ while (data[count++]); files = (File**)XCALLOC(File*, count + 1); for (i = 0; data[i]; i++) { files[i] = (File*)XCALLOC(File, 1); files[i]->name = tmp; files[i]->mime_type = mime; files[i]->len = data[i]->len; files[i]->data = CHECKED_XMALLOC(unsigned char, data[i]->len); memmove (files[i]->data, data[i]->data, data[i]->len); } } return files; } ",0 "static inline int nf_ingress(struct sk_buff *skb, struct packet_type **pt_prev, int *ret, struct net_device *orig_dev) { #ifdef CONFIG_NETFILTER_INGRESS if (nf_hook_ingress_active(skb)) { int ingress_retval; if (*pt_prev) { *ret = deliver_skb(skb, *pt_prev, orig_dev); *pt_prev = NULL; } rcu_read_lock(); ingress_retval = nf_hook_ingress(skb); rcu_read_unlock(); return ingress_retval; } #endif /* CONFIG_NETFILTER_INGRESS */ return 0; } ",0 "static inline int should_resched(void) { return need_resched() && !(preempt_count() & PREEMPT_ACTIVE); } ",0 "SafeBuiltins::SafeBuiltins(ScriptContext* context) : context_(context) {} ",0 "int TestOpenThread(DWORD thread_id) { HANDLE thread = ::OpenThread(THREAD_QUERY_INFORMATION, FALSE, // Do not inherit handles. thread_id); if (NULL == thread) { if (ERROR_ACCESS_DENIED == ::GetLastError()) { return SBOX_TEST_DENIED; } else { return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND; } } else { ::CloseHandle(thread); return SBOX_TEST_SUCCEEDED; } } ",0 "int ldb_dn_get_comp_num(struct ldb_dn *dn) { if ( ! ldb_dn_validate(dn)) { return -1; } return dn->comp_num; } ",0 "status_t OMXNodeInstance::emptyBuffer_l( OMX_BUFFERHEADERTYPE *header, OMX_U32 flags, OMX_TICKS timestamp, intptr_t debugAddr) { header->nFlags = flags; header->nTimeStamp = timestamp; { Mutex::Autolock _l(mDebugLock); mInputBuffersWithCodec.add(header); if ((flags & OMX_BUFFERFLAG_CODECCONFIG) != 0) { bumpDebugLevel_l(2 /* numInputBuffers */, 0 /* numOutputBuffers */); } CLOG_BUMPED_BUFFER(emptyBuffer, WITH_STATS(FULL_BUFFER(debugAddr, header))); } OMX_ERRORTYPE err = OMX_EmptyThisBuffer(mHandle, header); CLOG_IF_ERROR(emptyBuffer, err, FULL_BUFFER(debugAddr, header)); { Mutex::Autolock _l(mDebugLock); if (err != OMX_ErrorNone) { mInputBuffersWithCodec.remove(header); } else if (!(flags & OMX_BUFFERFLAG_CODECCONFIG)) { unbumpDebugLevel_l(kPortIndexInput); } } return StatusFromOMXError(err); } ",0 "decode_NXAST_RAW_SAMPLE(const struct nx_action_sample *nas, enum ofp_version ofp_version OVS_UNUSED, struct ofpbuf *out) { struct ofpact_sample *sample; sample = ofpact_put_SAMPLE(out); sample->ofpact.raw = NXAST_RAW_SAMPLE; sample->probability = ntohs(nas->probability); sample->collector_set_id = ntohl(nas->collector_set_id); sample->obs_domain_id = ntohl(nas->obs_domain_id); sample->obs_point_id = ntohl(nas->obs_point_id); sample->sampling_port = OFPP_NONE; sample->direction = NX_ACTION_SAMPLE_DEFAULT; if (sample->probability == 0) { return OFPERR_OFPBAC_BAD_ARGUMENT; } return 0; } ",0 "static void pppol2tp_show(struct seq_file *m, void *arg) { struct l2tp_session *session = arg; struct pppol2tp_session *ps = l2tp_session_priv(session); if (ps) { struct pppox_sock *po = pppox_sk(ps->sock); if (po) seq_printf(m, "" interface %s\n"", ppp_dev_name(&po->chan)); } } ",0 "VaapiVideoDecodeAccelerator::VaapiVP8Accelerator::~VaapiVP8Accelerator() {} ",0 "static void pdf_run_c(fz_context *ctx, pdf_processor *proc, float x1, float y1, float x2, float y2, float x3, float y3) { pdf_run_processor *pr = (pdf_run_processor *)proc; fz_curveto(ctx, pr->path, x1, y1, x2, y2, x3, y3); } ",0 "void ImageBitmapFactories::ImageBitmapLoader::didFinishLoading() { if (!m_loader.arrayBufferResult()) { rejectPromise(); return; } RefPtr sharedBuffer = SharedBuffer::create((char*)m_loader.arrayBufferResult()->data(), m_loader.arrayBufferResult()->byteLength()); OwnPtr source = adoptPtr(new ImageSource()); source->setData(sharedBuffer.get(), true); RefPtr imageSkia = source->createFrameAtIndex(0); if (!imageSkia) { rejectPromise(); return; } RefPtr image = BitmapImage::create(imageSkia); if (!image->width() || !image->height()) { rejectPromise(); return; } if (!m_cropRect.width() && !m_cropRect.height()) { m_cropRect = IntRect(IntPoint(), image->size()); } RefPtrWillBeRawPtr imageBitmap = ImageBitmap::create(image.get(), m_cropRect); ScriptScope scope(m_scriptState); m_resolver->resolve(imageBitmap.release()); m_factory->didFinishLoading(this); } ",0 "void GLES2DecoderImpl::DoCopyTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) { TextureManager::TextureInfo* info = GetTextureInfoForTarget(target); if (!info) { SetGLError(GL_INVALID_OPERATION, ""glCopyTexSubImage2D: unknown texture for target""); return; } GLenum type = 0; GLenum format = 0; if (!info->GetLevelType(target, level, &type, &format) || !info->ValidForTexture( target, level, xoffset, yoffset, width, height, format, type)) { SetGLError(GL_INVALID_VALUE, ""glCopyTexSubImage2D: bad dimensions.""); return; } glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); } ",0 "void AddDllsFromRegistryToBlacklist() { HKEY key = NULL; LONG result = ::RegOpenKeyEx(HKEY_CURRENT_USER, kRegistryFinchListPath, 0, KEY_QUERY_VALUE | KEY_SET_VALUE, &key); if (result != ERROR_SUCCESS) return; DWORD value_len; DWORD name_len = MAX_PATH; std::vector name_buffer(name_len); for (int i = 0; result == ERROR_SUCCESS; ++i) { name_len = MAX_PATH; value_len = 0; result = ::RegEnumValue( key, i, &name_buffer[0], &name_len, NULL, NULL, NULL, &value_len); if (result != ERROR_SUCCESS) break; name_len = name_len + 1; value_len = value_len + 1; std::vector value_buffer(value_len); result = ::RegEnumValue(key, i, &name_buffer[0], &name_len, NULL, NULL, reinterpret_cast(&value_buffer[0]), &value_len); if (result != ERROR_SUCCESS) break; value_buffer[value_len - 1] = L'\0'; AddDllToBlacklist(&value_buffer[0]); } ::RegCloseKey(key); return; } ",0 "static int cxusb_d680_dmb_rc_query(struct dvb_usb_device *d) { u8 ircode[2]; if (cxusb_ctrl_msg(d, 0x10, NULL, 0, ircode, 2) < 0) return 0; if (ircode[0] || ircode[1]) rc_keydown(d->rc_dev, RC_TYPE_UNKNOWN, RC_SCANCODE_RC5(ircode[0], ircode[1]), 0); return 0; } ",0 "const KURL Document::SiteForCookies() const { if (IsHTMLImport()) return ImportsController()->Master()->SiteForCookies(); if (!GetFrame()) return SecurityOrigin::UrlWithUniqueSecurityOrigin(); Frame& top = GetFrame()->Tree().Top(); KURL top_document_url; if (top.IsLocalFrame()) { top_document_url = ToLocalFrame(top).GetDocument()->Url(); } else { SecurityOrigin* origin = top.GetSecurityContext()->GetSecurityOrigin(); if (origin) top_document_url = KURL(NullURL(), origin->ToString()); else top_document_url = SecurityOrigin::UrlWithUniqueSecurityOrigin(); } if (SchemeRegistry::ShouldTreatURLSchemeAsFirstPartyWhenTopLevel( top_document_url.Protocol())) return top_document_url; const OriginAccessEntry& access_entry = top.IsLocalFrame() ? ToLocalFrame(top).GetDocument()->AccessEntryFromURL() : OriginAccessEntry(top_document_url.Protocol(), top_document_url.Host(), OriginAccessEntry::kAllowRegisterableDomains); const Frame* current_frame = GetFrame(); while (current_frame) { while (current_frame->IsLocalFrame() && ToLocalFrame(current_frame)->GetDocument()->IsSrcdocDocument()) current_frame = current_frame->Tree().Parent(); DCHECK(current_frame); if (access_entry.MatchesDomain( *current_frame->GetSecurityContext()->GetSecurityOrigin()) == OriginAccessEntry::kDoesNotMatchOrigin) return SecurityOrigin::UrlWithUniqueSecurityOrigin(); current_frame = current_frame->Tree().Parent(); } return top_document_url; } ",0 "static struct page *__get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid, struct page *parent, int start) { struct page *page; int err; if (!nid) return ERR_PTR(-ENOENT); f2fs_bug_on(sbi, check_nid_range(sbi, nid)); repeat: page = f2fs_grab_cache_page(NODE_MAPPING(sbi), nid, false); if (!page) return ERR_PTR(-ENOMEM); err = read_node_page(page, 0); if (err < 0) { f2fs_put_page(page, 1); return ERR_PTR(err); } else if (err == LOCKED_PAGE) { goto page_hit; } if (parent) ra_node_pages(parent, start + 1, MAX_RA_NODE); lock_page(page); if (unlikely(page->mapping != NODE_MAPPING(sbi))) { f2fs_put_page(page, 1); goto repeat; } if (unlikely(!PageUptodate(page))) goto out_err; page_hit: if(unlikely(nid != nid_of_node(page))) { f2fs_bug_on(sbi, 1); ClearPageUptodate(page); out_err: f2fs_put_page(page, 1); return ERR_PTR(-EIO); } return page; } ",0 "void PrintHeaderFooterText( const string16& text, WebKit::WebCanvas* canvas, HeaderFooterPaint paint, float webkit_scale_factor, const PageSizeMargins& page_layout, printing::HorizontalHeaderFooterPosition horizontal_position, printing::VerticalHeaderFooterPosition vertical_position, double offset_to_baseline) { #if defined(USE_SKIA) #if defined(OS_WIN) PrintHeaderFooterByRenderText(text, canvas, paint, webkit_scale_factor, page_layout, horizontal_position, vertical_position, offset_to_baseline); #else size_t text_byte_length = text.length() * sizeof(char16); double text_width_in_points = SkScalarToDouble(paint.measureText( text.c_str(), text_byte_length)); SkPoint point = GetHeaderFooterPosition(webkit_scale_factor, page_layout, horizontal_position, vertical_position, offset_to_baseline, text_width_in_points); paint.setTextSize(SkDoubleToScalar( paint.getTextSize() / webkit_scale_factor)); canvas->drawText(text.c_str(), text_byte_length, point.x(), point.y(), paint); #endif // USE_SKIA && OS_WIN #elif defined(OS_MACOSX) ScopedCFTypeRef cf_text(base::SysUTF16ToCFStringRef(text)); ScopedCFTypeRef cf_attr_text( CFAttributedStringCreate(NULL, cf_text, paint)); ScopedCFTypeRef line(CTLineCreateWithAttributedString( cf_attr_text)); double text_width_in_points = CTLineGetTypographicBounds(line, NULL, NULL, NULL) * webkit_scale_factor; SkPoint point = GetHeaderFooterPosition(webkit_scale_factor, page_layout, horizontal_position, vertical_position, offset_to_baseline, text_width_in_points); CGContextSetTextPosition(canvas, SkScalarToDouble(point.x()), SkScalarToDouble(point.y())); CTLineDraw(line, canvas); #endif } ",0 "_rpc_stat_jobacct(slurm_msg_t *msg) { job_step_id_msg_t *req = (job_step_id_msg_t *)msg->data; slurm_msg_t resp_msg; job_step_stat_t *resp = NULL; int fd; uid_t req_uid, uid; uint16_t protocol_version; debug3(""Entering _rpc_stat_jobacct""); /* step completion messages are only allowed from other slurmstepd, so only root or SlurmUser is allowed here */ req_uid = g_slurm_auth_get_uid(msg->auth_cred, conf->auth_info); fd = stepd_connect(conf->spooldir, conf->node_name, req->job_id, req->step_id, &protocol_version); if (fd == -1) { error(""stepd_connect to %u.%u failed: %m"", req->job_id, req->step_id); slurm_send_rc_msg(msg, ESLURM_INVALID_JOB_ID); return ESLURM_INVALID_JOB_ID; } if ((int)(uid = stepd_get_uid(fd, protocol_version)) < 0) { debug(""stat_jobacct couldn't read from the step %u.%u: %m"", req->job_id, req->step_id); close(fd); if (msg->conn_fd >= 0) slurm_send_rc_msg(msg, ESLURM_INVALID_JOB_ID); return ESLURM_INVALID_JOB_ID; } /* * check that requesting user ID is the SLURM UID or root */ if ((req_uid != uid) && (!_slurm_authorized_user(req_uid))) { error(""stat_jobacct from uid %ld for job %u "" ""owned by uid %ld"", (long) req_uid, req->job_id, (long) uid); if (msg->conn_fd >= 0) { slurm_send_rc_msg(msg, ESLURM_USER_ID_MISSING); close(fd); return ESLURM_USER_ID_MISSING;/* or bad in this case */ } } resp = xmalloc(sizeof(job_step_stat_t)); resp->step_pids = xmalloc(sizeof(job_step_pids_t)); resp->step_pids->node_name = xstrdup(conf->node_name); slurm_msg_t_copy(&resp_msg, msg); resp->return_code = SLURM_SUCCESS; if (stepd_stat_jobacct(fd, protocol_version, req, resp) == SLURM_ERROR) { debug(""accounting for nonexistent job %u.%u requested"", req->job_id, req->step_id); } /* FIX ME: This should probably happen in the stepd_stat_jobacct to get more information about the pids. */ if (stepd_list_pids(fd, protocol_version, &resp->step_pids->pid, &resp->step_pids->pid_cnt) == SLURM_ERROR) { debug(""No pids for nonexistent job %u.%u requested"", req->job_id, req->step_id); } close(fd); resp_msg.msg_type = RESPONSE_JOB_STEP_STAT; resp_msg.data = resp; slurm_send_node_msg(msg->conn_fd, &resp_msg); slurm_free_job_step_stat(resp); return SLURM_SUCCESS; } ",0 "int ext4_mark_iloc_dirty(handle_t *handle, struct inode *inode, struct ext4_iloc *iloc) { int err = 0; if (test_opt(inode->i_sb, I_VERSION)) inode_inc_iversion(inode); /* the do_update_inode consumes one bh->b_count */ get_bh(iloc->bh); /* ext4_do_update_inode() does jbd2_journal_dirty_metadata */ err = ext4_do_update_inode(handle, inode, iloc); put_bh(iloc->bh); return err; } ",0 "String RTCPeerConnection::readyState() const { switch (m_readyState) { case ReadyStateNew: return ASCIILiteral(""new""); case ReadyStateOpening: return ASCIILiteral(""opening""); case ReadyStateActive: return ASCIILiteral(""active""); case ReadyStateClosing: return ASCIILiteral(""closing""); case ReadyStateClosed: return ASCIILiteral(""closed""); } ASSERT_NOT_REACHED(); return ASCIILiteral(""""); } ",0 "static inline int skb_alloc_rx_flag(const struct sk_buff *skb) { if (skb_pfmemalloc(skb)) return SKB_ALLOC_RX; return 0; } ",0 "static inline String resourceString(const v8::Handle function) { String resourceName; int lineNumber; resourceInfo(function, resourceName, lineNumber); StringBuilder builder; builder.append(resourceName); builder.append(':'); builder.append(String::number(lineNumber)); return builder.toString(); } ",0 "BGD_DECLARE(void) gdImageWebpEx (gdImagePtr im, FILE * outFile, int quality) { gdIOCtx *out = gdNewFileCtx(outFile); if (out == NULL) { return; } gdImageWebpCtx(im, out, quality); out->gd_free(out); } ",0 "void ewk_frame_force_layout(Evas_Object* ewkFrame) { DBG(""ewkFrame=%p"", ewkFrame); EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData); EINA_SAFETY_ON_NULL_RETURN(smartData->frame); WebCore::FrameView* view = smartData->frame->view(); if (view) view->forceLayout(true); } ",0 "static int seqiv_aead_givencrypt(struct aead_givcrypt_request *req) { struct crypto_aead *geniv = aead_givcrypt_reqtfm(req); struct seqiv_ctx *ctx = crypto_aead_ctx(geniv); struct aead_request *areq = &req->areq; struct aead_request *subreq = aead_givcrypt_reqctx(req); crypto_completion_t compl; void *data; u8 *info; unsigned int ivsize; int err; aead_request_set_tfm(subreq, aead_geniv_base(geniv)); compl = areq->base.complete; data = areq->base.data; info = areq->iv; ivsize = crypto_aead_ivsize(geniv); if (unlikely(!IS_ALIGNED((unsigned long)info, crypto_aead_alignmask(geniv) + 1))) { info = kmalloc(ivsize, areq->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP ? GFP_KERNEL: GFP_ATOMIC); if (!info) return -ENOMEM; compl = seqiv_aead_complete; data = req; } aead_request_set_callback(subreq, areq->base.flags, compl, data); aead_request_set_crypt(subreq, areq->src, areq->dst, areq->cryptlen, info); aead_request_set_assoc(subreq, areq->assoc, areq->assoclen); seqiv_geniv(ctx, info, req->seq, ivsize); memcpy(req->giv, info, ivsize); err = crypto_aead_encrypt(subreq); if (unlikely(info != areq->iv)) seqiv_aead_complete2(req, err); return err; } ",0 "static int snd_compr_start(struct snd_compr_stream *stream) { int retval; if (stream->runtime->state != SNDRV_PCM_STATE_PREPARED) return -EPERM; retval = stream->ops->trigger(stream, SNDRV_PCM_TRIGGER_START); if (!retval) stream->runtime->state = SNDRV_PCM_STATE_RUNNING; return retval; } ",0 "void IOThread::CleanUp() { base::debug::LeakTracker::CheckForLeaks(); delete sdch_manager_; sdch_manager_ = NULL; #if defined(USE_NSS) || defined(OS_IOS) net::ShutdownNSSHttpIO(); #endif system_url_request_context_getter_ = NULL; network_change_observer_.reset(); system_proxy_config_service_.reset(); delete globals_; globals_ = NULL; base::debug::LeakTracker::CheckForLeaks(); } ",0 " mrb_class_real(struct RClass* cl) { if (cl == 0) return NULL; while ((cl->tt == MRB_TT_SCLASS) || (cl->tt == MRB_TT_ICLASS)) { cl = cl->super; } return cl; } ",1 "static int decode_attr_mode(struct xdr_stream *xdr, uint32_t *bitmap, umode_t *mode) { uint32_t tmp; __be32 *p; int ret = 0; *mode = 0; if (unlikely(bitmap[1] & (FATTR4_WORD1_MODE - 1U))) return -EIO; if (likely(bitmap[1] & FATTR4_WORD1_MODE)) { p = xdr_inline_decode(xdr, 4); if (unlikely(!p)) goto out_overflow; tmp = be32_to_cpup(p); *mode = tmp & ~S_IFMT; bitmap[1] &= ~FATTR4_WORD1_MODE; ret = NFS_ATTR_FATTR_MODE; } dprintk(""%s: file mode=0%o\n"", __func__, (unsigned int)*mode); return ret; out_overflow: print_overflow_msg(__func__, xdr); return -EIO; } ",0 "BluetoothAdapter::~BluetoothAdapter() { if (set_powered_callbacks_) set_powered_callbacks_->error_callback.Run(); } ",0 "DGAInstallCmap(ColormapPtr cmap) { ScreenPtr pScreen = cmap->pScreen; DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); /* We rely on the extension to check that DGA is active */ if (!pScreenPriv->dgaColormap) pScreenPriv->savedColormap = GetInstalledmiColormap(pScreen); pScreenPriv->dgaColormap = cmap; (*pScreen->InstallColormap) (cmap); } ",0 "static int check_ld_imm(struct bpf_verifier_env *env, struct bpf_insn *insn) { struct bpf_reg_state *regs = cur_regs(env); int err; if (BPF_SIZE(insn->code) != BPF_DW) { verbose(env, ""invalid BPF_LD_IMM insn\n""); return -EINVAL; } if (insn->off != 0) { verbose(env, ""BPF_LD_IMM64 uses reserved fields\n""); return -EINVAL; } err = check_reg_arg(env, insn->dst_reg, DST_OP); if (err) return err; if (insn->src_reg == 0) { u64 imm = ((u64)(insn + 1)->imm << 32) | (u32)insn->imm; regs[insn->dst_reg].type = SCALAR_VALUE; __mark_reg_known(®s[insn->dst_reg], imm); return 0; } /* replace_map_fd_with_map_ptr() should have caught bad ld_imm64 */ BUG_ON(insn->src_reg != BPF_PSEUDO_MAP_FD); regs[insn->dst_reg].type = CONST_PTR_TO_MAP; regs[insn->dst_reg].map_ptr = ld_imm64_to_map_ptr(insn); return 0; } ",0 "void WebProcessProxy::didUpdateHistoryTitle(uint64_t pageID, const String& title, const String& url, uint64_t frameID) { WebPageProxy* page = webPage(pageID); if (!page) return; WebFrameProxy* frame = webFrame(frameID); MESSAGE_CHECK(frame); MESSAGE_CHECK(frame->page() == page); MESSAGE_CHECK_URL(url); m_context->historyClient().didUpdateHistoryTitle(m_context.get(), page, title, url, frame); } ",0 "PHP_FUNCTION(imagecharup) { php_imagechar(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); } ",0 "void Document::didAccessStyleResolver() { static const int timeBeforeThrowingAwayStyleResolverAfterLastUseInSeconds = 60; static const int holdOffTimeBeforeReschedulingTimerInSeconds = 5; double currentTime = WTF::currentTime(); if (currentTime > m_lastStyleResolverAccessTime + holdOffTimeBeforeReschedulingTimerInSeconds) { m_styleResolverThrowawayTimer.startOneShot(timeBeforeThrowingAwayStyleResolverAfterLastUseInSeconds); m_lastStyleResolverAccessTime = currentTime; } } ",0 " init_copy(mrb_state *mrb, mrb_value dest, mrb_value obj) { switch (mrb_type(obj)) { case MRB_TT_CLASS: case MRB_TT_MODULE: copy_class(mrb, dest, obj); mrb_iv_copy(mrb, dest, obj); mrb_iv_remove(mrb, dest, mrb_intern_lit(mrb, ""__classname__"")); break; case MRB_TT_OBJECT: case MRB_TT_SCLASS: case MRB_TT_HASH: case MRB_TT_DATA: case MRB_TT_EXCEPTION: mrb_iv_copy(mrb, dest, obj); break; case MRB_TT_ISTRUCT: mrb_istruct_copy(dest, obj); break; default: break; } mrb_funcall(mrb, dest, ""initialize_copy"", 1, obj); } ",1 "armv6pmu_stop(void) { unsigned long flags, val; raw_spin_lock_irqsave(&pmu_lock, flags); val = armv6_pmcr_read(); val &= ~ARMV6_PMCR_ENABLE; armv6_pmcr_write(val); raw_spin_unlock_irqrestore(&pmu_lock, flags); } ",0 "void snd_pcm_set_ops(struct snd_pcm *pcm, int direction, const struct snd_pcm_ops *ops) { struct snd_pcm_str *stream = &pcm->streams[direction]; struct snd_pcm_substream *substream; for (substream = stream->substream; substream != NULL; substream = substream->next) substream->ops = ops; } ",0 "static void SVGStartDocument(void *context) { SVGInfo *svg_info; xmlParserCtxtPtr parser; /* Called when the document start being processed. */ (void) LogMagickEvent(CoderEvent,GetMagickModule(),"" SAX.startDocument()""); svg_info=(SVGInfo *) context; parser=svg_info->parser; svg_info->document=xmlNewDoc(parser->version); if (svg_info->document == (xmlDocPtr) NULL) return; if (parser->encoding == NULL) svg_info->document->encoding=(const xmlChar *) NULL; else svg_info->document->encoding=xmlStrdup(parser->encoding); svg_info->document->standalone=parser->standalone; } ",0 "static void process_command(conn *c, char *command) { token_t tokens[MAX_TOKENS]; size_t ntokens; int comm; assert(c != NULL); MEMCACHED_PROCESS_COMMAND_START(c->sfd, c->rcurr, c->rbytes); if (settings.verbose > 1) fprintf(stderr, ""<%d %s\n"", c->sfd, command); /* * for commands set/add/replace, we build an item and read the data * directly into it, then continue in nread_complete(). */ c->msgcurr = 0; c->msgused = 0; c->iovused = 0; if (add_msghdr(c) != 0) { out_string(c, ""SERVER_ERROR out of memory preparing response""); return; } ntokens = tokenize_command(command, tokens, MAX_TOKENS); if (ntokens >= 3 && ((strcmp(tokens[COMMAND_TOKEN].value, ""get"") == 0) || (strcmp(tokens[COMMAND_TOKEN].value, ""bget"") == 0))) { process_get_command(c, tokens, ntokens, false); } else if ((ntokens == 6 || ntokens == 7) && ((strcmp(tokens[COMMAND_TOKEN].value, ""add"") == 0 && (comm = NREAD_ADD)) || (strcmp(tokens[COMMAND_TOKEN].value, ""set"") == 0 && (comm = NREAD_SET)) || (strcmp(tokens[COMMAND_TOKEN].value, ""replace"") == 0 && (comm = NREAD_REPLACE)) || (strcmp(tokens[COMMAND_TOKEN].value, ""prepend"") == 0 && (comm = NREAD_PREPEND)) || (strcmp(tokens[COMMAND_TOKEN].value, ""append"") == 0 && (comm = NREAD_APPEND)) )) { process_update_command(c, tokens, ntokens, comm, false); } else if ((ntokens == 7 || ntokens == 8) && (strcmp(tokens[COMMAND_TOKEN].value, ""cas"") == 0 && (comm = NREAD_CAS))) { process_update_command(c, tokens, ntokens, comm, true); } else if ((ntokens == 4 || ntokens == 5) && (strcmp(tokens[COMMAND_TOKEN].value, ""incr"") == 0)) { process_arithmetic_command(c, tokens, ntokens, 1); } else if (ntokens >= 3 && (strcmp(tokens[COMMAND_TOKEN].value, ""gets"") == 0)) { process_get_command(c, tokens, ntokens, true); } else if ((ntokens == 4 || ntokens == 5) && (strcmp(tokens[COMMAND_TOKEN].value, ""decr"") == 0)) { process_arithmetic_command(c, tokens, ntokens, 0); } else if (ntokens >= 3 && ntokens <= 4 && (strcmp(tokens[COMMAND_TOKEN].value, ""delete"") == 0)) { process_delete_command(c, tokens, ntokens); } else if (ntokens >= 2 && (strcmp(tokens[COMMAND_TOKEN].value, ""stats"") == 0)) { process_stat(c, tokens, ntokens); } else if (ntokens >= 2 && ntokens <= 4 && (strcmp(tokens[COMMAND_TOKEN].value, ""flush_all"") == 0)) { time_t exptime = 0; set_current_time(); set_noreply_maybe(c, tokens, ntokens); pthread_mutex_lock(&c->thread->stats.mutex); c->thread->stats.flush_cmds++; pthread_mutex_unlock(&c->thread->stats.mutex); if(ntokens == (c->noreply ? 3 : 2)) { settings.oldest_live = current_time - 1; item_flush_expired(); out_string(c, ""OK""); return; } exptime = strtol(tokens[1].value, NULL, 10); if(errno == ERANGE) { out_string(c, ""CLIENT_ERROR bad command line format""); return; } /* If exptime is zero realtime() would return zero too, and realtime(exptime) - 1 would overflow to the max unsigned value. So we process exptime == 0 the same way we do when no delay is given at all. */ if (exptime > 0) settings.oldest_live = realtime(exptime) - 1; else /* exptime == 0 */ settings.oldest_live = current_time - 1; item_flush_expired(); out_string(c, ""OK""); return; } else if (ntokens == 2 && (strcmp(tokens[COMMAND_TOKEN].value, ""version"") == 0)) { out_string(c, ""VERSION "" VERSION); } else if (ntokens == 2 && (strcmp(tokens[COMMAND_TOKEN].value, ""quit"") == 0)) { conn_set_state(c, conn_closing); } else if ((ntokens == 3 || ntokens == 4) && (strcmp(tokens[COMMAND_TOKEN].value, ""verbosity"") == 0)) { process_verbosity_command(c, tokens, ntokens); } else { out_string(c, ""ERROR""); } return; } ",0 "static inline int get_amv(Mpeg4DecContext *ctx, int n) { MpegEncContext *s = &ctx->m; int x, y, mb_v, sum, dx, dy, shift; int len = 1 << (s->f_code + 4); const int a = s->sprite_warping_accuracy; if (s->workaround_bugs & FF_BUG_AMV) len >>= s->quarter_sample; if (s->real_sprite_warping_points == 1) { if (ctx->divx_version == 500 && ctx->divx_build == 413) sum = s->sprite_offset[0][n] / (1 << (a - s->quarter_sample)); else sum = RSHIFT(s->sprite_offset[0][n] * (1 << s->quarter_sample), a); } else { dx = s->sprite_delta[n][0]; dy = s->sprite_delta[n][1]; shift = ctx->sprite_shift[0]; if (n) dy -= 1 << (shift + a + 1); else dx -= 1 << (shift + a + 1); mb_v = s->sprite_offset[0][n] + dx * s->mb_x * 16 + dy * s->mb_y * 16; sum = 0; for (y = 0; y < 16; y++) { int v; v = mb_v + dy * y; for (x = 0; x < 16; x++) { sum += v >> shift; v += dx; } } sum = RSHIFT(sum, a + 8 - s->quarter_sample); } if (sum < -len) sum = -len; else if (sum >= len) sum = len - 1; return sum; } ",0 "void addReplyBulk(client *c, robj *obj) { addReplyBulkLen(c,obj); addReply(c,obj); addReply(c,shared.crlf); } ",0 "static inline void put_link(struct nameidata *nd) { struct saved *last = nd->stack + --nd->depth; do_delayed_call(&last->done); if (!(nd->flags & LOOKUP_RCU)) path_put(&last->link); } ",0 "SYSCALL_DEFINE3(lchown, const char __user *, filename, uid_t, user, gid_t, group) { return sys_fchownat(AT_FDCWD, filename, user, group, AT_SYMLINK_NOFOLLOW); } ",0 "static void simple_callback(struct urb *urb) { complete(urb->context); } ",0 "decode_OFPAT_RAW11_SET_VLAN_VID(uint16_t vid, enum ofp_version ofp_version OVS_UNUSED, struct ofpbuf *out) { return decode_set_vlan_vid(vid, false, out); } ",0 "autofill::RegionDataLoader* PaymentRequestState::GetRegionDataLoader() { return payment_request_delegate_->GetRegionDataLoader(); } ",0 "PassRefPtr SerializedScriptValue::create(const ScriptValue& value, WebBlobInfoArray* blobInfo, ExceptionState& exceptionState, v8::Isolate* isolate) { ASSERT(isolate->InContext()); return adoptRef(new SerializedScriptValue(value.v8Value(), 0, 0, blobInfo, exceptionState, isolate)); } ",0 "bool MoveTabFunction::RunImpl() { int tab_id; EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &tab_id)); DictionaryValue* update_props; EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &update_props)); int new_index; EXTENSION_FUNCTION_VALIDATE(update_props->GetInteger( keys::kIndexKey, &new_index)); EXTENSION_FUNCTION_VALIDATE(new_index >= 0); Browser* source_browser = NULL; TabStripModel* source_tab_strip = NULL; TabContents* contents = NULL; int tab_index = -1; if (!GetTabById(tab_id, profile(), include_incognito(), &source_browser, &source_tab_strip, &contents, &tab_index, &error_)) return false; if (source_browser->type() != Browser::TYPE_NORMAL) { error_ = keys::kCanOnlyMoveTabsWithinNormalWindowsError; return false; } if (update_props->HasKey(keys::kWindowIdKey)) { Browser* target_browser; int window_id; EXTENSION_FUNCTION_VALIDATE(update_props->GetInteger( keys::kWindowIdKey, &window_id)); target_browser = GetBrowserInProfileWithId(profile(), window_id, include_incognito(), &error_); if (!target_browser) return false; if (target_browser->type() != Browser::TYPE_NORMAL) { error_ = keys::kCanOnlyMoveTabsWithinNormalWindowsError; return false; } if (ExtensionTabUtil::GetWindowId(target_browser) != ExtensionTabUtil::GetWindowId(source_browser)) { TabStripModel* target_tab_strip = target_browser->tabstrip_model(); contents = source_tab_strip->DetachTabContentsAt(tab_index); if (!contents) { error_ = ExtensionErrorUtils::FormatErrorMessage( keys::kTabNotFoundError, IntToString(tab_id)); return false; } if (new_index > target_tab_strip->count()) new_index = target_tab_strip->count(); target_tab_strip->InsertTabContentsAt(new_index, contents, false, true); if (has_callback()) result_.reset(ExtensionTabUtil::CreateTabValue(contents, target_tab_strip, new_index)); return true; } } if (new_index >= source_tab_strip->count()) new_index = source_tab_strip->count() - 1; if (new_index != tab_index) source_tab_strip->MoveTabContentsAt(tab_index, new_index, false); if (has_callback()) result_.reset(ExtensionTabUtil::CreateTabValue(contents, source_tab_strip, new_index)); return true; } ",0 "void RenderViewImpl::UnregisterPluginDelegate( WebPluginDelegateProxy* delegate) { plugin_delegates_.erase(delegate); } ",0 "_XcursorStdioFileRead (XcursorFile *file, unsigned char *buf, int len) { FILE *f = file->closure; return fread (buf, 1, len, f); } ",0 " void Navigate(const char* url, int page_id) { contents()->TestDidNavigate( contents()->GetRenderViewHost(), page_id, GURL(url), content::PAGE_TRANSITION_TYPED); } ",0 "rpl_dao_print(netdissect_options *ndo, const u_char *bp, u_int length) { const struct nd_rpl_dao *dao = (const struct nd_rpl_dao *)bp; const char *dagid_str = """"; ND_TCHECK(*dao); if (length < ND_RPL_DAO_MIN_LEN) goto tooshort; bp += ND_RPL_DAO_MIN_LEN; length -= ND_RPL_DAO_MIN_LEN; if(RPL_DAO_D(dao->rpl_flags)) { ND_TCHECK2(dao->rpl_dagid, DAGID_LEN); if (length < DAGID_LEN) goto tooshort; dagid_str = ip6addr_string (ndo, dao->rpl_dagid); bp += DAGID_LEN; length -= DAGID_LEN; } ND_PRINT((ndo, "" [dagid:%s,seq:%u,instance:%u%s%s,%02x]"", dagid_str, dao->rpl_daoseq, dao->rpl_instanceid, RPL_DAO_K(dao->rpl_flags) ? "",acK"":"""", RPL_DAO_D(dao->rpl_flags) ? "",Dagid"":"""", dao->rpl_flags)); if(ndo->ndo_vflag > 1) { const struct rpl_dio_genoption *opt = (const struct rpl_dio_genoption *)bp; rpl_dio_printopt(ndo, opt, length); } return; trunc: ND_PRINT((ndo,"" [|truncated]"")); return; tooshort: ND_PRINT((ndo,"" [|length too short]"")); return; } ",0 "void HTMLMediaElement::ParserDidSetAttributes() { HTMLElement::ParserDidSetAttributes(); if (FastHasAttribute(mutedAttr)) muted_ = true; } ",0 " static unsigned long get_seg_limit(struct pt_regs *regs, int seg_reg_idx) { struct desc_struct *desc; unsigned long limit; short sel; sel = get_segment_selector(regs, seg_reg_idx); if (sel < 0) return 0; if (user_64bit_mode(regs) || v8086_mode(regs)) return -1L; if (!sel) return 0; desc = get_desc(sel); if (!desc) return 0; /* * If the granularity bit is set, the limit is given in multiples * of 4096. This also means that the 12 least significant bits are * not tested when checking the segment limits. In practice, * this means that the segment ends in (limit << 12) + 0xfff. */ limit = get_desc_limit(desc); if (desc->g) limit = (limit << 12) + 0xfff; return limit; } ",1 "void RenderFrameHostImpl::MarkInitiatorsAsRequiringSeparateURLLoaderFactory( base::flat_set request_initiators, bool push_to_renderer_now) { size_t old_size = initiators_requiring_separate_url_loader_factory_.size(); initiators_requiring_separate_url_loader_factory_.insert( request_initiators.begin(), request_initiators.end()); size_t new_size = initiators_requiring_separate_url_loader_factory_.size(); bool insertion_took_place = (old_size != new_size); if (push_to_renderer_now && insertion_took_place && has_committed_any_navigation_) { std::unique_ptr subresource_loader_factories = std::make_unique(); subresource_loader_factories->initiator_specific_factory_infos() = CreateInitiatorSpecificURLLoaderFactories(request_initiators); GetNavigationControl()->UpdateSubresourceLoaderFactories( std::move(subresource_loader_factories)); } } ",0 "unsigned long long Track::GetUid() const { return m_info.uid; } ",0 "void TestingAutomationProvider::GetTabProcessID(int handle, int* process_id) { *process_id = -1; if (tab_tracker_->ContainsHandle(handle)) { *process_id = 0; WebContents* web_contents = tab_tracker_->GetResource(handle)->GetWebContents(); content::RenderProcessHost* rph = web_contents->GetRenderProcessHost(); if (rph) *process_id = base::GetProcId(rph->GetHandle()); } } ",0 "static int rfc4106_set_key(struct crypto_aead *parent, const u8 *key, unsigned int key_len) { int ret = 0; struct crypto_tfm *tfm = crypto_aead_tfm(parent); struct aesni_rfc4106_gcm_ctx *ctx = aesni_rfc4106_gcm_ctx_get(parent); struct crypto_aead *cryptd_child = cryptd_aead_child(ctx->cryptd_tfm); struct aesni_rfc4106_gcm_ctx *child_ctx = aesni_rfc4106_gcm_ctx_get(cryptd_child); u8 *new_key_align, *new_key_mem = NULL; if (key_len < 4) { crypto_tfm_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN); return -EINVAL; } /*Account for 4 byte nonce at the end.*/ key_len -= 4; if (key_len != AES_KEYSIZE_128 && key_len != AES_KEYSIZE_192 && key_len != AES_KEYSIZE_256) { crypto_tfm_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN); return -EINVAL; } memcpy(ctx->nonce, key + key_len, sizeof(ctx->nonce)); /*This must be on a 16 byte boundary!*/ if ((unsigned long)(&(ctx->aes_key_expanded.key_enc[0])) % AESNI_ALIGN) return -EINVAL; if ((unsigned long)key % AESNI_ALIGN) { /*key is not aligned: use an auxuliar aligned pointer*/ new_key_mem = kmalloc(key_len+AESNI_ALIGN, GFP_KERNEL); if (!new_key_mem) return -ENOMEM; new_key_align = PTR_ALIGN(new_key_mem, AESNI_ALIGN); memcpy(new_key_align, key, key_len); key = new_key_align; } if (!irq_fpu_usable()) ret = crypto_aes_expand_key(&(ctx->aes_key_expanded), key, key_len); else { kernel_fpu_begin(); ret = aesni_set_key(&(ctx->aes_key_expanded), key, key_len); kernel_fpu_end(); } /*This must be on a 16 byte boundary!*/ if ((unsigned long)(&(ctx->hash_subkey[0])) % AESNI_ALIGN) { ret = -EINVAL; goto exit; } ret = rfc4106_set_hash_subkey(ctx->hash_subkey, key, key_len); memcpy(child_ctx, ctx, sizeof(*ctx)); exit: kfree(new_key_mem); return ret; } ",0 " void Add(int original_content_length, int received_content_length) { AddInt64ToListPref( kNumDaysInHistory - 1, original_content_length, original_update_.Get()); AddInt64ToListPref( kNumDaysInHistory - 1, received_content_length, received_update_.Get()); } ",1 "gfx::Point OverlayWindowViews::resize_handle_position_for_testing() const { return resize_handle_view_->origin(); } ",0 "static MagickBooleanType ExpandHeap(size_t size) { DataSegmentInfo *segment_info; MagickBooleanType mapped; register ssize_t i; register void *block; size_t blocksize; void *segment; blocksize=((size+12*sizeof(size_t))+SegmentSize-1) & -SegmentSize; assert(memory_pool.number_segments < MaxSegments); segment=MapBlob(-1,IOMode,0,blocksize); mapped=segment != (void *) NULL ? MagickTrue : MagickFalse; if (segment == (void *) NULL) segment=(void *) memory_methods.acquire_memory_handler(blocksize); if (segment == (void *) NULL) return(MagickFalse); segment_info=(DataSegmentInfo *) free_segments; free_segments=segment_info->next; segment_info->mapped=mapped; segment_info->length=blocksize; segment_info->allocation=segment; segment_info->bound=(char *) segment+blocksize; i=(ssize_t) memory_pool.number_segments-1; for ( ; (i >= 0) && (memory_pool.segments[i]->allocation > segment); i--) memory_pool.segments[i+1]=memory_pool.segments[i]; memory_pool.segments[i+1]=segment_info; memory_pool.number_segments++; size=blocksize-12*sizeof(size_t); block=(char *) segment_info->allocation+4*sizeof(size_t); *BlockHeader(block)=size | PreviousBlockBit; *BlockFooter(block,size)=size; InsertFreeBlock(block,AllocationPolicy(size)); block=NextBlock(block); assert(block < segment_info->bound); *BlockHeader(block)=2*sizeof(size_t); *BlockHeader(NextBlock(block))=PreviousBlockBit; return(MagickTrue); } ",0 "R_API RConfigNode* r_config_set_cb(RConfig *cfg, const char *name, const char *value, RConfigCallback cb) { RConfigNode *node = r_config_set (cfg, name, value); if (node && (node->setter = cb)) { if (!cb (cfg->user, node)) { return NULL; } } return node; } ",0 "static void wake_up_partner(struct pipe_inode_info *pipe) { wake_up_interruptible(&pipe->wait); } ",0 "v8::Local DOMWindow::AssociateWithWrapper( v8::Isolate*, const WrapperTypeInfo*, v8::Local wrapper) { NOTREACHED(); return v8::Local(); } ",0 "void EnterpriseEnrollmentScreen::RegisterForDevicePolicy( const std::string& token, policy::BrowserPolicyConnector::TokenType token_type) { policy::BrowserPolicyConnector* connector = g_browser_process->browser_policy_connector(); if (!connector->device_cloud_policy_subsystem()) { NOTREACHED() << ""Cloud policy subsystem not initialized.""; UMA_HISTOGRAM_ENUMERATION(policy::kMetricEnrollment, policy::kMetricEnrollmentOtherFailed, policy::kMetricEnrollmentSize); if (is_showing_) actor_->ShowFatalEnrollmentError(); return; } connector->ScheduleServiceInitialization(0); registrar_.reset(new policy::CloudPolicySubsystem::ObserverRegistrar( connector->device_cloud_policy_subsystem(), this)); connector->SetDeviceCredentials(user_, token, token_type); } ",1 "brcmf_cfg80211_cancel_remain_on_channel(struct wiphy *wiphy, struct wireless_dev *wdev, u64 cookie) { struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); struct brcmf_cfg80211_vif *vif; int err = 0; brcmf_dbg(TRACE, ""Enter p2p listen cancel\n""); vif = cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif; if (vif == NULL) { brcmf_err(""No p2p device available for probe response\n""); err = -ENODEV; goto exit; } brcmf_p2p_cancel_remain_on_channel(vif->ifp); exit: return err; } ",0 "WebGLBuffer* WebGLRenderingContextBase::createBuffer() { if (isContextLost()) return nullptr; return WebGLBuffer::Create(this); } ",0 " static int netbk_count_requests(struct xenvif *vif, struct xen_netif_tx_request *first, struct xen_netif_tx_request *txp, int work_to_do) { RING_IDX cons = vif->tx.req_cons; int frags = 0; if (!(first->flags & XEN_NETTXF_more_data)) return 0; do { if (frags >= work_to_do) { netdev_dbg(vif->dev, ""Need more frags\n""); return -frags; } if (unlikely(frags >= MAX_SKB_FRAGS)) { netdev_dbg(vif->dev, ""Too many frags\n""); return -frags; } memcpy(txp, RING_GET_REQUEST(&vif->tx, cons + frags), sizeof(*txp)); if (txp->size > first->size) { netdev_dbg(vif->dev, ""Frags galore\n""); return -frags; } first->size -= txp->size; frags++; if (unlikely((txp->offset + txp->size) > PAGE_SIZE)) { netdev_dbg(vif->dev, ""txp->offset: %x, size: %u\n"", txp->offset, txp->size); return -frags; } } while ((txp++)->flags & XEN_NETTXF_more_data); return frags; } ",1 "static int aa_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) { AADemuxContext *c = s->priv_data; AVChapter *ch; int64_t chapter_pos, chapter_start, chapter_size; int chapter_idx = 0; if (timestamp < 0) timestamp = 0; while (chapter_idx < s->nb_chapters && timestamp >= s->chapters[chapter_idx]->end) { ++chapter_idx; } if (chapter_idx >= s->nb_chapters) { chapter_idx = s->nb_chapters - 1; if (chapter_idx < 0) return -1; // there is no chapter. timestamp = s->chapters[chapter_idx]->end; } ch = s->chapters[chapter_idx]; chapter_size = ch->end / TIMEPREC - ch->start / TIMEPREC; chapter_pos = av_rescale_rnd((timestamp - ch->start) / TIMEPREC, 1, c->codec_second_size, (flags & AVSEEK_FLAG_BACKWARD) ? AV_ROUND_DOWN : AV_ROUND_UP) * c->codec_second_size; if (chapter_pos >= chapter_size) chapter_pos = chapter_size; chapter_start = c->content_start + (ch->start / TIMEPREC) + CHAPTER_HEADER_SIZE * (1 + chapter_idx); avio_seek(s->pb, chapter_start + chapter_pos, SEEK_SET); c->current_codec_second_size = c->codec_second_size; c->current_chapter_size = chapter_size - chapter_pos; c->chapter_idx = 1 + chapter_idx; if (s->streams[0]->codecpar->codec_id == AV_CODEC_ID_MP3) { c->seek_offset = (MP3_FRAME_SIZE - chapter_pos % MP3_FRAME_SIZE) % MP3_FRAME_SIZE; } ff_update_cur_dts(s, s->streams[0], ch->start + (chapter_pos + c->seek_offset) * TIMEPREC); return 1; } ",0 "xfs_inode_ag_iterator_flags( struct xfs_mount *mp, int (*execute)(struct xfs_inode *ip, int flags, void *args), int flags, void *args, int iter_flags) { struct xfs_perag *pag; int error = 0; int last_error = 0; xfs_agnumber_t ag; ag = 0; while ((pag = xfs_perag_get(mp, ag))) { ag = pag->pag_agno + 1; error = xfs_inode_ag_walk(mp, pag, execute, flags, args, -1, iter_flags); xfs_perag_put(pag); if (error) { last_error = error; if (error == -EFSCORRUPTED) break; } } return last_error; } ",0 "bool PSIR_FileWriter::IsLegacyChanged() { if ( ! this->changed ) return false; if ( this->legacyDeleted ) return true; InternalRsrcMap::iterator irPos = this->imgRsrcs.begin(); InternalRsrcMap::iterator irEnd = this->imgRsrcs.end(); for ( ; irPos != irEnd; ++irPos ) { const InternalRsrcInfo & rsrcInfo = irPos->second; if ( rsrcInfo.changed && (rsrcInfo.id != kPSIR_XMP) ) return true; } return false; // Can get here if the XMP is the only thing changed. } // PSIR_FileWriter::IsLegacyChanged ",0 "static void mime_type_dtor(zval *zv) { free(Z_PTR_P(zv)); } ",0 "void SyncTest::SetProxyConfig(net::URLRequestContextGetter* context_getter, const net::ProxyConfig& proxy_config) { base::WaitableEvent done(false, false); BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind(&SetProxyConfigCallback, &done, make_scoped_refptr(context_getter), proxy_config)); done.Wait(); } ",0 "BaseSettingChange::DisplayName BaseSettingChange::GetApplyDisplayName() const { return DisplayName(kDefaultNamePriority, string16()); } ",0 "static int mif_hdr_growcmpts(mif_hdr_t *hdr, int maxcmpts) { int cmptno; mif_cmpt_t **newcmpts; assert(maxcmpts >= hdr->numcmpts); newcmpts = (!hdr->cmpts) ? jas_malloc(maxcmpts * sizeof(mif_cmpt_t *)) : jas_realloc(hdr->cmpts, maxcmpts * sizeof(mif_cmpt_t *)); if (!newcmpts) { return -1; } hdr->maxcmpts = maxcmpts; hdr->cmpts = newcmpts; for (cmptno = hdr->numcmpts; cmptno < hdr->maxcmpts; ++cmptno) { hdr->cmpts[cmptno] = 0; } return 0; } ",0 "megasas_disable_intr_skinny(struct megasas_instance *instance) { struct megasas_register_set __iomem *regs; u32 mask = 0xFFFFFFFF; regs = instance->reg_set; writel(mask, ®s->outbound_intr_mask); /* Dummy readl to force pci flush */ readl(®s->outbound_intr_mask); } ",0 "size_t DataReductionProxyConfig::GetWarmupURLFetchAttemptCounts() const { DCHECK(thread_checker_.CalledOnValidThread()); return network_properties_manager_->GetWarmupURLFetchAttemptCounts( warmup_url_fetch_in_flight_secure_proxy_, warmup_url_fetch_in_flight_core_proxy_); } ",0 "void capture_headers(char *som, struct hdr_idx *idx, char **cap, struct cap_hdr *cap_hdr) { char *eol, *sol, *col, *sov; int cur_idx; struct cap_hdr *h; int len; sol = som + hdr_idx_first_pos(idx); cur_idx = hdr_idx_first_idx(idx); while (cur_idx) { eol = sol + idx->v[cur_idx].len; col = sol; while (col < eol && *col != ':') col++; sov = col + 1; while (sov < eol && HTTP_IS_LWS(*sov)) sov++; for (h = cap_hdr; h; h = h->next) { if (h->namelen && (h->namelen == col - sol) && (strncasecmp(sol, h->name, h->namelen) == 0)) { if (cap[h->index] == NULL) cap[h->index] = pool_alloc(h->pool); if (cap[h->index] == NULL) { ha_alert(""HTTP capture : out of memory.\n""); continue; } len = eol - sov; if (len > h->len) len = h->len; memcpy(cap[h->index], sov, len); cap[h->index][len]=0; } } sol = eol + idx->v[cur_idx].cr + 1; cur_idx = idx->v[cur_idx].next; } } ",0 "IW_IMPL(int) iw_process_image(struct iw_context *ctx) { int ret; int retval = 0; if(ctx->use_count>0) { iw_set_error(ctx,""Internal: Incorrect attempt to reprocess image""); goto done; } ctx->use_count++; ret = iw_prepare_processing(ctx,ctx->canvas_width,ctx->canvas_height); if(!ret) goto done; ret = iw_process_internal(ctx); if(!ret) goto done; iwpvt_optimize_image(ctx); retval = 1; done: return retval; } ",0 "dual_timestamp* dual_timestamp_get(dual_timestamp *ts) { assert(ts); ts->realtime = now(CLOCK_REALTIME); ts->monotonic = now(CLOCK_MONOTONIC); return ts; } ",0 "void Job::DoDnsOperation() { CheckIsOnOriginThread(); DCHECK(!pending_dns_); if (cancelled_.IsSet()) return; HostResolver::RequestHandle dns_request = NULL; int result = host_resolver()->Resolve( MakeDnsRequestInfo(pending_dns_host_, pending_dns_op_), DEFAULT_PRIORITY, &pending_dns_addresses_, base::Bind(&Job::OnDnsOperationComplete, this), &dns_request, bindings_->GetBoundNetLog()); pending_dns_completed_synchronously_ = result != ERR_IO_PENDING; if (cancelled_.IsSet()) return; if (pending_dns_completed_synchronously_) { OnDnsOperationComplete(result); } else { DCHECK(dns_request); pending_dns_ = dns_request; } if (!blocking_dns_) { event_.Signal(); } } ",0 "void debugfs_remove(struct dentry *dentry) { struct dentry *parent; int ret; if (IS_ERR_OR_NULL(dentry)) return; parent = dentry->d_parent; inode_lock(d_inode(parent)); ret = __debugfs_remove(dentry, parent); inode_unlock(d_inode(parent)); if (!ret) simple_release_fs(&debugfs_mount, &debugfs_mount_count); synchronize_srcu(&debugfs_srcu); } ",0 "void HTMLTextAreaElement::updateValue() const { if (formControlValueMatchesRenderer()) return; ASSERT(renderer()); m_value = innerTextValue(); const_cast(this)->setFormControlValueMatchesRenderer(true); const_cast(this)->notifyFormStateChanged(); m_isDirty = true; const_cast(this)->updatePlaceholderVisibility(false); } ",0 "X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose) { return X509_PURPOSE_set(¶m->purpose, purpose); } ",0 "static void ftrace_startup_sysctl(void) { if (unlikely(ftrace_disabled)) return; /* Force update next time */ saved_ftrace_func = NULL; /* ftrace_start_up is true if we want ftrace running */ if (ftrace_start_up) ftrace_run_update_code(FTRACE_UPDATE_CALLS); } ",0 "int check_intra_pred4x4_mode_emuedge(int mode, int mb_x, int mb_y, int *copy_buf, int vp7) { switch (mode) { case VERT_PRED: if (!mb_x && mb_y) { *copy_buf = 1; return mode; } /* fall-through */ case DIAG_DOWN_LEFT_PRED: case VERT_LEFT_PRED: return !mb_y ? (vp7 ? DC_128_PRED : DC_127_PRED) : mode; case HOR_PRED: if (!mb_y) { *copy_buf = 1; return mode; } /* fall-through */ case HOR_UP_PRED: return !mb_x ? (vp7 ? DC_128_PRED : DC_129_PRED) : mode; case TM_VP8_PRED: return check_tm_pred4x4_mode(mode, mb_x, mb_y, vp7); case DC_PRED: /* 4x4 DC doesn't use the same ""H.264-style"" exceptions * as 16x16/8x8 DC */ case DIAG_DOWN_RIGHT_PRED: case VERT_RIGHT_PRED: case HOR_DOWN_PRED: if (!mb_y || !mb_x) *copy_buf = 1; return mode; } return mode; } ",0 "int gdImageColorClosestAlpha (gdImagePtr im, int r, int g, int b, int a) { int i; long rd, gd, bd, ad; int ct = (-1); int first = 1; long mindist = 0; if (im->trueColor) { return gdTrueColorAlpha(r, g, b, a); } for (i = 0; i < im->colorsTotal; i++) { long dist; if (im->open[i]) { continue; } rd = im->red[i] - r; gd = im->green[i] - g; bd = im->blue[i] - b; /* gd 2.02: whoops, was - b (thanks to David Marwood) */ ad = im->alpha[i] - a; dist = rd * rd + gd * gd + bd * bd + ad * ad; if (first || (dist < mindist)) { mindist = dist; ct = i; first = 0; } } return ct; } ",0 " void RecordInitialHistogramSnapshots( base::HistogramSnapshotManager* snapshot_manager) { provider()->RecordInitialHistogramSnapshots(snapshot_manager); } ",0 "static void v9fs_flush(void *opaque) { ssize_t err; int16_t tag; size_t offset = 7; V9fsPDU *cancel_pdu; V9fsPDU *pdu = opaque; V9fsState *s = pdu->s; err = pdu_unmarshal(pdu, offset, ""w"", &tag); if (err < 0) { pdu_complete(pdu, err); return; } trace_v9fs_flush(pdu->tag, pdu->id, tag); QLIST_FOREACH(cancel_pdu, &s->active_list, next) { if (cancel_pdu->tag == tag) { break; } } if (cancel_pdu) { cancel_pdu->cancelled = 1; /* * Wait for pdu to complete. */ qemu_co_queue_wait(&cancel_pdu->complete); cancel_pdu->cancelled = 0; pdu_free(cancel_pdu); } pdu_complete(pdu, 7); } ",0 "static inline signed short ReadPropertySignedShort(const EndianType endian, const unsigned char *buffer) { union { unsigned short unsigned_value; signed short signed_value; } quantum; unsigned short value; if (endian == LSBEndian) { value=(unsigned short) buffer[1] << 8; value|=(unsigned short) buffer[0]; quantum.unsigned_value=value & 0xffff; return(quantum.signed_value); } value=(unsigned short) buffer[0] << 8; value|=(unsigned short) buffer[1]; quantum.unsigned_value=value & 0xffff; return(quantum.signed_value); } ",0 "void machine_halt(void) { machine_shutdown(); local_irq_disable(); while (1); } ",0 "bool MediaStreamManager::SetupScreenCaptureRequest(DeviceRequest* request) { DCHECK(request->audio_type() == MEDIA_DESKTOP_AUDIO_CAPTURE || request->video_type() == MEDIA_DESKTOP_VIDEO_CAPTURE); if (request->video_type() != MEDIA_DESKTOP_VIDEO_CAPTURE || (request->audio_type() != MEDIA_NO_SERVICE && request->audio_type() != MEDIA_DESKTOP_AUDIO_CAPTURE)) { LOG(ERROR) << ""Invalid screen capture request.""; return false; } std::string video_device_id; if (request->video_type() == MEDIA_DESKTOP_VIDEO_CAPTURE) { const std::string& video_stream_source = request->controls.video.stream_source; if (video_stream_source == kMediaStreamSourceDesktop && !request->controls.video.device_id.empty()) { video_device_id = request->controls.video.device_id; } } const std::string audio_device_id = request->audio_type() == MEDIA_DESKTOP_AUDIO_CAPTURE ? video_device_id : """"; request->CreateUIRequest(audio_device_id, video_device_id); return true; } ",0 "void GraphicsSurface::platformDestroy() { if (m_texture) { pGlXReleaseTexImageEXT(m_private->display(), m_private->glxPixmap(), GLX_FRONT_EXT); glDeleteTextures(1, &m_texture); } delete m_private; m_private = 0; } ",0 "void __weak arch_perf_update_userpage(struct perf_event_mmap_page *userpg, u64 now) { } ",0 "ACTION_P(RunClosure, closure) { closure.Run(); } ",0 " virtual ~PowerManagerClientObserverForTesting() {} ",0 "static int tg3_mdio_read(struct mii_bus *bp, int mii_id, int reg) { struct tg3 *tp = bp->priv; u32 val; spin_lock_bh(&tp->lock); if (tg3_readphy(tp, reg, &val)) val = -EIO; spin_unlock_bh(&tp->lock); return val; } ",0 "bool HTMLFormControlElement::checkValidity(WillBeHeapVector>* unhandledInvalidControls, CheckValidityEventBehavior eventBehavior) { if (isValidElement()) return true; if (eventBehavior != CheckValidityDispatchInvalidEvent) return false; RefPtrWillBeRawPtr protector(this); RefPtrWillBeRawPtr originalDocument(document()); bool needsDefaultAction = dispatchEvent(Event::createCancelable(EventTypeNames::invalid)); if (needsDefaultAction && unhandledInvalidControls && inDocument() && originalDocument == document()) unhandledInvalidControls->append(this); return false; } ",0 "static void voidMethodEnforceRangeLongArgMethodCallback(const v8::FunctionCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMMethod""); TestObjectPythonV8Internal::voidMethodEnforceRangeLongArgMethod(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "static bool __munlock_isolate_lru_page(struct page *page, bool getpage) { if (PageLRU(page)) { struct lruvec *lruvec; lruvec = mem_cgroup_page_lruvec(page, page_zone(page)); if (getpage) get_page(page); ClearPageLRU(page); del_page_from_lru_list(page, lruvec, page_lru(page)); return true; } return false; } ",0 "LRESULT InputMethodIMM32::OnImeSetContext(HWND window_handle, UINT message, WPARAM wparam, LPARAM lparam, BOOL* handled) { if (!!wparam) imm32_manager_.CreateImeWindow(window_handle); OnInputMethodChanged(); return imm32_manager_.SetImeWindowStyle( window_handle, message, wparam, lparam, handled); } ",0 "int init_uinput (void) { char *name = ""AVRCP""; BTIF_TRACE_DEBUG(""%s"", __FUNCTION__); uinput_fd = uinput_create(name); if (uinput_fd < 0) { BTIF_TRACE_ERROR(""%s AVRCP: Failed to initialize uinput for %s (%d)"", __FUNCTION__, name, uinput_fd); } else { BTIF_TRACE_DEBUG(""%s AVRCP: Initialized uinput for %s (fd=%d)"", __FUNCTION__, name, uinput_fd); } return uinput_fd; } ",0 "get_op_array(const gs_memory_t *mem, int size) { gs_main_instance *minst = get_minst_from_memory(mem); return op_index_op_array_table(minst->i_ctx_p,size); } ",0 "void proto_unregister(struct proto *prot) { mutex_lock(&proto_list_mutex); release_proto_idx(prot); list_del(&prot->node); mutex_unlock(&proto_list_mutex); if (prot->slab != NULL) { kmem_cache_destroy(prot->slab); prot->slab = NULL; } if (prot->rsk_prot != NULL && prot->rsk_prot->slab != NULL) { kmem_cache_destroy(prot->rsk_prot->slab); kfree(prot->rsk_prot->slab_name); prot->rsk_prot->slab = NULL; } if (prot->twsk_prot != NULL && prot->twsk_prot->twsk_slab != NULL) { kmem_cache_destroy(prot->twsk_prot->twsk_slab); kfree(prot->twsk_prot->twsk_slab_name); prot->twsk_prot->twsk_slab = NULL; } } ",0 "void DownloadManagerImpl::OnDownloadCreated( std::unique_ptr download) { DCHECK(!base::ContainsKey(downloads_, download->GetId())); DCHECK(!base::ContainsKey(downloads_by_guid_, download->GetGuid())); download::DownloadItemImpl* item = download.get(); downloads_[item->GetId()] = std::move(download); downloads_by_guid_[item->GetGuid()] = item; for (auto& observer : observers_) observer.OnDownloadCreated(this, item); DVLOG(20) << __func__ << ""() download = "" << item->DebugString(true); } ",0 "my_object_get_objs (MyObject *obj, GPtrArray **objs, GError **error) { *objs = g_ptr_array_new (); g_ptr_array_add (*objs, g_strdup (""/org/freedesktop/DBus/GLib/Tests/MyTestObject"")); g_ptr_array_add (*objs, g_strdup (""/org/freedesktop/DBus/GLib/Tests/MyTestObject2"")); return TRUE; } ",1 "static unsigned char* ensure(printbuffer * const p, size_t needed) { unsigned char *newbuffer = NULL; size_t newsize = 0; if ((p == NULL) || (p->buffer == NULL)) { return NULL; } if ((p->length > 0) && (p->offset >= p->length)) { /* make sure that offset is valid */ return NULL; } if (needed > INT_MAX) { /* sizes bigger than INT_MAX are currently not supported */ return NULL; } needed += p->offset + 1; if (needed <= p->length) { return p->buffer + p->offset; } if (p->noalloc) { return NULL; } /* calculate new buffer size */ if (needed > (INT_MAX / 2)) { /* overflow of int, use INT_MAX if possible */ if (needed <= INT_MAX) { newsize = INT_MAX; } else { return NULL; } } else { newsize = needed * 2; } if (p->hooks.reallocate != NULL) { /* reallocate with realloc if available */ newbuffer = (unsigned char*)p->hooks.reallocate(p->buffer, newsize); if (newbuffer == NULL) { p->hooks.deallocate(p->buffer); p->length = 0; p->buffer = NULL; return NULL; } } else { /* otherwise reallocate manually */ newbuffer = (unsigned char*)p->hooks.allocate(newsize); if (!newbuffer) { p->hooks.deallocate(p->buffer); p->length = 0; p->buffer = NULL; return NULL; } if (newbuffer) { memcpy(newbuffer, p->buffer, p->offset + 1); } p->hooks.deallocate(p->buffer); } p->length = newsize; p->buffer = newbuffer; return newbuffer + p->offset; } ",0 "DownloadFileManager::~DownloadFileManager() { DCHECK(downloads_.empty()); } ",0 "_dbus_connect_tcp_socket_with_nonce (const char *host, const char *port, const char *family, const char *noncefile, DBusError *error) { int saved_errno = 0; int fd = -1, res; struct addrinfo hints; struct addrinfo *ai, *tmp; _DBUS_ASSERT_ERROR_IS_CLEAR(error); _DBUS_ZERO (hints); if (!family) hints.ai_family = AF_UNSPEC; else if (!strcmp(family, ""ipv4"")) hints.ai_family = AF_INET; else if (!strcmp(family, ""ipv6"")) hints.ai_family = AF_INET6; else { dbus_set_error (error, DBUS_ERROR_BAD_ADDRESS, ""Unknown address family %s"", family); return -1; } hints.ai_protocol = IPPROTO_TCP; hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_ADDRCONFIG; if ((res = getaddrinfo(host, port, &hints, &ai)) != 0) { dbus_set_error (error, _dbus_error_from_errno (errno), ""Failed to lookup host/port: \""%s:%s\"": %s (%d)"", host, port, gai_strerror(res), res); return -1; } tmp = ai; while (tmp) { if (!_dbus_open_socket (&fd, tmp->ai_family, SOCK_STREAM, 0, error)) { freeaddrinfo(ai); _DBUS_ASSERT_ERROR_IS_SET(error); return -1; } _DBUS_ASSERT_ERROR_IS_CLEAR(error); if (connect (fd, (struct sockaddr*) tmp->ai_addr, tmp->ai_addrlen) < 0) { saved_errno = errno; _dbus_close(fd, NULL); fd = -1; tmp = tmp->ai_next; continue; } break; } freeaddrinfo(ai); if (fd == -1) { dbus_set_error (error, _dbus_error_from_errno (saved_errno), ""Failed to connect to socket \""%s:%s\"" %s"", host, port, _dbus_strerror(saved_errno)); return -1; } if (noncefile != NULL) { DBusString noncefileStr; dbus_bool_t ret; _dbus_string_init_const (&noncefileStr, noncefile); ret = _dbus_send_nonce (fd, &noncefileStr, error); _dbus_string_free (&noncefileStr); if (!ret) { _dbus_close (fd, NULL); return -1; } } if (!_dbus_set_fd_nonblocking (fd, error)) { _dbus_close (fd, NULL); return -1; } return fd; } ",0 " event_help( void ) { grEvent dummy_event; FTDemo_Display_Clear( display ); grGotoxy( 0, 0 ); grSetMargin( 2, 1 ); grGotobitmap( display->bitmap ); grWriteln( ""FreeType String Viewer - part of the FreeType test suite"" ); grLn(); grWriteln( ""This program is used to display a string of text using"" ); grWriteln( ""the new convenience API of the FreeType 2 library."" ); grLn(); grWriteln( ""Use the following keys :"" ); grLn(); grWriteln( "" F1 or ? : display this help screen"" ); grLn(); grWriteln( "" a : toggle anti-aliasing"" ); grWriteln( "" b : toggle embedded bitmaps (and disable rotation)"" ); grWriteln( "" f : toggle forced auto-hinting"" ); grWriteln( "" h : toggle outline hinting"" ); grWriteln( "" l : toggle low precision rendering"" ); grLn(); grWriteln( "" 1-2 : select rendering mode"" ); grWriteln( "" k : cycle through kerning modes"" ); grWriteln( "" t : cycle through kerning degrees"" ); grWriteln( "" V : toggle vertical rendering"" ); grLn(); grWriteln( "" G : toggle gamma correction"" ); grWriteln( "" g : increase gamma by 0.1"" ); grWriteln( "" v : decrease gamma by 0.1"" ); grLn(); grWriteln( "" n : next font"" ); grWriteln( "" p : previous font"" ); grLn(); grWriteln( "" Up : increase pointsize by 1 unit"" ); grWriteln( "" Down : decrease pointsize by 1 unit"" ); grWriteln( "" Page Up : increase pointsize by 10 units"" ); grWriteln( "" Page Down : decrease pointsize by 10 units"" ); grLn(); grWriteln( "" Right : rotate counter-clockwise"" ); grWriteln( "" Left : rotate clockwise"" ); grWriteln( "" F7 : big rotate counter-clockwise"" ); grWriteln( "" F8 : big rotate clockwise"" ); grLn(); grLn(); grWriteln( ""press any key to exit this help screen"" ); grRefreshSurface( display->surface ); grListenSurface( display->surface, gr_event_key, &dummy_event ); } ",0 "free_config_nic_rules( config_tree *ptree ) { nic_rule_node *curr_node; if (ptree->nic_rules != NULL) { while (1) { UNLINK_FIFO(curr_node, *ptree->nic_rules, link); if (NULL == curr_node) break; if (curr_node->if_name != NULL) free(curr_node->if_name); free(curr_node); } free(ptree->nic_rules); ptree->nic_rules = NULL; } } ",0 "static int ctr_crypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) { return glue_ctr_crypt_128bit(&cast6_ctr, desc, dst, src, nbytes); } ",0 "int __btrfs_setxattr(struct btrfs_trans_handle *trans, struct inode *inode, const char *name, const void *value, size_t size, int flags) { struct btrfs_root *root = BTRFS_I(inode)->root; int ret; if (trans) return do_setxattr(trans, inode, name, value, size, flags); trans = btrfs_start_transaction(root, 2); if (IS_ERR(trans)) return PTR_ERR(trans); ret = do_setxattr(trans, inode, name, value, size, flags); if (ret) goto out; inode_inc_iversion(inode); inode->i_ctime = CURRENT_TIME; set_bit(BTRFS_INODE_COPY_EVERYTHING, &BTRFS_I(inode)->runtime_flags); ret = btrfs_update_inode(trans, root, inode); BUG_ON(ret); out: btrfs_end_transaction(trans, root); return ret; } ",0 "static const struct k_clock *clockid_to_kclock(const clockid_t id) { clockid_t idx = id; if (id < 0) { return (id & CLOCKFD_MASK) == CLOCKFD ? &clock_posix_dynamic : &clock_posix_cpu; } if (id >= ARRAY_SIZE(posix_clocks)) return NULL; return posix_clocks[array_index_nospec(idx, ARRAY_SIZE(posix_clocks))]; } ",0 "int ecryptfs_compute_root_iv(struct ecryptfs_crypt_stat *crypt_stat) { int rc = 0; char dst[MD5_DIGEST_SIZE]; BUG_ON(crypt_stat->iv_bytes > MD5_DIGEST_SIZE); BUG_ON(crypt_stat->iv_bytes <= 0); if (!(crypt_stat->flags & ECRYPTFS_KEY_VALID)) { rc = -EINVAL; ecryptfs_printk(KERN_WARNING, ""Session key not valid; "" ""cannot generate root IV\n""); goto out; } rc = ecryptfs_calculate_md5(dst, crypt_stat, crypt_stat->key, crypt_stat->key_size); if (rc) { ecryptfs_printk(KERN_WARNING, ""Error attempting to compute "" ""MD5 while generating root IV\n""); goto out; } memcpy(crypt_stat->root_iv, dst, crypt_stat->iv_bytes); out: if (rc) { memset(crypt_stat->root_iv, 0, crypt_stat->iv_bytes); crypt_stat->flags |= ECRYPTFS_SECURITY_WARNING; } return rc; } ",0 "static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, struct request_sock *req, struct dst_entry *dst) { struct inet6_request_sock *treq; struct ipv6_pinfo *newnp, *np = inet6_sk(sk); struct tcp6_sock *newtcp6sk; struct inet_sock *newinet; struct tcp_sock *newtp; struct sock *newsk; struct ipv6_txoptions *opt; #ifdef CONFIG_TCP_MD5SIG struct tcp_md5sig_key *key; #endif if (skb->protocol == htons(ETH_P_IP)) { /* * v6 mapped */ newsk = tcp_v4_syn_recv_sock(sk, skb, req, dst); if (newsk == NULL) return NULL; newtcp6sk = (struct tcp6_sock *)newsk; inet_sk(newsk)->pinet6 = &newtcp6sk->inet6; newinet = inet_sk(newsk); newnp = inet6_sk(newsk); newtp = tcp_sk(newsk); memcpy(newnp, np, sizeof(struct ipv6_pinfo)); ipv6_addr_set_v4mapped(newinet->inet_daddr, &newnp->daddr); ipv6_addr_set_v4mapped(newinet->inet_saddr, &newnp->saddr); ipv6_addr_copy(&newnp->rcv_saddr, &newnp->saddr); inet_csk(newsk)->icsk_af_ops = &ipv6_mapped; newsk->sk_backlog_rcv = tcp_v4_do_rcv; #ifdef CONFIG_TCP_MD5SIG newtp->af_specific = &tcp_sock_ipv6_mapped_specific; #endif newnp->pktoptions = NULL; newnp->opt = NULL; newnp->mcast_oif = inet6_iif(skb); newnp->mcast_hops = ipv6_hdr(skb)->hop_limit; /* * No need to charge this sock to the relevant IPv6 refcnt debug socks count * here, tcp_create_openreq_child now does this for us, see the comment in * that function for the gory details. -acme */ /* It is tricky place. Until this moment IPv4 tcp worked with IPv6 icsk.icsk_af_ops. Sync it now. */ tcp_sync_mss(newsk, inet_csk(newsk)->icsk_pmtu_cookie); return newsk; } treq = inet6_rsk(req); opt = np->opt; if (sk_acceptq_is_full(sk)) goto out_overflow; if (!dst) { dst = inet6_csk_route_req(sk, req); if (!dst) goto out; } newsk = tcp_create_openreq_child(sk, req, skb); if (newsk == NULL) goto out_nonewsk; /* * No need to charge this sock to the relevant IPv6 refcnt debug socks * count here, tcp_create_openreq_child now does this for us, see the * comment in that function for the gory details. -acme */ newsk->sk_gso_type = SKB_GSO_TCPV6; __ip6_dst_store(newsk, dst, NULL, NULL); newtcp6sk = (struct tcp6_sock *)newsk; inet_sk(newsk)->pinet6 = &newtcp6sk->inet6; newtp = tcp_sk(newsk); newinet = inet_sk(newsk); newnp = inet6_sk(newsk); memcpy(newnp, np, sizeof(struct ipv6_pinfo)); ipv6_addr_copy(&newnp->daddr, &treq->rmt_addr); ipv6_addr_copy(&newnp->saddr, &treq->loc_addr); ipv6_addr_copy(&newnp->rcv_saddr, &treq->loc_addr); newsk->sk_bound_dev_if = treq->iif; /* Now IPv6 options... First: no IPv4 options. */ newinet->opt = NULL; newnp->ipv6_fl_list = NULL; /* Clone RX bits */ newnp->rxopt.all = np->rxopt.all; /* Clone pktoptions received with SYN */ newnp->pktoptions = NULL; if (treq->pktopts != NULL) { newnp->pktoptions = skb_clone(treq->pktopts, GFP_ATOMIC); kfree_skb(treq->pktopts); treq->pktopts = NULL; if (newnp->pktoptions) skb_set_owner_r(newnp->pktoptions, newsk); } newnp->opt = NULL; newnp->mcast_oif = inet6_iif(skb); newnp->mcast_hops = ipv6_hdr(skb)->hop_limit; /* Clone native IPv6 options from listening socket (if any) Yes, keeping reference count would be much more clever, but we make one more one thing there: reattach optmem to newsk. */ if (opt) { newnp->opt = ipv6_dup_options(newsk, opt); if (opt != np->opt) sock_kfree_s(sk, opt, opt->tot_len); } inet_csk(newsk)->icsk_ext_hdr_len = 0; if (newnp->opt) inet_csk(newsk)->icsk_ext_hdr_len = (newnp->opt->opt_nflen + newnp->opt->opt_flen); tcp_mtup_init(newsk); tcp_sync_mss(newsk, dst_mtu(dst)); newtp->advmss = dst_metric_advmss(dst); tcp_initialize_rcv_mss(newsk); newinet->inet_daddr = newinet->inet_saddr = LOOPBACK4_IPV6; newinet->inet_rcv_saddr = LOOPBACK4_IPV6; #ifdef CONFIG_TCP_MD5SIG /* Copy over the MD5 key from the original socket */ if ((key = tcp_v6_md5_do_lookup(sk, &newnp->daddr)) != NULL) { /* We're using one, so create a matching key * on the newsk structure. If we fail to get * memory, then we end up not copying the key * across. Shucks. */ char *newkey = kmemdup(key->key, key->keylen, GFP_ATOMIC); if (newkey != NULL) tcp_v6_md5_do_add(newsk, &newnp->daddr, newkey, key->keylen); } #endif if (__inet_inherit_port(sk, newsk) < 0) { sock_put(newsk); goto out; } __inet6_hash(newsk, NULL); return newsk; out_overflow: NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENOVERFLOWS); out_nonewsk: if (opt && opt != np->opt) sock_kfree_s(sk, opt, opt->tot_len); dst_release(dst); out: NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS); return NULL; } ",1 "void CrosMock::InitMockTouchpadLibrary() { InitMockLibraryLoader(); if (mock_touchpad_library_) return; mock_touchpad_library_ = new StrictMock(); test_api()->SetTouchpadLibrary(mock_touchpad_library_, true); } ",0 "bool Document::IsTrustedTypesEnabledForDoc() const { return SecurityContext::RequireTrustedTypes() && origin_trials::TrustedDOMTypesEnabled(this); } ",0 "void WebGL2RenderingContextBase::uniform4fv( const WebGLUniformLocation* location, Vector& v, GLuint src_offset, GLuint src_length) { if (isContextLost() || !ValidateUniformParameters(""uniform4fv"", location, v.data(), v.size(), 4, src_offset, src_length)) return; ContextGL()->Uniform4fv( location->Location(), (src_length ? src_length : (v.size() - src_offset)) >> 2, v.data() + src_offset); } ",0 "static int parse_public_key(const u8 *key, size_t keysize, RSA *rsa) { const u8 *p = key; BIGNUM *n, *e; int base; base = (keysize - 7) / 5; if (base != 32 && base != 48 && base != 64 && base != 128) { fprintf(stderr, ""Invalid public key.\n""); return -1; } p += 3; n = BN_new(); if (n == NULL) return -1; cf2bn(p, 2 * base, n); p += 2 * base; p += base; p += 2 * base; e = BN_new(); if (e == NULL) return -1; cf2bn(p, 4, e); if (RSA_set0_key(rsa, n, e, NULL) != 1) return -1; return 0; } ",0 " explicit GetRegistrationForReadyCallback(ReadyProperty* ready) : m_ready(ready) { } ",0 "static int comedi_mmap(struct file *file, struct vm_area_struct *vma) { const unsigned minor = iminor(file->f_dentry->d_inode); struct comedi_device_file_info *dev_file_info = comedi_get_device_file_info(minor); struct comedi_device *dev = dev_file_info->device; struct comedi_async *async = NULL; unsigned long start = vma->vm_start; unsigned long size; int n_pages; int i; int retval; struct comedi_subdevice *s; mutex_lock(&dev->mutex); if (!dev->attached) { DPRINTK(""no driver configured on comedi%i\n"", dev->minor); retval = -ENODEV; goto done; } if (vma->vm_flags & VM_WRITE) s = comedi_get_write_subdevice(dev_file_info); else s = comedi_get_read_subdevice(dev_file_info); if (s == NULL) { retval = -EINVAL; goto done; } async = s->async; if (async == NULL) { retval = -EINVAL; goto done; } if (vma->vm_pgoff != 0) { DPRINTK(""comedi: mmap() offset must be 0.\n""); retval = -EINVAL; goto done; } size = vma->vm_end - vma->vm_start; if (size > async->prealloc_bufsz) { retval = -EFAULT; goto done; } if (size & (~PAGE_MASK)) { retval = -EFAULT; goto done; } n_pages = size >> PAGE_SHIFT; for (i = 0; i < n_pages; ++i) { if (remap_pfn_range(vma, start, page_to_pfn(virt_to_page (async->buf_page_list [i].virt_addr)), PAGE_SIZE, PAGE_SHARED)) { retval = -EAGAIN; goto done; } start += PAGE_SIZE; } vma->vm_ops = &comedi_vm_ops; vma->vm_private_data = async; async->mmap_count++; retval = 0; done: mutex_unlock(&dev->mutex); return retval; } ",0 "static void cleanup_single_sta(struct sta_info *sta) { int ac, i; struct tid_ampdu_tx *tid_tx; struct ieee80211_sub_if_data *sdata = sta->sdata; struct ieee80211_local *local = sdata->local; struct ps_data *ps; if (test_sta_flag(sta, WLAN_STA_PS_STA)) { if (sta->sdata->vif.type == NL80211_IFTYPE_AP || sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN) ps = &sdata->bss->ps; else if (ieee80211_vif_is_mesh(&sdata->vif)) ps = &sdata->u.mesh.ps; else return; clear_sta_flag(sta, WLAN_STA_PS_STA); atomic_dec(&ps->num_sta_ps); sta_info_recalc_tim(sta); } for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { local->total_ps_buffered -= skb_queue_len(&sta->ps_tx_buf[ac]); ieee80211_purge_tx_queue(&local->hw, &sta->ps_tx_buf[ac]); ieee80211_purge_tx_queue(&local->hw, &sta->tx_filtered[ac]); } if (ieee80211_vif_is_mesh(&sdata->vif)) mesh_sta_cleanup(sta); cancel_work_sync(&sta->drv_unblock_wk); /* * Destroy aggregation state here. It would be nice to wait for the * driver to finish aggregation stop and then clean up, but for now * drivers have to handle aggregation stop being requested, followed * directly by station destruction. */ for (i = 0; i < IEEE80211_NUM_TIDS; i++) { kfree(sta->ampdu_mlme.tid_start_tx[i]); tid_tx = rcu_dereference_raw(sta->ampdu_mlme.tid_tx[i]); if (!tid_tx) continue; ieee80211_purge_tx_queue(&local->hw, &tid_tx->pending); kfree(tid_tx); } sta_info_free(local, sta); } ",0 "void WebMediaPlayerImpl::Paint(cc::PaintCanvas* canvas, const blink::WebRect& rect, cc::PaintFlags& flags, int already_uploaded_id, VideoFrameUploadMetadata* out_metadata) { DCHECK(main_task_runner_->BelongsToCurrentThread()); TRACE_EVENT0(""media"", ""WebMediaPlayerImpl:paint""); if (cdm_context_ref_) return; scoped_refptr video_frame = GetCurrentFrameFromCompositor(); gfx::Rect gfx_rect(rect); Context3D context_3d; if (video_frame.get() && video_frame->HasTextures()) { if (context_provider_) { context_3d = Context3D(context_provider_->ContextGL(), context_provider_->GrContext()); } if (!context_3d.gl) return; // Unable to get/create a shared main thread context. if (!context_3d.gr_context) return; // The context has been lost since and can't setup a GrContext. } if (out_metadata && video_frame) { ComputeFrameUploadMetadata(video_frame.get(), already_uploaded_id, out_metadata); if (out_metadata->skipped) { return; } } video_renderer_.Paint( video_frame, canvas, gfx::RectF(gfx_rect), flags, pipeline_metadata_.video_decoder_config.video_rotation(), context_3d); } ",0 "static void coroutine_fn v9fs_write(void *opaque) { ssize_t err; int32_t fid; uint64_t off; uint32_t count; int32_t len = 0; int32_t total = 0; size_t offset = 7; V9fsFidState *fidp; V9fsPDU *pdu = opaque; V9fsState *s = pdu->s; QEMUIOVector qiov_full; QEMUIOVector qiov; err = pdu_unmarshal(pdu, offset, ""dqd"", &fid, &off, &count); if (err < 0) { pdu_complete(pdu, err); return; } offset += err; v9fs_init_qiov_from_pdu(&qiov_full, pdu, offset, count, true); trace_v9fs_write(pdu->tag, pdu->id, fid, off, count, qiov_full.niov); fidp = get_fid(pdu, fid); if (fidp == NULL) { err = -EINVAL; goto out_nofid; } if (fidp->fid_type == P9_FID_FILE) { if (fidp->fs.fd == -1) { err = -EINVAL; goto out; } } else if (fidp->fid_type == P9_FID_XATTR) { /* * setxattr operation */ err = v9fs_xattr_write(s, pdu, fidp, off, count, qiov_full.iov, qiov_full.niov); goto out; } else { err = -EINVAL; goto out; } qemu_iovec_init(&qiov, qiov_full.niov); do { qemu_iovec_reset(&qiov); qemu_iovec_concat(&qiov, &qiov_full, total, qiov_full.size - total); if (0) { print_sg(qiov.iov, qiov.niov); } /* Loop in case of EINTR */ do { len = v9fs_co_pwritev(pdu, fidp, qiov.iov, qiov.niov, off); if (len >= 0) { off += len; total += len; } } while (len == -EINTR && !pdu->cancelled); if (len < 0) { /* IO error return the error */ err = len; goto out_qiov; } } while (total < count && len > 0); offset = 7; err = pdu_marshal(pdu, offset, ""d"", total); if (err < 0) { goto out; } err += offset; trace_v9fs_write_return(pdu->tag, pdu->id, total, err); out_qiov: qemu_iovec_destroy(&qiov); out: put_fid(pdu, fidp); out_nofid: qemu_iovec_destroy(&qiov_full); pdu_complete(pdu, err); } ",0 "static bool vmx_rdtscp_supported(void) { return cpu_has_vmx_rdtscp(); } ",0 "void ExtensionsGuestViewMessageFilter::CreateMimeHandlerViewGuest( int32_t render_frame_id, const std::string& view_id, int32_t element_instance_id, const gfx::Size& element_size, mime_handler::BeforeUnloadControlPtr before_unload_control, int32_t plugin_frame_routing_id) { base::PostTaskWithTraits( FROM_HERE, {content::BrowserThread::UI}, base::BindOnce(&ExtensionsGuestViewMessageFilter:: CreateMimeHandlerViewGuestOnUIThread, this, render_frame_id, view_id, element_instance_id, element_size, before_unload_control.PassInterface(), plugin_frame_routing_id, false)); } ",0 "static ssize_t pages_collapsed_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { return sprintf(buf, ""%u\n"", khugepaged_pages_collapsed); } ",0 "int ssl3_get_certificate_request(SSL *s) { int ok,ret=0; unsigned long n,nc,l; unsigned int llen, ctype_num,i; X509_NAME *xn=NULL; const unsigned char *p,*q; unsigned char *d; STACK_OF(X509_NAME) *ca_sk=NULL; n=s->method->ssl_get_message(s, SSL3_ST_CR_CERT_REQ_A, SSL3_ST_CR_CERT_REQ_B, -1, s->max_cert_list, &ok); if (!ok) return((int)n); s->s3->tmp.cert_req=0; if (s->s3->tmp.message_type == SSL3_MT_SERVER_DONE) { s->s3->tmp.reuse_message=1; /* If we get here we don't need any cached handshake records * as we wont be doing client auth. */ if (s->s3->handshake_buffer) { if (!ssl3_digest_cached_records(s)) goto err; } return(1); } if (s->s3->tmp.message_type != SSL3_MT_CERTIFICATE_REQUEST) { ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_UNEXPECTED_MESSAGE); SSLerr(SSL_F_SSL3_GET_CERTIFICATE_REQUEST,SSL_R_WRONG_MESSAGE_TYPE); goto err; } /* TLS does not like anon-DH with client cert */ if (s->version > SSL3_VERSION) { if (s->s3->tmp.new_cipher->algorithm_auth & SSL_aNULL) { ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_UNEXPECTED_MESSAGE); SSLerr(SSL_F_SSL3_GET_CERTIFICATE_REQUEST,SSL_R_TLS_CLIENT_CERT_REQ_WITH_ANON_CIPHER); goto err; } } p=d=(unsigned char *)s->init_msg; if ((ca_sk=sk_X509_NAME_new(ca_dn_cmp)) == NULL) { SSLerr(SSL_F_SSL3_GET_CERTIFICATE_REQUEST,ERR_R_MALLOC_FAILURE); goto err; } /* get the certificate types */ ctype_num= *(p++); if (s->cert->ctypes) { OPENSSL_free(s->cert->ctypes); s->cert->ctypes = NULL; } if (ctype_num > SSL3_CT_NUMBER) { /* If we exceed static buffer copy all to cert structure */ s->cert->ctypes = OPENSSL_malloc(ctype_num); if (s->cert->ctypes == NULL) { SSLerr(SSL_F_SSL3_GET_CERTIFICATE_REQUEST,ERR_R_MALLOC_FAILURE); goto err; } memcpy(s->cert->ctypes, p, ctype_num); s->cert->ctype_num = (size_t)ctype_num; ctype_num=SSL3_CT_NUMBER; } for (i=0; is3->tmp.ctype[i]= p[i]; p+=p[-1]; if (SSL_USE_SIGALGS(s)) { n2s(p, llen); /* Check we have enough room for signature algorithms and * following length value. */ if ((unsigned long)(p - d + llen + 2) > n) { ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_DECODE_ERROR); SSLerr(SSL_F_SSL3_GET_CERTIFICATE_REQUEST,SSL_R_DATA_LENGTH_TOO_LONG); goto err; } /* Clear certificate digests and validity flags */ for (i = 0; i < SSL_PKEY_NUM; i++) { s->cert->pkeys[i].digest = NULL; s->cert->pkeys[i].valid_flags = 0; } if ((llen & 1) || !tls1_save_sigalgs(s, p, llen)) { ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_DECODE_ERROR); SSLerr(SSL_F_SSL3_GET_CERTIFICATE_REQUEST,SSL_R_SIGNATURE_ALGORITHMS_ERROR); goto err; } if (!tls1_process_sigalgs(s)) { ssl3_send_alert(s,SSL3_AL_FATAL, SSL_AD_INTERNAL_ERROR); SSLerr(SSL_F_SSL3_GET_CERTIFICATE_REQUEST, ERR_R_MALLOC_FAILURE); goto err; } p += llen; } /* get the CA RDNs */ n2s(p,llen); #if 0 { FILE *out; out=fopen(""/tmp/vsign.der"",""w""); fwrite(p,1,llen,out); fclose(out); } #endif if ((unsigned long)(p - d + llen) != n) { ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_DECODE_ERROR); SSLerr(SSL_F_SSL3_GET_CERTIFICATE_REQUEST,SSL_R_LENGTH_MISMATCH); goto err; } for (nc=0; nc llen) { if ((s->options & SSL_OP_NETSCAPE_CA_DN_BUG)) goto cont; /* netscape bugs */ ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_DECODE_ERROR); SSLerr(SSL_F_SSL3_GET_CERTIFICATE_REQUEST,SSL_R_CA_DN_TOO_LONG); goto err; } q=p; if ((xn=d2i_X509_NAME(NULL,&q,l)) == NULL) { /* If netscape tolerance is on, ignore errors */ if (s->options & SSL_OP_NETSCAPE_CA_DN_BUG) goto cont; else { ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_DECODE_ERROR); SSLerr(SSL_F_SSL3_GET_CERTIFICATE_REQUEST,ERR_R_ASN1_LIB); goto err; } } if (q != (p+l)) { ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_DECODE_ERROR); SSLerr(SSL_F_SSL3_GET_CERTIFICATE_REQUEST,SSL_R_CA_DN_LENGTH_MISMATCH); goto err; } if (!sk_X509_NAME_push(ca_sk,xn)) { SSLerr(SSL_F_SSL3_GET_CERTIFICATE_REQUEST,ERR_R_MALLOC_FAILURE); goto err; } p+=l; nc+=l+2; } if (0) { cont: ERR_clear_error(); } /* we should setup a certificate to return.... */ s->s3->tmp.cert_req=1; s->s3->tmp.ctype_num=ctype_num; if (s->s3->tmp.ca_names != NULL) sk_X509_NAME_pop_free(s->s3->tmp.ca_names,X509_NAME_free); s->s3->tmp.ca_names=ca_sk; ca_sk=NULL; ret=1; err: if (ca_sk != NULL) sk_X509_NAME_pop_free(ca_sk,X509_NAME_free); return(ret); } ",0 "CacheAddr BackendImpl::GetNextAddr(Addr address) { EntriesMap::iterator it = open_entries_.find(address.value()); if (it != open_entries_.end()) { EntryImpl* this_entry = it->second; return this_entry->GetNextAddress(); } DCHECK(block_files_.IsValid(address)); DCHECK(!address.is_separate_file() && address.file_type() == BLOCK_256); CacheEntryBlock entry(File(address), address); CHECK(entry.Load()); return entry.Data()->next; } ",0 "static void openssl_thread_setup(void) { int i; lock_cs = OPENSSL_malloc(CRYPTO_num_locks() * sizeof(pthread_mutex_t)); lock_count = OPENSSL_malloc(CRYPTO_num_locks() * sizeof(long)); for (i = 0; i < CRYPTO_num_locks(); i++) { lock_count[i] = 0; pthread_mutex_init(&(lock_cs[i]), NULL); } CRYPTO_set_id_callback(pthreads_thread_id); CRYPTO_set_locking_callback(pthreads_locking_callback); } ",0 "static inline unsigned int llcp_accept_poll(struct sock *parent) { struct nfc_llcp_sock *llcp_sock, *n, *parent_sock; struct sock *sk; parent_sock = nfc_llcp_sock(parent); list_for_each_entry_safe(llcp_sock, n, &parent_sock->accept_queue, accept_queue) { sk = &llcp_sock->sk; if (sk->sk_state == LLCP_CONNECTED) return POLLIN | POLLRDNORM; } return 0; } ",0 "Element* RootEditableElementOfSelection(const FrameSelection& frameSelection) { const SelectionInDOMTree& selection = frameSelection.GetSelectionInDOMTree(); if (selection.IsNone()) return nullptr; if (Element* editable = RootEditableElementOf(selection.Base())) return editable; frameSelection.GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets(); const VisibleSelection& visibleSeleciton = frameSelection.ComputeVisibleSelectionInDOMTree(); return RootEditableElementOf(visibleSeleciton.Start()); } ",0 "WebBluetoothServiceImpl::ScanningClient::ScanningClient( blink::mojom::WebBluetoothScanClientAssociatedPtr client, blink::mojom::WebBluetoothRequestLEScanOptionsPtr options, RequestScanningStartCallback callback, BluetoothDeviceScanningPromptController* prompt_controller) : client_(std::move(client)), options_(std::move(options)), callback_(std::move(callback)), prompt_controller_(prompt_controller) { DCHECK(options_->filters.has_value() || options_->accept_all_advertisements); client_.set_connection_error_handler(base::BindRepeating( &ScanningClient::DisconnectionHandler, base::Unretained(this))); } ",0 "void ParamTraits::Log(const gfx::RectF& p, std::string* l) { l->append(base::StringPrintf(""(%f, %f, %f, %f)"", p.x(), p.y(), p.width(), p.height())); } ",0 "MagickExport Image *ComplexImages(const Image *images,const ComplexOperator op, ExceptionInfo *exception) { #define ComplexImageTag ""Complex/Image"" CacheView *Ai_view, *Ar_view, *Bi_view, *Br_view, *Ci_view, *Cr_view; const char *artifact; const Image *Ai_image, *Ar_image, *Bi_image, *Br_image; double snr; Image *Ci_image, *complex_images, *Cr_image, *image; MagickBooleanType status; MagickOffsetType progress; ssize_t y; assert(images != (Image *) NULL); assert(images->signature == MagickCoreSignature); if (images->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"",images->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); if (images->next == (Image *) NULL) { (void) ThrowMagickException(exception,GetMagickModule(),ImageError, ""ImageSequenceRequired"",""`%s'"",images->filename); return((Image *) NULL); } image=CloneImage(images,0,0,MagickTrue,exception); if (image == (Image *) NULL) return((Image *) NULL); if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse) { image=DestroyImageList(image); return(image); } image->depth=32UL; complex_images=NewImageList(); AppendImageToList(&complex_images,image); image=CloneImage(images,0,0,MagickTrue,exception); if (image == (Image *) NULL) { complex_images=DestroyImageList(complex_images); return(complex_images); } AppendImageToList(&complex_images,image); /* Apply complex mathematics to image pixels. */ artifact=GetImageArtifact(image,""complex:snr""); snr=0.0; if (artifact != (const char *) NULL) snr=StringToDouble(artifact,(char **) NULL); Ar_image=images; Ai_image=images->next; Br_image=images; Bi_image=images->next; if ((images->next->next != (Image *) NULL) && (images->next->next->next != (Image *) NULL)) { Br_image=images->next->next; Bi_image=images->next->next->next; } Cr_image=complex_images; Ci_image=complex_images->next; Ar_view=AcquireVirtualCacheView(Ar_image,exception); Ai_view=AcquireVirtualCacheView(Ai_image,exception); Br_view=AcquireVirtualCacheView(Br_image,exception); Bi_view=AcquireVirtualCacheView(Bi_image,exception); Cr_view=AcquireAuthenticCacheView(Cr_image,exception); Ci_view=AcquireAuthenticCacheView(Ci_image,exception); status=MagickTrue; progress=0; #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static) shared(progress,status) \ magick_number_threads(Cr_image,complex_images,Cr_image->rows,1L) #endif for (y=0; y < (ssize_t) Cr_image->rows; y++) { register const Quantum *magick_restrict Ai, *magick_restrict Ar, *magick_restrict Bi, *magick_restrict Br; register Quantum *magick_restrict Ci, *magick_restrict Cr; register ssize_t x; if (status == MagickFalse) continue; Ar=GetCacheViewVirtualPixels(Ar_view,0,y,Cr_image->columns,1,exception); Ai=GetCacheViewVirtualPixels(Ai_view,0,y,Cr_image->columns,1,exception); Br=GetCacheViewVirtualPixels(Br_view,0,y,Cr_image->columns,1,exception); Bi=GetCacheViewVirtualPixels(Bi_view,0,y,Cr_image->columns,1,exception); Cr=QueueCacheViewAuthenticPixels(Cr_view,0,y,Cr_image->columns,1,exception); Ci=QueueCacheViewAuthenticPixels(Ci_view,0,y,Ci_image->columns,1,exception); if ((Ar == (const Quantum *) NULL) || (Ai == (const Quantum *) NULL) || (Br == (const Quantum *) NULL) || (Bi == (const Quantum *) NULL) || (Cr == (Quantum *) NULL) || (Ci == (Quantum *) NULL)) { status=MagickFalse; continue; } for (x=0; x < (ssize_t) Cr_image->columns; x++) { register ssize_t i; for (i=0; i < (ssize_t) GetPixelChannels(Cr_image); i++) { switch (op) { case AddComplexOperator: { Cr[i]=Ar[i]+Br[i]; Ci[i]=Ai[i]+Bi[i]; break; } case ConjugateComplexOperator: default: { Cr[i]=Ar[i]; Ci[i]=(-Bi[i]); break; } case DivideComplexOperator: { double gamma; gamma=PerceptibleReciprocal((double) Br[i]*Br[i]+Bi[i]*Bi[i]+snr); Cr[i]=gamma*((double) Ar[i]*Br[i]+(double) Ai[i]*Bi[i]); Ci[i]=gamma*((double) Ai[i]*Br[i]-(double) Ar[i]*Bi[i]); break; } case MagnitudePhaseComplexOperator: { Cr[i]=sqrt((double) Ar[i]*Ar[i]+(double) Ai[i]*Ai[i]); Ci[i]=atan2((double) Ai[i],(double) Ar[i])/(2.0*MagickPI)+0.5; break; } case MultiplyComplexOperator: { Cr[i]=QuantumScale*((double) Ar[i]*Br[i]-(double) Ai[i]*Bi[i]); Ci[i]=QuantumScale*((double) Ai[i]*Br[i]+(double) Ar[i]*Bi[i]); break; } case RealImaginaryComplexOperator: { Cr[i]=Ar[i]*cos(2.0*MagickPI*(Ai[i]-0.5)); Ci[i]=Ar[i]*sin(2.0*MagickPI*(Ai[i]-0.5)); break; } case SubtractComplexOperator: { Cr[i]=Ar[i]-Br[i]; Ci[i]=Ai[i]-Bi[i]; break; } } } Ar+=GetPixelChannels(Ar_image); Ai+=GetPixelChannels(Ai_image); Br+=GetPixelChannels(Br_image); Bi+=GetPixelChannels(Bi_image); Cr+=GetPixelChannels(Cr_image); Ci+=GetPixelChannels(Ci_image); } if (SyncCacheViewAuthenticPixels(Ci_view,exception) == MagickFalse) status=MagickFalse; if (SyncCacheViewAuthenticPixels(Cr_view,exception) == MagickFalse) status=MagickFalse; if (images->progress_monitor != (MagickProgressMonitor) NULL) { MagickBooleanType proceed; #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp atomic #endif progress++; proceed=SetImageProgress(images,ComplexImageTag,progress,images->rows); if (proceed == MagickFalse) status=MagickFalse; } } Cr_view=DestroyCacheView(Cr_view); Ci_view=DestroyCacheView(Ci_view); Br_view=DestroyCacheView(Br_view); Bi_view=DestroyCacheView(Bi_view); Ar_view=DestroyCacheView(Ar_view); Ai_view=DestroyCacheView(Ai_view); if (status == MagickFalse) complex_images=DestroyImageList(complex_images); return(complex_images); } ",1 "bool V4L2JpegEncodeAccelerator::EncodedInstanceDmaBuf::SetUpJpegParameters( int quality, gfx::Size coded_size) { DCHECK(parent_->encoder_task_runner_->BelongsToCurrentThread()); struct v4l2_ext_controls ctrls; struct v4l2_ext_control ctrl; memset(&ctrls, 0, sizeof(ctrls)); memset(&ctrl, 0, sizeof(ctrl)); ctrls.ctrl_class = V4L2_CTRL_CLASS_JPEG; ctrls.controls = &ctrl; ctrls.count = 1; switch (output_buffer_pixelformat_) { case V4L2_PIX_FMT_JPEG_RAW: FillQuantizationTable(quality, kDefaultQuantTable[0].value, quantization_table_[0].value); FillQuantizationTable(quality, kDefaultQuantTable[1].value, quantization_table_[1].value); ctrl.id = V4L2_CID_JPEG_LUMA_QUANTIZATION; ctrl.size = kDctSize; ctrl.ptr = quantization_table_[0].value; IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_S_EXT_CTRLS, &ctrls); ctrl.id = V4L2_CID_JPEG_CHROMA_QUANTIZATION; ctrl.size = kDctSize; ctrl.ptr = quantization_table_[1].value; IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_S_EXT_CTRLS, &ctrls); PrepareJpegMarkers(coded_size); break; default: NOTREACHED(); } return true; } ",0 "static bool exclusive_event_installable(struct perf_event *event, struct perf_event_context *ctx) { struct perf_event *iter_event; struct pmu *pmu = event->pmu; if (!(pmu->capabilities & PERF_PMU_CAP_EXCLUSIVE)) return true; list_for_each_entry(iter_event, &ctx->event_list, event_entry) { if (exclusive_event_match(iter_event, event)) return false; } return true; } ",0 "static inline void hidg_put_minor(int minor) { ida_simple_remove(&hidg_ida, minor); } ",0 "void MediaStreamManager::Closed(MediaStreamType stream_type, int capture_session_id) { DCHECK_CURRENTLY_ON(BrowserThread::IO); } ",0 "static size_t findDiff(const void* buf1, const void* buf2, size_t max) { const BYTE* b1 = (const BYTE*)buf1; const BYTE* b2 = (const BYTE*)buf2; size_t u; for (u=0; u(scriptable_plugin_))); url_util_ = pp::URLUtil_Dev::Get(); if (url_util_ == NULL) return false; PLUGIN_PRINTF((""Plugin::Init (url_util_=%p)\n"", static_cast(url_util_))); bool status = Plugin::Init( static_cast(argc), const_cast(argn), const_cast(argv)); if (status) { const char* dev_settings = LookupArgument(kDevAttribute); enable_dev_interfaces_ = (dev_settings != NULL); const char* type_attr = LookupArgument(kTypeAttribute); if (type_attr != NULL) { mime_type_ = nacl::string(type_attr); std::transform(mime_type_.begin(), mime_type_.end(), mime_type_.begin(), tolower); } const char* manifest_url = LookupArgument(kSrcManifestAttribute); if (NexeIsContentHandler()) { manifest_url = LookupArgument(kNaClManifestAttribute); } CHECK(url_util_ != NULL); pp::Var base_var = url_util_->GetDocumentURL(this); if (!base_var.is_string()) { PLUGIN_PRINTF((""Plugin::Init (unable to find document url)\n"")); return false; } set_plugin_base_url(base_var.AsString()); if (manifest_url == NULL) { PLUGIN_PRINTF((""Plugin::Init:"" "" WARNING: no 'src' property, so no manifest loaded.\n"")); if (NULL != LookupArgument(kNaClManifestAttribute)) { PLUGIN_PRINTF((""Plugin::Init:"" "" WARNING: 'nacl' property is incorrect. Use 'src'.\n"")); } } else { RequestNaClManifest(manifest_url); } } PLUGIN_PRINTF((""Plugin::Init (status=%d)\n"", status)); return status; } ",0 " const ui::Accelerator& last_accelerator() const { return last_accelerator_; } ",0 "void HTMLSelectElement::optionSelectionStateChanged(HTMLOptionElement* option, bool optionIsSelected) { ASSERT(option->ownerSelectElement() == this); if (optionIsSelected) selectOption(option->index()); else if (!usesMenuList() || multiple()) selectOption(-1); else selectOption(nextSelectableListIndex(-1)); } ",0 "_dbus_send_credentials_socket (int handle, DBusError *error) { /* FIXME: for the session bus credentials shouldn't matter (?), but * for the system bus they are presumably essential. A rough outline * of a way to implement the credential transfer would be this: * * client waits to *read* a byte. * * server creates a named pipe with a random name, sends a byte * contining its length, and its name. * * client reads the name, connects to it (using Win32 API). * * server waits for connection to the named pipe, then calls * ImpersonateNamedPipeClient(), notes its now-current credentials, * calls RevertToSelf(), closes its handles to the named pipe, and * is done. (Maybe there is some other way to get the SID of a named * pipe client without having to use impersonation?) * * client closes its handles and is done. * * Ralf: Why not sending credentials over the given this connection ? * Using named pipes makes it impossible to be connected from a unix client. * */ int bytes_written; DBusString buf; _dbus_string_init_const_len (&buf, ""\0"", 1); again: bytes_written = _dbus_write_socket (handle, &buf, 0, 1 ); if (bytes_written < 0 && errno == EINTR) goto again; if (bytes_written < 0) { dbus_set_error (error, _dbus_error_from_errno (errno), ""Failed to write credentials byte: %s"", _dbus_strerror_from_errno ()); return FALSE; } else if (bytes_written == 0) { dbus_set_error (error, DBUS_ERROR_IO_ERROR, ""wrote zero bytes writing credentials byte""); return FALSE; } else { _dbus_assert (bytes_written == 1); _dbus_verbose (""wrote 1 zero byte, credential sending isn't implemented yet\n""); return TRUE; } return TRUE; } ",0 "void TestRenderViewHost::SimulateWasHidden() { GetWidget()->WasHidden(); } ",0 "static void CreateContextProviderOnMainThread( ContextProviderCreationInfo* creation_info, WaitableEvent* waitable_event) { DCHECK(IsMainThread()); creation_info->created_context_provider = Platform::Current()->CreateOffscreenGraphicsContext3DProvider( creation_info->context_attributes, creation_info->url, 0, creation_info->gl_info); waitable_event->Signal(); } ",0 "struct dentry *d_alloc(struct dentry * parent, const struct qstr *name) { struct dentry *dentry = __d_alloc(parent->d_sb, name); if (!dentry) return NULL; spin_lock(&parent->d_lock); /* * don't need child lock because it is not subject * to concurrency here */ __dget_dlock(parent); dentry->d_parent = parent; list_add(&dentry->d_child, &parent->d_subdirs); spin_unlock(&parent->d_lock); return dentry; } ",0 "static int index_apply_to_all( git_index *index, int action, const git_strarray *paths, git_index_matched_path_cb cb, void *payload) { int error = 0; size_t i; git_pathspec ps; const char *match; git_buf path = GIT_BUF_INIT; assert(index); if ((error = git_pathspec__init(&ps, paths)) < 0) return error; git_vector_sort(&index->entries); for (i = 0; !error && i < index->entries.length; ++i) { git_index_entry *entry = git_vector_get(&index->entries, i); /* check if path actually matches */ if (!git_pathspec__match( &ps.pathspec, entry->path, false, (bool)index->ignore_case, &match, NULL)) continue; /* issue notification callback if requested */ if (cb && (error = cb(entry->path, match, payload)) != 0) { if (error > 0) { /* return > 0 means skip this one */ error = 0; continue; } if (error < 0) /* return < 0 means abort */ break; } /* index manipulation may alter entry, so don't depend on it */ if ((error = git_buf_sets(&path, entry->path)) < 0) break; switch (action) { case INDEX_ACTION_NONE: break; case INDEX_ACTION_UPDATE: error = git_index_add_bypath(index, path.ptr); if (error == GIT_ENOTFOUND) { giterr_clear(); error = git_index_remove_bypath(index, path.ptr); if (!error) /* back up foreach if we removed this */ i--; } break; case INDEX_ACTION_REMOVE: if (!(error = git_index_remove_bypath(index, path.ptr))) i--; /* back up foreach if we removed this */ break; default: giterr_set(GITERR_INVALID, ""unknown index action %d"", action); error = -1; break; } } git_buf_free(&path); git_pathspec__clear(&ps); return error; } ",0 "void WebKitTestResultPrinter::PrintAudioFooter() { if (state_ != IN_AUDIO_BLOCK) return; if (!capture_text_only_) { *output_ << ""#EOF\n""; output_->flush(); } state_ = IN_IMAGE_BLOCK; } ",0 "INLINE void impeg2d_bit_stream_flush_to_byte_boundary(void* pv_ctxt) { UWORD8 u1_bit_offset; stream_t *ps_stream = (stream_t *)pv_ctxt; u1_bit_offset = (ps_stream->u4_offset) & 0x7; /* if it is not byte aligned make it byte aligned*/ if(u1_bit_offset != 0) { impeg2d_bit_stream_flush(ps_stream,(8 - u1_bit_offset)); } } ",0 " EntrySync* EntrySync::moveTo(DirectoryEntrySync* parent, const String& name, ExceptionState& exceptionState) const { RefPtr helper = EntrySyncCallbackHelper::create(); m_fileSystem->move(this, parent, name, helper->successCallback(), helper->errorCallback(), DOMFileSystemBase::Synchronous); return helper->getResult(exceptionState); } ",1 "void StopChildProcess(base::ProcessHandle handle) { DCHECK(CurrentlyOnProcessLauncherTaskRunner()); JNIEnv* env = AttachCurrentThread(); DCHECK(env); Java_ChildProcessLauncherHelperImpl_stop(env, static_cast(handle)); } ",0 "static void nfs4_close_prepare(struct rpc_task *task, void *data) { struct nfs4_closedata *calldata = data; struct nfs4_state *state = calldata->state; int call_close = 0; if (nfs_wait_on_sequence(calldata->arg.seqid, task) != 0) return; task->tk_msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN_DOWNGRADE]; calldata->arg.fmode = FMODE_READ|FMODE_WRITE; spin_lock(&state->owner->so_lock); /* Calculate the change in open mode */ if (state->n_rdwr == 0) { if (state->n_rdonly == 0) { call_close |= test_bit(NFS_O_RDONLY_STATE, &state->flags); call_close |= test_bit(NFS_O_RDWR_STATE, &state->flags); calldata->arg.fmode &= ~FMODE_READ; } if (state->n_wronly == 0) { call_close |= test_bit(NFS_O_WRONLY_STATE, &state->flags); call_close |= test_bit(NFS_O_RDWR_STATE, &state->flags); calldata->arg.fmode &= ~FMODE_WRITE; } } spin_unlock(&state->owner->so_lock); if (!call_close) { /* Note: exit _without_ calling nfs4_close_done */ task->tk_action = NULL; return; } if (calldata->arg.fmode == 0) { task->tk_msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_CLOSE]; if (calldata->roc && pnfs_roc_drain(calldata->inode, &calldata->roc_barrier)) { rpc_sleep_on(&NFS_SERVER(calldata->inode)->roc_rpcwaitq, task, NULL); return; } } nfs_fattr_init(calldata->res.fattr); calldata->timestamp = jiffies; if (nfs4_setup_sequence(NFS_SERVER(calldata->inode), &calldata->arg.seq_args, &calldata->res.seq_res, 1, task)) return; rpc_call_start(task); } ",0 " void WriteReplyAndDeleteThis(const IPC::ChannelHandle& handle) { ViewHostMsg_OpenChannelToPlugin::WriteReplyParams(reply_msg(), handle, info_); filter()->OnCompletedOpenChannelToNpapiPlugin(this); SendReplyAndDeleteThis(); } ",0 "KeyboardCode KeyboardCodeFromNative(const base::NativeEvent& native_event) { return KeyboardCodeForWindowsKeyCode(native_event.wParam); } ",0 "static int scan(Scanner *s) { uchar *cursor = s->cur; char *str, *ptr = NULL; std: s->tok = cursor; s->len = 0; #line 311 ""ext/date/lib/parse_iso_intervals.re"" #line 291 ""ext/date/lib/parse_iso_intervals.c"" { YYCTYPE yych; unsigned int yyaccept = 0; static const unsigned char yybm[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; YYDEBUG(0, *YYCURSOR); if ((YYLIMIT - YYCURSOR) < 20) YYFILL(20); yych = *YYCURSOR; if (yych <= ',') { if (yych <= '\n') { if (yych <= 0x00) goto yy9; if (yych <= 0x08) goto yy11; if (yych <= '\t') goto yy7; goto yy9; } else { if (yych == ' ') goto yy7; if (yych <= '+') goto yy11; goto yy7; } } else { if (yych <= 'O') { if (yych <= '-') goto yy11; if (yych <= '/') goto yy7; if (yych <= '9') goto yy4; goto yy11; } else { if (yych <= 'P') goto yy5; if (yych != 'R') goto yy11; } } YYDEBUG(2, *YYCURSOR); ++YYCURSOR; if ((yych = *YYCURSOR) <= '/') goto yy3; if (yych <= '9') goto yy98; yy3: YYDEBUG(3, *YYCURSOR); #line 424 ""ext/date/lib/parse_iso_intervals.re"" { add_error(s, ""Unexpected character""); goto std; } #line 366 ""ext/date/lib/parse_iso_intervals.c"" yy4: YYDEBUG(4, *YYCURSOR); yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '/') goto yy3; if (yych <= '9') goto yy59; goto yy3; yy5: YYDEBUG(5, *YYCURSOR); yyaccept = 1; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '/') goto yy6; if (yych <= '9') goto yy12; if (yych == 'T') goto yy14; yy6: YYDEBUG(6, *YYCURSOR); #line 351 ""ext/date/lib/parse_iso_intervals.re"" { timelib_sll nr; int in_time = 0; DEBUG_OUTPUT(""period""); TIMELIB_INIT; ptr++; do { if ( *ptr == 'T' ) { in_time = 1; ptr++; } if ( *ptr == '\0' ) { add_error(s, ""Missing expected time part""); break; } nr = timelib_get_unsigned_nr((char **) &ptr, 12); switch (*ptr) { case 'Y': s->period->y = nr; break; case 'W': s->period->d = nr * 7; break; case 'D': s->period->d = nr; break; case 'H': s->period->h = nr; break; case 'S': s->period->s = nr; break; case 'M': if (in_time) { s->period->i = nr; } else { s->period->m = nr; } break; default: add_error(s, ""Undefined period specifier""); break; } ptr++; } while (*ptr); s->have_period = 1; TIMELIB_DEINIT; return TIMELIB_PERIOD; } #line 424 ""ext/date/lib/parse_iso_intervals.c"" yy7: YYDEBUG(7, *YYCURSOR); ++YYCURSOR; YYDEBUG(8, *YYCURSOR); #line 413 ""ext/date/lib/parse_iso_intervals.re"" { goto std; } #line 433 ""ext/date/lib/parse_iso_intervals.c"" yy9: YYDEBUG(9, *YYCURSOR); ++YYCURSOR; YYDEBUG(10, *YYCURSOR); #line 418 ""ext/date/lib/parse_iso_intervals.re"" { s->pos = cursor; s->line++; goto std; } #line 443 ""ext/date/lib/parse_iso_intervals.c"" yy11: YYDEBUG(11, *YYCURSOR); yych = *++YYCURSOR; goto yy3; yy12: YYDEBUG(12, *YYCURSOR); yych = *++YYCURSOR; if (yych <= 'L') { if (yych <= '9') { if (yych >= '0') goto yy25; } else { if (yych == 'D') goto yy24; } } else { if (yych <= 'W') { if (yych <= 'M') goto yy27; if (yych >= 'W') goto yy26; } else { if (yych == 'Y') goto yy28; } } yy13: YYDEBUG(13, *YYCURSOR); YYCURSOR = YYMARKER; if (yyaccept <= 0) { goto yy3; } else { goto yy6; } yy14: YYDEBUG(14, *YYCURSOR); yyaccept = 1; yych = *(YYMARKER = ++YYCURSOR); if (yybm[0+yych] & 128) { goto yy15; } goto yy6; yy15: YYDEBUG(15, *YYCURSOR); ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; YYDEBUG(16, *YYCURSOR); if (yybm[0+yych] & 128) { goto yy15; } if (yych <= 'L') { if (yych == 'H') goto yy19; goto yy13; } else { if (yych <= 'M') goto yy18; if (yych != 'S') goto yy13; } yy17: YYDEBUG(17, *YYCURSOR); yych = *++YYCURSOR; goto yy6; yy18: YYDEBUG(18, *YYCURSOR); yyaccept = 1; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '/') goto yy6; if (yych <= '9') goto yy22; goto yy6; yy19: YYDEBUG(19, *YYCURSOR); yyaccept = 1; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '/') goto yy6; if (yych >= ':') goto yy6; yy20: YYDEBUG(20, *YYCURSOR); ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; YYDEBUG(21, *YYCURSOR); if (yych <= 'L') { if (yych <= '/') goto yy13; if (yych <= '9') goto yy20; goto yy13; } else { if (yych <= 'M') goto yy18; if (yych == 'S') goto yy17; goto yy13; } yy22: YYDEBUG(22, *YYCURSOR); ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; YYDEBUG(23, *YYCURSOR); if (yych <= '/') goto yy13; if (yych <= '9') goto yy22; if (yych == 'S') goto yy17; goto yy13; yy24: YYDEBUG(24, *YYCURSOR); yych = *++YYCURSOR; if (yych == 'T') goto yy14; goto yy6; yy25: YYDEBUG(25, *YYCURSOR); yych = *++YYCURSOR; if (yych <= 'L') { if (yych <= '9') { if (yych <= '/') goto yy13; goto yy35; } else { if (yych == 'D') goto yy24; goto yy13; } } else { if (yych <= 'W') { if (yych <= 'M') goto yy27; if (yych <= 'V') goto yy13; } else { if (yych == 'Y') goto yy28; goto yy13; } } yy26: YYDEBUG(26, *YYCURSOR); yyaccept = 1; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '/') goto yy6; if (yych <= '9') goto yy33; if (yych == 'T') goto yy14; goto yy6; yy27: YYDEBUG(27, *YYCURSOR); yyaccept = 1; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '/') goto yy6; if (yych <= '9') goto yy31; if (yych == 'T') goto yy14; goto yy6; yy28: YYDEBUG(28, *YYCURSOR); yyaccept = 1; yych = *(YYMARKER = ++YYCURSOR); if (yych <= '/') goto yy6; if (yych <= '9') goto yy29; if (yych == 'T') goto yy14; goto yy6; yy29: YYDEBUG(29, *YYCURSOR); ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3); yych = *YYCURSOR; YYDEBUG(30, *YYCURSOR); if (yych <= 'D') { if (yych <= '/') goto yy13; if (yych <= '9') goto yy29; if (yych <= 'C') goto yy13; goto yy24; } else { if (yych <= 'M') { if (yych <= 'L') goto yy13; goto yy27; } else { if (yych == 'W') goto yy26; goto yy13; } } yy31: YYDEBUG(31, *YYCURSOR); ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3); yych = *YYCURSOR; YYDEBUG(32, *YYCURSOR); if (yych <= 'C') { if (yych <= '/') goto yy13; if (yych <= '9') goto yy31; goto yy13; } else { if (yych <= 'D') goto yy24; if (yych == 'W') goto yy26; goto yy13; } yy33: YYDEBUG(33, *YYCURSOR); ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3); yych = *YYCURSOR; YYDEBUG(34, *YYCURSOR); if (yych <= '/') goto yy13; if (yych <= '9') goto yy33; if (yych == 'D') goto yy24; goto yy13; yy35: YYDEBUG(35, *YYCURSOR); yych = *++YYCURSOR; if (yych <= 'L') { if (yych <= '9') { if (yych <= '/') goto yy13; } else { if (yych == 'D') goto yy24; goto yy13; } } else { if (yych <= 'W') { if (yych <= 'M') goto yy27; if (yych <= 'V') goto yy13; goto yy26; } else { if (yych == 'Y') goto yy28; goto yy13; } } YYDEBUG(36, *YYCURSOR); yych = *++YYCURSOR; if (yych != '-') goto yy39; YYDEBUG(37, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '/') goto yy13; if (yych <= '0') goto yy40; if (yych <= '1') goto yy41; goto yy13; yy38: YYDEBUG(38, *YYCURSOR); ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3); yych = *YYCURSOR; yy39: YYDEBUG(39, *YYCURSOR); if (yych <= 'L') { if (yych <= '9') { if (yych <= '/') goto yy13; goto yy38; } else { if (yych == 'D') goto yy24; goto yy13; } } else { if (yych <= 'W') { if (yych <= 'M') goto yy27; if (yych <= 'V') goto yy13; goto yy26; } else { if (yych == 'Y') goto yy28; goto yy13; } } yy40: YYDEBUG(40, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '/') goto yy13; if (yych <= '9') goto yy42; goto yy13; yy41: YYDEBUG(41, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '/') goto yy13; if (yych >= '3') goto yy13; yy42: YYDEBUG(42, *YYCURSOR); yych = *++YYCURSOR; if (yych != '-') goto yy13; YYDEBUG(43, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '/') goto yy13; if (yych <= '0') goto yy44; if (yych <= '2') goto yy45; if (yych <= '3') goto yy46; goto yy13; yy44: YYDEBUG(44, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '/') goto yy13; if (yych <= '9') goto yy47; goto yy13; yy45: YYDEBUG(45, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '/') goto yy13; if (yych <= '9') goto yy47; goto yy13; yy46: YYDEBUG(46, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '/') goto yy13; if (yych >= '2') goto yy13; yy47: YYDEBUG(47, *YYCURSOR); yych = *++YYCURSOR; if (yych != 'T') goto yy13; YYDEBUG(48, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '/') goto yy13; if (yych <= '1') goto yy49; if (yych <= '2') goto yy50; goto yy13; yy49: YYDEBUG(49, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '/') goto yy13; if (yych <= '9') goto yy51; goto yy13; yy50: YYDEBUG(50, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '/') goto yy13; if (yych >= '5') goto yy13; yy51: YYDEBUG(51, *YYCURSOR); yych = *++YYCURSOR; if (yych != ':') goto yy13; YYDEBUG(52, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '/') goto yy13; if (yych >= '6') goto yy13; YYDEBUG(53, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '/') goto yy13; if (yych >= ':') goto yy13; YYDEBUG(54, *YYCURSOR); yych = *++YYCURSOR; if (yych != ':') goto yy13; YYDEBUG(55, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '/') goto yy13; if (yych >= '6') goto yy13; YYDEBUG(56, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '/') goto yy13; if (yych >= ':') goto yy13; YYDEBUG(57, *YYCURSOR); ++YYCURSOR; YYDEBUG(58, *YYCURSOR); #line 393 ""ext/date/lib/parse_iso_intervals.re"" { DEBUG_OUTPUT(""combinedrep""); TIMELIB_INIT; s->period->y = timelib_get_unsigned_nr((char **) &ptr, 4); ptr++; s->period->m = timelib_get_unsigned_nr((char **) &ptr, 2); ptr++; s->period->d = timelib_get_unsigned_nr((char **) &ptr, 2); ptr++; s->period->h = timelib_get_unsigned_nr((char **) &ptr, 2); ptr++; s->period->i = timelib_get_unsigned_nr((char **) &ptr, 2); ptr++; s->period->s = timelib_get_unsigned_nr((char **) &ptr, 2); s->have_period = 1; TIMELIB_DEINIT; return TIMELIB_PERIOD; } #line 792 ""ext/date/lib/parse_iso_intervals.c"" yy59: YYDEBUG(59, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '/') goto yy13; if (yych >= ':') goto yy13; YYDEBUG(60, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '/') goto yy13; if (yych >= ':') goto yy13; YYDEBUG(61, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '/') { if (yych == '-') goto yy64; goto yy13; } else { if (yych <= '0') goto yy62; if (yych <= '1') goto yy63; goto yy13; } yy62: YYDEBUG(62, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '0') goto yy13; if (yych <= '9') goto yy85; goto yy13; yy63: YYDEBUG(63, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '/') goto yy13; if (yych <= '2') goto yy85; goto yy13; yy64: YYDEBUG(64, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '/') goto yy13; if (yych <= '0') goto yy65; if (yych <= '1') goto yy66; goto yy13; yy65: YYDEBUG(65, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '0') goto yy13; if (yych <= '9') goto yy67; goto yy13; yy66: YYDEBUG(66, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '/') goto yy13; if (yych >= '3') goto yy13; yy67: YYDEBUG(67, *YYCURSOR); yych = *++YYCURSOR; if (yych != '-') goto yy13; YYDEBUG(68, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '/') goto yy13; if (yych <= '0') goto yy69; if (yych <= '2') goto yy70; if (yych <= '3') goto yy71; goto yy13; yy69: YYDEBUG(69, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '0') goto yy13; if (yych <= '9') goto yy72; goto yy13; yy70: YYDEBUG(70, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '/') goto yy13; if (yych <= '9') goto yy72; goto yy13; yy71: YYDEBUG(71, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '/') goto yy13; if (yych >= '2') goto yy13; yy72: YYDEBUG(72, *YYCURSOR); yych = *++YYCURSOR; if (yych != 'T') goto yy13; YYDEBUG(73, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '/') goto yy13; if (yych <= '1') goto yy74; if (yych <= '2') goto yy75; goto yy13; yy74: YYDEBUG(74, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '/') goto yy13; if (yych <= '9') goto yy76; goto yy13; yy75: YYDEBUG(75, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '/') goto yy13; if (yych >= '5') goto yy13; yy76: YYDEBUG(76, *YYCURSOR); yych = *++YYCURSOR; if (yych != ':') goto yy13; YYDEBUG(77, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '/') goto yy13; if (yych >= '6') goto yy13; YYDEBUG(78, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '/') goto yy13; if (yych >= ':') goto yy13; YYDEBUG(79, *YYCURSOR); yych = *++YYCURSOR; if (yych != ':') goto yy13; YYDEBUG(80, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '/') goto yy13; if (yych >= '6') goto yy13; YYDEBUG(81, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '/') goto yy13; if (yych >= ':') goto yy13; YYDEBUG(82, *YYCURSOR); yych = *++YYCURSOR; if (yych != 'Z') goto yy13; yy83: YYDEBUG(83, *YYCURSOR); ++YYCURSOR; YYDEBUG(84, *YYCURSOR); #line 327 ""ext/date/lib/parse_iso_intervals.re"" { timelib_time *current; if (s->have_date || s->have_period) { current = s->end; s->have_end_date = 1; } else { current = s->begin; s->have_begin_date = 1; } DEBUG_OUTPUT(""datetimebasic | datetimeextended""); TIMELIB_INIT; current->y = timelib_get_nr((char **) &ptr, 4); current->m = timelib_get_nr((char **) &ptr, 2); current->d = timelib_get_nr((char **) &ptr, 2); current->h = timelib_get_nr((char **) &ptr, 2); current->i = timelib_get_nr((char **) &ptr, 2); current->s = timelib_get_nr((char **) &ptr, 2); s->have_date = 1; TIMELIB_DEINIT; return TIMELIB_ISO_DATE; } #line 944 ""ext/date/lib/parse_iso_intervals.c"" yy85: YYDEBUG(85, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '/') goto yy13; if (yych <= '0') goto yy86; if (yych <= '2') goto yy87; if (yych <= '3') goto yy88; goto yy13; yy86: YYDEBUG(86, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '0') goto yy13; if (yych <= '9') goto yy89; goto yy13; yy87: YYDEBUG(87, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '/') goto yy13; if (yych <= '9') goto yy89; goto yy13; yy88: YYDEBUG(88, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '/') goto yy13; if (yych >= '2') goto yy13; yy89: YYDEBUG(89, *YYCURSOR); yych = *++YYCURSOR; if (yych != 'T') goto yy13; YYDEBUG(90, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '/') goto yy13; if (yych <= '1') goto yy91; if (yych <= '2') goto yy92; goto yy13; yy91: YYDEBUG(91, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '/') goto yy13; if (yych <= '9') goto yy93; goto yy13; yy92: YYDEBUG(92, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '/') goto yy13; if (yych >= '5') goto yy13; yy93: YYDEBUG(93, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '/') goto yy13; if (yych >= '6') goto yy13; YYDEBUG(94, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '/') goto yy13; if (yych >= ':') goto yy13; YYDEBUG(95, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '/') goto yy13; if (yych >= '6') goto yy13; YYDEBUG(96, *YYCURSOR); yych = *++YYCURSOR; if (yych <= '/') goto yy13; if (yych >= ':') goto yy13; YYDEBUG(97, *YYCURSOR); yych = *++YYCURSOR; if (yych == 'Z') goto yy83; goto yy13; yy98: YYDEBUG(98, *YYCURSOR); ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; YYDEBUG(99, *YYCURSOR); if (yych <= '/') goto yy100; if (yych <= '9') goto yy98; yy100: YYDEBUG(100, *YYCURSOR); #line 316 ""ext/date/lib/parse_iso_intervals.re"" { DEBUG_OUTPUT(""recurrences""); TIMELIB_INIT; ptr++; s->recurrences = timelib_get_unsigned_nr((char **) &ptr, 9); TIMELIB_DEINIT; s->have_recurrences = 1; return TIMELIB_PERIOD; } #line 1032 ""ext/date/lib/parse_iso_intervals.c"" } #line 428 ""ext/date/lib/parse_iso_intervals.re"" } ",1 "float RenderViewImpl::GetFilteredTimePerFrame() { return filtered_time_per_frame(); } ",0 "static uintmax_t change_note_fanout(struct tree_entry *root, unsigned char fanout) { char hex_sha1[40], path[60]; return do_change_note_fanout(root, root, hex_sha1, 0, path, 0, fanout); } ",0 "OPJ_BOOL opj_tcd_decode_tile( opj_tcd_t *p_tcd, OPJ_BYTE *p_src, OPJ_UINT32 p_max_length, OPJ_UINT32 p_tile_no, opj_codestream_index_t *p_cstr_index ) { OPJ_UINT32 l_data_read; p_tcd->tcd_tileno = p_tile_no; p_tcd->tcp = &(p_tcd->cp->tcps[p_tile_no]); #ifdef TODO_MSD /* FIXME */ /* INDEX >> */ if(p_cstr_info) { OPJ_UINT32 resno, compno, numprec = 0; for (compno = 0; compno < (OPJ_UINT32) p_cstr_info->numcomps; compno++) { opj_tcp_t *tcp = &p_tcd->cp->tcps[0]; opj_tccp_t *tccp = &tcp->tccps[compno]; opj_tcd_tilecomp_t *tilec_idx = &p_tcd->tcd_image->tiles->comps[compno]; for (resno = 0; resno < tilec_idx->numresolutions; resno++) { opj_tcd_resolution_t *res_idx = &tilec_idx->resolutions[resno]; p_cstr_info->tile[p_tile_no].pw[resno] = res_idx->pw; p_cstr_info->tile[p_tile_no].ph[resno] = res_idx->ph; numprec += res_idx->pw * res_idx->ph; p_cstr_info->tile[p_tile_no].pdx[resno] = tccp->prcw[resno]; p_cstr_info->tile[p_tile_no].pdy[resno] = tccp->prch[resno]; } } p_cstr_info->tile[p_tile_no].packet = (opj_packet_info_t *) opj_malloc(p_cstr_info->numlayers * numprec * sizeof(opj_packet_info_t)); p_cstr_info->packno = 0; } /* << INDEX */ #endif /*--------------TIER2------------------*/ /* FIXME _ProfStart(PGROUP_T2); */ l_data_read = 0; if (! opj_tcd_t2_decode(p_tcd, p_src, &l_data_read, p_max_length, p_cstr_index)) { return OPJ_FALSE; } /* FIXME _ProfStop(PGROUP_T2); */ /*------------------TIER1-----------------*/ /* FIXME _ProfStart(PGROUP_T1); */ if (! opj_tcd_t1_decode(p_tcd)) { return OPJ_FALSE; } /* FIXME _ProfStop(PGROUP_T1); */ /*----------------DWT---------------------*/ /* FIXME _ProfStart(PGROUP_DWT); */ if (! opj_tcd_dwt_decode(p_tcd)) { return OPJ_FALSE; } /* FIXME _ProfStop(PGROUP_DWT); */ /*----------------MCT-------------------*/ /* FIXME _ProfStart(PGROUP_MCT); */ if (! opj_tcd_mct_decode(p_tcd)) { return OPJ_FALSE; } /* FIXME _ProfStop(PGROUP_MCT); */ /* FIXME _ProfStart(PGROUP_DC_SHIFT); */ if (! opj_tcd_dc_level_shift_decode(p_tcd)) { return OPJ_FALSE; } /* FIXME _ProfStop(PGROUP_DC_SHIFT); */ /*---------------TILE-------------------*/ return OPJ_TRUE; } ",0 "static void show_string(struct usb_device *udev, char *id, char *string) { if (!string) return; dev_info(&udev->dev, ""%s: %s\n"", id, string); } ",0 "EXPORTED uint32_t mboxlist_string_to_mbtype(const char *string) { uint32_t mbtype = 0; if (!string) return 0; /* null just means default */ for (; *string; string++) { switch (*string) { case 'a': mbtype |= MBTYPE_ADDRESSBOOK; break; case 'b': mbtype |= MBTYPE_COLLECTION; break; case 'c': mbtype |= MBTYPE_CALENDAR; break; case 'd': mbtype |= MBTYPE_DELETED; break; case 'm': mbtype |= MBTYPE_MOVING; break; case 'n': mbtype |= MBTYPE_NETNEWS; break; case 'r': mbtype |= MBTYPE_REMOTE; break; case 'z': mbtype |= MBTYPE_RESERVE; break; } } return mbtype; } ",0 " GradientLayerDelegate() : layer_(ui::LAYER_TEXTURED) { layer_.set_delegate(this); layer_.SetFillsBoundsOpaquely(false); } ",0 "OMX_ERRORTYPE omx_vdec::empty_this_buffer(OMX_IN OMX_HANDLETYPE hComp, OMX_IN OMX_BUFFERHEADERTYPE* buffer) { OMX_ERRORTYPE ret1 = OMX_ErrorNone; unsigned int nBufferIndex = drv_ctx.ip_buf.actualcount; if (m_state == OMX_StateInvalid) { DEBUG_PRINT_ERROR(""Empty this buffer in Invalid State""); return OMX_ErrorInvalidState; } if (buffer == NULL) { DEBUG_PRINT_ERROR(""ERROR:ETB Buffer is NULL""); return OMX_ErrorBadParameter; } if (!m_inp_bEnabled) { DEBUG_PRINT_ERROR(""ERROR:ETB incorrect state operation, input port is disabled.""); return OMX_ErrorIncorrectStateOperation; } if (buffer->nInputPortIndex != OMX_CORE_INPUT_PORT_INDEX) { DEBUG_PRINT_ERROR(""ERROR:ETB invalid port in header %u"", (unsigned int)buffer->nInputPortIndex); return OMX_ErrorBadPortIndex; } #ifdef _ANDROID_ if (iDivXDrmDecrypt) { OMX_ERRORTYPE drmErr = iDivXDrmDecrypt->Decrypt(buffer); if (drmErr != OMX_ErrorNone) { DEBUG_PRINT_LOW(""ERROR:iDivXDrmDecrypt->Decrypt %d"", drmErr); } } #endif //_ANDROID_ if (perf_flag) { if (!latency) { dec_time.stop(); latency = dec_time.processing_time_us(); dec_time.start(); } } if (arbitrary_bytes) { nBufferIndex = buffer - m_inp_heap_ptr; } else { if (input_use_buffer == true) { nBufferIndex = buffer - m_inp_heap_ptr; m_inp_mem_ptr[nBufferIndex].nFilledLen = m_inp_heap_ptr[nBufferIndex].nFilledLen; m_inp_mem_ptr[nBufferIndex].nTimeStamp = m_inp_heap_ptr[nBufferIndex].nTimeStamp; m_inp_mem_ptr[nBufferIndex].nFlags = m_inp_heap_ptr[nBufferIndex].nFlags; buffer = &m_inp_mem_ptr[nBufferIndex]; DEBUG_PRINT_LOW(""Non-Arbitrary mode - buffer address is: malloc %p, pmem%p in Index %d, buffer %p of size %u"", &m_inp_heap_ptr[nBufferIndex], &m_inp_mem_ptr[nBufferIndex],nBufferIndex, buffer, (unsigned int)buffer->nFilledLen); } else { nBufferIndex = buffer - m_inp_mem_ptr; } } if (nBufferIndex > drv_ctx.ip_buf.actualcount ) { DEBUG_PRINT_ERROR(""ERROR:ETB nBufferIndex is invalid""); return OMX_ErrorBadParameter; } if (buffer->nFlags & OMX_BUFFERFLAG_CODECCONFIG) { codec_config_flag = true; DEBUG_PRINT_LOW(""%s: codec_config buffer"", __FUNCTION__); } DEBUG_PRINT_LOW(""[ETB] BHdr(%p) pBuf(%p) nTS(%lld) nFL(%u)"", buffer, buffer->pBuffer, buffer->nTimeStamp, (unsigned int)buffer->nFilledLen); if (arbitrary_bytes) { post_event ((unsigned long)hComp,(unsigned long)buffer, OMX_COMPONENT_GENERATE_ETB_ARBITRARY); } else { post_event ((unsigned long)hComp,(unsigned long)buffer,OMX_COMPONENT_GENERATE_ETB); } time_stamp_dts.insert_timestamp(buffer); return OMX_ErrorNone; } ",1 "static uint32_t out_get_sample_rate(const struct audio_stream *stream) { struct stream_out *out = (struct stream_out *)stream; return out->sample_rate; } ",0 "void WebContentsImpl::OnDidLoadResourceFromMemoryCache( const GURL& url, const std::string& security_info, const std::string& http_method, const std::string& mime_type, ResourceType resource_type) { SSLStatus status; if (!DeserializeSecurityInfo(security_info, &status)) { bad_message::ReceivedBadMessage( GetRenderProcessHost(), bad_message::WC_MEMORY_CACHE_RESOURCE_BAD_SECURITY_INFO); return; } LoadFromMemoryCacheDetails details( url, status.cert_id, status.cert_status, http_method, mime_type, resource_type); controller_.ssl_manager()->DidLoadFromMemoryCache(details); FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidLoadResourceFromMemoryCache(details)); if (url.is_valid() && url.SchemeIsHTTPOrHTTPS()) { scoped_refptr request_context( resource_type == RESOURCE_TYPE_MEDIA ? GetBrowserContext()->GetMediaRequestContextForRenderProcess( GetRenderProcessHost()->GetID()) : GetBrowserContext()->GetRequestContextForRenderProcess( GetRenderProcessHost()->GetID())); BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind(&NotifyCacheOnIO, request_context, url, http_method)); } } ",0 " virtual JBIG2SegmentType getType() { return jbig2SegBitmap; } ",0 "void AutofillManager::OnDidPreviewAutofillFormData() { if (test_delegate_) test_delegate_->DidPreviewFormData(); } ",0 "CronTab::getError() { return ( this->errorLog ); } ",0 "base::string16 AuthenticatorClientPinTapAgainSheetModel::GetStepDescription() const { return l10n_util::GetStringUTF16(IDS_WEBAUTHN_PIN_TAP_AGAIN_DESCRIPTION); } ",0 "int yr_object_has_undefined_value( YR_OBJECT* object, const char* field, ...) { YR_OBJECT* field_obj; va_list args; va_start(args, field); if (field != NULL) field_obj = _yr_object_lookup(object, 0, field, args); else field_obj = object; va_end(args); if (field_obj == NULL) return TRUE; switch(field_obj->type) { case OBJECT_TYPE_FLOAT: return isnan(((YR_OBJECT_DOUBLE*) field_obj)->value); case OBJECT_TYPE_STRING: return ((YR_OBJECT_STRING*) field_obj)->value == NULL; case OBJECT_TYPE_INTEGER: return ((YR_OBJECT_INTEGER*) field_obj)->value == UNDEFINED; } return FALSE; } ",0 "void RenderWidgetHostImpl::OnGpuSwapBuffersCompletedInternal( const ui::LatencyInfo& latency_info) { ui::LatencyInfo::LatencyComponent window_snapshot_component; if (latency_info.FindLatency(ui::BROWSER_SNAPSHOT_FRAME_NUMBER_COMPONENT, GetLatencyComponentId(), &window_snapshot_component)) { int sequence_number = static_cast(window_snapshot_component.sequence_number); #if defined(OS_MACOSX) || defined(OS_WIN) base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( FROM_HERE, base::Bind(&RenderWidgetHostImpl::WindowSnapshotReachedScreen, weak_factory_.GetWeakPtr(), sequence_number), base::TimeDelta::FromSecondsD(1. / 6)); #else WindowSnapshotReachedScreen(sequence_number); #endif } latency_tracker_.OnGpuSwapBuffersCompleted(latency_info); } ",0 " random_mod(unsigned int max) { unsigned int x; RANDOMIZE(x); return x % max; /* 0 .. max-1 */ } ",0 "void SyncBackendHost::Core::OnBootstrapTokenUpdated( const std::string& bootstrap_token) { if (!sync_loop_) return; DCHECK_EQ(MessageLoop::current(), sync_loop_); host_.Call( FROM_HERE, &SyncBackendHost::PersistEncryptionBootstrapToken, bootstrap_token); } ",0 "void PrintDialogGtk::ShowDialog( PrintingContextCairo::PrintSettingsCallback* callback) { callback_ = callback; GtkWindow* parent = BrowserList::GetLastActive()->window()->GetNativeHandle(); dialog_ = gtk_print_unix_dialog_new(NULL, parent); g_signal_connect(dialog_, ""delete-event"", G_CALLBACK(gtk_widget_hide_on_delete), NULL); gtk_window_set_modal(GTK_WINDOW(dialog_), TRUE); GtkPrintCapabilities cap = static_cast( GTK_PRINT_CAPABILITY_GENERATE_PDF | GTK_PRINT_CAPABILITY_PAGE_SET | GTK_PRINT_CAPABILITY_COPIES | GTK_PRINT_CAPABILITY_COLLATE | GTK_PRINT_CAPABILITY_REVERSE); gtk_print_unix_dialog_set_manual_capabilities(GTK_PRINT_UNIX_DIALOG(dialog_), cap); gtk_print_unix_dialog_set_embed_page_setup(GTK_PRINT_UNIX_DIALOG(dialog_), TRUE); g_signal_connect(dialog_, ""response"", G_CALLBACK(OnResponseThunk), this); gtk_widget_show(dialog_); } ",0 "void RenderWidgetHostViewAura::OnInputMethodChanged() { if (!host_) return; } ",0 " event_index_change( int delta ) { int num_indices = handle->current_font->num_indices; status.Num += delta; if ( status.Num < 0 ) status.Num = 0; else if ( status.Num >= num_indices ) status.Num = num_indices - 1; } ",0 "static int __vhost_add_used_n(struct vhost_virtqueue *vq, struct vring_used_elem *heads, unsigned count) { struct vring_used_elem __user *used; u16 old, new; int start; start = vq->last_used_idx % vq->num; used = vq->used->ring + start; if (count == 1) { if (__put_user(heads[0].id, &used->id)) { vq_err(vq, ""Failed to write used id""); return -EFAULT; } if (__put_user(heads[0].len, &used->len)) { vq_err(vq, ""Failed to write used len""); return -EFAULT; } } else if (__copy_to_user(used, heads, count * sizeof *used)) { vq_err(vq, ""Failed to write used""); return -EFAULT; } if (unlikely(vq->log_used)) { /* Make sure data is seen before log. */ smp_wmb(); /* Log used ring entry write. */ log_write(vq->log_base, vq->log_addr + ((void __user *)used - (void __user *)vq->used), count * sizeof *used); } old = vq->last_used_idx; new = (vq->last_used_idx += count); /* If the driver never bothers to signal in a very long while, * used index might wrap around. If that happens, invalidate * signalled_used index we stored. TODO: make sure driver * signals at least once in 2^16 and remove this. */ if (unlikely((u16)(new - vq->signalled_used) < (u16)(new - old))) vq->signalled_used_valid = false; return 0; } ",0 "String securityState(const GURL& url, const net::CertStatus& cert_status) { if (!url.SchemeIsCryptographic()) return Security::SecurityStateEnum::Neutral; if (net::IsCertStatusError(cert_status) && !net::IsCertStatusMinorError(cert_status)) { return Security::SecurityStateEnum::Insecure; } return Security::SecurityStateEnum::Secure; } ",0 "int snd_seq_set_queue_tempo(int client, struct snd_seq_queue_tempo *tempo) { if (!snd_seq_queue_check_access(tempo->queue, client)) return -EPERM; return snd_seq_queue_timer_set_tempo(tempo->queue, client, tempo); } ",0 "void WebPageProxy::backForwardGoToItem(uint64_t itemID) { m_backForwardList->goToItem(process()->webBackForwardItem(itemID)); } ",0 "static void btif_hl_upstreams_ctrl_evt(UINT16 event, char* p_param){ tBTA_HL_CTRL *p_data = (tBTA_HL_CTRL *) p_param; UINT8 i; tBTA_HL_REG_PARAM reg_param; btif_hl_app_cb_t *p_acb; BTIF_TRACE_DEBUG(""%s event %d"", __FUNCTION__, event); btif_hl_display_calling_process_name(); switch ( event ) { case BTA_HL_CTRL_ENABLE_CFM_EVT: BTIF_TRACE_DEBUG(""Rcv BTA_HL_CTRL_ENABLE_CFM_EVT""); BTIF_TRACE_DEBUG(""status=%d"", p_data->enable_cfm.status); if (p_data->enable_cfm.status == BTA_HL_STATUS_OK) { btif_hl_set_state(BTIF_HL_STATE_ENABLED); for (i=0; i < BTA_HL_NUM_APPS ; i ++) { p_acb = BTIF_HL_GET_APP_CB_PTR(i); if (p_acb->in_use && p_acb->reg_pending) { p_acb->reg_pending = FALSE; reg_param.dev_type = p_acb->dev_type; reg_param.sec_mask = BTA_SEC_AUTHENTICATE | BTA_SEC_ENCRYPT; reg_param.p_srv_name = p_acb->srv_name; reg_param.p_srv_desp = p_acb->srv_desp; reg_param.p_provider_name = p_acb->provider_name; BTIF_TRACE_DEBUG(""Register pending app_id=%d"", p_acb->app_id); btif_hl_proc_reg_request (i, p_acb->app_id, ®_param, btif_hl_cback); } } } break; case BTA_HL_CTRL_DISABLE_CFM_EVT: BTIF_TRACE_DEBUG(""Rcv BTA_HL_CTRL_DISABLE_CFM_EVT""); BTIF_TRACE_DEBUG(""status=%d"", p_data->disable_cfm.status); if (p_data->disable_cfm.status == BTA_HL_STATUS_OK) { memset(p_btif_hl_cb, 0, sizeof(btif_hl_cb_t)); btif_hl_set_state(BTIF_HL_STATE_DISABLED); } break; default: break; } } ",0 "void CSoundFile::FreeSample(LPVOID p) { if (p) { GlobalFreePtr(((LPSTR)p)-16); } } ",0 "bool PrintMsg_Print_Params_IsEqual( const PrintMsg_PrintPages_Params& oldParams, const PrintMsg_PrintPages_Params& newParams) { return PageLayoutIsEqual(oldParams, newParams) && oldParams.params.max_shrink == newParams.params.max_shrink && oldParams.params.min_shrink == newParams.params.min_shrink && oldParams.params.selection_only == newParams.params.selection_only && oldParams.params.supports_alpha_blend == newParams.params.supports_alpha_blend && oldParams.pages.size() == newParams.pages.size() && oldParams.params.display_header_footer == newParams.params.display_header_footer && oldParams.params.date == newParams.params.date && oldParams.params.title == newParams.params.title && oldParams.params.url == newParams.params.url && std::equal(oldParams.pages.begin(), oldParams.pages.end(), newParams.pages.begin()); } ",0 "static void sparc_pmu_cancel_txn(struct pmu *pmu) { struct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events); cpuhw->group_flag &= ~PERF_EVENT_TXN; perf_pmu_enable(pmu); } ",0 " __releases(proto_list_mutex) { mutex_unlock(&proto_list_mutex); } ",0 "ui::WindowShowState AdjustShowState(ui::WindowShowState state) { switch (state) { case ui::SHOW_STATE_NORMAL: case ui::SHOW_STATE_MINIMIZED: case ui::SHOW_STATE_MAXIMIZED: case ui::SHOW_STATE_FULLSCREEN: return state; case ui::SHOW_STATE_DEFAULT: case ui::SHOW_STATE_INACTIVE: case ui::SHOW_STATE_END: return ui::SHOW_STATE_NORMAL; } return ui::SHOW_STATE_NORMAL; } ",0 "static int perf_event_period(struct perf_event *event, u64 __user *arg) { u64 value; if (!is_sampling_event(event)) return -EINVAL; if (copy_from_user(&value, arg, sizeof(value))) return -EFAULT; if (!value) return -EINVAL; if (event->attr.freq && value > sysctl_perf_event_sample_rate) return -EINVAL; event_function_call(event, __perf_event_period, &value); return 0; } ",0 "bool RenderFrameHostImpl::PrepareForInnerWebContentsAttach() { DCHECK(MimeHandlerViewMode::UsesCrossProcessFrame()); if (IsCrossProcessSubframe() || !GetParent()) return false; ResetNavigationRequests(); ResetLoadingState(); is_attaching_inner_delegate_ = true; return true; } ",0 "static int write_chunk(git_stream *io, const char *buffer, size_t len) { git_buf buf = GIT_BUF_INIT; /* Chunk header */ git_buf_printf(&buf, ""%"" PRIxZ ""\r\n"", len); if (git_buf_oom(&buf)) return -1; if (git_stream_write(io, buf.ptr, buf.size, 0) < 0) { git_buf_free(&buf); return -1; } git_buf_free(&buf); /* Chunk body */ if (len > 0 && git_stream_write(io, buffer, len, 0) < 0) return -1; /* Chunk footer */ if (git_stream_write(io, ""\r\n"", 2, 0) < 0) return -1; return 0; } ",0 "static inline int tcp_in_quickack_mode(const struct sock *sk) { const struct inet_connection_sock *icsk = inet_csk(sk); return icsk->icsk_ack.quick && !icsk->icsk_ack.pingpong; } ",0 "int Chapters::GetEditionCount() const { return m_editions_count; } ",1 "dissect_rach_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, struct fp_info *p_fp_info, void *data) { gboolean is_control_frame; guint16 header_crc = 0; proto_item * header_crc_pi = NULL; guint header_length = 0; /* Header CRC */ header_crc = tvb_get_bits8(tvb, 0, 7); header_crc_pi = proto_tree_add_item(tree, hf_fp_header_crc, tvb, offset, 1, ENC_BIG_ENDIAN); /* Frame Type */ is_control_frame = tvb_get_guint8(tvb, offset) & 0x01; proto_tree_add_item(tree, hf_fp_ft, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; col_append_str(pinfo->cinfo, COL_INFO, is_control_frame ? "" [Control] "" : "" [Data] ""); if (is_control_frame) { dissect_common_control(tvb, pinfo, tree, offset, p_fp_info); /* For control frame the header CRC is actually frame CRC covering all * bytes except the first */ if (preferences_header_checksum) { verify_control_frame_crc(tvb, pinfo, header_crc_pi, header_crc); } } else { guint8 cfn; guint32 propagation_delay = 0; proto_item *propagation_delay_ti = NULL; guint32 received_sync_ul_timing_deviation = 0; proto_item *received_sync_ul_timing_deviation_ti = NULL; proto_item *rx_timing_deviation_ti = NULL; guint16 rx_timing_deviation = 0; /* DATA */ /* CFN */ cfn = tvb_get_guint8(tvb, offset); proto_tree_add_item(tree, hf_fp_cfn, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; col_append_fstr(pinfo->cinfo, COL_INFO, ""CFN=%03u "", cfn); /* TFI */ proto_tree_add_item(tree, hf_fp_tfi, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; if (p_fp_info->channel == CHANNEL_RACH_FDD) { /* Propagation delay */ propagation_delay = tvb_get_guint8(tvb, offset); propagation_delay_ti = proto_tree_add_uint(tree, hf_fp_propagation_delay, tvb, offset, 1, propagation_delay*3); offset++; } /* Should be TDD 3.84 or 7.68 */ if (p_fp_info->channel == CHANNEL_RACH_TDD) { /* Rx Timing Deviation */ rx_timing_deviation = tvb_get_guint8(tvb, offset); rx_timing_deviation_ti = proto_tree_add_item(tree, hf_fp_rx_timing_deviation, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; } if (p_fp_info->channel == CHANNEL_RACH_TDD_128) { /* Received SYNC UL Timing Deviation */ received_sync_ul_timing_deviation = tvb_get_guint8(tvb, offset); received_sync_ul_timing_deviation_ti = proto_tree_add_item(tree, hf_fp_received_sync_ul_timing_deviation, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; } header_length = offset; /* TB data */ offset = dissect_tb_data(tvb, pinfo, tree, offset, p_fp_info, &mac_fdd_rach_handle, data); /* CRCIs */ offset = dissect_crci_bits(tvb, pinfo, tree, p_fp_info, offset); /* Info introduced in R6 */ /* only check if it looks as if they are present */ if (((p_fp_info->release == 6) || (p_fp_info->release == 7)) && (tvb_reported_length_remaining(tvb, offset) > 2)) { int n; guint8 flags; /* guint8 flag_bytes = 0; */ gboolean cell_portion_id_present = FALSE; gboolean ext_propagation_delay_present = FALSE; gboolean angle_of_arrival_present = FALSE; gboolean ext_rx_sync_ul_timing_deviation_present = FALSE; gboolean ext_rx_timing_deviation_present = FALSE; /* New IE flags (assume mandatory for now) */ do { proto_item *new_ie_flags_ti; proto_tree *new_ie_flags_tree; guint ies_found = 0; /* Add new IE flags subtree */ new_ie_flags_ti = proto_tree_add_string_format(tree, hf_fp_rach_new_ie_flags, tvb, offset, 1, """", ""New IE flags""); new_ie_flags_tree = proto_item_add_subtree(new_ie_flags_ti, ett_fp_rach_new_ie_flags); /* Read next byte */ flags = tvb_get_guint8(tvb, offset); /* flag_bytes++ */ /* Dissect individual bits */ for (n=0; n < 8; n++) { switch (n) { case 6: switch (p_fp_info->division) { case Division_FDD: /* Ext propagation delay */ ext_propagation_delay_present = TRUE; proto_tree_add_item(new_ie_flags_tree, hf_fp_rach_ext_propagation_delay_present, tvb, offset, 1, ENC_BIG_ENDIAN); break; case Division_TDD_128: /* Ext Rx Sync UL Timing */ ext_rx_sync_ul_timing_deviation_present = TRUE; proto_tree_add_item(new_ie_flags_tree, hf_fp_rach_ext_rx_sync_ul_timing_deviation_present, tvb, offset, 1, ENC_BIG_ENDIAN); break; default: /* Not defined */ proto_tree_add_item(new_ie_flags_tree, hf_fp_rach_new_ie_flag_unused[6], tvb, offset, 1, ENC_BIG_ENDIAN); break; } break; case 7: switch (p_fp_info->division) { case Division_FDD: /* Cell Portion ID */ cell_portion_id_present = TRUE; proto_tree_add_item(new_ie_flags_tree, hf_fp_rach_cell_portion_id_present, tvb, offset, 1, ENC_BIG_ENDIAN); break; case Division_TDD_128: /* AOA */ angle_of_arrival_present = TRUE; proto_tree_add_item(new_ie_flags_tree, hf_fp_rach_angle_of_arrival_present, tvb, offset, 1, ENC_BIG_ENDIAN); break; case Division_TDD_384: case Division_TDD_768: /* Extended Rx Timing Deviation */ ext_rx_timing_deviation_present = TRUE; proto_tree_add_item(new_ie_flags_tree, hf_fp_rach_ext_rx_timing_deviation_present, tvb, offset, 1, ENC_BIG_ENDIAN); break; } break; default: /* No defined meanings */ /* Visual Studio Code Analyzer wrongly thinks n can be 7 here. It can't */ proto_tree_add_item(new_ie_flags_tree, hf_fp_rach_new_ie_flag_unused[n], tvb, offset, 1, ENC_BIG_ENDIAN); break; } if ((flags >> (7-n)) & 0x01) { ies_found++; } } offset++; proto_item_append_text(new_ie_flags_ti, "" (%u IEs found)"", ies_found); /* Last bit set will indicate another flags byte follows... */ } while (0); /*((flags & 0x01) && (flag_bytes < 31));*/ /* Cell Portion ID */ if (cell_portion_id_present) { proto_tree_add_item(tree, hf_fp_cell_portion_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; } /* Ext Rx Timing Deviation */ if (ext_rx_timing_deviation_present) { guint8 extra_bits; guint bits_to_extend; switch (p_fp_info->division) { case Division_TDD_384: bits_to_extend = 1; break; case Division_TDD_768: bits_to_extend = 2; break; default: /* TODO: report unexpected division type */ bits_to_extend = 1; break; } extra_bits = tvb_get_guint8(tvb, offset) & ((bits_to_extend == 1) ? 0x01 : 0x03); rx_timing_deviation = (extra_bits << 8) | (rx_timing_deviation); proto_item_append_text(rx_timing_deviation_ti, "" (extended to 0x%x)"", rx_timing_deviation); proto_tree_add_bits_item(tree, hf_fp_extended_bits, tvb, offset*8 + (8-bits_to_extend), bits_to_extend, ENC_BIG_ENDIAN); offset++; } /* Ext propagation delay. */ if (ext_propagation_delay_present) { guint16 extra_bits = tvb_get_ntohs(tvb, offset) & 0x03ff; proto_tree_add_item(tree, hf_fp_ext_propagation_delay, tvb, offset, 2, ENC_BIG_ENDIAN); /* Adding 10 bits to original 8 */ proto_item_append_text(propagation_delay_ti, "" (extended to %u)"", ((extra_bits << 8) | propagation_delay) * 3); offset += 2; } /* Angle of Arrival (AOA) */ if (angle_of_arrival_present) { proto_tree_add_item(tree, hf_fp_angle_of_arrival, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; } /* Ext. Rx Sync UL Timing Deviation */ if (ext_rx_sync_ul_timing_deviation_present) { guint16 extra_bits; /* Ext received Sync UL Timing Deviation */ extra_bits = tvb_get_ntohs(tvb, offset) & 0x1fff; proto_tree_add_item(tree, hf_fp_ext_received_sync_ul_timing_deviation, tvb, offset, 2, ENC_BIG_ENDIAN); /* Adding 13 bits to original 8 */ proto_item_append_text(received_sync_ul_timing_deviation_ti, "" (extended to %u)"", (extra_bits << 8) | received_sync_ul_timing_deviation); offset += 2; } } if (preferences_header_checksum) { verify_header_crc(tvb, pinfo, header_crc_pi, header_crc, header_length); } /* Spare Extension and Payload CRC */ dissect_spare_extension_and_crc(tvb, pinfo, tree, 1, offset, header_length); } } ",0 " void CancelModalDialog() { NativeAppModalDialog* native_dialog = GetDialog(); native_dialog->CancelAppModalDialog(); } ",0 "void Document::processHttpEquivDefaultStyle(const AtomicString& content) { styleEngine().setSelectedStylesheetSetName(content); styleEngine().setPreferredStylesheetSetName(content); styleResolverChanged(); } ",0 "void Document::writeln(v8::Isolate* isolate, TrustedHTML* text, ExceptionState& exception_state) { DCHECK(origin_trials::TrustedDOMTypesEnabled(this)); writeln(text->toString(), EnteredDOMWindow(isolate)->document(), exception_state); } ",0 " void ExecuteScriptAndCheckPDFNavigation( RenderFrameHost* rfh, const std::string& javascript, ExpectedNavigationStatus expected_navigation_status) { const GURL original_url(shell()->web_contents()->GetLastCommittedURL()); const std::string expected_message = (expected_navigation_status == NAVIGATION_ALLOWED) ? std::string() : kDataUrlBlockedPattern; std::unique_ptr console_delegate; if (!expected_message.empty()) { console_delegate.reset(new ConsoleObserverDelegate( shell()->web_contents(), expected_message)); shell()->web_contents()->SetDelegate(console_delegate.get()); } TestNavigationObserver navigation_observer(shell()->web_contents()); EXPECT_TRUE(ExecuteScript(rfh, javascript)); if (console_delegate) { console_delegate->Wait(); shell()->web_contents()->SetDelegate(nullptr); } switch (expected_navigation_status) { case NAVIGATION_ALLOWED: navigation_observer.Wait(); EXPECT_TRUE(shell()->web_contents()->GetLastCommittedURL().SchemeIs( url::kDataScheme)); EXPECT_TRUE(navigation_observer.last_navigation_url().SchemeIs( url::kDataScheme)); EXPECT_TRUE(navigation_observer.last_navigation_succeeded()); break; case NAVIGATION_BLOCKED: EXPECT_EQ(original_url, shell()->web_contents()->GetLastCommittedURL()); EXPECT_FALSE(navigation_observer.last_navigation_succeeded()); break; default: NOTREACHED(); } } ",0 "static int jpeg2000_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { Jpeg2000DecoderContext *s = avctx->priv_data; ThreadFrame frame = { .f = data }; AVFrame *picture = data; int tileno, ret; s->avctx = avctx; bytestream2_init(&s->g, avpkt->data, avpkt->size); s->curtileno = -1; memset(s->cdef, -1, sizeof(s->cdef)); if (bytestream2_get_bytes_left(&s->g) < 2) { ret = AVERROR_INVALIDDATA; goto end; } if (bytestream2_get_bytes_left(&s->g) >= 12 && (bytestream2_get_be32u(&s->g) == 12) && (bytestream2_get_be32u(&s->g) == JP2_SIG_TYPE) && (bytestream2_get_be32u(&s->g) == JP2_SIG_VALUE)) { if (!jp2_find_codestream(s)) { av_log(avctx, AV_LOG_ERROR, ""Could not find Jpeg2000 codestream atom.\n""); ret = AVERROR_INVALIDDATA; goto end; } } else { bytestream2_seek(&s->g, 0, SEEK_SET); } if (bytestream2_get_be16u(&s->g) != JPEG2000_SOC) { av_log(avctx, AV_LOG_ERROR, ""SOC marker not present\n""); ret = AVERROR_INVALIDDATA; goto end; } if (ret = jpeg2000_read_main_headers(s)) goto end; /* get picture buffer */ if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0) goto end; picture->pict_type = AV_PICTURE_TYPE_I; picture->key_frame = 1; if (ret = jpeg2000_read_bitstream_packets(s)) goto end; for (tileno = 0; tileno < s->numXtiles * s->numYtiles; tileno++) if (ret = jpeg2000_decode_tile(s, s->tile + tileno, picture)) goto end; jpeg2000_dec_cleanup(s); *got_frame = 1; if (s->avctx->pix_fmt == AV_PIX_FMT_PAL8) memcpy(picture->data[1], s->palette, 256 * sizeof(uint32_t)); return bytestream2_tell(&s->g); end: jpeg2000_dec_cleanup(s); return ret; } ",0 "String WebFrame::source() const { if (!m_coreFrame) return String(); Document* document = m_coreFrame->document(); if (!document) return String(); TextResourceDecoder* decoder = document->decoder(); if (!decoder) return String(); DocumentLoader* documentLoader = m_coreFrame->loader()->activeDocumentLoader(); if (!documentLoader) return String(); RefPtr mainResourceData = documentLoader->mainResourceData(); if (!mainResourceData) return String(); return decoder->encoding().decode(mainResourceData->data(), mainResourceData->size()); } ",0 "void V8TestObject::LimitedToOnlyOtherAttributeAttributeSetterCallback( const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_limitedToOnlyOtherAttribute_Setter""); v8::Local v8_value = info[0]; test_object_v8_internal::LimitedToOnlyOtherAttributeAttributeSetter(v8_value, info); } ",0 "static void qeth_core_remove_device(struct ccwgroup_device *gdev) { unsigned long flags; struct qeth_card *card = dev_get_drvdata(&gdev->dev); QETH_DBF_TEXT(SETUP, 2, ""removedv""); if (card->discipline) { card->discipline->remove(gdev); qeth_core_free_discipline(card); } write_lock_irqsave(&qeth_core_card_list.rwlock, flags); list_del(&card->list); write_unlock_irqrestore(&qeth_core_card_list.rwlock, flags); qeth_core_free_card(card); dev_set_drvdata(&gdev->dev, NULL); put_device(&gdev->dev); return; } ",0 "static int oidc_authorization_request_set_cookie(request_rec *r, oidc_cfg *c, const char *state, oidc_proto_state_t *proto_state) { /* * create a cookie consisting of 8 elements: * random value, original URL, original method, issuer, response_type, response_mod, prompt and timestamp * encoded as JSON, encrypting the resulting JSON value */ char *cookieValue = oidc_proto_state_to_cookie(r, c, proto_state); if (cookieValue == NULL) return HTTP_INTERNAL_SERVER_ERROR; /* * clean expired state cookies to avoid pollution and optionally * try to avoid the number of state cookies exceeding a max */ int number_of_cookies = oidc_clean_expired_state_cookies(r, c, NULL, oidc_cfg_delete_oldest_state_cookies(c)); int max_number_of_cookies = oidc_cfg_max_number_of_state_cookies(c); if ((max_number_of_cookies > 0) && (number_of_cookies >= max_number_of_cookies)) { oidc_warn(r, ""the number of existing, valid state cookies (%d) has exceeded the limit (%d), no additional authorization request + state cookie can be generated, aborting the request"", number_of_cookies, max_number_of_cookies); /* * TODO: the html_send code below caters for the case that there's a user behind a * browser generating this request, rather than a piece of XHR code; how would an * XHR client handle this? */ /* * it appears that sending content with a 503 turns the HTTP status code * into a 200 so we'll avoid that for now: the user will see Apache specific * readable text anyway * return oidc_util_html_send_error(r, c->error_template, ""Too Many Outstanding Requests"", apr_psprintf(r->pool, ""No authentication request could be generated since there are too many outstanding authentication requests already; you may have to wait up to %d seconds to be able to create a new request"", c->state_timeout), HTTP_SERVICE_UNAVAILABLE); */ return HTTP_SERVICE_UNAVAILABLE; } /* assemble the cookie name for the state cookie */ const char *cookieName = oidc_get_state_cookie_name(r, state); /* set it as a cookie */ oidc_util_set_cookie(r, cookieName, cookieValue, -1, c->cookie_same_site ? OIDC_COOKIE_EXT_SAME_SITE_LAX : NULL); return HTTP_OK; } ",0 "static int inet6_fill_link_af(struct sk_buff *skb, const struct net_device *dev) { struct inet6_dev *idev = __in6_dev_get(dev); if (!idev) return -ENODATA; if (inet6_fill_ifla6_attrs(skb, idev) < 0) return -EMSGSIZE; return 0; } ",0 "size_t CalculateRequiredCountsBytes(size_t bucket_count) { const size_t kBytesPerBucket = 2 * sizeof(HistogramBase::AtomicCount); if (bucket_count > std::numeric_limits::max() / kBytesPerBucket) return 0; return bucket_count * kBytesPerBucket; } ",0 "inline void comps_rtree_pair_destroy(COMPS_RTreePair * pair) { free(pair->key); free(pair); } ",0 "int DetectEngineContentInspection(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, const Signature *s, const SigMatchData *smd, Flow *f, uint8_t *buffer, uint32_t buffer_len, uint32_t stream_start_offset, uint8_t inspection_mode, void *data) { SCEnter(); KEYWORD_PROFILING_START; det_ctx->inspection_recursion_counter++; if (det_ctx->inspection_recursion_counter == de_ctx->inspection_recursion_limit) { det_ctx->discontinue_matching = 1; KEYWORD_PROFILING_END(det_ctx, smd->type, 0); SCReturnInt(0); } if (smd == NULL || buffer_len == 0) { KEYWORD_PROFILING_END(det_ctx, smd->type, 0); SCReturnInt(0); } /* \todo unify this which is phase 2 of payload inspection unification */ if (smd->type == DETECT_CONTENT) { DetectContentData *cd = (DetectContentData *)smd->ctx; SCLogDebug(""inspecting content %""PRIu32"" buffer_len %""PRIu32, cd->id, buffer_len); /* we might have already have this content matched by the mpm. * (if there is any other reason why we'd want to avoid checking * it here, please fill it in) */ /* rule parsers should take care of this */ #ifdef DEBUG BUG_ON(cd->depth != 0 && cd->depth <= cd->offset); #endif /* search for our pattern, checking the matches recursively. * if we match we look for the next SigMatch as well */ uint8_t *found = NULL; uint32_t offset = 0; uint32_t depth = buffer_len; uint32_t prev_offset = 0; /**< used in recursive searching */ uint32_t prev_buffer_offset = det_ctx->buffer_offset; do { if ((cd->flags & DETECT_CONTENT_DISTANCE) || (cd->flags & DETECT_CONTENT_WITHIN)) { SCLogDebug(""det_ctx->buffer_offset %""PRIu32, det_ctx->buffer_offset); offset = prev_buffer_offset; depth = buffer_len; int distance = cd->distance; if (cd->flags & DETECT_CONTENT_DISTANCE) { if (cd->flags & DETECT_CONTENT_DISTANCE_BE) { distance = det_ctx->bj_values[cd->distance]; } if (distance < 0 && (uint32_t)(abs(distance)) > offset) offset = 0; else offset += distance; SCLogDebug(""cd->distance %""PRIi32"", offset %""PRIu32"", depth %""PRIu32, distance, offset, depth); } if (cd->flags & DETECT_CONTENT_WITHIN) { if (cd->flags & DETECT_CONTENT_WITHIN_BE) { if ((int32_t)depth > (int32_t)(prev_buffer_offset + det_ctx->bj_values[cd->within] + distance)) { depth = prev_buffer_offset + det_ctx->bj_values[cd->within] + distance; } } else { if ((int32_t)depth > (int32_t)(prev_buffer_offset + cd->within + distance)) { depth = prev_buffer_offset + cd->within + distance; } SCLogDebug(""cd->within %""PRIi32"", det_ctx->buffer_offset %""PRIu32"", depth %""PRIu32, cd->within, prev_buffer_offset, depth); } if (stream_start_offset != 0 && prev_buffer_offset == 0) { if (depth <= stream_start_offset) { goto no_match; } else if (depth >= (stream_start_offset + buffer_len)) { ; } else { depth = depth - stream_start_offset; } } } if (cd->flags & DETECT_CONTENT_DEPTH_BE) { if ((det_ctx->bj_values[cd->depth] + prev_buffer_offset) < depth) { depth = prev_buffer_offset + det_ctx->bj_values[cd->depth]; } } else { if (cd->depth != 0) { if ((cd->depth + prev_buffer_offset) < depth) { depth = prev_buffer_offset + cd->depth; } SCLogDebug(""cd->depth %""PRIu32"", depth %""PRIu32, cd->depth, depth); } } if (cd->flags & DETECT_CONTENT_OFFSET_BE) { if (det_ctx->bj_values[cd->offset] > offset) offset = det_ctx->bj_values[cd->offset]; } else { if (cd->offset > offset) { offset = cd->offset; SCLogDebug(""setting offset %""PRIu32, offset); } } } else { /* implied no relative matches */ /* set depth */ if (cd->flags & DETECT_CONTENT_DEPTH_BE) { depth = det_ctx->bj_values[cd->depth]; } else { if (cd->depth != 0) { depth = cd->depth; } } if (stream_start_offset != 0 && cd->flags & DETECT_CONTENT_DEPTH) { if (depth <= stream_start_offset) { goto no_match; } else if (depth >= (stream_start_offset + buffer_len)) { ; } else { depth = depth - stream_start_offset; } } /* set offset */ if (cd->flags & DETECT_CONTENT_OFFSET_BE) offset = det_ctx->bj_values[cd->offset]; else offset = cd->offset; prev_buffer_offset = 0; } /* update offset with prev_offset if we're searching for * matches after the first occurence. */ SCLogDebug(""offset %""PRIu32"", prev_offset %""PRIu32, offset, prev_offset); if (prev_offset != 0) offset = prev_offset; SCLogDebug(""offset %""PRIu32"", depth %""PRIu32, offset, depth); if (depth > buffer_len) depth = buffer_len; /* if offset is bigger than depth we can never match on a pattern. * We can however, ""match"" on a negated pattern. */ if (offset > depth || depth == 0) { if (cd->flags & DETECT_CONTENT_NEGATED) { goto match; } else { goto no_match; } } uint8_t *sbuffer = buffer + offset; uint32_t sbuffer_len = depth - offset; uint32_t match_offset = 0; SCLogDebug(""sbuffer_len %""PRIu32, sbuffer_len); #ifdef DEBUG BUG_ON(sbuffer_len > buffer_len); #endif /* \todo Add another optimization here. If cd->content_len is * greater than sbuffer_len found is anyways NULL */ /* do the actual search */ found = SpmScan(cd->spm_ctx, det_ctx->spm_thread_ctx, sbuffer, sbuffer_len); /* next we evaluate the result in combination with the * negation flag. */ SCLogDebug(""found %p cd negated %s"", found, cd->flags & DETECT_CONTENT_NEGATED ? ""true"" : ""false""); if (found == NULL && !(cd->flags & DETECT_CONTENT_NEGATED)) { goto no_match; } else if (found == NULL && (cd->flags & DETECT_CONTENT_NEGATED)) { goto match; } else if (found != NULL && (cd->flags & DETECT_CONTENT_NEGATED)) { SCLogDebug(""content %""PRIu32"" matched at offset %""PRIu32"", but negated so no match"", cd->id, match_offset); /* don't bother carrying recursive matches now, for preceding * relative keywords */ if (DETECT_CONTENT_IS_SINGLE(cd)) det_ctx->discontinue_matching = 1; goto no_match; } else { match_offset = (uint32_t)((found - buffer) + cd->content_len); SCLogDebug(""content %""PRIu32"" matched at offset %""PRIu32"""", cd->id, match_offset); det_ctx->buffer_offset = match_offset; /* Match branch, add replace to the list if needed */ if (cd->flags & DETECT_CONTENT_REPLACE) { if (inspection_mode == DETECT_ENGINE_CONTENT_INSPECTION_MODE_PAYLOAD) { /* we will need to replace content if match is confirmed */ det_ctx->replist = DetectReplaceAddToList(det_ctx->replist, found, cd); } else { SCLogWarning(SC_ERR_INVALID_VALUE, ""Can't modify payload without packet""); } } if (!(cd->flags & DETECT_CONTENT_RELATIVE_NEXT)) { SCLogDebug(""no relative match coming up, so this is a match""); goto match; } /* bail out if we have no next match. Technically this is an * error, as the current cd has the DETECT_CONTENT_RELATIVE_NEXT * flag set. */ if (smd->is_last) { goto no_match; } SCLogDebug(""content %""PRIu32, cd->id); KEYWORD_PROFILING_END(det_ctx, smd->type, 1); /* see if the next buffer keywords match. If not, we will * search for another occurence of this content and see * if the others match then until we run out of matches */ int r = DetectEngineContentInspection(de_ctx, det_ctx, s, smd+1, f, buffer, buffer_len, stream_start_offset, inspection_mode, data); if (r == 1) { SCReturnInt(1); } if (det_ctx->discontinue_matching) goto no_match; /* set the previous match offset to the start of this match + 1 */ prev_offset = (match_offset - (cd->content_len - 1)); SCLogDebug(""trying to see if there is another match after prev_offset %""PRIu32, prev_offset); } } while(1); } else if (smd->type == DETECT_ISDATAAT) { SCLogDebug(""inspecting isdataat""); DetectIsdataatData *id = (DetectIsdataatData *)smd->ctx; if (id->flags & ISDATAAT_RELATIVE) { if (det_ctx->buffer_offset + id->dataat > buffer_len) { SCLogDebug(""det_ctx->buffer_offset + id->dataat %""PRIu32"" > %""PRIu32, det_ctx->buffer_offset + id->dataat, buffer_len); if (id->flags & ISDATAAT_NEGATED) goto match; goto no_match; } else { SCLogDebug(""relative isdataat match""); if (id->flags & ISDATAAT_NEGATED) goto no_match; goto match; } } else { if (id->dataat < buffer_len) { SCLogDebug(""absolute isdataat match""); if (id->flags & ISDATAAT_NEGATED) goto no_match; goto match; } else { SCLogDebug(""absolute isdataat mismatch, id->isdataat %""PRIu32"", buffer_len %""PRIu32"""", id->dataat, buffer_len); if (id->flags & ISDATAAT_NEGATED) goto match; goto no_match; } } } else if (smd->type == DETECT_PCRE) { SCLogDebug(""inspecting pcre""); DetectPcreData *pe = (DetectPcreData *)smd->ctx; uint32_t prev_buffer_offset = det_ctx->buffer_offset; uint32_t prev_offset = 0; int r = 0; det_ctx->pcre_match_start_offset = 0; do { Packet *p = NULL; if (inspection_mode == DETECT_ENGINE_CONTENT_INSPECTION_MODE_PAYLOAD) p = (Packet *)data; r = DetectPcrePayloadMatch(det_ctx, s, smd, p, f, buffer, buffer_len); if (r == 0) { goto no_match; } if (!(pe->flags & DETECT_PCRE_RELATIVE_NEXT)) { SCLogDebug(""no relative match coming up, so this is a match""); goto match; } KEYWORD_PROFILING_END(det_ctx, smd->type, 1); /* save it, in case we need to do a pcre match once again */ prev_offset = det_ctx->pcre_match_start_offset; /* see if the next payload keywords match. If not, we will * search for another occurence of this pcre and see * if the others match, until we run out of matches */ r = DetectEngineContentInspection(de_ctx, det_ctx, s, smd+1, f, buffer, buffer_len, stream_start_offset, inspection_mode, data); if (r == 1) { SCReturnInt(1); } if (det_ctx->discontinue_matching) goto no_match; det_ctx->buffer_offset = prev_buffer_offset; det_ctx->pcre_match_start_offset = prev_offset; } while (1); } else if (smd->type == DETECT_BYTETEST) { DetectBytetestData *btd = (DetectBytetestData *)smd->ctx; uint8_t flags = btd->flags; int32_t offset = btd->offset; uint64_t value = btd->value; if (flags & DETECT_BYTETEST_OFFSET_BE) { offset = det_ctx->bj_values[offset]; } if (flags & DETECT_BYTETEST_VALUE_BE) { value = det_ctx->bj_values[value]; } /* if we have dce enabled we will have to use the endianness * specified by the dce header */ if (flags & DETECT_BYTETEST_DCE && data != NULL) { DCERPCState *dcerpc_state = (DCERPCState *)data; /* enable the endianness flag temporarily. once we are done * processing we reset the flags to the original value*/ flags |= ((dcerpc_state->dcerpc.dcerpchdr.packed_drep[0] & 0x10) ? DETECT_BYTETEST_LITTLE: 0); } if (DetectBytetestDoMatch(det_ctx, s, smd->ctx, buffer, buffer_len, flags, offset, value) != 1) { goto no_match; } goto match; } else if (smd->type == DETECT_BYTEJUMP) { DetectBytejumpData *bjd = (DetectBytejumpData *)smd->ctx; uint8_t flags = bjd->flags; int32_t offset = bjd->offset; if (flags & DETECT_BYTEJUMP_OFFSET_BE) { offset = det_ctx->bj_values[offset]; } /* if we have dce enabled we will have to use the endianness * specified by the dce header */ if (flags & DETECT_BYTEJUMP_DCE && data != NULL) { DCERPCState *dcerpc_state = (DCERPCState *)data; /* enable the endianness flag temporarily. once we are done * processing we reset the flags to the original value*/ flags |= ((dcerpc_state->dcerpc.dcerpchdr.packed_drep[0] & 0x10) ? DETECT_BYTEJUMP_LITTLE: 0); } if (DetectBytejumpDoMatch(det_ctx, s, smd->ctx, buffer, buffer_len, flags, offset) != 1) { goto no_match; } goto match; } else if (smd->type == DETECT_BYTE_EXTRACT) { DetectByteExtractData *bed = (DetectByteExtractData *)smd->ctx; uint8_t endian = bed->endian; /* if we have dce enabled we will have to use the endianness * specified by the dce header */ if ((bed->flags & DETECT_BYTE_EXTRACT_FLAG_ENDIAN) && endian == DETECT_BYTE_EXTRACT_ENDIAN_DCE && data != NULL) { DCERPCState *dcerpc_state = (DCERPCState *)data; /* enable the endianness flag temporarily. once we are done * processing we reset the flags to the original value*/ endian |= ((dcerpc_state->dcerpc.dcerpchdr.packed_drep[0] == 0x10) ? DETECT_BYTE_EXTRACT_ENDIAN_LITTLE : DETECT_BYTE_EXTRACT_ENDIAN_BIG); } if (DetectByteExtractDoMatch(det_ctx, smd, s, buffer, buffer_len, &det_ctx->bj_values[bed->local_id], endian) != 1) { goto no_match; } goto match; /* we should never get here, but bail out just in case */ } else if (smd->type == DETECT_AL_URILEN) { SCLogDebug(""inspecting uri len""); int r = 0; DetectUrilenData *urilend = (DetectUrilenData *) smd->ctx; switch (urilend->mode) { case DETECT_URILEN_EQ: if (buffer_len == urilend->urilen1) r = 1; break; case DETECT_URILEN_LT: if (buffer_len < urilend->urilen1) r = 1; break; case DETECT_URILEN_GT: if (buffer_len > urilend->urilen1) r = 1; break; case DETECT_URILEN_RA: if (buffer_len > urilend->urilen1 && buffer_len < urilend->urilen2) { r = 1; } break; } if (r == 1) { goto match; } det_ctx->discontinue_matching = 0; goto no_match; #ifdef HAVE_LUA } else if (smd->type == DETECT_LUA) { SCLogDebug(""lua starting""); if (DetectLuaMatchBuffer(det_ctx, s, smd, buffer, buffer_len, det_ctx->buffer_offset, f) != 1) { SCLogDebug(""lua no_match""); goto no_match; } SCLogDebug(""lua match""); goto match; #endif /* HAVE_LUA */ } else if (smd->type == DETECT_BASE64_DECODE) { if (DetectBase64DecodeDoMatch(det_ctx, s, smd, buffer, buffer_len)) { if (s->sm_arrays[DETECT_SM_LIST_BASE64_DATA] != NULL) { KEYWORD_PROFILING_END(det_ctx, smd->type, 1); if (DetectBase64DataDoMatch(de_ctx, det_ctx, s, f)) { /* Base64 is a terminal list. */ goto final_match; } } } } else { SCLogDebug(""sm->type %u"", smd->type); #ifdef DEBUG BUG_ON(1); #endif } no_match: KEYWORD_PROFILING_END(det_ctx, smd->type, 0); SCReturnInt(0); match: /* this sigmatch matched, inspect the next one. If it was the last, * the buffer portion of the signature matched. */ if (!smd->is_last) { KEYWORD_PROFILING_END(det_ctx, smd->type, 1); int r = DetectEngineContentInspection(de_ctx, det_ctx, s, smd+1, f, buffer, buffer_len, stream_start_offset, inspection_mode, data); SCReturnInt(r); } final_match: KEYWORD_PROFILING_END(det_ctx, smd->type, 1); SCReturnInt(1); } ",1 "static bool detect_write_flooding(struct kvm_mmu_page *sp) { /* * Skip write-flooding detected for the sp whose level is 1, because * it can become unsync, then the guest page is not write-protected. */ if (sp->role.level == PT_PAGE_TABLE_LEVEL) return false; return ++sp->write_flooding_count >= 3; } ",0 "bool RenderLayerCompositor::canAccelerateVideoRendering(RenderVideo* o) const { if (!m_hasAcceleratedCompositing) return false; return o->supportsAcceleratedRendering(); } ",0 "TestDataReductionProxyConfig::TestDataReductionProxyConfig( std::unique_ptr config_values, scoped_refptr io_task_runner, scoped_refptr ui_task_runner, DataReductionProxyConfigurator* configurator) : DataReductionProxyConfig( io_task_runner, ui_task_runner, network::TestNetworkConnectionTracker::GetInstance(), std::move(config_values), configurator), tick_clock_(nullptr), is_captive_portal_(false), add_default_proxy_bypass_rules_(true) {} ",0 " static std::string redirect_headers() { return URLRequestTestJob::test_redirect_headers(); } ",0 "threadsTest(const char *filename ATTRIBUTE_UNUSED, const char *resul ATTRIBUTE_UNUSED, const char *err ATTRIBUTE_UNUSED, int options ATTRIBUTE_UNUSED) { return(testThread()); } ",0 "void jswrap_graphics_drawString(JsVar *parent, JsVar *var, int x, int y) { JsGraphics gfx; if (!graphicsGetFromVar(&gfx, parent)) return; JsVar *customBitmap = 0, *customWidth = 0; int customHeight = 0, customFirstChar = 0; if (gfx.data.fontSize>0) { customHeight = gfx.data.fontSize; } else if (gfx.data.fontSize == JSGRAPHICS_FONTSIZE_4X6) { customHeight = 6; } else if (gfx.data.fontSize == JSGRAPHICS_FONTSIZE_CUSTOM) { customBitmap = jsvObjectGetChild(parent, JSGRAPHICS_CUSTOMFONT_BMP, 0); customWidth = jsvObjectGetChild(parent, JSGRAPHICS_CUSTOMFONT_WIDTH, 0); customHeight = (int)jsvGetIntegerAndUnLock(jsvObjectGetChild(parent, JSGRAPHICS_CUSTOMFONT_HEIGHT, 0)); customFirstChar = (int)jsvGetIntegerAndUnLock(jsvObjectGetChild(parent, JSGRAPHICS_CUSTOMFONT_FIRSTCHAR, 0)); } JsGraphicsFlags oldFlags = gfx.data.flags; if (gfx.data.fontRotate==1) { gfx.data.flags ^= JSGRAPHICSFLAGS_SWAP_XY | JSGRAPHICSFLAGS_INVERT_X; int t = gfx.data.width - (x+1); x = y; y = t; } else if (gfx.data.fontRotate==2) { gfx.data.flags ^= JSGRAPHICSFLAGS_INVERT_X | JSGRAPHICSFLAGS_INVERT_Y; x = gfx.data.width - (x+1); y = gfx.data.height - (y+1); } else if (gfx.data.fontRotate==3) { gfx.data.flags ^= JSGRAPHICSFLAGS_SWAP_XY | JSGRAPHICSFLAGS_INVERT_Y; int t = gfx.data.height - (y+1); y = x; x = t; } if (gfx.data.fontAlignX>=0) x -= jswrap_graphics_stringWidth(parent, var) * (gfx.data.fontAlignX+1)/2; if (gfx.data.fontAlignY>=0) y -= customHeight * (gfx.data.fontAlignX+1)/2; int maxX = (gfx.data.flags & JSGRAPHICSFLAGS_SWAP_XY) ? gfx.data.height : gfx.data.width; int maxY = (gfx.data.flags & JSGRAPHICSFLAGS_SWAP_XY) ? gfx.data.width : gfx.data.height; int startx = x; JsVar *str = jsvAsString(var, false); JsvStringIterator it; jsvStringIteratorNew(&it, str, 0); while (jsvStringIteratorHasChar(&it)) { char ch = jsvStringIteratorGetChar(&it); if (ch=='\n') { x = startx; y += customHeight; jsvStringIteratorNext(&it); continue; } if (gfx.data.fontSize>0) { #ifndef SAVE_ON_FLASH int w = (int)graphicsVectorCharWidth(&gfx, gfx.data.fontSize, ch); if (x>-w && x-gfx.data.fontSize && y-4 && x-6 && y=customFirstChar) { JsvStringIterator wit; jsvStringIteratorNew(&wit, customWidth, 0); while (jsvStringIteratorHasChar(&wit) && (int)jsvStringIteratorGetIndex(&wit)<(ch-customFirstChar)) { bmpOffset += (unsigned char)jsvStringIteratorGetChar(&wit); jsvStringIteratorNext(&wit); } width = (unsigned char)jsvStringIteratorGetChar(&wit); jsvStringIteratorFree(&wit); } } else { width = (int)jsvGetInteger(customWidth); bmpOffset = width*(ch-customFirstChar); } if (ch>=customFirstChar && (x>-width) && (x-customHeight) && y>3); bmpOffset &= 7; int cx,cy; for (cx=0;cxnext) { if (strcmp(obj->font.name, font) == 0) break; last_index = obj->font.index; } /* Create a new font object if we need it */ if (!obj) { obj = pdf_add_object(pdf, OBJ_font); if (!obj) return pdf->errval; strncpy(obj->font.name, font, sizeof(obj->font.name)); obj->font.name[sizeof(obj->font.name) - 1] = '\0'; obj->font.index = last_index + 1; } pdf->current_font = obj; return 0; } ",0 "GBool CachedFileStream::fillBuf() { int n; bufPos += bufEnd - buf; bufPtr = bufEnd = buf; if (limited && bufPos >= start + length) { return gFalse; } if (limited && bufPos + cachedStreamBufSize > start + length) { n = start + length - bufPos; } else { n = cachedStreamBufSize - (bufPos % cachedStreamBufSize); } cc->read(buf, 1, n); bufEnd = buf + n; if (bufPtr >= bufEnd) { return gFalse; } return gTrue; } ",0 "static ssize_t pmcraid_show_adapter_id( struct device *dev, struct device_attribute *attr, char *buf ) { struct Scsi_Host *shost = class_to_shost(dev); struct pmcraid_instance *pinstance = (struct pmcraid_instance *)shost->hostdata; u32 adapter_id = (pinstance->pdev->bus->number << 8) | pinstance->pdev->devfn; u32 aen_group = pmcraid_event_family.id; return snprintf(buf, PAGE_SIZE, ""adapter id: %d\nminor: %d\naen group: %d\n"", adapter_id, MINOR(pinstance->cdev.dev), aen_group); } ",0 " ScopedExtensionPrefUpdate(PrefService* service, const std::string& extension_id) : DictionaryPrefUpdate(service, ExtensionPrefs::kExtensionsPref), prefs_(service), extension_id_(extension_id) {} ",0 "ContentSecurityPolicy::ExposeForNavigationalChecks() const { std::vector policies; for (const auto& policy : policies_) { policies.push_back(policy->ExposeForNavigationalChecks()); } WebContentSecurityPolicyList list; list.policies = policies; if (self_source_) list.self_source = self_source_->ExposeForNavigationalChecks(); return list; } ",0 " bool IsGroupStored(const GURL& manifest_url) { return mock_storage()->IsGroupForManifestStored(manifest_url); } ",0 "long dtls1_ctrl(SSL *s, int cmd, long larg, void *parg) { int ret = 0; switch (cmd) { case DTLS_CTRL_GET_TIMEOUT: if (dtls1_get_timeout(s, (struct timeval *)parg) != NULL) { ret = 1; } break; case DTLS_CTRL_HANDLE_TIMEOUT: ret = dtls1_handle_timeout(s); break; case DTLS_CTRL_LISTEN: ret = dtls1_listen(s, parg); break; case SSL_CTRL_CHECK_PROTO_VERSION: /* * For library-internal use; checks that the current protocol is the * highest enabled version (according to s->ctx->method, as version * negotiation may have changed s->method). */ if (s->version == s->ctx->method->version) return 1; /* * Apparently we're using a version-flexible SSL_METHOD (not at its * highest protocol version). */ if (s->ctx->method->version == DTLS_method()->version) { #if DTLS_MAX_VERSION != DTLS1_2_VERSION # error Code needs update for DTLS_method() support beyond DTLS1_2_VERSION. #endif if (!(s->options & SSL_OP_NO_DTLSv1_2)) return s->version == DTLS1_2_VERSION; if (!(s->options & SSL_OP_NO_DTLSv1)) return s->version == DTLS1_VERSION; } return 0; /* Unexpected state; fail closed. */ case DTLS_CTRL_SET_LINK_MTU: if (larg < (long)dtls1_link_min_mtu()) return 0; s->d1->link_mtu = larg; return 1; case DTLS_CTRL_GET_LINK_MIN_MTU: return (long)dtls1_link_min_mtu(); case SSL_CTRL_SET_MTU: /* * We may not have a BIO set yet so can't call dtls1_min_mtu() * We'll have to make do with dtls1_link_min_mtu() and max overhead */ if (larg < (long)dtls1_link_min_mtu() - DTLS1_MAX_MTU_OVERHEAD) return 0; s->d1->mtu = larg; return larg; default: ret = ssl3_ctrl(s, cmd, larg, parg); break; } return (ret); } ",0 "static void ip_vs_copy_usvc_compat(struct ip_vs_service_user_kern *usvc, struct ip_vs_service_user *usvc_compat) { usvc->af = AF_INET; usvc->protocol = usvc_compat->protocol; usvc->addr.ip = usvc_compat->addr; usvc->port = usvc_compat->port; usvc->fwmark = usvc_compat->fwmark; /* Deep copy of sched_name is not needed here */ usvc->sched_name = usvc_compat->sched_name; usvc->flags = usvc_compat->flags; usvc->timeout = usvc_compat->timeout; usvc->netmask = usvc_compat->netmask; } ",0 "void btif_hl_start_cch_timer(UINT8 app_idx, UINT8 mcl_idx) { btif_hl_mcl_cb_t *p_mcb = BTIF_HL_GET_MCL_CB_PTR(app_idx, mcl_idx); BTIF_TRACE_DEBUG(""%s app_idx=%d, mcl_idx=%d timer_active=%d timer_in_use=%d"", __FUNCTION__,app_idx, mcl_idx, p_mcb->cch_timer_active, p_mcb->cch_timer.in_use); p_mcb->cch_timer_active = TRUE; if (!p_mcb->cch_timer.in_use) { BTIF_TRACE_DEBUG(""Start CCH timer ""); memset(&p_mcb->cch_timer, 0, sizeof(TIMER_LIST_ENT)); p_mcb->cch_timer.param = (UINT32)btif_hl_tmr_hdlr; btu_start_timer(&p_mcb->cch_timer, BTU_TTYPE_USER_FUNC, BTIF_TIMEOUT_CCH_NO_DCH_SECS); } else { BTIF_TRACE_DEBUG(""Restart CCH timer ""); btu_stop_timer(&p_mcb->cch_timer); btu_start_timer(&p_mcb->cch_timer, BTU_TTYPE_USER_FUNC, BTIF_TIMEOUT_CCH_NO_DCH_SECS); } } ",0 "int asn1_ber_decoder(const struct asn1_decoder *decoder, void *context, const unsigned char *data, size_t datalen) { const unsigned char *machine = decoder->machine; const asn1_action_t *actions = decoder->actions; size_t machlen = decoder->machlen; enum asn1_opcode op; unsigned char tag = 0, csp = 0, jsp = 0, optag = 0, hdr = 0; const char *errmsg; size_t pc = 0, dp = 0, tdp = 0, len = 0; int ret; unsigned char flags = 0; #define FLAG_INDEFINITE_LENGTH 0x01 #define FLAG_MATCHED 0x02 #define FLAG_LAST_MATCHED 0x04 /* Last tag matched */ #define FLAG_CONS 0x20 /* Corresponds to CONS bit in the opcode tag * - ie. whether or not we are going to parse * a compound type. */ #define NR_CONS_STACK 10 unsigned short cons_dp_stack[NR_CONS_STACK]; unsigned short cons_datalen_stack[NR_CONS_STACK]; unsigned char cons_hdrlen_stack[NR_CONS_STACK]; #define NR_JUMP_STACK 10 unsigned char jump_stack[NR_JUMP_STACK]; if (datalen > 65535) return -EMSGSIZE; next_op: pr_debug(""next_op: pc=\e[32m%zu\e[m/%zu dp=\e[33m%zu\e[m/%zu C=%d J=%d\n"", pc, machlen, dp, datalen, csp, jsp); if (unlikely(pc >= machlen)) goto machine_overrun_error; op = machine[pc]; if (unlikely(pc + asn1_op_lengths[op] > machlen)) goto machine_overrun_error; /* If this command is meant to match a tag, then do that before * evaluating the command. */ if (op <= ASN1_OP__MATCHES_TAG) { unsigned char tmp; /* Skip conditional matches if possible */ if ((op & ASN1_OP_MATCH__COND && flags & FLAG_MATCHED) || dp == datalen) { flags &= ~FLAG_LAST_MATCHED; pc += asn1_op_lengths[op]; goto next_op; } flags = 0; hdr = 2; /* Extract a tag from the data */ if (unlikely(dp >= datalen - 1)) goto data_overrun_error; tag = data[dp++]; if (unlikely((tag & 0x1f) == ASN1_LONG_TAG)) goto long_tag_not_supported; if (op & ASN1_OP_MATCH__ANY) { pr_debug(""- any %02x\n"", tag); } else { /* Extract the tag from the machine * - Either CONS or PRIM are permitted in the data if * CONS is not set in the op stream, otherwise CONS * is mandatory. */ optag = machine[pc + 1]; flags |= optag & FLAG_CONS; /* Determine whether the tag matched */ tmp = optag ^ tag; tmp &= ~(optag & ASN1_CONS_BIT); pr_debug(""- match? %02x %02x %02x\n"", tag, optag, tmp); if (tmp != 0) { /* All odd-numbered tags are MATCH_OR_SKIP. */ if (op & ASN1_OP_MATCH__SKIP) { pc += asn1_op_lengths[op]; dp--; goto next_op; } goto tag_mismatch; } } flags |= FLAG_MATCHED; len = data[dp++]; if (len > 0x7f) { if (unlikely(len == ASN1_INDEFINITE_LENGTH)) { /* Indefinite length */ if (unlikely(!(tag & ASN1_CONS_BIT))) goto indefinite_len_primitive; flags |= FLAG_INDEFINITE_LENGTH; if (unlikely(2 > datalen - dp)) goto data_overrun_error; } else { int n = len - 0x80; if (unlikely(n > 2)) goto length_too_long; if (unlikely(dp >= datalen - n)) goto data_overrun_error; hdr += n; for (len = 0; n > 0; n--) { len <<= 8; len |= data[dp++]; } if (unlikely(len > datalen - dp)) goto data_overrun_error; } } if (flags & FLAG_CONS) { /* For expected compound forms, we stack the positions * of the start and end of the data. */ if (unlikely(csp >= NR_CONS_STACK)) goto cons_stack_overflow; cons_dp_stack[csp] = dp; cons_hdrlen_stack[csp] = hdr; if (!(flags & FLAG_INDEFINITE_LENGTH)) { cons_datalen_stack[csp] = datalen; datalen = dp + len; } else { cons_datalen_stack[csp] = 0; } csp++; } pr_debug(""- TAG: %02x %zu%s\n"", tag, len, flags & FLAG_CONS ? "" CONS"" : """"); tdp = dp; } /* Decide how to handle the operation */ switch (op) { case ASN1_OP_MATCH_ANY_ACT: case ASN1_OP_COND_MATCH_ANY_ACT: ret = actions[machine[pc + 1]](context, hdr, tag, data + dp, len); if (ret < 0) return ret; goto skip_data; case ASN1_OP_MATCH_ACT: case ASN1_OP_MATCH_ACT_OR_SKIP: case ASN1_OP_COND_MATCH_ACT_OR_SKIP: ret = actions[machine[pc + 2]](context, hdr, tag, data + dp, len); if (ret < 0) return ret; goto skip_data; case ASN1_OP_MATCH: case ASN1_OP_MATCH_OR_SKIP: case ASN1_OP_MATCH_ANY: case ASN1_OP_COND_MATCH_OR_SKIP: case ASN1_OP_COND_MATCH_ANY: skip_data: if (!(flags & FLAG_CONS)) { if (flags & FLAG_INDEFINITE_LENGTH) { ret = asn1_find_indefinite_length( data, datalen, &dp, &len, &errmsg); if (ret < 0) goto error; } else { dp += len; } pr_debug(""- LEAF: %zu\n"", len); } pc += asn1_op_lengths[op]; goto next_op; case ASN1_OP_MATCH_JUMP: case ASN1_OP_MATCH_JUMP_OR_SKIP: case ASN1_OP_COND_MATCH_JUMP_OR_SKIP: pr_debug(""- MATCH_JUMP\n""); if (unlikely(jsp == NR_JUMP_STACK)) goto jump_stack_overflow; jump_stack[jsp++] = pc + asn1_op_lengths[op]; pc = machine[pc + 2]; goto next_op; case ASN1_OP_COND_FAIL: if (unlikely(!(flags & FLAG_MATCHED))) goto tag_mismatch; pc += asn1_op_lengths[op]; goto next_op; case ASN1_OP_COMPLETE: if (unlikely(jsp != 0 || csp != 0)) { pr_err(""ASN.1 decoder error: Stacks not empty at completion (%u, %u)\n"", jsp, csp); return -EBADMSG; } return 0; case ASN1_OP_END_SET: case ASN1_OP_END_SET_ACT: if (unlikely(!(flags & FLAG_MATCHED))) goto tag_mismatch; case ASN1_OP_END_SEQ: case ASN1_OP_END_SET_OF: case ASN1_OP_END_SEQ_OF: case ASN1_OP_END_SEQ_ACT: case ASN1_OP_END_SET_OF_ACT: case ASN1_OP_END_SEQ_OF_ACT: if (unlikely(csp <= 0)) goto cons_stack_underflow; csp--; tdp = cons_dp_stack[csp]; hdr = cons_hdrlen_stack[csp]; len = datalen; datalen = cons_datalen_stack[csp]; pr_debug(""- end cons t=%zu dp=%zu l=%zu/%zu\n"", tdp, dp, len, datalen); if (datalen == 0) { /* Indefinite length - check for the EOC. */ datalen = len; if (unlikely(datalen - dp < 2)) goto data_overrun_error; if (data[dp++] != 0) { if (op & ASN1_OP_END__OF) { dp--; csp++; pc = machine[pc + 1]; pr_debug(""- continue\n""); goto next_op; } goto missing_eoc; } if (data[dp++] != 0) goto invalid_eoc; len = dp - tdp - 2; } else { if (dp < len && (op & ASN1_OP_END__OF)) { datalen = len; csp++; pc = machine[pc + 1]; pr_debug(""- continue\n""); goto next_op; } if (dp != len) goto cons_length_error; len -= tdp; pr_debug(""- cons len l=%zu d=%zu\n"", len, dp - tdp); } if (op & ASN1_OP_END__ACT) { unsigned char act; if (op & ASN1_OP_END__OF) act = machine[pc + 2]; else act = machine[pc + 1]; ret = actions[act](context, hdr, 0, data + tdp, len); } pc += asn1_op_lengths[op]; goto next_op; case ASN1_OP_MAYBE_ACT: if (!(flags & FLAG_LAST_MATCHED)) { pc += asn1_op_lengths[op]; goto next_op; } case ASN1_OP_ACT: ret = actions[machine[pc + 1]](context, hdr, tag, data + tdp, len); if (ret < 0) return ret; pc += asn1_op_lengths[op]; goto next_op; case ASN1_OP_RETURN: if (unlikely(jsp <= 0)) goto jump_stack_underflow; pc = jump_stack[--jsp]; flags |= FLAG_MATCHED | FLAG_LAST_MATCHED; goto next_op; default: break; } /* Shouldn't reach here */ pr_err(""ASN.1 decoder error: Found reserved opcode (%u) pc=%zu\n"", op, pc); return -EBADMSG; data_overrun_error: errmsg = ""Data overrun error""; goto error; machine_overrun_error: errmsg = ""Machine overrun error""; goto error; jump_stack_underflow: errmsg = ""Jump stack underflow""; goto error; jump_stack_overflow: errmsg = ""Jump stack overflow""; goto error; cons_stack_underflow: errmsg = ""Cons stack underflow""; goto error; cons_stack_overflow: errmsg = ""Cons stack overflow""; goto error; cons_length_error: errmsg = ""Cons length error""; goto error; missing_eoc: errmsg = ""Missing EOC in indefinite len cons""; goto error; invalid_eoc: errmsg = ""Invalid length EOC""; goto error; length_too_long: errmsg = ""Unsupported length""; goto error; indefinite_len_primitive: errmsg = ""Indefinite len primitive not permitted""; goto error; tag_mismatch: errmsg = ""Unexpected tag""; goto error; long_tag_not_supported: errmsg = ""Long tag not supported""; error: pr_debug(""\nASN1: %s [m=%zu d=%zu ot=%02x t=%02x l=%zu]\n"", errmsg, pc, dp, optag, tag, len); return -EBADMSG; } ",1 " DailyDataSavingUpdate( const char* pref_original, const char* pref_received, PrefService* pref_service) : pref_original_(pref_original), pref_received_(pref_received), original_update_(pref_service, pref_original_), received_update_(pref_service, pref_received_) { } ",1 "ui::AXTreeIDRegistry::AXTreeID RenderFrameHostImpl::GetAXTreeID() { return ax_tree_id_; } ",0 "static int decode_new_pred(Mpeg4DecContext *ctx, GetBitContext *gb) { MpegEncContext *s = &ctx->m; int len = FFMIN(ctx->time_increment_bits + 3, 15); get_bits(gb, len); if (get_bits1(gb)) get_bits(gb, len); check_marker(s->avctx, gb, ""after new_pred""); return 0; } ",0 "init_copy(mrb_state *mrb, mrb_value dest, mrb_value obj) { switch (mrb_type(obj)) { case MRB_TT_ICLASS: copy_class(mrb, dest, obj); return; case MRB_TT_CLASS: case MRB_TT_MODULE: copy_class(mrb, dest, obj); mrb_iv_copy(mrb, dest, obj); mrb_iv_remove(mrb, dest, mrb_intern_lit(mrb, ""__classname__"")); break; case MRB_TT_OBJECT: case MRB_TT_SCLASS: case MRB_TT_HASH: case MRB_TT_DATA: case MRB_TT_EXCEPTION: mrb_iv_copy(mrb, dest, obj); break; case MRB_TT_ISTRUCT: mrb_istruct_copy(dest, obj); break; default: break; } mrb_funcall(mrb, dest, ""initialize_copy"", 1, obj); } ",0 "static void image_ctx_free(ImageContext *img) { int i, j; av_free(img->color_cache); if (img->role != IMAGE_ROLE_ARGB && !img->is_alpha_primary) av_frame_free(&img->frame); if (img->huffman_groups) { for (i = 0; i < img->nb_huffman_groups; i++) { for (j = 0; j < HUFFMAN_CODES_PER_META_CODE; j++) ff_free_vlc(&img->huffman_groups[i * HUFFMAN_CODES_PER_META_CODE + j].vlc); } av_free(img->huffman_groups); } memset(img, 0, sizeof(*img)); } ",0 "static bool bin_strings(RCore *r, int mode, int va) { RList *list; RBinFile *binfile = r_bin_cur (r->bin); RBinPlugin *plugin = r_bin_file_cur_plugin (binfile); int rawstr = r_config_get_i (r->config, ""bin.rawstr""); if (!binfile) { return false; } if (!r_config_get_i (r->config, ""bin.strings"")) { return false; } if (!plugin) { return false; } if (plugin->info && plugin->name) { if (strcmp (plugin->name, ""any"") == 0 && !rawstr) { if (IS_MODE_JSON (mode)) { r_cons_print(""[]""); } return false; } } if (!(list = r_bin_get_strings (r->bin))) { return false; } _print_strings (r, list, mode, va); return true; } ",0 "static int mcryptd_enqueue_request(struct mcryptd_queue *queue, struct crypto_async_request *request, struct mcryptd_hash_request_ctx *rctx) { int cpu, err; struct mcryptd_cpu_queue *cpu_queue; cpu = get_cpu(); cpu_queue = this_cpu_ptr(queue->cpu_queue); rctx->tag.cpu = cpu; err = crypto_enqueue_request(&cpu_queue->queue, request); pr_debug(""enqueue request: cpu %d cpu_queue %p request %p\n"", cpu, cpu_queue, request); queue_work_on(cpu, kcrypto_wq, &cpu_queue->work); put_cpu(); return err; } ",0 "void AgcEnable(preproc_effect_t *effect) { webrtc::GainControl *agc = static_cast(effect->engine); ALOGV(""AgcEnable agc %p"", agc); agc->Enable(true); } ",0 "state_store(struct md_rdev *rdev, const char *buf, size_t len) { /* can write * faulty - simulates an error * remove - disconnects the device * writemostly - sets write_mostly * -writemostly - clears write_mostly * blocked - sets the Blocked flags * -blocked - clears the Blocked and possibly simulates an error * insync - sets Insync providing device isn't active * -insync - clear Insync for a device with a slot assigned, * so that it gets rebuilt based on bitmap * write_error - sets WriteErrorSeen * -write_error - clears WriteErrorSeen */ int err = -EINVAL; if (cmd_match(buf, ""faulty"") && rdev->mddev->pers) { md_error(rdev->mddev, rdev); if (test_bit(Faulty, &rdev->flags)) err = 0; else err = -EBUSY; } else if (cmd_match(buf, ""remove"")) { if (rdev->raid_disk >= 0) err = -EBUSY; else { struct mddev *mddev = rdev->mddev; if (mddev_is_clustered(mddev)) md_cluster_ops->remove_disk(mddev, rdev); md_kick_rdev_from_array(rdev); if (mddev_is_clustered(mddev)) md_cluster_ops->metadata_update_start(mddev); if (mddev->pers) md_update_sb(mddev, 1); md_new_event(mddev); if (mddev_is_clustered(mddev)) md_cluster_ops->metadata_update_finish(mddev); err = 0; } } else if (cmd_match(buf, ""writemostly"")) { set_bit(WriteMostly, &rdev->flags); err = 0; } else if (cmd_match(buf, ""-writemostly"")) { clear_bit(WriteMostly, &rdev->flags); err = 0; } else if (cmd_match(buf, ""blocked"")) { set_bit(Blocked, &rdev->flags); err = 0; } else if (cmd_match(buf, ""-blocked"")) { if (!test_bit(Faulty, &rdev->flags) && rdev->badblocks.unacked_exist) { /* metadata handler doesn't understand badblocks, * so we need to fail the device */ md_error(rdev->mddev, rdev); } clear_bit(Blocked, &rdev->flags); clear_bit(BlockedBadBlocks, &rdev->flags); wake_up(&rdev->blocked_wait); set_bit(MD_RECOVERY_NEEDED, &rdev->mddev->recovery); md_wakeup_thread(rdev->mddev->thread); err = 0; } else if (cmd_match(buf, ""insync"") && rdev->raid_disk == -1) { set_bit(In_sync, &rdev->flags); err = 0; } else if (cmd_match(buf, ""-insync"") && rdev->raid_disk >= 0) { if (rdev->mddev->pers == NULL) { clear_bit(In_sync, &rdev->flags); rdev->saved_raid_disk = rdev->raid_disk; rdev->raid_disk = -1; err = 0; } } else if (cmd_match(buf, ""write_error"")) { set_bit(WriteErrorSeen, &rdev->flags); err = 0; } else if (cmd_match(buf, ""-write_error"")) { clear_bit(WriteErrorSeen, &rdev->flags); err = 0; } else if (cmd_match(buf, ""want_replacement"")) { /* Any non-spare device that is not a replacement can * become want_replacement at any time, but we then need to * check if recovery is needed. */ if (rdev->raid_disk >= 0 && !test_bit(Replacement, &rdev->flags)) set_bit(WantReplacement, &rdev->flags); set_bit(MD_RECOVERY_NEEDED, &rdev->mddev->recovery); md_wakeup_thread(rdev->mddev->thread); err = 0; } else if (cmd_match(buf, ""-want_replacement"")) { /* Clearing 'want_replacement' is always allowed. * Once replacements starts it is too late though. */ err = 0; clear_bit(WantReplacement, &rdev->flags); } else if (cmd_match(buf, ""replacement"")) { /* Can only set a device as a replacement when array has not * yet been started. Once running, replacement is automatic * from spares, or by assigning 'slot'. */ if (rdev->mddev->pers) err = -EBUSY; else { set_bit(Replacement, &rdev->flags); err = 0; } } else if (cmd_match(buf, ""-replacement"")) { /* Similarly, can only clear Replacement before start */ if (rdev->mddev->pers) err = -EBUSY; else { clear_bit(Replacement, &rdev->flags); err = 0; } } else if (cmd_match(buf, ""re-add"")) { if (test_bit(Faulty, &rdev->flags) && (rdev->raid_disk == -1)) { /* clear_bit is performed _after_ all the devices * have their local Faulty bit cleared. If any writes * happen in the meantime in the local node, they * will land in the local bitmap, which will be synced * by this node eventually */ if (!mddev_is_clustered(rdev->mddev) || (err = md_cluster_ops->gather_bitmaps(rdev)) == 0) { clear_bit(Faulty, &rdev->flags); err = add_bound_rdev(rdev); } } else err = -EBUSY; } if (!err) sysfs_notify_dirent_safe(rdev->sysfs_state); return err ? err : len; } ",0 "ProcListInstalledColormaps(ClientPtr client) { xListInstalledColormapsReply *preply; int nummaps, rc; WindowPtr pWin; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); rc = dixLookupWindow(&pWin, stuff->id, client, DixGetAttrAccess); if (rc != Success) return rc; rc = XaceHook(XACE_SCREEN_ACCESS, client, pWin->drawable.pScreen, DixGetAttrAccess); if (rc != Success) return rc; preply = malloc(sizeof(xListInstalledColormapsReply) + pWin->drawable.pScreen->maxInstalledCmaps * sizeof(Colormap)); if (!preply) return BadAlloc; preply->type = X_Reply; preply->sequenceNumber = client->sequence; nummaps = (*pWin->drawable.pScreen->ListInstalledColormaps) (pWin->drawable.pScreen, (Colormap *) &preply[1]); preply->nColormaps = nummaps; preply->length = nummaps; WriteReplyToClient(client, sizeof(xListInstalledColormapsReply), preply); client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, nummaps * sizeof(Colormap), &preply[1]); free(preply); return Success; } ",0 "void RTCPeerConnection::setRemoteDescription(PassRefPtr prpSessionDescription, PassRefPtr successCallback, PassRefPtr errorCallback, ExceptionCode& ec) { if (m_readyState == ReadyStateClosing || m_readyState == ReadyStateClosed) { ec = INVALID_STATE_ERR; return; } RefPtr sessionDescription = prpSessionDescription; if (!sessionDescription) { ec = TYPE_MISMATCH_ERR; return; } RefPtr request = RTCVoidRequestImpl::create(scriptExecutionContext(), successCallback, errorCallback); m_peerHandler->setRemoteDescription(request.release(), sessionDescription->descriptor()); } ",1 "download::DownloadItemImpl* DownloadManagerImpl::CreateActiveItem( uint32_t id, const download::DownloadCreateInfo& info) { DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK(!base::ContainsKey(downloads_, id)); download::DownloadItemImpl* download = item_factory_->CreateActiveItem(this, id, info); downloads_[id] = base::WrapUnique(download); downloads_by_guid_[download->GetGuid()] = download; DownloadItemUtils::AttachInfo( download, GetBrowserContext(), WebContentsImpl::FromRenderFrameHostID(info.render_process_id, info.render_frame_id)); return download; } ",1 "GURL GetOriginalRequestURL(WebDocumentLoader* document_loader) { GURL overriden_url; if (MaybeGetOverriddenURL(document_loader, &overriden_url)) return overriden_url; std::vector redirects; GetRedirectChain(document_loader, &redirects); if (!redirects.empty()) return redirects.at(0); return document_loader->OriginalRequest().Url(); } ",0 "SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname, u32, mask) { struct fsnotify_group *group; struct inode *inode; struct path path; struct file *filp; int ret, fput_needed; unsigned flags = 0; filp = fget_light(fd, &fput_needed); if (unlikely(!filp)) return -EBADF; /* verify that this is indeed an inotify instance */ if (unlikely(filp->f_op != &inotify_fops)) { ret = -EINVAL; goto fput_and_out; } if (!(mask & IN_DONT_FOLLOW)) flags |= LOOKUP_FOLLOW; if (mask & IN_ONLYDIR) flags |= LOOKUP_DIRECTORY; ret = inotify_find_inode(pathname, &path, flags); if (ret) goto fput_and_out; /* inode held in place by reference to path; group by fget on fd */ inode = path.dentry->d_inode; group = filp->private_data; /* create/update an inode mark */ ret = inotify_update_watch(group, inode, mask); path_put(&path); fput_and_out: fput_light(filp, fput_needed); return ret; } ",0 "void ChromeClientImpl::scheduleAnimation() { m_webView->scheduleAnimation(); } ",0 "static u8 get_umr_flags(int acc) { return (acc & IB_ACCESS_REMOTE_ATOMIC ? MLX5_PERM_ATOMIC : 0) | (acc & IB_ACCESS_REMOTE_WRITE ? MLX5_PERM_REMOTE_WRITE : 0) | (acc & IB_ACCESS_REMOTE_READ ? MLX5_PERM_REMOTE_READ : 0) | (acc & IB_ACCESS_LOCAL_WRITE ? MLX5_PERM_LOCAL_WRITE : 0) | MLX5_PERM_LOCAL_READ | MLX5_PERM_UMR_EN; } ",0 "static void v9fs_readdir(void *opaque) { int32_t fid; V9fsFidState *fidp; ssize_t retval = 0; size_t offset = 7; uint64_t initial_offset; int32_t count; uint32_t max_count; V9fsPDU *pdu = opaque; retval = pdu_unmarshal(pdu, offset, ""dqd"", &fid, &initial_offset, &max_count); if (retval < 0) { goto out_nofid; } trace_v9fs_readdir(pdu->tag, pdu->id, fid, initial_offset, max_count); fidp = get_fid(pdu, fid); if (fidp == NULL) { retval = -EINVAL; goto out_nofid; } if (!fidp->fs.dir.stream) { retval = -EINVAL; goto out; } if (initial_offset == 0) { v9fs_co_rewinddir(pdu, fidp); } else { v9fs_co_seekdir(pdu, fidp, initial_offset); } count = v9fs_do_readdir(pdu, fidp, max_count); if (count < 0) { retval = count; goto out; } retval = pdu_marshal(pdu, offset, ""d"", count); if (retval < 0) { goto out; } retval += count + offset; trace_v9fs_readdir_return(pdu->tag, pdu->id, count, retval); out: put_fid(pdu, fidp); out_nofid: pdu_complete(pdu, retval); } ",0 "bool LocalFrame::IsUsingDataSavingPreview() const { if (!Client()) return false; WebURLRequest::PreviewsState previews_state = Client()->GetPreviewsStateForFrame(); return previews_state & (WebURLRequest::kServerLoFiOn | WebURLRequest::kClientLoFiOn | WebURLRequest::kNoScriptOn); } ",0 "encode_POP_QUEUE(const struct ofpact_null *null OVS_UNUSED, enum ofp_version ofp_version OVS_UNUSED, struct ofpbuf *out) { put_NXAST_POP_QUEUE(out); } ",0 "dict_spot_results(i_ctx_t *i_ctx_p, ref * pdict, const gs_spot_halftone * psp) { int code; code = dict_real_result(i_ctx_p, pdict, ""ActualFrequency"", psp->screen.actual_frequency); if (code < 0) return code; return dict_real_result(i_ctx_p, pdict, ""ActualAngle"", psp->screen.actual_angle); } ",0 "ScriptValue Document::registerElement(ScriptState* script_state, const AtomicString& name, const ElementRegistrationOptions& options, ExceptionState& exception_state, V0CustomElement::NameSet valid_names) { HostsUsingFeatures::CountMainWorldOnly( script_state, *this, HostsUsingFeatures::Feature::kDocumentRegisterElement); if (!RegistrationContext()) { exception_state.ThrowDOMException( DOMExceptionCode::kNotSupportedError, ""No element registration context is available.""); return ScriptValue(); } if (name == ""dom-module"") UseCounter::Count(*this, WebFeature::kPolymerV1Detected); V0CustomElementConstructorBuilder constructor_builder(script_state, options); RegistrationContext()->RegisterElement(this, &constructor_builder, name, valid_names, exception_state); return constructor_builder.BindingsReturnValue(); } ",0 "NTSTATUS TCStartThread (PKSTART_ROUTINE threadProc, PVOID threadArg, PKTHREAD *kThread) { return TCStartThreadInProcess (threadProc, threadArg, kThread, NULL); } ",0 "void TaskQueue::WillDeleteTaskQueueManager() { base::AutoLock lock(lock_); task_queue_manager_ = nullptr; delayed_task_queue_ = base::DelayedTaskQueue(); incoming_queue_ = base::TaskQueue(); work_queue_ = base::TaskQueue(); } ",0 "OtherClientGone(void *value, XID id) { OtherClientsPtr other, prev; WindowPtr pWin = (WindowPtr) value; prev = 0; for (other = wOtherClients(pWin); other; other = other->next) { if (other->resource == id) { if (prev) prev->next = other->next; else { if (!(pWin->optional->otherClients = other->next)) CheckWindowOptionalNeed(pWin); } free(other); RecalculateDeliverableEvents(pWin); return Success; } prev = other; } FatalError(""client not on event list""); } ",0 "bool DiceResponseHandler::CanGetTokenForAccount(const std::string& gaia_id, const std::string& email) { if (signin::DiceMethodGreaterOrEqual( account_consistency_, signin::AccountConsistencyMethod::kDiceMigration)) { return true; } DCHECK_EQ(signin::AccountConsistencyMethod::kDiceFixAuthErrors, account_consistency_); std::string account = account_tracker_service_->PickAccountIdForAccount(gaia_id, email); std::string chrome_account = signin_manager_->GetAuthenticatedAccountId(); bool can_get_token = (chrome_account == account); VLOG_IF(1, !can_get_token) << ""[Dice] Dropping Dice signin response for "" << account; return can_get_token; } ",0 "QWebPreferences* QQuickWebViewExperimental::preferences() const { QQuickWebViewPrivate* const d = d_ptr; if (!d->preferences) d->preferences = adoptPtr(QWebPreferencesPrivate::createPreferences(d)); return d->preferences.get(); } ",0 "String HTMLDocument::dir() { HTMLElement* b = body(); if (!b) return String(); return b->getAttribute(dirAttr); } ",0 "static void aio_queue_work(struct kioctx * ctx) { unsigned long timeout; /* * if someone is waiting, get the work started right * away, otherwise, use a longer delay */ smp_mb(); if (waitqueue_active(&ctx->wait)) timeout = 1; else timeout = HZ/10; queue_delayed_work(aio_wq, &ctx->wq, timeout); } ",0 "void H264SwDecMemcpy(void *dest, void *src, u32 count) { memcpy(dest, src, count); } ",0 "static bool kvm_get_time_and_clockread(s64 *kernel_ns, cycle_t *cycle_now) { struct timespec ts; /* checked again under seqlock below */ if (pvclock_gtod_data.clock.vclock_mode != VCLOCK_TSC) return false; if (do_monotonic(&ts, cycle_now) != VCLOCK_TSC) return false; monotonic_to_bootbased(&ts); *kernel_ns = timespec_to_ns(&ts); return true; } ",0 "void InspectorResourceAgent::disable(ErrorString*) { m_state->setBoolean(ResourceAgentState::resourceAgentEnabled, false); m_state->setString(ResourceAgentState::userAgentOverride, """"); m_instrumentingAgents->setInspectorResourceAgent(0); m_resourcesData->clear(); } ",0 "void RenderWidgetHostImpl::OnClose() { ShutdownAndDestroyWidget(true); } ",0 " void TestDomOperationResponse(const std::string& json_string) { if (enabled()) CommandReceived(); } ",0 "static int init_victim_secmap(struct f2fs_sb_info *sbi) { struct dirty_seglist_info *dirty_i = DIRTY_I(sbi); unsigned int bitmap_size = f2fs_bitmap_size(MAIN_SECS(sbi)); dirty_i->victim_secmap = kvzalloc(bitmap_size, GFP_KERNEL); if (!dirty_i->victim_secmap) return -ENOMEM; return 0; } ",0 "static int asepcos_set_security_attributes(sc_card_t *card, sc_file_t *file) { size_t i; const amode_entry_t *table; u8 buf[64], *p; int r = SC_SUCCESS; /* first check whether the security attributes in encoded form * are already set. If present use these */ if (file->sec_attr != NULL && file->sec_attr_len != 0) return asepcos_set_sec_attributes(card, file->sec_attr, file->sec_attr_len, file->type == SC_FILE_TYPE_DF ? 0:1); /* otherwise construct the ACL from the opensc ACLs */ if (file->type == SC_FILE_TYPE_DF) table = df_amode_table; else if (file->type == SC_FILE_TYPE_WORKING_EF) table = wef_amode_table; else if (file->type == SC_FILE_TYPE_INTERNAL_EF) table = ief_amode_table; else return SC_ERROR_INVALID_ARGUMENTS; p = buf; for (i = 0; table[i].am != 0; i++) { const struct sc_acl_entry *ent = sc_file_get_acl_entry(file, table[i].sc); if (ent == NULL) continue; *p++ = 0x80; *p++ = 0x01; *p++ = table[i].am & 0xff; if (ent->method == SC_AC_NONE) { *p++ = 0x90; *p++ = 0x00; } else if (ent->method == SC_AC_NEVER) { *p++ = 0x97; *p++ = 0x00; } else if (ent->method == SC_AC_CHV) { sc_cardctl_asepcos_akn2fileid_t st; st.akn = ent->key_ref; r = asepcos_akn_to_fileid(card, &st); if (r != SC_SUCCESS) return r; *p++ = 0xa0; *p++ = 0x05; *p++ = 0x89; *p++ = 0x03; *p++ = (st.fileid >> 16) & 0xff; *p++ = (st.fileid >> 8 ) & 0xff; *p++ = st.fileid & 0xff; } else { sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, ""unknown auth method: '%d'"", ent->method); return SC_ERROR_INTERNAL; } } if (p != buf) r = asepcos_set_sec_attributes(card, buf, p-buf, file->type == SC_FILE_TYPE_DF ? 0:1); return r; } ",0 "static void mov_read_chapters(AVFormatContext *s) { MOVContext *mov = s->priv_data; AVStream *st; MOVStreamContext *sc; int64_t cur_pos; int i, j; int chapter_track; for (j = 0; j < mov->nb_chapter_tracks; j++) { chapter_track = mov->chapter_tracks[j]; st = NULL; for (i = 0; i < s->nb_streams; i++) if (s->streams[i]->id == chapter_track) { st = s->streams[i]; break; } if (!st) { av_log(s, AV_LOG_ERROR, ""Referenced QT chapter track not found\n""); continue; } sc = st->priv_data; cur_pos = avio_tell(sc->pb); if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { st->disposition |= AV_DISPOSITION_ATTACHED_PIC | AV_DISPOSITION_TIMED_THUMBNAILS; if (st->nb_index_entries) { AVPacket pkt; AVIndexEntry *sample = &st->index_entries[0]; if (avio_seek(sc->pb, sample->pos, SEEK_SET) != sample->pos) { av_log(s, AV_LOG_ERROR, ""Failed to retrieve first frame\n""); goto finish; } if (av_get_packet(sc->pb, &pkt, sample->size) < 0) goto finish; st->attached_pic = pkt; st->attached_pic.stream_index = st->index; st->attached_pic.flags |= AV_PKT_FLAG_KEY; } } else { st->codecpar->codec_type = AVMEDIA_TYPE_DATA; st->codecpar->codec_id = AV_CODEC_ID_BIN_DATA; st->discard = AVDISCARD_ALL; for (i = 0; i < st->nb_index_entries; i++) { AVIndexEntry *sample = &st->index_entries[i]; int64_t end = i+1 < st->nb_index_entries ? st->index_entries[i+1].timestamp : st->duration; uint8_t *title; uint16_t ch; int len, title_len; if (end < sample->timestamp) { av_log(s, AV_LOG_WARNING, ""ignoring stream duration which is shorter than chapters\n""); end = AV_NOPTS_VALUE; } if (avio_seek(sc->pb, sample->pos, SEEK_SET) != sample->pos) { av_log(s, AV_LOG_ERROR, ""Chapter %d not found in file\n"", i); goto finish; } len = avio_rb16(sc->pb); if (len > sample->size-2) continue; title_len = 2*len + 1; if (!(title = av_mallocz(title_len))) goto finish; if (!len) { title[0] = 0; } else { ch = avio_rb16(sc->pb); if (ch == 0xfeff) avio_get_str16be(sc->pb, len, title, title_len); else if (ch == 0xfffe) avio_get_str16le(sc->pb, len, title, title_len); else { AV_WB16(title, ch); if (len == 1 || len == 2) title[len] = 0; else avio_get_str(sc->pb, INT_MAX, title + 2, len - 1); } } avpriv_new_chapter(s, i, st->time_base, sample->timestamp, end, title); av_freep(&title); } } finish: avio_seek(sc->pb, cur_pos, SEEK_SET); } } ",0 "void BeginInstallWithManifestFunction::InstallUIAbort() { error_ = std::string(kUserCancelledError); SetResult(USER_CANCELLED); SendResponse(false); Release(); } ",0 "static int get_snd_codec_id(audio_format_t format) { int id = 0; switch (format & AUDIO_FORMAT_MAIN_MASK) { default: ALOGE(""%s: Unsupported audio format"", __func__); } return id; } ",0 "static void __net_exit xfrm6_tunnel_net_exit(struct net *net) { } ",0 "png_init_filter_functions_neon(png_structp pp, unsigned int bpp) { /* The switch statement is compiled in for ARM_NEON_API, the call to * png_have_neon is compiled in for ARM_NEON_CHECK. If both are defined * the check is only performed if the API has not set the NEON option on * or off explicitly. In this case the check controls what happens. * * If the CHECK is not compiled in and the option is UNSET the behavior prior * to 1.6.7 was to use the NEON code - this was a bug caused by having the * wrong order of the 'ON' and 'default' cases. UNSET now defaults to OFF, * as documented in png.h */ #ifdef PNG_ARM_NEON_API_SUPPORTED switch ((pp->options >> PNG_ARM_NEON) & 3) { case PNG_OPTION_UNSET: /* Allow the run-time check to execute if it has been enabled - * thus both API and CHECK can be turned on. If it isn't supported * this case will fall through to the 'default' below, which just * returns. */ #endif /* PNG_ARM_NEON_API_SUPPORTED */ #ifdef PNG_ARM_NEON_CHECK_SUPPORTED { static volatile sig_atomic_t no_neon = -1; /* not checked */ if (no_neon < 0) no_neon = !png_have_neon(pp); if (no_neon) return; } #ifdef PNG_ARM_NEON_API_SUPPORTED break; #endif #endif /* PNG_ARM_NEON_CHECK_SUPPORTED */ #ifdef PNG_ARM_NEON_API_SUPPORTED default: /* OFF or INVALID */ return; case PNG_OPTION_ON: /* Option turned on */ break; } #endif /* IMPORTANT: any new external functions used here must be declared using * PNG_INTERNAL_FUNCTION in ../pngpriv.h. This is required so that the * 'prefix' option to configure works: * * ./configure --with-libpng-prefix=foobar_ * * Verify you have got this right by running the above command, doing a build * and examining pngprefix.h; it must contain a #define for every external * function you add. (Notice that this happens automatically for the * initialization function.) */ pp->read_filter[PNG_FILTER_VALUE_UP-1] = png_read_filter_row_up_neon; if (bpp == 3) { pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub3_neon; pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg3_neon; pp->read_filter[PNG_FILTER_VALUE_PAETH-1] = png_read_filter_row_paeth3_neon; } else if (bpp == 4) { pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub4_neon; pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg4_neon; pp->read_filter[PNG_FILTER_VALUE_PAETH-1] = png_read_filter_row_paeth4_neon; } } ",0 " void InitTextfield() { InitTextfields(1); } ",0 "void FS_Dir_f( void ) { char *path; char *extension; char **dirnames; int ndirs; int i; if ( Cmd_Argc() < 2 || Cmd_Argc() > 3 ) { Com_Printf( ""usage: dir [extension]\n"" ); return; } if ( Cmd_Argc() == 2 ) { path = Cmd_Argv( 1 ); extension = """"; } else { path = Cmd_Argv( 1 ); extension = Cmd_Argv( 2 ); } Com_Printf( ""Directory of %s %s\n"", path, extension ); Com_Printf( ""---------------\n"" ); dirnames = FS_ListFiles( path, extension, &ndirs ); for ( i = 0; i < ndirs; i++ ) { Com_Printf( ""%s\n"", dirnames[i] ); } FS_FreeFileList( dirnames ); } ",0 "concat_authorization_data(krb5_context context, krb5_authdata **first, krb5_authdata **second, krb5_authdata ***output) { int i, j; krb5_authdata **ptr, **retdata; /* count up the entries */ i = 0; if (first) for (ptr = first; *ptr; ptr++) i++; if (second) for (ptr = second; *ptr; ptr++) i++; retdata = (krb5_authdata **)malloc((i+1)*sizeof(*retdata)); if (!retdata) return ENOMEM; retdata[i] = 0; /* null-terminated array */ for (i = 0, j = 0, ptr = first; j < 2 ; ptr = second, j++) while (ptr && *ptr) { /* now walk & copy */ retdata[i] = (krb5_authdata *)malloc(sizeof(*retdata[i])); if (!retdata[i]) { krb5_free_authdata(context, retdata); return ENOMEM; } *retdata[i] = **ptr; if (!(retdata[i]->contents = (krb5_octet *)malloc(retdata[i]->length))) { free(retdata[i]); retdata[i] = 0; krb5_free_authdata(context, retdata); return ENOMEM; } memcpy(retdata[i]->contents, (*ptr)->contents, retdata[i]->length); ptr++; i++; } *output = retdata; return 0; } ",0 "struct sctp_chunk *sctp_make_asconf_update_ip(struct sctp_association *asoc, union sctp_addr *laddr, struct sockaddr *addrs, int addrcnt, __be16 flags) { sctp_addip_param_t param; struct sctp_chunk *retval; union sctp_addr_param addr_param; union sctp_addr *addr; void *addr_buf; struct sctp_af *af; int paramlen = sizeof(param); int addr_param_len = 0; int totallen = 0; int i; int del_pickup = 0; /* Get total length of all the address parameters. */ addr_buf = addrs; for (i = 0; i < addrcnt; i++) { addr = addr_buf; af = sctp_get_af_specific(addr->v4.sin_family); addr_param_len = af->to_addr_param(addr, &addr_param); totallen += paramlen; totallen += addr_param_len; addr_buf += af->sockaddr_len; if (asoc->asconf_addr_del_pending && !del_pickup) { /* reuse the parameter length from the same scope one */ totallen += paramlen; totallen += addr_param_len; del_pickup = 1; pr_debug(""%s: picked same-scope del_pending addr, "" ""totallen for all addresses is %d\n"", __func__, totallen); } } /* Create an asconf chunk with the required length. */ retval = sctp_make_asconf(asoc, laddr, totallen); if (!retval) return NULL; /* Add the address parameters to the asconf chunk. */ addr_buf = addrs; for (i = 0; i < addrcnt; i++) { addr = addr_buf; af = sctp_get_af_specific(addr->v4.sin_family); addr_param_len = af->to_addr_param(addr, &addr_param); param.param_hdr.type = flags; param.param_hdr.length = htons(paramlen + addr_param_len); param.crr_id = i; sctp_addto_chunk(retval, paramlen, ¶m); sctp_addto_chunk(retval, addr_param_len, &addr_param); addr_buf += af->sockaddr_len; } if (flags == SCTP_PARAM_ADD_IP && del_pickup) { addr = asoc->asconf_addr_del_pending; af = sctp_get_af_specific(addr->v4.sin_family); addr_param_len = af->to_addr_param(addr, &addr_param); param.param_hdr.type = SCTP_PARAM_DEL_IP; param.param_hdr.length = htons(paramlen + addr_param_len); param.crr_id = i; sctp_addto_chunk(retval, paramlen, ¶m); sctp_addto_chunk(retval, addr_param_len, &addr_param); } return retval; } ",0 "void NormalPageArena::VerifyObjectStartBitmap() { #if DCHECK_IS_ON() SetAllocationPoint(nullptr, 0); for (NormalPage* page = static_cast(first_page_); page; page = static_cast(page->Next())) page->VerifyObjectStartBitmapIsConsistentWithPayload(); #endif // DCHECK_IS_ON() } ",0 "void adjustOpenFilesLimit(void) { rlim_t maxfiles = server.maxclients+CONFIG_MIN_RESERVED_FDS; struct rlimit limit; if (getrlimit(RLIMIT_NOFILE,&limit) == -1) { serverLog(LL_WARNING,""Unable to obtain the current NOFILE limit (%s), assuming 1024 and setting the max clients configuration accordingly."", strerror(errno)); server.maxclients = 1024-CONFIG_MIN_RESERVED_FDS; } else { rlim_t oldlimit = limit.rlim_cur; /* Set the max number of files if the current limit is not enough * for our needs. */ if (oldlimit < maxfiles) { rlim_t bestlimit; int setrlimit_error = 0; /* Try to set the file limit to match 'maxfiles' or at least * to the higher value supported less than maxfiles. */ bestlimit = maxfiles; while(bestlimit > oldlimit) { rlim_t decr_step = 16; limit.rlim_cur = bestlimit; limit.rlim_max = bestlimit; if (setrlimit(RLIMIT_NOFILE,&limit) != -1) break; setrlimit_error = errno; /* We failed to set file limit to 'bestlimit'. Try with a * smaller limit decrementing by a few FDs per iteration. */ if (bestlimit < decr_step) break; bestlimit -= decr_step; } /* Assume that the limit we get initially is still valid if * our last try was even lower. */ if (bestlimit < oldlimit) bestlimit = oldlimit; if (bestlimit < maxfiles) { int old_maxclients = server.maxclients; server.maxclients = bestlimit-CONFIG_MIN_RESERVED_FDS; if (server.maxclients < 1) { serverLog(LL_WARNING,""Your current 'ulimit -n' "" ""of %llu is not enough for the server to start. "" ""Please increase your open file limit to at least "" ""%llu. Exiting."", (unsigned long long) oldlimit, (unsigned long long) maxfiles); exit(1); } serverLog(LL_WARNING,""You requested maxclients of %d "" ""requiring at least %llu max file descriptors."", old_maxclients, (unsigned long long) maxfiles); serverLog(LL_WARNING,""Server can't set maximum open files "" ""to %llu because of OS error: %s."", (unsigned long long) maxfiles, strerror(setrlimit_error)); serverLog(LL_WARNING,""Current maximum open files is %llu. "" ""maxclients has been reduced to %d to compensate for "" ""low ulimit. "" ""If you need higher maxclients increase 'ulimit -n'."", (unsigned long long) bestlimit, server.maxclients); } else { serverLog(LL_NOTICE,""Increased maximum number of open files "" ""to %llu (it was originally set to %llu)."", (unsigned long long) maxfiles, (unsigned long long) oldlimit); } } } } ",0 "static void kvm_mmu_notifier_change_pte(struct mmu_notifier *mn, struct mm_struct *mm, unsigned long address, pte_t pte) { struct kvm *kvm = mmu_notifier_to_kvm(mn); int idx; idx = srcu_read_lock(&kvm->srcu); spin_lock(&kvm->mmu_lock); kvm->mmu_notifier_seq++; if (kvm_set_spte_hva(kvm, address, pte)) kvm_flush_remote_tlbs(kvm); spin_unlock(&kvm->mmu_lock); srcu_read_unlock(&kvm->srcu, idx); } ",0 "static gro_result_t napi_frags_finish(struct napi_struct *napi, struct sk_buff *skb, gro_result_t ret) { switch (ret) { case GRO_NORMAL: case GRO_HELD: __skb_push(skb, ETH_HLEN); skb->protocol = eth_type_trans(skb, skb->dev); if (ret == GRO_NORMAL && netif_receive_skb_internal(skb)) ret = GRO_DROP; break; case GRO_DROP: case GRO_MERGED_FREE: napi_reuse_skb(napi, skb); break; case GRO_MERGED: break; } return ret; } ",0 "void BrowserRenderProcessHost::ResetVisitedLinks() { visited_link_updater_->AddReset(); if (visible_widgets_ == 0) return; visited_link_updater_->Update(this); } ",0 "static void set_vma_resv_map(struct vm_area_struct *vma, struct resv_map *map) { VM_BUG_ON(!is_vm_hugetlb_page(vma)); VM_BUG_ON(vma->vm_flags & VM_MAYSHARE); set_vma_private_data(vma, (get_vma_private_data(vma) & HPAGE_RESV_MASK) | (unsigned long)map); } ",0 "static int rawsock_create(struct net *net, struct socket *sock, const struct nfc_protocol *nfc_proto) { struct sock *sk; pr_debug(""sock=%p\n"", sock); if (sock->type != SOCK_SEQPACKET) return -ESOCKTNOSUPPORT; sock->ops = &rawsock_ops; sk = sk_alloc(net, PF_NFC, GFP_ATOMIC, nfc_proto->proto); if (!sk) return -ENOMEM; sock_init_data(sock, sk); sk->sk_protocol = nfc_proto->id; sk->sk_destruct = rawsock_destruct; sock->state = SS_UNCONNECTED; INIT_WORK(&nfc_rawsock(sk)->tx_work, rawsock_tx_work); nfc_rawsock(sk)->tx_work_scheduled = false; return 0; } ",0 "static void tsk_set_unreliable(struct tipc_sock *tsk, bool unreliable) { msg_set_src_droppable(&tsk->phdr, unreliable ? 1 : 0); } ",0 "ChromeContentBrowserClient::WillCreateURLLoaderRequestInterceptors( content::NavigationUIData* navigation_ui_data, int frame_tree_node_id, const scoped_refptr& network_loader_factory) { std::vector> interceptors; #if BUILDFLAG(ENABLE_OFFLINE_PAGES) if (base::FeatureList::IsEnabled(network::features::kNetworkService)) { interceptors.push_back( std::make_unique( navigation_ui_data, frame_tree_node_id)); } #endif if (base::FeatureList::IsEnabled(network::features::kNetworkService) && base::FeatureList::IsEnabled( previews::features::kHTTPSServerPreviewsUsingURLLoader)) { interceptors.push_back( std::make_unique( network_loader_factory, frame_tree_node_id)); } return interceptors; } ",0 "void GfxICCBasedColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) { #ifdef USE_CMS if (transform != NULL && displayPixelType == PT_CMYK) { Guchar in[gfxColorMaxComps]; Guchar out[gfxColorMaxComps]; for (int i = 0;i < nComps;i++) { in[i] = colToByte(color->c[i]); } transform->doTransform(in,out,1); cmyk->c = byteToCol(out[0]); cmyk->m = byteToCol(out[1]); cmyk->y = byteToCol(out[2]); cmyk->k = byteToCol(out[3]); } else { GfxRGB rgb; GfxColorComp c, m, y, k; getRGB(color,&rgb); c = clip01(gfxColorComp1 - rgb.r); m = clip01(gfxColorComp1 - rgb.g); y = clip01(gfxColorComp1 - rgb.b); k = c; if (m < k) { k = m; } if (y < k) { k = y; } cmyk->c = c - k; cmyk->m = m - k; cmyk->y = y - k; cmyk->k = k; } #else alt->getCMYK(color, cmyk); #endif } ",0 "static void kvm_destroy_dirty_bitmap(struct kvm_memory_slot *memslot) { if (!memslot->dirty_bitmap) return; kvfree(memslot->dirty_bitmap); memslot->dirty_bitmap = NULL; } ",0 "PHP_FUNCTION(pg_copy_from) { zval *pgsql_link = NULL, *pg_rows; zval **tmp; char *table_name, *pg_delim = NULL, *pg_null_as = NULL; int table_name_len, pg_delim_len, pg_null_as_len; int pg_null_as_free = 0; char *query; HashPosition pos; int id = -1; PGconn *pgsql; PGresult *pgsql_result; ExecStatusType status; int argc = ZEND_NUM_ARGS(); if (zend_parse_parameters(argc TSRMLS_CC, ""rsa|ss"", &pgsql_link, &table_name, &table_name_len, &pg_rows, &pg_delim, &pg_delim_len, &pg_null_as, &pg_null_as_len) == FAILURE) { return; } if (!pg_delim) { pg_delim = ""\t""; } if (!pg_null_as) { pg_null_as = safe_estrdup(""\\\\N""); pg_null_as_free = 1; } ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, ""PostgreSQL link"", le_link, le_plink); spprintf(&query, 0, ""COPY %s FROM STDIN DELIMITERS E'%c' WITH NULL AS E'%s'"", table_name, *pg_delim, pg_null_as); while ((pgsql_result = PQgetResult(pgsql))) { PQclear(pgsql_result); } pgsql_result = PQexec(pgsql, query); if (pg_null_as_free) { efree(pg_null_as); } efree(query); if (pgsql_result) { status = PQresultStatus(pgsql_result); } else { status = (ExecStatusType) PQstatus(pgsql); } switch (status) { case PGRES_COPY_IN: if (pgsql_result) { int command_failed = 0; PQclear(pgsql_result); zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(pg_rows), &pos); #if HAVE_PQPUTCOPYDATA while (zend_hash_get_current_data_ex(Z_ARRVAL_P(pg_rows), (void **) &tmp, &pos) == SUCCESS) { zval *value; ALLOC_ZVAL(value); INIT_PZVAL_COPY(value, *tmp); zval_copy_ctor(value); convert_to_string_ex(&value); query = (char *)emalloc(Z_STRLEN_P(value) + 2); strlcpy(query, Z_STRVAL_P(value), Z_STRLEN_P(value) + 2); if(Z_STRLEN_P(value) > 0 && *(query + Z_STRLEN_P(value) - 1) != '\n') { strlcat(query, ""\n"", Z_STRLEN_P(value) + 2); } if (PQputCopyData(pgsql, query, strlen(query)) != 1) { efree(query); zval_dtor(value); efree(value); PHP_PQ_ERROR(""copy failed: %s"", pgsql); RETURN_FALSE; } efree(query); zval_dtor(value); efree(value); zend_hash_move_forward_ex(Z_ARRVAL_P(pg_rows), &pos); } if (PQputCopyEnd(pgsql, NULL) != 1) { PHP_PQ_ERROR(""putcopyend failed: %s"", pgsql); RETURN_FALSE; } #else while (zend_hash_get_current_data_ex(Z_ARRVAL_P(pg_rows), (void **) &tmp, &pos) == SUCCESS) { zval *value; ALLOC_ZVAL(value); INIT_PZVAL_COPY(value, *tmp); zval_copy_ctor(value); convert_to_string_ex(&value); query = (char *)emalloc(Z_STRLEN_P(value) + 2); strlcpy(query, Z_STRVAL_P(value), Z_STRLEN_P(value) + 2); if(Z_STRLEN_P(value) > 0 && *(query + Z_STRLEN_P(value) - 1) != '\n') { strlcat(query, ""\n"", Z_STRLEN_P(value) + 2); } if (PQputline(pgsql, query)==EOF) { efree(query); zval_dtor(value); efree(value); PHP_PQ_ERROR(""copy failed: %s"", pgsql); RETURN_FALSE; } efree(query); zval_dtor(value); efree(value); zend_hash_move_forward_ex(Z_ARRVAL_P(pg_rows), &pos); } if (PQputline(pgsql, ""\\.\n"") == EOF) { PHP_PQ_ERROR(""putline failed: %s"", pgsql); RETURN_FALSE; } if (PQendcopy(pgsql)) { PHP_PQ_ERROR(""endcopy failed: %s"", pgsql); RETURN_FALSE; } #endif while ((pgsql_result = PQgetResult(pgsql))) { if (PGRES_COMMAND_OK != PQresultStatus(pgsql_result)) { PHP_PQ_ERROR(""Copy command failed: %s"", pgsql); command_failed = 1; } PQclear(pgsql_result); } if (command_failed) { RETURN_FALSE; } } else { PQclear(pgsql_result); RETURN_FALSE; } RETURN_TRUE; break; default: PQclear(pgsql_result); PHP_PQ_ERROR(""Copy command failed: %s"", pgsql); RETURN_FALSE; break; } } ",0 "hook_hdata (struct t_weechat_plugin *plugin, const char *hdata_name, const char *description, t_hook_callback_hdata *callback, void *callback_data) { struct t_hook *new_hook; struct t_hook_hdata *new_hook_hdata; int priority; const char *ptr_hdata_name; if (!hdata_name || !hdata_name[0] || !callback) return NULL; new_hook = malloc (sizeof (*new_hook)); if (!new_hook) return NULL; new_hook_hdata = malloc (sizeof (*new_hook_hdata)); if (!new_hook_hdata) { free (new_hook); return NULL; } hook_get_priority_and_name (hdata_name, &priority, &ptr_hdata_name); hook_init_data (new_hook, plugin, HOOK_TYPE_HDATA, priority, callback_data); new_hook->hook_data = new_hook_hdata; new_hook_hdata->callback = callback; new_hook_hdata->hdata_name = strdup ((ptr_hdata_name) ? ptr_hdata_name : hdata_name); new_hook_hdata->description = strdup ((description) ? description : """"); hook_add_to_list (new_hook); return new_hook; } ",0 "static int packet_recvmsg(struct socket *sock, struct msghdr *msg, size_t len, int flags) { struct sock *sk = sock->sk; struct sk_buff *skb; int copied, err; int vnet_hdr_len = 0; unsigned int origlen = 0; err = -EINVAL; if (flags & ~(MSG_PEEK|MSG_DONTWAIT|MSG_TRUNC|MSG_CMSG_COMPAT|MSG_ERRQUEUE)) goto out; #if 0 /* What error should we return now? EUNATTACH? */ if (pkt_sk(sk)->ifindex < 0) return -ENODEV; #endif if (flags & MSG_ERRQUEUE) { err = sock_recv_errqueue(sk, msg, len, SOL_PACKET, PACKET_TX_TIMESTAMP); goto out; } /* * Call the generic datagram receiver. This handles all sorts * of horrible races and re-entrancy so we can forget about it * in the protocol layers. * * Now it will return ENETDOWN, if device have just gone down, * but then it will block. */ skb = skb_recv_datagram(sk, flags, flags & MSG_DONTWAIT, &err); /* * An error occurred so return it. Because skb_recv_datagram() * handles the blocking we don't see and worry about blocking * retries. */ if (skb == NULL) goto out; if (pkt_sk(sk)->pressure) packet_rcv_has_room(pkt_sk(sk), NULL); if (pkt_sk(sk)->has_vnet_hdr) { err = packet_rcv_vnet(msg, skb, &len); if (err) goto out_free; vnet_hdr_len = sizeof(struct virtio_net_hdr); } /* You lose any data beyond the buffer you gave. If it worries * a user program they can ask the device for its MTU * anyway. */ copied = skb->len; if (copied > len) { copied = len; msg->msg_flags |= MSG_TRUNC; } err = skb_copy_datagram_msg(skb, 0, msg, copied); if (err) goto out_free; if (sock->type != SOCK_PACKET) { struct sockaddr_ll *sll = &PACKET_SKB_CB(skb)->sa.ll; /* Original length was stored in sockaddr_ll fields */ origlen = PACKET_SKB_CB(skb)->sa.origlen; sll->sll_family = AF_PACKET; sll->sll_protocol = skb->protocol; } sock_recv_ts_and_drops(msg, sk, skb); if (msg->msg_name) { /* If the address length field is there to be filled * in, we fill it in now. */ if (sock->type == SOCK_PACKET) { __sockaddr_check_size(sizeof(struct sockaddr_pkt)); msg->msg_namelen = sizeof(struct sockaddr_pkt); } else { struct sockaddr_ll *sll = &PACKET_SKB_CB(skb)->sa.ll; msg->msg_namelen = sll->sll_halen + offsetof(struct sockaddr_ll, sll_addr); } memcpy(msg->msg_name, &PACKET_SKB_CB(skb)->sa, msg->msg_namelen); } if (pkt_sk(sk)->auxdata) { struct tpacket_auxdata aux; aux.tp_status = TP_STATUS_USER; if (skb->ip_summed == CHECKSUM_PARTIAL) aux.tp_status |= TP_STATUS_CSUMNOTREADY; else if (skb->pkt_type != PACKET_OUTGOING && (skb->ip_summed == CHECKSUM_COMPLETE || skb_csum_unnecessary(skb))) aux.tp_status |= TP_STATUS_CSUM_VALID; aux.tp_len = origlen; aux.tp_snaplen = skb->len; aux.tp_mac = 0; aux.tp_net = skb_network_offset(skb); if (skb_vlan_tag_present(skb)) { aux.tp_vlan_tci = skb_vlan_tag_get(skb); aux.tp_vlan_tpid = ntohs(skb->vlan_proto); aux.tp_status |= TP_STATUS_VLAN_VALID | TP_STATUS_VLAN_TPID_VALID; } else { aux.tp_vlan_tci = 0; aux.tp_vlan_tpid = 0; } put_cmsg(msg, SOL_PACKET, PACKET_AUXDATA, sizeof(aux), &aux); } /* * Free or return the buffer as appropriate. Again this * hides all the races and re-entrancy issues from us. */ err = vnet_hdr_len + ((flags&MSG_TRUNC) ? skb->len : copied); out_free: skb_free_datagram(sk, skb); out: return err; } ",0 "bool GLES2DecoderImpl::InitializeShaderTranslator() { TRACE_EVENT0(""gpu"", ""GLES2DecoderImpl::InitializeShaderTranslator""); if (feature_info_->disable_shader_translator()) { return true; } if (vertex_translator_ || fragment_translator_) { DCHECK(vertex_translator_ && fragment_translator_); return true; } ShBuiltInResources resources; sh::InitBuiltInResources(&resources); resources.MaxVertexAttribs = group_->max_vertex_attribs(); resources.MaxVertexUniformVectors = group_->max_vertex_uniform_vectors(); resources.MaxVaryingVectors = group_->max_varying_vectors(); resources.MaxVertexTextureImageUnits = group_->max_vertex_texture_image_units(); resources.MaxCombinedTextureImageUnits = group_->max_texture_units(); resources.MaxTextureImageUnits = group_->max_texture_image_units(); resources.MaxFragmentUniformVectors = group_->max_fragment_uniform_vectors(); resources.MaxDrawBuffers = group_->max_draw_buffers(); resources.MaxExpressionComplexity = 256; resources.MaxCallStackDepth = 256; resources.MaxDualSourceDrawBuffers = group_->max_dual_source_draw_buffers(); if (!feature_info_->IsWebGL1OrES2Context()) { resources.MaxVertexOutputVectors = group_->max_vertex_output_components() / 4; resources.MaxFragmentInputVectors = group_->max_fragment_input_components() / 4; resources.MaxProgramTexelOffset = group_->max_program_texel_offset(); resources.MinProgramTexelOffset = group_->min_program_texel_offset(); } resources.FragmentPrecisionHigh = has_fragment_precision_high_; ShShaderSpec shader_spec; switch (feature_info_->context_type()) { case CONTEXT_TYPE_WEBGL1: shader_spec = SH_WEBGL_SPEC; resources.OES_standard_derivatives = derivatives_explicitly_enabled_; resources.EXT_frag_depth = frag_depth_explicitly_enabled_; resources.EXT_draw_buffers = draw_buffers_explicitly_enabled_; if (!draw_buffers_explicitly_enabled_) resources.MaxDrawBuffers = 1; resources.EXT_shader_texture_lod = shader_texture_lod_explicitly_enabled_; resources.NV_draw_buffers = draw_buffers_explicitly_enabled_ && features().nv_draw_buffers; break; case CONTEXT_TYPE_WEBGL2: shader_spec = SH_WEBGL2_SPEC; break; case CONTEXT_TYPE_OPENGLES2: shader_spec = SH_GLES2_SPEC; resources.OES_standard_derivatives = features().oes_standard_derivatives ? 1 : 0; resources.ARB_texture_rectangle = features().arb_texture_rectangle ? 1 : 0; resources.OES_EGL_image_external = features().oes_egl_image_external ? 1 : 0; resources.NV_EGL_stream_consumer_external = features().nv_egl_stream_consumer_external ? 1 : 0; resources.EXT_draw_buffers = features().ext_draw_buffers ? 1 : 0; resources.EXT_frag_depth = features().ext_frag_depth ? 1 : 0; resources.EXT_shader_texture_lod = features().ext_shader_texture_lod ? 1 : 0; resources.NV_draw_buffers = features().nv_draw_buffers ? 1 : 0; resources.EXT_blend_func_extended = features().ext_blend_func_extended ? 1 : 0; break; case CONTEXT_TYPE_OPENGLES3: shader_spec = SH_GLES3_SPEC; resources.ARB_texture_rectangle = features().arb_texture_rectangle ? 1 : 0; resources.OES_EGL_image_external = features().oes_egl_image_external ? 1 : 0; resources.NV_EGL_stream_consumer_external = features().nv_egl_stream_consumer_external ? 1 : 0; resources.EXT_blend_func_extended = features().ext_blend_func_extended ? 1 : 0; break; default: NOTREACHED(); shader_spec = SH_GLES2_SPEC; break; } if (((shader_spec == SH_WEBGL_SPEC || shader_spec == SH_WEBGL2_SPEC) && features().enable_shader_name_hashing) || force_shader_name_hashing_for_test) resources.HashFunction = &CityHash64; else resources.HashFunction = nullptr; ShCompileOptions driver_bug_workarounds = 0; if (workarounds().init_gl_position_in_vertex_shader) driver_bug_workarounds |= SH_INIT_GL_POSITION; if (workarounds().unfold_short_circuit_as_ternary_operation) driver_bug_workarounds |= SH_UNFOLD_SHORT_CIRCUIT; if (workarounds().scalarize_vec_and_mat_constructor_args) driver_bug_workarounds |= SH_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS; if (workarounds().regenerate_struct_names) driver_bug_workarounds |= SH_REGENERATE_STRUCT_NAMES; if (workarounds().remove_pow_with_constant_exponent) driver_bug_workarounds |= SH_REMOVE_POW_WITH_CONSTANT_EXPONENT; if (workarounds().emulate_abs_int_function) driver_bug_workarounds |= SH_EMULATE_ABS_INT_FUNCTION; if (workarounds().rewrite_texelfetchoffset_to_texelfetch) driver_bug_workarounds |= SH_REWRITE_TEXELFETCHOFFSET_TO_TEXELFETCH; if (workarounds().add_and_true_to_loop_condition) driver_bug_workarounds |= SH_ADD_AND_TRUE_TO_LOOP_CONDITION; if (workarounds().rewrite_do_while_loops) driver_bug_workarounds |= SH_REWRITE_DO_WHILE_LOOPS; if (workarounds().emulate_isnan_on_float) driver_bug_workarounds |= SH_EMULATE_ISNAN_FLOAT_FUNCTION; if (workarounds().use_unused_standard_shared_blocks) driver_bug_workarounds |= SH_USE_UNUSED_STANDARD_SHARED_BLOCKS; if (workarounds().dont_remove_invariant_for_fragment_input) driver_bug_workarounds |= SH_DONT_REMOVE_INVARIANT_FOR_FRAGMENT_INPUT; if (workarounds().remove_invariant_and_centroid_for_essl3) driver_bug_workarounds |= SH_REMOVE_INVARIANT_AND_CENTROID_FOR_ESSL3; if (workarounds().rewrite_float_unary_minus_operator) driver_bug_workarounds |= SH_REWRITE_FLOAT_UNARY_MINUS_OPERATOR; if (workarounds().dont_use_loops_to_initialize_variables) driver_bug_workarounds |= SH_DONT_USE_LOOPS_TO_INITIALIZE_VARIABLES; if (!workarounds().dont_initialize_uninitialized_locals) driver_bug_workarounds |= SH_INITIALIZE_UNINITIALIZED_LOCALS; resources.WEBGL_debug_shader_precision = group_->gpu_preferences().emulate_shader_precision; ShShaderOutput shader_output_language = ShaderTranslator::GetShaderOutputLanguageForContext(gl_version_info()); vertex_translator_ = shader_translator_cache()->GetTranslator( GL_VERTEX_SHADER, shader_spec, &resources, shader_output_language, driver_bug_workarounds); if (!vertex_translator_.get()) { LOG(ERROR) << ""Could not initialize vertex shader translator.""; Destroy(true); return false; } fragment_translator_ = shader_translator_cache()->GetTranslator( GL_FRAGMENT_SHADER, shader_spec, &resources, shader_output_language, driver_bug_workarounds); if (!fragment_translator_.get()) { LOG(ERROR) << ""Could not initialize fragment shader translator.""; Destroy(true); return false; } return true; } ",0 " void HWNDMessageHandler::OnEnterSizeMove() { delegate_->HandleBeginWMSizeMove(); SetMsgHandled(FALSE); } ",1 "base::MessageLoopProxy* ProxyChannelDelegate::GetIPCMessageLoop() { return RenderThread::Get()->GetIOMessageLoopProxy().get(); } ",1 "XRRGetOutputPrimary(Display *dpy, Window window) { XExtDisplayInfo *info = XRRFindDisplay(dpy); xRRGetOutputPrimaryReq *req; xRRGetOutputPrimaryReply rep; int major_version, minor_version; RRCheckExtension (dpy, info, 0); if (!XRRQueryVersion (dpy, &major_version, &minor_version) || !_XRRHasOutputPrimary (major_version, minor_version)) return None; LockDisplay(dpy); GetReq (RRGetOutputPrimary, req); req->reqType = info->codes->major_opcode; req->randrReqType = X_RRGetOutputPrimary; req->window = window; if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) rep.output = None; UnlockDisplay(dpy); SyncHandle(); return rep.output; } ",0 "megasas_register_aen(struct megasas_instance *instance, u32 seq_num, u32 class_locale_word) { int ret_val; struct megasas_cmd *cmd; struct megasas_dcmd_frame *dcmd; union megasas_evt_class_locale curr_aen; union megasas_evt_class_locale prev_aen; /* * If there an AEN pending already (aen_cmd), check if the * class_locale of that pending AEN is inclusive of the new * AEN request we currently have. If it is, then we don't have * to do anything. In other words, whichever events the current * AEN request is subscribing to, have already been subscribed * to. * * If the old_cmd is _not_ inclusive, then we have to abort * that command, form a class_locale that is superset of both * old and current and re-issue to the FW */ curr_aen.word = class_locale_word; if (instance->aen_cmd) { prev_aen.word = le32_to_cpu(instance->aen_cmd->frame->dcmd.mbox.w[1]); if ((curr_aen.members.class < MFI_EVT_CLASS_DEBUG) || (curr_aen.members.class > MFI_EVT_CLASS_DEAD)) { dev_info(&instance->pdev->dev, ""%s %d out of range class %d send by application\n"", __func__, __LINE__, curr_aen.members.class); return 0; } /* * A class whose enum value is smaller is inclusive of all * higher values. If a PROGRESS (= -1) was previously * registered, then a new registration requests for higher * classes need not be sent to FW. They are automatically * included. * * Locale numbers don't have such hierarchy. They are bitmap * values */ if ((prev_aen.members.class <= curr_aen.members.class) && !((prev_aen.members.locale & curr_aen.members.locale) ^ curr_aen.members.locale)) { /* * Previously issued event registration includes * current request. Nothing to do. */ return 0; } else { curr_aen.members.locale |= prev_aen.members.locale; if (prev_aen.members.class < curr_aen.members.class) curr_aen.members.class = prev_aen.members.class; instance->aen_cmd->abort_aen = 1; ret_val = megasas_issue_blocked_abort_cmd(instance, instance-> aen_cmd, 30); if (ret_val) { dev_printk(KERN_DEBUG, &instance->pdev->dev, ""Failed to abort "" ""previous AEN command\n""); return ret_val; } } } cmd = megasas_get_cmd(instance); if (!cmd) return -ENOMEM; dcmd = &cmd->frame->dcmd; memset(instance->evt_detail, 0, sizeof(struct megasas_evt_detail)); /* * Prepare DCMD for aen registration */ memset(dcmd->mbox.b, 0, MFI_MBOX_SIZE); dcmd->cmd = MFI_CMD_DCMD; dcmd->cmd_status = 0x0; dcmd->sge_count = 1; dcmd->flags = MFI_FRAME_DIR_READ; dcmd->timeout = 0; dcmd->pad_0 = 0; dcmd->data_xfer_len = cpu_to_le32(sizeof(struct megasas_evt_detail)); dcmd->opcode = cpu_to_le32(MR_DCMD_CTRL_EVENT_WAIT); dcmd->mbox.w[0] = cpu_to_le32(seq_num); instance->last_seq_num = seq_num; dcmd->mbox.w[1] = cpu_to_le32(curr_aen.word); megasas_set_dma_settings(instance, dcmd, instance->evt_detail_h, sizeof(struct megasas_evt_detail)); if (instance->aen_cmd != NULL) { megasas_return_cmd(instance, cmd); return 0; } /* * Store reference to the cmd used to register for AEN. When an * application wants us to register for AEN, we have to abort this * cmd and re-register with a new EVENT LOCALE supplied by that app */ instance->aen_cmd = cmd; /* * Issue the aen registration frame */ instance->instancet->issue_dcmd(instance, cmd); return 0; } ",0 "int Condor_Auth_SSL::authenticate(const char * /* remoteHost */, CondorError* /* errstack */) { long err; char *buffer; char err_buf[500]; int ssl_status = AUTH_SSL_A_OK; int server_status = AUTH_SSL_A_OK; int client_status = AUTH_SSL_A_OK; int done = 0; int success = (0 == 0); int fail = (0 == 1); int round_ctr = 0; BIO *conn_in = NULL, *conn_out = NULL; SSL *ssl = NULL; SSL_CTX *ctx = NULL; unsigned char session_key[AUTH_SSL_SESSION_KEY_LEN]; /* This next bit is just to get the fqdn of the host we're communicating with. One would think that remoteHost would have this, but it doesn't seem to. -Ian */ /* After some discussion with Zach, we don't actually do any checking that involves the host name, so whatever... const char *peerHostAddr = getRemoteHost(); struct hostent *he = condor_gethostbyname(peerHostAddr); dprintf(D_SECURITY,""Peer addr: '%s'\n"", peerHostAddr); const char *peerHostName = get_full_hostname_from_hostent( condor_gethostbyaddr(he->h_addr, sizeof he->h_addr, AF_INET), NULL); dprintf(D_SECURITY,""Got hostname for peer: '%s'\n"", peerHostName); */ buffer = (char*) malloc( AUTH_SSL_BUF_SIZE ); if( mySock_->isClient() ) { if( init_OpenSSL( ) != AUTH_SSL_A_OK ) { ouch( ""Error initializing OpenSSL for authentication\n"" ); client_status = AUTH_SSL_ERROR; } if( !(ctx = setup_ssl_ctx( false )) ) { ouch( ""Error initializing client security context\n"" ); client_status = AUTH_SSL_ERROR; } if( !(conn_in = BIO_new( BIO_s_mem( ) )) || !(conn_out = BIO_new( BIO_s_mem( ) )) ) { ouch( ""Error creating buffer for SSL authentication\n"" ); client_status = AUTH_SSL_ERROR; } if( !(ssl = SSL_new( ctx )) ) { ouch( ""Error creating SSL context\n"" ); client_status = AUTH_SSL_ERROR; } server_status = client_share_status( client_status ); if( server_status != AUTH_SSL_A_OK || client_status != AUTH_SSL_A_OK ) { ouch( ""SSL Authentication fails, terminating\n"" ); free(buffer); return fail; } SSL_set_bio( ssl, conn_in, conn_out ); done = 0; round_ctr = 0; while( !done ) { if( client_status != AUTH_SSL_HOLDING ) { ouch(""Trying to connect.\n""); ssl_status = SSL_connect( ssl ); dprintf(D_SECURITY, ""Tried to connect: %d\n"", ssl_status); } if( ssl_status < 1 ) { client_status = AUTH_SSL_QUITTING; done = 1; err = SSL_get_error( ssl, ssl_status ); switch( err ) { case SSL_ERROR_ZERO_RETURN: ouch(""SSL: connection has been closed.\n""); break; case SSL_ERROR_WANT_READ: ouch(""SSL: trying to continue reading.\n""); client_status = AUTH_SSL_RECEIVING; done = 0; break; case SSL_ERROR_WANT_WRITE: ouch(""SSL: trying to continue writing.\n""); client_status = AUTH_SSL_SENDING; done = 0; break; case SSL_ERROR_WANT_CONNECT: case SSL_ERROR_WANT_ACCEPT: ouch(""SSL: error want connect/accept.\n""); break; case SSL_ERROR_WANT_X509_LOOKUP: ouch(""SSL: X509_LOOKUP: callback incomplete.\n"" ); break; case SSL_ERROR_SYSCALL: ouch(""SSL: Syscall.\n"" ); break; case SSL_ERROR_SSL: ouch(""SSL: library failure. see error queue?\n""); break; default: ouch(""SSL: unknown error?\n"" ); break; } } else { client_status = AUTH_SSL_HOLDING; } round_ctr++; dprintf(D_SECURITY,""Round %d.\n"", round_ctr); if(round_ctr % 2 == 1) { if(AUTH_SSL_ERROR == client_send_message( client_status, buffer, conn_in, conn_out )) { server_status = AUTH_SSL_QUITTING; } } else { server_status = client_receive_message( client_status, buffer, conn_in, conn_out ); } dprintf(D_SECURITY,""Status (c: %d, s: %d)\n"", client_status, server_status); /* server_status = client_exchange_messages( client_status, * buffer, conn_in, * conn_out ); */ if( server_status == AUTH_SSL_ERROR ) { server_status = AUTH_SSL_QUITTING; } if( server_status == AUTH_SSL_HOLDING && client_status == AUTH_SSL_HOLDING ) { done = 1; } if( client_status == AUTH_SSL_QUITTING || server_status == AUTH_SSL_QUITTING ) { ouch( ""SSL Authentication failed\n"" ); free(buffer); return fail; } } dprintf(D_SECURITY,""Client trying post connection check.\n""); if((err = post_connection_check( ssl, AUTH_SSL_ROLE_CLIENT )) != X509_V_OK ) { ouch( ""Error on check of peer certificate\n"" ); snprintf(err_buf, 500, ""%s\n"", X509_verify_cert_error_string( err )); ouch( err_buf ); client_status = AUTH_SSL_QUITTING; } else { client_status = AUTH_SSL_A_OK; } dprintf(D_SECURITY,""Client performs one last exchange of messages.\n""); if( client_status == AUTH_SSL_QUITTING || server_status == AUTH_SSL_QUITTING ) { ouch( ""SSL Authentication failed\n"" ); free(buffer); return fail; } client_status = server_status = AUTH_SSL_RECEIVING; done = 0; round_ctr = 0; while(!done) { dprintf(D_SECURITY,""Reading round %d.\n"",++round_ctr); if(round_ctr > 256) { ouch(""Too many rounds exchanging key: quitting.\n""); done = 1; client_status = AUTH_SSL_QUITTING; break; } if( client_status != AUTH_SSL_HOLDING) { ssl_status = SSL_read(ssl, session_key, AUTH_SSL_SESSION_KEY_LEN); } if(ssl_status < 1) { err = SSL_get_error( ssl, ssl_status); switch( err ) { case SSL_ERROR_WANT_READ: case SSL_ERROR_WANT_WRITE: ouch(""SSL: continue read/write.\n""); done = 0; client_status = AUTH_SSL_RECEIVING; break; default: client_status = AUTH_SSL_QUITTING; done = 1; ouch(""SSL: error on write. Can't proceed.\n""); break; } } else { dprintf(D_SECURITY,""SSL read has succeeded.\n""); client_status = AUTH_SSL_HOLDING; } if(round_ctr % 2 == 1) { server_status = client_receive_message( client_status, buffer, conn_in, conn_out ); } else { if(AUTH_SSL_ERROR == client_send_message( client_status, buffer, conn_in, conn_out )) { server_status = AUTH_SSL_QUITTING; } } dprintf(D_ALWAYS, ""Status: c: %d, s: %d\n"", client_status, server_status); if(server_status == AUTH_SSL_HOLDING && client_status == AUTH_SSL_HOLDING) { done = 1; } if(server_status == AUTH_SSL_QUITTING) { done = 1; } } if( server_status == AUTH_SSL_QUITTING || client_status == AUTH_SSL_QUITTING ) { ouch( ""SSL Authentication failed at session key exchange.\n"" ); free(buffer); return fail; } setup_crypto( session_key, AUTH_SSL_SESSION_KEY_LEN ); } else { // Server if( init_OpenSSL( ) != AUTH_SSL_A_OK ) { ouch( ""Error initializing OpenSSL for authentication\n"" ); server_status = AUTH_SSL_ERROR; } if( !(ctx = setup_ssl_ctx( true )) ) { ouch( ""Error initializing server security context\n"" ); server_status = AUTH_SSL_ERROR; } if( !(conn_in = BIO_new( BIO_s_mem( ) )) || !(conn_out = BIO_new( BIO_s_mem( ) )) ) { ouch( ""Error creating buffer for SSL authentication\n"" ); server_status = AUTH_SSL_ERROR; } if (!(ssl = SSL_new(ctx))) { ouch(""Error creating SSL context\n""); server_status = AUTH_SSL_ERROR; } client_status = server_share_status( server_status ); if( client_status != AUTH_SSL_A_OK || server_status != AUTH_SSL_A_OK ) { ouch( ""SSL Authentication fails, terminating\n"" ); free(buffer); return fail; } SSL_set_bio(ssl, conn_in, conn_out); done = 0; round_ctr = 0; while( !done ) { if( server_status != AUTH_SSL_HOLDING ) { ouch(""Trying to accept.\n""); ssl_status = SSL_accept( ssl ); dprintf(D_SECURITY, ""Accept returned %d.\n"", ssl_status); } if( ssl_status < 1 ) { server_status = AUTH_SSL_QUITTING; done = 1; err = SSL_get_error( ssl, ssl_status ); switch( err ) { case SSL_ERROR_ZERO_RETURN: ouch(""SSL: connection has been closed.\n""); break; case SSL_ERROR_WANT_READ: ouch(""SSL: trying to continue reading.\n""); server_status = AUTH_SSL_RECEIVING; done = 0; break; case SSL_ERROR_WANT_WRITE: ouch(""SSL: trying to continue writing.\n""); server_status = AUTH_SSL_SENDING; done = 0; break; case SSL_ERROR_WANT_CONNECT: case SSL_ERROR_WANT_ACCEPT: ouch(""SSL: error want connect/accept.\n""); break; case SSL_ERROR_WANT_X509_LOOKUP: ouch(""SSL: X509_LOOKUP: callback incomplete.\n"" ); break; case SSL_ERROR_SYSCALL: ouch(""SSL: Syscall.\n"" ); break; case SSL_ERROR_SSL: ouch(""SSL: library failure. see error queue?\n""); break; default: ouch(""SSL: unknown error?\n"" ); break; } } else { server_status = AUTH_SSL_HOLDING; } round_ctr++; dprintf(D_SECURITY,""Round %d.\n"", round_ctr); if(round_ctr %2 == 1) { client_status = server_receive_message( server_status, buffer, conn_in, conn_out ); } else { if(AUTH_SSL_ERROR == server_send_message( server_status, buffer, conn_in, conn_out )) { client_status = AUTH_SSL_QUITTING; } } dprintf(D_SECURITY,""Status (c: %d, s: %d)\n"", client_status, server_status); /* * client_status = server_exchange_messages( server_status, * buffer, * conn_in, conn_out ); */ if (client_status == AUTH_SSL_ERROR) { client_status = AUTH_SSL_QUITTING; } if( client_status == AUTH_SSL_HOLDING && server_status == AUTH_SSL_HOLDING ) { done = 1; } if( client_status == AUTH_SSL_QUITTING || server_status == AUTH_SSL_QUITTING ) { ouch( ""SSL Authentication failed\n"" ); free(buffer); return fail; } } ouch(""Server trying post connection check.\n""); if ((err = post_connection_check(ssl, AUTH_SSL_ROLE_SERVER)) != X509_V_OK) { ouch( ""Error on check of peer certificate\n"" ); char errbuf[500]; snprintf(errbuf, 500, ""%s\n"", X509_verify_cert_error_string(err)); ouch( errbuf ); ouch( ""Error checking SSL object after connection\n"" ); server_status = AUTH_SSL_QUITTING; } else { server_status = AUTH_SSL_A_OK; } if( server_status == AUTH_SSL_QUITTING || client_status == AUTH_SSL_QUITTING ) { ouch( ""SSL Authentication failed\n"" ); free(buffer); return fail; } if(!RAND_bytes(session_key, AUTH_SSL_SESSION_KEY_LEN)) { ouch(""Couldn't generate session key.\n""); server_status = AUTH_SSL_QUITTING; } client_status = server_status = AUTH_SSL_RECEIVING; done = 0; round_ctr = 0; while(!done) { dprintf(D_SECURITY,""Writing round %d.\n"", ++round_ctr); if(round_ctr > 256) { ouch(""Too many rounds exchanging key: quitting.\n""); done = 1; server_status = AUTH_SSL_QUITTING; break; } if( server_status != AUTH_SSL_HOLDING ) { ssl_status = SSL_write(ssl, session_key, AUTH_SSL_SESSION_KEY_LEN); } if(ssl_status < 1) { err = SSL_get_error( ssl, ssl_status); switch( err ) { case SSL_ERROR_WANT_READ: case SSL_ERROR_WANT_WRITE: ouch(""SSL: continue read/write.\n""); done = 0; server_status = AUTH_SSL_RECEIVING; break; default: server_status = AUTH_SSL_QUITTING; done = 1; ouch(""SSL: error on write. Can't proceed.\n""); break; } } else { dprintf(D_SECURITY, ""SSL write has succeeded.\n""); if(client_status == AUTH_SSL_HOLDING) { done = 1; } server_status = AUTH_SSL_HOLDING; } if(round_ctr % 2 == 1) { if(AUTH_SSL_ERROR == server_send_message( server_status, buffer, conn_in, conn_out )) { client_status = AUTH_SSL_QUITTING; } } else { client_status = server_receive_message( server_status, buffer, conn_in, conn_out ); } dprintf(D_ALWAYS, ""Status: c: %d, s: %d\n"", client_status, server_status); if(server_status == AUTH_SSL_HOLDING && client_status == AUTH_SSL_HOLDING) { done = 1; } if(client_status == AUTH_SSL_QUITTING) { done = 1; } } if( server_status == AUTH_SSL_QUITTING || client_status == AUTH_SSL_QUITTING ) { ouch( ""SSL Authentication failed at key exchange.\n"" ); free(buffer); return fail; } setup_crypto( session_key, AUTH_SSL_SESSION_KEY_LEN ); } char subjectname[1024]; X509 *peer = SSL_get_peer_certificate(ssl); X509_NAME_oneline(X509_get_subject_name(peer), subjectname, 1024); setAuthenticatedName( subjectname ); setRemoteUser( ""ssl"" ); setRemoteDomain( UNMAPPED_DOMAIN ); dprintf(D_SECURITY,""SSL authentication succeeded to %s\n"", subjectname); SSL_CTX_free(ctx); SSL_free(ssl); free(buffer); return success; } ",0 "static int xfrm_del_sa(struct sk_buff *skb, struct nlmsghdr *nlh, struct nlattr **attrs) { struct net *net = sock_net(skb->sk); struct xfrm_state *x; int err = -ESRCH; struct km_event c; struct xfrm_usersa_id *p = nlmsg_data(nlh); x = xfrm_user_state_lookup(net, p, attrs, &err); if (x == NULL) return err; if ((err = security_xfrm_state_delete(x)) != 0) goto out; if (xfrm_state_kern(x)) { err = -EPERM; goto out; } err = xfrm_state_delete(x); if (err < 0) goto out; c.seq = nlh->nlmsg_seq; c.portid = nlh->nlmsg_pid; c.event = nlh->nlmsg_type; km_state_notify(x, &c); out: xfrm_audit_state_delete(x, err ? 0 : 1, true); xfrm_state_put(x); return err; } ",0 "void BrowserMainLoop::CreateAudioManager() { DCHECK(!audio_manager_); audio_manager_ = GetContentClient()->browser()->CreateAudioManager( MediaInternals::GetInstance()); if (!audio_manager_) { audio_manager_ = media::AudioManager::Create(std::make_unique(), MediaInternals::GetInstance()); } CHECK(audio_manager_); audio_system_ = media::AudioSystem::CreateInstance(); CHECK(audio_system_); } ",0 "void LocalFrame::DidResume() { DCHECK(RuntimeEnabledFeatures::PageLifecycleEnabled()); if (GetDocument()) { const TimeTicks resume_event_start = CurrentTimeTicks(); GetDocument()->DispatchEvent(Event::Create(EventTypeNames::resume)); const TimeTicks resume_event_end = CurrentTimeTicks(); DEFINE_STATIC_LOCAL( CustomCountHistogram, resume_histogram, (""DocumentEventTiming.ResumeDuration"", 0, 10000000, 50)); resume_histogram.Count( (resume_event_end - resume_event_start).InMicroseconds()); if (auto* frame_resource_coordinator = GetFrameResourceCoordinator()) { frame_resource_coordinator->SetLifecycleState( resource_coordinator::mojom::LifecycleState::kRunning); } } } ",0 "static int muscle_card_import_key(sc_card_t *card, sc_cardctl_muscle_key_info_t *info) { /* CURRENTLY DONT SUPPORT EXTRACTING PRIVATE KEYS... */ switch(info->keyType) { case 0x02: /* RSA_PRIVATE */ case 0x03: /* RSA_PRIVATE_CRT */ return msc_import_key(card, info->keyLocation, info); default: return SC_ERROR_NOT_SUPPORTED; } } ",0 "static void entry_status(Node *e, char *page) { char *dp; char *status = ""disabled""; const char * flags = ""flags: ""; if (test_bit(Enabled, &e->flags)) status = ""enabled""; if (!VERBOSE_STATUS) { sprintf(page, ""%s\n"", status); return; } sprintf(page, ""%s\ninterpreter %s\n"", status, e->interpreter); dp = page + strlen(page); /* print the special flags */ sprintf (dp, ""%s"", flags); dp += strlen (flags); if (e->flags & MISC_FMT_PRESERVE_ARGV0) { *dp ++ = 'P'; } if (e->flags & MISC_FMT_OPEN_BINARY) { *dp ++ = 'O'; } if (e->flags & MISC_FMT_CREDENTIALS) { *dp ++ = 'C'; } *dp ++ = '\n'; if (!test_bit(Magic, &e->flags)) { sprintf(dp, ""extension .%s\n"", e->magic); } else { int i; sprintf(dp, ""offset %i\nmagic "", e->offset); dp = page + strlen(page); for (i = 0; i < e->size; i++) { sprintf(dp, ""%02x"", 0xff & (int) (e->magic[i])); dp += 2; } if (e->mask) { sprintf(dp, ""\nmask ""); dp += 6; for (i = 0; i < e->size; i++) { sprintf(dp, ""%02x"", 0xff & (int) (e->mask[i])); dp += 2; } } *dp++ = '\n'; *dp = '\0'; } } ",0 "static int ip6mr_rtm_dumproute(struct sk_buff *skb, struct netlink_callback *cb) { struct net *net = sock_net(skb->sk); struct mr6_table *mrt; struct mfc6_cache *mfc; unsigned int t = 0, s_t; unsigned int h = 0, s_h; unsigned int e = 0, s_e; s_t = cb->args[0]; s_h = cb->args[1]; s_e = cb->args[2]; read_lock(&mrt_lock); ip6mr_for_each_table(mrt, net) { if (t < s_t) goto next_table; if (t > s_t) s_h = 0; for (h = s_h; h < MFC6_LINES; h++) { list_for_each_entry(mfc, &mrt->mfc6_cache_array[h], list) { if (e < s_e) goto next_entry; if (ip6mr_fill_mroute(mrt, skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, mfc, RTM_NEWROUTE, NLM_F_MULTI) < 0) goto done; next_entry: e++; } e = s_e = 0; } spin_lock_bh(&mfc_unres_lock); list_for_each_entry(mfc, &mrt->mfc6_unres_queue, list) { if (e < s_e) goto next_entry2; if (ip6mr_fill_mroute(mrt, skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, mfc, RTM_NEWROUTE, NLM_F_MULTI) < 0) { spin_unlock_bh(&mfc_unres_lock); goto done; } next_entry2: e++; } spin_unlock_bh(&mfc_unres_lock); e = s_e = 0; s_h = 0; next_table: t++; } done: read_unlock(&mrt_lock); cb->args[2] = e; cb->args[1] = h; cb->args[0] = t; return skb->len; } ",0 "static u64 svm_read_tsc_offset(struct kvm_vcpu *vcpu) { struct vcpu_svm *svm = to_svm(vcpu); return svm->vmcb->control.tsc_offset; } ",0 "bool ContentSecurityPolicy::AllowTrustedTypePolicy( const String& policy_name) const { bool is_allowed = true; for (const auto& policy : policies_) { if (!CheckHeaderTypeMatches(CheckHeaderType::kCheckAll, policy->HeaderType())) { continue; } is_allowed &= policy->AllowTrustedTypePolicy(policy_name); } return is_allowed; } ",0 "void AppResult::OnExtensionIconImageChanged(extensions::IconImage* image) { DCHECK_EQ(icon_.get(), image); UpdateIcon(); } ",0 "int sock_common_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen) { struct sock *sk = sock->sk; return sk->sk_prot->setsockopt(sk, level, optname, optval, optlen); } ",0 " bool asn1_write_DATA_BLOB_LDAPString(struct asn1_data *data, const DATA_BLOB *s) { asn1_write(data, s->data, s->length); return !data->has_error; } ",1 "nfs41_same_server_scope(struct server_scope *a, struct server_scope *b) { if (a->server_scope_sz == b->server_scope_sz && memcmp(a->server_scope, b->server_scope, a->server_scope_sz) == 0) return true; return false; } ",0 "ui::InputMethod* RenderWidgetHostViewAura::GetInputMethod() const { if (!window_) return nullptr; aura::Window* root_window = window_->GetRootWindow(); if (!root_window) return nullptr; return root_window->GetHost()->GetInputMethod(); } ",0 "set_required_caps (void) { struct __user_cap_header_struct hdr = { _LINUX_CAPABILITY_VERSION_3, 0 }; struct __user_cap_data_struct data[2] = { { 0 } }; /* Drop all non-require capabilities */ data[0].effective = REQUIRED_CAPS_0; data[0].permitted = REQUIRED_CAPS_0; data[0].inheritable = 0; data[1].effective = REQUIRED_CAPS_1; data[1].permitted = REQUIRED_CAPS_1; data[1].inheritable = 0; if (capset (&hdr, data) < 0) die_with_error (""capset failed""); } ",0 "JsVarRef jsvGetNextSibling(const JsVar *v) { return (JsVarRef)(v->varData.ref.nextSibling | (((v->varData.ref.pack >> (JSVARREF_PACKED_BITS*2))&JSVARREF_PACKED_BIT_MASK))<<8); } ",0 "cdf_swap_header(cdf_header_t *h) { size_t i; h->h_magic = CDF_TOLE8(h->h_magic); h->h_uuid[0] = CDF_TOLE8(h->h_uuid[0]); h->h_uuid[1] = CDF_TOLE8(h->h_uuid[1]); h->h_revision = CDF_TOLE2(h->h_revision); h->h_version = CDF_TOLE2(h->h_version); h->h_byte_order = CDF_TOLE2(h->h_byte_order); h->h_sec_size_p2 = CDF_TOLE2(h->h_sec_size_p2); h->h_short_sec_size_p2 = CDF_TOLE2(h->h_short_sec_size_p2); h->h_num_sectors_in_sat = CDF_TOLE4(h->h_num_sectors_in_sat); h->h_secid_first_directory = CDF_TOLE4(h->h_secid_first_directory); h->h_min_size_standard_stream = CDF_TOLE4(h->h_min_size_standard_stream); h->h_secid_first_sector_in_short_sat = CDF_TOLE4((uint32_t)h->h_secid_first_sector_in_short_sat); h->h_num_sectors_in_short_sat = CDF_TOLE4(h->h_num_sectors_in_short_sat); h->h_secid_first_sector_in_master_sat = CDF_TOLE4((uint32_t)h->h_secid_first_sector_in_master_sat); h->h_num_sectors_in_master_sat = CDF_TOLE4(h->h_num_sectors_in_master_sat); for (i = 0; i < __arraycount(h->h_master_sat); i++) h->h_master_sat[i] = CDF_TOLE4((uint32_t)h->h_master_sat[i]); } ",0 "Text* Document::createEditingTextNode(const String& text) { return Text::createEditingText(*this, text); } ",0 "void skb_abort_seq_read(struct skb_seq_state *st) { if (st->frag_data) kunmap_atomic(st->frag_data); } ",0 "void kvm_set_lapic_tscdeadline_msr(struct kvm_vcpu *vcpu, u64 data) { struct kvm_lapic *apic = vcpu->arch.apic; if (!kvm_vcpu_has_lapic(vcpu) || apic_lvtt_oneshot(apic) || apic_lvtt_period(apic)) return; hrtimer_cancel(&apic->lapic_timer.timer); apic->lapic_timer.tscdeadline = data; start_apic_timer(apic); } ",0 "create_pid_dir(void) { if (mkdir(pid_directory, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) && errno != EEXIST) { log_message(LOG_INFO, ""Unable to create directory %s"", pid_directory); return; } } ",0 "std::wstring GetSpecificHeader(const std::wstring& headers, const std::wstring& name) { return GetSpecificHeaderT(headers, name); } ",0 "static void timers_stop(struct seq_file *m, void *v) { struct timers_private *tp = m->private; if (tp->sighand) { unlock_task_sighand(tp->task, &tp->flags); tp->sighand = NULL; } if (tp->task) { put_task_struct(tp->task); tp->task = NULL; } } ",0 "void RenderFrameImpl::didFinishLoad(blink::WebLocalFrame* frame) { DCHECK(!frame_ || frame_ == frame); WebDataSource* ds = frame->dataSource(); DocumentState* document_state = DocumentState::FromDataSource(ds); if (document_state->finish_load_time().is_null()) { if (!frame->parent()) { TRACE_EVENT_INSTANT0(""WebCore"", ""LoadFinished"", TRACE_EVENT_SCOPE_PROCESS); } document_state->set_finish_load_time(Time::Now()); } FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), DidFinishLoad(frame)); FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidFinishLoad()); if (is_swapped_out()) return; Send(new FrameHostMsg_DidFinishLoad(routing_id_, ds->request().url())); } ",0 "static void catc_ctrl_done(struct urb *urb) { struct catc *catc = urb->context; struct ctrl_queue *q; unsigned long flags; int status = urb->status; if (status) dev_dbg(&urb->dev->dev, ""ctrl_done, status %d, len %d.\n"", status, urb->actual_length); spin_lock_irqsave(&catc->ctrl_lock, flags); q = catc->ctrl_queue + catc->ctrl_tail; if (q->dir) { if (q->buf && q->len) memcpy(q->buf, catc->ctrl_buf, q->len); else q->buf = catc->ctrl_buf; } if (q->callback) q->callback(catc, q); catc->ctrl_tail = (catc->ctrl_tail + 1) & (CTRL_QUEUE - 1); if (catc->ctrl_head != catc->ctrl_tail) catc_ctrl_run(catc); else clear_bit(CTRL_RUNNING, &catc->flags); spin_unlock_irqrestore(&catc->ctrl_lock, flags); } ",0 "int cap_vm_enough_memory(struct mm_struct *mm, long pages) { int cap_sys_admin = 0; if (cap_capable(current_cred(), &init_user_ns, CAP_SYS_ADMIN, SECURITY_CAP_NOAUDIT) == 0) cap_sys_admin = 1; return __vm_enough_memory(mm, pages, cap_sys_admin); } ",0 "MagickExport void GetMagickMemoryMethods( AcquireMemoryHandler *acquire_memory_handler, ResizeMemoryHandler *resize_memory_handler, DestroyMemoryHandler *destroy_memory_handler) { assert(acquire_memory_handler != (AcquireMemoryHandler *) NULL); assert(resize_memory_handler != (ResizeMemoryHandler *) NULL); assert(destroy_memory_handler != (DestroyMemoryHandler *) NULL); *acquire_memory_handler=memory_methods.acquire_memory_handler; *resize_memory_handler=memory_methods.resize_memory_handler; *destroy_memory_handler=memory_methods.destroy_memory_handler; } ",0 "static boolean ReadIPTCProfile(j_decompress_ptr jpeg_info) { char magick[MagickPathExtent]; ErrorManager *error_manager; ExceptionInfo *exception; Image *image; MagickBooleanType status; register ssize_t i; register unsigned char *p; size_t length; StringInfo *iptc_profile, *profile; /* Determine length of binary data stored here. */ length=(size_t) ((size_t) GetCharacter(jpeg_info) << 8); length+=(size_t) GetCharacter(jpeg_info); length-=2; if (length <= 14) { while (length-- > 0) if (GetCharacter(jpeg_info) == EOF) break; return(TRUE); } /* Validate that this was written as a Photoshop resource format slug. */ for (i=0; i < 10; i++) magick[i]=(char) GetCharacter(jpeg_info); magick[10]='\0'; length-=10; if (length <= 10) return(TRUE); if (LocaleCompare(magick,""Photoshop "") != 0) { /* Not a IPTC profile, return. */ for (i=0; i < (ssize_t) length; i++) if (GetCharacter(jpeg_info) == EOF) break; return(TRUE); } /* Remove the version number. */ for (i=0; i < 4; i++) if (GetCharacter(jpeg_info) == EOF) break; if (length <= 11) return(TRUE); length-=4; error_manager=(ErrorManager *) jpeg_info->client_data; exception=error_manager->exception; image=error_manager->image; profile=BlobToStringInfo((const void *) NULL,length); if (profile == (StringInfo *) NULL) { (void) ThrowMagickException(exception,GetMagickModule(), ResourceLimitError,""MemoryAllocationFailed"",""`%s'"",image->filename); return(FALSE); } error_manager->profile=profile; p=GetStringInfoDatum(profile); for (i=0; i < (ssize_t) length; i++) { int c; c=GetCharacter(jpeg_info); if (c == EOF) break; *p++=(unsigned char) c; } error_manager->profile=NULL; if (i != (ssize_t) length) { profile=DestroyStringInfo(profile); (void) ThrowMagickException(exception,GetMagickModule(), CorruptImageError,""InsufficientImageDataInFile"",""`%s'"", image->filename); return(FALSE); } /* The IPTC profile is actually an 8bim */ iptc_profile=(StringInfo *) GetImageProfile(image,""8bim""); if (iptc_profile != (StringInfo *) NULL) { ConcatenateStringInfo(iptc_profile,profile); profile=DestroyStringInfo(profile); } else { status=SetImageProfile(image,""8bim"",profile,exception); profile=DestroyStringInfo(profile); if (status == MagickFalse) { (void) ThrowMagickException(exception,GetMagickModule(), ResourceLimitError,""MemoryAllocationFailed"",""`%s'"",image->filename); return(FALSE); } } if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Profile: iptc, %.20g bytes"",(double) length); return(TRUE); } ",1 "static void vrend_destroy_program(struct vrend_linked_shader_program *ent) { int i; glDeleteProgram(ent->id); list_del(&ent->head); for (i = PIPE_SHADER_VERTEX; i <= PIPE_SHADER_GEOMETRY; i++) { if (ent->ss[i]) list_del(&ent->sl[i]); free(ent->shadow_samp_mask_locs[i]); free(ent->shadow_samp_add_locs[i]); free(ent->samp_locs[i]); free(ent->const_locs[i]); free(ent->ubo_locs[i]); } free(ent->attrib_locs); free(ent); } ",0 "int imap_msg_commit(struct Context *ctx, struct Message *msg) { int r = mutt_file_fclose(&msg->fp); if (r != 0) return r; return imap_append_message(ctx, msg); } ",0 "static void anyCallbackFunctionOptionalAnyArgAttributeAttributeSetterCallback(v8::Local, v8::Local jsValue, const v8::PropertyCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMSetter""); TestObjectPythonV8Internal::anyCallbackFunctionOptionalAnyArgAttributeAttributeSetter(jsValue, info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "AirPDcapDecryptWPABroadcastKey(const EAPOL_RSN_KEY *pEAPKey, guint8 *decryption_key, PAIRPDCAP_SEC_ASSOCIATION sa, guint eapol_len) { guint8 key_version; guint8 *key_data; guint8 *szEncryptedKey; guint16 key_bytes_len = 0; /* Length of the total key data field */ guint16 key_len; /* Actual group key length */ static AIRPDCAP_KEY_ITEM dummy_key; /* needed in case AirPDcapRsnaMng() wants the key structure */ AIRPDCAP_SEC_ASSOCIATION *tmp_sa; /* We skip verifying the MIC of the key. If we were implementing a WPA supplicant we'd want to verify, but for a sniffer it's not needed. */ /* Preparation for decrypting the group key - determine group key data length */ /* depending on whether the pairwise key is TKIP or AES encryption key */ key_version = AIRPDCAP_EAP_KEY_DESCR_VER(pEAPKey->key_information[1]); if (key_version == AIRPDCAP_WPA_KEY_VER_NOT_CCMP){ /* TKIP */ key_bytes_len = pntoh16(pEAPKey->key_length); }else if (key_version == AIRPDCAP_WPA_KEY_VER_AES_CCMP){ /* AES */ key_bytes_len = pntoh16(pEAPKey->key_data_len); /* AES keys must be at least 128 bits = 16 bytes. */ if (key_bytes_len < 16) { return AIRPDCAP_RET_NO_VALID_HANDSHAKE; } } if (key_bytes_len < GROUP_KEY_MIN_LEN || key_bytes_len > eapol_len - sizeof(EAPOL_RSN_KEY)) { return AIRPDCAP_RET_NO_VALID_HANDSHAKE; } /* Encrypted key is in the information element field of the EAPOL key packet */ key_data = (guint8 *)pEAPKey + sizeof(EAPOL_RSN_KEY); szEncryptedKey = (guint8 *)g_memdup(key_data, key_bytes_len); DEBUG_DUMP(""Encrypted Broadcast key:"", szEncryptedKey, key_bytes_len); DEBUG_DUMP(""KeyIV:"", pEAPKey->key_iv, 16); DEBUG_DUMP(""decryption_key:"", decryption_key, 16); /* We are rekeying, save old sa */ tmp_sa=(AIRPDCAP_SEC_ASSOCIATION *)g_malloc(sizeof(AIRPDCAP_SEC_ASSOCIATION)); memcpy(tmp_sa, sa, sizeof(AIRPDCAP_SEC_ASSOCIATION)); sa->next=tmp_sa; /* As we have no concept of the prior association request at this point, we need to deduce the */ /* group key cipher from the length of the key bytes. In WPA this is straightforward as the */ /* keybytes just contain the GTK, and the GTK is only in the group handshake, NOT the M3. */ /* In WPA2 its a little more tricky as the M3 keybytes contain an RSN_IE, but the group handshake */ /* does not. Also there are other (variable length) items in the keybytes which we need to account */ /* for to determine the true key length, and thus the group cipher. */ if (key_version == AIRPDCAP_WPA_KEY_VER_NOT_CCMP){ guint8 new_key[32]; guint8 dummy[256]; /* TKIP key */ /* Per 802.11i, Draft 3.0 spec, section 8.5.2, p. 97, line 4-8, */ /* group key is decrypted using RC4. Concatenate the IV with the 16 byte EK (PTK+16) to get the decryption key */ rc4_state_struct rc4_state; /* The WPA group key just contains the GTK bytes so deducing the type is straightforward */ /* Note - WPA M3 doesn't contain a group key so we'll only be here for the group handshake */ sa->wpa.key_ver = (key_bytes_len >=TKIP_GROUP_KEY_LEN)?AIRPDCAP_WPA_KEY_VER_NOT_CCMP:AIRPDCAP_WPA_KEY_VER_AES_CCMP; /* Build the full decryption key based on the IV and part of the pairwise key */ memcpy(new_key, pEAPKey->key_iv, 16); memcpy(new_key+16, decryption_key, 16); DEBUG_DUMP(""FullDecrKey:"", new_key, 32); crypt_rc4_init(&rc4_state, new_key, sizeof(new_key)); /* Do dummy 256 iterations of the RC4 algorithm (per 802.11i, Draft 3.0, p. 97 line 6) */ crypt_rc4(&rc4_state, dummy, 256); crypt_rc4(&rc4_state, szEncryptedKey, key_bytes_len); } else if (key_version == AIRPDCAP_WPA_KEY_VER_AES_CCMP){ /* AES CCMP key */ guint8 key_found; guint8 key_length; guint16 key_index; guint8 *decrypted_data; /* Unwrap the key; the result is key_bytes_len in length */ decrypted_data = AES_unwrap(decryption_key, 16, szEncryptedKey, key_bytes_len); /* With WPA2 what we get after Broadcast Key decryption is an actual RSN structure. The key itself is stored as a GTK KDE WPA2 IE (1 byte) id = 0xdd, length (1 byte), GTK OUI (4 bytes), key index (1 byte) and 1 reserved byte. Thus we have to pass pointer to the actual key with 8 bytes offset */ key_found = FALSE; key_index = 0; /* Parse Key data until we found GTK KDE */ /* GTK KDE = 00-0F-AC 01 */ while(key_index < (key_bytes_len - 6) && !key_found){ guint8 rsn_id; guint32 type; /* Get RSN ID */ rsn_id = decrypted_data[key_index]; type = ((decrypted_data[key_index + 2] << 24) + (decrypted_data[key_index + 3] << 16) + (decrypted_data[key_index + 4] << 8) + (decrypted_data[key_index + 5])); if (rsn_id == 0xdd && type == 0x000fac01) { key_found = TRUE; } else { key_index += decrypted_data[key_index+1]+2; } } if (key_found){ key_length = decrypted_data[key_index+1] - 6; if (key_index+8 >= key_bytes_len || key_length > key_bytes_len - key_index - 8) { g_free(decrypted_data); g_free(szEncryptedKey); return AIRPDCAP_RET_NO_VALID_HANDSHAKE; } /* Skip over the GTK header info, and don't copy past the end of the encrypted data */ memcpy(szEncryptedKey, decrypted_data+key_index+8, key_length); } else { g_free(decrypted_data); g_free(szEncryptedKey); return AIRPDCAP_RET_NO_VALID_HANDSHAKE; } if (key_length == TKIP_GROUP_KEY_LEN) sa->wpa.key_ver = AIRPDCAP_WPA_KEY_VER_NOT_CCMP; else sa->wpa.key_ver = AIRPDCAP_WPA_KEY_VER_AES_CCMP; g_free(decrypted_data); } key_len = (sa->wpa.key_ver==AIRPDCAP_WPA_KEY_VER_NOT_CCMP)?TKIP_GROUP_KEY_LEN:CCMP_GROUP_KEY_LEN; if (key_len > key_bytes_len) { /* the key required for this protocol is longer than the key that we just calculated */ g_free(szEncryptedKey); return AIRPDCAP_RET_NO_VALID_HANDSHAKE; } /* Decrypted key is now in szEncryptedKey with len of key_len */ DEBUG_DUMP(""Broadcast key:"", szEncryptedKey, key_len); /* Load the proper key material info into the SA */ sa->key = &dummy_key; /* we just need key to be not null because it is checked in AirPDcapRsnaMng(). The WPA key materials are actually in the .wpa structure */ sa->validKey = TRUE; /* Since this is a GTK and its size is only 32 bytes (vs. the 64 byte size of a PTK), we fake it and put it in at a 32-byte offset so the */ /* AirPDcapRsnaMng() function will extract the right piece of the GTK for decryption. (The first 16 bytes of the GTK are used for decryption.) */ memset(sa->wpa.ptk, 0, sizeof(sa->wpa.ptk)); memcpy(sa->wpa.ptk+32, szEncryptedKey, key_len); g_free(szEncryptedKey); return AIRPDCAP_RET_SUCCESS_HANDSHAKE; } ",1 "void VP9Decoder::RefreshReferenceFrames(const scoped_refptr& pic) { for (size_t i = 0; i < media::kVp9NumRefFrames; ++i) { DCHECK_IMPLIES(pic->frame_hdr->IsKeyframe(), pic->frame_hdr->RefreshFlag(i)); if (pic->frame_hdr->RefreshFlag(i)) ref_frames_[i] = pic; } } ",0 "JSValue jsTestObjLongLongSequenceAttr(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestObj* castedThis = jsCast(asObject(slotBase)); UNUSED_PARAM(exec); TestObj* impl = static_cast(castedThis->impl()); JSValue result = jsArray(exec, castedThis->globalObject(), impl->longLongSequenceAttr()); return result; } ",0 "e1000e_link_down(E1000ECore *core) { e1000x_update_regs_on_link_down(core->mac, core->phy[0]); e1000e_update_flowctl_status(core); } ",0 "void drop_privs(int nogroups) { EUID_ROOT(); gid_t gid = getgid(); if (gid == 0 || nogroups) { if (setgroups(0, NULL) < 0) errExit(""setgroups""); if (arg_debug) printf(""Username %s, no supplementary groups\n"", cfg.username); } else { assert(cfg.username); gid_t groups[MAX_GROUPS]; int ngroups = MAX_GROUPS; int rv = getgrouplist(cfg.username, gid, groups, &ngroups); if (arg_debug && rv) { printf(""Username %s, groups "", cfg.username); int i; for (i = 0; i < ngroups; i++) printf(""%u, "", groups[i]); printf(""\n""); } if (rv == -1) { fprintf(stderr, ""Warning: cannot extract supplementary group list, dropping them\n""); if (setgroups(0, NULL) < 0) errExit(""setgroups""); } else { rv = setgroups(ngroups, groups); if (rv) { fprintf(stderr, ""Warning: cannot set supplementary group list, dropping them\n""); if (setgroups(0, NULL) < 0) errExit(""setgroups""); } } } if (setgid(getgid()) < 0) errExit(""setgid/getgid""); if (setuid(getuid()) < 0) errExit(""setuid/getuid""); } ",0 " void DidGetAllRegistrations( const base::WeakPtr& context, blink::ServiceWorkerStatusCode status, const std::vector& registrations) { if (!context || status != blink::ServiceWorkerStatusCode::kOk) return; const std::map live_versions_copy = context->GetLiveVersions(); for (const auto& version_itr : live_versions_copy) { ServiceWorkerVersion* version(version_itr.second); if (version->running_status() == EmbeddedWorkerStatus::STARTING || version->running_status() == EmbeddedWorkerStatus::RUNNING) { version->StopWorker(base::DoNothing()); } } for (const auto& registration_info : registrations) { context->UnregisterServiceWorker( registration_info.scope, base::BindOnce(&ClearAllServiceWorkersHelper::OnResult, this)); } } ",0 "LIBOPENMPT_MODPLUG_API void ModPlug_SetSettings(const ModPlug_Settings* settings) { if(!settings) return; memcpy(&globalsettings,settings,sizeof(ModPlug_Settings)); } ",0 "static void NullableStringMethodMethod(const v8::FunctionCallbackInfo& info) { TestObject* impl = V8TestObject::ToImpl(info.Holder()); V8SetReturnValueStringOrNull(info, impl->nullableStringMethod(), info.GetIsolate()); } ",0 "static struct sk_buff *xfrm_policy_netlink(struct sk_buff *in_skb, struct xfrm_policy *xp, int dir, u32 seq) { struct xfrm_dump_info info; struct sk_buff *skb; int err; skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); if (!skb) return ERR_PTR(-ENOMEM); info.in_skb = in_skb; info.out_skb = skb; info.nlmsg_seq = seq; info.nlmsg_flags = 0; err = dump_one_policy(xp, dir, 0, &info); if (err) { kfree_skb(skb); return ERR_PTR(err); } return skb; } ",0 "PassRefPtr InspectorResourceAgent::buildInitiatorObject(Document* document, const FetchInitiatorInfo& initiatorInfo) { RefPtr stackTrace = createScriptCallStack(ScriptCallStack::maxCallStackSizeToCapture, true); if (stackTrace && stackTrace->size() > 0) { RefPtr initiatorObject = TypeBuilder::Network::Initiator::create() .setType(TypeBuilder::Network::Initiator::Type::Script); initiatorObject->setStackTrace(stackTrace->buildInspectorArray()); return initiatorObject; } if (document && document->scriptableDocumentParser()) { RefPtr initiatorObject = TypeBuilder::Network::Initiator::create() .setType(TypeBuilder::Network::Initiator::Type::Parser); initiatorObject->setUrl(urlWithoutFragment(document->url()).string()); if (TextPosition::belowRangePosition() != initiatorInfo.position) initiatorObject->setLineNumber(initiatorInfo.position.m_line.oneBasedInt()); else initiatorObject->setLineNumber(document->scriptableDocumentParser()->lineNumber().oneBasedInt()); return initiatorObject; } if (m_isRecalculatingStyle && m_styleRecalculationInitiator) return m_styleRecalculationInitiator; return TypeBuilder::Network::Initiator::create() .setType(TypeBuilder::Network::Initiator::Type::Other) .release(); } ",0 "void HTMLMediaElement::FinishSeek() { BLINK_MEDIA_LOG << ""finishSeek("" << (void*)this << "")""; seeking_ = false; SetOfficialPlaybackPosition(CurrentPlaybackPosition()); ScheduleTimeupdateEvent(false); ScheduleEvent(event_type_names::kSeeked); SetDisplayMode(kVideo); } ",0 "static void _php_date_tzinfo_dtor(void *tzinfo) { timelib_tzinfo **tzi = (timelib_tzinfo **)tzinfo; timelib_tzinfo_dtor(*tzi); } ",0 "void ArthurOutputDev::updateStrokeColor(GfxState *state) { GfxRGB rgb; QColor penColour = m_currentPen.color(); state->getStrokeRGB(&rgb); penColour.setRgbF(colToDbl(rgb.r), colToDbl(rgb.g), colToDbl(rgb.b), penColour.alphaF()); m_currentPen.setColor(penColour); m_painter->setPen(m_currentPen); } ",0 "long f2fs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { switch (cmd) { case F2FS_IOC32_GETFLAGS: cmd = F2FS_IOC_GETFLAGS; break; case F2FS_IOC32_SETFLAGS: cmd = F2FS_IOC_SETFLAGS; break; default: return -ENOIOCTLCMD; } return f2fs_ioctl(file, cmd, (unsigned long) compat_ptr(arg)); } ",0 "error::Error GLES2DecoderImpl::HandleBindFragmentInputLocationCHROMIUMBucket( uint32_t immediate_data_size, const volatile void* cmd_data) { const volatile gles2::cmds::BindFragmentInputLocationCHROMIUMBucket& c = *static_cast< const volatile gles2::cmds::BindFragmentInputLocationCHROMIUMBucket*>( cmd_data); if (!features().chromium_path_rendering) { return error::kUnknownCommand; } GLuint program = static_cast(c.program); GLint location = static_cast(c.location); Bucket* bucket = GetBucket(c.name_bucket_id); if (!bucket || bucket->size() == 0) { return error::kInvalidArguments; } std::string name_str; if (!bucket->GetAsString(&name_str)) { return error::kInvalidArguments; } DoBindFragmentInputLocationCHROMIUM(program, location, name_str); return error::kNoError; } ",0 " void Fail() { if (!expect_fail_) FAIL(); QuitMessageLoop(); } ",0 "GF_Err co64_Read(GF_Box *s,GF_BitStream *bs) { u32 entries; GF_ChunkLargeOffsetBox *ptr = (GF_ChunkLargeOffsetBox *) s; ptr->nb_entries = gf_bs_read_u32(bs); ISOM_DECREASE_SIZE(ptr, 4) if (ptr->nb_entries > ptr->size / 8) { GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (""[iso file] Invalid number of entries %d in co64\n"", ptr->nb_entries)); return GF_ISOM_INVALID_FILE; } ptr->offsets = (u64 *) gf_malloc(ptr->nb_entries * sizeof(u64) ); if (ptr->offsets == NULL) return GF_OUT_OF_MEM; ptr->alloc_size = ptr->nb_entries; for (entries = 0; entries < ptr->nb_entries; entries++) { ptr->offsets[entries] = gf_bs_read_u64(bs); } return GF_OK; } ",0 "unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order, gfp_t gfp_mask, unsigned long *total_scanned) { unsigned long nr_reclaimed = 0; struct mem_cgroup_per_zone *mz, *next_mz = NULL; unsigned long reclaimed; int loop = 0; struct mem_cgroup_tree_per_zone *mctz; unsigned long long excess; unsigned long nr_scanned; if (order > 0) return 0; mctz = soft_limit_tree_node_zone(zone_to_nid(zone), zone_idx(zone)); /* * This loop can run a while, specially if mem_cgroup's continuously * keep exceeding their soft limit and putting the system under * pressure */ do { if (next_mz) mz = next_mz; else mz = mem_cgroup_largest_soft_limit_node(mctz); if (!mz) break; nr_scanned = 0; reclaimed = mem_cgroup_soft_reclaim(mz->mem, zone, gfp_mask, &nr_scanned); nr_reclaimed += reclaimed; *total_scanned += nr_scanned; spin_lock(&mctz->lock); /* * If we failed to reclaim anything from this memory cgroup * it is time to move on to the next cgroup */ next_mz = NULL; if (!reclaimed) { do { /* * Loop until we find yet another one. * * By the time we get the soft_limit lock * again, someone might have aded the * group back on the RB tree. Iterate to * make sure we get a different mem. * mem_cgroup_largest_soft_limit_node returns * NULL if no other cgroup is present on * the tree */ next_mz = __mem_cgroup_largest_soft_limit_node(mctz); if (next_mz == mz) css_put(&next_mz->mem->css); else /* next_mz == NULL or other memcg */ break; } while (1); } __mem_cgroup_remove_exceeded(mz->mem, mz, mctz); excess = res_counter_soft_limit_excess(&mz->mem->res); /* * One school of thought says that we should not add * back the node to the tree if reclaim returns 0. * But our reclaim could return 0, simply because due * to priority we are exposing a smaller subset of * memory to reclaim from. Consider this as a longer * term TODO. */ /* If excess == 0, no tree ops */ __mem_cgroup_insert_exceeded(mz->mem, mz, mctz, excess); spin_unlock(&mctz->lock); css_put(&mz->mem->css); loop++; /* * Could not reclaim anything and there are no more * mem cgroups to try or we seem to be looping without * reclaiming anything. */ if (!nr_reclaimed && (next_mz == NULL || loop > MEM_CGROUP_MAX_SOFT_LIMIT_RECLAIM_LOOPS)) break; } while (!nr_reclaimed); if (next_mz) css_put(&next_mz->mem->css); return nr_reclaimed; } ",0 "static int __init ecryptfs_init(void) { int rc; if (ECRYPTFS_DEFAULT_EXTENT_SIZE > PAGE_CACHE_SIZE) { rc = -EINVAL; ecryptfs_printk(KERN_ERR, ""The eCryptfs extent size is "" ""larger than the host's page size, and so "" ""eCryptfs cannot run on this system. The "" ""default eCryptfs extent size is [%u] bytes; "" ""the page size is [%lu] bytes.\n"", ECRYPTFS_DEFAULT_EXTENT_SIZE, (unsigned long)PAGE_CACHE_SIZE); goto out; } rc = ecryptfs_init_kmem_caches(); if (rc) { printk(KERN_ERR ""Failed to allocate one or more kmem_cache objects\n""); goto out; } rc = do_sysfs_registration(); if (rc) { printk(KERN_ERR ""sysfs registration failed\n""); goto out_free_kmem_caches; } rc = ecryptfs_init_kthread(); if (rc) { printk(KERN_ERR ""%s: kthread initialization failed; "" ""rc = [%d]\n"", __func__, rc); goto out_do_sysfs_unregistration; } rc = ecryptfs_init_messaging(); if (rc) { printk(KERN_ERR ""Failure occurred while attempting to "" ""initialize the communications channel to "" ""ecryptfsd\n""); goto out_destroy_kthread; } rc = ecryptfs_init_crypto(); if (rc) { printk(KERN_ERR ""Failure whilst attempting to init crypto; "" ""rc = [%d]\n"", rc); goto out_release_messaging; } rc = register_filesystem(&ecryptfs_fs_type); if (rc) { printk(KERN_ERR ""Failed to register filesystem\n""); goto out_destroy_crypto; } if (ecryptfs_verbosity > 0) printk(KERN_CRIT ""eCryptfs verbosity set to %d. Secret values "" ""will be written to the syslog!\n"", ecryptfs_verbosity); goto out; out_destroy_crypto: ecryptfs_destroy_crypto(); out_release_messaging: ecryptfs_release_messaging(); out_destroy_kthread: ecryptfs_destroy_kthread(); out_do_sysfs_unregistration: do_sysfs_unregistration(); out_free_kmem_caches: ecryptfs_free_kmem_caches(); out: return rc; } ",0 "uint32_t GraphicsSurface::platformFrontBuffer() const { return 0; } ",0 "ZEND_API void zend_save_error_handling(zend_error_handling *current TSRMLS_DC) /* {{{ */ { current->handling = EG(error_handling); current->exception = EG(exception_class); current->user_handler = EG(user_error_handler); if (current->user_handler) { Z_ADDREF_P(current->user_handler); } } /* }}} */ ",0 "sp CameraService::findClientUnsafe( const wp& cameraClient, int& outIndex) { sp client; for (int i = 0; i < mNumberOfCameras; i++) { if (mClient[i] == 0) continue; client = mClient[i].promote(); if (client == NULL) { mClient[i].clear(); continue; } if (cameraClient == client->getRemote()) { outIndex = i; return client; } } outIndex = -1; return NULL; } ",0 "olsr_print_neighbor(netdissect_options *ndo, const u_char *msg_data, u_int hello_len) { int neighbor; ND_PRINT((ndo, ""\n\t neighbor\n\t\t"")); neighbor = 1; while (hello_len >= sizeof(struct in_addr)) { if (!ND_TTEST2(*msg_data, sizeof(struct in_addr))) return (-1); /* print 4 neighbors per line */ ND_PRINT((ndo, ""%s%s"", ipaddr_string(ndo, msg_data), neighbor % 4 == 0 ? ""\n\t\t"" : "" "")); msg_data += sizeof(struct in_addr); hello_len -= sizeof(struct in_addr); } return (0); } ",0 "void WebContentsImpl::CreateNewWindow( RenderFrameHost* opener, int32_t render_view_route_id, int32_t main_frame_route_id, int32_t main_frame_widget_route_id, const mojom::CreateNewWindowParams& params, SessionStorageNamespace* session_storage_namespace) { DCHECK_EQ((render_view_route_id == MSG_ROUTING_NONE), (main_frame_route_id == MSG_ROUTING_NONE)); DCHECK_EQ((render_view_route_id == MSG_ROUTING_NONE), (main_frame_widget_route_id == MSG_ROUTING_NONE)); DCHECK(opener); int render_process_id = opener->GetProcess()->GetID(); SiteInstance* source_site_instance = opener->GetSiteInstance(); DCHECK(!RenderFrameHostImpl::FromID(render_process_id, main_frame_route_id)); bool is_guest = BrowserPluginGuest::IsGuest(this); DCHECK(!params.opener_suppressed || render_view_route_id == MSG_ROUTING_NONE); scoped_refptr site_instance = params.opener_suppressed && !is_guest ? SiteInstance::CreateForURL(GetBrowserContext(), params.target_url) : source_site_instance; const std::string& partition_id = GetContentClient()->browser()-> GetStoragePartitionIdForSite(GetBrowserContext(), site_instance->GetSiteURL()); StoragePartition* partition = BrowserContext::GetStoragePartition( GetBrowserContext(), site_instance.get()); DOMStorageContextWrapper* dom_storage_context = static_cast(partition->GetDOMStorageContext()); SessionStorageNamespaceImpl* session_storage_namespace_impl = static_cast(session_storage_namespace); CHECK(session_storage_namespace_impl->IsFromContext(dom_storage_context)); if (delegate_ && !delegate_->ShouldCreateWebContents( this, opener, source_site_instance, render_view_route_id, main_frame_route_id, main_frame_widget_route_id, params.window_container_type, opener->GetLastCommittedURL(), params.frame_name, params.target_url, partition_id, session_storage_namespace)) { RenderFrameHostImpl* rfh = RenderFrameHostImpl::FromID(render_process_id, main_frame_route_id); if (rfh) { DCHECK(rfh->IsRenderFrameLive()); rfh->Init(); } return; } CreateParams create_params(GetBrowserContext(), site_instance.get()); create_params.routing_id = render_view_route_id; create_params.main_frame_routing_id = main_frame_route_id; create_params.main_frame_widget_routing_id = main_frame_widget_route_id; create_params.main_frame_name = params.frame_name; create_params.opener_render_process_id = render_process_id; create_params.opener_render_frame_id = opener->GetRoutingID(); create_params.opener_suppressed = params.opener_suppressed; if (params.disposition == WindowOpenDisposition::NEW_BACKGROUND_TAB) create_params.initially_hidden = true; create_params.renderer_initiated_creation = main_frame_route_id != MSG_ROUTING_NONE; std::unique_ptr new_contents; if (!is_guest) { create_params.context = view_->GetNativeView(); create_params.initial_size = GetContainerBounds().size(); new_contents = WebContents::Create(create_params); } else { new_contents = base::WrapUnique( GetBrowserPluginGuest()->CreateNewGuestWindow(create_params)); } WebContentsImpl* raw_new_contents = static_cast(new_contents.get()); raw_new_contents->GetController().SetSessionStorageNamespace( partition_id, session_storage_namespace); if (!params.frame_name.empty()) raw_new_contents->GetRenderManager()->CreateProxiesForNewNamedFrame(); if (!params.opener_suppressed) { if (!is_guest) { WebContentsView* new_view = raw_new_contents->view_.get(); new_view->CreateViewForWidget( new_contents->GetRenderViewHost()->GetWidget(), false); } DCHECK_NE(MSG_ROUTING_NONE, main_frame_widget_route_id); pending_contents_[std::make_pair(render_process_id, main_frame_widget_route_id)] = std::move(new_contents); AddDestructionObserver(raw_new_contents); } if (delegate_) { delegate_->WebContentsCreated(this, render_process_id, opener->GetRoutingID(), params.frame_name, params.target_url, raw_new_contents); } if (opener) { for (auto& observer : observers_) { observer.DidOpenRequestedURL(raw_new_contents, opener, params.target_url, params.referrer, params.disposition, ui::PAGE_TRANSITION_LINK, false, // started_from_context_menu true); // renderer_initiated } } if (IsFullscreenForCurrentTab()) ExitFullscreen(true); if (params.opener_suppressed) { bool was_blocked = false; base::WeakPtr weak_new_contents = raw_new_contents->weak_factory_.GetWeakPtr(); if (delegate_) { gfx::Rect initial_rect; delegate_->AddNewContents(this, std::move(new_contents), params.disposition, initial_rect, params.mimic_user_gesture, &was_blocked); if (!weak_new_contents) return; // The delegate deleted |new_contents| during AddNewContents(). } if (!was_blocked) { OpenURLParams open_params(params.target_url, params.referrer, WindowOpenDisposition::CURRENT_TAB, ui::PAGE_TRANSITION_LINK, true /* is_renderer_initiated */); open_params.user_gesture = params.mimic_user_gesture; if (delegate_ && !is_guest && !delegate_->ShouldResumeRequestsForCreatedWindow()) { DCHECK(weak_new_contents); weak_new_contents->delayed_open_url_params_.reset( new OpenURLParams(open_params)); } else { weak_new_contents->OpenURL(open_params); } } } } ",1 "static void *fb_seq_next(struct seq_file *m, void *v, loff_t *pos) { (*pos)++; return (*pos < FB_MAX) ? pos : NULL; } ",0 "void* Type_Signature_Dup(struct _cms_typehandler_struct* self, const void *Ptr, cmsUInt32Number n) { return _cmsDupMem(self ->ContextID, Ptr, n * sizeof(cmsSignature)); } ",0 "static inline struct cpuacct *task_ca(struct task_struct *tsk) { return container_of(task_subsys_state(tsk, cpuacct_subsys_id), struct cpuacct, css); } ",0 "void CastStreamingNativeHandler::DestroyCastRtpStream( const v8::FunctionCallbackInfo& args) { CHECK_EQ(1, args.Length()); CHECK(args[0]->IsInt32()); const int transport_id = args[0]->ToInt32(args.GetIsolate())->Value(); if (!GetRtpStreamOrThrow(transport_id)) return; rtp_stream_map_.erase(transport_id); } ",0 "scoped_refptr LoginHandler::Create( net::AuthChallengeInfo* auth_info, content::ResourceRequestInfo::WebContentsGetter web_contents_getter, LoginAuthRequiredCallback auth_required_callback) { return base::MakeRefCounted( auth_info, web_contents_getter, std::move(auth_required_callback)); } ",0 "static unsigned int __gang_lookup_nat_cache(struct f2fs_nm_info *nm_i, nid_t start, unsigned int nr, struct nat_entry **ep) { return radix_tree_gang_lookup(&nm_i->nat_root, (void **)ep, start, nr); } ",0 "DEBUG_TRACE_FUNC(const char *func, unsigned line, const char *fmt, ...) { va_list args; uint64_t nsnow; static uint64_t nslast; struct timespec tsnow; /* Get some operating system independent thread id */ unsigned long thread_id = mg_current_thread_id(); clock_gettime(CLOCK_REALTIME, &tsnow); nsnow = ((uint64_t)tsnow.tv_sec) * ((uint64_t)1000000000) + ((uint64_t)tsnow.tv_nsec); if (!nslast) { nslast = nsnow; } flockfile(stdout); printf(""*** %lu.%09lu %12"" INT64_FMT "" %lu %s:%u: "", (unsigned long)tsnow.tv_sec, (unsigned long)tsnow.tv_nsec, nsnow - nslast, thread_id, func, line); va_start(args, fmt); vprintf(fmt, args); va_end(args); putchar('\n'); fflush(stdout); funlockfile(stdout); nslast = nsnow; } ",0 "static void warningHandler(void* closure, const char* message, ...) { va_list args; va_start(args, message); getTokenizer(closure)->error(XMLTokenizer::warning, message, args); va_end(args); } ",0 "dispatchCallForward(Parcel &p, RequestInfo *pRI) { RIL_CallForwardInfo cff; int32_t t; status_t status; RLOGD(""dispatchCallForward""); memset (&cff, 0, sizeof(cff)); status = p.readInt32(&t); cff.status = (int)t; status = p.readInt32(&t); cff.reason = (int)t; status = p.readInt32(&t); cff.serviceClass = (int)t; status = p.readInt32(&t); cff.toa = (int)t; cff.number = strdupReadString(p); status = p.readInt32(&t); cff.timeSeconds = (int)t; if (status != NO_ERROR) { goto invalid; } if (cff.number != NULL && strlen (cff.number) == 0) { cff.number = NULL; } startRequest; appendPrintBuf(""%sstat=%d,reason=%d,serv=%d,toa=%d,%s,tout=%d"", printBuf, cff.status, cff.reason, cff.serviceClass, cff.toa, (char*)cff.number, cff.timeSeconds); closeRequest; printRequest(pRI->token, pRI->pCI->requestNumber); CALL_ONREQUEST(pRI->pCI->requestNumber, &cff, sizeof(cff), pRI, pRI->socket_id); #ifdef MEMSET_FREED memsetString(cff.number); #endif free (cff.number); #ifdef MEMSET_FREED memset(&cff, 0, sizeof(cff)); #endif return; invalid: invalidCommandBlock(pRI); return; } ",0 "bool ClientControlledShellSurface::GetSavedWindowPlacement( const views::Widget* widget, gfx::Rect* bounds, ui::WindowShowState* show_state) const { return false; } ",0 "void WebGL2RenderingContextBase::bindTransformFeedback( GLenum target, WebGLTransformFeedback* feedback) { bool deleted; if (!CheckObjectToBeBound(""bindTransformFeedback"", feedback, deleted)) return; if (deleted) { SynthesizeGLError(GL_INVALID_OPERATION, ""bindTransformFeedback"", ""attempted to bind a deleted transform feedback object""); return; } if (target != GL_TRANSFORM_FEEDBACK) { SynthesizeGLError(GL_INVALID_ENUM, ""bindTransformFeedback"", ""target must be TRANSFORM_FEEDBACK""); return; } WebGLTransformFeedback* feedback_to_be_bound; if (feedback) { feedback_to_be_bound = feedback; feedback_to_be_bound->SetTarget(target); } else { feedback_to_be_bound = default_transform_feedback_.Get(); } transform_feedback_binding_ = feedback_to_be_bound; ContextGL()->BindTransformFeedback(target, ObjectOrZero(feedback_to_be_bound)); } ",0 "std::map MapFromKeyValuePairs(std::vector> pairs) { std::map result; for (size_t i = 0; i < pairs.size(); ++i) result[pairs[i].first] = pairs[i].second; return result; } ",0 "static long btrfs_ioctl_qgroup_limit(struct file *file, void __user *arg) { struct btrfs_root *root = BTRFS_I(fdentry(file)->d_inode)->root; struct btrfs_ioctl_qgroup_limit_args *sa; struct btrfs_trans_handle *trans; int ret; int err; u64 qgroupid; if (!capable(CAP_SYS_ADMIN)) return -EPERM; ret = mnt_want_write_file(file); if (ret) return ret; sa = memdup_user(arg, sizeof(*sa)); if (IS_ERR(sa)) { ret = PTR_ERR(sa); goto drop_write; } trans = btrfs_join_transaction(root); if (IS_ERR(trans)) { ret = PTR_ERR(trans); goto out; } qgroupid = sa->qgroupid; if (!qgroupid) { /* take the current subvol as qgroup */ qgroupid = root->root_key.objectid; } /* FIXME: check if the IDs really exist */ ret = btrfs_limit_qgroup(trans, root->fs_info, qgroupid, &sa->lim); err = btrfs_end_transaction(trans, root); if (err && !ret) ret = err; out: kfree(sa); drop_write: mnt_drop_write_file(file); return ret; } ",0 " bool RunSizeTest(Browser* browser, SizeTestType type, const std::string& partial_indication, const std::string& total_indication) { embedded_test_server()->ServeFilesFromDirectory(GetTestDataDirectory()); embedded_test_server()->RegisterRequestHandler(base::Bind( &content::SlowDownloadHttpResponse::HandleSlowDownloadRequest)); EXPECT_TRUE(embedded_test_server()->Start()); base::ScopedAllowBlockingForTesting allow_blocking; EXPECT_TRUE(type == SIZE_TEST_TYPE_UNKNOWN || type == SIZE_TEST_TYPE_KNOWN); if (type != SIZE_TEST_TYPE_KNOWN && type != SIZE_TEST_TYPE_UNKNOWN) return false; GURL url(type == SIZE_TEST_TYPE_KNOWN ? embedded_test_server()->GetURL( content::SlowDownloadHttpResponse::kKnownSizeUrl) : embedded_test_server()->GetURL( content::SlowDownloadHttpResponse::kUnknownSizeUrl)); GURL finish_url = embedded_test_server()->GetURL( content::SlowDownloadHttpResponse::kFinishDownloadUrl); base::FilePath filename; net::FileURLToFilePath(url, &filename); base::string16 expected_title_in_progress( base::ASCIIToUTF16(partial_indication) + filename.LossyDisplayName()); base::string16 expected_title_finished( base::ASCIIToUTF16(total_indication) + filename.LossyDisplayName()); std::unique_ptr observer( CreateWaiter(browser, 1)); ui_test_utils::NavigateToURL(browser, url); ui_test_utils::NavigateToURLWithDisposition( browser, finish_url, WindowOpenDisposition::NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); observer->WaitForFinished(); EXPECT_EQ(1u, observer->NumDownloadsSeenInState(DownloadItem::COMPLETE)); CheckDownloadStatesForBrowser(browser, 1, DownloadItem::COMPLETE); EXPECT_EQ(2, browser->tab_strip_model()->count()); base::FilePath basefilename(filename.BaseName()); net::FileURLToFilePath(url, &filename); base::FilePath download_path = GetDownloadDirectory(browser).Append(basefilename); bool downloaded_path_exists = base::PathExists(download_path); EXPECT_TRUE(downloaded_path_exists); if (!downloaded_path_exists) return false; size_t file_size = content::SlowDownloadHttpResponse::kFirstDownloadSize + content::SlowDownloadHttpResponse::kSecondDownloadSize; std::string expected_contents(file_size, '*'); EXPECT_TRUE(VerifyFile(download_path, expected_contents, file_size)); EXPECT_TRUE(base::DieFileDie(download_path, false)); EXPECT_FALSE(base::PathExists(download_path)); return true; } ",0 "void RenderFrameDevToolsAgentHost::OnResetNavigationRequest( NavigationRequest* navigation_request) { RenderFrameDevToolsAgentHost* agent_host = FindAgentHost(navigation_request->frame_tree_node()); if (!agent_host) return; if (navigation_request->net_error() != net::OK) { for (auto* network : protocol::NetworkHandler::ForAgentHost(agent_host)) network->NavigationFailed(navigation_request); } for (auto* page : protocol::PageHandler::ForAgentHost(agent_host)) page->NavigationReset(navigation_request); } ",0 "static ssize_t pages_unshared_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { return sprintf(buf, ""%lu\n"", ksm_pages_unshared); } ",0 "int ff_h264_decode_extradata(H264Context *h, const uint8_t *buf, int size) { AVCodecContext *avctx = h->avctx; int ret; if (!buf || size <= 0) return -1; if (buf[0] == 1) { int i, cnt, nalsize; const unsigned char *p = buf; h->is_avc = 1; if (size < 7) { av_log(avctx, AV_LOG_ERROR, ""avcC %d too short\n"", size); return AVERROR_INVALIDDATA; } /* sps and pps in the avcC always have length coded with 2 bytes, * so put a fake nal_length_size = 2 while parsing them */ h->nal_length_size = 2; cnt = *(p + 5) & 0x1f; // Number of sps p += 6; for (i = 0; i < cnt; i++) { nalsize = AV_RB16(p) + 2; if(nalsize > size - (p-buf)) return AVERROR_INVALIDDATA; ret = decode_nal_units(h, p, nalsize, 1); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, ""Decoding sps %d from avcC failed\n"", i); return ret; } p += nalsize; } cnt = *(p++); // Number of pps for (i = 0; i < cnt; i++) { nalsize = AV_RB16(p) + 2; if(nalsize > size - (p-buf)) return AVERROR_INVALIDDATA; ret = decode_nal_units(h, p, nalsize, 1); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, ""Decoding pps %d from avcC failed\n"", i); return ret; } p += nalsize; } h->nal_length_size = (buf[4] & 0x03) + 1; } else { h->is_avc = 0; ret = decode_nal_units(h, buf, size, 1); if (ret < 0) return ret; } return size; } ",0 "bool ScrollableShelfView::ShouldAdaptToRTL() const { return base::i18n::IsRTL() && GetShelf()->IsHorizontalAlignment(); } ",0 "void RenderWidgetHostImpl::ImeCancelComposition() { Send(new ViewMsg_ImeSetComposition(GetRoutingID(), string16(), std::vector(), 0, 0)); } ",0 "void pmcraid_ioasc_logger(u32 ioasc, struct pmcraid_cmd *cmd) { struct pmcraid_ioasc_error *error_info = pmcraid_get_error_info(ioasc); if (error_info == NULL || cmd->drv_inst->current_log_level < error_info->log_level) return; /* log the error string */ pmcraid_err(""cmd [%x] for resource %x failed with %x(%s)\n"", cmd->ioa_cb->ioarcb.cdb[0], cmd->ioa_cb->ioarcb.resource_handle, le32_to_cpu(ioasc), error_info->error_string); } ",0 "MojoResult Core::MapBuffer(MojoHandle buffer_handle, uint64_t offset, uint64_t num_bytes, void** buffer, MojoMapBufferFlags flags) { RequestContext request_context; scoped_refptr dispatcher(GetDispatcher(buffer_handle)); if (!dispatcher) return MOJO_RESULT_INVALID_ARGUMENT; std::unique_ptr mapping; MojoResult result = dispatcher->MapBuffer(offset, num_bytes, flags, &mapping); if (result != MOJO_RESULT_OK) return result; DCHECK(mapping); void* address = mapping->GetBase(); { base::AutoLock locker(mapping_table_lock_); result = mapping_table_.AddMapping(std::move(mapping)); } if (result != MOJO_RESULT_OK) return result; *buffer = address; return MOJO_RESULT_OK; } ",0 "static void sas_ata_internal_abort(struct sas_task *task) { struct sas_internal *si = dev_to_sas_internal(task->dev); unsigned long flags; int res; spin_lock_irqsave(&task->task_state_lock, flags); if (task->task_state_flags & SAS_TASK_STATE_ABORTED || task->task_state_flags & SAS_TASK_STATE_DONE) { spin_unlock_irqrestore(&task->task_state_lock, flags); SAS_DPRINTK(""%s: Task %p already finished.\n"", __func__, task); goto out; } task->task_state_flags |= SAS_TASK_STATE_ABORTED; spin_unlock_irqrestore(&task->task_state_lock, flags); res = si->dft->lldd_abort_task(task); spin_lock_irqsave(&task->task_state_lock, flags); if (task->task_state_flags & SAS_TASK_STATE_DONE || res == TMF_RESP_FUNC_COMPLETE) { spin_unlock_irqrestore(&task->task_state_lock, flags); goto out; } /* XXX we are not prepared to deal with ->lldd_abort_task() * failures. TODO: lldds need to unconditionally forget about * aborted ata tasks, otherwise we (likely) leak the sas task * here */ SAS_DPRINTK(""%s: Task %p leaked.\n"", __func__, task); if (!(task->task_state_flags & SAS_TASK_STATE_DONE)) task->task_state_flags &= ~SAS_TASK_STATE_ABORTED; spin_unlock_irqrestore(&task->task_state_lock, flags); return; out: sas_free_task(task); } ",0 "DEFINE_TRACE(FrameLoader) { visitor->trace(m_frame); visitor->trace(m_progressTracker); visitor->trace(m_documentLoader); visitor->trace(m_provisionalDocumentLoader); visitor->trace(m_currentItem); visitor->trace(m_provisionalItem); visitor->trace(m_deferredHistoryLoad); } ",0 "gst_asf_demux_process_metadata (GstASFDemux * demux, guint8 * data, guint64 size) { guint16 blockcount, i; GST_INFO_OBJECT (demux, ""object is a metadata object""); /* Content Descriptor Count */ if (size < 2) goto not_enough_data; blockcount = gst_asf_demux_get_uint16 (&data, &size); for (i = 0; i < blockcount; ++i) { GstStructure *s; guint16 stream_num, name_len, data_type, lang_idx G_GNUC_UNUSED; guint32 data_len, ival; gchar *name_utf8; if (size < (2 + 2 + 2 + 2 + 4)) goto not_enough_data; lang_idx = gst_asf_demux_get_uint16 (&data, &size); stream_num = gst_asf_demux_get_uint16 (&data, &size); name_len = gst_asf_demux_get_uint16 (&data, &size); data_type = gst_asf_demux_get_uint16 (&data, &size); data_len = gst_asf_demux_get_uint32 (&data, &size); if (size < name_len + data_len) goto not_enough_data; /* convert name to UTF-8 */ name_utf8 = g_convert ((gchar *) data, name_len, ""UTF-8"", ""UTF-16LE"", NULL, NULL, NULL); gst_asf_demux_skip_bytes (name_len, &data, &size); if (name_utf8 == NULL) { GST_WARNING (""Failed to convert value name to UTF8, skipping""); gst_asf_demux_skip_bytes (data_len, &data, &size); continue; } if (data_type != ASF_DEMUX_DATA_TYPE_DWORD) { gst_asf_demux_skip_bytes (data_len, &data, &size); g_free (name_utf8); continue; } /* read DWORD */ if (size < 4) { g_free (name_utf8); goto not_enough_data; } ival = gst_asf_demux_get_uint32 (&data, &size); /* skip anything else there may be, just in case */ gst_asf_demux_skip_bytes (data_len - 4, &data, &size); s = gst_asf_demux_get_metadata_for_stream (demux, stream_num); gst_structure_set (s, name_utf8, G_TYPE_INT, ival, NULL); g_free (name_utf8); } GST_INFO_OBJECT (demux, ""metadata = %"" GST_PTR_FORMAT, demux->metadata); return GST_FLOW_OK; /* Errors */ not_enough_data: { GST_WARNING (""Unexpected end of data parsing metadata object""); return GST_FLOW_OK; /* not really fatal */ } } ",0 "void ExtensionTtsController::SetPlatformImpl( ExtensionTtsPlatformImpl* platform_impl) { platform_impl_ = platform_impl; } ",1 "void RenderWidgetHostImpl::OnForceRedrawComplete(int snapshot_id) { #if defined(OS_MACOSX) || defined(OS_WIN) base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( FROM_HERE, base::BindOnce(&RenderWidgetHostImpl::WindowSnapshotReachedScreen, weak_factory_.GetWeakPtr(), snapshot_id), TimeDelta::FromSecondsD(1. / 6)); #else WindowSnapshotReachedScreen(snapshot_id); #endif } ",0 " void testFreeCrash_Bug20080827() { char const * const sourceUri = ""abc""; char const * const baseUri = ""http://www.example.org/""; int res; UriParserStateA state; UriUriA absoluteDest; UriUriA relativeSource; UriUriA absoluteBase; state.uri = &relativeSource; res = uriParseUriA(&state, sourceUri); TEST_ASSERT(res == URI_SUCCESS); state.uri = &absoluteBase; res = uriParseUriA(&state, baseUri); TEST_ASSERT(res == URI_SUCCESS); res = uriRemoveBaseUriA(&absoluteDest, &relativeSource, &absoluteBase, URI_FALSE); TEST_ASSERT(res == URI_ERROR_REMOVEBASE_REL_SOURCE); uriFreeUriMembersA(&relativeSource); uriFreeUriMembersA(&absoluteBase); uriFreeUriMembersA(&absoluteDest); // Crashed here } ",0 "handle_copy_move_conflict (CommonJob *job, GFile *src, GFile *dest, GFile *dest_dir) { FileConflictResponse *response; g_timer_stop (job->time); nautilus_progress_info_pause (job->progress); response = copy_move_conflict_ask_user_action (job->parent_window, src, dest, dest_dir); nautilus_progress_info_resume (job->progress); g_timer_continue (job->time); return response; } ",0 "void Smb4KGlobal::clearHostsList() { mutex.lock(); while (!p->hostsList.isEmpty()) { delete p->hostsList.takeFirst(); } mutex.unlock(); } ",0 "void VideoCaptureImpl::StartCapture( int client_id, const media::VideoCaptureParams& params, const VideoCaptureStateUpdateCB& state_update_cb, const VideoCaptureDeliverFrameCB& deliver_frame_cb) { DVLOG(1) << __func__ << "" |device_id_| = "" << device_id_; DCHECK(io_thread_checker_.CalledOnValidThread()); ClientInfo client_info; client_info.params = params; client_info.state_update_cb = state_update_cb; client_info.deliver_frame_cb = deliver_frame_cb; switch (state_) { case VIDEO_CAPTURE_STATE_STARTING: case VIDEO_CAPTURE_STATE_STARTED: clients_[client_id] = client_info; DCHECK_EQ(params_.resolution_change_policy, params.resolution_change_policy); return; case VIDEO_CAPTURE_STATE_STOPPING: clients_pending_on_restart_[client_id] = client_info; DVLOG(1) << __func__ << "" Got new resolution while stopping: "" << params.requested_format.frame_size.ToString(); return; case VIDEO_CAPTURE_STATE_STOPPED: case VIDEO_CAPTURE_STATE_ENDED: clients_[client_id] = client_info; params_ = params; params_.requested_format.frame_rate = std::min(params_.requested_format.frame_rate, static_cast(media::limits::kMaxFramesPerSecond)); DVLOG(1) << ""StartCapture: starting with first resolution "" << params_.requested_format.frame_size.ToString(); StartCaptureInternal(); return; case VIDEO_CAPTURE_STATE_ERROR: state_update_cb.Run(VIDEO_CAPTURE_STATE_ERROR); return; case VIDEO_CAPTURE_STATE_PAUSED: case VIDEO_CAPTURE_STATE_RESUMED: NOTREACHED(); return; } } ",0 "void FrameLoader::continueLoadAfterWillSubmitForm() { if (!m_provisionalDocumentLoader) return; m_provisionalDocumentLoader->prepareForLoadStart(); if (!m_provisionalDocumentLoader) return; DocumentLoader* activeDocLoader = activeDocumentLoader(); if (activeDocLoader && activeDocLoader->isLoadingMainResource()) return; m_loadingFromCachedPage = false; unsigned long identifier = 0; if (Page* page = m_frame->page()) { identifier = page->progress()->createUniqueIdentifier(); notifier()->assignIdentifierToInitialRequest(identifier, m_provisionalDocumentLoader.get(), m_provisionalDocumentLoader->originalRequest()); } if (!m_provisionalDocumentLoader->startLoadingMainResource(identifier)) m_provisionalDocumentLoader->updateLoading(); } ",0 "int git_index_add_frombuffer( git_index *index, const git_index_entry *source_entry, const void *buffer, size_t len) { git_index_entry *entry = NULL; int error = 0; git_oid id; assert(index && source_entry->path); if (INDEX_OWNER(index) == NULL) return create_index_error(-1, ""could not initialize index entry. "" ""Index is not backed up by an existing repository.""); if (!is_file_or_link(source_entry->mode)) { giterr_set(GITERR_INDEX, ""invalid filemode""); return -1; } if (index_entry_dup(&entry, index, source_entry) < 0) return -1; error = git_blob_create_frombuffer(&id, INDEX_OWNER(index), buffer, len); if (error < 0) { index_entry_free(entry); return error; } git_oid_cpy(&entry->id, &id); entry->file_size = len; if ((error = index_insert(index, &entry, 1, true, true, true)) < 0) return error; /* Adding implies conflict was resolved, move conflict entries to REUC */ if ((error = index_conflict_to_reuc(index, entry->path)) < 0 && error != GIT_ENOTFOUND) return error; git_tree_cache_invalidate_path(index->tree, entry->path); return 0; } ",0 "static int jas_icctxtdesc_output(jas_iccattrval_t *attrval, jas_stream_t *out) { jas_icctxtdesc_t *txtdesc = &attrval->data.txtdesc; if (jas_iccputuint32(out, txtdesc->asclen) || jas_stream_puts(out, txtdesc->ascdata) || jas_stream_putc(out, 0) == EOF || jas_iccputuint32(out, txtdesc->uclangcode) || jas_iccputuint32(out, txtdesc->uclen) || jas_stream_write(out, txtdesc->ucdata, txtdesc->uclen * 2) != JAS_CAST(int, txtdesc->uclen * 2) || jas_iccputuint16(out, txtdesc->sccode) || jas_stream_putc(out, txtdesc->maclen) == EOF) goto error; if (txtdesc->maclen > 0) { if (jas_stream_write(out, txtdesc->macdata, 67) != 67) goto error; } else { if (jas_stream_pad(out, 67, 0) != 67) goto error; } return 0; error: return -1; } ",0 "static int nfs3svc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p, struct nfsd3_getaclres *resp) { struct dentry *dentry = resp->fh.fh_dentry; p = nfs3svc_encode_post_op_attr(rqstp, p, &resp->fh); if (resp->status == 0 && dentry && d_really_is_positive(dentry)) { struct inode *inode = d_inode(dentry); struct kvec *head = rqstp->rq_res.head; unsigned int base; int n; int w; *p++ = htonl(resp->mask); if (!xdr_ressize_check(rqstp, p)) return 0; base = (char *)p - (char *)head->iov_base; rqstp->rq_res.page_len = w = nfsacl_size( (resp->mask & NFS_ACL) ? resp->acl_access : NULL, (resp->mask & NFS_DFACL) ? resp->acl_default : NULL); while (w > 0) { if (!*(rqstp->rq_next_page++)) return 0; w -= PAGE_SIZE; } n = nfsacl_encode(&rqstp->rq_res, base, inode, resp->acl_access, resp->mask & NFS_ACL, 0); if (n > 0) n = nfsacl_encode(&rqstp->rq_res, base + n, inode, resp->acl_default, resp->mask & NFS_DFACL, NFS_ACL_DEFAULT); if (n <= 0) return 0; } else if (!xdr_ressize_check(rqstp, p)) return 0; return 1; } ",0 "generate_many_bodies_inner (DBusMessageDataIter *iter, DBusMessage **message_p) { DBusMessage *message; DBusString signature; DBusString body; /* Keeping this small makes things go faster */ message = dbus_message_new_method_call (""o.z.F"", ""/"", ""o.z.B"", ""Nah""); if (message == NULL) _dbus_assert_not_reached (""oom""); set_reply_serial (message); if (!_dbus_string_init (&signature) || !_dbus_string_init (&body)) _dbus_assert_not_reached (""oom""); if (dbus_internal_do_not_use_generate_bodies (iter_get_sequence (iter), message->byte_order, &signature, &body)) { const char *v_SIGNATURE; v_SIGNATURE = _dbus_string_get_const_data (&signature); if (!_dbus_header_set_field_basic (&message->header, DBUS_HEADER_FIELD_SIGNATURE, DBUS_TYPE_SIGNATURE, &v_SIGNATURE)) _dbus_assert_not_reached (""oom""); if (!_dbus_string_move (&body, 0, &message->body, 0)) _dbus_assert_not_reached (""oom""); _dbus_marshal_set_uint32 (&message->header.data, BODY_LENGTH_OFFSET, _dbus_string_get_length (&message->body), message->byte_order); *message_p = message; } else { dbus_message_unref (message); *message_p = NULL; } _dbus_string_free (&signature); _dbus_string_free (&body); return *message_p != NULL; } ",0 "GBool GfxState::parseBlendMode(Object *obj, GfxBlendMode *mode) { Object obj2; int i, j; if (obj->isName()) { for (i = 0; i < nGfxBlendModeNames; ++i) { if (!strcmp(obj->getName(), gfxBlendModeNames[i].name)) { *mode = gfxBlendModeNames[i].mode; return gTrue; } } return gFalse; } else if (obj->isArray()) { for (i = 0; i < obj->arrayGetLength(); ++i) { obj->arrayGet(i, &obj2); if (!obj2.isName()) { obj2.free(); return gFalse; } for (j = 0; j < nGfxBlendModeNames; ++j) { if (!strcmp(obj2.getName(), gfxBlendModeNames[j].name)) { obj2.free(); *mode = gfxBlendModeNames[j].mode; return gTrue; } } obj2.free(); } *mode = gfxBlendNormal; return gTrue; } else { return gFalse; } } ",0 "void GLES2DecoderImpl::ReleaseIOSurfaceForTexture(GLuint texture_id) { TextureToIOSurfaceMap::iterator it = texture_to_io_surface_map_.find( texture_id); if (it != texture_to_io_surface_map_.end()) { IOSurfaceRef surface = it->second; CFRelease(surface); texture_to_io_surface_map_.erase(it); } } ",0 "void AudioRendererAlgorithm::ResetWindow() { DCHECK_LE(index_into_window_, window_size_); index_into_window_ = 0; crossfade_frame_number_ = 0; } ",0 "String DataObjectItem::GetAsString() const { DCHECK_EQ(kind_, kStringKind); if (source_ == kInternalSource) return data_; DCHECK_EQ(source_, kClipboardSource); String data; if (type_ == kMimeTypeTextPlain) { data = SystemClipboard::GetInstance().ReadPlainText(); } else if (type_ == kMimeTypeTextRTF) { data = SystemClipboard::GetInstance().ReadRTF(); } else if (type_ == kMimeTypeTextHTML) { KURL ignored_source_url; unsigned ignored; data = SystemClipboard::GetInstance().ReadHTML(ignored_source_url, ignored, ignored); } else { data = SystemClipboard::GetInstance().ReadCustomData(type_); } return SystemClipboard::GetInstance().SequenceNumber() == sequence_number_ ? data : String(); } ",0 "mp_fail_print(netdissect_options *ndo, const u_char *opt, u_int opt_len, u_char flags _U_) { if (opt_len != 12) return 0; ND_PRINT((ndo, "" seq %"" PRIu64, EXTRACT_64BITS(opt + 4))); return 1; } ",0 "static int invlpg_interception(struct vcpu_svm *svm) { if (!static_cpu_has(X86_FEATURE_DECODEASSISTS)) return emulate_instruction(&svm->vcpu, 0) == EMULATE_DONE; kvm_mmu_invlpg(&svm->vcpu, svm->vmcb->control.exit_info_1); skip_emulated_instruction(&svm->vcpu); return 1; } ",0 "int rds_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, int msg_flags) { struct sock *sk = sock->sk; struct rds_sock *rs = rds_sk_to_rs(sk); long timeo; int ret = 0, nonblock = msg_flags & MSG_DONTWAIT; DECLARE_SOCKADDR(struct sockaddr_in6 *, sin6, msg->msg_name); DECLARE_SOCKADDR(struct sockaddr_in *, sin, msg->msg_name); struct rds_incoming *inc = NULL; /* udp_recvmsg()->sock_recvtimeo() gets away without locking too.. */ timeo = sock_rcvtimeo(sk, nonblock); rdsdebug(""size %zu flags 0x%x timeo %ld\n"", size, msg_flags, timeo); if (msg_flags & MSG_OOB) goto out; if (msg_flags & MSG_ERRQUEUE) return sock_recv_errqueue(sk, msg, size, SOL_IP, IP_RECVERR); while (1) { /* If there are pending notifications, do those - and nothing else */ if (!list_empty(&rs->rs_notify_queue)) { ret = rds_notify_queue_get(rs, msg); break; } if (rs->rs_cong_notify) { ret = rds_notify_cong(rs, msg); break; } if (!rds_next_incoming(rs, &inc)) { if (nonblock) { bool reaped = rds_recvmsg_zcookie(rs, msg); ret = reaped ? 0 : -EAGAIN; break; } timeo = wait_event_interruptible_timeout(*sk_sleep(sk), (!list_empty(&rs->rs_notify_queue) || rs->rs_cong_notify || rds_next_incoming(rs, &inc)), timeo); rdsdebug(""recvmsg woke inc %p timeo %ld\n"", inc, timeo); if (timeo > 0 || timeo == MAX_SCHEDULE_TIMEOUT) continue; ret = timeo; if (ret == 0) ret = -ETIMEDOUT; break; } rdsdebug(""copying inc %p from %pI6c:%u to user\n"", inc, &inc->i_conn->c_faddr, ntohs(inc->i_hdr.h_sport)); ret = inc->i_conn->c_trans->inc_copy_to_user(inc, &msg->msg_iter); if (ret < 0) break; /* * if the message we just copied isn't at the head of the * recv queue then someone else raced us to return it, try * to get the next message. */ if (!rds_still_queued(rs, inc, !(msg_flags & MSG_PEEK))) { rds_inc_put(inc); inc = NULL; rds_stats_inc(s_recv_deliver_raced); iov_iter_revert(&msg->msg_iter, ret); continue; } if (ret < be32_to_cpu(inc->i_hdr.h_len)) { if (msg_flags & MSG_TRUNC) ret = be32_to_cpu(inc->i_hdr.h_len); msg->msg_flags |= MSG_TRUNC; } if (rds_cmsg_recv(inc, msg, rs)) { ret = -EFAULT; goto out; } rds_recvmsg_zcookie(rs, msg); rds_stats_inc(s_recv_delivered); if (msg->msg_name) { if (ipv6_addr_v4mapped(&inc->i_saddr)) { sin = (struct sockaddr_in *)msg->msg_name; sin->sin_family = AF_INET; sin->sin_port = inc->i_hdr.h_sport; sin->sin_addr.s_addr = inc->i_saddr.s6_addr32[3]; memset(sin->sin_zero, 0, sizeof(sin->sin_zero)); msg->msg_namelen = sizeof(*sin); } else { sin6 = (struct sockaddr_in6 *)msg->msg_name; sin6->sin6_family = AF_INET6; sin6->sin6_port = inc->i_hdr.h_sport; sin6->sin6_addr = inc->i_saddr; sin6->sin6_flowinfo = 0; sin6->sin6_scope_id = rs->rs_bound_scope_id; msg->msg_namelen = sizeof(*sin6); } } break; } if (inc) rds_inc_put(inc); out: return ret; } ",0 "static int snd_ctl_card_info(struct snd_card *card, struct snd_ctl_file * ctl, unsigned int cmd, void __user *arg) { struct snd_ctl_card_info *info; info = kzalloc(sizeof(*info), GFP_KERNEL); if (! info) return -ENOMEM; down_read(&snd_ioctl_rwsem); info->card = card->number; strlcpy(info->id, card->id, sizeof(info->id)); strlcpy(info->driver, card->driver, sizeof(info->driver)); strlcpy(info->name, card->shortname, sizeof(info->name)); strlcpy(info->longname, card->longname, sizeof(info->longname)); strlcpy(info->mixername, card->mixername, sizeof(info->mixername)); strlcpy(info->components, card->components, sizeof(info->components)); up_read(&snd_ioctl_rwsem); if (copy_to_user(arg, info, sizeof(struct snd_ctl_card_info))) { kfree(info); return -EFAULT; } kfree(info); return 0; } ",0 "static unsigned int crypto_rng_ctxsize(struct crypto_alg *alg, u32 type, u32 mask) { return alg->cra_ctxsize; } ",0 "static void unsignedLongAttributeAttributeSetterCallback(v8::Local, v8::Local jsValue, const v8::PropertyCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMSetter""); TestObjectPythonV8Internal::unsignedLongAttributeAttributeSetter(jsValue, info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 " static std::string GetSessionCacheKey(const SSL* ssl) { SSLClientSocketOpenSSL* socket = GetInstance()->GetClientSocketFromSSL(ssl); DCHECK(socket); return GetSocketSessionCacheKey(*socket); } ",0 " RestartTestJob(URLRequest* request, NetworkDelegate* network_delegate) : URLRequestTestJob(request, network_delegate, true) {} ",0 "static int finish_port_resume(struct usb_device *udev) { int status = 0; u16 devstatus = 0; /* caller owns the udev device lock */ dev_dbg(&udev->dev, ""%s\n"", udev->reset_resume ? ""finish reset-resume"" : ""finish resume""); /* usb ch9 identifies four variants of SUSPENDED, based on what * state the device resumes to. Linux currently won't see the * first two on the host side; they'd be inside hub_port_init() * during many timeouts, but hub_wq can't suspend until later. */ usb_set_device_state(udev, udev->actconfig ? USB_STATE_CONFIGURED : USB_STATE_ADDRESS); /* 10.5.4.5 says not to reset a suspended port if the attached * device is enabled for remote wakeup. Hence the reset * operation is carried out here, after the port has been * resumed. */ if (udev->reset_resume) { /* * If the device morphs or switches modes when it is reset, * we don't want to perform a reset-resume. We'll fail the * resume, which will cause a logical disconnect, and then * the device will be rediscovered. */ retry_reset_resume: if (udev->quirks & USB_QUIRK_RESET) status = -ENODEV; else status = usb_reset_and_verify_device(udev); } /* 10.5.4.5 says be sure devices in the tree are still there. * For now let's assume the device didn't go crazy on resume, * and device drivers will know about any resume quirks. */ if (status == 0) { devstatus = 0; status = usb_get_status(udev, USB_RECIP_DEVICE, 0, &devstatus); /* If a normal resume failed, try doing a reset-resume */ if (status && !udev->reset_resume && udev->persist_enabled) { dev_dbg(&udev->dev, ""retry with reset-resume\n""); udev->reset_resume = 1; goto retry_reset_resume; } } if (status) { dev_dbg(&udev->dev, ""gone after usb resume? status %d\n"", status); /* * There are a few quirky devices which violate the standard * by claiming to have remote wakeup enabled after a reset, * which crash if the feature is cleared, hence check for * udev->reset_resume */ } else if (udev->actconfig && !udev->reset_resume) { if (udev->speed < USB_SPEED_SUPER) { if (devstatus & (1 << USB_DEVICE_REMOTE_WAKEUP)) status = usb_disable_remote_wakeup(udev); } else { status = usb_get_status(udev, USB_RECIP_INTERFACE, 0, &devstatus); if (!status && devstatus & (USB_INTRF_STAT_FUNC_RW_CAP | USB_INTRF_STAT_FUNC_RW)) status = usb_disable_remote_wakeup(udev); } if (status) dev_dbg(&udev->dev, ""disable remote wakeup, status %d\n"", status); status = 0; } return status; } ",0 "stringprep_strerror (Stringprep_rc rc) { const char *p; bindtextdomain (PACKAGE, LOCALEDIR); switch (rc) { case STRINGPREP_OK: p = _(""Success""); break; case STRINGPREP_CONTAINS_UNASSIGNED: p = _(""Forbidden unassigned code points in input""); break; case STRINGPREP_CONTAINS_PROHIBITED: p = _(""Prohibited code points in input""); break; case STRINGPREP_BIDI_BOTH_L_AND_RAL: p = _(""Conflicting bidirectional properties in input""); break; case STRINGPREP_BIDI_LEADTRAIL_NOT_RAL: p = _(""Malformed bidirectional string""); break; case STRINGPREP_BIDI_CONTAINS_PROHIBITED: p = _(""Prohibited bidirectional code points in input""); break; case STRINGPREP_TOO_SMALL_BUFFER: p = _(""Output would exceed the buffer space provided""); break; case STRINGPREP_PROFILE_ERROR: p = _(""Error in stringprep profile definition""); break; case STRINGPREP_FLAG_ERROR: p = _(""Flag conflict with profile""); break; case STRINGPREP_UNKNOWN_PROFILE: case STRINGPREP_UNKNOWN_PROFILE: p = _(""Unknown profile""); break; case STRINGPREP_NFKC_FAILED: p = _(""Unicode normalization failed (internal error)""); break; default: p = _(""Unknown error""); break; } return p; } ",1 "ZEND_API int zend_ts_hash_del_key_or_index(TsHashTable *ht, char *arKey, uint nKeyLength, ulong h, int flag) { int retval; begin_write(ht); retval = zend_hash_del_key_or_index(TS_HASH(ht), arKey, nKeyLength, h, flag); end_write(ht); return retval; } ",0 "ebt_basic_match(const struct ebt_entry *e, const struct sk_buff *skb, const struct net_device *in, const struct net_device *out) { const struct ethhdr *h = eth_hdr(skb); const struct net_bridge_port *p; __be16 ethproto; int verdict, i; if (vlan_tx_tag_present(skb)) ethproto = htons(ETH_P_8021Q); else ethproto = h->h_proto; if (e->bitmask & EBT_802_3) { if (FWINV2(ntohs(ethproto) >= 1536, EBT_IPROTO)) return 1; } else if (!(e->bitmask & EBT_NOPROTO) && FWINV2(e->ethproto != ethproto, EBT_IPROTO)) return 1; if (FWINV2(ebt_dev_check(e->in, in), EBT_IIN)) return 1; if (FWINV2(ebt_dev_check(e->out, out), EBT_IOUT)) return 1; /* rcu_read_lock()ed by nf_hook_slow */ if (in && (p = br_port_get_rcu(in)) != NULL && FWINV2(ebt_dev_check(e->logical_in, p->br->dev), EBT_ILOGICALIN)) return 1; if (out && (p = br_port_get_rcu(out)) != NULL && FWINV2(ebt_dev_check(e->logical_out, p->br->dev), EBT_ILOGICALOUT)) return 1; if (e->bitmask & EBT_SOURCEMAC) { verdict = 0; for (i = 0; i < 6; i++) verdict |= (h->h_source[i] ^ e->sourcemac[i]) & e->sourcemsk[i]; if (FWINV2(verdict != 0, EBT_ISOURCE) ) return 1; } if (e->bitmask & EBT_DESTMAC) { verdict = 0; for (i = 0; i < 6; i++) verdict |= (h->h_dest[i] ^ e->destmac[i]) & e->destmsk[i]; if (FWINV2(verdict != 0, EBT_IDEST) ) return 1; } return 0; } ",0 "s32 gf_gettimeofday(struct timeval *tp, void *tz) { return gettimeofday(tp, tz); } ",0 "void V8TestObject::LongAttributeAttributeSetterCallback( const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_longAttribute_Setter""); v8::Local v8_value = info[0]; test_object_v8_internal::LongAttributeAttributeSetter(v8_value, info); } ",0 "void Document::setXMLVersion(const String& version, ExceptionState& exception_state) { if (!XMLDocumentParser::SupportsXMLVersion(version)) { exception_state.ThrowDOMException( kNotSupportedError, ""This document does not support the XML version '"" + version + ""'.""); return; } xml_version_ = version; } ",0 "virDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags) { virConnectPtr conn; VIR_DOMAIN_DEBUG(domain, ""flags=%x"", flags); virResetLastError(); virCheckDomainReturn(domain, -1); conn = domain->conn; if (flags & VIR_DOMAIN_VCPU_GUEST) virCheckReadOnlyGoto(conn->flags, error); VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_AFFECT_LIVE, VIR_DOMAIN_AFFECT_CONFIG, error); if (conn->driver->domainGetVcpusFlags) { int ret; ret = conn->driver->domainGetVcpusFlags(domain, flags); if (ret < 0) goto error; return ret; } virReportUnsupportedError(); error: virDispatchError(domain->conn); return -1; } ",0 "static int kvm_io_bus_insert_dev(struct kvm_io_bus *bus, struct kvm_io_device *dev, gpa_t addr, int len) { bus->range[bus->dev_count++] = (struct kvm_io_range) { .addr = addr, .len = len, .dev = dev, }; sort(bus->range, bus->dev_count, sizeof(struct kvm_io_range), kvm_io_bus_sort_cmp, NULL); return 0; } ",0 " virtual void TearDown() { if (invalidation_notifier_.get()) ResetNotifier(); } ",0 "bool base64Decode(const String& in, Vector& out, CharacterMatchFunctionPtr shouldIgnoreCharacter, Base64DecodePolicy policy) { if (in.isEmpty()) return base64DecodeInternal(0, 0, out, shouldIgnoreCharacter, policy); if (in.is8Bit()) return base64DecodeInternal(in.characters8(), in.length(), out, shouldIgnoreCharacter, policy); return base64DecodeInternal(in.characters16(), in.length(), out, shouldIgnoreCharacter, policy); } ",0 "decode_NXAST_RAW_REG_LOAD(const struct nx_action_reg_load *narl, enum ofp_version ofp_version OVS_UNUSED, const struct vl_mff_map *vl_mff_map, uint64_t *tlv_bitmap, struct ofpbuf *out) { struct mf_subfield dst; enum ofperr error; dst.ofs = nxm_decode_ofs(narl->ofs_nbits); dst.n_bits = nxm_decode_n_bits(narl->ofs_nbits); error = mf_vl_mff_mf_from_nxm_header(ntohl(narl->dst), vl_mff_map, &dst.field, tlv_bitmap); if (error) { return error; } error = mf_check_dst(&dst, NULL); if (error) { return error; } /* Reject 'narl' if a bit numbered 'n_bits' or higher is set to 1 in * narl->value. */ if (dst.n_bits < 64 && ntohll(narl->value) >> dst.n_bits) { return OFPERR_OFPBAC_BAD_ARGUMENT; } struct ofpact_set_field *sf = ofpact_put_reg_load(out, dst.field, NULL, NULL); bitwise_put(ntohll(narl->value), sf->value, dst.field->n_bytes, dst.ofs, dst.n_bits); bitwise_put(UINT64_MAX, ofpact_set_field_mask(sf), dst.field->n_bytes, dst.ofs, dst.n_bits); return 0; } ",0 "static int gpr32_get(struct task_struct *target, const struct user_regset *regset, unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf) { const unsigned long *regs = &target->thread.regs->gpr[0]; compat_ulong_t *k = kbuf; compat_ulong_t __user *u = ubuf; compat_ulong_t reg; int i; if (target->thread.regs == NULL) return -EIO; if (!FULL_REGS(target->thread.regs)) { /* We have a partial register set. Fill 14-31 with bogus values */ for (i = 14; i < 32; i++) target->thread.regs->gpr[i] = NV_REG_POISON; } pos /= sizeof(reg); count /= sizeof(reg); if (kbuf) for (; count > 0 && pos < PT_MSR; --count) *k++ = regs[pos++]; else for (; count > 0 && pos < PT_MSR; --count) if (__put_user((compat_ulong_t) regs[pos++], u++)) return -EFAULT; if (count > 0 && pos == PT_MSR) { reg = get_user_msr(target); if (kbuf) *k++ = reg; else if (__put_user(reg, u++)) return -EFAULT; ++pos; --count; } if (kbuf) for (; count > 0 && pos < PT_REGS_COUNT; --count) *k++ = regs[pos++]; else for (; count > 0 && pos < PT_REGS_COUNT; --count) if (__put_user((compat_ulong_t) regs[pos++], u++)) return -EFAULT; kbuf = k; ubuf = u; pos *= sizeof(reg); count *= sizeof(reg); return user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf, PT_REGS_COUNT * sizeof(reg), -1); } ",0 " static ThreadSpecific& originMap() { AtomicallyInitializedStatic(BlobOriginCache*, cache = new BlobOriginCache); AtomicallyInitializedStatic(ThreadSpecific*, map = new ThreadSpecific); return *map; } ",0 "static int sg_proc_seq_show_int(struct seq_file *s, void *v) { seq_printf(s, ""%d\n"", *((int *)s->private)); return 0; } ",0 "perf_event_set_addr_filter(struct perf_event *event, char *filter_str) { LIST_HEAD(filters); int ret; /* * Since this is called in perf_ioctl() path, we're already holding * ctx::mutex. */ lockdep_assert_held(&event->ctx->mutex); if (WARN_ON_ONCE(event->parent)) return -EINVAL; ret = perf_event_parse_addr_filter(event, filter_str, &filters); if (ret) goto fail_clear_files; ret = event->pmu->addr_filters_validate(&filters); if (ret) goto fail_free_filters; /* remove existing filters, if any */ perf_addr_filters_splice(event, &filters); /* install new filters */ perf_event_for_each_child(event, perf_event_addr_filters_apply); return ret; fail_free_filters: free_filters_list(&filters); fail_clear_files: event->addr_filters.nr_file_filters = 0; return ret; } ",0 "PseudoElement* Element::pseudoElement(PseudoId pseudoId) const { return hasRareData() ? elementRareData()->pseudoElement(pseudoId) : 0; } ",0 "const char* InputDispatcher::Connection::getWindowName() const { if (inputWindowHandle != NULL) { return inputWindowHandle->getName().string(); } if (monitor) { return ""monitor""; } return ""?""; } ",0 "blink::WebFrame* RenderFrameImpl::ResolveOpener(int opener_frame_routing_id) { if (opener_frame_routing_id == MSG_ROUTING_NONE) return nullptr; RenderFrameProxy* opener_proxy = RenderFrameProxy::FromRoutingID(opener_frame_routing_id); if (opener_proxy) return opener_proxy->web_frame(); RenderFrameImpl* opener_frame = RenderFrameImpl::FromRoutingID(opener_frame_routing_id); if (opener_frame) return opener_frame->GetWebFrame(); return nullptr; } ",0 "void NTPInfoObserver::OnTopSitesLoaded() { request_ = top_sites_->StartQueryForMostVisited(); } ",0 "static void sync_lockstate_on_connect(btif_hh_device_t *p_dev) { int keylockstates; BTIF_TRACE_EVENT(""%s: Syncing keyboard lock states after ""\ ""reconnect..."",__FUNCTION__); /*If the device is connected, update keyboard state */ update_keyboard_lockstates(p_dev); /*Check if the lockstate of caps,scroll,num is set. If so, send a report to the kernel so the lockstate is in sync */ keylockstates = get_keylockstates(); if (keylockstates) { BTIF_TRACE_DEBUG(""%s: Sending hid report to kernel ""\ ""indicating lock key state 0x%x"",__FUNCTION__, keylockstates); usleep(200000); toggle_os_keylockstates(p_dev->fd, keylockstates); } else { BTIF_TRACE_DEBUG(""%s: NOT sending hid report to kernel ""\ ""indicating lock key state 0x%x"",__FUNCTION__, keylockstates); } } ",1 "int ParseRiffHeaderConfig (FILE *infile, char *infilename, char *fourcc, WavpackContext *wpc, WavpackConfig *config) { int is_rf64 = !strncmp (fourcc, ""RF64"", 4), got_ds64 = 0; int64_t total_samples = 0, infilesize; RiffChunkHeader riff_chunk_header; ChunkHeader chunk_header; WaveHeader WaveHeader; DS64Chunk ds64_chunk; uint32_t bcount; CLEAR (WaveHeader); CLEAR (ds64_chunk); infilesize = DoGetFileSize (infile); if (!is_rf64 && infilesize >= 4294967296LL && !(config->qmode & QMODE_IGNORE_LENGTH)) { error_line (""can't handle .WAV files larger than 4 GB (non-standard)!""); return WAVPACK_SOFT_ERROR; } memcpy (&riff_chunk_header, fourcc, 4); if ((!DoReadFile (infile, ((char *) &riff_chunk_header) + 4, sizeof (RiffChunkHeader) - 4, &bcount) || bcount != sizeof (RiffChunkHeader) - 4 || strncmp (riff_chunk_header.formType, ""WAVE"", 4))) { error_line (""%s is not a valid .WAV file!"", infilename); return WAVPACK_SOFT_ERROR; } else if (!(config->qmode & QMODE_NO_STORE_WRAPPER) && !WavpackAddWrapper (wpc, &riff_chunk_header, sizeof (RiffChunkHeader))) { error_line (""%s"", WavpackGetErrorMessage (wpc)); return WAVPACK_SOFT_ERROR; } while (1) { if (!DoReadFile (infile, &chunk_header, sizeof (ChunkHeader), &bcount) || bcount != sizeof (ChunkHeader)) { error_line (""%s is not a valid .WAV file!"", infilename); return WAVPACK_SOFT_ERROR; } else if (!(config->qmode & QMODE_NO_STORE_WRAPPER) && !WavpackAddWrapper (wpc, &chunk_header, sizeof (ChunkHeader))) { error_line (""%s"", WavpackGetErrorMessage (wpc)); return WAVPACK_SOFT_ERROR; } WavpackLittleEndianToNative (&chunk_header, ChunkHeaderFormat); if (!strncmp (chunk_header.ckID, ""ds64"", 4)) { if (chunk_header.ckSize < sizeof (DS64Chunk) || !DoReadFile (infile, &ds64_chunk, sizeof (DS64Chunk), &bcount) || bcount != sizeof (DS64Chunk)) { error_line (""%s is not a valid .WAV file!"", infilename); return WAVPACK_SOFT_ERROR; } else if (!(config->qmode & QMODE_NO_STORE_WRAPPER) && !WavpackAddWrapper (wpc, &ds64_chunk, sizeof (DS64Chunk))) { error_line (""%s"", WavpackGetErrorMessage (wpc)); return WAVPACK_SOFT_ERROR; } got_ds64 = 1; WavpackLittleEndianToNative (&ds64_chunk, DS64ChunkFormat); if (debug_logging_mode) error_line (""DS64: riffSize = %lld, dataSize = %lld, sampleCount = %lld, table_length = %d"", (long long) ds64_chunk.riffSize64, (long long) ds64_chunk.dataSize64, (long long) ds64_chunk.sampleCount64, ds64_chunk.tableLength); if (ds64_chunk.tableLength * sizeof (CS64Chunk) != chunk_header.ckSize - sizeof (DS64Chunk)) { error_line (""%s is not a valid .WAV file!"", infilename); return WAVPACK_SOFT_ERROR; } while (ds64_chunk.tableLength--) { CS64Chunk cs64_chunk; if (!DoReadFile (infile, &cs64_chunk, sizeof (CS64Chunk), &bcount) || bcount != sizeof (CS64Chunk) || (!(config->qmode & QMODE_NO_STORE_WRAPPER) && !WavpackAddWrapper (wpc, &cs64_chunk, sizeof (CS64Chunk)))) { error_line (""%s"", WavpackGetErrorMessage (wpc)); return WAVPACK_SOFT_ERROR; } } } else if (!strncmp (chunk_header.ckID, ""fmt "", 4)) { // if it's the format chunk, we want to get some info out of there and int supported = TRUE, format; // make sure it's a .wav file we can handle if (chunk_header.ckSize < 16 || chunk_header.ckSize > sizeof (WaveHeader) || !DoReadFile (infile, &WaveHeader, chunk_header.ckSize, &bcount) || bcount != chunk_header.ckSize) { error_line (""%s is not a valid .WAV file!"", infilename); return WAVPACK_SOFT_ERROR; } else if (!(config->qmode & QMODE_NO_STORE_WRAPPER) && !WavpackAddWrapper (wpc, &WaveHeader, chunk_header.ckSize)) { error_line (""%s"", WavpackGetErrorMessage (wpc)); return WAVPACK_SOFT_ERROR; } WavpackLittleEndianToNative (&WaveHeader, WaveHeaderFormat); if (debug_logging_mode) { error_line (""format tag size = %d"", chunk_header.ckSize); error_line (""FormatTag = %x, NumChannels = %d, BitsPerSample = %d"", WaveHeader.FormatTag, WaveHeader.NumChannels, WaveHeader.BitsPerSample); error_line (""BlockAlign = %d, SampleRate = %d, BytesPerSecond = %d"", WaveHeader.BlockAlign, WaveHeader.SampleRate, WaveHeader.BytesPerSecond); if (chunk_header.ckSize > 16) error_line (""cbSize = %d, ValidBitsPerSample = %d"", WaveHeader.cbSize, WaveHeader.ValidBitsPerSample); if (chunk_header.ckSize > 20) error_line (""ChannelMask = %x, SubFormat = %d"", WaveHeader.ChannelMask, WaveHeader.SubFormat); } if (chunk_header.ckSize > 16 && WaveHeader.cbSize == 2) config->qmode |= QMODE_ADOBE_MODE; format = (WaveHeader.FormatTag == 0xfffe && chunk_header.ckSize == 40) ? WaveHeader.SubFormat : WaveHeader.FormatTag; config->bits_per_sample = (chunk_header.ckSize == 40 && WaveHeader.ValidBitsPerSample) ? WaveHeader.ValidBitsPerSample : WaveHeader.BitsPerSample; if (format != 1 && format != 3) supported = FALSE; if (format == 3 && config->bits_per_sample != 32) supported = FALSE; if (!WaveHeader.NumChannels || WaveHeader.NumChannels > 256 || WaveHeader.BlockAlign / WaveHeader.NumChannels < (config->bits_per_sample + 7) / 8 || WaveHeader.BlockAlign / WaveHeader.NumChannels > 4 || WaveHeader.BlockAlign % WaveHeader.NumChannels) supported = FALSE; if (config->bits_per_sample < 1 || config->bits_per_sample > 32) supported = FALSE; if (!supported) { error_line (""%s is an unsupported .WAV format!"", infilename); return WAVPACK_SOFT_ERROR; } if (chunk_header.ckSize < 40) { if (!config->channel_mask && !(config->qmode & QMODE_CHANS_UNASSIGNED)) { if (WaveHeader.NumChannels <= 2) config->channel_mask = 0x5 - WaveHeader.NumChannels; else if (WaveHeader.NumChannels <= 18) config->channel_mask = (1 << WaveHeader.NumChannels) - 1; else config->channel_mask = 0x3ffff; } } else if (WaveHeader.ChannelMask && (config->channel_mask || (config->qmode & QMODE_CHANS_UNASSIGNED))) { error_line (""this WAV file already has channel order information!""); return WAVPACK_SOFT_ERROR; } else if (WaveHeader.ChannelMask) config->channel_mask = WaveHeader.ChannelMask; if (format == 3) config->float_norm_exp = 127; else if ((config->qmode & QMODE_ADOBE_MODE) && WaveHeader.BlockAlign / WaveHeader.NumChannels == 4) { if (WaveHeader.BitsPerSample == 24) config->float_norm_exp = 127 + 23; else if (WaveHeader.BitsPerSample == 32) config->float_norm_exp = 127 + 15; } if (debug_logging_mode) { if (config->float_norm_exp == 127) error_line (""data format: normalized 32-bit floating point""); else if (config->float_norm_exp) error_line (""data format: 32-bit floating point (Audition %d:%d float type 1)"", config->float_norm_exp - 126, 150 - config->float_norm_exp); else error_line (""data format: %d-bit integers stored in %d byte(s)"", config->bits_per_sample, WaveHeader.BlockAlign / WaveHeader.NumChannels); } } else if (!strncmp (chunk_header.ckID, ""data"", 4)) { // on the data chunk, get size and exit loop int64_t data_chunk_size = (got_ds64 && chunk_header.ckSize == (uint32_t) -1) ? ds64_chunk.dataSize64 : chunk_header.ckSize; if (!WaveHeader.NumChannels || (is_rf64 && !got_ds64)) { // make sure we saw ""fmt"" and ""ds64"" chunks (if required) error_line (""%s is not a valid .WAV file!"", infilename); return WAVPACK_SOFT_ERROR; } if (infilesize && !(config->qmode & QMODE_IGNORE_LENGTH) && infilesize - data_chunk_size > 16777216) { error_line (""this .WAV file has over 16 MB of extra RIFF data, probably is corrupt!""); return WAVPACK_SOFT_ERROR; } if (config->qmode & QMODE_IGNORE_LENGTH) { if (infilesize && DoGetFilePosition (infile) != -1) total_samples = (infilesize - DoGetFilePosition (infile)) / WaveHeader.BlockAlign; else total_samples = -1; } else { total_samples = data_chunk_size / WaveHeader.BlockAlign; if (got_ds64 && total_samples != ds64_chunk.sampleCount64) { error_line (""%s is not a valid .WAV file!"", infilename); return WAVPACK_SOFT_ERROR; } if (!total_samples) { error_line (""this .WAV file has no audio samples, probably is corrupt!""); return WAVPACK_SOFT_ERROR; } if (total_samples > MAX_WAVPACK_SAMPLES) { error_line (""%s has too many samples for WavPack!"", infilename); return WAVPACK_SOFT_ERROR; } } config->bytes_per_sample = WaveHeader.BlockAlign / WaveHeader.NumChannels; config->num_channels = WaveHeader.NumChannels; config->sample_rate = WaveHeader.SampleRate; break; } else { // just copy unknown chunks to output file int bytes_to_copy = (chunk_header.ckSize + 1) & ~1L; char *buff = malloc (bytes_to_copy); if (debug_logging_mode) error_line (""extra unknown chunk \""%c%c%c%c\"" of %d bytes"", chunk_header.ckID [0], chunk_header.ckID [1], chunk_header.ckID [2], chunk_header.ckID [3], chunk_header.ckSize); if (!DoReadFile (infile, buff, bytes_to_copy, &bcount) || bcount != bytes_to_copy || (!(config->qmode & QMODE_NO_STORE_WRAPPER) && !WavpackAddWrapper (wpc, buff, bytes_to_copy))) { error_line (""%s"", WavpackGetErrorMessage (wpc)); free (buff); return WAVPACK_SOFT_ERROR; } free (buff); } } if (!WavpackSetConfiguration64 (wpc, config, total_samples, NULL)) { error_line (""%s: %s"", infilename, WavpackGetErrorMessage (wpc)); return WAVPACK_SOFT_ERROR; } return WAVPACK_NO_ERROR; } ",1 "bool LookupMatchInTopDomains(base::StringPiece skeleton) { DCHECK_NE(skeleton.back(), '.'); auto labels = base::SplitStringPiece(skeleton, ""."", base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL); if (labels.size() > kNumberOfLabelsToCheck) { labels.erase(labels.begin(), labels.begin() + labels.size() - kNumberOfLabelsToCheck); } while (labels.size() > 1) { std::string partial_skeleton = base::JoinString(labels, "".""); if (net::LookupStringInFixedSet( g_graph, g_graph_length, partial_skeleton.data(), partial_skeleton.length()) != net::kDafsaNotFound) return true; labels.erase(labels.begin()); } return false; } ",0 " explicit InterstitialHostObserver(RenderViewHost* rvh) : content::RenderViewHostObserver(rvh) {} ",0 " void VRDisplay::OnBlur() { display_blurred_ = true; vr_v_sync_provider_.reset(); navigator_vr_->EnqueueVREvent(VRDisplayEvent::Create( EventTypeNames::vrdisplayblur, true, false, this, """")); } ",1 "static int dcb_doit(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) { struct net *net = sock_net(skb->sk); struct net_device *netdev; struct dcbmsg *dcb = nlmsg_data(nlh); struct nlattr *tb[DCB_ATTR_MAX + 1]; u32 portid = skb ? NETLINK_CB(skb).portid : 0; int ret = -EINVAL; struct sk_buff *reply_skb; struct nlmsghdr *reply_nlh = NULL; const struct reply_func *fn; if ((nlh->nlmsg_type == RTM_SETDCB) && !capable(CAP_NET_ADMIN)) return -EPERM; ret = nlmsg_parse(nlh, sizeof(*dcb), tb, DCB_ATTR_MAX, dcbnl_rtnl_policy); if (ret < 0) return ret; if (dcb->cmd > DCB_CMD_MAX) return -EINVAL; /* check if a reply function has been defined for the command */ fn = &reply_funcs[dcb->cmd]; if (!fn->cb) return -EOPNOTSUPP; if (!tb[DCB_ATTR_IFNAME]) return -EINVAL; netdev = dev_get_by_name(net, nla_data(tb[DCB_ATTR_IFNAME])); if (!netdev) return -ENODEV; if (!netdev->dcbnl_ops) { ret = -EOPNOTSUPP; goto out; } reply_skb = dcbnl_newmsg(fn->type, dcb->cmd, portid, nlh->nlmsg_seq, nlh->nlmsg_flags, &reply_nlh); if (!reply_skb) { ret = -ENOBUFS; goto out; } ret = fn->cb(netdev, nlh, nlh->nlmsg_seq, tb, reply_skb); if (ret < 0) { nlmsg_free(reply_skb); goto out; } nlmsg_end(reply_skb, reply_nlh); ret = rtnl_unicast(reply_skb, net, portid); out: dev_put(netdev); return ret; } ",0 "static void hns_tx_timeout_reset(struct hns_nic_priv *priv) { /* Do the reset outside of interrupt context */ if (!test_bit(NIC_STATE_DOWN, &priv->state)) { set_bit(NIC_STATE2_RESET_REQUESTED, &priv->state); netdev_warn(priv->netdev, ""initiating reset due to tx timeout(%llu,0x%lx)\n"", priv->tx_timeout_count, priv->state); priv->tx_timeout_count++; hns_nic_task_schedule(priv); } } ",0 "static GLuint blit_get_frag_tex_writedepth(struct vrend_blitter_ctx *blit_ctx, int pipe_tex_target, unsigned nr_samples) { assert(pipe_tex_target < PIPE_MAX_TEXTURE_TYPES); if (nr_samples > 1) { GLuint *shader = &blit_ctx->fs_texfetch_depth_msaa[pipe_tex_target]; if (!*shader) { unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(pipe_tex_target, nr_samples); *shader = blit_build_frag_blit_msaa_depth(blit_ctx, tgsi_tex); } return *shader; } else { GLuint *shader = &blit_ctx->fs_texfetch_depth[pipe_tex_target]; if (!*shader) { unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(pipe_tex_target, 0); *shader = blit_build_frag_tex_writedepth(blit_ctx, tgsi_tex); } return *shader; } } ",0 "void V8TestObject::DoubleOrNullStringAttributeAttributeSetterCallback( const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_doubleOrNullStringAttribute_Setter""); v8::Local v8_value = info[0]; test_object_v8_internal::DoubleOrNullStringAttributeAttributeSetter(v8_value, info); } ",0 "static int add_del_listener(pid_t pid, const struct cpumask *mask, int isadd) { struct listener_list *listeners; struct listener *s, *tmp, *s2; unsigned int cpu; if (!cpumask_subset(mask, cpu_possible_mask)) return -EINVAL; if (isadd == REGISTER) { for_each_cpu(cpu, mask) { s = kmalloc_node(sizeof(struct listener), GFP_KERNEL, cpu_to_node(cpu)); if (!s) goto cleanup; s->pid = pid; s->valid = 1; listeners = &per_cpu(listener_array, cpu); down_write(&listeners->sem); list_for_each_entry(s2, &listeners->list, list) { if (s2->pid == pid && s2->valid) goto exists; } list_add(&s->list, &listeners->list); s = NULL; exists: up_write(&listeners->sem); kfree(s); /* nop if NULL */ } return 0; } /* Deregister or cleanup */ cleanup: for_each_cpu(cpu, mask) { listeners = &per_cpu(listener_array, cpu); down_write(&listeners->sem); list_for_each_entry_safe(s, tmp, &listeners->list, list) { if (s->pid == pid) { list_del(&s->list); kfree(s); break; } } up_write(&listeners->sem); } return 0; } ",0 " virtual void GetQuotaLimitHeuristics( QuotaLimitHeuristics* heuristics) const { heuristics->push_back(new TimedLimit(k2PerMinute, new Mapper())); } ",0 "void AutomationProvider::IsWindowMaximized(int handle, bool* is_maximized, bool* success) { *success = false; NOTIMPLEMENTED(); } ",0 "static void write_pmc(int idx, u64 val) { u64 shift, mask, pic; shift = 0; if (idx == PIC_UPPER_INDEX) shift = 32; mask = ((u64) 0xffffffff) << shift; val <<= shift; read_pic(pic); pic &= ~mask; pic |= val; write_pic(pic); } ",0 "RenderProcessHostPrivilege GetProcessPrivilege( content::RenderProcessHost* process_host, extensions::ProcessMap* process_map, ExtensionService* service) { std::set extension_ids = process_map->GetExtensionsInProcess(process_host->GetID()); if (extension_ids.empty()) return PRIV_NORMAL; for (std::set::iterator iter = extension_ids.begin(); iter != extension_ids.end(); ++iter) { const Extension* extension = service->GetExtensionById(*iter, false); if (extension && extension->is_storage_isolated()) return PRIV_ISOLATED; if (extension && extension->is_hosted_app()) return PRIV_HOSTED; } return PRIV_EXTENSION; } ",0 "static void assign_proto_idx(struct proto *prot) { prot->inuse_idx = find_first_zero_bit(proto_inuse_idx, PROTO_INUSE_NR); if (unlikely(prot->inuse_idx == PROTO_INUSE_NR - 1)) { printk(KERN_ERR ""PROTO_INUSE_NR exhausted\n""); return; } set_bit(prot->inuse_idx, proto_inuse_idx); } ",0 "static Browser_Window *browser_view_find(Evas_Object *view) { Eina_List *l; void *data; if (!view) return NULL; EINA_LIST_FOREACH(windows, l, data) { Browser_Window *browser_window = (Browser_Window *)data; if (browser_window->webview == view) return browser_window; } return NULL; } ",0 "static bool add_value_to_attrib(TALLOC_CTX *mem_ctx, struct ldb_val *value, struct ldb_message_element *attrib) { attrib->values = talloc_realloc(mem_ctx, attrib->values, DATA_BLOB, attrib->num_values+1); if (attrib->values == NULL) return false; attrib->values[attrib->num_values].data = talloc_steal(attrib->values, value->data); attrib->values[attrib->num_values].length = value->length; attrib->num_values += 1; return true; } ",0 "iperf_set_test_state(struct iperf_test *ipt, signed char state) { ipt->state = state; } ",0 "void PushMessagingServiceImpl::UnsubscribeBecausePermissionRevoked( const PushMessagingAppIdentifier& app_identifier, const UnregisterCallback& callback, const std::string& sender_id, bool success, bool not_found) { UnsubscribeInternal( content::mojom::PushUnregistrationReason::PERMISSION_REVOKED, app_identifier.origin(), app_identifier.service_worker_registration_id(), app_identifier.app_id(), sender_id, callback); } ",0 "run_cmd(int fd, ...) { pid_t pid; sigset_t sigm, sigm_old; /* block signals, let child establish its own handlers */ sigemptyset(&sigm); sigaddset(&sigm, SIGTERM); sigprocmask(SIG_BLOCK, &sigm, &sigm_old); pid = fork(); if ( pid < 0 ) { sigprocmask(SIG_SETMASK, &sigm_old, NULL); fd_printf(STO, ""*** cannot fork: %s ***\r\n"", strerror(errno)); return -1; } else if ( pid ) { /* father: picocom */ int status, r; /* reset the mask */ sigprocmask(SIG_SETMASK, &sigm_old, NULL); /* wait for child to finish */ do { r = waitpid(pid, &status, 0); } while ( r < 0 && errno == EINTR ); /* reset terminal (back to raw mode) */ term_apply(STI); /* check and report child return status */ if ( WIFEXITED(status) ) { fd_printf(STO, ""\r\n*** exit status: %d ***\r\n"", WEXITSTATUS(status)); return WEXITSTATUS(status); } else if ( WIFSIGNALED(status) ) { fd_printf(STO, ""\r\n*** killed by signal: %d ***\r\n"", WTERMSIG(status)); return -1; } else { fd_printf(STO, ""\r\n*** abnormal termination: 0x%x ***\r\n"", r); return -1; } } else { /* child: external program */ long fl; char cmd[512]; /* unmanage terminal, and reset it to canonical mode */ term_remove(STI); /* unmanage serial port fd, without reset */ term_erase(fd); /* set serial port fd to blocking mode */ fl = fcntl(fd, F_GETFL); fl &= ~O_NONBLOCK; fcntl(fd, F_SETFL, fl); /* connect stdin and stdout to serial port */ close(STI); close(STO); dup2(fd, STI); dup2(fd, STO); { /* build command-line */ char *c, *ce; const char *s; int n; va_list vls; strcpy(cmd, EXEC); c = &cmd[sizeof(EXEC)- 1]; ce = cmd + sizeof(cmd) - 1; va_start(vls, fd); while ( (s = va_arg(vls, const char *)) ) { n = strlen(s); if ( c + n + 1 >= ce ) break; memcpy(c, s, n); c += n; *c++ = ' '; } va_end(vls); *c = '\0'; } /* run extenral command */ fd_printf(STDERR_FILENO, ""%s\n"", &cmd[sizeof(EXEC) - 1]); establish_child_signal_handlers(); sigprocmask(SIG_SETMASK, &sigm_old, NULL); execl(""/bin/sh"", ""sh"", ""-c"", cmd, NULL); exit(42); } } ",1 "static OPJ_BOOL bmp_read_rle4_data(FILE* IN, OPJ_UINT8* pData, OPJ_UINT32 stride, OPJ_UINT32 width, OPJ_UINT32 height) { OPJ_UINT32 x, y; OPJ_UINT8 *pix; const OPJ_UINT8 *beyond; beyond = pData + stride * height; pix = pData; x = y = 0U; while (y < height) { int c = getc(IN); if (c == EOF) { break; } if (c) { /* encoded mode */ int j; OPJ_UINT8 c1 = (OPJ_UINT8)getc(IN); for (j = 0; (j < c) && (x < width) && ((OPJ_SIZE_T)pix < (OPJ_SIZE_T)beyond); j++, x++, pix++) { *pix = (OPJ_UINT8)((j & 1) ? (c1 & 0x0fU) : ((c1 >> 4) & 0x0fU)); } } else { /* absolute mode */ c = getc(IN); if (c == EOF) { break; } if (c == 0x00) { /* EOL */ x = 0; y++; pix = pData + y * stride; } else if (c == 0x01) { /* EOP */ break; } else if (c == 0x02) { /* MOVE by dxdy */ c = getc(IN); x += (OPJ_UINT32)c; c = getc(IN); y += (OPJ_UINT32)c; pix = pData + y * stride + x; } else { /* 03 .. 255 : absolute mode */ int j; OPJ_UINT8 c1 = 0U; for (j = 0; (j < c) && (x < width) && ((OPJ_SIZE_T)pix < (OPJ_SIZE_T)beyond); j++, x++, pix++) { if ((j & 1) == 0) { c1 = (OPJ_UINT8)getc(IN); } *pix = (OPJ_UINT8)((j & 1) ? (c1 & 0x0fU) : ((c1 >> 4) & 0x0fU)); } if (((c & 3) == 1) || ((c & 3) == 2)) { /* skip padding byte */ getc(IN); } } } } /* while(y < height) */ return OPJ_TRUE; } ",0 " gdImagePtr gdImageCreateFromJpeg (FILE * inFile) { return gdImageCreateFromJpegEx(inFile, 1); } ",0 "int UDPSocketWin::SendTo(IOBuffer* buf, int buf_len, const IPEndPoint& address, const CompletionCallback& callback) { return SendToOrWrite(buf, buf_len, &address, callback); } ",0 "void log_error_mesg_fatal(const char *file, int line, const char *func, const char *mesg) { int errno_save = errno; fprintf(stderr, ""%s%s:%d (%s) - "", get_commonlog_time(), file, line, func); errno = errno_save; perror(mesg); exit(EXIT_FAILURE); } ",0 " void free_descriptor_buffer(struct b43_dmaring *ring, struct b43_dmadesc_meta *meta) { if (meta->skb) { dev_kfree_skb_any(meta->skb); meta->skb = NULL; } } ",0 "static MagickBooleanType load_tile_rle(Image *image,Image *tile_image, XCFDocInfo *inDocInfo,XCFLayerInfo *inLayerInfo,size_t data_length, ExceptionInfo *exception) { MagickOffsetType size; Quantum alpha; register Quantum *q; size_t length; ssize_t bytes_per_pixel, count, i, j; unsigned char data, pixel, *xcfdata, *xcfodata, *xcfdatalimit; bytes_per_pixel=(ssize_t) inDocInfo->bytes_per_pixel; xcfdata=(unsigned char *) AcquireQuantumMemory(data_length,sizeof(*xcfdata)); if (xcfdata == (unsigned char *) NULL) ThrowBinaryException(ResourceLimitError,""MemoryAllocationFailed"", image->filename); xcfodata=xcfdata; count=ReadBlob(image, (size_t) data_length, xcfdata); xcfdatalimit = xcfodata+count-1; alpha=ScaleCharToQuantum((unsigned char) inLayerInfo->alpha); for (i=0; i < (ssize_t) bytes_per_pixel; i++) { q=GetAuthenticPixels(tile_image,0,0,tile_image->columns,tile_image->rows, exception); if (q == (Quantum *) NULL) continue; size=(MagickOffsetType) tile_image->rows*tile_image->columns; while (size > 0) { if (xcfdata > xcfdatalimit) goto bogus_rle; pixel=(*xcfdata++); length=(size_t) pixel; if (length >= 128) { length=255-(length-1); if (length == 128) { if (xcfdata >= xcfdatalimit) goto bogus_rle; length=(size_t) ((*xcfdata << 8) + xcfdata[1]); xcfdata+=2; } size-=length; if (size < 0) goto bogus_rle; if (&xcfdata[length-1] > xcfdatalimit) goto bogus_rle; while (length-- > 0) { data=(*xcfdata++); switch (i) { case 0: { if (inDocInfo->image_type == GIMP_GRAY) SetPixelGray(tile_image,ScaleCharToQuantum(data),q); else { SetPixelRed(tile_image,ScaleCharToQuantum(data),q); SetPixelGreen(tile_image,ScaleCharToQuantum(data),q); SetPixelBlue(tile_image,ScaleCharToQuantum(data),q); } SetPixelAlpha(tile_image,alpha,q); break; } case 1: { if (inDocInfo->image_type == GIMP_GRAY) SetPixelAlpha(tile_image,ScaleCharToQuantum(data),q); else SetPixelGreen(tile_image,ScaleCharToQuantum(data),q); break; } case 2: { SetPixelBlue(tile_image,ScaleCharToQuantum(data),q); break; } case 3: { SetPixelAlpha(tile_image,ScaleCharToQuantum(data),q); break; } } q+=GetPixelChannels(tile_image); } } else { length+=1; if (length == 128) { if (xcfdata >= xcfdatalimit) goto bogus_rle; length=(size_t) ((*xcfdata << 8) + xcfdata[1]); xcfdata+=2; } size-=length; if (size < 0) goto bogus_rle; if (xcfdata > xcfdatalimit) goto bogus_rle; pixel=(*xcfdata++); for (j=0; j < (ssize_t) length; j++) { data=pixel; switch (i) { case 0: { if (inDocInfo->image_type == GIMP_GRAY) SetPixelGray(tile_image,ScaleCharToQuantum(data),q); else { SetPixelRed(tile_image,ScaleCharToQuantum(data),q); SetPixelGreen(tile_image,ScaleCharToQuantum(data),q); SetPixelBlue(tile_image,ScaleCharToQuantum(data),q); } SetPixelAlpha(tile_image,alpha,q); break; } case 1: { if (inDocInfo->image_type == GIMP_GRAY) SetPixelAlpha(tile_image,ScaleCharToQuantum(data),q); else SetPixelGreen(tile_image,ScaleCharToQuantum(data),q); break; } case 2: { SetPixelBlue(tile_image,ScaleCharToQuantum(data),q); break; } case 3: { SetPixelAlpha(tile_image,ScaleCharToQuantum(data),q); break; } } q+=GetPixelChannels(tile_image); } } } if (SyncAuthenticPixels(tile_image,exception) == MagickFalse) break; } xcfodata=(unsigned char *) RelinquishMagickMemory(xcfodata); return(MagickTrue); bogus_rle: if (xcfodata != (unsigned char *) NULL) xcfodata=(unsigned char *) RelinquishMagickMemory(xcfodata); return(MagickFalse); } ",0 "void V8TestObject::ReflectedIdAttributeSetterCallback( const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_reflectedId_Setter""); v8::Local v8_value = info[0]; test_object_v8_internal::ReflectedIdAttributeSetter(v8_value, info); } ",0 "static noinline int insert_inline_extent(struct btrfs_trans_handle *trans, struct btrfs_root *root, struct inode *inode, u64 start, size_t size, size_t compressed_size, int compress_type, struct page **compressed_pages) { struct btrfs_key key; struct btrfs_path *path; struct extent_buffer *leaf; struct page *page = NULL; char *kaddr; unsigned long ptr; struct btrfs_file_extent_item *ei; int err = 0; int ret; size_t cur_size = size; size_t datasize; unsigned long offset; if (compressed_size && compressed_pages) cur_size = compressed_size; path = btrfs_alloc_path(); if (!path) return -ENOMEM; path->leave_spinning = 1; key.objectid = btrfs_ino(inode); key.offset = start; btrfs_set_key_type(&key, BTRFS_EXTENT_DATA_KEY); datasize = btrfs_file_extent_calc_inline_size(cur_size); inode_add_bytes(inode, size); ret = btrfs_insert_empty_item(trans, root, path, &key, datasize); if (ret) { err = ret; goto fail; } leaf = path->nodes[0]; ei = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_file_extent_item); btrfs_set_file_extent_generation(leaf, ei, trans->transid); btrfs_set_file_extent_type(leaf, ei, BTRFS_FILE_EXTENT_INLINE); btrfs_set_file_extent_encryption(leaf, ei, 0); btrfs_set_file_extent_other_encoding(leaf, ei, 0); btrfs_set_file_extent_ram_bytes(leaf, ei, size); ptr = btrfs_file_extent_inline_start(ei); if (compress_type != BTRFS_COMPRESS_NONE) { struct page *cpage; int i = 0; while (compressed_size > 0) { cpage = compressed_pages[i]; cur_size = min_t(unsigned long, compressed_size, PAGE_CACHE_SIZE); kaddr = kmap_atomic(cpage); write_extent_buffer(leaf, kaddr, ptr, cur_size); kunmap_atomic(kaddr); i++; ptr += cur_size; compressed_size -= cur_size; } btrfs_set_file_extent_compression(leaf, ei, compress_type); } else { page = find_get_page(inode->i_mapping, start >> PAGE_CACHE_SHIFT); btrfs_set_file_extent_compression(leaf, ei, 0); kaddr = kmap_atomic(page); offset = start & (PAGE_CACHE_SIZE - 1); write_extent_buffer(leaf, kaddr + offset, ptr, size); kunmap_atomic(kaddr); page_cache_release(page); } btrfs_mark_buffer_dirty(leaf); btrfs_free_path(path); /* * we're an inline extent, so nobody can * extend the file past i_size without locking * a page we already have locked. * * We must do any isize and inode updates * before we unlock the pages. Otherwise we * could end up racing with unlink. */ BTRFS_I(inode)->disk_i_size = inode->i_size; ret = btrfs_update_inode(trans, root, inode); return ret; fail: btrfs_free_path(path); return err; } ",0 "void V8TestObject::StringOrNullAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_stringOrNullAttribute_Getter""); test_object_v8_internal::StringOrNullAttributeAttributeGetter(info); } ",0 "PHP_METHOD(Phar, setSignatureAlgorithm) { long algo; char *error, *key = NULL; int key_len = 0; PHAR_ARCHIVE_OBJECT(); if (PHAR_G(readonly) && !phar_obj->arc.archive->is_data) { zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, ""Cannot set signature algorithm, phar is read-only""); return; } if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, ""l|s"", &algo, &key, &key_len) != SUCCESS) { return; } switch (algo) { case PHAR_SIG_SHA256: case PHAR_SIG_SHA512: #ifndef PHAR_HASH_OK zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, ""SHA-256 and SHA-512 signatures are only supported if the hash extension is enabled and built non-shared""); return; #endif case PHAR_SIG_MD5: case PHAR_SIG_SHA1: case PHAR_SIG_OPENSSL: if (phar_obj->arc.archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->arc.archive) TSRMLS_CC)) { zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, ""phar \""%s\"" is persistent, unable to copy on write"", phar_obj->arc.archive->fname); return; } phar_obj->arc.archive->sig_flags = algo; phar_obj->arc.archive->is_modified = 1; PHAR_G(openssl_privatekey) = key; PHAR_G(openssl_privatekey_len) = key_len; phar_flush(phar_obj->arc.archive, 0, 0, 0, &error TSRMLS_CC); if (error) { zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, ""%s"", error); efree(error); } break; default: zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, ""Unknown signature algorithm specified""); } } ",0 "static void t1_putline(void) { char *p = t1_line_array; if (t1_line_ptr - t1_line_array <= 1) return; if (t1_eexec_encrypt) { while (p < t1_line_ptr) t1_outhex(eencrypt(*p++)); /* dvips outputs hex, unlike pdftex */ } else while (p < t1_line_ptr) t1_putchar(*p++); } ",0 "static void svm_cache_reg(struct kvm_vcpu *vcpu, enum kvm_reg reg) { switch (reg) { case VCPU_EXREG_PDPTR: BUG_ON(!npt_enabled); load_pdptrs(vcpu, vcpu->arch.walk_mmu, kvm_read_cr3(vcpu)); break; default: BUG(); } } ",0 "int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) { struct page *page; struct kvm *kvm; int r; BUG_ON(vcpu->kvm == NULL); kvm = vcpu->kvm; vcpu->arch.pv.pv_unhalted = false; vcpu->arch.emulate_ctxt.ops = &emulate_ops; if (!irqchip_in_kernel(kvm) || kvm_vcpu_is_bsp(vcpu)) vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE; else vcpu->arch.mp_state = KVM_MP_STATE_UNINITIALIZED; page = alloc_page(GFP_KERNEL | __GFP_ZERO); if (!page) { r = -ENOMEM; goto fail; } vcpu->arch.pio_data = page_address(page); kvm_set_tsc_khz(vcpu, max_tsc_khz); r = kvm_mmu_create(vcpu); if (r < 0) goto fail_free_pio_data; if (irqchip_in_kernel(kvm)) { r = kvm_create_lapic(vcpu); if (r < 0) goto fail_mmu_destroy; } else static_key_slow_inc(&kvm_no_apic_vcpu); vcpu->arch.mce_banks = kzalloc(KVM_MAX_MCE_BANKS * sizeof(u64) * 4, GFP_KERNEL); if (!vcpu->arch.mce_banks) { r = -ENOMEM; goto fail_free_lapic; } vcpu->arch.mcg_cap = KVM_MAX_MCE_BANKS; if (!zalloc_cpumask_var(&vcpu->arch.wbinvd_dirty_mask, GFP_KERNEL)) { r = -ENOMEM; goto fail_free_mce_banks; } r = fx_init(vcpu); if (r) goto fail_free_wbinvd_dirty_mask; vcpu->arch.ia32_tsc_adjust_msr = 0x0; vcpu->arch.pv_time_enabled = false; vcpu->arch.guest_supported_xcr0 = 0; vcpu->arch.guest_xstate_size = XSAVE_HDR_SIZE + XSAVE_HDR_OFFSET; kvm_async_pf_hash_reset(vcpu); kvm_pmu_init(vcpu); return 0; fail_free_wbinvd_dirty_mask: free_cpumask_var(vcpu->arch.wbinvd_dirty_mask); fail_free_mce_banks: kfree(vcpu->arch.mce_banks); fail_free_lapic: kvm_free_lapic(vcpu); fail_mmu_destroy: kvm_mmu_destroy(vcpu); fail_free_pio_data: free_page((unsigned long)vcpu->arch.pio_data); fail: return r; } ",0 "error::Error GLES2DecoderImpl::GetUniformLocationHelper( GLuint client_id, uint32 location_shm_id, uint32 location_shm_offset, const std::string& name_str) { if (!StringIsValidForGLES(name_str.c_str())) { SetGLError(GL_INVALID_VALUE, ""glGetUniformLocation: Invalid character""); return error::kNoError; } ProgramManager::ProgramInfo* info = GetProgramInfoNotShader( client_id, ""glUniformLocation""); if (!info) { return error::kNoError; } if (!info->IsValid()) { SetGLError(GL_INVALID_OPERATION, ""glGetUniformLocation: program not linked""); return error::kNoError; } GLint* location = GetSharedMemoryAs( location_shm_id, location_shm_offset, sizeof(GLint)); if (!location) { return error::kOutOfBounds; } if (*location != -1) { return error::kGenericError; } *location = program_manager()->SwizzleLocation( info->GetUniformFakeLocation(name_str)); return error::kNoError; } ",0 "sg_common_write(Sg_fd * sfp, Sg_request * srp, unsigned char *cmnd, int timeout, int blocking) { int k, at_head; Sg_device *sdp = sfp->parentdp; sg_io_hdr_t *hp = &srp->header; srp->data.cmd_opcode = cmnd[0]; /* hold opcode of command */ hp->status = 0; hp->masked_status = 0; hp->msg_status = 0; hp->info = 0; hp->host_status = 0; hp->driver_status = 0; hp->resid = 0; SCSI_LOG_TIMEOUT(4, sg_printk(KERN_INFO, sfp->parentdp, ""sg_common_write: scsi opcode=0x%02x, cmd_size=%d\n"", (int) cmnd[0], (int) hp->cmd_len)); k = sg_start_req(srp, cmnd); if (k) { SCSI_LOG_TIMEOUT(1, sg_printk(KERN_INFO, sfp->parentdp, ""sg_common_write: start_req err=%d\n"", k)); sg_finish_rem_req(srp); return k; /* probably out of space --> ENOMEM */ } if (atomic_read(&sdp->detaching)) { if (srp->bio) blk_end_request_all(srp->rq, -EIO); sg_finish_rem_req(srp); return -ENODEV; } hp->duration = jiffies_to_msecs(jiffies); if (hp->interface_id != '\0' && /* v3 (or later) interface */ (SG_FLAG_Q_AT_TAIL & hp->flags)) at_head = 0; else at_head = 1; srp->rq->timeout = timeout; kref_get(&sfp->f_ref); /* sg_rq_end_io() does kref_put(). */ blk_execute_rq_nowait(sdp->device->request_queue, sdp->disk, srp->rq, at_head, sg_rq_end_io); return 0; } ",1 "static int unix_release(struct socket *sock) { struct sock *sk = sock->sk; if (!sk) return 0; unix_release_sock(sk, 0); sock->sk = NULL; return 0; } ",0 "void PasswordAutofillAgent::OnFillPasswordForm( int key, const PasswordFormFillData& form_data) { std::unique_ptr logger; if (logging_state_active_) { logger.reset(new RendererSavePasswordProgressLogger(this, routing_id())); logger->LogMessage(Logger::STRING_ON_FILL_PASSWORD_FORM_METHOD); } bool ambiguous_or_empty_names = DoesFormContainAmbiguousOrEmptyNames(form_data); FormElementsList forms; FindFormElements(render_frame(), form_data, ambiguous_or_empty_names, &forms); if (logger) { logger->LogBoolean(Logger::STRING_AMBIGUOUS_OR_EMPTY_NAMES, ambiguous_or_empty_names); logger->LogNumber(Logger::STRING_NUMBER_OF_POTENTIAL_FORMS_TO_FILL, forms.size()); logger->LogBoolean(Logger::STRING_FORM_DATA_WAIT, form_data.wait_for_username); } for (const auto& form : forms) { base::string16 username_field_name; base::string16 password_field_name = FieldName(form_data.password_field, ambiguous_or_empty_names); bool form_contains_fillable_username_field = FillDataContainsFillableUsername(form_data); if (form_contains_fillable_username_field) { username_field_name = FieldName(form_data.username_field, ambiguous_or_empty_names); } if (logger) { logger->LogBoolean(Logger::STRING_CONTAINS_FILLABLE_USERNAME_FIELD, form_contains_fillable_username_field); logger->LogBoolean(Logger::STRING_USERNAME_FIELD_NAME_EMPTY, username_field_name.empty()); logger->LogBoolean(Logger::STRING_PASSWORD_FIELD_NAME_EMPTY, password_field_name.empty()); } blink::WebInputElement username_element; blink::WebInputElement password_element; if (!username_field_name.empty()) { const auto it = form.find(username_field_name); DCHECK(it != form.end()); username_element = it->second; } if (password_field_name.empty()) break; { const auto it = form.find(password_field_name); DCHECK(it != form.end()); password_element = it->second; } blink::WebInputElement main_element = username_element.isNull() ? password_element : username_element; if (web_input_to_password_info_.find(main_element) != web_input_to_password_info_.end()) continue; if (!form_data.wait_for_username) { FillFormOnPasswordReceived( form_data, username_element, password_element, &nonscript_modified_values_, base::Bind(&PasswordValueGatekeeper::RegisterElement, base::Unretained(&gatekeeper_)), logger.get()); } PasswordInfo password_info; password_info.fill_data = form_data; password_info.key = key; password_info.password_field = password_element; web_input_to_password_info_[main_element] = password_info; if (!main_element.isPasswordField()) password_to_username_[password_element] = username_element; } } ",0 "static int pfkey_sockaddr_pair_size(sa_family_t family) { return PFKEY_ALIGN8(pfkey_sockaddr_len(family) * 2); } ",0 "int ping_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, size_t len, int noblock, int flags, int *addr_len) { struct inet_sock *isk = inet_sk(sk); int family = sk->sk_family; struct sockaddr_in *sin; struct sockaddr_in6 *sin6; struct sk_buff *skb; int copied, err; pr_debug(""ping_recvmsg(sk=%p,sk->num=%u)\n"", isk, isk->inet_num); err = -EOPNOTSUPP; if (flags & MSG_OOB) goto out; if (addr_len) { if (family == AF_INET) *addr_len = sizeof(*sin); else if (family == AF_INET6 && addr_len) *addr_len = sizeof(*sin6); } if (flags & MSG_ERRQUEUE) { if (family == AF_INET) { return ip_recv_error(sk, msg, len); #if IS_ENABLED(CONFIG_IPV6) } else if (family == AF_INET6) { return pingv6_ops.ipv6_recv_error(sk, msg, len); #endif } } skb = skb_recv_datagram(sk, flags, noblock, &err); if (!skb) goto out; copied = skb->len; if (copied > len) { msg->msg_flags |= MSG_TRUNC; copied = len; } /* Don't bother checking the checksum */ err = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied); if (err) goto done; sock_recv_timestamp(msg, sk, skb); /* Copy the address and add cmsg data. */ if (family == AF_INET) { sin = (struct sockaddr_in *) msg->msg_name; sin->sin_family = AF_INET; sin->sin_port = 0 /* skb->h.uh->source */; sin->sin_addr.s_addr = ip_hdr(skb)->saddr; memset(sin->sin_zero, 0, sizeof(sin->sin_zero)); if (isk->cmsg_flags) ip_cmsg_recv(msg, skb); #if IS_ENABLED(CONFIG_IPV6) } else if (family == AF_INET6) { struct ipv6_pinfo *np = inet6_sk(sk); struct ipv6hdr *ip6 = ipv6_hdr(skb); sin6 = (struct sockaddr_in6 *) msg->msg_name; sin6->sin6_family = AF_INET6; sin6->sin6_port = 0; sin6->sin6_addr = ip6->saddr; sin6->sin6_flowinfo = 0; if (np->sndflow) sin6->sin6_flowinfo = ip6_flowinfo(ip6); sin6->sin6_scope_id = ipv6_iface_scope_id(&sin6->sin6_addr, IP6CB(skb)->iif); if (inet6_sk(sk)->rxopt.all) pingv6_ops.ip6_datagram_recv_ctl(sk, msg, skb); #endif } else { BUG(); } err = copied; done: skb_free_datagram(sk, skb); out: pr_debug(""ping_recvmsg -> %d\n"", err); return err; } ",1 "static int rawv6_ioctl(struct sock *sk, int cmd, unsigned long arg) { switch (cmd) { case SIOCOUTQ: { int amount = sk_wmem_alloc_get(sk); return put_user(amount, (int __user *)arg); } case SIOCINQ: { struct sk_buff *skb; int amount = 0; spin_lock_bh(&sk->sk_receive_queue.lock); skb = skb_peek(&sk->sk_receive_queue); if (skb) amount = skb_tail_pointer(skb) - skb_transport_header(skb); spin_unlock_bh(&sk->sk_receive_queue.lock); return put_user(amount, (int __user *)arg); } default: #ifdef CONFIG_IPV6_MROUTE return ip6mr_ioctl(sk, cmd, (void __user *)arg); #else return -ENOIOCTLCMD; #endif } } ",0 "bool BaseAudioContext::AreAutoplayRequirementsFulfilled() const { switch (GetAutoplayPolicy()) { case AutoplayPolicy::Type::kNoUserGestureRequired: return true; case AutoplayPolicy::Type::kUserGestureRequired: case AutoplayPolicy::Type::kUserGestureRequiredForCrossOrigin: return Frame::HasTransientUserActivation( GetDocument() ? GetDocument()->GetFrame() : nullptr); case AutoplayPolicy::Type::kDocumentUserActivationRequired: return AutoplayPolicy::IsDocumentAllowedToPlay(*GetDocument()); } NOTREACHED(); return false; } ",0 "JSValue jsTestSerializedScriptValueInterfaceReadonlyValue(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestSerializedScriptValueInterface* castedThis = jsCast(asObject(slotBase)); UNUSED_PARAM(exec); TestSerializedScriptValueInterface* impl = static_cast(castedThis->impl()); JSValue result = impl->readonlyValue() ? impl->readonlyValue()->deserialize(exec, castedThis->globalObject(), 0) : jsNull(); return result; } ",0 "double HTMLMediaElement::OfficialPlaybackPosition() const { bool waiting_for_data = ready_state_ <= kHaveCurrentData; if (official_playback_position_needs_update_ && !paused_ && !waiting_for_data) { SetOfficialPlaybackPosition(CurrentPlaybackPosition()); } #if LOG_OFFICIAL_TIME_STATUS static const double kMinCachedDeltaForWarning = 0.01; double delta = std::abs(official_playback_position_ - CurrentPlaybackPosition()); if (delta > kMinCachedDeltaForWarning) { BLINK_MEDIA_LOG << ""CurrentTime("" << (void*)this << "") - WARNING, cached time is "" << delta << ""seconds off of media time when paused/waiting""; } #endif return official_playback_position_; } ",0 "write_xml_file(xmlNode * xml_node, const char *filename, gboolean compress) { FILE *stream = NULL; stream = fopen(filename, ""w""); return write_xml_stream(xml_node, filename, stream, compress); } ",0 "void WebRuntimeFeatures::EnableSecMetadata(bool enable) { RuntimeEnabledFeatures::SetSecMetadataEnabled(enable); } ",0 " FakeWindowEventDispatcher(aura::WindowTreeHost* host) : WindowEventDispatcher(host, true), processed_touch_event_count_(0) {} ",0 "static int setup_netdev(struct lxc_netdev *netdev) { char ifname[IFNAMSIZ]; char *current_ifname = ifname; int err; /* empty network namespace */ if (!netdev->ifindex) { if (netdev->flags & IFF_UP) { err = lxc_netdev_up(""lo""); if (err) { ERROR(""failed to set the loopback up : %s"", strerror(-err)); return -1; } } if (netdev->type != LXC_NET_VETH) return 0; netdev->ifindex = if_nametoindex(netdev->name); } /* get the new ifindex in case of physical netdev */ if (netdev->type == LXC_NET_PHYS) { if (!(netdev->ifindex = if_nametoindex(netdev->link))) { ERROR(""failed to get ifindex for %s"", netdev->link); return -1; } } /* retrieve the name of the interface */ if (!if_indextoname(netdev->ifindex, current_ifname)) { ERROR(""no interface corresponding to index '%d'"", netdev->ifindex); return -1; } /* default: let the system to choose one interface name */ if (!netdev->name) netdev->name = netdev->type == LXC_NET_PHYS ? netdev->link : ""eth%d""; /* rename the interface name */ if (strcmp(ifname, netdev->name) != 0) { err = lxc_netdev_rename_by_name(ifname, netdev->name); if (err) { ERROR(""failed to rename %s->%s : %s"", ifname, netdev->name, strerror(-err)); return -1; } } /* Re-read the name of the interface because its name has changed * and would be automatically allocated by the system */ if (!if_indextoname(netdev->ifindex, current_ifname)) { ERROR(""no interface corresponding to index '%d'"", netdev->ifindex); return -1; } /* set a mac address */ if (netdev->hwaddr) { if (setup_hw_addr(netdev->hwaddr, current_ifname)) { ERROR(""failed to setup hw address for '%s'"", current_ifname); return -1; } } /* setup ipv4 addresses on the interface */ if (setup_ipv4_addr(&netdev->ipv4, netdev->ifindex)) { ERROR(""failed to setup ip addresses for '%s'"", ifname); return -1; } /* setup ipv6 addresses on the interface */ if (setup_ipv6_addr(&netdev->ipv6, netdev->ifindex)) { ERROR(""failed to setup ipv6 addresses for '%s'"", ifname); return -1; } /* set the network device up */ if (netdev->flags & IFF_UP) { int err; err = lxc_netdev_up(current_ifname); if (err) { ERROR(""failed to set '%s' up : %s"", current_ifname, strerror(-err)); return -1; } /* the network is up, make the loopback up too */ err = lxc_netdev_up(""lo""); if (err) { ERROR(""failed to set the loopback up : %s"", strerror(-err)); return -1; } } /* We can only set up the default routes after bringing * up the interface, sine bringing up the interface adds * the link-local routes and we can't add a default * route if the gateway is not reachable. */ /* setup ipv4 gateway on the interface */ if (netdev->ipv4_gateway) { if (!(netdev->flags & IFF_UP)) { ERROR(""Cannot add ipv4 gateway for %s when not bringing up the interface"", ifname); return -1; } if (lxc_list_empty(&netdev->ipv4)) { ERROR(""Cannot add ipv4 gateway for %s when not assigning an address"", ifname); return -1; } err = lxc_ipv4_gateway_add(netdev->ifindex, netdev->ipv4_gateway); if (err) { err = lxc_ipv4_dest_add(netdev->ifindex, netdev->ipv4_gateway); if (err) { ERROR(""failed to add ipv4 dest for '%s': %s"", ifname, strerror(-err)); } err = lxc_ipv4_gateway_add(netdev->ifindex, netdev->ipv4_gateway); if (err) { ERROR(""failed to setup ipv4 gateway for '%s': %s"", ifname, strerror(-err)); if (netdev->ipv4_gateway_auto) { char buf[INET_ADDRSTRLEN]; inet_ntop(AF_INET, netdev->ipv4_gateway, buf, sizeof(buf)); ERROR(""tried to set autodetected ipv4 gateway '%s'"", buf); } return -1; } } } /* setup ipv6 gateway on the interface */ if (netdev->ipv6_gateway) { if (!(netdev->flags & IFF_UP)) { ERROR(""Cannot add ipv6 gateway for %s when not bringing up the interface"", ifname); return -1; } if (lxc_list_empty(&netdev->ipv6) && !IN6_IS_ADDR_LINKLOCAL(netdev->ipv6_gateway)) { ERROR(""Cannot add ipv6 gateway for %s when not assigning an address"", ifname); return -1; } err = lxc_ipv6_gateway_add(netdev->ifindex, netdev->ipv6_gateway); if (err) { err = lxc_ipv6_dest_add(netdev->ifindex, netdev->ipv6_gateway); if (err) { ERROR(""failed to add ipv6 dest for '%s': %s"", ifname, strerror(-err)); } err = lxc_ipv6_gateway_add(netdev->ifindex, netdev->ipv6_gateway); if (err) { ERROR(""failed to setup ipv6 gateway for '%s': %s"", ifname, strerror(-err)); if (netdev->ipv6_gateway_auto) { char buf[INET6_ADDRSTRLEN]; inet_ntop(AF_INET6, netdev->ipv6_gateway, buf, sizeof(buf)); ERROR(""tried to set autodetected ipv6 gateway '%s'"", buf); } return -1; } } } DEBUG(""'%s' has been setup"", current_ifname); return 0; } ",0 "static int __init crypto_xcbc_module_init(void) { return crypto_register_template(&crypto_xcbc_tmpl); } ",0 "ModuleExport size_t RegisterBGRImage(void) { MagickInfo *entry; entry=SetMagickInfo(""BGR""); entry->decoder=(DecodeImageHandler *) ReadBGRImage; entry->encoder=(EncodeImageHandler *) WriteBGRImage; entry->raw=MagickTrue; entry->endian_support=MagickTrue; entry->description=ConstantString(""Raw blue, green, and red samples""); entry->module=ConstantString(""BGR""); (void) RegisterMagickInfo(entry); entry=SetMagickInfo(""BGRA""); entry->decoder=(DecodeImageHandler *) ReadBGRImage; entry->encoder=(EncodeImageHandler *) WriteBGRImage; entry->raw=MagickTrue; entry->endian_support=MagickTrue; entry->description=ConstantString(""Raw blue, green, red, and alpha samples""); entry->module=ConstantString(""BGR""); (void) RegisterMagickInfo(entry); return(MagickImageCoderSignature); } ",0 "static void stream_blob(uintmax_t len, unsigned char *sha1out, uintmax_t mark) { size_t in_sz = 64 * 1024, out_sz = 64 * 1024; unsigned char *in_buf = xmalloc(in_sz); unsigned char *out_buf = xmalloc(out_sz); struct object_entry *e; unsigned char sha1[20]; unsigned long hdrlen; off_t offset; git_SHA_CTX c; git_zstream s; struct sha1file_checkpoint checkpoint; int status = Z_OK; /* Determine if we should auto-checkpoint. */ if ((max_packsize && (pack_size + 60 + len) > max_packsize) || (pack_size + 60 + len) < pack_size) cycle_packfile(); sha1file_checkpoint(pack_file, &checkpoint); offset = checkpoint.offset; hdrlen = snprintf((char *)out_buf, out_sz, ""blob %"" PRIuMAX, len) + 1; if (out_sz <= hdrlen) die(""impossibly large object header""); git_SHA1_Init(&c); git_SHA1_Update(&c, out_buf, hdrlen); crc32_begin(pack_file); git_deflate_init(&s, pack_compression_level); hdrlen = encode_in_pack_object_header(OBJ_BLOB, len, out_buf); if (out_sz <= hdrlen) die(""impossibly large object header""); s.next_out = out_buf + hdrlen; s.avail_out = out_sz - hdrlen; while (status != Z_STREAM_END) { if (0 < len && !s.avail_in) { size_t cnt = in_sz < len ? in_sz : (size_t)len; size_t n = fread(in_buf, 1, cnt, stdin); if (!n && feof(stdin)) die(""EOF in data (%"" PRIuMAX "" bytes remaining)"", len); git_SHA1_Update(&c, in_buf, n); s.next_in = in_buf; s.avail_in = n; len -= n; } status = git_deflate(&s, len ? 0 : Z_FINISH); if (!s.avail_out || status == Z_STREAM_END) { size_t n = s.next_out - out_buf; sha1write(pack_file, out_buf, n); pack_size += n; s.next_out = out_buf; s.avail_out = out_sz; } switch (status) { case Z_OK: case Z_BUF_ERROR: case Z_STREAM_END: continue; default: die(""unexpected deflate failure: %d"", status); } } git_deflate_end(&s); git_SHA1_Final(sha1, &c); if (sha1out) hashcpy(sha1out, sha1); e = insert_object(sha1); if (mark) insert_mark(mark, e); if (e->idx.offset) { duplicate_count_by_type[OBJ_BLOB]++; truncate_pack(&checkpoint); } else if (find_sha1_pack(sha1, packed_git)) { e->type = OBJ_BLOB; e->pack_id = MAX_PACK_ID; e->idx.offset = 1; /* just not zero! */ duplicate_count_by_type[OBJ_BLOB]++; truncate_pack(&checkpoint); } else { e->depth = 0; e->type = OBJ_BLOB; e->pack_id = pack_id; e->idx.offset = offset; e->idx.crc32 = crc32_end(pack_file); object_count++; object_count_by_type[OBJ_BLOB]++; } free(in_buf); free(out_buf); } ",0 "int ssl3_setup_read_buffer(SSL *s) { unsigned char *p; size_t len,align=0,headerlen; if (SSL_version(s) == DTLS1_VERSION || SSL_version(s) == DTLS1_BAD_VER) headerlen = DTLS1_RT_HEADER_LENGTH; else headerlen = SSL3_RT_HEADER_LENGTH; #if defined(SSL3_ALIGN_PAYLOAD) && SSL3_ALIGN_PAYLOAD!=0 align = (-SSL3_RT_HEADER_LENGTH)&(SSL3_ALIGN_PAYLOAD-1); #endif if (s->s3->rbuf.buf == NULL) { len = SSL3_RT_MAX_PLAIN_LENGTH + SSL3_RT_MAX_ENCRYPTED_OVERHEAD + headerlen + align; if (s->options & SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER) { s->s3->init_extra = 1; len += SSL3_RT_MAX_EXTRA; } #ifndef OPENSSL_NO_COMP if (!(s->options & SSL_OP_NO_COMPRESSION)) len += SSL3_RT_MAX_COMPRESSED_OVERHEAD; #endif if ((p=freelist_extract(s->ctx, 1, len)) == NULL) goto err; s->s3->rbuf.buf = p; s->s3->rbuf.len = len; } s->packet= &(s->s3->rbuf.buf[0]); return 1; err: SSLerr(SSL_F_SSL3_SETUP_READ_BUFFER,ERR_R_MALLOC_FAILURE); return 0; } ",0 "mrb_yield_with_class(mrb_state *mrb, mrb_value b, mrb_int argc, const mrb_value *argv, mrb_value self, struct RClass *c) { struct RProc *p; mrb_sym mid = mrb->c->ci->mid; mrb_callinfo *ci; int n = mrb->c->ci->nregs; mrb_value val; if (mrb_nil_p(b)) { mrb_raise(mrb, E_ARGUMENT_ERROR, ""no block given""); } if (mrb->c->ci - mrb->c->cibase > MRB_FUNCALL_DEPTH_MAX) { mrb_exc_raise(mrb, mrb_obj_value(mrb->stack_err)); } p = mrb_proc_ptr(b); ci = cipush(mrb); ci->mid = mid; ci->proc = p; ci->stackent = mrb->c->stack; ci->argc = (int)argc; ci->target_class = c; ci->acc = CI_ACC_SKIP; mrb->c->stack = mrb->c->stack + n; ci->nregs = MRB_PROC_CFUNC_P(p) ? (int)(argc+2) : p->body.irep->nregs; stack_extend(mrb, ci->nregs); mrb->c->stack[0] = self; if (argc > 0) { stack_copy(mrb->c->stack+1, argv, argc); } mrb->c->stack[argc+1] = mrb_nil_value(); if (MRB_PROC_CFUNC_P(p)) { val = MRB_PROC_CFUNC(p)(mrb, self); mrb->c->stack = mrb->c->ci->stackent; cipop(mrb); } else { val = mrb_run(mrb, p, self); } return val; } ",0 "void ImageInputType::ensureFallbackContent() { if (m_useFallbackContent) return; setUseFallbackContent(); reattachFallbackContent(); } ",0 "void UrlFetcherDownloader::CreateDownloadDir() { base::CreateNewTempDirectory(FILE_PATH_LITERAL(""chrome_url_fetcher_""), &download_dir_); } ",0 "nfsd4_decode_copy(struct nfsd4_compoundargs *argp, struct nfsd4_copy *copy) { DECODE_HEAD; unsigned int tmp; status = nfsd4_decode_stateid(argp, ©->cp_src_stateid); if (status) return status; status = nfsd4_decode_stateid(argp, ©->cp_dst_stateid); if (status) return status; READ_BUF(8 + 8 + 8 + 4 + 4 + 4); p = xdr_decode_hyper(p, ©->cp_src_pos); p = xdr_decode_hyper(p, ©->cp_dst_pos); p = xdr_decode_hyper(p, ©->cp_count); copy->cp_consecutive = be32_to_cpup(p++); copy->cp_synchronous = be32_to_cpup(p++); tmp = be32_to_cpup(p); /* Source server list not supported */ DECODE_TAIL; } ",0 "void ConvertYUVToRGB32(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, uint8* rgb_buf, int width, int height, int y_pitch, int uv_pitch, int rgb_pitch, YUVType yuv_type) { unsigned int y_shift = yuv_type; for (int y = 0; y < height; ++y) { uint8* rgb_row = rgb_buf + y * rgb_pitch; const uint8* y_ptr = y_buf + y * y_pitch; const uint8* u_ptr = u_buf + (y >> y_shift) * uv_pitch; const uint8* v_ptr = v_buf + (y >> y_shift) * uv_pitch; FastConvertYUVToRGB32Row(y_ptr, u_ptr, v_ptr, rgb_row, width); } EMMS(); } ",0 "void DataPipeProducerDispatcher::NotifyWrite(uint32_t num_bytes) { DVLOG(1) << ""Data pipe producer "" << pipe_id_ << "" notifying peer: "" << num_bytes << "" bytes written. [control_port="" << control_port_.name() << ""]""; SendDataPipeControlMessage(node_controller_, control_port_, DataPipeCommand::DATA_WAS_WRITTEN, num_bytes); } ",0 "v8::Handle V8DOMWrapper::convertDOMImplementationToV8Object(DOMImplementation* impl) { v8::Handle result = instantiateV8Object(V8ClassIndex::DOMIMPLEMENTATION, V8ClassIndex::DOMIMPLEMENTATION, impl); if (result.IsEmpty()) { return v8::Null(); } return result; } ",0 "int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length) { struct super_block *sb = inode->i_sb; ext4_lblk_t first_block, stop_block; struct address_space *mapping = inode->i_mapping; loff_t first_block_offset, last_block_offset; handle_t *handle; unsigned int credits; int ret = 0; if (!S_ISREG(inode->i_mode)) return -EOPNOTSUPP; trace_ext4_punch_hole(inode, offset, length, 0); /* * Write out all dirty pages to avoid race conditions * Then release them. */ if (mapping->nrpages && mapping_tagged(mapping, PAGECACHE_TAG_DIRTY)) { ret = filemap_write_and_wait_range(mapping, offset, offset + length - 1); if (ret) return ret; } mutex_lock(&inode->i_mutex); /* No need to punch hole beyond i_size */ if (offset >= inode->i_size) goto out_mutex; /* * If the hole extends beyond i_size, set the hole * to end after the page that contains i_size */ if (offset + length > inode->i_size) { length = inode->i_size + PAGE_CACHE_SIZE - (inode->i_size & (PAGE_CACHE_SIZE - 1)) - offset; } if (offset & (sb->s_blocksize - 1) || (offset + length) & (sb->s_blocksize - 1)) { /* * Attach jinode to inode for jbd2 if we do any zeroing of * partial block */ ret = ext4_inode_attach_jinode(inode); if (ret < 0) goto out_mutex; } first_block_offset = round_up(offset, sb->s_blocksize); last_block_offset = round_down((offset + length), sb->s_blocksize) - 1; /* Now release the pages and zero block aligned part of pages*/ if (last_block_offset > first_block_offset) truncate_pagecache_range(inode, first_block_offset, last_block_offset); /* Wait all existing dio workers, newcomers will block on i_mutex */ ext4_inode_block_unlocked_dio(inode); inode_dio_wait(inode); if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) credits = ext4_writepage_trans_blocks(inode); else credits = ext4_blocks_for_truncate(inode); handle = ext4_journal_start(inode, EXT4_HT_TRUNCATE, credits); if (IS_ERR(handle)) { ret = PTR_ERR(handle); ext4_std_error(sb, ret); goto out_dio; } ret = ext4_zero_partial_blocks(handle, inode, offset, length); if (ret) goto out_stop; first_block = (offset + sb->s_blocksize - 1) >> EXT4_BLOCK_SIZE_BITS(sb); stop_block = (offset + length) >> EXT4_BLOCK_SIZE_BITS(sb); /* If there are no blocks to remove, return now */ if (first_block >= stop_block) goto out_stop; down_write(&EXT4_I(inode)->i_data_sem); ext4_discard_preallocations(inode); ret = ext4_es_remove_extent(inode, first_block, stop_block - first_block); if (ret) { up_write(&EXT4_I(inode)->i_data_sem); goto out_stop; } if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) ret = ext4_ext_remove_space(inode, first_block, stop_block - 1); else ret = ext4_ind_remove_space(handle, inode, first_block, stop_block); up_write(&EXT4_I(inode)->i_data_sem); if (IS_SYNC(inode)) ext4_handle_sync(handle); /* Now release the pages again to reduce race window */ if (last_block_offset > first_block_offset) truncate_pagecache_range(inode, first_block_offset, last_block_offset); inode->i_mtime = inode->i_ctime = ext4_current_time(inode); ext4_mark_inode_dirty(handle, inode); out_stop: ext4_journal_stop(handle); out_dio: ext4_inode_resume_unlocked_dio(inode); out_mutex: mutex_unlock(&inode->i_mutex); return ret; } ",1 "static int rtecp_cipher(sc_card_t *card, const u8 *data, size_t data_len, u8 *out, size_t out_len, int sign) { sc_apdu_t apdu; u8 *buf, *buf_out; size_t i; int r; assert(card && card->ctx && data && out); buf_out = malloc(out_len + 2); buf = malloc(data_len); if (!buf || !buf_out) { free(buf); free(buf_out); SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_NORMAL, SC_ERROR_OUT_OF_MEMORY); } for (i = 0; i < data_len; ++i) buf[i] = data[data_len - 1 - i]; if (sign) sc_format_apdu(card, &apdu, SC_APDU_CASE_4_SHORT, 0x2A, 0x9E, 0x9A); else sc_format_apdu(card, &apdu, SC_APDU_CASE_4_SHORT, 0x2A, 0x80, 0x86); apdu.lc = data_len; apdu.data = buf; apdu.datalen = data_len; apdu.resp = buf_out; apdu.resplen = out_len + 2; apdu.le = out_len > 256 ? 256 : out_len; if (apdu.lc > 255) apdu.flags |= SC_APDU_FLAGS_CHAINING; r = sc_transmit_apdu(card, &apdu); if (!sign) { assert(buf); sc_mem_clear(buf, data_len); } assert(buf); free(buf); if (r) sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, ""APDU transmit failed: %s\n"", sc_strerror(r)); else { if (apdu.sw1 == 0x90 && apdu.sw2 == 0x00) { assert(buf_out); for (i = 0; i < apdu.resplen; ++i) out[i] = buf_out[apdu.resplen - 1 - i]; r = (i > 0) ? (int)i : SC_ERROR_INTERNAL; } else r = sc_check_sw(card, apdu.sw1, apdu.sw2); } if (!sign) { assert(buf_out); sc_mem_clear(buf_out, out_len + 2); } assert(buf_out); free(buf_out); SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, r); } ",0 "void rds_inc_put(struct rds_incoming *inc) { rdsdebug(""put inc %p ref %d\n"", inc, atomic_read(&inc->i_refcount)); if (atomic_dec_and_test(&inc->i_refcount)) { BUG_ON(!list_empty(&inc->i_item)); inc->i_conn->c_trans->inc_free(inc); } } ",0 "void RenderFrameImpl::ScrollFocusedEditableElementIntoRect( const gfx::Rect& rect) { blink::WebAutofillClient* autofill_client = frame_->AutofillClient(); if (has_scrolled_focused_editable_node_into_rect_ && rect == rect_for_scrolled_focused_editable_node_ && autofill_client) { autofill_client->DidCompleteFocusChangeInFrame(); return; } if (!frame_->LocalRoot() ->FrameWidget() ->ScrollFocusedEditableElementIntoView()) { return; } rect_for_scrolled_focused_editable_node_ = rect; has_scrolled_focused_editable_node_into_rect_ = true; if (!GetRenderWidget()->layer_tree_view()->HasPendingPageScaleAnimation() && autofill_client) { autofill_client->DidCompleteFocusChangeInFrame(); } } ",0 "std::string Backtrace::FormatFrameData(const backtrace_frame_data_t* frame) { const char* map_name; if (BacktraceMap::IsValid(frame->map) && !frame->map.name.empty()) { map_name = frame->map.name.c_str(); } else { map_name = """"; } uintptr_t relative_pc = BacktraceMap::GetRelativePc(frame->map, frame->pc); std::string line(StringPrintf(""#%02zu pc %"" PRIPTR "" %s"", frame->num, relative_pc, map_name)); if (frame->map.offset != 0) { line += "" (offset "" + StringPrintf(""0x%"" PRIxPTR, frame->map.offset) + "")""; } if (!frame->func_name.empty()) { line += "" ("" + frame->func_name; if (frame->func_offset) { line += StringPrintf(""+%"" PRIuPTR, frame->func_offset); } line += ')'; } return line; } ",0 "void Huff_Init(huffman_t *huff) { Com_Memset(&huff->compressor, 0, sizeof(huff_t)); Com_Memset(&huff->decompressor, 0, sizeof(huff_t)); huff->decompressor.tree = huff->decompressor.lhead = huff->decompressor.ltail = huff->decompressor.loc[NYT] = &(huff->decompressor.nodeList[huff->decompressor.blocNode++]); huff->decompressor.tree->symbol = NYT; huff->decompressor.tree->weight = 0; huff->decompressor.lhead->next = huff->decompressor.lhead->prev = NULL; huff->decompressor.tree->parent = huff->decompressor.tree->left = huff->decompressor.tree->right = NULL; huff->compressor.tree = huff->compressor.lhead = huff->compressor.loc[NYT] = &(huff->compressor.nodeList[huff->compressor.blocNode++]); huff->compressor.tree->symbol = NYT; huff->compressor.tree->weight = 0; huff->compressor.lhead->next = huff->compressor.lhead->prev = NULL; huff->compressor.tree->parent = huff->compressor.tree->left = huff->compressor.tree->right = NULL; } ",0 "DeviceOrientationController* DeviceOrientationController::from(Document* document) { DeviceOrientationController* controller = static_cast(DocumentSupplement::from(document, supplementName())); if (!controller) { controller = new DeviceOrientationController(document); DocumentSupplement::provideTo(document, supplementName(), adoptPtr(controller)); } return controller; } ",0 "void RenderBlock::removePositionedObjects(RenderBlock* o, ContainingBlockState containingBlockState) { TrackedRendererListHashSet* positionedDescendants = positionedObjects(); if (!positionedDescendants) return; RenderBox* r; TrackedRendererListHashSet::iterator end = positionedDescendants->end(); Vector deadObjects; for (TrackedRendererListHashSet::iterator it = positionedDescendants->begin(); it != end; ++it) { r = *it; if (!o || r->isDescendantOf(o)) { if (containingBlockState == NewContainingBlock) r->setChildNeedsLayout(MarkOnlyThis); RenderObject* p = r->parent(); while (p && !p->isRenderBlock()) p = p->parent(); if (p) p->setChildNeedsLayout(); deadObjects.append(r); } } for (unsigned i = 0; i < deadObjects.size(); i++) removePositionedObject(deadObjects.at(i)); } ",0 "MagickExport void ClonePixelCacheMethods(Cache clone,const Cache cache) { CacheInfo *restrict cache_info, *restrict source_info; assert(clone != (Cache) NULL); source_info=(CacheInfo *) clone; assert(source_info->signature == MagickSignature); if (source_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"", source_info->filename); assert(cache != (Cache) NULL); cache_info=(CacheInfo *) cache; assert(cache_info->signature == MagickSignature); source_info->methods=cache_info->methods; } ",0 "bool Element::hasAttributeNS(const AtomicString& namespaceURI, const AtomicString& localName) const { if (!elementData()) return false; QualifiedName qName(nullAtom, localName, namespaceURI); synchronizeAttribute(qName); return elementData()->getAttributeItem(qName); } ",0 "DGAGetViewportStatus(int index) { DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); /* We rely on the extension to check that DGA is active */ if (!pScreenPriv->funcs->GetViewport) return 0; return (*pScreenPriv->funcs->GetViewport) (pScreenPriv->pScrn); } ",0 "unsigned int GfxColorSpace::getCMSColorSpaceType(icColorSpaceSignature cs) { switch (cs) { case icSigXYZData: return PT_XYZ; break; case icSigLabData: return PT_Lab; break; case icSigLuvData: return PT_YUV; break; case icSigYCbCrData: return PT_YCbCr; break; case icSigYxyData: return PT_Yxy; break; case icSigRgbData: return PT_RGB; break; case icSigGrayData: return PT_GRAY; break; case icSigHsvData: return PT_HSV; break; case icSigHlsData: return PT_HLS; break; case icSigCmykData: return PT_CMYK; break; case icSigCmyData: return PT_CMY; break; case icSig2colorData: case icSig3colorData: case icSig4colorData: case icSig5colorData: case icSig6colorData: case icSig7colorData: case icSig8colorData: case icSig9colorData: case icSig10colorData: case icSig11colorData: case icSig12colorData: case icSig13colorData: case icSig14colorData: case icSig15colorData: default: break; } return PT_RGB; } ",0 "static int nfs4_xdr_dec_write(struct rpc_rqst *rqstp, __be32 *p, struct nfs_writeres *res) { struct xdr_stream xdr; struct compound_hdr hdr; int status; xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); status = decode_compound_hdr(&xdr, &hdr); if (status) goto out; status = decode_putfh(&xdr); if (status) goto out; status = decode_write(&xdr, res); if (status) goto out; decode_getfattr(&xdr, res->fattr, res->server); if (!status) status = res->count; out: return status; } ",0 "void smp_proc_rand(tSMP_CB* p_cb, tSMP_INT_DATA* p_data) { uint8_t* p = p_data->p_data; SMP_TRACE_DEBUG(""%s"", __func__); if (smp_command_has_invalid_parameters(p_cb)) { tSMP_INT_DATA smp_int_data; smp_int_data.status = SMP_INVALID_PARAMETERS; smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &smp_int_data); return; } /* save the SRand for comparison */ STREAM_TO_ARRAY(p_cb->rrand, p, BT_OCTET16_LEN); } ",0 "void InputDispatcher::logOutboundKeyDetailsLocked(const char* prefix, const KeyEntry* entry) { #if DEBUG_OUTBOUND_EVENT_DETAILS ALOGD(""%seventTime=%lld, deviceId=%d, source=0x%x, policyFlags=0x%x, "" ""action=0x%x, flags=0x%x, keyCode=0x%x, scanCode=0x%x, metaState=0x%x, "" ""repeatCount=%d, downTime=%lld"", prefix, entry->eventTime, entry->deviceId, entry->source, entry->policyFlags, entry->action, entry->flags, entry->keyCode, entry->scanCode, entry->metaState, entry->repeatCount, entry->downTime); #endif } ",0 "static int cypress_ca42v2_port_probe(struct usb_serial_port *port) { struct cypress_private *priv; int ret; ret = cypress_generic_port_probe(port); if (ret) { dev_dbg(&port->dev, ""%s - Failed setting up port\n"", __func__); return ret; } priv = usb_get_serial_port_data(port); priv->chiptype = CT_CA42V2; return 0; } ",0 " void SetShouldRequireCTForTesting(bool* required) { if (base::FeatureList::IsEnabled(network::features::kNetworkService)) { network::mojom::NetworkServiceTestPtr network_service_test; content::ServiceManagerConnection::GetForProcess() ->GetConnector() ->BindInterface(content::mojom::kNetworkServiceName, &network_service_test); network::mojom::NetworkServiceTest::ShouldRequireCT required_ct; if (!required) { required_ct = network::mojom::NetworkServiceTest::ShouldRequireCT::RESET; } else { required_ct = *required ? network::mojom::NetworkServiceTest::ShouldRequireCT::REQUIRE : network::mojom::NetworkServiceTest::ShouldRequireCT:: DONT_REQUIRE; } mojo::ScopedAllowSyncCallForTesting allow_sync_call; network_service_test->SetShouldRequireCT(required_ct); return; } base::PostTaskWithTraits( FROM_HERE, {BrowserThread::IO}, base::BindOnce( &net::TransportSecurityState::SetShouldRequireCTForTesting, required)); } ",0 "static void encode_compound_hdr(struct xdr_stream *xdr, struct rpc_rqst *req, struct compound_hdr *hdr) { __be32 *p; struct rpc_auth *auth = req->rq_cred->cr_auth; /* initialize running count of expected bytes in reply. * NOTE: the replied tag SHOULD be the same is the one sent, * but this is not required as a MUST for the server to do so. */ hdr->replen = RPC_REPHDRSIZE + auth->au_rslack + 3 + hdr->taglen; dprintk(""encode_compound: tag=%.*s\n"", (int)hdr->taglen, hdr->tag); BUG_ON(hdr->taglen > NFS4_MAXTAGLEN); p = reserve_space(xdr, 4 + hdr->taglen + 8); p = xdr_encode_opaque(p, hdr->tag, hdr->taglen); *p++ = cpu_to_be32(hdr->minorversion); hdr->nops_p = p; *p = cpu_to_be32(hdr->nops); } ",0 "IntSize WebPagePrivate::viewportSize() const { return mapFromTransformed(transformedViewportSize()); } ",0 "static int query_raw_packet_qp_rq_state(struct mlx5_ib_dev *dev, struct mlx5_ib_rq *rq, u8 *rq_state) { void *out; void *rqc; int inlen; int err; inlen = MLX5_ST_SZ_BYTES(query_rq_out); out = kvzalloc(inlen, GFP_KERNEL); if (!out) return -ENOMEM; err = mlx5_core_query_rq(dev->mdev, rq->base.mqp.qpn, out); if (err) goto out; rqc = MLX5_ADDR_OF(query_rq_out, out, rq_context); *rq_state = MLX5_GET(rqc, rqc, state); rq->state = *rq_state; out: kvfree(out); return err; } ",0 "TracingControllerImpl* TracingControllerImpl::GetInstance() { DCHECK(g_tracing_controller); return g_tracing_controller; } ",0 "ExtensionsAPIClient::CreateWebRequestEventRouterDelegate() const { return nullptr; } ",0 "static int nobody_responds_to_arp(uint32_t nip, const uint8_t *safe_mac, unsigned arpping_ms) { struct in_addr temp; int r; r = arpping(nip, safe_mac, server_config.server_nip, server_config.server_mac, server_config.interface, arpping_ms); if (r) return r; temp.s_addr = nip; bb_error_msg(""%s belongs to someone, reserving it for %u seconds"", inet_ntoa(temp), (unsigned)server_config.conflict_time); add_lease(NULL, nip, server_config.conflict_time, NULL, 0); return 0; } ",0 " ThrottleListQueuePointer queue_pointer() const { return queue_pointer_; } ",0 "static inline int ebt_watcher_to_user(const struct ebt_entry_watcher *w, const char *base, char __user *ubase) { return ebt_obj_to_user(ubase + ((char *)w - base), w->u.watcher->name, w->data, sizeof(*w), w->u.watcher->usersize, w->watcher_size); } ",0 "void GfxDeviceNColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) { double x[gfxColorMaxComps], c[gfxColorMaxComps]; GfxColor color2; int i; for (i = 0; i < nComps; ++i) { x[i] = colToDbl(color->c[i]); } func->transform(x, c); for (i = 0; i < alt->getNComps(); ++i) { color2.c[i] = dblToCol(c[i]); } alt->getRGB(&color2, rgb); } ",0 "void ClientControlledShellSurface::OnWindowAddedToRootWindow( aura::Window* window) { if (client_controlled_state_->set_bounds_locally()) return; ScopedLockedToRoot scoped_locked_to_root(widget_); UpdateWidgetBounds(); } ",0 " addrs_in_same_network_family(const tor_addr_t *a1, const tor_addr_t *a2) { return 0 == tor_addr_compare_masked(a1, a2, 16, CMP_SEMANTIC); } ",0 "void H264DPB::RemoveUnused() { for (Pictures::iterator it = pics_.begin(); it != pics_.end(); ) { if ((*it)->outputted && !(*it)->ref) pics_.erase(it++); else ++it; } } ",0 "void OmniboxViewViews::SaveStateToTab(content::WebContents* tab) { DCHECK(tab); if (IsIMEComposing()) { ConfirmCompositionText(); GetInputMethod()->CancelComposition(this); } OmniboxEditModel::State state = model()->GetStateForTabSwitch(); tab->SetUserData(OmniboxState::kKey, base::MakeUnique( state, GetSelectedRange(), saved_selection_for_focus_change_)); } ",0 "int ssl3_accept(SSL *s) { BUF_MEM *buf; unsigned long alg_k,Time=(unsigned long)time(NULL); void (*cb)(const SSL *ssl,int type,int val)=NULL; int ret= -1; int new_state,state,skip=0; RAND_add(&Time,sizeof(Time),0); ERR_clear_error(); clear_sys_error(); if (s->info_callback != NULL) cb=s->info_callback; else if (s->ctx->info_callback != NULL) cb=s->ctx->info_callback; /* init things to blank */ s->in_handshake++; if (!SSL_in_init(s) || SSL_in_before(s)) SSL_clear(s); if (s->cert == NULL) { SSLerr(SSL_F_SSL3_ACCEPT,SSL_R_NO_CERTIFICATE_SET); return(-1); } #ifndef OPENSSL_NO_HEARTBEATS /* If we're awaiting a HeartbeatResponse, pretend we * already got and don't await it anymore, because * Heartbeats don't make sense during handshakes anyway. */ if (s->tlsext_hb_pending) { s->tlsext_hb_pending = 0; s->tlsext_hb_seq++; } #endif for (;;) { state=s->state; switch (s->state) { case SSL_ST_RENEGOTIATE: s->renegotiate=1; /* s->state=SSL_ST_ACCEPT; */ case SSL_ST_BEFORE: case SSL_ST_ACCEPT: case SSL_ST_BEFORE|SSL_ST_ACCEPT: case SSL_ST_OK|SSL_ST_ACCEPT: s->server=1; if (cb != NULL) cb(s,SSL_CB_HANDSHAKE_START,1); if ((s->version>>8) != 3) { SSLerr(SSL_F_SSL3_ACCEPT, ERR_R_INTERNAL_ERROR); return -1; } s->type=SSL_ST_ACCEPT; if (s->init_buf == NULL) { if ((buf=BUF_MEM_new()) == NULL) { ret= -1; goto end; } if (!BUF_MEM_grow(buf,SSL3_RT_MAX_PLAIN_LENGTH)) { ret= -1; goto end; } s->init_buf=buf; } if (!ssl3_setup_buffers(s)) { ret= -1; goto end; } s->init_num=0; s->s3->flags &= ~SSL3_FLAGS_SGC_RESTART_DONE; if (s->state != SSL_ST_RENEGOTIATE) { /* Ok, we now need to push on a buffering BIO so that * the output is sent in a way that TCP likes :-) */ if (!ssl_init_wbio_buffer(s,1)) { ret= -1; goto end; } ssl3_init_finished_mac(s); s->state=SSL3_ST_SR_CLNT_HELLO_A; s->ctx->stats.sess_accept++; } else if (!s->s3->send_connection_binding && !(s->options & SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION)) { /* Server attempting to renegotiate with * client that doesn't support secure * renegotiation. */ SSLerr(SSL_F_SSL3_ACCEPT, SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED); ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_HANDSHAKE_FAILURE); ret = -1; goto end; } else { /* s->state == SSL_ST_RENEGOTIATE, * we will just send a HelloRequest */ s->ctx->stats.sess_accept_renegotiate++; s->state=SSL3_ST_SW_HELLO_REQ_A; } break; case SSL3_ST_SW_HELLO_REQ_A: case SSL3_ST_SW_HELLO_REQ_B: s->shutdown=0; ret=ssl3_send_hello_request(s); if (ret <= 0) goto end; s->s3->tmp.next_state=SSL3_ST_SW_HELLO_REQ_C; s->state=SSL3_ST_SW_FLUSH; s->init_num=0; ssl3_init_finished_mac(s); break; case SSL3_ST_SW_HELLO_REQ_C: s->state=SSL_ST_OK; break; case SSL3_ST_SR_CLNT_HELLO_A: case SSL3_ST_SR_CLNT_HELLO_B: case SSL3_ST_SR_CLNT_HELLO_C: s->shutdown=0; if (s->rwstate != SSL_X509_LOOKUP) { ret=ssl3_get_client_hello(s); if (ret <= 0) goto end; } #ifndef OPENSSL_NO_SRP { int al; if ((ret = ssl_check_srp_ext_ClientHello(s,&al)) < 0) { /* callback indicates firther work to be done */ s->rwstate=SSL_X509_LOOKUP; goto end; } if (ret != SSL_ERROR_NONE) { ssl3_send_alert(s,SSL3_AL_FATAL,al); /* This is not really an error but the only means to for a client to detect whether srp is supported. */ if (al != TLS1_AD_UNKNOWN_PSK_IDENTITY) SSLerr(SSL_F_SSL3_ACCEPT,SSL_R_CLIENTHELLO_TLSEXT); ret = SSL_TLSEXT_ERR_ALERT_FATAL; ret= -1; goto end; } } #endif s->renegotiate = 2; s->state=SSL3_ST_SW_SRVR_HELLO_A; s->init_num=0; break; case SSL3_ST_SW_SRVR_HELLO_A: case SSL3_ST_SW_SRVR_HELLO_B: ret=ssl3_send_server_hello(s); if (ret <= 0) goto end; #ifndef OPENSSL_NO_TLSEXT if (s->hit) { if (s->tlsext_ticket_expected) s->state=SSL3_ST_SW_SESSION_TICKET_A; else s->state=SSL3_ST_SW_CHANGE_A; } #else if (s->hit) s->state=SSL3_ST_SW_CHANGE_A; #endif else s->state=SSL3_ST_SW_CERT_A; s->init_num=0; break; case SSL3_ST_SW_CERT_A: case SSL3_ST_SW_CERT_B: /* Check if it is anon DH or anon ECDH, */ /* normal PSK or KRB5 or SRP */ if (!(s->s3->tmp.new_cipher->algorithm_auth & SSL_aNULL) && !(s->s3->tmp.new_cipher->algorithm_mkey & SSL_kPSK) && !(s->s3->tmp.new_cipher->algorithm_auth & SSL_aKRB5)) { ret=ssl3_send_server_certificate(s); if (ret <= 0) goto end; #ifndef OPENSSL_NO_TLSEXT if (s->tlsext_status_expected) s->state=SSL3_ST_SW_CERT_STATUS_A; else s->state=SSL3_ST_SW_KEY_EXCH_A; } else { skip = 1; s->state=SSL3_ST_SW_KEY_EXCH_A; } #else } else skip=1; s->state=SSL3_ST_SW_KEY_EXCH_A; #endif s->init_num=0; break; case SSL3_ST_SW_KEY_EXCH_A: case SSL3_ST_SW_KEY_EXCH_B: alg_k = s->s3->tmp.new_cipher->algorithm_mkey; /* clear this, it may get reset by * send_server_key_exchange */ if ((s->options & SSL_OP_EPHEMERAL_RSA) #ifndef OPENSSL_NO_KRB5 && !(alg_k & SSL_kKRB5) #endif /* OPENSSL_NO_KRB5 */ ) /* option SSL_OP_EPHEMERAL_RSA sends temporary RSA key * even when forbidden by protocol specs * (handshake may fail as clients are not required to * be able to handle this) */ s->s3->tmp.use_rsa_tmp=1; else s->s3->tmp.use_rsa_tmp=0; /* only send if a DH key exchange, fortezza or * RSA but we have a sign only certificate * * PSK: may send PSK identity hints * * For ECC ciphersuites, we send a serverKeyExchange * message only if the cipher suite is either * ECDH-anon or ECDHE. In other cases, the * server certificate contains the server's * public key for key exchange. */ if (s->s3->tmp.use_rsa_tmp /* PSK: send ServerKeyExchange if PSK identity * hint if provided */ #ifndef OPENSSL_NO_PSK || ((alg_k & SSL_kPSK) && s->ctx->psk_identity_hint) #endif #ifndef OPENSSL_NO_SRP /* SRP: send ServerKeyExchange */ || (alg_k & SSL_kSRP) #endif || (alg_k & (SSL_kDHr|SSL_kDHd|SSL_kEDH)) || (alg_k & SSL_kEECDH) || ((alg_k & SSL_kRSA) && (s->cert->pkeys[SSL_PKEY_RSA_ENC].privatekey == NULL || (SSL_C_IS_EXPORT(s->s3->tmp.new_cipher) && EVP_PKEY_size(s->cert->pkeys[SSL_PKEY_RSA_ENC].privatekey)*8 > SSL_C_EXPORT_PKEYLENGTH(s->s3->tmp.new_cipher) ) ) ) ) { ret=ssl3_send_server_key_exchange(s); if (ret <= 0) goto end; } else skip=1; s->state=SSL3_ST_SW_CERT_REQ_A; s->init_num=0; break; case SSL3_ST_SW_CERT_REQ_A: case SSL3_ST_SW_CERT_REQ_B: if (/* don't request cert unless asked for it: */ !(s->verify_mode & SSL_VERIFY_PEER) || /* if SSL_VERIFY_CLIENT_ONCE is set, * don't request cert during re-negotiation: */ ((s->session->peer != NULL) && (s->verify_mode & SSL_VERIFY_CLIENT_ONCE)) || /* never request cert in anonymous ciphersuites * (see section ""Certificate request"" in SSL 3 drafts * and in RFC 2246): */ ((s->s3->tmp.new_cipher->algorithm_auth & SSL_aNULL) && /* ... except when the application insists on verification * (against the specs, but s3_clnt.c accepts this for SSL 3) */ !(s->verify_mode & SSL_VERIFY_FAIL_IF_NO_PEER_CERT)) || /* never request cert in Kerberos ciphersuites */ (s->s3->tmp.new_cipher->algorithm_auth & SSL_aKRB5) /* With normal PSK Certificates and * Certificate Requests are omitted */ || (s->s3->tmp.new_cipher->algorithm_mkey & SSL_kPSK)) { /* no cert request */ skip=1; s->s3->tmp.cert_request=0; s->state=SSL3_ST_SW_SRVR_DONE_A; if (s->s3->handshake_buffer) if (!ssl3_digest_cached_records(s)) return -1; } else { s->s3->tmp.cert_request=1; ret=ssl3_send_certificate_request(s); if (ret <= 0) goto end; #ifndef NETSCAPE_HANG_BUG s->state=SSL3_ST_SW_SRVR_DONE_A; #else s->state=SSL3_ST_SW_FLUSH; s->s3->tmp.next_state=SSL3_ST_SR_CERT_A; #endif s->init_num=0; } break; case SSL3_ST_SW_SRVR_DONE_A: case SSL3_ST_SW_SRVR_DONE_B: ret=ssl3_send_server_done(s); if (ret <= 0) goto end; s->s3->tmp.next_state=SSL3_ST_SR_CERT_A; s->state=SSL3_ST_SW_FLUSH; s->init_num=0; break; case SSL3_ST_SW_FLUSH: /* This code originally checked to see if * any data was pending using BIO_CTRL_INFO * and then flushed. This caused problems * as documented in PR#1939. The proposed * fix doesn't completely resolve this issue * as buggy implementations of BIO_CTRL_PENDING * still exist. So instead we just flush * unconditionally. */ s->rwstate=SSL_WRITING; if (BIO_flush(s->wbio) <= 0) { ret= -1; goto end; } s->rwstate=SSL_NOTHING; s->state=s->s3->tmp.next_state; break; case SSL3_ST_SR_CERT_A: case SSL3_ST_SR_CERT_B: /* Check for second client hello (MS SGC) */ ret = ssl3_check_client_hello(s); if (ret <= 0) goto end; if (ret == 2) s->state = SSL3_ST_SR_CLNT_HELLO_C; else { if (s->s3->tmp.cert_request) { ret=ssl3_get_client_certificate(s); if (ret <= 0) goto end; } s->init_num=0; s->state=SSL3_ST_SR_KEY_EXCH_A; } break; case SSL3_ST_SR_KEY_EXCH_A: case SSL3_ST_SR_KEY_EXCH_B: ret=ssl3_get_client_key_exchange(s); if (ret <= 0) goto end; if (ret == 2) { /* For the ECDH ciphersuites when * the client sends its ECDH pub key in * a certificate, the CertificateVerify * message is not sent. * Also for GOST ciphersuites when * the client uses its key from the certificate * for key exchange. */ #if defined(OPENSSL_NO_TLSEXT) || defined(OPENSSL_NO_NEXTPROTONEG) s->state=SSL3_ST_SR_FINISHED_A; #else if (s->s3->next_proto_neg_seen) s->state=SSL3_ST_SR_NEXT_PROTO_A; else s->state=SSL3_ST_SR_FINISHED_A; #endif s->init_num = 0; } else if (TLS1_get_version(s) >= TLS1_2_VERSION) { s->state=SSL3_ST_SR_CERT_VRFY_A; s->init_num=0; if (!s->session->peer) break; /* For TLS v1.2 freeze the handshake buffer * at this point and digest cached records. */ if (!s->s3->handshake_buffer) { SSLerr(SSL_F_SSL3_ACCEPT,ERR_R_INTERNAL_ERROR); return -1; } s->s3->flags |= TLS1_FLAGS_KEEP_HANDSHAKE; if (!ssl3_digest_cached_records(s)) return -1; } else { int offset=0; int dgst_num; s->state=SSL3_ST_SR_CERT_VRFY_A; s->init_num=0; /* We need to get hashes here so if there is * a client cert, it can be verified * FIXME - digest processing for CertificateVerify * should be generalized. But it is next step */ if (s->s3->handshake_buffer) if (!ssl3_digest_cached_records(s)) return -1; for (dgst_num=0; dgst_nums3->handshake_dgst[dgst_num]) { int dgst_size; s->method->ssl3_enc->cert_verify_mac(s,EVP_MD_CTX_type(s->s3->handshake_dgst[dgst_num]),&(s->s3->tmp.cert_verify_md[offset])); dgst_size=EVP_MD_CTX_size(s->s3->handshake_dgst[dgst_num]); if (dgst_size < 0) { ret = -1; goto end; } offset+=dgst_size; } } break; case SSL3_ST_SR_CERT_VRFY_A: case SSL3_ST_SR_CERT_VRFY_B: /* we should decide if we expected this one */ ret=ssl3_get_cert_verify(s); if (ret <= 0) goto end; #if defined(OPENSSL_NO_TLSEXT) || defined(OPENSSL_NO_NEXTPROTONEG) s->state=SSL3_ST_SR_FINISHED_A; #else if (s->s3->next_proto_neg_seen) s->state=SSL3_ST_SR_NEXT_PROTO_A; else s->state=SSL3_ST_SR_FINISHED_A; #endif s->init_num=0; break; #if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG) case SSL3_ST_SR_NEXT_PROTO_A: case SSL3_ST_SR_NEXT_PROTO_B: ret=ssl3_get_next_proto(s); if (ret <= 0) goto end; s->init_num = 0; s->state=SSL3_ST_SR_FINISHED_A; break; #endif case SSL3_ST_SR_FINISHED_A: case SSL3_ST_SR_FINISHED_B: ret=ssl3_get_finished(s,SSL3_ST_SR_FINISHED_A, SSL3_ST_SR_FINISHED_B); if (ret <= 0) goto end; #ifndef OPENSSL_NO_TLSEXT else if (s->tlsext_ticket_expected) s->state=SSL3_ST_SW_SESSION_TICKET_A; #endif else s->state=SSL3_ST_SW_CHANGE_A; s->init_num=0; break; #ifndef OPENSSL_NO_TLSEXT case SSL3_ST_SW_SESSION_TICKET_A: case SSL3_ST_SW_SESSION_TICKET_B: ret=ssl3_send_newsession_ticket(s); if (ret <= 0) goto end; s->state=SSL3_ST_SW_CHANGE_A; s->init_num=0; break; case SSL3_ST_SW_CERT_STATUS_A: case SSL3_ST_SW_CERT_STATUS_B: ret=ssl3_send_cert_status(s); if (ret <= 0) goto end; s->state=SSL3_ST_SW_KEY_EXCH_A; s->init_num=0; break; #endif case SSL3_ST_SW_CHANGE_A: case SSL3_ST_SW_CHANGE_B: s->session->cipher=s->s3->tmp.new_cipher; if (!s->method->ssl3_enc->setup_key_block(s)) { ret= -1; goto end; } ret=ssl3_send_change_cipher_spec(s, SSL3_ST_SW_CHANGE_A,SSL3_ST_SW_CHANGE_B); if (ret <= 0) goto end; s->state=SSL3_ST_SW_FINISHED_A; s->init_num=0; if (!s->method->ssl3_enc->change_cipher_state(s, SSL3_CHANGE_CIPHER_SERVER_WRITE)) { ret= -1; goto end; } break; case SSL3_ST_SW_FINISHED_A: case SSL3_ST_SW_FINISHED_B: ret=ssl3_send_finished(s, SSL3_ST_SW_FINISHED_A,SSL3_ST_SW_FINISHED_B, s->method->ssl3_enc->server_finished_label, s->method->ssl3_enc->server_finished_label_len); if (ret <= 0) goto end; s->state=SSL3_ST_SW_FLUSH; if (s->hit) { #if defined(OPENSSL_NO_TLSEXT) || defined(OPENSSL_NO_NEXTPROTONEG) s->s3->tmp.next_state=SSL3_ST_SR_FINISHED_A; #else s->s3->tmp.next_state=SSL3_ST_SR_FINISHED_A; #else if (s->s3->next_proto_neg_seen) s->s3->tmp.next_state=SSL3_ST_SR_NEXT_PROTO_A; else s->s3->tmp.next_state=SSL3_ST_SR_FINISHED_A; #endif case SSL_ST_OK: /* clean a few things up */ ssl3_cleanup_key_block(s); BUF_MEM_free(s->init_buf); s->init_buf=NULL; /* remove buffering on output */ ssl_free_wbio_buffer(s); s->init_num=0; if (s->renegotiate == 2) /* skipped if we just sent a HelloRequest */ { s->renegotiate=0; s->new_session=0; ssl_update_cache(s,SSL_SESS_CACHE_SERVER); s->ctx->stats.sess_accept_good++; /* s->server=1; */ s->handshake_func=ssl3_accept; if (cb != NULL) cb(s,SSL_CB_HANDSHAKE_DONE,1); } ret = 1; goto end; /* break; */ default: SSLerr(SSL_F_SSL3_ACCEPT,SSL_R_UNKNOWN_STATE); ret= -1; goto end; /* break; */ } if (!s->s3->tmp.reuse_message && !skip) { if (s->debug) { if ((ret=BIO_flush(s->wbio)) <= 0) goto end; } if ((cb != NULL) && (s->state != state)) { new_state=s->state; s->state=state; cb(s,SSL_CB_ACCEPT_LOOP,1); s->state=new_state; } } skip=0; } end: /* BIO_flush(s->wbio); */ s->in_handshake--; if (cb != NULL) cb(s,SSL_CB_ACCEPT_EXIT,ret); return(ret); } ",1 "asmlinkage void __exception do_sp_pc_abort(unsigned long addr, unsigned int esr, struct pt_regs *regs) { struct siginfo info; info.si_signo = SIGBUS; info.si_errno = 0; info.si_code = BUS_ADRALN; info.si_addr = (void __user *)addr; arm64_notify_die("""", regs, &info, esr); } ",0 " bool IsTopSitesLoaded() { return top_sites()->loaded_; } ",0 "Stralign_left(Str s, int width) { Str n; int i; STR_LENGTH_CHECK(s); if (s->length >= width) return Strdup(s); n = Strnew_size(width); Strcopy(n, s); for (i = s->length; i < width; i++) Strcat_char(n, ' '); return n; } ",0 "void __init mnt_init(void) { unsigned u; int err; mnt_cache = kmem_cache_create(""mnt_cache"", sizeof(struct mount), 0, SLAB_HWCACHE_ALIGN | SLAB_PANIC, NULL); mount_hashtable = alloc_large_system_hash(""Mount-cache"", sizeof(struct hlist_head), mhash_entries, 19, 0, &m_hash_shift, &m_hash_mask, 0, 0); mountpoint_hashtable = alloc_large_system_hash(""Mountpoint-cache"", sizeof(struct hlist_head), mphash_entries, 19, 0, &mp_hash_shift, &mp_hash_mask, 0, 0); if (!mount_hashtable || !mountpoint_hashtable) panic(""Failed to allocate mount hash table\n""); for (u = 0; u <= m_hash_mask; u++) INIT_HLIST_HEAD(&mount_hashtable[u]); for (u = 0; u <= mp_hash_mask; u++) INIT_HLIST_HEAD(&mountpoint_hashtable[u]); kernfs_init(); err = sysfs_init(); if (err) printk(KERN_WARNING ""%s: sysfs_init error: %d\n"", __func__, err); fs_kobj = kobject_create_and_add(""fs"", NULL); if (!fs_kobj) printk(KERN_WARNING ""%s: kobj create error\n"", __func__); init_rootfs(); init_mount_tree(); } ",0 "static struct mm_slot *get_mm_slot(struct mm_struct *mm) { struct mm_slot *mm_slot; struct hlist_head *bucket; struct hlist_node *node; bucket = &mm_slots_hash[((unsigned long)mm / sizeof(struct mm_struct)) % MM_SLOTS_HASH_HEADS]; hlist_for_each_entry(mm_slot, node, bucket, hash) { if (mm == mm_slot->mm) return mm_slot; } return NULL; } ",0 "void BackwardsCharacterIterator::advance(int count) { if (count <= 0) { ASSERT(!count); return; } m_atBreak = false; int remaining = m_textIterator.length() - m_runOffset; if (count < remaining) { m_runOffset += count; m_offset += count; return; } count -= remaining; m_offset += remaining; for (m_textIterator.advance(); !atEnd(); m_textIterator.advance()) { int runLength = m_textIterator.length(); if (runLength == 0) m_atBreak = true; else { if (count < runLength) { m_runOffset = count; m_offset += count; return; } count -= runLength; m_offset += runLength; } } m_atBreak = true; m_runOffset = 0; } ",0 "bool GLSurfaceOzoneEGL::ReinitializeNativeSurface() { std::unique_ptr scoped_make_current; GLContext* current_context = GLContext::GetCurrent(); bool was_current = current_context && current_context->IsCurrent(this); if (was_current) { scoped_make_current.reset(new ui::ScopedMakeCurrent(current_context, this)); } Destroy(); ozone_surface_ = ui::OzonePlatform::GetInstance() ->GetSurfaceFactoryOzone() ->CreateEGLSurfaceForWidget(widget_); if (!ozone_surface_) { LOG(ERROR) << ""Failed to create native surface.""; return false; } window_ = ozone_surface_->GetNativeWindow(); if (!Initialize(format_)) { LOG(ERROR) << ""Failed to initialize.""; return false; } return true; } ",0 "static void __ldsem_wake(struct ld_semaphore *sem) { if (!list_empty(&sem->write_wait)) __ldsem_wake_writer(sem); else if (!list_empty(&sem->read_wait)) __ldsem_wake_readers(sem); } ",0 " jbig2_sd_release(Jbig2Ctx *ctx, Jbig2SymbolDict *dict) { int i; if (dict == NULL) return; for (i = 0; i < dict->n_symbols; i++) if (dict->glyphs[i]) jbig2_image_release(ctx, dict->glyphs[i]); jbig2_free(ctx->allocator, dict->glyphs); jbig2_free(ctx->allocator, dict); } ",1 "void ide_sector_read(IDEState *s) { int64_t sector_num; int n; s->status = READY_STAT | SEEK_STAT; s->error = 0; /* not needed by IDE spec, but needed by Windows */ sector_num = ide_get_sector(s); n = s->nsector; if (n == 0) { ide_transfer_stop(s); return; } s->status |= BUSY_STAT; if (n > s->req_nb_sectors) { n = s->req_nb_sectors; } #if defined(DEBUG_IDE) printf(""sector=%"" PRId64 ""\n"", sector_num); #endif if (!ide_sect_range_ok(s, sector_num, n)) { ide_rw_error(s); return; } s->iov.iov_base = s->io_buffer; s->iov.iov_len = n * BDRV_SECTOR_SIZE; qemu_iovec_init_external(&s->qiov, &s->iov, 1); block_acct_start(blk_get_stats(s->blk), &s->acct, n * BDRV_SECTOR_SIZE, BLOCK_ACCT_READ); s->pio_aiocb = blk_aio_readv(s->blk, sector_num, &s->qiov, n, ide_sector_read_cb, s); } ",0 "n_tty_receive_buf_raw(struct tty_struct *tty, const unsigned char *cp, char *fp, int count) { struct n_tty_data *ldata = tty->disc_data; char flag = TTY_NORMAL; while (count--) { if (fp) flag = *fp++; if (likely(flag == TTY_NORMAL)) put_tty_queue(*cp++, ldata); else n_tty_receive_char_flagged(tty, *cp++, flag); } } ",0 "cipop(mrb_state *mrb) { struct mrb_context *c = mrb->c; struct REnv *env = c->ci->env; c->ci--; if (env) mrb_env_unshare(mrb, env); } ",0 "void InstallablePaymentAppCrawler::DownloadAndDecodeWebAppIcon( const GURL& method_manifest_url, const GURL& web_app_manifest_url, std::unique_ptr> icons) { if (icons == nullptr || icons->empty()) return; std::vector manifest_icons; for (const auto& icon : *icons) { if (icon.src.empty() || !base::IsStringUTF8(icon.src)) { WarnIfPossible( ""The installable payment app's icon src url is not a non-empty UTF8 "" ""string.""); continue; } GURL icon_src = GURL(icon.src); if (!icon_src.is_valid()) { icon_src = web_app_manifest_url.Resolve(icon.src); if (!icon_src.is_valid()) { WarnIfPossible( ""Failed to resolve the installable payment app's icon src url ("" + icon.src + "").""); continue; } } blink::Manifest::ImageResource manifest_icon; manifest_icon.src = icon_src; manifest_icon.type = base::UTF8ToUTF16(icon.type); manifest_icon.purpose.emplace_back( blink::Manifest::ImageResource::Purpose::ANY); manifest_icon.sizes.emplace_back(gfx::Size()); manifest_icons.emplace_back(manifest_icon); } if (manifest_icons.empty()) return; const int kPaymentAppIdealIconSize = 0xFFFF; const int kPaymentAppMinimumIconSize = 0; GURL best_icon_url = blink::ManifestIconSelector::FindBestMatchingIcon( manifest_icons, kPaymentAppIdealIconSize, kPaymentAppMinimumIconSize, blink::Manifest::ImageResource::Purpose::ANY); if (!best_icon_url.is_valid()) { WarnIfPossible( ""No suitable icon found in the installabble payment app's manifest ("" + web_app_manifest_url.spec() + "").""); return; } if (web_contents() == nullptr) return; number_of_web_app_icons_to_download_and_decode_++; bool can_download_icon = content::ManifestIconDownloader::Download( web_contents(), best_icon_url, kPaymentAppIdealIconSize, kPaymentAppMinimumIconSize, base::Bind( &InstallablePaymentAppCrawler::OnPaymentWebAppIconDownloadAndDecoded, weak_ptr_factory_.GetWeakPtr(), method_manifest_url, web_app_manifest_url)); DCHECK(can_download_icon); } ",0 "static int val_hdr(struct arg *arg, char **err_msg) { if (arg && arg[1].type == ARGT_SINT && arg[1].data.sint < -MAX_HDR_HISTORY) { memprintf(err_msg, ""header occurrence must be >= %d"", -MAX_HDR_HISTORY); return 0; } return 1; } ",0 "int sock_create_lite(int family, int type, int protocol, struct socket **res) { int err; struct socket *sock = NULL; err = security_socket_create(family, type, protocol, 1); if (err) goto out; sock = sock_alloc(); if (!sock) { err = -ENOMEM; goto out; } sock->type = type; err = security_socket_post_create(sock, family, type, protocol, 1); if (err) goto out_release; out: *res = sock; return err; out_release: sock_release(sock); sock = NULL; goto out; } ",0 "void InputDispatcher::doDispatchCycleFinishedLockedInterruptible( CommandEntry* commandEntry) { sp connection = commandEntry->connection; nsecs_t finishTime = commandEntry->eventTime; uint32_t seq = commandEntry->seq; bool handled = commandEntry->handled; DispatchEntry* dispatchEntry = connection->findWaitQueueEntry(seq); if (dispatchEntry) { nsecs_t eventDuration = finishTime - dispatchEntry->deliveryTime; if (eventDuration > SLOW_EVENT_PROCESSING_WARNING_TIMEOUT) { String8 msg; msg.appendFormat(""Window '%s' spent %0.1fms processing the last input event: "", connection->getWindowName(), eventDuration * 0.000001f); dispatchEntry->eventEntry->appendDescription(msg); ALOGI(""%s"", msg.string()); } bool restartEvent; if (dispatchEntry->eventEntry->type == EventEntry::TYPE_KEY) { KeyEntry* keyEntry = static_cast(dispatchEntry->eventEntry); restartEvent = afterKeyEventLockedInterruptible(connection, dispatchEntry, keyEntry, handled); } else if (dispatchEntry->eventEntry->type == EventEntry::TYPE_MOTION) { MotionEntry* motionEntry = static_cast(dispatchEntry->eventEntry); restartEvent = afterMotionEventLockedInterruptible(connection, dispatchEntry, motionEntry, handled); } else { restartEvent = false; } if (dispatchEntry == connection->findWaitQueueEntry(seq)) { connection->waitQueue.dequeue(dispatchEntry); traceWaitQueueLengthLocked(connection); if (restartEvent && connection->status == Connection::STATUS_NORMAL) { connection->outboundQueue.enqueueAtHead(dispatchEntry); traceOutboundQueueLengthLocked(connection); } else { releaseDispatchEntryLocked(dispatchEntry); } } startDispatchCycleLocked(now(), connection); } } ",0 "void TypingCommand::insertParagraphSeparator(EditingState* editingState) { if (!canAppendNewLineFeedToSelection(endingSelection())) return; applyCommandToComposite(InsertParagraphSeparatorCommand::create(document()), editingState); if (editingState->isAborted()) return; typingAddedToOpenCommand(InsertParagraphSeparator); } ",0 "static inline struct cpuacct *cgroup_ca(struct cgroup *cgrp) { return container_of(cgroup_subsys_state(cgrp, cpuacct_subsys_id), struct cpuacct, css); } ",0 " WarmupURLFetcher::~WarmupURLFetcher() {} ",0 " explicit CacheQueryResult(CacheQueryOutcome outcome) : outcome(outcome) {} ",0 "static int ecdsa_sign_det_restartable( mbedtls_ecp_group *grp, mbedtls_mpi *r, mbedtls_mpi *s, const mbedtls_mpi *d, const unsigned char *buf, size_t blen, mbedtls_md_type_t md_alg, mbedtls_ecdsa_restart_ctx *rs_ctx ) { int ret; mbedtls_hmac_drbg_context rng_ctx; mbedtls_hmac_drbg_context *p_rng = &rng_ctx; unsigned char data[2 * MBEDTLS_ECP_MAX_BYTES]; size_t grp_len = ( grp->nbits + 7 ) / 8; const mbedtls_md_info_t *md_info; mbedtls_mpi h; if( ( md_info = mbedtls_md_info_from_type( md_alg ) ) == NULL ) return( MBEDTLS_ERR_ECP_BAD_INPUT_DATA ); mbedtls_mpi_init( &h ); mbedtls_hmac_drbg_init( &rng_ctx ); ECDSA_RS_ENTER( det ); #if defined(MBEDTLS_ECP_RESTARTABLE) if( rs_ctx != NULL && rs_ctx->det != NULL ) { /* redirect to our context */ p_rng = &rs_ctx->det->rng_ctx; /* jump to current step */ if( rs_ctx->det->state == ecdsa_det_sign ) goto sign; } #endif /* MBEDTLS_ECP_RESTARTABLE */ /* Use private key and message hash (reduced) to initialize HMAC_DRBG */ MBEDTLS_MPI_CHK( mbedtls_mpi_write_binary( d, data, grp_len ) ); MBEDTLS_MPI_CHK( derive_mpi( grp, &h, buf, blen ) ); MBEDTLS_MPI_CHK( mbedtls_mpi_write_binary( &h, data + grp_len, grp_len ) ); mbedtls_hmac_drbg_seed_buf( p_rng, md_info, data, 2 * grp_len ); #if defined(MBEDTLS_ECP_RESTARTABLE) if( rs_ctx != NULL && rs_ctx->det != NULL ) rs_ctx->det->state = ecdsa_det_sign; sign: #endif #if defined(MBEDTLS_ECDSA_SIGN_ALT) ret = mbedtls_ecdsa_sign( grp, r, s, d, buf, blen, mbedtls_hmac_drbg_random, p_rng ); #else ret = ecdsa_sign_restartable( grp, r, s, d, buf, blen, mbedtls_hmac_drbg_random, p_rng, rs_ctx ); #endif /* MBEDTLS_ECDSA_SIGN_ALT */ cleanup: mbedtls_hmac_drbg_free( &rng_ctx ); mbedtls_mpi_free( &h ); ECDSA_RS_LEAVE( det ); return( ret ); } ",1 "static void flag_skiplist_free(void *data) { RFlagsAtOffset *item = (RFlagsAtOffset *)data; r_list_free (item->flags); free (data); } ",0 "_forkexec_slurmstepd(uint16_t type, void *req, slurm_addr_t *cli, slurm_addr_t *self, const hostset_t step_hset, uint16_t protocol_version) { pid_t pid; int to_stepd[2] = {-1, -1}; int to_slurmd[2] = {-1, -1}; if (pipe(to_stepd) < 0 || pipe(to_slurmd) < 0) { error(""_forkexec_slurmstepd pipe failed: %m""); return SLURM_FAILURE; } if (_add_starting_step(type, req)) { error(""_forkexec_slurmstepd failed in _add_starting_step: %m""); return SLURM_FAILURE; } if ((pid = fork()) < 0) { error(""_forkexec_slurmstepd: fork: %m""); close(to_stepd[0]); close(to_stepd[1]); close(to_slurmd[0]); close(to_slurmd[1]); _remove_starting_step(type, req); return SLURM_FAILURE; } else if (pid > 0) { int rc = SLURM_SUCCESS; #if (SLURMSTEPD_MEMCHECK == 0) int i; time_t start_time = time(NULL); #endif /* * Parent sends initialization data to the slurmstepd * over the to_stepd pipe, and waits for the return code * reply on the to_slurmd pipe. */ if (close(to_stepd[0]) < 0) error(""Unable to close read to_stepd in parent: %m""); if (close(to_slurmd[1]) < 0) error(""Unable to close write to_slurmd in parent: %m""); if ((rc = _send_slurmstepd_init(to_stepd[1], type, req, cli, self, step_hset, protocol_version)) != 0) { error(""Unable to init slurmstepd""); goto done; } /* If running under valgrind/memcheck, this pipe doesn't work * correctly so just skip it. */ #if (SLURMSTEPD_MEMCHECK == 0) i = read(to_slurmd[0], &rc, sizeof(int)); if (i < 0) { error(""%s: Can not read return code from slurmstepd "" ""got %d: %m"", __func__, i); rc = SLURM_FAILURE; } else if (i != sizeof(int)) { error(""%s: slurmstepd failed to send return code "" ""got %d: %m"", __func__, i); rc = SLURM_FAILURE; } else { int delta_time = time(NULL) - start_time; int cc; if (delta_time > 5) { info(""Warning: slurmstepd startup took %d sec, "" ""possible file system problem or full "" ""memory"", delta_time); } if (rc != SLURM_SUCCESS) error(""slurmstepd return code %d"", rc); cc = SLURM_SUCCESS; cc = write(to_stepd[1], &cc, sizeof(int)); if (cc != sizeof(int)) { error(""%s: failed to send ack to stepd %d: %m"", __func__, cc); } } #endif done: if (_remove_starting_step(type, req)) error(""Error cleaning up starting_step list""); /* Reap child */ if (waitpid(pid, NULL, 0) < 0) error(""Unable to reap slurmd child process""); if (close(to_stepd[1]) < 0) error(""close write to_stepd in parent: %m""); if (close(to_slurmd[0]) < 0) error(""close read to_slurmd in parent: %m""); return rc; } else { #if (SLURMSTEPD_MEMCHECK == 1) /* memcheck test of slurmstepd, option #1 */ char *const argv[3] = {""memcheck"", (char *)conf->stepd_loc, NULL}; #elif (SLURMSTEPD_MEMCHECK == 2) /* valgrind test of slurmstepd, option #2 */ uint32_t job_id = 0, step_id = 0; char log_file[256]; char *const argv[13] = {""valgrind"", ""--tool=memcheck"", ""--error-limit=no"", ""--leak-check=summary"", ""--show-reachable=yes"", ""--max-stackframe=16777216"", ""--num-callers=20"", ""--child-silent-after-fork=yes"", ""--track-origins=yes"", log_file, (char *)conf->stepd_loc, NULL}; if (type == LAUNCH_BATCH_JOB) { job_id = ((batch_job_launch_msg_t *)req)->job_id; step_id = ((batch_job_launch_msg_t *)req)->step_id; } else if (type == LAUNCH_TASKS) { job_id = ((launch_tasks_request_msg_t *)req)->job_id; step_id = ((launch_tasks_request_msg_t *)req)->job_step_id; } snprintf(log_file, sizeof(log_file), ""--log-file=/tmp/slurmstepd_valgrind_%u.%u"", job_id, step_id); #elif (SLURMSTEPD_MEMCHECK == 3) /* valgrind/drd test of slurmstepd, option #3 */ uint32_t job_id = 0, step_id = 0; char log_file[256]; char *const argv[10] = {""valgrind"", ""--tool=drd"", ""--error-limit=no"", ""--max-stackframe=16777216"", ""--num-callers=20"", ""--child-silent-after-fork=yes"", log_file, (char *)conf->stepd_loc, NULL}; if (type == LAUNCH_BATCH_JOB) { job_id = ((batch_job_launch_msg_t *)req)->job_id; step_id = ((batch_job_launch_msg_t *)req)->step_id; } else if (type == LAUNCH_TASKS) { job_id = ((launch_tasks_request_msg_t *)req)->job_id; step_id = ((launch_tasks_request_msg_t *)req)->job_step_id; } snprintf(log_file, sizeof(log_file), ""--log-file=/tmp/slurmstepd_valgrind_%u.%u"", job_id, step_id); #elif (SLURMSTEPD_MEMCHECK == 4) /* valgrind/helgrind test of slurmstepd, option #4 */ uint32_t job_id = 0, step_id = 0; char log_file[256]; char *const argv[10] = {""valgrind"", ""--tool=helgrind"", ""--error-limit=no"", ""--max-stackframe=16777216"", ""--num-callers=20"", ""--child-silent-after-fork=yes"", log_file, (char *)conf->stepd_loc, NULL}; if (type == LAUNCH_BATCH_JOB) { job_id = ((batch_job_launch_msg_t *)req)->job_id; step_id = ((batch_job_launch_msg_t *)req)->step_id; } else if (type == LAUNCH_TASKS) { job_id = ((launch_tasks_request_msg_t *)req)->job_id; step_id = ((launch_tasks_request_msg_t *)req)->job_step_id; } snprintf(log_file, sizeof(log_file), ""--log-file=/tmp/slurmstepd_valgrind_%u.%u"", job_id, step_id); #else /* no memory checking, default */ char *const argv[2] = { (char *)conf->stepd_loc, NULL}; #endif int i; int failed = 0; /* inform slurmstepd about our config */ setenv(""SLURM_CONF"", conf->conffile, 1); /* * Child forks and exits */ if (setsid() < 0) { error(""_forkexec_slurmstepd: setsid: %m""); failed = 1; } if ((pid = fork()) < 0) { error(""_forkexec_slurmstepd: "" ""Unable to fork grandchild: %m""); failed = 2; } else if (pid > 0) { /* child */ exit(0); } /* * Just incase we (or someone we are linking to) * opened a file and didn't do a close on exec. This * is needed mostly to protect us against libs we link * to that don't set the flag as we should already be * setting it for those that we open. The number 256 * is an arbitrary number based off test7.9. */ for (i=3; i<256; i++) { (void) fcntl(i, F_SETFD, FD_CLOEXEC); } /* * Grandchild exec's the slurmstepd * * If the slurmd is being shutdown/restarted before * the pipe happens the old conf->lfd could be reused * and if we close it the dup2 below will fail. */ if ((to_stepd[0] != conf->lfd) && (to_slurmd[1] != conf->lfd)) slurm_shutdown_msg_engine(conf->lfd); if (close(to_stepd[1]) < 0) error(""close write to_stepd in grandchild: %m""); if (close(to_slurmd[0]) < 0) error(""close read to_slurmd in parent: %m""); (void) close(STDIN_FILENO); /* ignore return */ if (dup2(to_stepd[0], STDIN_FILENO) == -1) { error(""dup2 over STDIN_FILENO: %m""); exit(1); } fd_set_close_on_exec(to_stepd[0]); (void) close(STDOUT_FILENO); /* ignore return */ if (dup2(to_slurmd[1], STDOUT_FILENO) == -1) { error(""dup2 over STDOUT_FILENO: %m""); exit(1); } fd_set_close_on_exec(to_slurmd[1]); (void) close(STDERR_FILENO); /* ignore return */ if (dup2(devnull, STDERR_FILENO) == -1) { error(""dup2 /dev/null to STDERR_FILENO: %m""); exit(1); } fd_set_noclose_on_exec(STDERR_FILENO); log_fini(); if (!failed) { if (conf->chos_loc && !access(conf->chos_loc, X_OK)) execvp(conf->chos_loc, argv); else execvp(argv[0], argv); error(""exec of slurmstepd failed: %m""); } exit(2); } } ",0 "int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, struct kvm_dirty_log *log) { int r, i; struct kvm_memory_slot *memslot; unsigned long n; unsigned long is_dirty = 0; mutex_lock(&kvm->slots_lock); r = -EINVAL; if (log->slot >= KVM_MEMORY_SLOTS) goto out; memslot = &kvm->memslots->memslots[log->slot]; r = -ENOENT; if (!memslot->dirty_bitmap) goto out; n = kvm_dirty_bitmap_bytes(memslot); for (i = 0; !is_dirty && i < n/sizeof(long); i++) is_dirty = memslot->dirty_bitmap[i]; /* If nothing is dirty, don't bother messing with page tables. */ if (is_dirty) { struct kvm_memslots *slots, *old_slots; unsigned long *dirty_bitmap; dirty_bitmap = memslot->dirty_bitmap_head; if (memslot->dirty_bitmap == dirty_bitmap) dirty_bitmap += n / sizeof(long); memset(dirty_bitmap, 0, n); r = -ENOMEM; slots = kzalloc(sizeof(struct kvm_memslots), GFP_KERNEL); if (!slots) goto out; memcpy(slots, kvm->memslots, sizeof(struct kvm_memslots)); slots->memslots[log->slot].dirty_bitmap = dirty_bitmap; slots->generation++; old_slots = kvm->memslots; rcu_assign_pointer(kvm->memslots, slots); synchronize_srcu_expedited(&kvm->srcu); dirty_bitmap = old_slots->memslots[log->slot].dirty_bitmap; kfree(old_slots); spin_lock(&kvm->mmu_lock); kvm_mmu_slot_remove_write_access(kvm, log->slot); spin_unlock(&kvm->mmu_lock); r = -EFAULT; if (copy_to_user(log->dirty_bitmap, dirty_bitmap, n)) goto out; } else { r = -EFAULT; if (clear_user(log->dirty_bitmap, n)) goto out; } r = 0; out: mutex_unlock(&kvm->slots_lock); return r; } ",0 "void WebContentsImpl::OnDidRunInsecureContent(RenderFrameHostImpl* source, const GURL& security_origin, const GURL& target_url) { DidRunInsecureContent(security_origin, target_url); } ",0 "static int read_emulate(struct kvm_vcpu *vcpu, gpa_t gpa, void *val, int bytes) { return !kvm_read_guest(vcpu->kvm, gpa, val, bytes); } ",0 "static void cpu_ctx_sched_in(struct perf_cpu_context *cpuctx, enum event_type_t event_type, struct task_struct *task) { struct perf_event_context *ctx = &cpuctx->ctx; ctx_sched_in(ctx, cpuctx, event_type, task); } ",0 "NET_EXPORT_PRIVATE std::vector GenerateUpdatedTargetInfo( bool is_mic_enabled, bool is_epa_enabled, const std::string& channel_bindings, const std::string& spn, const std::vector& av_pairs, uint64_t* server_timestamp) { size_t updated_target_info_len = 0; std::vector updated_av_pairs(av_pairs); UpdateTargetInfoAvPairs(is_mic_enabled, is_epa_enabled, channel_bindings, spn, &updated_av_pairs, server_timestamp, &updated_target_info_len); return WriteUpdatedTargetInfo(updated_av_pairs, updated_target_info_len); } ",0 "psf_open_rsrc (SF_PRIVATE *psf) { if (psf->rsrc.filedes > 0) return 0 ; /* Test for MacOSX style resource fork on HPFS or HPFS+ filesystems. */ snprintf (psf->rsrc.path.c, sizeof (psf->rsrc.path.c), ""%s/..namedfork/rsrc"", psf->file.path.c) ; psf->error = SFE_NO_ERROR ; if ((psf->rsrc.filedes = psf_open_fd (&psf->rsrc)) >= 0) { psf->rsrclength = psf_get_filelen_fd (psf->rsrc.filedes) ; if (psf->rsrclength > 0 || (psf->rsrc.mode & SFM_WRITE)) return SFE_NO_ERROR ; psf_close_fd (psf->rsrc.filedes) ; psf->rsrc.filedes = -1 ; } ; if (psf->rsrc.filedes == - SFE_BAD_OPEN_MODE) { psf->error = SFE_BAD_OPEN_MODE ; return psf->error ; } ; /* ** Now try for a resource fork stored as a separate file in the same ** directory, but preceded with a dot underscore. */ snprintf (psf->rsrc.path.c, sizeof (psf->rsrc.path.c), ""%s._%s"", psf->file.dir.c, psf->file.name.c) ; psf->error = SFE_NO_ERROR ; if ((psf->rsrc.filedes = psf_open_fd (&psf->rsrc)) >= 0) { psf->rsrclength = psf_get_filelen_fd (psf->rsrc.filedes) ; return SFE_NO_ERROR ; } ; /* ** Now try for a resource fork stored in a separate file in the ** .AppleDouble/ directory. */ snprintf (psf->rsrc.path.c, sizeof (psf->rsrc.path.c), ""%s.AppleDouble/%s"", psf->file.dir.c, psf->file.name.c) ; psf->error = SFE_NO_ERROR ; if ((psf->rsrc.filedes = psf_open_fd (&psf->rsrc)) >= 0) { psf->rsrclength = psf_get_filelen_fd (psf->rsrc.filedes) ; return SFE_NO_ERROR ; } ; /* No resource file found. */ if (psf->rsrc.filedes == -1) psf_log_syserr (psf, errno) ; psf->rsrc.filedes = -1 ; return psf->error ; } /* psf_open_rsrc */ ",0 "void Document::setCookie(const String& value, ExceptionCode& ec) { if (page() && !page()->settings()->cookieEnabled()) return; if (!securityOrigin()->canAccessCookies()) { ec = SECURITY_ERR; return; } KURL cookieURL = this->cookieURL(); if (cookieURL.isEmpty()) return; setCookies(this, cookieURL, value); } ",0 " Read(media::mojom::VideoCaptureFormatDataView data, media::VideoCaptureFormat* out) { if (!data.ReadFrameSize(&out->frame_size)) return false; out->frame_rate = data.frame_rate(); if (!data.ReadPixelFormat(&out->pixel_format)) return false; return true; } ",0 "void EC_GROUP_free(EC_GROUP *group) { if (!group) return; if (group->meth->group_finish != 0) group->meth->group_finish(group); EC_EX_DATA_free_all_data(&group->extra_data); if (EC_GROUP_VERSION(group) && group->mont_data) BN_MONT_CTX_free(group->mont_data); if (group->generator != NULL) EC_POINT_free(group->generator); BN_free(&group->order); BN_free(&group->cofactor); if (group->seed) OPENSSL_free(group->seed); OPENSSL_free(group); } ",0 "gfx::Font OmniboxViewWin::GetFont() { return font_; } ",0 "entry_guard_add_bridge_to_sample(guard_selection_t *gs, const bridge_info_t *bridge) { const uint8_t *id_digest = bridge_get_rsa_id_digest(bridge); const tor_addr_port_t *addrport = bridge_get_addr_port(bridge); tor_assert(addrport); /* make sure that the guard is not already sampled. */ if (BUG(get_sampled_guard_for_bridge(gs, bridge))) return NULL; // LCOV_EXCL_LINE return entry_guard_add_to_sample_impl(gs, id_digest, NULL, addrport); } ",0 "void preventCommandReplication(client *c) { c->flags |= CLIENT_PREVENT_REPL_PROP; } ",0 "static int hns_nic_net_open(struct net_device *ndev) { struct hns_nic_priv *priv = netdev_priv(ndev); struct hnae_handle *h = priv->ae_handle; int ret; if (test_bit(NIC_STATE_TESTING, &priv->state)) return -EBUSY; priv->link = 0; netif_carrier_off(ndev); ret = netif_set_real_num_tx_queues(ndev, h->q_num); if (ret < 0) { netdev_err(ndev, ""netif_set_real_num_tx_queues fail, ret=%d!\n"", ret); return ret; } ret = netif_set_real_num_rx_queues(ndev, h->q_num); if (ret < 0) { netdev_err(ndev, ""netif_set_real_num_rx_queues fail, ret=%d!\n"", ret); return ret; } ret = hns_nic_net_up(ndev); if (ret) { netdev_err(ndev, ""hns net up fail, ret=%d!\n"", ret); return ret; } return 0; } ",0 "bool AutofillManager::GetCachedFormAndField(const FormData& form, const FormFieldData& field, FormStructure** form_structure, AutofillField** autofill_field) { if (!FindCachedForm(form, form_structure) && !FormStructure(form).ShouldBeParsed()) { return false; } if (!UpdateCachedForm(form, *form_structure, form_structure)) return false; if (!(*form_structure)->autofill_count()) return false; *autofill_field = nullptr; for (const auto& current : **form_structure) { if (current->SameFieldAs(field)) { *autofill_field = current.get(); break; } } return *autofill_field != nullptr; } ",0 "int nntp_check_msgid(struct Context *ctx, const char *msgid) { struct NntpData *nntp_data = ctx->data; char buf[LONG_STRING]; FILE *fp = mutt_file_mkstemp(); if (!fp) { mutt_perror(""mutt_file_mkstemp() failed!""); return -1; } snprintf(buf, sizeof(buf), ""HEAD %s\r\n"", msgid); int rc = nntp_fetch_lines(nntp_data, buf, sizeof(buf), NULL, fetch_tempfile, fp); if (rc) { mutt_file_fclose(&fp); if (rc < 0) return -1; if (mutt_str_strncmp(""430"", buf, 3) == 0) return 1; mutt_error(""HEAD: %s"", buf); return -1; } /* parse header */ if (ctx->msgcount == ctx->hdrmax) mx_alloc_memory(ctx); struct Header *hdr = ctx->hdrs[ctx->msgcount] = mutt_header_new(); hdr->data = mutt_mem_calloc(1, sizeof(struct NntpHeaderData)); hdr->env = mutt_rfc822_read_header(fp, hdr, 0, 0); mutt_file_fclose(&fp); /* get article number */ if (hdr->env->xref) nntp_parse_xref(ctx, hdr); else { snprintf(buf, sizeof(buf), ""STAT %s\r\n"", msgid); if (nntp_query(nntp_data, buf, sizeof(buf)) < 0) { mutt_header_free(&hdr); return -1; } sscanf(buf + 4, ANUM, &NHDR(hdr)->article_num); } /* reset flags */ hdr->read = false; hdr->old = false; hdr->deleted = false; hdr->changed = true; hdr->received = hdr->date_sent; hdr->index = ctx->msgcount++; mx_update_context(ctx, 1); return 0; } ",0 "static int __dequeue_signal(struct sigpending *pending, sigset_t *mask, siginfo_t *info, bool *resched_timer) { int sig = next_signal(pending, mask); if (sig) collect_signal(sig, pending, info, resched_timer); return sig; } ",0 "isis_print(netdissect_options *ndo, const uint8_t *p, u_int length) { const struct isis_common_header *isis_header; const struct isis_iih_lan_header *header_iih_lan; const struct isis_iih_ptp_header *header_iih_ptp; const struct isis_lsp_header *header_lsp; const struct isis_csnp_header *header_csnp; const struct isis_psnp_header *header_psnp; const struct isis_tlv_lsp *tlv_lsp; const struct isis_tlv_ptp_adj *tlv_ptp_adj; const struct isis_tlv_is_reach *tlv_is_reach; const struct isis_tlv_es_reach *tlv_es_reach; uint8_t pdu_type, max_area, id_length, tlv_type, tlv_len, tmp, alen, lan_alen, prefix_len; uint8_t ext_is_len, ext_ip_len, mt_len; const uint8_t *optr, *pptr, *tptr; u_short packet_len,pdu_len, key_id; u_int i,vendor_id; int sigcheck; packet_len=length; optr = p; /* initialize the _o_riginal pointer to the packet start - need it for parsing the checksum TLV and authentication TLV verification */ isis_header = (const struct isis_common_header *)p; ND_TCHECK(*isis_header); if (length < ISIS_COMMON_HEADER_SIZE) goto trunc; pptr = p+(ISIS_COMMON_HEADER_SIZE); header_iih_lan = (const struct isis_iih_lan_header *)pptr; header_iih_ptp = (const struct isis_iih_ptp_header *)pptr; header_lsp = (const struct isis_lsp_header *)pptr; header_csnp = (const struct isis_csnp_header *)pptr; header_psnp = (const struct isis_psnp_header *)pptr; if (!ndo->ndo_eflag) ND_PRINT((ndo, ""IS-IS"")); /* * Sanity checking of the header. */ if (isis_header->version != ISIS_VERSION) { ND_PRINT((ndo, ""version %d packet not supported"", isis_header->version)); return (0); } if ((isis_header->id_length != SYSTEM_ID_LEN) && (isis_header->id_length != 0)) { ND_PRINT((ndo, ""system ID length of %d is not supported"", isis_header->id_length)); return (0); } if (isis_header->pdu_version != ISIS_VERSION) { ND_PRINT((ndo, ""version %d packet not supported"", isis_header->pdu_version)); return (0); } if (length < isis_header->fixed_len) { ND_PRINT((ndo, ""fixed header length %u > packet length %u"", isis_header->fixed_len, length)); return (0); } if (isis_header->fixed_len < ISIS_COMMON_HEADER_SIZE) { ND_PRINT((ndo, ""fixed header length %u < minimum header size %u"", isis_header->fixed_len, (u_int)ISIS_COMMON_HEADER_SIZE)); return (0); } max_area = isis_header->max_area; switch(max_area) { case 0: max_area = 3; /* silly shit */ break; case 255: ND_PRINT((ndo, ""bad packet -- 255 areas"")); return (0); default: break; } id_length = isis_header->id_length; switch(id_length) { case 0: id_length = 6; /* silly shit again */ break; case 1: /* 1-8 are valid sys-ID lenghts */ case 2: case 3: case 4: case 5: case 6: case 7: case 8: break; case 255: id_length = 0; /* entirely useless */ break; default: break; } /* toss any non 6-byte sys-ID len PDUs */ if (id_length != 6 ) { ND_PRINT((ndo, ""bad packet -- illegal sys-ID length (%u)"", id_length)); return (0); } pdu_type=isis_header->pdu_type; /* in non-verbose mode print the basic PDU Type plus PDU specific brief information*/ if (ndo->ndo_vflag == 0) { ND_PRINT((ndo, ""%s%s"", ndo->ndo_eflag ? """" : "", "", tok2str(isis_pdu_values, ""unknown PDU-Type %u"", pdu_type))); } else { /* ok they seem to want to know everything - lets fully decode it */ ND_PRINT((ndo, ""%slength %u"", ndo->ndo_eflag ? """" : "", "", length)); ND_PRINT((ndo, ""\n\t%s, hlen: %u, v: %u, pdu-v: %u, sys-id-len: %u (%u), max-area: %u (%u)"", tok2str(isis_pdu_values, ""unknown, type %u"", pdu_type), isis_header->fixed_len, isis_header->version, isis_header->pdu_version, id_length, isis_header->id_length, max_area, isis_header->max_area)); if (ndo->ndo_vflag > 1) { if (!print_unknown_data(ndo, optr, ""\n\t"", 8)) /* provide the _o_riginal pointer */ return (0); /* for optionally debugging the common header */ } } switch (pdu_type) { case ISIS_PDU_L1_LAN_IIH: case ISIS_PDU_L2_LAN_IIH: if (isis_header->fixed_len != (ISIS_COMMON_HEADER_SIZE+ISIS_IIH_LAN_HEADER_SIZE)) { ND_PRINT((ndo, "", bogus fixed header length %u should be %lu"", isis_header->fixed_len, (unsigned long)(ISIS_COMMON_HEADER_SIZE+ISIS_IIH_LAN_HEADER_SIZE))); return (0); } ND_TCHECK(*header_iih_lan); if (length < ISIS_COMMON_HEADER_SIZE+ISIS_IIH_LAN_HEADER_SIZE) goto trunc; if (ndo->ndo_vflag == 0) { ND_PRINT((ndo, "", src-id %s"", isis_print_id(header_iih_lan->source_id, SYSTEM_ID_LEN))); ND_PRINT((ndo, "", lan-id %s, prio %u"", isis_print_id(header_iih_lan->lan_id,NODE_ID_LEN), header_iih_lan->priority)); ND_PRINT((ndo, "", length %u"", length)); return (1); } pdu_len=EXTRACT_16BITS(header_iih_lan->pdu_len); if (packet_len>pdu_len) { packet_len=pdu_len; /* do TLV decoding as long as it makes sense */ length=pdu_len; } ND_PRINT((ndo, ""\n\t source-id: %s, holding time: %us, Flags: [%s]"", isis_print_id(header_iih_lan->source_id,SYSTEM_ID_LEN), EXTRACT_16BITS(header_iih_lan->holding_time), tok2str(isis_iih_circuit_type_values, ""unknown circuit type 0x%02x"", header_iih_lan->circuit_type))); ND_PRINT((ndo, ""\n\t lan-id: %s, Priority: %u, PDU length: %u"", isis_print_id(header_iih_lan->lan_id, NODE_ID_LEN), (header_iih_lan->priority) & ISIS_LAN_PRIORITY_MASK, pdu_len)); if (ndo->ndo_vflag > 1) { if (!print_unknown_data(ndo, pptr, ""\n\t "", ISIS_IIH_LAN_HEADER_SIZE)) return (0); } packet_len -= (ISIS_COMMON_HEADER_SIZE+ISIS_IIH_LAN_HEADER_SIZE); pptr = p + (ISIS_COMMON_HEADER_SIZE+ISIS_IIH_LAN_HEADER_SIZE); break; case ISIS_PDU_PTP_IIH: if (isis_header->fixed_len != (ISIS_COMMON_HEADER_SIZE+ISIS_IIH_PTP_HEADER_SIZE)) { ND_PRINT((ndo, "", bogus fixed header length %u should be %lu"", isis_header->fixed_len, (unsigned long)(ISIS_COMMON_HEADER_SIZE+ISIS_IIH_PTP_HEADER_SIZE))); return (0); } ND_TCHECK(*header_iih_ptp); if (length < ISIS_COMMON_HEADER_SIZE+ISIS_IIH_PTP_HEADER_SIZE) goto trunc; if (ndo->ndo_vflag == 0) { ND_PRINT((ndo, "", src-id %s"", isis_print_id(header_iih_ptp->source_id, SYSTEM_ID_LEN))); ND_PRINT((ndo, "", length %u"", length)); return (1); } pdu_len=EXTRACT_16BITS(header_iih_ptp->pdu_len); if (packet_len>pdu_len) { packet_len=pdu_len; /* do TLV decoding as long as it makes sense */ length=pdu_len; } ND_PRINT((ndo, ""\n\t source-id: %s, holding time: %us, Flags: [%s]"", isis_print_id(header_iih_ptp->source_id,SYSTEM_ID_LEN), EXTRACT_16BITS(header_iih_ptp->holding_time), tok2str(isis_iih_circuit_type_values, ""unknown circuit type 0x%02x"", header_iih_ptp->circuit_type))); ND_PRINT((ndo, ""\n\t circuit-id: 0x%02x, PDU length: %u"", header_iih_ptp->circuit_id, pdu_len)); if (ndo->ndo_vflag > 1) { if (!print_unknown_data(ndo, pptr, ""\n\t "", ISIS_IIH_PTP_HEADER_SIZE)) return (0); } packet_len -= (ISIS_COMMON_HEADER_SIZE+ISIS_IIH_PTP_HEADER_SIZE); pptr = p + (ISIS_COMMON_HEADER_SIZE+ISIS_IIH_PTP_HEADER_SIZE); break; case ISIS_PDU_L1_LSP: case ISIS_PDU_L2_LSP: if (isis_header->fixed_len != (ISIS_COMMON_HEADER_SIZE+ISIS_LSP_HEADER_SIZE)) { ND_PRINT((ndo, "", bogus fixed header length %u should be %lu"", isis_header->fixed_len, (unsigned long)ISIS_LSP_HEADER_SIZE)); return (0); } ND_TCHECK(*header_lsp); if (length < ISIS_COMMON_HEADER_SIZE+ISIS_LSP_HEADER_SIZE) goto trunc; if (ndo->ndo_vflag == 0) { ND_PRINT((ndo, "", lsp-id %s, seq 0x%08x, lifetime %5us"", isis_print_id(header_lsp->lsp_id, LSP_ID_LEN), EXTRACT_32BITS(header_lsp->sequence_number), EXTRACT_16BITS(header_lsp->remaining_lifetime))); ND_PRINT((ndo, "", length %u"", length)); return (1); } pdu_len=EXTRACT_16BITS(header_lsp->pdu_len); if (packet_len>pdu_len) { packet_len=pdu_len; /* do TLV decoding as long as it makes sense */ length=pdu_len; } ND_PRINT((ndo, ""\n\t lsp-id: %s, seq: 0x%08x, lifetime: %5us\n\t chksum: 0x%04x"", isis_print_id(header_lsp->lsp_id, LSP_ID_LEN), EXTRACT_32BITS(header_lsp->sequence_number), EXTRACT_16BITS(header_lsp->remaining_lifetime), EXTRACT_16BITS(header_lsp->checksum))); osi_print_cksum(ndo, (const uint8_t *)header_lsp->lsp_id, EXTRACT_16BITS(header_lsp->checksum), 12, length-12); ND_PRINT((ndo, "", PDU length: %u, Flags: [ %s"", pdu_len, ISIS_MASK_LSP_OL_BIT(header_lsp->typeblock) ? ""Overload bit set, "" : """")); if (ISIS_MASK_LSP_ATT_BITS(header_lsp->typeblock)) { ND_PRINT((ndo, ""%s"", ISIS_MASK_LSP_ATT_DEFAULT_BIT(header_lsp->typeblock) ? ""default "" : """")); ND_PRINT((ndo, ""%s"", ISIS_MASK_LSP_ATT_DELAY_BIT(header_lsp->typeblock) ? ""delay "" : """")); ND_PRINT((ndo, ""%s"", ISIS_MASK_LSP_ATT_EXPENSE_BIT(header_lsp->typeblock) ? ""expense "" : """")); ND_PRINT((ndo, ""%s"", ISIS_MASK_LSP_ATT_ERROR_BIT(header_lsp->typeblock) ? ""error "" : """")); ND_PRINT((ndo, ""ATT bit set, "")); } ND_PRINT((ndo, ""%s"", ISIS_MASK_LSP_PARTITION_BIT(header_lsp->typeblock) ? ""P bit set, "" : """")); ND_PRINT((ndo, ""%s ]"", tok2str(isis_lsp_istype_values, ""Unknown(0x%x)"", ISIS_MASK_LSP_ISTYPE_BITS(header_lsp->typeblock)))); if (ndo->ndo_vflag > 1) { if (!print_unknown_data(ndo, pptr, ""\n\t "", ISIS_LSP_HEADER_SIZE)) return (0); } packet_len -= (ISIS_COMMON_HEADER_SIZE+ISIS_LSP_HEADER_SIZE); pptr = p + (ISIS_COMMON_HEADER_SIZE+ISIS_LSP_HEADER_SIZE); break; case ISIS_PDU_L1_CSNP: case ISIS_PDU_L2_CSNP: if (isis_header->fixed_len != (ISIS_COMMON_HEADER_SIZE+ISIS_CSNP_HEADER_SIZE)) { ND_PRINT((ndo, "", bogus fixed header length %u should be %lu"", isis_header->fixed_len, (unsigned long)(ISIS_COMMON_HEADER_SIZE+ISIS_CSNP_HEADER_SIZE))); return (0); } ND_TCHECK(*header_csnp); if (length < ISIS_COMMON_HEADER_SIZE+ISIS_CSNP_HEADER_SIZE) goto trunc; if (ndo->ndo_vflag == 0) { ND_PRINT((ndo, "", src-id %s"", isis_print_id(header_csnp->source_id, NODE_ID_LEN))); ND_PRINT((ndo, "", length %u"", length)); return (1); } pdu_len=EXTRACT_16BITS(header_csnp->pdu_len); if (packet_len>pdu_len) { packet_len=pdu_len; /* do TLV decoding as long as it makes sense */ length=pdu_len; } ND_PRINT((ndo, ""\n\t source-id: %s, PDU length: %u"", isis_print_id(header_csnp->source_id, NODE_ID_LEN), pdu_len)); ND_PRINT((ndo, ""\n\t start lsp-id: %s"", isis_print_id(header_csnp->start_lsp_id, LSP_ID_LEN))); ND_PRINT((ndo, ""\n\t end lsp-id: %s"", isis_print_id(header_csnp->end_lsp_id, LSP_ID_LEN))); if (ndo->ndo_vflag > 1) { if (!print_unknown_data(ndo, pptr, ""\n\t "", ISIS_CSNP_HEADER_SIZE)) return (0); } packet_len -= (ISIS_COMMON_HEADER_SIZE+ISIS_CSNP_HEADER_SIZE); pptr = p + (ISIS_COMMON_HEADER_SIZE+ISIS_CSNP_HEADER_SIZE); break; case ISIS_PDU_L1_PSNP: case ISIS_PDU_L2_PSNP: if (isis_header->fixed_len != (ISIS_COMMON_HEADER_SIZE+ISIS_PSNP_HEADER_SIZE)) { ND_PRINT((ndo, ""- bogus fixed header length %u should be %lu"", isis_header->fixed_len, (unsigned long)(ISIS_COMMON_HEADER_SIZE+ISIS_PSNP_HEADER_SIZE))); return (0); } ND_TCHECK(*header_psnp); if (length < ISIS_COMMON_HEADER_SIZE+ISIS_PSNP_HEADER_SIZE) goto trunc; if (ndo->ndo_vflag == 0) { ND_PRINT((ndo, "", src-id %s"", isis_print_id(header_psnp->source_id, NODE_ID_LEN))); ND_PRINT((ndo, "", length %u"", length)); return (1); } pdu_len=EXTRACT_16BITS(header_psnp->pdu_len); if (packet_len>pdu_len) { packet_len=pdu_len; /* do TLV decoding as long as it makes sense */ length=pdu_len; } ND_PRINT((ndo, ""\n\t source-id: %s, PDU length: %u"", isis_print_id(header_psnp->source_id, NODE_ID_LEN), pdu_len)); if (ndo->ndo_vflag > 1) { if (!print_unknown_data(ndo, pptr, ""\n\t "", ISIS_PSNP_HEADER_SIZE)) return (0); } packet_len -= (ISIS_COMMON_HEADER_SIZE+ISIS_PSNP_HEADER_SIZE); pptr = p + (ISIS_COMMON_HEADER_SIZE+ISIS_PSNP_HEADER_SIZE); break; default: if (ndo->ndo_vflag == 0) { ND_PRINT((ndo, "", length %u"", length)); return (1); } (void)print_unknown_data(ndo, pptr, ""\n\t "", length); return (0); } /* * Now print the TLV's. */ while (packet_len > 0) { ND_TCHECK2(*pptr, 2); if (packet_len < 2) goto trunc; tlv_type = *pptr++; tlv_len = *pptr++; tmp =tlv_len; /* copy temporary len & pointer to packet data */ tptr = pptr; packet_len -= 2; /* first lets see if we know the TLVs name*/ ND_PRINT((ndo, ""\n\t %s TLV #%u, length: %u"", tok2str(isis_tlv_values, ""unknown"", tlv_type), tlv_type, tlv_len)); if (tlv_len == 0) /* something is invalid */ continue; if (packet_len < tlv_len) goto trunc; /* now check if we have a decoder otherwise do a hexdump at the end*/ switch (tlv_type) { case ISIS_TLV_AREA_ADDR: ND_TCHECK2(*tptr, 1); alen = *tptr++; while (tmp && alen < tmp) { ND_PRINT((ndo, ""\n\t Area address (length: %u): %s"", alen, isonsap_string(ndo, tptr, alen))); tptr += alen; tmp -= alen + 1; if (tmp==0) /* if this is the last area address do not attemt a boundary check */ break; ND_TCHECK2(*tptr, 1); alen = *tptr++; } break; case ISIS_TLV_ISNEIGH: while (tmp >= ETHER_ADDR_LEN) { ND_TCHECK2(*tptr, ETHER_ADDR_LEN); ND_PRINT((ndo, ""\n\t SNPA: %s"", isis_print_id(tptr, ETHER_ADDR_LEN))); tmp -= ETHER_ADDR_LEN; tptr += ETHER_ADDR_LEN; } break; case ISIS_TLV_ISNEIGH_VARLEN: if (!ND_TTEST2(*tptr, 1) || tmp < 3) /* min. TLV length */ goto trunctlv; lan_alen = *tptr++; /* LAN address length */ if (lan_alen == 0) { ND_PRINT((ndo, ""\n\t LAN address length 0 bytes (invalid)"")); break; } tmp --; ND_PRINT((ndo, ""\n\t LAN address length %u bytes "", lan_alen)); while (tmp >= lan_alen) { ND_TCHECK2(*tptr, lan_alen); ND_PRINT((ndo, ""\n\t\tIS Neighbor: %s"", isis_print_id(tptr, lan_alen))); tmp -= lan_alen; tptr +=lan_alen; } break; case ISIS_TLV_PADDING: break; case ISIS_TLV_MT_IS_REACH: mt_len = isis_print_mtid(ndo, tptr, ""\n\t ""); if (mt_len == 0) /* did something go wrong ? */ goto trunctlv; tptr+=mt_len; tmp-=mt_len; while (tmp >= 2+NODE_ID_LEN+3+1) { ext_is_len = isis_print_ext_is_reach(ndo, tptr, ""\n\t "", tlv_type); if (ext_is_len == 0) /* did something go wrong ? */ goto trunctlv; tmp-=ext_is_len; tptr+=ext_is_len; } break; case ISIS_TLV_IS_ALIAS_ID: while (tmp >= NODE_ID_LEN+1) { /* is it worth attempting a decode ? */ ext_is_len = isis_print_ext_is_reach(ndo, tptr, ""\n\t "", tlv_type); if (ext_is_len == 0) /* did something go wrong ? */ goto trunctlv; tmp-=ext_is_len; tptr+=ext_is_len; } break; case ISIS_TLV_EXT_IS_REACH: while (tmp >= NODE_ID_LEN+3+1) { /* is it worth attempting a decode ? */ ext_is_len = isis_print_ext_is_reach(ndo, tptr, ""\n\t "", tlv_type); if (ext_is_len == 0) /* did something go wrong ? */ goto trunctlv; tmp-=ext_is_len; tptr+=ext_is_len; } break; case ISIS_TLV_IS_REACH: ND_TCHECK2(*tptr,1); /* check if there is one byte left to read out the virtual flag */ ND_PRINT((ndo, ""\n\t %s"", tok2str(isis_is_reach_virtual_values, ""bogus virtual flag 0x%02x"", *tptr++))); tlv_is_reach = (const struct isis_tlv_is_reach *)tptr; while (tmp >= sizeof(struct isis_tlv_is_reach)) { ND_TCHECK(*tlv_is_reach); ND_PRINT((ndo, ""\n\t IS Neighbor: %s"", isis_print_id(tlv_is_reach->neighbor_nodeid, NODE_ID_LEN))); isis_print_metric_block(ndo, &tlv_is_reach->isis_metric_block); tmp -= sizeof(struct isis_tlv_is_reach); tlv_is_reach++; } break; case ISIS_TLV_ESNEIGH: tlv_es_reach = (const struct isis_tlv_es_reach *)tptr; while (tmp >= sizeof(struct isis_tlv_es_reach)) { ND_TCHECK(*tlv_es_reach); ND_PRINT((ndo, ""\n\t ES Neighbor: %s"", isis_print_id(tlv_es_reach->neighbor_sysid, SYSTEM_ID_LEN))); isis_print_metric_block(ndo, &tlv_es_reach->isis_metric_block); tmp -= sizeof(struct isis_tlv_es_reach); tlv_es_reach++; } break; /* those two TLVs share the same format */ case ISIS_TLV_INT_IP_REACH: case ISIS_TLV_EXT_IP_REACH: if (!isis_print_tlv_ip_reach(ndo, pptr, ""\n\t "", tlv_len)) return (1); break; case ISIS_TLV_EXTD_IP_REACH: while (tmp>0) { ext_ip_len = isis_print_extd_ip_reach(ndo, tptr, ""\n\t "", AF_INET); if (ext_ip_len == 0) /* did something go wrong ? */ goto trunctlv; tptr+=ext_ip_len; tmp-=ext_ip_len; } break; case ISIS_TLV_MT_IP_REACH: mt_len = isis_print_mtid(ndo, tptr, ""\n\t ""); if (mt_len == 0) { /* did something go wrong ? */ goto trunctlv; } tptr+=mt_len; tmp-=mt_len; while (tmp>0) { ext_ip_len = isis_print_extd_ip_reach(ndo, tptr, ""\n\t "", AF_INET); if (ext_ip_len == 0) /* did something go wrong ? */ goto trunctlv; tptr+=ext_ip_len; tmp-=ext_ip_len; } break; case ISIS_TLV_IP6_REACH: while (tmp>0) { ext_ip_len = isis_print_extd_ip_reach(ndo, tptr, ""\n\t "", AF_INET6); if (ext_ip_len == 0) /* did something go wrong ? */ goto trunctlv; tptr+=ext_ip_len; tmp-=ext_ip_len; } break; case ISIS_TLV_MT_IP6_REACH: mt_len = isis_print_mtid(ndo, tptr, ""\n\t ""); if (mt_len == 0) { /* did something go wrong ? */ goto trunctlv; } tptr+=mt_len; tmp-=mt_len; while (tmp>0) { ext_ip_len = isis_print_extd_ip_reach(ndo, tptr, ""\n\t "", AF_INET6); if (ext_ip_len == 0) /* did something go wrong ? */ goto trunctlv; tptr+=ext_ip_len; tmp-=ext_ip_len; } break; case ISIS_TLV_IP6ADDR: while (tmp>=sizeof(struct in6_addr)) { ND_TCHECK2(*tptr, sizeof(struct in6_addr)); ND_PRINT((ndo, ""\n\t IPv6 interface address: %s"", ip6addr_string(ndo, tptr))); tptr += sizeof(struct in6_addr); tmp -= sizeof(struct in6_addr); } break; case ISIS_TLV_AUTH: ND_TCHECK2(*tptr, 1); ND_PRINT((ndo, ""\n\t %s: "", tok2str(isis_subtlv_auth_values, ""unknown Authentication type 0x%02x"", *tptr))); switch (*tptr) { case ISIS_SUBTLV_AUTH_SIMPLE: if (fn_printzp(ndo, tptr + 1, tlv_len - 1, ndo->ndo_snapend)) goto trunctlv; break; case ISIS_SUBTLV_AUTH_MD5: for(i=1;i=1) { ND_TCHECK2(*tptr, 1); ND_PRINT((ndo, ""\n\t Adjacency State: %s (%u)"", tok2str(isis_ptp_adjancey_values, ""unknown"", *tptr), *tptr)); tmp--; } if(tmp>sizeof(tlv_ptp_adj->extd_local_circuit_id)) { ND_TCHECK(tlv_ptp_adj->extd_local_circuit_id); ND_PRINT((ndo, ""\n\t Extended Local circuit-ID: 0x%08x"", EXTRACT_32BITS(tlv_ptp_adj->extd_local_circuit_id))); tmp-=sizeof(tlv_ptp_adj->extd_local_circuit_id); } if(tmp>=SYSTEM_ID_LEN) { ND_TCHECK2(tlv_ptp_adj->neighbor_sysid, SYSTEM_ID_LEN); ND_PRINT((ndo, ""\n\t Neighbor System-ID: %s"", isis_print_id(tlv_ptp_adj->neighbor_sysid, SYSTEM_ID_LEN))); tmp-=SYSTEM_ID_LEN; } if(tmp>=sizeof(tlv_ptp_adj->neighbor_extd_local_circuit_id)) { ND_TCHECK(tlv_ptp_adj->neighbor_extd_local_circuit_id); ND_PRINT((ndo, ""\n\t Neighbor Extended Local circuit-ID: 0x%08x"", EXTRACT_32BITS(tlv_ptp_adj->neighbor_extd_local_circuit_id))); } break; case ISIS_TLV_PROTOCOLS: ND_PRINT((ndo, ""\n\t NLPID(s): "")); while (tmp>0) { ND_TCHECK2(*(tptr), 1); ND_PRINT((ndo, ""%s (0x%02x)"", tok2str(nlpid_values, ""unknown"", *tptr), *tptr)); if (tmp>1) /* further NPLIDs ? - put comma */ ND_PRINT((ndo, "", "")); tptr++; tmp--; } break; case ISIS_TLV_MT_PORT_CAP: { ND_TCHECK2(*(tptr), 2); ND_PRINT((ndo, ""\n\t RES: %d, MTID(s): %d"", (EXTRACT_16BITS (tptr) >> 12), (EXTRACT_16BITS (tptr) & 0x0fff))); tmp = tmp-2; tptr = tptr+2; if (tmp) isis_print_mt_port_cap_subtlv(ndo, tptr, tmp); break; } case ISIS_TLV_MT_CAPABILITY: ND_TCHECK2(*(tptr), 2); ND_PRINT((ndo, ""\n\t O: %d, RES: %d, MTID(s): %d"", (EXTRACT_16BITS(tptr) >> 15) & 0x01, (EXTRACT_16BITS(tptr) >> 12) & 0x07, EXTRACT_16BITS(tptr) & 0x0fff)); tmp = tmp-2; tptr = tptr+2; if (tmp) isis_print_mt_capability_subtlv(ndo, tptr, tmp); break; case ISIS_TLV_TE_ROUTER_ID: ND_TCHECK2(*pptr, sizeof(struct in_addr)); ND_PRINT((ndo, ""\n\t Traffic Engineering Router ID: %s"", ipaddr_string(ndo, pptr))); break; case ISIS_TLV_IPADDR: while (tmp>=sizeof(struct in_addr)) { ND_TCHECK2(*tptr, sizeof(struct in_addr)); ND_PRINT((ndo, ""\n\t IPv4 interface address: %s"", ipaddr_string(ndo, tptr))); tptr += sizeof(struct in_addr); tmp -= sizeof(struct in_addr); } break; case ISIS_TLV_HOSTNAME: ND_PRINT((ndo, ""\n\t Hostname: "")); if (fn_printzp(ndo, tptr, tmp, ndo->ndo_snapend)) goto trunctlv; break; case ISIS_TLV_SHARED_RISK_GROUP: if (tmp < NODE_ID_LEN) break; ND_TCHECK2(*tptr, NODE_ID_LEN); ND_PRINT((ndo, ""\n\t IS Neighbor: %s"", isis_print_id(tptr, NODE_ID_LEN))); tptr+=(NODE_ID_LEN); tmp-=(NODE_ID_LEN); if (tmp < 1) break; ND_TCHECK2(*tptr, 1); ND_PRINT((ndo, "", Flags: [%s]"", ISIS_MASK_TLV_SHARED_RISK_GROUP(*tptr++) ? ""numbered"" : ""unnumbered"")); tmp--; if (tmp < sizeof(struct in_addr)) break; ND_TCHECK2(*tptr, sizeof(struct in_addr)); ND_PRINT((ndo, ""\n\t IPv4 interface address: %s"", ipaddr_string(ndo, tptr))); tptr+=sizeof(struct in_addr); tmp-=sizeof(struct in_addr); if (tmp < sizeof(struct in_addr)) break; ND_TCHECK2(*tptr, sizeof(struct in_addr)); ND_PRINT((ndo, ""\n\t IPv4 neighbor address: %s"", ipaddr_string(ndo, tptr))); tptr+=sizeof(struct in_addr); tmp-=sizeof(struct in_addr); while (tmp>=4) { ND_TCHECK2(*tptr, 4); ND_PRINT((ndo, ""\n\t Link-ID: 0x%08x"", EXTRACT_32BITS(tptr))); tptr+=4; tmp-=4; } break; case ISIS_TLV_LSP: tlv_lsp = (const struct isis_tlv_lsp *)tptr; while(tmp>=sizeof(struct isis_tlv_lsp)) { ND_TCHECK((tlv_lsp->lsp_id)[LSP_ID_LEN-1]); ND_PRINT((ndo, ""\n\t lsp-id: %s"", isis_print_id(tlv_lsp->lsp_id, LSP_ID_LEN))); ND_TCHECK2(tlv_lsp->sequence_number, 4); ND_PRINT((ndo, "", seq: 0x%08x"", EXTRACT_32BITS(tlv_lsp->sequence_number))); ND_TCHECK2(tlv_lsp->remaining_lifetime, 2); ND_PRINT((ndo, "", lifetime: %5ds"", EXTRACT_16BITS(tlv_lsp->remaining_lifetime))); ND_TCHECK2(tlv_lsp->checksum, 2); ND_PRINT((ndo, "", chksum: 0x%04x"", EXTRACT_16BITS(tlv_lsp->checksum))); tmp-=sizeof(struct isis_tlv_lsp); tlv_lsp++; } break; case ISIS_TLV_CHECKSUM: if (tmp < ISIS_TLV_CHECKSUM_MINLEN) break; ND_TCHECK2(*tptr, ISIS_TLV_CHECKSUM_MINLEN); ND_PRINT((ndo, ""\n\t checksum: 0x%04x "", EXTRACT_16BITS(tptr))); /* do not attempt to verify the checksum if it is zero * most likely a HMAC-MD5 TLV is also present and * to avoid conflicts the checksum TLV is zeroed. * see rfc3358 for details */ osi_print_cksum(ndo, optr, EXTRACT_16BITS(tptr), tptr-optr, length); break; case ISIS_TLV_POI: if (tlv_len >= SYSTEM_ID_LEN + 1) { ND_TCHECK2(*tptr, SYSTEM_ID_LEN + 1); ND_PRINT((ndo, ""\n\t Purge Originator System-ID: %s"", isis_print_id(tptr + 1, SYSTEM_ID_LEN))); } if (tlv_len == 2 * SYSTEM_ID_LEN + 1) { ND_TCHECK2(*tptr, 2 * SYSTEM_ID_LEN + 1); ND_PRINT((ndo, ""\n\t Received from System-ID: %s"", isis_print_id(tptr + SYSTEM_ID_LEN + 1, SYSTEM_ID_LEN))); } break; case ISIS_TLV_MT_SUPPORTED: if (tmp < ISIS_TLV_MT_SUPPORTED_MINLEN) break; while (tmp>1) { /* length can only be a multiple of 2, otherwise there is something broken -> so decode down until length is 1 */ if (tmp!=1) { mt_len = isis_print_mtid(ndo, tptr, ""\n\t ""); if (mt_len == 0) /* did something go wrong ? */ goto trunctlv; tptr+=mt_len; tmp-=mt_len; } else { ND_PRINT((ndo, ""\n\t invalid MT-ID"")); break; } } break; case ISIS_TLV_RESTART_SIGNALING: /* first attempt to decode the flags */ if (tmp < ISIS_TLV_RESTART_SIGNALING_FLAGLEN) break; ND_TCHECK2(*tptr, ISIS_TLV_RESTART_SIGNALING_FLAGLEN); ND_PRINT((ndo, ""\n\t Flags [%s]"", bittok2str(isis_restart_flag_values, ""none"", *tptr))); tptr+=ISIS_TLV_RESTART_SIGNALING_FLAGLEN; tmp-=ISIS_TLV_RESTART_SIGNALING_FLAGLEN; /* is there anything other than the flags field? */ if (tmp == 0) break; if (tmp < ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN) break; ND_TCHECK2(*tptr, ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN); ND_PRINT((ndo, "", Remaining holding time %us"", EXTRACT_16BITS(tptr))); tptr+=ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN; tmp-=ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN; /* is there an additional sysid field present ?*/ if (tmp == SYSTEM_ID_LEN) { ND_TCHECK2(*tptr, SYSTEM_ID_LEN); ND_PRINT((ndo, "", for %s"", isis_print_id(tptr,SYSTEM_ID_LEN))); } break; case ISIS_TLV_IDRP_INFO: if (tmp < ISIS_TLV_IDRP_INFO_MINLEN) break; ND_TCHECK2(*tptr, ISIS_TLV_IDRP_INFO_MINLEN); ND_PRINT((ndo, ""\n\t Inter-Domain Information Type: %s"", tok2str(isis_subtlv_idrp_values, ""Unknown (0x%02x)"", *tptr))); switch (*tptr++) { case ISIS_SUBTLV_IDRP_ASN: ND_TCHECK2(*tptr, 2); /* fetch AS number */ ND_PRINT((ndo, ""AS Number: %u"", EXTRACT_16BITS(tptr))); break; case ISIS_SUBTLV_IDRP_LOCAL: case ISIS_SUBTLV_IDRP_RES: default: if (!print_unknown_data(ndo, tptr, ""\n\t "", tlv_len - 1)) return(0); break; } break; case ISIS_TLV_LSP_BUFFERSIZE: if (tmp < ISIS_TLV_LSP_BUFFERSIZE_MINLEN) break; ND_TCHECK2(*tptr, ISIS_TLV_LSP_BUFFERSIZE_MINLEN); ND_PRINT((ndo, ""\n\t LSP Buffersize: %u"", EXTRACT_16BITS(tptr))); break; case ISIS_TLV_PART_DIS: while (tmp >= SYSTEM_ID_LEN) { ND_TCHECK2(*tptr, SYSTEM_ID_LEN); ND_PRINT((ndo, ""\n\t %s"", isis_print_id(tptr, SYSTEM_ID_LEN))); tptr+=SYSTEM_ID_LEN; tmp-=SYSTEM_ID_LEN; } break; case ISIS_TLV_PREFIX_NEIGH: if (tmp < sizeof(struct isis_metric_block)) break; ND_TCHECK2(*tptr, sizeof(struct isis_metric_block)); ND_PRINT((ndo, ""\n\t Metric Block"")); isis_print_metric_block(ndo, (const struct isis_metric_block *)tptr); tptr+=sizeof(struct isis_metric_block); tmp-=sizeof(struct isis_metric_block); while(tmp>0) { ND_TCHECK2(*tptr, 1); prefix_len=*tptr++; /* read out prefix length in semioctets*/ if (prefix_len < 2) { ND_PRINT((ndo, ""\n\t\tAddress: prefix length %u < 2"", prefix_len)); break; } tmp--; if (tmp < prefix_len/2) break; ND_TCHECK2(*tptr, prefix_len / 2); ND_PRINT((ndo, ""\n\t\tAddress: %s/%u"", isonsap_string(ndo, tptr, prefix_len / 2), prefix_len * 4)); tptr+=prefix_len/2; tmp-=prefix_len/2; } break; case ISIS_TLV_IIH_SEQNR: if (tmp < ISIS_TLV_IIH_SEQNR_MINLEN) break; ND_TCHECK2(*tptr, ISIS_TLV_IIH_SEQNR_MINLEN); /* check if four bytes are on the wire */ ND_PRINT((ndo, ""\n\t Sequence number: %u"", EXTRACT_32BITS(tptr))); break; case ISIS_TLV_VENDOR_PRIVATE: if (tmp < ISIS_TLV_VENDOR_PRIVATE_MINLEN) break; ND_TCHECK2(*tptr, ISIS_TLV_VENDOR_PRIVATE_MINLEN); /* check if enough byte for a full oui */ vendor_id = EXTRACT_24BITS(tptr); ND_PRINT((ndo, ""\n\t Vendor: %s (%u)"", tok2str(oui_values, ""Unknown"", vendor_id), vendor_id)); tptr+=3; tmp-=3; if (tmp > 0) /* hexdump the rest */ if (!print_unknown_data(ndo, tptr, ""\n\t\t"", tmp)) return(0); break; /* * FIXME those are the defined TLVs that lack a decoder * you are welcome to contribute code ;-) */ case ISIS_TLV_DECNET_PHASE4: case ISIS_TLV_LUCENT_PRIVATE: case ISIS_TLV_IPAUTH: case ISIS_TLV_NORTEL_PRIVATE1: case ISIS_TLV_NORTEL_PRIVATE2: default: if (ndo->ndo_vflag <= 1) { if (!print_unknown_data(ndo, pptr, ""\n\t\t"", tlv_len)) return(0); } break; } /* do we want to see an additionally hexdump ? */ if (ndo->ndo_vflag> 1) { if (!print_unknown_data(ndo, pptr, ""\n\t "", tlv_len)) return(0); } pptr += tlv_len; packet_len -= tlv_len; } if (packet_len != 0) { ND_PRINT((ndo, ""\n\t %u straggler bytes"", packet_len)); } return (1); trunc: ND_PRINT((ndo, ""%s"", tstr)); return (1); trunctlv: ND_PRINT((ndo, ""\n\t\t"")); ND_PRINT((ndo, ""%s"", tstr)); return(1); } ",1 "static int ghash_setkey(struct crypto_shash *tfm, const u8 *key, unsigned int keylen) { struct ghash_ctx *ctx = crypto_shash_ctx(tfm); if (keylen != GHASH_BLOCK_SIZE) { crypto_shash_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN); return -EINVAL; } memcpy(ctx->key, key, GHASH_BLOCK_SIZE); memset(ctx->icv, 0, GHASH_BLOCK_SIZE); return 0; } ",0 "static inline void php_var_serialize_long(smart_str *buf, zend_long val) /* {{{ */ { smart_str_appendl(buf, ""i:"", 2); smart_str_append_long(buf, val); smart_str_appendc(buf, ';'); } /* }}} */ ",0 "static void pcrypt_fini_padata(struct padata_pcrypt *pcrypt) { free_cpumask_var(pcrypt->cb_cpumask->mask); kfree(pcrypt->cb_cpumask); padata_stop(pcrypt->pinst); padata_unregister_cpumask_notifier(pcrypt->pinst, &pcrypt->nblock); destroy_workqueue(pcrypt->wq); padata_free(pcrypt->pinst); } ",0 "static char *ReadBlobStringWithLongSize(Image *image,char *string,size_t max) { int c; MagickOffsetType offset; register ssize_t i; size_t length; assert(image != (Image *) NULL); assert(image->signature == MagickSignature); assert(max != 0); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"",image->filename); length=ReadBlobMSBLong(image); for (i=0; i < (ssize_t) MagickMin(length,max-1); i++) { c=ReadBlobByte(image); if (c == EOF) return((char *) NULL); string[i]=(char) c; } string[i]='\0'; offset=SeekBlob(image,(MagickOffsetType) (length-i),SEEK_CUR); if (offset < 0) (void) ThrowMagickException(&image->exception,GetMagickModule(), CorruptImageError,""ImproperImageHeader"",""`%s'"",image->filename); return(string); } ",0 "void TestExtensionSystem::CreateExtensionProcessManager() { extension_process_manager_.reset(ExtensionProcessManager::Create(profile_)); } ",0 "DOMHighResTimeStamp PerformanceNavigationTiming::responseEnd() const { DocumentLoadTiming* timing = GetDocumentLoadTiming(); if (!timing) return 0.0; return Performance::MonotonicTimeToDOMHighResTimeStamp( TimeOrigin(), timing->ResponseEnd(), false /* allow_negative_value */); } ",0 " void Run() { RenderProcessHost* host = RenderProcessHost::FromID(render_process_id_); if (host) host->OnMessageReceived(context_menu_message_); } ",0 "bool RenderFrameImpl::IsHidden() { return GetLocalRootRenderWidget()->is_hidden(); } ",0 "static int handle_invept(struct kvm_vcpu *vcpu) { struct vcpu_vmx *vmx = to_vmx(vcpu); u32 vmx_instruction_info, types; unsigned long type; gva_t gva; struct x86_exception e; struct { u64 eptp, gpa; } operand; if (!(vmx->nested.nested_vmx_secondary_ctls_high & SECONDARY_EXEC_ENABLE_EPT) || !(vmx->nested.nested_vmx_ept_caps & VMX_EPT_INVEPT_BIT)) { kvm_queue_exception(vcpu, UD_VECTOR); return 1; } if (!nested_vmx_check_permission(vcpu)) return 1; if (!kvm_read_cr0_bits(vcpu, X86_CR0_PE)) { kvm_queue_exception(vcpu, UD_VECTOR); return 1; } vmx_instruction_info = vmcs_read32(VMX_INSTRUCTION_INFO); type = kvm_register_readl(vcpu, (vmx_instruction_info >> 28) & 0xf); types = (vmx->nested.nested_vmx_ept_caps >> VMX_EPT_EXTENT_SHIFT) & 6; if (!(types & (1UL << type))) { nested_vmx_failValid(vcpu, VMXERR_INVALID_OPERAND_TO_INVEPT_INVVPID); skip_emulated_instruction(vcpu); return 1; } /* According to the Intel VMX instruction reference, the memory * operand is read even if it isn't needed (e.g., for type==global) */ if (get_vmx_mem_address(vcpu, vmcs_readl(EXIT_QUALIFICATION), vmx_instruction_info, false, &gva)) return 1; if (kvm_read_guest_virt(&vcpu->arch.emulate_ctxt, gva, &operand, sizeof(operand), &e)) { kvm_inject_page_fault(vcpu, &e); return 1; } switch (type) { case VMX_EPT_EXTENT_GLOBAL: kvm_mmu_sync_roots(vcpu); kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu); nested_vmx_succeed(vcpu); break; default: /* Trap single context invalidation invept calls */ BUG_ON(1); break; } skip_emulated_instruction(vcpu); return 1; } ",0 "void WebContentsImpl::AttachInterstitialPage( InterstitialPageImpl* interstitial_page) { DCHECK(!interstitial_page_ && interstitial_page); interstitial_page_ = interstitial_page; CancelActiveAndPendingDialogs(); for (auto& observer : observers_) observer.DidAttachInterstitialPage(); if (frame_tree_.IsLoading()) LoadingStateChanged(true, true, nullptr); if (node_.OuterContentsFrameTreeNode()) { if (GetRenderManager()->GetProxyToOuterDelegate()) { DCHECK( static_cast(interstitial_page->GetView()) ->IsRenderWidgetHostViewChildFrame()); RenderWidgetHostViewChildFrame* view = static_cast( interstitial_page->GetView()); GetRenderManager()->SetRWHViewForInnerContents(view); } } #if defined(OS_ANDROID) static_cast(interstitial_page_->GetMainFrame()) ->GetRenderWidgetHost() ->SetImportance(GetMainFrame()->GetRenderWidgetHost()->importance()); #endif } ",0 "static inline bool isPunctuationForFirstLetter(UChar c) { CharCategory charCategory = category(c); return charCategory == Punctuation_Open || charCategory == Punctuation_Close || charCategory == Punctuation_InitialQuote || charCategory == Punctuation_FinalQuote || charCategory == Punctuation_Other; } ",0 " scoped_ptr SynchronousCompositorImpl::DemandDrawHw( gfx::Size surface_size, const gfx::Transform& transform, gfx::Rect viewport, gfx::Rect clip, gfx::Rect viewport_rect_for_tile_priority, const gfx::Transform& transform_for_tile_priority) { DCHECK(CalledOnValidThread()); DCHECK(output_surface_); DCHECK(begin_frame_source_); scoped_ptr frame = output_surface_->DemandDrawHw(surface_size, transform, viewport, clip, viewport_rect_for_tile_priority, transform_for_tile_priority); if (frame.get()) UpdateFrameMetaData(frame->metadata); return frame.Pass(); } ",1 "size_t ZSTD_flushStream(ZSTD_CStream* zcs, ZSTD_outBuffer* output) { ZSTD_inBuffer input = { NULL, 0, 0 }; if (output->pos > output->size) return ERROR(GENERIC); CHECK_F( ZSTD_compressStream_generic(zcs, output, &input, ZSTD_e_flush) ); return zcs->outBuffContentSize - zcs->outBuffFlushedSize; /* remaining to flush */ } ",0 "void EditorClientBlackBerry::didSetSelectionTypesForPasteboard() { notImplemented(); } ",0 " ClickEvent() : ui::Event(ui::ET_UNKNOWN, base::TimeTicks(), 0) {} ",0 "void perf_sample_event_took(u64 sample_len_ns) { u64 max_len = READ_ONCE(perf_sample_allowed_ns); u64 running_len; u64 avg_len; u32 max; if (max_len == 0) return; /* Decay the counter by 1 average sample. */ running_len = __this_cpu_read(running_sample_length); running_len -= running_len/NR_ACCUMULATED_SAMPLES; running_len += sample_len_ns; __this_cpu_write(running_sample_length, running_len); /* * Note: this will be biased artifically low until we have * seen NR_ACCUMULATED_SAMPLES. Doing it this way keeps us * from having to maintain a count. */ avg_len = running_len/NR_ACCUMULATED_SAMPLES; if (avg_len <= max_len) return; __report_avg = avg_len; __report_allowed = max_len; /* * Compute a throttle threshold 25% below the current duration. */ avg_len += avg_len / 4; max = (TICK_NSEC / 100) * sysctl_perf_cpu_time_max_percent; if (avg_len < max) max /= (u32)avg_len; else max = 1; WRITE_ONCE(perf_sample_allowed_ns, avg_len); WRITE_ONCE(max_samples_per_tick, max); sysctl_perf_event_sample_rate = max * HZ; perf_sample_period_ns = NSEC_PER_SEC / sysctl_perf_event_sample_rate; if (!irq_work_queue(&perf_duration_work)) { early_printk(""perf: interrupt took too long (%lld > %lld), lowering "" ""kernel.perf_event_max_sample_rate to %d\n"", __report_avg, __report_allowed, sysctl_perf_event_sample_rate); } } ",0 "gfx::Size BrowserView::GetResizeCornerSize() const { return ResizeCorner::GetSize(); } ",0 "void ExtensionPrefs::MakePathsRelative() { const DictionaryValue* dict = prefs_->GetDictionary(kExtensionsPref); if (!dict || dict->empty()) return; std::set absolute_keys; for (DictionaryValue::key_iterator i = dict->begin_keys(); i != dict->end_keys(); ++i) { DictionaryValue* extension_dict = NULL; if (!dict->GetDictionaryWithoutPathExpansion(*i, &extension_dict)) continue; int location_value; if (extension_dict->GetInteger(kPrefLocation, &location_value) && location_value == Extension::LOAD) { continue; } FilePath::StringType path_string; if (!extension_dict->GetString(kPrefPath, &path_string)) continue; FilePath path(path_string); if (path.IsAbsolute()) absolute_keys.insert(*i); } if (absolute_keys.empty()) return; DictionaryPrefUpdate update(prefs_, kExtensionsPref); const DictionaryValue* update_dict = update.Get(); for (std::set::iterator i = absolute_keys.begin(); i != absolute_keys.end(); ++i) { DictionaryValue* extension_dict = NULL; update_dict->GetDictionaryWithoutPathExpansion(*i, &extension_dict); FilePath::StringType path_string; extension_dict->GetString(kPrefPath, &path_string); FilePath path(path_string); extension_dict->SetString(kPrefPath, MakePathRelative(install_directory_, path)); } SavePrefs(); } ",0 "AccessibilityRole AXNodeObject::remapAriaRoleDueToParent( AccessibilityRole role) const { if (role != ListBoxOptionRole && role != MenuItemRole) return role; for (AXObject* parent = parentObject(); parent && !parent->accessibilityIsIgnored(); parent = parent->parentObject()) { AccessibilityRole parentAriaRole = parent->ariaRoleAttribute(); if (role == ListBoxOptionRole && parentAriaRole == MenuRole) return MenuItemRole; if (role == MenuItemRole && parentAriaRole == GroupRole) return MenuButtonRole; if (parentAriaRole) break; } return role; } ",0 "ptaWriteStream(FILE *fp, PTA *pta, l_int32 type) { l_int32 i, n, ix, iy; l_float32 x, y; PROCNAME(""ptaWriteStream""); if (!fp) return ERROR_INT(""stream not defined"", procName, 1); if (!pta) return ERROR_INT(""pta not defined"", procName, 1); n = ptaGetCount(pta); fprintf(fp, ""\n Pta Version %d\n"", PTA_VERSION_NUMBER); if (type == 0) fprintf(fp, "" Number of pts = %d; format = float\n"", n); else /* type == 1 */ fprintf(fp, "" Number of pts = %d; format = integer\n"", n); for (i = 0; i < n; i++) { if (type == 0) { /* data is float */ ptaGetPt(pta, i, &x, &y); fprintf(fp, "" (%f, %f)\n"", x, y); } else { /* data is integer */ ptaGetIPt(pta, i, &ix, &iy); fprintf(fp, "" (%d, %d)\n"", ix, iy); } } return 0; } ",0 "status_t Camera3Device::PreparerThread::prepare(int maxCount, sp& stream) { status_t res; Mutex::Autolock l(mLock); res = stream->startPrepare(maxCount); if (res == OK) { ALOGV(""%s: Stream %d already prepared"", __FUNCTION__, stream->getId()); if (mListener) { mListener->notifyPrepared(stream->getId()); } return OK; } else if (res != NOT_ENOUGH_DATA) { return res; } if (!mActive) { Thread::requestExitAndWait(); res = Thread::run(""C3PrepThread"", PRIORITY_BACKGROUND); if (res != OK) { ALOGE(""%s: Unable to start preparer stream: %d (%s)"", __FUNCTION__, res, strerror(-res)); if (mListener) { mListener->notifyPrepared(stream->getId()); } return res; } mCancelNow = false; mActive = true; ALOGV(""%s: Preparer stream started"", __FUNCTION__); } mPendingStreams.push_back(stream); ALOGV(""%s: Stream %d queued for preparing"", __FUNCTION__, stream->getId()); return OK; } ",0 "static void aio_complete(struct kiocb *kiocb, long res, long res2) { struct aio_kiocb *iocb = container_of(kiocb, struct aio_kiocb, common); struct kioctx *ctx = iocb->ki_ctx; struct aio_ring *ring; struct io_event *ev_page, *event; unsigned tail, pos, head; unsigned long flags; /* * Special case handling for sync iocbs: * - events go directly into the iocb for fast handling * - the sync task with the iocb in its stack holds the single iocb * ref, no other paths have a way to get another ref * - the sync task helpfully left a reference to itself in the iocb */ BUG_ON(is_sync_kiocb(kiocb)); if (iocb->ki_list.next) { unsigned long flags; spin_lock_irqsave(&ctx->ctx_lock, flags); list_del(&iocb->ki_list); spin_unlock_irqrestore(&ctx->ctx_lock, flags); } /* * Add a completion event to the ring buffer. Must be done holding * ctx->completion_lock to prevent other code from messing with the tail * pointer since we might be called from irq context. */ spin_lock_irqsave(&ctx->completion_lock, flags); tail = ctx->tail; pos = tail + AIO_EVENTS_OFFSET; if (++tail >= ctx->nr_events) tail = 0; ev_page = kmap_atomic(ctx->ring_pages[pos / AIO_EVENTS_PER_PAGE]); event = ev_page + pos % AIO_EVENTS_PER_PAGE; event->obj = (u64)(unsigned long)iocb->ki_user_iocb; event->data = iocb->ki_user_data; event->res = res; event->res2 = res2; kunmap_atomic(ev_page); flush_dcache_page(ctx->ring_pages[pos / AIO_EVENTS_PER_PAGE]); pr_debug(""%p[%u]: %p: %p %Lx %lx %lx\n"", ctx, tail, iocb, iocb->ki_user_iocb, iocb->ki_user_data, res, res2); /* after flagging the request as done, we * must never even look at it again */ smp_wmb(); /* make event visible before updating tail */ ctx->tail = tail; ring = kmap_atomic(ctx->ring_pages[0]); head = ring->head; ring->tail = tail; kunmap_atomic(ring); flush_dcache_page(ctx->ring_pages[0]); ctx->completed_events++; if (ctx->completed_events > 1) refill_reqs_available(ctx, head, tail); spin_unlock_irqrestore(&ctx->completion_lock, flags); pr_debug(""added to ring %p at [%u]\n"", iocb, tail); /* * Check if the user asked us to deliver the result through an * eventfd. The eventfd_signal() function is safe to be called * from IRQ context. */ if (iocb->ki_eventfd != NULL) eventfd_signal(iocb->ki_eventfd, 1); /* everything turned out well, dispose of the aiocb. */ kiocb_free(iocb); /* * We have to order our ring_info tail store above and test * of the wait list below outside the wait lock. This is * like in wake_up_bit() where clearing a bit has to be * ordered with the unlocked test. */ smp_mb(); if (waitqueue_active(&ctx->wait)) wake_up(&ctx->wait); percpu_ref_put(&ctx->reqs); } ",0 "ubik_print(netdissect_options *ndo, register const u_char *bp) { int ubik_op; int32_t temp; /* * Print out the afs call we're invoking. The table used here was * gleaned from ubik/ubik_int.xg */ /* Every function that calls this function first makes a bounds check * for (sizeof(rx_header) + 4) bytes, so long as it remains this way * the line below will not over-read. */ ubik_op = EXTRACT_32BITS(bp + sizeof(struct rx_header)); ND_PRINT((ndo, "" ubik call %s"", tok2str(ubik_req, ""op#%d"", ubik_op))); /* * Decode some of the arguments to the Ubik calls */ bp += sizeof(struct rx_header) + 4; switch (ubik_op) { case 10000: /* Beacon */ ND_TCHECK2(bp[0], 4); temp = EXTRACT_32BITS(bp); bp += sizeof(int32_t); ND_PRINT((ndo, "" syncsite %s"", temp ? ""yes"" : ""no"")); ND_PRINT((ndo, "" votestart"")); DATEOUT(); ND_PRINT((ndo, "" dbversion"")); UBIK_VERSIONOUT(); ND_PRINT((ndo, "" tid"")); UBIK_VERSIONOUT(); break; case 10003: /* Get sync site */ ND_PRINT((ndo, "" site"")); UINTOUT(); break; case 20000: /* Begin */ case 20001: /* Commit */ case 20007: /* Abort */ case 20008: /* Release locks */ case 20010: /* Writev */ ND_PRINT((ndo, "" tid"")); UBIK_VERSIONOUT(); break; case 20002: /* Lock */ ND_PRINT((ndo, "" tid"")); UBIK_VERSIONOUT(); ND_PRINT((ndo, "" file"")); INTOUT(); ND_PRINT((ndo, "" pos"")); INTOUT(); ND_PRINT((ndo, "" length"")); INTOUT(); ND_TCHECK_32BITS(bp); temp = EXTRACT_32BITS(bp); bp += sizeof(int32_t); tok2str(ubik_lock_types, ""type %d"", temp); break; case 20003: /* Write */ ND_PRINT((ndo, "" tid"")); UBIK_VERSIONOUT(); ND_PRINT((ndo, "" file"")); INTOUT(); ND_PRINT((ndo, "" pos"")); INTOUT(); break; case 20005: /* Get file */ ND_PRINT((ndo, "" file"")); INTOUT(); break; case 20006: /* Send file */ ND_PRINT((ndo, "" file"")); INTOUT(); ND_PRINT((ndo, "" length"")); INTOUT(); ND_PRINT((ndo, "" dbversion"")); UBIK_VERSIONOUT(); break; case 20009: /* Truncate */ ND_PRINT((ndo, "" tid"")); UBIK_VERSIONOUT(); ND_PRINT((ndo, "" file"")); INTOUT(); ND_PRINT((ndo, "" length"")); INTOUT(); break; case 20012: /* Set version */ ND_PRINT((ndo, "" tid"")); UBIK_VERSIONOUT(); ND_PRINT((ndo, "" oldversion"")); UBIK_VERSIONOUT(); ND_PRINT((ndo, "" newversion"")); UBIK_VERSIONOUT(); break; default: ; } return; trunc: ND_PRINT((ndo, "" [|ubik]"")); } ",0 "static int ucma_open(struct inode *inode, struct file *filp) { struct ucma_file *file; file = kmalloc(sizeof *file, GFP_KERNEL); if (!file) return -ENOMEM; file->close_wq = create_singlethread_workqueue(""ucma_close_id""); if (!file->close_wq) { kfree(file); return -ENOMEM; } INIT_LIST_HEAD(&file->event_list); INIT_LIST_HEAD(&file->ctx_list); init_waitqueue_head(&file->poll_wait); mutex_init(&file->mut); filp->private_data = file; file->filp = filp; return nonseekable_open(inode, filp); } ",0 "void CorePageLoadMetricsObserver::OnFirstTextPaint( const page_load_metrics::PageLoadTiming& timing, const page_load_metrics::PageLoadExtraInfo& info) { if (WasStartedInForegroundOptionalEventInForeground(timing.first_text_paint, info)) { PAGE_LOAD_HISTOGRAM(internal::kHistogramFirstTextPaintImmediate, timing.first_text_paint.value()); } else { PAGE_LOAD_HISTOGRAM(internal::kBackgroundHistogramFirstTextPaintImmediate, timing.first_text_paint.value()); } } ",0 "static Image *ReadTIFFImage(const ImageInfo *image_info, ExceptionInfo *exception) { #define ThrowTIFFException(severity,message) \ { \ if (tiff_pixels != (unsigned char *) NULL) \ tiff_pixels=(unsigned char *) RelinquishMagickMemory(tiff_pixels); \ if (quantum_info != (QuantumInfo *) NULL) \ quantum_info=DestroyQuantumInfo(quantum_info); \ TIFFClose(tiff); \ ThrowReaderException(severity,message); \ } const char *option; float *chromaticity, x_position, y_position, x_resolution, y_resolution; Image *image; int tiff_status; MagickBooleanType more_frames, status; MagickSizeType number_pixels; QuantumInfo *quantum_info; QuantumType quantum_type; register ssize_t i; size_t pad; ssize_t y; TIFF *tiff; TIFFMethodType method; uint16 compress_tag, bits_per_sample, endian, extra_samples, interlace, max_sample_value, min_sample_value, orientation, pages, photometric, *sample_info, sample_format, samples_per_pixel, units, value; uint32 height, rows_per_strip, width; unsigned char *tiff_pixels; /* Open image. */ 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,exception); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } (void) SetMagickThreadValue(tiff_exception,exception); tiff=TIFFClientOpen(image->filename,""rb"",(thandle_t) image,TIFFReadBlob, TIFFWriteBlob,TIFFSeekBlob,TIFFCloseBlob,TIFFGetBlobSize,TIFFMapBlob, TIFFUnmapBlob); if (tiff == (TIFF *) NULL) { image=DestroyImageList(image); return((Image *) NULL); } if (image_info->number_scenes != 0) { /* Generate blank images for subimage specification (e.g. image.tif[4]. We need to check the number of directores because it is possible that the subimage(s) are stored in the photoshop profile. */ if (image_info->scene < (size_t) TIFFNumberOfDirectories(tiff)) { for (i=0; i < (ssize_t) image_info->scene; i++) { status=TIFFReadDirectory(tiff) != 0 ? MagickTrue : MagickFalse; if (status == MagickFalse) { TIFFClose(tiff); image=DestroyImageList(image); return((Image *) NULL); } AcquireNextImage(image_info,image,exception); if (GetNextImageInList(image) == (Image *) NULL) { TIFFClose(tiff); image=DestroyImageList(image); return((Image *) NULL); } image=SyncNextImageInList(image); } } } more_frames=MagickTrue; do { DisableMSCWarning(4127) if (0 && (image_info->verbose != MagickFalse)) TIFFPrintDirectory(tiff,stdout,MagickFalse); RestoreMSCWarning photometric=PHOTOMETRIC_RGB; if ((TIFFGetField(tiff,TIFFTAG_IMAGEWIDTH,&width) != 1) || (TIFFGetField(tiff,TIFFTAG_IMAGELENGTH,&height) != 1) || (TIFFGetFieldDefaulted(tiff,TIFFTAG_PHOTOMETRIC,&photometric) != 1) || (TIFFGetFieldDefaulted(tiff,TIFFTAG_COMPRESSION,&compress_tag) != 1) || (TIFFGetFieldDefaulted(tiff,TIFFTAG_FILLORDER,&endian) != 1) || (TIFFGetFieldDefaulted(tiff,TIFFTAG_PLANARCONFIG,&interlace) != 1) || (TIFFGetFieldDefaulted(tiff,TIFFTAG_SAMPLESPERPIXEL,&samples_per_pixel) != 1) || (TIFFGetFieldDefaulted(tiff,TIFFTAG_BITSPERSAMPLE,&bits_per_sample) != 1) || (TIFFGetFieldDefaulted(tiff,TIFFTAG_SAMPLEFORMAT,&sample_format) != 1) || (TIFFGetFieldDefaulted(tiff,TIFFTAG_MINSAMPLEVALUE,&min_sample_value) != 1) || (TIFFGetFieldDefaulted(tiff,TIFFTAG_MAXSAMPLEVALUE,&max_sample_value) != 1)) { TIFFClose(tiff); ThrowReaderException(CorruptImageError,""ImproperImageHeader""); } if (sample_format == SAMPLEFORMAT_IEEEFP) (void) SetImageProperty(image,""quantum:format"",""floating-point"", exception); switch (photometric) { case PHOTOMETRIC_MINISBLACK: { (void) SetImageProperty(image,""tiff:photometric"",""min-is-black"", exception); break; } case PHOTOMETRIC_MINISWHITE: { (void) SetImageProperty(image,""tiff:photometric"",""min-is-white"", exception); break; } case PHOTOMETRIC_PALETTE: { (void) SetImageProperty(image,""tiff:photometric"",""palette"",exception); break; } case PHOTOMETRIC_RGB: { (void) SetImageProperty(image,""tiff:photometric"",""RGB"",exception); break; } case PHOTOMETRIC_CIELAB: { (void) SetImageProperty(image,""tiff:photometric"",""CIELAB"",exception); break; } case PHOTOMETRIC_LOGL: { (void) SetImageProperty(image,""tiff:photometric"",""CIE Log2(L)"", exception); break; } case PHOTOMETRIC_LOGLUV: { (void) SetImageProperty(image,""tiff:photometric"",""LOGLUV"",exception); break; } #if defined(PHOTOMETRIC_MASK) case PHOTOMETRIC_MASK: { (void) SetImageProperty(image,""tiff:photometric"",""MASK"",exception); break; } #endif case PHOTOMETRIC_SEPARATED: { (void) SetImageProperty(image,""tiff:photometric"",""separated"",exception); break; } case PHOTOMETRIC_YCBCR: { (void) SetImageProperty(image,""tiff:photometric"",""YCBCR"",exception); break; } default: { (void) SetImageProperty(image,""tiff:photometric"",""unknown"",exception); break; } } if (image->debug != MagickFalse) { (void) LogMagickEvent(CoderEvent,GetMagickModule(),""Geometry: %ux%u"", (unsigned int) width,(unsigned int) height); (void) LogMagickEvent(CoderEvent,GetMagickModule(),""Interlace: %u"", interlace); (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Bits per sample: %u"",bits_per_sample); (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Min sample value: %u"",min_sample_value); (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Max sample value: %u"",max_sample_value); (void) LogMagickEvent(CoderEvent,GetMagickModule(),""Photometric "" ""interpretation: %s"",GetImageProperty(image,""tiff:photometric"", exception)); } image->columns=(size_t) width; image->rows=(size_t) height; image->depth=(size_t) bits_per_sample; if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(),""Image depth: %.20g"", (double) image->depth); image->endian=MSBEndian; if (endian == FILLORDER_LSB2MSB) image->endian=LSBEndian; #if defined(MAGICKCORE_HAVE_TIFFISBIGENDIAN) if (TIFFIsBigEndian(tiff) == 0) { (void) SetImageProperty(image,""tiff:endian"",""lsb"",exception); image->endian=LSBEndian; } else { (void) SetImageProperty(image,""tiff:endian"",""msb"",exception); image->endian=MSBEndian; } #endif if ((photometric == PHOTOMETRIC_MINISBLACK) || (photometric == PHOTOMETRIC_MINISWHITE)) SetImageColorspace(image,GRAYColorspace,exception); if (photometric == PHOTOMETRIC_SEPARATED) SetImageColorspace(image,CMYKColorspace,exception); if (photometric == PHOTOMETRIC_CIELAB) SetImageColorspace(image,LabColorspace,exception); TIFFGetProfiles(tiff,image,exception); TIFFGetProperties(tiff,image,exception); option=GetImageOption(image_info,""tiff:exif-properties""); if (IsStringFalse(option) == MagickFalse) /* enabled by default */ TIFFGetEXIFProperties(tiff,image,exception); (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_SAMPLESPERPIXEL, &samples_per_pixel); if ((TIFFGetFieldDefaulted(tiff,TIFFTAG_XRESOLUTION,&x_resolution) == 1) && (TIFFGetFieldDefaulted(tiff,TIFFTAG_YRESOLUTION,&y_resolution) == 1)) { image->resolution.x=x_resolution; image->resolution.y=y_resolution; } if (TIFFGetFieldDefaulted(tiff,TIFFTAG_RESOLUTIONUNIT,&units) == 1) { if (units == RESUNIT_INCH) image->units=PixelsPerInchResolution; if (units == RESUNIT_CENTIMETER) image->units=PixelsPerCentimeterResolution; } if ((TIFFGetFieldDefaulted(tiff,TIFFTAG_XPOSITION,&x_position) == 1) && (TIFFGetFieldDefaulted(tiff,TIFFTAG_YPOSITION,&y_position) == 1)) { image->page.x=(ssize_t) ceil(x_position*image->resolution.x-0.5); image->page.y=(ssize_t) ceil(y_position*image->resolution.y-0.5); } if (TIFFGetFieldDefaulted(tiff,TIFFTAG_ORIENTATION,&orientation) == 1) image->orientation=(OrientationType) orientation; if (TIFFGetField(tiff,TIFFTAG_WHITEPOINT,&chromaticity) == 1) { if (chromaticity != (float *) NULL) { image->chromaticity.white_point.x=chromaticity[0]; image->chromaticity.white_point.y=chromaticity[1]; } } if (TIFFGetField(tiff,TIFFTAG_PRIMARYCHROMATICITIES,&chromaticity) == 1) { if (chromaticity != (float *) NULL) { image->chromaticity.red_primary.x=chromaticity[0]; image->chromaticity.red_primary.y=chromaticity[1]; image->chromaticity.green_primary.x=chromaticity[2]; image->chromaticity.green_primary.y=chromaticity[3]; image->chromaticity.blue_primary.x=chromaticity[4]; image->chromaticity.blue_primary.y=chromaticity[5]; } } #if defined(MAGICKCORE_HAVE_TIFFISCODECCONFIGURED) || (TIFFLIB_VERSION > 20040919) if ((compress_tag != COMPRESSION_NONE) && (TIFFIsCODECConfigured(compress_tag) == 0)) { TIFFClose(tiff); ThrowReaderException(CoderError,""CompressNotSupported""); } #endif switch (compress_tag) { case COMPRESSION_NONE: image->compression=NoCompression; break; case COMPRESSION_CCITTFAX3: image->compression=FaxCompression; break; case COMPRESSION_CCITTFAX4: image->compression=Group4Compression; break; case COMPRESSION_JPEG: { image->compression=JPEGCompression; #if defined(JPEG_SUPPORT) { char sampling_factor[MagickPathExtent]; uint16 horizontal, vertical; tiff_status=TIFFGetField(tiff,TIFFTAG_YCBCRSUBSAMPLING,&horizontal, &vertical); if (tiff_status == 1) { (void) FormatLocaleString(sampling_factor,MagickPathExtent, ""%dx%d"",horizontal,vertical); (void) SetImageProperty(image,""jpeg:sampling-factor"", sampling_factor,exception); (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Sampling Factors: %s"",sampling_factor); } } #endif break; } case COMPRESSION_OJPEG: image->compression=JPEGCompression; break; #if defined(COMPRESSION_LZMA) case COMPRESSION_LZMA: image->compression=LZMACompression; break; #endif case COMPRESSION_LZW: image->compression=LZWCompression; break; case COMPRESSION_DEFLATE: image->compression=ZipCompression; break; case COMPRESSION_ADOBE_DEFLATE: image->compression=ZipCompression; break; default: image->compression=RLECompression; break; } quantum_info=(QuantumInfo *) NULL; if ((photometric == PHOTOMETRIC_PALETTE) && (pow(2.0,1.0*bits_per_sample) <= MaxColormapSize)) { size_t colors; colors=(size_t) GetQuantumRange(bits_per_sample)+1; if (AcquireImageColormap(image,colors,exception) == MagickFalse) { TIFFClose(tiff); ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); } } value=(unsigned short) image->scene; if (TIFFGetFieldDefaulted(tiff,TIFFTAG_PAGENUMBER,&value,&pages) == 1) image->scene=value; if (image->storage_class == PseudoClass) { size_t range; uint16 *blue_colormap, *green_colormap, *red_colormap; /* Initialize colormap. */ tiff_status=TIFFGetField(tiff,TIFFTAG_COLORMAP,&red_colormap, &green_colormap,&blue_colormap); if (tiff_status == 1) { if ((red_colormap != (uint16 *) NULL) && (green_colormap != (uint16 *) NULL) && (blue_colormap != (uint16 *) NULL)) { range=255; /* might be old style 8-bit colormap */ for (i=0; i < (ssize_t) image->colors; i++) if ((red_colormap[i] >= 256) || (green_colormap[i] >= 256) || (blue_colormap[i] >= 256)) { range=65535; break; } for (i=0; i < (ssize_t) image->colors; i++) { image->colormap[i].red=ClampToQuantum(((double) QuantumRange*red_colormap[i])/range); image->colormap[i].green=ClampToQuantum(((double) QuantumRange*green_colormap[i])/range); image->colormap[i].blue=ClampToQuantum(((double) QuantumRange*blue_colormap[i])/range); } } } } if (image_info->ping != MagickFalse) { if (image_info->number_scenes != 0) if (image->scene >= (image_info->scene+image_info->number_scenes-1)) break; goto next_tiff_frame; } status=SetImageExtent(image,image->columns,image->rows,exception); if (status == MagickFalse) { TIFFClose(tiff); return(DestroyImageList(image)); } status=ResetImagePixels(image,exception); if (status == MagickFalse) { TIFFClose(tiff); return(DestroyImageList(image)); } /* Allocate memory for the image and pixel buffer. */ tiff_pixels=(unsigned char *) NULL; quantum_info=AcquireQuantumInfo(image_info,image); if (quantum_info == (QuantumInfo *) NULL) ThrowTIFFException(ResourceLimitError,""MemoryAllocationFailed""); if (sample_format == SAMPLEFORMAT_UINT) status=SetQuantumFormat(image,quantum_info,UnsignedQuantumFormat); if (sample_format == SAMPLEFORMAT_INT) status=SetQuantumFormat(image,quantum_info,SignedQuantumFormat); if (sample_format == SAMPLEFORMAT_IEEEFP) status=SetQuantumFormat(image,quantum_info,FloatingPointQuantumFormat); if (status == MagickFalse) ThrowTIFFException(ResourceLimitError,""MemoryAllocationFailed""); status=MagickTrue; switch (photometric) { case PHOTOMETRIC_MINISBLACK: { quantum_info->min_is_white=MagickFalse; break; } case PHOTOMETRIC_MINISWHITE: { quantum_info->min_is_white=MagickTrue; break; } default: break; } tiff_status=TIFFGetFieldDefaulted(tiff,TIFFTAG_EXTRASAMPLES,&extra_samples, &sample_info); if (tiff_status == 1) { (void) SetImageProperty(image,""tiff:alpha"",""unspecified"",exception); if (extra_samples == 0) { if ((samples_per_pixel == 4) && (photometric == PHOTOMETRIC_RGB)) image->alpha_trait=BlendPixelTrait; } else for (i=0; i < extra_samples; i++) { image->alpha_trait=BlendPixelTrait; if (sample_info[i] == EXTRASAMPLE_ASSOCALPHA) { SetQuantumAlphaType(quantum_info,DisassociatedQuantumAlpha); (void) SetImageProperty(image,""tiff:alpha"",""associated"", exception); } else if (sample_info[i] == EXTRASAMPLE_UNASSALPHA) (void) SetImageProperty(image,""tiff:alpha"",""unassociated"", exception); } } if (image->alpha_trait != UndefinedPixelTrait) (void) SetImageAlphaChannel(image,OpaqueAlphaChannel,exception); method=ReadGenericMethod; rows_per_strip=(uint32) image->rows; if (TIFFGetField(tiff,TIFFTAG_ROWSPERSTRIP,&rows_per_strip) == 1) { char buffer[MagickPathExtent]; method=ReadStripMethod; (void) FormatLocaleString(buffer,MagickPathExtent,""%u"", (unsigned int) rows_per_strip); (void) SetImageProperty(image,""tiff:rows-per-strip"",buffer,exception); } if (rows_per_strip > (uint32) image->rows) rows_per_strip=(uint32) image->rows; if ((samples_per_pixel >= 3) && (interlace == PLANARCONFIG_CONTIG)) if ((image->alpha_trait == UndefinedPixelTrait) || (samples_per_pixel >= 4)) method=ReadRGBAMethod; if ((samples_per_pixel >= 4) && (interlace == PLANARCONFIG_SEPARATE)) if ((image->alpha_trait == UndefinedPixelTrait) || (samples_per_pixel >= 5)) method=ReadCMYKAMethod; if ((photometric != PHOTOMETRIC_RGB) && (photometric != PHOTOMETRIC_CIELAB) && (photometric != PHOTOMETRIC_SEPARATED)) method=ReadGenericMethod; if (image->storage_class == PseudoClass) method=ReadSingleSampleMethod; if ((photometric == PHOTOMETRIC_MINISBLACK) || (photometric == PHOTOMETRIC_MINISWHITE)) method=ReadSingleSampleMethod; if ((photometric != PHOTOMETRIC_SEPARATED) && (interlace == PLANARCONFIG_SEPARATE) && (bits_per_sample < 64)) method=ReadGenericMethod; if (image->compression == JPEGCompression) method=GetJPEGMethod(image,tiff,photometric,bits_per_sample, samples_per_pixel); if (compress_tag == COMPRESSION_JBIG) method=ReadStripMethod; if (TIFFIsTiled(tiff) != MagickFalse) method=ReadTileMethod; quantum_info->endian=LSBEndian; quantum_type=RGBQuantum; if (TIFFScanlineSize(tiff) <= 0) ThrowTIFFException(ResourceLimitError,""MemoryAllocationFailed""); if (((MagickSizeType) TIFFScanlineSize(tiff)) > GetBlobSize(image)) ThrowTIFFException(CorruptImageError,""InsufficientImageDataInFile""); number_pixels=MagickMax(TIFFScanlineSize(tiff),MagickMax((ssize_t) image->columns*samples_per_pixel*pow(2.0,ceil(log(bits_per_sample)/ log(2.0))),image->columns*rows_per_strip)*sizeof(uint32)); tiff_pixels=(unsigned char *) AcquireMagickMemory(number_pixels); if (tiff_pixels == (unsigned char *) NULL) ThrowTIFFException(ResourceLimitError,""MemoryAllocationFailed""); (void) ResetMagickMemory(tiff_pixels,0,number_pixels); switch (method) { case ReadSingleSampleMethod: { /* Convert TIFF image to PseudoClass MIFF image. */ quantum_type=IndexQuantum; pad=(size_t) MagickMax((ssize_t) samples_per_pixel-1,0); if (image->alpha_trait != UndefinedPixelTrait) { if (image->storage_class != PseudoClass) { quantum_type=samples_per_pixel == 1 ? AlphaQuantum : GrayAlphaQuantum; pad=(size_t) MagickMax((ssize_t) samples_per_pixel-2,0); } else { quantum_type=IndexAlphaQuantum; pad=(size_t) MagickMax((ssize_t) samples_per_pixel-2,0); } } else if (image->storage_class != PseudoClass) { quantum_type=GrayQuantum; pad=(size_t) MagickMax((ssize_t) samples_per_pixel-1,0); } status=SetQuantumPad(image,quantum_info,pad*pow(2,ceil(log( bits_per_sample)/log(2)))); if (status == MagickFalse) ThrowTIFFException(ResourceLimitError,""MemoryAllocationFailed""); for (y=0; y < (ssize_t) image->rows; y++) { register Quantum *magick_restrict q; tiff_status=TIFFReadPixels(tiff,0,y,(char *) tiff_pixels); if (tiff_status == -1) break; q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) break; (void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info, quantum_type,tiff_pixels,exception); if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } } break; } case ReadRGBAMethod: { /* Convert TIFF image to DirectClass MIFF image. */ pad=(size_t) MagickMax((size_t) samples_per_pixel-3,0); quantum_type=RGBQuantum; if (image->alpha_trait != UndefinedPixelTrait) { quantum_type=RGBAQuantum; pad=(size_t) MagickMax((size_t) samples_per_pixel-4,0); } if (image->colorspace == CMYKColorspace) { pad=(size_t) MagickMax((size_t) samples_per_pixel-4,0); quantum_type=CMYKQuantum; if (image->alpha_trait != UndefinedPixelTrait) { quantum_type=CMYKAQuantum; pad=(size_t) MagickMax((size_t) samples_per_pixel-5,0); } } status=SetQuantumPad(image,quantum_info,pad*((bits_per_sample+7) >> 3)); if (status == MagickFalse) ThrowTIFFException(ResourceLimitError,""MemoryAllocationFailed""); for (y=0; y < (ssize_t) image->rows; y++) { register Quantum *magick_restrict q; tiff_status=TIFFReadPixels(tiff,0,y,(char *) tiff_pixels); if (tiff_status == -1) break; q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) break; (void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info, quantum_type,tiff_pixels,exception); if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } } break; } case ReadCMYKAMethod: { /* Convert TIFF image to DirectClass MIFF image. */ for (i=0; i < (ssize_t) samples_per_pixel; i++) { for (y=0; y < (ssize_t) image->rows; y++) { register Quantum *magick_restrict q; tiff_status=TIFFReadPixels(tiff,(tsample_t) i,y,(char *) tiff_pixels); if (tiff_status == -1) break; q=GetAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) break; if (image->colorspace != CMYKColorspace) switch (i) { case 0: quantum_type=RedQuantum; break; case 1: quantum_type=GreenQuantum; break; case 2: quantum_type=BlueQuantum; break; case 3: quantum_type=AlphaQuantum; break; default: quantum_type=UndefinedQuantum; break; } else switch (i) { case 0: quantum_type=CyanQuantum; break; case 1: quantum_type=MagentaQuantum; break; case 2: quantum_type=YellowQuantum; break; case 3: quantum_type=BlackQuantum; break; case 4: quantum_type=AlphaQuantum; break; default: quantum_type=UndefinedQuantum; break; } (void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info, quantum_type,tiff_pixels,exception); if (SyncAuthenticPixels(image,exception) == MagickFalse) break; } if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } } break; } case ReadYCCKMethod: { for (y=0; y < (ssize_t) image->rows; y++) { register Quantum *magick_restrict q; register ssize_t x; unsigned char *p; tiff_status=TIFFReadPixels(tiff,0,y,(char *) tiff_pixels); if (tiff_status == -1) break; q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) break; p=tiff_pixels; for (x=0; x < (ssize_t) image->columns; x++) { SetPixelCyan(image,ScaleCharToQuantum(ClampYCC((double) *p+ (1.402*(double) *(p+2))-179.456)),q); SetPixelMagenta(image,ScaleCharToQuantum(ClampYCC((double) *p- (0.34414*(double) *(p+1))-(0.71414*(double ) *(p+2))+ 135.45984)),q); SetPixelYellow(image,ScaleCharToQuantum(ClampYCC((double) *p+ (1.772*(double) *(p+1))-226.816)),q); SetPixelBlack(image,ScaleCharToQuantum((unsigned char) *(p+3)),q); q+=GetPixelChannels(image); p+=4; } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } } break; } case ReadStripMethod: { register uint32 *p; /* Convert stripped TIFF image to DirectClass MIFF image. */ i=0; p=(uint32 *) NULL; for (y=0; y < (ssize_t) image->rows; y++) { register ssize_t x; register Quantum *magick_restrict q; q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) break; if (i == 0) { if (TIFFReadRGBAStrip(tiff,(tstrip_t) y,(uint32 *) tiff_pixels) == 0) break; i=(ssize_t) MagickMin((ssize_t) rows_per_strip,(ssize_t) image->rows-y); } i--; p=((uint32 *) tiff_pixels)+image->columns*i; for (x=0; x < (ssize_t) image->columns; x++) { SetPixelRed(image,ScaleCharToQuantum((unsigned char) (TIFFGetR(*p))),q); SetPixelGreen(image,ScaleCharToQuantum((unsigned char) (TIFFGetG(*p))),q); SetPixelBlue(image,ScaleCharToQuantum((unsigned char) (TIFFGetB(*p))),q); if (image->alpha_trait != UndefinedPixelTrait) SetPixelAlpha(image,ScaleCharToQuantum((unsigned char) (TIFFGetA(*p))),q); p++; q+=GetPixelChannels(image); } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } } break; } case ReadTileMethod: { register uint32 *p; uint32 *tile_pixels, columns, rows; /* Convert tiled TIFF image to DirectClass MIFF image. */ if ((TIFFGetField(tiff,TIFFTAG_TILEWIDTH,&columns) != 1) || (TIFFGetField(tiff,TIFFTAG_TILELENGTH,&rows) != 1)) ThrowTIFFException(CoderError,""ImageIsNotTiled""); if ((AcquireMagickResource(WidthResource,columns) == MagickFalse) || (AcquireMagickResource(HeightResource,rows) == MagickFalse)) ThrowTIFFException(ImageError,""WidthOrHeightExceedsLimit""); (void) SetImageStorageClass(image,DirectClass,exception); number_pixels=(MagickSizeType) columns*rows; if (HeapOverflowSanityCheck(rows,sizeof(*tile_pixels)) != MagickFalse) ThrowTIFFException(ResourceLimitError,""MemoryAllocationFailed""); tile_pixels=(uint32 *) AcquireQuantumMemory(columns,rows* sizeof(*tile_pixels)); if (tile_pixels == (uint32 *) NULL) ThrowTIFFException(ResourceLimitError,""MemoryAllocationFailed""); for (y=0; y < (ssize_t) image->rows; y+=rows) { register ssize_t x; register Quantum *magick_restrict q, *magick_restrict tile; size_t columns_remaining, rows_remaining; rows_remaining=image->rows-y; if ((ssize_t) (y+rows) < (ssize_t) image->rows) rows_remaining=rows; tile=QueueAuthenticPixels(image,0,y,image->columns,rows_remaining, exception); if (tile == (Quantum *) NULL) break; for (x=0; x < (ssize_t) image->columns; x+=columns) { size_t column, row; if (TIFFReadRGBATile(tiff,(uint32) x,(uint32) y,tile_pixels) == 0) break; columns_remaining=image->columns-x; if ((ssize_t) (x+columns) < (ssize_t) image->columns) columns_remaining=columns; p=tile_pixels+(rows-rows_remaining)*columns; q=tile+GetPixelChannels(image)*(image->columns*(rows_remaining-1)+ x); for (row=rows_remaining; row > 0; row--) { if (image->alpha_trait != UndefinedPixelTrait) for (column=columns_remaining; column > 0; column--) { SetPixelRed(image,ScaleCharToQuantum((unsigned char) TIFFGetR(*p)),q); SetPixelGreen(image,ScaleCharToQuantum((unsigned char) TIFFGetG(*p)),q); SetPixelBlue(image,ScaleCharToQuantum((unsigned char) TIFFGetB(*p)),q); SetPixelAlpha(image,ScaleCharToQuantum((unsigned char) TIFFGetA(*p)),q); p++; q+=GetPixelChannels(image); } else for (column=columns_remaining; column > 0; column--) { SetPixelRed(image,ScaleCharToQuantum((unsigned char) TIFFGetR(*p)),q); SetPixelGreen(image,ScaleCharToQuantum((unsigned char) TIFFGetG(*p)),q); SetPixelBlue(image,ScaleCharToQuantum((unsigned char) TIFFGetB(*p)),q); p++; q+=GetPixelChannels(image); } p+=columns-columns_remaining; q-=GetPixelChannels(image)*(image->columns+columns_remaining); } } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } } tile_pixels=(uint32 *) RelinquishMagickMemory(tile_pixels); break; } case ReadGenericMethod: default: { MemoryInfo *pixel_info; register uint32 *p; uint32 *pixels; /* Convert TIFF image to DirectClass MIFF image. */ number_pixels=(MagickSizeType) image->columns*image->rows; if (HeapOverflowSanityCheck(image->rows,sizeof(*pixels)) != MagickFalse) ThrowTIFFException(ResourceLimitError,""MemoryAllocationFailed""); pixel_info=AcquireVirtualMemory(image->columns,image->rows* sizeof(uint32)); if (pixel_info == (MemoryInfo *) NULL) ThrowTIFFException(ResourceLimitError,""MemoryAllocationFailed""); pixels=(uint32 *) GetVirtualMemoryBlob(pixel_info); (void) TIFFReadRGBAImage(tiff,(uint32) image->columns,(uint32) image->rows,(uint32 *) pixels,0); /* Convert image to DirectClass pixel packets. */ p=pixels+number_pixels-1; for (y=0; y < (ssize_t) image->rows; y++) { register ssize_t x; register Quantum *magick_restrict q; q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) break; q+=GetPixelChannels(image)*(image->columns-1); for (x=0; x < (ssize_t) image->columns; x++) { SetPixelRed(image,ScaleCharToQuantum((unsigned char) TIFFGetR(*p)),q); SetPixelGreen(image,ScaleCharToQuantum((unsigned char) TIFFGetG(*p)),q); SetPixelBlue(image,ScaleCharToQuantum((unsigned char) TIFFGetB(*p)),q); if (image->alpha_trait != UndefinedPixelTrait) SetPixelAlpha(image,ScaleCharToQuantum((unsigned char) TIFFGetA(*p)),q); p--; q-=GetPixelChannels(image); } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } } pixel_info=RelinquishVirtualMemory(pixel_info); break; } } tiff_pixels=(unsigned char *) RelinquishMagickMemory(tiff_pixels); SetQuantumImageType(image,quantum_type); next_tiff_frame: if (quantum_info != (QuantumInfo *) NULL) quantum_info=DestroyQuantumInfo(quantum_info); if (photometric == PHOTOMETRIC_CIELAB) DecodeLabImage(image,exception); if ((photometric == PHOTOMETRIC_LOGL) || (photometric == PHOTOMETRIC_MINISBLACK) || (photometric == PHOTOMETRIC_MINISWHITE)) { image->type=GrayscaleType; if (bits_per_sample == 1) image->type=BilevelType; } /* Proceed to next image. */ if (image_info->number_scenes != 0) if (image->scene >= (image_info->scene+image_info->number_scenes-1)) break; more_frames=TIFFReadDirectory(tiff) != 0 ? MagickTrue : MagickFalse; if (more_frames != MagickFalse) { /* Allocate next image structure. */ AcquireNextImage(image_info,image,exception); if (GetNextImageInList(image) == (Image *) NULL) { status=MagickFalse; break; } image=SyncNextImageInList(image); status=SetImageProgress(image,LoadImagesTag,image->scene-1, image->scene); if (status == MagickFalse) break; } } while ((status != MagickFalse) && (more_frames != MagickFalse)); TIFFClose(tiff); TIFFReadPhotoshopLayers(image,image_info,exception); if ((image_info->number_scenes != 0) && (image_info->scene >= GetImageListLength(image))) status=MagickFalse; if (status == MagickFalse) return(DestroyImageList(image)); return(GetFirstImageInList(image)); } ",0 "_rpc_terminate_batch_job(uint32_t job_id, uint32_t user_id, char *node_name) { int rc = SLURM_SUCCESS; int nsteps = 0; int delay; time_t now = time(NULL); slurm_ctl_conf_t *cf; job_env_t job_env; task_g_slurmd_release_resources(job_id); if (_waiter_init(job_id) == SLURM_ERROR) return; /* * ""revoke"" all future credentials for this jobid */ _note_batch_job_finished(job_id); if (slurm_cred_revoke(conf->vctx, job_id, now, now) < 0) { debug(""revoking cred for job %u: %m"", job_id); } else { save_cred_state(conf->vctx); debug(""credential for job %u revoked"", job_id); } /* * Tasks might be stopped (possibly by a debugger) * so send SIGCONT first. */ _kill_all_active_steps(job_id, SIGCONT, true); if (errno == ESLURMD_STEP_SUSPENDED) { /* * If the job step is currently suspended, we don't * bother with a ""nice"" termination. */ debug2(""Job is currently suspended, terminating""); nsteps = _terminate_all_steps(job_id, true); } else { nsteps = _kill_all_active_steps(job_id, SIGTERM, true); } #ifndef HAVE_AIX if ((nsteps == 0) && !conf->epilog) { slurm_cred_begin_expiration(conf->vctx, job_id); save_cred_state(conf->vctx); _waiter_complete(job_id); if (container_g_delete(job_id)) error(""container_g_delete(%u): %m"", job_id); _launch_complete_rm(job_id); return; } #endif /* * Check for corpses */ cf = slurm_conf_lock(); delay = MAX(cf->kill_wait, 5); slurm_conf_unlock(); if (!_pause_for_job_completion(job_id, NULL, delay) && _terminate_all_steps(job_id, true) ) { /* * Block until all user processes are complete. */ _pause_for_job_completion(job_id, NULL, 0); } /* * Begin expiration period for cached information about job. * If expiration period has already begun, then do not run * the epilog again, as that script has already been executed * for this job. */ if (slurm_cred_begin_expiration(conf->vctx, job_id) < 0) { debug(""Not running epilog for jobid %d: %m"", job_id); goto done; } save_cred_state(conf->vctx); memset(&job_env, 0, sizeof(job_env_t)); job_env.jobid = job_id; job_env.node_list = node_name; job_env.uid = (uid_t)user_id; /* NOTE: We lack the job's SPANK environment variables */ rc = _run_epilog(&job_env); if (rc) { int term_sig, exit_status; if (WIFSIGNALED(rc)) { exit_status = 0; term_sig = WTERMSIG(rc); } else { exit_status = WEXITSTATUS(rc); term_sig = 0; } error(""[job %u] epilog failed status=%d:%d"", job_id, exit_status, term_sig); } else debug(""completed epilog for jobid %u"", job_id); if (container_g_delete(job_id)) error(""container_g_delete(%u): %m"", job_id); _launch_complete_rm(job_id); done: _wait_state_completed(job_id, 5); _waiter_complete(job_id); } ",0 "static int vsse16_c(/*MpegEncContext*/ void *c, uint8_t *s1, uint8_t *s2, int stride, int h){ int score=0; int x,y; for(y=1; yentry) return 0; sgpd_entries = av_malloc_array(track->entry, sizeof(*sgpd_entries)); if (!sgpd_entries) return AVERROR(ENOMEM); av_assert0(track->par->codec_id == AV_CODEC_ID_OPUS || track->par->codec_id == AV_CODEC_ID_AAC); if (track->par->codec_id == AV_CODEC_ID_OPUS) { for (i = 0; i < track->entry; i++) { int roll_samples_remaining = roll_samples; int distance = 0; for (j = i - 1; j >= 0; j--) { roll_samples_remaining -= get_cluster_duration(track, j); distance++; if (roll_samples_remaining <= 0) break; } /* We don't have enough preceeding samples to compute a valid roll_distance here, so this sample can't be independently decoded. */ if (roll_samples_remaining > 0) distance = 0; /* Verify distance is a minimum of 2 (60ms) packets and a maximum of 32 (2.5ms) packets. */ av_assert0(distance == 0 || (distance >= 2 && distance <= 32)); if (i && distance == sgpd_entries[entries].roll_distance) { sgpd_entries[entries].count++; } else { entries++; sgpd_entries[entries].count = 1; sgpd_entries[entries].roll_distance = distance; sgpd_entries[entries].group_description_index = distance ? ++group : 0; } } } else { entries++; sgpd_entries[entries].count = track->sample_count; sgpd_entries[entries].roll_distance = 1; sgpd_entries[entries].group_description_index = ++group; } entries++; if (!group) { av_free(sgpd_entries); return 0; } /* Write sgpd tag */ avio_wb32(pb, 24 + (group * 2)); /* size */ ffio_wfourcc(pb, ""sgpd""); avio_wb32(pb, 1 << 24); /* fullbox */ ffio_wfourcc(pb, ""roll""); avio_wb32(pb, 2); /* default_length */ avio_wb32(pb, group); /* entry_count */ for (i = 0; i < entries; i++) { if (sgpd_entries[i].group_description_index) { avio_wb16(pb, -sgpd_entries[i].roll_distance); /* roll_distance */ } } /* Write sbgp tag */ avio_wb32(pb, 20 + (entries * 8)); /* size */ ffio_wfourcc(pb, ""sbgp""); avio_wb32(pb, 0); /* fullbox */ ffio_wfourcc(pb, ""roll""); avio_wb32(pb, entries); /* entry_count */ for (i = 0; i < entries; i++) { avio_wb32(pb, sgpd_entries[i].count); /* sample_count */ avio_wb32(pb, sgpd_entries[i].group_description_index); /* group_description_index */ } av_free(sgpd_entries); return 0; } ",0 "static int nfs4_read_done(struct rpc_task *task, struct nfs_pgio_header *hdr) { dprintk(""--> %s\n"", __func__); if (!nfs4_sequence_done(task, &hdr->res.seq_res)) return -EAGAIN; if (nfs4_read_stateid_changed(task, &hdr->args)) return -EAGAIN; return hdr->pgio_done_cb ? hdr->pgio_done_cb(task, hdr) : nfs4_read_done_cb(task, hdr); } ",0 "static void delete_and_unsubscribe_port(struct snd_seq_client *client, struct snd_seq_client_port *port, struct snd_seq_subscribers *subs, bool is_src, bool ack) { struct snd_seq_port_subs_info *grp; struct list_head *list; bool empty; grp = is_src ? &port->c_src : &port->c_dest; list = is_src ? &subs->src_list : &subs->dest_list; down_write(&grp->list_mutex); write_lock_irq(&grp->list_lock); empty = list_empty(list); if (!empty) list_del_init(list); grp->exclusive = 0; write_unlock_irq(&grp->list_lock); up_write(&grp->list_mutex); if (!empty) unsubscribe_port(client, port, grp, &subs->info, ack); } ",0 "__nfs4_get_fd(struct nfs4_file *f, int oflag) { if (f->fi_fds[oflag]) return get_file(f->fi_fds[oflag]); return NULL; } ",0 "ofputil_encode_tlv_table_reply(const struct ofp_header *oh, struct ofputil_tlv_table_reply *ttr) { struct ofpbuf *b; struct nx_tlv_table_reply *nx_ttr; b = ofpraw_alloc_reply(OFPRAW_NXT_TLV_TABLE_REPLY, oh, 0); nx_ttr = ofpbuf_put_zeros(b, sizeof *nx_ttr); nx_ttr->max_option_space = htonl(ttr->max_option_space); nx_ttr->max_fields = htons(ttr->max_fields); encode_tlv_table_mappings(b, &ttr->mappings); return b; } ",0 "static int ok_pkt(git_pkt **out, const char *line, size_t len) { git_pkt_ok *pkt; const char *ptr; size_t alloc_len; pkt = git__malloc(sizeof(*pkt)); GITERR_CHECK_ALLOC(pkt); pkt->type = GIT_PKT_OK; line += 3; /* skip ""ok "" */ if (!(ptr = strchr(line, '\n'))) { giterr_set(GITERR_NET, ""invalid packet line""); git__free(pkt); return -1; } len = ptr - line; GITERR_CHECK_ALLOC_ADD(&alloc_len, len, 1); pkt->ref = git__malloc(alloc_len); GITERR_CHECK_ALLOC(pkt->ref); memcpy(pkt->ref, line, len); pkt->ref[len] = '\0'; *out = (git_pkt *)pkt; return 0; } ",0 "static int netlink_sendmsg(struct kiocb *kiocb, struct socket *sock, struct msghdr *msg, size_t len) { struct sock_iocb *siocb = kiocb_to_siocb(kiocb); struct sock *sk = sock->sk; struct netlink_sock *nlk = nlk_sk(sk); struct sockaddr_nl *addr = msg->msg_name; u32 dst_pid; u32 dst_group; struct sk_buff *skb; int err; struct scm_cookie scm; if (msg->msg_flags&MSG_OOB) return -EOPNOTSUPP; if (NULL == siocb->scm) siocb->scm = &scm; err = scm_send(sock, msg, siocb->scm, true); if (err < 0) return err; if (msg->msg_namelen) { err = -EINVAL; if (addr->nl_family != AF_NETLINK) goto out; dst_pid = addr->nl_pid; dst_group = ffs(addr->nl_groups); err = -EPERM; if (dst_group && !netlink_capable(sock, NL_NONROOT_SEND)) goto out; } else { dst_pid = nlk->dst_pid; dst_group = nlk->dst_group; } if (!nlk->pid) { err = netlink_autobind(sock); if (err) goto out; } err = -EMSGSIZE; if (len > sk->sk_sndbuf - 32) goto out; err = -ENOBUFS; skb = alloc_skb(len, GFP_KERNEL); if (skb == NULL) goto out; NETLINK_CB(skb).pid = nlk->pid; NETLINK_CB(skb).dst_group = dst_group; memcpy(NETLINK_CREDS(skb), &siocb->scm->creds, sizeof(struct ucred)); err = -EFAULT; if (memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len)) { kfree_skb(skb); goto out; } err = security_netlink_send(sk, skb); if (err) { kfree_skb(skb); goto out; } if (dst_group) { atomic_inc(&skb->users); netlink_broadcast(sk, skb, dst_pid, dst_group, GFP_KERNEL); } err = netlink_unicast(sk, skb, dst_pid, msg->msg_flags&MSG_DONTWAIT); out: scm_destroy(siocb->scm); return err; } ",1 "static int vhost_scsi_deregister(void) { return misc_deregister(&vhost_scsi_misc); } ",0 "void PrintRenderFrameHelper::OnFramePreparedForPreviewDocument() { if (reset_prep_frame_view_) { PrepareFrameForPreviewDocument(); return; } DidFinishPrinting(CreatePreviewDocument() ? OK : FAIL_PREVIEW); } ",0 "static char *lxc_attach_getpwshell(uid_t uid) { /* local variables */ pid_t pid; int pipes[2]; int ret; int fd; char *result = NULL; /* we need to fork off a process that runs the * getent program, and we need to capture its * output, so we use a pipe for that purpose */ ret = pipe(pipes); if (ret < 0) return NULL; pid = fork(); if (pid < 0) { close(pipes[0]); close(pipes[1]); return NULL; } if (pid) { /* parent process */ FILE *pipe_f; char *line = NULL; size_t line_bufsz = 0; int found = 0; int status; close(pipes[1]); pipe_f = fdopen(pipes[0], ""r""); while (getline(&line, &line_bufsz, pipe_f) != -1) { char *token; char *saveptr = NULL; long value; char *endptr = NULL; int i; /* if we already found something, just continue * to read until the pipe doesn't deliver any more * data, but don't modify the existing data * structure */ if (found) continue; /* trim line on the right hand side */ for (i = strlen(line); i > 0 && (line[i - 1] == '\n' || line[i - 1] == '\r'); --i) line[i - 1] = '\0'; /* split into tokens: first user name */ token = strtok_r(line, "":"", &saveptr); if (!token) continue; /* next: dummy password field */ token = strtok_r(NULL, "":"", &saveptr); if (!token) continue; /* next: user id */ token = strtok_r(NULL, "":"", &saveptr); value = token ? strtol(token, &endptr, 10) : 0; if (!token || !endptr || *endptr || value == LONG_MIN || value == LONG_MAX) continue; /* dummy sanity check: user id matches */ if ((uid_t) value != uid) continue; /* skip fields: gid, gecos, dir, go to next field 'shell' */ for (i = 0; i < 4; i++) { token = strtok_r(NULL, "":"", &saveptr); if (!token) break; } if (!token) continue; free(result); result = strdup(token); /* sanity check that there are no fields after that */ token = strtok_r(NULL, "":"", &saveptr); if (token) continue; found = 1; } free(line); fclose(pipe_f); again: if (waitpid(pid, &status, 0) < 0) { if (errno == EINTR) goto again; return NULL; } /* some sanity checks: if anything even hinted at going * wrong: we can't be sure we have a valid result, so * we assume we don't */ if (!WIFEXITED(status)) return NULL; if (WEXITSTATUS(status) != 0) return NULL; if (!found) return NULL; return result; } else { /* child process */ char uid_buf[32]; char *arguments[] = { ""getent"", ""passwd"", uid_buf, NULL }; close(pipes[0]); /* we want to capture stdout */ dup2(pipes[1], 1); close(pipes[1]); /* get rid of stdin/stderr, so we try to associate it * with /dev/null */ fd = open(""/dev/null"", O_RDWR); if (fd < 0) { close(0); close(2); } else { dup2(fd, 0); dup2(fd, 2); close(fd); } /* finish argument list */ ret = snprintf(uid_buf, sizeof(uid_buf), ""%ld"", (long) uid); if (ret <= 0) exit(-1); /* try to run getent program */ (void) execvp(""getent"", arguments); exit(-1); } } ",0 "AXObjectCache* Document::ExistingAXObjectCache() const { auto& cache_owner = AXObjectCacheOwner(); if (!cache_owner.GetLayoutView()) return nullptr; return cache_owner.ax_object_cache_.Get(); } ",0 "static int bnep_rx_extension(struct bnep_session *s, struct sk_buff *skb) { struct bnep_ext_hdr *h; int err = 0; do { h = (void *) skb->data; if (!skb_pull(skb, sizeof(*h))) { err = -EILSEQ; break; } BT_DBG(""type 0x%x len %d"", h->type, h->len); switch (h->type & BNEP_TYPE_MASK) { case BNEP_EXT_CONTROL: bnep_rx_control(s, skb->data, skb->len); break; default: /* Unknown extension, skip it. */ break; } if (!skb_pull(skb, h->len)) { err = -EILSEQ; break; } } while (!err && (h->type & BNEP_EXT_HEADER)); return err; } ",0 "unsigned long long Chapters::Atom::GetUID() const { return m_uid; } ",1 "int usbnet_write_cmd_async(struct usbnet *dev, u8 cmd, u8 reqtype, u16 value, u16 index, const void *data, u16 size) { struct usb_ctrlrequest *req = NULL; struct urb *urb; int err = -ENOMEM; void *buf = NULL; netdev_dbg(dev->net, ""usbnet_write_cmd cmd=0x%02x reqtype=%02x"" "" value=0x%04x index=0x%04x size=%d\n"", cmd, reqtype, value, index, size); urb = usb_alloc_urb(0, GFP_ATOMIC); if (!urb) { netdev_err(dev->net, ""Error allocating URB in"" "" %s!\n"", __func__); goto fail; } if (data) { buf = kmemdup(data, size, GFP_ATOMIC); if (!buf) { netdev_err(dev->net, ""Error allocating buffer"" "" in %s!\n"", __func__); goto fail_free; } } req = kmalloc(sizeof(struct usb_ctrlrequest), GFP_ATOMIC); if (!req) goto fail_free_buf; req->bRequestType = reqtype; req->bRequest = cmd; req->wValue = cpu_to_le16(value); req->wIndex = cpu_to_le16(index); req->wLength = cpu_to_le16(size); usb_fill_control_urb(urb, dev->udev, usb_sndctrlpipe(dev->udev, 0), (void *)req, buf, size, usbnet_async_cmd_cb, req); urb->transfer_flags |= URB_FREE_BUFFER; err = usb_submit_urb(urb, GFP_ATOMIC); if (err < 0) { netdev_err(dev->net, ""Error submitting the control"" "" message: status=%d\n"", err); goto fail_free; } return 0; fail_free_buf: kfree(buf); fail_free: kfree(req); usb_free_urb(urb); fail: return err; } ",0 "scoped_refptr LocalFrame::GetInspectorTaskRunner() { return inspector_task_runner_; } ",0 "GF_Err fpar_Size(GF_Box *s) { FilePartitionBox *ptr = (FilePartitionBox *)s; ptr->size+= 13 + ptr->version ? 8 : 4; if (ptr->scheme_specific_info) ptr->size += strlen(ptr->scheme_specific_info); ptr->size+= ptr->nb_entries * 6; return GF_OK; } ",0 "daemon_linux_lvm2_lv_set_name_authorized_cb (Daemon *daemon, Device *device, DBusGMethodInvocation *context, const gchar *action_id, guint num_user_data, gpointer *user_data_elements) { const gchar *group_uuid = user_data_elements[0]; const gchar *uuid = user_data_elements[1]; const gchar *new_name = user_data_elements[2]; const gchar *vg_name; gchar *lv_name; guint n; gchar *argv[10]; /* Unfortunately lvchange does not (yet - file a bug) accept UUIDs - so find the LV name for this * UUID by looking at PVs */ lv_name = NULL; vg_name = find_lvm2_vg_name_for_uuid (daemon, group_uuid); if (vg_name == NULL) { throw_error (context, ERROR_FAILED, ""Cannot find VG with UUID `%s'"", group_uuid); goto out; } lv_name = find_lvm2_lv_name_for_uuids (daemon, group_uuid, uuid); if (lv_name == NULL) { throw_error (context, ERROR_FAILED, ""Cannot find LV with UUID `%s'"", uuid); goto out; } n = 0; argv[n++] = ""lvrename""; argv[n++] = (gchar *) vg_name; argv[n++] = lv_name; argv[n++] = (gchar *) new_name; argv[n++] = NULL; if (!job_new (context, ""LinuxLvm2LVSetName"", TRUE, NULL, argv, NULL, linux_lvm2_lv_set_name_completed_cb, FALSE, NULL, NULL)) { goto out; } out: g_free (lv_name); } ",0 " cf2_hintmap_adjustHints( CF2_HintMap hintmap ) { size_t i, j; cf2_arrstack_clear( hintmap->hintMoves ); /* working storage */ /* * First pass is bottom-up (font hint order) without look-ahead. * Locked edges are already adjusted. * Unlocked edges begin with dsCoord from `initialHintMap'. * Save edges that are not optimally adjusted in `hintMoves' array, * and process them in second pass. */ for ( i = 0; i < hintmap->count; i++ ) { FT_Bool isPair = cf2_hint_isPair( &hintmap->edge[i] ); /* index of upper edge (same value for ghost hint) */ j = isPair ? i + 1 : i; FT_ASSERT( j < hintmap->count ); FT_ASSERT( cf2_hint_isValid( &hintmap->edge[i] ) ); FT_ASSERT( cf2_hint_isValid( &hintmap->edge[j] ) ); FT_ASSERT( cf2_hint_isLocked( &hintmap->edge[i] ) == cf2_hint_isLocked( &hintmap->edge[j] ) ); if ( !cf2_hint_isLocked( &hintmap->edge[i] ) ) { /* hint edge is not locked, we can adjust it */ CF2_Fixed fracDown = cf2_fixedFraction( hintmap->edge[i].dsCoord ); CF2_Fixed fracUp = cf2_fixedFraction( hintmap->edge[j].dsCoord ); /* calculate all four possibilities; moves down are negative */ CF2_Fixed downMoveDown = 0 - fracDown; CF2_Fixed upMoveDown = 0 - fracUp; CF2_Fixed downMoveUp = fracDown == 0 ? 0 : cf2_intToFixed( 1 ) - fracDown; CF2_Fixed upMoveUp = fracUp == 0 ? 0 : cf2_intToFixed( 1 ) - fracUp; /* smallest move up */ CF2_Fixed moveUp = FT_MIN( downMoveUp, upMoveUp ); /* smallest move down */ CF2_Fixed moveDown = FT_MAX( downMoveDown, upMoveDown ); /* final amount to move edge or edge pair */ CF2_Fixed move; CF2_Fixed downMinCounter = CF2_MIN_COUNTER; CF2_Fixed upMinCounter = CF2_MIN_COUNTER; FT_Bool saveEdge = FALSE; /* minimum counter constraint doesn't apply when adjacent edges */ /* are synthetic */ /* TODO: doesn't seem a big effect; for now, reduce the code */ #if 0 if ( i == 0 || cf2_hint_isSynthetic( &hintmap->edge[i - 1] ) ) downMinCounter = 0; if ( j >= hintmap->count - 1 || cf2_hint_isSynthetic( &hintmap->edge[j + 1] ) ) upMinCounter = 0; #endif /* is there room to move up? */ /* there is if we are at top of array or the next edge is at or */ /* beyond proposed move up? */ if ( j >= hintmap->count - 1 || hintmap->edge[j + 1].dsCoord >= hintmap->edge[j].dsCoord + moveUp + upMinCounter ) { /* there is room to move up; is there also room to move down? */ if ( i == 0 || hintmap->edge[i - 1].dsCoord <= hintmap->edge[i].dsCoord + moveDown - downMinCounter ) { /* move smaller absolute amount */ move = ( -moveDown < moveUp ) ? moveDown : moveUp; /* optimum */ } else move = moveUp; } else { /* is there room to move down? */ if ( i == 0 || hintmap->edge[i - 1].dsCoord <= hintmap->edge[i].dsCoord + moveDown - downMinCounter ) { move = moveDown; /* true if non-optimum move */ saveEdge = (FT_Bool)( moveUp < -moveDown ); } else { /* no room to move either way without overlapping or reducing */ /* the counter too much */ move = 0; saveEdge = TRUE; } } /* Identify non-moves and moves down that aren't optimal, and save */ /* them for second pass. */ /* Do this only if there is an unlocked edge above (which could */ /* possibly move). */ if ( saveEdge && j < hintmap->count - 1 && !cf2_hint_isLocked( &hintmap->edge[j + 1] ) ) { CF2_HintMoveRec savedMove; savedMove.j = j; /* desired adjustment in second pass */ savedMove.moveUp = moveUp - move; cf2_arrstack_push( hintmap->hintMoves, &savedMove ); } /* move the edge(s) */ hintmap->edge[i].dsCoord += move; if ( isPair ) hintmap->edge[j].dsCoord += move; } /* assert there are no overlaps in device space */ FT_ASSERT( i == 0 || hintmap->edge[i - 1].dsCoord <= hintmap->edge[i].dsCoord ); FT_ASSERT( i < j || hintmap->edge[i].dsCoord <= hintmap->edge[j].dsCoord ); /* adjust the scales, avoiding divide by zero */ if ( i > 0 ) { if ( hintmap->edge[i].csCoord != hintmap->edge[i - 1].csCoord ) hintmap->edge[i - 1].scale = FT_DivFix( hintmap->edge[i].dsCoord - hintmap->edge[i - 1].dsCoord, hintmap->edge[i].csCoord - hintmap->edge[i - 1].csCoord ); } if ( isPair ) { if ( hintmap->edge[j].csCoord != hintmap->edge[j - 1].csCoord ) hintmap->edge[j - 1].scale = FT_DivFix( hintmap->edge[j].dsCoord - hintmap->edge[j - 1].dsCoord, hintmap->edge[j].csCoord - hintmap->edge[j - 1].csCoord ); i += 1; /* skip upper edge on next loop */ } } /* second pass tries to move non-optimal hints up, in case there is */ /* room now */ for ( i = cf2_arrstack_size( hintmap->hintMoves ); i > 0; i-- ) { CF2_HintMove hintMove = (CF2_HintMove) cf2_arrstack_getPointer( hintmap->hintMoves, i - 1 ); j = hintMove->j; /* this was tested before the push, above */ FT_ASSERT( j < hintmap->count - 1 ); /* is there room to move up? */ if ( hintmap->edge[j + 1].dsCoord >= hintmap->edge[j].dsCoord + hintMove->moveUp + CF2_MIN_COUNTER ) { /* there is more room now, move edge up */ hintmap->edge[j].dsCoord += hintMove->moveUp; if ( cf2_hint_isPair( &hintmap->edge[j] ) ) { FT_ASSERT( j > 0 ); hintmap->edge[j - 1].dsCoord += hintMove->moveUp; } } } } ",0 "static int aio_read_evt(struct kioctx *ioctx, struct io_event *ent) { struct aio_ring_info *info = &ioctx->ring_info; struct aio_ring *ring; unsigned long head; int ret = 0; ring = kmap_atomic(info->ring_pages[0], KM_USER0); dprintk(""in aio_read_evt h%lu t%lu m%lu\n"", (unsigned long)ring->head, (unsigned long)ring->tail, (unsigned long)ring->nr); if (ring->head == ring->tail) goto out; spin_lock(&info->ring_lock); head = ring->head % info->nr; if (head != ring->tail) { struct io_event *evp = aio_ring_event(info, head, KM_USER1); *ent = *evp; head = (head + 1) % info->nr; smp_mb(); /* finish reading the event before updatng the head */ ring->head = head; ret = 1; put_aio_ring_event(evp, KM_USER1); } spin_unlock(&info->ring_lock); out: kunmap_atomic(ring, KM_USER0); dprintk(""leaving aio_read_evt: %d h%lu t%lu\n"", ret, (unsigned long)ring->head, (unsigned long)ring->tail); return ret; } ",0 "static char *page_getlink(struct dentry * dentry, struct page **ppage) { char *kaddr; struct page *page; struct address_space *mapping = dentry->d_inode->i_mapping; page = read_mapping_page(mapping, 0, NULL); if (IS_ERR(page)) return (char*)page; *ppage = page; kaddr = kmap(page); nd_terminate_link(kaddr, dentry->d_inode->i_size, PAGE_SIZE - 1); return kaddr; } ",0 "static void bond_set_lockdep_class_one(struct net_device *dev, struct netdev_queue *txq, void *_unused) { lockdep_set_class(&txq->_xmit_lock, &bonding_netdev_xmit_lock_key); } ",0 "static void t1_puts(const char *s) { if (s != t1_line_array) strcpy(t1_line_array, s); t1_line_ptr = strend(t1_line_array); t1_putline(); } ",0 "VaapiVideoDecodeAccelerator::~VaapiVideoDecodeAccelerator() { DCHECK(task_runner_->BelongsToCurrentThread()); } ",0 "void InitialLoadObserver::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { if (type == content::NOTIFICATION_LOAD_START) { if (outstanding_tab_count_ > loading_tabs_.size()) loading_tabs_.insert(TabTimeMap::value_type( source.map_key(), TabTime(base::TimeTicks::Now()))); } else if (type == content::NOTIFICATION_LOAD_STOP) { if (outstanding_tab_count_ > finished_tabs_.size()) { TabTimeMap::iterator iter = loading_tabs_.find(source.map_key()); if (iter != loading_tabs_.end()) { finished_tabs_.insert(source.map_key()); iter->second.set_stop_time(base::TimeTicks::Now()); } } } else if (type == content::NOTIFICATION_RENDERER_PROCESS_CLOSED) { base::TerminationStatus status = content::Details( details)->status; switch (status) { case base::TERMINATION_STATUS_NORMAL_TERMINATION: break; case base::TERMINATION_STATUS_ABNORMAL_TERMINATION: case base::TERMINATION_STATUS_PROCESS_WAS_KILLED: case base::TERMINATION_STATUS_PROCESS_CRASHED: crashed_tab_count_++; break; case base::TERMINATION_STATUS_STILL_RUNNING: LOG(ERROR) << ""Got RENDERER_PROCESS_CLOSED notification, "" << ""but the process is still running. We may miss further "" << ""crash notification, resulting in hangs.""; break; default: LOG(ERROR) << ""Unhandled termination status "" << status; NOTREACHED(); break; } } else { NOTREACHED(); } if (finished_tabs_.size() + crashed_tab_count_ >= outstanding_tab_count_) ConditionMet(); } ",0 "bool EditorClientBlackBerry::shouldChangeSelectedRange(Range* fromRange, Range* toRange, EAffinity affinity, bool stillSelecting) { if (m_webPagePrivate->m_dumpRenderTree) return m_webPagePrivate->m_dumpRenderTree->shouldChangeSelectedDOMRangeToDOMRangeAffinityStillSelecting(fromRange, toRange, static_cast(affinity), stillSelecting); Frame* frame = m_webPagePrivate->focusedOrMainFrame(); if (frame && frame->document()) { if (frame->document()->focusedNode() && frame->document()->focusedNode()->hasTagName(HTMLNames::selectTag)) return false; if (m_webPagePrivate->m_inputHandler->isInputMode() && fromRange && toRange && (fromRange->startContainer() == toRange->startContainer())) m_webPagePrivate->m_inputHandler->notifyClientOfKeyboardVisibilityChange(true); } return true; } ",1 "int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) { struct ipv6_txoptions opt_space; struct udp_sock *up = udp_sk(sk); struct inet_sock *inet = inet_sk(sk); struct ipv6_pinfo *np = inet6_sk(sk); DECLARE_SOCKADDR(struct sockaddr_in6 *, sin6, msg->msg_name); struct in6_addr *daddr, *final_p, final; struct ipv6_txoptions *opt = NULL; struct ipv6_txoptions *opt_to_free = NULL; struct ip6_flowlabel *flowlabel = NULL; struct flowi6 fl6; struct dst_entry *dst; int addr_len = msg->msg_namelen; int ulen = len; int hlimit = -1; int tclass = -1; int dontfrag = -1; int corkreq = up->corkflag || msg->msg_flags&MSG_MORE; int err; int connected = 0; int is_udplite = IS_UDPLITE(sk); int (*getfrag)(void *, char *, int, int, int, struct sk_buff *); /* destination address check */ if (sin6) { if (addr_len < offsetof(struct sockaddr, sa_data)) return -EINVAL; switch (sin6->sin6_family) { case AF_INET6: if (addr_len < SIN6_LEN_RFC2133) return -EINVAL; daddr = &sin6->sin6_addr; break; case AF_INET: goto do_udp_sendmsg; case AF_UNSPEC: msg->msg_name = sin6 = NULL; msg->msg_namelen = addr_len = 0; daddr = NULL; break; default: return -EINVAL; } } else if (!up->pending) { if (sk->sk_state != TCP_ESTABLISHED) return -EDESTADDRREQ; daddr = &sk->sk_v6_daddr; } else daddr = NULL; if (daddr) { if (ipv6_addr_v4mapped(daddr)) { struct sockaddr_in sin; sin.sin_family = AF_INET; sin.sin_port = sin6 ? sin6->sin6_port : inet->inet_dport; sin.sin_addr.s_addr = daddr->s6_addr32[3]; msg->msg_name = &sin; msg->msg_namelen = sizeof(sin); do_udp_sendmsg: if (__ipv6_only_sock(sk)) return -ENETUNREACH; return udp_sendmsg(sk, msg, len); } } if (up->pending == AF_INET) return udp_sendmsg(sk, msg, len); /* Rough check on arithmetic overflow, better check is made in ip6_append_data(). */ if (len > INT_MAX - sizeof(struct udphdr)) return -EMSGSIZE; getfrag = is_udplite ? udplite_getfrag : ip_generic_getfrag; if (up->pending) { /* * There are pending frames. * The socket lock must be held while it's corked. */ lock_sock(sk); if (likely(up->pending)) { if (unlikely(up->pending != AF_INET6)) { release_sock(sk); return -EAFNOSUPPORT; } dst = NULL; goto do_append_data; } release_sock(sk); } ulen += sizeof(struct udphdr); memset(&fl6, 0, sizeof(fl6)); if (sin6) { if (sin6->sin6_port == 0) return -EINVAL; fl6.fl6_dport = sin6->sin6_port; daddr = &sin6->sin6_addr; if (np->sndflow) { fl6.flowlabel = sin6->sin6_flowinfo&IPV6_FLOWINFO_MASK; if (fl6.flowlabel&IPV6_FLOWLABEL_MASK) { flowlabel = fl6_sock_lookup(sk, fl6.flowlabel); if (!flowlabel) return -EINVAL; } } /* * Otherwise it will be difficult to maintain * sk->sk_dst_cache. */ if (sk->sk_state == TCP_ESTABLISHED && ipv6_addr_equal(daddr, &sk->sk_v6_daddr)) daddr = &sk->sk_v6_daddr; if (addr_len >= sizeof(struct sockaddr_in6) && sin6->sin6_scope_id && __ipv6_addr_needs_scope_id(__ipv6_addr_type(daddr))) fl6.flowi6_oif = sin6->sin6_scope_id; } else { if (sk->sk_state != TCP_ESTABLISHED) return -EDESTADDRREQ; fl6.fl6_dport = inet->inet_dport; daddr = &sk->sk_v6_daddr; fl6.flowlabel = np->flow_label; connected = 1; } if (!fl6.flowi6_oif) fl6.flowi6_oif = sk->sk_bound_dev_if; if (!fl6.flowi6_oif) fl6.flowi6_oif = np->sticky_pktinfo.ipi6_ifindex; fl6.flowi6_mark = sk->sk_mark; if (msg->msg_controllen) { opt = &opt_space; memset(opt, 0, sizeof(struct ipv6_txoptions)); opt->tot_len = sizeof(*opt); err = ip6_datagram_send_ctl(sock_net(sk), sk, msg, &fl6, opt, &hlimit, &tclass, &dontfrag); if (err < 0) { fl6_sock_release(flowlabel); return err; } if ((fl6.flowlabel&IPV6_FLOWLABEL_MASK) && !flowlabel) { flowlabel = fl6_sock_lookup(sk, fl6.flowlabel); if (!flowlabel) return -EINVAL; } if (!(opt->opt_nflen|opt->opt_flen)) opt = NULL; connected = 0; } if (!opt) { opt = txopt_get(np); opt_to_free = opt; } if (flowlabel) opt = fl6_merge_options(&opt_space, flowlabel, opt); opt = ipv6_fixup_options(&opt_space, opt); fl6.flowi6_proto = sk->sk_protocol; if (!ipv6_addr_any(daddr)) fl6.daddr = *daddr; else fl6.daddr.s6_addr[15] = 0x1; /* :: means loopback (BSD'ism) */ if (ipv6_addr_any(&fl6.saddr) && !ipv6_addr_any(&np->saddr)) fl6.saddr = np->saddr; fl6.fl6_sport = inet->inet_sport; final_p = fl6_update_dst(&fl6, opt, &final); if (final_p) connected = 0; if (!fl6.flowi6_oif && ipv6_addr_is_multicast(&fl6.daddr)) { fl6.flowi6_oif = np->mcast_oif; connected = 0; } else if (!fl6.flowi6_oif) fl6.flowi6_oif = np->ucast_oif; security_sk_classify_flow(sk, flowi6_to_flowi(&fl6)); dst = ip6_sk_dst_lookup_flow(sk, &fl6, final_p); if (IS_ERR(dst)) { err = PTR_ERR(dst); dst = NULL; goto out; } if (hlimit < 0) hlimit = ip6_sk_dst_hoplimit(np, &fl6, dst); if (tclass < 0) tclass = np->tclass; if (msg->msg_flags&MSG_CONFIRM) goto do_confirm; back_from_confirm: /* Lockless fast path for the non-corking case */ if (!corkreq) { struct sk_buff *skb; skb = ip6_make_skb(sk, getfrag, msg, ulen, sizeof(struct udphdr), hlimit, tclass, opt, &fl6, (struct rt6_info *)dst, msg->msg_flags, dontfrag); err = PTR_ERR(skb); if (!IS_ERR_OR_NULL(skb)) err = udp_v6_send_skb(skb, &fl6); goto release_dst; } lock_sock(sk); if (unlikely(up->pending)) { /* The socket is already corked while preparing it. */ /* ... which is an evident application bug. --ANK */ release_sock(sk); net_dbg_ratelimited(""udp cork app bug 2\n""); err = -EINVAL; goto out; } up->pending = AF_INET6; do_append_data: if (dontfrag < 0) dontfrag = np->dontfrag; up->len += ulen; err = ip6_append_data(sk, getfrag, msg, ulen, sizeof(struct udphdr), hlimit, tclass, opt, &fl6, (struct rt6_info *)dst, corkreq ? msg->msg_flags|MSG_MORE : msg->msg_flags, dontfrag); if (err) udp_v6_flush_pending_frames(sk); else if (!corkreq) err = udp_v6_push_pending_frames(sk); else if (unlikely(skb_queue_empty(&sk->sk_write_queue))) up->pending = 0; if (err > 0) err = np->recverr ? net_xmit_errno(err) : 0; release_sock(sk); release_dst: if (dst) { if (connected) { ip6_dst_store(sk, dst, ipv6_addr_equal(&fl6.daddr, &sk->sk_v6_daddr) ? &sk->sk_v6_daddr : NULL, #ifdef CONFIG_IPV6_SUBTREES ipv6_addr_equal(&fl6.saddr, &np->saddr) ? &np->saddr : #endif NULL); } else { dst_release(dst); } dst = NULL; } out: dst_release(dst); fl6_sock_release(flowlabel); txopt_put(opt_to_free); if (!err) return len; /* * ENOBUFS = no kernel mem, SOCK_NOSPACE = no sndbuf space. Reporting * ENOBUFS might not be good (it's not tunable per se), but otherwise * we don't have a good statistic (IpOutDiscards but it can be too many * things). We could add another new stat but at least for now that * seems like overkill. */ if (err == -ENOBUFS || test_bit(SOCK_NOSPACE, &sk->sk_socket->flags)) { UDP6_INC_STATS_USER(sock_net(sk), UDP_MIB_SNDBUFERRORS, is_udplite); } return err; do_confirm: dst_confirm(dst); if (!(msg->msg_flags&MSG_PROBE) || len) goto back_from_confirm; err = 0; goto out; } ",0 "void usb_destroy_configuration(struct usb_device *dev) { int c, i; if (!dev->config) return; if (dev->rawdescriptors) { for (i = 0; i < dev->descriptor.bNumConfigurations; i++) kfree(dev->rawdescriptors[i]); kfree(dev->rawdescriptors); dev->rawdescriptors = NULL; } for (c = 0; c < dev->descriptor.bNumConfigurations; c++) { struct usb_host_config *cf = &dev->config[c]; kfree(cf->string); for (i = 0; i < cf->desc.bNumInterfaces; i++) { if (cf->intf_cache[i]) kref_put(&cf->intf_cache[i]->ref, usb_release_interface_cache); } } kfree(dev->config); dev->config = NULL; } ",0 "R_API RBinObject *r_bin_object_find_by_arch_bits(RBinFile *binfile, const char *arch, int bits, const char *name) { RBinObject *obj = NULL; RListIter *iter = NULL; RBinInfo *info = NULL; r_list_foreach (binfile->objs, iter, obj) { info = obj->info; if (info && info->arch && info->file && (bits == info->bits) && !strcmp (info->arch, arch) && !strcmp (info->file, name)) { break; } obj = NULL; } return obj; } ",0 "int drm_mode_getblob_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv) { struct drm_mode_object *obj; struct drm_mode_get_blob *out_resp = data; struct drm_property_blob *blob; int ret = 0; void *blob_ptr; if (!drm_core_check_feature(dev, DRIVER_MODESET)) return -EINVAL; mutex_lock(&dev->mode_config.mutex); obj = drm_mode_object_find(dev, out_resp->blob_id, DRM_MODE_OBJECT_BLOB); if (!obj) { ret = -EINVAL; goto done; } blob = obj_to_blob(obj); if (out_resp->length == blob->length) { blob_ptr = (void *)(unsigned long)out_resp->data; if (copy_to_user(blob_ptr, blob->data, blob->length)){ ret = -EFAULT; goto done; } } out_resp->length = blob->length; done: mutex_unlock(&dev->mode_config.mutex); return ret; } ",0 "HTMLMediaElement::DirectionOfPlayback HTMLMediaElement::getDirectionOfPlayback() const { return m_playbackRate >= 0 ? Forward : Backward; } ",0 "bool DownloadItemImpl::IsDangerous() const { return (danger_type_ == DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE || danger_type_ == DOWNLOAD_DANGER_TYPE_DANGEROUS_URL || danger_type_ == DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT || danger_type_ == DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT || danger_type_ == DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST || danger_type_ == DOWNLOAD_DANGER_TYPE_POTENTIALLY_UNWANTED); } ",0 "unsigned long long Track::GetDefaultDuration() const { return m_info.defaultDuration; } ",0 " TabStrip* tab_strip() { return tab_strip_; } ",0 "GF_Box *dec3_New() { ISOM_DECL_BOX_ALLOC(GF_AC3ConfigBox, GF_ISOM_BOX_TYPE_DAC3); tmp->cfg.is_ec3 = 1; return (GF_Box *)tmp; } ",0 "static enum test_return test_binary_quit(void) { return test_binary_quit_impl(PROTOCOL_BINARY_CMD_QUIT); } ",0 "static inline void skcipher_map_src(struct skcipher_walk *walk) { walk->src.virt.addr = skcipher_map(&walk->in); } ",0 "void t2p_pdf_currenttime(T2P* t2p) { struct tm* currenttime; time_t timenow; if (time(&timenow) == (time_t) -1) { TIFFError(TIFF2PDF_MODULE, ""Can't get the current time: %s"", strerror(errno)); timenow = (time_t) 0; } currenttime = localtime(&timenow); snprintf(t2p->pdf_datetime, sizeof(t2p->pdf_datetime), ""D:%.4d%.2d%.2d%.2d%.2d%.2d"", (currenttime->tm_year + 1900) % 65536, (currenttime->tm_mon + 1) % 256, (currenttime->tm_mday) % 256, (currenttime->tm_hour) % 256, (currenttime->tm_min) % 256, (currenttime->tm_sec) % 256); return; } ",0 "user_extension_get_all_properties (User *user, Daemon *daemon, GDBusInterfaceInfo *interface, GDBusMethodInvocation *invocation) { GVariantBuilder builder; gint i; g_variant_builder_init (&builder, G_VARIANT_TYPE_VARDICT); for (i = 0; interface->properties && interface->properties[i]; i++) { GDBusPropertyInfo *property = interface->properties[i]; g_autoptr(GVariant) value = NULL; value = user_extension_get_value (user, interface, property); if (value) g_variant_builder_add (&builder, ""{sv}"", property->name, value); } g_dbus_method_invocation_return_value (invocation, g_variant_new (""(a{sv})"", &builder)); } ",0 "sctp_disposition_t sctp_sf_do_5_1C_ack(struct net *net, const struct sctp_endpoint *ep, const struct sctp_association *asoc, const sctp_subtype_t type, void *arg, sctp_cmd_seq_t *commands) { struct sctp_chunk *chunk = arg; sctp_init_chunk_t *initchunk; struct sctp_chunk *err_chunk; struct sctp_packet *packet; if (!sctp_vtag_verify(chunk, asoc)) return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); /* 6.10 Bundling * An endpoint MUST NOT bundle INIT, INIT ACK or * SHUTDOWN COMPLETE with any other chunks. */ if (!chunk->singleton) return sctp_sf_violation_chunk(net, ep, asoc, type, arg, commands); /* Make sure that the INIT-ACK chunk has a valid length */ if (!sctp_chunk_length_valid(chunk, sizeof(sctp_initack_chunk_t))) return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, commands); /* Grab the INIT header. */ chunk->subh.init_hdr = (sctp_inithdr_t *) chunk->skb->data; /* Verify the INIT chunk before processing it. */ err_chunk = NULL; if (!sctp_verify_init(net, asoc, chunk->chunk_hdr->type, (sctp_init_chunk_t *)chunk->chunk_hdr, chunk, &err_chunk)) { sctp_error_t error = SCTP_ERROR_NO_RESOURCE; /* This chunk contains fatal error. It is to be discarded. * Send an ABORT, with causes. If there are no causes, * then there wasn't enough memory. Just terminate * the association. */ if (err_chunk) { packet = sctp_abort_pkt_new(net, ep, asoc, arg, (__u8 *)(err_chunk->chunk_hdr) + sizeof(sctp_chunkhdr_t), ntohs(err_chunk->chunk_hdr->length) - sizeof(sctp_chunkhdr_t)); sctp_chunk_free(err_chunk); if (packet) { sctp_add_cmd_sf(commands, SCTP_CMD_SEND_PKT, SCTP_PACKET(packet)); SCTP_INC_STATS(net, SCTP_MIB_OUTCTRLCHUNKS); error = SCTP_ERROR_INV_PARAM; } } /* SCTP-AUTH, Section 6.3: * It should be noted that if the receiver wants to tear * down an association in an authenticated way only, the * handling of malformed packets should not result in * tearing down the association. * * This means that if we only want to abort associations * in an authenticated way (i.e AUTH+ABORT), then we * can't destroy this association just because the packet * was malformed. */ if (sctp_auth_recv_cid(SCTP_CID_ABORT, asoc)) return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); SCTP_INC_STATS(net, SCTP_MIB_ABORTEDS); return sctp_stop_t1_and_abort(net, commands, error, ECONNREFUSED, asoc, chunk->transport); } /* Tag the variable length parameters. Note that we never * convert the parameters in an INIT chunk. */ chunk->param_hdr.v = skb_pull(chunk->skb, sizeof(sctp_inithdr_t)); initchunk = (sctp_init_chunk_t *) chunk->chunk_hdr; sctp_add_cmd_sf(commands, SCTP_CMD_PEER_INIT, SCTP_PEER_INIT(initchunk)); /* Reset init error count upon receipt of INIT-ACK. */ sctp_add_cmd_sf(commands, SCTP_CMD_INIT_COUNTER_RESET, SCTP_NULL()); /* 5.1 C) ""A"" shall stop the T1-init timer and leave * COOKIE-WAIT state. ""A"" shall then ... start the T1-cookie * timer, and enter the COOKIE-ECHOED state. */ sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP, SCTP_TO(SCTP_EVENT_TIMEOUT_T1_INIT)); sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_START, SCTP_TO(SCTP_EVENT_TIMEOUT_T1_COOKIE)); sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE, SCTP_STATE(SCTP_STATE_COOKIE_ECHOED)); /* SCTP-AUTH: genereate the assocition shared keys so that * we can potentially signe the COOKIE-ECHO. */ sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_SHKEY, SCTP_NULL()); /* 5.1 C) ""A"" shall then send the State Cookie received in the * INIT ACK chunk in a COOKIE ECHO chunk, ... */ /* If there is any errors to report, send the ERROR chunk generated * for unknown parameters as well. */ sctp_add_cmd_sf(commands, SCTP_CMD_GEN_COOKIE_ECHO, SCTP_CHUNK(err_chunk)); return SCTP_DISPOSITION_CONSUME; } ",0 "int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len) { int copied = 0; while (len > 0) { char buf[128]; int this_len, retval; this_len = (len > sizeof(buf)) ? sizeof(buf) : len; if (copy_from_user(buf, src, this_len)) return -EFAULT; retval = ptrace_access_vm(tsk, dst, buf, this_len, FOLL_FORCE | FOLL_WRITE); if (!retval) { if (copied) break; return -EIO; } copied += retval; src += retval; dst += retval; len -= retval; } return copied; } ",0 " void SetID(TabContents* contents, int id) { GetIDAccessor()->SetProperty(contents->property_bag(), id); } ",0 "void TestRenderWidgetHostView::Hide() { is_showing_ = false; } ",0 "static void free_rootdomain(struct rcu_head *rcu) { struct root_domain *rd = container_of(rcu, struct root_domain, rcu); cpupri_cleanup(&rd->cpupri); free_cpumask_var(rd->rto_mask); free_cpumask_var(rd->online); free_cpumask_var(rd->span); kfree(rd); } ",0 " gfx::PointF GetPointInChild() { gfx::PointF point_f; std::string str; EXPECT_TRUE(ExecuteScriptAndExtractString( child_frame_tree_node_->current_frame_host(), ""get_point_inside_text()"", &str)); ConvertJSONToPoint(str, &point_f); point_f = child_rwhv()->TransformPointToRootCoordSpaceF(point_f); return point_f; } ",0 "xml2_close_cb(void *context) { (void)context; /* UNUSED */ return (0); } ",0 "nfs4_client_to_reclaim(const char *name, struct nfsd_net *nn) { unsigned int strhashval; struct nfs4_client_reclaim *crp; dprintk(""NFSD nfs4_client_to_reclaim NAME: %.*s\n"", HEXDIR_LEN, name); crp = alloc_reclaim(); if (crp) { strhashval = clientstr_hashval(name); INIT_LIST_HEAD(&crp->cr_strhash); list_add(&crp->cr_strhash, &nn->reclaim_str_hashtbl[strhashval]); memcpy(crp->cr_recdir, name, HEXDIR_LEN); crp->cr_clp = NULL; nn->reclaim_str_hashtbl_size++; } return crp; } ",0 "static void ssh1_log_outgoing_packet(Ssh ssh, struct Packet *pkt) { int nblanks = 0; struct logblank_t blanks[4]; char *str; int slen; /* * For outgoing packets, pkt->length represents the length of the * whole packet starting at pkt->data (including some header), and * pkt->body refers to the point within that where the log-worthy * payload begins. However, incoming packets expect pkt->length to * represent only the payload length (that is, it's measured from * pkt->body not from pkt->data). Temporarily adjust our outgoing * packet to conform to the incoming-packet semantics, so that we * can analyse it with the ssh_pkt_get functions. */ pkt->length -= (pkt->body - pkt->data); pkt->savedpos = 0; if (ssh->logomitdata && (pkt->type == SSH1_CMSG_STDIN_DATA || pkt->type == SSH1_MSG_CHANNEL_DATA)) { /* ""Session data"" packets - omit the data string. */ if (pkt->type == SSH1_MSG_CHANNEL_DATA) ssh_pkt_getuint32(pkt); /* skip channel id */ blanks[nblanks].offset = pkt->savedpos + 4; blanks[nblanks].type = PKTLOG_OMIT; ssh_pkt_getstring(pkt, &str, &slen); if (str) { blanks[nblanks].len = slen; nblanks++; } } if ((pkt->type == SSH1_CMSG_AUTH_PASSWORD || pkt->type == SSH1_CMSG_AUTH_TIS_RESPONSE || pkt->type == SSH1_CMSG_AUTH_CCARD_RESPONSE) && conf_get_int(ssh->conf, CONF_logomitpass)) { /* If this is a password or similar packet, blank the password(s). */ blanks[nblanks].offset = 0; blanks[nblanks].len = pkt->length; blanks[nblanks].type = PKTLOG_BLANK; nblanks++; } else if (pkt->type == SSH1_CMSG_X11_REQUEST_FORWARDING && conf_get_int(ssh->conf, CONF_logomitpass)) { /* * If this is an X forwarding request packet, blank the fake * auth data. * * Note that while we blank the X authentication data here, we * don't take any special action to blank the start of an X11 * channel, so using MIT-MAGIC-COOKIE-1 and actually opening * an X connection without having session blanking enabled is * likely to leak your cookie into the log. */ pkt->savedpos = 0; ssh_pkt_getstring(pkt, &str, &slen); blanks[nblanks].offset = pkt->savedpos; blanks[nblanks].type = PKTLOG_BLANK; ssh_pkt_getstring(pkt, &str, &slen); if (str) { blanks[nblanks].len = pkt->savedpos - blanks[nblanks].offset; nblanks++; } } log_packet(ssh->logctx, PKT_OUTGOING, pkt->data[12], ssh1_pkt_type(pkt->data[12]), pkt->body, pkt->length, nblanks, blanks, NULL, 0, NULL); /* * Undo the above adjustment of pkt->length, to put the packet * back in the state we found it. */ pkt->length += (pkt->body - pkt->data); } ",0 "Address LargeObjectArena::allocateLargeObjectPage(size_t allocationSize, size_t gcInfoIndex) { ASSERT(!(allocationSize & allocationMask)); Address result = lazySweep(allocationSize, gcInfoIndex); if (result) return result; getThreadState()->completeSweep(); getThreadState()->scheduleGCIfNeeded(); return doAllocateLargeObjectPage(allocationSize, gcInfoIndex); } ",0 "void InspectorClientImpl::flush() { if (WebDevToolsAgentImpl* agent = devToolsAgent()) agent->flush(); } ",0 "e1000e_can_receive(E1000ECore *core) { int i; if (!e1000x_rx_ready(core->owner, core->mac)) { return false; } for (i = 0; i < E1000E_NUM_QUEUES; i++) { E1000E_RxRing rxr; e1000e_rx_ring_init(core, &rxr, i); if (e1000e_ring_enabled(core, rxr.i) && e1000e_has_rxbufs(core, rxr.i, 1)) { trace_e1000e_rx_can_recv(); return true; } } trace_e1000e_rx_can_recv_rings_full(); return false; } ",0 "static int _sx_sasl_wio(sx_t s, sx_plugin_t p, sx_buf_t buf) { sx_error_t sxe; size_t len; int ret; char *out; Gsasl_session *sd = (Gsasl_session *) s->plugin_data[p->index]; _sx_debug(ZONE, ""doing sasl encode""); /* encode the output */ ret = gsasl_encode(sd, buf->data, buf->len, &out, &len); if (ret != GSASL_OK) { _sx_debug(ZONE, ""gsasl_encode failed (%d): %s"", ret, gsasl_strerror (ret)); /* Fatal error */ _sx_gen_error(sxe, SX_ERR_AUTH, ""SASL Stream encoding failed"", (char*) gsasl_strerror (ret)); _sx_event(s, event_ERROR, (void *) &sxe); return -1; } /* replace the buffer */ _sx_buffer_set(buf, out, len, NULL); free(out); _sx_debug(ZONE, ""%d bytes encoded for sasl channel"", buf->len); return 1; } ",0 "void retrieveResourcesForElement(Element* element, Vector* visitedFrames, Vector* framesToVisit, Vector* frameURLs, Vector* resourceURLs) { ASSERT(element); if (isHTMLFrameElementBase(*element) || isHTMLObjectElement(*element) || isHTMLEmbedElement(*element)) { Frame* frame = toHTMLFrameOwnerElement(element)->contentFrame(); if (frame && frame->isLocalFrame()) { if (!visitedFrames->contains(toLocalFrame(frame))) framesToVisit->append(toLocalFrame(frame)); return; } } KURL url = getSubResourceURLFromElement(element); if (url.isEmpty() || !url.isValid()) return; // No subresource for this node. if (!url.protocolIsInHTTPFamily() && !url.isLocalFile()) return; if (!resourceURLs->contains(url)) resourceURLs->append(url); } ",0 "void __napi_complete(struct napi_struct *n) { BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state)); BUG_ON(n->gro_list); list_del(&n->poll_list); smp_mb__before_clear_bit(); clear_bit(NAPI_STATE_SCHED, &n->state); } ",0 "void LayerTreeHostQt::didSyncCompositingStateForLayer(const WebLayerInfo& info) { m_shouldSyncFrame = true; m_webPage->send(Messages::LayerTreeHostProxy::SyncCompositingLayerState(info)); } ",0 "bool ExtensionRegistry::RemoveEnabled(const std::string& id) { return enabled_extensions_.Remove(id); } ",0 "int http_find_header2(const char *name, int len, char *sol, struct hdr_idx *idx, struct hdr_ctx *ctx) { char *eol, *sov; int cur_idx, old_idx; cur_idx = ctx->idx; if (cur_idx) { /* We have previously returned a value, let's search * another one on the same line. */ sol = ctx->line; ctx->del = ctx->val + ctx->vlen + ctx->tws; sov = sol + ctx->del; eol = sol + idx->v[cur_idx].len; if (sov >= eol) /* no more values in this header */ goto next_hdr; /* values remaining for this header, skip the comma but save it * for later use (eg: for header deletion). */ sov++; while (sov < eol && http_is_lws[(unsigned char)*sov]) sov++; goto return_hdr; } /* first request for this header */ sol += hdr_idx_first_pos(idx); old_idx = 0; cur_idx = hdr_idx_first_idx(idx); while (cur_idx) { eol = sol + idx->v[cur_idx].len; if (len == 0) { /* No argument was passed, we want any header. * To achieve this, we simply build a fake request. */ while (sol + len < eol && sol[len] != ':') len++; name = sol; } if ((len < eol - sol) && (sol[len] == ':') && (strncasecmp(sol, name, len) == 0)) { ctx->del = len; sov = sol + len + 1; while (sov < eol && http_is_lws[(unsigned char)*sov]) sov++; ctx->line = sol; ctx->prev = old_idx; return_hdr: ctx->idx = cur_idx; ctx->val = sov - sol; eol = find_hdr_value_end(sov, eol); ctx->tws = 0; while (eol > sov && http_is_lws[(unsigned char)*(eol - 1)]) { eol--; ctx->tws++; } ctx->vlen = eol - sov; return 1; } next_hdr: sol = eol + idx->v[cur_idx].cr + 1; old_idx = cur_idx; cur_idx = idx->v[cur_idx].next; } return 0; } ",0 " MockRenderWidgetHostImpl(RenderWidgetHostDelegate* delegate, RenderProcessHost* process, int32_t routing_id, std::unique_ptr widget_impl, mojom::WidgetPtr widget) : RenderWidgetHostImpl(delegate, process, routing_id, std::move(widget), false), widget_impl_(std::move(widget_impl)) { lastWheelOrTouchEventLatencyInfo = ui::LatencyInfo(); } ",0 "void GLES2DecoderImpl::ReleaseIOSurfaceForTexture(GLuint texture_id) { TextureToIOSurfaceMap::iterator it = texture_to_io_surface_map_.find( texture_id); if (it != texture_to_io_surface_map_.end()) { CFTypeRef surface = it->second; CFRelease(surface); texture_to_io_surface_map_.erase(it); } } ",0 "void WebPage::spellCheckingRequestProcessed(int32_t transactionId, spannable_string_t* spannableString) { d->m_inputHandler->spellCheckingRequestProcessed(transactionId, spannableString); } ",0 "static bool parse_reconnect(struct pool *pool, json_t *val) { if (opt_disable_client_reconnect) { applog(LOG_WARNING, ""Stratum client.reconnect received but is disabled, not reconnecting.""); return false; } char *url, *port, address[256]; char *sockaddr_url, *stratum_port, *tmp; /* Tempvars. */ url = (char *)json_string_value(json_array_get(val, 0)); if (!url) url = pool->sockaddr_url; port = (char *)json_string_value(json_array_get(val, 1)); if (!port) port = pool->stratum_port; snprintf(address, sizeof(address), ""%s:%s"", url, port); if (!extract_sockaddr(address, &sockaddr_url, &stratum_port)) return false; applog(LOG_NOTICE, ""Reconnect requested from %s to %s"", get_pool_name(pool), address); clear_pool_work(pool); mutex_lock(&pool->stratum_lock); __suspend_stratum(pool); tmp = pool->sockaddr_url; pool->sockaddr_url = sockaddr_url; pool->stratum_url = pool->sockaddr_url; free(tmp); tmp = pool->stratum_port; pool->stratum_port = stratum_port; free(tmp); mutex_unlock(&pool->stratum_lock); if (!restart_stratum(pool)) { pool_failed(pool); return false; } return true; } ",0 "static void tg3_sd_scan_scratchpad(struct tg3 *tp, struct tg3_ocir *ocir) { int i; for (i = 0; i < TG3_SD_NUM_RECS; i++, ocir++) { u32 off = i * TG3_OCIR_LEN, len = TG3_OCIR_LEN; tg3_ape_scratchpad_read(tp, (u32 *) ocir, off, len); off += len; if (ocir->signature != TG3_OCIR_SIG_MAGIC || !(ocir->version_flags & TG3_OCIR_FLAG_ACTIVE)) memset(ocir, 0, TG3_OCIR_LEN); } } ",0 "void PasswordAutofillAgent::SendPasswordForms(bool only_visible) { std::unique_ptr logger; if (logging_state_active_) { logger.reset(new RendererSavePasswordProgressLogger( GetPasswordManagerDriver().get())); logger->LogMessage(Logger::STRING_SEND_PASSWORD_FORMS_METHOD); logger->LogBoolean(Logger::STRING_ONLY_VISIBLE, only_visible); } WebLocalFrame* frame = render_frame()->GetWebFrame(); blink::WebSecurityOrigin origin = frame->GetDocument().GetSecurityOrigin(); if (logger) { logger->LogURL(Logger::STRING_SECURITY_ORIGIN, GURL(origin.ToString().Utf8())); } if (!FrameCanAccessPasswordManager()) { if (logger) logger->LogMessage(Logger::STRING_SECURITY_ORIGIN_FAILURE); return; } if (form_util::IsWebpageEmpty(frame)) { if (logger) { logger->LogMessage(Logger::STRING_WEBPAGE_EMPTY); } return; } WebVector forms; frame->GetDocument().Forms(forms); if (IsShowAutofillSignaturesEnabled()) AnnotateFormsAndFieldsWithSignatures(frame, &forms); if (logger) logger->LogNumber(Logger::STRING_NUMBER_OF_ALL_FORMS, forms.size()); std::vector password_forms; for (const WebFormElement& form : forms) { if (only_visible) { bool is_form_visible = form_util::AreFormContentsVisible(form); if (logger) { LogHTMLForm(logger.get(), Logger::STRING_FORM_FOUND_ON_PAGE, form); logger->LogBoolean(Logger::STRING_FORM_IS_VISIBLE, is_form_visible); } if (!is_form_visible) continue; } std::unique_ptr password_form( GetPasswordFormFromWebForm(form)); if (!password_form) continue; if (logger) logger->LogPasswordForm(Logger::STRING_FORM_IS_PASSWORD, *password_form); FormStructureInfo form_structure_info = ExtractFormStructureInfo(password_form->form_data); if (only_visible || WasFormStructureChanged(form_structure_info)) { forms_structure_cache_[form_structure_info.unique_renderer_id] = std::move(form_structure_info); password_forms.push_back(std::move(*password_form)); continue; } WebVector control_elements_vector; form.GetFormControlElements(control_elements_vector); std::vector control_elements = control_elements_vector.ReleaseVector(); TryFixAutofilledForm(&control_elements); } bool add_unowned_inputs = true; if (only_visible) { std::vector control_elements = form_util::GetUnownedAutofillableFormFieldElements( frame->GetDocument().All(), nullptr); add_unowned_inputs = form_util::IsSomeControlElementVisible(control_elements); if (logger) { logger->LogBoolean(Logger::STRING_UNOWNED_INPUTS_VISIBLE, add_unowned_inputs); } } if (add_unowned_inputs) { std::unique_ptr password_form( GetPasswordFormFromUnownedInputElements()); if (password_form) { if (logger) { logger->LogPasswordForm(Logger::STRING_FORM_IS_PASSWORD, *password_form); } password_forms.push_back(std::move(*password_form)); } } if (only_visible) { WebFrame* main_frame = render_frame()->GetWebFrame()->Top(); bool did_stop_loading = !main_frame || !main_frame->IsLoading(); GetPasswordManagerDriver()->PasswordFormsRendered(password_forms, did_stop_loading); } else { if (!sent_request_to_store_ && password_forms.empty() && HasPasswordField(*frame)) { password_forms.push_back(PasswordForm()); password_forms.back().scheme = PasswordForm::Scheme::kHtml; password_forms.back().origin = form_util::GetCanonicalOriginForDocument(frame->GetDocument()); password_forms.back().signon_realm = GetSignOnRealm(password_forms.back().origin); password_forms.back().form_data.url = password_forms.back().origin; } if (!password_forms.empty()) { sent_request_to_store_ = true; GetPasswordManagerDriver()->PasswordFormsParsed(password_forms); } } #if !defined(OS_ANDROID) && !defined(OS_IOS) if (!password_forms.empty() && (frame->GetDocument().Url().ProtocolIs(url::kHttpScheme) || frame->GetDocument().Url().ProtocolIs(url::kHttpsScheme))) page_passwords_analyser_.AnalyseDocumentDOM(frame); #endif } ",0 "int wait_on_page_writeback_range(struct address_space *mapping, pgoff_t start, pgoff_t end) { struct pagevec pvec; int nr_pages; int ret = 0; pgoff_t index; if (end < start) return 0; pagevec_init(&pvec, 0); index = start; while ((index <= end) && (nr_pages = pagevec_lookup_tag(&pvec, mapping, &index, PAGECACHE_TAG_WRITEBACK, min(end - index, (pgoff_t)PAGEVEC_SIZE-1) + 1)) != 0) { unsigned i; for (i = 0; i < nr_pages; i++) { struct page *page = pvec.pages[i]; /* until radix tree lookup accepts end_index */ if (page->index > end) continue; wait_on_page_writeback(page); if (PageError(page)) ret = -EIO; } pagevec_release(&pvec); cond_resched(); } /* Check for outstanding write errors */ if (test_and_clear_bit(AS_ENOSPC, &mapping->flags)) ret = -ENOSPC; if (test_and_clear_bit(AS_EIO, &mapping->flags)) ret = -EIO; return ret; } ",0 "GBool FoFiType1C::parse() { Type1CIndex fdIdx; Type1CIndexVal val; int i; parsedOk = gTrue; if (len > 0 && file[0] != '\x01') { ++file; --len; } getIndex(getU8(2, &parsedOk), &nameIdx, &parsedOk); getIndex(nameIdx.endPos, &topDictIdx, &parsedOk); getIndex(topDictIdx.endPos, &stringIdx, &parsedOk); getIndex(stringIdx.endPos, &gsubrIdx, &parsedOk); if (!parsedOk) { return gFalse; } gsubrBias = (gsubrIdx.len < 1240) ? 107 : (gsubrIdx.len < 33900) ? 1131 : 32768; getIndexVal(&nameIdx, 0, &val, &parsedOk); if (!parsedOk) { return gFalse; } name = new GooString((char *)&file[val.pos], val.len); readTopDict(); if (topDict.firstOp == 0x0c1e) { if (topDict.fdArrayOffset == 0) { nFDs = 1; privateDicts = (Type1CPrivateDict *)gmalloc(sizeof(Type1CPrivateDict)); readPrivateDict(0, 0, &privateDicts[0]); } else { getIndex(topDict.fdArrayOffset, &fdIdx, &parsedOk); if (!parsedOk) { return gFalse; } nFDs = fdIdx.len; privateDicts = (Type1CPrivateDict *) gmallocn(nFDs, sizeof(Type1CPrivateDict)); for (i = 0; i < nFDs; ++i) { getIndexVal(&fdIdx, i, &val, &parsedOk); if (!parsedOk) { return gFalse; } readFD(val.pos, val.len, &privateDicts[i]); } } } else { nFDs = 1; privateDicts = (Type1CPrivateDict *)gmalloc(sizeof(Type1CPrivateDict)); readPrivateDict(topDict.privateOffset, topDict.privateSize, &privateDicts[0]); } if (!parsedOk) { return gFalse; } if (topDict.charStringsOffset <= 0) { parsedOk = gFalse; return gFalse; } getIndex(topDict.charStringsOffset, &charStringsIdx, &parsedOk); if (!parsedOk) { return gFalse; } nGlyphs = charStringsIdx.len; if (topDict.firstOp == 0x0c1e) { readFDSelect(); if (!parsedOk) { return gFalse; } } if (!readCharset()) { parsedOk = gFalse; return gFalse; } if (topDict.firstOp != 0x0c14 && topDict.firstOp != 0x0c1e) { buildEncoding(); if (!parsedOk) { return gFalse; } } return parsedOk; } ",0 "static int btrfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) { struct inode *inode = dentry->d_inode; u32 blocksize = inode->i_sb->s_blocksize; generic_fillattr(inode, stat); stat->dev = BTRFS_I(inode)->root->anon_dev; stat->blksize = PAGE_CACHE_SIZE; stat->blocks = (ALIGN(inode_get_bytes(inode), blocksize) + ALIGN(BTRFS_I(inode)->delalloc_bytes, blocksize)) >> 9; return 0; } ",0 "void FrameFetchContext::PrepareRequest(ResourceRequest& request, RedirectType redirect_type) { SetFirstPartyCookieAndRequestorOrigin(request); String user_agent = GetUserAgent(); request.SetHTTPUserAgent(AtomicString(user_agent)); if (IsDetached()) return; GetLocalFrameClient()->DispatchWillSendRequest(request); if (MasterDocumentLoader()->GetServiceWorkerNetworkProvider()) { WrappedResourceRequest webreq(request); MasterDocumentLoader()->GetServiceWorkerNetworkProvider()->WillSendRequest( webreq); } if (redirect_type == FetchContext::RedirectType::kNotForRedirect && document_loader_ && !document_loader_->Fetcher()->Archive() && request.Url().IsValid()) { document_loader_->GetApplicationCacheHost()->WillStartLoading(request); } } ",0 "static inline unsigned long hash_name(const char *name, unsigned int *hashp) { unsigned long a, b, adata, bdata, mask, hash, len; const struct word_at_a_time constants = WORD_AT_A_TIME_CONSTANTS; hash = a = 0; len = -sizeof(unsigned long); do { hash = (hash + a) * 9; len += sizeof(unsigned long); a = load_unaligned_zeropad(name+len); b = a ^ REPEAT_BYTE('/'); } while (!(has_zero(a, &adata, &constants) | has_zero(b, &bdata, &constants))); adata = prep_zero_mask(a, adata, &constants); bdata = prep_zero_mask(b, bdata, &constants); mask = create_zero_mask(adata | bdata); hash += a & zero_bytemask(mask); *hashp = fold_hash(hash); return len + find_zero(mask); } ",0 "selCreate(l_int32 height, l_int32 width, const char *name) { SEL *sel; PROCNAME(""selCreate""); if ((sel = (SEL *)LEPT_CALLOC(1, sizeof(SEL))) == NULL) return (SEL *)ERROR_PTR(""sel not made"", procName, NULL); if (name) sel->name = stringNew(name); sel->sy = height; sel->sx = width; if ((sel->data = create2dIntArray(height, width)) == NULL) { LEPT_FREE(sel->name); LEPT_FREE(sel); return (SEL *)ERROR_PTR(""data not allocated"", procName, NULL); } return sel; } ",0 "static void lsi_do_msgout(LSIState *s) { uint8_t msg; int len; uint32_t current_tag; lsi_request *current_req, *p, *p_next; if (s->current) { current_tag = s->current->tag; current_req = s->current; } else { current_tag = s->select_tag; current_req = lsi_find_by_tag(s, current_tag); } trace_lsi_do_msgout(s->dbc); while (s->dbc) { msg = lsi_get_msgbyte(s); s->sfbr = msg; switch (msg) { case 0x04: trace_lsi_do_msgout_disconnect(); lsi_disconnect(s); break; case 0x08: trace_lsi_do_msgout_noop(); lsi_set_phase(s, PHASE_CMD); break; case 0x01: len = lsi_get_msgbyte(s); msg = lsi_get_msgbyte(s); (void)len; /* avoid a warning about unused variable*/ trace_lsi_do_msgout_extended(msg, len); switch (msg) { case 1: trace_lsi_do_msgout_ignored(""SDTR""); lsi_skip_msgbytes(s, 2); break; case 3: trace_lsi_do_msgout_ignored(""WDTR""); lsi_skip_msgbytes(s, 1); break; case 4: trace_lsi_do_msgout_ignored(""PPR""); lsi_skip_msgbytes(s, 5); break; default: goto bad; } break; case 0x20: /* SIMPLE queue */ s->select_tag |= lsi_get_msgbyte(s) | LSI_TAG_VALID; trace_lsi_do_msgout_simplequeue(s->select_tag & 0xff); break; case 0x21: /* HEAD of queue */ qemu_log_mask(LOG_UNIMP, ""lsi_scsi: HEAD queue not implemented\n""); s->select_tag |= lsi_get_msgbyte(s) | LSI_TAG_VALID; break; case 0x22: /* ORDERED queue */ qemu_log_mask(LOG_UNIMP, ""lsi_scsi: ORDERED queue not implemented\n""); s->select_tag |= lsi_get_msgbyte(s) | LSI_TAG_VALID; break; case 0x0d: /* The ABORT TAG message clears the current I/O process only. */ trace_lsi_do_msgout_abort(current_tag); if (current_req) { scsi_req_cancel(current_req->req); } lsi_disconnect(s); break; case 0x06: case 0x0e: case 0x0c: /* The ABORT message clears all I/O processes for the selecting initiator on the specified logical unit of the target. */ if (msg == 0x06) { trace_lsi_do_msgout_abort(current_tag); } /* The CLEAR QUEUE message clears all I/O processes for all initiators on the specified logical unit of the target. */ if (msg == 0x0e) { trace_lsi_do_msgout_clearqueue(current_tag); } /* The BUS DEVICE RESET message clears all I/O processes for all initiators on all logical units of the target. */ if (msg == 0x0c) { trace_lsi_do_msgout_busdevicereset(current_tag); } /* clear the current I/O process */ if (s->current) { scsi_req_cancel(s->current->req); } /* As the current implemented devices scsi_disk and scsi_generic only support one LUN, we don't need to keep track of LUNs. Clearing I/O processes for other initiators could be possible for scsi_generic by sending a SG_SCSI_RESET to the /dev/sgX device, but this is currently not implemented (and seems not to be really necessary). So let's simply clear all queued commands for the current device: */ QTAILQ_FOREACH_SAFE(p, &s->queue, next, p_next) { if ((p->tag & 0x0000ff00) == (current_tag & 0x0000ff00)) { scsi_req_cancel(p->req); } } lsi_disconnect(s); break; default: if ((msg & 0x80) == 0) { goto bad; } s->current_lun = msg & 7; trace_lsi_do_msgout_select(s->current_lun); lsi_set_phase(s, PHASE_CMD); break; } } return; bad: qemu_log_mask(LOG_UNIMP, ""Unimplemented message 0x%02x\n"", msg); lsi_set_phase(s, PHASE_MI); lsi_add_msg_byte(s, 7); /* MESSAGE REJECT */ s->msg_action = LSI_MSG_ACTION_COMMAND; } ",0 "nfsd_init_raparms(struct file *file) { struct inode *inode = file_inode(file); dev_t dev = inode->i_sb->s_dev; ino_t ino = inode->i_ino; struct raparms *ra, **rap, **frap = NULL; int depth = 0; unsigned int hash; struct raparm_hbucket *rab; hash = jhash_2words(dev, ino, 0xfeedbeef) & RAPARM_HASH_MASK; rab = &raparm_hash[hash]; spin_lock(&rab->pb_lock); for (rap = &rab->pb_head; (ra = *rap); rap = &ra->p_next) { if (ra->p_ino == ino && ra->p_dev == dev) goto found; depth++; if (ra->p_count == 0) frap = rap; } depth = nfsdstats.ra_size; if (!frap) { spin_unlock(&rab->pb_lock); return NULL; } rap = frap; ra = *frap; ra->p_dev = dev; ra->p_ino = ino; ra->p_set = 0; ra->p_hindex = hash; found: if (rap != &rab->pb_head) { *rap = ra->p_next; ra->p_next = rab->pb_head; rab->pb_head = ra; } ra->p_count++; nfsdstats.ra_depth[depth*10/nfsdstats.ra_size]++; spin_unlock(&rab->pb_lock); if (ra->p_set) file->f_ra = ra->p_ra; return ra; } ",0 "static bool nl80211_valid_cipher_suite(u32 cipher) { return cipher == WLAN_CIPHER_SUITE_WEP40 || cipher == WLAN_CIPHER_SUITE_WEP104 || cipher == WLAN_CIPHER_SUITE_TKIP || cipher == WLAN_CIPHER_SUITE_CCMP || cipher == WLAN_CIPHER_SUITE_AES_CMAC; } ",0 "static int nfs_flush_one(struct nfs_pageio_descriptor *desc, struct nfs_pgio_header *hdr) { struct nfs_page *req; struct page **pages; struct nfs_write_data *data; struct list_head *head = &desc->pg_list; struct nfs_commit_info cinfo; data = nfs_writedata_alloc(hdr, nfs_page_array_len(desc->pg_base, desc->pg_count)); if (!data) { nfs_flush_error(desc, hdr); return -ENOMEM; } nfs_init_cinfo(&cinfo, desc->pg_inode, desc->pg_dreq); pages = data->pages.pagevec; while (!list_empty(head)) { req = nfs_list_entry(head->next); nfs_list_remove_request(req); nfs_list_add_request(req, &hdr->pages); *pages++ = req->wb_page; } if ((desc->pg_ioflags & FLUSH_COND_STABLE) && (desc->pg_moreio || nfs_reqs_to_commit(&cinfo))) desc->pg_ioflags &= ~FLUSH_COND_STABLE; /* Set up the argument struct */ nfs_write_rpcsetup(data, desc->pg_count, 0, desc->pg_ioflags, &cinfo); list_add(&data->list, &hdr->rpc_list); desc->pg_rpc_callops = &nfs_write_common_ops; return 0; } ",0 "json_object_two_arg(PG_FUNCTION_ARGS) { ArrayType *key_array = PG_GETARG_ARRAYTYPE_P(0); ArrayType *val_array = PG_GETARG_ARRAYTYPE_P(1); int nkdims = ARR_NDIM(key_array); int nvdims = ARR_NDIM(val_array); StringInfoData result; Datum *key_datums, *val_datums; bool *key_nulls, *val_nulls; int key_count, val_count, i; text *rval; char *v; if (nkdims > 1 || nkdims != nvdims) ereport(ERROR, (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR), errmsg(""wrong number of array subscripts""))); if (nkdims == 0) PG_RETURN_DATUM(CStringGetTextDatum(""{}"")); deconstruct_array(key_array, TEXTOID, -1, false, 'i', &key_datums, &key_nulls, &key_count); deconstruct_array(val_array, TEXTOID, -1, false, 'i', &val_datums, &val_nulls, &val_count); if (key_count != val_count) ereport(ERROR, (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR), errmsg(""mismatched array dimensions""))); initStringInfo(&result); appendStringInfoChar(&result, '{'); for (i = 0; i < key_count; ++i) { if (key_nulls[i]) ereport(ERROR, (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), errmsg(""null value not allowed for object key""))); v = TextDatumGetCString(key_datums[i]); if (i > 0) appendStringInfoString(&result, "", ""); escape_json(&result, v); appendStringInfoString(&result, "" : ""); pfree(v); if (val_nulls[i]) appendStringInfoString(&result, ""null""); else { v = TextDatumGetCString(val_datums[i]); escape_json(&result, v); pfree(v); } } appendStringInfoChar(&result, '}'); pfree(key_datums); pfree(key_nulls); pfree(val_datums); pfree(val_nulls); rval = cstring_to_text_with_len(result.data, result.len); pfree(result.data); PG_RETURN_TEXT_P(rval); } ",0 "static void voidMethodFloatArgMethodCallback(const v8::FunctionCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMMethod""); TestObjectPythonV8Internal::voidMethodFloatArgMethod(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "bool WebDevToolsAgent::shouldInterruptForMessage(const WebString& message) { String commandName; if (!InspectorBackendDispatcher::getCommandName(message, &commandName)) return false; return commandName == InspectorBackendDispatcher::commandName(InspectorBackendDispatcher::kDebugger_pauseCmd) || commandName == InspectorBackendDispatcher::commandName(InspectorBackendDispatcher::kDebugger_setBreakpointCmd) || commandName == InspectorBackendDispatcher::commandName(InspectorBackendDispatcher::kDebugger_setBreakpointByUrlCmd) || commandName == InspectorBackendDispatcher::commandName(InspectorBackendDispatcher::kDebugger_removeBreakpointCmd) || commandName == InspectorBackendDispatcher::commandName(InspectorBackendDispatcher::kDebugger_setBreakpointsActiveCmd); } ",0 "bool HTMLLinkElement::sheetLoaded() { if (!isLoading() && !isDisabled() && !isAlternate()) { document()->removePendingSheet(); return true; } return false; } ",0 "icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp, const u_char *ep) { const struct icmp6_nodeinfo *ni6; const struct icmp6_hdr *dp; const u_char *cp; size_t siz, i; int needcomma; if (ep < bp) return; dp = (const struct icmp6_hdr *)bp; ni6 = (const struct icmp6_nodeinfo *)bp; siz = ep - bp; switch (ni6->ni_type) { case ICMP6_NI_QUERY: if (siz == sizeof(*dp) + 4) { /* KAME who-are-you */ ND_PRINT((ndo,"" who-are-you request"")); break; } ND_PRINT((ndo,"" node information query"")); ND_TCHECK2(*dp, sizeof(*ni6)); ni6 = (const struct icmp6_nodeinfo *)dp; ND_PRINT((ndo,"" ("")); /*)*/ switch (EXTRACT_16BITS(&ni6->ni_qtype)) { case NI_QTYPE_NOOP: ND_PRINT((ndo,""noop"")); break; case NI_QTYPE_SUPTYPES: ND_PRINT((ndo,""supported qtypes"")); i = EXTRACT_16BITS(&ni6->ni_flags); if (i) ND_PRINT((ndo,"" [%s]"", (i & 0x01) ? ""C"" : """")); break; case NI_QTYPE_FQDN: ND_PRINT((ndo,""DNS name"")); break; case NI_QTYPE_NODEADDR: ND_PRINT((ndo,""node addresses"")); i = ni6->ni_flags; if (!i) break; /* NI_NODEADDR_FLAG_TRUNCATE undefined for query */ ND_PRINT((ndo,"" [%s%s%s%s%s%s]"", (i & NI_NODEADDR_FLAG_ANYCAST) ? ""a"" : """", (i & NI_NODEADDR_FLAG_GLOBAL) ? ""G"" : """", (i & NI_NODEADDR_FLAG_SITELOCAL) ? ""S"" : """", (i & NI_NODEADDR_FLAG_LINKLOCAL) ? ""L"" : """", (i & NI_NODEADDR_FLAG_COMPAT) ? ""C"" : """", (i & NI_NODEADDR_FLAG_ALL) ? ""A"" : """")); break; default: ND_PRINT((ndo,""unknown"")); break; } if (ni6->ni_qtype == NI_QTYPE_NOOP || ni6->ni_qtype == NI_QTYPE_SUPTYPES) { if (siz != sizeof(*ni6)) if (ndo->ndo_vflag) ND_PRINT((ndo,"", invalid len"")); /*(*/ ND_PRINT((ndo,"")"")); break; } /* XXX backward compat, icmp-name-lookup-03 */ if (siz == sizeof(*ni6)) { ND_PRINT((ndo,"", 03 draft"")); /*(*/ ND_PRINT((ndo,"")"")); break; } switch (ni6->ni_code) { case ICMP6_NI_SUBJ_IPV6: if (!ND_TTEST2(*dp, sizeof(*ni6) + sizeof(struct in6_addr))) break; if (siz != sizeof(*ni6) + sizeof(struct in6_addr)) { if (ndo->ndo_vflag) ND_PRINT((ndo,"", invalid subject len"")); break; } ND_PRINT((ndo,"", subject=%s"", ip6addr_string(ndo, ni6 + 1))); break; case ICMP6_NI_SUBJ_FQDN: ND_PRINT((ndo,"", subject=DNS name"")); cp = (const u_char *)(ni6 + 1); if (cp[0] == ep - cp - 1) { /* icmp-name-lookup-03, pascal string */ if (ndo->ndo_vflag) ND_PRINT((ndo,"", 03 draft"")); cp++; ND_PRINT((ndo,"", \"""")); while (cp < ep) { safeputchar(ndo, *cp); cp++; } ND_PRINT((ndo,""\"""")); } else dnsname_print(ndo, cp, ep); break; case ICMP6_NI_SUBJ_IPV4: if (!ND_TTEST2(*dp, sizeof(*ni6) + sizeof(struct in_addr))) break; if (siz != sizeof(*ni6) + sizeof(struct in_addr)) { if (ndo->ndo_vflag) ND_PRINT((ndo,"", invalid subject len"")); break; } ND_PRINT((ndo,"", subject=%s"", ipaddr_string(ndo, ni6 + 1))); break; default: ND_PRINT((ndo,"", unknown subject"")); break; } /*(*/ ND_PRINT((ndo,"")"")); break; case ICMP6_NI_REPLY: if (icmp6len > siz) { ND_PRINT((ndo,""[|icmp6: node information reply]"")); break; } needcomma = 0; ni6 = (const struct icmp6_nodeinfo *)dp; ND_PRINT((ndo,"" node information reply"")); ND_PRINT((ndo,"" ("")); /*)*/ switch (ni6->ni_code) { case ICMP6_NI_SUCCESS: if (ndo->ndo_vflag) { ND_PRINT((ndo,""success"")); needcomma++; } break; case ICMP6_NI_REFUSED: ND_PRINT((ndo,""refused"")); needcomma++; if (siz != sizeof(*ni6)) if (ndo->ndo_vflag) ND_PRINT((ndo,"", invalid length"")); break; case ICMP6_NI_UNKNOWN: ND_PRINT((ndo,""unknown"")); needcomma++; if (siz != sizeof(*ni6)) if (ndo->ndo_vflag) ND_PRINT((ndo,"", invalid length"")); break; } if (ni6->ni_code != ICMP6_NI_SUCCESS) { /*(*/ ND_PRINT((ndo,"")"")); break; } switch (EXTRACT_16BITS(&ni6->ni_qtype)) { case NI_QTYPE_NOOP: if (needcomma) ND_PRINT((ndo,"", "")); ND_PRINT((ndo,""noop"")); if (siz != sizeof(*ni6)) if (ndo->ndo_vflag) ND_PRINT((ndo,"", invalid length"")); break; case NI_QTYPE_SUPTYPES: if (needcomma) ND_PRINT((ndo,"", "")); ND_PRINT((ndo,""supported qtypes"")); i = EXTRACT_16BITS(&ni6->ni_flags); if (i) ND_PRINT((ndo,"" [%s]"", (i & 0x01) ? ""C"" : """")); break; case NI_QTYPE_FQDN: if (needcomma) ND_PRINT((ndo,"", "")); ND_PRINT((ndo,""DNS name"")); cp = (const u_char *)(ni6 + 1) + 4; if (cp[0] == ep - cp - 1) { /* icmp-name-lookup-03, pascal string */ if (ndo->ndo_vflag) ND_PRINT((ndo,"", 03 draft"")); cp++; ND_PRINT((ndo,"", \"""")); while (cp < ep) { safeputchar(ndo, *cp); cp++; } ND_PRINT((ndo,""\"""")); } else dnsname_print(ndo, cp, ep); if ((EXTRACT_16BITS(&ni6->ni_flags) & 0x01) != 0) ND_PRINT((ndo,"" [TTL=%u]"", EXTRACT_32BITS(ni6 + 1))); break; case NI_QTYPE_NODEADDR: if (needcomma) ND_PRINT((ndo,"", "")); ND_PRINT((ndo,""node addresses"")); i = sizeof(*ni6); while (i < siz) { if (i + sizeof(struct in6_addr) + sizeof(int32_t) > siz) break; ND_PRINT((ndo,"" %s"", ip6addr_string(ndo, bp + i))); i += sizeof(struct in6_addr); ND_PRINT((ndo,""(%d)"", (int32_t)EXTRACT_32BITS(bp + i))); i += sizeof(int32_t); } i = ni6->ni_flags; if (!i) break; ND_PRINT((ndo,"" [%s%s%s%s%s%s%s]"", (i & NI_NODEADDR_FLAG_ANYCAST) ? ""a"" : """", (i & NI_NODEADDR_FLAG_GLOBAL) ? ""G"" : """", (i & NI_NODEADDR_FLAG_SITELOCAL) ? ""S"" : """", (i & NI_NODEADDR_FLAG_LINKLOCAL) ? ""L"" : """", (i & NI_NODEADDR_FLAG_COMPAT) ? ""C"" : """", (i & NI_NODEADDR_FLAG_ALL) ? ""A"" : """", (i & NI_NODEADDR_FLAG_TRUNCATE) ? ""T"" : """")); break; default: if (needcomma) ND_PRINT((ndo,"", "")); ND_PRINT((ndo,""unknown"")); break; } /*(*/ ND_PRINT((ndo,"")"")); break; } return; trunc: ND_PRINT((ndo, ""[|icmp6]"")); } ",1 "void MediaStreamManager::FinalizeRequestFailed( const std::string& label, DeviceRequest* request, MediaStreamRequestResult result) { DCHECK_CURRENTLY_ON(BrowserThread::IO); switch (request->request_type()) { case MEDIA_GENERATE_STREAM: { DCHECK(request->generate_stream_cb); std::move(request->generate_stream_cb) .Run(result, std::string(), MediaStreamDevices(), MediaStreamDevices()); break; } case MEDIA_OPEN_DEVICE_PEPPER_ONLY: { if (request->open_device_cb) { std::move(request->open_device_cb) .Run(false /* success */, std::string(), MediaStreamDevice()); } break; } case MEDIA_DEVICE_ACCESS: { DCHECK(request->media_access_request_cb); std::move(request->media_access_request_cb) .Run(MediaStreamDevices(), std::move(request->ui_proxy)); break; } case MEDIA_DEVICE_UPDATE: { return; } default: NOTREACHED(); break; } DeleteRequest(label); } ",0 "char* ewk_frame_script_execute(Evas_Object* ewkFrame, const char* script) { EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData, 0); EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->frame, 0); EINA_SAFETY_ON_NULL_RETURN_VAL(script, 0); #if USE(JSC) WTF::String resultString; JSC::JSValue result = smartData->frame->script()->executeScript(WTF::String::fromUTF8(script), true).jsValue(); if (!smartData->frame) // In case the script removed our frame from the page. return 0; if (!result || (!result.isBoolean() && !result.isString() && !result.isNumber())) return 0; JSC::JSLock lock(JSC::SilenceAssertionsOnly); JSC::ExecState* exec = smartData->frame->script()->globalObject(WebCore::mainThreadNormalWorld())->globalExec(); resultString = WebCore::ustringToString(result.toString(exec)->value(exec)); return strdup(resultString.utf8().data()); #else notImplemented(); return 0; #endif } ",0 "void FetchContext::PopulateResourceRequest( Resource::Type, const ClientHintsPreferences&, const FetchParameters::ResourceWidth&, ResourceRequest&) {} ",0 "base::DictionaryValue* GetAllNotificationsObserver::NotificationToJson( const Notification* note) { DictionaryValue* dict = new base::DictionaryValue(); dict->SetString(""content_url"", note->content_url().spec()); dict->SetString(""origin_url"", note->origin_url().spec()); dict->SetString(""display_source"", note->display_source()); dict->SetString(""id"", note->notification_id()); return dict; } ",0 "static inline void register_as_ext3(void) { int err = register_filesystem(&ext3_fs_type); if (err) printk(KERN_WARNING ""EXT4-fs: Unable to register as ext3 (%d)\n"", err); } ",0 "discard_unread_request_data(struct mg_connection *conn) { char buf[MG_BUF_LEN]; size_t to_read; int nread; if (conn == NULL) { return; } to_read = sizeof(buf); if (conn->is_chunked) { /* Chunked encoding: 3=chunk read completely * completely */ while (conn->is_chunked != 3) { nread = mg_read(conn, buf, to_read); if (nread <= 0) { break; } } } else { /* Not chunked: content length is known */ while (conn->consumed_content < conn->content_len) { if (to_read > (size_t)(conn->content_len - conn->consumed_content)) { to_read = (size_t)(conn->content_len - conn->consumed_content); } nread = mg_read(conn, buf, to_read); if (nread <= 0) { break; } } } } ",0 "static int cma_init_ud_qp(struct rdma_id_private *id_priv, struct ib_qp *qp) { struct ib_qp_attr qp_attr; int qp_attr_mask, ret; qp_attr.qp_state = IB_QPS_INIT; ret = rdma_init_qp_attr(&id_priv->id, &qp_attr, &qp_attr_mask); if (ret) return ret; ret = ib_modify_qp(qp, &qp_attr, qp_attr_mask); if (ret) return ret; qp_attr.qp_state = IB_QPS_RTR; ret = ib_modify_qp(qp, &qp_attr, IB_QP_STATE); if (ret) return ret; qp_attr.qp_state = IB_QPS_RTS; qp_attr.sq_psn = 0; ret = ib_modify_qp(qp, &qp_attr, IB_QP_STATE | IB_QP_SQ_PSN); return ret; } ",0 "PreconnectManager::PreconnectManager(base::WeakPtr delegate, Profile* profile) : delegate_(std::move(delegate)), profile_(profile), inflight_preresolves_count_(0) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK(profile_); } ",0 "WebDocument WebLocalFrameImpl::GetDocument() const { if (!GetFrame() || !GetFrame()->GetDocument()) return WebDocument(); return WebDocument(GetFrame()->GetDocument()); } ",0 "static int udf_fill_partdesc_info(struct super_block *sb, struct partitionDesc *p, int p_index) { struct udf_part_map *map; struct udf_sb_info *sbi = UDF_SB(sb); struct partitionHeaderDesc *phd; map = &sbi->s_partmaps[p_index]; map->s_partition_len = le32_to_cpu(p->partitionLength); /* blocks */ map->s_partition_root = le32_to_cpu(p->partitionStartingLocation); if (p->accessType == cpu_to_le32(PD_ACCESS_TYPE_READ_ONLY)) map->s_partition_flags |= UDF_PART_FLAG_READ_ONLY; if (p->accessType == cpu_to_le32(PD_ACCESS_TYPE_WRITE_ONCE)) map->s_partition_flags |= UDF_PART_FLAG_WRITE_ONCE; if (p->accessType == cpu_to_le32(PD_ACCESS_TYPE_REWRITABLE)) map->s_partition_flags |= UDF_PART_FLAG_REWRITABLE; if (p->accessType == cpu_to_le32(PD_ACCESS_TYPE_OVERWRITABLE)) map->s_partition_flags |= UDF_PART_FLAG_OVERWRITABLE; udf_debug(""Partition (%d type %x) starts at physical %d, block length %d\n"", p_index, map->s_partition_type, map->s_partition_root, map->s_partition_len); if (strcmp(p->partitionContents.ident, PD_PARTITION_CONTENTS_NSR02) && strcmp(p->partitionContents.ident, PD_PARTITION_CONTENTS_NSR03)) return 0; phd = (struct partitionHeaderDesc *)p->partitionContentsUse; if (phd->unallocSpaceTable.extLength) { struct kernel_lb_addr loc = { .logicalBlockNum = le32_to_cpu( phd->unallocSpaceTable.extPosition), .partitionReferenceNum = p_index, }; map->s_uspace.s_table = udf_iget(sb, &loc); if (!map->s_uspace.s_table) { udf_debug(""cannot load unallocSpaceTable (part %d)\n"", p_index); return 1; } map->s_partition_flags |= UDF_PART_FLAG_UNALLOC_TABLE; udf_debug(""unallocSpaceTable (part %d) @ %ld\n"", p_index, map->s_uspace.s_table->i_ino); } if (phd->unallocSpaceBitmap.extLength) { struct udf_bitmap *bitmap = udf_sb_alloc_bitmap(sb, p_index); if (!bitmap) return 1; map->s_uspace.s_bitmap = bitmap; bitmap->s_extLength = le32_to_cpu( phd->unallocSpaceBitmap.extLength); bitmap->s_extPosition = le32_to_cpu( phd->unallocSpaceBitmap.extPosition); map->s_partition_flags |= UDF_PART_FLAG_UNALLOC_BITMAP; udf_debug(""unallocSpaceBitmap (part %d) @ %d\n"", p_index, bitmap->s_extPosition); } if (phd->partitionIntegrityTable.extLength) udf_debug(""partitionIntegrityTable (part %d)\n"", p_index); if (phd->freedSpaceTable.extLength) { struct kernel_lb_addr loc = { .logicalBlockNum = le32_to_cpu( phd->freedSpaceTable.extPosition), .partitionReferenceNum = p_index, }; map->s_fspace.s_table = udf_iget(sb, &loc); if (!map->s_fspace.s_table) { udf_debug(""cannot load freedSpaceTable (part %d)\n"", p_index); return 1; } map->s_partition_flags |= UDF_PART_FLAG_FREED_TABLE; udf_debug(""freedSpaceTable (part %d) @ %ld\n"", p_index, map->s_fspace.s_table->i_ino); } if (phd->freedSpaceBitmap.extLength) { struct udf_bitmap *bitmap = udf_sb_alloc_bitmap(sb, p_index); if (!bitmap) return 1; map->s_fspace.s_bitmap = bitmap; bitmap->s_extLength = le32_to_cpu( phd->freedSpaceBitmap.extLength); bitmap->s_extPosition = le32_to_cpu( phd->freedSpaceBitmap.extPosition); map->s_partition_flags |= UDF_PART_FLAG_FREED_BITMAP; udf_debug(""freedSpaceBitmap (part %d) @ %d\n"", p_index, bitmap->s_extPosition); } return 0; } ",0 "jas_image_t *jpg_decode(jas_stream_t *in, char *optstr) { struct jpeg_decompress_struct cinfo; struct jpeg_error_mgr jerr; FILE *input_file; jpg_dest_t dest_mgr_buf; jpg_dest_t *dest_mgr = &dest_mgr_buf; JDIMENSION num_scanlines; jas_image_t *image; int ret; jpg_dec_importopts_t opts; size_t size; if (jpg_dec_parseopts(optstr, &opts)) { goto error; } memset(&cinfo, 0, sizeof(struct jpeg_decompress_struct)); memset(dest_mgr, 0, sizeof(jpg_dest_t)); dest_mgr->data = 0; image = 0; input_file = 0; if (!(input_file = tmpfile())) { jas_eprintf(""cannot make temporary file\n""); goto error; } if (jpg_copystreamtofile(input_file, in)) { jas_eprintf(""cannot copy stream\n""); goto error; } rewind(input_file); /* Allocate and initialize a JPEG decompression object. */ JAS_DBGLOG(10, (""jpeg_std_error(%p)\n"", &jerr)); cinfo.err = jpeg_std_error(&jerr); JAS_DBGLOG(10, (""jpeg_create_decompress(%p)\n"", &cinfo)); jpeg_create_decompress(&cinfo); /* Specify the data source for decompression. */ JAS_DBGLOG(10, (""jpeg_stdio_src(%p, %p)\n"", &cinfo, input_file)); jpeg_stdio_src(&cinfo, input_file); /* Read the file header to obtain the image information. */ JAS_DBGLOG(10, (""jpeg_read_header(%p, TRUE)\n"", &cinfo)); ret = jpeg_read_header(&cinfo, TRUE); JAS_DBGLOG(10, (""jpeg_read_header return value %d\n"", ret)); if (ret != JPEG_HEADER_OK) { jas_eprintf(""jpeg_read_header did not return JPEG_HEADER_OK\n""); } JAS_DBGLOG(10, ( ""header: image_width %d; image_height %d; num_components %d\n"", cinfo.image_width, cinfo.image_height, cinfo.num_components) ); /* Start the decompressor. */ JAS_DBGLOG(10, (""jpeg_start_decompress(%p)\n"", &cinfo)); ret = jpeg_start_decompress(&cinfo); JAS_DBGLOG(10, (""jpeg_start_decompress return value %d\n"", ret)); JAS_DBGLOG(10, ( ""header: output_width %d; output_height %d; output_components %d\n"", cinfo.output_width, cinfo.output_height, cinfo.output_components) ); if (opts.max_size) { if (!jas_safe_size_mul(cinfo.output_width, cinfo.output_height, &size) || !jas_safe_size_mul(size, cinfo.output_components, &size)) { goto error; } if (size > opts.max_size) { jas_eprintf(""image is too large\n""); goto error; } } /* Create an image object to hold the decoded data. */ if (!(image = jpg_mkimage(&cinfo))) { jas_eprintf(""jpg_mkimage failed\n""); goto error; } /* Initialize the data sink object. */ dest_mgr->image = image; if (!(dest_mgr->data = jas_matrix_create(1, cinfo.output_width))) { jas_eprintf(""jas_matrix_create failed\n""); goto error; } dest_mgr->start_output = jpg_start_output; dest_mgr->put_pixel_rows = jpg_put_pixel_rows; dest_mgr->finish_output = jpg_finish_output; dest_mgr->buffer = (*cinfo.mem->alloc_sarray) ((j_common_ptr) &cinfo, JPOOL_IMAGE, cinfo.output_width * cinfo.output_components, (JDIMENSION) 1); dest_mgr->buffer_height = 1; dest_mgr->error = 0; /* Process the compressed data. */ (*dest_mgr->start_output)(&cinfo, dest_mgr); while (cinfo.output_scanline < cinfo.output_height) { JAS_DBGLOG(10, (""jpeg_read_scanlines(%p, %p, %lu)\n"", &cinfo, dest_mgr->buffer, JAS_CAST(unsigned long, dest_mgr->buffer_height))); num_scanlines = jpeg_read_scanlines(&cinfo, dest_mgr->buffer, dest_mgr->buffer_height); JAS_DBGLOG(10, (""jpeg_read_scanlines return value %lu\n"", JAS_CAST(unsigned long, num_scanlines))); (*dest_mgr->put_pixel_rows)(&cinfo, dest_mgr, num_scanlines); } (*dest_mgr->finish_output)(&cinfo, dest_mgr); /* Complete the decompression process. */ JAS_DBGLOG(10, (""jpeg_finish_decompress(%p)\n"", &cinfo)); jpeg_finish_decompress(&cinfo); /* Destroy the JPEG decompression object. */ JAS_DBGLOG(10, (""jpeg_destroy_decompress(%p)\n"", &cinfo)); jpeg_destroy_decompress(&cinfo); jas_matrix_destroy(dest_mgr->data); JAS_DBGLOG(10, (""fclose(%p)\n"", input_file)); fclose(input_file); input_file = 0; if (dest_mgr->error) { jas_eprintf(""error during decoding\n""); goto error; } return image; error: if (dest_mgr->data) { jas_matrix_destroy(dest_mgr->data); } if (image) { jas_image_destroy(image); } if (input_file) { fclose(input_file); } return 0; } ",1 "int timeval_subtract (struct timeval *result, struct timeval *x, struct timeval *y) { /* Perform the carry for the later subtraction by updating y. */ if (x->tv_usec < y->tv_usec) { int nsec = (y->tv_usec - x->tv_usec) / 1000000 + 1; y->tv_usec -= 1000000 * nsec; y->tv_sec += nsec; } if (x->tv_usec - y->tv_usec > 1000000) { int nsec = (x->tv_usec - y->tv_usec) / 1000000; y->tv_usec += 1000000 * nsec; y->tv_sec -= nsec; } /* Compute the time remaining to wait. tv_usec is certainly positive. */ result->tv_sec = x->tv_sec - y->tv_sec; result->tv_usec = x->tv_usec - y->tv_usec; /* Return 1 if result is negative. */ return x->tv_sec < y->tv_sec; } ",0 " Sort( PProfileList list ) { PProfile *old, current, next; /* First, set the new X coordinate of each profile */ current = *list; while ( current ) { current->X = *current->offset; current->offset += current->flags & Flow_Up ? 1 : -1; current->height--; current = current->link; } /* Then sort them */ old = list; current = *old; if ( !current ) return; next = current->link; while ( next ) { if ( current->X <= next->X ) { old = ¤t->link; current = *old; if ( !current ) return; } else { *old = next; current->link = next->link; next->link = current; old = list; current = *old; } next = current->link; } } ",0 "void Browser::NewWindow() { if (browser_defaults::kAlwaysOpenIncognitoWindow && CommandLine::ForCurrentProcess()->HasSwitch(switches::kIncognito)) { NewIncognitoWindow(); return; } UserMetrics::RecordAction(UserMetricsAction(""NewWindow""), profile_); SessionService* session_service = profile_->GetOriginalProfile()->GetSessionService(); if (!session_service || !session_service->RestoreIfNecessary(std::vector())) { Browser::OpenEmptyWindow(profile_->GetOriginalProfile()); } } ",0 "base::string16 AuthenticatorNotRegisteredErrorModel::GetStepTitle() const { return l10n_util::GetStringUTF16(IDS_WEBAUTHN_ERROR_WRONG_KEY_TITLE); } ",0 "static int macvtap_init(void) { int err; err = alloc_chrdev_region(&macvtap_major, 0, MACVTAP_NUM_DEVS, ""macvtap""); if (err) goto out1; cdev_init(&macvtap_cdev, &macvtap_fops); err = cdev_add(&macvtap_cdev, macvtap_major, MACVTAP_NUM_DEVS); if (err) goto out2; macvtap_class = class_create(THIS_MODULE, ""macvtap""); if (IS_ERR(macvtap_class)) { err = PTR_ERR(macvtap_class); goto out3; } err = register_netdevice_notifier(&macvtap_notifier_block); if (err) goto out4; err = macvlan_link_register(&macvtap_link_ops); if (err) goto out5; return 0; out5: unregister_netdevice_notifier(&macvtap_notifier_block); out4: class_unregister(macvtap_class); out3: cdev_del(&macvtap_cdev); out2: unregister_chrdev_region(macvtap_major, MACVTAP_NUM_DEVS); out1: return err; } ",0 " ps_parser_to_int( PS_Parser parser ) { ps_parser_skip_spaces( parser ); return PS_Conv_ToInt( &parser->cursor, parser->limit ); } ",0 "void Document::SetFeaturePolicy(const String& feature_policy_header) { if (!RuntimeEnabledFeatures::FeaturePolicyEnabled()) return; if (!feature_policy_header.IsEmpty()) UseCounter::Count(*this, WebFeature::kFeaturePolicyHeader); FeaturePolicy* parent_feature_policy = nullptr; ParsedFeaturePolicy container_policy; Vector messages; const ParsedFeaturePolicy& parsed_header = ParseFeaturePolicyHeader( feature_policy_header, GetSecurityOrigin(), &messages); if (frame_) { if (!frame_->IsMainFrame()) { parent_feature_policy = frame_->Tree().Parent()->GetSecurityContext()->GetFeaturePolicy(); } if (frame_->Owner()) container_policy = frame_->Owner()->ContainerPolicy(); } InitializeFeaturePolicy(parsed_header, container_policy, parent_feature_policy); for (const auto& message : messages) { AddConsoleMessage( ConsoleMessage::Create(kOtherMessageSource, kErrorMessageLevel, ""Error with Feature-Policy header: "" + message)); } if (frame_ && !parsed_header.empty()) frame_->Client()->DidSetFeaturePolicyHeader(parsed_header); } ",0 "void ExtensionService::GarbageCollectExtensions() { if (extension_prefs_->pref_service()->ReadOnly()) return; scoped_ptr info( extension_prefs_->GetInstalledExtensionsInfo()); std::map extension_paths; for (size_t i = 0; i < info->size(); ++i) extension_paths[info->at(i)->extension_id] = info->at(i)->extension_path; if (!BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, NewRunnableFunction( &extension_file_util::GarbageCollectExtensions, install_directory_, extension_paths))) NOTREACHED(); if (profile_) { ThemeServiceFactory::GetForProfile(profile_)->RemoveUnusedThemes(); } } ",0 "int fpga_reset(void) { int ret = 0; u8 resets; if (!check_boco2()) { /* we do not have BOCO2, this is not really used */ return 0; } /* if we have skipped, we only want to reset the PCIe part */ resets = skip ? PCIE_RST : PCIE_RST | TRAFFIC_RST; ret = boco_clear_bits(PRST1, resets); if (ret) return ret; /* small delay for the pulse */ udelay(10); ret = boco_set_bits(PRST1, resets); if (ret) return ret; return 0; } ",0 " void FaviconSource::SendDefaultResponse(int request_id) { if (!default_favicon_.get()) { default_favicon_ = ResourceBundle::GetSharedInstance().LoadDataResourceBytes( IDR_DEFAULT_FAVICON); } SendResponse(request_id, default_favicon_); } ",1 "static inline void vm_exit_controls_reset_shadow(struct vcpu_vmx *vmx) { vmx->vm_exit_controls_shadow = vmcs_read32(VM_EXIT_CONTROLS); } ",0 "int fib6_del(struct rt6_info *rt, struct nl_info *info) { struct net *net = info->nl_net; struct fib6_node *fn = rt->rt6i_node; struct rt6_info **rtp; #if RT6_DEBUG >= 2 if (rt->dst.obsolete>0) { WARN_ON(fn != NULL); return -ENOENT; } #endif if (!fn || rt == net->ipv6.ip6_null_entry) return -ENOENT; WARN_ON(!(fn->fn_flags & RTN_RTINFO)); if (!(rt->rt6i_flags & RTF_CACHE)) { struct fib6_node *pn = fn; #ifdef CONFIG_IPV6_SUBTREES /* clones of this route might be in another subtree */ if (rt->rt6i_src.plen) { while (!(pn->fn_flags & RTN_ROOT)) pn = pn->parent; pn = pn->parent; } #endif fib6_prune_clones(info->nl_net, pn, rt); } /* * Walk the leaf entries looking for ourself */ for (rtp = &fn->leaf; *rtp; rtp = &(*rtp)->dst.rt6_next) { if (*rtp == rt) { fib6_del_route(fn, rtp, info); return 0; } } return -ENOENT; } ",0 "void Document::enqueuePopstateEvent(PassRefPtr stateObject) { if (!ContextFeatures::pushStateEnabled(this)) return; dispatchWindowEvent(PopStateEvent::create(stateObject, domWindow() ? domWindow()->history() : 0)); } ",0 "static void armv7pmu_stop(void) { unsigned long flags; raw_spin_lock_irqsave(&pmu_lock, flags); /* Disable all counters */ armv7_pmnc_write(armv7_pmnc_read() & ~ARMV7_PMNC_E); raw_spin_unlock_irqrestore(&pmu_lock, flags); } ",0 "bool FileSystemPolicy::QueryAttributesFileAction( EvalResult eval_result, const ClientInfo& client_info, const std::wstring &file, uint32 attributes, FILE_BASIC_INFORMATION* file_info, NTSTATUS* nt_status) { if (ASK_BROKER != eval_result) { *nt_status = STATUS_ACCESS_DENIED; return true; } NtQueryAttributesFileFunction NtQueryAttributesFile = NULL; ResolveNTFunctionPtr(""NtQueryAttributesFile"", &NtQueryAttributesFile); UNICODE_STRING uni_name = {0}; OBJECT_ATTRIBUTES obj_attributes = {0}; InitObjectAttribs(file, attributes, NULL, &obj_attributes, &uni_name); *nt_status = NtQueryAttributesFile(&obj_attributes, file_info); return true; } ",0 "static int btrfs_submit_direct_hook(int rw, struct btrfs_dio_private *dip, int skip_sum) { struct inode *inode = dip->inode; struct btrfs_root *root = BTRFS_I(inode)->root; struct bio *bio; struct bio *orig_bio = dip->orig_bio; struct bio_vec *bvec = orig_bio->bi_io_vec; u64 start_sector = orig_bio->bi_sector; u64 file_offset = dip->logical_offset; u64 submit_len = 0; u64 map_length; int nr_pages = 0; int ret = 0; int async_submit = 0; map_length = orig_bio->bi_size; ret = btrfs_map_block(root->fs_info, READ, start_sector << 9, &map_length, NULL, 0); if (ret) { bio_put(orig_bio); return -EIO; } if (map_length >= orig_bio->bi_size) { bio = orig_bio; goto submit; } async_submit = 1; bio = btrfs_dio_bio_alloc(orig_bio->bi_bdev, start_sector, GFP_NOFS); if (!bio) return -ENOMEM; bio->bi_private = dip; bio->bi_end_io = btrfs_end_dio_bio; atomic_inc(&dip->pending_bios); while (bvec <= (orig_bio->bi_io_vec + orig_bio->bi_vcnt - 1)) { if (unlikely(map_length < submit_len + bvec->bv_len || bio_add_page(bio, bvec->bv_page, bvec->bv_len, bvec->bv_offset) < bvec->bv_len)) { /* * inc the count before we submit the bio so * we know the end IO handler won't happen before * we inc the count. Otherwise, the dip might get freed * before we're done setting it up */ atomic_inc(&dip->pending_bios); ret = __btrfs_submit_dio_bio(bio, inode, rw, file_offset, skip_sum, async_submit); if (ret) { bio_put(bio); atomic_dec(&dip->pending_bios); goto out_err; } start_sector += submit_len >> 9; file_offset += submit_len; submit_len = 0; nr_pages = 0; bio = btrfs_dio_bio_alloc(orig_bio->bi_bdev, start_sector, GFP_NOFS); if (!bio) goto out_err; bio->bi_private = dip; bio->bi_end_io = btrfs_end_dio_bio; map_length = orig_bio->bi_size; ret = btrfs_map_block(root->fs_info, READ, start_sector << 9, &map_length, NULL, 0); if (ret) { bio_put(bio); goto out_err; } } else { submit_len += bvec->bv_len; nr_pages ++; bvec++; } } submit: ret = __btrfs_submit_dio_bio(bio, inode, rw, file_offset, skip_sum, async_submit); if (!ret) return 0; bio_put(bio); out_err: dip->errors = 1; /* * before atomic variable goto zero, we must * make sure dip->errors is perceived to be set. */ smp_mb__before_atomic_dec(); if (atomic_dec_and_test(&dip->pending_bios)) bio_io_error(dip->orig_bio); /* bio_end_io() will handle error, so we needn't return it */ return 0; } ",0 "status_t Parcel::writeStrongBinderVector(const std::unique_ptr>>& val) { return writeNullableTypedVector(val, &Parcel::writeStrongBinder); } ",0 "void CueTimeline::AddCueInternal(TextTrackCue* cue) { double end_time = std::max(cue->startTime(), cue->endTime()); CueInterval interval = cue_tree_.CreateInterval(cue->startTime(), end_time, cue); if (!cue_tree_.Contains(interval)) cue_tree_.Add(interval); } ",0 "void BaseAudioContext::MaybeUnlockUserGesture() { if (!user_gesture_required_ || !AreAutoplayRequirementsFulfilled()) return; DCHECK(!autoplay_status_.has_value() || autoplay_status_ != AutoplayStatus::kAutoplayStatusSucceeded); user_gesture_required_ = false; autoplay_status_ = AutoplayStatus::kAutoplayStatusSucceeded; } ",0 "void AudioContext::derefUnfinishedSourceNodes() { ASSERT(isMainThread()); for (unsigned i = 0; i < m_referencedNodes.size(); ++i) m_referencedNodes.at(i)->breakConnection(); m_referencedNodes.clear(); } ",0 "static int cdrom_ioctl_media_changed(struct cdrom_device_info *cdi, unsigned long arg) { struct cdrom_changer_info *info; int ret; cd_dbg(CD_DO_IOCTL, ""entering CDROM_MEDIA_CHANGED\n""); if (!CDROM_CAN(CDC_MEDIA_CHANGED)) return -ENOSYS; /* cannot select disc or select current disc */ if (!CDROM_CAN(CDC_SELECT_DISC) || arg == CDSL_CURRENT) return media_changed(cdi, 1); if (arg >= cdi->capacity) return -EINVAL; info = kmalloc(sizeof(*info), GFP_KERNEL); if (!info) return -ENOMEM; ret = cdrom_read_mech_status(cdi, info); if (!ret) ret = info->slots[arg].change; kfree(info); return ret; } ",0 "CreateWinMemoryPressureMonitor(const base::CommandLine& parsed_command_line) { std::vector thresholds = base::SplitString(parsed_command_line.GetSwitchValueASCII( switches::kMemoryPressureThresholdsMb), "","", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); int moderate_threshold_mb = 0; int critical_threshold_mb = 0; if (thresholds.size() == 2 && base::StringToInt(thresholds[0], &moderate_threshold_mb) && base::StringToInt(thresholds[1], &critical_threshold_mb) && moderate_threshold_mb >= critical_threshold_mb && critical_threshold_mb >= 0) { return std::make_unique( moderate_threshold_mb, critical_threshold_mb); } return std::make_unique(); } ",0 "GLenum StubGLGetError() { return glGetError(); } ",0 " TT_VecLen( FT_F26Dot6 X, FT_F26Dot6 Y ) { FT_Vector v; v.x = X; v.y = Y; return FT_Vector_Length( &v ); } ",0 "static u32 tcp_illinois_ssthresh(struct sock *sk) { struct tcp_sock *tp = tcp_sk(sk); struct illinois *ca = inet_csk_ca(sk); /* Multiplicative decrease */ return max(tp->snd_cwnd - ((tp->snd_cwnd * ca->beta) >> BETA_SHIFT), 2U); } ",0 "struct mem_cgroup *mem_cgroup_iter(struct mem_cgroup *root, struct mem_cgroup *prev, struct mem_cgroup_reclaim_cookie *reclaim) { struct mem_cgroup *memcg = NULL; int id = 0; if (mem_cgroup_disabled()) return NULL; if (!root) root = root_mem_cgroup; if (prev && !reclaim) id = css_id(&prev->css); if (prev && prev != root) css_put(&prev->css); if (!root->use_hierarchy && root != root_mem_cgroup) { if (prev) return NULL; return root; } while (!memcg) { struct mem_cgroup_reclaim_iter *uninitialized_var(iter); struct cgroup_subsys_state *css; if (reclaim) { int nid = zone_to_nid(reclaim->zone); int zid = zone_idx(reclaim->zone); struct mem_cgroup_per_zone *mz; mz = mem_cgroup_zoneinfo(root, nid, zid); iter = &mz->reclaim_iter[reclaim->priority]; if (prev && reclaim->generation != iter->generation) return NULL; id = iter->position; } rcu_read_lock(); css = css_get_next(&mem_cgroup_subsys, id + 1, &root->css, &id); if (css) { if (css == &root->css || css_tryget(css)) memcg = container_of(css, struct mem_cgroup, css); } else id = 0; rcu_read_unlock(); if (reclaim) { iter->position = id; if (!css) iter->generation++; else if (!prev && memcg) reclaim->generation = iter->generation; } if (prev && !css) return NULL; } return memcg; } ",0 "CommandBufferProxyImpl::CreateVideoDecoder( media::VideoCodecProfile profile, media::VideoDecodeAccelerator::Client* client) { int decoder_route_id; if (!Send(new GpuCommandBufferMsg_CreateVideoDecoder(route_id_, profile, &decoder_route_id))) { LOG(ERROR) << ""Send(GpuCommandBufferMsg_CreateVideoDecoder) failed""; return NULL; } scoped_refptr decoder_host = new GpuVideoDecodeAcceleratorHost(channel_, decoder_route_id, client); bool inserted = video_decoder_hosts_.insert(std::make_pair( decoder_route_id, decoder_host)).second; DCHECK(inserted); channel_->AddRoute(decoder_route_id, decoder_host->AsWeakPtr()); return decoder_host; } ",0 "gpu::Capabilities GLES2DecoderPassthroughImpl::GetCapabilities() { DCHECK(initialized()); Capabilities caps; PopulateNumericCapabilities(&caps, feature_info_.get()); api()->glGetIntegervFn(GL_BIND_GENERATES_RESOURCE_CHROMIUM, &caps.bind_generates_resource_chromium); DCHECK_EQ(caps.bind_generates_resource_chromium != GL_FALSE, group_->bind_generates_resource()); caps.egl_image_external = feature_info_->feature_flags().oes_egl_image_external; caps.texture_format_astc = feature_info_->feature_flags().ext_texture_format_astc; caps.texture_format_atc = feature_info_->feature_flags().ext_texture_format_atc; caps.texture_format_bgra8888 = feature_info_->feature_flags().ext_texture_format_bgra8888; caps.texture_format_dxt1 = feature_info_->feature_flags().ext_texture_format_dxt1; caps.texture_format_dxt5 = feature_info_->feature_flags().ext_texture_format_dxt5; caps.texture_format_etc1 = feature_info_->feature_flags().oes_compressed_etc1_rgb8_texture; caps.texture_format_etc1_npot = caps.texture_format_etc1; caps.texture_rectangle = feature_info_->feature_flags().arb_texture_rectangle; caps.texture_usage = feature_info_->feature_flags().angle_texture_usage; caps.texture_storage = feature_info_->feature_flags().ext_texture_storage; caps.discard_framebuffer = feature_info_->feature_flags().ext_discard_framebuffer; caps.sync_query = feature_info_->feature_flags().chromium_sync_query; #if defined(OS_MACOSX) caps.iosurface = true; #endif caps.blend_equation_advanced = feature_info_->feature_flags().blend_equation_advanced; caps.blend_equation_advanced_coherent = feature_info_->feature_flags().blend_equation_advanced_coherent; caps.texture_rg = feature_info_->feature_flags().ext_texture_rg; caps.texture_norm16 = feature_info_->feature_flags().ext_texture_norm16; caps.texture_half_float_linear = feature_info_->feature_flags().enable_texture_half_float_linear; caps.color_buffer_half_float_rgba = feature_info_->ext_color_buffer_float_available() || feature_info_->ext_color_buffer_half_float_available(); caps.image_ycbcr_422 = feature_info_->feature_flags().chromium_image_ycbcr_422; caps.image_ycbcr_420v = feature_info_->feature_flags().chromium_image_ycbcr_420v; caps.image_ycbcr_420v_disabled_for_video_frames = group_->gpu_preferences() .disable_biplanar_gpu_memory_buffers_for_video_frames; caps.image_xr30 = feature_info_->feature_flags().chromium_image_xr30; caps.image_xb30 = feature_info_->feature_flags().chromium_image_xb30; caps.max_copy_texture_chromium_size = feature_info_->workarounds().max_copy_texture_chromium_size; caps.render_buffer_format_bgra8888 = feature_info_->feature_flags().ext_render_buffer_format_bgra8888; caps.occlusion_query_boolean = feature_info_->feature_flags().occlusion_query_boolean; caps.timer_queries = feature_info_->feature_flags().ext_disjoint_timer_query; caps.gpu_rasterization = group_->gpu_feature_info() .status_values[GPU_FEATURE_TYPE_GPU_RASTERIZATION] == kGpuFeatureStatusEnabled; caps.post_sub_buffer = surface_->SupportsPostSubBuffer(); caps.surfaceless = !offscreen_ && surface_->IsSurfaceless(); caps.flips_vertically = !offscreen_ && surface_->FlipsVertically(); caps.msaa_is_slow = feature_info_->workarounds().msaa_is_slow; caps.avoid_stencil_buffers = feature_info_->workarounds().avoid_stencil_buffers; caps.multisample_compatibility = feature_info_->feature_flags().ext_multisample_compatibility; caps.dc_layers = !offscreen_ && surface_->SupportsDCLayers(); caps.commit_overlay_planes = surface_->SupportsCommitOverlayPlanes(); caps.use_dc_overlays_for_video = surface_->UseOverlaysForVideo(); caps.protected_video_swap_chain = surface_->SupportsProtectedVideo(); caps.texture_npot = feature_info_->feature_flags().npot_ok; caps.chromium_gpu_fence = feature_info_->feature_flags().chromium_gpu_fence; caps.chromium_nonblocking_readback = true; caps.num_surface_buffers = surface_->GetBufferCount(); caps.gpu_memory_buffer_formats = feature_info_->feature_flags().gpu_memory_buffer_formats; caps.texture_target_exception_list = group_->gpu_preferences().texture_target_exception_list; return caps; } ",0 "static int cine_read_header(AVFormatContext *avctx) { AVIOContext *pb = avctx->pb; AVStream *st; unsigned int version, compression, offImageHeader, offSetup, offImageOffsets, biBitCount, length, CFA; int vflip; char *description; uint64_t i; st = avformat_new_stream(avctx, NULL); if (!st) return AVERROR(ENOMEM); st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; st->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO; st->codecpar->codec_tag = 0; /* CINEFILEHEADER structure */ avio_skip(pb, 4); // Type, Headersize compression = avio_rl16(pb); version = avio_rl16(pb); if (version != 1) { avpriv_request_sample(avctx, ""unknown version %i"", version); return AVERROR_INVALIDDATA; } avio_skip(pb, 12); // FirstMovieImage, TotalImageCount, FirstImageNumber st->duration = avio_rl32(pb); offImageHeader = avio_rl32(pb); offSetup = avio_rl32(pb); offImageOffsets = avio_rl32(pb); avio_skip(pb, 8); // TriggerTime /* BITMAPINFOHEADER structure */ avio_seek(pb, offImageHeader, SEEK_SET); avio_skip(pb, 4); //biSize st->codecpar->width = avio_rl32(pb); st->codecpar->height = avio_rl32(pb); if (avio_rl16(pb) != 1) // biPlanes return AVERROR_INVALIDDATA; biBitCount = avio_rl16(pb); if (biBitCount != 8 && biBitCount != 16 && biBitCount != 24 && biBitCount != 48) { avpriv_request_sample(avctx, ""unsupported biBitCount %i"", biBitCount); return AVERROR_INVALIDDATA; } switch (avio_rl32(pb)) { case BMP_RGB: vflip = 0; break; case 0x100: /* BI_PACKED */ st->codecpar->codec_tag = MKTAG('B', 'I', 'T', 0); vflip = 1; break; default: avpriv_request_sample(avctx, ""unknown bitmap compression""); return AVERROR_INVALIDDATA; } avio_skip(pb, 4); // biSizeImage /* parse SETUP structure */ avio_seek(pb, offSetup, SEEK_SET); avio_skip(pb, 140); // FrameRatae16 .. descriptionOld if (avio_rl16(pb) != 0x5453) return AVERROR_INVALIDDATA; length = avio_rl16(pb); if (length < 0x163C) { avpriv_request_sample(avctx, ""short SETUP header""); return AVERROR_INVALIDDATA; } avio_skip(pb, 616); // Binning .. bFlipH if (!avio_rl32(pb) ^ vflip) { st->codecpar->extradata = av_strdup(""BottomUp""); st->codecpar->extradata_size = 9; } avio_skip(pb, 4); // Grid avpriv_set_pts_info(st, 64, 1, avio_rl32(pb)); avio_skip(pb, 20); // Shutter .. bEnableColor set_metadata_int(&st->metadata, ""camera_version"", avio_rl32(pb), 0); set_metadata_int(&st->metadata, ""firmware_version"", avio_rl32(pb), 0); set_metadata_int(&st->metadata, ""software_version"", avio_rl32(pb), 0); set_metadata_int(&st->metadata, ""recording_timezone"", avio_rl32(pb), 0); CFA = avio_rl32(pb); set_metadata_int(&st->metadata, ""brightness"", avio_rl32(pb), 1); set_metadata_int(&st->metadata, ""contrast"", avio_rl32(pb), 1); set_metadata_int(&st->metadata, ""gamma"", avio_rl32(pb), 1); avio_skip(pb, 12 + 16); // Reserved1 .. AutoExpRect set_metadata_float(&st->metadata, ""wbgain[0].r"", av_int2float(avio_rl32(pb)), 1); set_metadata_float(&st->metadata, ""wbgain[0].b"", av_int2float(avio_rl32(pb)), 1); avio_skip(pb, 36); // WBGain[1].. WBView st->codecpar->bits_per_coded_sample = avio_rl32(pb); if (compression == CC_RGB) { if (biBitCount == 8) { st->codecpar->format = AV_PIX_FMT_GRAY8; } else if (biBitCount == 16) { st->codecpar->format = AV_PIX_FMT_GRAY16LE; } else if (biBitCount == 24) { st->codecpar->format = AV_PIX_FMT_BGR24; } else if (biBitCount == 48) { st->codecpar->format = AV_PIX_FMT_BGR48LE; } else { avpriv_request_sample(avctx, ""unsupported biBitCount %i"", biBitCount); return AVERROR_INVALIDDATA; } } else if (compression == CC_UNINT) { switch (CFA & 0xFFFFFF) { case CFA_BAYER: if (biBitCount == 8) { st->codecpar->format = AV_PIX_FMT_BAYER_GBRG8; } else if (biBitCount == 16) { st->codecpar->format = AV_PIX_FMT_BAYER_GBRG16LE; } else { avpriv_request_sample(avctx, ""unsupported biBitCount %i"", biBitCount); return AVERROR_INVALIDDATA; } break; case CFA_BAYERFLIP: if (biBitCount == 8) { st->codecpar->format = AV_PIX_FMT_BAYER_RGGB8; } else if (biBitCount == 16) { st->codecpar->format = AV_PIX_FMT_BAYER_RGGB16LE; } else { avpriv_request_sample(avctx, ""unsupported biBitCount %i"", biBitCount); return AVERROR_INVALIDDATA; } break; default: avpriv_request_sample(avctx, ""unsupported Color Field Array (CFA) %i"", CFA & 0xFFFFFF); return AVERROR_INVALIDDATA; } } else { //CC_LEAD avpriv_request_sample(avctx, ""unsupported compression %i"", compression); return AVERROR_INVALIDDATA; } avio_skip(pb, 668); // Conv8Min ... Sensor set_metadata_int(&st->metadata, ""shutter_ns"", avio_rl32(pb), 0); avio_skip(pb, 24); // EDRShutterNs ... ImHeightAcq #define DESCRIPTION_SIZE 4096 description = av_malloc(DESCRIPTION_SIZE + 1); if (!description) return AVERROR(ENOMEM); i = avio_get_str(pb, DESCRIPTION_SIZE, description, DESCRIPTION_SIZE + 1); if (i < DESCRIPTION_SIZE) avio_skip(pb, DESCRIPTION_SIZE - i); if (description[0]) av_dict_set(&st->metadata, ""description"", description, AV_DICT_DONT_STRDUP_VAL); else av_free(description); avio_skip(pb, 1176); // RisingEdge ... cmUser set_metadata_int(&st->metadata, ""enable_crop"", avio_rl32(pb), 1); set_metadata_int(&st->metadata, ""crop_left"", avio_rl32(pb), 1); set_metadata_int(&st->metadata, ""crop_top"", avio_rl32(pb), 1); set_metadata_int(&st->metadata, ""crop_right"", avio_rl32(pb), 1); set_metadata_int(&st->metadata, ""crop_bottom"", avio_rl32(pb), 1); /* parse image offsets */ avio_seek(pb, offImageOffsets, SEEK_SET); for (i = 0; i < st->duration; i++) av_add_index_entry(st, avio_rl64(pb), i, 0, 0, AVINDEX_KEYFRAME); return 0; } ",1 "raptor_libxml_endDocument(void* user_data) { raptor_sax2* sax2 = (raptor_sax2*)user_data; xmlParserCtxtPtr xc = sax2->xc; libxml2_endDocument(sax2->xc); if(xc->myDoc) { xmlFreeDoc(xc->myDoc); xc->myDoc = NULL; } } ",0 "void usage() { printf(""\n"" "" %s - (C) 2007,2008 Andrea Bittau\n"" "" http://www.aircrack-ng.org\n"" ""\n"" "" Usage: buddy-ng \n"" ""\n"" "" Options:\n"" ""\n"" "" -h : This help screen\n"" "" -p : Don't drop privileges\n"" ""\n"", getVersion(""Buddy-ng"", _MAJ, _MIN, _SUB_MIN, _REVISION, _BETA, _RC)); exit(1); } ",0 "static int __dwc3_gadget_ep_disable(struct dwc3_ep *dep) { struct dwc3 *dwc = dep->dwc; u32 reg; trace_dwc3_gadget_ep_disable(dep); dwc3_remove_requests(dwc, dep); /* make sure HW endpoint isn't stalled */ if (dep->flags & DWC3_EP_STALL) __dwc3_gadget_ep_set_halt(dep, 0, false); reg = dwc3_readl(dwc->regs, DWC3_DALEPENA); reg &= ~DWC3_DALEPENA_EP(dep->number); dwc3_writel(dwc->regs, DWC3_DALEPENA, reg); dep->stream_capable = false; dep->type = 0; dep->flags &= DWC3_EP_END_TRANSFER_PENDING; /* Clear out the ep descriptors for non-ep0 */ if (dep->number > 1) { dep->endpoint.comp_desc = NULL; dep->endpoint.desc = NULL; } return 0; } ",0 "void php_call_shutdown_functions(TSRMLS_D) /* {{{ */ { if (BG(user_shutdown_function_names)) { zend_try { zend_hash_apply(BG(user_shutdown_function_names), (apply_func_t) user_shutdown_function_call TSRMLS_CC); } zend_end_try(); php_free_shutdown_functions(TSRMLS_C); } } /* }}} */ ",0 "DEFINE_TRACE(AXNodeObject) { visitor->trace(m_node); AXObject::trace(visitor); } ",0 "dtls1_set_message_header_int(SSL *s, unsigned char mt, unsigned long len, unsigned short seq_num, unsigned long frag_off, unsigned long frag_len) { struct hm_header_st *msg_hdr = &s->d1->w_msg_hdr; msg_hdr->type = mt; msg_hdr->msg_len = len; msg_hdr->seq = seq_num; msg_hdr->frag_off = frag_off; msg_hdr->frag_len = frag_len; } ",0 " virtual void TearDown() { adapter_ = NULL; DBusThreadManager::Shutdown(); } ",0 "GDataFile* GDataEntry::AsGDataFile() { return NULL; } ",0 "void MetricsLog::RecordCoreSystemProfile(MetricsServiceClient* client, SystemProfileProto* system_profile) { system_profile->set_build_timestamp(metrics::MetricsLog::GetBuildTime()); system_profile->set_app_version(client->GetVersionString()); system_profile->set_channel(client->GetChannel()); system_profile->set_application_locale(client->GetApplicationLocale()); #if defined(ADDRESS_SANITIZER) || DCHECK_IS_ON() system_profile->set_is_instrumented_build(true); #endif metrics::SystemProfileProto::Hardware* hardware = system_profile->mutable_hardware(); #if !defined(OS_IOS) hardware->set_cpu_architecture(base::SysInfo::OperatingSystemArchitecture()); #endif hardware->set_system_ram_mb(base::SysInfo::AmountOfPhysicalMemoryMB()); hardware->set_hardware_class(base::SysInfo::HardwareModelName()); #if defined(OS_WIN) hardware->set_dll_base(reinterpret_cast(CURRENT_MODULE())); #endif metrics::SystemProfileProto::OS* os = system_profile->mutable_os(); os->set_name(base::SysInfo::OperatingSystemName()); os->set_version(base::SysInfo::OperatingSystemVersion()); #if defined(OS_CHROMEOS) os->set_kernel_version(base::SysInfo::KernelVersion()); #elif defined(OS_LINUX) os->set_kernel_version(base::SysInfo::OperatingSystemVersion()); #endif #if defined(OS_ANDROID) os->set_build_fingerprint( base::android::BuildInfo::GetInstance()->android_build_fp()); std::string package_name = client->GetAppPackageName(); if (!package_name.empty() && package_name != ""com.android.chrome"") system_profile->set_app_package_name(package_name); #endif } ",0 "bool WebGLRenderingContextBase::CanUseTexImageByGPU(GLenum format, GLenum type) { #if defined(OS_MACOSX) if (type == GL_UNSIGNED_SHORT_5_5_5_1) return false; #endif if (format == GL_RED_INTEGER) return false; #if defined(OS_ANDROID) if (type == GL_FLOAT) return false; #endif if (type == GL_HALF_FLOAT_OES) return false; return true; } ",0 "array_to_json_internal(Datum array, StringInfo result, bool use_line_feeds) { ArrayType *v = DatumGetArrayTypeP(array); Oid element_type = ARR_ELEMTYPE(v); int *dim; int ndim; int nitems; int count = 0; Datum *elements; bool *nulls; int16 typlen; bool typbyval; char typalign; JsonTypeCategory tcategory; Oid outfuncoid; ndim = ARR_NDIM(v); dim = ARR_DIMS(v); nitems = ArrayGetNItems(ndim, dim); if (nitems <= 0) { appendStringInfoString(result, ""[]""); return; } get_typlenbyvalalign(element_type, &typlen, &typbyval, &typalign); json_categorize_type(element_type, &tcategory, &outfuncoid); deconstruct_array(v, element_type, typlen, typbyval, typalign, &elements, &nulls, &nitems); array_dim_to_json(result, 0, ndim, dim, elements, nulls, &count, tcategory, outfuncoid, use_line_feeds); pfree(elements); pfree(nulls); } ",0 "static int oz_usb_vendor_class_req(void *hpd, u8 req_id, u8 req_type, u8 request, __le16 value, __le16 index, const u8 *data, int data_len) { struct oz_usb_ctx *usb_ctx = hpd; struct oz_pd *pd = usb_ctx->pd; struct oz_elt *elt; struct oz_elt_buf *eb = &pd->elt_buff; struct oz_elt_info *ei = oz_elt_info_alloc(&pd->elt_buff); struct oz_vendor_class_req *body; if (ei == NULL) return -1; elt = (struct oz_elt *)ei->data; elt->length = sizeof(struct oz_vendor_class_req) - 1 + data_len; body = (struct oz_vendor_class_req *)(elt+1); body->type = OZ_VENDOR_CLASS_REQ; body->req_id = req_id; body->req_type = req_type; body->request = request; put_unaligned(value, &body->value); put_unaligned(index, &body->index); if (data_len) memcpy(body->data, data, data_len); return oz_usb_submit_elt(eb, ei, usb_ctx, 0, 0); } ",0 "void PluginChannel::CleanUp() { for (size_t i = 0; i < plugin_stubs_.size(); ++i) RemoveRoute(plugin_stubs_[i]->instance_id()); scoped_refptr me(this); plugin_stubs_.clear(); } ",0 "xmlParseCommentComplex(xmlParserCtxtPtr ctxt, xmlChar *buf, size_t len, size_t size) { int q, ql; int r, rl; int cur, l; size_t count = 0; int inputid; inputid = ctxt->input->id; if (buf == NULL) { len = 0; size = XML_PARSER_BUFFER_SIZE; buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar)); if (buf == NULL) { xmlErrMemory(ctxt, NULL); return; } } GROW; /* Assure there's enough input data */ q = CUR_CHAR(ql); if (q == 0) goto not_terminated; if (!IS_CHAR(q)) { xmlFatalErrMsgInt(ctxt, XML_ERR_INVALID_CHAR, ""xmlParseComment: invalid xmlChar value %d\n"", q); xmlFree (buf); return; } NEXTL(ql); r = CUR_CHAR(rl); if (r == 0) goto not_terminated; if (!IS_CHAR(r)) { xmlFatalErrMsgInt(ctxt, XML_ERR_INVALID_CHAR, ""xmlParseComment: invalid xmlChar value %d\n"", q); xmlFree (buf); return; } NEXTL(rl); cur = CUR_CHAR(l); if (cur == 0) goto not_terminated; while (IS_CHAR(cur) && /* checked */ ((cur != '>') || (r != '-') || (q != '-'))) { if ((r == '-') && (q == '-')) { xmlFatalErr(ctxt, XML_ERR_HYPHEN_IN_COMMENT, NULL); } if ((len > XML_MAX_TEXT_LENGTH) && ((ctxt->options & XML_PARSE_HUGE) == 0)) { xmlFatalErrMsgStr(ctxt, XML_ERR_COMMENT_NOT_FINISHED, ""Comment too big found"", NULL); xmlFree (buf); return; } if (len + 5 >= size) { xmlChar *new_buf; size_t new_size; new_size = size * 2; new_buf = (xmlChar *) xmlRealloc(buf, new_size); if (new_buf == NULL) { xmlFree (buf); xmlErrMemory(ctxt, NULL); return; } buf = new_buf; size = new_size; } COPY_BUF(ql,buf,len,q); q = r; ql = rl; r = cur; rl = l; count++; if (count > 50) { GROW; count = 0; if (ctxt->instate == XML_PARSER_EOF) { xmlFree(buf); return; } } NEXTL(l); cur = CUR_CHAR(l); if (cur == 0) { SHRINK; GROW; cur = CUR_CHAR(l); } } buf[len] = 0; if (cur == 0) { xmlFatalErrMsgStr(ctxt, XML_ERR_COMMENT_NOT_FINISHED, ""Comment not terminated \n scope * | * | d is scope of the destination. * B-d | \ * | \ <- smaller scope is better if * B-15 | \ if scope is enough for destination. * | ret = B - scope (-1 <= scope >= d <= 15). * d-C-1 | / * |/ <- greater is better * -C / if scope is not enough for destination. * /| ret = scope - C (-1 <= d < scope <= 15). * * d - C - 1 < B -15 (for all -1 <= d <= 15). * C > d + 14 - B >= 15 + 14 - B = 29 - B. * Assume B = 0 and we get C > 29. */ ret = __ipv6_addr_src_scope(score->addr_type); if (ret >= dst->scope) ret = -ret; else ret -= 128; /* 30 is enough */ score->scopedist = ret; break; case IPV6_SADDR_RULE_PREFERRED: { /* Rule 3: Avoid deprecated and optimistic addresses */ u8 avoid = IFA_F_DEPRECATED; if (!ipv6_use_optimistic_addr(score->ifa->idev)) avoid |= IFA_F_OPTIMISTIC; ret = ipv6_saddr_preferred(score->addr_type) || !(score->ifa->flags & avoid); break; } #ifdef CONFIG_IPV6_MIP6 case IPV6_SADDR_RULE_HOA: { /* Rule 4: Prefer home address */ int prefhome = !(dst->prefs & IPV6_PREFER_SRC_COA); ret = !(score->ifa->flags & IFA_F_HOMEADDRESS) ^ prefhome; break; } #endif case IPV6_SADDR_RULE_OIF: /* Rule 5: Prefer outgoing interface */ ret = (!dst->ifindex || dst->ifindex == score->ifa->idev->dev->ifindex); break; case IPV6_SADDR_RULE_LABEL: /* Rule 6: Prefer matching label */ ret = ipv6_addr_label(net, &score->ifa->addr, score->addr_type, score->ifa->idev->dev->ifindex) == dst->label; break; case IPV6_SADDR_RULE_PRIVACY: { /* Rule 7: Prefer public address * Note: prefer temporary address if use_tempaddr >= 2 */ int preftmp = dst->prefs & (IPV6_PREFER_SRC_PUBLIC|IPV6_PREFER_SRC_TMP) ? !!(dst->prefs & IPV6_PREFER_SRC_TMP) : score->ifa->idev->cnf.use_tempaddr >= 2; ret = (!(score->ifa->flags & IFA_F_TEMPORARY)) ^ preftmp; break; } case IPV6_SADDR_RULE_ORCHID: /* Rule 8-: Prefer ORCHID vs ORCHID or * non-ORCHID vs non-ORCHID */ ret = !(ipv6_addr_orchid(&score->ifa->addr) ^ ipv6_addr_orchid(dst->addr)); break; case IPV6_SADDR_RULE_PREFIX: /* Rule 8: Use longest matching prefix */ ret = ipv6_addr_diff(&score->ifa->addr, dst->addr); if (ret > score->ifa->prefix_len) ret = score->ifa->prefix_len; score->matchlen = ret; break; #ifdef CONFIG_IPV6_OPTIMISTIC_DAD case IPV6_SADDR_RULE_NOT_OPTIMISTIC: /* Optimistic addresses still have lower precedence than other * preferred addresses. */ ret = !(score->ifa->flags & IFA_F_OPTIMISTIC); break; #endif default: ret = 0; } if (ret) __set_bit(i, score->scorebits); score->rule = i; out: return ret; } ",0 "void SessionModelAssociator::OnGotSession( int handle, std::vector* windows) { DCHECK(CalledOnValidThread()); DCHECK(local_session_syncid_); sync_pb::SessionSpecifics specifics; specifics.set_session_tag(GetCurrentMachineTag()); sync_pb::SessionHeader* header_s = specifics.mutable_header(); PopulateSessionSpecificsHeader(*windows, header_s); sync_api::WriteTransaction trans(FROM_HERE, sync_service_->GetUserShare()); sync_api::ReadNode root(&trans); if (!root.InitByTagLookup(kSessionsTag)) { LOG(ERROR) << kNoSessionsFolderError; return; } sync_api::WriteNode header_node(&trans); if (!header_node.InitByIdLookup(local_session_syncid_)) { LOG(ERROR) << ""Failed to load local session header node.""; return; } header_node.SetSessionSpecifics(specifics); } ",0 "static inline bool elementAffectsDirectionality(const Node* node) { return node->isHTMLElement() && (node->hasTagName(bdiTag) || toHTMLElement(node)->hasAttribute(dirAttr)); } ",0 "static int __rds_rdma_map(struct rds_sock *rs, struct rds_get_mr_args *args, u64 *cookie_ret, struct rds_mr **mr_ret) { struct rds_mr *mr = NULL, *found; unsigned int nr_pages; struct page **pages = NULL; struct scatterlist *sg; void *trans_private; unsigned long flags; rds_rdma_cookie_t cookie; unsigned int nents; long i; int ret; if (rs->rs_bound_addr == 0 || !rs->rs_transport) { ret = -ENOTCONN; /* XXX not a great errno */ goto out; } if (!rs->rs_transport->get_mr) { ret = -EOPNOTSUPP; goto out; } nr_pages = rds_pages_in_vec(&args->vec); if (nr_pages == 0) { ret = -EINVAL; goto out; } /* Restrict the size of mr irrespective of underlying transport * To account for unaligned mr regions, subtract one from nr_pages */ if ((nr_pages - 1) > (RDS_MAX_MSG_SIZE >> PAGE_SHIFT)) { ret = -EMSGSIZE; goto out; } rdsdebug(""RDS: get_mr addr %llx len %llu nr_pages %u\n"", args->vec.addr, args->vec.bytes, nr_pages); /* XXX clamp nr_pages to limit the size of this alloc? */ pages = kcalloc(nr_pages, sizeof(struct page *), GFP_KERNEL); if (!pages) { ret = -ENOMEM; goto out; } mr = kzalloc(sizeof(struct rds_mr), GFP_KERNEL); if (!mr) { ret = -ENOMEM; goto out; } refcount_set(&mr->r_refcount, 1); RB_CLEAR_NODE(&mr->r_rb_node); mr->r_trans = rs->rs_transport; mr->r_sock = rs; if (args->flags & RDS_RDMA_USE_ONCE) mr->r_use_once = 1; if (args->flags & RDS_RDMA_INVALIDATE) mr->r_invalidate = 1; if (args->flags & RDS_RDMA_READWRITE) mr->r_write = 1; /* * Pin the pages that make up the user buffer and transfer the page * pointers to the mr's sg array. We check to see if we've mapped * the whole region after transferring the partial page references * to the sg array so that we can have one page ref cleanup path. * * For now we have no flag that tells us whether the mapping is * r/o or r/w. We need to assume r/w, or we'll do a lot of RDMA to * the zero page. */ ret = rds_pin_pages(args->vec.addr, nr_pages, pages, 1); if (ret < 0) goto out; nents = ret; sg = kcalloc(nents, sizeof(*sg), GFP_KERNEL); if (!sg) { ret = -ENOMEM; goto out; } WARN_ON(!nents); sg_init_table(sg, nents); /* Stick all pages into the scatterlist */ for (i = 0 ; i < nents; i++) sg_set_page(&sg[i], pages[i], PAGE_SIZE, 0); rdsdebug(""RDS: trans_private nents is %u\n"", nents); /* Obtain a transport specific MR. If this succeeds, the * s/g list is now owned by the MR. * Note that dma_map() implies that pending writes are * flushed to RAM, so no dma_sync is needed here. */ trans_private = rs->rs_transport->get_mr(sg, nents, rs, &mr->r_key); if (IS_ERR(trans_private)) { for (i = 0 ; i < nents; i++) put_page(sg_page(&sg[i])); kfree(sg); ret = PTR_ERR(trans_private); goto out; } mr->r_trans_private = trans_private; rdsdebug(""RDS: get_mr put_user key is %x cookie_addr %p\n"", mr->r_key, (void *)(unsigned long) args->cookie_addr); /* The user may pass us an unaligned address, but we can only * map page aligned regions. So we keep the offset, and build * a 64bit cookie containing and pass that * around. */ cookie = rds_rdma_make_cookie(mr->r_key, args->vec.addr & ~PAGE_MASK); if (cookie_ret) *cookie_ret = cookie; if (args->cookie_addr && put_user(cookie, (u64 __user *)(unsigned long) args->cookie_addr)) { ret = -EFAULT; goto out; } /* Inserting the new MR into the rbtree bumps its * reference count. */ spin_lock_irqsave(&rs->rs_rdma_lock, flags); found = rds_mr_tree_walk(&rs->rs_rdma_keys, mr->r_key, mr); spin_unlock_irqrestore(&rs->rs_rdma_lock, flags); BUG_ON(found && found != mr); rdsdebug(""RDS: get_mr key is %x\n"", mr->r_key); if (mr_ret) { refcount_inc(&mr->r_refcount); *mr_ret = mr; } ret = 0; out: kfree(pages); if (mr) rds_mr_put(mr); return ret; } ",0 "static void print_md5(FILE *stream, unsigned char digest[16]) { int i; for (i = 0; i < 16; ++i) fprintf(stream, ""%02x"", digest[i]); } ",0 "static int mounts_open(struct inode *inode, struct file *file) { return mounts_open_common(inode, file, &mounts_op); } ",0 "static bool nested_vmx_exit_handled_cr(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12) { unsigned long exit_qualification = vmcs_readl(EXIT_QUALIFICATION); int cr = exit_qualification & 15; int reg = (exit_qualification >> 8) & 15; unsigned long val = kvm_register_read(vcpu, reg); switch ((exit_qualification >> 4) & 3) { case 0: /* mov to cr */ switch (cr) { case 0: if (vmcs12->cr0_guest_host_mask & (val ^ vmcs12->cr0_read_shadow)) return 1; break; case 3: if ((vmcs12->cr3_target_count >= 1 && vmcs12->cr3_target_value0 == val) || (vmcs12->cr3_target_count >= 2 && vmcs12->cr3_target_value1 == val) || (vmcs12->cr3_target_count >= 3 && vmcs12->cr3_target_value2 == val) || (vmcs12->cr3_target_count >= 4 && vmcs12->cr3_target_value3 == val)) return 0; if (nested_cpu_has(vmcs12, CPU_BASED_CR3_LOAD_EXITING)) return 1; break; case 4: if (vmcs12->cr4_guest_host_mask & (vmcs12->cr4_read_shadow ^ val)) return 1; break; case 8: if (nested_cpu_has(vmcs12, CPU_BASED_CR8_LOAD_EXITING)) return 1; break; } break; case 2: /* clts */ if ((vmcs12->cr0_guest_host_mask & X86_CR0_TS) && (vmcs12->cr0_read_shadow & X86_CR0_TS)) return 1; break; case 1: /* mov from cr */ switch (cr) { case 3: if (vmcs12->cpu_based_vm_exec_control & CPU_BASED_CR3_STORE_EXITING) return 1; break; case 8: if (vmcs12->cpu_based_vm_exec_control & CPU_BASED_CR8_STORE_EXITING) return 1; break; } break; case 3: /* lmsw */ /* * lmsw can change bits 1..3 of cr0, and only set bit 0 of * cr0. Other attempted changes are ignored, with no exit. */ if (vmcs12->cr0_guest_host_mask & 0xe & (val ^ vmcs12->cr0_read_shadow)) return 1; if ((vmcs12->cr0_guest_host_mask & 0x1) && !(vmcs12->cr0_read_shadow & 0x1) && (val & 0x1)) return 1; break; } return 0; } ",0 "RendererSchedulerImpl::MainThreadOnly::MainThreadOnly( RendererSchedulerImpl* renderer_scheduler_impl, const scoped_refptr& compositor_task_runner, base::TickClock* time_source, base::TimeTicks now) : loading_task_cost_estimator(time_source, kLoadingTaskEstimationSampleCount, kLoadingTaskEstimationPercentile), timer_task_cost_estimator(time_source, kTimerTaskEstimationSampleCount, kTimerTaskEstimationPercentile), idle_time_estimator(compositor_task_runner, time_source, kShortIdlePeriodDurationSampleCount, kShortIdlePeriodDurationPercentile), current_use_case(UseCase::kNone, ""RendererScheduler.UseCase"", renderer_scheduler_impl, &renderer_scheduler_impl->tracing_controller_, UseCaseToString), longest_jank_free_task_duration( base::TimeDelta(), ""RendererScheduler.LongestJankFreeTaskDuration"", renderer_scheduler_impl, &renderer_scheduler_impl->tracing_controller_, TimeDeltaToMilliseconds), renderer_pause_count(0, ""RendererScheduler.PauseCount"", renderer_scheduler_impl, &renderer_scheduler_impl->tracing_controller_), navigation_task_expected_count( 0, ""RendererScheduler.NavigationTaskExpectedCount"", renderer_scheduler_impl, &renderer_scheduler_impl->tracing_controller_), expensive_task_policy(ExpensiveTaskPolicy::kRun, ""RendererScheduler.ExpensiveTaskPolicy"", renderer_scheduler_impl, &renderer_scheduler_impl->tracing_controller_, ExpensiveTaskPolicyToString), rail_mode_for_tracing(current_policy.rail_mode(), ""RendererScheduler.RAILMode"", renderer_scheduler_impl, &renderer_scheduler_impl->tracing_controller_, RAILModeToString), renderer_hidden(false, ""RendererScheduler.Hidden"", renderer_scheduler_impl, &renderer_scheduler_impl->tracing_controller_, HiddenStateToString), renderer_backgrounded(kLaunchingProcessIsBackgrounded, ""RendererScheduler.Backgrounded"", renderer_scheduler_impl, &renderer_scheduler_impl->tracing_controller_, BackgroundStateToString), stopping_when_backgrounded_enabled( false, ""RendererScheduler.StoppingWhenBackgroundedEnabled"", renderer_scheduler_impl, &renderer_scheduler_impl->tracing_controller_, YesNoStateToString), stopped_when_backgrounded(false, ""RendererScheduler.StoppedWhenBackgrounded"", renderer_scheduler_impl, &renderer_scheduler_impl->tracing_controller_, YesNoStateToString), was_shutdown(false, ""RendererScheduler.WasShutdown"", renderer_scheduler_impl, &renderer_scheduler_impl->tracing_controller_, YesNoStateToString), loading_task_estimated_cost( base::TimeDelta(), ""RendererScheduler.LoadingTaskEstimatedCostMs"", renderer_scheduler_impl, &renderer_scheduler_impl->tracing_controller_, TimeDeltaToMilliseconds), timer_task_estimated_cost(base::TimeDelta(), ""RendererScheduler.TimerTaskEstimatedCostMs"", renderer_scheduler_impl, &renderer_scheduler_impl->tracing_controller_, TimeDeltaToMilliseconds), loading_tasks_seem_expensive( false, ""RendererScheduler.LoadingTasksSeemExpensive"", renderer_scheduler_impl, &renderer_scheduler_impl->tracing_controller_, YesNoStateToString), timer_tasks_seem_expensive(false, ""RendererScheduler.TimerTasksSeemExpensive"", renderer_scheduler_impl, &renderer_scheduler_impl->tracing_controller_, YesNoStateToString), touchstart_expected_soon(false, ""RendererScheduler.TouchstartExpectedSoon"", renderer_scheduler_impl, &renderer_scheduler_impl->tracing_controller_, YesNoStateToString), have_seen_a_begin_main_frame( false, ""RendererScheduler.HasSeenBeginMainFrame"", renderer_scheduler_impl, &renderer_scheduler_impl->tracing_controller_, YesNoStateToString), have_reported_blocking_intervention_in_current_policy( false, ""RendererScheduler.HasReportedBlockingInterventionInCurrentPolicy"", renderer_scheduler_impl, &renderer_scheduler_impl->tracing_controller_, YesNoStateToString), have_reported_blocking_intervention_since_navigation( false, ""RendererScheduler.HasReportedBlockingInterventionSinceNavigation"", renderer_scheduler_impl, &renderer_scheduler_impl->tracing_controller_, YesNoStateToString), has_visible_render_widget_with_touch_handler( false, ""RendererScheduler.HasVisibleRenderWidgetWithTouchHandler"", renderer_scheduler_impl, &renderer_scheduler_impl->tracing_controller_, YesNoStateToString), begin_frame_not_expected_soon( false, ""RendererScheduler.BeginFrameNotExpectedSoon"", renderer_scheduler_impl, &renderer_scheduler_impl->tracing_controller_, YesNoStateToString), in_idle_period_for_testing(false, ""RendererScheduler.InIdlePeriod"", renderer_scheduler_impl, &renderer_scheduler_impl->tracing_controller_, YesNoStateToString), use_virtual_time(false, ""RendererScheduler.UseVirtualTime"", renderer_scheduler_impl, &renderer_scheduler_impl->tracing_controller_, YesNoStateToString), is_audio_playing(false, ""RendererScheduler.AudioPlaying"", renderer_scheduler_impl, &renderer_scheduler_impl->tracing_controller_, AudioPlayingStateToString), compositor_will_send_main_frame_not_expected( false, ""RendererScheduler.CompositorWillSendMainFrameNotExpected"", renderer_scheduler_impl, &renderer_scheduler_impl->tracing_controller_, YesNoStateToString), has_navigated(false, ""RendererScheduler.HasNavigated"", renderer_scheduler_impl, &renderer_scheduler_impl->tracing_controller_, YesNoStateToString), pause_timers_for_webview(false, ""RendererScheduler.PauseTimersForWebview"", renderer_scheduler_impl, &renderer_scheduler_impl->tracing_controller_, YesNoStateToString), background_status_changed_at(now), rail_mode_observer(nullptr), wake_up_budget_pool(nullptr), metrics_helper(renderer_scheduler_impl, now, renderer_backgrounded), process_type(RendererProcessType::kRenderer, ""RendererScheduler.ProcessType"", renderer_scheduler_impl, &renderer_scheduler_impl->tracing_controller_, RendererProcessTypeToString), task_description_for_tracing( base::nullopt, ""RendererScheduler.MainThreadTask"", renderer_scheduler_impl, &renderer_scheduler_impl->tracing_controller_, OptionalTaskDescriptionToString), virtual_time_policy(VirtualTimePolicy::kAdvance), virtual_time_pause_count(0), max_virtual_time_task_starvation_count(0), virtual_time_stopped(false), nested_runloop(false) {} ",0 "GF_Err gf_isom_hevc_config_update_ex(GF_ISOFile *the_file, u32 trackNumber, u32 DescriptionIndex, GF_HEVCConfig *cfg, u32 operand_type) { u32 array_incomplete; GF_TrackBox *trak; GF_Err e; GF_MPEGVisualSampleEntryBox *entry; e = CanAccessMovie(the_file, GF_ISOM_OPEN_WRITE); if (e) return e; trak = gf_isom_get_track_from_file(the_file, trackNumber); if (!trak || !trak->Media || !DescriptionIndex) return GF_BAD_PARAM; entry = (GF_MPEGVisualSampleEntryBox *)gf_list_get(trak->Media->information->sampleTable->SampleDescription->other_boxes, DescriptionIndex-1); if (!entry) return GF_BAD_PARAM; switch (entry->type) { case GF_ISOM_BOX_TYPE_HVC1: case GF_ISOM_BOX_TYPE_HEV1: case GF_ISOM_BOX_TYPE_HVC2: case GF_ISOM_BOX_TYPE_HEV2: case GF_ISOM_BOX_TYPE_LHV1: case GF_ISOM_BOX_TYPE_LHE1: case GF_ISOM_BOX_TYPE_HVT1: break; default: return GF_BAD_PARAM; } if (operand_type == GF_ISOM_HVCC_SET_TILE_BASE_TRACK) { if (entry->type==GF_ISOM_BOX_TYPE_HVC1) entry->type = GF_ISOM_BOX_TYPE_HVC2; else if (entry->type==GF_ISOM_BOX_TYPE_HEV1) entry->type = GF_ISOM_BOX_TYPE_HEV2; } else if (operand_type == GF_ISOM_HVCC_SET_TILE) { if (!entry->hevc_config) entry->hevc_config = (GF_HEVCConfigurationBox*)gf_isom_box_new(GF_ISOM_BOX_TYPE_HVCC); if (entry->hevc_config->config) gf_odf_hevc_cfg_del(entry->hevc_config->config); entry->hevc_config->config = NULL; entry->type = GF_ISOM_BOX_TYPE_HVT1; } else if (operand_type < GF_ISOM_HVCC_SET_LHVC) { if ((operand_type != GF_ISOM_HVCC_SET_INBAND) && !entry->hevc_config) entry->hevc_config = (GF_HEVCConfigurationBox*)gf_isom_box_new(GF_ISOM_BOX_TYPE_HVCC); if (cfg) { if (entry->hevc_config->config) gf_odf_hevc_cfg_del(entry->hevc_config->config); entry->hevc_config->config = HEVC_DuplicateConfig(cfg); } else if (operand_type != GF_ISOM_HVCC_SET_TILE) { operand_type=GF_ISOM_HVCC_SET_INBAND; } array_incomplete = (operand_type==GF_ISOM_HVCC_SET_INBAND) ? 1 : 0; if (entry->hevc_config && hevc_cleanup_config(entry->hevc_config->config, operand_type)) array_incomplete=1; if (entry->lhvc_config && hevc_cleanup_config(entry->lhvc_config->config, operand_type)) array_incomplete=1; switch (entry->type) { case GF_ISOM_BOX_TYPE_HEV1: case GF_ISOM_BOX_TYPE_HVC1: entry->type = array_incomplete ? GF_ISOM_BOX_TYPE_HEV1 : GF_ISOM_BOX_TYPE_HVC1; break; case GF_ISOM_BOX_TYPE_HEV2: case GF_ISOM_BOX_TYPE_HVC2: entry->type = array_incomplete ? GF_ISOM_BOX_TYPE_HEV2 : GF_ISOM_BOX_TYPE_HVC2; break; case GF_ISOM_BOX_TYPE_LHE1: case GF_ISOM_BOX_TYPE_LHV1: entry->type = array_incomplete ? GF_ISOM_BOX_TYPE_LHE1 : GF_ISOM_BOX_TYPE_LHV1; break; } } else { /*SVCC replacement/removal with HEVC base, backward compatible signaling*/ if ((operand_type==GF_ISOM_HVCC_SET_LHVC_WITH_BASE_BACKWARD) || (operand_type==GF_ISOM_HVCC_SET_LHVC_WITH_BASE)) { if (!entry->hevc_config) return GF_BAD_PARAM; if (!cfg) { if (entry->lhvc_config) { gf_isom_box_del((GF_Box*)entry->lhvc_config); entry->lhvc_config = NULL; } if (entry->type==GF_ISOM_BOX_TYPE_LHE1) entry->type = (operand_type==GF_ISOM_HVCC_SET_LHVC_WITH_BASE) ? GF_ISOM_BOX_TYPE_HEV2 : GF_ISOM_BOX_TYPE_HEV1; else if (entry->type==GF_ISOM_BOX_TYPE_HEV1) entry->type = (operand_type==GF_ISOM_HVCC_SET_LHVC_WITH_BASE) ? GF_ISOM_BOX_TYPE_HEV2 : GF_ISOM_BOX_TYPE_HEV1; else entry->type = (operand_type==GF_ISOM_HVCC_SET_LHVC_WITH_BASE) ? GF_ISOM_BOX_TYPE_HVC2 : GF_ISOM_BOX_TYPE_HVC1; } else { if (!entry->lhvc_config) entry->lhvc_config = (GF_HEVCConfigurationBox*)gf_isom_box_new(GF_ISOM_BOX_TYPE_LHVC); if (entry->lhvc_config->config) gf_odf_hevc_cfg_del(entry->lhvc_config->config); entry->lhvc_config->config = HEVC_DuplicateConfig(cfg); if (operand_type==GF_ISOM_HVCC_SET_LHVC_WITH_BASE_BACKWARD) { if (entry->type==GF_ISOM_BOX_TYPE_HEV2) entry->type = GF_ISOM_BOX_TYPE_HEV1; else entry->type = GF_ISOM_BOX_TYPE_HVC1; } else { if (entry->type==GF_ISOM_BOX_TYPE_HEV1) entry->type = GF_ISOM_BOX_TYPE_HEV2; else entry->type = GF_ISOM_BOX_TYPE_HVC2; } } } /*LHEVC track without base*/ else if (operand_type==GF_ISOM_HVCC_SET_LHVC) { if (entry->hevc_config) { gf_isom_box_del((GF_Box*)entry->hevc_config); entry->hevc_config=NULL; } if (!cfg) return GF_BAD_PARAM; if (!entry->lhvc_config) entry->lhvc_config = (GF_HEVCConfigurationBox*)gf_isom_box_new(GF_ISOM_BOX_TYPE_LHVC); if (entry->lhvc_config->config) gf_odf_hevc_cfg_del(entry->lhvc_config->config); entry->lhvc_config->config = HEVC_DuplicateConfig(cfg); if ((entry->type==GF_ISOM_BOX_TYPE_HEV1) || (entry->type==GF_ISOM_BOX_TYPE_HEV2)) entry->type = GF_ISOM_BOX_TYPE_LHE1; else entry->type = GF_ISOM_BOX_TYPE_LHV1; } /*LHEVC inband, no config change*/ else if (operand_type==GF_ISOM_LHCC_SET_INBAND) { entry->type = GF_ISOM_BOX_TYPE_LHE1; } } HEVC_RewriteESDescriptor(entry); return GF_OK; } ",0 "psf_asciiheader_printf (SF_PRIVATE *psf, const char *format, ...) { va_list argptr ; int maxlen ; char *start ; maxlen = strlen ((char*) psf->header) ; start = ((char*) psf->header) + maxlen ; maxlen = sizeof (psf->header) - maxlen ; va_start (argptr, format) ; vsnprintf (start, maxlen, format, argptr) ; va_end (argptr) ; /* Make sure the string is properly terminated. */ start [maxlen - 1] = 0 ; psf->headindex = strlen ((char*) psf->header) ; return ; } /* psf_asciiheader_printf */ ",1 "PHP_FUNCTION(pg_fetch_result) { zval *result, **field=NULL; long row; PGresult *pgsql_result; pgsql_result_handle *pg_result; int field_offset, pgsql_row, argc = ZEND_NUM_ARGS(); if (argc == 2) { if (zend_parse_parameters(argc TSRMLS_CC, ""rZ"", &result, &field) == FAILURE) { return; } } else { if (zend_parse_parameters(argc TSRMLS_CC, ""rlZ"", &result, &row, &field) == FAILURE) { return; } } ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, &result, -1, ""PostgreSQL result"", le_result); pgsql_result = pg_result->result; if (argc == 2) { if (pg_result->row < 0) { pg_result->row = 0; } pgsql_row = pg_result->row; if (pgsql_row >= PQntuples(pgsql_result)) { RETURN_FALSE; } } else { pgsql_row = row; if (pgsql_row < 0 || pgsql_row >= PQntuples(pgsql_result)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Unable to jump to row %ld on PostgreSQL result index %ld"", row, Z_LVAL_P(result)); RETURN_FALSE; } } switch(Z_TYPE_PP(field)) { case IS_STRING: field_offset = PQfnumber(pgsql_result, Z_STRVAL_PP(field)); break; default: convert_to_long_ex(field); field_offset = Z_LVAL_PP(field); break; } if (field_offset<0 || field_offset>=PQnfields(pgsql_result)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Bad column offset specified""); RETURN_FALSE; } if (PQgetisnull(pgsql_result, pgsql_row, field_offset)) { Z_TYPE_P(return_value) = IS_NULL; } else { char *value = PQgetvalue(pgsql_result, pgsql_row, field_offset); int value_len = PQgetlength(pgsql_result, pgsql_row, field_offset); ZVAL_STRINGL(return_value, value, value_len, 1); } } ",0 "void RenderFrameImpl::DidLoadResourceFromMemoryCache( const blink::WebURLRequest& request, const blink::WebURLResponse& response) { if (request.Url().ProtocolIs(url::kDataScheme)) return; Send(new FrameHostMsg_DidLoadResourceFromMemoryCache( routing_id_, request.Url(), request.HttpMethod().Utf8(), response.MimeType().Utf8(), WebURLRequestToResourceType(request))); } ",0 "static OPJ_BOOL opj_pi_next_rpcl(opj_pi_iterator_t * pi) { opj_pi_comp_t *comp = NULL; opj_pi_resolution_t *res = NULL; OPJ_UINT32 index = 0; if (!pi->first) { goto LABEL_SKIP; } else { OPJ_UINT32 compno, resno; pi->first = 0; pi->dx = 0; pi->dy = 0; for (compno = 0; compno < pi->numcomps; compno++) { comp = &pi->comps[compno]; for (resno = 0; resno < comp->numresolutions; resno++) { OPJ_UINT32 dx, dy; res = &comp->resolutions[resno]; dx = comp->dx * (1u << (res->pdx + comp->numresolutions - 1 - resno)); dy = comp->dy * (1u << (res->pdy + comp->numresolutions - 1 - resno)); pi->dx = !pi->dx ? dx : opj_uint_min(pi->dx, dx); pi->dy = !pi->dy ? dy : opj_uint_min(pi->dy, dy); } } } if (!pi->tp_on) { pi->poc.ty0 = pi->ty0; pi->poc.tx0 = pi->tx0; pi->poc.ty1 = pi->ty1; pi->poc.tx1 = pi->tx1; } for (pi->resno = pi->poc.resno0; pi->resno < pi->poc.resno1; pi->resno++) { for (pi->y = pi->poc.ty0; pi->y < pi->poc.ty1; pi->y += (OPJ_INT32)(pi->dy - (OPJ_UINT32)(pi->y % (OPJ_INT32)pi->dy))) { for (pi->x = pi->poc.tx0; pi->x < pi->poc.tx1; pi->x += (OPJ_INT32)(pi->dx - (OPJ_UINT32)(pi->x % (OPJ_INT32)pi->dx))) { for (pi->compno = pi->poc.compno0; pi->compno < pi->poc.compno1; pi->compno++) { OPJ_UINT32 levelno; OPJ_INT32 trx0, try0; OPJ_INT32 trx1, try1; OPJ_UINT32 rpx, rpy; OPJ_INT32 prci, prcj; comp = &pi->comps[pi->compno]; if (pi->resno >= comp->numresolutions) { continue; } res = &comp->resolutions[pi->resno]; levelno = comp->numresolutions - 1 - pi->resno; trx0 = opj_int_ceildiv(pi->tx0, (OPJ_INT32)(comp->dx << levelno)); try0 = opj_int_ceildiv(pi->ty0, (OPJ_INT32)(comp->dy << levelno)); trx1 = opj_int_ceildiv(pi->tx1, (OPJ_INT32)(comp->dx << levelno)); try1 = opj_int_ceildiv(pi->ty1, (OPJ_INT32)(comp->dy << levelno)); rpx = res->pdx + levelno; rpy = res->pdy + levelno; if (!((pi->y % (OPJ_INT32)(comp->dy << rpy) == 0) || ((pi->y == pi->ty0) && ((try0 << levelno) % (1 << rpy))))) { continue; } if (!((pi->x % (OPJ_INT32)(comp->dx << rpx) == 0) || ((pi->x == pi->tx0) && ((trx0 << levelno) % (1 << rpx))))) { continue; } if ((res->pw == 0) || (res->ph == 0)) { continue; } if ((trx0 == trx1) || (try0 == try1)) { continue; } prci = opj_int_floordivpow2(opj_int_ceildiv(pi->x, (OPJ_INT32)(comp->dx << levelno)), (OPJ_INT32)res->pdx) - opj_int_floordivpow2(trx0, (OPJ_INT32)res->pdx); prcj = opj_int_floordivpow2(opj_int_ceildiv(pi->y, (OPJ_INT32)(comp->dy << levelno)), (OPJ_INT32)res->pdy) - opj_int_floordivpow2(try0, (OPJ_INT32)res->pdy); pi->precno = (OPJ_UINT32)(prci + prcj * (OPJ_INT32)res->pw); for (pi->layno = pi->poc.layno0; pi->layno < pi->poc.layno1; pi->layno++) { index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno * pi->step_c + pi->precno * pi->step_p; if (!pi->include[index]) { pi->include[index] = 1; return OPJ_TRUE; } LABEL_SKIP: ; } } } } } return OPJ_FALSE; } ",1 "void camellia_xts_dec(void *ctx, u128 *dst, const u128 *src, le128 *iv) { glue_xts_crypt_128bit_one(ctx, dst, src, iv, GLUE_FUNC_CAST(camellia_dec_blk)); } ",0 "v8::Handle V8DataView::getUint8Callback(const v8::Arguments& args) { INC_STATS(""DOM.DataView.getUint8""); if (args.Length() < 1) return V8Proxy::throwNotEnoughArgumentsError(); DataView* imp = V8DataView::toNative(args.Holder()); ExceptionCode ec = 0; EXCEPTION_BLOCK(unsigned, byteOffset, toUInt32(args[0])); uint8_t result = imp->getUint8(byteOffset, ec); if (UNLIKELY(ec)) { V8Proxy::setDOMException(ec, args.GetIsolate()); return v8::Handle(); } return v8::Integer::New(result); } ",1 "int pixmap_high_level_pattern(gs_gstate * pgs) { gs_matrix m; gs_rect bbox; gs_fixed_rect clip_box; int code; gx_device_color *pdc = gs_currentdevicecolor_inline(pgs); const gs_client_pattern *ppat = gs_getpattern(&pdc->ccolor); gs_color_space *pcs; gs_pattern1_instance_t *pinst = (gs_pattern1_instance_t *)gs_currentcolor(pgs)->pattern; const pixmap_info *ppmap = ppat->client_data; code = gx_pattern_cache_add_dummy_entry(pgs, pinst, pgs->device->color_info.depth); if (code < 0) return code; code = gs_gsave(pgs); if (code < 0) return code; dev_proc(pgs->device, get_initial_matrix)(pgs->device, &m); gs_setmatrix(pgs, &m); code = gs_bbox_transform(&ppat->BBox, &ctm_only(pgs), &bbox); if (code < 0) { gs_grestore(pgs); return code; } clip_box.p.x = float2fixed(bbox.p.x); clip_box.p.y = float2fixed(bbox.p.y); clip_box.q.x = float2fixed(bbox.q.x); clip_box.q.y = float2fixed(bbox.q.y); code = gx_clip_to_rectangle(pgs, &clip_box); if (code < 0) { gs_grestore(pgs); return code; } { pattern_accum_param_s param; param.pinst = (void *)pinst; param.graphics_state = (void *)pgs; param.pinst_id = pinst->id; code = dev_proc(pgs->device, dev_spec_op)(pgs->device, gxdso_pattern_start_accum, ¶m, sizeof(pattern_accum_param_s)); } if (code < 0) { gs_grestore(pgs); return code; } if (ppmap->pcspace != 0) code = image_PaintProc(&pdc->ccolor, pgs); else { pcs = gs_cspace_new_DeviceGray(pgs->memory); if (pcs == NULL) return_error(gs_error_VMerror); gs_setcolorspace(pgs, pcs); code = mask_PaintProc(&pdc->ccolor, pgs); } if (code < 0) return code; code = gs_grestore(pgs); if (code < 0) return code; { pattern_accum_param_s param; param.pinst = (void *)pinst; param.graphics_state = (void *)pgs; param.pinst_id = pinst->id; code = dev_proc(pgs->device, dev_spec_op)(pgs->device, gxdso_pattern_finish_accum, ¶m, sizeof(pattern_accum_param_s)); } return code; } ",0 "json_to_recordset(PG_FUNCTION_ARGS) { return populate_recordset_worker(fcinfo, ""json_to_recordset"", false); } ",0 "static int ethtool_ioctl(struct net *net, struct compat_ifreq __user *ifr32) { struct compat_ethtool_rxnfc __user *compat_rxnfc; bool convert_in = false, convert_out = false; size_t buf_size = ALIGN(sizeof(struct ifreq), 8); struct ethtool_rxnfc __user *rxnfc; struct ifreq __user *ifr; u32 rule_cnt = 0, actual_rule_cnt; u32 ethcmd; u32 data; int ret; if (get_user(data, &ifr32->ifr_ifru.ifru_data)) return -EFAULT; compat_rxnfc = compat_ptr(data); if (get_user(ethcmd, &compat_rxnfc->cmd)) return -EFAULT; /* Most ethtool structures are defined without padding. * Unfortunately struct ethtool_rxnfc is an exception. */ switch (ethcmd) { default: break; case ETHTOOL_GRXCLSRLALL: /* Buffer size is variable */ if (get_user(rule_cnt, &compat_rxnfc->rule_cnt)) return -EFAULT; if (rule_cnt > KMALLOC_MAX_SIZE / sizeof(u32)) return -ENOMEM; buf_size += rule_cnt * sizeof(u32); /* fall through */ case ETHTOOL_GRXRINGS: case ETHTOOL_GRXCLSRLCNT: case ETHTOOL_GRXCLSRULE: convert_out = true; /* fall through */ case ETHTOOL_SRXCLSRLDEL: case ETHTOOL_SRXCLSRLINS: buf_size += sizeof(struct ethtool_rxnfc); convert_in = true; break; } ifr = compat_alloc_user_space(buf_size); rxnfc = (void *)ifr + ALIGN(sizeof(struct ifreq), 8); if (copy_in_user(&ifr->ifr_name, &ifr32->ifr_name, IFNAMSIZ)) return -EFAULT; if (put_user(convert_in ? rxnfc : compat_ptr(data), &ifr->ifr_ifru.ifru_data)) return -EFAULT; if (convert_in) { /* We expect there to be holes between fs.m_ext and * fs.ring_cookie and at the end of fs, but nowhere else. */ BUILD_BUG_ON(offsetof(struct compat_ethtool_rxnfc, fs.m_ext) + sizeof(compat_rxnfc->fs.m_ext) != offsetof(struct ethtool_rxnfc, fs.m_ext) + sizeof(rxnfc->fs.m_ext)); BUILD_BUG_ON( offsetof(struct compat_ethtool_rxnfc, fs.location) - offsetof(struct compat_ethtool_rxnfc, fs.ring_cookie) != offsetof(struct ethtool_rxnfc, fs.location) - offsetof(struct ethtool_rxnfc, fs.ring_cookie)); if (copy_in_user(rxnfc, compat_rxnfc, (void *)(&rxnfc->fs.m_ext + 1) - (void *)rxnfc) || copy_in_user(&rxnfc->fs.ring_cookie, &compat_rxnfc->fs.ring_cookie, (void *)(&rxnfc->fs.location + 1) - (void *)&rxnfc->fs.ring_cookie) || copy_in_user(&rxnfc->rule_cnt, &compat_rxnfc->rule_cnt, sizeof(rxnfc->rule_cnt))) return -EFAULT; } ret = dev_ioctl(net, SIOCETHTOOL, ifr); if (ret) return ret; if (convert_out) { if (copy_in_user(compat_rxnfc, rxnfc, (const void *)(&rxnfc->fs.m_ext + 1) - (const void *)rxnfc) || copy_in_user(&compat_rxnfc->fs.ring_cookie, &rxnfc->fs.ring_cookie, (const void *)(&rxnfc->fs.location + 1) - (const void *)&rxnfc->fs.ring_cookie) || copy_in_user(&compat_rxnfc->rule_cnt, &rxnfc->rule_cnt, sizeof(rxnfc->rule_cnt))) return -EFAULT; if (ethcmd == ETHTOOL_GRXCLSRLALL) { /* As an optimisation, we only copy the actual * number of rules that the underlying * function returned. Since Mallory might * change the rule count in user memory, we * check that it is less than the rule count * originally given (as the user buffer size), * which has been range-checked. */ if (get_user(actual_rule_cnt, &rxnfc->rule_cnt)) return -EFAULT; if (actual_rule_cnt < rule_cnt) rule_cnt = actual_rule_cnt; if (copy_in_user(&compat_rxnfc->rule_locs[0], &rxnfc->rule_locs[0], rule_cnt * sizeof(u32))) return -EFAULT; } } return 0; } ",0 "void drop_inmem_page(struct inode *inode, struct page *page) { struct f2fs_inode_info *fi = F2FS_I(inode); struct f2fs_sb_info *sbi = F2FS_I_SB(inode); struct list_head *head = &fi->inmem_pages; struct inmem_pages *cur = NULL; f2fs_bug_on(sbi, !IS_ATOMIC_WRITTEN_PAGE(page)); mutex_lock(&fi->inmem_lock); list_for_each_entry(cur, head, list) { if (cur->page == page) break; } f2fs_bug_on(sbi, !cur || cur->page != page); list_del(&cur->list); mutex_unlock(&fi->inmem_lock); dec_page_count(sbi, F2FS_INMEM_PAGES); kmem_cache_free(inmem_entry_slab, cur); ClearPageUptodate(page); set_page_private(page, 0); ClearPagePrivate(page); f2fs_put_page(page, 0); trace_f2fs_commit_inmem_page(page, INMEM_INVALIDATE); } ",0 "void ConvertAnswerOptionsToWebrtcAnswerOptions( const blink::WebRTCAnswerOptions& options, webrtc::PeerConnectionInterface::RTCOfferAnswerOptions* output) { output->voice_activity_detection = options.VoiceActivityDetection(); } ",0 "void InlineFlowBox::computeLogicalBoxHeights(int& maxPositionTop, int& maxPositionBottom, int& maxAscent, int& maxDescent, bool& setMaxAscent, bool& setMaxDescent, bool strictMode, GlyphOverflowAndFallbackFontsMap& textBoxDataMap, FontBaseline baselineType, VerticalPositionCache& verticalPositionCache) { if (isRootInlineBox()) { int height = lineHeight(); int baseline = baselinePosition(baselineType); if (hasTextChildren() || strictMode) { int ascent = baseline; int descent = height - ascent; if (maxAscent < ascent || !setMaxAscent) { maxAscent = ascent; setMaxAscent = true; } if (maxDescent < descent || !setMaxDescent) { maxDescent = descent; setMaxDescent = true; } } } for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { if (curr->renderer()->isPositioned()) continue; // Positioned placeholders don't affect calculations. bool isInlineFlow = curr->isInlineFlowBox(); bool affectsAscent = false; bool affectsDescent = false; curr->setLogicalTop(verticalPositionForBox(curr, baselineType, m_firstLine, verticalPositionCache)); int lineHeight; int baseline; Vector* usedFonts = 0; if (curr->isInlineTextBox()) { GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.find(static_cast(curr)); usedFonts = it == textBoxDataMap.end() ? 0 : &it->second.first; } if (usedFonts && !usedFonts->isEmpty() && curr->renderer()->style(m_firstLine)->lineHeight().isNegative()) { usedFonts->append(curr->renderer()->style(m_firstLine)->font().primaryFont()); bool baselineSet = false; baseline = 0; int baselineToBottom = 0; for (size_t i = 0; i < usedFonts->size(); ++i) { const FontMetrics& fontMetrics = usedFonts->at(i)->fontMetrics(); int halfLeading = (fontMetrics.lineSpacing() - fontMetrics.height()) / 2; int usedFontBaseline = halfLeading + fontMetrics.ascent(baselineType); int usedFontBaselineToBottom = fontMetrics.lineSpacing() - usedFontBaseline; if (!baselineSet) { baselineSet = true; baseline = usedFontBaseline; baselineToBottom = usedFontBaselineToBottom; } else { baseline = max(baseline, usedFontBaseline); baselineToBottom = max(baselineToBottom, usedFontBaselineToBottom); } if (!affectsAscent) affectsAscent = fontMetrics.ascent() - curr->logicalTop() > 0; if (!affectsDescent) affectsDescent = fontMetrics.descent() + curr->logicalTop() > 0; } lineHeight = baseline + baselineToBottom; } else { lineHeight = curr->lineHeight(); baseline = curr->baselinePosition(baselineType); if (curr->isText() || isInlineFlow) { const FontMetrics& fontMetrics = curr->renderer()->style(m_firstLine)->fontMetrics(); affectsAscent = fontMetrics.ascent(baselineType) - curr->logicalTop() > 0; affectsDescent = fontMetrics.descent(baselineType) + curr->logicalTop() > 0; } else { affectsAscent = true; affectsDescent = true; } } if (curr->verticalAlign() == TOP) { if (maxPositionTop < lineHeight) maxPositionTop = lineHeight; } else if (curr->verticalAlign() == BOTTOM) { if (maxPositionBottom < lineHeight) maxPositionBottom = lineHeight; } else if ((!isInlineFlow || static_cast(curr)->hasTextChildren()) || curr->boxModelObject()->hasInlineDirectionBordersOrPadding() || strictMode) { int ascent = baseline - curr->logicalTop(); int descent = lineHeight - ascent; if (affectsAscent && (maxAscent < ascent || !setMaxAscent)) { maxAscent = ascent; setMaxAscent = true; } if (affectsDescent && (maxDescent < descent || !setMaxDescent)) { maxDescent = descent; setMaxDescent = true; } } if (curr->isInlineFlowBox()) static_cast(curr)->computeLogicalBoxHeights(maxPositionTop, maxPositionBottom, maxAscent, maxDescent, setMaxAscent, setMaxDescent, strictMode, textBoxDataMap, baselineType, verticalPositionCache); } } ",0 "const fz_cmm_engine *fz_get_cmm_engine(fz_context *ctx) { return ctx->colorspace ? ctx->colorspace->cmm : NULL; } ",0 "void account_steal_ticks(unsigned long ticks) { account_steal_time(jiffies_to_cputime(ticks)); } ",0 "int imap_buffy_check(int check_stats) { struct ImapData *idata = NULL; struct ImapData *lastdata = NULL; struct Buffy *mailbox = NULL; char name[LONG_STRING]; char command[LONG_STRING]; char munged[LONG_STRING]; int buffies = 0; for (mailbox = Incoming; mailbox; mailbox = mailbox->next) { /* Init newly-added mailboxes */ if (!mailbox->magic) { if (mx_is_imap(mailbox->path)) mailbox->magic = MUTT_IMAP; } if (mailbox->magic != MUTT_IMAP) continue; if (get_mailbox(mailbox->path, &idata, name, sizeof(name)) < 0) { mailbox->new = false; continue; } /* Don't issue STATUS on the selected mailbox, it will be NOOPed or * IDLEd elsewhere. * idata->mailbox may be NULL for connections other than the current * mailbox's, and shouldn't expand to INBOX in that case. #3216. */ if (idata->mailbox && (imap_mxcmp(name, idata->mailbox) == 0)) { mailbox->new = false; continue; } if (!mutt_bit_isset(idata->capabilities, IMAP4REV1) && !mutt_bit_isset(idata->capabilities, STATUS)) { mutt_debug(2, ""Server doesn't support STATUS\n""); continue; } if (lastdata && idata != lastdata) { /* Send commands to previous server. Sorting the buffy list * may prevent some infelicitous interleavings */ if (imap_exec(lastdata, NULL, IMAP_CMD_FAIL_OK | IMAP_CMD_POLL) == -1) mutt_debug(1, ""#1 Error polling mailboxes\n""); lastdata = NULL; } if (!lastdata) lastdata = idata; imap_munge_mbox_name(idata, munged, sizeof(munged), name); if (check_stats) { snprintf(command, sizeof(command), ""STATUS %s (UIDNEXT UIDVALIDITY UNSEEN RECENT MESSAGES)"", munged); } else { snprintf(command, sizeof(command), ""STATUS %s (UIDNEXT UIDVALIDITY UNSEEN RECENT)"", munged); } if (imap_exec(idata, command, IMAP_CMD_QUEUE | IMAP_CMD_POLL) < 0) { mutt_debug(1, ""Error queueing command\n""); return 0; } } if (lastdata && (imap_exec(lastdata, NULL, IMAP_CMD_FAIL_OK | IMAP_CMD_POLL) == -1)) { mutt_debug(1, ""#2 Error polling mailboxes\n""); return 0; } /* collect results */ for (mailbox = Incoming; mailbox; mailbox = mailbox->next) { if (mailbox->magic == MUTT_IMAP && mailbox->new) buffies++; } return buffies; } ",0 "static ImageEventSender& loadEventSender() { DEFINE_STATIC_LOCAL(ImageEventSender, sender, (eventNames().loadEvent)); return sender; } ",0 "void ChromeContentBrowserClient::AllowCertificateError( SSLCertErrorHandler* handler, bool overridable, Callback2::Type* callback) { TabContents* tab = tab_util::GetTabContentsByID( handler->render_process_host_id(), handler->tab_contents_id()); if (!tab) { NOTREACHED(); return; } prerender::PrerenderManager* prerender_manager = tab->profile()->GetPrerenderManager(); if (prerender_manager && prerender_manager->IsTabContentsPrerendering(tab)) { if (prerender_manager->prerender_tracker()->TryCancel( handler->render_process_host_id(), handler->tab_contents_id(), prerender::FINAL_STATUS_SSL_ERROR)) { handler->CancelRequest(); return; } } SSLBlockingPage* blocking_page = new SSLBlockingPage( handler, overridable, callback); blocking_page->Show(); } ",0 "String HTMLFormControlElement::formMethod() const { const AtomicString& form_method_attr = FastGetAttribute(kFormmethodAttr); if (form_method_attr.IsNull()) return g_empty_string; return FormSubmission::Attributes::MethodString( FormSubmission::Attributes::ParseMethodType(form_method_attr)); } ",0 "static int build_curseg(struct f2fs_sb_info *sbi) { struct curseg_info *array; int i; array = kcalloc(NR_CURSEG_TYPE, sizeof(*array), GFP_KERNEL); if (!array) return -ENOMEM; SM_I(sbi)->curseg_array = array; for (i = 0; i < NR_CURSEG_TYPE; i++) { mutex_init(&array[i].curseg_mutex); array[i].sum_blk = kzalloc(PAGE_SIZE, GFP_KERNEL); if (!array[i].sum_blk) return -ENOMEM; init_rwsem(&array[i].journal_rwsem); array[i].journal = kzalloc(sizeof(struct f2fs_journal), GFP_KERNEL); if (!array[i].journal) return -ENOMEM; array[i].segno = NULL_SEGNO; array[i].next_blkoff = 0; } return restore_curseg_summaries(sbi); } ",0 "Resource* ResourceFetcher::ResourceForStaticData( const FetchParameters& params, const ResourceFactory& factory, const SubstituteData& substitute_data) { const KURL& url = params.GetResourceRequest().Url(); DCHECK(url.ProtocolIsData() || substitute_data.IsValid() || archive_); if (!archive_ && !substitute_data.IsValid() && (factory.GetType() == Resource::kMainResource || factory.GetType() == Resource::kRaw)) return nullptr; const String cache_identifier = GetCacheIdentifier(); if (Resource* old_resource = GetMemoryCache()->ResourceForURL(url, cache_identifier)) { if (params.Options().data_buffering_policy != kDoNotBufferData) return old_resource; GetMemoryCache()->Remove(old_resource); } ResourceResponse response; RefPtr data; if (substitute_data.IsValid()) { data = substitute_data.Content(); response.SetURL(url); response.SetMimeType(substitute_data.MimeType()); response.SetExpectedContentLength(data->size()); response.SetTextEncodingName(substitute_data.TextEncoding()); } else if (url.ProtocolIsData()) { data = NetworkUtils::ParseDataURLAndPopulateResponse(url, response); if (!data) return nullptr; } else { ArchiveResource* archive_resource = archive_->SubresourceForURL(params.Url()); if (!archive_resource) return nullptr; data = archive_resource->Data(); response.SetURL(url); response.SetMimeType(archive_resource->MimeType()); response.SetExpectedContentLength(data->size()); response.SetTextEncodingName(archive_resource->TextEncoding()); } Resource* resource = factory.Create( params.GetResourceRequest(), params.Options(), params.DecoderOptions()); resource->SetStatus(ResourceStatus::kPending); resource->NotifyStartLoad(); resource->ResponseReceived(response, nullptr); resource->SetDataBufferingPolicy(kBufferData); if (data->size()) resource->SetResourceBuffer(data); resource->SetIdentifier(CreateUniqueIdentifier()); resource->SetCacheIdentifier(cache_identifier); resource->Finish(); if (ShouldResourceBeAddedToMemoryCache(params, resource) && !substitute_data.IsValid()) { GetMemoryCache()->Add(resource); } return resource; } ",0 "bool InspectorOverlay::handleTouchEvent(const PlatformTouchEvent& event) { if (isEmpty()) return false; return overlayPage()->mainFrame()->eventHandler().handleTouchEvent(event); } ",0 "void Con_DrawConsole( void ) { Con_CheckResize(); if ( clc.state == CA_DISCONNECTED ) { if ( !( Key_GetCatcher( ) & (KEYCATCH_UI | KEYCATCH_CGAME)) ) { Con_DrawSolidConsole( 1.0 ); return; } } if ( con.displayFrac ) { Con_DrawSolidConsole( con.displayFrac ); } else { if ( clc.state == CA_ACTIVE ) { Con_DrawNotify(); } } } ",0 "bool RenderFrameHostImpl::IsRenderFrameLive() { bool is_live = GetProcess()->HasConnection() && render_frame_created_; DCHECK(!is_live || render_view_host_->IsRenderViewLive()); return is_live; } ",0 "input_userauth_success_unexpected(int type, u_int32_t seq, void *ctxt) { Authctxt *authctxt = ctxt; if (authctxt == NULL) fatal(""%s: no authentication context"", __func__); fatal(""Unexpected authentication success during %s."", authctxt->method->name); return 0; } ",0 "iperf_set_test_zerocopy(struct iperf_test *ipt, int zerocopy) { ipt->zerocopy = (zerocopy && has_sendfile()); } ",0 "static int send_msg(struct kiocb *iocb, struct socket *sock, struct msghdr *m, size_t total_len) { struct sock *sk = sock->sk; struct tipc_port *tport = tipc_sk_port(sk); struct sockaddr_tipc *dest = (struct sockaddr_tipc *)m->msg_name; int needs_conn; long timeout_val; int res = -EINVAL; if (unlikely(!dest)) return -EDESTADDRREQ; if (unlikely((m->msg_namelen < sizeof(*dest)) || (dest->family != AF_TIPC))) return -EINVAL; if (total_len > TIPC_MAX_USER_MSG_SIZE) return -EMSGSIZE; if (iocb) lock_sock(sk); needs_conn = (sock->state != SS_READY); if (unlikely(needs_conn)) { if (sock->state == SS_LISTENING) { res = -EPIPE; goto exit; } if (sock->state != SS_UNCONNECTED) { res = -EISCONN; goto exit; } if (tport->published) { res = -EOPNOTSUPP; goto exit; } if (dest->addrtype == TIPC_ADDR_NAME) { tport->conn_type = dest->addr.name.name.type; tport->conn_instance = dest->addr.name.name.instance; } /* Abort any pending connection attempts (very unlikely) */ reject_rx_queue(sk); } timeout_val = sock_sndtimeo(sk, m->msg_flags & MSG_DONTWAIT); do { if (dest->addrtype == TIPC_ADDR_NAME) { res = dest_name_check(dest, m); if (res) break; res = tipc_send2name(tport->ref, &dest->addr.name.name, dest->addr.name.domain, m->msg_iov, total_len); } else if (dest->addrtype == TIPC_ADDR_ID) { res = tipc_send2port(tport->ref, &dest->addr.id, m->msg_iov, total_len); } else if (dest->addrtype == TIPC_ADDR_MCAST) { if (needs_conn) { res = -EOPNOTSUPP; break; } res = dest_name_check(dest, m); if (res) break; res = tipc_multicast(tport->ref, &dest->addr.nameseq, m->msg_iov, total_len); } if (likely(res != -ELINKCONG)) { if (needs_conn && (res >= 0)) sock->state = SS_CONNECTING; break; } if (timeout_val <= 0L) { res = timeout_val ? timeout_val : -EWOULDBLOCK; break; } release_sock(sk); timeout_val = wait_event_interruptible_timeout(*sk_sleep(sk), !tport->congested, timeout_val); lock_sock(sk); } while (1); exit: if (iocb) release_sock(sk); return res; } ",0 "void BluetoothAdapterChromeOS::AdapterRemoved( const dbus::ObjectPath& object_path) { if (object_path == object_path_) RemoveAdapter(); } ",0 "void RenderWidgetHostImpl::StartHangMonitorTimeout(base::TimeDelta delay) { if (hang_monitor_timeout_) hang_monitor_timeout_->Start(delay); } ",0 "static void __swiotlb_sync_single_for_device(struct device *dev, dma_addr_t dev_addr, size_t size, enum dma_data_direction dir) { swiotlb_sync_single_for_device(dev, dev_addr, size, dir); if (!is_device_dma_coherent(dev)) __dma_map_area(phys_to_virt(dma_to_phys(dev, dev_addr)), size, dir); } ",0 "void SafeBrowsingBlockingPageV2::PopulatePhishingStringDictionary( DictionaryValue* strings) { PopulateStringDictionary( strings, l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_V2_TITLE), l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_V2_HEADLINE), l10n_util::GetStringFUTF16(IDS_SAFE_BROWSING_PHISHING_V2_DESCRIPTION1, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), UTF8ToUTF16(url_.host())), string16(), l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_V2_DESCRIPTION2)); strings->SetString(""details"", """"); strings->SetString(""confirm_text"", """"); strings->SetString(kBoxChecked, """"); strings->SetString(""report_error"", l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_V2_REPORT_ERROR)); strings->SetBoolean(kDisplayCheckBox, false); strings->SetString(""learnMore"", l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_V2_LEARN_MORE)); } ",0 "static int smp_execute_task(struct domain_device *dev, void *req, int req_size, void *resp, int resp_size) { struct scatterlist req_sg; struct scatterlist resp_sg; sg_init_one(&req_sg, req, req_size); sg_init_one(&resp_sg, resp, resp_size); return smp_execute_task_sg(dev, &req_sg, &resp_sg); } ",0 " virtual bool wifi_connecting() const { return false; } ",0 "GF_Err gf_isom_hevc_set_inband_config(GF_ISOFile *the_file, u32 trackNumber, u32 DescriptionIndex) { return gf_isom_hevc_config_update_ex(the_file, trackNumber, DescriptionIndex, NULL, GF_ISOM_HVCC_SET_INBAND); } ",0 " void SetBeforeConnectResult(int result) { before_connect_result_ = result; } ",0 "void V8TestObject::VoidMethodVariadicTestInterfaceEmptyArgMethodCallback(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_voidMethodVariadicTestInterfaceEmptyArg""); test_object_v8_internal::VoidMethodVariadicTestInterfaceEmptyArgMethod(info); } ",0 "GF_Err tims_dump(GF_Box *a, FILE * trace) { GF_TSHintEntryBox *p; p = (GF_TSHintEntryBox *)a; gf_isom_box_dump_start(a, ""RTPTimeScaleBox"", trace); fprintf(trace, ""TimeScale=\""%d\"">\n"", p->timeScale); gf_isom_box_dump_done(""RTPTimeScaleBox"", a, trace); return GF_OK; } ",0 "static ssize_t destroy_by_rcu_show(struct kmem_cache *s, char *buf) { return sprintf(buf, ""%d\n"", !!(s->flags & SLAB_DESTROY_BY_RCU)); } ",0 "move_copy_file_callback_new (GFile *file, gboolean overwrite, GdkPoint *position) { MoveFileCopyFallback *fallback; fallback = g_new (MoveFileCopyFallback, 1); fallback->file = file; fallback->overwrite = overwrite; if (position) { fallback->has_position = TRUE; fallback->position = *position; } else { fallback->has_position = FALSE; } return fallback; } ",0 " void ensureSpace(unsigned extra) { COMPILE_ASSERT(sizeof(BufferValueType) == 2, BufferValueTypeIsTwoBytes); m_buffer.resize((m_position + extra + 1) / sizeof(BufferValueType)); // ""+ 1"" to round up. } ",0 "static inline void check_class_changed(struct rq *rq, struct task_struct *p, const struct sched_class *prev_class, int oldprio) { if (prev_class != p->sched_class) { if (prev_class->switched_from) prev_class->switched_from(rq, p); p->sched_class->switched_to(rq, p); } else if (oldprio != p->prio || dl_task(p)) p->sched_class->prio_changed(rq, p, oldprio); } ",0 " virtual void BeginPassHook(unsigned int /*pass*/) { file_size_ = 0; psnr_ = 0.0; n_frames_ = 0; } ",0 "static MagickBooleanType ReadUncompressedRGB(Image *image, DDSInfo *dds_info, ExceptionInfo *exception) { PixelPacket *q; ssize_t x, y; unsigned short color; if (dds_info->pixelformat.rgb_bitcount == 8) (void) SetImageType(image,GrayscaleType); else if (dds_info->pixelformat.rgb_bitcount == 16 && !IsBitMask( dds_info->pixelformat,0xf800,0x07e0,0x001f,0x0000)) ThrowBinaryException(CorruptImageError,""ImageTypeNotSupported"", image->filename); for (y = 0; y < (ssize_t) dds_info->height; y++) { q = QueueAuthenticPixels(image, 0, y, dds_info->width, 1,exception); if (q == (PixelPacket *) NULL) return MagickFalse; for (x = 0; x < (ssize_t) dds_info->width; x++) { if (dds_info->pixelformat.rgb_bitcount == 8) SetPixelGray(q,ScaleCharToQuantum(ReadBlobByte(image))); else if (dds_info->pixelformat.rgb_bitcount == 16) { color=ReadBlobShort(image); SetPixelRed(q,ScaleCharToQuantum((unsigned char) (((color >> 11)/31.0)*255))); SetPixelGreen(q,ScaleCharToQuantum((unsigned char) ((((unsigned short)(color << 5) >> 10)/63.0)*255))); SetPixelBlue(q,ScaleCharToQuantum((unsigned char) ((((unsigned short)(color << 11) >> 11)/31.0)*255))); } else { SetPixelBlue(q,ScaleCharToQuantum((unsigned char) ReadBlobByte(image))); SetPixelGreen(q,ScaleCharToQuantum((unsigned char) ReadBlobByte(image))); SetPixelRed(q,ScaleCharToQuantum((unsigned char) ReadBlobByte(image))); if (dds_info->pixelformat.rgb_bitcount == 32) (void) ReadBlobByte(image); } SetPixelAlpha(q,QuantumRange); q++; } if (SyncAuthenticPixels(image,exception) == MagickFalse) return MagickFalse; } SkipRGBMipmaps(image, dds_info, 3); return MagickTrue; } ",0 "static void __init balloon_add_region(unsigned long start_pfn, unsigned long pages) { unsigned long pfn, extra_pfn_end; struct page *page; /* * If the amount of usable memory has been limited (e.g., with * the 'mem' command line parameter), don't add pages beyond * this limit. */ extra_pfn_end = min(max_pfn, start_pfn + pages); for (pfn = start_pfn; pfn < extra_pfn_end; pfn++) { page = pfn_to_page(pfn); /* totalram_pages and totalhigh_pages do not include the boot-time balloon extension, so don't subtract from it. */ __balloon_append(page); } balloon_stats.total_pages += extra_pfn_end - start_pfn; } ",0 "_dbus_append_user_from_current_process (DBusString *str) { return _dbus_string_append_uint (str, _dbus_geteuid ()); } ",0 "static int xhci_setup_packet(XHCITransfer *xfer) { XHCIState *xhci = xfer->xhci; USBEndpoint *ep; int dir; dir = xfer->in_xfer ? USB_TOKEN_IN : USB_TOKEN_OUT; if (xfer->packet.ep) { ep = xfer->packet.ep; } else { ep = xhci_epid_to_usbep(xhci, xfer->slotid, xfer->epid); if (!ep) { DPRINTF(""xhci: slot %d has no device\n"", xfer->slotid); return -1; } } xhci_xfer_create_sgl(xfer, dir == USB_TOKEN_IN); /* Also sets int_req */ usb_packet_setup(&xfer->packet, dir, ep, xfer->streamid, xfer->trbs[0].addr, false, xfer->int_req); usb_packet_map(&xfer->packet, &xfer->sgl); DPRINTF(""xhci: setup packet pid 0x%x addr %d ep %d\n"", xfer->packet.pid, ep->dev->addr, ep->nr); return 0; } ",0 "static void sanitize_dead_code(struct bpf_verifier_env *env) { struct bpf_insn_aux_data *aux_data = env->insn_aux_data; struct bpf_insn nop = BPF_MOV64_REG(BPF_REG_0, BPF_REG_0); struct bpf_insn *insn = env->prog->insnsi; const int insn_cnt = env->prog->len; int i; for (i = 0; i < insn_cnt; i++) { if (aux_data[i].seen) continue; memcpy(insn + i, &nop, sizeof(nop)); } } ",0 "void WebPluginImpl::ShowModalHTMLDialog(const GURL& url, int width, int height, const std::string& json_arguments, std::string* json_retval) { if (page_delegate_) { page_delegate_->ShowModalHTMLDialogForPlugin( url, gfx::Size(width, height), json_arguments, json_retval); } } ",0 "void IRCView::dragMoveEvent(QDragMoveEvent* e) { if (e->mimeData()->hasUrls()) e->accept(); else e->ignore(); } ",0 "int jas_image_readcmpt(jas_image_t *image, int cmptno, jas_image_coord_t x, jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height, jas_matrix_t *data) { jas_image_cmpt_t *cmpt; jas_image_coord_t i; jas_image_coord_t j; int k; jas_seqent_t v; int c; jas_seqent_t *dr; jas_seqent_t *d; int drs; if (cmptno < 0 || cmptno >= image->numcmpts_) { return -1; } cmpt = image->cmpts_[cmptno]; if (x >= cmpt->width_ || y >= cmpt->height_ || x + width > cmpt->width_ || y + height > cmpt->height_) { return -1; } if (!jas_matrix_numrows(data) || !jas_matrix_numcols(data)) { return -1; } if (jas_matrix_numrows(data) != height || jas_matrix_numcols(data) != width) { if (jas_matrix_resize(data, height, width)) { return -1; } } dr = jas_matrix_getref(data, 0, 0); drs = jas_matrix_rowstep(data); for (i = 0; i < height; ++i, dr += drs) { d = dr; if (jas_stream_seek(cmpt->stream_, (cmpt->width_ * (y + i) + x) * cmpt->cps_, SEEK_SET) < 0) { return -1; } for (j = width; j > 0; --j, ++d) { v = 0; for (k = cmpt->cps_; k > 0; --k) { if ((c = jas_stream_getc(cmpt->stream_)) == EOF) { return -1; } v = (v << 8) | (c & 0xff); } *d = bitstoint(v, cmpt->prec_, cmpt->sgnd_); } } return 0; } ",0 "static struct sock *__l2tp_ip6_bind_lookup(struct net *net, struct in6_addr *laddr, int dif, u32 tunnel_id) { struct sock *sk; sk_for_each_bound(sk, &l2tp_ip6_bind_table) { struct in6_addr *addr = inet6_rcv_saddr(sk); struct l2tp_ip6_sock *l2tp = l2tp_ip6_sk(sk); if (l2tp == NULL) continue; if ((l2tp->conn_id == tunnel_id) && net_eq(sock_net(sk), net) && !(addr && ipv6_addr_equal(addr, laddr)) && !(sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif)) goto found; } sk = NULL; found: return sk; } ",0 "static inline int vmcs12_read_any(struct kvm_vcpu *vcpu, unsigned long field, u64 *ret) { short offset = vmcs_field_to_offset(field); char *p; if (offset < 0) return offset; p = ((char *)(get_vmcs12(vcpu))) + offset; switch (vmcs_field_width(field)) { case VMCS_FIELD_WIDTH_NATURAL_WIDTH: *ret = *((natural_width *)p); return 0; case VMCS_FIELD_WIDTH_U16: *ret = *((u16 *)p); return 0; case VMCS_FIELD_WIDTH_U32: *ret = *((u32 *)p); return 0; case VMCS_FIELD_WIDTH_U64: *ret = *((u64 *)p); return 0; default: WARN_ON(1); return -ENOENT; } } ",0 "buf_finalize(StringInfo buf) { TxidSnapshot *snap = (TxidSnapshot *) buf->data; SET_VARSIZE(snap, buf->len); /* buf is not needed anymore */ buf->data = NULL; pfree(buf); return snap; } ",0 "void blkcg_policy_unregister(struct blkcg_policy *pol) { struct blkcg *blkcg; mutex_lock(&blkcg_pol_register_mutex); if (WARN_ON(blkcg_policy[pol->plid] != pol)) goto out_unlock; /* kill the intf files first */ if (pol->dfl_cftypes) cgroup_rm_cftypes(pol->dfl_cftypes); if (pol->legacy_cftypes) cgroup_rm_cftypes(pol->legacy_cftypes); /* remove cpds and unregister */ mutex_lock(&blkcg_pol_mutex); if (pol->cpd_alloc_fn) { list_for_each_entry(blkcg, &all_blkcgs, all_blkcgs_node) { if (blkcg->cpd[pol->plid]) { pol->cpd_free_fn(blkcg->cpd[pol->plid]); blkcg->cpd[pol->plid] = NULL; } } } blkcg_policy[pol->plid] = NULL; mutex_unlock(&blkcg_pol_mutex); out_unlock: mutex_unlock(&blkcg_pol_register_mutex); } ",0 "bool HTMLFormElement::isURLAttribute(const Attribute& attribute) const { return attribute.name() == actionAttr || HTMLElement::isURLAttribute(attribute); } ",0 "multiply_ms(tmsize_t m1, tmsize_t m2) { tmsize_t bytes = m1 * m2; if (m1 && bytes / m1 != m2) bytes = 0; return bytes; } ",0 "void DebuggerFunction::FormatErrorMessage(const std::string& format) { if (debuggee_.tab_id) error_ = ErrorUtils::FormatErrorMessage( format, keys::kTabTargetType, base::IntToString(*debuggee_.tab_id)); else if (debuggee_.extension_id) error_ = ErrorUtils::FormatErrorMessage( format, keys::kBackgroundPageTargetType, *debuggee_.extension_id); else error_ = ErrorUtils::FormatErrorMessage( format, keys::kOpaqueTargetType, *debuggee_.target_id); } ",0 "static void encrypted_destroy(struct key *key) { kzfree(key->payload.data[0]); } ",0 "void CalculatePageLayoutFromPrintParams( const PrintMsg_Print_Params& params, printing::PageSizeMargins* page_layout_in_points) { int dpi = GetDPI(¶ms); int content_width = params.content_size.width(); int content_height = params.content_size.height(); int margin_bottom = params.page_size.height() - content_height - params.margin_top; int margin_right = params.page_size.width() - content_width - params.margin_left; using printing::ConvertUnit; using printing::kPointsPerInch; page_layout_in_points->content_width = ConvertUnit(content_width, dpi, kPointsPerInch); page_layout_in_points->content_height = ConvertUnit(content_height, dpi, kPointsPerInch); page_layout_in_points->margin_top = ConvertUnit(params.margin_top, dpi, kPointsPerInch); page_layout_in_points->margin_right = ConvertUnit(margin_right, dpi, kPointsPerInch); page_layout_in_points->margin_bottom = ConvertUnit(margin_bottom, dpi, kPointsPerInch); page_layout_in_points->margin_left = ConvertUnit(params.margin_left, dpi, kPointsPerInch); } ",0 "void Browser::AddNewContents(WebContents* source, std::unique_ptr new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_rect, bool user_gesture, bool* was_blocked) { if (source && PopupBlockerTabHelper::ConsiderForPopupBlocking(disposition)) PopupTracker::CreateForWebContents(new_contents.get(), source); chrome::AddWebContents(this, source, std::move(new_contents), disposition, initial_rect); } ",0 "unsigned CurrentMaxGLContexts() { return IsMainThread() ? kMaxGLActiveContexts : kMaxGLActiveContextsOnWorker; } ",0 "void CairoOutputDev::endString(GfxState *state) { int render; if (!currentFont) return; if (!glyphs) return; render = state->getRender(); if (render == 3 || glyphCount == 0) { gfree(glyphs); glyphs = NULL; return; } if (!(render & 1)) { LOG (printf (""fill string\n"")); cairo_set_source (cairo, fill_pattern); cairo_show_glyphs (cairo, glyphs, glyphCount); if (cairo_shape) cairo_show_glyphs (cairo_shape, glyphs, glyphCount); } if ((render & 3) == 1 || (render & 3) == 2) { LOG (printf (""stroke string\n"")); cairo_set_source (cairo, stroke_pattern); cairo_glyph_path (cairo, glyphs, glyphCount); cairo_stroke (cairo); if (cairo_shape) { cairo_glyph_path (cairo_shape, glyphs, glyphCount); cairo_stroke (cairo_shape); } } if (render & 4) { LOG (printf (""clip string\n"")); if (textClipPath) { cairo_append_path (cairo, textClipPath); if (cairo_shape) { cairo_append_path (cairo_shape, textClipPath); } cairo_path_destroy (textClipPath); } cairo_glyph_path (cairo, glyphs, glyphCount); textClipPath = cairo_copy_path (cairo); cairo_new_path (cairo); if (cairo_shape) { cairo_new_path (cairo_shape); } } gfree (glyphs); glyphs = NULL; } ",0 "rotateContigSamples8bits(uint16 rotation, uint16 spp, uint16 bps, uint32 width, uint32 length, uint32 col, uint8 *src, uint8 *dst) { int ready_bits = 0; uint32 src_byte = 0, src_bit = 0; uint32 row, rowsize = 0, bit_offset = 0; uint8 matchbits = 0, maskbits = 0; uint8 buff1 = 0, buff2 = 0; uint8 *next; tsample_t sample; if ((src == NULL) || (dst == NULL)) { TIFFError(""rotateContigSamples8bits"",""Invalid src or destination buffer""); return (1); } rowsize = ((bps * spp * width) + 7) / 8; ready_bits = 0; maskbits = (uint8)-1 >> ( 8 - bps); buff1 = buff2 = 0; for (row = 0; row < length ; row++) { bit_offset = col * bps * spp; for (sample = 0; sample < spp; sample++) { if (sample == 0) { src_byte = bit_offset / 8; src_bit = bit_offset % 8; } else { src_byte = (bit_offset + (sample * bps)) / 8; src_bit = (bit_offset + (sample * bps)) % 8; } switch (rotation) { case 90: next = src + src_byte - (row * rowsize); break; case 270: next = src + src_byte + (row * rowsize); break; default: TIFFError(""rotateContigSamples8bits"", ""Invalid rotation %d"", rotation); return (1); } matchbits = maskbits << (8 - src_bit - bps); buff1 = ((*next) & matchbits) << (src_bit); /* If we have a full buffer's worth, write it out */ if (ready_bits >= 8) { *dst++ = buff2; buff2 = buff1; ready_bits -= 8; } else { buff2 = (buff2 | (buff1 >> ready_bits)); } ready_bits += bps; } } if (ready_bits > 0) { buff1 = (buff2 & ((unsigned int)255 << (8 - ready_bits))); *dst++ = buff1; } return (0); } /* end rotateContigSamples8bits */ ",0 "bool ACodec::OutputPortSettingsChangedState::onMessageReceived( const sp &msg) { bool handled = false; switch (msg->what()) { case kWhatFlush: case kWhatShutdown: case kWhatResume: case kWhatSetParameters: { if (msg->what() == kWhatResume) { ALOGV(""[%s] Deferring resume"", mCodec->mComponentName.c_str()); } mCodec->deferMessage(msg); handled = true; break; } default: handled = BaseState::onMessageReceived(msg); break; } return handled; } ",0 "isdn_net_getpeer(isdn_net_ioctl_phone *phone, isdn_net_ioctl_phone __user *peer) { isdn_net_dev *p = isdn_net_findif(phone->name); int ch, dv, idx; if (!p) return -ENODEV; /* * Theoretical race: while this executes, the remote number might * become invalid (hang up) or change (new connection), resulting * in (partially) wrong number copied to user. This race * currently ignored. */ ch = p->local->isdn_channel; dv = p->local->isdn_device; if(ch < 0 && dv < 0) return -ENOTCONN; idx = isdn_dc2minor(dv, ch); if (idx <0 ) return -ENODEV; /* for pre-bound channels, we need this extra check */ if (strncmp(dev->num[idx], ""???"", 3) == 0) return -ENOTCONN; strncpy(phone->phone, dev->num[idx], ISDN_MSNLEN); phone->outgoing = USG_OUTGOING(dev->usage[idx]); if (copy_to_user(peer, phone, sizeof(*peer))) return -EFAULT; return 0; } ",0 "int FrameFetchContext::ApplicationCacheHostID() const { if (!document_loader_) return WebApplicationCacheHost::kAppCacheNoHostId; return document_loader_->GetApplicationCacheHost()->GetHostID(); } ",0 "void QuotaManager::GetTemporaryGlobalQuota(QuotaCallback* callback) { LazyInitialize(); if (temporary_global_quota_ >= 0) { callback->Run(kQuotaStatusOk, kStorageTypeTemporary, temporary_global_quota_); delete callback; return; } temporary_global_quota_callbacks_.Add(callback); } ",0 "void ChunkedUploadDataStream::ResetInternal() { read_buffer_ = NULL; read_buffer_len_ = 0; read_index_ = 0; read_offset_ = 0; } ",0 "void RenderViewImpl::exitFullScreen() { Send(new ViewHostMsg_ToggleFullscreen(routing_id_, false)); } ",0 "static int rtnl_getlink(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) { struct net *net = sock_net(skb->sk); struct ifinfomsg *ifm; char ifname[IFNAMSIZ]; struct nlattr *tb[IFLA_MAX+1]; struct net_device *dev = NULL; struct sk_buff *nskb; int err; u32 ext_filter_mask = 0; err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy); if (err < 0) return err; if (tb[IFLA_IFNAME]) nla_strlcpy(ifname, tb[IFLA_IFNAME], IFNAMSIZ); if (tb[IFLA_EXT_MASK]) ext_filter_mask = nla_get_u32(tb[IFLA_EXT_MASK]); ifm = nlmsg_data(nlh); if (ifm->ifi_index > 0) dev = __dev_get_by_index(net, ifm->ifi_index); else if (tb[IFLA_IFNAME]) dev = __dev_get_by_name(net, ifname); else return -EINVAL; if (dev == NULL) return -ENODEV; nskb = nlmsg_new(if_nlmsg_size(dev, ext_filter_mask), GFP_KERNEL); if (nskb == NULL) return -ENOBUFS; err = rtnl_fill_ifinfo(nskb, dev, RTM_NEWLINK, NETLINK_CB(skb).portid, nlh->nlmsg_seq, 0, 0, ext_filter_mask); if (err < 0) { /* -EMSGSIZE implies BUG in if_nlmsg_size */ WARN_ON(err == -EMSGSIZE); kfree_skb(nskb); } else err = rtnl_unicast(nskb, net, NETLINK_CB(skb).portid); return err; } ",0 "void GLES2DecoderImpl::RestoreClearState() { framebuffer_state_.clear_state_dirty = true; api()->glClearColorFn(state_.color_clear_red, state_.color_clear_green, state_.color_clear_blue, state_.color_clear_alpha); api()->glClearStencilFn(state_.stencil_clear); api()->glClearDepthFn(state_.depth_clear); state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, state_.enable_flags.scissor_test); RestoreDeviceWindowRectangles(); gfx::Vector2d scissor_offset = GetBoundFramebufferDrawOffset(); api()->glScissorFn(state_.scissor_x + scissor_offset.x(), state_.scissor_y + scissor_offset.y(), state_.scissor_width, state_.scissor_height); } ",0 "static struct snd_timer *snd_timer_find(struct snd_timer_id *tid) { struct snd_timer *timer = NULL; list_for_each_entry(timer, &snd_timer_list, device_list) { if (timer->tmr_class != tid->dev_class) continue; if ((timer->tmr_class == SNDRV_TIMER_CLASS_CARD || timer->tmr_class == SNDRV_TIMER_CLASS_PCM) && (timer->card == NULL || timer->card->number != tid->card)) continue; if (timer->tmr_device != tid->device) continue; if (timer->tmr_subdevice != tid->subdevice) continue; return timer; } return NULL; } ",0 "bool AccessibilityUIElement::isVisible() const { return checkElementState(m_element, ATK_STATE_VISIBLE); } ",0 "static int shmem_remount_fs(struct super_block *sb, int *flags, char *data) { struct shmem_sb_info *sbinfo = SHMEM_SB(sb); struct shmem_sb_info config = *sbinfo; unsigned long inodes; int error = -EINVAL; if (shmem_parse_options(data, &config, true)) return error; spin_lock(&sbinfo->stat_lock); inodes = sbinfo->max_inodes - sbinfo->free_inodes; if (percpu_counter_compare(&sbinfo->used_blocks, config.max_blocks) > 0) goto out; if (config.max_inodes < inodes) goto out; /* * Those tests disallow limited->unlimited while any are in use; * but we must separately disallow unlimited->limited, because * in that case we have no record of how much is already in use. */ if (config.max_blocks && !sbinfo->max_blocks) goto out; if (config.max_inodes && !sbinfo->max_inodes) goto out; error = 0; sbinfo->max_blocks = config.max_blocks; sbinfo->max_inodes = config.max_inodes; sbinfo->free_inodes = config.max_inodes - inodes; mpol_put(sbinfo->mpol); sbinfo->mpol = config.mpol; /* transfers initial ref */ out: spin_unlock(&sbinfo->stat_lock); return error; } ",1 " void GetAutofillSuggestions(const FormData& form, const FormFieldData& field) { GetAutofillSuggestions(kDefaultPageID, form, field); } ",0 "void SVGElement::Trace(blink::Visitor* visitor) { visitor->Trace(elements_with_relative_lengths_); visitor->Trace(attribute_to_property_map_); visitor->Trace(svg_rare_data_); visitor->Trace(class_name_); Element::Trace(visitor); } ",0 "static struct net *net_alloc(void) { struct net *net = NULL; struct net_generic *ng; ng = net_alloc_generic(); if (!ng) goto out; net = kmem_cache_zalloc(net_cachep, GFP_KERNEL); if (!net) goto out_free; rcu_assign_pointer(net->gen, ng); out: return net; out_free: kfree(ng); goto out; } ",0 "void DeviceOrientationController::didChangeDeviceOrientation(DeviceOrientationData* deviceOrientationData) { dispatchDeviceEvent(DeviceOrientationEvent::create(EventTypeNames::deviceorientation, deviceOrientationData)); } ",0 "void Notification::dispatchCloseEvent() { if (m_state != NotificationStateShowing && m_state != NotificationStateClosing) return; m_state = NotificationStateClosed; dispatchEvent(Event::create(EventTypeNames::close)); } ",0 "static void AdjustYearIfNeeded(short &year) { if (year<100) { if (year >40) { year=1900+year; } else { year=2000+year; } } } ",0 "void Com_ReadFromPipe( void ) { static char buf[MAX_STRING_CHARS]; static int accu = 0; int read; if( !pipefile ) return; while( ( read = FS_Read( buf + accu, sizeof( buf ) - accu - 1, pipefile ) ) > 0 ) { char *brk = NULL; int i; for( i = accu; i < accu + read; ++i ) { if( buf[ i ] == '\0' ) buf[ i ] = '\n'; if( buf[ i ] == '\n' || buf[ i ] == '\r' ) brk = &buf[ i + 1 ]; } buf[ accu + read ] = '\0'; accu += read; if( brk ) { char tmp = *brk; *brk = '\0'; Cbuf_ExecuteText( EXEC_APPEND, buf ); *brk = tmp; accu -= brk - buf; memmove( buf, brk, accu + 1 ); } else if( accu >= sizeof( buf ) - 1 ) // full { Cbuf_ExecuteText( EXEC_APPEND, buf ); accu = 0; } } } ",0 "int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu, struct kvm_mp_state *mp_state) { return -EINVAL; } ",0 "bool ObserveNavEntryCommitted(const GURL& expected_url, const content::NotificationSource& source, const content::NotificationDetails& details) { return content::Details(details) ->entry->GetURL() == expected_url; } ",0 "void sched_fork(struct task_struct *p, int clone_flags) { int cpu = get_cpu(); __sched_fork(p); /* * We mark the process as running here. This guarantees that * nobody will actually run it, and a signal or other external * event cannot wake it up and insert it on the runqueue either. */ p->state = TASK_RUNNING; /* * Revert to default priority/policy on fork if requested. */ if (unlikely(p->sched_reset_on_fork)) { if (p->policy == SCHED_FIFO || p->policy == SCHED_RR) { p->policy = SCHED_NORMAL; p->normal_prio = p->static_prio; } if (PRIO_TO_NICE(p->static_prio) < 0) { p->static_prio = NICE_TO_PRIO(0); p->normal_prio = p->static_prio; set_load_weight(p); } /* * We don't need the reset flag anymore after the fork. It has * fulfilled its duty: */ p->sched_reset_on_fork = 0; } /* * Make sure we do not leak PI boosting priority to the child. */ p->prio = current->normal_prio; if (!rt_prio(p->prio)) p->sched_class = &fair_sched_class; if (p->sched_class->task_fork) p->sched_class->task_fork(p); /* * The child is not yet in the pid-hash so no cgroup attach races, * and the cgroup is pinned to this child due to cgroup_fork() * is ran before sched_fork(). * * Silence PROVE_RCU. */ rcu_read_lock(); set_task_cpu(p, cpu); rcu_read_unlock(); #if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) if (likely(sched_info_on())) memset(&p->sched_info, 0, sizeof(p->sched_info)); #endif #if defined(CONFIG_SMP) && defined(__ARCH_WANT_UNLOCKED_CTXSW) p->oncpu = 0; #endif #ifdef CONFIG_PREEMPT /* Want to start with kernel preemption disabled. */ task_thread_info(p)->preempt_count = 1; #endif plist_node_init(&p->pushable_tasks, MAX_PRIO); put_cpu(); } ",0 "void exit_thread(void) { discard_lazy_cpu_state(); } ",0 "int wc_ecc_make_key(WC_RNG* rng, int keysize, ecc_key* key) { return wc_ecc_make_key_ex(rng, keysize, key, ECC_CURVE_DEF); } ",0 "static int gather_hugetbl_stats(pte_t *pte, unsigned long hmask, unsigned long addr, unsigned long end, struct mm_walk *walk) { struct numa_maps *md; struct page *page; if (pte_none(*pte)) return 0; page = pte_page(*pte); if (!page) return 0; md = walk->private; gather_stats(page, md, pte_dirty(*pte), 1); return 0; } ",0 "static size_t GetCPUCoreCount() { long cpuCoreCount = 1; #if defined(_SC_NPROCESSORS_ONLN) cpuCoreCount = sysconf(_SC_NPROCESSORS_ONLN); #else cpuCoreCount = sysconf(_SC_NPROC_ONLN); #endif CHECK(cpuCoreCount >= 1); ALOGV(""Number of CPU cores: %ld"", cpuCoreCount); return (size_t)cpuCoreCount; } ",0 "void PresentationConnection::addedEventListener( const AtomicString& eventType, RegisteredEventListener& registeredListener) { EventTargetWithInlineData::addedEventListener(eventType, registeredListener); if (eventType == EventTypeNames::connect) UseCounter::count(getExecutionContext(), UseCounter::PresentationConnectionConnectEventListener); else if (eventType == EventTypeNames::close) UseCounter::count(getExecutionContext(), UseCounter::PresentationConnectionCloseEventListener); else if (eventType == EventTypeNames::terminate) UseCounter::count(getExecutionContext(), UseCounter::PresentationConnectionTerminateEventListener); else if (eventType == EventTypeNames::message) UseCounter::count(getExecutionContext(), UseCounter::PresentationConnectionMessageEventListener); } ",0 "SendSSDPMSEARCHResponse(int s, const struct sockaddr * sockname, const char * st, const char * usn, const char * server, const char * location) { int l, n; char buf[512]; socklen_t sockname_len; /* * follow guideline from document ""UPnP Device Architecture 1.0"" * uppercase is recommended. * DATE: is recommended * SERVER: OS/ver UPnP/1.0 miniupnpd/1.0 * - check what to put in the 'Cache-Control' header * * have a look at the document ""UPnP Device Architecture v1.1 */ l = snprintf(buf, sizeof(buf), ""HTTP/1.1 200 OK\r\n"" ""CACHE-CONTROL: max-age=120\r\n"" /*""DATE: ...\r\n""*/ ""ST: %s\r\n"" ""USN: %s\r\n"" ""EXT:\r\n"" ""SERVER: %s\r\n"" ""LOCATION: %s\r\n"" ""OPT: \""http://schemas.upnp.org/upnp/1/0/\""; ns=01\r\n"" /* UDA v1.1 */ ""01-NLS: %u\r\n"" /* same as BOOTID. UDA v1.1 */ ""BOOTID.UPNP.ORG: %u\r\n"" /* UDA v1.1 */ ""CONFIGID.UPNP.ORG: %u\r\n"" /* UDA v1.1 */ ""\r\n"", st, usn, server, location, upnp_bootid, upnp_bootid, upnp_configid); #ifdef ENABLE_IPV6 sockname_len = (sockname->sa_family == PF_INET6) ? sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in); #else /* ENABLE_IPV6 */ sockname_len = sizeof(struct sockaddr_in); #endif /* ENABLE_IPV6 */ n = sendto_or_schedule(s, buf, l, 0, sockname, sockname_len); if(n < 0) { syslog(LOG_ERR, ""%s: sendto(udp): %m"", __func__); } } ",0 "static unsigned seg_override(struct x86_emulate_ctxt *ctxt) { if (!ctxt->has_seg_override) return 0; return ctxt->seg_override; } ",0 "void DevToolsToolboxDelegate::HandleKeyboardEvent( content::WebContents* source, const content::NativeWebKeyboardEvent& event) { if (event.windowsKeyCode == 0x08) { return; } BrowserWindow* window = GetInspectedBrowserWindow(); if (window) window->HandleKeyboardEvent(event); } ",0 "void CL_ClearPing( int n ) { if (n < 0 || n >= MAX_PINGREQUESTS) return; cl_pinglist[n].adr.port = 0; } ",0 "static ZIPARCHIVE_METHOD(addFile) { struct zip *intern; zval *this = getThis(); char *filename; int filename_len; char *entry_name = NULL; int entry_name_len = 0; long offset_start = 0, offset_len = 0; if (!this) { RETURN_FALSE; } ZIP_FROM_OBJECT(intern, this); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""p|sll"", &filename, &filename_len, &entry_name, &entry_name_len, &offset_start, &offset_len) == FAILURE) { return; } if (filename_len == 0) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Empty string as filename""); RETURN_FALSE; } if (entry_name_len == 0) { entry_name = filename; entry_name_len = filename_len; } if (php_zip_add_file(intern, filename, filename_len, entry_name, entry_name_len, 0, 0 TSRMLS_CC) < 0) { RETURN_FALSE; } else { RETURN_TRUE; } } ",0 "static void cp2112_gpio_set(struct gpio_chip *chip, unsigned offset, int value) { struct cp2112_device *dev = gpiochip_get_data(chip); struct hid_device *hdev = dev->hdev; u8 *buf = dev->in_out_buffer; unsigned long flags; int ret; spin_lock_irqsave(&dev->lock, flags); buf[0] = CP2112_GPIO_SET; buf[1] = value ? 0xff : 0; buf[2] = 1 << offset; ret = hid_hw_raw_request(hdev, CP2112_GPIO_SET, buf, CP2112_GPIO_SET_LENGTH, HID_FEATURE_REPORT, HID_REQ_SET_REPORT); if (ret < 0) hid_err(hdev, ""error setting GPIO values: %d\n"", ret); spin_unlock_irqrestore(&dev->lock, flags); } ",1 "bool HTMLMediaElement::isGestureNeededForPlayback() const { if (!m_lockedPendingUserGesture) return false; return isGestureNeededForPlaybackIfPendingUserGestureIsLocked(); } ",0 "xsltCompileRelativePathPattern(xsltParserContextPtr ctxt, xmlChar *token, int novar) { xsltCompileStepPattern(ctxt, token, novar); if (ctxt->error) goto error; SKIP_BLANKS; while ((CUR != 0) && (CUR != '|')) { if ((CUR == '/') && (NXT(1) == '/')) { PUSH(XSLT_OP_ANCESTOR, NULL, NULL, novar); NEXT; NEXT; SKIP_BLANKS; xsltCompileStepPattern(ctxt, NULL, novar); } else if (CUR == '/') { PUSH(XSLT_OP_PARENT, NULL, NULL, novar); NEXT; SKIP_BLANKS; if ((CUR != 0) && (CUR != '|')) { xsltCompileRelativePathPattern(ctxt, NULL, novar); } } else { ctxt->error = 1; } if (ctxt->error) goto error; SKIP_BLANKS; } error: return; } ",0 "krb5_gss_inquire_sec_context_by_oid (OM_uint32 *minor_status, const gss_ctx_id_t context_handle, const gss_OID desired_object, gss_buffer_set_t *data_set) { krb5_gss_ctx_id_rec *ctx; size_t i; if (minor_status == NULL) return GSS_S_CALL_INACCESSIBLE_WRITE; *minor_status = 0; if (desired_object == GSS_C_NO_OID) return GSS_S_CALL_INACCESSIBLE_READ; if (data_set == NULL) return GSS_S_CALL_INACCESSIBLE_WRITE; *data_set = GSS_C_NO_BUFFER_SET; ctx = (krb5_gss_ctx_id_rec *) context_handle; if (ctx->terminated || !ctx->established) return GSS_S_NO_CONTEXT; for (i = 0; i < sizeof(krb5_gss_inquire_sec_context_by_oid_ops)/ sizeof(krb5_gss_inquire_sec_context_by_oid_ops[0]); i++) { if (g_OID_prefix_equal(desired_object, &krb5_gss_inquire_sec_context_by_oid_ops[i].oid)) { return (*krb5_gss_inquire_sec_context_by_oid_ops[i].func)(minor_status, context_handle, desired_object, data_set); } } *minor_status = EINVAL; return GSS_S_UNAVAILABLE; } ",0 "const CuePoint* Cues::GetLast() const { if (m_cue_points == NULL || m_count <= 0) return NULL; const long index = m_count - 1; CuePoint* const* const pp = m_cue_points; if (pp == NULL) return NULL; CuePoint* const pCP = pp[index]; if (pCP == NULL || pCP->GetTimeCode() < 0) return NULL; return pCP; } ",0 "static v8::Handle reflectedCustomIntegralAttrAttrGetter(v8::Local name, const v8::AccessorInfo& info) { INC_STATS(""DOM.TestObj.reflectedCustomIntegralAttr._get""); TestObj* imp = V8TestObj::toNative(info.Holder()); return v8::Integer::New(imp->getIntegralAttribute(WebCore::HTMLNames::customContentIntegralAttrAttr)); } ",0 "void DataPipeProducerDispatcher::StartSerialize(uint32_t* num_bytes, uint32_t* num_ports, uint32_t* num_handles) { base::AutoLock lock(lock_); DCHECK(in_transit_); *num_bytes = sizeof(SerializedState); *num_ports = 1; *num_handles = 1; } ",0 "void TestFeaturesNativeHandler::GetAPIFeatures( const v8::FunctionCallbackInfo& args) { scoped_ptr source( ExtensionsClient::Get()->CreateFeatureProviderSource(""api"")); scoped_ptr converter( content::V8ValueConverter::create()); args.GetReturnValue().Set( converter->ToV8Value(&source->dictionary(), context()->v8_context())); } ",0 "bool WebPageProxy::canGoBack() const { return m_backForwardList->backItem(); } ",0 " DictionaryValue* ExtensionTabUtil::CreateTabValue( const WebContents* contents, TabStripModel* tab_strip, int tab_index, IncludePrivacySensitiveFields include_privacy_sensitive_fields) { NOTIMPLEMENTED(); return NULL; } ",1 "static void __arm_dma_free(struct device *dev, size_t size, void *cpu_addr, dma_addr_t handle, struct dma_attrs *attrs, bool is_coherent) { struct page *page = pfn_to_page(dma_to_pfn(dev, handle)); if (dma_release_from_coherent(dev, get_order(size), cpu_addr)) return; size = PAGE_ALIGN(size); if (is_coherent || nommu()) { __dma_free_buffer(page, size); } else if (__free_from_pool(cpu_addr, size)) { return; } else if (!IS_ENABLED(CONFIG_DMA_CMA)) { __dma_free_remap(cpu_addr, size); __dma_free_buffer(page, size); } else { /* * Non-atomic allocations cannot be freed with IRQs disabled */ WARN_ON(irqs_disabled()); __free_from_contiguous(dev, page, cpu_addr, size); } } ",0 "int LvmBundle_init(EffectContext *pContext){ int status; ALOGV(""\tLvmBundle_init start""); pContext->config.inputCfg.accessMode = EFFECT_BUFFER_ACCESS_READ; pContext->config.inputCfg.channels = AUDIO_CHANNEL_OUT_STEREO; pContext->config.inputCfg.format = AUDIO_FORMAT_PCM_16_BIT; pContext->config.inputCfg.samplingRate = 44100; pContext->config.inputCfg.bufferProvider.getBuffer = NULL; pContext->config.inputCfg.bufferProvider.releaseBuffer = NULL; pContext->config.inputCfg.bufferProvider.cookie = NULL; pContext->config.inputCfg.mask = EFFECT_CONFIG_ALL; pContext->config.outputCfg.accessMode = EFFECT_BUFFER_ACCESS_ACCUMULATE; pContext->config.outputCfg.channels = AUDIO_CHANNEL_OUT_STEREO; pContext->config.outputCfg.format = AUDIO_FORMAT_PCM_16_BIT; pContext->config.outputCfg.samplingRate = 44100; pContext->config.outputCfg.bufferProvider.getBuffer = NULL; pContext->config.outputCfg.bufferProvider.releaseBuffer = NULL; pContext->config.outputCfg.bufferProvider.cookie = NULL; pContext->config.outputCfg.mask = EFFECT_CONFIG_ALL; CHECK_ARG(pContext != NULL); if (pContext->pBundledContext->hInstance != NULL){ ALOGV(""\tLvmBundle_init pContext->pBassBoost != NULL "" ""-> Calling pContext->pBassBoost->free()""); LvmEffect_free(pContext); ALOGV(""\tLvmBundle_init pContext->pBassBoost != NULL "" ""-> Called pContext->pBassBoost->free()""); } LVM_ReturnStatus_en LvmStatus=LVM_SUCCESS; /* Function call status */ LVM_ControlParams_t params; /* Control Parameters */ LVM_InstParams_t InstParams; /* Instance parameters */ LVM_EQNB_BandDef_t BandDefs[MAX_NUM_BANDS]; /* Equaliser band definitions */ LVM_HeadroomParams_t HeadroomParams; /* Headroom parameters */ LVM_HeadroomBandDef_t HeadroomBandDef[LVM_HEADROOM_MAX_NBANDS]; LVM_MemTab_t MemTab; /* Memory allocation table */ bool bMallocFailure = LVM_FALSE; /* Set the capabilities */ InstParams.BufferMode = LVM_UNMANAGED_BUFFERS; InstParams.MaxBlockSize = MAX_CALL_SIZE; InstParams.EQNB_NumBands = MAX_NUM_BANDS; InstParams.PSA_Included = LVM_PSA_ON; /* Allocate memory, forcing alignment */ LvmStatus = LVM_GetMemoryTable(LVM_NULL, &MemTab, &InstParams); LVM_ERROR_CHECK(LvmStatus, ""LVM_GetMemoryTable"", ""LvmBundle_init"") if(LvmStatus != LVM_SUCCESS) return -EINVAL; ALOGV(""\tCreateInstance Succesfully called LVM_GetMemoryTable\n""); /* Allocate memory */ for (int i=0; ipBundledContext->hInstance = LVM_NULL; /* Init sets the instance handle */ LvmStatus = LVM_GetInstanceHandle(&pContext->pBundledContext->hInstance, &MemTab, &InstParams); LVM_ERROR_CHECK(LvmStatus, ""LVM_GetInstanceHandle"", ""LvmBundle_init"") if(LvmStatus != LVM_SUCCESS) return -EINVAL; ALOGV(""\tLvmBundle_init CreateInstance Succesfully called LVM_GetInstanceHandle\n""); /* Set the initial process parameters */ /* General parameters */ params.OperatingMode = LVM_MODE_ON; params.SampleRate = LVM_FS_44100; params.SourceFormat = LVM_STEREO; params.SpeakerType = LVM_HEADPHONES; pContext->pBundledContext->SampleRate = LVM_FS_44100; /* Concert Sound parameters */ params.VirtualizerOperatingMode = LVM_MODE_OFF; params.VirtualizerType = LVM_CONCERTSOUND; params.VirtualizerReverbLevel = 100; params.CS_EffectLevel = LVM_CS_EFFECT_NONE; /* N-Band Equaliser parameters */ params.EQNB_OperatingMode = LVM_EQNB_OFF; params.EQNB_NBands = FIVEBAND_NUMBANDS; params.pEQNB_BandDefinition = &BandDefs[0]; for (int i=0; ipBundledContext->hInstance, ¶ms); LVM_ERROR_CHECK(LvmStatus, ""LVM_SetControlParameters"", ""LvmBundle_init"") if(LvmStatus != LVM_SUCCESS) return -EINVAL; ALOGV(""\tLvmBundle_init CreateInstance Succesfully called LVM_SetControlParameters\n""); /* Set the headroom parameters */ HeadroomBandDef[0].Limit_Low = 20; HeadroomBandDef[0].Limit_High = 4999; HeadroomBandDef[0].Headroom_Offset = 0; HeadroomBandDef[1].Limit_Low = 5000; HeadroomBandDef[1].Limit_High = 24000; HeadroomBandDef[1].Headroom_Offset = 0; HeadroomParams.pHeadroomDefinition = &HeadroomBandDef[0]; HeadroomParams.Headroom_OperatingMode = LVM_HEADROOM_ON; HeadroomParams.NHeadroomBands = 2; LvmStatus = LVM_SetHeadroomParams(pContext->pBundledContext->hInstance, &HeadroomParams); LVM_ERROR_CHECK(LvmStatus, ""LVM_SetHeadroomParams"", ""LvmBundle_init"") if(LvmStatus != LVM_SUCCESS) return -EINVAL; ALOGV(""\tLvmBundle_init CreateInstance Succesfully called LVM_SetHeadroomParams\n""); ALOGV(""\tLvmBundle_init End""); return 0; } /* end LvmBundle_init */ ",0 "void InputType::SetValue(const String& sanitized_value, bool value_changed, TextFieldEventBehavior event_behavior, TextControlSetValueSelection) { DCHECK_EQ(GetValueMode(), ValueMode::kValue); if (event_behavior == kDispatchNoEvent) GetElement().SetNonAttributeValue(sanitized_value); else GetElement().SetNonAttributeValueByUserEdit(sanitized_value); if (!value_changed) return; switch (event_behavior) { case kDispatchChangeEvent: GetElement().DispatchFormControlChangeEvent(); break; case kDispatchInputAndChangeEvent: GetElement().DispatchInputEvent(); GetElement().DispatchFormControlChangeEvent(); break; case kDispatchNoEvent: break; } } ",0 "void PDFiumEngine::UnsupportedFeature(int type) { std::string feature; switch (type) { #if !defined(PDF_ENABLE_XFA) case FPDF_UNSP_DOC_XFAFORM: feature = ""XFA""; break; #endif case FPDF_UNSP_DOC_PORTABLECOLLECTION: feature = ""Portfolios_Packages""; break; case FPDF_UNSP_DOC_ATTACHMENT: case FPDF_UNSP_ANNOT_ATTACHMENT: feature = ""Attachment""; break; case FPDF_UNSP_DOC_SECURITY: feature = ""Rights_Management""; break; case FPDF_UNSP_DOC_SHAREDREVIEW: feature = ""Shared_Review""; break; case FPDF_UNSP_DOC_SHAREDFORM_ACROBAT: case FPDF_UNSP_DOC_SHAREDFORM_FILESYSTEM: case FPDF_UNSP_DOC_SHAREDFORM_EMAIL: feature = ""Shared_Form""; break; case FPDF_UNSP_ANNOT_3DANNOT: feature = ""3D""; break; case FPDF_UNSP_ANNOT_MOVIE: feature = ""Movie""; break; case FPDF_UNSP_ANNOT_SOUND: feature = ""Sound""; break; case FPDF_UNSP_ANNOT_SCREEN_MEDIA: case FPDF_UNSP_ANNOT_SCREEN_RICHMEDIA: feature = ""Screen""; break; case FPDF_UNSP_ANNOT_SIG: feature = ""Digital_Signature""; break; } client_->DocumentHasUnsupportedFeature(feature); } ",0 "static OMX_ERRORTYPE subscribe_to_events(int fd) { OMX_ERRORTYPE eRet = OMX_ErrorNone; struct v4l2_event_subscription sub; int array_sz = sizeof(event_type)/sizeof(int); int i,rc; memset(&sub, 0, sizeof(sub)); if (fd < 0) { DEBUG_PRINT_ERROR(""Invalid input: %d"", fd); return OMX_ErrorBadParameter; } for (i = 0; i < array_sz; ++i) { memset(&sub, 0, sizeof(sub)); sub.type = event_type[i]; rc = ioctl(fd, VIDIOC_SUBSCRIBE_EVENT, &sub); if (rc) { DEBUG_PRINT_ERROR(""Failed to subscribe event: 0x%x"", sub.type); break; } } if (i < array_sz) { for (--i; i >=0 ; i--) { memset(&sub, 0, sizeof(sub)); sub.type = event_type[i]; rc = ioctl(fd, VIDIOC_UNSUBSCRIBE_EVENT, &sub); if (rc) DEBUG_PRINT_ERROR(""Failed to unsubscribe event: 0x%x"", sub.type); } eRet = OMX_ErrorNotImplemented; } return eRet; } ",0 "static int cmykbasecolor(i_ctx_t * i_ctx_p, ref *space, int base, int *stage, int *cont, int *stack_depth) { os_ptr op = osp; float CMYK[4], Gray, RGB[3]; int i; const gs_color_space * pcs = gs_currentcolorspace(igs); if (pcs->id == cs_DeviceGray_id) { /* UGLY hack. Its possible for the graphics library to change the * colour space to DeviceGray (setcachedevice), but this does not * change the PostScript space. It can't, because the graphics library * doesn't know about the PostScript objects. If we get a current* * operation before the space has been restored, the colour space in * the graphics library and the PostScript stored space won't match. * If that happens then we need to pretend the PS colour space was * DeviceGray */ return(graybasecolor(i_ctx_p, space, base, stage, cont, stack_depth)); } *cont = 0; *stage = 0; check_op(4); op -= 3; for (i=0;i<4;i++) { if (!r_has_type(op, t_integer)) { if (r_has_type(op, t_real)) { CMYK[i] = op->value.realval; } else return_error(gs_error_typecheck); } else CMYK[i] = (float)op->value.intval; if (CMYK[i] < 0 || CMYK[i] > 1) return_error(gs_error_rangecheck); op++; } switch (base) { case 0: pop(3); op = osp; Gray = (0.3 * CMYK[0]) + (0.59 * CMYK[1]) + (0.11 * CMYK[2]) + CMYK[3]; if (Gray > 1.0) Gray = 0; else Gray = 1.0 - Gray; make_real(op, Gray); break; case 1: case 2: pop(1); op = osp; RGB[0] = 1.0 - (CMYK[0] + CMYK[3]); if (RGB[0] < 0) RGB[0] = 0; RGB[1] = 1.0 - (CMYK[1] + CMYK[3]); if (RGB[1] < 0) RGB[1] = 0; RGB[2] = 1.0 - (CMYK[2] + CMYK[3]); if (RGB[2] < 0) RGB[2] = 0; if (base == 1) rgb2hsb((float *)&RGB); make_real(&op[-2], RGB[0]); make_real(&op[-1], RGB[1]); make_real(op, RGB[2]); break; case 3: op = osp; make_real(&op[-3], CMYK[0]); make_real(&op[-2], CMYK[1]); make_real(&op[-1], CMYK[2]); make_real(op, CMYK[3]); break; default: return_error(gs_error_undefined); } return 0; } ",0 "bool WebSocketJob::SendHandshakeRequest(const char* data, int len) { DCHECK_EQ(state_, CONNECTING); if (started_to_send_handshake_request_) return false; if (!handshake_request_->ParseRequest(data, len)) return false; handshake_response_->set_protocol_version( handshake_request_->protocol_version()); AddCookieHeaderAndSend(); started_to_send_handshake_request_ = true; return true; } ",0 "void BrowserLauncherItemController::OnRemoved() { } ",0 "void HTMLMediaElement::markCaptionAndSubtitleTracksAsUnconfigured() { if (!m_textTracks) return; for (unsigned i = 0; i < m_textTracks->length(); ++i) { TextTrack* textTrack = m_textTracks->anonymousIndexedGetter(i); if (textTrack->isVisualKind()) textTrack->setHasBeenConfigured(false); } } ",0 "HeadlessDevToolsManagerDelegate::CreateTarget( content::DevToolsAgentHost* agent_host, int session_id, int command_id, const base::DictionaryValue* params) { std::string url; if (const base::Value* url_value = params->FindKey(""url"")) { url = url_value->GetString(); } else { return CreateInvalidParamResponse(command_id, ""url""); } std::string browser_context_id; if (const base::Value* browser_context_id_value = params->FindKey(""browserContextId"")) { browser_context_id = browser_context_id_value->GetString(); } int width = browser_->options()->window_size.width(); if (const base::Value* width_value = params->FindKey(""width"")) width = width_value->GetInt(); int height = browser_->options()->window_size.height(); if (const base::Value* height_value = params->FindKey(""height"")) height = height_value->GetInt(); bool enable_begin_frame_control = false; if (const base::Value* enable_begin_frame_control_value = params->FindKey(""enableBeginFrameControl"")) { enable_begin_frame_control = enable_begin_frame_control_value->GetBool(); } #if defined(OS_MACOSX) if (enable_begin_frame_control) { return CreateErrorResponse( command_id, kErrorServerError, ""BeginFrameControl is not supported on MacOS yet""); } #endif HeadlessBrowserContext* context = browser_->GetBrowserContextForId(browser_context_id); if (!browser_context_id.empty()) { context = browser_->GetBrowserContextForId(browser_context_id); if (!context) return CreateInvalidParamResponse(command_id, ""browserContextId""); } else { context = browser_->GetDefaultBrowserContext(); if (!context) { return CreateErrorResponse(command_id, kErrorServerError, ""You specified no |browserContextId|, but "" ""there is no default browser context set on "" ""HeadlessBrowser""); } } HeadlessWebContentsImpl* web_contents_impl = HeadlessWebContentsImpl::From( context->CreateWebContentsBuilder() .SetInitialURL(GURL(url)) .SetWindowSize(gfx::Size(width, height)) .SetEnableBeginFrameControl(enable_begin_frame_control) .Build()); std::unique_ptr result( target::CreateTargetResult::Builder() .SetTargetId(web_contents_impl->GetDevToolsAgentHostId()) .Build() ->Serialize()); return CreateSuccessResponse(command_id, std::move(result)); } ",0 "mux_stdio_confirm(int id, int success, void *arg) { struct mux_stdio_confirm_ctx *cctx = arg; Channel *c, *cc; Buffer reply; if (cctx == NULL) fatal(""%s: cctx == NULL"", __func__); if ((c = channel_by_id(id)) == NULL) fatal(""%s: no channel for id %d"", __func__, id); if ((cc = channel_by_id(c->ctl_chan)) == NULL) fatal(""%s: channel %d lacks control channel %d"", __func__, id, c->ctl_chan); if (!success) { debug3(""%s: sending failure reply"", __func__); /* prepare reply */ buffer_init(&reply); buffer_put_int(&reply, MUX_S_FAILURE); buffer_put_int(&reply, cctx->rid); buffer_put_cstring(&reply, ""Session open refused by peer""); goto done; } debug3(""%s: sending success reply"", __func__); /* prepare reply */ buffer_init(&reply); buffer_put_int(&reply, MUX_S_SESSION_OPENED); buffer_put_int(&reply, cctx->rid); buffer_put_int(&reply, c->self); done: /* Send reply */ buffer_put_string(&cc->output, buffer_ptr(&reply), buffer_len(&reply)); buffer_free(&reply); if (cc->mux_pause <= 0) fatal(""%s: mux_pause %d"", __func__, cc->mux_pause); cc->mux_pause = 0; /* start processing messages again */ c->open_confirm_ctx = NULL; free(cctx); } ",0 "void Document::write(LocalDOMWindow* calling_window, const Vector& text, ExceptionState& exception_state) { DCHECK(calling_window); if (GetSecurityContext().RequireTrustedTypes()) { DCHECK(RuntimeEnabledFeatures::TrustedDOMTypesEnabled()); exception_state.ThrowTypeError( ""This document can only write `TrustedHTML` objects.""); return; } StringBuilder builder; for (const String& string : text) builder.Append(string); write(builder.ToString(), calling_window->document(), exception_state); } ",0 "static inline void _gdScaleCol (gdImagePtr pSrc, unsigned int src_width, gdImagePtr pRes, unsigned int dst_width, unsigned int dst_height, unsigned int uCol, LineContribType *contrib) { unsigned int y; for (y = 0; y < dst_height - 1; y++) { register unsigned char r = 0, g = 0, b = 0, a = 0; const int iLeft = contrib->ContribRow[y].Left; const int iRight = contrib->ContribRow[y].Right; int i; int *row = pRes->tpixels[y]; /* Accumulate each channel */ for (i = iLeft; i <= iRight; i++) { const int pCurSrc = pSrc->tpixels[i][uCol]; const int i_iLeft = i - iLeft; r += (unsigned char)(contrib->ContribRow[y].Weights[i_iLeft] * (double)(gdTrueColorGetRed(pCurSrc))); g += (unsigned char)(contrib->ContribRow[y].Weights[i_iLeft] * (double)(gdTrueColorGetGreen(pCurSrc))); b += (unsigned char)(contrib->ContribRow[y].Weights[i_iLeft] * (double)(gdTrueColorGetBlue(pCurSrc))); a += (unsigned char)(contrib->ContribRow[y].Weights[i_iLeft] * (double)(gdTrueColorGetAlpha(pCurSrc))); } pRes->tpixels[y][uCol] = gdTrueColorAlpha(r, g, b, a); } } ",0 "bool AutocompleteEditModel::CurrentTextIsURL() const { if (!user_input_in_progress_) return true; AutocompleteMatch match; GetInfoForCurrentText(&match, NULL); return match.transition == content::PAGE_TRANSITION_TYPED; } ",0 "static void path_cleanup(struct nameidata *nd) { if (nd->root.mnt && !(nd->flags & LOOKUP_ROOT)) { path_put(&nd->root); nd->root.mnt = NULL; } if (unlikely(nd->base)) fput(nd->base); } ",0 "static int tls_curve_allowed(SSL *s, const unsigned char *curve, int op) { const tls_curve_info *cinfo; if (curve[0]) return 1; if ((curve[1] < 1) || ((size_t)curve[1] > OSSL_NELEM(nid_list))) return 0; cinfo = &nid_list[curve[1] - 1]; # ifdef OPENSSL_NO_EC2M if (cinfo->flags & TLS_CURVE_CHAR2) return 0; # endif return ssl_security(s, op, cinfo->secbits, cinfo->nid, (void *)curve); } ",0 "static inline int slave_enable_netpoll(struct slave *slave) { return 0; } ",0 "int i2d_EC_PUBKEY_bio(BIO *bp, EC_KEY *ecdsa) { return ASN1_i2d_bio_of(EC_KEY,i2d_EC_PUBKEY,bp,ecdsa); } ",0 "int hostap_set_hostapd(local_info_t *local, int val, int rtnl_locked) { int ret; if (val < 0 || val > 1) return -EINVAL; if (local->hostapd == val) return 0; if (val) { ret = hostap_enable_hostapd(local, rtnl_locked); if (ret == 0) local->hostapd = 1; } else { local->hostapd = 0; ret = hostap_disable_hostapd(local, rtnl_locked); if (ret != 0) local->hostapd = 1; } return ret; } ",0 "int kvm_emulate_hypercall(struct kvm_vcpu *vcpu) { unsigned long nr, a0, a1, a2, a3, ret; int r = 1; if (kvm_hv_hypercall_enabled(vcpu->kvm)) return kvm_hv_hypercall(vcpu); nr = kvm_register_read(vcpu, VCPU_REGS_RAX); a0 = kvm_register_read(vcpu, VCPU_REGS_RBX); a1 = kvm_register_read(vcpu, VCPU_REGS_RCX); a2 = kvm_register_read(vcpu, VCPU_REGS_RDX); a3 = kvm_register_read(vcpu, VCPU_REGS_RSI); trace_kvm_hypercall(nr, a0, a1, a2, a3); if (!is_long_mode(vcpu)) { nr &= 0xFFFFFFFF; a0 &= 0xFFFFFFFF; a1 &= 0xFFFFFFFF; a2 &= 0xFFFFFFFF; a3 &= 0xFFFFFFFF; } if (kvm_x86_ops->get_cpl(vcpu) != 0) { ret = -KVM_EPERM; goto out; } switch (nr) { case KVM_HC_VAPIC_POLL_IRQ: ret = 0; break; case KVM_HC_KICK_CPU: kvm_pv_kick_cpu_op(vcpu->kvm, a0, a1); ret = 0; break; default: ret = -KVM_ENOSYS; break; } out: kvm_register_write(vcpu, VCPU_REGS_RAX, ret); ++vcpu->stat.hypercalls; return r; } ",0 "WebGLRenderingContextBase::CreateContextProviderInternal( CanvasRenderingContextHost* host, const CanvasContextCreationAttributes& attributes, unsigned web_gl_version, bool* using_gpu_compositing) { DCHECK(host); ExecutionContext* execution_context = host->GetTopExecutionContext(); DCHECK(execution_context); Platform::ContextAttributes context_attributes = ToPlatformContextAttributes( attributes, web_gl_version, SupportOwnOffscreenSurface(execution_context)); Platform::GraphicsInfo gl_info; std::unique_ptr context_provider; const auto& url = execution_context->Url(); if (IsMainThread()) { *using_gpu_compositing = !Platform::Current()->IsGpuCompositingDisabled(); context_provider = Platform::Current()->CreateOffscreenGraphicsContext3DProvider( context_attributes, url, nullptr, &gl_info); } else { context_provider = CreateContextProviderOnWorkerThread( context_attributes, &gl_info, using_gpu_compositing, url); } if (context_provider && !context_provider->BindToCurrentThread()) { context_provider = nullptr; gl_info.error_message = String(""bindToCurrentThread failed: "" + String(gl_info.error_message)); } if (!context_provider || g_should_fail_context_creation_for_testing) { g_should_fail_context_creation_for_testing = false; host->HostDispatchEvent(WebGLContextEvent::Create( EventTypeNames::webglcontextcreationerror, false, true, ExtractWebGLContextCreationError(gl_info))); return nullptr; } gpu::gles2::GLES2Interface* gl = context_provider->ContextGL(); if (!String(gl->GetString(GL_EXTENSIONS)) .Contains(""GL_OES_packed_depth_stencil"")) { host->HostDispatchEvent(WebGLContextEvent::Create( EventTypeNames::webglcontextcreationerror, false, true, ""OES_packed_depth_stencil support is required."")); return nullptr; } return context_provider; } ",0 "WebGLRenderingContextBase::CreateWebGraphicsContext3DProvider( CanvasRenderingContextHost* host, const CanvasContextCreationAttributesCore& attributes, Platform::ContextType context_type, bool* using_gpu_compositing) { if (host->IsWebGLBlocked()) { host->SetContextCreationWasBlocked(); host->HostDispatchEvent(WebGLContextEvent::Create( event_type_names::kWebglcontextcreationerror, ""Web page caused context loss and was blocked"")); return nullptr; } if ((context_type == Platform::kWebGL1ContextType && !host->IsWebGL1Enabled()) || (context_type == Platform::kWebGL2ContextType && !host->IsWebGL2Enabled()) || (context_type == Platform::kWebGL2ComputeContextType && !host->IsWebGL2Enabled())) { host->HostDispatchEvent(WebGLContextEvent::Create( event_type_names::kWebglcontextcreationerror, ""disabled by enterprise policy or commandline switch"")); return nullptr; } return CreateContextProviderInternal(host, attributes, context_type, using_gpu_compositing); } ",0 " void UpdatePowerStatus(const PowerSupplyStatus& status) { supply_status_ = status; if (supply_status_.battery_is_full) supply_status_.battery_percentage = 100.0; UpdateText(); } ",0 "static void activityLoggingForIsolatedWorldsPerWorldBindingsVoidMethodMethodCallback(const v8::FunctionCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMMethod""); V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->GetCurrentContext()); if (contextData && contextData->activityLogger()) { Vector > loggerArgs = toNativeArguments >(info, 0); contextData->activityLogger()->log(""TestObjectPython.activityLoggingForIsolatedWorldsPerWorldBindingsVoidMethod"", info.Length(), loggerArgs.data(), ""Method""); } TestObjectPythonV8Internal::activityLoggingForIsolatedWorldsPerWorldBindingsVoidMethodMethod(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "SYSCALL_DEFINE3(unlinkat, int, dfd, const char __user *, pathname, int, flag) { if ((flag & ~AT_REMOVEDIR) != 0) return -EINVAL; if (flag & AT_REMOVEDIR) return do_rmdir(dfd, pathname); return do_unlinkat(dfd, pathname); } ",0 "static inline unsigned long group_faults(struct task_struct *p, int nid) { if (!p->numa_group) return 0; return p->numa_group->faults[task_faults_idx(NUMA_MEM, nid, 0)] + p->numa_group->faults[task_faults_idx(NUMA_MEM, nid, 1)]; } ",0 "static void pmcraid_slave_destroy(struct scsi_device *scsi_dev) { struct pmcraid_resource_entry *res; res = (struct pmcraid_resource_entry *)scsi_dev->hostdata; if (res) res->scsi_dev = NULL; scsi_dev->hostdata = NULL; } ",0 "static struct inode *isofs_alloc_inode(struct super_block *sb) { struct iso_inode_info *ei; ei = kmem_cache_alloc(isofs_inode_cachep, GFP_KERNEL); if (!ei) return NULL; return &ei->vfs_inode; } ",0 "static inline void json_print_item_str(WriterContext *wctx, const char *key, const char *value) { AVBPrint buf; av_bprint_init(&buf, 1, AV_BPRINT_SIZE_UNLIMITED); printf(""\""%s\"":"", json_escape_str(&buf, key, wctx)); av_bprint_clear(&buf); printf("" \""%s\"""", json_escape_str(&buf, value, wctx)); av_bprint_finalize(&buf, NULL); } ",0 "dx_move_dirents(char *from, char *to, struct dx_map_entry *map, int count, unsigned blocksize) { unsigned rec_len = 0; while (count--) { struct ext4_dir_entry_2 *de = (struct ext4_dir_entry_2 *) (from + (map->offs<<2)); rec_len = EXT4_DIR_REC_LEN(de->name_len); memcpy (to, de, rec_len); ((struct ext4_dir_entry_2 *) to)->rec_len = ext4_rec_len_to_disk(rec_len, blocksize); de->inode = 0; map++; to += rec_len; } return (struct ext4_dir_entry_2 *) (to - rec_len); } ",0 "static MagickBooleanType IsPS(const unsigned char *magick,const size_t length) { if (length < 4) return(MagickFalse); if (memcmp(magick,""%!"",2) == 0) return(MagickTrue); if (memcmp(magick,""\004%!"",3) == 0) return(MagickTrue); return(MagickFalse); } ",0 "char *get_component(char *target, char **targname) { char *start; while(*target == '/') target ++; start = target; while(*target != '/' && *target != '\0') target ++; *targname = strndup(start, target - start); while(*target == '/') target ++; return target; } ",0 "raptor_libxml_startDocument(void* user_data) { raptor_sax2* sax2 = (raptor_sax2*)user_data; libxml2_startDocument(sax2->xc); } ",0 "static int padlock_cra_init(struct crypto_tfm *tfm) { struct crypto_shash *hash = __crypto_shash_cast(tfm); const char *fallback_driver_name = crypto_tfm_alg_name(tfm); struct padlock_sha_ctx *ctx = crypto_tfm_ctx(tfm); struct crypto_shash *fallback_tfm; int err = -ENOMEM; /* Allocate a fallback and abort if it failed. */ fallback_tfm = crypto_alloc_shash(fallback_driver_name, 0, CRYPTO_ALG_NEED_FALLBACK); if (IS_ERR(fallback_tfm)) { printk(KERN_WARNING PFX ""Fallback driver '%s' could not be loaded!\n"", fallback_driver_name); err = PTR_ERR(fallback_tfm); goto out; } ctx->fallback = fallback_tfm; hash->descsize += crypto_shash_descsize(fallback_tfm); return 0; out: return err; } ",0 "void InspectorResourceAgent::didRecalculateStyle() { m_isRecalculatingStyle = false; m_styleRecalculationInitiator = nullptr; } ",0 "void ccst_del(GF_Box *s) { GF_CodingConstraintsBox *ptr = (GF_CodingConstraintsBox *)s; if (ptr) gf_free(ptr); return; } ",0 "void WebGL2RenderingContextBase::texSubImage2D( ExecutionContext* execution_context, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLenum format, GLenum type, HTMLVideoElement* video, ExceptionState& exception_state) { WebGLRenderingContextBase::texSubImage2D(execution_context, target, level, xoffset, yoffset, format, type, video, exception_state); } ",0 " aura::Window* CreateTestWindowInParent(aura::Window* root_window) { aura::Window* window = window_factory::NewWindow().release(); window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); window->SetType(aura::client::WINDOW_TYPE_NORMAL); window->Init(ui::LAYER_TEXTURED); aura::client::ParentWindowWithContext(window, root_window, gfx::Rect()); return window; } ",0 "static void __unlink_end_trans(struct btrfs_trans_handle *trans, struct btrfs_root *root) { if (trans->block_rsv->type == BTRFS_BLOCK_RSV_GLOBAL) { btrfs_block_rsv_release(root, trans->block_rsv, trans->bytes_reserved); trans->block_rsv = &root->fs_info->trans_block_rsv; BUG_ON(!root->fs_info->enospc_unlink); root->fs_info->enospc_unlink = 0; } btrfs_end_transaction(trans, root); } ",0 "WORD32 ih264d_video_decode(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op) { /* ! */ dec_struct_t * ps_dec = (dec_struct_t *)(dec_hdl->pv_codec_handle); WORD32 i4_err_status = 0; UWORD8 *pu1_buf = NULL; WORD32 buflen; UWORD32 u4_max_ofst, u4_length_of_start_code = 0; UWORD32 bytes_consumed = 0; UWORD32 cur_slice_is_nonref = 0; UWORD32 u4_next_is_aud; UWORD32 u4_first_start_code_found = 0; WORD32 ret = 0,api_ret_value = IV_SUCCESS; WORD32 header_data_left = 0,frame_data_left = 0; UWORD8 *pu1_bitstrm_buf; ivd_video_decode_ip_t *ps_dec_ip; ivd_video_decode_op_t *ps_dec_op; ithread_set_name((void*)""Parse_thread""); ps_dec_ip = (ivd_video_decode_ip_t *)pv_api_ip; ps_dec_op = (ivd_video_decode_op_t *)pv_api_op; { UWORD32 u4_size; u4_size = ps_dec_op->u4_size; memset(ps_dec_op, 0, sizeof(ivd_video_decode_op_t)); ps_dec_op->u4_size = u4_size; } ps_dec->pv_dec_out = ps_dec_op; ps_dec->process_called = 1; if(ps_dec->init_done != 1) { return IV_FAIL; } /*Data memory barries instruction,so that bitstream write by the application is complete*/ DATA_SYNC(); if(0 == ps_dec->u1_flushfrm) { if(ps_dec_ip->pv_stream_buffer == NULL) { ps_dec_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM; ps_dec_op->u4_error_code |= IVD_DEC_FRM_BS_BUF_NULL; return IV_FAIL; } if(ps_dec_ip->u4_num_Bytes <= 0) { ps_dec_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM; ps_dec_op->u4_error_code |= IVD_DEC_NUMBYTES_INV; return IV_FAIL; } } ps_dec->u1_pic_decode_done = 0; ps_dec_op->u4_num_bytes_consumed = 0; ps_dec->ps_out_buffer = NULL; if(ps_dec_ip->u4_size >= offsetof(ivd_video_decode_ip_t, s_out_buffer)) ps_dec->ps_out_buffer = &ps_dec_ip->s_out_buffer; ps_dec->u4_fmt_conv_cur_row = 0; ps_dec->u4_output_present = 0; ps_dec->s_disp_op.u4_error_code = 1; ps_dec->u4_fmt_conv_num_rows = FMT_CONV_NUM_ROWS; ps_dec->u4_stop_threads = 0; if(0 == ps_dec->u4_share_disp_buf && ps_dec->i4_decode_header == 0) { UWORD32 i; if(ps_dec->ps_out_buffer->u4_num_bufs == 0) { ps_dec_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM; ps_dec_op->u4_error_code |= IVD_DISP_FRM_ZERO_OP_BUFS; return IV_FAIL; } for(i = 0; i < ps_dec->ps_out_buffer->u4_num_bufs; i++) { if(ps_dec->ps_out_buffer->pu1_bufs[i] == NULL) { ps_dec_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM; ps_dec_op->u4_error_code |= IVD_DISP_FRM_OP_BUF_NULL; return IV_FAIL; } if(ps_dec->ps_out_buffer->u4_min_out_buf_size[i] == 0) { ps_dec_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM; ps_dec_op->u4_error_code |= IVD_DISP_FRM_ZERO_OP_BUF_SIZE; return IV_FAIL; } } } if(ps_dec->u4_total_frames_decoded >= NUM_FRAMES_LIMIT) { ps_dec_op->u4_error_code = ERROR_FRAME_LIMIT_OVER; return IV_FAIL; } /* ! */ ps_dec->u4_ts = ps_dec_ip->u4_ts; ps_dec_op->u4_error_code = 0; ps_dec_op->e_pic_type = -1; ps_dec_op->u4_output_present = 0; ps_dec_op->u4_frame_decoded_flag = 0; ps_dec->i4_frametype = -1; ps_dec->i4_content_type = -1; ps_dec->u4_slice_start_code_found = 0; /* In case the deocder is not in flush mode(in shared mode), then decoder has to pick up a buffer to write current frame. Check if a frame is available in such cases */ if(ps_dec->u1_init_dec_flag == 1 && ps_dec->u4_share_disp_buf == 1 && ps_dec->u1_flushfrm == 0) { UWORD32 i; WORD32 disp_avail = 0, free_id; /* Check if at least one buffer is available with the codec */ /* If not then return to application with error */ for(i = 0; i < ps_dec->u1_pic_bufs; i++) { if(0 == ps_dec->u4_disp_buf_mapping[i] || 1 == ps_dec->u4_disp_buf_to_be_freed[i]) { disp_avail = 1; break; } } if(0 == disp_avail) { /* If something is queued for display wait for that buffer to be returned */ ps_dec_op->u4_error_code = IVD_DEC_REF_BUF_NULL; ps_dec_op->u4_error_code |= (1 << IVD_UNSUPPORTEDPARAM); return (IV_FAIL); } while(1) { pic_buffer_t *ps_pic_buf; ps_pic_buf = (pic_buffer_t *)ih264_buf_mgr_get_next_free( (buf_mgr_t *)ps_dec->pv_pic_buf_mgr, &free_id); if(ps_pic_buf == NULL) { UWORD32 i, display_queued = 0; /* check if any buffer was given for display which is not returned yet */ for(i = 0; i < (MAX_DISP_BUFS_NEW); i++) { if(0 != ps_dec->u4_disp_buf_mapping[i]) { display_queued = 1; break; } } /* If some buffer is queued for display, then codec has to singal an error and wait for that buffer to be returned. If nothing is queued for display then codec has ownership of all display buffers and it can reuse any of the existing buffers and continue decoding */ if(1 == display_queued) { /* If something is queued for display wait for that buffer to be returned */ ps_dec_op->u4_error_code = IVD_DEC_REF_BUF_NULL; ps_dec_op->u4_error_code |= (1 << IVD_UNSUPPORTEDPARAM); return (IV_FAIL); } } else { /* If the buffer is with display, then mark it as in use and then look for a buffer again */ if(1 == ps_dec->u4_disp_buf_mapping[free_id]) { ih264_buf_mgr_set_status( (buf_mgr_t *)ps_dec->pv_pic_buf_mgr, free_id, BUF_MGR_IO); } else { /** * Found a free buffer for present call. Release it now. * Will be again obtained later. */ ih264_buf_mgr_release((buf_mgr_t *)ps_dec->pv_pic_buf_mgr, free_id, BUF_MGR_IO); break; } } } } if(ps_dec->u1_flushfrm && ps_dec->u1_init_dec_flag) { ih264d_get_next_display_field(ps_dec, ps_dec->ps_out_buffer, &(ps_dec->s_disp_op)); if(0 == ps_dec->s_disp_op.u4_error_code) { ps_dec->u4_fmt_conv_cur_row = 0; ps_dec->u4_fmt_conv_num_rows = ps_dec->s_disp_frame_info.u4_y_ht; ih264d_format_convert(ps_dec, &(ps_dec->s_disp_op), ps_dec->u4_fmt_conv_cur_row, ps_dec->u4_fmt_conv_num_rows); ps_dec->u4_fmt_conv_cur_row += ps_dec->u4_fmt_conv_num_rows; ps_dec->u4_output_present = 1; } ih264d_release_display_field(ps_dec, &(ps_dec->s_disp_op)); ps_dec_op->u4_pic_wd = (UWORD32)ps_dec->u2_disp_width; ps_dec_op->u4_pic_ht = (UWORD32)ps_dec->u2_disp_height; ps_dec_op->u4_new_seq = 0; ps_dec_op->u4_output_present = ps_dec->u4_output_present; ps_dec_op->u4_progressive_frame_flag = ps_dec->s_disp_op.u4_progressive_frame_flag; ps_dec_op->e_output_format = ps_dec->s_disp_op.e_output_format; ps_dec_op->s_disp_frm_buf = ps_dec->s_disp_op.s_disp_frm_buf; ps_dec_op->e4_fld_type = ps_dec->s_disp_op.e4_fld_type; ps_dec_op->u4_ts = ps_dec->s_disp_op.u4_ts; ps_dec_op->u4_disp_buf_id = ps_dec->s_disp_op.u4_disp_buf_id; /*In the case of flush ,since no frame is decoded set pic type as invalid*/ ps_dec_op->u4_is_ref_flag = -1; ps_dec_op->e_pic_type = IV_NA_FRAME; ps_dec_op->u4_frame_decoded_flag = 0; if(0 == ps_dec->s_disp_op.u4_error_code) { return (IV_SUCCESS); } else return (IV_FAIL); } if(ps_dec->u1_res_changed == 1) { /*if resolution has changed and all buffers have been flushed, reset decoder*/ ih264d_init_decoder(ps_dec); } ps_dec->u4_prev_nal_skipped = 0; ps_dec->u2_cur_mb_addr = 0; ps_dec->u2_total_mbs_coded = 0; ps_dec->u2_cur_slice_num = 0; ps_dec->cur_dec_mb_num = 0; ps_dec->cur_recon_mb_num = 0; ps_dec->u4_first_slice_in_pic = 2; ps_dec->u1_first_pb_nal_in_pic = 1; ps_dec->u1_slice_header_done = 0; ps_dec->u1_dangling_field = 0; ps_dec->u4_dec_thread_created = 0; ps_dec->u4_bs_deblk_thread_created = 0; ps_dec->u4_cur_bs_mb_num = 0; ps_dec->u4_start_recon_deblk = 0; DEBUG_THREADS_PRINTF("" Starting process call\n""); ps_dec->u4_pic_buf_got = 0; do { pu1_buf = (UWORD8*)ps_dec_ip->pv_stream_buffer + ps_dec_op->u4_num_bytes_consumed; u4_max_ofst = ps_dec_ip->u4_num_Bytes - ps_dec_op->u4_num_bytes_consumed; pu1_bitstrm_buf = ps_dec->ps_mem_tab[MEM_REC_BITSBUF].pv_base; u4_next_is_aud = 0; buflen = ih264d_find_start_code(pu1_buf, 0, u4_max_ofst, &u4_length_of_start_code, &u4_next_is_aud); if(buflen == -1) buflen = 0; /* Ignore bytes beyond the allocated size of intermediate buffer */ /* Since 8 bytes are read ahead, ensure 8 bytes are free at the end of the buffer, which will be memset to 0 after emulation prevention */ buflen = MIN(buflen, (WORD32)(ps_dec->ps_mem_tab[MEM_REC_BITSBUF].u4_mem_size - 8)); bytes_consumed = buflen + u4_length_of_start_code; ps_dec_op->u4_num_bytes_consumed += bytes_consumed; if(buflen >= MAX_NAL_UNIT_SIZE) { ih264d_fill_output_struct_from_context(ps_dec, ps_dec_op); H264_DEC_DEBUG_PRINT( ""\nNal Size exceeded %d, Processing Stopped..\n"", MAX_NAL_UNIT_SIZE); ps_dec->i4_error_code = 1 << IVD_CORRUPTEDDATA; ps_dec_op->e_pic_type = -1; /*signal the decode thread*/ ih264d_signal_decode_thread(ps_dec); /*signal end of frame decode for curren frame*/ if(ps_dec->u4_pic_buf_got == 0) { if(ps_dec->i4_header_decoded == 3) { ps_dec->u2_total_mbs_coded = ps_dec->ps_cur_sps->u2_max_mb_addr + 1; } /* close deblock thread if it is not closed yet*/ if(ps_dec->u4_num_cores == 3) { ih264d_signal_bs_deblk_thread(ps_dec); } return IV_FAIL; } else { ps_dec->u1_pic_decode_done = 1; continue; } } { UWORD8 u1_firstbyte, u1_nal_ref_idc; if(ps_dec->i4_app_skip_mode == IVD_SKIP_B) { u1_firstbyte = *(pu1_buf + u4_length_of_start_code); u1_nal_ref_idc = (UWORD8)(NAL_REF_IDC(u1_firstbyte)); if(u1_nal_ref_idc == 0) { /*skip non reference frames*/ cur_slice_is_nonref = 1; continue; } else { if(1 == cur_slice_is_nonref) { /*We have encountered a referenced frame,return to app*/ ps_dec_op->u4_num_bytes_consumed -= bytes_consumed; ps_dec_op->e_pic_type = IV_B_FRAME; ps_dec_op->u4_error_code = IVD_DEC_FRM_SKIPPED; ps_dec_op->u4_error_code |= (1 << IVD_UNSUPPORTEDPARAM); ps_dec_op->u4_frame_decoded_flag = 0; ps_dec_op->u4_size = sizeof(ivd_video_decode_op_t); /*signal the decode thread*/ ih264d_signal_decode_thread(ps_dec); /* close deblock thread if it is not closed yet*/ if(ps_dec->u4_num_cores == 3) { ih264d_signal_bs_deblk_thread(ps_dec); } return (IV_FAIL); } } } } if(buflen) { memcpy(pu1_bitstrm_buf, pu1_buf + u4_length_of_start_code, buflen); u4_first_start_code_found = 1; } else { /*start code not found*/ if(u4_first_start_code_found == 0) { /*no start codes found in current process call*/ ps_dec->i4_error_code = ERROR_START_CODE_NOT_FOUND; ps_dec_op->u4_error_code |= 1 << IVD_INSUFFICIENTDATA; if(ps_dec->u4_pic_buf_got == 0) { ih264d_fill_output_struct_from_context(ps_dec, ps_dec_op); ps_dec_op->u4_error_code = ps_dec->i4_error_code; ps_dec_op->u4_frame_decoded_flag = 0; return (IV_FAIL); } else { ps_dec->u1_pic_decode_done = 1; continue; } } else { /* a start code has already been found earlier in the same process call*/ frame_data_left = 0; header_data_left = 0; continue; } } ps_dec->u4_return_to_app = 0; ret = ih264d_parse_nal_unit(dec_hdl, ps_dec_op, pu1_bitstrm_buf, buflen); if(ret != OK) { UWORD32 error = ih264d_map_error(ret); ps_dec_op->u4_error_code = error | ret; api_ret_value = IV_FAIL; if((ret == IVD_RES_CHANGED) || (ret == IVD_STREAM_WIDTH_HEIGHT_NOT_SUPPORTED) || (ret == ERROR_UNAVAIL_PICBUF_T) || (ret == ERROR_UNAVAIL_MVBUF_T) || (ret == ERROR_INV_SPS_PPS_T)) { ps_dec->u4_slice_start_code_found = 0; break; } if((ret == ERROR_INCOMPLETE_FRAME) || (ret == ERROR_DANGLING_FIELD_IN_PIC)) { ps_dec_op->u4_num_bytes_consumed -= bytes_consumed; api_ret_value = IV_FAIL; break; } if(ret == ERROR_IN_LAST_SLICE_OF_PIC) { api_ret_value = IV_FAIL; break; } } if(ps_dec->u4_return_to_app) { /*We have encountered a referenced frame,return to app*/ ps_dec_op->u4_num_bytes_consumed -= bytes_consumed; ps_dec_op->u4_error_code = IVD_DEC_FRM_SKIPPED; ps_dec_op->u4_error_code |= (1 << IVD_UNSUPPORTEDPARAM); ps_dec_op->u4_frame_decoded_flag = 0; ps_dec_op->u4_size = sizeof(ivd_video_decode_op_t); /*signal the decode thread*/ ih264d_signal_decode_thread(ps_dec); /* close deblock thread if it is not closed yet*/ if(ps_dec->u4_num_cores == 3) { ih264d_signal_bs_deblk_thread(ps_dec); } return (IV_FAIL); } header_data_left = ((ps_dec->i4_decode_header == 1) && (ps_dec->i4_header_decoded != 3) && (ps_dec_op->u4_num_bytes_consumed < ps_dec_ip->u4_num_Bytes)); frame_data_left = (((ps_dec->i4_decode_header == 0) && ((ps_dec->u1_pic_decode_done == 0) || (u4_next_is_aud == 1))) && (ps_dec_op->u4_num_bytes_consumed < ps_dec_ip->u4_num_Bytes)); } while(( header_data_left == 1)||(frame_data_left == 1)); if((ps_dec->u4_slice_start_code_found == 1) && ps_dec->u2_total_mbs_coded < ps_dec->u2_frm_ht_in_mbs * ps_dec->u2_frm_wd_in_mbs) { WORD32 num_mb_skipped; WORD32 prev_slice_err; pocstruct_t temp_poc; WORD32 ret1; WORD32 ht_in_mbs; ht_in_mbs = ps_dec->u2_pic_ht >> (4 + ps_dec->ps_cur_slice->u1_field_pic_flag); num_mb_skipped = (ht_in_mbs * ps_dec->u2_frm_wd_in_mbs) - ps_dec->u2_total_mbs_coded; if(ps_dec->u4_first_slice_in_pic && (ps_dec->u4_pic_buf_got == 0)) prev_slice_err = 1; else prev_slice_err = 2; if(ps_dec->u4_first_slice_in_pic && (ps_dec->u2_total_mbs_coded == 0)) prev_slice_err = 1; ret1 = ih264d_mark_err_slice_skip(ps_dec, num_mb_skipped, ps_dec->u1_nal_unit_type == IDR_SLICE_NAL, ps_dec->ps_cur_slice->u2_frame_num, &temp_poc, prev_slice_err); if((ret1 == ERROR_UNAVAIL_PICBUF_T) || (ret1 == ERROR_UNAVAIL_MVBUF_T) || (ret1 == ERROR_INV_SPS_PPS_T)) { ret = ret1; } } if((ret == IVD_RES_CHANGED) || (ret == IVD_STREAM_WIDTH_HEIGHT_NOT_SUPPORTED) || (ret == ERROR_UNAVAIL_PICBUF_T) || (ret == ERROR_UNAVAIL_MVBUF_T) || (ret == ERROR_INV_SPS_PPS_T)) { /* signal the decode thread */ ih264d_signal_decode_thread(ps_dec); /* close deblock thread if it is not closed yet */ if(ps_dec->u4_num_cores == 3) { ih264d_signal_bs_deblk_thread(ps_dec); } /* dont consume bitstream for change in resolution case */ if(ret == IVD_RES_CHANGED) { ps_dec_op->u4_num_bytes_consumed -= bytes_consumed; } return IV_FAIL; } if(ps_dec->u1_separate_parse) { /* If Format conversion is not complete, complete it here */ if(ps_dec->u4_num_cores == 2) { /*do deblocking of all mbs*/ if((ps_dec->u4_nmb_deblk == 0) &&(ps_dec->u4_start_recon_deblk == 1) && (ps_dec->ps_cur_sps->u1_mb_aff_flag == 0)) { UWORD32 u4_num_mbs,u4_max_addr; tfr_ctxt_t s_tfr_ctxt; tfr_ctxt_t *ps_tfr_cxt = &s_tfr_ctxt; pad_mgr_t *ps_pad_mgr = &ps_dec->s_pad_mgr; /*BS is done for all mbs while parsing*/ u4_max_addr = (ps_dec->u2_frm_wd_in_mbs * ps_dec->u2_frm_ht_in_mbs) - 1; ps_dec->u4_cur_bs_mb_num = u4_max_addr + 1; ih264d_init_deblk_tfr_ctxt(ps_dec, ps_pad_mgr, ps_tfr_cxt, ps_dec->u2_frm_wd_in_mbs, 0); u4_num_mbs = u4_max_addr - ps_dec->u4_cur_deblk_mb_num + 1; DEBUG_PERF_PRINTF(""mbs left for deblocking= %d \n"",u4_num_mbs); if(u4_num_mbs != 0) ih264d_check_mb_map_deblk(ps_dec, u4_num_mbs, ps_tfr_cxt,1); ps_dec->u4_start_recon_deblk = 0; } } /*signal the decode thread*/ ih264d_signal_decode_thread(ps_dec); /* close deblock thread if it is not closed yet*/ if(ps_dec->u4_num_cores == 3) { ih264d_signal_bs_deblk_thread(ps_dec); } } DATA_SYNC(); if((ps_dec_op->u4_error_code & 0xff) != ERROR_DYNAMIC_RESOLUTION_NOT_SUPPORTED) { ps_dec_op->u4_pic_wd = (UWORD32)ps_dec->u2_disp_width; ps_dec_op->u4_pic_ht = (UWORD32)ps_dec->u2_disp_height; } if(ps_dec->i4_header_decoded != 3) { ps_dec_op->u4_error_code |= (1 << IVD_INSUFFICIENTDATA); } if(ps_dec->i4_decode_header == 1 && ps_dec->i4_header_decoded != 3) { ps_dec_op->u4_error_code |= (1 << IVD_INSUFFICIENTDATA); } if(ps_dec->u4_prev_nal_skipped) { /*We have encountered a referenced frame,return to app*/ ps_dec_op->u4_error_code = IVD_DEC_FRM_SKIPPED; ps_dec_op->u4_error_code |= (1 << IVD_UNSUPPORTEDPARAM); ps_dec_op->u4_frame_decoded_flag = 0; ps_dec_op->u4_size = sizeof(ivd_video_decode_op_t); /* close deblock thread if it is not closed yet*/ if(ps_dec->u4_num_cores == 3) { ih264d_signal_bs_deblk_thread(ps_dec); } return (IV_FAIL); } if((ps_dec->u4_slice_start_code_found == 1) && (ERROR_DANGLING_FIELD_IN_PIC != i4_err_status)) { /* * For field pictures, set the bottom and top picture decoded u4_flag correctly. */ if(ps_dec->ps_cur_slice->u1_field_pic_flag) { if(1 == ps_dec->ps_cur_slice->u1_bottom_field_flag) { ps_dec->u1_top_bottom_decoded |= BOT_FIELD_ONLY; } else { ps_dec->u1_top_bottom_decoded |= TOP_FIELD_ONLY; } } /* if new frame in not found (if we are still getting slices from previous frame) * ih264d_deblock_display is not called. Such frames will not be added to reference /display */ if (((ps_dec->ps_dec_err_status->u1_err_flag & REJECT_CUR_PIC) == 0) && (ps_dec->u4_pic_buf_got == 1)) { /* Calling Function to deblock Picture and Display */ ret = ih264d_deblock_display(ps_dec); } /*set to complete ,as we dont support partial frame decode*/ if(ps_dec->i4_header_decoded == 3) { ps_dec->u2_total_mbs_coded = ps_dec->ps_cur_sps->u2_max_mb_addr + 1; } /*Update the i4_frametype at the end of picture*/ if(ps_dec->ps_cur_slice->u1_nal_unit_type == IDR_SLICE_NAL) { ps_dec->i4_frametype = IV_IDR_FRAME; } else if(ps_dec->i4_pic_type == B_SLICE) { ps_dec->i4_frametype = IV_B_FRAME; } else if(ps_dec->i4_pic_type == P_SLICE) { ps_dec->i4_frametype = IV_P_FRAME; } else if(ps_dec->i4_pic_type == I_SLICE) { ps_dec->i4_frametype = IV_I_FRAME; } else { H264_DEC_DEBUG_PRINT(""Shouldn't come here\n""); } ps_dec->i4_content_type = ps_dec->ps_cur_slice->u1_field_pic_flag; ps_dec->u4_total_frames_decoded = ps_dec->u4_total_frames_decoded + 2; ps_dec->u4_total_frames_decoded = ps_dec->u4_total_frames_decoded - ps_dec->ps_cur_slice->u1_field_pic_flag; } /* close deblock thread if it is not closed yet*/ if(ps_dec->u4_num_cores == 3) { ih264d_signal_bs_deblk_thread(ps_dec); } { /* In case the decoder is configured to run in low delay mode, * then get display buffer and then format convert. * Note in this mode, format conversion does not run paralelly in a thread and adds to the codec cycles */ if((0 == ps_dec->u4_num_reorder_frames_at_init) && ps_dec->u1_init_dec_flag) { ih264d_get_next_display_field(ps_dec, ps_dec->ps_out_buffer, &(ps_dec->s_disp_op)); if(0 == ps_dec->s_disp_op.u4_error_code) { ps_dec->u4_fmt_conv_cur_row = 0; ps_dec->u4_output_present = 1; } } ih264d_fill_output_struct_from_context(ps_dec, ps_dec_op); /* If Format conversion is not complete, complete it here */ if(ps_dec->u4_output_present && (ps_dec->u4_fmt_conv_cur_row < ps_dec->s_disp_frame_info.u4_y_ht)) { ps_dec->u4_fmt_conv_num_rows = ps_dec->s_disp_frame_info.u4_y_ht - ps_dec->u4_fmt_conv_cur_row; ih264d_format_convert(ps_dec, &(ps_dec->s_disp_op), ps_dec->u4_fmt_conv_cur_row, ps_dec->u4_fmt_conv_num_rows); ps_dec->u4_fmt_conv_cur_row += ps_dec->u4_fmt_conv_num_rows; } ih264d_release_display_field(ps_dec, &(ps_dec->s_disp_op)); } if(ps_dec->i4_decode_header == 1 && (ps_dec->i4_header_decoded & 1) == 1) { ps_dec_op->u4_progressive_frame_flag = 1; if((NULL != ps_dec->ps_cur_sps) && (1 == (ps_dec->ps_cur_sps->u1_is_valid))) { if((0 == ps_dec->ps_sps->u1_frame_mbs_only_flag) && (0 == ps_dec->ps_sps->u1_mb_aff_flag)) ps_dec_op->u4_progressive_frame_flag = 0; } } if((TOP_FIELD_ONLY | BOT_FIELD_ONLY) == ps_dec->u1_top_bottom_decoded) { ps_dec->u1_top_bottom_decoded = 0; } /*--------------------------------------------------------------------*/ /* Do End of Pic processing. */ /* Should be called only if frame was decoded in previous process call*/ /*--------------------------------------------------------------------*/ if(ps_dec->u4_pic_buf_got == 1) { if(1 == ps_dec->u1_last_pic_not_decoded) { ret = ih264d_end_of_pic_dispbuf_mgr(ps_dec); if(ret != OK) return ret; ret = ih264d_end_of_pic(ps_dec); if(ret != OK) return ret; } else { ret = ih264d_end_of_pic(ps_dec); if(ret != OK) return ret; } } /*Data memory barrier instruction,so that yuv write by the library is complete*/ DATA_SYNC(); H264_DEC_DEBUG_PRINT(""The num bytes consumed: %d\n"", ps_dec_op->u4_num_bytes_consumed); return api_ret_value; } ",1 "u32 a_copy_from_user(void *to, const void *from, u32 n) { return(copy_from_user(to, from, n)); } ",0 "notify_prepare(fd_set *readset) { if (notify_pipe[0] != -1) FD_SET(notify_pipe[0], readset); } ",0 "double TestWebKitPlatformSupport::audioHardwareSampleRate() { return 44100.0; } ",0 "static int __kvm_set_dr(struct kvm_vcpu *vcpu, int dr, unsigned long val) { switch (dr) { case 0 ... 3: vcpu->arch.db[dr] = val; if (!(vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP)) vcpu->arch.eff_db[dr] = val; break; case 4: if (kvm_read_cr4_bits(vcpu, X86_CR4_DE)) return 1; /* #UD */ /* fall through */ case 6: if (val & 0xffffffff00000000ULL) return -1; /* #GP */ vcpu->arch.dr6 = (val & DR6_VOLATILE) | DR6_FIXED_1; kvm_update_dr6(vcpu); break; case 5: if (kvm_read_cr4_bits(vcpu, X86_CR4_DE)) return 1; /* #UD */ /* fall through */ default: /* 7 */ if (val & 0xffffffff00000000ULL) return -1; /* #GP */ vcpu->arch.dr7 = (val & DR7_VOLATILE) | DR7_FIXED_1; kvm_update_dr7(vcpu); break; } return 0; } ",0 "void FeatureInfo::InitializeForTesting( const DisallowedFeatures& disallowed_features) { initialized_ = false; Initialize(CONTEXT_TYPE_OPENGLES2, false /* is_passthrough_cmd_decoder */, disallowed_features); } ",0 "static void Bitmap_copyPixelsFromBuffer(JNIEnv* env, jobject, jlong bitmapHandle, jobject jbuffer) { SkBitmap* bitmap = reinterpret_cast(bitmapHandle); SkAutoLockPixels alp(*bitmap); void* dst = bitmap->getPixels(); if (NULL != dst) { android::AutoBufferPointer abp(env, jbuffer, JNI_FALSE); memcpy(dst, abp.pointer(), bitmap->getSize()); bitmap->notifyPixelsChanged(); } } ",0 "int load_abrt_plugin_conf_file(const char *file, map_string_t *settings) { static const char *const base_directories[] = { DEFAULT_PLUGINS_CONF_DIR, PLUGINS_CONF_DIR, NULL }; return load_conf_file_from_dirs(file, base_directories, settings, /*skip key w/o values:*/ false); } ",0 "void ewk_view_fixed_layout_size_get(const Evas_Object* ewkView, Evas_Coord* width, Evas_Coord* height) { if (width) *width = 0; if (height) *height = 0; EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); WebCore::FrameView* view = priv->mainFrame->view(); if (view->useFixedLayout()) { WebCore::IntSize size = view->fixedLayoutSize(); if (width) *width = size.width(); if (height) *height = size.height(); } } ",0 "static int handle_apic_access(struct kvm_vcpu *vcpu) { if (likely(fasteoi)) { unsigned long exit_qualification = vmcs_readl(EXIT_QUALIFICATION); int access_type, offset; access_type = exit_qualification & APIC_ACCESS_TYPE; offset = exit_qualification & APIC_ACCESS_OFFSET; /* * Sane guest uses MOV to write EOI, with written value * not cared. So make a short-circuit here by avoiding * heavy instruction emulation. */ if ((access_type == TYPE_LINEAR_APIC_INST_WRITE) && (offset == APIC_EOI)) { kvm_lapic_set_eoi(vcpu); skip_emulated_instruction(vcpu); return 1; } } return emulate_instruction(vcpu, 0) == EMULATE_DONE; } ",0 "void MediaPlayerService::AudioOutput::setNextOutput(const sp& nextOutput) { Mutex::Autolock lock(mLock); mNextOutput = nextOutput; } ",0 "void NuPlayer::GenericSource::onReadBuffer(sp msg) { int32_t tmpType; CHECK(msg->findInt32(""trackType"", &tmpType)); media_track_type trackType = (media_track_type)tmpType; readBuffer(trackType); { Mutex::Autolock _l(mReadBufferLock); mPendingReadBufferTypes &= ~(1 << trackType); } } ",0 "static inline int vmsvga_copy_rect(struct vmsvga_state_s *s, int x0, int y0, int x1, int y1, int w, int h) { DisplaySurface *surface = qemu_console_surface(s->vga.con); uint8_t *vram = s->vga.vram_ptr; int bypl = surface_stride(surface); int bypp = surface_bytes_per_pixel(surface); int width = bypp * w; int line = h; uint8_t *ptr[2]; if (!vmsvga_verify_rect(surface, ""vmsvga_copy_rect/src"", x0, y0, w, h)) { return -1; } if (!vmsvga_verify_rect(surface, ""vmsvga_copy_rect/dst"", x1, y1, w, h)) { return -1; } if (y1 > y0) { ptr[0] = vram + bypp * x0 + bypl * (y0 + h - 1); ptr[1] = vram + bypp * x1 + bypl * (y1 + h - 1); for (; line > 0; line --, ptr[0] -= bypl, ptr[1] -= bypl) { memmove(ptr[1], ptr[0], width); } } else { ptr[0] = vram + bypp * x0 + bypl * y0; ptr[1] = vram + bypp * x1 + bypl * y1; for (; line > 0; line --, ptr[0] += bypl, ptr[1] += bypl) { memmove(ptr[1], ptr[0], width); } } vmsvga_update_rect_delayed(s, x1, y1, w, h); return 0; } ",0 "void InputConnectionImpl::StartStateUpdateTimer() { state_update_timer_.Start( FROM_HERE, kStateUpdateTimeout, base::BindOnce(&InputConnectionImpl::UpdateTextInputState, base::Unretained(this), true /* is_input_state_update_requested */)); } ",0 " void testUriHostRegname() { UriParserStateA stateA; UriUriA uriA; stateA.uri = &uriA; const char * const input = ""http"" ""://"" ""example.com""; TEST_ASSERT(0 == uriParseUriA(&stateA, input)); TEST_ASSERT(uriA.hostText.first == input + 4 + 3); TEST_ASSERT(uriA.hostText.afterLast == input + 4 + 3 + 11); TEST_ASSERT(uriA.hostData.ip4 == NULL); TEST_ASSERT(uriA.hostData.ip6 == NULL); TEST_ASSERT(uriA.hostData.ipFuture.first == NULL); TEST_ASSERT(uriA.hostData.ipFuture.afterLast == NULL); uriFreeUriMembersA(&uriA); } ",0 "autofill::AddressNormalizer* PaymentRequestState::GetAddressNormalizer() { return payment_request_delegate_->GetAddressNormalizer(); } ",0 "static void mcryptd_free(struct crypto_instance *inst) { struct mcryptd_instance_ctx *ctx = crypto_instance_ctx(inst); struct hashd_instance_ctx *hctx = crypto_instance_ctx(inst); switch (inst->alg.cra_flags & CRYPTO_ALG_TYPE_MASK) { case CRYPTO_ALG_TYPE_AHASH: crypto_drop_ahash(&hctx->spawn); kfree(ahash_instance(inst)); return; default: crypto_drop_spawn(&ctx->spawn); kfree(inst); } } ",0 "static Image *ReadMPCImage(const ImageInfo *image_info,ExceptionInfo *exception) { char cache_filename[MaxTextExtent], id[MaxTextExtent], keyword[MaxTextExtent], *options; const unsigned char *p; GeometryInfo geometry_info; Image *image; int c; LinkedListInfo *profiles; MagickBooleanType status; MagickOffsetType offset; MagickStatusType flags; register ssize_t i; size_t depth, length; ssize_t count; StringInfo *profile; unsigned int signature; /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickSignature); image=AcquireImage(image_info); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } (void) CopyMagickString(cache_filename,image->filename,MaxTextExtent); AppendImageFormat(""cache"",cache_filename); c=ReadBlobByte(image); if (c == EOF) { image=DestroyImage(image); return((Image *) NULL); } *id='\0'; (void) ResetMagickMemory(keyword,0,sizeof(keyword)); offset=0; do { /* Decode image header; header terminates one character beyond a ':'. */ profiles=(LinkedListInfo *) NULL; length=MaxTextExtent; options=AcquireString((char *) NULL); signature=GetMagickSignature((const StringInfo *) NULL); image->depth=8; image->compression=NoCompression; while ((isgraph(c) != MagickFalse) && (c != (int) ':')) { register char *p; if (c == (int) '{') { char *comment; /* Read comment-- any text between { }. */ length=MaxTextExtent; comment=AcquireString((char *) NULL); for (p=comment; comment != (char *) NULL; p++) { c=ReadBlobByte(image); if (c == (int) '\\') c=ReadBlobByte(image); else if ((c == EOF) || (c == (int) '}')) break; if ((size_t) (p-comment+1) >= length) { *p='\0'; length<<=1; comment=(char *) ResizeQuantumMemory(comment,length+ MaxTextExtent,sizeof(*comment)); if (comment == (char *) NULL) break; p=comment+strlen(comment); } *p=(char) c; } if (comment == (char *) NULL) ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); *p='\0'; (void) SetImageProperty(image,""comment"",comment); comment=DestroyString(comment); c=ReadBlobByte(image); } else if (isalnum(c) != MagickFalse) { /* Get the keyword. */ length=MaxTextExtent; p=keyword; do { if (c == (int) '=') break; if ((size_t) (p-keyword) < (MaxTextExtent-1)) *p++=(char) c; c=ReadBlobByte(image); } while (c != EOF); *p='\0'; p=options; while (isspace((int) ((unsigned char) c)) != 0) c=ReadBlobByte(image); if (c == (int) '=') { /* Get the keyword value. */ c=ReadBlobByte(image); while ((c != (int) '}') && (c != EOF)) { if ((size_t) (p-options+1) >= length) { *p='\0'; length<<=1; options=(char *) ResizeQuantumMemory(options,length+ MaxTextExtent,sizeof(*options)); if (options == (char *) NULL) break; p=options+strlen(options); } *p++=(char) c; c=ReadBlobByte(image); if (c == '\\') { c=ReadBlobByte(image); if (c == (int) '}') { *p++=(char) c; c=ReadBlobByte(image); } } if (*options != '{') if (isspace((int) ((unsigned char) c)) != 0) break; } if (options == (char *) NULL) ThrowReaderException(ResourceLimitError, ""MemoryAllocationFailed""); } *p='\0'; if (*options == '{') (void) CopyMagickString(options,options+1,strlen(options)); /* Assign a value to the specified keyword. */ switch (*keyword) { case 'b': case 'B': { if (LocaleCompare(keyword,""background-color"") == 0) { (void) QueryColorDatabase(options,&image->background_color, exception); break; } if (LocaleCompare(keyword,""blue-primary"") == 0) { flags=ParseGeometry(options,&geometry_info); image->chromaticity.blue_primary.x=geometry_info.rho; image->chromaticity.blue_primary.y=geometry_info.sigma; if ((flags & SigmaValue) == 0) image->chromaticity.blue_primary.y= image->chromaticity.blue_primary.x; break; } if (LocaleCompare(keyword,""border-color"") == 0) { (void) QueryColorDatabase(options,&image->border_color, exception); break; } (void) SetImageProperty(image,keyword,options); break; } case 'c': case 'C': { if (LocaleCompare(keyword,""class"") == 0) { ssize_t storage_class; storage_class=ParseCommandOption(MagickClassOptions, MagickFalse,options); if (storage_class < 0) break; image->storage_class=(ClassType) storage_class; break; } if (LocaleCompare(keyword,""colors"") == 0) { image->colors=StringToUnsignedLong(options); break; } if (LocaleCompare(keyword,""colorspace"") == 0) { ssize_t colorspace; colorspace=ParseCommandOption(MagickColorspaceOptions, MagickFalse,options); if (colorspace < 0) break; image->colorspace=(ColorspaceType) colorspace; break; } if (LocaleCompare(keyword,""compression"") == 0) { ssize_t compression; compression=ParseCommandOption(MagickCompressOptions, MagickFalse,options); if (compression < 0) break; image->compression=(CompressionType) compression; break; } if (LocaleCompare(keyword,""columns"") == 0) { image->columns=StringToUnsignedLong(options); break; } (void) SetImageProperty(image,keyword,options); break; } case 'd': case 'D': { if (LocaleCompare(keyword,""delay"") == 0) { image->delay=StringToUnsignedLong(options); break; } if (LocaleCompare(keyword,""depth"") == 0) { image->depth=StringToUnsignedLong(options); break; } if (LocaleCompare(keyword,""dispose"") == 0) { ssize_t dispose; dispose=ParseCommandOption(MagickDisposeOptions,MagickFalse, options); if (dispose < 0) break; image->dispose=(DisposeType) dispose; break; } (void) SetImageProperty(image,keyword,options); break; } case 'e': case 'E': { if (LocaleCompare(keyword,""endian"") == 0) { ssize_t endian; endian=ParseCommandOption(MagickEndianOptions,MagickFalse, options); if (endian < 0) break; image->endian=(EndianType) endian; break; } if (LocaleCompare(keyword,""error"") == 0) { image->error.mean_error_per_pixel=StringToDouble(options, (char **) NULL); break; } (void) SetImageProperty(image,keyword,options); break; } case 'g': case 'G': { if (LocaleCompare(keyword,""gamma"") == 0) { image->gamma=StringToDouble(options,(char **) NULL); break; } if (LocaleCompare(keyword,""green-primary"") == 0) { flags=ParseGeometry(options,&geometry_info); image->chromaticity.green_primary.x=geometry_info.rho; image->chromaticity.green_primary.y=geometry_info.sigma; if ((flags & SigmaValue) == 0) image->chromaticity.green_primary.y= image->chromaticity.green_primary.x; break; } (void) SetImageProperty(image,keyword,options); break; } case 'i': case 'I': { if (LocaleCompare(keyword,""id"") == 0) { (void) CopyMagickString(id,options,MaxTextExtent); break; } if (LocaleCompare(keyword,""iterations"") == 0) { image->iterations=StringToUnsignedLong(options); break; } (void) SetImageProperty(image,keyword,options); break; } case 'm': case 'M': { if (LocaleCompare(keyword,""magick-signature"") == 0) { signature=(unsigned int) StringToUnsignedLong(options); break; } if (LocaleCompare(keyword,""matte"") == 0) { ssize_t matte; matte=ParseCommandOption(MagickBooleanOptions,MagickFalse, options); if (matte < 0) break; image->matte=(MagickBooleanType) matte; break; } if (LocaleCompare(keyword,""matte-color"") == 0) { (void) QueryColorDatabase(options,&image->matte_color, exception); break; } if (LocaleCompare(keyword,""maximum-error"") == 0) { image->error.normalized_maximum_error=StringToDouble( options,(char **) NULL); break; } if (LocaleCompare(keyword,""mean-error"") == 0) { image->error.normalized_mean_error=StringToDouble(options, (char **) NULL); break; } if (LocaleCompare(keyword,""montage"") == 0) { (void) CloneString(&image->montage,options); break; } (void) SetImageProperty(image,keyword,options); break; } case 'o': case 'O': { if (LocaleCompare(keyword,""opaque"") == 0) { ssize_t matte; matte=ParseCommandOption(MagickBooleanOptions,MagickFalse, options); if (matte < 0) break; image->matte=(MagickBooleanType) matte; break; } if (LocaleCompare(keyword,""orientation"") == 0) { ssize_t orientation; orientation=ParseCommandOption(MagickOrientationOptions, MagickFalse,options); if (orientation < 0) break; image->orientation=(OrientationType) orientation; break; } (void) SetImageProperty(image,keyword,options); break; } case 'p': case 'P': { if (LocaleCompare(keyword,""page"") == 0) { char *geometry; geometry=GetPageGeometry(options); (void) ParseAbsoluteGeometry(geometry,&image->page); geometry=DestroyString(geometry); break; } if (LocaleCompare(keyword,""pixel-intensity"") == 0) { ssize_t intensity; intensity=ParseCommandOption(MagickPixelIntensityOptions, MagickFalse,options); if (intensity < 0) break; image->intensity=(PixelIntensityMethod) intensity; break; } if ((LocaleNCompare(keyword,""profile:"",8) == 0) || (LocaleNCompare(keyword,""profile-"",8) == 0)) { if (profiles == (LinkedListInfo *) NULL) profiles=NewLinkedList(0); (void) AppendValueToLinkedList(profiles, AcquireString(keyword+8)); profile=BlobToStringInfo((const void *) NULL,(size_t) StringToLong(options)); if (profile == (StringInfo *) NULL) ThrowReaderException(ResourceLimitError, ""MemoryAllocationFailed""); (void) SetImageProfile(image,keyword+8,profile); profile=DestroyStringInfo(profile); break; } (void) SetImageProperty(image,keyword,options); break; } case 'q': case 'Q': { if (LocaleCompare(keyword,""quality"") == 0) { image->quality=StringToUnsignedLong(options); break; } (void) SetImageProperty(image,keyword,options); break; } case 'r': case 'R': { if (LocaleCompare(keyword,""red-primary"") == 0) { flags=ParseGeometry(options,&geometry_info); image->chromaticity.red_primary.x=geometry_info.rho; if ((flags & SigmaValue) != 0) image->chromaticity.red_primary.y=geometry_info.sigma; break; } if (LocaleCompare(keyword,""rendering-intent"") == 0) { ssize_t rendering_intent; rendering_intent=ParseCommandOption(MagickIntentOptions, MagickFalse,options); if (rendering_intent < 0) break; image->rendering_intent=(RenderingIntent) rendering_intent; break; } if (LocaleCompare(keyword,""resolution"") == 0) { flags=ParseGeometry(options,&geometry_info); image->x_resolution=geometry_info.rho; image->y_resolution=geometry_info.sigma; if ((flags & SigmaValue) == 0) image->y_resolution=image->x_resolution; break; } if (LocaleCompare(keyword,""rows"") == 0) { image->rows=StringToUnsignedLong(options); break; } (void) SetImageProperty(image,keyword,options); break; } case 's': case 'S': { if (LocaleCompare(keyword,""scene"") == 0) { image->scene=StringToUnsignedLong(options); break; } (void) SetImageProperty(image,keyword,options); break; } case 't': case 'T': { if (LocaleCompare(keyword,""ticks-per-second"") == 0) { image->ticks_per_second=(ssize_t) StringToLong(options); break; } if (LocaleCompare(keyword,""tile-offset"") == 0) { char *geometry; geometry=GetPageGeometry(options); (void) ParseAbsoluteGeometry(geometry,&image->tile_offset); geometry=DestroyString(geometry); } if (LocaleCompare(keyword,""type"") == 0) { ssize_t type; type=ParseCommandOption(MagickTypeOptions,MagickFalse, options); if (type < 0) break; image->type=(ImageType) type; break; } (void) SetImageProperty(image,keyword,options); break; } case 'u': case 'U': { if (LocaleCompare(keyword,""units"") == 0) { ssize_t units; units=ParseCommandOption(MagickResolutionOptions,MagickFalse, options); if (units < 0) break; image->units=(ResolutionType) units; break; } (void) SetImageProperty(image,keyword,options); break; } case 'w': case 'W': { if (LocaleCompare(keyword,""white-point"") == 0) { flags=ParseGeometry(options,&geometry_info); image->chromaticity.white_point.x=geometry_info.rho; image->chromaticity.white_point.y=geometry_info.sigma; if ((flags & SigmaValue) == 0) image->chromaticity.white_point.y= image->chromaticity.white_point.x; break; } (void) SetImageProperty(image,keyword,options); break; } default: { (void) SetImageProperty(image,keyword,options); break; } } } else c=ReadBlobByte(image); while (isspace((int) ((unsigned char) c)) != 0) c=ReadBlobByte(image); } options=DestroyString(options); (void) ReadBlobByte(image); /* Verify that required image information is defined. */ if ((LocaleCompare(id,""MagickCache"") != 0) || (image->storage_class == UndefinedClass) || (image->compression == UndefinedCompression) || (image->columns == 0) || (image->rows == 0)) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); if (signature != GetMagickSignature((const StringInfo *) NULL)) ThrowReaderException(CacheError,""IncompatibleAPI""); if (image->montage != (char *) NULL) { register char *p; /* Image directory. */ length=MaxTextExtent; image->directory=AcquireString((char *) NULL); p=image->directory; do { *p='\0'; if ((strlen(image->directory)+MaxTextExtent) >= length) { /* Allocate more memory for the image directory. */ length<<=1; image->directory=(char *) ResizeQuantumMemory(image->directory, length+MaxTextExtent,sizeof(*image->directory)); if (image->directory == (char *) NULL) ThrowReaderException(CorruptImageError,""UnableToReadImageData""); p=image->directory+strlen(image->directory); } c=ReadBlobByte(image); *p++=(char) c; } while (c != (int) '\0'); } if (profiles != (LinkedListInfo *) NULL) { const char *name; const StringInfo *profile; register unsigned char *p; /* Read image profiles. */ ResetLinkedListIterator(profiles); name=(const char *) GetNextValueInLinkedList(profiles); while (name != (const char *) NULL) { profile=GetImageProfile(image,name); if (profile != (StringInfo *) NULL) { p=GetStringInfoDatum(profile); (void) ReadBlob(image,GetStringInfoLength(profile),p); } name=(const char *) GetNextValueInLinkedList(profiles); } profiles=DestroyLinkedList(profiles,RelinquishMagickMemory); } depth=GetImageQuantumDepth(image,MagickFalse); if (image->storage_class == PseudoClass) { size_t packet_size; unsigned char *colormap; /* Create image colormap. */ packet_size=(size_t) (3UL*depth/8UL); if ((packet_size*image->colors) > GetBlobSize(image)) ThrowReaderException(CorruptImageError,""InsufficientImageDataInFile""); image->colormap=(PixelPacket *) AcquireQuantumMemory(image->colors+1, sizeof(*image->colormap)); if (image->colormap == (PixelPacket *) NULL) ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); if (image->colors != 0) { /* Read image colormap from file. */ colormap=(unsigned char *) AcquireQuantumMemory(image->colors, packet_size*sizeof(*colormap)); if (colormap == (unsigned char *) NULL) ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); count=ReadBlob(image,packet_size*image->colors,colormap); if (count != (ssize_t) (packet_size*image->colors)) { colormap=(unsigned char *) RelinquishMagickMemory(colormap); ThrowReaderException(CorruptImageError, ""InsufficientImageDataInFile""); } p=colormap; switch (depth) { default: colormap=(unsigned char *) RelinquishMagickMemory(colormap); ThrowReaderException(CorruptImageError, ""ImageDepthNotSupported""); case 8: { unsigned char pixel; for (i=0; i < (ssize_t) image->colors; i++) { p=PushCharPixel(p,&pixel); image->colormap[i].red=ScaleCharToQuantum(pixel); p=PushCharPixel(p,&pixel); image->colormap[i].green=ScaleCharToQuantum(pixel); p=PushCharPixel(p,&pixel); image->colormap[i].blue=ScaleCharToQuantum(pixel); } break; } case 16: { unsigned short pixel; for (i=0; i < (ssize_t) image->colors; i++) { p=PushShortPixel(MSBEndian,p,&pixel); image->colormap[i].red=ScaleShortToQuantum(pixel); p=PushShortPixel(MSBEndian,p,&pixel); image->colormap[i].green=ScaleShortToQuantum(pixel); p=PushShortPixel(MSBEndian,p,&pixel); image->colormap[i].blue=ScaleShortToQuantum(pixel); } break; } case 32: { unsigned int pixel; for (i=0; i < (ssize_t) image->colors; i++) { p=PushLongPixel(MSBEndian,p,&pixel); image->colormap[i].red=ScaleLongToQuantum(pixel); p=PushLongPixel(MSBEndian,p,&pixel); image->colormap[i].green=ScaleLongToQuantum(pixel); p=PushLongPixel(MSBEndian,p,&pixel); image->colormap[i].blue=ScaleLongToQuantum(pixel); } break; } } colormap=(unsigned char *) RelinquishMagickMemory(colormap); } } if (EOFBlob(image) != MagickFalse) { ThrowFileException(exception,CorruptImageError,""UnexpectedEndOfFile"", image->filename); break; } if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0)) if (image->scene >= (image_info->scene+image_info->number_scenes-1)) break; if ((AcquireMagickResource(WidthResource,image->columns) == MagickFalse) || (AcquireMagickResource(HeightResource,image->rows) == MagickFalse)) ThrowReaderException(ImageError,""WidthOrHeightExceedsLimit""); /* Attach persistent pixel cache. */ status=PersistPixelCache(image,cache_filename,MagickTrue,&offset,exception); if (status == MagickFalse) ThrowReaderException(CacheError,""UnableToPersistPixelCache""); /* Proceed to next image. */ do { c=ReadBlobByte(image); } while ((isgraph(c) == MagickFalse) && (c != EOF)); if (c != EOF) { /* Allocate next image structure. */ AcquireNextImage(image_info,image); if (GetNextImageInList(image) == (Image *) NULL) { image=DestroyImageList(image); return((Image *) NULL); } image=SyncNextImageInList(image); status=SetImageProgress(image,LoadImagesTag,TellBlob(image), GetBlobSize(image)); if (status == MagickFalse) break; } } while (c != EOF); (void) CloseBlob(image); return(GetFirstImageInList(image)); } ",0 "struct lruvec *mem_cgroup_lru_move_lists(struct zone *zone, struct page *page, enum lru_list from, enum lru_list to) { /* XXX: Optimize this, especially for @from == @to */ mem_cgroup_lru_del_list(page, from); return mem_cgroup_lru_add_list(zone, page, to); } ",0 "nfs4_async_handle_error(struct rpc_task *task, const struct nfs_server *server, struct nfs4_state *state) { struct nfs_client *clp = server->nfs_client; if (task->tk_status >= 0) return 0; switch(task->tk_status) { case -NFS4ERR_DELEG_REVOKED: case -NFS4ERR_ADMIN_REVOKED: case -NFS4ERR_BAD_STATEID: if (state == NULL) break; nfs_remove_bad_delegation(state->inode); case -NFS4ERR_OPENMODE: if (state == NULL) break; nfs4_schedule_stateid_recovery(server, state); goto wait_on_recovery; case -NFS4ERR_EXPIRED: if (state != NULL) nfs4_schedule_stateid_recovery(server, state); case -NFS4ERR_STALE_STATEID: case -NFS4ERR_STALE_CLIENTID: nfs4_schedule_lease_recovery(clp); goto wait_on_recovery; #if defined(CONFIG_NFS_V4_1) case -NFS4ERR_BADSESSION: case -NFS4ERR_BADSLOT: case -NFS4ERR_BAD_HIGH_SLOT: case -NFS4ERR_DEADSESSION: case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION: case -NFS4ERR_SEQ_FALSE_RETRY: case -NFS4ERR_SEQ_MISORDERED: dprintk(""%s ERROR %d, Reset session\n"", __func__, task->tk_status); nfs4_schedule_session_recovery(clp->cl_session, task->tk_status); task->tk_status = 0; return -EAGAIN; #endif /* CONFIG_NFS_V4_1 */ case -NFS4ERR_DELAY: nfs_inc_server_stats(server, NFSIOS_DELAY); case -NFS4ERR_GRACE: case -EKEYEXPIRED: rpc_delay(task, NFS4_POLL_RETRY_MAX); task->tk_status = 0; return -EAGAIN; case -NFS4ERR_RETRY_UNCACHED_REP: case -NFS4ERR_OLD_STATEID: task->tk_status = 0; return -EAGAIN; } task->tk_status = nfs4_map_errors(task->tk_status); return 0; wait_on_recovery: rpc_sleep_on(&clp->cl_rpcwaitq, task, NULL); if (test_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state) == 0) rpc_wake_up_queued_task(&clp->cl_rpcwaitq, task); task->tk_status = 0; return -EAGAIN; } ",0 "void Browser::ViewSource(TabContentsWrapper* contents, const GURL& url, const std::string& content_state) { UserMetrics::RecordAction(UserMetricsAction(""ViewSource""), profile_); DCHECK(contents); TabContentsWrapper* view_source_contents = contents->Clone(); view_source_contents->controller().PruneAllButActive(); NavigationEntry* active_entry = view_source_contents->controller().GetActiveEntry(); if (!active_entry) return; GURL view_source_url = GURL(chrome::kViewSourceScheme + std::string("":"") + url.spec()); active_entry->set_virtual_url(view_source_url); active_entry->set_content_state( webkit_glue::RemoveScrollOffsetFromHistoryState(content_state)); active_entry->set_title(string16()); if (CanSupportWindowFeature(FEATURE_TABSTRIP)) { int index = tab_handler_->GetTabStripModel()-> GetIndexOfTabContents(contents); int add_types = TabStripModel::ADD_ACTIVE | TabStripModel::ADD_INHERIT_GROUP; tab_handler_->GetTabStripModel()->InsertTabContentsAt(index + 1, view_source_contents, add_types); } else { Browser* browser = Browser::CreateForType(TYPE_NORMAL, profile_); BrowserWindow* new_window = browser->window(); new_window->SetBounds(gfx::Rect(new_window->GetRestoredBounds().origin(), window()->GetRestoredBounds().size())); browser->window()->Show(); browser->AddTab(view_source_contents, PageTransition::LINK); } if (profile_->HasSessionService()) { SessionService* session_service = profile_->GetSessionService(); if (session_service) session_service->TabRestored(&view_source_contents->controller(), false); } } ",0 "Browser::DownloadClosePreventionType Browser::OkToCloseWithInProgressDownloads( int* num_downloads_blocking) const { DCHECK(num_downloads_blocking); *num_downloads_blocking = 0; if (IsAttemptingToCloseBrowser()) return DOWNLOAD_CLOSE_OK; if (!g_browser_process->profile_manager()) return DOWNLOAD_CLOSE_OK; int total_download_count = DownloadService::DownloadCountAllProfiles(); if (total_download_count == 0) return DOWNLOAD_CLOSE_OK; // No downloads; can definitely close. int profile_window_count = 0; int total_window_count = 0; for (BrowserList::const_iterator iter = BrowserList::begin(); iter != BrowserList::end(); ++iter) { Browser* const browser = *iter; if (browser == this || browser->IsAttemptingToCloseBrowser()) continue; if ((*iter)->profile() == profile()) profile_window_count++; total_window_count++; } if (total_window_count == 0) { *num_downloads_blocking = total_download_count; return DOWNLOAD_CLOSE_BROWSER_SHUTDOWN; } DownloadService* download_service = DownloadServiceFactory::GetForProfile(profile()); if (profile_window_count == 0 && download_service->DownloadCount() > 0 && profile()->IsOffTheRecord()) { *num_downloads_blocking = download_service->DownloadCount(); return DOWNLOAD_CLOSE_LAST_WINDOW_IN_INCOGNITO_PROFILE; } return DOWNLOAD_CLOSE_OK; } ",0 "FrameSelection::ComputeVisibleSelectionInDOMTreeDeprecated() const { GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets(); return ComputeVisibleSelectionInDOMTree(); } ",0 "static int aes_set_key(struct crypto_tfm *tfm, const u8 *in_key, unsigned int key_len) { struct aes_ctx *ctx = aes_ctx(tfm); const __le32 *key = (const __le32 *)in_key; u32 *flags = &tfm->crt_flags; struct crypto_aes_ctx gen_aes; int cpu; if (key_len % 8) { *flags |= CRYPTO_TFM_RES_BAD_KEY_LEN; return -EINVAL; } /* * If the hardware is capable of generating the extended key * itself we must supply the plain key for both encryption * and decryption. */ ctx->D = ctx->E; ctx->E[0] = le32_to_cpu(key[0]); ctx->E[1] = le32_to_cpu(key[1]); ctx->E[2] = le32_to_cpu(key[2]); ctx->E[3] = le32_to_cpu(key[3]); /* Prepare control words. */ memset(&ctx->cword, 0, sizeof(ctx->cword)); ctx->cword.decrypt.encdec = 1; ctx->cword.encrypt.rounds = 10 + (key_len - 16) / 4; ctx->cword.decrypt.rounds = ctx->cword.encrypt.rounds; ctx->cword.encrypt.ksize = (key_len - 16) / 8; ctx->cword.decrypt.ksize = ctx->cword.encrypt.ksize; /* Don't generate extended keys if the hardware can do it. */ if (aes_hw_extkey_available(key_len)) goto ok; ctx->D = ctx->d_data; ctx->cword.encrypt.keygen = 1; ctx->cword.decrypt.keygen = 1; if (crypto_aes_expand_key(&gen_aes, in_key, key_len)) { *flags |= CRYPTO_TFM_RES_BAD_KEY_LEN; return -EINVAL; } memcpy(ctx->E, gen_aes.key_enc, AES_MAX_KEYLENGTH); memcpy(ctx->D, gen_aes.key_dec, AES_MAX_KEYLENGTH); ok: for_each_online_cpu(cpu) if (&ctx->cword.encrypt == per_cpu(paes_last_cword, cpu) || &ctx->cword.decrypt == per_cpu(paes_last_cword, cpu)) per_cpu(paes_last_cword, cpu) = NULL; return 0; } ",0 "int mbedtls_ecdsa_verify( mbedtls_ecp_group *grp, const unsigned char *buf, size_t blen, const mbedtls_ecp_point *Q, const mbedtls_mpi *r, const mbedtls_mpi *s) { int ret; mbedtls_mpi e, s_inv, u1, u2; mbedtls_ecp_point R; mbedtls_ecp_point_init( &R ); mbedtls_mpi_init( &e ); mbedtls_mpi_init( &s_inv ); mbedtls_mpi_init( &u1 ); mbedtls_mpi_init( &u2 ); /* Fail cleanly on curves such as Curve25519 that can't be used for ECDSA */ if( grp->N.p == NULL ) return( MBEDTLS_ERR_ECP_BAD_INPUT_DATA ); /* * Step 1: make sure r and s are in range 1..n-1 */ if( mbedtls_mpi_cmp_int( r, 1 ) < 0 || mbedtls_mpi_cmp_mpi( r, &grp->N ) >= 0 || mbedtls_mpi_cmp_int( s, 1 ) < 0 || mbedtls_mpi_cmp_mpi( s, &grp->N ) >= 0 ) { ret = MBEDTLS_ERR_ECP_VERIFY_FAILED; goto cleanup; } /* * Additional precaution: make sure Q is valid */ MBEDTLS_MPI_CHK( mbedtls_ecp_check_pubkey( grp, Q ) ); /* * Step 3: derive MPI from hashed message */ MBEDTLS_MPI_CHK( derive_mpi( grp, &e, buf, blen ) ); /* * Step 4: u1 = e / s mod n, u2 = r / s mod n */ MBEDTLS_MPI_CHK( mbedtls_mpi_inv_mod( &s_inv, s, &grp->N ) ); MBEDTLS_MPI_CHK( mbedtls_mpi_mul_mpi( &u1, &e, &s_inv ) ); MBEDTLS_MPI_CHK( mbedtls_mpi_mod_mpi( &u1, &u1, &grp->N ) ); MBEDTLS_MPI_CHK( mbedtls_mpi_mul_mpi( &u2, r, &s_inv ) ); MBEDTLS_MPI_CHK( mbedtls_mpi_mod_mpi( &u2, &u2, &grp->N ) ); /* * Step 5: R = u1 G + u2 Q * * Since we're not using any secret data, no need to pass a RNG to * mbedtls_ecp_mul() for countermesures. */ MBEDTLS_MPI_CHK( mbedtls_ecp_muladd( grp, &R, &u1, &grp->G, &u2, Q ) ); if( mbedtls_ecp_is_zero( &R ) ) { ret = MBEDTLS_ERR_ECP_VERIFY_FAILED; goto cleanup; } /* * Step 6: convert xR to an integer (no-op) * Step 7: reduce xR mod n (gives v) */ MBEDTLS_MPI_CHK( mbedtls_mpi_mod_mpi( &R.X, &R.X, &grp->N ) ); /* * Step 8: check if v (that is, R.X) is equal to r */ if( mbedtls_mpi_cmp_mpi( &R.X, r ) != 0 ) { ret = MBEDTLS_ERR_ECP_VERIFY_FAILED; goto cleanup; } cleanup: mbedtls_ecp_point_free( &R ); mbedtls_mpi_free( &e ); mbedtls_mpi_free( &s_inv ); mbedtls_mpi_free( &u1 ); mbedtls_mpi_free( &u2 ); return( ret ); } ",0 "is_infinite_or_zerol (long double x) { return isnanl (x) || x + x == x; } ",0 "static void netlink_rcv_wake(struct sock *sk) { struct netlink_sock *nlk = nlk_sk(sk); if (skb_queue_empty(&sk->sk_receive_queue)) clear_bit(NETLINK_S_CONGESTED, &nlk->state); if (!test_bit(NETLINK_S_CONGESTED, &nlk->state)) wake_up_interruptible(&nlk->wait); } ",0 "static int tg3_test_dma(struct tg3 *tp) { dma_addr_t buf_dma; u32 *buf, saved_dma_rwctrl; int ret = 0; buf = dma_alloc_coherent(&tp->pdev->dev, TEST_BUFFER_SIZE, &buf_dma, GFP_KERNEL); if (!buf) { ret = -ENOMEM; goto out_nofree; } tp->dma_rwctrl = ((0x7 << DMA_RWCTRL_PCI_WRITE_CMD_SHIFT) | (0x6 << DMA_RWCTRL_PCI_READ_CMD_SHIFT)); tp->dma_rwctrl = tg3_calc_dma_bndry(tp, tp->dma_rwctrl); if (tg3_flag(tp, 57765_PLUS)) goto out; if (tg3_flag(tp, PCI_EXPRESS)) { /* DMA read watermark not used on PCIE */ tp->dma_rwctrl |= 0x00180000; } else if (!tg3_flag(tp, PCIX_MODE)) { if (tg3_asic_rev(tp) == ASIC_REV_5705 || tg3_asic_rev(tp) == ASIC_REV_5750) tp->dma_rwctrl |= 0x003f0000; else tp->dma_rwctrl |= 0x003f000f; } else { if (tg3_asic_rev(tp) == ASIC_REV_5703 || tg3_asic_rev(tp) == ASIC_REV_5704) { u32 ccval = (tr32(TG3PCI_CLOCK_CTRL) & 0x1f); u32 read_water = 0x7; /* If the 5704 is behind the EPB bridge, we can * do the less restrictive ONE_DMA workaround for * better performance. */ if (tg3_flag(tp, 40BIT_DMA_BUG) && tg3_asic_rev(tp) == ASIC_REV_5704) tp->dma_rwctrl |= 0x8000; else if (ccval == 0x6 || ccval == 0x7) tp->dma_rwctrl |= DMA_RWCTRL_ONE_DMA; if (tg3_asic_rev(tp) == ASIC_REV_5703) read_water = 4; /* Set bit 23 to enable PCIX hw bug fix */ tp->dma_rwctrl |= (read_water << DMA_RWCTRL_READ_WATER_SHIFT) | (0x3 << DMA_RWCTRL_WRITE_WATER_SHIFT) | (1 << 23); } else if (tg3_asic_rev(tp) == ASIC_REV_5780) { /* 5780 always in PCIX mode */ tp->dma_rwctrl |= 0x00144000; } else if (tg3_asic_rev(tp) == ASIC_REV_5714) { /* 5714 always in PCIX mode */ tp->dma_rwctrl |= 0x00148000; } else { tp->dma_rwctrl |= 0x001b000f; } } if (tg3_flag(tp, ONE_DMA_AT_ONCE)) tp->dma_rwctrl |= DMA_RWCTRL_ONE_DMA; if (tg3_asic_rev(tp) == ASIC_REV_5703 || tg3_asic_rev(tp) == ASIC_REV_5704) tp->dma_rwctrl &= 0xfffffff0; if (tg3_asic_rev(tp) == ASIC_REV_5700 || tg3_asic_rev(tp) == ASIC_REV_5701) { /* Remove this if it causes problems for some boards. */ tp->dma_rwctrl |= DMA_RWCTRL_USE_MEM_READ_MULT; /* On 5700/5701 chips, we need to set this bit. * Otherwise the chip will issue cacheline transactions * to streamable DMA memory with not all the byte * enables turned on. This is an error on several * RISC PCI controllers, in particular sparc64. * * On 5703/5704 chips, this bit has been reassigned * a different meaning. In particular, it is used * on those chips to enable a PCI-X workaround. */ tp->dma_rwctrl |= DMA_RWCTRL_ASSERT_ALL_BE; } tw32(TG3PCI_DMA_RW_CTRL, tp->dma_rwctrl); #if 0 /* Unneeded, already done by tg3_get_invariants. */ tg3_switch_clocks(tp); #endif if (tg3_asic_rev(tp) != ASIC_REV_5700 && tg3_asic_rev(tp) != ASIC_REV_5701) goto out; /* It is best to perform DMA test with maximum write burst size * to expose the 5700/5701 write DMA bug. */ saved_dma_rwctrl = tp->dma_rwctrl; tp->dma_rwctrl &= ~DMA_RWCTRL_WRITE_BNDRY_MASK; tw32(TG3PCI_DMA_RW_CTRL, tp->dma_rwctrl); while (1) { u32 *p = buf, i; for (i = 0; i < TEST_BUFFER_SIZE / sizeof(u32); i++) p[i] = i; /* Send the buffer to the chip. */ ret = tg3_do_test_dma(tp, buf, buf_dma, TEST_BUFFER_SIZE, 1); if (ret) { dev_err(&tp->pdev->dev, ""%s: Buffer write failed. err = %d\n"", __func__, ret); break; } #if 0 /* validate data reached card RAM correctly. */ for (i = 0; i < TEST_BUFFER_SIZE / sizeof(u32); i++) { u32 val; tg3_read_mem(tp, 0x2100 + (i*4), &val); if (le32_to_cpu(val) != p[i]) { dev_err(&tp->pdev->dev, ""%s: Buffer corrupted on device! "" ""(%d != %d)\n"", __func__, val, i); /* ret = -ENODEV here? */ } p[i] = 0; } #endif /* Now read it back. */ ret = tg3_do_test_dma(tp, buf, buf_dma, TEST_BUFFER_SIZE, 0); if (ret) { dev_err(&tp->pdev->dev, ""%s: Buffer read failed. "" ""err = %d\n"", __func__, ret); break; } /* Verify it. */ for (i = 0; i < TEST_BUFFER_SIZE / sizeof(u32); i++) { if (p[i] == i) continue; if ((tp->dma_rwctrl & DMA_RWCTRL_WRITE_BNDRY_MASK) != DMA_RWCTRL_WRITE_BNDRY_16) { tp->dma_rwctrl &= ~DMA_RWCTRL_WRITE_BNDRY_MASK; tp->dma_rwctrl |= DMA_RWCTRL_WRITE_BNDRY_16; tw32(TG3PCI_DMA_RW_CTRL, tp->dma_rwctrl); break; } else { dev_err(&tp->pdev->dev, ""%s: Buffer corrupted on read back! "" ""(%d != %d)\n"", __func__, p[i], i); ret = -ENODEV; goto out; } } if (i == (TEST_BUFFER_SIZE / sizeof(u32))) { /* Success. */ ret = 0; break; } } if ((tp->dma_rwctrl & DMA_RWCTRL_WRITE_BNDRY_MASK) != DMA_RWCTRL_WRITE_BNDRY_16) { /* DMA test passed without adjusting DMA boundary, * now look for chipsets that are known to expose the * DMA bug without failing the test. */ if (pci_dev_present(tg3_dma_wait_state_chipsets)) { tp->dma_rwctrl &= ~DMA_RWCTRL_WRITE_BNDRY_MASK; tp->dma_rwctrl |= DMA_RWCTRL_WRITE_BNDRY_16; } else { /* Safe to use the calculated DMA boundary. */ tp->dma_rwctrl = saved_dma_rwctrl; } tw32(TG3PCI_DMA_RW_CTRL, tp->dma_rwctrl); } out: dma_free_coherent(&tp->pdev->dev, TEST_BUFFER_SIZE, buf, buf_dma); out_nofree: return ret; } ",0 "static inline void crash_enable_local_vmclear(int cpu) { } ",0 "ZSTD_adjustCParams_internal(ZSTD_compressionParameters cPar, unsigned long long srcSize, size_t dictSize) { static const U64 minSrcSize = 513; /* (1<<9) + 1 */ static const U64 maxWindowResize = 1ULL << (ZSTD_WINDOWLOG_MAX-1); assert(ZSTD_checkCParams(cPar)==0); if (dictSize && (srcSize+1<2) /* srcSize unknown */ ) srcSize = minSrcSize; /* presumed small when there is a dictionary */ else if (srcSize == 0) srcSize = ZSTD_CONTENTSIZE_UNKNOWN; /* 0 == unknown : presumed large */ /* resize windowLog if input is small enough, to use less memory */ if ( (srcSize < maxWindowResize) && (dictSize < maxWindowResize) ) { U32 const tSize = (U32)(srcSize + dictSize); static U32 const hashSizeMin = 1 << ZSTD_HASHLOG_MIN; U32 const srcLog = (tSize < hashSizeMin) ? ZSTD_HASHLOG_MIN : ZSTD_highbit32(tSize-1) + 1; if (cPar.windowLog > srcLog) cPar.windowLog = srcLog; } if (cPar.hashLog > cPar.windowLog+1) cPar.hashLog = cPar.windowLog+1; { U32 const cycleLog = ZSTD_cycleLog(cPar.chainLog, cPar.strategy); if (cycleLog > cPar.windowLog) cPar.chainLog -= (cycleLog - cPar.windowLog); } if (cPar.windowLog < ZSTD_WINDOWLOG_ABSOLUTEMIN) cPar.windowLog = ZSTD_WINDOWLOG_ABSOLUTEMIN; /* required for frame header */ return cPar; } ",0 "void V8TestObject::TestInterfaceOrLongMethodMethodCallback(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_testInterfaceOrLongMethod""); test_object_v8_internal::TestInterfaceOrLongMethodMethod(info); } ",0 "void GpuChannelHost::MessageFilter::OnChannelError() { DCHECK(parent_->factory_->IsIOThread()); for (ListenerMap::iterator it = listeners_.begin(); it != listeners_.end(); it++) { const GpuListenerInfo& info = it->second; info.loop->PostTask( FROM_HERE, base::Bind(&IPC::Channel::Listener::OnChannelError, info.listener)); } listeners_.clear(); MessageLoop* main_loop = parent_->factory_->GetMainLoop(); main_loop->PostTask(FROM_HERE, base::Bind(&GpuChannelHost::OnChannelError, parent_)); } ",0 "void ChromeClientImpl::ChromeDestroyed() { } ",0 "static int skcipher_recvmsg_sync(struct socket *sock, struct msghdr *msg, int flags) { struct sock *sk = sock->sk; struct alg_sock *ask = alg_sk(sk); struct skcipher_ctx *ctx = ask->private; unsigned bs = crypto_skcipher_blocksize(crypto_skcipher_reqtfm( &ctx->req)); struct skcipher_sg_list *sgl; struct scatterlist *sg; int err = -EAGAIN; int used; long copied = 0; lock_sock(sk); while (msg_data_left(msg)) { sgl = list_first_entry(&ctx->tsgl, struct skcipher_sg_list, list); sg = sgl->sg; while (!sg->length) sg++; if (!ctx->used) { err = skcipher_wait_for_data(sk, flags); if (err) goto unlock; } used = min_t(unsigned long, ctx->used, msg_data_left(msg)); used = af_alg_make_sg(&ctx->rsgl, &msg->msg_iter, used); err = used; if (err < 0) goto unlock; if (ctx->more || used < ctx->used) used -= used % bs; err = -EINVAL; if (!used) goto free; skcipher_request_set_crypt(&ctx->req, sg, ctx->rsgl.sg, used, ctx->iv); err = af_alg_wait_for_completion( ctx->enc ? crypto_skcipher_encrypt(&ctx->req) : crypto_skcipher_decrypt(&ctx->req), &ctx->completion); free: af_alg_free_sg(&ctx->rsgl); if (err) goto unlock; copied += used; skcipher_pull_sgl(sk, used, 1); iov_iter_advance(&msg->msg_iter, used); } err = 0; unlock: skcipher_wmem_wakeup(sk); release_sock(sk); return copied ?: err; } ",0 "static int __init i8042_create_kbd_port(void) { struct serio *serio; struct i8042_port *port = &i8042_ports[I8042_KBD_PORT_NO]; serio = kzalloc(sizeof(struct serio), GFP_KERNEL); if (!serio) return -ENOMEM; serio->id.type = i8042_direct ? SERIO_8042 : SERIO_8042_XL; serio->write = i8042_dumbkbd ? NULL : i8042_kbd_write; serio->start = i8042_start; serio->stop = i8042_stop; serio->close = i8042_port_close; serio->ps2_cmd_mutex = &i8042_mutex; serio->port_data = port; serio->dev.parent = &i8042_platform_device->dev; strlcpy(serio->name, ""i8042 KBD port"", sizeof(serio->name)); strlcpy(serio->phys, I8042_KBD_PHYS_DESC, sizeof(serio->phys)); strlcpy(serio->firmware_id, i8042_kbd_firmware_id, sizeof(serio->firmware_id)); port->serio = serio; port->irq = I8042_KBD_IRQ; return 0; } ",0 "static int ecb_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) { struct blkcipher_walk walk; blkcipher_walk_init(&walk, dst, src, nbytes); return ecb_crypt(desc, &walk, false); } ",0 "GfxColorSpace *GfxColorSpace::parse(Object *csObj) { GfxColorSpace *cs; Object obj1; cs = NULL; if (csObj->isName()) { if (csObj->isName(""DeviceGray"") || csObj->isName(""G"")) { cs = new GfxDeviceGrayColorSpace(); } else if (csObj->isName(""DeviceRGB"") || csObj->isName(""RGB"")) { cs = new GfxDeviceRGBColorSpace(); } else if (csObj->isName(""DeviceCMYK"") || csObj->isName(""CMYK"")) { cs = new GfxDeviceCMYKColorSpace(); } else if (csObj->isName(""Pattern"")) { cs = new GfxPatternColorSpace(NULL); } else { error(-1, ""Bad color space '%s'"", csObj->getName()); } } else if (csObj->isArray()) { csObj->arrayGet(0, &obj1); if (obj1.isName(""DeviceGray"") || obj1.isName(""G"")) { cs = new GfxDeviceGrayColorSpace(); } else if (obj1.isName(""DeviceRGB"") || obj1.isName(""RGB"")) { cs = new GfxDeviceRGBColorSpace(); } else if (obj1.isName(""DeviceCMYK"") || obj1.isName(""CMYK"")) { cs = new GfxDeviceCMYKColorSpace(); } else if (obj1.isName(""CalGray"")) { cs = GfxCalGrayColorSpace::parse(csObj->getArray()); } else if (obj1.isName(""CalRGB"")) { cs = GfxCalRGBColorSpace::parse(csObj->getArray()); } else if (obj1.isName(""Lab"")) { cs = GfxLabColorSpace::parse(csObj->getArray()); } else if (obj1.isName(""ICCBased"")) { cs = GfxICCBasedColorSpace::parse(csObj->getArray()); } else if (obj1.isName(""Indexed"") || obj1.isName(""I"")) { cs = GfxIndexedColorSpace::parse(csObj->getArray()); } else if (obj1.isName(""Separation"")) { cs = GfxSeparationColorSpace::parse(csObj->getArray()); } else if (obj1.isName(""DeviceN"")) { cs = GfxDeviceNColorSpace::parse(csObj->getArray()); } else if (obj1.isName(""Pattern"")) { cs = GfxPatternColorSpace::parse(csObj->getArray()); } else { error(-1, ""Bad color space""); } obj1.free(); } else { error(-1, ""Bad color space - expected name or array""); } return cs; } ",0 " static void ext4_end_io_work(struct work_struct *work) { ext4_io_end_t *io = container_of(work, ext4_io_end_t, work); struct inode *inode = io->inode; int ret = 0; mutex_lock(&inode->i_mutex); ret = ext4_end_io_nolock(io); if (ret >= 0) { if (!list_empty(&io->list)) list_del_init(&io->list); ext4_free_io_end(io); } mutex_unlock(&inode->i_mutex); } ",1 "void RenderFrameHostImpl::OnDidFailLoadWithError( const GURL& url, int error_code, const base::string16& error_description) { TRACE_EVENT2(""navigation"", ""RenderFrameHostImpl::OnDidFailProvisionalLoadWithError"", ""frame_tree_node"", frame_tree_node_->frame_tree_node_id(), ""error"", error_code); GURL validated_url(url); GetProcess()->FilterURL(false, &validated_url); frame_tree_node_->navigator()->DidFailLoadWithError( this, validated_url, error_code, error_description); } ",0 "gs_finit_push_systemdict(i_ctx_t *i_ctx_p) { if (i_ctx_p == NULL) return; if (dsp == dstop ) { if (ref_stack_extend(&d_stack, 1) < 0) { /* zend() cannot fail */ (void)zend(i_ctx_p); } } dsp++; ref_assign(dsp, systemdict); } ",0 "std::string MixedContentTypeToProtocolMixedContentType( blink::WebMixedContentContextType mixed_content_type) { switch (mixed_content_type) { case blink::WebMixedContentContextType::kNotMixedContent: return Security::MixedContentTypeEnum::None; case blink::WebMixedContentContextType::kBlockable: return Security::MixedContentTypeEnum::Blockable; case blink::WebMixedContentContextType::kOptionallyBlockable: return Security::MixedContentTypeEnum::OptionallyBlockable; case blink::WebMixedContentContextType::kShouldBeBlockable: NOTREACHED(); return Security::MixedContentTypeEnum::OptionallyBlockable; default: NOTREACHED(); return Security::MixedContentTypeEnum::None; } } ",0 "void LocalDOMWindow::scrollBy(const ScrollToOptions& scroll_to_options) const { if (!IsCurrentlyDisplayedInFrame()) return; document()->UpdateStyleAndLayoutIgnorePendingStylesheets(); LocalFrameView* view = GetFrame()->View(); if (!view) return; Page* page = GetFrame()->GetPage(); if (!page) return; if (GetFrame()->Loader().GetDocumentLoader()) { GetFrame() ->Loader() .GetDocumentLoader() ->GetInitialScrollState() .was_scrolled_by_js = true; } double x = 0.0; double y = 0.0; if (scroll_to_options.hasLeft()) x = ScrollableArea::NormalizeNonFiniteScroll(scroll_to_options.left()); if (scroll_to_options.hasTop()) y = ScrollableArea::NormalizeNonFiniteScroll(scroll_to_options.top()); ScrollableArea* viewport = view->LayoutViewportScrollableArea(); ScrollOffset current_offset = viewport->GetScrollOffset(); ScrollOffset scaled_delta(x * GetFrame()->PageZoomFactor(), y * GetFrame()->PageZoomFactor()); FloatPoint new_scaled_position = ScrollOffsetToPosition( scaled_delta + current_offset, viewport->ScrollOrigin()); if (SnapCoordinator* coordinator = document()->GetSnapCoordinator()) { new_scaled_position = coordinator->GetSnapPositionForPoint( *document()->GetLayoutView(), new_scaled_position, scroll_to_options.hasLeft(), scroll_to_options.hasTop()); } ScrollBehavior scroll_behavior = kScrollBehaviorAuto; ScrollableArea::ScrollBehaviorFromString(scroll_to_options.behavior(), scroll_behavior); viewport->SetScrollOffset( ScrollPositionToOffset(new_scaled_position, viewport->ScrollOrigin()), kProgrammaticScroll, scroll_behavior); } ",0 "void Browser::OpenClearBrowsingDataDialog() { UserMetrics::RecordAction(UserMetricsAction(""ClearBrowsingData_ShowDlg""), profile_); if (!CommandLine::ForCurrentProcess()->HasSwitch( switches::kDisableTabbedOptions)) { ShowOptionsTab( chrome::kAdvancedOptionsSubPage + std::string(kHashMark) + chrome::kClearBrowserDataSubPage); } else { window_->ShowClearBrowsingDataDialog(); } } ",0 "void inc_nlink(struct inode *inode) { if (unlikely(inode->i_nlink == 0)) { WARN_ON(!(inode->i_state & I_LINKABLE)); atomic_long_dec(&inode->i_sb->s_remove_count); } inode->__i_nlink++; } ",0 "LUALIB_API int luaopen_cmsgpack(lua_State *L) { luaopen_create(L); #if LUA_VERSION_NUM < 502 /* Register name globally for 5.1 */ lua_pushvalue(L, -1); lua_setglobal(L, LUACMSGPACK_NAME); #endif return 1; } ",0 "void __init ipfrag_init(void) { ip4_frags_ctl_register(); register_pernet_subsys(&ip4_frags_ops); ip4_frags.hashfn = ip4_hashfn; ip4_frags.constructor = ip4_frag_init; ip4_frags.destructor = ip4_frag_free; ip4_frags.skb_free = NULL; ip4_frags.qsize = sizeof(struct ipq); ip4_frags.match = ip4_frag_match; ip4_frags.frag_expire = ip_expire; ip4_frags.secret_interval = 10 * 60 * HZ; inet_frags_init(&ip4_frags); } ",0 "void LayerTilerChromium::setTileSize(const IntSize& size) { if (m_tileSize == size) return; reset(); m_tileSize = size; m_tilePixels = adoptArrayPtr(new uint8_t[m_tileSize.width() * m_tileSize.height() * 4]); } ",0 "void videobuf_queue_vmalloc_init(struct videobuf_queue* q, struct videobuf_queue_ops *ops, void *dev, spinlock_t *irqlock, enum v4l2_buf_type type, enum v4l2_field field, unsigned int msize, void *priv) { videobuf_queue_core_init(q, ops, dev, irqlock, type, field, msize, priv, &qops); } ",0 "static int tls_prf_sha384( unsigned char *secret, size_t slen, char *label, unsigned char *random, size_t rlen, unsigned char *dstbuf, size_t dlen ) { size_t nb; size_t i, j, k; unsigned char tmp[128]; unsigned char h_i[48]; if( sizeof( tmp ) < 48 + strlen( label ) + rlen ) return( POLARSSL_ERR_SSL_BAD_INPUT_DATA ); nb = strlen( label ); memcpy( tmp + 48, label, nb ); memcpy( tmp + 48 + nb, random, rlen ); nb += rlen; /* * Compute P_(secret, label + random)[0..dlen] */ sha4_hmac( secret, slen, tmp + 48, nb, tmp, 1 ); for( i = 0; i < dlen; i += 48 ) { sha4_hmac( secret, slen, tmp, 48 + nb, h_i, 1 ); sha4_hmac( secret, slen, tmp, 48, tmp, 1 ); k = ( i + 48 > dlen ) ? dlen % 48 : 48; for( j = 0; j < k; j++ ) dstbuf[i + j] = h_i[j]; } memset( tmp, 0, sizeof( tmp ) ); memset( h_i, 0, sizeof( h_i ) ); return( 0 ); } ",0 "LockContentsView::~LockContentsView() { Shell::Get()->accelerator_controller()->UnregisterAll(this); data_dispatcher_->RemoveObserver(this); Shell::Get()->login_screen_controller()->RemoveObserver(this); keyboard::KeyboardController::Get()->RemoveObserver(this); Shell::Get()->system_tray_notifier()->RemoveSystemTrayFocusObserver(this); if (unlock_attempt_ > 0) { Shell::Get()->metrics()->login_metrics_recorder()->RecordNumLoginAttempts( unlock_attempt_, false /*success*/); } chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver( this); } ",0 "bool PDFiumEngineExports::GetPDFPageSizeByIndex( const void* pdf_buffer, int pdf_buffer_size, int page_number, double* width, double* height) { FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr); if (!doc) return false; bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; FPDF_CloseDocument(doc); return success; } ",0 "bool EditorClientBlackBerry::isGrammarCheckingEnabled() { notImplemented(); return false; } ",0 "static void send_auth(char *username, char *password) { struct mt_packet data; unsigned short width = 0; unsigned short height = 0; char *terminal = getenv(""TERM""); char md5data[100]; unsigned char md5sum[17]; int plen; md5_state_t state; #if defined(__linux__) && defined(_POSIX_MEMLOCK_RANGE) mlock(md5data, sizeof(md5data)); mlock(md5sum, sizeof(md5data)); #endif /* Concat string of 0 + password + pass_salt */ md5data[0] = 0; strncpy(md5data + 1, password, 82); md5data[83] = '\0'; memcpy(md5data + 1 + strlen(password), pass_salt, 16); /* Generate md5 sum of md5data with a leading 0 */ md5_init(&state); md5_append(&state, (const md5_byte_t *)md5data, strlen(password) + 17); md5_finish(&state, (md5_byte_t *)md5sum + 1); md5sum[0] = 0; /* Send combined packet to server */ init_packet(&data, MT_PTYPE_DATA, srcmac, dstmac, sessionkey, outcounter); plen = add_control_packet(&data, MT_CPTYPE_PASSWORD, md5sum, 17); plen += add_control_packet(&data, MT_CPTYPE_USERNAME, username, strlen(username)); plen += add_control_packet(&data, MT_CPTYPE_TERM_TYPE, terminal, strlen(terminal)); if (is_a_tty && get_terminal_size(&width, &height) != -1) { width = htole16(width); height = htole16(height); plen += add_control_packet(&data, MT_CPTYPE_TERM_WIDTH, &width, 2); plen += add_control_packet(&data, MT_CPTYPE_TERM_HEIGHT, &height, 2); } outcounter += plen; /* TODO: handle result */ send_udp(&data, 1); } ",1 "static void overloadedMethodBMethod(const v8::FunctionCallbackInfo& info) { if (((info.Length() == 1))) { overloadedMethodB1Method(info); return; } if (((info.Length() == 1) && (isUndefinedOrNull(info[0]) || info[0]->IsString() || info[0]->IsObject()))) { overloadedMethodB2Method(info); return; } ExceptionState exceptionState(ExceptionState::ExecutionContext, ""overloadedMethodB"", ""TestObject"", info.Holder(), info.GetIsolate()); if (UNLIKELY(info.Length() < 1)) { exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length())); exceptionState.throwIfNeeded(); return; } exceptionState.throwTypeError(""No function was found that matched the signature provided.""); exceptionState.throwIfNeeded(); } ",0 "int ratestrtosize(char *s, uint_fast32_t rawsize, uint_fast32_t *size) { jpc_flt_t f; /* Note: This function must not modify output size on failure. */ if (strchr(s, 'B')) { *size = atoi(s); } else { f = atof(s); if (f < 0) { *size = 0; } else if (f > 1.0) { *size = rawsize + 1; } else { *size = f * rawsize; } } return 0; } ",0 "static void efx_tso_put_header(struct efx_tx_queue *tx_queue, struct efx_tso_header *tsoh, unsigned len) { struct efx_tx_buffer *buffer; buffer = &tx_queue->buffer[tx_queue->insert_count & tx_queue->ptr_mask]; efx_tsoh_free(tx_queue, buffer); EFX_BUG_ON_PARANOID(buffer->len); EFX_BUG_ON_PARANOID(buffer->unmap_len); EFX_BUG_ON_PARANOID(buffer->skb); EFX_BUG_ON_PARANOID(!buffer->continuation); EFX_BUG_ON_PARANOID(buffer->tsoh); buffer->len = len; buffer->dma_addr = tsoh->dma_addr; buffer->tsoh = tsoh; ++tx_queue->insert_count; } ",0 "bool FormIsHTTPS(FormStructure* form) { return form->ConvertToFormData().origin.SchemeIs(chrome::kHttpsScheme); } ",0 "static void set_pixel_format(VncState *vs, int bits_per_pixel, int depth, int big_endian_flag, int true_color_flag, int red_max, int green_max, int blue_max, int red_shift, int green_shift, int blue_shift) { if (!true_color_flag) { vnc_client_error(vs); return; } vs->client_pf.rmax = red_max; vs->client_pf.rbits = hweight_long(red_max); vs->client_pf.rshift = red_shift; vs->client_pf.bytes_per_pixel = bits_per_pixel / 8; vs->client_pf.depth = bits_per_pixel == 32 ? 24 : bits_per_pixel; vs->client_be = big_endian_flag; set_pixel_conversion(vs); graphic_hw_invalidate(NULL); graphic_hw_update(NULL); } ",1 "static int __mkroute_input(struct sk_buff *skb, const struct fib_result *res, struct in_device *in_dev, __be32 daddr, __be32 saddr, u32 tos) { struct fib_nh_exception *fnhe; struct rtable *rth; int err; struct in_device *out_dev; unsigned int flags = 0; bool do_cache; u32 itag = 0; /* get a working reference to the output device */ out_dev = __in_dev_get_rcu(FIB_RES_DEV(*res)); if (out_dev == NULL) { net_crit_ratelimited(""Bug in ip_route_input_slow(). Please report.\n""); return -EINVAL; } err = fib_validate_source(skb, saddr, daddr, tos, FIB_RES_OIF(*res), in_dev->dev, in_dev, &itag); if (err < 0) { ip_handle_martian_source(in_dev->dev, in_dev, skb, daddr, saddr); goto cleanup; } do_cache = res->fi && !itag; if (out_dev == in_dev && err && IN_DEV_TX_REDIRECTS(out_dev) && skb->protocol == htons(ETH_P_IP) && (IN_DEV_SHARED_MEDIA(out_dev) || inet_addr_onlink(out_dev, saddr, FIB_RES_GW(*res)))) IPCB(skb)->flags |= IPSKB_DOREDIRECT; if (skb->protocol != htons(ETH_P_IP)) { /* Not IP (i.e. ARP). Do not create route, if it is * invalid for proxy arp. DNAT routes are always valid. * * Proxy arp feature have been extended to allow, ARP * replies back to the same interface, to support * Private VLAN switch technologies. See arp.c. */ if (out_dev == in_dev && IN_DEV_PROXY_ARP_PVLAN(in_dev) == 0) { err = -EINVAL; goto cleanup; } } fnhe = find_exception(&FIB_RES_NH(*res), daddr); if (do_cache) { if (fnhe != NULL) rth = rcu_dereference(fnhe->fnhe_rth_input); else rth = rcu_dereference(FIB_RES_NH(*res).nh_rth_input); if (rt_cache_valid(rth)) { skb_dst_set_noref(skb, &rth->dst); goto out; } } rth = rt_dst_alloc(out_dev->dev, IN_DEV_CONF_GET(in_dev, NOPOLICY), IN_DEV_CONF_GET(out_dev, NOXFRM), do_cache); if (!rth) { err = -ENOBUFS; goto cleanup; } rth->rt_genid = rt_genid_ipv4(dev_net(rth->dst.dev)); rth->rt_flags = flags; rth->rt_type = res->type; rth->rt_is_input = 1; rth->rt_iif = 0; rth->rt_pmtu = 0; rth->rt_gateway = 0; rth->rt_uses_gateway = 0; INIT_LIST_HEAD(&rth->rt_uncached); RT_CACHE_STAT_INC(in_slow_tot); rth->dst.input = ip_forward; rth->dst.output = ip_output; rt_set_nexthop(rth, daddr, res, fnhe, res->fi, res->type, itag); skb_dst_set(skb, &rth->dst); out: err = 0; cleanup: return err; } ",0 "static struct dm_io *alloc_io(struct mapped_device *md) { return mempool_alloc(md->io_pool, GFP_NOIO); } ",0 "void __udp4_lib_err(struct sk_buff *skb, u32 info, struct udp_table *udptable) { struct inet_sock *inet; const struct iphdr *iph = (const struct iphdr *)skb->data; struct udphdr *uh = (struct udphdr *)(skb->data+(iph->ihl<<2)); const int type = icmp_hdr(skb)->type; const int code = icmp_hdr(skb)->code; struct sock *sk; int harderr; int err; struct net *net = dev_net(skb->dev); sk = __udp4_lib_lookup(net, iph->daddr, uh->dest, iph->saddr, uh->source, skb->dev->ifindex, udptable); if (sk == NULL) { ICMP_INC_STATS_BH(net, ICMP_MIB_INERRORS); return; /* No socket for error */ } err = 0; harderr = 0; inet = inet_sk(sk); switch (type) { default: case ICMP_TIME_EXCEEDED: err = EHOSTUNREACH; break; case ICMP_SOURCE_QUENCH: goto out; case ICMP_PARAMETERPROB: err = EPROTO; harderr = 1; break; case ICMP_DEST_UNREACH: if (code == ICMP_FRAG_NEEDED) { /* Path MTU discovery */ ipv4_sk_update_pmtu(skb, sk, info); if (inet->pmtudisc != IP_PMTUDISC_DONT) { err = EMSGSIZE; harderr = 1; break; } goto out; } err = EHOSTUNREACH; if (code <= NR_ICMP_UNREACH) { harderr = icmp_err_convert[code].fatal; err = icmp_err_convert[code].errno; } break; case ICMP_REDIRECT: ipv4_sk_redirect(skb, sk); break; } /* * RFC1122: OK. Passes ICMP errors back to application, as per * 4.1.3.3. */ if (!inet->recverr) { if (!harderr || sk->sk_state != TCP_ESTABLISHED) goto out; } else ip_icmp_error(sk, skb, err, uh->dest, info, (u8 *)(uh+1)); sk->sk_err = err; sk->sk_error_report(sk); out: sock_put(sk); } ",0 "zlib_reset(struct zlib *zlib, int window_bits) /* Reinitializes a zlib with a different window_bits */ { assert(zlib->state >= 0); /* initialized by zlib_init */ zlib->z.next_in = Z_NULL; zlib->z.avail_in = 0; zlib->z.next_out = Z_NULL; zlib->z.avail_out = 0; zlib->window_bits = window_bits; zlib->compressed_digits = 0; zlib->uncompressed_digits = 0; zlib->state = 0; /* initialized, once */ zlib->rc = inflateReset2(&zlib->z, 0); if (zlib->rc != Z_OK) { zlib_message(zlib, 1/*unexpected*/); return 0; } return 1; } ",0 "la_strsep(char **sp, const char *sep) { char *p, *s; if (sp == NULL || *sp == NULL || **sp == '\0') return(NULL); s = *sp; p = s + strcspn(s, sep); if (*p != '\0') *p++ = '\0'; *sp = p; return(s); } ",0 " NotificationInfo() : total_count(0) {} ",0 "int RenderViewImpl::GetPageId() { return page_id_; } ",0 "static void sanitize_dimension(zval *zv TSRMLS_DC) { zval *arr = NULL, *tmp = NULL, **cur = NULL; char *var = NULL, *ptr = Z_STRVAL_P(zv), *end = Z_STRVAL_P(zv) + Z_STRLEN_P(zv); long level = 0; MAKE_STD_ZVAL(arr); array_init(arr); cur = &arr; while (ptr < end) { if (!var) { var = ptr; } switch (*ptr) { case '[': if (++level > PG(max_input_nesting_level)) { zval_ptr_dtor(&arr); php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Max input nesting level of %ld exceeded"", (long) PG(max_input_nesting_level)); return; } if (ptr - var == 0) { ++var; break; } /* no break */ case ']': MAKE_STD_ZVAL(tmp); ZVAL_NULL(tmp); convert_to_array(*cur); if (ptr - var) { char chr = *ptr; *ptr = '\0'; zend_symtable_update(Z_ARRVAL_PP(cur), var, ptr - var + 1, (void *) &tmp, sizeof(zval *), (void *) &cur); *ptr = chr; } else { zend_hash_next_index_insert(Z_ARRVAL_PP(cur), (void *) &tmp, sizeof(zval *), (void *) &cur); } var = NULL; break; } ++ptr; } if (zend_hash_num_elements(Z_ARRVAL_P(arr))) { zval_dtor(zv); #if PHP_VERSION_ID >= 50400 ZVAL_COPY_VALUE(zv, arr); #else zv->value = arr->value; Z_TYPE_P(zv) = Z_TYPE_P(arr); #endif FREE_ZVAL(arr); } else { zval_ptr_dtor(&arr); } } ",0 "static int store_instr(int instr_no, struct sbi_instrument *instr) { if (instr->key != FM_PATCH && (instr->key != OPL3_PATCH || devc->model != 2)) printk(KERN_WARNING ""FM warning: Invalid patch format field (key) 0x%x\n"", instr->key); memcpy((char *) &(devc->i_map[instr_no]), (char *) instr, sizeof(*instr)); return 0; } ",0 "static inline u64 virt_ticks(struct task_struct *p) { u64 utime, stime; task_cputime(p, &utime, &stime); return utime; } ",0 "BOOL update_read_suppress_output(rdpUpdate* update, wStream* s) { BYTE allowDisplayUpdates; if (Stream_GetRemainingLength(s) < 4) return FALSE; Stream_Read_UINT8(s, allowDisplayUpdates); Stream_Seek(s, 3); /* pad3Octects */ if (allowDisplayUpdates > 0 && Stream_GetRemainingLength(s) < 8) return FALSE; if (update->context->settings->SuppressOutput) IFCALL(update->SuppressOutput, update->context, allowDisplayUpdates, allowDisplayUpdates > 0 ? (RECTANGLE_16*) Stream_Pointer(s) : NULL); else WLog_Print(update->log, WLOG_WARN, ""ignoring suppress output request from client""); return TRUE; } ",0 "void OverrideUIString(uint32_t hash, const base::string16& string) { int resource_id = GetResourceIndex(hash); if (resource_id == -1) return; ui::ResourceBundle::GetSharedInstance().OverrideLocaleStringResource( resource_id, string); } ",0 "int ffs_name_dev(struct ffs_dev *dev, const char *name) { int ret; ffs_dev_lock(); ret = _ffs_name_dev(dev, name); ffs_dev_unlock(); return ret; } ",0 "CSSStyleSheet::CSSStyleSheet(Node* parentNode, const String& href, const KURL& baseURL, const String& charset) : StyleSheet(parentNode, href, baseURL) , m_doc(parentNode->document()) , m_namespaces(0) , m_charset(charset) , m_loadCompleted(false) , m_strictParsing(false) , m_isUserStyleSheet(false) , m_hasSyntacticallyValidCSSHeader(true) { } ",0 "static char *get_cpuset(const char *cg) { char *answer; if (!cgfs_get_value(""cpuset"", cg, ""cpuset.cpus"", &answer)) return NULL; return answer; } ",0 "XML_GetIdAttributeIndex(XML_Parser parser) { if (parser == NULL) return -1; return parser->m_idAttIndex; } ",0 "void RenderViewImpl::LoadNavigationErrorPage( WebFrame* frame, const WebURLRequest& failed_request, const WebURLError& error, const std::string& html, bool replace) { std::string alt_html; const std::string* error_html; if (!html.empty()) { error_html = &html; } else { GetContentClient()->renderer()->GetNavigationErrorStrings( failed_request, error, &alt_html, NULL); error_html = &alt_html; } frame->loadHTMLString(*error_html, GURL(kUnreachableWebDataURL), error.unreachableURL, replace); } ",0 "static void CMSExceptionHandler(cmsContext context,cmsUInt32Number severity, const char *message) { CMSExceptionInfo *cms_exception; ExceptionInfo *exception; Image *image; cms_exception=(CMSExceptionInfo *) context; if (cms_exception == (CMSExceptionInfo *) NULL) return; exception=cms_exception->exception; if (exception == (ExceptionInfo *) NULL) return; image=cms_exception->image; if (image == (Image *) NULL) { (void) ThrowMagickException(exception,GetMagickModule(),ImageWarning, ""UnableToTransformColorspace"",""`%s'"",""unknown context""); return; } if (image->debug != MagickFalse) (void) LogMagickEvent(TransformEvent,GetMagickModule(),""lcms: #%u, %s"", severity,message != (char *) NULL ? message : ""no message""); (void) ThrowMagickException(exception,GetMagickModule(),ImageWarning, ""UnableToTransformColorspace"",""`%s'"",image->filename); } ",0 "long long AudioTrack::GetChannels() const { return m_channels; } ",0 "void AutofillDialogViews::SectionContainer::OnGestureEvent( ui::GestureEvent* event) { if (!ShouldForwardEvent(*event)) return; proxy_button_->OnGestureEvent(event); } ",0 "xfs_attr_set( struct xfs_inode *dp, const unsigned char *name, unsigned char *value, int valuelen, int flags) { struct xfs_mount *mp = dp->i_mount; struct xfs_buf *leaf_bp = NULL; struct xfs_da_args args; struct xfs_defer_ops dfops; struct xfs_trans_res tres; xfs_fsblock_t firstblock; int rsvd = (flags & ATTR_ROOT) != 0; int error, err2, local; XFS_STATS_INC(mp, xs_attr_set); if (XFS_FORCED_SHUTDOWN(dp->i_mount)) return -EIO; error = xfs_attr_args_init(&args, dp, name, flags); if (error) return error; args.value = value; args.valuelen = valuelen; args.firstblock = &firstblock; args.dfops = &dfops; args.op_flags = XFS_DA_OP_ADDNAME | XFS_DA_OP_OKNOENT; args.total = xfs_attr_calc_size(&args, &local); error = xfs_qm_dqattach(dp, 0); if (error) return error; /* * If the inode doesn't have an attribute fork, add one. * (inode must not be locked when we call this routine) */ if (XFS_IFORK_Q(dp) == 0) { int sf_size = sizeof(xfs_attr_sf_hdr_t) + XFS_ATTR_SF_ENTSIZE_BYNAME(args.namelen, valuelen); error = xfs_bmap_add_attrfork(dp, sf_size, rsvd); if (error) return error; } tres.tr_logres = M_RES(mp)->tr_attrsetm.tr_logres + M_RES(mp)->tr_attrsetrt.tr_logres * args.total; tres.tr_logcount = XFS_ATTRSET_LOG_COUNT; tres.tr_logflags = XFS_TRANS_PERM_LOG_RES; /* * Root fork attributes can use reserved data blocks for this * operation if necessary */ error = xfs_trans_alloc(mp, &tres, args.total, 0, rsvd ? XFS_TRANS_RESERVE : 0, &args.trans); if (error) return error; xfs_ilock(dp, XFS_ILOCK_EXCL); error = xfs_trans_reserve_quota_nblks(args.trans, dp, args.total, 0, rsvd ? XFS_QMOPT_RES_REGBLKS | XFS_QMOPT_FORCE_RES : XFS_QMOPT_RES_REGBLKS); if (error) { xfs_iunlock(dp, XFS_ILOCK_EXCL); xfs_trans_cancel(args.trans); return error; } xfs_trans_ijoin(args.trans, dp, 0); /* * If the attribute list is non-existent or a shortform list, * upgrade it to a single-leaf-block attribute list. */ if (dp->i_d.di_aformat == XFS_DINODE_FMT_LOCAL || (dp->i_d.di_aformat == XFS_DINODE_FMT_EXTENTS && dp->i_d.di_anextents == 0)) { /* * Build initial attribute list (if required). */ if (dp->i_d.di_aformat == XFS_DINODE_FMT_EXTENTS) xfs_attr_shortform_create(&args); /* * Try to add the attr to the attribute list in * the inode. */ error = xfs_attr_shortform_addname(&args); if (error != -ENOSPC) { /* * Commit the shortform mods, and we're done. * NOTE: this is also the error path (EEXIST, etc). */ ASSERT(args.trans != NULL); /* * If this is a synchronous mount, make sure that * the transaction goes to disk before returning * to the user. */ if (mp->m_flags & XFS_MOUNT_WSYNC) xfs_trans_set_sync(args.trans); if (!error && (flags & ATTR_KERNOTIME) == 0) { xfs_trans_ichgtime(args.trans, dp, XFS_ICHGTIME_CHG); } err2 = xfs_trans_commit(args.trans); xfs_iunlock(dp, XFS_ILOCK_EXCL); return error ? error : err2; } /* * It won't fit in the shortform, transform to a leaf block. * GROT: another possible req'mt for a double-split btree op. */ xfs_defer_init(args.dfops, args.firstblock); error = xfs_attr_shortform_to_leaf(&args, &leaf_bp); if (error) goto out_defer_cancel; /* * Prevent the leaf buffer from being unlocked so that a * concurrent AIL push cannot grab the half-baked leaf * buffer and run into problems with the write verifier. */ xfs_trans_bhold(args.trans, leaf_bp); xfs_defer_bjoin(args.dfops, leaf_bp); xfs_defer_ijoin(args.dfops, dp); error = xfs_defer_finish(&args.trans, args.dfops); if (error) goto out_defer_cancel; /* * Commit the leaf transformation. We'll need another (linked) * transaction to add the new attribute to the leaf, which * means that we have to hold & join the leaf buffer here too. */ error = xfs_trans_roll_inode(&args.trans, dp); if (error) goto out; xfs_trans_bjoin(args.trans, leaf_bp); leaf_bp = NULL; } if (xfs_bmap_one_block(dp, XFS_ATTR_FORK)) error = xfs_attr_leaf_addname(&args); else error = xfs_attr_node_addname(&args); if (error) goto out; /* * If this is a synchronous mount, make sure that the * transaction goes to disk before returning to the user. */ if (mp->m_flags & XFS_MOUNT_WSYNC) xfs_trans_set_sync(args.trans); if ((flags & ATTR_KERNOTIME) == 0) xfs_trans_ichgtime(args.trans, dp, XFS_ICHGTIME_CHG); /* * Commit the last in the sequence of transactions. */ xfs_trans_log_inode(args.trans, dp, XFS_ILOG_CORE); error = xfs_trans_commit(args.trans); xfs_iunlock(dp, XFS_ILOCK_EXCL); return error; out_defer_cancel: xfs_defer_cancel(&dfops); out: if (leaf_bp) xfs_trans_brelse(args.trans, leaf_bp); if (args.trans) xfs_trans_cancel(args.trans); xfs_iunlock(dp, XFS_ILOCK_EXCL); return error; } ",0 "inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value) { if ((ctxt == NULL) || (value == NULL)) return(-1); if (ctxt->inputNr >= ctxt->inputMax) { ctxt->inputMax *= 2; ctxt->inputTab = (xmlParserInputPtr *) xmlRealloc(ctxt->inputTab, ctxt->inputMax * sizeof(ctxt->inputTab[0])); if (ctxt->inputTab == NULL) { xmlErrMemory(ctxt, NULL); xmlFreeInputStream(value); ctxt->inputMax /= 2; value = NULL; return (-1); } } ctxt->inputTab[ctxt->inputNr] = value; ctxt->input = value; return (ctxt->inputNr++); } ",0 "void QQuickWebView::goForward() { Q_D(QQuickWebView); d->webPageProxy->goForward(); } ",0 "void GLES2DecoderImpl::DoSwapInterval(int interval) { context_->SetSwapInterval(interval); } ",0 "ofputil_encode_group_stats_request(enum ofp_version ofp_version, uint32_t group_id) { struct ofpbuf *request; switch (ofp_version) { case OFP10_VERSION: ovs_fatal(0, ""dump-group-stats needs OpenFlow 1.1 or later "" ""(\'-O OpenFlow11\')""); case OFP11_VERSION: case OFP12_VERSION: case OFP13_VERSION: case OFP14_VERSION: case OFP15_VERSION: case OFP16_VERSION: { struct ofp11_group_stats_request *req; request = ofpraw_alloc(OFPRAW_OFPST11_GROUP_REQUEST, ofp_version, 0); req = ofpbuf_put_zeros(request, sizeof *req); req->group_id = htonl(group_id); break; } default: OVS_NOT_REACHED(); } return request; } ",0 "static int __init user_debug_setup(char *str) { get_option(&str, &user_debug); return 1; } ",0 "static int handle_apic_write(struct kvm_vcpu *vcpu) { unsigned long exit_qualification = vmcs_readl(EXIT_QUALIFICATION); u32 offset = exit_qualification & 0xfff; /* APIC-write VM exit is trap-like and thus no need to adjust IP */ kvm_apic_write_nodecode(vcpu, offset); return 1; } ",0 "PassRefPtr Document::getItems(const String& typeNames) { String localTypeNames = typeNames.isNull() ? MicroDataItemList::undefinedItemType() : typeNames; return ensureRareData()->ensureNodeLists()->addCacheWithName(this, MicroDataItemListType, localTypeNames); } ",0 "int ecryptfs_read_and_validate_header_region(struct inode *inode) { u8 file_size[ECRYPTFS_SIZE_AND_MARKER_BYTES]; u8 *marker = file_size + ECRYPTFS_FILE_SIZE_BYTES; int rc; rc = ecryptfs_read_lower(file_size, 0, ECRYPTFS_SIZE_AND_MARKER_BYTES, inode); if (rc < ECRYPTFS_SIZE_AND_MARKER_BYTES) return rc >= 0 ? -EINVAL : rc; rc = ecryptfs_validate_marker(marker); if (!rc) ecryptfs_i_size_init(file_size, inode); return rc; } ",0 "static int nl80211_addset_beacon(struct sk_buff *skb, struct genl_info *info) { int (*call)(struct wiphy *wiphy, struct net_device *dev, struct beacon_parameters *info); struct cfg80211_registered_device *rdev = info->user_ptr[0]; struct net_device *dev = info->user_ptr[1]; struct wireless_dev *wdev = dev->ieee80211_ptr; struct beacon_parameters params; int haveinfo = 0, err; if (!is_valid_ie_attr(info->attrs[NL80211_ATTR_BEACON_TAIL])) return -EINVAL; if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) return -EOPNOTSUPP; memset(¶ms, 0, sizeof(params)); switch (info->genlhdr->cmd) { case NL80211_CMD_NEW_BEACON: /* these are required for NEW_BEACON */ if (!info->attrs[NL80211_ATTR_BEACON_INTERVAL] || !info->attrs[NL80211_ATTR_DTIM_PERIOD] || !info->attrs[NL80211_ATTR_BEACON_HEAD]) return -EINVAL; params.interval = nla_get_u32(info->attrs[NL80211_ATTR_BEACON_INTERVAL]); params.dtim_period = nla_get_u32(info->attrs[NL80211_ATTR_DTIM_PERIOD]); err = cfg80211_validate_beacon_int(rdev, params.interval); if (err) return err; call = rdev->ops->add_beacon; break; case NL80211_CMD_SET_BEACON: call = rdev->ops->set_beacon; break; default: WARN_ON(1); return -EOPNOTSUPP; } if (!call) return -EOPNOTSUPP; if (info->attrs[NL80211_ATTR_BEACON_HEAD]) { params.head = nla_data(info->attrs[NL80211_ATTR_BEACON_HEAD]); params.head_len = nla_len(info->attrs[NL80211_ATTR_BEACON_HEAD]); haveinfo = 1; } if (info->attrs[NL80211_ATTR_BEACON_TAIL]) { params.tail = nla_data(info->attrs[NL80211_ATTR_BEACON_TAIL]); params.tail_len = nla_len(info->attrs[NL80211_ATTR_BEACON_TAIL]); haveinfo = 1; } if (!haveinfo) return -EINVAL; err = call(&rdev->wiphy, dev, ¶ms); if (!err && params.interval) wdev->beacon_interval = params.interval; return err; } ",0 "static bool ipip6_valid_ip_proto(u8 ipproto) { return ipproto == IPPROTO_IPV6 || ipproto == IPPROTO_IPIP || #if IS_ENABLED(CONFIG_MPLS) ipproto == IPPROTO_MPLS || #endif ipproto == 0; } ",0 "static void event_uart_has_bytes(eager_reader_t *reader, UNUSED_ATTR void *context) { if (stream_has_interpretation) { callbacks->data_ready(current_data_type); } else { uint8_t type_byte; if (eager_reader_read(reader, &type_byte, 1, true) == 0) { LOG_ERROR(""%s could not read HCI message type"", __func__); return; } if (stream_corrupted_during_le_scan_workaround(type_byte)) return; if (type_byte < DATA_TYPE_ACL || type_byte > DATA_TYPE_EVENT) { LOG_ERROR(""%s Unknown HCI message type. Dropping this byte 0x%x, min %x, max %x"", __func__, type_byte, DATA_TYPE_ACL, DATA_TYPE_EVENT); return; } stream_has_interpretation = true; current_data_type = type_byte; } } ",0 "setupM (gcry_cipher_hd_t c) { #if defined(GCM_USE_INTEL_PCLMUL) || defined(GCM_USE_ARM_PMULL) unsigned int features = _gcry_get_hw_features (); #endif if (0) ; #ifdef GCM_USE_INTEL_PCLMUL else if (features & HWF_INTEL_PCLMUL) { c->u_mode.gcm.ghash_fn = _gcry_ghash_intel_pclmul; _gcry_ghash_setup_intel_pclmul (c); } #endif #ifdef GCM_USE_ARM_PMULL else if (features & HWF_ARM_PMULL) { c->u_mode.gcm.ghash_fn = ghash_armv8_ce_pmull; ghash_setup_armv8_ce_pmull (c); } #endif #ifdef GCM_USE_ARM_NEON else if (features & HWF_ARM_NEON) { c->u_mode.gcm.ghash_fn = ghash_armv7_neon; ghash_setup_armv7_neon (c); } #endif else { c->u_mode.gcm.ghash_fn = ghash_internal; fillM (c); } } ",0 "static std::map getMimeTypeToDownloadVideoMap() { return {{""video/x-msvideo"", DOWNLOAD_VIDEO_AVI}, {""video/mpeg"", DOWNLOAD_VIDEO_MPEG}, {""video/ogg"", DOWNLOAD_VIDEO_OGV}, {""video/webm"", DOWNLOAD_VIDEO_WEBM}, {""video/3gpp"", DOWNLOAD_VIDEO_3GP}, {""video/3ggp2"", DOWNLOAD_VIDEO_3G2}, {""video/mp4"", DOWNLOAD_VIDEO_MP4}, {""video/quicktime"", DOWNLOAD_VIDEO_MOV}, {""video/x-ms-wmv"", DOWNLOAD_VIDEO_WMV}}; } ",0 "static int ssl_scan_serverhello_tlsext(SSL *s, unsigned char **p, unsigned char *d, int n, int *al) { unsigned short length; unsigned short type; unsigned short size; unsigned char *data = *p; int tlsext_servername = 0; int renegotiate_seen = 0; # ifndef OPENSSL_NO_NEXTPROTONEG s->s3->next_proto_neg_seen = 0; # endif s->tlsext_ticket_expected = 0; if (s->s3->alpn_selected) { OPENSSL_free(s->s3->alpn_selected); s->s3->alpn_selected = NULL; } # ifndef OPENSSL_NO_HEARTBEATS s->tlsext_heartbeat &= ~(SSL_TLSEXT_HB_ENABLED | SSL_TLSEXT_HB_DONT_SEND_REQUESTS); # endif if (data >= (d + n - 2)) goto ri_check; n2s(data, length); if (data + length != d + n) { *al = SSL_AD_DECODE_ERROR; return 0; } while (data <= (d + n - 4)) { n2s(data, type); n2s(data, size); if (data + size > (d + n)) goto ri_check; if (s->tlsext_debug_cb) s->tlsext_debug_cb(s, 1, type, data, size, s->tlsext_debug_arg); if (type == TLSEXT_TYPE_server_name) { if (s->tlsext_hostname == NULL || size > 0) { *al = TLS1_AD_UNRECOGNIZED_NAME; return 0; } tlsext_servername = 1; } # ifndef OPENSSL_NO_EC else if (type == TLSEXT_TYPE_ec_point_formats) { unsigned char *sdata = data; int ecpointformatlist_length = *(sdata++); if (ecpointformatlist_length != size - 1) { *al = TLS1_AD_DECODE_ERROR; return 0; } if (!s->hit) { s->session->tlsext_ecpointformatlist_length = 0; if (s->session->tlsext_ecpointformatlist != NULL) OPENSSL_free(s->session->tlsext_ecpointformatlist); if ((s->session->tlsext_ecpointformatlist = OPENSSL_malloc(ecpointformatlist_length)) == NULL) { *al = TLS1_AD_INTERNAL_ERROR; return 0; } s->session->tlsext_ecpointformatlist_length = ecpointformatlist_length; memcpy(s->session->tlsext_ecpointformatlist, sdata, ecpointformatlist_length); } # if 0 fprintf(stderr, ""ssl_parse_serverhello_tlsext s->session->tlsext_ecpointformatlist ""); sdata = s->session->tlsext_ecpointformatlist; for (i = 0; i < s->session->tlsext_ecpointformatlist_length; i++) fprintf(stderr, ""%i "", *(sdata++)); fprintf(stderr, ""\n""); # endif } # endif /* OPENSSL_NO_EC */ else if (type == TLSEXT_TYPE_session_ticket) { if (s->tls_session_ticket_ext_cb && !s->tls_session_ticket_ext_cb(s, data, size, s->tls_session_ticket_ext_cb_arg)) { *al = TLS1_AD_INTERNAL_ERROR; return 0; } if ((SSL_get_options(s) & SSL_OP_NO_TICKET) || (size > 0)) { *al = TLS1_AD_UNSUPPORTED_EXTENSION; return 0; } s->tlsext_ticket_expected = 1; } # ifdef TLSEXT_TYPE_opaque_prf_input else if (type == TLSEXT_TYPE_opaque_prf_input) { unsigned char *sdata = data; if (size < 2) { *al = SSL_AD_DECODE_ERROR; return 0; } n2s(sdata, s->s3->server_opaque_prf_input_len); if (s->s3->server_opaque_prf_input_len != size - 2) { *al = SSL_AD_DECODE_ERROR; return 0; } if (s->s3->server_opaque_prf_input != NULL) { /* shouldn't really happen */ OPENSSL_free(s->s3->server_opaque_prf_input); } if (s->s3->server_opaque_prf_input_len == 0) { /* dummy byte just to get non-NULL */ s->s3->server_opaque_prf_input = OPENSSL_malloc(1); } else { s->s3->server_opaque_prf_input = BUF_memdup(sdata, s->s3->server_opaque_prf_input_len); } if (s->s3->server_opaque_prf_input == NULL) { *al = TLS1_AD_INTERNAL_ERROR; return 0; } } # endif else if (type == TLSEXT_TYPE_status_request) { /* * MUST be empty and only sent if we've requested a status * request message. */ if ((s->tlsext_status_type == -1) || (size > 0)) { *al = TLS1_AD_UNSUPPORTED_EXTENSION; return 0; } /* Set flag to expect CertificateStatus message */ s->tlsext_status_expected = 1; } # ifndef OPENSSL_NO_NEXTPROTONEG else if (type == TLSEXT_TYPE_next_proto_neg && s->s3->tmp.finish_md_len == 0) { unsigned char *selected; unsigned char selected_len; /* We must have requested it. */ if (s->ctx->next_proto_select_cb == NULL) { *al = TLS1_AD_UNSUPPORTED_EXTENSION; return 0; } /* The data must be valid */ if (!ssl_next_proto_validate(data, size)) { *al = TLS1_AD_DECODE_ERROR; return 0; } if (s-> ctx->next_proto_select_cb(s, &selected, &selected_len, data, size, s->ctx->next_proto_select_cb_arg) != SSL_TLSEXT_ERR_OK) { *al = TLS1_AD_INTERNAL_ERROR; return 0; } s->next_proto_negotiated = OPENSSL_malloc(selected_len); if (!s->next_proto_negotiated) { *al = TLS1_AD_INTERNAL_ERROR; return 0; } memcpy(s->next_proto_negotiated, selected, selected_len); s->next_proto_negotiated_len = selected_len; s->s3->next_proto_neg_seen = 1; } # endif else if (type == TLSEXT_TYPE_application_layer_protocol_negotiation) { unsigned len; /* We must have requested it. */ if (!s->cert->alpn_sent) { *al = TLS1_AD_UNSUPPORTED_EXTENSION; return 0; } if (size < 4) { *al = TLS1_AD_DECODE_ERROR; return 0; } /*- * The extension data consists of: * uint16 list_length * uint8 proto_length; * uint8 proto[proto_length]; */ len = data[0]; len <<= 8; len |= data[1]; if (len != (unsigned)size - 2) { *al = TLS1_AD_DECODE_ERROR; return 0; } len = data[2]; if (len != (unsigned)size - 3) { *al = TLS1_AD_DECODE_ERROR; return 0; } if (s->s3->alpn_selected) OPENSSL_free(s->s3->alpn_selected); s->s3->alpn_selected = OPENSSL_malloc(len); if (!s->s3->alpn_selected) { *al = TLS1_AD_INTERNAL_ERROR; return 0; } memcpy(s->s3->alpn_selected, data + 3, len); s->s3->alpn_selected_len = len; } else if (type == TLSEXT_TYPE_renegotiate) { if (!ssl_parse_serverhello_renegotiate_ext(s, data, size, al)) return 0; renegotiate_seen = 1; } # ifndef OPENSSL_NO_HEARTBEATS else if (type == TLSEXT_TYPE_heartbeat) { switch (data[0]) { case 0x01: /* Server allows us to send HB requests */ s->tlsext_heartbeat |= SSL_TLSEXT_HB_ENABLED; break; case 0x02: /* Server doesn't accept HB requests */ s->tlsext_heartbeat |= SSL_TLSEXT_HB_ENABLED; s->tlsext_heartbeat |= SSL_TLSEXT_HB_DONT_SEND_REQUESTS; break; default: *al = SSL_AD_ILLEGAL_PARAMETER; return 0; } } # endif # ifndef OPENSSL_NO_SRTP else if (SSL_IS_DTLS(s) && type == TLSEXT_TYPE_use_srtp) { if (ssl_parse_serverhello_use_srtp_ext(s, data, size, al)) return 0; } # endif /* * If this extension type was not otherwise handled, but matches a * custom_cli_ext_record, then send it to the c callback */ else if (custom_ext_parse(s, 0, type, data, size, al) <= 0) return 0; data += size; } if (data != d + n) { *al = SSL_AD_DECODE_ERROR; return 0; } if (!s->hit && tlsext_servername == 1) { if (s->tlsext_hostname) { if (s->session->tlsext_hostname == NULL) { s->session->tlsext_hostname = BUF_strdup(s->tlsext_hostname); if (!s->session->tlsext_hostname) { *al = SSL_AD_UNRECOGNIZED_NAME; return 0; } } else { *al = SSL_AD_DECODE_ERROR; return 0; } } } *p = data; ri_check: /* * Determine if we need to see RI. Strictly speaking if we want to avoid * an attack we should *always* see RI even on initial server hello * because the client doesn't see any renegotiation during an attack. * However this would mean we could not connect to any server which * doesn't support RI so for the immediate future tolerate RI absence on * initial connect only. */ if (!renegotiate_seen && !(s->options & SSL_OP_LEGACY_SERVER_CONNECT) && !(s->options & SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION)) { *al = SSL_AD_HANDSHAKE_FAILURE; SSLerr(SSL_F_SSL_SCAN_SERVERHELLO_TLSEXT, SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED); return 0; } return 1; } ",1 "cifs_reclassify_socket4(struct socket *sock) { struct sock *sk = sock->sk; BUG_ON(sock_owned_by_user(sk)); sock_lock_init_class_and_name(sk, ""slock-AF_INET-CIFS"", &cifs_slock_key[0], ""sk_lock-AF_INET-CIFS"", &cifs_key[0]); } ",0 "void free_huge_page(struct page *page) { /* * Can't pass hstate in here because it is called from the * compound page destructor. */ struct hstate *h = page_hstate(page); int nid = page_to_nid(page); struct hugepage_subpool *spool = (struct hugepage_subpool *)page_private(page); bool restore_reserve; VM_BUG_ON_PAGE(page_count(page), page); VM_BUG_ON_PAGE(page_mapcount(page), page); set_page_private(page, 0); page->mapping = NULL; restore_reserve = PagePrivate(page); ClearPagePrivate(page); /* * A return code of zero implies that the subpool will be under its * minimum size if the reservation is not restored after page is free. * Therefore, force restore_reserve operation. */ if (hugepage_subpool_put_pages(spool, 1) == 0) restore_reserve = true; spin_lock(&hugetlb_lock); clear_page_huge_active(page); hugetlb_cgroup_uncharge_page(hstate_index(h), pages_per_huge_page(h), page); if (restore_reserve) h->resv_huge_pages++; if (PageHugeTemporary(page)) { list_del(&page->lru); ClearPageHugeTemporary(page); update_and_free_page(h, page); } else if (h->surplus_huge_pages_node[nid]) { /* remove the page from active list */ list_del(&page->lru); update_and_free_page(h, page); h->surplus_huge_pages--; h->surplus_huge_pages_node[nid]--; } else { arch_clear_hugepage_flags(page); enqueue_huge_page(h, page); } spin_unlock(&hugetlb_lock); } ",0 " Window* get(Display* dpy) { if (!window) { window = XCreateSimpleWindow(dpy, XDefaultRootWindow(dpy), -1, -1, 1, 1, 0, BlackPixel(dpy, 0), WhitePixel(dpy, 0)); XSetWindowAttributes attributes; attributes.override_redirect = true; XChangeWindowAttributes(dpy, window, X11OverrideRedirect, &attributes); display = dpy; XMapWindow(dpy, window); } return &window; } ",0 "void DelegatedFrameHost::DidNotProduceFrame(const viz::BeginFrameAck& ack) { DCHECK(!ack.has_damage); support_->DidNotProduceFrame(ack); } ",0 "ModuleExport void UnregisterVIFFImage(void) { (void) UnregisterMagickInfo(""VIFF""); (void) UnregisterMagickInfo(""XV""); } ",0 "static void cirrus_write_hidden_dac(CirrusVGAState * s, int reg_value) { if (s->cirrus_hidden_dac_lockindex == 4) { s->cirrus_hidden_dac_data = reg_value; #if defined(DEBUG_CIRRUS) printf(""cirrus: outport hidden DAC, value %02x\n"", reg_value); #endif } s->cirrus_hidden_dac_lockindex = 0; } ",0 "void WorkerFetchContext::AddAdditionalRequestHeaders(ResourceRequest& request, FetchResourceType type) { BaseFetchContext::AddAdditionalRequestHeaders(request, type); if (!request.Url().IsEmpty() && !request.Url().ProtocolIsInHTTPFamily()) return; if (web_context_->IsDataSaverEnabled()) request.SetHTTPHeaderField(HTTPNames::Save_Data, ""on""); } ",0 "static const char *urlsection(cmd_parms *cmd, void *mconfig, const char *arg) { const char *errmsg; const char *endp = ap_strrchr_c(arg, '>'); int old_overrides = cmd->override; char *old_path = cmd->path; core_dir_config *conf; ap_regex_t *r = NULL; const command_rec *thiscmd = cmd->cmd; ap_conf_vector_t *new_url_conf = ap_create_per_dir_config(cmd->pool); const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE); if (err != NULL) { return err; } if (endp == NULL) { return unclosed_directive(cmd); } arg = apr_pstrndup(cmd->temp_pool, arg, endp - arg); if (!arg[0]) { return missing_container_arg(cmd); } cmd->path = ap_getword_conf(cmd->pool, &arg); cmd->override = OR_ALL|ACCESS_CONF; if (thiscmd->cmd_data) { /* */ r = ap_pregcomp(cmd->pool, cmd->path, AP_REG_EXTENDED); if (!r) { return ""Regex could not be compiled""; } } else if (!strcmp(cmd->path, ""~"")) { cmd->path = ap_getword_conf(cmd->pool, &arg); r = ap_pregcomp(cmd->pool, cmd->path, AP_REG_EXTENDED); if (!r) { return ""Regex could not be compiled""; } } /* initialize our config and fetch it */ conf = ap_set_config_vectors(cmd->server, new_url_conf, cmd->path, &core_module, cmd->pool); errmsg = ap_walk_config(cmd->directive->first_child, cmd, new_url_conf); if (errmsg != NULL) return errmsg; conf->d = apr_pstrdup(cmd->pool, cmd->path); /* No mangling, please */ conf->d_is_fnmatch = apr_fnmatch_test(conf->d) != 0; conf->r = r; if (r) { conf->refs = apr_array_make(cmd->pool, 8, sizeof(char *)); ap_regname(r, conf->refs, AP_REG_MATCH, 1); } ap_add_per_url_conf(cmd->server, new_url_conf); if (*arg != '\0') { return apr_pstrcat(cmd->pool, ""Multiple "", thiscmd->name, ""> arguments not (yet) supported."", NULL); } cmd->path = old_path; cmd->override = old_overrides; return NULL; } ",0 "GF_Err tssy_Write(GF_Box *s, GF_BitStream *bs) { GF_Err e; GF_TimeStampSynchronyBox *ptr = (GF_TimeStampSynchronyBox *)s; if (ptr == NULL) return GF_BAD_PARAM; e = gf_isom_box_write_header(s, bs); if (e) return e; gf_bs_write_int(bs, 0, 6); gf_bs_write_int(bs, ptr->timestamp_sync, 2); return GF_OK; } ",0 "void CommandTokenizer::pump() { if (m_posNextSeparator == std::string::npos || m_posNextSeparator == m_input.size()) { m_next = std::string(); return; } size_t start = m_posNextSeparator ? m_posNextSeparator + 1 : 0; m_posNextSeparator = m_input.find(kSeparator, start); size_t size = m_posNextSeparator == std::string::npos ? std::string::npos : m_posNextSeparator - start; m_next = std::string(m_input, start, size); } ",0 "static int get_wvr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd, const struct kvm_one_reg *reg, void __user *uaddr) { __u64 *r = &vcpu->arch.vcpu_debug_state.dbg_wvr[rd->reg]; if (copy_to_user(uaddr, r, KVM_REG_SIZE(reg->id)) != 0) return -EFAULT; return 0; } ",0 " LocalSiteCharacteristicsDataImpl::LocalSiteCharacteristicsDataImpl( const url::Origin& origin, OnDestroyDelegate* delegate, LocalSiteCharacteristicsDatabase* database) : origin_(origin), loaded_tabs_count_(0U), loaded_tabs_in_background_count_(0U), database_(database), delegate_(delegate), safe_to_write_to_db_(false), is_dirty_(false), weak_factory_(this) { DCHECK(database_); DCHECK(delegate_); DCHECK(!site_characteristics_.IsInitialized()); database_->ReadSiteCharacteristicsFromDB( origin_, base::BindOnce(&LocalSiteCharacteristicsDataImpl::OnInitCallback, weak_factory_.GetWeakPtr())); } ",0 "void Part::setupActions() { m_signalMapper = new QSignalMapper(this); m_showInfoPanelAction = new KToggleAction(i18nc(""@action:inmenu"", ""Show Information Panel""), this); actionCollection()->addAction(QStringLiteral( ""show-infopanel"" ), m_showInfoPanelAction); m_showInfoPanelAction->setChecked(ArkSettings::showInfoPanel()); connect(m_showInfoPanelAction, &QAction::triggered, this, &Part::slotToggleInfoPanel); m_saveAsAction = actionCollection()->addAction(KStandardAction::SaveAs, QStringLiteral(""ark_file_save_as""), this, SLOT(slotSaveAs())); m_openFileAction = actionCollection()->addAction(QStringLiteral(""openfile"")); m_openFileAction->setText(i18nc(""open a file with external program"", ""&Open"")); m_openFileAction->setIcon(QIcon::fromTheme(QStringLiteral(""document-open""))); m_openFileAction->setToolTip(i18nc(""@info:tooltip"", ""Click to open the selected file with the associated application"")); connect(m_openFileAction, &QAction::triggered, m_signalMapper, static_cast(&QSignalMapper::map)); m_signalMapper->setMapping(m_openFileAction, OpenFile); m_openFileWithAction = actionCollection()->addAction(QStringLiteral(""openfilewith"")); m_openFileWithAction->setText(i18nc(""open a file with external program"", ""Open &With..."")); m_openFileWithAction->setIcon(QIcon::fromTheme(QStringLiteral(""document-open""))); m_openFileWithAction->setToolTip(i18nc(""@info:tooltip"", ""Click to open the selected file with an external program"")); connect(m_openFileWithAction, &QAction::triggered, m_signalMapper, static_cast(&QSignalMapper::map)); m_signalMapper->setMapping(m_openFileWithAction, OpenFileWith); m_previewAction = actionCollection()->addAction(QStringLiteral(""preview"")); m_previewAction->setText(i18nc(""to preview a file inside an archive"", ""Pre&view"")); m_previewAction->setIcon(QIcon::fromTheme(QStringLiteral(""document-preview-archive""))); m_previewAction->setToolTip(i18nc(""@info:tooltip"", ""Click to preview the selected file"")); actionCollection()->setDefaultShortcut(m_previewAction, Qt::CTRL + Qt::Key_P); connect(m_previewAction, &QAction::triggered, m_signalMapper, static_cast(&QSignalMapper::map)); m_signalMapper->setMapping(m_previewAction, Preview); m_extractArchiveAction = actionCollection()->addAction(QStringLiteral(""extract_all"")); m_extractArchiveAction->setText(i18nc(""@action:inmenu"", ""E&xtract All"")); m_extractArchiveAction->setIcon(QIcon::fromTheme(QStringLiteral(""archive-extract""))); m_extractArchiveAction->setToolTip(i18n(""Click to open an extraction dialog, where you can choose how to extract all the files in the archive"")); actionCollection()->setDefaultShortcut(m_extractArchiveAction, Qt::CTRL + Qt::SHIFT + Qt::Key_E); connect(m_extractArchiveAction, &QAction::triggered, this, &Part::slotExtractArchive); m_extractAction = actionCollection()->addAction(QStringLiteral(""extract"")); m_extractAction->setText(i18nc(""@action:inmenu"", ""&Extract"")); m_extractAction->setIcon(QIcon::fromTheme(QStringLiteral(""archive-extract""))); actionCollection()->setDefaultShortcut(m_extractAction, Qt::CTRL + Qt::Key_E); m_extractAction->setToolTip(i18n(""Click to open an extraction dialog, where you can choose to extract either all files or just the selected ones"")); connect(m_extractAction, &QAction::triggered, this, &Part::slotShowExtractionDialog); m_addFilesAction = actionCollection()->addAction(QStringLiteral(""add"")); m_addFilesAction->setIcon(QIcon::fromTheme(QStringLiteral(""archive-insert""))); m_addFilesAction->setText(i18n(""Add &Files..."")); m_addFilesAction->setToolTip(i18nc(""@info:tooltip"", ""Click to add files to the archive"")); actionCollection()->setDefaultShortcut(m_addFilesAction, Qt::ALT + Qt::Key_A); connect(m_addFilesAction, &QAction::triggered, this, static_cast(&Part::slotAddFiles)); m_renameFileAction = actionCollection()->addAction(QStringLiteral(""rename"")); m_renameFileAction->setIcon(QIcon::fromTheme(QStringLiteral(""edit-rename""))); m_renameFileAction->setText(i18n(""&Rename"")); actionCollection()->setDefaultShortcut(m_renameFileAction, Qt::Key_F2); m_renameFileAction->setToolTip(i18nc(""@info:tooltip"", ""Click to rename the selected file"")); connect(m_renameFileAction, &QAction::triggered, this, &Part::slotEditFileName); m_deleteFilesAction = actionCollection()->addAction(QStringLiteral(""delete"")); m_deleteFilesAction->setIcon(QIcon::fromTheme(QStringLiteral(""archive-remove""))); m_deleteFilesAction->setText(i18n(""De&lete"")); actionCollection()->setDefaultShortcut(m_deleteFilesAction, Qt::Key_Delete); m_deleteFilesAction->setToolTip(i18nc(""@info:tooltip"", ""Click to delete the selected files"")); connect(m_deleteFilesAction, &QAction::triggered, this, &Part::slotDeleteFiles); m_cutFilesAction = actionCollection()->addAction(QStringLiteral(""cut"")); m_cutFilesAction->setIcon(QIcon::fromTheme(QStringLiteral(""edit-cut""))); m_cutFilesAction->setText(i18nc(""@action:inmenu"", ""C&ut"")); actionCollection()->setDefaultShortcut(m_cutFilesAction, Qt::CTRL + Qt::Key_X); m_cutFilesAction->setToolTip(i18nc(""@info:tooltip"", ""Click to cut the selected files"")); connect(m_cutFilesAction, &QAction::triggered, this, &Part::slotCutFiles); m_copyFilesAction = actionCollection()->addAction(QStringLiteral(""copy"")); m_copyFilesAction->setIcon(QIcon::fromTheme(QStringLiteral(""edit-copy""))); m_copyFilesAction->setText(i18nc(""@action:inmenu"", ""C&opy"")); actionCollection()->setDefaultShortcut(m_copyFilesAction, Qt::CTRL + Qt::Key_C); m_copyFilesAction->setToolTip(i18nc(""@info:tooltip"", ""Click to copy the selected files"")); connect(m_copyFilesAction, &QAction::triggered, this, &Part::slotCopyFiles); m_pasteFilesAction = actionCollection()->addAction(QStringLiteral(""paste"")); m_pasteFilesAction->setIcon(QIcon::fromTheme(QStringLiteral(""edit-paste""))); m_pasteFilesAction->setText(i18nc(""@action:inmenu"", ""Pa&ste"")); actionCollection()->setDefaultShortcut(m_pasteFilesAction, Qt::CTRL + Qt::Key_V); m_pasteFilesAction->setToolTip(i18nc(""@info:tooltip"", ""Click to paste the files here"")); connect(m_pasteFilesAction, &QAction::triggered, this, static_cast(&Part::slotPasteFiles)); m_propertiesAction = actionCollection()->addAction(QStringLiteral(""properties"")); m_propertiesAction->setIcon(QIcon::fromTheme(QStringLiteral(""document-properties""))); m_propertiesAction->setText(i18nc(""@action:inmenu"", ""&Properties"")); actionCollection()->setDefaultShortcut(m_propertiesAction, Qt::ALT + Qt::Key_Return); m_propertiesAction->setToolTip(i18nc(""@info:tooltip"", ""Click to see properties for archive"")); connect(m_propertiesAction, &QAction::triggered, this, &Part::slotShowProperties); m_editCommentAction = actionCollection()->addAction(QStringLiteral(""edit_comment"")); m_editCommentAction->setIcon(QIcon::fromTheme(QStringLiteral(""document-edit""))); actionCollection()->setDefaultShortcut(m_editCommentAction, Qt::ALT + Qt::Key_C); m_editCommentAction->setToolTip(i18nc(""@info:tooltip"", ""Click to add or edit comment"")); connect(m_editCommentAction, &QAction::triggered, this, &Part::slotShowComment); m_testArchiveAction = actionCollection()->addAction(QStringLiteral(""test_archive"")); m_testArchiveAction->setIcon(QIcon::fromTheme(QStringLiteral(""checkmark""))); m_testArchiveAction->setText(i18nc(""@action:inmenu"", ""&Test Integrity"")); actionCollection()->setDefaultShortcut(m_testArchiveAction, Qt::ALT + Qt::Key_T); m_testArchiveAction->setToolTip(i18nc(""@info:tooltip"", ""Click to test the archive for integrity"")); connect(m_testArchiveAction, &QAction::triggered, this, &Part::slotTestArchive); connect(m_signalMapper, static_cast(&QSignalMapper::mapped), this, &Part::slotOpenEntry); updateActions(); updateQuickExtractMenu(m_extractArchiveAction); updateQuickExtractMenu(m_extractAction); } ",0 "static char *find_eoq(char *p) { for (; *p; p++) { if (*p == '""') { break; } if (*p == '\\' && p[1] == '""') { p++; } } return p; } ",0 "void DownloadManagerImpl::StartDownloadItem( std::unique_ptr info, const download::DownloadUrlParameters::OnStartedCallback& on_started, download::InProgressDownloadManager::StartDownloadItemCallback callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); if (!info->is_new_download) { download::DownloadItemImpl* download = downloads_by_guid_[info->guid]; if (!download || download->GetState() == download::DownloadItem::CANCELLED) download = nullptr; std::move(callback).Run(std::move(info), download, should_persist_new_download_); OnDownloadStarted(download, on_started); } else { GetNextId(base::BindOnce(&DownloadManagerImpl::CreateNewDownloadItemToStart, weak_factory_.GetWeakPtr(), std::move(info), on_started, std::move(callback))); } } ",0 "void mca_ccb_report_event(tMCA_CCB* p_ccb, uint8_t event, tMCA_CTRL* p_data) { if (p_ccb && p_ccb->p_rcb && p_ccb->p_rcb->p_cback) (*p_ccb->p_rcb->p_cback)(mca_rcb_to_handle(p_ccb->p_rcb), mca_ccb_to_hdl(p_ccb), event, p_data); } ",0 "void ChromeContentBrowserClient::RegisterOutOfProcessServices( OutOfProcessServiceMap* services) { #if BUILDFLAG(ENABLE_ISOLATED_XR_SERVICE) (*services)[device::mojom::kVrIsolatedServiceName] = base::BindRepeating( &l10n_util::GetStringUTF16, IDS_ISOLATED_XR_PROCESS_NAME); #endif #if BUILDFLAG(ENABLE_PRINTING) (*services)[printing::mojom::kServiceName] = base::BindRepeating(&l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_PDF_COMPOSITOR_SERVICE_NAME); #endif #if BUILDFLAG(ENABLE_PRINT_PREVIEW) || \ (BUILDFLAG(ENABLE_PRINTING) && defined(OS_WIN)) (*services)[printing::mojom::kChromePrintingServiceName] = base::BindRepeating(&l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_PRINTING_SERVICE_NAME); #endif (*services)[heap_profiling::mojom::kServiceName] = base::BindRepeating( &l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_PROFILING_SERVICE_NAME); #if BUILDFLAG(ENABLE_EXTENSIONS) || defined(OS_ANDROID) (*services)[chrome::mojom::kMediaGalleryUtilServiceName] = base::BindRepeating(&l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_MEDIA_GALLERY_UTILITY_NAME); #endif #if BUILDFLAG(ENABLE_EXTENSIONS) (*services)[chrome::mojom::kRemovableStorageWriterServiceName] = base::BindRepeating(&l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_IMAGE_WRITER_NAME); #endif #if defined(OS_WIN) (*services)[chrome::mojom::kUtilWinServiceName] = base::BindRepeating( &l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_UTILITY_WIN_NAME); #endif #if defined(OS_WIN) && BUILDFLAG(ENABLE_EXTENSIONS) (*services)[chrome::mojom::kWifiUtilWinServiceName] = base::BindRepeating(&l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_WIFI_CREDENTIALS_GETTER_NAME); #endif #if !defined(OS_ANDROID) (*services)[chrome::mojom::kProfileImportServiceName] = base::BindRepeating( &l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_PROFILE_IMPORTER_NAME); (*services)[proxy_resolver::mojom::kProxyResolverServiceName] = base::BindRepeating(&l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_PROXY_RESOLVER_NAME); #endif #if BUILDFLAG(ENABLE_PRINTING) && defined(OS_CHROMEOS) (*services)[chrome::mojom::kCupsIppParserServiceName] = base::BindRepeating(&l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_CUPS_IPP_PARSER_SERVICE_NAME); #endif #if defined(FULL_SAFE_BROWSING) || defined(OS_CHROMEOS) (*services)[chrome::mojom::kFileUtilServiceName] = base::BindRepeating( &l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_FILE_UTILITY_NAME); #endif #if !defined(OS_ANDROID) (*services)[patch::mojom::kServiceName] = base::BindRepeating( &l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_PATCH_NAME); #endif (*services)[unzip::mojom::kServiceName] = base::BindRepeating( &l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_UNZIP_NAME); #if defined(OS_CHROMEOS) ash_service_registry::RegisterOutOfProcessServices(services); (*services)[chromeos::ime::mojom::kServiceName] = base::BindRepeating( &l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_IME_SERVICE_NAME); #endif #if BUILDFLAG(ENABLE_SIMPLE_BROWSER_SERVICE_OUT_OF_PROCESS) if (base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kLaunchSimpleBrowserSwitch)) { (*services)[simple_browser::mojom::kServiceName] = base::BindRepeating([]() -> base::string16 { return base::ASCIIToUTF16(""Simple Browser""); }); } #endif #if !defined(OS_ANDROID) if (base::FeatureList::IsEnabled(mirroring::features::kMirroringService) && base::FeatureList::IsEnabled(features::kAudioServiceAudioStreams) && base::FeatureList::IsEnabled(network::features::kNetworkService)) { (*services)[mirroring::mojom::kServiceName] = base::BindRepeating(&base::ASCIIToUTF16, ""Mirroring Service""); } #endif } ",0 "V8Debugger::V8Debugger(v8::Isolate* isolate, V8InspectorImpl* inspector) : m_isolate(isolate) , m_inspector(inspector) , m_lastContextId(0) , m_enableCount(0) , m_breakpointsActivated(true) , m_runningNestedMessageLoop(false) , m_ignoreScriptParsedEventsCounter(0) , m_maxAsyncCallStackDepth(0) { } ",0 "void GDataFileSystem::CopyOnUIThreadAfterGetEntryInfoPair( const FilePath& dest_file_path, const FileOperationCallback& callback, scoped_ptr result) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); DCHECK(result.get()); if (result->first.error != GDATA_FILE_OK) { callback.Run(result->first.error); return; } else if (result->second.error != GDATA_FILE_OK) { callback.Run(result->second.error); return; } scoped_ptr src_file_proto = result->first.proto.Pass(); scoped_ptr dest_parent_proto = result->second.proto.Pass(); if (!dest_parent_proto->file_info().is_directory()) { callback.Run(GDATA_FILE_ERROR_NOT_A_DIRECTORY); return; } else if (src_file_proto->file_info().is_directory()) { callback.Run(GDATA_FILE_ERROR_INVALID_OPERATION); return; } if (src_file_proto->file_specific_info().is_hosted_document()) { CopyDocumentToDirectory(dest_file_path.DirName(), src_file_proto->resource_id(), dest_file_path.BaseName().RemoveExtension().value(), callback); return; } const FilePath& src_file_path = result->first.path; GetFileByPath(src_file_path, base::Bind(&GDataFileSystem::OnGetFileCompleteForCopy, ui_weak_ptr_, dest_file_path, callback), GetDownloadDataCallback()); } ",0 "void GamepadProvider::DoAddGamepadDataFetcher( std::unique_ptr fetcher) { DCHECK(polling_thread_->task_runner()->BelongsToCurrentThread()); if (!fetcher) return; InitializeDataFetcher(fetcher.get()); data_fetchers_.push_back(std::move(fetcher)); } ",0 "static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function, u32 index, int *nent, int maxnent) { unsigned f_nx = is_efer_nx() ? F(NX) : 0; #ifdef CONFIG_X86_64 unsigned f_gbpages = (kvm_x86_ops->get_lpage_level() == PT_PDPE_LEVEL) ? F(GBPAGES) : 0; unsigned f_lm = F(LM); #else unsigned f_gbpages = 0; unsigned f_lm = 0; #endif unsigned f_rdtscp = kvm_x86_ops->rdtscp_supported() ? F(RDTSCP) : 0; /* cpuid 1.edx */ const u32 kvm_supported_word0_x86_features = F(FPU) | F(VME) | F(DE) | F(PSE) | F(TSC) | F(MSR) | F(PAE) | F(MCE) | F(CX8) | F(APIC) | 0 /* Reserved */ | F(SEP) | F(MTRR) | F(PGE) | F(MCA) | F(CMOV) | F(PAT) | F(PSE36) | 0 /* PSN */ | F(CLFLSH) | 0 /* Reserved, DS, ACPI */ | F(MMX) | F(FXSR) | F(XMM) | F(XMM2) | F(SELFSNOOP) | 0 /* HTT, TM, Reserved, PBE */; /* cpuid 0x80000001.edx */ const u32 kvm_supported_word1_x86_features = F(FPU) | F(VME) | F(DE) | F(PSE) | F(TSC) | F(MSR) | F(PAE) | F(MCE) | F(CX8) | F(APIC) | 0 /* Reserved */ | F(SYSCALL) | F(MTRR) | F(PGE) | F(MCA) | F(CMOV) | F(PAT) | F(PSE36) | 0 /* Reserved */ | f_nx | 0 /* Reserved */ | F(MMXEXT) | F(MMX) | F(FXSR) | F(FXSR_OPT) | f_gbpages | f_rdtscp | 0 /* Reserved */ | f_lm | F(3DNOWEXT) | F(3DNOW); /* cpuid 1.ecx */ const u32 kvm_supported_word4_x86_features = F(XMM3) | F(PCLMULQDQ) | 0 /* DTES64, MONITOR */ | 0 /* DS-CPL, VMX, SMX, EST */ | 0 /* TM2 */ | F(SSSE3) | 0 /* CNXT-ID */ | 0 /* Reserved */ | 0 /* Reserved */ | F(CX16) | 0 /* xTPR Update, PDCM */ | 0 /* Reserved, DCA */ | F(XMM4_1) | F(XMM4_2) | F(X2APIC) | F(MOVBE) | F(POPCNT) | 0 /* Reserved*/ | F(AES) | F(XSAVE) | 0 /* OSXSAVE */ | F(AVX) | F(F16C); /* cpuid 0x80000001.ecx */ const u32 kvm_supported_word6_x86_features = F(LAHF_LM) | F(CMP_LEGACY) | 0 /*SVM*/ | 0 /* ExtApicSpace */ | F(CR8_LEGACY) | F(ABM) | F(SSE4A) | F(MISALIGNSSE) | F(3DNOWPREFETCH) | 0 /* OSVW */ | 0 /* IBS */ | F(XOP) | 0 /* SKINIT, WDT, LWP */ | F(FMA4) | F(TBM); /* all calls to cpuid_count() should be made on the same cpu */ get_cpu(); do_cpuid_1_ent(entry, function, index); ++*nent; switch (function) { case 0: entry->eax = min(entry->eax, (u32)0xd); break; case 1: entry->edx &= kvm_supported_word0_x86_features; cpuid_mask(&entry->edx, 0); entry->ecx &= kvm_supported_word4_x86_features; cpuid_mask(&entry->ecx, 4); /* we support x2apic emulation even if host does not support * it since we emulate x2apic in software */ entry->ecx |= F(X2APIC); break; /* function 2 entries are STATEFUL. That is, repeated cpuid commands * may return different values. This forces us to get_cpu() before * issuing the first command, and also to emulate this annoying behavior * in kvm_emulate_cpuid() using KVM_CPUID_FLAG_STATE_READ_NEXT */ case 2: { int t, times = entry->eax & 0xff; entry->flags |= KVM_CPUID_FLAG_STATEFUL_FUNC; entry->flags |= KVM_CPUID_FLAG_STATE_READ_NEXT; for (t = 1; t < times && *nent < maxnent; ++t) { do_cpuid_1_ent(&entry[t], function, 0); entry[t].flags |= KVM_CPUID_FLAG_STATEFUL_FUNC; ++*nent; } break; } /* function 4 and 0xb have additional index. */ case 4: { int i, cache_type; entry->flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX; /* read more entries until cache_type is zero */ for (i = 1; *nent < maxnent; ++i) { cache_type = entry[i - 1].eax & 0x1f; if (!cache_type) break; do_cpuid_1_ent(&entry[i], function, i); entry[i].flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX; ++*nent; } break; } case 0xb: { int i, level_type; entry->flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX; /* read more entries until level_type is zero */ for (i = 1; *nent < maxnent; ++i) { level_type = entry[i - 1].ecx & 0xff00; if (!level_type) break; do_cpuid_1_ent(&entry[i], function, i); entry[i].flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX; ++*nent; } break; } case 0xd: { int i; entry->flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX; for (i = 1; *nent < maxnent; ++i) { if (entry[i - 1].eax == 0 && i != 2) break; do_cpuid_1_ent(&entry[i], function, i); entry[i].flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX; ++*nent; } break; } case KVM_CPUID_SIGNATURE: { char signature[12] = ""KVMKVMKVM\0\0""; u32 *sigptr = (u32 *)signature; entry->eax = 0; entry->ebx = sigptr[0]; entry->ecx = sigptr[1]; entry->edx = sigptr[2]; break; } case KVM_CPUID_FEATURES: entry->eax = (1 << KVM_FEATURE_CLOCKSOURCE) | (1 << KVM_FEATURE_NOP_IO_DELAY) | (1 << KVM_FEATURE_CLOCKSOURCE2) | (1 << KVM_FEATURE_CLOCKSOURCE_STABLE_BIT); entry->ebx = 0; entry->ecx = 0; entry->edx = 0; break; case 0x80000000: entry->eax = min(entry->eax, 0x8000001a); break; case 0x80000001: entry->edx &= kvm_supported_word1_x86_features; cpuid_mask(&entry->edx, 1); entry->ecx &= kvm_supported_word6_x86_features; cpuid_mask(&entry->ecx, 6); break; } kvm_x86_ops->set_supported_cpuid(function, entry); put_cpu(); } ",0 "static int tomoyo_audit_mount_log(struct tomoyo_request_info *r) { const char *dev = r->param.mount.dev->name; const char *dir = r->param.mount.dir->name; const char *type = r->param.mount.type->name; const unsigned long flags = r->param.mount.flags; if (r->granted) return 0; if (!strcmp(type, TOMOYO_MOUNT_REMOUNT_KEYWORD)) tomoyo_warn_log(r, ""mount -o remount %s 0x%lX"", dir, flags); else if (!strcmp(type, TOMOYO_MOUNT_BIND_KEYWORD) || !strcmp(type, TOMOYO_MOUNT_MOVE_KEYWORD)) tomoyo_warn_log(r, ""mount %s %s %s 0x%lX"", type, dev, dir, flags); else if (!strcmp(type, TOMOYO_MOUNT_MAKE_UNBINDABLE_KEYWORD) || !strcmp(type, TOMOYO_MOUNT_MAKE_PRIVATE_KEYWORD) || !strcmp(type, TOMOYO_MOUNT_MAKE_SLAVE_KEYWORD) || !strcmp(type, TOMOYO_MOUNT_MAKE_SHARED_KEYWORD)) tomoyo_warn_log(r, ""mount %s %s 0x%lX"", type, dir, flags); else tomoyo_warn_log(r, ""mount -t %s %s %s 0x%lX"", type, dev, dir, flags); return tomoyo_supervisor(r, TOMOYO_KEYWORD_ALLOW_MOUNT ""%s %s %s 0x%lX\n"", tomoyo_pattern(r->param.mount.dev), tomoyo_pattern(r->param.mount.dir), type, flags); } ",0 "vhost_scsi_ioctl(struct file *f, unsigned int ioctl, unsigned long arg) { struct vhost_scsi *vs = f->private_data; struct vhost_scsi_target backend; void __user *argp = (void __user *)arg; u64 __user *featurep = argp; u32 __user *eventsp = argp; u32 events_missed; u64 features; int r, abi_version = VHOST_SCSI_ABI_VERSION; struct vhost_virtqueue *vq = &vs->vqs[VHOST_SCSI_VQ_EVT].vq; switch (ioctl) { case VHOST_SCSI_SET_ENDPOINT: if (copy_from_user(&backend, argp, sizeof backend)) return -EFAULT; if (backend.reserved != 0) return -EOPNOTSUPP; return vhost_scsi_set_endpoint(vs, &backend); case VHOST_SCSI_CLEAR_ENDPOINT: if (copy_from_user(&backend, argp, sizeof backend)) return -EFAULT; if (backend.reserved != 0) return -EOPNOTSUPP; return vhost_scsi_clear_endpoint(vs, &backend); case VHOST_SCSI_GET_ABI_VERSION: if (copy_to_user(argp, &abi_version, sizeof abi_version)) return -EFAULT; return 0; case VHOST_SCSI_SET_EVENTS_MISSED: if (get_user(events_missed, eventsp)) return -EFAULT; mutex_lock(&vq->mutex); vs->vs_events_missed = events_missed; mutex_unlock(&vq->mutex); return 0; case VHOST_SCSI_GET_EVENTS_MISSED: mutex_lock(&vq->mutex); events_missed = vs->vs_events_missed; mutex_unlock(&vq->mutex); if (put_user(events_missed, eventsp)) return -EFAULT; return 0; case VHOST_GET_FEATURES: features = VHOST_SCSI_FEATURES; if (copy_to_user(featurep, &features, sizeof features)) return -EFAULT; return 0; case VHOST_SET_FEATURES: if (copy_from_user(&features, featurep, sizeof features)) return -EFAULT; return vhost_scsi_set_features(vs, features); default: mutex_lock(&vs->dev.mutex); r = vhost_dev_ioctl(&vs->dev, ioctl, argp); /* TODO: flush backend after dev ioctl. */ if (r == -ENOIOCTLCMD) r = vhost_vring_ioctl(&vs->dev, ioctl, argp); mutex_unlock(&vs->dev.mutex); return r; } } ",0 "void OxideQQuickWebViewPrivate::killWebProcess(bool crash) { if (!proxy_) { return; } proxy_->killWebProcess(crash); } ",0 "ErrorState* ContextState::GetErrorState() { return error_state_.get(); } ",0 "WeakPtrWillBeRawPtr Document::contextDocument() { if (m_contextDocument) return m_contextDocument; if (m_frame) { #if ENABLE(OILPAN) return this; #else return m_weakFactory.createWeakPtr(); #endif } return WeakPtrWillBeRawPtr(nullptr); } ",0 "hstoreArrayToPairs(ArrayType *a, int *npairs) { Datum *key_datums; bool *key_nulls; int key_count; Pairs *key_pairs; int bufsiz; int i, j; deconstruct_array(a, TEXTOID, -1, false, 'i', &key_datums, &key_nulls, &key_count); if (key_count == 0) { *npairs = 0; return NULL; } key_pairs = palloc(sizeof(Pairs) * key_count); for (i = 0, j = 0; i < key_count; i++) { if (!key_nulls[i]) { key_pairs[j].key = VARDATA(key_datums[i]); key_pairs[j].keylen = VARSIZE(key_datums[i]) - VARHDRSZ; key_pairs[j].val = NULL; key_pairs[j].vallen = 0; key_pairs[j].needfree = 0; key_pairs[j].isnull = 1; j++; } } *npairs = hstoreUniquePairs(key_pairs, j, &bufsiz); return key_pairs; } ",1 "int rtnl_delete_link(struct net_device *dev) { const struct rtnl_link_ops *ops; LIST_HEAD(list_kill); ops = dev->rtnl_link_ops; if (!ops || !ops->dellink) return -EOPNOTSUPP; ops->dellink(dev, &list_kill); unregister_netdevice_many(&list_kill); return 0; } ",0 "static int rfcomm_get_dev_info(void __user *arg) { struct rfcomm_dev *dev; struct rfcomm_dev_info di; int err = 0; BT_DBG(""""); if (copy_from_user(&di, arg, sizeof(di))) return -EFAULT; dev = rfcomm_dev_get(di.id); if (!dev) return -ENODEV; di.flags = dev->flags; di.channel = dev->channel; di.state = dev->dlc->state; bacpy(&di.src, &dev->src); bacpy(&di.dst, &dev->dst); if (copy_to_user(arg, &di, sizeof(di))) err = -EFAULT; tty_port_put(&dev->port); return err; } ",0 " static std::string ID() { update_client::CrxComponent component; component.version = Version(""0.0.0.0""); GetPkHash(&component.pk_hash); return update_client::GetCrxComponentID(component); } ",0 "const gfx::Font& BrowserFrame::GetTitleFont() { static gfx::Font *title_font = new gfx::Font(); return *title_font; } ",0 "bool WebPluginDelegatePepper::CalculatePrintedPageDimensions( int page_number, NPPPrintExtensions* print_extensions, gfx::Size* page_dimensions) { int32 width_in_pixels = 0; int32 height_in_pixels = 0; NPError err = print_extensions->getRasterDimensions( instance()->npp(), page_number, &width_in_pixels, &height_in_pixels); if (err != NPERR_NO_ERROR) return false; DCHECK(width_in_pixels && height_in_pixels); page_dimensions->SetSize(width_in_pixels, height_in_pixels); return true; } ",0 "static inline int simulate_ll(struct pt_regs *regs, unsigned int opcode) { unsigned long value, __user *vaddr; long offset; /* * analyse the ll instruction that just caused a ri exception * and put the referenced address to addr. */ /* sign extend offset */ offset = opcode & OFFSET; offset <<= 16; offset >>= 16; vaddr = (unsigned long __user *) ((unsigned long)(regs->regs[(opcode & BASE) >> 21]) + offset); if ((unsigned long)vaddr & 3) return SIGBUS; if (get_user(value, vaddr)) return SIGSEGV; preempt_disable(); if (ll_task == NULL || ll_task == current) { ll_bit = 1; } else { ll_bit = 0; } ll_task = current; preempt_enable(); regs->regs[(opcode & RT) >> 16] = value; return 0; } ",0 " void ClearServerData(syncable::MutableEntry* entry) { entry->Put(SERVER_NON_UNIQUE_NAME, """"); entry->Put(SERVER_PARENT_ID, syncable::GetNullId()); entry->Put(SERVER_MTIME, Time()); entry->Put(SERVER_CTIME, Time()); entry->Put(SERVER_VERSION, 0); entry->Put(SERVER_IS_DIR, false); entry->Put(SERVER_IS_DEL, false); entry->Put(IS_UNAPPLIED_UPDATE, false); entry->Put(SERVER_SPECIFICS, sync_pb::EntitySpecifics::default_instance()); entry->Put(SERVER_POSITION_IN_PARENT, 0); } ",1 "pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud) { return NULL; } ",0 "perf_cgroup_defer_enabled(struct perf_event *event) { /* * when the current task's perf cgroup does not match * the event's, we need to remember to call the * perf_mark_enable() function the first time a task with * a matching perf cgroup is scheduled in. */ if (is_cgroup_event(event) && !perf_cgroup_match(event)) event->cgrp_defer_enabled = 1; } ",0 "ImageStream::ImageStream(Stream *strA, int widthA, int nCompsA, int nBitsA) { int imgLineSize; str = strA; width = widthA; nComps = nCompsA; nBits = nBitsA; nVals = width * nComps; inputLineSize = (nVals * nBits + 7) >> 3; if (nBits <= 0 || nVals > INT_MAX / nBits - 7) { inputLineSize = -1; } inputLine = (Guchar *)gmallocn_checkoverflow(inputLineSize, sizeof(char)); if (nBits == 8) { imgLine = (Guchar *)inputLine; } else { if (nBits == 1) { imgLineSize = (nVals + 7) & ~7; } else { imgLineSize = nVals; } if (width > INT_MAX / nComps) { imgLineSize = -1; } imgLine = (Guchar *)gmallocn(imgLineSize, sizeof(Guchar)); } imgIdx = nVals; } ",0 "PHP_METHOD(Phar, convertToExecutable) { char *ext = NULL; int is_data, ext_len = 0; php_uint32 flags; zval *ret; /* a number that is not 0, 1 or 2 (Which is also Greg's birthday, so there) */ long format = 9021976, method = 9021976; PHAR_ARCHIVE_OBJECT(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""|lls"", &format, &method, &ext, &ext_len) == FAILURE) { return; } if (PHAR_G(readonly)) { zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, ""Cannot write out executable phar archive, phar is read-only""); return; } switch (format) { case 9021976: case PHAR_FORMAT_SAME: /* null is converted to 0 */ /* by default, use the existing format */ if (phar_obj->arc.archive->is_tar) { format = PHAR_FORMAT_TAR; } else if (phar_obj->arc.archive->is_zip) { format = PHAR_FORMAT_ZIP; } else { format = PHAR_FORMAT_PHAR; } break; case PHAR_FORMAT_PHAR: case PHAR_FORMAT_TAR: case PHAR_FORMAT_ZIP: break; default: zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, ""Unknown file format specified, please pass one of Phar::PHAR, Phar::TAR or Phar::ZIP""); return; } switch (method) { case 9021976: flags = phar_obj->arc.archive->flags & PHAR_FILE_COMPRESSION_MASK; break; case 0: flags = PHAR_FILE_COMPRESSED_NONE; break; case PHAR_ENT_COMPRESSED_GZ: if (format == PHAR_FORMAT_ZIP) { zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, ""Cannot compress entire archive with gzip, zip archives do not support whole-archive compression""); return; } if (!PHAR_G(has_zlib)) { zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, ""Cannot compress entire archive with gzip, enable ext/zlib in php.ini""); return; } flags = PHAR_FILE_COMPRESSED_GZ; break; case PHAR_ENT_COMPRESSED_BZ2: if (format == PHAR_FORMAT_ZIP) { zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, ""Cannot compress entire archive with bz2, zip archives do not support whole-archive compression""); return; } if (!PHAR_G(has_bz2)) { zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, ""Cannot compress entire archive with bz2, enable ext/bz2 in php.ini""); return; } flags = PHAR_FILE_COMPRESSED_BZ2; break; default: zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, ""Unknown compression specified, please pass one of Phar::GZ or Phar::BZ2""); return; } is_data = phar_obj->arc.archive->is_data; phar_obj->arc.archive->is_data = 0; ret = phar_convert_to_other(phar_obj->arc.archive, format, ext, flags TSRMLS_CC); phar_obj->arc.archive->is_data = is_data; if (ret) { RETURN_ZVAL(ret, 1, 1); } else { RETURN_NULL(); } } ",0 "static int tcp_v6_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key, struct sock *sk, struct request_sock *req, struct sk_buff *skb) { const struct in6_addr *saddr, *daddr; struct tcp_md5sig_pool *hp; struct hash_desc *desc; struct tcphdr *th = tcp_hdr(skb); if (sk) { saddr = &inet6_sk(sk)->saddr; daddr = &inet6_sk(sk)->daddr; } else if (req) { saddr = &inet6_rsk(req)->loc_addr; daddr = &inet6_rsk(req)->rmt_addr; } else { const struct ipv6hdr *ip6h = ipv6_hdr(skb); saddr = &ip6h->saddr; daddr = &ip6h->daddr; } hp = tcp_get_md5sig_pool(); if (!hp) goto clear_hash_noput; desc = &hp->md5_desc; if (crypto_hash_init(desc)) goto clear_hash; if (tcp_v6_md5_hash_pseudoheader(hp, daddr, saddr, skb->len)) goto clear_hash; if (tcp_md5_hash_header(hp, th)) goto clear_hash; if (tcp_md5_hash_skb_data(hp, skb, th->doff << 2)) goto clear_hash; if (tcp_md5_hash_key(hp, key)) goto clear_hash; if (crypto_hash_final(desc, md5_hash)) goto clear_hash; tcp_put_md5sig_pool(); return 0; clear_hash: tcp_put_md5sig_pool(); clear_hash_noput: memset(md5_hash, 0, 16); return 1; } ",0 "static v8::Handle convert4Callback(const v8::Arguments& args) { INC_STATS(""DOM.TestObj.convert4""); if (args.Length() < 1) return V8Proxy::throwNotEnoughArgumentsError(); TestObj* imp = V8TestObj::toNative(args.Holder()); EXCEPTION_BLOCK(d*, , V8d::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8d::toNative(v8::Handle::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0); imp->convert4(); return v8::Handle(); } ",1 "int evm_inode_removexattr(struct dentry *dentry, const char *xattr_name) { return evm_protect_xattr(dentry, xattr_name, NULL, 0); } ",0 "static int rtl8150_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd) { rtl8150_t *dev = netdev_priv(netdev); u16 *data = (u16 *) & rq->ifr_ifru; int res = 0; switch (cmd) { case SIOCDEVPRIVATE: data[0] = dev->phy; case SIOCDEVPRIVATE + 1: read_mii_word(dev, dev->phy, (data[1] & 0x1f), &data[3]); break; case SIOCDEVPRIVATE + 2: if (!capable(CAP_NET_ADMIN)) return -EPERM; write_mii_word(dev, dev->phy, (data[1] & 0x1f), data[2]); break; default: res = -EOPNOTSUPP; } return res; } ",0 "static int afpClose(sqlite3_file *id) { int rc = SQLITE_OK; unixFile *pFile = (unixFile*)id; assert( id!=0 ); afpUnlock(id, NO_LOCK); assert( unixFileMutexNotheld(pFile) ); unixEnterMutex(); if( pFile->pInode ){ unixInodeInfo *pInode = pFile->pInode; sqlite3_mutex_enter(pInode->pLockMutex); if( pInode->nLock ){ /* If there are outstanding locks, do not actually close the file just ** yet because that would clear those locks. Instead, add the file ** descriptor to pInode->aPending. It will be automatically closed when ** the last lock is cleared. */ setPendingFd(pFile); } sqlite3_mutex_leave(pInode->pLockMutex); } releaseInodeInfo(pFile); sqlite3_free(pFile->lockingContext); rc = closeUnixFile(id); unixLeaveMutex(); return rc; } ",0 "static void ptt_on(struct net_device *dev) { outb(PTT_ON, MCR(dev->base_addr)); } ",0 "error::Error GLES2DecoderPassthroughImpl::DoCreateAndConsumeTextureINTERNAL( GLuint texture_client_id, const volatile GLbyte* mailbox) { if (!texture_client_id || resources_->texture_id_map.HasClientID(texture_client_id)) { return error::kInvalidArguments; } const Mailbox& mb = Mailbox::FromVolatile( *reinterpret_cast(mailbox)); scoped_refptr texture = TexturePassthrough::CheckedCast( group_->mailbox_manager()->ConsumeTexture(mb)); if (texture == nullptr) { DoGenTextures(1, &texture_client_id); InsertError(GL_INVALID_OPERATION, ""Invalid mailbox name.""); return error::kNoError; } resources_->texture_id_map.RemoveClientID(texture_client_id); resources_->texture_id_map.SetIDMapping(texture_client_id, texture->service_id()); resources_->texture_object_map.RemoveClientID(texture_client_id); resources_->texture_object_map.SetIDMapping(texture_client_id, texture); return error::kNoError; } ",0 " void MaybeRestoreIBusConfig() { if (!ibus_) { return; } MaybeDestroyIBusConfig(); if (!ibus_config_) { GDBusConnection* ibus_connection = ibus_bus_get_connection(ibus_); if (!ibus_connection) { LOG(INFO) << ""Couldn't create an ibus config object since "" << ""IBus connection is not ready.""; return; } const gboolean disconnected = g_dbus_connection_is_closed(ibus_connection); if (disconnected) { LOG(ERROR) << ""Couldn't create an ibus config object since "" << ""IBus connection is closed.""; return; } ibus_config_ = ibus_config_new(ibus_connection, NULL /* do not cancel the operation */, NULL /* do not get error information */); if (!ibus_config_) { LOG(ERROR) << ""ibus_config_new() failed. ibus-memconf is not ready?""; return; } g_object_ref(ibus_config_); LOG(INFO) << ""ibus_config_ is ready.""; } } ",1 "void WebContentsImpl::NotifySwappedFromRenderManager(RenderViewHost* rvh) { NotifySwapped(rvh); if (delegate_) view_->SetOverscrollControllerEnabled(delegate_->CanOverscrollContent()); view_->RenderViewSwappedIn(render_manager_.current_host()); FrameTreeNode* root = NULL; RenderViewHostImpl* new_rvh = static_cast( render_manager_.current_host()); if (new_rvh->main_frame_id() != -1) root = new FrameTreeNode(new_rvh->main_frame_id(), std::string()); frame_tree_root_.reset(root); } ",0 "static int iucv_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len) { struct sock *sk = sock->sk; struct iucv_sock *iucv = iucv_sk(sk); struct sk_buff *skb; struct iucv_message txmsg; struct cmsghdr *cmsg; int cmsg_done; long timeo; char user_id[9]; char appl_id[9]; int err; int noblock = msg->msg_flags & MSG_DONTWAIT; err = sock_error(sk); if (err) return err; if (msg->msg_flags & MSG_OOB) return -EOPNOTSUPP; /* SOCK_SEQPACKET: we do not support segmented records */ if (sk->sk_type == SOCK_SEQPACKET && !(msg->msg_flags & MSG_EOR)) return -EOPNOTSUPP; lock_sock(sk); if (sk->sk_shutdown & SEND_SHUTDOWN) { err = -EPIPE; goto out; } /* Return if the socket is not in connected state */ if (sk->sk_state != IUCV_CONNECTED) { err = -ENOTCONN; goto out; } /* initialize defaults */ cmsg_done = 0; /* check for duplicate headers */ txmsg.class = 0; /* iterate over control messages */ for (cmsg = CMSG_FIRSTHDR(msg); cmsg; cmsg = CMSG_NXTHDR(msg, cmsg)) { if (!CMSG_OK(msg, cmsg)) { err = -EINVAL; goto out; } if (cmsg->cmsg_level != SOL_IUCV) continue; if (cmsg->cmsg_type & cmsg_done) { err = -EINVAL; goto out; } cmsg_done |= cmsg->cmsg_type; switch (cmsg->cmsg_type) { case SCM_IUCV_TRGCLS: if (cmsg->cmsg_len != CMSG_LEN(TRGCLS_SIZE)) { err = -EINVAL; goto out; } /* set iucv message target class */ memcpy(&txmsg.class, (void *) CMSG_DATA(cmsg), TRGCLS_SIZE); break; default: err = -EINVAL; goto out; break; } } /* allocate one skb for each iucv message: * this is fine for SOCK_SEQPACKET (unless we want to support * segmented records using the MSG_EOR flag), but * for SOCK_STREAM we might want to improve it in future */ if (iucv->transport == AF_IUCV_TRANS_HIPER) skb = sock_alloc_send_skb(sk, len + sizeof(struct af_iucv_trans_hdr) + ETH_HLEN, noblock, &err); else skb = sock_alloc_send_skb(sk, len, noblock, &err); if (!skb) { err = -ENOMEM; goto out; } if (iucv->transport == AF_IUCV_TRANS_HIPER) skb_reserve(skb, sizeof(struct af_iucv_trans_hdr) + ETH_HLEN); if (memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len)) { err = -EFAULT; goto fail; } /* wait if outstanding messages for iucv path has reached */ timeo = sock_sndtimeo(sk, noblock); err = iucv_sock_wait(sk, iucv_below_msglim(sk), timeo); if (err) goto fail; /* return -ECONNRESET if the socket is no longer connected */ if (sk->sk_state != IUCV_CONNECTED) { err = -ECONNRESET; goto fail; } /* increment and save iucv message tag for msg_completion cbk */ txmsg.tag = iucv->send_tag++; IUCV_SKB_CB(skb)->tag = txmsg.tag; if (iucv->transport == AF_IUCV_TRANS_HIPER) { atomic_inc(&iucv->msg_sent); err = afiucv_hs_send(&txmsg, sk, skb, 0); if (err) { atomic_dec(&iucv->msg_sent); goto fail; } goto release; } skb_queue_tail(&iucv->send_skb_q, skb); if (((iucv->path->flags & IUCV_IPRMDATA) & iucv->flags) && skb->len <= 7) { err = iucv_send_iprm(iucv->path, &txmsg, skb); /* on success: there is no message_complete callback * for an IPRMDATA msg; remove skb from send queue */ if (err == 0) { skb_unlink(skb, &iucv->send_skb_q); kfree_skb(skb); } /* this error should never happen since the * IUCV_IPRMDATA path flag is set... sever path */ if (err == 0x15) { pr_iucv->path_sever(iucv->path, NULL); skb_unlink(skb, &iucv->send_skb_q); err = -EPIPE; goto fail; } } else err = pr_iucv->message_send(iucv->path, &txmsg, 0, 0, (void *) skb->data, skb->len); if (err) { if (err == 3) { user_id[8] = 0; memcpy(user_id, iucv->dst_user_id, 8); appl_id[8] = 0; memcpy(appl_id, iucv->dst_name, 8); pr_err(""Application %s on z/VM guest %s"" "" exceeds message limit\n"", appl_id, user_id); err = -EAGAIN; } else err = -EPIPE; skb_unlink(skb, &iucv->send_skb_q); goto fail; } release: release_sock(sk); return len; fail: kfree_skb(skb); out: release_sock(sk); return err; } ",0 "void StoragePartitionImpl::DeletionHelperDone(base::OnceClosure callback) { std::move(callback).Run(); deletion_helpers_running_--; if (on_deletion_helpers_done_callback_ && deletion_helpers_running_ == 0) { std::move(on_deletion_helpers_done_callback_).Run(); } } ",0 "static struct sk_buff *br_multicast_alloc_query(struct net_bridge *br, struct br_ip *addr) { switch (addr->proto) { case htons(ETH_P_IP): return br_ip4_multicast_alloc_query(br, addr->u.ip4); #if IS_ENABLED(CONFIG_IPV6) case htons(ETH_P_IPV6): return br_ip6_multicast_alloc_query(br, &addr->u.ip6); #endif } return NULL; } ",0 "static u64 vmx_compute_tsc_offset(struct kvm_vcpu *vcpu, u64 target_tsc) { return target_tsc - native_read_tsc(); } ",0 "static void php_session_save_current_state(TSRMLS_D) /* {{{ */ { int ret = FAILURE; IF_SESSION_VARS() { if (PS(mod_data) || PS(mod_user_implemented)) { char *val; int vallen; val = php_session_encode(&vallen TSRMLS_CC); if (val) { ret = PS(mod)->s_write(&PS(mod_data), PS(id), val, vallen TSRMLS_CC); efree(val); } else { ret = PS(mod)->s_write(&PS(mod_data), PS(id), """", 0 TSRMLS_CC); } } if (ret == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Failed to write session data (%s). Please "" ""verify that the current setting of session.save_path "" ""is correct (%s)"", PS(mod)->s_name, PS(save_path)); } } if (PS(mod_data) || PS(mod_user_implemented)) { PS(mod)->s_close(&PS(mod_data) TSRMLS_CC); } } /* }}} */ ",0 "MODRET set_rootrevoke(cmd_rec *cmd) { int root_revoke = -1; config_rec *c = NULL; CHECK_ARGS(cmd, 1); CHECK_CONF(cmd, CONF_ROOT|CONF_VIRTUAL|CONF_GLOBAL|CONF_ANON); /* A RootRevoke value of 0 indicates 'false', 1 indicates 'true', and * 2 indicates 'NonCompliantActiveTransfer'. */ root_revoke = get_boolean(cmd, 1); if (root_revoke == -1) { if (strcasecmp(cmd->argv[1], ""UseNonCompliantActiveTransfer"") != 0 && strcasecmp(cmd->argv[1], ""UseNonCompliantActiveTransfers"") != 0) { CONF_ERROR(cmd, ""expected Boolean parameter""); } root_revoke = 2; } c = add_config_param(cmd->argv[0], 1, NULL); c->argv[0] = pcalloc(c->pool, sizeof(unsigned char)); *((unsigned char *) c->argv[0]) = (unsigned char) root_revoke; c->flags |= CF_MERGEDOWN; return PR_HANDLED(cmd); } ",0 "std::string PrintPropList(IBusPropList *prop_list, int tree_level) { if (!prop_list) { return """"; } std::stringstream stream; for (int i = 0;; ++i) { IBusProperty* prop = ibus_prop_list_get(prop_list, i); if (!prop) { break; } stream << PrintProp(prop, tree_level); } return stream.str(); } ",0 "static bt_status_t get_protocol (bt_bdaddr_t *bd_addr, bthh_protocol_mode_t protocolMode) { CHECK_BTHH_INIT(); btif_hh_device_t *p_dev; BD_ADDR* bda = (BD_ADDR*) bd_addr; UNUSED(protocolMode); BTIF_TRACE_DEBUG("" addr = %02X:%02X:%02X:%02X:%02X:%02X"", (*bda)[0], (*bda)[1], (*bda)[2], (*bda)[3], (*bda)[4], (*bda)[5]); if (btif_hh_cb.status == BTIF_HH_DISABLED) { BTIF_TRACE_ERROR(""%s: Error, HH status = %d"", __FUNCTION__, btif_hh_cb.status); return BT_STATUS_FAIL; } p_dev = btif_hh_find_connected_dev_by_bda(bd_addr); if (p_dev != NULL) { BTA_HhGetProtoMode(p_dev->dev_handle); } else { return BT_STATUS_FAIL; } return BT_STATUS_SUCCESS; } ",0 "AudioFlinger::EffectModule::~EffectModule() { ALOGV(""Destructor %p"", this); if (mEffectInterface != NULL) { remove_effect_from_hal_l(); EffectRelease(mEffectInterface); } } ",0 "static void ip6_copy_metadata(struct sk_buff *to, struct sk_buff *from) { to->pkt_type = from->pkt_type; to->priority = from->priority; to->protocol = from->protocol; skb_dst_drop(to); skb_dst_set(to, dst_clone(skb_dst(from))); to->dev = from->dev; to->mark = from->mark; #ifdef CONFIG_NET_SCHED to->tc_index = from->tc_index; #endif nf_copy(to, from); #if defined(CONFIG_NETFILTER_XT_TARGET_TRACE) || \ defined(CONFIG_NETFILTER_XT_TARGET_TRACE_MODULE) to->nf_trace = from->nf_trace; #endif skb_copy_secmark(to, from); } ",0 "void WebRuntimeFeatures::enableOverlayScrollbars(bool enable) { RuntimeEnabledFeatures::setOverlayScrollbarsEnabled(enable); } ",0 "String Document::readyState() const { DEFINE_STATIC_LOCAL(const String, loading, (""loading"")); DEFINE_STATIC_LOCAL(const String, interactive, (""interactive"")); DEFINE_STATIC_LOCAL(const String, complete, (""complete"")); switch (m_readyState) { case Loading: return loading; case Interactive: return interactive; case Complete: return complete; } ASSERT_NOT_REACHED(); return String(); } ",0 "void MediaControlToggleClosedCaptionsButtonElement::defaultEventHandler( Event* event) { if (event->type() == EventTypeNames::click) { if (mediaElement().textTracks()->length() == 1) { if (mediaElement().textTracks()->hasShowingTracks()) { mediaControls().disableShowingTextTracks(); } else { mediaControls().showTextTrackAtIndex(0); } } else { mediaControls().toggleTextTrackList(); } updateDisplayType(); event->setDefaultHandled(); } MediaControlInputElement::defaultEventHandler(event); } ",0 "bool HevcParameterSets::findParam64(uint32_t key, uint64_t *param) { return findParam(key, param, mParams); } ",0 "autofill::AutofillDriver* PasswordAutofillManager::GetAutofillDriver() { return password_manager_driver_->GetAutofillDriver(); } ",0 "static struct inode *nfs_alloc_inode(struct super_block *sb) { struct nfs_inode *node; node = xzalloc(sizeof(*node)); if (!node) return NULL; return &node->inode; } ",0 "void SandboxIPCHandler::HandleFontMatchRequest( int fd, base::PickleIterator iter, const std::vector& fds) { SkFontStyle requested_style; std::string family; if (!iter.ReadString(&family) || !skia::ReadSkFontStyle(&iter, &requested_style)) return; SkFontConfigInterface::FontIdentity result_identity; SkString result_family; SkFontStyle result_style; SkFontConfigInterface* fc = SkFontConfigInterface::GetSingletonDirectInterface(); const bool r = fc->matchFamilyName(family.c_str(), requested_style, &result_identity, &result_family, &result_style); base::Pickle reply; if (!r) { reply.WriteBool(false); } else { int index = FindOrAddPath(result_identity.fString); result_identity.fID = static_cast(index); reply.WriteBool(true); skia::WriteSkString(&reply, result_family); skia::WriteSkFontIdentity(&reply, result_identity); skia::WriteSkFontStyle(&reply, result_style); } SendRendererReply(fds, reply, -1); } ",0 "bool mem_cgroup_reclaimable(struct mem_cgroup *memcg, bool noswap) { int nid; /* * quick check...making use of scan_node. * We can skip unused nodes. */ if (!nodes_empty(memcg->scan_nodes)) { for (nid = first_node(memcg->scan_nodes); nid < MAX_NUMNODES; nid = next_node(nid, memcg->scan_nodes)) { if (test_mem_cgroup_node_reclaimable(memcg, nid, noswap)) return true; } } /* * Check rest of nodes. */ for_each_node_state(nid, N_HIGH_MEMORY) { if (node_isset(nid, memcg->scan_nodes)) continue; if (test_mem_cgroup_node_reclaimable(memcg, nid, noswap)) return true; } return false; } ",0 "static int sample_conv_q_prefered(const struct arg *args, struct sample *smp) { const char *al = smp->data.str.str; const char *end = al + smp->data.str.len; const char *token; int toklen; int qvalue; const char *str; const char *w; int best_q = 0; /* Set the constant to the sample, because the output of the * function will be peek in the constant configuration string. */ smp->flags |= SMP_F_CONST; smp->data.str.size = 0; smp->data.str.str = """"; smp->data.str.len = 0; /* Parse the accept language */ while (1) { /* Jump spaces, quit if the end is detected. */ while (al < end && isspace((unsigned char)*al)) al++; if (al >= end) break; /* Start of the fisrt word. */ token = al; /* Look for separator: isspace(), ',' or ';'. Next value if 0 length word. */ while (al < end && *al != ';' && *al != ',' && !isspace((unsigned char)*al)) al++; if (al == token) goto expect_comma; /* Length of the token. */ toklen = al - token; qvalue = 1000; /* Check if the token exists in the list. If the token not exists, * jump to the next token. */ str = args[0].data.str.str; w = str; while (1) { if (*str == ';' || *str == '\0') { if (language_range_match(token, toklen, w, str-w)) goto look_for_q; if (*str == '\0') goto expect_comma; w = str + 1; } str++; } goto expect_comma; look_for_q: /* Jump spaces, quit if the end is detected. */ while (al < end && isspace((unsigned char)*al)) al++; if (al >= end) goto process_value; /* If ',' is found, process the result */ if (*al == ',') goto process_value; /* If the character is different from ';', look * for the end of the header part in best effort. */ if (*al != ';') goto expect_comma; /* Assumes that the char is ';', now expect ""q="". */ al++; /* Jump spaces, process value if the end is detected. */ while (al < end && isspace((unsigned char)*al)) al++; if (al >= end) goto process_value; /* Expect 'q'. If no 'q', continue in best effort */ if (*al != 'q') goto process_value; al++; /* Jump spaces, process value if the end is detected. */ while (al < end && isspace((unsigned char)*al)) al++; if (al >= end) goto process_value; /* Expect '='. If no '=', continue in best effort */ if (*al != '=') goto process_value; al++; /* Jump spaces, process value if the end is detected. */ while (al < end && isspace((unsigned char)*al)) al++; if (al >= end) goto process_value; /* Parse the q value. */ qvalue = parse_qvalue(al, &al); process_value: /* If the new q value is the best q value, then store the associated * language in the response. If qvalue is the biggest value (1000), * break the process. */ if (qvalue > best_q) { smp->data.str.str = (char *)w; smp->data.str.len = str - w; if (qvalue >= 1000) break; best_q = qvalue; } expect_comma: /* Expect comma or end. If the end is detected, quit the loop. */ while (al < end && *al != ',') al++; if (al >= end) break; /* Comma is found, jump it and restart the analyzer. */ al++; } /* Set default value if required. */ if (smp->data.str.len == 0 && args[1].type == ARGT_STR) { smp->data.str.str = args[1].data.str.str; smp->data.str.len = args[1].data.str.len; } /* Return true only if a matching language was found. */ return smp->data.str.len != 0; } ",0 "IntRect ChromeClientImpl::windowResizerRect() const { IntRect result; if (m_webView->client()) result = m_webView->client()->windowResizerRect(); return result; } ",0 "static void bta_pan_callback(tBTA_PAN_EVT event, tBTA_PAN *p_data) { btif_transfer_context(bta_pan_callback_transfer, event, (char*)p_data, sizeof(tBTA_PAN), NULL); } ",0 " void BluetoothDeviceChromeOS::ConnectInternal( bool after_pairing, const base::Closure& callback, const ConnectErrorCallback& error_callback) { VLOG(1) << object_path_.value() << "": Connecting""; DBusThreadManager::Get()->GetBluetoothDeviceClient()-> Connect( object_path_, base::Bind(&BluetoothDeviceChromeOS::OnConnect, weak_ptr_factory_.GetWeakPtr(), after_pairing, callback), base::Bind(&BluetoothDeviceChromeOS::OnConnectError, weak_ptr_factory_.GetWeakPtr(), after_pairing, error_callback)); } ",0 "void au1100fb_fb_rotate(struct fb_info *fbi, int angle) { struct au1100fb_device *fbdev = to_au1100fb_device(fbi); print_dbg(""fb_rotate %p %d"", fbi, angle); if (fbdev && (angle > 0) && !(angle % 90)) { fbdev->regs->lcd_control &= ~LCD_CONTROL_GO; fbdev->regs->lcd_control &= ~(LCD_CONTROL_SM_MASK); fbdev->regs->lcd_control |= ((angle/90) << LCD_CONTROL_SM_BIT); fbdev->regs->lcd_control |= LCD_CONTROL_GO; } } ",0 "void DevToolsWindow::CloseWindow() { DCHECK(IsDocked()); web_contents_->GetRenderViewHost()->FirePageBeforeUnload(false); } ",0 "nfsd4_decode_free_stateid(struct nfsd4_compoundargs *argp, struct nfsd4_free_stateid *free_stateid) { DECODE_HEAD; READ_BUF(sizeof(stateid_t)); free_stateid->fr_stateid.si_generation = be32_to_cpup(p++); COPYMEM(&free_stateid->fr_stateid.si_opaque, sizeof(stateid_opaque_t)); DECODE_TAIL; } ",0 "smp_fetch_http_auth_grp(const struct arg *args, struct sample *smp, const char *kw, void *private) { if (!args || args->type != ARGT_USR) return 0; CHECK_HTTP_MESSAGE_FIRST(); if (!get_http_auth(smp->strm)) return 0; /* if the user does not belong to the userlist or has a wrong password, * report that it unconditionally does not match. Otherwise we return * a string containing the username. */ if (!check_user(args->data.usr, smp->strm->txn->auth.user, smp->strm->txn->auth.pass)) return 0; /* pat_match_auth() will need the user list */ smp->ctx.a[0] = args->data.usr; smp->data.type = SMP_T_STR; smp->flags = SMP_F_CONST; smp->data.u.str.str = smp->strm->txn->auth.user; smp->data.u.str.len = strlen(smp->strm->txn->auth.user); return 1; } ",0 "InspectorPageAgent::BuildObjectForFrameTree(LocalFrame* frame) { std::unique_ptr frame_object = BuildObjectForFrame(frame); std::unique_ptr> subresources = protocol::Array::create(); HeapVector> all_resources = CachedResourcesForFrame(frame, true); for (Resource* cached_resource : all_resources) { std::unique_ptr resource_object = protocol::Page::FrameResource::create() .setUrl(UrlWithoutFragment(cached_resource->Url()).GetString()) .setType(CachedResourceTypeJson(*cached_resource)) .setMimeType(cached_resource->GetResponse().MimeType()) .setContentSize(cached_resource->GetResponse().DecodedBodyLength()) .build(); double last_modified = cached_resource->GetResponse().LastModified(); if (!std::isnan(last_modified)) resource_object->setLastModified(last_modified); if (cached_resource->WasCanceled()) resource_object->setCanceled(true); else if (cached_resource->GetStatus() == ResourceStatus::kLoadError) resource_object->setFailed(true); subresources->addItem(std::move(resource_object)); } HeapVector> all_imports = InspectorPageAgent::ImportsForFrame(frame); for (Document* import : all_imports) { std::unique_ptr resource_object = protocol::Page::FrameResource::create() .setUrl(UrlWithoutFragment(import->Url()).GetString()) .setType(ResourceTypeJson(InspectorPageAgent::kDocumentResource)) .setMimeType(import->SuggestedMIMEType()) .build(); subresources->addItem(std::move(resource_object)); } std::unique_ptr result = protocol::Page::FrameResourceTree::create() .setFrame(std::move(frame_object)) .setResources(std::move(subresources)) .build(); std::unique_ptr> children_array; for (Frame* child = frame->Tree().FirstChild(); child; child = child->Tree().NextSibling()) { if (!child->IsLocalFrame()) continue; if (!children_array) children_array = protocol::Array::create(); children_array->addItem(BuildObjectForFrameTree(ToLocalFrame(child))); } result->setChildFrames(std::move(children_array)); return result; } ",0 "bool venc_dev::venc_set_voptiming_cfg( OMX_U32 TimeIncRes) { struct venc_voptimingcfg vop_timing_cfg; DEBUG_PRINT_LOW(""venc_set_voptiming_cfg: TimeRes = %u"", (unsigned int)TimeIncRes); vop_timing_cfg.voptime_resolution = TimeIncRes; voptimecfg.voptime_resolution = vop_timing_cfg.voptime_resolution; return true; } ",0 " void FetchContext::DispatchWillSendRequest(unsigned long, ResourceRequest&, const ResourceResponse&, const FetchInitiatorInfo&) {} ",1 "content::WebUIDataSource* CreateWebUIDataSource() { content::WebUIDataSource* source = content::WebUIDataSource::Create(chrome::kChromeUIInlineLoginHost); source->SetUseJsonJSFormatV2(); source->SetJsonPath(""strings.js""); source->SetDefaultResource(IDR_INLINE_LOGIN_HTML); source->AddResourcePath(""inline_login.css"", IDR_INLINE_LOGIN_CSS); source->AddResourcePath(""inline_login.js"", IDR_INLINE_LOGIN_JS); return source; }; ",0 "g_proxy_list_free (DBusGProxyList *list) { /* we don't hold a reference to the proxies in the list, * as they ref the GProxyManager */ g_slist_free (list->proxies); g_free (list); } ",0 "static void longSequenceAttrAttrSetter(v8::Local name, v8::Local value, const v8::AccessorInfo& info) { INC_STATS(""DOM.TestObj.longSequenceAttr._set""); TestObj* imp = V8TestObj::toNative(info.Holder()); Vector v = toNativeArray(value); imp->setLongSequenceAttr(v); return; } ",0 "void Document::write(const String& text, Document* enteredDocument, ExceptionState& exceptionState) { write(SegmentedString(text), enteredDocument, exceptionState); } ",0 "int InlineTextBox::lineHeight() const { if (!isText() || !parent()) return 0; if (m_renderer->isBR()) return toRenderBR(m_renderer)->lineHeight(m_firstLine); return parent()->lineHeight(); } ",0 "WebContentsBindingSet* WebContentsImpl::GetBindingSet( const std::string& interface_name) { auto it = binding_sets_.find(interface_name); if (it == binding_sets_.end()) return nullptr; return it->second; } ",0 "void ndp_msgra_router_lifetime_set(struct ndp_msgra *msgra, uint16_t router_lifetime) { msgra->ra->nd_ra_router_lifetime = htons(router_lifetime); } ",0 "static int cx24116_read_snr_esno(struct dvb_frontend *fe, u16 *snr) { struct cx24116_state *state = fe->demodulator_priv; dprintk(""%s()\n"", __func__); *snr = cx24116_readreg(state, CX24116_REG_QUALITY8) << 8 | cx24116_readreg(state, CX24116_REG_QUALITY0); dprintk(""%s: raw 0x%04x\n"", __func__, *snr); return 0; } ",0 "void InspectorPageAgent::setEmulatedMedia(ErrorString*, const String& media) { String currentMedia = m_state->getString(PageAgentState::pageAgentEmulatedMedia); if (media == currentMedia) return; m_state->setString(PageAgentState::pageAgentEmulatedMedia, media); Document* document = 0; if (m_page->mainFrame()) document = m_page->mainFrame()->document(); if (document) { document->mediaQueryAffectingValueChanged(); document->styleResolverChanged(RecalcStyleImmediately); document->updateLayout(); } } ",0 "void PlatformSensorProviderBase::NotifySensorCreated( mojom::SensorType type, scoped_refptr sensor) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(!ContainsKey(sensor_map_, type)); DCHECK(ContainsKey(requests_map_, type)); if (sensor) sensor_map_[type] = sensor.get(); auto it = requests_map_.find(type); CallbackQueue callback_queue = it->second; requests_map_.erase(type); FreeResourcesIfNeeded(); for (auto& callback : callback_queue) callback.Run(sensor); } ",0 "static int boco_set_bits(u8 reg, u8 flags) { int ret; u8 regval; /* give access to the EEPROM from FPGA */ ret = i2c_read(BOCO_ADDR, reg, 1, ®val, 1); if (ret) { printf(""%s: error reading the BOCO @%#x !!\n"", __func__, reg); return ret; } regval |= flags; ret = i2c_write(BOCO_ADDR, reg, 1, ®val, 1); if (ret) { printf(""%s: error writing the BOCO @%#x !!\n"", __func__, reg); return ret; } return 0; } ",0 "static int f_midi_bind(struct usb_configuration *c, struct usb_function *f) { struct usb_descriptor_header **midi_function; struct usb_midi_in_jack_descriptor jack_in_ext_desc[MAX_PORTS]; struct usb_midi_in_jack_descriptor jack_in_emb_desc[MAX_PORTS]; struct usb_midi_out_jack_descriptor_1 jack_out_ext_desc[MAX_PORTS]; struct usb_midi_out_jack_descriptor_1 jack_out_emb_desc[MAX_PORTS]; struct usb_composite_dev *cdev = c->cdev; struct f_midi *midi = func_to_midi(f); struct usb_string *us; int status, n, jack = 1, i = 0, endpoint_descriptor_index = 0; midi->gadget = cdev->gadget; tasklet_init(&midi->tasklet, f_midi_in_tasklet, (unsigned long) midi); status = f_midi_register_card(midi); if (status < 0) goto fail_register; /* maybe allocate device-global string ID */ us = usb_gstrings_attach(c->cdev, midi_strings, ARRAY_SIZE(midi_string_defs)); if (IS_ERR(us)) { status = PTR_ERR(us); goto fail; } ac_interface_desc.iInterface = us[STRING_FUNC_IDX].id; /* We have two interfaces, AudioControl and MIDIStreaming */ status = usb_interface_id(c, f); if (status < 0) goto fail; ac_interface_desc.bInterfaceNumber = status; status = usb_interface_id(c, f); if (status < 0) goto fail; ms_interface_desc.bInterfaceNumber = status; ac_header_desc.baInterfaceNr[0] = status; midi->ms_id = status; status = -ENODEV; /* allocate instance-specific endpoints */ midi->in_ep = usb_ep_autoconfig(cdev->gadget, &bulk_in_desc); if (!midi->in_ep) goto fail; midi->out_ep = usb_ep_autoconfig(cdev->gadget, &bulk_out_desc); if (!midi->out_ep) goto fail; /* allocate temporary function list */ midi_function = kcalloc((MAX_PORTS * 4) + 11, sizeof(*midi_function), GFP_KERNEL); if (!midi_function) { status = -ENOMEM; goto fail; } /* * construct the function's descriptor set. As the number of * input and output MIDI ports is configurable, we have to do * it that way. */ /* add the headers - these are always the same */ midi_function[i++] = (struct usb_descriptor_header *) &ac_interface_desc; midi_function[i++] = (struct usb_descriptor_header *) &ac_header_desc; midi_function[i++] = (struct usb_descriptor_header *) &ms_interface_desc; /* calculate the header's wTotalLength */ n = USB_DT_MS_HEADER_SIZE + (midi->in_ports + midi->out_ports) * (USB_DT_MIDI_IN_SIZE + USB_DT_MIDI_OUT_SIZE(1)); ms_header_desc.wTotalLength = cpu_to_le16(n); midi_function[i++] = (struct usb_descriptor_header *) &ms_header_desc; /* configure the external IN jacks, each linked to an embedded OUT jack */ for (n = 0; n < midi->in_ports; n++) { struct usb_midi_in_jack_descriptor *in_ext = &jack_in_ext_desc[n]; struct usb_midi_out_jack_descriptor_1 *out_emb = &jack_out_emb_desc[n]; in_ext->bLength = USB_DT_MIDI_IN_SIZE; in_ext->bDescriptorType = USB_DT_CS_INTERFACE; in_ext->bDescriptorSubtype = USB_MS_MIDI_IN_JACK; in_ext->bJackType = USB_MS_EXTERNAL; in_ext->bJackID = jack++; in_ext->iJack = 0; midi_function[i++] = (struct usb_descriptor_header *) in_ext; out_emb->bLength = USB_DT_MIDI_OUT_SIZE(1); out_emb->bDescriptorType = USB_DT_CS_INTERFACE; out_emb->bDescriptorSubtype = USB_MS_MIDI_OUT_JACK; out_emb->bJackType = USB_MS_EMBEDDED; out_emb->bJackID = jack++; out_emb->bNrInputPins = 1; out_emb->pins[0].baSourcePin = 1; out_emb->pins[0].baSourceID = in_ext->bJackID; out_emb->iJack = 0; midi_function[i++] = (struct usb_descriptor_header *) out_emb; /* link it to the endpoint */ ms_in_desc.baAssocJackID[n] = out_emb->bJackID; } /* configure the external OUT jacks, each linked to an embedded IN jack */ for (n = 0; n < midi->out_ports; n++) { struct usb_midi_in_jack_descriptor *in_emb = &jack_in_emb_desc[n]; struct usb_midi_out_jack_descriptor_1 *out_ext = &jack_out_ext_desc[n]; in_emb->bLength = USB_DT_MIDI_IN_SIZE; in_emb->bDescriptorType = USB_DT_CS_INTERFACE; in_emb->bDescriptorSubtype = USB_MS_MIDI_IN_JACK; in_emb->bJackType = USB_MS_EMBEDDED; in_emb->bJackID = jack++; in_emb->iJack = 0; midi_function[i++] = (struct usb_descriptor_header *) in_emb; out_ext->bLength = USB_DT_MIDI_OUT_SIZE(1); out_ext->bDescriptorType = USB_DT_CS_INTERFACE; out_ext->bDescriptorSubtype = USB_MS_MIDI_OUT_JACK; out_ext->bJackType = USB_MS_EXTERNAL; out_ext->bJackID = jack++; out_ext->bNrInputPins = 1; out_ext->iJack = 0; out_ext->pins[0].baSourceID = in_emb->bJackID; out_ext->pins[0].baSourcePin = 1; midi_function[i++] = (struct usb_descriptor_header *) out_ext; /* link it to the endpoint */ ms_out_desc.baAssocJackID[n] = in_emb->bJackID; } /* configure the endpoint descriptors ... */ ms_out_desc.bLength = USB_DT_MS_ENDPOINT_SIZE(midi->in_ports); ms_out_desc.bNumEmbMIDIJack = midi->in_ports; ms_in_desc.bLength = USB_DT_MS_ENDPOINT_SIZE(midi->out_ports); ms_in_desc.bNumEmbMIDIJack = midi->out_ports; /* ... and add them to the list */ endpoint_descriptor_index = i; midi_function[i++] = (struct usb_descriptor_header *) &bulk_out_desc; midi_function[i++] = (struct usb_descriptor_header *) &ms_out_desc; midi_function[i++] = (struct usb_descriptor_header *) &bulk_in_desc; midi_function[i++] = (struct usb_descriptor_header *) &ms_in_desc; midi_function[i++] = NULL; /* * support all relevant hardware speeds... we expect that when * hardware is dual speed, all bulk-capable endpoints work at * both speeds */ /* copy descriptors, and track endpoint copies */ f->fs_descriptors = usb_copy_descriptors(midi_function); if (!f->fs_descriptors) goto fail_f_midi; if (gadget_is_dualspeed(c->cdev->gadget)) { bulk_in_desc.wMaxPacketSize = cpu_to_le16(512); bulk_out_desc.wMaxPacketSize = cpu_to_le16(512); f->hs_descriptors = usb_copy_descriptors(midi_function); if (!f->hs_descriptors) goto fail_f_midi; } if (gadget_is_superspeed(c->cdev->gadget)) { bulk_in_desc.wMaxPacketSize = cpu_to_le16(1024); bulk_out_desc.wMaxPacketSize = cpu_to_le16(1024); i = endpoint_descriptor_index; midi_function[i++] = (struct usb_descriptor_header *) &bulk_out_desc; midi_function[i++] = (struct usb_descriptor_header *) &bulk_out_ss_comp_desc; midi_function[i++] = (struct usb_descriptor_header *) &ms_out_desc; midi_function[i++] = (struct usb_descriptor_header *) &bulk_in_desc; midi_function[i++] = (struct usb_descriptor_header *) &bulk_in_ss_comp_desc; midi_function[i++] = (struct usb_descriptor_header *) &ms_in_desc; f->ss_descriptors = usb_copy_descriptors(midi_function); if (!f->ss_descriptors) goto fail_f_midi; } kfree(midi_function); return 0; fail_f_midi: kfree(midi_function); usb_free_all_descriptors(f); fail: f_midi_unregister_card(midi); fail_register: ERROR(cdev, ""%s: can't bind, err %d\n"", f->name, status); return status; } ",0 "lvm2_lv_create_device_not_seen_cb (gpointer user_data) { CreateLvm2LVData *data = user_data; throw_error (data->context, ERROR_FAILED, ""Error creating Logical Volume: timeout (10s) waiting for LV to show up""); g_signal_handler_disconnect (data->daemon, data->device_added_signal_handler_id); g_signal_handler_disconnect (data->daemon, data->device_changed_signal_handler_id); lvm2_lv_create_data_unref (data); return FALSE; } ",0 "int o2nm_depend_this_node(void) { int ret = 0; struct o2nm_node *local_node; local_node = o2nm_get_node_by_num(o2nm_this_node()); if (!local_node) { ret = -EINVAL; goto out; } ret = o2nm_depend_item(&local_node->nd_item); o2nm_node_put(local_node); out: return ret; } ",0 "void Document::enforceInsecureRequestPolicy(WebInsecureRequestPolicy policy) { setInsecureRequestPolicy(getInsecureRequestPolicy() | policy); if (frame()) frame()->loader().client()->didEnforceInsecureRequestPolicy(getInsecureRequestPolicy()); } ",0 "fz_make_hash_link_key(fz_context *ctx, fz_store_hash *hash, void *key_) { fz_link_key *key = (fz_link_key *)key_; memcpy(hash->u.link.dst_md5, key->dst_md5, 16); memcpy(hash->u.link.src_md5, key->src_md5, 16); hash->u.link.ri = key->rend.ri; hash->u.link.bp = key->rend.bp; hash->u.link.src_extras = key->src_extras; hash->u.link.dst_extras = key->dst_extras; hash->u.link.bpp16 = key->depth == 2; hash->u.link.proof = key->proof; hash->u.link.copy_spots = key->copy_spots; return 1; } ",0 "PassRefPtr Document::createComment(const String& data) { return Comment::create(*this, data); } ",0 "void WebPageProxy::didReceiveResponseForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceResponse& response) { WebFrameProxy* frame = process()->webFrame(frameID); MESSAGE_CHECK(frame); m_resourceLoadClient.didReceiveResponseForResource(this, frame, resourceIdentifier, response); } ",0 "static bool sta_info_buffer_expired(struct sta_info *sta, struct sk_buff *skb) { struct ieee80211_tx_info *info; int timeout; if (!skb) return false; info = IEEE80211_SKB_CB(skb); /* Timeout: (2 * listen_interval * beacon_int * 1024 / 1000000) sec */ timeout = (sta->listen_interval * sta->sdata->vif.bss_conf.beacon_int * 32 / 15625) * HZ; if (timeout < STA_TX_BUFFER_EXPIRE) timeout = STA_TX_BUFFER_EXPIRE; return time_after(jiffies, info->control.jiffies + timeout); } ",0 "static size_t ZSTD_NCountCost(unsigned const* count, unsigned const max, size_t const nbSeq, unsigned const FSELog) { BYTE wksp[FSE_NCOUNTBOUND]; S16 norm[MaxSeq + 1]; const U32 tableLog = FSE_optimalTableLog(FSELog, nbSeq, max); CHECK_F(FSE_normalizeCount(norm, tableLog, count, nbSeq, max)); return FSE_writeNCount(wksp, sizeof(wksp), norm, max, tableLog); } ",0 "bool AllSamplesPassedQuery::End(base::subtle::Atomic32 submit_count) { EndQueryHelper(target()); return AddToPendingQueue(submit_count); } ",0 "static void methodWithExceptionMethod(const v8::FunctionCallbackInfo& info) { ExceptionState exceptionState(ExceptionState::ExecutionContext, ""methodWithException"", ""TestObject"", info.Holder(), info.GetIsolate()); TestObject* imp = V8TestObject::toNative(info.Holder()); imp->methodWithException(exceptionState); if (exceptionState.throwIfNeeded()) return; } ",0 "cancel_filesystem_info_for_file (NautilusDirectory *directory, NautilusFile *file) { if (directory->details->filesystem_info_state != NULL && directory->details->filesystem_info_state->file == file) { filesystem_info_cancel (directory); } } ",0 " void WebPluginDelegateImpl::DidFinishLoadWithReason(const GURL& url, NPReason reason, intptr_t notify_data) { if (quirks_ & PLUGIN_QUIRK_ALWAYS_NOTIFY_SUCCESS && reason == NPRES_NETWORK_ERR) { reason = NPRES_DONE; } instance()->DidFinishLoadWithReason( url, reason, reinterpret_cast(notify_data)); } ",1 " asmlinkage void bad_mode(struct pt_regs *regs, int reason, unsigned int esr) { console_verbose(); pr_crit(""Bad mode in %s handler detected, code 0x%08x\n"", handler[reason], esr); die(""Oops - bad mode"", regs, 0); local_irq_disable(); panic(""bad mode""); } ",1 "OMX_ERRORTYPE omx_video::push_empty_eos_buffer(OMX_HANDLETYPE hComp, OMX_BUFFERHEADERTYPE* buffer) { OMX_BUFFERHEADERTYPE* opqBuf = NULL; OMX_ERRORTYPE retVal = OMX_ErrorNone; unsigned index = 0; DEBUG_PRINT_LOW(""In push empty eos buffer""); do { if (mUsesColorConversion) { if (pdest_frame) { opqBuf = pdest_frame; pdest_frame = NULL; } else if (m_opq_pmem_q.m_size) { unsigned long address = 0, p2, id; m_opq_pmem_q.pop_entry(&address,&p2,&id); opqBuf = (OMX_BUFFERHEADERTYPE* ) address; } index = opqBuf - m_inp_mem_ptr; } else { opqBuf = (OMX_BUFFERHEADERTYPE* ) buffer; index = opqBuf - meta_buffer_hdr; } if (!opqBuf || index >= m_sInPortDef.nBufferCountActual) { DEBUG_PRINT_ERROR(""push_empty_eos_buffer: Could not find a "" ""color-conversion buffer to queue ! defer until available""); return OMX_ErrorNone; } struct pmem Input_pmem_info; Input_pmem_info.buffer = opqBuf; Input_pmem_info.fd = m_pInput_pmem[index].fd; Input_pmem_info.offset = 0; Input_pmem_info.size = m_pInput_pmem[index].size; if (dev_use_buf(&Input_pmem_info, PORT_INDEX_IN, 0) != true) { DEBUG_PRINT_ERROR(""ERROR: in dev_use_buf for empty eos buffer""); retVal = OMX_ErrorBadParameter; break; } OMX_BUFFERHEADERTYPE emptyEosBufHdr; memcpy(&emptyEosBufHdr, opqBuf, sizeof(OMX_BUFFERHEADERTYPE)); emptyEosBufHdr.nFilledLen = 0; emptyEosBufHdr.nTimeStamp = buffer->nTimeStamp; emptyEosBufHdr.nFlags = buffer->nFlags; emptyEosBufHdr.pBuffer = NULL; if (!mUsesColorConversion) emptyEosBufHdr.nAllocLen = m_sInPortDef.nBufferSize; if (dev_empty_buf(&emptyEosBufHdr, 0, index, m_pInput_pmem[index].fd) != true) { DEBUG_PRINT_ERROR(""ERROR: in dev_empty_buf for empty eos buffer""); dev_free_buf(&Input_pmem_info, PORT_INDEX_IN); retVal = OMX_ErrorBadParameter; break; } mEmptyEosBuffer = opqBuf; } while(false); m_pCallbacks.EmptyBufferDone(hComp, m_app_data, buffer); --pending_input_buffers; return retVal; } ",0 " virtual status_t setTransformHint(uint32_t hint) { Parcel data, reply; data.writeInterfaceToken(IGraphicBufferConsumer::getInterfaceDescriptor()); data.writeUint32(hint); status_t result = remote()->transact(SET_TRANSFORM_HINT, data, &reply); if (result != NO_ERROR) { return result; } return reply.readInt32(); } ",0 "BGD_DECLARE(void) gdImageCopyResampled (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int dstW, int dstH, int srcW, int srcH) { int x, y; if (!dst->trueColor) { gdImageCopyResized (dst, src, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH); return; } for (y = dstY; (y < dstY + dstH); y++) { for (x = dstX; (x < dstX + dstW); x++) { float sy1, sy2, sx1, sx2; float sx, sy; float spixels = 0.0; float red = 0.0, green = 0.0, blue = 0.0, alpha = 0.0; float alpha_factor, alpha_sum = 0.0, contrib_sum = 0.0; sy1 = ((float)(y - dstY)) * (float)srcH / (float)dstH; sy2 = ((float)(y + 1 - dstY)) * (float) srcH / (float) dstH; sy = sy1; do { float yportion; if (floorf(sy) == floorf(sy1)) { yportion = 1.0 - (sy - floorf(sy)); if (yportion > sy2 - sy1) { yportion = sy2 - sy1; } sy = floorf(sy); } else if (sy == floorf(sy2)) { yportion = sy2 - floorf(sy2); } else { yportion = 1.0; } sx1 = ((float)(x - dstX)) * (float) srcW / dstW; sx2 = ((float)(x + 1 - dstX)) * (float) srcW / dstW; sx = sx1; do { float xportion; float pcontribution; int p; if (floorf(sx) == floorf(sx1)) { xportion = 1.0 - (sx - floorf(sx)); if (xportion > sx2 - sx1) { xportion = sx2 - sx1; } sx = floorf(sx); } else if (sx == floorf(sx2)) { xportion = sx2 - floorf(sx2); } else { xportion = 1.0; } pcontribution = xportion * yportion; p = gdImageGetTrueColorPixel(src, (int) sx + srcX, (int) sy + srcY); alpha_factor = ((gdAlphaMax - gdTrueColorGetAlpha(p))) * pcontribution; red += gdTrueColorGetRed (p) * alpha_factor; green += gdTrueColorGetGreen (p) * alpha_factor; blue += gdTrueColorGetBlue (p) * alpha_factor; alpha += gdTrueColorGetAlpha (p) * pcontribution; alpha_sum += alpha_factor; contrib_sum += pcontribution; spixels += xportion * yportion; sx += 1.0; } while (sx < sx2); sy += 1.0f; } while (sy < sy2); if (spixels != 0.0) { red /= spixels; green /= spixels; blue /= spixels; alpha /= spixels; } if ( alpha_sum != 0.0) { if( contrib_sum != 0.0) { alpha_sum /= contrib_sum; } red /= alpha_sum; green /= alpha_sum; blue /= alpha_sum; } /* Clamping to allow for rounding errors above */ if (red > 255.0) { red = 255.0; } if (green > 255.0) { green = 255.0; } if (blue > 255.0f) { blue = 255.0; } if (alpha > gdAlphaMax) { alpha = gdAlphaMax; } gdImageSetPixel(dst, x, y, gdTrueColorAlpha ((int) red, (int) green, (int) blue, (int) alpha)); } } } ",0 "input_gssapi_exchange_complete(int type, u_int32_t plen, struct ssh *ssh) { Authctxt *authctxt = ssh->authctxt; int r, authenticated; const char *displayname; if (authctxt == NULL || (authctxt->methoddata == NULL && !use_privsep)) fatal(""No authentication or GSSAPI context""); /* * We don't need to check the status, because we're only enabled in * the dispatcher once the exchange is complete */ if ((r = sshpkt_get_end(ssh)) != 0) fatal(""%s: %s"", __func__, ssh_err(r)); authenticated = PRIVSEP(ssh_gssapi_userok(authctxt->user)); if ((!use_privsep || mm_is_monitor()) && (displayname = ssh_gssapi_displayname()) != NULL) auth2_record_info(authctxt, ""%s"", displayname); authctxt->postponed = 0; ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_GSSAPI_TOKEN, NULL); ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_GSSAPI_ERRTOK, NULL); ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_GSSAPI_MIC, NULL); ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE, NULL); userauth_finish(ssh, authenticated, ""gssapi-with-mic"", NULL); return 0; } ",0 "blink::WebPlugin* RenderFrameImpl::CreatePlugin( const blink::WebPluginParams& params) { blink::WebPlugin* plugin = nullptr; if (GetContentClient()->renderer()->OverrideCreatePlugin(this, params, &plugin)) { return plugin; } if (params.mime_type.ContainsOnlyASCII() && params.mime_type.Ascii() == kBrowserPluginMimeType) { BrowserPluginDelegate* delegate = GetContentClient()->renderer()->CreateBrowserPluginDelegate( this, WebPluginInfo(), kBrowserPluginMimeType, GURL(params.url)); return BrowserPluginManager::Get()->CreateBrowserPlugin( this, delegate->GetWeakPtr()); } #if BUILDFLAG(ENABLE_PLUGINS) WebPluginInfo info; std::string mime_type; bool found = false; Send(new FrameHostMsg_GetPluginInfo( routing_id_, params.url, frame_->Top()->GetSecurityOrigin(), params.mime_type.Utf8(), &found, &info, &mime_type)); if (!found) return nullptr; WebPluginParams params_to_use = params; params_to_use.mime_type = WebString::FromUTF8(mime_type); return CreatePlugin(info, params_to_use, nullptr /* throttler */); #else return nullptr; #endif // BUILDFLAG(ENABLE_PLUGINS) } ",0 "static int complete_emulated_mmio(struct kvm_vcpu *vcpu) { struct kvm_run *run = vcpu->run; struct kvm_mmio_fragment *frag; unsigned len; BUG_ON(!vcpu->mmio_needed); /* Complete previous fragment */ frag = &vcpu->mmio_fragments[vcpu->mmio_cur_fragment]; len = min(8u, frag->len); if (!vcpu->mmio_is_write) memcpy(frag->data, run->mmio.data, len); if (frag->len <= 8) { /* Switch to the next fragment. */ frag++; vcpu->mmio_cur_fragment++; } else { /* Go forward to the next mmio piece. */ frag->data += len; frag->gpa += len; frag->len -= len; } if (vcpu->mmio_cur_fragment == vcpu->mmio_nr_fragments) { vcpu->mmio_needed = 0; if (vcpu->mmio_is_write) return 1; vcpu->mmio_read_completed = 1; return complete_emulated_io(vcpu); } run->exit_reason = KVM_EXIT_MMIO; run->mmio.phys_addr = frag->gpa; if (vcpu->mmio_is_write) memcpy(run->mmio.data, frag->data, min(8u, frag->len)); run->mmio.len = min(8u, frag->len); run->mmio.is_write = vcpu->mmio_is_write; vcpu->arch.complete_userspace_io = complete_emulated_mmio; return 0; } ",0 "int test_lshift1(BIO *bp) { BIGNUM *a, *b, *c; int i; a = BN_new(); b = BN_new(); c = BN_new(); BN_bntest_rand(a, 200, 0, 0); a->neg = rand_neg(); for (i = 0; i < num0; i++) { BN_lshift1(b, a); if (bp != NULL) { if (!results) { BN_print(bp, a); BIO_puts(bp, "" * 2""); BIO_puts(bp, "" - ""); } BN_print(bp, b); BIO_puts(bp, ""\n""); } BN_add(c, a, a); BN_sub(a, b, c); if (!BN_is_zero(a)) { fprintf(stderr, ""Left shift one test failed!\n""); return 0; } BN_copy(a, b); } BN_free(a); BN_free(b); BN_free(c); return (1); } ",0 " bool NaClProcessHost::StartWithLaunchedProcess() { #if defined(OS_LINUX) if (wait_for_nacl_gdb_) { if (LaunchNaClGdb(base::GetProcId(process_->GetData().handle))) { return true; } DLOG(ERROR) << ""Failed to launch debugger""; } #endif NaClBrowser* nacl_browser = NaClBrowser::GetInstance(); if (nacl_browser->IsReady()) { return SendStart(); } else if (nacl_browser->IsOk()) { nacl_browser->WaitForResources( base::Bind(&NaClProcessHost::OnResourcesReady, weak_factory_.GetWeakPtr())); return true; } else { return false; } } ",0 "CStarter::RemoteContinue(int) { int retval = this->Continue(); jic->Continue(); return retval; } ",0 "void Browser::OnWindowClosing() { if (!ShouldCloseWindow()) return; bool should_quit_if_last_browser = browser_shutdown::IsTryingToQuit() || !browser::WillKeepAlive(); if (should_quit_if_last_browser && BrowserList::size() == 1) browser_shutdown::OnShutdownStarting(browser_shutdown::WINDOW_CLOSE); SessionService* session_service = SessionServiceFactory::GetForProfile(profile()); if (session_service) session_service->WindowClosing(session_id()); TabRestoreService* tab_restore_service = TabRestoreServiceFactory::GetForProfile(profile()); #if defined(USE_AURA) if (tab_restore_service && is_app()) tab_restore_service->BrowserClosing(tab_restore_service_delegate()); #endif if (tab_restore_service && is_type_tabbed() && tab_count()) tab_restore_service->BrowserClosing(tab_restore_service_delegate()); content::NotificationService::current()->Notify( chrome::NOTIFICATION_BROWSER_CLOSING, content::Source(this), content::NotificationService::NoDetails()); chrome::CloseAllTabs(this); } ",0 "GahpClient::cream_delegate(const char *delg_service, const char *delg_id) { static const char* command = ""CREAM_DELEGATE""; if (server->m_commands_supported->contains_anycase(command)==FALSE) { return GAHPCLIENT_COMMAND_NOT_SUPPORTED; } if (!delg_service) delg_service=NULLSTRING; if (!delg_id) delg_id=NULLSTRING; std::string reqline; char *esc1 = strdup( escapeGahpString(delg_service) ); char *esc2 = strdup( escapeGahpString(delg_id) ); int x = sprintf(reqline, ""%s %s"", esc2, esc1); free( esc1 ); free( esc2 ); ASSERT( x > 0 ); const char *buf = reqline.c_str(); if ( !is_pending(command,buf) ) { if ( m_mode == results_only ) { return GAHPCLIENT_COMMAND_NOT_SUBMITTED; } now_pending(command,buf,deleg_proxy,high_prio); } Gahp_Args* result = get_pending_result(command,buf); if ( result ) { if (result->argc != 2) { EXCEPT(""Bad %s Result"",command); } int rc; if (strcmp(result->argv[1], NULLSTRING) == 0) { rc = 0; } else { rc = 1; error_string = result->argv[1]; } delete result; return rc; } if ( check_pending_timeout(command,buf) ) { sprintf( error_string, ""%s timed out"", command ); return GAHPCLIENT_COMMAND_TIMED_OUT; } return GAHPCLIENT_COMMAND_PENDING; } ",0 "static u64 fixed_mtrr_seg_unit_size(int seg) { return 8 << fixed_seg_table[seg].range_shift; } ",0 "void GpuCommandBufferStub::PollWork() { if (decoder_.get()) { if (!decoder_->MakeCurrent()) { DLOG(ERROR) << ""Context lost because MakeCurrent failed.""; command_buffer_->SetContextLostReason(decoder_->GetContextLostReason()); command_buffer_->SetParseError(gpu::error::kLostContext); if (gfx::GLContext::LosesAllContextsOnContextLost()) channel_->LoseAllContexts(); return; } } if (scheduler_.get()) scheduler_->PollUnscheduleFences(); } ",0 "static int set_qf_name(struct super_block *sb, int qtype, substring_t *args) { struct ext4_sb_info *sbi = EXT4_SB(sb); char *qname; int ret = -1; if (sb_any_quota_loaded(sb) && !sbi->s_qf_names[qtype]) { ext4_msg(sb, KERN_ERR, ""Cannot change journaled "" ""quota options when quota turned on""); return -1; } if (ext4_has_feature_quota(sb)) { ext4_msg(sb, KERN_INFO, ""Journaled quota options "" ""ignored when QUOTA feature is enabled""); return 1; } qname = match_strdup(args); if (!qname) { ext4_msg(sb, KERN_ERR, ""Not enough memory for storing quotafile name""); return -1; } if (sbi->s_qf_names[qtype]) { if (strcmp(sbi->s_qf_names[qtype], qname) == 0) ret = 1; else ext4_msg(sb, KERN_ERR, ""%s quota file already specified"", QTYPE2NAME(qtype)); goto errout; } if (strchr(qname, '/')) { ext4_msg(sb, KERN_ERR, ""quotafile must be on filesystem root""); goto errout; } sbi->s_qf_names[qtype] = qname; set_opt(sb, QUOTA); return 1; errout: kfree(qname); return ret; } ",0 "void test_base64_lengths(void) { const char *in = ""FuseMuse""; char out1[32]; char out2[32]; size_t enclen; int declen; /* Encoding a zero-length string should fail */ enclen = mutt_b64_encode(out1, in, 0, 32); if (!TEST_CHECK(enclen == 0)) { TEST_MSG(""Expected: %zu"", 0); TEST_MSG(""Actual : %zu"", enclen); } /* Decoding a zero-length string should fail, too */ out1[0] = '\0'; declen = mutt_b64_decode(out2, out1); if (!TEST_CHECK(declen == -1)) { TEST_MSG(""Expected: %zu"", -1); TEST_MSG(""Actual : %zu"", declen); } /* Encode one to eight bytes, check the lengths of the returned string */ for (size_t i = 1; i <= 8; ++i) { enclen = mutt_b64_encode(out1, in, i, 32); size_t exp = ((i + 2) / 3) << 2; if (!TEST_CHECK(enclen == exp)) { TEST_MSG(""Expected: %zu"", exp); TEST_MSG(""Actual : %zu"", enclen); } declen = mutt_b64_decode(out2, out1); if (!TEST_CHECK(declen == i)) { TEST_MSG(""Expected: %zu"", i); TEST_MSG(""Actual : %zu"", declen); } out2[declen] = '\0'; if (!TEST_CHECK(strncmp(out2, in, i) == 0)) { TEST_MSG(""Expected: %s"", in); TEST_MSG(""Actual : %s"", out2); } } } ",1 "RenderImageResource* ImageLoader::renderImageResource() { RenderObject* renderer = m_element->renderer(); if (!renderer) return 0; if (renderer->isImage() && !static_cast(renderer)->isGeneratedContent()) return toRenderImage(renderer)->imageResource(); #if ENABLE(SVG) if (renderer->isSVGImage()) return toRenderSVGImage(renderer)->imageResource(); #endif if (renderer->isVideo()) return toRenderVideo(renderer)->imageResource(); return 0; } ",0 "void PaintController::FinishCycle() { DCHECK(new_display_item_list_.IsEmpty()); DCHECK(new_paint_chunks_.IsInInitialState()); current_paint_artifact_.FinishCycle(); } ",0 "static void ecdsa_restart_ver_init( mbedtls_ecdsa_restart_ver_ctx *ctx ) { mbedtls_mpi_init( &ctx->u1 ); mbedtls_mpi_init( &ctx->u2 ); ctx->state = ecdsa_ver_init; } ",0 "static void ETagGet_ConditionalRequest_Handler( const net::HttpRequestInfo* request, std::string* response_status, std::string* response_headers, std::string* response_data) { EXPECT_TRUE( request->extra_headers.HasHeader(net::HttpRequestHeaders::kIfNoneMatch)); response_status->assign(""HTTP/1.1 304 Not Modified""); response_headers->assign(kETagGET_Transaction.response_headers); response_data->clear(); } ",0 "static struct socket *vhost_net_stop_vq(struct vhost_net *n, struct vhost_virtqueue *vq) { struct socket *sock; mutex_lock(&vq->mutex); sock = vq->private_data; vhost_net_disable_vq(n, vq); vq->private_data = NULL; mutex_unlock(&vq->mutex); return sock; } ",0 " AudioRendererHostTest() : log_factory(base::MakeUnique()), audio_manager_(base::MakeUnique( base::ThreadTaskRunnerHandle::Get(), log_factory.get())), render_process_host_(&browser_context_, &auth_run_loop_) { base::CommandLine::ForCurrentProcess()->AppendSwitch( switches::kUseFakeDeviceForMediaStream); media_stream_manager_.reset(new MediaStreamManager(audio_manager_.get())); host_ = new MockAudioRendererHost( &auth_run_loop_, render_process_host_.GetID(), audio_manager_.get(), &mirroring_manager_, media_stream_manager_.get(), kSalt); host_->set_peer_process_for_testing(base::Process::Current()); } ",1 "event_create(void) { struct posix_event *ret = mg_malloc(sizeof(struct posix_event)); if (ret == 0) { /* out of memory */ return 0; } if (0 != pthread_mutex_init(&(ret->mutex), NULL)) { /* pthread mutex not available */ mg_free(ret); return 0; } if (0 != pthread_cond_init(&(ret->cond), NULL)) { /* pthread cond not available */ pthread_mutex_destroy(&(ret->mutex)); mg_free(ret); return 0; } return (void *)ret; } ",0 "exsltDateFormatDuration (const exsltDateValDurationPtr dt) { xmlChar buf[100], *cur = buf; double secs, days; double years, months; if (dt == NULL) return NULL; /* quick and dirty check */ if ((dt->sec == 0.0) && (dt->day == 0) && (dt->mon == 0)) return xmlStrdup((xmlChar*)""P0D""); secs = dt->sec; days = (double)dt->day; years = (double)(dt->mon / 12); months = (double)(dt->mon % 12); *cur = '\0'; if (secs < 0.0) { secs = -secs; *cur = '-'; } if (days < 0) { days = -days; *cur = '-'; } if (years < 0) { years = -years; *cur = '-'; } if (months < 0) { months = -months; *cur = '-'; } if (*cur == '-') cur++; *cur++ = 'P'; if (years != 0.0) { FORMAT_ITEM(years, cur, 1, 'Y'); } if (months != 0.0) { FORMAT_ITEM(months, cur, 1, 'M'); } if (secs >= SECS_PER_DAY) { double tmp = floor(secs / SECS_PER_DAY); days += tmp; secs -= (tmp * SECS_PER_DAY); } FORMAT_ITEM(days, cur, 1, 'D'); if (secs > 0.0) { *cur++ = 'T'; } FORMAT_ITEM(secs, cur, SECS_PER_HOUR, 'H'); FORMAT_ITEM(secs, cur, SECS_PER_MIN, 'M'); if (secs > 0.0) { FORMAT_FLOAT(secs, cur, 0); *cur++ = 'S'; } *cur = 0; return xmlStrdup(buf); } ",0 "int i2d_DSAPrivateKey_fp(FILE *fp, DSA *dsa) { return ASN1_i2d_fp_of_const(DSA,i2d_DSAPrivateKey,fp,dsa); } ",0 "static int copy_from_read_buf(struct tty_struct *tty, unsigned char __user **b, size_t *nr) { struct n_tty_data *ldata = tty->disc_data; int retval; size_t n; bool is_eof; size_t head = smp_load_acquire(&ldata->commit_head); size_t tail = ldata->read_tail & (N_TTY_BUF_SIZE - 1); retval = 0; n = min(head - ldata->read_tail, N_TTY_BUF_SIZE - tail); n = min(*nr, n); if (n) { const unsigned char *from = read_buf_addr(ldata, tail); retval = copy_to_user(*b, from, n); n -= retval; is_eof = n == 1 && *from == EOF_CHAR(tty); tty_audit_add_data(tty, from, n); smp_store_release(&ldata->read_tail, ldata->read_tail + n); /* Turn single EOF into zero-length read */ if (L_EXTPROC(tty) && ldata->icanon && is_eof && (head == ldata->read_tail)) n = 0; *b += n; *nr -= n; } return retval; } ",0 "void FrameLoaderClient::transitionToCommittedFromCachedFrame(CachedFrame*) { } ",0 "static void mincore_unmapped_range(struct vm_area_struct *vma, unsigned long addr, unsigned long end, unsigned char *vec) { unsigned long nr = (end - addr) >> PAGE_SHIFT; int i; if (vma->vm_file) { pgoff_t pgoff; pgoff = linear_page_index(vma, addr); for (i = 0; i < nr; i++, pgoff++) vec[i] = mincore_page(vma->vm_file->f_mapping, pgoff); } else { for (i = 0; i < nr; i++) vec[i] = 0; } } ",0 "static int ptrace_signal(int signr, siginfo_t *info) { /* * We do not check sig_kernel_stop(signr) but set this marker * unconditionally because we do not know whether debugger will * change signr. This flag has no meaning unless we are going * to stop after return from ptrace_stop(). In this case it will * be checked in do_signal_stop(), we should only stop if it was * not cleared by SIGCONT while we were sleeping. See also the * comment in dequeue_signal(). */ current->jobctl |= JOBCTL_STOP_DEQUEUED; ptrace_stop(signr, CLD_TRAPPED, 0, info); /* We're back. Did the debugger cancel the sig? */ signr = current->exit_code; if (signr == 0) return signr; current->exit_code = 0; /* * Update the siginfo structure if the signal has * changed. If the debugger wanted something * specific in the siginfo structure then it should * have updated *info via PTRACE_SETSIGINFO. */ if (signr != info->si_signo) { info->si_signo = signr; info->si_errno = 0; info->si_code = SI_USER; rcu_read_lock(); info->si_pid = task_pid_vnr(current->parent); info->si_uid = from_kuid_munged(current_user_ns(), task_uid(current->parent)); rcu_read_unlock(); } /* If the (new) signal is now blocked, requeue it. */ if (sigismember(¤t->blocked, signr)) { specific_send_sig_info(signr, info, current); signr = 0; } return signr; } ",0 "NPError WebPluginDelegatePepper::Device2DFlushContext( NPP id, NPDeviceContext2D* context, NPDeviceFlushContextCallbackPtr callback, void* user_data) { if (!context) return NPERR_INVALID_PARAM; Graphics2DDeviceContext* ctx = graphic2d_contexts_.Lookup( reinterpret_cast(context->reserved)); if (!ctx) return NPERR_INVALID_PARAM; // TODO(brettw) call callback. return ctx->Flush(&committed_bitmap_, context, callback, id, user_data); } ",0 "static int check_call(struct verifier_env *env, int func_id) { struct verifier_state *state = &env->cur_state; const struct bpf_func_proto *fn = NULL; struct reg_state *regs = state->regs; struct bpf_map *map = NULL; struct reg_state *reg; int i, err; /* find function prototype */ if (func_id < 0 || func_id >= __BPF_FUNC_MAX_ID) { verbose(""invalid func %d\n"", func_id); return -EINVAL; } if (env->prog->aux->ops->get_func_proto) fn = env->prog->aux->ops->get_func_proto(func_id); if (!fn) { verbose(""unknown func %d\n"", func_id); return -EINVAL; } /* eBPF programs must be GPL compatible to use GPL-ed functions */ if (!env->prog->gpl_compatible && fn->gpl_only) { verbose(""cannot call GPL only function from proprietary program\n""); return -EINVAL; } /* check args */ err = check_func_arg(env, BPF_REG_1, fn->arg1_type, &map); if (err) return err; err = check_func_arg(env, BPF_REG_2, fn->arg2_type, &map); if (err) return err; err = check_func_arg(env, BPF_REG_3, fn->arg3_type, &map); if (err) return err; err = check_func_arg(env, BPF_REG_4, fn->arg4_type, &map); if (err) return err; err = check_func_arg(env, BPF_REG_5, fn->arg5_type, &map); if (err) return err; /* reset caller saved regs */ for (i = 0; i < CALLER_SAVED_REGS; i++) { reg = regs + caller_saved[i]; reg->type = NOT_INIT; reg->imm = 0; } /* update return register */ if (fn->ret_type == RET_INTEGER) { regs[BPF_REG_0].type = UNKNOWN_VALUE; } else if (fn->ret_type == RET_VOID) { regs[BPF_REG_0].type = NOT_INIT; } else if (fn->ret_type == RET_PTR_TO_MAP_VALUE_OR_NULL) { regs[BPF_REG_0].type = PTR_TO_MAP_VALUE_OR_NULL; /* remember map_ptr, so that check_map_access() * can check 'value_size' boundary of memory access * to map element returned from bpf_map_lookup_elem() */ if (map == NULL) { verbose(""kernel subsystem misconfigured verifier\n""); return -EINVAL; } regs[BPF_REG_0].map_ptr = map; } else { verbose(""unknown return type %d of func %d\n"", fn->ret_type, func_id); return -EINVAL; } err = check_map_func_compatibility(map, func_id); if (err) return err; return 0; } ",0 "void do_enable(char UNUSED *p) { bdt_enable(); } ",0 "ofputil_pull_ofp15_buckets(struct ofpbuf *msg, size_t buckets_length, enum ofp_version version, uint8_t group_type, struct ovs_list *buckets) { struct ofp15_bucket *ob; ovs_list_init(buckets); while (buckets_length > 0) { struct ofputil_bucket *bucket = NULL; struct ofpbuf ofpacts; enum ofperr err = OFPERR_OFPGMFC_BAD_BUCKET; size_t ob_len, actions_len, properties_len; ovs_be32 watch_port = ofputil_port_to_ofp11(OFPP_ANY); ovs_be32 watch_group = htonl(OFPG_ANY); ovs_be16 weight = htons(group_type == OFPGT11_SELECT ? 1 : 0); ofpbuf_init(&ofpacts, 0); ob = ofpbuf_try_pull(msg, sizeof *ob); if (!ob) { VLOG_WARN_RL(&bad_ofmsg_rl, ""buckets end with %""PRIuSIZE "" leftover bytes"", buckets_length); goto err; } ob_len = ntohs(ob->len); actions_len = ntohs(ob->action_array_len); if (ob_len < sizeof *ob) { VLOG_WARN_RL(&bad_ofmsg_rl, ""OpenFlow message bucket length "" ""%""PRIuSIZE"" is not valid"", ob_len); goto err; } else if (ob_len > buckets_length) { VLOG_WARN_RL(&bad_ofmsg_rl, ""OpenFlow message bucket length "" ""%""PRIuSIZE"" exceeds remaining buckets data size %"" PRIuSIZE, ob_len, buckets_length); goto err; } else if (actions_len > ob_len - sizeof *ob) { VLOG_WARN_RL(&bad_ofmsg_rl, ""OpenFlow message bucket actions "" ""length %""PRIuSIZE"" exceeds remaining bucket "" ""data size %""PRIuSIZE, actions_len, ob_len - sizeof *ob); goto err; } buckets_length -= ob_len; err = ofpacts_pull_openflow_actions(msg, actions_len, version, NULL, NULL, &ofpacts); if (err) { goto err; } properties_len = ob_len - sizeof *ob - actions_len; struct ofpbuf properties = ofpbuf_const_initializer( ofpbuf_pull(msg, properties_len), properties_len); while (properties.size > 0) { struct ofpbuf payload; uint64_t type; err = ofpprop_pull(&properties, &payload, &type); if (err) { goto err; } switch (type) { case OFPGBPT15_WEIGHT: err = ofpprop_parse_be16(&payload, &weight); break; case OFPGBPT15_WATCH_PORT: err = ofpprop_parse_be32(&payload, &watch_port); break; case OFPGBPT15_WATCH_GROUP: err = ofpprop_parse_be32(&payload, &watch_group); break; default: err = OFPPROP_UNKNOWN(false, ""group bucket"", type); break; } if (err) { goto err; } } bucket = xzalloc(sizeof *bucket); bucket->weight = ntohs(weight); err = ofputil_port_from_ofp11(watch_port, &bucket->watch_port); if (err) { err = OFPERR_OFPGMFC_BAD_WATCH; goto err; } bucket->watch_group = ntohl(watch_group); bucket->bucket_id = ntohl(ob->bucket_id); if (bucket->bucket_id > OFPG15_BUCKET_MAX) { VLOG_WARN_RL(&bad_ofmsg_rl, ""bucket id (%u) is out of range"", bucket->bucket_id); err = OFPERR_OFPGMFC_BAD_BUCKET; goto err; } bucket->ofpacts = ofpbuf_steal_data(&ofpacts); bucket->ofpacts_len = ofpacts.size; ovs_list_push_back(buckets, &bucket->list_node); continue; err: free(bucket); ofpbuf_uninit(&ofpacts); ofputil_bucket_list_destroy(buckets); return err; } if (ofputil_bucket_check_duplicate_id(buckets)) { VLOG_WARN_RL(&bad_ofmsg_rl, ""Duplicate bucket id""); ofputil_bucket_list_destroy(buckets); return OFPERR_OFPGMFC_BAD_BUCKET; } return 0; } ",0 "local void write_table(out, table) FILE *out; const z_crc_t FAR *table; { int n; for (n = 0; n < 256; n++) fprintf(out, ""%s0x%08lxUL%s"", n % 5 ? """" : "" "", (unsigned long)(table[n]), n == 255 ? ""\n"" : (n % 5 == 4 ? "",\n"" : "", "")); } ",0 "status_t MediaPlayer::setLooping(int loop) { ALOGV(""MediaPlayer::setLooping""); Mutex::Autolock _l(mLock); mLoop = (loop != 0); if (mPlayer != 0) { return mPlayer->setLooping(loop); } return OK; } ",0 " OVS_REQUIRES(ofproto_mutex) { struct ofgroup *old_group; /* Modified group. */ struct ofgroup *new_group; enum ofperr error; old_group = ofproto_group_lookup__(ofproto, ogm->gm.group_id, OVS_VERSION_MAX); if (!old_group) { return OFPERR_OFPGMFC_UNKNOWN_GROUP; } /* Inserting or deleting a bucket should not change the group's type or * properties, so change the group mod so that these aspects match the old * group. (See EXT-570.) */ if (ogm->gm.command == OFPGC15_INSERT_BUCKET || ogm->gm.command == OFPGC15_REMOVE_BUCKET) { ogm->gm.type = old_group->type; ofputil_group_properties_destroy(&ogm->gm.props); ofputil_group_properties_copy(&ogm->gm.props, &old_group->props); } if (old_group->type != ogm->gm.type && (ofproto->n_groups[ogm->gm.type] >= ofproto->ogf.max_groups[ogm->gm.type])) { return OFPERR_OFPGMFC_OUT_OF_GROUPS; } error = init_group(ofproto, &ogm->gm, ogm->version, &ogm->new_group); if (error) { return error; } new_group = ogm->new_group; /* Manipulate bucket list for bucket commands */ if (ogm->gm.command == OFPGC15_INSERT_BUCKET) { error = copy_buckets_for_insert_bucket(old_group, new_group, ogm->gm.command_bucket_id); } else if (ogm->gm.command == OFPGC15_REMOVE_BUCKET) { error = copy_buckets_for_remove_bucket(old_group, new_group, ogm->gm.command_bucket_id); } if (error) { goto out; } /* The group creation time does not change during modification. */ *CONST_CAST(long long int *, &(new_group->created)) = old_group->created; *CONST_CAST(long long int *, &(new_group->modified)) = time_msec(); group_collection_add(&ogm->old_groups, old_group); /* Mark the old group for deletion. */ versions_set_remove_version(&old_group->versions, ogm->version); /* Insert replacement group. */ cmap_insert(&ofproto->groups, &new_group->cmap_node, hash_int(new_group->group_id, 0)); /* Transfer rules. */ rule_collection_move(&new_group->rules, &old_group->rules); if (old_group->type != new_group->type) { ofproto->n_groups[old_group->type]--; ofproto->n_groups[new_group->type]++; } return 0; out: ofproto_group_unref(new_group); return error; } ",0 "struct md_rdev *md_find_rdev_nr_rcu(struct mddev *mddev, int nr) { struct md_rdev *rdev; rdev_for_each_rcu(rdev, mddev) if (rdev->desc_nr == nr) return rdev; return NULL; } ",0 "write_ruleset_details(int s) { int proto = 0; unsigned short eport, iport; char desc[64]; char iaddr[32]; char rhost[32]; unsigned int timestamp; u_int64_t packets; u_int64_t bytes; int i = 0; char buffer[256]; int n; write(s, ""Ruleset :\n"", 10); while(get_redirect_rule_by_index(i, 0/*ifname*/, &eport, iaddr, sizeof(iaddr), &iport, &proto, desc, sizeof(desc), rhost, sizeof(rhost), ×tamp, &packets, &bytes) >= 0) { n = snprintf(buffer, sizeof(buffer), ""%2d %s %s:%hu->%s:%hu "" ""'%s' %u %"" PRIu64 "" %"" PRIu64 ""\n"", /*""'%s' %llu %llu\n"",*/ i, proto_itoa(proto), rhost, eport, iaddr, iport, desc, timestamp, packets, bytes); write(s, buffer, n); i++; } } ",0 "static PHP_FUNCTION(xmlwriter_start_dtd_element) { php_xmlwriter_string_arg(INTERNAL_FUNCTION_PARAM_PASSTHRU, xmlTextWriterStartDTDElement, ""Invalid Element Name""); } ",0 "static int vorbis_pump_first_frame(stb_vorbis *f) { int len, right, left, res; res = vorbis_decode_packet(f, &len, &left, &right); if (res) vorbis_finish_frame(f, len, left, right); return res; } ",0 "cmd_http_expect(CMD_ARGS) { struct http *hp; const char *lhs; char *cmp; const char *rhs; (void)cmd; (void)vl; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); assert(!strcmp(av[0], ""expect"")); av++; AN(av[0]); AN(av[1]); AN(av[2]); AZ(av[3]); lhs = cmd_var_resolve(hp, av[0]); cmp = av[1]; rhs = cmd_var_resolve(hp, av[2]); if (!strcmp(cmp, ""=="")) { if (strcmp(lhs, rhs)) vtc_log(hp->vl, 0, ""EXPECT %s (%s) %s %s (%s) failed"", av[0], lhs, av[1], av[2], rhs); else vtc_log(hp->vl, 4, ""EXPECT %s (%s) %s %s (%s) match"", av[0], lhs, av[1], av[2], rhs); } else if (!strcmp(cmp, ""!="")) { if (!strcmp(lhs, rhs)) vtc_log(hp->vl, 0, ""EXPECT %s (%s) %s %s (%s) failed"", av[0], lhs, av[1], av[2], rhs); else vtc_log(hp->vl, 4, ""EXPECT %s (%s) %s %s (%s) match"", av[0], lhs, av[1], av[2], rhs); } else { vtc_log(hp->vl, 0, ""EXPECT %s (%s) %s %s (%s) test not implemented"", av[0], lhs, av[1], av[2], rhs); } } ",0 "int git_index_snapshot_new(git_vector *snap, git_index *index) { int error; GIT_REFCOUNT_INC(index); git_atomic_inc(&index->readers); git_vector_sort(&index->entries); error = git_vector_dup(snap, &index->entries, index->entries._cmp); if (error < 0) git_index_free(index); return error; } ",0 "xsltApplyOneTemplate(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, xmlNodePtr list, xsltTemplatePtr templ ATTRIBUTE_UNUSED, xsltStackElemPtr params) { if ((ctxt == NULL) || (list == NULL)) return; CHECK_STOPPED; if (params) { /* * This code should be obsolete - was previously used * by libexslt/functions.c, but due to bug 381319 the * logic there was changed. */ int oldVarsNr = ctxt->varsNr; /* * Push the given xsl:param(s) onto the variable stack. */ while (params != NULL) { xsltLocalVariablePush(ctxt, params, -1); params = params->next; } xsltApplySequenceConstructor(ctxt, contextNode, list, templ); /* * Pop the given xsl:param(s) from the stack but don't free them. */ xsltLocalVariablePop(ctxt, oldVarsNr, -2); } else xsltApplySequenceConstructor(ctxt, contextNode, list, templ); } ",0 "void HTMLFormElement::finishRequestAutocomplete(AutocompleteResult result) { RefPtr event; if (result == AutocompleteResultSuccess) event = Event::create(eventNames().autocompleteEvent); else if (result == AutocompleteResultErrorDisabled) event = AutocompleteErrorEvent::create(""disabled""); else if (result == AutocompleteResultErrorCancel) event = AutocompleteErrorEvent::create(""cancel""); else if (result == AutocompleteResultErrorInvalid) event = AutocompleteErrorEvent::create(""invalid""); event->setTarget(this); m_pendingAutocompleteEvents.append(event.release()); if (!m_requestAutocompleteTimer.isActive()) m_requestAutocompleteTimer.startOneShot(0); } ",0 "void unix_gc(void) { struct unix_sock *u; struct unix_sock *next; struct sk_buff_head hitlist; struct list_head cursor; LIST_HEAD(not_cycle_list); spin_lock(&unix_gc_lock); /* Avoid a recursive GC. */ if (gc_in_progress) goto out; gc_in_progress = true; /* First, select candidates for garbage collection. Only * in-flight sockets are considered, and from those only ones * which don't have any external reference. * * Holding unix_gc_lock will protect these candidates from * being detached, and hence from gaining an external * reference. Since there are no possible receivers, all * buffers currently on the candidates' queues stay there * during the garbage collection. * * We also know that no new candidate can be added onto the * receive queues. Other, non candidate sockets _can_ be * added to queue, so we must make sure only to touch * candidates. */ list_for_each_entry_safe(u, next, &gc_inflight_list, link) { long total_refs; long inflight_refs; total_refs = file_count(u->sk.sk_socket->file); inflight_refs = atomic_long_read(&u->inflight); BUG_ON(inflight_refs < 1); BUG_ON(total_refs < inflight_refs); if (total_refs == inflight_refs) { list_move_tail(&u->link, &gc_candidates); __set_bit(UNIX_GC_CANDIDATE, &u->gc_flags); __set_bit(UNIX_GC_MAYBE_CYCLE, &u->gc_flags); } } /* Now remove all internal in-flight reference to children of * the candidates. */ list_for_each_entry(u, &gc_candidates, link) scan_children(&u->sk, dec_inflight, NULL); /* Restore the references for children of all candidates, * which have remaining references. Do this recursively, so * only those remain, which form cyclic references. * * Use a ""cursor"" link, to make the list traversal safe, even * though elements might be moved about. */ list_add(&cursor, &gc_candidates); while (cursor.next != &gc_candidates) { u = list_entry(cursor.next, struct unix_sock, link); /* Move cursor to after the current position. */ list_move(&cursor, &u->link); if (atomic_long_read(&u->inflight) > 0) { list_move_tail(&u->link, ¬_cycle_list); __clear_bit(UNIX_GC_MAYBE_CYCLE, &u->gc_flags); scan_children(&u->sk, inc_inflight_move_tail, NULL); } } list_del(&cursor); /* not_cycle_list contains those sockets which do not make up a * cycle. Restore these to the inflight list. */ while (!list_empty(¬_cycle_list)) { u = list_entry(not_cycle_list.next, struct unix_sock, link); __clear_bit(UNIX_GC_CANDIDATE, &u->gc_flags); list_move_tail(&u->link, &gc_inflight_list); } /* Now gc_candidates contains only garbage. Restore original * inflight counters for these as well, and remove the skbuffs * which are creating the cycle(s). */ skb_queue_head_init(&hitlist); list_for_each_entry(u, &gc_candidates, link) scan_children(&u->sk, inc_inflight, &hitlist); spin_unlock(&unix_gc_lock); /* Here we are. Hitlist is filled. Die. */ __skb_queue_purge(&hitlist); spin_lock(&unix_gc_lock); /* All candidates should have been detached by now. */ BUG_ON(!list_empty(&gc_candidates)); gc_in_progress = false; wake_up(&unix_gc_wait); out: spin_unlock(&unix_gc_lock); } ",0 "perform_one_test_safe(FILE *fp, int argc, const char **argv, png_uint_32 *default_flags, display *d, const char *test) { if (setjmp(d->error_return) == 0) { d->test = test; /* allow use of d->error_return */ # ifdef PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED perform_one_test(fp, argc, argv, default_flags, d, 0); # endif # ifdef PNG_READ_USER_CHUNKS_SUPPORTED perform_one_test(fp, argc, argv, default_flags, d, 1); # endif d->test = init; /* prevent use of d->error_return */ } } ",0 "void BrowserView::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { unhandled_keyboard_event_handler_.HandleKeyboardEvent(event, GetFocusManager()); } ",0 "void ResourceFetcher::stopFetching() { if (m_multipartLoaders) m_multipartLoaders->cancelAll(); if (m_loaders) m_loaders->cancelAll(); } ",0 "gfx::Image* AutolaunchInfoBarDelegate::GetIcon() const { return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( IDR_PRODUCT_LOGO_32); } ",0 "void SerializedScriptValue::toWireBytes(Vector& result) const { ASSERT(result.isEmpty()); size_t length = m_data.length(); result.resize(length * sizeof(UChar)); UChar* dst = reinterpret_cast(result.data()); if (m_data.is8Bit()) { const LChar* src = m_data.characters8(); for (size_t i = 0; i < length; i++) dst[i] = htons(static_cast(src[i])); } else { const UChar* src = m_data.characters16(); for (size_t i = 0; i < length; i++) dst[i] = htons(src[i]); } } ",0 "static void overloadedMethodA2Method(const v8::FunctionCallbackInfo& info) { ExceptionState exceptionState(ExceptionState::ExecutionContext, ""overloadedMethodA"", ""TestObjectPython"", info.Holder(), info.GetIsolate()); if (UNLIKELY(info.Length() < 2)) { exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, info.Length())); exceptionState.throwIfNeeded(); return; } TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); V8TRYCATCH_EXCEPTION_VOID(int, longArg1, toInt32(info[0], exceptionState), exceptionState); V8TRYCATCH_EXCEPTION_VOID(int, longArg2, toInt32(info[1], exceptionState), exceptionState); imp->overloadedMethodA(longArg1, longArg2); } ",0 "static inline MagickOffsetType ReadPixelCacheRegion( const CacheInfo *magick_restrict cache_info,const MagickOffsetType offset, const MagickSizeType length,unsigned char *magick_restrict buffer) { register MagickOffsetType i; ssize_t count; #if !defined(MAGICKCORE_HAVE_PREAD) if (lseek(cache_info->file,offset,SEEK_SET) < 0) return((MagickOffsetType) -1); #endif count=0; for (i=0; i < (MagickOffsetType) length; i+=count) { #if !defined(MAGICKCORE_HAVE_PREAD) count=read(cache_info->file,buffer+i,(size_t) MagickMin(length-i,(size_t) SSIZE_MAX)); #else count=pread(cache_info->file,buffer+i,(size_t) MagickMin(length-i,(size_t) SSIZE_MAX),(off_t) (offset+i)); #endif if (count <= 0) { count=0; if (errno != EINTR) break; } } return(i); } ",0 "static void efx_pci_remove_main(struct efx_nic *efx) { #ifdef CONFIG_RFS_ACCEL free_irq_cpu_rmap(efx->net_dev->rx_cpu_rmap); efx->net_dev->rx_cpu_rmap = NULL; #endif efx_nic_fini_interrupt(efx); efx_fini_channels(efx); efx_fini_port(efx); efx->type->fini(efx); efx_fini_napi(efx); efx_remove_all(efx); } ",0 "RenderWidgetFullscreenPepper* RenderFrameImpl::CreatePepperFullscreenContainer( PepperPluginInstanceImpl* plugin) { GURL active_url; if (render_view()->webview()) active_url = render_view()->GetURLForGraphicsContext3D(); mojom::WidgetPtr widget_channel; mojom::WidgetRequest widget_channel_request = mojo::MakeRequest(&widget_channel); int32_t fullscreen_widget_routing_id = MSG_ROUTING_NONE; if (!RenderThreadImpl::current_render_message_filter() ->CreateFullscreenWidget(render_view()->routing_id(), std::move(widget_channel), &fullscreen_widget_routing_id)) { return nullptr; } RenderWidget::ShowCallback show_callback = base::Bind(&RenderViewImpl::ShowCreatedFullscreenWidget, render_view()->GetWeakPtr()); RenderWidgetFullscreenPepper* widget = RenderWidgetFullscreenPepper::Create( fullscreen_widget_routing_id, show_callback, GetRenderWidget()->compositor_deps(), plugin, active_url, GetRenderWidget()->screen_info(), std::move(widget_channel_request)); widget->Show(blink::kWebNavigationPolicyIgnore); return widget; } ",0 "GF_Box *txtc_New() { ISOM_DECL_BOX_ALLOC(GF_TextConfigBox, GF_ISOM_BOX_TYPE_TXTC); return (GF_Box *)tmp; } ",0 "DEFINE_TRACE(InspectorAccessibilityAgent) { visitor->trace(m_page); visitor->trace(m_domAgent); InspectorBaseAgent::trace(visitor); } ",0 "void ChromeContentRendererClient::GetNavigationErrorStrings( const WebKit::WebURLRequest& failed_request, const WebKit::WebURLError& error, std::string* error_html, string16* error_description) { const GURL failed_url = error.unreachableURL; const Extension* extension = NULL; const bool is_repost = error.reason == net::ERR_CACHE_MISS && error.domain == WebString::fromUTF8(net::kErrorDomain) && EqualsASCII(failed_request.httpMethod(), ""POST""); if (failed_url.is_valid() && !failed_url.SchemeIs(chrome::kExtensionScheme)) { extension = extension_dispatcher_->extensions()->GetExtensionOrAppByURL( ExtensionURLInfo(failed_url)); } if (error_html) { int resource_id; DictionaryValue error_strings; if (extension && !extension->from_bookmark()) { LocalizedError::GetAppErrorStrings(error, failed_url, extension, &error_strings); resource_id = IDR_ERROR_APP_HTML; } else { if (is_repost) { LocalizedError::GetFormRepostStrings(failed_url, &error_strings); } else { LocalizedError::GetStrings(error, &error_strings); } resource_id = IDR_NET_ERROR_HTML; } const base::StringPiece template_html( ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id)); if (template_html.empty()) { NOTREACHED() << ""unable to load template. ID: "" << resource_id; } else { *error_html = jstemplate_builder::GetTemplatesHtml( template_html, &error_strings, ""t""); } } if (error_description) { if (!extension && !is_repost) *error_description = LocalizedError::GetErrorDetails(error); } } ",0 "void CompositorImpl::RequestNewLayerTreeFrameSink() { DCHECK(!layer_tree_frame_sink_request_pending_) << ""LayerTreeFrameSink request is already pending?""; layer_tree_frame_sink_request_pending_ = true; HandlePendingLayerTreeFrameSinkRequest(); } ",0 "server_request_tun(void) { Channel *c = NULL; int mode, tun; int sock; mode = packet_get_int(); switch (mode) { case SSH_TUNMODE_POINTOPOINT: case SSH_TUNMODE_ETHERNET: break; default: packet_send_debug(""Unsupported tunnel device mode.""); return NULL; } if ((options.permit_tun & mode) == 0) { packet_send_debug(""Server has rejected tunnel device "" ""forwarding""); return NULL; } tun = packet_get_int(); if (forced_tun_device != -1) { if (tun != SSH_TUNID_ANY && forced_tun_device != tun) goto done; tun = forced_tun_device; } sock = tun_open(tun, mode); if (sock < 0) goto done; c = channel_new(""tun"", SSH_CHANNEL_OPEN, sock, sock, -1, CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, 0, ""tun"", 1); c->datagram = 1; done: if (c == NULL) packet_send_debug(""Failed to open the tunnel device.""); return c; } ",0 "bool venc_dev::venc_set_searchrange() { DEBUG_PRINT_LOW(""venc_set_searchrange""); struct v4l2_control control; struct v4l2_ext_control ctrl[6]; struct v4l2_ext_controls controls; int rc; if (m_sVenc_cfg.codectype == V4L2_PIX_FMT_MPEG4) { ctrl[0].id = V4L2_CID_MPEG_VIDC_VIDEO_IFRAME_X_RANGE; ctrl[0].value = 16; ctrl[1].id = V4L2_CID_MPEG_VIDC_VIDEO_IFRAME_Y_RANGE; ctrl[1].value = 4; ctrl[2].id = V4L2_CID_MPEG_VIDC_VIDEO_PFRAME_X_RANGE; ctrl[2].value = 16; ctrl[3].id = V4L2_CID_MPEG_VIDC_VIDEO_PFRAME_Y_RANGE; ctrl[3].value = 4; ctrl[4].id = V4L2_CID_MPEG_VIDC_VIDEO_BFRAME_X_RANGE; ctrl[4].value = 12; ctrl[5].id = V4L2_CID_MPEG_VIDC_VIDEO_BFRAME_Y_RANGE; ctrl[5].value = 4; } else if ((m_sVenc_cfg.codectype == V4L2_PIX_FMT_H264) || (m_sVenc_cfg.codectype == V4L2_PIX_FMT_VP8)) { ctrl[0].id = V4L2_CID_MPEG_VIDC_VIDEO_IFRAME_X_RANGE; ctrl[0].value = 16; ctrl[1].id = V4L2_CID_MPEG_VIDC_VIDEO_IFRAME_Y_RANGE; ctrl[1].value = 4; ctrl[2].id = V4L2_CID_MPEG_VIDC_VIDEO_PFRAME_X_RANGE; ctrl[2].value = 16; ctrl[3].id = V4L2_CID_MPEG_VIDC_VIDEO_PFRAME_Y_RANGE; ctrl[3].value = 4; ctrl[4].id = V4L2_CID_MPEG_VIDC_VIDEO_BFRAME_X_RANGE; ctrl[4].value = 12; ctrl[5].id = V4L2_CID_MPEG_VIDC_VIDEO_BFRAME_Y_RANGE; ctrl[5].value = 4; } else if (m_sVenc_cfg.codectype == V4L2_PIX_FMT_H263) { ctrl[0].id = V4L2_CID_MPEG_VIDC_VIDEO_IFRAME_X_RANGE; ctrl[0].value = 4; ctrl[1].id = V4L2_CID_MPEG_VIDC_VIDEO_IFRAME_Y_RANGE; ctrl[1].value = 4; ctrl[2].id = V4L2_CID_MPEG_VIDC_VIDEO_PFRAME_X_RANGE; ctrl[2].value = 4; ctrl[3].id = V4L2_CID_MPEG_VIDC_VIDEO_PFRAME_Y_RANGE; ctrl[3].value = 4; ctrl[4].id = V4L2_CID_MPEG_VIDC_VIDEO_BFRAME_X_RANGE; ctrl[4].value = 4; ctrl[5].id = V4L2_CID_MPEG_VIDC_VIDEO_BFRAME_Y_RANGE; ctrl[5].value = 4; } else { DEBUG_PRINT_ERROR(""Invalid codec type""); return false; } controls.count = 6; controls.ctrl_class = V4L2_CTRL_CLASS_MPEG; controls.controls = ctrl; DEBUG_PRINT_LOW("" Calling IOCTL set control for"" ""id=%x, val=%d id=%x, val=%d"" ""id=%x, val=%d id=%x, val=%d"" ""id=%x, val=%d id=%x, val=%d"", controls.controls[0].id, controls.controls[0].value, controls.controls[1].id, controls.controls[1].value, controls.controls[2].id, controls.controls[2].value, controls.controls[3].id, controls.controls[3].value, controls.controls[4].id, controls.controls[4].value, controls.controls[5].id, controls.controls[5].value); rc = ioctl(m_nDriver_fd, VIDIOC_S_EXT_CTRLS, &controls); if (rc) { DEBUG_PRINT_ERROR(""Failed to set search range %d"", rc); return false; } return true; } ",0 "ZEND_API void ZEND_FASTCALL zend_hash_internal_pointer_end_ex(HashTable *ht, HashPosition *pos) { uint32_t idx; IS_CONSISTENT(ht); HT_ASSERT(&ht->nInternalPointer != pos || GC_REFCOUNT(ht) == 1); idx = ht->nNumUsed; while (idx > 0) { idx--; if (Z_TYPE(ht->arData[idx].val) != IS_UNDEF) { *pos = idx; return; } } *pos = HT_INVALID_IDX; } ",0 "XFixesCreateRegionFromWindow (Display *dpy, Window window, int kind) { XFixesExtDisplayInfo *info = XFixesFindDisplay (dpy); xXFixesCreateRegionFromWindowReq *req; XserverRegion region; XFixesCheckExtension (dpy, info, 0); LockDisplay (dpy); GetReq (XFixesCreateRegionFromWindow, req); req->reqType = info->codes->major_opcode; req->xfixesReqType = X_XFixesCreateRegionFromWindow; region = req->region = XAllocID (dpy); req->window = window; req->kind = kind; UnlockDisplay (dpy); SyncHandle(); return region; } ",0 "URLPatternSet PermissionsData::GetEffectiveHostPermissions() const { base::AutoLock auto_lock(runtime_lock_); URLPatternSet effective_hosts = active_permissions_unsafe_->effective_hosts().Clone(); for (const auto& val : tab_specific_permissions_) effective_hosts.AddPatterns(val.second->effective_hosts()); return effective_hosts; } ",0 "void CSSPaintValue::PaintImageGeneratorReady() { for (const ImageResourceObserver* client : Clients().Keys()) { const_cast(client)->ImageChanged( static_cast(this), ImageResourceObserver::CanDeferInvalidation::kNo); } } ",0 "void CL_Clientinfo_f( void ) { Com_Printf( ""--------- Client Information ---------\n"" ); Com_Printf( ""state: %i\n"", clc.state ); Com_Printf( ""Server: %s\n"", clc.servername ); Com_Printf (""User info settings:\n""); Info_Print( Cvar_InfoString( CVAR_USERINFO ) ); Com_Printf( ""--------------------------------------\n"" ); } ",0 "native_handle* Parcel::readNativeHandle() const { int numFds, numInts; status_t err; err = readInt32(&numFds); if (err != NO_ERROR) return 0; err = readInt32(&numInts); if (err != NO_ERROR) return 0; native_handle* h = native_handle_create(numFds, numInts); if (!h) { return 0; } for (int i=0 ; err==NO_ERROR && idata[i] = dup(readFileDescriptor()); if (h->data[i] < 0) err = BAD_VALUE; } err = read(h->data + numFds, sizeof(int)*numInts); if (err != NO_ERROR) { native_handle_close(h); native_handle_delete(h); h = 0; } return h; } ",1 " AudioRendererHost::AudioRendererHost(int render_process_id, media::AudioManager* audio_manager, AudioMirroringManager* mirroring_manager, MediaStreamManager* media_stream_manager, const std::string& salt) : BrowserMessageFilter(AudioMsgStart), render_process_id_(render_process_id), audio_manager_(audio_manager), mirroring_manager_(mirroring_manager), media_stream_manager_(media_stream_manager), salt_(salt), validate_render_frame_id_function_(&ValidateRenderFrameId), authorization_handler_(audio_manager_, media_stream_manager, render_process_id_, salt) { DCHECK(audio_manager_); } ",1 "int make_http_soap_request(zval *this_ptr, char *buf, int buf_size, char *location, char *soapaction, int soap_version, char **buffer, int *buffer_len TSRMLS_DC) { char *request; smart_str soap_headers = {0}; smart_str soap_headers_z = {0}; int request_size, err; php_url *phpurl = NULL; php_stream *stream; zval **trace, **tmp; int use_proxy = 0; int use_ssl; char *http_headers, *http_body, *content_type, *http_version, *cookie_itt; int http_header_size, http_body_size, http_close; char *connection; int http_1_1; int http_status; int content_type_xml = 0; long redirect_max = 20; char *content_encoding; char *http_msg = NULL; zend_bool old_allow_url_fopen; php_stream_context *context = NULL; zend_bool has_authorization = 0; zend_bool has_proxy_authorization = 0; zend_bool has_cookies = 0; if (this_ptr == NULL || Z_TYPE_P(this_ptr) != IS_OBJECT) { return FALSE; } request = buf; request_size = buf_size; /* Compress request */ if (zend_hash_find(Z_OBJPROP_P(this_ptr), ""compression"", sizeof(""compression""), (void **)&tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_LONG) { int level = Z_LVAL_PP(tmp) & 0x0f; int kind = Z_LVAL_PP(tmp) & SOAP_COMPRESSION_DEFLATE; if (level > 9) {level = 9;} if ((Z_LVAL_PP(tmp) & SOAP_COMPRESSION_ACCEPT) != 0) { smart_str_append_const(&soap_headers_z,""Accept-Encoding: gzip, deflate\r\n""); } if (level > 0) { zval func; zval retval; zval param1, param2, param3; zval *params[3]; int n; params[0] = ¶m1; INIT_PZVAL(params[0]); params[1] = ¶m2; INIT_PZVAL(params[1]); params[2] = ¶m3; INIT_PZVAL(params[2]); ZVAL_STRINGL(params[0], buf, buf_size, 0); ZVAL_LONG(params[1], level); if (kind == SOAP_COMPRESSION_DEFLATE) { n = 2; ZVAL_STRING(&func, ""gzcompress"", 0); smart_str_append_const(&soap_headers_z,""Content-Encoding: deflate\r\n""); } else { n = 3; ZVAL_STRING(&func, ""gzencode"", 0); smart_str_append_const(&soap_headers_z,""Content-Encoding: gzip\r\n""); ZVAL_LONG(params[2], 0x1f); } if (call_user_function(CG(function_table), (zval**)NULL, &func, &retval, n, params TSRMLS_CC) == SUCCESS && Z_TYPE(retval) == IS_STRING) { request = Z_STRVAL(retval); request_size = Z_STRLEN(retval); } else { if (request != buf) {efree(request);} smart_str_free(&soap_headers_z); return FALSE; } } } if (zend_hash_find(Z_OBJPROP_P(this_ptr), ""httpsocket"", sizeof(""httpsocket""), (void **)&tmp) == SUCCESS) { php_stream_from_zval_no_verify(stream,tmp); if (zend_hash_find(Z_OBJPROP_P(this_ptr), ""_use_proxy"", sizeof(""_use_proxy""), (void **)&tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_LONG) { use_proxy = Z_LVAL_PP(tmp); } } else { stream = NULL; } if (location != NULL && location[0] != '\000') { phpurl = php_url_parse(location); } if (SUCCESS == zend_hash_find(Z_OBJPROP_P(this_ptr), ""_stream_context"", sizeof(""_stream_context""), (void**)&tmp)) { context = php_stream_context_from_zval(*tmp, 0); } if (context && php_stream_context_get_option(context, ""http"", ""max_redirects"", &tmp) == SUCCESS) { if (Z_TYPE_PP(tmp) != IS_STRING || !is_numeric_string(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), &redirect_max, NULL, 1)) { if (Z_TYPE_PP(tmp) == IS_LONG) redirect_max = Z_LVAL_PP(tmp); } } try_again: if (phpurl == NULL || phpurl->host == NULL) { if (phpurl != NULL) {php_url_free(phpurl);} if (request != buf) {efree(request);} add_soap_fault(this_ptr, ""HTTP"", ""Unable to parse URL"", NULL, NULL TSRMLS_CC); smart_str_free(&soap_headers_z); return FALSE; } use_ssl = 0; if (phpurl->scheme != NULL && strcmp(phpurl->scheme, ""https"") == 0) { use_ssl = 1; } else if (phpurl->scheme == NULL || strcmp(phpurl->scheme, ""http"") != 0) { php_url_free(phpurl); if (request != buf) {efree(request);} add_soap_fault(this_ptr, ""HTTP"", ""Unknown protocol. Only http and https are allowed."", NULL, NULL TSRMLS_CC); smart_str_free(&soap_headers_z); return FALSE; } old_allow_url_fopen = PG(allow_url_fopen); PG(allow_url_fopen) = 1; if (use_ssl && php_stream_locate_url_wrapper(""https://"", NULL, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC) == NULL) { php_url_free(phpurl); if (request != buf) {efree(request);} add_soap_fault(this_ptr, ""HTTP"", ""SSL support is not available in this build"", NULL, NULL TSRMLS_CC); PG(allow_url_fopen) = old_allow_url_fopen; smart_str_free(&soap_headers_z); return FALSE; } if (phpurl->port == 0) { phpurl->port = use_ssl ? 443 : 80; } /* Check if request to the same host */ if (stream != NULL) { php_url *orig; if (zend_hash_find(Z_OBJPROP_P(this_ptr), ""httpurl"", sizeof(""httpurl""), (void **)&tmp) == SUCCESS && (orig = (php_url *) zend_fetch_resource(tmp TSRMLS_CC, -1, ""httpurl"", NULL, 1, le_url)) != NULL && ((use_proxy && !use_ssl) || (((use_ssl && orig->scheme != NULL && strcmp(orig->scheme, ""https"") == 0) || (!use_ssl && orig->scheme == NULL) || (!use_ssl && strcmp(orig->scheme, ""https"") != 0)) && strcmp(orig->host, phpurl->host) == 0 && orig->port == phpurl->port))) { } else { php_stream_close(stream); zend_hash_del(Z_OBJPROP_P(this_ptr), ""httpurl"", sizeof(""httpurl"")); zend_hash_del(Z_OBJPROP_P(this_ptr), ""httpsocket"", sizeof(""httpsocket"")); zend_hash_del(Z_OBJPROP_P(this_ptr), ""_use_proxy"", sizeof(""_use_proxy"")); stream = NULL; use_proxy = 0; } } /* Check if keep-alive connection is still opened */ if (stream != NULL && php_stream_eof(stream)) { php_stream_close(stream); zend_hash_del(Z_OBJPROP_P(this_ptr), ""httpurl"", sizeof(""httpurl"")); zend_hash_del(Z_OBJPROP_P(this_ptr), ""httpsocket"", sizeof(""httpsocket"")); zend_hash_del(Z_OBJPROP_P(this_ptr), ""_use_proxy"", sizeof(""_use_proxy"")); stream = NULL; use_proxy = 0; } if (!stream) { stream = http_connect(this_ptr, phpurl, use_ssl, context, &use_proxy TSRMLS_CC); if (stream) { php_stream_auto_cleanup(stream); add_property_resource(this_ptr, ""httpsocket"", php_stream_get_resource_id(stream)); add_property_long(this_ptr, ""_use_proxy"", use_proxy); } else { php_url_free(phpurl); if (request != buf) {efree(request);} add_soap_fault(this_ptr, ""HTTP"", ""Could not connect to host"", NULL, NULL TSRMLS_CC); PG(allow_url_fopen) = old_allow_url_fopen; smart_str_free(&soap_headers_z); return FALSE; } } PG(allow_url_fopen) = old_allow_url_fopen; if (stream) { zval **cookies, **login, **password; int ret = zend_list_insert(phpurl, le_url TSRMLS_CC); add_property_resource(this_ptr, ""httpurl"", ret); /*zend_list_addref(ret);*/ if (context && php_stream_context_get_option(context, ""http"", ""protocol_version"", &tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_DOUBLE && Z_DVAL_PP(tmp) == 1.0) { http_1_1 = 0; } else { http_1_1 = 1; } smart_str_append_const(&soap_headers, ""POST ""); if (use_proxy && !use_ssl) { smart_str_appends(&soap_headers, phpurl->scheme); smart_str_append_const(&soap_headers, ""://""); smart_str_appends(&soap_headers, phpurl->host); smart_str_appendc(&soap_headers, ':'); smart_str_append_unsigned(&soap_headers, phpurl->port); } if (phpurl->path) { smart_str_appends(&soap_headers, phpurl->path); } else { smart_str_appendc(&soap_headers, '/'); } if (phpurl->query) { smart_str_appendc(&soap_headers, '?'); smart_str_appends(&soap_headers, phpurl->query); } if (phpurl->fragment) { smart_str_appendc(&soap_headers, '#'); smart_str_appends(&soap_headers, phpurl->fragment); } if (http_1_1) { smart_str_append_const(&soap_headers, "" HTTP/1.1\r\n""); } else { smart_str_append_const(&soap_headers, "" HTTP/1.0\r\n""); } smart_str_append_const(&soap_headers, ""Host: ""); smart_str_appends(&soap_headers, phpurl->host); if (phpurl->port != (use_ssl?443:80)) { smart_str_appendc(&soap_headers, ':'); smart_str_append_unsigned(&soap_headers, phpurl->port); } if (!http_1_1 || (zend_hash_find(Z_OBJPROP_P(this_ptr), ""_keep_alive"", sizeof(""_keep_alive""), (void **)&tmp) == SUCCESS && Z_LVAL_PP(tmp) == 0)) { } if (!http_1_1 || (zend_hash_find(Z_OBJPROP_P(this_ptr), ""_keep_alive"", sizeof(""_keep_alive""), (void **)&tmp) == SUCCESS && Z_LVAL_PP(tmp) == 0)) { smart_str_append_const(&soap_headers, ""\r\n"" ""Connection: close\r\n""); Z_TYPE_PP(tmp) == IS_STRING) { if (Z_STRLEN_PP(tmp) > 0) { smart_str_append_const(&soap_headers, ""User-Agent: ""); smart_str_appendl(&soap_headers, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); smart_str_append_const(&soap_headers, ""\r\n""); } } else if (context && php_stream_context_get_option(context, ""http"", ""user_agent"", &tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_STRING) { if (Z_STRLEN_PP(tmp) > 0) { smart_str_append_const(&soap_headers, ""User-Agent: ""); smart_str_appendl(&soap_headers, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); smart_str_append_const(&soap_headers, ""\r\n""); } } else if (FG(user_agent)) { smart_str_append_const(&soap_headers, ""User-Agent: ""); smart_str_appends(&soap_headers, FG(user_agent)); smart_str_append_const(&soap_headers, ""\r\n""); } else { smart_str_append_const(&soap_headers, ""User-Agent: PHP-SOAP/""PHP_VERSION""\r\n""); } smart_str_append(&soap_headers, &soap_headers_z); if (soap_version == SOAP_1_2) { smart_str_append_const(&soap_headers,""Content-Type: application/soap+xml; charset=utf-8""); if (soapaction) { smart_str_append_const(&soap_headers,""; action=\""""); smart_str_appends(&soap_headers, soapaction); smart_str_append_const(&soap_headers,""\""""); } smart_str_append_const(&soap_headers,""\r\n""); } else { smart_str_append_const(&soap_headers,""Content-Type: text/xml; charset=utf-8\r\n""); if (soapaction) { smart_str_append_const(&soap_headers, ""SOAPAction: \""""); smart_str_appends(&soap_headers, soapaction); smart_str_append_const(&soap_headers, ""\""\r\n""); } } smart_str_append_const(&soap_headers,""Content-Length: ""); smart_str_append_long(&soap_headers, request_size); smart_str_append_const(&soap_headers, ""\r\n""); /* HTTP Authentication */ if (zend_hash_find(Z_OBJPROP_P(this_ptr), ""_login"", sizeof(""_login""), (void **)&login) == SUCCESS && Z_TYPE_PP(login) == IS_STRING) { zval **digest; has_authorization = 1; if (zend_hash_find(Z_OBJPROP_P(this_ptr), ""_digest"", sizeof(""_digest""), (void **)&digest) == SUCCESS) { if (Z_TYPE_PP(digest) == IS_ARRAY) { char HA1[33], HA2[33], response[33], cnonce[33], nc[9]; PHP_MD5_CTX md5ctx; unsigned char hash[16]; PHP_MD5Init(&md5ctx); snprintf(cnonce, sizeof(cnonce), ""%ld"", php_rand(TSRMLS_C)); PHP_MD5Update(&md5ctx, (unsigned char*)cnonce, strlen(cnonce)); PHP_MD5Final(hash, &md5ctx); make_digest(cnonce, hash); if (zend_hash_find(Z_ARRVAL_PP(digest), ""nc"", sizeof(""nc""), (void **)&tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_LONG) { Z_LVAL_PP(tmp)++; snprintf(nc, sizeof(nc), ""%08ld"", Z_LVAL_PP(tmp)); } else { add_assoc_long(*digest, ""nc"", 1); strcpy(nc, ""00000001""); } PHP_MD5Init(&md5ctx); PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_PP(login), Z_STRLEN_PP(login)); PHP_MD5Update(&md5ctx, (unsigned char*)"":"", 1); if (zend_hash_find(Z_ARRVAL_PP(digest), ""realm"", sizeof(""realm""), (void **)&tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_STRING) { PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); } PHP_MD5Update(&md5ctx, (unsigned char*)"":"", 1); if (zend_hash_find(Z_OBJPROP_P(this_ptr), ""_password"", sizeof(""_password""), (void **)&password) == SUCCESS && Z_TYPE_PP(password) == IS_STRING) { PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_PP(password), Z_STRLEN_PP(password)); } PHP_MD5Final(hash, &md5ctx); make_digest(HA1, hash); if (zend_hash_find(Z_ARRVAL_PP(digest), ""algorithm"", sizeof(""algorithm""), (void **)&tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_STRING && Z_STRLEN_PP(tmp) == sizeof(""md5-sess"")-1 && stricmp(Z_STRVAL_PP(tmp), ""md5-sess"") == 0) { PHP_MD5Init(&md5ctx); PHP_MD5Update(&md5ctx, (unsigned char*)HA1, 32); PHP_MD5Update(&md5ctx, (unsigned char*)"":"", 1); if (zend_hash_find(Z_ARRVAL_PP(digest), ""nonce"", sizeof(""nonce""), (void **)&tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_STRING) { PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); } PHP_MD5Update(&md5ctx, (unsigned char*)"":"", 1); PHP_MD5Update(&md5ctx, (unsigned char*)cnonce, 8); PHP_MD5Final(hash, &md5ctx); make_digest(HA1, hash); } PHP_MD5Init(&md5ctx); PHP_MD5Update(&md5ctx, (unsigned char*)""POST:"", sizeof(""POST:"")-1); if (phpurl->path) { PHP_MD5Update(&md5ctx, (unsigned char*)phpurl->path, strlen(phpurl->path)); } else { PHP_MD5Update(&md5ctx, (unsigned char*)""/"", 1); } if (phpurl->query) { PHP_MD5Update(&md5ctx, (unsigned char*)""?"", 1); PHP_MD5Update(&md5ctx, (unsigned char*)phpurl->query, strlen(phpurl->query)); } /* TODO: Support for qop=""auth-int"" */ /* if (zend_hash_find(Z_ARRVAL_PP(digest), ""qop"", sizeof(""qop""), (void **)&tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_STRING && Z_STRLEN_PP(tmp) == sizeof(""auth-int"")-1 && stricmp(Z_STRVAL_PP(tmp), ""auth-int"") == 0) { PHP_MD5Update(&md5ctx, "":"", 1); PHP_MD5Update(&md5ctx, HEntity, HASHHEXLEN); } */ PHP_MD5Final(hash, &md5ctx); make_digest(HA2, hash); PHP_MD5Init(&md5ctx); PHP_MD5Update(&md5ctx, (unsigned char*)HA1, 32); PHP_MD5Update(&md5ctx, (unsigned char*)"":"", 1); if (zend_hash_find(Z_ARRVAL_PP(digest), ""nonce"", sizeof(""nonce""), (void **)&tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_STRING) { PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); } PHP_MD5Update(&md5ctx, (unsigned char*)"":"", 1); if (zend_hash_find(Z_ARRVAL_PP(digest), ""qop"", sizeof(""qop""), (void **)&tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_STRING) { PHP_MD5Update(&md5ctx, (unsigned char*)nc, 8); PHP_MD5Update(&md5ctx, (unsigned char*)"":"", 1); PHP_MD5Update(&md5ctx, (unsigned char*)cnonce, 8); PHP_MD5Update(&md5ctx, (unsigned char*)"":"", 1); /* TODO: Support for qop=""auth-int"" */ PHP_MD5Update(&md5ctx, (unsigned char*)""auth"", sizeof(""auth"")-1); PHP_MD5Update(&md5ctx, (unsigned char*)"":"", 1); } PHP_MD5Update(&md5ctx, (unsigned char*)HA2, 32); PHP_MD5Final(hash, &md5ctx); make_digest(response, hash); smart_str_append_const(&soap_headers, ""Authorization: Digest username=\""""); smart_str_appendl(&soap_headers, Z_STRVAL_PP(login), Z_STRLEN_PP(login)); if (zend_hash_find(Z_ARRVAL_PP(digest), ""realm"", sizeof(""realm""), (void **)&tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_STRING) { smart_str_append_const(&soap_headers, ""\"", realm=\""""); smart_str_appendl(&soap_headers, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); } if (zend_hash_find(Z_ARRVAL_PP(digest), ""nonce"", sizeof(""nonce""), (void **)&tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_STRING) { smart_str_append_const(&soap_headers, ""\"", nonce=\""""); smart_str_appendl(&soap_headers, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); } smart_str_append_const(&soap_headers, ""\"", uri=\""""); if (phpurl->path) { smart_str_appends(&soap_headers, phpurl->path); } else { smart_str_appendc(&soap_headers, '/'); } if (phpurl->query) { smart_str_appendc(&soap_headers, '?'); smart_str_appends(&soap_headers, phpurl->query); } if (phpurl->fragment) { smart_str_appendc(&soap_headers, '#'); smart_str_appends(&soap_headers, phpurl->fragment); } if (zend_hash_find(Z_ARRVAL_PP(digest), ""qop"", sizeof(""qop""), (void **)&tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_STRING) { /* TODO: Support for qop=""auth-int"" */ smart_str_append_const(&soap_headers, ""\"", qop=\""auth""); smart_str_append_const(&soap_headers, ""\"", nc=\""""); smart_str_appendl(&soap_headers, nc, 8); smart_str_append_const(&soap_headers, ""\"", cnonce=\""""); smart_str_appendl(&soap_headers, cnonce, 8); } smart_str_append_const(&soap_headers, ""\"", response=\""""); smart_str_appendl(&soap_headers, response, 32); if (zend_hash_find(Z_ARRVAL_PP(digest), ""opaque"", sizeof(""opaque""), (void **)&tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_STRING) { smart_str_append_const(&soap_headers, ""\"", opaque=\""""); smart_str_appendl(&soap_headers, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); } if (zend_hash_find(Z_ARRVAL_PP(digest), ""algorithm"", sizeof(""algorithm""), (void **)&tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_STRING) { smart_str_append_const(&soap_headers, ""\"", algorithm=\""""); smart_str_appendl(&soap_headers, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); } smart_str_append_const(&soap_headers, ""\""\r\n""); } } else { unsigned char* buf; int len; smart_str auth = {0}; smart_str_appendl(&auth, Z_STRVAL_PP(login), Z_STRLEN_PP(login)); smart_str_appendc(&auth, ':'); if (zend_hash_find(Z_OBJPROP_P(this_ptr), ""_password"", sizeof(""_password""), (void **)&password) == SUCCESS && Z_TYPE_PP(password) == IS_STRING) { smart_str_appendl(&auth, Z_STRVAL_PP(password), Z_STRLEN_PP(password)); } smart_str_0(&auth); buf = php_base64_encode((unsigned char*)auth.c, auth.len, &len); smart_str_append_const(&soap_headers, ""Authorization: Basic ""); smart_str_appendl(&soap_headers, (char*)buf, len); smart_str_append_const(&soap_headers, ""\r\n""); efree(buf); smart_str_free(&auth); } } /* Proxy HTTP Authentication */ if (use_proxy && !use_ssl) { has_proxy_authorization = proxy_authentication(this_ptr, &soap_headers TSRMLS_CC); } /* Send cookies along with request */ if (zend_hash_find(Z_OBJPROP_P(this_ptr), ""_cookies"", sizeof(""_cookies""), (void **)&cookies) == SUCCESS) { zval **data; } /* Send cookies along with request */ if (zend_hash_find(Z_OBJPROP_P(this_ptr), ""_cookies"", sizeof(""_cookies""), (void **)&cookies) == SUCCESS) { zval **data; char *key; int i, n; for (i = 0; i < n; i++) { zend_hash_get_current_data(Z_ARRVAL_PP(cookies), (void **)&data); zend_hash_get_current_key(Z_ARRVAL_PP(cookies), &key, NULL, FALSE); if (Z_TYPE_PP(data) == IS_ARRAY) { zval** value; if (zend_hash_index_find(Z_ARRVAL_PP(data), 0, (void**)&value) == SUCCESS && Z_TYPE_PP(value) == IS_STRING) { zval **tmp; if ((zend_hash_index_find(Z_ARRVAL_PP(data), 1, (void**)&tmp) == FAILURE || strncmp(phpurl->path?phpurl->path:""/"",Z_STRVAL_PP(tmp),Z_STRLEN_PP(tmp)) == 0) && (zend_hash_index_find(Z_ARRVAL_PP(data), 2, (void**)&tmp) == FAILURE || in_domain(phpurl->host,Z_STRVAL_PP(tmp))) && (use_ssl || zend_hash_index_find(Z_ARRVAL_PP(data), 3, (void**)&tmp) == FAILURE)) { smart_str_appendl(&soap_headers, key, strlen(key)); smart_str_appendc(&soap_headers, '='); smart_str_appendl(&soap_headers, Z_STRVAL_PP(value), Z_STRLEN_PP(value)); smart_str_appendc(&soap_headers, ';'); } } } zend_hash_move_forward(Z_ARRVAL_PP(cookies)); } smart_str_append_const(&soap_headers, ""\r\n""); } } http_context_headers(context, has_authorization, has_proxy_authorization, has_cookies, &soap_headers TSRMLS_CC); smart_str_append_const(&soap_headers, ""\r\n""); smart_str_0(&soap_headers); if (zend_hash_find(Z_OBJPROP_P(this_ptr), ""trace"", sizeof(""trace""), (void **) &trace) == SUCCESS && Z_LVAL_PP(trace) > 0) { add_property_stringl(this_ptr, ""__last_request_headers"", soap_headers.c, soap_headers.len, 1); } smart_str_append_const(&soap_headers, ""\r\n""); smart_str_0(&soap_headers); if (zend_hash_find(Z_OBJPROP_P(this_ptr), ""trace"", sizeof(""trace""), (void **) &trace) == SUCCESS && Z_LVAL_PP(trace) > 0) { add_property_stringl(this_ptr, ""__last_request_headers"", soap_headers.c, soap_headers.len, 1); } smart_str_appendl(&soap_headers, request, request_size); zend_hash_del(Z_OBJPROP_P(this_ptr), ""httpurl"", sizeof(""httpurl"")); zend_hash_del(Z_OBJPROP_P(this_ptr), ""httpsocket"", sizeof(""httpsocket"")); zend_hash_del(Z_OBJPROP_P(this_ptr), ""_use_proxy"", sizeof(""_use_proxy"")); add_soap_fault(this_ptr, ""HTTP"", ""Failed Sending HTTP SOAP request"", NULL, NULL TSRMLS_CC); smart_str_free(&soap_headers_z); return FALSE; } smart_str_free(&soap_headers); } else { add_soap_fault(this_ptr, ""HTTP"", ""Failed to create stream??"", NULL, NULL TSRMLS_CC); smart_str_free(&soap_headers_z); return FALSE; } ",1 "ftrace_pid_write(struct file *filp, const char __user *ubuf, size_t cnt, loff_t *ppos) { char buf[64], *tmp; long val; int ret; if (cnt >= sizeof(buf)) return -EINVAL; if (copy_from_user(&buf, ubuf, cnt)) return -EFAULT; buf[cnt] = 0; /* * Allow ""echo > set_ftrace_pid"" or ""echo -n '' > set_ftrace_pid"" * to clean the filter quietly. */ tmp = strstrip(buf); if (strlen(tmp) == 0) return 1; ret = kstrtol(tmp, 10, &val); if (ret < 0) return ret; ret = ftrace_pid_add(val); return ret ? ret : cnt; } ",0 " void ImageFetched(const ContentSuggestion::ID& id, const GURL& url, const base::string16& title, const base::string16& text, base::Time timeout_at, const gfx::Image& image) { if (!ShouldNotifyInState(app_status_listener_.GetState())) { return; // Became foreground while we were fetching the image; forget it. } DVLOG(1) << ""Fetched "" << image.Size().width() << ""x"" << image.Size().height() << "" image for "" << url.spec(); if (ContentSuggestionsNotificationHelper::SendNotification( id, url, title, text, CropSquare(image), timeout_at)) { RecordContentSuggestionsNotificationImpression( id.category().IsKnownCategory(KnownCategories::ARTICLES) ? CONTENT_SUGGESTIONS_ARTICLE : CONTENT_SUGGESTIONS_NONARTICLE); } } ",1 "int gdImageColorResolveAlpha (gdImagePtr im, int r, int g, int b, int a) { int c; int ct = -1; int op = -1; long rd, gd, bd, ad, dist; long mindist = 4 * 255 * 255; /* init to max poss dist */ if (im->trueColor) { return gdTrueColorAlpha (r, g, b, a); } for (c = 0; c < im->colorsTotal; c++) { if (im->open[c]) { op = c; /* Save open slot */ continue; /* Color not in use */ } if (c == im->transparent) { /* don't ever resolve to the color that has * been designated as the transparent color */ continue; } rd = (long) (im->red[c] - r); gd = (long) (im->green[c] - g); bd = (long) (im->blue[c] - b); ad = (long) (im->alpha[c] - a); dist = rd * rd + gd * gd + bd * bd + ad * ad; if (dist < mindist) { if (dist == 0) { return c; /* Return exact match color */ } mindist = dist; ct = c; } } /* no exact match. We now know closest, but first try to allocate exact */ if (op == -1) { op = im->colorsTotal; if (op == gdMaxColors) { /* No room for more colors */ return ct; /* Return closest available color */ } im->colorsTotal++; } im->red[op] = r; im->green[op] = g; im->blue[op] = b; im->alpha[op] = a; im->open[op] = 0; return op; /* Return newly allocated color */ } ",0 "POINTER_SYSTEM_UPDATE* update_read_pointer_system(rdpUpdate* update, wStream* s) { POINTER_SYSTEM_UPDATE* pointer_system = calloc(1, sizeof(POINTER_SYSTEM_UPDATE)); if (!pointer_system) goto fail; if (Stream_GetRemainingLength(s) < 4) goto fail; Stream_Read_UINT32(s, pointer_system->type); /* systemPointerType (4 bytes) */ return pointer_system; fail: free_pointer_system_update(update->context, pointer_system); return NULL; } ",0 "static long kvm_dev_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg) { long r = -EINVAL; switch (ioctl) { case KVM_GET_API_VERSION: if (arg) goto out; r = KVM_API_VERSION; break; case KVM_CREATE_VM: r = kvm_dev_ioctl_create_vm(arg); break; case KVM_CHECK_EXTENSION: r = kvm_vm_ioctl_check_extension_generic(NULL, arg); break; case KVM_GET_VCPU_MMAP_SIZE: if (arg) goto out; r = PAGE_SIZE; /* struct kvm_run */ #ifdef CONFIG_X86 r += PAGE_SIZE; /* pio data page */ #endif #ifdef KVM_COALESCED_MMIO_PAGE_OFFSET r += PAGE_SIZE; /* coalesced mmio ring page */ #endif break; case KVM_TRACE_ENABLE: case KVM_TRACE_PAUSE: case KVM_TRACE_DISABLE: r = -EOPNOTSUPP; break; default: return kvm_arch_dev_ioctl(filp, ioctl, arg); } out: return r; } ",0 "HRESULT CGaiaCredentialBase::SetComboBoxSelectedValue(DWORD field_id, DWORD dwSelectedItem) { return E_NOTIMPL; } ",0 "static int dn_wait_run(struct sock *sk, long *timeo) { struct dn_scp *scp = DN_SK(sk); DEFINE_WAIT(wait); int err = 0; if (scp->state == DN_RUN) goto out; if (!*timeo) return -EALREADY; prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); for(;;) { release_sock(sk); if (scp->state == DN_CI || scp->state == DN_CC) *timeo = schedule_timeout(*timeo); lock_sock(sk); err = 0; if (scp->state == DN_RUN) break; err = sock_error(sk); if (err) break; err = sock_intr_errno(*timeo); if (signal_pending(current)) break; err = -ETIMEDOUT; if (!*timeo) break; prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); } finish_wait(sk_sleep(sk), &wait); out: if (err == 0) { sk->sk_socket->state = SS_CONNECTED; } else if (scp->state != DN_CI && scp->state != DN_CC) { sk->sk_socket->state = SS_UNCONNECTED; } return err; } ",0 "static void cpu_clock_event_read(struct perf_event *event) { cpu_clock_event_update(event); } ",0 "static void perf_event_task_output(struct perf_event *event, struct perf_task_event *task_event) { struct perf_output_handle handle; struct perf_sample_data sample; struct task_struct *task = task_event->task; int ret, size = task_event->event_id.header.size; perf_event_header__init_id(&task_event->event_id.header, &sample, event); ret = perf_output_begin(&handle, event, task_event->event_id.header.size, 0, 0); if (ret) goto out; task_event->event_id.pid = perf_event_pid(event, task); task_event->event_id.ppid = perf_event_pid(event, current); task_event->event_id.tid = perf_event_tid(event, task); task_event->event_id.ptid = perf_event_tid(event, current); perf_output_put(&handle, task_event->event_id); perf_event__output_id_sample(event, &handle, &sample); perf_output_end(&handle); out: task_event->event_id.header.size = size; } ",1 "valuePush(xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr value) { if ((ctxt == NULL) || (value == NULL)) return(-1); if (ctxt->valueNr >= ctxt->valueMax) { xmlXPathObjectPtr *tmp; tmp = (xmlXPathObjectPtr *) xmlRealloc(ctxt->valueTab, 2 * ctxt->valueMax * sizeof(ctxt->valueTab[0])); if (tmp == NULL) { xmlGenericError(xmlGenericErrorContext, ""realloc failed !\n""); return (0); } ctxt->valueMax *= 2; ctxt->valueTab = tmp; } ctxt->valueTab[ctxt->valueNr] = value; ctxt->value = value; return (ctxt->valueNr++); } ",0 "static void sasl_timeout_callback(struct Event* ev) { struct Client *cptr; assert(0 != ev_timer(ev)); assert(0 != t_data(ev_timer(ev))); if (ev_type(ev) == ET_EXPIRE) { cptr = (struct Client*) t_data(ev_timer(ev)); abort_sasl(cptr, 1); } } ",0 "base::Optional DownloadManagerImpl::GetInProgressEntry( download::DownloadItemImpl* download) { return in_progress_manager_->GetInProgressEntry(download); } ",0 "static Element* ElementUnderMouse(Document* document_under_mouse, const LayoutPoint& point) { HitTestRequest request(HitTestRequest::kReadOnly | HitTestRequest::kActive); HitTestResult result(request, point); document_under_mouse->GetLayoutView()->HitTest(result); Node* n = result.InnerNode(); while (n && !n->IsElementNode()) n = n->ParentOrShadowHostNode(); if (n && n->IsInShadowTree()) n = n->OwnerShadowHost(); return ToElement(n); } ",0 "ztype(i_ctx_t *i_ctx_p) { os_ptr op = osp; ref tnref; int code = array_get(imemory, op, (long)r_btype(op - 1), &tnref); if (code < 0) return code; if (!r_has_type(&tnref, t_name)) { /* Must be either a stack underflow or a t_[a]struct. */ check_op(2); { /* Get the type name from the structure. */ if (op[-1].value.pstruct != 0x00) { const char *sname = gs_struct_type_name_string(gs_object_type(imemory, op[-1].value.pstruct)); int code = name_ref(imemory, (const byte *)sname, strlen(sname), (ref *) (op - 1), 0); if (code < 0) return code; } else return_error(gs_error_stackunderflow); } r_set_attrs(op - 1, a_executable); } else { ref_assign(op - 1, &tnref); } pop(1); return 0; } ",1 "static int read_table(AVFormatContext *avctx, AVStream *st, int (*parse)(AVFormatContext *avctx, AVStream *st, const char *name, int size)) { int count, i; AVIOContext *pb = avctx->pb; avio_skip(pb, 4); count = avio_rb32(pb); avio_skip(pb, 4); for (i = 0; i < count; i++) { char name[17]; int size; avio_read(pb, name, 16); name[sizeof(name) - 1] = 0; size = avio_rb32(pb); if (size < 0) { av_log(avctx, AV_LOG_ERROR, ""entry size %d is invalid\n"", size); return AVERROR_INVALIDDATA; } if (parse(avctx, st, name, size) < 0) { avpriv_request_sample(avctx, ""Variable %s"", name); avio_skip(pb, size); } } return 0; } ",0 "ssize_t wait_on_sync_kiocb(struct kiocb *iocb) { while (iocb->ki_users) { set_current_state(TASK_UNINTERRUPTIBLE); if (!iocb->ki_users) break; io_schedule(); } __set_current_state(TASK_RUNNING); return iocb->ki_user_data; } ",0 "static js_Ast *arrayliteral(js_State *J) { js_Ast *head, *tail; if (J->lookahead == ']') return NULL; head = tail = LIST(arrayelement(J)); while (jsP_accept(J, ',')) { if (J->lookahead != ']') tail = tail->b = LIST(arrayelement(J)); } return jsP_list(head); } ",0 "bool ExtensionTtsPlatformImplWin::IsSpeaking() { if (speech_synthesizer_ && !paused_) { SPVOICESTATUS status; HRESULT result = speech_synthesizer_->GetStatus(&status, NULL); if (result == S_OK) { if (status.dwRunningState == 0 || // 0 == waiting to speak status.dwRunningState == SPRS_IS_SPEAKING) { return true; } } } return false; } ",0 "static int decode_user_data(Mpeg4DecContext *ctx, GetBitContext *gb) { MpegEncContext *s = &ctx->m; char buf[256]; int i; int e; int ver = 0, build = 0, ver2 = 0, ver3 = 0; char last; for (i = 0; i < 255 && get_bits_count(gb) < gb->size_in_bits; i++) { if (show_bits(gb, 23) == 0) break; buf[i] = get_bits(gb, 8); } buf[i] = 0; /* divx detection */ e = sscanf(buf, ""DivX%dBuild%d%c"", &ver, &build, &last); if (e < 2) e = sscanf(buf, ""DivX%db%d%c"", &ver, &build, &last); if (e >= 2) { ctx->divx_version = ver; ctx->divx_build = build; s->divx_packed = e == 3 && last == 'p'; } /* libavcodec detection */ e = sscanf(buf, ""FFmpe%*[^b]b%d"", &build) + 3; if (e != 4) e = sscanf(buf, ""FFmpeg v%d.%d.%d / libavcodec build: %d"", &ver, &ver2, &ver3, &build); if (e != 4) { e = sscanf(buf, ""Lavc%d.%d.%d"", &ver, &ver2, &ver3) + 1; if (e > 1) { if (ver > 0xFFU || ver2 > 0xFFU || ver3 > 0xFFU) { av_log(s->avctx, AV_LOG_WARNING, ""Unknown Lavc version string encountered, %d.%d.%d; "" ""clamping sub-version values to 8-bits.\n"", ver, ver2, ver3); } build = ((ver & 0xFF) << 16) + ((ver2 & 0xFF) << 8) + (ver3 & 0xFF); } } if (e != 4) { if (strcmp(buf, ""ffmpeg"") == 0) ctx->lavc_build = 4600; } if (e == 4) ctx->lavc_build = build; /* Xvid detection */ e = sscanf(buf, ""XviD%d"", &build); if (e == 1) ctx->xvid_build = build; return 0; } ",0 "int64_t IPCThreadState::clearCallingIdentity() { int64_t token = ((int64_t)mCallingUid<<32) | mCallingPid; clearCaller(); return token; } ",0 "static void SWFInput_dtor_close(SWFInput input) { fclose((FILE *)input->data); SWFInput_dtor(input); } ",0 "void tpm_continue_selftest(struct tpm_chip *chip) { u8 data[] = { 0, 193, /* TPM_TAG_RQU_COMMAND */ 0, 0, 0, 10, /* length */ 0, 0, 0, 83, /* TPM_ORD_GetCapability */ }; tpm_transmit(chip, data, sizeof(data)); } ",0 "void InspectorPageAgent::setShowPaintRects(ErrorString*, bool show) { m_state->setBoolean(PageAgentState::pageAgentShowPaintRects, show); m_client->setShowPaintRects(show); if (!show && mainFrame() && mainFrame()->view()) mainFrame()->view()->invalidate(); } ",0 "static long userfaultfd_ioctl(struct file *file, unsigned cmd, unsigned long arg) { int ret = -EINVAL; struct userfaultfd_ctx *ctx = file->private_data; if (cmd != UFFDIO_API && ctx->state == UFFD_STATE_WAIT_API) return -EINVAL; switch(cmd) { case UFFDIO_API: ret = userfaultfd_api(ctx, arg); break; case UFFDIO_REGISTER: ret = userfaultfd_register(ctx, arg); break; case UFFDIO_UNREGISTER: ret = userfaultfd_unregister(ctx, arg); break; case UFFDIO_WAKE: ret = userfaultfd_wake(ctx, arg); break; case UFFDIO_COPY: ret = userfaultfd_copy(ctx, arg); break; case UFFDIO_ZEROPAGE: ret = userfaultfd_zeropage(ctx, arg); break; } return ret; } ",0 "static struct arm_pmu *__init armv8_pmuv3_pmu_init(void) { armv8pmu.name = ""arm/armv8-pmuv3""; armv8pmu.map_event = armv8_pmuv3_map_event; armv8pmu.num_events = armv8pmu_read_num_pmnc_events(); armv8pmu.set_event_filter = armv8pmu_set_event_filter; return &armv8pmu; } ",0 "int i2d_X509_REQ_fp(FILE *fp, X509_REQ *req) { return ASN1_item_i2d_fp(ASN1_ITEM_rptr(X509_REQ), fp, req); } ",0 "static void del_session(SSL_CTX *sctx, SSL_SESSION *session) { simple_ssl_session *sess, *prev = NULL; const unsigned char *id; unsigned int idlen; id = SSL_SESSION_get_id(session, &idlen); for (sess = first; sess; sess = sess->next) { if (idlen == sess->idlen && !memcmp(sess->id, id, idlen)) { if (prev) prev->next = sess->next; else first = sess->next; OPENSSL_free(sess->id); OPENSSL_free(sess->der); OPENSSL_free(sess); return; } prev = sess; } } ",0 "bool RenderViewTest::ExecuteJavaScriptAndReturnIntValue( const string16& script, int* int_result) { v8::Handle result = GetMainFrame()->executeScriptAndReturnValue(WebScriptSource(script)); if (result.IsEmpty() || !result->IsInt32()) return false; if (int_result) *int_result = result->Int32Value(); return true; } ",0 "cmsToneCurve* ReadEmbeddedCurve(struct _cms_typehandler_struct* self, cmsIOHANDLER* io) { cmsTagTypeSignature BaseType; cmsUInt32Number nItems; BaseType = _cmsReadTypeBase(io); switch (BaseType) { case cmsSigCurveType: return (cmsToneCurve*) Type_Curve_Read(self, io, &nItems, 0); case cmsSigParametricCurveType: return (cmsToneCurve*) Type_ParametricCurve_Read(self, io, &nItems, 0); default: { char String[5]; _cmsTagSignature2String(String, (cmsTagSignature) BaseType); cmsSignalError(self ->ContextID, cmsERROR_UNKNOWN_EXTENSION, ""Unknown curve type '%s'"", String); } return NULL; } } ",0 "static int movl_rdisp_reg(RAnal* anal, RAnalOp* op, ut16 code){ op->type = R_ANAL_OP_TYPE_LOAD; op->dst = anal_fill_ai_rg (anal, GET_TARGET_REG(code)); op->src[0] = anal_fill_reg_disp_mem (anal, GET_SOURCE_REG(code), code&0x0F, LONG_SIZE); return op->size; } ",0 "static int smaps_rollup_open(struct inode *inode, struct file *file) { int ret; struct proc_maps_private *priv; priv = kzalloc(sizeof(*priv), GFP_KERNEL_ACCOUNT); if (!priv) return -ENOMEM; ret = single_open(file, show_smaps_rollup, priv); if (ret) goto out_free; priv->inode = inode; priv->mm = proc_mem_open(inode, PTRACE_MODE_READ); if (IS_ERR(priv->mm)) { ret = PTR_ERR(priv->mm); single_release(inode, file); goto out_free; } return 0; out_free: kfree(priv); return ret; } ",0 "void instruction_breakpoint_exception(struct pt_regs *regs) { if (notify_die(DIE_IABR_MATCH, ""iabr_match"", regs, 5, 5, SIGTRAP) == NOTIFY_STOP) return; if (debugger_iabr_match(regs)) return; _exception(SIGTRAP, regs, TRAP_BRKPT, regs->nip); } ",0 "DocumentElementSetMap& DocumentToElementSetMap() { DEFINE_STATIC_LOCAL(Persistent, map, (MakeGarbageCollected())); return *map; } ",0 "void ChromePasswordManagerClient::ShowPasswordGenerationPopup( password_manager::ContentPasswordManagerDriver* driver, const autofill::password_generation::PasswordGenerationUIData& ui_data, bool is_manually_triggered) { DCHECK(driver); gfx::RectF element_bounds_in_top_frame_space = TransformToRootCoordinates(driver->render_frame_host(), ui_data.bounds); if (!is_manually_triggered && driver->GetPasswordAutofillManager() ->MaybeShowPasswordSuggestionsWithGeneration( element_bounds_in_top_frame_space, ui_data.text_direction)) { return; } gfx::RectF element_bounds_in_screen_space = GetBoundsInScreenSpace(element_bounds_in_top_frame_space); password_manager_.SetGenerationElementAndReasonForForm( driver, ui_data.password_form, ui_data.generation_element, is_manually_triggered); popup_controller_ = PasswordGenerationPopupControllerImpl::GetOrCreate( popup_controller_, element_bounds_in_screen_space, ui_data.password_form, ui_data.generation_element, ui_data.max_length, &password_manager_, driver->AsWeakPtr(), observer_, web_contents(), web_contents()->GetNativeView()); popup_controller_->Show(PasswordGenerationPopupController::kOfferGeneration); } ",0 "void GLES2DecoderImpl::DoPopulateSubscribedValuesCHROMIUM(GLenum target) { if (!CheckCurrentValuebuffer(""glPopulateSubscribedValuesCHROMIUM"")) { return; } valuebuffer_manager()->UpdateValuebufferState(state_.bound_valuebuffer.get()); } ",0 "void OMXCodec::setJPEGInputFormat( OMX_U32 width, OMX_U32 height, OMX_U32 compressedSize) { OMX_PARAM_PORTDEFINITIONTYPE def; InitOMXParams(&def); def.nPortIndex = kPortIndexInput; status_t err = mOMX->getParameter( mNode, OMX_IndexParamPortDefinition, &def, sizeof(def)); CHECK_EQ(err, (status_t)OK); CHECK_EQ((int)def.eDomain, (int)OMX_PortDomainImage); OMX_IMAGE_PORTDEFINITIONTYPE *imageDef = &def.format.image; CHECK_EQ((int)imageDef->eCompressionFormat, (int)OMX_IMAGE_CodingJPEG); imageDef->nFrameWidth = width; imageDef->nFrameHeight = height; def.nBufferSize = compressedSize; def.nBufferCountActual = def.nBufferCountMin; err = mOMX->setParameter( mNode, OMX_IndexParamPortDefinition, &def, sizeof(def)); CHECK_EQ(err, (status_t)OK); } ",0 "static void unsignedShortAttrAttributeSetter(v8::Local jsValue, const v8::PropertyCallbackInfo& info) { ExceptionState exceptionState(ExceptionState::SetterContext, ""unsignedShortAttr"", ""TestObject"", info.Holder(), info.GetIsolate()); TestObject* imp = V8TestObject::toNative(info.Holder()); V8TRYCATCH_EXCEPTION_VOID(unsigned, cppValue, toUInt16(jsValue, exceptionState), exceptionState); imp->setUnsignedShortAttr(cppValue); } ",0 " void CWebServer::Cmd_GetLanguage(WebEmSession & session, const request& req, Json::Value &root) { std::string sValue; if (m_sql.GetPreferencesVar(""Language"", sValue)) { root[""status""] = ""OK""; root[""title""] = ""GetLanguage""; root[""language""] = sValue; } } ",0 "int __mm_populate(unsigned long start, unsigned long len, int ignore_errors) { struct mm_struct *mm = current->mm; unsigned long end, nstart, nend; struct vm_area_struct *vma = NULL; int locked = 0; long ret = 0; VM_BUG_ON(start & ~PAGE_MASK); VM_BUG_ON(len != PAGE_ALIGN(len)); end = start + len; for (nstart = start; nstart < end; nstart = nend) { /* * We want to fault in pages for [nstart; end) address range. * Find first corresponding VMA. */ if (!locked) { locked = 1; down_read(&mm->mmap_sem); vma = find_vma(mm, nstart); } else if (nstart >= vma->vm_end) vma = vma->vm_next; if (!vma || vma->vm_start >= end) break; /* * Set [nstart; nend) to intersection of desired address * range with the first VMA. Also, skip undesirable VMA types. */ nend = min(end, vma->vm_end); if (vma->vm_flags & (VM_IO | VM_PFNMAP)) continue; if (nstart < vma->vm_start) nstart = vma->vm_start; /* * Now fault in a range of pages. __mlock_vma_pages_range() * double checks the vma flags, so that it won't mlock pages * if the vma was already munlocked. */ ret = __mlock_vma_pages_range(vma, nstart, nend, &locked); if (ret < 0) { if (ignore_errors) { ret = 0; continue; /* continue at next VMA */ } ret = __mlock_posix_error_return(ret); break; } nend = nstart + ret * PAGE_SIZE; ret = 0; } if (locked) up_read(&mm->mmap_sem); return ret; /* 0 or negative error code */ } ",0 "static void nfs_finish_clear_delegation_stateid(struct nfs4_state *state) { nfs_remove_bad_delegation(state->inode); write_seqlock(&state->seqlock); nfs4_stateid_copy(&state->stateid, &state->open_stateid); write_sequnlock(&state->seqlock); clear_bit(NFS_DELEGATED_STATE, &state->flags); } ",0 "_ksba_cert_get_subject_dn_ptr (ksba_cert_t cert, unsigned char const **ptr, size_t *length) { asn_node_t n; if (!cert || !cert->initialized || !ptr || !length) return gpg_error (GPG_ERR_INV_VALUE); n = _ksba_asn_find_node (cert->root, ""Certificate.tbsCertificate.subject""); if (!n || !n->down) return gpg_error (GPG_ERR_NO_VALUE); /* oops - should be there */ n = n->down; /* dereference the choice node */ if (n->off == -1) return gpg_error (GPG_ERR_NO_VALUE); *ptr = cert->image + n->off; *length = n->nhdr + n->len; return 0; } ",0 "bool ACodec::allYourBuffersAreBelongToUs() { return allYourBuffersAreBelongToUs(kPortIndexInput) && allYourBuffersAreBelongToUs(kPortIndexOutput); } ",0 "static int tg3_ape_otp_read(struct tg3 *tp, u32 offset, u32 *val) { int i, err; u32 val2, off = offset * 8; err = tg3_nvram_lock(tp); if (err) return err; tg3_ape_write32(tp, TG3_APE_OTP_ADDR, off | APE_OTP_ADDR_CPU_ENABLE); tg3_ape_write32(tp, TG3_APE_OTP_CTRL, APE_OTP_CTRL_PROG_EN | APE_OTP_CTRL_CMD_RD | APE_OTP_CTRL_START); tg3_ape_read32(tp, TG3_APE_OTP_CTRL); udelay(10); for (i = 0; i < 100; i++) { val2 = tg3_ape_read32(tp, TG3_APE_OTP_STATUS); if (val2 & APE_OTP_STATUS_CMD_DONE) { *val = tg3_ape_read32(tp, TG3_APE_OTP_RD_DATA); break; } udelay(10); } tg3_ape_write32(tp, TG3_APE_OTP_CTRL, 0); tg3_nvram_unlock(tp); if (val2 & APE_OTP_STATUS_CMD_DONE) return 0; return -EBUSY; } ",0 "GF_Err url_dump(GF_Box *a, FILE * trace) { GF_DataEntryURLBox *p; p = (GF_DataEntryURLBox *)a; gf_isom_box_dump_start(a, ""URLDataEntryBox"", trace); if (p->location) { fprintf(trace, "" URL=\""%s\"">\n"", p->location); } else { fprintf(trace, "">\n""); if (p->size) { if (! (p->flags & 1) ) { fprintf(trace, ""\n""); } else { fprintf(trace, ""\n""); } } } gf_isom_box_dump_done(""URLDataEntryBox"", a, trace); return GF_OK; } ",0 "doWorkByList( StringList* ids, CondorError *errstack ) { ClassAd* rval = 0; switch( mode ) { case JA_RELEASE_JOBS: rval = schedd->releaseJobs( ids, actionReason, errstack ); break; case JA_REMOVE_X_JOBS: rval = schedd->removeXJobs( ids, actionReason, errstack ); break; case JA_VACATE_JOBS: rval = schedd->vacateJobs( ids, VACATE_GRACEFUL, errstack ); break; case JA_VACATE_FAST_JOBS: rval = schedd->vacateJobs( ids, VACATE_FAST, errstack ); break; case JA_REMOVE_JOBS: rval = schedd->removeJobs( ids, actionReason, errstack ); break; case JA_HOLD_JOBS: rval = schedd->holdJobs( ids, actionReason, holdReasonSubCode, errstack ); break; case JA_SUSPEND_JOBS: rval = schedd->suspendJobs( ids, actionReason, errstack ); break; case JA_CONTINUE_JOBS: rval = schedd->continueJobs( ids, actionReason, errstack ); break; default: EXCEPT( ""impossible: unknown mode in doWorkByList"" ); } if( ! rval ) { had_error = true; } else { int result = FALSE; if( !rval->LookupInteger(ATTR_ACTION_RESULT, result) || !result ) { had_error = true; } } return rval; } ",0 "nfs41_callback_svc(void *vrqstp) { struct svc_rqst *rqstp = vrqstp; struct svc_serv *serv = rqstp->rq_server; struct rpc_rqst *req; int error; DEFINE_WAIT(wq); set_freezable(); while (!kthread_should_stop()) { if (try_to_freeze()) continue; prepare_to_wait(&serv->sv_cb_waitq, &wq, TASK_INTERRUPTIBLE); spin_lock_bh(&serv->sv_cb_lock); if (!list_empty(&serv->sv_cb_list)) { req = list_first_entry(&serv->sv_cb_list, struct rpc_rqst, rq_bc_list); list_del(&req->rq_bc_list); spin_unlock_bh(&serv->sv_cb_lock); finish_wait(&serv->sv_cb_waitq, &wq); dprintk(""Invoking bc_svc_process()\n""); error = bc_svc_process(serv, req, rqstp); dprintk(""bc_svc_process() returned w/ error code= %d\n"", error); } else { spin_unlock_bh(&serv->sv_cb_lock); schedule(); finish_wait(&serv->sv_cb_waitq, &wq); } flush_signals(current); } return 0; } ",1 "CatalogueRescan (FontPathElementPtr fpe) { CataloguePtr cat = fpe->private; char link[MAXFONTFILENAMELEN]; char dest[MAXFONTFILENAMELEN]; char *attrib; FontPathElementPtr subfpe; struct stat statbuf; const char *path; DIR *dir; struct dirent *entry; int len; int pathlen; path = fpe->name + strlen(CataloguePrefix); if (stat(path, &statbuf) < 0 || !S_ISDIR(statbuf.st_mode)) return BadFontPath; if (statbuf.st_mtime <= cat->mtime) return Successful; dir = opendir(path); if (dir == NULL) { xfree(cat); return BadFontPath; } CatalogueUnrefFPEs (fpe); while (entry = readdir(dir), entry != NULL) { snprintf(link, sizeof link, ""%s/%s"", path, entry->d_name); len = readlink(link, dest, sizeof dest); if (len < 0) continue; dest[len] = '\0'; if (dest[0] != '/') { pathlen = strlen(path); memmove(dest + pathlen + 1, dest, sizeof dest - pathlen - 1); memcpy(dest, path, pathlen); memcpy(dest + pathlen, ""/"", 1); len += pathlen + 1; } attrib = strchr(link, ':'); if (attrib && len + strlen(attrib) < sizeof dest) { memcpy(dest + len, attrib, strlen(attrib)); len += strlen(attrib); } subfpe = xalloc(sizeof *subfpe); if (subfpe == NULL) continue; /* The fonts returned by OpenFont will point back to the * subfpe they come from. So set the type of the subfpe to * what the catalogue fpe was assigned, so calls to CloseFont * (which uses font->fpe->type) goes to CatalogueCloseFont. */ subfpe->type = fpe->type; subfpe->name_length = len; subfpe->name = xalloc (len + 1); if (subfpe == NULL) { xfree(subfpe); continue; } memcpy(subfpe->name, dest, len); subfpe->name[len] = '\0'; /* The X server will manipulate the subfpe ref counts * associated with the font in OpenFont and CloseFont, so we * have to make sure it's valid. */ subfpe->refcount = 1; if (FontFileInitFPE (subfpe) != Successful) { xfree(subfpe->name); xfree(subfpe); continue; } if (CatalogueAddFPE(cat, subfpe) != Successful) { FontFileFreeFPE (subfpe); xfree(subfpe); continue; } } closedir(dir); qsort(cat->fpeList, cat->fpeCount, sizeof cat->fpeList[0], ComparePriority); cat->mtime = statbuf.st_mtime; return Successful; } ",1 "static int macvlan_broadcast_one(struct sk_buff *skb, const struct macvlan_dev *vlan, const struct ethhdr *eth, bool local) { struct net_device *dev = vlan->dev; if (!skb) return NET_RX_DROP; if (local) return vlan->forward(dev, skb); skb->dev = dev; if (!compare_ether_addr_64bits(eth->h_dest, dev->broadcast)) skb->pkt_type = PACKET_BROADCAST; else skb->pkt_type = PACKET_MULTICAST; return vlan->receive(skb); } ",0 "static unsigned short ReadDCMShort(DCMStreamInfo *stream_info,Image *image) { int shift, byte; unsigned short value; if (image->compression != RLECompression) return(ReadBlobLSBShort(image)); shift=image->depth < 16 ? 4 : 8; value=(unsigned short) ReadDCMByte(stream_info,image); byte=ReadDCMByte(stream_info,image); if (byte < 0) return(0); value|=(unsigned short) (byte << shift); return(value); } ",0 "void WebKitTestController::DiscardMainWindow() { WebContentsObserver::Observe(NULL); if (test_phase_ != BETWEEN_TESTS) { Shell::CloseAllWindows(); base::MessageLoop::current()->PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); test_phase_ = CLEAN_UP; } else if (main_window_) { main_window_->Close(); } main_window_ = NULL; current_pid_ = base::kNullProcessId; } ",0 "static int __hw_perf_event_init(struct perf_event *event) { struct perf_event_attr *attr = &event->attr; struct hw_perf_event *hwc = &event->hw; struct perf_event *evts[MAX_HWEVENTS]; unsigned long evtypes[MAX_HWEVENTS]; int idx_rubbish_bin[MAX_HWEVENTS]; int ev; int n; /* We only support a limited range of HARDWARE event types with one * only programmable via a RAW event type. */ if (attr->type == PERF_TYPE_HARDWARE) { if (attr->config >= alpha_pmu->max_events) return -EINVAL; ev = alpha_pmu->event_map[attr->config]; } else if (attr->type == PERF_TYPE_HW_CACHE) { return -EOPNOTSUPP; } else if (attr->type == PERF_TYPE_RAW) { ev = attr->config & 0xff; } else { return -EOPNOTSUPP; } if (ev < 0) { return ev; } /* The EV67 does not support mode exclusion */ if (attr->exclude_kernel || attr->exclude_user || attr->exclude_hv || attr->exclude_idle) { return -EPERM; } /* * We place the event type in event_base here and leave calculation * of the codes to programme the PMU for alpha_pmu_enable() because * it is only then we will know what HW events are actually * scheduled on to the PMU. At that point the code to programme the * PMU is put into config_base and the PMC to use is placed into * idx. We initialise idx (below) to PMC_NO_INDEX to indicate that * it is yet to be determined. */ hwc->event_base = ev; /* Collect events in a group together suitable for calling * alpha_check_constraints() to verify that the group as a whole can * be scheduled on to the PMU. */ n = 0; if (event->group_leader != event) { n = collect_events(event->group_leader, alpha_pmu->num_pmcs - 1, evts, evtypes, idx_rubbish_bin); if (n < 0) return -EINVAL; } evtypes[n] = hwc->event_base; evts[n] = event; if (alpha_check_constraints(evts, evtypes, n + 1)) return -EINVAL; /* Indicate that PMU config and idx are yet to be determined. */ hwc->config_base = 0; hwc->idx = PMC_NO_INDEX; event->destroy = hw_perf_event_destroy; /* * Most architectures reserve the PMU for their use at this point. * As there is no existing mechanism to arbitrate usage and there * appears to be no other user of the Alpha PMU we just assume * that we can just use it, hence a NO-OP here. * * Maybe an alpha_reserve_pmu() routine should be implemented but is * anything else ever going to use it? */ if (!hwc->sample_period) { hwc->sample_period = alpha_pmu->pmc_max_period[0]; hwc->last_period = hwc->sample_period; local64_set(&hwc->period_left, hwc->sample_period); } return 0; } ",0 "static bool hasTextContent(Resource* cachedResource) { InspectorPageAgent::ResourceType type = InspectorPageAgent::cachedResourceType(*cachedResource); return type == InspectorPageAgent::DocumentResource || type == InspectorPageAgent::StylesheetResource || type == InspectorPageAgent::ScriptResource || type == InspectorPageAgent::XHRResource; } ",0 "IPV6DefragSturgesNovakWindowsTest(void) { /* Expected data. */ u_char expected[] = { ""AAAAAAAA"" ""AAAAAAAA"" ""AAAAAAAA"" ""JJJJJJJJ"" ""BBBBBBBB"" ""BBBBBBBB"" ""CCCCCCCC"" ""CCCCCCCC"" ""CCCCCCCC"" ""LLLLLLLL"" ""LLLLLLLL"" ""LLLLLLLL"" ""MMMMMMMM"" ""EEEEEEEE"" ""EEEEEEEE"" ""FFFFFFFF"" ""FFFFFFFF"" ""FFFFFFFF"" ""GGGGGGGG"" ""GGGGGGGG"" ""HHHHHHHH"" ""HHHHHHHH"" ""IIIIIIII"" ""QQQQQQQQ"" }; return IPV6DefragDoSturgesNovakTest(DEFRAG_POLICY_WINDOWS, expected, sizeof(expected)); } ",0 "gpu::GpuChannelHost* RenderThreadImpl::GetGpuChannel() { if (!gpu_channel_) return nullptr; if (gpu_channel_->IsLost()) return nullptr; return gpu_channel_.get(); } ",0 "static int fuse_notify(struct fuse_conn *fc, enum fuse_notify_code code, unsigned int size, struct fuse_copy_state *cs) { /* Don't try to move pages (yet) */ cs->move_pages = 0; switch (code) { case FUSE_NOTIFY_POLL: return fuse_notify_poll(fc, size, cs); case FUSE_NOTIFY_INVAL_INODE: return fuse_notify_inval_inode(fc, size, cs); case FUSE_NOTIFY_INVAL_ENTRY: return fuse_notify_inval_entry(fc, size, cs); case FUSE_NOTIFY_STORE: return fuse_notify_store(fc, size, cs); case FUSE_NOTIFY_RETRIEVE: return fuse_notify_retrieve(fc, size, cs); case FUSE_NOTIFY_DELETE: return fuse_notify_delete(fc, size, cs); default: fuse_copy_finish(cs); return -EINVAL; } } ",0 "static int vqa_decode_chunk(VqaContext *s, AVFrame *frame) { unsigned int chunk_type; unsigned int chunk_size; int byte_skip; unsigned int index = 0; int i; unsigned char r, g, b; int index_shift; int res; int cbf0_chunk = -1; int cbfz_chunk = -1; int cbp0_chunk = -1; int cbpz_chunk = -1; int cpl0_chunk = -1; int cplz_chunk = -1; int vptz_chunk = -1; int x, y; int lines = 0; int pixel_ptr; int vector_index = 0; int lobyte = 0; int hibyte = 0; int lobytes = 0; int hibytes = s->decode_buffer_size / 2; /* first, traverse through the frame and find the subchunks */ while (bytestream2_get_bytes_left(&s->gb) >= 8) { chunk_type = bytestream2_get_be32u(&s->gb); index = bytestream2_tell(&s->gb); chunk_size = bytestream2_get_be32u(&s->gb); switch (chunk_type) { case CBF0_TAG: cbf0_chunk = index; break; case CBFZ_TAG: cbfz_chunk = index; break; case CBP0_TAG: cbp0_chunk = index; break; case CBPZ_TAG: cbpz_chunk = index; break; case CPL0_TAG: cpl0_chunk = index; break; case CPLZ_TAG: cplz_chunk = index; break; case VPTZ_TAG: vptz_chunk = index; break; default: av_log(s->avctx, AV_LOG_ERROR, ""Found unknown chunk type: %s (%08X)\n"", av_fourcc2str(av_bswap32(chunk_type)), chunk_type); break; } byte_skip = chunk_size & 0x01; bytestream2_skip(&s->gb, chunk_size + byte_skip); } /* next, deal with the palette */ if ((cpl0_chunk != -1) && (cplz_chunk != -1)) { /* a chunk should not have both chunk types */ av_log(s->avctx, AV_LOG_ERROR, ""problem: found both CPL0 and CPLZ chunks\n""); return AVERROR_INVALIDDATA; } /* decompress the palette chunk */ if (cplz_chunk != -1) { /* yet to be handled */ } /* convert the RGB palette into the machine's endian format */ if (cpl0_chunk != -1) { bytestream2_seek(&s->gb, cpl0_chunk, SEEK_SET); chunk_size = bytestream2_get_be32(&s->gb); /* sanity check the palette size */ if (chunk_size / 3 > 256 || chunk_size > bytestream2_get_bytes_left(&s->gb)) { av_log(s->avctx, AV_LOG_ERROR, ""problem: found a palette chunk with %d colors\n"", chunk_size / 3); return AVERROR_INVALIDDATA; } for (i = 0; i < chunk_size / 3; i++) { /* scale by 4 to transform 6-bit palette -> 8-bit */ r = bytestream2_get_byteu(&s->gb) * 4; g = bytestream2_get_byteu(&s->gb) * 4; b = bytestream2_get_byteu(&s->gb) * 4; s->palette[i] = 0xFFU << 24 | r << 16 | g << 8 | b; s->palette[i] |= s->palette[i] >> 6 & 0x30303; } } /* next, look for a full codebook */ if ((cbf0_chunk != -1) && (cbfz_chunk != -1)) { /* a chunk should not have both chunk types */ av_log(s->avctx, AV_LOG_ERROR, ""problem: found both CBF0 and CBFZ chunks\n""); return AVERROR_INVALIDDATA; } /* decompress the full codebook chunk */ if (cbfz_chunk != -1) { bytestream2_seek(&s->gb, cbfz_chunk, SEEK_SET); chunk_size = bytestream2_get_be32(&s->gb); if ((res = decode_format80(s, chunk_size, s->codebook, s->codebook_size, 0)) < 0) return res; } /* copy a full codebook */ if (cbf0_chunk != -1) { bytestream2_seek(&s->gb, cbf0_chunk, SEEK_SET); chunk_size = bytestream2_get_be32(&s->gb); /* sanity check the full codebook size */ if (chunk_size > MAX_CODEBOOK_SIZE) { av_log(s->avctx, AV_LOG_ERROR, ""problem: CBF0 chunk too large (0x%X bytes)\n"", chunk_size); return AVERROR_INVALIDDATA; } bytestream2_get_buffer(&s->gb, s->codebook, chunk_size); } /* decode the frame */ if (vptz_chunk == -1) { /* something is wrong if there is no VPTZ chunk */ av_log(s->avctx, AV_LOG_ERROR, ""problem: no VPTZ chunk found\n""); return AVERROR_INVALIDDATA; } bytestream2_seek(&s->gb, vptz_chunk, SEEK_SET); chunk_size = bytestream2_get_be32(&s->gb); if ((res = decode_format80(s, chunk_size, s->decode_buffer, s->decode_buffer_size, 1)) < 0) return res; /* render the final PAL8 frame */ if (s->vector_height == 4) index_shift = 4; else index_shift = 3; for (y = 0; y < s->height; y += s->vector_height) { for (x = 0; x < s->width; x += 4, lobytes++, hibytes++) { pixel_ptr = y * frame->linesize[0] + x; /* get the vector index, the method for which varies according to * VQA file version */ switch (s->vqa_version) { case 1: lobyte = s->decode_buffer[lobytes * 2]; hibyte = s->decode_buffer[(lobytes * 2) + 1]; vector_index = ((hibyte << 8) | lobyte) >> 3; vector_index <<= index_shift; lines = s->vector_height; /* uniform color fill - a quick hack */ if (hibyte == 0xFF) { while (lines--) { frame->data[0][pixel_ptr + 0] = 255 - lobyte; frame->data[0][pixel_ptr + 1] = 255 - lobyte; frame->data[0][pixel_ptr + 2] = 255 - lobyte; frame->data[0][pixel_ptr + 3] = 255 - lobyte; pixel_ptr += frame->linesize[0]; } lines=0; } break; case 2: lobyte = s->decode_buffer[lobytes]; hibyte = s->decode_buffer[hibytes]; vector_index = (hibyte << 8) | lobyte; vector_index <<= index_shift; lines = s->vector_height; break; case 3: /* not implemented yet */ lines = 0; break; } while (lines--) { frame->data[0][pixel_ptr + 0] = s->codebook[vector_index++]; frame->data[0][pixel_ptr + 1] = s->codebook[vector_index++]; frame->data[0][pixel_ptr + 2] = s->codebook[vector_index++]; frame->data[0][pixel_ptr + 3] = s->codebook[vector_index++]; pixel_ptr += frame->linesize[0]; } } } /* handle partial codebook */ if ((cbp0_chunk != -1) && (cbpz_chunk != -1)) { /* a chunk should not have both chunk types */ av_log(s->avctx, AV_LOG_ERROR, ""problem: found both CBP0 and CBPZ chunks\n""); return AVERROR_INVALIDDATA; } if (cbp0_chunk != -1) { bytestream2_seek(&s->gb, cbp0_chunk, SEEK_SET); chunk_size = bytestream2_get_be32(&s->gb); if (chunk_size > MAX_CODEBOOK_SIZE - s->next_codebook_buffer_index) { av_log(s->avctx, AV_LOG_ERROR, ""cbp0 chunk too large (%u bytes)\n"", chunk_size); return AVERROR_INVALIDDATA; } /* accumulate partial codebook */ bytestream2_get_buffer(&s->gb, &s->next_codebook_buffer[s->next_codebook_buffer_index], chunk_size); s->next_codebook_buffer_index += chunk_size; s->partial_countdown--; if (s->partial_countdown <= 0) { /* time to replace codebook */ memcpy(s->codebook, s->next_codebook_buffer, s->next_codebook_buffer_index); /* reset accounting */ s->next_codebook_buffer_index = 0; s->partial_countdown = s->partial_count; } } if (cbpz_chunk != -1) { bytestream2_seek(&s->gb, cbpz_chunk, SEEK_SET); chunk_size = bytestream2_get_be32(&s->gb); if (chunk_size > MAX_CODEBOOK_SIZE - s->next_codebook_buffer_index) { av_log(s->avctx, AV_LOG_ERROR, ""cbpz chunk too large (%u bytes)\n"", chunk_size); return AVERROR_INVALIDDATA; } /* accumulate partial codebook */ bytestream2_get_buffer(&s->gb, &s->next_codebook_buffer[s->next_codebook_buffer_index], chunk_size); s->next_codebook_buffer_index += chunk_size; s->partial_countdown--; if (s->partial_countdown <= 0) { bytestream2_init(&s->gb, s->next_codebook_buffer, s->next_codebook_buffer_index); /* decompress codebook */ if ((res = decode_format80(s, s->next_codebook_buffer_index, s->codebook, s->codebook_size, 0)) < 0) return res; /* reset accounting */ s->next_codebook_buffer_index = 0; s->partial_countdown = s->partial_count; } } return 0; } ",0 "static size_t q_encoder(char *str, const char *buf, size_t buflen, const char *tocode) { static const char hex[] = ""0123456789ABCDEF""; char *s0 = str; memcpy(str, ""=?"", 2); str += 2; memcpy(str, tocode, strlen(tocode)); str += strlen(tocode); memcpy(str, ""?Q?"", 3); str += 3; while (buflen--) { unsigned char c = *buf++; if (c == ' ') *str++ = '_'; else if ((c >= 0x7f) || (c < 0x20) || (c == '_') || strchr(MimeSpecials, c)) { *str++ = '='; *str++ = hex[(c & 0xf0) >> 4]; *str++ = hex[c & 0x0f]; } else *str++ = c; } memcpy(str, ""?="", 2); str += 2; return (str - s0); } ",0 " void DragFromCenterBy(aura::Window* window, int dx, int dy) { ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), window); generator.DragMouseBy(dx, dy); } ",0 " bool canCollapseWithMarginBefore() const { return m_atBeforeSideOfBlock && m_canCollapseMarginBeforeWithChildren; } ",0 "_dbus_get_real_time (long *tv_sec, long *tv_usec) { FILETIME ft; dbus_uint64_t time64; GetSystemTimeAsFileTime (&ft); memcpy (&time64, &ft, sizeof (time64)); /* Convert from 100s of nanoseconds since 1601-01-01 * to Unix epoch. Yes, this is Y2038 unsafe. */ time64 -= DBUS_INT64_CONSTANT (116444736000000000); time64 /= 10; if (tv_sec) *tv_sec = time64 / 1000000; if (tv_usec) *tv_usec = time64 % 1000000; } ",0 "ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_function_entry *functions, HashTable *function_table, int type TSRMLS_DC) /* {{{ */ { const zend_function_entry *ptr = functions; zend_function function, *reg_function; zend_internal_function *internal_function = (zend_internal_function *)&function; int count=0, unload=0; HashTable *target_function_table = function_table; int error_type; zend_function *ctor = NULL, *dtor = NULL, *clone = NULL, *__get = NULL, *__set = NULL, *__unset = NULL, *__isset = NULL, *__call = NULL, *__callstatic = NULL, *__tostring = NULL, *__debugInfo = NULL; const char *lowercase_name; int fname_len; const char *lc_class_name = NULL; int class_name_len = 0; zend_ulong hash; if (type==MODULE_PERSISTENT) { error_type = E_CORE_WARNING; } else { error_type = E_WARNING; } if (!target_function_table) { target_function_table = CG(function_table); } internal_function->type = ZEND_INTERNAL_FUNCTION; internal_function->module = EG(current_module); if (scope) { class_name_len = strlen(scope->name); if ((lc_class_name = zend_memrchr(scope->name, '\\', class_name_len))) { ++lc_class_name; class_name_len -= (lc_class_name - scope->name); lc_class_name = zend_str_tolower_dup(lc_class_name, class_name_len); } else { lc_class_name = zend_str_tolower_dup(scope->name, class_name_len); } } while (ptr->fname) { internal_function->handler = ptr->handler; internal_function->function_name = (char*)ptr->fname; internal_function->scope = scope; internal_function->prototype = NULL; if (ptr->flags) { if (!(ptr->flags & ZEND_ACC_PPP_MASK)) { if (ptr->flags != ZEND_ACC_DEPRECATED || scope) { zend_error(error_type, ""Invalid access level for %s%s%s() - access must be exactly one of public, protected or private"", scope ? scope->name : """", scope ? ""::"" : """", ptr->fname); } internal_function->fn_flags = ZEND_ACC_PUBLIC | ptr->flags; } else { internal_function->fn_flags = ptr->flags; } } else { internal_function->fn_flags = ZEND_ACC_PUBLIC; } if (ptr->arg_info) { zend_internal_function_info *info = (zend_internal_function_info*)ptr->arg_info; internal_function->arg_info = (zend_arg_info*)ptr->arg_info+1; internal_function->num_args = ptr->num_args; /* Currently you cannot denote that the function can accept less arguments than num_args */ if (info->required_num_args == -1) { internal_function->required_num_args = ptr->num_args; } else { internal_function->required_num_args = info->required_num_args; } if (info->return_reference) { internal_function->fn_flags |= ZEND_ACC_RETURN_REFERENCE; } if (ptr->arg_info[ptr->num_args].is_variadic) { internal_function->fn_flags |= ZEND_ACC_VARIADIC; } } else { internal_function->arg_info = NULL; internal_function->num_args = 0; internal_function->required_num_args = 0; } if (ptr->flags & ZEND_ACC_ABSTRACT) { if (scope) { /* This is a class that must be abstract itself. Here we set the check info. */ scope->ce_flags |= ZEND_ACC_IMPLICIT_ABSTRACT_CLASS; if (!(scope->ce_flags & ZEND_ACC_INTERFACE)) { /* Since the class is not an interface it needs to be declared as a abstract class. */ /* Since here we are handling internal functions only we can add the keyword flag. */ /* This time we set the flag for the keyword 'abstract'. */ scope->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; } } if (ptr->flags & ZEND_ACC_STATIC && (!scope || !(scope->ce_flags & ZEND_ACC_INTERFACE))) { zend_error(error_type, ""Static function %s%s%s() cannot be abstract"", scope ? scope->name : """", scope ? ""::"" : """", ptr->fname); } } else { if (scope && (scope->ce_flags & ZEND_ACC_INTERFACE)) { efree((char*)lc_class_name); zend_error(error_type, ""Interface %s cannot contain non abstract method %s()"", scope->name, ptr->fname); return FAILURE; } if (!internal_function->handler) { if (scope) { efree((char*)lc_class_name); } zend_error(error_type, ""Method %s%s%s() cannot be a NULL function"", scope ? scope->name : """", scope ? ""::"" : """", ptr->fname); zend_unregister_functions(functions, count, target_function_table TSRMLS_CC); return FAILURE; } } fname_len = strlen(ptr->fname); lowercase_name = zend_new_interned_string(zend_str_tolower_dup(ptr->fname, fname_len), fname_len + 1, 1 TSRMLS_CC); hash = str_hash(lowercase_name, fname_len); if (zend_hash_quick_add(target_function_table, lowercase_name, fname_len+1, hash, &function, sizeof(zend_function), (void**)®_function) == FAILURE) { unload=1; str_efree(lowercase_name); break; } /* If types of arguments have to be checked */ if (reg_function->common.arg_info && reg_function->common.num_args) { int i; for (i = 0; i < reg_function->common.num_args; i++) { if (reg_function->common.arg_info[i].class_name || reg_function->common.arg_info[i].type_hint) { reg_function->common.fn_flags |= ZEND_ACC_HAS_TYPE_HINTS; break; } } } if (scope) { /* Look for ctor, dtor, clone * If it's an old-style constructor, store it only if we don't have * a constructor already. */ if ((fname_len == class_name_len) && !ctor && !memcmp(lowercase_name, lc_class_name, class_name_len+1)) { ctor = reg_function; } else if ((fname_len == sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME) - 1)) { ctor = reg_function; } else if ((fname_len == sizeof(ZEND_DESTRUCTOR_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_DESTRUCTOR_FUNC_NAME, sizeof(ZEND_DESTRUCTOR_FUNC_NAME) - 1)) { dtor = reg_function; if (internal_function->num_args) { zend_error(error_type, ""Destructor %s::%s() cannot take arguments"", scope->name, ptr->fname); } } else if ((fname_len == sizeof(ZEND_CLONE_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME) - 1)) { clone = reg_function; } else if ((fname_len == sizeof(ZEND_CALL_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME) - 1)) { __call = reg_function; } else if ((fname_len == sizeof(ZEND_CALLSTATIC_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_CALLSTATIC_FUNC_NAME, sizeof(ZEND_CALLSTATIC_FUNC_NAME) - 1)) { __callstatic = reg_function; } else if ((fname_len == sizeof(ZEND_TOSTRING_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_TOSTRING_FUNC_NAME, sizeof(ZEND_TOSTRING_FUNC_NAME) - 1)) { __tostring = reg_function; } else if ((fname_len == sizeof(ZEND_GET_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME) - 1)) { __get = reg_function; } else if ((fname_len == sizeof(ZEND_SET_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME) - 1)) { __set = reg_function; } else if ((fname_len == sizeof(ZEND_UNSET_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_UNSET_FUNC_NAME, sizeof(ZEND_UNSET_FUNC_NAME) - 1)) { __unset = reg_function; } else if ((fname_len == sizeof(ZEND_ISSET_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_ISSET_FUNC_NAME, sizeof(ZEND_ISSET_FUNC_NAME) - 1)) { __isset = reg_function; } else if ((fname_len == sizeof(ZEND_DEBUGINFO_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_DEBUGINFO_FUNC_NAME, sizeof(ZEND_DEBUGINFO_FUNC_NAME) - 1)) { __debugInfo = reg_function; } else { reg_function = NULL; } if (reg_function) { zend_check_magic_method_implementation(scope, reg_function, error_type TSRMLS_CC); } } ptr++; count++; str_efree(lowercase_name); } if (unload) { /* before unloading, display all remaining bad function in the module */ if (scope) { efree((char*)lc_class_name); } while (ptr->fname) { fname_len = strlen(ptr->fname); lowercase_name = zend_str_tolower_dup(ptr->fname, fname_len); if (zend_hash_exists(target_function_table, lowercase_name, fname_len+1)) { zend_error(error_type, ""Function registration failed - duplicate name - %s%s%s"", scope ? scope->name : """", scope ? ""::"" : """", ptr->fname); } efree((char*)lowercase_name); ptr++; } zend_unregister_functions(functions, count, target_function_table TSRMLS_CC); return FAILURE; } if (scope) { scope->constructor = ctor; scope->destructor = dtor; scope->clone = clone; scope->__call = __call; scope->__callstatic = __callstatic; scope->__tostring = __tostring; scope->__get = __get; scope->__set = __set; scope->__unset = __unset; scope->__isset = __isset; scope->__debugInfo = __debugInfo; if (ctor) { ctor->common.fn_flags |= ZEND_ACC_CTOR; if (ctor->common.fn_flags & ZEND_ACC_STATIC) { zend_error(error_type, ""Constructor %s::%s() cannot be static"", scope->name, ctor->common.function_name); } ctor->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; } if (dtor) { dtor->common.fn_flags |= ZEND_ACC_DTOR; if (dtor->common.fn_flags & ZEND_ACC_STATIC) { zend_error(error_type, ""Destructor %s::%s() cannot be static"", scope->name, dtor->common.function_name); } dtor->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; } if (clone) { clone->common.fn_flags |= ZEND_ACC_CLONE; if (clone->common.fn_flags & ZEND_ACC_STATIC) { zend_error(error_type, ""Constructor %s::%s() cannot be static"", scope->name, clone->common.function_name); } clone->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; } if (__call) { if (__call->common.fn_flags & ZEND_ACC_STATIC) { zend_error(error_type, ""Method %s::%s() cannot be static"", scope->name, __call->common.function_name); } __call->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; } if (__callstatic) { if (!(__callstatic->common.fn_flags & ZEND_ACC_STATIC)) { zend_error(error_type, ""Method %s::%s() must be static"", scope->name, __callstatic->common.function_name); } __callstatic->common.fn_flags |= ZEND_ACC_STATIC; } if (__tostring) { if (__tostring->common.fn_flags & ZEND_ACC_STATIC) { zend_error(error_type, ""Method %s::%s() cannot be static"", scope->name, __tostring->common.function_name); } __tostring->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; } if (__get) { if (__get->common.fn_flags & ZEND_ACC_STATIC) { zend_error(error_type, ""Method %s::%s() cannot be static"", scope->name, __get->common.function_name); } __get->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; } if (__set) { if (__set->common.fn_flags & ZEND_ACC_STATIC) { zend_error(error_type, ""Method %s::%s() cannot be static"", scope->name, __set->common.function_name); } __set->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; } if (__unset) { if (__unset->common.fn_flags & ZEND_ACC_STATIC) { zend_error(error_type, ""Method %s::%s() cannot be static"", scope->name, __unset->common.function_name); } __unset->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; } if (__isset) { if (__isset->common.fn_flags & ZEND_ACC_STATIC) { zend_error(error_type, ""Method %s::%s() cannot be static"", scope->name, __isset->common.function_name); } __isset->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; } if (__debugInfo) { if (__debugInfo->common.fn_flags & ZEND_ACC_STATIC) { zend_error(error_type, ""Method %s::%s() cannot be static"", scope->name, __debugInfo->common.function_name); } } efree((char*)lc_class_name); } return SUCCESS; } /* }}} */ ",0 "bool RenderBox::repaintLayerRectsForImage(WrappedImagePtr image, const FillLayer* layers, bool drawingBackground) { IntRect rendererRect; RenderBox* layerRenderer = 0; for (const FillLayer* curLayer = layers; curLayer; curLayer = curLayer->next()) { if (curLayer->image() && image == curLayer->image()->data() && curLayer->image()->canRender(style()->effectiveZoom())) { if (!layerRenderer) { bool drawingRootBackground = drawingBackground && (isRoot() || (isBody() && !document()->documentElement()->renderer()->hasBackground())); if (drawingRootBackground) { layerRenderer = view(); int rw; int rh; if (FrameView* frameView = toRenderView(layerRenderer)->frameView()) { rw = frameView->contentsWidth(); rh = frameView->contentsHeight(); } else { rw = layerRenderer->width(); rh = layerRenderer->height(); } rendererRect = IntRect(-layerRenderer->marginLeft(), -layerRenderer->marginTop(), max(layerRenderer->width() + layerRenderer->marginLeft() + layerRenderer->marginRight() + layerRenderer->borderLeft() + layerRenderer->borderRight(), rw), max(layerRenderer->height() + layerRenderer->marginTop() + layerRenderer->marginBottom() + layerRenderer->borderTop() + layerRenderer->borderBottom(), rh)); } else { layerRenderer = this; rendererRect = borderBoxRect(); } } BackgroundImageGeometry geometry; layerRenderer->calculateBackgroundImageGeometry(curLayer, rendererRect, geometry); layerRenderer->repaintRectangle(geometry.destRect()); if (geometry.destRect() == rendererRect) return true; } } return false; } ",0 "nvmet_fc_rcv_fcp_req(struct nvmet_fc_target_port *target_port, struct nvmefc_tgt_fcp_req *fcpreq, void *cmdiubuf, u32 cmdiubuf_len) { struct nvmet_fc_tgtport *tgtport = targetport_to_tgtport(target_port); struct nvme_fc_cmd_iu *cmdiu = cmdiubuf; struct nvmet_fc_tgt_queue *queue; struct nvmet_fc_fcp_iod *fod; struct nvmet_fc_defer_fcp_req *deferfcp; unsigned long flags; /* validate iu, so the connection id can be used to find the queue */ if ((cmdiubuf_len != sizeof(*cmdiu)) || (cmdiu->scsi_id != NVME_CMD_SCSI_ID) || (cmdiu->fc_id != NVME_CMD_FC_ID) || (be16_to_cpu(cmdiu->iu_len) != (sizeof(*cmdiu)/4))) return -EIO; queue = nvmet_fc_find_target_queue(tgtport, be64_to_cpu(cmdiu->connection_id)); if (!queue) return -ENOTCONN; /* * note: reference taken by find_target_queue * After successful fod allocation, the fod will inherit the * ownership of that reference and will remove the reference * when the fod is freed. */ spin_lock_irqsave(&queue->qlock, flags); fod = nvmet_fc_alloc_fcp_iod(queue); if (fod) { spin_unlock_irqrestore(&queue->qlock, flags); fcpreq->nvmet_fc_private = fod; fod->fcpreq = fcpreq; memcpy(&fod->cmdiubuf, cmdiubuf, cmdiubuf_len); nvmet_fc_queue_fcp_req(tgtport, queue, fcpreq); return 0; } if (!tgtport->ops->defer_rcv) { spin_unlock_irqrestore(&queue->qlock, flags); /* release the queue lookup reference */ nvmet_fc_tgt_q_put(queue); return -ENOENT; } deferfcp = list_first_entry_or_null(&queue->avail_defer_list, struct nvmet_fc_defer_fcp_req, req_list); if (deferfcp) { /* Just re-use one that was previously allocated */ list_del(&deferfcp->req_list); } else { spin_unlock_irqrestore(&queue->qlock, flags); /* Now we need to dynamically allocate one */ deferfcp = kmalloc(sizeof(*deferfcp), GFP_KERNEL); if (!deferfcp) { /* release the queue lookup reference */ nvmet_fc_tgt_q_put(queue); return -ENOMEM; } spin_lock_irqsave(&queue->qlock, flags); } /* For now, use rspaddr / rsplen to save payload information */ fcpreq->rspaddr = cmdiubuf; fcpreq->rsplen = cmdiubuf_len; deferfcp->fcp_req = fcpreq; /* defer processing till a fod becomes available */ list_add_tail(&deferfcp->req_list, &queue->pending_cmd_list); /* NOTE: the queue lookup reference is still valid */ spin_unlock_irqrestore(&queue->qlock, flags); return -EOVERFLOW; } ",0 "GF_Err tfhd_Size(GF_Box *s) { GF_TrackFragmentHeaderBox *ptr = (GF_TrackFragmentHeaderBox *)s; ptr->size += 4; if (ptr->flags & GF_ISOM_TRAF_BASE_OFFSET) ptr->size += 8; if (ptr->flags & GF_ISOM_TRAF_SAMPLE_DESC) ptr->size += 4; if (ptr->flags & GF_ISOM_TRAF_SAMPLE_DUR) ptr->size += 4; if (ptr->flags & GF_ISOM_TRAF_SAMPLE_SIZE) ptr->size += 4; if (ptr->flags & GF_ISOM_TRAF_SAMPLE_FLAGS) ptr->size += 4; return GF_OK; } ",0 "static int handle_remove(FsContext *ctx, const char *path) { errno = EOPNOTSUPP; return -1; } ",0 "PrepareFrameAndViewForPrint::CreateURLLoaderFactory() { return blink::Platform::Current()->CreateDefaultURLLoaderFactory(); } ",0 "static int mov_read_timecode_track(AVFormatContext *s, AVStream *st) { MOVStreamContext *sc = st->priv_data; int flags = 0; int64_t cur_pos = avio_tell(sc->pb); uint32_t value; if (!st->nb_index_entries) return -1; avio_seek(sc->pb, st->index_entries->pos, SEEK_SET); value = avio_rb32(s->pb); if (sc->tmcd_flags & 0x0001) flags |= AV_TIMECODE_FLAG_DROPFRAME; if (sc->tmcd_flags & 0x0002) flags |= AV_TIMECODE_FLAG_24HOURSMAX; if (sc->tmcd_flags & 0x0004) flags |= AV_TIMECODE_FLAG_ALLOWNEGATIVE; /* Assume Counter flag is set to 1 in tmcd track (even though it is likely * not the case) and thus assume ""frame number format"" instead of QT one. * No sample with tmcd track can be found with a QT timecode at the moment, * despite what the tmcd track ""suggests"" (Counter flag set to 0 means QT * format). */ parse_timecode_in_framenum_format(s, st, value, flags); avio_seek(sc->pb, cur_pos, SEEK_SET); return 0; } ",0 "mm_answer_authpassword(int sock, Buffer *m) { static int call_count; char *passwd; int authenticated; u_int plen; if (!options.password_authentication) fatal(""%s: password authentication not enabled"", __func__); passwd = buffer_get_string(m, &plen); /* Only authenticate if the context is valid */ authenticated = options.password_authentication && auth_password(authctxt, passwd); explicit_bzero(passwd, strlen(passwd)); free(passwd); buffer_clear(m); buffer_put_int(m, authenticated); debug3(""%s: sending result %d"", __func__, authenticated); mm_request_send(sock, MONITOR_ANS_AUTHPASSWORD, m); call_count++; if (plen == 0 && call_count == 1) auth_method = ""none""; else auth_method = ""password""; /* Causes monitor loop to terminate if authenticated */ return (authenticated); } ",0 "static MagickBooleanType PCXWritePixels(PCXInfo *pcx_info, const unsigned char *pixels,Image *image) { register const unsigned char *q; register ssize_t i, x; ssize_t count; unsigned char packet, previous; q=pixels; for (i=0; i < (ssize_t) pcx_info->planes; i++) { if (pcx_info->encoding == 0) { for (x=0; x < (ssize_t) pcx_info->bytes_per_line; x++) (void) WriteBlobByte(image,(unsigned char) (*q++)); } else { previous=(*q++); count=1; for (x=0; x < (ssize_t) (pcx_info->bytes_per_line-1); x++) { packet=(*q++); if ((packet == previous) && (count < 63)) { count++; continue; } if ((count > 1) || ((previous & 0xc0) == 0xc0)) { count|=0xc0; (void) WriteBlobByte(image,(unsigned char) count); } (void) WriteBlobByte(image,previous); previous=packet; count=1; } if ((count > 1) || ((previous & 0xc0) == 0xc0)) { count|=0xc0; (void) WriteBlobByte(image,(unsigned char) count); } (void) WriteBlobByte(image,previous); } } return (MagickTrue); } ",0 " int GetZeroFrameBuffer(size_t min_size, vpx_codec_frame_buffer_t *fb) { EXPECT_TRUE(fb != NULL); const int idx = FindFreeBufferIndex(); if (idx == num_buffers_) return -1; if (ext_fb_list_[idx].size < min_size) { delete [] ext_fb_list_[idx].data; ext_fb_list_[idx].data = NULL; ext_fb_list_[idx].size = min_size; } SetFrameBuffer(idx, fb); return 0; } ",0 "void invalidate_blocks(struct f2fs_sb_info *sbi, block_t addr) { unsigned int segno = GET_SEGNO(sbi, addr); struct sit_info *sit_i = SIT_I(sbi); f2fs_bug_on(sbi, addr == NULL_ADDR); if (addr == NEW_ADDR) return; /* add it into sit main buffer */ mutex_lock(&sit_i->sentry_lock); update_sit_entry(sbi, addr, -1); /* add it into dirty seglist */ locate_dirty_segment(sbi, segno); mutex_unlock(&sit_i->sentry_lock); } ",0 "void FileManagerBrowserTestBase::SetUpCommandLine( base::CommandLine* command_line) { command_line->AppendSwitch(switches::kDisableAudioOutput); if (!GetRequiresStartupBrowser()) { command_line->AppendSwitch(switches::kNoStartupWindow); set_exit_when_last_browser_closes(false); } if (IsGuestModeTest()) { command_line->AppendSwitch(chromeos::switches::kGuestSession); command_line->AppendSwitchNative(chromeos::switches::kLoginUser, ""$guest""); command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, ""user""); command_line->AppendSwitch(switches::kIncognito); set_chromeos_user_ = false; } if (IsIncognitoModeTest()) { command_line->AppendSwitch(switches::kIncognito); } std::vector enabled_features; std::vector disabled_features; if (!IsGuestModeTest()) { enabled_features.emplace_back(features::kCrostini); } if (!IsNativeSmbTest()) { disabled_features.emplace_back(features::kNativeSmb); } if (IsDriveFsTest()) { enabled_features.emplace_back(chromeos::features::kDriveFs); } else { disabled_features.emplace_back(chromeos::features::kDriveFs); } if (IsMyFilesVolume()) { enabled_features.emplace_back(chromeos::features::kMyFilesVolume); } else { disabled_features.emplace_back(chromeos::features::kMyFilesVolume); } if (IsArcTest()) { arc::SetArcAvailableCommandLineForTesting(command_line); } if (IsDocumentsProviderTest()) { enabled_features.emplace_back( arc::kEnableDocumentsProviderInFilesAppFeature); } else { disabled_features.emplace_back( arc::kEnableDocumentsProviderInFilesAppFeature); } feature_list_.InitWithFeatures(enabled_features, disabled_features); extensions::ExtensionApiTest::SetUpCommandLine(command_line); } ",1 "static void php_imagepolygon(INTERNAL_FUNCTION_PARAMETERS, int filled) { zval *IM, *POINTS; long NPOINTS, COL; zval **var = NULL; gdImagePtr im; gdPointPtr points; int npoints, col, nelem, i; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""rall"", &IM, &POINTS, &NPOINTS, &COL) == FAILURE) { return; } ZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, ""Image"", le_gd); npoints = NPOINTS; col = COL; nelem = zend_hash_num_elements(Z_ARRVAL_P(POINTS)); if (nelem < 6) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""You must have at least 3 points in your array""); RETURN_FALSE; } if (npoints <= 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""You must give a positive number of points""); RETURN_FALSE; } if (nelem < npoints * 2) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Trying to use %d points in array with only %d points"", npoints, nelem/2); RETURN_FALSE; } points = (gdPointPtr) safe_emalloc(npoints, sizeof(gdPoint), 0); for (i = 0; i < npoints; i++) { if (zend_hash_index_find(Z_ARRVAL_P(POINTS), (i * 2), (void **) &var) == SUCCESS) { SEPARATE_ZVAL((var)); convert_to_long(*var); points[i].x = Z_LVAL_PP(var); } if (zend_hash_index_find(Z_ARRVAL_P(POINTS), (i * 2) + 1, (void **) &var) == SUCCESS) { SEPARATE_ZVAL(var); convert_to_long(*var); points[i].y = Z_LVAL_PP(var); } } if (filled) { gdImageFilledPolygon(im, points, npoints, col); } else { gdImagePolygon(im, points, npoints, col); } efree(points); RETURN_TRUE; } ",1 "static double TriangleThreshold(const Image *image,const double *histogram) { double a, b, c, count, distance, inverse_ratio, max_distance, segment, x1, x2, y1, y2; register ssize_t i; ssize_t end, max, start, threshold; /* Compute optimal threshold with triangle algorithm. */ start=0; /* find start bin, first bin not zero count */ for (i=0; i <= (ssize_t) MaxIntensity; i++) if (histogram[i] > 0.0) { start=i; break; } end=0; /* find end bin, last bin not zero count */ for (i=(ssize_t) MaxIntensity; i >= 0; i--) if (histogram[i] > 0.0) { end=i; break; } max=0; /* find max bin, bin with largest count */ count=0.0; for (i=0; i <= (ssize_t) MaxIntensity; i++) if (histogram[i] > count) { max=i; count=histogram[i]; } /* Compute threshold at split point. */ x1=(double) max; y1=histogram[max]; x2=(double) end; if ((max-start) >= (end-max)) x2=(double) start; y2=0.0; a=y1-y2; b=x2-x1; c=(-1.0)*(a*x1+b*y1); inverse_ratio=1.0/sqrt(a*a+b*b+c*c); threshold=0; max_distance=0.0; if (x2 == (double) start) for (i=start; i < max; i++) { segment=inverse_ratio*(a*i+b*histogram[i]+c); distance=sqrt(segment*segment); if ((distance > max_distance) && (segment > 0.0)) { threshold=i; max_distance=distance; } } else for (i=end; i > max; i--) { segment=inverse_ratio*(a*i+b*histogram[i]+c); distance=sqrt(segment*segment); if ((distance > max_distance) && (segment < 0.0)) { threshold=i; max_distance=distance; } } return(100.0*threshold/MaxIntensity); } ",0 "static void red_channel_pipes_create_batch(RedChannel *channel, new_pipe_item_t creator, void *data, rcc_item_t callback) { RingItem *link; RedChannelClient *rcc; PipeItem *item; int num = 0; RING_FOREACH(link, &channel->clients) { rcc = SPICE_CONTAINEROF(link, RedChannelClient, channel_link); item = (*creator)(rcc, data, num++); if (callback) { (*callback)(rcc, item); } } } ",0 " virtual void SetUp() { session_ = new protocol::FakeSession(); session_->set_message_loop(&message_loop_); viewer_ = new ConnectionToClient( base::MessageLoopProxy::current(), session_); viewer_->set_host_stub(&host_stub_); viewer_->set_input_stub(&input_stub_); viewer_->SetEventHandler(&handler_); EXPECT_CALL(handler_, OnConnectionOpened(viewer_.get())); session_->state_change_callback().Run( protocol::Session::CONNECTED); session_->state_change_callback().Run( protocol::Session::CONNECTED_CHANNELS); message_loop_.RunAllPending(); } ",0 "void RenderFrameImpl::SetPendingNavigationParams( scoped_ptr navigation_params) { pending_navigation_params_ = navigation_params.Pass(); } ",0 "void WebSocketExperimentTask::Run() { next_state_ = STATE_URL_FETCH; DoLoop(net::OK); } ",0 "static ssize_t mem_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { return mem_rw(file, buf, count, ppos, 0); } ",0 "static void set_node_addr(struct f2fs_sb_info *sbi, struct node_info *ni, block_t new_blkaddr, bool fsync_done) { struct f2fs_nm_info *nm_i = NM_I(sbi); struct nat_entry *e; down_write(&nm_i->nat_tree_lock); e = __lookup_nat_cache(nm_i, ni->nid); if (!e) { e = grab_nat_entry(nm_i, ni->nid, true); copy_node_info(&e->ni, ni); f2fs_bug_on(sbi, ni->blk_addr == NEW_ADDR); } else if (new_blkaddr == NEW_ADDR) { /* * when nid is reallocated, * previous nat entry can be remained in nat cache. * So, reinitialize it with new information. */ copy_node_info(&e->ni, ni); f2fs_bug_on(sbi, ni->blk_addr != NULL_ADDR); } /* sanity check */ f2fs_bug_on(sbi, nat_get_blkaddr(e) != ni->blk_addr); f2fs_bug_on(sbi, nat_get_blkaddr(e) == NULL_ADDR && new_blkaddr == NULL_ADDR); f2fs_bug_on(sbi, nat_get_blkaddr(e) == NEW_ADDR && new_blkaddr == NEW_ADDR); f2fs_bug_on(sbi, nat_get_blkaddr(e) != NEW_ADDR && nat_get_blkaddr(e) != NULL_ADDR && new_blkaddr == NEW_ADDR); /* increment version no as node is removed */ if (nat_get_blkaddr(e) != NEW_ADDR && new_blkaddr == NULL_ADDR) { unsigned char version = nat_get_version(e); nat_set_version(e, inc_node_version(version)); /* in order to reuse the nid */ if (nm_i->next_scan_nid > ni->nid) nm_i->next_scan_nid = ni->nid; } /* change address */ nat_set_blkaddr(e, new_blkaddr); if (new_blkaddr == NEW_ADDR || new_blkaddr == NULL_ADDR) set_nat_flag(e, IS_CHECKPOINTED, false); __set_nat_cache_dirty(nm_i, e); /* update fsync_mark if its inode nat entry is still alive */ if (ni->nid != ni->ino) e = __lookup_nat_cache(nm_i, ni->ino); if (e) { if (fsync_done && ni->nid == ni->ino) set_nat_flag(e, HAS_FSYNCED_INODE, true); set_nat_flag(e, HAS_LAST_FSYNC, fsync_done); } up_write(&nm_i->nat_tree_lock); } ",0 "static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *gb) { MpegEncContext *s = &ctx->m; int a = 2 << s->sprite_warping_accuracy; int rho = 3 - s->sprite_warping_accuracy; int r = 16 / a; int alpha = 1; int beta = 0; int w = s->width; int h = s->height; int min_ab, i, w2, h2, w3, h3; int sprite_ref[4][2]; int virtual_ref[2][2]; int64_t sprite_offset[2][2]; int64_t sprite_delta[2][2]; const int vop_ref[4][2] = { { 0, 0 }, { s->width, 0 }, { 0, s->height }, { s->width, s->height } }; int d[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }; if (w <= 0 || h <= 0) return AVERROR_INVALIDDATA; /* the decoder was not properly initialized and we cannot continue */ if (sprite_trajectory.table == NULL) return AVERROR_INVALIDDATA; for (i = 0; i < ctx->num_sprite_warping_points; i++) { int length; int x = 0, y = 0; length = get_vlc2(gb, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 3); if (length > 0) x = get_xbits(gb, length); if (!(ctx->divx_version == 500 && ctx->divx_build == 413)) check_marker(s->avctx, gb, ""before sprite_trajectory""); length = get_vlc2(gb, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 3); if (length > 0) y = get_xbits(gb, length); check_marker(s->avctx, gb, ""after sprite_trajectory""); ctx->sprite_traj[i][0] = d[i][0] = x; ctx->sprite_traj[i][1] = d[i][1] = y; } for (; i < 4; i++) ctx->sprite_traj[i][0] = ctx->sprite_traj[i][1] = 0; while ((1 << alpha) < w) alpha++; while ((1 << beta) < h) beta++; /* typo in the MPEG-4 std for the definition of w' and h' */ w2 = 1 << alpha; h2 = 1 << beta; if (ctx->divx_version == 500 && ctx->divx_build == 413) { sprite_ref[0][0] = a * vop_ref[0][0] + d[0][0]; sprite_ref[0][1] = a * vop_ref[0][1] + d[0][1]; sprite_ref[1][0] = a * vop_ref[1][0] + d[0][0] + d[1][0]; sprite_ref[1][1] = a * vop_ref[1][1] + d[0][1] + d[1][1]; sprite_ref[2][0] = a * vop_ref[2][0] + d[0][0] + d[2][0]; sprite_ref[2][1] = a * vop_ref[2][1] + d[0][1] + d[2][1]; } else { sprite_ref[0][0] = (a >> 1) * (2 * vop_ref[0][0] + d[0][0]); sprite_ref[0][1] = (a >> 1) * (2 * vop_ref[0][1] + d[0][1]); sprite_ref[1][0] = (a >> 1) * (2 * vop_ref[1][0] + d[0][0] + d[1][0]); sprite_ref[1][1] = (a >> 1) * (2 * vop_ref[1][1] + d[0][1] + d[1][1]); sprite_ref[2][0] = (a >> 1) * (2 * vop_ref[2][0] + d[0][0] + d[2][0]); sprite_ref[2][1] = (a >> 1) * (2 * vop_ref[2][1] + d[0][1] + d[2][1]); } /* sprite_ref[3][0] = (a >> 1) * (2 * vop_ref[3][0] + d[0][0] + d[1][0] + d[2][0] + d[3][0]); * sprite_ref[3][1] = (a >> 1) * (2 * vop_ref[3][1] + d[0][1] + d[1][1] + d[2][1] + d[3][1]); */ /* This is mostly identical to the MPEG-4 std (and is totally unreadable * because of that...). Perhaps it should be reordered to be more readable. * The idea behind this virtual_ref mess is to be able to use shifts later * per pixel instead of divides so the distance between points is converted * from w&h based to w2&h2 based which are of the 2^x form. */ virtual_ref[0][0] = 16 * (vop_ref[0][0] + w2) + ROUNDED_DIV(((w - w2) * (r * sprite_ref[0][0] - 16LL * vop_ref[0][0]) + w2 * (r * sprite_ref[1][0] - 16LL * vop_ref[1][0])), w); virtual_ref[0][1] = 16 * vop_ref[0][1] + ROUNDED_DIV(((w - w2) * (r * sprite_ref[0][1] - 16LL * vop_ref[0][1]) + w2 * (r * sprite_ref[1][1] - 16LL * vop_ref[1][1])), w); virtual_ref[1][0] = 16 * vop_ref[0][0] + ROUNDED_DIV(((h - h2) * (r * sprite_ref[0][0] - 16LL * vop_ref[0][0]) + h2 * (r * sprite_ref[2][0] - 16LL * vop_ref[2][0])), h); virtual_ref[1][1] = 16 * (vop_ref[0][1] + h2) + ROUNDED_DIV(((h - h2) * (r * sprite_ref[0][1] - 16LL * vop_ref[0][1]) + h2 * (r * sprite_ref[2][1] - 16LL * vop_ref[2][1])), h); switch (ctx->num_sprite_warping_points) { case 0: sprite_offset[0][0] = sprite_offset[0][1] = sprite_offset[1][0] = sprite_offset[1][1] = 0; sprite_delta[0][0] = a; sprite_delta[0][1] = sprite_delta[1][0] = 0; sprite_delta[1][1] = a; ctx->sprite_shift[0] = ctx->sprite_shift[1] = 0; break; case 1: // GMC only sprite_offset[0][0] = sprite_ref[0][0] - a * vop_ref[0][0]; sprite_offset[0][1] = sprite_ref[0][1] - a * vop_ref[0][1]; sprite_offset[1][0] = ((sprite_ref[0][0] >> 1) | (sprite_ref[0][0] & 1)) - a * (vop_ref[0][0] / 2); sprite_offset[1][1] = ((sprite_ref[0][1] >> 1) | (sprite_ref[0][1] & 1)) - a * (vop_ref[0][1] / 2); sprite_delta[0][0] = a; sprite_delta[0][1] = sprite_delta[1][0] = 0; sprite_delta[1][1] = a; ctx->sprite_shift[0] = ctx->sprite_shift[1] = 0; break; case 2: sprite_offset[0][0] = ((int64_t) sprite_ref[0][0] * (1 << alpha + rho)) + ((int64_t) -r * sprite_ref[0][0] + virtual_ref[0][0]) * ((int64_t) -vop_ref[0][0]) + ((int64_t) r * sprite_ref[0][1] - virtual_ref[0][1]) * ((int64_t) -vop_ref[0][1]) + (1 << (alpha + rho - 1)); sprite_offset[0][1] = ((int64_t) sprite_ref[0][1] * (1 << alpha + rho)) + ((int64_t) -r * sprite_ref[0][1] + virtual_ref[0][1]) * ((int64_t) -vop_ref[0][0]) + ((int64_t) -r * sprite_ref[0][0] + virtual_ref[0][0]) * ((int64_t) -vop_ref[0][1]) + (1 << (alpha + rho - 1)); sprite_offset[1][0] = (((int64_t)-r * sprite_ref[0][0] + virtual_ref[0][0]) * ((int64_t)-2 * vop_ref[0][0] + 1) + ((int64_t) r * sprite_ref[0][1] - virtual_ref[0][1]) * ((int64_t)-2 * vop_ref[0][1] + 1) + 2 * w2 * r * (int64_t) sprite_ref[0][0] - 16 * w2 + (1 << (alpha + rho + 1))); sprite_offset[1][1] = (((int64_t)-r * sprite_ref[0][1] + virtual_ref[0][1]) * ((int64_t)-2 * vop_ref[0][0] + 1) + ((int64_t)-r * sprite_ref[0][0] + virtual_ref[0][0]) * ((int64_t)-2 * vop_ref[0][1] + 1) + 2 * w2 * r * (int64_t) sprite_ref[0][1] - 16 * w2 + (1 << (alpha + rho + 1))); sprite_delta[0][0] = (-r * sprite_ref[0][0] + virtual_ref[0][0]); sprite_delta[0][1] = (+r * sprite_ref[0][1] - virtual_ref[0][1]); sprite_delta[1][0] = (-r * sprite_ref[0][1] + virtual_ref[0][1]); sprite_delta[1][1] = (-r * sprite_ref[0][0] + virtual_ref[0][0]); ctx->sprite_shift[0] = alpha + rho; ctx->sprite_shift[1] = alpha + rho + 2; break; case 3: min_ab = FFMIN(alpha, beta); w3 = w2 >> min_ab; h3 = h2 >> min_ab; sprite_offset[0][0] = ((int64_t)sprite_ref[0][0] * (1 << (alpha + beta + rho - min_ab))) + ((int64_t)-r * sprite_ref[0][0] + virtual_ref[0][0]) * h3 * (-vop_ref[0][0]) + ((int64_t)-r * sprite_ref[0][0] + virtual_ref[1][0]) * w3 * (-vop_ref[0][1]) + ((int64_t)1 << (alpha + beta + rho - min_ab - 1)); sprite_offset[0][1] = ((int64_t)sprite_ref[0][1] * (1 << (alpha + beta + rho - min_ab))) + ((int64_t)-r * sprite_ref[0][1] + virtual_ref[0][1]) * h3 * (-vop_ref[0][0]) + ((int64_t)-r * sprite_ref[0][1] + virtual_ref[1][1]) * w3 * (-vop_ref[0][1]) + ((int64_t)1 << (alpha + beta + rho - min_ab - 1)); sprite_offset[1][0] = ((int64_t)-r * sprite_ref[0][0] + virtual_ref[0][0]) * h3 * (-2 * vop_ref[0][0] + 1) + ((int64_t)-r * sprite_ref[0][0] + virtual_ref[1][0]) * w3 * (-2 * vop_ref[0][1] + 1) + (int64_t)2 * w2 * h3 * r * sprite_ref[0][0] - 16 * w2 * h3 + ((int64_t)1 << (alpha + beta + rho - min_ab + 1)); sprite_offset[1][1] = ((int64_t)-r * sprite_ref[0][1] + virtual_ref[0][1]) * h3 * (-2 * vop_ref[0][0] + 1) + ((int64_t)-r * sprite_ref[0][1] + virtual_ref[1][1]) * w3 * (-2 * vop_ref[0][1] + 1) + (int64_t)2 * w2 * h3 * r * sprite_ref[0][1] - 16 * w2 * h3 + ((int64_t)1 << (alpha + beta + rho - min_ab + 1)); sprite_delta[0][0] = (-r * (int64_t)sprite_ref[0][0] + virtual_ref[0][0]) * h3; sprite_delta[0][1] = (-r * (int64_t)sprite_ref[0][0] + virtual_ref[1][0]) * w3; sprite_delta[1][0] = (-r * (int64_t)sprite_ref[0][1] + virtual_ref[0][1]) * h3; sprite_delta[1][1] = (-r * (int64_t)sprite_ref[0][1] + virtual_ref[1][1]) * w3; ctx->sprite_shift[0] = alpha + beta + rho - min_ab; ctx->sprite_shift[1] = alpha + beta + rho - min_ab + 2; break; } /* try to simplify the situation */ if (sprite_delta[0][0] == a << ctx->sprite_shift[0] && sprite_delta[0][1] == 0 && sprite_delta[1][0] == 0 && sprite_delta[1][1] == a << ctx->sprite_shift[0]) { sprite_offset[0][0] >>= ctx->sprite_shift[0]; sprite_offset[0][1] >>= ctx->sprite_shift[0]; sprite_offset[1][0] >>= ctx->sprite_shift[1]; sprite_offset[1][1] >>= ctx->sprite_shift[1]; sprite_delta[0][0] = a; sprite_delta[0][1] = 0; sprite_delta[1][0] = 0; sprite_delta[1][1] = a; ctx->sprite_shift[0] = 0; ctx->sprite_shift[1] = 0; s->real_sprite_warping_points = 1; } else { int shift_y = 16 - ctx->sprite_shift[0]; int shift_c = 16 - ctx->sprite_shift[1]; for (i = 0; i < 2; i++) { if (shift_c < 0 || shift_y < 0 || FFABS( sprite_offset[0][i]) >= INT_MAX >> shift_y || FFABS( sprite_offset[1][i]) >= INT_MAX >> shift_c || FFABS( sprite_delta[0][i]) >= INT_MAX >> shift_y || FFABS( sprite_delta[1][i]) >= INT_MAX >> shift_y ) { avpriv_request_sample(s->avctx, ""Too large sprite shift, delta or offset""); goto overflow; } } for (i = 0; i < 2; i++) { sprite_offset[0][i] *= 1 << shift_y; sprite_offset[1][i] *= 1 << shift_c; sprite_delta[0][i] *= 1 << shift_y; sprite_delta[1][i] *= 1 << shift_y; ctx->sprite_shift[i] = 16; } for (i = 0; i < 2; i++) { int64_t sd[2] = { sprite_delta[i][0] - a * (1LL<<16), sprite_delta[i][1] - a * (1LL<<16) }; if (llabs(sprite_offset[0][i] + sprite_delta[i][0] * (w+16LL)) >= INT_MAX || llabs(sprite_offset[0][i] + sprite_delta[i][1] * (h+16LL)) >= INT_MAX || llabs(sprite_offset[0][i] + sprite_delta[i][0] * (w+16LL) + sprite_delta[i][1] * (h+16LL)) >= INT_MAX || llabs(sprite_delta[i][0] * (w+16LL)) >= INT_MAX || llabs(sprite_delta[i][1] * (h+16LL)) >= INT_MAX || llabs(sd[0]) >= INT_MAX || llabs(sd[1]) >= INT_MAX || llabs(sprite_offset[0][i] + sd[0] * (w+16LL)) >= INT_MAX || llabs(sprite_offset[0][i] + sd[1] * (h+16LL)) >= INT_MAX || llabs(sprite_offset[0][i] + sd[0] * (w+16LL) + sd[1] * (h+16LL)) >= INT_MAX ) { avpriv_request_sample(s->avctx, ""Overflow on sprite points""); goto overflow; } } s->real_sprite_warping_points = ctx->num_sprite_warping_points; } for (i = 0; i < 4; i++) { s->sprite_offset[i&1][i>>1] = sprite_offset[i&1][i>>1]; s->sprite_delta [i&1][i>>1] = sprite_delta [i&1][i>>1]; } return 0; overflow: memset(s->sprite_offset, 0, sizeof(s->sprite_offset)); memset(s->sprite_delta, 0, sizeof(s->sprite_delta)); return AVERROR_PATCHWELCOME; } ",0 "init_device (u2fh_devs * devs, struct u2fdevice *dev) { unsigned char resp[1024]; unsigned char nonce[8]; if (obtain_nonce(nonce) != 0) { return U2FH_TRANSPORT_ERROR; } size_t resplen = sizeof (resp); dev->cid = CID_BROADCAST; if (u2fh_sendrecv (devs, dev->id, U2FHID_INIT, nonce, sizeof (nonce), resp, &resplen) == U2FH_OK) { U2FHID_INIT_RESP initresp; if (resplen > sizeof (initresp)) { return U2FH_MEMORY_ERROR; } memcpy (&initresp, resp, resplen); dev->cid = initresp.cid; dev->versionInterface = initresp.versionInterface; dev->versionMajor = initresp.versionMajor; dev->versionMinor = initresp.versionMinor; dev->capFlags = initresp.capFlags; } else { return U2FH_TRANSPORT_ERROR; } return U2FH_OK; } ",1 "juniper_pppoe_atm_print(netdissect_options *ndo, const struct pcap_pkthdr *h, register const u_char *p) { struct juniper_l2info_t l2info; uint16_t extracted_ethertype; l2info.pictype = DLT_JUNIPER_PPPOE_ATM; if (juniper_parse_header(ndo, p, h, &l2info) == 0) return l2info.header_len; p+=l2info.header_len; extracted_ethertype = EXTRACT_16BITS(p); /* this DLT contains nothing but raw PPPoE frames, * prepended with a type field*/ if (ethertype_print(ndo, extracted_ethertype, p+ETHERTYPE_LEN, l2info.length-ETHERTYPE_LEN, l2info.caplen-ETHERTYPE_LEN, NULL, NULL) == 0) /* ether_type not known, probably it wasn't one */ ND_PRINT((ndo, ""unknown ethertype 0x%04x"", extracted_ethertype)); return l2info.header_len; } ",0 "static int fuse_ioctl_copy_user(struct page **pages, struct iovec *iov, unsigned int nr_segs, size_t bytes, bool to_user) { struct iov_iter ii; int page_idx = 0; if (!bytes) return 0; iov_iter_init(&ii, iov, nr_segs, bytes, 0); while (iov_iter_count(&ii)) { struct page *page = pages[page_idx++]; size_t todo = min_t(size_t, PAGE_SIZE, iov_iter_count(&ii)); void *kaddr; kaddr = kmap(page); while (todo) { char __user *uaddr = ii.iov->iov_base + ii.iov_offset; size_t iov_len = ii.iov->iov_len - ii.iov_offset; size_t copy = min(todo, iov_len); size_t left; if (!to_user) left = copy_from_user(kaddr, uaddr, copy); else left = copy_to_user(uaddr, kaddr, copy); if (unlikely(left)) return -EFAULT; iov_iter_advance(&ii, copy); todo -= copy; kaddr += copy; } kunmap(page); } return 0; } ",0 "static int crypto_report_comp(struct sk_buff *skb, struct crypto_alg *alg) { struct crypto_report_comp rcomp; snprintf(rcomp.type, CRYPTO_MAX_ALG_NAME, ""%s"", ""compression""); if (nla_put(skb, CRYPTOCFGA_REPORT_COMPRESS, sizeof(struct crypto_report_comp), &rcomp)) goto nla_put_failure; return 0; nla_put_failure: return -EMSGSIZE; } ",1 "void phar_destroy_phar_data(phar_archive_data *phar TSRMLS_DC) /* {{{ */ { if (phar->alias && phar->alias != phar->fname) { pefree(phar->alias, phar->is_persistent); phar->alias = NULL; } if (phar->fname) { pefree(phar->fname, phar->is_persistent); phar->fname = NULL; } if (phar->signature) { pefree(phar->signature, phar->is_persistent); phar->signature = NULL; } if (phar->manifest.arBuckets) { zend_hash_destroy(&phar->manifest); phar->manifest.arBuckets = NULL; } if (phar->mounted_dirs.arBuckets) { zend_hash_destroy(&phar->mounted_dirs); phar->mounted_dirs.arBuckets = NULL; } if (phar->virtual_dirs.arBuckets) { zend_hash_destroy(&phar->virtual_dirs); phar->virtual_dirs.arBuckets = NULL; } if (phar->metadata) { if (phar->is_persistent) { if (phar->metadata_len) { /* for zip comments that are strings */ free(phar->metadata); } else { zval_internal_ptr_dtor(&phar->metadata); } } else { zval_ptr_dtor(&phar->metadata); } phar->metadata_len = 0; phar->metadata = 0; } if (phar->fp) { php_stream_close(phar->fp); phar->fp = 0; } if (phar->ufp) { php_stream_close(phar->ufp); phar->ufp = 0; } pefree(phar, phar->is_persistent); } /* }}}*/ ",0 "int php_openssl_get_ssl_stream_data_index() { return ssl_stream_data_index; } ",0 "DevToolsWindow* DevToolsWindow::AsDevToolsWindow( content::RenderViewHost* window_rvh) { if (g_instances == NULL) return NULL; DevToolsWindows* instances = &g_instances.Get(); for (DevToolsWindows::iterator it(instances->begin()); it != instances->end(); ++it) { if ((*it)->web_contents_->GetRenderViewHost() == window_rvh) return *it; } return NULL; } ",0 "PHP_FUNCTION( locale_get_region ) { get_icu_value_src_php( LOC_REGION_TAG , INTERNAL_FUNCTION_PARAM_PASSTHRU ); } ",0 "String UrlForFrame(LocalFrame* frame) { KURL url = frame->GetDocument()->Url(); url.RemoveFragmentIdentifier(); return url.GetString(); } ",0 "expand_case_fold_make_rem_string(Node** rnode, UChar *s, UChar *end, regex_t* reg) { int r; Node *node; node = onig_node_new_str(s, end); if (IS_NULL(node)) return ONIGERR_MEMORY; r = update_string_node_case_fold(reg, node); if (r != 0) { onig_node_free(node); return r; } NODE_STRING_SET_AMBIG(node); NODE_STRING_SET_DONT_GET_OPT_INFO(node); *rnode = node; return 0; } ",0 "bool RTCPeerConnectionHandler::AddICECandidate( const blink::WebRTCVoidRequest& request, scoped_refptr candidate) { DCHECK(task_runner_->RunsTasksInCurrentSequence()); TRACE_EVENT0(""webrtc"", ""RTCPeerConnectionHandler::addICECandidate""); bool result = AddICECandidate(std::move(candidate)); task_runner_->PostTask( FROM_HERE, base::BindOnce(&RTCPeerConnectionHandler::OnaddICECandidateResult, weak_factory_.GetWeakPtr(), request, result)); return true; } ",0 "void GLES2Implementation::GetQueryObjectui64vEXT(GLuint id, GLenum pname, GLuint64* params) { GLuint64 result = 0; if (GetQueryObjectValueHelper(""glGetQueryObjectui64vEXT"", id, pname, &result)) *params = result; } ",0 "static int anon_pipe_buf_steal(struct pipe_inode_info *pipe, struct pipe_buffer *buf) { struct page *page = buf->page; if (page_count(page) == 1) { memcg_kmem_uncharge(page, 0); __SetPageLocked(page); return 0; } return 1; } ",0 " virtual bool IsAutoFillEnabled() const { return autofill_enabled_; } ",0 "static inline int sem_security(struct kern_ipc_perm *ipcp, int semflg) { struct sem_array *sma; sma = container_of(ipcp, struct sem_array, sem_perm); return security_sem_associate(sma, semflg); } ",0 "kwsexec (kwset_t kws, char const *text, size_t size, struct kwsmatch *kwsmatch) { struct kwset const *kwset = (struct kwset *) kws; if (kwset->words == 1 && kwset->trans == NULL) { size_t ret = bmexec (kws, text, size); if (ret != (size_t) -1) { kwsmatch->index = 0; kwsmatch->offset[0] = ret; kwsmatch->size[0] = kwset->mind; } return ret; } else return cwexec(kws, text, size, kwsmatch); } ",0 "static void hardware_enable(void) { raw_spin_lock(&kvm_count_lock); if (kvm_usage_count) hardware_enable_nolock(NULL); raw_spin_unlock(&kvm_count_lock); } ",0 "static int tls1_check_sig_alg(CERT *c, X509 *x, int default_nid) { int sig_nid; size_t i; if (default_nid == -1) return 1; sig_nid = X509_get_signature_nid(x); if (default_nid) return sig_nid == default_nid ? 1 : 0; for (i = 0; i < c->shared_sigalgslen; i++) if (sig_nid == c->shared_sigalgs[i].signandhash_nid) return 1; return 0; } ",0 "ContentEncoding::ContentEncryption::~ContentEncryption() { delete[] key_id; delete[] signature; delete[] sig_key_id; } ",0 "static int print_module_info(zend_module_entry *module, void *arg TSRMLS_DC) { php_printf(""%s\n"", module->name); return 0; } ",0 "void ACodec::notifyOfRenderedFrames(bool dropIncomplete, FrameRenderTracker::Info *until) { sp msg = mNotify->dup(); msg->setInt32(""what"", CodecBase::kWhatOutputFramesRendered); std::list done = mRenderTracker.checkFencesAndGetRenderedFrames(until, dropIncomplete); for (std::list::const_iterator it = done.cbegin(); it != done.cend(); ++it) { ssize_t index = it->getIndex(); if (index >= 0 && (size_t)index < mBuffers[kPortIndexOutput].size()) { mBuffers[kPortIndexOutput].editItemAt(index).mRenderInfo = NULL; } else if (index >= 0) { ALOGE(""invalid index %zd in %zu"", index, mBuffers[kPortIndexOutput].size()); } } if (MediaCodec::CreateFramesRenderedMessage(done, msg)) { msg->post(); } } ",0 " memory_handle(const media::BitstreamBuffer& input) { base::SharedMemoryHandle input_handle = base::SharedMemory::DuplicateHandle(input.handle()); if (!base::SharedMemory::IsHandleValid(input_handle)) { DLOG(ERROR) << ""Failed to duplicate handle of BitstreamBuffer""; return mojo::ScopedSharedBufferHandle(); } return mojo::WrapSharedMemoryHandle(input_handle, input.size(), true /* read_only */); } ",1 "_pixman_image_get_scanline_generic_float (pixman_iter_t * iter, const uint32_t *mask) { pixman_iter_get_scanline_t fetch_32 = iter->data; uint32_t *buffer = iter->buffer; fetch_32 (iter, NULL); pixman_expand_to_float ((argb_t *)buffer, buffer, PIXMAN_a8r8g8b8, iter->width); return iter->buffer; } ",0 " int32_t PPB_URLLoader_Impl::Open(PP_Resource request_id, PP_CompletionCallback callback) { EnterResourceNoLock enter_request(request_id, true); if (enter_request.failed()) return PP_ERROR_BADARGUMENT; PPB_URLRequestInfo_Impl* request = static_cast( enter_request.object()); int32_t rv = ValidateCallback(callback); if (rv != PP_OK) return rv; if (request->RequiresUniversalAccess() && !has_universal_access_) return PP_ERROR_NOACCESS; if (loader_.get()) return PP_ERROR_INPROGRESS; WebFrame* frame = instance()->container()->element().document().frame(); if (!frame) return PP_ERROR_FAILED; WebURLRequest web_request(request->ToWebURLRequest(frame)); WebURLLoaderOptions options; if (has_universal_access_) { options.crossOriginRequestPolicy = WebURLLoaderOptions::CrossOriginRequestPolicyAllow; options.allowCredentials = true; } else if (request->allow_cross_origin_requests()) { options.crossOriginRequestPolicy = WebURLLoaderOptions::CrossOriginRequestPolicyUseAccessControl; options.allowCredentials = request->allow_credentials(); } is_asynchronous_load_suspended_ = false; loader_.reset(frame->createAssociatedURLLoader(options)); if (!loader_.get()) return PP_ERROR_FAILED; loader_->loadAsynchronously(web_request, this); if (done_status_ == PP_ERROR_FAILED || done_status_ == PP_ERROR_NOACCESS) return done_status_; request_info_ = scoped_refptr(request); RegisterCallback(callback); return PP_OK_COMPLETIONPENDING; } ",0 "static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb) { struct net *net = sock_net(skb->sk); int h, s_h; int idx, s_idx; int ip_idx, s_ip_idx; struct net_device *dev; struct in_device *in_dev; struct in_ifaddr *ifa; struct hlist_head *head; s_h = cb->args[0]; s_idx = idx = cb->args[1]; s_ip_idx = ip_idx = cb->args[2]; for (h = s_h; h < NETDEV_HASHENTRIES; h++, s_idx = 0) { idx = 0; head = &net->dev_index_head[h]; rcu_read_lock(); cb->seq = atomic_read(&net->ipv4.dev_addr_genid) ^ net->dev_base_seq; hlist_for_each_entry_rcu(dev, head, index_hlist) { if (idx < s_idx) goto cont; if (h > s_h || idx > s_idx) s_ip_idx = 0; in_dev = __in_dev_get_rcu(dev); if (!in_dev) goto cont; for (ifa = in_dev->ifa_list, ip_idx = 0; ifa; ifa = ifa->ifa_next, ip_idx++) { if (ip_idx < s_ip_idx) continue; if (inet_fill_ifaddr(skb, ifa, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, RTM_NEWADDR, NLM_F_MULTI) < 0) { rcu_read_unlock(); goto done; } nl_dump_check_consistent(cb, nlmsg_hdr(skb)); } cont: idx++; } rcu_read_unlock(); } done: cb->args[0] = h; cb->args[1] = idx; cb->args[2] = ip_idx; return skb->len; } ",0 "xmlXPathNamespaceURIFunction(xmlXPathParserContextPtr ctxt, int nargs) { xmlXPathObjectPtr cur; if (ctxt == NULL) return; if (nargs == 0) { valuePush(ctxt, xmlXPathCacheNewNodeSet(ctxt->context, ctxt->context->node)); nargs = 1; } 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->nodesetval == NULL) || (cur->nodesetval->nodeNr == 0)) { valuePush(ctxt, xmlXPathCacheNewCString(ctxt->context, """")); } else { int i = 0; /* Should be first in document order !!!!! */ switch (cur->nodesetval->nodeTab[i]->type) { case XML_ELEMENT_NODE: case XML_ATTRIBUTE_NODE: if (cur->nodesetval->nodeTab[i]->ns == NULL) valuePush(ctxt, xmlXPathCacheNewCString(ctxt->context, """")); else valuePush(ctxt, xmlXPathCacheNewString(ctxt->context, cur->nodesetval->nodeTab[i]->ns->href)); break; default: valuePush(ctxt, xmlXPathCacheNewCString(ctxt->context, """")); } } xmlXPathReleaseObject(ctxt->context, cur); } ",0 "static inline void GetMinimumPixelList(PixelList *pixel_list,Quantum *pixel) { register SkipList *p; size_t color, minimum; ssize_t count; /* Find the minimum value for each of the color. */ p=(&pixel_list->skip_list); count=0; color=65536UL; minimum=p->nodes[color].next[0]; do { color=p->nodes[color].next[0]; if (color < minimum) minimum=color; count+=p->nodes[color].count; } while (count < (ssize_t) pixel_list->length); *pixel=ScaleShortToQuantum((unsigned short) minimum); } ",0 "static void update_top_cache_domain(int cpu) { struct sched_domain *sd; struct sched_domain *busy_sd = NULL; int id = cpu; int size = 1; sd = highest_flag_domain(cpu, SD_SHARE_PKG_RESOURCES); if (sd) { id = cpumask_first(sched_domain_span(sd)); size = cpumask_weight(sched_domain_span(sd)); busy_sd = sd->parent; /* sd_busy */ } rcu_assign_pointer(per_cpu(sd_busy, cpu), busy_sd); rcu_assign_pointer(per_cpu(sd_llc, cpu), sd); per_cpu(sd_llc_size, cpu) = size; per_cpu(sd_llc_id, cpu) = id; sd = lowest_flag_domain(cpu, SD_NUMA); rcu_assign_pointer(per_cpu(sd_numa, cpu), sd); sd = highest_flag_domain(cpu, SD_ASYM_PACKING); rcu_assign_pointer(per_cpu(sd_asym, cpu), sd); } ",0 "static int sctp_copy_laddrs(struct sock *sk, __u16 port, void *to, size_t space_left, int *bytes_copied) { struct sctp_sockaddr_entry *addr; union sctp_addr temp; int cnt = 0; int addrlen; struct net *net = sock_net(sk); rcu_read_lock(); list_for_each_entry_rcu(addr, &net->sctp.local_addr_list, list) { if (!addr->valid) continue; if ((PF_INET == sk->sk_family) && (AF_INET6 == addr->a.sa.sa_family)) continue; if ((PF_INET6 == sk->sk_family) && inet_v6_ipv6only(sk) && (AF_INET == addr->a.sa.sa_family)) continue; memcpy(&temp, &addr->a, sizeof(temp)); if (!temp.v4.sin_port) temp.v4.sin_port = htons(port); addrlen = sctp_get_pf_specific(sk->sk_family) ->addr_to_user(sctp_sk(sk), &temp); if (space_left < addrlen) { cnt = -ENOMEM; break; } memcpy(to, &temp, addrlen); to += addrlen; cnt++; space_left -= addrlen; *bytes_copied += addrlen; } rcu_read_unlock(); return cnt; } ",0 "circle_diameter(PG_FUNCTION_ARGS) { CIRCLE *circle = PG_GETARG_CIRCLE_P(0); PG_RETURN_FLOAT8(2 * circle->radius); } ",0 "status_t Camera3Device::deleteStream(int id) { ATRACE_CALL(); Mutex::Autolock il(mInterfaceLock); Mutex::Autolock l(mLock); status_t res; ALOGV(""%s: Camera %d: Deleting stream %d"", __FUNCTION__, mId, id); if (mStatus == STATUS_ACTIVE) { ALOGV(""%s: Camera %d: Device not idle"", __FUNCTION__, mId); return -EBUSY; } sp deletedStream; ssize_t outputStreamIdx = mOutputStreams.indexOfKey(id); if (mInputStream != NULL && id == mInputStream->getId()) { deletedStream = mInputStream; mInputStream.clear(); } else { if (outputStreamIdx == NAME_NOT_FOUND) { CLOGE(""Stream %d does not exist"", id); return BAD_VALUE; } } if (outputStreamIdx != NAME_NOT_FOUND) { deletedStream = mOutputStreams.editValueAt(outputStreamIdx); mOutputStreams.removeItem(id); } res = deletedStream->disconnect(); if (res != OK) { SET_ERR_L(""Can't disconnect deleted stream %d"", id); } mDeletedStreams.add(deletedStream); mNeedConfig = true; return res; } ",0 "update_info_linux_loop (Device *device) { gboolean ret; gint fd; struct loop_info64 loop_info_buf; gboolean is_loop; gchar *s; gchar *s2; is_loop = FALSE; ret = FALSE; fd = -1; if (!g_str_has_prefix (device->priv->native_path, ""/sys/devices/virtual/block/loop"")) { ret = TRUE; goto out; } fd = open (device->priv->device_file, O_RDONLY); if (fd < 0) goto out; if (ioctl (fd, LOOP_GET_STATUS64, &loop_info_buf) != 0) goto out; /* TODO: is lo_file_name really NUL-terminated? */ device_set_linux_loop_filename (device, (const gchar *) loop_info_buf.lo_file_name); ret = TRUE; is_loop = TRUE; device_set_drive_vendor (device, ""Linux""); s2 = g_path_get_basename ((gchar *) loop_info_buf.lo_file_name); s = g_strdup_printf (""Loop: %s"", s2); g_free (s2); device_set_drive_model (device, s); g_free (s); out: if (fd > 0) close (fd); device_set_device_is_linux_loop (device, is_loop); return ret; } ",0 "int __glXDisp_WaitGL(__GLXclientState *cl, GLbyte *pc) { xGLXWaitGLReq *req = (xGLXWaitGLReq *)pc; GLXContextTag tag = req->contextTag; __GLXcontext *glxc = NULL; int error; if (tag) { glxc = __glXLookupContextByTag(cl, tag); if (!glxc) return __glXError(GLXBadContextTag); if (!__glXForceCurrent(cl, req->contextTag, &error)) return error; CALL_Finish( GET_DISPATCH(), () ); } if (glxc && glxc->drawPriv->waitGL) (*glxc->drawPriv->waitGL)(glxc->drawPriv); return Success; } ",0 "AP_DECLARE(apr_uint32_t) ap_random_pick(apr_uint32_t min, apr_uint32_t max) { apr_uint32_t number; #if (!__GNUC__ || __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) || \ !__sparc__ || APR_SIZEOF_VOIDP != 8) /* This triggers a gcc bug on sparc/64bit with gcc < 4.8, PR 52900 */ if (max < 16384) { apr_uint16_t num16; ap_random_insecure_bytes(&num16, sizeof(num16)); RAND_RANGE(num16, min, max, APR_UINT16_MAX); number = num16; } else #endif { ap_random_insecure_bytes(&number, sizeof(number)); RAND_RANGE(number, min, max, APR_UINT32_MAX); } return number; } ",0 "void Browser::BookmarkCurrentPage() { UserMetrics::RecordAction(UserMetricsAction(""Star""), profile_); BookmarkModel* model = profile()->GetBookmarkModel(); if (!model || !model->IsLoaded()) return; // Ignore requests until bookmarks are loaded. GURL url; string16 title; TabContents* tab = GetSelectedTabContents(); bookmark_utils::GetURLAndTitleToBookmark(tab, &url, &title); bool was_bookmarked = model->IsBookmarked(url); if (!was_bookmarked && profile_->IsOffTheRecord()) { tab->SaveFavicon(); } model->SetURLStarred(url, title, true); if (window_->IsActive() && model->IsBookmarked(url)) { window_->ShowBookmarkBubble(url, was_bookmarked); } } ",0 "int set_cpus_allowed_ptr(struct task_struct *p, const struct cpumask *new_mask) { unsigned long flags; struct rq *rq; unsigned int dest_cpu; int ret = 0; /* * Serialize against TASK_WAKING so that ttwu() and wunt() can * drop the rq->lock and still rely on ->cpus_allowed. */ again: while (task_is_waking(p)) cpu_relax(); rq = task_rq_lock(p, &flags); if (task_is_waking(p)) { task_rq_unlock(rq, &flags); goto again; } if (!cpumask_intersects(new_mask, cpu_active_mask)) { ret = -EINVAL; goto out; } if (unlikely((p->flags & PF_THREAD_BOUND) && p != current && !cpumask_equal(&p->cpus_allowed, new_mask))) { ret = -EINVAL; goto out; } if (p->sched_class->set_cpus_allowed) p->sched_class->set_cpus_allowed(p, new_mask); else { cpumask_copy(&p->cpus_allowed, new_mask); p->rt.nr_cpus_allowed = cpumask_weight(new_mask); } /* Can the task run on the task's current CPU? If so, we're done */ if (cpumask_test_cpu(task_cpu(p), new_mask)) goto out; dest_cpu = cpumask_any_and(cpu_active_mask, new_mask); if (migrate_task(p, dest_cpu)) { struct migration_arg arg = { p, dest_cpu }; /* Need help from migration thread: drop lock and wait. */ task_rq_unlock(rq, &flags); stop_one_cpu(cpu_of(rq), migration_cpu_stop, &arg); tlb_migrate_finish(p->mm); return 0; } out: task_rq_unlock(rq, &flags); return ret; } ",0 "void efx_fini_tx_queue(struct efx_tx_queue *tx_queue) { if (!tx_queue->initialised) return; netif_dbg(tx_queue->efx, drv, tx_queue->efx->net_dev, ""shutting down TX queue %d\n"", tx_queue->queue); tx_queue->initialised = false; /* Flush TX queue, remove descriptor ring */ efx_nic_fini_tx(tx_queue); efx_release_tx_buffers(tx_queue); /* Free up TSO header cache */ efx_fini_tso(tx_queue); } ",0 "static void voidMethodOptionalStringArgMethodCallback(const v8::FunctionCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMMethod""); TestObjectPythonV8Internal::voidMethodOptionalStringArgMethod(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "WebPreferences::~WebPreferences() { } ",0 "hook_focus_hashtable_map_cb (void *data, struct t_hashtable *hashtable, const void *key, const void *value) { struct t_hashtable *hashtable1; /* make C compiler happy */ (void) hashtable; hashtable1 = (struct t_hashtable *)data; if (hashtable1 && key && value) hashtable_set (hashtable1, (const char *)key, (const char *)value); } ",0 "error::Error GLES2DecoderImpl::HandleDrawElements( uint32 immediate_data_size, const gles2::DrawElements& c) { if (!bound_element_array_buffer_ || bound_element_array_buffer_->IsDeleted()) { SetGLError(GL_INVALID_OPERATION, ""glDrawElements: No element array buffer bound""); return error::kNoError; } GLenum mode = c.mode; GLsizei count = c.count; GLenum type = c.type; int32 offset = c.index_offset; if (count < 0) { SetGLError(GL_INVALID_VALUE, ""glDrawElements: count < 0""); return error::kNoError; } if (offset < 0) { SetGLError(GL_INVALID_VALUE, ""glDrawElements: offset < 0""); return error::kNoError; } if (!validators_->draw_mode.IsValid(mode)) { SetGLError(GL_INVALID_ENUM, ""glDrawElements: mode GL_INVALID_ENUM""); return error::kNoError; } if (!validators_->index_type.IsValid(type)) { SetGLError(GL_INVALID_ENUM, ""glDrawElements: type GL_INVALID_ENUM""); return error::kNoError; } GLuint max_vertex_accessed; if (!bound_element_array_buffer_->GetMaxValueForRange( offset, count, type, &max_vertex_accessed)) { SetGLError(GL_INVALID_OPERATION, ""glDrawElements: range out of bounds for buffer""); return error::kNoError; } if (IsDrawValid(max_vertex_accessed)) { bool simulated_attrib_0 = SimulateAttrib0(max_vertex_accessed); bool textures_set = SetBlackTextureForNonRenderableTextures(); const GLvoid* indices = reinterpret_cast(offset); glDrawElements(mode, count, type, indices); if (textures_set) { RestoreStateForNonRenderableTextures(); } if (simulated_attrib_0) { RestoreStateForSimulatedAttrib0(); } } return error::kNoError; } ",0 "struct file *sock_alloc_file(struct socket *sock, int flags, const char *dname) { struct qstr name = { .name = """" }; struct path path; struct file *file; if (dname) { name.name = dname; name.len = strlen(name.name); } else if (sock->sk) { name.name = sock->sk->sk_prot_creator->name; name.len = strlen(name.name); } path.dentry = d_alloc_pseudo(sock_mnt->mnt_sb, &name); if (unlikely(!path.dentry)) return ERR_PTR(-ENOMEM); path.mnt = mntget(sock_mnt); d_instantiate(path.dentry, SOCK_INODE(sock)); file = alloc_file(&path, FMODE_READ | FMODE_WRITE, &socket_file_ops); if (IS_ERR(file)) { /* drop dentry, keep inode */ ihold(d_inode(path.dentry)); path_put(&path); return file; } sock->file = file; file->f_flags = O_RDWR | (flags & O_NONBLOCK); file->private_data = sock; return file; } ",0 " void WaitForPageScaleUpdate() { if (!got_page_scale_update_) { base::RunLoop run_loop; on_page_scale_update_ = run_loop.QuitClosure(); run_loop.Run(); } got_page_scale_update_ = false; } ",0 "const char* GLES2DecoderImpl::GetCommandName(unsigned int command_id) const { if (command_id >= kFirstGLES2Command && command_id < kNumCommands) { return gles2::GetCommandName(static_cast(command_id)); } return GetCommonCommandName(static_cast(command_id)); } ",0 "static void Free_PairPos1( HB_PairPosFormat1* ppf1, HB_UShort format1, HB_UShort format2 ) { HB_UShort n, count; HB_PairSet* ps; if ( ppf1->PairSet ) { count = ppf1->PairSetCount; ps = ppf1->PairSet; for ( n = 0; n < count; n++ ) Free_PairSet( &ps[n], format1, format2 ); FREE( ps ); } } ",0 "void StatusBubbleGtk::MouseMoved( const gfx::Point& location, bool left_content) { if (left_content && ignore_next_left_content_) { ignore_next_left_content_ = false; return; } last_mouse_location_ = location; last_mouse_left_content_ = left_content; if (!GTK_WIDGET_REALIZED(container_.get())) return; GtkWidget* parent = gtk_widget_get_parent(container_.get()); if (!parent || !GTK_WIDGET_REALIZED(parent)) return; int old_y_offset = y_offset_; bool old_flip_horizontally = flip_horizontally_; if (left_content) { SetFlipHorizontally(false); y_offset_ = 0; } else { GtkWidget* toplevel = gtk_widget_get_toplevel(container_.get()); if (!toplevel || !GTK_WIDGET_REALIZED(toplevel)) return; bool ltr = !base::i18n::IsRTL(); GtkRequisition requisition; gtk_widget_size_request(container_.get(), &requisition); gint toplevel_x = 0, toplevel_y = 0; gdk_window_get_position(toplevel->window, &toplevel_x, &toplevel_y); gfx::Rect parent_rect = gtk_util::GetWidgetRectRelativeToToplevel(parent); gfx::Rect bubble_rect( toplevel_x + parent_rect.x() + (ltr ? 0 : parent->allocation.width - requisition.width), toplevel_y + parent_rect.y() + parent->allocation.height - requisition.height, requisition.width, requisition.height); int left_threshold = bubble_rect.x() - bubble_rect.height() - kMousePadding; int right_threshold = bubble_rect.right() + bubble_rect.height() + kMousePadding; int top_threshold = bubble_rect.y() - kMousePadding; if (((ltr && location.x() < right_threshold) || (!ltr && location.x() > left_threshold)) && location.y() > top_threshold) { if (download_shelf_is_visible_) { SetFlipHorizontally(true); y_offset_ = 0; } else { SetFlipHorizontally(false); int distance = std::max(ltr ? location.x() - right_threshold : left_threshold - location.x(), top_threshold - location.y()); y_offset_ = std::min(-1 * distance, requisition.height); } } else { SetFlipHorizontally(false); y_offset_ = 0; } } if (y_offset_ != old_y_offset || flip_horizontally_ != old_flip_horizontally) gtk_widget_queue_resize_no_redraw(parent); } ",0 "void V8TestObject::LimitedToOnlyAttributeAttributeSetterCallback( const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_limitedToOnlyAttribute_Setter""); v8::Local v8_value = info[0]; test_object_v8_internal::LimitedToOnlyAttributeAttributeSetter(v8_value, info); } ",0 "rdpLicense* license_new(rdpRdp* rdp) { rdpLicense* license; license = (rdpLicense*) malloc(sizeof(rdpLicense)); if (license != NULL) { ZeroMemory(license, sizeof(rdpLicense)); license->rdp = rdp; license->state = LICENSE_STATE_AWAIT; license->certificate = certificate_new(); license->ProductInfo = license_new_product_info(); license->ErrorInfo = license_new_binary_blob(BB_ERROR_BLOB); license->KeyExchangeList = license_new_binary_blob(BB_KEY_EXCHG_ALG_BLOB); license->ServerCertificate = license_new_binary_blob(BB_CERTIFICATE_BLOB); license->ClientUserName = license_new_binary_blob(BB_CLIENT_USER_NAME_BLOB); license->ClientMachineName = license_new_binary_blob(BB_CLIENT_MACHINE_NAME_BLOB); license->PlatformChallenge = license_new_binary_blob(BB_ANY_BLOB); license->EncryptedPlatformChallenge = license_new_binary_blob(BB_ANY_BLOB); license->EncryptedPremasterSecret = license_new_binary_blob(BB_ANY_BLOB); license->EncryptedHardwareId = license_new_binary_blob(BB_ENCRYPTED_DATA_BLOB); license->ScopeList = license_new_scope_list(); license_generate_randoms(license); } return license; } ",0 "MockPlatformSensorClient::MockPlatformSensorClient( scoped_refptr sensor) : MockPlatformSensorClient() { DCHECK(sensor); sensor_ = std::move(sensor); sensor_->AddClient(this); } ",0 "static void validate_coredump_safety(void) { #ifdef CONFIG_COREDUMP if (suid_dumpable == SUID_DUMP_ROOT && core_pattern[0] != '/' && core_pattern[0] != '|') { printk(KERN_WARNING ""Unsafe core_pattern used with ""\ ""suid_dumpable=2. Pipe handler or fully qualified ""\ ""core dump path required.\n""); } #endif } ",0 "static int build_ino_list(u64 inum, u64 offset, u64 root, void *ctx) { struct btrfs_data_container *inodes = ctx; const size_t c = 3 * sizeof(u64); if (inodes->bytes_left >= c) { inodes->bytes_left -= c; inodes->val[inodes->elem_cnt] = inum; inodes->val[inodes->elem_cnt + 1] = offset; inodes->val[inodes->elem_cnt + 2] = root; inodes->elem_cnt += 3; } else { inodes->bytes_missing += c - inodes->bytes_left; inodes->bytes_left = 0; inodes->elem_missed += 3; } return 0; } ",0 " socket_t *socket_accept(const socket_t *socket) { assert(socket != NULL); int fd = accept(socket->fd, NULL, NULL); if (fd == INVALID_FD) { LOG_ERROR(""%s unable to accept socket: %s"", __func__, strerror(errno)); return NULL; } socket_t *ret = (socket_t *)osi_calloc(sizeof(socket_t)); if (!ret) { close(fd); LOG_ERROR(""%s unable to allocate memory for socket."", __func__); return NULL; } ret->fd = fd; return ret; } ",1 "void MockCoordinator::RequestGlobalMemoryDump( MemoryDumpType dump_type, MemoryDumpLevelOfDetail level_of_detail, const std::vector& allocator_dump_names, const RequestGlobalMemoryDumpCallback& callback) { client_->RequestChromeDump(dump_type, level_of_detail); callback.Run(true, mojom::GlobalMemoryDumpPtr()); } ",0 "void PassthroughResources::Destroy(gl::GLApi* api) { bool have_context = !!api; DeleteServiceObjects(&texture_id_map, have_context, [this, api](GLuint client_id, GLuint texture) { if (!texture_object_map.HasClientID(client_id)) { api->glDeleteTexturesFn(1, &texture); } }); DeleteServiceObjects(&buffer_id_map, have_context, [api](GLuint client_id, GLuint buffer) { api->glDeleteBuffersARBFn(1, &buffer); }); DeleteServiceObjects(&renderbuffer_id_map, have_context, [api](GLuint client_id, GLuint renderbuffer) { api->glDeleteRenderbuffersEXTFn(1, &renderbuffer); }); DeleteServiceObjects(&sampler_id_map, have_context, [api](GLuint client_id, GLuint sampler) { api->glDeleteSamplersFn(1, &sampler); }); DeleteServiceObjects(&program_id_map, have_context, [api](GLuint client_id, GLuint program) { api->glDeleteProgramFn(program); }); DeleteServiceObjects(&shader_id_map, have_context, [api](GLuint client_id, GLuint shader) { api->glDeleteShaderFn(shader); }); DeleteServiceObjects(&sync_id_map, have_context, [api](GLuint client_id, uintptr_t sync) { api->glDeleteSyncFn(reinterpret_cast(sync)); }); if (!have_context) { texture_object_map.ForEach( [](GLuint client_id, scoped_refptr texture) { texture->MarkContextLost(); }); for (const auto& pair : texture_shared_image_map) { pair.second->OnContextLost(); } } texture_object_map.Clear(); texture_shared_image_map.clear(); DestroyPendingTextures(have_context); } ",0 "PHP_FUNCTION(imageconvolution) { zval *SIM, *hash_matrix; zval **var = NULL, **var2 = NULL; gdImagePtr im_src = NULL; double div, offset; int nelem, i, j, res; float matrix[3][3] = {{0,0,0}, {0,0,0}, {0,0,0}}; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""radd"", &SIM, &hash_matrix, &div, &offset) == FAILURE) { RETURN_FALSE; } ZEND_FETCH_RESOURCE(im_src, gdImagePtr, &SIM, -1, ""Image"", le_gd); nelem = zend_hash_num_elements(Z_ARRVAL_P(hash_matrix)); if (nelem != 3) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""You must have 3x3 array""); RETURN_FALSE; } for (i=0; i<3; i++) { if (zend_hash_index_find(Z_ARRVAL_P(hash_matrix), (i), (void **) &var) == SUCCESS && Z_TYPE_PP(var) == IS_ARRAY) { if (Z_TYPE_PP(var) != IS_ARRAY || zend_hash_num_elements(Z_ARRVAL_PP(var)) != 3 ) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""You must have 3x3 array""); RETURN_FALSE; } for (j=0; j<3; j++) { if (zend_hash_index_find(Z_ARRVAL_PP(var), (j), (void **) &var2) == SUCCESS) { SEPARATE_ZVAL(var2); convert_to_double(*var2); matrix[i][j] = Z_DVAL_PP(var2); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""You must have a 3x3 matrix""); RETURN_FALSE; } } } } res = gdImageConvolution(im_src, matrix, div, offset); if (res) { RETURN_TRUE; } else { RETURN_FALSE; } } ",0 "CameraService::Client::~Client() { ALOGV(""~Client""); mDestructionStarted = true; mCameraService->releaseSound(); Client::disconnect(); } ",0 " scoped_refptr GetNoTunnelParams() { return GetParams(false); } ",0 "decode_encoded_header_info(struct archive_read *a, struct _7z_stream_info *si) { struct _7zip *zip = (struct _7zip *)a->format->data; errno = 0; if (read_StreamsInfo(a, si) < 0) { if (errno == ENOMEM) archive_set_error(&a->archive, -1, ""Couldn't allocate memory""); else archive_set_error(&a->archive, -1, ""Malformed 7-Zip archive""); return (ARCHIVE_FATAL); } if (si->pi.numPackStreams == 0 || si->ci.numFolders == 0) { archive_set_error(&a->archive, -1, ""Malformed 7-Zip archive""); return (ARCHIVE_FATAL); } if (zip->header_offset < si->pi.pos + si->pi.sizes[0] || (int64_t)(si->pi.pos + si->pi.sizes[0]) < 0 || si->pi.sizes[0] == 0 || (int64_t)si->pi.pos < 0) { archive_set_error(&a->archive, -1, ""Malformed Header offset""); return (ARCHIVE_FATAL); } return (ARCHIVE_OK); } ",0 "static int exif_file_sections_add(image_info_type *ImageInfo, int type, size_t size, uchar *data) { file_section *tmp; int count = ImageInfo->file.count; tmp = safe_erealloc(ImageInfo->file.list, (count+1), sizeof(file_section), 0); ImageInfo->file.list = tmp; ImageInfo->file.list[count].type = 0xFFFF; ImageInfo->file.list[count].data = NULL; ImageInfo->file.list[count].size = 0; ImageInfo->file.count = count+1; if (!size) { data = NULL; } else if (data == NULL) { data = safe_emalloc(size, 1, 0); } ImageInfo->file.list[count].type = type; ImageInfo->file.list[count].data = data; ImageInfo->file.list[count].size = size; return count; } ",0 "PHP_FUNCTION(imagesy) { zval *IM; gdImagePtr im; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""r"", &IM) == FAILURE) { return; } ZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, ""Image"", le_gd); RETURN_LONG(gdImageSY(im)); } ",0 "PrintingContext::Result PrintingContext::PageDone() { if (abort_printing_) return CANCEL; DCHECK(in_print_job_); if (EndPage(context_) <= 0) return OnError(); return OK; } ",0 "void PlatformSensor::UpdateSharedBufferAndNotifyClients( const SensorReading& reading) { UpdateSharedBuffer(reading); task_runner_->PostTask(FROM_HERE, base::Bind(&PlatformSensor::NotifySensorReadingChanged, weak_factory_.GetWeakPtr())); } ",0 "void MojoAudioOutputStream::OnError() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(deleter_callback_); std::move(deleter_callback_).Run(); // Deletes |this|. } ",0 "SPR_WhereIsIt(struct rx_call *call, afs_int32 aid, afs_int32 *apos) { afs_int32 code; afs_int32 cid = ANONYMOUSID; code = whereIsIt(call, aid, apos, &cid); osi_auditU(call, PTS_WheIsItEvent, code, AUD_ID, aid, AUD_LONG, *apos, AUD_END); ViceLog(125, (""PTS_WhereIsIt: code %d cid %d aid %d apos %d\n"", code, cid, aid, *apos)); return code; } ",0 "std::string ConnectionErrorToString(protocol::ErrorCode error) { switch (error) { case protocol::OK: return ""NONE""; case protocol::PEER_IS_OFFLINE: return ""HOST_IS_OFFLINE""; case protocol::SESSION_REJECTED: case protocol::AUTHENTICATION_FAILED: return ""SESSION_REJECTED""; case protocol::INCOMPATIBLE_PROTOCOL: return ""INCOMPATIBLE_PROTOCOL""; case protocol::HOST_OVERLOAD: return ""HOST_OVERLOAD""; case protocol::CHANNEL_CONNECTION_ERROR: case protocol::SIGNALING_ERROR: case protocol::SIGNALING_TIMEOUT: case protocol::UNKNOWN_ERROR: return ""NETWORK_FAILURE""; } DLOG(FATAL) << ""Unknown error code"" << error; return std::string(); } ",0 "SPL_METHOD(SplObjectStorage, setInfo) { spl_SplObjectStorageElement *element; spl_SplObjectStorage *intern = Z_SPLOBJSTORAGE_P(getThis()); zval *inf; if (zend_parse_parameters(ZEND_NUM_ARGS(), ""z"", &inf) == FAILURE) { return; } if ((element = zend_hash_get_current_data_ptr_ex(&intern->storage, &intern->pos)) == NULL) { return; } zval_ptr_dtor(&element->inf); ZVAL_COPY(&element->inf, inf); } /* }}} */ /* {{{ proto void SplObjectStorage::next() ",0 "RenderProcessHost* RenderProcessHostImpl::GetProcessHostForSite( BrowserContext* browser_context, const GURL& url) { SiteProcessMap* map = GetSiteProcessMapForBrowserContext(browser_context); GURL site_url = SiteInstance::GetSiteForURL(browser_context, url); RenderProcessHost* host = map->FindProcess(site_url.possibly_invalid_spec()); if (host && (!host->MayReuseHost() || !IsSuitableHost(host, browser_context, site_url))) { RecordAction( base::UserMetricsAction(""BindingsMismatch_GetProcessHostPerSite"")); map->RemoveProcess(host); host = nullptr; } return host; } ",0 "void SerializedScriptValue::transferImageBitmaps(v8::Isolate* isolate, const ImageBitmapArray& imageBitmaps, ExceptionState& exceptionState) { if (!imageBitmaps.size()) return; for (size_t i = 0; i < imageBitmaps.size(); ++i) { if (imageBitmaps[i]->isNeutered()) { exceptionState.throwDOMException(DataCloneError, ""ImageBitmap at index "" + String::number(i) + "" is already neutered.""); return; } } OwnPtr contents = adoptPtr(new ImageBitmapContentsArray); HeapHashSet> visited; for (size_t i = 0; i < imageBitmaps.size(); ++i) { if (visited.contains(imageBitmaps[i])) continue; visited.add(imageBitmaps[i]); contents->append(imageBitmaps[i]->transfer()); } m_imageBitmapContentsArray = contents.release(); } ",0 "xmlDetectSAX2(xmlParserCtxtPtr ctxt) { if (ctxt == NULL) return; #ifdef LIBXML_SAX1_ENABLED if ((ctxt->sax) && (ctxt->sax->initialized == XML_SAX2_MAGIC) && ((ctxt->sax->startElementNs != NULL) || (ctxt->sax->endElementNs != NULL))) ctxt->sax2 = 1; #else ctxt->sax2 = 1; #endif /* LIBXML_SAX1_ENABLED */ ctxt->str_xml = xmlDictLookup(ctxt->dict, BAD_CAST ""xml"", 3); ctxt->str_xmlns = xmlDictLookup(ctxt->dict, BAD_CAST ""xmlns"", 5); ctxt->str_xml_ns = xmlDictLookup(ctxt->dict, XML_XML_NAMESPACE, 36); if ((ctxt->str_xml==NULL) || (ctxt->str_xmlns==NULL) || (ctxt->str_xml_ns == NULL)) { xmlErrMemory(ctxt, NULL); } } ",0 "uint32_t VirtualizerGetStrength(EffectContext *pContext){ LVM_ControlParams_t ActiveParams; /* Current control Parameters */ LVM_ReturnStatus_en LvmStatus = LVM_SUCCESS; /* Function call status */ LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams); LVM_ERROR_CHECK(LvmStatus, ""LVM_GetControlParameters"", ""VirtualizerGetStrength"") if(LvmStatus != LVM_SUCCESS) return -EINVAL; return pContext->pBundledContext->VirtStrengthSaved; } /* end getStrength */ ",0 "struct ctl_table_header *__register_sysctl_table( struct ctl_table_set *set, const char *path, struct ctl_table *table) { struct ctl_table_root *root = set->dir.header.root; struct ctl_table_header *header; const char *name, *nextname; struct ctl_dir *dir; struct ctl_table *entry; struct ctl_node *node; int nr_entries = 0; for (entry = table; entry->procname; entry++) nr_entries++; header = kzalloc(sizeof(struct ctl_table_header) + sizeof(struct ctl_node)*nr_entries, GFP_KERNEL); if (!header) return NULL; node = (struct ctl_node *)(header + 1); init_header(header, root, set, node, table); if (sysctl_check_table(path, table)) goto fail; spin_lock(&sysctl_lock); dir = &set->dir; /* Reference moved down the diretory tree get_subdir */ dir->header.nreg++; spin_unlock(&sysctl_lock); /* Find the directory for the ctl_table */ for (name = path; name; name = nextname) { int namelen; nextname = strchr(name, '/'); if (nextname) { namelen = nextname - name; nextname++; } else { namelen = strlen(name); } if (namelen == 0) continue; dir = get_subdir(dir, name, namelen); if (IS_ERR(dir)) goto fail; } spin_lock(&sysctl_lock); if (insert_header(dir, header)) goto fail_put_dir_locked; drop_sysctl_table(&dir->header); spin_unlock(&sysctl_lock); return header; fail_put_dir_locked: drop_sysctl_table(&dir->header); spin_unlock(&sysctl_lock); fail: kfree(header); dump_stack(); return NULL; } ",0 " explicit RegisteringMixin(ObjectRegistry* registry) { HeapObjectHeader* header = GetHeapObjectHeader(); const void* uninitialized_value = BlinkGC::kNotFullyConstructedObject; EXPECT_EQ(uninitialized_value, header); registry->insert(reinterpret_cast(this), this); } ",0 "ZSTD_compressSequences(seqStore_t* seqStorePtr, const ZSTD_entropyCTables_t* prevEntropy, ZSTD_entropyCTables_t* nextEntropy, const ZSTD_CCtx_params* cctxParams, void* dst, size_t dstCapacity, size_t srcSize, void* workspace, size_t wkspSize, int bmi2) { size_t const cSize = ZSTD_compressSequences_internal( seqStorePtr, prevEntropy, nextEntropy, cctxParams, dst, dstCapacity, workspace, wkspSize, bmi2); if (cSize == 0) return 0; /* When srcSize <= dstCapacity, there is enough space to write a raw uncompressed block. * Since we ran out of space, block must be not compressible, so fall back to raw uncompressed block. */ if ((cSize == ERROR(dstSize_tooSmall)) & (srcSize <= dstCapacity)) return 0; /* block not compressed */ if (ZSTD_isError(cSize)) return cSize; /* Check compressibility */ { size_t const maxCSize = srcSize - ZSTD_minGain(srcSize, cctxParams->cParams.strategy); if (cSize >= maxCSize) return 0; /* block not compressed */ } return cSize; } ",0 "static void access_flags_to_mode(__le32 ace_flags, int type, umode_t *pmode, umode_t *pbits_to_set) { __u32 flags = le32_to_cpu(ace_flags); /* the order of ACEs is important. The canonical order is to begin with DENY entries followed by ALLOW, otherwise an allow entry could be encountered first, making the subsequent deny entry like ""dead code"" which would be superflous since Windows stops when a match is made for the operation you are trying to perform for your user */ /* For deny ACEs we change the mask so that subsequent allow access control entries do not turn on the bits we are denying */ if (type == ACCESS_DENIED) { if (flags & GENERIC_ALL) *pbits_to_set &= ~S_IRWXUGO; if ((flags & GENERIC_WRITE) || ((flags & FILE_WRITE_RIGHTS) == FILE_WRITE_RIGHTS)) *pbits_to_set &= ~S_IWUGO; if ((flags & GENERIC_READ) || ((flags & FILE_READ_RIGHTS) == FILE_READ_RIGHTS)) *pbits_to_set &= ~S_IRUGO; if ((flags & GENERIC_EXECUTE) || ((flags & FILE_EXEC_RIGHTS) == FILE_EXEC_RIGHTS)) *pbits_to_set &= ~S_IXUGO; return; } else if (type != ACCESS_ALLOWED) { cifs_dbg(VFS, ""unknown access control type %d\n"", type); return; } /* else ACCESS_ALLOWED type */ if (flags & GENERIC_ALL) { *pmode |= (S_IRWXUGO & (*pbits_to_set)); cifs_dbg(NOISY, ""all perms\n""); return; } if ((flags & GENERIC_WRITE) || ((flags & FILE_WRITE_RIGHTS) == FILE_WRITE_RIGHTS)) *pmode |= (S_IWUGO & (*pbits_to_set)); if ((flags & GENERIC_READ) || ((flags & FILE_READ_RIGHTS) == FILE_READ_RIGHTS)) *pmode |= (S_IRUGO & (*pbits_to_set)); if ((flags & GENERIC_EXECUTE) || ((flags & FILE_EXEC_RIGHTS) == FILE_EXEC_RIGHTS)) *pmode |= (S_IXUGO & (*pbits_to_set)); cifs_dbg(NOISY, ""access flags 0x%x mode now 0x%x\n"", flags, *pmode); return; } ",0 "static int sctp_inet6addr_event(struct notifier_block *this, unsigned long ev, void *ptr) { struct inet6_ifaddr *ifa = (struct inet6_ifaddr *)ptr; struct sctp_sockaddr_entry *addr = NULL; struct sctp_sockaddr_entry *temp; struct net *net = dev_net(ifa->idev->dev); int found = 0; switch (ev) { case NETDEV_UP: addr = kmalloc(sizeof(struct sctp_sockaddr_entry), GFP_ATOMIC); if (addr) { addr->a.v6.sin6_family = AF_INET6; addr->a.v6.sin6_port = 0; addr->a.v6.sin6_addr = ifa->addr; addr->a.v6.sin6_scope_id = ifa->idev->dev->ifindex; addr->valid = 1; spin_lock_bh(&net->sctp.local_addr_lock); list_add_tail_rcu(&addr->list, &net->sctp.local_addr_list); sctp_addr_wq_mgmt(net, addr, SCTP_ADDR_NEW); spin_unlock_bh(&net->sctp.local_addr_lock); } break; case NETDEV_DOWN: spin_lock_bh(&net->sctp.local_addr_lock); list_for_each_entry_safe(addr, temp, &net->sctp.local_addr_list, list) { if (addr->a.sa.sa_family == AF_INET6 && ipv6_addr_equal(&addr->a.v6.sin6_addr, &ifa->addr)) { sctp_addr_wq_mgmt(net, addr, SCTP_ADDR_DEL); found = 1; addr->valid = 0; list_del_rcu(&addr->list); break; } } spin_unlock_bh(&net->sctp.local_addr_lock); if (found) kfree_rcu(addr, rcu); break; } return NOTIFY_DONE; } ",0 "projid_t from_kprojid(struct user_namespace *targ, kprojid_t kprojid) { /* Map the uid from a global kernel uid */ return map_id_up(&targ->projid_map, __kprojid_val(kprojid)); } ",0 "RenderWidgetFullscreenPepper* RenderView::CreatePepperFullscreenContainer( webkit::ppapi::PluginInstance* plugin) { GURL active_url; if (webview() && webview()->mainFrame()) active_url = GURL(webview()->mainFrame()->document().url()); RenderWidgetFullscreenPepper* widget = RenderWidgetFullscreenPepper::Create( routing_id_, render_thread_, plugin, active_url); widget->show(WebKit::WebNavigationPolicyIgnore); return widget; } ",0 "gsf_infile_tar_set_source (GsfInfileTar *tar, GsfInput *src) { if (src) src = gsf_input_proxy_new (src); if (tar->source) g_object_unref (tar->source); tar->source = src; } ",0 "static inline void blk_free_request(struct request_list *rl, struct request *rq) { if (rq->rq_flags & RQF_ELVPRIV) { elv_put_request(rl->q, rq); if (rq->elv.icq) put_io_context(rq->elv.icq->ioc); } mempool_free(rq, rl->rq_pool); } ",0 "R_API ut64 r_bin_java_calc_class_size(ut8 *bytes, ut64 size) { RBinJavaObj *bin = R_NEW0 (RBinJavaObj); if (!bin) { return false; } RBinJavaObj *cur_bin = R_BIN_JAVA_GLOBAL_BIN; ut64 bin_size = UT64_MAX; if (bin) { if (r_bin_java_load_bin (bin, bytes, size)) { bin_size = bin->calc_size; } r_bin_java_free (bin); R_BIN_JAVA_GLOBAL_BIN = cur_bin; } return bin_size; } ",0 "WebContentsImpl::WebContentsImpl( BrowserContext* browser_context, WebContentsImpl* opener) : delegate_(NULL), controller_(this, browser_context), render_view_host_delegate_view_(NULL), opener_(opener), #if defined(OS_WIN) && defined(USE_AURA) accessible_parent_(NULL), #endif frame_tree_(new NavigatorImpl(&controller_, this), this, this, this, this), is_loading_(false), crashed_status_(base::TERMINATION_STATUS_STILL_RUNNING), crashed_error_code_(0), waiting_for_response_(false), load_state_(net::LOAD_STATE_IDLE, base::string16()), upload_size_(0), upload_position_(0), displayed_insecure_content_(false), capturer_count_(0), should_normally_be_visible_(true), is_being_destroyed_(false), notify_disconnection_(false), dialog_manager_(NULL), is_showing_before_unload_dialog_(false), closed_by_user_gesture_(false), minimum_zoom_percent_(static_cast(kMinimumZoomFactor * 100)), maximum_zoom_percent_(static_cast(kMaximumZoomFactor * 100)), temporary_zoom_settings_(false), color_chooser_identifier_(0), render_view_message_source_(NULL), fullscreen_widget_routing_id_(MSG_ROUTING_NONE), is_subframe_(false) { for (size_t i = 0; i < g_created_callbacks.Get().size(); i++) g_created_callbacks.Get().at(i).Run(this); frame_tree_.SetFrameRemoveListener( base::Bind(&WebContentsImpl::OnFrameRemoved, base::Unretained(this))); } ",0 "loff_t tracing_lseek(struct file *file, loff_t offset, int whence) { int ret; if (file->f_mode & FMODE_READ) ret = seq_lseek(file, offset, whence); else file->f_pos = ret = 0; return ret; } ",0 "format_CLONE(const struct ofpact_nest *a, struct ds *s) { ds_put_format(s, ""%sclone(%s"", colors.paren, colors.end); ofpacts_format(a->actions, ofpact_nest_get_action_len(a), s); ds_put_format(s, ""%s)%s"", colors.paren, colors.end); } ",0 "static void compileoptiongetFunc( sqlite3_context *context, int argc, sqlite3_value **argv ){ int n; assert( argc==1 ); UNUSED_PARAMETER(argc); /* IMP: R-04922-24076 The sqlite_compileoption_get() SQL function ** is a wrapper around the sqlite3_compileoption_get() C/C++ function. */ n = sqlite3_value_int(argv[0]); sqlite3_result_text(context, sqlite3_compileoption_get(n), -1, SQLITE_STATIC); } ",0 "LRESULT WebView::onShowWindowEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, bool& handled) { if (!lParam) { m_isVisible = wParam; if (m_page) m_page->viewStateDidChange(WebPageProxy::ViewIsVisible); } handled = false; return 0; } ",0 " void RemoveFramebuffer(GLuint client_id) { framebuffer_manager()->RemoveFramebuffer(client_id); } ",0 "static int __init keep_bootcon_setup(char *str) { keep_bootcon = 1; printk(KERN_INFO ""debug: skip boot console de-registration.\n""); return 0; } ",0 "static void add_8x8basis_c(int16_t rem[64], int16_t basis[64], int scale){ int i; for(i=0; i<8*8; i++){ rem[i] += (basis[i]*scale + (1<<(BASIS_SHIFT - RECON_SHIFT-1)))>>(BASIS_SHIFT - RECON_SHIFT); } } ",0 "PHP_METHOD(Phar, addEmptyDir) { char *dirname; size_t dirname_len; PHAR_ARCHIVE_OBJECT(); if (zend_parse_parameters(ZEND_NUM_ARGS(), ""s"", &dirname, &dirname_len) == FAILURE) { return; } if (dirname_len >= sizeof("".phar"")-1 && !memcmp(dirname, "".phar"", sizeof("".phar"")-1)) { zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, ""Cannot create a directory in magic \"".phar\"" directory""); return; } phar_mkdir(&phar_obj->archive, dirname, dirname_len); } ",1 "static int sha384_neon_final(struct shash_desc *desc, u8 *hash) { u8 D[SHA512_DIGEST_SIZE]; sha512_neon_final(desc, D); memcpy(hash, D, SHA384_DIGEST_SIZE); memset(D, 0, SHA512_DIGEST_SIZE); return 0; } ",0 "xmlXPathDebugObjUsageRequested(xmlXPathContextPtr ctxt, xmlXPathObjectType objType) { int isCached = 0; if (ctxt != NULL) { if (ctxt->cache != NULL) { xmlXPathContextCachePtr cache = (xmlXPathContextCachePtr) ctxt->cache; isCached = 1; cache->dbgReusedAll++; switch (objType) { case XPATH_UNDEFINED: cache->dbgReusedUndefined++; break; case XPATH_NODESET: cache->dbgReusedNodeset++; break; case XPATH_BOOLEAN: cache->dbgReusedBool++; break; case XPATH_NUMBER: cache->dbgReusedNumber++; break; case XPATH_STRING: cache->dbgReusedString++; break; case XPATH_POINT: cache->dbgReusedPoint++; break; case XPATH_RANGE: cache->dbgReusedRange++; break; case XPATH_LOCATIONSET: cache->dbgReusedLocset++; break; case XPATH_USERS: cache->dbgReusedUsers++; break; case XPATH_XSLT_TREE: cache->dbgReusedXSLTTree++; break; default: break; } } } switch (objType) { case XPATH_UNDEFINED: if (! isCached) xmlXPathDebugObjTotalUndefined++; xmlXPathDebugObjCounterUndefined++; if (xmlXPathDebugObjCounterUndefined > xmlXPathDebugObjMaxUndefined) xmlXPathDebugObjMaxUndefined = xmlXPathDebugObjCounterUndefined; break; case XPATH_NODESET: if (! isCached) xmlXPathDebugObjTotalNodeset++; xmlXPathDebugObjCounterNodeset++; if (xmlXPathDebugObjCounterNodeset > xmlXPathDebugObjMaxNodeset) xmlXPathDebugObjMaxNodeset = xmlXPathDebugObjCounterNodeset; break; case XPATH_BOOLEAN: if (! isCached) xmlXPathDebugObjTotalBool++; xmlXPathDebugObjCounterBool++; if (xmlXPathDebugObjCounterBool > xmlXPathDebugObjMaxBool) xmlXPathDebugObjMaxBool = xmlXPathDebugObjCounterBool; break; case XPATH_NUMBER: if (! isCached) xmlXPathDebugObjTotalNumber++; xmlXPathDebugObjCounterNumber++; if (xmlXPathDebugObjCounterNumber > xmlXPathDebugObjMaxNumber) xmlXPathDebugObjMaxNumber = xmlXPathDebugObjCounterNumber; break; case XPATH_STRING: if (! isCached) xmlXPathDebugObjTotalString++; xmlXPathDebugObjCounterString++; if (xmlXPathDebugObjCounterString > xmlXPathDebugObjMaxString) xmlXPathDebugObjMaxString = xmlXPathDebugObjCounterString; break; case XPATH_POINT: if (! isCached) xmlXPathDebugObjTotalPoint++; xmlXPathDebugObjCounterPoint++; if (xmlXPathDebugObjCounterPoint > xmlXPathDebugObjMaxPoint) xmlXPathDebugObjMaxPoint = xmlXPathDebugObjCounterPoint; break; case XPATH_RANGE: if (! isCached) xmlXPathDebugObjTotalRange++; xmlXPathDebugObjCounterRange++; if (xmlXPathDebugObjCounterRange > xmlXPathDebugObjMaxRange) xmlXPathDebugObjMaxRange = xmlXPathDebugObjCounterRange; break; case XPATH_LOCATIONSET: if (! isCached) xmlXPathDebugObjTotalLocset++; xmlXPathDebugObjCounterLocset++; if (xmlXPathDebugObjCounterLocset > xmlXPathDebugObjMaxLocset) xmlXPathDebugObjMaxLocset = xmlXPathDebugObjCounterLocset; break; case XPATH_USERS: if (! isCached) xmlXPathDebugObjTotalUsers++; xmlXPathDebugObjCounterUsers++; if (xmlXPathDebugObjCounterUsers > xmlXPathDebugObjMaxUsers) xmlXPathDebugObjMaxUsers = xmlXPathDebugObjCounterUsers; break; case XPATH_XSLT_TREE: if (! isCached) xmlXPathDebugObjTotalXSLTTree++; xmlXPathDebugObjCounterXSLTTree++; if (xmlXPathDebugObjCounterXSLTTree > xmlXPathDebugObjMaxXSLTTree) xmlXPathDebugObjMaxXSLTTree = xmlXPathDebugObjCounterXSLTTree; break; default: break; } if (! isCached) xmlXPathDebugObjTotalAll++; xmlXPathDebugObjCounterAll++; if (xmlXPathDebugObjCounterAll > xmlXPathDebugObjMaxAll) xmlXPathDebugObjMaxAll = xmlXPathDebugObjCounterAll; } ",0 "PassRefPtr HTMLSelectElement::create(Document& document) { return adoptRef(new HTMLSelectElement(document, 0, false)); } ",0 "static header_cache_t *pop_hcache_open(struct PopData *pop_data, const char *path) { struct Url url; char p[LONG_STRING]; if (!pop_data || !pop_data->conn) return mutt_hcache_open(HeaderCache, path, NULL); mutt_account_tourl(&pop_data->conn->account, &url); url.path = HC_FNAME; url_tostring(&url, p, sizeof(p), U_PATH); return mutt_hcache_open(HeaderCache, p, pop_hcache_namer); } ",0 " Ins_SZP2( INS_ARG ) { switch ( (FT_Int)args[0] ) { case 0: CUR.zp2 = CUR.twilight; break; case 1: CUR.zp2 = CUR.pts; break; default: if ( CUR.pedantic_hinting ) CUR.error = TT_Err_Invalid_Reference; return; } CUR.GS.gep2 = (FT_UShort)args[0]; } ",0 "static inline void vm_exit_controls_set(struct vcpu_vmx *vmx, u32 val) { if (vmx->vm_exit_controls_shadow != val) vm_exit_controls_init(vmx, val); } ",0 "static SQLITE_NOINLINE int accessPayloadChecked( BtCursor *pCur, u32 offset, u32 amt, void *pBuf ){ int rc; if ( pCur->eState==CURSOR_INVALID ){ return SQLITE_ABORT; } assert( cursorOwnsBtShared(pCur) ); rc = btreeRestoreCursorPosition(pCur); return rc ? rc : accessPayload(pCur, offset, amt, pBuf, 0); } ",0 "XRenderExtFindDisplay (XRenderExtInfo *extinfo, Display *dpy) { XRenderExtDisplayInfo *dpyinfo; /* * see if this was the most recently accessed display */ if ((dpyinfo = extinfo->cur) && dpyinfo->display == dpy) return dpyinfo; /* * look for display in list */ _XLockMutex(_Xglobal_lock); for (dpyinfo = extinfo->head; dpyinfo; dpyinfo = dpyinfo->next) { if (dpyinfo->display == dpy) { extinfo->cur = dpyinfo; /* cache most recently used */ _XUnlockMutex(_Xglobal_lock); return dpyinfo; } } _XUnlockMutex(_Xglobal_lock); return NULL; } ",0 " RenderMessageCompletionCallback(RenderMessageFilter* filter, IPC::Message* reply_msg) : filter_(filter), reply_msg_(reply_msg) { } ",0 "int nfc_genl_target_lost(struct nfc_dev *dev, u32 target_idx) { struct sk_buff *msg; void *hdr; msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); if (!msg) return -ENOMEM; hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, NFC_EVENT_TARGET_LOST); if (!hdr) goto free_msg; if (nla_put_string(msg, NFC_ATTR_DEVICE_NAME, nfc_device_name(dev)) || nla_put_u32(msg, NFC_ATTR_TARGET_INDEX, target_idx)) goto nla_put_failure; genlmsg_end(msg, hdr); genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL); return 0; nla_put_failure: free_msg: nlmsg_free(msg); return -EMSGSIZE; } ",0 "static inline void tick_irq_exit(void) { #ifdef CONFIG_NO_HZ_COMMON int cpu = smp_processor_id(); /* Make sure that timer wheel updates are propagated */ if ((idle_cpu(cpu) && !need_resched()) || tick_nohz_full_cpu(cpu)) { if (!in_interrupt()) tick_nohz_irq_exit(); } #endif } ",0 "void VaapiVideoDecodeAccelerator::ResetTask() { VLOGF(2); DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); decoder_->Reset(); base::AutoLock auto_lock(lock_); if (curr_input_buffer_.get()) ReturnCurrInputBuffer_Locked(); task_runner_->PostTask( FROM_HERE, base::Bind(&VaapiVideoDecodeAccelerator::FinishReset, weak_this_)); } ",0 "void __init ipc_init_proc_interface(const char *path, const char *header, int ids, int (*show)(struct seq_file *, void *)) { struct proc_dir_entry *pde; struct ipc_proc_iface *iface; iface = kmalloc(sizeof(*iface), GFP_KERNEL); if (!iface) return; iface->path = path; iface->header = header; iface->ids = ids; iface->show = show; pde = proc_create_data(path, S_IRUGO, /* world readable */ NULL, /* parent dir */ &sysvipc_proc_fops, iface); if (!pde) kfree(iface); } ",0 "CJSON_PUBLIC(void) cJSON_InitHooks(cJSON_Hooks* hooks) { if (hooks == NULL) { /* Reset hooks */ global_hooks.allocate = malloc; global_hooks.deallocate = free; global_hooks.reallocate = realloc; return; } global_hooks.allocate = malloc; if (hooks->malloc_fn != NULL) { global_hooks.allocate = hooks->malloc_fn; } global_hooks.deallocate = free; if (hooks->free_fn != NULL) { global_hooks.deallocate = hooks->free_fn; } /* use realloc only if both free and malloc are used */ global_hooks.reallocate = NULL; if ((global_hooks.allocate == malloc) && (global_hooks.deallocate == free)) { global_hooks.reallocate = realloc; } } ",0 "void RenderWidgetHostViewAura::AccessibilitySetTextSelection( int acc_obj_id, int start_offset, int end_offset) { if (!host_) return; host_->AccessibilitySetTextSelection( acc_obj_id, start_offset, end_offset); } ",0 "save_directory_hook () { rl_icppfunc_t *ret; if (dircomplete_expand) { ret = rl_directory_completion_hook; rl_directory_completion_hook = (rl_icppfunc_t *)NULL; } else { ret = rl_directory_rewrite_hook; rl_directory_rewrite_hook = (rl_icppfunc_t *)NULL; } return ret; } ",0 "error::Error GLES2DecoderImpl::HandleCompressedTexImage2D( uint32 immediate_data_size, const cmds::CompressedTexImage2D& c) { GLenum target = static_cast(c.target); GLint level = static_cast(c.level); GLenum internal_format = static_cast(c.internalformat); GLsizei width = static_cast(c.width); GLsizei height = static_cast(c.height); GLint border = static_cast(c.border); GLsizei image_size = static_cast(c.imageSize); uint32 data_shm_id = static_cast(c.data_shm_id); uint32 data_shm_offset = static_cast(c.data_shm_offset); const void* data = NULL; if (data_shm_id != 0 || data_shm_offset != 0) { data = GetSharedMemoryAs( data_shm_id, data_shm_offset, image_size); if (!data) { return error::kOutOfBounds; } } return DoCompressedTexImage2D( target, level, internal_format, width, height, border, image_size, data); } ",0 "mojom::FrameHost* TestRenderFrame::GetFrameHost() { return mock_frame_host_.get(); } ",0 "static void unlink_queued_callback(struct urb *urb) { int status = urb->status; struct queued_ctx *ctx = urb->context; if (ctx->status) goto done; if (urb == ctx->urbs[ctx->num - 4] || urb == ctx->urbs[ctx->num - 2]) { if (status == -ECONNRESET) goto done; /* What error should we report if the URB completed normally? */ } if (status != 0) ctx->status = status; done: if (atomic_dec_and_test(&ctx->pending)) complete(&ctx->complete); } ",0 "void InvalidationNotifier::OnNotificationsDisabled( NotificationsDisabledReason reason) { DCHECK(CalledOnValidThread()); helper_.EmitOnNotificationsDisabled(reason); } ",0 "struct page *follow_page(struct vm_area_struct *vma, unsigned long address, unsigned int flags) { pgd_t *pgd; pud_t *pud; pmd_t *pmd; pte_t *ptep, pte; spinlock_t *ptl; struct page *page; struct mm_struct *mm = vma->vm_mm; page = follow_huge_addr(mm, address, flags & FOLL_WRITE); if (!IS_ERR(page)) { BUG_ON(flags & FOLL_GET); goto out; } page = NULL; pgd = pgd_offset(mm, address); if (pgd_none(*pgd) || unlikely(pgd_bad(*pgd))) goto no_page_table; pud = pud_offset(pgd, address); if (pud_none(*pud)) goto no_page_table; if (pud_huge(*pud) && vma->vm_flags & VM_HUGETLB) { BUG_ON(flags & FOLL_GET); page = follow_huge_pud(mm, address, pud, flags & FOLL_WRITE); goto out; } if (unlikely(pud_bad(*pud))) goto no_page_table; pmd = pmd_offset(pud, address); if (pmd_none(*pmd)) goto no_page_table; if (pmd_huge(*pmd) && vma->vm_flags & VM_HUGETLB) { BUG_ON(flags & FOLL_GET); page = follow_huge_pmd(mm, address, pmd, flags & FOLL_WRITE); goto out; } if (pmd_trans_huge(*pmd)) { if (flags & FOLL_SPLIT) { split_huge_page_pmd(mm, pmd); goto split_fallthrough; } spin_lock(&mm->page_table_lock); if (likely(pmd_trans_huge(*pmd))) { if (unlikely(pmd_trans_splitting(*pmd))) { spin_unlock(&mm->page_table_lock); wait_split_huge_page(vma->anon_vma, pmd); } else { page = follow_trans_huge_pmd(mm, address, pmd, flags); spin_unlock(&mm->page_table_lock); goto out; } } else spin_unlock(&mm->page_table_lock); /* fall through */ } split_fallthrough: if (unlikely(pmd_bad(*pmd))) goto no_page_table; ptep = pte_offset_map_lock(mm, pmd, address, &ptl); pte = *ptep; if (!pte_present(pte)) goto no_page; if ((flags & FOLL_WRITE) && !pte_write(pte)) goto unlock; page = vm_normal_page(vma, address, pte); if (unlikely(!page)) { if ((flags & FOLL_DUMP) || !is_zero_pfn(pte_pfn(pte))) goto bad_page; page = pte_page(pte); } if (flags & FOLL_GET) get_page_foll(page); if (flags & FOLL_TOUCH) { if ((flags & FOLL_WRITE) && !pte_dirty(pte) && !PageDirty(page)) set_page_dirty(page); /* * pte_mkyoung() would be more correct here, but atomic care * is needed to avoid losing the dirty bit: it is easier to use * mark_page_accessed(). */ mark_page_accessed(page); } if ((flags & FOLL_MLOCK) && (vma->vm_flags & VM_LOCKED)) { /* * The preliminary mapping check is mainly to avoid the * pointless overhead of lock_page on the ZERO_PAGE * which might bounce very badly if there is contention. * * If the page is already locked, we don't need to * handle it now - vmscan will handle it later if and * when it attempts to reclaim the page. */ if (page->mapping && trylock_page(page)) { lru_add_drain(); /* push cached pages to LRU */ /* * Because we lock page here and migration is * blocked by the pte's page reference, we need * only check for file-cache page truncation. */ if (page->mapping) mlock_vma_page(page); unlock_page(page); } } unlock: pte_unmap_unlock(ptep, ptl); out: return page; bad_page: pte_unmap_unlock(ptep, ptl); return ERR_PTR(-EFAULT); no_page: pte_unmap_unlock(ptep, ptl); if (!pte_none(pte)) return page; no_page_table: /* * When core dumping an enormous anonymous area that nobody * has touched so far, we don't want to allocate unnecessary pages or * page tables. Return error instead of NULL to skip handle_mm_fault, * then get_dump_page() will return NULL to leave a hole in the dump. * But we can only make this optimization where a hole would surely * be zero-filled if handle_mm_fault() actually did handle it. */ if ((flags & FOLL_DUMP) && (!vma->vm_ops || !vma->vm_ops->fault)) return ERR_PTR(-EFAULT); return page; } ",0 "static int em_jmp_far(struct x86_emulate_ctxt *ctxt) { int rc; unsigned short sel, old_sel; struct desc_struct old_desc, new_desc; const struct x86_emulate_ops *ops = ctxt->ops; u8 cpl = ctxt->ops->cpl(ctxt); /* Assignment of RIP may only fail in 64-bit mode */ if (ctxt->mode == X86EMUL_MODE_PROT64) ops->get_segment(ctxt, &old_sel, &old_desc, NULL, VCPU_SREG_CS); memcpy(&sel, ctxt->src.valptr + ctxt->op_bytes, 2); rc = __load_segment_descriptor(ctxt, sel, VCPU_SREG_CS, cpl, false, &new_desc); if (rc != X86EMUL_CONTINUE) return rc; rc = assign_eip_far(ctxt, ctxt->src.val, new_desc.l); if (rc != X86EMUL_CONTINUE) { WARN_ON(!ctxt->mode != X86EMUL_MODE_PROT64); /* assigning eip failed; restore the old cs */ ops->set_segment(ctxt, old_sel, &old_desc, 0, VCPU_SREG_CS); return rc; } return rc; } ",0 "bool JSTestSerializedScriptValueInterface::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) { JSTestSerializedScriptValueInterface* thisObject = jsCast(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info); return getStaticValueSlot(exec, &JSTestSerializedScriptValueInterfaceTable, thisObject, propertyName, slot); } ",0 "static void conditionalLongAttributeAttributeSetter(v8::Local jsValue, const v8::PropertyCallbackInfo& info) { ExceptionState exceptionState(ExceptionState::SetterContext, ""conditionalLongAttribute"", ""TestObjectPython"", info.Holder(), info.GetIsolate()); TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); V8TRYCATCH_EXCEPTION_VOID(int, cppValue, toInt32(jsValue, exceptionState), exceptionState); imp->setConditionalLongAttribute(cppValue); } ",0 "char* MACH0_(get_cpusubtype)(struct MACH0_(obj_t)* bin) { if (bin) { return MACH0_(get_cpusubtype_from_hdr) (&bin->hdr); } return strdup (""Unknown""); } ",0 "static void virtio_gpu_update_display(void *opaque) { } ",0 " explicit TestFormStructure(const FormData& form) : FormStructure(form) {} ",0 "OfflinePageDownloadBridge::~OfflinePageDownloadBridge() {} ",0 "void BaseShadow::removeJobPre( const char* reason ) { if( ! jobAd ) { dprintf( D_ALWAYS, ""In removeJob() w/ NULL JobAd!"" ); } dprintf( D_ALWAYS, ""Job %d.%d is being removed: %s\n"", getCluster(), getProc(), reason ); cleanUp(); int size = strlen( reason ) + strlen( ATTR_REMOVE_REASON ) + 4; char* buf = (char*)malloc( size * sizeof(char) ); if( ! buf ) { EXCEPT( ""Out of memory!"" ); } sprintf( buf, ""%s=\""%s\"""", ATTR_REMOVE_REASON, reason ); jobAd->Insert( buf ); free( buf ); emailRemoveEvent( reason ); if( !updateJobInQueue(U_REMOVE) ) { dprintf( D_ALWAYS, ""Failed to update job queue!\n"" ); } } ",0 "static int parse_q922_addr(netdissect_options *ndo, const u_char *p, u_int *dlci, u_int *addr_len, uint8_t *flags, u_int length) { if (!ND_TTEST(p[0]) || length < 1) return -1; if ((p[0] & FR_EA_BIT)) return 0; if (!ND_TTEST(p[1]) || length < 2) return -1; *addr_len = 2; *dlci = ((p[0] & 0xFC) << 2) | ((p[1] & 0xF0) >> 4); flags[0] = p[0] & 0x02; /* populate the first flag fields */ flags[1] = p[1] & 0x0c; flags[2] = 0; /* clear the rest of the flags */ flags[3] = 0; if (p[1] & FR_EA_BIT) return 1; /* 2-byte Q.922 address */ p += 2; length -= 2; if (!ND_TTEST(p[0]) || length < 1) return -1; (*addr_len)++; /* 3- or 4-byte Q.922 address */ if ((p[0] & FR_EA_BIT) == 0) { *dlci = (*dlci << 7) | (p[0] >> 1); (*addr_len)++; /* 4-byte Q.922 address */ p++; length--; } if (!ND_TTEST(p[0]) || length < 1) return -1; if ((p[0] & FR_EA_BIT) == 0) return 0; /* more than 4 bytes of Q.922 address? */ flags[3] = p[0] & 0x02; *dlci = (*dlci << 6) | (p[0] >> 2); return 1; } ",0 "static int vmci_transport_recv_connected(struct sock *sk, struct vmci_transport_packet *pkt) { struct vsock_sock *vsk; bool pkt_processed = false; /* In cases where we are closing the connection, it's sufficient to * mark the state change (and maybe error) and wake up any waiting * threads. Since this is a connected socket, it's owned by a user * process and will be cleaned up when the failure is passed back on * the current or next system call. Our system call implementations * must therefore check for error and state changes on entry and when * being awoken. */ switch (pkt->type) { case VMCI_TRANSPORT_PACKET_TYPE_SHUTDOWN: if (pkt->u.mode) { vsk = vsock_sk(sk); vsk->peer_shutdown |= pkt->u.mode; sk->sk_state_change(sk); } break; case VMCI_TRANSPORT_PACKET_TYPE_RST: vsk = vsock_sk(sk); /* It is possible that we sent our peer a message (e.g a * WAITING_READ) right before we got notified that the peer had * detached. If that happens then we can get a RST pkt back * from our peer even though there is data available for us to * read. In that case, don't shutdown the socket completely but * instead allow the local client to finish reading data off * the queuepair. Always treat a RST pkt in connected mode like * a clean shutdown. */ sock_set_flag(sk, SOCK_DONE); vsk->peer_shutdown = SHUTDOWN_MASK; if (vsock_stream_has_data(vsk) <= 0) sk->sk_state = SS_DISCONNECTING; sk->sk_state_change(sk); break; default: vsk = vsock_sk(sk); vmci_trans(vsk)->notify_ops->handle_notify_pkt( sk, pkt, false, NULL, NULL, &pkt_processed); if (!pkt_processed) return -EINVAL; break; } return 0; } ",0 "static void dump_invalid_creds(const struct cred *cred, const char *label, const struct task_struct *tsk) { printk(KERN_ERR ""CRED: %s credentials: %p %s%s%s\n"", label, cred, cred == &init_cred ? ""[init]"" : """", cred == tsk->real_cred ? ""[real]"" : """", cred == tsk->cred ? ""[eff]"" : """"); printk(KERN_ERR ""CRED: ->magic=%x, put_addr=%p\n"", cred->magic, cred->put_addr); printk(KERN_ERR ""CRED: ->usage=%d, subscr=%d\n"", atomic_read(&cred->usage), read_cred_subscribers(cred)); printk(KERN_ERR ""CRED: ->*uid = { %d,%d,%d,%d }\n"", cred->uid, cred->euid, cred->suid, cred->fsuid); printk(KERN_ERR ""CRED: ->*gid = { %d,%d,%d,%d }\n"", cred->gid, cred->egid, cred->sgid, cred->fsgid); #ifdef CONFIG_SECURITY printk(KERN_ERR ""CRED: ->security is %p\n"", cred->security); if ((unsigned long) cred->security >= PAGE_SIZE && (((unsigned long) cred->security & 0xffffff00) != (POISON_FREE << 24 | POISON_FREE << 16 | POISON_FREE << 8))) printk(KERN_ERR ""CRED: ->security {%x, %x}\n"", ((u32*)cred->security)[0], ((u32*)cred->security)[1]); #endif } ",0 "bool AllSamplesPassedQuery::Begin() { BeginQueryHelper(target(), service_id_); return true; } ",0 "_exsltDateParseGMonth (exsltDateValDatePtr dt, const xmlChar **str) { const xmlChar *cur = *str; int ret = 0; PARSE_2_DIGITS(dt->mon, cur, VALID_MONTH, ret); if (ret != 0) return ret; *str = cur; #ifdef DEBUG_EXSLT_DATE xsltGenericDebug(xsltGenericDebugContext, ""Parsed month %02i\n"", dt->mon); #endif return 0; } ",0 "const Extension* ExtensionSettingsHandler::GetExtension(const ListValue* args) { std::string extension_id = UTF16ToUTF8(ExtractStringValue(args)); CHECK(!extension_id.empty()); return extension_service_->GetExtensionById(extension_id, true); } ",0 "static int ext4_acquire_dquot(struct dquot *dquot) { int ret, err; handle_t *handle; handle = ext4_journal_start(dquot_to_inode(dquot), EXT4_HT_QUOTA, EXT4_QUOTA_INIT_BLOCKS(dquot->dq_sb)); if (IS_ERR(handle)) return PTR_ERR(handle); ret = dquot_acquire(dquot); err = ext4_journal_stop(handle); if (!ret) ret = err; return ret; } ",0 "blink::WebString RTCPeerConnectionHandler::Id() const { return blink::WebString::FromASCII(id_); } ",0 "void GLES2DecoderImpl::RestoreAllExternalTextureBindingsIfNeeded() { if (texture_manager()->GetServiceIdGeneration() == texture_manager_service_id_generation_) return; for (unsigned texture_unit_index = 0; texture_unit_index < state_.texture_units.size(); texture_unit_index++) { TextureUnit& texture_unit = state_.texture_units[texture_unit_index]; if (texture_unit.bind_target != GL_TEXTURE_EXTERNAL_OES) continue; if (TextureRef* texture_ref = texture_unit.bound_texture_external_oes.get()) { api()->glActiveTextureFn(GL_TEXTURE0 + texture_unit_index); api()->glBindTextureFn(GL_TEXTURE_EXTERNAL_OES, texture_ref->service_id()); } } api()->glActiveTextureFn(GL_TEXTURE0 + state_.active_texture_unit); texture_manager_service_id_generation_ = texture_manager()->GetServiceIdGeneration(); } ",0 "static int hwsim_unicast_netgroup(struct mac80211_hwsim_data *data, struct sk_buff *skb, int portid) { struct net *net; bool found = false; int res = -ENOENT; rcu_read_lock(); for_each_net_rcu(net) { if (data->netgroup == hwsim_net_get_netgroup(net)) { res = genlmsg_unicast(net, skb, portid); found = true; break; } } rcu_read_unlock(); if (!found) nlmsg_free(skb); return res; } ",0 "int mapped_hostid(unsigned id, struct lxc_conf *conf, enum idtype idtype) { struct lxc_list *it; struct id_map *map; lxc_list_for_each(it, &conf->id_map) { map = it->elem; if (map->idtype != idtype) continue; if (id >= map->hostid && id < map->hostid + map->range) return (id - map->hostid) + map->nsid; } return -1; } ",0 "double RoundDouble(const long double invalue, const short numberOfPrecisions) { long long p = (long long) pow(10.0L, numberOfPrecisions); double ret= (long long)(invalue * p + 0.5L) / (double)p; return ret; } ",0 "int generic_readlink(struct dentry *dentry, char __user *buffer, int buflen) { DEFINE_DELAYED_CALL(done); struct inode *inode = d_inode(dentry); const char *link = inode->i_link; int res; if (!link) { link = inode->i_op->get_link(dentry, inode, &done); if (IS_ERR(link)) return PTR_ERR(link); } res = readlink_copy(buffer, buflen, link); do_delayed_call(&done); return res; } ",0 "static struct se_device *rd_alloc_device(struct se_hba *hba, const char *name) { struct rd_dev *rd_dev; struct rd_host *rd_host = hba->hba_ptr; rd_dev = kzalloc(sizeof(struct rd_dev), GFP_KERNEL); if (!rd_dev) { pr_err(""Unable to allocate memory for struct rd_dev\n""); return NULL; } rd_dev->rd_host = rd_host; return &rd_dev->dev; } ",0 "ResourceRequestBlockedReason BaseFetchContext::CanRequest( Resource::Type type, const ResourceRequest& resource_request, const KURL& url, const ResourceLoaderOptions& options, SecurityViolationReportingPolicy reporting_policy, FetchParameters::OriginRestriction origin_restriction, ResourceRequest::RedirectStatus redirect_status) const { ResourceRequestBlockedReason blocked_reason = CanRequestInternal(type, resource_request, url, options, reporting_policy, origin_restriction, redirect_status); if (blocked_reason != ResourceRequestBlockedReason::kNone && reporting_policy == SecurityViolationReportingPolicy::kReport) { DispatchDidBlockRequest(resource_request, options.initiator_info, blocked_reason); } return blocked_reason; } ",1 " content::WebContents* web_contents() { return stub_->web_contents(); } ",0 "gdImagePtr gdImageCreateFromWBMPCtx (gdIOCtx * infile) { /* FILE *wbmp_file; */ Wbmp *wbmp; gdImagePtr im = NULL; int black, white; int col, row, pos; if (readwbmp (&gd_getin, infile, &wbmp)) { return NULL; } if (!(im = gdImageCreate (wbmp->width, wbmp->height))) { freewbmp (wbmp); return NULL; } /* create the background color */ white = gdImageColorAllocate(im, 255, 255, 255); /* create foreground color */ black = gdImageColorAllocate(im, 0, 0, 0); /* fill in image (in a wbmp 1 = white/ 0 = black) */ pos = 0; for (row = 0; row < wbmp->height; row++) { for (col = 0; col < wbmp->width; col++) { if (wbmp->bitmap[pos++] == WBMP_WHITE) { gdImageSetPixel(im, col, row, white); } else { gdImageSetPixel(im, col, row, black); } } } freewbmp(wbmp); return im; } ",0 "SYSCALL_DEFINE2(mq_notify, mqd_t, mqdes, const struct sigevent __user *, u_notification) { struct sigevent n, *p = NULL; if (u_notification) { if (copy_from_user(&n, u_notification, sizeof(struct sigevent))) return -EFAULT; p = &n; } return do_mq_notify(mqdes, p); } ",0 "int EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx) { if (group->meth->invert == 0) { ECerr(EC_F_EC_POINT_INVERT, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); return 0; } if (group->meth != a->meth) { ECerr(EC_F_EC_POINT_INVERT, EC_R_INCOMPATIBLE_OBJECTS); return 0; } return group->meth->invert(group, a, ctx); } ",0 "JsArgList SyncManager::SyncInternal::GetChildNodeIds( const JsArgList& args) { ListValue return_args; ListValue* child_ids = new ListValue(); return_args.Append(child_ids); int64 id = GetId(args.Get(), 0); if (id != kInvalidId) { ReadTransaction trans(FROM_HERE, GetUserShare()); syncable::Directory::ChildHandles child_handles; trans.GetDirectory()->GetChildHandlesByHandle(trans.GetWrappedTrans(), id, &child_handles); for (syncable::Directory::ChildHandles::const_iterator it = child_handles.begin(); it != child_handles.end(); ++it) { child_ids->Append(Value::CreateStringValue( base::Int64ToString(*it))); } } return JsArgList(&return_args); } ",0 "idr_register(struct idr *idr, struct isoent *isoent, int weight, int noff) { struct idrent *idrent, *n; idrent = &(idr->idrent_pool[idr->pool_idx++]); idrent->wnext = idrent->avail = NULL; idrent->isoent = isoent; idrent->weight = weight; idrent->noff = noff; idrent->rename_num = 0; if (!__archive_rb_tree_insert_node(&(idr->rbtree), &(idrent->rbnode))) { n = (struct idrent *)__archive_rb_tree_find_node( &(idr->rbtree), idrent->isoent); if (n != NULL) { /* this `idrent' needs to rename. */ idrent->avail = n; *idr->wait_list.last = idrent; idr->wait_list.last = &(idrent->wnext); } } } ",0 "ip_vs_add_service(struct ip_vs_service_user_kern *u, struct ip_vs_service **svc_p) { int ret = 0; struct ip_vs_scheduler *sched = NULL; struct ip_vs_service *svc = NULL; /* increase the module use count */ ip_vs_use_count_inc(); /* Lookup the scheduler by 'u->sched_name' */ sched = ip_vs_scheduler_get(u->sched_name); if (sched == NULL) { pr_info(""Scheduler module ip_vs_%s not found\n"", u->sched_name); ret = -ENOENT; goto out_mod_dec; } #ifdef CONFIG_IP_VS_IPV6 if (u->af == AF_INET6 && (u->netmask < 1 || u->netmask > 128)) { ret = -EINVAL; goto out_err; } #endif svc = kzalloc(sizeof(struct ip_vs_service), GFP_ATOMIC); if (svc == NULL) { IP_VS_DBG(1, ""%s(): no memory\n"", __func__); ret = -ENOMEM; goto out_err; } /* I'm the first user of the service */ atomic_set(&svc->usecnt, 1); atomic_set(&svc->refcnt, 0); svc->af = u->af; svc->protocol = u->protocol; ip_vs_addr_copy(svc->af, &svc->addr, &u->addr); svc->port = u->port; svc->fwmark = u->fwmark; svc->flags = u->flags; svc->timeout = u->timeout * HZ; svc->netmask = u->netmask; INIT_LIST_HEAD(&svc->destinations); rwlock_init(&svc->sched_lock); spin_lock_init(&svc->stats.lock); /* Bind the scheduler */ ret = ip_vs_bind_scheduler(svc, sched); if (ret) goto out_err; sched = NULL; /* Update the virtual service counters */ if (svc->port == FTPPORT) atomic_inc(&ip_vs_ftpsvc_counter); else if (svc->port == 0) atomic_inc(&ip_vs_nullsvc_counter); ip_vs_new_estimator(&svc->stats); /* Count only IPv4 services for old get/setsockopt interface */ if (svc->af == AF_INET) ip_vs_num_services++; /* Hash the service into the service table */ write_lock_bh(&__ip_vs_svc_lock); ip_vs_svc_hash(svc); write_unlock_bh(&__ip_vs_svc_lock); *svc_p = svc; return 0; out_err: if (svc != NULL) { if (svc->scheduler) ip_vs_unbind_scheduler(svc); if (svc->inc) { local_bh_disable(); ip_vs_app_inc_put(svc->inc); local_bh_enable(); } kfree(svc); } ip_vs_scheduler_put(sched); out_mod_dec: /* decrease the module use count */ ip_vs_use_count_dec(); return ret; } ",0 "WORD32 ih264d_init_video_decoder(iv_obj_t *dec_hdl, ih264d_init_ip_t *ps_init_ip, ih264d_init_op_t *ps_init_op) { dec_struct_t * ps_dec; iv_mem_rec_t *memtab; UWORD8 *pu1_extra_mem_base,*pu1_mem_base; memtab = ps_init_ip->s_ivd_init_ip_t.pv_mem_rec_location; dec_hdl->pv_codec_handle = memtab[MEM_REC_CODEC].pv_base; ps_dec = dec_hdl->pv_codec_handle; memset(ps_dec, 0, sizeof(dec_struct_t)); if(ps_init_ip->s_ivd_init_ip_t.u4_size > offsetof(ih264d_init_ip_t, i4_level)) { ps_dec->u4_level_at_init = ps_init_ip->i4_level; } else { ps_dec->u4_level_at_init = H264_LEVEL_3_1; } if(ps_init_ip->s_ivd_init_ip_t.u4_size > offsetof(ih264d_init_ip_t, u4_num_ref_frames)) { ps_dec->u4_num_ref_frames_at_init = ps_init_ip->u4_num_ref_frames; } else { ps_dec->u4_num_ref_frames_at_init = H264_MAX_REF_PICS; } if(ps_init_ip->s_ivd_init_ip_t.u4_size > offsetof(ih264d_init_ip_t, u4_num_reorder_frames)) { ps_dec->u4_num_reorder_frames_at_init = ps_init_ip->u4_num_reorder_frames; } else { ps_dec->u4_num_reorder_frames_at_init = H264_MAX_REF_PICS; } if(ps_init_ip->s_ivd_init_ip_t.u4_size > offsetof(ih264d_init_ip_t, u4_num_extra_disp_buf)) { ps_dec->u4_num_extra_disp_bufs_at_init = ps_init_ip->u4_num_extra_disp_buf; } else { ps_dec->u4_num_extra_disp_bufs_at_init = 0; } if(ps_init_ip->s_ivd_init_ip_t.u4_size > offsetof(ih264d_init_ip_t, u4_share_disp_buf)) { #ifndef LOGO_EN ps_dec->u4_share_disp_buf = ps_init_ip->u4_share_disp_buf; #else ps_dec->u4_share_disp_buf = 0; #endif } else { ps_dec->u4_share_disp_buf = 0; } if((ps_init_ip->s_ivd_init_ip_t.e_output_format != IV_YUV_420P) && (ps_init_ip->s_ivd_init_ip_t.e_output_format != IV_YUV_420SP_UV) && (ps_init_ip->s_ivd_init_ip_t.e_output_format != IV_YUV_420SP_VU)) { ps_dec->u4_share_disp_buf = 0; } if((ps_dec->u4_level_at_init < MIN_LEVEL_SUPPORTED) || (ps_dec->u4_level_at_init > MAX_LEVEL_SUPPORTED)) { ps_init_op->s_ivd_init_op_t.u4_error_code |= ERROR_LEVEL_UNSUPPORTED; return (IV_FAIL); } if(ps_dec->u4_num_ref_frames_at_init > H264_MAX_REF_PICS) { ps_init_op->s_ivd_init_op_t.u4_error_code |= ERROR_NUM_REF; ps_dec->u4_num_ref_frames_at_init = H264_MAX_REF_PICS; } if(ps_dec->u4_num_reorder_frames_at_init > H264_MAX_REF_PICS) { ps_init_op->s_ivd_init_op_t.u4_error_code |= ERROR_NUM_REF; ps_dec->u4_num_reorder_frames_at_init = H264_MAX_REF_PICS; } if(ps_dec->u4_num_extra_disp_bufs_at_init > H264_MAX_REF_PICS) { ps_init_op->s_ivd_init_op_t.u4_error_code |= ERROR_NUM_REF; ps_dec->u4_num_extra_disp_bufs_at_init = 0; } if(0 == ps_dec->u4_share_disp_buf) ps_dec->u4_num_extra_disp_bufs_at_init = 0; ps_dec->u4_num_disp_bufs_requested = 1; ps_dec->u4_width_at_init = ps_init_ip->s_ivd_init_ip_t.u4_frm_max_wd; ps_dec->u4_height_at_init = ps_init_ip->s_ivd_init_ip_t.u4_frm_max_ht; ps_dec->u4_width_at_init = ALIGN16(ps_dec->u4_width_at_init); ps_dec->u4_height_at_init = ALIGN32(ps_dec->u4_height_at_init); ps_dec->pv_dec_thread_handle = memtab[MEM_REC_THREAD_HANDLE].pv_base; pu1_mem_base = memtab[MEM_REC_THREAD_HANDLE].pv_base; ps_dec->pv_bs_deblk_thread_handle = pu1_mem_base + ithread_get_handle_size(); ps_dec->u4_extra_mem_used = 0; pu1_extra_mem_base = memtab[MEM_REC_EXTRA_MEM].pv_base; ps_dec->ps_dec_err_status = (dec_err_status_t *)(pu1_extra_mem_base + ps_dec->u4_extra_mem_used); ps_dec->u4_extra_mem_used += (((sizeof(dec_err_status_t) + 127) >> 7) << 7); ps_dec->ps_mem_tab = memtab[MEM_REC_BACKUP].pv_base; memcpy(ps_dec->ps_mem_tab, memtab, sizeof(iv_mem_rec_t) * MEM_REC_CNT); ps_dec->ps_pps = memtab[MEM_REC_PPS].pv_base; ps_dec->ps_sps = memtab[MEM_REC_SPS].pv_base; ps_dec->ps_sei = (sei *)(pu1_extra_mem_base + ps_dec->u4_extra_mem_used); ps_dec->u4_extra_mem_used += sizeof(sei); ps_dec->ps_dpb_mgr = memtab[MEM_REC_DPB_MGR].pv_base; ps_dec->ps_dpb_cmds = (dpb_commands_t *)(pu1_extra_mem_base + ps_dec->u4_extra_mem_used); ps_dec->u4_extra_mem_used += sizeof(dpb_commands_t); ps_dec->ps_bitstrm = (dec_bit_stream_t *)(pu1_extra_mem_base + ps_dec->u4_extra_mem_used); ps_dec->u4_extra_mem_used += sizeof(dec_bit_stream_t); ps_dec->ps_cur_slice =(dec_slice_params_t *) (pu1_extra_mem_base + ps_dec->u4_extra_mem_used); ps_dec->u4_extra_mem_used += sizeof(dec_slice_params_t); ps_dec->pv_scratch_sps_pps = (void *)(pu1_extra_mem_base + ps_dec->u4_extra_mem_used); ps_dec->u4_extra_mem_used += MAX(sizeof(dec_seq_params_t), sizeof(dec_pic_params_t)); ps_dec->ps_pred_pkd = memtab[MEM_REC_PRED_INFO_PKD].pv_base; ps_dec->ps_dpb_mgr->pv_codec_handle = ps_dec; ps_dec->pv_dec_out = (void *)ps_init_op; ps_dec->pv_dec_in = (void *)ps_init_ip; ps_dec->u1_chroma_format = (UWORD8)(ps_init_ip->s_ivd_init_ip_t.e_output_format); ih264d_init_decoder(ps_dec); return (IV_SUCCESS); } ",0 "void ScaleRect(float scale, pp::Rect* rect) { int left = static_cast(floorf(rect->x() * scale)); int top = static_cast(floorf(rect->y() * scale)); int right = static_cast(ceilf((rect->x() + rect->width()) * scale)); int bottom = static_cast(ceilf((rect->y() + rect->height()) * scale)); rect->SetRect(left, top, right - left, bottom - top); } ",0 "void * CAPSTONE_API cs_winkernel_realloc(void *ptr, size_t size) { void *new_ptr = NULL; size_t current_size = 0; size_t smaller_size = 0; if (!ptr) { return cs_winkernel_malloc(size); } new_ptr = cs_winkernel_malloc(size); if (!new_ptr) { return NULL; } current_size = CONTAINING_RECORD(ptr, CS_WINKERNEL_MEMBLOCK, data)->size; smaller_size = (current_size < size) ? current_size : size; RtlCopyMemory(new_ptr, ptr, smaller_size); cs_winkernel_free(ptr); return new_ptr; } ",0 "struct bio *bio_alloc_bioset(gfp_t gfp_mask, unsigned int nr_iovecs, struct bio_set *bs) { gfp_t saved_gfp = gfp_mask; unsigned front_pad; unsigned inline_vecs; struct bio_vec *bvl = NULL; struct bio *bio; void *p; if (!bs) { if (nr_iovecs > UIO_MAXIOV) return NULL; p = kmalloc(sizeof(struct bio) + nr_iovecs * sizeof(struct bio_vec), gfp_mask); front_pad = 0; inline_vecs = nr_iovecs; } else { /* should not use nobvec bioset for nr_iovecs > 0 */ if (WARN_ON_ONCE(!bs->bvec_pool && nr_iovecs > 0)) return NULL; /* * generic_make_request() converts recursion to iteration; this * means if we're running beneath it, any bios we allocate and * submit will not be submitted (and thus freed) until after we * return. * * This exposes us to a potential deadlock if we allocate * multiple bios from the same bio_set() while running * underneath generic_make_request(). If we were to allocate * multiple bios (say a stacking block driver that was splitting * bios), we would deadlock if we exhausted the mempool's * reserve. * * We solve this, and guarantee forward progress, with a rescuer * workqueue per bio_set. If we go to allocate and there are * bios on current->bio_list, we first try the allocation * without __GFP_DIRECT_RECLAIM; if that fails, we punt those * bios we would be blocking to the rescuer workqueue before * we retry with the original gfp_flags. */ if (current->bio_list && (!bio_list_empty(¤t->bio_list[0]) || !bio_list_empty(¤t->bio_list[1])) && bs->rescue_workqueue) gfp_mask &= ~__GFP_DIRECT_RECLAIM; p = mempool_alloc(bs->bio_pool, gfp_mask); if (!p && gfp_mask != saved_gfp) { punt_bios_to_rescuer(bs); gfp_mask = saved_gfp; p = mempool_alloc(bs->bio_pool, gfp_mask); } front_pad = bs->front_pad; inline_vecs = BIO_INLINE_VECS; } if (unlikely(!p)) return NULL; bio = p + front_pad; bio_init(bio, NULL, 0); if (nr_iovecs > inline_vecs) { unsigned long idx = 0; bvl = bvec_alloc(gfp_mask, nr_iovecs, &idx, bs->bvec_pool); if (!bvl && gfp_mask != saved_gfp) { punt_bios_to_rescuer(bs); gfp_mask = saved_gfp; bvl = bvec_alloc(gfp_mask, nr_iovecs, &idx, bs->bvec_pool); } if (unlikely(!bvl)) goto err_free; bio->bi_flags |= idx << BVEC_POOL_OFFSET; } else if (nr_iovecs) { bvl = bio->bi_inline_vecs; } bio->bi_pool = bs; bio->bi_max_vecs = nr_iovecs; bio->bi_io_vec = bvl; return bio; err_free: mempool_free(p, bs->bio_pool); return NULL; } ",0 "void WebContentsImpl::SetUserAgentOverride(const std::string& override) { if (GetUserAgentOverride() == override) return; renderer_preferences_.user_agent_override = override; RenderViewHost* host = GetRenderViewHost(); if (host) host->SyncRendererPrefs(); NavigationEntry* entry = controller_.GetVisibleEntry(); if (is_loading_ && entry != NULL && entry->GetIsOverridingUserAgent()) controller_.ReloadIgnoringCache(true); FOR_EACH_OBSERVER(WebContentsObserver, observers_, UserAgentOverrideSet(override)); } ",0 "const base::Process& BrowserChildProcessHostImpl::GetProcess() const { DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK(child_process_.get()) << ""Requesting a child process handle before launching.""; DCHECK(child_process_->GetProcess().IsValid()) << ""Requesting a child process handle before launch has completed OK.""; return child_process_->GetProcess(); } ",0 "static int hwahc_op_get_frame_number(struct usb_hcd *usb_hcd) { struct wusbhc *wusbhc = usb_hcd_to_wusbhc(usb_hcd); struct hwahc *hwahc = container_of(wusbhc, struct hwahc, wusbhc); struct wahc *wa = &hwahc->wa; /* * We cannot query the HWA for the WUSB time since that requires sending * a synchronous URB and this function can be called in_interrupt. * Instead, query the USB frame number for our parent and use that. */ return usb_get_current_frame_number(wa->usb_dev); } ",0 "void CloudPolicyController::Initialize( DeviceManagementService* service, CloudPolicyCacheBase* cache, DeviceTokenFetcher* token_fetcher, CloudPolicyDataStore* data_store, PolicyNotifier* notifier, DelayedWorkScheduler* scheduler) { DCHECK(cache); service_ = service; cache_ = cache; token_fetcher_ = token_fetcher; data_store_ = data_store; notifier_ = notifier; state_ = STATE_TOKEN_UNAVAILABLE; policy_refresh_rate_ms_ = kPolicyRefreshRateInMilliseconds; effective_policy_refresh_error_delay_ms_ = kPolicyRefreshErrorDelayInMilliseconds; scheduler_.reset(scheduler); data_store_->AddObserver(this); if (!data_store_->device_token().empty()) SetState(STATE_TOKEN_VALID); else SetState(STATE_TOKEN_UNAVAILABLE); } ",0 "void DocumentTimeline::DocumentTimelineTiming::wakeAfter(double duration) { m_timer.startOneShot(duration); } ",0 "void WebView::windowReceivedMessage(HWND, UINT message, WPARAM wParam, LPARAM) { switch (message) { case WM_NCACTIVATE: updateActiveStateSoon(); break; case WM_SETTINGCHANGE: break; } } ",0 "static MagickBooleanType RenderType(Image *image,const DrawInfo *draw_info, const PointInfo *offset,TypeMetric *metrics) { const TypeInfo *type_info; DrawInfo *annotate_info; MagickBooleanType status; type_info=(const TypeInfo *) NULL; if (draw_info->font != (char *) NULL) { if (*draw_info->font == '@') { status=RenderFreetype(image,draw_info,draw_info->encoding,offset, metrics); return(status); } if (*draw_info->font == '-') return(RenderX11(image,draw_info,offset,metrics)); if (*draw_info->font == '^') return(RenderPostscript(image,draw_info,offset,metrics)); if (IsPathAccessible(draw_info->font) != MagickFalse) { status=RenderFreetype(image,draw_info,draw_info->encoding,offset, metrics); return(status); } type_info=GetTypeInfo(draw_info->font,&image->exception); if (type_info == (const TypeInfo *) NULL) (void) ThrowMagickException(&image->exception,GetMagickModule(), TypeWarning,""UnableToReadFont"",""`%s'"",draw_info->font); } if ((type_info == (const TypeInfo *) NULL) && (draw_info->family != (const char *) NULL)) { type_info=GetTypeInfoByFamily(draw_info->family,draw_info->style, draw_info->stretch,draw_info->weight,&image->exception); if (type_info == (const TypeInfo *) NULL) { char **family; int number_families; register ssize_t i; /* Parse font family list. */ family=StringToArgv(draw_info->family,&number_families); for (i=1; i < (ssize_t) number_families; i++) { type_info=GetTypeInfoByFamily(family[i],draw_info->style, draw_info->stretch,draw_info->weight,&image->exception); if (type_info != (const TypeInfo *) NULL) break; } for (i=0; i < (ssize_t) number_families; i++) family[i]=DestroyString(family[i]); family=(char **) RelinquishMagickMemory(family); if (type_info == (const TypeInfo *) NULL) (void) ThrowMagickException(&image->exception,GetMagickModule(), TypeWarning,""UnableToReadFont"",""`%s'"",draw_info->family); } } if (type_info == (const TypeInfo *) NULL) type_info=GetTypeInfoByFamily(""Arial"",draw_info->style, draw_info->stretch,draw_info->weight,&image->exception); if (type_info == (const TypeInfo *) NULL) type_info=GetTypeInfoByFamily(""Helvetica"",draw_info->style, draw_info->stretch,draw_info->weight,&image->exception); if (type_info == (const TypeInfo *) NULL) type_info=GetTypeInfoByFamily(""Century Schoolbook"",draw_info->style, draw_info->stretch,draw_info->weight,&image->exception); if (type_info == (const TypeInfo *) NULL) type_info=GetTypeInfoByFamily(""Sans"",draw_info->style, draw_info->stretch,draw_info->weight,&image->exception); if (type_info == (const TypeInfo *) NULL) type_info=GetTypeInfoByFamily((const char *) NULL,draw_info->style, draw_info->stretch,draw_info->weight,&image->exception); if (type_info == (const TypeInfo *) NULL) type_info=GetTypeInfo(""*"",&image->exception); if (type_info == (const TypeInfo *) NULL) { status=RenderFreetype(image,draw_info,draw_info->encoding,offset,metrics); return(status); } annotate_info=CloneDrawInfo((ImageInfo *) NULL,draw_info); annotate_info->face=type_info->face; if (type_info->metrics != (char *) NULL) (void) CloneString(&annotate_info->metrics,type_info->metrics); if (type_info->glyphs != (char *) NULL) (void) CloneString(&annotate_info->font,type_info->glyphs); status=RenderFreetype(image,annotate_info,type_info->encoding,offset,metrics); annotate_info=DestroyDrawInfo(annotate_info); return(status); } ",0 "static inline int create_thread(void *(*start_routine)(void *), void * arg, pthread_t * thread_id) { pthread_attr_t thread_attr; pthread_attr_init(&thread_attr); pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_JOINABLE); int policy; int min_pri=0; int ret = -1; struct sched_param param; if ((ret = pthread_create(thread_id, &thread_attr, start_routine, arg))!=0 ) { APPL_TRACE_ERROR(""pthread_create : %s"", strerror(errno)); return ret; } /* We need to lower the priority of this thread to ensure the stack gets * priority over transfer to a socket */ pthread_getschedparam(*thread_id, &policy, ¶m); min_pri = sched_get_priority_min(policy); if (param.sched_priority > min_pri) { param.sched_priority -= 1; } pthread_setschedparam(*thread_id, policy, ¶m); return ret; } ",0 "static void tcp_ack_probe(struct sock *sk) { const struct tcp_sock *tp = tcp_sk(sk); struct inet_connection_sock *icsk = inet_csk(sk); /* Was it a usable window open? */ if (!after(TCP_SKB_CB(tcp_send_head(sk))->end_seq, tcp_wnd_end(tp))) { icsk->icsk_backoff = 0; inet_csk_clear_xmit_timer(sk, ICSK_TIME_PROBE0); /* Socket must be waked up by subsequent tcp_data_snd_check(). * This function is not for random using! */ } else { inet_csk_reset_xmit_timer(sk, ICSK_TIME_PROBE0, min(icsk->icsk_rto << icsk->icsk_backoff, TCP_RTO_MAX), TCP_RTO_MAX); } } ",0 "void LayerTreeCoordinator::syncLayerState(WebLayerID id, const WebLayerInfo& info) { if (m_shouldSendScrollPositionUpdate) { m_webPage->send(Messages::LayerTreeCoordinatorProxy::DidChangeScrollPosition(m_visibleContentsRect.location())); m_shouldSendScrollPositionUpdate = false; } m_shouldSyncFrame = true; m_webPage->send(Messages::LayerTreeCoordinatorProxy::SetCompositingLayerState(id, info)); } ",0 "static int inet_netconf_msgsize_devconf(int type) { int size = NLMSG_ALIGN(sizeof(struct netconfmsg)) + nla_total_size(4); /* NETCONFA_IFINDEX */ bool all = false; if (type == NETCONFA_ALL) all = true; if (all || type == NETCONFA_FORWARDING) size += nla_total_size(4); if (all || type == NETCONFA_RP_FILTER) size += nla_total_size(4); if (all || type == NETCONFA_MC_FORWARDING) size += nla_total_size(4); if (all || type == NETCONFA_PROXY_NEIGH) size += nla_total_size(4); if (all || type == NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN) size += nla_total_size(4); return size; } ",0 "void WebGLRenderingContextBase::TexImageHelperHTMLCanvasElement( const SecurityOrigin* security_origin, TexImageFunctionID function_id, GLenum target, GLint level, GLint internalformat, GLenum format, GLenum type, GLint xoffset, GLint yoffset, GLint zoffset, HTMLCanvasElement* canvas, const IntRect& source_sub_rectangle, GLsizei depth, GLint unpack_image_height, ExceptionState& exception_state) { const char* func_name = GetTexImageFunctionName(function_id); if (isContextLost()) return; if (!ValidateHTMLCanvasElement(security_origin, func_name, canvas, exception_state)) return; WebGLTexture* texture = ValidateTexImageBinding(func_name, function_id, target); if (!texture) return; TexImageFunctionType function_type; if (function_id == kTexImage2D) function_type = kTexImage; else function_type = kTexSubImage; if (!ValidateTexFunc(func_name, function_type, kSourceHTMLCanvasElement, target, level, internalformat, canvas->width(), canvas->height(), depth, 0, format, type, xoffset, yoffset, zoffset)) return; bool selecting_sub_rectangle = false; if (!ValidateTexImageSubRectangle( func_name, function_id, canvas, source_sub_rectangle, depth, unpack_image_height, &selecting_sub_rectangle)) { return; } if (function_id == kTexImage2D || function_id == kTexSubImage2D) { if (!canvas->IsAccelerated() || !CanUseTexImageByGPU(format, type)) { TexImageImpl(function_id, target, level, internalformat, xoffset, yoffset, zoffset, format, type, canvas ->CopiedImage(kBackBuffer, kPreferAcceleration, FunctionIDToSnapshotReason(function_id)) .get(), WebGLImageConversion::kHtmlDomCanvas, unpack_flip_y_, unpack_premultiply_alpha_, source_sub_rectangle, 1, 0); return; } IntRect adjusted_source_sub_rectangle = source_sub_rectangle; if (!unpack_flip_y_) { adjusted_source_sub_rectangle.SetY(canvas->height() - adjusted_source_sub_rectangle.MaxY()); } if (function_id == kTexImage2D) { TexImage2DBase(target, level, internalformat, source_sub_rectangle.Width(), source_sub_rectangle.Height(), 0, format, type, nullptr); TexImageByGPU(function_id, texture, target, level, 0, 0, 0, canvas, adjusted_source_sub_rectangle); } else { TexImageByGPU(function_id, texture, target, level, xoffset, yoffset, 0, canvas, adjusted_source_sub_rectangle); } } else { TexImageImpl(function_id, target, level, internalformat, xoffset, yoffset, zoffset, format, type, canvas ->CopiedImage(kBackBuffer, kPreferAcceleration, FunctionIDToSnapshotReason(function_id)) .get(), WebGLImageConversion::kHtmlDomCanvas, unpack_flip_y_, unpack_premultiply_alpha_, source_sub_rectangle, depth, unpack_image_height); } } ",0 "DOMWindow* CreateWindow(const String& url_string, const AtomicString& frame_name, const String& window_features_string, LocalDOMWindow& calling_window, LocalFrame& first_frame, LocalFrame& opener_frame, ExceptionState& exception_state) { LocalFrame* active_frame = calling_window.GetFrame(); DCHECK(active_frame); KURL completed_url = url_string.IsEmpty() ? KURL(kParsedURLString, g_empty_string) : first_frame.GetDocument()->CompleteURL(url_string); if (!completed_url.IsEmpty() && !completed_url.IsValid()) { UseCounter::Count(active_frame, WebFeature::kWindowOpenWithInvalidURL); exception_state.ThrowDOMException( kSyntaxError, ""Unable to open a window with invalid URL '"" + completed_url.GetString() + ""'.\n""); return nullptr; } WebWindowFeatures window_features = GetWindowFeaturesFromString(window_features_string); FrameLoadRequest frame_request(calling_window.document(), ResourceRequest(completed_url), frame_name); frame_request.SetShouldSetOpener(window_features.noopener ? kNeverSetOpener : kMaybeSetOpener); frame_request.GetResourceRequest().SetFrameType( WebURLRequest::kFrameTypeAuxiliary); frame_request.GetResourceRequest().SetRequestorOrigin( SecurityOrigin::Create(active_frame->GetDocument()->Url())); frame_request.GetResourceRequest().SetHTTPReferrer( SecurityPolicy::GenerateReferrer( active_frame->GetDocument()->GetReferrerPolicy(), completed_url, active_frame->GetDocument()->OutgoingReferrer())); bool has_user_gesture = UserGestureIndicator::ProcessingUserGesture(); bool created; Frame* new_frame = CreateWindowHelper( opener_frame, *active_frame, opener_frame, frame_request, window_features, kNavigationPolicyIgnore, created); if (!new_frame) return nullptr; if (new_frame->DomWindow()->IsInsecureScriptAccess(calling_window, completed_url)) return window_features.noopener ? nullptr : new_frame->DomWindow(); if (created) { FrameLoadRequest request(calling_window.document(), ResourceRequest(completed_url)); request.GetResourceRequest().SetHasUserGesture(has_user_gesture); new_frame->Navigate(request); } else if (!url_string.IsEmpty()) { new_frame->Navigate(*calling_window.document(), completed_url, false, has_user_gesture ? UserGestureStatus::kActive : UserGestureStatus::kNone); } return window_features.noopener ? nullptr : new_frame->DomWindow(); } ",1 "blink::mojom::CommitResult RenderFrameImpl::PrepareForHistoryNavigationCommit( FrameMsg_Navigate_Type::Value navigation_type, const RequestNavigationParams& request_params, WebHistoryItem* item_for_history_navigation, blink::WebFrameLoadType* load_type) { DCHECK(navigation_type == FrameMsg_Navigate_Type::HISTORY_SAME_DOCUMENT || navigation_type == FrameMsg_Navigate_Type::HISTORY_DIFFERENT_DOCUMENT || navigation_type == FrameMsg_Navigate_Type::RESTORE || navigation_type == FrameMsg_Navigate_Type::RESTORE_WITH_POST); std::unique_ptr entry = PageStateToHistoryEntry(request_params.page_state); if (!entry) return blink::mojom::CommitResult::Aborted; *item_for_history_navigation = entry->root(); *load_type = blink::WebFrameLoadType::kBackForward; history_subframe_unique_names_ = request_params.subframe_unique_names; if (navigation_type == FrameMsg_Navigate_Type::HISTORY_SAME_DOCUMENT) { if (current_history_item_.IsNull()) { NOTREACHED(); return blink::mojom::CommitResult::RestartCrossDocument; } if (current_history_item_.DocumentSequenceNumber() != item_for_history_navigation->DocumentSequenceNumber()) { return blink::mojom::CommitResult::RestartCrossDocument; } } bool interrupted_by_client_redirect = frame_->IsNavigationScheduledWithin(0) || frame_->GetProvisionalDocumentLoader() || !current_history_item_.IsNull(); if (request_params.is_history_navigation_in_new_child && interrupted_by_client_redirect) { return blink::mojom::CommitResult::Aborted; } return blink::mojom::CommitResult::Ok; } ",0 "void print_vma_addr(char *prefix, unsigned long ip) { struct mm_struct *mm = current->mm; struct vm_area_struct *vma; /* * Do not print if we are in atomic * contexts (in exception stacks, etc.): */ if (preempt_count()) return; down_read(&mm->mmap_sem); vma = find_vma(mm, ip); if (vma && vma->vm_file) { struct file *f = vma->vm_file; char *buf = (char *)__get_free_page(GFP_KERNEL); if (buf) { char *p; p = file_path(f, buf, PAGE_SIZE); if (IS_ERR(p)) p = ""?""; printk(""%s%s[%lx+%lx]"", prefix, kbasename(p), vma->vm_start, vma->vm_end - vma->vm_start); free_page((unsigned long)buf); } } up_read(&mm->mmap_sem); } ",0 "void WebGL2RenderingContextBase::drawBuffers(const Vector& buffers) { if (isContextLost()) return; ScopedRGBEmulationColorMask emulation_color_mask(this, color_mask_, drawing_buffer_.Get()); GLsizei n = buffers.size(); const GLenum* bufs = buffers.data(); for (GLsizei i = 0; i < n; ++i) { switch (bufs[i]) { case GL_NONE: case GL_BACK: case GL_COLOR_ATTACHMENT0: break; default: if (bufs[i] > GL_COLOR_ATTACHMENT0 && bufs[i] < static_cast(GL_COLOR_ATTACHMENT0 + MaxColorAttachments())) break; SynthesizeGLError(GL_INVALID_ENUM, ""drawBuffers"", ""invalid buffer""); return; } } if (!framebuffer_binding_) { if (n != 1) { SynthesizeGLError(GL_INVALID_OPERATION, ""drawBuffers"", ""the number of buffers is not 1""); return; } if (bufs[0] != GL_BACK && bufs[0] != GL_NONE) { SynthesizeGLError(GL_INVALID_OPERATION, ""drawBuffers"", ""BACK or NONE""); return; } GLenum value = (bufs[0] == GL_BACK) ? GL_COLOR_ATTACHMENT0 : GL_NONE; ContextGL()->DrawBuffersEXT(1, &value); SetBackDrawBuffer(bufs[0]); } else { if (n > MaxDrawBuffers()) { SynthesizeGLError(GL_INVALID_VALUE, ""drawBuffers"", ""more than max draw buffers""); return; } for (GLsizei i = 0; i < n; ++i) { if (bufs[i] != GL_NONE && bufs[i] != static_cast(GL_COLOR_ATTACHMENT0_EXT + i)) { SynthesizeGLError(GL_INVALID_OPERATION, ""drawBuffers"", ""COLOR_ATTACHMENTi_EXT or NONE""); return; } } framebuffer_binding_->DrawBuffers(buffers); } } ",0 "static void fr_lmi_send(struct net_device *dev, int fullrep) { hdlc_device *hdlc = dev_to_hdlc(dev); struct sk_buff *skb; pvc_device *pvc = state(hdlc)->first_pvc; int lmi = state(hdlc)->settings.lmi; int dce = state(hdlc)->settings.dce; int len = lmi == LMI_ANSI ? LMI_ANSI_LENGTH : LMI_CCITT_CISCO_LENGTH; int stat_len = (lmi == LMI_CISCO) ? 6 : 3; u8 *data; int i = 0; if (dce && fullrep) { len += state(hdlc)->dce_pvc_count * (2 + stat_len); if (len > HDLC_MAX_MRU) { netdev_warn(dev, ""Too many PVCs while sending LMI full report\n""); return; } } skb = dev_alloc_skb(len); if (!skb) { netdev_warn(dev, ""Memory squeeze on fr_lmi_send()\n""); return; } memset(skb->data, 0, len); skb_reserve(skb, 4); if (lmi == LMI_CISCO) { skb->protocol = cpu_to_be16(NLPID_CISCO_LMI); fr_hard_header(&skb, LMI_CISCO_DLCI); } else { skb->protocol = cpu_to_be16(NLPID_CCITT_ANSI_LMI); fr_hard_header(&skb, LMI_CCITT_ANSI_DLCI); } data = skb_tail_pointer(skb); data[i++] = LMI_CALLREF; data[i++] = dce ? LMI_STATUS : LMI_STATUS_ENQUIRY; if (lmi == LMI_ANSI) data[i++] = LMI_ANSI_LOCKSHIFT; data[i++] = lmi == LMI_CCITT ? LMI_CCITT_REPTYPE : LMI_ANSI_CISCO_REPTYPE; data[i++] = LMI_REPT_LEN; data[i++] = fullrep ? LMI_FULLREP : LMI_INTEGRITY; data[i++] = lmi == LMI_CCITT ? LMI_CCITT_ALIVE : LMI_ANSI_CISCO_ALIVE; data[i++] = LMI_INTEG_LEN; data[i++] = state(hdlc)->txseq = fr_lmi_nextseq(state(hdlc)->txseq); data[i++] = state(hdlc)->rxseq; if (dce && fullrep) { while (pvc) { data[i++] = lmi == LMI_CCITT ? LMI_CCITT_PVCSTAT : LMI_ANSI_CISCO_PVCSTAT; data[i++] = stat_len; /* LMI start/restart */ if (state(hdlc)->reliable && !pvc->state.exist) { pvc->state.exist = pvc->state.new = 1; fr_log_dlci_active(pvc); } /* ifconfig PVC up */ if (pvc->open_count && !pvc->state.active && pvc->state.exist && !pvc->state.new) { pvc_carrier(1, pvc); pvc->state.active = 1; fr_log_dlci_active(pvc); } if (lmi == LMI_CISCO) { data[i] = pvc->dlci >> 8; data[i + 1] = pvc->dlci & 0xFF; } else { data[i] = (pvc->dlci >> 4) & 0x3F; data[i + 1] = ((pvc->dlci << 3) & 0x78) | 0x80; data[i + 2] = 0x80; } if (pvc->state.new) data[i + 2] |= 0x08; else if (pvc->state.active) data[i + 2] |= 0x02; i += stat_len; pvc = pvc->next; } } skb_put(skb, i); skb->priority = TC_PRIO_CONTROL; skb->dev = dev; skb_reset_network_header(skb); dev_queue_xmit(skb); } ",0 "ext4_xattr_set_entry(struct ext4_xattr_info *i, struct ext4_xattr_search *s) { struct ext4_xattr_entry *last; size_t free, min_offs = s->end - s->base, name_len = strlen(i->name); /* Compute min_offs and last. */ last = s->first; for (; !IS_LAST_ENTRY(last); last = EXT4_XATTR_NEXT(last)) { if (!last->e_value_block && last->e_value_size) { size_t offs = le16_to_cpu(last->e_value_offs); if (offs < min_offs) min_offs = offs; } } free = min_offs - ((void *)last - s->base) - sizeof(__u32); if (!s->not_found) { if (!s->here->e_value_block && s->here->e_value_size) { size_t size = le32_to_cpu(s->here->e_value_size); free += EXT4_XATTR_SIZE(size); } free += EXT4_XATTR_LEN(name_len); } if (i->value) { if (free < EXT4_XATTR_LEN(name_len) + EXT4_XATTR_SIZE(i->value_len)) return -ENOSPC; } if (i->value && s->not_found) { /* Insert the new name. */ size_t size = EXT4_XATTR_LEN(name_len); size_t rest = (void *)last - (void *)s->here + sizeof(__u32); memmove((void *)s->here + size, s->here, rest); memset(s->here, 0, size); s->here->e_name_index = i->name_index; s->here->e_name_len = name_len; memcpy(s->here->e_name, i->name, name_len); } else { if (!s->here->e_value_block && s->here->e_value_size) { void *first_val = s->base + min_offs; size_t offs = le16_to_cpu(s->here->e_value_offs); void *val = s->base + offs; size_t size = EXT4_XATTR_SIZE( le32_to_cpu(s->here->e_value_size)); if (i->value && size == EXT4_XATTR_SIZE(i->value_len)) { /* The old and the new value have the same size. Just replace. */ s->here->e_value_size = cpu_to_le32(i->value_len); if (i->value == EXT4_ZERO_XATTR_VALUE) { memset(val, 0, size); } else { /* Clear pad bytes first. */ memset(val + size - EXT4_XATTR_PAD, 0, EXT4_XATTR_PAD); memcpy(val, i->value, i->value_len); } return 0; } /* Remove the old value. */ memmove(first_val + size, first_val, val - first_val); memset(first_val, 0, size); s->here->e_value_size = 0; s->here->e_value_offs = 0; min_offs += size; /* Adjust all value offsets. */ last = s->first; while (!IS_LAST_ENTRY(last)) { size_t o = le16_to_cpu(last->e_value_offs); if (!last->e_value_block && last->e_value_size && o < offs) last->e_value_offs = cpu_to_le16(o + size); last = EXT4_XATTR_NEXT(last); } } if (!i->value) { /* Remove the old name. */ size_t size = EXT4_XATTR_LEN(name_len); last = ENTRY((void *)last - size); memmove(s->here, (void *)s->here + size, (void *)last - (void *)s->here + sizeof(__u32)); memset(last, 0, size); } } if (i->value) { /* Insert the new value. */ s->here->e_value_size = cpu_to_le32(i->value_len); if (i->value_len) { size_t size = EXT4_XATTR_SIZE(i->value_len); void *val = s->base + min_offs - size; s->here->e_value_offs = cpu_to_le16(min_offs - size); if (i->value == EXT4_ZERO_XATTR_VALUE) { memset(val, 0, size); } else { /* Clear the pad bytes first. */ memset(val + size - EXT4_XATTR_PAD, 0, EXT4_XATTR_PAD); memcpy(val, i->value, i->value_len); } } } return 0; } ",0 "void Editor::Paste(EditorCommandSource source) { DCHECK(GetFrame().GetDocument()); if (TryDHTMLPaste(kAllMimeTypes)) return; // DHTML did the whole operation if (!CanPaste()) return; GetFrame().GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets(); if (source == kCommandFromMenuOrKeyBinding && !GetFrame().Selection().SelectionHasFocus()) return; GetSpellChecker().UpdateMarkersForWordsAffectedByEditing(false); ResourceFetcher* loader = GetFrame().GetDocument()->Fetcher(); ResourceCacheValidationSuppressor validation_suppressor(loader); PasteMode paste_mode = GetFrame() .Selection() .ComputeVisibleSelectionInDOMTree() .IsContentRichlyEditable() ? kAllMimeTypes : kPlainTextOnly; if (source == kCommandFromMenuOrKeyBinding) { DataTransfer* data_transfer = DataTransfer::Create(DataTransfer::kCopyAndPaste, kDataTransferReadable, DataObject::CreateFromPasteboard(paste_mode)); if (DispatchBeforeInputDataTransfer(FindEventTargetFromSelection(), InputEvent::InputType::kInsertFromPaste, data_transfer) != DispatchEventResult::kNotCanceled) return; if (frame_->GetDocument()->GetFrame() != frame_) return; } if (paste_mode == kAllMimeTypes) PasteWithPasteboard(Pasteboard::GeneralPasteboard()); else PasteAsPlainTextWithPasteboard(Pasteboard::GeneralPasteboard()); } ",0 "static void ati_remote2_complete_key(struct urb *urb) { struct ati_remote2 *ar2 = urb->context; int r; switch (urb->status) { case 0: usb_mark_last_busy(ar2->udev); ati_remote2_input_key(ar2); break; case -ENOENT: case -EILSEQ: case -ECONNRESET: case -ESHUTDOWN: dev_dbg(&ar2->intf[1]->dev, ""%s(): urb status = %d\n"", __func__, urb->status); return; default: usb_mark_last_busy(ar2->udev); dev_err(&ar2->intf[1]->dev, ""%s(): urb status = %d\n"", __func__, urb->status); } r = usb_submit_urb(urb, GFP_ATOMIC); if (r) dev_err(&ar2->intf[1]->dev, ""%s(): usb_submit_urb() = %d\n"", __func__, r); } ",0 "void BackendImpl::TrimForTest(bool empty) { eviction_.SetTestMode(); eviction_.TrimCache(empty); } ",0 "static void flush_buffer (void) { DEBUG (""network plugin: flush_buffer: send_buffer_fill = %i"", send_buffer_fill); network_send_buffer (send_buffer, (size_t) send_buffer_fill); stats_octets_tx += ((uint64_t) send_buffer_fill); stats_packets_tx++; network_init_buffer (); } ",0 "void GDataFileSystem::GetFileByResourceIdOnUIThread( const std::string& resource_id, const GetFileCallback& get_file_callback, const GetDownloadDataCallback& get_download_data_callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); directory_service_->GetEntryByResourceIdAsync(resource_id, base::Bind(&GDataFileSystem::GetFileByEntryOnUIThread, ui_weak_ptr_, get_file_callback, get_download_data_callback)); } ",0 "void PushMessagingServiceImpl::OnContentSettingChanged( const ContentSettingsPattern& primary_pattern, const ContentSettingsPattern& secondary_pattern, ContentSettingsType content_type, std::string resource_identifier) { if (content_type != CONTENT_SETTINGS_TYPE_NOTIFICATIONS) return; std::vector all_app_identifiers = PushMessagingAppIdentifier::GetAll(profile_); base::Closure barrier_closure = base::BarrierClosure( all_app_identifiers.size(), content_setting_changed_callback_for_testing_.is_null() ? base::Bind(&base::DoNothing) : content_setting_changed_callback_for_testing_); for (const PushMessagingAppIdentifier& app_identifier : all_app_identifiers) { if (primary_pattern.IsValid() && !primary_pattern.Matches(app_identifier.origin())) { barrier_closure.Run(); continue; } if (IsPermissionSet(app_identifier.origin())) { barrier_closure.Run(); continue; } bool need_sender_id = false; #if defined(OS_ANDROID) need_sender_id = !PushMessagingAppIdentifier::UseInstanceID(app_identifier.app_id()); #endif if (need_sender_id) { GetSenderId( profile_, app_identifier.origin(), app_identifier.service_worker_registration_id(), base::Bind( &PushMessagingServiceImpl::UnsubscribeBecausePermissionRevoked, weak_factory_.GetWeakPtr(), app_identifier, base::Bind(&UnregisterCallbackToClosure, barrier_closure))); } else { UnsubscribeInternal( content::mojom::PushUnregistrationReason::PERMISSION_REVOKED, app_identifier.origin(), app_identifier.service_worker_registration_id(), app_identifier.app_id(), std::string() /* sender_id */, base::Bind(&UnregisterCallbackToClosure, barrier_closure)); } } } ",0 "static struct rtable *__rt_cache_get_next(struct seq_file *seq, struct rtable *r) { struct rt_cache_iter_state *st = seq->private; r = rcu_dereference_bh(r->dst.rt_next); while (!r) { rcu_read_unlock_bh(); do { if (--st->bucket < 0) return NULL; } while (!rcu_dereference_raw(rt_hash_table[st->bucket].chain)); rcu_read_lock_bh(); r = rcu_dereference_bh(rt_hash_table[st->bucket].chain); } return r; } ",0 "int blk_rq_prep_clone(struct request *rq, struct request *rq_src, struct bio_set *bs, gfp_t gfp_mask, int (*bio_ctr)(struct bio *, struct bio *, void *), void *data) { struct bio *bio, *bio_src; if (!bs) bs = &fs_bio_set; __rq_for_each_bio(bio_src, rq_src) { bio = bio_clone_fast(bio_src, gfp_mask, bs); if (!bio) goto free_and_out; if (bio_ctr && bio_ctr(bio, bio_src, data)) goto free_and_out; if (rq->bio) { rq->biotail->bi_next = bio; rq->biotail = bio; } else rq->bio = rq->biotail = bio; } __blk_rq_prep_clone(rq, rq_src); return 0; free_and_out: if (bio) bio_put(bio); blk_rq_unprep_clone(rq); return -ENOMEM; } ",0 "void PictureLayerImpl::UpdateTilePriorities( const Occlusion& occlusion_in_content_space) { DCHECK_IMPLIES(raster_source_->IsSolidColor(), tilings_->num_tilings() == 0); double current_frame_time_in_seconds = (layer_tree_impl()->CurrentBeginFrameArgs().frame_time - base::TimeTicks()).InSecondsF(); gfx::Rect viewport_rect_in_layer_space = GetViewportForTilePriorityInContentSpace(); bool can_require_tiles_for_activation = !only_used_low_res_last_append_quads_ || RequiresHighResToDraw() || !layer_tree_impl()->SmoothnessTakesPriority(); bool updated = tilings_->UpdateTilePriorities( viewport_rect_in_layer_space, ideal_contents_scale_, current_frame_time_in_seconds, occlusion_in_content_space, can_require_tiles_for_activation); if (updated) layer_tree_impl()->DidModifyTilePriorities(); } ",0 "bool HTMLCanvasElement::IsOpaque() const { return context_ && !context_->CreationAttributes().alpha; } ",0 "GamepadProvider::ClosureAndThread::ClosureAndThread( const base::Closure& c, const scoped_refptr& m) : closure(c), task_runner(m) {} ",0 "static loff_t ext3_max_size(int bits) { loff_t res = EXT3_NDIR_BLOCKS; int meta_blocks; loff_t upper_limit; /* This is calculated to be the largest file size for a * dense, file such that the total number of * sectors in the file, including data and all indirect blocks, * does not exceed 2^32 -1 * __u32 i_blocks representing the total number of * 512 bytes blocks of the file */ upper_limit = (1LL << 32) - 1; /* total blocks in file system block size */ upper_limit >>= (bits - 9); /* indirect blocks */ meta_blocks = 1; /* double indirect blocks */ meta_blocks += 1 + (1LL << (bits-2)); /* tripple indirect blocks */ meta_blocks += 1 + (1LL << (bits-2)) + (1LL << (2*(bits-2))); upper_limit -= meta_blocks; upper_limit <<= bits; res += 1LL << (bits-2); res += 1LL << (2*(bits-2)); res += 1LL << (3*(bits-2)); res <<= bits; if (res > upper_limit) res = upper_limit; if (res > MAX_LFS_FILESIZE) res = MAX_LFS_FILESIZE; return res; } ",0 "JsVar *jslNewStringFromLexer(JslCharPos *charFrom, size_t charTo) { size_t maxLength = charTo + 1 - jsvStringIteratorGetIndex(&charFrom->it); assert(maxLength>0); // will fail if 0 JsVar *var = 0; if (maxLength > JSV_FLAT_STRING_BREAK_EVEN) { var = jsvNewFlatStringOfLength((unsigned int)maxLength); if (var) { char *flatPtr = jsvGetFlatStringPointer(var); *(flatPtr++) = charFrom->currCh; JsvStringIterator it = jsvStringIteratorClone(&charFrom->it); while (jsvStringIteratorHasChar(&it) && (--maxLength>0)) { *(flatPtr++) = jsvStringIteratorGetChar(&it); jsvStringIteratorNext(&it); } jsvStringIteratorFree(&it); return var; } } var = jsvNewFromEmptyString(); if (!var) { // out of memory return 0; } JsVar *block = jsvLockAgain(var); block->varData.str[0] = charFrom->currCh; size_t blockChars = 1; size_t l = maxLength; JsvStringIterator it = jsvStringIteratorClone(&charFrom->it); while (jsvStringIteratorHasChar(&it) && (--maxLength>0)) { char ch = jsvStringIteratorGetChar(&it); if (blockChars >= jsvGetMaxCharactersInVar(block)) { jsvSetCharactersInVar(block, blockChars); JsVar *next = jsvNewWithFlags(JSV_STRING_EXT_0); if (!next) break; // out of memory jsvSetLastChild(block, jsvGetRef(next)); jsvUnLock(block); block = next; blockChars=0; // it's new, so empty } block->varData.str[blockChars++] = ch; jsvStringIteratorNext(&it); } jsvSetCharactersInVar(block, blockChars); jsvUnLock(block); assert((l == jsvGetStringLength(var)) || (jsErrorFlags&JSERR_MEMORY) || !jsvStringIteratorHasChar(&it)); jsvStringIteratorFree(&it); return var; } ",0 "void PrintViewManagerBase::DidStartLoading() { UpdatePrintingEnabled(); } ",0 "CanvasSurfaceLayerBridgeClientImpl::CanvasSurfaceLayerBridgeClientImpl() { DCHECK(!m_service.is_bound()); Platform::current()->interfaceProvider()->getInterface(mojo::GetProxy(&m_service)); } ",0 "static void emulator_set_segment(struct x86_emulate_ctxt *ctxt, u16 selector, struct desc_struct *desc, u32 base3, int seg) { struct kvm_vcpu *vcpu = emul_to_vcpu(ctxt); struct kvm_segment var; var.selector = selector; var.base = get_desc_base(desc); #ifdef CONFIG_X86_64 var.base |= ((u64)base3) << 32; #endif var.limit = get_desc_limit(desc); if (desc->g) var.limit = (var.limit << 12) | 0xfff; var.type = desc->type; var.dpl = desc->dpl; var.db = desc->d; var.s = desc->s; var.l = desc->l; var.g = desc->g; var.avl = desc->avl; var.present = desc->p; var.unusable = !var.present; var.padding = 0; kvm_set_segment(vcpu, &var, seg); return; } ",0 "static void DecrementUntilZero(int* count) { (*count)--; if (!(*count)) base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::RunLoop::QuitCurrentWhenIdleClosureDeprecated()); } ",1 "void HTMLMediaElement::AttachLayoutTree(AttachContext& context) { HTMLElement::AttachLayoutTree(context); if (GetLayoutObject()) GetLayoutObject()->UpdateFromElement(); } ",0 "static void readpng2_end_callback(png_structp png_ptr, png_infop info_ptr) { mainprog_info *mainprog_ptr; /* retrieve the pointer to our special-purpose struct */ mainprog_ptr = png_get_progressive_ptr(png_ptr); /* let the main program know that it should flush any buffered image * data to the display now and set a ""done"" flag or whatever, but note * that it SHOULD NOT DESTROY THE PNG STRUCTS YET--in other words, do * NOT call readpng2_cleanup() either here or in the finish_display() * routine; wait until control returns to the main program via * readpng2_decode_data() */ (*mainprog_ptr->mainprog_finish_display)(); /* all done */ return; } ",1 "bool ConvertJSONToPoint(const std::string& str, gfx::PointF* point) { std::unique_ptr value = base::JSONReader::Read(str); if (!value) return false; base::DictionaryValue* root; if (!value->GetAsDictionary(&root)) return false; double x, y; if (!root->GetDouble(""x"", &x)) return false; if (!root->GetDouble(""y"", &y)) return false; point->set_x(x); point->set_y(y); return true; } ",0 "void OxideQQuickWebView::setPopupMenu(QQmlComponent* popupMenu) { Q_D(OxideQQuickWebView); if (d->contents_view_->popupMenu() == popupMenu) { return; } d->contents_view_->setPopupMenu(popupMenu); emit popupMenuChanged(); } ",0 "bool ShelfLayoutManager::CanStartFullscreenAppListDrag( float scroll_y_hint) const { if (!shelf_->IsHorizontalAlignment()) return false; if (!IsVisible()) return false; if (shelf_widget_->IsShowingOverflowBubble()) return false; if (is_app_list_visible_) return false; if (scroll_y_hint >= 0) return false; if (IsHomeLauncherEnabledInTabletMode()) return false; return true; } ",0 "pkinit_init_kdc_req_context(krb5_context context, pkinit_kdc_req_context *ctx) { krb5_error_code retval = ENOMEM; pkinit_kdc_req_context reqctx = NULL; reqctx = malloc(sizeof(*reqctx)); if (reqctx == NULL) return retval; memset(reqctx, 0, sizeof(*reqctx)); reqctx->magic = PKINIT_CTX_MAGIC; retval = pkinit_init_req_crypto(&reqctx->cryptoctx); if (retval) goto cleanup; reqctx->rcv_auth_pack = NULL; reqctx->rcv_auth_pack9 = NULL; pkiDebug(""%s: returning reqctx at %p\n"", __FUNCTION__, reqctx); *ctx = reqctx; retval = 0; cleanup: if (retval) pkinit_fini_kdc_req_context(context, reqctx); return retval; } ",0 "void ParamTraits::Write(Message* m, const param_type& p) { m->WriteData(reinterpret_cast(&p), sizeof(param_type)); } ",0 "void WallpaperManager::Open() { if (wallpaper_manager_util::ShouldUseAndroidWallpapersApp( ProfileHelper::Get()->GetProfileByUser( user_manager::UserManager::Get()->GetActiveUser())) && !ash_util::IsRunningInMash()) { activation_client_observer_.Add(ash::Shell::Get()->activation_client()); } wallpaper_manager_util::OpenWallpaperManager(); } ",0 "GtkWidget* AddMenuEntry(GtkWidget* menu_widget, const char* text, GCallback callback, Shell* shell) { GtkWidget* entry = gtk_menu_item_new_with_label(text); g_signal_connect(entry, ""activate"", callback, shell); gtk_menu_shell_append(GTK_MENU_SHELL(menu_widget), entry); return entry; } ",0 "PrepopulatedPageList TopSitesImpl::GetPrepopulatedPages() { return prepopulated_pages_; } ",0 " DevToolsClient::~DevToolsClient() { } ",0 "static uintmax_t parse_mark_ref_space(const char **p) { uintmax_t mark; char *end; mark = parse_mark_ref(*p, &end); if (*end++ != ' ') die(""Missing space after mark: %s"", command_buf.buf); *p = end; return mark; } ",0 "size_t String8::length() const { return SharedBuffer::sizeFromData(mString)-1; } ",0 "static i32 ComparePictures(const void *ptr1, const void *ptr2) { /* Variables */ dpbPicture_t *pic1, *pic2; /* Code */ ASSERT(ptr1); ASSERT(ptr2); pic1 = (dpbPicture_t*)ptr1; pic2 = (dpbPicture_t*)ptr2; /* both are non-reference pictures, check if needed for display */ if (!IS_REFERENCE(*pic1) && !IS_REFERENCE(*pic2)) { if (pic1->toBeDisplayed && !pic2->toBeDisplayed) return(-1); else if (!pic1->toBeDisplayed && pic2->toBeDisplayed) return(1); else return(0); } /* only pic 1 needed for reference -> greater */ else if (!IS_REFERENCE(*pic2)) return(-1); /* only pic 2 needed for reference -> greater */ else if (!IS_REFERENCE(*pic1)) return(1); /* both are short term reference pictures -> check picNum */ else if (IS_SHORT_TERM(*pic1) && IS_SHORT_TERM(*pic2)) { if (pic1->picNum > pic2->picNum) return(-1); else if (pic1->picNum < pic2->picNum) return(1); else return(0); } /* only pic 1 is short term -> greater */ else if (IS_SHORT_TERM(*pic1)) return(-1); /* only pic 2 is short term -> greater */ else if (IS_SHORT_TERM(*pic2)) return(1); /* both are long term reference pictures -> check picNum (contains the * longTermPicNum */ else { if (pic1->picNum > pic2->picNum) return(1); else if (pic1->picNum < pic2->picNum) return(-1); else return(0); } } ",0 "on_fileselector_done(void *user_data, Evas_Object *file_selector, void *event_info) { FileSelectorData *fs_data = (FileSelectorData *)user_data; const char *selected = (const char *)event_info; if (selected && *selected) ewk_file_chooser_request_file_choose(fs_data->request, selected); close_file_picker(fs_data); } ",0 "std::unique_ptr InspectorAsyncTask::Data(const String& name) { std::unique_ptr value = TracedValue::Create(); value->SetString(""name"", name); return value; } ",0 "apprentice_compile(struct magic_set *ms, struct magic_map *map, const char *fn) { static const size_t nm = sizeof(*map->nmagic) * MAGIC_SETS; static const size_t m = sizeof(**map->magic); int fd = -1; size_t len; char *dbname; int rv = -1; uint32_t i; union { struct magic m; uint32_t h[2 + MAGIC_SETS]; } hdr; dbname = mkdbname(ms, fn, 1); if (dbname == NULL) goto out; if ((fd = open(dbname, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0644)) == -1) { file_error(ms, errno, ""cannot open `%s'"", dbname); goto out; } memset(&hdr, 0, sizeof(hdr)); hdr.h[0] = MAGICNO; hdr.h[1] = VERSIONNO; memcpy(hdr.h + 2, map->nmagic, nm); if (write(fd, &hdr, sizeof(hdr)) != (ssize_t)sizeof(hdr)) { file_error(ms, errno, ""error writing `%s'"", dbname); goto out; } for (i = 0; i < MAGIC_SETS; i++) { len = m * map->nmagic[i]; if (write(fd, map->magic[i], len) != (ssize_t)len) { file_error(ms, errno, ""error writing `%s'"", dbname); goto out; } } if (fd != -1) (void)close(fd); rv = 0; out: free(dbname); return rv; } ",0 "static void mark_tree_contents_uninteresting(struct tree *tree) { struct tree_desc desc; struct name_entry entry; struct object *obj = &tree->object; if (!has_sha1_file(obj->sha1)) return; if (parse_tree(tree) < 0) die(""bad tree %s"", sha1_to_hex(obj->sha1)); init_tree_desc(&desc, tree->buffer, tree->size); while (tree_entry(&desc, &entry)) { switch (object_type(entry.mode)) { case OBJ_TREE: mark_tree_uninteresting(lookup_tree(entry.sha1)); break; case OBJ_BLOB: mark_blob_uninteresting(lookup_blob(entry.sha1)); break; default: /* Subproject commit - not in this repository */ break; } } /* * We don't care about the tree any more * after it has been marked uninteresting. */ free_tree_buffer(tree); } ",0 "static inline void hwsim_check_magic(struct ieee80211_vif *vif) { struct hwsim_vif_priv *vp = (void *)vif->drv_priv; WARN(vp->magic != HWSIM_VIF_MAGIC, ""Invalid VIF (%p) magic %#x, %pM, %d/%d\n"", vif, vp->magic, vif->addr, vif->type, vif->p2p); } ",0 "void udp_v6_clear_sk(struct sock *sk, int size) { struct inet_sock *inet = inet_sk(sk); /* we do not want to clear pinet6 field, because of RCU lookups */ sk_prot_clear_portaddr_nulls(sk, offsetof(struct inet_sock, pinet6)); size -= offsetof(struct inet_sock, pinet6) + sizeof(inet->pinet6); memset(&inet->pinet6 + 1, 0, size); } ",0 "iakerb_gss_export_sec_context(OM_uint32 *minor_status, gss_ctx_id_t *context_handle, gss_buffer_t interprocess_token) { OM_uint32 maj; iakerb_ctx_id_t ctx = (iakerb_ctx_id_t)context_handle; /* We don't currently support exporting partially established contexts. */ if (!ctx->established) return GSS_S_UNAVAILABLE; maj = krb5_gss_export_sec_context(minor_status, &ctx->gssc, interprocess_token); if (ctx->gssc == GSS_C_NO_CONTEXT) { iakerb_release_context(ctx); *context_handle = GSS_C_NO_CONTEXT; } return maj; } ",1 "gp_bgr8(Pixel *p, png_const_voidp pb) { png_const_bytep pp = voidcast(png_const_bytep, pb); p->r = pp[2]; p->g = pp[1]; p->b = pp[0]; p->a = 255; } ",0 "Eina_Bool ewk_frame_visible_content_geometry_get(const Evas_Object* ewkFrame, Eina_Bool includeScrollbars, int* x, int* y, int* width, int* height) { if (x) *x = 0; if (y) *y = 0; if (width) *width = 0; if (height) *height = 0; EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData, false); EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->frame, false); EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->frame->view(), false); WebCore::IntRect rect = smartData->frame->view()->visibleContentRect(includeScrollbars); if (x) *x = rect.x(); if (y) *y = rect.y(); if (width) *width = rect.width(); if (height) *height = rect.height(); return true; } ",0 "static int event_function(void *info) { struct event_function_struct *efs = info; struct perf_event *event = efs->event; struct perf_event_context *ctx = event->ctx; struct perf_cpu_context *cpuctx = __get_cpu_context(ctx); struct perf_event_context *task_ctx = cpuctx->task_ctx; int ret = 0; WARN_ON_ONCE(!irqs_disabled()); perf_ctx_lock(cpuctx, task_ctx); /* * Since we do the IPI call without holding ctx->lock things can have * changed, double check we hit the task we set out to hit. */ if (ctx->task) { if (ctx->task != current) { ret = -ESRCH; goto unlock; } /* * We only use event_function_call() on established contexts, * and event_function() is only ever called when active (or * rather, we'll have bailed in task_function_call() or the * above ctx->task != current test), therefore we must have * ctx->is_active here. */ WARN_ON_ONCE(!ctx->is_active); /* * And since we have ctx->is_active, cpuctx->task_ctx must * match. */ WARN_ON_ONCE(task_ctx != ctx); } else { WARN_ON_ONCE(&cpuctx->ctx != ctx); } efs->func(event, cpuctx, ctx, efs->data); unlock: perf_ctx_unlock(cpuctx, task_ctx); return ret; } ",0 "FilePath GDataCache::GetCacheDirectoryPath( CacheSubDirectoryType sub_dir_type) const { DCHECK_LE(0, sub_dir_type); DCHECK_GT(NUM_CACHE_TYPES, sub_dir_type); return cache_paths_[sub_dir_type]; } ",0 " static int get_core_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg) { /* * Because the kvm_regs structure is a mix of 32, 64 and * 128bit fields, we index it as if it was a 32bit * array. Hence below, nr_regs is the number of entries, and * off the index in the ""array"". */ __u32 __user *uaddr = (__u32 __user *)(unsigned long)reg->addr; struct kvm_regs *regs = vcpu_gp_regs(vcpu); int nr_regs = sizeof(*regs) / sizeof(__u32); u32 off; /* Our ID is an index into the kvm_regs struct. */ off = core_reg_offset_from_id(reg->id); if (off >= nr_regs || (off + (KVM_REG_SIZE(reg->id) / sizeof(__u32))) >= nr_regs) return -ENOENT; if (copy_to_user(uaddr, ((u32 *)regs) + off, KVM_REG_SIZE(reg->id))) return -EFAULT; return 0; } ",1 "const char* SQLiteDatabase::LastErrorMsg() { if (db_) return sqlite3_errmsg(db_); return open_error_message_.IsNull() ? kNotOpenErrorMessage : open_error_message_.data(); } ",0 "int regs_query_register_offset(const char *name) { unsigned long offset; if (!name || *name != 'r') return -EINVAL; if (kstrtoul(name + 1, 10, &offset)) return -EINVAL; if (offset >= NUM_GPRS) return -EINVAL; return offset; } ",0 "static int fmt_mp_to_sp(const struct v4l2_format *f_mp, struct v4l2_format *f_sp) { const struct v4l2_pix_format_mplane *pix_mp = &f_mp->fmt.pix_mp; struct v4l2_pix_format *pix = &f_sp->fmt.pix; if (f_mp->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) f_sp->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; else if (f_mp->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) f_sp->type = V4L2_BUF_TYPE_VIDEO_OUTPUT; else return -EINVAL; pix->width = pix_mp->width; pix->height = pix_mp->height; pix->pixelformat = pix_mp->pixelformat; pix->field = pix_mp->field; pix->colorspace = pix_mp->colorspace; pix->sizeimage = pix_mp->plane_fmt[0].sizeimage; pix->bytesperline = pix_mp->plane_fmt[0].bytesperline; return 0; } ",0 " bool HttpAuthFilterWhitelist::IsValid(const GURL& url, HttpAuth::Target target) const { if ((target != HttpAuth::AUTH_SERVER) && (target != HttpAuth::AUTH_PROXY)) return false; if (target == HttpAuth::AUTH_PROXY) return true; return rules_.Matches(url); } ",0 "mrb_module_get(mrb_state *mrb, const char *name) { return mrb_class_get(mrb, name); } ",0 "static void phar_do_404(phar_archive_data *phar, char *fname, int fname_len, char *f404, size_t f404_len, char *entry, size_t entry_len) /* {{{ */ { sapi_header_line ctr = {0}; phar_entry_info *info; if (phar && f404_len) { info = phar_get_entry_info(phar, f404, f404_len, NULL, 1); if (info) { phar_file_action(phar, info, ""text/html"", PHAR_MIME_PHP, f404, f404_len, fname, NULL, NULL, 0); return; } } ctr.response_code = 404; ctr.line_len = sizeof(""HTTP/1.0 404 Not Found"")-1; ctr.line = ""HTTP/1.0 404 Not Found""; sapi_header_op(SAPI_HEADER_REPLACE, &ctr); sapi_send_headers(); PHPWRITE(""\n \n File Not Found\n \n \n

404 - File "", sizeof(""\n \n File Not Found\n \n \n

404 - File "") - 1); PHPWRITE(entry, entry_len); PHPWRITE("" Not Found

\n \n"", sizeof("" Not Found\n \n"") - 1); } /* }}} */ ",0 "static inline WTF::String urlSuitableForTestResult(WKURLRef fileUrl) { if (!fileUrl) return String(); WKRetainPtr schemeString = adoptWK(WKURLCopyScheme(fileUrl)); if (!isLocalFileScheme(schemeString.get())) return toWTFString(adoptWK(WKURLCopyString(fileUrl))); WTF::String urlString = toWTFString(adoptWK(WKURLCopyString(fileUrl))); const size_t indexBaseName = urlString.reverseFind(divider); return (indexBaseName == notFound) ? urlString : urlString.substring(indexBaseName + 1); } ",0 "XML_GetIdAttributeIndex(XML_Parser parser) { if (parser == NULL) return -1; return parser->m_idAttIndex; } ",0 "static int ramfs_nommu_resize(struct inode *inode, loff_t newsize, loff_t size) { int ret; /* assume a truncate from zero size is going to be for the purposes of * shared mmap */ if (size == 0) { if (unlikely(newsize >> 32)) return -EFBIG; return ramfs_nommu_expand_for_mapping(inode, newsize); } /* check that a decrease in size doesn't cut off any shared mappings */ if (newsize < size) { ret = nommu_shrink_inode_mappings(inode, size, newsize); if (ret < 0) return ret; } truncate_setsize(inode, newsize); return 0; } ",0 "static Eina_Bool _ewk_view_zoom_animator_cb(void* data) { Ewk_View_Smart_Data* smartData = static_cast(data); Evas_Coord centerX, centerY; EWK_VIEW_PRIV_GET(smartData, priv); double now = ecore_loop_time_get(); centerX = priv->animatedZoom.center.x; centerY = priv->animatedZoom.center.y; if (centerX >= smartData->view.w) centerX = smartData->view.w - 1; if (centerY >= smartData->view.h) centerY = smartData->view.h - 1; if ((now >= priv->animatedZoom.time.end) || (now < priv->animatedZoom.time.start)) { _ewk_view_zoom_animated_finish(smartData); ewk_view_zoom_set(smartData->self, priv->animatedZoom.zoom.end, centerX, centerY); smartData->api->sc.calculate(smartData->self); return false; } smartData->animated_zoom.zoom.current = _ewk_view_zoom_animated_current(priv); smartData->api->zoom_weak_set(smartData, smartData->animated_zoom.zoom.current, centerX, centerY); return true; } ",0 "vc4_wait_bo_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv) { int ret; struct drm_vc4_wait_bo *args = data; struct drm_gem_object *gem_obj; struct vc4_bo *bo; if (args->pad != 0) return -EINVAL; gem_obj = drm_gem_object_lookup(file_priv, args->handle); if (!gem_obj) { DRM_ERROR(""Failed to look up GEM BO %d\n"", args->handle); return -EINVAL; } bo = to_vc4_bo(gem_obj); ret = vc4_wait_for_seqno_ioctl_helper(dev, bo->seqno, &args->timeout_ns); drm_gem_object_unreference_unlocked(gem_obj); return ret; } ",0 "static int nfs4_proc_renew(struct nfs_client *clp, struct rpc_cred *cred) { struct rpc_message msg = { .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_RENEW], .rpc_argp = clp, .rpc_cred = cred, }; unsigned long now = jiffies; int status; status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT); if (status < 0) return status; do_renew_lease(clp, now); return 0; } ",0 "void LayerTreeHostQt::cancelPendingLayerFlush() { m_layerFlushTimer.stop(); } ",0 "pkinit_get_certs_fs(krb5_context context, pkinit_plg_crypto_context plg_cryptoctx, pkinit_req_crypto_context req_cryptoctx, pkinit_identity_opts *idopts, pkinit_identity_crypto_context id_cryptoctx, krb5_principal princ) { krb5_error_code retval = KRB5KDC_ERR_PREAUTH_FAILED; if (idopts->cert_filename == NULL) { pkiDebug(""%s: failed to get user's cert location\n"", __FUNCTION__); goto cleanup; } if (idopts->key_filename == NULL) { pkiDebug(""%s: failed to get user's private key location\n"", __FUNCTION__); goto cleanup; } retval = pkinit_load_fs_cert_and_key(context, id_cryptoctx, idopts->cert_filename, idopts->key_filename, 0); cleanup: return retval; } ",0 "static void methodWithCallbackInterfaceArgMethod(const v8::FunctionCallbackInfo& info) { if (UNLIKELY(info.Length() < 1)) { throwTypeError(ExceptionMessages::failedToExecute(""methodWithCallbackInterfaceArg"", ""TestObject"", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIsolate()); return; } TestObject* imp = V8TestObject::toNative(info.Holder()); if (info.Length() <= 0 || !info[0]->IsFunction()) { throwTypeError(ExceptionMessages::failedToExecute(""methodWithCallbackInterfaceArg"", ""TestObject"", ""The callback provided as parameter 1 is not a function.""), info.GetIsolate()); return; } OwnPtr callbackInterface = V8TestCallbackInterface::create(v8::Handle::Cast(info[0]), currentExecutionContext(info.GetIsolate())); imp->methodWithCallbackInterfaceArg(callbackInterface.release()); } ",0 "const char* LocalFileSystem::supplementName() { return ""LocalFileSystem""; } ",0 "static int perf_event_idx_default(struct perf_event *event) { return 0; } ",0 "static unsigned long *gfn_to_rmap(struct kvm *kvm, gfn_t gfn, int level) { struct kvm_memory_slot *slot; slot = gfn_to_memslot(kvm, gfn); return __gfn_to_rmap(gfn, level, slot); } ",0 "int open_for_data(struct cdrom_device_info *cdi) { int ret; const struct cdrom_device_ops *cdo = cdi->ops; tracktype tracks; cd_dbg(CD_OPEN, ""entering open_for_data\n""); /* Check if the driver can report drive status. If it can, we can do clever things. If it can't, well, we at least tried! */ if (cdo->drive_status != NULL) { ret = cdo->drive_status(cdi, CDSL_CURRENT); cd_dbg(CD_OPEN, ""drive_status=%d\n"", ret); if (ret == CDS_TRAY_OPEN) { cd_dbg(CD_OPEN, ""the tray is open...\n""); /* can/may i close it? */ if (CDROM_CAN(CDC_CLOSE_TRAY) && cdi->options & CDO_AUTO_CLOSE) { cd_dbg(CD_OPEN, ""trying to close the tray\n""); ret=cdo->tray_move(cdi,0); if (ret) { cd_dbg(CD_OPEN, ""bummer. tried to close the tray but failed.\n""); /* Ignore the error from the low level driver. We don't care why it couldn't close the tray. We only care that there is no disc in the drive, since that is the _REAL_ problem here.*/ ret=-ENOMEDIUM; goto clean_up_and_return; } } else { cd_dbg(CD_OPEN, ""bummer. this drive can't close the tray.\n""); ret=-ENOMEDIUM; goto clean_up_and_return; } /* Ok, the door should be closed now.. Check again */ ret = cdo->drive_status(cdi, CDSL_CURRENT); if ((ret == CDS_NO_DISC) || (ret==CDS_TRAY_OPEN)) { cd_dbg(CD_OPEN, ""bummer. the tray is still not closed.\n""); cd_dbg(CD_OPEN, ""tray might not contain a medium\n""); ret=-ENOMEDIUM; goto clean_up_and_return; } cd_dbg(CD_OPEN, ""the tray is now closed\n""); } /* the door should be closed now, check for the disc */ ret = cdo->drive_status(cdi, CDSL_CURRENT); if (ret!=CDS_DISC_OK) { ret = -ENOMEDIUM; goto clean_up_and_return; } } cdrom_count_tracks(cdi, &tracks); if (tracks.error == CDS_NO_DISC) { cd_dbg(CD_OPEN, ""bummer. no disc.\n""); ret=-ENOMEDIUM; goto clean_up_and_return; } /* CD-Players which don't use O_NONBLOCK, workman * for example, need bit CDO_CHECK_TYPE cleared! */ if (tracks.data==0) { if (cdi->options & CDO_CHECK_TYPE) { /* give people a warning shot, now that CDO_CHECK_TYPE is the default case! */ cd_dbg(CD_OPEN, ""bummer. wrong media type.\n""); cd_dbg(CD_WARNING, ""pid %d must open device O_NONBLOCK!\n"", (unsigned int)task_pid_nr(current)); ret=-EMEDIUMTYPE; goto clean_up_and_return; } else { cd_dbg(CD_OPEN, ""wrong media type, but CDO_CHECK_TYPE not set\n""); } } cd_dbg(CD_OPEN, ""all seems well, opening the devicen""); /* all seems well, we can open the device */ ret = cdo->open(cdi, 0); /* open for data */ cd_dbg(CD_OPEN, ""opening the device gave me %d\n"", ret); /* After all this careful checking, we shouldn't have problems opening the device, but we don't want the device locked if this somehow fails... */ if (ret) { cd_dbg(CD_OPEN, ""open device failed\n""); goto clean_up_and_return; } if (CDROM_CAN(CDC_LOCK) && (cdi->options & CDO_LOCK)) { cdo->lock_door(cdi, 1); cd_dbg(CD_OPEN, ""door locked\n""); } cd_dbg(CD_OPEN, ""device opened successfully\n""); return ret; /* Something failed. Try to unlock the drive, because some drivers (notably ide-cd) lock the drive after every command. This produced a nasty bug where after mount failed, the drive would remain locked! This ensures that the drive gets unlocked after a mount fails. This is a goto to avoid bloating the driver with redundant code. */ clean_up_and_return: cd_dbg(CD_OPEN, ""open failed\n""); if (CDROM_CAN(CDC_LOCK) && cdi->options & CDO_LOCK) { cdo->lock_door(cdi, 0); cd_dbg(CD_OPEN, ""door unlocked\n""); } return ret; } ",0 "static int nf_tables_getsetelem(struct sock *nlsk, struct sk_buff *skb, const struct nlmsghdr *nlh, const struct nlattr * const nla[]) { const struct nft_set *set; struct nft_ctx ctx; int err; err = nft_ctx_init_from_elemattr(&ctx, skb, nlh, nla, false); if (err < 0) return err; set = nf_tables_set_lookup(ctx.table, nla[NFTA_SET_ELEM_LIST_SET]); if (IS_ERR(set)) return PTR_ERR(set); if (set->flags & NFT_SET_INACTIVE) return -ENOENT; if (nlh->nlmsg_flags & NLM_F_DUMP) { struct netlink_dump_control c = { .dump = nf_tables_dump_set, }; return netlink_dump_start(nlsk, skb, nlh, &c); } return -EOPNOTSUPP; } ",0 "ShellWindow* ShellWindow::CreateImpl(Profile* profile, const extensions::Extension* extension, const GURL& url, const ShellWindow::CreateParams& params) { return new ShellWindowViews(profile, extension, url, params); } ",0 "static void check_spread(struct cfs_rq *cfs_rq, struct sched_entity *se) { #ifdef CONFIG_SCHED_DEBUG s64 d = se->vruntime - cfs_rq->min_vruntime; if (d < 0) d = -d; if (d > 3*sysctl_sched_latency) schedstat_inc(cfs_rq->nr_spread_over); #endif } ",0 "void avrc_process_timeout(void* data) { tAVRC_PARAM* param = (tAVRC_PARAM*)data; AVRC_TRACE_DEBUG(""AVRC: command timeout (handle=0x%02x, label=0x%02x)"", param->handle, param->label); /* Notify app */ if (avrc_cb.ccb[param->handle].ctrl_cback) { avrc_cb.ccb[param->handle].ctrl_cback.Run( param->handle, AVRC_CMD_TIMEOUT_EVT, param->label, NULL); } /* If vendor command timed-out, then send next command in the queue */ if (param->msg_mask & AVRC_MSG_MASK_IS_VENDOR_CMD) { avrc_send_next_vendor_cmd(param->handle); } osi_free(param); } ",0 "static int crc32c_sparc64_update(struct shash_desc *desc, const u8 *data, unsigned int len) { u32 *crcp = shash_desc_ctx(desc); crc32c_compute(crcp, (const u64 *) data, len); return 0; } ",0 "static void do_bad_area(unsigned long addr, unsigned int esr, struct pt_regs *regs) { struct task_struct *tsk = current; struct mm_struct *mm = tsk->active_mm; /* * If we are in kernel mode at this point, we have no context to * handle this fault with. */ if (user_mode(regs)) __do_user_fault(tsk, addr, esr, SIGSEGV, SEGV_MAPERR, regs); else __do_kernel_fault(mm, addr, esr, regs); } ",0 "void ResourceMessageFilter::OnGetPlugins(bool refresh, IPC::Message* reply_msg) { ChromeThread::PostTask( ChromeThread::FILE, FROM_HERE, NewRunnableMethod( this, &ResourceMessageFilter::OnGetPluginsOnFileThread, refresh, reply_msg)); } ",0 "void RenderFrameHostImpl::SetAccessibilityCallbackForTesting( const base::Callback& callback) { accessibility_testing_callback_ = callback; } ",0 "static inline int pte_unmap_same(struct mm_struct *mm, pmd_t *pmd, pte_t *page_table, pte_t orig_pte) { int same = 1; #if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT) if (sizeof(pte_t) > sizeof(unsigned long)) { spinlock_t *ptl = pte_lockptr(mm, pmd); spin_lock(ptl); same = pte_same(*page_table, orig_pte); spin_unlock(ptl); } #endif pte_unmap(page_table); return same; } ",0 "init_arch(void) { struct utsname buf; if( uname(&buf) < 0 ) { return; } uname_arch = strdup( buf.machine ); if( !uname_arch ) { EXCEPT( ""Out of memory!"" ); } uname_opsys = strdup( buf.sysname ); if( !uname_opsys ) { EXCEPT( ""Out of memory!"" ); } arch = sysapi_translate_arch( buf.machine, buf.sysname ); opsys = sysapi_translate_opsys( buf.sysname, buf.release, buf.version, _sysapi_opsys_is_versioned ); opsys_versioned = sysapi_translate_opsys( buf.sysname, buf.release, buf.version, true ); opsys_version = sysapi_translate_opsys_version( buf.sysname, buf.release, buf.version ); if ( arch && opsys ) { arch_inited = TRUE; } } ",0 "ofputil_decode_packet_in(const struct ofp_header *oh, bool loose, const struct tun_table *tun_table, const struct vl_mff_map *vl_mff_map, struct ofputil_packet_in *pin, size_t *total_lenp, uint32_t *buffer_idp, struct ofpbuf *continuation) { uint32_t buffer_id; size_t total_len; memset(pin, 0, sizeof *pin); pin->cookie = OVS_BE64_MAX; if (continuation) { ofpbuf_use_const(continuation, NULL, 0); } struct ofpbuf b = ofpbuf_const_initializer(oh, ntohs(oh->length)); enum ofpraw raw = ofpraw_pull_assert(&b); if (raw == OFPRAW_OFPT13_PACKET_IN || raw == OFPRAW_OFPT12_PACKET_IN) { const struct ofp12_packet_in *opi = ofpbuf_pull(&b, sizeof *opi); const ovs_be64 *cookie = (raw == OFPRAW_OFPT13_PACKET_IN ? ofpbuf_pull(&b, sizeof *cookie) : NULL); enum ofperr error = oxm_pull_match_loose(&b, tun_table, &pin->flow_metadata); if (error) { return error; } if (!ofpbuf_try_pull(&b, 2)) { return OFPERR_OFPBRC_BAD_LEN; } pin->reason = opi->reason; pin->table_id = opi->table_id; buffer_id = ntohl(opi->buffer_id); total_len = ntohs(opi->total_len); if (cookie) { pin->cookie = *cookie; } pin->packet = b.data; pin->packet_len = b.size; } else if (raw == OFPRAW_OFPT10_PACKET_IN) { const struct ofp10_packet_in *opi; opi = ofpbuf_pull(&b, offsetof(struct ofp10_packet_in, data)); pin->packet = CONST_CAST(uint8_t *, opi->data); pin->packet_len = b.size; match_init_catchall(&pin->flow_metadata); match_set_in_port(&pin->flow_metadata, u16_to_ofp(ntohs(opi->in_port))); pin->reason = opi->reason; buffer_id = ntohl(opi->buffer_id); total_len = ntohs(opi->total_len); } else if (raw == OFPRAW_OFPT11_PACKET_IN) { const struct ofp11_packet_in *opi; ofp_port_t in_port; enum ofperr error; opi = ofpbuf_pull(&b, sizeof *opi); pin->packet = b.data; pin->packet_len = b.size; buffer_id = ntohl(opi->buffer_id); error = ofputil_port_from_ofp11(opi->in_port, &in_port); if (error) { return error; } match_init_catchall(&pin->flow_metadata); match_set_in_port(&pin->flow_metadata, in_port); total_len = ntohs(opi->total_len); pin->reason = opi->reason; pin->table_id = opi->table_id; } else if (raw == OFPRAW_NXT_PACKET_IN) { const struct nx_packet_in *npi; int error; npi = ofpbuf_pull(&b, sizeof *npi); error = nx_pull_match_loose(&b, ntohs(npi->match_len), &pin->flow_metadata, NULL, NULL, NULL); if (error) { return error; } if (!ofpbuf_try_pull(&b, 2)) { return OFPERR_OFPBRC_BAD_LEN; } pin->reason = npi->reason; pin->table_id = npi->table_id; pin->cookie = npi->cookie; buffer_id = ntohl(npi->buffer_id); total_len = ntohs(npi->total_len); pin->packet = b.data; pin->packet_len = b.size; } else if (raw == OFPRAW_NXT_PACKET_IN2 || raw == OFPRAW_NXT_RESUME) { enum ofperr error = decode_nx_packet_in2(oh, loose, tun_table, vl_mff_map, pin, &total_len, &buffer_id, continuation); if (error) { return error; } } else { OVS_NOT_REACHED(); } if (total_lenp) { *total_lenp = total_len; } if (buffer_idp) { *buffer_idp = buffer_id; } return 0; } ",0 "ksba_ocsp_get_digest_algo (ksba_ocsp_t ocsp) { return ocsp? ocsp->digest_oid : NULL; } ",0 " void GestureProviderAura::OnGestureEvent( const GestureEventData& gesture) { GestureEventDetails details = gesture.details; if (gesture.type == ET_GESTURE_TAP) { int tap_count = 1; if (previous_tap_ && IsConsideredDoubleTap(*previous_tap_, gesture)) tap_count = 1 + (previous_tap_->details.tap_count() % 3); details.set_tap_count(tap_count); if (!previous_tap_) previous_tap_.reset(new GestureEventData(gesture)); else *previous_tap_ = gesture; previous_tap_->details = details; } else if (gesture.type == ET_GESTURE_TAP_CANCEL) { previous_tap_.reset(); } scoped_ptr event( new ui::GestureEvent(gesture.type, gesture.x, gesture.y, last_touch_event_flags_, gesture.time - base::TimeTicks(), details, 1 << gesture.motion_event_id)); if (!handling_event_) { client_->OnGestureEvent(event.get()); } else { pending_gestures_.push_back(event.release()); } } ",1 "static int megasas_start_aen(struct megasas_instance *instance) { struct megasas_evt_log_info eli; union megasas_evt_class_locale class_locale; /* * Get the latest sequence number from FW */ memset(&eli, 0, sizeof(eli)); if (megasas_get_seq_num(instance, &eli)) return -1; /* * Register AEN with FW for latest sequence number plus 1 */ class_locale.members.reserved = 0; class_locale.members.locale = MR_EVT_LOCALE_ALL; class_locale.members.class = MR_EVT_CLASS_DEBUG; return megasas_register_aen(instance, le32_to_cpu(eli.newest_seq_num) + 1, class_locale.word); } ",0 "static int dvico_bluebird_xc2028_callback(void *ptr, int component, int command, int arg) { struct dvb_usb_adapter *adap = ptr; struct dvb_usb_device *d = adap->dev; switch (command) { case XC2028_TUNER_RESET: deb_info(""%s: XC2028_TUNER_RESET %d\n"", __func__, arg); cxusb_bluebird_gpio_pulse(d, 0x01, 1); break; case XC2028_RESET_CLK: deb_info(""%s: XC2028_RESET_CLK %d\n"", __func__, arg); break; default: deb_info(""%s: unknown command %d, arg %d\n"", __func__, command, arg); return -EINVAL; } return 0; } ",0 "int nf_nat_proto_range_to_nlattr(struct sk_buff *skb, const struct nf_nat_range *range) { NLA_PUT_BE16(skb, CTA_PROTONAT_PORT_MIN, range->min.all); NLA_PUT_BE16(skb, CTA_PROTONAT_PORT_MAX, range->max.all); return 0; nla_put_failure: return -1; } ",0 "Stream *CachedFileStream::makeSubStream(Guint startA, GBool limitedA, Guint lengthA, Object *dictA) { cc->incRefCnt(); return new CachedFileStream(cc, startA, limitedA, lengthA, dictA); } ",0 "void HTMLInputElement::setActivatedSubmit(bool flag) { m_isActivatedSubmit = flag; } ",0 "void SocketStreamDispatcherHost::OnClose(net::SocketStream* socket) { int socket_id = SocketStreamHost::SocketIdFromSocketStream(socket); DVLOG(1) << ""SocketStreamDispatcherHost::OnClosed socket_id="" << socket_id; if (socket_id == content::kNoSocketId) { LOG(ERROR) << ""NoSocketId in OnClose""; return; } DeleteSocketStreamHost(socket_id); } ",0 "static int addnumber(JF, double value) { int i; for (i = 0; i < F->numlen; ++i) if (F->numtab[i] == value) return i; if (F->numlen >= F->numcap) { F->numcap = F->numcap ? F->numcap * 2 : 16; F->numtab = js_realloc(J, F->numtab, F->numcap * sizeof *F->numtab); } F->numtab[F->numlen] = value; return F->numlen++; } ",0 "void DrawingBuffer::ReadBackFramebuffer(unsigned char* pixels, int width, int height, ReadbackOrder readback_order, WebGLImageConversion::AlphaOp op) { DCHECK(state_restorer_); state_restorer_->SetPixelPackAlignmentDirty(); gl_->PixelStorei(GL_PACK_ALIGNMENT, 1); gl_->ReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels); size_t buffer_size = 4 * width * height; if (readback_order == kReadbackSkia) { #if (SK_R32_SHIFT == 16) && !SK_B32_SHIFT for (size_t i = 0; i < buffer_size; i += 4) { std::swap(pixels[i], pixels[i + 2]); } #endif } if (op == WebGLImageConversion::kAlphaDoPremultiply) { for (size_t i = 0; i < buffer_size; i += 4) { pixels[i + 0] = std::min(255, pixels[i + 0] * pixels[i + 3] / 255); pixels[i + 1] = std::min(255, pixels[i + 1] * pixels[i + 3] / 255); pixels[i + 2] = std::min(255, pixels[i + 2] * pixels[i + 3] / 255); } } else if (op != WebGLImageConversion::kAlphaDoNothing) { NOTREACHED(); } } ",1 "void blk_mq_wake_waiters(struct request_queue *q) { struct blk_mq_hw_ctx *hctx; unsigned int i; queue_for_each_hw_ctx(q, hctx, i) if (blk_mq_hw_queue_mapped(hctx)) blk_mq_tag_wakeup_all(hctx->tags, true); /* * If we are called because the queue has now been marked as * dying, we need to ensure that processes currently waiting on * the queue are notified as well. */ wake_up_all(&q->mq_freeze_wq); } ",0 "StylePropertyMapReadOnly* Document::ComputedStyleMap(Element* element) { ElementComputedStyleMap::AddResult add_result = element_computed_style_map_.insert(element, nullptr); if (add_result.is_new_entry) add_result.stored_value->value = ComputedStylePropertyMap::Create(element); return add_result.stored_value->value; } ",0 "static int packet_getsockopt(struct socket *sock, int level, int optname, char __user *optval, int __user *optlen) { int len; int val, lv = sizeof(val); struct sock *sk = sock->sk; struct packet_sock *po = pkt_sk(sk); void *data = &val; union tpacket_stats_u st; struct tpacket_rollover_stats rstats; if (level != SOL_PACKET) return -ENOPROTOOPT; if (get_user(len, optlen)) return -EFAULT; if (len < 0) return -EINVAL; switch (optname) { case PACKET_STATISTICS: spin_lock_bh(&sk->sk_receive_queue.lock); memcpy(&st, &po->stats, sizeof(st)); memset(&po->stats, 0, sizeof(po->stats)); spin_unlock_bh(&sk->sk_receive_queue.lock); if (po->tp_version == TPACKET_V3) { lv = sizeof(struct tpacket_stats_v3); st.stats3.tp_packets += st.stats3.tp_drops; data = &st.stats3; } else { lv = sizeof(struct tpacket_stats); st.stats1.tp_packets += st.stats1.tp_drops; data = &st.stats1; } break; case PACKET_AUXDATA: val = po->auxdata; break; case PACKET_ORIGDEV: val = po->origdev; break; case PACKET_VNET_HDR: val = po->has_vnet_hdr; break; case PACKET_VERSION: val = po->tp_version; break; case PACKET_HDRLEN: if (len > sizeof(int)) len = sizeof(int); if (len < sizeof(int)) return -EINVAL; if (copy_from_user(&val, optval, len)) return -EFAULT; switch (val) { case TPACKET_V1: val = sizeof(struct tpacket_hdr); break; case TPACKET_V2: val = sizeof(struct tpacket2_hdr); break; case TPACKET_V3: val = sizeof(struct tpacket3_hdr); break; default: return -EINVAL; } break; case PACKET_RESERVE: val = po->tp_reserve; break; case PACKET_LOSS: val = po->tp_loss; break; case PACKET_TIMESTAMP: val = po->tp_tstamp; break; case PACKET_FANOUT: val = (po->fanout ? ((u32)po->fanout->id | ((u32)po->fanout->type << 16) | ((u32)po->fanout->flags << 24)) : 0); break; case PACKET_ROLLOVER_STATS: if (!po->rollover) return -EINVAL; rstats.tp_all = atomic_long_read(&po->rollover->num); rstats.tp_huge = atomic_long_read(&po->rollover->num_huge); rstats.tp_failed = atomic_long_read(&po->rollover->num_failed); data = &rstats; lv = sizeof(rstats); break; case PACKET_TX_HAS_OFF: val = po->tp_tx_has_off; break; case PACKET_QDISC_BYPASS: val = packet_use_direct_xmit(po); break; default: return -ENOPROTOOPT; } if (len > lv) len = lv; if (put_user(len, optlen)) return -EFAULT; if (copy_to_user(optval, data, len)) return -EFAULT; return 0; } ",0 "static int ext4_ext_split(handle_t *handle, struct inode *inode, struct ext4_ext_path *path, struct ext4_extent *newext, int at) { struct buffer_head *bh = NULL; int depth = ext_depth(inode); struct ext4_extent_header *neh; struct ext4_extent_idx *fidx; struct ext4_extent *ex; int i = at, k, m, a; ext4_fsblk_t newblock, oldblock; __le32 border; ext4_fsblk_t *ablocks = NULL; /* array of allocated blocks */ int err = 0; /* make decision: where to split? */ /* FIXME: now decision is simplest: at current extent */ /* if current leaf will be split, then we should use * border from split point */ BUG_ON(path[depth].p_ext > EXT_MAX_EXTENT(path[depth].p_hdr)); if (path[depth].p_ext != EXT_MAX_EXTENT(path[depth].p_hdr)) { border = path[depth].p_ext[1].ee_block; ext_debug(""leaf will be split."" "" next leaf starts at %d\n"", le32_to_cpu(border)); } else { border = newext->ee_block; ext_debug(""leaf will be added."" "" next leaf starts at %d\n"", le32_to_cpu(border)); } /* * If error occurs, then we break processing * and mark filesystem read-only. index won't * be inserted and tree will be in consistent * state. Next mount will repair buffers too. */ /* * Get array to track all allocated blocks. * We need this to handle errors and free blocks * upon them. */ ablocks = kzalloc(sizeof(ext4_fsblk_t) * depth, GFP_NOFS); if (!ablocks) return -ENOMEM; /* allocate all needed blocks */ ext_debug(""allocate %d blocks for indexes/leaf\n"", depth - at); for (a = 0; a < depth - at; a++) { newblock = ext4_ext_new_meta_block(handle, inode, path, newext, &err); if (newblock == 0) goto cleanup; ablocks[a] = newblock; } /* initialize new leaf */ newblock = ablocks[--a]; BUG_ON(newblock == 0); bh = sb_getblk(inode->i_sb, newblock); if (!bh) { err = -EIO; goto cleanup; } lock_buffer(bh); err = ext4_journal_get_create_access(handle, bh); if (err) goto cleanup; neh = ext_block_hdr(bh); neh->eh_entries = 0; neh->eh_max = cpu_to_le16(ext4_ext_space_block(inode, 0)); neh->eh_magic = EXT4_EXT_MAGIC; neh->eh_depth = 0; ex = EXT_FIRST_EXTENT(neh); /* move remainder of path[depth] to the new leaf */ BUG_ON(path[depth].p_hdr->eh_entries != path[depth].p_hdr->eh_max); /* start copy from next extent */ /* TODO: we could do it by single memmove */ m = 0; path[depth].p_ext++; while (path[depth].p_ext <= EXT_MAX_EXTENT(path[depth].p_hdr)) { ext_debug(""move %d:%llu:[%d]%d in new leaf %llu\n"", le32_to_cpu(path[depth].p_ext->ee_block), ext_pblock(path[depth].p_ext), ext4_ext_is_uninitialized(path[depth].p_ext), ext4_ext_get_actual_len(path[depth].p_ext), newblock); /*memmove(ex++, path[depth].p_ext++, sizeof(struct ext4_extent)); neh->eh_entries++;*/ path[depth].p_ext++; m++; } if (m) { memmove(ex, path[depth].p_ext-m, sizeof(struct ext4_extent)*m); le16_add_cpu(&neh->eh_entries, m); } set_buffer_uptodate(bh); unlock_buffer(bh); err = ext4_handle_dirty_metadata(handle, inode, bh); if (err) goto cleanup; brelse(bh); bh = NULL; /* correct old leaf */ if (m) { err = ext4_ext_get_access(handle, inode, path + depth); if (err) goto cleanup; le16_add_cpu(&path[depth].p_hdr->eh_entries, -m); err = ext4_ext_dirty(handle, inode, path + depth); if (err) goto cleanup; } /* create intermediate indexes */ k = depth - at - 1; BUG_ON(k < 0); if (k) ext_debug(""create %d intermediate indices\n"", k); /* insert new index into current index block */ /* current depth stored in i var */ i = depth - 1; while (k--) { oldblock = newblock; newblock = ablocks[--a]; bh = sb_getblk(inode->i_sb, newblock); if (!bh) { err = -EIO; goto cleanup; } lock_buffer(bh); err = ext4_journal_get_create_access(handle, bh); if (err) goto cleanup; neh = ext_block_hdr(bh); neh->eh_entries = cpu_to_le16(1); neh->eh_magic = EXT4_EXT_MAGIC; neh->eh_max = cpu_to_le16(ext4_ext_space_block_idx(inode, 0)); neh->eh_depth = cpu_to_le16(depth - i); fidx = EXT_FIRST_INDEX(neh); fidx->ei_block = border; ext4_idx_store_pblock(fidx, oldblock); ext_debug(""int.index at %d (block %llu): %u -> %llu\n"", i, newblock, le32_to_cpu(border), oldblock); /* copy indexes */ m = 0; path[i].p_idx++; ext_debug(""cur 0x%p, last 0x%p\n"", path[i].p_idx, EXT_MAX_INDEX(path[i].p_hdr)); BUG_ON(EXT_MAX_INDEX(path[i].p_hdr) != EXT_LAST_INDEX(path[i].p_hdr)); while (path[i].p_idx <= EXT_MAX_INDEX(path[i].p_hdr)) { ext_debug(""%d: move %d:%llu in new index %llu\n"", i, le32_to_cpu(path[i].p_idx->ei_block), idx_pblock(path[i].p_idx), newblock); /*memmove(++fidx, path[i].p_idx++, sizeof(struct ext4_extent_idx)); neh->eh_entries++; BUG_ON(neh->eh_entries > neh->eh_max);*/ path[i].p_idx++; m++; } if (m) { memmove(++fidx, path[i].p_idx - m, sizeof(struct ext4_extent_idx) * m); le16_add_cpu(&neh->eh_entries, m); } set_buffer_uptodate(bh); unlock_buffer(bh); err = ext4_handle_dirty_metadata(handle, inode, bh); if (err) goto cleanup; brelse(bh); bh = NULL; /* correct old index */ if (m) { err = ext4_ext_get_access(handle, inode, path + i); if (err) goto cleanup; le16_add_cpu(&path[i].p_hdr->eh_entries, -m); err = ext4_ext_dirty(handle, inode, path + i); if (err) goto cleanup; } i--; } /* insert new index */ err = ext4_ext_insert_index(handle, inode, path + at, le32_to_cpu(border), newblock); cleanup: if (bh) { if (buffer_locked(bh)) unlock_buffer(bh); brelse(bh); } if (err) { /* free all allocated blocks in error case */ for (i = 0; i < depth; i++) { if (!ablocks[i]) continue; ext4_free_blocks(handle, inode, 0, ablocks[i], 1, EXT4_FREE_BLOCKS_METADATA); } } kfree(ablocks); return err; } ",0 "void ShelfBackgroundAnimator::NotifyObservers() { for (auto& observer : observers_) NotifyObserver(&observer); } ",0 "void BlockedPlugin::BindWebFrame(WebFrame* frame) { BindToJavascript(frame, ""plugin""); BindMethod(""load"", &BlockedPlugin::Load); BindMethod(""hide"", &BlockedPlugin::Hide); } ",0 "mm_ssh_gssapi_checkmic(Gssctxt *ctx, gss_buffer_t gssbuf, gss_buffer_t gssmic) { Buffer m; OM_uint32 major; buffer_init(&m); buffer_put_string(&m, gssbuf->value, gssbuf->length); buffer_put_string(&m, gssmic->value, gssmic->length); mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_GSSCHECKMIC, &m); mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_GSSCHECKMIC, &m); major = buffer_get_int(&m); buffer_free(&m); return(major); } ",0 " virtual ~FramebufferInfoFloatTest() { } ",0 "int mem_cgroup_sockets_init(struct mem_cgroup *memcg, struct cgroup_subsys *ss) { struct proto *proto; int ret = 0; mutex_lock(&proto_list_mutex); list_for_each_entry(proto, &proto_list, node) { if (proto->init_cgroup) { ret = proto->init_cgroup(memcg, ss); if (ret) goto out; } } mutex_unlock(&proto_list_mutex); return ret; out: list_for_each_entry_continue_reverse(proto, &proto_list, node) if (proto->destroy_cgroup) proto->destroy_cgroup(memcg); mutex_unlock(&proto_list_mutex); return ret; } ",0 "static void start_cpu_timer(int cpu) { struct delayed_work *reap_work = &per_cpu(slab_reap_work, cpu); if (reap_work->work.func == NULL) { init_reap_node(cpu); INIT_DEFERRABLE_WORK(reap_work, cache_reap); schedule_delayed_work_on(cpu, reap_work, __round_jiffies_relative(HZ, cpu)); } } ",0 "void RenderBlock::willBeDestroyed() { m_beingDestroyed = true; children()->destroyLeftoverChildren(); RenderBoxModelObject* continuation = this->continuation(); if (continuation) { continuation->destroy(); setContinuation(0); } if (!documentBeingDestroyed()) { if (firstLineBox()) { if (isSelectionBorder()) view()->clearSelection(); if (isAnonymousBlock()) { for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox()) { while (InlineBox* childBox = box->firstChild()) childBox->remove(); } } } else if (parent()) parent()->dirtyLinesFromChangedChild(this); } m_lineBoxes.deleteLineBoxes(); if (UNLIKELY(gDelayedUpdateScrollInfoSet != 0)) gDelayedUpdateScrollInfoSet->remove(this); if (FastTextAutosizer* textAutosizer = document().fastTextAutosizer()) textAutosizer->destroy(this); RenderBox::willBeDestroyed(); } ",0 " cff_parse_font_bbox( CFF_Parser parser ) { CFF_FontRecDict dict = (CFF_FontRecDict)parser->object; FT_BBox* bbox = &dict->font_bbox; FT_Byte** data = parser->stack; FT_Error error; error = FT_ERR( Stack_Underflow ); if ( parser->top >= parser->stack + 4 ) { bbox->xMin = FT_RoundFix( cff_parse_fixed( parser, data++ ) ); bbox->yMin = FT_RoundFix( cff_parse_fixed( parser, data++ ) ); bbox->xMax = FT_RoundFix( cff_parse_fixed( parser, data++ ) ); bbox->yMax = FT_RoundFix( cff_parse_fixed( parser, data ) ); error = FT_Err_Ok; FT_TRACE4(( "" [%d %d %d %d]\n"", bbox->xMin / 65536, bbox->yMin / 65536, bbox->xMax / 65536, bbox->yMax / 65536 )); } return error; } ",0 "static Image *ReadTIFFImage(const ImageInfo *image_info, ExceptionInfo *exception) { const char *option; float *chromaticity, x_position, y_position, x_resolution, y_resolution; Image *image; int tiff_status; MagickBooleanType status; MagickSizeType number_pixels; QuantumInfo *quantum_info; QuantumType quantum_type; register ssize_t i; size_t pad; ssize_t y; TIFF *tiff; TIFFMethodType method; uint16 compress_tag, bits_per_sample, endian, extra_samples, interlace, max_sample_value, min_sample_value, orientation, pages, photometric, *sample_info, sample_format, samples_per_pixel, units, value; uint32 height, rows_per_strip, width; unsigned char *pixels; /* Open image. */ 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,exception); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } (void) SetMagickThreadValue(tiff_exception,exception); tiff=TIFFClientOpen(image->filename,""rb"",(thandle_t) image,TIFFReadBlob, TIFFWriteBlob,TIFFSeekBlob,TIFFCloseBlob,TIFFGetBlobSize,TIFFMapBlob, TIFFUnmapBlob); if (tiff == (TIFF *) NULL) { image=DestroyImageList(image); return((Image *) NULL); } if (image_info->number_scenes != 0) { /* Generate blank images for subimage specification (e.g. image.tif[4]. We need to check the number of directores because it is possible that the subimage(s) are stored in the photoshop profile. */ if (image_info->scene < (size_t) TIFFNumberOfDirectories(tiff)) { for (i=0; i < (ssize_t) image_info->scene; i++) { status=TIFFReadDirectory(tiff) != 0 ? MagickTrue : MagickFalse; if (status == MagickFalse) { TIFFClose(tiff); image=DestroyImageList(image); return((Image *) NULL); } AcquireNextImage(image_info,image,exception); if (GetNextImageInList(image) == (Image *) NULL) { TIFFClose(tiff); image=DestroyImageList(image); return((Image *) NULL); } image=SyncNextImageInList(image); } } } do { DisableMSCWarning(4127) if (0 && (image_info->verbose != MagickFalse)) TIFFPrintDirectory(tiff,stdout,MagickFalse); RestoreMSCWarning if ((TIFFGetField(tiff,TIFFTAG_IMAGEWIDTH,&width) != 1) || (TIFFGetField(tiff,TIFFTAG_IMAGELENGTH,&height) != 1) || (TIFFGetFieldDefaulted(tiff,TIFFTAG_COMPRESSION,&compress_tag) != 1) || (TIFFGetFieldDefaulted(tiff,TIFFTAG_FILLORDER,&endian) != 1) || (TIFFGetFieldDefaulted(tiff,TIFFTAG_PLANARCONFIG,&interlace) != 1) || (TIFFGetFieldDefaulted(tiff,TIFFTAG_SAMPLESPERPIXEL,&samples_per_pixel) != 1) || (TIFFGetFieldDefaulted(tiff,TIFFTAG_BITSPERSAMPLE,&bits_per_sample) != 1) || (TIFFGetFieldDefaulted(tiff,TIFFTAG_SAMPLEFORMAT,&sample_format) != 1) || (TIFFGetFieldDefaulted(tiff,TIFFTAG_MINSAMPLEVALUE,&min_sample_value) != 1) || (TIFFGetFieldDefaulted(tiff,TIFFTAG_MAXSAMPLEVALUE,&max_sample_value) != 1) || (TIFFGetFieldDefaulted(tiff,TIFFTAG_PHOTOMETRIC,&photometric) != 1)) { TIFFClose(tiff); ThrowReaderException(CorruptImageError,""ImproperImageHeader""); } if (sample_format == SAMPLEFORMAT_IEEEFP) (void) SetImageProperty(image,""quantum:format"",""floating-point"", exception); switch (photometric) { case PHOTOMETRIC_MINISBLACK: { (void) SetImageProperty(image,""tiff:photometric"",""min-is-black"", exception); break; } case PHOTOMETRIC_MINISWHITE: { (void) SetImageProperty(image,""tiff:photometric"",""min-is-white"", exception); break; } case PHOTOMETRIC_PALETTE: { (void) SetImageProperty(image,""tiff:photometric"",""palette"",exception); break; } case PHOTOMETRIC_RGB: { (void) SetImageProperty(image,""tiff:photometric"",""RGB"",exception); break; } case PHOTOMETRIC_CIELAB: { (void) SetImageProperty(image,""tiff:photometric"",""CIELAB"",exception); break; } case PHOTOMETRIC_LOGL: { (void) SetImageProperty(image,""tiff:photometric"",""CIE Log2(L)"", exception); break; } case PHOTOMETRIC_LOGLUV: { (void) SetImageProperty(image,""tiff:photometric"",""LOGLUV"",exception); break; } #if defined(PHOTOMETRIC_MASK) case PHOTOMETRIC_MASK: { (void) SetImageProperty(image,""tiff:photometric"",""MASK"",exception); break; } #endif case PHOTOMETRIC_SEPARATED: { (void) SetImageProperty(image,""tiff:photometric"",""separated"",exception); break; } case PHOTOMETRIC_YCBCR: { (void) SetImageProperty(image,""tiff:photometric"",""YCBCR"",exception); break; } default: { (void) SetImageProperty(image,""tiff:photometric"",""unknown"",exception); break; } } if (image->debug != MagickFalse) { (void) LogMagickEvent(CoderEvent,GetMagickModule(),""Geometry: %ux%u"", (unsigned int) width,(unsigned int) height); (void) LogMagickEvent(CoderEvent,GetMagickModule(),""Interlace: %u"", interlace); (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Bits per sample: %u"",bits_per_sample); (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Min sample value: %u"",min_sample_value); (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Max sample value: %u"",max_sample_value); (void) LogMagickEvent(CoderEvent,GetMagickModule(),""Photometric "" ""interpretation: %s"",GetImageProperty(image,""tiff:photometric"", exception)); } image->columns=(size_t) width; image->rows=(size_t) height; image->depth=(size_t) bits_per_sample; status=SetImageExtent(image,image->columns,image->rows,exception); if (status == MagickFalse) return(DestroyImageList(image)); if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(),""Image depth: %.20g"", (double) image->depth); image->endian=MSBEndian; if (endian == FILLORDER_LSB2MSB) image->endian=LSBEndian; #if defined(MAGICKCORE_HAVE_TIFFISBIGENDIAN) if (TIFFIsBigEndian(tiff) == 0) { (void) SetImageProperty(image,""tiff:endian"",""lsb"",exception); image->endian=LSBEndian; } else { (void) SetImageProperty(image,""tiff:endian"",""msb"",exception); image->endian=MSBEndian; } #endif if ((photometric == PHOTOMETRIC_MINISBLACK) || (photometric == PHOTOMETRIC_MINISWHITE)) SetImageColorspace(image,GRAYColorspace,exception); if (photometric == PHOTOMETRIC_SEPARATED) SetImageColorspace(image,CMYKColorspace,exception); if (photometric == PHOTOMETRIC_CIELAB) SetImageColorspace(image,LabColorspace,exception); TIFFGetProfiles(tiff,image,image_info->ping,exception); TIFFGetProperties(tiff,image,exception); option=GetImageOption(image_info,""tiff:exif-properties""); if (IsStringFalse(option) == MagickFalse) /* enabled by default */ TIFFGetEXIFProperties(tiff,image,exception); (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_SAMPLESPERPIXEL, &samples_per_pixel); if ((TIFFGetFieldDefaulted(tiff,TIFFTAG_XRESOLUTION,&x_resolution) == 1) && (TIFFGetFieldDefaulted(tiff,TIFFTAG_YRESOLUTION,&y_resolution) == 1)) { image->resolution.x=x_resolution; image->resolution.y=y_resolution; } if (TIFFGetFieldDefaulted(tiff,TIFFTAG_RESOLUTIONUNIT,&units) == 1) { if (units == RESUNIT_INCH) image->units=PixelsPerInchResolution; if (units == RESUNIT_CENTIMETER) image->units=PixelsPerCentimeterResolution; } if ((TIFFGetFieldDefaulted(tiff,TIFFTAG_XPOSITION,&x_position) == 1) && (TIFFGetFieldDefaulted(tiff,TIFFTAG_YPOSITION,&y_position) == 1)) { image->page.x=(ssize_t) ceil(x_position*image->resolution.x-0.5); image->page.y=(ssize_t) ceil(y_position*image->resolution.y-0.5); } if (TIFFGetFieldDefaulted(tiff,TIFFTAG_ORIENTATION,&orientation) == 1) image->orientation=(OrientationType) orientation; if (TIFFGetField(tiff,TIFFTAG_WHITEPOINT,&chromaticity) == 1) { if (chromaticity != (float *) NULL) { image->chromaticity.white_point.x=chromaticity[0]; image->chromaticity.white_point.y=chromaticity[1]; } } if (TIFFGetField(tiff,TIFFTAG_PRIMARYCHROMATICITIES,&chromaticity) == 1) { if (chromaticity != (float *) NULL) { image->chromaticity.red_primary.x=chromaticity[0]; image->chromaticity.red_primary.y=chromaticity[1]; image->chromaticity.green_primary.x=chromaticity[2]; image->chromaticity.green_primary.y=chromaticity[3]; image->chromaticity.blue_primary.x=chromaticity[4]; image->chromaticity.blue_primary.y=chromaticity[5]; } } #if defined(MAGICKCORE_HAVE_TIFFISCODECCONFIGURED) || (TIFFLIB_VERSION > 20040919) if ((compress_tag != COMPRESSION_NONE) && (TIFFIsCODECConfigured(compress_tag) == 0)) { TIFFClose(tiff); ThrowReaderException(CoderError,""CompressNotSupported""); } #endif switch (compress_tag) { case COMPRESSION_NONE: image->compression=NoCompression; break; case COMPRESSION_CCITTFAX3: image->compression=FaxCompression; break; case COMPRESSION_CCITTFAX4: image->compression=Group4Compression; break; case COMPRESSION_JPEG: { image->compression=JPEGCompression; #if defined(JPEG_SUPPORT) { char sampling_factor[MagickPathExtent]; int tiff_status; uint16 horizontal, vertical; tiff_status=TIFFGetFieldDefaulted(tiff,TIFFTAG_YCBCRSUBSAMPLING, &horizontal,&vertical); if (tiff_status == 1) { (void) FormatLocaleString(sampling_factor,MagickPathExtent, ""%dx%d"",horizontal,vertical); (void) SetImageProperty(image,""jpeg:sampling-factor"", sampling_factor,exception); (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Sampling Factors: %s"",sampling_factor); } } #endif break; } case COMPRESSION_OJPEG: image->compression=JPEGCompression; break; #if defined(COMPRESSION_LZMA) case COMPRESSION_LZMA: image->compression=LZMACompression; break; #endif case COMPRESSION_LZW: image->compression=LZWCompression; break; case COMPRESSION_DEFLATE: image->compression=ZipCompression; break; case COMPRESSION_ADOBE_DEFLATE: image->compression=ZipCompression; break; default: image->compression=RLECompression; break; } /* Allocate memory for the image and pixel buffer. */ quantum_info=AcquireQuantumInfo(image_info,image); if (quantum_info == (QuantumInfo *) NULL) { TIFFClose(tiff); ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); } if (sample_format == SAMPLEFORMAT_UINT) status=SetQuantumFormat(image,quantum_info,UnsignedQuantumFormat); if (sample_format == SAMPLEFORMAT_INT) status=SetQuantumFormat(image,quantum_info,SignedQuantumFormat); if (sample_format == SAMPLEFORMAT_IEEEFP) status=SetQuantumFormat(image,quantum_info,FloatingPointQuantumFormat); if (status == MagickFalse) { TIFFClose(tiff); quantum_info=DestroyQuantumInfo(quantum_info); ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); } status=MagickTrue; switch (photometric) { case PHOTOMETRIC_MINISBLACK: { quantum_info->min_is_white=MagickFalse; break; } case PHOTOMETRIC_MINISWHITE: { quantum_info->min_is_white=MagickTrue; break; } default: break; } tiff_status=TIFFGetFieldDefaulted(tiff,TIFFTAG_EXTRASAMPLES,&extra_samples, &sample_info); if (tiff_status == 1) { (void) SetImageProperty(image,""tiff:alpha"",""unspecified"",exception); if (extra_samples == 0) { if ((samples_per_pixel == 4) && (photometric == PHOTOMETRIC_RGB)) image->alpha_trait=BlendPixelTrait; } else for (i=0; i < extra_samples; i++) { image->alpha_trait=BlendPixelTrait; if (sample_info[i] == EXTRASAMPLE_ASSOCALPHA) { SetQuantumAlphaType(quantum_info,DisassociatedQuantumAlpha); (void) SetImageProperty(image,""tiff:alpha"",""associated"", exception); } else if (sample_info[i] == EXTRASAMPLE_UNASSALPHA) (void) SetImageProperty(image,""tiff:alpha"",""unassociated"", exception); } } if ((photometric == PHOTOMETRIC_PALETTE) && (pow(2.0,1.0*bits_per_sample) <= MaxColormapSize)) { size_t colors; colors=(size_t) GetQuantumRange(bits_per_sample)+1; if (AcquireImageColormap(image,colors,exception) == MagickFalse) { TIFFClose(tiff); ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); } } value=(unsigned short) image->scene; if (TIFFGetFieldDefaulted(tiff,TIFFTAG_PAGENUMBER,&value,&pages) == 1) image->scene=value; if (image->storage_class == PseudoClass) { int tiff_status; size_t range; uint16 *blue_colormap, *green_colormap, *red_colormap; /* Initialize colormap. */ tiff_status=TIFFGetField(tiff,TIFFTAG_COLORMAP,&red_colormap, &green_colormap,&blue_colormap); if (tiff_status == 1) { if ((red_colormap != (uint16 *) NULL) && (green_colormap != (uint16 *) NULL) && (blue_colormap != (uint16 *) NULL)) { range=255; /* might be old style 8-bit colormap */ for (i=0; i < (ssize_t) image->colors; i++) if ((red_colormap[i] >= 256) || (green_colormap[i] >= 256) || (blue_colormap[i] >= 256)) { range=65535; break; } for (i=0; i < (ssize_t) image->colors; i++) { image->colormap[i].red=ClampToQuantum(((double) QuantumRange*red_colormap[i])/range); image->colormap[i].green=ClampToQuantum(((double) QuantumRange*green_colormap[i])/range); image->colormap[i].blue=ClampToQuantum(((double) QuantumRange*blue_colormap[i])/range); } } } if (image->alpha_trait == UndefinedPixelTrait) image->depth=GetImageDepth(image,exception); } if (image_info->ping != MagickFalse) { if (image_info->number_scenes != 0) if (image->scene >= (image_info->scene+image_info->number_scenes-1)) { quantum_info=DestroyQuantumInfo(quantum_info); break; } goto next_tiff_frame; } method=ReadGenericMethod; if (TIFFGetField(tiff,TIFFTAG_ROWSPERSTRIP,&rows_per_strip) == 1) { char value[MagickPathExtent]; method=ReadStripMethod; (void) FormatLocaleString(value,MagickPathExtent,""%u"", (unsigned int) rows_per_strip); (void) SetImageProperty(image,""tiff:rows-per-strip"",value,exception); } if ((samples_per_pixel >= 2) && (interlace == PLANARCONFIG_CONTIG)) method=ReadRGBAMethod; if ((samples_per_pixel >= 2) && (interlace == PLANARCONFIG_SEPARATE)) method=ReadCMYKAMethod; if ((photometric != PHOTOMETRIC_RGB) && (photometric != PHOTOMETRIC_CIELAB) && (photometric != PHOTOMETRIC_SEPARATED)) method=ReadGenericMethod; if (image->storage_class == PseudoClass) method=ReadSingleSampleMethod; if ((photometric == PHOTOMETRIC_MINISBLACK) || (photometric == PHOTOMETRIC_MINISWHITE)) method=ReadSingleSampleMethod; if ((photometric != PHOTOMETRIC_SEPARATED) && (interlace == PLANARCONFIG_SEPARATE) && (bits_per_sample < 64)) method=ReadGenericMethod; if (image->compression == JPEGCompression) method=GetJPEGMethod(image,tiff,photometric,bits_per_sample, samples_per_pixel); if (compress_tag == COMPRESSION_JBIG) method=ReadStripMethod; if (TIFFIsTiled(tiff) != MagickFalse) method=ReadTileMethod; quantum_info->endian=LSBEndian; quantum_type=RGBQuantum; pixels=(unsigned char *) GetQuantumPixels(quantum_info); switch (method) { case ReadSingleSampleMethod: { /* Convert TIFF image to PseudoClass MIFF image. */ quantum_type=IndexQuantum; pad=(size_t) MagickMax((size_t) samples_per_pixel-1,0); if (image->alpha_trait != UndefinedPixelTrait) { if (image->storage_class != PseudoClass) { quantum_type=samples_per_pixel == 1 ? AlphaQuantum : GrayAlphaQuantum; pad=(size_t) MagickMax((size_t) samples_per_pixel-2,0); } else { quantum_type=IndexAlphaQuantum; pad=(size_t) MagickMax((size_t) samples_per_pixel-2,0); } } else if (image->storage_class != PseudoClass) { quantum_type=GrayQuantum; pad=(size_t) MagickMax((size_t) samples_per_pixel-1,0); } status=SetQuantumPad(image,quantum_info,pad*((bits_per_sample+7) >> 3)); if (status == MagickFalse) { TIFFClose(tiff); ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); } pixels=(unsigned char *) GetQuantumPixels(quantum_info); for (y=0; y < (ssize_t) image->rows; y++) { int status; register Quantum *magick_restrict q; status=TIFFReadPixels(tiff,bits_per_sample,0,y,(char *) pixels); if (status == -1) break; q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) break; (void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info, quantum_type,pixels,exception); if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } } break; } case ReadRGBAMethod: { /* Convert TIFF image to DirectClass MIFF image. */ pad=(size_t) MagickMax((size_t) samples_per_pixel-3,0); quantum_type=RGBQuantum; if (image->alpha_trait != UndefinedPixelTrait) { quantum_type=RGBAQuantum; pad=(size_t) MagickMax((size_t) samples_per_pixel-4,0); } if (image->colorspace == CMYKColorspace) { pad=(size_t) MagickMax((size_t) samples_per_pixel-4,0); quantum_type=CMYKQuantum; if (image->alpha_trait != UndefinedPixelTrait) { quantum_type=CMYKAQuantum; pad=(size_t) MagickMax((size_t) samples_per_pixel-5,0); } } status=SetQuantumPad(image,quantum_info,pad*((bits_per_sample+7) >> 3)); if (status == MagickFalse) { TIFFClose(tiff); ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); } pixels=(unsigned char *) GetQuantumPixels(quantum_info); for (y=0; y < (ssize_t) image->rows; y++) { int status; register Quantum *magick_restrict q; status=TIFFReadPixels(tiff,bits_per_sample,0,y,(char *) pixels); if (status == -1) break; q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) break; (void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info, quantum_type,pixels,exception); if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } } break; } case ReadCMYKAMethod: { /* Convert TIFF image to DirectClass MIFF image. */ for (i=0; i < (ssize_t) samples_per_pixel; i++) { for (y=0; y < (ssize_t) image->rows; y++) { register Quantum *magick_restrict q; int status; status=TIFFReadPixels(tiff,bits_per_sample,(tsample_t) i,y,(char *) pixels); if (status == -1) break; q=GetAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) break; if (image->colorspace != CMYKColorspace) switch (i) { case 0: quantum_type=RedQuantum; break; case 1: quantum_type=GreenQuantum; break; case 2: quantum_type=BlueQuantum; break; case 3: quantum_type=AlphaQuantum; break; default: quantum_type=UndefinedQuantum; break; } else switch (i) { case 0: quantum_type=CyanQuantum; break; case 1: quantum_type=MagentaQuantum; break; case 2: quantum_type=YellowQuantum; break; case 3: quantum_type=BlackQuantum; break; case 4: quantum_type=AlphaQuantum; break; default: quantum_type=UndefinedQuantum; break; } (void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info, quantum_type,pixels,exception); if (SyncAuthenticPixels(image,exception) == MagickFalse) break; } if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } } break; } case ReadYCCKMethod: { pixels=(unsigned char *) GetQuantumPixels(quantum_info); for (y=0; y < (ssize_t) image->rows; y++) { int status; register Quantum *magick_restrict q; register ssize_t x; unsigned char *p; status=TIFFReadPixels(tiff,bits_per_sample,0,y,(char *) pixels); if (status == -1) break; q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) break; p=pixels; for (x=0; x < (ssize_t) image->columns; x++) { SetPixelCyan(image,ScaleCharToQuantum(ClampYCC((double) *p+ (1.402*(double) *(p+2))-179.456)),q); SetPixelMagenta(image,ScaleCharToQuantum(ClampYCC((double) *p- (0.34414*(double) *(p+1))-(0.71414*(double ) *(p+2))+ 135.45984)),q); SetPixelYellow(image,ScaleCharToQuantum(ClampYCC((double) *p+ (1.772*(double) *(p+1))-226.816)),q); SetPixelBlack(image,ScaleCharToQuantum((unsigned char) *(p+3)),q); q+=GetPixelChannels(image); p+=4; } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } } break; } case ReadStripMethod: { register uint32 *p; /* Convert stripped TIFF image to DirectClass MIFF image. */ i=0; p=(uint32 *) NULL; for (y=0; y < (ssize_t) image->rows; y++) { register ssize_t x; register Quantum *magick_restrict q; q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) break; if (i == 0) { if (TIFFReadRGBAStrip(tiff,(tstrip_t) y,(uint32 *) pixels) == 0) break; i=(ssize_t) MagickMin((ssize_t) rows_per_strip,(ssize_t) image->rows-y); } i--; p=((uint32 *) pixels)+image->columns*i; for (x=0; x < (ssize_t) image->columns; x++) { SetPixelRed(image,ScaleCharToQuantum((unsigned char) (TIFFGetR(*p))),q); SetPixelGreen(image,ScaleCharToQuantum((unsigned char) (TIFFGetG(*p))),q); SetPixelBlue(image,ScaleCharToQuantum((unsigned char) (TIFFGetB(*p))),q); if (image->alpha_trait != UndefinedPixelTrait) SetPixelAlpha(image,ScaleCharToQuantum((unsigned char) (TIFFGetA(*p))),q); p++; q+=GetPixelChannels(image); } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } } break; } case ReadTileMethod: { register uint32 *p; uint32 *tile_pixels, columns, rows; /* Convert tiled TIFF image to DirectClass MIFF image. */ if ((TIFFGetField(tiff,TIFFTAG_TILEWIDTH,&columns) != 1) || (TIFFGetField(tiff,TIFFTAG_TILELENGTH,&rows) != 1)) { TIFFClose(tiff); ThrowReaderException(CoderError,""ImageIsNotTiled""); } (void) SetImageStorageClass(image,DirectClass,exception); number_pixels=(MagickSizeType) columns*rows; if ((number_pixels*sizeof(uint32)) != (MagickSizeType) ((size_t) (number_pixels*sizeof(uint32)))) { TIFFClose(tiff); ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); } tile_pixels=(uint32 *) AcquireQuantumMemory(columns, rows*sizeof(*tile_pixels)); if (tile_pixels == (uint32 *) NULL) { TIFFClose(tiff); ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); } for (y=0; y < (ssize_t) image->rows; y+=rows) { register ssize_t x; register Quantum *magick_restrict q, *magick_restrict tile; size_t columns_remaining, rows_remaining; rows_remaining=image->rows-y; if ((ssize_t) (y+rows) < (ssize_t) image->rows) rows_remaining=rows; tile=QueueAuthenticPixels(image,0,y,image->columns,rows_remaining, exception); if (tile == (Quantum *) NULL) break; for (x=0; x < (ssize_t) image->columns; x+=columns) { size_t column, row; if (TIFFReadRGBATile(tiff,(uint32) x,(uint32) y,tile_pixels) == 0) break; columns_remaining=image->columns-x; if ((ssize_t) (x+columns) < (ssize_t) image->columns) columns_remaining=columns; p=tile_pixels+(rows-rows_remaining)*columns; q=tile+GetPixelChannels(image)*(image->columns*(rows_remaining-1)+ x); for (row=rows_remaining; row > 0; row--) { if (image->alpha_trait != UndefinedPixelTrait) for (column=columns_remaining; column > 0; column--) { SetPixelRed(image,ScaleCharToQuantum((unsigned char) TIFFGetR(*p)),q); SetPixelGreen(image,ScaleCharToQuantum((unsigned char) TIFFGetG(*p)),q); SetPixelBlue(image,ScaleCharToQuantum((unsigned char) TIFFGetB(*p)),q); SetPixelAlpha(image,ScaleCharToQuantum((unsigned char) TIFFGetA(*p)),q); p++; q+=GetPixelChannels(image); } else for (column=columns_remaining; column > 0; column--) { SetPixelRed(image,ScaleCharToQuantum((unsigned char) TIFFGetR(*p)),q); SetPixelGreen(image,ScaleCharToQuantum((unsigned char) TIFFGetG(*p)),q); SetPixelBlue(image,ScaleCharToQuantum((unsigned char) TIFFGetB(*p)),q); p++; q+=GetPixelChannels(image); } p+=columns-columns_remaining; q-=GetPixelChannels(image)*(image->columns+columns_remaining); } } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } } tile_pixels=(uint32 *) RelinquishMagickMemory(tile_pixels); break; } case ReadGenericMethod: default: { MemoryInfo *pixel_info; register uint32 *p; uint32 *pixels; /* Convert TIFF image to DirectClass MIFF image. */ number_pixels=(MagickSizeType) image->columns*image->rows; if ((number_pixels*sizeof(uint32)) != (MagickSizeType) ((size_t) (number_pixels*sizeof(uint32)))) { TIFFClose(tiff); ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); } pixel_info=AcquireVirtualMemory(image->columns,image->rows* sizeof(uint32)); if (pixel_info == (MemoryInfo *) NULL) { TIFFClose(tiff); ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); } pixels=(uint32 *) GetVirtualMemoryBlob(pixel_info); (void) TIFFReadRGBAImage(tiff,(uint32) image->columns, (uint32) image->rows,(uint32 *) pixels,0); /* Convert image to DirectClass pixel packets. */ p=pixels+number_pixels-1; for (y=0; y < (ssize_t) image->rows; y++) { register ssize_t x; register Quantum *magick_restrict q; q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) break; q+=GetPixelChannels(image)*(image->columns-1); for (x=0; x < (ssize_t) image->columns; x++) { SetPixelRed(image,ScaleCharToQuantum((unsigned char) TIFFGetR(*p)),q); SetPixelGreen(image,ScaleCharToQuantum((unsigned char) TIFFGetG(*p)),q); SetPixelBlue(image,ScaleCharToQuantum((unsigned char) TIFFGetB(*p)),q); if (image->alpha_trait != UndefinedPixelTrait) SetPixelAlpha(image,ScaleCharToQuantum((unsigned char) TIFFGetA(*p)),q); p--; q-=GetPixelChannels(image); } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } } pixel_info=RelinquishVirtualMemory(pixel_info); break; } } SetQuantumImageType(image,quantum_type); next_tiff_frame: quantum_info=DestroyQuantumInfo(quantum_info); if (photometric == PHOTOMETRIC_CIELAB) DecodeLabImage(image,exception); if ((photometric == PHOTOMETRIC_LOGL) || (photometric == PHOTOMETRIC_MINISBLACK) || (photometric == PHOTOMETRIC_MINISWHITE)) { image->type=GrayscaleType; if (bits_per_sample == 1) image->type=BilevelType; } /* Proceed to next image. */ if (image_info->number_scenes != 0) if (image->scene >= (image_info->scene+image_info->number_scenes-1)) break; status=TIFFReadDirectory(tiff) != 0 ? MagickTrue : MagickFalse; if (status != MagickFalse) { /* Allocate next image structure. */ AcquireNextImage(image_info,image,exception); if (GetNextImageInList(image) == (Image *) NULL) { image=DestroyImageList(image); return((Image *) NULL); } image=SyncNextImageInList(image); status=SetImageProgress(image,LoadImagesTag,image->scene-1, image->scene); if (status == MagickFalse) break; } } while (status != MagickFalse); TIFFClose(tiff); TIFFReadPhotoshopLayers(image,image_info,exception); if (image_info->number_scenes != 0) { if (image_info->scene >= GetImageListLength(image)) { /* Subimage was not found in the Photoshop layer */ image=DestroyImageList(image); return((Image *)NULL); } } return(GetFirstImageInList(image)); } ",0 "static bool __tpacket_has_room(struct packet_sock *po, int pow_off) { int idx, len; len = po->rx_ring.frame_max + 1; idx = po->rx_ring.head; if (pow_off) idx += len >> pow_off; if (idx >= len) idx -= len; return packet_lookup_frame(po, &po->rx_ring, idx, TP_STATUS_KERNEL); } ",0 "bool HTMLFormElement::checkValidity() { return !CheckInvalidControlsAndCollectUnhandled( nullptr, kCheckValidityDispatchInvalidEvent); } ",0 "void rvcc_del(GF_Box *s) { gf_free(s); } ",0 "static int __init i8042_setup_kbd(void) { int error; error = i8042_create_kbd_port(); if (error) return error; error = request_irq(I8042_KBD_IRQ, i8042_interrupt, IRQF_SHARED, ""i8042"", i8042_platform_device); if (error) goto err_free_port; error = i8042_enable_kbd_port(); if (error) goto err_free_irq; i8042_kbd_irq_registered = true; return 0; err_free_irq: free_irq(I8042_KBD_IRQ, i8042_platform_device); err_free_port: i8042_free_kbd_port(); return error; } ",0 "bool RenderBlock::paintsContinuationOutline(RenderInline* flow) { ContinuationOutlineTableMap* table = continuationOutlineTable(); if (table->isEmpty()) return false; ListHashSet* continuations = table->get(this); if (!continuations) return false; return continuations->contains(flow); } ",0 "size_t DiscardableSharedMemoryManager::GetBytesAllocated() { base::AutoLock lock(lock_); return bytes_allocated_; } ",0 "static v8::Handle unsignedLongLongSequenceAttrAttrGetter(v8::Local name, const v8::AccessorInfo& info) { INC_STATS(""DOM.TestObj.unsignedLongLongSequenceAttr._get""); TestObj* imp = V8TestObj::toNative(info.Holder()); return v8Array(imp->unsignedLongLongSequenceAttr(), info.GetIsolate()); } ",0 "error::Error GLES2DecoderImpl::HandleRequestExtensionCHROMIUM( uint32 immediate_data_size, const cmds::RequestExtensionCHROMIUM& c) { Bucket* bucket = GetBucket(c.bucket_id); if (!bucket || bucket->size() == 0) { return error::kInvalidArguments; } std::string feature_str; if (!bucket->GetAsString(&feature_str)) { return error::kInvalidArguments; } bool desire_webgl_glsl_validation = feature_str.find(""GL_CHROMIUM_webglsl"") != std::string::npos; bool desire_standard_derivatives = false; bool desire_frag_depth = false; bool desire_draw_buffers = false; bool desire_shader_texture_lod = false; if (force_webgl_glsl_validation_) { desire_standard_derivatives = feature_str.find(""GL_OES_standard_derivatives"") != std::string::npos; desire_frag_depth = feature_str.find(""GL_EXT_frag_depth"") != std::string::npos; desire_draw_buffers = feature_str.find(""GL_EXT_draw_buffers"") != std::string::npos; desire_shader_texture_lod = feature_str.find(""GL_EXT_shader_texture_lod"") != std::string::npos; } if (desire_webgl_glsl_validation != force_webgl_glsl_validation_ || desire_standard_derivatives != derivatives_explicitly_enabled_ || desire_frag_depth != frag_depth_explicitly_enabled_ || desire_draw_buffers != draw_buffers_explicitly_enabled_) { force_webgl_glsl_validation_ |= desire_webgl_glsl_validation; derivatives_explicitly_enabled_ |= desire_standard_derivatives; frag_depth_explicitly_enabled_ |= desire_frag_depth; draw_buffers_explicitly_enabled_ |= desire_draw_buffers; shader_texture_lod_explicitly_enabled_ |= desire_shader_texture_lod; InitializeShaderTranslator(); } UpdateCapabilities(); return error::kNoError; } ",0 "bool ResourceDispatcherHostImpl::HasSufficientResourcesForRequest( net::URLRequest* request) { ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); OustandingRequestsStats stats = IncrementOutstandingRequestsCount(1, info); if (stats.num_requests > max_num_in_flight_requests_per_process_) return false; if (num_in_flight_requests_ > max_num_in_flight_requests_) return false; return true; } ",0 "int32_t GetCallbackId() { static int32_t sCallId = 0; return ++sCallId; } ",0 "void RenderFrameHostImpl::DidCommitSameDocumentNavigation( std::unique_ptr validated_params) { ScopedActiveURL scoped_active_url( validated_params->url, frame_tree_node()->frame_tree()->root()->current_origin()); ScopedCommitStateResetter commit_state_resetter(this); if (!is_active()) return; TRACE_EVENT2(""navigation"", ""RenderFrameHostImpl::DidCommitSameDocumentNavigation"", ""frame_tree_node"", frame_tree_node_->frame_tree_node_id(), ""url"", validated_params->url.possibly_invalid_spec()); bool is_browser_initiated = same_document_navigation_request_ && (same_document_navigation_request_->commit_params().navigation_token == validated_params->navigation_token); if (!DidCommitNavigationInternal( is_browser_initiated ? std::move(same_document_navigation_request_) : nullptr, validated_params.get(), true /* is_same_document_navigation*/)) { return; } commit_state_resetter.disable(); } ",0 "R_API void r_config_list(RConfig *cfg, const char *str, int rad) { RConfigNode *node; RListIter *iter; const char *sfx = """"; const char *pfx = """"; int len = 0; bool verbose = false; bool json = false; bool isFirst = false; if (!STRNULL (str)) { str = r_str_chop_ro (str); len = strlen (str); if (len > 0 && str[0] == 'j') { str++; len--; json = true; rad = 'J'; } if (len > 0 && str[0] == ' ') { str++; len--; } if (strlen (str) == 0) { str = NULL; len = 0; } } switch (rad) { case 1: pfx = ""\""e ""; sfx = ""\""""; /* fallthrou */ case 0: r_list_foreach (cfg->nodes, iter, node) { if (!str || (str && (!strncmp (str, node->name, len)))) { config_print_node (cfg, node, pfx, sfx, verbose, json); } } break; case 2: r_list_foreach (cfg->nodes, iter, node) { if (!str || (str && (!strncmp (str, node->name, len)))) { if (!str || !strncmp (str, node->name, len)) { cfg->cb_printf (""%20s: %s\n"", node->name, node->desc? node->desc: """"); } } } break; case 'v': verbose = true; r_list_foreach (cfg->nodes, iter, node) { if (!str || (str && (!strncmp (str, node->name, len)))) { config_print_node (cfg, node, pfx, sfx, verbose, json); } } break; case 'q': r_list_foreach (cfg->nodes, iter, node) { cfg->cb_printf (""%s\n"", node->name); } break; case 'J': verbose = true; /* fallthrou */ case 'j': json = true; isFirst = true; if (verbose) { cfg->cb_printf (""[""); } else { cfg->cb_printf (""{""); } r_list_foreach (cfg->nodes, iter, node) { if (!str || (str && (!strncmp (str, node->name, len)))) { if (!str || !strncmp (str, node->name, len)) { if (isFirst) { isFirst = false; } else { cfg->cb_printf ("",""); } config_print_node (cfg, node, pfx, sfx, verbose, json); } } } if (verbose) { cfg->cb_printf (""]\n""); } else { cfg->cb_printf (""}\n""); } break; } } ",0 "selftest_fips_256 (int extended, selftest_report_func_t report) { const char *what; const char *errtxt; (void)extended; /* No extended tests available. */ what = ""low-level""; errtxt = selftest_basic_256 (); if (errtxt) goto failed; return 0; /* Succeeded. */ failed: if (report) report (""cipher"", GCRY_CIPHER_AES256, what, errtxt); return GPG_ERR_SELFTEST_FAILED; } ",0 "set_script_params_array(vector_t *strvec, notify_script_t *script, unsigned extra_params) { unsigned num_words = 0; size_t len = 0; char **word_ptrs; char *words; vector_t *strvec_qe = NULL; unsigned i; /* Count the number of words, and total string length */ if (vector_size(strvec) >= 2) strvec_qe = alloc_strvec_quoted_escaped(strvec_slot(strvec, 1)); if (!strvec_qe) return; num_words = vector_size(strvec_qe); for (i = 0; i < num_words; i++) len += strlen(strvec_slot(strvec_qe, i)) + 1; /* Allocate memory for pointers to words and words themselves */ script->args = word_ptrs = MALLOC((num_words + extra_params + 1) * sizeof(char *) + len); words = (char *)word_ptrs + (num_words + extra_params + 1) * sizeof(char *); /* Set up pointers to words, and copy the words */ for (i = 0; i < num_words; i++) { strcpy(words, strvec_slot(strvec_qe, i)); *(word_ptrs++) = words; words += strlen(words) + 1; } *word_ptrs = NULL; script->num_args = num_words; free_strvec(strvec_qe); } ",0 "static struct page *dequeue_huge_page_vma(struct hstate *h, struct vm_area_struct *vma, unsigned long address, int avoid_reserve) { struct page *page; struct mempolicy *mpol; nodemask_t *nodemask; struct zonelist *zonelist; struct zone *zone; struct zoneref *z; unsigned int cpuset_mems_cookie; retry_cpuset: cpuset_mems_cookie = get_mems_allowed(); zonelist = huge_zonelist(vma, address, htlb_alloc_mask, &mpol, &nodemask); /* * A child process with MAP_PRIVATE mappings created by their parent * have no page reserves. This check ensures that reservations are * not ""stolen"". The child may still get SIGKILLed */ if (!vma_has_reserves(vma) && h->free_huge_pages - h->resv_huge_pages == 0) goto err; /* If reserves cannot be used, ensure enough pages are in the pool */ if (avoid_reserve && h->free_huge_pages - h->resv_huge_pages == 0) goto err; for_each_zone_zonelist_nodemask(zone, z, zonelist, MAX_NR_ZONES - 1, nodemask) { if (cpuset_zone_allowed_softwall(zone, htlb_alloc_mask)) { page = dequeue_huge_page_node(h, zone_to_nid(zone)); if (page) { if (!avoid_reserve) decrement_hugepage_resv_vma(h, vma); break; } } } mpol_cond_put(mpol); if (unlikely(!put_mems_allowed(cpuset_mems_cookie) && !page)) goto retry_cpuset; return page; err: mpol_cond_put(mpol); return NULL; } ",0 "int CL_GetPingQueueCount( void ) { int i; int count; ping_t* pingptr; count = 0; pingptr = cl_pinglist; for (i=0; iadr.port) { count++; } } return (count); } ",0 "void GDataCache::RemoveObserver(Observer* observer) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); observers_.RemoveObserver(observer); } ",0 "static int create_window(PluginInstance *plugin, NPWindow *window) { if (plugin->is_windowless) { destroy_window_attributes(plugin->window.ws_info); plugin->window.ws_info = NULL; } assert(plugin->window.ws_info == NULL); NPSetWindowCallbackStruct *ws_info; if ((ws_info = NPW_MemClone(NPSetWindowCallbackStruct, window->ws_info)) == NULL) return -1; if (create_window_attributes(ws_info) < 0) return -1; memcpy(&plugin->window, window, sizeof(*window)); window = &plugin->window; window->ws_info = ws_info; fixup_size_hints(plugin); if (plugin->is_windowless) return 0; if (plugin->use_xembed) { GtkData *toolkit = calloc(1, sizeof(*toolkit)); if (toolkit == NULL) return -1; toolkit->container = gtk_plug_new((GdkNativeWindow)window->window); if (toolkit->container == NULL) return -1; gtk_widget_set_size_request(toolkit->container, window->width, window->height); gtk_widget_show(toolkit->container); toolkit->socket = gtk_socket_new(); if (toolkit->socket == NULL) return -1; gtk_widget_show(toolkit->socket); gtk_container_add(GTK_CONTAINER(toolkit->container), toolkit->socket); gtk_widget_show_all(toolkit->container); window->window = (void *)gtk_socket_get_id(GTK_SOCKET(toolkit->socket)); plugin->toolkit_data = toolkit; #if USE_XEMBED_HACK g_signal_connect(toolkit->container, ""delete-event"", G_CALLBACK(gtk_true), NULL); #endif g_signal_connect(toolkit->container, ""destroy"", G_CALLBACK(gtk_widget_destroyed), &toolkit->container); g_signal_connect(toolkit->socket, ""plug_removed"", G_CALLBACK(gtk_true), NULL); return 0; } XtData *toolkit = calloc(1, sizeof(*toolkit)); if (toolkit == NULL) return -1; String app_name, app_class; XtGetApplicationNameAndClass(x_display, &app_name, &app_class); Widget top_widget = XtVaAppCreateShell(""drawingArea"", app_class, topLevelShellWidgetClass, x_display, XtNoverrideRedirect, True, XtNborderWidth, 0, XtNbackgroundPixmap, None, XtNwidth, window->width, XtNheight, window->height, NULL); Widget form = XtVaCreateManagedWidget(""form"", compositeWidgetClass, top_widget, XtNdepth, ws_info->depth, XtNvisual, ws_info->visual, XtNcolormap, ws_info->colormap, XtNborderWidth, 0, XtNbackgroundPixmap, None, XtNwidth, window->width, XtNheight, window->height, NULL); XtRealizeWidget(top_widget); XReparentWindow(x_display, XtWindow(top_widget), (Window)window->window, 0, 0); XtRealizeWidget(form); XSelectInput(x_display, XtWindow(top_widget), 0x0fffff); XtAddEventHandler(top_widget, (SubstructureNotifyMask|KeyPress|KeyRelease), True, xt_client_event_handler, toolkit); XtAddEventHandler(form, (ButtonReleaseMask), True, xt_client_event_handler, toolkit); xt_client_set_info(form, 0); plugin->toolkit_data = toolkit; toolkit->top_widget = top_widget; toolkit->form = form; toolkit->browser_window = (Window)window->window; window->window = (void *)XtWindow(form); return 0; } ",0 "ChromeWebContentsDelegateAndroid::~ChromeWebContentsDelegateAndroid() { notification_registrar_.RemoveAll(); } ",0 "IsInterferingGrab(ClientPtr client, DeviceIntPtr dev, xEvent *event) { DeviceIntPtr it = inputInfo.devices; switch (event->u.u.type) { case KeyPress: case KeyRelease: case ButtonPress: case ButtonRelease: case MotionNotify: case EnterNotify: case LeaveNotify: break; default: return FALSE; } if (dev->deviceGrab.grab && SameClient(dev->deviceGrab.grab, client)) return FALSE; while (it) { if (it != dev) { if (it->deviceGrab.grab && SameClient(it->deviceGrab.grab, client) && !it->deviceGrab.fromPassiveGrab) { if ((IsPointerDevice(it) && IsPointerDevice(dev)) || (IsKeyboardDevice(it) && IsKeyboardDevice(dev))) return TRUE; } } it = it->next; } return FALSE; } ",0 "Eina_Bool ewk_frame_focused_element_geometry_get(const Evas_Object *ewkFrame, int *x, int *y, int *w, int *h) { EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData, false); WebCore::Document* document = smartData->frame->document(); if (!document) return false; WebCore::Node* focusedNode = document->focusedNode(); if (!focusedNode) return false; WebCore::IntRect nodeRect = focusedNode->getPixelSnappedRect(); if (x) *x = nodeRect.x(); if (y) *y = nodeRect.y(); if (w) *w = nodeRect.width(); if (h) *h = nodeRect.height(); return true; } ",0 "static struct file *aio_private_file(struct kioctx *ctx, loff_t nr_pages) { struct qstr this = QSTR_INIT(""[aio]"", 5); struct file *file; struct path path; struct inode *inode = alloc_anon_inode(aio_mnt->mnt_sb); if (IS_ERR(inode)) return ERR_CAST(inode); inode->i_mapping->a_ops = &aio_ctx_aops; inode->i_mapping->private_data = ctx; inode->i_size = PAGE_SIZE * nr_pages; path.dentry = d_alloc_pseudo(aio_mnt->mnt_sb, &this); if (!path.dentry) { iput(inode); return ERR_PTR(-ENOMEM); } path.mnt = mntget(aio_mnt); d_instantiate(path.dentry, inode); file = alloc_file(&path, FMODE_READ | FMODE_WRITE, &aio_ring_fops); if (IS_ERR(file)) { path_put(&path); return file; } file->f_flags = O_RDWR; file->private_data = ctx; return file; } ",0 "static int convertCompoundSelectToSubquery(Walker *pWalker, Select *p){ int i; Select *pNew; Select *pX; sqlite3 *db; struct ExprList_item *a; SrcList *pNewSrc; Parse *pParse; Token dummy; if( p->pPrior==0 ) return WRC_Continue; if( p->pOrderBy==0 ) return WRC_Continue; for(pX=p; pX && (pX->op==TK_ALL || pX->op==TK_SELECT); pX=pX->pPrior){} if( pX==0 ) return WRC_Continue; a = p->pOrderBy->a; for(i=p->pOrderBy->nExpr-1; i>=0; i--){ if( a[i].pExpr->flags & EP_Collate ) break; } if( i<0 ) return WRC_Continue; /* If we reach this point, that means the transformation is required. */ pParse = pWalker->pParse; db = pParse->db; pNew = sqlite3DbMallocZero(db, sizeof(*pNew) ); if( pNew==0 ) return WRC_Abort; memset(&dummy, 0, sizeof(dummy)); pNewSrc = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&dummy,pNew,0,0); if( pNewSrc==0 ) return WRC_Abort; *pNew = *p; p->pSrc = pNewSrc; p->pEList = sqlite3ExprListAppend(pParse, 0, sqlite3Expr(db, TK_ASTERISK, 0)); p->op = TK_SELECT; p->pWhere = 0; pNew->pGroupBy = 0; pNew->pHaving = 0; pNew->pOrderBy = 0; p->pPrior = 0; p->pNext = 0; p->pWith = 0; p->selFlags &= ~SF_Compound; assert( (p->selFlags & SF_Converted)==0 ); p->selFlags |= SF_Converted; assert( pNew->pPrior!=0 ); pNew->pPrior->pNext = pNew; pNew->pLimit = 0; return WRC_Continue; } ",0 "static int fuse_release(struct inode *inode, struct file *file) { fuse_release_common(file, FUSE_RELEASE); /* return value is ignored by VFS */ return 0; } ",0 " UsbSetInterfaceAlternateSettingFunction() { } ",0 "static int sysvipc_msg_proc_show(struct seq_file *s, void *it) { struct user_namespace *user_ns = seq_user_ns(s); struct msg_queue *msq = it; seq_printf(s, ""%10d %10d %4o %10lu %10lu %5u %5u %5u %5u %5u %5u %10lu %10lu %10lu\n"", msq->q_perm.key, msq->q_perm.id, msq->q_perm.mode, msq->q_cbytes, msq->q_qnum, msq->q_lspid, msq->q_lrpid, from_kuid_munged(user_ns, msq->q_perm.uid), from_kgid_munged(user_ns, msq->q_perm.gid), from_kuid_munged(user_ns, msq->q_perm.cuid), from_kgid_munged(user_ns, msq->q_perm.cgid), msq->q_stime, msq->q_rtime, msq->q_ctime); return 0; } ",0 "SPICE_GNUC_VISIBLE void spice_server_set_addr(SpiceServer *s, const char *addr, int flags) { spice_assert(reds == s); g_strlcpy(spice_addr, addr, sizeof(spice_addr)); if (flags & SPICE_ADDR_FLAG_IPV4_ONLY) { spice_family = PF_INET; } if (flags & SPICE_ADDR_FLAG_IPV6_ONLY) { spice_family = PF_INET6; } } ",0 "static int mct_u232_get_modem_stat(struct usb_serial_port *port, unsigned char *msr) { int rc; unsigned char *buf; buf = kmalloc(MCT_U232_MAX_SIZE, GFP_KERNEL); if (buf == NULL) { *msr = 0; return -ENOMEM; } rc = usb_control_msg(port->serial->dev, usb_rcvctrlpipe(port->serial->dev, 0), MCT_U232_GET_MODEM_STAT_REQUEST, MCT_U232_GET_REQUEST_TYPE, 0, 0, buf, MCT_U232_GET_MODEM_STAT_SIZE, WDR_TIMEOUT); if (rc < 0) { dev_err(&port->dev, ""Get MODEM STATus failed (error = %d)\n"", rc); *msr = 0; } else { *msr = buf[0]; } dev_dbg(&port->dev, ""get_modem_stat: 0x%x\n"", *msr); kfree(buf); return rc; } /* mct_u232_get_modem_stat */ ",0 "static void handle_exif_density(struct iwjpegrcontext *rctx, struct iw_image *img) { if(img->density_code!=IW_DENSITY_UNKNOWN) { return; } if(rctx->exif_density_x<=0.0 || rctx->exif_density_y<=0.0) return; switch(rctx->exif_density_unit) { case 1: // No units if(fabs(rctx->exif_density_x-rctx->exif_density_y)<0.00001) return; // Square, unitless pixels = no meaningful information. img->density_x = rctx->exif_density_x; img->density_y = rctx->exif_density_y; img->density_code = IW_DENSITY_UNITS_UNKNOWN; break; case 2: // Inches img->density_x = rctx->exif_density_x/0.0254; img->density_y = rctx->exif_density_y/0.0254; img->density_code = IW_DENSITY_UNITS_PER_METER; break; case 3: // Centimeters img->density_x = rctx->exif_density_x*100.0; img->density_y = rctx->exif_density_y*100.0; img->density_code = IW_DENSITY_UNITS_PER_METER; break; } } ",0 "void CustomButton::OnMouseMoved(const ui::MouseEvent& event) { if (state_ != STATE_DISABLED) SetState(HitTestPoint(event.location()) ? STATE_HOVERED : STATE_NORMAL); } ",0 "void ContainerNode::removeChildren(SubtreeModificationAction action) { if (!m_firstChild) return; RefPtrWillBeRawPtr protect(this); willRemoveChildren(); { SubframeLoadingDisabler disabler(*this); document().removeFocusedElementOfSubtree(this, true); document().nodeChildrenWillBeRemoved(*this); } #if !ENABLE(OILPAN) NodeVector removedChildren; #endif { HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates; { EventDispatchForbiddenScope assertNoEventDispatch; ScriptForbiddenScope forbidScript; #if !ENABLE(OILPAN) removedChildren.reserveInitialCapacity(countChildren()); #endif while (RefPtrWillBeRawPtr child = m_firstChild) { removeBetween(0, child->nextSibling(), *child); #if !ENABLE(OILPAN) removedChildren.append(child.get()); #endif notifyNodeRemoved(*child); } } ChildrenChange change = {AllChildrenRemoved, nullptr, nullptr, ChildrenChangeSourceAPI}; childrenChanged(change); } if (action == DispatchSubtreeModifiedEvent) dispatchSubtreeModifiedEvent(); } ",0 "static void shift_arg(php_http_buffer_t *buf, char *key_str, size_t key_len, zval *zvalue, const char *ass, size_t asl, const char *vss, size_t vsl, unsigned flags TSRMLS_DC) { if (Z_TYPE_P(zvalue) == IS_ARRAY || Z_TYPE_P(zvalue) == IS_OBJECT) { HashPosition pos; php_http_array_hashkey_t key = php_http_array_hashkey_init(0); zval **val; zend_bool rfc5987 = !strcmp(key_str, ""*rfc5987*""); if (!rfc5987) { shift_key(buf, key_str, key_len, ass, asl, flags TSRMLS_CC); } FOREACH_KEYVAL(pos, zvalue, key, val) { /* did you mean recursion? */ php_http_array_hashkey_stringify(&key); if (rfc5987 && (Z_TYPE_PP(val) == IS_ARRAY || Z_TYPE_PP(val) == IS_OBJECT)) { shift_key(buf, key.str, key.len-1, ass, asl, flags TSRMLS_CC); shift_rfc5987(buf, *val, vss, vsl, flags TSRMLS_CC); } else { shift_arg(buf, key.str, key.len-1, *val, ass, asl, vss, vsl, flags TSRMLS_CC); } php_http_array_hashkey_stringfree(&key); } } else { shift_key(buf, key_str, key_len, ass, asl, flags TSRMLS_CC); if (flags & PHP_HTTP_PARAMS_RFC5988) { switch (key_len) { case lenof(""rel""): case lenof(""title""): case lenof(""anchor""): /* some args must be quoted */ if (0 <= php_http_select_str(key_str, 3, ""rel"", ""title"", ""anchor"")) { shift_rfc5988_val(buf, zvalue, vss, vsl, flags TSRMLS_CC); return; } break; } } shift_val(buf, zvalue, vss, vsl, flags TSRMLS_CC); } } ",0 "HTMLElement* Document::body() const { if (!documentElement() || !isHTMLHtmlElement(documentElement())) return 0; for (HTMLElement* child = Traversal::firstChild(*documentElement()); child; child = Traversal::nextSibling(*child)) { if (isHTMLFrameSetElement(*child) || isHTMLBodyElement(*child)) return child; } return 0; } ",0 "static void get_frame_stats(vpx_codec_ctx_t *ctx, const vpx_image_t *img, vpx_codec_pts_t pts, unsigned int duration, vpx_enc_frame_flags_t flags, unsigned int deadline, vpx_fixed_buf_t *stats) { vpx_codec_iter_t iter = NULL; const vpx_codec_cx_pkt_t *pkt = NULL; const vpx_codec_err_t res = vpx_codec_encode(ctx, img, pts, duration, flags, deadline); if (res != VPX_CODEC_OK) die_codec(ctx, ""Failed to get frame stats.""); while ((pkt = vpx_codec_get_cx_data(ctx, &iter)) != NULL) { if (pkt->kind == VPX_CODEC_STATS_PKT) { const uint8_t *const pkt_buf = pkt->data.twopass_stats.buf; const size_t pkt_size = pkt->data.twopass_stats.sz; stats->buf = realloc(stats->buf, stats->sz + pkt_size); memcpy((uint8_t *)stats->buf + stats->sz, pkt_buf, pkt_size); stats->sz += pkt_size; } } } ",1 " ~DownloadObserver() { download_manager_->RemoveObserver(this); } ",0 "void AppCacheUpdateJob::OnManifestInfoWriteComplete(int result) { if (result > 0) { scoped_refptr io_buffer = base::MakeRefCounted(manifest_data_); manifest_response_writer_->WriteData( io_buffer.get(), manifest_data_.length(), base::BindOnce(&AppCacheUpdateJob::OnManifestDataWriteComplete, base::Unretained(this))); } else { HandleCacheFailure( blink::mojom::AppCacheErrorDetails( ""Failed to write the manifest headers to storage"", blink::mojom::AppCacheErrorReason::APPCACHE_UNKNOWN_ERROR, GURL(), 0, false /*is_cross_origin*/), DISKCACHE_ERROR, GURL()); } } ",0 "bool HTMLFormControlElement::IsSuccessfulSubmitButton() const { return CanBeSuccessfulSubmitButton() && !IsDisabledFormControl(); } ",0 "static int vq_memory_access_ok(void __user *log_base, struct vhost_memory *mem, int log_all) { int i; if (!mem) return 0; for (i = 0; i < mem->nregions; ++i) { struct vhost_memory_region *m = mem->regions + i; unsigned long a = m->userspace_addr; if (m->memory_size > ULONG_MAX) return 0; else if (!access_ok(VERIFY_WRITE, (void __user *)a, m->memory_size)) return 0; else if (log_all && !log_access_ok(log_base, m->guest_phys_addr, m->memory_size)) return 0; } return 1; } ",0 "opj_bool pi_create_encode(opj_pi_iterator_t *pi, opj_cp_t *cp, int tileno, int pino, int tpnum, int tppos, J2K_T2_MODE t2_mode, int cur_totnum_tp) { char prog[4]; int i; int incr_top = 1, resetX = 0; opj_tcp_t *tcps = &cp->tcps[tileno]; opj_poc_t *tcp = &tcps->pocs[pino]; pi[pino].first = 1; pi[pino].poc.prg = tcp->prg; switch (tcp->prg) { case CPRL: strncpy(prog, ""CPRL"", 4); break; case LRCP: strncpy(prog, ""LRCP"", 4); break; case PCRL: strncpy(prog, ""PCRL"", 4); break; case RLCP: strncpy(prog, ""RLCP"", 4); break; case RPCL: strncpy(prog, ""RPCL"", 4); break; case PROG_UNKNOWN: return OPJ_TRUE; } if (!(cp->tp_on && ((!cp->cinema && (t2_mode == FINAL_PASS)) || cp->cinema))) { pi[pino].poc.resno0 = tcp->resS; pi[pino].poc.resno1 = tcp->resE; pi[pino].poc.compno0 = tcp->compS; pi[pino].poc.compno1 = tcp->compE; pi[pino].poc.layno0 = tcp->layS; pi[pino].poc.layno1 = tcp->layE; pi[pino].poc.precno0 = tcp->prcS; pi[pino].poc.precno1 = tcp->prcE; pi[pino].poc.tx0 = tcp->txS; pi[pino].poc.ty0 = tcp->tyS; pi[pino].poc.tx1 = tcp->txE; pi[pino].poc.ty1 = tcp->tyE; } else { if (tpnum < cur_totnum_tp) { for (i = 3; i >= 0; i--) { switch (prog[i]) { case 'C': if (i > tppos) { pi[pino].poc.compno0 = tcp->compS; pi[pino].poc.compno1 = tcp->compE; } else { if (tpnum == 0) { tcp->comp_t = tcp->compS; pi[pino].poc.compno0 = tcp->comp_t; pi[pino].poc.compno1 = tcp->comp_t + 1; tcp->comp_t += 1; } else { if (incr_top == 1) { if (tcp->comp_t == tcp->compE) { tcp->comp_t = tcp->compS; pi[pino].poc.compno0 = tcp->comp_t; pi[pino].poc.compno1 = tcp->comp_t + 1; tcp->comp_t += 1; incr_top = 1; } else { pi[pino].poc.compno0 = tcp->comp_t; pi[pino].poc.compno1 = tcp->comp_t + 1; tcp->comp_t += 1; incr_top = 0; } } else { pi[pino].poc.compno0 = tcp->comp_t - 1; pi[pino].poc.compno1 = tcp->comp_t; } } } break; case 'R': if (i > tppos) { pi[pino].poc.resno0 = tcp->resS; pi[pino].poc.resno1 = tcp->resE; } else { if (tpnum == 0) { tcp->res_t = tcp->resS; pi[pino].poc.resno0 = tcp->res_t; pi[pino].poc.resno1 = tcp->res_t + 1; tcp->res_t += 1; } else { if (incr_top == 1) { if (tcp->res_t == tcp->resE) { tcp->res_t = tcp->resS; pi[pino].poc.resno0 = tcp->res_t; pi[pino].poc.resno1 = tcp->res_t + 1; tcp->res_t += 1; incr_top = 1; } else { pi[pino].poc.resno0 = tcp->res_t; pi[pino].poc.resno1 = tcp->res_t + 1; tcp->res_t += 1; incr_top = 0; } } else { pi[pino].poc.resno0 = tcp->res_t - 1; pi[pino].poc.resno1 = tcp->res_t; } } } break; case 'L': if (i > tppos) { pi[pino].poc.layno0 = tcp->layS; pi[pino].poc.layno1 = tcp->layE; } else { if (tpnum == 0) { tcp->lay_t = tcp->layS; pi[pino].poc.layno0 = tcp->lay_t; pi[pino].poc.layno1 = tcp->lay_t + 1; tcp->lay_t += 1; } else { if (incr_top == 1) { if (tcp->lay_t == tcp->layE) { tcp->lay_t = tcp->layS; pi[pino].poc.layno0 = tcp->lay_t; pi[pino].poc.layno1 = tcp->lay_t + 1; tcp->lay_t += 1; incr_top = 1; } else { pi[pino].poc.layno0 = tcp->lay_t; pi[pino].poc.layno1 = tcp->lay_t + 1; tcp->lay_t += 1; incr_top = 0; } } else { pi[pino].poc.layno0 = tcp->lay_t - 1; pi[pino].poc.layno1 = tcp->lay_t; } } } break; case 'P': switch (tcp->prg) { case LRCP: case RLCP: if (i > tppos) { pi[pino].poc.precno0 = tcp->prcS; pi[pino].poc.precno1 = tcp->prcE; } else { if (tpnum == 0) { tcp->prc_t = tcp->prcS; pi[pino].poc.precno0 = tcp->prc_t; pi[pino].poc.precno1 = tcp->prc_t + 1; tcp->prc_t += 1; } else { if (incr_top == 1) { if (tcp->prc_t == tcp->prcE) { tcp->prc_t = tcp->prcS; pi[pino].poc.precno0 = tcp->prc_t; pi[pino].poc.precno1 = tcp->prc_t + 1; tcp->prc_t += 1; incr_top = 1; } else { pi[pino].poc.precno0 = tcp->prc_t; pi[pino].poc.precno1 = tcp->prc_t + 1; tcp->prc_t += 1; incr_top = 0; } } else { pi[pino].poc.precno0 = tcp->prc_t - 1; pi[pino].poc.precno1 = tcp->prc_t; } } } break; default: if (i > tppos) { pi[pino].poc.tx0 = tcp->txS; pi[pino].poc.ty0 = tcp->tyS; pi[pino].poc.tx1 = tcp->txE; pi[pino].poc.ty1 = tcp->tyE; } else { if (tpnum == 0) { tcp->tx0_t = tcp->txS; tcp->ty0_t = tcp->tyS; pi[pino].poc.tx0 = tcp->tx0_t; pi[pino].poc.tx1 = tcp->tx0_t + tcp->dx - (tcp->tx0_t % tcp->dx); pi[pino].poc.ty0 = tcp->ty0_t; pi[pino].poc.ty1 = tcp->ty0_t + tcp->dy - (tcp->ty0_t % tcp->dy); tcp->tx0_t = pi[pino].poc.tx1; tcp->ty0_t = pi[pino].poc.ty1; } else { if (incr_top == 1) { if (tcp->tx0_t >= tcp->txE) { if (tcp->ty0_t >= tcp->tyE) { tcp->ty0_t = tcp->tyS; pi[pino].poc.ty0 = tcp->ty0_t; pi[pino].poc.ty1 = tcp->ty0_t + tcp->dy - (tcp->ty0_t % tcp->dy); tcp->ty0_t = pi[pino].poc.ty1; incr_top = 1; resetX = 1; } else { pi[pino].poc.ty0 = tcp->ty0_t; pi[pino].poc.ty1 = tcp->ty0_t + tcp->dy - (tcp->ty0_t % tcp->dy); tcp->ty0_t = pi[pino].poc.ty1; incr_top = 0; resetX = 1; } if (resetX == 1) { tcp->tx0_t = tcp->txS; pi[pino].poc.tx0 = tcp->tx0_t; pi[pino].poc.tx1 = tcp->tx0_t + tcp->dx - (tcp->tx0_t % tcp->dx); tcp->tx0_t = pi[pino].poc.tx1; } } else { pi[pino].poc.tx0 = tcp->tx0_t; pi[pino].poc.tx1 = tcp->tx0_t + tcp->dx - (tcp->tx0_t % tcp->dx); tcp->tx0_t = pi[pino].poc.tx1; pi[pino].poc.ty0 = tcp->ty0_t - tcp->dy - (tcp->ty0_t % tcp->dy); pi[pino].poc.ty1 = tcp->ty0_t ; incr_top = 0; } } else { pi[pino].poc.tx0 = tcp->tx0_t - tcp->dx - (tcp->tx0_t % tcp->dx); pi[pino].poc.tx1 = tcp->tx0_t ; pi[pino].poc.ty0 = tcp->ty0_t - tcp->dy - (tcp->ty0_t % tcp->dy); pi[pino].poc.ty1 = tcp->ty0_t ; } } } break; } break; } } } } return OPJ_FALSE; } ",0 " BpHDCPObserver(const sp &impl) : BpInterface(impl) { } ",0 "static void jsB_Number(js_State *J) { js_pushnumber(J, js_gettop(J) > 1 ? js_tonumber(J, 1) : 0); } ",0 "int OBJ_obj2nid(const ASN1_OBJECT *a) { const unsigned int *op; ADDED_OBJ ad,*adp; if (a == NULL) return(NID_undef); if (a->nid != 0) return(a->nid); if (added != NULL) { ad.type=ADDED_DATA; ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */ adp=lh_ADDED_OBJ_retrieve(added,&ad); if (adp != NULL) return (adp->obj->nid); } op=OBJ_bsearch_obj(&a, obj_objs, NUM_OBJ); if (op == NULL) return(NID_undef); return(nid_objs[*op].nid); } ",0 "ping_t* CL_GetFreePing( void ) { ping_t* pingptr; ping_t* best; int oldest; int i; int time; pingptr = cl_pinglist; for (i=0; iadr.port) { if (!pingptr->time) { if (Sys_Milliseconds() - pingptr->start < 500) { continue; } } else if (pingptr->time < 500) { continue; } } pingptr->adr.port = 0; return (pingptr); } pingptr = cl_pinglist; best = cl_pinglist; oldest = INT_MIN; for (i=0; istart; if (time > oldest) { oldest = time; best = pingptr; } } return (best); } ",0 "void RenderBox::imageChanged(WrappedImagePtr image, const IntRect*) { if (!parent()) return; if ((style()->borderImage().image() && style()->borderImage().image()->data() == image) || (style()->maskBoxImage().image() && style()->maskBoxImage().image()->data() == image)) { repaint(); return; } bool didFullRepaint = repaintLayerRectsForImage(image, style()->backgroundLayers(), true); if (!didFullRepaint) repaintLayerRectsForImage(image, style()->maskLayers(), false); #if USE(ACCELERATED_COMPOSITING) if (hasLayer() && layer()->hasCompositedMask() && layersUseImage(image, style()->maskLayers())) layer()->contentChanged(RenderLayer::MaskImageChanged); #endif } ",0 "HTMLAnchorElement* HTMLAnchorElement::create(Document& document) { return new HTMLAnchorElement(aTag, document); } ",0 " static void RegisterPropertiesHandler( void* object, const ImePropertyList& prop_list) { if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { LOG(ERROR) << ""Not on UI thread""; return; } InputMethodLibraryImpl* input_method_library = static_cast(object); input_method_library->RegisterProperties(prop_list); } ",1 "WebPluginDelegateProxy::WebPluginDelegateProxy( const std::string& mime_type, const base::WeakPtr& render_view) : render_view_(render_view), plugin_(NULL), uses_shared_bitmaps_(false), window_(gfx::kNullPluginWindow), mime_type_(mime_type), instance_id_(MSG_ROUTING_NONE), npobject_(NULL), sad_plugin_(NULL), invalidate_pending_(false), transparent_(false), page_url_(render_view_->webview()->mainFrame()->url()) { } ",0 "PassOwnPtr Document::createLifecycleNotifier() { return DocumentLifecycleNotifier::create(this); } ",0 " mojo::ScopedSharedBufferHandle GamepadProvider::GetSharedBufferHandle() { base::SharedMemoryHandle handle = base::SharedMemory::DuplicateHandle( gamepad_shared_buffer_->shared_memory()->handle()); return mojo::WrapSharedMemoryHandle(handle, sizeof(GamepadHardwareBuffer), true /* read_only */); } ",1 "nfsreply_print_noaddr(netdissect_options *ndo, register const u_char *bp, u_int length, register const u_char *bp2) { register const struct sunrpc_msg *rp; uint32_t proc, vers, reply_stat; enum sunrpc_reject_stat rstat; uint32_t rlow; uint32_t rhigh; enum sunrpc_auth_stat rwhy; nfserr = 0; /* assume no error */ rp = (const struct sunrpc_msg *)bp; ND_TCHECK(rp->rm_reply.rp_stat); reply_stat = EXTRACT_32BITS(&rp->rm_reply.rp_stat); switch (reply_stat) { case SUNRPC_MSG_ACCEPTED: ND_PRINT((ndo, ""reply ok %u"", length)); if (xid_map_find(rp, bp2, &proc, &vers) >= 0) interp_reply(ndo, rp, proc, vers, length); break; case SUNRPC_MSG_DENIED: ND_PRINT((ndo, ""reply ERR %u: "", length)); ND_TCHECK(rp->rm_reply.rp_reject.rj_stat); rstat = EXTRACT_32BITS(&rp->rm_reply.rp_reject.rj_stat); switch (rstat) { case SUNRPC_RPC_MISMATCH: ND_TCHECK(rp->rm_reply.rp_reject.rj_vers.high); rlow = EXTRACT_32BITS(&rp->rm_reply.rp_reject.rj_vers.low); rhigh = EXTRACT_32BITS(&rp->rm_reply.rp_reject.rj_vers.high); ND_PRINT((ndo, ""RPC Version mismatch (%u-%u)"", rlow, rhigh)); break; case SUNRPC_AUTH_ERROR: ND_TCHECK(rp->rm_reply.rp_reject.rj_why); rwhy = EXTRACT_32BITS(&rp->rm_reply.rp_reject.rj_why); ND_PRINT((ndo, ""Auth %s"", tok2str(sunrpc_auth_str, ""Invalid failure code %u"", rwhy))); break; default: ND_PRINT((ndo, ""Unknown reason for rejecting rpc message %u"", (unsigned int)rstat)); break; } break; default: ND_PRINT((ndo, ""reply Unknown rpc response code=%u %u"", reply_stat, length)); break; } return; trunc: if (!nfserr) ND_PRINT((ndo, ""%s"", tstr)); } ",0 "CCHAR GetReceiveQueueForCurrentCPU(PARANDIS_ADAPTER *pContext) { #if PARANDIS_SUPPORT_RSS return ParaNdis6_RSSGetCurrentCpuReceiveQueue(&pContext->RSSParameters); #else UNREFERENCED_PARAMETER(pContext); return PARANDIS_RECEIVE_QUEUE_UNCLASSIFIED; #endif } ",0 "void OffscreenCanvasSurfaceImpl::WillDrawSurface(const cc::SurfaceId& id, const gfx::Rect& damage_rect) { } ",1 "status_t MediaHTTP::getSize(off64_t *size) { if (mInitCheck != OK) { return mInitCheck; } if (!mCachedSizeValid) { mCachedSize = mHTTPConnection->getSize(); mCachedSizeValid = true; } *size = mCachedSize; return *size < 0 ? *size : static_cast(OK); } ",0 "gp_bgr16(Pixel *p, png_const_voidp pb) { png_const_uint_16p pp = voidcast(png_const_uint_16p, pb); p->r = pp[2]; p->g = pp[1]; p->b = pp[0]; p->a = 65535; } ",0 "dissect_80211n_mac_phy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int data_len, guint32 *n_mac_flags, guint32 *ampdu_id, struct ieee_802_11_phdr *phdr) { proto_tree *ftree; proto_item *ti; ptvcursor_t *csr; guint8 mcs; guint8 ness; guint16 ext_frequency; gchar *chan_str; ftree = proto_tree_add_subtree(tree, tvb, offset, data_len, ett_dot11n_mac_phy, NULL, ""802.11n MAC+PHY""); add_ppi_field_header(tvb, ftree, &offset); data_len -= 4; /* Subtract field header length */ if (data_len != PPI_80211N_MAC_PHY_LEN) { proto_tree_add_expert_format(ftree, pinfo, &ei_ppi_invalid_length, tvb, offset, data_len, ""Invalid length: %u"", data_len); THROW(ReportedBoundsError); } dissect_80211n_mac(tvb, pinfo, ftree, offset, PPI_80211N_MAC_LEN, FALSE, n_mac_flags, ampdu_id, phdr); offset += PPI_80211N_MAC_PHY_OFF; csr = ptvcursor_new(ftree, tvb, offset); mcs = tvb_get_guint8(tvb, ptvcursor_current_offset(csr)); if (mcs != 255) { phdr->phy_info.info_11n.presence_flags |= PHDR_802_11N_HAS_MCS_INDEX; phdr->phy_info.info_11n.mcs_index = mcs; } ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_mcs, 1, 255); ness = tvb_get_guint8(tvb, ptvcursor_current_offset(csr)); phdr->phy_info.info_11n.presence_flags |= PHDR_802_11N_HAS_NESS; phdr->phy_info.info_11n.ness = ness; ti = ptvcursor_add(csr, hf_80211n_mac_phy_num_streams, 1, ENC_LITTLE_ENDIAN); if (tvb_get_guint8(tvb, ptvcursor_current_offset(csr) - 1) == 0) proto_item_append_text(ti, "" (unknown)""); ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_rssi_combined, 1, 255); ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_rssi_ant0_ctl, 1, 255); ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_rssi_ant1_ctl, 1, 255); ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_rssi_ant2_ctl, 1, 255); ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_rssi_ant3_ctl, 1, 255); ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_rssi_ant0_ext, 1, 255); ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_rssi_ant1_ext, 1, 255); ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_rssi_ant2_ext, 1, 255); ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_rssi_ant3_ext, 1, 255); ext_frequency = tvb_get_letohs(ptvcursor_tvbuff(csr), ptvcursor_current_offset(csr)); chan_str = ieee80211_mhz_to_str(ext_frequency); proto_tree_add_uint_format(ptvcursor_tree(csr), hf_80211n_mac_phy_ext_chan_freq, ptvcursor_tvbuff(csr), ptvcursor_current_offset(csr), 2, ext_frequency, ""Ext. Channel frequency: %s"", chan_str); g_free(chan_str); ptvcursor_advance(csr, 2); ptvcursor_add_with_subtree(csr, hf_80211n_mac_phy_ext_chan_flags, 2, ENC_LITTLE_ENDIAN, ett_dot11n_mac_phy_ext_channel_flags); ptvcursor_add_no_advance(csr, hf_80211n_mac_phy_ext_chan_flags_turbo, 2, ENC_LITTLE_ENDIAN); ptvcursor_add_no_advance(csr, hf_80211n_mac_phy_ext_chan_flags_cck, 2, ENC_LITTLE_ENDIAN); ptvcursor_add_no_advance(csr, hf_80211n_mac_phy_ext_chan_flags_ofdm, 2, ENC_LITTLE_ENDIAN); ptvcursor_add_no_advance(csr, hf_80211n_mac_phy_ext_chan_flags_2ghz, 2, ENC_LITTLE_ENDIAN); ptvcursor_add_no_advance(csr, hf_80211n_mac_phy_ext_chan_flags_5ghz, 2, ENC_LITTLE_ENDIAN); ptvcursor_add_no_advance(csr, hf_80211n_mac_phy_ext_chan_flags_passive, 2, ENC_LITTLE_ENDIAN); ptvcursor_add_no_advance(csr, hf_80211n_mac_phy_ext_chan_flags_dynamic, 2, ENC_LITTLE_ENDIAN); ptvcursor_add(csr, hf_80211n_mac_phy_ext_chan_flags_gfsk, 2, ENC_LITTLE_ENDIAN); ptvcursor_pop_subtree(csr); ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_dbm_ant0signal, 1, 0x80); /* -128 */ ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_dbm_ant0noise, 1, 0x80); ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_dbm_ant1signal, 1, 0x80); ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_dbm_ant1noise, 1, 0x80); ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_dbm_ant2signal, 1, 0x80); ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_dbm_ant2noise, 1, 0x80); ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_dbm_ant3signal, 1, 0x80); ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_dbm_ant3noise, 1, 0x80); ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_evm0, 4, 0); ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_evm1, 4, 0); ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_evm2, 4, 0); ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_evm3, 4, 0); ptvcursor_free(csr); } ",0 "nautilus_directory_schedule_dequeue_pending (NautilusDirectory *directory) { if (directory->details->dequeue_pending_idle_id == 0) { directory->details->dequeue_pending_idle_id = g_idle_add (dequeue_pending_idle_callback, directory); } } ",0 "void ManifestManager::ResolveCallbacks(ResolveState state) { if (state == ResolveStateFailure) manifest_ = Manifest(); manifest_dirty_ = state != ResolveStateSuccess; std::vector callbacks; swap(callbacks, pending_callbacks_); for (auto& callback : callbacks) { std::move(callback).Run(manifest_url_, manifest_, manifest_debug_info_.get()); } } ",0 "static struct sctp_chunk *sctp_make_asconf_ack(const struct sctp_association *asoc, __u32 serial, int vparam_len) { sctp_addiphdr_t asconf; struct sctp_chunk *retval; int length = sizeof(asconf) + vparam_len; /* Create the chunk. */ retval = sctp_make_control(asoc, SCTP_CID_ASCONF_ACK, 0, length); if (!retval) return NULL; asconf.serial = htonl(serial); retval->subh.addip_hdr = sctp_addto_chunk(retval, sizeof(asconf), &asconf); return retval; } ",0 "static void default_print_section_footer(WriterContext *wctx) { DefaultContext *def = wctx->priv; const struct section *section = wctx->section[wctx->level]; char buf[32]; if (def->noprint_wrappers || def->nested_section[wctx->level]) return; if (!(section->flags & (SECTION_FLAG_IS_WRAPPER|SECTION_FLAG_IS_ARRAY))) printf(""[/%s]\n"", upcase_string(buf, sizeof(buf), section->name)); } ",0 "static int __set_tracer_option(struct trace_array *tr, struct tracer_flags *tracer_flags, struct tracer_opt *opts, int neg) { struct tracer *trace = tracer_flags->trace; int ret; ret = trace->set_flag(tr, tracer_flags->val, opts->bit, !neg); if (ret) return ret; if (neg) tracer_flags->val &= ~opts->bit; else tracer_flags->val |= opts->bit; return 0; } ",0 "void LayerTreeHostImpl::SetViewportDamage(const gfx::Rect& damage_rect) { viewport_damage_rect_.Union(damage_rect); } ",0 "OMX_ERRORTYPE omx_vdec::component_deinit(OMX_IN OMX_HANDLETYPE hComp) { (void) hComp; #ifdef _ANDROID_ if (iDivXDrmDecrypt) { delete iDivXDrmDecrypt; iDivXDrmDecrypt=NULL; } #endif //_ANDROID_ unsigned i = 0; if (OMX_StateLoaded != m_state) { DEBUG_PRINT_ERROR(""WARNING:Rxd DeInit,OMX not in LOADED state %d"",\ m_state); DEBUG_PRINT_ERROR(""Playback Ended - FAILED""); } else { DEBUG_PRINT_HIGH(""Playback Ended - PASSED""); } /*Check if the output buffers have to be cleaned up*/ if (m_out_mem_ptr) { DEBUG_PRINT_LOW(""Freeing the Output Memory""); for (i = 0; i < drv_ctx.op_buf.actualcount; i++ ) { free_output_buffer (&m_out_mem_ptr[i]); } #ifdef _ANDROID_ICS_ memset(&native_buffer, 0, (sizeof(nativebuffer) * MAX_NUM_INPUT_OUTPUT_BUFFERS)); #endif } /*Check if the input buffers have to be cleaned up*/ if (m_inp_mem_ptr || m_inp_heap_ptr) { DEBUG_PRINT_LOW(""Freeing the Input Memory""); for (i = 0; iarSsidLen = 0; A_MEMZERO(ar->arSsid, sizeof(ar->arSsid)); switch(fwmode) { case HI_OPTION_FW_MODE_IBSS: ar->arNetworkType = ar->arNextMode = ADHOC_NETWORK; break; case HI_OPTION_FW_MODE_BSS_STA: ar->arNetworkType = ar->arNextMode = INFRA_NETWORK; break; case HI_OPTION_FW_MODE_AP: ar->arNetworkType = ar->arNextMode = AP_NETWORK; break; } ar->arDot11AuthMode = OPEN_AUTH; ar->arAuthMode = NONE_AUTH; ar->arPairwiseCrypto = NONE_CRYPT; ar->arPairwiseCryptoLen = 0; ar->arGroupCrypto = NONE_CRYPT; ar->arGroupCryptoLen = 0; A_MEMZERO(ar->arWepKeyList, sizeof(ar->arWepKeyList)); A_MEMZERO(ar->arReqBssid, sizeof(ar->arReqBssid)); A_MEMZERO(ar->arBssid, sizeof(ar->arBssid)); ar->arBssChannel = 0; } ",0 "static int nl80211_del_beacon(struct sk_buff *skb, struct genl_info *info) { struct cfg80211_registered_device *rdev = info->user_ptr[0]; struct net_device *dev = info->user_ptr[1]; struct wireless_dev *wdev = dev->ieee80211_ptr; int err; if (!rdev->ops->del_beacon) return -EOPNOTSUPP; if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) return -EOPNOTSUPP; err = rdev->ops->del_beacon(&rdev->wiphy, dev); if (!err) wdev->beacon_interval = 0; return err; } ",0 "static bool stacksafe(struct bpf_verifier_state *old, struct bpf_verifier_state *cur, struct idpair *idmap) { int i, spi; /* if explored stack has more populated slots than current stack * such stacks are not equivalent */ if (old->allocated_stack > cur->allocated_stack) return false; /* walk slots of the explored stack and ignore any additional * slots in the current stack, since explored(safe) state * didn't use them */ for (i = 0; i < old->allocated_stack; i++) { spi = i / BPF_REG_SIZE; if (old->stack[spi].slot_type[i % BPF_REG_SIZE] == STACK_INVALID) continue; if (old->stack[spi].slot_type[i % BPF_REG_SIZE] != cur->stack[spi].slot_type[i % BPF_REG_SIZE]) /* Ex: old explored (safe) state has STACK_SPILL in * this stack slot, but current has has STACK_MISC -> * this verifier states are not equivalent, * return false to continue verification of this path */ return false; if (i % BPF_REG_SIZE) continue; if (old->stack[spi].slot_type[0] != STACK_SPILL) continue; if (!regsafe(&old->stack[spi].spilled_ptr, &cur->stack[spi].spilled_ptr, idmap)) /* when explored and current stack slot are both storing * spilled registers, check that stored pointers types * are the same as well. * Ex: explored safe path could have stored * (bpf_reg_state) {.type = PTR_TO_STACK, .off = -8} * but current path has stored: * (bpf_reg_state) {.type = PTR_TO_STACK, .off = -16} * such verifier states are not equivalent. * return false to continue verification of this path */ return false; } return true; } ",0 "bool GetStringProperty( XID window, const std::string& property_name, std::string* value) { Atom type = None; int format = 0; // size in bits of each item in 'property' unsigned long num_items = 0; unsigned char* property = NULL; int result = GetProperty(window, property_name, 1024, &type, &format, &num_items, &property); if (result != Success) return false; if (format != 8) { XFree(property); return false; } value->assign(reinterpret_cast(property), num_items); XFree(property); return true; } ",0 " AwMainDelegate::CreateContentBrowserClient() { content_browser_client_.reset(new AwContentBrowserClient(this)); return content_browser_client_.get(); } ",0 "cdf_read_short_sector_chain(const cdf_header_t *h, const cdf_sat_t *ssat, const cdf_stream_t *sst, cdf_secid_t sid, size_t len, cdf_stream_t *scn) { size_t ss = CDF_SEC_SIZE(h), i, j; scn->sst_len = cdf_count_chain(ssat, sid, CDF_SEC_SIZE(h)); scn->sst_dirlen = len; if (sst->sst_tab == NULL || scn->sst_len == (size_t)-1) return -1; scn->sst_tab = calloc(scn->sst_len, ss); if (scn->sst_tab == NULL) return -1; for (j = i = 0; sid >= 0; i++, j++) { if (j >= CDF_LOOP_LIMIT) { DPRINTF((""Read short sector chain loop limit"")); errno = EFTYPE; goto out; } if (i >= scn->sst_len) { DPRINTF((""Out of bounds reading short sector chain "" ""%"" SIZE_T_FORMAT ""u > %"" SIZE_T_FORMAT ""u\n"", i, scn->sst_len)); errno = EFTYPE; goto out; } if (cdf_read_short_sector(sst, scn->sst_tab, i * ss, ss, h, sid) != (ssize_t)ss) { DPRINTF((""Reading short sector chain %d"", sid)); goto out; } sid = CDF_TOLE4((uint32_t)ssat->sat_tab[sid]); } return 0; out: free(scn->sst_tab); return -1; } ",1 "static Image *ReadWPGImage(const ImageInfo *image_info, ExceptionInfo *exception) { typedef struct { size_t FileId; MagickOffsetType DataOffset; unsigned int ProductType; unsigned int FileType; unsigned char MajorVersion; unsigned char MinorVersion; unsigned int EncryptKey; unsigned int Reserved; } WPGHeader; typedef struct { unsigned char RecType; size_t RecordLength; } WPGRecord; typedef struct { unsigned char Class; unsigned char RecType; size_t Extension; size_t RecordLength; } WPG2Record; typedef struct { unsigned HorizontalUnits; unsigned VerticalUnits; unsigned char PosSizePrecision; } WPG2Start; typedef struct { unsigned int Width; unsigned int Height; unsigned int Depth; unsigned int HorzRes; unsigned int VertRes; } WPGBitmapType1; typedef struct { unsigned int Width; unsigned int Height; unsigned char Depth; unsigned char Compression; } WPG2BitmapType1; typedef struct { unsigned int RotAngle; unsigned int LowLeftX; unsigned int LowLeftY; unsigned int UpRightX; unsigned int UpRightY; unsigned int Width; unsigned int Height; unsigned int Depth; unsigned int HorzRes; unsigned int VertRes; } WPGBitmapType2; typedef struct { unsigned int StartIndex; unsigned int NumOfEntries; } WPGColorMapRec; /* typedef struct { size_t PS_unknown1; unsigned int PS_unknown2; unsigned int PS_unknown3; } WPGPSl1Record; */ Image *image; unsigned int status; WPGHeader Header; WPGRecord Rec; WPG2Record Rec2; WPG2Start StartWPG; WPGBitmapType1 BitmapHeader1; WPG2BitmapType1 Bitmap2Header1; WPGBitmapType2 BitmapHeader2; WPGColorMapRec WPG_Palette; int i, bpp, WPG2Flags; ssize_t ldblk; size_t one; unsigned char *BImgBuff; tCTM CTM; /*current transform matrix*/ /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickCoreSignature); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); one=1; image=AcquireImage(image_info,exception); image->depth=8; status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } /* Read WPG image. */ Header.FileId=ReadBlobLSBLong(image); Header.DataOffset=(MagickOffsetType) ReadBlobLSBLong(image); Header.ProductType=ReadBlobLSBShort(image); Header.FileType=ReadBlobLSBShort(image); Header.MajorVersion=ReadBlobByte(image); Header.MinorVersion=ReadBlobByte(image); Header.EncryptKey=ReadBlobLSBShort(image); Header.Reserved=ReadBlobLSBShort(image); if (Header.FileId!=0x435057FF || (Header.ProductType>>8)!=0x16) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); if (Header.EncryptKey!=0) ThrowReaderException(CoderError,""EncryptedWPGImageFileNotSupported""); image->columns = 1; image->rows = 1; image->colors = 0; bpp=0; BitmapHeader2.RotAngle=0; switch(Header.FileType) { case 1: /* WPG level 1 */ while(!EOFBlob(image)) /* object parser loop */ { (void) SeekBlob(image,Header.DataOffset,SEEK_SET); if(EOFBlob(image)) break; Rec.RecType=(i=ReadBlobByte(image)); if(i==EOF) break; Rd_WP_DWORD(image,&Rec.RecordLength); if(EOFBlob(image)) break; Header.DataOffset=TellBlob(image)+Rec.RecordLength; switch(Rec.RecType) { case 0x0B: /* bitmap type 1 */ BitmapHeader1.Width=ReadBlobLSBShort(image); BitmapHeader1.Height=ReadBlobLSBShort(image); if ((BitmapHeader1.Width == 0) || (BitmapHeader1.Height == 0)) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); BitmapHeader1.Depth=ReadBlobLSBShort(image); BitmapHeader1.HorzRes=ReadBlobLSBShort(image); BitmapHeader1.VertRes=ReadBlobLSBShort(image); if(BitmapHeader1.HorzRes && BitmapHeader1.VertRes) { image->units=PixelsPerCentimeterResolution; image->resolution.x=BitmapHeader1.HorzRes/470.0; image->resolution.y=BitmapHeader1.VertRes/470.0; } image->columns=BitmapHeader1.Width; image->rows=BitmapHeader1.Height; bpp=BitmapHeader1.Depth; goto UnpackRaster; case 0x0E: /*Color palette */ WPG_Palette.StartIndex=ReadBlobLSBShort(image); WPG_Palette.NumOfEntries=ReadBlobLSBShort(image); image->colors=WPG_Palette.NumOfEntries; if (!AcquireImageColormap(image,image->colors,exception)) goto NoMemory; for (i=WPG_Palette.StartIndex; i < (int)WPG_Palette.NumOfEntries; i++) { image->colormap[i].red=ScaleCharToQuantum((unsigned char) ReadBlobByte(image)); image->colormap[i].green=ScaleCharToQuantum((unsigned char) ReadBlobByte(image)); image->colormap[i].blue=ScaleCharToQuantum((unsigned char) ReadBlobByte(image)); } break; case 0x11: /* Start PS l1 */ if(Rec.RecordLength > 8) image=ExtractPostscript(image,image_info, TellBlob(image)+8, /* skip PS header in the wpg */ (ssize_t) Rec.RecordLength-8,exception); break; case 0x14: /* bitmap type 2 */ BitmapHeader2.RotAngle=ReadBlobLSBShort(image); BitmapHeader2.LowLeftX=ReadBlobLSBShort(image); BitmapHeader2.LowLeftY=ReadBlobLSBShort(image); BitmapHeader2.UpRightX=ReadBlobLSBShort(image); BitmapHeader2.UpRightY=ReadBlobLSBShort(image); BitmapHeader2.Width=ReadBlobLSBShort(image); BitmapHeader2.Height=ReadBlobLSBShort(image); if ((BitmapHeader2.Width == 0) || (BitmapHeader2.Height == 0)) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); BitmapHeader2.Depth=ReadBlobLSBShort(image); BitmapHeader2.HorzRes=ReadBlobLSBShort(image); BitmapHeader2.VertRes=ReadBlobLSBShort(image); image->units=PixelsPerCentimeterResolution; image->page.width=(unsigned int) ((BitmapHeader2.LowLeftX-BitmapHeader2.UpRightX)/470.0); image->page.height=(unsigned int) ((BitmapHeader2.LowLeftX-BitmapHeader2.UpRightY)/470.0); image->page.x=(int) (BitmapHeader2.LowLeftX/470.0); image->page.y=(int) (BitmapHeader2.LowLeftX/470.0); if(BitmapHeader2.HorzRes && BitmapHeader2.VertRes) { image->resolution.x=BitmapHeader2.HorzRes/470.0; image->resolution.y=BitmapHeader2.VertRes/470.0; } image->columns=BitmapHeader2.Width; image->rows=BitmapHeader2.Height; bpp=BitmapHeader2.Depth; UnpackRaster: if ((image->colors == 0) && (bpp != 24)) { image->colors=one << bpp; if (!AcquireImageColormap(image,image->colors,exception)) { NoMemory: ThrowReaderException(ResourceLimitError, ""MemoryAllocationFailed""); } /* printf(""Load default colormap \n""); */ for (i=0; (i < (int) image->colors) && (i < 256); i++) { image->colormap[i].red=ScaleCharToQuantum(WPG1_Palette[i].Red); image->colormap[i].green=ScaleCharToQuantum(WPG1_Palette[i].Green); image->colormap[i].blue=ScaleCharToQuantum(WPG1_Palette[i].Blue); } } else { if (bpp < 24) if ( (image->colors < (one << bpp)) && (bpp != 24) ) image->colormap=(PixelInfo *) ResizeQuantumMemory( image->colormap,(size_t) (one << bpp), sizeof(*image->colormap)); } if (bpp == 1) { if(image->colormap[0].red==0 && image->colormap[0].green==0 && image->colormap[0].blue==0 && image->colormap[1].red==0 && image->colormap[1].green==0 && image->colormap[1].blue==0) { /* fix crippled monochrome palette */ image->colormap[1].red = image->colormap[1].green = image->colormap[1].blue = QuantumRange; } } if(UnpackWPGRaster(image,bpp,exception) < 0) /* The raster cannot be unpacked */ { DecompressionFailed: ThrowReaderException(CoderError,""UnableToDecompressImage""); } if(Rec.RecType==0x14 && BitmapHeader2.RotAngle!=0 && !image_info->ping) { /* flop command */ if(BitmapHeader2.RotAngle & 0x8000) { Image *flop_image; flop_image = FlopImage(image, exception); if (flop_image != (Image *) NULL) { DuplicateBlob(flop_image,image); (void) RemoveLastImageFromList(&image); AppendImageToList(&image,flop_image); } } /* flip command */ if(BitmapHeader2.RotAngle & 0x2000) { Image *flip_image; flip_image = FlipImage(image, exception); if (flip_image != (Image *) NULL) { DuplicateBlob(flip_image,image); (void) RemoveLastImageFromList(&image); AppendImageToList(&image,flip_image); } } /* rotate command */ if(BitmapHeader2.RotAngle & 0x0FFF) { Image *rotate_image; rotate_image=RotateImage(image,(BitmapHeader2.RotAngle & 0x0FFF), exception); if (rotate_image != (Image *) NULL) { DuplicateBlob(rotate_image,image); (void) RemoveLastImageFromList(&image); AppendImageToList(&image,rotate_image); } } } /* Allocate next image structure. */ AcquireNextImage(image_info,image,exception); image->depth=8; if (image->next == (Image *) NULL) goto Finish; image=SyncNextImageInList(image); image->columns=image->rows=0; image->colors=0; break; case 0x1B: /* Postscript l2 */ if(Rec.RecordLength>0x3C) image=ExtractPostscript(image,image_info, TellBlob(image)+0x3C, /* skip PS l2 header in the wpg */ (ssize_t) Rec.RecordLength-0x3C,exception); break; } } break; case 2: /* WPG level 2 */ (void) memset(CTM,0,sizeof(CTM)); StartWPG.PosSizePrecision = 0; while(!EOFBlob(image)) /* object parser loop */ { (void) SeekBlob(image,Header.DataOffset,SEEK_SET); if(EOFBlob(image)) break; Rec2.Class=(i=ReadBlobByte(image)); if(i==EOF) break; Rec2.RecType=(i=ReadBlobByte(image)); if(i==EOF) break; Rd_WP_DWORD(image,&Rec2.Extension); Rd_WP_DWORD(image,&Rec2.RecordLength); if(EOFBlob(image)) break; Header.DataOffset=TellBlob(image)+Rec2.RecordLength; switch(Rec2.RecType) { case 1: StartWPG.HorizontalUnits=ReadBlobLSBShort(image); StartWPG.VerticalUnits=ReadBlobLSBShort(image); StartWPG.PosSizePrecision=ReadBlobByte(image); break; case 0x0C: /* Color palette */ WPG_Palette.StartIndex=ReadBlobLSBShort(image); WPG_Palette.NumOfEntries=ReadBlobLSBShort(image); image->colors=WPG_Palette.NumOfEntries; if (AcquireImageColormap(image,image->colors,exception) == MagickFalse) ThrowReaderException(ResourceLimitError, ""MemoryAllocationFailed""); for (i=WPG_Palette.StartIndex; i < (int)WPG_Palette.NumOfEntries; i++) { image->colormap[i].red=ScaleCharToQuantum((char) ReadBlobByte(image)); image->colormap[i].green=ScaleCharToQuantum((char) ReadBlobByte(image)); image->colormap[i].blue=ScaleCharToQuantum((char) ReadBlobByte(image)); (void) ReadBlobByte(image); /*Opacity??*/ } break; case 0x0E: Bitmap2Header1.Width=ReadBlobLSBShort(image); Bitmap2Header1.Height=ReadBlobLSBShort(image); if ((Bitmap2Header1.Width == 0) || (Bitmap2Header1.Height == 0)) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); Bitmap2Header1.Depth=ReadBlobByte(image); Bitmap2Header1.Compression=ReadBlobByte(image); if(Bitmap2Header1.Compression > 1) continue; /*Unknown compression method */ switch(Bitmap2Header1.Depth) { case 1: bpp=1; break; case 2: bpp=2; break; case 3: bpp=4; break; case 4: bpp=8; break; case 8: bpp=24; break; default: continue; /*Ignore raster with unknown depth*/ } image->columns=Bitmap2Header1.Width; image->rows=Bitmap2Header1.Height; if ((image->colors == 0) && (bpp != 24)) { size_t one; one=1; image->colors=one << bpp; if (!AcquireImageColormap(image,image->colors,exception)) goto NoMemory; } else { if(bpp < 24) if( image->colors<(one << bpp) && bpp!=24 ) image->colormap=(PixelInfo *) ResizeQuantumMemory( image->colormap,(size_t) (one << bpp), sizeof(*image->colormap)); } switch(Bitmap2Header1.Compression) { case 0: /*Uncompressed raster*/ { ldblk=(ssize_t) ((bpp*image->columns+7)/8); BImgBuff=(unsigned char *) AcquireQuantumMemory((size_t) ldblk,sizeof(*BImgBuff)); if (BImgBuff == (unsigned char *) NULL) goto NoMemory; for(i=0; i< (ssize_t) image->rows; i++) { (void) ReadBlob(image,ldblk,BImgBuff); InsertRow(image,BImgBuff,i,bpp,exception); } if(BImgBuff) BImgBuff=(unsigned char *) RelinquishMagickMemory(BImgBuff);; break; } case 1: /*RLE for WPG2 */ { if( UnpackWPG2Raster(image,bpp,exception) < 0) goto DecompressionFailed; break; } } if(CTM[0][0]<0 && !image_info->ping) { /*?? RotAngle=360-RotAngle;*/ Image *flop_image; flop_image = FlopImage(image, exception); if (flop_image != (Image *) NULL) { DuplicateBlob(flop_image,image); (void) RemoveLastImageFromList(&image); AppendImageToList(&image,flop_image); } /* Try to change CTM according to Flip - I am not sure, must be checked. Tx(0,0)=-1; Tx(1,0)=0; Tx(2,0)=0; Tx(0,1)= 0; Tx(1,1)=1; Tx(2,1)=0; Tx(0,2)=(WPG._2Rect.X_ur+WPG._2Rect.X_ll); Tx(1,2)=0; Tx(2,2)=1; */ } if(CTM[1][1]<0 && !image_info->ping) { /*?? RotAngle=360-RotAngle;*/ Image *flip_image; flip_image = FlipImage(image, exception); if (flip_image != (Image *) NULL) { DuplicateBlob(flip_image,image); (void) RemoveLastImageFromList(&image); AppendImageToList(&image,flip_image); } /* Try to change CTM according to Flip - I am not sure, must be checked. float_matrix Tx(3,3); Tx(0,0)= 1; Tx(1,0)= 0; Tx(2,0)=0; Tx(0,1)= 0; Tx(1,1)=-1; Tx(2,1)=0; Tx(0,2)= 0; Tx(1,2)=(WPG._2Rect.Y_ur+WPG._2Rect.Y_ll); Tx(2,2)=1; */ } /* Allocate next image structure. */ AcquireNextImage(image_info,image,exception); image->depth=8; if (image->next == (Image *) NULL) goto Finish; image=SyncNextImageInList(image); image->columns=image->rows=1; image->colors=0; break; case 0x12: /* Postscript WPG2*/ i=ReadBlobLSBShort(image); if(Rec2.RecordLength > (unsigned int) i) image=ExtractPostscript(image,image_info, TellBlob(image)+i, /*skip PS header in the wpg2*/ (ssize_t) (Rec2.RecordLength-i-2),exception); break; case 0x1B: /*bitmap rectangle*/ WPG2Flags = LoadWPG2Flags(image,StartWPG.PosSizePrecision,NULL,&CTM); (void) WPG2Flags; break; } } break; default: { ThrowReaderException(CoderError,""DataEncodingSchemeIsNotSupported""); } } status=SetImageExtent(image,image->columns,image->rows,exception); if (status == MagickFalse) return(DestroyImageList(image)); Finish: (void) CloseBlob(image); { Image *p; ssize_t scene=0; /* Rewind list, removing any empty images while rewinding. */ p=image; image=NULL; while (p != (Image *) NULL) { Image *tmp=p; if ((p->rows == 0) || (p->columns == 0)) { p=p->previous; DeleteImageFromList(&tmp); } else { image=p; p=p->previous; } } /* Fix scene numbers. */ for (p=image; p != (Image *) NULL; p=p->next) p->scene=(size_t) scene++; } if (image == (Image *) NULL) ThrowReaderException(CorruptImageError, ""ImageFileDoesNotContainAnyImageData""); return(image); } ",1 "void RenderViewImpl::OnGetRenderedText() { if (!webview()) return; if (!webview()->MainFrame()->IsWebLocalFrame()) return; static const size_t kMaximumMessageSize = 8 * 1024 * 1024; std::string text = WebFrameContentDumper::DumpWebViewAsText(webview(), kMaximumMessageSize) .Utf8(); Send(new ViewMsg_GetRenderedTextCompleted(GetRoutingID(), text)); } ",0 "void SVGStyleElement::NotifyLoadedSheetAndAllCriticalSubresources( LoadedSheetErrorStatus error_status) { if (error_status != kNoErrorLoadingSubresource) { GetDocument() .GetTaskRunner(TaskType::kDOMManipulation) ->PostTask(FROM_HERE, WTF::Bind(&SVGStyleElement::DispatchPendingEvent, WrapPersistent(this))); } } ",0 "RCMS *r_pkcs7_parse_cms (const ut8 *buffer, ut32 length) { RASN1Object *object; RCMS *container; if (!buffer || !length) { return NULL; } container = R_NEW0 (RCMS); if (!container) { return NULL; } object = r_asn1_create_object (buffer, length); if (!object || object->list.length != 2 || !object->list.objects[0] || object->list.objects[1]->list.length != 1) { r_asn1_free_object (object); free (container); return NULL; } container->contentType = r_asn1_stringify_oid (object->list.objects[0]->sector, object->list.objects[0]->length); r_pkcs7_parse_signeddata (&container->signedData, object->list.objects[1]->list.objects[0]); r_asn1_free_object (object); return container; } ",1 "static void write_hash_cache(struct sha1file *f, struct pack_idx_entry **index, uint32_t index_nr) { uint32_t i; for (i = 0; i < index_nr; ++i) { struct object_entry *entry = (struct object_entry *)index[i]; uint32_t hash_value = htonl(entry->hash); sha1write(f, &hash_value, sizeof(hash_value)); } } ",0 "bool DialogNotification::HasArrow() const { return type_ == DialogNotification::WALLET_ERROR || type_ == DialogNotification::WALLET_USAGE_CONFIRMATION; } ",0 "static int vsock_stream_getsockopt(struct socket *sock, int level, int optname, char __user *optval, int __user *optlen) { int err; int len; struct sock *sk; struct vsock_sock *vsk; u64 val; if (level != AF_VSOCK) return -ENOPROTOOPT; err = get_user(len, optlen); if (err != 0) return err; #define COPY_OUT(_v) \ do { \ if (len < sizeof(_v)) \ return -EINVAL; \ \ len = sizeof(_v); \ if (copy_to_user(optval, &_v, len) != 0) \ return -EFAULT; \ \ } while (0) err = 0; sk = sock->sk; vsk = vsock_sk(sk); switch (optname) { case SO_VM_SOCKETS_BUFFER_SIZE: val = transport->get_buffer_size(vsk); COPY_OUT(val); break; case SO_VM_SOCKETS_BUFFER_MAX_SIZE: val = transport->get_max_buffer_size(vsk); COPY_OUT(val); break; case SO_VM_SOCKETS_BUFFER_MIN_SIZE: val = transport->get_min_buffer_size(vsk); COPY_OUT(val); break; case SO_VM_SOCKETS_CONNECT_TIMEOUT: { struct timeval tv; tv.tv_sec = vsk->connect_timeout / HZ; tv.tv_usec = (vsk->connect_timeout - tv.tv_sec * HZ) * (1000000 / HZ); COPY_OUT(tv); break; } default: return -ENOPROTOOPT; } err = put_user(len, optlen); if (err != 0) return -EFAULT; #undef COPY_OUT return 0; } ",0 "static TEE_Result tee_mmu_user_va2pa_attr(const struct user_ta_ctx *utc, void *ua, paddr_t *pa, uint32_t *attr) { struct vm_region *region; TAILQ_FOREACH(region, &utc->vm_info->regions, link) { if (!core_is_buffer_inside(ua, 1, region->va, region->size)) continue; if (pa) { TEE_Result res; paddr_t p; size_t offset; size_t granule; /* * mobj and input user address may each include * a specific offset-in-granule position. * Drop both to get target physical page base * address then apply only user address * offset-in-granule. * Mapping lowest granule is the small page. */ granule = MAX(region->mobj->phys_granule, (size_t)SMALL_PAGE_SIZE); assert(!granule || IS_POWER_OF_TWO(granule)); offset = region->offset + ROUNDDOWN((vaddr_t)ua - region->va, granule); res = mobj_get_pa(region->mobj, offset, granule, &p); if (res != TEE_SUCCESS) return res; *pa = p | ((vaddr_t)ua & (granule - 1)); } if (attr) *attr = region->attr; return TEE_SUCCESS; } return TEE_ERROR_ACCESS_DENIED; } ",0 "bool VaapiVideoDecodeAccelerator::GetInputBuffer_Locked() { DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); lock_.AssertAcquired(); if (curr_input_buffer_.get()) return true; while (input_buffers_.empty() && (state_ == kDecoding || state_ == kIdle)) { input_ready_.Wait(); } if (state_ != kDecoding && state_ != kIdle) return false; DCHECK(!input_buffers_.empty()); curr_input_buffer_ = std::move(input_buffers_.front()); input_buffers_.pop(); if (curr_input_buffer_->IsFlushRequest()) { VLOGF(4) << ""New flush buffer""; return true; } VLOGF(4) << ""New current input buffer, id: "" << curr_input_buffer_->id() << "" size: "" << curr_input_buffer_->shm()->size() << ""B""; decoder_->SetStream( static_cast(curr_input_buffer_->shm()->memory()), curr_input_buffer_->shm()->size()); return true; } ",0 " void GpuChannel::OnCreateOffscreenCommandBuffer( const gfx::Size& size, const GPUCreateCommandBufferConfig& init_params, IPC::Message* reply_message) { int32 route_id = MSG_ROUTING_NONE; content::GetContentClient()->SetActiveURL(init_params.active_url); #if defined(ENABLE_GPU) WillCreateCommandBuffer(init_params.gpu_preference); GpuCommandBufferStub* share_group = stubs_.Lookup(init_params.share_group_id); route_id = GenerateRouteID(); scoped_ptr stub(new GpuCommandBufferStub( this, share_group, gfx::GLSurfaceHandle(), size, disallowed_features_, init_params.allowed_extensions, init_params.attribs, init_params.gpu_preference, route_id, 0, watchdog_, software_)); router_.AddRoute(route_id, stub.get()); stubs_.AddWithID(stub.release(), route_id); TRACE_EVENT1(""gpu"", ""GpuChannel::OnCreateOffscreenCommandBuffer"", ""route_id"", route_id); #endif GpuChannelMsg_CreateOffscreenCommandBuffer::WriteReplyParams( reply_message, route_id); Send(reply_message); } ",0 "void LocalFrame::Trace(blink::Visitor* visitor) { visitor->Trace(ad_tracker_); visitor->Trace(probe_sink_); visitor->Trace(performance_monitor_); visitor->Trace(idleness_detector_); visitor->Trace(inspector_trace_events_); visitor->Trace(loader_); visitor->Trace(navigation_scheduler_); visitor->Trace(view_); visitor->Trace(dom_window_); visitor->Trace(page_popup_owner_); visitor->Trace(script_controller_); visitor->Trace(editor_); visitor->Trace(spell_checker_); visitor->Trace(selection_); visitor->Trace(event_handler_); visitor->Trace(console_); visitor->Trace(input_method_controller_); visitor->Trace(text_suggestion_controller_); visitor->Trace(computed_node_mapping_); Frame::Trace(visitor); Supplementable::Trace(visitor); } ",0 "decode_openflow11_instructions(const struct ofp11_instruction insts[], size_t n_insts, const struct ofp11_instruction *out[]) { const struct ofp11_instruction *inst; size_t left; memset(out, 0, N_OVS_INSTRUCTIONS * sizeof *out); INSTRUCTION_FOR_EACH (inst, left, insts, n_insts) { enum ovs_instruction_type type; enum ofperr error; error = decode_openflow11_instruction(inst, &type); if (error) { return error; } if (out[type]) { return OFPERR_OFPBIC_DUP_INST; } out[type] = inst; } if (left) { VLOG_WARN_RL(&rl, ""bad instruction format at offset %""PRIuSIZE, (n_insts - left) * sizeof *inst); return OFPERR_OFPBIC_BAD_LEN; } return 0; } ",0 " cib_remote_perform_op(cib_t * cib, const char *op, const char *host, const char *section, xmlNode * data, xmlNode ** output_data, int call_options, const char *name) { int rc = pcmk_ok; xmlNode *op_msg = NULL; xmlNode *op_reply = NULL; cib_remote_opaque_t *private = cib->variant_opaque; if (sync_timer == NULL) { sync_timer = calloc(1, sizeof(struct timer_rec_s)); } if (cib->state == cib_disconnected) { return -ENOTCONN; } if (output_data != NULL) { *output_data = NULL; } if (op == NULL) { crm_err(""No operation specified""); return -EINVAL; } cib->call_id++; /* prevent call_id from being negative (or zero) and conflicting * with the cib_errors enum * use 2 because we use it as (cib->call_id - 1) below */ if (cib->call_id < 1) { cib->call_id = 1; } op_msg = cib_create_op(cib->call_id, private->callback.token, op, host, section, data, call_options, NULL); if (op_msg == NULL) { return -EPROTO; } crm_trace(""Sending %s message to CIB service"", op); crm_send_remote_msg(private->command.session, op_msg, private->command.encrypted); free_xml(op_msg); if ((call_options & cib_discard_reply)) { crm_trace(""Discarding reply""); return pcmk_ok; } else if (!(call_options & cib_sync_call)) { return cib->call_id; } crm_trace(""Waiting for a syncronous reply""); if (cib->call_timeout > 0) { /* We need this, even with msgfromIPC_timeout(), because we might * get other/older replies that don't match the active request */ timer_expired = FALSE; sync_timer->call_id = cib->call_id; sync_timer->timeout = cib->call_timeout * 1000; sync_timer->ref = g_timeout_add(sync_timer->timeout, cib_timeout_handler, sync_timer); } while (timer_expired == FALSE) { int reply_id = -1; int msg_id = cib->call_id; op_reply = crm_recv_remote_msg(private->command.session, private->command.encrypted); if (op_reply == NULL) { break; } crm_element_value_int(op_reply, F_CIB_CALLID, &reply_id); CRM_CHECK(reply_id > 0, free_xml(op_reply); if (sync_timer->ref > 0) { g_source_remove(sync_timer->ref); sync_timer->ref = 0;} return -ENOMSG) ; if (reply_id == msg_id) { break; } else if (reply_id < msg_id) { crm_debug(""Received old reply: %d (wanted %d)"", reply_id, msg_id); crm_log_xml_trace(op_reply, ""Old reply""); } else if ((reply_id - 10000) > msg_id) { /* wrap-around case */ crm_debug(""Received old reply: %d (wanted %d)"", reply_id, msg_id); crm_log_xml_trace(op_reply, ""Old reply""); } else { crm_err(""Received a __future__ reply:"" "" %d (wanted %d)"", reply_id, msg_id); } free_xml(op_reply); op_reply = NULL; } if (sync_timer->ref > 0) { g_source_remove(sync_timer->ref); sync_timer->ref = 0; } if (timer_expired) { return -ETIME; } /* if(IPC_ISRCONN(native->command_channel) == FALSE) { */ /* crm_err(""CIB disconnected: %d"", */ /* native->command_channel->ch_status); */ /* cib->state = cib_disconnected; */ /* } */ if (op_reply == NULL) { crm_err(""No reply message - empty""); return -ENOMSG; } crm_trace(""Syncronous reply received""); /* Start processing the reply... */ if (crm_element_value_int(op_reply, F_CIB_RC, &rc) != 0) { rc = -EPROTO; } if (rc == -pcmk_err_diff_resync) { /* This is an internal value that clients do not and should not care about */ rc = pcmk_ok; } if (rc == pcmk_ok || rc == -EPERM) { crm_log_xml_debug(op_reply, ""passed""); } else { /* } else if(rc == -ETIME) { */ crm_err(""Call failed: %s"", pcmk_strerror(rc)); crm_log_xml_warn(op_reply, ""failed""); } if (output_data == NULL) { /* do nothing more */ } else if (!(call_options & cib_discard_reply)) { xmlNode *tmp = get_message_xml(op_reply, F_CIB_CALLDATA); if (tmp == NULL) { crm_trace(""No output in reply to \""%s\"" command %d"", op, cib->call_id - 1); } else { *output_data = copy_xml(tmp); } } free_xml(op_reply); return rc; } ",1 "static void end_output_stream(request_rec *r) { conn_rec *c = r->connection; apr_bucket_brigade *bb; apr_bucket *b; bb = apr_brigade_create(r->pool, c->bucket_alloc); b = apr_bucket_eos_create(c->bucket_alloc); APR_BRIGADE_INSERT_TAIL(bb, b); ap_pass_brigade(r->output_filters, bb); } ",0 "void ComputeWebKitPrintParamsInDesiredDpi( const PrintMsg_Print_Params& print_params, blink::WebPrintParams* webkit_print_params) { int dpi = GetDPI(&print_params); webkit_print_params->printerDPI = dpi; webkit_print_params->printScalingOption = print_params.print_scaling_option; webkit_print_params->printContentArea.width = ConvertUnit( print_params.content_size.width(), dpi, print_params.desired_dpi); webkit_print_params->printContentArea.height = ConvertUnit( print_params.content_size.height(), dpi, print_params.desired_dpi); webkit_print_params->printableArea.x = ConvertUnit( print_params.printable_area.x(), dpi, print_params.desired_dpi); webkit_print_params->printableArea.y = ConvertUnit( print_params.printable_area.y(), dpi, print_params.desired_dpi); webkit_print_params->printableArea.width = ConvertUnit( print_params.printable_area.width(), dpi, print_params.desired_dpi); webkit_print_params->printableArea.height = ConvertUnit( print_params.printable_area.height(), dpi, print_params.desired_dpi); webkit_print_params->paperSize.width = ConvertUnit( print_params.page_size.width(), dpi, print_params.desired_dpi); webkit_print_params->paperSize.height = ConvertUnit( print_params.page_size.height(), dpi, print_params.desired_dpi); } ",0 "static int windows_get_active_config_descriptor(struct libusb_device *dev, unsigned char *buffer, size_t len, int *host_endian) { struct windows_device_priv *priv = _device_priv(dev); if (priv->active_config == 0) return LIBUSB_ERROR_NOT_FOUND; return windows_get_config_descriptor(dev, (uint8_t)(priv->active_config-1), buffer, len, host_endian); } ",0 "void ext4_ext_drop_refs(struct ext4_ext_path *path) { int depth = path->p_depth; int i; for (i = 0; i <= depth; i++, path++) if (path->p_bh) { brelse(path->p_bh); path->p_bh = NULL; } } ",0 "bool SVGImage::currentFrameHasSingleSecurityOrigin() const { if (!m_page) return true; LocalFrame* frame = m_page->mainFrame(); RELEASE_ASSERT(frame->document()->loadEventFinished()); SVGSVGElement* rootElement = toSVGDocument(frame->document())->rootElement(); if (!rootElement) return true; ComposedTreeWalker walker(rootElement); while (Node* node = walker.get()) { if (node->hasTagName(SVGNames::foreignObjectTag)) return false; if (node->hasTagName(SVGNames::imageTag)) { if (!toSVGImageElement(node)->currentFrameHasSingleSecurityOrigin()) return false; } else if (node->hasTagName(SVGNames::feImageTag)) { if (!toSVGFEImageElement(node)->currentFrameHasSingleSecurityOrigin()) return false; } walker.next(); } return true; } ",0 "blink::WebPushClient* RenderFrameImpl::pushClient() { if (!push_messaging_dispatcher_) push_messaging_dispatcher_ = new PushMessagingDispatcher(this); return push_messaging_dispatcher_; } ",0 "void RTCPeerConnectionHandler::OnaddICECandidateResult( const blink::WebRTCVoidRequest& webkit_request, bool result) { DCHECK(task_runner_->RunsTasksInCurrentSequence()); TRACE_EVENT0(""webrtc"", ""RTCPeerConnectionHandler::OnaddICECandidateResult""); if (!result) { return webkit_request.RequestFailed( webrtc::RTCError(webrtc::RTCErrorType::UNSUPPORTED_OPERATION, std::move(""Error processing ICE candidate""))); } return webkit_request.RequestSucceeded(); } ",0 "static inline void bt_index_atomic_inc(atomic_t *index) { int old = atomic_read(index); int new = bt_index_inc(old); atomic_cmpxchg(index, old, new); } ",0 "xsltEvalUserParams(xsltTransformContextPtr ctxt, const char **params) { int indx = 0; const xmlChar *name; const xmlChar *value; if (params == NULL) return(0); while (params[indx] != NULL) { name = (const xmlChar *) params[indx++]; value = (const xmlChar *) params[indx++]; if (xsltEvalOneUserParam(ctxt, name, value) != 0) return(-1); } return 0; } ",0 "void GLSurfaceEGLSurfaceControl::SwapBuffersAsync( SwapCompletionCallback completion_callback, PresentationCallback presentation_callback) { CommitPendingTransaction(std::move(completion_callback), std::move(presentation_callback)); } ",1 "void HTMLInputElement::SetValueForUser(const String& value) { setValue(value, kDispatchChangeEvent); } ",0 "static int phar_zip_process_extra(php_stream *fp, phar_entry_info *entry, php_uint16 len TSRMLS_DC) /* {{{ */ { union { phar_zip_extra_field_header header; phar_zip_unix3 unix3; } h; int read; do { if (sizeof(h.header) != php_stream_read(fp, (char *) &h.header, sizeof(h.header))) { return FAILURE; } if (h.header.tag[0] != 'n' || h.header.tag[1] != 'u') { /* skip to next header */ php_stream_seek(fp, PHAR_GET_16(h.header.size), SEEK_CUR); len -= PHAR_GET_16(h.header.size) + 4; continue; } /* unix3 header found */ read = php_stream_read(fp, (char *) &(h.unix3.crc32), sizeof(h.unix3) - sizeof(h.header)); len -= read + 4; if (sizeof(h.unix3) - sizeof(h.header) != read) { return FAILURE; } if (PHAR_GET_16(h.unix3.size) > sizeof(h.unix3) - 4) { /* skip symlink filename - we may add this support in later */ php_stream_seek(fp, PHAR_GET_16(h.unix3.size) - sizeof(h.unix3.size), SEEK_CUR); } /* set permissions */ entry->flags &= PHAR_ENT_COMPRESSION_MASK; if (entry->is_dir) { entry->flags |= PHAR_GET_16(h.unix3.perms) & PHAR_ENT_PERM_MASK; } else { entry->flags |= PHAR_GET_16(h.unix3.perms) & PHAR_ENT_PERM_MASK; } } while (len); return SUCCESS; } /* }}} */ ",0 "static void overloadedMethodEMethodCallback(const v8::FunctionCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMMethod""); TestObjectPythonV8Internal::overloadedMethodEMethod(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "void ASessionDescription::getFormat(size_t index, AString *value) const { CHECK_GE(index, 0u); CHECK_LT(index, mTracks.size()); *value = mFormats.itemAt(index); } ",0 "static void reflectTestInterfaceAttributeAttributeSetter(v8::Local jsValue, const v8::PropertyCallbackInfo& info) { TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); V8TRYCATCH_VOID(TestInterface*, cppValue, V8TestInterface::toNativeWithTypeCheck(info.GetIsolate(), jsValue)); CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; imp->setAttribute(HTMLNames::reflecttestinterfaceattributeAttr, WTF::getPtr(cppValue)); } ",0 "GF_Err saiz_Size(GF_Box *s) { GF_SampleAuxiliaryInfoSizeBox *ptr = (GF_SampleAuxiliaryInfoSizeBox*)s; if (ptr->aux_info_type || ptr->aux_info_type_parameter) { ptr->flags |= 1; } if (ptr->flags & 1) ptr->size += 8; ptr->size += 5; if (ptr->default_sample_info_size==0) ptr->size += ptr->sample_count; return GF_OK; } ",0 "static int newque(struct ipc_namespace *ns, struct ipc_params *params) { struct msg_queue *msq; int id, retval; key_t key = params->key; int msgflg = params->flg; msq = ipc_rcu_alloc(sizeof(*msq)); if (!msq) return -ENOMEM; msq->q_perm.mode = msgflg & S_IRWXUGO; msq->q_perm.key = key; msq->q_perm.security = NULL; retval = security_msg_queue_alloc(msq); if (retval) { ipc_rcu_putref(msq, ipc_rcu_free); return retval; } /* ipc_addid() locks msq upon success. */ id = ipc_addid(&msg_ids(ns), &msq->q_perm, ns->msg_ctlmni); if (id < 0) { ipc_rcu_putref(msq, msg_rcu_free); return id; } msq->q_stime = msq->q_rtime = 0; msq->q_ctime = get_seconds(); msq->q_cbytes = msq->q_qnum = 0; msq->q_qbytes = ns->msg_ctlmnb; msq->q_lspid = msq->q_lrpid = 0; INIT_LIST_HEAD(&msq->q_messages); INIT_LIST_HEAD(&msq->q_receivers); INIT_LIST_HEAD(&msq->q_senders); ipc_unlock_object(&msq->q_perm); rcu_read_unlock(); return msq->q_perm.id; } ",1 "static int mount_rootfs_dir(const char *rootfs, const char *target, const char *options) { unsigned long mntflags; char *mntdata; int ret; if (parse_mntopts(options, &mntflags, &mntdata) < 0) { free(mntdata); return -1; } ret = mount(rootfs, target, ""none"", MS_BIND | MS_REC | mntflags, mntdata); free(mntdata); return ret; } ",0 "static int em_bt(struct x86_emulate_ctxt *ctxt) { /* Disable writeback. */ ctxt->dst.type = OP_NONE; /* only subword offset */ ctxt->src.val &= (ctxt->dst.bytes << 3) - 1; emulate_2op_SrcV_nobyte(ctxt, ""bt""); return X86EMUL_CONTINUE; } ",0 "line_vertical(PG_FUNCTION_ARGS) { LINE *line = PG_GETARG_LINE_P(0); PG_RETURN_BOOL(FPzero(line->B)); } ",0 "static CURLcode imap_dophase_done(struct connectdata *conn, bool connected) { struct FTP *imap = conn->data->state.proto.imap; (void)connected; if(imap->transfer != FTPTRANSFER_BODY) /* no data to transfer */ Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); return CURLE_OK; } ",0 "pp::Instance* Instance::GetInstance() { return this; } ",0 "ffs_setup_state_clear_cancelled(struct ffs_data *ffs) { return (enum ffs_setup_state) cmpxchg(&ffs->setup_state, FFS_SETUP_CANCELLED, FFS_NO_SETUP); } ",0 "ssize_t generic_file_splice_read(struct file *in, loff_t *ppos, struct pipe_inode_info *pipe, size_t len, unsigned int flags) { struct iov_iter to; struct kiocb kiocb; int idx, ret; iov_iter_pipe(&to, READ, pipe, len); idx = to.idx; init_sync_kiocb(&kiocb, in); kiocb.ki_pos = *ppos; ret = call_read_iter(in, &kiocb, &to); if (ret > 0) { *ppos = kiocb.ki_pos; file_accessed(in); } else if (ret < 0) { to.idx = idx; to.iov_offset = 0; iov_iter_advance(&to, 0); /* to free what was emitted */ /* * callers of ->splice_read() expect -EAGAIN on * ""can't put anything in there"", rather than -EFAULT. */ if (ret == -EFAULT) ret = -EAGAIN; } return ret; } ",0 "bool OmniboxViewViews::HandleKeyEvent(views::Textfield* textfield, const ui::KeyEvent& event) { delete_at_end_pressed_ = false; if (event.key_code() == ui::VKEY_BACK) { if (model()->is_keyword_hint() || model()->keyword().empty() || HasSelection() || GetCursorPosition() != 0) return false; model()->ClearKeyword(text()); return true; } if (event.key_code() == ui::VKEY_DELETE && !event.IsAltDown()) { delete_at_end_pressed_ = (!HasSelection() && GetCursorPosition() == text().length()); } if (GetCursorPosition() == text().length()) { base::i18n::TextDirection direction = GetTextDirection(); if ((direction == base::i18n::LEFT_TO_RIGHT && event.key_code() == ui::VKEY_RIGHT) || (direction == base::i18n::RIGHT_TO_LEFT && event.key_code() == ui::VKEY_LEFT)) { return model()->CommitSuggestedText(); } } return false; } ",0 "xfs_attr3_leaf_rebalance( struct xfs_da_state *state, struct xfs_da_state_blk *blk1, struct xfs_da_state_blk *blk2) { struct xfs_da_args *args; struct xfs_attr_leafblock *leaf1; struct xfs_attr_leafblock *leaf2; struct xfs_attr3_icleaf_hdr ichdr1; struct xfs_attr3_icleaf_hdr ichdr2; struct xfs_attr_leaf_entry *entries1; struct xfs_attr_leaf_entry *entries2; int count; int totallen; int max; int space; int swap; /* * Set up environment. */ ASSERT(blk1->magic == XFS_ATTR_LEAF_MAGIC); ASSERT(blk2->magic == XFS_ATTR_LEAF_MAGIC); leaf1 = blk1->bp->b_addr; leaf2 = blk2->bp->b_addr; xfs_attr3_leaf_hdr_from_disk(state->args->geo, &ichdr1, leaf1); xfs_attr3_leaf_hdr_from_disk(state->args->geo, &ichdr2, leaf2); ASSERT(ichdr2.count == 0); args = state->args; trace_xfs_attr_leaf_rebalance(args); /* * Check ordering of blocks, reverse if it makes things simpler. * * NOTE: Given that all (current) callers pass in an empty * second block, this code should never set ""swap"". */ swap = 0; if (xfs_attr3_leaf_order(blk1->bp, &ichdr1, blk2->bp, &ichdr2)) { struct xfs_da_state_blk *tmp_blk; struct xfs_attr3_icleaf_hdr tmp_ichdr; tmp_blk = blk1; blk1 = blk2; blk2 = tmp_blk; /* struct copies to swap them rather than reconverting */ tmp_ichdr = ichdr1; ichdr1 = ichdr2; ichdr2 = tmp_ichdr; leaf1 = blk1->bp->b_addr; leaf2 = blk2->bp->b_addr; swap = 1; } /* * Examine entries until we reduce the absolute difference in * byte usage between the two blocks to a minimum. Then get * the direction to copy and the number of elements to move. * * ""inleaf"" is true if the new entry should be inserted into blk1. * If ""swap"" is also true, then reverse the sense of ""inleaf"". */ state->inleaf = xfs_attr3_leaf_figure_balance(state, blk1, &ichdr1, blk2, &ichdr2, &count, &totallen); if (swap) state->inleaf = !state->inleaf; /* * Move any entries required from leaf to leaf: */ if (count < ichdr1.count) { /* * Figure the total bytes to be added to the destination leaf. */ /* number entries being moved */ count = ichdr1.count - count; space = ichdr1.usedbytes - totallen; space += count * sizeof(xfs_attr_leaf_entry_t); /* * leaf2 is the destination, compact it if it looks tight. */ max = ichdr2.firstused - xfs_attr3_leaf_hdr_size(leaf1); max -= ichdr2.count * sizeof(xfs_attr_leaf_entry_t); if (space > max) xfs_attr3_leaf_compact(args, &ichdr2, blk2->bp); /* * Move high entries from leaf1 to low end of leaf2. */ xfs_attr3_leaf_moveents(args, leaf1, &ichdr1, ichdr1.count - count, leaf2, &ichdr2, 0, count); } else if (count > ichdr1.count) { /* * I assert that since all callers pass in an empty * second buffer, this code should never execute. */ ASSERT(0); /* * Figure the total bytes to be added to the destination leaf. */ /* number entries being moved */ count -= ichdr1.count; space = totallen - ichdr1.usedbytes; space += count * sizeof(xfs_attr_leaf_entry_t); /* * leaf1 is the destination, compact it if it looks tight. */ max = ichdr1.firstused - xfs_attr3_leaf_hdr_size(leaf1); max -= ichdr1.count * sizeof(xfs_attr_leaf_entry_t); if (space > max) xfs_attr3_leaf_compact(args, &ichdr1, blk1->bp); /* * Move low entries from leaf2 to high end of leaf1. */ xfs_attr3_leaf_moveents(args, leaf2, &ichdr2, 0, leaf1, &ichdr1, ichdr1.count, count); } xfs_attr3_leaf_hdr_to_disk(state->args->geo, leaf1, &ichdr1); xfs_attr3_leaf_hdr_to_disk(state->args->geo, leaf2, &ichdr2); xfs_trans_log_buf(args->trans, blk1->bp, 0, args->geo->blksize - 1); xfs_trans_log_buf(args->trans, blk2->bp, 0, args->geo->blksize - 1); /* * Copy out last hashval in each block for B-tree code. */ entries1 = xfs_attr3_leaf_entryp(leaf1); entries2 = xfs_attr3_leaf_entryp(leaf2); blk1->hashval = be32_to_cpu(entries1[ichdr1.count - 1].hashval); blk2->hashval = be32_to_cpu(entries2[ichdr2.count - 1].hashval); /* * Adjust the expected index for insertion. * NOTE: this code depends on the (current) situation that the * second block was originally empty. * * If the insertion point moved to the 2nd block, we must adjust * the index. We must also track the entry just following the * new entry for use in an ""atomic rename"" operation, that entry * is always the ""old"" entry and the ""new"" entry is what we are * inserting. The index/blkno fields refer to the ""old"" entry, * while the index2/blkno2 fields refer to the ""new"" entry. */ if (blk1->index > ichdr1.count) { ASSERT(state->inleaf == 0); blk2->index = blk1->index - ichdr1.count; args->index = args->index2 = blk2->index; args->blkno = args->blkno2 = blk2->blkno; } else if (blk1->index == ichdr1.count) { if (state->inleaf) { args->index = blk1->index; args->blkno = blk1->blkno; args->index2 = 0; args->blkno2 = blk2->blkno; } else { /* * On a double leaf split, the original attr location * is already stored in blkno2/index2, so don't * overwrite it overwise we corrupt the tree. */ blk2->index = blk1->index - ichdr1.count; args->index = blk2->index; args->blkno = blk2->blkno; if (!state->extravalid) { /* * set the new attr location to match the old * one and let the higher level split code * decide where in the leaf to place it. */ args->index2 = blk2->index; args->blkno2 = blk2->blkno; } } } else { ASSERT(state->inleaf == 1); args->index = args->index2 = blk1->index; args->blkno = args->blkno2 = blk1->blkno; } } ",0 "void RenderFrameImpl::DidFinishSameDocumentNavigation( const blink::WebHistoryItem& item, blink::WebHistoryCommitType commit_type, bool content_initiated) { TRACE_EVENT1(""navigation,rail"", ""RenderFrameImpl::didFinishSameDocumentNavigation"", ""id"", routing_id_); InternalDocumentStateData* data = InternalDocumentStateData::FromDocumentLoader( frame_->GetDocumentLoader()); if (content_initiated) data->set_navigation_state(NavigationState::CreateContentInitiated()); data->navigation_state()->set_was_within_same_document(true); ui::PageTransition transition = GetTransitionType(frame_->GetDocumentLoader(), frame_, true /* loading */); DidCommitNavigationInternal(item, commit_type, true /* was_within_same_document */, transition, nullptr /* remote_interface_provider_request */); } ",0 "status_t NuPlayer::GenericSource::seekTo(int64_t seekTimeUs) { sp msg = new AMessage(kWhatSeek, this); msg->setInt64(""seekTimeUs"", seekTimeUs); sp response; status_t err = msg->postAndAwaitResponse(&response); if (err == OK && response != NULL) { CHECK(response->findInt32(""err"", &err)); } return err; } ",0 "std::vector RegisterAllFeatureVariationParameters( flags_ui::FlagsStorage* flags_storage, base::FeatureList* feature_list) { return FlagsStateSingleton::GetFlagsState() ->RegisterAllFeatureVariationParameters(flags_storage, feature_list); } ",0 "static long vma_needs_reservation(struct hstate *h, struct vm_area_struct *vma, unsigned long addr) { struct address_space *mapping = vma->vm_file->f_mapping; struct inode *inode = mapping->host; if (vma->vm_flags & VM_MAYSHARE) { pgoff_t idx = vma_hugecache_offset(h, vma, addr); return region_chg(&inode->i_mapping->private_list, idx, idx + 1); } else if (!is_vma_resv_set(vma, HPAGE_RESV_OWNER)) { return 1; } else { long err; pgoff_t idx = vma_hugecache_offset(h, vma, addr); struct resv_map *reservations = vma_resv_map(vma); err = region_chg(&reservations->regions, idx, idx + 1); if (err < 0) return err; return 0; } } ",0 "static PHP_METHOD(PDOStatement, __wakeup) { zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, ""You cannot serialize or unserialize PDOStatement instances""); } ",0 "string16 BrowserView::GetAccessibleWindowTitle() const { if (IsOffTheRecord()) { return l10n_util::GetStringFUTF16( IDS_ACCESSIBLE_INCOGNITO_WINDOW_TITLE_FORMAT, GetWindowTitle()); } return GetWindowTitle(); } ",0 "png_get_tRNS(png_structp png_ptr, png_infop info_ptr, png_bytep *trans, int *num_trans, png_color_16p *trans_values) { png_uint_32 retval = 0; if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS)) { png_debug1(1, ""in %s retrieval function"", ""tRNS""); if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) { if (trans != NULL) { *trans = info_ptr->trans; retval |= PNG_INFO_tRNS; } if (trans_values != NULL) *trans_values = &(info_ptr->trans_values); } else /* if (info_ptr->color_type != PNG_COLOR_TYPE_PALETTE) */ { if (trans_values != NULL) { *trans_values = &(info_ptr->trans_values); retval |= PNG_INFO_tRNS; } if (trans != NULL) *trans = NULL; } if (num_trans != NULL) { *num_trans = info_ptr->num_trans; retval |= PNG_INFO_tRNS; } } return (retval); } ",0 "int __sched ldsem_down_write(struct ld_semaphore *sem, long timeout) { might_sleep(); return __ldsem_down_write_nested(sem, 0, timeout); } ",0 "void PluginServiceImpl::OpenChannelToPpapiBroker( int render_process_id, const FilePath& path, PpapiPluginProcessHost::BrokerClient* client) { PpapiPluginProcessHost* plugin_host = FindOrStartPpapiBrokerProcess( render_process_id, path); if (plugin_host) { plugin_host->OpenChannelToPlugin(client); } else { client->OnPpapiChannelOpened(IPC::ChannelHandle(), base::kNullProcessId, 0); } } ",0 " void FinishTesting() { base::MessageLoop::current()->PostTask(FROM_HERE, quit_closure_); } ",0 "static inline void ipv6_store_devconf(struct ipv6_devconf *cnf, __s32 *array, int bytes) { BUG_ON(bytes < (DEVCONF_MAX * 4)); memset(array, 0, bytes); array[DEVCONF_FORWARDING] = cnf->forwarding; array[DEVCONF_HOPLIMIT] = cnf->hop_limit; array[DEVCONF_MTU6] = cnf->mtu6; array[DEVCONF_ACCEPT_RA] = cnf->accept_ra; array[DEVCONF_ACCEPT_REDIRECTS] = cnf->accept_redirects; array[DEVCONF_AUTOCONF] = cnf->autoconf; array[DEVCONF_DAD_TRANSMITS] = cnf->dad_transmits; array[DEVCONF_RTR_SOLICITS] = cnf->rtr_solicits; array[DEVCONF_RTR_SOLICIT_INTERVAL] = jiffies_to_msecs(cnf->rtr_solicit_interval); array[DEVCONF_RTR_SOLICIT_DELAY] = jiffies_to_msecs(cnf->rtr_solicit_delay); array[DEVCONF_FORCE_MLD_VERSION] = cnf->force_mld_version; array[DEVCONF_MLDV1_UNSOLICITED_REPORT_INTERVAL] = jiffies_to_msecs(cnf->mldv1_unsolicited_report_interval); array[DEVCONF_MLDV2_UNSOLICITED_REPORT_INTERVAL] = jiffies_to_msecs(cnf->mldv2_unsolicited_report_interval); array[DEVCONF_USE_TEMPADDR] = cnf->use_tempaddr; array[DEVCONF_TEMP_VALID_LFT] = cnf->temp_valid_lft; array[DEVCONF_TEMP_PREFERED_LFT] = cnf->temp_prefered_lft; array[DEVCONF_REGEN_MAX_RETRY] = cnf->regen_max_retry; array[DEVCONF_MAX_DESYNC_FACTOR] = cnf->max_desync_factor; array[DEVCONF_MAX_ADDRESSES] = cnf->max_addresses; array[DEVCONF_ACCEPT_RA_DEFRTR] = cnf->accept_ra_defrtr; array[DEVCONF_ACCEPT_RA_PINFO] = cnf->accept_ra_pinfo; #ifdef CONFIG_IPV6_ROUTER_PREF array[DEVCONF_ACCEPT_RA_RTR_PREF] = cnf->accept_ra_rtr_pref; array[DEVCONF_RTR_PROBE_INTERVAL] = jiffies_to_msecs(cnf->rtr_probe_interval); #ifdef CONFIG_IPV6_ROUTE_INFO array[DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN] = cnf->accept_ra_rt_info_max_plen; #endif #endif array[DEVCONF_PROXY_NDP] = cnf->proxy_ndp; array[DEVCONF_ACCEPT_SOURCE_ROUTE] = cnf->accept_source_route; #ifdef CONFIG_IPV6_OPTIMISTIC_DAD array[DEVCONF_OPTIMISTIC_DAD] = cnf->optimistic_dad; array[DEVCONF_USE_OPTIMISTIC] = cnf->use_optimistic; #endif #ifdef CONFIG_IPV6_MROUTE array[DEVCONF_MC_FORWARDING] = cnf->mc_forwarding; #endif array[DEVCONF_DISABLE_IPV6] = cnf->disable_ipv6; array[DEVCONF_ACCEPT_DAD] = cnf->accept_dad; array[DEVCONF_FORCE_TLLAO] = cnf->force_tllao; array[DEVCONF_NDISC_NOTIFY] = cnf->ndisc_notify; array[DEVCONF_SUPPRESS_FRAG_NDISC] = cnf->suppress_frag_ndisc; array[DEVCONF_ACCEPT_RA_FROM_LOCAL] = cnf->accept_ra_from_local; array[DEVCONF_ACCEPT_RA_MTU] = cnf->accept_ra_mtu; } ",0 "int ssl3_get_client_hello(SSL *s) { int i, j, ok, al = SSL_AD_INTERNAL_ERROR, ret = -1, cookie_valid = 0; unsigned int cookie_len; long n; unsigned long id; unsigned char *p, *d; SSL_CIPHER *c; #ifndef OPENSSL_NO_COMP unsigned char *q; SSL_COMP *comp = NULL; #endif STACK_OF(SSL_CIPHER) *ciphers = NULL; if (s->state == SSL3_ST_SR_CLNT_HELLO_C && !s->first_packet) goto retry_cert; /* * We do this so that we will respond with our native type. If we are * TLSv1 and we get SSLv3, we will respond with TLSv1, This down * switching should be handled by a different method. If we are SSLv3, we * will respond with SSLv3, even if prompted with TLSv1. */ if (s->state == SSL3_ST_SR_CLNT_HELLO_A) { s->state = SSL3_ST_SR_CLNT_HELLO_B; } s->first_packet = 1; n = s->method->ssl_get_message(s, SSL3_ST_SR_CLNT_HELLO_B, SSL3_ST_SR_CLNT_HELLO_C, SSL3_MT_CLIENT_HELLO, SSL3_RT_MAX_PLAIN_LENGTH, &ok); if (!ok) return ((int)n); s->first_packet = 0; d = p = (unsigned char *)s->init_msg; /* * 2 bytes for client version, SSL3_RANDOM_SIZE bytes for random, 1 byte * for session id length */ if (n < 2 + SSL3_RANDOM_SIZE + 1) { al = SSL_AD_DECODE_ERROR; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_LENGTH_TOO_SHORT); goto f_err; } /* * use version from inside client hello, not from record header (may * differ: see RFC 2246, Appendix E, second paragraph) */ s->client_version = (((int)p[0]) << 8) | (int)p[1]; p += 2; if (SSL_IS_DTLS(s) ? (s->client_version > s->version && s->method->version != DTLS_ANY_VERSION) : (s->client_version < s->version)) { SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_WRONG_VERSION_NUMBER); if ((s->client_version >> 8) == SSL3_VERSION_MAJOR && !s->enc_write_ctx && !s->write_hash) { /* * similar to ssl3_get_record, send alert using remote version * number */ s->version = s->client_version; } al = SSL_AD_PROTOCOL_VERSION; goto f_err; } /* * If we require cookies and this ClientHello doesn't contain one, just * return since we do not want to allocate any memory yet. So check * cookie length... */ if (SSL_get_options(s) & SSL_OP_COOKIE_EXCHANGE) { unsigned int session_length, cookie_length; session_length = *(p + SSL3_RANDOM_SIZE); if (p + SSL3_RANDOM_SIZE + session_length + 1 >= d + n) { al = SSL_AD_DECODE_ERROR; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_LENGTH_TOO_SHORT); goto f_err; } cookie_length = *(p + SSL3_RANDOM_SIZE + session_length + 1); if (cookie_length == 0) return 1; } /* load the client random */ memcpy(s->s3->client_random, p, SSL3_RANDOM_SIZE); p += SSL3_RANDOM_SIZE; /* get the session-id */ j = *(p++); if (p + j > d + n) { al = SSL_AD_DECODE_ERROR; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_LENGTH_TOO_SHORT); goto f_err; } if ((j < 0) || (j > SSL_MAX_SSL_SESSION_ID_LENGTH)) { al = SSL_AD_DECODE_ERROR; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_LENGTH_MISMATCH); goto f_err; } s->hit = 0; /* * Versions before 0.9.7 always allow clients to resume sessions in * renegotiation. 0.9.7 and later allow this by default, but optionally * ignore resumption requests with flag * SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION (it's a new flag rather * than a change to default behavior so that applications relying on this * for security won't even compile against older library versions). * 1.0.1 and later also have a function SSL_renegotiate_abbreviated() to * request renegotiation but not a new session (s->new_session remains * unset): for servers, this essentially just means that the * SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION setting will be ignored. */ if ((s->new_session && (s->options & SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION))) { if (!ssl_get_new_session(s, 1)) goto err; } else { i = ssl_get_prev_session(s, p, j, d + n); /* * Only resume if the session's version matches the negotiated * version. * RFC 5246 does not provide much useful advice on resumption * with a different protocol version. It doesn't forbid it but * the sanity of such behaviour would be questionable. * In practice, clients do not accept a version mismatch and * will abort the handshake with an error. */ if (i == 1 && s->version == s->session->ssl_version) { /* previous * session */ s->hit = 1; } else if (i == -1) goto err; else { /* i == 0 */ if (!ssl_get_new_session(s, 1)) goto err; } } p += j; if (SSL_IS_DTLS(s)) { /* cookie stuff */ if (p + 1 > d + n) { al = SSL_AD_DECODE_ERROR; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_LENGTH_TOO_SHORT); goto f_err; } cookie_len = *(p++); if (p + cookie_len > d + n) { al = SSL_AD_DECODE_ERROR; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_LENGTH_TOO_SHORT); goto f_err; } /* * The ClientHello may contain a cookie even if the * HelloVerify message has not been sent--make sure that it * does not cause an overflow. */ if (cookie_len > sizeof(s->d1->rcvd_cookie)) { /* too much data */ al = SSL_AD_DECODE_ERROR; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_COOKIE_MISMATCH); goto f_err; } /* verify the cookie if appropriate option is set. */ if ((SSL_get_options(s) & SSL_OP_COOKIE_EXCHANGE) && cookie_len > 0) { memcpy(s->d1->rcvd_cookie, p, cookie_len); if (s->ctx->app_verify_cookie_cb != NULL) { if (s->ctx->app_verify_cookie_cb(s, s->d1->rcvd_cookie, cookie_len) == 0) { al = SSL_AD_HANDSHAKE_FAILURE; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_COOKIE_MISMATCH); goto f_err; } /* else cookie verification succeeded */ } /* default verification */ else if (memcmp(s->d1->rcvd_cookie, s->d1->cookie, s->d1->cookie_len) != 0) { al = SSL_AD_HANDSHAKE_FAILURE; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_COOKIE_MISMATCH); goto f_err; } cookie_valid = 1; } p += cookie_len; if (s->method->version == DTLS_ANY_VERSION) { /* Select version to use */ if (s->client_version <= DTLS1_2_VERSION && !(s->options & SSL_OP_NO_DTLSv1_2)) { s->version = DTLS1_2_VERSION; s->method = DTLSv1_2_server_method(); } else if (tls1_suiteb(s)) { SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_ONLY_DTLS_1_2_ALLOWED_IN_SUITEB_MODE); s->version = s->client_version; al = SSL_AD_PROTOCOL_VERSION; goto f_err; } else if (s->client_version <= DTLS1_VERSION && !(s->options & SSL_OP_NO_DTLSv1)) { s->version = DTLS1_VERSION; s->method = DTLSv1_server_method(); } else { SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_WRONG_VERSION_NUMBER); s->version = s->client_version; al = SSL_AD_PROTOCOL_VERSION; goto f_err; } s->session->ssl_version = s->version; } } if (p + 2 > d + n) { al = SSL_AD_DECODE_ERROR; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_LENGTH_TOO_SHORT); goto f_err; } n2s(p, i); if (i == 0) { al = SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_NO_CIPHERS_SPECIFIED); goto f_err; } /* i bytes of cipher data + 1 byte for compression length later */ if ((p + i + 1) > (d + n)) { /* not enough data */ al = SSL_AD_DECODE_ERROR; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_LENGTH_MISMATCH); goto f_err; } if (ssl_bytes_to_cipher_list(s, p, i, &(ciphers)) == NULL) { goto err; } p += i; /* If it is a hit, check that the cipher is in the list */ if (s->hit) { j = 0; id = s->session->cipher->id; #ifdef CIPHER_DEBUG fprintf(stderr, ""client sent %d ciphers\n"", sk_SSL_CIPHER_num(ciphers)); #endif for (i = 0; i < sk_SSL_CIPHER_num(ciphers); i++) { c = sk_SSL_CIPHER_value(ciphers, i); #ifdef CIPHER_DEBUG fprintf(stderr, ""client [%2d of %2d]:%s\n"", i, sk_SSL_CIPHER_num(ciphers), SSL_CIPHER_get_name(c)); #endif if (c->id == id) { j = 1; break; } } /* * Disabled because it can be used in a ciphersuite downgrade attack: * CVE-2010-4180. */ #if 0 if (j == 0 && (s->options & SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG) && (sk_SSL_CIPHER_num(ciphers) == 1)) { /* * Special case as client bug workaround: the previously used * cipher may not be in the current list, the client instead * might be trying to continue using a cipher that before wasn't * chosen due to server preferences. We'll have to reject the * connection if the cipher is not enabled, though. */ c = sk_SSL_CIPHER_value(ciphers, 0); if (sk_SSL_CIPHER_find(SSL_get_ciphers(s), c) >= 0) { s->session->cipher = c; j = 1; } } #endif if (j == 0) { /* * we need to have the cipher in the cipher list if we are asked * to reuse it */ al = SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_REQUIRED_CIPHER_MISSING); goto f_err; } } /* compression */ i = *(p++); if ((p + i) > (d + n)) { /* not enough data */ al = SSL_AD_DECODE_ERROR; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_LENGTH_MISMATCH); goto f_err; } #ifndef OPENSSL_NO_COMP q = p; #endif for (j = 0; j < i; j++) { if (p[j] == 0) break; } p += i; if (j >= i) { /* no compress */ al = SSL_AD_DECODE_ERROR; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_NO_COMPRESSION_SPECIFIED); goto f_err; } #ifndef OPENSSL_NO_TLSEXT /* TLS extensions */ if (s->version >= SSL3_VERSION) { if (!ssl_parse_clienthello_tlsext(s, &p, d + n)) { SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_PARSE_TLSEXT); goto err; } } /* * Check if we want to use external pre-shared secret for this handshake * for not reused session only. We need to generate server_random before * calling tls_session_secret_cb in order to allow SessionTicket * processing to use it in key derivation. */ { unsigned char *pos; pos = s->s3->server_random; if (ssl_fill_hello_random(s, 1, pos, SSL3_RANDOM_SIZE) <= 0) { goto f_err; } } if (!s->hit && s->version >= TLS1_VERSION && s->tls_session_secret_cb) { SSL_CIPHER *pref_cipher = NULL; s->session->master_key_length = sizeof(s->session->master_key); if (s->tls_session_secret_cb(s, s->session->master_key, &s->session->master_key_length, ciphers, &pref_cipher, s->tls_session_secret_cb_arg)) { s->hit = 1; s->session->ciphers = ciphers; s->session->verify_result = X509_V_OK; ciphers = NULL; /* check if some cipher was preferred by call back */ pref_cipher = pref_cipher ? pref_cipher : ssl3_choose_cipher(s, s-> session->ciphers, SSL_get_ciphers (s)); if (pref_cipher == NULL) { al = SSL_AD_HANDSHAKE_FAILURE; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_NO_SHARED_CIPHER); goto f_err; } s->session->cipher = pref_cipher; if (s->cipher_list) sk_SSL_CIPHER_free(s->cipher_list); if (s->cipher_list_by_id) sk_SSL_CIPHER_free(s->cipher_list_by_id); s->cipher_list = sk_SSL_CIPHER_dup(s->session->ciphers); s->cipher_list_by_id = sk_SSL_CIPHER_dup(s->session->ciphers); } } #endif /* * Worst case, we will use the NULL compression, but if we have other * options, we will now look for them. We have i-1 compression * algorithms from the client, starting at q. */ s->s3->tmp.new_compression = NULL; #ifndef OPENSSL_NO_COMP /* This only happens if we have a cache hit */ if (s->session->compress_meth != 0) { int m, comp_id = s->session->compress_meth; /* Perform sanity checks on resumed compression algorithm */ /* Can't disable compression */ if (s->options & SSL_OP_NO_COMPRESSION) { SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_INCONSISTENT_COMPRESSION); goto f_err; } /* Look for resumed compression method */ for (m = 0; m < sk_SSL_COMP_num(s->ctx->comp_methods); m++) { comp = sk_SSL_COMP_value(s->ctx->comp_methods, m); if (comp_id == comp->id) { s->s3->tmp.new_compression = comp; break; } } if (s->s3->tmp.new_compression == NULL) { SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_INVALID_COMPRESSION_ALGORITHM); goto f_err; } /* Look for resumed method in compression list */ for (m = 0; m < i; m++) { if (q[m] == comp_id) break; } if (m >= i) { al = SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_REQUIRED_COMPRESSSION_ALGORITHM_MISSING); goto f_err; } } else if (s->hit) comp = NULL; else if (!(s->options & SSL_OP_NO_COMPRESSION) && s->ctx->comp_methods) { /* See if we have a match */ int m, nn, o, v, done = 0; nn = sk_SSL_COMP_num(s->ctx->comp_methods); for (m = 0; m < nn; m++) { comp = sk_SSL_COMP_value(s->ctx->comp_methods, m); v = comp->id; for (o = 0; o < i; o++) { if (v == q[o]) { done = 1; break; } } if (done) break; } if (done) s->s3->tmp.new_compression = comp; else comp = NULL; } #else /* * If compression is disabled we'd better not try to resume a session * using compression. */ if (s->session->compress_meth != 0) { SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_INCONSISTENT_COMPRESSION); goto f_err; } #endif /* * Given s->session->ciphers and SSL_get_ciphers, we must pick a cipher */ if (!s->hit) { #ifdef OPENSSL_NO_COMP s->session->compress_meth = 0; #else s->session->compress_meth = (comp == NULL) ? 0 : comp->id; #endif if (s->session->ciphers != NULL) sk_SSL_CIPHER_free(s->session->ciphers); s->session->ciphers = ciphers; if (ciphers == NULL) { al = SSL_AD_INTERNAL_ERROR; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, ERR_R_INTERNAL_ERROR); goto f_err; } ciphers = NULL; if (!tls1_set_server_sigalgs(s)) { SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_CLIENTHELLO_TLSEXT); goto err; } /* Let cert callback update server certificates if required */ retry_cert: if (s->cert->cert_cb) { int rv = s->cert->cert_cb(s, s->cert->cert_cb_arg); if (rv == 0) { al = SSL_AD_INTERNAL_ERROR; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_CERT_CB_ERROR); goto f_err; } if (rv < 0) { s->rwstate = SSL_X509_LOOKUP; return -1; } s->rwstate = SSL_NOTHING; } c = ssl3_choose_cipher(s, s->session->ciphers, SSL_get_ciphers(s)); if (c == NULL) { al = SSL_AD_HANDSHAKE_FAILURE; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_NO_SHARED_CIPHER); goto f_err; } s->s3->tmp.new_cipher = c; } else { /* Session-id reuse */ #ifdef REUSE_CIPHER_BUG STACK_OF(SSL_CIPHER) *sk; SSL_CIPHER *nc = NULL; SSL_CIPHER *ec = NULL; if (s->options & SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG) { sk = s->session->ciphers; for (i = 0; i < sk_SSL_CIPHER_num(sk); i++) { c = sk_SSL_CIPHER_value(sk, i); if (c->algorithm_enc & SSL_eNULL) nc = c; if (SSL_C_IS_EXPORT(c)) ec = c; } if (nc != NULL) s->s3->tmp.new_cipher = nc; else if (ec != NULL) s->s3->tmp.new_cipher = ec; else s->s3->tmp.new_cipher = s->session->cipher; } else #endif s->s3->tmp.new_cipher = s->session->cipher; } if (!SSL_USE_SIGALGS(s) || !(s->verify_mode & SSL_VERIFY_PEER)) { if (!ssl3_digest_cached_records(s)) goto f_err; } /*- * we now have the following setup. * client_random * cipher_list - our prefered list of ciphers * ciphers - the clients prefered list of ciphers * compression - basically ignored right now * ssl version is set - sslv3 * s->session - The ssl session has been setup. * s->hit - session reuse flag * s->tmp.new_cipher - the new cipher to use. */ /* Handles TLS extensions that we couldn't check earlier */ if (s->version >= SSL3_VERSION) { if (ssl_check_clienthello_tlsext_late(s) <= 0) { SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_CLIENTHELLO_TLSEXT); goto err; } } ret = cookie_valid ? 2 : 1; if (0) { f_err: ssl3_send_alert(s, SSL3_AL_FATAL, al); err: s->state = SSL_ST_ERR; } if (ciphers != NULL) sk_SSL_CIPHER_free(ciphers); return ret; } ",0 "bool WebGLRenderingContextBase::ValidateHTMLImageElement( const SecurityOrigin* security_origin, const char* function_name, HTMLImageElement* image, ExceptionState& exception_state) { if (!image || !image->CachedImage()) { SynthesizeGLError(GL_INVALID_VALUE, function_name, ""no image""); return false; } const KURL& url = image->CachedImage()->GetResponse().Url(); if (url.IsNull() || url.IsEmpty() || !url.IsValid()) { SynthesizeGLError(GL_INVALID_VALUE, function_name, ""invalid image""); return false; } if (WouldTaintOrigin(image, security_origin)) { exception_state.ThrowSecurityError(""The cross-origin image at "" + url.ElidedString() + "" may not be loaded.""); return false; } return true; } ",1 "static int snd_seq_ioctl_set_queue_client(struct snd_seq_client *client, void *arg) { struct snd_seq_queue_client *info = arg; int err; if (info->used >= 0) { err = snd_seq_queue_use(info->queue, client->number, info->used); if (err < 0) return err; } return snd_seq_ioctl_get_queue_client(client, arg); } ",0 "void RenderWidget::OnCreateVideoAck(int32 video_id) { } ",0 "InitEntries(Entries *e) { e->room = INIT_ENTRY_SIZE; e->used = 0; e->entry = (Entry *)malloc(INIT_ENTRY_SIZE*sizeof(Entry)); } ",0 "ofputil_encode_flow_mod(const struct ofputil_flow_mod *fm, enum ofputil_protocol protocol) { enum ofp_version version = ofputil_protocol_to_ofp_version(protocol); ovs_be16 raw_flags = ofputil_encode_flow_mod_flags(fm->flags, version); struct ofpbuf *msg; switch (protocol) { case OFPUTIL_P_OF11_STD: case OFPUTIL_P_OF12_OXM: case OFPUTIL_P_OF13_OXM: case OFPUTIL_P_OF14_OXM: case OFPUTIL_P_OF15_OXM: case OFPUTIL_P_OF16_OXM: { struct ofp11_flow_mod *ofm; int tailroom; tailroom = ofputil_match_typical_len(protocol) + fm->ofpacts_len; msg = ofpraw_alloc(OFPRAW_OFPT11_FLOW_MOD, version, tailroom); ofm = ofpbuf_put_zeros(msg, sizeof *ofm); if ((protocol == OFPUTIL_P_OF11_STD && (fm->command == OFPFC_MODIFY || fm->command == OFPFC_MODIFY_STRICT) && fm->cookie_mask == htonll(0)) || fm->command == OFPFC_ADD) { ofm->cookie = fm->new_cookie; } else { ofm->cookie = fm->cookie & fm->cookie_mask; } ofm->cookie_mask = fm->cookie_mask; if (fm->table_id != OFPTT_ALL || (protocol != OFPUTIL_P_OF11_STD && (fm->command == OFPFC_DELETE || fm->command == OFPFC_DELETE_STRICT))) { ofm->table_id = fm->table_id; } else { ofm->table_id = 0; } ofm->command = fm->command; ofm->idle_timeout = htons(fm->idle_timeout); ofm->hard_timeout = htons(fm->hard_timeout); ofm->priority = htons(fm->priority); ofm->buffer_id = htonl(fm->buffer_id); ofm->out_port = ofputil_port_to_ofp11(fm->out_port); ofm->out_group = htonl(fm->out_group); ofm->flags = raw_flags; if (version >= OFP14_VERSION && fm->command == OFPFC_ADD) { ofm->importance = htons(fm->importance); } else { ofm->importance = 0; } ofputil_put_ofp11_match(msg, &fm->match, protocol); ofpacts_put_openflow_instructions(fm->ofpacts, fm->ofpacts_len, msg, version); break; } case OFPUTIL_P_OF10_STD: case OFPUTIL_P_OF10_STD_TID: { struct ofp10_flow_mod *ofm; msg = ofpraw_alloc(OFPRAW_OFPT10_FLOW_MOD, OFP10_VERSION, fm->ofpacts_len); ofm = ofpbuf_put_zeros(msg, sizeof *ofm); ofputil_match_to_ofp10_match(&fm->match, &ofm->match); ofm->cookie = fm->new_cookie; ofm->command = ofputil_tid_command(fm, protocol); ofm->idle_timeout = htons(fm->idle_timeout); ofm->hard_timeout = htons(fm->hard_timeout); ofm->priority = htons(fm->priority); ofm->buffer_id = htonl(fm->buffer_id); ofm->out_port = htons(ofp_to_u16(fm->out_port)); ofm->flags = raw_flags; ofpacts_put_openflow_actions(fm->ofpacts, fm->ofpacts_len, msg, version); break; } case OFPUTIL_P_OF10_NXM: case OFPUTIL_P_OF10_NXM_TID: { struct nx_flow_mod *nfm; int match_len; msg = ofpraw_alloc(OFPRAW_NXT_FLOW_MOD, OFP10_VERSION, NXM_TYPICAL_LEN + fm->ofpacts_len); nfm = ofpbuf_put_zeros(msg, sizeof *nfm); nfm->command = ofputil_tid_command(fm, protocol); nfm->cookie = fm->new_cookie; match_len = nx_put_match(msg, &fm->match, fm->cookie, fm->cookie_mask); nfm = msg->msg; nfm->idle_timeout = htons(fm->idle_timeout); nfm->hard_timeout = htons(fm->hard_timeout); nfm->priority = htons(fm->priority); nfm->buffer_id = htonl(fm->buffer_id); nfm->out_port = htons(ofp_to_u16(fm->out_port)); nfm->flags = raw_flags; nfm->match_len = htons(match_len); ofpacts_put_openflow_actions(fm->ofpacts, fm->ofpacts_len, msg, version); break; } default: OVS_NOT_REACHED(); } ofpmsg_update_length(msg); return msg; } ",0 "SystemURLRequestContextGetter::GetNetworkTaskRunner() const { return network_task_runner_; } ",0 "GF_Err iSFM_dump(GF_Box *a, FILE * trace) { GF_ISMASampleFormatBox *p; const char *name = (a->type==GF_ISOM_BOX_TYPE_ISFM) ? ""ISMASampleFormat"" : ""OMADRMAUFormatBox""; p = (GF_ISMASampleFormatBox *)a; gf_isom_box_dump_start(a, name, trace); fprintf(trace, ""selective_encryption=\""%d\"" key_indicator_length=\""%d\"" IV_length=\""%d\"">\n"", p->selective_encryption, p->key_indicator_length, p->IV_length); gf_isom_box_dump_done(name, a, trace); return GF_OK; } ",0 "static void flush_backlog(void *arg) { struct net_device *dev = arg; struct softnet_data *queue = &__get_cpu_var(softnet_data); struct sk_buff *skb, *tmp; skb_queue_walk_safe(&queue->input_pkt_queue, skb, tmp) if (skb->dev == dev) { __skb_unlink(skb, &queue->input_pkt_queue); kfree_skb(skb); } } ",0 "static void freefieldlist(struct fieldlist *l) { struct fieldlist *n; while (l) { n = l->next; free(l->section); strarray_free(l->fields); free(l->trail); if (l->rock) free(l->rock); free((char *)l); l = n; } } ",0 "void ExtensionInfoBar::RunMenu(View* source, const gfx::Point& pt) { const Extension* extension = delegate_->extension_host()->extension(); if (!extension->ShowConfigureContextMenus()) return; if (!options_menu_contents_.get()) { Browser* browser = BrowserView::GetBrowserViewForNativeWindow( platform_util::GetTopLevel(source->GetWidget()->GetNativeView()))-> browser(); options_menu_contents_ = new ExtensionContextMenuModel( extension, browser, NULL); } options_menu_menu_.reset(new views::Menu2(options_menu_contents_.get())); options_menu_menu_->RunMenuAt(pt, views::Menu2::ALIGN_TOPLEFT); } ",0 "void WebContents::SetScreenOrientationDelegate( ScreenOrientationDelegate* delegate) { ScreenOrientationProvider::SetDelegate(delegate); } ",0 "bool DefaultTabHandler::CanCloseTab() const { return delegate_->AsBrowser()->CanCloseTab(); } ",0 "bool Camera3Device::RequestThread::threadLoop() { ATRACE_CALL(); status_t res; if (waitIfPaused()) { return true; } waitForNextRequestBatch(); if (mNextRequests.size() == 0) { return true; } int latestRequestId; camera_metadata_entry_t requestIdEntry = mNextRequests[mNextRequests.size() - 1]. captureRequest->mSettings.find(ANDROID_REQUEST_ID); if (requestIdEntry.count > 0) { latestRequestId = requestIdEntry.data.i32[0]; } else { ALOGW(""%s: Did not have android.request.id set in the request."", __FUNCTION__); latestRequestId = NAME_NOT_FOUND; } res = prepareHalRequests(); if (res == TIMED_OUT) { cleanUpFailedRequests(/*sendRequestError*/ true); return true; } else if (res != OK) { cleanUpFailedRequests(/*sendRequestError*/ false); return false; } { Mutex::Autolock al(mLatestRequestMutex); mLatestRequestId = latestRequestId; mLatestRequestSignal.signal(); } bool useFlushLock = mNextRequests.size() > 1; if (useFlushLock) { mFlushLock.lock(); } ALOGVV(""%s: %d: submitting %d requests in a batch."", __FUNCTION__, __LINE__, mNextRequests.size()); for (auto& nextRequest : mNextRequests) { ATRACE_ASYNC_BEGIN(""frame capture"", nextRequest.halRequest.frame_number); ATRACE_BEGIN(""camera3->process_capture_request""); res = mHal3Device->ops->process_capture_request(mHal3Device, &nextRequest.halRequest); ATRACE_END(); if (res != OK) { SET_ERR(""RequestThread: Unable to submit capture request %d to HAL"" "" device: %s (%d)"", nextRequest.halRequest.frame_number, strerror(-res), res); cleanUpFailedRequests(/*sendRequestError*/ false); if (useFlushLock) { mFlushLock.unlock(); } return false; } nextRequest.submitted = true; if (nextRequest.halRequest.settings != NULL) { // Don't update if they were unchanged Mutex::Autolock al(mLatestRequestMutex); camera_metadata_t* cloned = clone_camera_metadata(nextRequest.halRequest.settings); mLatestRequest.acquire(cloned); } if (nextRequest.halRequest.settings != NULL) { nextRequest.captureRequest->mSettings.unlock(nextRequest.halRequest.settings); } res = removeTriggers(mPrevRequest); if (res != OK) { SET_ERR(""RequestThread: Unable to remove triggers "" ""(capture request %d, HAL device: %s (%d)"", nextRequest.halRequest.frame_number, strerror(-res), res); cleanUpFailedRequests(/*sendRequestError*/ false); if (useFlushLock) { mFlushLock.unlock(); } return false; } } if (useFlushLock) { mFlushLock.unlock(); } { Mutex::Autolock l(mRequestLock); mNextRequests.clear(); } return true; } ",0 "NavigationController::NavigationController( TabContents* contents, Profile* profile, SessionStorageNamespace* session_storage_namespace) : profile_(profile), pending_entry_(NULL), last_committed_entry_index_(-1), pending_entry_index_(-1), transient_entry_index_(-1), tab_contents_(contents), max_restored_page_id_(-1), ALLOW_THIS_IN_INITIALIZER_LIST(ssl_manager_(this)), needs_reload_(false), session_storage_namespace_(session_storage_namespace), pending_reload_(NO_RELOAD) { DCHECK(profile_); if (!session_storage_namespace_) { session_storage_namespace_ = new SessionStorageNamespace( profile_->GetWebKitContext()); } } ",0 "void WebKitTestResultPrinter::PrintTextBlock(const std::string& block) { if (state_ != IN_TEXT_BLOCK) return; *output_ << block; } ",0 "static inline void ipmi_si_set_not_busy(struct timespec64 *ts) { ts->tv_nsec = -1; } ",0 "int BrowserNonClientFrameViewAura::NonClientHitTest(const gfx::Point& point) { return frame_painter_->NonClientHitTest(this, point); } ",0 "static int bond_close(struct net_device *bond_dev) { struct bonding *bond = netdev_priv(bond_dev); write_lock_bh(&bond->lock); bond->send_peer_notif = 0; /* signal timers not to re-arm */ bond->kill_timers = 1; write_unlock_bh(&bond->lock); if (bond->params.miimon) { /* link check interval, in milliseconds. */ cancel_delayed_work(&bond->mii_work); } if (bond->params.arp_interval) { /* arp interval, in milliseconds. */ cancel_delayed_work(&bond->arp_work); } switch (bond->params.mode) { case BOND_MODE_8023AD: cancel_delayed_work(&bond->ad_work); break; case BOND_MODE_TLB: case BOND_MODE_ALB: cancel_delayed_work(&bond->alb_work); break; default: break; } if (delayed_work_pending(&bond->mcast_work)) cancel_delayed_work(&bond->mcast_work); if (bond_is_lb(bond)) { /* Must be called only after all * slaves have been released */ bond_alb_deinitialize(bond); } bond->recv_probe = NULL; return 0; } ",0 "const char* CMSEXPORT cmsIT8GetProperty(cmsHANDLE hIT8, const char* Key) { cmsIT8* it8 = (cmsIT8*) hIT8; KEYVALUE* p; if (IsAvailableOnList(GetTable(it8) -> HeaderList, Key, NULL, &p)) { return p -> Value; } return NULL; } ",0 "bshift (u32 * M, int i) { u32 t[4], mask; t[0] = M[i * 4 + 0]; t[1] = M[i * 4 + 1]; t[2] = M[i * 4 + 2]; t[3] = M[i * 4 + 3]; mask = -(t[3] & 1) & 0xe1; M[i * 4 + 3] = (t[3] >> 1) ^ (t[2] << 31); M[i * 4 + 2] = (t[2] >> 1) ^ (t[1] << 31); M[i * 4 + 1] = (t[1] >> 1) ^ (t[0] << 31); M[i * 4 + 0] = (t[0] >> 1) ^ (mask << 24); } ",0 "static void ndisc_solicit(struct neighbour *neigh, struct sk_buff *skb) { struct in6_addr *saddr = NULL; struct in6_addr mcaddr; struct net_device *dev = neigh->dev; struct in6_addr *target = (struct in6_addr *)&neigh->primary_key; int probes = atomic_read(&neigh->probes); if (skb && ipv6_chk_addr_and_flags(dev_net(dev), &ipv6_hdr(skb)->saddr, dev, 1, IFA_F_TENTATIVE|IFA_F_OPTIMISTIC)) saddr = &ipv6_hdr(skb)->saddr; probes -= NEIGH_VAR(neigh->parms, UCAST_PROBES); if (probes < 0) { if (!(neigh->nud_state & NUD_VALID)) { ND_PRINTK(1, dbg, ""%s: trying to ucast probe in NUD_INVALID: %pI6\n"", __func__, target); } ndisc_send_ns(dev, neigh, target, target, saddr); } else if ((probes -= NEIGH_VAR(neigh->parms, APP_PROBES)) < 0) { neigh_app_ns(neigh); } else { addrconf_addr_solict_mult(target, &mcaddr); ndisc_send_ns(dev, NULL, target, &mcaddr, saddr); } } ",0 "QQuickWebPage* QQuickWebView::page() { Q_D(QQuickWebView); return d->pageView.data(); } ",0 "bool TryGetGamepadButton(const vr::VRControllerState_t& controller_state, uint64_t supported_buttons, vr::EVRButtonId button_id, GamepadButton* button) { uint64_t button_mask = vr::ButtonMaskFromId(button_id); if ((supported_buttons & button_mask) != 0) { bool button_pressed = (controller_state.ulButtonPressed & button_mask) != 0; bool button_touched = (controller_state.ulButtonTouched & button_mask) != 0; button->touched = button_touched || button_pressed; button->pressed = button_pressed; button->value = button_pressed ? 1.0 : 0.0; return true; } return false; } ",0 "static long btrfs_ioctl_default_subvol(struct file *file, void __user *argp) { struct inode *inode = fdentry(file)->d_inode; struct btrfs_root *root = BTRFS_I(inode)->root; struct btrfs_root *new_root; struct btrfs_dir_item *di; struct btrfs_trans_handle *trans; struct btrfs_path *path; struct btrfs_key location; struct btrfs_disk_key disk_key; u64 objectid = 0; u64 dir_id; int ret; if (!capable(CAP_SYS_ADMIN)) return -EPERM; ret = mnt_want_write_file(file); if (ret) return ret; if (copy_from_user(&objectid, argp, sizeof(objectid))) { ret = -EFAULT; goto out; } if (!objectid) objectid = root->root_key.objectid; location.objectid = objectid; location.type = BTRFS_ROOT_ITEM_KEY; location.offset = (u64)-1; new_root = btrfs_read_fs_root_no_name(root->fs_info, &location); if (IS_ERR(new_root)) { ret = PTR_ERR(new_root); goto out; } if (btrfs_root_refs(&new_root->root_item) == 0) { ret = -ENOENT; goto out; } path = btrfs_alloc_path(); if (!path) { ret = -ENOMEM; goto out; } path->leave_spinning = 1; trans = btrfs_start_transaction(root, 1); if (IS_ERR(trans)) { btrfs_free_path(path); ret = PTR_ERR(trans); goto out; } dir_id = btrfs_super_root_dir(root->fs_info->super_copy); di = btrfs_lookup_dir_item(trans, root->fs_info->tree_root, path, dir_id, ""default"", 7, 1); if (IS_ERR_OR_NULL(di)) { btrfs_free_path(path); btrfs_end_transaction(trans, root); printk(KERN_ERR ""Umm, you don't have the default dir item, "" ""this isn't going to work\n""); ret = -ENOENT; goto out; } btrfs_cpu_key_to_disk(&disk_key, &new_root->root_key); btrfs_set_dir_item_key(path->nodes[0], di, &disk_key); btrfs_mark_buffer_dirty(path->nodes[0]); btrfs_free_path(path); btrfs_set_fs_incompat(root->fs_info, DEFAULT_SUBVOL); btrfs_end_transaction(trans, root); out: mnt_drop_write_file(file); return ret; } ",0 "SetupWildMatch(FontTablePtr table, FontNamePtr pat, int *leftp, int *rightp, int *privatep) { int nDashes; char c; char *t; char *firstWild; char *firstDigit; int first; int center, left, right; int result; char *name; name = pat->name; nDashes = pat->ndashes; firstWild = 0; firstDigit = 0; t = name; while ((c = *t++)) { if (isWild(c)) { if (!firstWild) firstWild = t - 1; } if (isDigit(c)) { if (!firstDigit) firstDigit = t - 1; } } left = 0; right = table->used; if (firstWild) *privatep = nDashes; else *privatep = -1; if (!table->sorted) { *leftp = left; *rightp = right; return -1; } else if (firstWild) { if (firstDigit && firstDigit < firstWild) first = firstDigit - name; else first = firstWild - name; while (left < right) { center = (left + right) / 2; result = strncmp(name, table->entries[center].name.name, first); if (result == 0) break; if (result < 0) right = center; else left = center + 1; } *leftp = left; *rightp = right; return -1; } else { while (left < right) { center = (left + right) / 2; result = strcmpn(name, table->entries[center].name.name); if (result == 0) return center; if (result < 0) right = center; else left = center + 1; } *leftp = 1; *rightp = 0; return -1; } } ",0 "nautilus_file_operations_link (GList *files, GArray *relative_item_points, GFile *target_dir, GtkWindow *parent_window, NautilusCopyCallback done_callback, gpointer done_callback_data) { GTask *task; CopyMoveJob *job; job = op_job_new (CopyMoveJob, parent_window); job->done_callback = done_callback; job->done_callback_data = done_callback_data; job->files = g_list_copy_deep (files, (GCopyFunc) g_object_ref, NULL); job->destination = g_object_ref (target_dir); /* Need to indicate the destination for the operation notification open * button. */ nautilus_progress_info_set_destination (((CommonJob *) job)->progress, target_dir); if (relative_item_points != NULL && relative_item_points->len > 0) { job->icon_positions = g_memdup (relative_item_points->data, sizeof (GdkPoint) * relative_item_points->len); job->n_icon_positions = relative_item_points->len; } job->debuting_files = g_hash_table_new_full (g_file_hash, (GEqualFunc) g_file_equal, g_object_unref, NULL); if (!nautilus_file_undo_manager_is_operating ()) { GFile *src_dir; src_dir = g_file_get_parent (files->data); job->common.undo_info = nautilus_file_undo_info_ext_new (NAUTILUS_FILE_UNDO_OP_CREATE_LINK, g_list_length (files), src_dir, target_dir); g_object_unref (src_dir); } task = g_task_new (NULL, job->common.cancellable, link_task_done, job); g_task_set_task_data (task, job, NULL); g_task_run_in_thread (task, link_task_thread_func); g_object_unref (task); } ",0 "static void anyCallbackFunctionOptionalAnyArgMethodMethodCallback(const v8::FunctionCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMMethod""); TestObjectPythonV8Internal::anyCallbackFunctionOptionalAnyArgMethodMethod(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "RenderViewImpl* RenderViewImpl::Create( gfx::NativeViewId parent_hwnd, int32 opener_id, const content::RendererPreferences& renderer_prefs, const WebPreferences& webkit_prefs, SharedRenderViewCounter* counter, int32 routing_id, int32 surface_id, int64 session_storage_namespace_id, const string16& frame_name, bool is_renderer_created, bool swapped_out, int32 next_page_id, const WebKit::WebScreenInfo& screen_info, content::old::GuestToEmbedderChannel* guest_to_embedder_channel, AccessibilityMode accessibility_mode) { DCHECK(routing_id != MSG_ROUTING_NONE); return new RenderViewImpl( parent_hwnd, opener_id, renderer_prefs, webkit_prefs, counter, routing_id, surface_id, session_storage_namespace_id, frame_name, is_renderer_created, swapped_out, next_page_id, screen_info, guest_to_embedder_channel, accessibility_mode); } ",0 " virtual int DoSwitchToSpdyTest(SocketStreamEvent* event) { return ERR_PROTOCOL_SWITCHED; } ",0 "void account_idle_time(cputime_t cputime) { struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat; cputime64_t cputime64 = cputime_to_cputime64(cputime); struct rq *rq = this_rq(); if (atomic_read(&rq->nr_iowait) > 0) cpustat->iowait = cputime64_add(cpustat->iowait, cputime64); else cpustat->idle = cputime64_add(cpustat->idle, cputime64); } ",0 "content::ColorChooser* Browser::OpenColorChooser( WebContents* web_contents, SkColor initial_color, const std::vector& suggestions) { return chrome::ShowColorChooser(web_contents, initial_color); } ",0 "COMPS_HSList ** comps_mrtree_getp(COMPS_MRTree * rt, const char * key) { COMPS_HSList * subnodes; COMPS_HSListItem * it = NULL; COMPS_MRTreeData * rtdata; unsigned int offset, len, x; char found, ended; len = strlen(key); offset = 0; subnodes = rt->subnodes; while (offset != len) { found = 0; for (it = subnodes->first; it != NULL; it=it->next) { if (((COMPS_MRTreeData*)it->data)->key[0] == key[offset]) { found = 1; break; } } if (!found) return NULL; rtdata = (COMPS_MRTreeData*)it->data; for (x=1; ;x++) { ended=0; if (rtdata->key[x] == 0) ended += 1; if (x == len - offset) ended += 2; if (ended != 0) break; if (key[offset+x] != rtdata->key[x]) break; } if (ended == 3) return &rtdata->data; else if (ended == 1) offset+=x; else return NULL; subnodes = ((COMPS_MRTreeData*)it->data)->subnodes; } if (it) return &((COMPS_MRTreeData*)it->data)->data; else return NULL; } ",0 "xmlParseBalancedChunkMemory(xmlDocPtr doc, xmlSAXHandlerPtr sax, void *user_data, int depth, const xmlChar *string, xmlNodePtr *lst) { return xmlParseBalancedChunkMemoryRecover( doc, sax, user_data, depth, string, lst, 0 ); } ",0 "void megasas_do_ocr(struct megasas_instance *instance) { if ((instance->pdev->device == PCI_DEVICE_ID_LSI_SAS1064R) || (instance->pdev->device == PCI_DEVICE_ID_DELL_PERC5) || (instance->pdev->device == PCI_DEVICE_ID_LSI_VERDE_ZCR)) { *instance->consumer = cpu_to_le32(MEGASAS_ADPRESET_INPROG_SIGN); } instance->instancet->disable_intr(instance); atomic_set(&instance->adprecovery, MEGASAS_ADPRESET_SM_INFAULT); instance->issuepend_done = 0; atomic_set(&instance->fw_outstanding, 0); megasas_internal_reset_defer_cmds(instance); process_fw_state_change_wq(&instance->work_init); } ",0 " hash_insert( char* key, size_t data, hashtable* ht, FT_Memory memory ) { hashnode nn, *bp = hash_bucket( key, ht ); FT_Error error = BDF_Err_Ok; nn = *bp; if ( !nn ) { if ( FT_NEW( nn ) ) goto Exit; *bp = nn; nn->key = key; nn->data = data; if ( ht->used >= ht->limit ) { error = hash_rehash( ht, memory ); if ( error ) goto Exit; } ht->used++; } else nn->data = data; Exit: return error; } ",0 "void RTCPeerConnection::changeReadyState(ReadyState readyState) { if (readyState == m_readyState || m_readyState == ReadyStateClosed) return; m_readyState = readyState; switch (m_readyState) { case ReadyStateOpening: break; case ReadyStateActive: dispatchEvent(Event::create(eventNames().openEvent, false, false)); break; case ReadyStateClosing: case ReadyStateClosed: break; case ReadyStateNew: ASSERT_NOT_REACHED(); break; } dispatchEvent(Event::create(eventNames().statechangeEvent, false, false)); } ",0 "sf_read_float (SNDFILE *sndfile, float *ptr, sf_count_t len) { SF_PRIVATE *psf ; sf_count_t count, extra ; VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ; if (psf->file.mode == SFM_WRITE) { psf->error = SFE_NOT_READMODE ; return 0 ; } ; if (len % psf->sf.channels) { psf->error = SFE_BAD_READ_ALIGN ; return 0 ; } ; if (len <= 0 || psf->read_current >= psf->sf.frames) { psf_memset (ptr, 0, len * sizeof (float)) ; return 0 ; } ; if (psf->read_float == NULL || psf->seek == NULL) { psf->error = SFE_UNIMPLEMENTED ; return 0 ; } ; if (psf->last_op != SFM_READ) if (psf->seek (psf, SFM_READ, psf->read_current) < 0) return 0 ; count = psf->read_float (psf, ptr, len) ; if (psf->read_current + count / psf->sf.channels <= psf->sf.frames) psf->read_current += count / psf->sf.channels ; else { count = (psf->sf.frames - psf->read_current) * psf->sf.channels ; extra = len - count ; psf_memset (ptr + count, 0, extra * sizeof (float)) ; psf->read_current = psf->sf.frames ; } ; psf->last_op = SFM_READ ; return count ; } /* sf_read_float */ ",0 "void ChromeWebContentsDelegateAndroid::OnFindResultAvailable( WebContents* web_contents, const FindNotificationDetails* find_result) { JNIEnv* env = base::android::AttachCurrentThread(); ScopedJavaLocalRef obj = GetJavaDelegate(env); if (obj.is_null()) return; ScopedJavaLocalRef selection_rect = CreateJavaRect( env, find_result->selection_rect()); ScopedJavaLocalRef details_object = Java_ChromeWebContentsDelegateAndroid_createFindNotificationDetails( env, find_result->number_of_matches(), selection_rect.obj(), find_result->active_match_ordinal(), find_result->final_update()); Java_ChromeWebContentsDelegateAndroid_onFindResultAvailable( env, obj.obj(), details_object.obj()); } ",0 " explicit PredictorInitializer(ResourcePrefetchPredictor* predictor) : TestObserver(predictor), predictor_(predictor) {} ",0 "int ConfirmInfoBar::NonLabelWidth() const { ChromeLayoutProvider* layout_provider = ChromeLayoutProvider::Get(); const int label_spacing = layout_provider->GetDistanceMetric( views::DISTANCE_RELATED_LABEL_HORIZONTAL); const int button_spacing = layout_provider->GetDistanceMetric( views::DISTANCE_RELATED_BUTTON_HORIZONTAL); int width = (label_->text().empty() || (!ok_button_ && !cancel_button_)) ? 0 : label_spacing; if (ok_button_) width += ok_button_->width() + (cancel_button_ ? button_spacing : 0); width += cancel_button_ ? cancel_button_->width() : 0; return width + ((link_->text().empty() || !width) ? 0 : label_spacing); } ",0 "static void ipip6_tunnel_link(struct sit_net *sitn, struct ip_tunnel *t) { struct ip_tunnel **tp = ipip6_bucket(sitn, t); spin_lock_bh(&ipip6_lock); t->next = *tp; rcu_assign_pointer(*tp, t); spin_unlock_bh(&ipip6_lock); } ",0 "static int ca_dn_cmp(const X509_NAME * const *a, const X509_NAME * const *b) { return(X509_NAME_cmp(*a,*b)); } ",0 "static void _php_curl_close_ex(php_curl *ch) { #if PHP_CURL_DEBUG fprintf(stderr, ""DTOR CALLED, ch = %x\n"", ch); #endif _php_curl_verify_handlers(ch, 0); /* * Libcurl is doing connection caching. When easy handle is cleaned up, * if the handle was previously used by the curl_multi_api, the connection * remains open un the curl multi handle is cleaned up. Some protocols are * sending content like the FTP one, and libcurl try to use the * WRITEFUNCTION or the HEADERFUNCTION. Since structures used in those * callback are freed, we need to use an other callback to which avoid * segfaults. * * Libcurl commit d021f2e8a00 fix this issue and should be part of 7.28.2 */ curl_easy_setopt(ch->cp, CURLOPT_HEADERFUNCTION, curl_write_nothing); curl_easy_setopt(ch->cp, CURLOPT_WRITEFUNCTION, curl_write_nothing); curl_easy_cleanup(ch->cp); /* cURL destructors should be invoked only by last curl handle */ if (--ch->clone == 0) { zend_llist_clean(&ch->to_free->str); zend_llist_clean(&ch->to_free->post); zend_hash_destroy(ch->to_free->slist); efree(ch->to_free->slist); efree(ch->to_free); } smart_str_free(&ch->handlers->write->buf); zval_ptr_dtor(&ch->handlers->write->func_name); zval_ptr_dtor(&ch->handlers->read->func_name); zval_ptr_dtor(&ch->handlers->write_header->func_name); #if CURLOPT_PASSWDFUNCTION != 0 zval_ptr_dtor(&ch->handlers->passwd); #endif zval_ptr_dtor(&ch->handlers->std_err); if (ch->header.str) { zend_string_release(ch->header.str); } zval_ptr_dtor(&ch->handlers->write_header->stream); zval_ptr_dtor(&ch->handlers->write->stream); zval_ptr_dtor(&ch->handlers->read->stream); efree(ch->handlers->write); efree(ch->handlers->write_header); efree(ch->handlers->read); if (ch->handlers->progress) { zval_ptr_dtor(&ch->handlers->progress->func_name); efree(ch->handlers->progress); } #if LIBCURL_VERSION_NUM >= 0x071500 /* Available since 7.21.0 */ if (ch->handlers->fnmatch) { zval_ptr_dtor(&ch->handlers->fnmatch->func_name); efree(ch->handlers->fnmatch); } #endif efree(ch->handlers); efree(ch); } ",0 "void NotifyEPMRequestStatus(RequestStatus status, void* profile_id, int process_id, int render_view_id) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); Profile* profile = reinterpret_cast(profile_id); if (!g_browser_process->profile_manager()->IsValidProfile(profile)) return; extensions::ProcessManager* process_manager = extensions::ExtensionSystem::Get(profile)->process_manager(); if (!process_manager) return; RenderViewHost* render_view_host = RenderViewHost::FromID(process_id, render_view_id); if (render_view_host) { if (status == REQUEST_STARTED) { process_manager->OnNetworkRequestStarted(render_view_host); } else if (status == REQUEST_DONE) { process_manager->OnNetworkRequestDone(render_view_host); } else { NOTREACHED(); } } } ",0 "void DownloadManagerImpl::GetNextId(const DownloadIdCallback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); if (delegate_) { delegate_->GetNextId(callback); return; } static uint32_t next_id = content::DownloadItem::kInvalidId + 1; callback.Run(next_id++); } ",0 "int dtls1_write_bytes(SSL *s, int type, const void *buf, int len) { int i; OPENSSL_assert(len <= SSL3_RT_MAX_PLAIN_LENGTH); s->rwstate=SSL_NOTHING; i=do_dtls1_write(s, type, buf, len, 0); return i; } ",0 " RemoveObserverForSession(int render_process_id, int render_frame_id, int session_id) { DCHECK_CURRENTLY_ON(BrowserThread::UI); RenderFrameHost* render_frame_host = RenderFrameHost::FromID(render_process_id, render_frame_id); if (!render_frame_host) return; WebContents* web_contents = WebContents::FromRenderFrameHost(render_frame_host); if (!web_contents) return; auto it = contents_observers_.find(web_contents); if (it == contents_observers_.end()) return; it->second->RemoveObservedFrame(render_frame_host, session_id); } ",0 "bool IsSmartVirtualKeyboardEnabled() { if (base::CommandLine::ForCurrentProcess()->HasSwitch( keyboard::switches::kEnableVirtualKeyboard)) { return false; } return !base::CommandLine::ForCurrentProcess()->HasSwitch( keyboard::switches::kDisableSmartVirtualKeyboard); } ",1 "void nfs4_check_drain_bc_complete(struct nfs4_session *ses) { if (!test_bit(NFS4_SESSION_DRAINING, &ses->session_state) || ses->bc_slot_table.highest_used_slotid != NFS4_NO_SLOT) return; dprintk(""%s COMPLETE: Session Back Channel Drained\n"", __func__); complete(&ses->bc_slot_table.complete); } ",0 "void Document::didAssociateFormControlsTimerFired(Timer* timer) { ASSERT_UNUSED(timer, timer == &m_didAssociateFormControlsTimer); if (!frame() || !frame()->page()) return; WillBeHeapVector> associatedFormControls; copyToVector(m_associatedFormControls, associatedFormControls); frame()->page()->chrome().client().didAssociateFormControls(associatedFormControls, frame()); m_associatedFormControls.clear(); } ",0 "translate_compat_table(struct net *net, const char *name, unsigned int valid_hooks, struct xt_table_info **pinfo, void **pentry0, unsigned int total_size, unsigned int number, unsigned int *hook_entries, unsigned int *underflows) { unsigned int i, j; struct xt_table_info *newinfo, *info; void *pos, *entry0, *entry1; struct compat_ip6t_entry *iter0; struct ip6t_entry *iter1; unsigned int size; int ret = 0; info = *pinfo; entry0 = *pentry0; size = total_size; info->number = number; /* Init all hooks to impossible value. */ for (i = 0; i < NF_INET_NUMHOOKS; i++) { info->hook_entry[i] = 0xFFFFFFFF; info->underflow[i] = 0xFFFFFFFF; } duprintf(""translate_compat_table: size %u\n"", info->size); j = 0; xt_compat_lock(AF_INET6); xt_compat_init_offsets(AF_INET6, number); /* Walk through entries, checking offsets. */ xt_entry_foreach(iter0, entry0, total_size) { ret = check_compat_entry_size_and_hooks(iter0, info, &size, entry0, entry0 + total_size, hook_entries, underflows, name); if (ret != 0) goto out_unlock; ++j; } ret = -EINVAL; if (j != number) { duprintf(""translate_compat_table: %u not %u entries\n"", j, number); goto out_unlock; } /* Check hooks all assigned */ for (i = 0; i < NF_INET_NUMHOOKS; i++) { /* Only hooks which are valid */ if (!(valid_hooks & (1 << i))) continue; if (info->hook_entry[i] == 0xFFFFFFFF) { duprintf(""Invalid hook entry %u %u\n"", i, hook_entries[i]); goto out_unlock; } if (info->underflow[i] == 0xFFFFFFFF) { duprintf(""Invalid underflow %u %u\n"", i, underflows[i]); goto out_unlock; } } ret = -ENOMEM; newinfo = xt_alloc_table_info(size); if (!newinfo) goto out_unlock; newinfo->number = number; for (i = 0; i < NF_INET_NUMHOOKS; i++) { newinfo->hook_entry[i] = info->hook_entry[i]; newinfo->underflow[i] = info->underflow[i]; } entry1 = newinfo->entries; pos = entry1; size = total_size; xt_entry_foreach(iter0, entry0, total_size) { ret = compat_copy_entry_from_user(iter0, &pos, &size, name, newinfo, entry1); if (ret != 0) break; } xt_compat_flush_offsets(AF_INET6); xt_compat_unlock(AF_INET6); if (ret) goto free_newinfo; ret = -ELOOP; if (!mark_source_chains(newinfo, valid_hooks, entry1)) goto free_newinfo; i = 0; xt_entry_foreach(iter1, entry1, newinfo->size) { ret = compat_check_entry(iter1, net, name); if (ret != 0) break; ++i; if (strcmp(ip6t_get_target(iter1)->u.user.name, XT_ERROR_TARGET) == 0) ++newinfo->stacksize; } if (ret) { /* * The first i matches need cleanup_entry (calls ->destroy) * because they had called ->check already. The other j-i * entries need only release. */ int skip = i; j -= i; xt_entry_foreach(iter0, entry0, newinfo->size) { if (skip-- > 0) continue; if (j-- == 0) break; compat_release_entry(iter0); } xt_entry_foreach(iter1, entry1, newinfo->size) { if (i-- == 0) break; cleanup_entry(iter1, net); } xt_free_table_info(newinfo); return ret; } *pinfo = newinfo; *pentry0 = entry1; xt_free_table_info(info); return 0; free_newinfo: xt_free_table_info(newinfo); out: xt_entry_foreach(iter0, entry0, total_size) { if (j-- == 0) break; compat_release_entry(iter0); } return ret; out_unlock: xt_compat_flush_offsets(AF_INET6); xt_compat_unlock(AF_INET6); goto out; } ",0 "void WebContentsImpl::CopyMaxPageIDsFrom(WebContents* web_contents) { WebContentsImpl* contents = static_cast(web_contents); max_page_ids_ = contents->max_page_ids_; } ",0 "static bool is_admin_up(struct net_device *dev) { return dev && (dev->flags & IFF_UP); } ",0 "PHP_FUNCTION(radius_request_authenticator) { radius_descriptor *raddesc; ssize_t res; char buf[LEN_AUTH]; zval *z_radh; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""r"", &z_radh) == FAILURE) { return; } ZEND_FETCH_RESOURCE(raddesc, radius_descriptor *, &z_radh, -1, ""rad_handle"", le_radius); res = rad_request_authenticator(raddesc->radh, buf, sizeof buf); if (res == -1) { RETURN_FALSE; } else { RETURN_STRINGL(buf, res, 1); } } ",0 "xmlXPathCompFunctionCall(xmlXPathParserContextPtr ctxt) { xmlChar *name; xmlChar *prefix; int nbargs = 0; int sort = 1; name = xmlXPathParseQName(ctxt, &prefix); if (name == NULL) { xmlFree(prefix); XP_ERROR(XPATH_EXPR_ERROR); } SKIP_BLANKS; #ifdef DEBUG_EXPR if (prefix == NULL) xmlGenericError(xmlGenericErrorContext, ""Calling function %s\n"", name); else xmlGenericError(xmlGenericErrorContext, ""Calling function %s:%s\n"", prefix, name); #endif if (CUR != '(') { XP_ERROR(XPATH_EXPR_ERROR); } NEXT; SKIP_BLANKS; /* * Optimization for count(): we don't need the node-set to be sorted. */ if ((prefix == NULL) && (name[0] == 'c') && xmlStrEqual(name, BAD_CAST ""count"")) { sort = 0; } ctxt->comp->last = -1; if (CUR != ')') { while (CUR != 0) { int op1 = ctxt->comp->last; ctxt->comp->last = -1; xmlXPathCompileExpr(ctxt, sort); if (ctxt->error != XPATH_EXPRESSION_OK) { xmlFree(name); xmlFree(prefix); return; } PUSH_BINARY_EXPR(XPATH_OP_ARG, op1, ctxt->comp->last, 0, 0); nbargs++; if (CUR == ')') break; if (CUR != ',') { XP_ERROR(XPATH_EXPR_ERROR); } NEXT; SKIP_BLANKS; } } PUSH_LONG_EXPR(XPATH_OP_FUNCTION, nbargs, 0, 0, name, prefix); NEXT; SKIP_BLANKS; } ",0 "void SyncManager::SyncInternal::SetDecryptionPassphrase( const std::string& passphrase) { if (passphrase.empty()) { NOTREACHED() << ""Cannot decrypt with an empty passphrase.""; return; } WriteTransaction trans(FROM_HERE, GetUserShare()); Cryptographer* cryptographer = trans.GetCryptographer(); KeyParams key_params = {""localhost"", ""dummy"", passphrase}; WriteNode node(&trans); if (node.InitByTagLookup(kNigoriTag) != sync_api::BaseNode::INIT_OK) { NOTREACHED(); return; } if (!cryptographer->has_pending_keys()) { NOTREACHED() << ""Attempt to set decryption passphrase failed because there "" << ""were no pending keys.""; return; } bool nigori_has_explicit_passphrase = node.GetNigoriSpecifics().using_explicit_passphrase(); std::string bootstrap_token; sync_pb::EncryptedData pending_keys; pending_keys = cryptographer->GetPendingKeys(); bool success = false; if (!nigori_has_explicit_passphrase) { if (cryptographer->is_initialized()) { Cryptographer temp_cryptographer(encryptor_); temp_cryptographer.SetPendingKeys(cryptographer->GetPendingKeys()); if (temp_cryptographer.DecryptPendingKeys(key_params)) { sync_pb::EncryptedData encrypted; cryptographer->GetKeys(&encrypted); if (temp_cryptographer.CanDecrypt(encrypted)) { DVLOG(1) << ""Implicit user provided passphrase accepted for "" << ""decryption, overwriting default.""; cryptographer->DecryptPendingKeys(key_params); cryptographer->GetBootstrapToken(&bootstrap_token); success = true; } else { DVLOG(1) << ""Implicit user provided passphrase accepted for "" << ""decryption, restoring implicit internal passphrase "" << ""as default.""; std::string bootstrap_token_from_current_key; cryptographer->GetBootstrapToken( &bootstrap_token_from_current_key); cryptographer->DecryptPendingKeys(key_params); cryptographer->AddKeyFromBootstrapToken( bootstrap_token_from_current_key); success = true; } } else { // !temp_cryptographer.DecryptPendingKeys(..) DVLOG(1) << ""Implicit user provided passphrase failed to decrypt.""; success = false; } // temp_cryptographer.DecryptPendingKeys(...) } else { // cryptographer->is_initialized() == false if (cryptographer->DecryptPendingKeys(key_params)) { cryptographer->GetBootstrapToken(&bootstrap_token); DVLOG(1) << ""Implicit user provided passphrase accepted, initializing"" << "" cryptographer.""; success = true; } else { DVLOG(1) << ""Implicit user provided passphrase failed to decrypt.""; success = false; } } // cryptographer->is_initialized() } else { // nigori_has_explicit_passphrase == true if (cryptographer->DecryptPendingKeys(key_params)) { DVLOG(1) << ""Explicit passphrase accepted for decryption.""; cryptographer->GetBootstrapToken(&bootstrap_token); success = true; } else { DVLOG(1) << ""Explicit passphrase failed to decrypt.""; success = false; } } // nigori_has_explicit_passphrase DVLOG_IF(1, !success) << ""Failure in SetDecryptionPassphrase; notifying and returning.""; DVLOG_IF(1, success) << ""Successfully set decryption passphrase; updating nigori and "" ""reencrypting.""; FinishSetPassphrase(success, bootstrap_token, nigori_has_explicit_passphrase, &trans, &node); } ",0 "static int parse_msg_type(const char *str) { if (!strcmp(str, ""error"")) return FSCK_ERROR; else if (!strcmp(str, ""warn"")) return FSCK_WARN; else if (!strcmp(str, ""ignore"")) return FSCK_IGNORE; else die(""Unknown fsck message type: '%s'"", str); } ",0 "TextureManager::TextureInfo* TextureManager::GetTextureInfo( GLuint client_id) { TextureInfoMap::iterator it = texture_infos_.find(client_id); return it != texture_infos_.end() ? it->second : NULL; } ",0 "MagickExport void GetDrawInfo(const ImageInfo *image_info,DrawInfo *draw_info) { char *next_token; const char *option; ExceptionInfo *exception; ImageInfo *clone_info; /* Initialize draw attributes. */ (void) LogMagickEvent(TraceEvent,GetMagickModule(),""...""); assert(draw_info != (DrawInfo *) NULL); (void) memset(draw_info,0,sizeof(*draw_info)); clone_info=CloneImageInfo(image_info); GetAffineMatrix(&draw_info->affine); exception=AcquireExceptionInfo(); (void) QueryColorCompliance(""#000F"",AllCompliance,&draw_info->fill, exception); (void) QueryColorCompliance(""#FFF0"",AllCompliance,&draw_info->stroke, exception); draw_info->stroke_antialias=clone_info->antialias; draw_info->stroke_width=1.0; draw_info->fill_rule=EvenOddRule; draw_info->alpha=OpaqueAlpha; draw_info->fill_alpha=OpaqueAlpha; draw_info->stroke_alpha=OpaqueAlpha; draw_info->linecap=ButtCap; draw_info->linejoin=MiterJoin; draw_info->miterlimit=10; draw_info->decorate=NoDecoration; draw_info->pointsize=12.0; draw_info->undercolor.alpha=(MagickRealType) TransparentAlpha; draw_info->compose=OverCompositeOp; draw_info->render=MagickTrue; draw_info->clip_path=MagickFalse; draw_info->debug=IsEventLogging(); if (clone_info->font != (char *) NULL) draw_info->font=AcquireString(clone_info->font); if (clone_info->density != (char *) NULL) draw_info->density=AcquireString(clone_info->density); draw_info->text_antialias=clone_info->antialias; if (fabs(clone_info->pointsize) >= MagickEpsilon) draw_info->pointsize=clone_info->pointsize; draw_info->border_color=clone_info->border_color; if (clone_info->server_name != (char *) NULL) draw_info->server_name=AcquireString(clone_info->server_name); option=GetImageOption(clone_info,""direction""); if (option != (const char *) NULL) draw_info->direction=(DirectionType) ParseCommandOption( MagickDirectionOptions,MagickFalse,option); else draw_info->direction=UndefinedDirection; option=GetImageOption(clone_info,""encoding""); if (option != (const char *) NULL) (void) CloneString(&draw_info->encoding,option); option=GetImageOption(clone_info,""family""); if (option != (const char *) NULL) (void) CloneString(&draw_info->family,option); option=GetImageOption(clone_info,""fill""); if (option != (const char *) NULL) (void) QueryColorCompliance(option,AllCompliance,&draw_info->fill, exception); option=GetImageOption(clone_info,""gravity""); if (option != (const char *) NULL) draw_info->gravity=(GravityType) ParseCommandOption(MagickGravityOptions, MagickFalse,option); option=GetImageOption(clone_info,""interline-spacing""); if (option != (const char *) NULL) draw_info->interline_spacing=StringToDouble(option,&next_token); option=GetImageOption(clone_info,""interword-spacing""); if (option != (const char *) NULL) draw_info->interword_spacing=StringToDouble(option,&next_token); option=GetImageOption(clone_info,""kerning""); if (option != (const char *) NULL) draw_info->kerning=StringToDouble(option,&next_token); option=GetImageOption(clone_info,""stroke""); if (option != (const char *) NULL) (void) QueryColorCompliance(option,AllCompliance,&draw_info->stroke, exception); option=GetImageOption(clone_info,""strokewidth""); if (option != (const char *) NULL) draw_info->stroke_width=StringToDouble(option,&next_token); option=GetImageOption(clone_info,""style""); if (option != (const char *) NULL) draw_info->style=(StyleType) ParseCommandOption(MagickStyleOptions, MagickFalse,option); option=GetImageOption(clone_info,""undercolor""); if (option != (const char *) NULL) (void) QueryColorCompliance(option,AllCompliance,&draw_info->undercolor, exception); option=GetImageOption(clone_info,""weight""); if (option != (const char *) NULL) { ssize_t weight; weight=ParseCommandOption(MagickWeightOptions,MagickFalse,option); if (weight == -1) weight=(ssize_t) StringToUnsignedLong(option); draw_info->weight=(size_t) weight; } exception=DestroyExceptionInfo(exception); draw_info->signature=MagickCoreSignature; clone_info=DestroyImageInfo(clone_info); } ",0 " X11SurfaceFactory::GetAllowedGLImplementations() { std::vector impls; impls.push_back(gl::kGLImplementationEGLGLES2); impls.push_back(gl::kGLImplementationDesktopGL); impls.push_back(gl::kGLImplementationOSMesaGL); return impls; } ",1 "xfs_buf_ioerror( xfs_buf_t *bp, int error) { ASSERT(error >= 0 && error <= 0xffff); bp->b_error = (unsigned short)error; trace_xfs_buf_ioerror(bp, error, _RET_IP_); } ",0 " LayerTreeHostTestSetVisible() : num_draws_(0) {} ",0 " Ins_GETINFO( TT_ExecContext exc, FT_Long* args ) { FT_Long K; TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( exc->face ); K = 0; #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY /********************************/ /* RASTERIZER VERSION */ /* Selector Bit: 0 */ /* Return Bit(s): 0-7 */ /* */ if ( SUBPIXEL_HINTING_INFINALITY && ( args[0] & 1 ) != 0 && exc->subpixel_hinting ) { if ( exc->ignore_x_mode ) { /* if in ClearType backward compatibility mode, */ /* we sometimes change the TrueType version dynamically */ K = exc->rasterizer_version; FT_TRACE6(( ""Setting rasterizer version %d\n"", exc->rasterizer_version )); } else K = TT_INTERPRETER_VERSION_38; } else #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ if ( ( args[0] & 1 ) != 0 ) K = driver->interpreter_version; /********************************/ /* GLYPH ROTATED */ /* Selector Bit: 1 */ /* Return Bit(s): 8 */ /* */ if ( ( args[0] & 2 ) != 0 && exc->tt_metrics.rotated ) K |= 1 << 8; /********************************/ /* GLYPH STRETCHED */ /* Selector Bit: 2 */ /* Return Bit(s): 9 */ /* */ if ( ( args[0] & 4 ) != 0 && exc->tt_metrics.stretched ) K |= 1 << 9; #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT /********************************/ /* VARIATION GLYPH */ /* Selector Bit: 3 */ /* Return Bit(s): 10 */ /* */ /* XXX: UNDOCUMENTED! */ if ( (args[0] & 8 ) != 0 && exc->face->blend ) K |= 1 << 10; #endif /********************************/ /* BI-LEVEL HINTING AND */ /* GRAYSCALE RENDERING */ /* Selector Bit: 5 */ /* Return Bit(s): 12 */ /* */ if ( ( args[0] & 32 ) != 0 && exc->grayscale ) K |= 1 << 12; #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL /* Toggle the following flags only outside of monochrome mode. */ /* Otherwise, instructions may behave weirdly and rendering results */ /* may differ between v35 and v40 mode, e.g., in `Times New Roman */ /* Bold Italic'. */ if ( SUBPIXEL_HINTING_MINIMAL && exc->subpixel_hinting_lean ) { /********************************/ /* HINTING FOR SUBPIXEL */ /* Selector Bit: 6 */ /* Return Bit(s): 13 */ /* */ /* v40 does subpixel hinting by default. */ if ( ( args[0] & 64 ) != 0 ) K |= 1 << 13; /********************************/ /* VERTICAL LCD SUBPIXELS? */ /* Selector Bit: 8 */ /* Return Bit(s): 15 */ /* */ if ( ( args[0] & 256 ) != 0 && exc->vertical_lcd_lean ) K |= 1 << 15; /********************************/ /* SUBPIXEL POSITIONED? */ /* Selector Bit: 10 */ /* Return Bit(s): 17 */ /* */ /* XXX: FreeType supports it, dependent on what client does? */ if ( ( args[0] & 1024 ) != 0 ) K |= 1 << 17; /********************************/ /* SYMMETRICAL SMOOTHING */ /* Selector Bit: 11 */ /* Return Bit(s): 18 */ /* */ /* The only smoothing method FreeType supports unless someone sets */ /* FT_LOAD_TARGET_MONO. */ if ( ( args[0] & 2048 ) != 0 && exc->subpixel_hinting_lean ) K |= 1 << 18; /********************************/ /* CLEARTYPE HINTING AND */ /* GRAYSCALE RENDERING */ /* Selector Bit: 12 */ /* Return Bit(s): 19 */ /* */ /* Grayscale rendering is what FreeType does anyway unless someone */ /* sets FT_LOAD_TARGET_MONO or FT_LOAD_TARGET_LCD(_V) */ if ( ( args[0] & 4096 ) != 0 && exc->grayscale_cleartype ) K |= 1 << 19; } #endif #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY if ( SUBPIXEL_HINTING_INFINALITY && exc->rasterizer_version >= TT_INTERPRETER_VERSION_35 ) { if ( exc->rasterizer_version >= 37 ) { /********************************/ /* HINTING FOR SUBPIXEL */ /* Selector Bit: 6 */ /* Return Bit(s): 13 */ /* */ if ( ( args[0] & 64 ) != 0 && exc->subpixel_hinting ) K |= 1 << 13; /********************************/ /* COMPATIBLE WIDTHS ENABLED */ /* Selector Bit: 7 */ /* Return Bit(s): 14 */ /* */ /* Functionality still needs to be added */ if ( ( args[0] & 128 ) != 0 && exc->compatible_widths ) K |= 1 << 14; /********************************/ /* VERTICAL LCD SUBPIXELS? */ /* Selector Bit: 8 */ /* Return Bit(s): 15 */ /* */ /* Functionality still needs to be added */ if ( ( args[0] & 256 ) != 0 && exc->vertical_lcd ) K |= 1 << 15; /********************************/ /* HINTING FOR BGR? */ /* Selector Bit: 9 */ /* Return Bit(s): 16 */ /* */ /* Functionality still needs to be added */ if ( ( args[0] & 512 ) != 0 && exc->bgr ) K |= 1 << 16; if ( exc->rasterizer_version >= 38 ) { /********************************/ /* SUBPIXEL POSITIONED? */ /* Selector Bit: 10 */ /* Return Bit(s): 17 */ /* */ /* Functionality still needs to be added */ if ( ( args[0] & 1024 ) != 0 && exc->subpixel_positioned ) K |= 1 << 17; /********************************/ /* SYMMETRICAL SMOOTHING */ /* Selector Bit: 11 */ /* Return Bit(s): 18 */ /* */ /* Functionality still needs to be added */ if ( ( args[0] & 2048 ) != 0 && exc->symmetrical_smoothing ) K |= 1 << 18; /********************************/ /* GRAY CLEARTYPE */ /* Selector Bit: 12 */ /* Return Bit(s): 19 */ /* */ /* Functionality still needs to be added */ if ( ( args[0] & 4096 ) != 0 && exc->gray_cleartype ) K |= 1 << 19; } } } #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ args[0] = K; } ",0 "json_populate_record(PG_FUNCTION_ARGS) { return populate_record_worker(fcinfo, ""json_populate_record"", true); } ",0 "Response InputHandler::EmulateTouchFromMouseEvent(const std::string& type, int x, int y, const std::string& button, Maybe maybe_timestamp, Maybe delta_x, Maybe delta_y, Maybe modifiers, Maybe click_count) { blink::WebInputEvent::Type event_type; if (type == Input::EmulateTouchFromMouseEvent::TypeEnum::MouseWheel) { event_type = blink::WebInputEvent::kMouseWheel; if (!delta_x.isJust() || !delta_y.isJust()) { return Response::InvalidParams( ""'deltaX' and 'deltaY' are expected for mouseWheel event""); } } else { event_type = GetMouseEventType(type); if (event_type == blink::WebInputEvent::kUndefined) { return Response::InvalidParams( base::StringPrintf(""Unexpected event type '%s'"", type.c_str())); } } blink::WebPointerProperties::Button event_button = blink::WebPointerProperties::Button::kNoButton; int button_modifiers = 0; if (!GetMouseEventButton(button, &event_button, &button_modifiers)) return Response::InvalidParams(""Invalid mouse button""); ui::WebScopedInputEvent event; blink::WebMouseWheelEvent* wheel_event = nullptr; blink::WebMouseEvent* mouse_event = nullptr; if (type == Input::EmulateTouchFromMouseEvent::TypeEnum::MouseWheel) { wheel_event = new blink::WebMouseWheelEvent( event_type, GetEventModifiers( modifiers.fromMaybe(blink::WebInputEvent::kNoModifiers), false, false, 0) | button_modifiers, GetEventTimestamp(maybe_timestamp)); mouse_event = wheel_event; event.reset(wheel_event); wheel_event->delta_x = static_cast(delta_x.fromJust()); wheel_event->delta_y = static_cast(delta_y.fromJust()); if (base::FeatureList::IsEnabled( features::kTouchpadAndWheelScrollLatching)) { wheel_event->phase = blink::WebMouseWheelEvent::kPhaseBegan; } } else { mouse_event = new blink::WebMouseEvent( event_type, GetEventModifiers( modifiers.fromMaybe(blink::WebInputEvent::kNoModifiers), false, false, 0) | button_modifiers, GetEventTimestamp(maybe_timestamp)); event.reset(mouse_event); } mouse_event->SetPositionInWidget(x, y); mouse_event->button = event_button; mouse_event->SetPositionInScreen(x, y); mouse_event->click_count = click_count.fromMaybe(0); mouse_event->pointer_type = blink::WebPointerProperties::PointerType::kTouch; if (!host_ || !host_->GetRenderWidgetHost()) return Response::InternalError(); if (wheel_event) { host_->GetRenderWidgetHost()->ForwardWheelEvent(*wheel_event); if (base::FeatureList::IsEnabled( features::kTouchpadAndWheelScrollLatching)) { wheel_event->delta_x = 0; wheel_event->delta_y = 0; wheel_event->phase = blink::WebMouseWheelEvent::kPhaseEnded; wheel_event->dispatch_type = blink::WebInputEvent::kEventNonBlocking; host_->GetRenderWidgetHost()->ForwardWheelEvent(*wheel_event); } } else { host_->GetRenderWidgetHost()->ForwardMouseEvent(*mouse_event); } return Response::OK(); } ",0 "static int network_stats_read (void) /* {{{ */ { derive_t copy_octets_rx; derive_t copy_octets_tx; derive_t copy_packets_rx; derive_t copy_packets_tx; derive_t copy_values_dispatched; derive_t copy_values_not_dispatched; derive_t copy_values_sent; derive_t copy_values_not_sent; derive_t copy_receive_list_length; value_list_t vl = VALUE_LIST_INIT; value_t values[2]; copy_octets_rx = stats_octets_rx; copy_octets_tx = stats_octets_tx; copy_packets_rx = stats_packets_rx; copy_packets_tx = stats_packets_tx; copy_values_dispatched = stats_values_dispatched; copy_values_not_dispatched = stats_values_not_dispatched; copy_values_sent = stats_values_sent; copy_values_not_sent = stats_values_not_sent; copy_receive_list_length = receive_list_length; /* Initialize `vl' */ vl.values = values; vl.values_len = 2; vl.time = 0; sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, ""network"", sizeof (vl.plugin)); /* Octets received / sent */ vl.values[0].derive = (derive_t) copy_octets_rx; vl.values[1].derive = (derive_t) copy_octets_tx; sstrncpy (vl.type, ""if_octets"", sizeof (vl.type)); plugin_dispatch_values (&vl); /* Packets received / send */ vl.values[0].derive = (derive_t) copy_packets_rx; vl.values[1].derive = (derive_t) copy_packets_tx; sstrncpy (vl.type, ""if_packets"", sizeof (vl.type)); plugin_dispatch_values (&vl); /* Values (not) dispatched and (not) send */ sstrncpy (vl.type, ""total_values"", sizeof (vl.type)); vl.values_len = 1; vl.values[0].derive = (derive_t) copy_values_dispatched; sstrncpy (vl.type_instance, ""dispatch-accepted"", sizeof (vl.type_instance)); plugin_dispatch_values (&vl); vl.values[0].derive = (derive_t) copy_values_not_dispatched; sstrncpy (vl.type_instance, ""dispatch-rejected"", sizeof (vl.type_instance)); plugin_dispatch_values (&vl); vl.values[0].derive = (derive_t) copy_values_sent; sstrncpy (vl.type_instance, ""send-accepted"", sizeof (vl.type_instance)); plugin_dispatch_values (&vl); vl.values[0].derive = (derive_t) copy_values_not_sent; sstrncpy (vl.type_instance, ""send-rejected"", sizeof (vl.type_instance)); plugin_dispatch_values (&vl); /* Receive queue length */ vl.values[0].gauge = (gauge_t) copy_receive_list_length; sstrncpy (vl.type, ""queue_length"", sizeof (vl.type)); vl.type_instance[0] = 0; plugin_dispatch_values (&vl); return (0); } /* }}} int network_stats_read */ ",0 "static bool btif_av_state_started_handler(btif_sm_event_t event, void* p_data) { tBTA_AV* p_av = (tBTA_AV*)p_data; BTIF_TRACE_DEBUG(""%s: event=%s flags=0x%x"", __func__, dump_av_sm_event_name((btif_av_sm_event_t)event), btif_av_cb.flags); switch (event) { case BTIF_SM_ENTER_EVT: /* we are again in started state, clear any remote suspend flags */ btif_av_cb.flags &= ~BTIF_AV_FLAG_REMOTE_SUSPEND; /** * Report to components above that we have entered the streaming * stage, this should usually be followed by focus grant. * see update_audio_focus_state() */ btif_report_audio_state(BTAV_AUDIO_STATE_STARTED, &(btif_av_cb.peer_bda)); break; case BTIF_SM_EXIT_EVT: break; case BTIF_AV_START_STREAM_REQ_EVT: /* we were remotely started, just ack back the local request */ if (btif_av_cb.peer_sep == AVDT_TSEP_SNK) btif_a2dp_on_started(NULL, true); break; case BTIF_AV_SOURCE_CONFIG_REQ_EVT: btif_update_source_codec(p_data); break; case BTIF_AV_SOURCE_CONFIG_UPDATED_EVT: btif_report_source_codec_state(p_data); break; /* fixme -- use suspend = true always to work around issue with BTA AV */ case BTIF_AV_STOP_STREAM_REQ_EVT: case BTIF_AV_SUSPEND_STREAM_REQ_EVT: BTIF_TRACE_WARNING(""%s: event=%s flags=0x%x"", __func__, dump_av_sm_event_name((btif_av_sm_event_t)event), btif_av_cb.flags); /* set pending flag to ensure btif task is not trying to restart stream while suspend is in progress */ btif_av_cb.flags |= BTIF_AV_FLAG_LOCAL_SUSPEND_PENDING; /* if we were remotely suspended but suspend locally, local suspend always overrides */ btif_av_cb.flags &= ~BTIF_AV_FLAG_REMOTE_SUSPEND; if (btif_av_cb.peer_sep == AVDT_TSEP_SNK) { /* * Immediately stop transmission of frames while suspend is * pending. */ btif_a2dp_source_set_tx_flush(true); } if (btif_av_cb.peer_sep == AVDT_TSEP_SRC) { btif_a2dp_on_stopped(NULL); } BTA_AvStop(true); break; case BTIF_AV_DISCONNECT_REQ_EVT: BTIF_TRACE_WARNING(""%s: event=%s flags=0x%x"", __func__, dump_av_sm_event_name((btif_av_sm_event_t)event), btif_av_cb.flags); /* request avdtp to close */ BTA_AvClose(btif_av_cb.bta_handle); if (btif_av_cb.peer_sep == AVDT_TSEP_SRC) { BTA_AvCloseRc(btif_av_cb.bta_handle); } /* inform the application that we are disconnecting */ btif_report_connection_state(BTAV_CONNECTION_STATE_DISCONNECTING, &(btif_av_cb.peer_bda)); /* wait in closing state until fully closed */ btif_sm_change_state(btif_av_cb.sm_handle, BTIF_AV_STATE_CLOSING); break; case BTA_AV_SUSPEND_EVT: BTIF_TRACE_WARNING( ""%s: BTA_AV_SUSPEND_EVT status=%d initiator=%d flags=0x%x"", __func__, p_av->suspend.status, p_av->suspend.initiator, btif_av_cb.flags); /* a2dp suspended, stop media task until resumed */ btif_a2dp_on_suspended(&p_av->suspend); /* if not successful, remain in current state */ if (p_av->suspend.status != BTA_AV_SUCCESS) { btif_av_cb.flags &= ~BTIF_AV_FLAG_LOCAL_SUSPEND_PENDING; if (btif_av_cb.peer_sep == AVDT_TSEP_SNK) { /* suspend failed, reset back tx flush state */ btif_a2dp_source_set_tx_flush(false); } return false; } if (p_av->suspend.initiator != true) { /* remote suspend, notify HAL and await audioflinger to suspend/stop stream */ /* set remote suspend flag to block media task from restarting stream only if we did not already initiate a local suspend */ if ((btif_av_cb.flags & BTIF_AV_FLAG_LOCAL_SUSPEND_PENDING) == 0) btif_av_cb.flags |= BTIF_AV_FLAG_REMOTE_SUSPEND; btif_report_audio_state(BTAV_AUDIO_STATE_REMOTE_SUSPEND, &(btif_av_cb.peer_bda)); } else { btif_report_audio_state(BTAV_AUDIO_STATE_STOPPED, &(btif_av_cb.peer_bda)); } btif_sm_change_state(btif_av_cb.sm_handle, BTIF_AV_STATE_OPENED); /* suspend completed and state changed, clear pending status */ btif_av_cb.flags &= ~BTIF_AV_FLAG_LOCAL_SUSPEND_PENDING; break; case BTA_AV_STOP_EVT: BTIF_TRACE_WARNING(""%s: event=%s flags=0x%x"", __func__, dump_av_sm_event_name((btif_av_sm_event_t)event), btif_av_cb.flags); btif_av_cb.flags |= BTIF_AV_FLAG_PENDING_STOP; btif_a2dp_on_stopped(&p_av->suspend); btif_report_audio_state(BTAV_AUDIO_STATE_STOPPED, &(btif_av_cb.peer_bda)); /* if stop was successful, change state to open */ if (p_av->suspend.status == BTA_AV_SUCCESS) btif_sm_change_state(btif_av_cb.sm_handle, BTIF_AV_STATE_OPENED); break; case BTA_AV_CLOSE_EVT: BTIF_TRACE_WARNING(""%s: event=%s flags=0x%x"", __func__, dump_av_sm_event_name((btif_av_sm_event_t)event), btif_av_cb.flags); btif_av_cb.flags |= BTIF_AV_FLAG_PENDING_STOP; /* avdtp link is closed */ btif_a2dp_on_stopped(NULL); /* inform the application that we are disconnected */ btif_report_connection_state(BTAV_CONNECTION_STATE_DISCONNECTED, &(btif_av_cb.peer_bda)); btif_sm_change_state(btif_av_cb.sm_handle, BTIF_AV_STATE_IDLE); break; case BTIF_AV_OFFLOAD_START_REQ_EVT: BTA_AvOffloadStart(btif_av_cb.bta_handle); break; case BTA_AV_OFFLOAD_START_RSP_EVT: btif_a2dp_on_offload_started(p_av->status); break; CHECK_RC_EVENT(event, (tBTA_AV*)p_data); default: BTIF_TRACE_WARNING(""%s: unhandled event=%s"", __func__, dump_av_sm_event_name((btif_av_sm_event_t)event)); return false; } return true; } ",0 "print_cluster_tickets(pe_working_set_t * data_set) { xmlNode *cib_constraints = get_object_root(XML_CIB_TAG_CONSTRAINTS, data_set->input); /* For recording the tickets that are referenced in rsc_ticket constraints * but have never been granted yet. */ unpack_constraints(cib_constraints, data_set); print_as(""\nTickets:\n""); g_hash_table_foreach(data_set->tickets, print_ticket, NULL); return; } ",0 "int imap_delete_mailbox(struct Context *ctx, struct ImapMbox *mx) { char buf[PATH_MAX], mbox[PATH_MAX]; struct ImapData *idata = NULL; if (!ctx || !ctx->data) { idata = imap_conn_find(&mx->account, ImapPassive ? MUTT_IMAP_CONN_NONEW : 0); if (!idata) { FREE(&mx->mbox); return -1; } } else { idata = ctx->data; } imap_munge_mbox_name(idata, mbox, sizeof(mbox), mx->mbox); snprintf(buf, sizeof(buf), ""DELETE %s"", mbox); if (imap_exec(idata, buf, 0) != 0) return -1; return 0; } ",0 "void AutofillPopupViewViews::DrawAutofillEntry(gfx::Canvas* canvas, int index, const gfx::Rect& entry_rect) { canvas->FillRect( entry_rect, GetNativeTheme()->GetSystemColor( controller_->GetBackgroundColorIDForRow(index))); const bool is_rtl = controller_->IsRTL(); const int text_align = is_rtl ? gfx::Canvas::TEXT_ALIGN_RIGHT : gfx::Canvas::TEXT_ALIGN_LEFT; gfx::Rect value_rect = entry_rect; value_rect.Inset(AutofillPopupLayoutModel::kEndPadding, 0); bool icon_on_the_right = !is_rtl; int x_align_left = icon_on_the_right ? value_rect.right() : value_rect.x(); int row_height = controller_->layout_model().GetRowBounds(index).height(); const gfx::ImageSkia image = controller_->layout_model().GetIconImage(index); if (!image.isNull()) { int icon_y = entry_rect.y() + (row_height - image.height()) / 2; int icon_x_align_left = icon_on_the_right ? x_align_left - image.width() : x_align_left; canvas->DrawImageInt(image, icon_x_align_left, icon_y); x_align_left = icon_x_align_left + (is_rtl ? image.width() + AutofillPopupLayoutModel::kIconPadding : -AutofillPopupLayoutModel::kIconPadding); } const int value_width = gfx::GetStringWidth( controller_->GetElidedValueAt(index), controller_->layout_model().GetValueFontListForRow(index)); int value_x_align_left = is_rtl ? value_rect.right() - value_width : value_rect.x(); canvas->DrawStringRectWithFlags( controller_->GetElidedValueAt(index), controller_->layout_model().GetValueFontListForRow(index), GetNativeTheme()->GetSystemColor( controller_->layout_model().GetValueFontColorIDForRow(index)), gfx::Rect(value_x_align_left, value_rect.y(), value_width, value_rect.height()), text_align); if (!controller_->GetSuggestionAt(index).label.empty()) { const int label_width = gfx::GetStringWidth( controller_->GetElidedLabelAt(index), controller_->layout_model().GetLabelFontListForRow(index)); int label_x_align_left = x_align_left + (is_rtl ? 0 : -label_width); canvas->DrawStringRectWithFlags( controller_->GetElidedLabelAt(index), controller_->layout_model().GetLabelFontListForRow(index), GetNativeTheme()->GetSystemColor( ui::NativeTheme::kColorId_ResultsTableDimmedText), gfx::Rect(label_x_align_left, entry_rect.y(), label_width, entry_rect.height()), text_align); } } ",0 "param_get_pool_mode(char *buf, struct kernel_param *kp) { int *ip = (int *)kp->arg; switch (*ip) { case SVC_POOL_AUTO: return strlcpy(buf, ""auto"", 20); case SVC_POOL_GLOBAL: return strlcpy(buf, ""global"", 20); case SVC_POOL_PERCPU: return strlcpy(buf, ""percpu"", 20); case SVC_POOL_PERNODE: return strlcpy(buf, ""pernode"", 20); default: return sprintf(buf, ""%d"", *ip); } } ",0 "static void addrconf_verify_rtnl(void) { unsigned long now, next, next_sec, next_sched; struct inet6_ifaddr *ifp; int i; ASSERT_RTNL(); rcu_read_lock_bh(); now = jiffies; next = round_jiffies_up(now + ADDR_CHECK_FREQUENCY); cancel_delayed_work(&addr_chk_work); for (i = 0; i < IN6_ADDR_HSIZE; i++) { restart: hlist_for_each_entry_rcu_bh(ifp, &inet6_addr_lst[i], addr_lst) { unsigned long age; /* When setting preferred_lft to a value not zero or * infinity, while valid_lft is infinity * IFA_F_PERMANENT has a non-infinity life time. */ if ((ifp->flags & IFA_F_PERMANENT) && (ifp->prefered_lft == INFINITY_LIFE_TIME)) continue; spin_lock(&ifp->lock); /* We try to batch several events at once. */ age = (now - ifp->tstamp + ADDRCONF_TIMER_FUZZ_MINUS) / HZ; if (ifp->valid_lft != INFINITY_LIFE_TIME && age >= ifp->valid_lft) { spin_unlock(&ifp->lock); in6_ifa_hold(ifp); ipv6_del_addr(ifp); goto restart; } else if (ifp->prefered_lft == INFINITY_LIFE_TIME) { spin_unlock(&ifp->lock); continue; } else if (age >= ifp->prefered_lft) { /* jiffies - ifp->tstamp > age >= ifp->prefered_lft */ int deprecate = 0; if (!(ifp->flags&IFA_F_DEPRECATED)) { deprecate = 1; ifp->flags |= IFA_F_DEPRECATED; } if ((ifp->valid_lft != INFINITY_LIFE_TIME) && (time_before(ifp->tstamp + ifp->valid_lft * HZ, next))) next = ifp->tstamp + ifp->valid_lft * HZ; spin_unlock(&ifp->lock); if (deprecate) { in6_ifa_hold(ifp); ipv6_ifa_notify(0, ifp); in6_ifa_put(ifp); goto restart; } } else if ((ifp->flags&IFA_F_TEMPORARY) && !(ifp->flags&IFA_F_TENTATIVE)) { unsigned long regen_advance = ifp->idev->cnf.regen_max_retry * ifp->idev->cnf.dad_transmits * NEIGH_VAR(ifp->idev->nd_parms, RETRANS_TIME) / HZ; if (age >= ifp->prefered_lft - regen_advance) { struct inet6_ifaddr *ifpub = ifp->ifpub; if (time_before(ifp->tstamp + ifp->prefered_lft * HZ, next)) next = ifp->tstamp + ifp->prefered_lft * HZ; if (!ifp->regen_count && ifpub) { ifp->regen_count++; in6_ifa_hold(ifp); in6_ifa_hold(ifpub); spin_unlock(&ifp->lock); spin_lock(&ifpub->lock); ifpub->regen_count = 0; spin_unlock(&ifpub->lock); ipv6_create_tempaddr(ifpub, ifp); in6_ifa_put(ifpub); in6_ifa_put(ifp); goto restart; } } else if (time_before(ifp->tstamp + ifp->prefered_lft * HZ - regen_advance * HZ, next)) next = ifp->tstamp + ifp->prefered_lft * HZ - regen_advance * HZ; spin_unlock(&ifp->lock); } else { /* ifp->prefered_lft <= ifp->valid_lft */ if (time_before(ifp->tstamp + ifp->prefered_lft * HZ, next)) next = ifp->tstamp + ifp->prefered_lft * HZ; spin_unlock(&ifp->lock); } } } next_sec = round_jiffies_up(next); next_sched = next; /* If rounded timeout is accurate enough, accept it. */ if (time_before(next_sec, next + ADDRCONF_TIMER_FUZZ)) next_sched = next_sec; /* And minimum interval is ADDRCONF_TIMER_FUZZ_MAX. */ if (time_before(next_sched, jiffies + ADDRCONF_TIMER_FUZZ_MAX)) next_sched = jiffies + ADDRCONF_TIMER_FUZZ_MAX; ADBG(KERN_DEBUG ""now = %lu, schedule = %lu, rounded schedule = %lu => %lu\n"", now, next, next_sec, next_sched); mod_delayed_work(addrconf_wq, &addr_chk_work, next_sched - now); rcu_read_unlock_bh(); } ",0 "int CLASS canon_s2is() { unsigned row; for (row=0; row < 100; row++) { fseek (ifp, row*3340 + 3284, SEEK_SET); if (getc(ifp) > 15) return 1; } return 0; } ",0 "void SyncManager::SyncInternal::SaveChanges() { directory()->SaveChanges(); } ",0 "void PageInfoBubbleView::StyledLabelLinkClicked(views::StyledLabel* label, const gfx::Range& range, int event_flags) { switch (label->id()) { case PageInfoBubbleView::VIEW_ID_PAGE_INFO_LABEL_SECURITY_DETAILS: web_contents()->OpenURL(content::OpenURLParams( GURL(chrome::kPageInfoHelpCenterURL), content::Referrer(), WindowOpenDisposition::NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, false)); presenter_->RecordPageInfoAction( PageInfo::PAGE_INFO_CONNECTION_HELP_OPENED); break; case PageInfoBubbleView:: VIEW_ID_PAGE_INFO_LABEL_RESET_CERTIFICATE_DECISIONS: presenter_->OnRevokeSSLErrorBypassButtonPressed(); GetWidget()->Close(); break; default: NOTREACHED(); } } ",0 "parse_opt_register_src_bracket( struct translate_ctx *ctx, struct parsed_bracket *brackets, int *parsed_brackets) { const char *cur = ctx->cur; *parsed_brackets = 0; eat_opt_white( &cur ); if (cur[0] == '[') { ++cur; ctx->cur = cur; if (!parse_register_bracket(ctx, brackets)) return FALSE; *parsed_brackets = 1; } return TRUE; } ",0 "static int output_byte(char byte) { int status = wait_til_ready(); if (status < 0) return -1; if (is_ready_state(status)) { fd_outb(byte, FD_DATA); output_log[output_log_pos].data = byte; output_log[output_log_pos].status = status; output_log[output_log_pos].jiffies = jiffies; output_log_pos = (output_log_pos + 1) % OLOGSIZE; return 0; } FDCS->reset = 1; if (initialized) { DPRINT(""Unable to send byte %x to FDC. Fdc=%x Status=%x\n"", byte, fdc, status); show_floppy(); } return -1; } ",0 "void Huff_offsetTransmit (huff_t *huff, int ch, byte *fout, int *offset) { bloc = *offset; send(huff->loc[ch], NULL, fout); *offset = bloc; } ",1 "static int ext4_enable_quotas(struct super_block *sb) { int type, err = 0; unsigned long qf_inums[EXT4_MAXQUOTAS] = { le32_to_cpu(EXT4_SB(sb)->s_es->s_usr_quota_inum), le32_to_cpu(EXT4_SB(sb)->s_es->s_grp_quota_inum) }; sb_dqopt(sb)->flags |= DQUOT_QUOTA_SYS_FILE; for (type = 0; type < EXT4_MAXQUOTAS; type++) { if (qf_inums[type]) { err = ext4_quota_enable(sb, type, QFMT_VFS_V1, DQUOT_USAGE_ENABLED); if (err) { ext4_warning(sb, ""Failed to enable quota tracking "" ""(type=%d, err=%d). Please run "" ""e2fsck to fix."", type, err); return err; } } } return 0; } ",0 "static int StreamTcpTest01 (void) { StreamTcpThread stt; Packet *p = SCMalloc(SIZE_OF_PACKET); if (unlikely(p == NULL)) return 0; Flow f; memset(p, 0, SIZE_OF_PACKET); memset (&f, 0, sizeof(Flow)); FLOW_INITIALIZE(&f); p->flow = &f; int ret = 0; StreamTcpUTInit(&stt.ra_ctx); TcpSession *ssn = StreamTcpNewSession(p, 0); if (ssn == NULL) { printf(""Session can not be allocated: ""); goto end; } f.protoctx = ssn; if (f.alparser != NULL) { printf(""AppLayer field not set to NULL: ""); goto end; } if (ssn->state != 0) { printf(""TCP state field not set to 0: ""); goto end; } StreamTcpSessionClear(p->flow->protoctx); ret = 1; end: SCFree(p); FLOW_DESTROY(&f); StreamTcpUTDeinit(stt.ra_ctx); return ret; } ",0 "static void OriginTrialEnabledVoidMethodMethod(const v8::FunctionCallbackInfo& info) { TestObject* impl = V8TestObject::ToImpl(info.Holder()); impl->originTrialEnabledVoidMethod(); } ",0 " int X509_verify(X509 *a, EVP_PKEY *r) { return(ASN1_item_verify(ASN1_ITEM_rptr(X509_CINF),a->sig_alg, a->signature,a->cert_info,r)); } ",1 "void CurvesFree(cmsContext ContextID, void* ptr) { Curves16Data* Data = (Curves16Data*) ptr; int i; for (i=0; i < Data -> nCurves; i++) { _cmsFree(ContextID, Data ->Curves[i]); } _cmsFree(ContextID, Data ->Curves); _cmsFree(ContextID, ptr); } ",0 "void PaintController::GenerateFullRasterInvalidation( PaintChunk& chunk, const DisplayItem& old_item, const DisplayItem& new_item) { DCHECK(&old_item.Client() == &new_item.Client()); FloatRect old_visual_rect(old_item.VisualRect()); FloatRect new_visual_rect(new_item.VisualRect()); if (!new_visual_rect.Contains(old_visual_rect)) { AddRasterInvalidation(new_item.Client(), chunk, old_visual_rect, new_item.Client().GetPaintInvalidationReason()); if (old_visual_rect.Contains(new_visual_rect)) return; } AddRasterInvalidation(new_item.Client(), chunk, new_visual_rect, new_item.Client().GetPaintInvalidationReason()); } ",0 "void DelegatedFrameHost::OnCompositingShuttingDown(ui::Compositor* compositor) { DCHECK_EQ(compositor, compositor_); ResetCompositor(); DCHECK(!compositor_); } ",0 "bool Document::canNavigate(Frame* targetFrame) { if (!m_frame) return false; if (!targetFrame) return true; if (!isSandboxed(SandboxTopNavigation) && targetFrame == m_frame->tree()->top()) return true; if (isSandboxed(SandboxNavigation)) { if (targetFrame->tree()->isDescendantOf(m_frame)) return true; const char* reason = ""The frame attempting navigation is sandboxed, and is therefore disallowed from navigating its ancestors.""; if (isSandboxed(SandboxTopNavigation) && targetFrame == m_frame->tree()->top()) reason = ""The frame attempting navigation of the top-level window is sandboxed, but the 'allow-top-navigation' flag is not set.""; printNavigationErrorMessage(targetFrame, url(), reason); return false; } if (canAccessAncestor(securityOrigin(), targetFrame)) return true; if (!targetFrame->tree()->parent()) { if (targetFrame == m_frame->loader()->opener()) return true; if (canAccessAncestor(securityOrigin(), targetFrame->loader()->opener())) return true; } printNavigationErrorMessage(targetFrame, url(), ""The frame attempting navigation is neither same-origin with the target, nor is it the target's parent or opener.""); return false; } ",0 " __releases(ctx->disk->queue->queue_lock) __releases(rcu) { struct module *owner; spin_unlock_irq(ctx->disk->queue->queue_lock); rcu_read_unlock(); owner = ctx->disk->fops->owner; put_disk(ctx->disk); module_put(owner); } ",0 "void TestLoadTimingNotReusedWithPac(const LoadTimingInfo& load_timing_info, int connect_timing_flags) { EXPECT_FALSE(load_timing_info.socket_reused); EXPECT_NE(NetLogSource::kInvalidId, load_timing_info.socket_log_id); EXPECT_FALSE(load_timing_info.proxy_resolve_start.is_null()); EXPECT_LE(load_timing_info.proxy_resolve_start, load_timing_info.proxy_resolve_end); EXPECT_LE(load_timing_info.proxy_resolve_end, load_timing_info.connect_timing.connect_start); ExpectConnectTimingHasTimes(load_timing_info.connect_timing, connect_timing_flags); EXPECT_LE(load_timing_info.connect_timing.connect_end, load_timing_info.send_start); EXPECT_LE(load_timing_info.send_start, load_timing_info.send_end); EXPECT_TRUE(load_timing_info.request_start_time.is_null()); EXPECT_TRUE(load_timing_info.request_start.is_null()); EXPECT_TRUE(load_timing_info.receive_headers_end.is_null()); } ",0 "static void btif_report_audio_state(btav_audio_state_t state, RawAddress* bd_addr) { if (bt_av_sink_callbacks != NULL) { HAL_CBACK(bt_av_sink_callbacks, audio_state_cb, state, bd_addr); } else if (bt_av_src_callbacks != NULL) { HAL_CBACK(bt_av_src_callbacks, audio_state_cb, state, bd_addr); } } ",0 " int main(int argc, const char **argv) { int result = 1; if (argc == 3) { png_image image; /* Only the image structure version number needs to be set. */ memset(&image, 0, sizeof image); image.version = PNG_IMAGE_VERSION; if (png_image_begin_read_from_file(&image, argv[1])) { png_bytep buffer; /* Change this to try different formats! If you set a colormap format * then you must also supply a colormap below. */ image.format = PNG_FORMAT_RGBA; buffer = malloc(PNG_IMAGE_SIZE(image)); if (buffer != NULL) { if (png_image_finish_read(&image, NULL/*background*/, buffer, 0/*row_stride*/, NULL/*colormap for PNG_FORMAT_FLAG_COLORMAP */)) { if (png_image_write_to_file(&image, argv[2], 0/*convert_to_8bit*/, buffer, 0/*row_stride*/, NULL/*colormap*/)) result = 0; else fprintf(stderr, ""pngtopng: write %s: %s\n"", argv[2], image.message); free(buffer); } else { fprintf(stderr, ""pngtopng: read %s: %s\n"", argv[1], image.message); /* This is the only place where a 'free' is required; libpng does * the cleanup on error and success, but in this case we couldn't * complete the read because of running out of memory. */ png_image_free(&image); } } else fprintf(stderr, ""pngtopng: out of memory: %lu bytes\n"", (unsigned long)PNG_IMAGE_SIZE(image)); } else /* Failed to read the first argument: */ fprintf(stderr, ""pngtopng: %s: %s\n"", argv[1], image.message); } else /* Wrong number of arguments */ fprintf(stderr, ""pngtopng: usage: pngtopng input-file output-file\n""); return result; } ",0 "void Gfx::doFunctionShFill(GfxFunctionShading *shading) { double x0, y0, x1, y1; GfxColor colors[4]; if (out->useShadedFills() && out->functionShadedFill(state, shading)) { return; } shading->getDomain(&x0, &y0, &x1, &y1); shading->getColor(x0, y0, &colors[0]); shading->getColor(x0, y1, &colors[1]); shading->getColor(x1, y0, &colors[2]); shading->getColor(x1, y1, &colors[3]); doFunctionShFill1(shading, x0, y0, x1, y1, colors, 0); } ",0 "void BackFramebuffer::AttachRenderBuffer(GLenum target, BackRenderbuffer* render_buffer) { DCHECK_NE(id_, 0u); ScopedGLErrorSuppressor suppressor( ""BackFramebuffer::AttachRenderBuffer"", decoder_->GetErrorState()); ScopedFrameBufferBinder binder(decoder_, id_); GLuint attach_id = render_buffer ? render_buffer->id() : 0; glFramebufferRenderbufferEXT(GL_FRAMEBUFFER, target, GL_RENDERBUFFER, attach_id); } ",0 "xfs_map_cow( struct xfs_writepage_ctx *wpc, struct inode *inode, loff_t offset, unsigned int *new_type) { struct xfs_inode *ip = XFS_I(inode); struct xfs_bmbt_irec imap; bool is_cow = false, need_alloc = false; int error; /* * If we already have a valid COW mapping keep using it. */ if (wpc->io_type == XFS_IO_COW) { wpc->imap_valid = xfs_imap_valid(inode, &wpc->imap, offset); if (wpc->imap_valid) { *new_type = XFS_IO_COW; return 0; } } /* * Else we need to check if there is a COW mapping at this offset. */ xfs_ilock(ip, XFS_ILOCK_SHARED); is_cow = xfs_reflink_find_cow_mapping(ip, offset, &imap, &need_alloc); xfs_iunlock(ip, XFS_ILOCK_SHARED); if (!is_cow) return 0; /* * And if the COW mapping has a delayed extent here we need to * allocate real space for it now. */ if (need_alloc) { error = xfs_iomap_write_allocate(ip, XFS_COW_FORK, offset, &imap); if (error) return error; } wpc->io_type = *new_type = XFS_IO_COW; wpc->imap_valid = true; wpc->imap = imap; return 0; } ",0 "void *Type_Screening_Read(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cmsUInt32Number* nItems, cmsUInt32Number SizeOfTag) { cmsScreening* sc = NULL; cmsUInt32Number i; sc = (cmsScreening*) _cmsMallocZero(self ->ContextID, sizeof(cmsScreening)); if (sc == NULL) return NULL; *nItems = 0; if (!_cmsReadUInt32Number(io, &sc ->Flag)) goto Error; if (!_cmsReadUInt32Number(io, &sc ->nChannels)) goto Error; if (sc ->nChannels > cmsMAXCHANNELS - 1) sc ->nChannels = cmsMAXCHANNELS - 1; for (i=0; i < sc ->nChannels; i++) { if (!_cmsRead15Fixed16Number(io, &sc ->Channels[i].Frequency)) goto Error; if (!_cmsRead15Fixed16Number(io, &sc ->Channels[i].ScreenAngle)) goto Error; if (!_cmsReadUInt32Number(io, &sc ->Channels[i].SpotShape)) goto Error; } *nItems = 1; return (void*) sc; Error: if (sc != NULL) _cmsFree(self ->ContextID, sc); return NULL; cmsUNUSED_PARAMETER(SizeOfTag); } ",0 "PaintArtifactCompositor::PaintArtifactCompositor( base::RepeatingCallback scroll_callback) : scroll_callback_(std::move(scroll_callback)), tracks_raster_invalidations_(false) { if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled() && !RuntimeEnabledFeatures::BlinkGenPropertyTreesEnabled()) return; root_layer_ = cc::Layer::Create(); } ",0 " static void opl3_setup_voice(int dev, int voice, int chn) { struct channel_info *info = &synth_devs[dev]->chn_info[chn]; opl3_set_instr(dev, voice, info->pgm_num); devc->voc[voice].bender = 0; devc->voc[voice].bender_range = info->bender_range; devc->voc[voice].volume = info->controllers[CTL_MAIN_VOLUME]; devc->voc[voice].panning = (info->controllers[CTL_PAN] * 2) - 128; } ",1 "void HTMLCanvasElement::WillDrawImageTo2DContext(CanvasImageSource* source) { if (canvas_heuristic_parameters::kEnableAccelerationToAvoidReadbacks && SharedGpuContext::AllowSoftwareToAcceleratedCanvasUpgrade() && source->IsAccelerated() && GetOrCreateCanvas2DLayerBridge() && !canvas2d_bridge_->IsAccelerated() && ShouldAccelerate(kIgnoreResourceLimitCriteria)) { std::unique_ptr surface = CreateAccelerated2dBuffer(); if (surface) { ReplaceExisting2dLayerBridge(std::move(surface)); SetNeedsCompositingUpdate(); } } } ",0 "void DevToolsUIBindings::OnURLFetchComplete(const net::URLFetcher* source) { DCHECK(source); PendingRequestsMap::iterator it = pending_requests_.find(source); DCHECK(it != pending_requests_.end()); base::DictionaryValue response; base::DictionaryValue* headers = new base::DictionaryValue(); net::HttpResponseHeaders* rh = source->GetResponseHeaders(); response.SetInteger(""statusCode"", rh ? rh->response_code() : 200); response.Set(""headers"", headers); size_t iterator = 0; std::string name; std::string value; while (rh && rh->EnumerateHeaderLines(&iterator, &name, &value)) headers->SetString(name, value); it->second.Run(&response); pending_requests_.erase(it); delete source; } ",0 "static void put_unused_buffer(QEMUFile *f, void *pv, size_t size) { static const uint8_t buf[1024]; int block_len; while (size > 0) { block_len = MIN(sizeof(buf), size); size -= block_len; qemu_put_buffer(f, buf, block_len); } } ",0 "u8d(double d) { d = closestinteger(d); return (png_byte)d; } ",0 "static int net_ctl_permissions(struct ctl_table_header *head, struct ctl_table *table) { struct net *net = container_of(head->set, struct net, sysctls); kuid_t root_uid = make_kuid(net->user_ns, 0); kgid_t root_gid = make_kgid(net->user_ns, 0); /* Allow network administrator to have same access as root. */ if (ns_capable(net->user_ns, CAP_NET_ADMIN) || uid_eq(root_uid, current_uid())) { int mode = (table->mode >> 6) & 7; return (mode << 6) | (mode << 3) | mode; } /* Allow netns root group to have the same access as the root group */ if (gid_eq(root_gid, current_gid())) { int mode = (table->mode >> 3) & 7; return (mode << 3) | mode; } return table->mode; } ",1 "static int buffer_empty(Buffer *buffer) { return buffer->offset == 0; } ",0 "static void warn_about_quota(const char *quotaroot) { time_t now = time(NULL); struct quota q; int res; int r; int thresholds[QUOTA_NUMRESOURCES]; int pc_threshold = config_getint(IMAPOPT_QUOTAWARN); int pc_usage; struct buf msg = BUF_INITIALIZER; static char lastqr[MAX_MAILBOX_PATH+1] = """"; static time_t nextalert = 0; if (!quotaroot || !*quotaroot) return; /* no quota, nothing to do */ /* rate limit checks and warnings to every 10 min */ if (!strcmp(quotaroot, lastqr) && now < nextalert) return; strlcpy(lastqr, quotaroot, sizeof(lastqr)); nextalert = now + 600; quota_init(&q, quotaroot); r = quota_read(&q, NULL, 0); if (r) goto out; /* failed to read */ memset(thresholds, 0, sizeof(thresholds)); thresholds[QUOTA_STORAGE] = config_getint(IMAPOPT_QUOTAWARNKB); thresholds[QUOTA_MESSAGE] = config_getint(IMAPOPT_QUOTAWARNMSG); thresholds[QUOTA_ANNOTSTORAGE] = config_getint(IMAPOPT_QUOTAWARNKB); for (res = 0 ; res < QUOTA_NUMRESOURCES ; res++) { if (q.limits[res] < 0) continue; /* this resource is unlimited */ buf_reset(&msg); if (thresholds[res] <= 0 || thresholds[res] >= q.limits[res] || q.useds[res] > ((quota_t) (q.limits[res] - thresholds[res])) * quota_units[res]) { pc_usage = (int)(((double) q.useds[res] * 100.0) / (double) ((quota_t) q.limits[res] * quota_units[res])); if (q.useds[res] > (quota_t) q.limits[res] * quota_units[res]) buf_printf(&msg, error_message(IMAP_NO_OVERQUOTA), quota_names[res]); else if (pc_usage > pc_threshold) buf_printf(&msg, error_message(IMAP_NO_CLOSEQUOTA), pc_usage, quota_names[res]); } if (msg.len) prot_printf(imapd_out, ""* NO [ALERT] %s\r\n"", buf_cstring(&msg)); } buf_reset(&msg); out: quota_free(&q); } ",0 "void LayerTreeCoordinator::syncLayerChildren(WebLayerID id, const Vector& children) { m_shouldSyncFrame = true; m_webPage->send(Messages::LayerTreeCoordinatorProxy::SetCompositingLayerChildren(id, children)); } ",0 "bool SetExtendedFileAttribute(const char* path, const char* name, const char* value, size_t value_size, int flags) { //// On Chrome OS, there is no component that can validate these extended //// attributes so there is no need to set them. base::ScopedBlockingCall scoped_blocking_call(base::BlockingType::MAY_BLOCK); int result = setxattr(path, name, value, value_size, flags); if (result) { DPLOG(ERROR) << ""Could not set extended attribute "" << name << "" on file "" << path; return false; } return true; } ",1 "spnego_gss_accept_sec_context( OM_uint32 *minor_status, gss_ctx_id_t *context_handle, gss_cred_id_t verifier_cred_handle, gss_buffer_t input_token, gss_channel_bindings_t input_chan_bindings, gss_name_t *src_name, gss_OID *mech_type, gss_buffer_t output_token, OM_uint32 *ret_flags, OM_uint32 *time_rec, gss_cred_id_t *delegated_cred_handle) { OM_uint32 ret, tmpmin, negState; send_token_flag return_token; gss_buffer_t mechtok_in, mic_in, mic_out; gss_buffer_desc mechtok_out = GSS_C_EMPTY_BUFFER; spnego_gss_ctx_id_t sc = NULL; spnego_gss_cred_id_t spcred = NULL; int sendTokenInit = 0, tmpret; mechtok_in = mic_in = mic_out = GSS_C_NO_BUFFER; /* * This function works in three steps: * * 1. Perform mechanism negotiation. * 2. Invoke the negotiated mech's gss_accept_sec_context function * and examine the results. * 3. Process or generate MICs if necessary. * * Step one determines whether the negotiation requires a MIC exchange, * while steps two and three share responsibility for determining when * the exchange is complete. If the selected mech completes in this * call and no MIC exchange is expected, then step 2 will decide. If a * MIC exchange is expected, then step 3 will decide. If an error * occurs in any step, the exchange will be aborted, possibly with an * error token. * * negState determines the state of the negotiation, and is * communicated to the acceptor if a continuing token is sent. * return_token is used to indicate what type of token, if any, should * be generated. */ /* Validate arguments. */ if (minor_status != NULL) *minor_status = 0; if (output_token != GSS_C_NO_BUFFER) { output_token->length = 0; output_token->value = NULL; } if (minor_status == NULL || output_token == GSS_C_NO_BUFFER || context_handle == NULL) return GSS_S_CALL_INACCESSIBLE_WRITE; if (input_token == GSS_C_NO_BUFFER) return GSS_S_CALL_INACCESSIBLE_READ; /* Step 1: Perform mechanism negotiation. */ sc = (spnego_gss_ctx_id_t)*context_handle; spcred = (spnego_gss_cred_id_t)verifier_cred_handle; if (sc == NULL || sc->internal_mech == GSS_C_NO_OID) { /* Process an initial token or request for NegHints. */ if (src_name != NULL) *src_name = GSS_C_NO_NAME; if (mech_type != NULL) *mech_type = GSS_C_NO_OID; if (time_rec != NULL) *time_rec = 0; if (ret_flags != NULL) *ret_flags = 0; if (delegated_cred_handle != NULL) *delegated_cred_handle = GSS_C_NO_CREDENTIAL; if (input_token->length == 0) { ret = acc_ctx_hints(minor_status, context_handle, spcred, &mic_out, &negState, &return_token); if (ret != GSS_S_COMPLETE) goto cleanup; sendTokenInit = 1; ret = GSS_S_CONTINUE_NEEDED; } else { /* Can set negState to REQUEST_MIC */ ret = acc_ctx_new(minor_status, input_token, context_handle, spcred, &mechtok_in, &mic_in, &negState, &return_token); if (ret != GSS_S_COMPLETE) goto cleanup; ret = GSS_S_CONTINUE_NEEDED; } } else { /* Process a response token. Can set negState to * ACCEPT_INCOMPLETE. */ ret = acc_ctx_cont(minor_status, input_token, context_handle, &mechtok_in, &mic_in, &negState, &return_token); if (ret != GSS_S_COMPLETE) goto cleanup; ret = GSS_S_CONTINUE_NEEDED; } /* Step 2: invoke the negotiated mechanism's gss_accept_sec_context * function. */ sc = (spnego_gss_ctx_id_t)*context_handle; /* * Handle mechtok_in and mic_in only if they are * present in input_token. If neither is present, whether * this is an error depends on whether this is the first * round-trip. RET is set to a default value according to * whether it is the first round-trip. */ if (negState != REQUEST_MIC && mechtok_in != GSS_C_NO_BUFFER) { ret = acc_ctx_call_acc(minor_status, sc, spcred, mechtok_in, mech_type, &mechtok_out, ret_flags, time_rec, delegated_cred_handle, &negState, &return_token); } /* Step 3: process or generate the MIC, if the negotiated mech is * complete and supports MICs. */ if (!HARD_ERROR(ret) && sc->mech_complete && (sc->ctx_flags & GSS_C_INTEG_FLAG)) { ret = handle_mic(minor_status, mic_in, (mechtok_out.length != 0), sc, &mic_out, &negState, &return_token); } cleanup: if (return_token == INIT_TOKEN_SEND && sendTokenInit) { assert(sc != NULL); tmpret = make_spnego_tokenInit_msg(sc, 1, mic_out, 0, GSS_C_NO_BUFFER, return_token, output_token); if (tmpret < 0) ret = GSS_S_FAILURE; } else if (return_token != NO_TOKEN_SEND && return_token != CHECK_MIC) { tmpret = make_spnego_tokenTarg_msg(negState, sc ? sc->internal_mech : GSS_C_NO_OID, &mechtok_out, mic_out, return_token, output_token); if (tmpret < 0) ret = GSS_S_FAILURE; } if (ret == GSS_S_COMPLETE) { *context_handle = (gss_ctx_id_t)sc->ctx_handle; if (sc->internal_name != GSS_C_NO_NAME && src_name != NULL) { *src_name = sc->internal_name; sc->internal_name = GSS_C_NO_NAME; } release_spnego_ctx(&sc); } else if (ret != GSS_S_CONTINUE_NEEDED) { if (sc != NULL) { gss_delete_sec_context(&tmpmin, &sc->ctx_handle, GSS_C_NO_BUFFER); release_spnego_ctx(&sc); } *context_handle = GSS_C_NO_CONTEXT; } gss_release_buffer(&tmpmin, &mechtok_out); if (mechtok_in != GSS_C_NO_BUFFER) { gss_release_buffer(&tmpmin, mechtok_in); free(mechtok_in); } if (mic_in != GSS_C_NO_BUFFER) { gss_release_buffer(&tmpmin, mic_in); free(mic_in); } if (mic_out != GSS_C_NO_BUFFER) { gss_release_buffer(&tmpmin, mic_out); free(mic_out); } return ret; } ",0 "void WebContentsViewAura::OnWindowTargetVisibilityChanged(bool visible) { if (visible) web_contents_->WasShown(); else web_contents_->WasHidden(); } ",0 "IntRect Editor::firstRectForRange(const EphemeralRange& range) const { DCHECK(!frame().document()->needsLayoutTreeUpdate()); DocumentLifecycle::DisallowTransitionScope disallowTransition( frame().document()->lifecycle()); LayoutUnit extraWidthToEndOfLine; DCHECK(range.isNotNull()); IntRect startCaretRect = RenderedPosition( createVisiblePosition(range.startPosition()).deepEquivalent(), TextAffinity::Downstream) .absoluteRect(&extraWidthToEndOfLine); if (startCaretRect.isEmpty()) return IntRect(); IntRect endCaretRect = RenderedPosition( createVisiblePosition(range.endPosition()).deepEquivalent(), TextAffinity::Upstream) .absoluteRect(); if (endCaretRect.isEmpty()) return IntRect(); if (startCaretRect.y() == endCaretRect.y()) { return IntRect(std::min(startCaretRect.x(), endCaretRect.x()), startCaretRect.y(), abs(endCaretRect.x() - startCaretRect.x()), std::max(startCaretRect.height(), endCaretRect.height())); } return IntRect(startCaretRect.x(), startCaretRect.y(), (startCaretRect.width() + extraWidthToEndOfLine).toInt(), startCaretRect.height()); } ",0 "static int descriptors_changed(struct usb_device *udev, struct usb_device_descriptor *old_device_descriptor, struct usb_host_bos *old_bos) { int changed = 0; unsigned index; unsigned serial_len = 0; unsigned len; unsigned old_length; int length; char *buf; if (memcmp(&udev->descriptor, old_device_descriptor, sizeof(*old_device_descriptor)) != 0) return 1; if ((old_bos && !udev->bos) || (!old_bos && udev->bos)) return 1; if (udev->bos) { len = le16_to_cpu(udev->bos->desc->wTotalLength); if (len != le16_to_cpu(old_bos->desc->wTotalLength)) return 1; if (memcmp(udev->bos->desc, old_bos->desc, len)) return 1; } /* Since the idVendor, idProduct, and bcdDevice values in the * device descriptor haven't changed, we will assume the * Manufacturer and Product strings haven't changed either. * But the SerialNumber string could be different (e.g., a * different flash card of the same brand). */ if (udev->serial) serial_len = strlen(udev->serial) + 1; len = serial_len; for (index = 0; index < udev->descriptor.bNumConfigurations; index++) { old_length = le16_to_cpu(udev->config[index].desc.wTotalLength); len = max(len, old_length); } buf = kmalloc(len, GFP_NOIO); if (!buf) /* assume the worst */ return 1; for (index = 0; index < udev->descriptor.bNumConfigurations; index++) { old_length = le16_to_cpu(udev->config[index].desc.wTotalLength); length = usb_get_descriptor(udev, USB_DT_CONFIG, index, buf, old_length); if (length != old_length) { dev_dbg(&udev->dev, ""config index %d, error %d\n"", index, length); changed = 1; break; } if (memcmp(buf, udev->rawdescriptors[index], old_length) != 0) { dev_dbg(&udev->dev, ""config index %d changed (#%d)\n"", index, ((struct usb_config_descriptor *) buf)-> bConfigurationValue); changed = 1; break; } } if (!changed && serial_len) { length = usb_string(udev, udev->descriptor.iSerialNumber, buf, serial_len); if (length + 1 != serial_len) { dev_dbg(&udev->dev, ""serial string error %d\n"", length); changed = 1; } else if (memcmp(buf, udev->serial, length) != 0) { dev_dbg(&udev->dev, ""serial string changed\n""); changed = 1; } } kfree(buf); return changed; } ",0 "void Editor::PasteAsPlainText(const String& pasting_text, bool smart_replace) { Element* target = FindEventTargetFromSelection(); if (!target) return; target->DispatchEvent(TextEvent::CreateForPlainTextPaste( GetFrame().DomWindow(), pasting_text, smart_replace)); } ",0 "static void __perf_event_read(void *info) { struct perf_event *event = info; struct perf_event_context *ctx = event->ctx; struct perf_cpu_context *cpuctx = __get_cpu_context(ctx); /* * If this is a task context, we need to check whether it is * the current task context of this cpu. If not it has been * scheduled out before the smp call arrived. In that case * event->count would have been updated to a recent sample * when the event was scheduled out. */ if (ctx->task && cpuctx->task_ctx != ctx) return; raw_spin_lock(&ctx->lock); if (ctx->is_active) { update_context_time(ctx); update_cgrp_time_from_event(event); } update_event_times(event); if (event->state == PERF_EVENT_STATE_ACTIVE) event->pmu->read(event); raw_spin_unlock(&ctx->lock); } ",0 "void RunAndQuit(const base::Closure& closure, const base::Closure& quit, base::MessageLoopProxy* original_message_loop) { closure.Run(); original_message_loop->PostTask(FROM_HERE, quit); } ",0 "static struct sock *__vsock_find_bound_socket(struct sockaddr_vm *addr) { struct vsock_sock *vsk; list_for_each_entry(vsk, vsock_bound_sockets(addr), bound_table) if (addr->svm_port == vsk->local_addr.svm_port) return sk_vsock(vsk); return NULL; } ",0 " void StopWorkerThread() { base::ThreadRestrictions::ScopedAllowIO allow_io; thread_.reset(); } ",0 "static void rpng_x_cleanup(void) { if (image_data) { free(image_data); image_data = NULL; } if (ximage) { if (ximage->data) { free(ximage->data); /* we allocated it, so we free it */ ximage->data = (char *)NULL; /* instead of XDestroyImage() */ } XDestroyImage(ximage); ximage = NULL; } if (have_gc) XFreeGC(display, gc); if (have_window) XDestroyWindow(display, window); if (have_colormap) XFreeColormap(display, colormap); if (have_nondefault_visual) XFree(visual_list); } ",0 "static ext4_lblk_t ext4_ext_next_leaf_block(struct ext4_ext_path *path) { int depth; BUG_ON(path == NULL); depth = path->p_depth; /* zero-tree has no leaf blocks at all */ if (depth == 0) return EXT_MAX_BLOCKS; /* go to index block */ depth--; while (depth >= 0) { if (path[depth].p_idx != EXT_LAST_INDEX(path[depth].p_hdr)) return (ext4_lblk_t) le32_to_cpu(path[depth].p_idx[1].ei_block); depth--; } return EXT_MAX_BLOCKS; } ",0 "static int ipip6_rcv(struct sk_buff *skb) { struct iphdr *iph; struct ip_tunnel *tunnel; if (!pskb_may_pull(skb, sizeof(struct ipv6hdr))) goto out; iph = ip_hdr(skb); rcu_read_lock(); tunnel = ipip6_tunnel_lookup(dev_net(skb->dev), skb->dev, iph->saddr, iph->daddr); if (tunnel != NULL) { struct pcpu_tstats *tstats; secpath_reset(skb); skb->mac_header = skb->network_header; skb_reset_network_header(skb); IPCB(skb)->flags = 0; skb->protocol = htons(ETH_P_IPV6); skb->pkt_type = PACKET_HOST; if ((tunnel->dev->priv_flags & IFF_ISATAP) && !isatap_chksrc(skb, iph, tunnel)) { tunnel->dev->stats.rx_errors++; rcu_read_unlock(); kfree_skb(skb); return 0; } tstats = this_cpu_ptr(tunnel->dev->tstats); tstats->rx_packets++; tstats->rx_bytes += skb->len; __skb_tunnel_rx(skb, tunnel->dev); ipip6_ecn_decapsulate(iph, skb); netif_rx(skb); rcu_read_unlock(); return 0; } /* no tunnel matched, let upstream know, ipsec may handle it */ rcu_read_unlock(); return 1; out: kfree_skb(skb); return 0; } ",0 "static void chmd_close(struct mschm_decompressor *base, struct mschmd_header *chm) { struct mschm_decompressor_p *self = (struct mschm_decompressor_p *) base; struct mschmd_file *fi, *nfi; struct mspack_system *sys; unsigned int i; if (!base) return; sys = self->system; self->error = MSPACK_ERR_OK; /* free files */ for (fi = chm->files; fi; fi = nfi) { nfi = fi->next; sys->free(fi); } for (fi = chm->sysfiles; fi; fi = nfi) { nfi = fi->next; sys->free(fi); } /* if this CHM was being decompressed, free decompression state */ if (self->d && (self->d->chm == chm)) { if (self->d->infh) sys->close(self->d->infh); if (self->d->state) lzxd_free(self->d->state); sys->free(self->d); self->d = NULL; } /* if this CHM had a chunk cache, free it and contents */ if (chm->chunk_cache) { for (i = 0; i < chm->num_chunks; i++) sys->free(chm->chunk_cache[i]); sys->free(chm->chunk_cache); } sys->free(chm); } ",0 "static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info) { struct cfg80211_registered_device *rdev = info->user_ptr[0]; int err; struct net_device *dev = info->user_ptr[1]; struct station_parameters params; u8 *mac_addr = NULL; memset(¶ms, 0, sizeof(params)); if (!info->attrs[NL80211_ATTR_MAC]) return -EINVAL; if (!info->attrs[NL80211_ATTR_STA_LISTEN_INTERVAL]) return -EINVAL; if (!info->attrs[NL80211_ATTR_STA_SUPPORTED_RATES]) return -EINVAL; if (!info->attrs[NL80211_ATTR_STA_AID]) return -EINVAL; mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]); params.supported_rates = nla_data(info->attrs[NL80211_ATTR_STA_SUPPORTED_RATES]); params.supported_rates_len = nla_len(info->attrs[NL80211_ATTR_STA_SUPPORTED_RATES]); params.listen_interval = nla_get_u16(info->attrs[NL80211_ATTR_STA_LISTEN_INTERVAL]); params.aid = nla_get_u16(info->attrs[NL80211_ATTR_STA_AID]); if (!params.aid || params.aid > IEEE80211_MAX_AID) return -EINVAL; if (info->attrs[NL80211_ATTR_HT_CAPABILITY]) params.ht_capa = nla_data(info->attrs[NL80211_ATTR_HT_CAPABILITY]); if (info->attrs[NL80211_ATTR_STA_PLINK_ACTION]) params.plink_action = nla_get_u8(info->attrs[NL80211_ATTR_STA_PLINK_ACTION]); if (parse_station_flags(info, ¶ms)) return -EINVAL; if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN && dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT && dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) return -EINVAL; err = get_vlan(info, rdev, ¶ms.vlan); if (err) goto out; /* validate settings */ err = 0; if (!rdev->ops->add_station) { err = -EOPNOTSUPP; goto out; } err = rdev->ops->add_station(&rdev->wiphy, dev, mac_addr, ¶ms); out: if (params.vlan) dev_put(params.vlan); return err; } ",0 "static int dev_new_index(struct net *net) { int ifindex = net->ifindex; for (;;) { if (++ifindex <= 0) ifindex = 1; if (!__dev_get_by_index(net, ifindex)) return net->ifindex = ifindex; } } ",0 "void RenderFrameImpl::OnTextTrackSettingsChanged( const FrameMsg_TextTrackSettings_Params& params) { DCHECK(!frame_->parent()); if (!render_view_->webview()) return; if (params.text_tracks_enabled) { render_view_->webview()->settings()->setTextTrackKindUserPreference( WebSettings::TextTrackKindUserPreference::Captions); } else { render_view_->webview()->settings()->setTextTrackKindUserPreference( WebSettings::TextTrackKindUserPreference::Default); } render_view_->webview()->settings()->setTextTrackBackgroundColor( WebString::fromUTF8(params.text_track_background_color)); render_view_->webview()->settings()->setTextTrackFontFamily( WebString::fromUTF8(params.text_track_font_family)); render_view_->webview()->settings()->setTextTrackFontStyle( WebString::fromUTF8(params.text_track_font_style)); render_view_->webview()->settings()->setTextTrackFontVariant( WebString::fromUTF8(params.text_track_font_variant)); render_view_->webview()->settings()->setTextTrackTextColor( WebString::fromUTF8(params.text_track_text_color)); render_view_->webview()->settings()->setTextTrackTextShadow( WebString::fromUTF8(params.text_track_text_shadow)); render_view_->webview()->settings()->setTextTrackTextSize( WebString::fromUTF8(params.text_track_text_size)); } ",0 "dissect_spoolss_buffer(tvbuff_t *tvb, gint offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep, BUFFER *b) { if (b) memset(b, 0, sizeof(BUFFER)); di->private_data = b; offset = dissect_ndr_pointer( tvb, offset, pinfo, tree, di, drep, dissect_spoolss_buffer_data, NDR_POINTER_UNIQUE, ""Buffer"", -1); return offset; } ",0 "static int op32_get_current_rxslot(struct b43_dmaring *ring) { u32 val; val = b43_dma_read(ring, B43_DMA32_RXSTATUS); val &= B43_DMA32_RXDPTR; return (val / sizeof(struct b43_dmadesc32)); } ",0 "bool TextTrack::IsVisualKind() const { return kind() == SubtitlesKeyword() || kind() == CaptionsKeyword(); } ",0 "void BrowserView::TabDetachedAt(TabContents* contents, int index) { if (index == browser_->active_index()) { contents_container_->SetWebContents(NULL); infobar_container_->ChangeTabContents(NULL); UpdateDevToolsForContents(NULL); } } ",1 "void FrameLoaderClient::didDisplayInsecureContent() { notImplemented(); } ",0 "static void activityLoggedInIsolatedWorldsAttrAttributeGetterForMainWorld(const v8::PropertyCallbackInfo& info) { TestObject* imp = V8TestObject::toNative(info.Holder()); v8SetReturnValueInt(info, imp->activityLoggedInIsolatedWorldsAttr()); } ",0 "bool RenderProcessHostImpl::Init() { if (channel_.get()) return true; CommandLine::StringType renderer_prefix; #if defined(OS_POSIX) const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); renderer_prefix = browser_command_line.GetSwitchValueNative(switches::kRendererCmdPrefix); #endif // defined(OS_POSIX) #if defined(OS_LINUX) int flags = renderer_prefix.empty() ? ChildProcessHost::CHILD_ALLOW_SELF : ChildProcessHost::CHILD_NORMAL; #else int flags = ChildProcessHost::CHILD_NORMAL; #endif FilePath renderer_path = ChildProcessHost::GetChildPath(flags); if (renderer_path.empty()) return false; const std::string channel_id = IPC::Channel::GenerateVerifiedChannelID(std::string()); channel_.reset( #if defined(OS_ANDROID) browser_command_line.HasSwitch(switches::kEnableWebViewSynchronousAPIs) ? new IPC::SyncChannel( channel_id, IPC::Channel::MODE_SERVER, this, BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), true, &dummy_shutdown_event_) : #endif new IPC::ChannelProxy( channel_id, IPC::Channel::MODE_SERVER, this, BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); GetContentClient()->browser()->RenderProcessHostCreated(this); CreateMessageFilters(); if (run_renderer_in_process()) { in_process_renderer_.reset(new RendererMainThread(channel_id)); base::Thread::Options options; #if !defined(TOOLKIT_GTK) && !defined(OS_ANDROID) options.message_loop_type = MessageLoop::TYPE_UI; #else options.message_loop_type = MessageLoop::TYPE_DEFAULT; #endif in_process_renderer_->StartWithOptions(options); OnProcessLaunched(); // Fake a callback that the process is ready. } else { CommandLine* cmd_line = new CommandLine(renderer_path); if (!renderer_prefix.empty()) cmd_line->PrependWrapper(renderer_prefix); AppendRendererCommandLine(cmd_line); cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id); child_process_launcher_.reset(new ChildProcessLauncher( #if defined(OS_WIN) FilePath(), #elif defined(OS_POSIX) renderer_prefix.empty(), base::EnvironmentVector(), channel_->TakeClientFileDescriptor(), #endif cmd_line, GetID(), this)); fast_shutdown_started_ = false; } is_initialized_ = true; return true; } ",0 "md5_digest_clear (struct md5_digest *digest) { CLEAR (*digest); } ",0 "TextureMapperGL::~TextureMapperGL() { delete m_data; } ",0 "OMXNodeInstance::OMXNodeInstance( OMX *owner, const sp &observer, const char *name) : mOwner(owner), mNodeID(0), mHandle(NULL), mObserver(observer), mDying(false), mBufferIDCount(0) { mName = ADebug::GetDebugName(name); DEBUG = ADebug::GetDebugLevelFromProperty(name, ""debug.stagefright.omx-debug""); ALOGV(""debug level for %s is %d"", name, DEBUG); DEBUG_BUMP = DEBUG; mNumPortBuffers[0] = 0; mNumPortBuffers[1] = 0; mDebugLevelBumpPendingBuffers[0] = 0; mDebugLevelBumpPendingBuffers[1] = 0; mMetadataType[0] = kMetadataBufferTypeInvalid; mMetadataType[1] = kMetadataBufferTypeInvalid; mSecureBufferType[0] = kSecureBufferTypeUnknown; mSecureBufferType[1] = kSecureBufferTypeUnknown; mIsSecure = AString(name).endsWith("".secure""); } ",1 "ShutdownWatcherHelper::~ShutdownWatcherHelper() { DCHECK_EQ(thread_id_, base::PlatformThread::CurrentId()); if (shutdown_watchdog_) { shutdown_watchdog_->Disarm(); delete shutdown_watchdog_; shutdown_watchdog_ = nullptr; } } ",0 "struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net, const struct in6_addr *addr, struct net_device *dev, int strict) { struct inet6_ifaddr *ifp, *result = NULL; unsigned int hash = inet6_addr_hash(addr); rcu_read_lock_bh(); hlist_for_each_entry_rcu_bh(ifp, &inet6_addr_lst[hash], addr_lst) { if (!net_eq(dev_net(ifp->idev->dev), net)) continue; if (ipv6_addr_equal(&ifp->addr, addr)) { if (dev == NULL || ifp->idev->dev == dev || !(ifp->scope&(IFA_LINK|IFA_HOST) || strict)) { result = ifp; in6_ifa_hold(ifp); break; } } } rcu_read_unlock_bh(); return result; } ",0 "kvm_irqfd_assign(struct kvm *kvm, struct kvm_irqfd *args) { struct kvm_kernel_irqfd *irqfd, *tmp; struct fd f; struct eventfd_ctx *eventfd = NULL, *resamplefd = NULL; int ret; unsigned int events; int idx; if (!kvm_arch_intc_initialized(kvm)) return -EAGAIN; irqfd = kzalloc(sizeof(*irqfd), GFP_KERNEL); if (!irqfd) return -ENOMEM; irqfd->kvm = kvm; irqfd->gsi = args->gsi; INIT_LIST_HEAD(&irqfd->list); INIT_WORK(&irqfd->inject, irqfd_inject); INIT_WORK(&irqfd->shutdown, irqfd_shutdown); seqcount_init(&irqfd->irq_entry_sc); f = fdget(args->fd); if (!f.file) { ret = -EBADF; goto out; } eventfd = eventfd_ctx_fileget(f.file); if (IS_ERR(eventfd)) { ret = PTR_ERR(eventfd); goto fail; } irqfd->eventfd = eventfd; if (args->flags & KVM_IRQFD_FLAG_RESAMPLE) { struct kvm_kernel_irqfd_resampler *resampler; resamplefd = eventfd_ctx_fdget(args->resamplefd); if (IS_ERR(resamplefd)) { ret = PTR_ERR(resamplefd); goto fail; } irqfd->resamplefd = resamplefd; INIT_LIST_HEAD(&irqfd->resampler_link); mutex_lock(&kvm->irqfds.resampler_lock); list_for_each_entry(resampler, &kvm->irqfds.resampler_list, link) { if (resampler->notifier.gsi == irqfd->gsi) { irqfd->resampler = resampler; break; } } if (!irqfd->resampler) { resampler = kzalloc(sizeof(*resampler), GFP_KERNEL); if (!resampler) { ret = -ENOMEM; mutex_unlock(&kvm->irqfds.resampler_lock); goto fail; } resampler->kvm = kvm; INIT_LIST_HEAD(&resampler->list); resampler->notifier.gsi = irqfd->gsi; resampler->notifier.irq_acked = irqfd_resampler_ack; INIT_LIST_HEAD(&resampler->link); list_add(&resampler->link, &kvm->irqfds.resampler_list); kvm_register_irq_ack_notifier(kvm, &resampler->notifier); irqfd->resampler = resampler; } list_add_rcu(&irqfd->resampler_link, &irqfd->resampler->list); synchronize_srcu(&kvm->irq_srcu); mutex_unlock(&kvm->irqfds.resampler_lock); } /* * Install our own custom wake-up handling so we are notified via * a callback whenever someone signals the underlying eventfd */ init_waitqueue_func_entry(&irqfd->wait, irqfd_wakeup); init_poll_funcptr(&irqfd->pt, irqfd_ptable_queue_proc); spin_lock_irq(&kvm->irqfds.lock); ret = 0; list_for_each_entry(tmp, &kvm->irqfds.items, list) { if (irqfd->eventfd != tmp->eventfd) continue; /* This fd is used for another irq already. */ ret = -EBUSY; spin_unlock_irq(&kvm->irqfds.lock); goto fail; } idx = srcu_read_lock(&kvm->irq_srcu); irqfd_update(kvm, irqfd); srcu_read_unlock(&kvm->irq_srcu, idx); list_add_tail(&irqfd->list, &kvm->irqfds.items); spin_unlock_irq(&kvm->irqfds.lock); /* * Check if there was an event already pending on the eventfd * before we registered, and trigger it as if we didn't miss it. */ events = f.file->f_op->poll(f.file, &irqfd->pt); if (events & POLLIN) schedule_work(&irqfd->inject); /* * do not drop the file until the irqfd is fully initialized, otherwise * we might race against the POLLHUP */ fdput(f); #ifdef CONFIG_HAVE_KVM_IRQ_BYPASS if (kvm_arch_has_irq_bypass()) { irqfd->consumer.token = (void *)irqfd->eventfd; irqfd->consumer.add_producer = kvm_arch_irq_bypass_add_producer; irqfd->consumer.del_producer = kvm_arch_irq_bypass_del_producer; irqfd->consumer.stop = kvm_arch_irq_bypass_stop; irqfd->consumer.start = kvm_arch_irq_bypass_start; ret = irq_bypass_register_consumer(&irqfd->consumer); if (ret) pr_info(""irq bypass consumer (token %p) registration fails: %d\n"", irqfd->consumer.token, ret); } #endif return 0; fail: if (irqfd->resampler) irqfd_resampler_shutdown(irqfd); if (resamplefd && !IS_ERR(resamplefd)) eventfd_ctx_put(resamplefd); if (eventfd && !IS_ERR(eventfd)) eventfd_ctx_put(eventfd); fdput(f); out: kfree(irqfd); return ret; } ",0 "void ExtensionPrefs::SetPageIndex(const std::string& extension_id, int index) { CHECK_GE(index, 0); UpdateExtensionPref(extension_id, kPrefPageIndex, Value::CreateIntegerValue(index)); } ",0 " void writeReferenceCount(uint32_t numberOfReferences) { append(ReferenceCountTag); doWriteUint32(numberOfReferences); } ",0 "static int mov_read_stsd(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; int ret, entries; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams - 1]; sc = st->priv_data; avio_r8(pb); /* version */ avio_rb24(pb); /* flags */ entries = avio_rb32(pb); if (entries <= 0) { av_log(c->fc, AV_LOG_ERROR, ""invalid STSD entries %d\n"", entries); return AVERROR_INVALIDDATA; } if (sc->extradata) { av_log(c->fc, AV_LOG_ERROR, ""Duplicate STSD\n""); return AVERROR_INVALIDDATA; } /* Prepare space for hosting multiple extradata. */ sc->extradata = av_mallocz_array(entries, sizeof(*sc->extradata)); sc->extradata_size = av_mallocz_array(entries, sizeof(*sc->extradata_size)); if (!sc->extradata_size || !sc->extradata) { ret = AVERROR(ENOMEM); goto fail; } ret = ff_mov_read_stsd_entries(c, pb, entries); if (ret < 0) return ret; sc->stsd_count = entries; /* Restore back the primary extradata. */ av_freep(&st->codecpar->extradata); st->codecpar->extradata_size = sc->extradata_size[0]; if (sc->extradata_size[0]) { st->codecpar->extradata = av_mallocz(sc->extradata_size[0] + AV_INPUT_BUFFER_PADDING_SIZE); if (!st->codecpar->extradata) return AVERROR(ENOMEM); memcpy(st->codecpar->extradata, sc->extradata[0], sc->extradata_size[0]); } return mov_finalize_stsd_codec(c, pb, st, sc); fail: av_freep(&sc->extradata); av_freep(&sc->extradata_size); return ret; } ",0 "MockScheduler::MockScheduler() : QuicSendScheduler(NULL, kFixRate) { } ",0 "static int handle_ipmb_get_msg_cmd(struct ipmi_smi *intf, struct ipmi_smi_msg *msg) { struct cmd_rcvr *rcvr; int rv = 0; unsigned char netfn; unsigned char cmd; unsigned char chan; struct ipmi_user *user = NULL; struct ipmi_ipmb_addr *ipmb_addr; struct ipmi_recv_msg *recv_msg; if (msg->rsp_size < 10) { /* Message not big enough, just ignore it. */ ipmi_inc_stat(intf, invalid_commands); return 0; } if (msg->rsp[2] != 0) { /* An error getting the response, just ignore it. */ return 0; } netfn = msg->rsp[4] >> 2; cmd = msg->rsp[8]; chan = msg->rsp[3] & 0xf; rcu_read_lock(); rcvr = find_cmd_rcvr(intf, netfn, cmd, chan); if (rcvr) { user = rcvr->user; kref_get(&user->refcount); } else user = NULL; rcu_read_unlock(); if (user == NULL) { /* We didn't find a user, deliver an error response. */ ipmi_inc_stat(intf, unhandled_commands); msg->data[0] = (IPMI_NETFN_APP_REQUEST << 2); msg->data[1] = IPMI_SEND_MSG_CMD; msg->data[2] = msg->rsp[3]; msg->data[3] = msg->rsp[6]; msg->data[4] = ((netfn + 1) << 2) | (msg->rsp[7] & 0x3); msg->data[5] = ipmb_checksum(&msg->data[3], 2); msg->data[6] = intf->addrinfo[msg->rsp[3] & 0xf].address; /* rqseq/lun */ msg->data[7] = (msg->rsp[7] & 0xfc) | (msg->rsp[4] & 0x3); msg->data[8] = msg->rsp[8]; /* cmd */ msg->data[9] = IPMI_INVALID_CMD_COMPLETION_CODE; msg->data[10] = ipmb_checksum(&msg->data[6], 4); msg->data_size = 11; ipmi_debug_msg(""Invalid command:"", msg->data, msg->data_size); rcu_read_lock(); if (!intf->in_shutdown) { smi_send(intf, intf->handlers, msg, 0); /* * We used the message, so return the value * that causes it to not be freed or * queued. */ rv = -1; } rcu_read_unlock(); } else { recv_msg = ipmi_alloc_recv_msg(); if (!recv_msg) { /* * We couldn't allocate memory for the * message, so requeue it for handling * later. */ rv = 1; kref_put(&user->refcount, free_user); } else { /* Extract the source address from the data. */ ipmb_addr = (struct ipmi_ipmb_addr *) &recv_msg->addr; ipmb_addr->addr_type = IPMI_IPMB_ADDR_TYPE; ipmb_addr->slave_addr = msg->rsp[6]; ipmb_addr->lun = msg->rsp[7] & 3; ipmb_addr->channel = msg->rsp[3] & 0xf; /* * Extract the rest of the message information * from the IPMB header. */ recv_msg->user = user; recv_msg->recv_type = IPMI_CMD_RECV_TYPE; recv_msg->msgid = msg->rsp[7] >> 2; recv_msg->msg.netfn = msg->rsp[4] >> 2; recv_msg->msg.cmd = msg->rsp[8]; recv_msg->msg.data = recv_msg->msg_data; /* * We chop off 10, not 9 bytes because the checksum * at the end also needs to be removed. */ recv_msg->msg.data_len = msg->rsp_size - 10; memcpy(recv_msg->msg_data, &msg->rsp[9], msg->rsp_size - 10); if (deliver_response(intf, recv_msg)) ipmi_inc_stat(intf, unhandled_commands); else ipmi_inc_stat(intf, handled_commands); } } return rv; } ",0 "MagickExport MagickBooleanType IsTaintImage(const Image *image) { char magick[MaxTextExtent], filename[MaxTextExtent]; register const Image *p; assert(image != (Image *) NULL); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""...""); assert(image->signature == MagickSignature); (void) CopyMagickString(magick,image->magick,MaxTextExtent); (void) CopyMagickString(filename,image->filename,MaxTextExtent); for (p=image; p != (Image *) NULL; p=GetNextImageInList(p)) { if (p->taint != MagickFalse) return(MagickTrue); if (LocaleCompare(p->magick,magick) != 0) return(MagickTrue); if (LocaleCompare(p->filename,filename) != 0) return(MagickTrue); } return(MagickFalse); } ",0 "bool DownloadManagerImpl::ShouldCompleteDownload( download::DownloadItemImpl* item, const base::Closure& complete_callback) { if (!delegate_ || delegate_->ShouldCompleteDownload(item, complete_callback)) { return true; } return false; } ",0 " Move_Zp2_Point( TT_ExecContext exc, FT_UShort point, FT_F26Dot6 dx, FT_F26Dot6 dy, FT_Bool touch ) { if ( exc->GS.freeVector.x != 0 ) { #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL if ( !( SUBPIXEL_HINTING_MINIMAL && exc->backward_compatibility ) ) #endif exc->zp2.cur[point].x = ADD_LONG( exc->zp2.cur[point].x, dx ); if ( touch ) exc->zp2.tags[point] |= FT_CURVE_TAG_TOUCH_X; } if ( exc->GS.freeVector.y != 0 ) { #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL if ( !( SUBPIXEL_HINTING_MINIMAL && exc->backward_compatibility && exc->iupx_called && exc->iupy_called ) ) #endif exc->zp2.cur[point].y = ADD_LONG( exc->zp2.cur[point].y, dy ); if ( touch ) exc->zp2.tags[point] |= FT_CURVE_TAG_TOUCH_Y; } } ",0 "static int translate_compat_table(const char *name, unsigned int valid_hooks, struct xt_table_info **pinfo, void **pentry0, unsigned int total_size, unsigned int number, unsigned int *hook_entries, unsigned int *underflows) { unsigned int i, j; struct xt_table_info *newinfo, *info; void *pos, *entry0, *entry1; struct compat_arpt_entry *iter0; struct arpt_entry *iter1; unsigned int size; int ret = 0; info = *pinfo; entry0 = *pentry0; size = total_size; info->number = number; /* Init all hooks to impossible value. */ for (i = 0; i < NF_ARP_NUMHOOKS; i++) { info->hook_entry[i] = 0xFFFFFFFF; info->underflow[i] = 0xFFFFFFFF; } duprintf(""translate_compat_table: size %u\n"", info->size); j = 0; xt_compat_lock(NFPROTO_ARP); xt_compat_init_offsets(NFPROTO_ARP, number); /* Walk through entries, checking offsets. */ xt_entry_foreach(iter0, entry0, total_size) { ret = check_compat_entry_size_and_hooks(iter0, info, &size, entry0, entry0 + total_size, hook_entries, underflows, name); if (ret != 0) goto out_unlock; ++j; } ret = -EINVAL; if (j != number) { duprintf(""translate_compat_table: %u not %u entries\n"", j, number); goto out_unlock; } /* Check hooks all assigned */ for (i = 0; i < NF_ARP_NUMHOOKS; i++) { /* Only hooks which are valid */ if (!(valid_hooks & (1 << i))) continue; if (info->hook_entry[i] == 0xFFFFFFFF) { duprintf(""Invalid hook entry %u %u\n"", i, hook_entries[i]); goto out_unlock; } if (info->underflow[i] == 0xFFFFFFFF) { duprintf(""Invalid underflow %u %u\n"", i, underflows[i]); goto out_unlock; } } ret = -ENOMEM; newinfo = xt_alloc_table_info(size); if (!newinfo) goto out_unlock; newinfo->number = number; for (i = 0; i < NF_ARP_NUMHOOKS; i++) { newinfo->hook_entry[i] = info->hook_entry[i]; newinfo->underflow[i] = info->underflow[i]; } entry1 = newinfo->entries; pos = entry1; size = total_size; xt_entry_foreach(iter0, entry0, total_size) { ret = compat_copy_entry_from_user(iter0, &pos, &size, name, newinfo, entry1); if (ret != 0) break; } xt_compat_flush_offsets(NFPROTO_ARP); xt_compat_unlock(NFPROTO_ARP); if (ret) goto free_newinfo; ret = -ELOOP; if (!mark_source_chains(newinfo, valid_hooks, entry1)) goto free_newinfo; i = 0; xt_entry_foreach(iter1, entry1, newinfo->size) { iter1->counters.pcnt = xt_percpu_counter_alloc(); if (IS_ERR_VALUE(iter1->counters.pcnt)) { ret = -ENOMEM; break; } ret = check_target(iter1, name); if (ret != 0) { xt_percpu_counter_free(iter1->counters.pcnt); break; } ++i; if (strcmp(arpt_get_target(iter1)->u.user.name, XT_ERROR_TARGET) == 0) ++newinfo->stacksize; } if (ret) { /* * The first i matches need cleanup_entry (calls ->destroy) * because they had called ->check already. The other j-i * entries need only release. */ int skip = i; j -= i; xt_entry_foreach(iter0, entry0, newinfo->size) { if (skip-- > 0) continue; if (j-- == 0) break; compat_release_entry(iter0); } xt_entry_foreach(iter1, entry1, newinfo->size) { if (i-- == 0) break; cleanup_entry(iter1); } xt_free_table_info(newinfo); return ret; } *pinfo = newinfo; *pentry0 = entry1; xt_free_table_info(info); return 0; free_newinfo: xt_free_table_info(newinfo); out: xt_entry_foreach(iter0, entry0, total_size) { if (j-- == 0) break; compat_release_entry(iter0); } return ret; out_unlock: xt_compat_flush_offsets(NFPROTO_ARP); xt_compat_unlock(NFPROTO_ARP); goto out; } ",0 "static void __svc_rdma_free(struct work_struct *work) { struct svcxprt_rdma *rdma = container_of(work, struct svcxprt_rdma, sc_work); struct svc_xprt *xprt = &rdma->sc_xprt; dprintk(""svcrdma: %s(%p)\n"", __func__, rdma); if (rdma->sc_qp && !IS_ERR(rdma->sc_qp)) ib_drain_qp(rdma->sc_qp); /* We should only be called from kref_put */ if (kref_read(&xprt->xpt_ref) != 0) pr_err(""svcrdma: sc_xprt still in use? (%d)\n"", kref_read(&xprt->xpt_ref)); /* * Destroy queued, but not processed read completions. Note * that this cleanup has to be done before destroying the * cm_id because the device ptr is needed to unmap the dma in * svc_rdma_put_context. */ while (!list_empty(&rdma->sc_read_complete_q)) { struct svc_rdma_op_ctxt *ctxt; ctxt = list_first_entry(&rdma->sc_read_complete_q, struct svc_rdma_op_ctxt, list); list_del(&ctxt->list); svc_rdma_put_context(ctxt, 1); } /* Destroy queued, but not processed recv completions */ while (!list_empty(&rdma->sc_rq_dto_q)) { struct svc_rdma_op_ctxt *ctxt; ctxt = list_first_entry(&rdma->sc_rq_dto_q, struct svc_rdma_op_ctxt, list); list_del(&ctxt->list); svc_rdma_put_context(ctxt, 1); } /* Warn if we leaked a resource or under-referenced */ if (rdma->sc_ctxt_used != 0) pr_err(""svcrdma: ctxt still in use? (%d)\n"", rdma->sc_ctxt_used); /* Final put of backchannel client transport */ if (xprt->xpt_bc_xprt) { xprt_put(xprt->xpt_bc_xprt); xprt->xpt_bc_xprt = NULL; } rdma_dealloc_frmr_q(rdma); svc_rdma_destroy_ctxts(rdma); svc_rdma_destroy_maps(rdma); /* Destroy the QP if present (not a listener) */ if (rdma->sc_qp && !IS_ERR(rdma->sc_qp)) ib_destroy_qp(rdma->sc_qp); if (rdma->sc_sq_cq && !IS_ERR(rdma->sc_sq_cq)) ib_free_cq(rdma->sc_sq_cq); if (rdma->sc_rq_cq && !IS_ERR(rdma->sc_rq_cq)) ib_free_cq(rdma->sc_rq_cq); if (rdma->sc_pd && !IS_ERR(rdma->sc_pd)) ib_dealloc_pd(rdma->sc_pd); /* Destroy the CM ID */ rdma_destroy_id(rdma->sc_cm_id); kfree(rdma); } ",1 "void TabStripModel::SelectRelativeTab(bool next) { if (contents_data_.empty()) return; int index = active_index(); int delta = next ? 1 : -1; index = (index + count() + delta) % count(); ActivateTabAt(index, true); } ",0 "void NavigatorImpl::RequestNavigation( FrameTreeNode* frame_tree_node, const GURL& dest_url, const Referrer& dest_referrer, const FrameNavigationEntry& frame_entry, const NavigationEntryImpl& entry, ReloadType reload_type, PreviewsState previews_state, bool is_same_document_history_load, bool is_history_navigation_in_new_child, const scoped_refptr& post_body, base::TimeTicks navigation_start) { CHECK(IsBrowserSideNavigationEnabled()); DCHECK(frame_tree_node); bool should_dispatch_beforeunload = !is_same_document_history_load && !is_history_navigation_in_new_child && frame_tree_node->current_frame_host()->ShouldDispatchBeforeUnload(); FrameMsg_Navigate_Type::Value navigation_type = GetNavigationType( frame_tree_node->current_url(), // old_url dest_url, // new_url reload_type, // reload_type entry, // entry frame_entry, // frame_entry is_same_document_history_load); // is_same_document_history_load std::unique_ptr scoped_request = NavigationRequest::CreateBrowserInitiated( frame_tree_node, dest_url, dest_referrer, frame_entry, entry, navigation_type, previews_state, is_same_document_history_load, is_history_navigation_in_new_child, post_body, navigation_start, controller_); if (dest_url.SchemeIs(url::kJavaScriptScheme)) { RenderFrameHostImpl* render_frame_host = frame_tree_node->render_manager()->GetFrameHostForNavigation( *scoped_request.get()); render_frame_host->CommitNavigation( nullptr, // response nullptr, // body mojo::ScopedDataPipeConsumerHandle(), scoped_request->common_params(), scoped_request->request_params(), scoped_request->is_view_source()); return; } frame_tree_node->CreatedNavigationRequest(std::move(scoped_request)); NavigationRequest* navigation_request = frame_tree_node->navigation_request(); if (!navigation_request) return; // Navigation was synchronously stopped. if (should_dispatch_beforeunload && !IsRendererDebugURL(dest_url)) { navigation_request->SetWaitingForRendererResponse(); frame_tree_node->current_frame_host()->DispatchBeforeUnload( true, reload_type != ReloadType::NONE); } else { navigation_request->BeginNavigation(); } } ",0 "WebString WebLocalFrameImpl::SelectionAsMarkup() const { WebPluginContainerImpl* plugin_container = GetFrame()->GetWebPluginContainer(); if (plugin_container) return plugin_container->Plugin()->SelectionAsMarkup(); GetFrame()->GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets(); return GetFrame()->Selection().SelectedHTMLForClipboard(); } ",0 "static struct super_block *alloc_super(struct file_system_type *type, int flags) { struct super_block *s = kzalloc(sizeof(struct super_block), GFP_USER); static const struct super_operations default_op; int i; if (!s) return NULL; if (security_sb_alloc(s)) goto fail; #ifdef CONFIG_SMP s->s_files = alloc_percpu(struct list_head); if (!s->s_files) goto fail; for_each_possible_cpu(i) INIT_LIST_HEAD(per_cpu_ptr(s->s_files, i)); #else INIT_LIST_HEAD(&s->s_files); #endif for (i = 0; i < SB_FREEZE_LEVELS; i++) { if (percpu_counter_init(&s->s_writers.counter[i], 0) < 0) goto fail; lockdep_init_map(&s->s_writers.lock_map[i], sb_writers_name[i], &type->s_writers_key[i], 0); } init_waitqueue_head(&s->s_writers.wait); init_waitqueue_head(&s->s_writers.wait_unfrozen); s->s_flags = flags; s->s_bdi = &default_backing_dev_info; INIT_HLIST_NODE(&s->s_instances); INIT_HLIST_BL_HEAD(&s->s_anon); INIT_LIST_HEAD(&s->s_inodes); if (list_lru_init(&s->s_dentry_lru)) goto fail; if (list_lru_init(&s->s_inode_lru)) goto fail; INIT_LIST_HEAD(&s->s_mounts); init_rwsem(&s->s_umount); lockdep_set_class(&s->s_umount, &type->s_umount_key); /* * sget() can have s_umount recursion. * * When it cannot find a suitable sb, it allocates a new * one (this one), and tries again to find a suitable old * one. * * In case that succeeds, it will acquire the s_umount * lock of the old one. Since these are clearly distrinct * locks, and this object isn't exposed yet, there's no * risk of deadlocks. * * Annotate this by putting this lock in a different * subclass. */ down_write_nested(&s->s_umount, SINGLE_DEPTH_NESTING); s->s_count = 1; atomic_set(&s->s_active, 1); mutex_init(&s->s_vfs_rename_mutex); lockdep_set_class(&s->s_vfs_rename_mutex, &type->s_vfs_rename_key); mutex_init(&s->s_dquot.dqio_mutex); mutex_init(&s->s_dquot.dqonoff_mutex); init_rwsem(&s->s_dquot.dqptr_sem); s->s_maxbytes = MAX_NON_LFS; s->s_op = &default_op; s->s_time_gran = 1000000000; s->cleancache_poolid = -1; s->s_shrink.seeks = DEFAULT_SEEKS; s->s_shrink.scan_objects = super_cache_scan; s->s_shrink.count_objects = super_cache_count; s->s_shrink.batch = 1024; s->s_shrink.flags = SHRINKER_NUMA_AWARE; return s; fail: destroy_super(s); return NULL; } ",1 "linux_lvm2_lv_create_completed_cb (DBusGMethodInvocation *context, Device *device, gboolean job_was_cancelled, int status, const char *stderr, const char *stdout, gpointer user_data) { CreateLvm2LVData *data = user_data; if (WEXITSTATUS (status) == 0 && !job_was_cancelled) { Device *d; d = lvm2_lv_create_has_lv (data); if (d != NULL) { /* yay! it is.. now create the file system if requested */ lvm2_lv_create_found_device (device, data); } else { /* otherwise sit around and wait for the new LV to appear */ data->device_added_signal_handler_id = g_signal_connect_after (data->daemon, ""device-added"", G_CALLBACK (lvm2_lv_create_device_added_cb), data); data->device_changed_signal_handler_id = g_signal_connect_after (data->daemon, ""device-changed"", G_CALLBACK (lvm2_lv_create_device_changed_cb), data); data->device_added_timeout_id = g_timeout_add (10 * 1000, lvm2_lv_create_device_not_seen_cb, data); lvm2_lv_create_data_ref (data); } } else { if (job_was_cancelled) { throw_error (context, ERROR_CANCELLED, ""Job was cancelled""); } else { throw_error (context, ERROR_FAILED, ""Error creating LVM2 Logical Volume: lvcreate exited with exit code %d: %s"", WEXITSTATUS (status), stderr); } } } ",0 "iasecc_se_get_info_from_cache(struct sc_card *card, struct iasecc_se_info *se) { struct iasecc_private_data *prv = (struct iasecc_private_data *) card->drv_data; struct sc_context *ctx = card->ctx; struct iasecc_se_info *si = NULL; int rv; LOG_FUNC_CALLED(ctx); for(si = prv->se_info; si; si = si->next) { if (si->reference != se->reference) continue; if (!(card->cache.valid && card->cache.current_df) && si->df) continue; if (card->cache.valid && card->cache.current_df && !si->df) continue; if (card->cache.valid && card->cache.current_df && si->df) if (memcmp(&card->cache.current_df->path, &si->df->path, sizeof(struct sc_path))) continue; break; } if (!si) return SC_ERROR_OBJECT_NOT_FOUND; memcpy(se, si, sizeof(struct iasecc_se_info)); if (si->df) { sc_file_dup(&se->df, si->df); if (se->df == NULL) LOG_TEST_RET(ctx, SC_ERROR_OUT_OF_MEMORY, ""Cannot duplicate current DF file""); } rv = iasecc_docp_copy(ctx, &si->docp, &se->docp); LOG_TEST_RET(ctx, rv, ""Cannot make copy of DOCP""); LOG_FUNC_RETURN(ctx, rv); } ",0 "static int red_channel_client_pre_create_validate(RedChannel *channel, RedClient *client) { if (red_client_get_channel(client, channel->type, channel->id)) { spice_printerr(""Error client %p: duplicate channel type %d id %d"", client, channel->type, channel->id); return FALSE; } return TRUE; } ",0 "std::unique_ptr LocalFrameClientImpl::CreateWebMediaPlayer( HTMLMediaElement& html_media_element, const WebMediaPlayerSource& source, WebMediaPlayerClient* client, WebLayerTreeView* layer_tree_view) { WebLocalFrameImpl* web_frame = WebLocalFrameImpl::FromFrame(html_media_element.GetDocument().GetFrame()); if (!web_frame || !web_frame->Client()) return nullptr; return CoreInitializer::GetInstance().CreateWebMediaPlayer( web_frame->Client(), html_media_element, source, client, layer_tree_view); } ",0 "static OPJ_BOOL opj_tcd_dc_level_shift_decode ( opj_tcd_t *p_tcd ) { OPJ_UINT32 compno; opj_tcd_tilecomp_t * l_tile_comp = 00; opj_tccp_t * l_tccp = 00; opj_image_comp_t * l_img_comp = 00; opj_tcd_resolution_t* l_res = 00; opj_tcd_tile_t * l_tile; OPJ_UINT32 l_width,l_height,i,j; OPJ_INT32 * l_current_ptr; OPJ_INT32 l_min, l_max; OPJ_UINT32 l_stride; l_tile = p_tcd->tcd_image->tiles; l_tile_comp = l_tile->comps; l_tccp = p_tcd->tcp->tccps; l_img_comp = p_tcd->image->comps; for (compno = 0; compno < l_tile->numcomps; compno++) { l_res = l_tile_comp->resolutions + l_img_comp->resno_decoded; l_width = (OPJ_UINT32)(l_res->x1 - l_res->x0); l_height = (OPJ_UINT32)(l_res->y1 - l_res->y0); l_stride = (OPJ_UINT32)(l_tile_comp->x1 - l_tile_comp->x0) - l_width; assert(l_height == 0 || l_width + l_stride <= l_tile_comp->data_size / l_height); /*MUPDF*/ if (l_img_comp->sgnd) { l_min = -(1 << (l_img_comp->prec - 1)); l_max = (1 << (l_img_comp->prec - 1)) - 1; } else { l_min = 0; l_max = (1 << l_img_comp->prec) - 1; } l_current_ptr = l_tile_comp->data; if (l_tccp->qmfbid == 1) { for (j=0;jm_dc_level_shift, l_min, l_max); ++l_current_ptr; } l_current_ptr += l_stride; } } else { for (j=0;jm_dc_level_shift, l_min, l_max); ; ++l_current_ptr; } l_current_ptr += l_stride; } } ++l_img_comp; ++l_tccp; ++l_tile_comp; } return OPJ_TRUE; } ",0 "void Location::setHost(LocalDOMWindow* current_window, LocalDOMWindow* entered_window, const String& host, ExceptionState& exception_state) { KURL url = GetDocument()->Url(); url.SetHostAndPort(host); SetLocation(url.GetString(), current_window, entered_window, &exception_state); } ",0 "print_reason(netdissect_options *ndo, register int reason) { ND_PRINT((ndo, ""%s "", tok2str(reason2str, ""reason-%d"", reason))); } ",0 "static int kvm_device_ioctl_attr(struct kvm_device *dev, int (*accessor)(struct kvm_device *dev, struct kvm_device_attr *attr), unsigned long arg) { struct kvm_device_attr attr; if (!accessor) return -EPERM; if (copy_from_user(&attr, (void __user *)arg, sizeof(attr))) return -EFAULT; return accessor(dev, &attr); } ",0 "JSValue JSDataView::getInt8(ExecState* exec) { return getDataViewMember(exec, static_cast(impl()), AccessDataViewMemberAsInt8); } ",0 "static PHP_FUNCTION(session_set_save_handler) { zval ***args = NULL; int i, num_args, argc = ZEND_NUM_ARGS(); char *name; if (PS(session_status) != php_session_none) { RETURN_FALSE; } if (argc > 0 && argc <= 2) { zval *obj = NULL, *callback = NULL; zend_uint func_name_len; char *func_name; HashPosition pos; zend_function *default_mptr, *current_mptr; ulong func_index; php_shutdown_function_entry shutdown_function_entry; zend_bool register_shutdown = 1; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""O|b"", &obj, php_session_iface_entry, ®ister_shutdown) == FAILURE) { RETURN_FALSE; } /* Find implemented methods - SessionHandlerInterface */ zend_hash_internal_pointer_reset_ex(&php_session_iface_entry->function_table, &pos); i = 0; while (zend_hash_get_current_data_ex(&php_session_iface_entry->function_table, (void **) &default_mptr, &pos) == SUCCESS) { zend_hash_get_current_key_ex(&php_session_iface_entry->function_table, &func_name, &func_name_len, &func_index, 0, &pos); if (zend_hash_find(&Z_OBJCE_P(obj)->function_table, func_name, func_name_len, (void **)¤t_mptr) == SUCCESS) { if (PS(mod_user_names).names[i] != NULL) { zval_ptr_dtor(&PS(mod_user_names).names[i]); } MAKE_STD_ZVAL(callback); array_init_size(callback, 2); Z_ADDREF_P(obj); add_next_index_zval(callback, obj); add_next_index_stringl(callback, func_name, func_name_len - 1, 1); PS(mod_user_names).names[i] = callback; } else { php_error_docref(NULL TSRMLS_CC, E_ERROR, ""Session handler's function table is corrupt""); RETURN_FALSE; } zend_hash_move_forward_ex(&php_session_iface_entry->function_table, &pos); ++i; } /* Find implemented methods - SessionIdInterface (optional) */ zend_hash_internal_pointer_reset_ex(&php_session_id_iface_entry->function_table, &pos); while (zend_hash_get_current_data_ex(&php_session_id_iface_entry->function_table, (void **) &default_mptr, &pos) == SUCCESS) { zend_hash_get_current_key_ex(&php_session_id_iface_entry->function_table, &func_name, &func_name_len, &func_index, 0, &pos); if (zend_hash_find(&Z_OBJCE_P(obj)->function_table, func_name, func_name_len, (void **)¤t_mptr) == SUCCESS) { if (PS(mod_user_names).names[i] != NULL) { zval_ptr_dtor(&PS(mod_user_names).names[i]); } MAKE_STD_ZVAL(callback); array_init_size(callback, 2); Z_ADDREF_P(obj); add_next_index_zval(callback, obj); add_next_index_stringl(callback, func_name, func_name_len - 1, 1); PS(mod_user_names).names[i] = callback; } zend_hash_move_forward_ex(&php_session_id_iface_entry->function_table, &pos); ++i; } if (register_shutdown) { /* create shutdown function */ shutdown_function_entry.arg_count = 1; shutdown_function_entry.arguments = (zval **) safe_emalloc(sizeof(zval *), 1, 0); MAKE_STD_ZVAL(callback); ZVAL_STRING(callback, ""session_register_shutdown"", 1); shutdown_function_entry.arguments[0] = callback; /* add shutdown function, removing the old one if it exists */ if (!register_user_shutdown_function(""session_shutdown"", sizeof(""session_shutdown""), &shutdown_function_entry TSRMLS_CC)) { zval_ptr_dtor(&callback); efree(shutdown_function_entry.arguments); php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Unable to register session shutdown function""); RETURN_FALSE; } } else { /* remove shutdown function */ remove_user_shutdown_function(""session_shutdown"", sizeof(""session_shutdown"") TSRMLS_CC); } if (PS(mod) && PS(session_status) == php_session_none && PS(mod) != &ps_mod_user) { zend_alter_ini_entry(""session.save_handler"", sizeof(""session.save_handler""), ""user"", sizeof(""user"")-1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); } RETURN_TRUE; } if (argc != 6 && argc != 7) { WRONG_PARAM_COUNT; } if (zend_parse_parameters(argc TSRMLS_CC, ""+"", &args, &num_args) == FAILURE) { return; } /* remove shutdown function */ remove_user_shutdown_function(""session_shutdown"", sizeof(""session_shutdown"") TSRMLS_CC); /* at this point argc can only be 6 or 7 */ for (i = 0; i < argc; i++) { if (!zend_is_callable(*args[i], 0, &name TSRMLS_CC)) { efree(args); php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Argument %d is not a valid callback"", i+1); efree(name); RETURN_FALSE; } efree(name); } if (PS(mod) && PS(mod) != &ps_mod_user) { zend_alter_ini_entry(""session.save_handler"", sizeof(""session.save_handler""), ""user"", sizeof(""user"")-1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); } for (i = 0; i < argc; i++) { if (PS(mod_user_names).names[i] != NULL) { zval_ptr_dtor(&PS(mod_user_names).names[i]); } Z_ADDREF_PP(args[i]); PS(mod_user_names).names[i] = *args[i]; } efree(args); RETURN_TRUE; } ",0 "bool RenderThreadImpl::IsGpuMemoryBufferCompositorResourcesEnabled() { return is_gpu_memory_buffer_compositor_resources_enabled_; } ",0 "bool lockdep_genl_is_held(void) { return lockdep_is_held(&genl_mutex); } ",0 "void GLClearFramebufferTest::InitDraw() { static const char* v_shader_str = ""attribute vec4 a_Position;\n"" ""uniform float u_depth;\n"" ""void main()\n"" ""{\n"" "" gl_Position = a_Position;\n"" "" gl_Position.z = u_depth;\n"" ""}\n""; static const char* f_shader_str = ""precision mediump float;\n"" ""uniform vec4 u_draw_color;\n"" ""void main()\n"" ""{\n"" "" gl_FragColor = u_draw_color;\n"" ""}\n""; GLuint program = GLTestHelper::LoadProgram(v_shader_str, f_shader_str); DCHECK(program); glUseProgram(program); GLuint position_loc = glGetAttribLocation(program, ""a_Position""); GLTestHelper::SetupUnitQuad(position_loc); color_handle_ = glGetUniformLocation(program, ""u_draw_color""); DCHECK(color_handle_ != static_cast(-1)); depth_handle_ = glGetUniformLocation(program, ""u_depth""); DCHECK(depth_handle_ != static_cast(-1)); } ",0 "_prevA(int visited) { HmarkerList *hl = Currentbuf->hmarklist; BufferPoint *po; Anchor *an, *pan; int i, x, y, n = searchKeyNum(); ParsedURL url; if (Currentbuf->firstLine == NULL) return; if (!hl || hl->nmark == 0) return; an = retrieveCurrentAnchor(Currentbuf); if (visited != TRUE && an == NULL) an = retrieveCurrentForm(Currentbuf); y = Currentbuf->currentLine->linenumber; x = Currentbuf->pos; if (visited == TRUE) { n = hl->nmark; } for (i = 0; i < n; i++) { pan = an; if (an && an->hseq >= 0) { int hseq = an->hseq - 1; do { if (hseq < 0) { if (visited == TRUE) return; an = pan; goto _end; } po = hl->marks + hseq; an = retrieveAnchor(Currentbuf->href, po->line, po->pos); if (visited != TRUE && an == NULL) an = retrieveAnchor(Currentbuf->formitem, po->line, po->pos); hseq--; if (visited == TRUE && an) { parseURL2(an->url, &url, baseURL(Currentbuf)); if (getHashHist(URLHist, parsedURL2Str(&url)->ptr)) { goto _end; } } } while (an == NULL || an == pan); } else { an = closest_prev_anchor(Currentbuf->href, NULL, x, y); if (visited != TRUE) an = closest_prev_anchor(Currentbuf->formitem, an, x, y); if (an == NULL) { if (visited == TRUE) return; an = pan; break; } x = an->start.pos; y = an->start.line; if (visited == TRUE && an) { parseURL2(an->url, &url, baseURL(Currentbuf)); if (getHashHist(URLHist, parsedURL2Str(&url)->ptr)) { goto _end; } } } } if (visited == TRUE) return; _end: if (an == NULL || an->hseq < 0) return; po = hl->marks + an->hseq; gotoLine(Currentbuf, po->line); Currentbuf->pos = po->pos; arrangeCursor(Currentbuf); displayBuffer(Currentbuf, B_NORMAL); } ",0 "void ClassicPendingScript::Prefinalize() { CancelStreaming(); prefinalizer_called_ = true; } ",0 " GURL GetTestBaseURL(const std::string& test_directory) { GURL::Replacements replace_host; replace_host.SetHostStr(""localhost""); GURL base_url = embedded_test_server()->GetURL( ""/extensions/api_test/"" + test_directory + ""/""); return base_url.ReplaceComponents(replace_host); } ",0 "bool AppCacheDatabase::InsertEntry(const EntryRecord* record) { if (!LazyOpen(kCreateIfNeeded)) return false; static const char kSql[] = ""INSERT INTO Entries (cache_id, url, flags, response_id, response_size)"" "" VALUES(?, ?, ?, ?, ?)""; sql::Statement statement(db_->GetCachedStatement(SQL_FROM_HERE, kSql)); statement.BindInt64(0, record->cache_id); statement.BindString(1, record->url.spec()); statement.BindInt(2, record->flags); statement.BindInt64(3, record->response_id); statement.BindInt64(4, record->response_size); return statement.Run(); } ",1 "fst_rx_config(struct fst_port_info *port) { int i; int pi; unsigned int offset; unsigned long flags; struct fst_card_info *card; pi = port->index; card = port->card; spin_lock_irqsave(&card->card_lock, flags); for (i = 0; i < NUM_RX_BUFFER; i++) { offset = BUF_OFFSET(rxBuffer[pi][i][0]); FST_WRW(card, rxDescrRing[pi][i].ladr, (u16) offset); FST_WRB(card, rxDescrRing[pi][i].hadr, (u8) (offset >> 16)); FST_WRW(card, rxDescrRing[pi][i].bcnt, cnv_bcnt(LEN_RX_BUFFER)); FST_WRW(card, rxDescrRing[pi][i].mcnt, LEN_RX_BUFFER); FST_WRB(card, rxDescrRing[pi][i].bits, DMA_OWN); } port->rxpos = 0; spin_unlock_irqrestore(&card->card_lock, flags); } ",0 "int xmp_datetime_compare(XmpDateTime *left, XmpDateTime *right) { if (!left && !right) { return 0; } if (!left) { return -1; } if (!right) { return 1; } XMP_DateTime _left; ASSIGN(_left, *left); XMP_DateTime _right; ASSIGN(_right, *right); return XMPUtils::CompareDateTime(_left, _right); } ",0 "static int hid_reset_resume(struct usb_interface *intf) { struct hid_device *hid = usb_get_intfdata(intf); int status; status = hid_post_reset(intf); if (status >= 0 && hid->driver && hid->driver->reset_resume) { int ret = hid->driver->reset_resume(hid); if (ret < 0) status = ret; } return status; } ",0 "void Document::decrementLoadEventDelayCount() { ASSERT(m_loadEventDelayCount); --m_loadEventDelayCount; if (frame() && !m_loadEventDelayCount && !m_loadEventDelayTimer.isActive()) m_loadEventDelayTimer.startOneShot(0); } ",0 "v8::Persistent* V8ClassIndex::GetCache(V8WrapperType type) { switch (type) { #define MAKE_CASE(type, name)\ case V8ClassIndex::type: return &name##_cache_; ALL_WRAPPER_TYPES(MAKE_CASE) #undef MAKE_CASE default: ASSERT(false); return NULL; } } ",0 "MojoResult Core::CreateMessage(MojoMessageHandle* message_handle) { if (!message_handle) return MOJO_RESULT_INVALID_ARGUMENT; *message_handle = reinterpret_cast( UserMessageImpl::CreateEventForNewMessage().release()); return MOJO_RESULT_OK; } ",0 "SYSCALL_DEFINE3(osf_fstatfs, unsigned long, fd, struct osf_statfs __user *, buffer, unsigned long, bufsiz) { struct kstatfs linux_stat; int error = fd_statfs(fd, &linux_stat); if (!error) error = linux_to_osf_statfs(&linux_stat, buffer, bufsiz); return error; } ",0 "static inline void nfsd4_increment_op_stats(u32 opnum) { if (opnum >= FIRST_NFS4_OP && opnum <= LAST_NFS4_OP) nfsdstats.nfs4_opcount[opnum]++; } ",0 " virtual void RunWork() { bytes_read_ = base::ReadPlatformFile(file_, offset_, buffer_.get(), bytes_to_read_); if (bytes_read_ < 0) set_error_code(base::PLATFORM_FILE_ERROR_FAILED); } ",0 "static inline int ext4_ext_space_block(struct inode *inode, int check) { int size; size = (inode->i_sb->s_blocksize - sizeof(struct ext4_extent_header)) / sizeof(struct ext4_extent); #ifdef AGGRESSIVE_TEST if (!check && size > 6) size = 6; #endif return size; } ",0 "static int cmp_event_layer(const void *p1, const void *p2) { ASS_Event *e1 = ((EventImages *) p1)->event; ASS_Event *e2 = ((EventImages *) p2)->event; if (e1->Layer < e2->Layer) return -1; if (e1->Layer > e2->Layer) return 1; if (e1->ReadOrder < e2->ReadOrder) return -1; if (e1->ReadOrder > e2->ReadOrder) return 1; return 0; } ",0 "static void svm_write_tsc_offset(struct kvm_vcpu *vcpu, u64 offset) { struct vcpu_svm *svm = to_svm(vcpu); u64 g_tsc_offset = 0; if (is_guest_mode(vcpu)) { g_tsc_offset = svm->vmcb->control.tsc_offset - svm->nested.hsave->control.tsc_offset; svm->nested.hsave->control.tsc_offset = offset; } else trace_kvm_write_tsc_offset(vcpu->vcpu_id, svm->vmcb->control.tsc_offset, offset); svm->vmcb->control.tsc_offset = offset + g_tsc_offset; mark_dirty(svm->vmcb, VMCB_INTERCEPTS); } ",0 "base::span GetContentSettingsUIInfo() { DCHECK(base::FeatureList::GetInstance() != nullptr); static const PermissionsUIInfo kPermissionsUIInfo[] = { {CONTENT_SETTINGS_TYPE_COOKIES, 0}, {CONTENT_SETTINGS_TYPE_IMAGES, IDS_PAGE_INFO_TYPE_IMAGES}, {CONTENT_SETTINGS_TYPE_JAVASCRIPT, IDS_PAGE_INFO_TYPE_JAVASCRIPT}, {CONTENT_SETTINGS_TYPE_POPUPS, IDS_PAGE_INFO_TYPE_POPUPS_REDIRECTS}, #if BUILDFLAG(ENABLE_PLUGINS) {CONTENT_SETTINGS_TYPE_PLUGINS, IDS_PAGE_INFO_TYPE_FLASH}, #endif {CONTENT_SETTINGS_TYPE_GEOLOCATION, IDS_PAGE_INFO_TYPE_LOCATION}, {CONTENT_SETTINGS_TYPE_NOTIFICATIONS, IDS_PAGE_INFO_TYPE_NOTIFICATIONS}, {CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, IDS_PAGE_INFO_TYPE_MIC}, {CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, IDS_PAGE_INFO_TYPE_CAMERA}, {CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, IDS_AUTOMATIC_DOWNLOADS_TAB_LABEL}, {CONTENT_SETTINGS_TYPE_MIDI_SYSEX, IDS_PAGE_INFO_TYPE_MIDI_SYSEX}, {CONTENT_SETTINGS_TYPE_BACKGROUND_SYNC, IDS_PAGE_INFO_TYPE_BACKGROUND_SYNC}, {CONTENT_SETTINGS_TYPE_AUTOPLAY, IDS_PAGE_INFO_TYPE_AUTOPLAY}, {CONTENT_SETTINGS_TYPE_ADS, IDS_PAGE_INFO_TYPE_ADS}, {CONTENT_SETTINGS_TYPE_SOUND, IDS_PAGE_INFO_TYPE_SOUND}, {CONTENT_SETTINGS_TYPE_CLIPBOARD_READ, IDS_PAGE_INFO_TYPE_CLIPBOARD}, {CONTENT_SETTINGS_TYPE_SENSORS, base::FeatureList::IsEnabled(features::kGenericSensorExtraClasses) ? IDS_PAGE_INFO_TYPE_SENSORS : IDS_PAGE_INFO_TYPE_MOTION_SENSORS}, {CONTENT_SETTINGS_TYPE_USB_GUARD, IDS_PAGE_INFO_TYPE_USB}, #if !defined(OS_ANDROID) {CONTENT_SETTINGS_TYPE_SERIAL_GUARD, IDS_PAGE_INFO_TYPE_SERIAL}, {CONTENT_SETTINGS_TYPE_BLUETOOTH_SCANNING, IDS_PAGE_INFO_TYPE_BLUETOOTH_SCANNING}, #endif }; return kPermissionsUIInfo; } ",0 "static void unlink1_callback(struct urb *urb) { int status = urb->status; /* we ""know"" -EPIPE (stall) never happens */ if (!status) status = usb_submit_urb(urb, GFP_ATOMIC); if (status) { urb->status = status; complete(urb->context); } } ",0 "void DatabaseImpl::SetIndexesReady(int64_t transaction_id, int64_t object_store_id, const std::vector& index_ids) { idb_runner_->PostTask( FROM_HERE, base::Bind(&IDBThreadHelper::SetIndexesReady, base::Unretained(helper_), transaction_id, object_store_id, index_ids)); } ",0 "uint64_t WebMediaPlayerImpl::VideoDecodedByteCount() const { DCHECK(main_task_runner_->BelongsToCurrentThread()); return GetPipelineStatistics().video_bytes_decoded; } ",0 "PHP_MINFO_FUNCTION(mb_regex) { char buf[32]; php_info_print_table_start(); php_info_print_table_row(2, ""Multibyte (japanese) regex support"", ""enabled""); snprintf(buf, sizeof(buf), ""%d.%d.%d"", ONIGURUMA_VERSION_MAJOR, ONIGURUMA_VERSION_MINOR, ONIGURUMA_VERSION_TEENY); #ifdef PHP_ONIG_BUNDLED #ifdef USE_COMBINATION_EXPLOSION_CHECK php_info_print_table_row(2, ""Multibyte regex (oniguruma) backtrack check"", ""On""); #else /* USE_COMBINATION_EXPLOSION_CHECK */ php_info_print_table_row(2, ""Multibyte regex (oniguruma) backtrack check"", ""Off""); #endif /* USE_COMBINATION_EXPLOSION_CHECK */ #endif /* PHP_BUNDLED_ONIG */ php_info_print_table_row(2, ""Multibyte regex (oniguruma) version"", buf); php_info_print_table_end(); } ",0 "ProfileImplIOData::Handle::GetIsolatedAppRequestContextGetter( const std::string& app_id) const { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!app_id.empty()); LazyInitialize(); ChromeURLRequestContextGetterMap::iterator iter = app_request_context_getter_map_.find(app_id); if (iter != app_request_context_getter_map_.end()) return iter->second; ChromeURLRequestContextGetter* context = ChromeURLRequestContextGetter::CreateOriginalForIsolatedApp( profile_, io_data_, app_id); app_request_context_getter_map_[app_id] = context; return context; } ",0 "void Browser::Print() { if (switches::IsPrintPreviewEnabled()) GetSelectedTabContentsWrapper()->print_view_manager()->PrintPreviewNow(); else GetSelectedTabContentsWrapper()->print_view_manager()->PrintNow(); } ",0 "asmlinkage void do_mdmx(struct pt_regs *regs) { force_sig(SIGILL, current); } ",0 "int CLASS nikon_e2100() { uchar t[12]; int i; fseek (ifp, 0, SEEK_SET); for (i=0; i < 1024; i++) { fread (t, 1, 12, ifp); if (((t[2] & t[4] & t[7] & t[9]) >> 4 & t[1] & t[6] & t[8] & t[11] & 3) != 3) return 0; } return 1; } ",0 " void PrerenderTestURLImpl( const GURL& url, const std::deque& expected_final_status_queue, int total_navigations) { dest_url_ = url; std::vector replacement_text; replacement_text.push_back( make_pair(""REPLACE_WITH_PREFETCH_URL"", dest_url_.spec())); std::string replacement_path; ASSERT_TRUE(net::TestServer::GetFilePathWithReplacements( ""files/prerender/prerender_loader.html"", replacement_text, &replacement_path)); net::TestServer* src_server = test_server(); scoped_ptr https_src_server; if (use_https_src_server_) { https_src_server.reset( new net::TestServer(net::TestServer::TYPE_HTTPS, FilePath(FILE_PATH_LITERAL(""chrome/test/data"")))); ASSERT_TRUE(https_src_server->Start()); src_server = https_src_server.get(); } GURL src_url = src_server->GetURL(replacement_path); ASSERT_TRUE(prerender_manager()); prerender_manager()->rate_limit_enabled_ = false; ASSERT_TRUE(prerender_contents_factory_ == NULL); prerender_contents_factory_ = new WaitForLoadPrerenderContentsFactory(total_navigations, expected_final_status_queue); prerender_manager()->SetPrerenderContentsFactory( prerender_contents_factory_); FinalStatus expected_final_status = expected_final_status_queue.front(); browser()->OpenURL(src_url, GURL(), CURRENT_TAB, PageTransition::TYPED); TestPrerenderContents* prerender_contents = NULL; ui_test_utils::RunMessageLoop(); prerender_contents = static_cast( prerender_manager()->FindEntry(dest_url_)); switch (expected_final_status) { case FINAL_STATUS_USED: { ASSERT_TRUE(prerender_contents != NULL); if (call_javascript_) { bool prerender_test_result = false; ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( prerender_contents->render_view_host(), L"""", L""window.domAutomationController.send(DidPrerenderPass())"", &prerender_test_result)); EXPECT_TRUE(prerender_test_result); } break; } default: EXPECT_TRUE(prerender_contents == NULL); break; } } ",0 "static void virgl_cmd_create_resource_3d(VirtIOGPU *g, struct virtio_gpu_ctrl_command *cmd) { struct virtio_gpu_resource_create_3d c3d; struct virgl_renderer_resource_create_args args; VIRTIO_GPU_FILL_CMD(c3d); trace_virtio_gpu_cmd_res_create_3d(c3d.resource_id, c3d.format, c3d.width, c3d.height, c3d.depth); args.handle = c3d.resource_id; args.target = c3d.target; args.format = c3d.format; args.bind = c3d.bind; args.width = c3d.width; args.height = c3d.height; args.depth = c3d.depth; args.array_size = c3d.array_size; args.last_level = c3d.last_level; args.nr_samples = c3d.nr_samples; args.flags = c3d.flags; virgl_renderer_resource_create(&args, NULL, 0); } ",0 " favicon::MockFaviconService* favicon_service() { return mock_favicon_service_.get(); } ",0 "static int aesni_cbc_hmac_sha1_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr) { EVP_AES_HMAC_SHA1 *key = data(ctx); switch (type) { case EVP_CTRL_AEAD_SET_MAC_KEY: { unsigned int i; unsigned char hmac_key[64]; memset(hmac_key, 0, sizeof(hmac_key)); if (arg > (int)sizeof(hmac_key)) { SHA1_Init(&key->head); SHA1_Update(&key->head, ptr, arg); SHA1_Final(hmac_key, &key->head); } else { memcpy(hmac_key, ptr, arg); } for (i = 0; i < sizeof(hmac_key); i++) hmac_key[i] ^= 0x36; /* ipad */ SHA1_Init(&key->head); SHA1_Update(&key->head, hmac_key, sizeof(hmac_key)); for (i = 0; i < sizeof(hmac_key); i++) hmac_key[i] ^= 0x36 ^ 0x5c; /* opad */ SHA1_Init(&key->tail); SHA1_Update(&key->tail, hmac_key, sizeof(hmac_key)); OPENSSL_cleanse(hmac_key, sizeof(hmac_key)); return 1; } case EVP_CTRL_AEAD_TLS1_AAD: { unsigned char *p = ptr; unsigned int len; if (arg != EVP_AEAD_TLS1_AAD_LEN) return -1; len = p[arg - 2] << 8 | p[arg - 1]; if (ctx->encrypt) { key->payload_length = len; if ((key->aux.tls_ver = p[arg - 4] << 8 | p[arg - 3]) >= TLS1_1_VERSION) { len -= AES_BLOCK_SIZE; p[arg - 2] = len >> 8; p[arg - 1] = len; } key->md = key->head; SHA1_Update(&key->md, p, arg); return (int)(((len + SHA_DIGEST_LENGTH + AES_BLOCK_SIZE) & -AES_BLOCK_SIZE) - len); } else { memcpy(key->aux.tls_aad, ptr, arg); key->payload_length = arg; return SHA_DIGEST_LENGTH; } } # if !defined(OPENSSL_NO_MULTIBLOCK) && EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK case EVP_CTRL_TLS1_1_MULTIBLOCK_MAX_BUFSIZE: return (int)(5 + 16 + ((arg + 20 + 16) & -16)); case EVP_CTRL_TLS1_1_MULTIBLOCK_AAD: { EVP_CTRL_TLS1_1_MULTIBLOCK_PARAM *param = (EVP_CTRL_TLS1_1_MULTIBLOCK_PARAM *) ptr; unsigned int n4x = 1, x4; unsigned int frag, last, packlen, inp_len; if (arg < (int)sizeof(EVP_CTRL_TLS1_1_MULTIBLOCK_PARAM)) return -1; inp_len = param->inp[11] << 8 | param->inp[12]; if (ctx->encrypt) { if ((param->inp[9] << 8 | param->inp[10]) < TLS1_1_VERSION) return -1; if (inp_len) { if (inp_len < 4096) return 0; /* too short */ if (inp_len >= 8192 && OPENSSL_ia32cap_P[2] & (1 << 5)) n4x = 2; /* AVX2 */ } else if ((n4x = param->interleave / 4) && n4x <= 2) inp_len = param->len; else return -1; key->md = key->head; SHA1_Update(&key->md, param->inp, 13); x4 = 4 * n4x; n4x += 1; frag = inp_len >> n4x; last = inp_len + frag - (frag << n4x); if (last > frag && ((last + 13 + 9) % 64 < (x4 - 1))) { frag++; last -= x4 - 1; } packlen = 5 + 16 + ((frag + 20 + 16) & -16); packlen = (packlen << n4x) - packlen; packlen += 5 + 16 + ((last + 20 + 16) & -16); param->interleave = x4; return (int)packlen; } else return -1; /* not yet */ } case EVP_CTRL_TLS1_1_MULTIBLOCK_ENCRYPT: { EVP_CTRL_TLS1_1_MULTIBLOCK_PARAM *param = (EVP_CTRL_TLS1_1_MULTIBLOCK_PARAM *) ptr; return (int)tls1_1_multi_block_encrypt(key, param->out, param->inp, param->len, param->interleave / 4); } case EVP_CTRL_TLS1_1_MULTIBLOCK_DECRYPT: # endif default: return -1; } } ",0 "kg_set_ccache_name (OM_uint32 *minor_status, const char *name) { char *new_name = NULL; char *swap = NULL; char *kg_ccache_name; krb5_error_code kerr; if (name) { new_name = strdup(name); if (new_name == NULL) { *minor_status = ENOMEM; return GSS_S_FAILURE; } } kg_ccache_name = k5_getspecific(K5_KEY_GSS_KRB5_CCACHE_NAME); swap = kg_ccache_name; kg_ccache_name = new_name; new_name = swap; kerr = k5_setspecific(K5_KEY_GSS_KRB5_CCACHE_NAME, kg_ccache_name); if (kerr != 0) { /* Can't store, so free up the storage. */ free(kg_ccache_name); /* ??? free(new_name); */ *minor_status = kerr; return GSS_S_FAILURE; } free (new_name); *minor_status = 0; return GSS_S_COMPLETE; } ",0 "int DH_compute_key_padded(unsigned char *key, const BIGNUM *pub_key, DH *dh) { int rv, pad; rv = dh->meth->compute_key(key, pub_key, dh); if (rv <= 0) return rv; pad = BN_num_bytes(dh->p) - rv; if (pad > 0) { memmove(key + pad, key, rv); memset(key, 0, pad); } return rv + pad; } ",0 "ContentSetting GetSettingFromDownloadStatus( DownloadRequestLimiter::DownloadStatus status) { switch (status) { case DownloadRequestLimiter::ALLOW_ONE_DOWNLOAD: case DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD: return CONTENT_SETTING_ASK; case DownloadRequestLimiter::ALLOW_ALL_DOWNLOADS: return CONTENT_SETTING_ALLOW; case DownloadRequestLimiter::DOWNLOADS_NOT_ALLOWED: return CONTENT_SETTING_BLOCK; } NOTREACHED(); return CONTENT_SETTING_DEFAULT; } ",0 "static int ptrace_sethbpregs(struct task_struct *tsk, long num, unsigned long __user *data) { int idx, gen_len, gen_type, implied_type, ret = 0; u32 user_val; struct perf_event *bp; struct arch_hw_breakpoint_ctrl ctrl; struct perf_event_attr attr; if (num == 0) goto out; else if (num < 0) implied_type = HW_BREAKPOINT_RW; else implied_type = HW_BREAKPOINT_X; idx = ptrace_hbp_num_to_idx(num); if (idx < 0 || idx >= ARM_MAX_HBP_SLOTS) { ret = -EINVAL; goto out; } if (get_user(user_val, data)) { ret = -EFAULT; goto out; } bp = tsk->thread.debug.hbp[idx]; if (!bp) { bp = ptrace_hbp_create(tsk, implied_type); if (IS_ERR(bp)) { ret = PTR_ERR(bp); goto out; } tsk->thread.debug.hbp[idx] = bp; } attr = bp->attr; if (num & 0x1) { /* Address */ attr.bp_addr = user_val; } else { /* Control */ decode_ctrl_reg(user_val, &ctrl); ret = arch_bp_generic_fields(ctrl, &gen_len, &gen_type); if (ret) goto out; if ((gen_type & implied_type) != gen_type) { ret = -EINVAL; goto out; } attr.bp_len = gen_len; attr.bp_type = gen_type; attr.disabled = !ctrl.enabled; } ret = modify_user_hw_breakpoint(bp, &attr); out: return ret; } ",0 "static int read_spaninfo(struct mschm_decompressor_p *self, struct mschmd_sec_mscompressed *sec, off_t *length_ptr) { struct mspack_system *sys = self->system; unsigned char *data; /* find SpanInfo file */ int err = find_sys_file(self, sec, &sec->spaninfo, spaninfo_name); if (err) return MSPACK_ERR_DATAFORMAT; /* check it's large enough */ if (sec->spaninfo->length != 8) { D((""SpanInfo file is wrong size"")) return MSPACK_ERR_DATAFORMAT; } /* read the SpanInfo file */ if (!(data = read_sys_file(self, sec->spaninfo))) { D((""can't read SpanInfo file"")) return self->error; } /* get the uncompressed length of the LZX stream */ err = read_off64(length_ptr, data, sys, self->d->infh); sys->free(data); if (err) return MSPACK_ERR_DATAFORMAT; if (*length_ptr <= 0) { D((""output length is invalid"")) return MSPACK_ERR_DATAFORMAT; } return MSPACK_ERR_OK; } ",0 "int phar_parse_zipfile(php_stream *fp, char *fname, int fname_len, char *alias, int alias_len, phar_archive_data** pphar, char **error) /* {{{ */ { phar_zip_dir_end locator; char buf[sizeof(locator) + 65536]; zend_long size; php_uint16 i; phar_archive_data *mydata = NULL; phar_entry_info entry = {0}; char *p = buf, *ext, *actual_alias = NULL; char *metadata = NULL; size = php_stream_tell(fp); if (size > sizeof(locator) + 65536) { /* seek to max comment length + end of central directory record */ size = sizeof(locator) + 65536; if (FAILURE == php_stream_seek(fp, -size, SEEK_END)) { php_stream_close(fp); if (error) { spprintf(error, 4096, ""phar error: unable to search for end of central directory in zip-based phar \""%s\"""", fname); } return FAILURE; } } else { php_stream_seek(fp, 0, SEEK_SET); } if (!php_stream_read(fp, buf, size)) { php_stream_close(fp); if (error) { spprintf(error, 4096, ""phar error: unable to read in data to search for end of central directory in zip-based phar \""%s\"""", fname); } return FAILURE; } while ((p=(char *) memchr(p + 1, 'P', (size_t) (size - (p + 1 - buf)))) != NULL) { if ((p - buf) + sizeof(locator) <= size && !memcmp(p + 1, ""K\5\6"", 3)) { memcpy((void *)&locator, (void *) p, sizeof(locator)); if (PHAR_GET_16(locator.centraldisk) != 0 || PHAR_GET_16(locator.disknumber) != 0) { /* split archives not handled */ php_stream_close(fp); if (error) { spprintf(error, 4096, ""phar error: split archives spanning multiple zips cannot be processed in zip-based phar \""%s\"""", fname); } return FAILURE; } if (PHAR_GET_16(locator.counthere) != PHAR_GET_16(locator.count)) { if (error) { spprintf(error, 4096, ""phar error: corrupt zip archive, conflicting file count in end of central directory record in zip-based phar \""%s\"""", fname); } php_stream_close(fp); return FAILURE; } mydata = pecalloc(1, sizeof(phar_archive_data), PHAR_G(persist)); mydata->is_persistent = PHAR_G(persist); /* read in archive comment, if any */ if (PHAR_GET_16(locator.comment_len)) { metadata = p + sizeof(locator); if (PHAR_GET_16(locator.comment_len) != size - (metadata - buf)) { if (error) { spprintf(error, 4096, ""phar error: corrupt zip archive, zip file comment truncated in zip-based phar \""%s\"""", fname); } php_stream_close(fp); pefree(mydata, mydata->is_persistent); return FAILURE; } mydata->metadata_len = PHAR_GET_16(locator.comment_len); if (phar_parse_metadata(&metadata, &mydata->metadata, PHAR_GET_16(locator.comment_len)) == FAILURE) { mydata->metadata_len = 0; /* if not valid serialized data, it is a regular string */ ZVAL_NEW_STR(&mydata->metadata, zend_string_init(metadata, PHAR_GET_16(locator.comment_len), mydata->is_persistent)); } } else { ZVAL_UNDEF(&mydata->metadata); } goto foundit; } } php_stream_close(fp); if (error) { spprintf(error, 4096, ""phar error: end of central directory not found in zip-based phar \""%s\"""", fname); } return FAILURE; foundit: mydata->fname = pestrndup(fname, fname_len, mydata->is_persistent); #ifdef PHP_WIN32 phar_unixify_path_separators(mydata->fname, fname_len); #endif mydata->is_zip = 1; mydata->fname_len = fname_len; ext = strrchr(mydata->fname, '/'); if (ext) { mydata->ext = memchr(ext, '.', (mydata->fname + fname_len) - ext); if (mydata->ext == ext) { mydata->ext = memchr(ext + 1, '.', (mydata->fname + fname_len) - ext - 1); } if (mydata->ext) { mydata->ext_len = (mydata->fname + fname_len) - mydata->ext; } } /* clean up on big-endian systems */ /* seek to central directory */ php_stream_seek(fp, PHAR_GET_32(locator.cdir_offset), SEEK_SET); /* read in central directory */ zend_hash_init(&mydata->manifest, PHAR_GET_16(locator.count), zend_get_hash_value, destroy_phar_manifest_entry, (zend_bool)mydata->is_persistent); zend_hash_init(&mydata->mounted_dirs, 5, zend_get_hash_value, NULL, (zend_bool)mydata->is_persistent); zend_hash_init(&mydata->virtual_dirs, PHAR_GET_16(locator.count) * 2, zend_get_hash_value, NULL, (zend_bool)mydata->is_persistent); entry.phar = mydata; entry.is_zip = 1; entry.fp_type = PHAR_FP; entry.is_persistent = mydata->is_persistent; #define PHAR_ZIP_FAIL_FREE(errmsg, save) \ zend_hash_destroy(&mydata->manifest); \ mydata->manifest.u.flags = 0; \ zend_hash_destroy(&mydata->mounted_dirs); \ mydata->mounted_dirs.u.flags = 0; \ zend_hash_destroy(&mydata->virtual_dirs); \ mydata->virtual_dirs.u.flags = 0; \ php_stream_close(fp); \ zval_dtor(&mydata->metadata); \ if (mydata->signature) { \ efree(mydata->signature); \ } \ if (error) { \ spprintf(error, 4096, ""phar error: %s in zip-based phar \""%s\"""", errmsg, mydata->fname); \ } \ pefree(mydata->fname, mydata->is_persistent); \ if (mydata->alias) { \ pefree(mydata->alias, mydata->is_persistent); \ } \ pefree(mydata, mydata->is_persistent); \ efree(save); \ return FAILURE; #define PHAR_ZIP_FAIL(errmsg) \ zend_hash_destroy(&mydata->manifest); \ mydata->manifest.u.flags = 0; \ zend_hash_destroy(&mydata->mounted_dirs); \ mydata->mounted_dirs.u.flags = 0; \ zend_hash_destroy(&mydata->virtual_dirs); \ mydata->virtual_dirs.u.flags = 0; \ php_stream_close(fp); \ zval_dtor(&mydata->metadata); \ if (mydata->signature) { \ efree(mydata->signature); \ } \ if (error) { \ spprintf(error, 4096, ""phar error: %s in zip-based phar \""%s\"""", errmsg, mydata->fname); \ } \ pefree(mydata->fname, mydata->is_persistent); \ if (mydata->alias) { \ pefree(mydata->alias, mydata->is_persistent); \ } \ pefree(mydata, mydata->is_persistent); \ return FAILURE; /* add each central directory item to the manifest */ for (i = 0; i < PHAR_GET_16(locator.count); ++i) { phar_zip_central_dir_file zipentry; zend_off_t beforeus = php_stream_tell(fp); if (sizeof(zipentry) != php_stream_read(fp, (char *) &zipentry, sizeof(zipentry))) { PHAR_ZIP_FAIL(""unable to read central directory entry, truncated""); } /* clean up for bigendian systems */ if (memcmp(""PK\1\2"", zipentry.signature, 4)) { /* corrupted entry */ PHAR_ZIP_FAIL(""corrupted central directory entry, no magic signature""); } if (entry.is_persistent) { entry.manifest_pos = i; } entry.compressed_filesize = PHAR_GET_32(zipentry.compsize); entry.uncompressed_filesize = PHAR_GET_32(zipentry.uncompsize); entry.crc32 = PHAR_GET_32(zipentry.crc32); /* do not PHAR_GET_16 either on the next line */ entry.timestamp = phar_zip_d2u_time(zipentry.timestamp, zipentry.datestamp); entry.flags = PHAR_ENT_PERM_DEF_FILE; entry.header_offset = PHAR_GET_32(zipentry.offset); entry.offset = entry.offset_abs = PHAR_GET_32(zipentry.offset) + sizeof(phar_zip_file_header) + PHAR_GET_16(zipentry.filename_len) + PHAR_GET_16(zipentry.extra_len); if (PHAR_GET_16(zipentry.flags) & PHAR_ZIP_FLAG_ENCRYPTED) { PHAR_ZIP_FAIL(""Cannot process encrypted zip files""); } if (!PHAR_GET_16(zipentry.filename_len)) { PHAR_ZIP_FAIL(""Cannot process zips created from stdin (zero-length filename)""); } entry.filename_len = PHAR_GET_16(zipentry.filename_len); entry.filename = (char *) pemalloc(entry.filename_len + 1, entry.is_persistent); if (entry.filename_len != php_stream_read(fp, entry.filename, entry.filename_len)) { pefree(entry.filename, entry.is_persistent); PHAR_ZIP_FAIL(""unable to read in filename from central directory, truncated""); } entry.filename[entry.filename_len] = '\0'; if (entry.filename[entry.filename_len - 1] == '/') { entry.is_dir = 1; if(entry.filename_len > 1) { entry.filename_len--; } entry.flags |= PHAR_ENT_PERM_DEF_DIR; } else { entry.is_dir = 0; } if (entry.filename_len == sizeof("".phar/signature.bin"")-1 && !strncmp(entry.filename, "".phar/signature.bin"", sizeof("".phar/signature.bin"")-1)) { size_t read; php_stream *sigfile; zend_off_t now; char *sig; now = php_stream_tell(fp); pefree(entry.filename, entry.is_persistent); sigfile = php_stream_fopen_tmpfile(); if (!sigfile) { PHAR_ZIP_FAIL(""couldn't open temporary file""); } php_stream_seek(fp, 0, SEEK_SET); /* copy file contents + local headers and zip comment, if any, to be hashed for signature */ php_stream_copy_to_stream_ex(fp, sigfile, entry.header_offset, NULL); /* seek to central directory */ php_stream_seek(fp, PHAR_GET_32(locator.cdir_offset), SEEK_SET); /* copy central directory header */ php_stream_copy_to_stream_ex(fp, sigfile, beforeus - PHAR_GET_32(locator.cdir_offset), NULL); if (metadata) { php_stream_write(sigfile, metadata, PHAR_GET_16(locator.comment_len)); } php_stream_seek(fp, sizeof(phar_zip_file_header) + entry.header_offset + entry.filename_len + PHAR_GET_16(zipentry.extra_len), SEEK_SET); sig = (char *) emalloc(entry.uncompressed_filesize); read = php_stream_read(fp, sig, entry.uncompressed_filesize); if (read != entry.uncompressed_filesize) { php_stream_close(sigfile); efree(sig); PHAR_ZIP_FAIL(""signature cannot be read""); } mydata->sig_flags = PHAR_GET_32(sig); if (FAILURE == phar_verify_signature(sigfile, php_stream_tell(sigfile), mydata->sig_flags, sig + 8, entry.uncompressed_filesize - 8, fname, &mydata->signature, &mydata->sig_len, error)) { efree(sig); if (error) { char *save; php_stream_close(sigfile); spprintf(&save, 4096, ""signature cannot be verified: %s"", *error); efree(*error); PHAR_ZIP_FAIL_FREE(save, save); } else { php_stream_close(sigfile); PHAR_ZIP_FAIL(""signature cannot be verified""); } } php_stream_close(sigfile); efree(sig); /* signature checked out, let's ensure this is the last file in the phar */ if (i != PHAR_GET_16(locator.count) - 1) { PHAR_ZIP_FAIL(""entries exist after signature, invalid phar""); } continue; } phar_add_virtual_dirs(mydata, entry.filename, entry.filename_len); if (PHAR_GET_16(zipentry.extra_len)) { zend_off_t loc = php_stream_tell(fp); if (FAILURE == phar_zip_process_extra(fp, &entry, PHAR_GET_16(zipentry.extra_len))) { pefree(entry.filename, entry.is_persistent); PHAR_ZIP_FAIL(""Unable to process extra field header for file in central directory""); } php_stream_seek(fp, loc + PHAR_GET_16(zipentry.extra_len), SEEK_SET); } switch (PHAR_GET_16(zipentry.compressed)) { case PHAR_ZIP_COMP_NONE : /* compression flag already set */ break; case PHAR_ZIP_COMP_DEFLATE : entry.flags |= PHAR_ENT_COMPRESSED_GZ; if (!PHAR_G(has_zlib)) { pefree(entry.filename, entry.is_persistent); PHAR_ZIP_FAIL(""zlib extension is required""); } break; case PHAR_ZIP_COMP_BZIP2 : entry.flags |= PHAR_ENT_COMPRESSED_BZ2; if (!PHAR_G(has_bz2)) { pefree(entry.filename, entry.is_persistent); PHAR_ZIP_FAIL(""bzip2 extension is required""); } break; case 1 : pefree(entry.filename, entry.is_persistent); PHAR_ZIP_FAIL(""unsupported compression method (Shrunk) used in this zip""); case 2 : case 3 : case 4 : case 5 : pefree(entry.filename, entry.is_persistent); PHAR_ZIP_FAIL(""unsupported compression method (Reduce) used in this zip""); case 6 : pefree(entry.filename, entry.is_persistent); PHAR_ZIP_FAIL(""unsupported compression method (Implode) used in this zip""); case 7 : pefree(entry.filename, entry.is_persistent); PHAR_ZIP_FAIL(""unsupported compression method (Tokenize) used in this zip""); case 9 : pefree(entry.filename, entry.is_persistent); PHAR_ZIP_FAIL(""unsupported compression method (Deflate64) used in this zip""); case 10 : pefree(entry.filename, entry.is_persistent); PHAR_ZIP_FAIL(""unsupported compression method (PKWare Implode/old IBM TERSE) used in this zip""); case 14 : pefree(entry.filename, entry.is_persistent); PHAR_ZIP_FAIL(""unsupported compression method (LZMA) used in this zip""); case 18 : pefree(entry.filename, entry.is_persistent); PHAR_ZIP_FAIL(""unsupported compression method (IBM TERSE) used in this zip""); case 19 : pefree(entry.filename, entry.is_persistent); PHAR_ZIP_FAIL(""unsupported compression method (IBM LZ77) used in this zip""); case 97 : pefree(entry.filename, entry.is_persistent); PHAR_ZIP_FAIL(""unsupported compression method (WavPack) used in this zip""); case 98 : pefree(entry.filename, entry.is_persistent); PHAR_ZIP_FAIL(""unsupported compression method (PPMd) used in this zip""); default : pefree(entry.filename, entry.is_persistent); PHAR_ZIP_FAIL(""unsupported compression method (unknown) used in this zip""); } /* get file metadata */ if (PHAR_GET_16(zipentry.comment_len)) { if (PHAR_GET_16(zipentry.comment_len) != php_stream_read(fp, buf, PHAR_GET_16(zipentry.comment_len))) { pefree(entry.filename, entry.is_persistent); PHAR_ZIP_FAIL(""unable to read in file comment, truncated""); } p = buf; entry.metadata_len = PHAR_GET_16(zipentry.comment_len); if (phar_parse_metadata(&p, &(entry.metadata), PHAR_GET_16(zipentry.comment_len)) == FAILURE) { entry.metadata_len = 0; /* if not valid serialized data, it is a regular string */ ZVAL_NEW_STR(&entry.metadata, zend_string_init(buf, PHAR_GET_16(zipentry.comment_len), entry.is_persistent)); } } else { ZVAL_UNDEF(&entry.metadata); } if (!actual_alias && entry.filename_len == sizeof("".phar/alias.txt"")-1 && !strncmp(entry.filename, "".phar/alias.txt"", sizeof("".phar/alias.txt"")-1)) { php_stream_filter *filter; zend_off_t saveloc; /* verify local file header */ phar_zip_file_header local; /* archive alias found */ saveloc = php_stream_tell(fp); php_stream_seek(fp, PHAR_GET_32(zipentry.offset), SEEK_SET); if (sizeof(local) != php_stream_read(fp, (char *) &local, sizeof(local))) { pefree(entry.filename, entry.is_persistent); PHAR_ZIP_FAIL(""phar error: internal corruption of zip-based phar (cannot read local file header for alias)""); } /* verify local header */ if (entry.filename_len != PHAR_GET_16(local.filename_len) || entry.crc32 != PHAR_GET_32(local.crc32) || entry.uncompressed_filesize != PHAR_GET_32(local.uncompsize) || entry.compressed_filesize != PHAR_GET_32(local.compsize)) { pefree(entry.filename, entry.is_persistent); PHAR_ZIP_FAIL(""phar error: internal corruption of zip-based phar (local header of alias does not match central directory)""); } /* construct actual offset to file start - local extra_len can be different from central extra_len */ entry.offset = entry.offset_abs = sizeof(local) + entry.header_offset + PHAR_GET_16(local.filename_len) + PHAR_GET_16(local.extra_len); php_stream_seek(fp, entry.offset, SEEK_SET); /* these next lines should be for php < 5.2.6 after 5.3 filters are fixed */ fp->writepos = 0; fp->readpos = 0; php_stream_seek(fp, entry.offset, SEEK_SET); fp->writepos = 0; fp->readpos = 0; /* the above lines should be for php < 5.2.6 after 5.3 filters are fixed */ mydata->alias_len = entry.uncompressed_filesize; if (entry.flags & PHAR_ENT_COMPRESSED_GZ) { filter = php_stream_filter_create(""zlib.inflate"", NULL, php_stream_is_persistent(fp)); if (!filter) { pefree(entry.filename, entry.is_persistent); PHAR_ZIP_FAIL(""unable to decompress alias, zlib filter creation failed""); } php_stream_filter_append(&fp->readfilters, filter); { zend_string *str = php_stream_copy_to_mem(fp, entry.uncompressed_filesize, 0); if (str) { entry.uncompressed_filesize = ZSTR_LEN(str); actual_alias = estrndup(ZSTR_VAL(str), ZSTR_LEN(str)); zend_string_release(str); } else { actual_alias = NULL; entry.uncompressed_filesize = 0; } } if (!entry.uncompressed_filesize || !actual_alias) { pefree(entry.filename, entry.is_persistent); PHAR_ZIP_FAIL(""unable to read in alias, truncated""); } php_stream_filter_flush(filter, 1); php_stream_filter_remove(filter, 1); } else if (entry.flags & PHAR_ENT_COMPRESSED_BZ2) { filter = php_stream_filter_create(""bzip2.decompress"", NULL, php_stream_is_persistent(fp)); if (!filter) { pefree(entry.filename, entry.is_persistent); PHAR_ZIP_FAIL(""unable to read in alias, bzip2 filter creation failed""); } php_stream_filter_append(&fp->readfilters, filter); { zend_string *str = php_stream_copy_to_mem(fp, entry.uncompressed_filesize, 0); if (str) { entry.uncompressed_filesize = ZSTR_LEN(str); actual_alias = estrndup(ZSTR_VAL(str), ZSTR_LEN(str)); zend_string_release(str); } else { actual_alias = NULL; entry.uncompressed_filesize = 0; } } if (!entry.uncompressed_filesize || !actual_alias) { pefree(entry.filename, entry.is_persistent); PHAR_ZIP_FAIL(""unable to read in alias, truncated""); } php_stream_filter_flush(filter, 1); php_stream_filter_remove(filter, 1); } else { { zend_string *str = php_stream_copy_to_mem(fp, entry.uncompressed_filesize, 0); if (str) { entry.uncompressed_filesize = ZSTR_LEN(str); actual_alias = estrndup(ZSTR_VAL(str), ZSTR_LEN(str)); zend_string_release(str); } else { actual_alias = NULL; entry.uncompressed_filesize = 0; } } if (!entry.uncompressed_filesize || !actual_alias) { pefree(entry.filename, entry.is_persistent); PHAR_ZIP_FAIL(""unable to read in alias, truncated""); } } /* return to central directory parsing */ php_stream_seek(fp, saveloc, SEEK_SET); } phar_set_inode(&entry); zend_hash_str_add_mem(&mydata->manifest, entry.filename, entry.filename_len, (void *)&entry, sizeof(phar_entry_info)); } mydata->fp = fp; if (zend_hash_str_exists(&(mydata->manifest), "".phar/stub.php"", sizeof("".phar/stub.php"")-1)) { mydata->is_data = 0; } else { mydata->is_data = 1; } zend_hash_str_add_ptr(&(PHAR_G(phar_fname_map)), mydata->fname, fname_len, mydata); if (actual_alias) { phar_archive_data *fd_ptr; if (!phar_validate_alias(actual_alias, mydata->alias_len)) { if (error) { spprintf(error, 4096, ""phar error: invalid alias \""%s\"" in zip-based phar \""%s\"""", actual_alias, fname); } efree(actual_alias); zend_hash_str_del(&(PHAR_G(phar_fname_map)), mydata->fname, fname_len); return FAILURE; } mydata->is_temporary_alias = 0; if (NULL != (fd_ptr = zend_hash_str_find_ptr(&(PHAR_G(phar_alias_map)), actual_alias, mydata->alias_len))) { if (SUCCESS != phar_free_alias(fd_ptr, actual_alias, mydata->alias_len)) { if (error) { spprintf(error, 4096, ""phar error: Unable to add zip-based phar \""%s\"" with implicit alias, alias is already in use"", fname); } efree(actual_alias); zend_hash_str_del(&(PHAR_G(phar_fname_map)), mydata->fname, fname_len); return FAILURE; } } mydata->alias = entry.is_persistent ? pestrndup(actual_alias, mydata->alias_len, 1) : actual_alias; if (entry.is_persistent) { efree(actual_alias); } zend_hash_str_add_ptr(&(PHAR_G(phar_alias_map)), actual_alias, mydata->alias_len, mydata); } else { phar_archive_data *fd_ptr; if (alias_len) { if (NULL != (fd_ptr = zend_hash_str_find_ptr(&(PHAR_G(phar_alias_map)), alias, alias_len))) { if (SUCCESS != phar_free_alias(fd_ptr, alias, alias_len)) { if (error) { spprintf(error, 4096, ""phar error: Unable to add zip-based phar \""%s\"" with explicit alias, alias is already in use"", fname); } zend_hash_str_del(&(PHAR_G(phar_fname_map)), mydata->fname, fname_len); return FAILURE; } } zend_hash_str_add_ptr(&(PHAR_G(phar_alias_map)), actual_alias, mydata->alias_len, mydata); mydata->alias = pestrndup(alias, alias_len, mydata->is_persistent); mydata->alias_len = alias_len; } else { mydata->alias = pestrndup(mydata->fname, fname_len, mydata->is_persistent); mydata->alias_len = fname_len; } mydata->is_temporary_alias = 1; } if (pphar) { *pphar = mydata; } return SUCCESS; } /* }}} */ ",1 "void kvm_complete_insn_gp(struct kvm_vcpu *vcpu, int err) { if (err) kvm_inject_gp(vcpu, 0); else kvm_x86_ops->skip_emulated_instruction(vcpu); } ",0 "put_ofp14_queue_rate(struct ofpbuf *reply, enum ofp14_queue_desc_prop_type type, uint16_t rate) { if (rate != UINT16_MAX) { ofpprop_put_u16(reply, type, rate); } } ",0 "void WallpaperManager::SetDefaultWallpaperPath( const base::FilePath& default_small_wallpaper_file, std::unique_ptr small_wallpaper_image, const base::FilePath& default_large_wallpaper_file, std::unique_ptr large_wallpaper_image) { default_small_wallpaper_file_ = default_small_wallpaper_file; default_large_wallpaper_file_ = default_large_wallpaper_file; ash::WallpaperController* controller = ash::Shell::Get()->wallpaper_controller(); const bool need_update_screen = default_wallpaper_image_.get() && controller->WallpaperIsAlreadyLoaded(default_wallpaper_image_->image(), false /* compare_layouts */, wallpaper::WALLPAPER_LAYOUT_CENTER); default_wallpaper_image_.reset(); if (GetAppropriateResolution() == WALLPAPER_RESOLUTION_SMALL) { if (small_wallpaper_image) { default_wallpaper_image_.reset( new user_manager::UserImage(*small_wallpaper_image)); default_wallpaper_image_->set_file_path(default_small_wallpaper_file); } } else { if (large_wallpaper_image) { default_wallpaper_image_.reset( new user_manager::UserImage(*large_wallpaper_image)); default_wallpaper_image_->set_file_path(default_large_wallpaper_file); } } if (need_update_screen) DoSetDefaultWallpaper(EmptyAccountId(), MovableOnDestroyCallbackHolder()); } ",1 "static void pit_latch_count(struct kvm *kvm, int channel) { struct kvm_kpit_channel_state *c = &kvm->arch.vpit->pit_state.channels[channel]; WARN_ON(!mutex_is_locked(&kvm->arch.vpit->pit_state.lock)); if (!c->count_latched) { c->latched_count = pit_get_count(kvm, channel); c->count_latched = c->rw_mode; } } ",0 " CastSelectDefaultView* select_view() { return select_view_; } ",0 "_archive_write_free(struct archive *_a) { struct archive_write *a = (struct archive_write *)_a; int r = ARCHIVE_OK, r1; if (_a == NULL) return (ARCHIVE_OK); /* It is okay to call free() in state FATAL. */ archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC, ARCHIVE_STATE_ANY | ARCHIVE_STATE_FATAL, ""archive_write_free""); if (a->archive.state != ARCHIVE_STATE_FATAL) r = archive_write_close(&a->archive); /* Release format resources. */ if (a->format_free != NULL) { r1 = (a->format_free)(a); if (r1 < r) r = r1; } __archive_write_filters_free(_a); /* Release various dynamic buffers. */ free((void *)(uintptr_t)(const void *)a->nulls); archive_string_free(&a->archive.error_string); a->archive.magic = 0; __archive_clean(&a->archive); free(a); return (r); } ",0 "static int irda_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) { /* * All IRDA's ioctl are standard ones. */ return -ENOIOCTLCMD; } ",0 "static int numa_maps_open(struct inode *inode, struct file *file) { struct numa_maps_private *priv; int ret = -ENOMEM; priv = kzalloc(sizeof(*priv), GFP_KERNEL); if (priv) { priv->proc_maps.pid = proc_pid(inode); ret = seq_open(file, &proc_pid_numa_maps_op); if (!ret) { struct seq_file *m = file->private_data; m->private = priv; } else { kfree(priv); } } return ret; } ",0 "String8& String8::appendPath(const char* name) { if (name[0] != OS_PATH_SEPARATOR) { if (*name == '\0') { return *this; } size_t len = length(); if (len == 0) { setPathName(name); return *this; } int newlen = strlen(name); char* buf = lockBuffer(len+1+newlen); if (buf[len-1] != OS_PATH_SEPARATOR) buf[len++] = OS_PATH_SEPARATOR; memcpy(buf+len, name, newlen+1); len += newlen; unlockBuffer(len); return *this; } else { setPathName(name); return *this; } } ",0 "void V8TestObject::IndexedPropertyGetterCallback( uint32_t index, const v8::PropertyCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_IndexedPropertyGetter""); test_object_v8_internal::IndexedPropertyGetter(index, info); } ",0 "void GfxPath::append(GfxPath *path) { int i; if (n + path->n > size) { size = n + path->n; subpaths = (GfxSubpath **) greallocn(subpaths, size, sizeof(GfxSubpath *)); } for (i = 0; i < path->n; ++i) { subpaths[n++] = path->subpaths[i]->copy(); } justMoved = gFalse; } ",0 "bool RenderViewImpl::MaybeLoadAlternateErrorPage(WebFrame* frame, const WebURLError& error, bool replace) { if (frame->parent()) return false; int ec = error.reason; if (ec != net::ERR_NAME_NOT_RESOLVED && ec != net::ERR_CONNECTION_FAILED && ec != net::ERR_CONNECTION_REFUSED && ec != net::ERR_ADDRESS_UNREACHABLE && ec != net::ERR_CONNECTION_TIMED_OUT) { return false; } const GURL& error_page_url = GetAlternateErrorPageURL(error.unreachableURL, ec == net::ERR_NAME_NOT_RESOLVED ? DNS_ERROR : CONNECTION_ERROR); if (!error_page_url.is_valid()) return false; frame->loadHTMLString(std::string(), GURL(chrome::kUnreachableWebDataURL), error.unreachableURL, replace); DocumentState* document_state = DocumentState::FromDataSource(frame->provisionalDataSource()); document_state->set_alt_error_page_fetcher( new AltErrorPageResourceFetcher( error_page_url, frame, error, base::Bind(&RenderViewImpl::AltErrorPageFinished, base::Unretained(this)))); return true; } ",0 "std::string ContentBrowserClient::GetWorkerProcessTitle( const GURL& url, ResourceContext* context) { return std::string(); } ",0 "static inline int fb_prepare_extra_logos(struct fb_info *info, unsigned int height, unsigned int yres) { return height; } ",0 "static void TIFFWarnings(const char *module,const char *format,va_list warning) { char message[MagickPathExtent]; ExceptionInfo *exception; #if defined(MAGICKCORE_HAVE_VSNPRINTF) (void) vsnprintf(message,MagickPathExtent-2,format,warning); #else (void) vsprintf(message,format,warning); #endif message[MaxTextExtent-2]='\0'; (void) ConcatenateMagickString(message,""."",MagickPathExtent); exception=(ExceptionInfo *) GetMagickThreadValue(tiff_exception); if (exception != (ExceptionInfo *) NULL) (void) ThrowMagickException(exception,GetMagickModule(),CoderWarning, message,""`%s'"",module); } ",0 "static int em_lldt(struct x86_emulate_ctxt *ctxt) { u16 sel = ctxt->src.val; /* Disable writeback. */ ctxt->dst.type = OP_NONE; return load_segment_descriptor(ctxt, sel, VCPU_SREG_LDTR); } ",0 "static inline const unsigned char *ReadResourceShort(const unsigned char *p, unsigned short *quantum) { *quantum=(unsigned short) (*p++) << 8; *quantum|=(unsigned short) (*p++); return(p); } ",0 "void WebSettingsImpl::setLoadsImagesAutomatically(bool loadsImagesAutomatically) { m_settings->setLoadsImagesAutomatically(loadsImagesAutomatically); } ",0 "static void virgl_cmd_context_destroy(VirtIOGPU *g, struct virtio_gpu_ctrl_command *cmd) { struct virtio_gpu_ctx_destroy cd; VIRTIO_GPU_FILL_CMD(cd); trace_virtio_gpu_cmd_ctx_destroy(cd.hdr.ctx_id); virgl_renderer_context_destroy(cd.hdr.ctx_id); } ",0 "static BOOL update_send_bitmap_update(rdpContext* context, const BITMAP_UPDATE* bitmapUpdate) { wStream* s; rdpRdp* rdp = context->rdp; rdpUpdate* update = context->update; BOOL ret = TRUE; update_force_flush(context); s = fastpath_update_pdu_init(rdp->fastpath); if (!s) return FALSE; if (!update_write_bitmap_update(update, s, bitmapUpdate) || !fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_BITMAP, s, bitmapUpdate->skipCompression)) { ret = FALSE; goto out_fail; } update_force_flush(context); out_fail: Stream_Release(s); return ret; } ",0 "static bool is_init_done(void) { return pth != -1; } ",0 "t2p_sample_rgbaa_to_rgb(tdata_t data, uint32 samplecount) { uint32 i; /* For the 3 first samples, there is overlapping between souce and destination, so use memmove(). See http://bugzilla.maptools.org/show_bug.cgi?id=2577 */ for(i = 0; i < 3 && i < samplecount; i++) memmove((uint8*)data + i * 3, (uint8*)data + i * 4, 3); for(; i < samplecount; i++) memcpy((uint8*)data + i * 3, (uint8*)data + i * 4, 3); return(i * 3); } ",0 "static void task_clock_event_read(struct perf_event *event) { u64 now = perf_clock(); u64 delta = now - event->ctx->timestamp; u64 time = event->ctx->time + delta; task_clock_event_update(event, time); } ",0 " static void Compute_Funcs( EXEC_OP ) { if ( CUR.GS.freeVector.x == 0x4000 ) { CUR.func_freeProj = (TProject_Function)Project_x; CUR.F_dot_P = CUR.GS.projVector.x * 0x10000L; } else { if ( CUR.GS.freeVector.y == 0x4000 ) { CUR.func_freeProj = (TProject_Function)Project_y; CUR.F_dot_P = CUR.GS.projVector.y * 0x10000L; } else { CUR.func_move = (TMove_Function)Direct_Move; CUR.func_freeProj = (TProject_Function)Free_Project; CUR.F_dot_P = (Long)CUR.GS.projVector.x * CUR.GS.freeVector.x * 4 + (Long)CUR.GS.projVector.y * CUR.GS.freeVector.y * 4; } } CUR.cached_metrics = FALSE; if ( CUR.GS.projVector.x == 0x4000 ) CUR.func_project = (TProject_Function)Project_x; else { if ( CUR.GS.projVector.y == 0x4000 ) CUR.func_project = (TProject_Function)Project_y; else CUR.func_project = (TProject_Function)Project; } if ( CUR.GS.dualVector.x == 0x4000 ) CUR.func_dualproj = (TProject_Function)Project_x; else { if ( CUR.GS.dualVector.y == 0x4000 ) CUR.func_dualproj = (TProject_Function)Project_y; else CUR.func_dualproj = (TProject_Function)Dual_Project; } CUR.func_move = (TMove_Function)Direct_Move; if ( CUR.F_dot_P == 0x40000000L ) { if ( CUR.GS.freeVector.x == 0x4000 ) CUR.func_move = (TMove_Function)Direct_Move_X; else { if ( CUR.GS.freeVector.y == 0x4000 ) CUR.func_move = (TMove_Function)Direct_Move_Y; } } /* at small sizes, F_dot_P can become too small, resulting */ /* in overflows and 'spikes' in a number of glyphs like 'w'. */ if ( ABS( CUR.F_dot_P ) < 0x4000000L ) CUR.F_dot_P = 0x40000000L; /* Disable cached aspect ratio */ CUR.metrics.ratio = 0; } ",0 "void GLES2DecoderImpl::DeleteTransformFeedbacksHelper( GLsizei n, const volatile GLuint* client_ids) { for (GLsizei ii = 0; ii < n; ++ii) { GLuint client_id = client_ids[ii]; TransformFeedback* transform_feedback = GetTransformFeedback(client_id); if (transform_feedback) { if (transform_feedback->active()) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, ""glDeleteTransformFeedbacks"", ""Deleting transform feedback is active""); return; } if (state_.bound_transform_feedback.get() == transform_feedback) { DCHECK(state_.default_transform_feedback.get()); state_.default_transform_feedback->DoBindTransformFeedback( GL_TRANSFORM_FEEDBACK, state_.bound_transform_feedback.get(), state_.bound_transform_feedback_buffer.get()); state_.bound_transform_feedback = state_.default_transform_feedback.get(); } RemoveTransformFeedback(client_id); } } } ",0 "validate_sfinfo (SF_INFO *sfinfo) { if (sfinfo->samplerate < 1) return 0 ; if (sfinfo->frames < 0) return 0 ; if (sfinfo->channels < 1) return 0 ; if ((SF_CONTAINER (sfinfo->format)) == 0) return 0 ; if ((SF_CODEC (sfinfo->format)) == 0) return 0 ; if (sfinfo->sections < 1) return 0 ; return 1 ; } /* validate_sfinfo */ ",0 "static int ssl_set_version(SSL *s) { unsigned long mask, options = s->options; if (s->method->version == TLS_ANY_VERSION) { /* * SSL_OP_NO_X disables all protocols above X *if* there are * some protocols below X enabled. This is required in order * to maintain ""version capability"" vector contiguous. So * that if application wants to disable TLS1.0 in favour of * TLS1>=1, it would be insufficient to pass SSL_NO_TLSv1, the * answer is SSL_OP_NO_TLSv1|SSL_OP_NO_SSLv3. */ mask = SSL_OP_NO_TLSv1_1 | SSL_OP_NO_TLSv1 #if !defined(OPENSSL_NO_SSL3) | SSL_OP_NO_SSLv3 #endif ; #if !defined(OPENSSL_NO_TLS1_2_CLIENT) if (options & SSL_OP_NO_TLSv1_2) { if ((options & mask) != mask) { s->version = TLS1_1_VERSION; } else { SSLerr(SSL_F_SSL_SET_VERSION, SSL_R_NO_PROTOCOLS_AVAILABLE); return 0; } } else { s->version = TLS1_2_VERSION; } #else if ((options & mask) == mask) { SSLerr(SSL_F_SSL_SET_VERSION, SSL_R_NO_PROTOCOLS_AVAILABLE); return 0; } s->version = TLS1_1_VERSION; #endif mask &= ~SSL_OP_NO_TLSv1_1; if ((options & SSL_OP_NO_TLSv1_1) && (options & mask) != mask) s->version = TLS1_VERSION; mask &= ~SSL_OP_NO_TLSv1; #if !defined(OPENSSL_NO_SSL3) if ((options & SSL_OP_NO_TLSv1) && (options & mask) != mask) s->version = SSL3_VERSION; #endif if (s->version != TLS1_2_VERSION && tls1_suiteb(s)) { SSLerr(SSL_F_SSL_SET_VERSION, SSL_R_ONLY_TLS_1_2_ALLOWED_IN_SUITEB_MODE); return 0; } if (s->version == SSL3_VERSION && FIPS_mode()) { SSLerr(SSL_F_SSL_SET_VERSION, SSL_R_ONLY_TLS_ALLOWED_IN_FIPS_MODE); return 0; } } else if (s->method->version == DTLS_ANY_VERSION) { /* Determine which DTLS version to use */ /* If DTLS 1.2 disabled correct the version number */ if (options & SSL_OP_NO_DTLSv1_2) { if (tls1_suiteb(s)) { SSLerr(SSL_F_SSL_SET_VERSION, SSL_R_ONLY_DTLS_1_2_ALLOWED_IN_SUITEB_MODE); return 0; } /* * Disabling all versions is silly: return an error. */ if (options & SSL_OP_NO_DTLSv1) { SSLerr(SSL_F_SSL_SET_VERSION, SSL_R_WRONG_SSL_VERSION); return 0; } /* * Update method so we don't use any DTLS 1.2 features. */ s->method = DTLSv1_client_method(); s->version = DTLS1_VERSION; } else { /* * We only support one version: update method */ if (options & SSL_OP_NO_DTLSv1) s->method = DTLSv1_2_client_method(); s->version = DTLS1_2_VERSION; } } s->client_version = s->version; return 1; } ",0 "static int ctr_des_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) { struct s390_des_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); struct blkcipher_walk walk; blkcipher_walk_init(&walk, dst, src, nbytes); return ctr_desall_crypt(desc, KMCTR_DEA_ENCRYPT, ctx, &walk); } ",0 "rend_service_intro_established(origin_circuit_t *circuit, const uint8_t *request, size_t request_len) { rend_service_t *service; rend_intro_point_t *intro; char serviceid[REND_SERVICE_ID_LEN_BASE32+1]; (void) request; (void) request_len; tor_assert(circuit->rend_data); /* XXX: This is version 2 specific (only supported one for now). */ const char *rend_pk_digest = (char *) rend_data_get_pk_digest(circuit->rend_data, NULL); if (circuit->base_.purpose != CIRCUIT_PURPOSE_S_ESTABLISH_INTRO) { log_warn(LD_PROTOCOL, ""received INTRO_ESTABLISHED cell on non-intro circuit.""); goto err; } service = rend_service_get_by_pk_digest(rend_pk_digest); if (!service) { log_warn(LD_REND, ""Unknown service on introduction circuit %u."", (unsigned)circuit->base_.n_circ_id); goto err; } /* We've just successfully established a intro circuit to one of our * introduction point, account for it. */ intro = find_intro_point(circuit); if (intro == NULL) { log_warn(LD_REND, ""Introduction circuit established without a rend_intro_point_t "" ""object for service %s on circuit %u"", safe_str_client(serviceid), (unsigned)circuit->base_.n_circ_id); goto err; } intro->circuit_established = 1; /* We might not have every introduction point ready but at this point we * know that the descriptor needs to be uploaded. */ service->desc_is_dirty = time(NULL); circuit_change_purpose(TO_CIRCUIT(circuit), CIRCUIT_PURPOSE_S_INTRO); base32_encode(serviceid, REND_SERVICE_ID_LEN_BASE32 + 1, rend_pk_digest, REND_SERVICE_ID_LEN); log_info(LD_REND, ""Received INTRO_ESTABLISHED cell on circuit %u for service %s"", (unsigned)circuit->base_.n_circ_id, serviceid); /* Getting a valid INTRODUCE_ESTABLISHED means we've successfully * used the circ */ pathbias_mark_use_success(circuit); return 0; err: circuit_mark_for_close(TO_CIRCUIT(circuit), END_CIRC_REASON_TORPROTOCOL); return -1; } ",1 "do_os_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type, int swap, uint32_t namesz, uint32_t descsz, size_t noff, size_t doff, int *flags) { if (namesz == 5 && strcmp((char *)&nbuf[noff], ""SuSE"") == 0 && type == NT_GNU_VERSION && descsz == 2) { *flags |= FLAGS_DID_OS_NOTE; file_printf(ms, "", for SuSE %d.%d"", nbuf[doff], nbuf[doff + 1]); return 1; } if (namesz == 4 && strcmp((char *)&nbuf[noff], ""GNU"") == 0 && type == NT_GNU_VERSION && descsz == 16) { uint32_t desc[4]; memcpy(desc, &nbuf[doff], sizeof(desc)); *flags |= FLAGS_DID_OS_NOTE; if (file_printf(ms, "", for GNU/"") == -1) return 1; switch (elf_getu32(swap, desc[0])) { case GNU_OS_LINUX: if (file_printf(ms, ""Linux"") == -1) return 1; break; case GNU_OS_HURD: if (file_printf(ms, ""Hurd"") == -1) return 1; break; case GNU_OS_SOLARIS: if (file_printf(ms, ""Solaris"") == -1) return 1; break; case GNU_OS_KFREEBSD: if (file_printf(ms, ""kFreeBSD"") == -1) return 1; break; case GNU_OS_KNETBSD: if (file_printf(ms, ""kNetBSD"") == -1) return 1; break; default: if (file_printf(ms, """") == -1) return 1; } if (file_printf(ms, "" %d.%d.%d"", elf_getu32(swap, desc[1]), elf_getu32(swap, desc[2]), elf_getu32(swap, desc[3])) == -1) return 1; return 1; } if (namesz == 7 && strcmp((char *)&nbuf[noff], ""NetBSD"") == 0) { if (type == NT_NETBSD_VERSION && descsz == 4) { *flags |= FLAGS_DID_OS_NOTE; do_note_netbsd_version(ms, swap, &nbuf[doff]); return 1; } } if (namesz == 8 && strcmp((char *)&nbuf[noff], ""FreeBSD"") == 0) { if (type == NT_FREEBSD_VERSION && descsz == 4) { *flags |= FLAGS_DID_OS_NOTE; do_note_freebsd_version(ms, swap, &nbuf[doff]); return 1; } } if (namesz == 8 && strcmp((char *)&nbuf[noff], ""OpenBSD"") == 0 && type == NT_OPENBSD_VERSION && descsz == 4) { *flags |= FLAGS_DID_OS_NOTE; if (file_printf(ms, "", for OpenBSD"") == -1) return 1; /* Content of note is always 0 */ return 1; } if (namesz == 10 && strcmp((char *)&nbuf[noff], ""DragonFly"") == 0 && type == NT_DRAGONFLY_VERSION && descsz == 4) { uint32_t desc; *flags |= FLAGS_DID_OS_NOTE; if (file_printf(ms, "", for DragonFly"") == -1) return 1; memcpy(&desc, &nbuf[doff], sizeof(desc)); desc = elf_getu32(swap, desc); if (file_printf(ms, "" %d.%d.%d"", desc / 100000, desc / 10000 % 10, desc % 10000) == -1) return 1; return 1; } return 0; } ",0 "IW_IMPL(int) iw_read_jpeg_file(struct iw_context *ctx, struct iw_iodescr *iodescr) { int retval=0; struct jpeg_decompress_struct cinfo; struct my_error_mgr jerr; int cinfo_valid=0; int colorspace; JDIMENSION rownum; JSAMPLE *jsamprow; int numchannels=0; struct iw_image img; struct iwjpegrcontext rctx; JSAMPLE *tmprow = NULL; int cmyk_flag = 0; iw_zeromem(&img,sizeof(struct iw_image)); iw_zeromem(&cinfo,sizeof(struct jpeg_decompress_struct)); iw_zeromem(&jerr,sizeof(struct my_error_mgr)); iw_zeromem(&rctx,sizeof(struct iwjpegrcontext)); cinfo.err = jpeg_std_error(&jerr.pub); jerr.pub.error_exit = my_error_exit; jerr.pub.output_message = my_output_message; if (setjmp(jerr.setjmp_buffer)) { char buffer[JMSG_LENGTH_MAX]; (*cinfo.err->format_message) ((j_common_ptr)&cinfo, buffer); iw_set_errorf(ctx,""libjpeg reports read error: %s"",buffer); goto done; } jpeg_create_decompress(&cinfo); cinfo_valid=1; rctx.pub.init_source = my_init_source_fn; rctx.pub.fill_input_buffer = my_fill_input_buffer_fn; rctx.pub.skip_input_data = my_skip_input_data_fn; rctx.pub.resync_to_restart = jpeg_resync_to_restart; // libjpeg default rctx.pub.term_source = my_term_source_fn; rctx.ctx = ctx; rctx.iodescr = iodescr; rctx.buffer_len = 32768; rctx.buffer = iw_malloc(ctx, rctx.buffer_len); if(!rctx.buffer) goto done; rctx.exif_density_x = -1.0; rctx.exif_density_y = -1.0; cinfo.src = (struct jpeg_source_mgr*)&rctx; jpeg_save_markers(&cinfo, 0xe1, 65535); jpeg_read_header(&cinfo, TRUE); rctx.is_jfif = cinfo.saw_JFIF_marker; iwjpeg_read_density(ctx,&img,&cinfo); iwjpeg_read_saved_markers(&rctx,&cinfo); jpeg_start_decompress(&cinfo); colorspace=cinfo.out_color_space; numchannels=cinfo.output_components; if(colorspace==JCS_GRAYSCALE && numchannels==1) { img.imgtype = IW_IMGTYPE_GRAY; img.native_grayscale = 1; } else if((colorspace==JCS_RGB) && numchannels==3) { img.imgtype = IW_IMGTYPE_RGB; } else if((colorspace==JCS_CMYK) && numchannels==4) { img.imgtype = IW_IMGTYPE_RGB; cmyk_flag = 1; } else { iw_set_error(ctx,""Unsupported type of JPEG""); goto done; } img.width = cinfo.output_width; img.height = cinfo.output_height; if(!iw_check_image_dimensions(ctx,img.width,img.height)) { goto done; } img.bit_depth = 8; img.bpr = iw_calc_bytesperrow(img.width,img.bit_depth*numchannels); img.pixels = (iw_byte*)iw_malloc_large(ctx, img.bpr, img.height); if(!img.pixels) { goto done; } if(cmyk_flag) { tmprow = iw_malloc(ctx,4*img.width); if(!tmprow) goto done; } while(cinfo.output_scanline < cinfo.output_height) { rownum=cinfo.output_scanline; jsamprow = &img.pixels[img.bpr * rownum]; if(cmyk_flag) { jpeg_read_scanlines(&cinfo, &tmprow, 1); convert_cmyk_to_rbg(ctx,tmprow,jsamprow,img.width); } else { jpeg_read_scanlines(&cinfo, &jsamprow, 1); } if(cinfo.output_scanline<=rownum) { iw_set_error(ctx,""Error reading JPEG file""); goto done; } } jpeg_finish_decompress(&cinfo); handle_exif_density(&rctx, &img); iw_set_input_image(ctx, &img); img.pixels = NULL; if(rctx.exif_orientation>=2 && rctx.exif_orientation<=8) { static const unsigned int exif_orient_to_transform[9] = { 0,0, 1,3,2,4,5,7,6 }; if(rctx.is_jfif) { iw_warning(ctx,""JPEG image has an ambiguous orientation""); } iw_reorient_image(ctx,exif_orient_to_transform[rctx.exif_orientation]); } retval=1; done: iw_free(ctx, img.pixels); if(cinfo_valid) jpeg_destroy_decompress(&cinfo); if(rctx.buffer) iw_free(ctx,rctx.buffer); if(tmprow) iw_free(ctx,tmprow); return retval; } ",0 "static void raisesExceptionVoidMethodOptionalLongArgMethodCallback(const v8::FunctionCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMMethod""); TestObjectPythonV8Internal::raisesExceptionVoidMethodOptionalLongArgMethod(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "void KeyboardOverlayHandler::GetInputMethodId(const ListValue* args) { chromeos::input_method::InputMethodManager* manager = chromeos::input_method::InputMethodManager::GetInstance(); const chromeos::input_method::InputMethodDescriptor& descriptor = manager->current_input_method(); StringValue param(descriptor.id()); web_ui_->CallJavascriptFunction(""initKeyboardOverlayId"", param); } ",0 "static int nfs4_proc_sequence(struct nfs_client *clp, struct rpc_cred *cred) { struct rpc_task *task; int ret; task = _nfs41_proc_sequence(clp, cred); if (IS_ERR(task)) { ret = PTR_ERR(task); goto out; } ret = rpc_wait_for_completion_task(task); if (!ret) { struct nfs4_sequence_res *res = task->tk_msg.rpc_resp; if (task->tk_status == 0) nfs41_handle_sequence_flag_errors(clp, res->sr_status_flags); ret = task->tk_status; } rpc_put_task(task); out: dprintk(""<-- %s status=%d\n"", __func__, ret); return ret; } ",0 "void TestContentClient::SetActiveURL(const GURL& url) { } ",0 "kvm_assign_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args) { enum kvm_bus bus_idx; int ret; bus_idx = ioeventfd_bus_from_flags(args->flags); /* must be natural-word sized, or 0 to ignore length */ switch (args->len) { case 0: case 1: case 2: case 4: case 8: break; default: return -EINVAL; } /* check for range overflow */ if (args->addr + args->len < args->addr) return -EINVAL; /* check for extra flags that we don't understand */ if (args->flags & ~KVM_IOEVENTFD_VALID_FLAG_MASK) return -EINVAL; /* ioeventfd with no length can't be combined with DATAMATCH */ if (!args->len && (args->flags & KVM_IOEVENTFD_FLAG_DATAMATCH)) return -EINVAL; ret = kvm_assign_ioeventfd_idx(kvm, bus_idx, args); if (ret) goto fail; /* When length is ignored, MMIO is also put on a separate bus, for * faster lookups. */ if (!args->len && bus_idx == KVM_MMIO_BUS) { ret = kvm_assign_ioeventfd_idx(kvm, KVM_FAST_MMIO_BUS, args); if (ret < 0) goto fast_fail; } return 0; fast_fail: kvm_deassign_ioeventfd_idx(kvm, bus_idx, args); fail: return ret; } ",0 "std::vector GetTestCorruptedSignResponse(size_t length) { DCHECK_LE(length, arraysize(test_data::kTestU2fSignResponse)); return fido_parsing_utils::Materialize(fido_parsing_utils::ExtractSpan( test_data::kTestU2fSignResponse, 0, length)); } ",0 "rb_commit_index(struct ring_buffer_per_cpu *cpu_buffer) { return rb_page_commit(cpu_buffer->commit_page); } ",0 "sp MediaPlayerService::Client::setDataSource_pre( player_type playerType) { ALOGV(""player type = %d"", playerType); sp p = createPlayer(playerType); if (p == NULL) { return p; } sp sm = defaultServiceManager(); sp binder = sm->getService(String16(""media.extractor"")); mExtractorDeathListener = new ServiceDeathNotifier(binder, p, MEDIAEXTRACTOR_PROCESS_DEATH); binder->linkToDeath(mExtractorDeathListener); binder = sm->getService(String16(""media.codec"")); mCodecDeathListener = new ServiceDeathNotifier(binder, p, MEDIACODEC_PROCESS_DEATH); binder->linkToDeath(mCodecDeathListener); if (!p->hardwareOutput()) { Mutex::Autolock l(mLock); mAudioOutput = new AudioOutput(mAudioSessionId, IPCThreadState::self()->getCallingUid(), mPid, mAudioAttributes); static_cast(p.get())->setAudioSink(mAudioOutput); } return p; } ",0 "static struct nd_opt_hdr *ndisc_next_option(struct nd_opt_hdr *cur, struct nd_opt_hdr *end) { int type; if (!cur || !end || cur >= end) return NULL; type = cur->nd_opt_type; do { cur = ((void *)cur) + (cur->nd_opt_len << 3); } while (cur < end && cur->nd_opt_type != type); return cur <= end && cur->nd_opt_type == type ? cur : NULL; } ",0 "static void hns_xgmac_get_link_status(void *mac_drv, u32 *link_stat) { struct mac_driver *drv = (struct mac_driver *)mac_drv; *link_stat = dsaf_read_dev(drv, XGMAC_LINK_STATUS_REG); } ",0 " handle_connection(GArray *servers, int net, SERVER *serve, CLIENT *client) { int sock_flags_old; int sock_flags_new; if(serve->max_connections > 0 && g_hash_table_size(children) >= serve->max_connections) { msg(LOG_INFO, ""Max connections reached""); goto handle_connection_out; } if((sock_flags_old = fcntl(net, F_GETFL, 0)) == -1) { err(""fcntl F_GETFL""); } sock_flags_new = sock_flags_old & ~O_NONBLOCK; if (sock_flags_new != sock_flags_old && fcntl(net, F_SETFL, sock_flags_new) == -1) { err(""fcntl F_SETFL ~O_NONBLOCK""); } if(!client) { client = g_new0(CLIENT, 1); client->server=serve; client->exportsize=OFFT_MAX; client->net=net; client->transactionlogfd = -1; } if (set_peername(net, client)) { goto handle_connection_out; } if (!authorized_client(client)) { msg(LOG_INFO, ""Unauthorized client""); goto handle_connection_out; } msg(LOG_INFO, ""Authorized client""); if (!dontfork) { pid_t pid; int i; sigset_t newset; sigset_t oldset; sigemptyset(&newset); sigaddset(&newset, SIGCHLD); sigaddset(&newset, SIGTERM); sigprocmask(SIG_BLOCK, &newset, &oldset); if ((pid = fork()) < 0) { msg(LOG_INFO, ""Could not fork (%s)"", strerror(errno)); sigprocmask(SIG_SETMASK, &oldset, NULL); goto handle_connection_out; } if (pid > 0) { /* parent */ pid_t *pidp; pidp = g_malloc(sizeof(pid_t)); *pidp = pid; g_hash_table_insert(children, pidp, pidp); sigprocmask(SIG_SETMASK, &oldset, NULL); goto handle_connection_out; } /* child */ signal(SIGCHLD, SIG_DFL); signal(SIGTERM, SIG_DFL); signal(SIGHUP, SIG_DFL); sigprocmask(SIG_SETMASK, &oldset, NULL); g_hash_table_destroy(children); children = NULL; for(i=0;ilen;i++) { serve=&g_array_index(servers, SERVER, i); close(serve->socket); } /* FALSE does not free the actual data. This is required, because the client has a direct reference into that data, and otherwise we get a segfault... */ g_array_free(servers, FALSE); for(i=0;ilen;i++) { close(g_array_index(modernsocks, int, i)); } g_array_free(modernsocks, TRUE); } msg(LOG_INFO, ""Starting to serve""); serveconnection(client); exit(EXIT_SUCCESS); handle_connection_out: g_free(client); close(net); } ",0 "size_t php_mysqlnd_auth_write(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC) { zend_uchar buffer[AUTH_WRITE_BUFFER_LEN]; zend_uchar *p = buffer + MYSQLND_HEADER_SIZE; /* start after the header */ int len; MYSQLND_PACKET_AUTH * packet= (MYSQLND_PACKET_AUTH *) _packet; DBG_ENTER(""php_mysqlnd_auth_write""); if (!packet->is_change_user_packet) { int4store(p, packet->client_flags); p+= 4; int4store(p, packet->max_packet_size); p+= 4; int1store(p, packet->charset_no); p++; memset(p, 0, 23); /* filler */ p+= 23; } if (packet->send_auth_data || packet->is_change_user_packet) { len = MIN(strlen(packet->user), MYSQLND_MAX_ALLOWED_USER_LEN); memcpy(p, packet->user, len); p+= len; *p++ = '\0'; /* defensive coding */ if (packet->auth_data == NULL) { packet->auth_data_len = 0; } if (packet->auth_data_len > 0xFF) { const char * const msg = ""Authentication data too long. "" ""Won't fit into the buffer and will be truncated. Authentication will thus fail""; SET_CLIENT_ERROR(*conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, msg); php_error_docref(NULL TSRMLS_CC, E_WARNING, ""%s"", msg); DBG_RETURN(0); } int1store(p, packet->auth_data_len); ++p; /*!!!!! is the buffer big enough ??? */ if ((sizeof(buffer) - (p - buffer)) < packet->auth_data_len) { DBG_ERR(""the stack buffer was not enough!!""); DBG_RETURN(0); } if (packet->auth_data_len) { memcpy(p, packet->auth_data, packet->auth_data_len); p+= packet->auth_data_len; } if (packet->db) { /* CLIENT_CONNECT_WITH_DB should have been set */ size_t real_db_len = MIN(MYSQLND_MAX_ALLOWED_DB_LEN, packet->db_len); memcpy(p, packet->db, real_db_len); p+= real_db_len; *p++= '\0'; } else if (packet->is_change_user_packet) { *p++= '\0'; } /* no \0 for no DB */ if (packet->is_change_user_packet) { if (packet->charset_no) { int2store(p, packet->charset_no); p+= 2; } } if (packet->auth_plugin_name) { size_t len = MIN(strlen(packet->auth_plugin_name), sizeof(buffer) - (p - buffer) - 1); memcpy(p, packet->auth_plugin_name, len); p+= len; *p++= '\0'; } if (packet->connect_attr && zend_hash_num_elements(packet->connect_attr)) { HashPosition pos_value; const char ** entry_value; size_t ca_payload_len = 0; zend_hash_internal_pointer_reset_ex(packet->connect_attr, &pos_value); while (SUCCESS == zend_hash_get_current_data_ex(packet->connect_attr, (void **)&entry_value, &pos_value)) { char *s_key; unsigned int s_len; unsigned long num_key; size_t value_len = strlen(*entry_value); if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(packet->connect_attr, &s_key, &s_len, &num_key, 0, &pos_value)) { ca_payload_len += php_mysqlnd_net_store_length_size(s_len); ca_payload_len += s_len; ca_payload_len += php_mysqlnd_net_store_length_size(value_len); ca_payload_len += value_len; } zend_hash_move_forward_ex(conn->options->connect_attr, &pos_value); } if ((sizeof(buffer) - (p - buffer)) >= (ca_payload_len + php_mysqlnd_net_store_length_size(ca_payload_len))) { p = php_mysqlnd_net_store_length(p, ca_payload_len); zend_hash_internal_pointer_reset_ex(packet->connect_attr, &pos_value); while (SUCCESS == zend_hash_get_current_data_ex(packet->connect_attr, (void **)&entry_value, &pos_value)) { char *s_key; unsigned int s_len; unsigned long num_key; size_t value_len = strlen(*entry_value); if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(packet->connect_attr, &s_key, &s_len, &num_key, 0, &pos_value)) { /* copy key */ p = php_mysqlnd_net_store_length(p, s_len); memcpy(p, s_key, s_len); p+= s_len; /* copy value */ p = php_mysqlnd_net_store_length(p, value_len); memcpy(p, *entry_value, value_len); p+= value_len; } zend_hash_move_forward_ex(conn->options->connect_attr, &pos_value); } } else { /* cannot put the data - skip */ } } } if (packet->is_change_user_packet) { if (PASS != conn->m->simple_command(conn, COM_CHANGE_USER, buffer + MYSQLND_HEADER_SIZE, p - buffer - MYSQLND_HEADER_SIZE, PROT_LAST /* the caller will handle the OK packet */, packet->silent, TRUE TSRMLS_CC)) { DBG_RETURN(0); } DBG_RETURN(p - buffer - MYSQLND_HEADER_SIZE); } else { size_t sent = conn->net->data->m.send_ex(conn->net, buffer, p - buffer - MYSQLND_HEADER_SIZE, conn->stats, conn->error_info TSRMLS_CC); if (!sent) { CONN_SET_STATE(conn, CONN_QUIT_SENT); } DBG_RETURN(sent); } } ",0 "void OfflinePageModelTaskified::GetAllPages( const MultipleOfflinePageItemCallback& callback) { auto task = GetPagesTask::CreateTaskMatchingAllPages(store_.get(), callback); task_queue_.AddTask(std::move(task)); } ",0 "static int mpeg4_decode_studio_block(MpegEncContext *s, int32_t block[64], int n) { Mpeg4DecContext *ctx = s->avctx->priv_data; int cc, dct_dc_size, dct_diff, code, j, idx = 1, group = 0, run = 0, additional_code_len, sign, mismatch; VLC *cur_vlc = &ctx->studio_intra_tab[0]; uint8_t *const scantable = s->intra_scantable.permutated; const uint16_t *quant_matrix; uint32_t flc; const int min = -1 * (1 << (s->avctx->bits_per_raw_sample + 6)); const int max = ((1 << (s->avctx->bits_per_raw_sample + 6)) - 1); mismatch = 1; memset(block, 0, 64 * sizeof(int32_t)); if (n < 4) { cc = 0; dct_dc_size = get_vlc2(&s->gb, ctx->studio_luma_dc.table, STUDIO_INTRA_BITS, 2); quant_matrix = s->intra_matrix; } else { cc = (n & 1) + 1; if (ctx->rgb) dct_dc_size = get_vlc2(&s->gb, ctx->studio_luma_dc.table, STUDIO_INTRA_BITS, 2); else dct_dc_size = get_vlc2(&s->gb, ctx->studio_chroma_dc.table, STUDIO_INTRA_BITS, 2); quant_matrix = s->chroma_intra_matrix; } if (dct_dc_size < 0) { av_log(s->avctx, AV_LOG_ERROR, ""illegal dct_dc_size vlc\n""); return AVERROR_INVALIDDATA; } else if (dct_dc_size == 0) { dct_diff = 0; } else { dct_diff = get_xbits(&s->gb, dct_dc_size); if (dct_dc_size > 8) { if(!check_marker(s->avctx, &s->gb, ""dct_dc_size > 8"")) return AVERROR_INVALIDDATA; } } s->last_dc[cc] += dct_diff; if (s->mpeg_quant) block[0] = s->last_dc[cc] * (8 >> s->intra_dc_precision); else block[0] = s->last_dc[cc] * (8 >> s->intra_dc_precision) * (8 >> s->dct_precision); /* TODO: support mpeg_quant for AC coefficients */ block[0] = av_clip(block[0], min, max); mismatch ^= block[0]; /* AC Coefficients */ while (1) { group = get_vlc2(&s->gb, cur_vlc->table, STUDIO_INTRA_BITS, 2); if (group < 0) { av_log(s->avctx, AV_LOG_ERROR, ""illegal ac coefficient group vlc\n""); return AVERROR_INVALIDDATA; } additional_code_len = ac_state_tab[group][0]; cur_vlc = &ctx->studio_intra_tab[ac_state_tab[group][1]]; if (group == 0) { /* End of Block */ break; } else if (group >= 1 && group <= 6) { /* Zero run length (Table B.47) */ run = 1 << additional_code_len; if (additional_code_len) run += get_bits(&s->gb, additional_code_len); idx += run; continue; } else if (group >= 7 && group <= 12) { /* Zero run length and +/-1 level (Table B.48) */ code = get_bits(&s->gb, additional_code_len); sign = code & 1; code >>= 1; run = (1 << (additional_code_len - 1)) + code; idx += run; j = scantable[idx++]; block[j] = sign ? 1 : -1; } else if (group >= 13 && group <= 20) { /* Level value (Table B.49) */ j = scantable[idx++]; block[j] = get_xbits(&s->gb, additional_code_len); } else if (group == 21) { /* Escape */ j = scantable[idx++]; additional_code_len = s->avctx->bits_per_raw_sample + s->dct_precision + 4; flc = get_bits(&s->gb, additional_code_len); if (flc >> (additional_code_len-1)) block[j] = -1 * (( flc ^ ((1 << additional_code_len) -1)) + 1); else block[j] = flc; } block[j] = ((8 * 2 * block[j] * quant_matrix[j] * s->qscale) >> s->dct_precision) / 32; block[j] = av_clip(block[j], min, max); mismatch ^= block[j]; } block[63] ^= mismatch & 1; return 0; } ",1 "static u32 tcm_loop_get_task_tag(struct se_cmd *se_cmd) { return 1; } ",0 "LogLuvDecode32(TIFF* tif, uint8* op, tmsize_t occ, uint16 s) { static const char module[] = ""LogLuvDecode32""; LogLuvState* sp; int shft; tmsize_t i; tmsize_t npixels; unsigned char* bp; uint32* tp; uint32 b; tmsize_t cc; int rc; assert(s == 0); sp = DecoderState(tif); assert(sp != NULL); npixels = occ / sp->pixel_size; if (sp->user_datafmt == SGILOGDATAFMT_RAW) tp = (uint32*) op; else { if(sp->tbuflen < npixels) { TIFFErrorExt(tif->tif_clientdata, module, ""Translation buffer too short""); return (0); } tp = (uint32*) sp->tbuf; } _TIFFmemset((void*) tp, 0, npixels*sizeof (tp[0])); bp = (unsigned char*) tif->tif_rawcp; cc = tif->tif_rawcc; /* get each byte string */ for (shft = 4*8; (shft -= 8) >= 0; ) { for (i = 0; i < npixels && cc > 0; ) { if (*bp >= 128) { /* run */ if( cc < 2 ) break; rc = *bp++ + (2-128); b = (uint32)*bp++ << shft; cc -= 2; while (rc-- && i < npixels) tp[i++] |= b; } else { /* non-run */ rc = *bp++; /* nul is noop */ while (--cc && rc-- && i < npixels) tp[i++] |= (uint32)*bp++ << shft; } } if (i != npixels) { #if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__)) TIFFErrorExt(tif->tif_clientdata, module, ""Not enough data at row %lu (short %I64d pixels)"", (unsigned long) tif->tif_row, (unsigned __int64) (npixels - i)); #else TIFFErrorExt(tif->tif_clientdata, module, ""Not enough data at row %lu (short %llu pixels)"", (unsigned long) tif->tif_row, (unsigned long long) (npixels - i)); #endif tif->tif_rawcp = (uint8*) bp; tif->tif_rawcc = cc; return (0); } } (*sp->tfunc)(sp, op, npixels); tif->tif_rawcp = (uint8*) bp; tif->tif_rawcc = cc; return (1); } ",0 "static void copy_gigantic_page(struct page *dst, struct page *src) { int i; struct hstate *h = page_hstate(src); struct page *dst_base = dst; struct page *src_base = src; for (i = 0; i < pages_per_huge_page(h); ) { cond_resched(); copy_highpage(dst, src); i++; dst = mem_map_next(dst, dst_base, i); src = mem_map_next(src, src_base, i); } } ",0 "static int idp_check_dp(DIST_POINT_NAME *a, DIST_POINT_NAME *b) { X509_NAME *nm = NULL; GENERAL_NAMES *gens = NULL; GENERAL_NAME *gena, *genb; int i, j; if (!a || !b) return 1; if (a->type == 1) { if (!a->dpname) return 0; /* Case 1: two X509_NAME */ if (b->type == 1) { if (!b->dpname) return 0; if (!X509_NAME_cmp(a->dpname, b->dpname)) return 1; else return 0; } /* Case 2: set name and GENERAL_NAMES appropriately */ nm = a->dpname; gens = b->name.fullname; } else if (b->type == 1) { if (!b->dpname) return 0; /* Case 2: set name and GENERAL_NAMES appropriately */ gens = a->name.fullname; nm = b->dpname; } /* Handle case 2 with one GENERAL_NAMES and one X509_NAME */ if (nm) { for (i = 0; i < sk_GENERAL_NAME_num(gens); i++) { gena = sk_GENERAL_NAME_value(gens, i); if (gena->type != GEN_DIRNAME) continue; if (!X509_NAME_cmp(nm, gena->d.directoryName)) return 1; } return 0; } /* Else case 3: two GENERAL_NAMES */ for (i = 0; i < sk_GENERAL_NAME_num(a->name.fullname); i++) { gena = sk_GENERAL_NAME_value(a->name.fullname, i); for (j = 0; j < sk_GENERAL_NAME_num(b->name.fullname); j++) { genb = sk_GENERAL_NAME_value(b->name.fullname, j); if (!GENERAL_NAME_cmp(gena, genb)) return 1; } } return 0; } ",0 "dotraplinkage void do_coprocessor_error(struct pt_regs *regs, long error_code) { enum ctx_state prev_state; prev_state = exception_enter(); math_error(regs, error_code, X86_TRAP_MF); exception_exit(prev_state); } ",0 "void RenderFrameHostImpl::OnSameDocumentCommitProcessed( int64_t navigation_id, bool should_replace_current_entry, blink::mojom::CommitResult result) { if (!same_document_navigation_request_ || same_document_navigation_request_->navigation_handle() ->GetNavigationId() != navigation_id) { return; } if (result == blink::mojom::CommitResult::RestartCrossDocument) { frame_tree_node_->navigator()->RestartNavigationAsCrossDocument( std::move(same_document_navigation_request_)); } if (result == blink::mojom::CommitResult::Aborted) { same_document_navigation_request_.reset(); } } ",0 "brcmf_update_pmklist(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp) { struct brcmf_pmk_list_le *pmk_list; int i; u32 npmk; s32 err; pmk_list = &cfg->pmk_list; npmk = le32_to_cpu(pmk_list->npmk); brcmf_dbg(CONN, ""No of elements %d\n"", npmk); for (i = 0; i < npmk; i++) brcmf_dbg(CONN, ""PMK[%d]: %pM\n"", i, &pmk_list->pmk[i].bssid); err = brcmf_fil_iovar_data_set(ifp, ""pmkid_info"", pmk_list, sizeof(*pmk_list)); return err; } ",0 "zend_bool php_openssl_pkey_init_dh(DH *dh, zval *data) { BIGNUM *p, *q, *g, *priv_key, *pub_key; OPENSSL_PKEY_SET_BN(data, p); OPENSSL_PKEY_SET_BN(data, q); OPENSSL_PKEY_SET_BN(data, g); if (!p || !g || !DH_set0_pqg(dh, p, q, g)) { return 0; } OPENSSL_PKEY_SET_BN(data, priv_key); OPENSSL_PKEY_SET_BN(data, pub_key); if (pub_key) { return DH_set0_key(dh, pub_key, priv_key); } if (priv_key) { pub_key = php_openssl_dh_pub_from_priv(priv_key, g, p); if (pub_key == NULL) { return 0; } return DH_set0_key(dh, pub_key, priv_key); } /* generate key */ PHP_OPENSSL_RAND_ADD_TIME(); if (!DH_generate_key(dh)) { return 0; } /* all good */ return 1; } ",0 "void ScrollableShelfView::StartShelfScrollAnimation(float scroll_distance) { const gfx::Transform current_transform = shelf_view_->GetTransform(); gfx::Transform reverse_transform = current_transform; if (ShouldAdaptToRTL()) scroll_distance = -scroll_distance; if (GetShelf()->IsHorizontalAlignment()) reverse_transform.Translate(gfx::Vector2dF(scroll_distance, 0)); else reverse_transform.Translate(gfx::Vector2dF(0, scroll_distance)); shelf_view_->layer()->SetTransform(reverse_transform); ui::ScopedLayerAnimationSettings animation_settings( shelf_view_->layer()->GetAnimator()); animation_settings.SetTweenType(gfx::Tween::EASE_OUT); animation_settings.SetPreemptionStrategy( ui::LayerAnimator::IMMEDIATELY_SET_NEW_TARGET); shelf_view_->layer()->SetTransform(current_transform); } ",0 "static void napi_gro_flush(struct napi_struct *napi) { struct sk_buff *skb, *next; for (skb = napi->gro_list; skb; skb = next) { next = skb->next; skb->next = NULL; napi_gro_complete(skb); } napi->gro_count = 0; napi->gro_list = NULL; } ",0 "bool DownloadUIAdapterDelegate::IsTemporarilyHiddenInUI( const ClientId& client_id) { return false; } ",0 "static void decide_output_bit_depth(struct iw_context *ctx) { if(ctx->output_profile&IW_PROFILE_HDRI) { ctx->img2.sampletype=IW_SAMPLETYPE_FLOATINGPOINT; } else { ctx->img2.sampletype=IW_SAMPLETYPE_UINT; } if(ctx->img2.sampletype==IW_SAMPLETYPE_FLOATINGPOINT) { ctx->img2.bit_depth=32; return; } if(ctx->req.output_depth>8 && (ctx->output_profile&IW_PROFILE_16BPS)) { ctx->img2.bit_depth=16; } else { if(ctx->req.output_depth>8) { iw_warning(ctx,""Reducing depth to 8; required by the output format.""); } ctx->img2.bit_depth=8; } } ",0 "GURL DownloadProtectionService::GetDownloadRequestUrl() { GURL url(kDownloadRequestUrl); std::string api_key = google_apis::GetAPIKey(); if (!api_key.empty()) url = url.Resolve(""?key="" + net::EscapeQueryParamValue(api_key, true)); return url; } ",0 "PHP_FUNCTION(mcrypt_enc_get_algorithms_name) { char *name; MCRYPT_GET_TD_ARG name = mcrypt_enc_get_algorithms_name(pm->td); RETVAL_STRING(name, 1); mcrypt_free(name); } ",0 "static void h2_session_ev_stream_done(h2_session *session, int arg, const char *msg) { --session->open_streams; switch (session->state) { case H2_SESSION_ST_IDLE: if (session->open_streams == 0) { /* enter keepalive timeout, since we no longer have streams */ session->idle_until = (session->s->keep_alive_timeout + apr_time_now()); } break; default: break; } } ",0 "xmlParseAttributeType(xmlParserCtxtPtr ctxt, xmlEnumerationPtr *tree) { SHRINK; if (CMP5(CUR_PTR, 'C', 'D', 'A', 'T', 'A')) { SKIP(5); return(XML_ATTRIBUTE_CDATA); } else if (CMP6(CUR_PTR, 'I', 'D', 'R', 'E', 'F', 'S')) { SKIP(6); return(XML_ATTRIBUTE_IDREFS); } else if (CMP5(CUR_PTR, 'I', 'D', 'R', 'E', 'F')) { SKIP(5); return(XML_ATTRIBUTE_IDREF); } else if ((RAW == 'I') && (NXT(1) == 'D')) { SKIP(2); return(XML_ATTRIBUTE_ID); } else if (CMP6(CUR_PTR, 'E', 'N', 'T', 'I', 'T', 'Y')) { SKIP(6); return(XML_ATTRIBUTE_ENTITY); } else if (CMP8(CUR_PTR, 'E', 'N', 'T', 'I', 'T', 'I', 'E', 'S')) { SKIP(8); return(XML_ATTRIBUTE_ENTITIES); } else if (CMP8(CUR_PTR, 'N', 'M', 'T', 'O', 'K', 'E', 'N', 'S')) { SKIP(8); return(XML_ATTRIBUTE_NMTOKENS); } else if (CMP7(CUR_PTR, 'N', 'M', 'T', 'O', 'K', 'E', 'N')) { SKIP(7); return(XML_ATTRIBUTE_NMTOKEN); } return(xmlParseEnumeratedType(ctxt, tree)); } ",0 "void PrintWebViewHelper::OnPrintPreview(const DictionaryValue& settings) { DCHECK(is_preview_); print_preview_context_.OnPrintPreview(); if (!InitPrintSettings(print_preview_context_.frame(), print_preview_context_.node(), true)) { Send(new PrintHostMsg_PrintPreviewInvalidPrinterSettings( routing_id(), print_pages_params_->params.document_cookie)); return; } if (!UpdatePrintSettings(settings, true)) { LOG(ERROR) << ""UpdatePrintSettings failed""; DidFinishPrinting(FAIL_PREVIEW); return; } if (!print_pages_params_->params.is_first_request && old_print_pages_params_.get() && PrintMsg_Print_Params_IsEqual(*old_print_pages_params_, *print_pages_params_)) { PrintHostMsg_DidPreviewDocument_Params preview_params; preview_params.reuse_existing_data = true; preview_params.data_size = 0; preview_params.document_cookie = print_pages_params_->params.document_cookie; preview_params.expected_pages_count = print_preview_context_.total_page_count(); preview_params.modifiable = print_preview_context_.IsModifiable(); preview_params.preview_request_id = print_pages_params_->params.preview_request_id; Send(new PrintHostMsg_MetafileReadyForPrinting(routing_id(), preview_params)); return; } old_print_pages_params_.reset(); is_print_ready_metafile_sent_ = false; print_pages_params_->params.supports_alpha_blend = true; bool generate_draft_pages = false; if (!settings.GetBoolean(printing::kSettingGenerateDraftData, &generate_draft_pages)) { NOTREACHED(); } print_preview_context_.set_generate_draft_pages(generate_draft_pages); if (CreatePreviewDocument()) { DidFinishPrinting(OK); } else { if (notify_browser_of_print_failure_) LOG(ERROR) << ""CreatePreviewDocument failed""; DidFinishPrinting(FAIL_PREVIEW); } } ",1 "static void list_data_remotesubscriptions(struct listargs *listargs) { /* Need to fetch subscription list from backend_inbox */ struct list_rock rock; char mytag[128]; memset(&rock, 0, sizeof(struct list_rock)); rock.listargs = listargs; rock.subs = strarray_new(); construct_hash_table(&rock.server_table, 10, 1); proxy_gentag(mytag, sizeof(mytag)); if ((listargs->sel & LIST_SEL_SUBSCRIBED) && !(listargs->sel & (LIST_SEL_SPECIALUSE | LIST_SEL_METADATA))) { /* Subscriptions are the only selection criteria. Send client request as-is to backend_inbox. Responses will be piped to the client as we build subs list. */ list_data_remote(backend_inbox, mytag, listargs, rock.subs); /* Don't proxy to backend_inbox again */ hash_insert(backend_inbox->hostname, (void *)0xDEADBEEF, &rock.server_table); } else { /* Multiple selection criteria or need to return subscription info. Just fetch subscriptions without piping responses to the client. If we send entire client request, subscribed mailboxes on non-Inbox servers might be filtered out due to lack of metadata to meet the selection criteria. Note that we end up sending two requests to backend_inbox, but there doesn't appear to be any way around this. */ struct listargs myargs; memcpy(&myargs, listargs, sizeof(struct listargs)); myargs.sel = LIST_SEL_SUBSCRIBED; myargs.ret = 0; list_data_remote(backend_inbox, mytag, &myargs, rock.subs); } /* find */ mboxlist_findallmulti(&imapd_namespace, &listargs->pat, imapd_userisadmin, imapd_userid, imapd_authstate, list_cb, &rock); strarray_free(rock.subs); free_hash_table(&rock.server_table, NULL); if (rock.last_name) free(rock.last_name); } ",0 "asmlinkage __visible void __attribute__((weak)) smp_thermal_interrupt(void) { } ",0 "AMediaCodecCryptoInfo *AMediaCodecCryptoInfo_new( int numsubsamples, uint8_t key[16], uint8_t iv[16], cryptoinfo_mode_t mode, size_t *clearbytes, size_t *encryptedbytes) { size_t cryptosize = sizeof(AMediaCodecCryptoInfo) + sizeof(size_t) * numsubsamples * 2; AMediaCodecCryptoInfo *ret = (AMediaCodecCryptoInfo*) malloc(cryptosize); if (!ret) { ALOGE(""couldn't allocate %zu bytes"", cryptosize); return NULL; } ret->numsubsamples = numsubsamples; memcpy(ret->key, key, 16); memcpy(ret->iv, iv, 16); ret->mode = mode; ret->pattern.encryptBlocks = 0; ret->pattern.skipBlocks = 0; ret->clearbytes = (size_t*) (ret + 1); // point immediately after the struct ret->encryptedbytes = ret->clearbytes + numsubsamples; // point after the clear sizes memcpy(ret->clearbytes, clearbytes, numsubsamples * sizeof(size_t)); memcpy(ret->encryptedbytes, encryptedbytes, numsubsamples * sizeof(size_t)); return ret; } ",1 "status_t SampleIterator::findSampleTimeAndDuration( uint32_t sampleIndex, uint32_t *time, uint32_t *duration) { if (sampleIndex >= mTable->mNumSampleSizes) { return ERROR_OUT_OF_RANGE; } while (sampleIndex >= mTTSSampleIndex + mTTSCount) { if (mTimeToSampleIndex == mTable->mTimeToSampleCount) { return ERROR_OUT_OF_RANGE; } mTTSSampleIndex += mTTSCount; mTTSSampleTime += mTTSCount * mTTSDuration; mTTSCount = mTable->mTimeToSample[2 * mTimeToSampleIndex]; mTTSDuration = mTable->mTimeToSample[2 * mTimeToSampleIndex + 1]; ++mTimeToSampleIndex; } *time = mTTSSampleTime + mTTSDuration * (sampleIndex - mTTSSampleIndex); int32_t offset = mTable->getCompositionTimeOffset(sampleIndex); if ((offset < 0 && *time < (offset == INT32_MIN ? INT32_MAX : uint32_t(-offset))) || (offset > 0 && *time > UINT32_MAX - offset)) { ALOGE(""%u + %d would overflow"", *time, offset); return ERROR_OUT_OF_RANGE; } if (offset > 0) { *time += offset; } else { *time -= (offset == INT32_MIN ? INT32_MAX : (-offset)); } *duration = mTTSDuration; return OK; } ",0 "BGD_DECLARE(int) gdImageColorResolve (gdImagePtr im, int r, int g, int b) { return gdImageColorResolveAlpha (im, r, g, b, gdAlphaOpaque); } ",0 "int GetMimeTypeMatch(const std::string& mime_type_string, std::map mime_type_map) { for (const auto& entry : mime_type_map) { if (entry.first == mime_type_string) { return entry.second; } } return 0; } ",0 "RedirectStatus GetPredictionRedirectStatus(const GURL& initial_url, const GURL& main_frame_url, const std::string& prediction_key, bool is_redirected, bool is_host) { if (main_frame_url == initial_url) { return is_redirected ? RedirectStatus::NO_REDIRECT_BUT_PREDICTED : RedirectStatus::NO_REDIRECT; } if (!is_redirected) return RedirectStatus::REDIRECT_NOT_PREDICTED; const std::string& main_frame_key = is_host ? main_frame_url.host() : main_frame_url.spec(); return main_frame_key == prediction_key ? RedirectStatus::REDIRECT_CORRECTLY_PREDICTED : RedirectStatus::REDIRECT_WRONG_PREDICTED; } ",0 "AXObjectCache* Document::axObjectCache() const { if (!AXObjectCache::accessibilityEnabled()) return 0; Document* topDocument = this->topDocument(); if (!topDocument->renderer()) return 0; ASSERT(topDocument == this || !m_axObjectCache); if (!topDocument->m_axObjectCache) topDocument->m_axObjectCache = adoptPtr(new AXObjectCache(topDocument)); return topDocument->m_axObjectCache.get(); } ",0 "GF_Err rely_Read(GF_Box *s, GF_BitStream *bs) { GF_RelyHintBox *ptr = (GF_RelyHintBox *)s; ptr->reserved = gf_bs_read_int(bs, 6); ptr->prefered = gf_bs_read_int(bs, 1); ptr->required = gf_bs_read_int(bs, 1); return GF_OK; } ",0 "match_path(sc_card_t *card, unsigned short int **pathptr, size_t *pathlen, int need_info) { unsigned short int *curptr, *ptr; size_t curlen, len; size_t i; curptr = (unsigned short int *) card->cache.current_path.value; curlen = card->cache.current_path.len; ptr = *pathptr; len = *pathlen; if (curlen < 1 || len < 1) return 0; /* Make sure path starts with MF. * Note the cached path should always begin with MF. */ if (ptr[0] != GPK_FID_MF || curptr[0] != GPK_FID_MF) return 0; for (i = 1; i < len && i < curlen; i++) { if (ptr[i] != curptr[i]) break; } if (len < curlen) { /* Caller asked us to select the DF, but the * current file is some EF within the DF we're * interested in. Say ACK */ if (len == 2) goto okay; /* Anything else won't work */ return 0; } /* In the case of an exact match: * If the caller needs info on the file to be selected, * make sure we at least select the file itself. * If the DF matches the current DF, just return the * FID */ if (i == len && need_info) { if (i > 1) { *pathptr = ptr + len - 1; *pathlen = len - 1; return 1; } /* bummer */ return 0; } okay: *pathptr = ptr + i; *pathlen = len - i; return 1; } ",0 "void WebPluginProxy::HandleURLRequest(const char *method, bool is_javascript_url, const char* target, unsigned int len, const char* buf, bool is_file_data, bool notify, const char* url, intptr_t notify_data, bool popups_allowed) { if (!url) { NOTREACHED(); return; } if (!target && (0 == base::strcasecmp(method, ""GET""))) { if (delegate_->GetQuirks() & WebPluginDelegateImpl::PLUGIN_QUIRK_BLOCK_NONSTANDARD_GETURL_REQUESTS) { GURL request_url(url); if (!request_url.SchemeIs(chrome::kHttpScheme) && !request_url.SchemeIs(chrome::kHttpsScheme) && !request_url.SchemeIs(chrome::kFtpScheme)) { return; } } } PluginHostMsg_URLRequest_Params params; params.method = method; params.is_javascript_url = is_javascript_url; if (target) params.target = std::string(target); if (len) { params.buffer.resize(len); memcpy(¶ms.buffer.front(), buf, len); } params.is_file_data = is_file_data; params.notify = notify; params.url = url; params.notify_data = notify_data; params.popups_allowed = popups_allowed; Send(new PluginHostMsg_URLRequest(route_id_, params)); } ",1 "void InspectorNetworkAgent::DidFailFetch(ThreadableLoaderClient* client) { known_request_id_map_.erase(client); } ",0 "DevToolsManager* ChromeContentBrowserClient::GetDevToolsManager() { return g_browser_process->devtools_manager(); } ",0 "dissect_u3v_register(guint64 addr, proto_tree *branch, tvbuff_t *tvb, gint offset, gint length, u3v_conv_info_t * u3v_conv_info) { gint isABRM = FALSE, isSBRM = FALSE, isSIRM = FALSE,isEIRM = FALSE; /* check if this is the access to one of the base address registers */ if ( addr < 0x10000 ) { isABRM = TRUE; switch (addr) { case U3V_ABRM_GENCP_VERSION: proto_tree_add_item(branch, hf_u3v_bootstrap_GenCP_Version, tvb, offset, 4, ENC_LITTLE_ENDIAN); break; case U3V_ABRM_MANUFACTURER_NAME: if ( length <= 64 ) { proto_tree_add_item(branch, hf_u3v_bootstrap_Manufacturer_Name, tvb, offset, length, ENC_ASCII|ENC_NA); } break; case U3V_ABRM_MODEL_NAME: if ( length <= 64 ) { proto_tree_add_item(branch, hf_u3v_bootstrap_Model_Name, tvb, offset, length, ENC_ASCII|ENC_NA); } break; case U3V_ABRM_FAMILY_NAME: if ( length <= 64 ) { proto_tree_add_item(branch, hf_u3v_bootstrap_Family_Name, tvb, offset, length, ENC_ASCII|ENC_NA); } break; case U3V_ABRM_DEVICE_VERSION: if ( length <= 64 ) { proto_tree_add_item(branch, hf_u3v_bootstrap_Device_Version, tvb, offset, length, ENC_ASCII|ENC_NA); } break; case U3V_ABRM_MANUFACTURER_INFO: if ( length <= 64 ) { proto_tree_add_item(branch, hf_u3v_bootstrap_Manufacturer_Info, tvb, offset, length, ENC_ASCII|ENC_NA); } break; case U3V_ABRM_SERIAL_NUMBER: if ( length <= 64 ) { proto_tree_add_item(branch, hf_u3v_bootstrap_Serial_Number, tvb, offset, length, ENC_ASCII|ENC_NA); } break; case U3V_ABRM_USER_DEFINED_NAME: if ( length <= 64 ) { proto_tree_add_item(branch, hf_u3v_bootstrap_User_Defined_Name, tvb, offset, length, ENC_ASCII|ENC_NA); } break; case U3V_ABRM_DEVICE_CAPABILITY: proto_tree_add_item(branch, hf_u3v_bootstrap_Device_Capability, tvb, offset, 8, ENC_LITTLE_ENDIAN); break; case U3V_ABRM_MAXIMUM_DEVICE_RESPONSE_TIME: proto_tree_add_item(branch, hf_u3v_bootstrap_Maximum_Device_Response_Time, tvb, offset, 4, ENC_LITTLE_ENDIAN); break; case U3V_ABRM_MANIFEST_TABLE_ADDRESS: proto_tree_add_item(branch, hf_u3v_bootstrap_Manifest_Table_Address, tvb, offset, 8, ENC_LITTLE_ENDIAN); break; case U3V_ABRM_SBRM_ADDRESS: proto_tree_add_item(branch, hf_u3v_bootstrap_SBRM_Address, tvb, offset, 8, ENC_LITTLE_ENDIAN); break; case U3V_ABRM_DEVICE_CONFIGURATION: proto_tree_add_item(branch, hf_u3v_bootstrap_Device_Configuration, tvb, offset, 8, ENC_LITTLE_ENDIAN); break; case U3V_ABRM_HEARTBEAT_TIMEOUT: proto_tree_add_item(branch, hf_u3v_bootstrap_Heartbeat_Timeout, tvb, offset, 4, ENC_LITTLE_ENDIAN); break; case U3V_ABRM_MESSAGE_CHANNEL_CHANNEL_ID: proto_tree_add_item(branch, hf_u3v_bootstrap_Message_Channel_channel_id, tvb, offset, 4, ENC_LITTLE_ENDIAN); break; case U3V_ABRM_TIMESTAMP: proto_tree_add_item(branch, hf_u3v_bootstrap_Timestamp, tvb, offset, 8, ENC_LITTLE_ENDIAN); break; case U3V_ABRM_TIMESTAMP_LATCH: proto_tree_add_item(branch, hf_u3v_bootstrap_Timestamp_Latch, tvb, offset, 4, ENC_LITTLE_ENDIAN); break; case U3V_ABRM_TIMESTAMP_INCREMENT: proto_tree_add_item(branch, hf_u3v_bootstrap_Timestamp_Increment, tvb, offset, 8, ENC_LITTLE_ENDIAN); break; case U3V_ABRM_ACCESS_PRIVILEGE: proto_tree_add_item(branch, hf_u3v_bootstrap_Access_Privilege, tvb, offset, 4, ENC_LITTLE_ENDIAN); break; case U3V_ABRM_PROTOCOL_ENDIANESS: proto_tree_add_item(branch, hf_u3v_bootstrap_Protocol_Endianess, tvb, offset, 4, ENC_LITTLE_ENDIAN); break; case U3V_ABRM_IMPLEMENTATION_ENDIANESS: proto_tree_add_item(branch, hf_u3v_bootstrap_Implementation_Endianess, tvb, offset, 4, ENC_LITTLE_ENDIAN); break; default: isABRM = FALSE; break; } } if ( u3v_conv_info->sbrm_addr != 0 && (addr >= u3v_conv_info->sbrm_addr)) { guint64 map_offset = addr - u3v_conv_info->sbrm_addr; isSBRM = TRUE; switch(map_offset) { case U3V_SBRM_U3V_VERSION: proto_tree_add_item(branch, hf_u3v_bootstrap_U3V_Version, tvb, offset, 4, ENC_LITTLE_ENDIAN); break; case U3V_SBRM_U3VCP_CAPABILITY_REGISTER: proto_tree_add_item(branch, hf_u3v_bootstrap_U3VCP_Capability_Register, tvb, offset, 8, ENC_LITTLE_ENDIAN); break; case U3V_SBRM_U3VCP_CONFIGURATION_REGISTER: proto_tree_add_item(branch, hf_u3v_bootstrap_U3VCP_Configuration_Register, tvb, offset, 8, ENC_LITTLE_ENDIAN); break; case U3V_SBRM_MAXIMUM_COMMAND_TRANSFER_LENGTH: proto_tree_add_item(branch, hf_u3v_bootstrap_Maximum_Command_Transfer_Length, tvb, offset, 4, ENC_LITTLE_ENDIAN); break; case U3V_SBRM_MAXIMUM_ACKNOWLEDGE_TRANSFER_LENGTH: proto_tree_add_item(branch, hf_u3v_bootstrap_Maximum_Acknowledge_Transfer_Length, tvb, offset, 4, ENC_LITTLE_ENDIAN); break; case U3V_SBRM_NUMBER_OF_STREAM_CHANNELS: proto_tree_add_item(branch, hf_u3v_bootstrap_Number_of_Stream_Channels, tvb, offset, 4, ENC_LITTLE_ENDIAN); break; case U3V_SBRM_SIRM_ADDRESS: proto_tree_add_item(branch, hf_u3v_bootstrap_SIRM_Address, tvb, offset, 8, ENC_LITTLE_ENDIAN); break; case U3V_SBRM_SIRM_LENGTH: proto_tree_add_item(branch, hf_u3v_bootstrap_SIRM_Length, tvb, offset, 4, ENC_LITTLE_ENDIAN); break; case U3V_SBRM_EIRM_ADDRESS: proto_tree_add_item(branch, hf_u3v_bootstrap_EIRM_Address, tvb, offset, 8, ENC_LITTLE_ENDIAN); break; case U3V_SBRM_EIRM_LENGTH: proto_tree_add_item(branch, hf_u3v_bootstrap_EIRM_Length, tvb, offset, 4, ENC_LITTLE_ENDIAN); break; case U3V_SBRM_IIDC2_ADDRESS: proto_tree_add_item(branch, hf_u3v_bootstrap_IIDC2_Address, tvb, offset, 8, ENC_LITTLE_ENDIAN); break; case U3V_SBRM_CURRENT_SPEED: proto_tree_add_item(branch, hf_u3v_bootstrap_Current_Speed, tvb, offset, 4, ENC_LITTLE_ENDIAN); break; default: isSBRM = FALSE; break; } } if ( u3v_conv_info->sirm_addr != 0 && (addr >= u3v_conv_info->sirm_addr)) { guint64 map_offset = addr - u3v_conv_info->sirm_addr; isSIRM = TRUE; switch(map_offset) { case U3V_SIRM_SI_INFO: proto_tree_add_item(branch, hf_u3v_bootstrap_SI_Info, tvb, offset, 4, ENC_LITTLE_ENDIAN); break; case U3V_SIRM_SI_CONTROL: proto_tree_add_item(branch, hf_u3v_bootstrap_SI_Control, tvb, offset, 4, ENC_LITTLE_ENDIAN); break; case U3V_SIRM_SI_REQUIRED_PAYLOAD_SIZE: proto_tree_add_item(branch, hf_u3v_bootstrap_SI_Required_Payload_Size, tvb, offset, 8, ENC_LITTLE_ENDIAN); break; case U3V_SIRM_SI_REQUIRED_LEADER_SIZE: proto_tree_add_item(branch, hf_u3v_bootstrap_SI_Required_Leader_Size, tvb, offset, 4, ENC_LITTLE_ENDIAN); break; case U3V_SIRM_SI_REQUIRED_TRAILER_SIZE: proto_tree_add_item(branch, hf_u3v_bootstrap_SI_Required_Trailer_Size, tvb, offset, 4, ENC_LITTLE_ENDIAN); break; case U3V_SIRM_SI_MAXIMUM_LEADER_SIZE: proto_tree_add_item(branch, hf_u3v_bootstrap_SI_Maximum_Leader_Size, tvb, offset, 4, ENC_LITTLE_ENDIAN); break; case U3V_SIRM_SI_PAYLOAD_TRANSFER_SIZE: proto_tree_add_item(branch, hf_u3v_bootstrap_SI_Payload_Transfer_Size, tvb, offset, 4, ENC_LITTLE_ENDIAN); break; case U3V_SIRM_SI_PAYLOAD_TRANSFER_COUNT: proto_tree_add_item(branch, hf_u3v_bootstrap_SI_Payload_Transfer_Count, tvb, offset, 4, ENC_LITTLE_ENDIAN); break; case U3V_SIRM_SI_PAYLOAD_FINAL_TRANSFER1_SIZE: proto_tree_add_item(branch, hf_u3v_bootstrap_SI_Payload_Final_Transfer1_Size, tvb, offset, 4, ENC_LITTLE_ENDIAN); break; case U3V_SIRM_SI_PAYLOAD_FINAL_TRANSFER2_SIZE: proto_tree_add_item(branch, hf_u3v_bootstrap_SI_Payload_Final_Transfer2_Size, tvb, offset, 4, ENC_LITTLE_ENDIAN); break; case U3V_SIRM_SI_MAXIMUM_TRAILER_SIZE: proto_tree_add_item(branch, hf_u3v_bootstrap_SI_Maximum_Trailer_Size, tvb, offset, 4, ENC_LITTLE_ENDIAN); break; default: isSIRM = FALSE; break; } } if ( u3v_conv_info->eirm_addr != 0 && (addr >= u3v_conv_info->eirm_addr)) { guint64 map_offset = addr -u3v_conv_info->eirm_addr; isEIRM=TRUE; switch(map_offset) { case U3V_EIRM_EI_CONTROL: proto_tree_add_item(branch, hf_u3v_bootstrap_EI_Control, tvb, offset, 4, ENC_LITTLE_ENDIAN); break; case U3V_EIRM_MAXIMUM_EVENT_TRANSFER_LENGTH: proto_tree_add_item(branch, hf_u3v_bootstrap_Maximum_Event_Transfer_Length, tvb, offset, 4, ENC_LITTLE_ENDIAN); break; case U3V_EIRM_EVENT_TEST_CONTROL: proto_tree_add_item(branch, hf_u3v_bootstrap_Event_Test_Control, tvb, offset, 4, ENC_LITTLE_ENDIAN); break; default: isEIRM = FALSE; break; } } if(isABRM || isSBRM || isSIRM || isEIRM ) { return 1; } return 0; } ",0 "static Image *ReadOneJNGImage(MngInfo *mng_info, const ImageInfo *image_info, ExceptionInfo *exception) { Image *alpha_image, *color_image, *image, *jng_image; ImageInfo *alpha_image_info, *color_image_info; MagickBooleanType logging; int unique_filenames; ssize_t y; MagickBooleanType status; png_uint_32 jng_height, jng_width; png_byte jng_color_type, jng_image_sample_depth, jng_image_compression_method, jng_image_interlace_method, jng_alpha_sample_depth, jng_alpha_compression_method, jng_alpha_filter_method, jng_alpha_interlace_method; register const PixelPacket *s; register ssize_t i, x; register PixelPacket *q; register unsigned char *p; unsigned int read_JSEP, reading_idat; size_t length; jng_alpha_compression_method=0; jng_alpha_sample_depth=8; jng_color_type=0; jng_height=0; jng_width=0; alpha_image=(Image *) NULL; color_image=(Image *) NULL; alpha_image_info=(ImageInfo *) NULL; color_image_info=(ImageInfo *) NULL; unique_filenames=0; logging=LogMagickEvent(CoderEvent,GetMagickModule(), "" Enter ReadOneJNGImage()""); image=mng_info->image; if (GetAuthenticPixelQueue(image) != (PixelPacket *) NULL) { /* Allocate next image structure. */ if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" AcquireNextImage()""); AcquireNextImage(image_info,image); if (GetNextImageInList(image) == (Image *) NULL) return(DestroyImageList(image)); image=SyncNextImageInList(image); } mng_info->image=image; /* Signature bytes have already been read. */ read_JSEP=MagickFalse; reading_idat=MagickFalse; for (;;) { char type[MaxTextExtent]; unsigned char *chunk; unsigned int count; /* Read a new JNG chunk. */ status=SetImageProgress(image,LoadImagesTag,TellBlob(image), 2*GetBlobSize(image)); if (status == MagickFalse) break; type[0]='\0'; (void) ConcatenateMagickString(type,""errr"",MaxTextExtent); length=ReadBlobMSBLong(image); count=(unsigned int) ReadBlob(image,4,(unsigned char *) type); if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Reading JNG chunk type %c%c%c%c, length: %.20g"", type[0],type[1],type[2],type[3],(double) length); if (length > PNG_UINT_31_MAX || count == 0) ThrowReaderException(CorruptImageError,""CorruptImage""); p=NULL; chunk=(unsigned char *) NULL; if (length != 0) { chunk=(unsigned char *) AcquireQuantumMemory(length,sizeof(*chunk)); if (chunk == (unsigned char *) NULL) ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); for (i=0; i < (ssize_t) length; i++) { int c; c=ReadBlobByte(image); chunk[i]=(unsigned char) c; } p=chunk; } (void) ReadBlobMSBLong(image); /* read crc word */ if (memcmp(type,mng_JHDR,4) == 0) { if (length == 16) { jng_width=(size_t) ((p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]); jng_height=(size_t) ((p[4] << 24) | (p[5] << 16) | (p[6] << 8) | p[7]); if ((jng_width == 0) || (jng_height == 0)) ThrowReaderException(CorruptImageError,""NegativeOrZeroImageSize""); jng_color_type=p[8]; jng_image_sample_depth=p[9]; jng_image_compression_method=p[10]; jng_image_interlace_method=p[11]; image->interlace=jng_image_interlace_method != 0 ? PNGInterlace : NoInterlace; jng_alpha_sample_depth=p[12]; jng_alpha_compression_method=p[13]; jng_alpha_filter_method=p[14]; jng_alpha_interlace_method=p[15]; if (logging != MagickFalse) { (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" jng_width: %16lu, jng_height: %16lu\n"" "" jng_color_type: %16d, jng_image_sample_depth: %3d\n"" "" jng_image_compression_method:%3d"", (unsigned long) jng_width, (unsigned long) jng_height, jng_color_type, jng_image_sample_depth, jng_image_compression_method); (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" jng_image_interlace_method: %3d"" "" jng_alpha_sample_depth: %3d"", jng_image_interlace_method, jng_alpha_sample_depth); (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" jng_alpha_compression_method:%3d\n"" "" jng_alpha_filter_method: %3d\n"" "" jng_alpha_interlace_method: %3d"", jng_alpha_compression_method, jng_alpha_filter_method, jng_alpha_interlace_method); } } if (length != 0) chunk=(unsigned char *) RelinquishMagickMemory(chunk); continue; } if ((reading_idat == MagickFalse) && (read_JSEP == MagickFalse) && ((memcmp(type,mng_JDAT,4) == 0) || (memcmp(type,mng_JdAA,4) == 0) || (memcmp(type,mng_IDAT,4) == 0) || (memcmp(type,mng_JDAA,4) == 0))) { /* o create color_image o open color_blob, attached to color_image o if (color type has alpha) open alpha_blob, attached to alpha_image */ if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Creating color_blob.""); color_image_info=(ImageInfo *)AcquireMagickMemory(sizeof(ImageInfo)); if (color_image_info == (ImageInfo *) NULL) ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); GetImageInfo(color_image_info); color_image=AcquireImage(color_image_info); if (color_image == (Image *) NULL) ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); (void) AcquireUniqueFilename(color_image->filename); unique_filenames++; status=OpenBlob(color_image_info,color_image,WriteBinaryBlobMode, exception); if (status == MagickFalse) { color_image=DestroyImage(color_image); return(DestroyImageList(image)); } if ((image_info->ping == MagickFalse) && (jng_color_type >= 12)) { alpha_image_info=(ImageInfo *) AcquireMagickMemory(sizeof(ImageInfo)); if (alpha_image_info == (ImageInfo *) NULL) { color_image=DestroyImage(color_image); ThrowReaderException(ResourceLimitError, ""MemoryAllocationFailed""); } GetImageInfo(alpha_image_info); alpha_image=AcquireImage(alpha_image_info); if (alpha_image == (Image *) NULL) { alpha_image_info=DestroyImageInfo(alpha_image_info); color_image=DestroyImage(color_image); ThrowReaderException(ResourceLimitError, ""MemoryAllocationFailed""); } if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Creating alpha_blob.""); (void) AcquireUniqueFilename(alpha_image->filename); unique_filenames++; status=OpenBlob(alpha_image_info,alpha_image,WriteBinaryBlobMode, exception); if (status == MagickFalse) { alpha_image=DestroyImage(alpha_image); alpha_image_info=DestroyImageInfo(alpha_image_info); color_image=DestroyImage(color_image); return(DestroyImageList(image)); } if (jng_alpha_compression_method == 0) { unsigned char data[18]; if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Writing IHDR chunk to alpha_blob.""); (void) WriteBlob(alpha_image,8,(const unsigned char *) ""\211PNG\r\n\032\n""); (void) WriteBlobMSBULong(alpha_image,13L); PNGType(data,mng_IHDR); LogPNGChunk(logging,mng_IHDR,13L); PNGLong(data+4,jng_width); PNGLong(data+8,jng_height); data[12]=jng_alpha_sample_depth; data[13]=0; /* color_type gray */ data[14]=0; /* compression method 0 */ data[15]=0; /* filter_method 0 */ data[16]=0; /* interlace_method 0 */ (void) WriteBlob(alpha_image,17,data); (void) WriteBlobMSBULong(alpha_image,crc32(0,data,17)); } } reading_idat=MagickTrue; } if (memcmp(type,mng_JDAT,4) == 0) { /* Copy chunk to color_image->blob */ if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Copying JDAT chunk data to color_blob.""); if (length != 0) { (void) WriteBlob(color_image,length,chunk); chunk=(unsigned char *) RelinquishMagickMemory(chunk); } continue; } if (memcmp(type,mng_IDAT,4) == 0) { png_byte data[5]; /* Copy IDAT header and chunk data to alpha_image->blob */ if (alpha_image != NULL && image_info->ping == MagickFalse) { if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Copying IDAT chunk data to alpha_blob.""); (void) WriteBlobMSBULong(alpha_image,(size_t) length); PNGType(data,mng_IDAT); LogPNGChunk(logging,mng_IDAT,length); (void) WriteBlob(alpha_image,4,data); (void) WriteBlob(alpha_image,length,chunk); (void) WriteBlobMSBULong(alpha_image, crc32(crc32(0,data,4),chunk,(uInt) length)); } if (length != 0) chunk=(unsigned char *) RelinquishMagickMemory(chunk); continue; } if ((memcmp(type,mng_JDAA,4) == 0) || (memcmp(type,mng_JdAA,4) == 0)) { /* Copy chunk data to alpha_image->blob */ if (alpha_image != NULL && image_info->ping == MagickFalse) { if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Copying JDAA chunk data to alpha_blob.""); (void) WriteBlob(alpha_image,length,chunk); } if (length != 0) chunk=(unsigned char *) RelinquishMagickMemory(chunk); continue; } if (memcmp(type,mng_JSEP,4) == 0) { read_JSEP=MagickTrue; if (length != 0) chunk=(unsigned char *) RelinquishMagickMemory(chunk); continue; } if (memcmp(type,mng_bKGD,4) == 0) { if (length == 2) { image->background_color.red=ScaleCharToQuantum(p[1]); image->background_color.green=image->background_color.red; image->background_color.blue=image->background_color.red; } if (length == 6) { image->background_color.red=ScaleCharToQuantum(p[1]); image->background_color.green=ScaleCharToQuantum(p[3]); image->background_color.blue=ScaleCharToQuantum(p[5]); } chunk=(unsigned char *) RelinquishMagickMemory(chunk); continue; } if (memcmp(type,mng_gAMA,4) == 0) { if (length == 4) image->gamma=((float) mng_get_long(p))*0.00001; chunk=(unsigned char *) RelinquishMagickMemory(chunk); continue; } if (memcmp(type,mng_cHRM,4) == 0) { if (length == 32) { image->chromaticity.white_point.x=0.00001*mng_get_long(p); image->chromaticity.white_point.y=0.00001*mng_get_long(&p[4]); image->chromaticity.red_primary.x=0.00001*mng_get_long(&p[8]); image->chromaticity.red_primary.y=0.00001*mng_get_long(&p[12]); image->chromaticity.green_primary.x=0.00001*mng_get_long(&p[16]); image->chromaticity.green_primary.y=0.00001*mng_get_long(&p[20]); image->chromaticity.blue_primary.x=0.00001*mng_get_long(&p[24]); image->chromaticity.blue_primary.y=0.00001*mng_get_long(&p[28]); } chunk=(unsigned char *) RelinquishMagickMemory(chunk); continue; } if (memcmp(type,mng_sRGB,4) == 0) { if (length == 1) { image->rendering_intent= Magick_RenderingIntent_from_PNG_RenderingIntent(p[0]); image->gamma=1.000f/2.200f; image->chromaticity.red_primary.x=0.6400f; image->chromaticity.red_primary.y=0.3300f; image->chromaticity.green_primary.x=0.3000f; image->chromaticity.green_primary.y=0.6000f; image->chromaticity.blue_primary.x=0.1500f; image->chromaticity.blue_primary.y=0.0600f; image->chromaticity.white_point.x=0.3127f; image->chromaticity.white_point.y=0.3290f; } chunk=(unsigned char *) RelinquishMagickMemory(chunk); continue; } if (memcmp(type,mng_oFFs,4) == 0) { if (length > 8) { image->page.x=(ssize_t) mng_get_long(p); image->page.y=(ssize_t) mng_get_long(&p[4]); if ((int) p[8] != 0) { image->page.x/=10000; image->page.y/=10000; } } if (length != 0) chunk=(unsigned char *) RelinquishMagickMemory(chunk); continue; } if (memcmp(type,mng_pHYs,4) == 0) { if (length > 8) { image->x_resolution=(double) mng_get_long(p); image->y_resolution=(double) mng_get_long(&p[4]); if ((int) p[8] == PNG_RESOLUTION_METER) { image->units=PixelsPerCentimeterResolution; image->x_resolution=image->x_resolution/100.0f; image->y_resolution=image->y_resolution/100.0f; } } chunk=(unsigned char *) RelinquishMagickMemory(chunk); continue; } #if 0 if (memcmp(type,mng_iCCP,4) == 0) { /* To do: */ if (length != 0) chunk=(unsigned char *) RelinquishMagickMemory(chunk); continue; } #endif if (length != 0) chunk=(unsigned char *) RelinquishMagickMemory(chunk); if (memcmp(type,mng_IEND,4)) continue; break; } /* IEND found */ /* Finish up reading image data: o read main image from color_blob. o close color_blob. o if (color_type has alpha) if alpha_encoding is PNG read secondary image from alpha_blob via ReadPNG if alpha_encoding is JPEG read secondary image from alpha_blob via ReadJPEG o close alpha_blob. o copy intensity of secondary image into opacity samples of main image. o destroy the secondary image. */ if (color_image_info == (ImageInfo *) NULL) { assert(color_image == (Image *) NULL); assert(alpha_image == (Image *) NULL); return(DestroyImageList(image)); } if (color_image == (Image *) NULL) { assert(alpha_image == (Image *) NULL); return(DestroyImageList(image)); } (void) SeekBlob(color_image,0,SEEK_SET); if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Reading jng_image from color_blob.""); assert(color_image_info != (ImageInfo *) NULL); (void) FormatLocaleString(color_image_info->filename,MaxTextExtent,""%s"", color_image->filename); color_image_info->ping=MagickFalse; /* To do: avoid this */ jng_image=ReadImage(color_image_info,exception); (void) RelinquishUniqueFileResource(color_image->filename); unique_filenames--; color_image=DestroyImage(color_image); color_image_info=DestroyImageInfo(color_image_info); if (jng_image == (Image *) NULL) return(DestroyImageList(image)); if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Copying jng_image pixels to main image.""); image->columns=jng_width; image->rows=jng_height; length=image->columns*sizeof(PixelPacket); status=SetImageExtent(image,image->columns,image->rows); if (status == MagickFalse) { InheritException(exception,&image->exception); return(DestroyImageList(image)); } for (y=0; y < (ssize_t) image->rows; y++) { s=GetVirtualPixels(jng_image,0,y,image->columns,1,&image->exception); q=GetAuthenticPixels(image,0,y,image->columns,1,exception); (void) CopyMagickMemory(q,s,length); if (SyncAuthenticPixels(image,exception) == MagickFalse) break; } jng_image=DestroyImage(jng_image); if (image_info->ping == MagickFalse) { if (jng_color_type >= 12) { if (jng_alpha_compression_method == 0) { png_byte data[5]; (void) WriteBlobMSBULong(alpha_image,0x00000000L); PNGType(data,mng_IEND); LogPNGChunk(logging,mng_IEND,0L); (void) WriteBlob(alpha_image,4,data); (void) WriteBlobMSBULong(alpha_image,crc32(0,data,4)); } (void) SeekBlob(alpha_image,0,SEEK_SET); if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Reading opacity from alpha_blob.""); (void) FormatLocaleString(alpha_image_info->filename,MaxTextExtent, ""%s"",alpha_image->filename); jng_image=ReadImage(alpha_image_info,exception); if (jng_image != (Image *) NULL) for (y=0; y < (ssize_t) image->rows; y++) { s=GetVirtualPixels(jng_image,0,y,image->columns,1, &image->exception); q=GetAuthenticPixels(image,0,y,image->columns,1,exception); if (image->matte != MagickFalse) for (x=(ssize_t) image->columns; x != 0; x--,q++,s++) SetPixelOpacity(q,QuantumRange- GetPixelRed(s)); else for (x=(ssize_t) image->columns; x != 0; x--,q++,s++) { SetPixelAlpha(q,GetPixelRed(s)); if (GetPixelOpacity(q) != OpaqueOpacity) image->matte=MagickTrue; } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; } (void) RelinquishUniqueFileResource(alpha_image->filename); unique_filenames--; alpha_image=DestroyImage(alpha_image); alpha_image_info=DestroyImageInfo(alpha_image_info); if (jng_image != (Image *) NULL) jng_image=DestroyImage(jng_image); } } /* Read the JNG image. */ if (mng_info->mng_type == 0) { mng_info->mng_width=jng_width; mng_info->mng_height=jng_height; } if (image->page.width == 0 && image->page.height == 0) { image->page.width=jng_width; image->page.height=jng_height; } if (image->page.x == 0 && image->page.y == 0) { image->page.x=mng_info->x_off[mng_info->object_id]; image->page.y=mng_info->y_off[mng_info->object_id]; } else { image->page.y=mng_info->y_off[mng_info->object_id]; } mng_info->image_found++; status=SetImageProgress(image,LoadImagesTag,2*TellBlob(image), 2*GetBlobSize(image)); if (status == MagickFalse) return(DestroyImageList(image)); if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" exit ReadOneJNGImage(); unique_filenames=%d"",unique_filenames); return(image); } ",1 " ~DownloadFileManagerTest() { } ",0 "static int v9fs_mark_fids_unreclaim(V9fsPDU *pdu, V9fsPath *path) { int err; V9fsState *s = pdu->s; V9fsFidState *fidp, head_fid; head_fid.next = s->fid_list; for (fidp = s->fid_list; fidp; fidp = fidp->next) { if (fidp->path.size != path->size) { continue; } if (!memcmp(fidp->path.data, path->data, path->size)) { /* Mark the fid non reclaimable. */ fidp->flags |= FID_NON_RECLAIMABLE; /* reopen the file/dir if already closed */ err = v9fs_reopen_fid(pdu, fidp); if (err < 0) { return -1; } /* * Go back to head of fid list because * the list could have got updated when * switched to the worker thread */ if (err == 0) { fidp = &head_fid; } } } return 0; } ",0 "update_info_linux_dmmp (Device *device) { const gchar *dm_name; const gchar* const *target_types; const gchar* const *target_parameters; gchar *decoded_params; gboolean is_dmmp; guint n; GPtrArray *p; Device *component; gchar *s; is_dmmp = FALSE; p = NULL; decoded_params = NULL; dm_name = g_udev_device_get_property (device->priv->d, ""DM_NAME""); if (dm_name == NULL) goto out; target_types = g_udev_device_get_property_as_strv (device->priv->d, ""UDISKS_DM_TARGETS_TYPE""); if (target_types == NULL || g_strcmp0 (target_types[0], ""multipath"") != 0) goto out; if (device->priv->slaves_objpath->len == 0) goto out; target_parameters = g_udev_device_get_property_as_strv (device->priv->d, ""UDISKS_DM_TARGETS_PARAMS""); if (target_parameters == NULL || g_strv_length ((gchar **) target_parameters) != 1) goto out; decoded_params = decode_udev_encoded_string (target_parameters[0]); device_set_linux_dmmp_name (device, dm_name); device_set_linux_dmmp_parameters (device, decoded_params); p = g_ptr_array_new (); component = NULL; for (n = 0; n < device->priv->slaves_objpath->len; n++) { const gchar *component_objpath = device->priv->slaves_objpath->pdata[n]; if (component == NULL) { component = daemon_local_find_by_object_path (device->priv->daemon, component_objpath); } g_ptr_array_add (p, (gpointer) component_objpath); } g_ptr_array_add (p, NULL); device_set_linux_dmmp_slaves (device, (GStrv) p->pdata); if (component == NULL) goto out; /* Copy only drive properties used for identification to the multipath device. Yes, * this means, we'll get serial/wwn clashes but this is already so for each path. * * Also, clients *should* be smart about things and special-handle linux_dmmp and * linux_dmmp_component devices. */ device_set_drive_vendor (device, component->priv->drive_vendor); device_set_drive_model (device, component->priv->drive_model); device_set_drive_revision (device, component->priv->drive_revision); device_set_drive_serial (device, component->priv->drive_serial); device_set_drive_wwn (device, component->priv->drive_wwn); /* connection interface */ device_set_drive_connection_interface (device, ""virtual_multipath""); device_set_drive_connection_speed (device, 0); s = g_strdup_printf (""/dev/mapper/%s"", dm_name); device_set_device_file_presentation (device, s); g_free (s); is_dmmp = TRUE; out: g_free (decoded_params); if (p != NULL) g_ptr_array_free (p, TRUE); device_set_device_is_linux_dmmp (device, is_dmmp); return TRUE; } ",0 "vol_print(netdissect_options *ndo, register const u_char *bp, int length) { int vol_op; if (length <= (int)sizeof(struct rx_header)) return; if (ndo->ndo_snapend - bp + 1 <= (int)(sizeof(struct rx_header) + sizeof(int32_t))) { goto trunc; } /* * Print out the afs call we're invoking. The table used here was * gleaned from volser/volint.xg */ vol_op = EXTRACT_32BITS(bp + sizeof(struct rx_header)); ND_PRINT((ndo, "" vol call %s"", tok2str(vol_req, ""op#%d"", vol_op))); bp += sizeof(struct rx_header) + 4; switch (vol_op) { case 100: /* Create volume */ ND_PRINT((ndo, "" partition"")); UINTOUT(); ND_PRINT((ndo, "" name"")); STROUT(AFSNAMEMAX); ND_PRINT((ndo, "" type"")); UINTOUT(); ND_PRINT((ndo, "" parent"")); UINTOUT(); break; case 101: /* Delete volume */ case 107: /* Get flags */ ND_PRINT((ndo, "" trans"")); UINTOUT(); break; case 102: /* Restore */ ND_PRINT((ndo, "" totrans"")); UINTOUT(); ND_PRINT((ndo, "" flags"")); UINTOUT(); break; case 103: /* Forward */ ND_PRINT((ndo, "" fromtrans"")); UINTOUT(); ND_PRINT((ndo, "" fromdate"")); DATEOUT(); DESTSERVEROUT(); ND_PRINT((ndo, "" desttrans"")); INTOUT(); break; case 104: /* End trans */ ND_PRINT((ndo, "" trans"")); UINTOUT(); break; case 105: /* Clone */ ND_PRINT((ndo, "" trans"")); UINTOUT(); ND_PRINT((ndo, "" purgevol"")); UINTOUT(); ND_PRINT((ndo, "" newtype"")); UINTOUT(); ND_PRINT((ndo, "" newname"")); STROUT(AFSNAMEMAX); break; case 106: /* Set flags */ ND_PRINT((ndo, "" trans"")); UINTOUT(); ND_PRINT((ndo, "" flags"")); UINTOUT(); break; case 108: /* Trans create */ ND_PRINT((ndo, "" vol"")); UINTOUT(); ND_PRINT((ndo, "" partition"")); UINTOUT(); ND_PRINT((ndo, "" flags"")); UINTOUT(); break; case 109: /* Dump */ case 655537: /* Get size */ ND_PRINT((ndo, "" fromtrans"")); UINTOUT(); ND_PRINT((ndo, "" fromdate"")); DATEOUT(); break; case 110: /* Get n-th volume */ ND_PRINT((ndo, "" index"")); UINTOUT(); break; case 111: /* Set forwarding */ ND_PRINT((ndo, "" tid"")); UINTOUT(); ND_PRINT((ndo, "" newsite"")); UINTOUT(); break; case 112: /* Get name */ case 113: /* Get status */ ND_PRINT((ndo, "" tid"")); break; case 114: /* Signal restore */ ND_PRINT((ndo, "" name"")); STROUT(AFSNAMEMAX); ND_PRINT((ndo, "" type"")); UINTOUT(); ND_PRINT((ndo, "" pid"")); UINTOUT(); ND_PRINT((ndo, "" cloneid"")); UINTOUT(); break; case 116: /* List volumes */ ND_PRINT((ndo, "" partition"")); UINTOUT(); ND_PRINT((ndo, "" flags"")); UINTOUT(); break; case 117: /* Set id types */ ND_PRINT((ndo, "" tid"")); UINTOUT(); ND_PRINT((ndo, "" name"")); STROUT(AFSNAMEMAX); ND_PRINT((ndo, "" type"")); UINTOUT(); ND_PRINT((ndo, "" pid"")); UINTOUT(); ND_PRINT((ndo, "" clone"")); UINTOUT(); ND_PRINT((ndo, "" backup"")); UINTOUT(); break; case 119: /* Partition info */ ND_PRINT((ndo, "" name"")); STROUT(AFSNAMEMAX); break; case 120: /* Reclone */ ND_PRINT((ndo, "" tid"")); UINTOUT(); break; case 121: /* List one volume */ case 122: /* Nuke volume */ case 124: /* Extended List volumes */ case 125: /* Extended List one volume */ case 65536: /* Convert RO to RW volume */ ND_PRINT((ndo, "" partid"")); UINTOUT(); ND_PRINT((ndo, "" volid"")); UINTOUT(); break; case 123: /* Set date */ ND_PRINT((ndo, "" tid"")); UINTOUT(); ND_PRINT((ndo, "" date"")); DATEOUT(); break; case 126: /* Set info */ ND_PRINT((ndo, "" tid"")); UINTOUT(); break; case 128: /* Forward multiple */ ND_PRINT((ndo, "" fromtrans"")); UINTOUT(); ND_PRINT((ndo, "" fromdate"")); DATEOUT(); { unsigned long i, j; ND_TCHECK2(bp[0], 4); j = EXTRACT_32BITS(bp); bp += sizeof(int32_t); for (i = 0; i < j; i++) { DESTSERVEROUT(); if (i != j - 1) ND_PRINT((ndo, "","")); } if (j == 0) ND_PRINT((ndo, "" "")); } break; case 65538: /* Dump version 2 */ ND_PRINT((ndo, "" fromtrans"")); UINTOUT(); ND_PRINT((ndo, "" fromdate"")); DATEOUT(); ND_PRINT((ndo, "" flags"")); UINTOUT(); break; default: ; } return; trunc: ND_PRINT((ndo, "" [|vol]"")); } ",0 "void BookmarkManagerView::SelectInTree(BookmarkNode* node) { if (!node) return; BookmarkNode* parent = node->is_url() ? node->GetParent() : node; FolderNode* folder_node = tree_model_->GetFolderNodeForBookmarkNode(parent); if (!folder_node) { NOTREACHED(); return; } tree_view_->SetSelectedNode(folder_node); if (node->is_url()) { int index = table_model_->IndexOfNode(node); if (index != -1) table_view_->Select(index); table_view_->RequestFocus(); } } ",0 "crm_xml_init(void) { static bool init = TRUE; if(init) { init = FALSE; /* The default allocator XML_BUFFER_ALLOC_EXACT does far too many * realloc_safe()s and it can take upwards of 18 seconds (yes, seconds) * to dump a 28kb tree which XML_BUFFER_ALLOC_DOUBLEIT can do in * less than 1 second. */ xmlSetBufferAllocationScheme(XML_BUFFER_ALLOC_DOUBLEIT); /* Populate and free the _private field when nodes are created and destroyed */ xmlDeregisterNodeDefault(pcmkDeregisterNode); xmlRegisterNodeDefault(pcmkRegisterNode); __xml_build_schema_list(); } } ",0 "static long calc_group_shares(struct cfs_rq *cfs_rq) { long tg_weight, tg_shares, load, shares; struct task_group *tg = cfs_rq->tg; tg_shares = READ_ONCE(tg->shares); load = max(scale_load_down(cfs_rq->load.weight), cfs_rq->avg.load_avg); tg_weight = atomic_long_read(&tg->load_avg); /* Ensure tg_weight >= load */ tg_weight -= cfs_rq->tg_load_avg_contrib; tg_weight += load; shares = (tg_shares * load); if (tg_weight) shares /= tg_weight; /* * MIN_SHARES has to be unscaled here to support per-CPU partitioning * of a group with small tg->shares value. It is a floor value which is * assigned as a minimum load.weight to the sched_entity representing * the group on a CPU. * * E.g. on 64-bit for a group with tg->shares of scale_load(15)=15*1024 * on an 8-core system with 8 tasks each runnable on one CPU shares has * to be 15*1024*1/8=1920 instead of scale_load(MIN_SHARES)=2*1024. In * case no task is runnable on a CPU MIN_SHARES=2 should be returned * instead of 0. */ return clamp_t(long, shares, MIN_SHARES, tg_shares); } ",0 "void TemplateURL::SetPrepopulateId(int id) { data_.prepopulate_id = id; const bool prepopulated = id > 0; for (TemplateURLRef& ref : url_refs_) ref.prepopulated_ = prepopulated; suggestions_url_ref_.prepopulated_ = prepopulated; instant_url_ref_.prepopulated_ = prepopulated; image_url_ref_.prepopulated_ = prepopulated; new_tab_url_ref_.prepopulated_ = prepopulated; contextual_search_url_ref_.prepopulated_ = prepopulated; } ",0 "static int ext4_ext_convert_to_initialized(handle_t *handle, struct inode *inode, struct ext4_map_blocks *map, struct ext4_ext_path *path) { struct ext4_sb_info *sbi; struct ext4_extent_header *eh; struct ext4_map_blocks split_map; struct ext4_extent zero_ex; struct ext4_extent *ex; ext4_lblk_t ee_block, eof_block; unsigned int ee_len, depth; int allocated, max_zeroout = 0; int err = 0; int split_flag = 0; ext_debug(""ext4_ext_convert_to_initialized: inode %lu, logical"" ""block %llu, max_blocks %u\n"", inode->i_ino, (unsigned long long)map->m_lblk, map->m_len); sbi = EXT4_SB(inode->i_sb); eof_block = (inode->i_size + inode->i_sb->s_blocksize - 1) >> inode->i_sb->s_blocksize_bits; if (eof_block < map->m_lblk + map->m_len) eof_block = map->m_lblk + map->m_len; depth = ext_depth(inode); eh = path[depth].p_hdr; ex = path[depth].p_ext; ee_block = le32_to_cpu(ex->ee_block); ee_len = ext4_ext_get_actual_len(ex); allocated = ee_len - (map->m_lblk - ee_block); trace_ext4_ext_convert_to_initialized_enter(inode, map, ex); /* Pre-conditions */ BUG_ON(!ext4_ext_is_uninitialized(ex)); BUG_ON(!in_range(map->m_lblk, ee_block, ee_len)); /* * Attempt to transfer newly initialized blocks from the currently * uninitialized extent to its left neighbor. This is much cheaper * than an insertion followed by a merge as those involve costly * memmove() calls. This is the common case in steady state for * workloads doing fallocate(FALLOC_FL_KEEP_SIZE) followed by append * writes. * * Limitations of the current logic: * - L1: we only deal with writes at the start of the extent. * The approach could be extended to writes at the end * of the extent but this scenario was deemed less common. * - L2: we do not deal with writes covering the whole extent. * This would require removing the extent if the transfer * is possible. * - L3: we only attempt to merge with an extent stored in the * same extent tree node. */ if ((map->m_lblk == ee_block) && /*L1*/ (map->m_len < ee_len) && /*L2*/ (ex > EXT_FIRST_EXTENT(eh))) { /*L3*/ struct ext4_extent *prev_ex; ext4_lblk_t prev_lblk; ext4_fsblk_t prev_pblk, ee_pblk; unsigned int prev_len, write_len; prev_ex = ex - 1; prev_lblk = le32_to_cpu(prev_ex->ee_block); prev_len = ext4_ext_get_actual_len(prev_ex); prev_pblk = ext4_ext_pblock(prev_ex); ee_pblk = ext4_ext_pblock(ex); write_len = map->m_len; /* * A transfer of blocks from 'ex' to 'prev_ex' is allowed * upon those conditions: * - C1: prev_ex is initialized, * - C2: prev_ex is logically abutting ex, * - C3: prev_ex is physically abutting ex, * - C4: prev_ex can receive the additional blocks without * overflowing the (initialized) length limit. */ if ((!ext4_ext_is_uninitialized(prev_ex)) && /*C1*/ ((prev_lblk + prev_len) == ee_block) && /*C2*/ ((prev_pblk + prev_len) == ee_pblk) && /*C3*/ (prev_len < (EXT_INIT_MAX_LEN - write_len))) { /*C4*/ err = ext4_ext_get_access(handle, inode, path + depth); if (err) goto out; trace_ext4_ext_convert_to_initialized_fastpath(inode, map, ex, prev_ex); /* Shift the start of ex by 'write_len' blocks */ ex->ee_block = cpu_to_le32(ee_block + write_len); ext4_ext_store_pblock(ex, ee_pblk + write_len); ex->ee_len = cpu_to_le16(ee_len - write_len); ext4_ext_mark_uninitialized(ex); /* Restore the flag */ /* Extend prev_ex by 'write_len' blocks */ prev_ex->ee_len = cpu_to_le16(prev_len + write_len); /* Mark the block containing both extents as dirty */ ext4_ext_dirty(handle, inode, path + depth); /* Update path to point to the right extent */ path[depth].p_ext = prev_ex; /* Result: number of initialized blocks past m_lblk */ allocated = write_len; goto out; } } WARN_ON(map->m_lblk < ee_block); /* * It is safe to convert extent to initialized via explicit * zeroout only if extent is fully insde i_size or new_size. */ split_flag |= ee_block + ee_len <= eof_block ? EXT4_EXT_MAY_ZEROOUT : 0; if (EXT4_EXT_MAY_ZEROOUT & split_flag) max_zeroout = sbi->s_extent_max_zeroout_kb >> inode->i_sb->s_blocksize_bits; /* If extent is less than s_max_zeroout_kb, zeroout directly */ if (max_zeroout && (ee_len <= max_zeroout)) { err = ext4_ext_zeroout(inode, ex); if (err) goto out; err = ext4_ext_get_access(handle, inode, path + depth); if (err) goto out; ext4_ext_mark_initialized(ex); ext4_ext_try_to_merge(handle, inode, path, ex); err = ext4_ext_dirty(handle, inode, path + path->p_depth); goto out; } /* * four cases: * 1. split the extent into three extents. * 2. split the extent into two extents, zeroout the first half. * 3. split the extent into two extents, zeroout the second half. * 4. split the extent into two extents with out zeroout. */ split_map.m_lblk = map->m_lblk; split_map.m_len = map->m_len; if (max_zeroout && (allocated > map->m_len)) { if (allocated <= max_zeroout) { /* case 3 */ zero_ex.ee_block = cpu_to_le32(map->m_lblk); zero_ex.ee_len = cpu_to_le16(allocated); ext4_ext_store_pblock(&zero_ex, ext4_ext_pblock(ex) + map->m_lblk - ee_block); err = ext4_ext_zeroout(inode, &zero_ex); if (err) goto out; split_map.m_lblk = map->m_lblk; split_map.m_len = allocated; } else if (map->m_lblk - ee_block + map->m_len < max_zeroout) { /* case 2 */ if (map->m_lblk != ee_block) { zero_ex.ee_block = ex->ee_block; zero_ex.ee_len = cpu_to_le16(map->m_lblk - ee_block); ext4_ext_store_pblock(&zero_ex, ext4_ext_pblock(ex)); err = ext4_ext_zeroout(inode, &zero_ex); if (err) goto out; } split_map.m_lblk = ee_block; split_map.m_len = map->m_lblk - ee_block + map->m_len; allocated = map->m_len; } } allocated = ext4_split_extent(handle, inode, path, &split_map, split_flag, 0); if (allocated < 0) err = allocated; out: return err ? err : allocated; } ",0 "std::unique_ptr BlobStorageContext::CreateHandle( const std::string& uuid, BlobEntry* entry) { return base::WrapUnique(new BlobDataHandle( uuid, entry->content_type_, entry->content_disposition_, entry->size_, this, base::ThreadTaskRunnerHandle::Get().get())); } ",0 " static void CreateLoaderAndStart( RenderProcessHost* process, int route_id, int request_id, const network::ResourceRequest& resource_request) { network::mojom::URLLoaderPtr loader; network::TestURLLoaderClient client; CreateLoaderAndStart(process, mojo::MakeRequest(&loader), route_id, request_id, resource_request, client.CreateInterfacePtr().PassInterface()); } ",0 "void QQuickWebViewPrivate::updateUserScripts() { Vector scripts; scripts.reserveCapacity(userScripts.size()); for (unsigned i = 0; i < userScripts.size(); ++i) { const QUrl& url = userScripts.at(i); if (!url.isValid()) { qWarning(""QQuickWebView: Couldn't open '%s' as user script because URL is invalid."", qPrintable(url.toString())); continue; } QString contents = readUserScript(url); if (contents.isEmpty()) continue; scripts.append(String(contents)); } webPageProxy->setUserScripts(scripts); } ",0 "static int hub_hub_status(struct usb_hub *hub, u16 *status, u16 *change) { int ret; mutex_lock(&hub->status_mutex); ret = get_hub_status(hub->hdev, &hub->status->hub); if (ret < 0) { if (ret != -ENODEV) dev_err(hub->intfdev, ""%s failed (err = %d)\n"", __func__, ret); } else { *status = le16_to_cpu(hub->status->hub.wHubStatus); *change = le16_to_cpu(hub->status->hub.wHubChange); ret = 0; } mutex_unlock(&hub->status_mutex); return ret; } ",0 "void Document::updateTitle(const String& title) { if (m_rawTitle == title) return; m_rawTitle = title; String oldTitle = m_title; if (m_rawTitle.isEmpty()) m_title = String(); else if (m_rawTitle.is8Bit()) m_title = canonicalizedTitle(this, m_rawTitle); else m_title = canonicalizedTitle(this, m_rawTitle); if (!m_frame || oldTitle == m_title) return; m_frame->loader().client()->dispatchDidReceiveTitle(m_title); } ",0 "int RenderProcessHostImpl::GetNextRoutingID() { return widget_helper_->GetNextRoutingID(); } ",0 "void ImageLoader::updatedHasPendingEvent() { bool wasProtected = m_elementIsProtected; m_elementIsProtected = m_hasPendingLoadEvent || m_hasPendingErrorEvent; if (wasProtected == m_elementIsProtected) return; if (m_elementIsProtected) { if (m_derefElementTimer.isActive()) m_derefElementTimer.stop(); else m_keepAlive = m_element; } else { DCHECK(!m_derefElementTimer.isActive()); m_derefElementTimer.startOneShot(0, BLINK_FROM_HERE); } } ",0 "bool SendMouseDragJSONRequest( AutomationMessageSender* sender, int browser_index, int tab_index, int start_x, int start_y, int end_x, int end_y, std::string* error_msg) { DictionaryValue dict; dict.SetString(""command"", ""WebkitMouseDrag""); dict.SetInteger(""windex"", browser_index); dict.SetInteger(""tab_index"", tab_index); dict.SetInteger(""start_x"", start_x); dict.SetInteger(""start_y"", start_y); dict.SetInteger(""end_x"", end_x); dict.SetInteger(""end_y"", end_y); DictionaryValue reply_dict; return SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg); } ",0 " RenderWidgetHostViewAura* tab_view() const { return view_; } ",0 "static void vmx_set_msr_bitmap(struct kvm_vcpu *vcpu) { unsigned long *msr_bitmap; if (irqchip_in_kernel(vcpu->kvm) && apic_x2apic_mode(vcpu->arch.apic)) { if (is_long_mode(vcpu)) msr_bitmap = vmx_msr_bitmap_longmode_x2apic; else msr_bitmap = vmx_msr_bitmap_legacy_x2apic; } else { if (is_long_mode(vcpu)) msr_bitmap = vmx_msr_bitmap_longmode; else msr_bitmap = vmx_msr_bitmap_legacy; } vmcs_write64(MSR_BITMAP, __pa(msr_bitmap)); } ",0 "static int mov_write_gmhd_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = avio_tell(pb); avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, ""gmhd""); avio_wb32(pb, 0x18); /* gmin size */ ffio_wfourcc(pb, ""gmin"");/* generic media info */ avio_wb32(pb, 0); /* version & flags */ avio_wb16(pb, 0x40); /* graphics mode = */ avio_wb16(pb, 0x8000); /* opColor (r?) */ avio_wb16(pb, 0x8000); /* opColor (g?) */ avio_wb16(pb, 0x8000); /* opColor (b?) */ avio_wb16(pb, 0); /* balance */ avio_wb16(pb, 0); /* reserved */ /* * This special text atom is required for * Apple Quicktime chapters. The contents * don't appear to be documented, so the * bytes are copied verbatim. */ if (track->tag != MKTAG('c','6','0','8')) { avio_wb32(pb, 0x2C); /* size */ ffio_wfourcc(pb, ""text""); avio_wb16(pb, 0x01); avio_wb32(pb, 0x00); avio_wb32(pb, 0x00); avio_wb32(pb, 0x00); avio_wb32(pb, 0x01); avio_wb32(pb, 0x00); avio_wb32(pb, 0x00); avio_wb32(pb, 0x00); avio_wb32(pb, 0x00004000); avio_wb16(pb, 0x0000); } if (track->par->codec_tag == MKTAG('t','m','c','d')) { int64_t tmcd_pos = avio_tell(pb); avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, ""tmcd""); mov_write_tcmi_tag(pb, track); update_size(pb, tmcd_pos); } else if (track->par->codec_tag == MKTAG('g','p','m','d')) { int64_t gpmd_pos = avio_tell(pb); avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, ""gpmd""); avio_wb32(pb, 0); /* version */ update_size(pb, gpmd_pos); } return update_size(pb, pos); } ",0 "PHP_FUNCTION(openssl_public_encrypt) { zval *key, *crypted; EVP_PKEY *pkey; int cryptedlen; zend_string *cryptedbuf; int successful = 0; zend_resource *keyresource = NULL; zend_long padding = RSA_PKCS1_PADDING; char * data; size_t data_len; if (zend_parse_parameters(ZEND_NUM_ARGS(), ""sz/z|l"", &data, &data_len, &crypted, &key, &padding) == FAILURE) return; RETVAL_FALSE; pkey = php_openssl_evp_from_zval(key, 1, NULL, 0, 0, &keyresource); if (pkey == NULL) { php_error_docref(NULL, E_WARNING, ""key parameter is not a valid public key""); RETURN_FALSE; } PHP_OPENSSL_CHECK_SIZE_T_TO_INT(data_len, data); cryptedlen = EVP_PKEY_size(pkey); cryptedbuf = zend_string_alloc(cryptedlen, 0); switch (EVP_PKEY_id(pkey)) { case EVP_PKEY_RSA: case EVP_PKEY_RSA2: successful = (RSA_public_encrypt((int)data_len, (unsigned char *)data, (unsigned char *)ZSTR_VAL(cryptedbuf), EVP_PKEY_get0_RSA(pkey), (int)padding) == cryptedlen); break; default: php_error_docref(NULL, E_WARNING, ""key type not supported in this PHP build!""); } if (successful) { zval_dtor(crypted); ZSTR_VAL(cryptedbuf)[cryptedlen] = '\0'; ZVAL_NEW_STR(crypted, cryptedbuf); cryptedbuf = NULL; RETVAL_TRUE; } else { php_openssl_store_errors(); } if (keyresource == NULL) { EVP_PKEY_free(pkey); } if (cryptedbuf) { zend_string_release(cryptedbuf); } } ",0 "Node* TextIterator::node() const { RefPtr textRange = range(); if (!textRange) return 0; Node* node = textRange->startContainer(); if (!node) return 0; if (node->offsetInCharacters()) return node; return node->childNode(textRange->startOffset()); } ",0 "Compositor* Compositor::Create(CompositorClient* client, gfx::NativeWindow root_window) { return client ? new CompositorImpl(client, root_window) : NULL; } ",0 "static void encrypt_callback(void *priv, u8 *srcdst, unsigned int nbytes) { const unsigned int bsize = SERPENT_BLOCK_SIZE; struct crypt_priv *ctx = priv; int i; ctx->fpu_enabled = serpent_fpu_begin(ctx->fpu_enabled, nbytes); if (nbytes >= SERPENT_AVX2_PARALLEL_BLOCKS * bsize) { serpent_ecb_enc_16way(ctx->ctx, srcdst, srcdst); srcdst += bsize * SERPENT_AVX2_PARALLEL_BLOCKS; nbytes -= bsize * SERPENT_AVX2_PARALLEL_BLOCKS; } while (nbytes >= SERPENT_PARALLEL_BLOCKS * bsize) { serpent_ecb_enc_8way_avx(ctx->ctx, srcdst, srcdst); srcdst += bsize * SERPENT_PARALLEL_BLOCKS; nbytes -= bsize * SERPENT_PARALLEL_BLOCKS; } for (i = 0; i < nbytes / bsize; i++, srcdst += bsize) __serpent_encrypt(ctx->ctx, srcdst, srcdst); } ",0 "set_default_smtp_connection_timeout(data_t * data) { data->smtp_connection_to = DEFAULT_SMTP_CONNECTION_TIMEOUT; } ",0 "ssh_packet_write_poll(struct ssh *ssh) { struct session_state *state = ssh->state; int len = sshbuf_len(state->output); int r; if (len > 0) { len = write(state->connection_out, sshbuf_ptr(state->output), len); if (len == -1) { if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK) return 0; return SSH_ERR_SYSTEM_ERROR; } if (len == 0) return SSH_ERR_CONN_CLOSED; if ((r = sshbuf_consume(state->output, len)) != 0) return r; } return 0; } ",0 "int gdImageColorExact (gdImagePtr im, int r, int g, int b) { return gdImageColorExactAlpha (im, r, g, b, gdAlphaOpaque); } ",0 "static int sctp_setsockopt_default_sndinfo(struct sock *sk, char __user *optval, unsigned int optlen) { struct sctp_sock *sp = sctp_sk(sk); struct sctp_association *asoc; struct sctp_sndinfo info; if (optlen != sizeof(info)) return -EINVAL; if (copy_from_user(&info, optval, optlen)) return -EFAULT; if (info.snd_flags & ~(SCTP_UNORDERED | SCTP_ADDR_OVER | SCTP_ABORT | SCTP_EOF)) return -EINVAL; asoc = sctp_id2assoc(sk, info.snd_assoc_id); if (!asoc && info.snd_assoc_id && sctp_style(sk, UDP)) return -EINVAL; if (asoc) { asoc->default_stream = info.snd_sid; asoc->default_flags = info.snd_flags; asoc->default_ppid = info.snd_ppid; asoc->default_context = info.snd_context; } else { sp->default_stream = info.snd_sid; sp->default_flags = info.snd_flags; sp->default_ppid = info.snd_ppid; sp->default_context = info.snd_context; } return 0; } ",0 "bool Element::webkitMatchesSelector(const String& selector, ExceptionCode& ec) { if (selector.isEmpty()) { ec = SYNTAX_ERR; return false; } SelectorQuery* selectorQuery = document()->selectorQueryCache()->add(selector, document(), ec); if (!selectorQuery) return false; return selectorQuery->matches(this); } ",0 "DevToolsWindow* DevToolsWindow::FindDevToolsWindow( DevToolsAgentHost* agent_host) { if (!agent_host || g_instances == NULL) return NULL; DevToolsWindows* instances = g_instances.Pointer(); for (DevToolsWindows::iterator it(instances->begin()); it != instances->end(); ++it) { if ((*it)->bindings_->IsAttachedTo(agent_host)) return *it; } return NULL; } ",0 "static void timer_config_save(UNUSED_ATTR void *data) { assert(config != NULL); assert(alarm_timer != NULL); static const size_t CACHE_MAX = 256; const char *keys[CACHE_MAX]; size_t num_keys = 0; size_t total_candidates = 0; pthread_mutex_lock(&lock); for (const config_section_node_t *snode = config_section_begin(config); snode != config_section_end(config); snode = config_section_next(snode)) { const char *section = config_section_name(snode); if (!string_is_bdaddr(section)) continue; if (config_has_key(config, section, ""LinkKey"") || config_has_key(config, section, ""LE_KEY_PENC"") || config_has_key(config, section, ""LE_KEY_PID"") || config_has_key(config, section, ""LE_KEY_PCSRK"") || config_has_key(config, section, ""LE_KEY_LENC"") || config_has_key(config, section, ""LE_KEY_LCSRK"")) continue; if (num_keys < CACHE_MAX) keys[num_keys++] = section; ++total_candidates; } if (total_candidates > CACHE_MAX * 2) while (num_keys > 0) config_remove_section(config, keys[--num_keys]); config_save(config, CONFIG_FILE_PATH); pthread_mutex_unlock(&lock); } ",1 "void ScriptProcessorHandler::SetChannelCount(unsigned long channel_count, ExceptionState& exception_state) { DCHECK(IsMainThread()); BaseAudioContext::GraphAutoLocker locker(Context()); if (channel_count != channel_count_) { exception_state.ThrowDOMException( kNotSupportedError, ""channelCount cannot be changed from "" + String::Number(channel_count_) + "" to "" + String::Number(channel_count)); } } ",0 " Ins_SHPIX( TT_ExecContext exc, FT_Long* args ) { FT_F26Dot6 dx, dy; FT_UShort point; #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY FT_Int B1, B2; #endif #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL FT_Bool in_twilight = FT_BOOL( exc->GS.gep0 == 0 || exc->GS.gep1 == 0 || exc->GS.gep2 == 0 ); #endif if ( exc->top < exc->GS.loop + 1 ) { if ( exc->pedantic_hinting ) exc->error = FT_THROW( Invalid_Reference ); goto Fail; } dx = TT_MulFix14( args[0], exc->GS.freeVector.x ); dy = TT_MulFix14( args[0], exc->GS.freeVector.y ); while ( exc->GS.loop > 0 ) { exc->args--; point = (FT_UShort)exc->stack[exc->args]; if ( BOUNDS( point, exc->zp2.n_points ) ) { if ( exc->pedantic_hinting ) { exc->error = FT_THROW( Invalid_Reference ); return; } } else #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY if ( SUBPIXEL_HINTING_INFINALITY ) { /* If not using ignore_x_mode rendering, allow ZP2 move. */ /* If inline deltas aren't allowed, skip ZP2 move. */ /* If using ignore_x_mode rendering, allow ZP2 point move if: */ /* - freedom vector is y and sph_compatibility_mode is off */ /* - the glyph is composite and the move is in the Y direction */ /* - the glyph is specifically set to allow SHPIX moves */ /* - the move is on a previously Y-touched point */ if ( exc->ignore_x_mode ) { /* save point for later comparison */ if ( exc->GS.freeVector.y != 0 ) B1 = exc->zp2.cur[point].y; else B1 = exc->zp2.cur[point].x; if ( !exc->face->sph_compatibility_mode && exc->GS.freeVector.y != 0 ) { Move_Zp2_Point( exc, point, dx, dy, TRUE ); /* save new point */ if ( exc->GS.freeVector.y != 0 ) { B2 = exc->zp2.cur[point].y; /* reverse any disallowed moves */ if ( ( exc->sph_tweak_flags & SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES ) && ( B1 & 63 ) != 0 && ( B2 & 63 ) != 0 && B1 != B2 ) Move_Zp2_Point( exc, point, NEG_LONG( dx ), NEG_LONG( dy ), TRUE ); } } else if ( exc->face->sph_compatibility_mode ) { if ( exc->sph_tweak_flags & SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES ) { dx = FT_PIX_ROUND( B1 + dx ) - B1; dy = FT_PIX_ROUND( B1 + dy ) - B1; } /* skip post-iup deltas */ if ( exc->iup_called && ( ( exc->sph_in_func_flags & SPH_FDEF_INLINE_DELTA_1 ) || ( exc->sph_in_func_flags & SPH_FDEF_INLINE_DELTA_2 ) ) ) goto Skip; if ( !( exc->sph_tweak_flags & SPH_TWEAK_ALWAYS_SKIP_DELTAP ) && ( ( exc->is_composite && exc->GS.freeVector.y != 0 ) || ( exc->zp2.tags[point] & FT_CURVE_TAG_TOUCH_Y ) || ( exc->sph_tweak_flags & SPH_TWEAK_DO_SHPIX ) ) ) Move_Zp2_Point( exc, point, 0, dy, TRUE ); /* save new point */ if ( exc->GS.freeVector.y != 0 ) { B2 = exc->zp2.cur[point].y; /* reverse any disallowed moves */ if ( ( B1 & 63 ) == 0 && ( B2 & 63 ) != 0 && B1 != B2 ) Move_Zp2_Point( exc, point, 0, NEG_LONG( dy ), TRUE ); } } else if ( exc->sph_in_func_flags & SPH_FDEF_TYPEMAN_DIAGENDCTRL ) Move_Zp2_Point( exc, point, dx, dy, TRUE ); } else Move_Zp2_Point( exc, point, dx, dy, TRUE ); } else #endif #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL if ( SUBPIXEL_HINTING_MINIMAL && exc->backward_compatibility ) { /* Special case: allow SHPIX to move points in the twilight zone. */ /* Otherwise, treat SHPIX the same as DELTAP. Unbreaks various */ /* fonts such as older versions of Rokkitt and DTL Argo T Light */ /* that would glitch severely after calling ALIGNRP after a */ /* blocked SHPIX. */ if ( in_twilight || ( !( exc->iupx_called && exc->iupy_called ) && ( ( exc->is_composite && exc->GS.freeVector.y != 0 ) || ( exc->zp2.tags[point] & FT_CURVE_TAG_TOUCH_Y ) ) ) ) Move_Zp2_Point( exc, point, 0, dy, TRUE ); } else #endif Move_Zp2_Point( exc, point, dx, dy, TRUE ); #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY Skip: #endif exc->GS.loop--; } Fail: exc->GS.loop = 1; exc->new_top = exc->args; } ",0 "bool PDFiumEngine::OnKeyDown(const pp::KeyboardInputEvent& event) { if (last_page_mouse_down_ == -1) return false; bool rv = !!FORM_OnKeyDown( form_, pages_[last_page_mouse_down_]->GetPage(), event.GetKeyCode(), event.GetModifiers()); if (event.GetKeyCode() == ui::VKEY_BACK || event.GetKeyCode() == ui::VKEY_ESCAPE) { std::string str; str.push_back(event.GetKeyCode()); pp::KeyboardInputEvent synthesized(pp::KeyboardInputEvent( client_->GetPluginInstance(), PP_INPUTEVENT_TYPE_CHAR, event.GetTimeStamp(), event.GetModifiers(), event.GetKeyCode(), str)); OnChar(synthesized); } return rv; } ",0 "LUALIB_API int luaopen_struct (lua_State *L) { luaL_register(L, ""struct"", thislib); return 1; } ",0 "static void __mark_reg_const_zero(struct bpf_reg_state *reg) { __mark_reg_known(reg, 0); reg->off = 0; reg->type = SCALAR_VALUE; } ",0 "void BaseMultipleFieldsDateAndTimeInputType::didFocusOnControl() { element()->setFocus(true); } ",0 "status_t NuMediaExtractor::advance() { Mutex::Autolock autoLock(mLock); ssize_t minIndex = fetchTrackSamples(); if (minIndex < 0) { return ERROR_END_OF_STREAM; } TrackInfo *info = &mSelectedTracks.editItemAt(minIndex); info->mSample->release(); info->mSample = NULL; info->mSampleTimeUs = -1ll; return OK; } ",0 "void WallpaperManagerBase::SetCustomizedDefaultWallpaper( const GURL& wallpaper_url, const base::FilePath& downloaded_file, const base::FilePath& resized_directory) { DCHECK(wallpaper_url.is_valid()); if (!wallpaper_url.is_valid()) { if (!wallpaper_url.is_empty()) { LOG(WARNING) << ""Invalid Customized Wallpaper URL '"" << wallpaper_url.spec() << ""'""; } return; } std::string downloaded_file_name = downloaded_file.BaseName().value(); std::unique_ptr rescaled_files( new CustomizedWallpaperRescaledFiles( downloaded_file, resized_directory.Append(downloaded_file_name + kSmallWallpaperSuffix), resized_directory.Append(downloaded_file_name + kLargeWallpaperSuffix))); base::Closure check_file_exists = rescaled_files->CreateCheckerClosure(); base::Closure on_checked_closure = base::Bind(&WallpaperManagerBase::SetCustomizedDefaultWallpaperAfterCheck, weak_factory_.GetWeakPtr(), wallpaper_url, downloaded_file, base::Passed(std::move(rescaled_files))); if (!task_runner_->PostTaskAndReply(FROM_HERE, check_file_exists, on_checked_closure)) { LOG(WARNING) << ""Failed to start check CheckCustomizedWallpaperFilesExist.""; } } ",0 "void comps_objmrtree_copy(COMPS_ObjMRTree *ret, COMPS_ObjMRTree *rt){ COMPS_HSList * to_clone, *tmplist, *new_subnodes; COMPS_HSListItem *it, *it2; COMPS_ObjMRTreeData *rtdata; COMPS_ObjList *new_data_list; to_clone = comps_hslist_create(); comps_hslist_init(to_clone, NULL, NULL, NULL); for (it = rt->subnodes->first; it != NULL; it = it->next) { rtdata = comps_objmrtree_data_create( ((COMPS_ObjMRTreeData*)it->data)->key, NULL); new_data_list = (COMPS_ObjList*) COMPS_OBJECT_COPY(((COMPS_ObjMRTreeData*)it->data)->data); COMPS_OBJECT_DESTROY(&rtdata->data); comps_hslist_destroy(&rtdata->subnodes); rtdata->subnodes = ((COMPS_ObjMRTreeData*)it->data)->subnodes; rtdata->data = new_data_list; comps_hslist_append(ret->subnodes, rtdata, 0); comps_hslist_append(to_clone, rtdata, 0); } while (to_clone->first) { it2 = to_clone->first; tmplist = ((COMPS_ObjMRTreeData*)it2->data)->subnodes; comps_hslist_remove(to_clone, to_clone->first); new_subnodes = comps_hslist_create(); comps_hslist_init(new_subnodes, NULL, NULL, &comps_objmrtree_data_destroy_v); for (it = tmplist->first; it != NULL; it = it->next) { rtdata = comps_objmrtree_data_create( ((COMPS_ObjMRTreeData*)it->data)->key, NULL); new_data_list = (COMPS_ObjList*) COMPS_OBJECT_COPY(((COMPS_ObjMRTreeData*)it->data)->data); comps_hslist_destroy(&rtdata->subnodes); COMPS_OBJECT_DESTROY(rtdata->data); rtdata->subnodes = ((COMPS_ObjMRTreeData*)it->data)->subnodes; rtdata->data = new_data_list; comps_hslist_append(new_subnodes, rtdata, 0); comps_hslist_append(to_clone, rtdata, 0); } ((COMPS_ObjMRTreeData*)it2->data)->subnodes = new_subnodes; free(it2); } ret->len = rt->len; comps_hslist_destroy(&to_clone); } ",0 "static int php_libxml_streams_IO_close(void *context) { TSRMLS_FETCH(); return php_stream_close((php_stream*)context); } ",0 "void UrlmonUrlRequest::ReleaseBindings() { binding_.Release(); if (bind_context_) ::RevokeBindStatusCallback(bind_context_, this); } ",0 "void LayerWebKitThread::setRunningAnimations(const Vector >& animations) { m_runningAnimations = animations; m_animationsChanged = true; setNeedsCommit(); } ",0 "bool Document::CheckCompletedInternal() { if (!ShouldComplete()) return false; if (frame_) { frame_->Client()->RunScriptsAtDocumentIdle(); if (!frame_) return false; if (!ShouldComplete()) return false; } SetReadyState(kComplete); if (LoadEventStillNeeded()) ImplicitClose(); if (!frame_ || !frame_->IsAttached()) return false; if (frame_->GetSettings()->GetSavePreviousDocumentResources() == SavePreviousDocumentResources::kUntilOnLoad) { fetcher_->ClearResourcesFromPreviousFetcher(); } frame_->GetNavigationScheduler().StartTimer(); View()->HandleLoadCompleted(); if (!AllDescendantsAreComplete(frame_)) return false; if (!Loader()->SentDidFinishLoad()) { if (frame_->IsMainFrame()) GetViewportData().GetViewportDescription().ReportMobilePageStats(frame_); Loader()->SetSentDidFinishLoad(); frame_->Client()->DispatchDidFinishLoad(); if (!frame_) return false; if (frame_->Client()->GetRemoteNavigationAssociatedInterfaces()) { mojom::blink::UkmSourceIdFrameHostAssociatedPtr ukm_binding; frame_->Client()->GetRemoteNavigationAssociatedInterfaces()->GetInterface( &ukm_binding); DCHECK(ukm_binding.is_bound()); ukm_binding->SetDocumentSourceId(ukm_source_id_); } AnchorElementMetrics::MaybeReportViewportMetricsOnLoad(*this); } return true; } ",0 "static node_t **get_ppnode(huff_t* huff) { node_t **tppnode; if (!huff->freelist) { return &(huff->nodePtrs[huff->blocPtrs++]); } else { tppnode = huff->freelist; huff->freelist = (node_t **)*tppnode; return tppnode; } } ",0 "void _xml_characterDataHandler(void *userData, const XML_Char *s, int len) { xml_parser *parser = (xml_parser *)userData; if (parser) { zval *retval, *args[2]; if (parser->characterDataHandler) { args[0] = _xml_resource_zval(parser->index); args[1] = _xml_xmlchar_zval(s, len, parser->target_encoding); if ((retval = xml_call_handler(parser, parser->characterDataHandler, parser->characterDataPtr, 2, args))) { zval_ptr_dtor(&retval); } } if (parser->data) { int i; int doprint = 0; char *decoded_value; int decoded_len; decoded_value = xml_utf8_decode(s,len,&decoded_len,parser->target_encoding); for (i = 0; i < decoded_len; i++) { switch (decoded_value[i]) { case ' ': case '\t': case '\n': continue; default: doprint = 1; break; } if (doprint) { break; } } if (doprint || (! parser->skipwhite)) { if (parser->lastwasopen) { zval **myval; /* check if the current tag already has a value - if yes append to that! */ if (zend_hash_find(Z_ARRVAL_PP(parser->ctag),""value"",sizeof(""value""),(void **) &myval) == SUCCESS) { int newlen = Z_STRLEN_PP(myval) + decoded_len; Z_STRVAL_PP(myval) = erealloc(Z_STRVAL_PP(myval),newlen+1); strncpy(Z_STRVAL_PP(myval) + Z_STRLEN_PP(myval), decoded_value, decoded_len + 1); Z_STRLEN_PP(myval) += decoded_len; efree(decoded_value); } else { add_assoc_string(*(parser->ctag),""value"",decoded_value,0); } } else { zval *tag; zval **curtag, **mytype, **myval; HashPosition hpos=NULL; zend_hash_internal_pointer_end_ex(Z_ARRVAL_P(parser->data), &hpos); if (hpos && (zend_hash_get_current_data_ex(Z_ARRVAL_P(parser->data), (void **) &curtag, &hpos) == SUCCESS)) { if (zend_hash_find(Z_ARRVAL_PP(curtag),""type"",sizeof(""type""),(void **) &mytype) == SUCCESS) { if (!strcmp(Z_STRVAL_PP(mytype), ""cdata"")) { if (zend_hash_find(Z_ARRVAL_PP(curtag),""value"",sizeof(""value""),(void **) &myval) == SUCCESS) { int newlen = Z_STRLEN_PP(myval) + decoded_len; Z_STRVAL_PP(myval) = erealloc(Z_STRVAL_PP(myval),newlen+1); strncpy(Z_STRVAL_PP(myval) + Z_STRLEN_PP(myval), decoded_value, decoded_len + 1); Z_STRLEN_PP(myval) += decoded_len; efree(decoded_value); return; } } } } if (parser->level <= XML_MAXLEVEL) { MAKE_STD_ZVAL(tag); array_init(tag); _xml_add_to_info(parser,parser->ltags[parser->level-1] + parser->toffset); add_assoc_string(tag,""tag"",parser->ltags[parser->level-1] + parser->toffset,1); add_assoc_string(tag,""value"",decoded_value,0); add_assoc_string(tag,""type"",""cdata"",1); add_assoc_long(tag,""level"",parser->level); zend_hash_next_index_insert(Z_ARRVAL_P(parser->data),&tag,sizeof(zval*),NULL); } else if (parser->level == (XML_MAXLEVEL + 1)) { TSRMLS_FETCH(); php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Maximum depth exceeded - Results truncated""); } } } else { efree(decoded_value); } } } } ",1 "void ehci_reset(void *opaque) { EHCIState *s = opaque; int i; USBDevice *devs[NB_PORTS]; trace_usb_ehci_reset(); /* * Do the detach before touching portsc, so that it correctly gets send to * us or to our companion based on PORTSC_POWNER before the reset. */ for(i = 0; i < NB_PORTS; i++) { devs[i] = s->ports[i].dev; if (devs[i] && devs[i]->attached) { usb_detach(&s->ports[i]); } } memset(&s->opreg, 0x00, sizeof(s->opreg)); memset(&s->portsc, 0x00, sizeof(s->portsc)); s->usbcmd = NB_MAXINTRATE << USBCMD_ITC_SH; s->usbsts = USBSTS_HALT; s->usbsts_pending = 0; s->usbsts_frindex = 0; s->astate = EST_INACTIVE; s->pstate = EST_INACTIVE; for(i = 0; i < NB_PORTS; i++) { if (s->companion_ports[i]) { s->portsc[i] = PORTSC_POWNER | PORTSC_PPOWER; } else { s->portsc[i] = PORTSC_PPOWER; } if (devs[i] && devs[i]->attached) { usb_attach(&s->ports[i]); usb_device_reset(devs[i]); } } ehci_queues_rip_all(s, 0); ehci_queues_rip_all(s, 1); timer_del(s->frame_timer); qemu_bh_cancel(s->async_bh); } ",0 "fst_close(struct net_device *dev) { struct fst_port_info *port; struct fst_card_info *card; unsigned char tx_dma_done; unsigned char rx_dma_done; port = dev_to_port(dev); card = port->card; tx_dma_done = inb(card->pci_conf + DMACSR1); rx_dma_done = inb(card->pci_conf + DMACSR0); dbg(DBG_OPEN, ""Port Close: tx_dma_in_progress = %d (%x) rx_dma_in_progress = %d (%x)\n"", card->dmatx_in_progress, tx_dma_done, card->dmarx_in_progress, rx_dma_done); netif_stop_queue(dev); fst_closeport(dev_to_port(dev)); if (port->mode != FST_RAW) { hdlc_close(dev); } module_put(THIS_MODULE); return 0; } ",0 "int fscrypt_initialize(unsigned int cop_flags) { int i, res = -ENOMEM; /* * No need to allocate a bounce page pool if there already is one or * this FS won't use it. */ if (cop_flags & FS_CFLG_OWN_PAGES || fscrypt_bounce_page_pool) return 0; mutex_lock(&fscrypt_init_mutex); if (fscrypt_bounce_page_pool) goto already_initialized; for (i = 0; i < num_prealloc_crypto_ctxs; i++) { struct fscrypt_ctx *ctx; ctx = kmem_cache_zalloc(fscrypt_ctx_cachep, GFP_NOFS); if (!ctx) goto fail; list_add(&ctx->free_list, &fscrypt_free_ctxs); } fscrypt_bounce_page_pool = mempool_create_page_pool(num_prealloc_crypto_pages, 0); if (!fscrypt_bounce_page_pool) goto fail; already_initialized: mutex_unlock(&fscrypt_init_mutex); return 0; fail: fscrypt_destroy(); mutex_unlock(&fscrypt_init_mutex); return res; } ",0 "LayoutUnit RenderFlexibleBox::adjustChildSizeForMinAndMax(RenderBox* child, LayoutUnit childSize) { Length max = isHorizontalFlow() ? child->style()->maxWidth() : child->style()->maxHeight(); if (max.isSpecifiedOrIntrinsic()) { LayoutUnit maxExtent = computeMainAxisExtentForChild(child, MaxSize, max); if (maxExtent != -1 && childSize > maxExtent) childSize = maxExtent; } Length min = isHorizontalFlow() ? child->style()->minWidth() : child->style()->minHeight(); LayoutUnit minExtent = 0; if (min.isSpecifiedOrIntrinsic()) minExtent = computeMainAxisExtentForChild(child, MinSize, min); return std::max(childSize, minExtent); } ",0 "nfsd4_sequence_done(struct nfsd4_compoundres *resp) { struct nfsd4_compound_state *cs = &resp->cstate; if (nfsd4_has_session(cs)) { if (cs->status != nfserr_replay_cache) { nfsd4_store_cache_entry(resp); cs->slot->sl_flags &= ~NFSD4_SLOT_INUSE; } /* Drop session reference that was taken in nfsd4_sequence() */ nfsd4_put_session(cs->session); } else if (cs->clp) put_client_renew(cs->clp); } ",0 "void CL_CDDialog( void ) { cls.cddialog = qtrue; // start it next frame } ",0 "logerror(Image *image, const char *a1, const char *a2, const char *a3) { fflush(stdout); if (image->image.warning_or_error) fprintf(stderr, ""%s%s%s: %s\n"", a1, a2, a3, image->image.message); else fprintf(stderr, ""%s%s%s\n"", a1, a2, a3); if (image->image.opaque != NULL) { fprintf(stderr, ""%s: image opaque pointer non-NULL on error\n"", image->file_name); png_image_free(&image->image); } return 0; } ",0 "void ChromeClientImpl::SetWindowRect(const IntRect& r, LocalFrame& frame) { DCHECK_EQ(&frame, web_view_->MainFrameImpl()->GetFrame()); WebWidgetClient* client = WebLocalFrameImpl::FromFrame(&frame)->FrameWidget()->Client(); client->SetWindowRect(r); } ",0 "static av_cold int ape_decode_init(AVCodecContext *avctx) { APEContext *s = avctx->priv_data; int i; if (avctx->extradata_size != 6) { av_log(avctx, AV_LOG_ERROR, ""Incorrect extradata\n""); return AVERROR(EINVAL); } if (avctx->channels > 2) { av_log(avctx, AV_LOG_ERROR, ""Only mono and stereo is supported\n""); return AVERROR(EINVAL); } s->bps = avctx->bits_per_coded_sample; switch (s->bps) { case 8: avctx->sample_fmt = AV_SAMPLE_FMT_U8P; break; case 16: avctx->sample_fmt = AV_SAMPLE_FMT_S16P; break; case 24: avctx->sample_fmt = AV_SAMPLE_FMT_S32P; break; default: avpriv_request_sample(avctx, ""%d bits per coded sample"", s->bps); return AVERROR_PATCHWELCOME; } s->avctx = avctx; s->channels = avctx->channels; s->fileversion = AV_RL16(avctx->extradata); s->compression_level = AV_RL16(avctx->extradata + 2); s->flags = AV_RL16(avctx->extradata + 4); av_log(avctx, AV_LOG_VERBOSE, ""Compression Level: %d - Flags: %d\n"", s->compression_level, s->flags); if (s->compression_level % 1000 || s->compression_level > COMPRESSION_LEVEL_INSANE || !s->compression_level || (s->fileversion < 3930 && s->compression_level == COMPRESSION_LEVEL_INSANE)) { av_log(avctx, AV_LOG_ERROR, ""Incorrect compression level %d\n"", s->compression_level); return AVERROR_INVALIDDATA; } s->fset = s->compression_level / 1000 - 1; for (i = 0; i < APE_FILTER_LEVELS; i++) { if (!ape_filter_orders[s->fset][i]) break; FF_ALLOC_OR_GOTO(avctx, s->filterbuf[i], (ape_filter_orders[s->fset][i] * 3 + HISTORY_SIZE) * 4, filter_alloc_fail); } if (s->fileversion < 3860) { s->entropy_decode_mono = entropy_decode_mono_0000; s->entropy_decode_stereo = entropy_decode_stereo_0000; } else if (s->fileversion < 3900) { s->entropy_decode_mono = entropy_decode_mono_3860; s->entropy_decode_stereo = entropy_decode_stereo_3860; } else if (s->fileversion < 3930) { s->entropy_decode_mono = entropy_decode_mono_3900; s->entropy_decode_stereo = entropy_decode_stereo_3900; } else if (s->fileversion < 3990) { s->entropy_decode_mono = entropy_decode_mono_3900; s->entropy_decode_stereo = entropy_decode_stereo_3930; } else { s->entropy_decode_mono = entropy_decode_mono_3990; s->entropy_decode_stereo = entropy_decode_stereo_3990; } if (s->fileversion < 3930) { s->predictor_decode_mono = predictor_decode_mono_3800; s->predictor_decode_stereo = predictor_decode_stereo_3800; } else if (s->fileversion < 3950) { s->predictor_decode_mono = predictor_decode_mono_3930; s->predictor_decode_stereo = predictor_decode_stereo_3930; } else { s->predictor_decode_mono = predictor_decode_mono_3950; s->predictor_decode_stereo = predictor_decode_stereo_3950; } ff_bswapdsp_init(&s->bdsp); ff_llauddsp_init(&s->adsp); avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; return 0; filter_alloc_fail: ape_decode_close(avctx); return AVERROR(ENOMEM); } ",0 "static int coolkey_select_file(sc_card_t *card, const sc_path_t *in_path, sc_file_t **file_out) { int r; struct sc_file *file = NULL; coolkey_private_data_t * priv = COOLKEY_DATA(card); unsigned long object_id; assert(card != NULL && in_path != NULL); SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE); if (in_path->len != 4) { return SC_ERROR_OBJECT_NOT_FOUND; } r = coolkey_select_applet(card); if (r != SC_SUCCESS) { return r; } object_id = bebytes2ulong(in_path->value); priv->obj = coolkey_find_object_by_id(&priv->objects_list, object_id); if (priv->obj == NULL) { return SC_ERROR_OBJECT_NOT_FOUND; } priv->key_id = COOLKEY_INVALID_KEY; if (coolkey_class(object_id) == COOLKEY_KEY_CLASS) { priv->key_id = coolkey_get_key_id(object_id); } if (file_out) { file = sc_file_new(); if (file == NULL) SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_NORMAL, SC_ERROR_OUT_OF_MEMORY); file->path = *in_path; /* this could be like the FCI */ file->type = SC_PATH_TYPE_FILE_ID; file->shareable = 0; file->ef_structure = 0; file->size = priv->obj->length; *file_out = file; } return SC_SUCCESS; } ",0 "bool SaveWallpaperInternal(const base::FilePath& path, const char* data, int size) { int written_bytes = base::WriteFile(path, data, size); return written_bytes == size; } ",0 "static void strawberryAttributeGetter(const v8::PropertyCallbackInfo& info) { TestObject* imp = V8TestObject::toNative(info.Holder()); v8SetReturnValueInt(info, imp->blueberry()); } ",0 "static size_t taskstats_packet_size(void) { size_t size; size = nla_total_size(sizeof(u32)) + nla_total_size(sizeof(struct taskstats)) + nla_total_size(0); #ifdef TASKSTATS_NEEDS_PADDING size += nla_total_size(0); /* Padding for alignment */ #endif return size; } ",0 "static void __sync_task_rss_stat(struct task_struct *task, struct mm_struct *mm) { int i; for (i = 0; i < NR_MM_COUNTERS; i++) { if (task->rss_stat.count[i]) { add_mm_counter(mm, i, task->rss_stat.count[i]); task->rss_stat.count[i] = 0; } } task->rss_stat.events = 0; } ",0 "PanoramiXRenderChangePicture (ClientPtr client) { PanoramiXRes *pict; int result = Success, j; REQUEST(xRenderChangePictureReq); REQUEST_AT_LEAST_SIZE(xRenderChangePictureReq); VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess); FOR_NSCREENS_BACKWARD(j) { stuff->picture = pict->info[j].id; result = (*PanoramiXSaveRenderVector[X_RenderChangePicture]) (client); if(result != Success) break; } return result; } ",0 "static void TIFFGetEXIFProperties(TIFF *tiff,Image *image, ExceptionInfo *exception) { #if defined(MAGICKCORE_HAVE_TIFFREADEXIFDIRECTORY) char value[MagickPathExtent]; register ssize_t i; tdir_t directory; #if defined(TIFF_VERSION_BIG) uint64 #else uint32 #endif offset; void *sans; /* Read EXIF properties. */ offset=0; if (TIFFGetField(tiff,TIFFTAG_EXIFIFD,&offset) != 1) return; directory=TIFFCurrentDirectory(tiff); if (TIFFReadEXIFDirectory(tiff,offset) != 1) { TIFFSetDirectory(tiff,directory); return; } sans=NULL; for (i=0; exif_info[i].tag != 0; i++) { *value='\0'; switch (exif_info[i].type) { case TIFF_ASCII: { char *ascii; ascii=(char *) NULL; if ((TIFFGetField(tiff,exif_info[i].tag,&ascii,&sans,&sans) == 1) && (ascii != (char *) NULL) && (*ascii != '\0')) (void) CopyMagickString(value,ascii,MagickPathExtent); break; } case TIFF_SHORT: { if (exif_info[i].variable_length == 0) { uint16 shorty; shorty=0; if (TIFFGetField(tiff,exif_info[i].tag,&shorty,&sans,&sans) == 1) (void) FormatLocaleString(value,MagickPathExtent,""%d"",shorty); } else { int tiff_status; uint16 *shorty; uint16 shorty_num; tiff_status=TIFFGetField(tiff,exif_info[i].tag,&shorty_num,&shorty, &sans,&sans); if (tiff_status == 1) (void) FormatLocaleString(value,MagickPathExtent,""%d"", shorty_num != 0 ? shorty[0] : 0); } break; } case TIFF_LONG: { uint32 longy; longy=0; if (TIFFGetField(tiff,exif_info[i].tag,&longy,&sans,&sans) == 1) (void) FormatLocaleString(value,MagickPathExtent,""%d"",longy); break; } #if defined(TIFF_VERSION_BIG) case TIFF_LONG8: { uint64 long8y; long8y=0; if (TIFFGetField(tiff,exif_info[i].tag,&long8y,&sans,&sans) == 1) (void) FormatLocaleString(value,MagickPathExtent,""%.20g"",(double) ((MagickOffsetType) long8y)); break; } #endif case TIFF_RATIONAL: case TIFF_SRATIONAL: case TIFF_FLOAT: { float floaty; floaty=0.0; if (TIFFGetField(tiff,exif_info[i].tag,&floaty,&sans,&sans) == 1) (void) FormatLocaleString(value,MagickPathExtent,""%g"",(double) floaty); break; } case TIFF_DOUBLE: { double doubley; doubley=0.0; if (TIFFGetField(tiff,exif_info[i].tag,&doubley,&sans,&sans) == 1) (void) FormatLocaleString(value,MagickPathExtent,""%g"",doubley); break; } default: break; } if (*value != '\0') (void) SetImageProperty(image,exif_info[i].property,value,exception); } TIFFSetDirectory(tiff,directory); #else (void) tiff; (void) image; #endif } ",0 "static void decode_cpe(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld, uint8_t id_syn_ele) { uint8_t channels = hDecoder->fr_channels; uint8_t tag = 0; if (channels+2 > MAX_CHANNELS) { hInfo->error = 12; return; } if (hDecoder->fr_ch_ele+1 > MAX_SYNTAX_ELEMENTS) { hInfo->error = 13; return; } /* for CPE the number of output channels is always 2 */ if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 0) { /* element_output_channels not set yet */ hDecoder->element_output_channels[hDecoder->fr_ch_ele] = 2; } else if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] != 2) { /* element inconsistency */ hInfo->error = 21; return; } if (hDecoder->frame && hDecoder->element_id[hDecoder->fr_ch_ele] != id_syn_ele) { /* element inconsistency */ hInfo->error = 21; return; } /* save the syntax element id */ hDecoder->element_id[hDecoder->fr_ch_ele] = id_syn_ele; /* decode the element */ hInfo->error = channel_pair_element(hDecoder, ld, channels, &tag); /* map output channel position to internal data channels */ if (hDecoder->pce_set) { hDecoder->internal_channel[hDecoder->pce.cpe_channel[tag]] = channels; hDecoder->internal_channel[hDecoder->pce.cpe_channel[tag]+1] = channels+1; } else { hDecoder->internal_channel[channels] = channels; hDecoder->internal_channel[channels+1] = channels+1; } hDecoder->fr_channels += 2; hDecoder->fr_ch_ele++; } ",0 "fz_keep_colorspace_context(fz_context *ctx) { if (!ctx) return NULL; return fz_keep_imp(ctx, ctx->colorspace, &ctx->colorspace->ctx_refs); } ",0 "bool AddPolicyForGPU(CommandLine* cmd_line, sandbox::TargetPolicy* policy) { #if !defined(NACL_WIN64) // We don't need this code on win nacl64. if (base::win::GetVersion() > base::win::VERSION_SERVER_2003) { if (cmd_line->GetSwitchValueASCII(switches::kUseGL) == gfx::kGLImplementationDesktopName) { policy->SetTokenLevel(sandbox::USER_RESTRICTED_SAME_ACCESS, sandbox::USER_LIMITED); policy->SetJobLevel(sandbox::JOB_UNPROTECTED, 0); policy->SetDelayedIntegrityLevel(sandbox::INTEGRITY_LEVEL_LOW); } else { if (cmd_line->GetSwitchValueASCII(switches::kUseGL) == gfx::kGLImplementationSwiftShaderName || cmd_line->HasSwitch(switches::kReduceGpuSandbox)) { policy->SetTokenLevel(sandbox::USER_RESTRICTED_SAME_ACCESS, sandbox::USER_LIMITED); policy->SetJobLevel(sandbox::JOB_LIMITED_USER, JOB_OBJECT_UILIMIT_SYSTEMPARAMETERS | JOB_OBJECT_UILIMIT_DESKTOP | JOB_OBJECT_UILIMIT_EXITWINDOWS | JOB_OBJECT_UILIMIT_DISPLAYSETTINGS); } else { policy->SetTokenLevel(sandbox::USER_RESTRICTED_SAME_ACCESS, sandbox::USER_RESTRICTED); policy->SetJobLevel(sandbox::JOB_LOCKDOWN, JOB_OBJECT_UILIMIT_HANDLES); } policy->SetIntegrityLevel(sandbox::INTEGRITY_LEVEL_LOW); } } else { policy->SetJobLevel(sandbox::JOB_UNPROTECTED, 0); policy->SetTokenLevel(sandbox::USER_UNPROTECTED, sandbox::USER_LIMITED); } sandbox::ResultCode result = policy->AddRule( sandbox::TargetPolicy::SUBSYS_NAMED_PIPES, sandbox::TargetPolicy::NAMEDPIPES_ALLOW_ANY, L""\\\\.\\pipe\\chrome.gpu.*""); if (result != sandbox::SBOX_ALL_OK) return false; result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_HANDLES, sandbox::TargetPolicy::HANDLES_DUP_ANY, L""Section""); if (result != sandbox::SBOX_ALL_OK) return false; AddGenericDllEvictionPolicy(policy); #endif return true; } ",1 "base::FilePath GetStartupProfilePath(const base::FilePath& user_data_dir, const base::CommandLine& command_line) { #if defined(OS_WIN) if (command_line.HasSwitch(switches::kNotificationLaunchId)) { std::string profile_id = NotificationLaunchId::GetProfileIdFromLaunchId( command_line.GetSwitchValueNative(switches::kNotificationLaunchId)); if (!profile_id.empty()) { return user_data_dir.Append( base::FilePath(base::UTF8ToUTF16(profile_id))); } } #endif // defined(OS_WIN) if (IsGuestModeEnforced(command_line, /* show_warning= */ false)) return profiles::GetDefaultProfileDir(user_data_dir); if (command_line.HasSwitch(switches::kProfileDirectory)) { return user_data_dir.Append( command_line.GetSwitchValuePath(switches::kProfileDirectory)); } return g_browser_process->profile_manager()->GetLastUsedProfileDir( user_data_dir); } ",0 "content::KeyboardEventProcessingResult BrowserView::PreHandleKeyboardEvent( const NativeWebKeyboardEvent& event) { if ((event.GetType() != blink::WebInputEvent::kRawKeyDown) && (event.GetType() != blink::WebInputEvent::kKeyUp)) { return content::KeyboardEventProcessingResult::NOT_HANDLED; } views::FocusManager* focus_manager = GetFocusManager(); DCHECK(focus_manager); if (focus_manager->shortcut_handling_suspended()) return content::KeyboardEventProcessingResult::NOT_HANDLED; ui::Accelerator accelerator = ui::GetAcceleratorFromNativeWebKeyboardEvent(event); if (browser_->is_app()) { return content::KeyboardEventProcessingResult::NOT_HANDLED; } #if defined(OS_CHROMEOS) if (ash_util::IsAcceleratorDeprecated(accelerator)) { return (event.GetType() == blink::WebInputEvent::kRawKeyDown) ? content::KeyboardEventProcessingResult::NOT_HANDLED_IS_SHORTCUT : content::KeyboardEventProcessingResult::NOT_HANDLED; } #endif // defined(OS_CHROMEOS) content::KeyboardEventProcessingResult result = frame_->PreHandleKeyboardEvent(event); if (result != content::KeyboardEventProcessingResult::NOT_HANDLED) return result; #if defined(OS_CHROMEOS) if (event.os_event && event.os_event->IsKeyEvent() && ash_util::WillAshProcessAcceleratorForEvent( *event.os_event->AsKeyEvent())) { return content::KeyboardEventProcessingResult::HANDLED_DONT_UPDATE_EVENT; } #endif int id; if (!FindCommandIdForAccelerator(accelerator, &id)) { if (focus_manager->ProcessAccelerator(accelerator)) return content::KeyboardEventProcessingResult::HANDLED; return content::KeyboardEventProcessingResult::NOT_HANDLED; } chrome::BrowserCommandController* controller = browser_->command_controller(); if (controller->IsReservedCommandOrKey(id, event)) { UpdateAcceleratorMetrics(accelerator, id); return focus_manager->ProcessAccelerator(accelerator) ? content::KeyboardEventProcessingResult::HANDLED : content::KeyboardEventProcessingResult::NOT_HANDLED; } DCHECK_EQ(event.GetType(), blink::WebInputEvent::kRawKeyDown); return content::KeyboardEventProcessingResult::NOT_HANDLED_IS_SHORTCUT; } ",0 "error::Error GLES2DecoderPassthroughImpl::DoGetBufferParameteri64v( GLenum target, GLenum pname, GLsizei bufsize, GLsizei* length, GLint64* params) { CheckErrorCallbackState(); api()->glGetBufferParameteri64vRobustANGLEFn(target, pname, bufsize, length, params); if (CheckErrorCallbackState()) { return error::kNoError; } PatchGetBufferResults(target, pname, bufsize, length, params); return error::kNoError; } ",0 "bool ion_buffer_fault_user_mappings(struct ion_buffer *buffer) { return (buffer->flags & ION_FLAG_CACHED) && !(buffer->flags & ION_FLAG_CACHED_NEEDS_SYNC); } ",0 "bool RenderFrameHostImpl::DidCommitNavigationInternal( FrameHostMsg_DidCommitProvisionalLoad_Params* validated_params, bool is_same_document_navigation) { DCHECK_EQ(ui::PageTransitionIsMainFrame(validated_params->transition), !GetParent()); if (!ValidateDidCommitParams(validated_params)) return false; if (!is_loading()) { bool was_loading = frame_tree_node()->frame_tree()->IsLoading(); is_loading_ = true; frame_tree_node()->DidStartLoading(!is_same_document_navigation, was_loading); } if (navigation_request_) was_discarded_ = navigation_request_->request_params().was_discarded; std::unique_ptr navigation_request; if (is_same_document_navigation) { navigation_request = TakeNavigationRequestForSameDocumentCommit(*validated_params); } else { navigation_request = TakeNavigationRequestForCommit(*validated_params); } DCHECK(navigation_request); DCHECK(navigation_request->navigation_handle()); UpdateSiteURL(validated_params->url, validated_params->url_is_unreachable); accessibility_reset_count_ = 0; frame_tree_node()->navigator()->DidNavigate(this, *validated_params, std::move(navigation_request), is_same_document_navigation); if (!is_same_document_navigation) navigation_request_.reset(); return true; } ",0 "int RenderBox::baselinePosition(FontBaseline baselineType, bool /*firstLine*/, LineDirectionMode direction, LinePositionMode linePositionMode) const { ASSERT(linePositionMode == PositionOnContainingLine); if (isReplaced()) { int result = direction == HorizontalLine ? m_marginBox.top() + height() + m_marginBox.bottom() : m_marginBox.right() + width() + m_marginBox.left(); if (baselineType == AlphabeticBaseline) return result; return result - result / 2; } return 0; } ",0 "static void vrend_destroy_shader_object(void *obj_ptr) { struct vrend_shader_selector *state = obj_ptr; vrend_shader_state_reference(&state, NULL); } ",0 "qreal QQuickWebViewExperimental::contentHeight() const { Q_D(const QQuickWebView); ASSERT(d->flickProvider); return d->flickProvider->contentHeight(); } ",0 "Response ServiceWorkerHandler::UpdateRegistration( const std::string& scope_url) { if (!enabled_) return CreateDomainNotEnabledErrorResponse(); if (!context_) return CreateContextErrorResponse(); context_->UpdateRegistration(GURL(scope_url)); return Response::OK(); } ",0 " Ins_ELSE( TT_ExecContext exc ) { FT_Int nIfs; nIfs = 1; do { if ( SkipCode( exc ) == FAILURE ) return; switch ( exc->opcode ) { case 0x58: /* IF */ nIfs++; break; case 0x59: /* EIF */ nIfs--; break; } } while ( nIfs != 0 ); } ",0 "static void i6300esb_reset(DeviceState *dev) { PCIDevice *pdev = PCI_DEVICE(dev); I6300State *d = WATCHDOG_I6300ESB_DEVICE(pdev); i6300esb_debug(""I6300State = %p\n"", d); i6300esb_disable_timer(d); /* NB: Don't change d->previous_reboot_flag in this function. */ d->reboot_enabled = 1; d->clock_scale = CLOCK_SCALE_1KHZ; d->int_type = INT_TYPE_IRQ; d->free_run = 0; d->locked = 0; d->enabled = 0; d->timer1_preload = 0xfffff; d->timer2_preload = 0xfffff; d->stage = 1; d->unlock_state = 0; } ",0 " void OnSignalConnected(const std::string& interface, const std::string& signal, bool succeeded) { LOG_IF(ERROR, !succeeded) << ""Connect to "" << interface << "" "" << signal << "" failed.""; } ",0 "void ScrollableShelfView::ScrollByYOffset(float y_offset, bool animating) { ScrollToYOffset(scroll_offset_.y() + y_offset, animating); } ",0 "bool TranslateManager::IsTranslatableURL(const GURL& url) { return !url.SchemeIs(""chrome""); } ",0 "void Chapters::Atom::Init() { m_string_uid = NULL; m_uid = 0; m_start_timecode = -1; m_stop_timecode = -1; m_displays = NULL; m_displays_size = 0; m_displays_count = 0; } ",1 "unsigned long long PerformanceNavigationTiming::GetDecodedBodySize() const { return resource_timing_info_->FinalResponse().DecodedBodyLength(); } ",0 "void UserSelectionScreen::SetView(UserBoardView* view) { view_ = view; } ",0 "int Condor_Auth_SSL :: server_share_status( int server_status ) { int client_status; if( send_status( server_status ) == AUTH_SSL_ERROR ) { return AUTH_SSL_ERROR; } if( receive_status( client_status ) == AUTH_SSL_ERROR ) { return AUTH_SSL_ERROR; } return client_status; } ",0 "gdImagePtr gdImageRotateNearestNeighbour(gdImagePtr src, const float degrees, const int bgColor) { float _angle = ((float) (-degrees / 180.0f) * (float)M_PI); const int src_w = gdImageSX(src); const int src_h = gdImageSY(src); const unsigned int new_width = (unsigned int)(abs((int)(src_w * cos(_angle))) + abs((int)(src_h * sin(_angle))) + 0.5f); const unsigned int new_height = (unsigned int)(abs((int)(src_w * sin(_angle))) + abs((int)(src_h * cos(_angle))) + 0.5f); const gdFixed f_0_5 = gd_ftofx(0.5f); const gdFixed f_H = gd_itofx(src_h/2); const gdFixed f_W = gd_itofx(src_w/2); const gdFixed f_cos = gd_ftofx(cos(-_angle)); const gdFixed f_sin = gd_ftofx(sin(-_angle)); unsigned int dst_offset_x; unsigned int dst_offset_y = 0; unsigned int i; gdImagePtr dst; dst = gdImageCreateTrueColor(new_width, new_height); if (!dst) { return NULL; } dst->saveAlphaFlag = 1; for (i = 0; i < new_height; i++) { unsigned int j; dst_offset_x = 0; for (j = 0; j < new_width; j++) { gdFixed f_i = gd_itofx((int)i - (int)new_height/2); gdFixed f_j = gd_itofx((int)j - (int)new_width/2); gdFixed f_m = gd_mulfx(f_j,f_sin) + gd_mulfx(f_i,f_cos) + f_0_5 + f_H; gdFixed f_n = gd_mulfx(f_j,f_cos) - gd_mulfx(f_i,f_sin) + f_0_5 + f_W; long m = gd_fxtoi(f_m); long n = gd_fxtoi(f_n); if ((m > 0) && (m < src_h-1) && (n > 0) && (n < src_w-1)) { if (dst_offset_y < new_height) { dst->tpixels[dst_offset_y][dst_offset_x++] = src->tpixels[m][n]; } } else { if (dst_offset_y < new_height) { dst->tpixels[dst_offset_y][dst_offset_x++] = bgColor; } } } dst_offset_y++; } return dst; } ",0 "armv6pmu_write_counter(int counter, u32 value) { if (ARMV6_CYCLE_COUNTER == counter) asm volatile(""mcr p15, 0, %0, c15, c12, 1"" : : ""r""(value)); else if (ARMV6_COUNTER0 == counter) asm volatile(""mcr p15, 0, %0, c15, c12, 2"" : : ""r""(value)); else if (ARMV6_COUNTER1 == counter) asm volatile(""mcr p15, 0, %0, c15, c12, 3"" : : ""r""(value)); else WARN_ONCE(1, ""invalid counter number (%d)\n"", counter); } ",0 "static int buildid_dir_command_config(const char *var, const char *value, void *data) { struct buildid_dir_config *c = data; const char *v; /* same dir for all commands */ if (!prefixcmp(var, ""buildid."") && !strcmp(var + 8, ""dir"")) { v = perf_config_dirname(var, value); if (!v) return -1; strncpy(c->dir, v, MAXPATHLEN-1); c->dir[MAXPATHLEN-1] = '\0'; } return 0; } ",0 "PHP_FUNCTION(pg_close) { zval *pgsql_link = NULL; int id = -1, argc = ZEND_NUM_ARGS(); PGconn *pgsql; if (zend_parse_parameters(argc, ""|r"", &pgsql_link) == FAILURE) { return; } if (argc == 0) { id = FETCH_DEFAULT_LINK(); CHECK_DEFAULT_LINK(id); } if (pgsql_link == NULL && id == -1) { RETURN_FALSE; } ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, ""PostgreSQL link"", le_link, le_plink); if (id==-1) { /* explicit resource number */ zend_list_close(Z_RES_P(pgsql_link)); } if (id!=-1 || (pgsql_link && Z_RES_P(pgsql_link) == PGG(default_link))) { zend_list_close(PGG(default_link)); PGG(default_link) = NULL; } RETURN_TRUE; } ",0 "static void ikev2_parent_outI1_continue(struct pluto_crypto_req_cont *pcrc, struct pluto_crypto_req *r, err_t ugh) { struct ke_continuation *ke = (struct ke_continuation *)pcrc; struct msg_digest *md = ke->md; struct state *const st = md->st; stf_status e; DBG(DBG_CONTROLMORE, DBG_log(""ikev2 parent outI1: calculated ke+nonce, sending I1"")); if (st == NULL) { loglog(RC_LOG_SERIOUS, ""%s: Request was disconnected from state"", __FUNCTION__); if (ke->md) release_md(ke->md); return; } /* XXX should check out ugh */ passert(ugh == NULL); passert(cur_state == NULL); passert(st != NULL); passert(st->st_suspended_md == ke->md); set_suspended(st, NULL); /* no longer connected or suspended */ set_cur_state(st); st->st_calculating = FALSE; e = ikev2_parent_outI1_tail(pcrc, r); if (ke->md != NULL) { complete_v2_state_transition(&ke->md, e); if (ke->md) release_md(ke->md); } reset_cur_state(); reset_globals(); passert(GLOBALS_ARE_RESET()); } ",1 "_client_protocol_timeout (GsmXSMPClient *client) { g_debug (""GsmXSMPClient: client_protocol_timeout for client '%s' in ICE status %d"", client->priv->description, IceConnectionStatus (client->priv->ice_connection)); gsm_client_set_status (GSM_CLIENT (client), GSM_CLIENT_FAILED); gsm_client_disconnected (GSM_CLIENT (client)); return FALSE; } ",1 "static void nfs4_xdr_enc_commit(struct rpc_rqst *req, struct xdr_stream *xdr, struct nfs_writeargs *args) { struct compound_hdr hdr = { .minorversion = nfs4_xdr_minorversion(&args->seq_args), }; encode_compound_hdr(xdr, req, &hdr); encode_sequence(xdr, &args->seq_args, &hdr); encode_putfh(xdr, args->fh, &hdr); encode_commit(xdr, args, &hdr); if (args->bitmask) encode_getfattr(xdr, args->bitmask, &hdr); encode_nops(&hdr); } ",0 "bool AsyncReadPixelsCompletedQuery::Begin() { return true; } ",0 "nfs4_layoutget_prepare(struct rpc_task *task, void *calldata) { struct nfs4_layoutget *lgp = calldata; struct nfs_server *server = NFS_SERVER(lgp->args.inode); dprintk(""--> %s\n"", __func__); /* Note the is a race here, where a CB_LAYOUTRECALL can come in * right now covering the LAYOUTGET we are about to send. * However, that is not so catastrophic, and there seems * to be no way to prevent it completely. */ if (nfs4_setup_sequence(server, &lgp->args.seq_args, &lgp->res.seq_res, 0, task)) return; if (pnfs_choose_layoutget_stateid(&lgp->args.stateid, NFS_I(lgp->args.inode)->layout, lgp->args.ctx->state)) { rpc_exit(task, NFS4_OK); return; } rpc_call_start(task); } ",0 "int tls1_mac(SSL *ssl, SSL3_RECORD *rec, unsigned char *md, int send) { unsigned char *seq; EVP_MD_CTX *hash; size_t md_size; int i; EVP_MD_CTX *hmac = NULL, *mac_ctx; unsigned char header[13]; int stream_mac = (send ? (ssl->mac_flags & SSL_MAC_FLAG_WRITE_MAC_STREAM) : (ssl->mac_flags & SSL_MAC_FLAG_READ_MAC_STREAM)); int t; if (send) { seq = RECORD_LAYER_get_write_sequence(&ssl->rlayer); hash = ssl->write_hash; } else { seq = RECORD_LAYER_get_read_sequence(&ssl->rlayer); hash = ssl->read_hash; } t = EVP_MD_CTX_size(hash); OPENSSL_assert(t >= 0); md_size = t; /* I should fix this up TLS TLS TLS TLS TLS XXXXXXXX */ if (stream_mac) { mac_ctx = hash; } else { hmac = EVP_MD_CTX_new(); if (hmac == NULL || !EVP_MD_CTX_copy(hmac, hash)) return -1; mac_ctx = hmac; } if (SSL_IS_DTLS(ssl)) { unsigned char dtlsseq[8], *p = dtlsseq; s2n(send ? DTLS_RECORD_LAYER_get_w_epoch(&ssl->rlayer) : DTLS_RECORD_LAYER_get_r_epoch(&ssl->rlayer), p); memcpy(p, &seq[2], 6); memcpy(header, dtlsseq, 8); } else memcpy(header, seq, 8); header[8] = rec->type; header[9] = (unsigned char)(ssl->version >> 8); header[10] = (unsigned char)(ssl->version); header[11] = (rec->length) >> 8; header[12] = (rec->length) & 0xff; if (!send && !SSL_USE_ETM(ssl) && EVP_CIPHER_CTX_mode(ssl->enc_read_ctx) == EVP_CIPH_CBC_MODE && ssl3_cbc_record_digest_supported(mac_ctx)) { /* * This is a CBC-encrypted record. We must avoid leaking any * timing-side channel information about how many blocks of data we * are hashing because that gives an attacker a timing-oracle. */ /* Final param == not SSLv3 */ if (ssl3_cbc_digest_record(mac_ctx, md, &md_size, header, rec->input, rec->length + md_size, rec->orig_len, ssl->s3->read_mac_secret, ssl->s3->read_mac_secret_size, 0) <= 0) { EVP_MD_CTX_free(hmac); return -1; } } else { if (EVP_DigestSignUpdate(mac_ctx, header, sizeof(header)) <= 0 || EVP_DigestSignUpdate(mac_ctx, rec->input, rec->length) <= 0 || EVP_DigestSignFinal(mac_ctx, md, &md_size) <= 0) { EVP_MD_CTX_free(hmac); return -1; } if (!send && !SSL_USE_ETM(ssl) && FIPS_mode()) if (!tls_fips_digest_extra(ssl->enc_read_ctx, mac_ctx, rec->input, rec->length, rec->orig_len)) { EVP_MD_CTX_free(hmac); return -1; } } EVP_MD_CTX_free(hmac); #ifdef SSL_DEBUG fprintf(stderr, ""seq=""); { int z; for (z = 0; z < 8; z++) fprintf(stderr, ""%02X "", seq[z]); fprintf(stderr, ""\n""); } fprintf(stderr, ""rec=""); { unsigned int z; for (z = 0; z < rec->length; z++) fprintf(stderr, ""%02X "", rec->data[z]); fprintf(stderr, ""\n""); } #endif if (!SSL_IS_DTLS(ssl)) { for (i = 7; i >= 0; i--) { ++seq[i]; if (seq[i] != 0) break; } } #ifdef SSL_DEBUG { unsigned int z; for (z = 0; z < md_size; z++) fprintf(stderr, ""%02X "", md[z]); fprintf(stderr, ""\n""); } #endif return (md_size); } ",0 "void PrepareFrameAndViewForPrint::FinishPrinting() { if (!finished_) { finished_ = true; frame_->printEnd(); web_view_->resize(prev_view_size_); if (WebFrame* web_frame = web_view_->mainFrame()) web_frame->setScrollOffset(prev_scroll_offset_); } } ",0 "omx_video::omx_cmd_queue::omx_cmd_queue(): m_read(0),m_write(0),m_size(0) { memset(m_q,0,sizeof(omx_event)*OMX_CORE_CONTROL_CMDQ_SIZE); } ",0 "authentic_pin_cmd(struct sc_card *card, struct sc_pin_cmd_data *data, int *tries_left) { struct sc_context *ctx = card->ctx; int rv = SC_ERROR_INTERNAL; LOG_FUNC_CALLED(ctx); sc_log(ctx, ""PIN-CMD:%X,PIN(type:%X,ret:%i)"", data->cmd, data->pin_type, data->pin_reference); sc_log(ctx, ""PIN1(%p,len:%i,tries-left:%i)"", data->pin1.data, data->pin1.len, data->pin1.tries_left); sc_log(ctx, ""PIN2(%p,len:%i)"", data->pin2.data, data->pin2.len); switch (data->cmd) { case SC_PIN_CMD_VERIFY: rv = authentic_pin_verify(card, data); break; case SC_PIN_CMD_CHANGE: rv = authentic_pin_change(card, data, tries_left); break; case SC_PIN_CMD_UNBLOCK: rv = authentic_pin_reset(card, data, tries_left); break; case SC_PIN_CMD_GET_INFO: rv = authentic_pin_get_policy(card, data); break; default: LOG_TEST_RET(ctx, SC_ERROR_NOT_SUPPORTED, ""Unsupported PIN command""); } if (rv == SC_ERROR_PIN_CODE_INCORRECT && tries_left) *tries_left = data->pin1.tries_left; LOG_FUNC_RETURN(ctx, rv); } ",0 "void perf_pmu_migrate_context(struct pmu *pmu, int src_cpu, int dst_cpu) { struct perf_event_context *src_ctx; struct perf_event_context *dst_ctx; struct perf_event *event, *tmp; LIST_HEAD(events); src_ctx = &per_cpu_ptr(pmu->pmu_cpu_context, src_cpu)->ctx; dst_ctx = &per_cpu_ptr(pmu->pmu_cpu_context, dst_cpu)->ctx; mutex_lock(&src_ctx->mutex); list_for_each_entry_safe(event, tmp, &src_ctx->event_list, event_entry) { perf_remove_from_context(event, false); unaccount_event_cpu(event, src_cpu); put_ctx(src_ctx); list_add(&event->migrate_entry, &events); } mutex_unlock(&src_ctx->mutex); synchronize_rcu(); mutex_lock(&dst_ctx->mutex); list_for_each_entry_safe(event, tmp, &events, migrate_entry) { list_del(&event->migrate_entry); if (event->state >= PERF_EVENT_STATE_OFF) event->state = PERF_EVENT_STATE_INACTIVE; account_event_cpu(event, dst_cpu); perf_install_in_context(dst_ctx, event, dst_cpu); get_ctx(dst_ctx); } mutex_unlock(&dst_ctx->mutex); } ",0 "bool GLES2DecoderPassthroughImpl::WasContextLostByRobustnessExtension() const { return WasContextLost() && reset_by_robustness_extension_; } ",0 "choose_volume(struct archive_read *a, struct iso9660 *iso9660) { struct file_info *file; int64_t skipsize; struct vd *vd; const void *block; char seenJoliet; vd = &(iso9660->primary); if (!iso9660->opt_support_joliet) iso9660->seenJoliet = 0; if (iso9660->seenJoliet && vd->location > iso9660->joliet.location) /* This condition is unlikely; by way of caution. */ vd = &(iso9660->joliet); skipsize = LOGICAL_BLOCK_SIZE * vd->location; skipsize = __archive_read_consume(a, skipsize); if (skipsize < 0) return ((int)skipsize); iso9660->current_position = skipsize; block = __archive_read_ahead(a, vd->size, NULL); if (block == NULL) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, ""Failed to read full block when scanning "" ""ISO9660 directory list""); return (ARCHIVE_FATAL); } /* * While reading Root Directory, flag seenJoliet must be zero to * avoid converting special name 0x00(Current Directory) and * next byte to UCS2. */ seenJoliet = iso9660->seenJoliet;/* Save flag. */ iso9660->seenJoliet = 0; file = parse_file_info(a, NULL, block); if (file == NULL) return (ARCHIVE_FATAL); iso9660->seenJoliet = seenJoliet; /* * If the iso image has both RockRidge and Joliet, we preferentially * use RockRidge Extensions rather than Joliet ones. */ if (vd == &(iso9660->primary) && iso9660->seenRockridge && iso9660->seenJoliet) iso9660->seenJoliet = 0; if (vd == &(iso9660->primary) && !iso9660->seenRockridge && iso9660->seenJoliet) { /* Switch reading data from primary to joliet. */ vd = &(iso9660->joliet); skipsize = LOGICAL_BLOCK_SIZE * vd->location; skipsize -= iso9660->current_position; skipsize = __archive_read_consume(a, skipsize); if (skipsize < 0) return ((int)skipsize); iso9660->current_position += skipsize; block = __archive_read_ahead(a, vd->size, NULL); if (block == NULL) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, ""Failed to read full block when scanning "" ""ISO9660 directory list""); return (ARCHIVE_FATAL); } iso9660->seenJoliet = 0; file = parse_file_info(a, NULL, block); if (file == NULL) return (ARCHIVE_FATAL); iso9660->seenJoliet = seenJoliet; } /* Store the root directory in the pending list. */ if (add_entry(a, iso9660, file) != ARCHIVE_OK) return (ARCHIVE_FATAL); if (iso9660->seenRockridge) { a->archive.archive_format = ARCHIVE_FORMAT_ISO9660_ROCKRIDGE; a->archive.archive_format_name = ""ISO9660 with Rockridge extensions""; } return (ARCHIVE_OK); } ",1 " void SyncManager::SyncInternal::OnServerConnectionEvent( const ServerConnectionEvent& event) { DCHECK(thread_checker_.CalledOnValidThread()); allstatus_.HandleServerConnectionEvent(event); if (event.connection_code == browser_sync::HttpResponse::SERVER_CONNECTION_OK) { ObserverList temp_obs_list; CopyObservers(&temp_obs_list); FOR_EACH_OBSERVER(SyncManager::Observer, temp_obs_list, OnAuthError(AuthError::None())); } if (event.connection_code == browser_sync::HttpResponse::SYNC_AUTH_ERROR) { observing_ip_address_changes_ = false; ObserverList temp_obs_list; CopyObservers(&temp_obs_list); FOR_EACH_OBSERVER(SyncManager::Observer, temp_obs_list, OnAuthError(AuthError(AuthError::INVALID_GAIA_CREDENTIALS))); } if (event.connection_code == browser_sync::HttpResponse::SYNC_SERVER_ERROR) { ObserverList temp_obs_list; CopyObservers(&temp_obs_list); FOR_EACH_OBSERVER(SyncManager::Observer, temp_obs_list, OnAuthError(AuthError(AuthError::CONNECTION_FAILED))); } } ",0 "void V8TestObject::LongSequenceMethodMethodCallback(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_longSequenceMethod""); test_object_v8_internal::LongSequenceMethodMethod(info); } ",0 "static int decode_level0_header(LHAFileHeader **header, LHAInputStream *stream) { uint8_t header_len; uint8_t header_csum; size_t path_len; size_t min_len; header_len = RAW_DATA(header, 0); header_csum = RAW_DATA(header, 1); switch ((*header)->header_level) { case 0: min_len = LEVEL_0_MIN_HEADER_LEN; break; case 1: min_len = LEVEL_1_MIN_HEADER_LEN; break; default: return 0; } if (header_len < min_len) { return 0; } if (!extend_raw_data(header, stream, header_len + 2 - RAW_DATA_LEN(header))) { return 0; } if (!check_l0_checksum(&RAW_DATA(header, 2), RAW_DATA_LEN(header) - 2, header_csum)) { return 0; } memcpy((*header)->compress_method, &RAW_DATA(header, 2), 5); (*header)->compress_method[5] = '\0'; (*header)->compressed_length = lha_decode_uint32(&RAW_DATA(header, 7)); (*header)->length = lha_decode_uint32(&RAW_DATA(header, 11)); (*header)->timestamp = decode_ftime(&RAW_DATA(header, 15)); path_len = RAW_DATA(header, 21); if (min_len + path_len > header_len) { return 0; } if ((*header)->header_level == 0) { (*header)->os_type = LHA_OS_TYPE_UNKNOWN; } else { (*header)->os_type = RAW_DATA(header, 24 + path_len); } if (!process_level0_path(*header, &RAW_DATA(header, 22), path_len)) { return 0; } (*header)->crc = lha_decode_uint16(&RAW_DATA(header, 22 + path_len)); if ((*header)->header_level == 0 && header_len > LEVEL_0_MIN_HEADER_LEN + path_len) { process_level0_extended_area(*header, &RAW_DATA(header, LEVEL_0_MIN_HEADER_LEN + 2 + path_len), header_len - LEVEL_0_MIN_HEADER_LEN - path_len); } return 1; } ",0 "ssize_t libevt_record_values_read( libevt_record_values_t *record_values, libbfio_handle_t *file_io_handle, libevt_io_handle_t *io_handle, off64_t *file_offset, uint8_t strict_mode, libcerror_error_t **error ) { uint8_t record_size_data[ 4 ]; uint8_t *record_data = NULL; static char *function = ""libevt_record_values_read""; size_t read_size = 0; size_t record_data_offset = 0; ssize_t read_count = 0; ssize_t total_read_count = 0; uint32_t record_data_size = 0; if( record_values == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, ""%s: invalid record values."", function ); return( -1 ); } if( io_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, ""%s: invalid IO handle."", function ); return( -1 ); } if( file_offset == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, ""%s: invalid file offset."", function ); return( -1 ); } record_values->offset = *file_offset; read_count = libbfio_handle_read_buffer( file_io_handle, record_size_data, sizeof( uint32_t ), error ); if( read_count != (ssize_t) sizeof( uint32_t ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, ""%s: unable to read record size data."", function ); goto on_error; } *file_offset += read_count; total_read_count = read_count; byte_stream_copy_to_uint32_little_endian( record_size_data, record_data_size ); if( record_data_size < 4 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, ""%s: record data size value out of bounds."", function ); goto on_error; } #if SIZEOF_SIZE_T <= 4 if( (size_t) record_data_size > (size_t) SSIZE_MAX ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_EXCEEDS_MAXIMUM, ""%s: invalid record data size value exceeds maximum."", function ); goto on_error; } #endif /* Allocating record data as 4 bytes and then using realloc here * corrupts the memory */ record_data = (uint8_t *) memory_allocate( sizeof( uint8_t ) * record_data_size ); if( record_data == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_INSUFFICIENT, ""%s: unable to create record data."", function ); goto on_error; } byte_stream_copy_from_uint32_little_endian( record_data, record_data_size ); record_data_offset = 4; read_size = record_data_size - record_data_offset; if( ( (size64_t) *file_offset + read_size ) > io_handle->file_size ) { read_size = (size_t) ( io_handle->file_size - *file_offset ); } read_count = libbfio_handle_read_buffer( file_io_handle, &( record_data[ record_data_offset ] ), read_size, error ); if( read_count != (ssize_t) read_size ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, ""%s: unable to read record data."", function ); goto on_error; } *file_offset += read_count; record_data_offset += read_count; total_read_count += read_count; if( record_data_offset < (size_t) record_data_size ) { if( libbfio_handle_seek_offset( file_io_handle, (off64_t) sizeof( evt_file_header_t ), SEEK_SET, error ) == -1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_SEEK_FAILED, ""%s: unable to seek file header offset: %"" PRIzd ""."", function, sizeof( evt_file_header_t ) ); goto on_error; } *file_offset = (off64_t) sizeof( evt_file_header_t ); read_size = (size_t) record_data_size - record_data_offset; read_count = libbfio_handle_read_buffer( file_io_handle, &( record_data[ record_data_offset ] ), read_size, error ); if( read_count != (ssize_t) read_size ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, ""%s: unable to read record data."", function ); goto on_error; } *file_offset += read_count; total_read_count += read_count; } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( ""%s: record data:\n"", function ); libcnotify_print_data( record_data, (size_t) record_data_size, LIBCNOTIFY_PRINT_DATA_FLAG_GROUP_DATA ); } #endif if( memory_compare( &( record_data[ 4 ] ), evt_file_signature, 4 ) == 0 ) { record_values->type = LIBEVT_RECORD_TYPE_EVENT; } else if( memory_compare( &( record_data[ 4 ] ), evt_end_of_file_record_signature1, 4 ) == 0 ) { record_values->type = LIBEVT_RECORD_TYPE_END_OF_FILE; } else { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, ""%s: unsupported record values signature."", function ); goto on_error; } if( record_values->type == LIBEVT_RECORD_TYPE_EVENT ) { if( libevt_record_values_read_event( record_values, record_data, (size_t) record_data_size, strict_mode, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, ""%s: unable to read event record values."", function ); goto on_error; } } else if( record_values->type == LIBEVT_RECORD_TYPE_END_OF_FILE ) { if( libevt_record_values_read_end_of_file( record_values, record_data, (size_t) record_data_size, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, ""%s: unable to read end of file record values."", function ); goto on_error; } } memory_free( record_data ); return( total_read_count ); on_error: if( record_data != NULL ) { memory_free( record_data ); } return( -1 ); } ",0 "static inline void *flexarray_get(struct flexarray *flex, int index) { int bin; if (index >= flex->item_count) return NULL; bin = flexarray_get_bin(flex, index); if (bin < 0 || bin >= flex->bin_count) return NULL; return flex->bins[bin][flexarray_get_bin_offset(flex, bin, index)]; } ",0 "static int opfmul(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { case 1: if ( op->operands[0].type & OT_MEMORY ) { if ( op->operands[0].type & OT_DWORD ) { data[l++] = 0xd8; data[l++] = 0x08 | op->operands[0].regs[0]; } else if ( op->operands[0].type & OT_QWORD ) { data[l++] = 0xdc; data[l++] = 0x08 | op->operands[0].regs[0]; } else { return -1; } } else { return -1; } break; case 2: if ( op->operands[0].type & OT_FPUREG & ~OT_REGALL && op->operands[0].reg == 0 && op->operands[1].type & OT_FPUREG & ~OT_REGALL ) { data[l++] = 0xd8; data[l++] = 0xc8 | op->operands[1].reg; } else if ( op->operands[0].type & OT_FPUREG & ~OT_REGALL && op->operands[1].type & OT_FPUREG & ~OT_REGALL && op->operands[1].reg == 0 ) { data[l++] = 0xdc; data[l++] = 0xc8 | op->operands[0].reg; } else { return -1; } break; default: return -1; } return l; } ",0 "void GLES2Implementation::DestroyGpuFenceCHROMIUMHelper(GLuint client_id) { if (GetIdAllocator(IdNamespaces::kGpuFences)->InUse(client_id)) { GetIdAllocator(IdNamespaces::kGpuFences)->FreeID(client_id); helper_->DestroyGpuFenceCHROMIUM(client_id); } else { SetGLError(GL_INVALID_VALUE, ""glDestroyGpuFenceCHROMIUM"", ""id not created by this context.""); } } ",0 " virtual void GetEntryInfoCallback( base::PlatformFileError error, const FilePath& entry_path, scoped_ptr entry_proto) { last_error_ = error; entry_proto_ = entry_proto.Pass(); } ",0 "Frame* FrameLoader::opener() { return m_opener; } ",0 "grub_ext2_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) { struct grub_ext2_data *data = node->data; struct grub_ext2_inode *inode = &node->inode; int blknr = -1; unsigned int blksz = EXT2_BLOCK_SIZE (data); int log2_blksz = LOG2_EXT2_BLOCK_SIZE (data); if (grub_le_to_cpu32(inode->flags) & EXT4_EXTENTS_FLAG) { #ifndef _MSC_VER char buf[EXT2_BLOCK_SIZE (data)]; #else char * buf = grub_malloc (EXT2_BLOCK_SIZE(data)); #endif struct grub_ext4_extent_header *leaf; struct grub_ext4_extent *ext; int i; leaf = grub_ext4_find_leaf (data, buf, (struct grub_ext4_extent_header *) inode->blocks.dir_blocks, fileblock); if (! leaf) { grub_error (GRUB_ERR_BAD_FS, ""invalid extent""); return -1; } ext = (struct grub_ext4_extent *) (leaf + 1); for (i = 0; i < grub_le_to_cpu16 (leaf->entries); i++) { if (fileblock < grub_le_to_cpu32 (ext[i].block)) break; } if (--i >= 0) { fileblock -= grub_le_to_cpu32 (ext[i].block); if (fileblock >= grub_le_to_cpu16 (ext[i].len)) return 0; else { grub_disk_addr_t start; start = grub_le_to_cpu16 (ext[i].start_hi); start = (start << 32) + grub_le_to_cpu32 (ext[i].start); return fileblock + start; } } else { grub_error (GRUB_ERR_BAD_FS, ""something wrong with extent""); return -1; } } /* Direct blocks. */ if (fileblock < INDIRECT_BLOCKS) { blknr = grub_le_to_cpu32 (inode->blocks.dir_blocks[fileblock]); /* Indirect. */ } else if (fileblock < INDIRECT_BLOCKS + blksz / 4) { grub_uint32_t *indir; indir = grub_malloc (blksz); if (! indir) return grub_errno; if (grub_disk_read (data->disk, ((grub_disk_addr_t) grub_le_to_cpu32 (inode->blocks.indir_block)) << log2_blksz, 0, blksz, indir)) return grub_errno; blknr = grub_le_to_cpu32 (indir[fileblock - INDIRECT_BLOCKS]); grub_free (indir); } /* Double indirect. */ else if (fileblock < (grub_disk_addr_t)(INDIRECT_BLOCKS + blksz / 4) \ * (grub_disk_addr_t)(blksz / 4 + 1)) { unsigned int perblock = blksz / 4; unsigned int rblock = fileblock - (INDIRECT_BLOCKS + blksz / 4); grub_uint32_t *indir; indir = grub_malloc (blksz); if (! indir) return grub_errno; if (grub_disk_read (data->disk, ((grub_disk_addr_t) grub_le_to_cpu32 (inode->blocks.double_indir_block)) << log2_blksz, 0, blksz, indir)) return grub_errno; if (grub_disk_read (data->disk, ((grub_disk_addr_t) grub_le_to_cpu32 (indir[rblock / perblock])) << log2_blksz, 0, blksz, indir)) return grub_errno; blknr = grub_le_to_cpu32 (indir[rblock % perblock]); grub_free (indir); } /* triple indirect. */ else { grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, ""ext2fs doesn't support triple indirect blocks""); } return blknr; } ",1 "static int fsmChown(const char *path, mode_t mode, uid_t uid, gid_t gid) { int rc = S_ISLNK(mode) ? lchown(path, uid, gid) : chown(path, uid, gid); if (rc < 0) { struct stat st; if (lstat(path, &st) == 0 && st.st_uid == uid && st.st_gid == gid) rc = 0; } if (_fsm_debug) rpmlog(RPMLOG_DEBUG, "" %8s (%s, %d, %d) %s\n"", __func__, path, (int)uid, (int)gid, (rc < 0 ? strerror(errno) : """")); if (rc < 0) rc = RPMERR_CHOWN_FAILED; return rc; } ",0 "void NavigationControllerImpl::Restore( int selected_navigation, RestoreType type, std::vector>* entries) { DCHECK(GetEntryCount() == 0 && !GetPendingEntry()); DCHECK(selected_navigation >= 0 && selected_navigation < static_cast(entries->size())); needs_reload_ = true; entries_.reserve(entries->size()); for (auto& entry : *entries) entries_.push_back( NavigationEntryImpl::FromNavigationEntry(std::move(entry))); entries->clear(); FinishRestore(selected_navigation, type); } ",0 "static int crypto_update_alg(struct sk_buff *skb, struct nlmsghdr *nlh, struct nlattr **attrs) { struct crypto_alg *alg; struct crypto_user_alg *p = nlmsg_data(nlh); struct nlattr *priority = attrs[CRYPTOCFGA_PRIORITY_VAL]; LIST_HEAD(list); if (priority && !strlen(p->cru_driver_name)) return -EINVAL; alg = crypto_alg_match(p, 1); if (!alg) return -ENOENT; down_write(&crypto_alg_sem); crypto_remove_spawns(alg, &list, NULL); if (priority) alg->cra_priority = nla_get_u32(priority); up_write(&crypto_alg_sem); crypto_remove_final(&list); return 0; } ",0 "static int ext4_inode_csum_verify(struct inode *inode, struct ext4_inode *raw, struct ext4_inode_info *ei) { __u32 provided, calculated; if (EXT4_SB(inode->i_sb)->s_es->s_creator_os != cpu_to_le32(EXT4_OS_LINUX) || !ext4_has_metadata_csum(inode->i_sb)) return 1; provided = le16_to_cpu(raw->i_checksum_lo); calculated = ext4_inode_csum(inode, raw, ei); if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE && EXT4_FITS_IN_INODE(raw, ei, i_checksum_hi)) provided |= ((__u32)le16_to_cpu(raw->i_checksum_hi)) << 16; else calculated &= 0xFFFF; return provided == calculated; } ",0 "void SyncManager::UpdateEnabledTypes() { DCHECK(thread_checker_.CalledOnValidThread()); data_->UpdateEnabledTypes(); } ",0 "int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy) { if (phy->attached_tproto & SAS_PROTOCOL_STP) dev->tproto = phy->attached_tproto; if (phy->attached_sata_dev) dev->tproto |= SAS_SATA_DEV; if (phy->attached_dev_type == SAS_SATA_PENDING) dev->dev_type = SAS_SATA_PENDING; else { int res; dev->dev_type = SAS_SATA_DEV; res = sas_get_report_phy_sata(dev->parent, phy->phy_id, &dev->sata_dev.rps_resp); if (res) { SAS_DPRINTK(""report phy sata to %016llx:0x%x returned "" ""0x%x\n"", SAS_ADDR(dev->parent->sas_addr), phy->phy_id, res); return res; } memcpy(dev->frame_rcvd, &dev->sata_dev.rps_resp.rps.fis, sizeof(struct dev_to_host_fis)); dev->sata_dev.class = sas_get_ata_command_set(dev); } return 0; } ",0 "gstd_close(void *the_tok) { struct gstd_tok *tok = the_tok; OM_uint32 min; gss_delete_sec_context(&min, &tok->gstd_ctx, GSS_C_NO_BUFFER); if (tok->gstd_inbuf.length > 0) gss_release_buffer(&min, &tok->gstd_inbuf); close(tok->gstd_fd); return 0; } ",0 "MYSQLND_METHOD(mysqlnd_conn_data, sqlstate)(const MYSQLND_CONN_DATA * const conn TSRMLS_DC) { return conn->error_info->sqlstate[0] ? conn->error_info->sqlstate:MYSQLND_SQLSTATE_NULL; } ",0 "static void getKeyTypes(redisReply *keys, int *types) { redisReply *reply; unsigned int i; /* Pipeline TYPE commands */ for(i=0;ielements;i++) { redisAppendCommand(context, ""TYPE %s"", keys->element[i]->str); } /* Retrieve types */ for(i=0;ielements;i++) { if(redisGetReply(context, (void**)&reply)!=REDIS_OK) { fprintf(stderr, ""Error getting type for key '%s' (%d: %s)\n"", keys->element[i]->str, context->err, context->errstr); exit(1); } else if(reply->type != REDIS_REPLY_STATUS) { if(reply->type == REDIS_REPLY_ERROR) { fprintf(stderr, ""TYPE returned an error: %s\n"", reply->str); } else { fprintf(stderr, ""Invalid reply type (%d) for TYPE on key '%s'!\n"", reply->type, keys->element[i]->str); } exit(1); } types[i] = toIntType(keys->element[i]->str, reply->str); freeReplyObject(reply); } } ",0 "static int shash_final_unaligned(struct shash_desc *desc, u8 *out) { struct crypto_shash *tfm = desc->tfm; unsigned long alignmask = crypto_shash_alignmask(tfm); struct shash_alg *shash = crypto_shash_alg(tfm); unsigned int ds = crypto_shash_digestsize(tfm); u8 ubuf[shash_align_buffer_size(ds, alignmask)] __aligned_largest; u8 *buf = PTR_ALIGN(&ubuf[0], alignmask + 1); int err; err = shash->final(desc, buf); if (err) goto out; memcpy(out, buf, ds); out: memset(buf, 0, ds); return err; } ",0 "int32 NavigationControllerImpl::GetMaxRestoredPageID() const { return max_restored_page_id_; } ",0 "static int check_stack_boundary(struct bpf_verifier_env *env, int regno, int access_size, bool zero_size_allowed, struct bpf_call_arg_meta *meta) { struct bpf_reg_state *reg = reg_state(env, regno); struct bpf_func_state *state = func(env, reg); int off, i, slot, spi; if (reg->type != PTR_TO_STACK) { /* Allow zero-byte read from NULL, regardless of pointer type */ if (zero_size_allowed && access_size == 0 && register_is_null(reg)) return 0; verbose(env, ""R%d type=%s expected=%s\n"", regno, reg_type_str[reg->type], reg_type_str[PTR_TO_STACK]); return -EACCES; } /* Only allow fixed-offset stack reads */ if (!tnum_is_const(reg->var_off)) { char tn_buf[48]; tnum_strn(tn_buf, sizeof(tn_buf), reg->var_off); verbose(env, ""invalid variable stack read R%d var_off=%s\n"", regno, tn_buf); return -EACCES; } off = reg->off + reg->var_off.value; if (off >= 0 || off < -MAX_BPF_STACK || off + access_size > 0 || access_size < 0 || (access_size == 0 && !zero_size_allowed)) { verbose(env, ""invalid stack type R%d off=%d access_size=%d\n"", regno, off, access_size); return -EACCES; } if (meta && meta->raw_mode) { meta->access_size = access_size; meta->regno = regno; return 0; } for (i = 0; i < access_size; i++) { u8 *stype; slot = -(off + i) - 1; spi = slot / BPF_REG_SIZE; if (state->allocated_stack <= slot) goto err; stype = &state->stack[spi].slot_type[slot % BPF_REG_SIZE]; if (*stype == STACK_MISC) goto mark; if (*stype == STACK_ZERO) { /* helper can write anything into the stack */ *stype = STACK_MISC; goto mark; } err: verbose(env, ""invalid indirect read from stack off %d+%d size %d\n"", off, i, access_size); return -EACCES; mark: /* reading any byte out of 8-byte 'spill_slot' will cause * the whole slot to be marked as 'read' */ mark_reg_read(env, &state->stack[spi].spilled_ptr, state->stack[spi].spilled_ptr.parent); } return update_stack_depth(env, state, off); } ",0 "store_tabletYtilt(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct aiptek *aiptek = dev_get_drvdata(dev); int y; if (kstrtoint(buf, 10, &y)) { size_t len = buf[count - 1] == '\n' ? count - 1 : count; if (strncmp(buf, ""disable"", len)) return -EINVAL; aiptek->newSetting.yTilt = AIPTEK_TILT_DISABLE; } else { if (y < AIPTEK_TILT_MIN || y > AIPTEK_TILT_MAX) return -EINVAL; aiptek->newSetting.yTilt = y; } return count; } ",0 "int ff_mpeg4_decode_picture_header(Mpeg4DecContext *ctx, GetBitContext *gb) { MpegEncContext *s = &ctx->m; unsigned startcode, v; int ret; int vol = 0; /* search next start code */ align_get_bits(gb); if (!s->studio_profile && s->avctx->bits_per_raw_sample != 8) s->avctx->bits_per_raw_sample = 0; if (s->codec_tag == AV_RL32(""WV1F"") && show_bits(gb, 24) == 0x575630) { skip_bits(gb, 24); if (get_bits(gb, 8) == 0xF0) goto end; } startcode = 0xff; for (;;) { if (get_bits_count(gb) >= gb->size_in_bits) { if (gb->size_in_bits == 8 && (ctx->divx_version >= 0 || ctx->xvid_build >= 0) || s->codec_tag == AV_RL32(""QMP4"")) { av_log(s->avctx, AV_LOG_VERBOSE, ""frame skip %d\n"", gb->size_in_bits); return FRAME_SKIPPED; // divx bug } else return AVERROR_INVALIDDATA; // end of stream } /* use the bits after the test */ v = get_bits(gb, 8); startcode = ((startcode << 8) | v) & 0xffffffff; if ((startcode & 0xFFFFFF00) != 0x100) continue; // no startcode if (s->avctx->debug & FF_DEBUG_STARTCODE) { av_log(s->avctx, AV_LOG_DEBUG, ""startcode: %3X "", startcode); if (startcode <= 0x11F) av_log(s->avctx, AV_LOG_DEBUG, ""Video Object Start""); else if (startcode <= 0x12F) av_log(s->avctx, AV_LOG_DEBUG, ""Video Object Layer Start""); else if (startcode <= 0x13F) av_log(s->avctx, AV_LOG_DEBUG, ""Reserved""); else if (startcode <= 0x15F) av_log(s->avctx, AV_LOG_DEBUG, ""FGS bp start""); else if (startcode <= 0x1AF) av_log(s->avctx, AV_LOG_DEBUG, ""Reserved""); else if (startcode == 0x1B0) av_log(s->avctx, AV_LOG_DEBUG, ""Visual Object Seq Start""); else if (startcode == 0x1B1) av_log(s->avctx, AV_LOG_DEBUG, ""Visual Object Seq End""); else if (startcode == 0x1B2) av_log(s->avctx, AV_LOG_DEBUG, ""User Data""); else if (startcode == 0x1B3) av_log(s->avctx, AV_LOG_DEBUG, ""Group of VOP start""); else if (startcode == 0x1B4) av_log(s->avctx, AV_LOG_DEBUG, ""Video Session Error""); else if (startcode == 0x1B5) av_log(s->avctx, AV_LOG_DEBUG, ""Visual Object Start""); else if (startcode == 0x1B6) av_log(s->avctx, AV_LOG_DEBUG, ""Video Object Plane start""); else if (startcode == 0x1B7) av_log(s->avctx, AV_LOG_DEBUG, ""slice start""); else if (startcode == 0x1B8) av_log(s->avctx, AV_LOG_DEBUG, ""extension start""); else if (startcode == 0x1B9) av_log(s->avctx, AV_LOG_DEBUG, ""fgs start""); else if (startcode == 0x1BA) av_log(s->avctx, AV_LOG_DEBUG, ""FBA Object start""); else if (startcode == 0x1BB) av_log(s->avctx, AV_LOG_DEBUG, ""FBA Object Plane start""); else if (startcode == 0x1BC) av_log(s->avctx, AV_LOG_DEBUG, ""Mesh Object start""); else if (startcode == 0x1BD) av_log(s->avctx, AV_LOG_DEBUG, ""Mesh Object Plane start""); else if (startcode == 0x1BE) av_log(s->avctx, AV_LOG_DEBUG, ""Still Texture Object start""); else if (startcode == 0x1BF) av_log(s->avctx, AV_LOG_DEBUG, ""Texture Spatial Layer start""); else if (startcode == 0x1C0) av_log(s->avctx, AV_LOG_DEBUG, ""Texture SNR Layer start""); else if (startcode == 0x1C1) av_log(s->avctx, AV_LOG_DEBUG, ""Texture Tile start""); else if (startcode == 0x1C2) av_log(s->avctx, AV_LOG_DEBUG, ""Texture Shape Layer start""); else if (startcode == 0x1C3) av_log(s->avctx, AV_LOG_DEBUG, ""stuffing start""); else if (startcode <= 0x1C5) av_log(s->avctx, AV_LOG_DEBUG, ""reserved""); else if (startcode <= 0x1FF) av_log(s->avctx, AV_LOG_DEBUG, ""System start""); av_log(s->avctx, AV_LOG_DEBUG, "" at %d\n"", get_bits_count(gb)); } if (startcode >= 0x120 && startcode <= 0x12F) { if (vol) { av_log(s->avctx, AV_LOG_WARNING, ""Ignoring multiple VOL headers\n""); continue; } vol++; if ((ret = decode_vol_header(ctx, gb)) < 0) return ret; } else if (startcode == USER_DATA_STARTCODE) { decode_user_data(ctx, gb); } else if (startcode == GOP_STARTCODE) { mpeg4_decode_gop_header(s, gb); } else if (startcode == VOS_STARTCODE) { int profile, level; mpeg4_decode_profile_level(s, gb, &profile, &level); if (profile == FF_PROFILE_MPEG4_SIMPLE_STUDIO && (level > 0 && level < 9)) { s->studio_profile = 1; next_start_code_studio(gb); extension_and_user_data(s, gb, 0); } else if (s->studio_profile) { avpriv_request_sample(s->avctx, ""Mixes studio and non studio profile\n""); return AVERROR_PATCHWELCOME; } s->avctx->profile = profile; s->avctx->level = level; } else if (startcode == VISUAL_OBJ_STARTCODE) { if (s->studio_profile) { if ((ret = decode_studiovisualobject(ctx, gb)) < 0) return ret; } else mpeg4_decode_visual_object(s, gb); } else if (startcode == VOP_STARTCODE) { break; } align_get_bits(gb); startcode = 0xff; } end: if (s->avctx->flags & AV_CODEC_FLAG_LOW_DELAY) s->low_delay = 1; s->avctx->has_b_frames = !s->low_delay; if (s->studio_profile) { if (!s->avctx->bits_per_raw_sample) { av_log(s->avctx, AV_LOG_ERROR, ""Missing VOL header\n""); return AVERROR_INVALIDDATA; } return decode_studio_vop_header(ctx, gb); } else return decode_vop_header(ctx, gb); } ",0 "void RecordDownloadVideoType(const std::string& mime_type_string) { DownloadVideo download_video = DownloadVideo( GetMimeTypeMatch(mime_type_string, getMimeTypeToDownloadVideoMap())); UMA_HISTOGRAM_ENUMERATION(""Download.ContentType.Video"", download_video, DOWNLOAD_VIDEO_MAX); } ",0 "static RBinElfSection* get_section_by_name(ELFOBJ *bin, const char *section_name) { int i; if (!bin->g_sections) { return NULL; } for (i = 0; !bin->g_sections[i].last; i++) { if (!strncmp (bin->g_sections[i].name, section_name, ELF_STRING_LENGTH-1)) { return &bin->g_sections[i]; } } return NULL; } ",0 "WebURLError RenderViewImpl::cannotHandleRequestError( WebFrame* frame, const WebURLRequest& request) { NOTREACHED(); // Since we said we can handle all requests. return WebURLError(); } ",0 "void Part::updateActions() { bool isWritable = m_model->archive() && !m_model->archive()->isReadOnly(); const Archive::Entry *entry = m_model->entryForIndex(m_view->selectionModel()->currentIndex()); int selectedEntriesCount = m_view->selectionModel()->selectedRows().count(); const bool isEncryptedButUnknownPassword = m_model->archive() && m_model->archive()->encryptionType() != Archive::Unencrypted && m_model->archive()->password().isEmpty(); if (isEncryptedButUnknownPassword) { m_addFilesAction->setToolTip(xi18nc(""@info:tooltip"", ""Adding files to existing password-protected archives with no header-encryption is currently not supported."" ""Extract the files and create a new archive if you want to add files."")); m_testArchiveAction->setToolTip(xi18nc(""@info:tooltip"", ""Testing password-protected archives with no header-encryption is currently not supported."")); } else { m_addFilesAction->setToolTip(i18nc(""@info:tooltip"", ""Click to add files to the archive"")); m_testArchiveAction->setToolTip(i18nc(""@info:tooltip"", ""Click to test the archive for integrity"")); } const int maxPreviewSize = ArkSettings::previewFileSizeLimit() * 1024 * 1024; const bool limit = ArkSettings::limitPreviewFileSize(); bool isPreviewable = (!limit || (limit && entry != Q_NULLPTR && entry->property(""size"").toLongLong() < maxPreviewSize)); const bool isDir = (entry == Q_NULLPTR) ? false : entry->isDir(); m_previewAction->setEnabled(!isBusy() && isPreviewable && !isDir && (selectedEntriesCount == 1)); m_extractArchiveAction->setEnabled(!isBusy() && (m_model->rowCount() > 0)); m_extractAction->setEnabled(!isBusy() && (m_model->rowCount() > 0)); m_saveAsAction->setEnabled(!isBusy() && m_model->rowCount() > 0); m_addFilesAction->setEnabled(!isBusy() && isWritable && !isEncryptedButUnknownPassword); m_deleteFilesAction->setEnabled(!isBusy() && isWritable && (selectedEntriesCount > 0)); m_openFileAction->setEnabled(!isBusy() && isPreviewable && !isDir && (selectedEntriesCount == 1)); m_openFileWithAction->setEnabled(!isBusy() && isPreviewable && !isDir && (selectedEntriesCount == 1)); m_propertiesAction->setEnabled(!isBusy() && m_model->archive()); m_renameFileAction->setEnabled(!isBusy() && isWritable && (selectedEntriesCount == 1)); m_cutFilesAction->setEnabled(!isBusy() && isWritable && (selectedEntriesCount > 0)); m_copyFilesAction->setEnabled(!isBusy() && isWritable && (selectedEntriesCount > 0)); m_pasteFilesAction->setEnabled(!isBusy() && isWritable && (selectedEntriesCount == 0 || (selectedEntriesCount == 1 && isDir)) && (m_model->filesToMove.count() > 0 || m_model->filesToCopy.count() > 0)); m_commentView->setEnabled(!isBusy()); m_commentMsgWidget->setEnabled(!isBusy()); m_editCommentAction->setEnabled(false); m_testArchiveAction->setEnabled(false); if (m_model->archive()) { const KPluginMetaData metadata = PluginManager().preferredPluginFor(m_model->archive()->mimeType())->metaData(); bool supportsWriteComment = ArchiveFormat::fromMetadata(m_model->archive()->mimeType(), metadata).supportsWriteComment(); m_editCommentAction->setEnabled(!isBusy() && supportsWriteComment); m_commentView->setReadOnly(!supportsWriteComment); m_editCommentAction->setText(m_model->archive()->hasComment() ? i18nc(""@action:inmenu mutually exclusive with Add &Comment"", ""Edit &Comment"") : i18nc(""@action:inmenu mutually exclusive with Edit &Comment"", ""Add &Comment"")); bool supportsTesting = ArchiveFormat::fromMetadata(m_model->archive()->mimeType(), metadata).supportsTesting(); m_testArchiveAction->setEnabled(!isBusy() && supportsTesting && !isEncryptedButUnknownPassword); } else { m_commentView->setReadOnly(true); m_editCommentAction->setText(i18nc(""@action:inmenu mutually exclusive with Edit &Comment"", ""Add &Comment"")); } } ",0 "void BrowserPluginGuest::SetSize( const BrowserPluginHostMsg_AutoSize_Params& auto_size_params, const BrowserPluginHostMsg_ResizeGuest_Params& resize_guest_params) { bool old_auto_size_enabled = auto_size_enabled_; gfx::Size old_max_size = max_auto_size_; gfx::Size old_min_size = min_auto_size_; auto_size_enabled_ = auto_size_params.enable; max_auto_size_ = auto_size_params.max_size; min_auto_size_ = auto_size_params.min_size; if (auto_size_enabled_ && (!old_auto_size_enabled || (old_max_size != max_auto_size_) || (old_min_size != min_auto_size_))) { web_contents()->GetRenderViewHost()->EnableAutoResize( min_auto_size_, max_auto_size_); web_contents()->GetRenderViewHost()->Send(new ViewMsg_Repaint( web_contents()->GetRenderViewHost()->GetRoutingID(), max_auto_size_)); } else if (!auto_size_enabled_ && old_auto_size_enabled) { web_contents()->GetRenderViewHost()->DisableAutoResize( resize_guest_params.view_size); } Resize(embedder_web_contents_->GetRenderViewHost(), resize_guest_params); } ",0 "static unsigned char* cJSON_strdup(const unsigned char* string, const internal_hooks * const hooks) { size_t length = 0; unsigned char *copy = NULL; if (string == NULL) { return NULL; } length = strlen((const char*)string) + sizeof(""""); copy = (unsigned char*)hooks->allocate(length); if (copy == NULL) { return NULL; } memcpy(copy, string, length); return copy; } ",0 "cmsBool isabsolutepath(const char *path) { char ThreeChars[4]; if(path == NULL) return FALSE; if (path[0] == 0) return FALSE; strncpy(ThreeChars, path, 3); ThreeChars[3] = 0; if(ThreeChars[0] == DIR_CHAR) return TRUE; #ifdef CMS_IS_WINDOWS_ if (isalpha((int) ThreeChars[0]) && ThreeChars[1] == ':') return TRUE; #endif return FALSE; } ",0 "static unsigned update_treesame(struct rev_info *revs, struct commit *commit) { if (commit->parents && commit->parents->next) { unsigned n; struct treesame_state *st; struct commit_list *p; unsigned relevant_parents; unsigned relevant_change, irrelevant_change; st = lookup_decoration(&revs->treesame, &commit->object); if (!st) die(""update_treesame %s"", oid_to_hex(&commit->object.oid)); relevant_parents = 0; relevant_change = irrelevant_change = 0; for (p = commit->parents, n = 0; p; n++, p = p->next) { if (relevant_commit(p->item)) { relevant_change |= !st->treesame[n]; relevant_parents++; } else irrelevant_change |= !st->treesame[n]; } if (relevant_parents ? relevant_change : irrelevant_change) commit->object.flags &= ~TREESAME; else commit->object.flags |= TREESAME; } return commit->object.flags & TREESAME; } ",0 "void Layer::OnTransformAnimated(const gfx::Transform& transform) { transform_ = transform; } ",0 "static int rxq2vq(int rxq) { return rxq * 2; } ",0 "PHP_FUNCTION(openssl_open) { zval **privkey, *opendata; EVP_PKEY *pkey; int len1, len2; unsigned char *buf; long keyresource = -1; EVP_CIPHER_CTX ctx; char * data; int data_len; char * ekey; int ekey_len; char *method =NULL; int method_len = 0; const EVP_CIPHER *cipher; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""szsZ|s"", &data, &data_len, &opendata, &ekey, &ekey_len, &privkey, &method, &method_len) == FAILURE) { return; } pkey = php_openssl_evp_from_zval(privkey, 0, """", 0, &keyresource TSRMLS_CC); if (pkey == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""unable to coerce parameter 4 into a private key""); RETURN_FALSE; } if (method) { cipher = EVP_get_cipherbyname(method); if (!cipher) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Unknown signature algorithm.""); RETURN_FALSE; } } else { cipher = EVP_rc4(); } buf = emalloc(data_len + 1); if (EVP_OpenInit(&ctx, cipher, (unsigned char *)ekey, ekey_len, NULL, pkey) && EVP_OpenUpdate(&ctx, buf, &len1, (unsigned char *)data, data_len)) { if (!EVP_OpenFinal(&ctx, buf + len1, &len2) || (len1 + len2 == 0)) { efree(buf); if (keyresource == -1) { EVP_PKEY_free(pkey); } RETURN_FALSE; } } else { efree(buf); if (keyresource == -1) { EVP_PKEY_free(pkey); } RETURN_FALSE; } if (keyresource == -1) { EVP_PKEY_free(pkey); } zval_dtor(opendata); buf[len1 + len2] = '\0'; ZVAL_STRINGL(opendata, erealloc(buf, len1 + len2 + 1), len1 + len2, 0); RETURN_TRUE; } ",0 "void Document::attach(const AttachContext& context) { ASSERT(m_lifecycle.state() == DocumentLifecycle::Inactive); ASSERT(!m_axObjectCache || this != &axObjectCacheOwner()); m_layoutView = new LayoutView(this); setLayoutObject(m_layoutView); m_layoutView->setIsInWindow(true); m_layoutView->setStyle(StyleResolver::styleForDocument(*this)); m_layoutView->compositor()->setNeedsCompositingUpdate(CompositingUpdateAfterCompositingInputChange); ContainerNode::attach(context); if (TextAutosizer* autosizer = textAutosizer()) autosizer->updatePageInfo(); m_lifecycle.advanceTo(DocumentLifecycle::StyleClean); } ",0 "void MediaStreamManager::StopStreamDevice(int render_process_id, int render_frame_id, const std::string& device_id, int session_id) { DCHECK_CURRENTLY_ON(BrowserThread::IO); DVLOG(1) << ""StopStreamDevice({render_frame_id = "" << render_frame_id << ""} "" << "", {device_id = "" << device_id << ""}, session_id = "" << session_id << ""})""; ",0 "static void add_stream_to_programs(AVFormatContext *s, struct playlist *pls, AVStream *stream) { HLSContext *c = s->priv_data; int i, j; int bandwidth = -1; for (i = 0; i < c->n_variants; i++) { struct variant *v = c->variants[i]; for (j = 0; j < v->n_playlists; j++) { if (v->playlists[j] != pls) continue; av_program_add_stream_index(s, i, stream->index); if (bandwidth < 0) bandwidth = v->bandwidth; else if (bandwidth != v->bandwidth) bandwidth = -1; /* stream in multiple variants with different bandwidths */ } } if (bandwidth >= 0) av_dict_set_int(&stream->metadata, ""variant_bitrate"", bandwidth, 0); } ",0 "fmov_reg_idx(struct sh_fpu_soft_struct *fregs, struct pt_regs *regs, int m, int n) { if (FPSCR_SZ) { FMOV_EXT(m); WRITE(FRm, Rn + R0 + 4); m++; WRITE(FRm, Rn + R0); } else { WRITE(FRm, Rn + R0); } return 0; } ",0 "remove_control_socket (const char *path) { char *_path = xstrdup (path), *p; unlink (_path); p = strrchr (_path, '/'); assert (p != NULL); *p = '\0'; rmdir (_path); free (_path); } ",0 "Browser::~Browser() { VLOG_IF(1, g_log_bug53991) << ""~Browser: "" << profile_->IsOffTheRecord() << ""; stillActive="" << BrowserList::IsOffTheRecordSessionActive(); if (profile_->GetProfileSyncService()) profile_->GetProfileSyncService()->RemoveObserver(this); BrowserList::RemoveBrowser(this); #if defined(OS_WIN) || defined(OS_LINUX) if (!BrowserList::HasBrowserWithProfile(profile_)) { profile_->ResetTabRestoreService(); } #endif SessionService* session_service = profile_->GetSessionService(); if (session_service) session_service->WindowClosed(session_id_); TabRestoreService* tab_restore_service = profile()->GetTabRestoreService(); if (tab_restore_service) tab_restore_service->BrowserClosed(tab_restore_service_delegate()); encoding_auto_detect_.Destroy(); printing_enabled_.Destroy(); dev_tools_disabled_.Destroy(); incognito_mode_allowed_.Destroy(); instant_enabled_.Destroy(); use_vertical_tabs_.Destroy(); edit_bookmarks_enabled_.Destroy(); if (profile_->IsOffTheRecord() && !BrowserList::IsOffTheRecordSessionActive()) { profile_->GetOriginalProfile()->DestroyOffTheRecordProfile(); } if (select_file_dialog_.get()) select_file_dialog_->ListenerDestroyed(); TabRestoreServiceDestroyed(tab_restore_service_); } ",0 "void WebPluginProxy::InitiateHTTPRangeRequest(const char* url, const char* range_info, intptr_t existing_stream, bool notify_needed, intptr_t notify_data) { Send(new PluginHostMsg_InitiateHTTPRangeRequest(route_id_, url, range_info, existing_stream, notify_needed, notify_data)); } ",1 "static int packet_dev_mc(struct net_device *dev, struct packet_mclist *i, int what) { switch (i->type) { case PACKET_MR_MULTICAST: if (i->alen != dev->addr_len) return -EINVAL; if (what > 0) return dev_mc_add(dev, i->addr); else return dev_mc_del(dev, i->addr); break; case PACKET_MR_PROMISC: return dev_set_promiscuity(dev, what); case PACKET_MR_ALLMULTI: return dev_set_allmulti(dev, what); case PACKET_MR_UNICAST: if (i->alen != dev->addr_len) return -EINVAL; if (what > 0) return dev_uc_add(dev, i->addr); else return dev_uc_del(dev, i->addr); break; default: break; } return 0; } ",0 "static void *counter_func(void *arg){ { set_pid_priority(0,SCHED_FIFO,sched_get_priority_min(SCHED_FIFO),""Unable to set SCHED_FIFO for %d (\""%s\""). (%s)"", ""the counter_func""); } for(;;){ counter++; if(verbose) print_error(stderr,""counter set to %d"",counter); sleep(increasetime); } return NULL; } ",0 "static void __exit sha512_generic_mod_fini(void) { crypto_unregister_shashes(sha512_algs, ARRAY_SIZE(sha512_algs)); } ",0 "void WebContentsImpl::EnableWebContentsOnlyAccessibilityMode() { if (!GetAccessibilityMode().is_mode_off()) { for (RenderFrameHost* rfh : GetAllFrames()) ResetAccessibility(rfh); } else { AddAccessibilityMode(ui::kAXModeWebContentsOnly); } } ",0 "nlmsvc_grant_blocked(struct nlm_block *block) { struct nlm_file *file = block->b_file; struct nlm_lock *lock = &block->b_call->a_args.lock; int error; loff_t fl_start, fl_end; dprintk(""lockd: grant blocked lock %p\n"", block); kref_get(&block->b_count); /* Unlink block request from list */ nlmsvc_unlink_block(block); /* If b_granted is true this means we've been here before. * Just retry the grant callback, possibly refreshing the RPC * binding */ if (block->b_granted) { nlm_rebind_host(block->b_host); goto callback; } /* Try the lock operation again */ /* vfs_lock_file() can mangle fl_start and fl_end, but we need * them unchanged for the GRANT_MSG */ lock->fl.fl_flags |= FL_SLEEP; fl_start = lock->fl.fl_start; fl_end = lock->fl.fl_end; error = vfs_lock_file(file->f_file, F_SETLK, &lock->fl, NULL); lock->fl.fl_flags &= ~FL_SLEEP; lock->fl.fl_start = fl_start; lock->fl.fl_end = fl_end; switch (error) { case 0: break; case FILE_LOCK_DEFERRED: dprintk(""lockd: lock still blocked error %d\n"", error); nlmsvc_insert_block(block, NLM_NEVER); nlmsvc_release_block(block); return; default: printk(KERN_WARNING ""lockd: unexpected error %d in %s!\n"", -error, __func__); nlmsvc_insert_block(block, 10 * HZ); nlmsvc_release_block(block); return; } callback: /* Lock was granted by VFS. */ dprintk(""lockd: GRANTing blocked lock.\n""); block->b_granted = 1; /* keep block on the list, but don't reattempt until the RPC * completes or the submission fails */ nlmsvc_insert_block(block, NLM_NEVER); /* Call the client -- use a soft RPC task since nlmsvc_retry_blocked * will queue up a new one if this one times out */ error = nlm_async_call(block->b_call, NLMPROC_GRANTED_MSG, &nlmsvc_grant_ops); /* RPC submission failed, wait a bit and retry */ if (error < 0) nlmsvc_insert_block(block, 10 * HZ); } ",0 "static int parse_data(struct strbuf *sb, uintmax_t limit, uintmax_t *len_res) { const char *data; strbuf_reset(sb); if (!skip_prefix(command_buf.buf, ""data "", &data)) die(""Expected 'data n' command, found: %s"", command_buf.buf); if (skip_prefix(data, ""<<"", &data)) { char *term = xstrdup(data); size_t term_len = command_buf.len - (data - command_buf.buf); strbuf_detach(&command_buf, NULL); for (;;) { if (strbuf_getline(&command_buf, stdin, '\n') == EOF) die(""EOF in data (terminator '%s' not found)"", term); if (term_len == command_buf.len && !strcmp(term, command_buf.buf)) break; strbuf_addbuf(sb, &command_buf); strbuf_addch(sb, '\n'); } free(term); } else { uintmax_t len = strtoumax(data, NULL, 10); size_t n = 0, length = (size_t)len; if (limit && limit < len) { *len_res = len; return 0; } if (length < len) die(""data is too large to use in this context""); while (n < length) { size_t s = strbuf_fread(sb, length - n, stdin); if (!s && feof(stdin)) die(""EOF in data (%lu bytes remaining)"", (unsigned long)(length - n)); n += s; } } skip_optional_lf(); return 1; } ",0 "static void doubleArrayAttributeSetterCallback(v8::Local, v8::Local jsValue, const v8::PropertyCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMSetter""); TestObjectV8Internal::doubleArrayAttributeSetter(jsValue, info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "void ScrollAnchor::Clear() { LayoutObject* layout_object = anchor_object_ ? anchor_object_ : ScrollerLayoutBox(scroller_); PaintLayer* layer = nullptr; if (LayoutObject* parent = layout_object->Parent()) layer = parent->EnclosingLayer(); while (layer) { if (PaintLayerScrollableArea* scrollable_area = layer->GetScrollableArea()) { ScrollAnchor* anchor = scrollable_area->GetScrollAnchor(); DCHECK(anchor); anchor->ClearSelf(); } layer = layer->Parent(); } } ",0 "pid_t task_numa_group_id(struct task_struct *p) { return p->numa_group ? p->numa_group->gid : 0; } ",0 "void EventConverterEvdevImpl::AllowAllKeys() { DCHECK(HasKeyboard()); blocked_keys_.reset(); } ",0 "void dev_kfree_skb_irq(struct sk_buff *skb) { if (atomic_dec_and_test(&skb->users)) { struct softnet_data *sd; unsigned long flags; local_irq_save(flags); sd = &__get_cpu_var(softnet_data); skb->next = sd->completion_queue; sd->completion_queue = skb; raise_softirq_irqoff(NET_TX_SOFTIRQ); local_irq_restore(flags); } } ",0 "sp DRMSource::getFormat() { return mOriginalMediaSource->getFormat(); } ",0 "void RenderFrameHostManager::CreateOpenerProxies( SiteInstance* instance, FrameTreeNode* skip_this_node) { std::vector opener_frame_trees; base::hash_set nodes_with_back_links; CollectOpenerFrameTrees(&opener_frame_trees, &nodes_with_back_links); for (int i = opener_frame_trees.size() - 1; i >= 0; i--) { opener_frame_trees[i] ->root() ->render_manager() ->CreateOpenerProxiesForFrameTree(instance, skip_this_node); } for (auto* node : nodes_with_back_links) { RenderFrameProxyHost* proxy = node->render_manager()->GetRenderFrameProxyHost(instance); if (!proxy) continue; int opener_routing_id = node->render_manager()->GetOpenerRoutingID(instance); DCHECK_NE(opener_routing_id, MSG_ROUTING_NONE); proxy->Send(new FrameMsg_UpdateOpener(proxy->GetRoutingID(), opener_routing_id)); } } ",0 "void sendReplyToClient(aeEventLoop *el, int fd, void *privdata, int mask) { UNUSED(el); UNUSED(mask); writeToClient(fd,privdata,1); } ",0 "void TestController::run() { if (!resetStateToConsistentValues()) { m_currentInvocation->dumpWebProcessUnresponsiveness(); return; } if (m_usingServerMode) runTestingServerLoop(); else { for (size_t i = 0; i < m_paths.size(); ++i) { if (!runTest(m_paths[i].c_str())) break; } } } ",0 "acpi_ns_print_node_pathname(struct acpi_namespace_node *node, const char *message) { struct acpi_buffer buffer; acpi_status status; if (!node) { acpi_os_printf(""[NULL NAME]""); return; } /* Convert handle to full pathname and print it (with supplied message) */ buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; status = acpi_ns_handle_to_pathname(node, &buffer, TRUE); if (ACPI_SUCCESS(status)) { if (message) { acpi_os_printf(""%s "", message); } acpi_os_printf(""[%s] (Node %p)"", (char *)buffer.pointer, node); ACPI_FREE(buffer.pointer); } } ",0 "static int enter_vmx_non_root_mode(struct kvm_vcpu *vcpu) { struct vcpu_vmx *vmx = to_vmx(vcpu); struct vmcs12 *vmcs12 = get_vmcs12(vcpu); u32 msr_entry_idx; u32 exit_qual; int r; enter_guest_mode(vcpu); if (!(vmcs12->vm_entry_controls & VM_ENTRY_LOAD_DEBUG_CONTROLS)) vmx->nested.vmcs01_debugctl = vmcs_read64(GUEST_IA32_DEBUGCTL); vmx_switch_vmcs(vcpu, &vmx->nested.vmcs02); vmx_segment_cache_clear(vmx); if (vmcs12->cpu_based_vm_exec_control & CPU_BASED_USE_TSC_OFFSETING) vcpu->arch.tsc_offset += vmcs12->tsc_offset; r = EXIT_REASON_INVALID_STATE; if (prepare_vmcs02(vcpu, vmcs12, &exit_qual)) goto fail; nested_get_vmcs12_pages(vcpu, vmcs12); r = EXIT_REASON_MSR_LOAD_FAIL; msr_entry_idx = nested_vmx_load_msr(vcpu, vmcs12->vm_entry_msr_load_addr, vmcs12->vm_entry_msr_load_count); if (msr_entry_idx) goto fail; /* * Note no nested_vmx_succeed or nested_vmx_fail here. At this point * we are no longer running L1, and VMLAUNCH/VMRESUME has not yet * returned as far as L1 is concerned. It will only return (and set * the success flag) when L2 exits (see nested_vmx_vmexit()). */ return 0; fail: if (vmcs12->cpu_based_vm_exec_control & CPU_BASED_USE_TSC_OFFSETING) vcpu->arch.tsc_offset -= vmcs12->tsc_offset; leave_guest_mode(vcpu); vmx_switch_vmcs(vcpu, &vmx->vmcs01); nested_vmx_entry_failure(vcpu, vmcs12, r, exit_qual); return 1; } ",0 "void WebGLRenderingContextBase::TexImageByGPU( TexImageFunctionID function_id, WebGLTexture* texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, CanvasImageSource* image, const IntRect& source_sub_rectangle) { DCHECK(image->IsCanvasElement() || image->IsImageBitmap()); int width = source_sub_rectangle.Width(); int height = source_sub_rectangle.Height(); ScopedTexture2DRestorer restorer(this); GLuint target_texture = texture->Object(); bool possible_direct_copy = false; if (function_id == kTexImage2D || function_id == kTexSubImage2D) { possible_direct_copy = Extensions3DUtil::CanUseCopyTextureCHROMIUM(target); } GLint copy_x_offset = xoffset; GLint copy_y_offset = yoffset; GLenum copy_target = target; if (!possible_direct_copy) { ContextGL()->GenTextures(1, &target_texture); ContextGL()->BindTexture(GL_TEXTURE_2D, target_texture); ContextGL()->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); ContextGL()->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); ContextGL()->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); ContextGL()->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); ContextGL()->TexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); copy_x_offset = 0; copy_y_offset = 0; copy_target = GL_TEXTURE_2D; } { ScopedUnpackParametersResetRestore temporaryResetUnpack(this); if (image->IsCanvasElement()) { TexImageCanvasByGPU(function_id, static_cast(image), copy_target, target_texture, copy_x_offset, copy_y_offset, source_sub_rectangle); } else { TexImageBitmapByGPU(static_cast(image), copy_target, target_texture, !unpack_flip_y_, copy_x_offset, copy_y_offset, source_sub_rectangle); } } if (!possible_direct_copy) { GLuint tmp_fbo; ContextGL()->GenFramebuffers(1, &tmp_fbo); ContextGL()->BindFramebuffer(GL_FRAMEBUFFER, tmp_fbo); ContextGL()->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, target_texture, 0); ContextGL()->BindTexture(texture->GetTarget(), texture->Object()); if (function_id == kTexImage2D) { ContextGL()->CopyTexSubImage2D(target, level, 0, 0, 0, 0, width, height); } else if (function_id == kTexSubImage2D) { ContextGL()->CopyTexSubImage2D(target, level, xoffset, yoffset, 0, 0, width, height); } else if (function_id == kTexSubImage3D) { ContextGL()->CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, 0, 0, width, height); } ContextGL()->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0); RestoreCurrentFramebuffer(); ContextGL()->DeleteFramebuffers(1, &tmp_fbo); ContextGL()->DeleteTextures(1, &target_texture); } } ",0 "static void srpt_recv_done(struct ib_cq *cq, struct ib_wc *wc) { struct srpt_rdma_ch *ch = cq->cq_context; struct srpt_recv_ioctx *ioctx = container_of(wc->wr_cqe, struct srpt_recv_ioctx, ioctx.cqe); if (wc->status == IB_WC_SUCCESS) { int req_lim; req_lim = atomic_dec_return(&ch->req_lim); if (unlikely(req_lim < 0)) pr_err(""req_lim = %d < 0\n"", req_lim); srpt_handle_new_iu(ch, ioctx, NULL); } else { pr_info(""receiving failed for ioctx %p with status %d\n"", ioctx, wc->status); } } ",0 "static int kvm_dev_ioctl_create_vm(unsigned long type) { int r; struct kvm *kvm; kvm = kvm_create_vm(type); if (IS_ERR(kvm)) return PTR_ERR(kvm); #ifdef KVM_COALESCED_MMIO_PAGE_OFFSET r = kvm_coalesced_mmio_init(kvm); if (r < 0) { kvm_put_kvm(kvm); return r; } #endif r = anon_inode_getfd(""kvm-vm"", &kvm_vm_fops, kvm, O_RDWR | O_CLOEXEC); if (r < 0) kvm_put_kvm(kvm); return r; } ",0 "static int tcm_loop_shutdown_session(struct se_session *se_sess) { return 0; } ",0 "static long random_ioctl(struct file *f, unsigned int cmd, unsigned long arg) { int size, ent_count; int __user *p = (int __user *)arg; int retval; switch (cmd) { case RNDGETENTCNT: /* inherently racy, no point locking */ if (put_user(input_pool.entropy_count, p)) return -EFAULT; return 0; case RNDADDTOENTCNT: if (!capable(CAP_SYS_ADMIN)) return -EPERM; if (get_user(ent_count, p)) return -EFAULT; credit_entropy_bits(&input_pool, ent_count); return 0; case RNDADDENTROPY: if (!capable(CAP_SYS_ADMIN)) return -EPERM; if (get_user(ent_count, p++)) return -EFAULT; if (ent_count < 0) return -EINVAL; if (get_user(size, p++)) return -EFAULT; retval = write_pool(&input_pool, (const char __user *)p, size); if (retval < 0) return retval; credit_entropy_bits(&input_pool, ent_count); return 0; case RNDZAPENTCNT: case RNDCLEARPOOL: /* Clear the entropy pool counters. */ if (!capable(CAP_SYS_ADMIN)) return -EPERM; rand_initialize(); return 0; default: return -EINVAL; } } ",0 "void RecordRequestsAllowedHistogram(ResourceRequestsAllowedState state) { UMA_HISTOGRAM_ENUMERATION(""Variations.ResourceRequestsAllowed"", state, RESOURCE_REQUESTS_ALLOWED_ENUM_SIZE); } ",0 " MockDispatcher() : num_key_events_dispatched_(0) { } ",0 "static void fill_composite_hash(CompositeHashKey *hk, CombinedBitmapInfo *info) { hk->filter = info->filter; hk->bitmap_count = info->bitmap_count; hk->bitmaps = info->bitmaps; } ",0 "int compiler_set_root(struct block *blk) { BUG_IF(blk == NULL); tree_root = blk; return E_SUCCESS; } ",0 "void InspectorNetworkAgent::DidReceiveWebSocketFrameError( unsigned long identifier, const String& error_message) { GetFrontend()->webSocketFrameError(IdentifiersFactory::RequestId(identifier), MonotonicallyIncreasingTime(), error_message); } ",0 "VP8XChunk::VP8XChunk(Container* parent) : Chunk(parent, kChunk_VP8X) { this->needsRewrite = true; this->size = 10; this->data.resize(this->size); this->data.assign(this->size, 0); XMP_Uns8* bitstream = (XMP_Uns8*)parent->chunks[WEBP_CHUNK_IMAGE][0]->data.data(); XMP_Uns32 width = ((bitstream[7] << 8) | bitstream[6]) & 0x3fff; XMP_Uns32 height = ((bitstream[9] << 8) | bitstream[8]) & 0x3fff; this->width(width); this->height(height); parent->vp8x = this; } ",0 "xfs_end_io_direct_write( struct kiocb *iocb, loff_t offset, ssize_t size, void *private) { struct inode *inode = file_inode(iocb->ki_filp); struct xfs_inode *ip = XFS_I(inode); uintptr_t flags = (uintptr_t)private; int error = 0; trace_xfs_end_io_direct_write(ip, offset, size); if (XFS_FORCED_SHUTDOWN(ip->i_mount)) return -EIO; if (size <= 0) return size; /* * The flags tell us whether we are doing unwritten extent conversions * or an append transaction that updates the on-disk file size. These * cases are the only cases where we should *potentially* be needing * to update the VFS inode size. */ if (flags == 0) { ASSERT(offset + size <= i_size_read(inode)); return 0; } /* * We need to update the in-core inode size here so that we don't end up * with the on-disk inode size being outside the in-core inode size. We * have no other method of updating EOF for AIO, so always do it here * if necessary. * * We need to lock the test/set EOF update as we can be racing with * other IO completions here to update the EOF. Failing to serialise * here can result in EOF moving backwards and Bad Things Happen when * that occurs. */ spin_lock(&ip->i_flags_lock); if (offset + size > i_size_read(inode)) i_size_write(inode, offset + size); spin_unlock(&ip->i_flags_lock); if (flags & XFS_DIO_FLAG_COW) error = xfs_reflink_end_cow(ip, offset, size); if (flags & XFS_DIO_FLAG_UNWRITTEN) { trace_xfs_end_io_direct_write_unwritten(ip, offset, size); error = xfs_iomap_write_unwritten(ip, offset, size); } if (flags & XFS_DIO_FLAG_APPEND) { trace_xfs_end_io_direct_write_append(ip, offset, size); error = xfs_setfilesize(ip, offset, size); } return error; } ",0 "static void crypto_exit_skcipher_ops_ablkcipher(struct crypto_tfm *tfm) { struct crypto_ablkcipher **ctx = crypto_tfm_ctx(tfm); crypto_free_ablkcipher(*ctx); } ",0 "static int perf_event_init_context(struct task_struct *child, int ctxn) { struct perf_event_context *child_ctx, *parent_ctx; struct perf_event_context *cloned_ctx; struct perf_event *event; struct task_struct *parent = current; int inherited_all = 1; unsigned long flags; int ret = 0; if (likely(!parent->perf_event_ctxp[ctxn])) return 0; /* * If the parent's context is a clone, pin it so it won't get * swapped under us. */ parent_ctx = perf_pin_task_context(parent, ctxn); if (!parent_ctx) return 0; /* * No need to check if parent_ctx != NULL here; since we saw * it non-NULL earlier, the only reason for it to become NULL * is if we exit, and since we're currently in the middle of * a fork we can't be exiting at the same time. */ /* * Lock the parent list. No need to lock the child - not PID * hashed yet and not running, so nobody can access it. */ mutex_lock(&parent_ctx->mutex); /* * We dont have to disable NMIs - we are only looking at * the list, not manipulating it: */ list_for_each_entry(event, &parent_ctx->pinned_groups, group_entry) { ret = inherit_task_group(event, parent, parent_ctx, child, ctxn, &inherited_all); if (ret) break; } /* * We can't hold ctx->lock when iterating the ->flexible_group list due * to allocations, but we need to prevent rotation because * rotate_ctx() will change the list from interrupt context. */ raw_spin_lock_irqsave(&parent_ctx->lock, flags); parent_ctx->rotate_disable = 1; raw_spin_unlock_irqrestore(&parent_ctx->lock, flags); list_for_each_entry(event, &parent_ctx->flexible_groups, group_entry) { ret = inherit_task_group(event, parent, parent_ctx, child, ctxn, &inherited_all); if (ret) break; } raw_spin_lock_irqsave(&parent_ctx->lock, flags); parent_ctx->rotate_disable = 0; child_ctx = child->perf_event_ctxp[ctxn]; if (child_ctx && inherited_all) { /* * Mark the child context as a clone of the parent * context, or of whatever the parent is a clone of. * * Note that if the parent is a clone, the holding of * parent_ctx->lock avoids it from being uncloned. */ cloned_ctx = parent_ctx->parent_ctx; if (cloned_ctx) { child_ctx->parent_ctx = cloned_ctx; child_ctx->parent_gen = parent_ctx->parent_gen; } else { child_ctx->parent_ctx = parent_ctx; child_ctx->parent_gen = parent_ctx->generation; } get_ctx(child_ctx->parent_ctx); } raw_spin_unlock_irqrestore(&parent_ctx->lock, flags); mutex_unlock(&parent_ctx->mutex); perf_unpin_context(parent_ctx); put_ctx(parent_ctx); return ret; } ",0 "bool FileSystemPolicy::SetInformationFileAction( EvalResult eval_result, const ClientInfo& client_info, HANDLE target_file_handle, void* file_info, uint32 length, uint32 info_class, IO_STATUS_BLOCK* io_block, NTSTATUS* nt_status) { if (ASK_BROKER != eval_result) { *nt_status = STATUS_ACCESS_DENIED; return true; } NtSetInformationFileFunction NtSetInformationFile = NULL; ResolveNTFunctionPtr(""NtSetInformationFile"", &NtSetInformationFile); HANDLE local_handle = NULL; if (!::DuplicateHandle(client_info.process, target_file_handle, ::GetCurrentProcess(), &local_handle, 0, FALSE, DUPLICATE_SAME_ACCESS)) { *nt_status = STATUS_ACCESS_DENIED; return true; } ScopedHandle handle(local_handle); FILE_INFORMATION_CLASS file_info_class = static_cast(info_class); *nt_status = NtSetInformationFile(local_handle, io_block, file_info, length, file_info_class); return true; } ",0 "void RecordNetworkChangeEvent(DataReductionProxyNetworkChangeEvent event) { UMA_HISTOGRAM_ENUMERATION(""DataReductionProxy.NetworkChangeEvents"", event, CHANGE_EVENT_COUNT); } ",0 "sessions_changed (gpointer user_data) { PolkitBackendSessionMonitor *monitor = POLKIT_BACKEND_SESSION_MONITOR (user_data); g_signal_emit (monitor, signals[CHANGED_SIGNAL], 0); return TRUE; } ",0 " static Handle PopImpl(Handle receiver) { return Subclass::RemoveElement(receiver, AT_END); } ",0 "void SimulateTapAt(WebContents* web_contents, const gfx::Point& point) { blink::WebGestureEvent tap(blink::WebGestureEvent::kGestureTap, 0, ui::EventTimeForNow(), blink::kWebGestureDeviceTouchscreen); tap.SetPositionInWidget(gfx::PointF(point)); RenderWidgetHostImpl* widget_host = RenderWidgetHostImpl::From( web_contents->GetRenderViewHost()->GetWidget()); widget_host->ForwardGestureEvent(tap); } ",0 "static u8 vmx_msr_bitmap_mode(struct kvm_vcpu *vcpu) { u8 mode = 0; if (cpu_has_secondary_exec_ctrls() && (vmcs_read32(SECONDARY_VM_EXEC_CONTROL) & SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE)) { mode |= MSR_BITMAP_MODE_X2APIC; if (enable_apicv && kvm_vcpu_apicv_active(vcpu)) mode |= MSR_BITMAP_MODE_X2APIC_APICV; } if (is_long_mode(vcpu)) mode |= MSR_BITMAP_MODE_LM; return mode; } ",0 "static inline void SetPSDPixel(Image *image,const size_t channels, const ssize_t type,const size_t packet_size,const Quantum pixel,Quantum *q, ExceptionInfo *exception) { if (image->storage_class == PseudoClass) { if (packet_size == 1) SetPixelIndex(image,ScaleQuantumToChar(pixel),q); else SetPixelIndex(image,ScaleQuantumToShort(pixel),q); SetPixelViaPixelInfo(image,image->colormap+(ssize_t) ConstrainColormapIndex(image,GetPixelIndex(image,q),exception),q); return; } switch (type) { case -1: { SetPixelAlpha(image, pixel,q); break; } case -2: case 0: { SetPixelRed(image,pixel,q); if (channels == 1 || type == -2) SetPixelGray(image,pixel,q); break; } case 1: { if (image->storage_class == PseudoClass) SetPixelAlpha(image,pixel,q); else SetPixelGreen(image,pixel,q); break; } case 2: { if (image->storage_class == PseudoClass) SetPixelAlpha(image,pixel,q); else SetPixelBlue(image,pixel,q); break; } case 3: { if (image->colorspace == CMYKColorspace) SetPixelBlack(image,pixel,q); else if (image->alpha_trait != UndefinedPixelTrait) SetPixelAlpha(image,pixel,q); break; } case 4: { if ((IssRGBCompatibleColorspace(image->colorspace) != MagickFalse) && (channels > 3)) break; if (image->alpha_trait != UndefinedPixelTrait) SetPixelAlpha(image,pixel,q); break; } } } ",0 "struct sock *x25_find_socket(unsigned int lci, struct x25_neigh *nb) { struct sock *s; read_lock_bh(&x25_list_lock); s = __x25_find_socket(lci, nb); read_unlock_bh(&x25_list_lock); return s; } ",0 "HeadlessDevToolsManagerDelegate::GetWindowForTarget( content::DevToolsAgentHost* agent_host, int session_id, int command_id, const base::DictionaryValue* params) { const base::Value* target_id_value = params->FindKey(""targetId""); if (!target_id_value) return CreateInvalidParamResponse(command_id, ""targetId""); HeadlessWebContentsImpl* web_contents = HeadlessWebContentsImpl::From( browser_->GetWebContentsForDevToolsAgentHostId( target_id_value->GetString())); if (!web_contents) { return CreateErrorResponse(command_id, kErrorServerError, ""No web contents for the given target id""); } auto result = std::make_unique(); result->SetInteger(""windowId"", web_contents->window_id()); result->Set(""bounds"", CreateBoundsDict(web_contents)); return CreateSuccessResponse(command_id, std::move(result)); } ",0 "void RendererSchedulerImpl::OnVirtualTimeAdvanced() { for (auto& observer : main_thread_only().virtual_time_observers) { observer.OnVirtualTimeAdvanced(virtual_time_domain_->Now() - main_thread_only().initial_virtual_time); } } ",0 "static void __address_space_init_once(struct address_space *mapping) { INIT_RADIX_TREE(&mapping->i_pages, GFP_ATOMIC | __GFP_ACCOUNT); init_rwsem(&mapping->i_mmap_rwsem); INIT_LIST_HEAD(&mapping->private_list); spin_lock_init(&mapping->private_lock); mapping->i_mmap = RB_ROOT_CACHED; } ",0 "xsltSwapTopCompMatch(xsltCompMatchPtr comp) { int i; int j = comp->nbStep - 1; if (j > 0) { register xmlChar *tmp; register xsltOp op; register xmlXPathCompExprPtr expr; register int t; i = j - 1; tmp = comp->steps[i].value; comp->steps[i].value = comp->steps[j].value; comp->steps[j].value = tmp; tmp = comp->steps[i].value2; comp->steps[i].value2 = comp->steps[j].value2; comp->steps[j].value2 = tmp; tmp = comp->steps[i].value3; comp->steps[i].value3 = comp->steps[j].value3; comp->steps[j].value3 = tmp; op = comp->steps[i].op; comp->steps[i].op = comp->steps[j].op; comp->steps[j].op = op; expr = comp->steps[i].comp; comp->steps[i].comp = comp->steps[j].comp; comp->steps[j].comp = expr; t = comp->steps[i].previousExtra; comp->steps[i].previousExtra = comp->steps[j].previousExtra; comp->steps[j].previousExtra = t; t = comp->steps[i].indexExtra; comp->steps[i].indexExtra = comp->steps[j].indexExtra; comp->steps[j].indexExtra = t; t = comp->steps[i].lenExtra; comp->steps[i].lenExtra = comp->steps[j].lenExtra; comp->steps[j].lenExtra = t; } } ",0 "void HTMLFormControlElement::removedFrom(ContainerNode* insertionPoint) { fieldSetAncestorsSetNeedsValidityCheck(insertionPoint); hideVisibleValidationMessage(); m_hasValidationMessage = false; m_ancestorDisabledState = AncestorDisabledStateUnknown; m_dataListAncestorState = Unknown; setNeedsWillValidateCheck(); HTMLElement::removedFrom(insertionPoint); ListedElement::removedFrom(insertionPoint); } ",0 " void CanDownloadFor(WebContents* web_contents) { download_request_limiter_->CanDownloadImpl( web_contents, ""GET"", // request method base::Bind(&DownloadRequestLimiterTest::ContinueDownload, base::Unretained(this))); base::RunLoop().RunUntilIdle(); } ",0 "CMS_ContentInfo *CMS_compress(BIO *in, int comp_nid, unsigned int flags) { CMSerr(CMS_F_CMS_COMPRESS, CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM); return NULL; } ",0 "struct kvm *kvm_arch_alloc_vm(void) { struct kvm *kvm; uint64_t vm_base; BUG_ON(sizeof(struct kvm) > KVM_VM_STRUCT_SIZE); vm_base = __get_free_pages(GFP_KERNEL, get_order(KVM_VM_DATA_SIZE)); if (!vm_base) return NULL; memset((void *)vm_base, 0, KVM_VM_DATA_SIZE); kvm = (struct kvm *)(vm_base + offsetof(struct kvm_vm_data, kvm_vm_struct)); kvm->arch.vm_base = vm_base; printk(KERN_DEBUG""kvm: vm's data area:0x%lx\n"", vm_base); return kvm; } ",0 "static int opcmp(RAsm *a, ut8 *data, const Opcode *op) { if (op->operands[1].type & OT_CONSTANT) { if (op->operands[0].type & OT_GPREG && op->operands[0].type & OT_WORD) { return process_16bit_group_1 (a, data, op, 0x38); } if (!is_al_reg (&op->operands[0])) { return process_group_1 (a, data, op); } } return process_1byte_op (a, data, op, 0x38); } ",0 "static int gather_hugetlb_stats(pte_t *pte, unsigned long hmask, unsigned long addr, unsigned long end, struct mm_walk *walk) { return 0; } ",0 "void TestContentClient::AddNPAPIPlugins( webkit::npapi::PluginList* plugin_list) { } ",0 "static MagickBooleanType WriteCINImage(const ImageInfo *image_info,Image *image, ExceptionInfo *exception) { char timestamp[MagickPathExtent]; const char *value; CINInfo cin; const StringInfo *profile; MagickBooleanType status; MagickOffsetType offset; QuantumInfo *quantum_info; QuantumType quantum_type; register const Quantum *p; register ssize_t i; size_t length; ssize_t count, y; struct tm local_time; time_t seconds; unsigned char *pixels; /* Open output image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickCoreSignature); assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"",image->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception); if (status == MagickFalse) return(status); if (image->colorspace != LogColorspace) (void) TransformImageColorspace(image,LogColorspace,exception); /* Write image information. */ (void) memset(&cin,0,sizeof(cin)); offset=0; cin.file.magic=0x802A5FD7UL; offset+=WriteBlobLong(image,(unsigned int) cin.file.magic); cin.file.image_offset=0x800; offset+=WriteBlobLong(image,(unsigned int) cin.file.image_offset); cin.file.generic_length=0x400; offset+=WriteBlobLong(image,(unsigned int) cin.file.generic_length); cin.file.industry_length=0x400; offset+=WriteBlobLong(image,(unsigned int) cin.file.industry_length); cin.file.user_length=0x00; profile=GetImageProfile(image,""dpx:user.data""); if (profile != (StringInfo *) NULL) { cin.file.user_length+=(size_t) GetStringInfoLength(profile); cin.file.user_length=(((cin.file.user_length+0x2000-1)/0x2000)*0x2000); } offset+=WriteBlobLong(image,(unsigned int) cin.file.user_length); cin.file.file_size=4*image->columns*image->rows+0x2000; offset+=WriteBlobLong(image,(unsigned int) cin.file.file_size); (void) CopyMagickString(cin.file.version,""V4.5"",sizeof(cin.file.version)); offset+=WriteBlob(image,sizeof(cin.file.version),(unsigned char *) cin.file.version); value=GetCINProperty(image_info,image,""dpx:file.filename"",exception); if (value != (const char *) NULL) (void) CopyMagickString(cin.file.filename,value,sizeof(cin.file.filename)); else (void) CopyMagickString(cin.file.filename,image->filename, sizeof(cin.file.filename)); offset+=WriteBlob(image,sizeof(cin.file.filename),(unsigned char *) cin.file.filename); seconds=time((time_t *) NULL); #if defined(MAGICKCORE_HAVE_LOCALTIME_R) (void) localtime_r(&seconds,&local_time); #else (void) memcpy(&local_time,localtime(&seconds),sizeof(local_time)); #endif (void) memset(timestamp,0,sizeof(timestamp)); (void) strftime(timestamp,MagickPathExtent,""%Y:%m:%d:%H:%M:%S%Z"",&local_time); (void) memset(cin.file.create_date,0,sizeof(cin.file.create_date)); (void) CopyMagickString(cin.file.create_date,timestamp,11); offset+=WriteBlob(image,sizeof(cin.file.create_date),(unsigned char *) cin.file.create_date); (void) memset(cin.file.create_time,0,sizeof(cin.file.create_time)); (void) CopyMagickString(cin.file.create_time,timestamp+11,11); offset+=WriteBlob(image,sizeof(cin.file.create_time),(unsigned char *) cin.file.create_time); offset+=WriteBlob(image,sizeof(cin.file.reserve),(unsigned char *) cin.file.reserve); cin.image.orientation=0x00; offset+=WriteBlobByte(image,cin.image.orientation); cin.image.number_channels=3; offset+=WriteBlobByte(image,cin.image.number_channels); offset+=WriteBlob(image,sizeof(cin.image.reserve1),(unsigned char *) cin.image.reserve1); for (i=0; i < 8; i++) { cin.image.channel[i].designator[0]=0; /* universal metric */ offset+=WriteBlobByte(image,cin.image.channel[0].designator[0]); cin.image.channel[i].designator[1]=(unsigned char) (i > 3 ? 0 : i+1); /* channel color */; offset+=WriteBlobByte(image,cin.image.channel[1].designator[0]); cin.image.channel[i].bits_per_pixel=(unsigned char) image->depth; offset+=WriteBlobByte(image,cin.image.channel[0].bits_per_pixel); offset+=WriteBlobByte(image,cin.image.channel[0].reserve); cin.image.channel[i].pixels_per_line=image->columns; offset+=WriteBlobLong(image,(unsigned int) cin.image.channel[0].pixels_per_line); cin.image.channel[i].lines_per_image=image->rows; offset+=WriteBlobLong(image,(unsigned int) cin.image.channel[0].lines_per_image); cin.image.channel[i].min_data=0; offset+=WriteBlobFloat(image,cin.image.channel[0].min_data); cin.image.channel[i].min_quantity=0.0; offset+=WriteBlobFloat(image,cin.image.channel[0].min_quantity); cin.image.channel[i].max_data=(float) ((MagickOffsetType) GetQuantumRange(image->depth)); offset+=WriteBlobFloat(image,cin.image.channel[0].max_data); cin.image.channel[i].max_quantity=2.048f; offset+=WriteBlobFloat(image,cin.image.channel[0].max_quantity); } offset+=WriteBlobFloat(image,image->chromaticity.white_point.x); offset+=WriteBlobFloat(image,image->chromaticity.white_point.y); offset+=WriteBlobFloat(image,image->chromaticity.red_primary.x); offset+=WriteBlobFloat(image,image->chromaticity.red_primary.y); offset+=WriteBlobFloat(image,image->chromaticity.green_primary.x); offset+=WriteBlobFloat(image,image->chromaticity.green_primary.y); offset+=WriteBlobFloat(image,image->chromaticity.blue_primary.x); offset+=WriteBlobFloat(image,image->chromaticity.blue_primary.y); value=GetCINProperty(image_info,image,""dpx:image.label"",exception); if (value != (const char *) NULL) (void) CopyMagickString(cin.image.label,value,sizeof(cin.image.label)); offset+=WriteBlob(image,sizeof(cin.image.label),(unsigned char *) cin.image.label); offset+=WriteBlob(image,sizeof(cin.image.reserve),(unsigned char *) cin.image.reserve); /* Write data format information. */ cin.data_format.interleave=0; /* pixel interleave (rgbrgbr...) */ offset+=WriteBlobByte(image,cin.data_format.interleave); cin.data_format.packing=5; /* packing ssize_tword (32bit) boundaries */ offset+=WriteBlobByte(image,cin.data_format.packing); cin.data_format.sign=0; /* unsigned data */ offset+=WriteBlobByte(image,cin.data_format.sign); cin.data_format.sense=0; /* image sense: positive image */ offset+=WriteBlobByte(image,cin.data_format.sense); cin.data_format.line_pad=0; offset+=WriteBlobLong(image,(unsigned int) cin.data_format.line_pad); cin.data_format.channel_pad=0; offset+=WriteBlobLong(image,(unsigned int) cin.data_format.channel_pad); offset+=WriteBlob(image,sizeof(cin.data_format.reserve),(unsigned char *) cin.data_format.reserve); /* Write origination information. */ cin.origination.x_offset=0UL; value=GetCINProperty(image_info,image,""dpx:origination.x_offset"",exception); if (value != (const char *) NULL) cin.origination.x_offset=(ssize_t) StringToLong(value); offset+=WriteBlobLong(image,(unsigned int) cin.origination.x_offset); cin.origination.y_offset=0UL; value=GetCINProperty(image_info,image,""dpx:origination.y_offset"",exception); if (value != (const char *) NULL) cin.origination.y_offset=(ssize_t) StringToLong(value); offset+=WriteBlobLong(image,(unsigned int) cin.origination.y_offset); value=GetCINProperty(image_info,image,""dpx:origination.filename"",exception); if (value != (const char *) NULL) (void) CopyMagickString(cin.origination.filename,value, sizeof(cin.origination.filename)); else (void) CopyMagickString(cin.origination.filename,image->filename, sizeof(cin.origination.filename)); offset+=WriteBlob(image,sizeof(cin.origination.filename),(unsigned char *) cin.origination.filename); seconds=time((time_t *) NULL); (void) memset(timestamp,0,sizeof(timestamp)); (void) strftime(timestamp,MagickPathExtent,""%Y:%m:%d:%H:%M:%S%Z"",&local_time); (void) memset(cin.origination.create_date,0, sizeof(cin.origination.create_date)); (void) CopyMagickString(cin.origination.create_date,timestamp,11); offset+=WriteBlob(image,sizeof(cin.origination.create_date),(unsigned char *) cin.origination.create_date); (void) memset(cin.origination.create_time,0, sizeof(cin.origination.create_time)); (void) CopyMagickString(cin.origination.create_time,timestamp+11,15); offset+=WriteBlob(image,sizeof(cin.origination.create_time),(unsigned char *) cin.origination.create_time); value=GetCINProperty(image_info,image,""dpx:origination.device"",exception); if (value != (const char *) NULL) (void) CopyMagickString(cin.origination.device,value, sizeof(cin.origination.device)); offset+=WriteBlob(image,sizeof(cin.origination.device),(unsigned char *) cin.origination.device); value=GetCINProperty(image_info,image,""dpx:origination.model"",exception); if (value != (const char *) NULL) (void) CopyMagickString(cin.origination.model,value, sizeof(cin.origination.model)); offset+=WriteBlob(image,sizeof(cin.origination.model),(unsigned char *) cin.origination.model); value=GetCINProperty(image_info,image,""dpx:origination.serial"",exception); if (value != (const char *) NULL) (void) CopyMagickString(cin.origination.serial,value, sizeof(cin.origination.serial)); offset+=WriteBlob(image,sizeof(cin.origination.serial),(unsigned char *) cin.origination.serial); cin.origination.x_pitch=0.0f; value=GetCINProperty(image_info,image,""dpx:origination.x_pitch"",exception); if (value != (const char *) NULL) cin.origination.x_pitch=StringToDouble(value,(char **) NULL); offset+=WriteBlobFloat(image,cin.origination.x_pitch); cin.origination.y_pitch=0.0f; value=GetCINProperty(image_info,image,""dpx:origination.y_pitch"",exception); if (value != (const char *) NULL) cin.origination.y_pitch=StringToDouble(value,(char **) NULL); offset+=WriteBlobFloat(image,cin.origination.y_pitch); cin.origination.gamma=image->gamma; offset+=WriteBlobFloat(image,cin.origination.gamma); offset+=WriteBlob(image,sizeof(cin.origination.reserve),(unsigned char *) cin.origination.reserve); /* Image film information. */ cin.film.id=0; value=GetCINProperty(image_info,image,""dpx:film.id"",exception); if (value != (const char *) NULL) cin.film.id=(char) StringToLong(value); offset+=WriteBlobByte(image,(unsigned char) cin.film.id); cin.film.type=0; value=GetCINProperty(image_info,image,""dpx:film.type"",exception); if (value != (const char *) NULL) cin.film.type=(char) StringToLong(value); offset+=WriteBlobByte(image,(unsigned char) cin.film.type); cin.film.offset=0; value=GetCINProperty(image_info,image,""dpx:film.offset"",exception); if (value != (const char *) NULL) cin.film.offset=(char) StringToLong(value); offset+=WriteBlobByte(image,(unsigned char) cin.film.offset); offset+=WriteBlobByte(image,(unsigned char) cin.film.reserve1); cin.film.prefix=0UL; value=GetCINProperty(image_info,image,""dpx:film.prefix"",exception); if (value != (const char *) NULL) cin.film.prefix=StringToUnsignedLong(value); offset+=WriteBlobLong(image,(unsigned int) cin.film.prefix); cin.film.count=0UL; value=GetCINProperty(image_info,image,""dpx:film.count"",exception); if (value != (const char *) NULL) cin.film.count=StringToUnsignedLong(value); offset+=WriteBlobLong(image,(unsigned int) cin.film.count); value=GetCINProperty(image_info,image,""dpx:film.format"",exception); if (value != (const char *) NULL) (void) CopyMagickString(cin.film.format,value,sizeof(cin.film.format)); offset+=WriteBlob(image,sizeof(cin.film.format),(unsigned char *) cin.film.format); cin.film.frame_position=0UL; value=GetCINProperty(image_info,image,""dpx:film.frame_position"",exception); if (value != (const char *) NULL) cin.film.frame_position=StringToUnsignedLong(value); offset+=WriteBlobLong(image,(unsigned int) cin.film.frame_position); cin.film.frame_rate=0.0f; value=GetCINProperty(image_info,image,""dpx:film.frame_rate"",exception); if (value != (const char *) NULL) cin.film.frame_rate=StringToDouble(value,(char **) NULL); offset+=WriteBlobFloat(image,cin.film.frame_rate); value=GetCINProperty(image_info,image,""dpx:film.frame_id"",exception); if (value != (const char *) NULL) (void) CopyMagickString(cin.film.frame_id,value,sizeof(cin.film.frame_id)); offset+=WriteBlob(image,sizeof(cin.film.frame_id),(unsigned char *) cin.film.frame_id); value=GetCINProperty(image_info,image,""dpx:film.slate_info"",exception); if (value != (const char *) NULL) (void) CopyMagickString(cin.film.slate_info,value, sizeof(cin.film.slate_info)); offset+=WriteBlob(image,sizeof(cin.film.slate_info),(unsigned char *) cin.film.slate_info); offset+=WriteBlob(image,sizeof(cin.film.reserve),(unsigned char *) cin.film.reserve); if (profile != (StringInfo *) NULL) offset+=WriteBlob(image,GetStringInfoLength(profile), GetStringInfoDatum(profile)); while (offset < (MagickOffsetType) cin.file.image_offset) offset+=WriteBlobByte(image,0x00); /* Convert pixel packets to CIN raster image. */ quantum_info=AcquireQuantumInfo(image_info,image); if (quantum_info == (QuantumInfo *) NULL) ThrowWriterException(ResourceLimitError,""MemoryAllocationFailed""); quantum_info->quantum=32; quantum_info->pack=MagickFalse; quantum_type=RGBQuantum; pixels=(unsigned char *) GetQuantumPixels(quantum_info); length=GetBytesPerRow(image->columns,3,image->depth,MagickTrue); DisableMSCWarning(4127) if (0) RestoreMSCWarning { quantum_type=GrayQuantum; length=GetBytesPerRow(image->columns,1,image->depth,MagickTrue); } for (y=0; y < (ssize_t) image->rows; y++) { p=GetVirtualPixels(image,0,y,image->columns,1,exception); if (p == (const Quantum *) NULL) break; (void) ExportQuantumPixels(image,(CacheView *) NULL,quantum_info, quantum_type,pixels,exception); count=WriteBlob(image,length,pixels); if (count != (ssize_t) length) break; status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } quantum_info=DestroyQuantumInfo(quantum_info); (void) CloseBlob(image); return(status); } ",0 "runtest(int i) { int ret = 0, res; int old_errors, old_tests, old_leaks; old_errors = nb_errors; old_tests = nb_tests; old_leaks = nb_leaks; if ((tests_quiet == 0) && (testDescriptions[i].desc != NULL)) printf(""## %s\n"", testDescriptions[i].desc); res = launchTests(&testDescriptions[i]); if (res != 0) ret++; if (verbose) { if ((nb_errors == old_errors) && (nb_leaks == old_leaks)) printf(""Ran %d tests, no errors\n"", nb_tests - old_tests); else printf(""Ran %d tests, %d errors, %d leaks\n"", nb_tests - old_tests, nb_errors - old_errors, nb_leaks - old_leaks); } return(ret); } ",0 "static void nsc_encode_argb_to_aycocg(NSC_CONTEXT* context, const BYTE* data, UINT32 scanline) { UINT16 x; UINT16 y; UINT16 rw; BYTE ccl; const BYTE* src; BYTE* yplane = NULL; BYTE* coplane = NULL; BYTE* cgplane = NULL; BYTE* aplane = NULL; INT16 r_val; INT16 g_val; INT16 b_val; BYTE a_val; UINT32 tempWidth; tempWidth = ROUND_UP_TO(context->width, 8); rw = (context->ChromaSubsamplingLevel ? tempWidth : context->width); ccl = context->ColorLossLevel; for (y = 0; y < context->height; y++) { src = data + (context->height - 1 - y) * scanline; yplane = context->priv->PlaneBuffers[0] + y * rw; coplane = context->priv->PlaneBuffers[1] + y * rw; cgplane = context->priv->PlaneBuffers[2] + y * rw; aplane = context->priv->PlaneBuffers[3] + y * context->width; for (x = 0; x < context->width; x++) { switch (context->format) { case PIXEL_FORMAT_BGRX32: b_val = *src++; g_val = *src++; r_val = *src++; src++; a_val = 0xFF; break; case PIXEL_FORMAT_BGRA32: b_val = *src++; g_val = *src++; r_val = *src++; a_val = *src++; break; case PIXEL_FORMAT_RGBX32: r_val = *src++; g_val = *src++; b_val = *src++; src++; a_val = 0xFF; break; case PIXEL_FORMAT_RGBA32: r_val = *src++; g_val = *src++; b_val = *src++; a_val = *src++; break; case PIXEL_FORMAT_BGR24: b_val = *src++; g_val = *src++; r_val = *src++; a_val = 0xFF; break; case PIXEL_FORMAT_RGB24: r_val = *src++; g_val = *src++; b_val = *src++; a_val = 0xFF; break; case PIXEL_FORMAT_BGR16: b_val = (INT16)(((*(src + 1)) & 0xF8) | ((*(src + 1)) >> 5)); g_val = (INT16)((((*(src + 1)) & 0x07) << 5) | (((*src) & 0xE0) >> 3)); r_val = (INT16)((((*src) & 0x1F) << 3) | (((*src) >> 2) & 0x07)); a_val = 0xFF; src += 2; break; case PIXEL_FORMAT_RGB16: r_val = (INT16)(((*(src + 1)) & 0xF8) | ((*(src + 1)) >> 5)); g_val = (INT16)((((*(src + 1)) & 0x07) << 5) | (((*src) & 0xE0) >> 3)); b_val = (INT16)((((*src) & 0x1F) << 3) | (((*src) >> 2) & 0x07)); a_val = 0xFF; src += 2; break; case PIXEL_FORMAT_A4: { int shift; BYTE idx; shift = (7 - (x % 8)); idx = ((*src) >> shift) & 1; idx |= (((*(src + 1)) >> shift) & 1) << 1; idx |= (((*(src + 2)) >> shift) & 1) << 2; idx |= (((*(src + 3)) >> shift) & 1) << 3; idx *= 3; r_val = (INT16) context->palette[idx]; g_val = (INT16) context->palette[idx + 1]; b_val = (INT16) context->palette[idx + 2]; if (shift == 0) src += 4; } a_val = 0xFF; break; case PIXEL_FORMAT_RGB8: { int idx = (*src) * 3; r_val = (INT16) context->palette[idx]; g_val = (INT16) context->palette[idx + 1]; b_val = (INT16) context->palette[idx + 2]; src++; } a_val = 0xFF; break; default: r_val = g_val = b_val = a_val = 0; break; } *yplane++ = (BYTE)((r_val >> 2) + (g_val >> 1) + (b_val >> 2)); /* Perform color loss reduction here */ *coplane++ = (BYTE)((r_val - b_val) >> ccl); *cgplane++ = (BYTE)((-(r_val >> 1) + g_val - (b_val >> 1)) >> ccl); *aplane++ = a_val; } if (context->ChromaSubsamplingLevel && (x % 2) == 1) { *yplane = *(yplane - 1); *coplane = *(coplane - 1); *cgplane = *(cgplane - 1); } } if (context->ChromaSubsamplingLevel && (y % 2) == 1) { yplane = context->priv->PlaneBuffers[0] + y * rw; coplane = context->priv->PlaneBuffers[1] + y * rw; cgplane = context->priv->PlaneBuffers[2] + y * rw; CopyMemory(yplane, yplane - rw, rw); CopyMemory(coplane, coplane - rw, rw); CopyMemory(cgplane, cgplane - rw, rw); } } ",1 "static int __on_net_schedule_list(struct xenvif *vif) { return !list_empty(&vif->schedule_list); } ",0 "void WebView::scrollView(const IntRect& scrollRect, const IntSize& scrollOffset) { setViewNeedsDisplay(scrollRect); } ",0 "static int graft_tree(struct mount *mnt, struct path *path) { if (mnt->mnt.mnt_sb->s_flags & MS_NOUSER) return -EINVAL; if (S_ISDIR(path->dentry->d_inode->i_mode) != S_ISDIR(mnt->mnt.mnt_root->d_inode->i_mode)) return -ENOTDIR; if (d_unlinked(path->dentry)) return -ENOENT; return attach_recursive_mnt(mnt, path, NULL); } ",0 "ScriptValue WebGLRenderingContextBase::getFramebufferAttachmentParameter( ScriptState* script_state, GLenum target, GLenum attachment, GLenum pname) { if (isContextLost() || !ValidateFramebufferFuncParameters(""getFramebufferAttachmentParameter"", target, attachment)) return ScriptValue::CreateNull(script_state); if (!framebuffer_binding_ || !framebuffer_binding_->Object()) { SynthesizeGLError(GL_INVALID_OPERATION, ""getFramebufferAttachmentParameter"", ""no framebuffer bound""); return ScriptValue::CreateNull(script_state); } WebGLSharedObject* attachment_object = framebuffer_binding_->GetAttachmentObject(attachment); if (!attachment_object) { if (pname == GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE) return WebGLAny(script_state, GL_NONE); SynthesizeGLError(GL_INVALID_ENUM, ""getFramebufferAttachmentParameter"", ""invalid parameter name""); return ScriptValue::CreateNull(script_state); } DCHECK(attachment_object->IsTexture() || attachment_object->IsRenderbuffer()); if (attachment_object->IsTexture()) { switch (pname) { case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: return WebGLAny(script_state, GL_TEXTURE); case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: return WebGLAny(script_state, attachment_object); case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: { GLint value = 0; ContextGL()->GetFramebufferAttachmentParameteriv(target, attachment, pname, &value); return WebGLAny(script_state, value); } case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT: if (ExtensionEnabled(kEXTsRGBName)) { GLint value = 0; ContextGL()->GetFramebufferAttachmentParameteriv(target, attachment, pname, &value); return WebGLAny(script_state, static_cast(value)); } SynthesizeGLError(GL_INVALID_ENUM, ""getFramebufferAttachmentParameter"", ""invalid parameter name for renderbuffer attachment""); return ScriptValue::CreateNull(script_state); default: SynthesizeGLError(GL_INVALID_ENUM, ""getFramebufferAttachmentParameter"", ""invalid parameter name for texture attachment""); return ScriptValue::CreateNull(script_state); } } else { switch (pname) { case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: return WebGLAny(script_state, GL_RENDERBUFFER); case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: return WebGLAny(script_state, attachment_object); case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT: if (ExtensionEnabled(kEXTsRGBName)) { GLint value = 0; ContextGL()->GetFramebufferAttachmentParameteriv(target, attachment, pname, &value); return WebGLAny(script_state, value); } SynthesizeGLError(GL_INVALID_ENUM, ""getFramebufferAttachmentParameter"", ""invalid parameter name for renderbuffer attachment""); return ScriptValue::CreateNull(script_state); default: SynthesizeGLError(GL_INVALID_ENUM, ""getFramebufferAttachmentParameter"", ""invalid parameter name for renderbuffer attachment""); return ScriptValue::CreateNull(script_state); } } } ",0 "uint16 BluetoothDeviceChromeOS::GetVendorID() const { uint16 vendor_id = 0; ParseModalias(object_path_, &vendor_id, NULL, NULL); return vendor_id; } ",0 "each_worker(FunctionCallInfo fcinfo, bool as_text) { text *json = PG_GETARG_TEXT_P(0); JsonLexContext *lex; JsonSemAction *sem; ReturnSetInfo *rsi; MemoryContext old_cxt; TupleDesc tupdesc; EachState *state; lex = makeJsonLexContext(json, true); state = palloc0(sizeof(EachState)); sem = palloc0(sizeof(JsonSemAction)); rsi = (ReturnSetInfo *) fcinfo->resultinfo; if (!rsi || !IsA(rsi, ReturnSetInfo) || (rsi->allowedModes & SFRM_Materialize) == 0 || rsi->expectedDesc == NULL) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg(""set-valued function called in context that "" ""cannot accept a set""))); rsi->returnMode = SFRM_Materialize; (void) get_call_result_type(fcinfo, NULL, &tupdesc); /* make these in a sufficiently long-lived memory context */ old_cxt = MemoryContextSwitchTo(rsi->econtext->ecxt_per_query_memory); state->ret_tdesc = CreateTupleDescCopy(tupdesc); BlessTupleDesc(state->ret_tdesc); state->tuple_store = tuplestore_begin_heap(rsi->allowedModes & SFRM_Materialize_Random, false, work_mem); MemoryContextSwitchTo(old_cxt); sem->semstate = (void *) state; sem->array_start = each_array_start; sem->scalar = each_scalar; sem->object_field_start = each_object_field_start; sem->object_field_end = each_object_field_end; state->normalize_results = as_text; state->next_scalar = false; state->lex = lex; state->tmp_cxt = AllocSetContextCreate(CurrentMemoryContext, ""json_each temporary cxt"", ALLOCSET_DEFAULT_MINSIZE, ALLOCSET_DEFAULT_INITSIZE, ALLOCSET_DEFAULT_MAXSIZE); pg_parse_json(lex, sem); MemoryContextDelete(state->tmp_cxt); rsi->setResult = state->tuple_store; rsi->setDesc = state->ret_tdesc; PG_RETURN_NULL(); } ",0 "int btrfs_orphan_add(struct btrfs_trans_handle *trans, struct inode *inode) { struct btrfs_root *root = BTRFS_I(inode)->root; struct btrfs_block_rsv *block_rsv = NULL; int reserve = 0; int insert = 0; int ret; if (!root->orphan_block_rsv) { block_rsv = btrfs_alloc_block_rsv(root, BTRFS_BLOCK_RSV_TEMP); if (!block_rsv) return -ENOMEM; } spin_lock(&root->orphan_lock); if (!root->orphan_block_rsv) { root->orphan_block_rsv = block_rsv; } else if (block_rsv) { btrfs_free_block_rsv(root, block_rsv); block_rsv = NULL; } if (!test_and_set_bit(BTRFS_INODE_HAS_ORPHAN_ITEM, &BTRFS_I(inode)->runtime_flags)) { #if 0 /* * For proper ENOSPC handling, we should do orphan * cleanup when mounting. But this introduces backward * compatibility issue. */ if (!xchg(&root->orphan_item_inserted, 1)) insert = 2; else insert = 1; #endif insert = 1; atomic_inc(&root->orphan_inodes); } if (!test_and_set_bit(BTRFS_INODE_ORPHAN_META_RESERVED, &BTRFS_I(inode)->runtime_flags)) reserve = 1; spin_unlock(&root->orphan_lock); /* grab metadata reservation from transaction handle */ if (reserve) { ret = btrfs_orphan_reserve_metadata(trans, inode); BUG_ON(ret); /* -ENOSPC in reservation; Logic error? JDM */ } /* insert an orphan item to track this unlinked/truncated file */ if (insert >= 1) { ret = btrfs_insert_orphan_item(trans, root, btrfs_ino(inode)); if (ret && ret != -EEXIST) { clear_bit(BTRFS_INODE_HAS_ORPHAN_ITEM, &BTRFS_I(inode)->runtime_flags); btrfs_abort_transaction(trans, root, ret); return ret; } ret = 0; } /* insert an orphan item to track subvolume contains orphan files */ if (insert >= 2) { ret = btrfs_insert_orphan_item(trans, root->fs_info->tree_root, root->root_key.objectid); if (ret && ret != -EEXIST) { btrfs_abort_transaction(trans, root, ret); return ret; } } return 0; } ",0 "static void __exit crypto_xcbc_module_exit(void) { crypto_unregister_template(&crypto_xcbc_tmpl); } ",0 "bool OmniboxEditModel::query_in_progress() const { return !autocomplete_controller()->done(); } ",0 "views::Label* AutofillPopupItemView::CreateSecondaryLabel( const base::string16& text) const { return CreateLabelWithStyleAndContext( text, ChromeTextContext::CONTEXT_BODY_TEXT_LARGE, ChromeTextStyle::STYLE_SECONDARY); } ",0 "void PresentationConnection::didChangeState( WebPresentationConnectionState state, bool shouldDispatchEvent) { if (m_state == state) return; m_state = state; if (!shouldDispatchEvent) return; switch (m_state) { case WebPresentationConnectionState::Connecting: NOTREACHED(); return; case WebPresentationConnectionState::Connected: dispatchStateChangeEvent(Event::create(EventTypeNames::connect)); return; case WebPresentationConnectionState::Terminated: dispatchStateChangeEvent(Event::create(EventTypeNames::terminate)); return; case WebPresentationConnectionState::Closed: NOTREACHED(); return; } NOTREACHED(); } ",0 "asmlinkage long sys_oabi_fcntl64(unsigned int fd, unsigned int cmd, unsigned long arg) { struct oabi_flock64 user; struct flock64 kernel; mm_segment_t fs = USER_DS; /* initialized to kill a warning */ unsigned long local_arg = arg; int ret; switch (cmd) { case F_GETLK64: case F_SETLK64: case F_SETLKW64: if (copy_from_user(&user, (struct oabi_flock64 __user *)arg, sizeof(user))) return -EFAULT; kernel.l_type = user.l_type; kernel.l_whence = user.l_whence; kernel.l_start = user.l_start; kernel.l_len = user.l_len; kernel.l_pid = user.l_pid; local_arg = (unsigned long)&kernel; fs = get_fs(); set_fs(KERNEL_DS); } ret = sys_fcntl64(fd, cmd, local_arg); switch (cmd) { case F_GETLK64: if (!ret) { user.l_type = kernel.l_type; user.l_whence = kernel.l_whence; user.l_start = kernel.l_start; user.l_len = kernel.l_len; user.l_pid = kernel.l_pid; if (copy_to_user((struct oabi_flock64 __user *)arg, &user, sizeof(user))) ret = -EFAULT; } case F_SETLK64: case F_SETLKW64: set_fs(fs); } return ret; } ",0 "size_t RenderProcessHost::GetMaxRendererProcessCount() { if (g_max_renderer_count_override) return g_max_renderer_count_override; #if defined(OS_ANDROID) return std::numeric_limits::max(); #endif static size_t max_count = 0; if (!max_count) { const size_t kEstimatedWebContentsMemoryUsage = #if defined(ARCH_CPU_64_BITS) 60; // In MB #else 40; // In MB #endif max_count = base::SysInfo::AmountOfPhysicalMemoryMB() / 2; max_count /= kEstimatedWebContentsMemoryUsage; const size_t kMinRendererProcessCount = 3; max_count = std::max(max_count, kMinRendererProcessCount); max_count = std::min(max_count, kMaxRendererProcessCount); } return max_count; } ",0 "void TopSitesImpl::ScheduleUpdateTimer() { if (timer_.IsRunning()) return; timer_.Start(FROM_HERE, kDelayForUpdates, this, &TopSitesImpl::StartQueryForMostVisited); } ",0 "void HostNPScriptObject::NotifyAccessCode(bool success) { DCHECK_EQ(MessageLoop::current(), host_context_.main_message_loop()); if (state_ == kRequestedAccessCode) { SetState(success ? kReceivedAccessCode : kError); } } ",0 "create_restrict_node( address_node * addr, address_node * mask, int_fifo * flags, int line_no ) { restrict_node *my_node; my_node = emalloc_zero(sizeof(*my_node)); my_node->addr = addr; my_node->mask = mask; my_node->flags = flags; my_node->line_no = line_no; return my_node; } ",0 "hstore_from_record(PG_FUNCTION_ARGS) { HeapTupleHeader rec; int32 buflen; HStore *out; Pairs *pairs; Oid tupType; int32 tupTypmod; TupleDesc tupdesc; HeapTupleData tuple; RecordIOData *my_extra; int ncolumns; int i, j; Datum *values; bool *nulls; if (PG_ARGISNULL(0)) { Oid argtype = get_fn_expr_argtype(fcinfo->flinfo, 0); /* * have no tuple to look at, so the only source of type info is the * argtype. The lookup_rowtype_tupdesc call below will error out if we * don't have a known composite type oid here. */ tupType = argtype; tupTypmod = -1; rec = NULL; } else { rec = PG_GETARG_HEAPTUPLEHEADER(0); /* Extract type info from the tuple itself */ tupType = HeapTupleHeaderGetTypeId(rec); tupTypmod = HeapTupleHeaderGetTypMod(rec); } tupdesc = lookup_rowtype_tupdesc(tupType, tupTypmod); ncolumns = tupdesc->natts; /* * We arrange to look up the needed I/O info just once per series of * calls, assuming the record type doesn't change underneath us. */ my_extra = (RecordIOData *) fcinfo->flinfo->fn_extra; if (my_extra == NULL || my_extra->ncolumns != ncolumns) { fcinfo->flinfo->fn_extra = MemoryContextAlloc(fcinfo->flinfo->fn_mcxt, sizeof(RecordIOData) - sizeof(ColumnIOData) + ncolumns * sizeof(ColumnIOData)); my_extra = (RecordIOData *) fcinfo->flinfo->fn_extra; my_extra->record_type = InvalidOid; my_extra->record_typmod = 0; } if (my_extra->record_type != tupType || my_extra->record_typmod != tupTypmod) { MemSet(my_extra, 0, sizeof(RecordIOData) - sizeof(ColumnIOData) + ncolumns * sizeof(ColumnIOData)); my_extra->record_type = tupType; my_extra->record_typmod = tupTypmod; my_extra->ncolumns = ncolumns; } pairs = palloc(ncolumns * sizeof(Pairs)); if (rec) { /* Build a temporary HeapTuple control structure */ tuple.t_len = HeapTupleHeaderGetDatumLength(rec); ItemPointerSetInvalid(&(tuple.t_self)); tuple.t_tableOid = InvalidOid; tuple.t_data = rec; values = (Datum *) palloc(ncolumns * sizeof(Datum)); nulls = (bool *) palloc(ncolumns * sizeof(bool)); /* Break down the tuple into fields */ heap_deform_tuple(&tuple, tupdesc, values, nulls); } else { values = NULL; nulls = NULL; } for (i = 0, j = 0; i < ncolumns; ++i) { ColumnIOData *column_info = &my_extra->columns[i]; Oid column_type = tupdesc->attrs[i]->atttypid; char *value; /* Ignore dropped columns in datatype */ if (tupdesc->attrs[i]->attisdropped) continue; pairs[j].key = NameStr(tupdesc->attrs[i]->attname); pairs[j].keylen = hstoreCheckKeyLen(strlen(NameStr(tupdesc->attrs[i]->attname))); if (!nulls || nulls[i]) { pairs[j].val = NULL; pairs[j].vallen = 4; pairs[j].isnull = true; pairs[j].needfree = false; ++j; continue; } /* * Convert the column value to text */ if (column_info->column_type != column_type) { bool typIsVarlena; getTypeOutputInfo(column_type, &column_info->typiofunc, &typIsVarlena); fmgr_info_cxt(column_info->typiofunc, &column_info->proc, fcinfo->flinfo->fn_mcxt); column_info->column_type = column_type; } value = OutputFunctionCall(&column_info->proc, values[i]); pairs[j].val = value; pairs[j].vallen = hstoreCheckValLen(strlen(value)); pairs[j].isnull = false; pairs[j].needfree = false; ++j; } ncolumns = hstoreUniquePairs(pairs, j, &buflen); out = hstorePairs(pairs, ncolumns, buflen); ReleaseTupleDesc(tupdesc); PG_RETURN_POINTER(out); } ",1 "void Editor::toggleOverwriteModeEnabled() { m_overwriteModeEnabled = !m_overwriteModeEnabled; frame().selection().setShouldShowBlockCursor(m_overwriteModeEnabled); } ",0 "bool JSArray::increaseVectorPrefixLength(unsigned newLength) { ArrayStorage* storage = m_storage; unsigned vectorLength = m_vectorLength; ASSERT(newLength > vectorLength); ASSERT(newLength <= MAX_STORAGE_VECTOR_INDEX); unsigned newVectorLength = getNewVectorLength(newLength); void* newBaseStorage = fastMalloc(storageSize(newVectorLength + m_indexBias)); if (!newBaseStorage) return false; m_indexBias += newVectorLength - newLength; m_storage = reinterpret_cast_ptr(static_cast(newBaseStorage) + m_indexBias * sizeof(JSValue)); memcpy(m_storage, storage, storageSize(0)); memcpy(&m_storage->m_vector[newLength - m_vectorLength], &storage->m_vector[0], vectorLength * sizeof(JSValue)); m_storage->m_allocBase = newBaseStorage; m_vectorLength = newLength; fastFree(storage->m_allocBase); Heap::heap(this)->reportExtraMemoryCost(storageSize(newVectorLength) - storageSize(vectorLength)); return true; } ",1 "void Browser::UseVerticalTabsChanged() { UpdateTabStripModelInsertionPolicy(); window()->ToggleTabStripMode(); } ",0 " SwapoutACKMessageFilter() : BrowserMessageFilter(FrameMsgStart) {} ",0 "bool WasModuleLoadSuccessful( Resource* resource, HeapVector>* error_messages) { DCHECK(error_messages); if (resource) { SubresourceIntegrityHelper::GetConsoleMessages( resource->IntegrityReportInfo(), error_messages); } if (!resource || resource->ErrorOccurred() || resource->IntegrityDisposition() != ResourceIntegrityDisposition::kPassed) { return false; } const auto& response = resource->GetResponse(); if (response.IsHTTP() && !FetchUtils::IsOkStatus(response.HttpStatusCode())) { return false; } if (!MIMETypeRegistry::IsSupportedJavaScriptMIMEType( response.HttpContentType())) { String message = ""Failed to load module script: The server responded with a "" ""non-JavaScript MIME type of \"""" + response.HttpContentType() + ""\"". Strict MIME type checking is enforced for module scripts per "" ""HTML spec.""; error_messages->push_back(ConsoleMessage::CreateForRequest( kJSMessageSource, kErrorMessageLevel, message, response.Url().GetString(), nullptr, resource->Identifier())); return false; } return true; } ",0 "string16 ExtensionInstallUI::Prompt::GetPermissionsHeader() const { return l10n_util::GetStringUTF16(kPermissionsHeaderIds[type_]); } ",0 "OperationID FileSystemOperationRunner::RemoveFile(const FileSystemURL& url, StatusCallback callback) { base::File::Error error = base::File::FILE_OK; std::unique_ptr operation = base::WrapUnique( file_system_context_->CreateFileSystemOperation(url, &error)); FileSystemOperation* operation_raw = operation.get(); OperationID id = BeginOperation(std::move(operation)); base::AutoReset beginning(&is_beginning_operation_, true); if (!operation_raw) { DidFinish(id, std::move(callback), error); return id; } PrepareForWrite(id, url); operation_raw->RemoveFile( url, base::BindOnce(&FileSystemOperationRunner::DidFinish, weak_ptr_, id, std::move(callback))); return id; } ",0 "sp Camera3Device::createCaptureRequest( const CameraMetadata &request) { ATRACE_CALL(); status_t res; sp newRequest = new CaptureRequest; newRequest->mSettings = request; camera_metadata_entry_t inputStreams = newRequest->mSettings.find(ANDROID_REQUEST_INPUT_STREAMS); if (inputStreams.count > 0) { if (mInputStream == NULL || mInputStream->getId() != inputStreams.data.i32[0]) { CLOGE(""Request references unknown input stream %d"", inputStreams.data.u8[0]); return NULL; } if (mInputStream->isConfiguring()) { res = mInputStream->finishConfiguration(mHal3Device); if (res != OK) { SET_ERR_L(""Unable to finish configuring input stream %d:"" "" %s (%d)"", mInputStream->getId(), strerror(-res), res); return NULL; } } if (mInputStream->isPreparing()) { CLOGE(""Request references an input stream that's being prepared!""); return NULL; } newRequest->mInputStream = mInputStream; newRequest->mSettings.erase(ANDROID_REQUEST_INPUT_STREAMS); } camera_metadata_entry_t streams = newRequest->mSettings.find(ANDROID_REQUEST_OUTPUT_STREAMS); if (streams.count == 0) { CLOGE(""Zero output streams specified!""); return NULL; } for (size_t i = 0; i < streams.count; i++) { int idx = mOutputStreams.indexOfKey(streams.data.i32[i]); if (idx == NAME_NOT_FOUND) { CLOGE(""Request references unknown stream %d"", streams.data.u8[i]); return NULL; } sp stream = mOutputStreams.editValueAt(idx); if (stream->isConfiguring()) { res = stream->finishConfiguration(mHal3Device); if (res != OK) { SET_ERR_L(""Unable to finish configuring stream %d: %s (%d)"", stream->getId(), strerror(-res), res); return NULL; } } if (stream->isPreparing()) { CLOGE(""Request references an output stream that's being prepared!""); return NULL; } newRequest->mOutputStreams.push(stream); } newRequest->mSettings.erase(ANDROID_REQUEST_OUTPUT_STREAMS); newRequest->mBatchSize = 1; return newRequest; } ",0 "void TabStrip::ResizeLayoutTabs() { if (tab_count() == 0) return; RemoveMessageLoopObserver(); in_tab_close_ = false; available_width_for_tabs_ = -1; int pinned_tab_count = GetPinnedTabCount(); if (pinned_tab_count == tab_count()) { return; } StartResizeLayoutAnimation(); } ",0 "scoped_ptr LayerTreeHost::CreateOutputSurface() { return client_->CreateOutputSurface(num_failed_recreate_attempts_ >= 4); } ",0 "GF_Err grpl_dump(GF_Box *a, FILE * trace) { gf_isom_box_dump_start(a, ""GroupListBox"", trace); fprintf(trace, "">\n""); gf_isom_box_dump_done(""GroupListBox"", a, trace); return GF_OK; } ",0 "static int xfrm_dump_sa(struct sk_buff *skb, struct netlink_callback *cb) { struct net *net = sock_net(skb->sk); struct xfrm_state_walk *walk = (struct xfrm_state_walk *) &cb->args[1]; struct xfrm_dump_info info; BUILD_BUG_ON(sizeof(struct xfrm_state_walk) > sizeof(cb->args) - sizeof(cb->args[0])); info.in_skb = cb->skb; info.out_skb = skb; info.nlmsg_seq = cb->nlh->nlmsg_seq; info.nlmsg_flags = NLM_F_MULTI; if (!cb->args[0]) { cb->args[0] = 1; xfrm_state_walk_init(walk, 0); } (void) xfrm_state_walk(net, walk, dump_one_state, &info); return skb->len; } ",0 "xmlXPathNewCompExpr(void) { xmlXPathCompExprPtr cur; cur = (xmlXPathCompExprPtr) xmlMalloc(sizeof(xmlXPathCompExpr)); if (cur == NULL) { xmlXPathErrMemory(NULL, ""allocating component\n""); return(NULL); } memset(cur, 0, sizeof(xmlXPathCompExpr)); cur->maxStep = 10; cur->nbStep = 0; cur->steps = (xmlXPathStepOp *) xmlMalloc(cur->maxStep * sizeof(xmlXPathStepOp)); if (cur->steps == NULL) { xmlXPathErrMemory(NULL, ""allocating steps\n""); xmlFree(cur); return(NULL); } memset(cur->steps, 0, cur->maxStep * sizeof(xmlXPathStepOp)); cur->last = -1; #ifdef DEBUG_EVAL_COUNTS cur->nb = 0; #endif return(cur); } ",0 "download_action(struct parsed_tagarg *arg) { DownloadList *d; pid_t pid; for (; arg; arg = arg->next) { if (!strncmp(arg->arg, ""stop"", 4)) { pid = (pid_t) atoi(&arg->arg[4]); #ifndef __MINGW32_VERSION kill(pid, SIGKILL); #endif } else if (!strncmp(arg->arg, ""ok"", 2)) pid = (pid_t) atoi(&arg->arg[2]); else continue; for (d = FirstDL; d; d = d->next) { if (d->pid == pid) { unlink(d->lock); if (d->prev) d->prev->next = d->next; else FirstDL = d->next; if (d->next) d->next->prev = d->prev; else LastDL = d->prev; break; } } } ldDL(); } ",0 "int vhost_add_used(struct vhost_virtqueue *vq, unsigned int head, int len) { struct vring_used_elem __user *used; /* The virtqueue contains a ring of used buffers. Get a pointer to the * next entry in that used ring. */ used = &vq->used->ring[vq->last_used_idx % vq->num]; if (__put_user(head, &used->id)) { vq_err(vq, ""Failed to write used id""); return -EFAULT; } if (__put_user(len, &used->len)) { vq_err(vq, ""Failed to write used len""); return -EFAULT; } /* Make sure buffer is written before we update index. */ smp_wmb(); if (__put_user(vq->last_used_idx + 1, &vq->used->idx)) { vq_err(vq, ""Failed to increment used idx""); return -EFAULT; } if (unlikely(vq->log_used)) { /* Make sure data is seen before log. */ smp_wmb(); /* Log used ring entry write. */ log_write(vq->log_base, vq->log_addr + ((void __user *)used - (void __user *)vq->used), sizeof *used); /* Log used index update. */ log_write(vq->log_base, vq->log_addr + offsetof(struct vring_used, idx), sizeof vq->used->idx); if (vq->log_ctx) eventfd_signal(vq->log_ctx, 1); } vq->last_used_idx++; /* If the driver never bothers to signal in a very long while, * used index might wrap around. If that happens, invalidate * signalled_used index we stored. TODO: make sure driver * signals at least once in 2^16 and remove this. */ if (unlikely(vq->last_used_idx == vq->signalled_used)) vq->signalled_used_valid = false; return 0; } ",0 "static inline void set_cmdline(int idx, const char *cmdline) { memcpy(get_saved_cmdlines(idx), cmdline, TASK_COMM_LEN); } ",0 "scoped_refptr Extension::Create(const FilePath& path, Manifest::Location location, const DictionaryValue& value, int flags, std::string* utf8_error) { return Extension::Create(path, location, value, flags, std::string(), // ID is ignored if empty. utf8_error); } ",0 "e1000_link_up(E1000State *s) { s->mac_reg[STATUS] |= E1000_STATUS_LU; s->phy_reg[PHY_STATUS] |= MII_SR_LINK_STATUS; } ",0 "vips_foreign_load_iscompat( VipsImage *a, VipsImage *b ) { if( a->Xsize != b->Xsize || a->Ysize != b->Ysize || a->Bands != b->Bands || a->Coding != b->Coding || a->BandFmt != b->BandFmt ) { vips_error( ""VipsForeignLoad"", ""%s"", _( ""images do not match"" ) ); return( FALSE ); } return( TRUE ); } ",0 " TestCommand() : shouldDumpPixels(false), timeout(0) { } ",0 "bool Document::haveStylesheetsLoaded() const { return !m_styleSheetCollection->hasPendingSheets() || m_ignorePendingStylesheets; } ",0 "vrrp_vscript_user_handler(vector_t *strvec) { vrrp_script_t *vscript = LIST_TAIL_DATA(vrrp_data->vrrp_script); if (set_script_uid_gid(strvec, 1, &vscript->script.uid, &vscript->script.gid)) { report_config_error(CONFIG_GENERAL_ERROR, ""Unable to set uid/gid for script %s"", cmd_str(&vscript->script)); remove_script = true; } else { remove_script = false; script_user_set = true; } } ",0 "int jbd2_journal_file_inode(handle_t *handle, struct jbd2_inode *jinode) { transaction_t *transaction = handle->h_transaction; journal_t *journal = transaction->t_journal; if (is_handle_aborted(handle)) return -EIO; jbd_debug(4, ""Adding inode %lu, tid:%d\n"", jinode->i_vfs_inode->i_ino, transaction->t_tid); /* * First check whether inode isn't already on the transaction's * lists without taking the lock. Note that this check is safe * without the lock as we cannot race with somebody removing inode * from the transaction. The reason is that we remove inode from the * transaction only in journal_release_jbd_inode() and when we commit * the transaction. We are guarded from the first case by holding * a reference to the inode. We are safe against the second case * because if jinode->i_transaction == transaction, commit code * cannot touch the transaction because we hold reference to it, * and if jinode->i_next_transaction == transaction, commit code * will only file the inode where we want it. */ if (jinode->i_transaction == transaction || jinode->i_next_transaction == transaction) return 0; spin_lock(&journal->j_list_lock); if (jinode->i_transaction == transaction || jinode->i_next_transaction == transaction) goto done; /* * We only ever set this variable to 1 so the test is safe. Since * t_need_data_flush is likely to be set, we do the test to save some * cacheline bouncing */ if (!transaction->t_need_data_flush) transaction->t_need_data_flush = 1; /* On some different transaction's list - should be * the committing one */ if (jinode->i_transaction) { J_ASSERT(jinode->i_next_transaction == NULL); J_ASSERT(jinode->i_transaction == journal->j_committing_transaction); jinode->i_next_transaction = transaction; goto done; } /* Not on any transaction list... */ J_ASSERT(!jinode->i_next_transaction); jinode->i_transaction = transaction; list_add(&jinode->i_list, &transaction->t_inode_list); done: spin_unlock(&journal->j_list_lock); return 0; } ",0 "void PeopleHandler::HandleSignout(const base::ListValue* args) { bool delete_profile = false; args->GetBoolean(0, &delete_profile); if (!signin_util::IsUserSignoutAllowedForProfile(profile_)) { DCHECK(delete_profile); } else { SigninManager* signin_manager = SigninManagerFactory::GetForProfile(profile_); if (signin_manager->IsAuthenticated()) { if (GetSyncService()) ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS); signin_metrics::SignoutDelete delete_metric = delete_profile ? signin_metrics::SignoutDelete::DELETED : signin_metrics::SignoutDelete::KEEPING; signin_manager->SignOutAndRemoveAllAccounts( signin_metrics::USER_CLICKED_SIGNOUT_SETTINGS, delete_metric); } else { DCHECK(!delete_profile) << ""Deleting the profile should only be offered the user is syncing.""; ProfileOAuth2TokenServiceFactory::GetForProfile(profile_) ->RevokeAllCredentials(); } } if (delete_profile) { webui::DeleteProfileAtPath(profile_->GetPath(), ProfileMetrics::DELETE_PROFILE_SETTINGS); } } ",1 "int skb_csum_hwoffload_help(struct sk_buff *skb, const netdev_features_t features) { if (unlikely(skb->csum_not_inet)) return !!(features & NETIF_F_SCTP_CRC) ? 0 : skb_crc32c_csum_help(skb); return !!(features & NETIF_F_CSUM_MASK) ? 0 : skb_checksum_help(skb); } ",0 "InputDispatcher::CommandEntry::CommandEntry(Command command) : command(command), eventTime(0), keyEntry(NULL), userActivityEventType(0), seq(0), handled(false) { } ",0 "static int handle_pml_full(struct kvm_vcpu *vcpu) { unsigned long exit_qualification; trace_kvm_pml_full(vcpu->vcpu_id); exit_qualification = vmcs_readl(EXIT_QUALIFICATION); /* * PML buffer FULL happened while executing iret from NMI, * ""blocked by NMI"" bit has to be set before next VM entry. */ if (!(to_vmx(vcpu)->idt_vectoring_info & VECTORING_INFO_VALID_MASK) && (exit_qualification & INTR_INFO_UNBLOCK_NMI)) vmcs_set_bits(GUEST_INTERRUPTIBILITY_INFO, GUEST_INTR_STATE_NMI); /* * PML buffer already flushed at beginning of VMEXIT. Nothing to do * here.., and there's no userspace involvement needed for PML. */ return 1; } ",0 " cff_parse_fixed_dynamic( CFF_Parser parser, FT_Byte** d, FT_Long* scaling ) { FT_ASSERT( scaling ); if ( **d == 30 ) return cff_parse_real( *d, parser->limit, 0, scaling ); else { FT_Long number; FT_Int integer_length; number = cff_parse_integer( d[0], d[1] ); if ( number > 0x7FFFL ) { for ( integer_length = 5; integer_length < 10; integer_length++ ) if ( number < power_tens[integer_length] ) break; if ( ( number / power_tens[integer_length - 5] ) > 0x7FFFL ) { *scaling = integer_length - 4; return FT_DivFix( number, power_tens[integer_length - 4] ); } else { *scaling = integer_length - 5; return FT_DivFix( number, power_tens[integer_length - 5] ); } } else { *scaling = 0; return (FT_Long)( (FT_ULong)number << 16 ); } } } ",0 "int ecc_mul2add(ecc_point* A, mp_int* kA, ecc_point* B, mp_int* kB, ecc_point* C, mp_int* a, mp_int* modulus, void* heap) { int idx1 = -1, idx2 = -1, err = MP_OKAY, mpInit = 0; mp_digit mp; mp_int mu; err = mp_init(&mu); if (err != MP_OKAY) return err; #ifndef HAVE_THREAD_LS if (initMutex == 0) { wc_InitMutex(&ecc_fp_lock); initMutex = 1; } if (wc_LockMutex(&ecc_fp_lock) != 0) return BAD_MUTEX_E; #endif /* HAVE_THREAD_LS */ /* find point */ idx1 = find_base(A); /* no entry? */ if (idx1 == -1) { /* find hole and add it */ if ((idx1 = find_hole()) >= 0) { err = add_entry(idx1, A); } } if (err == MP_OKAY && idx1 != -1) { /* increment LRU */ ++(fp_cache[idx1].lru_count); } if (err == MP_OKAY) /* find point */ idx2 = find_base(B); if (err == MP_OKAY) { /* no entry? */ if (idx2 == -1) { /* find hole and add it */ if ((idx2 = find_hole()) >= 0) err = add_entry(idx2, B); } } if (err == MP_OKAY && idx2 != -1) { /* increment LRU */ ++(fp_cache[idx2].lru_count); } if (err == MP_OKAY) { /* if it's 2 build the LUT, if it's higher just use the LUT */ if (idx1 >= 0 && fp_cache[idx1].lru_count == 2) { /* compute mp */ err = mp_montgomery_setup(modulus, &mp); if (err == MP_OKAY) { mpInit = 1; err = mp_montgomery_calc_normalization(&mu, modulus); } if (err == MP_OKAY) /* build the LUT */ err = build_lut(idx1, a, modulus, mp, &mu); } } if (err == MP_OKAY) { /* if it's 2 build the LUT, if it's higher just use the LUT */ if (idx2 >= 0 && fp_cache[idx2].lru_count == 2) { if (mpInit == 0) { /* compute mp */ err = mp_montgomery_setup(modulus, &mp); if (err == MP_OKAY) { mpInit = 1; err = mp_montgomery_calc_normalization(&mu, modulus); } } if (err == MP_OKAY) /* build the LUT */ err = build_lut(idx2, a, modulus, mp, &mu); } } if (err == MP_OKAY) { if (idx1 >=0 && idx2 >= 0 && fp_cache[idx1].lru_count >= 2 && fp_cache[idx2].lru_count >= 2) { if (mpInit == 0) { /* compute mp */ err = mp_montgomery_setup(modulus, &mp); } if (err == MP_OKAY) err = accel_fp_mul2add(idx1, idx2, kA, kB, C, a, modulus, mp); } else { err = normal_ecc_mul2add(A, kA, B, kB, C, a, modulus, heap); } } #ifndef HAVE_THREAD_LS wc_UnLockMutex(&ecc_fp_lock); #endif /* HAVE_THREAD_LS */ mp_clear(&mu); return err; } ",0 "static void *saved_cmdlines_start(struct seq_file *m, loff_t *pos) { void *v; loff_t l = 0; preempt_disable(); arch_spin_lock(&trace_cmdline_lock); v = &savedcmd->map_cmdline_to_pid[0]; while (l <= *pos) { v = saved_cmdlines_next(m, v, &l); if (!v) return NULL; } return v; } ",0 "static void *cache_free_debugcheck(struct kmem_cache *cachep, void *objp, unsigned long caller) { unsigned int objnr; struct page *page; BUG_ON(virt_to_cache(objp) != cachep); objp -= obj_offset(cachep); kfree_debugcheck(objp); page = virt_to_head_page(objp); if (cachep->flags & SLAB_RED_ZONE) { verify_redzone_free(cachep, objp); *dbg_redzone1(cachep, objp) = RED_INACTIVE; *dbg_redzone2(cachep, objp) = RED_INACTIVE; } if (cachep->flags & SLAB_STORE_USER) { set_store_user_dirty(cachep); *dbg_userword(cachep, objp) = (void *)caller; } objnr = obj_to_index(cachep, page, objp); BUG_ON(objnr >= cachep->num); BUG_ON(objp != index_to_obj(cachep, page, objnr)); if (cachep->flags & SLAB_POISON) { poison_obj(cachep, objp, POISON_FREE); slab_kernel_map(cachep, objp, 0, caller); } return objp; } ",0 "bool IsViewsBrowserCocoa() { return !base::FeatureList::IsEnabled(kViewsBrowserWindows) && !base::FeatureList::IsEnabled(kExperimentalUi); } ",0 "static struct dentry *proc_task_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *nd) { struct dentry *result = ERR_PTR(-ENOENT); struct task_struct *task; struct task_struct *leader = get_proc_task(dir); unsigned tid; struct pid_namespace *ns; if (!leader) goto out_no_task; tid = name_to_int(dentry); if (tid == ~0U) goto out; ns = dentry->d_sb->s_fs_info; rcu_read_lock(); task = find_task_by_pid_ns(tid, ns); if (task) get_task_struct(task); rcu_read_unlock(); if (!task) goto out; if (!same_thread_group(leader, task)) goto out_drop_task; result = proc_task_instantiate(dir, dentry, task, NULL); out_drop_task: put_task_struct(task); out: put_task_struct(leader); out_no_task: return result; } ",0 "int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg) { struct tcp_sock *tp = tcp_sk(sk); int answ; bool slow; switch (cmd) { case SIOCINQ: if (sk->sk_state == TCP_LISTEN) return -EINVAL; slow = lock_sock_fast(sk); answ = tcp_inq(sk); unlock_sock_fast(sk, slow); break; case SIOCATMARK: answ = tp->urg_data && tp->urg_seq == tp->copied_seq; break; case SIOCOUTQ: if (sk->sk_state == TCP_LISTEN) return -EINVAL; if ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV)) answ = 0; else answ = tp->write_seq - tp->snd_una; break; case SIOCOUTQNSD: if (sk->sk_state == TCP_LISTEN) return -EINVAL; if ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV)) answ = 0; else answ = tp->write_seq - tp->snd_nxt; break; default: return -ENOIOCTLCMD; } return put_user(answ, (int __user *)arg); } ",0 "static int handle_window_update_frame(h2o_http2_conn_t *conn, h2o_http2_frame_t *frame, const char **err_desc) { h2o_http2_window_update_payload_t payload; int ret, err_is_stream_level; if ((ret = h2o_http2_decode_window_update_payload(&payload, frame, err_desc, &err_is_stream_level)) != 0) { if (err_is_stream_level) { h2o_http2_stream_t *stream = h2o_http2_conn_get_stream(conn, frame->stream_id); if (stream != NULL) h2o_http2_stream_reset(conn, stream); send_stream_error(conn, frame->stream_id, ret); return 0; } else { return ret; } } if (frame->stream_id == 0) { if (h2o_http2_window_update(&conn->_write.window, payload.window_size_increment) != 0) { *err_desc = ""flow control window overflow""; return H2O_HTTP2_ERROR_FLOW_CONTROL; } } else if (!is_idle_stream_id(conn, frame->stream_id)) { h2o_http2_stream_t *stream = h2o_http2_conn_get_stream(conn, frame->stream_id); if (stream != NULL) { if (update_stream_output_window(stream, payload.window_size_increment) != 0) { h2o_http2_stream_reset(conn, stream); send_stream_error(conn, frame->stream_id, H2O_HTTP2_ERROR_FLOW_CONTROL); return 0; } } } else { *err_desc = ""invalid stream id in WINDOW_UPDATE frame""; return H2O_HTTP2_ERROR_PROTOCOL; } resume_send(conn); return 0; } ",0 "static void xfer_recover(struct xfer_header *xfer) { struct xfer_item *item; int r; syslog(LOG_INFO, ""XFER: recovering""); /* Backout any changes - we stop on first untouched mailbox */ for (item = xfer->items; item && item->state; item = item->next) { switch (item->state) { case XFER_UNDUMPED: case XFER_LOCAL_MOVING: /* Unset mailbox as MOVING on local server */ r = mboxlist_update(item->mbentry, 1); if (r) { syslog(LOG_ERR, ""Could not back out MOVING flag during move of %s (%s)"", item->mbentry->name, error_message(r)); } case XFER_REMOTE_CREATED: if (!xfer->use_replication) { /* Delete remote mailbox */ prot_printf(xfer->be->out, ""LD1 LOCALDELETE {"" SIZE_T_FMT ""+}\r\n%s\r\n"", strlen(item->extname), item->extname); r = getresult(xfer->be->in, ""LD1""); if (r) { syslog(LOG_ERR, ""Could not back out remote mailbox during move of %s (%s)"", item->mbentry->name, error_message(r)); } } case XFER_DEACTIVATED: /* Tell murder it's back here and active */ r = xfer_mupdate(1, item->mbentry->name, item->mbentry->partition, config_servername, item->mbentry->acl); if (r) { syslog(LOG_ERR, ""Could not back out mupdate during move of %s (%s)"", item->mbentry->name, error_message(r)); } } } } ",0 "__mem_cgroup_commit_charge_lrucare(struct page *page, struct mem_cgroup *memcg, enum charge_type ctype) { struct page_cgroup *pc = lookup_page_cgroup(page); struct zone *zone = page_zone(page); unsigned long flags; bool removed = false; /* * In some case, SwapCache, FUSE(splice_buf->radixtree), the page * is already on LRU. It means the page may on some other page_cgroup's * LRU. Take care of it. */ spin_lock_irqsave(&zone->lru_lock, flags); if (PageLRU(page)) { del_page_from_lru_list(zone, page, page_lru(page)); ClearPageLRU(page); removed = true; } __mem_cgroup_commit_charge(memcg, page, 1, pc, ctype); if (removed) { add_page_to_lru_list(zone, page, page_lru(page)); SetPageLRU(page); } spin_unlock_irqrestore(&zone->lru_lock, flags); return; } ",0 "PHP_FUNCTION(imagejpeg) { _php_image_output_ctx(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_JPG, ""JPEG"", gdImageJpegCtx); } ",0 "void Document::Shutdown() { TRACE_EVENT0(""blink"", ""Document::shutdown""); CHECK(!frame_ || frame_->Tree().ChildCount() == 0); if (!IsActive()) return; display_cutout_host_.reset(); FrameNavigationDisabler navigation_disabler(*frame_); HTMLFrameOwnerElement::PluginDisposeSuspendScope suspend_plugin_dispose; ScriptForbiddenScope forbid_script; lifecycle_.AdvanceTo(DocumentLifecycle::kStopping); View()->Dispose(); CHECK(!View()->IsAttached()); HTMLFrameOwnerElement* owner_element = frame_->DeprecatedLocalOwner(); if (owner_element && !frame_->IsProvisional()) owner_element->SetEmbeddedContentView(nullptr); markers_->PrepareForDestruction(); if (GetPage()) GetPage()->DocumentDetached(this); probe::documentDetached(this); if (frame_->Client()->GetSharedWorkerRepositoryClient()) frame_->Client()->GetSharedWorkerRepositoryClient()->DocumentDetached(this); if (scripted_animation_controller_) scripted_animation_controller_->ClearDocumentPointer(); scripted_animation_controller_.Clear(); scripted_idle_task_controller_.Clear(); if (SvgExtensions()) AccessSVGExtensions().PauseAnimations(); if (layout_view_) layout_view_->SetIsInWindow(false); if (RegistrationContext()) RegistrationContext()->DocumentWasDetached(); MutationObserver::CleanSlotChangeList(*this); hover_element_ = nullptr; active_element_ = nullptr; autofocus_element_ = nullptr; if (focused_element_.Get()) { Element* old_focused_element = focused_element_; focused_element_ = nullptr; if (GetPage()) GetPage()->GetChromeClient().FocusedNodeChanged(old_focused_element, nullptr); } sequential_focus_navigation_starting_point_ = nullptr; if (this == &AXObjectCacheOwner()) ClearAXObjectCache(); layout_view_ = nullptr; ContainerNode::DetachLayoutTree(); CHECK(!View()->IsAttached()); if (this != &AXObjectCacheOwner()) { if (AXObjectCache* cache = ExistingAXObjectCache()) { for (Node& node : NodeTraversal::DescendantsOf(*this)) { cache->Remove(&node); } } } GetStyleEngine().DidDetach(); frame_->GetEventHandlerRegistry().DocumentDetached(*this); DocumentShutdownNotifier::NotifyContextDestroyed(); SynchronousMutationNotifier::NotifyContextDestroyed(); if (!Loader()) fetcher_->ClearContext(); if (imports_controller_) { imports_controller_->Dispose(); ClearImportsController(); } if (media_query_matcher_) media_query_matcher_->DocumentDetached(); lifecycle_.AdvanceTo(DocumentLifecycle::kStopped); CHECK(!View()->IsAttached()); ExecutionContext::NotifyContextDestroyed(); CHECK(!View()->IsAttached()); needs_to_record_ukm_outlive_time_ = IsInMainFrame(); if (needs_to_record_ukm_outlive_time_) { UkmRecorder(); } frame_ = nullptr; document_outlive_time_reporter_ = std::make_unique(this); } ",0 "static inline cputime_t virt_ticks(struct task_struct *p) { return p->utime; } ",0 "FileOutStream::FileOutStream (FILE* fa, Guint startA) { f = fa; start = startA; } ",0 "int qcow2_check_metadata_overlap(BlockDriverState *bs, int ign, int64_t offset, int64_t size) { BDRVQcowState *s = bs->opaque; int chk = s->overlap_check & ~ign; int i, j; if (!size) { return 0; } if (chk & QCOW2_OL_MAIN_HEADER) { if (offset < s->cluster_size) { return QCOW2_OL_MAIN_HEADER; } } /* align range to test to cluster boundaries */ size = align_offset(offset_into_cluster(s, offset) + size, s->cluster_size); offset = start_of_cluster(s, offset); if ((chk & QCOW2_OL_ACTIVE_L1) && s->l1_size) { if (overlaps_with(s->l1_table_offset, s->l1_size * sizeof(uint64_t))) { return QCOW2_OL_ACTIVE_L1; } } if ((chk & QCOW2_OL_REFCOUNT_TABLE) && s->refcount_table_size) { if (overlaps_with(s->refcount_table_offset, s->refcount_table_size * sizeof(uint64_t))) { return QCOW2_OL_REFCOUNT_TABLE; } } if ((chk & QCOW2_OL_SNAPSHOT_TABLE) && s->snapshots_size) { if (overlaps_with(s->snapshots_offset, s->snapshots_size)) { return QCOW2_OL_SNAPSHOT_TABLE; } } if ((chk & QCOW2_OL_INACTIVE_L1) && s->snapshots) { for (i = 0; i < s->nb_snapshots; i++) { if (s->snapshots[i].l1_size && overlaps_with(s->snapshots[i].l1_table_offset, s->snapshots[i].l1_size * sizeof(uint64_t))) { return QCOW2_OL_INACTIVE_L1; } } } if ((chk & QCOW2_OL_ACTIVE_L2) && s->l1_table) { for (i = 0; i < s->l1_size; i++) { if ((s->l1_table[i] & L1E_OFFSET_MASK) && overlaps_with(s->l1_table[i] & L1E_OFFSET_MASK, s->cluster_size)) { return QCOW2_OL_ACTIVE_L2; } } } if ((chk & QCOW2_OL_REFCOUNT_BLOCK) && s->refcount_table) { for (i = 0; i < s->refcount_table_size; i++) { if ((s->refcount_table[i] & REFT_OFFSET_MASK) && overlaps_with(s->refcount_table[i] & REFT_OFFSET_MASK, s->cluster_size)) { return QCOW2_OL_REFCOUNT_BLOCK; } } } if ((chk & QCOW2_OL_INACTIVE_L2) && s->snapshots) { for (i = 0; i < s->nb_snapshots; i++) { uint64_t l1_ofs = s->snapshots[i].l1_table_offset; uint32_t l1_sz = s->snapshots[i].l1_size; uint64_t l1_sz2 = l1_sz * sizeof(uint64_t); uint64_t *l1 = g_malloc(l1_sz2); int ret; ret = bdrv_pread(bs->file, l1_ofs, l1, l1_sz2); if (ret < 0) { g_free(l1); return ret; } for (j = 0; j < l1_sz; j++) { uint64_t l2_ofs = be64_to_cpu(l1[j]) & L1E_OFFSET_MASK; if (l2_ofs && overlaps_with(l2_ofs, s->cluster_size)) { g_free(l1); return QCOW2_OL_INACTIVE_L2; } } g_free(l1); } } return 0; } ",0 "void V8TestObject::CallWithExecutionContextAnyAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_callWithExecutionContextAnyAttribute_Getter""); test_object_v8_internal::CallWithExecutionContextAnyAttributeAttributeGetter(info); } ",0 "void ContainerNode::parserTakeAllChildrenFrom(ContainerNode* oldParent) { while (RefPtr child = oldParent->firstChild()) { oldParent->parserRemoveChild(child.get()); treeScope().adoptIfNeeded(child.get()); parserAppendChild(child.get()); } } ",0 "void UsbTransferFunction::OnCompleted(UsbTransferStatus status, scoped_refptr data, size_t length) { scoped_ptr transfer_info(new base::DictionaryValue()); transfer_info->SetInteger(kResultCodeKey, status); transfer_info->Set(kDataKey, base::BinaryValue::CreateWithCopiedBuffer( data->data(), length)); if (status == device::USB_TRANSFER_COMPLETED) { Respond(OneArgument(transfer_info.release())); } else { scoped_ptr error_args(new base::ListValue()); error_args->Append(transfer_info.release()); Respond(ErrorWithArguments(error_args.Pass(), ConvertTransferStatusToApi(status))); } } ",0 "static JSON_INLINE void list_insert(list_t *list, list_t *node) { node->next = list; node->prev = list->prev; list->prev->next = node; list->prev = node; } ",0 "static int ide_handle_rw_error(IDEState *s, int error, int op) { bool is_read = (op & IDE_RETRY_READ) != 0; BlockErrorAction action = blk_get_error_action(s->blk, is_read, error); if (action == BLOCK_ERROR_ACTION_STOP) { s->bus->dma->ops->set_unit(s->bus->dma, s->unit); s->bus->error_status = op; } else if (action == BLOCK_ERROR_ACTION_REPORT) { if (op & IDE_RETRY_DMA) { ide_dma_error(s); } else { ide_rw_error(s); } } blk_error_action(s->blk, action, is_read, error); return action != BLOCK_ERROR_ACTION_IGNORE; } ",0 "int qemu_spice_rect_is_empty(const QXLRect* r) { return r->top == r->bottom || r->left == r->right; } ",0 "float GM2TabStyle::GetThrobValue() const { const bool is_selected = tab_->IsSelected(); double val = is_selected ? kSelectedTabOpacity : 0; if (IsHoverActive()) { constexpr float kSelectedTabThrobScale = 0.95f - kSelectedTabOpacity; const float opacity = GetHoverOpacity(); const float offset = is_selected ? (kSelectedTabThrobScale * opacity) : opacity; val += GetHoverAnimationValue() * offset; } return val; } ",0 "String createFullMarkup(const Range* range) { if (!range) return String(); Node* node = range->startContainer(); if (!node) return String(); Document* document = node->document(); if (!document) return String(); Frame* frame = document->frame(); if (!frame) return String(); return frame->documentTypeString() + createMarkup(range, 0, AnnotateForInterchange); } ",0 "void LayoutSVGContainer::addChild(LayoutObject* child, LayoutObject* beforeChild) { LayoutSVGModelObject::addChild(child, beforeChild); SVGResourcesCache::clientWasAddedToTree(child, child->styleRef()); bool shouldIsolateDescendants = (child->isBlendingAllowed() && child->style()->hasBlendMode()) || child->hasNonIsolatedBlendingDescendants(); if (shouldIsolateDescendants) descendantIsolationRequirementsChanged(DescendantIsolationRequired); } ",0 "DevToolsWindow::FrontendWebContentsObserver::~FrontendWebContentsObserver() { } ",0 "static int srpt_init_nodeacl(struct se_node_acl *se_nacl, const char *name) { u8 i_port_id[16]; if (srpt_parse_i_port_id(i_port_id, name) < 0) { pr_err(""invalid initiator port ID %s\n"", name); return -EINVAL; } return 0; } ",0 "static int __split_huge_page_splitting(struct page *page, struct vm_area_struct *vma, unsigned long address) { struct mm_struct *mm = vma->vm_mm; pmd_t *pmd; int ret = 0; spin_lock(&mm->page_table_lock); pmd = page_check_address_pmd(page, mm, address, PAGE_CHECK_ADDRESS_PMD_NOTSPLITTING_FLAG); if (pmd) { /* * We can't temporarily set the pmd to null in order * to split it, the pmd must remain marked huge at all * times or the VM won't take the pmd_trans_huge paths * and it won't wait on the anon_vma->root->lock to * serialize against split_huge_page*. */ pmdp_splitting_flush_notify(vma, address, pmd); ret = 1; } spin_unlock(&mm->page_table_lock); return ret; } ",0 "int __init reboot_setup(char *str) { reboot_mode = str[0]; return 1; } ",0 "void PresentationConnectionProxy::OnMessage( PresentationConnectionMessage message, const OnMessageCallback& callback) { DCHECK(!callback.is_null()); if (message.is_binary()) { source_connection_->didReceiveBinaryMessage(&(message.data->front()), message.data->size()); } else { source_connection_->didReceiveTextMessage( blink::WebString::fromUTF8(*(message.message))); } callback.Run(true); } ",0 "char **lxc_normalize_path(const char *path) { char **components; char **p; size_t components_len = 0; size_t pos = 0; components = lxc_string_split(path, '/'); if (!components) return NULL; for (p = components; *p; p++) components_len++; /* resolve '.' and '..' */ for (pos = 0; pos < components_len; ) { if (!strcmp(components[pos], ""."") || (!strcmp(components[pos], "".."") && pos == 0)) { /* eat this element */ free(components[pos]); memmove(&components[pos], &components[pos+1], sizeof(char *) * (components_len - pos)); components_len--; } else if (!strcmp(components[pos], "".."")) { /* eat this and the previous element */ free(components[pos - 1]); free(components[pos]); memmove(&components[pos-1], &components[pos+1], sizeof(char *) * (components_len - pos)); components_len -= 2; pos--; } else { pos++; } } return components; } ",0 "void WebContentsImpl::OnUserGesture() { FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidGetUserGesture()); ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get(); if (rdh) // NULL in unittests. rdh->OnUserGesture(this); } ",0 " FetchDataLoaderAsWasmModule(ScriptState* script_state) : builder_(script_state->GetIsolate()), script_state_(script_state) {} ",0 "static void set_checkpoint_signal(void) { struct sigaction sa; memset(&sa, 0, sizeof(sa)); sa.sa_handler = checkpoint_signal; sigemptyset(&sa.sa_mask); sa.sa_flags = SA_RESTART; sigaction(SIGUSR1, &sa, NULL); } ",0 "static MagickBooleanType WriteMPCImage(const ImageInfo *image_info,Image *image) { char buffer[MaxTextExtent], cache_filename[MaxTextExtent]; const char *property, *value; MagickBooleanType status; MagickOffsetType offset, scene; register ssize_t i; size_t depth, one; /* Open persistent cache. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickSignature); assert(image != (Image *) NULL); assert(image->signature == MagickSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"",image->filename); status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception); if (status == MagickFalse) return(status); (void) CopyMagickString(cache_filename,image->filename,MaxTextExtent); AppendImageFormat(""cache"",cache_filename); scene=0; offset=0; one=1; do { /* Write persistent cache meta-information. */ depth=GetImageQuantumDepth(image,MagickTrue); if ((image->storage_class == PseudoClass) && (image->colors > (one << depth))) image->storage_class=DirectClass; (void) WriteBlobString(image,""id=MagickCache\n""); (void) FormatLocaleString(buffer,MaxTextExtent,""magick-signature=%u\n"", GetMagickSignature((const StringInfo *) NULL)); (void) WriteBlobString(image,buffer); (void) FormatLocaleString(buffer,MaxTextExtent, ""class=%s colors=%.20g matte=%s\n"",CommandOptionToMnemonic( MagickClassOptions,image->storage_class),(double) image->colors, CommandOptionToMnemonic(MagickBooleanOptions,(ssize_t) image->matte)); (void) WriteBlobString(image,buffer); (void) FormatLocaleString(buffer,MaxTextExtent, ""columns=%.20g rows=%.20g depth=%.20g\n"",(double) image->columns, (double) image->rows,(double) image->depth); (void) WriteBlobString(image,buffer); if (image->type != UndefinedType) { (void) FormatLocaleString(buffer,MaxTextExtent,""type=%s\n"", CommandOptionToMnemonic(MagickTypeOptions,image->type)); (void) WriteBlobString(image,buffer); } if (image->colorspace != UndefinedColorspace) { (void) FormatLocaleString(buffer,MaxTextExtent,""colorspace=%s\n"", CommandOptionToMnemonic(MagickColorspaceOptions,image->colorspace)); (void) WriteBlobString(image,buffer); } if (image->intensity != UndefinedPixelIntensityMethod) { (void) FormatLocaleString(buffer,MaxTextExtent,""pixel-intensity=%s\n"", CommandOptionToMnemonic(MagickPixelIntensityOptions, image->intensity)); (void) WriteBlobString(image,buffer); } if (image->endian != UndefinedEndian) { (void) FormatLocaleString(buffer,MaxTextExtent,""endian=%s\n"", CommandOptionToMnemonic(MagickEndianOptions,image->endian)); (void) WriteBlobString(image,buffer); } if (image->compression != UndefinedCompression) { (void) FormatLocaleString(buffer,MaxTextExtent, ""compression=%s quality=%.20g\n"",CommandOptionToMnemonic( MagickCompressOptions,image->compression),(double) image->quality); (void) WriteBlobString(image,buffer); } if (image->units != UndefinedResolution) { (void) FormatLocaleString(buffer,MaxTextExtent,""units=%s\n"", CommandOptionToMnemonic(MagickResolutionOptions,image->units)); (void) WriteBlobString(image,buffer); } if ((image->x_resolution != 0) || (image->y_resolution != 0)) { (void) FormatLocaleString(buffer,MaxTextExtent, ""resolution=%gx%g\n"",image->x_resolution,image->y_resolution); (void) WriteBlobString(image,buffer); } if ((image->page.width != 0) || (image->page.height != 0)) { (void) FormatLocaleString(buffer,MaxTextExtent, ""page=%.20gx%.20g%+.20g%+.20g\n"",(double) image->page.width,(double) image->page.height,(double) image->page.x,(double) image->page.y); (void) WriteBlobString(image,buffer); } else if ((image->page.x != 0) || (image->page.y != 0)) { (void) FormatLocaleString(buffer,MaxTextExtent,""page=%+ld%+ld\n"", (long) image->page.x,(long) image->page.y); (void) WriteBlobString(image,buffer); } if ((image->tile_offset.x != 0) || (image->tile_offset.y != 0)) { (void) FormatLocaleString(buffer,MaxTextExtent,""tile-offset=%+ld%+ld\n"", (long) image->tile_offset.x,(long) image->tile_offset.y); (void) WriteBlobString(image,buffer); } if ((GetNextImageInList(image) != (Image *) NULL) || (GetPreviousImageInList(image) != (Image *) NULL)) { if (image->scene == 0) (void) FormatLocaleString(buffer,MaxTextExtent, ""iterations=%.20g delay=%.20g ticks-per-second=%.20g\n"",(double) image->iterations,(double) image->delay,(double) image->ticks_per_second); else (void) FormatLocaleString(buffer,MaxTextExtent,""scene=%.20g "" ""iterations=%.20g delay=%.20g ticks-per-second=%.20g\n"", (double) image->scene,(double) image->iterations,(double) image->delay,(double) image->ticks_per_second); (void) WriteBlobString(image,buffer); } else { if (image->scene != 0) { (void) FormatLocaleString(buffer,MaxTextExtent,""scene=%.20g\n"", (double) image->scene); (void) WriteBlobString(image,buffer); } if (image->iterations != 0) { (void) FormatLocaleString(buffer,MaxTextExtent,""iterations=%.20g\n"", (double) image->iterations); (void) WriteBlobString(image,buffer); } if (image->delay != 0) { (void) FormatLocaleString(buffer,MaxTextExtent,""delay=%.20g\n"", (double) image->delay); (void) WriteBlobString(image,buffer); } if (image->ticks_per_second != UndefinedTicksPerSecond) { (void) FormatLocaleString(buffer,MaxTextExtent, ""ticks-per-second=%.20g\n"",(double) image->ticks_per_second); (void) WriteBlobString(image,buffer); } } if (image->gravity != UndefinedGravity) { (void) FormatLocaleString(buffer,MaxTextExtent,""gravity=%s\n"", CommandOptionToMnemonic(MagickGravityOptions,image->gravity)); (void) WriteBlobString(image,buffer); } if (image->dispose != UndefinedDispose) { (void) FormatLocaleString(buffer,MaxTextExtent,""dispose=%s\n"", CommandOptionToMnemonic(MagickDisposeOptions,image->dispose)); (void) WriteBlobString(image,buffer); } if (image->rendering_intent != UndefinedIntent) { (void) FormatLocaleString(buffer,MaxTextExtent, ""rendering-intent=%s\n"",CommandOptionToMnemonic(MagickIntentOptions, image->rendering_intent)); (void) WriteBlobString(image,buffer); } if (image->gamma != 0.0) { (void) FormatLocaleString(buffer,MaxTextExtent,""gamma=%g\n"", image->gamma); (void) WriteBlobString(image,buffer); } if (image->chromaticity.white_point.x != 0.0) { /* Note chomaticity points. */ (void) FormatLocaleString(buffer,MaxTextExtent,""red-primary="" ""%g,%g green-primary=%g,%g blue-primary=%g,%g\n"", image->chromaticity.red_primary.x,image->chromaticity.red_primary.y, image->chromaticity.green_primary.x, image->chromaticity.green_primary.y, image->chromaticity.blue_primary.x, image->chromaticity.blue_primary.y); (void) WriteBlobString(image,buffer); (void) FormatLocaleString(buffer,MaxTextExtent, ""white-point=%g,%g\n"",image->chromaticity.white_point.x, image->chromaticity.white_point.y); (void) WriteBlobString(image,buffer); } if (image->orientation != UndefinedOrientation) { (void) FormatLocaleString(buffer,MaxTextExtent, ""orientation=%s\n"",CommandOptionToMnemonic(MagickOrientationOptions, image->orientation)); (void) WriteBlobString(image,buffer); } if (image->profiles != (void *) NULL) { const char *name; const StringInfo *profile; /* Generic profile. */ ResetImageProfileIterator(image); for (name=GetNextImageProfile(image); name != (const char *) NULL; ) { profile=GetImageProfile(image,name); if (profile != (StringInfo *) NULL) { (void) FormatLocaleString(buffer,MaxTextExtent, ""profile:%s=%.20g\n"",name,(double) GetStringInfoLength(profile)); (void) WriteBlobString(image,buffer); } name=GetNextImageProfile(image); } } if (image->montage != (char *) NULL) { (void) FormatLocaleString(buffer,MaxTextExtent,""montage=%s\n"", image->montage); (void) WriteBlobString(image,buffer); } ResetImagePropertyIterator(image); property=GetNextImageProperty(image); while (property != (const char *) NULL) { (void) FormatLocaleString(buffer,MaxTextExtent,""%s="",property); (void) WriteBlobString(image,buffer); value=GetImageProperty(image,property); if (value != (const char *) NULL) { size_t length; length=strlen(value); for (i=0; i < (ssize_t) length; i++) if (isspace((int) ((unsigned char) value[i])) != 0) break; if ((i == (ssize_t) length) && (i != 0)) (void) WriteBlob(image,length,(const unsigned char *) value); else { (void) WriteBlobByte(image,'{'); if (strchr(value,'}') == (char *) NULL) (void) WriteBlob(image,length,(const unsigned char *) value); else for (i=0; i < (ssize_t) length; i++) { if (value[i] == (int) '}') (void) WriteBlobByte(image,'\\'); (void) WriteBlobByte(image,value[i]); } (void) WriteBlobByte(image,'}'); } } (void) WriteBlobByte(image,'\n'); property=GetNextImageProperty(image); } ",0 "static void dccp_v6_reqsk_destructor(struct request_sock *req) { dccp_feat_list_purge(&dccp_rsk(req)->dreq_featneg); kfree(inet_rsk(req)->ipv6_opt); kfree_skb(inet_rsk(req)->pktopts); } ",0 "gboolean BrowserFrameGtk::OnConfigureEvent(GtkWidget* widget, GdkEventConfigure* event) { browser_view_->WindowMoved(); return views::NativeWidgetGtk::OnConfigureEvent(widget, event); } ",0 "GF_Err stts_Read(GF_Box *s, GF_BitStream *bs) { u32 i; GF_TimeToSampleBox *ptr = (GF_TimeToSampleBox *)s; #ifndef GPAC_DISABLE_ISOM_WRITE ptr->w_LastDTS = 0; #endif ptr->nb_entries = gf_bs_read_u32(bs); ISOM_DECREASE_SIZE(ptr, 4); if (ptr->nb_entries > ptr->size / 8) { GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (""[iso file] Invalid number of entries %d in stts\n"", ptr->nb_entries)); return GF_ISOM_INVALID_FILE; } ptr->alloc_size = ptr->nb_entries; ptr->entries = gf_malloc(sizeof(GF_SttsEntry)*ptr->alloc_size); if (!ptr->entries) return GF_OUT_OF_MEM; for (i=0; inb_entries; i++) { ptr->entries[i].sampleCount = gf_bs_read_u32(bs); ptr->entries[i].sampleDelta = gf_bs_read_u32(bs); #ifndef GPAC_DISABLE_ISOM_WRITE ptr->w_currentSampleNum += ptr->entries[i].sampleCount; ptr->w_LastDTS += (u64)ptr->entries[i].sampleCount * ptr->entries[i].sampleDelta; #endif if (!ptr->entries[i].sampleDelta) { if ((i+1nb_entries) ) { GF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, (""[iso file] Found stts entry with sample_delta=0 - forbidden ! Fixing to 1\n"" )); ptr->entries[i].sampleDelta = 1; } else if (ptr->entries[i].sampleCount>1) { GF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, (""[iso file] more than one stts entry at the end of the track with sample_delta=0 - forbidden ! Fixing to 1\n"" )); ptr->entries[i].sampleDelta = 1; } } else if ((s32) ptr->entries[i].sampleDelta < 0) { GF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, (""[iso file] stts entry %d has negative duration %d - forbidden ! Fixing to 1, sync may get lost (consider reimport raw media)\n"", i, (s32) ptr->entries[i].sampleDelta )); ptr->entries[i].sampleDelta = 1; } } if (ptr->size<(ptr->nb_entries*8)) return GF_ISOM_INVALID_FILE; ISOM_DECREASE_SIZE(ptr, ptr->nb_entries*8); #ifndef GPAC_DISABLE_ISOM_WRITE if (ptr->nb_entries) ptr->w_LastDTS -= ptr->entries[ptr->nb_entries-1].sampleDelta; #endif return GF_OK; } ",0 "struct ldb_dn *ldb_dn_from_ldb_val(TALLOC_CTX *mem_ctx, struct ldb_context *ldb, const struct ldb_val *strdn) { struct ldb_dn *dn; if (! ldb) return NULL; if (strdn && strdn->data && (strnlen((const char*)strdn->data, strdn->length) != strdn->length)) { /* The RDN must not contain a character with value 0x0 */ return NULL; } dn = talloc_zero(mem_ctx, struct ldb_dn); LDB_DN_NULL_FAILED(dn); dn->ldb = talloc_get_type(ldb, struct ldb_context); if (dn->ldb == NULL) { /* the caller probably got the arguments to ldb_dn_new() mixed up */ talloc_free(dn); return NULL; } if (strdn->data && strdn->length) { const char *data = (const char *)strdn->data; size_t length = strdn->length; if (data[0] == '@') { dn->special = true; } dn->ext_linearized = talloc_strndup(dn, data, length); LDB_DN_NULL_FAILED(dn->ext_linearized); if (data[0] == '<') { const char *p_save, *p = dn->ext_linearized; do { p_save = p; p = strstr(p, "">;""); if (p) { p = p + 2; } } while (p); if (p_save == dn->ext_linearized) { dn->linearized = talloc_strdup(dn, """"); } else { dn->linearized = talloc_strdup(dn, p_save); } LDB_DN_NULL_FAILED(dn->linearized); } else { dn->linearized = dn->ext_linearized; dn->ext_linearized = NULL; } } else { dn->linearized = talloc_strdup(dn, """"); LDB_DN_NULL_FAILED(dn->linearized); } return dn; failed: talloc_free(dn); return NULL; } ",0 "const char* WebPage::interpretKeyEvent(const KeyboardEvent* evt) { ASSERT(evt->type() == eventNames().keydownEvent || evt->type() == eventNames().keypressEvent); static HashMap* keyDownCommandsMap = 0; static HashMap* keyPressCommandsMap = 0; if (!keyDownCommandsMap) { keyDownCommandsMap = new HashMap; keyPressCommandsMap = new HashMap; for (size_t i = 0; i < WTF_ARRAY_LENGTH(keyDownEntries); ++i) keyDownCommandsMap->set(keyDownEntries[i].modifiers << 16 | keyDownEntries[i].virtualKey, keyDownEntries[i].name); for (size_t i = 0; i < WTF_ARRAY_LENGTH(keyPressEntries); ++i) keyPressCommandsMap->set(keyPressEntries[i].modifiers << 16 | keyPressEntries[i].charCode, keyPressEntries[i].name); } unsigned modifiers = 0; if (evt->shiftKey()) modifiers |= ShiftKey; if (evt->altKey()) modifiers |= AltKey; if (evt->ctrlKey()) modifiers |= CtrlKey; if (evt->type() == eventNames().keydownEvent) { int mapKey = modifiers << 16 | evt->keyCode(); return mapKey ? keyDownCommandsMap->get(mapKey) : 0; } int mapKey = modifiers << 16 | evt->charCode(); return mapKey ? keyPressCommandsMap->get(mapKey) : 0; } ",0 "static void intel_clovertown_quirks(void) { /* * PEBS is unreliable due to: * * AJ67 - PEBS may experience CPL leaks * AJ68 - PEBS PMI may be delayed by one event * AJ69 - GLOBAL_STATUS[62] will only be set when DEBUGCTL[12] * AJ106 - FREEZE_LBRS_ON_PMI doesn't work in combination with PEBS * * AJ67 could be worked around by restricting the OS/USR flags. * AJ69 could be worked around by setting PMU_FREEZE_ON_PMI. * * AJ106 could possibly be worked around by not allowing LBR * usage from PEBS, including the fixup. * AJ68 could possibly be worked around by always programming * a pebs_event_reset[0] value and coping with the lost events. * * But taken together it might just make sense to not enable PEBS on * these chips. */ printk(KERN_WARNING ""PEBS disabled due to CPU errata.\n""); x86_pmu.pebs = 0; x86_pmu.pebs_constraints = NULL; } ",0 "static int oidc_check_max_session_duration(request_rec *r, oidc_cfg *cfg, oidc_session_t *session) { /* get the session expiry from the session data */ apr_time_t session_expires = oidc_session_get_session_expires(r, session); /* check the expire timestamp against the current time */ if (apr_time_now() > session_expires) { oidc_warn(r, ""maximum session duration exceeded for user: %s"", session->remote_user); oidc_session_kill(r, session); return oidc_handle_unauthenticated_user(r, cfg); } /* log message about max session duration */ oidc_log_session_expires(r, ""session max lifetime"", session_expires); return OK; } ",0 "void HeadlessDevToolsManagerDelegate::BeginFrame( content::DevToolsAgentHost* agent_host, int session_id, int command_id, const base::DictionaryValue* params, const CommandCallback& callback) { DCHECK(callback); content::WebContents* web_contents = agent_host->GetWebContents(); if (!web_contents) { callback.Run(CreateErrorResponse(command_id, kErrorServerError, ""Command not supported on this endpoint"")); return; } HeadlessWebContentsImpl* headless_contents = HeadlessWebContentsImpl::From(browser_.get(), web_contents); if (!headless_contents->begin_frame_control_enabled()) { callback.Run(CreateErrorResponse( command_id, kErrorServerError, ""Command is only supported if BeginFrameControl is enabled."")); return; } double frame_time_double = 0; double deadline_double = 0; double interval_double = 0; base::Time frame_time; base::TimeTicks frame_timeticks; base::TimeTicks deadline; base::TimeDelta interval; if (params->GetDouble(""frameTime"", &frame_time_double)) { frame_time = base::Time::FromDoubleT(frame_time_double); base::TimeDelta delta = frame_time - base::Time::UnixEpoch(); frame_timeticks = base::TimeTicks::UnixEpoch() + delta; } else { frame_timeticks = base::TimeTicks::Now(); } if (params->GetDouble(""interval"", &interval_double)) { if (interval_double <= 0) { callback.Run(CreateErrorResponse(command_id, kErrorInvalidParam, ""interval has to be greater than 0"")); return; } interval = base::TimeDelta::FromMillisecondsD(interval_double); } else { interval = viz::BeginFrameArgs::DefaultInterval(); } if (params->GetDouble(""deadline"", &deadline_double)) { base::TimeDelta delta = base::Time::FromDoubleT(deadline_double) - frame_time; if (delta <= base::TimeDelta()) { callback.Run(CreateErrorResponse(command_id, kErrorInvalidParam, ""deadline has to be after frameTime"")); return; } deadline = frame_timeticks + delta; } else { deadline = frame_timeticks + interval; } bool capture_screenshot = false; ImageEncoding encoding = ImageEncoding::kPng; int quality = kDefaultScreenshotQuality; const base::Value* value = nullptr; const base::DictionaryValue* screenshot_dict = nullptr; if (params->Get(""screenshot"", &value)) { if (!value->GetAsDictionary(&screenshot_dict)) { callback.Run(CreateInvalidParamResponse(command_id, ""screenshot"")); return; } capture_screenshot = true; std::string format; if (screenshot_dict->GetString(""format"", &format)) { if (format == kPng) { encoding = ImageEncoding::kPng; } else if (format == kJpeg) { encoding = ImageEncoding::kJpeg; } else { callback.Run( CreateInvalidParamResponse(command_id, ""screenshot.format"")); return; } } if (screenshot_dict->GetInteger(""quality"", &quality) && (quality < 0 || quality > 100)) { callback.Run( CreateErrorResponse(command_id, kErrorInvalidParam, ""screenshot.quality has to be in range 0..100"")); return; } } if (base::CommandLine::ForCurrentProcess()->HasSwitch( cc::switches::kRunAllCompositorStagesBeforeDraw) && headless_contents->HasPendingFrame()) { LOG(WARNING) << ""A BeginFrame is already in flight. In "" ""--run-all-compositor-stages-before-draw mode, only a "" ""single BeginFrame should be active at the same time.""; } headless_contents->BeginFrame(frame_timeticks, deadline, interval, capture_screenshot, base::Bind(&OnBeginFrameFinished, command_id, callback, encoding, quality)); } ",0 "static void php_cgi_ini_activate_user_config(char *path, int path_len, const char *doc_root, int doc_root_len, int start TSRMLS_DC) { char *ptr; user_config_cache_entry *new_entry, *entry; time_t request_time = sapi_get_request_time(TSRMLS_C); /* Find cached config entry: If not found, create one */ if (zend_hash_find(&CGIG(user_config_cache), path, path_len + 1, (void **) &entry) == FAILURE) { new_entry = pemalloc(sizeof(user_config_cache_entry), 1); new_entry->expires = 0; new_entry->user_config = (HashTable *) pemalloc(sizeof(HashTable), 1); zend_hash_init(new_entry->user_config, 0, NULL, (dtor_func_t) config_zval_dtor, 1); zend_hash_update(&CGIG(user_config_cache), path, path_len + 1, new_entry, sizeof(user_config_cache_entry), (void **) &entry); free(new_entry); } /* Check whether cache entry has expired and rescan if it is */ if (request_time > entry->expires) { char *real_path = NULL; int real_path_len; char *s1, *s2; int s_len; /* Clear the expired config */ zend_hash_clean(entry->user_config); if (!IS_ABSOLUTE_PATH(path, path_len)) { real_path = tsrm_realpath(path, NULL TSRMLS_CC); if (real_path == NULL) { return; } real_path_len = strlen(real_path); path = real_path; path_len = real_path_len; } if (path_len > doc_root_len) { s1 = (char *) doc_root; s2 = path; s_len = doc_root_len; } else { s1 = path; s2 = (char *) doc_root; s_len = path_len; } /* we have to test if path is part of DOCUMENT_ROOT. if it is inside the docroot, we scan the tree up to the docroot to find more user.ini, if not we only scan the current path. */ #ifdef PHP_WIN32 if (strnicmp(s1, s2, s_len) == 0) { #else if (strncmp(s1, s2, s_len) == 0) { #endif ptr = s2 + start; /* start is the point where doc_root ends! */ while ((ptr = strchr(ptr, DEFAULT_SLASH)) != NULL) { *ptr = 0; php_parse_user_ini_file(path, PG(user_ini_filename), entry->user_config TSRMLS_CC); *ptr = '/'; ptr++; } } else { php_parse_user_ini_file(path, PG(user_ini_filename), entry->user_config TSRMLS_CC); } if (real_path) { free(real_path); } entry->expires = request_time + PG(user_ini_cache_ttl); } /* Activate ini entries with values from the user config hash */ php_ini_activate_config(entry->user_config, PHP_INI_PERDIR, PHP_INI_STAGE_HTACCESS TSRMLS_CC); } /* }}} */ static int sapi_cgi_activate(TSRMLS_D) { char *path, *doc_root, *server_name; uint path_len, doc_root_len, server_name_len; /* PATH_TRANSLATED should be defined at this stage but better safe than sorry :) */ if (!SG(request_info).path_translated) { ",0 "MdSettingsUI::~MdSettingsUI() { } ",0 "bool RemoveDllFromBlacklist(const wchar_t* dll_name) { int blacklist_size = BlacklistSize(); for (int i = 0; i < blacklist_size; ++i) { if (!_wcsicmp(g_troublesome_dlls[i], dll_name)) { delete[] g_troublesome_dlls[i]; g_troublesome_dlls[i] = g_troublesome_dlls[blacklist_size - 1]; g_troublesome_dlls[blacklist_size - 1] = NULL; if (g_blocked_dlls[i]) --g_num_blocked_dlls; g_blocked_dlls[i] = g_blocked_dlls[blacklist_size - 1]; return true; } } return false; } ",0 "void SyncManager::SyncInternal::ReEncryptEverything(WriteTransaction* trans) { Cryptographer* cryptographer = trans->GetCryptographer(); if (!cryptographer || !cryptographer->is_ready()) return; syncable::ModelTypeSet encrypted_types = GetEncryptedTypes(trans); ModelSafeRoutingInfo routes; registrar_->GetModelSafeRoutingInfo(&routes); std::string tag; for (syncable::ModelTypeSet::iterator iter = encrypted_types.begin(); iter != encrypted_types.end(); ++iter) { if (*iter == syncable::PASSWORDS || *iter == syncable::NIGORI || routes.count(*iter) == 0) continue; ReadNode type_root(trans); tag = syncable::ModelTypeToRootTag(*iter); if (!type_root.InitByTagLookup(tag)) { NOTREACHED(); return; } std::queue to_visit; int64 child_id = type_root.GetFirstChildId(); to_visit.push(child_id); while (!to_visit.empty()) { child_id = to_visit.front(); to_visit.pop(); if (child_id == kInvalidId) continue; WriteNode child(trans); if (!child.InitByIdLookup(child_id)) { NOTREACHED(); continue; } if (child.GetIsFolder()) { to_visit.push(child.GetFirstChildId()); } if (child.GetEntry()->Get(syncable::UNIQUE_SERVER_TAG).empty()) { child.ResetFromSpecifics(); } to_visit.push(child.GetSuccessorId()); } } if (routes.count(syncable::PASSWORDS) > 0) { ReadNode passwords_root(trans); std::string passwords_tag = syncable::ModelTypeToRootTag(syncable::PASSWORDS); if (passwords_root.InitByTagLookup(passwords_tag)) { int64 child_id = passwords_root.GetFirstChildId(); while (child_id != kInvalidId) { WriteNode child(trans); if (!child.InitByIdLookup(child_id)) { NOTREACHED(); return; } child.SetPasswordSpecifics(child.GetPasswordSpecifics()); child_id = child.GetSuccessorId(); } } } ObserverList temp_obs_list; CopyObservers(&temp_obs_list); FOR_EACH_OBSERVER(SyncManager::Observer, temp_obs_list, OnEncryptionComplete(encrypted_types)); } ",0 "void svcauth_gss_set_log_miscerr_func( auth_gssapi_log_miscerr_func func, caddr_t data) { log_miscerr = func; log_miscerr_data = data; } ",0 "NO_INLINE JsVar *jspeArrowFunction(JsVar *funcVar, JsVar *a) { assert(!a || jsvIsName(a)); JSP_ASSERT_MATCH(LEX_ARROW_FUNCTION); funcVar = jspeAddNamedFunctionParameter(funcVar, a); bool expressionOnly = lex->tk!='{'; jspeFunctionDefinitionInternal(funcVar, expressionOnly); if (execInfo.thisVar) { jsvObjectSetChild(funcVar, JSPARSE_FUNCTION_THIS_NAME, execInfo.thisVar); } return funcVar; } NO_INLINE JsVar *jspeExpressionOrArrowFunction() { JsVar *a = 0; JsVar *funcVar = 0; bool allNames = true; while (lex->tk!=')' && !JSP_SHOULDNT_PARSE) { if (allNames && a) { funcVar = jspeAddNamedFunctionParameter(funcVar, a); } jsvUnLock(a); a = jspeAssignmentExpression(); if (!(jsvIsName(a) && jsvIsString(a))) allNames = false; if (lex->tk!=')') JSP_MATCH_WITH_CLEANUP_AND_RETURN(',', jsvUnLock2(a,funcVar), 0); } JSP_MATCH_WITH_CLEANUP_AND_RETURN(')', jsvUnLock2(a,funcVar), 0); if (allNames && lex->tk==LEX_ARROW_FUNCTION) { funcVar = jspeArrowFunction(funcVar, a); jsvUnLock(a); return funcVar; } else { jsvUnLock(funcVar); return a; } } NO_INLINE JsVar *jspeClassDefinition(bool parseNamedClass) { JsVar *classFunction = 0; JsVar *classPrototype = 0; JsVar *classInternalName = 0; bool actuallyCreateClass = JSP_SHOULD_EXECUTE; if (actuallyCreateClass) classFunction = jsvNewWithFlags(JSV_FUNCTION); if (parseNamedClass && lex->tk==LEX_ID) { if (classFunction) classInternalName = jslGetTokenValueAsVar(lex); JSP_ASSERT_MATCH(LEX_ID); } if (classFunction) { JsVar *prototypeName = jsvFindChildFromString(classFunction, JSPARSE_PROTOTYPE_VAR, true); jspEnsureIsPrototype(classFunction, prototypeName); // make sure it's an object classPrototype = jsvSkipName(prototypeName); jsvUnLock(prototypeName); } if (lex->tk==LEX_R_EXTENDS) { JSP_ASSERT_MATCH(LEX_R_EXTENDS); JsVar *extendsFrom = actuallyCreateClass ? jsvSkipNameAndUnLock(jspGetNamedVariable(jslGetTokenValueAsString(lex))) : 0; JSP_MATCH_WITH_CLEANUP_AND_RETURN(LEX_ID,jsvUnLock4(extendsFrom,classFunction,classInternalName,classPrototype),0); if (classPrototype) { if (jsvIsFunction(extendsFrom)) { jsvObjectSetChild(classPrototype, JSPARSE_INHERITS_VAR, extendsFrom); jsvObjectSetChildAndUnLock(classFunction, JSPARSE_FUNCTION_CODE_NAME, jsvNewFromString(""if(this.__proto__.__proto__)this.__proto__.__proto__.apply(this,arguments)"")); } else jsExceptionHere(JSET_SYNTAXERROR, ""'extends' argument should be a function, got %t"", extendsFrom); } jsvUnLock(extendsFrom); } JSP_MATCH_WITH_CLEANUP_AND_RETURN('{',jsvUnLock3(classFunction,classInternalName,classPrototype),0); while ((lex->tk==LEX_ID || lex->tk==LEX_R_STATIC) && !jspIsInterrupted()) { bool isStatic = lex->tk==LEX_R_STATIC; if (isStatic) JSP_ASSERT_MATCH(LEX_R_STATIC); JsVar *funcName = jslGetTokenValueAsVar(lex); JSP_MATCH_WITH_CLEANUP_AND_RETURN(LEX_ID,jsvUnLock3(classFunction,classInternalName,classPrototype),0); JsVar *method = jspeFunctionDefinition(false); if (classFunction && classPrototype) { if (jsvIsStringEqual(funcName, ""get"") || jsvIsStringEqual(funcName, ""set"")) { jsExceptionHere(JSET_SYNTAXERROR, ""'get' and 'set' and not supported in Espruino""); } else if (jsvIsStringEqual(funcName, ""constructor"")) { jswrap_function_replaceWith(classFunction, method); } else { funcName = jsvMakeIntoVariableName(funcName, 0); jsvSetValueOfName(funcName, method); jsvAddName(isStatic ? classFunction : classPrototype, funcName); } } jsvUnLock2(method,funcName); } jsvUnLock(classPrototype); if (classInternalName) jsvObjectSetChildAndUnLock(classFunction, JSPARSE_FUNCTION_NAME_NAME, classInternalName); JSP_MATCH_WITH_CLEANUP_AND_RETURN('}',jsvUnLock(classFunction),0); return classFunction; } #endif NO_INLINE JsVar *jspeFactor() { if (lex->tk==LEX_ID) { JsVar *a = jspGetNamedVariable(jslGetTokenValueAsString(lex)); JSP_ASSERT_MATCH(LEX_ID); #ifndef SAVE_ON_FLASH if (lex->tk==LEX_TEMPLATE_LITERAL) jsExceptionHere(JSET_SYNTAXERROR, ""Tagged template literals not supported""); else if (lex->tk==LEX_ARROW_FUNCTION && jsvIsName(a)) { JsVar *funcVar = jspeArrowFunction(0,a); jsvUnLock(a); a=funcVar; } #endif return a; } else if (lex->tk==LEX_INT) { JsVar *v = 0; if (JSP_SHOULD_EXECUTE) { v = jsvNewFromLongInteger(stringToInt(jslGetTokenValueAsString(lex))); } JSP_ASSERT_MATCH(LEX_INT); return v; } else if (lex->tk==LEX_FLOAT) { JsVar *v = 0; if (JSP_SHOULD_EXECUTE) { v = jsvNewFromFloat(stringToFloat(jslGetTokenValueAsString(lex))); } JSP_ASSERT_MATCH(LEX_FLOAT); return v; } else if (lex->tk=='(') { JSP_ASSERT_MATCH('('); if (!jspCheckStackPosition()) return 0; #ifdef SAVE_ON_FLASH JsVar *a = jspeExpression(); if (!JSP_SHOULDNT_PARSE) JSP_MATCH_WITH_RETURN(')',a); return a; #else return jspeExpressionOrArrowFunction(); #endif } else if (lex->tk==LEX_R_TRUE) { JSP_ASSERT_MATCH(LEX_R_TRUE); return JSP_SHOULD_EXECUTE ? jsvNewFromBool(true) : 0; } else if (lex->tk==LEX_R_FALSE) { JSP_ASSERT_MATCH(LEX_R_FALSE); return JSP_SHOULD_EXECUTE ? jsvNewFromBool(false) : 0; } else if (lex->tk==LEX_R_NULL) { JSP_ASSERT_MATCH(LEX_R_NULL); return JSP_SHOULD_EXECUTE ? jsvNewWithFlags(JSV_NULL) : 0; } else if (lex->tk==LEX_R_UNDEFINED) { JSP_ASSERT_MATCH(LEX_R_UNDEFINED); return 0; } else if (lex->tk==LEX_STR) { JsVar *a = 0; if (JSP_SHOULD_EXECUTE) a = jslGetTokenValueAsVar(lex); JSP_ASSERT_MATCH(LEX_STR); return a; #ifndef SAVE_ON_FLASH } else if (lex->tk==LEX_TEMPLATE_LITERAL) { return jspeTemplateLiteral(); #endif } else if (lex->tk==LEX_REGEX) { JsVar *a = 0; #ifdef SAVE_ON_FLASH jsExceptionHere(JSET_SYNTAXERROR, ""RegEx are not supported in this version of Espruino\n""); #else JsVar *regex = jslGetTokenValueAsVar(lex); size_t regexEnd = 0, regexLen = 0; JsvStringIterator it; jsvStringIteratorNew(&it, regex, 0); while (jsvStringIteratorHasChar(&it)) { regexLen++; if (jsvStringIteratorGetChar(&it)=='/') regexEnd = regexLen; jsvStringIteratorNext(&it); } jsvStringIteratorFree(&it); JsVar *flags = 0; if (regexEnd < regexLen) flags = jsvNewFromStringVar(regex, regexEnd, JSVAPPENDSTRINGVAR_MAXLENGTH); JsVar *regexSource = jsvNewFromStringVar(regex, 1, regexEnd-2); a = jswrap_regexp_constructor(regexSource, flags); jsvUnLock3(regex, flags, regexSource); #endif JSP_ASSERT_MATCH(LEX_REGEX); return a; } else if (lex->tk=='{') { if (!jspCheckStackPosition()) return 0; return jspeFactorObject(); } else if (lex->tk=='[') { if (!jspCheckStackPosition()) return 0; return jspeFactorArray(); } else if (lex->tk==LEX_R_FUNCTION) { if (!jspCheckStackPosition()) return 0; JSP_ASSERT_MATCH(LEX_R_FUNCTION); return jspeFunctionDefinition(true); #ifndef SAVE_ON_FLASH } else if (lex->tk==LEX_R_CLASS) { if (!jspCheckStackPosition()) return 0; JSP_ASSERT_MATCH(LEX_R_CLASS); return jspeClassDefinition(true); } else if (lex->tk==LEX_R_SUPER) { JSP_ASSERT_MATCH(LEX_R_SUPER); /* This is kind of nasty, since super appears to do three different things. * In the constructor it references the extended class's constructor * in a method it references the constructor's prototype. * in a static method it references the extended class's constructor (but this is different) */ if (jsvIsObject(execInfo.thisVar)) { JsVar *proto1 = jsvObjectGetChild(execInfo.thisVar, JSPARSE_INHERITS_VAR, 0); // if we're in a method, get __proto__ first JsVar *proto2 = jsvIsObject(proto1) ? jsvObjectGetChild(proto1, JSPARSE_INHERITS_VAR, 0) : 0; // still in method, get __proto__.__proto__ jsvUnLock(proto1); if (!proto2) { jsExceptionHere(JSET_SYNTAXERROR, ""Calling 'super' outside of class""); return 0; } if (lex->tk=='(') return proto2; // eg. used in a constructor JsVar *proto3 = jsvIsFunction(proto2) ? jsvObjectGetChild(proto2, JSPARSE_PROTOTYPE_VAR, 0) : 0; jsvUnLock(proto2); return proto3; } else if (jsvIsFunction(execInfo.thisVar)) { JsVar *proto1 = jsvObjectGetChild(execInfo.thisVar, JSPARSE_PROTOTYPE_VAR, 0); JsVar *proto2 = jsvIsObject(proto1) ? jsvObjectGetChild(proto1, JSPARSE_INHERITS_VAR, 0) : 0; jsvUnLock(proto1); if (!proto2) { jsExceptionHere(JSET_SYNTAXERROR, ""Calling 'super' outside of class""); return 0; } return proto2; } jsExceptionHere(JSET_SYNTAXERROR, ""Calling 'super' outside of class""); return 0; #endif } else if (lex->tk==LEX_R_THIS) { JSP_ASSERT_MATCH(LEX_R_THIS); return jsvLockAgain( execInfo.thisVar ? execInfo.thisVar : execInfo.root ); } else if (lex->tk==LEX_R_DELETE) { if (!jspCheckStackPosition()) return 0; return jspeFactorDelete(); } else if (lex->tk==LEX_R_TYPEOF) { if (!jspCheckStackPosition()) return 0; return jspeFactorTypeOf(); } else if (lex->tk==LEX_R_VOID) { if (!jspCheckStackPosition()) return 0; JSP_ASSERT_MATCH(LEX_R_VOID); jsvUnLock(jspeUnaryExpression()); return 0; } JSP_MATCH(LEX_EOF); jsExceptionHere(JSET_SYNTAXERROR, ""Unexpected end of Input\n""); return 0; } NO_INLINE JsVar *__jspePostfixExpression(JsVar *a) { while (lex->tk==LEX_PLUSPLUS || lex->tk==LEX_MINUSMINUS) { int op = lex->tk; JSP_ASSERT_MATCH(op); if (JSP_SHOULD_EXECUTE) { JsVar *one = jsvNewFromInteger(1); JsVar *oldValue = jsvAsNumberAndUnLock(jsvSkipName(a)); // keep the old value (but convert to number) JsVar *res = jsvMathsOpSkipNames(oldValue, one, op==LEX_PLUSPLUS ? '+' : '-'); jsvUnLock(one); jspReplaceWith(a, res); jsvUnLock(res); jsvUnLock(a); a = oldValue; } } return a; } NO_INLINE JsVar *jspePostfixExpression() { JsVar *a; if (lex->tk==LEX_PLUSPLUS || lex->tk==LEX_MINUSMINUS) { int op = lex->tk; JSP_ASSERT_MATCH(op); a = jspePostfixExpression(); if (JSP_SHOULD_EXECUTE) { JsVar *one = jsvNewFromInteger(1); JsVar *res = jsvMathsOpSkipNames(a, one, op==LEX_PLUSPLUS ? '+' : '-'); jsvUnLock(one); jspReplaceWith(a, res); jsvUnLock(res); } } else a = jspeFactorFunctionCall(); return __jspePostfixExpression(a); } NO_INLINE JsVar *jspeUnaryExpression() { if (lex->tk=='!' || lex->tk=='~' || lex->tk=='-' || lex->tk=='+') { short tk = lex->tk; JSP_ASSERT_MATCH(tk); if (!JSP_SHOULD_EXECUTE) { return jspeUnaryExpression(); } if (tk=='!') { // logical not return jsvNewFromBool(!jsvGetBoolAndUnLock(jsvSkipNameAndUnLock(jspeUnaryExpression()))); } else if (tk=='~') { // bitwise not return jsvNewFromInteger(~jsvGetIntegerAndUnLock(jsvSkipNameAndUnLock(jspeUnaryExpression()))); } else if (tk=='-') { // unary minus return jsvNegateAndUnLock(jspeUnaryExpression()); // names already skipped } else if (tk=='+') { // unary plus (convert to number) JsVar *v = jsvSkipNameAndUnLock(jspeUnaryExpression()); JsVar *r = jsvAsNumber(v); // names already skipped jsvUnLock(v); return r; } assert(0); return 0; } else return jspePostfixExpression(); } unsigned int jspeGetBinaryExpressionPrecedence(int op) { switch (op) { case LEX_OROR: return 1; break; case LEX_ANDAND: return 2; break; case '|' : return 3; break; case '^' : return 4; break; case '&' : return 5; break; case LEX_EQUAL: case LEX_NEQUAL: case LEX_TYPEEQUAL: case LEX_NTYPEEQUAL: return 6; case LEX_LEQUAL: case LEX_GEQUAL: case '<': case '>': case LEX_R_INSTANCEOF: return 7; case LEX_R_IN: return (execInfo.execute&EXEC_FOR_INIT)?0:7; case LEX_LSHIFT: case LEX_RSHIFT: case LEX_RSHIFTUNSIGNED: return 8; case '+': case '-': return 9; case '*': case '/': case '%': return 10; default: return 0; } } NO_INLINE JsVar *__jspeBinaryExpression(JsVar *a, unsigned int lastPrecedence) { /* This one's a bit strange. Basically all the ops have their own precedence, it's not * like & and | share the same precedence. We don't want to recurse for each one, * so instead we do this. * * We deal with an expression in recursion ONLY if it's of higher precedence * than the current one, otherwise we stick in the while loop. */ unsigned int precedence = jspeGetBinaryExpressionPrecedence(lex->tk); while (precedence && precedence>lastPrecedence) { int op = lex->tk; JSP_ASSERT_MATCH(op); if (op==LEX_ANDAND || op==LEX_OROR) { bool aValue = jsvGetBoolAndUnLock(jsvSkipName(a)); if ((!aValue && op==LEX_ANDAND) || (aValue && op==LEX_OROR)) { JSP_SAVE_EXECUTE(); jspSetNoExecute(); jsvUnLock(__jspeBinaryExpression(jspeUnaryExpression(),precedence)); JSP_RESTORE_EXECUTE(); } else { jsvUnLock(a); a = __jspeBinaryExpression(jspeUnaryExpression(),precedence); } } else { // else it's a more 'normal' logical expression - just use Maths JsVar *b = __jspeBinaryExpression(jspeUnaryExpression(),precedence); if (JSP_SHOULD_EXECUTE) { if (op==LEX_R_IN) { JsVar *av = jsvSkipName(a); // needle JsVar *bv = jsvSkipName(b); // haystack if (jsvIsArray(bv) || jsvIsObject(bv)) { // search keys, NOT values av = jsvAsArrayIndexAndUnLock(av); JsVar *varFound = jspGetVarNamedField( bv, av, true); jsvUnLock(a); a = jsvNewFromBool(varFound!=0); jsvUnLock(varFound); } else {// else it will be undefined jsExceptionHere(JSET_ERROR, ""Cannot use 'in' operator to search a %t"", bv); jsvUnLock(a); a = 0; } jsvUnLock2(av, bv); } else if (op==LEX_R_INSTANCEOF) { bool inst = false; JsVar *av = jsvSkipName(a); JsVar *bv = jsvSkipName(b); if (!jsvIsFunction(bv)) { jsExceptionHere(JSET_ERROR, ""Expecting a function on RHS in instanceof check, got %t"", bv); } else { if (jsvIsObject(av) || jsvIsFunction(av)) { JsVar *bproto = jspGetNamedField(bv, JSPARSE_PROTOTYPE_VAR, false); JsVar *proto = jsvObjectGetChild(av, JSPARSE_INHERITS_VAR, 0); while (proto) { if (proto == bproto) inst=true; JsVar *childProto = jsvObjectGetChild(proto, JSPARSE_INHERITS_VAR, 0); jsvUnLock(proto); proto = childProto; } if (jspIsConstructor(bv, ""Object"")) inst = true; jsvUnLock(bproto); } if (!inst) { const char *name = jswGetBasicObjectName(av); if (name) { inst = jspIsConstructor(bv, name); } if (!inst && (jsvIsArray(av) || jsvIsArrayBuffer(av)) && jspIsConstructor(bv, ""Object"")) inst = true; } } jsvUnLock3(av, bv, a); a = jsvNewFromBool(inst); } else { // --------------------------------------------- NORMAL JsVar *res = jsvMathsOpSkipNames(a, b, op); jsvUnLock(a); a = res; } } jsvUnLock(b); } precedence = jspeGetBinaryExpressionPrecedence(lex->tk); } return a; } JsVar *jspeBinaryExpression() { return __jspeBinaryExpression(jspeUnaryExpression(),0); } NO_INLINE JsVar *__jspeConditionalExpression(JsVar *lhs) { if (lex->tk=='?') { JSP_ASSERT_MATCH('?'); if (!JSP_SHOULD_EXECUTE) { jsvUnLock(jspeAssignmentExpression()); JSP_MATCH(':'); jsvUnLock(jspeAssignmentExpression()); } else { bool first = jsvGetBoolAndUnLock(jsvSkipName(lhs)); jsvUnLock(lhs); if (first) { lhs = jspeAssignmentExpression(); JSP_MATCH(':'); JSP_SAVE_EXECUTE(); jspSetNoExecute(); jsvUnLock(jspeAssignmentExpression()); JSP_RESTORE_EXECUTE(); } else { JSP_SAVE_EXECUTE(); jspSetNoExecute(); jsvUnLock(jspeAssignmentExpression()); JSP_RESTORE_EXECUTE(); JSP_MATCH(':'); lhs = jspeAssignmentExpression(); } } } return lhs; } JsVar *jspeConditionalExpression() { return __jspeConditionalExpression(jspeBinaryExpression()); } NO_INLINE JsVar *__jspeAssignmentExpression(JsVar *lhs) { if (lex->tk=='=' || lex->tk==LEX_PLUSEQUAL || lex->tk==LEX_MINUSEQUAL || lex->tk==LEX_MULEQUAL || lex->tk==LEX_DIVEQUAL || lex->tk==LEX_MODEQUAL || lex->tk==LEX_ANDEQUAL || lex->tk==LEX_OREQUAL || lex->tk==LEX_XOREQUAL || lex->tk==LEX_RSHIFTEQUAL || lex->tk==LEX_LSHIFTEQUAL || lex->tk==LEX_RSHIFTUNSIGNEDEQUAL) { JsVar *rhs; int op = lex->tk; JSP_ASSERT_MATCH(op); rhs = jspeAssignmentExpression(); rhs = jsvSkipNameAndUnLock(rhs); // ensure we get rid of any references on the RHS if (JSP_SHOULD_EXECUTE && lhs) { if (op=='=') { /* If we're assigning to this and we don't have a parent, * add it to the symbol table root */ if (!jsvGetRefs(lhs) && jsvIsName(lhs)) { if (!jsvIsArrayBufferName(lhs) && !jsvIsNewChild(lhs)) jsvAddName(execInfo.root, lhs); } jspReplaceWith(lhs, rhs); } else { if (op==LEX_PLUSEQUAL) op='+'; else if (op==LEX_MINUSEQUAL) op='-'; else if (op==LEX_MULEQUAL) op='*'; else if (op==LEX_DIVEQUAL) op='/'; else if (op==LEX_MODEQUAL) op='%'; else if (op==LEX_ANDEQUAL) op='&'; else if (op==LEX_OREQUAL) op='|'; else if (op==LEX_XOREQUAL) op='^'; else if (op==LEX_RSHIFTEQUAL) op=LEX_RSHIFT; else if (op==LEX_LSHIFTEQUAL) op=LEX_LSHIFT; else if (op==LEX_RSHIFTUNSIGNEDEQUAL) op=LEX_RSHIFTUNSIGNED; if (op=='+' && jsvIsName(lhs)) { JsVar *currentValue = jsvSkipName(lhs); if (jsvIsString(currentValue) && !jsvIsFlatString(currentValue) && jsvGetRefs(currentValue)==1 && rhs!=currentValue) { /* A special case for string += where this is the only use of the string * and we're not appending to ourselves. In this case we can do a * simple append (rather than clone + append)*/ JsVar *str = jsvAsString(rhs, false); jsvAppendStringVarComplete(currentValue, str); jsvUnLock(str); op = 0; } jsvUnLock(currentValue); } if (op) { /* Fallback which does a proper add */ JsVar *res = jsvMathsOpSkipNames(lhs,rhs,op); jspReplaceWith(lhs, res); jsvUnLock(res); } } } jsvUnLock(rhs); } return lhs; } JsVar *jspeAssignmentExpression() { return __jspeAssignmentExpression(jspeConditionalExpression()); } NO_INLINE JsVar *jspeExpression() { while (!JSP_SHOULDNT_PARSE) { JsVar *a = jspeAssignmentExpression(); if (lex->tk!=',') return a; jsvCheckReferenceError(a); jsvUnLock(a); JSP_ASSERT_MATCH(','); } return 0; } /** Parse a block `{ ... }` but assume brackets are already parsed */ NO_INLINE void jspeBlockNoBrackets() { if (JSP_SHOULD_EXECUTE) { while (lex->tk && lex->tk!='}') { JsVar *a = jspeStatement(); jsvCheckReferenceError(a); jsvUnLock(a); if (JSP_HAS_ERROR) { if (lex && !(execInfo.execute&EXEC_ERROR_LINE_REPORTED)) { execInfo.execute = (JsExecFlags)(execInfo.execute | EXEC_ERROR_LINE_REPORTED); JsVar *stackTrace = jsvObjectGetChild(execInfo.hiddenRoot, JSPARSE_STACKTRACE_VAR, JSV_STRING_0); if (stackTrace) { jsvAppendPrintf(stackTrace, ""at ""); jspAppendStackTrace(stackTrace); jsvUnLock(stackTrace); } } } if (JSP_SHOULDNT_PARSE) return; } } else { int brackets = 0; while (lex->tk && (brackets || lex->tk != '}')) { if (lex->tk == '{') brackets++; if (lex->tk == '}') brackets--; JSP_ASSERT_MATCH(lex->tk); } } return; } ",1 "void WebFrameLoaderClient::windowObjectCleared() { if (webframe_->client()) webframe_->client()->didClearWindowObject(webframe_); WebViewImpl* webview = webframe_->GetWebViewImpl(); if (webview) { WebDevToolsAgentImpl* tools_agent = webview->GetWebDevToolsAgentImpl(); if (tools_agent) tools_agent->WindowObjectCleared(webframe_); } } ",0 "void RTCPeerConnectionHandler::OnRemoveReceiverPlanB(uintptr_t receiver_id) { DCHECK(task_runner_->RunsTasksInCurrentSequence()); TRACE_EVENT0(""webrtc"", ""RTCPeerConnectionHandler::OnRemoveReceiverPlanB""); auto it = FindReceiver(receiver_id); DCHECK(it != rtp_receivers_.end()); auto receiver = std::make_unique(*(*it)); track_metrics_.RemoveTrack(MediaStreamTrackMetrics::Direction::kReceive, MediaStreamTrackMetricsKind(receiver->Track()), receiver->Track().Id().Utf8()); if (peer_connection_tracker_) { auto receiver_only_transceiver = std::make_unique( std::make_unique(*receiver)); size_t receiver_index = GetTransceiverIndex(*receiver_only_transceiver); peer_connection_tracker_->TrackRemoveTransceiver( this, PeerConnectionTracker::TransceiverUpdatedReason::kSetRemoteDescription, *receiver_only_transceiver.get(), receiver_index); } rtp_receivers_.erase(it); for (const auto& stream_id : receiver->state().stream_ids()) { if (!IsRemoteStream(rtp_receivers_, stream_id)) PerSessionWebRTCAPIMetrics::GetInstance()->IncrementStreamCounter(); } if (!is_closed_) client_->DidRemoveReceiverPlanB(std::move(receiver)); } ",0 "void DatabaseImpl::OpenCursor( int64_t transaction_id, int64_t object_store_id, int64_t index_id, const IndexedDBKeyRange& key_range, blink::WebIDBCursorDirection direction, bool key_only, blink::WebIDBTaskType task_type, ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info) { scoped_refptr callbacks( new IndexedDBCallbacks(dispatcher_host_->AsWeakPtr(), origin_, std::move(callbacks_info), idb_runner_)); idb_runner_->PostTask( FROM_HERE, base::Bind(&IDBThreadHelper::OpenCursor, base::Unretained(helper_), transaction_id, object_store_id, index_id, key_range, direction, key_only, task_type, base::Passed(&callbacks))); } ",0 " static int l2cap_build_conf_req(struct sock *sk, void *data) { struct l2cap_pinfo *pi = l2cap_pi(sk); struct l2cap_conf_req *req = data; struct l2cap_conf_rfc rfc = { .mode = L2CAP_MODE_BASIC }; void *ptr = req->data; BT_DBG(""sk %p"", sk); switch (pi->mode) { case L2CAP_MODE_BASIC: if (pi->imtu != L2CAP_DEFAULT_MTU) l2cap_add_conf_opt(&ptr, L2CAP_CONF_MTU, 2, pi->imtu); break; case L2CAP_MODE_ERTM: rfc.mode = L2CAP_MODE_ERTM; rfc.txwin_size = L2CAP_DEFAULT_RX_WINDOW; rfc.max_transmit = L2CAP_DEFAULT_MAX_RECEIVE; rfc.retrans_timeout = cpu_to_le16(L2CAP_DEFAULT_RETRANS_TO); rfc.monitor_timeout = cpu_to_le16(L2CAP_DEFAULT_MONITOR_TO); rfc.max_pdu_size = cpu_to_le16(L2CAP_DEFAULT_MAX_RX_APDU); l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC, sizeof(rfc), (unsigned long) &rfc); break; } /* FIXME: Need actual value of the flush timeout */ req->dcid = cpu_to_le16(pi->dcid); req->flags = cpu_to_le16(0); return ptr - data; } ",1 "reset_order_state(void) { memset(&g_order_state, 0, sizeof(g_order_state)); g_order_state.order_type = RDP_ORDER_PATBLT; } ",0 " virtual void Trace(blink::Visitor* visitor) { visitor->Trace(obj_); } ",0 "static jboolean android_net_wifi_setSsidWhitelist( JNIEnv *env, jclass cls, jint iface, jint id, jobject list) { JNIHelper helper(env); wifi_interface_handle handle = getIfaceHandle(helper, cls, iface); ALOGD(""configure SSID white list request [%d] = %p"", id, handle); wifi_ssid *ssids = NULL; int num_ssids = 0; if (list != NULL) { size_t len = helper.getArrayLength((jobjectArray)list); if (len > 0) { ssids = (wifi_ssid *)malloc(len * sizeof (wifi_ssid)); if (!ssids) return false; memset(ssids, 0, len * sizeof (wifi_ssid)); for (unsigned int i = 0; i < len; i++) { JNIObject jssid = helper.getObjectArrayElement(list, i); if (jssid == NULL) { ALOGD(""configure SSID whitelist: could not get element %d"", i); free(ssids); return false; } ScopedUtfChars chars(env, (jstring)jssid.get()); const char *utf = chars.c_str(); if (utf == NULL) { ALOGE(""Error getting sssid""); free(ssids); return false; } int slen = strnlen(utf, 33); if (slen <= 0 || slen > 32) { ALOGE(""Error wrong ssid length %d"", slen); free(ssids); return false; } memcpy(ssids[i].ssid, utf, slen); num_ssids++; ALOGD(""SSID white list: added ssid %s"", utf); } } } ALOGD(""android_net_wifi_setSsidWhitelist Added %d sssids"", num_ssids); return hal_fn.wifi_set_ssid_white_list(id, handle, num_ssids, ssids) == WIFI_SUCCESS; } ",0 "void platform_device_put(struct platform_device *pdev) { if (pdev) put_device(&pdev->dev); } ",0 "void Textfield::UpdateAfterChange(bool text_changed, bool cursor_changed) { if (text_changed) { if (controller_) controller_->ContentsChanged(this, text()); NotifyAccessibilityEvent(ax::mojom::Event::kValueChanged, true); } if (cursor_changed) { UpdateCursorViewPosition(); UpdateCursorVisibility(); } if (text_changed || cursor_changed) { OnCaretBoundsChanged(); SchedulePaint(); } } ",0 "status_t BufferQueueConsumer::connect( const sp& consumerListener, bool controlledByApp) { ATRACE_CALL(); if (consumerListener == NULL) { BQ_LOGE(""connect(C): consumerListener may not be NULL""); return BAD_VALUE; } BQ_LOGV(""connect(C): controlledByApp=%s"", controlledByApp ? ""true"" : ""false""); Mutex::Autolock lock(mCore->mMutex); if (mCore->mIsAbandoned) { BQ_LOGE(""connect(C): BufferQueue has been abandoned""); return NO_INIT; } mCore->mConsumerListener = consumerListener; mCore->mConsumerControlledByApp = controlledByApp; return NO_ERROR; } ",0 "void Layer::SetLayerTreeHost(LayerTreeHost* host) { if (layer_tree_host_ == host) return; layer_tree_host_ = host; SetNeedsPushProperties(); for (size_t i = 0; i < children_.size(); ++i) children_[i]->SetLayerTreeHost(host); if (mask_layer_.get()) mask_layer_->SetLayerTreeHost(host); if (replica_layer_.get()) replica_layer_->SetLayerTreeHost(host); if (host) { layer_animation_controller_->SetAnimationRegistrar( host->animation_registrar()); if (host->settings().layer_transforms_should_scale_layer_contents) reset_raster_scale_to_unknown(); } if (host && layer_animation_controller_->has_any_animation()) host->SetNeedsCommit(); SetNeedsFilterContextIfNeeded(); } ",0 "void Chapters::Display::Init() { m_string = NULL; m_language = NULL; m_country = NULL; } ",1 "__xml_log_element(int log_level, const char *file, const char *function, int line, const char *prefix, xmlNode * data, int depth, int options) { int max = 0; int offset = 0; const char *name = NULL; const char *hidden = NULL; xmlNode *child = NULL; xmlAttrPtr pIter = NULL; if(data == NULL) { return; } name = crm_element_name(data); if(is_set(options, xml_log_option_open)) { char *buffer = NULL; insert_prefix(options, &buffer, &offset, &max, depth); if(data->type == XML_COMMENT_NODE) { buffer_print(buffer, max, offset, """"); } else { buffer_print(buffer, max, offset, ""<%s"", name); } hidden = crm_element_value(data, ""hidden""); for (pIter = crm_first_attr(data); pIter != NULL; pIter = pIter->next) { xml_private_t *p = pIter->_private; const char *p_name = (const char *)pIter->name; const char *p_value = crm_attr_value(pIter); char *p_copy = NULL; if(is_set(p->flags, xpf_deleted)) { continue; } else if ((is_set(options, xml_log_option_diff_plus) || is_set(options, xml_log_option_diff_minus)) && strcmp(XML_DIFF_MARKER, p_name) == 0) { continue; } else if (hidden != NULL && p_name[0] != 0 && strstr(hidden, p_name) != NULL) { p_copy = strdup(""*****""); } else { p_copy = crm_xml_escape(p_value); } buffer_print(buffer, max, offset, "" %s=\""%s\"""", p_name, p_copy); free(p_copy); } if(xml_has_children(data) == FALSE) { buffer_print(buffer, max, offset, ""/>""); } else if(is_set(options, xml_log_option_children)) { buffer_print(buffer, max, offset, "">""); } else { buffer_print(buffer, max, offset, ""/>""); } do_crm_log_alias(log_level, file, function, line, ""%s %s"", prefix, buffer); free(buffer); } if(data->type == XML_COMMENT_NODE) { return; } else if(xml_has_children(data) == FALSE) { return; } else if(is_set(options, xml_log_option_children)) { offset = 0; max = 0; for (child = __xml_first_child(data); child != NULL; child = __xml_next(child)) { __xml_log_element(log_level, file, function, line, prefix, child, depth + 1, options|xml_log_option_open|xml_log_option_close); } } if(is_set(options, xml_log_option_close)) { char *buffer = NULL; insert_prefix(options, &buffer, &offset, &max, depth); buffer_print(buffer, max, offset, """", name); do_crm_log_alias(log_level, file, function, line, ""%s %s"", prefix, buffer); free(buffer); } } ",0 "static int check_helper_call(struct bpf_verifier_env *env, int func_id, int insn_idx) { const struct bpf_func_proto *fn = NULL; struct bpf_reg_state *regs; struct bpf_call_arg_meta meta; bool changes_data; int i, err; /* find function prototype */ if (func_id < 0 || func_id >= __BPF_FUNC_MAX_ID) { verbose(env, ""invalid func %s#%d\n"", func_id_name(func_id), func_id); return -EINVAL; } if (env->ops->get_func_proto) fn = env->ops->get_func_proto(func_id, env->prog); if (!fn) { verbose(env, ""unknown func %s#%d\n"", func_id_name(func_id), func_id); return -EINVAL; } /* eBPF programs must be GPL compatible to use GPL-ed functions */ if (!env->prog->gpl_compatible && fn->gpl_only) { verbose(env, ""cannot call GPL-restricted function from non-GPL compatible program\n""); return -EINVAL; } /* With LD_ABS/IND some JITs save/restore skb from r1. */ changes_data = bpf_helper_changes_pkt_data(fn->func); if (changes_data && fn->arg1_type != ARG_PTR_TO_CTX) { verbose(env, ""kernel subsystem misconfigured func %s#%d: r1 != ctx\n"", func_id_name(func_id), func_id); return -EINVAL; } memset(&meta, 0, sizeof(meta)); meta.pkt_access = fn->pkt_access; err = check_func_proto(fn); if (err) { verbose(env, ""kernel subsystem misconfigured func %s#%d\n"", func_id_name(func_id), func_id); return err; } /* check args */ err = check_func_arg(env, BPF_REG_1, fn->arg1_type, &meta); if (err) return err; err = check_func_arg(env, BPF_REG_2, fn->arg2_type, &meta); if (err) return err; err = check_func_arg(env, BPF_REG_3, fn->arg3_type, &meta); if (err) return err; err = check_func_arg(env, BPF_REG_4, fn->arg4_type, &meta); if (err) return err; err = check_func_arg(env, BPF_REG_5, fn->arg5_type, &meta); if (err) return err; err = record_func_map(env, &meta, func_id, insn_idx); if (err) return err; /* Mark slots with STACK_MISC in case of raw mode, stack offset * is inferred from register state. */ for (i = 0; i < meta.access_size; i++) { err = check_mem_access(env, insn_idx, meta.regno, i, BPF_B, BPF_WRITE, -1, false); if (err) return err; } if (func_id == BPF_FUNC_tail_call) { err = check_reference_leak(env); if (err) { verbose(env, ""tail_call would lead to reference leak\n""); return err; } } else if (is_release_function(func_id)) { err = release_reference(env, &meta); if (err) return err; } regs = cur_regs(env); /* check that flags argument in get_local_storage(map, flags) is 0, * this is required because get_local_storage() can't return an error. */ if (func_id == BPF_FUNC_get_local_storage && !register_is_null(®s[BPF_REG_2])) { verbose(env, ""get_local_storage() doesn't support non-zero flags\n""); return -EINVAL; } /* reset caller saved regs */ for (i = 0; i < CALLER_SAVED_REGS; i++) { mark_reg_not_init(env, regs, caller_saved[i]); check_reg_arg(env, caller_saved[i], DST_OP_NO_MARK); } /* update return register (already marked as written above) */ if (fn->ret_type == RET_INTEGER) { /* sets type to SCALAR_VALUE */ mark_reg_unknown(env, regs, BPF_REG_0); } else if (fn->ret_type == RET_VOID) { regs[BPF_REG_0].type = NOT_INIT; } else if (fn->ret_type == RET_PTR_TO_MAP_VALUE_OR_NULL || fn->ret_type == RET_PTR_TO_MAP_VALUE) { /* There is no offset yet applied, variable or fixed */ mark_reg_known_zero(env, regs, BPF_REG_0); /* remember map_ptr, so that check_map_access() * can check 'value_size' boundary of memory access * to map element returned from bpf_map_lookup_elem() */ if (meta.map_ptr == NULL) { verbose(env, ""kernel subsystem misconfigured verifier\n""); return -EINVAL; } regs[BPF_REG_0].map_ptr = meta.map_ptr; if (fn->ret_type == RET_PTR_TO_MAP_VALUE) { regs[BPF_REG_0].type = PTR_TO_MAP_VALUE; } else { regs[BPF_REG_0].type = PTR_TO_MAP_VALUE_OR_NULL; regs[BPF_REG_0].id = ++env->id_gen; } } else if (fn->ret_type == RET_PTR_TO_SOCKET_OR_NULL) { int id = acquire_reference_state(env, insn_idx); if (id < 0) return id; mark_reg_known_zero(env, regs, BPF_REG_0); regs[BPF_REG_0].type = PTR_TO_SOCKET_OR_NULL; regs[BPF_REG_0].id = id; } else { verbose(env, ""unknown return type %d of func %s#%d\n"", fn->ret_type, func_id_name(func_id), func_id); return -EINVAL; } do_refine_retval_range(regs, fn->ret_type, func_id, &meta); err = check_map_func_compatibility(env, meta.map_ptr, func_id); if (err) return err; if (func_id == BPF_FUNC_get_stack && !env->prog->has_callchain_buf) { const char *err_str; #ifdef CONFIG_PERF_EVENTS err = get_callchain_buffers(sysctl_perf_event_max_stack); err_str = ""cannot get callchain buffer for func %s#%d\n""; #else err = -ENOTSUPP; err_str = ""func %s#%d not supported without CONFIG_PERF_EVENTS\n""; #endif if (err) { verbose(env, err_str, func_id_name(func_id), func_id); return err; } env->prog->has_callchain_buf = true; } if (changes_data) clear_all_pkt_pointers(env); return 0; } ",0 "DictionaryValue* TypedUrlSpecificsToValue( const sync_pb::TypedUrlSpecifics& proto) { DictionaryValue* value = new DictionaryValue(); SET_STR(url); SET_STR(title); SET_BOOL(hidden); SET_INT64_REP(visits); SET_INT32_REP(visit_transitions); return value; } ",0 "GF_Err fecr_dump(GF_Box *a, FILE * trace) { u32 i; char *box_name; FECReservoirBox *ptr = (FECReservoirBox *) a; if (a->type==GF_ISOM_BOX_TYPE_FIRE) { box_name = ""FILEReservoirBox""; } else { box_name = ""FECReservoirBox""; } gf_isom_box_dump_start(a, box_name, trace); fprintf(trace, "">\n""); for (i=0; inb_entries; i++) { fprintf(trace, ""<%sEntry itemID=\""%d\"" symbol_count=\""%d\""/>\n"", box_name, ptr->entries[i].item_id, ptr->entries[i].symbol_count); } if (!ptr->size) { fprintf(trace, ""<%sEntry itemID=\""\"" symbol_count=\""\""/>\n"", box_name); } gf_isom_box_dump_done(box_name, a, trace); return GF_OK; } ",0 "archive_read_support_format_zip_streamable(struct archive *_a) { struct archive_read *a = (struct archive_read *)_a; struct zip *zip; int r; archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_NEW, ""archive_read_support_format_zip""); zip = (struct zip *)calloc(1, sizeof(*zip)); if (zip == NULL) { archive_set_error(&a->archive, ENOMEM, ""Can't allocate zip data""); return (ARCHIVE_FATAL); } /* Streamable reader doesn't support mac extensions. */ zip->process_mac_extensions = 0; /* * Until enough data has been read, we cannot tell about * any encrypted entries yet. */ zip->has_encrypted_entries = ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW; zip->crc32func = real_crc32; r = __archive_read_register_format(a, zip, ""zip"", archive_read_format_zip_streamable_bid, archive_read_format_zip_options, archive_read_format_zip_streamable_read_header, archive_read_format_zip_read_data, archive_read_format_zip_read_data_skip_streamable, NULL, archive_read_format_zip_cleanup, archive_read_support_format_zip_capabilities_streamable, archive_read_format_zip_has_encrypted_entries); if (r != ARCHIVE_OK) free(zip); return (ARCHIVE_OK); } ",0 "static int __init qeth_core_init(void) { int rc; pr_info(""loading core functions\n""); INIT_LIST_HEAD(&qeth_core_card_list.list); INIT_LIST_HEAD(&qeth_dbf_list); rwlock_init(&qeth_core_card_list.rwlock); mutex_init(&qeth_mod_mutex); qeth_wq = create_singlethread_workqueue(""qeth_wq""); rc = qeth_register_dbf_views(); if (rc) goto out_err; qeth_core_root_dev = root_device_register(""qeth""); rc = PTR_RET(qeth_core_root_dev); if (rc) goto register_err; qeth_core_header_cache = kmem_cache_create(""qeth_hdr"", sizeof(struct qeth_hdr) + ETH_HLEN, 64, 0, NULL); if (!qeth_core_header_cache) { rc = -ENOMEM; goto slab_err; } qeth_qdio_outbuf_cache = kmem_cache_create(""qeth_buf"", sizeof(struct qeth_qdio_out_buffer), 0, 0, NULL); if (!qeth_qdio_outbuf_cache) { rc = -ENOMEM; goto cqslab_err; } rc = ccw_driver_register(&qeth_ccw_driver); if (rc) goto ccw_err; qeth_core_ccwgroup_driver.driver.groups = qeth_drv_attr_groups; rc = ccwgroup_driver_register(&qeth_core_ccwgroup_driver); if (rc) goto ccwgroup_err; return 0; ccwgroup_err: ccw_driver_unregister(&qeth_ccw_driver); ccw_err: kmem_cache_destroy(qeth_qdio_outbuf_cache); cqslab_err: kmem_cache_destroy(qeth_core_header_cache); slab_err: root_device_unregister(qeth_core_root_dev); register_err: qeth_unregister_dbf_views(); out_err: pr_err(""Initializing the qeth device driver failed\n""); return rc; } ",0 "QUrl WebContext::cachePath() const { base::FilePath path; if (IsInitialized()) { path = context_->GetCachePath(); } else { path = construct_props_->cache_path; } if (path.empty()) { return QUrl(); } return QUrl::fromLocalFile(QString::fromStdString(path.value())); } ",0 "bool Player::maybeStartAnimationOnCompositor() { ASSERT(!hasStartTime()); if (!m_content || !m_content->isAnimation()) return false; return toAnimation(m_content.get())->maybeStartAnimationOnCompositor(); } ",0 " Context(base::Time begin_time, BrowserContext* browser_context) : event_(new base::WaitableEvent(true, false)), begin_time_(begin_time), is_removing_(false), browser_context_path_(browser_context->GetPath()), resource_context_(browser_context->GetResourceContext()) { DCHECK_CURRENTLY_ON(BrowserThread::UI); } ",0 "PHP_FUNCTION(dom_document_rename_node) { DOM_NOT_IMPLEMENTED(); } ",0 "static unsigned d_flags_for_inode(struct inode *inode) { unsigned add_flags = DCACHE_REGULAR_TYPE; if (!inode) return DCACHE_MISS_TYPE; if (S_ISDIR(inode->i_mode)) { add_flags = DCACHE_DIRECTORY_TYPE; if (unlikely(!(inode->i_opflags & IOP_LOOKUP))) { if (unlikely(!inode->i_op->lookup)) add_flags = DCACHE_AUTODIR_TYPE; else inode->i_opflags |= IOP_LOOKUP; } goto type_determined; } if (unlikely(!(inode->i_opflags & IOP_NOFOLLOW))) { if (unlikely(inode->i_op->get_link)) { add_flags = DCACHE_SYMLINK_TYPE; goto type_determined; } inode->i_opflags |= IOP_NOFOLLOW; } if (unlikely(!S_ISREG(inode->i_mode))) add_flags = DCACHE_SPECIAL_TYPE; type_determined: if (unlikely(IS_AUTOMOUNT(inode))) add_flags |= DCACHE_NEED_AUTOMOUNT; return add_flags; } ",0 "write_file(cupsd_client_t *con, /* I - Client connection */ http_status_t code, /* I - HTTP status */ char *filename, /* I - Filename */ char *type, /* I - File type */ struct stat *filestats) /* O - File information */ { con->file = open(filename, O_RDONLY); cupsdLogClient(con, CUPSD_LOG_DEBUG2, ""write_file: code=%d, filename=\""%s\"" (%d), type=\""%s\"", filestats=%p."", code, filename, con->file, type ? type : ""(null)"", filestats); if (con->file < 0) return (0); fcntl(con->file, F_SETFD, fcntl(con->file, F_GETFD) | FD_CLOEXEC); con->pipe_pid = 0; con->sent_header = 1; httpClearFields(con->http); httpSetLength(con->http, (size_t)filestats->st_size); httpSetField(con->http, HTTP_FIELD_LAST_MODIFIED, httpGetDateString(filestats->st_mtime)); if (!cupsdSendHeader(con, code, type, CUPSD_AUTH_NONE)) return (0); cupsdAddSelect(httpGetFd(con->http), NULL, (cupsd_selfunc_t)cupsdWriteClient, con); cupsdLogClient(con, CUPSD_LOG_DEBUG, ""Sending file.""); return (1); } ",0 "InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated( const gfx::Point& viewport_point, const gfx::Vector2dF& scroll_delta, base::TimeDelta delayed_by) { InputHandler::ScrollStatus scroll_status; scroll_status.main_thread_scrolling_reasons = MainThreadScrollingReason::kNotScrollingOnMain; ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree; ScrollNode* scroll_node = scroll_tree.CurrentlyScrollingNode(); if (scroll_node) { gfx::Vector2dF delta = scroll_delta; if (!scroll_node->user_scrollable_horizontal) delta.set_x(0); if (!scroll_node->user_scrollable_vertical) delta.set_y(0); if (ScrollAnimationUpdateTarget(scroll_node, delta, delayed_by)) { scroll_status.thread = SCROLL_ON_IMPL_THREAD; } else { scroll_status.thread = SCROLL_IGNORED; scroll_status.main_thread_scrolling_reasons = MainThreadScrollingReason::kNotScrollable; } return scroll_status; } ScrollStateData scroll_state_data; scroll_state_data.position_x = viewport_point.x(); scroll_state_data.position_y = viewport_point.y(); ScrollState scroll_state(scroll_state_data); scroll_status = ScrollBegin(&scroll_state, WHEEL); scroll_node = scroll_tree.CurrentlyScrollingNode(); if (scroll_status.thread == SCROLL_ON_IMPL_THREAD && scroll_node) { gfx::Vector2dF pending_delta = scroll_delta; for (; scroll_tree.parent(scroll_node); scroll_node = scroll_tree.parent(scroll_node)) { if (!scroll_node->scrollable) continue; bool scrolls_main_viewport_scroll_layer = viewport()->MainScrollLayer() && viewport()->MainScrollLayer()->scroll_tree_index() == scroll_node->id; if (scrolls_main_viewport_scroll_layer) { gfx::Vector2dF scrolled = viewport()->ScrollAnimated(pending_delta, delayed_by); if (scrolled == pending_delta) return scroll_status; break; } gfx::Vector2dF scroll_delta = ComputeScrollDelta(scroll_node, pending_delta); if (ScrollAnimationCreate(scroll_node, scroll_delta, delayed_by)) return scroll_status; pending_delta -= scroll_delta; } } scroll_state.set_is_ending(true); ScrollEnd(&scroll_state); return scroll_status; } ",0 "HTMLMediaElement* TextTrack::MediaElement() const { return track_list_ ? track_list_->Owner() : nullptr; } ",0 "bool tty_is_console(const char *tty) { assert(tty); return streq(skip_dev_prefix(tty), ""console""); } ",0 " virtual ~CallbackHelper() {} ",0 "static int get_slot_from_bitmask(int mask, int (*check)(struct module *, int), struct module *module) { int slot; for (slot = 0; slot < SNDRV_CARDS; slot++) { if (slot < 32 && !(mask & (1U << slot))) continue; if (!test_bit(slot, snd_cards_lock)) { if (check(module, slot)) return slot; /* found */ } } return mask; /* unchanged */ } ",0 "sf_flac_meta_get_vorbiscomments (SF_PRIVATE *psf, const FLAC__StreamMetadata *metadata) { static FLAC_TAG tags [] = { { ""title"", SF_STR_TITLE }, { ""copyright"", SF_STR_COPYRIGHT }, { ""software"", SF_STR_SOFTWARE }, { ""artist"", SF_STR_ARTIST }, { ""comment"", SF_STR_COMMENT }, { ""date"", SF_STR_DATE }, { ""album"", SF_STR_ALBUM }, { ""license"", SF_STR_LICENSE }, { ""tracknumber"", SF_STR_TRACKNUMBER }, { ""genre"", SF_STR_GENRE } } ; const char *value, *cptr ; int k, tag_num ; for (k = 0 ; k < ARRAY_LEN (tags) ; k++) { tag_num = FLAC__metadata_object_vorbiscomment_find_entry_from (metadata, 0, tags [k].tag) ; if (tag_num < 0) continue ; value = (const char*) metadata->data.vorbis_comment.comments [tag_num].entry ; if ((cptr = strchr (value, '=')) != NULL) value = cptr + 1 ; psf_log_printf (psf, "" %-12s : %s\n"", tags [k].tag, value) ; psf_store_string (psf, tags [k].type, value) ; } ; return ; } /* sf_flac_meta_get_vorbiscomments */ ",0 "hook_get_priority_and_name (const char *name, int *priority, const char **ptr_name) { char *pos, *str_priority, *error; long number; if (priority) *priority = HOOK_PRIORITY_DEFAULT; if (ptr_name) *ptr_name = name; pos = strchr (name, '|'); if (pos) { str_priority = string_strndup (name, pos - name); if (str_priority) { error = NULL; number = strtol (str_priority, &error, 10); if (error && !error[0]) { if (priority) *priority = number; if (ptr_name) *ptr_name = pos + 1; } free (str_priority); } } } ",0 "WebCString WebPageSerializer::serializeToMHTMLUsingBinaryEncoding(WebView* view) { RefPtr mhtml = serializePageToMHTML(toWebViewImpl(view)->page(), MHTMLArchive::UseBinaryEncoding); return WebCString(mhtml->data(), mhtml->size()); } ",0 " void FlushHighlighterControllerMojo() { framework_service_->GetHighlighterClientForTesting()->FlushMojoForTesting(); } ",0 "void CastStreamingNativeHandler::CallReceiverErrorCallback( v8::CopyablePersistentTraits::CopyablePersistent function, const std::string& error_message) { v8::Isolate* isolate = context()->v8_context()->GetIsolate(); v8::Local arg = v8::String::NewFromUtf8(isolate, error_message.data(), v8::String::kNormalString, error_message.size()); context()->CallFunction( v8::Local::New(isolate, function), 1, &arg); } ",0 "int equalizer_set_parameter(effect_context_t *context, effect_param_t *p, uint32_t size __unused) { equalizer_context_t *eq_ctxt = (equalizer_context_t *)context; int voffset = ((p->psize - 1) / sizeof(int32_t) + 1) * sizeof(int32_t); void *value = p->data + voffset; int32_t *param_tmp = (int32_t *)p->data; int32_t param = *param_tmp++; int32_t preset; int32_t band; int32_t level; int i; ALOGV(""%s"", __func__); p->status = 0; switch (param) { case EQ_PARAM_CUR_PRESET: ALOGV(""EQ_PARAM_CUR_PRESET""); preset = (int32_t)(*(uint16_t *)value); if ((preset >= equalizer_get_num_presets(eq_ctxt)) || (preset < 0)) { p->status = -EINVAL; break; } equalizer_set_preset(eq_ctxt, preset); break; case EQ_PARAM_BAND_LEVEL: ALOGV(""EQ_PARAM_BAND_LEVEL""); band = *param_tmp; level = (int32_t)(*(int16_t *)value); if (band >= NUM_EQ_BANDS) { p->status = -EINVAL; break; } equalizer_set_band_level(eq_ctxt, band, level); break; case EQ_PARAM_PROPERTIES: { ALOGV(""EQ_PARAM_PROPERTIES""); int16_t *prop = (int16_t *)value; if ((int)prop[0] >= equalizer_get_num_presets(eq_ctxt)) { p->status = -EINVAL; break; } if (prop[0] >= 0) { equalizer_set_preset(eq_ctxt, (int)prop[0]); } else { if ((int)prop[1] != NUM_EQ_BANDS) { p->status = -EINVAL; break; } for (i = 0; i < NUM_EQ_BANDS; i++) { equalizer_set_band_level(eq_ctxt, i, (int)prop[2 + i]); } } } break; default: p->status = -EINVAL; break; } return 0; } ",0 "static size_t ZSTD_initCDict_internal( ZSTD_CDict* cdict, const void* dictBuffer, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType, ZSTD_compressionParameters cParams) { DEBUGLOG(3, ""ZSTD_initCDict_internal (dictContentType:%u)"", (U32)dictContentType); assert(!ZSTD_checkCParams(cParams)); cdict->matchState.cParams = cParams; if ((dictLoadMethod == ZSTD_dlm_byRef) || (!dictBuffer) || (!dictSize)) { cdict->dictBuffer = NULL; cdict->dictContent = dictBuffer; } else { void* const internalBuffer = ZSTD_malloc(dictSize, cdict->customMem); cdict->dictBuffer = internalBuffer; cdict->dictContent = internalBuffer; if (!internalBuffer) return ERROR(memory_allocation); memcpy(internalBuffer, dictBuffer, dictSize); } cdict->dictContentSize = dictSize; /* Reset the state to no dictionary */ ZSTD_reset_compressedBlockState(&cdict->cBlockState); { void* const end = ZSTD_reset_matchState( &cdict->matchState, (U32*)cdict->workspace + HUF_WORKSPACE_SIZE_U32, &cParams, ZSTDcrp_continue, /* forCCtx */ 0); assert(end == (char*)cdict->workspace + cdict->workspaceSize); (void)end; } /* (Maybe) load the dictionary * Skips loading the dictionary if it is <= 8 bytes. */ { ZSTD_CCtx_params params; memset(¶ms, 0, sizeof(params)); params.compressionLevel = ZSTD_CLEVEL_DEFAULT; params.fParams.contentSizeFlag = 1; params.cParams = cParams; { size_t const dictID = ZSTD_compress_insertDictionary( &cdict->cBlockState, &cdict->matchState, ¶ms, cdict->dictContent, cdict->dictContentSize, dictContentType, ZSTD_dtlm_full, cdict->workspace); if (ZSTD_isError(dictID)) return dictID; assert(dictID <= (size_t)(U32)-1); cdict->dictID = (U32)dictID; } } return 0; } ",0 "poly_path(PG_FUNCTION_ARGS) { POLYGON *poly = PG_GETARG_POLYGON_P(0); PATH *path; int size; int i; size = offsetof(PATH, p[0]) +sizeof(path->p[0]) * poly->npts; path = (PATH *) palloc(size); SET_VARSIZE(path, size); path->npts = poly->npts; path->closed = TRUE; /* prevent instability in unused pad bytes */ path->dummy = 0; for (i = 0; i < poly->npts; i++) { path->p[i].x = poly->p[i].x; path->p[i].y = poly->p[i].y; } PG_RETURN_PATH_P(path); } ",1 "static bool MatchMagicNumber(const char* content, size_t size, const MagicNumber& magic_entry, std::string* result) { const size_t len = magic_entry.magic_len; DCHECK_LE(len, kBytesRequiredForMagic); const char* end = static_cast(memchr(content, '\0', size)); const size_t content_strlen = (end != NULL) ? static_cast(end - content) : size; bool match = false; if (magic_entry.is_string) { if (content_strlen >= len) { DCHECK_EQ(strlen(magic_entry.magic), len); match = base::EqualsCaseInsensitiveASCII(magic_entry.magic, base::StringPiece(content, len)); } } else { if (size >= len) { if (!magic_entry.mask) { match = MagicCmp(magic_entry.magic, content, len); } else { match = MagicMaskCmp(magic_entry.magic, content, len, magic_entry.mask); } } } if (match) { result->assign(magic_entry.mime_type); return true; } return false; } ",0 "SVGElementSet* SVGElement::SetOfIncomingReferences() const { if (!HasSVGRareData()) return nullptr; return &SvgRareData()->IncomingReferences(); } ",0 " void fe_netjoin_deinit(void) { while (joinservers != NULL) netjoin_server_remove(joinservers->data); if (join_tag != -1) { g_source_remove(join_tag); signal_remove(""print starting"", (SIGNAL_FUNC) sig_print_starting); } signal_remove(""setup changed"", (SIGNAL_FUNC) read_settings); signal_remove(""message quit"", (SIGNAL_FUNC) msg_quit); signal_remove(""message join"", (SIGNAL_FUNC) msg_join); signal_remove(""message irc mode"", (SIGNAL_FUNC) msg_mode); } ",1 "PHP_FUNCTION(locale_filter_matches) { char* lang_tag = NULL; int lang_tag_len = 0; const char* loc_range = NULL; int loc_range_len = 0; int result = 0; char* token = 0; char* chrcheck = NULL; char* can_lang_tag = NULL; char* can_loc_range = NULL; char* cur_lang_tag = NULL; char* cur_loc_range = NULL; zend_bool boolCanonical = 0; UErrorCode status = U_ZERO_ERROR; intl_error_reset( NULL TSRMLS_CC ); if(zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, ""ss|b"", &lang_tag, &lang_tag_len , &loc_range , &loc_range_len , &boolCanonical) == FAILURE) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, ""locale_filter_matches: unable to parse input params"", 0 TSRMLS_CC ); RETURN_FALSE; } if(loc_range_len == 0) { loc_range = intl_locale_get_default(TSRMLS_C); } if( strcmp(loc_range,""*"")==0){ RETURN_TRUE; } if( boolCanonical ){ /* canonicalize loc_range */ can_loc_range=get_icu_value_internal( loc_range , LOC_CANONICALIZE_TAG , &result , 0); if( result ==0) { intl_error_set( NULL, status, ""locale_filter_matches : unable to canonicalize loc_range"" , 0 TSRMLS_CC ); RETURN_FALSE; } /* canonicalize lang_tag */ can_lang_tag = get_icu_value_internal( lang_tag , LOC_CANONICALIZE_TAG , &result , 0); if( result ==0) { intl_error_set( NULL, status, ""locale_filter_matches : unable to canonicalize lang_tag"" , 0 TSRMLS_CC ); RETURN_FALSE; } /* Convert to lower case for case-insensitive comparison */ cur_lang_tag = ecalloc( 1, strlen(can_lang_tag) + 1); /* Convert to lower case for case-insensitive comparison */ result = strToMatch( can_lang_tag , cur_lang_tag); if( result == 0) { efree( cur_lang_tag ); efree( can_lang_tag ); RETURN_FALSE; } cur_loc_range = ecalloc( 1, strlen(can_loc_range) + 1); result = strToMatch( can_loc_range , cur_loc_range ); if( result == 0) { efree( cur_lang_tag ); efree( can_lang_tag ); efree( cur_loc_range ); efree( can_loc_range ); RETURN_FALSE; } /* check if prefix */ token = strstr( cur_lang_tag , cur_loc_range ); if( token && (token==cur_lang_tag) ){ /* check if the char. after match is SEPARATOR */ chrcheck = token + (strlen(cur_loc_range)); if( isIDSeparator(*chrcheck) || isEndOfTag(*chrcheck) ){ if( cur_lang_tag){ efree( cur_lang_tag ); } if( cur_loc_range){ efree( cur_loc_range ); } if( can_lang_tag){ efree( can_lang_tag ); } if( can_loc_range){ efree( can_loc_range ); } RETURN_TRUE; } } /* No prefix as loc_range */ if( cur_lang_tag){ efree( cur_lang_tag ); } if( cur_loc_range){ efree( cur_loc_range ); } if( can_lang_tag){ efree( can_lang_tag ); } if( can_loc_range){ efree( can_loc_range ); } RETURN_FALSE; } /* end of if isCanonical */ else{ /* Convert to lower case for case-insensitive comparison */ cur_lang_tag = ecalloc( 1, strlen(lang_tag ) + 1); result = strToMatch( lang_tag , cur_lang_tag); if( result == 0) { efree( cur_lang_tag ); RETURN_FALSE; } cur_loc_range = ecalloc( 1, strlen(loc_range ) + 1); result = strToMatch( loc_range , cur_loc_range ); if( result == 0) { efree( cur_lang_tag ); efree( cur_loc_range ); RETURN_FALSE; } /* check if prefix */ token = strstr( cur_lang_tag , cur_loc_range ); if( token && (token==cur_lang_tag) ){ /* check if the char. after match is SEPARATOR */ chrcheck = token + (strlen(cur_loc_range)); if( isIDSeparator(*chrcheck) || isEndOfTag(*chrcheck) ){ if( cur_lang_tag){ efree( cur_lang_tag ); } if( cur_loc_range){ efree( cur_loc_range ); } RETURN_TRUE; } } /* No prefix as loc_range */ if( cur_lang_tag){ efree( cur_lang_tag ); } if( cur_loc_range){ efree( cur_loc_range ); } RETURN_FALSE; } } ",0 "static v8::Handle acceptTransferListCallback(const v8::Arguments& args) { INC_STATS(""DOM.TestSerializedScriptValueInterface.acceptTransferList""); if (args.Length() < 1) return V8Proxy::throwNotEnoughArgumentsError(); TestSerializedScriptValueInterface* imp = V8TestSerializedScriptValueInterface::toNative(args.Holder()); MessagePortArray messagePortArrayTransferList; ArrayBufferArray arrayBufferArrayTransferList; if (args.Length() > 1) { if (!extractTransferables(args[1], messagePortArrayTransferList, arrayBufferArrayTransferList)) return V8Proxy::throwTypeError(""Could not extract transferables""); } bool dataDidThrow = false; RefPtr data = SerializedScriptValue::create(args[0], &messagePortArrayTransferList, &arrayBufferArrayTransferList, dataDidThrow, args.GetIsolate()); if (dataDidThrow) return v8::Undefined(); if (args.Length() <= 1) { imp->acceptTransferList(data); return v8::Handle(); } imp->acceptTransferList(data, messagePortArrayTransferList); return v8::Handle(); } ",1 "static int composite_init(int sub_api, struct libusb_context *ctx) { return LIBUSB_SUCCESS; } ",0 " int updateCount() const { return m_client.m_updateCount; } ",0 "release_spnego_ctx(spnego_gss_ctx_id_t *ctx) { spnego_gss_ctx_id_t context; OM_uint32 minor_stat; context = *ctx; if (context != NULL) { (void) gss_release_buffer(&minor_stat, &context->DER_mechTypes); (void) gss_release_oid_set(&minor_stat, &context->mech_set); (void) gss_release_name(&minor_stat, &context->internal_name); if (context->optionStr != NULL) { free(context->optionStr); context->optionStr = NULL; } free(context); *ctx = NULL; } } ",0 "void RenderFrameImpl::OnSelectRange(const gfx::Point& base, const gfx::Point& extent) { Send(new InputHostMsg_SelectRange_ACK(GetRenderWidget()->routing_id())); AutoResetMember handling_select_range( this, &RenderFrameImpl::handling_select_range_, true); frame_->SelectRange(render_view_->ConvertWindowPointToViewport(base), render_view_->ConvertWindowPointToViewport(extent)); } ",0 "static void cast6_xts_enc(void *ctx, u128 *dst, const u128 *src, le128 *iv) { glue_xts_crypt_128bit_one(ctx, dst, src, iv, GLUE_FUNC_CAST(__cast6_encrypt)); } ",0 "static void ipip_tunnel_unlink(struct ipip_net *ipn, struct ip_tunnel *t) { struct ip_tunnel __rcu **tp; struct ip_tunnel *iter; for (tp = ipip_bucket(ipn, t); (iter = rtnl_dereference(*tp)) != NULL; tp = &iter->next) { if (t == iter) { rcu_assign_pointer(*tp, t->next); break; } } } ",0 "static inline int aead_len(struct xfrm_algo_aead *alg) { return sizeof(*alg) + ((alg->alg_key_len + 7) / 8); } ",0 "static int uas_resume(struct usb_interface *intf) { return 0; } ",0 "static int f2fs_vm_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) { struct page *page = vmf->page; struct inode *inode = file_inode(vma->vm_file); struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); struct dnode_of_data dn; int err; f2fs_balance_fs(sbi); sb_start_pagefault(inode->i_sb); /* block allocation */ f2fs_lock_op(sbi); set_new_dnode(&dn, inode, NULL, NULL, 0); err = f2fs_reserve_block(&dn, page->index); f2fs_unlock_op(sbi); if (err) goto out; file_update_time(vma->vm_file); lock_page(page); if (unlikely(page->mapping != inode->i_mapping || page_offset(page) > i_size_read(inode) || !PageUptodate(page))) { unlock_page(page); err = -EFAULT; goto out; } /* * check to see if the page is mapped already (no holes) */ if (PageMappedToDisk(page)) goto mapped; /* page is wholly or partially inside EOF */ if (((page->index + 1) << PAGE_CACHE_SHIFT) > i_size_read(inode)) { unsigned offset; offset = i_size_read(inode) & ~PAGE_CACHE_MASK; zero_user_segment(page, offset, PAGE_CACHE_SIZE); } set_page_dirty(page); SetPageUptodate(page); trace_f2fs_vm_page_mkwrite(page, DATA); mapped: /* fill the page */ f2fs_wait_on_page_writeback(page, DATA); out: sb_end_pagefault(inode->i_sb); return block_page_mkwrite_return(err); } ",0 "static void perf_swevent_start(struct perf_event *event, int flags) { event->hw.state = 0; } ",0 "static struct posix_acl *f2fs_acl_clone(const struct posix_acl *acl, gfp_t flags) { struct posix_acl *clone = NULL; if (acl) { int size = sizeof(struct posix_acl) + acl->a_count * sizeof(struct posix_acl_entry); clone = kmemdup(acl, size, flags); if (clone) atomic_set(&clone->a_refcount, 1); } return clone; } ",0 "ScriptPromise ImageBitmapFactories::createImageBitmap(EventTarget& eventTarget, Blob* blob, int sx, int sy, int sw, int sh, ExceptionState& exceptionState) { if (!blob) { exceptionState.throwTypeError(""The blob provided is invalid.""); return ScriptPromise(); } if (!sw || !sh) { exceptionState.throwDOMException(IndexSizeError, String::format(""The source %s provided is 0."", sw ? ""height"" : ""width"")); return ScriptPromise(); } RefPtr resolver = ScriptPromiseResolver::create(eventTarget.executionContext()); ScriptPromise promise = resolver->promise(); RefPtr loader = ImageBitmapFactories::ImageBitmapLoader::create(from(eventTarget), resolver, IntRect(sx, sy, sw, sh)); from(eventTarget).addLoader(loader); loader->loadBlobAsync(eventTarget.executionContext(), blob); return promise; } ",0 "static void ssh_pkt_addbyte(struct Packet *pkt, unsigned char byte) { ssh_pkt_adddata(pkt, &byte, 1); } ",0 " bool openWindow() { g_assert(!m_inspectorWindow); m_inspectorWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL); WebKitWebViewBase* inspectorView = webkit_web_inspector_get_web_view(m_inspector); g_assert(inspectorView); gtk_container_add(GTK_CONTAINER(m_inspectorWindow), GTK_WIDGET(inspectorView)); gtk_widget_show_all(m_inspectorWindow); return InspectorTest::openWindow(); } ",0 "double WebPagePrivate::maximumScale() const { double zoomToFitScale = this->zoomToFitScale(); if (m_maximumScale >= m_minimumScale && respectViewport()) return std::max(zoomToFitScale, m_maximumScale); return hasVirtualViewport() ? std::max(zoomToFitScale, 4.0) : 4.0; } ",0 "static inline struct inet_timewait_sock *tw_next(struct inet_timewait_sock *tw) { return !is_a_nulls(tw->tw_node.next) ? hlist_nulls_entry(tw->tw_node.next, typeof(*tw), tw_node) : NULL; } ",0 "int ssl3_cbc_remove_padding(SSL3_RECORD *rec, unsigned block_size, unsigned mac_size) { unsigned padding_length, good; const unsigned overhead = 1 /* padding length byte */ + mac_size; /* * These lengths are all public so we can test them in non-constant time. */ if (overhead > rec->length) return 0; padding_length = rec->data[rec->length - 1]; good = constant_time_ge(rec->length, padding_length + overhead); /* SSLv3 requires that the padding is minimal. */ good &= constant_time_ge(block_size, padding_length + 1); rec->length -= good & (padding_length + 1); return constant_time_select_int(good, 1, -1); } ",0 "void CLASS fuji_load_raw() { ushort *pixel; int wide, row, col, r, c; fseek (ifp, (top_margin*raw_width + left_margin) * 2, SEEK_CUR); wide = fuji_width << !fuji_layout; pixel = (ushort *) calloc (wide, sizeof *pixel); merror (pixel, ""fuji_load_raw()""); for (row=0; row < raw_height; row++) { read_shorts (pixel, wide); fseek (ifp, 2*(raw_width - wide), SEEK_CUR); for (col=0; col < wide; col++) { if (fuji_layout) { r = fuji_width - 1 - col + (row >> 1); c = col + ((row+1) >> 1); } else { r = fuji_width - 1 + row - (col >> 1); c = row + ((col+1) >> 1); } BAYER(r,c) = pixel[col]; } } free (pixel); } ",0 "static int em_rdtsc(struct x86_emulate_ctxt *ctxt) { u64 tsc = 0; ctxt->ops->get_msr(ctxt, MSR_IA32_TSC, &tsc); ctxt->regs[VCPU_REGS_RAX] = (u32)tsc; ctxt->regs[VCPU_REGS_RDX] = tsc >> 32; return X86EMUL_CONTINUE; } ",0 "int __ref register_cu2_notifier(struct notifier_block *nb) { return raw_notifier_chain_register(&cu2_chain, nb); } ",0 "vips_foreign_load_temp( VipsForeignLoad *load ) { const guint64 disc_threshold = vips_get_disc_threshold(); const guint64 image_size = VIPS_IMAGE_SIZEOF_IMAGE( load->out ); /* If this is a partial operation, we can open directly. */ if( load->flags & VIPS_FOREIGN_PARTIAL ) { #ifdef DEBUG printf( ""vips_foreign_load_temp: partial temp\n"" ); #endif /*DEBUG*/ return( vips_image_new() ); } /* If it can do sequential access and it's been requested, we can open * directly. */ if( (load->flags & VIPS_FOREIGN_SEQUENTIAL) && load->access != VIPS_ACCESS_RANDOM ) { #ifdef DEBUG printf( ""vips_foreign_load_temp: partial sequential temp\n"" ); #endif /*DEBUG*/ return( vips_image_new() ); } /* ->memory used to be called ->disc and default TRUE. If it's been * forced FALSE, set memory TRUE. */ if( !load->disc ) load->memory = TRUE; /* We open via disc if: * - 'memory' is off * - the uncompressed image will be larger than * vips_get_disc_threshold() */ if( !load->memory && image_size > disc_threshold ) { #ifdef DEBUG printf( ""vips_foreign_load_temp: disc temp\n"" ); #endif /*DEBUG*/ return( vips_image_new_temp_file( ""%s.v"" ) ); } #ifdef DEBUG printf( ""vips_foreign_load_temp: memory temp\n"" ); #endif /*DEBUG*/ /* Otherwise, fall back to a memory buffer. */ return( vips_image_new_memory() ); } ",0 "static const PixelPacket *GetVirtualPixelsCache(const Image *image) { CacheInfo *restrict cache_info; const int id = GetOpenMPThreadId(); assert(image != (const Image *) NULL); assert(image->signature == MagickSignature); assert(image->cache != (Cache) NULL); cache_info=(CacheInfo *) image->cache; assert(cache_info->signature == MagickSignature); assert(id < (int) cache_info->number_threads); return(GetVirtualPixelsNexus(image->cache,cache_info->nexus_info[id])); } ",0 "void netdev_bonding_change(struct net_device *dev, unsigned long event) { call_netdevice_notifiers(event, dev); } ",0 "static struct fib6_node * fib6_lookup_1(struct fib6_node *root, struct lookup_args *args) { struct fib6_node *fn; __be32 dir; if (unlikely(args->offset == 0)) return NULL; /* * Descend on a tree */ fn = root; for (;;) { struct fib6_node *next; dir = addr_bit_set(args->addr, fn->fn_bit); next = dir ? fn->right : fn->left; if (next) { fn = next; continue; } break; } while (fn) { if (FIB6_SUBTREE(fn) || fn->fn_flags & RTN_RTINFO) { struct rt6key *key; key = (struct rt6key *) ((u8 *) fn->leaf + args->offset); if (ipv6_prefix_equal(&key->addr, args->addr, key->plen)) { #ifdef CONFIG_IPV6_SUBTREES if (fn->subtree) { struct fib6_node *sfn; sfn = fib6_lookup_1(fn->subtree, args + 1); if (!sfn) goto backtrack; fn = sfn; } #endif if (fn->fn_flags & RTN_RTINFO) return fn; } } #ifdef CONFIG_IPV6_SUBTREES backtrack: #endif if (fn->fn_flags & RTN_ROOT) break; fn = fn->parent; } return NULL; } ",0 "static int ssl_get_ecdh_params_from_cert( mbedtls_ssl_context *ssl ) { int ret; if( ! mbedtls_pk_can_do( mbedtls_ssl_own_key( ssl ), MBEDTLS_PK_ECKEY ) ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( ""server key not ECDH capable"" ) ); return( MBEDTLS_ERR_SSL_PK_TYPE_MISMATCH ); } if( ( ret = mbedtls_ecdh_get_params( &ssl->handshake->ecdh_ctx, mbedtls_pk_ec( *mbedtls_ssl_own_key( ssl ) ), MBEDTLS_ECDH_OURS ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, ( ""mbedtls_ecdh_get_params"" ), ret ); return( ret ); } return( 0 ); } ",0 "BOOL CALLBACK DismissOwnedPopups(HWND window, LPARAM arg) { const HWND toplevel_hwnd = reinterpret_cast(arg); if (::IsWindowVisible(window)) { const HWND owner = ::GetWindow(window, GW_OWNER); if (toplevel_hwnd == owner) { ::PostMessage(window, WM_CANCELMODE, 0, 0); } } return TRUE; } ",0 "static void update_logging() { bool should_log = module_started && (logging_enabled_via_api || stack_config->get_btsnoop_turned_on()); if (should_log == is_logging) return; is_logging = should_log; if (should_log) { btsnoop_net_open(); const char *log_path = stack_config->get_btsnoop_log_path(); if (stack_config->get_btsnoop_should_save_last()) { char last_log_path[PATH_MAX]; snprintf(last_log_path, PATH_MAX, ""%s.%llu"", log_path, btsnoop_timestamp()); if (!rename(log_path, last_log_path) && errno != ENOENT) LOG_ERROR(""%s unable to rename '%s' to '%s': %s"", __func__, log_path, last_log_path, strerror(errno)); } logfile_fd = open(log_path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH); if (logfile_fd == INVALID_FD) { LOG_ERROR(""%s unable to open '%s': %s"", __func__, log_path, strerror(errno)); is_logging = false; return; } write(logfile_fd, ""btsnoop\0\0\0\0\1\0\0\x3\xea"", 16); } else { if (logfile_fd != INVALID_FD) close(logfile_fd); logfile_fd = INVALID_FD; btsnoop_net_close(); } } ",1 "static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent) { struct inode *inode = ordered_extent->inode; struct btrfs_root *root = BTRFS_I(inode)->root; struct btrfs_trans_handle *trans = NULL; struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree; struct extent_state *cached_state = NULL; struct new_sa_defrag_extent *new = NULL; int compress_type = 0; int ret = 0; u64 logical_len = ordered_extent->len; bool nolock; bool truncated = false; nolock = btrfs_is_free_space_inode(inode); if (test_bit(BTRFS_ORDERED_IOERR, &ordered_extent->flags)) { ret = -EIO; goto out; } btrfs_free_io_failure_record(inode, ordered_extent->file_offset, ordered_extent->file_offset + ordered_extent->len - 1); if (test_bit(BTRFS_ORDERED_TRUNCATED, &ordered_extent->flags)) { truncated = true; logical_len = ordered_extent->truncated_len; /* Truncated the entire extent, don't bother adding */ if (!logical_len) goto out; } if (test_bit(BTRFS_ORDERED_NOCOW, &ordered_extent->flags)) { BUG_ON(!list_empty(&ordered_extent->list)); /* Logic error */ btrfs_ordered_update_i_size(inode, 0, ordered_extent); if (nolock) trans = btrfs_join_transaction_nolock(root); else trans = btrfs_join_transaction(root); if (IS_ERR(trans)) { ret = PTR_ERR(trans); trans = NULL; goto out; } trans->block_rsv = &root->fs_info->delalloc_block_rsv; ret = btrfs_update_inode_fallback(trans, root, inode); if (ret) /* -ENOMEM or corruption */ btrfs_abort_transaction(trans, root, ret); goto out; } lock_extent_bits(io_tree, ordered_extent->file_offset, ordered_extent->file_offset + ordered_extent->len - 1, 0, &cached_state); ret = test_range_bit(io_tree, ordered_extent->file_offset, ordered_extent->file_offset + ordered_extent->len - 1, EXTENT_DEFRAG, 1, cached_state); if (ret) { u64 last_snapshot = btrfs_root_last_snapshot(&root->root_item); if (0 && last_snapshot >= BTRFS_I(inode)->generation) /* the inode is shared */ new = record_old_file_extents(inode, ordered_extent); clear_extent_bit(io_tree, ordered_extent->file_offset, ordered_extent->file_offset + ordered_extent->len - 1, EXTENT_DEFRAG, 0, 0, &cached_state, GFP_NOFS); } if (nolock) trans = btrfs_join_transaction_nolock(root); else trans = btrfs_join_transaction(root); if (IS_ERR(trans)) { ret = PTR_ERR(trans); trans = NULL; goto out_unlock; } trans->block_rsv = &root->fs_info->delalloc_block_rsv; if (test_bit(BTRFS_ORDERED_COMPRESSED, &ordered_extent->flags)) compress_type = ordered_extent->compress_type; if (test_bit(BTRFS_ORDERED_PREALLOC, &ordered_extent->flags)) { BUG_ON(compress_type); ret = btrfs_mark_extent_written(trans, inode, ordered_extent->file_offset, ordered_extent->file_offset + logical_len); } else { BUG_ON(root == root->fs_info->tree_root); ret = insert_reserved_file_extent(trans, inode, ordered_extent->file_offset, ordered_extent->start, ordered_extent->disk_len, logical_len, logical_len, compress_type, 0, 0, BTRFS_FILE_EXTENT_REG); if (!ret) btrfs_release_delalloc_bytes(root, ordered_extent->start, ordered_extent->disk_len); } unpin_extent_cache(&BTRFS_I(inode)->extent_tree, ordered_extent->file_offset, ordered_extent->len, trans->transid); if (ret < 0) { btrfs_abort_transaction(trans, root, ret); goto out_unlock; } add_pending_csums(trans, inode, ordered_extent->file_offset, &ordered_extent->list); btrfs_ordered_update_i_size(inode, 0, ordered_extent); ret = btrfs_update_inode_fallback(trans, root, inode); if (ret) { /* -ENOMEM or corruption */ btrfs_abort_transaction(trans, root, ret); goto out_unlock; } ret = 0; out_unlock: unlock_extent_cached(io_tree, ordered_extent->file_offset, ordered_extent->file_offset + ordered_extent->len - 1, &cached_state, GFP_NOFS); out: if (root != root->fs_info->tree_root) btrfs_delalloc_release_metadata(inode, ordered_extent->len); if (trans) btrfs_end_transaction(trans, root); if (ret || truncated) { u64 start, end; if (truncated) start = ordered_extent->file_offset + logical_len; else start = ordered_extent->file_offset; end = ordered_extent->file_offset + ordered_extent->len - 1; clear_extent_uptodate(io_tree, start, end, NULL, GFP_NOFS); /* Drop the cache for the part of the extent we didn't write. */ btrfs_drop_extent_cache(inode, start, end, 0); /* * If the ordered extent had an IOERR or something else went * wrong we need to return the space for this ordered extent * back to the allocator. We only free the extent in the * truncated case if we didn't write out the extent at all. */ if ((ret || !logical_len) && !test_bit(BTRFS_ORDERED_NOCOW, &ordered_extent->flags) && !test_bit(BTRFS_ORDERED_PREALLOC, &ordered_extent->flags)) btrfs_free_reserved_extent(root, ordered_extent->start, ordered_extent->disk_len, 1); } /* * This needs to be done to make sure anybody waiting knows we are done * updating everything for this ordered extent. */ btrfs_remove_ordered_extent(inode, ordered_extent); /* for snapshot-aware defrag */ if (new) { if (ret) { free_sa_defrag_extent(new); atomic_dec(&root->fs_info->defrag_running); } else { relink_file_extents(new); } } /* once for us */ btrfs_put_ordered_extent(ordered_extent); /* once for the tree */ btrfs_put_ordered_extent(ordered_extent); return ret; } ",0 "int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) { struct page *page = vmf->page; loff_t size; unsigned long len; int ret; struct file *file = vma->vm_file; struct inode *inode = file_inode(file); struct address_space *mapping = inode->i_mapping; handle_t *handle; get_block_t *get_block; int retries = 0; sb_start_pagefault(inode->i_sb); file_update_time(vma->vm_file); /* Delalloc case is easy... */ if (test_opt(inode->i_sb, DELALLOC) && !ext4_should_journal_data(inode) && !ext4_nonda_switch(inode->i_sb)) { do { ret = block_page_mkwrite(vma, vmf, ext4_da_get_block_prep); } while (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)); goto out_ret; } lock_page(page); size = i_size_read(inode); /* Page got truncated from under us? */ if (page->mapping != mapping || page_offset(page) > size) { unlock_page(page); ret = VM_FAULT_NOPAGE; goto out; } if (page->index == size >> PAGE_CACHE_SHIFT) len = size & ~PAGE_CACHE_MASK; else len = PAGE_CACHE_SIZE; /* * Return if we have all the buffers mapped. This avoids the need to do * journal_start/journal_stop which can block and take a long time */ if (page_has_buffers(page)) { if (!ext4_walk_page_buffers(NULL, page_buffers(page), 0, len, NULL, ext4_bh_unmapped)) { /* Wait so that we don't change page under IO */ wait_for_stable_page(page); ret = VM_FAULT_LOCKED; goto out; } } unlock_page(page); /* OK, we need to fill the hole... */ if (ext4_should_dioread_nolock(inode)) get_block = ext4_get_block_write; else get_block = ext4_get_block; retry_alloc: handle = ext4_journal_start(inode, EXT4_HT_WRITE_PAGE, ext4_writepage_trans_blocks(inode)); if (IS_ERR(handle)) { ret = VM_FAULT_SIGBUS; goto out; } ret = block_page_mkwrite(vma, vmf, get_block); if (!ret && ext4_should_journal_data(inode)) { if (ext4_walk_page_buffers(handle, page_buffers(page), 0, PAGE_CACHE_SIZE, NULL, do_journal_get_write_access)) { unlock_page(page); ret = VM_FAULT_SIGBUS; ext4_journal_stop(handle); goto out; } ext4_set_inode_state(inode, EXT4_STATE_JDATA); } ext4_journal_stop(handle); if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)) goto retry_alloc; out_ret: ret = block_page_mkwrite_return(ret); out: sb_end_pagefault(inode->i_sb); return ret; } ",1 "static int do_read_fault(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, pmd_t *pmd, pgoff_t pgoff, unsigned int flags, pte_t orig_pte) { struct page *fault_page; spinlock_t *ptl; pte_t *pte; int ret = 0; /* * Let's call ->map_pages() first and use ->fault() as fallback * if page by the offset is not ready to be mapped (cold cache or * something). */ if (vma->vm_ops->map_pages && fault_around_bytes >> PAGE_SHIFT > 1) { pte = pte_offset_map_lock(mm, pmd, address, &ptl); do_fault_around(vma, address, pte, pgoff, flags); if (!pte_same(*pte, orig_pte)) goto unlock_out; pte_unmap_unlock(pte, ptl); } ret = __do_fault(vma, address, pgoff, flags, NULL, &fault_page); if (unlikely(ret & (VM_FAULT_ERROR | VM_FAULT_NOPAGE | VM_FAULT_RETRY))) return ret; pte = pte_offset_map_lock(mm, pmd, address, &ptl); if (unlikely(!pte_same(*pte, orig_pte))) { pte_unmap_unlock(pte, ptl); unlock_page(fault_page); page_cache_release(fault_page); return ret; } do_set_pte(vma, address, fault_page, pte, false, false); unlock_page(fault_page); unlock_out: pte_unmap_unlock(pte, ptl); return ret; } ",0 "follow_huge_addr(struct mm_struct *mm, unsigned long address, int write) { return ERR_PTR(-EINVAL); } ",0 "void PDFiumEngine::Form_OnChange(FPDF_FORMFILLINFO* param) { } ",0 "void GuestViewBase::LoadingStateChanged(content::WebContents* source, bool to_different_document) { if (!attached() || !embedder_web_contents()->GetDelegate()) return; embedder_web_contents()->GetDelegate()->LoadingStateChanged( embedder_web_contents(), to_different_document); } ",0 "static unsigned int unix_dgram_poll(struct file *file, struct socket *sock, poll_table *wait) { struct sock *sk = sock->sk, *other; unsigned int mask, writable; sock_poll_wait(file, sk_sleep(sk), wait); mask = 0; /* exceptional events? */ if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) mask |= POLLERR; if (sk->sk_shutdown & RCV_SHUTDOWN) mask |= POLLRDHUP | POLLIN | POLLRDNORM; if (sk->sk_shutdown == SHUTDOWN_MASK) mask |= POLLHUP; /* readable? */ if (!skb_queue_empty(&sk->sk_receive_queue)) mask |= POLLIN | POLLRDNORM; /* Connection-based need to check for termination and startup */ if (sk->sk_type == SOCK_SEQPACKET) { if (sk->sk_state == TCP_CLOSE) mask |= POLLHUP; /* connection hasn't started yet? */ if (sk->sk_state == TCP_SYN_SENT) return mask; } /* No write status requested, avoid expensive OUT tests. */ if (!(poll_requested_events(wait) & (POLLWRBAND|POLLWRNORM|POLLOUT))) return mask; writable = unix_writable(sk); other = unix_peer_get(sk); if (other) { if (unix_peer(other) != sk) { sock_poll_wait(file, &unix_sk(other)->peer_wait, wait); if (unix_recvq_full(other)) writable = 0; } sock_put(other); } if (writable) mask |= POLLOUT | POLLWRNORM | POLLWRBAND; else set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags); return mask; } ",0 " FlagsStateSingleton() : flags_state_(kFeatureEntries, base::size(kFeatureEntries)) {} ",0 "void WebPluginDelegatePepper::DidFinishLoadWithReason( const GURL& url, NPReason reason, int notify_id) { instance()->DidFinishLoadWithReason(url, reason, notify_id); } ",0 "void BrowserViewRenderer::SetTotalRootLayerScrollOffset( gfx::Vector2dF scroll_offset_dip) { if (scroll_offset_dip_ == scroll_offset_dip) return; scroll_offset_dip_ = scroll_offset_dip; gfx::Vector2d max_offset = max_scroll_offset(); gfx::Vector2d scroll_offset; if (max_scroll_offset_dip_.x()) { scroll_offset.set_x((scroll_offset_dip.x() * max_offset.x()) / max_scroll_offset_dip_.x()); } if (max_scroll_offset_dip_.y()) { scroll_offset.set_y((scroll_offset_dip.y() * max_offset.y()) / max_scroll_offset_dip_.y()); } DCHECK_LE(0, scroll_offset.x()); DCHECK_LE(0, scroll_offset.y()); DCHECK_LE(scroll_offset.x(), max_offset.x()); DCHECK_LE(scroll_offset.y(), max_offset.y()); client_->ScrollContainerViewTo(scroll_offset); } ",0 "static int check_pe64_bytes(const ut8 *buf, ut64 length) { int idx, ret = false; if (!buf || length <= 0x3d) { return false; } idx = buf[0x3c] | (buf[0x3d]<<8); if (length >= idx + 0x20) { if (!memcmp (buf, ""MZ"", 2) && !memcmp (buf+idx, ""PE"", 2) && !memcmp (buf+idx+0x18, ""\x0b\x02"", 2)) { ret = true; } } return ret; } ",0 "static void UnsignedLongLongMethodMethod(const v8::FunctionCallbackInfo& info) { TestObject* impl = V8TestObject::ToImpl(info.Holder()); V8SetReturnValue(info, static_cast(impl->unsignedLongLongMethod())); } ",0 "static struct fpm_child_s *fpm_child_find(pid_t pid) /* {{{ */ { struct fpm_worker_pool_s *wp; struct fpm_child_s *child = 0; for (wp = fpm_worker_all_pools; wp; wp = wp->next) { for (child = wp->children; child; child = child->next) { if (child->pid == pid) { break; } } if (child) break; } if (!child) { return 0; } return child; } /* }}} */ ",0 "void mem_cgroup_replace_page_cache(struct page *oldpage, struct page *newpage) { struct mem_cgroup *memcg; struct page_cgroup *pc; enum charge_type type = MEM_CGROUP_CHARGE_TYPE_CACHE; if (mem_cgroup_disabled()) return; pc = lookup_page_cgroup(oldpage); /* fix accounting on old pages */ lock_page_cgroup(pc); memcg = pc->mem_cgroup; mem_cgroup_charge_statistics(memcg, PageCgroupCache(pc), -1); ClearPageCgroupUsed(pc); unlock_page_cgroup(pc); if (PageSwapBacked(oldpage)) type = MEM_CGROUP_CHARGE_TYPE_SHMEM; /* * Even if newpage->mapping was NULL before starting replacement, * the newpage may be on LRU(or pagevec for LRU) already. We lock * LRU while we overwrite pc->mem_cgroup. */ __mem_cgroup_commit_charge(memcg, newpage, 1, pc, type, true); } ",0 "JSObject* createRangeError(JSGlobalObject* globalObject, const UString& message) { ASSERT(!message.isEmpty()); return ErrorInstance::create(globalObject->globalData(), globalObject->rangeErrorConstructor()->errorStructure(), message); } ",0 "void RenderWidgetHostViewGuest::SetCachedPageScaleFactorLimits( float minimum_scale, float maximum_scale) { NOTIMPLEMENTED(); } ",0 "t2p_sample_rgba_to_rgb(tdata_t data, uint32 samplecount) { uint32 i = 0; uint32 sample = 0; uint8 alpha = 0; for (i = 0; i < samplecount; i++) { sample=((uint32*)data)[i]; alpha=(uint8)((255 - ((sample >> 24) & 0xff))); ((uint8 *)data)[i * 3] = (uint8) ((sample >> 16) & 0xff) + alpha; ((uint8 *)data)[i * 3 + 1] = (uint8) ((sample >> 8) & 0xff) + alpha; ((uint8 *)data)[i * 3 + 2] = (uint8) (sample & 0xff) + alpha; } return (i * 3); } ",0 "WebPluginContainerImpl* LocalFrame::GetWebPluginContainer(Node* node) const { if (GetDocument() && GetDocument()->IsPluginDocument()) { return ToPluginDocument(GetDocument())->GetPluginView(); } if (!node) { DCHECK(GetDocument()); node = GetDocument()->FocusedElement(); } if (node) { return node->GetWebPluginContainer(); } return nullptr; } ",0 "void ff_amf_write_field_name(uint8_t **dst, const char *str) { bytestream_put_be16(dst, strlen(str)); bytestream_put_buffer(dst, str, strlen(str)); } ",0 "void SaveBlobStatusAndFiles(BlobStatus* status_ptr, std::vector* files_ptr, BlobStatus status, std::vector files) { EXPECT_FALSE(BlobStatusIsError(status)); *status_ptr = status; for (FileCreationInfo& info : files) { files_ptr->push_back(std::move(info)); } } ",0 "static int sas_configure_set(struct domain_device *dev, int phy_id, u8 *sas_addr, int index, int include) { int res; u8 *cri_req; u8 *cri_resp; cri_req = alloc_smp_req(CRI_REQ_SIZE); if (!cri_req) return -ENOMEM; cri_resp = alloc_smp_resp(CRI_RESP_SIZE); if (!cri_resp) { kfree(cri_req); return -ENOMEM; } cri_req[1] = SMP_CONF_ROUTE_INFO; *(__be16 *)(cri_req+6) = cpu_to_be16(index); cri_req[9] = phy_id; if (SAS_ADDR(sas_addr) == 0 || !include) cri_req[12] |= 0x80; memcpy(cri_req+16, sas_addr, SAS_ADDR_SIZE); res = smp_execute_task(dev, cri_req, CRI_REQ_SIZE, cri_resp, CRI_RESP_SIZE); if (res) goto out; res = cri_resp[2]; if (res == SMP_RESP_NO_INDEX) { SAS_DPRINTK(""overflow of indexes: dev %016llx phy 0x%x "" ""index 0x%x\n"", SAS_ADDR(dev->sas_addr), phy_id, index); } out: kfree(cri_req); kfree(cri_resp); return res; } ",0 "static __net_exit void proto_exit_net(struct net *net) { remove_proc_entry(""protocols"", net->proc_net); } ",0 "static int tcos_get_serialnr(sc_card_t *card, sc_serial_number_t *serial) { int r; if (!serial) return SC_ERROR_INVALID_ARGUMENTS; /* see if we have cached serial number */ if (card->serialnr.len) { memcpy(serial, &card->serialnr, sizeof(*serial)); return SC_SUCCESS; } card->serialnr.len = sizeof card->serialnr.value; r = sc_parse_ef_gdo(card, card->serialnr.value, &card->serialnr.len, NULL, 0); if (r < 0) { card->serialnr.len = 0; return r; } /* copy and return serial number */ memcpy(serial, &card->serialnr, sizeof(*serial)); return SC_SUCCESS; } ",0 "iasecc_sdo_put_data(struct sc_card *card, struct iasecc_sdo_update *update) { struct sc_context *ctx = card->ctx; struct sc_apdu apdu; int ii, rv; LOG_FUNC_CALLED(ctx); if (update->magic != SC_CARDCTL_IASECC_SDO_MAGIC_PUT_DATA) LOG_TEST_RET(ctx, SC_ERROR_INVALID_DATA, ""Invalid SDO update data""); for(ii=0; update->fields[ii].tag && ii < IASECC_SDO_TAGS_UPDATE_MAX; ii++) { unsigned char *encoded = NULL; int encoded_len; encoded_len = iasecc_sdo_encode_update_field(ctx, update->sdo_class, update->sdo_ref, &update->fields[ii], &encoded); sc_log(ctx, ""iasecc_sdo_put_data() encode[%i]; tag %X; encoded_len %i"", ii, update->fields[ii].tag, encoded_len); LOG_TEST_RET(ctx, encoded_len, ""Cannot encode update data""); sc_format_apdu(card, &apdu, SC_APDU_CASE_3_SHORT, 0xDB, 0x3F, 0xFF); apdu.data = encoded; apdu.datalen = encoded_len; apdu.lc = encoded_len; apdu.flags |= SC_APDU_FLAGS_CHAINING; rv = sc_transmit_apdu(card, &apdu); LOG_TEST_RET(ctx, rv, ""APDU transmit failed""); rv = sc_check_sw(card, apdu.sw1, apdu.sw2); LOG_TEST_RET(ctx, rv, ""SDO put data error""); free(encoded); } LOG_FUNC_RETURN(ctx, SC_SUCCESS); } ",0 "bool WebPluginDelegateProxy::CreateBitmap( scoped_ptr* memory, scoped_ptr* canvas) { int width = plugin_rect_.width(); int height = plugin_rect_.height(); const size_t stride = skia::PlatformCanvas::StrideForWidth(width); const size_t size = stride * height; #if defined(OS_LINUX) memory->reset(TransportDIB::Create(size, 0)); if (!memory->get()) return false; #endif #if defined(OS_MACOSX) TransportDIB::Handle handle; IPC::Message* msg = new ViewHostMsg_AllocTransportDIB(size, &handle); if (!RenderThread::current()->Send(msg)) return false; if (handle.fd < 0) return false; memory->reset(TransportDIB::Map(handle)); #else static uint32 sequence_number = 0; memory->reset(TransportDIB::Create(size, sequence_number++)); #endif canvas->reset((*memory)->GetPlatformCanvas(width, height)); return true; } ",0 "static void boot_delay_msec(void) { unsigned long long k; unsigned long timeout; if (boot_delay == 0 || system_state != SYSTEM_BOOTING) return; k = (unsigned long long)loops_per_msec * boot_delay; timeout = jiffies + msecs_to_jiffies(boot_delay); while (k) { k--; cpu_relax(); /* * use (volatile) jiffies to prevent * compiler reduction; loop termination via jiffies * is secondary and may or may not happen. */ if (time_after(jiffies, timeout)) break; touch_nmi_watchdog(); } } ",0 "struct fib6_table *fib6_new_table(struct net *net, u32 id) { struct fib6_table *tb; if (id == 0) id = RT6_TABLE_MAIN; tb = fib6_get_table(net, id); if (tb) return tb; tb = fib6_alloc_table(net, id); if (tb) fib6_link_table(net, tb); return tb; } ",0 "GF_Err ftab_dump(GF_Box *a, FILE * trace) { u32 i; GF_FontTableBox *p = (GF_FontTableBox *)a; gf_isom_box_dump_start(a, ""FontTableBox"", trace); fprintf(trace, "">\n""); for (i=0; ientry_count; i++) { fprintf(trace, ""\n"", p->fonts[i].fontID, p->fonts[i].fontName ? p->fonts[i].fontName : ""NULL""); } if (!p->size) { fprintf(trace, ""\n""); } gf_isom_box_dump_done(""FontTableBox"", a, trace); return GF_OK; } ",0 "void RenderWidgetHostViewAura::SetIsLoading(bool is_loading) { is_loading_ = is_loading; UpdateCursorIfOverSelf(); } ",0 "GF_Err mp4s_Read(GF_Box *s, GF_BitStream *bs) { GF_Err e; GF_MPEGSampleEntryBox *ptr = (GF_MPEGSampleEntryBox *)s; e = gf_isom_base_sample_entry_read((GF_SampleEntryBox *)ptr, bs); if (e) return e; ISOM_DECREASE_SIZE(ptr, 8); return gf_isom_box_array_read(s, bs, mp4s_AddBox); } ",0 "int __rtnl_link_register(struct rtnl_link_ops *ops) { if (rtnl_link_ops_get(ops->kind)) return -EEXIST; /* The check for setup is here because if ops * does not have that filled up, it is not possible * to use the ops for creating device. So do not * fill up dellink as well. That disables rtnl_dellink. */ if (ops->setup && !ops->dellink) ops->dellink = unregister_netdevice_queue; list_add_tail(&ops->list, &link_ops); return 0; } ",0 "static int ehci_state_fetchitd(EHCIState *ehci, int async) { uint32_t entry; EHCIitd itd; assert(!async); entry = ehci_get_fetch_addr(ehci, async); if (get_dwords(ehci, NLPTR_GET(entry), (uint32_t *) &itd, sizeof(EHCIitd) >> 2) < 0) { return -1; } ehci_trace_itd(ehci, entry, &itd); if (ehci_process_itd(ehci, &itd, entry) != 0) { return -1; } put_dwords(ehci, NLPTR_GET(entry), (uint32_t *) &itd, sizeof(EHCIitd) >> 2); ehci_set_fetch_addr(ehci, async, itd.next); ehci_set_state(ehci, async, EST_FETCHENTRY); return 1; } ",0 "send_set_info(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, u64 volatile_fid, u32 pid, u8 info_class, u8 info_type, u32 additional_info, unsigned int num, void **data, unsigned int *size) { struct smb_rqst rqst; struct smb2_set_info_rsp *rsp = NULL; struct kvec *iov; struct kvec rsp_iov; int rc = 0; int resp_buftype; struct cifs_ses *ses = tcon->ses; int flags = 0; if (!ses || !(ses->server)) return -EIO; if (!num) return -EINVAL; if (smb3_encryption_required(tcon)) flags |= CIFS_TRANSFORM_REQ; iov = kmalloc_array(num, sizeof(struct kvec), GFP_KERNEL); if (!iov) return -ENOMEM; memset(&rqst, 0, sizeof(struct smb_rqst)); rqst.rq_iov = iov; rqst.rq_nvec = num; rc = SMB2_set_info_init(tcon, &rqst, persistent_fid, volatile_fid, pid, info_class, info_type, additional_info, data, size); if (rc) { kfree(iov); return rc; } rc = cifs_send_recv(xid, ses, &rqst, &resp_buftype, flags, &rsp_iov); SMB2_set_info_free(&rqst); rsp = (struct smb2_set_info_rsp *)rsp_iov.iov_base; if (rc != 0) { cifs_stats_fail_inc(tcon, SMB2_SET_INFO_HE); trace_smb3_set_info_err(xid, persistent_fid, tcon->tid, ses->Suid, info_class, (__u32)info_type, rc); } free_rsp_buf(resp_buftype, rsp); kfree(iov); return rc; } ",0 "static tag_table_type exif_get_tag_table(int section) { switch(section) { case SECTION_FILE: return &tag_table_IFD[0]; case SECTION_COMPUTED: return &tag_table_IFD[0]; case SECTION_ANY_TAG: return &tag_table_IFD[0]; case SECTION_IFD0: return &tag_table_IFD[0]; case SECTION_THUMBNAIL: return &tag_table_IFD[0]; case SECTION_COMMENT: return &tag_table_IFD[0]; case SECTION_APP0: return &tag_table_IFD[0]; case SECTION_EXIF: return &tag_table_IFD[0]; case SECTION_FPIX: return &tag_table_IFD[0]; case SECTION_GPS: return &tag_table_GPS[0]; case SECTION_INTEROP: return &tag_table_IOP[0]; case SECTION_APP12: return &tag_table_IFD[0]; case SECTION_WINXP: return &tag_table_IFD[0]; } return &tag_table_IFD[0]; } ",0 "fbCompositeGeneral (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { RegionRec region; int n; BoxPtr pbox; Bool srcRepeat = FALSE; Bool maskRepeat = FALSE; int w, h; CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; CARD32 *scanline_buffer = _scanline_buffer; FbComposeData compose_data; if (pSrc->pDrawable) srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); if (pMask && pMask->pDrawable) maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) op = PictOpSrc; if (!miComputeCompositeRegion (®ion, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst, yDst, width, height)) return; compose_data.op = op; compose_data.src = pSrc; compose_data.mask = pMask; compose_data.dest = pDst; if (width > SCANLINE_BUFFER_LENGTH) scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); n = REGION_NUM_RECTS (®ion); pbox = REGION_RECTS (®ion); while (n--) { h = pbox->y2 - pbox->y1; compose_data.ySrc = pbox->y1 - yDst + ySrc; compose_data.yMask = pbox->y1 - yDst + yMask; compose_data.yDest = pbox->y1; while (h) { compose_data.height = h; w = pbox->x2 - pbox->x1; compose_data.xSrc = pbox->x1 - xDst + xSrc; compose_data.xMask = pbox->x1 - xDst + xMask; compose_data.xDest = pbox->x1; if (maskRepeat) { compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) compose_data.height = pMask->pDrawable->height - compose_data.yMask; } if (srcRepeat) { compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; } while (w) { compose_data.width = w; if (maskRepeat) { compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) compose_data.width = pMask->pDrawable->width - compose_data.xMask; } if (srcRepeat) { compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; } fbCompositeRect(&compose_data, scanline_buffer); w -= compose_data.width; compose_data.xSrc += compose_data.width; compose_data.xMask += compose_data.width; compose_data.xDest += compose_data.width; } h -= compose_data.height; compose_data.ySrc += compose_data.height; compose_data.yMask += compose_data.height; compose_data.yDest += compose_data.height; } pbox++; } REGION_UNINIT (pDst->pDrawable->pScreen, ®ion); if (scanline_buffer != _scanline_buffer) free(scanline_buffer); } ",1 "void RenderWidgetHostViewAura::EndFrameSubscription() { idle_frame_subscriber_textures_.clear(); frame_subscriber_.reset(); } ",0 "int AutofillManager::MakeFrontendID( const std::string& cc_backend_id, const std::string& profile_backend_id) const { int cc_int_id = BackendIDToInt(cc_backend_id); int profile_int_id = BackendIDToInt(profile_backend_id); DCHECK(cc_int_id <= std::numeric_limits::max()); DCHECK(profile_int_id <= std::numeric_limits::max()); return (cc_int_id << std::numeric_limits::digits) | profile_int_id; } ",0 "static inline bool nested_svm_nmi(struct vcpu_svm *svm) { if (!is_guest_mode(&svm->vcpu)) return true; if (!(svm->nested.intercept & (1ULL << INTERCEPT_NMI))) return true; svm->vmcb->control.exit_code = SVM_EXIT_NMI; svm->nested.exit_required = true; return false; } ",0 "static int __init einj_init(void) { int rc; acpi_status status; struct dentry *fentry; struct apei_exec_context ctx; if (acpi_disabled) return -ENODEV; status = acpi_get_table(ACPI_SIG_EINJ, 0, (struct acpi_table_header **)&einj_tab); if (status == AE_NOT_FOUND) return -ENODEV; else if (ACPI_FAILURE(status)) { const char *msg = acpi_format_exception(status); pr_err(EINJ_PFX ""Failed to get table, %s\n"", msg); return -EINVAL; } rc = einj_check_table(einj_tab); if (rc) { pr_warning(FW_BUG EINJ_PFX ""EINJ table is invalid\n""); return -EINVAL; } rc = -ENOMEM; einj_debug_dir = debugfs_create_dir(""einj"", apei_get_debugfs_dir()); if (!einj_debug_dir) goto err_cleanup; fentry = debugfs_create_file(""available_error_type"", S_IRUSR, einj_debug_dir, NULL, &available_error_type_fops); if (!fentry) goto err_cleanup; fentry = debugfs_create_file(""error_type"", S_IRUSR | S_IWUSR, einj_debug_dir, NULL, &error_type_fops); if (!fentry) goto err_cleanup; fentry = debugfs_create_file(""error_inject"", S_IWUSR, einj_debug_dir, NULL, &error_inject_fops); if (!fentry) goto err_cleanup; apei_resources_init(&einj_resources); einj_exec_ctx_init(&ctx); rc = apei_exec_collect_resources(&ctx, &einj_resources); if (rc) goto err_fini; rc = apei_resources_request(&einj_resources, ""APEI EINJ""); if (rc) goto err_fini; rc = apei_exec_pre_map_gars(&ctx); if (rc) goto err_release; rc = -ENOMEM; einj_param = einj_get_parameter_address(); if ((param_extension || acpi5) && einj_param) { fentry = debugfs_create_x32(""flags"", S_IRUSR | S_IWUSR, einj_debug_dir, &error_flags); if (!fentry) goto err_unmap; fentry = debugfs_create_x64(""param1"", S_IRUSR | S_IWUSR, einj_debug_dir, &error_param1); if (!fentry) goto err_unmap; fentry = debugfs_create_x64(""param2"", S_IRUSR | S_IWUSR, einj_debug_dir, &error_param2); if (!fentry) goto err_unmap; fentry = debugfs_create_x64(""param3"", S_IRUSR | S_IWUSR, einj_debug_dir, &error_param3); if (!fentry) goto err_unmap; fentry = debugfs_create_x64(""param4"", S_IRUSR | S_IWUSR, einj_debug_dir, &error_param4); if (!fentry) goto err_unmap; fentry = debugfs_create_x32(""notrigger"", S_IRUSR | S_IWUSR, einj_debug_dir, ¬rigger); if (!fentry) goto err_unmap; } if (vendor_dev[0]) { vendor_blob.data = vendor_dev; vendor_blob.size = strlen(vendor_dev); fentry = debugfs_create_blob(""vendor"", S_IRUSR, einj_debug_dir, &vendor_blob); if (!fentry) goto err_unmap; fentry = debugfs_create_x32(""vendor_flags"", S_IRUSR | S_IWUSR, einj_debug_dir, &vendor_flags); if (!fentry) goto err_unmap; } pr_info(EINJ_PFX ""Error INJection is initialized.\n""); return 0; err_unmap: if (einj_param) { acpi_size size = (acpi5) ? sizeof(struct set_error_type_with_address) : sizeof(struct einj_parameter); acpi_os_unmap_iomem(einj_param, size); } apei_exec_post_unmap_gars(&ctx); err_release: apei_resources_release(&einj_resources); err_fini: apei_resources_fini(&einj_resources); err_cleanup: debugfs_remove_recursive(einj_debug_dir); return rc; } ",0 "bool MultibufferDataSource::DidPassCORSAccessCheck() const { if (url_data()->cors_mode() == UrlData::CORS_UNSPECIFIED) return false; if (init_cb_) return false; if (failed_) return false; return true; } ",1 "int is_error_pfn(pfn_t pfn) { return pfn == bad_pfn || pfn == hwpoison_pfn || pfn == fault_pfn; } ",0 "SparseHistogram::SparseHistogram(const std::string& name) : HistogramBase(name), samples_(new SampleMap(HashMetricName(name))), logged_samples_(new SampleMap(samples_->id())) {} ",0 "void ass_shaper_find_runs(ASS_Shaper *shaper, ASS_Renderer *render_priv, GlyphInfo *glyphs, size_t len) { int i; int shape_run = 0; #ifdef CONFIG_HARFBUZZ ass_shaper_determine_script(shaper, glyphs, len); #endif for (i = 0; i < len; i++) { GlyphInfo *last = glyphs + i - 1; GlyphInfo *info = glyphs + i; if (info->symbol == 0xfffc) continue; ass_font_get_index(render_priv->fontselect, info->font, info->symbol, &info->face_index, &info->glyph_index); if (i > 0 && (last->font != info->font || last->face_index != info->face_index || last->script != info->script || last->font_size != info->font_size || last->c[0] != info->c[0] || last->c[1] != info->c[1] || last->c[2] != info->c[2] || last->c[3] != info->c[3] || last->be != info->be || last->blur != info->blur || last->shadow_x != info->shadow_x || last->shadow_y != info->shadow_y || last->frx != info->frx || last->fry != info->fry || last->frz != info->frz || last->fax != info->fax || last->fay != info->fay || last->scale_x != info->scale_x || last->scale_y != info->scale_y || last->border_style != info->border_style || last->border_x != info->border_x || last->border_y != info->border_y || last->hspacing != info->hspacing || last->italic != info->italic || last->bold != info->bold || last->flags != info->flags)) shape_run++; info->shape_run_id = shape_run; } } ",0 "check_file_permissions_aux(i_ctx_t *i_ctx_p, char *fname, uint flen) { /* i_ctx_p is NULL running init files. */ /* fname must be reduced. */ if (i_ctx_p == NULL) return 0; if (check_file_permissions_reduced(i_ctx_p, fname, flen, ""PermitFileReading"") < 0) return_error(gs_error_invalidfileaccess); return 0; } ",0 " TestDidCreateFrameWebFrameClient() : m_frameCount(0), m_parent(0) { } ",0 "cifs_create(struct inode *inode, struct dentry *direntry, int mode, struct nameidata *nd) { int rc = -ENOENT; int xid; int create_options = CREATE_NOT_DIR; __u32 oplock = 0; int oflags; /* * BB below access is probably too much for mknod to request * but we have to do query and setpathinfo so requesting * less could fail (unless we want to request getatr and setatr * permissions (only). At least for POSIX we do not have to * request so much. */ int desiredAccess = GENERIC_READ | GENERIC_WRITE; __u16 fileHandle; struct cifs_sb_info *cifs_sb; struct tcon_link *tlink; struct cifs_tcon *tcon; char *full_path = NULL; FILE_ALL_INFO *buf = NULL; struct inode *newinode = NULL; int disposition = FILE_OVERWRITE_IF; xid = GetXid(); cifs_sb = CIFS_SB(inode->i_sb); tlink = cifs_sb_tlink(cifs_sb); if (IS_ERR(tlink)) { FreeXid(xid); return PTR_ERR(tlink); } tcon = tlink_tcon(tlink); if (enable_oplocks) oplock = REQ_OPLOCK; if (nd) oflags = nd->intent.open.file->f_flags; else oflags = O_RDONLY | O_CREAT; full_path = build_path_from_dentry(direntry); if (full_path == NULL) { rc = -ENOMEM; goto cifs_create_out; } if (tcon->unix_ext && (tcon->ses->capabilities & CAP_UNIX) && (CIFS_UNIX_POSIX_PATH_OPS_CAP & le64_to_cpu(tcon->fsUnixInfo.Capability))) { rc = cifs_posix_open(full_path, &newinode, inode->i_sb, mode, oflags, &oplock, &fileHandle, xid); /* EIO could indicate that (posix open) operation is not supported, despite what server claimed in capability negotiation. EREMOTE indicates DFS junction, which is not handled in posix open */ if (rc == 0) { if (newinode == NULL) /* query inode info */ goto cifs_create_get_file_info; else /* success, no need to query */ goto cifs_create_set_dentry; } else if ((rc != -EIO) && (rc != -EREMOTE) && (rc != -EOPNOTSUPP) && (rc != -EINVAL)) goto cifs_create_out; /* else fallthrough to retry, using older open call, this is case where server does not support this SMB level, and falsely claims capability (also get here for DFS case which should be rare for path not covered on files) */ } if (nd) { /* if the file is going to stay open, then we need to set the desired access properly */ desiredAccess = 0; if (OPEN_FMODE(oflags) & FMODE_READ) desiredAccess |= GENERIC_READ; /* is this too little? */ if (OPEN_FMODE(oflags) & FMODE_WRITE) desiredAccess |= GENERIC_WRITE; if ((oflags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL)) disposition = FILE_CREATE; else if ((oflags & (O_CREAT | O_TRUNC)) == (O_CREAT | O_TRUNC)) disposition = FILE_OVERWRITE_IF; else if ((oflags & O_CREAT) == O_CREAT) disposition = FILE_OPEN_IF; else cFYI(1, ""Create flag not set in create function""); } /* BB add processing to set equivalent of mode - e.g. via CreateX with ACLs */ buf = kmalloc(sizeof(FILE_ALL_INFO), GFP_KERNEL); if (buf == NULL) { rc = -ENOMEM; goto cifs_create_out; } /* * if we're not using unix extensions, see if we need to set * ATTR_READONLY on the create call */ if (!tcon->unix_ext && (mode & S_IWUGO) == 0) create_options |= CREATE_OPTION_READONLY; if (backup_cred(cifs_sb)) create_options |= CREATE_OPEN_BACKUP_INTENT; if (tcon->ses->capabilities & CAP_NT_SMBS) rc = CIFSSMBOpen(xid, tcon, full_path, disposition, desiredAccess, create_options, &fileHandle, &oplock, buf, cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); else rc = -EIO; /* no NT SMB support fall into legacy open below */ if (rc == -EIO) { /* old server, retry the open legacy style */ rc = SMBLegacyOpen(xid, tcon, full_path, disposition, desiredAccess, create_options, &fileHandle, &oplock, buf, cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); } if (rc) { cFYI(1, ""cifs_create returned 0x%x"", rc); goto cifs_create_out; } /* If Open reported that we actually created a file then we now have to set the mode if possible */ if ((tcon->unix_ext) && (oplock & CIFS_CREATE_ACTION)) { struct cifs_unix_set_info_args args = { .mode = mode, .ctime = NO_CHANGE_64, .atime = NO_CHANGE_64, .mtime = NO_CHANGE_64, .device = 0, }; if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) { args.uid = (__u64) current_fsuid(); if (inode->i_mode & S_ISGID) args.gid = (__u64) inode->i_gid; else args.gid = (__u64) current_fsgid(); } else { args.uid = NO_CHANGE_64; args.gid = NO_CHANGE_64; } CIFSSMBUnixSetFileInfo(xid, tcon, &args, fileHandle, current->tgid); } else { /* BB implement mode setting via Windows security descriptors e.g. */ /* CIFSSMBWinSetPerms(xid,tcon,path,mode,-1,-1,nls);*/ /* Could set r/o dos attribute if mode & 0222 == 0 */ } cifs_create_get_file_info: /* server might mask mode so we have to query for it */ if (tcon->unix_ext) rc = cifs_get_inode_info_unix(&newinode, full_path, inode->i_sb, xid); else { rc = cifs_get_inode_info(&newinode, full_path, buf, inode->i_sb, xid, &fileHandle); if (newinode) { if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DYNPERM) newinode->i_mode = mode; if ((oplock & CIFS_CREATE_ACTION) && (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID)) { newinode->i_uid = current_fsuid(); if (inode->i_mode & S_ISGID) newinode->i_gid = inode->i_gid; else newinode->i_gid = current_fsgid(); } } } cifs_create_set_dentry: if (rc == 0) d_instantiate(direntry, newinode); else cFYI(1, ""Create worked, get_inode_info failed rc = %d"", rc); if (newinode && nd) { struct cifsFileInfo *pfile_info; struct file *filp; filp = lookup_instantiate_filp(nd, direntry, generic_file_open); if (IS_ERR(filp)) { rc = PTR_ERR(filp); CIFSSMBClose(xid, tcon, fileHandle); goto cifs_create_out; } pfile_info = cifs_new_fileinfo(fileHandle, filp, tlink, oplock); if (pfile_info == NULL) { fput(filp); CIFSSMBClose(xid, tcon, fileHandle); rc = -ENOMEM; } } else { CIFSSMBClose(xid, tcon, fileHandle); } cifs_create_out: kfree(buf); kfree(full_path); cifs_put_tlink(tlink); FreeXid(xid); return rc; } ",0 "void PanelSettingsMenuModel::ExtensionUninstallAccepted() { const Extension* extension = panel_->GetExtension(); DCHECK(extension); panel_->browser()->GetProfile()->GetExtensionService()-> UninstallExtension(extension->id(), false, NULL); } ",0 "static void IPv6SupportResults(IPv6SupportStatus result) { static bool run_once = false; if (!run_once) { run_once = true; UMA_HISTOGRAM_ENUMERATION(""Net.IPv6Status"", result, IPV6_SUPPORT_MAX); } else { UMA_HISTOGRAM_ENUMERATION(""Net.IPv6Status_retest"", result, IPV6_SUPPORT_MAX); } } ",0 "void NavigationRequest::HandleInterfaceDisconnection( mojom::NavigationClientAssociatedPtr* navigation_client, base::OnceClosure error_handler) { navigation_client->set_connection_error_handler(std::move(error_handler)); } ",0 "int megasas_alloc_ctrl_dma_buffers(struct megasas_instance *instance) { struct pci_dev *pdev = instance->pdev; struct fusion_context *fusion = instance->ctrl_context; instance->evt_detail = dma_alloc_coherent(&pdev->dev, sizeof(struct megasas_evt_detail), &instance->evt_detail_h, GFP_KERNEL); if (!instance->evt_detail) { dev_err(&instance->pdev->dev, ""Failed to allocate event detail buffer\n""); return -ENOMEM; } if (fusion) { fusion->ioc_init_request = dma_alloc_coherent(&pdev->dev, sizeof(struct MPI2_IOC_INIT_REQUEST), &fusion->ioc_init_request_phys, GFP_KERNEL); if (!fusion->ioc_init_request) { dev_err(&pdev->dev, ""Failed to allocate PD list buffer\n""); return -ENOMEM; } instance->snapdump_prop = dma_alloc_coherent(&pdev->dev, sizeof(struct MR_SNAPDUMP_PROPERTIES), &instance->snapdump_prop_h, GFP_KERNEL); if (!instance->snapdump_prop) dev_err(&pdev->dev, ""Failed to allocate snapdump properties buffer\n""); instance->host_device_list_buf = dma_alloc_coherent(&pdev->dev, HOST_DEVICE_LIST_SZ, &instance->host_device_list_buf_h, GFP_KERNEL); if (!instance->host_device_list_buf) { dev_err(&pdev->dev, ""Failed to allocate targetid list buffer\n""); return -ENOMEM; } } instance->pd_list_buf = dma_alloc_coherent(&pdev->dev, MEGASAS_MAX_PD * sizeof(struct MR_PD_LIST), &instance->pd_list_buf_h, GFP_KERNEL); if (!instance->pd_list_buf) { dev_err(&pdev->dev, ""Failed to allocate PD list buffer\n""); return -ENOMEM; } instance->ctrl_info_buf = dma_alloc_coherent(&pdev->dev, sizeof(struct megasas_ctrl_info), &instance->ctrl_info_buf_h, GFP_KERNEL); if (!instance->ctrl_info_buf) { dev_err(&pdev->dev, ""Failed to allocate controller info buffer\n""); return -ENOMEM; } instance->ld_list_buf = dma_alloc_coherent(&pdev->dev, sizeof(struct MR_LD_LIST), &instance->ld_list_buf_h, GFP_KERNEL); if (!instance->ld_list_buf) { dev_err(&pdev->dev, ""Failed to allocate LD list buffer\n""); return -ENOMEM; } instance->ld_targetid_list_buf = dma_alloc_coherent(&pdev->dev, sizeof(struct MR_LD_TARGETID_LIST), &instance->ld_targetid_list_buf_h, GFP_KERNEL); if (!instance->ld_targetid_list_buf) { dev_err(&pdev->dev, ""Failed to allocate LD targetid list buffer\n""); return -ENOMEM; } if (!reset_devices) { instance->system_info_buf = dma_alloc_coherent(&pdev->dev, sizeof(struct MR_DRV_SYSTEM_INFO), &instance->system_info_h, GFP_KERNEL); instance->pd_info = dma_alloc_coherent(&pdev->dev, sizeof(struct MR_PD_INFO), &instance->pd_info_h, GFP_KERNEL); instance->tgt_prop = dma_alloc_coherent(&pdev->dev, sizeof(struct MR_TARGET_PROPERTIES), &instance->tgt_prop_h, GFP_KERNEL); instance->crash_dump_buf = dma_alloc_coherent(&pdev->dev, CRASH_DMA_BUF_SIZE, &instance->crash_dump_h, GFP_KERNEL); if (!instance->system_info_buf) dev_err(&instance->pdev->dev, ""Failed to allocate system info buffer\n""); if (!instance->pd_info) dev_err(&instance->pdev->dev, ""Failed to allocate pd_info buffer\n""); if (!instance->tgt_prop) dev_err(&instance->pdev->dev, ""Failed to allocate tgt_prop buffer\n""); if (!instance->crash_dump_buf) dev_err(&instance->pdev->dev, ""Failed to allocate crash dump buffer\n""); } return 0; } ",0 "std::unique_ptr* GetPaddingKey() { static base::NoDestructor> s_padding_key([] { return SymmetricKey::GenerateRandomKey(kPaddingKeyAlgorithm, 128); }()); return s_padding_key.get(); } ",1 " gfx::Size ShellWindowFrameView::GetMaximumSize() { gfx::Size max_size = frame_->client_view()->GetMaximumSize(); if (!max_size.IsEmpty()) { gfx::Rect client_bounds = GetBoundsForClientView(); max_size.Enlarge(0, client_bounds.y()); } return max_size; } ",1 " void CloseInspectedBrowser() { chrome::CloseWindow(browser()); } ",0 "void PrintPreviewUI::OnShowSystemDialog() { web_ui()->CallJavascriptFunction(""onSystemDialogLinkClicked""); } ",0 "void QuotaManager::DumpOriginInfoTable( DumpOriginInfoTableCallback* callback) { make_scoped_refptr(new DumpOriginInfoTableTask(this, callback))->Start(); } ",0 "void Layer::SetParent(Layer* layer) { DCHECK(!layer || !layer->HasAncestor(this)); if (parent_should_know_need_push_properties()) { if (parent_) parent_->RemoveDependentNeedsPushProperties(); if (layer) layer->AddDependentNeedsPushProperties(); } parent_ = layer; SetLayerTreeHost(parent_ ? parent_->layer_tree_host() : NULL); if (!layer_tree_host_) return; const LayerTreeSettings& settings = layer_tree_host_->settings(); if (!settings.layer_transforms_should_scale_layer_contents) return; reset_raster_scale_to_unknown(); if (mask_layer_.get()) mask_layer_->reset_raster_scale_to_unknown(); if (replica_layer_.get() && replica_layer_->mask_layer_.get()) replica_layer_->mask_layer_->reset_raster_scale_to_unknown(); } ",0 "void WriteVirtIODeviceWord(ULONG_PTR ulRegister, u16 wValue) { #if 1 NdisRawWritePortUshort(ulRegister, wValue); #else static int nCounterToFail = 0; static const int StartFail = 200, StopFail = 600; BOOLEAN bFail = FALSE; DPrintf(6, (""%s> R[%x] = %x\n"", __FUNCTION__, (ULONG)ulRegister, wValue) ); if ((ulRegister & 0x1F) == 0x10) { nCounterToFail++; bFail = nCounterToFail >= StartFail && nCounterToFail < StopFail; } if (!bFail) NdisRawWritePortUshort(ulRegister, wValue); else { DPrintf(0, (""%s> FAILING R[%x] = %x\n"", __FUNCTION__, (ULONG)ulRegister, wValue) ); } #endif } ",0 "void SettingLevelBubbleView::Layout() { progress_bar_->SetBounds(width() - kPadding - kProgressBarWidth, (height() - kProgressBarHeight) / 2, kProgressBarWidth, kProgressBarHeight); } ",0 "Response InspectorNetworkAgent::disable() { DCHECK(!pending_request_); state_->setBoolean(NetworkAgentState::kNetworkAgentEnabled, false); state_->setString(NetworkAgentState::kUserAgentOverride, """"); instrumenting_agents_->removeInspectorNetworkAgent(this); resources_data_->Clear(); known_request_id_map_.clear(); return Response::OK(); } ",0 "bool HTMLTextAreaElement::matchesReadWritePseudoClass() const { return !isReadOnly(); } ",0 " virtual double GetWidthForTab(int index) const { TabGtk* tab = tabstrip_->GetTabAt(index); if (index == to_index_) return animation_.CurrentValueBetween(0, target_bounds_.width()); if (tab->mini()) return TabGtk::GetMiniWidth(); if (tab->IsActive()) { return animation_.CurrentValueBetween(start_selected_width_, end_selected_width_); } return animation_.CurrentValueBetween(start_unselected_width_, end_unselected_width_); } ",0 "void d_instantiate(struct dentry *entry, struct inode * inode) { BUG_ON(!hlist_unhashed(&entry->d_u.d_alias)); if (inode) { security_d_instantiate(entry, inode); spin_lock(&inode->i_lock); __d_instantiate(entry, inode); spin_unlock(&inode->i_lock); } } ",0 "static void perf_event_comm_output(struct perf_event *event, struct perf_comm_event *comm_event) { struct perf_output_handle handle; struct perf_sample_data sample; int size = comm_event->event_id.header.size; int ret; perf_event_header__init_id(&comm_event->event_id.header, &sample, event); ret = perf_output_begin(&handle, event, comm_event->event_id.header.size); if (ret) goto out; comm_event->event_id.pid = perf_event_pid(event, comm_event->task); comm_event->event_id.tid = perf_event_tid(event, comm_event->task); perf_output_put(&handle, comm_event->event_id); __output_copy(&handle, comm_event->comm, comm_event->comm_size); perf_event__output_id_sample(event, &handle, &sample); perf_output_end(&handle); out: comm_event->event_id.header.size = size; } ",0 "void FrameLoader::DispatchDidClearWindowObjectInMainWorld() { DCHECK(frame_->GetDocument()); if (!frame_->GetDocument()->CanExecuteScripts(kNotAboutToExecuteScript)) return; if (dispatching_did_clear_window_object_in_main_world_) return; AutoReset in_did_clear_window_object( &dispatching_did_clear_window_object_in_main_world_, true); Client()->DispatchDidClearWindowObjectInMainWorld(); } ",0 "static bool ValidPathForFile(const FilePath::StringType& text, FilePath* full_path) { FilePath file_path(text); if (!file_util::AbsolutePath(&file_path)) return false; if (!file_util::PathExists(file_path)) return false; *full_path = file_path; return true; } ",0 "void SoundChannel::resume() { Mutex::Autolock lock(&mLock); if (mState == PAUSED) { ALOGV(""resume track""); mState = PLAYING; mAutoPaused = false; mAudioTrack->start(); } } ",0 "void ResourceDispatcherHostImpl::SetDelegate( ResourceDispatcherHostDelegate* delegate) { delegate_ = delegate; } ",0 "void WebContentsImpl::Copy() { RenderFrameHostImpl* focused_frame = GetFocusedFrame(); if (!focused_frame) return; focused_frame->GetFrameInputHandler()->Copy(); RecordAction(base::UserMetricsAction(""Copy"")); } ",0 "void QQuickWebViewFlickablePrivate::didChangeContentsSize(const QSize& newSize) { Q_Q(QQuickWebView); pageView->setContentsSize(newSize); // emits contentsSizeChanged() m_viewportHandler->pageContentsSizeChanged(newSize, q->boundingRect().size().toSize()); } ",0 "static void run_event_gtk_alert(const char *msg, void *args) { GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(g_wnd_assistant), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_CLOSE, ""%s"", msg); char *tagged_msg = tag_url(msg, ""\n""); gtk_message_dialog_set_markup(GTK_MESSAGE_DIALOG(dialog), tagged_msg); free(tagged_msg); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); log_request_response_communication(msg, NULL, (struct analyze_event_data *)args); } ",0 "void V8TestObject::CallWithScriptStateExecutionContextIsolateVoidMethodMethodCallback(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_callWithScriptStateExecutionContextIsolateVoidMethod""); test_object_v8_internal::CallWithScriptStateExecutionContextIsolateVoidMethodMethod(info); } ",0 "SAPI_API char *sapi_get_default_content_type(TSRMLS_D) { uint len; return get_default_content_type(0, &len TSRMLS_CC); } ",0 "define_function(fsum_3) { double a = float_argument(1); double b = float_argument(2); double c = float_argument(3); return_float(a + b + c); } ",0 "int RenderThreadImpl::GenerateRoutingID() { int routing_id = MSG_ROUTING_NONE; Send(new ViewHostMsg_GenerateRoutingID(&routing_id)); return routing_id; } ",0 "static void vmx_set_rvi(int vector) { u16 status; u8 old; status = vmcs_read16(GUEST_INTR_STATUS); old = (u8)status & 0xff; if ((u8)vector != old) { status &= ~0xff; status |= (u8)vector; vmcs_write16(GUEST_INTR_STATUS, status); } } ",0 "inline void Splash::drawAAPixelInit() { aaBufY = -1; } ",0 "psf_get_filelen (SF_PRIVATE *psf) { sf_count_t filelen ; if (psf->virtual_io) return psf->vio.get_filelen (psf->vio_user_data) ; filelen = psf_get_filelen_fd (psf->file.filedes) ; if (filelen == -1) { psf_log_syserr (psf, errno) ; return (sf_count_t) -1 ; } ; if (filelen == -SFE_BAD_STAT_SIZE) { psf->error = SFE_BAD_STAT_SIZE ; return (sf_count_t) -1 ; } ; switch (psf->file.mode) { case SFM_WRITE : filelen = filelen - psf->fileoffset ; break ; case SFM_READ : if (psf->fileoffset > 0 && psf->filelength > 0) filelen = psf->filelength ; break ; case SFM_RDWR : /* ** Cannot open embedded files SFM_RDWR so we don't need to ** subtract psf->fileoffset. We already have the answer we ** need. */ break ; default : /* Shouldn't be here, so return error. */ filelen = -1 ; } ; return filelen ; } /* psf_get_filelen */ ",0 "need_numeric_port_hack(void) { if (!tested_for_getaddrinfo_hacks) test_for_getaddrinfo_hacks(); return need_numeric_port_hack_; } ",0 "static int cgm_get(const char *filename, char *value, size_t len, const char *name, const char *lxcpath) { pid_t pid; int p[2], ret, newlen, readlen; if (pipe(p) < 0) return -1; if ((pid = fork()) < 0) { close(p[0]); close(p[1]); return -1; } if (!pid) // do_cgm_get exits do_cgm_get(name, lxcpath, filename, p[1], len && value); close(p[1]); ret = read(p[0], &newlen, sizeof(newlen)); if (ret != sizeof(newlen)) { close(p[0]); ret = -1; goto out; } if (!len || !value) { close(p[0]); ret = newlen; goto out; } memset(value, 0, len); if (newlen < 0) { // child is reporting an error close(p[0]); ret = -1; goto out; } if (newlen == 0) { // empty read close(p[0]); ret = 0; goto out; } readlen = newlen > len ? len : newlen; ret = read(p[0], value, readlen); close(p[0]); if (ret != readlen) { ret = -1; goto out; } if (newlen >= len) { value[len-1] = '\0'; newlen = len-1; } else if (newlen+1 < len) { value[newlen++] = '\n'; value[newlen] = '\0'; } ret = newlen; out: if (wait_for_pid(pid)) WARN(""do_cgm_get exited with error""); return ret; } ",0 " static MagickBooleanType ReadUncompressedRGBA(Image *image, DDSInfo *dds_info, ExceptionInfo *exception) { PixelPacket *q; ssize_t alphaBits, x, y; unsigned short color; alphaBits=0; if (dds_info->pixelformat.rgb_bitcount == 16) { if (IsBitMask(dds_info->pixelformat,0x7c00,0x03e0,0x001f,0x8000)) alphaBits=1; else if (IsBitMask(dds_info->pixelformat,0x00ff,0x00ff,0x00ff,0xff00)) { alphaBits=2; (void) SetImageType(image,GrayscaleMatteType); } else if (IsBitMask(dds_info->pixelformat,0x0f00,0x00f0,0x000f,0xf000)) alphaBits=4; else ThrowBinaryException(CorruptImageError,""ImageTypeNotSupported"", image->filename); } for (y = 0; y < (ssize_t) dds_info->height; y++) { q = QueueAuthenticPixels(image, 0, y, dds_info->width, 1,exception); if (q == (PixelPacket *) NULL) return MagickFalse; for (x = 0; x < (ssize_t) dds_info->width; x++) { if (dds_info->pixelformat.rgb_bitcount == 16) { color=ReadBlobShort(image); if (alphaBits == 1) { SetPixelAlpha(q,(color & (1 << 15)) ? QuantumRange : 0); SetPixelRed(q,ScaleCharToQuantum((unsigned char) ((((unsigned short)(color << 1) >> 11)/31.0)*255))); SetPixelGreen(q,ScaleCharToQuantum((unsigned char) ((((unsigned short)(color << 6) >> 11)/31.0)*255))); SetPixelBlue(q,ScaleCharToQuantum((unsigned char) ((((unsigned short)(color << 11) >> 11)/31.0)*255))); } else if (alphaBits == 2) { SetPixelAlpha(q,ScaleCharToQuantum((unsigned char) (color >> 8))); SetPixelGray(q,ScaleCharToQuantum((unsigned char)color)); } else { SetPixelAlpha(q,ScaleCharToQuantum((unsigned char) (((color >> 12)/15.0)*255))); SetPixelRed(q,ScaleCharToQuantum((unsigned char) ((((unsigned short)(color << 4) >> 12)/15.0)*255))); SetPixelGreen(q,ScaleCharToQuantum((unsigned char) ((((unsigned short)(color << 8) >> 12)/15.0)*255))); SetPixelBlue(q,ScaleCharToQuantum((unsigned char) ((((unsigned short)(color << 12) >> 12)/15.0)*255))); } } else { SetPixelBlue(q,ScaleCharToQuantum((unsigned char) ReadBlobByte(image))); SetPixelGreen(q,ScaleCharToQuantum((unsigned char) ReadBlobByte(image))); SetPixelRed(q,ScaleCharToQuantum((unsigned char) ReadBlobByte(image))); SetPixelAlpha(q,ScaleCharToQuantum((unsigned char) ReadBlobByte(image))); } q++; } if (SyncAuthenticPixels(image,exception) == MagickFalse) return MagickFalse; } SkipRGBMipmaps(image, dds_info, 4); return MagickTrue; } ",1 "void RenderViewTest::SetFocused(const blink::WebNode& node) { RenderViewImpl* impl = static_cast(view_); impl->focusedNodeChanged(blink::WebNode(), node); } ",0 "void WebDevToolsAgentImpl::paintPageOverlay(WebCanvas* canvas) { InspectorController* ic = inspectorController(); if (ic) { GraphicsContext context(canvas); context.setCertainlyOpaque(false); ic->drawHighlight(context); } } ",0 "jv jv_parse_sized(const char* string, int length) { struct jv_parser parser; parser_init(&parser, 0); jv_parser_set_buf(&parser, string, length, 0); jv value = jv_parser_next(&parser); if (jv_is_valid(value)) { jv next = jv_parser_next(&parser); if (jv_is_valid(next)) { jv_free(value); jv_free(next); value = jv_invalid_with_msg(jv_string(""Unexpected extra JSON values"")); } else if (jv_invalid_has_msg(jv_copy(next))) { jv_free(value); value = next; } else { jv_free(next); } } else if (jv_invalid_has_msg(jv_copy(value))) { } else { jv_free(value); value = jv_invalid_with_msg(jv_string(""Expected JSON value"")); } parser_free(&parser); if (!jv_is_valid(value) && jv_invalid_has_msg(jv_copy(value))) { jv msg = jv_invalid_get_msg(value); value = jv_invalid_with_msg(jv_string_fmt(""%s (while parsing '%s')"", jv_string_value(msg), string)); jv_free(msg); } return value; } ",0 "void Document::didAssociateFormControl(Element* element) { if (!frame() || !frame()->page() || !frame()->page()->chrome()->client()->shouldNotifyOnFormChanges()) return; m_associatedFormControls.add(element); if (!m_didAssociateFormControlsTimer.isActive()) m_didAssociateFormControlsTimer.startOneShot(0); } ",0 "static int asn1_item_flags_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it, int flags) { if (out && !*out) { unsigned char *p, *buf; int len; len = ASN1_item_ex_i2d(&val, NULL, it, -1, flags); if (len <= 0) return len; buf = OPENSSL_malloc(len); if (!buf) return -1; p = buf; ASN1_item_ex_i2d(&val, &p, it, -1, flags); *out = buf; return len; } return ASN1_item_ex_i2d(&val, out, it, -1, flags); } ",0 "xmlXPathDebugDumpValueTree(FILE *output, xmlNodeSetPtr cur, int depth) { int i; char shift[100]; for (i = 0;((i < depth) && (i < 25));i++) shift[2 * i] = shift[2 * i + 1] = ' '; shift[2 * i] = shift[2 * i + 1] = 0; if ((cur == NULL) || (cur->nodeNr == 0) || (cur->nodeTab[0] == NULL)) { fprintf(output, ""%s"", shift); fprintf(output, ""Value Tree is NULL !\n""); return; } fprintf(output, ""%s"", shift); fprintf(output, ""%d"", i + 1); xmlXPathDebugDumpNodeList(output, cur->nodeTab[0]->children, depth + 1); } ",0 "int Range::maxStartOffset() const { if (!m_start.container()) return 0; if (!m_start.container()->offsetInCharacters()) return m_start.container()->childNodeCount(); return m_start.container()->maxCharacterOffset(); } ",0 "onig_get_syntax(regex_t* reg) { return reg->syntax; } ",0 "void StoragePartitionImpl::WaitForDeletionTasksForTesting() { if (deletion_helpers_running_) { base::RunLoop loop; on_deletion_helpers_done_callback_ = loop.QuitClosure(); loop.Run(); } } ",0 "static void parse_cat_blob(const char *p) { struct object_entry *oe = oe; unsigned char sha1[20]; /* cat-blob SP LF */ if (*p == ':') { oe = find_mark(parse_mark_ref_eol(p)); if (!oe) die(""Unknown mark: %s"", command_buf.buf); hashcpy(sha1, oe->idx.sha1); } else { if (get_sha1_hex(p, sha1)) die(""Invalid dataref: %s"", command_buf.buf); if (p[40]) die(""Garbage after SHA1: %s"", command_buf.buf); oe = find_object(sha1); } cat_blob(oe, sha1); } ",0 "RenderFlexibleBox::RenderFlexibleBox(Element* element) : RenderBlock(element) , m_orderIterator(this) , m_numberOfInFlowChildrenOnFirstLine(-1) { setChildrenInline(false); // All of our children must be block-level. } ",0 " MockFetchContext() { } ",0 "void bio_endio(struct bio *bio) { again: if (!bio_remaining_done(bio)) return; if (!bio_integrity_endio(bio)) return; /* * Need to have a real endio function for chained bios, otherwise * various corner cases will break (like stacking block devices that * save/restore bi_end_io) - however, we want to avoid unbounded * recursion and blowing the stack. Tail call optimization would * handle this, but compiling with frame pointers also disables * gcc's sibling call optimization. */ if (bio->bi_end_io == bio_chain_endio) { bio = __bio_chain_endio(bio); goto again; } if (bio->bi_disk && bio_flagged(bio, BIO_TRACE_COMPLETION)) { trace_block_bio_complete(bio->bi_disk->queue, bio, blk_status_to_errno(bio->bi_status)); bio_clear_flag(bio, BIO_TRACE_COMPLETION); } blk_throtl_bio_endio(bio); /* release cgroup info */ bio_uninit(bio); if (bio->bi_end_io) bio->bi_end_io(bio); } ",0 "bool DelegatedFrameHost::CanCopyToBitmap() const { return client_->GetCompositor() && client_->GetLayer()->has_external_content(); } ",0 "static int ext4_split_extent(handle_t *handle, struct inode *inode, struct ext4_ext_path *path, struct ext4_map_blocks *map, int split_flag, int flags) { ext4_lblk_t ee_block; struct ext4_extent *ex; unsigned int ee_len, depth; int err = 0; int uninitialized; int split_flag1, flags1; depth = ext_depth(inode); ex = path[depth].p_ext; ee_block = le32_to_cpu(ex->ee_block); ee_len = ext4_ext_get_actual_len(ex); uninitialized = ext4_ext_is_uninitialized(ex); if (map->m_lblk + map->m_len < ee_block + ee_len) { split_flag1 = split_flag & EXT4_EXT_MAY_ZEROOUT ? EXT4_EXT_MAY_ZEROOUT : 0; flags1 = flags | EXT4_GET_BLOCKS_PRE_IO; if (uninitialized) split_flag1 |= EXT4_EXT_MARK_UNINIT1 | EXT4_EXT_MARK_UNINIT2; err = ext4_split_extent_at(handle, inode, path, map->m_lblk + map->m_len, split_flag1, flags1); } ext4_ext_drop_refs(path); path = ext4_ext_find_extent(inode, map->m_lblk, path); if (IS_ERR(path)) return PTR_ERR(path); if (map->m_lblk >= ee_block) { split_flag1 = split_flag & EXT4_EXT_MAY_ZEROOUT ? EXT4_EXT_MAY_ZEROOUT : 0; if (uninitialized) split_flag1 |= EXT4_EXT_MARK_UNINIT1; if (split_flag & EXT4_EXT_MARK_UNINIT2) split_flag1 |= EXT4_EXT_MARK_UNINIT2; err = ext4_split_extent_at(handle, inode, path, map->m_lblk, split_flag1, flags); if (err) goto out; } ext4_ext_show_leaf(inode, path); out: return err ? err : map->m_len; } ",0 "xfs_inode_from_disk( struct xfs_inode *ip, struct xfs_dinode *from) { struct xfs_icdinode *to = &ip->i_d; struct inode *inode = VFS_I(ip); /* * Convert v1 inodes immediately to v2 inode format as this is the * minimum inode version format we support in the rest of the code. */ to->di_version = from->di_version; if (to->di_version == 1) { set_nlink(inode, be16_to_cpu(from->di_onlink)); to->di_projid_lo = 0; to->di_projid_hi = 0; to->di_version = 2; } else { set_nlink(inode, be32_to_cpu(from->di_nlink)); to->di_projid_lo = be16_to_cpu(from->di_projid_lo); to->di_projid_hi = be16_to_cpu(from->di_projid_hi); } to->di_format = from->di_format; to->di_uid = be32_to_cpu(from->di_uid); to->di_gid = be32_to_cpu(from->di_gid); to->di_flushiter = be16_to_cpu(from->di_flushiter); /* * Time is signed, so need to convert to signed 32 bit before * storing in inode timestamp which may be 64 bit. Otherwise * a time before epoch is converted to a time long after epoch * on 64 bit systems. */ inode->i_atime.tv_sec = (int)be32_to_cpu(from->di_atime.t_sec); inode->i_atime.tv_nsec = (int)be32_to_cpu(from->di_atime.t_nsec); inode->i_mtime.tv_sec = (int)be32_to_cpu(from->di_mtime.t_sec); inode->i_mtime.tv_nsec = (int)be32_to_cpu(from->di_mtime.t_nsec); inode->i_ctime.tv_sec = (int)be32_to_cpu(from->di_ctime.t_sec); inode->i_ctime.tv_nsec = (int)be32_to_cpu(from->di_ctime.t_nsec); inode->i_generation = be32_to_cpu(from->di_gen); inode->i_mode = be16_to_cpu(from->di_mode); to->di_size = be64_to_cpu(from->di_size); to->di_nblocks = be64_to_cpu(from->di_nblocks); to->di_extsize = be32_to_cpu(from->di_extsize); to->di_nextents = be32_to_cpu(from->di_nextents); to->di_anextents = be16_to_cpu(from->di_anextents); to->di_forkoff = from->di_forkoff; to->di_aformat = from->di_aformat; to->di_dmevmask = be32_to_cpu(from->di_dmevmask); to->di_dmstate = be16_to_cpu(from->di_dmstate); to->di_flags = be16_to_cpu(from->di_flags); if (to->di_version == 3) { inode_set_iversion_queried(inode, be64_to_cpu(from->di_changecount)); to->di_crtime.t_sec = be32_to_cpu(from->di_crtime.t_sec); to->di_crtime.t_nsec = be32_to_cpu(from->di_crtime.t_nsec); to->di_flags2 = be64_to_cpu(from->di_flags2); to->di_cowextsize = be32_to_cpu(from->di_cowextsize); } } ",0 "void V8TestObjectPython::installPerContextEnabledProperties(v8::Handle instanceTemplate, TestObjectPython* impl, v8::Isolate* isolate) { v8::Local prototypeTemplate = v8::Local::Cast(instanceTemplate->GetPrototype()); if (ContextFeatures::featureNameEnabled(impl->document())) { static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\ {""perContextEnabledLongAttribute"", TestObjectPythonV8Internal::perContextEnabledLongAttributeAttributeGetterCallback, TestObjectPythonV8Internal::perContextEnabledLongAttributeAttributeSetterCallback, 0, 0, 0, static_cast(v8::DEFAULT), static_cast(v8::None), 0 /* on instance */}; V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate, attributeConfiguration, isolate); } if (ContextFeatures::featureNameEnabled(impl->document())) { static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\ {""perContextEnabledRuntimeEnabledLongAttribute"", TestObjectPythonV8Internal::perContextEnabledRuntimeEnabledLongAttributeAttributeGetterCallback, TestObjectPythonV8Internal::perContextEnabledRuntimeEnabledLongAttributeAttributeSetterCallback, 0, 0, 0, static_cast(v8::DEFAULT), static_cast(v8::None), 0 /* on instance */}; V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate, attributeConfiguration, isolate); } } ",0 " Ins_SCVTCI( INS_ARG ) { DO_SCVTCI } ",0 "static void fsl_emb_pmu_read(struct perf_event *event) { s64 val, delta, prev; if (event->hw.state & PERF_HES_STOPPED) return; /* * Performance monitor interrupts come even when interrupts * are soft-disabled, as long as interrupts are hard-enabled. * Therefore we treat them like NMIs. */ do { prev = local64_read(&event->hw.prev_count); barrier(); val = read_pmc(event->hw.idx); } while (local64_cmpxchg(&event->hw.prev_count, prev, val) != prev); /* The counters are only 32 bits wide */ delta = (val - prev) & 0xfffffffful; local64_add(delta, &event->count); local64_sub(delta, &event->hw.period_left); } ",0 "void GuestViewBase::OnZoomChanged( const ui_zoom::ZoomController::ZoomChangedEventData& data) { if (data.web_contents == embedder_web_contents()) { auto guest_zoom_controller = ui_zoom::ZoomController::FromWebContents(web_contents()); if (content::ZoomValuesEqual(data.new_zoom_level, guest_zoom_controller->GetZoomLevel())) { return; } guest_zoom_controller->SetZoomLevel(data.new_zoom_level); EmbedderZoomChanged(data.old_zoom_level, data.new_zoom_level); return; } if (data.web_contents == web_contents()) { GuestZoomChanged(data.old_zoom_level, data.new_zoom_level); } } ",0 "void inet_hashinfo_init(struct inet_hashinfo *h) { int i; atomic_set(&h->bsockets, 0); for (i = 0; i < INET_LHTABLE_SIZE; i++) { spin_lock_init(&h->listening_hash[i].lock); INIT_HLIST_NULLS_HEAD(&h->listening_hash[i].head, i + LISTENING_NULLS_BASE); } } ",0 "static long ocfs2_fallocate(struct file *file, int mode, loff_t offset, loff_t len) { struct inode *inode = file_inode(file); struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); struct ocfs2_space_resv sr; int change_size = 1; int cmd = OCFS2_IOC_RESVSP64; if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE)) return -EOPNOTSUPP; if (!ocfs2_writes_unwritten_extents(osb)) return -EOPNOTSUPP; if (mode & FALLOC_FL_KEEP_SIZE) change_size = 0; if (mode & FALLOC_FL_PUNCH_HOLE) cmd = OCFS2_IOC_UNRESVSP64; sr.l_whence = 0; sr.l_start = (s64)offset; sr.l_len = (s64)len; return __ocfs2_change_file_space(NULL, inode, offset, cmd, &sr, change_size); } ",0 "static void o2nm_cluster_group_drop_item(struct config_group *group, struct config_item *item) { struct o2nm_cluster *cluster = to_o2nm_cluster(item); BUG_ON(o2nm_single_cluster != cluster); o2nm_single_cluster = NULL; configfs_remove_default_groups(&cluster->cl_group); config_item_put(item); } ",0 "void PluginInfoMessageFilter::Context::DecidePluginStatus( const GetPluginInfo_Params& params, const WebPluginInfo& plugin, const PluginMetadata* plugin_metadata, ChromeViewHostMsg_GetPluginInfo_Status* status) const { #if defined(OS_WIN) if (plugin.type == WebPluginInfo::PLUGIN_TYPE_NPAPI && base::win::IsMetroProcess()) { status->value = ChromeViewHostMsg_GetPluginInfo_Status::kNPAPINotSupported; return; } #endif ContentSetting plugin_setting = CONTENT_SETTING_DEFAULT; bool uses_default_content_setting = true; GetPluginContentSetting(plugin, params.top_origin_url, params.url, plugin_metadata->identifier(), &plugin_setting, &uses_default_content_setting); DCHECK(plugin_setting != CONTENT_SETTING_DEFAULT); PluginMetadata::SecurityStatus plugin_status = plugin_metadata->GetSecurityStatus(plugin); #if defined(ENABLE_PLUGIN_INSTALLATION) if (plugin_status == PluginMetadata::SECURITY_STATUS_OUT_OF_DATE && !allow_outdated_plugins_.GetValue()) { if (allow_outdated_plugins_.IsManaged()) { status->value = ChromeViewHostMsg_GetPluginInfo_Status::kOutdatedDisallowed; } else { status->value = ChromeViewHostMsg_GetPluginInfo_Status::kOutdatedBlocked; } return; } #endif if (plugin_status == PluginMetadata::SECURITY_STATUS_REQUIRES_AUTHORIZATION && plugin.type != WebPluginInfo::PLUGIN_TYPE_PEPPER_IN_PROCESS && plugin.type != WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS && !always_authorize_plugins_.GetValue() && plugin_setting != CONTENT_SETTING_BLOCK && uses_default_content_setting) { status->value = ChromeViewHostMsg_GetPluginInfo_Status::kUnauthorized; return; } if (PluginService::GetInstance()->IsPluginUnstable(plugin.path) && !always_authorize_plugins_.GetValue() && plugin_setting != CONTENT_SETTING_BLOCK && uses_default_content_setting) { status->value = ChromeViewHostMsg_GetPluginInfo_Status::kUnauthorized; return; } if (plugin_setting == CONTENT_SETTING_ASK) status->value = ChromeViewHostMsg_GetPluginInfo_Status::kClickToPlay; else if (plugin_setting == CONTENT_SETTING_BLOCK) status->value = ChromeViewHostMsg_GetPluginInfo_Status::kBlocked; } ",0 "static WKRect getWindowFrame(WKPageRef page, const void* clientInfo) { PlatformWebView* view = static_cast(const_cast(clientInfo)); return view->windowFrame(); } ",0 "void WebMediaPlayerMS::OnPictureInPictureModeEnded() { if (!client_ || !IsInPictureInPicture()) return; client_->PictureInPictureStopped(); } ",0 "static void tcp_v6_clear_md5_list (struct sock *sk) { struct tcp_sock *tp = tcp_sk(sk); int i; if (tp->md5sig_info->entries6) { for (i = 0; i < tp->md5sig_info->entries6; i++) kfree(tp->md5sig_info->keys6[i].base.key); tp->md5sig_info->entries6 = 0; tcp_free_md5sig_pool(); } kfree(tp->md5sig_info->keys6); tp->md5sig_info->keys6 = NULL; tp->md5sig_info->alloced6 = 0; if (tp->md5sig_info->entries4) { for (i = 0; i < tp->md5sig_info->entries4; i++) kfree(tp->md5sig_info->keys4[i].base.key); tp->md5sig_info->entries4 = 0; tcp_free_md5sig_pool(); } kfree(tp->md5sig_info->keys4); tp->md5sig_info->keys4 = NULL; tp->md5sig_info->alloced4 = 0; } ",0 "static void arcmsr_hbaD_stop_bgrb(struct AdapterControlBlock *pACB) { struct MessageUnit_D *reg = pACB->pmuD; pACB->acb_flags &= ~ACB_F_MSG_START_BGRB; writel(ARCMSR_INBOUND_MESG0_STOP_BGRB, reg->inbound_msgaddr0); if (!arcmsr_hbaD_wait_msgint_ready(pACB)) pr_notice(""arcmsr%d: wait 'stop adapter background rebulid' "" ""timeout\n"", pACB->host->host_no); } ",0 "static void reset_wcr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd) { vcpu->arch.vcpu_debug_state.dbg_wcr[rd->reg] = rd->val; } ",0 "PassRefPtrWillBeRawPtr Document::caretRangeFromPoint(int x, int y) { if (!layoutView()) return nullptr; HitTestResult result = hitTestInDocument(this, x, y); PositionWithAffinity positionWithAffinity = result.position(); if (positionWithAffinity.position().isNull()) return nullptr; Position rangeCompliantPosition = positionWithAffinity.position().parentAnchoredEquivalent(); return Range::createAdjustedToTreeScope(*this, rangeCompliantPosition); } ",0 "static void d_walk(struct dentry *parent, void *data, enum d_walk_ret (*enter)(void *, struct dentry *), void (*finish)(void *)) { struct dentry *this_parent; struct list_head *next; unsigned seq = 0; enum d_walk_ret ret; bool retry = true; again: read_seqbegin_or_lock(&rename_lock, &seq); this_parent = parent; spin_lock(&this_parent->d_lock); ret = enter(data, this_parent); switch (ret) { case D_WALK_CONTINUE: break; case D_WALK_QUIT: case D_WALK_SKIP: goto out_unlock; case D_WALK_NORETRY: retry = false; break; } repeat: next = this_parent->d_subdirs.next; resume: while (next != &this_parent->d_subdirs) { struct list_head *tmp = next; struct dentry *dentry = list_entry(tmp, struct dentry, d_child); next = tmp->next; if (unlikely(dentry->d_flags & DCACHE_DENTRY_CURSOR)) continue; spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); ret = enter(data, dentry); switch (ret) { case D_WALK_CONTINUE: break; case D_WALK_QUIT: spin_unlock(&dentry->d_lock); goto out_unlock; case D_WALK_NORETRY: retry = false; break; case D_WALK_SKIP: spin_unlock(&dentry->d_lock); continue; } if (!list_empty(&dentry->d_subdirs)) { spin_unlock(&this_parent->d_lock); spin_release(&dentry->d_lock.dep_map, 1, _RET_IP_); this_parent = dentry; spin_acquire(&this_parent->d_lock.dep_map, 0, 1, _RET_IP_); goto repeat; } spin_unlock(&dentry->d_lock); } /* * All done at this level ... ascend and resume the search. */ rcu_read_lock(); ascend: if (this_parent != parent) { struct dentry *child = this_parent; this_parent = child->d_parent; spin_unlock(&child->d_lock); spin_lock(&this_parent->d_lock); /* might go back up the wrong parent if we have had a rename. */ if (need_seqretry(&rename_lock, seq)) goto rename_retry; /* go into the first sibling still alive */ do { next = child->d_child.next; if (next == &this_parent->d_subdirs) goto ascend; child = list_entry(next, struct dentry, d_child); } while (unlikely(child->d_flags & DCACHE_DENTRY_KILLED)); rcu_read_unlock(); goto resume; } if (need_seqretry(&rename_lock, seq)) goto rename_retry; rcu_read_unlock(); if (finish) finish(data); out_unlock: spin_unlock(&this_parent->d_lock); done_seqretry(&rename_lock, seq); return; rename_retry: spin_unlock(&this_parent->d_lock); rcu_read_unlock(); BUG_ON(seq & 1); if (!retry) return; seq = 1; goto again; } ",0 "rs_filter_get_size(RSFilter *filter, const RSFilterRequest *request) { RSFilterResponse *response = NULL; g_return_val_if_fail(RS_IS_FILTER(filter), NULL); g_return_val_if_fail(RS_IS_FILTER_REQUEST(request), NULL); if (RS_FILTER_GET_CLASS(filter)->get_size && filter->enabled) response = RS_FILTER_GET_CLASS(filter)->get_size(filter, request); else if (filter->previous) response = rs_filter_get_size(filter->previous, request); return response; } ",0 "SkCodec::SkScanlineOrder SkIcoCodec::onGetScanlineOrder() const { if (fCurrScanlineCodec) { SkASSERT(!fCurrIncrementalCodec); return fCurrScanlineCodec->getScanlineOrder(); } if (fCurrIncrementalCodec) { return fCurrIncrementalCodec->getScanlineOrder(); } return INHERITED::onGetScanlineOrder(); } ",0 "slow_search_backward(OnigEncoding enc, UChar* target, UChar* target_end, const UChar* text, const UChar* adjust_text, const UChar* text_end, const UChar* text_start) { UChar *t, *p, *s; s = (UChar* )text_end; s -= (target_end - target); if (s > text_start) s = (UChar* )text_start; else s = ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc, adjust_text, s); while (s >= text) { if (*s == *target) { p = s + 1; t = target + 1; while (t < target_end) { if (*t != *p++) break; t++; } if (t == target_end) return s; } s = (UChar* )onigenc_get_prev_char_head(enc, adjust_text, s); } return (UChar* )NULL; } ",0 "static int ep_remove(struct eventpoll *ep, struct epitem *epi) { unsigned long flags; struct file *file = epi->ffd.file; /* * Removes poll wait queue hooks. We _have_ to do this without holding * the ""ep->lock"" otherwise a deadlock might occur. This because of the * sequence of the lock acquisition. Here we do ""ep->lock"" then the wait * queue head lock when unregistering the wait queue. The wakeup callback * will run by holding the wait queue head lock and will call our callback * that will try to get ""ep->lock"". */ ep_unregister_pollwait(ep, epi); /* Remove the current item from the list of epoll hooks */ spin_lock(&file->f_lock); if (ep_is_linked(&epi->fllink)) list_del_init(&epi->fllink); spin_unlock(&file->f_lock); rb_erase(&epi->rbn, &ep->rbr); spin_lock_irqsave(&ep->lock, flags); if (ep_is_linked(&epi->rdllink)) list_del_init(&epi->rdllink); spin_unlock_irqrestore(&ep->lock, flags); /* At this point it is safe to free the eventpoll item */ kmem_cache_free(epi_cache, epi); atomic_long_dec(&ep->user->epoll_watches); return 0; } ",0 "struct mm_struct *get_task_mm(struct task_struct *task) { struct mm_struct *mm; task_lock(task); mm = task->mm; if (mm) { if (task->flags & PF_KTHREAD) mm = NULL; else mmget(mm); } task_unlock(task); return mm; } ",0 "DWORD OmniboxViewWin::EditDropTarget::OnDragOver(IDataObject* data_object, DWORD key_state, POINT cursor_position, DWORD effect) { if (drag_has_url_) return CopyOrLinkDropEffect(effect); if (drag_has_string_) { UpdateDropHighlightPosition(cursor_position); if (edit_->drop_highlight_position() == -1 && edit_->in_drag()) return DROPEFFECT_NONE; if (edit_->in_drag()) { DCHECK((effect & DROPEFFECT_COPY) && (effect & DROPEFFECT_MOVE)); return (key_state & MK_CONTROL) ? DROPEFFECT_COPY : DROPEFFECT_MOVE; } return CopyOrLinkDropEffect(effect); } return DROPEFFECT_NONE; } ",0 "MagickExport void ImagesToCustomStream(const ImageInfo *image_info, Image *images,ExceptionInfo *exception) { const MagickInfo *magick_info; ImageInfo *clone_info; MagickBooleanType blob_support, status; 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(images != (Image *) NULL); assert(images->signature == MagickCoreSignature); assert(image_info->custom_stream != (CustomStreamInfo *) NULL); assert(image_info->custom_stream->signature == MagickCoreSignature); assert(image_info->custom_stream->reader != (CustomStreamHandler) NULL); assert(image_info->custom_stream->writer != (CustomStreamHandler) NULL); assert(exception != (ExceptionInfo *) NULL); clone_info=CloneImageInfo(image_info); (void) SetImageInfo(clone_info,(unsigned int) GetImageListLength(images), exception); if (*clone_info->magick != '\0') (void) CopyMagickString(images->magick,clone_info->magick,MagickPathExtent); magick_info=GetMagickInfo(images->magick,exception); if (magick_info == (const MagickInfo *) NULL) { (void) ThrowMagickException(exception,GetMagickModule(), MissingDelegateError,""NoEncodeDelegateForThisImageFormat"",""`%s'"", images->magick); clone_info=DestroyImageInfo(clone_info); return; } (void) CopyMagickString(clone_info->magick,images->magick,MagickPathExtent); blob_support=GetMagickBlobSupport(magick_info); if ((blob_support != MagickFalse) && (GetMagickEncoderSeekableStream(magick_info) != MagickFalse)) { if ((clone_info->custom_stream->seeker == (CustomStreamSeeker) NULL) || (clone_info->custom_stream->teller == (CustomStreamTeller) NULL)) blob_support=MagickFalse; } if (blob_support != MagickFalse) { /* Native blob support for this image format. */ (void) CloseBlob(images); *images->filename='\0'; (void) WriteImages(clone_info,images,images->filename,exception); (void) CloseBlob(images); } else { char filename[MagickPathExtent], unique[MagickPathExtent]; int file; unsigned char *blob; /* Write file to disk in blob image format. */ clone_info->custom_stream=(CustomStreamInfo *) NULL; blob=(unsigned char *) AcquireQuantumMemory(MagickMaxBufferExtent, sizeof(*blob)); if (blob == (unsigned char *) NULL) { ThrowFileException(exception,BlobError,""UnableToWriteBlob"", image_info->filename); clone_info=DestroyImageInfo(clone_info); return; } file=AcquireUniqueFileResource(unique); if (file == -1) { ThrowFileException(exception,BlobError,""UnableToWriteBlob"", image_info->filename); blob=(unsigned char *) RelinquishMagickMemory(blob); clone_info=DestroyImageInfo(clone_info); return; } clone_info->file=fdopen(file,""wb+""); if (clone_info->file != (FILE *) NULL) { ssize_t count; (void) FormatLocaleString(filename,MagickPathExtent,""%s:%s"", images->magick,unique); status=WriteImages(clone_info,images,filename,exception); (void) CloseBlob(images); if (status != MagickFalse) { (void) fseek(clone_info->file,0,SEEK_SET); count=(ssize_t) MagickMaxBufferExtent; while (count == (ssize_t) MagickMaxBufferExtent) { count=(ssize_t) fread(blob,sizeof(*blob),MagickMaxBufferExtent, clone_info->file); (void) image_info->custom_stream->writer(blob,(size_t) count, image_info->custom_stream->data); } } (void) fclose(clone_info->file); } blob=(unsigned char *) RelinquishMagickMemory(blob); (void) RelinquishUniqueFileResource(unique); } clone_info=DestroyImageInfo(clone_info); } ",0 "int jas_image_depalettize(jas_image_t *image, int cmptno, int numlutents, int_fast32_t *lutents, int dtype, int newcmptno) { jas_image_cmptparm_t cmptparms; int_fast32_t v; int i; int j; jas_image_cmpt_t *cmpt; cmpt = image->cmpts_[cmptno]; cmptparms.tlx = cmpt->tlx_; cmptparms.tly = cmpt->tly_; cmptparms.hstep = cmpt->hstep_; cmptparms.vstep = cmpt->vstep_; cmptparms.width = cmpt->width_; cmptparms.height = cmpt->height_; cmptparms.prec = JAS_IMAGE_CDT_GETPREC(dtype); cmptparms.sgnd = JAS_IMAGE_CDT_GETSGND(dtype); if (jas_image_addcmpt(image, newcmptno, &cmptparms)) { return -1; } if (newcmptno <= cmptno) { ++cmptno; cmpt = image->cmpts_[cmptno]; } for (j = 0; j < cmpt->height_; ++j) { for (i = 0; i < cmpt->width_; ++i) { v = jas_image_readcmptsample(image, cmptno, i, j); if (v < 0) { v = 0; } else if (v >= numlutents) { v = numlutents - 1; } jas_image_writecmptsample(image, newcmptno, i, j, lutents[v]); } } return 0; } ",0 " AppendComponentTransform() {} ",0 "struct super_block *sget(struct file_system_type *type, int (*test)(struct super_block *,void *), int (*set)(struct super_block *,void *), int flags, void *data) { struct super_block *s = NULL; struct super_block *old; int err; retry: spin_lock(&sb_lock); if (test) { hlist_for_each_entry(old, &type->fs_supers, s_instances) { if (!test(old, data)) continue; if (!grab_super(old)) goto retry; if (s) { up_write(&s->s_umount); destroy_super(s); s = NULL; } return old; } } if (!s) { spin_unlock(&sb_lock); s = alloc_super(type, flags); if (!s) return ERR_PTR(-ENOMEM); goto retry; } err = set(s, data); if (err) { spin_unlock(&sb_lock); up_write(&s->s_umount); destroy_super(s); return ERR_PTR(err); } s->s_type = type; strlcpy(s->s_id, type->name, sizeof(s->s_id)); list_add_tail(&s->s_list, &super_blocks); hlist_add_head(&s->s_instances, &type->fs_supers); spin_unlock(&sb_lock); get_filesystem(type); register_shrinker(&s->s_shrink); return s; } ",0 "static int mem_close(jas_stream_obj_t *obj) { JAS_DBGLOG(100, (""mem_close(%p)\n"", obj)); jas_stream_memobj_t *m = (jas_stream_memobj_t *)obj; JAS_DBGLOG(100, (""mem_close myalloc=%d\n"", m->myalloc_)); if (m->myalloc_ && m->buf_) { JAS_DBGLOG(100, (""mem_close freeing buffer %p\n"", m->buf_)); jas_free(m->buf_); m->buf_ = 0; } jas_free(obj); return 0; } ",0 "bool AutocompleteEditModel::IsSpaceCharForAcceptingKeyword(wchar_t c) { switch (c) { case 0x0020: // Space case 0x3000: // Ideographic Space return true; default: return false; } } ",0 "static int check_memory_region_flags(struct kvm_userspace_memory_region *mem) { u32 valid_flags = KVM_MEM_LOG_DIRTY_PAGES; #ifdef KVM_CAP_READONLY_MEM valid_flags |= KVM_MEM_READONLY; #endif if (mem->flags & ~valid_flags) return -EINVAL; return 0; } ",0 "static int hid_clear_halt(int sub_api, struct libusb_device_handle *dev_handle, unsigned char endpoint) { struct libusb_context *ctx = DEVICE_CTX(dev_handle->dev); struct windows_device_handle_priv *handle_priv = _device_handle_priv(dev_handle); struct windows_device_priv *priv = _device_priv(dev_handle->dev); HANDLE hid_handle; int current_interface; CHECK_HID_AVAILABLE; current_interface = interface_by_endpoint(priv, handle_priv, endpoint); if (current_interface < 0) { usbi_err(ctx, ""unable to match endpoint to an open interface - cannot clear""); return LIBUSB_ERROR_NOT_FOUND; } usbi_dbg(""matched endpoint %02X with interface %d"", endpoint, current_interface); hid_handle = handle_priv->interface_handle[current_interface].api_handle; if (!HidD_FlushQueue(hid_handle)) { usbi_err(ctx, ""Flushing of HID queue failed: %s"", windows_error_str(0)); return LIBUSB_ERROR_NO_DEVICE; } return LIBUSB_SUCCESS; } ",1 "is_combo(int transforms) { return transforms & (transforms-1); /* non-zero if more than one set bit */ } ",0 "void BluetoothDeviceChooserController::PostSuccessCallback( const std::string& device_address) { if (!base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(success_callback_, std::move(options_), device_address))) { LOG(WARNING) << ""No TaskRunner.""; } } ",0 "static void __exit crc32_pclmul_mod_fini(void) { crypto_unregister_shash(&alg); } ",0 "void WebGLRenderingContextBase::uniform2iv(const WebGLUniformLocation* location, Vector& v) { if (isContextLost() || !ValidateUniformParameters(""uniform2iv"", location, v.data(), v.size(), 2, 0, v.size())) return; ContextGL()->Uniform2iv(location->Location(), v.size() >> 1, v.data()); } ",0 " premultiply_data( png_structp png, png_row_infop row_info, png_bytep data ) { unsigned int i; FT_UNUSED( png ); for ( i = 0; i < row_info->rowbytes; i += 4 ) { unsigned char* base = &data[i]; unsigned int alpha = base[3]; if ( alpha == 0 ) base[0] = base[1] = base[2] = base[3] = 0; else { unsigned int red = base[0]; unsigned int green = base[1]; unsigned int blue = base[2]; if ( alpha != 0xFF ) { red = multiply_alpha( alpha, red ); green = multiply_alpha( alpha, green ); blue = multiply_alpha( alpha, blue ); } base[0] = blue; base[1] = green; base[2] = red; base[3] = alpha; } } } ",0 "static void megasas_soft_reset(MegasasState *s) { int i; MegasasCmd *cmd; trace_megasas_reset(s->fw_state); for (i = 0; i < s->fw_cmds; i++) { cmd = &s->frames[i]; megasas_abort_command(cmd); } if (s->fw_state == MFI_FWSTATE_READY) { BusChild *kid; /* * The EFI firmware doesn't handle UA, * so we need to clear the Power On/Reset UA * after the initial reset. */ QTAILQ_FOREACH(kid, &s->bus.qbus.children, sibling) { SCSIDevice *sdev = SCSI_DEVICE(kid->child); sdev->unit_attention = SENSE_CODE(NO_SENSE); scsi_device_unit_attention_reported(sdev); } } megasas_reset_frames(s); s->reply_queue_len = s->fw_cmds; s->reply_queue_pa = 0; s->consumer_pa = 0; s->producer_pa = 0; s->fw_state = MFI_FWSTATE_READY; s->doorbell = 0; s->intr_mask = MEGASAS_INTR_DISABLED_MASK; s->frame_hi = 0; s->flags &= ~MEGASAS_MASK_USE_QUEUE64; s->event_count++; s->boot_event = s->event_count; } ",0 "bool SyncTest::AwaitQuiescence() { return ProfileSyncServiceHarness::AwaitQuiescence(clients()); } ",0 "static struct sched_domain *__build_numa_sched_domains(struct s_data *d, const struct cpumask *cpu_map, struct sched_domain_attr *attr, int i) { struct sched_domain *sd = NULL; #ifdef CONFIG_NUMA struct sched_domain *parent; d->sd_allnodes = 0; if (cpumask_weight(cpu_map) > SD_NODES_PER_DOMAIN * cpumask_weight(d->nodemask)) { sd = &per_cpu(allnodes_domains, i).sd; SD_INIT(sd, ALLNODES); set_domain_attribute(sd, attr); cpumask_copy(sched_domain_span(sd), cpu_map); cpu_to_allnodes_group(i, cpu_map, &sd->groups, d->tmpmask); d->sd_allnodes = 1; } parent = sd; sd = &per_cpu(node_domains, i).sd; SD_INIT(sd, NODE); set_domain_attribute(sd, attr); sched_domain_node_span(cpu_to_node(i), sched_domain_span(sd)); sd->parent = parent; if (parent) parent->child = sd; cpumask_and(sched_domain_span(sd), sched_domain_span(sd), cpu_map); #endif return sd; } ",0 "get_ping_buffer_for_header (Header *header) { Buffer *buffer; GDBusMessage *dummy; dummy = g_dbus_message_new_method_call (NULL, ""/"", ""org.freedesktop.DBus.Peer"", ""Ping""); g_dbus_message_set_serial (dummy, header->serial); g_dbus_message_set_flags (dummy, header->flags); buffer = message_to_buffer (dummy); g_object_unref (dummy); return buffer; } ",0 "void CLASS subtract (const char *fname) { FILE *fp; int dim[3]={0,0,0}, comment=0, number=0, error=0, nd=0, c, row, col; ushort *pixel; if (!(fp = fopen (fname, ""rb""))) { perror (fname); return; } if (fgetc(fp) != 'P' || fgetc(fp) != '5') error = 1; while (!error && nd < 3 && (c = fgetc(fp)) != EOF) { if (c == '#') comment = 1; if (c == '\n') comment = 0; if (comment) continue; if (isdigit(c)) number = 1; if (number) { if (isdigit(c)) dim[nd] = dim[nd]*10 + c -'0'; else if (isspace(c)) { number = 0; nd++; } else error = 1; } } if (error || nd < 3) { dcraw_message (DCRAW_ERROR,_(""%s is not a valid PGM file!\n""), fname); fclose (fp); return; } else if (dim[0] != width || dim[1] != height || dim[2] != 65535) { dcraw_message (DCRAW_ERROR,_(""%s has the wrong dimensions!\n""), fname); fclose (fp); return; } pixel = (ushort *) calloc (width, sizeof *pixel); merror (pixel, ""subtract()""); for (row=0; row < height; row++) { fread (pixel, 2, width, fp); for (col=0; col < width; col++) BAYER(row,col) = MAX (BAYER(row,col) - ntohs(pixel[col]), 0); } free (pixel); fclose (fp); memset (cblack, 0, sizeof cblack); black = 0; } ",0 "static void phar_copy_cached_phar(phar_archive_data **pphar TSRMLS_DC) /* {{{ */ { phar_archive_data *phar; HashTable newmanifest; char *fname; phar_archive_object **objphar; phar = (phar_archive_data *) emalloc(sizeof(phar_archive_data)); *phar = **pphar; phar->is_persistent = 0; fname = phar->fname; phar->fname = estrndup(phar->fname, phar->fname_len); phar->ext = phar->fname + (phar->ext - fname); if (phar->alias) { phar->alias = estrndup(phar->alias, phar->alias_len); } if (phar->signature) { phar->signature = estrdup(phar->signature); } if (phar->metadata) { /* assume success, we would have failed before */ if (phar->metadata_len) { char *buf = estrndup((char *) phar->metadata, phar->metadata_len); phar_parse_metadata(&buf, &phar->metadata, phar->metadata_len TSRMLS_CC); efree(buf); } else { zval *t; t = phar->metadata; ALLOC_ZVAL(phar->metadata); *phar->metadata = *t; zval_copy_ctor(phar->metadata); Z_SET_REFCOUNT_P(phar->metadata, 1); } } zend_hash_init(&newmanifest, sizeof(phar_entry_info), zend_get_hash_value, destroy_phar_manifest_entry, 0); zend_hash_copy(&newmanifest, &(*pphar)->manifest, NULL, NULL, sizeof(phar_entry_info)); zend_hash_apply_with_argument(&newmanifest, (apply_func_arg_t) phar_update_cached_entry, (void *)phar TSRMLS_CC); phar->manifest = newmanifest; zend_hash_init(&phar->mounted_dirs, sizeof(char *), zend_get_hash_value, NULL, 0); zend_hash_init(&phar->virtual_dirs, sizeof(char *), zend_get_hash_value, NULL, 0); zend_hash_copy(&phar->virtual_dirs, &(*pphar)->virtual_dirs, NULL, NULL, sizeof(void *)); *pphar = phar; /* now, scan the list of persistent Phar objects referencing this phar and update the pointers */ for (zend_hash_internal_pointer_reset(&PHAR_GLOBALS->phar_persist_map); SUCCESS == zend_hash_get_current_data(&PHAR_GLOBALS->phar_persist_map, (void **) &objphar); zend_hash_move_forward(&PHAR_GLOBALS->phar_persist_map)) { if (objphar[0]->arc.archive->fname_len == phar->fname_len && !memcmp(objphar[0]->arc.archive->fname, phar->fname, phar->fname_len)) { objphar[0]->arc.archive = phar; } } } /* }}} */ ",0 " MockAudioRendererHost(base::RunLoop* auth_run_loop, int render_process_id, media::AudioManager* audio_manager, AudioMirroringManager* mirroring_manager, MediaStreamManager* media_stream_manager, const std::string& salt) : AudioRendererHost(render_process_id, audio_manager, mirroring_manager, media_stream_manager, salt), shared_memory_length_(0), auth_run_loop_(auth_run_loop) { set_render_frame_id_validate_function_for_testing(&ValidateRenderFrameId); } ",1 "void ExtensionHelper::DidDownloadApplicationDefinition( const WebKit::WebURLResponse& response, const std::string& data) { scoped_ptr app_info( pending_app_info_.release()); JSONStringValueSerializer serializer(data); int error_code = 0; std::string error_message; scoped_ptr result(serializer.Deserialize(&error_code, &error_message)); if (!result.get()) { AddErrorToRootConsole(UTF8ToUTF16(error_message)); return; } string16 error_message_16; if (!web_apps::ParseWebAppFromDefinitionFile(result.get(), app_info.get(), &error_message_16)) { AddErrorToRootConsole(error_message_16); return; } if (!app_info->icons.empty()) { pending_app_info_.reset(app_info.release()); pending_app_icon_requests_ = static_cast(pending_app_info_->icons.size()); for (size_t i = 0; i < pending_app_info_->icons.size(); ++i) { app_icon_fetchers_.push_back(linked_ptr( new ImageResourceFetcher( pending_app_info_->icons[i].url, render_view()->GetWebView()->mainFrame(), static_cast(i), pending_app_info_->icons[i].width, WebURLRequest::TargetIsFavicon, base::Bind( &ExtensionHelper::DidDownloadApplicationIcon, base::Unretained(this))))); } } else { Send(new ExtensionHostMsg_InstallApplication(routing_id(), *app_info)); } } ",0 "set_path(const struct passwd* pw) { int r; if (pw->pw_uid) r = logindefs_setenv(""PATH"", ""ENV_PATH"", _PATH_DEFPATH); else if ((r = logindefs_setenv(""PATH"", ""ENV_ROOTPATH"", NULL)) != 0) r = logindefs_setenv(""PATH"", ""ENV_SUPATH"", _PATH_DEFPATH_ROOT); if (r != 0) err (EXIT_FAILURE, _(""failed to set the %s environment variable""), ""PATH""); } ",0 "pkinit_init_kdc_profile(krb5_context context, pkinit_kdc_context plgctx) { krb5_error_code retval; char *eku_string = NULL; pkiDebug(""%s: entered for realm %s\n"", __FUNCTION__, plgctx->realmname); retval = pkinit_kdcdefault_string(context, plgctx->realmname, KRB5_CONF_PKINIT_IDENTITY, &plgctx->idopts->identity); if (retval != 0 || NULL == plgctx->idopts->identity) { retval = EINVAL; krb5_set_error_message(context, retval, _(""No pkinit_identity supplied for realm %s""), plgctx->realmname); goto errout; } retval = pkinit_kdcdefault_strings(context, plgctx->realmname, KRB5_CONF_PKINIT_ANCHORS, &plgctx->idopts->anchors); if (retval != 0 || NULL == plgctx->idopts->anchors) { retval = EINVAL; krb5_set_error_message(context, retval, _(""No pkinit_anchors supplied for realm %s""), plgctx->realmname); goto errout; } pkinit_kdcdefault_strings(context, plgctx->realmname, KRB5_CONF_PKINIT_POOL, &plgctx->idopts->intermediates); pkinit_kdcdefault_strings(context, plgctx->realmname, KRB5_CONF_PKINIT_REVOKE, &plgctx->idopts->crls); pkinit_kdcdefault_string(context, plgctx->realmname, KRB5_CONF_PKINIT_KDC_OCSP, &plgctx->idopts->ocsp); pkinit_kdcdefault_integer(context, plgctx->realmname, KRB5_CONF_PKINIT_DH_MIN_BITS, PKINIT_DEFAULT_DH_MIN_BITS, &plgctx->opts->dh_min_bits); if (plgctx->opts->dh_min_bits < PKINIT_DH_MIN_CONFIG_BITS) { pkiDebug(""%s: invalid value (%d < %d) for pkinit_dh_min_bits, "" ""using default value (%d) instead\n"", __FUNCTION__, plgctx->opts->dh_min_bits, PKINIT_DH_MIN_CONFIG_BITS, PKINIT_DEFAULT_DH_MIN_BITS); plgctx->opts->dh_min_bits = PKINIT_DEFAULT_DH_MIN_BITS; } pkinit_kdcdefault_boolean(context, plgctx->realmname, KRB5_CONF_PKINIT_ALLOW_UPN, 0, &plgctx->opts->allow_upn); pkinit_kdcdefault_boolean(context, plgctx->realmname, KRB5_CONF_PKINIT_REQUIRE_CRL_CHECKING, 0, &plgctx->opts->require_crl_checking); pkinit_kdcdefault_string(context, plgctx->realmname, KRB5_CONF_PKINIT_EKU_CHECKING, &eku_string); if (eku_string != NULL) { if (strcasecmp(eku_string, ""kpClientAuth"") == 0) { plgctx->opts->require_eku = 1; plgctx->opts->accept_secondary_eku = 0; } else if (strcasecmp(eku_string, ""scLogin"") == 0) { plgctx->opts->require_eku = 1; plgctx->opts->accept_secondary_eku = 1; } else if (strcasecmp(eku_string, ""none"") == 0) { plgctx->opts->require_eku = 0; plgctx->opts->accept_secondary_eku = 0; } else { pkiDebug(""%s: Invalid value for pkinit_eku_checking: '%s'\n"", __FUNCTION__, eku_string); } free(eku_string); } return 0; errout: pkinit_fini_kdc_profile(context, plgctx); return retval; } ",0 "void RenderBox::addLayerHitTestRects(LayerHitTestRects& layerRects, const RenderLayer* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) const { LayoutPoint adjustedLayerOffset = layerOffset + locationOffset(); RenderBoxModelObject::addLayerHitTestRects(layerRects, currentLayer, adjustedLayerOffset, containerRect); } ",0 "bool ExtensionDevToolsClientHost::MayAttachToBrowser() { return false; } ",0 "static void nfs_commit_release_pages(struct nfs_commit_data *data) { struct nfs_page *req; int status = data->task.tk_status; struct nfs_commit_info cinfo; while (!list_empty(&data->pages)) { req = nfs_list_entry(data->pages.next); nfs_list_remove_request(req); nfs_clear_page_commit(req->wb_page); dprintk(""NFS: commit (%s/%llu %d@%lld)"", req->wb_context->dentry->d_sb->s_id, (unsigned long long)NFS_FILEID(req->wb_context->dentry->d_inode), req->wb_bytes, (long long)req_offset(req)); if (status < 0) { nfs_context_set_write_error(req->wb_context, status); nfs_inode_remove_request(req); dprintk("", error = %d\n"", status); goto next; } /* Okay, COMMIT succeeded, apparently. Check the verifier * returned by the server against all stored verfs. */ if (!memcmp(&req->wb_verf, &data->verf.verifier, sizeof(req->wb_verf))) { /* We have a match */ nfs_inode_remove_request(req); dprintk("" OK\n""); goto next; } /* We have a mismatch. Write the page again */ dprintk("" mismatch\n""); nfs_mark_request_dirty(req); set_bit(NFS_CONTEXT_RESEND_WRITES, &req->wb_context->flags); next: nfs_unlock_and_release_request(req); } nfs_init_cinfo(&cinfo, data->inode, data->dreq); if (atomic_dec_and_test(&cinfo.mds->rpcs_out)) nfs_commit_clear_lock(NFS_I(data->inode)); } ",0 "void CustomButton::AnimationProgressed(const gfx::Animation* animation) { SchedulePaint(); } ",0 "static int mipspmu_add(struct perf_event *event, int flags) { struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); struct hw_perf_event *hwc = &event->hw; int idx; int err = 0; perf_pmu_disable(event->pmu); /* To look for a free counter for this event. */ idx = mipspmu->alloc_counter(cpuc, hwc); if (idx < 0) { err = idx; goto out; } /* * If there is an event in the counter we are going to use then * make sure it is disabled. */ event->hw.idx = idx; mipspmu->disable_event(idx); cpuc->events[idx] = event; hwc->state = PERF_HES_STOPPED | PERF_HES_UPTODATE; if (flags & PERF_EF_START) mipspmu_start(event, PERF_EF_RELOAD); /* Propagate our changes to the userspace mapping. */ perf_event_update_userpage(event); out: perf_pmu_enable(event->pmu); return err; } ",0 "virConnectNumOfDefinedDomains(virConnectPtr conn) { VIR_DEBUG(""conn=%p"", conn); virResetLastError(); virCheckConnectReturn(conn, -1); if (conn->driver->connectNumOfDefinedDomains) { int ret; ret = conn->driver->connectNumOfDefinedDomains(conn); if (ret < 0) goto error; return ret; } virReportUnsupportedError(); error: virDispatchError(conn); return -1; } ",0 " ExtensionDevToolsClientHost* Lookup(WebContents* contents) { for (std::set::iterator it = client_hosts_.begin(); it != client_hosts_.end(); ++it) { DevToolsAgentHost* agent_host = DevToolsManager::GetInstance()->GetDevToolsAgentHostFor(*it); if (!agent_host) continue; content::RenderViewHost* rvh = DevToolsAgentHostRegistry::GetRenderViewHost(agent_host); if (rvh && rvh->GetDelegate() && rvh->GetDelegate()->GetAsWebContents() == contents) return static_cast(*it); } return NULL; } ",0 "static PHP_NAMED_FUNCTION(zif_zip_entry_close) { zval * zip_entry; zip_read_rsrc * zr_rsrc; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""r"", &zip_entry) == FAILURE) { return; } ZEND_FETCH_RESOURCE(zr_rsrc, zip_read_rsrc *, &zip_entry, -1, le_zip_entry_name, le_zip_entry); RETURN_BOOL(SUCCESS == zend_list_delete(Z_LVAL_P(zip_entry))); } ",0 "int64 DownloadItemImpl::GetTotalBytes() const { return total_bytes_; } ",0 "static unsigned char *__struct_ptr(struct f2fs_sb_info *sbi, int struct_type) { if (struct_type == GC_THREAD) return (unsigned char *)sbi->gc_thread; else if (struct_type == SM_INFO) return (unsigned char *)SM_I(sbi); else if (struct_type == DCC_INFO) return (unsigned char *)SM_I(sbi)->dcc_info; else if (struct_type == NM_INFO) return (unsigned char *)NM_I(sbi); else if (struct_type == F2FS_SBI) return (unsigned char *)sbi; #ifdef CONFIG_F2FS_FAULT_INJECTION else if (struct_type == FAULT_INFO_RATE || struct_type == FAULT_INFO_TYPE) return (unsigned char *)&sbi->fault_info; #endif return NULL; } ",0 "int inet6_csk_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl_unused) { struct ipv6_pinfo *np = inet6_sk(sk); struct flowi6 fl6; struct dst_entry *dst; int res; dst = inet6_csk_route_socket(sk, &fl6); if (IS_ERR(dst)) { sk->sk_err_soft = -PTR_ERR(dst); sk->sk_route_caps = 0; kfree_skb(skb); return PTR_ERR(dst); } rcu_read_lock(); skb_dst_set_noref(skb, dst); /* Restore final destination back after routing done */ fl6.daddr = sk->sk_v6_daddr; res = ip6_xmit(sk, skb, &fl6, np->opt, np->tclass); rcu_read_unlock(); return res; } ",1 "struct sctp_chunk *sctp_make_auth(const struct sctp_association *asoc) { struct sctp_chunk *retval; struct sctp_hmac *hmac_desc; struct sctp_authhdr auth_hdr; __u8 *hmac; /* Get the first hmac that the peer told us to use */ hmac_desc = sctp_auth_asoc_get_hmac(asoc); if (unlikely(!hmac_desc)) return NULL; retval = sctp_make_control(asoc, SCTP_CID_AUTH, 0, hmac_desc->hmac_len + sizeof(sctp_authhdr_t)); if (!retval) return NULL; auth_hdr.hmac_id = htons(hmac_desc->hmac_id); auth_hdr.shkey_id = htons(asoc->active_key_id); retval->subh.auth_hdr = sctp_addto_chunk(retval, sizeof(sctp_authhdr_t), &auth_hdr); hmac = skb_put(retval->skb, hmac_desc->hmac_len); memset(hmac, 0, hmac_desc->hmac_len); /* Adjust the chunk header to include the empty MAC */ retval->chunk_hdr->length = htons(ntohs(retval->chunk_hdr->length) + hmac_desc->hmac_len); retval->chunk_end = skb_tail_pointer(retval->skb); return retval; } ",0 "static void webkit_web_view_base_class_init(WebKitWebViewBaseClass* webkitWebViewBaseClass) { GtkWidgetClass* widgetClass = GTK_WIDGET_CLASS(webkitWebViewBaseClass); widgetClass->realize = webkitWebViewBaseRealize; widgetClass->draw = webkitWebViewBaseDraw; widgetClass->size_allocate = webkitWebViewBaseSizeAllocate; widgetClass->map = webkitWebViewBaseMap; widgetClass->focus_in_event = webkitWebViewBaseFocusInEvent; widgetClass->focus_out_event = webkitWebViewBaseFocusOutEvent; widgetClass->key_press_event = webkitWebViewBaseKeyPressEvent; widgetClass->key_release_event = webkitWebViewBaseKeyReleaseEvent; widgetClass->button_press_event = webkitWebViewBaseButtonPressEvent; widgetClass->button_release_event = webkitWebViewBaseButtonReleaseEvent; widgetClass->scroll_event = webkitWebViewBaseScrollEvent; widgetClass->motion_notify_event = webkitWebViewBaseMotionNotifyEvent; widgetClass->query_tooltip = webkitWebViewBaseQueryTooltip; widgetClass->drag_end = webkitWebViewBaseDragEnd; widgetClass->drag_data_get = webkitWebViewBaseDragDataGet; widgetClass->drag_motion = webkitWebViewBaseDragMotion; widgetClass->drag_leave = webkitWebViewBaseDragLeave; widgetClass->drag_drop = webkitWebViewBaseDragDrop; widgetClass->drag_data_received = webkitWebViewBaseDragDataReceived; widgetClass->get_accessible = webkitWebViewBaseGetAccessible; GObjectClass* gobjectClass = G_OBJECT_CLASS(webkitWebViewBaseClass); gobjectClass->finalize = webkitWebViewBaseFinalize; GtkContainerClass* containerClass = GTK_CONTAINER_CLASS(webkitWebViewBaseClass); containerClass->add = webkitWebViewBaseContainerAdd; containerClass->remove = webkitWebViewBaseContainerRemove; containerClass->forall = webkitWebViewBaseContainerForall; g_type_class_add_private(webkitWebViewBaseClass, sizeof(WebKitWebViewBasePrivate)); } ",0 "NetworkChangeNotifierMac::NetworkChangeCalculatorParamsMac() { NetworkChangeCalculatorParams params; params.ip_address_offline_delay_ = base::TimeDelta::FromMilliseconds(500); params.ip_address_online_delay_ = base::TimeDelta::FromMilliseconds(500); params.connection_type_offline_delay_ = base::TimeDelta::FromMilliseconds(1000); params.connection_type_online_delay_ = base::TimeDelta::FromMilliseconds(500); return params; } ",0 "SProcXvQueryImageAttributes(ClientPtr client) { REQUEST(xvQueryImageAttributesReq); REQUEST_SIZE_MATCH(xvQueryImageAttributesReq); swaps(&stuff->length); swapl(&stuff->port); swapl(&stuff->id); swaps(&stuff->width); swaps(&stuff->height); return XvProcVector[xv_QueryImageAttributes] (client); } ",0 "armv6pmu_get_event_idx(struct cpu_hw_events *cpuc, struct hw_perf_event *event) { /* Always place a cycle counter into the cycle counter. */ if (ARMV6_PERFCTR_CPU_CYCLES == event->config_base) { if (test_and_set_bit(ARMV6_CYCLE_COUNTER, cpuc->used_mask)) return -EAGAIN; return ARMV6_CYCLE_COUNTER; } else { /* * For anything other than a cycle counter, try and use * counter0 and counter1. */ if (!test_and_set_bit(ARMV6_COUNTER1, cpuc->used_mask)) return ARMV6_COUNTER1; if (!test_and_set_bit(ARMV6_COUNTER0, cpuc->used_mask)) return ARMV6_COUNTER0; /* The counters are all in use. */ return -EAGAIN; } } ",0 "static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu) { struct dst_entry *dst = &rt->dst; u32 old_mtu = ipv4_mtu(dst); struct fib_result res; bool lock = false; if (ip_mtu_locked(dst)) return; if (old_mtu < mtu) return; if (mtu < ip_rt_min_pmtu) { lock = true; mtu = min(old_mtu, ip_rt_min_pmtu); } if (rt->rt_pmtu == mtu && !lock && time_before(jiffies, dst->expires - ip_rt_mtu_expires / 2)) return; rcu_read_lock(); if (fib_lookup(dev_net(dst->dev), fl4, &res, 0) == 0) { struct fib_nh *nh = &FIB_RES_NH(res); update_or_create_fnhe(nh, fl4->daddr, 0, mtu, lock, jiffies + ip_rt_mtu_expires); } rcu_read_unlock(); } ",0 "void WebPageProxy::ignoreWord(const String& word) { MESSAGE_CHECK(m_pendingLearnOrIgnoreWordMessageCount); --m_pendingLearnOrIgnoreWordMessageCount; TextChecker::ignoreWord(spellDocumentTag(), word); } ",0 "MostVisitedSitesBridge::~MostVisitedSitesBridge() {} ",0 "int phar_create_signature(phar_archive_data *phar, php_stream *fp, char **signature, int *signature_length, char **error) /* {{{ */ { unsigned char buf[1024]; int sig_len; php_stream_rewind(fp); if (phar->signature) { efree(phar->signature); phar->signature = NULL; } switch(phar->sig_flags) { #ifdef PHAR_HASH_OK case PHAR_SIG_SHA512: { unsigned char digest[64]; PHP_SHA512_CTX context; PHP_SHA512Init(&context); while ((sig_len = php_stream_read(fp, (char*)buf, sizeof(buf))) > 0) { PHP_SHA512Update(&context, buf, sig_len); } PHP_SHA512Final(digest, &context); *signature = estrndup((char *) digest, 64); *signature_length = 64; break; } case PHAR_SIG_SHA256: { unsigned char digest[32]; PHP_SHA256_CTX context; PHP_SHA256Init(&context); while ((sig_len = php_stream_read(fp, (char*)buf, sizeof(buf))) > 0) { PHP_SHA256Update(&context, buf, sig_len); } PHP_SHA256Final(digest, &context); *signature = estrndup((char *) digest, 32); *signature_length = 32; break; } #else case PHAR_SIG_SHA512: case PHAR_SIG_SHA256: if (error) { spprintf(error, 0, ""unable to write to phar \""%s\"" with requested hash type"", phar->fname); } return FAILURE; #endif case PHAR_SIG_OPENSSL: { int siglen; unsigned char *sigbuf; #ifdef PHAR_HAVE_OPENSSL BIO *in; EVP_PKEY *key; EVP_MD_CTX *md_ctx; in = BIO_new_mem_buf(PHAR_G(openssl_privatekey), PHAR_G(openssl_privatekey_len)); if (in == NULL) { if (error) { spprintf(error, 0, ""unable to write to phar \""%s\"" with requested openssl signature"", phar->fname); } return FAILURE; } key = PEM_read_bio_PrivateKey(in, NULL,NULL, """"); BIO_free(in); if (!key) { if (error) { spprintf(error, 0, ""unable to process private key""); } return FAILURE; } md_ctx = EVP_MD_CTX_create(); siglen = EVP_PKEY_size(key); sigbuf = emalloc(siglen + 1); if (!EVP_SignInit(md_ctx, EVP_sha1())) { efree(sigbuf); if (error) { spprintf(error, 0, ""unable to initialize openssl signature for phar \""%s\"""", phar->fname); } return FAILURE; } while ((sig_len = php_stream_read(fp, (char*)buf, sizeof(buf))) > 0) { if (!EVP_SignUpdate(md_ctx, buf, sig_len)) { efree(sigbuf); if (error) { spprintf(error, 0, ""unable to update the openssl signature for phar \""%s\"""", phar->fname); } return FAILURE; } } if (!EVP_SignFinal (md_ctx, sigbuf,(unsigned int *)&siglen, key)) { efree(sigbuf); if (error) { spprintf(error, 0, ""unable to write phar \""%s\"" with requested openssl signature"", phar->fname); } return FAILURE; } sigbuf[siglen] = '\0'; EVP_MD_CTX_destroy(md_ctx); #else sigbuf = NULL; siglen = 0; php_stream_seek(fp, 0, SEEK_END); if (FAILURE == phar_call_openssl_signverify(1, fp, php_stream_tell(fp), PHAR_G(openssl_privatekey), PHAR_G(openssl_privatekey_len), (char **)&sigbuf, &siglen)) { if (error) { spprintf(error, 0, ""unable to write phar \""%s\"" with requested openssl signature"", phar->fname); } return FAILURE; } #endif *signature = (char *) sigbuf; *signature_length = siglen; } break; default: phar->sig_flags = PHAR_SIG_SHA1; case PHAR_SIG_SHA1: { unsigned char digest[20]; PHP_SHA1_CTX context; PHP_SHA1Init(&context); while ((sig_len = php_stream_read(fp, (char*)buf, sizeof(buf))) > 0) { PHP_SHA1Update(&context, buf, sig_len); } PHP_SHA1Final(digest, &context); *signature = estrndup((char *) digest, 20); *signature_length = 20; break; } case PHAR_SIG_MD5: { unsigned char digest[16]; PHP_MD5_CTX context; PHP_MD5Init(&context); while ((sig_len = php_stream_read(fp, (char*)buf, sizeof(buf))) > 0) { PHP_MD5Update(&context, buf, sig_len); } PHP_MD5Final(digest, &context); *signature = estrndup((char *) digest, 16); *signature_length = 16; break; } } phar->sig_len = phar_hex_str((const char *)*signature, *signature_length, &phar->signature); return SUCCESS; } /* }}} */ ",0 "void ClipboardMessageFilter::OnReadAvailableTypes( ui::Clipboard::Buffer buffer, std::vector* types, bool* contains_filenames) { GetClipboard()->ReadAvailableTypes(buffer, types, contains_filenames); } ",0 "void RenderViewImpl::OnSetHistoryLengthAndPrune(int history_length, int32 minimum_page_id) { DCHECK_GE(history_length, 0); DCHECK(history_list_offset_ == history_list_length_ - 1); DCHECK_GE(minimum_page_id, -1); std::vector new_history_page_ids(history_length, -1); for (size_t i = 0; i < history_page_ids_.size(); ++i) { if (minimum_page_id >= 0 && history_page_ids_[i] < minimum_page_id) continue; new_history_page_ids.push_back(history_page_ids_[i]); } new_history_page_ids.swap(history_page_ids_); history_list_length_ = history_page_ids_.size(); history_list_offset_ = history_list_length_ - 1; } ",0 "compile_tree_n_times(Node* node, int n, regex_t* reg, ScanEnv* env) { int i, r; for (i = 0; i < n; i++) { r = compile_tree(node, reg, env); if (r != 0) return r; } return 0; } ",0 "irc_server_set_buffer_title (struct t_irc_server *server) { char *title; int length; if (server && server->buffer) { if (server->is_connected) { length = 16 + ((server->current_address) ? strlen (server->current_address) : 16) + 16 + ((server->current_ip) ? strlen (server->current_ip) : 16) + 1; title = malloc (length); if (title) { snprintf (title, length, ""IRC: %s/%d (%s)"", server->current_address, server->current_port, (server->current_ip) ? server->current_ip : """"); weechat_buffer_set (server->buffer, ""title"", title); free (title); } } else { weechat_buffer_set (server->buffer, ""title"", """"); } } } ",0 "ofputil_encode_queue_stats_request(enum ofp_version ofp_version, const struct ofputil_queue_stats_request *oqsr) { struct ofpbuf *request; switch (ofp_version) { case OFP11_VERSION: case OFP12_VERSION: case OFP13_VERSION: case OFP14_VERSION: case OFP15_VERSION: case OFP16_VERSION: { struct ofp11_queue_stats_request *req; request = ofpraw_alloc(OFPRAW_OFPST11_QUEUE_REQUEST, ofp_version, 0); req = ofpbuf_put_zeros(request, sizeof *req); req->port_no = ofputil_port_to_ofp11(oqsr->port_no); req->queue_id = htonl(oqsr->queue_id); break; } case OFP10_VERSION: { struct ofp10_queue_stats_request *req; request = ofpraw_alloc(OFPRAW_OFPST10_QUEUE_REQUEST, ofp_version, 0); req = ofpbuf_put_zeros(request, sizeof *req); /* OpenFlow 1.0 needs OFPP_ALL instead of OFPP_ANY */ req->port_no = htons(ofp_to_u16(oqsr->port_no == OFPP_ANY ? OFPP_ALL : oqsr->port_no)); req->queue_id = htonl(oqsr->queue_id); break; } default: OVS_NOT_REACHED(); } return request; } ",0 "_PUBLIC_ char *strlower_talloc(TALLOC_CTX *ctx, const char *src) { struct smb_iconv_handle *iconv_handle = get_iconv_handle(); return strlower_talloc_handle(iconv_handle, ctx, src); } ",0 "void __net_exit ip_vs_control_net_cleanup_sysctl(struct net *net) { struct netns_ipvs *ipvs = net_ipvs(net); cancel_delayed_work_sync(&ipvs->defense_work); cancel_work_sync(&ipvs->defense_work.work); unregister_net_sysctl_table(ipvs->sysctl_hdr); } ",0 "void ScopedFrameBlamer::LeaveContext() { LocalFrameClient* client = frame_->Client(); if (!client) return; if (BlameContext* context = client->GetFrameBlameContext()) context->Leave(); } ",0 " CompositorSwapClient(ui::Compositor* compositor, GpuProcessTransportFactory* factory) : compositor_(compositor), factory_(factory) { } ",0 "map_call_default(map_op_t op) { script_run(s_def_map_scripts[op], false); } ",0 "void Resource::FinishPendingClients() { HeapVector> clients_to_notify; CopyToVector(clients_awaiting_callback_, clients_to_notify); for (const auto& client : clients_to_notify) { if (!clients_awaiting_callback_.erase(client)) continue; clients_.insert(client); if (!is_revalidating_) DidAddClient(client); } bool scheduled = async_finish_pending_clients_task_.IsActive(); if (scheduled && clients_awaiting_callback_.IsEmpty()) async_finish_pending_clients_task_.Cancel(); DCHECK(clients_awaiting_callback_.IsEmpty() || scheduled); } ",0 "PHP_FUNCTION(imagewbmp) { _php_image_output_ctx(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_WBM, ""WBMP"", gdImageWBMPCtx); } ",0 "RootWindow* RootWindowHostLinux::GetRootWindow() { return root_window_; } ",0 "bool oom_killer_disable(signed long timeout) { signed long ret; /* * Make sure to not race with an ongoing OOM killer. Check that the * current is not killed (possibly due to sharing the victim's memory). */ if (mutex_lock_killable(&oom_lock)) return false; oom_killer_disabled = true; mutex_unlock(&oom_lock); ret = wait_event_interruptible_timeout(oom_victims_wait, !atomic_read(&oom_victims), timeout); if (ret <= 0) { oom_killer_enable(); return false; } pr_info(""OOM killer disabled.\n""); return true; } ",0 "GF_Err mvex_Read(GF_Box *s, GF_BitStream *bs) { return gf_isom_box_array_read(s, bs, mvex_AddBox); } ",0 "static bool DeviceScaleEnsuresTextQuality(float device_scale_factor) { #if defined(OS_ANDROID) || defined(OS_CHROMEOS) return true; #else return device_scale_factor >= 1.5f; #endif } ",0 "void Browser::ShowExtensionsTab() { UserMetrics::RecordAction(UserMetricsAction(""ShowExtensions"")); ShowOptionsTab(chrome::kExtensionsSubPage); } ",0 "netscreen_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info) { char line[NETSCREEN_LINE_LENGTH]; if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1) { return FALSE; } if (file_gets(line, NETSCREEN_LINE_LENGTH, wth->random_fh) == NULL) { *err = file_error(wth->random_fh, err_info); if (*err == 0) { *err = WTAP_ERR_SHORT_READ; } return FALSE; } return parse_netscreen_packet(wth->random_fh, phdr, buf, line, err, err_info); } ",0 "bool PaintArtifactCompositor::PendingLayer::CanMerge( const PendingLayer& guest) const { if (requires_own_layer || guest.requires_own_layer) return false; if (property_tree_state.Effect() != guest.property_tree_state.Effect()) return false; return CanUpcastTo(guest.property_tree_state, property_tree_state); } ",0 "void ThreadHeap::VisitStackRoots(MarkingVisitor* visitor) { DCHECK(thread_state_->InAtomicMarkingPause()); TRACE_EVENT0(""blink_gc"", ""ThreadHeap::visitStackRoots""); address_cache_->FlushIfDirty(); address_cache_->EnableLookup(); thread_state_->VisitStack(visitor); address_cache_->DisableLookup(); } ",0 "static void dbg_to_reg(struct kvm_vcpu *vcpu, struct sys_reg_params *p, u64 *dbg_reg) { p->regval = *dbg_reg; if (p->is_32bit) p->regval &= 0xffffffffUL; } ",0 "InjectedBundlePage::~InjectedBundlePage() { } ",0 "void JBIG2Stream::readCodeTableSeg(Guint segNum, Guint length) { JBIG2HuffmanTable *huffTab; Guint flags, oob, prefixBits, rangeBits; int lowVal, highVal, val; Guint huffTabSize, i; if (!readUByte(&flags) || !readLong(&lowVal) || !readLong(&highVal)) { goto eofError; } oob = flags & 1; prefixBits = ((flags >> 1) & 7) + 1; rangeBits = ((flags >> 4) & 7) + 1; huffDecoder->reset(); huffTabSize = 8; huffTab = (JBIG2HuffmanTable *) gmallocn(huffTabSize, sizeof(JBIG2HuffmanTable)); i = 0; val = lowVal; while (val < highVal) { if (i == huffTabSize) { huffTabSize *= 2; huffTab = (JBIG2HuffmanTable *) greallocn(huffTab, huffTabSize, sizeof(JBIG2HuffmanTable)); } huffTab[i].val = val; huffTab[i].prefixLen = huffDecoder->readBits(prefixBits); huffTab[i].rangeLen = huffDecoder->readBits(rangeBits); val += 1 << huffTab[i].rangeLen; ++i; } if (i + oob + 3 > huffTabSize) { huffTabSize = i + oob + 3; huffTab = (JBIG2HuffmanTable *) greallocn(huffTab, huffTabSize, sizeof(JBIG2HuffmanTable)); } huffTab[i].val = lowVal - 1; huffTab[i].prefixLen = huffDecoder->readBits(prefixBits); huffTab[i].rangeLen = jbig2HuffmanLOW; ++i; huffTab[i].val = highVal; huffTab[i].prefixLen = huffDecoder->readBits(prefixBits); huffTab[i].rangeLen = 32; ++i; if (oob) { huffTab[i].val = 0; huffTab[i].prefixLen = huffDecoder->readBits(prefixBits); huffTab[i].rangeLen = jbig2HuffmanOOB; ++i; } huffTab[i].val = 0; huffTab[i].prefixLen = 0; huffTab[i].rangeLen = jbig2HuffmanEOT; huffDecoder->buildTable(huffTab, i); segments->append(new JBIG2CodeTable(segNum, huffTab)); return; eofError: error(getPos(), ""Unexpected EOF in JBIG2 stream""); } ",0 "xmlAddEntityReference(xmlEntityPtr ent, xmlNodePtr firstNode, xmlNodePtr lastNode) { if (xmlEntityRefFunc != NULL) { (*xmlEntityRefFunc) (ent, firstNode, lastNode); } } ",0 "static size_t SGIEncode(unsigned char *pixels,size_t length, unsigned char *packets) { short runlength; register unsigned char *p, *q; unsigned char *limit, *mark; p=pixels; limit=p+length*4; q=packets; while (p < limit) { mark=p; p+=8; while ((p < limit) && ((*(p-8) != *(p-4)) || (*(p-4) != *p))) p+=4; p-=8; length=(size_t) (p-mark) >> 2; while (length != 0) { runlength=(short) (length > 126 ? 126 : length); length-=runlength; *q++=(unsigned char) (0x80 | runlength); for ( ; runlength > 0; runlength--) { *q++=(*mark); mark+=4; } } mark=p; p+=4; while ((p < limit) && (*p == *mark)) p+=4; length=(size_t) (p-mark) >> 2; while (length != 0) { runlength=(short) (length > 126 ? 126 : length); length-=runlength; *q++=(unsigned char) runlength; *q++=(*mark); } } *q++='\0'; return((size_t) (q-packets)); } ",0 "void BlinkTestRunner::EvaluateInWebInspector(long call_id, const std::string& script) { WebDevToolsAgent* agent = render_view()->GetMainRenderFrame()->GetWebFrame()->devToolsAgent(); if (agent) agent->evaluateInWebInspector(call_id, WebString::fromUTF8(script)); } ",0 "static void diff_pixels_c(int16_t *av_restrict block, const uint8_t *s1, const uint8_t *s2, int stride){ int i; /* read the pixels */ for(i=0;i<8;i++) { block[0] = s1[0] - s2[0]; block[1] = s1[1] - s2[1]; block[2] = s1[2] - s2[2]; block[3] = s1[3] - s2[3]; block[4] = s1[4] - s2[4]; block[5] = s1[5] - s2[5]; block[6] = s1[6] - s2[6]; block[7] = s1[7] - s2[7]; s1 += stride; s2 += stride; block += 8; } } ",0 "static struct page *get_object_page(const void *x) { struct page *page = virt_to_head_page(x); if (!PageSlab(page)) return NULL; return page; } ",0 "static int handle_vmclear(struct kvm_vcpu *vcpu) { struct vcpu_vmx *vmx = to_vmx(vcpu); u32 zero = 0; gpa_t vmptr; if (!nested_vmx_check_permission(vcpu)) return 1; if (nested_vmx_get_vmptr(vcpu, &vmptr)) return 1; if (!PAGE_ALIGNED(vmptr) || (vmptr >> cpuid_maxphyaddr(vcpu))) { nested_vmx_failValid(vcpu, VMXERR_VMCLEAR_INVALID_ADDRESS); return kvm_skip_emulated_instruction(vcpu); } if (vmptr == vmx->nested.vmxon_ptr) { nested_vmx_failValid(vcpu, VMXERR_VMCLEAR_VMXON_POINTER); return kvm_skip_emulated_instruction(vcpu); } if (vmptr == vmx->nested.current_vmptr) nested_release_vmcs12(vmx); kvm_vcpu_write_guest(vcpu, vmptr + offsetof(struct vmcs12, launch_state), &zero, sizeof(zero)); nested_vmx_succeed(vcpu); return kvm_skip_emulated_instruction(vcpu); } ",0 "static void drop_sysctl_table(struct ctl_table_header *header) { struct ctl_dir *parent = header->parent; if (--header->nreg) return; put_links(header); start_unregistering(header); if (!--header->count) kfree_rcu(header, rcu); if (parent) drop_sysctl_table(&parent->header); } ",0 "static void inv_predict_3(uint8_t *p, const uint8_t *p_l, const uint8_t *p_tl, const uint8_t *p_t, const uint8_t *p_tr) { AV_COPY32(p, p_tr); } ",0 "static void armv8pmu_reset(void *info) { u32 idx, nb_cnt = cpu_pmu->num_events; /* The counter and interrupt enable registers are unknown at reset. */ for (idx = ARMV8_IDX_CYCLE_COUNTER; idx < nb_cnt; ++idx) armv8pmu_disable_event(NULL, idx); /* Initialize & Reset PMNC: C and P bits. */ armv8pmu_pmcr_write(ARMV8_PMCR_P | ARMV8_PMCR_C); /* Disable access from userspace. */ asm volatile(""msr pmuserenr_el0, %0"" :: ""r"" (0)); } ",0 "std::vector Extension::GetDistinctHostsForDisplay( const URLPatternList& list) { return GetDistinctHosts(list, true); } ",0 "status_t Camera3Device::waitUntilDrainedLocked() { switch (mStatus) { case STATUS_UNINITIALIZED: case STATUS_UNCONFIGURED: ALOGV(""%s: Already idle"", __FUNCTION__); return OK; case STATUS_CONFIGURED: case STATUS_ERROR: case STATUS_ACTIVE: break; default: SET_ERR_L(""Unexpected status: %d"",mStatus); return INVALID_OPERATION; } ALOGV(""%s: Camera %d: Waiting until idle"", __FUNCTION__, mId); status_t res = waitUntilStateThenRelock(/*active*/ false, kShutdownTimeout); if (res != OK) { SET_ERR_L(""Error waiting for HAL to drain: %s (%d)"", strerror(-res), res); } return res; } ",0 "void shm_exit_ns(struct ipc_namespace *ns) { free_ipcs(ns, &shm_ids(ns), do_shm_rmid); idr_destroy(&ns->ids[IPC_SHM_IDS].ipcs_idr); } ",0 " status_t HevcParameterSets::addNalUnit(const uint8_t* data, size_t size) { uint8_t nalUnitType = (data[0] >> 1) & 0x3f; status_t err = OK; switch (nalUnitType) { case 32: // VPS err = parseVps(data + 2, size - 2); break; case 33: // SPS err = parseSps(data + 2, size - 2); break; case 34: // PPS err = parsePps(data + 2, size - 2); break; case 39: // Prefix SEI case 40: // Suffix SEI break; default: ALOGE(""Unrecognized NAL unit type.""); return ERROR_MALFORMED; } if (err != OK) { return err; } sp buffer = ABuffer::CreateAsCopy(data, size); buffer->setInt32Data(nalUnitType); mNalUnits.push(buffer); return OK; } ",1 "void HTMLKeygenElement::parseAttribute(const QualifiedName& name, const AtomicString& value) { if (name == disabledAttr) shadowSelect()->setAttribute(name, value); HTMLFormControlElement::parseAttribute(name, value); } ",0 "LocalSiteCharacteristicsDataImpl::~LocalSiteCharacteristicsDataImpl() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(!IsLoaded()); DCHECK_EQ(0U, loaded_tabs_in_background_count_); DCHECK(delegate_); delegate_->OnLocalSiteCharacteristicsDataImplDestroyed(this); if (is_dirty_ && safe_to_write_to_db_) { DCHECK(site_characteristics_.IsInitialized()); database_->WriteSiteCharacteristicsIntoDB(origin_, site_characteristics_); } } ",0 "static int AppLayerProtoDetectTest02(void) { AppLayerProtoDetectUnittestCtxBackup(); AppLayerProtoDetectSetup(); int r = 0; const char *buf = ""HTTP""; AppLayerProtoDetectPMRegisterPatternCS(IPPROTO_TCP, ALPROTO_HTTP, buf, 4, 0, STREAM_TOCLIENT); buf = ""ftp""; AppLayerProtoDetectPMRegisterPatternCS(IPPROTO_TCP, ALPROTO_FTP, buf, 4, 0, STREAM_TOCLIENT); AppLayerProtoDetectPrepareState(); if (alpd_ctx.ctx_ipp[FLOW_PROTO_TCP].ctx_pm[0].max_pat_id != 0) { printf(""alpd_ctx.ctx_ipp[FLOW_PROTO_TCP].ctx_pm[0].max_pat_id != 0\n""); goto end; } if (alpd_ctx.ctx_ipp[FLOW_PROTO_TCP].ctx_pm[1].max_pat_id != 2) { printf(""alpd_ctx.ctx_ipp[FLOW_PROTO_TCP].ctx_pm[1].max_pat_id != 2\n""); goto end; } if (alpd_ctx.ctx_ipp[FLOW_PROTO_TCP].ctx_pm[0].map != NULL) { printf(""alpd_ctx.ctx_ipp[FLOW_PROTO_TCP].ctx_pm[0].map != NULL\n""); goto end; } if (alpd_ctx.ctx_ipp[FLOW_PROTO_TCP].ctx_pm[1].map == NULL) { printf(""alpd_ctx.ctx_ipp[FLOW_PROTO_TCP].ctx_pm[1].map != NULL\n""); goto end; } if (alpd_ctx.ctx_ipp[FLOW_PROTO_TCP].ctx_pm[1].map[0]->alproto != ALPROTO_FTP) { printf(""alpd_ctx.ctx_ipp[FLOW_PROTO_TCP].ctx_pm[1].map[0].alproto != ALPROTO_FTP\n""); goto end; } if (alpd_ctx.ctx_ipp[FLOW_PROTO_TCP].ctx_pm[1].map[1]->alproto != ALPROTO_HTTP) { printf(""alpd_ctx.ctx_ipp[FLOW_PROTO_TCP].ctx_pm[1].map[1].alproto != ALPROTO_HTTP\n""); goto end; } r = 1; end: AppLayerProtoDetectDeSetup(); AppLayerProtoDetectUnittestCtxRestore(); return r; } ",0 "static int asn1_find_end(const unsigned char **in, long len, char inf) { int expected_eoc; long plen; const unsigned char *p = *in, *q; /* If not indefinite length constructed just add length */ if (inf == 0) { *in += len; return 1; } expected_eoc = 1; /* * Indefinite length constructed form. Find the end when enough EOCs are * found. If more indefinite length constructed headers are encountered * increment the expected eoc count otherwise just skip to the end of the * data. */ while (len > 0) { if (asn1_check_eoc(&p, len)) { expected_eoc--; if (expected_eoc == 0) break; len -= 2; continue; } q = p; /* Just read in a header: only care about the length */ if (!asn1_check_tlen(&plen, NULL, NULL, &inf, NULL, &p, len, -1, 0, 0, NULL)) { ASN1err(ASN1_F_ASN1_FIND_END, ERR_R_NESTED_ASN1_ERROR); return 0; } if (inf) expected_eoc++; else p += plen; len -= p - q; } if (expected_eoc) { ASN1err(ASN1_F_ASN1_FIND_END, ASN1_R_MISSING_EOC); return 0; } *in = p; return 1; } ",0 "error::Error GLES2DecoderPassthroughImpl::DoVertexAttrib4fv( GLuint indx, const volatile GLfloat* values) { api()->glVertexAttrib4fvFn(indx, const_cast(values)); return error::kNoError; } ",0 "static int dotl_to_open_flags(int flags) { int i; /* * We have same bits for P9_DOTL_READONLY, P9_DOTL_WRONLY * and P9_DOTL_NOACCESS */ int oflags = flags & O_ACCMODE; struct dotl_openflag_map dotl_oflag_map[] = { { P9_DOTL_CREATE, O_CREAT }, { P9_DOTL_EXCL, O_EXCL }, { P9_DOTL_NOCTTY , O_NOCTTY }, { P9_DOTL_TRUNC, O_TRUNC }, { P9_DOTL_APPEND, O_APPEND }, { P9_DOTL_NONBLOCK, O_NONBLOCK } , { P9_DOTL_DSYNC, O_DSYNC }, { P9_DOTL_FASYNC, FASYNC }, { P9_DOTL_DIRECT, O_DIRECT }, { P9_DOTL_LARGEFILE, O_LARGEFILE }, { P9_DOTL_DIRECTORY, O_DIRECTORY }, { P9_DOTL_NOFOLLOW, O_NOFOLLOW }, { P9_DOTL_NOATIME, O_NOATIME }, { P9_DOTL_SYNC, O_SYNC }, }; for (i = 0; i < ARRAY_SIZE(dotl_oflag_map); i++) { if (flags & dotl_oflag_map[i].dotl_flag) { oflags |= dotl_oflag_map[i].open_flag; } } return oflags; } ",0 "psf_instrument_alloc (void) { SF_INSTRUMENT *instr ; instr = calloc (1, sizeof (SF_INSTRUMENT)) ; if (instr == NULL) return NULL ; /* Set non-zero default values. */ instr->basenote = -1 ; instr->velocity_lo = -1 ; instr->velocity_hi = -1 ; instr->key_lo = -1 ; instr->key_hi = -1 ; return instr ; } /* psf_instrument_alloc */ ",0 "void Document::setFullScreenRenderer(RenderFullScreen* renderer) { if (renderer == m_fullScreenRenderer) return; if (renderer && m_savedPlaceholderRenderStyle) renderer->createPlaceholder(m_savedPlaceholderRenderStyle.release(), m_savedPlaceholderFrameRect); else if (renderer && m_fullScreenRenderer && m_fullScreenRenderer->placeholder()) { RenderBlock* placeholder = m_fullScreenRenderer->placeholder(); renderer->createPlaceholder(RenderStyle::clone(placeholder->style()), placeholder->frameRect()); } if (m_fullScreenRenderer) m_fullScreenRenderer->destroy(); ASSERT(!m_fullScreenRenderer); m_fullScreenRenderer = renderer; if (page()) page()->chrome()->client()->fullScreenRendererChanged(m_fullScreenRenderer); } ",0 "static double filter_bspline(const double x) { if (x>2.0f) { return 0.0f; } else { double a, b, c, d; /* Was calculated anyway cause the ""if((x-1.0f) < 0)"" */ const double xm1 = x - 1.0f; const double xp1 = x + 1.0f; const double xp2 = x + 2.0f; if ((xp2) <= 0.0f) a = 0.0f; else a = xp2*xp2*xp2; if ((xp1) <= 0.0f) b = 0.0f; else b = xp1*xp1*xp1; if (x <= 0) c = 0.0f; else c = x*x*x; if ((xm1) <= 0.0f) d = 0.0f; else d = xm1*xm1*xm1; return (0.16666666666666666667f * (a - (4.0f * b) + (6.0f * c) - (4.0f * d))); } } ",0 "sockaddr_inet(short family, inet_address_t *addr) { SOCKADDR_INET sa_inet; ZeroMemory(&sa_inet, sizeof(sa_inet)); sa_inet.si_family = family; if (family == AF_INET) { sa_inet.Ipv4.sin_addr = addr->ipv4; } else if (family == AF_INET6) { sa_inet.Ipv6.sin6_addr = addr->ipv6; } return sa_inet; } ",0 "static bool may_access_direct_pkt_data(struct bpf_verifier_env *env, const struct bpf_call_arg_meta *meta, enum bpf_access_type t) { switch (env->prog->type) { /* Program types only with direct read access go here! */ case BPF_PROG_TYPE_LWT_IN: case BPF_PROG_TYPE_LWT_OUT: case BPF_PROG_TYPE_LWT_SEG6LOCAL: case BPF_PROG_TYPE_SK_REUSEPORT: case BPF_PROG_TYPE_FLOW_DISSECTOR: case BPF_PROG_TYPE_CGROUP_SKB: if (t == BPF_WRITE) return false; /* fallthrough */ /* Program types with direct read + write access go here! */ case BPF_PROG_TYPE_SCHED_CLS: case BPF_PROG_TYPE_SCHED_ACT: case BPF_PROG_TYPE_XDP: case BPF_PROG_TYPE_LWT_XMIT: case BPF_PROG_TYPE_SK_SKB: case BPF_PROG_TYPE_SK_MSG: if (meta) return meta->pkt_access; env->seen_direct_write = true; return true; default: return false; } } ",0 "bool HeadlessWebContentsImpl::OpenURL(const GURL& url) { if (!url.is_valid()) return false; content::NavigationController::LoadURLParams params(url); params.transition_type = ui::PageTransitionFromInt( ui::PAGE_TRANSITION_TYPED | ui::PAGE_TRANSITION_FROM_ADDRESS_BAR); web_contents_->GetController().LoadURLWithParams(params); web_contents_delegate_->ActivateContents(web_contents_.get()); web_contents_->Focus(); return true; } ",0 " void GpuProcessHost::OnProcessLaunched() { base::ProcessHandle child_handle = in_process_ ? base::GetCurrentProcessHandle() : process_->GetData().handle; #if defined(OS_WIN) DuplicateHandle(base::GetCurrentProcessHandle(), child_handle, base::GetCurrentProcessHandle(), &gpu_process_, PROCESS_DUP_HANDLE, FALSE, 0); #else gpu_process_ = child_handle; #endif UMA_HISTOGRAM_TIMES(""GPU.GPUProcessLaunchTime"", base::TimeTicks::Now() - init_start_time_); } ",1 "static void activityLoggingGetterForIsolatedWorldsPerWorldBindingsLongAttributeAttributeSetterCallback(v8::Local, v8::Local jsValue, const v8::PropertyCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMSetter""); TestObjectPythonV8Internal::activityLoggingGetterForIsolatedWorldsPerWorldBindingsLongAttributeAttributeSetter(jsValue, info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "static MagickBooleanType Huffman2DEncodeImage(const ImageInfo *image_info, Image *image,Image *inject_image,ExceptionInfo *exception) { Image *group4_image; ImageInfo *write_info; MagickBooleanType status; size_t length; unsigned char *group4; status=MagickTrue; write_info=CloneImageInfo(image_info); (void) CopyMagickString(write_info->filename,""GROUP4:"",MagickPathExtent); (void) CopyMagickString(write_info->magick,""GROUP4"",MagickPathExtent); group4_image=CloneImage(inject_image,0,0,MagickTrue,exception); if (group4_image == (Image *) NULL) return(MagickFalse); group4=(unsigned char *) ImageToBlob(write_info,group4_image,&length, exception); group4_image=DestroyImage(group4_image); if (group4 == (unsigned char *) NULL) return(MagickFalse); write_info=DestroyImageInfo(write_info); if (WriteBlob(image,length,group4) != (ssize_t) length) status=MagickFalse; group4=(unsigned char *) RelinquishMagickMemory(group4); return(status); } ",0 "int _yr_scan_match_callback( uint8_t* match_data, int32_t match_length, int flags, void* args) { CALLBACK_ARGS* callback_args = (CALLBACK_ARGS*) args; YR_STRING* string = callback_args->string; YR_MATCH* new_match; int result = ERROR_SUCCESS; int tidx = callback_args->context->tidx; size_t match_offset = match_data - callback_args->data; match_length += callback_args->forward_matches; if (callback_args->full_word) { if (flags & RE_FLAGS_WIDE) { if (match_offset >= 2 && *(match_data - 1) == 0 && isalnum(*(match_data - 2))) return ERROR_SUCCESS; if (match_offset + match_length + 1 < callback_args->data_size && *(match_data + match_length + 1) == 0 && isalnum(*(match_data + match_length))) return ERROR_SUCCESS; } else { if (match_offset >= 1 && isalnum(*(match_data - 1))) return ERROR_SUCCESS; if (match_offset + match_length < callback_args->data_size && isalnum(*(match_data + match_length))) return ERROR_SUCCESS; } } if (STRING_IS_CHAIN_PART(string)) { result = _yr_scan_verify_chained_string_match( string, callback_args->context, match_data, callback_args->data_base, match_offset, match_length); } else { if (string->matches[tidx].count == 0) { FAIL_ON_ERROR(yr_arena_write_data( callback_args->context->matching_strings_arena, &string, sizeof(string), NULL)); } FAIL_ON_ERROR(yr_arena_allocate_memory( callback_args->context->matches_arena, sizeof(YR_MATCH), (void**) &new_match)); new_match->data_length = yr_min(match_length, MAX_MATCH_DATA); FAIL_ON_ERROR(yr_arena_write_data( callback_args->context->matches_arena, match_data, new_match->data_length, (void**) &new_match->data)); if (result == ERROR_SUCCESS) { new_match->base = callback_args->data_base; new_match->offset = match_offset; new_match->match_length = match_length; new_match->prev = NULL; new_match->next = NULL; FAIL_ON_ERROR(_yr_scan_add_match_to_list( new_match, &string->matches[tidx], STRING_IS_GREEDY_REGEXP(string))); } } return result; } ",1 "const gpu::Capabilities& CommandBufferProxyImpl::GetCapabilities() const { return capabilities_; } ",0 " void TearDownOnUIThread() { fake_drive_file_system_.reset(); fake_drive_service_.reset(); } ",0 "static int recv_pkt(git_pkt **out, gitno_buffer *buf) { const char *ptr = buf->data, *line_end = ptr; git_pkt *pkt = NULL; int pkt_type, error = 0, ret; do { if (buf->offset > 0) error = git_pkt_parse_line(&pkt, ptr, &line_end, buf->offset); else error = GIT_EBUFS; if (error == 0) break; /* return the pkt */ if (error < 0 && error != GIT_EBUFS) return error; if ((ret = gitno_recv(buf)) < 0) return ret; } while (error); gitno_consume(buf, line_end); pkt_type = pkt->type; if (out != NULL) *out = pkt; else git__free(pkt); return pkt_type; } ",0 "static inline int decide_ac_pred(MpegEncContext *s, int16_t block[6][64], const int dir[6], uint8_t *st[6], int zigzag_last_index[6]) { int score = 0; int i, n; int8_t *const qscale_table = s->current_picture.qscale_table; memcpy(zigzag_last_index, s->block_last_index, sizeof(int) * 6); for (n = 0; n < 6; n++) { int16_t *ac_val, *ac_val1; score -= get_block_rate(s, block[n], s->block_last_index[n], s->intra_scantable.permutated); ac_val = s->ac_val[0][0] + s->block_index[n] * 16; ac_val1 = ac_val; if (dir[n]) { const int xy = s->mb_x + s->mb_y * s->mb_stride - s->mb_stride; /* top prediction */ ac_val -= s->block_wrap[n] * 16; if (s->mb_y == 0 || s->qscale == qscale_table[xy] || n == 2 || n == 3) { /* same qscale */ for (i = 1; i < 8; i++) { const int level = block[n][s->idsp.idct_permutation[i]]; block[n][s->idsp.idct_permutation[i]] = level - ac_val[i + 8]; ac_val1[i] = block[n][s->idsp.idct_permutation[i << 3]]; ac_val1[i + 8] = level; } } else { /* different qscale, we must rescale */ for (i = 1; i < 8; i++) { const int level = block[n][s->idsp.idct_permutation[i]]; block[n][s->idsp.idct_permutation[i]] = level - ROUNDED_DIV(ac_val[i + 8] * qscale_table[xy], s->qscale); ac_val1[i] = block[n][s->idsp.idct_permutation[i << 3]]; ac_val1[i + 8] = level; } } st[n] = s->intra_h_scantable.permutated; } else { const int xy = s->mb_x - 1 + s->mb_y * s->mb_stride; /* left prediction */ ac_val -= 16; if (s->mb_x == 0 || s->qscale == qscale_table[xy] || n == 1 || n == 3) { /* same qscale */ for (i = 1; i < 8; i++) { const int level = block[n][s->idsp.idct_permutation[i << 3]]; block[n][s->idsp.idct_permutation[i << 3]] = level - ac_val[i]; ac_val1[i] = level; ac_val1[i + 8] = block[n][s->idsp.idct_permutation[i]]; } } else { /* different qscale, we must rescale */ for (i = 1; i < 8; i++) { const int level = block[n][s->idsp.idct_permutation[i << 3]]; block[n][s->idsp.idct_permutation[i << 3]] = level - ROUNDED_DIV(ac_val[i] * qscale_table[xy], s->qscale); ac_val1[i] = level; ac_val1[i + 8] = block[n][s->idsp.idct_permutation[i]]; } } st[n] = s->intra_v_scantable.permutated; } for (i = 63; i > 0; i--) // FIXME optimize if (block[n][st[n][i]]) break; s->block_last_index[n] = i; score += get_block_rate(s, block[n], s->block_last_index[n], st[n]); } if (score < 0) { return 1; } else { restore_ac_coeffs(s, block, dir, st, zigzag_last_index); return 0; } } ",0 "ext4_fsblk_t ext4_block_bitmap(struct super_block *sb, struct ext4_group_desc *bg) { return le32_to_cpu(bg->bg_block_bitmap_lo) | (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ? (ext4_fsblk_t)le32_to_cpu(bg->bg_block_bitmap_hi) << 32 : 0); } ",0 "u16 skb_tx_hash(const struct net_device *dev, const struct sk_buff *skb) { u32 hash; if (skb_rx_queue_recorded(skb)) { hash = skb_get_rx_queue(skb); while (unlikely(hash >= dev->real_num_tx_queues)) hash -= dev->real_num_tx_queues; return hash; } if (skb->sk && skb->sk->sk_hash) hash = skb->sk->sk_hash; else hash = (__force u16) skb->protocol; hash = jhash_1word(hash, hashrnd); return (u16) (((u64) hash * dev->real_num_tx_queues) >> 32); } ",0 "static int kvm_guest_time_update(struct kvm_vcpu *v) { unsigned long flags; struct kvm_vcpu_arch *vcpu = &v->arch; void *shared_kaddr; unsigned long this_tsc_khz; s64 kernel_ns, max_kernel_ns; u64 tsc_timestamp; /* Keep irq disabled to prevent changes to the clock */ local_irq_save(flags); tsc_timestamp = kvm_x86_ops->read_l1_tsc(v); kernel_ns = get_kernel_ns(); this_tsc_khz = vcpu_tsc_khz(v); if (unlikely(this_tsc_khz == 0)) { local_irq_restore(flags); kvm_make_request(KVM_REQ_CLOCK_UPDATE, v); return 1; } /* * We may have to catch up the TSC to match elapsed wall clock * time for two reasons, even if kvmclock is used. * 1) CPU could have been running below the maximum TSC rate * 2) Broken TSC compensation resets the base at each VCPU * entry to avoid unknown leaps of TSC even when running * again on the same CPU. This may cause apparent elapsed * time to disappear, and the guest to stand still or run * very slowly. */ if (vcpu->tsc_catchup) { u64 tsc = compute_guest_tsc(v, kernel_ns); if (tsc > tsc_timestamp) { kvm_x86_ops->adjust_tsc_offset(v, tsc - tsc_timestamp); tsc_timestamp = tsc; } } local_irq_restore(flags); if (!vcpu->time_page) return 0; /* * Time as measured by the TSC may go backwards when resetting the base * tsc_timestamp. The reason for this is that the TSC resolution is * higher than the resolution of the other clock scales. Thus, many * possible measurments of the TSC correspond to one measurement of any * other clock, and so a spread of values is possible. This is not a * problem for the computation of the nanosecond clock; with TSC rates * around 1GHZ, there can only be a few cycles which correspond to one * nanosecond value, and any path through this code will inevitably * take longer than that. However, with the kernel_ns value itself, * the precision may be much lower, down to HZ granularity. If the * first sampling of TSC against kernel_ns ends in the low part of the * range, and the second in the high end of the range, we can get: * * (TSC - offset_low) * S + kns_old > (TSC - offset_high) * S + kns_new * * As the sampling errors potentially range in the thousands of cycles, * it is possible such a time value has already been observed by the * guest. To protect against this, we must compute the system time as * observed by the guest and ensure the new system time is greater. */ max_kernel_ns = 0; if (vcpu->hv_clock.tsc_timestamp && vcpu->last_guest_tsc) { max_kernel_ns = vcpu->last_guest_tsc - vcpu->hv_clock.tsc_timestamp; max_kernel_ns = pvclock_scale_delta(max_kernel_ns, vcpu->hv_clock.tsc_to_system_mul, vcpu->hv_clock.tsc_shift); max_kernel_ns += vcpu->last_kernel_ns; } if (unlikely(vcpu->hw_tsc_khz != this_tsc_khz)) { kvm_get_time_scale(NSEC_PER_SEC / 1000, this_tsc_khz, &vcpu->hv_clock.tsc_shift, &vcpu->hv_clock.tsc_to_system_mul); vcpu->hw_tsc_khz = this_tsc_khz; } if (max_kernel_ns > kernel_ns) kernel_ns = max_kernel_ns; /* With all the info we got, fill in the values */ vcpu->hv_clock.tsc_timestamp = tsc_timestamp; vcpu->hv_clock.system_time = kernel_ns + v->kvm->arch.kvmclock_offset; vcpu->last_kernel_ns = kernel_ns; vcpu->last_guest_tsc = tsc_timestamp; vcpu->hv_clock.flags = 0; /* * The interface expects us to write an even number signaling that the * update is finished. Since the guest won't see the intermediate * state, we just increase by 2 at the end. */ vcpu->hv_clock.version += 2; shared_kaddr = kmap_atomic(vcpu->time_page, KM_USER0); memcpy(shared_kaddr + vcpu->time_offset, &vcpu->hv_clock, sizeof(vcpu->hv_clock)); kunmap_atomic(shared_kaddr, KM_USER0); mark_page_dirty(v->kvm, vcpu->time >> PAGE_SHIFT); return 0; } ",0 "static void recalloc_sock(struct pool *pool, size_t len) { size_t old, newlen; old = strlen(pool->sockbuf); newlen = old + len + 1; if (newlen < pool->sockbuf_size) return; newlen = newlen + (RBUFSIZE - (newlen % RBUFSIZE)); pool->sockbuf = (char *)realloc(pool->sockbuf, newlen); if (!pool->sockbuf) quithere(1, ""Failed to realloc pool sockbuf""); memset(pool->sockbuf + old, 0, newlen - old); pool->sockbuf_size = newlen; } ",0 "bool CreateNewTempDirectory(const FilePath::StringType& prefix, FilePath* new_temp_path) { FilePath tmpdir; if (!GetTempDir(&tmpdir)) return false; return CreateTemporaryDirInDirImpl(tmpdir, TempFileName(), new_temp_path); } ",0 "std::unique_ptr UnpackPermissionSet( const Permissions& permissions_input, const PermissionSet& required_permissions, const PermissionSet& optional_permissions, bool allow_file_access, std::string* error) { DCHECK(error); auto result = std::make_unique(); if (permissions_input.permissions && !UnpackAPIPermissions(*permissions_input.permissions, required_permissions, optional_permissions, result.get(), error)) { return nullptr; } if (permissions_input.origins && !UnpackOriginPermissions(*permissions_input.origins, required_permissions, optional_permissions, allow_file_access, result.get(), error)) { return nullptr; } return result; } ",0 "static int raw_cmd_copyout(int cmd, void __user *param, struct floppy_raw_cmd *ptr) { int ret; while (ptr) { struct floppy_raw_cmd cmd = *ptr; cmd.next = NULL; cmd.kernel_data = NULL; ret = copy_to_user(param, &cmd, sizeof(cmd)); if (ret) return -EFAULT; param += sizeof(struct floppy_raw_cmd); if ((ptr->flags & FD_RAW_READ) && ptr->buffer_length) { if (ptr->length >= 0 && ptr->length <= ptr->buffer_length) { long length = ptr->buffer_length - ptr->length; ret = fd_copyout(ptr->data, ptr->kernel_data, length); if (ret) return ret; } } ptr = ptr->next; } return 0; } ",0 "static int rb_allocate_pages(struct ring_buffer_per_cpu *cpu_buffer, unsigned long nr_pages) { LIST_HEAD(pages); WARN_ON(!nr_pages); if (__rb_allocate_pages(nr_pages, &pages, cpu_buffer->cpu)) return -ENOMEM; /* * The ring buffer page list is a circular list that does not * start and end with a list head. All page list items point to * other pages. */ cpu_buffer->pages = pages.next; list_del(&pages); cpu_buffer->nr_pages = nr_pages; rb_check_pages(cpu_buffer); return 0; } ",0 "void NormalPage::RemoveFromHeap() { ArenaForNormalPage()->FreePage(this); } ",0 "void Document::loadPluginsSoon() { if (!m_pluginLoadingTimer.isActive()) m_pluginLoadingTimer.startOneShot(0, FROM_HERE); } ",0 "static int invlpga_interception(struct vcpu_svm *svm) { struct kvm_vcpu *vcpu = &svm->vcpu; trace_kvm_invlpga(svm->vmcb->save.rip, kvm_register_read(&svm->vcpu, VCPU_REGS_RCX), kvm_register_read(&svm->vcpu, VCPU_REGS_RAX)); /* Let's treat INVLPGA the same as INVLPG (can be optimized!) */ kvm_mmu_invlpg(vcpu, kvm_register_read(&svm->vcpu, VCPU_REGS_RAX)); svm->next_rip = kvm_rip_read(&svm->vcpu) + 3; skip_emulated_instruction(&svm->vcpu); return 1; } ",0 "static unsigned char port_inb(const struct si_sm_io *io, unsigned int offset) { unsigned int addr = io->addr_data; return inb(addr + (offset * io->regspacing)); } ",0 "bool RuleFeatureSet::extractInvalidationSetFeature(const CSSSelector& selector, InvalidationSetFeatures& features) { if (selector.match() == CSSSelector::Tag && selector.tagQName().localName() != starAtom) features.tagName = selector.tagQName().localName(); else if (selector.match() == CSSSelector::Id) features.id = selector.value(); else if (selector.match() == CSSSelector::Class) features.classes.append(selector.value()); else if (selector.isAttributeSelector()) features.attributes.append(selector.attribute().localName()); else if (selector.pseudoType() == CSSSelector::PseudoWebKitCustomElement) features.customPseudoElement = true; else if (selector.pseudoType() == CSSSelector::PseudoBefore || selector.pseudoType() == CSSSelector::PseudoAfter) features.hasBeforeOrAfter = true; else return false; return true; } ",0 "int nfs4_proc_fs_locations(struct rpc_clnt *client, struct inode *dir, const struct qstr *name, struct nfs4_fs_locations *fs_locations, struct page *page) { struct nfs4_exception exception = { }; int err; do { err = _nfs4_proc_fs_locations(client, dir, name, fs_locations, page); trace_nfs4_get_fs_locations(dir, name, err); err = nfs4_handle_exception(NFS_SERVER(dir), err, &exception); } while (exception.retry); return err; } ",0 "bool BitReaderCore::Refill(int min_nbits) { DCHECK_LE(min_nbits, kRegWidthInBits); RefillCurrentRegister(); if (min_nbits <= nbits_) return true; DCHECK_EQ(nbits_next_, 0); DCHECK_EQ(reg_next_, 0u); int max_nbytes = sizeof(reg_next_); const uint8_t* byte_stream_window; int window_size = byte_stream_provider_->GetBytes(max_nbytes, &byte_stream_window); DCHECK_GE(window_size, 0); DCHECK_LE(window_size, max_nbytes); if (window_size == 0) return false; reg_next_ = 0; memcpy(®_next_, byte_stream_window, window_size); reg_next_ = base::NetToHost64(reg_next_); nbits_next_ = window_size * 8; RefillCurrentRegister(); return (nbits_ >= min_nbits); } ",0 "status_t MediaPlayerService::Client::setAudioStreamType(audio_stream_type_t type) { ALOGV(""[%d] setAudioStreamType(%d)"", mConnId, type); Mutex::Autolock l(mLock); if (mAudioOutput != 0) mAudioOutput->setAudioStreamType(type); return NO_ERROR; } ",0 "void nfs4_init_sequence(struct nfs4_sequence_args *args, struct nfs4_sequence_res *res, int cache_reply) { args->sa_slot = NULL; args->sa_cache_this = cache_reply; args->sa_privileged = 0; res->sr_slot = NULL; } ",0 "maybe_reverse (char const *name, bool nonexistent, bool is_empty) { bool looks_reversed = (! is_empty) < p_says_nonexistent[reverse ^ is_empty]; /* Allow to create and delete empty files when we know that they are empty: in the ""diff --git"" format, we know that from the index header. */ if (is_empty && p_says_nonexistent[reverse ^ nonexistent] == 1 && p_says_nonexistent[! reverse ^ nonexistent] == 2) return false; if (looks_reversed) reverse ^= ok_to_reverse (""The next patch%s would %s the file %s,\nwhich %s!"", reverse ? "", when reversed,"" : """", (nonexistent ? ""delete"" : is_empty ? ""empty out"" : ""create""), quotearg (name), (nonexistent ? ""does not exist"" : is_empty ? ""is already empty"" : ""already exists"")); return looks_reversed; } ",0 "int ff_amf_read_number(GetByteContext *bc, double *val) { uint64_t read; if (bytestream2_get_byte(bc) != AMF_DATA_TYPE_NUMBER) return AVERROR_INVALIDDATA; read = bytestream2_get_be64(bc); *val = av_int2double(read); return 0; } ",0 "static TEE_Result get_prop_tee_dev_id(struct tee_ta_session *sess __unused, void *buf, size_t *blen) { TEE_Result res; TEE_UUID uuid; const size_t nslen = 5; uint8_t data[5 + FVR_DIE_ID_NUM_REGS * sizeof(uint32_t)] = { 'O', 'P', 'T', 'E', 'E' }; if (*blen < sizeof(uuid)) { *blen = sizeof(uuid); return TEE_ERROR_SHORT_BUFFER; } *blen = sizeof(uuid); if (tee_otp_get_die_id(data + nslen, sizeof(data) - nslen)) return TEE_ERROR_BAD_STATE; res = tee_hash_createdigest(TEE_ALG_SHA256, data, sizeof(data), (uint8_t *)&uuid, sizeof(uuid)); if (res != TEE_SUCCESS) return TEE_ERROR_BAD_STATE; /* * Changes the random value into and UUID as specifiec * in RFC 4122. The magic values are from the example * code in the RFC. * * TEE_UUID is defined slightly different from the RFC, * but close enough for our purpose. */ uuid.timeHiAndVersion &= 0x0fff; uuid.timeHiAndVersion |= 5 << 12; /* uuid.clock_seq_hi_and_reserved in the RFC */ uuid.clockSeqAndNode[0] &= 0x3f; uuid.clockSeqAndNode[0] |= 0x80; return tee_svc_copy_to_user(buf, &uuid, sizeof(TEE_UUID)); } ",0 "static void pvclock_gtod_update_fn(struct work_struct *work) { struct kvm *kvm; struct kvm_vcpu *vcpu; int i; spin_lock(&kvm_lock); list_for_each_entry(kvm, &vm_list, vm_list) kvm_for_each_vcpu(i, vcpu, kvm) kvm_make_request(KVM_REQ_MASTERCLOCK_UPDATE, vcpu); atomic_set(&kvm_guest_has_master_clock, 0); spin_unlock(&kvm_lock); } ",0 "static int dvb_usbv2_adapter_dvb_exit(struct dvb_usb_adapter *adap) { dev_dbg(&adap_to_d(adap)->udev->dev, ""%s: adap=%d\n"", __func__, adap->id); if (adap->dvb_adap.priv) { dvb_net_release(&adap->dvb_net); adap->demux.dmx.close(&adap->demux.dmx); dvb_dmxdev_release(&adap->dmxdev); dvb_dmx_release(&adap->demux); dvb_unregister_adapter(&adap->dvb_adap); } return 0; } ",0 "static void ipa_functions(wmfAPI *API) { wmf_magick_t *ddata = 0; wmfFunctionReference *FR = (wmfFunctionReference *) API->function_reference; /* IPA function reference links */ FR->device_open = ipa_device_open; FR->device_close = ipa_device_close; FR->device_begin = ipa_device_begin; FR->device_end = ipa_device_end; FR->flood_interior = ipa_flood_interior; FR->flood_exterior = ipa_flood_exterior; FR->draw_pixel = ipa_draw_pixel; FR->draw_pie = ipa_draw_pie; FR->draw_chord = ipa_draw_chord; FR->draw_arc = ipa_draw_arc; FR->draw_ellipse = ipa_draw_ellipse; FR->draw_line = ipa_draw_line; FR->poly_line = ipa_poly_line; FR->draw_polygon = ipa_draw_polygon; #if defined(MAGICKCORE_WMFLITE_DELEGATE) FR->draw_polypolygon = ipa_draw_polypolygon; #endif FR->draw_rectangle = ipa_draw_rectangle; FR->rop_draw = ipa_rop_draw; FR->bmp_draw = ipa_bmp_draw; FR->bmp_read = ipa_bmp_read; FR->bmp_free = ipa_bmp_free; FR->draw_text = ipa_draw_text; FR->udata_init = ipa_udata_init; FR->udata_copy = ipa_udata_copy; FR->udata_set = ipa_udata_set; FR->udata_free = ipa_udata_free; FR->region_frame = ipa_region_frame; FR->region_paint = ipa_region_paint; FR->region_clip = ipa_region_clip; /* Allocate device data structure */ ddata = (wmf_magick_t *) wmf_malloc(API, sizeof(wmf_magick_t)); if (ERR(API)) return; (void) ResetMagickMemory((void *) ddata, 0, sizeof(wmf_magick_t)); API->device_data = (void *) ddata; /* Device data defaults */ ddata->image = 0; } ",0 "ReadUserLogStateAccess::isInitialized( void ) const { return m_state->isInitialized( ); } ",0 "static void free_note_info(struct elf_note_info *info) { while (!list_empty(&info->thread_list)) { struct list_head *tmp = info->thread_list.next; list_del(tmp); kfree(list_entry(tmp, struct elf_thread_status, list)); } /* Free data possibly allocated by fill_files_note(): */ if (info->notes_files) vfree(info->notes_files->data); kfree(info->prstatus); kfree(info->psinfo); kfree(info->notes); kfree(info->fpu); #ifdef ELF_CORE_COPY_XFPREGS kfree(info->xfpu); #endif } ",0 "static int __kvm_set_dr(struct kvm_vcpu *vcpu, int dr, unsigned long val) { switch (dr) { case 0 ... 3: vcpu->arch.db[dr] = val; if (!(vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP)) vcpu->arch.eff_db[dr] = val; break; case 4: /* fall through */ case 6: if (val & 0xffffffff00000000ULL) return -1; /* #GP */ vcpu->arch.dr6 = (val & DR6_VOLATILE) | kvm_dr6_fixed(vcpu); kvm_update_dr6(vcpu); break; case 5: /* fall through */ default: /* 7 */ if (val & 0xffffffff00000000ULL) return -1; /* #GP */ vcpu->arch.dr7 = (val & DR7_VOLATILE) | DR7_FIXED_1; kvm_update_dr7(vcpu); break; } return 0; } ",0 "struct ebt_entry *ebt_next_entry(const struct ebt_entry *entry) { return (void *)entry + entry->next_offset; } ",0 "nfsd4_decode_access(struct nfsd4_compoundargs *argp, struct nfsd4_access *access) { DECODE_HEAD; READ_BUF(4); access->ac_req_access = be32_to_cpup(p++); DECODE_TAIL; } ",0 "static int record_root_in_trans(struct btrfs_trans_handle *trans, struct btrfs_root *root) { if (root->ref_cows && root->last_trans < trans->transid) { WARN_ON(root == root->fs_info->extent_root); WARN_ON(root->commit_root != root->node); /* * see below for in_trans_setup usage rules * we have the reloc mutex held now, so there * is only one writer in this function */ root->in_trans_setup = 1; /* make sure readers find in_trans_setup before * they find our root->last_trans update */ smp_wmb(); spin_lock(&root->fs_info->fs_roots_radix_lock); if (root->last_trans == trans->transid) { spin_unlock(&root->fs_info->fs_roots_radix_lock); return 0; } radix_tree_tag_set(&root->fs_info->fs_roots_radix, (unsigned long)root->root_key.objectid, BTRFS_ROOT_TRANS_TAG); spin_unlock(&root->fs_info->fs_roots_radix_lock); root->last_trans = trans->transid; /* this is pretty tricky. We don't want to * take the relocation lock in btrfs_record_root_in_trans * unless we're really doing the first setup for this root in * this transaction. * * Normally we'd use root->last_trans as a flag to decide * if we want to take the expensive mutex. * * But, we have to set root->last_trans before we * init the relocation root, otherwise, we trip over warnings * in ctree.c. The solution used here is to flag ourselves * with root->in_trans_setup. When this is 1, we're still * fixing up the reloc trees and everyone must wait. * * When this is zero, they can trust root->last_trans and fly * through btrfs_record_root_in_trans without having to take the * lock. smp_wmb() makes sure that all the writes above are * done before we pop in the zero below */ btrfs_init_reloc_root(trans, root); smp_wmb(); root->in_trans_setup = 0; } return 0; } ",0 "static int aio_ring_mremap(struct vm_area_struct *vma) { struct file *file = vma->vm_file; struct mm_struct *mm = vma->vm_mm; struct kioctx_table *table; int i, res = -EINVAL; spin_lock(&mm->ioctx_lock); rcu_read_lock(); table = rcu_dereference(mm->ioctx_table); for (i = 0; i < table->nr; i++) { struct kioctx *ctx; ctx = table->table[i]; if (ctx && ctx->aio_ring_file == file) { if (!atomic_read(&ctx->dead)) { ctx->user_id = ctx->mmap_base = vma->vm_start; res = 0; } break; } } rcu_read_unlock(); spin_unlock(&mm->ioctx_lock); return res; } ",0 "long btrfs_ioctl_trans_end(struct file *file) { struct inode *inode = fdentry(file)->d_inode; struct btrfs_root *root = BTRFS_I(inode)->root; struct btrfs_trans_handle *trans; trans = file->private_data; if (!trans) return -EINVAL; file->private_data = NULL; btrfs_end_transaction(trans, root); atomic_dec(&root->fs_info->open_ioctl_trans); mnt_drop_write_file(file); return 0; } ",0 "void HTMLBodyElement::parseAttribute(const QualifiedName& name, const AtomicString& value) { if (name == vlinkAttr || name == alinkAttr || name == linkAttr) { if (value.isNull()) { if (name == linkAttr) document().textLinkColors().resetLinkColor(); else if (name == vlinkAttr) document().textLinkColors().resetVisitedLinkColor(); else document().textLinkColors().resetActiveLinkColor(); } else { RGBA32 color; if (BisonCSSParser::parseColor(color, value, !document().inQuirksMode())) { if (name == linkAttr) document().textLinkColors().setLinkColor(color); else if (name == vlinkAttr) document().textLinkColors().setVisitedLinkColor(color); else document().textLinkColors().setActiveLinkColor(color); } } setNeedsStyleRecalc(SubtreeStyleChange); } else if (name == onloadAttr) document().setWindowAttributeEventListener(EventTypeNames::load, createAttributeEventListener(document().frame(), name, value)); else if (name == onbeforeunloadAttr) document().setWindowAttributeEventListener(EventTypeNames::beforeunload, createAttributeEventListener(document().frame(), name, value)); else if (name == onunloadAttr) document().setWindowAttributeEventListener(EventTypeNames::unload, createAttributeEventListener(document().frame(), name, value)); else if (name == onpagehideAttr) document().setWindowAttributeEventListener(EventTypeNames::pagehide, createAttributeEventListener(document().frame(), name, value)); else if (name == onpageshowAttr) document().setWindowAttributeEventListener(EventTypeNames::pageshow, createAttributeEventListener(document().frame(), name, value)); else if (name == onpopstateAttr) document().setWindowAttributeEventListener(EventTypeNames::popstate, createAttributeEventListener(document().frame(), name, value)); else if (name == onblurAttr) document().setWindowAttributeEventListener(EventTypeNames::blur, createAttributeEventListener(document().frame(), name, value)); else if (name == onerrorAttr) document().setWindowAttributeEventListener(EventTypeNames::error, createAttributeEventListener(document().frame(), name, value)); else if (name == onfocusAttr) document().setWindowAttributeEventListener(EventTypeNames::focus, createAttributeEventListener(document().frame(), name, value)); else if (RuntimeEnabledFeatures::orientationEventEnabled() && name == onorientationchangeAttr) document().setWindowAttributeEventListener(EventTypeNames::orientationchange, createAttributeEventListener(document().frame(), name, value)); else if (name == onhashchangeAttr) document().setWindowAttributeEventListener(EventTypeNames::hashchange, createAttributeEventListener(document().frame(), name, value)); else if (name == onmessageAttr) document().setWindowAttributeEventListener(EventTypeNames::message, createAttributeEventListener(document().frame(), name, value)); else if (name == onresizeAttr) document().setWindowAttributeEventListener(EventTypeNames::resize, createAttributeEventListener(document().frame(), name, value)); else if (name == onscrollAttr) document().setWindowAttributeEventListener(EventTypeNames::scroll, createAttributeEventListener(document().frame(), name, value)); else if (name == onselectionchangeAttr) document().setAttributeEventListener(EventTypeNames::selectionchange, createAttributeEventListener(document().frame(), name, value)); else if (name == onstorageAttr) document().setWindowAttributeEventListener(EventTypeNames::storage, createAttributeEventListener(document().frame(), name, value)); else if (name == ononlineAttr) document().setWindowAttributeEventListener(EventTypeNames::online, createAttributeEventListener(document().frame(), name, value)); else if (name == onofflineAttr) document().setWindowAttributeEventListener(EventTypeNames::offline, createAttributeEventListener(document().frame(), name, value)); else HTMLElement::parseAttribute(name, value); } ",0 "xsltParsePreprocessStylesheetTree(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) { xmlNodePtr deleteNode, cur, txt, textNode = NULL; xmlDocPtr doc; xsltStylesheetPtr style; int internalize = 0, findSpaceAttr; int xsltStylesheetElemDepth; xmlAttrPtr attr; xmlChar *value; const xmlChar *name, *nsNameXSLT = NULL; int strictWhitespace, inXSLText = 0; #ifdef XSLT_REFACTORED_XSLT_NSCOMP xsltNsMapPtr nsMapItem; #endif if ((cctxt == NULL) || (cctxt->style == NULL) || (node == NULL) || (node->type != XML_ELEMENT_NODE)) return(-1); doc = node->doc; if (doc == NULL) goto internal_err; style = cctxt->style; if ((style->dict != NULL) && (doc->dict == style->dict)) internalize = 1; else style->internalized = 0; /* * Init value of xml:space. Since this might be an embedded * stylesheet, this is needed to be performed on the element * where the stylesheet is rooted at, taking xml:space of * ancestors into account. */ if (! cctxt->simplified) xsltStylesheetElemDepth = cctxt->depth +1; else xsltStylesheetElemDepth = 0; if (xmlNodeGetSpacePreserve(node) != 1) cctxt->inode->preserveWhitespace = 0; else cctxt->inode->preserveWhitespace = 1; /* * Eval if we should keep the old incorrect behaviour. */ strictWhitespace = (cctxt->strict != 0) ? 1 : 0; nsNameXSLT = xsltConstNamespaceNameXSLT; deleteNode = NULL; cur = node; while (cur != NULL) { if (deleteNode != NULL) { #ifdef WITH_XSLT_DEBUG_BLANKS xsltGenericDebug(xsltGenericDebugContext, ""xsltParsePreprocessStylesheetTree: removing node\n""); #endif xmlUnlinkNode(deleteNode); xmlFreeNode(deleteNode); deleteNode = NULL; } if (cur->type == XML_ELEMENT_NODE) { /* * Clear the PSVI field. */ cur->psvi = NULL; xsltCompilerNodePush(cctxt, cur); inXSLText = 0; textNode = NULL; findSpaceAttr = 1; cctxt->inode->stripWhitespace = 0; /* * TODO: I'd love to use a string pointer comparison here :-/ */ if (IS_XSLT_ELEM(cur)) { #ifdef XSLT_REFACTORED_XSLT_NSCOMP if (cur->ns->href != nsNameXSLT) { nsMapItem = xsltNewNamespaceMapItem(cctxt, doc, cur->ns, cur); if (nsMapItem == NULL) goto internal_err; cur->ns->href = nsNameXSLT; } #endif if (cur->name == NULL) goto process_attributes; /* * Mark the XSLT element for later recognition. * TODO: Using the marker is still too dangerous, since if * the parsing mechanism leaves out an XSLT element, then * this might hit the transformation-mechanism, which * will break if it doesn't expect such a marker. */ /* cur->psvi = (void *) xsltXSLTElemMarker; */ /* * XSLT 2.0: ""Any whitespace text node whose parent is * one of the following elements is removed from the "" * tree, regardless of any xml:space attributes:..."" * xsl:apply-imports, * xsl:apply-templates, * xsl:attribute-set, * xsl:call-template, * xsl:choose, * xsl:stylesheet, xsl:transform. * XSLT 2.0: xsl:analyze-string, * xsl:character-map, * xsl:next-match * * TODO: I'd love to use a string pointer comparison here :-/ */ name = cur->name; switch (*name) { case 't': if ((name[0] == 't') && (name[1] == 'e') && (name[2] == 'x') && (name[3] == 't') && (name[4] == 0)) { /* * Process the xsl:text element. * ---------------------------- * Mark it for later recognition. */ cur->psvi = (void *) xsltXSLTTextMarker; /* * For stylesheets, the set of * whitespace-preserving element names * consists of just xsl:text. */ findSpaceAttr = 0; cctxt->inode->preserveWhitespace = 1; inXSLText = 1; } break; case 'c': if (xmlStrEqual(name, BAD_CAST ""choose"") || xmlStrEqual(name, BAD_CAST ""call-template"")) cctxt->inode->stripWhitespace = 1; break; case 'a': if (xmlStrEqual(name, BAD_CAST ""apply-templates"") || xmlStrEqual(name, BAD_CAST ""apply-imports"") || xmlStrEqual(name, BAD_CAST ""attribute-set"")) cctxt->inode->stripWhitespace = 1; break; default: if (xsltStylesheetElemDepth == cctxt->depth) { /* * This is a xsl:stylesheet/xsl:transform. */ cctxt->inode->stripWhitespace = 1; break; } if ((cur->prev != NULL) && (cur->prev->type == XML_TEXT_NODE)) { /* * XSLT 2.0 : ""Any whitespace text node whose * following-sibling node is an xsl:param or * xsl:sort element is removed from the tree, * regardless of any xml:space attributes."" */ if (((*name == 'p') || (*name == 's')) && (xmlStrEqual(name, BAD_CAST ""param"") || xmlStrEqual(name, BAD_CAST ""sort""))) { do { if (IS_BLANK_NODE(cur->prev)) { txt = cur->prev; xmlUnlinkNode(txt); xmlFreeNode(txt); } else { /* * This will result in a content * error, when hitting the parsing * functions. */ break; } } while (cur->prev); } } break; } } process_attributes: /* * Process attributes. * ------------------ */ if (cur->properties != NULL) { if (cur->children == NULL) findSpaceAttr = 0; attr = cur->properties; do { #ifdef XSLT_REFACTORED_XSLT_NSCOMP if ((attr->ns) && (attr->ns->href != nsNameXSLT) && xmlStrEqual(attr->ns->href, nsNameXSLT)) { nsMapItem = xsltNewNamespaceMapItem(cctxt, doc, attr->ns, cur); if (nsMapItem == NULL) goto internal_err; attr->ns->href = nsNameXSLT; } #endif if (internalize) { /* * Internalize the attribute's value; the goal is to * speed up operations and minimize used space by * compiled stylesheets. */ txt = attr->children; /* * NOTE that this assumes only one * text-node in the attribute's content. */ if ((txt != NULL) && (txt->content != NULL) && (!xmlDictOwns(style->dict, txt->content))) { value = (xmlChar *) xmlDictLookup(style->dict, txt->content, -1); xmlNodeSetContent(txt, NULL); txt->content = value; } } /* * Process xml:space attributes. * ---------------------------- */ if ((findSpaceAttr != 0) && (attr->ns != NULL) && (attr->name != NULL) && (attr->name[0] == 's') && (attr->ns->prefix != NULL) && (attr->ns->prefix[0] == 'x') && (attr->ns->prefix[1] == 'm') && (attr->ns->prefix[2] == 'l') && (attr->ns->prefix[3] == 0)) { value = xmlGetNsProp(cur, BAD_CAST ""space"", XML_XML_NAMESPACE); if (value != NULL) { if (xmlStrEqual(value, BAD_CAST ""preserve"")) { cctxt->inode->preserveWhitespace = 1; } else if (xmlStrEqual(value, BAD_CAST ""default"")) { cctxt->inode->preserveWhitespace = 0; } else { /* Invalid value for xml:space. */ xsltTransformError(NULL, style, cur, ""Attribute xml:space: Invalid value.\n""); cctxt->style->warnings++; } findSpaceAttr = 0; xmlFree(value); } } attr = attr->next; } while (attr != NULL); } /* * We'll descend into the children of element nodes only. */ if (cur->children != NULL) { cur = cur->children; continue; } } else if ((cur->type == XML_TEXT_NODE) || (cur->type == XML_CDATA_SECTION_NODE)) { /* * Merge adjacent text/CDATA-section-nodes * --------------------------------------- * In order to avoid breaking of existing stylesheets, * if the old behaviour is wanted (strictWhitespace == 0), * then we *won't* merge adjacent text-nodes * (except in xsl:text); this will ensure that whitespace-only * text nodes are (incorrectly) not stripped in some cases. * * Example: : zoo * Corrent (strict) result: zoo * Incorrect (old) result : zoo * * NOTE that we *will* merge adjacent text-nodes if * they are in xsl:text. * Example, the following: * zoo * will result in both cases in: * zoo */ cur->type = XML_TEXT_NODE; if ((strictWhitespace != 0) || (inXSLText != 0)) { /* * New behaviour; merge nodes. */ if (textNode == NULL) textNode = cur; else { if (cur->content != NULL) xmlNodeAddContent(textNode, cur->content); deleteNode = cur; } if ((cur->next == NULL) || (cur->next->type == XML_ELEMENT_NODE)) goto end_of_text; else goto next_sibling; } else { /* * Old behaviour. */ if (textNode == NULL) textNode = cur; goto end_of_text; } } else if ((cur->type == XML_COMMENT_NODE) || (cur->type == XML_PI_NODE)) { /* * Remove processing instructions and comments. */ deleteNode = cur; if ((cur->next == NULL) || (cur->next->type == XML_ELEMENT_NODE)) goto end_of_text; else goto next_sibling; } else { textNode = NULL; /* * Invalid node-type for this data-model. */ xsltTransformError(NULL, style, cur, ""Invalid type of node for the XSLT data model.\n""); cctxt->style->errors++; goto next_sibling; } end_of_text: if (textNode) { value = textNode->content; /* * At this point all adjacent text/CDATA-section nodes * have been merged. * * Strip whitespace-only text-nodes. * (cctxt->inode->stripWhitespace) */ if ((value == NULL) || (*value == 0) || (((cctxt->inode->stripWhitespace) || (! cctxt->inode->preserveWhitespace)) && IS_BLANK(*value) && xsltIsBlank(value))) { if (textNode != cur) { xmlUnlinkNode(textNode); xmlFreeNode(textNode); } else deleteNode = textNode; textNode = NULL; goto next_sibling; } /* * Convert CDATA-section nodes to text-nodes. * TODO: Can this produce problems? */ if (textNode->type != XML_TEXT_NODE) { textNode->type = XML_TEXT_NODE; textNode->name = xmlStringText; } if (internalize && (textNode->content != NULL) && (!xmlDictOwns(style->dict, textNode->content))) { /* * Internalize the string. */ value = (xmlChar *) xmlDictLookup(style->dict, textNode->content, -1); xmlNodeSetContent(textNode, NULL); textNode->content = value; } textNode = NULL; /* * Note that ""disable-output-escaping"" of the xsl:text * element will be applied at a later level, when * XSLT elements are processed. */ } next_sibling: if (cur->type == XML_ELEMENT_NODE) { xsltCompilerNodePop(cctxt, cur); } if (cur == node) break; if (cur->next != NULL) { cur = cur->next; } else { cur = cur->parent; inXSLText = 0; goto next_sibling; }; } if (deleteNode != NULL) { #ifdef WITH_XSLT_DEBUG_PARSING xsltGenericDebug(xsltGenericDebugContext, ""xsltParsePreprocessStylesheetTree: removing node\n""); #endif xmlUnlinkNode(deleteNode); xmlFreeNode(deleteNode); } return(0); internal_err: return(-1); } ",0 "void BrowserEventRouter::RegisterForTabNotifications(WebContents* contents) { registrar_.Add( this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, content::Source(&contents->GetController())); registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, content::Source(contents)); } ",0 "void sta_info_stop(struct ieee80211_local *local) { del_timer_sync(&local->sta_cleanup); } ",0 "bool UsbChooserContext::HasDevicePermission( const GURL& requesting_origin, const GURL& embedding_origin, scoped_refptr device) { if (!device) return false; device::mojom::UsbDeviceInfoPtr device_info = device::mojom::UsbDeviceInfo::From(*device); DCHECK(device_info); return HasDevicePermission(requesting_origin, embedding_origin, *device_info); } ",0 "_uiserver_decrypt (void *engine, int verify, gpgme_data_t ciph, gpgme_data_t plain) { engine_uiserver_t uiserver = engine; gpgme_error_t err; const char *protocol; char *cmd; if (!uiserver) return gpg_error (GPG_ERR_INV_VALUE); if (uiserver->protocol == GPGME_PROTOCOL_DEFAULT) protocol = """"; else if (uiserver->protocol == GPGME_PROTOCOL_OpenPGP) protocol = "" --protocol=OpenPGP""; else if (uiserver->protocol == GPGME_PROTOCOL_CMS) protocol = "" --protocol=CMS""; else return gpgme_error (GPG_ERR_UNSUPPORTED_PROTOCOL); if (asprintf (&cmd, ""DECRYPT%s%s"", protocol, verify ? """" : "" --no-verify"") < 0) return gpg_error_from_syserror (); uiserver->input_cb.data = ciph; err = uiserver_set_fd (uiserver, INPUT_FD, map_data_enc (uiserver->input_cb.data)); if (err) { free (cmd); return gpg_error (GPG_ERR_GENERAL); /* FIXME */ } uiserver->output_cb.data = plain; err = uiserver_set_fd (uiserver, OUTPUT_FD, 0); if (err) { free (cmd); return gpg_error (GPG_ERR_GENERAL); /* FIXME */ } uiserver->inline_data = NULL; err = start (engine, cmd); free (cmd); return err; } ",0 "MojoResult UnwrapMachPort(ScopedHandle handle, mach_port_t* port) { MojoPlatformHandle platform_handle; platform_handle.struct_size = sizeof(MojoPlatformHandle); MojoResult result = MojoUnwrapPlatformHandle(handle.release().value(), &platform_handle); if (result != MOJO_RESULT_OK) return result; CHECK(platform_handle.type == MOJO_PLATFORM_HANDLE_TYPE_MACH_PORT || platform_handle.type == MOJO_PLATFORM_HANDLE_TYPE_INVALID); *port = static_cast(platform_handle.value); return MOJO_RESULT_OK; } ",0 "const char *str8(const uint16_t *x, size_t x_len) { static char buf[128]; size_t max = 127; char *p = buf; if (x_len < max) { max = x_len; } if (x) { while ((max > 0) && (*x != '\0')) { *p++ = *x++; max--; } } *p++ = 0; return buf; } ",0 "cupsd_start_tls(cupsd_client_t *con, /* I - Client connection */ http_encryption_t e) /* I - Encryption mode */ { if (httpEncryption(con->http, e)) { cupsdLogClient(con, CUPSD_LOG_ERROR, ""Unable to encrypt connection: %s"", cupsLastErrorString()); return (-1); } cupsdLogClient(con, CUPSD_LOG_DEBUG, ""Connection now encrypted.""); return (0); } ",0 "void set_mm_exe_file(struct mm_struct *mm, struct file *new_exe_file) { if (new_exe_file) get_file(new_exe_file); if (mm->exe_file) fput(mm->exe_file); mm->exe_file = new_exe_file; mm->num_exe_file_vmas = 0; } ",0 "void __dev_kfree_skb_irq(struct sk_buff *skb, enum skb_free_reason reason) { unsigned long flags; if (likely(atomic_read(&skb->users) == 1)) { smp_rmb(); atomic_set(&skb->users, 0); } else if (likely(!atomic_dec_and_test(&skb->users))) { return; } get_kfree_skb_cb(skb)->reason = reason; local_irq_save(flags); skb->next = __this_cpu_read(softnet_data.completion_queue); __this_cpu_write(softnet_data.completion_queue, skb); raise_softirq_irqoff(NET_TX_SOFTIRQ); local_irq_restore(flags); } ",0 "unsigned char *ssl_add_clienthello_tlsext(SSL *s, unsigned char *buf, unsigned char *limit) { int extdatalen=0; unsigned char *orig = buf; unsigned char *ret = buf; /* don't add extensions for SSLv3 unless doing secure renegotiation */ if (s->client_version == SSL3_VERSION && !s->s3->send_connection_binding) return orig; ret+=2; if (ret>=limit) return NULL; /* this really never occurs, but ... */ if (s->tlsext_hostname != NULL) { /* Add TLS extension servername to the Client Hello message */ unsigned long size_str; long lenmax; /* check for enough space. 4 for the servername type and entension length 2 for servernamelist length 1 for the hostname type 2 for hostname length + hostname length */ if ((lenmax = limit - ret - 9) < 0 || (size_str = strlen(s->tlsext_hostname)) > (unsigned long)lenmax) return NULL; /* extension type and length */ s2n(TLSEXT_TYPE_server_name,ret); s2n(size_str+5,ret); /* length of servername list */ s2n(size_str+3,ret); /* hostname type, length and hostname */ *(ret++) = (unsigned char) TLSEXT_NAMETYPE_host_name; s2n(size_str,ret); memcpy(ret, s->tlsext_hostname, size_str); ret+=size_str; } /* Add RI if renegotiating */ if (s->renegotiate) { int el; if(!ssl_add_clienthello_renegotiate_ext(s, 0, &el, 0)) { SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); return NULL; } if((limit - ret - 4 - el) < 0) return NULL; s2n(TLSEXT_TYPE_renegotiate,ret); s2n(el,ret); if(!ssl_add_clienthello_renegotiate_ext(s, ret, &el, el)) { SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); return NULL; } ret += el; } #ifndef OPENSSL_NO_SRP /* Add SRP username if there is one */ if (s->srp_ctx.login != NULL) { /* Add TLS extension SRP username to the Client Hello message */ int login_len = strlen(s->srp_ctx.login); if (login_len > 255 || login_len == 0) { SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); return NULL; } /* check for enough space. 4 for the srp type type and entension length 1 for the srp user identity + srp user identity length */ if ((limit - ret - 5 - login_len) < 0) return NULL; /* fill in the extension */ s2n(TLSEXT_TYPE_srp,ret); s2n(login_len+1,ret); (*ret++) = (unsigned char) login_len; memcpy(ret, s->srp_ctx.login, login_len); ret+=login_len; } #endif #ifndef OPENSSL_NO_EC if (s->tlsext_ecpointformatlist != NULL) { /* Add TLS extension ECPointFormats to the ClientHello message */ long lenmax; if ((lenmax = limit - ret - 5) < 0) return NULL; if (s->tlsext_ecpointformatlist_length > (unsigned long)lenmax) return NULL; if (s->tlsext_ecpointformatlist_length > 255) { SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); return NULL; } s2n(TLSEXT_TYPE_ec_point_formats,ret); s2n(s->tlsext_ecpointformatlist_length + 1,ret); *(ret++) = (unsigned char) s->tlsext_ecpointformatlist_length; memcpy(ret, s->tlsext_ecpointformatlist, s->tlsext_ecpointformatlist_length); ret+=s->tlsext_ecpointformatlist_length; } if (s->tlsext_ellipticcurvelist != NULL) { /* Add TLS extension EllipticCurves to the ClientHello message */ long lenmax; if ((lenmax = limit - ret - 6) < 0) return NULL; if (s->tlsext_ellipticcurvelist_length > (unsigned long)lenmax) return NULL; if (s->tlsext_ellipticcurvelist_length > 65532) { SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); return NULL; } s2n(TLSEXT_TYPE_elliptic_curves,ret); s2n(s->tlsext_ellipticcurvelist_length + 2, ret); /* NB: draft-ietf-tls-ecc-12.txt uses a one-byte prefix for * elliptic_curve_list, but the examples use two bytes. * http://www1.ietf.org/mail-archive/web/tls/current/msg00538.html * resolves this to two bytes. */ s2n(s->tlsext_ellipticcurvelist_length, ret); memcpy(ret, s->tlsext_ellipticcurvelist, s->tlsext_ellipticcurvelist_length); ret+=s->tlsext_ellipticcurvelist_length; } #endif /* OPENSSL_NO_EC */ if (!(SSL_get_options(s) & SSL_OP_NO_TICKET)) { int ticklen; if (!s->new_session && s->session && s->session->tlsext_tick) ticklen = s->session->tlsext_ticklen; else if (s->session && s->tlsext_session_ticket && s->tlsext_session_ticket->data) { ticklen = s->tlsext_session_ticket->length; s->session->tlsext_tick = OPENSSL_malloc(ticklen); if (!s->session->tlsext_tick) return NULL; memcpy(s->session->tlsext_tick, s->tlsext_session_ticket->data, ticklen); s->session->tlsext_ticklen = ticklen; } else ticklen = 0; if (ticklen == 0 && s->tlsext_session_ticket && s->tlsext_session_ticket->data == NULL) goto skip_ext; /* Check for enough room 2 for extension type, 2 for len * rest for ticket */ if ((long)(limit - ret - 4 - ticklen) < 0) return NULL; s2n(TLSEXT_TYPE_session_ticket,ret); s2n(ticklen,ret); if (ticklen) { memcpy(ret, s->session->tlsext_tick, ticklen); ret += ticklen; } } skip_ext: if (TLS1_get_client_version(s) >= TLS1_2_VERSION) { if ((size_t)(limit - ret) < sizeof(tls12_sigalgs) + 6) return NULL; s2n(TLSEXT_TYPE_signature_algorithms,ret); s2n(sizeof(tls12_sigalgs) + 2, ret); s2n(sizeof(tls12_sigalgs), ret); memcpy(ret, tls12_sigalgs, sizeof(tls12_sigalgs)); ret += sizeof(tls12_sigalgs); } #ifdef TLSEXT_TYPE_opaque_prf_input if (s->s3->client_opaque_prf_input != NULL && s->version != DTLS1_VERSION) { size_t col = s->s3->client_opaque_prf_input_len; if ((long)(limit - ret - 6 - col < 0)) return NULL; if (col > 0xFFFD) /* can't happen */ return NULL; s2n(TLSEXT_TYPE_opaque_prf_input, ret); s2n(col + 2, ret); s2n(col, ret); memcpy(ret, s->s3->client_opaque_prf_input, col); ret += col; } #endif if (s->tlsext_status_type == TLSEXT_STATUSTYPE_ocsp && s->version != DTLS1_VERSION) { int i; long extlen, idlen, itmp; OCSP_RESPID *id; idlen = 0; for (i = 0; i < sk_OCSP_RESPID_num(s->tlsext_ocsp_ids); i++) { id = sk_OCSP_RESPID_value(s->tlsext_ocsp_ids, i); itmp = i2d_OCSP_RESPID(id, NULL); if (itmp <= 0) return NULL; idlen += itmp + 2; } if (s->tlsext_ocsp_exts) { extlen = i2d_X509_EXTENSIONS(s->tlsext_ocsp_exts, NULL); if (extlen < 0) return NULL; } else extlen = 0; if ((long)(limit - ret - 7 - extlen - idlen) < 0) return NULL; s2n(TLSEXT_TYPE_status_request, ret); if (extlen + idlen > 0xFFF0) return NULL; s2n(extlen + idlen + 5, ret); *(ret++) = TLSEXT_STATUSTYPE_ocsp; s2n(idlen, ret); for (i = 0; i < sk_OCSP_RESPID_num(s->tlsext_ocsp_ids); i++) { /* save position of id len */ unsigned char *q = ret; id = sk_OCSP_RESPID_value(s->tlsext_ocsp_ids, i); /* skip over id len */ ret += 2; itmp = i2d_OCSP_RESPID(id, &ret); /* write id len */ s2n(itmp, q); } s2n(extlen, ret); if (extlen > 0) i2d_X509_EXTENSIONS(s->tlsext_ocsp_exts, &ret); } #ifndef OPENSSL_NO_HEARTBEATS /* Add Heartbeat extension */ if ((limit - ret - 4 - 1) < 0) return NULL; s2n(TLSEXT_TYPE_heartbeat,ret); s2n(1,ret); /* Set mode: * 1: peer may send requests * 2: peer not allowed to send requests */ if (s->tlsext_heartbeat & SSL_TLSEXT_HB_DONT_RECV_REQUESTS) *(ret++) = SSL_TLSEXT_HB_DONT_SEND_REQUESTS; else *(ret++) = SSL_TLSEXT_HB_ENABLED; #endif #ifndef OPENSSL_NO_NEXTPROTONEG if (s->ctx->next_proto_select_cb && !s->s3->tmp.finish_md_len) { /* The client advertises an emtpy extension to indicate its * support for Next Protocol Negotiation */ if (limit - ret - 4 < 0) return NULL; s2n(TLSEXT_TYPE_next_proto_neg,ret); s2n(0,ret); } #endif #ifndef OPENSSL_NO_SRTP if(SSL_get_srtp_profiles(s)) { int el; ssl_add_clienthello_use_srtp_ext(s, 0, &el, 0); if((limit - ret - 4 - el) < 0) return NULL; s2n(TLSEXT_TYPE_use_srtp,ret); s2n(el,ret); if(ssl_add_clienthello_use_srtp_ext(s, ret, &el, el)) { SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); return NULL; } ret += el; } #endif /* Add padding to workaround bugs in F5 terminators. * See https://tools.ietf.org/html/draft-agl-tls-padding-03 * * NB: because this code works out the length of all existing * extensions it MUST always appear last. */ if (s->options & SSL_OP_TLSEXT_PADDING) { int hlen = ret - (unsigned char *)s->init_buf->data; /* The code in s23_clnt.c to build ClientHello messages * includes the 5-byte record header in the buffer, while * the code in s3_clnt.c does not. */ if (s->state == SSL23_ST_CW_CLNT_HELLO_A) hlen -= 5; if (hlen > 0xff && hlen < 0x200) { hlen = 0x200 - hlen; if (hlen >= 4) hlen -= 4; else hlen = 0; s2n(TLSEXT_TYPE_padding, ret); s2n(hlen, ret); memset(ret, 0, hlen); ret += hlen; } } if ((extdatalen = ret-orig-2)== 0) return orig; s2n(extdatalen, orig); return ret; } ",1 " TestHistoryWebFrameClient() { m_replacesCurrentHistoryItem = false; m_frame = 0; } ",0 "void ewk_view_load_document_finished(Evas_Object* ewkView, Evas_Object* frame) { evas_object_smart_callback_call(ewkView, ""load,document,finished"", frame); } ",0 "asmlinkage long sys_time(time_t __user * tloc) { time_t i = get_seconds(); if (tloc) { if (put_user(i,tloc)) i = -EFAULT; } return i; } ",0 "static char * out_get_parameters(const struct audio_stream *stream, const char *keys) { UNUSED(keys); struct a2dp_stream_out *out = (struct a2dp_stream_out *)stream; FNLOG(); /* add populating param here */ return strdup(""""); } ",0 "net::Error NetErrorFromString(const std::string& error, bool* ok) { *ok = true; if (error == Network::ErrorReasonEnum::Failed) return net::ERR_FAILED; if (error == Network::ErrorReasonEnum::Aborted) return net::ERR_ABORTED; if (error == Network::ErrorReasonEnum::TimedOut) return net::ERR_TIMED_OUT; if (error == Network::ErrorReasonEnum::AccessDenied) return net::ERR_ACCESS_DENIED; if (error == Network::ErrorReasonEnum::ConnectionClosed) return net::ERR_CONNECTION_CLOSED; if (error == Network::ErrorReasonEnum::ConnectionReset) return net::ERR_CONNECTION_RESET; if (error == Network::ErrorReasonEnum::ConnectionRefused) return net::ERR_CONNECTION_REFUSED; if (error == Network::ErrorReasonEnum::ConnectionAborted) return net::ERR_CONNECTION_ABORTED; if (error == Network::ErrorReasonEnum::ConnectionFailed) return net::ERR_CONNECTION_FAILED; if (error == Network::ErrorReasonEnum::NameNotResolved) return net::ERR_NAME_NOT_RESOLVED; if (error == Network::ErrorReasonEnum::InternetDisconnected) return net::ERR_INTERNET_DISCONNECTED; if (error == Network::ErrorReasonEnum::AddressUnreachable) return net::ERR_ADDRESS_UNREACHABLE; *ok = false; return net::ERR_FAILED; } ",0 "static int __dequeue_signal(struct sigpending *pending, sigset_t *mask, siginfo_t *info) { int sig = next_signal(pending, mask); if (sig) { if (current->notifier) { if (sigismember(current->notifier_mask, sig)) { if (!(current->notifier)(current->notifier_data)) { clear_thread_flag(TIF_SIGPENDING); return 0; } } } collect_signal(sig, pending, info); } return sig; } ",0 "static bool vmxnet3_verify_intx(VMXNET3State *s, int intx) { return s->msix_used || s->msi_used || (intx == (pci_get_byte(s->parent_obj.config + PCI_INTERRUPT_PIN) - 1)); } ",0 "static void copy_flags(unsigned long clone_flags, struct task_struct *p) { unsigned long new_flags = p->flags; new_flags &= ~(PF_SUPERPRIV | PF_WQ_WORKER); new_flags |= PF_FORKNOEXEC; new_flags |= PF_STARTING; p->flags = new_flags; clear_freeze_flag(p); } ",0 "parse_list(xmlChar *str) { xmlChar **buffer; xmlChar **out = NULL; int buffer_size = 0; int len; if(str == NULL) { return(NULL); } len = xmlStrlen(str); if((str[0] == '\'') && (str[len - 1] == '\'')) { str[len - 1] = '\0'; str++; } /* * allocate an translation buffer. */ buffer_size = 1000; buffer = (xmlChar **) xmlMalloc(buffer_size * sizeof(xmlChar*)); if (buffer == NULL) { perror(""malloc failed""); return(NULL); } out = buffer; while(*str != '\0') { if (out - buffer > buffer_size - 10) { int indx = out - buffer; xxx_growBufferReentrant(); out = &buffer[indx]; } (*out++) = str; while(*str != ',' && *str != '\0') ++str; if(*str == ',') *(str++) = '\0'; } (*out) = NULL; return buffer; } ",0 "bool AreSwitchesIdenticalToCurrentCommandLine( const base::CommandLine& new_cmdline, const base::CommandLine& active_cmdline, std::set* out_difference) { const char* extra_flag_sentinel_begin_flag_name = nullptr; const char* extra_flag_sentinel_end_flag_name = nullptr; #if defined(OS_CHROMEOS) extra_flag_sentinel_begin_flag_name = chromeos::switches::kPolicySwitchesBegin; extra_flag_sentinel_end_flag_name = chromeos::switches::kPolicySwitchesEnd; #endif return flags_ui::FlagsState::AreSwitchesIdenticalToCurrentCommandLine( new_cmdline, active_cmdline, out_difference, extra_flag_sentinel_begin_flag_name, extra_flag_sentinel_end_flag_name); } ",0 "can_vma_merge_before(struct vm_area_struct *vma, unsigned long vm_flags, struct anon_vma *anon_vma, struct file *file, pgoff_t vm_pgoff, struct vm_userfaultfd_ctx vm_userfaultfd_ctx) { if (is_mergeable_vma(vma, file, vm_flags, vm_userfaultfd_ctx) && is_mergeable_anon_vma(anon_vma, vma->anon_vma, vma)) { if (vma->vm_pgoff == vm_pgoff) return 1; } return 0; } ",0 "static inline void advance(struct pt_regs *regs) { regs->pc = regs->npc; regs->npc += 4; } ",0 "linkaddr_string(netdissect_options *ndo, const u_char *ep, const unsigned int type, const unsigned int len) { register u_int i; register char *cp; register struct enamemem *tp; if (len == 0) return (""""); if (type == LINKADDR_ETHER && len == ETHER_ADDR_LEN) return (etheraddr_string(ndo, ep)); if (type == LINKADDR_FRELAY) return (q922_string(ndo, ep, len)); tp = lookup_bytestring(ndo, ep, len); if (tp->e_name) return (tp->e_name); tp->e_name = cp = (char *)malloc(len*3); if (tp->e_name == NULL) (*ndo->ndo_error)(ndo, ""linkaddr_string: malloc""); *cp++ = hex[*ep >> 4]; *cp++ = hex[*ep++ & 0xf]; for (i = len-1; i > 0 ; --i) { *cp++ = ':'; *cp++ = hex[*ep >> 4]; *cp++ = hex[*ep++ & 0xf]; } *cp = '\0'; return (tp->e_name); } ",1 "struct crypto_alg *crypto_alg_lookup(const char *name, u32 type, u32 mask) { struct crypto_alg *alg; down_read(&crypto_alg_sem); alg = __crypto_alg_lookup(name, type, mask); up_read(&crypto_alg_sem); return alg; } ",0 "static void ucma_unlock_files(struct ucma_file *file1, struct ucma_file *file2) { if (file1 < file2) { mutex_unlock(&file2->mut); mutex_unlock(&file1->mut); } else { mutex_unlock(&file1->mut); mutex_unlock(&file2->mut); } } ",0 "void V8TestObject::VoidMethodTestInterfaceEmptyFrozenArrayMethodMethodCallback(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_voidMethodTestInterfaceEmptyFrozenArrayMethod""); test_object_v8_internal::VoidMethodTestInterfaceEmptyFrozenArrayMethodMethod(info); } ",0 "void V8WindowShell::updateDocument() { ASSERT(m_world->isMainWorld()); if (m_global.isEmpty()) return; if (m_context.isEmpty()) return; updateDocumentProperty(); updateSecurityOrigin(); } ",0 "static int fuse_try_move_page(struct fuse_copy_state *cs, struct page **pagep) { int err; struct page *oldpage = *pagep; struct page *newpage; struct pipe_buffer *buf = cs->pipebufs; err = unlock_request(cs->req); if (err) return err; fuse_copy_finish(cs); err = pipe_buf_confirm(cs->pipe, buf); if (err) return err; BUG_ON(!cs->nr_segs); cs->currbuf = buf; cs->len = buf->len; cs->pipebufs++; cs->nr_segs--; if (cs->len != PAGE_SIZE) goto out_fallback; if (pipe_buf_steal(cs->pipe, buf) != 0) goto out_fallback; newpage = buf->page; if (!PageUptodate(newpage)) SetPageUptodate(newpage); ClearPageMappedToDisk(newpage); if (fuse_check_page(newpage) != 0) goto out_fallback_unlock; /* * This is a new and locked page, it shouldn't be mapped or * have any special flags on it */ if (WARN_ON(page_mapped(oldpage))) goto out_fallback_unlock; if (WARN_ON(page_has_private(oldpage))) goto out_fallback_unlock; if (WARN_ON(PageDirty(oldpage) || PageWriteback(oldpage))) goto out_fallback_unlock; if (WARN_ON(PageMlocked(oldpage))) goto out_fallback_unlock; err = replace_page_cache_page(oldpage, newpage, GFP_KERNEL); if (err) { unlock_page(newpage); return err; } get_page(newpage); if (!(buf->flags & PIPE_BUF_FLAG_LRU)) lru_cache_add_file(newpage); err = 0; spin_lock(&cs->req->waitq.lock); if (test_bit(FR_ABORTED, &cs->req->flags)) err = -ENOENT; else *pagep = newpage; spin_unlock(&cs->req->waitq.lock); if (err) { unlock_page(newpage); put_page(newpage); return err; } unlock_page(oldpage); put_page(oldpage); cs->len = 0; return 0; out_fallback_unlock: unlock_page(newpage); out_fallback: cs->pg = buf->page; cs->offset = buf->offset; err = lock_request(cs->req); if (err) return err; return 1; } ",0 "static void *proc_self_follow_link(struct dentry *dentry, struct nameidata *nd) { struct pid_namespace *ns = dentry->d_sb->s_fs_info; pid_t tgid = task_tgid_nr_ns(current, ns); char *name = ERR_PTR(-ENOENT); if (tgid) { name = __getname(); if (!name) name = ERR_PTR(-ENOMEM); else sprintf(name, ""%d"", tgid); } nd_set_link(nd, name); return NULL; } ",0 "void LimitOffsets(const string16& str, std::vector* offsets_for_adjustment) { if (offsets_for_adjustment) { std::for_each(offsets_for_adjustment->begin(), offsets_for_adjustment->end(), LimitOffset(str.length())); } } ",0 "void Verify206Response(std::string response, int start, int end) { std::string raw_headers(net::HttpUtil::AssembleRawHeaders(response.data(), response.size())); scoped_refptr headers( new net::HttpResponseHeaders(raw_headers)); ASSERT_EQ(206, headers->response_code()); int64 range_start, range_end, object_size; ASSERT_TRUE( headers->GetContentRange(&range_start, &range_end, &object_size)); int64 content_length = headers->GetContentLength(); int length = end - start + 1; ASSERT_EQ(length, content_length); ASSERT_EQ(start, range_start); ASSERT_EQ(end, range_end); } ",0 "static int update_streams_from_subdemuxer(AVFormatContext *s, struct playlist *pls) { int err; while (pls->n_main_streams < pls->ctx->nb_streams) { int ist_idx = pls->n_main_streams; AVStream *st = avformat_new_stream(s, NULL); AVStream *ist = pls->ctx->streams[ist_idx]; if (!st) return AVERROR(ENOMEM); st->id = pls->index; dynarray_add(&pls->main_streams, &pls->n_main_streams, st); add_stream_to_programs(s, pls, st); err = set_stream_info_from_input_stream(st, pls, ist); if (err < 0) return err; } return 0; } ",0 "set_control_persist_exit_time(void) { if (muxserver_sock == -1 || !options.control_persist || options.control_persist_timeout == 0) { /* not using a ControlPersist timeout */ control_persist_exit_time = 0; } else if (channel_still_open()) { /* some client connections are still open */ if (control_persist_exit_time > 0) debug2(""%s: cancel scheduled exit"", __func__); control_persist_exit_time = 0; } else if (control_persist_exit_time <= 0) { /* a client connection has recently closed */ control_persist_exit_time = monotime() + (time_t)options.control_persist_timeout; debug2(""%s: schedule exit in %d seconds"", __func__, options.control_persist_timeout); } /* else we are already counting down to the timeout */ } ",0 "void WebBluetoothServiceImpl::OnStartNotifySessionSuccess( blink::mojom::WebBluetoothCharacteristicClientAssociatedPtr client, RemoteCharacteristicStartNotificationsCallback callback, std::unique_ptr notify_session) { DCHECK_CURRENTLY_ON(BrowserThread::UI); std::string characteristic_instance_id = notify_session->GetCharacteristicIdentifier(); std::move(callback).Run(blink::mojom::WebBluetoothResult::SUCCESS); auto gatt_notify_session_and_client = std::make_unique( std::move(notify_session), std::move(client)); characteristic_id_to_notify_session_[characteristic_instance_id] = std::move(gatt_notify_session_and_client); } ",0 " AcceleratorControllerTest() {}; ",0 "print_tree(FILE* f, Node* node) { print_indent_tree(f, node, 0); } ",0 " base::Optional GetAndResetLastForwardedGestureEvent() { base::Optional ret; last_forwarded_gesture_event_.swap(ret); return ret; } ",0 "cmsBool ReadMPEElem(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, void* Cargo, cmsUInt32Number n, cmsUInt32Number SizeOfTag) { cmsStageSignature ElementSig; cmsTagTypeHandler* TypeHandler; cmsUInt32Number nItems; cmsPipeline *NewLUT = (cmsPipeline *) Cargo; _cmsTagTypePluginChunkType* MPETypePluginChunk = ( _cmsTagTypePluginChunkType*) _cmsContextGetClientChunk(self->ContextID, MPEPlugin); if (!_cmsReadUInt32Number(io, (cmsUInt32Number*) &ElementSig)) return FALSE; if (!_cmsReadUInt32Number(io, NULL)) return FALSE; TypeHandler = GetHandler((cmsTagTypeSignature) ElementSig, MPETypePluginChunk ->TagTypes, SupportedMPEtypes); if (TypeHandler == NULL) { char String[5]; _cmsTagSignature2String(String, (cmsTagSignature) ElementSig); cmsSignalError(self ->ContextID, cmsERROR_UNKNOWN_EXTENSION, ""Unknown MPE type '%s' found."", String); return FALSE; } if (TypeHandler ->ReadPtr != NULL) { if (!cmsPipelineInsertStage(NewLUT, cmsAT_END, (cmsStage*) TypeHandler ->ReadPtr(self, io, &nItems, SizeOfTag))) return FALSE; } return TRUE; cmsUNUSED_PARAMETER(SizeOfTag); cmsUNUSED_PARAMETER(n); } ",0 "size_t jsvGetIndexFromLineAndCol(JsVar *v, size_t line, size_t col) { size_t x = 1; size_t y = 1; size_t n = 0; JsvStringIterator it; jsvStringIteratorNew(&it, v, 0); while (jsvStringIteratorHasChar(&it)) { char ch = jsvStringIteratorGetChar(&it); if ((y==line && x>=col) || y>line) { jsvStringIteratorFree(&it); return (y>line) ? (n-1) : n; } x++; if (ch=='\n') { x=1; y++; } n++; jsvStringIteratorNext(&it); } jsvStringIteratorFree(&it); return n; } ",0 "void cJSON_AddItemToObject( cJSON *object, const char *string, cJSON *item ) { if ( ! item ) return; if ( item->string ) cJSON_free( item->string ); item->string = cJSON_strdup( string ); cJSON_AddItemToArray( object, item ); } ",1 " void DeleteOriginFromDatabase(const GURL& origin, StorageType type) { quota_manager_->DeleteOriginFromDatabase(origin, type); } ",0 "static void callWithActiveWindowMethod(const v8::FunctionCallbackInfo& info) { TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); imp->callWithActiveWindow(callingDOMWindow(info.GetIsolate())); } ",0 "static bool ExecuteInsertLineBreak(LocalFrame& frame, Event* event, EditorCommandSource source, const String&) { switch (source) { case kCommandFromMenuOrKeyBinding: return TargetFrame(frame, event) ->GetEventHandler() .HandleTextInputEvent(""\n"", event, kTextEventInputLineBreak); case kCommandFromDOM: DCHECK(frame.GetDocument()); return TypingCommand::InsertLineBreak(*frame.GetDocument()); } NOTREACHED(); return false; } ",0 " AndroidOutputSurface( scoped_refptr context_provider, base::RepeatingCallback swap_buffers_callback) : viz::OutputSurface(std::move(context_provider)), swap_buffers_callback_(std::move(swap_buffers_callback)), overlay_candidate_validator_( new viz::CompositorOverlayCandidateValidatorAndroid()), weak_ptr_factory_(this) { capabilities_.max_frames_pending = kMaxDisplaySwapBuffers; } ",0 "static const struct arm_pmu *__init armv6mpcore_pmu_init(void) { return NULL; } ",0 "void WebFrame::resumeAnimations() { if (!m_coreFrame) return; AnimationController* controller = m_coreFrame->animation(); if (!controller) return; controller->resumeAnimations(); } ",0 "void WebGL2RenderingContextBase::texImage2D(ExecutionContext* execution_context, GLenum target, GLint level, GLint internalformat, GLenum format, GLenum type, HTMLImageElement* image, ExceptionState& exception_state) { if (isContextLost()) return; if (bound_pixel_unpack_buffer_) { SynthesizeGLError(GL_INVALID_OPERATION, ""texImage2D"", ""a buffer is bound to PIXEL_UNPACK_BUFFER""); return; } WebGLRenderingContextBase::texImage2D(execution_context, target, level, internalformat, format, type, image, exception_state); } ",0 "xmlXPathCmpNodesExt(xmlNodePtr node1, xmlNodePtr node2) { int depth1, depth2; int misc = 0, precedence1 = 0, precedence2 = 0; xmlNodePtr miscNode1 = NULL, miscNode2 = NULL; xmlNodePtr cur, root; long l1, l2; if ((node1 == NULL) || (node2 == NULL)) return(-2); if (node1 == node2) return(0); /* * a couple of optimizations which will avoid computations in most cases */ switch (node1->type) { case XML_ELEMENT_NODE: if (node2->type == XML_ELEMENT_NODE) { if ((0 > (long) node1->content) && /* TODO: Would a != 0 suffice here? */ (0 > (long) node2->content) && (node1->doc == node2->doc)) { l1 = -((long) node1->content); l2 = -((long) node2->content); if (l1 < l2) return(1); if (l1 > l2) return(-1); } else goto turtle_comparison; } break; case XML_ATTRIBUTE_NODE: precedence1 = 1; /* element is owner */ miscNode1 = node1; node1 = node1->parent; misc = 1; break; case XML_TEXT_NODE: case XML_CDATA_SECTION_NODE: case XML_COMMENT_NODE: case XML_PI_NODE: { miscNode1 = node1; /* * Find nearest element node. */ if (node1->prev != NULL) { do { node1 = node1->prev; if (node1->type == XML_ELEMENT_NODE) { precedence1 = 3; /* element in prev-sibl axis */ break; } if (node1->prev == NULL) { precedence1 = 2; /* element is parent */ /* * URGENT TODO: Are there any cases, where the * parent of such a node is not an element node? */ node1 = node1->parent; break; } } while (1); } else { precedence1 = 2; /* element is parent */ node1 = node1->parent; } if ((node1 == NULL) || (node1->type != XML_ELEMENT_NODE) || (0 <= (long) node1->content)) { /* * Fallback for whatever case. */ node1 = miscNode1; precedence1 = 0; } else misc = 1; } break; case XML_NAMESPACE_DECL: /* * TODO: why do we return 1 for namespace nodes? */ return(1); default: break; } switch (node2->type) { case XML_ELEMENT_NODE: break; case XML_ATTRIBUTE_NODE: precedence2 = 1; /* element is owner */ miscNode2 = node2; node2 = node2->parent; misc = 1; break; case XML_TEXT_NODE: case XML_CDATA_SECTION_NODE: case XML_COMMENT_NODE: case XML_PI_NODE: { miscNode2 = node2; if (node2->prev != NULL) { do { node2 = node2->prev; if (node2->type == XML_ELEMENT_NODE) { precedence2 = 3; /* element in prev-sibl axis */ break; } if (node2->prev == NULL) { precedence2 = 2; /* element is parent */ node2 = node2->parent; break; } } while (1); } else { precedence2 = 2; /* element is parent */ node2 = node2->parent; } if ((node2 == NULL) || (node2->type != XML_ELEMENT_NODE) || (0 <= (long) node1->content)) { node2 = miscNode2; precedence2 = 0; } else misc = 1; } break; case XML_NAMESPACE_DECL: return(1); default: break; } if (misc) { if (node1 == node2) { if (precedence1 == precedence2) { /* * The ugly case; but normally there aren't many * adjacent non-element nodes around. */ cur = miscNode2->prev; while (cur != NULL) { if (cur == miscNode1) return(1); if (cur->type == XML_ELEMENT_NODE) return(-1); cur = cur->prev; } return (-1); } else { /* * Evaluate based on higher precedence wrt to the element. * TODO: This assumes attributes are sorted before content. * Is this 100% correct? */ if (precedence1 < precedence2) return(1); else return(-1); } } /* * Special case: One of the helper-elements is contained by the other. * * * Text-1(precedence1 == 2) * * Text-6(precedence2 == 3) * */ if ((precedence2 == 3) && (precedence1 > 1)) { cur = node1->parent; while (cur) { if (cur == node2) return(1); cur = cur->parent; } } if ((precedence1 == 3) && (precedence2 > 1)) { cur = node2->parent; while (cur) { if (cur == node1) return(-1); cur = cur->parent; } } } /* * Speedup using document order if availble. */ if ((node1->type == XML_ELEMENT_NODE) && (node2->type == XML_ELEMENT_NODE) && (0 > (long) node1->content) && (0 > (long) node2->content) && (node1->doc == node2->doc)) { l1 = -((long) node1->content); l2 = -((long) node2->content); if (l1 < l2) return(1); if (l1 > l2) return(-1); } turtle_comparison: if (node1 == node2->prev) return(1); if (node1 == node2->next) return(-1); /* * compute depth to root */ for (depth2 = 0, cur = node2;cur->parent != NULL;cur = cur->parent) { if (cur == node1) return(1); depth2++; } root = cur; for (depth1 = 0, cur = node1;cur->parent != NULL;cur = cur->parent) { if (cur == node2) return(-1); depth1++; } /* * Distinct document (or distinct entities :-( ) case. */ if (root != cur) { return(-2); } /* * get the nearest common ancestor. */ while (depth1 > depth2) { depth1--; node1 = node1->parent; } while (depth2 > depth1) { depth2--; node2 = node2->parent; } while (node1->parent != node2->parent) { node1 = node1->parent; node2 = node2->parent; /* should not happen but just in case ... */ if ((node1 == NULL) || (node2 == NULL)) return(-2); } /* * Find who's first. */ if (node1 == node2->prev) return(1); if (node1 == node2->next) return(-1); /* * Speedup using document order if availble. */ if ((node1->type == XML_ELEMENT_NODE) && (node2->type == XML_ELEMENT_NODE) && (0 > (long) node1->content) && (0 > (long) node2->content) && (node1->doc == node2->doc)) { l1 = -((long) node1->content); l2 = -((long) node2->content); if (l1 < l2) return(1); if (l1 > l2) return(-1); } for (cur = node1->next;cur != NULL;cur = cur->next) if (cur == node2) return(1); return(-1); /* assume there is no sibling list corruption */ } ",0 "static int aesni_xts_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv, int enc) { EVP_AES_XTS_CTX *xctx = EVP_C_DATA(EVP_AES_XTS_CTX,ctx); if (!iv && !key) return 1; if (key) { /* key_len is two AES keys */ if (enc) { aesni_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 4, &xctx->ks1.ks); xctx->xts.block1 = (block128_f) aesni_encrypt; xctx->stream = aesni_xts_encrypt; } else { aesni_set_decrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 4, &xctx->ks1.ks); xctx->xts.block1 = (block128_f) aesni_decrypt; xctx->stream = aesni_xts_decrypt; } aesni_set_encrypt_key(key + EVP_CIPHER_CTX_key_length(ctx) / 2, EVP_CIPHER_CTX_key_length(ctx) * 4, &xctx->ks2.ks); xctx->xts.block2 = (block128_f) aesni_encrypt; xctx->xts.key1 = &xctx->ks1; } if (iv) { xctx->xts.key2 = &xctx->ks2; memcpy(EVP_CIPHER_CTX_iv_noconst(ctx), iv, 16); } return 1; } ",0 "ModuleExport size_t RegisterPSImage(void) { MagickInfo *entry; entry=AcquireMagickInfo(""PS"",""EPI"", ""Encapsulated PostScript Interchange format""); entry->decoder=(DecodeImageHandler *) ReadPSImage; entry->encoder=(EncodeImageHandler *) WritePSImage; entry->magick=(IsImageFormatHandler *) IsPS; entry->flags|=CoderDecoderSeekableStreamFlag; entry->flags^=CoderAdjoinFlag; entry->flags^=CoderBlobSupportFlag; entry->mime_type=ConstantString(""application/postscript""); (void) RegisterMagickInfo(entry); entry=AcquireMagickInfo(""PS"",""EPS"",""Encapsulated PostScript""); entry->decoder=(DecodeImageHandler *) ReadPSImage; entry->encoder=(EncodeImageHandler *) WritePSImage; entry->magick=(IsImageFormatHandler *) IsPS; entry->flags|=CoderDecoderSeekableStreamFlag; entry->flags^=CoderAdjoinFlag; entry->flags^=CoderBlobSupportFlag; entry->mime_type=ConstantString(""application/postscript""); (void) RegisterMagickInfo(entry); entry=AcquireMagickInfo(""PS"",""EPSF"",""Encapsulated PostScript""); entry->decoder=(DecodeImageHandler *) ReadPSImage; entry->encoder=(EncodeImageHandler *) WritePSImage; entry->magick=(IsImageFormatHandler *) IsPS; entry->flags|=CoderDecoderSeekableStreamFlag; entry->flags^=CoderAdjoinFlag; entry->flags^=CoderBlobSupportFlag; entry->mime_type=ConstantString(""application/postscript""); (void) RegisterMagickInfo(entry); entry=AcquireMagickInfo(""PS"",""EPSI"", ""Encapsulated PostScript Interchange format""); entry->decoder=(DecodeImageHandler *) ReadPSImage; entry->encoder=(EncodeImageHandler *) WritePSImage; entry->magick=(IsImageFormatHandler *) IsPS; entry->flags|=CoderDecoderSeekableStreamFlag; entry->flags^=CoderAdjoinFlag; entry->flags^=CoderBlobSupportFlag; entry->mime_type=ConstantString(""application/postscript""); (void) RegisterMagickInfo(entry); entry=AcquireMagickInfo(""PS"",""PS"",""PostScript""); entry->decoder=(DecodeImageHandler *) ReadPSImage; entry->encoder=(EncodeImageHandler *) WritePSImage; entry->magick=(IsImageFormatHandler *) IsPS; entry->mime_type=ConstantString(""application/postscript""); entry->flags|=CoderDecoderSeekableStreamFlag; entry->flags^=CoderBlobSupportFlag; (void) RegisterMagickInfo(entry); return(MagickImageCoderSignature); } ",0 "void _exit(int status) { fprint_str(stderr, ""_exit\n""); /* cause an unaligned access exception, that will drop you into gdb */ *(int *) 1 = status; while (1) ; /* avoid gcc warning because stdlib abort() has noreturn attribute */ } ",0 "static void cast5_encrypt(struct crypto_tfm *tfm, u8 *outbuf, const u8 *inbuf) { __cast5_encrypt(crypto_tfm_ctx(tfm), outbuf, inbuf); } ",0 "static void tsc210x_i2s_swallow(TSC210xState *s) { if (s->dac_voice[0]) tsc210x_out_flush(s, s->codec.out.len); else s->codec.out.len = 0; } ",0 "UnloadedExtensionInfo::UnloadedExtensionInfo( const Extension* extension, extension_misc::UnloadedExtensionReason reason) : reason(reason), already_disabled(false), extension(extension) {} ",0 "ScriptExecutor* ExecuteCodeInTabFunction::GetScriptExecutor( std::string* error) { Browser* browser = nullptr; content::WebContents* contents = nullptr; bool success = GetTabById(execute_tab_id_, browser_context(), include_incognito_information(), &browser, nullptr, &contents, nullptr, error) && contents && browser; if (!success) return nullptr; return TabHelper::FromWebContents(contents)->script_executor(); } ",0 "u64 kvm_read_l1_tsc(struct kvm_vcpu *vcpu, u64 host_tsc) { return kvm_x86_ops->read_l1_tsc(vcpu, kvm_scale_tsc(vcpu, host_tsc)); } ",0 "status_t CameraService::connectPro( const sp& cameraCb, int cameraId, const String16& clientPackageName, int clientUid, /*out*/ sp& device) { String8 clientName8(clientPackageName); int callingPid = getCallingPid(); LOG1(""CameraService::connectPro E (pid %d \""%s\"", id %d)"", callingPid, clientName8.string(), cameraId); status_t status = validateConnect(cameraId, /*inout*/clientUid); if (status != OK) { return status; } sp client; { Mutex::Autolock lock(mServiceLock); { sp client; if (!canConnectUnsafe(cameraId, clientPackageName, cameraCb->asBinder(), /*out*/client)) { return -EBUSY; } } int facing = -1; int deviceVersion = getDeviceVersion(cameraId, &facing); switch(deviceVersion) { case CAMERA_DEVICE_API_VERSION_1_0: ALOGE(""Camera id %d uses HALv1, doesn't support ProCamera"", cameraId); return -EOPNOTSUPP; break; case CAMERA_DEVICE_API_VERSION_2_0: case CAMERA_DEVICE_API_VERSION_2_1: case CAMERA_DEVICE_API_VERSION_3_0: client = new ProCamera2Client(this, cameraCb, clientPackageName, cameraId, facing, callingPid, clientUid, getpid()); break; case -1: ALOGE(""Invalid camera id %d"", cameraId); return BAD_VALUE; default: ALOGE(""Unknown camera device HAL version: %d"", deviceVersion); return INVALID_OPERATION; } status_t status = connectFinishUnsafe(client, client->getRemote()); if (status != OK) { return status; } mProClientList[cameraId].push(client); LOG1(""CameraService::connectPro X (id %d, this pid is %d)"", cameraId, getpid()); } device = client; return OK; } ",0 "void SetupDocumentLoader( DocumentLoader* document_loader, std::unique_ptr navigation_params) { if (!navigation_params) { document_loader->GetTiming().SetNavigationStart(CurrentTimeTicks()); return; } const WebNavigationTimings& navigation_timings = navigation_params->navigation_timings; document_loader->UpdateNavigationTimings( navigation_timings.navigation_start, navigation_timings.redirect_start, navigation_timings.redirect_end, navigation_timings.fetch_start, navigation_timings.input_start); document_loader->SetSourceLocation(navigation_params->source_location); if (navigation_params->is_user_activated) document_loader->SetUserActivated(); document_loader->SetServiceWorkerNetworkProvider( std::move(navigation_params->service_worker_network_provider)); } ",0 "void kvm_exit(void) { debugfs_remove_recursive(kvm_debugfs_dir); misc_deregister(&kvm_dev); kmem_cache_destroy(kvm_vcpu_cache); kvm_async_pf_deinit(); unregister_syscore_ops(&kvm_syscore_ops); unregister_reboot_notifier(&kvm_reboot_notifier); cpuhp_remove_state_nocalls(CPUHP_AP_KVM_STARTING); on_each_cpu(hardware_disable_nolock, NULL, 1); kvm_arch_hardware_unsetup(); kvm_arch_exit(); kvm_irqfd_exit(); free_cpumask_var(cpus_hardware_enabled); kvm_vfio_ops_exit(); } ",0 "ospf_api_errname (int errcode) { struct nametab NameTab[] = { { OSPF_API_OK, ""OK"", }, { OSPF_API_NOSUCHINTERFACE, ""No such interface"", }, { OSPF_API_NOSUCHAREA, ""No such area"", }, { OSPF_API_NOSUCHLSA, ""No such LSA"", }, { OSPF_API_ILLEGALLSATYPE, ""Illegal LSA type"", }, { OSPF_API_OPAQUETYPEINUSE, ""Opaque type in use"", }, { OSPF_API_OPAQUETYPENOTREGISTERED, ""Opaque type not registered"", }, { OSPF_API_NOTREADY, ""Not ready"", }, { OSPF_API_NOMEMORY, ""No memory"", }, { OSPF_API_ERROR, ""Other error"", }, { OSPF_API_UNDEF, ""Undefined"", }, }; int i, n = array_size(NameTab); const char *name = NULL; for (i = 0; i < n; i++) { if (NameTab[i].value == errcode) { name = NameTab[i].name; break; } } return name ? name : ""?""; } ",0 "static void perContextEnabledLongAttributeAttributeSetterCallback(v8::Local, v8::Local jsValue, const v8::PropertyCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMSetter""); TestObjectPythonV8Internal::perContextEnabledLongAttributeAttributeSetter(jsValue, info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 " scoped_refptr LoadUnpackedExtension( const base::FilePath::StringType& name) { base::FilePath extension_path(ui_test_utils::GetTestFilePath( base::FilePath(kTestExtensionsDir), base::FilePath(name))); extensions::ChromeTestExtensionLoader loader(browser()->profile()); return loader.LoadExtension(extension_path); } ",0 "static void MagickUsage(MagickBooleanType verbose) { const char *name; size_t len; name=GetClientName(); len=strlen(name); if (len>=7 && LocaleCompare(""convert"",name+len-7) == 0) { /* convert usage */ (void) FormatLocaleFile(stdout, ""Usage: %s [ {option} | {image} ... ] {output_image}\n"",name); (void) FormatLocaleFile(stdout, "" %s -help | -version | -usage | -list {option}\n\n"",name); return; } else if (len>=6 && LocaleCompare(""script"",name+len-6) == 0) { /* magick-script usage */ (void) FormatLocaleFile(stdout, ""Usage: %s {filename} [ {script_args} ... ]\n"",name); } else { /* magick usage */ (void) FormatLocaleFile(stdout, ""Usage: %s [ {option} | {image} ... ] {output_image}\n"",name); (void) FormatLocaleFile(stdout, "" %s [ {option} | {image} ... ] -script {filename} [ {script_args} ...]\n"", name); } (void) FormatLocaleFile(stdout, "" %s -help | -version | -usage | -list {option}\n\n"",name); if (verbose == MagickFalse) return; (void) FormatLocaleFile(stdout,""%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n"", ""All options are performed in a strict 'as you see them' order\n"", ""You must read-in images before you can operate on them.\n"", ""\n"", ""Magick Script files can use any of the following forms...\n"", "" #!/path/to/magick -script\n"", ""or\n"", "" #!/bin/sh\n"", "" :; exec magick -script \""$0\"" \""$@\""; exit 10\n"", "" # Magick script from here...\n"", ""or\n"", "" #!/usr/bin/env magick-script\n"", ""The latter two forms do not require the path to the command hard coded.\n"", ""Note: \""magick-script\"" needs to be linked to the \""magick\"" command.\n"", ""\n"", ""For more information on usage, options, examples, and techniques\n"", ""see the ImageMagick website at "", MagickAuthoritativeURL); return; } ",0 "static void snd_usb_mixer_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) { struct snd_usb_audio *chip = entry->private_data; struct usb_mixer_interface *mixer; struct usb_mixer_elem_list *list; int unitid; list_for_each_entry(mixer, &chip->mixer_list, list) { snd_iprintf(buffer, ""USB Mixer: usb_id=0x%08x, ctrlif=%i, ctlerr=%i\n"", chip->usb_id, snd_usb_ctrl_intf(chip), mixer->ignore_ctl_error); snd_iprintf(buffer, ""Card: %s\n"", chip->card->longname); for (unitid = 0; unitid < MAX_ID_ELEMS; unitid++) { for (list = mixer->id_elems[unitid]; list; list = list->next_id_elem) { snd_iprintf(buffer, "" Unit: %i\n"", list->id); if (list->kctl) snd_iprintf(buffer, "" Control: name=\""%s\"", index=%i\n"", list->kctl->id.name, list->kctl->id.index); if (list->dump) list->dump(buffer, list); } } } } ",0 "void ResourceDispatcherHost::PauseRequest(int child_id, int request_id, bool pause) { GlobalRequestID global_id(child_id, request_id); PendingRequestList::iterator i = pending_requests_.find(global_id); if (i == pending_requests_.end()) { DLOG(WARNING) << ""Pausing a request that wasn't found""; return; } ResourceDispatcherHostRequestInfo* info = InfoForRequest(i->second); int pause_count = info->pause_count() + (pause ? 1 : -1); if (pause_count < 0) { NOTREACHED(); // Unbalanced call to pause. return; } info->set_pause_count(pause_count); RESOURCE_LOG(""To pause ("" << pause << ""): "" << i->second->url().spec()); if (info->pause_count() == 0) { MessageLoop::current()->PostTask(FROM_HERE, method_runner_.NewRunnableMethod( &ResourceDispatcherHost::ResumeRequest, global_id)); } } ",0 "void js_rot3pop2(js_State *J) { /* A B C -> C */ STACK[TOP-3] = STACK[TOP-1]; TOP -= 2; } ",0 "const base::WeakPtr& LayerTreeHost::GetInputHandler() const { return input_handler_weak_ptr_; } ",0 "bool GLES2DecoderImpl::IsDrawValid(GLuint max_vertex_accessed) { if (!current_program_) { return false; } const VertexAttribManager::VertexAttribInfoList& infos = vertex_attrib_manager_.GetEnabledVertexAttribInfos(); for (VertexAttribManager::VertexAttribInfoList::const_iterator it = infos.begin(); it != infos.end(); ++it) { const VertexAttribManager::VertexAttribInfo* info = *it; const ProgramManager::ProgramInfo::VertexAttribInfo* attrib_info = current_program_->GetAttribInfoByLocation(info->index()); if (attrib_info) { if (!info->CanAccess(max_vertex_accessed)) { SetGLError(GL_INVALID_OPERATION, ""glDrawXXX: attempt to access out of range vertices""); return false; } } else { if (!info->buffer() || info->buffer()->IsDeleted()) { SetGLError( GL_INVALID_OPERATION, ""glDrawXXX: attempt to render with no buffer attached to enabled "" ""attrib""); return false; } } } return true; } ",0 "bool HTMLMediaElement::couldPlayIfEnoughData() const { return !paused() && !endedPlayback() && !stoppedDueToErrors(); } ",0 "static const char *ssh_pkt_type(Ssh ssh, int type) { if (ssh->version == 1) return ssh1_pkt_type(type); else return ssh2_pkt_type(ssh->pkt_kctx, ssh->pkt_actx, type); } ",0 "int ubifs_setattr(struct dentry *dentry, struct iattr *attr) { int err; struct inode *inode = dentry->d_inode; struct ubifs_info *c = inode->i_sb->s_fs_info; dbg_gen(""ino %lu, mode %#x, ia_valid %#x"", inode->i_ino, inode->i_mode, attr->ia_valid); err = inode_change_ok(inode, attr); if (err) return err; err = dbg_check_synced_i_size(c, inode); if (err) return err; if ((attr->ia_valid & ATTR_SIZE) && attr->ia_size < inode->i_size) /* Truncation to a smaller size */ err = do_truncation(c, inode, attr); else err = do_setattr(c, inode, attr); return err; } ",0 "int TestRunner::RunTest(const wchar_t* command) { if (MAX_STATE > 10) return SBOX_TEST_INVALID_PARAMETER; wchar_t state_number[2]; state_number[0] = L'0' + state_; state_number[1] = L'\0'; std::wstring full_command(state_number); full_command += L"" ""; full_command += command; return InternalRunTest(full_command.c_str()); } ",0 "int ext4_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, __u64 start, __u64 len) { ext4_lblk_t start_blk; int error = 0; /* fallback to generic here if not in extents fmt */ if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))) return generic_block_fiemap(inode, fieinfo, start, len, ext4_get_block); if (fiemap_check_flags(fieinfo, EXT4_FIEMAP_FLAGS)) return -EBADR; if (fieinfo->fi_flags & FIEMAP_FLAG_XATTR) { error = ext4_xattr_fiemap(inode, fieinfo); } else { ext4_lblk_t len_blks; __u64 last_blk; start_blk = start >> inode->i_sb->s_blocksize_bits; last_blk = (start + len - 1) >> inode->i_sb->s_blocksize_bits; if (last_blk >= EXT_MAX_BLOCK) last_blk = EXT_MAX_BLOCK-1; len_blks = ((ext4_lblk_t) last_blk) - start_blk + 1; /* * Walk the extent tree gathering extent information. * ext4_ext_fiemap_cb will push extents back to user. */ error = ext4_ext_walk_space(inode, start_blk, len_blks, ext4_ext_fiemap_cb, fieinfo); } return error; } ",0 "void Con_CheckResize( void ) { int i, j, width, oldwidth, oldtotallines, numlines, numchars; short tbuf[CON_TEXTSIZE]; width = ( SCREEN_WIDTH / SMALLCHAR_WIDTH ) - 2; if ( width == con.linewidth ) { return; } if ( width < 1 ) { // video hasn't been initialized yet width = DEFAULT_CONSOLE_WIDTH; con.linewidth = width; con.totallines = CON_TEXTSIZE / con.linewidth; for ( i = 0; i < CON_TEXTSIZE; i++ ) con.text[i] = ( ColorIndex( COLNSOLE_COLOR ) << 8 ) | ' '; } else { oldwidth = con.linewidth; con.linewidth = width; oldtotallines = con.totallines; con.totallines = CON_TEXTSIZE / con.linewidth; numlines = oldtotallines; if ( con.totallines < numlines ) { numlines = con.totallines; } numchars = oldwidth; if ( con.linewidth < numchars ) { numchars = con.linewidth; } memcpy( tbuf, con.text, CON_TEXTSIZE * sizeof( short ) ); for ( i = 0; i < CON_TEXTSIZE; i++ ) con.text[i] = ( ColorIndex( COLNSOLE_COLOR ) << 8 ) | ' '; for ( i = 0 ; i < numlines ; i++ ) { for ( j = 0 ; j < numchars ; j++ ) { con.text[( con.totallines - 1 - i ) * con.linewidth + j] = tbuf[( ( con.current - i + oldtotallines ) % oldtotallines ) * oldwidth + j]; } } Con_ClearNotify(); } con.current = con.totallines - 1; con.display = con.current; } ",0 "BOOLEAN btif_hl_find_mcl_idx_using_app_idx( tBTA_HL_MCL_HANDLE mcl_handle, UINT8 p_app_idx, UINT8 *p_mcl_idx){ btif_hl_app_cb_t *p_acb; BOOLEAN found=FALSE; UINT8 j; p_acb =BTIF_HL_GET_APP_CB_PTR(p_app_idx); for (j=0; j < BTA_HL_NUM_MCLS ; j++) { if (p_acb->mcb[j].in_use && (p_acb->mcb[j].mcl_handle == mcl_handle)) { found = TRUE; *p_mcl_idx = j; break; } } BTIF_TRACE_DEBUG(""%s found=%dmcl_idx=%d"",__FUNCTION__, found, j); return found; } ",0 "void QuotaManager::GetLRUOrigin( StorageType type, GetLRUOriginCallback* callback) { LazyInitialize(); DCHECK(!lru_origin_callback_.get()); lru_origin_callback_.reset(callback); if (db_disabled_) { lru_origin_callback_->Run(GURL()); lru_origin_callback_.reset(); return; } scoped_refptr task(new GetLRUOriginTask( this, type, origins_in_use_, origins_in_error_, callback_factory_.NewCallback( &QuotaManager::DidGetDatabaseLRUOrigin))); task->Start(); } ",0 "void GDataFileSystem::CheckLocalModificationAndRunAfterGetCacheFile( scoped_ptr entry_proto, const GetEntryInfoCallback& callback, GDataFileError error, const std::string& resource_id, const std::string& md5, const FilePath& local_cache_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (error != GDATA_FILE_OK) { if (!callback.is_null()) callback.Run(GDATA_FILE_OK, entry_proto.Pass()); return; } base::PlatformFileInfo* file_info = new base::PlatformFileInfo; bool* get_file_info_result = new bool(false); util::PostBlockingPoolSequencedTaskAndReply( FROM_HERE, blocking_task_runner_, base::Bind(&GetFileInfoOnBlockingPool, local_cache_path, base::Unretained(file_info), base::Unretained(get_file_info_result)), base::Bind(&GDataFileSystem::CheckLocalModificationAndRunAfterGetFileInfo, ui_weak_ptr_, base::Passed(&entry_proto), callback, base::Owned(file_info), base::Owned(get_file_info_result))); } ",0 "static void t1_start_eexec(PDF pdf) { int i; get_length1(); save_offset(); if (!t1_pfa) t1_check_block_len(false); for (t1_line_ptr = t1_line_array, i = 0; i < 4; i++) { edecrypt((byte) t1_getbyte()); *t1_line_ptr++ = 0; } t1_eexec_encrypt = true; /*tex To put the first four bytes: */ t1_putline(pdf); } ",0 "ServerWrapper::ServerWrapper(base::WeakPtr handler, std::unique_ptr socket, const base::FilePath& debug_frontend_dir, bool bundles_resources) : handler_(handler), server_(new net::HttpServer(std::move(socket), this)), debug_frontend_dir_(debug_frontend_dir), bundles_resources_(bundles_resources) {} ",0 "void WebGraphicsContext3DDefaultImpl::copyTexImage2D(unsigned long target, long level, unsigned long internalformat, long x, long y, unsigned long width, unsigned long height, long border) { makeContextCurrent(); bool needsResolve = (m_attributes.antialias && m_boundFBO == m_multisampleFBO); if (needsResolve) { resolveMultisampledFramebuffer(x, y, width, height); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo); } glCopyTexImage2D(target, level, internalformat, x, y, width, height, border); if (needsResolve) glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_boundFBO); } ",0 "PAM_EXTERN int pam_sm_acct_mgmt(pam_handle_t * pamh, int flags, int argc, const char **argv) { /* if the user has been authenticated (precondition of this call), then * everything is OK. Yes, we explicitly don't want to check CRLs, OCSP or * exparation of certificates (use pam_pkcs11 for this). */ return PAM_SUCCESS; } ",0 "static int read_wrapper_data (WavpackContext *wpc, WavpackMetadata *wpmd) { if ((wpc->open_flags & OPEN_WRAPPER) && wpc->wrapper_bytes < MAX_WRAPPER_BYTES && wpmd->byte_length) { wpc->wrapper_data = realloc (wpc->wrapper_data, wpc->wrapper_bytes + wpmd->byte_length); if (!wpc->wrapper_data) return FALSE; memcpy (wpc->wrapper_data + wpc->wrapper_bytes, wpmd->data, wpmd->byte_length); wpc->wrapper_bytes += wpmd->byte_length; } return TRUE; } ",0 "bool LayerTreeHostImpl::IsElementInList(ElementId element_id, ElementListType list_type) const { if (list_type == ElementListType::ACTIVE) { return active_tree() ? active_tree()->LayerByElementId(element_id) != nullptr : false; } else { if (pending_tree() && pending_tree()->LayerByElementId(element_id)) return true; if (recycle_tree() && recycle_tree()->LayerByElementId(element_id)) return true; return false; } } ",0 "static int mxf_parse_package_comments(MXFContext *mxf, AVDictionary **pm, MXFPackage *package) { MXFTaggedValue *tag; int size, i; char *key = NULL; for (i = 0; i < package->comment_count; i++) { tag = mxf_resolve_strong_ref(mxf, &package->comment_refs[i], TaggedValue); if (!tag || !tag->name || !tag->value) continue; size = strlen(tag->name) + 8 + 1; key = av_mallocz(size); if (!key) return AVERROR(ENOMEM); snprintf(key, size, ""comment_%s"", tag->name); av_dict_set(pm, key, tag->value, AV_DICT_DONT_STRDUP_KEY); } return 0; } ",0 " Histogram* CreateHistogram(const char* name, HistogramBase::Sample min, HistogramBase::Sample max, size_t bucket_count) { BucketRanges* ranges = new BucketRanges(bucket_count + 1); Histogram::InitializeBucketRanges(min, max, ranges); const BucketRanges* registered_ranges = StatisticsRecorder::RegisterOrDeleteDuplicateRanges(ranges); return new Histogram(name, min, max, registered_ranges); } ",0 "void V8TestObject::VoidMethodElementSequenceOrByteStringDoubleOrStringRecordMethodCallback(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_voidMethodElementSequenceOrByteStringDoubleOrStringRecord""); test_object_v8_internal::VoidMethodElementSequenceOrByteStringDoubleOrStringRecordMethod(info); } ",0 "bool CSPSource::portMatches(const KURL& url) const { if (m_portWildcard == HasWildcard) return true; int port = url.port(); if (port == m_port) return true; if (!port) return isDefaultPortForProtocol(m_port, url.protocol()); if (!m_port) return isDefaultPortForProtocol(port, url.protocol()); return false; } ",0 "void CreateWindowForRequest(const FrameLoadRequest& request, LocalFrame& opener_frame, NavigationPolicy policy) { DCHECK(request.GetResourceRequest().RequestorOrigin() || (opener_frame.GetDocument() && opener_frame.GetDocument()->Url().IsEmpty())); if (opener_frame.GetDocument()->PageDismissalEventBeingDispatched() != Document::kNoDismissal) return; if (opener_frame.GetDocument() && opener_frame.GetDocument()->IsSandboxed(kSandboxPopups)) return; if (policy == kNavigationPolicyCurrentTab) policy = kNavigationPolicyNewForegroundTab; WebWindowFeatures features; features.noopener = request.GetShouldSetOpener() == kNeverSetOpener; bool created; Frame* new_frame = CreateWindowHelper(opener_frame, opener_frame, opener_frame, request, features, policy, created); if (!new_frame) return; if (request.GetShouldSendReferrer() == kMaybeSendReferrer) { if (new_frame->IsLocalFrame()) ToLocalFrame(new_frame)->GetDocument()->SetReferrerPolicy( opener_frame.GetDocument()->GetReferrerPolicy()); } FrameLoadRequest new_request(0, request.GetResourceRequest()); new_request.SetForm(request.Form()); if (new_frame->IsLocalFrame()) ToLocalFrame(new_frame)->Loader().Load(new_request); } ",0 "static int mov_write_nmhd_tag(AVIOContext *pb) { avio_wb32(pb, 12); ffio_wfourcc(pb, ""nmhd""); avio_wb32(pb, 0); return 12; } ",0 "event_filter_match(struct perf_event *event) { return (event->cpu == -1 || event->cpu == smp_processor_id()) && perf_cgroup_match(event); } ",0 "static void setup_msrs(struct vcpu_vmx *vmx) { int save_nmsrs, index; save_nmsrs = 0; #ifdef CONFIG_X86_64 if (is_long_mode(&vmx->vcpu)) { index = __find_msr_index(vmx, MSR_SYSCALL_MASK); if (index >= 0) move_msr_up(vmx, index, save_nmsrs++); index = __find_msr_index(vmx, MSR_LSTAR); if (index >= 0) move_msr_up(vmx, index, save_nmsrs++); index = __find_msr_index(vmx, MSR_CSTAR); if (index >= 0) move_msr_up(vmx, index, save_nmsrs++); index = __find_msr_index(vmx, MSR_TSC_AUX); if (index >= 0 && guest_cpuid_has(&vmx->vcpu, X86_FEATURE_RDTSCP)) move_msr_up(vmx, index, save_nmsrs++); /* * MSR_STAR is only needed on long mode guests, and only * if efer.sce is enabled. */ index = __find_msr_index(vmx, MSR_STAR); if ((index >= 0) && (vmx->vcpu.arch.efer & EFER_SCE)) move_msr_up(vmx, index, save_nmsrs++); } #endif index = __find_msr_index(vmx, MSR_EFER); if (index >= 0 && update_transition_efer(vmx, index)) move_msr_up(vmx, index, save_nmsrs++); vmx->save_nmsrs = save_nmsrs; if (cpu_has_vmx_msr_bitmap()) vmx_update_msr_bitmap(&vmx->vcpu); } ",0 " std::wstring GetUsageStatsKeyPath(bool medium) { EXPECT_TRUE(!medium || system_level_); std::wstring result(L""Software\\""); if (kUseGoogleUpdateIntegration) { result.append(L""Google\\Update\\ClientState""); if (medium) result.append(L""Medium""); result.push_back(L'\\'); result.append(mode_->app_guid); } else { result.append(kProductPathName); } return result; } ",0 "void WebContentsImpl::SetIsOverlayContent(bool is_overlay_content) { is_overlay_content_ = is_overlay_content; } ",0 "void RenderThread::CloseCurrentConnections() { Send(new ViewHostMsg_CloseCurrentConnections()); } ",0 "void crypto_drop_spawn(struct crypto_spawn *spawn) { if (!spawn->alg) return; down_write(&crypto_alg_sem); list_del(&spawn->list); up_write(&crypto_alg_sem); } ",0 "void nfs4_reset_read(struct rpc_task *task, struct nfs_read_data *data) { dprintk(""%s Reset task for i/o through\n"", __func__); put_lseg(data->lseg); data->lseg = NULL; /* offsets will differ in the dense stripe case */ data->args.offset = data->mds_offset; data->ds_clp = NULL; data->args.fh = NFS_FH(data->inode); data->read_done_cb = nfs4_read_done_cb; task->tk_ops = data->mds_ops; rpc_task_reset_client(task, NFS_CLIENT(data->inode)); } ",0 " void LauncherView::UpdateFirstButtonPadding() { if (view_model_->view_size() > 0) { view_model_->view_at(0)->set_border(views::Border::CreateEmptyBorder( primary_axis_coordinate(0, kLeadingInset), primary_axis_coordinate(kLeadingInset, 0), 0, 0)); } } ",1 "EXPORTED modseq_t mboxlist_foldermodseq_dirty(struct mailbox *mailbox) { mbentry_t *mbentry = NULL; modseq_t ret = 0; if (mboxlist_mylookup(mailbox->name, &mbentry, NULL, 0)) return 0; ret = mbentry->foldermodseq = mailbox_modseq_dirty(mailbox); mboxlist_update(mbentry, 0); mboxlist_entry_free(&mbentry); return ret; } ",0 "GF_Err pmax_Read(GF_Box *s, GF_BitStream *bs) { GF_PMAXBox *ptr = (GF_PMAXBox *)s; ptr->maxSize = gf_bs_read_u32(bs); return GF_OK; } ",0 "test_bson_regex_lengths (void) { bson_t new = BSON_INITIALIZER; bson_oid_t oid; bson_oid_init_from_string (&oid, ""1234567890abcdef12345678""); bson_append_oid (&new, ""0123456"", -1, &oid); bson_append_regex (&new, ""0_________1_________2_________3___4"", -1, ""0_________1_________2_________3_________4_________5___4"", ""i""); ASSERT (new.len == 121); ASSERT (new.flags &BSON_FLAG_STATIC); ASSERT (!(new.flags &BSON_FLAG_INLINE)); bson_destroy (&new); } ",0 " ref_param_read_signal_error(gs_param_list * plist, gs_param_name pkey, int code) { iparam_list *const iplist = (iparam_list *) plist; iparam_loc loc; ref_param_read(iplist, pkey, &loc, -1); /* can't fail */ *loc.presult = code; switch (ref_param_read_get_policy(plist, pkey)) { case gs_param_policy_ignore: return 0; return_error(gs_error_configurationerror); default: return code; } } ",1 "GBool GfxResources::lookupXObjectNF(char *name, Object *obj) { GfxResources *resPtr; for (resPtr = this; resPtr; resPtr = resPtr->next) { if (resPtr->xObjDict.isDict()) { if (!resPtr->xObjDict.dictLookupNF(name, obj)->isNull()) return gTrue; obj->free(); } } error(-1, ""XObject '%s' is unknown"", name); return gFalse; } ",0 "peek_job(uint64_t id) { return job_find(id); } ",0 "static bool http_negotiate(struct pool *pool, int sockd, bool http0) { char buf[1024]; int i, len; if (http0) { snprintf(buf, 1024, ""CONNECT %s:%s HTTP/1.0\r\n\r\n"", pool->sockaddr_url, pool->stratum_port); } else { snprintf(buf, 1024, ""CONNECT %s:%s HTTP/1.1\r\nHost: %s:%s\r\n\r\n"", pool->sockaddr_url, pool->stratum_port, pool->sockaddr_url, pool->stratum_port); } applog(LOG_DEBUG, ""Sending proxy %s:%s - %s"", pool->sockaddr_proxy_url, pool->sockaddr_proxy_port, buf); send(sockd, buf, strlen(buf), 0); len = recv(sockd, buf, 12, 0); if (len <= 0) { applog(LOG_WARNING, ""Couldn't read from proxy %s:%s after sending CONNECT"", pool->sockaddr_proxy_url, pool->sockaddr_proxy_port); return false; } buf[len] = '\0'; applog(LOG_DEBUG, ""Received from proxy %s:%s - %s"", pool->sockaddr_proxy_url, pool->sockaddr_proxy_port, buf); if (strcmp(buf, ""HTTP/1.1 200"") && strcmp(buf, ""HTTP/1.0 200"")) { applog(LOG_WARNING, ""HTTP Error from proxy %s:%s - %s"", pool->sockaddr_proxy_url, pool->sockaddr_proxy_port, buf); return false; } /* Ignore unwanted headers till we get desired response */ for (i = 0; i < 4; i++) { buf[i] = recv_byte(sockd); if (buf[i] == (char)-1) { applog(LOG_WARNING, ""Couldn't read HTTP byte from proxy %s:%s"", pool->sockaddr_proxy_url, pool->sockaddr_proxy_port); return false; } } while (strncmp(buf, ""\r\n\r\n"", 4)) { for (i = 0; i < 3; i++) buf[i] = buf[i + 1]; buf[3] = recv_byte(sockd); if (buf[3] == (char)-1) { applog(LOG_WARNING, ""Couldn't read HTTP byte from proxy %s:%s"", pool->sockaddr_proxy_url, pool->sockaddr_proxy_port); return false; } } applog(LOG_DEBUG, ""Success negotiating with %s:%s HTTP proxy"", pool->sockaddr_proxy_url, pool->sockaddr_proxy_port); return true; } ",0 "void ContentSecurityPolicy::reportMetaOutsideHead(const String& header) { logToConsole(""The Content Security Policy '"" + header + ""' was delivered via a element outside the document's "" "", which is disallowed. The policy has been ignored.""); } ",0 "void PlatformSensorAndroid::StopSensor() { JNIEnv* env = AttachCurrentThread(); Java_PlatformSensor_stopSensor(env, j_object_); } ",0 "static int mxf_edit_unit_absolute_offset(MXFContext *mxf, MXFIndexTable *index_table, int64_t edit_unit, int64_t *edit_unit_out, int64_t *offset_out, int nag) { int i; int64_t offset_temp = 0; for (i = 0; i < index_table->nb_segments; i++) { MXFIndexTableSegment *s = index_table->segments[i]; edit_unit = FFMAX(edit_unit, s->index_start_position); /* clamp if trying to seek before start */ if (edit_unit < s->index_start_position + s->index_duration) { int64_t index = edit_unit - s->index_start_position; if (s->edit_unit_byte_count) offset_temp += s->edit_unit_byte_count * index; else if (s->nb_index_entries) { if (s->nb_index_entries == 2 * s->index_duration + 1) index *= 2; /* Avid index */ if (index < 0 || index >= s->nb_index_entries) { av_log(mxf->fc, AV_LOG_ERROR, ""IndexSID %i segment at %""PRId64"" IndexEntryArray too small\n"", index_table->index_sid, s->index_start_position); return AVERROR_INVALIDDATA; } offset_temp = s->stream_offset_entries[index]; } else { av_log(mxf->fc, AV_LOG_ERROR, ""IndexSID %i segment at %""PRId64"" missing EditUnitByteCount and IndexEntryArray\n"", index_table->index_sid, s->index_start_position); return AVERROR_INVALIDDATA; } if (edit_unit_out) *edit_unit_out = edit_unit; return mxf_absolute_bodysid_offset(mxf, index_table->body_sid, offset_temp, offset_out); } else { /* EditUnitByteCount == 0 for VBR indexes, which is fine since they use explicit StreamOffsets */ offset_temp += s->edit_unit_byte_count * s->index_duration; } } if (nag) av_log(mxf->fc, AV_LOG_ERROR, ""failed to map EditUnit %""PRId64"" in IndexSID %i to an offset\n"", edit_unit, index_table->index_sid); return AVERROR_INVALIDDATA; } ",0 "static void keep_curlalive(CURL *curl) { SOCKETTYPE sock; curl_easy_getinfo(curl, CURLINFO_LASTSOCKET, (long *)&sock); keep_sockalive(sock); } ",0 "void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl) { unsigned int ret = 0; if (ctx->num != 0) { ret = EVP_EncodeBlock(out, ctx->enc_data, ctx->num); out[ret++] = '\n'; out[ret] = '\0'; ctx->num = 0; } *outl = ret; } ",0 "static void callWithScriptStateVoidMethodMethod(const v8::FunctionCallbackInfo& info) { TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); ScriptState* currentState = ScriptState::current(); if (!currentState) return; ScriptState& state = *currentState; imp->callWithScriptStateVoidMethod(&state); if (state.hadException()) { v8::Local exception = state.exception(); state.clearException(); throwError(exception, info.GetIsolate()); return; } } ",0 "void Document::open(Document* entered_document, ExceptionState& exception_state) { if (ImportLoader()) { exception_state.ThrowDOMException( DOMExceptionCode::kInvalidStateError, ""Imported document doesn't support open().""); return; } if (!IsHTMLDocument()) { exception_state.ThrowDOMException(DOMExceptionCode::kInvalidStateError, ""Only HTML documents support open().""); return; } if (throw_on_dynamic_markup_insertion_count_) { exception_state.ThrowDOMException( DOMExceptionCode::kInvalidStateError, ""Custom Element constructor should not use open().""); return; } if (!AllowedToUseDynamicMarkUpInsertion(""open"", exception_state)) return; if (entered_document) { if (!GetSecurityOrigin()->IsSameSchemeHostPort( entered_document->GetSecurityOrigin())) { exception_state.ThrowSecurityError( ""Can only call open() on same-origin documents.""); return; } SetSecurityOrigin(entered_document->GetMutableSecurityOrigin()); if (this != entered_document) { KURL new_url = entered_document->Url(); new_url.SetFragmentIdentifier(String()); SetURL(new_url); SetReferrerPolicy(entered_document->GetReferrerPolicy()); } cookie_url_ = entered_document->CookieURL(); } open(); } ",0 "std::set* GetPeerConnectionHandlers() { static std::set* handlers = new std::set(); return handlers; } ",0 "void ServiceWorkerContextCore::AddLiveVersion(ServiceWorkerVersion* version) { CHECK(!GetLiveVersion(version->version_id())); live_versions_[version->version_id()] = version; version->AddObserver(this); ServiceWorkerVersionInfo version_info = version->GetInfo(); observer_list_->Notify(FROM_HERE, &ServiceWorkerContextCoreObserver::OnNewLiveVersion, version_info); } ",0 "void PaintLayerScrollableArea::ResetRebuildScrollbarLayerFlags() { rebuild_horizontal_scrollbar_layer_ = false; rebuild_vertical_scrollbar_layer_ = false; } ",0 "static int init_wv_bitstream (WavpackStream *wps, WavpackMetadata *wpmd) { if (!wpmd->byte_length || (wpmd->byte_length & 1)) return FALSE; bs_open_read (&wps->wvbits, wpmd->data, (unsigned char *) wpmd->data + wpmd->byte_length); return TRUE; } ",0 "void btif_dm_execute_service_request(UINT16 event, char *p_param) { BOOLEAN b_enable = FALSE; bt_status_t status; if (event == BTIF_DM_ENABLE_SERVICE) { b_enable = TRUE; } status = btif_in_execute_service_request(*((tBTA_SERVICE_ID*)p_param), b_enable); if (status == BT_STATUS_SUCCESS) { bt_property_t property; bt_uuid_t local_uuids[BT_MAX_NUM_UUIDS]; /* Now send the UUID_PROPERTY_CHANGED event to the upper layer */ BTIF_STORAGE_FILL_PROPERTY(&property, BT_PROPERTY_UUIDS, sizeof(local_uuids), local_uuids); btif_storage_get_adapter_property(&property); HAL_CBACK(bt_hal_cbacks, adapter_properties_cb, BT_STATUS_SUCCESS, 1, &property); } return; } ",0 " MockImmersiveFullscreenControllerDelegate* delegate() { return delegate_.get(); } ",0 "const DisplayItems& DisplayItemList::displayItems() const { ASSERT(m_newDisplayItems.isEmpty()); return m_currentDisplayItems; } ",0 "cifs_uncached_read_into_pages(struct TCP_Server_Info *server, struct cifs_readdata *rdata, unsigned int len) { int total_read = 0, result = 0; unsigned int i; unsigned int nr_pages = rdata->nr_pages; struct kvec iov; rdata->tailsz = PAGE_SIZE; for (i = 0; i < nr_pages; i++) { struct page *page = rdata->pages[i]; if (len >= PAGE_SIZE) { /* enough data to fill the page */ iov.iov_base = kmap(page); iov.iov_len = PAGE_SIZE; cifs_dbg(FYI, ""%u: iov_base=%p iov_len=%zu\n"", i, iov.iov_base, iov.iov_len); len -= PAGE_SIZE; } else if (len > 0) { /* enough for partial page, fill and zero the rest */ iov.iov_base = kmap(page); iov.iov_len = len; cifs_dbg(FYI, ""%u: iov_base=%p iov_len=%zu\n"", i, iov.iov_base, iov.iov_len); memset(iov.iov_base + len, '\0', PAGE_SIZE - len); rdata->tailsz = len; len = 0; } else { /* no need to hold page hostage */ rdata->pages[i] = NULL; rdata->nr_pages--; put_page(page); continue; } result = cifs_readv_from_socket(server, &iov, 1, iov.iov_len); kunmap(page); if (result < 0) break; total_read += result; } return total_read > 0 ? total_read : result; } ",0 "static void ahci_irq_set(void *opaque, int n, int level) { } ",0 "void WebPageProxy::decidePolicyForNavigationAction(uint64_t frameID, uint32_t opaqueNavigationType, uint32_t opaqueModifiers, int32_t opaqueMouseButton, const ResourceRequest& request, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments, bool& receivedPolicyAction, uint64_t& policyAction, uint64_t& downloadID) { RefPtr userData; WebContextUserMessageDecoder messageDecoder(userData, context()); if (!arguments->decode(messageDecoder)) return; if (request.url() != pendingAPIRequestURL()) clearPendingAPIRequestURL(); WebFrameProxy* frame = process()->webFrame(frameID); MESSAGE_CHECK(frame); NavigationType navigationType = static_cast(opaqueNavigationType); WebEvent::Modifiers modifiers = static_cast(opaqueModifiers); WebMouseEvent::Button mouseButton = static_cast(opaqueMouseButton); RefPtr listener = frame->setUpPolicyListenerProxy(listenerID); ASSERT(!m_inDecidePolicyForNavigationAction); m_inDecidePolicyForNavigationAction = true; m_syncNavigationActionPolicyActionIsValid = false; if (!m_policyClient.decidePolicyForNavigationAction(this, frame, navigationType, modifiers, mouseButton, request, listener.get(), userData.get())) listener->use(); m_inDecidePolicyForNavigationAction = false; receivedPolicyAction = m_syncNavigationActionPolicyActionIsValid; if (m_syncNavigationActionPolicyActionIsValid) { policyAction = m_syncNavigationActionPolicyAction; downloadID = m_syncNavigationActionPolicyDownloadID; } } ",0 "void TestingAutomationProvider::Login(DictionaryValue* args, IPC::Message* reply_message) { std::string username, password; if (!args->GetString(""username"", &username) || !args->GetString(""password"", &password)) { AutomationJSONReply(this, reply_message).SendError( ""Invalid or missing args.""); return; } chromeos::ExistingUserController* controller = chromeos::ExistingUserController::current_controller(); new LoginObserver(controller, this, reply_message); chromeos::WebUILoginDisplay* webui_login_display = static_cast(controller->login_display()); webui_login_display->ShowSigninScreenForCreds(username, password); } ",0 "void rt_mutex_setprio(struct task_struct *p, int prio) { int oldprio, on_rq, running, enqueue_flag = 0; struct rq *rq; const struct sched_class *prev_class; BUG_ON(prio > MAX_PRIO); rq = __task_rq_lock(p); /* * Idle task boosting is a nono in general. There is one * exception, when PREEMPT_RT and NOHZ is active: * * The idle task calls get_next_timer_interrupt() and holds * the timer wheel base->lock on the CPU and another CPU wants * to access the timer (probably to cancel it). We can safely * ignore the boosting request, as the idle CPU runs this code * with interrupts disabled and will complete the lock * protected section without being interrupted. So there is no * real need to boost. */ if (unlikely(p == rq->idle)) { WARN_ON(p != rq->curr); WARN_ON(p->pi_blocked_on); goto out_unlock; } trace_sched_pi_setprio(p, prio); p->pi_top_task = rt_mutex_get_top_task(p); oldprio = p->prio; prev_class = p->sched_class; on_rq = p->on_rq; running = task_current(rq, p); if (on_rq) dequeue_task(rq, p, 0); if (running) p->sched_class->put_prev_task(rq, p); /* * Boosting condition are: * 1. -rt task is running and holds mutex A * --> -dl task blocks on mutex A * * 2. -dl task is running and holds mutex A * --> -dl task blocks on mutex A and could preempt the * running task */ if (dl_prio(prio)) { if (!dl_prio(p->normal_prio) || (p->pi_top_task && dl_entity_preempt(&p->pi_top_task->dl, &p->dl))) { p->dl.dl_boosted = 1; p->dl.dl_throttled = 0; enqueue_flag = ENQUEUE_REPLENISH; } else p->dl.dl_boosted = 0; p->sched_class = &dl_sched_class; } else if (rt_prio(prio)) { if (dl_prio(oldprio)) p->dl.dl_boosted = 0; if (oldprio < prio) enqueue_flag = ENQUEUE_HEAD; p->sched_class = &rt_sched_class; } else { if (dl_prio(oldprio)) p->dl.dl_boosted = 0; p->sched_class = &fair_sched_class; } p->prio = prio; if (running) p->sched_class->set_curr_task(rq); if (on_rq) enqueue_task(rq, p, enqueue_flag); check_class_changed(rq, p, prev_class, oldprio); out_unlock: __task_rq_unlock(rq); } ",0 "static struct cluster_list *cluster_parse(struct in_addr *pnt, int length) { struct cluster_list tmp; struct cluster_list *cluster; tmp.length = length; tmp.list = pnt; cluster = hash_get(cluster_hash, &tmp, cluster_hash_alloc); cluster->refcnt++; return cluster; } ",0 "static inline void put_free_pages(struct xen_blkif_ring *ring, struct page **page, int num) { unsigned long flags; int i; spin_lock_irqsave(&ring->free_pages_lock, flags); for (i = 0; i < num; i++) list_add(&page[i]->lru, &ring->free_pages); ring->free_pages_num += num; spin_unlock_irqrestore(&ring->free_pages_lock, flags); } ",0 "void FrameLoaderClient::updateGlobalHistoryRedirectLinks() { notImplemented(); } ",0 "void HTMLLinkElement::LinkLoaded() { DispatchEvent(*Event::Create(EventTypeNames::load)); } ",0 "PrintJobWorker* PrinterQuery::DetachWorker(PrintJobWorkerOwner* new_owner) { DCHECK(!callback_.get()); DCHECK(worker_.get()); if (!worker_.get()) return NULL; worker_->SetNewOwner(new_owner); return worker_.release(); } ",0 "static bool nfs4_roc(struct inode *inode) { if (!nfs_have_layout(inode)) return false; return pnfs_roc(inode); } ",0 "static void authenc_esn_request_complete(struct aead_request *req, int err) { if (err != -EINPROGRESS) aead_request_complete(req, err); } ",0 "void WebContentsImpl::ForSecurityDropFullscreen() { WebContentsImpl* web_contents = this; while (web_contents) { if (web_contents->IsFullscreenForCurrentTab()) web_contents->ExitFullscreen(true); web_contents = web_contents->GetOuterWebContents(); } } ",0 "static int mmap_piobufs(struct vm_area_struct *vma, struct qib_devdata *dd, struct qib_ctxtdata *rcd, unsigned piobufs, unsigned piocnt) { unsigned long phys; int ret; /* * When we map the PIO buffers in the chip, we want to map them as * writeonly, no read possible; unfortunately, x86 doesn't allow * for this in hardware, but we still prevent users from asking * for it. */ if ((vma->vm_end - vma->vm_start) > (piocnt * dd->palign)) { qib_devinfo(dd->pcidev, ""FAIL mmap piobufs: reqlen %lx > PAGE\n"", vma->vm_end - vma->vm_start); ret = -EINVAL; goto bail; } phys = dd->physaddr + piobufs; #if defined(__powerpc__) /* There isn't a generic way to specify writethrough mappings */ pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE; pgprot_val(vma->vm_page_prot) |= _PAGE_WRITETHRU; pgprot_val(vma->vm_page_prot) &= ~_PAGE_GUARDED; #endif /* * don't allow them to later change to readable with mprotect (for when * not initially mapped readable, as is normally the case) */ vma->vm_flags &= ~VM_MAYREAD; vma->vm_flags |= VM_DONTCOPY | VM_DONTEXPAND; /* We used PAT if wc_cookie == 0 */ if (!dd->wc_cookie) vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); ret = io_remap_pfn_range(vma, vma->vm_start, phys >> PAGE_SHIFT, vma->vm_end - vma->vm_start, vma->vm_page_prot); bail: return ret; } ",0 "static int do_io_accounting(struct task_struct *task, char *buffer, int whole) { struct task_io_accounting acct = task->ioac; unsigned long flags; if (whole && lock_task_sighand(task, &flags)) { struct task_struct *t = task; task_io_accounting_add(&acct, &task->signal->ioac); while_each_thread(task, t) task_io_accounting_add(&acct, &t->ioac); unlock_task_sighand(task, &flags); } return sprintf(buffer, ""rchar: %llu\n"" ""wchar: %llu\n"" ""syscr: %llu\n"" ""syscw: %llu\n"" ""read_bytes: %llu\n"" ""write_bytes: %llu\n"" ""cancelled_write_bytes: %llu\n"", (unsigned long long)acct.rchar, (unsigned long long)acct.wchar, (unsigned long long)acct.syscr, (unsigned long long)acct.syscw, (unsigned long long)acct.read_bytes, (unsigned long long)acct.write_bytes, (unsigned long long)acct.cancelled_write_bytes); } ",1 "CWD_API int php_sys_stat_ex(const char *path, struct stat *buf, int lstat) /* {{{ */ { WIN32_FILE_ATTRIBUTE_DATA data; __int64 t; const size_t path_len = strlen(path); if (!GetFileAttributesEx(path, GetFileExInfoStandard, &data)) { return stat(path, buf); } if (path_len >= 1 && path[1] == ':') { if (path[0] >= 'A' && path[0] <= 'Z') { buf->st_dev = buf->st_rdev = path[0] - 'A'; } else { buf->st_dev = buf->st_rdev = path[0] - 'a'; } } else if (IS_UNC_PATH(path, path_len)) { buf->st_dev = buf->st_rdev = 0; } else { char cur_path[MAXPATHLEN+1]; DWORD len = sizeof(cur_path); char *tmp = cur_path; while(1) { DWORD r = GetCurrentDirectory(len, tmp); if (r < len) { if (tmp[1] == ':') { if (path[0] >= 'A' && path[0] <= 'Z') { buf->st_dev = buf->st_rdev = path[0] - 'A'; } else { buf->st_dev = buf->st_rdev = path[0] - 'a'; } } else { buf->st_dev = buf->st_rdev = -1; } break; } else if (!r) { buf->st_dev = buf->st_rdev = -1; break; } else { len = r+1; tmp = (char*)malloc(len); } } if (tmp != cur_path) { free(tmp); } } buf->st_uid = buf->st_gid = buf->st_ino = 0; if (lstat && data.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) { /* File is a reparse point. Get the target */ HANDLE hLink = NULL; REPARSE_DATA_BUFFER * pbuffer; unsigned int retlength = 0; TSRM_ALLOCA_FLAG(use_heap_large); hLink = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT|FILE_FLAG_BACKUP_SEMANTICS, NULL); if(hLink == INVALID_HANDLE_VALUE) { return -1; } pbuffer = (REPARSE_DATA_BUFFER *)tsrm_do_alloca(MAXIMUM_REPARSE_DATA_BUFFER_SIZE, use_heap_large); if(!DeviceIoControl(hLink, FSCTL_GET_REPARSE_POINT, NULL, 0, pbuffer, MAXIMUM_REPARSE_DATA_BUFFER_SIZE, &retlength, NULL)) { tsrm_free_alloca(pbuffer, use_heap_large); CloseHandle(hLink); return -1; } CloseHandle(hLink); if(pbuffer->ReparseTag == IO_REPARSE_TAG_SYMLINK) { buf->st_mode = S_IFLNK; buf->st_mode |= (data.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? (S_IREAD|(S_IREAD>>3)|(S_IREAD>>6)) : (S_IREAD|(S_IREAD>>3)|(S_IREAD>>6)|S_IWRITE|(S_IWRITE>>3)|(S_IWRITE>>6)); } #if 0 /* Not used yet */ else if(pbuffer->ReparseTag == IO_REPARSE_TAG_MOUNT_POINT) { buf->st_mode |=; } #endif tsrm_free_alloca(pbuffer, use_heap_large); } else { buf->st_mode = (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? (S_IFDIR|S_IEXEC|(S_IEXEC>>3)|(S_IEXEC>>6)) : S_IFREG; buf->st_mode |= (data.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? (S_IREAD|(S_IREAD>>3)|(S_IREAD>>6)) : (S_IREAD|(S_IREAD>>3)|(S_IREAD>>6)|S_IWRITE|(S_IWRITE>>3)|(S_IWRITE>>6)); } if ((data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) { int len = strlen(path); if (path[len-4] == '.') { if (_memicmp(path+len-3, ""exe"", 3) == 0 || _memicmp(path+len-3, ""com"", 3) == 0 || _memicmp(path+len-3, ""bat"", 3) == 0 || _memicmp(path+len-3, ""cmd"", 3) == 0) { buf->st_mode |= (S_IEXEC|(S_IEXEC>>3)|(S_IEXEC>>6)); } } } buf->st_nlink = 1; t = data.nFileSizeHigh; t = t << 32; t |= data.nFileSizeLow; buf->st_size = t; buf->st_atime = FileTimeToUnixTime(data.ftLastAccessTime); buf->st_ctime = FileTimeToUnixTime(data.ftCreationTime); buf->st_mtime = FileTimeToUnixTime(data.ftLastWriteTime); return 0; } /* }}} */ ",0 "void Com_RunAndTimeServerPacket( netadr_t *evFrom, msg_t *buf ) { int t1, t2, msec; t1 = 0; if ( com_speeds->integer ) { t1 = Sys_Milliseconds (); } SV_PacketEvent( *evFrom, buf ); if ( com_speeds->integer ) { t2 = Sys_Milliseconds (); msec = t2 - t1; if ( com_speeds->integer == 3 ) { Com_Printf( ""SV_PacketEvent time: %i\n"", msec ); } } } ",0 "router_dir_info_changed(void) { need_to_update_have_min_dir_info = 1; rend_hsdir_routers_changed(); } ",0 "DevToolsDomainHandler::DevToolsDomainHandler(const std::string& name) : name_(name) { } ",0 "void BrowserMainLoop::GetCompositingModeReporter( viz::mojom::CompositingModeReporterRequest request) { bool use_viz = base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableViz); if (IsUsingMus() || use_viz) { } else { compositing_mode_reporter_bindings_.AddBinding( compositing_mode_reporter_impl_.get(), std::move(request)); } } ",0 "void ShellSurface::OnWindowDestroying(aura::Window* window) { if (window == parent_) { parent_ = nullptr; SetEnabled(false); } window->RemoveObserver(this); } ",0 "void MimeHandlerViewContainer::DidReceiveData(const char* data, int data_length) { view_id_ += std::string(data, data_length); } ",0 "static void enforcedRangeUnsignedLongAttrAttributeGetter(const v8::PropertyCallbackInfo& info) { TestObject* imp = V8TestObject::toNative(info.Holder()); v8SetReturnValueUnsigned(info, imp->enforcedRangeUnsignedLongAttr()); } ",0 " void GCInfoTable::Resize() { static const int kGcInfoZapValue = 0x33; const size_t kInitialSize = 512; size_t new_size = gc_info_table_size_ ? 2 * gc_info_table_size_ : kInitialSize; DCHECK(new_size < GCInfoTable::kMaxIndex); g_gc_info_table = reinterpret_cast(WTF::Partitions::FastRealloc( g_gc_info_table, new_size * sizeof(GCInfo), ""GCInfo"")); DCHECK(g_gc_info_table); memset(reinterpret_cast(g_gc_info_table) + gc_info_table_size_ * sizeof(GCInfo), kGcInfoZapValue, (new_size - gc_info_table_size_) * sizeof(GCInfo)); gc_info_table_size_ = new_size; } ",1 "int nfc_genl_se_removed(struct nfc_dev *dev, u32 se_idx) { struct sk_buff *msg; void *hdr; msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); if (!msg) return -ENOMEM; hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, NFC_EVENT_SE_REMOVED); if (!hdr) goto free_msg; if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx) || nla_put_u32(msg, NFC_ATTR_SE_INDEX, se_idx)) goto nla_put_failure; genlmsg_end(msg, hdr); genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL); return 0; nla_put_failure: free_msg: nlmsg_free(msg); return -EMSGSIZE; } ",0 "void ResourceMultiBufferDataProvider::DidDownloadData(int dataLength) { NOTIMPLEMENTED(); } ",0 "static char *get_netscape_format(const struct Cookie *co) { return aprintf( ""%s"" /* httponly preamble */ ""%s%s\t"" /* domain */ ""%s\t"" /* tailmatch */ ""%s\t"" /* path */ ""%s\t"" /* secure */ ""%"" FORMAT_OFF_T ""\t"" /* expires */ ""%s\t"" /* name */ ""%s"", /* value */ co->httponly?""#HttpOnly_"":"""", /* Make sure all domains are prefixed with a dot if they allow tailmatching. This is Mozilla-style. */ (co->tailmatch && co->domain && co->domain[0] != '.')? ""."":"""", co->domain?co->domain:""unknown"", co->tailmatch?""TRUE"":""FALSE"", co->path?co->path:""/"", co->secure?""TRUE"":""FALSE"", co->expires, co->name, co->value?co->value:""""); } ",0 " CreateSharedChangeProcessor() { return new SharedChangeProcessor(); } ",0 "int usb_find_common_endpoints(struct usb_host_interface *alt, struct usb_endpoint_descriptor **bulk_in, struct usb_endpoint_descriptor **bulk_out, struct usb_endpoint_descriptor **int_in, struct usb_endpoint_descriptor **int_out) { struct usb_endpoint_descriptor *epd; int i; if (bulk_in) *bulk_in = NULL; if (bulk_out) *bulk_out = NULL; if (int_in) *int_in = NULL; if (int_out) *int_out = NULL; for (i = 0; i < alt->desc.bNumEndpoints; ++i) { epd = &alt->endpoint[i].desc; if (match_endpoint(epd, bulk_in, bulk_out, int_in, int_out)) return 0; } return -ENXIO; } ",0 "GPMF_ERR GPMF_Reserved(uint32_t key) { if(key == GPMF_KEY_DEVICE) return GPMF_ERROR_RESERVED; if(key == GPMF_KEY_DEVICE_ID) return GPMF_ERROR_RESERVED; if(key == GPMF_KEY_DEVICE_NAME) return GPMF_ERROR_RESERVED; if(key == GPMF_KEY_STREAM) return GPMF_ERROR_RESERVED; if(key == GPMF_KEY_STREAM_NAME) return GPMF_ERROR_RESERVED; if(key == GPMF_KEY_SI_UNITS) return GPMF_ERROR_RESERVED; if(key == GPMF_KEY_UNITS) return GPMF_ERROR_RESERVED; if(key == GPMF_KEY_SCALE) return GPMF_ERROR_RESERVED; if(key == GPMF_KEY_TYPE) return GPMF_ERROR_RESERVED; if(key == GPMF_KEY_TOTAL_SAMPLES) return GPMF_ERROR_RESERVED; if(key == GPMF_KEY_TICK) return GPMF_ERROR_RESERVED; if(key == GPMF_KEY_TOCK) return GPMF_ERROR_RESERVED; if(key == GPMF_KEY_EMPTY_PAYLOADS) return GPMF_ERROR_RESERVED; if(key == GPMF_KEY_REMARK) return GPMF_ERROR_RESERVED; return GPMF_OK; } ",0 "static void xhci_stall_ep(XHCITransfer *xfer) { XHCIState *xhci = xfer->xhci; XHCISlot *slot = &xhci->slots[xfer->slotid-1]; XHCIEPContext *epctx = slot->eps[xfer->epid-1]; uint32_t err; XHCIStreamContext *sctx; if (epctx->nr_pstreams) { sctx = xhci_find_stream(epctx, xfer->streamid, &err); if (sctx == NULL) { return; } sctx->ring.dequeue = xfer->trbs[0].addr; sctx->ring.ccs = xfer->trbs[0].ccs; xhci_set_ep_state(xhci, epctx, sctx, EP_HALTED); } else { epctx->ring.dequeue = xfer->trbs[0].addr; epctx->ring.ccs = xfer->trbs[0].ccs; xhci_set_ep_state(xhci, epctx, NULL, EP_HALTED); } } ",0 "NamedNodeMap* Element::attributes() const { ElementRareData* rareData = const_cast(this)->ensureElementRareData(); if (NamedNodeMap* attributeMap = rareData->attributeMap()) return attributeMap; rareData->setAttributeMap(NamedNodeMap::create(const_cast(this))); return rareData->attributeMap(); } ",0 "free_parser_data(void) { if (LIST_EXISTS(defs)) free_list(&defs); if (LIST_EXISTS(multiline_stack)) free_list(&multiline_stack); } ",0 "void RenderFrameDevToolsAgentHost::AttachSession(DevToolsSession* session) { session->SetRenderer(frame_host_ ? frame_host_->GetProcess()->GetID() : ChildProcessHost::kInvalidUniqueID, frame_host_); protocol::EmulationHandler* emulation_handler = new protocol::EmulationHandler(); session->AddHandler(base::WrapUnique(new protocol::BrowserHandler())); session->AddHandler(base::WrapUnique(new protocol::DOMHandler())); session->AddHandler(base::WrapUnique(emulation_handler)); session->AddHandler(base::WrapUnique(new protocol::InputHandler())); session->AddHandler(base::WrapUnique(new protocol::InspectorHandler())); session->AddHandler(base::WrapUnique(new protocol::IOHandler( GetIOContext()))); session->AddHandler(base::WrapUnique(new protocol::MemoryHandler())); session->AddHandler(base::WrapUnique(new protocol::NetworkHandler(GetId()))); session->AddHandler(base::WrapUnique(new protocol::SchemaHandler())); session->AddHandler(base::WrapUnique(new protocol::ServiceWorkerHandler())); session->AddHandler(base::WrapUnique(new protocol::StorageHandler())); session->AddHandler( base::WrapUnique(new protocol::TargetHandler(false /* browser_only */))); session->AddHandler(base::WrapUnique(new protocol::TracingHandler( protocol::TracingHandler::Renderer, frame_tree_node_ ? frame_tree_node_->frame_tree_node_id() : 0, GetIOContext()))); session->AddHandler( base::WrapUnique(new protocol::PageHandler(emulation_handler))); session->AddHandler(base::WrapUnique(new protocol::SecurityHandler())); if (EnsureAgent()) session->AttachToAgent(agent_ptr_); if (sessions().size() == 1) { frame_trace_recorder_.reset(new DevToolsFrameTraceRecorder()); GrantPolicy(); #if defined(OS_ANDROID) GetWakeLock()->RequestWakeLock(); #endif } } ",1 "CheckGrabForSyncs(DeviceIntPtr thisDev, Bool thisMode, Bool otherMode) { GrabPtr grab = thisDev->deviceGrab.grab; DeviceIntPtr dev; if (thisMode == GrabModeSync) thisDev->deviceGrab.sync.state = FROZEN_NO_EVENT; else { /* free both if same client owns both */ thisDev->deviceGrab.sync.state = THAWED; if (thisDev->deviceGrab.sync.other && (CLIENT_BITS(thisDev->deviceGrab.sync.other->resource) == CLIENT_BITS(grab->resource))) thisDev->deviceGrab.sync.other = NullGrab; } if (IsMaster(thisDev)) { dev = GetPairedDevice(thisDev); if (otherMode == GrabModeSync) dev->deviceGrab.sync.other = grab; else { /* free both if same client owns both */ if (dev->deviceGrab.sync.other && (CLIENT_BITS(dev->deviceGrab.sync.other->resource) == CLIENT_BITS(grab->resource))) dev->deviceGrab.sync.other = NullGrab; } } ComputeFreezes(); } ",0 "static zend_always_inline zval *_zend_hash_add_or_update_i(HashTable *ht, zend_string *key, zval *pData, uint32_t flag ZEND_FILE_LINE_DC) { zend_ulong h; uint32_t nIndex; uint32_t idx; Bucket *p; IS_CONSISTENT(ht); HT_ASSERT(GC_REFCOUNT(ht) == 1); if (UNEXPECTED(!(ht->u.flags & HASH_FLAG_INITIALIZED))) { CHECK_INIT(ht, 0); goto add_to_hash; } else if (ht->u.flags & HASH_FLAG_PACKED) { zend_hash_packed_to_hash(ht); } else if ((flag & HASH_ADD_NEW) == 0) { p = zend_hash_find_bucket(ht, key); if (p) { zval *data; if (flag & HASH_ADD) { if (!(flag & HASH_UPDATE_INDIRECT)) { return NULL; } ZEND_ASSERT(&p->val != pData); data = &p->val; if (Z_TYPE_P(data) == IS_INDIRECT) { data = Z_INDIRECT_P(data); if (Z_TYPE_P(data) != IS_UNDEF) { return NULL; } } else { return NULL; } } else { ZEND_ASSERT(&p->val != pData); data = &p->val; if ((flag & HASH_UPDATE_INDIRECT) && Z_TYPE_P(data) == IS_INDIRECT) { data = Z_INDIRECT_P(data); } } HANDLE_BLOCK_INTERRUPTIONS(); if (ht->pDestructor) { ht->pDestructor(data); } ZVAL_COPY_VALUE(data, pData); HANDLE_UNBLOCK_INTERRUPTIONS(); return data; } } ZEND_HASH_IF_FULL_DO_RESIZE(ht); /* If the Hash table is full, resize it */ add_to_hash: HANDLE_BLOCK_INTERRUPTIONS(); idx = ht->nNumUsed++; ht->nNumOfElements++; if (ht->nInternalPointer == HT_INVALID_IDX) { ht->nInternalPointer = idx; } zend_hash_iterators_update(ht, HT_INVALID_IDX, idx); p = ht->arData + idx; p->key = key; if (!ZSTR_IS_INTERNED(key)) { zend_string_addref(key); ht->u.flags &= ~HASH_FLAG_STATIC_KEYS; zend_string_hash_val(key); } p->h = h = ZSTR_H(key); ZVAL_COPY_VALUE(&p->val, pData); nIndex = h | ht->nTableMask; Z_NEXT(p->val) = HT_HASH(ht, nIndex); HT_HASH(ht, nIndex) = HT_IDX_TO_HASH(idx); HANDLE_UNBLOCK_INTERRUPTIONS(); return &p->val; } ",0 "static int midi_setup_noteon(struct _mdi *mdi, uint8_t channel, uint8_t note, uint8_t velocity) { MIDI_EVENT_DEBUG(__FUNCTION__,channel, note); _WM_CheckEventMemoryPool(mdi); mdi->events[mdi->event_count].do_event = *_WM_do_note_on; mdi->events[mdi->event_count].event_data.channel = channel; mdi->events[mdi->event_count].event_data.data.value = (note << 8) | velocity; mdi->events[mdi->event_count].samples_to_next = 0; mdi->event_count++; if (mdi->channel[channel].isdrum) _WM_load_patch(mdi, ((mdi->channel[channel].bank << 8) | (note | 0x80))); return (0); } ",0 "static sector_t fuse_bmap(struct address_space *mapping, sector_t block) { struct inode *inode = mapping->host; struct fuse_conn *fc = get_fuse_conn(inode); FUSE_ARGS(args); struct fuse_bmap_in inarg; struct fuse_bmap_out outarg; int err; if (!inode->i_sb->s_bdev || fc->no_bmap) return 0; memset(&inarg, 0, sizeof(inarg)); inarg.block = block; inarg.blocksize = inode->i_sb->s_blocksize; args.in.h.opcode = FUSE_BMAP; args.in.h.nodeid = get_node_id(inode); args.in.numargs = 1; args.in.args[0].size = sizeof(inarg); args.in.args[0].value = &inarg; args.out.numargs = 1; args.out.args[0].size = sizeof(outarg); args.out.args[0].value = &outarg; err = fuse_simple_request(fc, &args); if (err == -ENOSYS) fc->no_bmap = 1; return err ? 0 : outarg.block; } ",0 "void GpuChannel::DestroySoon() { MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&GpuChannel::OnDestroy, this)); } ",0 "static size_t read_data(serial_data_type_t type, uint8_t *buffer, size_t max_size, bool block) { if (type == DATA_TYPE_ACL) { return eager_reader_read(acl_stream, buffer, max_size, block); } else if (type == DATA_TYPE_EVENT) { return eager_reader_read(event_stream, buffer, max_size, block); } LOG_ERROR(""%s invalid data type: %d"", __func__, type); return 0; } ",0 "bool WebContentsImpl::IsLoadingToDifferentDocument() const { return IsLoading() && is_load_to_different_document_; } ",0 "static int __init pkcs7_key_init(void) { return register_key_type(&key_type_pkcs7); } ",0 "PrintRenderFrameHelper::PrintPreviewContext::prepared_node() const { DCHECK(state_ != UNINITIALIZED); return prep_frame_view_->node(); } ",0 " ValueType GetField(int64 metahandle, FieldType field, ValueType default_value) const { ScopedDirLookup dir(syncdb_.manager(), syncdb_.name()); EXPECT_TRUE(dir.good()); ReadTransaction trans(FROM_HERE, dir); Entry entry(&trans, GET_BY_HANDLE, metahandle); EXPECT_TRUE(entry.good()); if (!entry.good()) { return default_value; } EXPECT_EQ(metahandle, entry.Get(META_HANDLE)); return entry.Get(field); } ",0 "int peernet2id_alloc(struct net *net, struct net *peer) { bool alloc = false, alive = false; int id; if (refcount_read(&net->count) == 0) return NETNSA_NSID_NOT_ASSIGNED; spin_lock_bh(&net->nsid_lock); /* * When peer is obtained from RCU lists, we may race with * its cleanup. Check whether it's alive, and this guarantees * we never hash a peer back to net->netns_ids, after it has * just been idr_remove()'d from there in cleanup_net(). */ if (maybe_get_net(peer)) alive = alloc = true; id = __peernet2id_alloc(net, peer, &alloc); spin_unlock_bh(&net->nsid_lock); if (alloc && id >= 0) rtnl_net_notifyid(net, RTM_NEWNSID, id); if (alive) put_net(peer); return id; } ",0 "static const char *register_lua_scope(cmd_parms *cmd, void *_cfg, const char *scope, const char *min, const char *max) { ap_lua_dir_cfg *cfg = (ap_lua_dir_cfg *) _cfg; if (strcmp(""once"", scope) == 0) { cfg->vm_scope = AP_LUA_SCOPE_ONCE; } else if (strcmp(""request"", scope) == 0) { cfg->vm_scope = AP_LUA_SCOPE_REQUEST; } else if (strcmp(""conn"", scope) == 0) { cfg->vm_scope = AP_LUA_SCOPE_CONN; } else if (strcmp(""thread"", scope) == 0) { #if !APR_HAS_THREADS return apr_psprintf(cmd->pool, ""Scope type of '%s' cannot be used because this "" ""server does not have threading support "" ""(APR_HAS_THREADS)"" scope); #endif cfg->vm_scope = AP_LUA_SCOPE_THREAD; } else if (strcmp(""server"", scope) == 0) { unsigned int vmin, vmax; #if !APR_HAS_THREADS return apr_psprintf(cmd->pool, ""Scope type of '%s' cannot be used because this "" ""server does not have threading support "" ""(APR_HAS_THREADS)"" scope); #endif cfg->vm_scope = AP_LUA_SCOPE_SERVER; vmin = min ? atoi(min) : 1; vmax = max ? atoi(max) : 1; if (vmin == 0) { vmin = 1; } if (vmax < vmin) { vmax = vmin; } cfg->vm_min = vmin; cfg->vm_max = vmax; } else { return apr_psprintf(cmd->pool, ""Invalid value for LuaScope, '%s', acceptable "" ""values are: 'once', 'request', 'conn'"" #if APR_HAS_THREADS "", 'thread', 'server'"" #endif ,scope); } return NULL; } ",0 " void BasicFindMainInterceptResponseInWorkingSet() { BasicFindMainInterceptResponse(false); } ",0 "char *xmlrpc_boolean(char *buf, int value) { *buf = '\0'; snprintf(buf, XMLRPC_BUFSIZE, ""%d"", (value ? 1 : 0)); return buf; } ",0 "int emulator_set_dr(struct x86_emulate_ctxt *ctxt, int dr, unsigned long value) { return __kvm_set_dr(emul_to_vcpu(ctxt), dr, value); } ",0 "error::Error GLES2DecoderImpl::HandleBindFragDataLocationIndexedEXTBucket( uint32_t immediate_data_size, const volatile void* cmd_data) { if (!features().ext_blend_func_extended) { return error::kUnknownCommand; } const volatile gles2::cmds::BindFragDataLocationIndexedEXTBucket& c = *static_cast< const volatile gles2::cmds::BindFragDataLocationIndexedEXTBucket*>( cmd_data); GLuint program = static_cast(c.program); GLuint colorNumber = static_cast(c.colorNumber); GLuint index = static_cast(c.index); Bucket* bucket = GetBucket(c.name_bucket_id); if (!bucket || bucket->size() == 0) { return error::kInvalidArguments; } std::string name_str; if (!bucket->GetAsString(&name_str)) { return error::kInvalidArguments; } return DoBindFragDataLocationIndexed(program, colorNumber, index, name_str); } ",0 "int __glXDisp_VendorPrivate(__GLXclientState *cl, GLbyte *pc) { xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; GLint vendorcode = req->vendorCode; __GLXdispatchVendorPrivProcPtr proc; proc = (__GLXdispatchVendorPrivProcPtr) __glXGetProtocolDecodeFunction(& VendorPriv_dispatch_info, vendorcode, 0); if (proc != NULL) { (*proc)(cl, (GLbyte*)req); return Success; } cl->client->errorValue = req->vendorCode; return __glXError(GLXUnsupportedPrivateRequest); } ",0 "static int hfs_decompress_lzvn_attr(char* rawBuf, uint32_t rawSize, uint64_t uncSize, char** dstBuf, uint64_t* dstSize, int* dstBufFree) { if (rawBuf[0] == 0x06) { return hfs_decompress_noncompressed_attr( rawBuf, rawSize, uncSize, dstBuf, dstSize, dstBufFree); } char* uncBuf = (char *) tsk_malloc((size_t) uncSize); *dstSize = lzvn_decode_buffer(uncBuf, uncSize, rawBuf, rawSize); *dstBuf = uncBuf; *dstBufFree = TRUE; return 1; } ",0 "char *delete_chars(char *s, const char *bad) { char *f, *t; /* Drops all whitespace, regardless where in the string */ for (f = s, t = s; *f; f++) { if (strchr(bad, *f)) continue; *(t++) = *f; } *t = 0; return s; } ",0 "static void nfs41_call_priv_sync_prepare(struct rpc_task *task, void *calldata) { rpc_task_set_priority(task, RPC_PRIORITY_PRIVILEGED); nfs41_call_sync_prepare(task, calldata); } ",0 "sshpkt_put_bignum2(struct ssh *ssh, const BIGNUM *v) { return sshbuf_put_bignum2(ssh->state->outgoing_packet, v); } ",0 "void FrameLoader::loadProvisionalItemFromCachedPage() { DocumentLoader* provisionalLoader = provisionalDocumentLoader(); LOG(PageCache, ""WebCorePageCache: Loading provisional DocumentLoader %p with URL '%s' from CachedPage"", provisionalDocumentLoader(), provisionalDocumentLoader()->url().string().utf8().data()); provisionalLoader->prepareForLoadStart(); m_loadingFromCachedPage = true; provisionalLoader->setCommitted(true); commitProvisionalLoad(); } ",0 " void Wait(net::LoadState load_state, const base::string16& host) { waiting_host_ = host; waiting_state_ = load_state; if (!LoadStateMatches(web_contents_)) { base::RunLoop run_loop; quit_closure_ = run_loop.QuitClosure(); run_loop.Run(); DCHECK(LoadStateMatches(web_contents_)); } } ",0 "struct net_bridge_port_group *br_multicast_new_port_group( struct net_bridge_port *port, struct br_ip *group, struct net_bridge_port_group __rcu *next, unsigned char state) { struct net_bridge_port_group *p; p = kzalloc(sizeof(*p), GFP_ATOMIC); if (unlikely(!p)) return NULL; p->addr = *group; p->port = port; p->state = state; rcu_assign_pointer(p->next, next); hlist_add_head(&p->mglist, &port->mglist); setup_timer(&p->timer, br_multicast_port_group_expired, (unsigned long)p); return p; } ",0 "GpuProcessHost::SurfaceRef::SurfaceRef(gfx::PluginWindowHandle surface) : surface_(surface) { GtkNativeViewManager* manager = GtkNativeViewManager::GetInstance(); if (!manager->AddRefPermanentXID(surface_)) { LOG(ERROR) << ""Surface "" << surface << "" cannot be referenced.""; } } ",0 "static bmp_info_t *bmp_getinfo(jas_stream_t *in) { bmp_info_t *info; int i; bmp_palent_t *palent; if (!(info = bmp_info_create())) { return 0; } if (bmp_getint32(in, &info->len) || info->len != 40 || bmp_getint32(in, &info->width) || bmp_getint32(in, &info->height) || bmp_getint16(in, &info->numplanes) || bmp_getint16(in, &info->depth) || bmp_getint32(in, &info->enctype) || bmp_getint32(in, &info->siz) || bmp_getint32(in, &info->hres) || bmp_getint32(in, &info->vres) || bmp_getint32(in, &info->numcolors) || bmp_getint32(in, &info->mincolors)) { bmp_info_destroy(info); return 0; } if (info->height < 0) { info->topdown = 1; info->height = -info->height; } else { info->topdown = 0; } if (info->width <= 0 || info->height <= 0 || info->numplanes <= 0 || info->depth <= 0 || info->numcolors < 0 || info->mincolors < 0) { bmp_info_destroy(info); return 0; } if (info->enctype != BMP_ENC_RGB) { jas_eprintf(""unsupported BMP encoding\n""); bmp_info_destroy(info); return 0; } if (info->numcolors > 0) { if (!(info->palents = jas_alloc2(info->numcolors, sizeof(bmp_palent_t)))) { bmp_info_destroy(info); return 0; } } else { info->palents = 0; } for (i = 0; i < info->numcolors; ++i) { palent = &info->palents[i]; if ((palent->blu = jas_stream_getc(in)) == EOF || (palent->grn = jas_stream_getc(in)) == EOF || (palent->red = jas_stream_getc(in)) == EOF || (palent->res = jas_stream_getc(in)) == EOF) { bmp_info_destroy(info); return 0; } } return info; } ",0 "bool TopSitesImpl::IsBlacklisted(const GURL& url) { DCHECK(thread_checker_.CalledOnValidThread()); const base::DictionaryValue* blacklist = pref_service_->GetDictionary(kMostVisitedURLsBlacklist); return blacklist && blacklist->HasKey(GetURLHash(url)); } ",0 "static int AppLayerProtoDetectTest09(void) { AppLayerProtoDetectUnittestCtxBackup(); AppLayerProtoDetectSetup(); uint8_t l7data[] = { 0x00, 0x00, 0x00, 0x66, 0xfe, 0x53, 0x4d, 0x42, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02 }; const char *buf; int r = 0; Flow f; AppProto pm_results[ALPROTO_MAX]; AppLayerProtoDetectThreadCtx *alpd_tctx; memset(&f, 0x00, sizeof(f)); f.protomap = FlowGetProtoMapping(IPPROTO_TCP); memset(pm_results, 0, sizeof(pm_results)); buf = ""|fe|SMB""; AppLayerProtoDetectPMRegisterPatternCS(IPPROTO_TCP, ALPROTO_SMB2, buf, 8, 4, STREAM_TOCLIENT); AppLayerProtoDetectPrepareState(); /* AppLayerProtoDetectGetCtxThread() should be called post AppLayerProtoDetectPrepareState(), since * it sets internal structures which depends on the above function. */ alpd_tctx = AppLayerProtoDetectGetCtxThread(); if (alpd_ctx.ctx_ipp[FLOW_PROTO_TCP].ctx_pm[0].max_pat_id != 0) { printf(""alpd_ctx.ctx_ipp[FLOW_PROTO_TCP].ctx_pm[0].max_pat_id != 0\n""); goto end; } if (alpd_ctx.ctx_ipp[FLOW_PROTO_TCP].ctx_pm[1].max_pat_id != 1) { printf(""alpd_ctx.ctx_ipp[FLOW_PROTO_TCP].ctx_pm[1].max_pat_id != 2\n""); goto end; } if (alpd_ctx.ctx_ipp[FLOW_PROTO_TCP].ctx_pm[0].map != NULL) { printf(""alpd_ctx.ctx_ipp[FLOW_PROTO_TCP].ctx_pm[0].map != NULL\n""); goto end; } if (alpd_ctx.ctx_ipp[FLOW_PROTO_TCP].ctx_pm[1].map == NULL) { printf(""alpd_ctx.ctx_ipp[FLOW_PROTO_TCP].ctx_pm[1].map != NULL\n""); goto end; } if (alpd_ctx.ctx_ipp[FLOW_PROTO_TCP].ctx_pm[1].map[0]->alproto != ALPROTO_SMB2) { printf(""alpd_ctx.ctx_ipp[FLOW_PROTO_TCP].ctx_pm[1].map[0].alproto != ALPROTO_SMB2\n""); goto end; } uint32_t cnt = AppLayerProtoDetectPMGetProto(alpd_tctx, &f, l7data, sizeof(l7data), STREAM_TOCLIENT, IPPROTO_TCP, pm_results); if (cnt != 1 && pm_results[0] != ALPROTO_SMB2) { printf(""cnt != 1 && pm_results[0] != AlPROTO_SMB2\n""); goto end; } r = 1; end: if (alpd_tctx != NULL) AppLayerProtoDetectDestroyCtxThread(alpd_tctx); AppLayerProtoDetectDeSetup(); AppLayerProtoDetectUnittestCtxRestore(); return r; } ",0 "static void conn_free(struct connectdata *conn) { if(!conn) return; /* possible left-overs from the async name resolvers */ Curl_resolver_cancel(conn); /* close the SSL stuff before we close any sockets since they will/may write to the sockets */ Curl_ssl_close(conn, FIRSTSOCKET); Curl_ssl_close(conn, SECONDARYSOCKET); /* close possibly still open sockets */ if(CURL_SOCKET_BAD != conn->sock[SECONDARYSOCKET]) Curl_closesocket(conn, conn->sock[SECONDARYSOCKET]); if(CURL_SOCKET_BAD != conn->sock[FIRSTSOCKET]) Curl_closesocket(conn, conn->sock[FIRSTSOCKET]); if(CURL_SOCKET_BAD != conn->tempsock[0]) Curl_closesocket(conn, conn->tempsock[0]); if(CURL_SOCKET_BAD != conn->tempsock[1]) Curl_closesocket(conn, conn->tempsock[1]); #if !defined(CURL_DISABLE_HTTP) && defined(USE_NTLM) && \ defined(NTLM_WB_ENABLED) Curl_ntlm_wb_cleanup(conn); #endif Curl_safefree(conn->user); Curl_safefree(conn->passwd); Curl_safefree(conn->oauth_bearer); Curl_safefree(conn->options); Curl_safefree(conn->http_proxy.user); Curl_safefree(conn->socks_proxy.user); Curl_safefree(conn->http_proxy.passwd); Curl_safefree(conn->socks_proxy.passwd); Curl_safefree(conn->allocptr.proxyuserpwd); Curl_safefree(conn->allocptr.uagent); Curl_safefree(conn->allocptr.userpwd); Curl_safefree(conn->allocptr.accept_encoding); Curl_safefree(conn->allocptr.te); Curl_safefree(conn->allocptr.rangeline); Curl_safefree(conn->allocptr.ref); Curl_safefree(conn->allocptr.host); Curl_safefree(conn->allocptr.cookiehost); Curl_safefree(conn->allocptr.rtsp_transport); Curl_safefree(conn->trailer); Curl_safefree(conn->host.rawalloc); /* host name buffer */ Curl_safefree(conn->conn_to_host.rawalloc); /* host name buffer */ Curl_safefree(conn->secondaryhostname); Curl_safefree(conn->http_proxy.host.rawalloc); /* http proxy name buffer */ Curl_safefree(conn->socks_proxy.host.rawalloc); /* socks proxy name buffer */ Curl_safefree(conn->master_buffer); Curl_safefree(conn->connect_state); conn_reset_all_postponed_data(conn); Curl_llist_destroy(&conn->send_pipe, NULL); Curl_llist_destroy(&conn->recv_pipe, NULL); Curl_safefree(conn->localdev); Curl_free_primary_ssl_config(&conn->ssl_config); Curl_free_primary_ssl_config(&conn->proxy_ssl_config); #ifdef USE_UNIX_SOCKETS Curl_safefree(conn->unix_domain_socket); #endif #ifdef USE_SSL Curl_safefree(conn->ssl_extra); #endif free(conn); /* free all the connection oriented data */ } ",0 "void Browser::ShowModalSigninWindow(profiles::BubbleViewMode mode, signin_metrics::AccessPoint access_point) { signin_view_controller_.ShowModalSignin(mode, this, access_point); } ",0 "static int hci_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len) { struct sock *sk = sock->sk; struct hci_dev *hdev; struct sk_buff *skb; int err; BT_DBG(""sock %p sk %p"", sock, sk); if (msg->msg_flags & MSG_OOB) return -EOPNOTSUPP; if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_NOSIGNAL|MSG_ERRQUEUE)) return -EINVAL; if (len < 4 || len > HCI_MAX_FRAME_SIZE) return -EINVAL; lock_sock(sk); switch (hci_pi(sk)->channel) { case HCI_CHANNEL_RAW: case HCI_CHANNEL_USER: break; case HCI_CHANNEL_CONTROL: err = mgmt_control(sk, msg, len); goto done; case HCI_CHANNEL_MONITOR: err = -EOPNOTSUPP; goto done; default: err = -EINVAL; goto done; } hdev = hci_pi(sk)->hdev; if (!hdev) { err = -EBADFD; goto done; } if (!test_bit(HCI_UP, &hdev->flags)) { err = -ENETDOWN; goto done; } skb = bt_skb_send_alloc(sk, len, msg->msg_flags & MSG_DONTWAIT, &err); if (!skb) goto done; if (memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len)) { err = -EFAULT; goto drop; } bt_cb(skb)->pkt_type = *((unsigned char *) skb->data); skb_pull(skb, 1); if (hci_pi(sk)->channel == HCI_CHANNEL_RAW && bt_cb(skb)->pkt_type == HCI_COMMAND_PKT) { u16 opcode = get_unaligned_le16(skb->data); u16 ogf = hci_opcode_ogf(opcode); u16 ocf = hci_opcode_ocf(opcode); if (((ogf > HCI_SFLT_MAX_OGF) || !hci_test_bit(ocf & HCI_FLT_OCF_BITS, &hci_sec_filter.ocf_mask[ogf])) && !capable(CAP_NET_RAW)) { err = -EPERM; goto drop; } if (test_bit(HCI_RAW, &hdev->flags) || (ogf == 0x3f)) { skb_queue_tail(&hdev->raw_q, skb); queue_work(hdev->workqueue, &hdev->tx_work); } else { /* Stand-alone HCI commands must be flaged as * single-command requests. */ bt_cb(skb)->req.start = true; skb_queue_tail(&hdev->cmd_q, skb); queue_work(hdev->workqueue, &hdev->cmd_work); } } else { if (!capable(CAP_NET_RAW)) { err = -EPERM; goto drop; } if (hci_pi(sk)->channel == HCI_CHANNEL_USER && bt_cb(skb)->pkt_type != HCI_COMMAND_PKT && bt_cb(skb)->pkt_type != HCI_ACLDATA_PKT && bt_cb(skb)->pkt_type != HCI_SCODATA_PKT) { err = -EINVAL; goto drop; } skb_queue_tail(&hdev->raw_q, skb); queue_work(hdev->workqueue, &hdev->tx_work); } err = len; done: release_sock(sk); return err; drop: kfree_skb(skb); goto done; } ",0 "static void php_pgsql_get_result_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) { zval *result; PGresult *pgsql_result; pgsql_result_handle *pg_result; if (zend_parse_parameters(ZEND_NUM_ARGS(), ""r"", &result) == FAILURE) { return; } ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, result, -1, ""PostgreSQL result"", le_result); pgsql_result = pg_result->result; switch (entry_type) { case PHP_PG_NUM_ROWS: RETVAL_LONG(PQntuples(pgsql_result)); break; case PHP_PG_NUM_FIELDS: RETVAL_LONG(PQnfields(pgsql_result)); break; case PHP_PG_CMD_TUPLES: #if HAVE_PQCMDTUPLES RETVAL_LONG(atoi(PQcmdTuples(pgsql_result))); #else php_error_docref(NULL, E_WARNING, ""Not supported under this build""); RETVAL_LONG(0); #endif break; default: RETURN_FALSE; } } ",0 " virtual status_t setCipherAlgorithm(Vector const &sessionId, String8 const &algorithm) { Parcel data, reply; data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); writeVector(data, sessionId); data.writeString8(algorithm); status_t status = remote()->transact(SET_CIPHER_ALGORITHM, data, &reply); if (status != OK) { return status; } return reply.readInt32(); } ",0 "void CSoundFile::SetSpeed(PlayState &playState, uint32 param) const { #ifdef MODPLUG_TRACKER if(GetType() == MOD_TYPE_XM && !param) { playState.m_nMusicSpeed = uint16_max; } #endif // MODPLUG_TRACKER if(param > 0) playState.m_nMusicSpeed = param; if(GetType() == MOD_TYPE_STM && param > 0) { playState.m_nMusicSpeed = std::max(param >> 4u, 1); playState.m_nMusicTempo = ConvertST2Tempo(static_cast(param)); } } ",0 "static void dumpDescendantFrameScrollPositions(WKBundleFrameRef frame, StringBuilder& stringBuilder) { WKRetainPtr childFrames(AdoptWK, WKBundleFrameCopyChildFrames(frame)); size_t size = WKArrayGetSize(childFrames.get()); for (size_t i = 0; i < size; ++i) { WKBundleFrameRef subframe = static_cast(WKArrayGetItemAtIndex(childFrames.get(), i)); dumpFrameScrollPosition(subframe, stringBuilder, ShouldIncludeFrameName); dumpDescendantFrameScrollPositions(subframe, stringBuilder); } } ",0 "OMX_ERRORTYPE omx_video::convert_queue_buffer(OMX_HANDLETYPE hComp, struct pmem &Input_pmem_info,unsigned long &index) { unsigned char *uva; OMX_ERRORTYPE ret = OMX_ErrorNone; unsigned long address = 0,p2,id; DEBUG_PRINT_LOW(""In Convert and queue Meta Buffer""); if (!psource_frame || !pdest_frame) { DEBUG_PRINT_ERROR(""convert_queue_buffer invalid params""); return OMX_ErrorBadParameter; } if (secure_session) { DEBUG_PRINT_ERROR(""cannot convert buffer during secure session""); return OMX_ErrorInvalidState; } if (!psource_frame->nFilledLen) { if(psource_frame->nFlags & OMX_BUFFERFLAG_EOS) { pdest_frame->nFilledLen = psource_frame->nFilledLen; pdest_frame->nTimeStamp = psource_frame->nTimeStamp; pdest_frame->nFlags = psource_frame->nFlags; DEBUG_PRINT_HIGH(""Skipping color conversion for empty EOS Buffer "" ""header=%p filled-len=%u"", pdest_frame, (unsigned int)pdest_frame->nFilledLen); } else { pdest_frame->nOffset = 0; pdest_frame->nFilledLen = 0; pdest_frame->nTimeStamp = psource_frame->nTimeStamp; pdest_frame->nFlags = psource_frame->nFlags; DEBUG_PRINT_LOW(""Buffer header %p Filled len size %u"", pdest_frame, (unsigned int)pdest_frame->nFilledLen); } } else { uva = (unsigned char *)mmap(NULL, Input_pmem_info.size, PROT_READ|PROT_WRITE, MAP_SHARED,Input_pmem_info.fd,0); if (uva == MAP_FAILED) { ret = OMX_ErrorBadParameter; } else { if (!c2d_conv.convert(Input_pmem_info.fd, uva, uva, m_pInput_pmem[index].fd, pdest_frame->pBuffer, pdest_frame->pBuffer)) { DEBUG_PRINT_ERROR(""Color Conversion failed""); ret = OMX_ErrorBadParameter; } else { unsigned int buf_size = 0; if (!c2d_conv.get_buffer_size(C2D_OUTPUT,buf_size)) ret = OMX_ErrorBadParameter; else { pdest_frame->nOffset = 0; pdest_frame->nFilledLen = buf_size; pdest_frame->nTimeStamp = psource_frame->nTimeStamp; pdest_frame->nFlags = psource_frame->nFlags; DEBUG_PRINT_LOW(""Buffer header %p Filled len size %u"", pdest_frame, (unsigned int)pdest_frame->nFilledLen); } } munmap(uva,Input_pmem_info.size); } } if (dev_use_buf(&m_pInput_pmem[index],PORT_INDEX_IN,0) != true) { DEBUG_PRINT_ERROR(""ERROR: in dev_use_buf""); post_event ((unsigned long)pdest_frame,0,OMX_COMPONENT_GENERATE_EBD); ret = OMX_ErrorBadParameter; } if (ret == OMX_ErrorNone) ret = empty_this_buffer_proxy(hComp,pdest_frame); if (ret == OMX_ErrorNone) { m_pCallbacks.EmptyBufferDone(hComp ,m_app_data, psource_frame); psource_frame = NULL; pdest_frame = NULL; if (!psource_frame && m_opq_meta_q.m_size) { m_opq_meta_q.pop_entry(&address,&p2,&id); psource_frame = (OMX_BUFFERHEADERTYPE* ) address; } if (!pdest_frame && m_opq_pmem_q.m_size) { m_opq_pmem_q.pop_entry(&address,&p2,&id); pdest_frame = (OMX_BUFFERHEADERTYPE* ) address; DEBUG_PRINT_LOW(""pdest_frame pop address is %p"",pdest_frame); } } else { psource_frame = NULL; } return ret; } ",0 "static int hub_pre_reset(struct usb_interface *intf) { struct usb_hub *hub = usb_get_intfdata(intf); hub_quiesce(hub, HUB_PRE_RESET); hub->in_reset = 1; hub_pm_barrier_for_all_ports(hub); return 0; } ",0 "static ssize_t hfi1_file_write(struct file *fp, const char __user *data, size_t count, loff_t *offset) { const struct hfi1_cmd __user *ucmd; struct hfi1_filedata *fd = fp->private_data; struct hfi1_ctxtdata *uctxt = fd->uctxt; struct hfi1_cmd cmd; struct hfi1_user_info uinfo; struct hfi1_tid_info tinfo; unsigned long addr; ssize_t consumed = 0, copy = 0, ret = 0; void *dest = NULL; __u64 user_val = 0; int uctxt_required = 1; int must_be_root = 0; if (count < sizeof(cmd)) { ret = -EINVAL; goto bail; } ucmd = (const struct hfi1_cmd __user *)data; if (copy_from_user(&cmd, ucmd, sizeof(cmd))) { ret = -EFAULT; goto bail; } consumed = sizeof(cmd); switch (cmd.type) { case HFI1_CMD_ASSIGN_CTXT: uctxt_required = 0; /* assigned user context not required */ copy = sizeof(uinfo); dest = &uinfo; break; case HFI1_CMD_SDMA_STATUS_UPD: case HFI1_CMD_CREDIT_UPD: copy = 0; break; case HFI1_CMD_TID_UPDATE: case HFI1_CMD_TID_FREE: case HFI1_CMD_TID_INVAL_READ: copy = sizeof(tinfo); dest = &tinfo; break; case HFI1_CMD_USER_INFO: case HFI1_CMD_RECV_CTRL: case HFI1_CMD_POLL_TYPE: case HFI1_CMD_ACK_EVENT: case HFI1_CMD_CTXT_INFO: case HFI1_CMD_SET_PKEY: case HFI1_CMD_CTXT_RESET: copy = 0; user_val = cmd.addr; break; case HFI1_CMD_EP_INFO: case HFI1_CMD_EP_ERASE_CHIP: case HFI1_CMD_EP_ERASE_RANGE: case HFI1_CMD_EP_READ_RANGE: case HFI1_CMD_EP_WRITE_RANGE: uctxt_required = 0; /* assigned user context not required */ must_be_root = 1; /* validate user */ copy = 0; break; default: ret = -EINVAL; goto bail; } /* If the command comes with user data, copy it. */ if (copy) { if (copy_from_user(dest, (void __user *)cmd.addr, copy)) { ret = -EFAULT; goto bail; } consumed += copy; } /* * Make sure there is a uctxt when needed. */ if (uctxt_required && !uctxt) { ret = -EINVAL; goto bail; } /* only root can do these operations */ if (must_be_root && !capable(CAP_SYS_ADMIN)) { ret = -EPERM; goto bail; } switch (cmd.type) { case HFI1_CMD_ASSIGN_CTXT: ret = assign_ctxt(fp, &uinfo); if (ret < 0) goto bail; ret = setup_ctxt(fp); if (ret) goto bail; ret = user_init(fp); break; case HFI1_CMD_CTXT_INFO: ret = get_ctxt_info(fp, (void __user *)(unsigned long) user_val, cmd.len); break; case HFI1_CMD_USER_INFO: ret = get_base_info(fp, (void __user *)(unsigned long) user_val, cmd.len); break; case HFI1_CMD_SDMA_STATUS_UPD: break; case HFI1_CMD_CREDIT_UPD: if (uctxt && uctxt->sc) sc_return_credits(uctxt->sc); break; case HFI1_CMD_TID_UPDATE: ret = hfi1_user_exp_rcv_setup(fp, &tinfo); if (!ret) { /* * Copy the number of tidlist entries we used * and the length of the buffer we registered. * These fields are adjacent in the structure so * we can copy them at the same time. */ addr = (unsigned long)cmd.addr + offsetof(struct hfi1_tid_info, tidcnt); if (copy_to_user((void __user *)addr, &tinfo.tidcnt, sizeof(tinfo.tidcnt) + sizeof(tinfo.length))) ret = -EFAULT; } break; case HFI1_CMD_TID_INVAL_READ: ret = hfi1_user_exp_rcv_invalid(fp, &tinfo); if (ret) break; addr = (unsigned long)cmd.addr + offsetof(struct hfi1_tid_info, tidcnt); if (copy_to_user((void __user *)addr, &tinfo.tidcnt, sizeof(tinfo.tidcnt))) ret = -EFAULT; break; case HFI1_CMD_TID_FREE: ret = hfi1_user_exp_rcv_clear(fp, &tinfo); if (ret) break; addr = (unsigned long)cmd.addr + offsetof(struct hfi1_tid_info, tidcnt); if (copy_to_user((void __user *)addr, &tinfo.tidcnt, sizeof(tinfo.tidcnt))) ret = -EFAULT; break; case HFI1_CMD_RECV_CTRL: ret = manage_rcvq(uctxt, fd->subctxt, (int)user_val); break; case HFI1_CMD_POLL_TYPE: uctxt->poll_type = (typeof(uctxt->poll_type))user_val; break; case HFI1_CMD_ACK_EVENT: ret = user_event_ack(uctxt, fd->subctxt, user_val); break; case HFI1_CMD_SET_PKEY: if (HFI1_CAP_IS_USET(PKEY_CHECK)) ret = set_ctxt_pkey(uctxt, fd->subctxt, user_val); else ret = -EPERM; break; case HFI1_CMD_CTXT_RESET: { struct send_context *sc; struct hfi1_devdata *dd; if (!uctxt || !uctxt->dd || !uctxt->sc) { ret = -EINVAL; break; } /* * There is no protection here. User level has to * guarantee that no one will be writing to the send * context while it is being re-initialized. * If user level breaks that guarantee, it will break * it's own context and no one else's. */ dd = uctxt->dd; sc = uctxt->sc; /* * Wait until the interrupt handler has marked the * context as halted or frozen. Report error if we time * out. */ wait_event_interruptible_timeout( sc->halt_wait, (sc->flags & SCF_HALTED), msecs_to_jiffies(SEND_CTXT_HALT_TIMEOUT)); if (!(sc->flags & SCF_HALTED)) { ret = -ENOLCK; break; } /* * If the send context was halted due to a Freeze, * wait until the device has been ""unfrozen"" before * resetting the context. */ if (sc->flags & SCF_FROZEN) { wait_event_interruptible_timeout( dd->event_queue, !(ACCESS_ONCE(dd->flags) & HFI1_FROZEN), msecs_to_jiffies(SEND_CTXT_HALT_TIMEOUT)); if (dd->flags & HFI1_FROZEN) { ret = -ENOLCK; break; } if (dd->flags & HFI1_FORCED_FREEZE) { /* * Don't allow context reset if we are into * forced freeze */ ret = -ENODEV; break; } sc_disable(sc); ret = sc_enable(sc); hfi1_rcvctrl(dd, HFI1_RCVCTRL_CTXT_ENB, uctxt->ctxt); } else { ret = sc_restart(sc); } if (!ret) sc_return_credits(sc); break; } case HFI1_CMD_EP_INFO: case HFI1_CMD_EP_ERASE_CHIP: case HFI1_CMD_EP_ERASE_RANGE: case HFI1_CMD_EP_READ_RANGE: case HFI1_CMD_EP_WRITE_RANGE: ret = handle_eprom_command(fp, &cmd); break; } if (ret >= 0) ret = consumed; bail: return ret; } ",1 "static void begin_print_callback(GtkPrintOperation* op, GtkPrintContext* context, gpointer user_data) { PrintContext* printContext = reinterpret_cast(user_data); float width = gtk_print_context_get_width(context); float height = gtk_print_context_get_height(context); FloatRect printRect = FloatRect(0, 0, width, height); printContext->begin(width); float headerHeight = 0; float footerHeight = 0; float pageHeight; // height of the page adjusted by margins printContext->computePageRects(printRect, headerHeight, footerHeight, 1.0, pageHeight); gtk_print_operation_set_n_pages(op, printContext->pageCount()); } ",0 "static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) { char *host=NULL,*port=NULL,*options=NULL,*tty=NULL,*dbname=NULL,*connstring=NULL; PGconn *pgsql; smart_str str = {0}; zval **args[5]; int i, connect_type = 0; PGresult *pg_result; if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 5 || zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) { WRONG_PARAM_COUNT; } smart_str_appends(&str, ""pgsql""); for (i = 0; i < ZEND_NUM_ARGS(); i++) { /* make sure that the PGSQL_CONNECT_FORCE_NEW bit is not part of the hash so that subsequent connections * can re-use this connection. Bug #39979 */ if (i == 1 && ZEND_NUM_ARGS() == 2 && Z_TYPE_PP(args[i]) == IS_LONG) { if (Z_LVAL_PP(args[1]) == PGSQL_CONNECT_FORCE_NEW) { continue; } else if (Z_LVAL_PP(args[1]) & PGSQL_CONNECT_FORCE_NEW) { smart_str_append_long(&str, Z_LVAL_PP(args[1]) ^ PGSQL_CONNECT_FORCE_NEW); } } convert_to_string_ex(args[i]); smart_str_appendc(&str, '_'); smart_str_appendl(&str, Z_STRVAL_PP(args[i]), Z_STRLEN_PP(args[i])); } smart_str_0(&str); if (ZEND_NUM_ARGS() == 1) { /* new style, using connection string */ connstring = Z_STRVAL_PP(args[0]); } else if (ZEND_NUM_ARGS() == 2 ) { /* Safe to add conntype_option, since 2 args was illegal */ connstring = Z_STRVAL_PP(args[0]); convert_to_long_ex(args[1]); connect_type = Z_LVAL_PP(args[1]); } else { host = Z_STRVAL_PP(args[0]); port = Z_STRVAL_PP(args[1]); dbname = Z_STRVAL_PP(args[ZEND_NUM_ARGS()-1]); switch (ZEND_NUM_ARGS()) { case 5: tty = Z_STRVAL_PP(args[3]); /* fall through */ case 4: options = Z_STRVAL_PP(args[2]); break; } } if (persistent && PGG(allow_persistent)) { zend_rsrc_list_entry *le; /* try to find if we already have this link in our persistent list */ if (zend_hash_find(&EG(persistent_list), str.c, str.len+1, (void **) &le)==FAILURE) { /* we don't */ zend_rsrc_list_entry new_le; if (PGG(max_links)!=-1 && PGG(num_links)>=PGG(max_links)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Cannot create new link. Too many open links (%ld)"", PGG(num_links)); goto err; } if (PGG(max_persistent)!=-1 && PGG(num_persistent)>=PGG(max_persistent)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Cannot create new link. Too many open persistent links (%ld)"", PGG(num_persistent)); goto err; } /* create the link */ if (connstring) { pgsql=PQconnectdb(connstring); } else { pgsql=PQsetdb(host,port,options,tty,dbname); } if (pgsql==NULL || PQstatus(pgsql)==CONNECTION_BAD) { PHP_PQ_ERROR(""Unable to connect to PostgreSQL server: %s"", pgsql) if (pgsql) { PQfinish(pgsql); } goto err; } /* hash it up */ Z_TYPE(new_le) = le_plink; new_le.ptr = pgsql; if (zend_hash_update(&EG(persistent_list), str.c, str.len+1, (void *) &new_le, sizeof(zend_rsrc_list_entry), NULL)==FAILURE) { goto err; } PGG(num_links)++; PGG(num_persistent)++; } else { /* we do */ if (Z_TYPE_P(le) != le_plink) { RETURN_FALSE; } /* ensure that the link did not die */ if (PGG(auto_reset_persistent) & 1) { /* need to send & get something from backend to make sure we catch CONNECTION_BAD everytime */ PGresult *pg_result; pg_result = PQexec(le->ptr, ""select 1""); PQclear(pg_result); } if (PQstatus(le->ptr)==CONNECTION_BAD) { /* the link died */ if (le->ptr == NULL) { if (connstring) { le->ptr=PQconnectdb(connstring); } else { le->ptr=PQsetdb(host,port,options,tty,dbname); } } else { PQreset(le->ptr); } if (le->ptr==NULL || PQstatus(le->ptr)==CONNECTION_BAD) { php_error_docref(NULL TSRMLS_CC, E_WARNING,""PostgreSQL link lost, unable to reconnect""); zend_hash_del(&EG(persistent_list),str.c,str.len+1); goto err; } } pgsql = (PGconn *) le->ptr; #if HAVE_PQPROTOCOLVERSION && HAVE_PQPARAMETERSTATUS if (PQprotocolVersion(pgsql) >= 3 && atof(PQparameterStatus(pgsql, ""server_version"")) >= 7.2) { #else if (atof(PG_VERSION) >= 7.2) { #endif pg_result = PQexec(pgsql, ""RESET ALL;""); PQclear(pg_result); } } ZEND_REGISTER_RESOURCE(return_value, pgsql, le_plink); } else { /* Non persistent connection */ zend_rsrc_list_entry *index_ptr,new_index_ptr; /* first we check the hash for the hashed_details key. if it exists, * it should point us to the right offset where the actual pgsql link sits. * if it doesn't, open a new pgsql link, add it to the resource list, * and add a pointer to it with hashed_details as the key. */ if (!(connect_type & PGSQL_CONNECT_FORCE_NEW) && zend_hash_find(&EG(regular_list),str.c,str.len+1,(void **) &index_ptr)==SUCCESS) { int type; ulong link; void *ptr; if (Z_TYPE_P(index_ptr) != le_index_ptr) { RETURN_FALSE; } link = (ulong) index_ptr->ptr; ptr = zend_list_find(link,&type); /* check if the link is still there */ if (ptr && (type==le_link || type==le_plink)) { Z_LVAL_P(return_value) = link; zend_list_addref(link); php_pgsql_set_default_link(link TSRMLS_CC); Z_TYPE_P(return_value) = IS_RESOURCE; goto cleanup; } else { zend_hash_del(&EG(regular_list),str.c,str.len+1); } } if (PGG(max_links)!=-1 && PGG(num_links)>=PGG(max_links)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Cannot create new link. Too many open links (%ld)"", PGG(num_links)); goto err; } if (connstring) { pgsql = PQconnectdb(connstring); } else { pgsql = PQsetdb(host,port,options,tty,dbname); } if (pgsql==NULL || PQstatus(pgsql)==CONNECTION_BAD) { PHP_PQ_ERROR(""Unable to connect to PostgreSQL server: %s"", pgsql); if (pgsql) { PQfinish(pgsql); } goto err; } /* add it to the list */ ZEND_REGISTER_RESOURCE(return_value, pgsql, le_link); /* add it to the hash */ new_index_ptr.ptr = (void *) Z_LVAL_P(return_value); Z_TYPE(new_index_ptr) = le_index_ptr; if (zend_hash_update(&EG(regular_list),str.c,str.len+1,(void *) &new_index_ptr, sizeof(zend_rsrc_list_entry), NULL)==FAILURE) { goto err; } PGG(num_links)++; } /* set notice processer */ if (! PGG(ignore_notices) && Z_TYPE_P(return_value) == IS_RESOURCE) { PQsetNoticeProcessor(pgsql, _php_pgsql_notice_handler, (void*)Z_RESVAL_P(return_value)); } php_pgsql_set_default_link(Z_LVAL_P(return_value) TSRMLS_CC); cleanup: smart_str_free(&str); return; err: smart_str_free(&str); RETURN_FALSE; } /* }}} */ #if 0 /* {{{ php_pgsql_get_default_link */ static int php_pgsql_get_default_link(INTERNAL_FUNCTION_PARAMETERS) { if (PGG(default_link)==-1) { /* no link opened yet, implicitly open one */ ht = 0; php_pgsql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,0); } return PGG(default_link); } /* }}} */ #endif /* {{{ proto resource pg_connect(string connection_string[, int connect_type] | [string host, string port [, string options [, string tty,]]] string database) Open a PostgreSQL connection */ PHP_FUNCTION(pg_connect) { php_pgsql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,0); } /* }}} */ /* {{{ proto resource pg_pconnect(string connection_string | [string host, string port [, string options [, string tty,]]] string database) Open a persistent PostgreSQL connection */ PHP_FUNCTION(pg_pconnect) { php_pgsql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,1); } /* }}} */ /* {{{ proto bool pg_close([resource connection]) Close a PostgreSQL connection */ PHP_FUNCTION(pg_close) { zval *pgsql_link = NULL; int id = -1, argc = ZEND_NUM_ARGS(); PGconn *pgsql; if (zend_parse_parameters(argc TSRMLS_CC, ""|r"", &pgsql_link) == FAILURE) { return; } if (argc == 0) { id = PGG(default_link); CHECK_DEFAULT_LINK(id); } if (pgsql_link == NULL && id == -1) { RETURN_FALSE; } ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, ""PostgreSQL link"", le_link, le_plink); if (id==-1) { /* explicit resource number */ zend_list_delete(Z_RESVAL_P(pgsql_link)); } if (id!=-1 || (pgsql_link && Z_RESVAL_P(pgsql_link)==PGG(default_link))) { zend_list_delete(PGG(default_link)); PGG(default_link) = -1; } RETURN_TRUE; } /* }}} */ #define PHP_PG_DBNAME 1 #define PHP_PG_ERROR_MESSAGE 2 #define PHP_PG_OPTIONS 3 #define PHP_PG_PORT 4 #define PHP_PG_TTY 5 #define PHP_PG_HOST 6 #define PHP_PG_VERSION 7 /* {{{ php_pgsql_get_link_info */ static void php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) { zval *pgsql_link = NULL; int id = -1, argc = ZEND_NUM_ARGS(); PGconn *pgsql; char *msgbuf; if (zend_parse_parameters(argc TSRMLS_CC, ""|r"", &pgsql_link) == FAILURE) { return; } if (argc == 0) { id = PGG(default_link); CHECK_DEFAULT_LINK(id); } if (pgsql_link == NULL && id == -1) { RETURN_FALSE; } ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, ""PostgreSQL link"", le_link, le_plink); switch(entry_type) { case PHP_PG_DBNAME: Z_STRVAL_P(return_value) = PQdb(pgsql); break; case PHP_PG_ERROR_MESSAGE: RETURN_STRING(PQErrorMessageTrim(pgsql, &msgbuf), 0); return; case PHP_PG_OPTIONS: Z_STRVAL_P(return_value) = PQoptions(pgsql); break; case PHP_PG_PORT: Z_STRVAL_P(return_value) = PQport(pgsql); break; case PHP_PG_TTY: Z_STRVAL_P(return_value) = PQtty(pgsql); break; case PHP_PG_HOST: Z_STRVAL_P(return_value) = PQhost(pgsql); break; case PHP_PG_VERSION: array_init(return_value); add_assoc_string(return_value, ""client"", PG_VERSION, 1); #if HAVE_PQPROTOCOLVERSION add_assoc_long(return_value, ""protocol"", PQprotocolVersion(pgsql)); #if HAVE_PQPARAMETERSTATUS if (PQprotocolVersion(pgsql) >= 3) { add_assoc_string(return_value, ""server"", (char*)PQparameterStatus(pgsql, ""server_version""), 1); } #endif #endif return; default: RETURN_FALSE; } if (Z_STRVAL_P(return_value)) { Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value)); Z_STRVAL_P(return_value) = (char *) estrdup(Z_STRVAL_P(return_value)); } else { Z_STRLEN_P(return_value) = 0; Z_STRVAL_P(return_value) = (char *) estrdup(""""); } Z_TYPE_P(return_value) = IS_STRING; } /* }}} */ /* {{{ proto string pg_dbname([resource connection]) Get the database name */ PHP_FUNCTION(pg_dbname) { php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_DBNAME); } /* }}} */ /* {{{ proto string pg_last_error([resource connection]) Get the error message string */ PHP_FUNCTION(pg_last_error) { php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_ERROR_MESSAGE); } /* }}} */ /* {{{ proto string pg_options([resource connection]) Get the options associated with the connection */ PHP_FUNCTION(pg_options) { php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_OPTIONS); } /* }}} */ /* {{{ proto int pg_port([resource connection]) Return the port number associated with the connection */ PHP_FUNCTION(pg_port) { php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_PORT); } /* }}} */ /* {{{ proto string pg_tty([resource connection]) Return the tty name associated with the connection */ PHP_FUNCTION(pg_tty) { php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_TTY); } /* }}} */ /* {{{ proto string pg_host([resource connection]) Returns the host name associated with the connection */ PHP_FUNCTION(pg_host) { php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_HOST); } /* }}} */ /* {{{ proto array pg_version([resource connection]) Returns an array with client, protocol and server version (when available) */ PHP_FUNCTION(pg_version) { php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_VERSION); } /* }}} */ #if HAVE_PQPARAMETERSTATUS /* {{{ proto string|false pg_parameter_status([resource connection,] string param_name) Returns the value of a server parameter */ PHP_FUNCTION(pg_parameter_status) { zval *pgsql_link; int id; PGconn *pgsql; char *param; int len; if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, ""rs"", &pgsql_link, ¶m, &len) == SUCCESS) { id = -1; } else if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""s"", ¶m, &len) == SUCCESS) { pgsql_link = NULL; id = PGG(default_link); } else { RETURN_FALSE; } if (pgsql_link == NULL && id == -1) { RETURN_FALSE; } ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, ""PostgreSQL link"", le_link, le_plink); param = (char*)PQparameterStatus(pgsql, param); if (param) { RETURN_STRING(param, 1); } else { RETURN_FALSE; } } /* }}} */ #endif /* {{{ proto bool pg_ping([resource connection]) Ping database. If connection is bad, try to reconnect. */ PHP_FUNCTION(pg_ping) { zval *pgsql_link; int id; PGconn *pgsql; PGresult *res; if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, ""r"", &pgsql_link) == SUCCESS) { id = -1; } else { pgsql_link = NULL; id = PGG(default_link); } if (pgsql_link == NULL && id == -1) { RETURN_FALSE; } ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, ""PostgreSQL link"", le_link, le_plink); /* ping connection */ res = PQexec(pgsql, ""SELECT 1;""); PQclear(res); /* check status. */ if (PQstatus(pgsql) == CONNECTION_OK) RETURN_TRUE; /* reset connection if it's broken */ PQreset(pgsql); if (PQstatus(pgsql) == CONNECTION_OK) { RETURN_TRUE; } RETURN_FALSE; } /* }}} */ /* {{{ proto resource pg_query([resource connection,] string query) Execute a query */ PHP_FUNCTION(pg_query) { zval *pgsql_link = NULL; char *query; int id = -1, query_len, argc = ZEND_NUM_ARGS(); int leftover = 0; PGconn *pgsql; PGresult *pgsql_result; ExecStatusType status; pgsql_result_handle *pg_result; if (argc == 1) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""s"", &query, &query_len) == FAILURE) { return; } id = PGG(default_link); CHECK_DEFAULT_LINK(id); } else { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""rs"", &pgsql_link, &query, &query_len) == FAILURE) { return; } } if (pgsql_link == NULL && id == -1) { RETURN_FALSE; } ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, ""PostgreSQL link"", le_link, le_plink); if (PQ_SETNONBLOCKING(pgsql, 0)) { php_error_docref(NULL TSRMLS_CC, E_NOTICE,""Cannot set connection to blocking mode""); RETURN_FALSE; } while ((pgsql_result = PQgetResult(pgsql))) { PQclear(pgsql_result); leftover = 1; } if (leftover) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Found results on this connection. Use pg_get_result() to get these results first""); } pgsql_result = PQexec(pgsql, query); if ((PGG(auto_reset_persistent) & 2) && PQstatus(pgsql) != CONNECTION_OK) { PQclear(pgsql_result); PQreset(pgsql); pgsql_result = PQexec(pgsql, query); } if (pgsql_result) { status = PQresultStatus(pgsql_result); } else { status = (ExecStatusType) PQstatus(pgsql); } switch (status) { case PGRES_EMPTY_QUERY: case PGRES_BAD_RESPONSE: case PGRES_NONFATAL_ERROR: case PGRES_FATAL_ERROR: PHP_PQ_ERROR(""Query failed: %s"", pgsql); PQclear(pgsql_result); RETURN_FALSE; break; case PGRES_COMMAND_OK: /* successful command that did not return rows */ default: if (pgsql_result) { pg_result = (pgsql_result_handle *) emalloc(sizeof(pgsql_result_handle)); pg_result->conn = pgsql; pg_result->result = pgsql_result; pg_result->row = 0; ZEND_REGISTER_RESOURCE(return_value, pg_result, le_result); } else { PQclear(pgsql_result); RETURN_FALSE; } break; } } /* }}} */ #if HAVE_PQEXECPARAMS || HAVE_PQEXECPREPARED || HAVE_PQSENDQUERYPARAMS || HAVE_PQSENDQUERYPREPARED /* {{{ _php_pgsql_free_params */ static void _php_pgsql_free_params(char **params, int num_params) { if (num_params > 0) { int i; for (i = 0; i < num_params; i++) { if (params[i]) { efree(params[i]); } } efree(params); } } /* }}} */ #endif #if HAVE_PQEXECPARAMS /* {{{ proto resource pg_query_params([resource connection,] string query, array params) Execute a query */ PHP_FUNCTION(pg_query_params) { zval *pgsql_link = NULL; zval *pv_param_arr, **tmp; char *query; int query_len, id = -1, argc = ZEND_NUM_ARGS(); int leftover = 0; int num_params = 0; char **params = NULL; PGconn *pgsql; PGresult *pgsql_result; ExecStatusType status; pgsql_result_handle *pg_result; if (argc == 2) { if (zend_parse_parameters(argc TSRMLS_CC, ""sa"", &query, &query_len, &pv_param_arr) == FAILURE) { return; } id = PGG(default_link); CHECK_DEFAULT_LINK(id); } else { if (zend_parse_parameters(argc TSRMLS_CC, ""rsa"", &pgsql_link, &query, &query_len, &pv_param_arr) == FAILURE) { return; } } if (pgsql_link == NULL && id == -1) { RETURN_FALSE; } ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, ""PostgreSQL link"", le_link, le_plink); if (PQ_SETNONBLOCKING(pgsql, 0)) { php_error_docref(NULL TSRMLS_CC, E_NOTICE,""Cannot set connection to blocking mode""); RETURN_FALSE; } while ((pgsql_result = PQgetResult(pgsql))) { PQclear(pgsql_result); leftover = 1; } if (leftover) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Found results on this connection. Use pg_get_result() to get these results first""); } zend_hash_internal_pointer_reset(Z_ARRVAL_P(pv_param_arr)); num_params = zend_hash_num_elements(Z_ARRVAL_P(pv_param_arr)); if (num_params > 0) { int i = 0; params = (char **)safe_emalloc(sizeof(char *), num_params, 0); for(i = 0; i < num_params; i++) { if (zend_hash_get_current_data(Z_ARRVAL_P(pv_param_arr), (void **) &tmp) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING,""Error getting parameter""); _php_pgsql_free_params(params, num_params); RETURN_FALSE; } if (Z_TYPE_PP(tmp) == IS_NULL) { params[i] = NULL; } else { zval tmp_val = **tmp; zval_copy_ctor(&tmp_val); convert_to_string(&tmp_val); if (Z_TYPE(tmp_val) != IS_STRING) { php_error_docref(NULL TSRMLS_CC, E_WARNING,""Error converting parameter""); zval_dtor(&tmp_val); _php_pgsql_free_params(params, num_params); RETURN_FALSE; } params[i] = estrndup(Z_STRVAL(tmp_val), Z_STRLEN(tmp_val)); zval_dtor(&tmp_val); } zend_hash_move_forward(Z_ARRVAL_P(pv_param_arr)); } } pgsql_result = PQexecParams(pgsql, query, num_params, NULL, (const char * const *)params, NULL, NULL, 0); if ((PGG(auto_reset_persistent) & 2) && PQstatus(pgsql) != CONNECTION_OK) { PQclear(pgsql_result); PQreset(pgsql); pgsql_result = PQexecParams(pgsql, query, num_params, NULL, (const char * const *)params, NULL, NULL, 0); } if (pgsql_result) { status = PQresultStatus(pgsql_result); } else { status = (ExecStatusType) PQstatus(pgsql); } _php_pgsql_free_params(params, num_params); switch (status) { case PGRES_EMPTY_QUERY: case PGRES_BAD_RESPONSE: case PGRES_NONFATAL_ERROR: case PGRES_FATAL_ERROR: PHP_PQ_ERROR(""Query failed: %s"", pgsql); PQclear(pgsql_result); RETURN_FALSE; break; case PGRES_COMMAND_OK: /* successful command that did not return rows */ default: if (pgsql_result) { pg_result = (pgsql_result_handle *) emalloc(sizeof(pgsql_result_handle)); pg_result->conn = pgsql; pg_result->result = pgsql_result; pg_result->row = 0; ZEND_REGISTER_RESOURCE(return_value, pg_result, le_result); } else { PQclear(pgsql_result); RETURN_FALSE; } break; } } /* }}} */ #endif #if HAVE_PQPREPARE /* {{{ proto resource pg_prepare([resource connection,] string stmtname, string query) Prepare a query for future execution */ PHP_FUNCTION(pg_prepare) { zval *pgsql_link = NULL; char *query, *stmtname; int query_len, stmtname_len, id = -1, argc = ZEND_NUM_ARGS(); int leftover = 0; PGconn *pgsql; PGresult *pgsql_result; ExecStatusType status; pgsql_result_handle *pg_result; if (argc == 2) { if (zend_parse_parameters(argc TSRMLS_CC, ""ss"", &stmtname, &stmtname_len, &query, &query_len) == FAILURE) { return; } id = PGG(default_link); CHECK_DEFAULT_LINK(id); } else { if (zend_parse_parameters(argc TSRMLS_CC, ""rss"", &pgsql_link, &stmtname, &stmtname_len, &query, &query_len) == FAILURE) { return; } } if (pgsql_link == NULL && id == -1) { RETURN_FALSE; } ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, ""PostgreSQL link"", le_link, le_plink); if (PQ_SETNONBLOCKING(pgsql, 0)) { php_error_docref(NULL TSRMLS_CC, E_NOTICE,""Cannot set connection to blocking mode""); RETURN_FALSE; } while ((pgsql_result = PQgetResult(pgsql))) { PQclear(pgsql_result); leftover = 1; } if (leftover) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Found results on this connection. Use pg_get_result() to get these results first""); } pgsql_result = PQprepare(pgsql, stmtname, query, 0, NULL); if ((PGG(auto_reset_persistent) & 2) && PQstatus(pgsql) != CONNECTION_OK) { PQclear(pgsql_result); PQreset(pgsql); pgsql_result = PQprepare(pgsql, stmtname, query, 0, NULL); } if (pgsql_result) { status = PQresultStatus(pgsql_result); } else { status = (ExecStatusType) PQstatus(pgsql); } switch (status) { case PGRES_EMPTY_QUERY: case PGRES_BAD_RESPONSE: case PGRES_NONFATAL_ERROR: case PGRES_FATAL_ERROR: PHP_PQ_ERROR(""Query failed: %s"", pgsql); PQclear(pgsql_result); RETURN_FALSE; break; case PGRES_COMMAND_OK: /* successful command that did not return rows */ default: if (pgsql_result) { pg_result = (pgsql_result_handle *) emalloc(sizeof(pgsql_result_handle)); pg_result->conn = pgsql; pg_result->result = pgsql_result; pg_result->row = 0; ZEND_REGISTER_RESOURCE(return_value, pg_result, le_result); } else { PQclear(pgsql_result); RETURN_FALSE; } break; } } /* }}} */ #endif #if HAVE_PQEXECPREPARED /* {{{ proto resource pg_execute([resource connection,] string stmtname, array params) Execute a prepared query */ PHP_FUNCTION(pg_execute) { zval *pgsql_link = NULL; zval *pv_param_arr, **tmp; char *stmtname; int stmtname_len, id = -1, argc = ZEND_NUM_ARGS(); int leftover = 0; int num_params = 0; char **params = NULL; PGconn *pgsql; PGresult *pgsql_result; ExecStatusType status; pgsql_result_handle *pg_result; if (argc == 2) { if (zend_parse_parameters(argc TSRMLS_CC, ""sa/"", &stmtname, &stmtname_len, &pv_param_arr)==FAILURE) { return; } id = PGG(default_link); CHECK_DEFAULT_LINK(id); } else { if (zend_parse_parameters(argc TSRMLS_CC, ""rsa/"", &pgsql_link, &stmtname, &stmtname_len, &pv_param_arr) == FAILURE) { return; } } if (pgsql_link == NULL && id == -1) { RETURN_FALSE; } ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, ""PostgreSQL link"", le_link, le_plink); if (PQ_SETNONBLOCKING(pgsql, 0)) { php_error_docref(NULL TSRMLS_CC, E_NOTICE,""Cannot set connection to blocking mode""); RETURN_FALSE; } while ((pgsql_result = PQgetResult(pgsql))) { PQclear(pgsql_result); leftover = 1; } if (leftover) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Found results on this connection. Use pg_get_result() to get these results first""); } zend_hash_internal_pointer_reset(Z_ARRVAL_P(pv_param_arr)); num_params = zend_hash_num_elements(Z_ARRVAL_P(pv_param_arr)); if (num_params > 0) { int i = 0; params = (char **)safe_emalloc(sizeof(char *), num_params, 0); for(i = 0; i < num_params; i++) { if (zend_hash_get_current_data(Z_ARRVAL_P(pv_param_arr), (void **) &tmp) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING,""Error getting parameter""); _php_pgsql_free_params(params, num_params); RETURN_FALSE; } if (Z_TYPE_PP(tmp) == IS_NULL) { params[i] = NULL; } else { zval tmp_val = **tmp; zval_copy_ctor(&tmp_val); convert_to_string(&tmp_val); if (Z_TYPE(tmp_val) != IS_STRING) { php_error_docref(NULL TSRMLS_CC, E_WARNING,""Error converting parameter""); zval_dtor(&tmp_val); _php_pgsql_free_params(params, num_params); RETURN_FALSE; } params[i] = estrndup(Z_STRVAL(tmp_val), Z_STRLEN(tmp_val)); zval_dtor(&tmp_val); } zend_hash_move_forward(Z_ARRVAL_P(pv_param_arr)); } } pgsql_result = PQexecPrepared(pgsql, stmtname, num_params, (const char * const *)params, NULL, NULL, 0); if ((PGG(auto_reset_persistent) & 2) && PQstatus(pgsql) != CONNECTION_OK) { PQclear(pgsql_result); PQreset(pgsql); pgsql_result = PQexecPrepared(pgsql, stmtname, num_params, (const char * const *)params, NULL, NULL, 0); } if (pgsql_result) { status = PQresultStatus(pgsql_result); } else { status = (ExecStatusType) PQstatus(pgsql); } _php_pgsql_free_params(params, num_params); switch (status) { case PGRES_EMPTY_QUERY: case PGRES_BAD_RESPONSE: case PGRES_NONFATAL_ERROR: case PGRES_FATAL_ERROR: PHP_PQ_ERROR(""Query failed: %s"", pgsql); PQclear(pgsql_result); RETURN_FALSE; break; case PGRES_COMMAND_OK: /* successful command that did not return rows */ default: if (pgsql_result) { pg_result = (pgsql_result_handle *) emalloc(sizeof(pgsql_result_handle)); pg_result->conn = pgsql; pg_result->result = pgsql_result; pg_result->row = 0; ZEND_REGISTER_RESOURCE(return_value, pg_result, le_result); } else { PQclear(pgsql_result); RETURN_FALSE; } break; } } /* }}} */ #endif #define PHP_PG_NUM_ROWS 1 #define PHP_PG_NUM_FIELDS 2 #define PHP_PG_CMD_TUPLES 3 /* {{{ php_pgsql_get_result_info */ static void php_pgsql_get_result_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) { zval *result; PGresult *pgsql_result; pgsql_result_handle *pg_result; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""r"", &result) == FAILURE) { return; } ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, &result, -1, ""PostgreSQL result"", le_result); pgsql_result = pg_result->result; switch (entry_type) { case PHP_PG_NUM_ROWS: Z_LVAL_P(return_value) = PQntuples(pgsql_result); break; case PHP_PG_NUM_FIELDS: Z_LVAL_P(return_value) = PQnfields(pgsql_result); break; case PHP_PG_CMD_TUPLES: #if HAVE_PQCMDTUPLES Z_LVAL_P(return_value) = atoi(PQcmdTuples(pgsql_result)); #else php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Not supported under this build""); Z_LVAL_P(return_value) = 0; #endif break; default: RETURN_FALSE; } Z_TYPE_P(return_value) = IS_LONG; } /* }}} */ /* {{{ proto int pg_num_rows(resource result) Return the number of rows in the result */ PHP_FUNCTION(pg_num_rows) { php_pgsql_get_result_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_NUM_ROWS); } /* }}} */ /* {{{ proto int pg_num_fields(resource result) Return the number of fields in the result */ PHP_FUNCTION(pg_num_fields) { php_pgsql_get_result_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_NUM_FIELDS); } /* }}} */ #if HAVE_PQCMDTUPLES /* {{{ proto int pg_affected_rows(resource result) Returns the number of affected tuples */ PHP_FUNCTION(pg_affected_rows) { php_pgsql_get_result_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_CMD_TUPLES); } /* }}} */ #endif /* {{{ proto string pg_last_notice(resource connection) Returns the last notice set by the backend */ PHP_FUNCTION(pg_last_notice) { zval *pgsql_link; PGconn *pg_link; int id = -1; php_pgsql_notice **notice; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""r"", &pgsql_link) == FAILURE) { return; } /* Just to check if user passed valid resoruce */ ZEND_FETCH_RESOURCE2(pg_link, PGconn *, &pgsql_link, id, ""PostgreSQL link"", le_link, le_plink); if (zend_hash_index_find(&PGG(notices), Z_RESVAL_P(pgsql_link), (void **)¬ice) == FAILURE) { RETURN_FALSE; } RETURN_STRINGL((*notice)->message, (*notice)->len, 1); } /* }}} */ /* {{{ get_field_name */ static char *get_field_name(PGconn *pgsql, Oid oid, HashTable *list TSRMLS_DC) { PGresult *result; smart_str str = {0}; zend_rsrc_list_entry *field_type; char *ret=NULL; /* try to lookup the type in the resource list */ smart_str_appends(&str, ""pgsql_oid_""); smart_str_append_unsigned(&str, oid); smart_str_0(&str); if (zend_hash_find(list,str.c,str.len+1,(void **) &field_type)==SUCCESS) { ret = estrdup((char *)field_type->ptr); } else { /* hash all oid's */ int i,num_rows; int oid_offset,name_offset; char *tmp_oid, *end_ptr, *tmp_name; zend_rsrc_list_entry new_oid_entry; if ((result = PQexec(pgsql,""select oid,typname from pg_type"")) == NULL || PQresultStatus(result) != PGRES_TUPLES_OK) { if (result) { PQclear(result); } smart_str_free(&str); return STR_EMPTY_ALLOC(); } num_rows = PQntuples(result); oid_offset = PQfnumber(result,""oid""); name_offset = PQfnumber(result,""typname""); for (i=0; i= PQnfields(pg_result->result)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Bad field offset specified""); RETURN_FALSE; } oid = PQftable(pg_result->result, fnum); if (InvalidOid == oid) { RETURN_FALSE; } if (return_oid) { #if UINT_MAX > LONG_MAX /* Oid is unsigned int, we don't need this code, where LONG is wider */ if (oid > LONG_MAX) { smart_str oidstr = {0}; smart_str_append_unsigned(&oidstr, oid); smart_str_0(&oidstr); RETURN_STRINGL(oidstr.c, oidstr.len, 0); } else #endif RETURN_LONG((long)oid); } /* try to lookup the table name in the resource list */ smart_str_appends(&hash_key, ""pgsql_table_oid_""); smart_str_append_unsigned(&hash_key, oid); smart_str_0(&hash_key); if (zend_hash_find(&EG(regular_list), hash_key.c, hash_key.len+1, (void **) &field_table) == SUCCESS) { smart_str_free(&hash_key); RETURN_STRING((char *)field_table->ptr, 1); } else { /* Not found, lookup by querying PostgreSQL system tables */ PGresult *tmp_res; smart_str querystr = {0}; zend_rsrc_list_entry new_field_table; smart_str_appends(&querystr, ""select relname from pg_class where oid=""); smart_str_append_unsigned(&querystr, oid); smart_str_0(&querystr); if ((tmp_res = PQexec(pg_result->conn, querystr.c)) == NULL || PQresultStatus(tmp_res) != PGRES_TUPLES_OK) { if (tmp_res) { PQclear(tmp_res); } smart_str_free(&querystr); smart_str_free(&hash_key); RETURN_FALSE; } smart_str_free(&querystr); if ((table_name = PQgetvalue(tmp_res, 0, 0)) == NULL) { PQclear(tmp_res); smart_str_free(&hash_key); RETURN_FALSE; } Z_TYPE(new_field_table) = le_string; new_field_table.ptr = estrdup(table_name); zend_hash_update(&EG(regular_list), hash_key.c, hash_key.len+1, (void *) &new_field_table, sizeof(zend_rsrc_list_entry), NULL); smart_str_free(&hash_key); PQclear(tmp_res); RETURN_STRING(table_name, 1); } } /* }}} */ #endif #define PHP_PG_FIELD_NAME 1 #define PHP_PG_FIELD_SIZE 2 #define PHP_PG_FIELD_TYPE 3 #define PHP_PG_FIELD_TYPE_OID 4 /* {{{ php_pgsql_get_field_info */ static void php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) { zval *result; long field; PGresult *pgsql_result; pgsql_result_handle *pg_result; Oid oid; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""rl"", &result, &field) == FAILURE) { return; } ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, &result, -1, ""PostgreSQL result"", le_result); pgsql_result = pg_result->result; if (field < 0 || field >= PQnfields(pgsql_result)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Bad field offset specified""); RETURN_FALSE; } switch (entry_type) { case PHP_PG_FIELD_NAME: Z_STRVAL_P(return_value) = PQfname(pgsql_result, field); Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value)); Z_STRVAL_P(return_value) = estrndup(Z_STRVAL_P(return_value),Z_STRLEN_P(return_value)); Z_TYPE_P(return_value) = IS_STRING; break; case PHP_PG_FIELD_SIZE: Z_LVAL_P(return_value) = PQfsize(pgsql_result, field); Z_TYPE_P(return_value) = IS_LONG; break; case PHP_PG_FIELD_TYPE: Z_STRVAL_P(return_value) = get_field_name(pg_result->conn, PQftype(pgsql_result, field), &EG(regular_list) TSRMLS_CC); Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value)); Z_TYPE_P(return_value) = IS_STRING; break; case PHP_PG_FIELD_TYPE_OID: oid = PQftype(pgsql_result, field); #if UINT_MAX > LONG_MAX if (oid > LONG_MAX) { smart_str s = {0}; smart_str_append_unsigned(&s, oid); smart_str_0(&s); Z_STRVAL_P(return_value) = s.c; Z_STRLEN_P(return_value) = s.len; Z_TYPE_P(return_value) = IS_STRING; } else #endif { Z_LVAL_P(return_value) = (long)oid; Z_TYPE_P(return_value) = IS_LONG; } break; default: RETURN_FALSE; } } /* }}} */ /* {{{ proto string pg_field_name(resource result, int field_number) Returns the name of the field */ PHP_FUNCTION(pg_field_name) { php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_FIELD_NAME); } /* }}} */ /* {{{ proto int pg_field_size(resource result, int field_number) Returns the internal size of the field */ PHP_FUNCTION(pg_field_size) { php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_FIELD_SIZE); } /* }}} */ /* {{{ proto string pg_field_type(resource result, int field_number) Returns the type name for the given field */ PHP_FUNCTION(pg_field_type) { php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_FIELD_TYPE); } /* }}} */ /* {{{ proto string pg_field_type_oid(resource result, int field_number) Returns the type oid for the given field */ PHP_FUNCTION(pg_field_type_oid) { php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_FIELD_TYPE_OID); } /* }}} */ /* {{{ proto int pg_field_num(resource result, string field_name) Returns the field number of the named field */ PHP_FUNCTION(pg_field_num) { zval *result; char *field; int field_len; PGresult *pgsql_result; pgsql_result_handle *pg_result; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""rs"", &result, &field, &field_len) == FAILURE) { return; } ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, &result, -1, ""PostgreSQL result"", le_result); pgsql_result = pg_result->result; Z_LVAL_P(return_value) = PQfnumber(pgsql_result, field); Z_TYPE_P(return_value) = IS_LONG; } /* }}} */ /* {{{ proto mixed pg_fetch_result(resource result, [int row_number,] mixed field_name) Returns values from a result identifier */ PHP_FUNCTION(pg_fetch_result) { zval *result, **field=NULL; long row; PGresult *pgsql_result; pgsql_result_handle *pg_result; int field_offset, pgsql_row, argc = ZEND_NUM_ARGS(); if (argc == 2) { if (zend_parse_parameters(argc TSRMLS_CC, ""rZ"", &result, &field) == FAILURE) { return; } } else { if (zend_parse_parameters(argc TSRMLS_CC, ""rlZ"", &result, &row, &field) == FAILURE) { return; } } ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, &result, -1, ""PostgreSQL result"", le_result); pgsql_result = pg_result->result; if (argc == 2) { if (pg_result->row < 0) { pg_result->row = 0; } pgsql_row = pg_result->row; if (pgsql_row >= PQntuples(pgsql_result)) { RETURN_FALSE; } } else { pgsql_row = row; if (pgsql_row < 0 || pgsql_row >= PQntuples(pgsql_result)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Unable to jump to row %ld on PostgreSQL result index %ld"", row, Z_LVAL_P(result)); RETURN_FALSE; } } switch(Z_TYPE_PP(field)) { case IS_STRING: field_offset = PQfnumber(pgsql_result, Z_STRVAL_PP(field)); break; default: convert_to_long_ex(field); field_offset = Z_LVAL_PP(field); break; } if (field_offset<0 || field_offset>=PQnfields(pgsql_result)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Bad column offset specified""); RETURN_FALSE; } if (PQgetisnull(pgsql_result, pgsql_row, field_offset)) { Z_TYPE_P(return_value) = IS_NULL; } else { char *value = PQgetvalue(pgsql_result, pgsql_row, field_offset); int value_len = PQgetlength(pgsql_result, pgsql_row, field_offset); ZVAL_STRINGL(return_value, value, value_len, 1); } } /* }}} */ /* {{{ void php_pgsql_fetch_hash */ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, long result_type, int into_object) { zval *result, *zrow = NULL; PGresult *pgsql_result; pgsql_result_handle *pg_result; int i, num_fields, pgsql_row, use_row; long row = -1; char *field_name; zval *ctor_params = NULL; zend_class_entry *ce = NULL; if (into_object) { char *class_name = NULL; int class_name_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""r|z!sz"", &result, &zrow, &class_name, &class_name_len, &ctor_params) == FAILURE) { return; } if (!class_name) { ce = zend_standard_class_def; } else { ce = zend_fetch_class(class_name, class_name_len, ZEND_FETCH_CLASS_AUTO TSRMLS_CC); } if (!ce) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Could not find class '%s'"", class_name); return; } result_type = PGSQL_ASSOC; } else { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""r|z!l"", &result, &zrow, &result_type) == FAILURE) { return; } } if (zrow == NULL) { row = -1; } else { convert_to_long(zrow); row = Z_LVAL_P(zrow); if (row < 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""The row parameter must be greater or equal to zero""); RETURN_FALSE; } } use_row = ZEND_NUM_ARGS() > 1 && row != -1; if (!(result_type & PGSQL_BOTH)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Invalid result type""); RETURN_FALSE; } ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, &result, -1, ""PostgreSQL result"", le_result); pgsql_result = pg_result->result; if (use_row) { pgsql_row = row; pg_result->row = pgsql_row; if (pgsql_row < 0 || pgsql_row >= PQntuples(pgsql_result)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Unable to jump to row %ld on PostgreSQL result index %ld"", row, Z_LVAL_P(result)); RETURN_FALSE; } } else { /* If 2nd param is NULL, use internal row counter to access next row */ pgsql_row = pg_result->row; if (pgsql_row < 0 || pgsql_row >= PQntuples(pgsql_result)) { RETURN_FALSE; } pg_result->row++; } array_init(return_value); for (i = 0, num_fields = PQnfields(pgsql_result); i < num_fields; i++) { if (PQgetisnull(pgsql_result, pgsql_row, i)) { if (result_type & PGSQL_NUM) { add_index_null(return_value, i); } if (result_type & PGSQL_ASSOC) { field_name = PQfname(pgsql_result, i); add_assoc_null(return_value, field_name); } } else { char *element = PQgetvalue(pgsql_result, pgsql_row, i); if (element) { char *data; int data_len; int should_copy=0; const uint element_len = strlen(element); data = safe_estrndup(element, element_len); data_len = element_len; if (result_type & PGSQL_NUM) { add_index_stringl(return_value, i, data, data_len, should_copy); should_copy=1; } if (result_type & PGSQL_ASSOC) { field_name = PQfname(pgsql_result, i); add_assoc_stringl(return_value, field_name, data, data_len, should_copy); } } } } if (into_object) { zval dataset = *return_value; zend_fcall_info fci; zend_fcall_info_cache fcc; zval *retval_ptr; object_and_properties_init(return_value, ce, NULL); zend_merge_properties(return_value, Z_ARRVAL(dataset), 1 TSRMLS_CC); if (ce->constructor) { fci.size = sizeof(fci); fci.function_table = &ce->function_table; fci.function_name = NULL; fci.symbol_table = NULL; fci.object_ptr = return_value; fci.retval_ptr_ptr = &retval_ptr; if (ctor_params && Z_TYPE_P(ctor_params) != IS_NULL) { if (Z_TYPE_P(ctor_params) == IS_ARRAY) { HashTable *ht = Z_ARRVAL_P(ctor_params); Bucket *p; fci.param_count = 0; fci.params = safe_emalloc(sizeof(zval***), ht->nNumOfElements, 0); p = ht->pListHead; while (p != NULL) { fci.params[fci.param_count++] = (zval**)p->pData; p = p->pListNext; } } else { /* Two problems why we throw exceptions here: PHP is typeless * and hence passing one argument that's not an array could be * by mistake and the other way round is possible, too. The * single value is an array. Also we'd have to make that one * argument passed by reference. */ zend_throw_exception(zend_exception_get_default(TSRMLS_C), ""Parameter ctor_params must be an array"", 0 TSRMLS_CC); return; } } else { fci.param_count = 0; fci.params = NULL; } fci.no_separation = 1; fcc.initialized = 1; fcc.function_handler = ce->constructor; fcc.calling_scope = EG(scope); fcc.called_scope = Z_OBJCE_P(return_value); fcc.object_ptr = return_value; if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) { zend_throw_exception_ex(zend_exception_get_default(TSRMLS_C), 0 TSRMLS_CC, ""Could not execute %s::%s()"", ce->name, ce->constructor->common.function_name); } else { if (retval_ptr) { zval_ptr_dtor(&retval_ptr); } } if (fci.params) { efree(fci.params); } } else if (ctor_params) { zend_throw_exception_ex(zend_exception_get_default(TSRMLS_C), 0 TSRMLS_CC, ""Class %s does not have a constructor hence you cannot use ctor_params"", ce->name); } } } /* }}} */ /* {{{ proto array pg_fetch_row(resource result [, int row [, int result_type]]) Get a row as an enumerated array */ PHP_FUNCTION(pg_fetch_row) { php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, PGSQL_NUM, 0); } /* }}} */ /* {{{ proto array pg_fetch_assoc(resource result [, int row]) Fetch a row as an assoc array */ PHP_FUNCTION(pg_fetch_assoc) { /* pg_fetch_assoc() is added from PHP 4.3.0. It should raise error, when there is 3rd parameter */ if (ZEND_NUM_ARGS() > 2) WRONG_PARAM_COUNT; php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, PGSQL_ASSOC, 0); } /* }}} */ /* {{{ proto array pg_fetch_array(resource result [, int row [, int result_type]]) Fetch a row as an array */ PHP_FUNCTION(pg_fetch_array) { php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, PGSQL_BOTH, 0); } /* }}} */ /* {{{ proto object pg_fetch_object(resource result [, int row [, string class_name [, NULL|array ctor_params]]]) Fetch a row as an object */ PHP_FUNCTION(pg_fetch_object) { /* pg_fetch_object() allowed result_type used to be. 3rd parameter must be allowed for compatibility */ php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, PGSQL_ASSOC, 1); } /* }}} */ /* {{{ proto array pg_fetch_all(resource result) Fetch all rows into array */ PHP_FUNCTION(pg_fetch_all) { zval *result; PGresult *pgsql_result; pgsql_result_handle *pg_result; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""r"", &result) == FAILURE) { return; } ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, &result, -1, ""PostgreSQL result"", le_result); pgsql_result = pg_result->result; array_init(return_value); if (php_pgsql_result2array(pgsql_result, return_value TSRMLS_CC) == FAILURE) { zval_dtor(return_value); RETURN_FALSE; } } /* }}} */ /* {{{ proto array pg_fetch_all_columns(resource result [, int column_number]) Fetch all rows into array */ PHP_FUNCTION(pg_fetch_all_columns) { zval *result; PGresult *pgsql_result; pgsql_result_handle *pg_result; unsigned long colno=0; int pg_numrows, pg_row; size_t num_fields; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""r|l"", &result, &colno) == FAILURE) { RETURN_FALSE; } ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, &result, -1, ""PostgreSQL result"", le_result); pgsql_result = pg_result->result; num_fields = PQnfields(pgsql_result); if (colno >= num_fields || colno < 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Invalid column number '%ld'"", colno); RETURN_FALSE; } array_init(return_value); if ((pg_numrows = PQntuples(pgsql_result)) <= 0) { return; } for (pg_row = 0; pg_row < pg_numrows; pg_row++) { if (PQgetisnull(pgsql_result, pg_row, colno)) { add_next_index_null(return_value); } else { add_next_index_string(return_value, PQgetvalue(pgsql_result, pg_row, colno), 1); } } } /* }}} */ /* {{{ proto bool pg_result_seek(resource result, int offset) Set internal row offset */ PHP_FUNCTION(pg_result_seek) { zval *result; long row; pgsql_result_handle *pg_result; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""rl"", &result, &row) == FAILURE) { return; } ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, &result, -1, ""PostgreSQL result"", le_result); if (row < 0 || row >= PQntuples(pg_result->result)) { RETURN_FALSE; } /* seek to offset */ pg_result->row = row; RETURN_TRUE; } /* }}} */ #define PHP_PG_DATA_LENGTH 1 #define PHP_PG_DATA_ISNULL 2 /* {{{ php_pgsql_data_info */ static void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) { zval *result, **field; long row; PGresult *pgsql_result; pgsql_result_handle *pg_result; int field_offset, pgsql_row, argc = ZEND_NUM_ARGS(); if (argc == 2) { if (zend_parse_parameters(argc TSRMLS_CC, ""rZ"", &result, &field) == FAILURE) { return; } } else { if (zend_parse_parameters(argc TSRMLS_CC, ""rlZ"", &result, &row, &field) == FAILURE) { return; } } ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, &result, -1, ""PostgreSQL result"", le_result); pgsql_result = pg_result->result; if (argc == 2) { if (pg_result->row < 0) { pg_result->row = 0; } pgsql_row = pg_result->row; if (pgsql_row < 0 || pgsql_row >= PQntuples(pgsql_result)) { RETURN_FALSE; } } else { pgsql_row = row; if (pgsql_row < 0 || pgsql_row >= PQntuples(pgsql_result)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Unable to jump to row %ld on PostgreSQL result index %ld"", row, Z_LVAL_P(result)); RETURN_FALSE; } } switch(Z_TYPE_PP(field)) { case IS_STRING: convert_to_string_ex(field); field_offset = PQfnumber(pgsql_result, Z_STRVAL_PP(field)); break; default: convert_to_long_ex(field); field_offset = Z_LVAL_PP(field); break; } if (field_offset < 0 || field_offset >= PQnfields(pgsql_result)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Bad column offset specified""); RETURN_FALSE; } switch (entry_type) { case PHP_PG_DATA_LENGTH: Z_LVAL_P(return_value) = PQgetlength(pgsql_result, pgsql_row, field_offset); break; case PHP_PG_DATA_ISNULL: Z_LVAL_P(return_value) = PQgetisnull(pgsql_result, pgsql_row, field_offset); break; } Z_TYPE_P(return_value) = IS_LONG; } /* }}} */ /* {{{ proto int pg_field_prtlen(resource result, [int row,] mixed field_name_or_number) Returns the printed length */ PHP_FUNCTION(pg_field_prtlen) { php_pgsql_data_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_PG_DATA_LENGTH); } /* }}} */ /* {{{ proto int pg_field_is_null(resource result, [int row,] mixed field_name_or_number) Test if a field is NULL */ PHP_FUNCTION(pg_field_is_null) { php_pgsql_data_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_PG_DATA_ISNULL); } /* }}} */ /* {{{ proto bool pg_free_result(resource result) Free result memory */ PHP_FUNCTION(pg_free_result) { zval *result; pgsql_result_handle *pg_result; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""r"", &result) == FAILURE) { return; } ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, &result, -1, ""PostgreSQL result"", le_result); if (Z_LVAL_P(result) == 0) { RETURN_FALSE; } zend_list_delete(Z_RESVAL_P(result)); RETURN_TRUE; } /* }}} */ /* {{{ proto string pg_last_oid(resource result) Returns the last object identifier */ PHP_FUNCTION(pg_last_oid) { zval *result; PGresult *pgsql_result; pgsql_result_handle *pg_result; #ifdef HAVE_PQOIDVALUE Oid oid; #endif if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""r"", &result) == FAILURE) { return; } ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, &result, -1, ""PostgreSQL result"", le_result); pgsql_result = pg_result->result; #ifdef HAVE_PQOIDVALUE oid = PQoidValue(pgsql_result); if (oid == InvalidOid) { RETURN_FALSE; } PGSQL_RETURN_OID(oid); #else Z_STRVAL_P(return_value) = (char *) PQoidStatus(pgsql_result); if (Z_STRVAL_P(return_value)) { RETURN_STRING(Z_STRVAL_P(return_value), 1); } RETURN_STRING("""", 1); #endif } /* }}} */ /* {{{ proto bool pg_trace(string filename [, string mode [, resource connection]]) Enable tracing a PostgreSQL connection */ PHP_FUNCTION(pg_trace) { char *z_filename, *mode = ""w""; int z_filename_len, mode_len; zval *pgsql_link = NULL; int id = -1, argc = ZEND_NUM_ARGS(); PGconn *pgsql; FILE *fp = NULL; php_stream *stream; id = PGG(default_link); if (zend_parse_parameters(argc TSRMLS_CC, ""s|sr"", &z_filename, &z_filename_len, &mode, &mode_len, &pgsql_link) == FAILURE) { return; } if (argc < 3) { CHECK_DEFAULT_LINK(id); } if (pgsql_link == NULL && id == -1) { RETURN_FALSE; } ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, ""PostgreSQL link"", le_link, le_plink); stream = php_stream_open_wrapper(z_filename, mode, REPORT_ERRORS, NULL); if (!stream) { RETURN_FALSE; } if (FAILURE == php_stream_cast(stream, PHP_STREAM_AS_STDIO, (void**)&fp, REPORT_ERRORS)) { php_stream_close(stream); RETURN_FALSE; } php_stream_auto_cleanup(stream); PQtrace(pgsql, fp); RETURN_TRUE; } /* }}} */ /* {{{ proto bool pg_untrace([resource connection]) Disable tracing of a PostgreSQL connection */ PHP_FUNCTION(pg_untrace) { zval *pgsql_link = NULL; int id = -1, argc = ZEND_NUM_ARGS(); PGconn *pgsql; if (zend_parse_parameters(argc TSRMLS_CC, ""|r"", &pgsql_link) == FAILURE) { return; } if (argc == 0) { id = PGG(default_link); CHECK_DEFAULT_LINK(id); } if (pgsql_link == NULL && id == -1) { RETURN_FALSE; } ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, ""PostgreSQL link"", le_link, le_plink); PQuntrace(pgsql); RETURN_TRUE; } /* }}} */ /* {{{ proto mixed pg_lo_create([resource connection],[mixed large_object_oid]) Create a large object */ PHP_FUNCTION(pg_lo_create) { zval *pgsql_link = NULL, *oid = NULL; PGconn *pgsql; Oid pgsql_oid, wanted_oid = InvalidOid; int id = -1, argc = ZEND_NUM_ARGS(); if (zend_parse_parameters(argc TSRMLS_CC, ""|zz"", &pgsql_link, &oid) == FAILURE) { return; } if ((argc == 1) && (Z_TYPE_P(pgsql_link) != IS_RESOURCE)) { oid = pgsql_link; pgsql_link = NULL; } if (pgsql_link == NULL) { id = PGG(default_link); CHECK_DEFAULT_LINK(id); if (id == -1) { RETURN_FALSE; } } ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, ""PostgreSQL link"", le_link, le_plink); if (oid) { #ifndef HAVE_PG_LO_CREATE php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Passing OID value is not supported. Upgrade your PostgreSQL""); #else switch (Z_TYPE_P(oid)) { case IS_STRING: { char *end_ptr; wanted_oid = (Oid)strtoul(Z_STRVAL_P(oid), &end_ptr, 10); if ((Z_STRVAL_P(oid)+Z_STRLEN_P(oid)) != end_ptr) { /* wrong integer format */ php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""invalid OID value passed""); RETURN_FALSE; } } break; case IS_LONG: if (Z_LVAL_P(oid) < (long)InvalidOid) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""invalid OID value passed""); RETURN_FALSE; } wanted_oid = (Oid)Z_LVAL_P(oid); break; default: php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""invalid OID value passed""); RETURN_FALSE; } if ((pgsql_oid = lo_create(pgsql, wanted_oid)) == InvalidOid) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Unable to create PostgreSQL large object""); RETURN_FALSE; } PGSQL_RETURN_OID(pgsql_oid); #endif } if ((pgsql_oid = lo_creat(pgsql, INV_READ|INV_WRITE)) == InvalidOid) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Unable to create PostgreSQL large object""); RETURN_FALSE; } PGSQL_RETURN_OID(pgsql_oid); } /* }}} */ /* {{{ proto bool pg_lo_unlink([resource connection,] string large_object_oid) Delete a large object */ PHP_FUNCTION(pg_lo_unlink) { zval *pgsql_link = NULL; long oid_long; char *oid_string, *end_ptr; int oid_strlen; PGconn *pgsql; Oid oid; int id = -1; int argc = ZEND_NUM_ARGS(); /* accept string type since Oid type is unsigned int */ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, ""rs"", &pgsql_link, &oid_string, &oid_strlen) == SUCCESS) { oid = (Oid)strtoul(oid_string, &end_ptr, 10); if ((oid_string+oid_strlen) != end_ptr) { /* wrong integer format */ php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Wrong OID value passed""); RETURN_FALSE; } } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, ""rl"", &pgsql_link, &oid_long) == SUCCESS) { if (oid_long <= InvalidOid) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Invalid OID specified""); RETURN_FALSE; } oid = (Oid)oid_long; } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, ""s"", &oid_string, &oid_strlen) == SUCCESS) { oid = (Oid)strtoul(oid_string, &end_ptr, 10); if ((oid_string+oid_strlen) != end_ptr) { /* wrong integer format */ php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Wrong OID value passed""); RETURN_FALSE; } id = PGG(default_link); CHECK_DEFAULT_LINK(id); } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, ""l"", &oid_long) == SUCCESS) { if (oid_long <= InvalidOid) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Invalid OID is specified""); RETURN_FALSE; } oid = (Oid)oid_long; id = PGG(default_link); CHECK_DEFAULT_LINK(id); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Requires 1 or 2 arguments""); RETURN_FALSE; } if (pgsql_link == NULL && id == -1) { RETURN_FALSE; } ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, ""PostgreSQL link"", le_link, le_plink); if (lo_unlink(pgsql, oid) == -1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Unable to delete PostgreSQL large object %u"", oid); RETURN_FALSE; } RETURN_TRUE; } /* }}} */ /* {{{ proto resource pg_lo_open([resource connection,] int large_object_oid, string mode) Open a large object and return fd */ PHP_FUNCTION(pg_lo_open) { zval *pgsql_link = NULL; long oid_long; char *oid_string, *end_ptr, *mode_string; int oid_strlen, mode_strlen; PGconn *pgsql; Oid oid; int id = -1, pgsql_mode=0, pgsql_lofd; int create=0; pgLofp *pgsql_lofp; int argc = ZEND_NUM_ARGS(); /* accept string type since Oid is unsigned int */ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, ""rss"", &pgsql_link, &oid_string, &oid_strlen, &mode_string, &mode_strlen) == SUCCESS) { oid = (Oid)strtoul(oid_string, &end_ptr, 10); if ((oid_string+oid_strlen) != end_ptr) { /* wrong integer format */ php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Wrong OID value passed""); RETURN_FALSE; } } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, ""rls"", &pgsql_link, &oid_long, &mode_string, &mode_strlen) == SUCCESS) { if (oid_long <= InvalidOid) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Invalid OID specified""); RETURN_FALSE; } oid = (Oid)oid_long; } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, ""ss"", &oid_string, &oid_strlen, &mode_string, &mode_strlen) == SUCCESS) { oid = (Oid)strtoul(oid_string, &end_ptr, 10); if ((oid_string+oid_strlen) != end_ptr) { /* wrong integer format */ php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Wrong OID value passed""); RETURN_FALSE; } id = PGG(default_link); CHECK_DEFAULT_LINK(id); } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, ""ls"", &oid_long, &mode_string, &mode_strlen) == SUCCESS) { if (oid_long <= InvalidOid) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Invalid OID specified""); RETURN_FALSE; } oid = (Oid)oid_long; id = PGG(default_link); CHECK_DEFAULT_LINK(id); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Requires 1 or 2 arguments""); RETURN_FALSE; } if (pgsql_link == NULL && id == -1) { RETURN_FALSE; } ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, ""PostgreSQL link"", le_link, le_plink); /* r/w/+ is little bit more PHP-like than INV_READ/INV_WRITE and a lot of faster to type. Unfortunately, doesn't behave the same way as fopen()... (Jouni) */ if (strchr(mode_string, 'r') == mode_string) { pgsql_mode |= INV_READ; if (strchr(mode_string, '+') == mode_string+1) { pgsql_mode |= INV_WRITE; } } if (strchr(mode_string, 'w') == mode_string) { pgsql_mode |= INV_WRITE; create = 1; if (strchr(mode_string, '+') == mode_string+1) { pgsql_mode |= INV_READ; } } pgsql_lofp = (pgLofp *) emalloc(sizeof(pgLofp)); if ((pgsql_lofd = lo_open(pgsql, oid, pgsql_mode)) == -1) { if (create) { if ((oid = lo_creat(pgsql, INV_READ|INV_WRITE)) == 0) { efree(pgsql_lofp); php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Unable to create PostgreSQL large object""); RETURN_FALSE; } else { if ((pgsql_lofd = lo_open(pgsql, oid, pgsql_mode)) == -1) { if (lo_unlink(pgsql, oid) == -1) { efree(pgsql_lofp); php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Something is really messed up! Your database is badly corrupted in a way NOT related to PHP""); RETURN_FALSE; } efree(pgsql_lofp); php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Unable to open PostgreSQL large object""); RETURN_FALSE; } else { pgsql_lofp->conn = pgsql; pgsql_lofp->lofd = pgsql_lofd; Z_LVAL_P(return_value) = zend_list_insert(pgsql_lofp, le_lofp TSRMLS_CC); Z_TYPE_P(return_value) = IS_LONG; } } } else { efree(pgsql_lofp); php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Unable to open PostgreSQL large object""); RETURN_FALSE; } } else { pgsql_lofp->conn = pgsql; pgsql_lofp->lofd = pgsql_lofd; ZEND_REGISTER_RESOURCE(return_value, pgsql_lofp, le_lofp); } } /* }}} */ /* {{{ proto bool pg_lo_close(resource large_object) Close a large object */ PHP_FUNCTION(pg_lo_close) { zval *pgsql_lofp; pgLofp *pgsql; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""r"", &pgsql_lofp) == FAILURE) { return; } ZEND_FETCH_RESOURCE(pgsql, pgLofp *, &pgsql_lofp, -1, ""PostgreSQL large object"", le_lofp); if (lo_close((PGconn *)pgsql->conn, pgsql->lofd) < 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Unable to close PostgreSQL large object descriptor %d"", pgsql->lofd); RETVAL_FALSE; } else { RETVAL_TRUE; } zend_list_delete(Z_RESVAL_P(pgsql_lofp)); return; } /* }}} */ #define PGSQL_LO_READ_BUF_SIZE 8192 /* {{{ proto string pg_lo_read(resource large_object [, int len]) Read a large object */ PHP_FUNCTION(pg_lo_read) { zval *pgsql_id; long len; int buf_len = PGSQL_LO_READ_BUF_SIZE, nbytes, argc = ZEND_NUM_ARGS(); char *buf; pgLofp *pgsql; if (zend_parse_parameters(argc TSRMLS_CC, ""r|l"", &pgsql_id, &len) == FAILURE) { return; } ZEND_FETCH_RESOURCE(pgsql, pgLofp *, &pgsql_id, -1, ""PostgreSQL large object"", le_lofp); if (argc > 1) { buf_len = len; } buf = (char *) safe_emalloc(sizeof(char), (buf_len+1), 0); if ((nbytes = lo_read((PGconn *)pgsql->conn, pgsql->lofd, buf, buf_len))<0) { efree(buf); RETURN_FALSE; } buf[nbytes] = '\0'; RETURN_STRINGL(buf, nbytes, 0); } /* }}} */ /* {{{ proto int pg_lo_write(resource large_object, string buf [, int len]) Write a large object */ PHP_FUNCTION(pg_lo_write) { zval *pgsql_id; char *str; long z_len; int str_len, nbytes; int len; pgLofp *pgsql; int argc = ZEND_NUM_ARGS(); if (zend_parse_parameters(argc TSRMLS_CC, ""rs|l"", &pgsql_id, &str, &str_len, &z_len) == FAILURE) { return; } if (argc > 2) { if (z_len > str_len) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Cannot write more than buffer size %d. Tried to write %ld"", str_len, z_len); RETURN_FALSE; } if (z_len < 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Buffer size must be larger than 0, but %ld was specified"", z_len); RETURN_FALSE; } len = z_len; } else { len = str_len; } ZEND_FETCH_RESOURCE(pgsql, pgLofp *, &pgsql_id, -1, ""PostgreSQL large object"", le_lofp); if ((nbytes = lo_write((PGconn *)pgsql->conn, pgsql->lofd, str, len)) == -1) { RETURN_FALSE; } RETURN_LONG(nbytes); } /* }}} */ /* {{{ proto int pg_lo_read_all(resource large_object) Read a large object and send straight to browser */ PHP_FUNCTION(pg_lo_read_all) { zval *pgsql_id; int tbytes; volatile int nbytes; char buf[PGSQL_LO_READ_BUF_SIZE]; pgLofp *pgsql; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""r"", &pgsql_id) == FAILURE) { return; } ZEND_FETCH_RESOURCE(pgsql, pgLofp *, &pgsql_id, -1, ""PostgreSQL large object"", le_lofp); tbytes = 0; while ((nbytes = lo_read((PGconn *)pgsql->conn, pgsql->lofd, buf, PGSQL_LO_READ_BUF_SIZE))>0) { PHPWRITE(buf, nbytes); tbytes += nbytes; } RETURN_LONG(tbytes); } /* }}} */ /* {{{ proto int pg_lo_import([resource connection, ] string filename [, mixed oid]) Import large object direct from filesystem */ PHP_FUNCTION(pg_lo_import) { zval *pgsql_link = NULL, *oid = NULL; char *file_in; int id = -1, name_len; int argc = ZEND_NUM_ARGS(); PGconn *pgsql; Oid returned_oid; if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, ""rp|z"", &pgsql_link, &file_in, &name_len, &oid) == SUCCESS) { ; } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, ""p|z"", &file_in, &name_len, &oid) == SUCCESS) { id = PGG(default_link); CHECK_DEFAULT_LINK(id); } /* old calling convention, deprecated since PHP 4.2 */ else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, ""pr"", &file_in, &name_len, &pgsql_link ) == SUCCESS) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Old API is used""); } else { WRONG_PARAM_COUNT; } if (php_check_open_basedir(file_in TSRMLS_CC)) { RETURN_FALSE; } if (pgsql_link == NULL && id == -1) { RETURN_FALSE; } ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, ""PostgreSQL link"", le_link, le_plink); if (oid) { #ifndef HAVE_PG_LO_IMPORT_WITH_OID php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""OID value passing not supported""); #else Oid wanted_oid; switch (Z_TYPE_P(oid)) { case IS_STRING: { char *end_ptr; wanted_oid = (Oid)strtoul(Z_STRVAL_P(oid), &end_ptr, 10); if ((Z_STRVAL_P(oid)+Z_STRLEN_P(oid)) != end_ptr) { /* wrong integer format */ php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""invalid OID value passed""); RETURN_FALSE; } } break; case IS_LONG: if (Z_LVAL_P(oid) < (long)InvalidOid) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""invalid OID value passed""); RETURN_FALSE; } wanted_oid = (Oid)Z_LVAL_P(oid); break; default: php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""invalid OID value passed""); RETURN_FALSE; } returned_oid = lo_import_with_oid(pgsql, file_in, wanted_oid); if (returned_oid == InvalidOid) { RETURN_FALSE; } PGSQL_RETURN_OID(returned_oid); #endif } returned_oid = lo_import(pgsql, file_in); if (returned_oid == InvalidOid) { RETURN_FALSE; } PGSQL_RETURN_OID(returned_oid); } /* }}} */ /* {{{ proto bool pg_lo_export([resource connection, ] int objoid, string filename) Export large object direct to filesystem */ PHP_FUNCTION(pg_lo_export) { zval *pgsql_link = NULL; char *file_out, *oid_string, *end_ptr; int oid_strlen; int id = -1, name_len; long oid_long; Oid oid; PGconn *pgsql; int argc = ZEND_NUM_ARGS(); /* allow string to handle large OID value correctly */ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, ""rlp"", &pgsql_link, &oid_long, &file_out, &name_len) == SUCCESS) { if (oid_long <= InvalidOid) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Invalid OID specified""); RETURN_FALSE; } oid = (Oid)oid_long; } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, ""rss"", &pgsql_link, &oid_string, &oid_strlen, &file_out, &name_len) == SUCCESS) { oid = (Oid)strtoul(oid_string, &end_ptr, 10); if ((oid_string+oid_strlen) != end_ptr) { /* wrong integer format */ php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Wrong OID value passed""); RETURN_FALSE; } } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, ""lp"", &oid_long, &file_out, &name_len) == SUCCESS) { if (oid_long <= InvalidOid) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Invalid OID specified""); RETURN_FALSE; } oid = (Oid)oid_long; id = PGG(default_link); CHECK_DEFAULT_LINK(id); } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, ""sp"", &oid_string, &oid_strlen, &file_out, &name_len) == SUCCESS) { oid = (Oid)strtoul(oid_string, &end_ptr, 10); if ((oid_string+oid_strlen) != end_ptr) { /* wrong integer format */ php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Wrong OID value passed""); RETURN_FALSE; } id = PGG(default_link); CHECK_DEFAULT_LINK(id); } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, ""spr"", &oid_string, &oid_strlen, &file_out, &name_len, &pgsql_link) == SUCCESS) { oid = (Oid)strtoul(oid_string, &end_ptr, 10); if ((oid_string+oid_strlen) != end_ptr) { /* wrong integer format */ php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Wrong OID value passed""); RETURN_FALSE; } } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, ""lpr"", &oid_long, &file_out, &name_len, &pgsql_link) == SUCCESS) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Old API is used""); if (oid_long <= InvalidOid) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Invalid OID specified""); RETURN_FALSE; } oid = (Oid)oid_long; } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Requires 2 or 3 arguments""); RETURN_FALSE; } if (php_check_open_basedir(file_out TSRMLS_CC)) { RETURN_FALSE; } if (pgsql_link == NULL && id == -1) { RETURN_FALSE; } ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, ""PostgreSQL link"", le_link, le_plink); if (lo_export(pgsql, oid, file_out)) { RETURN_TRUE; } RETURN_FALSE; } /* }}} */ /* {{{ proto bool pg_lo_seek(resource large_object, int offset [, int whence]) Seeks position of large object */ PHP_FUNCTION(pg_lo_seek) { zval *pgsql_id = NULL; long offset = 0, whence = SEEK_CUR; pgLofp *pgsql; int argc = ZEND_NUM_ARGS(); if (zend_parse_parameters(argc TSRMLS_CC, ""rl|l"", &pgsql_id, &offset, &whence) == FAILURE) { return; } if (whence != SEEK_SET && whence != SEEK_CUR && whence != SEEK_END) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Invalid whence parameter""); return; } ZEND_FETCH_RESOURCE(pgsql, pgLofp *, &pgsql_id, -1, ""PostgreSQL large object"", le_lofp); if (lo_lseek((PGconn *)pgsql->conn, pgsql->lofd, offset, whence) > -1) { RETURN_TRUE; } else { RETURN_FALSE; } } /* }}} */ /* {{{ proto int pg_lo_tell(resource large_object) Returns current position of large object */ PHP_FUNCTION(pg_lo_tell) { zval *pgsql_id = NULL; int offset = 0; pgLofp *pgsql; int argc = ZEND_NUM_ARGS(); if (zend_parse_parameters(argc TSRMLS_CC, ""r"", &pgsql_id) == FAILURE) { return; } ZEND_FETCH_RESOURCE(pgsql, pgLofp *, &pgsql_id, -1, ""PostgreSQL large object"", le_lofp); offset = lo_tell((PGconn *)pgsql->conn, pgsql->lofd); RETURN_LONG(offset); } /* }}} */ #if HAVE_PQSETERRORVERBOSITY /* {{{ proto int pg_set_error_verbosity([resource connection,] int verbosity) Set error verbosity */ PHP_FUNCTION(pg_set_error_verbosity) { zval *pgsql_link = NULL; long verbosity; int id = -1, argc = ZEND_NUM_ARGS(); PGconn *pgsql; if (argc == 1) { if (zend_parse_parameters(argc TSRMLS_CC, ""l"", &verbosity) == FAILURE) { return; } id = PGG(default_link); CHECK_DEFAULT_LINK(id); } else { if (zend_parse_parameters(argc TSRMLS_CC, ""rl"", &pgsql_link, &verbosity) == FAILURE) { return; } } if (pgsql_link == NULL && id == -1) { RETURN_FALSE; } ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, ""PostgreSQL link"", le_link, le_plink); if (verbosity & (PQERRORS_TERSE|PQERRORS_DEFAULT|PQERRORS_VERBOSE)) { Z_LVAL_P(return_value) = PQsetErrorVerbosity(pgsql, verbosity); Z_TYPE_P(return_value) = IS_LONG; } else { RETURN_FALSE; } } /* }}} */ #endif #ifdef HAVE_PQCLIENTENCODING /* {{{ proto int pg_set_client_encoding([resource connection,] string encoding) Set client encoding */ PHP_FUNCTION(pg_set_client_encoding) { char *encoding; int encoding_len; zval *pgsql_link = NULL; int id = -1, argc = ZEND_NUM_ARGS(); PGconn *pgsql; if (argc == 1) { if (zend_parse_parameters(argc TSRMLS_CC, ""s"", &encoding, &encoding_len) == FAILURE) { return; } id = PGG(default_link); CHECK_DEFAULT_LINK(id); } else { if (zend_parse_parameters(argc TSRMLS_CC, ""rs"", &pgsql_link, &encoding, &encoding_len) == FAILURE) { return; } } if (pgsql_link == NULL && id == -1) { RETURN_FALSE; } ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, ""PostgreSQL link"", le_link, le_plink); Z_LVAL_P(return_value) = PQsetClientEncoding(pgsql, encoding); Z_TYPE_P(return_value) = IS_LONG; } /* }}} */ /* {{{ proto string pg_client_encoding([resource connection]) Get the current client encoding */ PHP_FUNCTION(pg_client_encoding) { zval *pgsql_link = NULL; int id = -1, argc = ZEND_NUM_ARGS(); PGconn *pgsql; if (zend_parse_parameters(argc TSRMLS_CC, ""|r"", &pgsql_link) == FAILURE) { return; } if (argc == 0) { id = PGG(default_link); CHECK_DEFAULT_LINK(id); } if (pgsql_link == NULL && id == -1) { RETURN_FALSE; } ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, ""PostgreSQL link"", le_link, le_plink); /* Just do the same as found in PostgreSQL sources... */ Z_STRVAL_P(return_value) = (char *) pg_encoding_to_char(PQclientEncoding(pgsql)); Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value)); Z_STRVAL_P(return_value) = (char *) estrdup(Z_STRVAL_P(return_value)); Z_TYPE_P(return_value) = IS_STRING; } /* }}} */ #endif #if !HAVE_PQGETCOPYDATA #define COPYBUFSIZ 8192 #endif /* {{{ proto bool pg_end_copy([resource connection]) Sync with backend. Completes the Copy command */ PHP_FUNCTION(pg_end_copy) { zval *pgsql_link = NULL; int id = -1, argc = ZEND_NUM_ARGS(); PGconn *pgsql; int result = 0; if (zend_parse_parameters(argc TSRMLS_CC, ""|r"", &pgsql_link) == FAILURE) { return; } if (argc == 0) { id = PGG(default_link); CHECK_DEFAULT_LINK(id); } if (pgsql_link == NULL && id == -1) { RETURN_FALSE; } ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, ""PostgreSQL link"", le_link, le_plink); result = PQendcopy(pgsql); if (result!=0) { PHP_PQ_ERROR(""Query failed: %s"", pgsql); RETURN_FALSE; } RETURN_TRUE; } /* }}} */ /* {{{ proto bool pg_put_line([resource connection,] string query) Send null-terminated string to backend server*/ PHP_FUNCTION(pg_put_line) { char *query; zval *pgsql_link = NULL; int query_len, id = -1; PGconn *pgsql; int result = 0, argc = ZEND_NUM_ARGS(); if (argc == 1) { if (zend_parse_parameters(argc TSRMLS_CC, ""s"", &query, &query_len) == FAILURE) { return; } id = PGG(default_link); CHECK_DEFAULT_LINK(id); } else { if (zend_parse_parameters(argc TSRMLS_CC, ""rs"", &pgsql_link, &query, &query_len) == FAILURE) { return; } } if (pgsql_link == NULL && id == -1) { RETURN_FALSE; } ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, ""PostgreSQL link"", le_link, le_plink); result = PQputline(pgsql, query); if (result==EOF) { PHP_PQ_ERROR(""Query failed: %s"", pgsql); RETURN_FALSE; } RETURN_TRUE; } /* }}} */ /* {{{ proto array pg_copy_to(resource connection, string table_name [, string delimiter [, string null_as]]) Copy table to array */ PHP_FUNCTION(pg_copy_to) { zval *pgsql_link; char *table_name, *pg_delim = NULL, *pg_null_as = NULL; int table_name_len, pg_delim_len, pg_null_as_len, free_pg_null = 0; char *query; int id = -1; PGconn *pgsql; PGresult *pgsql_result; ExecStatusType status; int copydone = 0; #if !HAVE_PQGETCOPYDATA char copybuf[COPYBUFSIZ]; #endif char *csv = (char *)NULL; int ret; int argc = ZEND_NUM_ARGS(); if (zend_parse_parameters(argc TSRMLS_CC, ""rs|ss"", &pgsql_link, &table_name, &table_name_len, &pg_delim, &pg_delim_len, &pg_null_as, &pg_null_as_len) == FAILURE) { return; } if (!pg_delim) { pg_delim = ""\t""; } ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, ""PostgreSQL link"", le_link, le_plink); if (!pg_null_as) { pg_null_as = safe_estrdup(""\\\\N""); free_pg_null = 1; } spprintf(&query, 0, ""COPY %s TO STDOUT DELIMITERS E'%c' WITH NULL AS E'%s'"", table_name, *pg_delim, pg_null_as); while ((pgsql_result = PQgetResult(pgsql))) { PQclear(pgsql_result); } pgsql_result = PQexec(pgsql, query); if (free_pg_null) { efree(pg_null_as); } efree(query); if (pgsql_result) { status = PQresultStatus(pgsql_result); } else { status = (ExecStatusType) PQstatus(pgsql); } switch (status) { case PGRES_COPY_OUT: if (pgsql_result) { PQclear(pgsql_result); array_init(return_value); #if HAVE_PQGETCOPYDATA while (!copydone) { ret = PQgetCopyData(pgsql, &csv, 0); switch (ret) { case -1: copydone = 1; break; case 0: case -2: PHP_PQ_ERROR(""getline failed: %s"", pgsql); RETURN_FALSE; break; default: add_next_index_string(return_value, csv, 1); PQfreemem(csv); break; } } #else while (!copydone) { if ((ret = PQgetline(pgsql, copybuf, COPYBUFSIZ))) { PHP_PQ_ERROR(""getline failed: %s"", pgsql); RETURN_FALSE; } if (copybuf[0] == '\\' && copybuf[1] == '.' && copybuf[2] == '\0') { copydone = 1; } else { if (csv == (char *)NULL) { csv = estrdup(copybuf); } else { csv = (char *)erealloc(csv, strlen(csv) + sizeof(char)*(COPYBUFSIZ+1)); strcat(csv, copybuf); } switch (ret) { case EOF: copydone = 1; case 0: add_next_index_string(return_value, csv, 1); efree(csv); csv = (char *)NULL; break; case 1: break; } } } if (PQendcopy(pgsql)) { PHP_PQ_ERROR(""endcopy failed: %s"", pgsql); RETURN_FALSE; } #endif while ((pgsql_result = PQgetResult(pgsql))) { PQclear(pgsql_result); } } else { PQclear(pgsql_result); RETURN_FALSE; } break; default: PQclear(pgsql_result); PHP_PQ_ERROR(""Copy command failed: %s"", pgsql); RETURN_FALSE; break; } } /* }}} */ /* {{{ proto bool pg_copy_from(resource connection, string table_name , array rows [, string delimiter [, string null_as]]) Copy table from array */ PHP_FUNCTION(pg_copy_from) { zval *pgsql_link = NULL, *pg_rows; zval **tmp; char *table_name, *pg_delim = NULL, *pg_null_as = NULL; int table_name_len, pg_delim_len, pg_null_as_len; int pg_null_as_free = 0; char *query; HashPosition pos; int id = -1; PGconn *pgsql; PGresult *pgsql_result; ExecStatusType status; int argc = ZEND_NUM_ARGS(); if (zend_parse_parameters(argc TSRMLS_CC, ""rsa|ss"", &pgsql_link, &table_name, &table_name_len, &pg_rows, &pg_delim, &pg_delim_len, &pg_null_as, &pg_null_as_len) == FAILURE) { return; } if (!pg_delim) { pg_delim = ""\t""; } if (!pg_null_as) { pg_null_as = safe_estrdup(""\\\\N""); pg_null_as_free = 1; } ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, ""PostgreSQL link"", le_link, le_plink); spprintf(&query, 0, ""COPY %s FROM STDIN DELIMITERS E'%c' WITH NULL AS E'%s'"", table_name, *pg_delim, pg_null_as); while ((pgsql_result = PQgetResult(pgsql))) { PQclear(pgsql_result); } pgsql_result = PQexec(pgsql, query); if (pg_null_as_free) { efree(pg_null_as); } efree(query); if (pgsql_result) { status = PQresultStatus(pgsql_result); } else { status = (ExecStatusType) PQstatus(pgsql); } switch (status) { case PGRES_COPY_IN: if (pgsql_result) { int command_failed = 0; PQclear(pgsql_result); zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(pg_rows), &pos); #if HAVE_PQPUTCOPYDATA while (zend_hash_get_current_data_ex(Z_ARRVAL_P(pg_rows), (void **) &tmp, &pos) == SUCCESS) { convert_to_string_ex(tmp); query = (char *)emalloc(Z_STRLEN_PP(tmp) + 2); strlcpy(query, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp) + 2); if(Z_STRLEN_PP(tmp) > 0 && *(query + Z_STRLEN_PP(tmp) - 1) != '\n') { strlcat(query, ""\n"", Z_STRLEN_PP(tmp) + 2); } if (PQputCopyData(pgsql, query, strlen(query)) != 1) { efree(query); PHP_PQ_ERROR(""copy failed: %s"", pgsql); RETURN_FALSE; } efree(query); zend_hash_move_forward_ex(Z_ARRVAL_P(pg_rows), &pos); } if (PQputCopyEnd(pgsql, NULL) != 1) { PHP_PQ_ERROR(""putcopyend failed: %s"", pgsql); RETURN_FALSE; } #else while (zend_hash_get_current_data_ex(Z_ARRVAL_P(pg_rows), (void **) &tmp, &pos) == SUCCESS) { convert_to_string_ex(tmp); query = (char *)emalloc(Z_STRLEN_PP(tmp) + 2); strlcpy(query, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp) + 2); if(Z_STRLEN_PP(tmp) > 0 && *(query + Z_STRLEN_PP(tmp) - 1) != '\n') { strlcat(query, ""\n"", Z_STRLEN_PP(tmp) + 2); } if (PQputline(pgsql, query)==EOF) { efree(query); PHP_PQ_ERROR(""copy failed: %s"", pgsql); RETURN_FALSE; } efree(query); zend_hash_move_forward_ex(Z_ARRVAL_P(pg_rows), &pos); } if (PQputline(pgsql, ""\\.\n"") == EOF) { PHP_PQ_ERROR(""putline failed: %s"", pgsql); RETURN_FALSE; } if (PQendcopy(pgsql)) { PHP_PQ_ERROR(""endcopy failed: %s"", pgsql); RETURN_FALSE; } #endif while ((pgsql_result = PQgetResult(pgsql))) { if (PGRES_COMMAND_OK != PQresultStatus(pgsql_result)) { PHP_PQ_ERROR(""Copy command failed: %s"", pgsql); command_failed = 1; } PQclear(pgsql_result); } if (command_failed) { RETURN_FALSE; } } else { PQclear(pgsql_result); RETURN_FALSE; } RETURN_TRUE; break; default: PQclear(pgsql_result); PHP_PQ_ERROR(""Copy command failed: %s"", pgsql); RETURN_FALSE; break; } } /* }}} */ #ifdef HAVE_PQESCAPE /* {{{ proto string pg_escape_string([resource connection,] string data) Escape string for text/char type */ PHP_FUNCTION(pg_escape_string) { char *from = NULL, *to = NULL; zval *pgsql_link; #ifdef HAVE_PQESCAPE_CONN PGconn *pgsql; #endif int to_len; int from_len; int id = -1; switch (ZEND_NUM_ARGS()) { case 1: if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""s"", &from, &from_len) == FAILURE) { return; } pgsql_link = NULL; id = PGG(default_link); break; default: if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""rs"", &pgsql_link, &from, &from_len) == FAILURE) { return; } break; } to = (char *) safe_emalloc(from_len, 2, 1); #ifdef HAVE_PQESCAPE_CONN if (pgsql_link != NULL || id != -1) { ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, ""PostgreSQL link"", le_link, le_plink); to_len = (int) PQescapeStringConn(pgsql, to, from, (size_t)from_len, NULL); } else #endif to_len = (int) PQescapeString(to, from, (size_t)from_len); RETURN_STRINGL(to, to_len, 0); } /* }}} */ /* {{{ proto string pg_escape_bytea([resource connection,] string data) Escape binary for bytea type */ PHP_FUNCTION(pg_escape_bytea) { char *from = NULL, *to = NULL; size_t to_len; int from_len, id = -1; #ifdef HAVE_PQESCAPE_BYTEA_CONN PGconn *pgsql; #endif zval *pgsql_link; switch (ZEND_NUM_ARGS()) { case 1: if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""s"", &from, &from_len) == FAILURE) { return; } pgsql_link = NULL; id = PGG(default_link); break; default: if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""rs"", &pgsql_link, &from, &from_len) == FAILURE) { return; } break; } #ifdef HAVE_PQESCAPE_BYTEA_CONN if (pgsql_link != NULL || id != -1) { ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, ""PostgreSQL link"", le_link, le_plink); to = (char *)PQescapeByteaConn(pgsql, (unsigned char *)from, (size_t)from_len, &to_len); } else #endif to = (char *)PQescapeBytea((unsigned char*)from, from_len, &to_len); RETVAL_STRINGL(to, to_len-1, 1); /* to_len includes addtional '\0' */ PQfreemem(to); } /* }}} */ #if !HAVE_PQUNESCAPEBYTEA /* PQunescapeBytea() from PostgreSQL 7.3 to provide bytea unescape feature to 7.2 users. Renamed to php_pgsql_unescape_bytea() */ /* * PQunescapeBytea - converts the null terminated string representation * of a bytea, strtext, into binary, filling a buffer. It returns a * pointer to the buffer which is NULL on error, and the size of the * buffer in retbuflen. The pointer may subsequently be used as an * argument to the function free(3). It is the reverse of PQescapeBytea. * * The following transformations are reversed: * '\0' == ASCII 0 == \000 * '\'' == ASCII 39 == \' * '\\' == ASCII 92 == \\ * * States: * 0 normal 0->1->2->3->4 * 1 \ 1->5 * 2 \0 1->6 * 3 \00 * 4 \000 * 5 \' * 6 \\ */ static unsigned char * php_pgsql_unescape_bytea(unsigned char *strtext, size_t *retbuflen) { size_t buflen; unsigned char *buffer, *sp, *bp; unsigned int state = 0; if (strtext == NULL) return NULL; buflen = strlen(strtext); /* will shrink, also we discover if * strtext */ buffer = (unsigned char *) emalloc(buflen); /* isn't NULL terminated */ for (bp = buffer, sp = strtext; *sp != '\0'; bp++, sp++) { ",1 "bool FrameLoader::ShouldClose(bool is_reload) { Page* page = frame_->GetPage(); if (!page || !page->GetChromeClient().CanOpenBeforeUnloadConfirmPanel()) return true; HeapVector> target_frames; target_frames.push_back(frame_); for (Frame* child = frame_->Tree().FirstChild(); child; child = child->Tree().TraverseNext(frame_)) { if (child->IsLocalFrame()) target_frames.push_back(ToLocalFrame(child)); } bool should_close = false; { NavigationDisablerForBeforeUnload navigation_disabler; size_t i; bool did_allow_navigation = false; for (i = 0; i < target_frames.size(); i++) { if (!target_frames[i]->Tree().IsDescendantOf(frame_)) continue; if (!target_frames[i]->GetDocument()->DispatchBeforeUnloadEvent( page->GetChromeClient(), is_reload, did_allow_navigation)) break; } if (i == target_frames.size()) should_close = true; } return should_close; } ",0 " explicit BrowserViewLayoutDelegateImpl(BrowserView* browser_view) : browser_view_(browser_view) {} ",0 "int __init udp_offload_init(void) { return inet6_add_offload(&udpv6_offload, IPPROTO_UDP); } ",0 "bool UnacceleratedStaticBitmapImage::IsPremultiplied() const { return paint_image_.GetSkImage()->alphaType() == SkAlphaType::kPremul_SkAlphaType; } ",0 "png_zfree(voidpf png_ptr, voidpf ptr) { png_free((png_structp)png_ptr, (png_voidp)ptr); } ",0 "SPL_METHOD(MultipleIterator, current) { spl_SplObjectStorage *intern; intern = Z_SPLOBJSTORAGE_P(getThis()); if (zend_parse_parameters_none() == FAILURE) { return; } spl_multiple_iterator_get_all(intern, SPL_MULTIPLE_ITERATOR_GET_ALL_CURRENT, return_value); } ",0 "static inline void v4l_print_ext_ctrls(unsigned int cmd, struct video_device *vfd, struct v4l2_ext_controls *c, int show_vals) { __u32 i; if (!(vfd->debug & V4L2_DEBUG_IOCTL_ARG)) return; dbgarg(cmd, """"); printk(KERN_CONT ""class=0x%x"", c->ctrl_class); for (i = 0; i < c->count; i++) { if (show_vals && !c->controls[i].size) printk(KERN_CONT "" id/val=0x%x/0x%x"", c->controls[i].id, c->controls[i].value); else printk(KERN_CONT "" id=0x%x,size=%u"", c->controls[i].id, c->controls[i].size); } printk(KERN_CONT ""\n""); }; ",0 "void MojoAudioOutputIPC::SetVolume(double volume) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(stream_.is_bound()); stream_->SetVolume(volume); } ",0 " WebInputElement GetInputElementById(const WebString& id) { return GetMainFrame() ->GetDocument() .GetElementById(id) .To(); } ",0 "void DocumentThreadableLoader::setSerializedCachedMetadata(Resource*, const char* data, size_t size) { if (!m_actualRequest.isNull()) return; m_client->didReceiveCachedMetadata(data, size); } ",0 "void ExtensionRegistry::AddObserver(ExtensionRegistryObserver* observer) { observers_.AddObserver(observer); } ",0 " bool context_menu_request_received() const { return context_menu_request_received_; } ",0 "ChromeContentBrowserClient::DetermineCommittedPreviewsForURL( const GURL& url, data_reduction_proxy::DataReductionProxyData* drp_data, previews::PreviewsUserData* previews_user_data, const previews::PreviewsDecider* previews_decider, content::PreviewsState initial_state, content::NavigationHandle* navigation_handle) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); if (!previews::HasEnabledPreviews(initial_state)) return content::PREVIEWS_OFF; content::PreviewsState previews_state = data_reduction_proxy::ContentLoFiDecider:: DetermineCommittedServerPreviewsState(drp_data, initial_state); return previews::DetermineCommittedClientPreviewsState( previews_user_data, url, previews_state, previews_decider, navigation_handle); } ",0 "static int __qeth_do_run_thread(struct qeth_card *card, unsigned long thread) { unsigned long flags; int rc = 0; spin_lock_irqsave(&card->thread_mask_lock, flags); if (card->thread_start_mask & thread) { if ((card->thread_allowed_mask & thread) && !(card->thread_running_mask & thread)) { rc = 1; card->thread_start_mask &= ~thread; card->thread_running_mask |= thread; } else rc = -EPERM; } spin_unlock_irqrestore(&card->thread_mask_lock, flags); return rc; } ",0 "int __init ip6_mr_init(void) { int err; mrt_cachep = kmem_cache_create(""ip6_mrt_cache"", sizeof(struct mfc6_cache), 0, SLAB_HWCACHE_ALIGN, NULL); if (!mrt_cachep) return -ENOMEM; err = register_pernet_subsys(&ip6mr_net_ops); if (err) goto reg_pernet_fail; err = register_netdevice_notifier(&ip6_mr_notifier); if (err) goto reg_notif_fail; #ifdef CONFIG_IPV6_PIMSM_V2 if (inet6_add_protocol(&pim6_protocol, IPPROTO_PIM) < 0) { pr_err(""%s: can't add PIM protocol\n"", __func__); err = -EAGAIN; goto add_proto_fail; } #endif rtnl_register(RTNL_FAMILY_IP6MR, RTM_GETROUTE, NULL, ip6mr_rtm_dumproute, NULL); return 0; #ifdef CONFIG_IPV6_PIMSM_V2 add_proto_fail: unregister_netdevice_notifier(&ip6_mr_notifier); #endif reg_notif_fail: unregister_pernet_subsys(&ip6mr_net_ops); reg_pernet_fail: kmem_cache_destroy(mrt_cachep); return err; } ",0 "sctp_disposition_t sctp_sf_do_9_2_shutdown_ack( struct net *net, const struct sctp_endpoint *ep, const struct sctp_association *asoc, const sctp_subtype_t type, void *arg, sctp_cmd_seq_t *commands) { struct sctp_chunk *chunk = (struct sctp_chunk *) arg; struct sctp_chunk *reply; /* There are 2 ways of getting here: * 1) called in response to a SHUTDOWN chunk * 2) called when SCTP_EVENT_NO_PENDING_TSN event is issued. * * For the case (2), the arg parameter is set to NULL. We need * to check that we have a chunk before accessing it's fields. */ if (chunk) { if (!sctp_vtag_verify(chunk, asoc)) return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); /* Make sure that the SHUTDOWN chunk has a valid length. */ if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_shutdown_chunk_t))) return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, commands); } /* If it has no more outstanding DATA chunks, the SHUTDOWN receiver * shall send a SHUTDOWN ACK ... */ reply = sctp_make_shutdown_ack(asoc, chunk); if (!reply) goto nomem; /* Set the transport for the SHUTDOWN ACK chunk and the timeout for * the T2-shutdown timer. */ sctp_add_cmd_sf(commands, SCTP_CMD_SETUP_T2, SCTP_CHUNK(reply)); /* and start/restart a T2-shutdown timer of its own, */ sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_RESTART, SCTP_TO(SCTP_EVENT_TIMEOUT_T2_SHUTDOWN)); if (asoc->autoclose) sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP, SCTP_TO(SCTP_EVENT_TIMEOUT_AUTOCLOSE)); /* Enter the SHUTDOWN-ACK-SENT state. */ sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE, SCTP_STATE(SCTP_STATE_SHUTDOWN_ACK_SENT)); /* sctp-implguide 2.10 Issues with Heartbeating and failover * * HEARTBEAT ... is discontinued after sending either SHUTDOWN * or SHUTDOWN-ACK. */ sctp_add_cmd_sf(commands, SCTP_CMD_HB_TIMERS_STOP, SCTP_NULL()); sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(reply)); return SCTP_DISPOSITION_CONSUME; nomem: return SCTP_DISPOSITION_NOMEM; } ",0 "void PrintViewManagerBase::TerminatePrintJob(bool cancel) { if (!print_job_.get()) return; if (cancel) { print_job_->Cancel(); inside_inner_message_loop_ = false; } else { DCHECK(!inside_inner_message_loop_); DCHECK(!print_job_->document() || print_job_->document()->IsComplete()); print_job_->Stop(); } ReleasePrintJob(); } ",0 "ofputil_decode_ofp15_group_desc_reply(struct ofputil_group_desc *gd, struct ofpbuf *msg, enum ofp_version version) { struct ofp15_group_desc_stats *ogds; uint16_t length, bucket_list_len; int error; if (!msg->header) { ofpraw_pull_assert(msg); } if (!msg->size) { return EOF; } ogds = ofpbuf_try_pull(msg, sizeof *ogds); if (!ogds) { VLOG_WARN_RL(&bad_ofmsg_rl, ""OFPST11_GROUP_DESC reply has %""PRIu32"" "" ""leftover bytes at end"", msg->size); return OFPERR_OFPBRC_BAD_LEN; } gd->type = ogds->type; gd->group_id = ntohl(ogds->group_id); length = ntohs(ogds->length); if (length < sizeof *ogds || length - sizeof *ogds > msg->size) { VLOG_WARN_RL(&bad_ofmsg_rl, ""OFPST11_GROUP_DESC reply claims invalid "" ""length %u"", length); return OFPERR_OFPBRC_BAD_LEN; } bucket_list_len = ntohs(ogds->bucket_list_len); if (length < bucket_list_len + sizeof *ogds) { VLOG_WARN_RL(&bad_ofmsg_rl, ""OFPST11_GROUP_DESC reply claims invalid "" ""bucket list length %u"", bucket_list_len); return OFPERR_OFPBRC_BAD_LEN; } error = ofputil_pull_ofp15_buckets(msg, bucket_list_len, version, gd->type, &gd->buckets); if (error) { return error; } /* By definition group desc messages don't have a group mod command. * However, parse_group_prop_ntr_selection_method() checks to make sure * that the command is OFPGC15_ADD or OFPGC15_DELETE to guard * against group mod messages with other commands supplying * a NTR selection method group experimenter property. * Such properties are valid for group desc replies so * claim that the group mod command is OFPGC15_ADD to * satisfy the check in parse_group_prop_ntr_selection_method() */ error = parse_ofp15_group_properties( msg, gd->type, OFPGC15_ADD, &gd->props, length - sizeof *ogds - bucket_list_len); if (error) { ofputil_bucket_list_destroy(&gd->buckets); } return error; } ",0 "void GLES2DecoderImpl::DoUniform3fv( GLint location, GLsizei count, const GLfloat* value) { GLenum type; if (!GetUniformTypeByLocation(location, ""glUniform3fv"", &type)) { return; } if (type == GL_BOOL_VEC3) { GLsizei num_values = count * 3; scoped_array temp(new GLint[num_values]); for (GLsizei ii = 0; ii < num_values; ++ii) { temp[ii] = static_cast(value[ii]); } glUniform3iv(location, count, temp.get()); } else { glUniform3fv(location, count, value); } } ",0 "void PlatformSensorProviderLinux::SetSensorDeviceManagerForTesting( std::unique_ptr sensor_device_manager) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); Shutdown(); sensor_device_manager_ = std::move(sensor_device_manager); } ",0 "static u64 *get_written_sptes(struct kvm_mmu_page *sp, gpa_t gpa, int *nspte) { unsigned page_offset, quadrant; u64 *spte; int level; page_offset = offset_in_page(gpa); level = sp->role.level; *nspte = 1; if (!sp->role.cr4_pae) { page_offset <<= 1; /* 32->64 */ /* * A 32-bit pde maps 4MB while the shadow pdes map * only 2MB. So we need to double the offset again * and zap two pdes instead of one. */ if (level == PT32_ROOT_LEVEL) { page_offset &= ~7; /* kill rounding error */ page_offset <<= 1; *nspte = 2; } quadrant = page_offset >> PAGE_SHIFT; page_offset &= ~PAGE_MASK; if (quadrant != sp->role.quadrant) return NULL; } spte = &sp->spt[page_offset / sizeof(*spte)]; return spte; } ",0 "int exfat_mount(struct exfat* ef, const char* spec, const char* options) { int rc; enum exfat_mode mode; exfat_tzset(); memset(ef, 0, sizeof(struct exfat)); parse_options(ef, options); if (match_option(options, ""ro"")) mode = EXFAT_MODE_RO; else if (match_option(options, ""ro_fallback"")) mode = EXFAT_MODE_ANY; else mode = EXFAT_MODE_RW; ef->dev = exfat_open(spec, mode); if (ef->dev == NULL) return -EIO; if (exfat_get_mode(ef->dev) == EXFAT_MODE_RO) { if (mode == EXFAT_MODE_ANY) ef->ro = -1; else ef->ro = 1; } ef->sb = malloc(sizeof(struct exfat_super_block)); if (ef->sb == NULL) { exfat_close(ef->dev); exfat_error(""failed to allocate memory for the super block""); return -ENOMEM; } memset(ef->sb, 0, sizeof(struct exfat_super_block)); if (exfat_pread(ef->dev, ef->sb, sizeof(struct exfat_super_block), 0) < 0) { exfat_close(ef->dev); free(ef->sb); exfat_error(""failed to read boot sector""); return -EIO; } if (memcmp(ef->sb->oem_name, ""EXFAT "", 8) != 0) { exfat_close(ef->dev); free(ef->sb); exfat_error(""exFAT file system is not found""); return -EIO; } ef->zero_cluster = malloc(CLUSTER_SIZE(*ef->sb)); if (ef->zero_cluster == NULL) { exfat_close(ef->dev); free(ef->sb); exfat_error(""failed to allocate zero sector""); return -ENOMEM; } /* use zero_cluster as a temporary buffer for VBR checksum verification */ if (!verify_vbr_checksum(ef->dev, ef->zero_cluster, SECTOR_SIZE(*ef->sb))) { free(ef->zero_cluster); exfat_close(ef->dev); free(ef->sb); return -EIO; } memset(ef->zero_cluster, 0, CLUSTER_SIZE(*ef->sb)); if (ef->sb->version.major != 1 || ef->sb->version.minor != 0) { free(ef->zero_cluster); exfat_close(ef->dev); exfat_error(""unsupported exFAT version: %hhu.%hhu"", ef->sb->version.major, ef->sb->version.minor); free(ef->sb); return -EIO; } if (ef->sb->fat_count != 1) { free(ef->zero_cluster); exfat_close(ef->dev); exfat_error(""unsupported FAT count: %hhu"", ef->sb->fat_count); free(ef->sb); return -EIO; } /* officially exFAT supports cluster size up to 32 MB */ if ((int) ef->sb->sector_bits + (int) ef->sb->spc_bits > 25) { free(ef->zero_cluster); exfat_close(ef->dev); exfat_error(""too big cluster size: 2^%d"", (int) ef->sb->sector_bits + (int) ef->sb->spc_bits); free(ef->sb); return -EIO; } if (le64_to_cpu(ef->sb->sector_count) * SECTOR_SIZE(*ef->sb) > exfat_get_size(ef->dev)) { /* this can cause I/O errors later but we don't fail mounting to let user rescue data */ exfat_warn(""file system is larger than underlying device: "" ""%""PRIu64"" > %""PRIu64, le64_to_cpu(ef->sb->sector_count) * SECTOR_SIZE(*ef->sb), exfat_get_size(ef->dev)); } ef->root = malloc(sizeof(struct exfat_node)); if (ef->root == NULL) { free(ef->zero_cluster); exfat_close(ef->dev); free(ef->sb); exfat_error(""failed to allocate root node""); return -ENOMEM; } memset(ef->root, 0, sizeof(struct exfat_node)); ef->root->flags = EXFAT_ATTRIB_DIR; ef->root->start_cluster = le32_to_cpu(ef->sb->rootdir_cluster); ef->root->fptr_cluster = ef->root->start_cluster; ef->root->name[0] = cpu_to_le16('\0'); ef->root->size = rootdir_size(ef); if (ef->root->size == 0) { free(ef->root); free(ef->zero_cluster); exfat_close(ef->dev); free(ef->sb); return -EIO; } /* exFAT does not have time attributes for the root directory */ ef->root->mtime = 0; ef->root->atime = 0; /* always keep at least 1 reference to the root node */ exfat_get_node(ef->root); rc = exfat_cache_directory(ef, ef->root); if (rc != 0) goto error; if (ef->upcase == NULL) { exfat_error(""upcase table is not found""); goto error; } if (ef->cmap.chunk == NULL) { exfat_error(""clusters bitmap is not found""); goto error; } if (prepare_super_block(ef) != 0) goto error; return 0; error: exfat_put_node(ef, ef->root); exfat_reset_cache(ef); free(ef->root); free(ef->zero_cluster); exfat_close(ef->dev); free(ef->sb); return -EIO; } ",1 "ut64 Elf_(r_bin_elf_get_fini_offset)(ELFOBJ *bin) { ut64 entry = Elf_(r_bin_elf_get_entry_offset) (bin); ut8 buf[512]; if (!bin) { return 0LL; } if (r_buf_read_at (bin->b, entry+11, buf, sizeof (buf)) == -1) { bprintf (""Warning: read (get_fini)\n""); return 0; } if (*buf == 0x68) { // push // x86/32 only ut64 addr; memmove (buf, buf+1, 4); addr = (ut64)r_read_le32 (buf); return Elf_(r_bin_elf_v2p) (bin, addr); } return 0; } ",0 "inf_gtk_certificate_manager_dispose(GObject* object) { InfGtkCertificateManager* manager; InfGtkCertificateManagerPrivate* priv; GSList* item; manager = INF_GTK_CERTIFICATE_MANAGER(object); priv = INF_GTK_CERTIFICATE_MANAGER_PRIVATE(manager); if(priv->parent_window != NULL) { g_object_unref(priv->parent_window); priv->parent_window = NULL; } if(priv->xmpp_manager != NULL) { g_object_unref(priv->xmpp_manager); priv->xmpp_manager = NULL; } for(item = priv->queries; item != NULL; item = g_slist_next(item)) { inf_gtk_certificate_manager_query_free( (InfGtkCertificateManagerQuery*)item->data ); } g_slist_free(priv->queries); priv->queries = NULL; G_OBJECT_CLASS(inf_gtk_certificate_manager_parent_class)->dispose(object); } ",0 "file_tryelf(struct magic_set *ms, int fd, const unsigned char *buf, size_t nbytes) { union { int32_t l; char c[sizeof (int32_t)]; } u; int clazz; int swap; struct stat st; off_t fsize; int flags = 0; Elf32_Ehdr elf32hdr; Elf64_Ehdr elf64hdr; uint16_t type; if (ms->flags & (MAGIC_MIME|MAGIC_APPLE)) return 0; /* * ELF executables have multiple section headers in arbitrary * file locations and thus file(1) cannot determine it from easily. * Instead we traverse thru all section headers until a symbol table * one is found or else the binary is stripped. * Return immediately if it's not ELF (so we avoid pipe2file unless needed). */ if (buf[EI_MAG0] != ELFMAG0 || (buf[EI_MAG1] != ELFMAG1 && buf[EI_MAG1] != OLFMAG1) || buf[EI_MAG2] != ELFMAG2 || buf[EI_MAG3] != ELFMAG3) return 0; /* * If we cannot seek, it must be a pipe, socket or fifo. */ if((lseek(fd, (off_t)0, SEEK_SET) == (off_t)-1) && (errno == ESPIPE)) fd = file_pipe2file(ms, fd, buf, nbytes); if (fstat(fd, &st) == -1) { file_badread(ms); return -1; } fsize = st.st_size; clazz = buf[EI_CLASS]; switch (clazz) { case ELFCLASS32: #undef elf_getu #define elf_getu(a, b) elf_getu32(a, b) #undef elfhdr #define elfhdr elf32hdr #include ""elfclass.h"" case ELFCLASS64: #undef elf_getu #define elf_getu(a, b) elf_getu64(a, b) #undef elfhdr #define elfhdr elf64hdr #include ""elfclass.h"" default: if (file_printf(ms, "", unknown class %d"", clazz) == -1) return -1; break; } return 0; } ",0 "static BOOL update_send_create_offscreen_bitmap_order( rdpContext* context, const CREATE_OFFSCREEN_BITMAP_ORDER* create_offscreen_bitmap) { wStream* s; size_t bm, em, inf; BYTE orderType; BYTE controlFlags; int headerLength; rdpUpdate* update = context->update; headerLength = 1; orderType = ORDER_TYPE_CREATE_OFFSCREEN_BITMAP; controlFlags = ORDER_SECONDARY | (orderType << 2); inf = update_approximate_create_offscreen_bitmap_order( create_offscreen_bitmap); update_check_flush(context, headerLength + inf); s = update->us; if (!s) return FALSE; bm = Stream_GetPosition(s); if (!Stream_EnsureRemainingCapacity(s, headerLength)) return FALSE; Stream_Seek(s, headerLength); if (!update_write_create_offscreen_bitmap_order(s, create_offscreen_bitmap)) return FALSE; em = Stream_GetPosition(s); Stream_SetPosition(s, bm); Stream_Write_UINT8(s, controlFlags); /* controlFlags (1 byte) */ Stream_SetPosition(s, em); update->numberOrders++; return TRUE; } ",0 "void rethrowExceptionInPrivateScript(v8::Isolate* isolate, v8::TryCatch& block, ScriptState* scriptStateInUserScript, ExceptionState::ContextType errorContext, const char* propertyName, const char* interfaceName) { v8::Local context = scriptStateInUserScript->context(); v8::Local exception = block.Exception(); RELEASE_ASSERT(!exception.IsEmpty() && exception->IsObject()); v8::Local exceptionObject = v8::Local::Cast(exception); v8::Local name = exceptionObject->Get(context, v8String(isolate, ""name"")).ToLocalChecked(); RELEASE_ASSERT(name->IsString()); v8::Local tryCatchMessage = block.Message(); v8::Local message; String messageString; if (exceptionObject->Get(context, v8String(isolate, ""message"")).ToLocal(&message) && message->IsString()) messageString = toCoreString(v8::Local::Cast(message)); String exceptionName = toCoreString(v8::Local::Cast(name)); if (exceptionName == ""PrivateScriptException"") { v8::Local code = exceptionObject->Get(context, v8String(isolate, ""code"")).ToLocalChecked(); RELEASE_ASSERT(code->IsInt32()); int exceptionCode = code.As()->Value(); ScriptState::Scope scope(scriptStateInUserScript); ExceptionState exceptionState(errorContext, propertyName, interfaceName, context->Global(), scriptStateInUserScript->isolate()); exceptionState.throwDOMException(exceptionCode, messageString); return; } if (exceptionName == ""RangeError"" && messageString.contains(""Maximum call stack size exceeded"")) { ScriptState::Scope scope(scriptStateInUserScript); ExceptionState exceptionState(errorContext, propertyName, interfaceName, scriptStateInUserScript->context()->Global(), scriptStateInUserScript->isolate()); exceptionState.throwDOMException(V8RangeError, messageString); return; } fprintf(stderr, ""Private script error: %s was thrown.\n"", exceptionName.utf8().data()); dumpV8Message(context, tryCatchMessage); RELEASE_NOTREACHED(); } ",0 "void BrowserWindowGtk::FocusAppMenu() { NOTIMPLEMENTED(); } ",0 "int AutoFillManager::PackGUIDs(const std::string& cc_guid, const std::string& profile_guid) { int cc_id = GUIDToID(cc_guid); int profile_id = GUIDToID(profile_guid); DCHECK(cc_id <= std::numeric_limits::max()); DCHECK(profile_id <= std::numeric_limits::max()); return cc_id << std::numeric_limits::digits | profile_id; } ",0 "InputDeviceCapabilitiesConstants* DOMWindow::GetInputDeviceCapabilities() { if (!input_capabilities_) input_capabilities_ = new InputDeviceCapabilitiesConstants; return input_capabilities_; } ",0 "static inline int ethertype_to_npindex(int ethertype) { switch (ethertype) { case ETH_P_IP: return NP_IP; case ETH_P_IPV6: return NP_IPV6; case ETH_P_IPX: return NP_IPX; case ETH_P_PPPTALK: case ETH_P_ATALK: return NP_AT; case ETH_P_MPLS_UC: return NP_MPLS_UC; case ETH_P_MPLS_MC: return NP_MPLS_MC; } return -1; } ",0 "void LayerTreeHostImpl::ScheduleMicroBenchmark( std::unique_ptr benchmark) { micro_benchmark_controller_.ScheduleRun(std::move(benchmark)); } ",0 "void Parcel::Blob::release() { if (mFd != -1 && mData) { ::munmap(mData, mSize); } clear(); } ",0 "void DownloadManagerImpl::InterceptNavigationOnChecksComplete( ResourceRequestInfo::WebContentsGetter web_contents_getter, std::unique_ptr resource_request, std::vector url_chain, scoped_refptr response, net::CertStatus cert_status, network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints, bool is_download_allowed) { if (!is_download_allowed) { DropDownload(); return; } int render_process_id = -1; int render_frame_id = -1; GURL site_url, tab_url, tab_referrer_url; RenderFrameHost* render_frame_host = nullptr; WebContents* web_contents = std::move(web_contents_getter).Run(); if (web_contents) { render_frame_host = web_contents->GetMainFrame(); if (render_frame_host) { render_process_id = render_frame_host->GetProcess()->GetID(); render_frame_id = render_frame_host->GetRoutingID(); } NavigationEntry* entry = web_contents->GetController().GetVisibleEntry(); if (entry) { tab_url = entry->GetURL(); tab_referrer_url = entry->GetReferrer().url; } } StoragePartitionImpl* storage_partition = GetStoragePartition(browser_context_, render_process_id, render_frame_id); in_progress_manager_->InterceptDownloadFromNavigation( std::move(resource_request), render_process_id, render_frame_id, site_url, tab_url, tab_referrer_url, std::move(url_chain), std::move(response), std::move(cert_status), std::move(url_loader_client_endpoints), CreateDownloadURLLoaderFactoryGetter(storage_partition, render_frame_host, false)); } ",0 "void RenderFrameHostManager::EnsureRenderFrameHostPageFocusConsistent() { frame_tree_node_->frame_tree()->SetPageFocus( render_frame_host_->GetSiteInstance(), frame_tree_node_->frame_tree() ->root() ->current_frame_host() ->GetRenderWidgetHost() ->is_focused()); } ",0 "static const HashTable* getJSFloat64ArrayPrototypeTable(ExecState* exec) { return getHashTableForGlobalData(exec->globalData(), &JSFloat64ArrayPrototypeTable); } ",0 "char *M_fs_path_tmpdir(M_fs_system_t sys_type) { char *d = NULL; char *out = NULL; M_fs_error_t res; #ifdef _WIN32 size_t len = M_fs_path_get_path_max(M_FS_SYSTEM_WINDOWS)+1; d = M_malloc_zero(len); /* Return is length without NULL. */ if (GetTempPath((DWORD)len, d) >= len) { M_free(d); d = NULL; } #elif defined(__APPLE__) d = M_fs_path_mac_tmpdir(); #else const char *const_temp; /* Try Unix env var. */ # ifdef HAVE_SECURE_GETENV const_temp = secure_getenv(""TMPDIR""); # else const_temp = getenv(""TMPDIR""); # endif if (!M_str_isempty(const_temp) && M_fs_perms_can_access(const_temp, M_FS_FILE_MODE_READ|M_FS_FILE_MODE_WRITE) == M_FS_ERROR_SUCCESS) { d = M_strdup(const_temp); } /* Fallback to some ""standard"" system paths. */ if (d == NULL) { const_temp = ""/tmp""; if (!M_str_isempty(const_temp) && M_fs_perms_can_access(const_temp, M_FS_FILE_MODE_READ|M_FS_FILE_MODE_WRITE) == M_FS_ERROR_SUCCESS) { d = M_strdup(const_temp); } } if (d == NULL) { const_temp = ""/var/tmp""; if (!M_str_isempty(const_temp) && M_fs_perms_can_access(const_temp, M_FS_FILE_MODE_READ|M_FS_FILE_MODE_WRITE) == M_FS_ERROR_SUCCESS) { d = M_strdup(const_temp); } } #endif if (d != NULL) { res = M_fs_path_norm(&out, d, M_FS_PATH_NORM_ABSOLUTE, sys_type); if (res != M_FS_ERROR_SUCCESS) { out = NULL; } } M_free(d); return out; } ",1 "WebString ToString(MeteringMode value) { switch (value) { case MeteringMode::NONE: return WebString::FromUTF8(""none""); case MeteringMode::MANUAL: return WebString::FromUTF8(""manual""); case MeteringMode::SINGLE_SHOT: return WebString::FromUTF8(""single-shot""); case MeteringMode::CONTINUOUS: return WebString::FromUTF8(""continuous""); default: NOTREACHED() << ""Unknown MeteringMode""; } return WebString(); } ",0 " void WtsSessionProcessDelegate::Core::OnJobNotification(DWORD message, DWORD pid) { DCHECK(main_task_runner_->BelongsToCurrentThread()); switch (message) { case JOB_OBJECT_MSG_ACTIVE_PROCESS_ZERO: CHECK(SetEvent(process_exit_event_)); break; case JOB_OBJECT_MSG_NEW_PROCESS: worker_process_.Set(OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid)); break; } } ",1 " SafeBrowsingBlockingPage* CreateSafeBrowsingPage( SafeBrowsingUIManager* ui_manager, WebContents* web_contents, const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) { if (unsafe_resources.size() == 1 && (unsafe_resources[0].threat_type == SB_THREAT_TYPE_URL_MALWARE || unsafe_resources[0].threat_type == SB_THREAT_TYPE_URL_PHISHING)) { return new SafeBrowsingBlockingPageV2(ui_manager, web_contents, unsafe_resources); } return new SafeBrowsingBlockingPageV1(ui_manager, web_contents, unsafe_resources); } ",0 "void RenderWidgetHostViewAura::UpdateMouseLockRegion() { RECT window_rect = display::Screen::GetScreen() ->DIPToScreenRectInWindow(window_, window_->GetBoundsInScreen()) .ToRECT(); ::ClipCursor(&window_rect); } ",0 "static void cypress_send(struct usb_serial_port *port) { int count = 0, result, offset, actual_size; struct cypress_private *priv = usb_get_serial_port_data(port); struct device *dev = &port->dev; unsigned long flags; if (!priv->comm_is_ok) return; dev_dbg(dev, ""%s - interrupt out size is %d\n"", __func__, port->interrupt_out_size); spin_lock_irqsave(&priv->lock, flags); if (priv->write_urb_in_use) { dev_dbg(dev, ""%s - can't write, urb in use\n"", __func__); spin_unlock_irqrestore(&priv->lock, flags); return; } spin_unlock_irqrestore(&priv->lock, flags); /* clear buffer */ memset(port->interrupt_out_urb->transfer_buffer, 0, port->interrupt_out_size); spin_lock_irqsave(&priv->lock, flags); switch (priv->pkt_fmt) { default: case packet_format_1: /* this is for the CY7C64013... */ offset = 2; port->interrupt_out_buffer[0] = priv->line_control; break; case packet_format_2: /* this is for the CY7C63743... */ offset = 1; port->interrupt_out_buffer[0] = priv->line_control; break; } if (priv->line_control & CONTROL_RESET) priv->line_control &= ~CONTROL_RESET; if (priv->cmd_ctrl) { priv->cmd_count++; dev_dbg(dev, ""%s - line control command being issued\n"", __func__); spin_unlock_irqrestore(&priv->lock, flags); goto send; } else spin_unlock_irqrestore(&priv->lock, flags); count = kfifo_out_locked(&priv->write_fifo, &port->interrupt_out_buffer[offset], port->interrupt_out_size - offset, &priv->lock); if (count == 0) return; switch (priv->pkt_fmt) { default: case packet_format_1: port->interrupt_out_buffer[1] = count; break; case packet_format_2: port->interrupt_out_buffer[0] |= count; } dev_dbg(dev, ""%s - count is %d\n"", __func__, count); send: spin_lock_irqsave(&priv->lock, flags); priv->write_urb_in_use = 1; spin_unlock_irqrestore(&priv->lock, flags); if (priv->cmd_ctrl) actual_size = 1; else actual_size = count + (priv->pkt_fmt == packet_format_1 ? 2 : 1); usb_serial_debug_data(dev, __func__, port->interrupt_out_size, port->interrupt_out_urb->transfer_buffer); usb_fill_int_urb(port->interrupt_out_urb, port->serial->dev, usb_sndintpipe(port->serial->dev, port->interrupt_out_endpointAddress), port->interrupt_out_buffer, port->interrupt_out_size, cypress_write_int_callback, port, priv->write_urb_interval); result = usb_submit_urb(port->interrupt_out_urb, GFP_ATOMIC); if (result) { dev_err_console(port, ""%s - failed submitting write urb, error %d\n"", __func__, result); priv->write_urb_in_use = 0; cypress_set_dead(port); } spin_lock_irqsave(&priv->lock, flags); if (priv->cmd_ctrl) priv->cmd_ctrl = 0; /* do not count the line control and size bytes */ priv->bytes_out += count; spin_unlock_irqrestore(&priv->lock, flags); usb_serial_port_softint(port); } /* cypress_send */ ",0 " int ElementIdToScrollNodeIndex(CompositorElementId element_id) { return web_layer_tree_view_->GetLayerTreeHost() ->property_trees() ->element_id_to_scroll_node_index[element_id]; } ",0 "static inline void pcnet_tmd_load(PCNetState *s, struct pcnet_TMD *tmd, hwaddr addr) { if (!BCR_SSIZE32(s)) { struct { uint32_t tbadr; int16_t length; int16_t status; } xda; s->phys_mem_read(s->dma_opaque, addr, (void *)&xda, sizeof(xda), 0); tmd->tbadr = le32_to_cpu(xda.tbadr) & 0xffffff; tmd->length = le16_to_cpu(xda.length); tmd->status = (le32_to_cpu(xda.tbadr) >> 16) & 0xff00; tmd->misc = le16_to_cpu(xda.status) << 16; tmd->res = 0; } else { s->phys_mem_read(s->dma_opaque, addr, (void *)tmd, sizeof(*tmd), 0); le32_to_cpus(&tmd->tbadr); le16_to_cpus((uint16_t *)&tmd->length); le16_to_cpus((uint16_t *)&tmd->status); le32_to_cpus(&tmd->misc); le32_to_cpus(&tmd->res); if (BCR_SWSTYLE(s) == 3) { uint32_t tmp = tmd->tbadr; tmd->tbadr = tmd->misc; tmd->misc = tmp; } } } ",0 "static WeakDocumentSet& liveDocumentSet() { DEFINE_STATIC_LOCAL(WeakDocumentSet, set, ()); return set; } ",0 " virtual void SetUp() { pred_fn_ = GetParam(); SetupMacroblock(mb_, mi_, data_array_, kBlockSize, kStride, 2); } ",0 "static int vmx_check_nested_events(struct kvm_vcpu *vcpu, bool external_intr) { struct vcpu_vmx *vmx = to_vmx(vcpu); if (nested_cpu_has_preemption_timer(get_vmcs12(vcpu)) && vmx->nested.preemption_timer_expired) { if (vmx->nested.nested_run_pending) return -EBUSY; nested_vmx_vmexit(vcpu, EXIT_REASON_PREEMPTION_TIMER, 0, 0); return 0; } if (vcpu->arch.nmi_pending && nested_exit_on_nmi(vcpu)) { if (vmx->nested.nested_run_pending || vcpu->arch.interrupt.pending) return -EBUSY; nested_vmx_vmexit(vcpu, EXIT_REASON_EXCEPTION_NMI, NMI_VECTOR | INTR_TYPE_NMI_INTR | INTR_INFO_VALID_MASK, 0); /* * The NMI-triggered VM exit counts as injection: * clear this one and block further NMIs. */ vcpu->arch.nmi_pending = 0; vmx_set_nmi_mask(vcpu, true); return 0; } if ((kvm_cpu_has_interrupt(vcpu) || external_intr) && nested_exit_on_intr(vcpu)) { if (vmx->nested.nested_run_pending) return -EBUSY; nested_vmx_vmexit(vcpu, EXIT_REASON_EXTERNAL_INTERRUPT, 0, 0); } return 0; } ",0 "static MagickBooleanType IsPDF(const unsigned char *magick,const size_t offset) { if (offset < 5) return(MagickFalse); if (LocaleNCompare((const char *) magick,""%PDF-"",5) == 0) return(MagickTrue); return(MagickFalse); } ",0 " virtual URLRequestJob* MaybeIntercept(URLRequest* request, NetworkDelegate* network_delegate) { if (restart_main_request_) { restart_main_request_ = false; did_restart_main_ = true; return new RestartTestJob(request, network_delegate); } if (cancel_main_request_) { cancel_main_request_ = false; did_cancel_main_ = true; return new CancelTestJob(request, network_delegate); } if (cancel_then_restart_main_request_) { cancel_then_restart_main_request_ = false; did_cancel_then_restart_main_ = true; return new CancelThenRestartTestJob(request, network_delegate); } if (simulate_main_network_error_) { simulate_main_network_error_ = false; did_simulate_error_main_ = true; return new URLRequestTestJob(request, network_delegate, true); } if (!intercept_main_request_) return NULL; intercept_main_request_ = false; did_intercept_main_ = true; return new URLRequestTestJob(request, network_delegate, main_headers_, main_data_, true); } ",0 "static void irda_disconnect_indication(void *instance, void *sap, LM_REASON reason, struct sk_buff *skb) { struct irda_sock *self; struct sock *sk; self = instance; pr_debug(""%s(%p)\n"", __func__, self); /* Don't care about it, but let's not leak it */ if(skb) dev_kfree_skb(skb); sk = instance; if (sk == NULL) { pr_debug(""%s(%p) : BUG : sk is NULL\n"", __func__, self); return; } /* Prevent race conditions with irda_release() and irda_shutdown() */ bh_lock_sock(sk); if (!sock_flag(sk, SOCK_DEAD) && sk->sk_state != TCP_CLOSE) { sk->sk_state = TCP_CLOSE; sk->sk_shutdown |= SEND_SHUTDOWN; sk->sk_state_change(sk); /* Close our TSAP. * If we leave it open, IrLMP put it back into the list of * unconnected LSAPs. The problem is that any incoming request * can then be matched to this socket (and it will be, because * it is at the head of the list). This would prevent any * listening socket waiting on the same TSAP to get those * requests. Some apps forget to close sockets, or hang to it * a bit too long, so we may stay in this dead state long * enough to be noticed... * Note : all socket function do check sk->sk_state, so we are * safe... * Jean II */ if (self->tsap) { irttp_close_tsap(self->tsap); self->tsap = NULL; } } bh_unlock_sock(sk); /* Note : once we are there, there is not much you want to do * with the socket anymore, apart from closing it. * For example, bind() and connect() won't reset sk->sk_err, * sk->sk_shutdown and sk->sk_flags to valid values... * Jean II */ } ",0 "static int sysctl_follow_link(struct ctl_table_header **phead, struct ctl_table **pentry) { struct ctl_table_header *head; struct ctl_table_root *root; struct ctl_table_set *set; struct ctl_table *entry; struct ctl_dir *dir; int ret; ret = 0; spin_lock(&sysctl_lock); root = (*pentry)->data; set = lookup_header_set(root); dir = xlate_dir(set, (*phead)->parent); if (IS_ERR(dir)) ret = PTR_ERR(dir); else { const char *procname = (*pentry)->procname; head = NULL; entry = find_entry(&head, dir, procname, strlen(procname)); ret = -ENOENT; if (entry && use_table(head)) { unuse_table(*phead); *phead = head; *pentry = entry; ret = 0; } } spin_unlock(&sysctl_lock); return ret; } ",0 " void XMLHttpRequest::didFail(const ResourceError& error) { if (m_error) return; if (error.isCancellation()) { m_exceptionCode = AbortError; abortError(); return; } if (error.isTimeout()) { didTimeout(); return; } if (error.domain() == errorDomainWebKitInternal) logConsoleError(scriptExecutionContext(), ""XMLHttpRequest cannot load "" + error.failingURL() + "". "" + error.localizedDescription()); m_exceptionCode = NetworkError; networkError(); } ",1 "static inline const char * getcommandname(uint64_t command) { switch (command) { case NBD_CMD_READ: return ""NBD_CMD_READ""; case NBD_CMD_WRITE: return ""NBD_CMD_WRITE""; case NBD_CMD_DISC: return ""NBD_CMD_DISC""; case NBD_CMD_FLUSH: return ""NBD_CMD_FLUSH""; case NBD_CMD_TRIM: return ""NBD_CMD_TRIM""; default: return ""UNKNOWN""; } } ",0 "static int cbc_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) { struct crypto_sparc64_aes_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); struct blkcipher_walk walk; int err; blkcipher_walk_init(&walk, dst, src, nbytes); err = blkcipher_walk_virt(desc, &walk); desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; ctx->ops->load_encrypt_keys(&ctx->key[0]); while ((nbytes = walk.nbytes)) { unsigned int block_len = nbytes & AES_BLOCK_MASK; if (likely(block_len)) { ctx->ops->cbc_encrypt(&ctx->key[0], (const u64 *)walk.src.virt.addr, (u64 *) walk.dst.virt.addr, block_len, (u64 *) walk.iv); } nbytes &= AES_BLOCK_SIZE - 1; err = blkcipher_walk_done(desc, &walk, nbytes); } fprs_write(0); return err; } ",0 "compare_forward(struct Forward *a, struct Forward *b) { if (!compare_host(a->listen_host, b->listen_host)) return 0; if (!compare_host(a->listen_path, b->listen_path)) return 0; if (a->listen_port != b->listen_port) return 0; if (!compare_host(a->connect_host, b->connect_host)) return 0; if (!compare_host(a->connect_path, b->connect_path)) return 0; if (a->connect_port != b->connect_port) return 0; return 1; } ",0 "void InspectorPageAgent::frameDetachedFromParent(Frame* frame) { HashMap::iterator iterator = m_frameToIdentifier.find(frame); if (iterator != m_frameToIdentifier.end()) { m_frontend->frameDetached(iterator->value); m_identifierToFrame.remove(iterator->value); m_frameToIdentifier.remove(iterator); } } ",0 "void WebPageProxy::scrollView(const IntRect& scrollRect, const IntSize& scrollOffset) { m_pageClient->scrollView(scrollRect, scrollOffset); } ",0 "static void srpt_rdma_write_done(struct ib_cq *cq, struct ib_wc *wc) { struct srpt_send_ioctx *ioctx = container_of(wc->wr_cqe, struct srpt_send_ioctx, rdma_cqe); if (unlikely(wc->status != IB_WC_SUCCESS)) { pr_info(""RDMA_WRITE for ioctx 0x%p failed with status %d\n"", ioctx, wc->status); srpt_abort_cmd(ioctx); } } ",0 "HTMLFormControlsCollection* HTMLFormElement::elements() { return ensureCachedCollection(FormControls); } ",0 "static const struct hci_uart_proto *hci_uart_get_proto(unsigned int id) { if (id >= HCI_UART_MAX_PROTO) return NULL; return hup[id]; } ",0 "static void mptsas_set_fault(MPTSASState *s, uint32_t code) { if ((s->state & MPI_IOC_STATE_FAULT) == 0) { s->state = MPI_IOC_STATE_FAULT | code; } } ",0 "PHP_FUNCTION(imagepsextendfont) { zval *fnt; double ext; int *f_ind; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""rd"", &fnt, &ext) == FAILURE) { return; } ZEND_FETCH_RESOURCE(f_ind, int *, &fnt, -1, ""Type 1 font"", le_ps_font); T1_DeleteAllSizes(*f_ind); if (ext <= 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Second parameter %F out of range (must be > 0)"", ext); RETURN_FALSE; } if (T1_ExtendFont(*f_ind, ext) != 0) { RETURN_FALSE; } RETURN_TRUE; } ",0 "int update_dimensions(VP8Context *s, int width, int height, int is_vp7) { AVCodecContext *avctx = s->avctx; int i, ret; if (width != s->avctx->width || ((width+15)/16 != s->mb_width || (height+15)/16 != s->mb_height) && s->macroblocks_base || height != s->avctx->height) { vp8_decode_flush_impl(s->avctx, 1); ret = ff_set_dimensions(s->avctx, width, height); if (ret < 0) return ret; } s->mb_width = (s->avctx->coded_width + 15) / 16; s->mb_height = (s->avctx->coded_height + 15) / 16; s->mb_layout = is_vp7 || avctx->active_thread_type == FF_THREAD_SLICE && avctx->thread_count > 1; if (!s->mb_layout) { // Frame threading and one thread s->macroblocks_base = av_mallocz((s->mb_width + s->mb_height * 2 + 1) * sizeof(*s->macroblocks)); s->intra4x4_pred_mode_top = av_mallocz(s->mb_width * 4); } else // Sliced threading s->macroblocks_base = av_mallocz((s->mb_width + 2) * (s->mb_height + 2) * sizeof(*s->macroblocks)); s->top_nnz = av_mallocz(s->mb_width * sizeof(*s->top_nnz)); s->top_border = av_mallocz((s->mb_width + 1) * sizeof(*s->top_border)); s->thread_data = av_mallocz(MAX_THREADS * sizeof(VP8ThreadData)); if (!s->macroblocks_base || !s->top_nnz || !s->top_border || !s->thread_data || (!s->intra4x4_pred_mode_top && !s->mb_layout)) { free_buffers(s); return AVERROR(ENOMEM); } for (i = 0; i < MAX_THREADS; i++) { s->thread_data[i].filter_strength = av_mallocz(s->mb_width * sizeof(*s->thread_data[0].filter_strength)); if (!s->thread_data[i].filter_strength) { free_buffers(s); return AVERROR(ENOMEM); } #if HAVE_THREADS pthread_mutex_init(&s->thread_data[i].lock, NULL); pthread_cond_init(&s->thread_data[i].cond, NULL); #endif } s->macroblocks = s->macroblocks_base + 1; return 0; } ",0 "WORD32 ih264d_cavlc_parse4x4coeff_n0to7(WORD16 *pi2_coeff_block, UWORD32 u4_isdc, /* is it a DC block */ WORD32 u4_n, dec_struct_t *ps_dec, UWORD32 *pu4_total_coeff) { dec_bit_stream_t *ps_bitstrm = ps_dec->ps_bitstrm; UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer; UWORD32 u4_bitstream_offset = ps_bitstrm->u4_ofst; UWORD32 u4_code, u4_index, u4_ldz; const UWORD16 *pu2_code = (const UWORD16*)gau2_ih264d_code_gx; const UWORD16 *pu2_offset_num_vlc = (const UWORD16 *)gau2_ih264d_offset_num_vlc_tab; UWORD32 u4_offset_num_vlc = pu2_offset_num_vlc[u4_n]; UNUSED(pi2_coeff_block); *pu4_total_coeff = 0; FIND_ONE_IN_STREAM_32(u4_ldz, u4_bitstream_offset, pu4_bitstrm_buf); NEXTBITS(u4_index, u4_bitstream_offset, pu4_bitstrm_buf, 3); u4_index += (u4_ldz << 3); u4_index += u4_offset_num_vlc; u4_index = MIN(u4_index, 303); u4_code = pu2_code[u4_index]; FLUSHBITS(u4_bitstream_offset, (u4_code & 0x03)); ps_bitstrm->u4_ofst = u4_bitstream_offset; *pu4_total_coeff = (u4_code >> 4); if(*pu4_total_coeff) { UWORD32 u4_trailing_ones, u4_offset, u4_total_coeff_tone; const UWORD8 *pu1_offset = (UWORD8 *)gau1_ih264d_total_coeff_fn_ptr_offset; WORD32 ret; u4_trailing_ones = ((u4_code >> 2) & 0x03); u4_offset = pu1_offset[*pu4_total_coeff - 1]; u4_total_coeff_tone = (*pu4_total_coeff << 16) | u4_trailing_ones; ret = ps_dec->pf_cavlc_4x4res_block[u4_offset](u4_isdc, u4_total_coeff_tone, ps_bitstrm); if(ret != 0) return ERROR_CAVLC_NUM_COEFF_T; } return OK; } ",0 "ZEND_METHOD(exception, __clone) { /* Should never be executable */ zend_throw_exception(NULL, ""Cannot clone object using __clone()"", 0 TSRMLS_CC); } ",0 " int ConnectToHandler(int signo, base::ScopedFD* connection) { int fds[2]; if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds) != 0) { return errno; } base::ScopedFD local_connection(fds[0]); base::ScopedFD handlers_socket(fds[1]); int optval = 1; socklen_t optlen = sizeof(optval); setsockopt(handlers_socket.get(), SOL_SOCKET, SO_PASSCRED, &optval, optlen); iovec iov[2]; iov[0].iov_base = &signo; iov[0].iov_len = sizeof(signo); iov[1].iov_base = &request_dump_; iov[1].iov_len = sizeof(request_dump_); msghdr msg; msg.msg_name = nullptr; msg.msg_namelen = 0; msg.msg_iov = iov; msg.msg_iovlen = base::size(iov); char cmsg_buf[CMSG_SPACE(sizeof(int))]; msg.msg_control = cmsg_buf; msg.msg_controllen = sizeof(cmsg_buf); cmsghdr* cmsg = CMSG_FIRSTHDR(&msg); cmsg->cmsg_level = SOL_SOCKET; cmsg->cmsg_type = SCM_RIGHTS; cmsg->cmsg_len = CMSG_LEN(sizeof(int)); *reinterpret_cast(CMSG_DATA(cmsg)) = handlers_socket.get(); if (HANDLE_EINTR(sendmsg(server_fd_, &msg, MSG_NOSIGNAL)) < 0) { return errno; } *connection = std::move(local_connection); return 0; } ",0 "void j2k_dump_image_comp_header(opj_image_comp_t* comp_header, OPJ_BOOL dev_dump_flag, FILE* out_stream) { char tab[3]; if (dev_dump_flag) { fprintf(stdout, ""[DEV] Dump an image_comp_header struct {\n""); tab[0] = '\0'; } else { tab[0] = '\t'; tab[1] = '\t'; tab[2] = '\0'; } fprintf(out_stream, ""%s dx=%d, dy=%d\n"", tab, comp_header->dx, comp_header->dy); fprintf(out_stream, ""%s prec=%d\n"", tab, comp_header->prec); fprintf(out_stream, ""%s sgnd=%d\n"", tab, comp_header->sgnd); if (dev_dump_flag) { fprintf(out_stream, ""}\n""); } } ",0 "status_t Parcel::writeDupImmutableBlobFileDescriptor(int fd) { if (!mAllowFds) return FDS_NOT_ALLOWED; status_t status = writeInt32(BLOB_ASHMEM_IMMUTABLE); if (status) return status; return writeDupFileDescriptor(fd); } ",0 "status_t OMXNodeInstance::setInternalOption( OMX_U32 portIndex, IOMX::InternalOptionType type, const void *data, size_t size) { CLOG_CONFIG(setInternalOption, ""%s(%d): %s:%u %zu@%p"", asString(type), type, portString(portIndex), portIndex, size, data); switch (type) { case IOMX::INTERNAL_OPTION_SUSPEND: case IOMX::INTERNAL_OPTION_REPEAT_PREVIOUS_FRAME_DELAY: case IOMX::INTERNAL_OPTION_MAX_TIMESTAMP_GAP: case IOMX::INTERNAL_OPTION_START_TIME: case IOMX::INTERNAL_OPTION_TIME_LAPSE: { const sp &bufferSource = getGraphicBufferSource(); if (bufferSource == NULL || portIndex != kPortIndexInput) { CLOGW(""setInternalOption is only for Surface input""); return ERROR_UNSUPPORTED; } if (type == IOMX::INTERNAL_OPTION_SUSPEND) { if (size != sizeof(bool)) { return INVALID_OPERATION; } bool suspend = *(bool *)data; CLOG_CONFIG(setInternalOption, ""suspend=%d"", suspend); bufferSource->suspend(suspend); } else if (type == IOMX::INTERNAL_OPTION_REPEAT_PREVIOUS_FRAME_DELAY){ if (size != sizeof(int64_t)) { return INVALID_OPERATION; } int64_t delayUs = *(int64_t *)data; CLOG_CONFIG(setInternalOption, ""delayUs=%lld"", (long long)delayUs); return bufferSource->setRepeatPreviousFrameDelayUs(delayUs); } else if (type == IOMX::INTERNAL_OPTION_MAX_TIMESTAMP_GAP){ if (size != sizeof(int64_t)) { return INVALID_OPERATION; } int64_t maxGapUs = *(int64_t *)data; CLOG_CONFIG(setInternalOption, ""gapUs=%lld"", (long long)maxGapUs); return bufferSource->setMaxTimestampGapUs(maxGapUs); } else if (type == IOMX::INTERNAL_OPTION_START_TIME) { if (size != sizeof(int64_t)) { return INVALID_OPERATION; } int64_t skipFramesBeforeUs = *(int64_t *)data; CLOG_CONFIG(setInternalOption, ""beforeUs=%lld"", (long long)skipFramesBeforeUs); bufferSource->setSkipFramesBeforeUs(skipFramesBeforeUs); } else { // IOMX::INTERNAL_OPTION_TIME_LAPSE if (size != sizeof(int64_t) * 2) { return INVALID_OPERATION; } int64_t timePerFrameUs = ((int64_t *)data)[0]; int64_t timePerCaptureUs = ((int64_t *)data)[1]; CLOG_CONFIG(setInternalOption, ""perFrameUs=%lld perCaptureUs=%lld"", (long long)timePerFrameUs, (long long)timePerCaptureUs); bufferSource->setTimeLapseUs((int64_t *)data); } return OK; } default: return ERROR_UNSUPPORTED; } } ",0 "static int asf_read_generic_value(AVIOContext *pb, int type, uint64_t *value) { switch (type) { case ASF_BOOL: *value = avio_rl16(pb); break; case ASF_DWORD: *value = avio_rl32(pb); break; case ASF_QWORD: *value = avio_rl64(pb); break; case ASF_WORD: *value = avio_rl16(pb); break; default: return AVERROR_INVALIDDATA; } return 0; } ",0 "void purple_transfer_cancel_all(struct im_connection *ic) { struct purple_data *pd = ic->proto_data; while (pd->filetransfers) { struct prpl_xfer_data *px = pd->filetransfers->data; if (px->ft) { imcb_file_canceled(ic, px->ft, ""Logging out""); } pd->filetransfers = g_slist_remove(pd->filetransfers, px); } } ",0 "void CSSStyleSheetResource::DestroyDecodedDataIfPossible() { if (!parsed_style_sheet_cache_) return; SetParsedStyleSheetCache(nullptr); } ",0 " Project_x( EXEC_OP_ FT_Pos dx, FT_Pos dy ) { FT_UNUSED_EXEC; FT_UNUSED( dy ); return dx; } ",0 "void VideoRendererBase::Initialize(const scoped_refptr& decoder, const PipelineStatusCB& status_cb, const StatisticsCB& statistics_cb, const TimeCB& time_cb) { base::AutoLock auto_lock(lock_); DCHECK(decoder); DCHECK(!status_cb.is_null()); DCHECK(!statistics_cb.is_null()); DCHECK(!time_cb.is_null()); DCHECK_EQ(kUninitialized, state_); decoder_ = decoder; statistics_cb_ = statistics_cb; time_cb_ = time_cb; host()->SetNaturalVideoSize(decoder_->natural_size()); state_ = kFlushed; set_opaque_cb_.Run(!decoder->HasAlpha()); set_opaque_cb_.Reset(); if (!base::PlatformThread::Create(0, this, &thread_)) { NOTREACHED() << ""Video thread creation failed""; state_ = kError; status_cb.Run(PIPELINE_ERROR_INITIALIZATION_FAILED); return; } #if defined(OS_WIN) ::SetThreadPriority(thread_, THREAD_PRIORITY_ABOVE_NORMAL); #endif // defined(OS_WIN) status_cb.Run(PIPELINE_OK); } ",0 "void RenderFrameHostImpl::Navigate(const FrameMsg_Navigate_Params& params) { TRACE_EVENT0(""frame_host"", ""RenderFrameHostImpl::Navigate""); if (!GetProcess()->IsGuest()) { ChildProcessSecurityPolicyImpl::GetInstance()->GrantRequestURL( GetProcess()->GetID(), params.url); if (params.url.SchemeIs(kDataScheme) && params.base_url_for_data_url.SchemeIs(kFileScheme)) { ChildProcessSecurityPolicyImpl::GetInstance()->GrantRequestURL( GetProcess()->GetID(), params.base_url_for_data_url); } } if (render_view_host_->navigations_suspended_) { DCHECK(!render_view_host_->suspended_nav_params_.get()); render_view_host_->suspended_nav_params_.reset( new FrameMsg_Navigate_Params(params)); } else { render_view_host_->SetState(RenderViewHostImpl::STATE_DEFAULT); Send(new FrameMsg_Navigate(routing_id_, params)); } if (!params.url.SchemeIs(kJavaScriptScheme)) delegate_->DidStartLoading(this); } ",0 "e1000e_build_rx_metadata(E1000ECore *core, struct NetRxPkt *pkt, bool is_eop, const E1000E_RSSInfo *rss_info, uint32_t *rss, uint32_t *mrq, uint32_t *status_flags, uint16_t *ip_id, uint16_t *vlan_tag) { struct virtio_net_hdr *vhdr; bool isip4, isip6, istcp, isudp; uint32_t pkt_type; *status_flags = E1000_RXD_STAT_DD; /* No additional metadata needed for non-EOP descriptors */ if (!is_eop) { goto func_exit; } *status_flags |= E1000_RXD_STAT_EOP; net_rx_pkt_get_protocols(pkt, &isip4, &isip6, &isudp, &istcp); trace_e1000e_rx_metadata_protocols(isip4, isip6, isudp, istcp); /* VLAN state */ if (net_rx_pkt_is_vlan_stripped(pkt)) { *status_flags |= E1000_RXD_STAT_VP; *vlan_tag = cpu_to_le16(net_rx_pkt_get_vlan_tag(pkt)); trace_e1000e_rx_metadata_vlan(*vlan_tag); } /* Packet parsing results */ if ((core->mac[RXCSUM] & E1000_RXCSUM_PCSD) != 0) { if (rss_info->enabled) { *rss = cpu_to_le32(rss_info->hash); *mrq = cpu_to_le32(rss_info->type | (rss_info->queue << 8)); trace_e1000e_rx_metadata_rss(*rss, *mrq); } } else if (isip4) { *status_flags |= E1000_RXD_STAT_IPIDV; *ip_id = cpu_to_le16(net_rx_pkt_get_ip_id(pkt)); trace_e1000e_rx_metadata_ip_id(*ip_id); } if (istcp && e1000e_is_tcp_ack(core, pkt)) { *status_flags |= E1000_RXD_STAT_ACK; trace_e1000e_rx_metadata_ack(); } if (isip6 && (core->mac[RFCTL] & E1000_RFCTL_IPV6_DIS)) { trace_e1000e_rx_metadata_ipv6_filtering_disabled(); pkt_type = E1000_RXD_PKT_MAC; } else if (istcp || isudp) { pkt_type = isip4 ? E1000_RXD_PKT_IP4_XDP : E1000_RXD_PKT_IP6_XDP; } else if (isip4 || isip6) { pkt_type = isip4 ? E1000_RXD_PKT_IP4 : E1000_RXD_PKT_IP6; } else { pkt_type = E1000_RXD_PKT_MAC; } *status_flags |= E1000_RXD_PKT_TYPE(pkt_type); trace_e1000e_rx_metadata_pkt_type(pkt_type); /* RX CSO information */ if (isip6 && (core->mac[RFCTL] & E1000_RFCTL_IPV6_XSUM_DIS)) { trace_e1000e_rx_metadata_ipv6_sum_disabled(); goto func_exit; } if (!net_rx_pkt_has_virt_hdr(pkt)) { trace_e1000e_rx_metadata_no_virthdr(); e1000e_verify_csum_in_sw(core, pkt, status_flags, istcp, isudp); goto func_exit; } vhdr = net_rx_pkt_get_vhdr(pkt); if (!(vhdr->flags & VIRTIO_NET_HDR_F_DATA_VALID) && !(vhdr->flags & VIRTIO_NET_HDR_F_NEEDS_CSUM)) { trace_e1000e_rx_metadata_virthdr_no_csum_info(); e1000e_verify_csum_in_sw(core, pkt, status_flags, istcp, isudp); goto func_exit; } if (e1000e_rx_l3_cso_enabled(core)) { *status_flags |= isip4 ? E1000_RXD_STAT_IPCS : 0; } else { trace_e1000e_rx_metadata_l3_cso_disabled(); } if (e1000e_rx_l4_cso_enabled(core)) { if (istcp) { *status_flags |= E1000_RXD_STAT_TCPCS; } else if (isudp) { *status_flags |= E1000_RXD_STAT_TCPCS | E1000_RXD_STAT_UDPCS; } } else { trace_e1000e_rx_metadata_l4_cso_disabled(); } trace_e1000e_rx_metadata_status_flags(*status_flags); func_exit: *status_flags = cpu_to_le32(*status_flags); } ",0 "bool RenderWidgetHostImpl::ShouldDropInputEvents() const { return ignore_input_events_ || process_->IgnoreInputEvents() || !delegate_; } ",0 "int ext4_convert_unwritten_extents(struct inode *inode, loff_t offset, ssize_t len) { handle_t *handle; unsigned int max_blocks; int ret = 0; int ret2 = 0; struct ext4_map_blocks map; unsigned int credits, blkbits = inode->i_blkbits; map.m_lblk = offset >> blkbits; /* * We can't just convert len to max_blocks because * If blocksize = 4096 offset = 3072 and len = 2048 */ max_blocks = ((EXT4_BLOCK_ALIGN(len + offset, blkbits) >> blkbits) - map.m_lblk); /* * credits to insert 1 extent into extent tree */ credits = ext4_chunk_trans_blocks(inode, max_blocks); while (ret >= 0 && ret < max_blocks) { map.m_lblk += ret; map.m_len = (max_blocks -= ret); handle = ext4_journal_start(inode, credits); if (IS_ERR(handle)) { ret = PTR_ERR(handle); break; } ret = ext4_map_blocks(handle, inode, &map, EXT4_GET_BLOCKS_IO_CONVERT_EXT); if (ret <= 0) { WARN_ON(ret <= 0); ext4_msg(inode->i_sb, KERN_ERR, ""%s:%d: inode #%lu: block %u: len %u: "" ""ext4_ext_map_blocks returned %d"", __func__, __LINE__, inode->i_ino, map.m_lblk, map.m_len, ret); } ext4_mark_inode_dirty(handle, inode); ret2 = ext4_journal_stop(handle); if (ret <= 0 || ret2 ) break; } return ret > 0 ? ret2 : ret; } ",0 "void WebGLRenderingContextBase::blendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { if (isContextLost()) return; ContextGL()->BlendColor(red, green, blue, alpha); } ",0 "void __local_bh_disable_ip(unsigned long ip, unsigned int cnt) { unsigned long flags; WARN_ON_ONCE(in_irq()); raw_local_irq_save(flags); /* * The preempt tracer hooks into preempt_count_add and will break * lockdep because it calls back into lockdep after SOFTIRQ_OFFSET * is set and before current->softirq_enabled is cleared. * We must manually increment preempt_count here and manually * call the trace_preempt_off later. */ __preempt_count_add(cnt); /* * Were softirqs turned off above: */ if (softirq_count() == (cnt & SOFTIRQ_MASK)) trace_softirqs_off(ip); raw_local_irq_restore(flags); if (preempt_count() == cnt) { #ifdef CONFIG_DEBUG_PREEMPT current->preempt_disable_ip = get_lock_parent_ip(); #endif trace_preempt_off(CALLER_ADDR0, get_lock_parent_ip()); } } ",0 "activation_get_activation_uris (ActivateParameters *parameters) { GList *l, *files; NautilusFile *file; LaunchLocation *location; /* link target info might be stale, re-read it */ for (l = parameters->locations; l != NULL; l = l->next) { location = l->data; file = location->file; if (file_was_cancelled (file)) { launch_location_free (location); parameters->locations = g_list_delete_link (parameters->locations, l); continue; } } if (parameters->locations == NULL) { activation_parameters_free (parameters); return; } files = get_file_list_for_launch_locations (parameters->locations); nautilus_file_list_call_when_ready (files, nautilus_mime_actions_get_required_file_attributes (), ¶meters->files_handle, activate_activation_uris_ready_callback, parameters); nautilus_file_list_free (files); } ",0 "void SetPageSizeAndContentRect(bool rotated, bool is_src_page_landscape, pp::Size* page_size, pp::Rect* content_rect) { bool is_dst_page_landscape = page_size->width() > page_size->height(); bool page_orientation_mismatched = is_src_page_landscape != is_dst_page_landscape; bool rotate_dst_page = rotated ^ page_orientation_mismatched; if (rotate_dst_page) { page_size->SetSize(page_size->height(), page_size->width()); content_rect->SetRect(content_rect->y(), content_rect->x(), content_rect->height(), content_rect->width()); } } ",0 "network_connect_gnutls_handshake_timer_cb (void *arg_hook_connect, int remaining_calls) { struct t_hook *hook_connect; /* make C compiler happy */ (void) remaining_calls; hook_connect = (struct t_hook *)arg_hook_connect; HOOK_CONNECT(hook_connect, handshake_hook_timer) = NULL; (void) (HOOK_CONNECT(hook_connect, callback)) (hook_connect->callback_data, WEECHAT_HOOK_CONNECT_GNUTLS_HANDSHAKE_ERROR, GNUTLS_E_EXPIRED, gnutls_strerror (GNUTLS_E_EXPIRED), HOOK_CONNECT(hook_connect, handshake_ip_address)); unhook (hook_connect); return WEECHAT_RC_OK; } ",0 "void LauncherView::SetAlignment(ShelfAlignment alignment) { if (alignment_ == alignment) return; alignment_ = alignment; UpdateFirstButtonPadding(); LayoutToIdealBounds(); tooltip_->SetArrowLocation(alignment_); } ",1 "bool RenderFrameImpl::RunModalConfirmDialog(const blink::WebString& message) { return RunJavaScriptDialog(JAVASCRIPT_DIALOG_TYPE_CONFIRM, message.Utf16(), base::string16(), frame_->GetDocument().Url(), nullptr); } ",0 "void OfflinePageModelImpl::GetPagesByURL( const GURL& url, URLSearchMode url_search_mode, const MultipleOfflinePageItemCallback& callback) { OfflinePageModelQueryBuilder builder; builder.SetUrls(OfflinePageModelQuery::Requirement::INCLUDE_MATCHING, std::vector({url}), url_search_mode, true /* strip_fragment */); RunWhenLoaded( base::Bind(&OfflinePageModelImpl::GetPagesMatchingQueryWhenLoadDone, weak_ptr_factory_.GetWeakPtr(), base::Passed(builder.Build(GetPolicyController())), callback)); } ",0 "png_set_compression_mem_level(png_structp png_ptr, int mem_level) { png_debug(1, ""in png_set_compression_mem_level""); if (png_ptr == NULL) return; png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL; png_ptr->zlib_mem_level = mem_level; } ",0 "static void account_numa_enqueue(struct rq *rq, struct task_struct *p) { rq->nr_numa_running += (p->numa_preferred_nid != -1); rq->nr_preferred_running += (p->numa_preferred_nid == task_node(p)); } ",0 "char * exif_dump_data(int *dump_free, int format, int components, int length, int motorola_intel, char *value_ptr TSRMLS_DC) /* {{{ */ { char *dump; int len; *dump_free = 0; if (format == TAG_FMT_STRING) { return value_ptr ? value_ptr : """"; } if (format == TAG_FMT_UNDEFINED) { return ""\n""; } if (format == TAG_FMT_IFD) { return """"; } if (format == TAG_FMT_SINGLE || format == TAG_FMT_DOUBLE) { return """"; } *dump_free = 1; if (components > 1) { len = spprintf(&dump, 0, ""(%d,%d) {"", components, length); } else { len = spprintf(&dump, 0, ""{""); } while(components > 0) { switch(format) { case TAG_FMT_BYTE: case TAG_FMT_UNDEFINED: case TAG_FMT_STRING: case TAG_FMT_SBYTE: dump = erealloc(dump, len + 4 + 1); snprintf(dump + len, 4 + 1, ""0x%02X"", *value_ptr); len += 4; value_ptr++; break; case TAG_FMT_USHORT: case TAG_FMT_SSHORT: dump = erealloc(dump, len + 6 + 1); snprintf(dump + len, 6 + 1, ""0x%04X"", php_ifd_get16s(value_ptr, motorola_intel)); len += 6; value_ptr += 2; break; case TAG_FMT_ULONG: case TAG_FMT_SLONG: dump = erealloc(dump, len + 6 + 1); snprintf(dump + len, 6 + 1, ""0x%04X"", php_ifd_get32s(value_ptr, motorola_intel)); len += 6; value_ptr += 4; break; case TAG_FMT_URATIONAL: case TAG_FMT_SRATIONAL: dump = erealloc(dump, len + 13 + 1); snprintf(dump + len, 13 + 1, ""0x%04X/0x%04X"", php_ifd_get32s(value_ptr, motorola_intel), php_ifd_get32s(value_ptr+4, motorola_intel)); len += 13; value_ptr += 8; break; } if (components > 0) { dump = erealloc(dump, len + 2 + 1); snprintf(dump + len, 2 + 1, "", ""); len += 2; components--; } else{ break; } } dump = erealloc(dump, len + 1 + 1); snprintf(dump + len, 1 + 1, ""}""); return dump; } /* }}} */ #endif /* {{{ exif_convert_any_format * Evaluate number, be it int, rational, or float from directory. */ static double exif_convert_any_format(void *value, int format, int motorola_intel TSRMLS_DC) { int s_den; unsigned u_den; switch(format) { case TAG_FMT_SBYTE: return *(signed char *)value; case TAG_FMT_BYTE: return *(uchar *)value; case TAG_FMT_USHORT: return php_ifd_get16u(value, motorola_intel); case TAG_FMT_ULONG: return php_ifd_get32u(value, motorola_intel); case TAG_FMT_URATIONAL: u_den = php_ifd_get32u(4+(char *)value, motorola_intel); if (u_den == 0) { return 0; } else { return (double)php_ifd_get32u(value, motorola_intel) / u_den; } case TAG_FMT_SRATIONAL: s_den = php_ifd_get32s(4+(char *)value, motorola_intel); if (s_den == 0) { return 0; } else { return (double)php_ifd_get32s(value, motorola_intel) / s_den; } case TAG_FMT_SSHORT: return (signed short)php_ifd_get16u(value, motorola_intel); case TAG_FMT_SLONG: return php_ifd_get32s(value, motorola_intel); /* Not sure if this is correct (never seen float used in Exif format) */ case TAG_FMT_SINGLE: #ifdef EXIF_DEBUG php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Found value of type single""); #endif return (double)*(float *)value; case TAG_FMT_DOUBLE: #ifdef EXIF_DEBUG php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Found value of type double""); #endif return *(double *)value; } return 0; } /* }}} */ /* {{{ exif_convert_any_to_int * Evaluate number, be it int, rational, or float from directory. */ static size_t exif_convert_any_to_int(void *value, int format, int motorola_intel TSRMLS_DC) { int s_den; unsigned u_den; switch(format) { case TAG_FMT_SBYTE: return *(signed char *)value; case TAG_FMT_BYTE: return *(uchar *)value; case TAG_FMT_USHORT: return php_ifd_get16u(value, motorola_intel); case TAG_FMT_ULONG: return php_ifd_get32u(value, motorola_intel); case TAG_FMT_URATIONAL: u_den = php_ifd_get32u(4+(char *)value, motorola_intel); if (u_den == 0) { return 0; } else { return php_ifd_get32u(value, motorola_intel) / u_den; } case TAG_FMT_SRATIONAL: s_den = php_ifd_get32s(4+(char *)value, motorola_intel); if (s_den == 0) { return 0; } else { return php_ifd_get32s(value, motorola_intel) / s_den; } case TAG_FMT_SSHORT: return php_ifd_get16u(value, motorola_intel); case TAG_FMT_SLONG: return php_ifd_get32s(value, motorola_intel); /* Not sure if this is correct (never seen float used in Exif format) */ case TAG_FMT_SINGLE: #ifdef EXIF_DEBUG php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Found value of type single""); #endif return (size_t)*(float *)value; case TAG_FMT_DOUBLE: #ifdef EXIF_DEBUG php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Found value of type double""); #endif return (size_t)*(double *)value; } return 0; } /* }}} */ /* {{{ struct image_info_value, image_info_list */ #ifndef WORD #define WORD unsigned short #endif #ifndef DWORD #define DWORD unsigned int #endif typedef struct { int num; int den; } signed_rational; typedef struct { unsigned int num; unsigned int den; } unsigned_rational; typedef union _image_info_value { char *s; unsigned u; int i; float f; double d; signed_rational sr; unsigned_rational ur; union _image_info_value *list; } image_info_value; typedef struct { WORD tag; WORD format; DWORD length; DWORD dummy; /* value ptr of tiff directory entry */ char *name; image_info_value value; } image_info_data; typedef struct { int count; image_info_data *list; } image_info_list; /* }}} */ /* {{{ exif_get_sectionname Returns the name of a section */ #define SECTION_FILE 0 #define SECTION_COMPUTED 1 #define SECTION_ANY_TAG 2 #define SECTION_IFD0 3 #define SECTION_THUMBNAIL 4 #define SECTION_COMMENT 5 #define SECTION_APP0 6 #define SECTION_EXIF 7 #define SECTION_FPIX 8 #define SECTION_GPS 9 #define SECTION_INTEROP 10 #define SECTION_APP12 11 #define SECTION_WINXP 12 #define SECTION_MAKERNOTE 13 #define SECTION_COUNT 14 #define FOUND_FILE (1<2) sections[len-2] = '\0'; return sections; } /* }}} */ /* {{{ struct image_info_type This structure stores Exif header image elements in a simple manner Used to store camera data as extracted from the various ways that it can be stored in a nexif header */ typedef struct { int type; size_t size; uchar *data; } file_section; typedef struct { int count; file_section *list; } file_section_list; typedef struct { image_filetype filetype; size_t width, height; size_t size; size_t offset; char *data; } thumbnail_data; typedef struct { char *value; size_t size; int tag; } xp_field_type; typedef struct { int count; xp_field_type *list; } xp_field_list; /* This structure is used to store a section of a Jpeg file. */ typedef struct { php_stream *infile; char *FileName; time_t FileDateTime; size_t FileSize; image_filetype FileType; int Height, Width; int IsColor; char *make; char *model; float ApertureFNumber; float ExposureTime; double FocalplaneUnits; float CCDWidth; double FocalplaneXRes; size_t ExifImageWidth; float FocalLength; float Distance; int motorola_intel; /* 1 Motorola; 0 Intel */ char *UserComment; int UserCommentLength; char *UserCommentEncoding; char *encode_unicode; char *decode_unicode_be; char *decode_unicode_le; char *encode_jis; char *decode_jis_be; char *decode_jis_le; char *Copyright;/* EXIF standard defines Copyright as "" [ '\0' ] ['\0']"" */ char *CopyrightPhotographer; char *CopyrightEditor; xp_field_list xp_fields; thumbnail_data Thumbnail; /* other */ int sections_found; /* FOUND_ */ image_info_list info_list[SECTION_COUNT]; /* for parsing */ int read_thumbnail; int read_all; int ifd_nesting_level; /* internal */ file_section_list file; } image_info_type; /* }}} */ /* {{{ exif_error_docref */ static void exif_error_docref(const char *docref EXIFERR_DC, const image_info_type *ImageInfo, int type, const char *format, ...) { va_list args; va_start(args, format); #ifdef EXIF_DEBUG { char *buf; spprintf(&buf, 0, ""%s(%d): %s"", _file, _line, format); php_verror(docref, ImageInfo->FileName?ImageInfo->FileName:"""", type, buf, args TSRMLS_CC); efree(buf); } #else php_verror(docref, ImageInfo->FileName?ImageInfo->FileName:"""", type, format, args TSRMLS_CC); #endif va_end(args); } /* }}} */ /* {{{ jpeg_sof_info */ typedef struct { int bits_per_sample; size_t width; size_t height; int num_components; } jpeg_sof_info; /* }}} */ /* {{{ exif_file_sections_add Add a file_section to image_info returns the used block or -1. if size>0 and data == NULL buffer of size is allocated */ static int exif_file_sections_add(image_info_type *ImageInfo, int type, size_t size, uchar *data) { file_section *tmp; int count = ImageInfo->file.count; tmp = safe_erealloc(ImageInfo->file.list, (count+1), sizeof(file_section), 0); ImageInfo->file.list = tmp; ImageInfo->file.list[count].type = 0xFFFF; ImageInfo->file.list[count].data = NULL; ImageInfo->file.list[count].size = 0; ImageInfo->file.count = count+1; if (!size) { data = NULL; } else if (data == NULL) { data = safe_emalloc(size, 1, 0); } ImageInfo->file.list[count].type = type; ImageInfo->file.list[count].data = data; ImageInfo->file.list[count].size = size; return count; } /* }}} */ /* {{{ exif_file_sections_realloc Reallocate a file section returns 0 on success and -1 on failure */ static int exif_file_sections_realloc(image_info_type *ImageInfo, int section_index, size_t size TSRMLS_DC) { void *tmp; /* This is not a malloc/realloc check. It is a plausibility check for the * function parameters (requirements engineering). */ if (section_index >= ImageInfo->file.count) { EXIF_ERRLOG_FSREALLOC(ImageInfo) return -1; } tmp = safe_erealloc(ImageInfo->file.list[section_index].data, 1, size, 0); ImageInfo->file.list[section_index].data = tmp; ImageInfo->file.list[section_index].size = size; return 0; } /* }}} */ /* {{{ exif_file_section_free Discard all file_sections in ImageInfo */ static int exif_file_sections_free(image_info_type *ImageInfo) { int i; if (ImageInfo->file.count) { for (i=0; ifile.count; i++) { EFREE_IF(ImageInfo->file.list[i].data); } } EFREE_IF(ImageInfo->file.list); ImageInfo->file.count = 0; return TRUE; } /* }}} */ /* {{{ exif_iif_add_value Add a value to image_info */ static void exif_iif_add_value(image_info_type *image_info, int section_index, char *name, int tag, int format, int length, void* value, int motorola_intel TSRMLS_DC) { size_t idex; void *vptr; image_info_value *info_value; image_info_data *info_data; image_info_data *list; if (length < 0) { return; } list = safe_erealloc(image_info->info_list[section_index].list, (image_info->info_list[section_index].count+1), sizeof(image_info_data), 0); image_info->info_list[section_index].list = list; info_data = &image_info->info_list[section_index].list[image_info->info_list[section_index].count]; memset(info_data, 0, sizeof(image_info_data)); info_data->tag = tag; info_data->format = format; info_data->length = length; info_data->name = estrdup(name); info_value = &info_data->value; switch (format) { case TAG_FMT_STRING: if (value) { length = php_strnlen(value, length); info_value->s = estrndup(value, length); info_data->length = length; } else { info_data->length = 0; info_value->s = estrdup(""""); } break; default: /* Standard says more types possible but skip them... * but allow users to handle data if they know how to * So not return but use type UNDEFINED * return; */ info_data->tag = TAG_FMT_UNDEFINED;/* otherwise not freed from memory */ case TAG_FMT_SBYTE: case TAG_FMT_BYTE: /* in contrast to strings bytes do not need to allocate buffer for NULL if length==0 */ if (!length) break; case TAG_FMT_UNDEFINED: if (value) { /* do not recompute length here */ info_value->s = estrndup(value, length); info_data->length = length; } else { info_data->length = 0; info_value->s = estrdup(""""); } break; case TAG_FMT_USHORT: case TAG_FMT_ULONG: case TAG_FMT_URATIONAL: case TAG_FMT_SSHORT: case TAG_FMT_SLONG: case TAG_FMT_SRATIONAL: case TAG_FMT_SINGLE: case TAG_FMT_DOUBLE: if (length==0) { break; } else if (length>1) { info_value->list = safe_emalloc(length, sizeof(image_info_value), 0); } else { info_value = &info_data->value; } for (idex=0,vptr=value; idex<(size_t)length; idex++,vptr=(char *) vptr + php_tiff_bytes_per_format[format]) { if (length>1) { info_value = &info_data->value.list[idex]; } switch (format) { case TAG_FMT_USHORT: info_value->u = php_ifd_get16u(vptr, motorola_intel); break; case TAG_FMT_ULONG: info_value->u = php_ifd_get32u(vptr, motorola_intel); break; case TAG_FMT_URATIONAL: info_value->ur.num = php_ifd_get32u(vptr, motorola_intel); info_value->ur.den = php_ifd_get32u(4+(char *)vptr, motorola_intel); break; case TAG_FMT_SSHORT: info_value->i = php_ifd_get16s(vptr, motorola_intel); break; case TAG_FMT_SLONG: info_value->i = php_ifd_get32s(vptr, motorola_intel); break; case TAG_FMT_SRATIONAL: info_value->sr.num = php_ifd_get32u(vptr, motorola_intel); info_value->sr.den = php_ifd_get32u(4+(char *)vptr, motorola_intel); break; case TAG_FMT_SINGLE: #ifdef EXIF_DEBUG php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Found value of type single""); #endif info_value->f = *(float *)value; case TAG_FMT_DOUBLE: #ifdef EXIF_DEBUG php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Found value of type double""); #endif info_value->d = *(double *)value; break; } } } image_info->sections_found |= 1<info_list[section_index].count++; } /* }}} */ /* {{{ exif_iif_add_tag Add a tag from IFD to image_info */ static void exif_iif_add_tag(image_info_type *image_info, int section_index, char *name, int tag, int format, size_t length, void* value TSRMLS_DC) { exif_iif_add_value(image_info, section_index, name, tag, format, (int)length, value, image_info->motorola_intel TSRMLS_CC); } /* }}} */ /* {{{ exif_iif_add_int Add an int value to image_info */ static void exif_iif_add_int(image_info_type *image_info, int section_index, char *name, int value TSRMLS_DC) { image_info_data *info_data; image_info_data *list; list = safe_erealloc(image_info->info_list[section_index].list, (image_info->info_list[section_index].count+1), sizeof(image_info_data), 0); image_info->info_list[section_index].list = list; info_data = &image_info->info_list[section_index].list[image_info->info_list[section_index].count]; info_data->tag = TAG_NONE; info_data->format = TAG_FMT_SLONG; info_data->length = 1; info_data->name = estrdup(name); info_data->value.i = value; image_info->sections_found |= 1<info_list[section_index].count++; } /* }}} */ /* {{{ exif_iif_add_str Add a string value to image_info MUST BE NUL TERMINATED */ static void exif_iif_add_str(image_info_type *image_info, int section_index, char *name, char *value TSRMLS_DC) { image_info_data *info_data; image_info_data *list; if (value) { list = safe_erealloc(image_info->info_list[section_index].list, (image_info->info_list[section_index].count+1), sizeof(image_info_data), 0); image_info->info_list[section_index].list = list; info_data = &image_info->info_list[section_index].list[image_info->info_list[section_index].count]; info_data->tag = TAG_NONE; info_data->format = TAG_FMT_STRING; info_data->length = 1; info_data->name = estrdup(name); info_data->value.s = estrdup(value); image_info->sections_found |= 1<info_list[section_index].count++; } } /* }}} */ /* {{{ exif_iif_add_fmt Add a format string value to image_info MUST BE NUL TERMINATED */ static void exif_iif_add_fmt(image_info_type *image_info, int section_index, char *name TSRMLS_DC, char *value, ...) { char *tmp; va_list arglist; va_start(arglist, value); if (value) { vspprintf(&tmp, 0, value, arglist); exif_iif_add_str(image_info, section_index, name, tmp TSRMLS_CC); efree(tmp); } va_end(arglist); } /* }}} */ /* {{{ exif_iif_add_str Add a string value to image_info MUST BE NUL TERMINATED */ static void exif_iif_add_buffer(image_info_type *image_info, int section_index, char *name, int length, char *value TSRMLS_DC) { image_info_data *info_data; image_info_data *list; if (value) { list = safe_erealloc(image_info->info_list[section_index].list, (image_info->info_list[section_index].count+1), sizeof(image_info_data), 0); image_info->info_list[section_index].list = list; info_data = &image_info->info_list[section_index].list[image_info->info_list[section_index].count]; info_data->tag = TAG_NONE; info_data->format = TAG_FMT_UNDEFINED; info_data->length = length; info_data->name = estrdup(name); info_data->value.s = safe_emalloc(length, 1, 1); memcpy(info_data->value.s, value, length); info_data->value.s[length] = 0; image_info->sections_found |= 1<info_list[section_index].count++; } } /* }}} */ /* {{{ exif_iif_free Free memory allocated for image_info */ static void exif_iif_free(image_info_type *image_info, int section_index) { int i; void *f; /* faster */ if (image_info->info_list[section_index].count) { for (i=0; i < image_info->info_list[section_index].count; i++) { if ((f=image_info->info_list[section_index].list[i].name) != NULL) { efree(f); } switch(image_info->info_list[section_index].list[i].format) { case TAG_FMT_SBYTE: case TAG_FMT_BYTE: /* in contrast to strings bytes do not need to allocate buffer for NULL if length==0 */ if (image_info->info_list[section_index].list[i].length<1) break; default: case TAG_FMT_UNDEFINED: case TAG_FMT_STRING: if ((f=image_info->info_list[section_index].list[i].value.s) != NULL) { efree(f); } break; case TAG_FMT_USHORT: case TAG_FMT_ULONG: case TAG_FMT_URATIONAL: case TAG_FMT_SSHORT: case TAG_FMT_SLONG: case TAG_FMT_SRATIONAL: case TAG_FMT_SINGLE: case TAG_FMT_DOUBLE: /* nothing to do here */ if (image_info->info_list[section_index].list[i].length > 1) { if ((f=image_info->info_list[section_index].list[i].value.list) != NULL) { efree(f); } } break; } } } EFREE_IF(image_info->info_list[section_index].list); } /* }}} */ /* {{{ add_assoc_image_info * Add image_info to associative array value. */ static void add_assoc_image_info(zval *value, int sub_array, image_info_type *image_info, int section_index TSRMLS_DC) { char buffer[64], *val, *name, uname[64]; int i, ap, l, b, idx=0, unknown=0; #ifdef EXIF_DEBUG int info_tag; #endif image_info_value *info_value; image_info_data *info_data; zval *tmpi, *array = NULL; #ifdef EXIF_DEBUG /* php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Adding %d infos from section %s"", image_info->info_list[section_index].count, exif_get_sectionname(section_index));*/ #endif if (image_info->info_list[section_index].count) { if (sub_array) { MAKE_STD_ZVAL(tmpi); array_init(tmpi); } else { tmpi = value; } for(i=0; iinfo_list[section_index].count; i++) { info_data = &image_info->info_list[section_index].list[i]; #ifdef EXIF_DEBUG info_tag = info_data->tag; /* conversion */ #endif info_value = &info_data->value; if (!(name = info_data->name)) { snprintf(uname, sizeof(uname), ""%d"", unknown++); name = uname; } #ifdef EXIF_DEBUG /* php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Adding infos: tag(0x%04X,%12s,L=0x%04X): %s"", info_tag, exif_get_tagname(info_tag, buffer, -12, exif_get_tag_table(section_index) TSRMLS_CC), info_data->length, info_data->format==TAG_FMT_STRING?(info_value&&info_value->s?info_value->s:""""):exif_get_tagformat(info_data->format));*/ #endif if (info_data->length==0) { add_assoc_null(tmpi, name); } else { switch (info_data->format) { default: /* Standard says more types possible but skip them... * but allow users to handle data if they know how to * So not return but use type UNDEFINED * return; */ case TAG_FMT_BYTE: case TAG_FMT_SBYTE: case TAG_FMT_UNDEFINED: if (!info_value->s) { add_assoc_stringl(tmpi, name, """", 0, 1); } else { add_assoc_stringl(tmpi, name, info_value->s, info_data->length, 1); } break; case TAG_FMT_STRING: if (!(val = info_value->s)) { val = """"; } if (section_index==SECTION_COMMENT) { add_index_string(tmpi, idx++, val, 1); } else { add_assoc_string(tmpi, name, val, 1); } break; case TAG_FMT_URATIONAL: case TAG_FMT_SRATIONAL: /*case TAG_FMT_BYTE: case TAG_FMT_SBYTE:*/ case TAG_FMT_USHORT: case TAG_FMT_SSHORT: case TAG_FMT_SINGLE: case TAG_FMT_DOUBLE: case TAG_FMT_ULONG: case TAG_FMT_SLONG: /* now the rest, first see if it becomes an array */ if ((l = info_data->length) > 1) { array = NULL; MAKE_STD_ZVAL(array); array_init(array); } for(ap=0; ap1) { info_value = &info_data->value.list[ap]; } switch (info_data->format) { case TAG_FMT_BYTE: if (l>1) { info_value = &info_data->value; for (b=0;bs[b])); } break; } case TAG_FMT_USHORT: case TAG_FMT_ULONG: if (l==1) { add_assoc_long(tmpi, name, (int)info_value->u); } else { add_index_long(array, ap, (int)info_value->u); } break; case TAG_FMT_URATIONAL: snprintf(buffer, sizeof(buffer), ""%i/%i"", info_value->ur.num, info_value->ur.den); if (l==1) { add_assoc_string(tmpi, name, buffer, 1); } else { add_index_string(array, ap, buffer, 1); } break; case TAG_FMT_SBYTE: if (l>1) { info_value = &info_data->value; for (b=0;bs[b]); } break; } case TAG_FMT_SSHORT: case TAG_FMT_SLONG: if (l==1) { add_assoc_long(tmpi, name, info_value->i); } else { add_index_long(array, ap, info_value->i); } break; case TAG_FMT_SRATIONAL: snprintf(buffer, sizeof(buffer), ""%i/%i"", info_value->sr.num, info_value->sr.den); if (l==1) { add_assoc_string(tmpi, name, buffer, 1); } else { add_index_string(array, ap, buffer, 1); } break; case TAG_FMT_SINGLE: if (l==1) { add_assoc_double(tmpi, name, info_value->f); } else { add_index_double(array, ap, info_value->f); } break; case TAG_FMT_DOUBLE: if (l==1) { add_assoc_double(tmpi, name, info_value->d); } else { add_index_double(array, ap, info_value->d); } break; } info_value = &info_data->value.list[ap]; } if (l>1) { add_assoc_zval(tmpi, name, array); } break; } } } if (sub_array) { add_assoc_zval(value, exif_get_sectionname(section_index), tmpi); } } } /* }}} */ /* {{{ Markers JPEG markers consist of one or more 0xFF bytes, followed by a marker code byte (which is not an FF). Here are the marker codes of interest in this program. (See jdmarker.c for a more complete list.) */ #define M_TEM 0x01 /* temp for arithmetic coding */ #define M_RES 0x02 /* reserved */ #define M_SOF0 0xC0 /* Start Of Frame N */ #define M_SOF1 0xC1 /* N indicates which compression process */ #define M_SOF2 0xC2 /* Only SOF0-SOF2 are now in common use */ #define M_SOF3 0xC3 #define M_DHT 0xC4 #define M_SOF5 0xC5 /* NB: codes C4 and CC are NOT SOF markers */ #define M_SOF6 0xC6 #define M_SOF7 0xC7 #define M_JPEG 0x08 /* reserved for extensions */ #define M_SOF9 0xC9 #define M_SOF10 0xCA #define M_SOF11 0xCB #define M_DAC 0xCC /* arithmetic table */ #define M_SOF13 0xCD #define M_SOF14 0xCE #define M_SOF15 0xCF #define M_RST0 0xD0 /* restart segment */ #define M_RST1 0xD1 #define M_RST2 0xD2 #define M_RST3 0xD3 #define M_RST4 0xD4 #define M_RST5 0xD5 #define M_RST6 0xD6 #define M_RST7 0xD7 #define M_SOI 0xD8 /* Start Of Image (beginning of datastream) */ #define M_EOI 0xD9 /* End Of Image (end of datastream) */ #define M_SOS 0xDA /* Start Of Scan (begins compressed data) */ #define M_DQT 0xDB #define M_DNL 0xDC #define M_DRI 0xDD #define M_DHP 0xDE #define M_EXP 0xDF #define M_APP0 0xE0 /* JPEG: 'JFIFF' AND (additional 'JFXX') */ #define M_EXIF 0xE1 /* Exif Attribute Information */ #define M_APP2 0xE2 /* Flash Pix Extension Data? */ #define M_APP3 0xE3 #define M_APP4 0xE4 #define M_APP5 0xE5 #define M_APP6 0xE6 #define M_APP7 0xE7 #define M_APP8 0xE8 #define M_APP9 0xE9 #define M_APP10 0xEA #define M_APP11 0xEB #define M_APP12 0xEC #define M_APP13 0xED /* IPTC International Press Telecommunications Council */ #define M_APP14 0xEE /* Software, Copyright? */ #define M_APP15 0xEF #define M_JPG0 0xF0 #define M_JPG1 0xF1 #define M_JPG2 0xF2 #define M_JPG3 0xF3 #define M_JPG4 0xF4 #define M_JPG5 0xF5 #define M_JPG6 0xF6 #define M_JPG7 0xF7 #define M_JPG8 0xF8 #define M_JPG9 0xF9 #define M_JPG10 0xFA #define M_JPG11 0xFB #define M_JPG12 0xFC #define M_JPG13 0xFD #define M_COM 0xFE /* COMment */ #define M_PSEUDO 0x123 /* Extra value. */ /* }}} */ /* {{{ jpeg2000 markers */ /* Markers x30 - x3F do not have a segment */ /* Markers x00, x01, xFE, xC0 - xDF ISO/IEC 10918-1 -> M_ */ /* Markers xF0 - xF7 ISO/IEC 10918-3 */ /* Markers xF7 - xF8 ISO/IEC 14495-1 */ /* XY=Main/Tile-header:(R:required, N:not_allowed, O:optional, L:last_marker) */ #define JC_SOC 0x4F /* NN, Start of codestream */ #define JC_SIZ 0x51 /* RN, Image and tile size */ #define JC_COD 0x52 /* RO, Codeing style defaulte */ #define JC_COC 0x53 /* OO, Coding style component */ #define JC_TLM 0x55 /* ON, Tile part length main header */ #define JC_PLM 0x57 /* ON, Packet length main header */ #define JC_PLT 0x58 /* NO, Packet length tile part header */ #define JC_QCD 0x5C /* RO, Quantization default */ #define JC_QCC 0x5D /* OO, Quantization component */ #define JC_RGN 0x5E /* OO, Region of interest */ #define JC_POD 0x5F /* OO, Progression order default */ #define JC_PPM 0x60 /* ON, Packed packet headers main header */ #define JC_PPT 0x61 /* NO, Packet packet headers tile part header */ #define JC_CME 0x64 /* OO, Comment: ""LL E "" E=0:binary, E=1:ascii */ #define JC_SOT 0x90 /* NR, Start of tile */ #define JC_SOP 0x91 /* NO, Start of packeter default */ #define JC_EPH 0x92 /* NO, End of packet header */ #define JC_SOD 0x93 /* NL, Start of data */ #define JC_EOC 0xD9 /* NN, End of codestream */ /* }}} */ /* {{{ exif_process_COM Process a COM marker. We want to print out the marker contents as legible text; we must guard against random junk and varying newline representations. */ static void exif_process_COM (image_info_type *image_info, char *value, size_t length TSRMLS_DC) { exif_iif_add_tag(image_info, SECTION_COMMENT, ""Comment"", TAG_COMPUTED_VALUE, TAG_FMT_STRING, length-2, value+2 TSRMLS_CC); } /* }}} */ /* {{{ exif_process_CME Process a CME marker. We want to print out the marker contents as legible text; we must guard against random junk and varying newline representations. */ #ifdef EXIF_JPEG2000 static void exif_process_CME (image_info_type *image_info, char *value, size_t length TSRMLS_DC) { if (length>3) { switch(value[2]) { case 0: exif_iif_add_tag(image_info, SECTION_COMMENT, ""Comment"", TAG_COMPUTED_VALUE, TAG_FMT_UNDEFINED, length, value TSRMLS_CC); break; case 1: exif_iif_add_tag(image_info, SECTION_COMMENT, ""Comment"", TAG_COMPUTED_VALUE, TAG_FMT_STRING, length, value); break; default: php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Undefined JPEG2000 comment encoding""); break; } } else { exif_iif_add_tag(image_info, SECTION_COMMENT, ""Comment"", TAG_COMPUTED_VALUE, TAG_FMT_UNDEFINED, 0, NULL); php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""JPEG2000 comment section too small""); } } #endif /* }}} */ /* {{{ exif_process_SOFn * Process a SOFn marker. This is useful for the image dimensions */ static void exif_process_SOFn (uchar *Data, int marker, jpeg_sof_info *result) { /* 0xFF SOSn SectLen(2) Bits(1) Height(2) Width(2) Channels(1) 3*Channels (1) */ result->bits_per_sample = Data[2]; result->height = php_jpg_get16(Data+3); result->width = php_jpg_get16(Data+5); result->num_components = Data[7]; /* switch (marker) { case M_SOF0: process = ""Baseline""; break; case M_SOF1: process = ""Extended sequential""; break; case M_SOF2: process = ""Progressive""; break; case M_SOF3: process = ""Lossless""; break; case M_SOF5: process = ""Differential sequential""; break; case M_SOF6: process = ""Differential progressive""; break; case M_SOF7: process = ""Differential lossless""; break; case M_SOF9: process = ""Extended sequential, arithmetic coding""; break; case M_SOF10: process = ""Progressive, arithmetic coding""; break; case M_SOF11: process = ""Lossless, arithmetic coding""; break; case M_SOF13: process = ""Differential sequential, arithmetic coding""; break; case M_SOF14: process = ""Differential progressive, arithmetic coding""; break; case M_SOF15: process = ""Differential lossless, arithmetic coding""; break; default: process = ""Unknown""; break; }*/ } /* }}} */ /* forward declarations */ static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start, char *offset_base, size_t IFDlength, size_t displacement, int section_index TSRMLS_DC); static int exif_process_IFD_TAG( image_info_type *ImageInfo, char *dir_entry, char *offset_base, size_t IFDlength, size_t displacement, int section_index, int ReadNextIFD, tag_table_type tag_table TSRMLS_DC); /* {{{ exif_get_markername Get name of marker */ #ifdef EXIF_DEBUG static char * exif_get_markername(int marker) { switch(marker) { case 0xC0: return ""SOF0""; case 0xC1: return ""SOF1""; case 0xC2: return ""SOF2""; case 0xC3: return ""SOF3""; case 0xC4: return ""DHT""; case 0xC5: return ""SOF5""; case 0xC6: return ""SOF6""; case 0xC7: return ""SOF7""; case 0xC9: return ""SOF9""; case 0xCA: return ""SOF10""; case 0xCB: return ""SOF11""; case 0xCD: return ""SOF13""; case 0xCE: return ""SOF14""; case 0xCF: return ""SOF15""; case 0xD8: return ""SOI""; case 0xD9: return ""EOI""; case 0xDA: return ""SOS""; case 0xDB: return ""DQT""; case 0xDC: return ""DNL""; case 0xDD: return ""DRI""; case 0xDE: return ""DHP""; case 0xDF: return ""EXP""; case 0xE0: return ""APP0""; case 0xE1: return ""EXIF""; case 0xE2: return ""FPIX""; case 0xE3: return ""APP3""; case 0xE4: return ""APP4""; case 0xE5: return ""APP5""; case 0xE6: return ""APP6""; case 0xE7: return ""APP7""; case 0xE8: return ""APP8""; case 0xE9: return ""APP9""; case 0xEA: return ""APP10""; case 0xEB: return ""APP11""; case 0xEC: return ""APP12""; case 0xED: return ""APP13""; case 0xEE: return ""APP14""; case 0xEF: return ""APP15""; case 0xF0: return ""JPG0""; case 0xFD: return ""JPG13""; case 0xFE: return ""COM""; case 0x01: return ""TEM""; } return ""Unknown""; } #endif /* }}} */ /* {{{ proto string exif_tagname(index) Get headername for index or false if not defined */ PHP_FUNCTION(exif_tagname) { long tag; char *szTemp; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""l"", &tag) == FAILURE) { return; } szTemp = exif_get_tagname(tag, NULL, 0, tag_table_IFD TSRMLS_CC); if (tag < 0 || !szTemp || !szTemp[0]) { RETURN_FALSE; } RETURN_STRING(szTemp, 1) } /* }}} */ /* {{{ exif_ifd_make_value * Create a value for an ifd from an info_data pointer */ static void* exif_ifd_make_value(image_info_data *info_data, int motorola_intel TSRMLS_DC) { size_t byte_count; char *value_ptr, *data_ptr; size_t i; image_info_value *info_value; byte_count = php_tiff_bytes_per_format[info_data->format] * info_data->length; value_ptr = safe_emalloc(max(byte_count, 4), 1, 0); memset(value_ptr, 0, 4); if (!info_data->length) { return value_ptr; } if (info_data->format == TAG_FMT_UNDEFINED || info_data->format == TAG_FMT_STRING || (byte_count>1 && (info_data->format == TAG_FMT_BYTE || info_data->format == TAG_FMT_SBYTE)) ) { memmove(value_ptr, info_data->value.s, byte_count); return value_ptr; } else if (info_data->format == TAG_FMT_BYTE) { *value_ptr = info_data->value.u; return value_ptr; } else if (info_data->format == TAG_FMT_SBYTE) { *value_ptr = info_data->value.i; return value_ptr; } else { data_ptr = value_ptr; for(i=0; ilength; i++) { if (info_data->length==1) { info_value = &info_data->value; } else { info_value = &info_data->value.list[i]; } switch(info_data->format) { case TAG_FMT_USHORT: php_ifd_set16u(data_ptr, info_value->u, motorola_intel); data_ptr += 2; break; case TAG_FMT_ULONG: php_ifd_set32u(data_ptr, info_value->u, motorola_intel); data_ptr += 4; break; case TAG_FMT_SSHORT: php_ifd_set16u(data_ptr, info_value->i, motorola_intel); data_ptr += 2; break; case TAG_FMT_SLONG: php_ifd_set32u(data_ptr, info_value->i, motorola_intel); data_ptr += 4; break; case TAG_FMT_URATIONAL: php_ifd_set32u(data_ptr, info_value->sr.num, motorola_intel); php_ifd_set32u(data_ptr+4, info_value->sr.den, motorola_intel); data_ptr += 8; break; case TAG_FMT_SRATIONAL: php_ifd_set32u(data_ptr, info_value->ur.num, motorola_intel); php_ifd_set32u(data_ptr+4, info_value->ur.den, motorola_intel); data_ptr += 8; break; case TAG_FMT_SINGLE: memmove(data_ptr, &info_value->f, 4); data_ptr += 4; break; case TAG_FMT_DOUBLE: memmove(data_ptr, &info_value->d, 8); data_ptr += 8; break; } } } return value_ptr; } /* }}} */ /* {{{ exif_thumbnail_build * Check and build thumbnail */ static void exif_thumbnail_build(image_info_type *ImageInfo TSRMLS_DC) { size_t new_size, new_move, new_value; char *new_data; void *value_ptr; int i, byte_count; image_info_list *info_list; image_info_data *info_data; #ifdef EXIF_DEBUG char tagname[64]; #endif if (!ImageInfo->read_thumbnail || !ImageInfo->Thumbnail.offset || !ImageInfo->Thumbnail.size) { return; /* ignore this call */ } #ifdef EXIF_DEBUG exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, ""Thumbnail: filetype = %d"", ImageInfo->Thumbnail.filetype); #endif switch(ImageInfo->Thumbnail.filetype) { default: case IMAGE_FILETYPE_JPEG: /* done */ break; case IMAGE_FILETYPE_TIFF_II: case IMAGE_FILETYPE_TIFF_MM: info_list = &ImageInfo->info_list[SECTION_THUMBNAIL]; new_size = 8 + 2 + info_list->count * 12 + 4; #ifdef EXIF_DEBUG exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, ""Thumbnail: size of signature + directory(%d): 0x%02X"", info_list->count, new_size); #endif new_value= new_size; /* offset for ifd values outside ifd directory */ for (i=0; icount; i++) { info_data = &info_list->list[i]; byte_count = php_tiff_bytes_per_format[info_data->format] * info_data->length; if (byte_count > 4) { new_size += byte_count; } } new_move = new_size; new_data = safe_erealloc(ImageInfo->Thumbnail.data, 1, ImageInfo->Thumbnail.size, new_size); ImageInfo->Thumbnail.data = new_data; memmove(ImageInfo->Thumbnail.data + new_move, ImageInfo->Thumbnail.data, ImageInfo->Thumbnail.size); ImageInfo->Thumbnail.size += new_size; /* fill in data */ if (ImageInfo->motorola_intel) { memmove(new_data, ""MM\x00\x2a\x00\x00\x00\x08"", 8); } else { memmove(new_data, ""II\x2a\x00\x08\x00\x00\x00"", 8); } new_data += 8; php_ifd_set16u(new_data, info_list->count, ImageInfo->motorola_intel); new_data += 2; for (i=0; icount; i++) { info_data = &info_list->list[i]; byte_count = php_tiff_bytes_per_format[info_data->format] * info_data->length; #ifdef EXIF_DEBUG exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, ""Thumbnail: process tag(x%04X=%s): %s%s (%d bytes)"", info_data->tag, exif_get_tagname(info_data->tag, tagname, -12, tag_table_IFD TSRMLS_CC), (info_data->length>1)&&info_data->format!=TAG_FMT_UNDEFINED&&info_data->format!=TAG_FMT_STRING?""ARRAY OF "":"""", exif_get_tagformat(info_data->format), byte_count); #endif if (info_data->tag==TAG_STRIP_OFFSETS || info_data->tag==TAG_JPEG_INTERCHANGE_FORMAT) { php_ifd_set16u(new_data + 0, info_data->tag, ImageInfo->motorola_intel); php_ifd_set16u(new_data + 2, TAG_FMT_ULONG, ImageInfo->motorola_intel); php_ifd_set32u(new_data + 4, 1, ImageInfo->motorola_intel); php_ifd_set32u(new_data + 8, new_move, ImageInfo->motorola_intel); } else { php_ifd_set16u(new_data + 0, info_data->tag, ImageInfo->motorola_intel); php_ifd_set16u(new_data + 2, info_data->format, ImageInfo->motorola_intel); php_ifd_set32u(new_data + 4, info_data->length, ImageInfo->motorola_intel); value_ptr = exif_ifd_make_value(info_data, ImageInfo->motorola_intel TSRMLS_CC); if (byte_count <= 4) { memmove(new_data+8, value_ptr, 4); } else { php_ifd_set32u(new_data+8, new_value, ImageInfo->motorola_intel); #ifdef EXIF_DEBUG exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, ""Thumbnail: writing with value offset: 0x%04X + 0x%02X"", new_value, byte_count); #endif memmove(ImageInfo->Thumbnail.data+new_value, value_ptr, byte_count); new_value += byte_count; } efree(value_ptr); } new_data += 12; } memset(new_data, 0, 4); /* next ifd pointer */ #ifdef EXIF_DEBUG exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, ""Thumbnail: created""); #endif break; } } /* }}} */ /* {{{ exif_thumbnail_extract * Grab the thumbnail, corrected */ static void exif_thumbnail_extract(image_info_type *ImageInfo, char *offset, size_t length TSRMLS_DC) { if (ImageInfo->Thumbnail.data) { exif_error_docref(""exif_read_data#error_mult_thumb"" EXIFERR_CC, ImageInfo, E_WARNING, ""Multiple possible thumbnails""); return; /* Should not happen */ } if (!ImageInfo->read_thumbnail) { return; /* ignore this call */ } /* according to exif2.1, the thumbnail is not supposed to be greater than 64K */ if (ImageInfo->Thumbnail.size >= 65536 || ImageInfo->Thumbnail.size <= 0 || ImageInfo->Thumbnail.offset <= 0 ) { exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, ""Illegal thumbnail size/offset""); return; } /* Check to make sure we are not going to go past the ExifLength */ if ((ImageInfo->Thumbnail.offset + ImageInfo->Thumbnail.size) > length) { EXIF_ERRLOG_THUMBEOF(ImageInfo) return; } ImageInfo->Thumbnail.data = estrndup(offset + ImageInfo->Thumbnail.offset, ImageInfo->Thumbnail.size); exif_thumbnail_build(ImageInfo TSRMLS_CC); } /* }}} */ /* {{{ exif_process_undefined * Copy a string/buffer in Exif header to a character string and return length of allocated buffer if any. */ static int exif_process_undefined(char **result, char *value, size_t byte_count TSRMLS_DC) { /* we cannot use strlcpy - here the problem is that we have to copy NUL * chars up to byte_count, we also have to add a single NUL character to * force end of string. * estrndup does not return length */ if (byte_count) { (*result) = estrndup(value, byte_count); /* NULL @ byte_count!!! */ return byte_count+1; } return 0; } /* }}} */ /* {{{ exif_process_string_raw * Copy a string in Exif header to a character string returns length of allocated buffer if any. */ static int exif_process_string_raw(char **result, char *value, size_t byte_count) { /* we cannot use strlcpy - here the problem is that we have to copy NUL * chars up to byte_count, we also have to add a single NUL character to * force end of string. */ if (byte_count) { (*result) = safe_emalloc(byte_count, 1, 1); memcpy(*result, value, byte_count); (*result)[byte_count] = '\0'; return byte_count+1; } return 0; } /* }}} */ /* {{{ exif_process_string * Copy a string in Exif header to a character string and return length of allocated buffer if any. * In contrast to exif_process_string this function does always return a string buffer */ static int exif_process_string(char **result, char *value, size_t byte_count TSRMLS_DC) { /* we cannot use strlcpy - here the problem is that we cannot use strlen to * determin length of string and we cannot use strlcpy with len=byte_count+1 * because then we might get into an EXCEPTION if we exceed an allocated * memory page...so we use php_strnlen in conjunction with memcpy and add the NUL * char. * estrdup would sometimes allocate more memory and does not return length */ if ((byte_count=php_strnlen(value, byte_count)) > 0) { return exif_process_undefined(result, value, byte_count TSRMLS_CC); } (*result) = estrndup("""", 1); /* force empty string */ return byte_count+1; } /* }}} */ /* {{{ exif_process_user_comment * Process UserComment in IFD. */ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoPtr, char **pszEncoding, char *szValuePtr, int ByteCount TSRMLS_DC) { int a; char *decode; size_t len;; *pszEncoding = NULL; /* Copy the comment */ if (ByteCount>=8) { if (!memcmp(szValuePtr, ""UNICODE\0"", 8)) { *pszEncoding = estrdup((const char*)szValuePtr); szValuePtr = szValuePtr+8; ByteCount -= 8; /* First try to detect BOM: ZERO WIDTH NOBREAK SPACE (FEFF 16) * since we have no encoding support for the BOM yet we skip that. */ if (!memcmp(szValuePtr, ""\xFE\xFF"", 2)) { decode = ""UCS-2BE""; szValuePtr = szValuePtr+2; ByteCount -= 2; } else if (!memcmp(szValuePtr, ""\xFF\xFE"", 2)) { decode = ""UCS-2LE""; szValuePtr = szValuePtr+2; ByteCount -= 2; } else if (ImageInfo->motorola_intel) { decode = ImageInfo->decode_unicode_be; } else { decode = ImageInfo->decode_unicode_le; } /* XXX this will fail again if encoding_converter returns on error something different than SIZE_MAX */ if (zend_multibyte_encoding_converter( (unsigned char**)pszInfoPtr, &len, (unsigned char*)szValuePtr, ByteCount, zend_multibyte_fetch_encoding(ImageInfo->encode_unicode TSRMLS_CC), zend_multibyte_fetch_encoding(decode TSRMLS_CC) TSRMLS_CC) == (size_t)-1) { len = exif_process_string_raw(pszInfoPtr, szValuePtr, ByteCount); } return len; } else if (!memcmp(szValuePtr, ""ASCII\0\0\0"", 8)) { *pszEncoding = estrdup((const char*)szValuePtr); szValuePtr = szValuePtr+8; ByteCount -= 8; } else if (!memcmp(szValuePtr, ""JIS\0\0\0\0\0"", 8)) { /* JIS should be tanslated to MB or we leave it to the user - leave it to the user */ *pszEncoding = estrdup((const char*)szValuePtr); szValuePtr = szValuePtr+8; ByteCount -= 8; /* XXX this will fail again if encoding_converter returns on error something different than SIZE_MAX */ if (zend_multibyte_encoding_converter( (unsigned char**)pszInfoPtr, &len, (unsigned char*)szValuePtr, ByteCount, zend_multibyte_fetch_encoding(ImageInfo->encode_jis TSRMLS_CC), zend_multibyte_fetch_encoding(ImageInfo->motorola_intel ? ImageInfo->decode_jis_be : ImageInfo->decode_jis_le TSRMLS_CC) TSRMLS_CC) == (size_t)-1) { len = exif_process_string_raw(pszInfoPtr, szValuePtr, ByteCount); } return len; } else if (!memcmp(szValuePtr, ""\0\0\0\0\0\0\0\0"", 8)) { /* 8 NULL means undefined and should be ASCII... */ *pszEncoding = estrdup(""UNDEFINED""); szValuePtr = szValuePtr+8; ByteCount -= 8; } } /* Olympus has this padded with trailing spaces. Remove these first. */ if (ByteCount>0) { for (a=ByteCount-1;a && szValuePtr[a]==' ';a--) { (szValuePtr)[a] = '\0'; } } /* normal text without encoding */ exif_process_string(pszInfoPtr, szValuePtr, ByteCount TSRMLS_CC); return strlen(*pszInfoPtr); } /* }}} */ /* {{{ exif_process_unicode * Process unicode field in IFD. */ static int exif_process_unicode(image_info_type *ImageInfo, xp_field_type *xp_field, int tag, char *szValuePtr, int ByteCount TSRMLS_DC) { xp_field->tag = tag; xp_field->value = NULL; /* XXX this will fail again if encoding_converter returns on error something different than SIZE_MAX */ if (zend_multibyte_encoding_converter( (unsigned char**)&xp_field->value, &xp_field->size, (unsigned char*)szValuePtr, ByteCount, zend_multibyte_fetch_encoding(ImageInfo->encode_unicode TSRMLS_CC), zend_multibyte_fetch_encoding(ImageInfo->motorola_intel ? ImageInfo->decode_unicode_be : ImageInfo->decode_unicode_le TSRMLS_CC) TSRMLS_CC) == (size_t)-1) { xp_field->size = exif_process_string_raw(&xp_field->value, szValuePtr, ByteCount); } return xp_field->size; } /* }}} */ /* {{{ exif_process_IFD_in_MAKERNOTE * Process nested IFDs directories in Maker Note. */ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * value_ptr, int value_len, char *offset_base, size_t IFDlength, size_t displacement TSRMLS_DC) { int de, i=0, section_index = SECTION_MAKERNOTE; int NumDirEntries, old_motorola_intel, offset_diff; const maker_note_type *maker_note; char *dir_start; for (i=0; i<=sizeof(maker_note_array)/sizeof(maker_note_type); i++) { if (i==sizeof(maker_note_array)/sizeof(maker_note_type)) return FALSE; maker_note = maker_note_array+i; /*exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, ""check (%s,%s)"", maker_note->make?maker_note->make:"""", maker_note->model?maker_note->model:"""");*/ if (maker_note->make && (!ImageInfo->make || strcmp(maker_note->make, ImageInfo->make))) continue; if (maker_note->model && (!ImageInfo->model || strcmp(maker_note->model, ImageInfo->model))) continue; if (maker_note->id_string && strncmp(maker_note->id_string, value_ptr, maker_note->id_string_len)) continue; break; } dir_start = value_ptr + maker_note->offset; #ifdef EXIF_DEBUG exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, ""Process %s @x%04X + 0x%04X=%d: %s"", exif_get_sectionname(section_index), (int)dir_start-(int)offset_base+maker_note->offset+displacement, value_len, value_len, exif_char_dump(value_ptr, value_len, (int)dir_start-(int)offset_base+maker_note->offset+displacement)); #endif ImageInfo->sections_found |= FOUND_MAKERNOTE; old_motorola_intel = ImageInfo->motorola_intel; switch (maker_note->byte_order) { case MN_ORDER_INTEL: ImageInfo->motorola_intel = 0; break; case MN_ORDER_MOTOROLA: ImageInfo->motorola_intel = 1; break; default: case MN_ORDER_NORMAL: break; } NumDirEntries = php_ifd_get16u(dir_start, ImageInfo->motorola_intel); switch (maker_note->offset_mode) { case MN_OFFSET_MAKER: offset_base = value_ptr; break; case MN_OFFSET_GUESS: offset_diff = 2 + NumDirEntries*12 + 4 - php_ifd_get32u(dir_start+10, ImageInfo->motorola_intel); #ifdef EXIF_DEBUG exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, ""Using automatic offset correction: 0x%04X"", ((int)dir_start-(int)offset_base+maker_note->offset+displacement) + offset_diff); #endif offset_base = value_ptr + offset_diff; break; default: case MN_OFFSET_NORMAL: break; } if ((2+NumDirEntries*12) > value_len) { exif_error_docref(""exif_read_data#error_ifd"" EXIFERR_CC, ImageInfo, E_WARNING, ""Illegal IFD size: 2 + x%04X*12 = x%04X > x%04X"", NumDirEntries, 2+NumDirEntries*12, value_len); return FALSE; } for (de=0;detag_table TSRMLS_CC)) { return FALSE; } } ImageInfo->motorola_intel = old_motorola_intel; /* NextDirOffset (must be NULL) = php_ifd_get32u(dir_start+2+12*de, ImageInfo->motorola_intel);*/ #ifdef EXIF_DEBUG exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, ""Subsection %s done"", exif_get_sectionname(SECTION_MAKERNOTE)); #endif return TRUE; } /* }}} */ /* {{{ exif_process_IFD_TAG * Process one of the nested IFDs directories. */ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, char *offset_base, size_t IFDlength, size_t displacement, int section_index, int ReadNextIFD, tag_table_type tag_table TSRMLS_DC) { size_t length; int tag, format, components; char *value_ptr, tagname[64], cbuf[32], *outside=NULL; size_t byte_count, offset_val, fpos, fgot; int64_t byte_count_signed; xp_field_type *tmp_xp; #ifdef EXIF_DEBUG char *dump_data; int dump_free; #endif /* EXIF_DEBUG */ /* Protect against corrupt headers */ if (ImageInfo->ifd_nesting_level > MAX_IFD_NESTING_LEVEL) { exif_error_docref(""exif_read_data#error_ifd"" EXIFERR_CC, ImageInfo, E_WARNING, ""corrupt EXIF header: maximum directory nesting level reached""); return FALSE; } ImageInfo->ifd_nesting_level++; tag = php_ifd_get16u(dir_entry, ImageInfo->motorola_intel); format = php_ifd_get16u(dir_entry+2, ImageInfo->motorola_intel); components = php_ifd_get32u(dir_entry+4, ImageInfo->motorola_intel); if (!format || format > NUM_FORMATS) { /* (-1) catches illegal zero case as unsigned underflows to positive large. */ exif_error_docref(""exif_read_data#error_ifd"" EXIFERR_CC, ImageInfo, E_WARNING, ""Process tag(x%04X=%s): Illegal format code 0x%04X, suppose BYTE"", tag, exif_get_tagname(tag, tagname, -12, tag_table TSRMLS_CC), format); format = TAG_FMT_BYTE; /*return TRUE;*/ } if (components < 0) { exif_error_docref(""exif_read_data#error_ifd"" EXIFERR_CC, ImageInfo, E_WARNING, ""Process tag(x%04X=%s): Illegal components(%ld)"", tag, exif_get_tagname(tag, tagname, -12, tag_table TSRMLS_CC), components); return FALSE; } byte_count_signed = (int64_t)components * php_tiff_bytes_per_format[format]; if (byte_count_signed < 0 || (byte_count_signed > INT32_MAX)) { exif_error_docref(""exif_read_data#error_ifd"" EXIFERR_CC, ImageInfo, E_WARNING, ""Process tag(x%04X=%s): Illegal byte_count"", tag, exif_get_tagname(tag, tagname, -12, tag_table TSRMLS_CC)); return FALSE; } byte_count = (size_t)byte_count_signed; if (byte_count > 4) { offset_val = php_ifd_get32u(dir_entry+8, ImageInfo->motorola_intel); /* If its bigger than 4 bytes, the dir entry contains an offset. */ value_ptr = offset_base+offset_val; /* dir_entry is ImageInfo->file.list[sn].data+2+i*12 offset_base is ImageInfo->file.list[sn].data-dir_offset dir_entry - offset_base is dir_offset+2+i*12 */ if (byte_count > IFDlength || offset_val > IFDlength-byte_count || value_ptr < dir_entry || offset_val < (size_t)(dir_entry-offset_base)) { /* It is important to check for IMAGE_FILETYPE_TIFF * JPEG does not use absolute pointers instead its pointers are * relative to the start of the TIFF header in APP1 section. */ if (byte_count > ImageInfo->FileSize || offset_val>ImageInfo->FileSize-byte_count || (ImageInfo->FileType!=IMAGE_FILETYPE_TIFF_II && ImageInfo->FileType!=IMAGE_FILETYPE_TIFF_MM && ImageInfo->FileType!=IMAGE_FILETYPE_JPEG)) { if (value_ptr < dir_entry) { /* we can read this if offset_val > 0 */ /* some files have their values in other parts of the file */ exif_error_docref(""exif_read_data#error_ifd"" EXIFERR_CC, ImageInfo, E_WARNING, ""Process tag(x%04X=%s): Illegal pointer offset(x%04X < x%04X)"", tag, exif_get_tagname(tag, tagname, -12, tag_table TSRMLS_CC), offset_val, dir_entry); } else { /* this is for sure not allowed */ /* exception are IFD pointers */ exif_error_docref(""exif_read_data#error_ifd"" EXIFERR_CC, ImageInfo, E_WARNING, ""Process tag(x%04X=%s): Illegal pointer offset(x%04X + x%04X = x%04X > x%04X)"", tag, exif_get_tagname(tag, tagname, -12, tag_table TSRMLS_CC), offset_val, byte_count, offset_val+byte_count, IFDlength); } return FALSE; } if (byte_count>sizeof(cbuf)) { /* mark as outside range and get buffer */ value_ptr = safe_emalloc(byte_count, 1, 0); outside = value_ptr; } else { /* In most cases we only access a small range so * it is faster to use a static buffer there * BUT it offers also the possibility to have * pointers read without the need to free them * explicitley before returning. */ memset(&cbuf, 0, sizeof(cbuf)); value_ptr = cbuf; } fpos = php_stream_tell(ImageInfo->infile); php_stream_seek(ImageInfo->infile, offset_val, SEEK_SET); fgot = php_stream_tell(ImageInfo->infile); if (fgot!=offset_val) { EFREE_IF(outside); exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, ""Wrong file pointer: 0x%08X != 0x%08X"", fgot, offset_val); return FALSE; } fgot = php_stream_read(ImageInfo->infile, value_ptr, byte_count); php_stream_seek(ImageInfo->infile, fpos, SEEK_SET); if (fgotsections_found |= FOUND_ANY_TAG; #ifdef EXIF_DEBUG dump_data = exif_dump_data(&dump_free, format, components, length, ImageInfo->motorola_intel, value_ptr TSRMLS_CC); exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, ""Process tag(x%04X=%s,@x%04X + x%04X(=%d)): %s%s %s"", tag, exif_get_tagname(tag, tagname, -12, tag_table TSRMLS_CC), offset_val+displacement, byte_count, byte_count, (components>1)&&format!=TAG_FMT_UNDEFINED&&format!=TAG_FMT_STRING?""ARRAY OF "":"""", exif_get_tagformat(format), dump_data); if (dump_free) { efree(dump_data); } #endif if (section_index==SECTION_THUMBNAIL) { if (!ImageInfo->Thumbnail.data) { switch(tag) { case TAG_IMAGEWIDTH: case TAG_COMP_IMAGE_WIDTH: ImageInfo->Thumbnail.width = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC); break; case TAG_IMAGEHEIGHT: case TAG_COMP_IMAGE_HEIGHT: ImageInfo->Thumbnail.height = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC); break; case TAG_STRIP_OFFSETS: case TAG_JPEG_INTERCHANGE_FORMAT: /* accept both formats */ ImageInfo->Thumbnail.offset = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC); break; case TAG_STRIP_BYTE_COUNTS: if (ImageInfo->FileType == IMAGE_FILETYPE_TIFF_II || ImageInfo->FileType == IMAGE_FILETYPE_TIFF_MM) { ImageInfo->Thumbnail.filetype = ImageInfo->FileType; } else { /* motorola is easier to read */ ImageInfo->Thumbnail.filetype = IMAGE_FILETYPE_TIFF_MM; } ImageInfo->Thumbnail.size = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC); break; case TAG_JPEG_INTERCHANGE_FORMAT_LEN: if (ImageInfo->Thumbnail.filetype == IMAGE_FILETYPE_UNKNOWN) { ImageInfo->Thumbnail.filetype = IMAGE_FILETYPE_JPEG; ImageInfo->Thumbnail.size = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC); } break; } } } else { if (section_index==SECTION_IFD0 || section_index==SECTION_EXIF) switch(tag) { case TAG_COPYRIGHT: /* check for "" NUL NUL"" */ if (byte_count>1 && (length=php_strnlen(value_ptr, byte_count)) > 0) { if (lengthCopyrightPhotographer = estrdup(value_ptr); ImageInfo->CopyrightEditor = estrndup(value_ptr+length+1, byte_count-length-1); spprintf(&ImageInfo->Copyright, 0, ""%s, %s"", value_ptr, value_ptr+length+1); /* format = TAG_FMT_UNDEFINED; this musn't be ASCII */ /* but we are not supposed to change this */ /* keep in mind that image_info does not store editor value */ } else { ImageInfo->Copyright = estrndup(value_ptr, byte_count); } } break; case TAG_USERCOMMENT: ImageInfo->UserCommentLength = exif_process_user_comment(ImageInfo, &(ImageInfo->UserComment), &(ImageInfo->UserCommentEncoding), value_ptr, byte_count TSRMLS_CC); break; case TAG_XP_TITLE: case TAG_XP_COMMENTS: case TAG_XP_AUTHOR: case TAG_XP_KEYWORDS: case TAG_XP_SUBJECT: tmp_xp = (xp_field_type*)safe_erealloc(ImageInfo->xp_fields.list, (ImageInfo->xp_fields.count+1), sizeof(xp_field_type), 0); ImageInfo->sections_found |= FOUND_WINXP; ImageInfo->xp_fields.list = tmp_xp; ImageInfo->xp_fields.count++; exif_process_unicode(ImageInfo, &(ImageInfo->xp_fields.list[ImageInfo->xp_fields.count-1]), tag, value_ptr, byte_count TSRMLS_CC); break; case TAG_FNUMBER: /* Simplest way of expressing aperture, so I trust it the most. (overwrite previously computed value if there is one) */ ImageInfo->ApertureFNumber = (float)exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC); break; case TAG_APERTURE: case TAG_MAX_APERTURE: /* More relevant info always comes earlier, so only use this field if we don't have appropriate aperture information yet. */ if (ImageInfo->ApertureFNumber == 0) { ImageInfo->ApertureFNumber = (float)exp(exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC)*log(2)*0.5); } break; case TAG_SHUTTERSPEED: /* More complicated way of expressing exposure time, so only use this value if we don't already have it from somewhere else. SHUTTERSPEED comes after EXPOSURE TIME */ if (ImageInfo->ExposureTime == 0) { ImageInfo->ExposureTime = (float)(1/exp(exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC)*log(2))); } break; case TAG_EXPOSURETIME: ImageInfo->ExposureTime = -1; break; case TAG_COMP_IMAGE_WIDTH: ImageInfo->ExifImageWidth = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC); break; case TAG_FOCALPLANE_X_RES: ImageInfo->FocalplaneXRes = exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC); break; case TAG_SUBJECT_DISTANCE: /* Inidcates the distacne the autofocus camera is focused to. Tends to be less accurate as distance increases. */ ImageInfo->Distance = (float)exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC); break; case TAG_FOCALPLANE_RESOLUTION_UNIT: switch((int)exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC)) { case 1: ImageInfo->FocalplaneUnits = 25.4; break; /* inch */ case 2: /* According to the information I was using, 2 measn meters. But looking at the Cannon powershot's files, inches is the only sensible value. */ ImageInfo->FocalplaneUnits = 25.4; break; case 3: ImageInfo->FocalplaneUnits = 10; break; /* centimeter */ case 4: ImageInfo->FocalplaneUnits = 1; break; /* milimeter */ case 5: ImageInfo->FocalplaneUnits = .001; break; /* micrometer */ } break; case TAG_SUB_IFD: if (format==TAG_FMT_IFD) { /* If this is called we are either in a TIFFs thumbnail or a JPEG where we cannot handle it */ /* TIFF thumbnail: our data structure cannot store a thumbnail of a thumbnail */ /* JPEG do we have the data area and what to do with it */ exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, ""Skip SUB IFD""); } break; case TAG_MAKE: ImageInfo->make = estrndup(value_ptr, byte_count); break; case TAG_MODEL: ImageInfo->model = estrndup(value_ptr, byte_count); break; case TAG_MAKER_NOTE: exif_process_IFD_in_MAKERNOTE(ImageInfo, value_ptr, byte_count, offset_base, IFDlength, displacement TSRMLS_CC); break; case TAG_EXIF_IFD_POINTER: case TAG_GPS_IFD_POINTER: case TAG_INTEROP_IFD_POINTER: if (ReadNextIFD) { char *Subdir_start; int sub_section_index = 0; switch(tag) { case TAG_EXIF_IFD_POINTER: #ifdef EXIF_DEBUG exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, ""Found EXIF""); #endif ImageInfo->sections_found |= FOUND_EXIF; sub_section_index = SECTION_EXIF; break; case TAG_GPS_IFD_POINTER: #ifdef EXIF_DEBUG exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, ""Found GPS""); #endif ImageInfo->sections_found |= FOUND_GPS; sub_section_index = SECTION_GPS; break; case TAG_INTEROP_IFD_POINTER: #ifdef EXIF_DEBUG exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, ""Found INTEROPERABILITY""); #endif ImageInfo->sections_found |= FOUND_INTEROP; sub_section_index = SECTION_INTEROP; break; } Subdir_start = offset_base + php_ifd_get32u(value_ptr, ImageInfo->motorola_intel); if (Subdir_start < offset_base || Subdir_start > offset_base+IFDlength) { exif_error_docref(""exif_read_data#error_ifd"" EXIFERR_CC, ImageInfo, E_WARNING, ""Illegal IFD Pointer""); return FALSE; } if (!exif_process_IFD_in_JPEG(ImageInfo, Subdir_start, offset_base, IFDlength, displacement, sub_section_index TSRMLS_CC)) { return FALSE; } #ifdef EXIF_DEBUG exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, ""Subsection %s done"", exif_get_sectionname(sub_section_index)); #endif } } } exif_iif_add_tag(ImageInfo, section_index, exif_get_tagname(tag, tagname, sizeof(tagname), tag_table TSRMLS_CC), tag, format, components, value_ptr TSRMLS_CC); EFREE_IF(outside); return TRUE; } /* }}} */ /* {{{ exif_process_IFD_in_JPEG * Process one of the nested IFDs directories. */ static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start, char *offset_base, size_t IFDlength, size_t displacement, int section_index TSRMLS_DC) { int de; int NumDirEntries; int NextDirOffset; #ifdef EXIF_DEBUG exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, ""Process %s (x%04X(=%d))"", exif_get_sectionname(section_index), IFDlength, IFDlength); #endif ImageInfo->sections_found |= FOUND_IFD0; NumDirEntries = php_ifd_get16u(dir_start, ImageInfo->motorola_intel); if ((dir_start+2+NumDirEntries*12) > (offset_base+IFDlength)) { if (!exif_process_IFD_TAG(ImageInfo, dir_start + 2 + 12 * de, offset_base, IFDlength, displacement, section_index, 1, exif_get_tag_table(section_index) TSRMLS_CC)) { return FALSE; } } /* * Ignore IFD2 if it purportedly exists */ if (section_index == SECTION_THUMBNAIL) { return TRUE; } /* * Hack to make it process IDF1 I hope * There are 2 IDFs, the second one holds the keys (0x0201 and 0x0202) to the thumbnail */ NextDirOffset = php_ifd_get32u(dir_start+2+12*de, ImageInfo->motorola_intel); if (NextDirOffset) { * Hack to make it process IDF1 I hope * There are 2 IDFs, the second one holds the keys (0x0201 and 0x0202) to the thumbnail */ NextDirOffset = php_ifd_get32u(dir_start+2+12*de, ImageInfo->motorola_intel); if (NextDirOffset) { /* the next line seems false but here IFDlength means length of all IFDs */ #ifdef EXIF_DEBUG exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, ""Thumbnail size: 0x%04X"", ImageInfo->Thumbnail.size); #endif if (ImageInfo->Thumbnail.filetype != IMAGE_FILETYPE_UNKNOWN && ImageInfo->Thumbnail.size && ImageInfo->Thumbnail.offset && ImageInfo->read_thumbnail ) { exif_thumbnail_extract(ImageInfo, offset_base, IFDlength TSRMLS_CC); } return TRUE; } else { return FALSE; } } return TRUE; } /* }}} */ /* {{{ exif_process_TIFF_in_JPEG Process a TIFF header in a JPEG file */ static void exif_process_TIFF_in_JPEG(image_info_type *ImageInfo, char *CharBuf, size_t length, size_t displacement TSRMLS_DC) { unsigned exif_value_2a, offset_of_ifd; /* set the thumbnail stuff to nothing so we can test to see if they get set up */ if (memcmp(CharBuf, ""II"", 2) == 0) { ImageInfo->motorola_intel = 0; } else if (memcmp(CharBuf, ""MM"", 2) == 0) { ImageInfo->motorola_intel = 1; } else { exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, ""Invalid TIFF alignment marker""); return; } /* Check the next two values for correctness. */ exif_value_2a = php_ifd_get16u(CharBuf+2, ImageInfo->motorola_intel); offset_of_ifd = php_ifd_get32u(CharBuf+4, ImageInfo->motorola_intel); if ( exif_value_2a != 0x2a || offset_of_ifd < 0x08) { exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, ""Invalid TIFF start (1)""); return; } } /* Check the next two values for correctness. */ exif_value_2a = php_ifd_get16u(CharBuf+2, ImageInfo->motorola_intel); offset_of_ifd = php_ifd_get32u(CharBuf+4, ImageInfo->motorola_intel); if ( exif_value_2a != 0x2a || offset_of_ifd < 0x08) { exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, ""Invalid TIFF start (1)""); return; } /* Compute the CCD width, in milimeters. */ if (ImageInfo->FocalplaneXRes != 0) { ImageInfo->CCDWidth = (float)(ImageInfo->ExifImageWidth * ImageInfo->FocalplaneUnits / ImageInfo->FocalplaneXRes); } } /* }}} */ ",1 "void GLES2DecoderImpl::OnFboChanged() const { if (workarounds().restore_scissor_on_fbo_change) state_.fbo_binding_for_scissor_workaround_dirty_ = true; if (workarounds().gl_begin_gl_end_on_fbo_change_to_backbuffer) { GLint bound_fbo_unsigned = -1; glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &bound_fbo_unsigned); GLuint bound_fbo = static_cast(bound_fbo_unsigned); if (surface_ && surface_->GetBackingFrameBufferObject() == bound_fbo) surface_->NotifyWasBound(); } } ",0 "void V8TestObject::ActivityLoggingAccessForAllWorldsLongAttributeAttributeSetterCallback( const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_activityLoggingAccessForAllWorldsLongAttribute_Setter""); v8::Local v8_value = info[0]; ScriptState* script_state = ScriptState::ForRelevantRealm(info); V8PerContextData* context_data = script_state->PerContextData(); if (context_data && context_data->ActivityLogger()) { context_data->ActivityLogger()->LogSetter(""TestObject.activityLoggingAccessForAllWorldsLongAttribute"", v8_value); } test_object_v8_internal::ActivityLoggingAccessForAllWorldsLongAttributeAttributeSetter(v8_value, info); } ",0 "INST_HANDLER (andi) { // ANDI Rd, K if (len < 2) { return; } int d = ((buf[0] >> 4) & 0xf) + 16; int k = ((buf[1] & 0x0f) << 4) | (buf[0] & 0x0f); op->val = k; ESIL_A (""%d,r%d,&,"", k, d); // 0: Rd & Rr __generic_bitop_flags (op); // up flags ESIL_A (""r%d,=,"", d); // Rd = Result } ",0 "void RenderView::SendExtensionRequest(const std::string& name, const ListValue& args, const GURL& source_url, int request_id, bool has_callback) { Send(new ViewHostMsg_ExtensionRequest(routing_id_, name, args, source_url, request_id, has_callback)); } ",0 "static int ffs_func_revmap_intf(struct ffs_function *func, u8 intf) { short *nums = func->interfaces_nums; unsigned count = func->ffs->interfaces_count; for (; count; --count, ++nums) { if (*nums >= 0 && *nums == intf) return nums - func->interfaces_nums; } return -EDOM; } ",0 "static inline void file_free(struct file *f) { percpu_counter_dec(&nr_files); file_check_state(f); call_rcu(&f->f_u.fu_rcuhead, file_free_rcu); } ",0 "cifs_readpages_read_into_pages(struct TCP_Server_Info *server, struct cifs_readdata *rdata, unsigned int len) { int total_read = 0, result = 0; unsigned int i; u64 eof; pgoff_t eof_index; unsigned int nr_pages = rdata->nr_pages; struct kvec iov; /* determine the eof that the server (probably) has */ eof = CIFS_I(rdata->mapping->host)->server_eof; eof_index = eof ? (eof - 1) >> PAGE_CACHE_SHIFT : 0; cifs_dbg(FYI, ""eof=%llu eof_index=%lu\n"", eof, eof_index); rdata->tailsz = PAGE_CACHE_SIZE; for (i = 0; i < nr_pages; i++) { struct page *page = rdata->pages[i]; if (len >= PAGE_CACHE_SIZE) { /* enough data to fill the page */ iov.iov_base = kmap(page); iov.iov_len = PAGE_CACHE_SIZE; cifs_dbg(FYI, ""%u: idx=%lu iov_base=%p iov_len=%zu\n"", i, page->index, iov.iov_base, iov.iov_len); len -= PAGE_CACHE_SIZE; } else if (len > 0) { /* enough for partial page, fill and zero the rest */ iov.iov_base = kmap(page); iov.iov_len = len; cifs_dbg(FYI, ""%u: idx=%lu iov_base=%p iov_len=%zu\n"", i, page->index, iov.iov_base, iov.iov_len); memset(iov.iov_base + len, '\0', PAGE_CACHE_SIZE - len); rdata->tailsz = len; len = 0; } else if (page->index > eof_index) { /* * The VFS will not try to do readahead past the * i_size, but it's possible that we have outstanding * writes with gaps in the middle and the i_size hasn't * caught up yet. Populate those with zeroed out pages * to prevent the VFS from repeatedly attempting to * fill them until the writes are flushed. */ zero_user(page, 0, PAGE_CACHE_SIZE); lru_cache_add_file(page); flush_dcache_page(page); SetPageUptodate(page); unlock_page(page); page_cache_release(page); rdata->pages[i] = NULL; rdata->nr_pages--; continue; } else { /* no need to hold page hostage */ lru_cache_add_file(page); unlock_page(page); page_cache_release(page); rdata->pages[i] = NULL; rdata->nr_pages--; continue; } result = cifs_readv_from_socket(server, &iov, 1, iov.iov_len); kunmap(page); if (result < 0) break; total_read += result; } return total_read > 0 ? total_read : result; } ",0 "static long cuse_file_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { struct fuse_file *ff = file->private_data; struct cuse_conn *cc = fc_to_cc(ff->fc); unsigned int flags = FUSE_IOCTL_COMPAT; if (cc->unrestricted_ioctl) flags |= FUSE_IOCTL_UNRESTRICTED; return fuse_do_ioctl(file, cmd, arg, flags); } ",0 "bool ChromeContentBrowserClient::ShouldTryToUseExistingProcessHost( content::BrowserContext* browser_context, const GURL& url) { if (!url.is_valid()) return false; #if BUILDFLAG(ENABLE_EXTENSIONS) Profile* profile = Profile::FromBrowserContext(browser_context); return ChromeContentBrowserClientExtensionsPart:: ShouldTryToUseExistingProcessHost( profile, url); #else return false; #endif } ",0 "void QQuickWebViewPrivate::setIcon(const QUrl& iconURL) { Q_Q(QQuickWebView); if (m_iconURL == iconURL) return; String oldPageURL = QUrl::fromPercentEncoding(m_iconURL.encodedFragment()); String newPageURL = webPageProxy->mainFrame()->url(); if (oldPageURL != newPageURL) { QtWebIconDatabaseClient* iconDatabase = context->iconDatabase(); if (!oldPageURL.isEmpty()) iconDatabase->releaseIconForPageURL(oldPageURL); if (!newPageURL.isEmpty()) iconDatabase->retainIconForPageURL(newPageURL); } m_iconURL = iconURL; emit q->iconChanged(); } ",0 " gfx::Rect ShellWindowFrameView::GetBoundsForClientView() const { if (frame_->IsFullscreen()) return bounds(); return gfx::Rect(0, kCaptionHeight, width(), std::max(0, height() - kCaptionHeight)); } ",1 "bool WebGraphicsContext3DDefaultImpl::getActiveAttrib(WebGLId program, unsigned long index, ActiveInfo& info) { makeContextCurrent(); if (!program) { synthesizeGLError(GL_INVALID_VALUE); return false; } GLint maxNameLength = -1; glGetProgramiv(program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &maxNameLength); if (maxNameLength < 0) return false; GLchar* name = 0; if (!tryFastMalloc(maxNameLength * sizeof(GLchar)).getValue(name)) { synthesizeGLError(GL_OUT_OF_MEMORY); return false; } GLsizei length = 0; GLint size = -1; GLenum type = 0; glGetActiveAttrib(program, index, maxNameLength, &length, &size, &type, name); if (size < 0) { fastFree(name); return false; } info.name = WebString::fromUTF8(name, length); info.type = type; info.size = size; fastFree(name); return true; } ",0 "static int airo_thread(void *data) { struct net_device *dev = data; struct airo_info *ai = dev->ml_priv; int locked; set_freezable(); while(1) { /* make swsusp happy with our thread */ try_to_freeze(); if (test_bit(JOB_DIE, &ai->jobs)) break; if (ai->jobs) { locked = down_interruptible(&ai->sem); } else { wait_queue_t wait; init_waitqueue_entry(&wait, current); add_wait_queue(&ai->thr_wait, &wait); for (;;) { set_current_state(TASK_INTERRUPTIBLE); if (ai->jobs) break; if (ai->expires || ai->scan_timeout) { if (ai->scan_timeout && time_after_eq(jiffies,ai->scan_timeout)){ set_bit(JOB_SCAN_RESULTS, &ai->jobs); break; } else if (ai->expires && time_after_eq(jiffies,ai->expires)){ set_bit(JOB_AUTOWEP, &ai->jobs); break; } if (!kthread_should_stop() && !freezing(current)) { unsigned long wake_at; if (!ai->expires || !ai->scan_timeout) { wake_at = max(ai->expires, ai->scan_timeout); } else { wake_at = min(ai->expires, ai->scan_timeout); } schedule_timeout(wake_at - jiffies); continue; } } else if (!kthread_should_stop() && !freezing(current)) { schedule(); continue; } break; } current->state = TASK_RUNNING; remove_wait_queue(&ai->thr_wait, &wait); locked = 1; } if (locked) continue; if (test_bit(JOB_DIE, &ai->jobs)) { up(&ai->sem); break; } if (ai->power.event || test_bit(FLAG_FLASHING, &ai->flags)) { up(&ai->sem); continue; } if (test_bit(JOB_XMIT, &ai->jobs)) airo_end_xmit(dev); else if (test_bit(JOB_XMIT11, &ai->jobs)) airo_end_xmit11(dev); else if (test_bit(JOB_STATS, &ai->jobs)) airo_read_stats(dev); else if (test_bit(JOB_WSTATS, &ai->jobs)) airo_read_wireless_stats(ai); else if (test_bit(JOB_PROMISC, &ai->jobs)) airo_set_promisc(ai); else if (test_bit(JOB_MIC, &ai->jobs)) micinit(ai); else if (test_bit(JOB_EVENT, &ai->jobs)) airo_send_event(dev); else if (test_bit(JOB_AUTOWEP, &ai->jobs)) timer_func(dev); else if (test_bit(JOB_SCAN_RESULTS, &ai->jobs)) airo_process_scan_results(ai); else /* Shouldn't get here, but we make sure to unlock */ up(&ai->sem); } return 0; } ",0 "GF_Box *fdpa_New() { ISOM_DECL_BOX_ALLOC(GF_FDpacketBox, GF_ISOM_BOX_TYPE_FDPA); return (GF_Box *)tmp; } ",0 "struct crypto_ahash *mcryptd_ahash_child(struct mcryptd_ahash *tfm) { struct mcryptd_hash_ctx *ctx = crypto_ahash_ctx(&tfm->base); return ctx->child; } ",0 "size_t filter_result_len(const char *filter, const char *user, char *output) { const char *part = NULL; size_t result = 0; do { size_t len; part = strstr(filter, ""%u""); if(part) len = part - filter; else len = strlen(filter); if (output) { strncpy(output, filter, len); output += len; } result += len; filter += len + 2; if(part) { if(output) { strncpy(output, user, strlen(user)); output += strlen(user); } result += strlen(user); } } while(part); if(output) *output = '\0'; return(result + 1); } ",0 "kadm5_setv4key_principal(void *server_handle, krb5_principal principal, krb5_keyblock *keyblock) { krb5_db_entry *kdb; osa_princ_ent_rec adb; krb5_timestamp now; kadm5_policy_ent_rec pol; krb5_keysalt keysalt; int i, kvno, ret; krb5_boolean have_pol = FALSE; kadm5_server_handle_t handle = server_handle; krb5_key_data tmp_key_data; krb5_keyblock *act_mkey; memset( &tmp_key_data, 0, sizeof(tmp_key_data)); CHECK_HANDLE(server_handle); krb5_clear_error_message(handle->context); if (principal == NULL || keyblock == NULL) return EINVAL; if (hist_princ && /* this will be NULL when initializing the databse */ ((krb5_principal_compare(handle->context, principal, hist_princ)) == TRUE)) return KADM5_PROTECT_PRINCIPAL; if (keyblock->enctype != ENCTYPE_DES_CBC_CRC) return KADM5_SETV4KEY_INVAL_ENCTYPE; if ((ret = kdb_get_entry(handle, principal, &kdb, &adb))) return(ret); for (kvno = 0, i=0; in_key_data; i++) if (kdb->key_data[i].key_data_kvno > kvno) kvno = kdb->key_data[i].key_data_kvno; if (kdb->key_data != NULL) cleanup_key_data(handle->context, kdb->n_key_data, kdb->key_data); kdb->key_data = calloc(1, sizeof(krb5_key_data)); if (kdb->key_data == NULL) return ENOMEM; kdb->n_key_data = 1; keysalt.type = KRB5_KDB_SALTTYPE_V4; /* XXX data.magic? */ keysalt.data.length = 0; keysalt.data.data = NULL; ret = kdb_get_active_mkey(handle, NULL, &act_mkey); if (ret) goto done; /* use tmp_key_data as temporary location and reallocate later */ ret = krb5_dbe_encrypt_key_data(handle->context, act_mkey, keyblock, &keysalt, kvno + 1, kdb->key_data); if (ret) { goto done; } kdb->attributes &= ~KRB5_KDB_REQUIRES_PWCHANGE; ret = krb5_timeofday(handle->context, &now); if (ret) goto done; if ((adb.aux_attributes & KADM5_POLICY)) { ret = get_policy(handle, adb.policy, &pol, &have_pol); if (ret) goto done; } if (have_pol) { if (pol.pw_max_life) kdb->pw_expiration = ts_incr(now, pol.pw_max_life); else kdb->pw_expiration = 0; } else { kdb->pw_expiration = 0; } ret = krb5_dbe_update_last_pwd_change(handle->context, kdb, now); if (ret) goto done; /* unlock principal on this KDC */ kdb->fail_auth_count = 0; /* key data changed, let the database provider know */ kdb->mask = KADM5_KEY_DATA | KADM5_FAIL_AUTH_COUNT; if ((ret = kdb_put_entry(handle, kdb, &adb))) goto done; ret = KADM5_OK; done: for (i = 0; i < tmp_key_data.key_data_ver; i++) { if (tmp_key_data.key_data_contents[i]) { memset (tmp_key_data.key_data_contents[i], 0, tmp_key_data.key_data_length[i]); free (tmp_key_data.key_data_contents[i]); } } kdb_free_entry(handle, kdb, &adb); if (have_pol) kadm5_free_policy_ent(handle->lhandle, &pol); return ret; } ",0 " bool UseOpenGLRenderer() { return cmd_line_.GetSwitchValueASCII(switches::kUseGL) == gl::kGLImplementationDesktopName; } ",0 "int drm_connector_property_get_value(struct drm_connector *connector, struct drm_property *property, uint64_t *val) { int i; for (i = 0; i < DRM_CONNECTOR_MAX_PROPERTY; i++) { if (connector->property_ids[i] == property->base.id) { *val = connector->property_values[i]; break; } } if (i == DRM_CONNECTOR_MAX_PROPERTY) return -EINVAL; return 0; } ",0 "static int cxusb_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int num) { struct dvb_usb_device *d = i2c_get_adapdata(adap); int ret; int i; if (mutex_lock_interruptible(&d->i2c_mutex) < 0) return -EAGAIN; for (i = 0; i < num; i++) { if (le16_to_cpu(d->udev->descriptor.idVendor) == USB_VID_MEDION) switch (msg[i].addr) { case 0x63: cxusb_gpio_tuner(d, 0); break; default: cxusb_gpio_tuner(d, 1); break; } if (msg[i].flags & I2C_M_RD) { /* read only */ u8 obuf[3], ibuf[MAX_XFER_SIZE]; if (1 + msg[i].len > sizeof(ibuf)) { warn(""i2c rd: len=%d is too big!\n"", msg[i].len); ret = -EOPNOTSUPP; goto unlock; } obuf[0] = 0; obuf[1] = msg[i].len; obuf[2] = msg[i].addr; if (cxusb_ctrl_msg(d, CMD_I2C_READ, obuf, 3, ibuf, 1+msg[i].len) < 0) { warn(""i2c read failed""); break; } memcpy(msg[i].buf, &ibuf[1], msg[i].len); } else if (i+1 < num && (msg[i+1].flags & I2C_M_RD) && msg[i].addr == msg[i+1].addr) { /* write to then read from same address */ u8 obuf[MAX_XFER_SIZE], ibuf[MAX_XFER_SIZE]; if (3 + msg[i].len > sizeof(obuf)) { warn(""i2c wr: len=%d is too big!\n"", msg[i].len); ret = -EOPNOTSUPP; goto unlock; } if (1 + msg[i + 1].len > sizeof(ibuf)) { warn(""i2c rd: len=%d is too big!\n"", msg[i + 1].len); ret = -EOPNOTSUPP; goto unlock; } obuf[0] = msg[i].len; obuf[1] = msg[i+1].len; obuf[2] = msg[i].addr; memcpy(&obuf[3], msg[i].buf, msg[i].len); if (cxusb_ctrl_msg(d, CMD_I2C_READ, obuf, 3+msg[i].len, ibuf, 1+msg[i+1].len) < 0) break; if (ibuf[0] != 0x08) deb_i2c(""i2c read may have failed\n""); memcpy(msg[i+1].buf, &ibuf[1], msg[i+1].len); i++; } else { /* write only */ u8 obuf[MAX_XFER_SIZE], ibuf; if (2 + msg[i].len > sizeof(obuf)) { warn(""i2c wr: len=%d is too big!\n"", msg[i].len); ret = -EOPNOTSUPP; goto unlock; } obuf[0] = msg[i].addr; obuf[1] = msg[i].len; memcpy(&obuf[2], msg[i].buf, msg[i].len); if (cxusb_ctrl_msg(d, CMD_I2C_WRITE, obuf, 2+msg[i].len, &ibuf,1) < 0) break; if (ibuf != 0x08) deb_i2c(""i2c write may have failed\n""); } } if (i == num) ret = num; else ret = -EREMOTEIO; unlock: mutex_unlock(&d->i2c_mutex); return ret; } ",0 "static void Free_LigatureAttach( HB_LigatureAttach* lat, HB_UShort num_classes ) { HB_UShort m, n, count; HB_ComponentRecord* cr; HB_Anchor* lan; if ( lat->ComponentRecord ) { count = lat->ComponentCount; cr = lat->ComponentRecord; for ( m = 0; m < count; m++ ) { lan = cr[m].LigatureAnchor; for ( n = 0; n < num_classes; n++ ) Free_Anchor( &lan[n] ); FREE( lan ); } FREE( cr ); } } ",0 "void trik_del(GF_Box *s) { GF_TrickPlayBox *ptr = (GF_TrickPlayBox *) s; if (ptr == NULL) return; if (ptr->entries) gf_free(ptr->entries); gf_free(ptr); } ",0 "ecryptfs_add_new_key_tfm(struct ecryptfs_key_tfm **key_tfm, char *cipher_name, size_t key_size) { struct ecryptfs_key_tfm *tmp_tfm; int rc = 0; BUG_ON(!mutex_is_locked(&key_tfm_list_mutex)); tmp_tfm = kmem_cache_alloc(ecryptfs_key_tfm_cache, GFP_KERNEL); if (key_tfm != NULL) (*key_tfm) = tmp_tfm; if (!tmp_tfm) { rc = -ENOMEM; printk(KERN_ERR ""Error attempting to allocate from "" ""ecryptfs_key_tfm_cache\n""); goto out; } mutex_init(&tmp_tfm->key_tfm_mutex); strncpy(tmp_tfm->cipher_name, cipher_name, ECRYPTFS_MAX_CIPHER_NAME_SIZE); tmp_tfm->cipher_name[ECRYPTFS_MAX_CIPHER_NAME_SIZE] = '\0'; tmp_tfm->key_size = key_size; rc = ecryptfs_process_key_cipher(&tmp_tfm->key_tfm, tmp_tfm->cipher_name, &tmp_tfm->key_size); if (rc) { printk(KERN_ERR ""Error attempting to initialize key TFM "" ""cipher with name = [%s]; rc = [%d]\n"", tmp_tfm->cipher_name, rc); kmem_cache_free(ecryptfs_key_tfm_cache, tmp_tfm); if (key_tfm != NULL) (*key_tfm) = NULL; goto out; } list_add(&tmp_tfm->key_tfm_list, &key_tfm_list); out: return rc; } ",0 "bool Player::update(double* timeToEffectChange, bool* didTriggerStyleRecalc) { if (!m_content) { if (timeToEffectChange) *timeToEffectChange = std::numeric_limits::infinity(); if (didTriggerStyleRecalc) *didTriggerStyleRecalc = false; return false; } double inheritedTime = isNull(m_timeline.currentTime()) ? nullValue() : currentTime(); bool didTriggerStyleRecalcLocal = m_content->updateInheritedTime(inheritedTime); if (timeToEffectChange) *timeToEffectChange = m_content->timeToEffectChange(); if (didTriggerStyleRecalc) *didTriggerStyleRecalc = didTriggerStyleRecalcLocal; return m_content->isCurrent() || m_content->isInEffect(); } ",0 "v8::MaybeLocal V8Debugger::callDebuggerMethod(const char* functionName, int argc, v8::Local argv[]) { v8::MicrotasksScope microtasks(m_isolate, v8::MicrotasksScope::kDoNotRunMicrotasks); v8::Local debuggerScript = m_debuggerScript.Get(m_isolate); v8::Local function = v8::Local::Cast(debuggerScript->Get(toV8StringInternalized(m_isolate, functionName))); DCHECK(m_isolate->InContext()); return function->Call(m_isolate->GetCurrentContext(), debuggerScript, argc, argv); } ",0 "ksba_name_ref (ksba_name_t name) { if (!name) fprintf (stderr, ""BUG: ksba_name_ref for NULL\n""); else ++name->ref_count; } ",0 "juniper_read_tlv_value(const u_char *p, u_int tlv_type, u_int tlv_len) { int tlv_value; /* TLVs < 128 are little endian encoded */ if (tlv_type < 128) { switch (tlv_len) { case 1: tlv_value = *p; break; case 2: tlv_value = EXTRACT_LE_16BITS(p); break; case 3: tlv_value = EXTRACT_LE_24BITS(p); break; case 4: tlv_value = EXTRACT_LE_32BITS(p); break; default: tlv_value = -1; break; } } else { /* TLVs >= 128 are big endian encoded */ switch (tlv_len) { case 1: tlv_value = *p; break; case 2: tlv_value = EXTRACT_16BITS(p); break; case 3: tlv_value = EXTRACT_24BITS(p); break; case 4: tlv_value = EXTRACT_32BITS(p); break; default: tlv_value = -1; break; } } return tlv_value; } ",0 "void zend_throw_exception_internal(zval *exception TSRMLS_DC) /* {{{ */ { #ifdef HAVE_DTRACE if (DTRACE_EXCEPTION_THROWN_ENABLED()) { const char *classname; zend_uint name_len; if (exception != NULL) { zend_get_object_classname(exception, &classname, &name_len TSRMLS_CC); DTRACE_EXCEPTION_THROWN((char *)classname); } else { DTRACE_EXCEPTION_THROWN(NULL); } } #endif /* HAVE_DTRACE */ if (exception != NULL) { zval *previous = EG(exception); zend_exception_set_previous(exception, EG(exception) TSRMLS_CC); EG(exception) = exception; if (previous) { return; } } if (!EG(current_execute_data)) { if(EG(exception)) { zend_exception_error(EG(exception), E_ERROR TSRMLS_CC); } zend_error(E_ERROR, ""Exception thrown without a stack frame""); } if (zend_throw_exception_hook) { zend_throw_exception_hook(exception TSRMLS_CC); } if (EG(current_execute_data)->opline == NULL || (EG(current_execute_data)->opline+1)->opcode == ZEND_HANDLE_EXCEPTION) { /* no need to rethrow the exception */ return; } EG(opline_before_exception) = EG(current_execute_data)->opline; EG(current_execute_data)->opline = EG(exception_op); } /* }}} */ ",0 "cmsBool Type_Data_Write(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, void* Ptr, cmsUInt32Number nItems) { cmsICCData* BinData = (cmsICCData*) Ptr; if (!_cmsWriteUInt32Number(io, BinData ->flag)) return FALSE; return io ->Write(io, BinData ->len, BinData ->data); cmsUNUSED_PARAMETER(nItems); cmsUNUSED_PARAMETER(self); } ",0 "Magick_ColorType_from_PNG_ColorType(const int ping_colortype) { switch (ping_colortype) { case 0: return ""Grayscale""; case 2: return ""Truecolor""; case 3: return ""Indexed""; case 4: return ""GrayAlpha""; case 6: return ""RGBA""; default: return ""UndefinedColorType""; } } ",0 "void Stream::getRawChars(int nChars, int *buffer) { error(errInternal, -1, ""Internal: called getRawChars() on non-predictor stream""); } ",0 "static int sock_no_open(struct inode *irrelevant, struct file *dontcare) { return -ENXIO; } ",0 "Element* ContainerNode::firstElementChild() const { return ElementTraversal::firstWithin(this); } ",0 "WORD32 ih264d_ref_idx_reordering(dec_struct_t *ps_dec, UWORD8 uc_lx) { dpb_manager_t *ps_dpb_mgr = ps_dec->ps_dpb_mgr; UWORD16 u4_cur_pic_num = ps_dec->ps_cur_slice->u2_frame_num; /*< Maximum Picture Number Minus 1 */ UWORD16 ui_max_frame_num = ps_dec->ps_cur_sps->u2_u4_max_pic_num_minus1 + 1; WORD32 i; UWORD32 ui_remapIdc, ui_nextUev; WORD16 u2_pred_frame_num = u4_cur_pic_num; WORD32 i_temp; UWORD16 u2_def_mod_flag = 0; /* Flag to keep track of which indices have been remapped */ UWORD8 modCount = 0; UWORD32 *pu4_bitstrm_buf = ps_dec->ps_bitstrm->pu4_buffer; UWORD32 *pu4_bitstrm_ofst = &ps_dec->ps_bitstrm->u4_ofst; dec_slice_params_t *ps_cur_slice = ps_dec->ps_cur_slice; UWORD8 u1_field_pic_flag = ps_cur_slice->u1_field_pic_flag; if(u1_field_pic_flag) { u4_cur_pic_num = u4_cur_pic_num * 2 + 1; ui_max_frame_num = ui_max_frame_num * 2; } u2_pred_frame_num = u4_cur_pic_num; ui_remapIdc = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf); while(ui_remapIdc != 3) { ui_nextUev = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf); if(ui_remapIdc != 2) { ui_nextUev = ui_nextUev + 1; if(ui_remapIdc == 0) { i_temp = u2_pred_frame_num - ui_nextUev; if(i_temp < 0) i_temp += ui_max_frame_num; } else { i_temp = u2_pred_frame_num + ui_nextUev; if(i_temp >= ui_max_frame_num) i_temp -= ui_max_frame_num; } /* Find the dpb with the matching picNum (picNum==frameNum for framePic) */ if(i_temp > u4_cur_pic_num) i_temp = i_temp - ui_max_frame_num; for(i = 0; i < (ps_cur_slice->u1_initial_list_size[uc_lx]); i++) { if(ps_dpb_mgr->ps_init_dpb[uc_lx][i]->i4_pic_num == i_temp) break; } if(i == (ps_cur_slice->u1_initial_list_size[uc_lx])) { UWORD32 i4_error_code; i4_error_code = ERROR_DBP_MANAGER_T; return i4_error_code; } u2_def_mod_flag |= (1 << i); ps_dpb_mgr->ps_mod_dpb[uc_lx][modCount++] = ps_dpb_mgr->ps_init_dpb[uc_lx][i]; u2_pred_frame_num = i_temp; //update predictor to be the picNum just obtained } else //2 { UWORD8 u1_lt_idx = (UWORD8)ui_nextUev; for(i = 0; i < (ps_cur_slice->u1_initial_list_size[uc_lx]); i++) { if(!ps_dpb_mgr->ps_init_dpb[uc_lx][i]->u1_is_short) { if(ps_dpb_mgr->ps_init_dpb[uc_lx][i]->u1_long_term_pic_num == u1_lt_idx) break; } } if(i == (ps_cur_slice->u1_initial_list_size[uc_lx])) { UWORD32 i4_error_code; i4_error_code = ERROR_DBP_MANAGER_T; return i4_error_code; } u2_def_mod_flag |= (1 << i); ps_dpb_mgr->ps_mod_dpb[uc_lx][modCount++] = ps_dpb_mgr->ps_init_dpb[uc_lx][i]; } ui_remapIdc = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf); /* Get the remapping_idc - 0/1/2/3 */ } for(i = 0; i < (ps_cur_slice->u1_num_ref_idx_lx_active[uc_lx]); i++) { if(!(u2_def_mod_flag & (1 << i))) ps_dpb_mgr->ps_mod_dpb[uc_lx][modCount++] = ps_dpb_mgr->ps_init_dpb[uc_lx][i]; } return OK; } ",0 "static void hub_tt_work(struct work_struct *work) { struct usb_hub *hub = container_of(work, struct usb_hub, tt.clear_work); unsigned long flags; spin_lock_irqsave(&hub->tt.lock, flags); while (!list_empty(&hub->tt.clear_list)) { struct list_head *next; struct usb_tt_clear *clear; struct usb_device *hdev = hub->hdev; const struct hc_driver *drv; int status; next = hub->tt.clear_list.next; clear = list_entry(next, struct usb_tt_clear, clear_list); list_del(&clear->clear_list); /* drop lock so HCD can concurrently report other TT errors */ spin_unlock_irqrestore(&hub->tt.lock, flags); status = hub_clear_tt_buffer(hdev, clear->devinfo, clear->tt); if (status && status != -ENODEV) dev_err(&hdev->dev, ""clear tt %d (%04x) error %d\n"", clear->tt, clear->devinfo, status); /* Tell the HCD, even if the operation failed */ drv = clear->hcd->driver; if (drv->clear_tt_buffer_complete) (drv->clear_tt_buffer_complete)(clear->hcd, clear->ep); kfree(clear); spin_lock_irqsave(&hub->tt.lock, flags); } spin_unlock_irqrestore(&hub->tt.lock, flags); } ",0 " bool OnCurtainPolicyUpdate(bool curtain_required) { DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); #if defined(OS_MACOSX) if (curtain_required) { if (getuid() == 0) { Shutdown(kLoginScreenNotSupportedExitCode); return false; } } #endif if (curtain_->required() != curtain_required) { LOG(INFO) << ""Updated curtain policy.""; curtain_->set_required(curtain_required); return true; } return false; } ",0 "void WebPluginDelegateProxy::OnSetWindow(gfx::PluginWindowHandle window) { uses_shared_bitmaps_ = !window; window_ = window; if (plugin_) plugin_->SetWindow(window); } ",0 "int sock_common_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, int flags) { struct sock *sk = sock->sk; int addr_len = 0; int err; err = sk->sk_prot->recvmsg(sk, msg, size, flags & MSG_DONTWAIT, flags & ~MSG_DONTWAIT, &addr_len); if (err >= 0) msg->msg_namelen = addr_len; return err; } ",0 "ReadUserLogStateAccess::getState( const ReadUserLogFileState *&state ) const { state = m_state; return true; } ",0 "void RenderFrameImpl::didChangeManifest(blink::WebLocalFrame* frame) { DCHECK(!frame_ || frame_ == frame); FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidChangeManifest()); } ",0 "void acpi_os_printf(const char *fmt, ...) { va_list args; va_start(args, fmt); acpi_os_vprintf(fmt, args); va_end(args); } ",0 "error::Error GLES2DecoderImpl::HandleCompressedTexSubImage2DBucket( uint32 immediate_data_size, const gles2::CompressedTexSubImage2DBucket& c) { GLenum target = static_cast(c.target); GLint level = static_cast(c.level); GLint xoffset = static_cast(c.xoffset); GLint yoffset = static_cast(c.yoffset); GLsizei width = static_cast(c.width); GLsizei height = static_cast(c.height); GLenum format = static_cast(c.format); Bucket* bucket = GetBucket(c.bucket_id); if (!bucket) { return error::kInvalidArguments; } uint32 data_size = bucket->size(); GLsizei imageSize = data_size; const void* data = bucket->GetData(0, data_size); if (!data) { return error::kInvalidArguments; } if (!validators_->texture_target.IsValid(target)) { SetGLError( GL_INVALID_ENUM, ""glCompressedTexSubImage2D"", ""target""); return error::kNoError; } if (!validators_->compressed_texture_format.IsValid(format)) { SetGLErrorInvalidEnum(""glCompressedTexSubImage2D"", format, ""format""); return error::kNoError; } if (width < 0) { SetGLError(GL_INVALID_VALUE, ""glCompressedTexSubImage2D"", ""width < 0""); return error::kNoError; } if (height < 0) { SetGLError(GL_INVALID_VALUE, ""glCompressedTexSubImage2D"", ""height < 0""); return error::kNoError; } if (imageSize < 0) { SetGLError(GL_INVALID_VALUE, ""glCompressedTexSubImage2D"", ""imageSize < 0""); return error::kNoError; } DoCompressedTexSubImage2D( target, level, xoffset, yoffset, width, height, format, imageSize, data); return error::kNoError; } ",0 "void FileSystemOperation::CreateFile(const GURL& path_url, bool exclusive, const StatusCallback& callback) { DCHECK(SetPendingOperationType(kOperationCreateFile)); base::PlatformFileError result = SetUpFileSystemPath( path_url, &src_path_, &src_util_, PATH_FOR_CREATE); if (result != base::PLATFORM_FILE_OK) { callback.Run(result); delete this; return; } GetUsageAndQuotaThenRunTask( src_path_.origin(), src_path_.type(), base::Bind(&FileSystemOperation::DoCreateFile, base::Unretained(this), callback, exclusive), base::Bind(callback, base::PLATFORM_FILE_ERROR_FAILED)); } ",0 "void HTMLMediaElement::LoadSourceFromAttribute() { load_state_ = kLoadingFromSrcAttr; const AtomicString& src_value = FastGetAttribute(kSrcAttr); if (src_value.IsEmpty()) { BLINK_MEDIA_LOG << ""LoadSourceFromAttribute("" << (void*)this << ""), empty 'src'""; MediaLoadingFailed(WebMediaPlayer::kNetworkStateFormatError, BuildElementErrorMessage(""Empty src attribute"")); return; } KURL media_url = GetDocument().CompleteURL(src_value); if (!IsSafeToLoadURL(media_url, kComplain)) { MediaLoadingFailed( WebMediaPlayer::kNetworkStateFormatError, BuildElementErrorMessage(""Media load rejected by URL safety check"")); return; } LoadResource(WebMediaPlayerSource(WebURL(media_url)), String()); } ",0 " ~BrowserOpenedWithExistingProfileNotificationObserver() { } ",0 "WindowMaximizedObserver::~WindowMaximizedObserver() {} ",0 "int __init sco_init(void) { int err; BUILD_BUG_ON(sizeof(struct sockaddr_sco) > sizeof(struct sockaddr)); err = proto_register(&sco_proto, 0); if (err < 0) return err; err = bt_sock_register(BTPROTO_SCO, &sco_sock_family_ops); if (err < 0) { BT_ERR(""SCO socket registration failed""); goto error; } err = bt_procfs_init(&init_net, ""sco"", &sco_sk_list, NULL); if (err < 0) { BT_ERR(""Failed to create SCO proc file""); bt_sock_unregister(BTPROTO_SCO); goto error; } BT_INFO(""SCO socket layer initialized""); hci_register_cb(&sco_cb); if (IS_ERR_OR_NULL(bt_debugfs)) return 0; sco_debugfs = debugfs_create_file(""sco"", 0444, bt_debugfs, NULL, &sco_debugfs_fops); return 0; error: proto_unregister(&sco_proto); return err; } ",0 "SkSampler* SkIcoCodec::getSampler(bool createIfNecessary) { if (fCurrScanlineCodec) { SkASSERT(!fCurrIncrementalCodec); return fCurrScanlineCodec->getSampler(createIfNecessary); } if (fCurrIncrementalCodec) { return fCurrIncrementalCodec->getSampler(createIfNecessary); } return nullptr; } ",0 "get_duplicate_name (const char *name, int count_increment, int max_length) { char *result; char *name_base; const char *suffix; int count; parse_previous_duplicate_name (name, &name_base, &suffix, &count); result = make_next_duplicate_name (name_base, suffix, count + count_increment, max_length); g_free (name_base); return result; } ",0 "void ImageCapture::ContextDestroyed(ExecutionContext*) { RemoveAllEventListeners(); service_requests_.clear(); DCHECK(!HasEventListeners()); } ",0 "AppendToBuffer(Buffer *b, char *str, int len) { while (b->used + len > b->room) { b->buff = (char *)realloc(b->buff, 2*b->room*(sizeof(char))); b->room *= 2; } strncpy(b->buff + b->used, str, len); b->used += len; } ",0 "void ieee80211_recalc_idle(struct ieee80211_local *local) { u32 chg; mutex_lock(&local->iflist_mtx); chg = __ieee80211_recalc_idle(local); mutex_unlock(&local->iflist_mtx); if (chg) ieee80211_hw_config(local, chg); } ",0 "__update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu) { struct trace_buffer *trace_buf = &tr->trace_buffer; struct trace_buffer *max_buf = &tr->max_buffer; struct trace_array_cpu *data = per_cpu_ptr(trace_buf->data, cpu); struct trace_array_cpu *max_data = per_cpu_ptr(max_buf->data, cpu); max_buf->cpu = cpu; max_buf->time_start = data->preempt_timestamp; max_data->saved_latency = tr->max_latency; max_data->critical_start = data->critical_start; max_data->critical_end = data->critical_end; strncpy(max_data->comm, tsk->comm, TASK_COMM_LEN); max_data->pid = tsk->pid; /* * If tsk == current, then use current_uid(), as that does not use * RCU. The irq tracer can be called out of RCU scope. */ if (tsk == current) max_data->uid = current_uid(); else max_data->uid = task_uid(tsk); max_data->nice = tsk->static_prio - 20 - MAX_RT_PRIO; max_data->policy = tsk->policy; max_data->rt_priority = tsk->rt_priority; /* record this tasks comm */ tracing_record_cmdline(tsk); } ",0 "static void caif_read_unlock(struct sock *sk) { struct caifsock *cf_sk; cf_sk = container_of(sk, struct caifsock, sk); mutex_unlock(&cf_sk->readlock); } ",0 "static int airo_networks_allocate(struct airo_info *ai) { if (ai->networks) return 0; ai->networks = kcalloc(AIRO_MAX_NETWORK_COUNT, sizeof(BSSListElement), GFP_KERNEL); if (!ai->networks) { airo_print_warn("""", ""Out of memory allocating beacons""); return -ENOMEM; } return 0; } ",0 "static void RemoveICCProfileFromResourceBlock(StringInfo *bim_profile) { register const unsigned char *p; size_t length; unsigned char *datum; unsigned int count, long_sans; unsigned short id, short_sans; length=GetStringInfoLength(bim_profile); if (length < 16) return; datum=GetStringInfoDatum(bim_profile); for (p=datum; (p >= datum) && (p < (datum+length-16)); ) { register unsigned char *q; q=(unsigned char *) p; if (LocaleNCompare((const char *) p,""8BIM"",4) != 0) break; p=PushLongPixel(MSBEndian,p,&long_sans); p=PushShortPixel(MSBEndian,p,&id); p=PushShortPixel(MSBEndian,p,&short_sans); p=PushLongPixel(MSBEndian,p,&count); if (id == 0x0000040f) { ssize_t quantum; quantum=PSDQuantum(count)+12; if ((quantum >= 12) && (quantum < length)) { if ((q+quantum < (datum+length-16))) (void) CopyMagickMemory(q,q+quantum,length-quantum-(q-datum)); SetStringInfoLength(bim_profile,length-quantum); } break; } p+=count; if ((count & 0x01) != 0) p++; } } ",0 "ip6mr_cache_unresolved(struct mr6_table *mrt, mifi_t mifi, struct sk_buff *skb) { bool found = false; int err; struct mfc6_cache *c; spin_lock_bh(&mfc_unres_lock); list_for_each_entry(c, &mrt->mfc6_unres_queue, list) { if (ipv6_addr_equal(&c->mf6c_mcastgrp, &ipv6_hdr(skb)->daddr) && ipv6_addr_equal(&c->mf6c_origin, &ipv6_hdr(skb)->saddr)) { found = true; break; } } if (!found) { /* * Create a new entry if allowable */ if (atomic_read(&mrt->cache_resolve_queue_len) >= 10 || (c = ip6mr_cache_alloc_unres()) == NULL) { spin_unlock_bh(&mfc_unres_lock); kfree_skb(skb); return -ENOBUFS; } /* * Fill in the new cache entry */ c->mf6c_parent = -1; c->mf6c_origin = ipv6_hdr(skb)->saddr; c->mf6c_mcastgrp = ipv6_hdr(skb)->daddr; /* * Reflect first query at pim6sd */ err = ip6mr_cache_report(mrt, skb, mifi, MRT6MSG_NOCACHE); if (err < 0) { /* If the report failed throw the cache entry out - Brad Parker */ spin_unlock_bh(&mfc_unres_lock); ip6mr_cache_free(c); kfree_skb(skb); return err; } atomic_inc(&mrt->cache_resolve_queue_len); list_add(&c->list, &mrt->mfc6_unres_queue); mr6_netlink_event(mrt, c, RTM_NEWROUTE); ipmr_do_expire_process(mrt); } /* * See if we can append the packet */ if (c->mfc_un.unres.unresolved.qlen > 3) { kfree_skb(skb); err = -ENOBUFS; } else { skb_queue_tail(&c->mfc_un.unres.unresolved, skb); err = 0; } spin_unlock_bh(&mfc_unres_lock); return err; } ",0 "ipt_do_table(struct sk_buff *skb, const struct nf_hook_state *state, struct xt_table *table) { unsigned int hook = state->hook; static const char nulldevname[IFNAMSIZ] __attribute__((aligned(sizeof(long)))); const struct iphdr *ip; /* Initializing verdict to NF_DROP keeps gcc happy. */ unsigned int verdict = NF_DROP; const char *indev, *outdev; const void *table_base; struct ipt_entry *e, **jumpstack; unsigned int stackidx, cpu; const struct xt_table_info *private; struct xt_action_param acpar; unsigned int addend; /* Initialization */ stackidx = 0; ip = ip_hdr(skb); indev = state->in ? state->in->name : nulldevname; outdev = state->out ? state->out->name : nulldevname; /* We handle fragments by dealing with the first fragment as * if it was a normal packet. All other fragments are treated * normally, except that they will NEVER match rules that ask * things we don't know, ie. tcp syn flag or ports). If the * rule is also a fragment-specific rule, non-fragments won't * match it. */ acpar.fragoff = ntohs(ip->frag_off) & IP_OFFSET; acpar.thoff = ip_hdrlen(skb); acpar.hotdrop = false; acpar.state = state; WARN_ON(!(table->valid_hooks & (1 << hook))); local_bh_disable(); addend = xt_write_recseq_begin(); private = READ_ONCE(table->private); /* Address dependency. */ cpu = smp_processor_id(); table_base = private->entries; jumpstack = (struct ipt_entry **)private->jumpstack[cpu]; /* Switch to alternate jumpstack if we're being invoked via TEE. * TEE issues XT_CONTINUE verdict on original skb so we must not * clobber the jumpstack. * * For recursion via REJECT or SYNPROXY the stack will be clobbered * but it is no problem since absolute verdict is issued by these. */ if (static_key_false(&xt_tee_enabled)) jumpstack += private->stacksize * __this_cpu_read(nf_skb_duplicated); e = get_entry(table_base, private->hook_entry[hook]); do { const struct xt_entry_target *t; const struct xt_entry_match *ematch; struct xt_counters *counter; WARN_ON(!e); if (!ip_packet_match(ip, indev, outdev, &e->ip, acpar.fragoff)) { no_match: e = ipt_next_entry(e); continue; } xt_ematch_foreach(ematch, e) { acpar.match = ematch->u.kernel.match; acpar.matchinfo = ematch->data; if (!acpar.match->match(skb, &acpar)) goto no_match; } counter = xt_get_this_cpu_counter(&e->counters); ADD_COUNTER(*counter, skb->len, 1); t = ipt_get_target(e); WARN_ON(!t->u.kernel.target); #if IS_ENABLED(CONFIG_NETFILTER_XT_TARGET_TRACE) /* The packet is traced: log it */ if (unlikely(skb->nf_trace)) trace_packet(state->net, skb, hook, state->in, state->out, table->name, private, e); #endif /* Standard target? */ if (!t->u.kernel.target->target) { int v; v = ((struct xt_standard_target *)t)->verdict; if (v < 0) { /* Pop from stack? */ if (v != XT_RETURN) { verdict = (unsigned int)(-v) - 1; break; } if (stackidx == 0) { e = get_entry(table_base, private->underflow[hook]); } else { e = jumpstack[--stackidx]; e = ipt_next_entry(e); } continue; } if (table_base + v != ipt_next_entry(e) && !(e->ip.flags & IPT_F_GOTO)) jumpstack[stackidx++] = e; e = get_entry(table_base, v); continue; } acpar.target = t->u.kernel.target; acpar.targinfo = t->data; verdict = t->u.kernel.target->target(skb, &acpar); if (verdict == XT_CONTINUE) { /* Target might have changed stuff. */ ip = ip_hdr(skb); e = ipt_next_entry(e); } else { /* Verdict */ break; } } while (!acpar.hotdrop); xt_write_recseq_end(addend); local_bh_enable(); if (acpar.hotdrop) return NF_DROP; else return verdict; } ",1 "static CURLcode nss_load_ca_certificates(struct connectdata *conn, int sockindex) { struct Curl_easy *data = conn->data; const char *cafile = data->set.ssl.CAfile; const char *capath = data->set.ssl.CApath; if(cafile) { CURLcode result = nss_load_cert(&conn->ssl[sockindex], cafile, PR_TRUE); if(result) return result; } if(capath) { struct_stat st; if(stat(capath, &st) == -1) return CURLE_SSL_CACERT_BADFILE; if(S_ISDIR(st.st_mode)) { PRDirEntry *entry; PRDir *dir = PR_OpenDir(capath); if(!dir) return CURLE_SSL_CACERT_BADFILE; while((entry = PR_ReadDir(dir, PR_SKIP_BOTH | PR_SKIP_HIDDEN))) { char *fullpath = aprintf(""%s/%s"", capath, entry->name); if(!fullpath) { PR_CloseDir(dir); return CURLE_OUT_OF_MEMORY; } if(CURLE_OK != nss_load_cert(&conn->ssl[sockindex], fullpath, PR_TRUE)) /* This is purposefully tolerant of errors so non-PEM files can * be in the same directory */ infof(data, ""failed to load '%s' from CURLOPT_CAPATH\n"", fullpath); free(fullpath); } PR_CloseDir(dir); } else infof(data, ""warning: CURLOPT_CAPATH not a directory (%s)\n"", capath); } infof(data, "" CAfile: %s\n CApath: %s\n"", cafile ? cafile : ""none"", capath ? capath : ""none""); return CURLE_OK; } ",0 "SelectorQueryCache* Document::selectorQueryCache() { if (!m_selectorQueryCache) m_selectorQueryCache = adoptPtr(new SelectorQueryCache()); return m_selectorQueryCache.get(); } ",0 "struct vhost_fdt_hash_table *mk_vhost_fdt_table_lookup(int id, struct host *host) { struct mk_list *head; struct mk_list *vhost_list; struct vhost_fdt_host *fdt_host; struct vhost_fdt_hash_table *ht = NULL; vhost_list = mk_vhost_fdt_key; mk_list_foreach(head, vhost_list) { fdt_host = mk_list_entry(head, struct vhost_fdt_host, _head); if (fdt_host->host == host) { ht = &fdt_host->hash_table[id]; return ht; } } return ht; } ",0 "ofputil_nx_flow_format_to_protocol(enum nx_flow_format flow_format) { switch (flow_format) { case NXFF_OPENFLOW10: return OFPUTIL_P_OF10_STD; case NXFF_NXM: return OFPUTIL_P_OF10_NXM; default: return 0; } } ",0 "ScriptPromise ImageCapture::grabFrame(ScriptState* script_state) { ScriptPromiseResolver* resolver = ScriptPromiseResolver::Create(script_state); ScriptPromise promise = resolver->Promise(); if (TrackIsInactive(*stream_track_)) { resolver->Reject(DOMException::Create( kInvalidStateError, ""The associated Track is in an invalid state."")); return promise; } if (!frame_grabber_) { frame_grabber_ = Platform::Current()->CreateImageCaptureFrameGrabber(); } if (!frame_grabber_) { resolver->Reject(DOMException::Create( kUnknownError, ""Couldn't create platform resources"")); return promise; } WebMediaStreamTrack track(stream_track_->Component()); frame_grabber_->GrabFrame( &track, new CallbackPromiseAdapter(resolver)); return promise; } ",0 "static opj_bool pi_next_pcrl(opj_pi_iterator_t * pi) { opj_pi_comp_t *comp = NULL; opj_pi_resolution_t *res = NULL; long index = 0; if (!pi->first) { comp = &pi->comps[pi->compno]; goto LABEL_SKIP; } else { int compno, resno; pi->first = 0; pi->dx = 0; pi->dy = 0; for (compno = 0; compno < pi->numcomps; compno++) { comp = &pi->comps[compno]; for (resno = 0; resno < comp->numresolutions; resno++) { int dx, dy; res = &comp->resolutions[resno]; dx = comp->dx * (1 << (res->pdx + comp->numresolutions - 1 - resno)); dy = comp->dy * (1 << (res->pdy + comp->numresolutions - 1 - resno)); pi->dx = !pi->dx ? dx : int_min(pi->dx, dx); pi->dy = !pi->dy ? dy : int_min(pi->dy, dy); } } } if (!pi->tp_on) { pi->poc.ty0 = pi->ty0; pi->poc.tx0 = pi->tx0; pi->poc.ty1 = pi->ty1; pi->poc.tx1 = pi->tx1; } for (pi->y = pi->poc.ty0; pi->y < pi->poc.ty1; pi->y += pi->dy - (pi->y % pi->dy)) { for (pi->x = pi->poc.tx0; pi->x < pi->poc.tx1; pi->x += pi->dx - (pi->x % pi->dx)) { for (pi->compno = pi->poc.compno0; pi->compno < pi->poc.compno1; pi->compno++) { comp = &pi->comps[pi->compno]; for (pi->resno = pi->poc.resno0; pi->resno < int_min(pi->poc.resno1, comp->numresolutions); pi->resno++) { int levelno; int trx0, try0; int trx1, try1; int rpx, rpy; int prci, prcj; res = &comp->resolutions[pi->resno]; levelno = comp->numresolutions - 1 - pi->resno; trx0 = int_ceildiv(pi->tx0, comp->dx << levelno); try0 = int_ceildiv(pi->ty0, comp->dy << levelno); trx1 = int_ceildiv(pi->tx1, comp->dx << levelno); try1 = int_ceildiv(pi->ty1, comp->dy << levelno); rpx = res->pdx + levelno; rpy = res->pdy + levelno; if (!((pi->y % (comp->dy << rpy) == 0) || ((pi->y == pi->ty0) && ((try0 << levelno) % (1 << rpy))))) { continue; } if (!((pi->x % (comp->dx << rpx) == 0) || ((pi->x == pi->tx0) && ((trx0 << levelno) % (1 << rpx))))) { continue; } if ((res->pw == 0) || (res->ph == 0)) { continue; } if ((trx0 == trx1) || (try0 == try1)) { continue; } prci = int_floordivpow2(int_ceildiv(pi->x, comp->dx << levelno), res->pdx) - int_floordivpow2(trx0, res->pdx); prcj = int_floordivpow2(int_ceildiv(pi->y, comp->dy << levelno), res->pdy) - int_floordivpow2(try0, res->pdy); pi->precno = prci + prcj * res->pw; for (pi->layno = pi->poc.layno0; pi->layno < pi->poc.layno1; pi->layno++) { index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno * pi->step_c + pi->precno * pi->step_p; if (!pi->include[index]) { pi->include[index] = 1; return OPJ_TRUE; } LABEL_SKIP: ; } } } } } return OPJ_FALSE; } ",1 "void AppCache::InitializeWithManifest(AppCacheManifest* manifest) { DCHECK(manifest); intercept_namespaces_.swap(manifest->intercept_namespaces); fallback_namespaces_.swap(manifest->fallback_namespaces); online_whitelist_namespaces_.swap(manifest->online_whitelist_namespaces); online_whitelist_all_ = manifest->online_whitelist_all; std::sort(intercept_namespaces_.begin(), intercept_namespaces_.end(), SortNamespacesByLength); std::sort(fallback_namespaces_.begin(), fallback_namespaces_.end(), SortNamespacesByLength); } ",0 " void DestroyPersistentMemoryAllocator() { allocator_ = nullptr; GlobalHistogramAllocator::ReleaseForTesting(); } ",0 "static void OctetAttributeAttributeSetter( v8::Local v8_value, const v8::FunctionCallbackInfo& info) { v8::Isolate* isolate = info.GetIsolate(); ALLOW_UNUSED_LOCAL(isolate); v8::Local holder = info.Holder(); ALLOW_UNUSED_LOCAL(holder); TestObject* impl = V8TestObject::ToImpl(holder); ExceptionState exception_state(isolate, ExceptionState::kSetterContext, ""TestObject"", ""octetAttribute""); uint8_t cpp_value = NativeValueTraits::NativeValue(info.GetIsolate(), v8_value, exception_state); if (exception_state.HadException()) return; impl->setOctetAttribute(cpp_value); } ",0 " virtual void SetUp() { fwd_txfm_ = GET_PARAM(0); inv_txfm_ = GET_PARAM(1); tx_type_ = GET_PARAM(2); pitch_ = 16; fwd_txfm_ref = fdct16x16_ref; } ",1 " explicit DefaultSubframeProcessHostHolder(BrowserContext* browser_context) : browser_context_(browser_context) {} ",0 "static int mov_read_stps(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; unsigned i, entries; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; avio_rb32(pb); // version + flags entries = avio_rb32(pb); if (sc->stps_data) av_log(c->fc, AV_LOG_WARNING, ""Duplicated STPS atom\n""); av_free(sc->stps_data); sc->stps_count = 0; sc->stps_data = av_malloc_array(entries, sizeof(*sc->stps_data)); if (!sc->stps_data) return AVERROR(ENOMEM); for (i = 0; i < entries && !pb->eof_reached; i++) { sc->stps_data[i] = avio_rb32(pb); } sc->stps_count = i; if (pb->eof_reached) return AVERROR_EOF; return 0; } ",0 "server_input_channel_req(int type, u_int32_t seq, void *ctxt) { Channel *c; int id, reply, success = 0; char *rtype; id = packet_get_int(); rtype = packet_get_string(NULL); reply = packet_get_char(); debug(""server_input_channel_req: channel %d request %s reply %d"", id, rtype, reply); if ((c = channel_lookup(id)) == NULL) packet_disconnect(""server_input_channel_req: "" ""unknown channel %d"", id); if (!strcmp(rtype, ""eow@openssh.com"")) { packet_check_eom(); chan_rcvd_eow(c); } else if ((c->type == SSH_CHANNEL_LARVAL || c->type == SSH_CHANNEL_OPEN) && strcmp(c->ctype, ""session"") == 0) success = session_input_channel_req(c, rtype); if (reply && !(c->flags & CHAN_CLOSE_SENT)) { packet_start(success ? SSH2_MSG_CHANNEL_SUCCESS : SSH2_MSG_CHANNEL_FAILURE); packet_put_int(c->remote_id); packet_send(); } free(rtype); return 0; } ",0 "strpbrk_or_eos (const char *s, const char *accept) { char *p = strpbrk (s, accept); if (!p) p = strchr (s, '\0'); return p; } ",0 "void RenderFrameHostImpl::OnAccessibilityEvents( const std::vector& params, int reset_token, int ack_token) { if (accessibility_reset_token_ != reset_token) { Send(new AccessibilityMsg_Events_ACK(routing_id_, ack_token)); return; } accessibility_reset_token_ = 0; RenderWidgetHostViewBase* view = GetViewForAccessibility(); ui::AXMode accessibility_mode = delegate_->GetAccessibilityMode(); if (!accessibility_mode.is_mode_off() && view && is_active()) { if (accessibility_mode.has_mode(ui::AXMode::kNativeAPIs)) GetOrCreateBrowserAccessibilityManager(); std::vector details; details.reserve(params.size()); for (size_t i = 0; i < params.size(); ++i) { const AccessibilityHostMsg_EventParams& param = params[i]; AXEventNotificationDetails detail; detail.event_type = param.event_type; detail.id = param.id; detail.ax_tree_id = GetAXTreeID(); detail.event_from = param.event_from; detail.action_request_id = param.action_request_id; if (param.update.has_tree_data) { detail.update.has_tree_data = true; ax_content_tree_data_ = param.update.tree_data; AXContentTreeDataToAXTreeData(&detail.update.tree_data); } detail.update.root_id = param.update.root_id; detail.update.node_id_to_clear = param.update.node_id_to_clear; detail.update.nodes.resize(param.update.nodes.size()); for (size_t i = 0; i < param.update.nodes.size(); ++i) { AXContentNodeDataToAXNodeData(param.update.nodes[i], &detail.update.nodes[i]); } details.push_back(detail); } if (accessibility_mode.has_mode(ui::AXMode::kNativeAPIs)) { if (browser_accessibility_manager_) browser_accessibility_manager_->OnAccessibilityEvents(details); } delegate_->AccessibilityEventReceived(details); if (!accessibility_testing_callback_.is_null()) { for (size_t i = 0; i < details.size(); i++) { const AXEventNotificationDetails& detail = details[i]; if (static_cast(detail.event_type) < 0) continue; if (!ax_tree_for_testing_) { if (browser_accessibility_manager_) { ax_tree_for_testing_.reset(new ui::AXTree( browser_accessibility_manager_->SnapshotAXTreeForTesting())); } else { ax_tree_for_testing_.reset(new ui::AXTree()); CHECK(ax_tree_for_testing_->Unserialize(detail.update)) << ax_tree_for_testing_->error(); } } else { CHECK(ax_tree_for_testing_->Unserialize(detail.update)) << ax_tree_for_testing_->error(); } accessibility_testing_callback_.Run(this, detail.event_type, detail.id); } } } Send(new AccessibilityMsg_Events_ACK(routing_id_, ack_token)); } ",0 " void BindToCurrentThread() { thread_task_runner_handle_ = MakeUnique(simple_task_runner_); run_loop_client_ = RunLoop::RegisterDelegateForCurrentThread(this); } ",0 "static int unix_dgram_peer_wake_connect(struct sock *sk, struct sock *other) { struct unix_sock *u, *u_other; int rc; u = unix_sk(sk); u_other = unix_sk(other); rc = 0; spin_lock(&u_other->peer_wait.lock); if (!u->peer_wake.private) { u->peer_wake.private = other; __add_wait_queue(&u_other->peer_wait, &u->peer_wake); rc = 1; } spin_unlock(&u_other->peer_wait.lock); return rc; } ",0 "void Browser::TabInsertedAt(TabStripModel* tab_strip_model, WebContents* contents, int index, bool foreground) { SetAsDelegate(contents, true); SessionTabHelper::FromWebContents(contents)->SetWindowID(session_id()); content::NotificationService::current()->Notify( chrome::NOTIFICATION_TAB_PARENTED, content::Source(contents), content::NotificationService::NoDetails()); SyncHistoryWithTabs(index); UpdateWindowForLoadingStateChanged(contents, true); interstitial_observers_.push_back(new InterstitialObserver(this, contents)); SessionService* session_service = SessionServiceFactory::GetForProfile(profile_); if (session_service) { session_service->TabInserted(contents); int new_active_index = tab_strip_model_->active_index(); if (index < new_active_index) session_service->SetSelectedTabInWindow(session_id(), new_active_index); } } ",0 "put_input_token(unsigned char **buf_out, gss_buffer_t input_token, unsigned int buflen) { int ret; /* if token length is 0, we do not want to send */ if (input_token->length == 0) return (0); if (input_token->length > buflen) return (-1); *(*buf_out)++ = OCTET_STRING; if ((ret = gssint_put_der_length(input_token->length, buf_out, input_token->length))) return (ret); TWRITE_STR(*buf_out, input_token->value, input_token->length); return (0); } ",0 "nodelist_add_microdesc(microdesc_t *md) { networkstatus_t *ns = networkstatus_get_latest_consensus_by_flavor(FLAV_MICRODESC); const routerstatus_t *rs; node_t *node; if (ns == NULL) return NULL; init_nodelist(); /* Microdescriptors don't carry an identity digest, so we need to figure * it out by looking up the routerstatus. */ rs = router_get_consensus_status_by_descriptor_digest(ns, md->digest); if (rs == NULL) return NULL; node = node_get_mutable_by_id(rs->identity_digest); if (node) { if (node->md) node->md->held_by_nodes--; node->md = md; md->held_by_nodes++; } return node; } ",0 "static void kvm_mmu_notifier_invalidate_page(struct mmu_notifier *mn, struct mm_struct *mm, unsigned long address) { struct kvm *kvm = mmu_notifier_to_kvm(mn); int need_tlb_flush, idx; /* * When ->invalidate_page runs, the linux pte has been zapped * already but the page is still allocated until * ->invalidate_page returns. So if we increase the sequence * here the kvm page fault will notice if the spte can't be * established because the page is going to be freed. If * instead the kvm page fault establishes the spte before * ->invalidate_page runs, kvm_unmap_hva will release it * before returning. * * The sequence increase only need to be seen at spin_unlock * time, and not at spin_lock time. * * Increasing the sequence after the spin_unlock would be * unsafe because the kvm page fault could then establish the * pte after kvm_unmap_hva returned, without noticing the page * is going to be freed. */ idx = srcu_read_lock(&kvm->srcu); spin_lock(&kvm->mmu_lock); kvm->mmu_notifier_seq++; need_tlb_flush = kvm_unmap_hva(kvm, address) | kvm->tlbs_dirty; spin_unlock(&kvm->mmu_lock); srcu_read_unlock(&kvm->srcu, idx); /* we've to flush the tlb before the pages can be freed */ if (need_tlb_flush) kvm_flush_remote_tlbs(kvm); } ",0 "void WebContentsImpl::RunJavaScriptMessage( RenderViewHost* rvh, const base::string16& message, const base::string16& default_prompt, const GURL& frame_url, JavaScriptMessageType javascript_message_type, IPC::Message* reply_msg, bool* did_suppress_message) { bool suppress_this_message = static_cast(rvh)->is_swapped_out() || ShowingInterstitialPage() || !delegate_ || delegate_->ShouldSuppressDialogs() || !delegate_->GetJavaScriptDialogManager(); if (!suppress_this_message) { std::string accept_lang = GetContentClient()->browser()-> GetAcceptLangs(GetBrowserContext()); dialog_manager_ = delegate_->GetJavaScriptDialogManager(); dialog_manager_->RunJavaScriptDialog( this, frame_url.GetOrigin(), accept_lang, javascript_message_type, message, default_prompt, base::Bind(&WebContentsImpl::OnDialogClosed, base::Unretained(this), rvh, reply_msg), &suppress_this_message); } *did_suppress_message = suppress_this_message; if (suppress_this_message) { OnDialogClosed(rvh, reply_msg, false, base::string16()); } } ",0 "void WebsiteSettings::RecordWebsiteSettingsAction( WebsiteSettingsAction action) { UMA_HISTOGRAM_ENUMERATION(""WebsiteSettings.Action"", action, WEBSITE_SETTINGS_COUNT); if (site_url_.SchemeIs(url::kHttpsScheme)) { UMA_HISTOGRAM_ENUMERATION(""WebsiteSettings.Action.HttpsUrl"", action, WEBSITE_SETTINGS_COUNT); } } ",0 "JsVar *jsvGetFlatStringFromPointer(char *v) { JsVar *secondVar = (JsVar*)v; JsVar *flatStr = secondVar-1; assert(jsvIsFlatString(flatStr)); return flatStr; } ",0 "LoginBigUserView* LockContentsView::TestApi::opt_secondary_big_view() const { return view_->opt_secondary_big_view_; } ",0 "static MagickBooleanType ClosePixelCacheOnDisk(CacheInfo *cache_info) { int status; status=(-1); if (cache_info->file != -1) { status=close(cache_info->file); cache_info->file=(-1); RelinquishMagickResource(FileResource,1); } return(status == -1 ? MagickFalse : MagickTrue); } ",0 "static void xhci_doorbell_write(void *ptr, hwaddr reg, uint64_t val, unsigned size) { XHCIState *xhci = ptr; unsigned int epid, streamid; trace_usb_xhci_doorbell_write(reg, val); if (!xhci_running(xhci)) { DPRINTF(""xhci: wrote doorbell while xHC stopped or paused\n""); return; } reg >>= 2; if (reg == 0) { if (val == 0) { xhci_process_commands(xhci); } else { DPRINTF(""xhci: bad doorbell 0 write: 0x%x\n"", (uint32_t)val); } } else { epid = val & 0xff; streamid = (val >> 16) & 0xffff; if (reg > xhci->numslots) { DPRINTF(""xhci: bad doorbell %d\n"", (int)reg); } else if (epid > 31) { DPRINTF(""xhci: bad doorbell %d write: 0x%x\n"", (int)reg, (uint32_t)val); } else { xhci_kick_ep(xhci, reg, epid, streamid); } } } ",0 "int hugetlb_treat_movable_handler(struct ctl_table *table, int write, void __user *buffer, size_t *length, loff_t *ppos) { proc_dointvec(table, write, buffer, length, ppos); if (hugepages_treat_as_movable) htlb_alloc_mask = GFP_HIGHUSER_MOVABLE; else htlb_alloc_mask = GFP_HIGHUSER; return 0; } ",0 "static __be32 get_client_locked(struct nfs4_client *clp) { struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id); lockdep_assert_held(&nn->client_lock); if (is_client_expired(clp)) return nfserr_expired; atomic_inc(&clp->cl_refcount); return nfs_ok; } ",0 " virtual status_t readNextPacket(MediaBuffer **buffer) { return _readNextPacket(buffer, /* calcVorbisTimestamp = */ true); } ",0 "unix_sck_send_msg(hsm_com_client_hdl_t *hdl, char *snd_buf, int snd_len, char *rcv_buf, int rcv_len, int timeout) { int nread = 0; int n; fd_set rset; struct timeval tm; int offset = 0; if (write(hdl->client_fd,snd_buf,snd_len)<0) { printf(""return failed.\n""); return 0; } tm.tv_sec = timeout; tm.tv_usec = 0; FD_ZERO(&rset); FD_SET(hdl->client_fd,&rset); while(1) { if ( (n = select(hdl->client_fd + 1,&rset,NULL,NULL,&tm)) < 0){ return 0; } if (FD_ISSET(hdl->client_fd, &rset)) { if ( (nread = unix_sck_read_data(hdl->client_fd, &hdl->scr, hdl->recv_buf, hdl->buf_len, &offset)) > 0) { if(nread <= rcv_len){ memcpy(rcv_buf,hdl->recv_buf,nread); return nread; } printf(""response too big\n""); return 0; } else if(nread < 0) { printf(""Skipping since we need more data\n""); continue; } else { printf(""Response is 0\n""); return 0; } } } return nread; } ",0 "static ssize_t map_size_show(struct uio_mem *mem, char *buf) { return sprintf(buf, ""0x%lx\n"", mem->size); } ",0 "status_t OMXNodeInstance::allocateBufferWithBackup( OMX_U32 portIndex, const sp ¶ms, OMX::buffer_id *buffer, OMX_U32 allottedSize) { if (params == NULL || buffer == NULL) { ALOGE(""b/25884056""); return BAD_VALUE; } Mutex::Autolock autoLock(mLock); if (allottedSize > params->size() || portIndex >= NELEM(mNumPortBuffers)) { return BAD_VALUE; } bool copy = mMetadataType[portIndex] == kMetadataBufferTypeInvalid; BufferMeta *buffer_meta = new BufferMeta( params, portIndex, (portIndex == kPortIndexInput) && copy /* copyToOmx */, (portIndex == kPortIndexOutput) && copy /* copyFromOmx */, NULL /* data */); OMX_BUFFERHEADERTYPE *header; OMX_ERRORTYPE err = OMX_AllocateBuffer( mHandle, &header, portIndex, buffer_meta, allottedSize); if (err != OMX_ErrorNone) { CLOG_ERROR(allocateBufferWithBackup, err, SIMPLE_BUFFER(portIndex, (size_t)allottedSize, params->pointer())); delete buffer_meta; buffer_meta = NULL; *buffer = 0; return StatusFromOMXError(err); } CHECK_EQ(header->pAppPrivate, buffer_meta); memset(header->pBuffer, 0, header->nAllocLen); *buffer = makeBufferID(header); addActiveBuffer(portIndex, *buffer); sp bufferSource(getGraphicBufferSource()); if (bufferSource != NULL && portIndex == kPortIndexInput) { bufferSource->addCodecBuffer(header); } CLOG_BUFFER(allocateBufferWithBackup, NEW_BUFFER_FMT(*buffer, portIndex, ""%zu@%p :> %u@%p"", params->size(), params->pointer(), allottedSize, header->pBuffer)); return OK; } ",1 "IntRect RenderLayerScrollableArea::resizerCornerRect(const IntRect& bounds, ResizerHitTestType resizerHitTestType) const { if (box().style()->resize() == RESIZE_NONE) return IntRect(); IntRect corner = cornerRect(box().style(), horizontalScrollbar(), verticalScrollbar(), bounds); if (resizerHitTestType == ResizerForTouch) { int expandRatio = ResizerControlExpandRatioForTouch - 1; corner.move(-corner.width() * expandRatio, -corner.height() * expandRatio); corner.expand(corner.width() * expandRatio, corner.height() * expandRatio); } return corner; } ",0 "static CURLcode nss_setup_connect(struct connectdata *conn, int sockindex) { PRFileDesc *model = NULL; PRFileDesc *nspr_io = NULL; PRFileDesc *nspr_io_stub = NULL; PRBool ssl_no_cache; PRBool ssl_cbc_random_iv; struct Curl_easy *data = conn->data; curl_socket_t sockfd = conn->sock[sockindex]; struct ssl_connect_data *connssl = &conn->ssl[sockindex]; CURLcode result; SSLVersionRange sslver = { SSL_LIBRARY_VERSION_TLS_1_0, /* min */ SSL_LIBRARY_VERSION_TLS_1_0 /* max */ }; connssl->data = data; /* list of all NSS objects we need to destroy in Curl_nss_close() */ connssl->obj_list = Curl_llist_alloc(nss_destroy_object); if(!connssl->obj_list) return CURLE_OUT_OF_MEMORY; /* FIXME. NSS doesn't support multiple databases open at the same time. */ PR_Lock(nss_initlock); result = nss_init(conn->data); if(result) { PR_Unlock(nss_initlock); goto error; } result = CURLE_SSL_CONNECT_ERROR; if(!mod) { char *configstring = aprintf(""library=%s name=PEM"", pem_library); if(!configstring) { PR_Unlock(nss_initlock); goto error; } mod = SECMOD_LoadUserModule(configstring, NULL, PR_FALSE); free(configstring); if(!mod || !mod->loaded) { if(mod) { SECMOD_DestroyModule(mod); mod = NULL; } infof(data, ""WARNING: failed to load NSS PEM library %s. Using "" ""OpenSSL PEM certificates will not work.\n"", pem_library); } } PK11_SetPasswordFunc(nss_get_password); PR_Unlock(nss_initlock); model = PR_NewTCPSocket(); if(!model) goto error; model = SSL_ImportFD(NULL, model); if(SSL_OptionSet(model, SSL_SECURITY, PR_TRUE) != SECSuccess) goto error; if(SSL_OptionSet(model, SSL_HANDSHAKE_AS_SERVER, PR_FALSE) != SECSuccess) goto error; if(SSL_OptionSet(model, SSL_HANDSHAKE_AS_CLIENT, PR_TRUE) != SECSuccess) goto error; /* do not use SSL cache if disabled or we are not going to verify peer */ ssl_no_cache = (conn->ssl_config.sessionid && data->set.ssl.verifypeer) ? PR_FALSE : PR_TRUE; if(SSL_OptionSet(model, SSL_NO_CACHE, ssl_no_cache) != SECSuccess) goto error; /* enable/disable the requested SSL version(s) */ if(nss_init_sslver(&sslver, data) != CURLE_OK) goto error; if(SSL_VersionRangeSet(model, &sslver) != SECSuccess) goto error; ssl_cbc_random_iv = !data->set.ssl_enable_beast; #ifdef SSL_CBC_RANDOM_IV /* unless the user explicitly asks to allow the protocol vulnerability, we use the work-around */ if(SSL_OptionSet(model, SSL_CBC_RANDOM_IV, ssl_cbc_random_iv) != SECSuccess) infof(data, ""warning: failed to set SSL_CBC_RANDOM_IV = %d\n"", ssl_cbc_random_iv); #else if(ssl_cbc_random_iv) infof(data, ""warning: support for SSL_CBC_RANDOM_IV not compiled in\n""); #endif if(data->set.ssl.cipher_list) { if(set_ciphers(data, model, data->set.ssl.cipher_list) != SECSuccess) { result = CURLE_SSL_CIPHER; goto error; } } if(!data->set.ssl.verifypeer && data->set.ssl.verifyhost) infof(data, ""warning: ignoring value of ssl.verifyhost\n""); /* bypass the default SSL_AuthCertificate() hook in case we do not want to * verify peer */ if(SSL_AuthCertificateHook(model, nss_auth_cert_hook, conn) != SECSuccess) goto error; data->set.ssl.certverifyresult=0; /* not checked yet */ if(SSL_BadCertHook(model, BadCertHandler, conn) != SECSuccess) goto error; if(SSL_HandshakeCallback(model, HandshakeCallback, conn) != SECSuccess) goto error; if(data->set.ssl.verifypeer) { const CURLcode rv = nss_load_ca_certificates(conn, sockindex); if(rv) { result = rv; goto error; } } if(data->set.ssl.CRLfile) { const CURLcode rv = nss_load_crl(data->set.ssl.CRLfile); if(rv) { result = rv; goto error; } infof(data, "" CRLfile: %s\n"", data->set.ssl.CRLfile); } if(data->set.str[STRING_CERT]) { char *nickname = dup_nickname(data, STRING_CERT); if(nickname) { /* we are not going to use libnsspem.so to read the client cert */ connssl->obj_clicert = NULL; } else { CURLcode rv = cert_stuff(conn, sockindex, data->set.str[STRING_CERT], data->set.str[STRING_KEY]); if(rv) { /* failf() is already done in cert_stuff() */ result = rv; goto error; } } /* store the nickname for SelectClientCert() called during handshake */ connssl->client_nickname = nickname; } else connssl->client_nickname = NULL; if(SSL_GetClientAuthDataHook(model, SelectClientCert, (void *)connssl) != SECSuccess) { result = CURLE_SSL_CERTPROBLEM; goto error; } /* wrap OS file descriptor by NSPR's file descriptor abstraction */ nspr_io = PR_ImportTCPSocket(sockfd); if(!nspr_io) goto error; /* create our own NSPR I/O layer */ nspr_io_stub = PR_CreateIOLayerStub(nspr_io_identity, &nspr_io_methods); if(!nspr_io_stub) { PR_Close(nspr_io); goto error; } /* make the per-connection data accessible from NSPR I/O callbacks */ nspr_io_stub->secret = (void *)connssl; /* push our new layer to the NSPR I/O stack */ if(PR_PushIOLayer(nspr_io, PR_TOP_IO_LAYER, nspr_io_stub) != PR_SUCCESS) { PR_Close(nspr_io); PR_Close(nspr_io_stub); goto error; } /* import our model socket onto the current I/O stack */ connssl->handle = SSL_ImportFD(model, nspr_io); if(!connssl->handle) { PR_Close(nspr_io); goto error; } PR_Close(model); /* We don't need this any more */ model = NULL; /* This is the password associated with the cert that we're using */ if(data->set.str[STRING_KEY_PASSWD]) { SSL_SetPKCS11PinArg(connssl->handle, data->set.str[STRING_KEY_PASSWD]); } #ifdef SSL_ENABLE_OCSP_STAPLING if(data->set.ssl.verifystatus) { if(SSL_OptionSet(connssl->handle, SSL_ENABLE_OCSP_STAPLING, PR_TRUE) != SECSuccess) goto error; } #endif #ifdef SSL_ENABLE_NPN if(SSL_OptionSet(connssl->handle, SSL_ENABLE_NPN, conn->bits.tls_enable_npn ? PR_TRUE : PR_FALSE) != SECSuccess) goto error; #endif #ifdef SSL_ENABLE_ALPN if(SSL_OptionSet(connssl->handle, SSL_ENABLE_ALPN, conn->bits.tls_enable_alpn ? PR_TRUE : PR_FALSE) != SECSuccess) goto error; #endif #if NSSVERNUM >= 0x030f04 /* 3.15.4 */ if(data->set.ssl.falsestart) { if(SSL_OptionSet(connssl->handle, SSL_ENABLE_FALSE_START, PR_TRUE) != SECSuccess) goto error; if(SSL_SetCanFalseStartCallback(connssl->handle, CanFalseStartCallback, conn) != SECSuccess) goto error; } #endif #if defined(SSL_ENABLE_NPN) || defined(SSL_ENABLE_ALPN) if(conn->bits.tls_enable_npn || conn->bits.tls_enable_alpn) { int cur = 0; unsigned char protocols[128]; #ifdef USE_NGHTTP2 if(data->set.httpversion >= CURL_HTTP_VERSION_2) { protocols[cur++] = NGHTTP2_PROTO_VERSION_ID_LEN; memcpy(&protocols[cur], NGHTTP2_PROTO_VERSION_ID, NGHTTP2_PROTO_VERSION_ID_LEN); cur += NGHTTP2_PROTO_VERSION_ID_LEN; } #endif protocols[cur++] = ALPN_HTTP_1_1_LENGTH; memcpy(&protocols[cur], ALPN_HTTP_1_1, ALPN_HTTP_1_1_LENGTH); cur += ALPN_HTTP_1_1_LENGTH; if(SSL_SetNextProtoNego(connssl->handle, protocols, cur) != SECSuccess) goto error; } #endif /* Force handshake on next I/O */ if(SSL_ResetHandshake(connssl->handle, /* asServer */ PR_FALSE) != SECSuccess) goto error; /* propagate hostname to the TLS layer */ if(SSL_SetURL(connssl->handle, conn->host.name) != SECSuccess) goto error; /* prevent NSS from re-using the session for a different hostname */ if(SSL_SetSockPeerID(connssl->handle, conn->host.name) != SECSuccess) goto error; return CURLE_OK; error: if(model) PR_Close(model); return nss_fail_connect(connssl, data, result); } ",0 "static void saved_cmdlines_stop(struct seq_file *m, void *v) { arch_spin_unlock(&trace_cmdline_lock); preempt_enable(); } ",0 "find_pa_data(const METHOD_DATA *md, unsigned type) { size_t i; if (md == NULL) return NULL; for (i = 0; i < md->len; i++) if (md->val[i].padata_type == type) return &md->val[i]; return NULL; } ",0 "bool OmniboxViewViews::MaybeFocusTabButton() { if (SelectedSuggestionHasTabMatch() && model()->popup_model()->selected_line_state() == OmniboxPopupModel::NORMAL) { model()->popup_model()->SetSelectedLineState( OmniboxPopupModel::BUTTON_FOCUSED); popup_view_->ProvideButtonFocusHint( model()->popup_model()->selected_line()); return true; } return false; } ",0 "bool MediaPlayer::isLooping() { ALOGV(""isLooping""); Mutex::Autolock _l(mLock); if (mPlayer != 0) { return mLoop; } ALOGV(""isLooping: no active player""); return false; } ",0 "static void rb_advance_reader(struct ring_buffer_per_cpu *cpu_buffer) { struct ring_buffer_event *event; struct buffer_page *reader; unsigned length; reader = rb_get_reader_page(cpu_buffer); /* This function should not be called when buffer is empty */ if (RB_WARN_ON(cpu_buffer, !reader)) return; event = rb_reader_event(cpu_buffer); if (event->type_len <= RINGBUF_TYPE_DATA_TYPE_LEN_MAX) cpu_buffer->read++; rb_update_read_stamp(cpu_buffer, event); length = rb_event_length(event); cpu_buffer->reader_page->read += length; } ",0 "void DefaultAudioDestinationHandler::CreatePlatformDestination() { platform_destination_ = AudioDestination::Create(*this, ChannelCount(), latency_hint_); } ",0 "static long f2fs_fallocate(struct file *file, int mode, loff_t offset, loff_t len) { struct inode *inode = file_inode(file); long ret; if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE)) return -EOPNOTSUPP; mutex_lock(&inode->i_mutex); if (mode & FALLOC_FL_PUNCH_HOLE) ret = punch_hole(inode, offset, len); else ret = expand_inode_data(inode, offset, len, mode); if (!ret) { inode->i_mtime = inode->i_ctime = CURRENT_TIME; mark_inode_dirty(inode); } mutex_unlock(&inode->i_mutex); trace_f2fs_fallocate(inode, mode, offset, len, ret); return ret; } ",0 "gfx::Size WebContentsViewAura::GetMaximumSize() const { return gfx::Size(); } ",0 "error::Error GLES2DecoderPassthroughImpl::DoGetString(GLenum name, uint32_t bucket_id) { std::string extensions; const char* str = nullptr; switch (name) { case GL_VERSION: str = GetServiceVersionString(feature_info_.get()); break; case GL_SHADING_LANGUAGE_VERSION: str = GetServiceShadingLanguageVersionString(feature_info_.get()); break; case GL_EXTENSIONS: { extensions = gfx::MakeExtensionString(feature_info_->extensions()); str = extensions.c_str(); break; } default: str = reinterpret_cast(api()->glGetStringFn(name)); break; } Bucket* bucket = CreateBucket(bucket_id); bucket->SetFromString(str); return error::kNoError; } ",0 "void libxsmm_sparse_csc_reader( libxsmm_generated_code* io_generated_code, const char* i_csc_file_in, unsigned int** o_row_idx, unsigned int** o_column_idx, double** o_values, unsigned int* o_row_count, unsigned int* o_column_count, unsigned int* o_element_count ) { FILE *l_csc_file_handle; const unsigned int l_line_length = 512; char l_line[512/*l_line_length*/+1]; unsigned int l_header_read = 0; unsigned int* l_column_idx_id = NULL; unsigned int l_i = 0; l_csc_file_handle = fopen( i_csc_file_in, ""r"" ); if ( l_csc_file_handle == NULL ) { LIBXSMM_HANDLE_ERROR( io_generated_code, LIBXSMM_ERR_CSC_INPUT ); return; } while (fgets(l_line, l_line_length, l_csc_file_handle) != NULL) { if ( strlen(l_line) == l_line_length ) { free(*o_row_idx); free(*o_column_idx); free(*o_values); free(l_column_idx_id); *o_row_idx = 0; *o_column_idx = 0; *o_values = 0; fclose( l_csc_file_handle ); /* close mtx file */ LIBXSMM_HANDLE_ERROR( io_generated_code, LIBXSMM_ERR_CSC_READ_LEN ); return; } /* check if we are still reading comments header */ if ( l_line[0] == '%' ) { continue; } else { /* if we are the first line after comment header, we allocate our data structures */ if ( l_header_read == 0 ) { if ( sscanf(l_line, ""%u %u %u"", o_row_count, o_column_count, o_element_count) == 3 ) { /* allocate CSC data structure matching mtx file */ *o_row_idx = (unsigned int*) malloc(sizeof(unsigned int) * (*o_element_count)); *o_column_idx = (unsigned int*) malloc(sizeof(unsigned int) * ((size_t)(*o_column_count) + 1)); *o_values = (double*) malloc(sizeof(double) * (*o_element_count)); l_column_idx_id = (unsigned int*) malloc(sizeof(unsigned int) * (*o_column_count)); /* check if mallocs were successful */ if ( ( *o_row_idx == NULL ) || ( *o_column_idx == NULL ) || ( *o_values == NULL ) || ( l_column_idx_id == NULL ) ) { free(*o_row_idx); free(*o_column_idx); free(*o_values); free(l_column_idx_id); *o_row_idx = 0; *o_column_idx = 0; *o_values = 0; fclose(l_csc_file_handle); /* close mtx file */ LIBXSMM_HANDLE_ERROR( io_generated_code, LIBXSMM_ERR_CSC_ALLOC_DATA ); return; } /* set everything to zero for init */ memset(*o_row_idx, 0, sizeof(unsigned int) * (*o_element_count)); memset(*o_column_idx, 0, sizeof(unsigned int) * ((size_t)(*o_column_count) + 1)); memset(*o_values, 0, sizeof(double) * (*o_element_count)); memset(l_column_idx_id, 0, sizeof(unsigned int) * (*o_column_count)); /* init column idx */ for (l_i = 0; l_i <= *o_column_count; ++l_i) { (*o_column_idx)[l_i] = *o_element_count; } /* init */ (*o_column_idx)[0] = 0; l_i = 0; l_header_read = 1; } else { LIBXSMM_HANDLE_ERROR( io_generated_code, LIBXSMM_ERR_CSC_READ_DESC ); fclose( l_csc_file_handle ); /* close mtx file */ return; } /* now we read the actual content */ } else { unsigned int l_row = 0, l_column = 0; double l_value = 0; /* read a line of content */ if ( sscanf(l_line, ""%u %u %lf"", &l_row, &l_column, &l_value) != 3 ) { free(*o_row_idx); free(*o_column_idx); free(*o_values); free(l_column_idx_id); *o_row_idx = 0; *o_column_idx = 0; *o_values = 0; fclose(l_csc_file_handle); /* close mtx file */ LIBXSMM_HANDLE_ERROR( io_generated_code, LIBXSMM_ERR_CSC_READ_ELEMS ); return; } /* adjust numbers to zero termination */ l_row--; l_column--; /* add these values to row and value structure */ (*o_row_idx)[l_i] = l_row; (*o_values)[l_i] = l_value; l_i++; /* handle columns, set id to own for this column, yeah we need to handle empty columns */ l_column_idx_id[l_column] = 1; (*o_column_idx)[l_column+1] = l_i; } } } /* close mtx file */ fclose( l_csc_file_handle ); /* check if we read a file which was consistent */ if ( l_i != (*o_element_count) ) { free(*o_row_idx); free(*o_column_idx); free(*o_values); free(l_column_idx_id); *o_row_idx = 0; *o_column_idx = 0; *o_values = 0; LIBXSMM_HANDLE_ERROR( io_generated_code, LIBXSMM_ERR_CSC_LEN ); return; } if ( l_column_idx_id != NULL ) { /* let's handle empty columns */ for ( l_i = 0; l_i < (*o_column_count); l_i++) { if ( l_column_idx_id[l_i] == 0 ) { (*o_column_idx)[l_i+1] = (*o_column_idx)[l_i]; } } /* free helper data structure */ free( l_column_idx_id ); } } ",1 "Document& Document::axObjectCacheOwner() const { Document* top = const_cast(this); LocalFrame* frame = this->frame(); if (!frame) return *top; while (frame && frame->owner() && frame->owner()->isLocal()) { HTMLFrameOwnerElement* owner = toHTMLFrameOwnerElement(frame->owner()); top = &owner->document(); frame = top->frame(); } if (top->frame() && top->frame()->pagePopupOwner()) { ASSERT(!top->m_axObjectCache); return top->frame()->pagePopupOwner()->document().axObjectCacheOwner(); } ASSERT(top); return *top; } ",0 "static void __patch_reloc(RBuffer *buf, ut32 addr_to_patch, ut32 data_offset) { ut8 val[4] = { 0 }; r_write_le32 (val, data_offset); r_buf_write_at (buf, addr_to_patch, (void *)val, sizeof (val)); } ",0 "AP_DECLARE(void) ap_finalize_request_protocol(request_rec *r) { int status = ap_discard_request_body(r); /* tell the filter chain there is no more content coming */ if (status) { error_output_stream(r, status); } if (!r->eos_sent) { end_output_stream(r); } } ",0 "void SessionService::ResetFromCurrentBrowsers() { ScheduleReset(); } ",0 "void GpuProcessHost::GetHasGpuProcess(base::OnceCallback callback) { if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::BindOnce(&GpuProcessHost::GetHasGpuProcess, std::move(callback))); return; } bool has_gpu = false; for (size_t i = 0; i < arraysize(g_gpu_process_hosts); ++i) { GpuProcessHost* host = g_gpu_process_hosts[i]; if (host && ValidateHost(host)) { has_gpu = true; break; } } std::move(callback).Run(has_gpu); } ",0 "void ChromeDownloadManagerDelegate::AddItemToPersistentStore( DownloadItem* item) { download_history_->AddEntry(item, base::Bind(&ChromeDownloadManagerDelegate::OnItemAddedToPersistentStore, base::Unretained(this))); } ",0 "static zend_object_value date_object_new_timezone(zend_class_entry *class_type TSRMLS_DC) { return date_object_new_timezone_ex(class_type, NULL TSRMLS_CC); } ",0 "bool HTMLFormElement::HasLegalLinkAttribute(const QualifiedName& name) const { return name == actionAttr || HTMLElement::HasLegalLinkAttribute(name); } ",0 "static void caif_ctrl_cb(struct cflayer *layr, enum caif_ctrlcmd flow, int phyid) { struct caifsock *cf_sk = container_of(layr, struct caifsock, layer); switch (flow) { case CAIF_CTRLCMD_FLOW_ON_IND: /* OK from modem to start sending again */ set_tx_flow_on(cf_sk); cf_sk->sk.sk_state_change(&cf_sk->sk); break; case CAIF_CTRLCMD_FLOW_OFF_IND: /* Modem asks us to shut up */ set_tx_flow_off(cf_sk); cf_sk->sk.sk_state_change(&cf_sk->sk); break; case CAIF_CTRLCMD_INIT_RSP: /* We're now connected */ caif_client_register_refcnt(&cf_sk->layer, cfsk_hold, cfsk_put); cf_sk->sk.sk_state = CAIF_CONNECTED; set_tx_flow_on(cf_sk); cf_sk->sk.sk_shutdown = 0; cf_sk->sk.sk_state_change(&cf_sk->sk); break; case CAIF_CTRLCMD_DEINIT_RSP: /* We're now disconnected */ cf_sk->sk.sk_state = CAIF_DISCONNECTED; cf_sk->sk.sk_state_change(&cf_sk->sk); break; case CAIF_CTRLCMD_INIT_FAIL_RSP: /* Connect request failed */ cf_sk->sk.sk_err = ECONNREFUSED; cf_sk->sk.sk_state = CAIF_DISCONNECTED; cf_sk->sk.sk_shutdown = SHUTDOWN_MASK; /* * Socket ""standards"" seems to require POLLOUT to * be set at connect failure. */ set_tx_flow_on(cf_sk); cf_sk->sk.sk_state_change(&cf_sk->sk); break; case CAIF_CTRLCMD_REMOTE_SHUTDOWN_IND: /* Modem has closed this connection, or device is down. */ cf_sk->sk.sk_shutdown = SHUTDOWN_MASK; cf_sk->sk.sk_err = ECONNRESET; set_rx_flow_on(cf_sk); cf_sk->sk.sk_error_report(&cf_sk->sk); break; default: pr_debug(""Unexpected flow command %d\n"", flow); } } ",0 "void V8TestObject::FloatAttributeAttributeSetterCallback( const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_floatAttribute_Setter""); v8::Local v8_value = info[0]; test_object_v8_internal::FloatAttributeAttributeSetter(v8_value, info); } ",0 "const sc_path_t *sc_get_mf_path(void) { static const sc_path_t mf_path = { {0x3f, 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 2, 0, 0, SC_PATH_TYPE_PATH, {{0},0} }; return &mf_path; } ",0 "static void voidMethodArrayBufferArgMethod(const v8::FunctionCallbackInfo& info) { if (UNLIKELY(info.Length() < 1)) { throwTypeError(ExceptionMessages::failedToExecute(""voidMethodArrayBufferArg"", ""TestObjectPython"", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIsolate()); return; } TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); V8TRYCATCH_VOID(ArrayBuffer*, arrayBufferArg, info[0]->IsArrayBuffer() ? V8ArrayBuffer::toNative(v8::Handle::Cast(info[0])) : 0); imp->voidMethodArrayBufferArg(arrayBufferArg); } ",0 "activate_desktop_file (ActivateParameters *parameters, NautilusFile *file) { ActivateParametersDesktop *parameters_desktop; char *primary, *secondary, *display_name; GtkWidget *dialog; GdkScreen *screen; char *uri; screen = gtk_widget_get_screen (GTK_WIDGET (parameters->parent_window)); if (!nautilus_file_is_trusted_link (file)) { /* copy the parts of parameters we are interested in as the orignal will be freed */ parameters_desktop = g_new0 (ActivateParametersDesktop, 1); if (parameters->parent_window) { parameters_desktop->parent_window = parameters->parent_window; g_object_add_weak_pointer (G_OBJECT (parameters_desktop->parent_window), (gpointer *) ¶meters_desktop->parent_window); } parameters_desktop->file = nautilus_file_ref (file); primary = _(""Untrusted application launcher""); display_name = nautilus_file_get_display_name (file); secondary = g_strdup_printf (_(""The application launcher “%s” has not been marked as trusted. "" ""If you do not know the source of this file, launching it may be unsafe."" ), display_name); dialog = gtk_message_dialog_new (parameters->parent_window, 0, GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE, NULL); g_object_set (dialog, ""text"", primary, ""secondary-text"", secondary, NULL); gtk_dialog_add_button (GTK_DIALOG (dialog), _(""_Launch Anyway""), RESPONSE_RUN); if (nautilus_file_can_set_permissions (file)) { gtk_dialog_add_button (GTK_DIALOG (dialog), _(""Mark as _Trusted""), RESPONSE_MARK_TRUSTED); } gtk_dialog_add_button (GTK_DIALOG (dialog), _(""_Cancel""), GTK_RESPONSE_CANCEL); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL); g_signal_connect (dialog, ""response"", G_CALLBACK (untrusted_launcher_response_callback), parameters_desktop); gtk_widget_show (dialog); g_free (display_name); g_free (secondary); return; } uri = nautilus_file_get_uri (file); DEBUG (""Launching trusted launcher %s"", uri); nautilus_launch_desktop_file (screen, uri, NULL, parameters->parent_window); g_free (uri); } ",1 "const char *get_camera_metadata_tag_name(uint32_t tag) { uint32_t tag_section = tag >> 16; if (tag_section >= VENDOR_SECTION && vendor_tag_ops != NULL) { return vendor_tag_ops->get_tag_name( vendor_tag_ops, tag); } if (tag_section >= ANDROID_SECTION_COUNT || tag >= camera_metadata_section_bounds[tag_section][1] ) { return NULL; } uint32_t tag_index = tag & 0xFFFF; return tag_info[tag_section][tag_index].tag_name; } ",0 "void CL_GlobalServers_f( void ) { netadr_t to; int count, i, masterNum; char command[1024], *masteraddress; if ((count = Cmd_Argc()) < 3 || (masterNum = atoi(Cmd_Argv(1))) < 0 || masterNum > MAX_MASTER_SERVERS - 1) { Com_Printf(""usage: globalservers [keywords]\n"", MAX_MASTER_SERVERS - 1); return; } sprintf(command, ""sv_master%d"", masterNum + 1); masteraddress = Cvar_VariableString(command); if(!*masteraddress) { Com_Printf( ""CL_GlobalServers_f: Error: No master server address given.\n""); return; } i = NET_StringToAdr(masteraddress, &to, NA_UNSPEC); if(!i) { Com_Printf( ""CL_GlobalServers_f: Error: could not resolve address of master %s\n"", masteraddress); return; } else if(i == 2) to.port = BigShort(PORT_MASTER); Com_Printf(""Requesting servers from master %s...\n"", masteraddress); cls.numglobalservers = -1; cls.pingUpdateSource = AS_GLOBAL; if (to.type == NA_IP6 || to.type == NA_MULTICAST6) { int v4enabled = Cvar_VariableIntegerValue(""net_enabled"") & NET_ENABLEV4; if(v4enabled) { Com_sprintf(command, sizeof(command), ""getserversExt %s %s"", com_gamename->string, Cmd_Argv(2)); } else { Com_sprintf(command, sizeof(command), ""getserversExt %s %s ipv6"", com_gamename->string, Cmd_Argv(2)); } } else if ( !Q_stricmp( com_gamename->string, LEGACY_MASTER_GAMENAME ) ) Com_sprintf(command, sizeof(command), ""getservers %s"", Cmd_Argv(2)); else Com_sprintf(command, sizeof(command), ""getservers %s %s"", com_gamename->string, Cmd_Argv(2)); for (i=3; i < count; i++) { Q_strcat(command, sizeof(command), "" ""); Q_strcat(command, sizeof(command), Cmd_Argv(i)); } NET_OutOfBandPrint( NS_SERVER, to, ""%s"", command ); } ",0 "static ssize_t ib_ucm_create_id(struct ib_ucm_file *file, const char __user *inbuf, int in_len, int out_len) { struct ib_ucm_create_id cmd; struct ib_ucm_create_id_resp resp; struct ib_ucm_context *ctx; int result; if (out_len < sizeof(resp)) return -ENOSPC; if (copy_from_user(&cmd, inbuf, sizeof(cmd))) return -EFAULT; mutex_lock(&file->file_mutex); ctx = ib_ucm_ctx_alloc(file); mutex_unlock(&file->file_mutex); if (!ctx) return -ENOMEM; ctx->uid = cmd.uid; ctx->cm_id = ib_create_cm_id(file->device->ib_dev, ib_ucm_event_handler, ctx); if (IS_ERR(ctx->cm_id)) { result = PTR_ERR(ctx->cm_id); goto err1; } resp.id = ctx->id; if (copy_to_user((void __user *)(unsigned long)cmd.response, &resp, sizeof(resp))) { result = -EFAULT; goto err2; } return 0; err2: ib_destroy_cm_id(ctx->cm_id); err1: mutex_lock(&ctx_id_mutex); idr_remove(&ctx_id_table, ctx->id); mutex_unlock(&ctx_id_mutex); kfree(ctx); return result; } ",0 "jpc_pchglist_t *jpc_pchglist_copy(jpc_pchglist_t *pchglist) { jpc_pchglist_t *newpchglist; jpc_pchg_t *newpchg; int pchgno; if (!(newpchglist = jpc_pchglist_create())) { return 0; } for (pchgno = 0; pchgno < pchglist->numpchgs; ++pchgno) { if (!(newpchg = jpc_pchg_copy(pchglist->pchgs[pchgno])) || jpc_pchglist_insert(newpchglist, -1, newpchg)) { jpc_pchglist_destroy(newpchglist); return 0; } } return newpchglist; } ",0 "static struct dx_countlimit *get_dx_countlimit(struct inode *inode, struct ext4_dir_entry *dirent, int *offset) { struct ext4_dir_entry *dp; struct dx_root_info *root; int count_offset; if (le16_to_cpu(dirent->rec_len) == EXT4_BLOCK_SIZE(inode->i_sb)) count_offset = 8; else if (le16_to_cpu(dirent->rec_len) == 12) { dp = (struct ext4_dir_entry *)(((void *)dirent) + 12); if (le16_to_cpu(dp->rec_len) != EXT4_BLOCK_SIZE(inode->i_sb) - 12) return NULL; root = (struct dx_root_info *)(((void *)dp + 12)); if (root->reserved_zero || root->info_length != sizeof(struct dx_root_info)) return NULL; count_offset = 32; } else return NULL; if (offset) *offset = count_offset; return (struct dx_countlimit *)(((void *)dirent) + count_offset); } ",0 "sshpkt_get_string_direct(struct ssh *ssh, const u_char **valp, size_t *lenp) { return sshbuf_get_string_direct(ssh->state->incoming_packet, valp, lenp); } ",0 "void RenderFrameHostImpl::DidCommitProvisionalLoad( std::unique_ptr validated_params, mojom::DidCommitProvisionalLoadInterfaceParamsPtr interface_params) { if (MaybeInterceptCommitCallback(nullptr, validated_params.get(), &interface_params)) { DidCommitNavigation(std::move(navigation_request_), std::move(validated_params), std::move(interface_params)); } } ",0 "void Element::updateLabel(TreeScope* scope, const AtomicString& oldForAttributeValue, const AtomicString& newForAttributeValue) { ASSERT(hasTagName(labelTag)); if (!inDocument()) return; if (oldForAttributeValue == newForAttributeValue) return; if (!oldForAttributeValue.isEmpty()) scope->removeLabel(oldForAttributeValue, static_cast(this)); if (!newForAttributeValue.isEmpty()) scope->addLabel(newForAttributeValue, static_cast(this)); } ",0 "Response InspectorNetworkAgent::replayXHR(const String& request_id) { String actual_request_id = request_id; XHRReplayData* xhr_replay_data = resources_data_->XhrReplayData(request_id); if (!xhr_replay_data) return Response::Error(""Given id does not correspond to XHR""); ExecutionContext* execution_context = xhr_replay_data->GetExecutionContext(); if (execution_context->IsContextDestroyed()) { resources_data_->SetXHRReplayData(request_id, 0); return Response::Error(""Document is already detached""); } XMLHttpRequest* xhr = XMLHttpRequest::Create(execution_context); execution_context->RemoveURLFromMemoryCache(xhr_replay_data->Url()); xhr->open(xhr_replay_data->Method(), xhr_replay_data->Url(), xhr_replay_data->Async(), IGNORE_EXCEPTION_FOR_TESTING); if (xhr_replay_data->IncludeCredentials()) xhr->setWithCredentials(true, IGNORE_EXCEPTION_FOR_TESTING); for (const auto& header : xhr_replay_data->Headers()) { xhr->setRequestHeader(header.key, header.value, IGNORE_EXCEPTION_FOR_TESTING); } xhr->SendForInspectorXHRReplay(xhr_replay_data->FormData(), IGNORE_EXCEPTION_FOR_TESTING); replay_xhrs_.insert(xhr); return Response::OK(); } ",0 "json_t *json_rpc_call(CURL *curl, const char *url, const char *userpass, const char *rpc_req, bool probe, bool longpoll, int *rolltime, struct pool *pool, bool share) { long timeout = longpoll ? (60 * 60) : 60; struct data_buffer all_data = {NULL, 0}; struct header_info hi = {NULL, 0, NULL, NULL, false, false, false}; char len_hdr[64], user_agent_hdr[128]; char curl_err_str[CURL_ERROR_SIZE]; struct curl_slist *headers = NULL; struct upload_buffer upload_data; json_t *val, *err_val, *res_val; bool probing = false; double byte_count; json_error_t err; int rc; memset(&err, 0, sizeof(err)); /* it is assumed that 'curl' is freshly [re]initialized at this pt */ if (probe) probing = !pool->probed; curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout); curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, curl_debug_cb); curl_easy_setopt(curl, CURLOPT_DEBUGDATA, (void *)pool); curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1); curl_easy_setopt(curl, CURLOPT_URL, url); curl_easy_setopt(curl, CURLOPT_ENCODING, """"); curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1); /* Shares are staggered already and delays in submission can be costly * so do not delay them */ if (!opt_delaynet || share) curl_easy_setopt(curl, CURLOPT_TCP_NODELAY, 1); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, all_data_cb); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &all_data); curl_easy_setopt(curl, CURLOPT_READFUNCTION, upload_data_cb); curl_easy_setopt(curl, CURLOPT_READDATA, &upload_data); curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curl_err_str); curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, resp_hdr_cb); curl_easy_setopt(curl, CURLOPT_HEADERDATA, &hi); curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_TRY); if (pool->rpc_proxy) { curl_easy_setopt(curl, CURLOPT_PROXY, pool->rpc_proxy); curl_easy_setopt(curl, CURLOPT_PROXYTYPE, pool->rpc_proxytype); } else if (opt_socks_proxy) { curl_easy_setopt(curl, CURLOPT_PROXY, opt_socks_proxy); curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4); } if (userpass) { curl_easy_setopt(curl, CURLOPT_USERPWD, userpass); curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); } if (longpoll) keep_curlalive(curl); curl_easy_setopt(curl, CURLOPT_POST, 1); if (opt_protocol) applog(LOG_DEBUG, ""JSON protocol request:\n%s"", rpc_req); upload_data.buf = rpc_req; upload_data.len = strlen(rpc_req); sprintf(len_hdr, ""Content-Length: %lu"", (unsigned long) upload_data.len); sprintf(user_agent_hdr, ""User-Agent: %s"", PACKAGE_STRING); headers = curl_slist_append(headers, ""Content-type: application/json""); headers = curl_slist_append(headers, ""X-Mining-Extensions: longpoll midstate rollntime submitold""); if (likely(global_hashrate)) { char ghashrate[255]; sprintf(ghashrate, ""X-Mining-Hashrate: %llu"", global_hashrate); headers = curl_slist_append(headers, ghashrate); } headers = curl_slist_append(headers, len_hdr); headers = curl_slist_append(headers, user_agent_hdr); headers = curl_slist_append(headers, ""Expect:""); /* disable Expect hdr*/ curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); if (opt_delaynet) { /* Don't delay share submission, but still track the nettime */ if (!share) { long long now_msecs, last_msecs; struct timeval now, last; cgtime(&now); last_nettime(&last); now_msecs = (long long)now.tv_sec * 1000; now_msecs += now.tv_usec / 1000; last_msecs = (long long)last.tv_sec * 1000; last_msecs += last.tv_usec / 1000; if (now_msecs > last_msecs && now_msecs - last_msecs < 250) { struct timespec rgtp; rgtp.tv_sec = 0; rgtp.tv_nsec = (250 - (now_msecs - last_msecs)) * 1000000; nanosleep(&rgtp, NULL); } } set_nettime(); } rc = curl_easy_perform(curl); if (rc) { applog(LOG_INFO, ""HTTP request failed: %s"", curl_err_str); goto err_out; } if (!all_data.buf) { applog(LOG_DEBUG, ""Empty data received in json_rpc_call.""); goto err_out; } pool->cgminer_pool_stats.times_sent++; if (curl_easy_getinfo(curl, CURLINFO_SIZE_UPLOAD, &byte_count) == CURLE_OK) pool->cgminer_pool_stats.bytes_sent += byte_count; pool->cgminer_pool_stats.times_received++; if (curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD, &byte_count) == CURLE_OK) pool->cgminer_pool_stats.bytes_received += byte_count; if (probing) { pool->probed = true; /* If X-Long-Polling was found, activate long polling */ if (hi.lp_path) { if (pool->hdr_path != NULL) free(pool->hdr_path); pool->hdr_path = hi.lp_path; } else pool->hdr_path = NULL; if (hi.stratum_url) { pool->stratum_url = hi.stratum_url; hi.stratum_url = NULL; } } else { if (hi.lp_path) { free(hi.lp_path); hi.lp_path = NULL; } if (hi.stratum_url) { free(hi.stratum_url); hi.stratum_url = NULL; } } *rolltime = hi.rolltime; pool->cgminer_pool_stats.rolltime = hi.rolltime; pool->cgminer_pool_stats.hadrolltime = hi.hadrolltime; pool->cgminer_pool_stats.canroll = hi.canroll; pool->cgminer_pool_stats.hadexpire = hi.hadexpire; val = JSON_LOADS(all_data.buf, &err); if (!val) { applog(LOG_INFO, ""JSON decode failed(%d): %s"", err.line, err.text); if (opt_protocol) applog(LOG_DEBUG, ""JSON protocol response:\n%s"", (char *)(all_data.buf)); goto err_out; } if (opt_protocol) { char *s = json_dumps(val, JSON_INDENT(3)); applog(LOG_DEBUG, ""JSON protocol response:\n%s"", s); free(s); } /* JSON-RPC valid response returns a non-null 'result', * and a null 'error'. */ res_val = json_object_get(val, ""result""); err_val = json_object_get(val, ""error""); if (!res_val ||(err_val && !json_is_null(err_val))) { char *s; if (err_val) s = json_dumps(err_val, JSON_INDENT(3)); else s = strdup(""(unknown reason)""); applog(LOG_INFO, ""JSON-RPC call failed: %s"", s); free(s); goto err_out; } if (hi.reason) { json_object_set_new(val, ""reject-reason"", json_string(hi.reason)); free(hi.reason); hi.reason = NULL; } successful_connect = true; databuf_free(&all_data); curl_slist_free_all(headers); curl_easy_reset(curl); return val; err_out: databuf_free(&all_data); curl_slist_free_all(headers); curl_easy_reset(curl); if (!successful_connect) applog(LOG_DEBUG, ""Failed to connect in json_rpc_call""); curl_easy_setopt(curl, CURLOPT_FRESH_CONNECT, 1); return NULL; } ",0 "static void cipso_v4_doi_free_rcu(struct rcu_head *entry) { struct cipso_v4_doi *doi_def; doi_def = container_of(entry, struct cipso_v4_doi, rcu); cipso_v4_doi_free(doi_def); } ",0 "struct sc_card_driver * sc_get_muscle_driver(void) { return sc_get_driver(); } ",0 "bgp_packet_withdraw (struct peer *peer, struct stream *s, struct prefix *p, afi_t afi, safi_t safi, struct prefix_rd *prd, u_char *tag) { unsigned long cp; unsigned long attrlen_pnt; bgp_size_t size; cp = stream_get_endp (s); stream_putc (s, BGP_ATTR_FLAG_OPTIONAL); stream_putc (s, BGP_ATTR_MP_UNREACH_NLRI); attrlen_pnt = stream_get_endp (s); stream_putc (s, 0); /* Length of this attribute. */ stream_putw (s, family2afi (p->family)); if (safi == SAFI_MPLS_VPN) { /* SAFI */ stream_putc (s, SAFI_MPLS_LABELED_VPN); /* prefix. */ stream_putc (s, p->prefixlen + 88); stream_put (s, tag, 3); stream_put (s, prd->val, 8); stream_put (s, &p->u.prefix, PSIZE (p->prefixlen)); } else { /* SAFI */ stream_putc (s, safi); /* prefix */ stream_put_prefix (s, p); } /* Set MP attribute length. */ size = stream_get_endp (s) - attrlen_pnt - 1; stream_putc_at (s, attrlen_pnt, size); return stream_get_endp (s) - cp; } ",0 "static void deprecatedVoidMethodMethod(const v8::FunctionCallbackInfo& info) { TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); imp->deprecatedVoidMethod(); } ",0 "scoped_ptr ResourceDispatcherHostImpl::MaybeInterceptAsStream( const base::FilePath& plugin_path, net::URLRequest* request, ResourceResponse* response, std::string* payload) { payload->clear(); ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); const std::string& mime_type = response->head.mime_type; GURL origin; if (!delegate_ || !delegate_->ShouldInterceptResourceAsStream( request, plugin_path, mime_type, &origin, payload)) { return scoped_ptr(); } StreamContext* stream_context = GetStreamContextForResourceContext(info->GetContext()); scoped_ptr handler( new StreamResourceHandler(request, stream_context->registry(), origin)); info->set_is_stream(true); scoped_ptr stream_info(new StreamInfo); stream_info->handle = handler->stream()->CreateHandle(); stream_info->original_url = request->url(); stream_info->mime_type = mime_type; if (response->head.headers.get()) { stream_info->response_headers = new net::HttpResponseHeaders(response->head.headers->raw_headers()); } delegate_->OnStreamCreated(request, std::move(stream_info)); return std::move(handler); } ",0 "static int crc32c_sparc64_setkey(struct crypto_shash *hash, const u8 *key, unsigned int keylen) { u32 *mctx = crypto_shash_ctx(hash); if (keylen != sizeof(u32)) { crypto_shash_set_flags(hash, CRYPTO_TFM_RES_BAD_KEY_LEN); return -EINVAL; } *(__le32 *)mctx = le32_to_cpup((__le32 *)key); return 0; } ",0 "void logsignal(int s) { if (!arg_debug) return; openlog(""firejail"", LOG_NDELAY | LOG_PID, LOG_USER); syslog(LOG_INFO, ""Signal %d caught"", s); closelog(); } ",0 "static void tun_net_init(struct net_device *dev) { struct tun_struct *tun = netdev_priv(dev); switch (tun->flags & TUN_TYPE_MASK) { case TUN_TUN_DEV: dev->netdev_ops = &tun_netdev_ops; /* Point-to-Point TUN Device */ dev->hard_header_len = 0; dev->addr_len = 0; dev->mtu = 1500; /* Zero header length */ dev->type = ARPHRD_NONE; dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST; dev->tx_queue_len = TUN_READQ_SIZE; /* We prefer our own queue length */ break; case TUN_TAP_DEV: dev->netdev_ops = &tap_netdev_ops; /* Ethernet TAP Device */ ether_setup(dev); dev->priv_flags &= ~IFF_TX_SKB_SHARING; eth_hw_addr_random(dev); dev->tx_queue_len = TUN_READQ_SIZE; /* We prefer our own queue length */ break; } } ",0 "static void migrate_task_rq_fair(struct task_struct *p, int new_cpu) { /* * As blocked tasks retain absolute vruntime the migration needs to * deal with this by subtracting the old and adding the new * min_vruntime -- the latter is done by enqueue_entity() when placing * the task on the new runqueue. */ if (p->state == TASK_WAKING) { struct sched_entity *se = &p->se; struct cfs_rq *cfs_rq = cfs_rq_of(se); u64 min_vruntime; #ifndef CONFIG_64BIT u64 min_vruntime_copy; do { min_vruntime_copy = cfs_rq->min_vruntime_copy; smp_rmb(); min_vruntime = cfs_rq->min_vruntime; } while (min_vruntime != min_vruntime_copy); #else min_vruntime = cfs_rq->min_vruntime; #endif se->vruntime -= min_vruntime; } if (p->on_rq == TASK_ON_RQ_MIGRATING) { /* * In case of TASK_ON_RQ_MIGRATING we in fact hold the 'old' * rq->lock and can modify state directly. */ lockdep_assert_held(&task_rq(p)->lock); detach_entity_cfs_rq(&p->se); } else { /* * We are supposed to update the task to ""current"" time, then * its up to date and ready to go to new CPU/cfs_rq. But we * have difficulty in getting what current time is, so simply * throw away the out-of-date time. This will result in the * wakee task is less decayed, but giving the wakee more load * sounds not bad. */ remove_entity_load_avg(&p->se); } /* Tell new CPU we are migrated */ p->se.avg.last_update_time = 0; /* We have migrated, no longer consider this task hot */ p->se.exec_start = 0; update_scan_period(p, new_cpu); } ",0 "AuthBackend::AuthBackend() : QObject(0) , d(new Private) { } ",0 "static void ept_set_mmio_spte_mask(void) { /* * EPT Misconfigurations can be generated if the value of bits 2:0 * of an EPT paging-structure entry is 110b (write/execute). * Also, magic bits (0x3ull << 62) is set to quickly identify mmio * spte. */ kvm_mmu_set_mmio_spte_mask((0x3ull << 62) | 0x6ull); } ",0 "static int cryp_set_dma_transfer(struct cryp_ctx *ctx, struct scatterlist *sg, int len, enum dma_data_direction direction) { struct dma_async_tx_descriptor *desc; struct dma_chan *channel = NULL; dma_cookie_t cookie; dev_dbg(ctx->device->dev, ""[%s]: "", __func__); if (unlikely(!IS_ALIGNED((u32)sg, 4))) { dev_err(ctx->device->dev, ""[%s]: Data in sg list isn't "" ""aligned! Addr: 0x%08x"", __func__, (u32)sg); return -EFAULT; } switch (direction) { case DMA_TO_DEVICE: channel = ctx->device->dma.chan_mem2cryp; ctx->device->dma.sg_src = sg; ctx->device->dma.sg_src_len = dma_map_sg(channel->device->dev, ctx->device->dma.sg_src, ctx->device->dma.nents_src, direction); if (!ctx->device->dma.sg_src_len) { dev_dbg(ctx->device->dev, ""[%s]: Could not map the sg list (TO_DEVICE)"", __func__); return -EFAULT; } dev_dbg(ctx->device->dev, ""[%s]: Setting up DMA for buffer "" ""(TO_DEVICE)"", __func__); desc = dmaengine_prep_slave_sg(channel, ctx->device->dma.sg_src, ctx->device->dma.sg_src_len, direction, DMA_CTRL_ACK); break; case DMA_FROM_DEVICE: channel = ctx->device->dma.chan_cryp2mem; ctx->device->dma.sg_dst = sg; ctx->device->dma.sg_dst_len = dma_map_sg(channel->device->dev, ctx->device->dma.sg_dst, ctx->device->dma.nents_dst, direction); if (!ctx->device->dma.sg_dst_len) { dev_dbg(ctx->device->dev, ""[%s]: Could not map the sg list (FROM_DEVICE)"", __func__); return -EFAULT; } dev_dbg(ctx->device->dev, ""[%s]: Setting up DMA for buffer "" ""(FROM_DEVICE)"", __func__); desc = dmaengine_prep_slave_sg(channel, ctx->device->dma.sg_dst, ctx->device->dma.sg_dst_len, direction, DMA_CTRL_ACK | DMA_PREP_INTERRUPT); desc->callback = cryp_dma_out_callback; desc->callback_param = ctx; break; default: dev_dbg(ctx->device->dev, ""[%s]: Invalid DMA direction"", __func__); return -EFAULT; } cookie = dmaengine_submit(desc); dma_async_issue_pending(channel); return 0; } ",0 "SYSCALL_DEFINE4(sendmmsg, int, fd, struct mmsghdr __user *, mmsg, unsigned int, vlen, unsigned int, flags) { return __sys_sendmmsg(fd, mmsg, vlen, flags); } ",0 " void DestroyPersistentHistogramAllocator() { allocator_ = nullptr; GlobalHistogramAllocator::ReleaseForTesting(); } ",0 "static void pformat(struct pt_regs *regs, unsigned int insn, unsigned int opf) { struct fpustate *f = FPUSTATE; unsigned long rs1, rs2, gsr, scale, rd_val; gsr = current_thread_info()->gsr[0]; scale = (gsr >> 3) & (opf == FPACK16_OPF ? 0xf : 0x1f); switch (opf) { case FPACK16_OPF: { unsigned long byte; rs2 = fpd_regval(f, RS2(insn)); rd_val = 0; for (byte = 0; byte < 4; byte++) { unsigned int val; s16 src = (rs2 >> (byte * 16UL)) & 0xffffUL; int scaled = src << scale; int from_fixed = scaled >> 7; val = ((from_fixed < 0) ? 0 : (from_fixed > 255) ? 255 : from_fixed); rd_val |= (val << (8 * byte)); } *fps_regaddr(f, RD(insn)) = rd_val; break; } case FPACK32_OPF: { unsigned long word; rs1 = fpd_regval(f, RS1(insn)); rs2 = fpd_regval(f, RS2(insn)); rd_val = (rs1 << 8) & ~(0x000000ff000000ffUL); for (word = 0; word < 2; word++) { unsigned long val; s32 src = (rs2 >> (word * 32UL)); s64 scaled = src << scale; s64 from_fixed = scaled >> 23; val = ((from_fixed < 0) ? 0 : (from_fixed > 255) ? 255 : from_fixed); rd_val |= (val << (32 * word)); } *fpd_regaddr(f, RD(insn)) = rd_val; break; } case FPACKFIX_OPF: { unsigned long word; rs2 = fpd_regval(f, RS2(insn)); rd_val = 0; for (word = 0; word < 2; word++) { long val; s32 src = (rs2 >> (word * 32UL)); s64 scaled = src << scale; s64 from_fixed = scaled >> 16; val = ((from_fixed < -32768) ? -32768 : (from_fixed > 32767) ? 32767 : from_fixed); rd_val |= ((val & 0xffff) << (word * 16)); } *fps_regaddr(f, RD(insn)) = rd_val; break; } case FEXPAND_OPF: { unsigned long byte; rs2 = fps_regval(f, RS2(insn)); rd_val = 0; for (byte = 0; byte < 4; byte++) { unsigned long val; u8 src = (rs2 >> (byte * 8)) & 0xff; val = src << 4; rd_val |= (val << (byte * 16)); } *fpd_regaddr(f, RD(insn)) = rd_val; break; } case FPMERGE_OPF: { rs1 = fps_regval(f, RS1(insn)); rs2 = fps_regval(f, RS2(insn)); rd_val = (((rs2 & 0x000000ff) << 0) | ((rs1 & 0x000000ff) << 8) | ((rs2 & 0x0000ff00) << 8) | ((rs1 & 0x0000ff00) << 16) | ((rs2 & 0x00ff0000) << 16) | ((rs1 & 0x00ff0000) << 24) | ((rs2 & 0xff000000) << 24) | ((rs1 & 0xff000000) << 32)); *fpd_regaddr(f, RD(insn)) = rd_val; break; } } } ",0 "void WebContentsImpl::Close(RenderViewHost* rvh) { #if defined(OS_MACOSX) if (view_->IsEventTracking()) { view_->CloseTabAfterEventTracking(); return; } #endif if (delegate_ && rvh == GetRenderViewHost()) delegate_->CloseContents(this); } ",0 "bool ClientSession::ShouldIgnoreRemoteMouseInput( const protocol::MouseEvent& event) const { if (remote_mouse_button_state_ != 0) return false; if (awaiting_continue_approval_) return true; int64 millis = (base::Time::Now() - latest_local_input_time_) .InMilliseconds(); if (millis < kRemoteBlockTimeoutMillis) return true; return false; } ",0 "void BrowserMainLoop::CreateStartupTasks() { TRACE_EVENT0(""startup"", ""BrowserMainLoop::CreateStartupTasks""); DCHECK(!startup_task_runner_); #if defined(OS_ANDROID) startup_task_runner_ = std::make_unique( base::Bind(&BrowserStartupComplete), base::ThreadTaskRunnerHandle::Get()); #else startup_task_runner_ = std::make_unique( base::Callback(), base::ThreadTaskRunnerHandle::Get()); #endif StartupTask pre_create_threads = base::Bind(&BrowserMainLoop::PreCreateThreads, base::Unretained(this)); startup_task_runner_->AddTask(pre_create_threads); StartupTask create_threads = base::Bind(&BrowserMainLoop::CreateThreads, base::Unretained(this)); startup_task_runner_->AddTask(create_threads); StartupTask browser_thread_started = base::Bind( &BrowserMainLoop::BrowserThreadsStarted, base::Unretained(this)); startup_task_runner_->AddTask(browser_thread_started); StartupTask pre_main_message_loop_run = base::Bind( &BrowserMainLoop::PreMainMessageLoopRun, base::Unretained(this)); startup_task_runner_->AddTask(pre_main_message_loop_run); #if defined(OS_ANDROID) if (parameters_.ui_task) { startup_task_runner_->RunAllTasksNow(); } else { startup_task_runner_->StartRunningTasksAsync(); } #else startup_task_runner_->RunAllTasksNow(); #endif } ",0 "static int TSS_sha1(const unsigned char *data, unsigned int datalen, unsigned char *digest) { struct sdesc *sdesc; int ret; sdesc = init_sdesc(hashalg); if (IS_ERR(sdesc)) { pr_info(""trusted_key: can't alloc %s\n"", hash_alg); return PTR_ERR(sdesc); } ret = crypto_shash_digest(&sdesc->shash, data, datalen, digest); kfree(sdesc); return ret; } ",0 "prepare_task_switch(struct rq *rq, struct task_struct *prev, struct task_struct *next) { fire_sched_out_preempt_notifiers(prev, next); prepare_lock_switch(rq, next); prepare_arch_switch(next); } ",0 "int main(int argc, char** argv) { /* Kernel starts us with all fd's closed. * But it's dangerous: * fprintf(stderr) can dump messages into random fds, etc. * Ensure that if any of fd 0,1,2 is closed, we open it to /dev/null. */ int fd = xopen(""/dev/null"", O_RDWR); while (fd < 2) fd = xdup(fd); if (fd > 2) close(fd); if (argc < 8) { /* percent specifier: %s %c %p %u %g %t %e %h */ /* argv: [0] [1] [2] [3] [4] [5] [6] [7] [8]*/ error_msg_and_die(""Usage: %s SIGNO CORE_SIZE_LIMIT PID UID GID TIME BINARY_NAME [HOSTNAME]"", argv[0]); } /* Not needed on 2.6.30. * At least 2.6.18 has a bug where * argv[1] = ""SIGNO CORE_SIZE_LIMIT PID ..."" * argv[2] = ""CORE_SIZE_LIMIT PID ..."" * and so on. Fixing it: */ if (strchr(argv[1], ' ')) { int i; for (i = 1; argv[i]; i++) { strchrnul(argv[i], ' ')[0] = '\0'; } } logmode = LOGMODE_JOURNAL; /* Parse abrt.conf */ load_abrt_conf(); /* ... and plugins/CCpp.conf */ bool setting_MakeCompatCore; bool setting_SaveBinaryImage; { map_string_t *settings = new_map_string(); load_abrt_plugin_conf_file(""CCpp.conf"", settings); const char *value; value = get_map_string_item_or_NULL(settings, ""MakeCompatCore""); setting_MakeCompatCore = value && string_to_bool(value); value = get_map_string_item_or_NULL(settings, ""SaveBinaryImage""); setting_SaveBinaryImage = value && string_to_bool(value); value = get_map_string_item_or_NULL(settings, ""VerboseLog""); if (value) g_verbose = xatoi_positive(value); free_map_string(settings); } errno = 0; const char* signal_str = argv[1]; int signal_no = xatoi_positive(signal_str); off_t ulimit_c = strtoull(argv[2], NULL, 10); if (ulimit_c < 0) /* unlimited? */ { /* set to max possible >0 value */ ulimit_c = ~((off_t)1 << (sizeof(off_t)*8-1)); } const char *pid_str = argv[3]; pid_t pid = xatoi_positive(argv[3]); uid_t uid = xatoi_positive(argv[4]); if (errno || pid <= 0) { perror_msg_and_die(""PID '%s' or limit '%s' is bogus"", argv[3], argv[2]); } { char *s = xmalloc_fopen_fgetline_fclose(VAR_RUN""/abrt/saved_core_pattern""); /* If we have a saved pattern and it's not a ""|PROG ARGS"" thing... */ if (s && s[0] != '|') core_basename = s; else free(s); } struct utsname uts; if (!argv[8]) /* no HOSTNAME? */ { uname(&uts); argv[8] = uts.nodename; } char path[PATH_MAX]; int src_fd_binary = -1; char *executable = get_executable(pid, setting_SaveBinaryImage ? &src_fd_binary : NULL); if (executable && strstr(executable, ""/abrt-hook-ccpp"")) { error_msg_and_die(""PID %lu is '%s', not dumping it to avoid recursion"", (long)pid, executable); } user_pwd = get_cwd(pid); /* may be NULL on error */ log_notice(""user_pwd:'%s'"", user_pwd); sprintf(path, ""/proc/%lu/status"", (long)pid); proc_pid_status = xmalloc_xopen_read_close(path, /*maxsz:*/ NULL); uid_t fsuid = uid; uid_t tmp_fsuid = get_fsuid(); int suid_policy = dump_suid_policy(); if (tmp_fsuid != uid) { /* use root for suided apps unless it's explicitly set to UNSAFE */ fsuid = 0; if (suid_policy == DUMP_SUID_UNSAFE) { fsuid = tmp_fsuid; } } /* Open a fd to compat coredump, if requested and is possible */ if (setting_MakeCompatCore && ulimit_c != 0) /* note: checks ""user_pwd == NULL"" inside; updates core_basename */ user_core_fd = open_user_core(uid, fsuid, pid, &argv[1]); if (executable == NULL) { /* readlink on /proc/$PID/exe failed, don't create abrt dump dir */ error_msg(""Can't read /proc/%lu/exe link"", (long)pid); goto create_user_core; } const char *signame = NULL; switch (signal_no) { case SIGILL : signame = ""ILL"" ; break; case SIGFPE : signame = ""FPE"" ; break; case SIGSEGV: signame = ""SEGV""; break; case SIGBUS : signame = ""BUS"" ; break; //Bus error (bad memory access) case SIGABRT: signame = ""ABRT""; break; //usually when abort() was called case SIGTRAP: signame = ""TRAP""; break; //Trace/breakpoint trap default: goto create_user_core; // not a signal we care about } if (!daemon_is_ok()) { /* not an error, exit with exit code 0 */ log(""abrtd is not running. If it crashed, "" ""/proc/sys/kernel/core_pattern contains a stale value, "" ""consider resetting it to 'core'"" ); goto create_user_core; } if (g_settings_nMaxCrashReportsSize > 0) { /* If free space is less than 1/4 of MaxCrashReportsSize... */ if (low_free_space(g_settings_nMaxCrashReportsSize, g_settings_dump_location)) goto create_user_core; } /* Check /var/tmp/abrt/last-ccpp marker, do not dump repeated crashes * if they happen too often. Else, write new marker value. */ snprintf(path, sizeof(path), ""%s/last-ccpp"", g_settings_dump_location); if (check_recent_crash_file(path, executable)) { /* It is a repeating crash */ goto create_user_core; } const char *last_slash = strrchr(executable, '/'); if (last_slash && strncmp(++last_slash, ""abrt"", 4) == 0) { /* If abrtd/abrt-foo crashes, we don't want to create a _directory_, * since that can make new copy of abrtd to process it, * and maybe crash again... * Unlike dirs, mere files are ignored by abrtd. */ snprintf(path, sizeof(path), ""%s/%s-coredump"", g_settings_dump_location, last_slash); int abrt_core_fd = xopen3(path, O_WRONLY | O_CREAT | O_TRUNC, 0600); off_t core_size = copyfd_eof(STDIN_FILENO, abrt_core_fd, COPYFD_SPARSE); if (core_size < 0 || fsync(abrt_core_fd) != 0) { unlink(path); /* copyfd_eof logs the error including errno string, * but it does not log file name */ error_msg_and_die(""Error saving '%s'"", path); } log(""Saved core dump of pid %lu (%s) to %s (%llu bytes)"", (long)pid, executable, path, (long long)core_size); return 0; } unsigned path_len = snprintf(path, sizeof(path), ""%s/ccpp-%s-%lu.new"", g_settings_dump_location, iso_date_string(NULL), (long)pid); if (path_len >= (sizeof(path) - sizeof(""/""FILENAME_COREDUMP))) { goto create_user_core; } /* use fsuid instead of uid, so we don't expose any sensitive * information of suided app in /var/tmp/abrt */ dd = dd_create(path, fsuid, DEFAULT_DUMP_DIR_MODE); if (dd) { char *rootdir = get_rootdir(pid); dd_create_basic_files(dd, fsuid, (rootdir && strcmp(rootdir, ""/"") != 0) ? rootdir : NULL); char source_filename[sizeof(""/proc/%lu/somewhat_long_name"") + sizeof(long)*3]; int source_base_ofs = sprintf(source_filename, ""/proc/%lu/smaps"", (long)pid); source_base_ofs -= strlen(""smaps""); char *dest_filename = concat_path_file(dd->dd_dirname, ""also_somewhat_longish_name""); char *dest_base = strrchr(dest_filename, '/') + 1; strcpy(source_filename + source_base_ofs, ""maps""); strcpy(dest_base, FILENAME_MAPS); copy_file_ext(source_filename, dest_filename, 0640, dd->dd_uid, dd->dd_gid, O_RDONLY, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL); strcpy(source_filename + source_base_ofs, ""limits""); strcpy(dest_base, FILENAME_LIMITS); copy_file_ext(source_filename, dest_filename, 0640, dd->dd_uid, dd->dd_gid, O_RDONLY, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL); strcpy(source_filename + source_base_ofs, ""cgroup""); strcpy(dest_base, FILENAME_CGROUP); copy_file_ext(source_filename, dest_filename, 0640, dd->dd_uid, dd->dd_gid, O_RDONLY, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL); strcpy(dest_base, FILENAME_OPEN_FDS); dump_fd_info(dest_filename, source_filename, source_base_ofs, dd->dd_uid, dd->dd_gid); free(dest_filename); dd_save_text(dd, FILENAME_ANALYZER, ""CCpp""); dd_save_text(dd, FILENAME_TYPE, ""CCpp""); dd_save_text(dd, FILENAME_EXECUTABLE, executable); dd_save_text(dd, FILENAME_PID, pid_str); dd_save_text(dd, FILENAME_PROC_PID_STATUS, proc_pid_status); if (user_pwd) dd_save_text(dd, FILENAME_PWD, user_pwd); if (rootdir) { if (strcmp(rootdir, ""/"") != 0) dd_save_text(dd, FILENAME_ROOTDIR, rootdir); } char *reason = xasprintf(""%s killed by SIG%s"", last_slash, signame ? signame : signal_str); dd_save_text(dd, FILENAME_REASON, reason); free(reason); char *cmdline = get_cmdline(pid); dd_save_text(dd, FILENAME_CMDLINE, cmdline ? : """"); free(cmdline); char *environ = get_environ(pid); dd_save_text(dd, FILENAME_ENVIRON, environ ? : """"); free(environ); char *fips_enabled = xmalloc_fopen_fgetline_fclose(""/proc/sys/crypto/fips_enabled""); if (fips_enabled) { if (strcmp(fips_enabled, ""0"") != 0) dd_save_text(dd, ""fips_enabled"", fips_enabled); free(fips_enabled); } dd_save_text(dd, FILENAME_ABRT_VERSION, VERSION); if (src_fd_binary > 0) { strcpy(path + path_len, ""/""FILENAME_BINARY); int dst_fd = create_or_die(path); off_t sz = copyfd_eof(src_fd_binary, dst_fd, COPYFD_SPARSE); if (fsync(dst_fd) != 0 || close(dst_fd) != 0 || sz < 0) { dd_delete(dd); error_msg_and_die(""Error saving '%s'"", path); } close(src_fd_binary); } strcpy(path + path_len, ""/""FILENAME_COREDUMP); int abrt_core_fd = create_or_die(path); /* We write both coredumps at once. * We can't write user coredump first, since it might be truncated * and thus can't be copied and used as abrt coredump; * and if we write abrt coredump first and then copy it as user one, * then we have a race when process exits but coredump does not exist yet: * $ echo -e '#include\nmain(){raise(SIGSEGV);}' | gcc -o test -x c - * $ rm -f core*; ulimit -c unlimited; ./test; ls -l core* * 21631 Segmentation fault (core dumped) ./test * ls: cannot access core*: No such file or directory <=== BAD */ off_t core_size = copyfd_sparse(STDIN_FILENO, abrt_core_fd, user_core_fd, ulimit_c); if (fsync(abrt_core_fd) != 0 || close(abrt_core_fd) != 0 || core_size < 0) { unlink(path); dd_delete(dd); if (user_core_fd >= 0) { xchdir(user_pwd); unlink(core_basename); } /* copyfd_sparse logs the error including errno string, * but it does not log file name */ error_msg_and_die(""Error writing '%s'"", path); } if (user_core_fd >= 0 /* error writing user coredump? */ && (fsync(user_core_fd) != 0 || close(user_core_fd) != 0 /* user coredump is too big? */ || (ulimit_c == 0 /* paranoia */ || core_size > ulimit_c) ) ) { /* nuke it (silently) */ xchdir(user_pwd); unlink(core_basename); } /* Save JVM crash log if it exists. (JVM's coredump per se * is nearly useless for JVM developers) */ { char *java_log = xasprintf(""/tmp/jvm-%lu/hs_error.log"", (long)pid); int src_fd = open(java_log, O_RDONLY); free(java_log); /* If we couldn't open the error log in /tmp directory we can try to * read the log from the current directory. It may produce AVC, it * may produce some error log but all these are expected. */ if (src_fd < 0) { java_log = xasprintf(""%s/hs_err_pid%lu.log"", user_pwd, (long)pid); src_fd = open(java_log, O_RDONLY); free(java_log); } if (src_fd >= 0) { strcpy(path + path_len, ""/hs_err.log""); int dst_fd = create_or_die(path); off_t sz = copyfd_eof(src_fd, dst_fd, COPYFD_SPARSE); if (close(dst_fd) != 0 || sz < 0) { dd_delete(dd); error_msg_and_die(""Error saving '%s'"", path); } close(src_fd); } } /* We close dumpdir before we start catering for crash storm case. * Otherwise, delete_dump_dir's from other concurrent * CCpp's won't be able to delete our dump (their delete_dump_dir * will wait for us), and we won't be able to delete their dumps. * Classic deadlock. */ dd_close(dd); path[path_len] = '\0'; /* path now contains only directory name */ char *newpath = xstrndup(path, path_len - (sizeof("".new"")-1)); if (rename(path, newpath) == 0) strcpy(path, newpath); free(newpath); log(""Saved core dump of pid %lu (%s) to %s (%llu bytes)"", (long)pid, executable, path, (long long)core_size); notify_new_path(path); /* rhbz#539551: ""abrt going crazy when crashing process is respawned"" */ if (g_settings_nMaxCrashReportsSize > 0) { /* x1.25 and round up to 64m: go a bit up, so that usual in-daemon trimming * kicks in first, and we don't ""fight"" with it: */ unsigned maxsize = g_settings_nMaxCrashReportsSize + g_settings_nMaxCrashReportsSize / 4; maxsize |= 63; trim_problem_dirs(g_settings_dump_location, maxsize * (double)(1024*1024), path); } free(rootdir); return 0; } /* We didn't create abrt dump, but may need to create compat coredump */ create_user_core: if (user_core_fd >= 0) { off_t core_size = copyfd_size(STDIN_FILENO, user_core_fd, ulimit_c, COPYFD_SPARSE); if (fsync(user_core_fd) != 0 || close(user_core_fd) != 0 || core_size < 0) { /* perror first, otherwise unlink may trash errno */ perror_msg(""Error writing '%s'"", full_core_basename); xchdir(user_pwd); unlink(core_basename); return 1; } if (ulimit_c == 0 || core_size > ulimit_c) { xchdir(user_pwd); unlink(core_basename); return 1; } log(""Saved core dump of pid %lu to %s (%llu bytes)"", (long)pid, full_core_basename, (long long)core_size); } return 0; } ",1 "void MessageLoop::ClearTaskRunnerForTesting() { DCHECK_EQ(this, current()); DCHECK(!unbound_task_runner_); task_runner_ = nullptr; thread_task_runner_handle_.reset(); } ",0 "smb2_writev_callback(struct mid_q_entry *mid) { struct cifs_writedata *wdata = mid->callback_data; struct cifs_tcon *tcon = tlink_tcon(wdata->cfile->tlink); unsigned int written; struct smb2_write_rsp *rsp = (struct smb2_write_rsp *)mid->resp_buf; unsigned int credits_received = 1; switch (mid->mid_state) { case MID_RESPONSE_RECEIVED: credits_received = le16_to_cpu(rsp->hdr.CreditRequest); wdata->result = smb2_check_receive(mid, tcon->ses->server, 0); if (wdata->result != 0) break; written = le32_to_cpu(rsp->DataLength); /* * Mask off high 16 bits when bytes written as returned * by the server is greater than bytes requested by the * client. OS/2 servers are known to set incorrect * CountHigh values. */ if (written > wdata->bytes) written &= 0xFFFF; if (written < wdata->bytes) wdata->result = -ENOSPC; else wdata->bytes = written; break; case MID_REQUEST_SUBMITTED: case MID_RETRY_NEEDED: wdata->result = -EAGAIN; break; default: wdata->result = -EIO; break; } if (wdata->result) cifs_stats_fail_inc(tcon, SMB2_WRITE_HE); queue_work(cifsiod_wq, &wdata->work); DeleteMidQEntry(mid); add_credits(tcon->ses->server, credits_received, 0); } ",0 "const char *string_of_NPPVariable(int variable) { const char *str; switch (variable) { #define _(VAL) case VAL: str = #VAL; break; _(NPPVpluginNameString); _(NPPVpluginDescriptionString); _(NPPVpluginWindowBool); _(NPPVpluginTransparentBool); _(NPPVjavaClass); _(NPPVpluginWindowSize); _(NPPVpluginTimerInterval); _(NPPVpluginScriptableInstance); _(NPPVpluginScriptableIID); _(NPPVjavascriptPushCallerBool); _(NPPVpluginKeepLibraryInMemory); _(NPPVpluginNeedsXEmbed); _(NPPVpluginScriptableNPObject); _(NPPVformValue); #undef _ default: switch (variable & 0xff) { #define _(VAL, VAR) case VAL: str = #VAR; break _(10, NPPVpluginScriptableInstance); #undef _ default: str = """"; break; } break; } return str; } ",1 "pkinit_server_verify_padata(krb5_context context, krb5_data *req_pkt, krb5_kdc_req * request, krb5_enc_tkt_part * enc_tkt_reply, krb5_pa_data * data, krb5_kdcpreauth_callbacks cb, krb5_kdcpreauth_rock rock, krb5_kdcpreauth_moddata moddata, krb5_kdcpreauth_verify_respond_fn respond, void *arg) { krb5_error_code retval = 0; krb5_data authp_data = {0, 0, NULL}, krb5_authz = {0, 0, NULL}; krb5_pa_pk_as_req *reqp = NULL; krb5_pa_pk_as_req_draft9 *reqp9 = NULL; krb5_auth_pack *auth_pack = NULL; krb5_auth_pack_draft9 *auth_pack9 = NULL; pkinit_kdc_context plgctx = NULL; pkinit_kdc_req_context reqctx = NULL; krb5_checksum cksum = {0, 0, 0, NULL}; krb5_data *der_req = NULL; int valid_eku = 0, valid_san = 0; krb5_data k5data; int is_signed = 1; krb5_pa_data **e_data = NULL; krb5_kdcpreauth_modreq modreq = NULL; pkiDebug(""pkinit_verify_padata: entered!\n""); if (data == NULL || data->length <= 0 || data->contents == NULL) { (*respond)(arg, 0, NULL, NULL, NULL); return; } if (moddata == NULL) { (*respond)(arg, EINVAL, NULL, NULL, NULL); return; } plgctx = pkinit_find_realm_context(context, moddata, request->server); if (plgctx == NULL) { (*respond)(arg, 0, NULL, NULL, NULL); return; } #ifdef DEBUG_ASN1 print_buffer_bin(data->contents, data->length, ""/tmp/kdc_as_req""); #endif /* create a per-request context */ retval = pkinit_init_kdc_req_context(context, &reqctx); if (retval) goto cleanup; reqctx->pa_type = data->pa_type; PADATA_TO_KRB5DATA(data, &k5data); switch ((int)data->pa_type) { case KRB5_PADATA_PK_AS_REQ: pkiDebug(""processing KRB5_PADATA_PK_AS_REQ\n""); retval = k5int_decode_krb5_pa_pk_as_req(&k5data, &reqp); if (retval) { pkiDebug(""decode_krb5_pa_pk_as_req failed\n""); goto cleanup; } #ifdef DEBUG_ASN1 print_buffer_bin(reqp->signedAuthPack.data, reqp->signedAuthPack.length, ""/tmp/kdc_signed_data""); #endif retval = cms_signeddata_verify(context, plgctx->cryptoctx, reqctx->cryptoctx, plgctx->idctx, CMS_SIGN_CLIENT, plgctx->opts->require_crl_checking, (unsigned char *) reqp->signedAuthPack.data, reqp->signedAuthPack.length, (unsigned char **)&authp_data.data, &authp_data.length, (unsigned char **)&krb5_authz.data, &krb5_authz.length, &is_signed); break; case KRB5_PADATA_PK_AS_REP_OLD: case KRB5_PADATA_PK_AS_REQ_OLD: pkiDebug(""processing KRB5_PADATA_PK_AS_REQ_OLD\n""); retval = k5int_decode_krb5_pa_pk_as_req_draft9(&k5data, &reqp9); if (retval) { pkiDebug(""decode_krb5_pa_pk_as_req_draft9 failed\n""); goto cleanup; } #ifdef DEBUG_ASN1 print_buffer_bin(reqp9->signedAuthPack.data, reqp9->signedAuthPack.length, ""/tmp/kdc_signed_data_draft9""); #endif retval = cms_signeddata_verify(context, plgctx->cryptoctx, reqctx->cryptoctx, plgctx->idctx, CMS_SIGN_DRAFT9, plgctx->opts->require_crl_checking, (unsigned char *) reqp9->signedAuthPack.data, reqp9->signedAuthPack.length, (unsigned char **)&authp_data.data, &authp_data.length, (unsigned char **)&krb5_authz.data, &krb5_authz.length, NULL); break; default: pkiDebug(""unrecognized pa_type = %d\n"", data->pa_type); retval = EINVAL; goto cleanup; } if (retval) { pkiDebug(""pkcs7_signeddata_verify failed\n""); goto cleanup; } if (is_signed) { retval = verify_client_san(context, plgctx, reqctx, request->client, &valid_san); if (retval) goto cleanup; if (!valid_san) { pkiDebug(""%s: did not find an acceptable SAN in user "" ""certificate\n"", __FUNCTION__); retval = KRB5KDC_ERR_CLIENT_NAME_MISMATCH; goto cleanup; } retval = verify_client_eku(context, plgctx, reqctx, &valid_eku); if (retval) goto cleanup; if (!valid_eku) { pkiDebug(""%s: did not find an acceptable EKU in user "" ""certificate\n"", __FUNCTION__); retval = KRB5KDC_ERR_INCONSISTENT_KEY_PURPOSE; goto cleanup; } } else { /* !is_signed */ if (!krb5_principal_compare(context, request->client, krb5_anonymous_principal())) { retval = KRB5KDC_ERR_PREAUTH_FAILED; krb5_set_error_message(context, retval, _(""Pkinit request not signed, but client "" ""not anonymous."")); goto cleanup; } } #ifdef DEBUG_ASN1 print_buffer_bin(authp_data.data, authp_data.length, ""/tmp/kdc_auth_pack""); #endif OCTETDATA_TO_KRB5DATA(&authp_data, &k5data); switch ((int)data->pa_type) { case KRB5_PADATA_PK_AS_REQ: retval = k5int_decode_krb5_auth_pack(&k5data, &auth_pack); if (retval) { pkiDebug(""failed to decode krb5_auth_pack\n""); goto cleanup; } retval = krb5_check_clockskew(context, auth_pack->pkAuthenticator.ctime); if (retval) goto cleanup; /* check dh parameters */ if (auth_pack->clientPublicValue != NULL) { retval = server_check_dh(context, plgctx->cryptoctx, reqctx->cryptoctx, plgctx->idctx, &auth_pack->clientPublicValue->algorithm.parameters, plgctx->opts->dh_min_bits); if (retval) { pkiDebug(""bad dh parameters\n""); goto cleanup; } } else if (!is_signed) { /*Anonymous pkinit requires DH*/ retval = KRB5KDC_ERR_PREAUTH_FAILED; krb5_set_error_message(context, retval, _(""Anonymous pkinit without DH public "" ""value not supported."")); goto cleanup; } der_req = cb->request_body(context, rock); retval = krb5_c_make_checksum(context, CKSUMTYPE_NIST_SHA, NULL, 0, der_req, &cksum); if (retval) { pkiDebug(""unable to calculate AS REQ checksum\n""); goto cleanup; } if (cksum.length != auth_pack->pkAuthenticator.paChecksum.length || k5_bcmp(cksum.contents, auth_pack->pkAuthenticator.paChecksum.contents, cksum.length) != 0) { pkiDebug(""failed to match the checksum\n""); #ifdef DEBUG_CKSUM pkiDebug(""calculating checksum on buf size (%d)\n"", req_pkt->length); print_buffer(req_pkt->data, req_pkt->length); pkiDebug(""received checksum type=%d size=%d "", auth_pack->pkAuthenticator.paChecksum.checksum_type, auth_pack->pkAuthenticator.paChecksum.length); print_buffer(auth_pack->pkAuthenticator.paChecksum.contents, auth_pack->pkAuthenticator.paChecksum.length); pkiDebug(""expected checksum type=%d size=%d "", cksum.checksum_type, cksum.length); print_buffer(cksum.contents, cksum.length); #endif retval = KRB5KDC_ERR_PA_CHECKSUM_MUST_BE_INCLUDED; goto cleanup; } /* check if kdcPkId present and match KDC's subjectIdentifier */ if (reqp->kdcPkId.data != NULL) { int valid_kdcPkId = 0; retval = pkinit_check_kdc_pkid(context, plgctx->cryptoctx, reqctx->cryptoctx, plgctx->idctx, (unsigned char *)reqp->kdcPkId.data, reqp->kdcPkId.length, &valid_kdcPkId); if (retval) goto cleanup; if (!valid_kdcPkId) pkiDebug(""kdcPkId in AS_REQ does not match KDC's cert"" ""RFC says to ignore and proceed\n""); } /* remember the decoded auth_pack for verify_padata routine */ reqctx->rcv_auth_pack = auth_pack; auth_pack = NULL; break; case KRB5_PADATA_PK_AS_REP_OLD: case KRB5_PADATA_PK_AS_REQ_OLD: retval = k5int_decode_krb5_auth_pack_draft9(&k5data, &auth_pack9); if (retval) { pkiDebug(""failed to decode krb5_auth_pack_draft9\n""); goto cleanup; } if (auth_pack9->clientPublicValue != NULL) { retval = server_check_dh(context, plgctx->cryptoctx, reqctx->cryptoctx, plgctx->idctx, &auth_pack9->clientPublicValue->algorithm.parameters, plgctx->opts->dh_min_bits); if (retval) { pkiDebug(""bad dh parameters\n""); goto cleanup; } } /* remember the decoded auth_pack for verify_padata routine */ reqctx->rcv_auth_pack9 = auth_pack9; auth_pack9 = NULL; break; } /* remember to set the PREAUTH flag in the reply */ enc_tkt_reply->flags |= TKT_FLG_PRE_AUTH; modreq = (krb5_kdcpreauth_modreq)reqctx; reqctx = NULL; cleanup: if (retval && data->pa_type == KRB5_PADATA_PK_AS_REQ) { pkiDebug(""pkinit_verify_padata failed: creating e-data\n""); if (pkinit_create_edata(context, plgctx->cryptoctx, reqctx->cryptoctx, plgctx->idctx, plgctx->opts, retval, &e_data)) pkiDebug(""pkinit_create_edata failed\n""); } switch ((int)data->pa_type) { case KRB5_PADATA_PK_AS_REQ: free_krb5_pa_pk_as_req(&reqp); free(cksum.contents); break; case KRB5_PADATA_PK_AS_REP_OLD: case KRB5_PADATA_PK_AS_REQ_OLD: free_krb5_pa_pk_as_req_draft9(&reqp9); } free(authp_data.data); free(krb5_authz.data); if (reqctx != NULL) pkinit_fini_kdc_req_context(context, reqctx); free_krb5_auth_pack(&auth_pack); free_krb5_auth_pack_draft9(context, &auth_pack9); (*respond)(arg, retval, modreq, e_data, NULL); } ",1 "void rb_free(struct ring_buffer *rb) { int i; perf_mmap_free_page((unsigned long)rb->user_page); for (i = 0; i < rb->nr_pages; i++) perf_mmap_free_page((unsigned long)rb->data_pages[i]); kfree(rb); } ",0 "_zip_cdir_free(struct zip_cdir *cd) { int i; if (!cd) return; for (i=0; inentry; i++) _zip_dirent_finalize(cd->entry+i); free(cd->comment); free(cd->entry); free(cd); } ",0 "menu_remove_edit(WebKitWebView *page, GArray *argv, GString *result) { (void) page; (void) result; remove_from_menu(argv, WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE); } ",0 "static unsigned long to_ratio(u64 period, u64 runtime) { if (runtime == RUNTIME_INF) return 1ULL << 20; return div64_u64(runtime << 20, period); } ",0 "void V8TestObject::LongAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_longAttribute_Getter""); test_object_v8_internal::LongAttributeAttributeGetter(info); } ",0 "void DevToolsWindow::ShowCertificateViewer( scoped_refptr certificate) { WebContents* inspected_contents = is_docked_ ? GetInspectedWebContents() : main_web_contents_; Browser* browser = NULL; int tab = 0; if (!FindInspectedBrowserAndTabIndex(inspected_contents, &browser, &tab)) return; gfx::NativeWindow parent = browser->window()->GetNativeWindow(); ::ShowCertificateViewer(inspected_contents, parent, certificate.get()); } ",0 "FileTransfer::Init( ClassAd *Ad, bool want_check_perms, priv_state priv, bool use_file_catalog) { char buf[ATTRLIST_MAX_EXPRESSION]; char *dynamic_buf = NULL; ASSERT( daemonCore ); // full Init require DaemonCore methods if( did_init ) { return 1; } dprintf(D_FULLDEBUG,""entering FileTransfer::Init\n""); m_use_file_catalog = use_file_catalog; simple_init = false; if (!TranskeyTable) { if (!(TranskeyTable = new TranskeyHashTable(7, compute_transkey_hash))) { return 0; } } if (ActiveTransferTid >= 0) { EXCEPT(""FileTransfer::Init called during active transfer!""); } if (!TransThreadTable) { if (!(TransThreadTable = new TransThreadHashTable(7, compute_transthread_hash))) { return 0; } } if ( !CommandsRegistered ) { CommandsRegistered = TRUE; daemonCore->Register_Command(FILETRANS_UPLOAD,""FILETRANS_UPLOAD"", (CommandHandler)&FileTransfer::HandleCommands, ""FileTransfer::HandleCommands()"",NULL,WRITE); daemonCore->Register_Command(FILETRANS_DOWNLOAD,""FILETRANS_DOWNLOAD"", (CommandHandler)&FileTransfer::HandleCommands, ""FileTransfer::HandleCommands()"",NULL,WRITE); ReaperId = daemonCore->Register_Reaper(""FileTransfer::Reaper"", (ReaperHandler)&FileTransfer::Reaper, ""FileTransfer::Reaper()"",NULL); if (ReaperId == 1) { EXCEPT(""FileTransfer::Reaper() can not be the default reaper!\n""); } set_seed( time(NULL) + (unsigned long)this + (unsigned long)Ad ); } if (Ad->LookupString(ATTR_TRANSFER_KEY, buf) != 1) { char tempbuf[80]; sprintf(tempbuf,""%x#%x%x%x"",++SequenceNum,(unsigned)time(NULL), get_random_int(),get_random_int()); TransKey = strdup(tempbuf); user_supplied_key = FALSE; sprintf(tempbuf,""%s=\""%s\"""",ATTR_TRANSFER_KEY,TransKey); Ad->InsertOrUpdate(tempbuf); char const *mysocket = global_dc_sinful(); ASSERT(mysocket); Ad->Assign(ATTR_TRANSFER_SOCKET,mysocket); } else { TransKey = strdup(buf); user_supplied_key = TRUE; } if ( !SimpleInit(Ad, want_check_perms, IsServer(), NULL, priv, m_use_file_catalog ) ) { return 0; } if (Ad->LookupString(ATTR_TRANSFER_SOCKET, buf) != 1) { return 0; } TransSock = strdup(buf); buf[0] = '\0'; if ( IsServer() && upload_changed_files ) { CommitFiles(); MyString filelist; const char* current_file = NULL; bool print_comma = false; Directory spool_space( SpoolSpace, desired_priv_state ); while ( (current_file=spool_space.Next()) ) { if ( UserLogFile && !file_strcmp(UserLogFile,current_file) ) { continue; } time_t mod_time; filesize_t filesize; if ( LookupInFileCatalog(current_file, &mod_time, &filesize) ) { if((filesize==-1)) { if(spool_space.GetModifyTime() <= mod_time) { dprintf( D_FULLDEBUG, ""Not including file %s, t: %ld<=%ld, s: N/A\n"", current_file, spool_space.GetModifyTime(), mod_time); continue; } } else if((spool_space.GetModifyTime()==mod_time) && (spool_space.GetFileSize()==filesize) ) { dprintf( D_FULLDEBUG, ""Not including file %s, t: %ld, "" ""s: "" FILESIZE_T_FORMAT ""\n"", current_file, spool_space.GetModifyTime(), spool_space.GetFileSize()); continue; } dprintf( D_FULLDEBUG, ""Including changed file %s, t: %ld, %ld, "" ""s: "" FILESIZE_T_FORMAT "", "" FILESIZE_T_FORMAT ""\n"", current_file, spool_space.GetModifyTime(), mod_time, spool_space.GetFileSize(), filesize ); } if ( print_comma ) { filelist += "",""; } else { print_comma = true; } filelist += current_file; } if ( print_comma ) { MyString intermediateFilesBuf; intermediateFilesBuf.sprintf( ""%s=\""%s\"""", ATTR_TRANSFER_INTERMEDIATE_FILES,filelist.Value()); Ad->InsertOrUpdate(intermediateFilesBuf.Value()); dprintf(D_FULLDEBUG,""%s\n"",buf); } } if ( IsClient() && upload_changed_files ) { dynamic_buf = NULL; Ad->LookupString(ATTR_TRANSFER_INTERMEDIATE_FILES,&dynamic_buf); dprintf(D_FULLDEBUG,""%s=\""%s\""\n"", ATTR_TRANSFER_INTERMEDIATE_FILES, dynamic_buf ? dynamic_buf : ""(none)""); if ( dynamic_buf ) { SpooledIntermediateFiles = strnewp(dynamic_buf); free(dynamic_buf); dynamic_buf = NULL; } } if ( IsServer() ) { MyString key(TransKey); FileTransfer *transobject; if ( TranskeyTable->lookup(key,transobject) < 0 ) { if ( TranskeyTable->insert(key,this) < 0 ) { dprintf(D_ALWAYS, ""FileTransfer::Init failed to insert key in our table\n""); return 0; } } else { EXCEPT(""FileTransfer: Duplicate TransferKeys!""); } } did_init = true; return 1; } ",0 "void GLES2DecoderImpl::DoTransformFeedbackVaryings( GLuint client_program_id, GLsizei count, const char* const* varyings, GLenum buffer_mode) { Program* program = GetProgramInfoNotShader( client_program_id, ""glTransformFeedbackVaryings""); if (!program) { return; } program->TransformFeedbackVaryings(count, varyings, buffer_mode); glTransformFeedbackVaryings( program->service_id(), count, varyings, buffer_mode); } ",0 "LayoutUnit RenderBlock::startAlignedOffsetForLine(LayoutUnit position, bool firstLine) { ETextAlign textAlign = style()->textAlign(); if (textAlign == TASTART) // FIXME: Handle TAEND here return startOffsetForLine(position, firstLine); float totalLogicalWidth = 0; float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false); float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), false) - logicalLeft; updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWidth, availableLogicalWidth, 0); if (!style()->isLeftToRightDirection()) return logicalWidth() - logicalLeft; return logicalLeft; } ",0 "void WebLocalFrameImpl::CopyImageAt(const WebPoint& pos_in_viewport) { HitTestResult result = HitTestResultForVisualViewportPos(pos_in_viewport); if (!isHTMLCanvasElement(result.InnerNodeOrImageMapImage()) && result.AbsoluteImageURL().IsEmpty()) { return; } GetFrame()->GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets(); GetFrame()->GetEditor().CopyImage(result); } ",0 "void PrintPreviewHandler::HandlePrintWithCloudPrint(const ListValue* /*args*/) { ReportStats(); PrintPreviewUI* print_preview_ui = static_cast( web_ui()->GetController()); scoped_refptr data; print_preview_ui->GetPrintPreviewDataForIndex( printing::COMPLETE_PREVIEW_DOCUMENT_INDEX, &data); if (!data.get()) { NOTREACHED(); return; } DCHECK_GT(data->size(), 0U); gfx::NativeWindow modal_parent = platform_util::GetTopLevel(preview_web_contents()->GetNativeView()); print_dialog_cloud::CreatePrintDialogForBytes( preview_web_contents()->GetBrowserContext(), modal_parent, data, string16(print_preview_ui->initiator_tab_title()), string16(), std::string(""application/pdf"")); ActivateInitiatorTabAndClosePreviewTab(); } ",0 "ui::TextEditCommand GetCommandForKeyEvent(const ui::KeyEvent& event) { if (event.type() != ui::ET_KEY_PRESSED || event.IsUnicodeKeyCode()) return ui::TextEditCommand::INVALID_COMMAND; const bool shift = event.IsShiftDown(); const bool control = event.IsControlDown() || event.IsCommandDown(); const bool alt = event.IsAltDown() || event.IsAltGrDown(); switch (event.key_code()) { case ui::VKEY_Z: if (control && !shift && !alt) return ui::TextEditCommand::UNDO; return (control && shift && !alt) ? ui::TextEditCommand::REDO : ui::TextEditCommand::INVALID_COMMAND; case ui::VKEY_Y: return (control && !alt) ? ui::TextEditCommand::REDO : ui::TextEditCommand::INVALID_COMMAND; case ui::VKEY_A: return (control && !alt) ? ui::TextEditCommand::SELECT_ALL : ui::TextEditCommand::INVALID_COMMAND; case ui::VKEY_X: return (control && !alt) ? ui::TextEditCommand::CUT : ui::TextEditCommand::INVALID_COMMAND; case ui::VKEY_C: return (control && !alt) ? ui::TextEditCommand::COPY : ui::TextEditCommand::INVALID_COMMAND; case ui::VKEY_V: return (control && !alt) ? ui::TextEditCommand::PASTE : ui::TextEditCommand::INVALID_COMMAND; case ui::VKEY_RIGHT: if (alt) return ui::TextEditCommand::INVALID_COMMAND; if (!shift) { return control ? ui::TextEditCommand::MOVE_WORD_RIGHT : ui::TextEditCommand::MOVE_RIGHT; } return control ? ui::TextEditCommand::MOVE_WORD_RIGHT_AND_MODIFY_SELECTION : ui::TextEditCommand::MOVE_RIGHT_AND_MODIFY_SELECTION; case ui::VKEY_LEFT: if (alt) return ui::TextEditCommand::INVALID_COMMAND; if (!shift) { return control ? ui::TextEditCommand::MOVE_WORD_LEFT : ui::TextEditCommand::MOVE_LEFT; } return control ? ui::TextEditCommand::MOVE_WORD_LEFT_AND_MODIFY_SELECTION : ui::TextEditCommand::MOVE_LEFT_AND_MODIFY_SELECTION; case ui::VKEY_HOME: return shift ? ui::TextEditCommand:: MOVE_TO_BEGINNING_OF_LINE_AND_MODIFY_SELECTION : ui::TextEditCommand::MOVE_TO_BEGINNING_OF_LINE; case ui::VKEY_END: return shift ? ui::TextEditCommand::MOVE_TO_END_OF_LINE_AND_MODIFY_SELECTION : ui::TextEditCommand::MOVE_TO_END_OF_LINE; case ui::VKEY_BACK: if (!control) return ui::TextEditCommand::DELETE_BACKWARD; #if defined(OS_LINUX) if (shift) return ui::TextEditCommand::DELETE_TO_BEGINNING_OF_LINE; #endif return ui::TextEditCommand::DELETE_WORD_BACKWARD; case ui::VKEY_DELETE: #if defined(OS_LINUX) if (shift && control) return ui::TextEditCommand::DELETE_TO_END_OF_LINE; #endif if (control) return ui::TextEditCommand::DELETE_WORD_FORWARD; return shift ? ui::TextEditCommand::CUT : ui::TextEditCommand::DELETE_FORWARD; case ui::VKEY_INSERT: if (control && !shift) return ui::TextEditCommand::COPY; return (shift && !control) ? ui::TextEditCommand::PASTE : ui::TextEditCommand::INVALID_COMMAND; default: return ui::TextEditCommand::INVALID_COMMAND; } } ",0 "xsltGetExtData(xsltTransformContextPtr ctxt, const xmlChar * URI) { xsltExtDataPtr data; if ((ctxt == NULL) || (URI == NULL)) return (NULL); if (ctxt->extInfos == NULL) { ctxt->extInfos = xmlHashCreate(10); if (ctxt->extInfos == NULL) return (NULL); data = NULL; } else { data = (xsltExtDataPtr) xmlHashLookup(ctxt->extInfos, URI); } if (data == NULL) { void *extData; xsltExtModulePtr module; xmlMutexLock(xsltExtMutex); module = xmlHashLookup(xsltExtensionsHash, URI); xmlMutexUnlock(xsltExtMutex); if (module == NULL) { #ifdef WITH_XSLT_DEBUG_EXTENSIONS xsltGenericDebug(xsltGenericDebugContext, ""Not registered extension module: %s\n"", URI); #endif return (NULL); } else { if (module->initFunc == NULL) return (NULL); #ifdef WITH_XSLT_DEBUG_EXTENSIONS xsltGenericDebug(xsltGenericDebugContext, ""Initializing module: %s\n"", URI); #endif extData = module->initFunc(ctxt, URI); if (extData == NULL) return (NULL); data = xsltNewExtData(module, extData); if (data == NULL) return (NULL); if (xmlHashAddEntry(ctxt->extInfos, URI, (void *) data) < 0) { xsltTransformError(ctxt, NULL, NULL, ""Failed to register module data: %s\n"", URI); if (module->shutdownFunc) module->shutdownFunc(ctxt, URI, extData); xsltFreeExtData(data); return (NULL); } } } return (data->extData); } ",0 "bool tracer_tracing_is_on(struct trace_array *tr) { if (tr->trace_buffer.buffer) return ring_buffer_record_is_on(tr->trace_buffer.buffer); return !tr->buffer_disabled; } ",0 "print_syscall_exit(struct trace_iterator *iter, int flags, struct trace_event *event) { struct trace_seq *s = &iter->seq; struct trace_entry *ent = iter->ent; struct syscall_trace_exit *trace; int syscall; struct syscall_metadata *entry; int ret; trace = (typeof(trace))ent; syscall = trace->nr; entry = syscall_nr_to_meta(syscall); if (!entry) { trace_seq_putc(s, '\n'); return TRACE_TYPE_HANDLED; } if (entry->exit_event->event.type != ent->type) { WARN_ON_ONCE(1); return TRACE_TYPE_UNHANDLED; } ret = trace_seq_printf(s, ""%s -> 0x%lx\n"", entry->name, trace->ret); if (!ret) return TRACE_TYPE_PARTIAL_LINE; return TRACE_TYPE_HANDLED; } ",0 "static void perWorldAttributeAttributeSetterForMainWorld(v8::Local jsValue, const v8::PropertyCallbackInfo& info) { TestObject* imp = V8TestObject::toNative(info.Holder()); V8TRYCATCH_VOID(TestObject*, cppValue, V8TestObject::toNativeWithTypeCheck(info.GetIsolate(), jsValue)); imp->setPerWorldAttribute(WTF::getPtr(cppValue)); } ",0 "static PHP_FUNCTION(session_encode) { int len; char *enc; if (zend_parse_parameters_none() == FAILURE) { return; } enc = php_session_encode(&len TSRMLS_CC); if (enc == NULL) { RETURN_FALSE; } RETVAL_STRINGL(enc, len, 0); } ",0 "void NuPlayer::GenericSource::postReadBuffer(media_track_type trackType) { Mutex::Autolock _l(mReadBufferLock); if ((mPendingReadBufferTypes & (1 << trackType)) == 0) { mPendingReadBufferTypes |= (1 << trackType); sp msg = new AMessage(kWhatReadBuffer, this); msg->setInt32(""trackType"", trackType); msg->post(); } } ",0 "PP_Var GetDocumentURL(PP_Instance instance, PP_URLComponents_Dev* components) { PluginInstance* plugin_instance = host_globals->GetInstance(instance); if (!plugin_instance) return PP_MakeUndefined(); return plugin_instance->GetDocumentURL(instance, components); } ",0 "GF_Err mfhd_Size(GF_Box *s) { s->size += 4; return GF_OK; } ",0 "static void nr_set_lockdep_one(struct net_device *dev, struct netdev_queue *txq, void *_unused) { lockdep_set_class(&txq->_xmit_lock, &nr_netdev_xmit_lock_key); } ",0 "static ssize_t lbs_failcount_write(struct file *file, const char __user *userbuf, size_t count, loff_t *ppos) { return lbs_threshold_write(TLV_TYPE_FAILCOUNT, CMD_SUBSCRIBE_FAILCOUNT, file, userbuf, count, ppos); } ",0 "void DocumentThreadableLoader::loadFallbackRequestForServiceWorker() { clearResource(); ResourceRequest fallbackRequest(m_fallbackRequestForServiceWorker); m_fallbackRequestForServiceWorker = ResourceRequest(); dispatchInitialRequest(fallbackRequest); } ",0 "cifs_write_allocate_pages(struct page **pages, unsigned long num_pages) { int rc = 0; unsigned long i; for (i = 0; i < num_pages; i++) { pages[i] = alloc_page(GFP_KERNEL|__GFP_HIGHMEM); if (!pages[i]) { /* * save number of pages we have already allocated and * return with ENOMEM error */ num_pages = i; rc = -ENOMEM; break; } } if (rc) { for (i = 0; i < num_pages; i++) put_page(pages[i]); } return rc; } ",0 "void QQuickWebViewPrivate::loadDidCommit() { Q_Q(QQuickWebView); ASSERT(q->loading()); emit q->navigationHistoryChanged(); emit q->titleChanged(); } ",0 "filesystem_create_wait_for_luks_device_not_seen_cb (gpointer user_data) { MkfsLuksData *data = user_data; throw_error (data->context, ERROR_FAILED, ""Error creating luks encrypted file system: timeout (10s) waiting for luks device to show up""); g_signal_handler_disconnect (data->device->priv->daemon, data->device_changed_signal_handler_id); mkfse_data_unref (data); return FALSE; } ",0 "static int read_exit_mmio(struct kvm_vcpu *vcpu, gpa_t gpa, void *val, int bytes) { trace_kvm_mmio(KVM_TRACE_MMIO_READ_UNSATISFIED, bytes, gpa, 0); return X86EMUL_IO_NEEDED; } ",0 "static int flag_skiplist_cmp(const void *va, const void *vb) { const RFlagsAtOffset *a = (RFlagsAtOffset *)va, *b = (RFlagsAtOffset *)vb; if (a->off == b->off) { return 0; } return a->off < b->off ? -1 : 1; } ",0 "static int bmpr_read_rle_internal(struct iwbmprcontext *rctx) { int retval = 0; int pos_x, pos_y; iw_byte buf[255]; size_t n_pix; size_t n_bytes; size_t i; size_t pal_index; pos_x = 0; pos_y = 0; iw_zeromem(rctx->img->pixels,rctx->img->bpr*rctx->img->height); while(1) { if(pos_y>rctx->img->height-1) break; if(pos_y==rctx->img->height-1 && pos_x>=rctx->img->width) break; if(!iwbmp_read(rctx,buf,2)) goto done; if(buf[0]==0) { if(buf[1]==0) { pos_y++; pos_x=0; } else if(buf[1]==1) { break; } else if(buf[1]==2) { if(!iwbmp_read(rctx,buf,2)) goto done; if(pos_ximg->width) pos_x += buf[0]; pos_y += buf[1]; } else { n_pix = (size_t)buf[1]; // Number of uncompressed pixels which follow if(rctx->compression==IWBMP_BI_RLE4) { n_bytes = ((n_pix+3)/4)*2; } else { n_bytes = ((n_pix+1)/2)*2; } if(!iwbmp_read(rctx,buf,n_bytes)) goto done; for(i=0;iimg->width) { if(rctx->compression==IWBMP_BI_RLE4) { pal_index = (i%2) ? buf[i/2]&0x0f : buf[i/2]>>4; } else { pal_index = buf[i]; } rctx->img->pixels[rctx->img->bpr*pos_y + pos_x*4 + 0] = rctx->palette.entry[pal_index].r; rctx->img->pixels[rctx->img->bpr*pos_y + pos_x*4 + 1] = rctx->palette.entry[pal_index].g; rctx->img->pixels[rctx->img->bpr*pos_y + pos_x*4 + 2] = rctx->palette.entry[pal_index].b; rctx->img->pixels[rctx->img->bpr*pos_y + pos_x*4 + 3] = 255; pos_x++; } } } } else { n_pix = (size_t)buf[0]; for(i=0;iimg->width) { if(rctx->compression==IWBMP_BI_RLE4) { pal_index = (i%2) ? buf[1]&0x0f : buf[1]>>4; } else { pal_index = buf[1]; } rctx->img->pixels[rctx->img->bpr*pos_y + pos_x*4 + 0] = rctx->palette.entry[pal_index].r; rctx->img->pixels[rctx->img->bpr*pos_y + pos_x*4 + 1] = rctx->palette.entry[pal_index].g; rctx->img->pixels[rctx->img->bpr*pos_y + pos_x*4 + 2] = rctx->palette.entry[pal_index].b; rctx->img->pixels[rctx->img->bpr*pos_y + pos_x*4 + 3] = 255; pos_x++; } } } } retval = 1; done: return retval; } ",0 "void TestingAutomationProvider::OnChannelError() { if (!reinitialize_on_channel_error_ && browser_shutdown::GetShutdownType() == browser_shutdown::NOT_VALID) BrowserList::AttemptExit(); AutomationProvider::OnChannelError(); } ",0 "void RenderFrameHostImpl::NavigateToInterstitialURL(const GURL& data_url) { TRACE_EVENT1(""navigation"", ""RenderFrameHostImpl::NavigateToInterstitialURL"", ""frame_tree_node"", frame_tree_node_->frame_tree_node_id()); DCHECK(data_url.SchemeIs(url::kDataScheme)); CommonNavigationParams common_params( data_url, Referrer(), ui::PAGE_TRANSITION_LINK, FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT, false, false, base::TimeTicks::Now(), FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(), PREVIEWS_OFF, base::TimeTicks::Now(), ""GET"", nullptr, base::Optional(), CSPDisposition::CHECK /* should_check_main_world_csp */, false /* started_from_context_menu */, false /* has_user_gesture */, base::nullopt /* suggested_filename */); CommitNavigation(nullptr, network::mojom::URLLoaderClientEndpointsPtr(), common_params, RequestNavigationParams(), false, base::nullopt, base::nullopt /* subresource_overrides */, base::UnguessableToken::Create() /* not traced */); } ",0 "node_exit_policy_rejects_all(const node_t *node) { if (node->rejects_all) return 1; if (node->ri) return node->ri->policy_is_reject_star; else if (node->md) return node->md->exit_policy == NULL || short_policy_is_reject_star(node->md->exit_policy); else return 1; } ",0 "bool omx_video::omx_c2d_conv::get_buffer_size(int port,unsigned int &buf_size) { int cret = 0; bool ret = false; C2DBuffReq bufferreq; if (c2dcc) { bufferreq.size = 0; pthread_mutex_lock(&c_lock); cret = c2dcc->getBuffReq(port,&bufferreq); pthread_mutex_unlock(&c_lock); DEBUG_PRINT_LOW(""Status of getbuffer is %d"", cret); ret = (cret)?false:true; buf_size = bufferreq.size; } return ret; } ",0 "int WebGraphicsContext3DDefaultImpl::width() { return m_cachedWidth; } ",0 "static int pppol2tp_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len, int flags) { int err; struct sk_buff *skb; struct sock *sk = sock->sk; err = -EIO; if (sk->sk_state & PPPOX_BOUND) goto end; msg->msg_namelen = 0; err = 0; skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, flags & MSG_DONTWAIT, &err); if (!skb) goto end; if (len > skb->len) len = skb->len; else if (len < skb->len) msg->msg_flags |= MSG_TRUNC; err = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, len); if (likely(err == 0)) err = len; kfree_skb(skb); end: return err; } ",1 "static int efx_ethtool_get_rxfh_indir(struct net_device *net_dev, struct ethtool_rxfh_indir *indir) { struct efx_nic *efx = netdev_priv(net_dev); size_t copy_size = min_t(size_t, indir->size, ARRAY_SIZE(efx->rx_indir_table)); if (efx_nic_rev(efx) < EFX_REV_FALCON_B0) return -EOPNOTSUPP; indir->size = ARRAY_SIZE(efx->rx_indir_table); memcpy(indir->ring_index, efx->rx_indir_table, copy_size * sizeof(indir->ring_index[0])); return 0; } ",0 "GooString *Stream::getPSFilter(int psLevel, const char *indent) { return new GooString(); } ",0 "static long generateHashValue( const char *fname ) { int i; long hash; char letter; hash = 0; i = 0; while ( fname[i] != '\0' ) { letter = tolower( fname[i] ); hash += (long)( letter ) * ( i + 119 ); i++; } hash &= ( FILE_HASH_SIZE - 1 ); return hash; } ",0 "static int virtqueue_num_heads(VirtQueue *vq, unsigned int idx) { uint16_t num_heads = vring_avail_idx(vq) - idx; /* Check it isn't doing very strange things with descriptor numbers. */ if (num_heads > vq->vring.num) { error_report(""Guest moved used index from %u to %u"", idx, vq->shadow_avail_idx); exit(1); } /* On success, callers read a descriptor at vq->last_avail_idx. * Make sure descriptor read does not bypass avail index read. */ if (num_heads) { smp_rmb(); } return num_heads; } ",0 "png_do_read_swap_alpha(png_row_infop row_info, png_bytep row) { png_debug(1, ""in png_do_read_swap_alpha""); #ifdef PNG_USELESS_TESTS_SUPPORTED if (row != NULL && row_info != NULL) #endif { png_uint_32 row_width = row_info->width; if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) { /* This converts from RGBA to ARGB */ if (row_info->bit_depth == 8) { png_bytep sp = row + row_info->rowbytes; png_bytep dp = sp; png_byte save; png_uint_32 i; for (i = 0; i < row_width; i++) { save = *(--sp); *(--dp) = *(--sp); *(--dp) = *(--sp); *(--dp) = *(--sp); *(--dp) = save; } } /* This converts from RRGGBBAA to AARRGGBB */ else { png_bytep sp = row + row_info->rowbytes; png_bytep dp = sp; png_byte save[2]; png_uint_32 i; for (i = 0; i < row_width; i++) { save[0] = *(--sp); save[1] = *(--sp); *(--dp) = *(--sp); *(--dp) = *(--sp); *(--dp) = *(--sp); *(--dp) = *(--sp); *(--dp) = *(--sp); *(--dp) = *(--sp); *(--dp) = save[0]; *(--dp) = save[1]; } } } else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) { /* This converts from GA to AG */ if (row_info->bit_depth == 8) { png_bytep sp = row + row_info->rowbytes; png_bytep dp = sp; png_byte save; png_uint_32 i; for (i = 0; i < row_width; i++) { save = *(--sp); *(--dp) = *(--sp); *(--dp) = save; } } /* This converts from GGAA to AAGG */ else { png_bytep sp = row + row_info->rowbytes; png_bytep dp = sp; png_byte save[2]; png_uint_32 i; for (i = 0; i < row_width; i++) { save[0] = *(--sp); save[1] = *(--sp); *(--dp) = *(--sp); *(--dp) = *(--sp); *(--dp) = save[0]; *(--dp) = save[1]; } } } } } ",0 "gss_verify_mic (minor_status, context_handle, message_buffer, token_buffer, qop_state) OM_uint32 * minor_status; gss_ctx_id_t context_handle; gss_buffer_t message_buffer; gss_buffer_t token_buffer; gss_qop_t * qop_state; { OM_uint32 status; gss_union_ctx_id_t ctx; gss_mechanism mech; if (minor_status == NULL) return (GSS_S_CALL_INACCESSIBLE_WRITE); *minor_status = 0; if (context_handle == GSS_C_NO_CONTEXT) return (GSS_S_CALL_INACCESSIBLE_READ | GSS_S_NO_CONTEXT); if ((message_buffer == GSS_C_NO_BUFFER) || GSS_EMPTY_BUFFER(token_buffer)) return (GSS_S_CALL_INACCESSIBLE_READ); /* * select the approprate underlying mechanism routine and * call it. */ ctx = (gss_union_ctx_id_t) context_handle; mech = gssint_get_mechanism (ctx->mech_type); if (mech) { if (mech->gss_verify_mic) { status = mech->gss_verify_mic( minor_status, ctx->internal_ctx_id, message_buffer, token_buffer, qop_state); if (status != GSS_S_COMPLETE) map_error(minor_status, mech); } else status = GSS_S_UNAVAILABLE; return(status); } return (GSS_S_BAD_MECH); } ",1 "uint64_t ram_bytes_transferred(void) { return bytes_transferred; } ",0 "StoragePartitionImpl::GetURLLoaderFactoryForBrowserProcessInternal() { if (url_loader_factory_for_browser_process_ && !url_loader_factory_for_browser_process_.encountered_error() && is_test_url_loader_factory_for_browser_process_ != g_url_loader_factory_callback_for_test.Get().is_null()) { return url_loader_factory_for_browser_process_.get(); } network::mojom::URLLoaderFactoryParamsPtr params = network::mojom::URLLoaderFactoryParams::New(); params->process_id = network::mojom::kBrowserProcessId; params->is_corb_enabled = false; params->disable_web_security = base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kDisableWebSecurity); if (g_url_loader_factory_callback_for_test.Get().is_null()) { auto request = mojo::MakeRequest(&url_loader_factory_for_browser_process_); GetNetworkContext()->CreateURLLoaderFactory(std::move(request), std::move(params)); is_test_url_loader_factory_for_browser_process_ = false; return url_loader_factory_for_browser_process_.get(); } network::mojom::URLLoaderFactoryPtr original_factory; GetNetworkContext()->CreateURLLoaderFactory( mojo::MakeRequest(&original_factory), std::move(params)); url_loader_factory_for_browser_process_ = g_url_loader_factory_callback_for_test.Get().Run( std::move(original_factory)); is_test_url_loader_factory_for_browser_process_ = true; return url_loader_factory_for_browser_process_.get(); } ",0 " process_event( RenderState state, grEvent* event ) { int ret = 0; ColumnState column = &state->columns[state->col]; switch ( event->key ) { case grKeyEsc: case grKEY( 'q' ): ret = 1; break; case grKeyF1: case grKEY( '?' ): event_help( state ); break; case grKeyLeft: if ( --state->col < 0 ) state->col = 2; state->message = state->message0; sprintf( state->message0, ""column %d selected"", state->col + 1 ); break; case grKeyRight: if ( ++state->col > 2 ) state->col = 0; state->message = state->message0; sprintf( state->message0, ""column %d selected"", state->col + 1 ); break; case grKeyUp: event_change_size( state, +0.5 ); break; case grKeyDown: event_change_size( state, -0.5 ); break; case grKeyPageUp: event_change_size( state, +5. ); break; case grKeyPageDown: event_change_size( state, -5. ); break; case grKEY( '1' ): state->col = 0; state->message = (char *)""column 1 selected""; break; case grKEY( '2' ): state->col = 1; state->message = (char *)""column 2 selected""; break; case grKEY( '3' ): state->col = 2; state->message = (char *)""column 3 selected""; break; case grKEY( 'a' ): column->use_global_advance_width = !column->use_global_advance_width; state->message = column->use_global_advance_width ? (char *)""using global advance width"" : (char *)""ignoring global advance width""; break; case grKEY( 'd' ): column->use_deltas = !column->use_deltas; state->message = column->use_deltas ? (char *)""using rsb/lsb deltas"" : (char *)""ignoring rsb/lsb deltas""; break; case grKEY( 'g' ): event_change_gamma( state, +0.1 ); break; case grKEY( 'h' ): column->hint_mode = (HintMode)( ( column->hint_mode + 1 ) % HINT_MODE_MAX ); state->message = state->message0; sprintf( state->message0, ""column %d is %s"", state->col + 1, render_mode_names[column->hint_mode] ); break; case grKEY( 'k' ): column->use_kerning = !column->use_kerning; state->message = column->use_kerning ? (char *)""using kerning"" : (char *)""ignoring kerning""; break; case grKEY( 'l' ): switch ( column->lcd_filter ) { case FT_LCD_FILTER_NONE: column->lcd_filter = FT_LCD_FILTER_DEFAULT; state->message = (char *)""using default LCD filter""; break; case FT_LCD_FILTER_DEFAULT: if ( !column->use_custom_lcd_filter ) { column->use_custom_lcd_filter = 1; state->message = (char*)""using custom LCD filter""; } else { column->use_custom_lcd_filter = 0; column->lcd_filter = FT_LCD_FILTER_LIGHT; state->message = (char *)""using light LCD filter""; } break; case FT_LCD_FILTER_LIGHT: column->lcd_filter = FT_LCD_FILTER_LEGACY; state->message = (char *)""using legacy LCD filter""; break; case FT_LCD_FILTER_LEGACY: column->lcd_filter = FT_LCD_FILTER_NONE; state->message = (char *)""using no LCD filter""; break; default: /* to satisfy picky compilers */ break; } break; case grKEY( 'n' ): render_state_set_file( state, state->face_index + 1 ); break; case grKEY( 'p' ): render_state_set_file( state, state->face_index - 1 ); break; case grKEY( 'r' ): column->use_lcd_filter = !column->use_lcd_filter; state->message = state->message0; sprintf( state->message0, ""column %d is using %s"", state->col + 1, column->use_lcd_filter ? ""LCD filtering"" : ""gray rendering"" ); break; case grKEY( 'v' ): event_change_gamma( state, -0.1 ); break; case grKEY( '[' ): if ( !column->use_custom_lcd_filter ) break; column->fw_index--; if ( column->fw_index < 0 ) column->fw_index = 4; break; case grKEY( ']' ): if ( !column->use_custom_lcd_filter ) break; column->fw_index++; if ( column->fw_index > 4 ) column->fw_index = 0; break; case grKEY( '-' ): if ( !column->use_custom_lcd_filter ) break; column->filter_weights[column->fw_index]--; break; case grKEY( '+' ): case grKEY( '=' ): if ( !column->use_custom_lcd_filter ) break; column->filter_weights[column->fw_index]++; break; default: break; } return ret; } ",0 "static int rtnl_net_dumpid_one(int id, void *peer, void *data) { struct rtnl_net_dump_cb *net_cb = (struct rtnl_net_dump_cb *)data; int ret; if (net_cb->idx < net_cb->s_idx) goto cont; net_cb->fillargs.nsid = id; if (net_cb->fillargs.add_ref) net_cb->fillargs.ref_nsid = __peernet2id(net_cb->ref_net, peer); ret = rtnl_net_fill(net_cb->skb, &net_cb->fillargs); if (ret < 0) return ret; cont: net_cb->idx++; return 0; } ",0 "xprt_rdma_bc_send_request(struct rpc_task *task) { struct rpc_rqst *rqst = task->tk_rqstp; struct svc_xprt *sxprt = rqst->rq_xprt->bc_xprt; struct svcxprt_rdma *rdma; int ret; dprintk(""svcrdma: sending bc call with xid: %08x\n"", be32_to_cpu(rqst->rq_xid)); if (!mutex_trylock(&sxprt->xpt_mutex)) { rpc_sleep_on(&sxprt->xpt_bc_pending, task, NULL); if (!mutex_trylock(&sxprt->xpt_mutex)) return -EAGAIN; rpc_wake_up_queued_task(&sxprt->xpt_bc_pending, task); } ret = -ENOTCONN; rdma = container_of(sxprt, struct svcxprt_rdma, sc_xprt); if (!test_bit(XPT_DEAD, &sxprt->xpt_flags)) ret = rpcrdma_bc_send_request(rdma, rqst); mutex_unlock(&sxprt->xpt_mutex); if (ret < 0) return ret; return 0; } ",0 "static int mem_cgroup_count_children(struct mem_cgroup *memcg) { int num = 0; struct mem_cgroup *iter; for_each_mem_cgroup_tree(iter, memcg) num++; return num; } ",0 "static int ocfs2_grab_pages_for_write(struct address_space *mapping, struct ocfs2_write_ctxt *wc, u32 cpos, loff_t user_pos, unsigned user_len, int new, struct page *mmap_page) { int ret = 0, i; unsigned long start, target_index, end_index, index; struct inode *inode = mapping->host; loff_t last_byte; target_index = user_pos >> PAGE_SHIFT; /* * Figure out how many pages we'll be manipulating here. For * non allocating write, we just change the one * page. Otherwise, we'll need a whole clusters worth. If we're * writing past i_size, we only need enough pages to cover the * last page of the write. */ if (new) { wc->w_num_pages = ocfs2_pages_per_cluster(inode->i_sb); start = ocfs2_align_clusters_to_page_index(inode->i_sb, cpos); /* * We need the index *past* the last page we could possibly * touch. This is the page past the end of the write or * i_size, whichever is greater. */ last_byte = max(user_pos + user_len, i_size_read(inode)); BUG_ON(last_byte < 1); end_index = ((last_byte - 1) >> PAGE_SHIFT) + 1; if ((start + wc->w_num_pages) > end_index) wc->w_num_pages = end_index - start; } else { wc->w_num_pages = 1; start = target_index; } end_index = (user_pos + user_len - 1) >> PAGE_SHIFT; for(i = 0; i < wc->w_num_pages; i++) { index = start + i; if (index >= target_index && index <= end_index && wc->w_type == OCFS2_WRITE_MMAP) { /* * ocfs2_pagemkwrite() is a little different * and wants us to directly use the page * passed in. */ lock_page(mmap_page); /* Exit and let the caller retry */ if (mmap_page->mapping != mapping) { WARN_ON(mmap_page->mapping); unlock_page(mmap_page); ret = -EAGAIN; goto out; } get_page(mmap_page); wc->w_pages[i] = mmap_page; wc->w_target_locked = true; } else if (index >= target_index && index <= end_index && wc->w_type == OCFS2_WRITE_DIRECT) { /* Direct write has no mapping page. */ wc->w_pages[i] = NULL; continue; } else { wc->w_pages[i] = find_or_create_page(mapping, index, GFP_NOFS); if (!wc->w_pages[i]) { ret = -ENOMEM; mlog_errno(ret); goto out; } } wait_for_stable_page(wc->w_pages[i]); if (index == target_index) wc->w_target_page = wc->w_pages[i]; } out: if (ret) wc->w_target_locked = false; return ret; } ",0 "void DateTimeFieldElement::didFocus() { if (m_fieldOwner) m_fieldOwner->didFocusOnField(); } ",0 "void kvm_arch_sync_events(struct kvm *kvm) { kvm_free_all_assigned_devices(kvm); kvm_free_pit(kvm); } ",0 "AutofillPopupSuggestionView::CreateBackground() { return views::CreateSolidBackground( is_selected_ ? popup_view_->GetSelectedBackgroundColor() : popup_view_->GetBackgroundColor()); } ",0 "void imap_cmd_finish(struct ImapData *idata) { if (idata->status == IMAP_FATAL) { cmd_handle_fatal(idata); return; } if (!(idata->state >= IMAP_SELECTED) || idata->ctx->closing) return; if (idata->reopen & IMAP_REOPEN_ALLOW) { unsigned int count = idata->new_mail_count; if (!(idata->reopen & IMAP_EXPUNGE_PENDING) && (idata->reopen & IMAP_NEWMAIL_PENDING) && count > idata->max_msn) { /* read new mail messages */ mutt_debug(2, ""Fetching new mail\n""); /* check_status: curs_main uses imap_check_mailbox to detect * whether the index needs updating */ idata->check_status = IMAP_NEWMAIL_PENDING; imap_read_headers(idata, idata->max_msn + 1, count); } else if (idata->reopen & IMAP_EXPUNGE_PENDING) { mutt_debug(2, ""Expunging mailbox\n""); imap_expunge_mailbox(idata); /* Detect whether we've gotten unexpected EXPUNGE messages */ if ((idata->reopen & IMAP_EXPUNGE_PENDING) && !(idata->reopen & IMAP_EXPUNGE_EXPECTED)) idata->check_status = IMAP_EXPUNGE_PENDING; idata->reopen &= ~(IMAP_EXPUNGE_PENDING | IMAP_NEWMAIL_PENDING | IMAP_EXPUNGE_EXPECTED); } } idata->status = false; } ",0 "printNewMessages( ClassAd* result_ad, StringList* ids ) { char* tmp; char* msg; PROC_ID job_id; bool rval; JobActionResults results; results.readResults( result_ad ); ids->rewind(); while( (tmp = ids->next()) ) { job_id = getProcByString( tmp ); rval = results.getResultString( job_id, &msg ); if( rval ) { fprintf( stdout, ""%s\n"", msg ); } else { fprintf( stderr, ""%s\n"", msg ); } free( msg ); } } ",0 " ChromePrintContext(LocalFrame* frame, bool use_printing_layout) : PrintContext(frame, use_printing_layout), printed_page_width_(0) {} ",0 "int prism2_sta_send_mgmt(local_info_t *local, u8 *dst, u16 stype, u8 *body, size_t bodylen) { struct sk_buff *skb; struct hostap_ieee80211_mgmt *mgmt; struct hostap_skb_tx_data *meta; struct net_device *dev = local->dev; skb = dev_alloc_skb(IEEE80211_MGMT_HDR_LEN + bodylen); if (skb == NULL) return -ENOMEM; mgmt = (struct hostap_ieee80211_mgmt *) skb_put(skb, IEEE80211_MGMT_HDR_LEN); memset(mgmt, 0, IEEE80211_MGMT_HDR_LEN); mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | stype); memcpy(mgmt->da, dst, ETH_ALEN); memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN); memcpy(mgmt->bssid, dst, ETH_ALEN); if (body) memcpy(skb_put(skb, bodylen), body, bodylen); meta = (struct hostap_skb_tx_data *) skb->cb; memset(meta, 0, sizeof(*meta)); meta->magic = HOSTAP_SKB_TX_DATA_MAGIC; meta->iface = netdev_priv(dev); skb->dev = dev; skb_reset_mac_header(skb); skb_reset_network_header(skb); dev_queue_xmit(skb); return 0; } ",0 "static void receive_header(VirtIONet *n, const struct iovec *iov, int iov_cnt, const void *buf, size_t size) { if (n->has_vnet_hdr) { /* FIXME this cast is evil */ void *wbuf = (void *)buf; work_around_broken_dhclient(wbuf, wbuf + n->host_hdr_len, size - n->host_hdr_len); iov_from_buf(iov, iov_cnt, 0, buf, sizeof(struct virtio_net_hdr)); } else { struct virtio_net_hdr hdr = { .flags = 0, .gso_type = VIRTIO_NET_HDR_GSO_NONE }; iov_from_buf(iov, iov_cnt, 0, &hdr, sizeof hdr); } } ",0 "virDomainMigratePrepareTunnel(virConnectPtr conn, virStreamPtr st, unsigned long flags, const char *dname, unsigned long bandwidth, const char *dom_xml) { VIR_DEBUG(""conn=%p, stream=%p, flags=%lx, dname=%s, "" ""bandwidth=%lu, dom_xml=%s"", conn, st, flags, NULLSTR(dname), bandwidth, NULLSTR(dom_xml)); virResetLastError(); virCheckConnectReturn(conn, -1); virCheckReadOnlyGoto(conn->flags, error); if (conn != st->conn) { virReportInvalidArg(conn, ""%s"", _(""conn must match stream connection"")); goto error; } if (conn->driver->domainMigratePrepareTunnel) { int rv = conn->driver->domainMigratePrepareTunnel(conn, st, flags, dname, bandwidth, dom_xml); if (rv < 0) goto error; return rv; } virReportUnsupportedError(); error: virDispatchError(conn); return -1; } ",0 "void InspectorPageAgent::DidRunJavaScriptDialog() { GetFrontend()->flush(); } ",0 "bool SyncManager::SyncInternal::HaveObservers() const { base::AutoLock lock(observers_lock_); return observers_.size() > 0; } ",0 "void IRCView::appendQueryAction(const QString& nick, const QString& message) { m_tabNotification = Konversation::tnfPrivate; appendAction(nick, message); } ",0 "void RenderFrameDevToolsAgentHost::DestroyOnRenderFrameGone() { scoped_refptr protect(this); if (IsAttached()) RevokePolicy(); ForceDetachAllSessions(); frame_host_ = nullptr; UpdateRendererChannel(IsAttached()); SetFrameTreeNode(nullptr); Release(); } ",0 "bool ResourcePrefetchPredictor::GetRedirectEndpointsForPreconnect( const url::Origin& entry_origin, const RedirectDataMap& redirect_data, PreconnectPrediction* prediction) const { if (!base::FeatureList::IsEnabled( features::kLoadingPreconnectToRedirectTarget)) { return false; } DCHECK(!prediction || prediction->requests.empty()); RedirectData data; if (!redirect_data.TryGetData(entry_origin.host(), &data)) return false; const float kMinRedirectConfidenceToTriggerPrefetch = 0.1f; bool at_least_one_redirect_endpoint_added = false; for (const auto& redirect : data.redirect_endpoints()) { if (ComputeRedirectConfidence(redirect) < kMinRedirectConfidenceToTriggerPrefetch) { continue; } std::string redirect_scheme = redirect.url_scheme().empty() ? ""https"" : redirect.url_scheme(); int redirect_port = redirect.has_url_port() ? redirect.url_port() : 443; const url::Origin redirect_origin = url::Origin::CreateFromNormalizedTuple( redirect_scheme, redirect.url(), redirect_port); if (redirect_origin == entry_origin) { continue; } if (prediction) { prediction->requests.emplace_back( redirect_origin.GetURL(), 1 /* num_scokets */, net::NetworkIsolationKey(redirect_origin, redirect_origin)); } at_least_one_redirect_endpoint_added = true; } if (prediction && prediction->host.empty() && at_least_one_redirect_endpoint_added) { prediction->host = entry_origin.host(); } return at_least_one_redirect_endpoint_added; } ",1 "void forget_all_cached_acls(struct inode *inode) { __forget_cached_acl(&inode->i_acl); __forget_cached_acl(&inode->i_default_acl); } ",0 "MagickExport MagickBooleanType WhiteThresholdImageChannel(Image *image, const ChannelType channel,const char *thresholds,ExceptionInfo *exception) { #define ThresholdImageTag ""Threshold/Image"" CacheView *image_view; GeometryInfo geometry_info; MagickBooleanType status; MagickOffsetType progress; MagickPixelPacket threshold; MagickStatusType flags; ssize_t y; assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"",image->filename); if (thresholds == (const char *) NULL) return(MagickTrue); if (SetImageStorageClass(image,DirectClass) == MagickFalse) return(MagickFalse); flags=ParseGeometry(thresholds,&geometry_info); GetMagickPixelPacket(image,&threshold); threshold.red=geometry_info.rho; threshold.green=geometry_info.sigma; if ((flags & SigmaValue) == 0) threshold.green=threshold.red; threshold.blue=geometry_info.xi; if ((flags & XiValue) == 0) threshold.blue=threshold.red; threshold.opacity=geometry_info.psi; if ((flags & PsiValue) == 0) threshold.opacity=threshold.red; threshold.index=geometry_info.chi; if ((flags & ChiValue) == 0) threshold.index=threshold.red; if ((flags & PercentValue) != 0) { threshold.red*=(MagickRealType) (QuantumRange/100.0); threshold.green*=(MagickRealType) (QuantumRange/100.0); threshold.blue*=(MagickRealType) (QuantumRange/100.0); threshold.opacity*=(MagickRealType) (QuantumRange/100.0); threshold.index*=(MagickRealType) (QuantumRange/100.0); } if ((IsMagickGray(&threshold) == MagickFalse) && (IsGrayColorspace(image->colorspace) != MagickFalse)) (void) SetImageColorspace(image,sRGBColorspace); /* White threshold image. */ status=MagickTrue; progress=0; image_view=AcquireAuthenticCacheView(image,exception); #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static) shared(progress,status) \ magick_number_threads(image,image,image->rows,1) #endif for (y=0; y < (ssize_t) image->rows; y++) { register IndexPacket *magick_restrict indexes; register ssize_t x; register PixelPacket *magick_restrict q; if (status == MagickFalse) continue; q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception); if (q == (PixelPacket *) NULL) { status=MagickFalse; continue; } indexes=GetCacheViewAuthenticIndexQueue(image_view); for (x=0; x < (ssize_t) image->columns; x++) { if (((channel & RedChannel) != 0) && ((MagickRealType) GetPixelRed(q) > threshold.red)) SetPixelRed(q,QuantumRange); if (((channel & GreenChannel) != 0) && ((MagickRealType) GetPixelGreen(q) > threshold.green)) SetPixelGreen(q,QuantumRange); if (((channel & BlueChannel) != 0) && ((MagickRealType) GetPixelBlue(q) > threshold.blue)) SetPixelBlue(q,QuantumRange); if (((channel & OpacityChannel) != 0) && ((MagickRealType) GetPixelOpacity(q) > threshold.opacity)) SetPixelOpacity(q,QuantumRange); if (((channel & IndexChannel) != 0) && (image->colorspace == CMYKColorspace) && ((MagickRealType) GetPixelIndex(indexes+x)) > threshold.index) SetPixelIndex(indexes+x,QuantumRange); q++; } if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse) status=MagickFalse; if (image->progress_monitor != (MagickProgressMonitor) NULL) { MagickBooleanType proceed; #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp atomic #endif progress++; proceed=SetImageProgress(image,ThresholdImageTag,progress,image->rows); if (proceed == MagickFalse) status=MagickFalse; } } image_view=DestroyCacheView(image_view); return(status); } ",0 "Response InspectorPageAgent::removeScriptToEvaluateOnNewDocument( const String& identifier) { return removeScriptToEvaluateOnLoad(identifier); } ",0 "int follow_down(struct path *path) { struct vfsmount *mounted; mounted = lookup_mnt(path); if (mounted) { dput(path->dentry); mntput(path->mnt); path->mnt = mounted; path->dentry = dget(mounted->mnt_root); return 1; } return 0; } ",0 "static int mpeg4_decode_partition_a(Mpeg4DecContext *ctx) { MpegEncContext *s = &ctx->m; int mb_num = 0; static const int8_t quant_tab[4] = { -1, -2, 1, 2 }; /* decode first partition */ s->first_slice_line = 1; for (; s->mb_y < s->mb_height; s->mb_y++) { ff_init_block_index(s); for (; s->mb_x < s->mb_width; s->mb_x++) { const int xy = s->mb_x + s->mb_y * s->mb_stride; int cbpc; int dir = 0; mb_num++; ff_update_block_index(s); if (s->mb_x == s->resync_mb_x && s->mb_y == s->resync_mb_y + 1) s->first_slice_line = 0; if (s->pict_type == AV_PICTURE_TYPE_I) { int i; do { if (show_bits_long(&s->gb, 19) == DC_MARKER) return mb_num - 1; cbpc = get_vlc2(&s->gb, ff_h263_intra_MCBPC_vlc.table, INTRA_MCBPC_VLC_BITS, 2); if (cbpc < 0) { av_log(s->avctx, AV_LOG_ERROR, ""mcbpc corrupted at %d %d\n"", s->mb_x, s->mb_y); return AVERROR_INVALIDDATA; } } while (cbpc == 8); s->cbp_table[xy] = cbpc & 3; s->current_picture.mb_type[xy] = MB_TYPE_INTRA; s->mb_intra = 1; if (cbpc & 4) ff_set_qscale(s, s->qscale + quant_tab[get_bits(&s->gb, 2)]); s->current_picture.qscale_table[xy] = s->qscale; s->mbintra_table[xy] = 1; for (i = 0; i < 6; i++) { int dc_pred_dir; int dc = mpeg4_decode_dc(s, i, &dc_pred_dir); if (dc < 0) { av_log(s->avctx, AV_LOG_ERROR, ""DC corrupted at %d %d\n"", s->mb_x, s->mb_y); return dc; } dir <<= 1; if (dc_pred_dir) dir |= 1; } s->pred_dir_table[xy] = dir; } else { /* P/S_TYPE */ int mx, my, pred_x, pred_y, bits; int16_t *const mot_val = s->current_picture.motion_val[0][s->block_index[0]]; const int stride = s->b8_stride * 2; try_again: bits = show_bits(&s->gb, 17); if (bits == MOTION_MARKER) return mb_num - 1; skip_bits1(&s->gb); if (bits & 0x10000) { /* skip mb */ if (s->pict_type == AV_PICTURE_TYPE_S && ctx->vol_sprite_usage == GMC_SPRITE) { s->current_picture.mb_type[xy] = MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_GMC | MB_TYPE_L0; mx = get_amv(ctx, 0); my = get_amv(ctx, 1); } else { s->current_picture.mb_type[xy] = MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0; mx = my = 0; } mot_val[0] = mot_val[2] = mot_val[0 + stride] = mot_val[2 + stride] = mx; mot_val[1] = mot_val[3] = mot_val[1 + stride] = mot_val[3 + stride] = my; if (s->mbintra_table[xy]) ff_clean_intra_table_entries(s); continue; } cbpc = get_vlc2(&s->gb, ff_h263_inter_MCBPC_vlc.table, INTER_MCBPC_VLC_BITS, 2); if (cbpc < 0) { av_log(s->avctx, AV_LOG_ERROR, ""mcbpc corrupted at %d %d\n"", s->mb_x, s->mb_y); return AVERROR_INVALIDDATA; } if (cbpc == 20) goto try_again; s->cbp_table[xy] = cbpc & (8 + 3); // 8 is dquant s->mb_intra = ((cbpc & 4) != 0); if (s->mb_intra) { s->current_picture.mb_type[xy] = MB_TYPE_INTRA; s->mbintra_table[xy] = 1; mot_val[0] = mot_val[2] = mot_val[0 + stride] = mot_val[2 + stride] = 0; mot_val[1] = mot_val[3] = mot_val[1 + stride] = mot_val[3 + stride] = 0; } else { if (s->mbintra_table[xy]) ff_clean_intra_table_entries(s); if (s->pict_type == AV_PICTURE_TYPE_S && ctx->vol_sprite_usage == GMC_SPRITE && (cbpc & 16) == 0) s->mcsel = get_bits1(&s->gb); else s->mcsel = 0; if ((cbpc & 16) == 0) { /* 16x16 motion prediction */ ff_h263_pred_motion(s, 0, 0, &pred_x, &pred_y); if (!s->mcsel) { mx = ff_h263_decode_motion(s, pred_x, s->f_code); if (mx >= 0xffff) return AVERROR_INVALIDDATA; my = ff_h263_decode_motion(s, pred_y, s->f_code); if (my >= 0xffff) return AVERROR_INVALIDDATA; s->current_picture.mb_type[xy] = MB_TYPE_16x16 | MB_TYPE_L0; } else { mx = get_amv(ctx, 0); my = get_amv(ctx, 1); s->current_picture.mb_type[xy] = MB_TYPE_16x16 | MB_TYPE_GMC | MB_TYPE_L0; } mot_val[0] = mot_val[2] = mot_val[0 + stride] = mot_val[2 + stride] = mx; mot_val[1] = mot_val[3] = mot_val[1 + stride] = mot_val[3 + stride] = my; } else { int i; s->current_picture.mb_type[xy] = MB_TYPE_8x8 | MB_TYPE_L0; for (i = 0; i < 4; i++) { int16_t *mot_val = ff_h263_pred_motion(s, i, 0, &pred_x, &pred_y); mx = ff_h263_decode_motion(s, pred_x, s->f_code); if (mx >= 0xffff) return AVERROR_INVALIDDATA; my = ff_h263_decode_motion(s, pred_y, s->f_code); if (my >= 0xffff) return AVERROR_INVALIDDATA; mot_val[0] = mx; mot_val[1] = my; } } } } } s->mb_x = 0; } return mb_num; } ",0 "bool ShouldQuicRetryOnAlternateNetworkBeforeHandshake( const VariationParameters& quic_trial_params) { return base::LowerCaseEqualsASCII( GetVariationParam(quic_trial_params, ""retry_on_alternate_network_before_handshake""), ""true""); } ",0 "static int des_ablkcipher_setkey(struct crypto_ablkcipher *cipher, const u8 *key, unsigned int keylen) { struct cryp_ctx *ctx = crypto_ablkcipher_ctx(cipher); u32 *flags = &cipher->base.crt_flags; u32 tmp[DES_EXPKEY_WORDS]; int ret; pr_debug(DEV_DBG_NAME "" [%s]"", __func__); if (keylen != DES_KEY_SIZE) { *flags |= CRYPTO_TFM_RES_BAD_KEY_LEN; pr_debug(DEV_DBG_NAME "" [%s]: CRYPTO_TFM_RES_BAD_KEY_LEN"", __func__); return -EINVAL; } ret = des_ekey(tmp, key); if (unlikely(ret == 0) && (*flags & CRYPTO_TFM_REQ_WEAK_KEY)) { *flags |= CRYPTO_TFM_RES_WEAK_KEY; pr_debug(DEV_DBG_NAME "" [%s]: CRYPTO_TFM_REQ_WEAK_KEY"", __func__); return -EINVAL; } memcpy(ctx->key, key, keylen); ctx->keylen = keylen; ctx->updated = 0; return 0; } ",0 "AriaCurrentState AXNodeObject::ariaCurrentState() const { const AtomicString& attributeValue = getAOMPropertyOrARIAAttribute(AOMStringProperty::kCurrent); if (attributeValue.isNull()) return AriaCurrentStateUndefined; if (attributeValue.isEmpty() || equalIgnoringCase(attributeValue, ""false"")) return AriaCurrentStateFalse; if (equalIgnoringCase(attributeValue, ""true"")) return AriaCurrentStateTrue; if (equalIgnoringCase(attributeValue, ""page"")) return AriaCurrentStatePage; if (equalIgnoringCase(attributeValue, ""step"")) return AriaCurrentStateStep; if (equalIgnoringCase(attributeValue, ""location"")) return AriaCurrentStateLocation; if (equalIgnoringCase(attributeValue, ""date"")) return AriaCurrentStateDate; if (equalIgnoringCase(attributeValue, ""time"")) return AriaCurrentStateTime; if (!attributeValue.isEmpty()) return AriaCurrentStateTrue; return AXObject::ariaCurrentState(); } ",1 "static char *print_string_ptr( const char *str ) { const char *ptr; char *ptr2, *out; int len = 0; unsigned char token; if ( ! str ) return cJSON_strdup( """" ); ptr = str; while ( ( token = *ptr ) && ++len ) { if ( strchr( ""\""\\\b\f\n\r\t"", token ) ) ++len; else if ( token < 32 ) len += 5; ++ptr; } if ( ! ( out = (char*) cJSON_malloc( len + 3 ) ) ) return 0; ptr2 = out; ptr = str; *ptr2++ = '\""'; while ( *ptr ) { if ( (unsigned char) *ptr > 31 && *ptr != '\""' && *ptr != '\\' ) *ptr2++ = *ptr++; else { *ptr2++ = '\\'; switch ( token = *ptr++ ) { case '\\': *ptr2++ = '\\'; break; case '\""': *ptr2++ = '\""'; break; case '\b': *ptr2++ = 'b'; break; case '\f': *ptr2++ = 'f'; break; case '\n': *ptr2++ = 'n'; break; case '\r': *ptr2++ = 'r'; break; case '\t': *ptr2++ = 't'; break; default: /* Escape and print. */ sprintf( ptr2, ""u%04x"", token ); ptr2 += 5; break; } } } *ptr2++ = '\""'; *ptr2++ = 0; return out; } ",1 "bgp_mp_unreach_parse (struct bgp_attr_parser_args *args, struct bgp_nlri *mp_withdraw) { struct stream *s; afi_t afi; safi_t safi; u_int16_t withdraw_len; int ret; struct peer *const peer = args->peer; const bgp_size_t length = args->length; s = peer->ibuf; #define BGP_MP_UNREACH_MIN_SIZE 3 if ((length > STREAM_READABLE(s)) || (length < BGP_MP_UNREACH_MIN_SIZE)) return BGP_ATTR_PARSE_ERROR; afi = stream_getw (s); safi = stream_getc (s); withdraw_len = length - BGP_MP_UNREACH_MIN_SIZE; if (safi != SAFI_MPLS_LABELED_VPN) { ret = bgp_nlri_sanity_check (peer, afi, stream_pnt (s), withdraw_len); if (ret < 0) return BGP_ATTR_PARSE_ERROR; } mp_withdraw->afi = afi; mp_withdraw->safi = safi; mp_withdraw->nlri = stream_pnt (s); mp_withdraw->length = withdraw_len; stream_forward_getp (s, withdraw_len); return BGP_ATTR_PARSE_PROCEED; } ",0 "void arm_notify_die(const char *str, struct pt_regs *regs, struct siginfo *info, unsigned long err, unsigned long trap) { if (user_mode(regs)) { current->thread.error_code = err; current->thread.trap_no = trap; force_sig_info(info->si_signo, info, current); } else { die(str, regs, err); } } ",0 "format_GOTO_TABLE(const struct ofpact_goto_table *a, struct ds *s) { ds_put_format(s, ""%sgoto_table:%s%""PRIu8, colors.param, colors.end, a->table_id); } ",0 "void ClipboardMessageFilter::OnWriteObjectsAsync( const ui::Clipboard::ObjectMap& objects) { ui::Clipboard::ObjectMap* long_living_objects = new ui::Clipboard::ObjectMap(objects); long_living_objects->erase(ui::Clipboard::CBF_SMBITMAP); BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, new WriteClipboardTask(long_living_objects)); } ",0 "ACTION_P(QuitMainMessageLoop, message_loop) { PostQuitTask(message_loop); } ",0 "delete_policy_2_svc(dpol_arg *arg, struct svc_req *rqstp) { static generic_ret ret; char *prime_arg; gss_buffer_desc client_name, service_name; OM_uint32 minor_stat; kadm5_server_handle_t handle; const char *errmsg = NULL; xdr_free(xdr_generic_ret, &ret); if ((ret.code = new_server_handle(arg->api_version, rqstp, &handle))) goto exit_func; if ((ret.code = check_handle((void *)handle))) goto exit_func; ret.api_version = handle->api_version; if (setup_gss_names(rqstp, &client_name, &service_name) < 0) { ret.code = KADM5_FAILURE; goto exit_func; } prime_arg = arg->name; if (CHANGEPW_SERVICE(rqstp) || !kadm5int_acl_check(handle->context, rqst2name(rqstp), ACL_DELETE, NULL, NULL)) { log_unauth(""kadm5_delete_policy"", prime_arg, &client_name, &service_name, rqstp); ret.code = KADM5_AUTH_DELETE; } else { ret.code = kadm5_delete_policy((void *)handle, arg->name); if( ret.code != 0 ) errmsg = krb5_get_error_message(handle->context, ret.code); log_done(""kadm5_delete_policy"", ((prime_arg == NULL) ? ""(null)"" : prime_arg), errmsg, &client_name, &service_name, rqstp); if (errmsg != NULL) krb5_free_error_message(handle->context, errmsg); } gss_release_buffer(&minor_stat, &client_name); gss_release_buffer(&minor_stat, &service_name); exit_func: free_server_handle(handle); return &ret; } ",1 "static void log_static_leases(struct static_lease **st_lease_pp) { struct static_lease *cur; if (dhcp_verbose < 2) return; cur = *st_lease_pp; while (cur) { bb_error_msg(""static lease: mac:%02x:%02x:%02x:%02x:%02x:%02x nip:%x"", cur->mac[0], cur->mac[1], cur->mac[2], cur->mac[3], cur->mac[4], cur->mac[5], cur->nip ); cur = cur->next; } } ",0 "void kvm_vcpu_reload_apic_access_page(struct kvm_vcpu *vcpu) { struct page *page = NULL; if (!lapic_in_kernel(vcpu)) return; if (!kvm_x86_ops->set_apic_access_page_addr) return; page = gfn_to_page(vcpu->kvm, APIC_DEFAULT_PHYS_BASE >> PAGE_SHIFT); if (is_error_page(page)) return; kvm_x86_ops->set_apic_access_page_addr(vcpu, page_to_phys(page)); /* * Do not pin apic access page in memory, the MMU notifier * will call us again if it is migrated or swapped out. */ put_page(page); } ",0 "void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb) { struct in_pktinfo *pktinfo = PKTINFO_SKB_CB(skb); bool prepare = (inet_sk(sk)->cmsg_flags & IP_CMSG_PKTINFO) || ipv6_sk_rxinfo(sk); if (prepare && skb_rtable(skb)) { /* skb->cb is overloaded: prior to this point it is IP{6}CB * which has interface index (iif) as the first member of the * underlying inet{6}_skb_parm struct. This code then overlays * PKTINFO_SKB_CB and in_pktinfo also has iif as the first * element so the iif is picked up from the prior IPCB. If iif * is the loopback interface, then return the sending interface * (e.g., process binds socket to eth0 for Tx which is * redirected to loopback in the rtable/dst). */ if (pktinfo->ipi_ifindex == LOOPBACK_IFINDEX) pktinfo->ipi_ifindex = inet_iif(skb); pktinfo->ipi_spec_dst.s_addr = fib_compute_spec_dst(skb); } else { pktinfo->ipi_ifindex = 0; pktinfo->ipi_spec_dst.s_addr = 0; } skb_dst_drop(skb); } ",1 "void DownloadItemImpl::OnDownloadedFileRemoved() { file_externally_removed_ = true; UpdateObservers(); } ",0 "static void vcc_release_cb(struct sock *sk) { struct atm_vcc *vcc = atm_sk(sk); if (vcc->release_cb) vcc->release_cb(vcc); } ",0 "exsltDateDuration (const xmlChar *number) { exsltDateValPtr dur; double secs; xmlChar *ret; if (number == NULL) secs = exsltDateSeconds(number); else secs = xmlXPathCastStringToNumber(number); if ((xmlXPathIsNaN(secs)) || (xmlXPathIsInf(secs))) return NULL; dur = exsltDateCreateDate(XS_DURATION); if (dur == NULL) return NULL; dur->value.dur.sec = secs; ret = exsltDateFormatDuration(&(dur->value.dur)); exsltDateFreeDate(dur); return ret; } ",0 "base::string16 AutofillDialogViews::GetCvc() { return GroupForSection(GetCreditCardSection())->suggested_info-> textfield()->GetText(); } ",0 "bool WebContext::doNotTrack() const { if (IsInitialized()) { return context_->GetDoNotTrack(); } return construct_props_->do_not_track; } ",0 "PassRefPtr ImageBitmap::getSourceImageForCanvas( SourceImageStatus* status, AccelerationHint, SnapshotReason, const FloatSize&) const { *status = NormalSourceImageStatus; return m_image ? m_image : nullptr; } ",0 "upnp_redirect_internal(const char * rhost, unsigned short eport, const char * iaddr, unsigned short iport, int proto, const char * desc, unsigned int timestamp) { /*syslog(LOG_INFO, ""redirecting port %hu to %s:%hu protocol %s for: %s"", eport, iaddr, iport, protocol, desc); */ if(disable_port_forwarding) return -1; if(add_redirect_rule2(ext_if_name, rhost, eport, iaddr, iport, proto, desc, timestamp) < 0) { return -1; } #ifdef ENABLE_LEASEFILE lease_file_add( eport, iaddr, iport, proto, desc, timestamp); #endif /* syslog(LOG_INFO, ""creating pass rule to %s:%hu protocol %s for: %s"", iaddr, iport, protocol, desc);*/ if(add_filter_rule2(ext_if_name, rhost, iaddr, eport, iport, proto, desc) < 0) { /* clean up the redirect rule */ #if !defined(__linux__) delete_redirect_rule(ext_if_name, eport, proto); #endif return -1; } if(timestamp > 0) { if(!nextruletoclean_timestamp || (timestamp < nextruletoclean_timestamp)) nextruletoclean_timestamp = timestamp; } #ifdef ENABLE_EVENTS /* the number of port mappings changed, we must * inform the subscribers */ upnp_event_var_change_notify(EWanIPC); #endif return 0; } ",0 "_dbus_full_duplex_pipe (int *fd1, int *fd2, dbus_bool_t blocking, DBusError *error) { SOCKET temp, socket1 = -1, socket2 = -1; struct sockaddr_in saddr; int len; u_long arg; _dbus_win_startup_winsock (); temp = socket (AF_INET, SOCK_STREAM, 0); if (temp == INVALID_SOCKET) { DBUS_SOCKET_SET_ERRNO (); goto out0; } _DBUS_ZERO (saddr); saddr.sin_family = AF_INET; saddr.sin_port = 0; saddr.sin_addr.s_addr = htonl (INADDR_LOOPBACK); if (bind (temp, (struct sockaddr *)&saddr, sizeof (saddr)) == SOCKET_ERROR) { DBUS_SOCKET_SET_ERRNO (); goto out0; } if (listen (temp, 1) == SOCKET_ERROR) { DBUS_SOCKET_SET_ERRNO (); goto out0; } len = sizeof (saddr); if (getsockname (temp, (struct sockaddr *)&saddr, &len) == SOCKET_ERROR) { DBUS_SOCKET_SET_ERRNO (); goto out0; } socket1 = socket (AF_INET, SOCK_STREAM, 0); if (socket1 == INVALID_SOCKET) { DBUS_SOCKET_SET_ERRNO (); goto out0; } if (connect (socket1, (struct sockaddr *)&saddr, len) == SOCKET_ERROR) { DBUS_SOCKET_SET_ERRNO (); goto out1; } socket2 = accept (temp, (struct sockaddr *) &saddr, &len); if (socket2 == INVALID_SOCKET) { DBUS_SOCKET_SET_ERRNO (); goto out1; } if (!blocking) { arg = 1; if (ioctlsocket (socket1, FIONBIO, &arg) == SOCKET_ERROR) { DBUS_SOCKET_SET_ERRNO (); goto out2; } arg = 1; if (ioctlsocket (socket2, FIONBIO, &arg) == SOCKET_ERROR) { DBUS_SOCKET_SET_ERRNO (); goto out2; } } *fd1 = socket1; *fd2 = socket2; _dbus_verbose (""full-duplex pipe %d:%d <-> %d:%d\n"", *fd1, socket1, *fd2, socket2); closesocket (temp); return TRUE; out2: closesocket (socket2); out1: closesocket (socket1); out0: closesocket (temp); dbus_set_error (error, _dbus_error_from_errno (errno), ""Could not setup socket pair: %s"", _dbus_strerror_from_errno ()); return FALSE; } ",0 "void DocumentThreadableLoader::overrideTimeout(unsigned long timeoutMilliseconds) { ASSERT(m_async); if (m_requestStartedSeconds <= 0.0) return; m_timeoutTimer.stop(); if (timeoutMilliseconds) { double elapsedTime = monotonicallyIncreasingTime() - m_requestStartedSeconds; double nextFire = timeoutMilliseconds / 1000.0; double resolvedTime = std::max(nextFire - elapsedTime, 0.0); m_timeoutTimer.startOneShot(resolvedTime, BLINK_FROM_HERE); } } ",0 "void RenderThreadImpl::OnAssociatedInterfaceRequest( const std::string& name, mojo::ScopedInterfaceEndpointHandle handle) { if (associated_interfaces_.CanBindRequest(name)) associated_interfaces_.BindRequest(name, std::move(handle)); else ChildThreadImpl::OnAssociatedInterfaceRequest(name, std::move(handle)); } ",0 "void blk_steal_bios(struct bio_list *list, struct request *rq) { if (rq->bio) { if (list->tail) list->tail->bi_next = rq->bio; else list->head = rq->bio; list->tail = rq->biotail; rq->bio = NULL; rq->biotail = NULL; } rq->__data_len = 0; } ",0 "bool WebMediaPlayerMS::CopyVideoYUVDataToPlatformTexture( gpu::gles2::GLES2Interface* gl, unsigned target, unsigned int texture, unsigned internal_format, unsigned format, unsigned type, int level, bool premultiply_alpha, bool flip_y, int already_uploaded_id, VideoFrameUploadMetadata* out_metadata) { TRACE_EVENT0(""media"", ""copyVideoYUVDataToPlatformTexture""); DCHECK(thread_checker_.CalledOnValidThread()); scoped_refptr video_frame = compositor_->GetCurrentFrameWithoutUpdatingStatistics(); if (!video_frame) return false; if (video_frame->HasTextures()) return false; media::Context3D context_3d; auto* provider = RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); if (!provider) return false; context_3d = media::Context3D(provider->ContextGL(), provider->GrContext()); DCHECK(context_3d.gl); return video_renderer_.CopyVideoFrameYUVDataToGLTexture( context_3d, gl, video_frame.get(), target, texture, internal_format, format, type, level, premultiply_alpha, flip_y); } ",0 "compat_copy_entries_to_user(unsigned int total_size, struct xt_table *table, void __user *userptr) { struct xt_counters *counters; const struct xt_table_info *private = table->private; void __user *pos; unsigned int size; int ret = 0; unsigned int i = 0; struct ip6t_entry *iter; counters = alloc_counters(table); if (IS_ERR(counters)) return PTR_ERR(counters); pos = userptr; size = total_size; xt_entry_foreach(iter, private->entries, total_size) { ret = compat_copy_entry_to_user(iter, &pos, &size, counters, i++); if (ret != 0) break; } vfree(counters); return ret; } ",0 "static int vmx_set_hv_timer(struct kvm_vcpu *vcpu, u64 guest_deadline_tsc) { struct vcpu_vmx *vmx; u64 tscl, guest_tscl, delta_tsc, lapic_timer_advance_cycles; if (kvm_mwait_in_guest(vcpu->kvm)) return -EOPNOTSUPP; vmx = to_vmx(vcpu); tscl = rdtsc(); guest_tscl = kvm_read_l1_tsc(vcpu, tscl); delta_tsc = max(guest_deadline_tsc, guest_tscl) - guest_tscl; lapic_timer_advance_cycles = nsec_to_cycles(vcpu, lapic_timer_advance_ns); if (delta_tsc > lapic_timer_advance_cycles) delta_tsc -= lapic_timer_advance_cycles; else delta_tsc = 0; /* Convert to host delta tsc if tsc scaling is enabled */ if (vcpu->arch.tsc_scaling_ratio != kvm_default_tsc_scaling_ratio && u64_shl_div_u64(delta_tsc, kvm_tsc_scaling_ratio_frac_bits, vcpu->arch.tsc_scaling_ratio, &delta_tsc)) return -ERANGE; /* * If the delta tsc can't fit in the 32 bit after the multi shift, * we can't use the preemption timer. * It's possible that it fits on later vmentries, but checking * on every vmentry is costly so we just use an hrtimer. */ if (delta_tsc >> (cpu_preemption_timer_multi + 32)) return -ERANGE; vmx->hv_deadline_tsc = tscl + delta_tsc; vmcs_set_bits(PIN_BASED_VM_EXEC_CONTROL, PIN_BASED_VMX_PREEMPTION_TIMER); return delta_tsc == 0; } ",0 "void DaemonProcess::OnConfigWatcherError() { DCHECK(caller_task_runner()->BelongsToCurrentThread()); Stop(); } ",0 "bool OmniboxViewViews::HandleKeyEvent(views::Textfield* textfield, const ui::KeyEvent& event) { if (event.type() == ui::ET_KEY_RELEASED) { if (event.key_code() == ui::VKEY_CONTROL) model()->OnControlKeyChanged(false); return false; } delete_at_end_pressed_ = false; if (event.IsUnicodeKeyCode()) return false; const bool shift = event.IsShiftDown(); const bool control = event.IsControlDown(); const bool alt = event.IsAltDown() || event.IsAltGrDown(); switch (event.key_code()) { case ui::VKEY_RETURN: model()->AcceptInput(alt ? WindowOpenDisposition::NEW_FOREGROUND_TAB : WindowOpenDisposition::CURRENT_TAB, false); return true; case ui::VKEY_ESCAPE: return model()->OnEscapeKeyPressed(); case ui::VKEY_CONTROL: model()->OnControlKeyChanged(true); break; case ui::VKEY_DELETE: if (shift && model()->popup_model()->IsOpen()) model()->popup_model()->TryDeletingCurrentItem(); delete_at_end_pressed_ = (!event.IsAltDown() && !HasSelection() && GetCursorPosition() == text().length()); break; case ui::VKEY_UP: if (IsTextEditCommandEnabled(ui::TextEditCommand::MOVE_UP)) { ExecuteTextEditCommand(ui::TextEditCommand::MOVE_UP); return true; } break; case ui::VKEY_DOWN: if (IsTextEditCommandEnabled(ui::TextEditCommand::MOVE_DOWN)) { ExecuteTextEditCommand(ui::TextEditCommand::MOVE_DOWN); return true; } break; case ui::VKEY_PRIOR: if (control || alt || shift) return false; model()->OnUpOrDownKeyPressed(-1 * model()->result().size()); return true; case ui::VKEY_NEXT: if (control || alt || shift) return false; model()->OnUpOrDownKeyPressed(model()->result().size()); return true; case ui::VKEY_V: if (control && !alt && IsTextEditCommandEnabled(ui::TextEditCommand::PASTE)) { ExecuteTextEditCommand(ui::TextEditCommand::PASTE); return true; } break; case ui::VKEY_INSERT: if (shift && !control && IsTextEditCommandEnabled(ui::TextEditCommand::PASTE)) { ExecuteTextEditCommand(ui::TextEditCommand::PASTE); return true; } break; case ui::VKEY_BACK: if (model()->is_keyword_hint() || model()->keyword().empty() || HasSelection() || GetCursorPosition() != 0) return false; model()->ClearKeyword(); return true; default: break; } return HandleEarlyTabActions(event); } ",0 "static bool check_bytes(const ut8 *buf, ut64 length) { return buf && length > 4 && memcmp (buf, ELFMAG, SELFMAG) == 0 && buf[4] != 2; } ",0 "void ChromeContentBrowserClient::CreateWebUsbService( content::RenderFrameHost* render_frame_host, mojo::InterfaceRequest request) { if (!base::FeatureList::IsEnabled(features::kWebUsb)) return; WebContents* web_contents = WebContents::FromRenderFrameHost(render_frame_host); if (!web_contents) { NOTREACHED(); return; } UsbTabHelper* tab_helper = UsbTabHelper::GetOrCreateForWebContents(web_contents); tab_helper->CreateWebUsbService(render_frame_host, std::move(request)); } ",0 "bool IsX11WindowFullScreen(XID window) { static Atom atom = GetAtom(""_NET_WM_STATE_FULLSCREEN""); std::vector atom_properties; if (GetAtomArrayProperty(window, ""_NET_WM_STATE"", &atom_properties) && std::find(atom_properties.begin(), atom_properties.end(), atom) != atom_properties.end()) return true; #if defined(TOOLKIT_GTK) GdkRectangle monitor_rect; gdk_screen_get_monitor_geometry(gdk_screen_get_default(), 0, &monitor_rect); gfx::Rect window_rect; if (!ui::GetWindowRect(window, &window_rect)) return false; return monitor_rect.x == window_rect.x() && monitor_rect.y == window_rect.y() && monitor_rect.width == window_rect.width() && monitor_rect.height == window_rect.height(); #else NOTIMPLEMENTED(); return false; #endif } ",0 "ofputil_pull_ipfix_stats(struct ofputil_ipfix_stats *is, struct ofpbuf *msg) { enum ofperr error; enum ofpraw raw; memset(is, 0xFF, sizeof (*is)); error = (msg->header ? ofpraw_decode(&raw, msg->header) : ofpraw_pull(&raw, msg)); if (error) { return error; } if (!msg->size) { return EOF; } else if (raw == OFPRAW_NXST_IPFIX_BRIDGE_REPLY || raw == OFPRAW_NXST_IPFIX_FLOW_REPLY) { struct nx_ipfix_stats_reply *reply; reply = ofpbuf_try_pull(msg, sizeof *reply); return ofputil_ipfix_stats_from_nx(is, reply); } else { OVS_NOT_REACHED(); } } ",0 "static int airo_close(struct net_device *dev) { struct airo_info *ai = dev->ml_priv; netif_stop_queue(dev); if (ai->wifidev != dev) { #ifdef POWER_ON_DOWN /* Shut power to the card. The idea is that the user can save * power when he doesn't need the card with ""ifconfig down"". * That's the method that is most friendly towards the network * stack (i.e. the network stack won't try to broadcast * anything on the interface and routes are gone. Jean II */ set_bit(FLAG_RADIO_DOWN, &ai->flags); disable_MAC(ai, 1); #endif disable_interrupts( ai ); free_irq(dev->irq, dev); set_bit(JOB_DIE, &ai->jobs); kthread_stop(ai->airo_thread_task); } return 0; } ",0 "char *M_fs_path_join(const char *p1, const char *p2, M_fs_system_t sys_type) { M_buf_t *buf; char sep; sys_type = M_fs_path_get_system_type(sys_type); /* If p2 is an absolute path we can't properly join it to another path... */ if (M_fs_path_isabs(p2, sys_type)) return M_strdup(p2); buf = M_buf_create(); sep = M_fs_path_get_system_sep(sys_type); /* Don't add nothing if we have nothing. */ if (p1 != NULL && *p1 != '\0') M_buf_add_str(buf, p1); /* Only put a sep if we have two parts and we really need the sep (p1 doesn't end with a sep). */ if (p1 != NULL && *p1 != '\0' && p2 != NULL && *p2 != '\0' && p1[M_str_len(p1)-1] != sep) M_buf_add_byte(buf, (unsigned char)sep); /* Don't add nothing if we have nothing. */ if (p2 != NULL && *p2 != '\0') M_buf_add_str(buf, p2); return M_buf_finish_str(buf, NULL); } ",0 "int btrfs_delete_one_dir_name(struct btrfs_trans_handle *trans, struct btrfs_root *root, struct btrfs_path *path, struct btrfs_dir_item *di) { struct extent_buffer *leaf; u32 sub_item_len; u32 item_len; int ret = 0; leaf = path->nodes[0]; sub_item_len = sizeof(*di) + btrfs_dir_name_len(leaf, di) + btrfs_dir_data_len(leaf, di); item_len = btrfs_item_size_nr(leaf, path->slots[0]); if (sub_item_len == item_len) { ret = btrfs_del_item(trans, root, path); } else { /* MARKER */ unsigned long ptr = (unsigned long)di; unsigned long start; start = btrfs_item_ptr_offset(leaf, path->slots[0]); memmove_extent_buffer(leaf, ptr, ptr + sub_item_len, item_len - (ptr + sub_item_len - start)); btrfs_truncate_item(trans, root, path, item_len - sub_item_len, 1); } return ret; } ",0 "_gnutls_send_finished (gnutls_session_t session, int again) { uint8_t data[36]; int ret; int data_size = 0; if (again == 0) { /* This is needed in order to hash all the required * messages. */ if ((ret = _gnutls_handshake_hash_pending (session)) < 0) { gnutls_assert (); return ret; } if (gnutls_protocol_get_version (session) == GNUTLS_SSL3) { ret = _gnutls_ssl3_finished (session, session->security_parameters.entity, data); data_size = 36; } else { /* TLS 1.0 */ ret = _gnutls_finished (session, session->security_parameters.entity, data); data_size = 12; } if (ret < 0) { gnutls_assert (); return ret; } } ret = _gnutls_send_handshake (session, data, data_size, GNUTLS_HANDSHAKE_FINISHED); return ret; } ",0 " base::FilePath temp_dir() { return temp_dir_.GetPath(); } ",0 "PHP_FUNCTION(mb_ereg_search_setpos) { long position; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""l"", &position) == FAILURE) { return; } if (position < 0 || (MBREX(search_str) != NULL && Z_TYPE_P(MBREX(search_str)) == IS_STRING && position >= Z_STRLEN_P(MBREX(search_str)))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Position is out of range""); MBREX(search_pos) = 0; RETURN_FALSE; } MBREX(search_pos) = position; RETURN_TRUE; } ",0 "Segment::Segment(IMkvReader* pReader, long long elem_start, long long start, long long size) : m_pReader(pReader), m_element_start(elem_start), m_start(start), m_size(size), m_pos(start), m_pUnknownSize(0), m_pSeekHead(NULL), m_pInfo(NULL), m_pTracks(NULL), m_pCues(NULL), m_pChapters(NULL), m_clusters(NULL), m_clusterCount(0), m_clusterPreloadCount(0), m_clusterSize(0) {} ",1 "isdn_net_xmit(struct net_device *ndev, struct sk_buff *skb) { isdn_net_dev *nd; isdn_net_local *slp; isdn_net_local *lp = netdev_priv(ndev); int retv = NETDEV_TX_OK; if (((isdn_net_local *) netdev_priv(ndev))->master) { printk(""isdn BUG at %s:%d!\n"", __FILE__, __LINE__); dev_kfree_skb(skb); return NETDEV_TX_OK; } /* For the other encaps the header has already been built */ #ifdef CONFIG_ISDN_PPP if (lp->p_encap == ISDN_NET_ENCAP_SYNCPPP) { return isdn_ppp_xmit(skb, ndev); } #endif nd = ((isdn_net_local *) netdev_priv(ndev))->netdev; lp = isdn_net_get_locked_lp(nd); if (!lp) { printk(KERN_WARNING ""%s: all channels busy - requeuing!\n"", ndev->name); return NETDEV_TX_BUSY; } /* we have our lp locked from now on */ /* Reset hangup-timeout */ lp->huptimer = 0; // FIXME? isdn_net_writebuf_skb(lp, skb); spin_unlock_bh(&lp->xmit_lock); /* the following stuff is here for backwards compatibility. * in future, start-up and hangup of slaves (based on current load) * should move to userspace and get based on an overall cps * calculation */ if (lp->cps > lp->triggercps) { if (lp->slave) { if (!lp->sqfull) { /* First time overload: set timestamp only */ lp->sqfull = 1; lp->sqfull_stamp = jiffies; } else { /* subsequent overload: if slavedelay exceeded, start dialing */ if (time_after(jiffies, lp->sqfull_stamp + lp->slavedelay)) { slp = ISDN_SLAVE_PRIV(lp); if (!(slp->flags & ISDN_NET_CONNECTED)) { isdn_net_force_dial_lp(ISDN_SLAVE_PRIV(lp)); } } } } } else { if (lp->sqfull && time_after(jiffies, lp->sqfull_stamp + lp->slavedelay + (10 * HZ))) { lp->sqfull = 0; } /* this is a hack to allow auto-hangup for slaves on moderate loads */ nd->queue = nd->local; } return retv; } ",0 "static void acl_state_changed_callback(bt_status_t status, bt_bdaddr_t *bd_addr, bt_acl_state_t state) { jbyteArray addr; int i; if (!checkCallbackThread()) { ALOGE(""Callback: '%s' is not called on the correct thread"", __FUNCTION__); return; } if (!bd_addr) { ALOGE(""Address is null in %s"", __FUNCTION__); return; } addr = callbackEnv->NewByteArray(sizeof(bt_bdaddr_t)); if (addr == NULL) { ALOGE(""Address allocation failed in %s"", __FUNCTION__); return; } callbackEnv->SetByteArrayRegion(addr, 0, sizeof(bt_bdaddr_t), (jbyte *)bd_addr); callbackEnv->CallVoidMethod(sJniCallbacksObj, method_aclStateChangeCallback, (jint) status, addr, (jint)state); checkAndClearExceptionFromCallback(callbackEnv, __FUNCTION__); callbackEnv->DeleteLocalRef(addr); } ",0 "void RenderFrameDevToolsAgentHost::ConnectWebContents(WebContents* wc) { RenderFrameHostImpl* host = static_cast(wc->GetMainFrame()); DCHECK(host); SetFrameTreeNode(host->frame_tree_node()); UpdateFrameHost(host); } ",0 "int fscrypt_fname_disk_to_usr(struct inode *inode, u32 hash, u32 minor_hash, const struct fscrypt_str *iname, struct fscrypt_str *oname) { const struct qstr qname = FSTR_TO_QSTR(iname); char buf[24]; if (fscrypt_is_dot_dotdot(&qname)) { oname->name[0] = '.'; oname->name[iname->len - 1] = '.'; oname->len = iname->len; return 0; } if (iname->len < FS_CRYPTO_BLOCK_SIZE) return -EUCLEAN; if (inode->i_crypt_info) return fname_decrypt(inode, iname, oname); if (iname->len <= FS_FNAME_CRYPTO_DIGEST_SIZE) { oname->len = digest_encode(iname->name, iname->len, oname->name); return 0; } if (hash) { memcpy(buf, &hash, 4); memcpy(buf + 4, &minor_hash, 4); } else { memset(buf, 0, 8); } memcpy(buf + 8, iname->name + iname->len - 16, 16); oname->name[0] = '_'; oname->len = 1 + digest_encode(buf, 24, oname->name + 1); return 0; } ",0 "tar_sparse_dump_region (struct tar_sparse_file *file, size_t i) { if (file->optab->dump_region) return file->optab->dump_region (file, i); return false; } ",0 "static bool split_dfs_path(TALLOC_CTX *ctx, const char *nodepath, char **pp_server, char **pp_share, char **pp_extrapath) { char *p, *q; char *path; *pp_server = NULL; *pp_share = NULL; *pp_extrapath = NULL; path = talloc_strdup(ctx, nodepath); if (!path) { goto fail; } if ( path[0] != '\\' ) { goto fail; } p = strchr_m( path + 1, '\\' ); if ( !p ) { goto fail; } *p = '\0'; p++; /* Look for any extra/deep path */ q = strchr_m(p, '\\'); if (q != NULL) { *q = '\0'; q++; *pp_extrapath = talloc_strdup(ctx, q); } else { *pp_extrapath = talloc_strdup(ctx, """"); } if (*pp_extrapath == NULL) { goto fail; } *pp_share = talloc_strdup(ctx, p); if (*pp_share == NULL) { goto fail; } *pp_server = talloc_strdup(ctx, &path[1]); if (*pp_server == NULL) { goto fail; } TALLOC_FREE(path); return true; fail: TALLOC_FREE(*pp_share); TALLOC_FREE(*pp_extrapath); TALLOC_FREE(path); return false; } ",0 "JsVar *jsvAsString(JsVar *v, bool unlockVar) { JsVar *str = 0; if (jsvHasCharacterData(v) && jsvIsName(v)) { str = jsvNewFromStringVar(v,0,JSVAPPENDSTRINGVAR_MAXLENGTH); } else if (jsvIsString(v)) { // If it is a string - just return a reference str = jsvLockAgain(v); } else if (jsvIsObject(v)) { // If it is an object and we can call toString on it JsVar *toStringFn = jspGetNamedField(v, ""toString"", false); if (toStringFn && toStringFn->varData.native.ptr != (void (*)(void))jswrap_object_toString) { JsVar *result = jspExecuteFunction(toStringFn,v,0,0); jsvUnLock(toStringFn); str = jsvAsString(result, true); } else { jsvUnLock(toStringFn); str = jsvNewFromString(""[object Object]""); } } else { const char *constChar = jsvGetConstString(v); assert(JS_NUMBER_BUFFER_SIZE>=10); char buf[JS_NUMBER_BUFFER_SIZE]; if (constChar) { str = jsvNewFromString(constChar); } else if (jsvIsPin(v)) { jshGetPinString(buf, (Pin)v->varData.integer); str = jsvNewFromString(buf); } else if (jsvIsInt(v)) { itostr(v->varData.integer, buf, 10); str = jsvNewFromString(buf); } else if (jsvIsFloat(v)) { ftoa_bounded(v->varData.floating, buf, sizeof(buf)); str = jsvNewFromString(buf); } else if (jsvIsArray(v) || jsvIsArrayBuffer(v)) { JsVar *filler = jsvNewFromString("",""); str = jsvArrayJoin(v, filler); jsvUnLock(filler); } else if (jsvIsFunction(v)) { str = jsvNewFromEmptyString(); if (str) jsfGetJSON(v, str, JSON_NONE); } else { jsExceptionHere(JSET_INTERNALERROR, ""Variable type cannot be converted to string""); str = 0; } } if (unlockVar) jsvUnLock(v); return str; } ",0 "int llc_conn_remove_acked_pdus(struct sock *sk, u8 nr, u16 *how_many_unacked) { int pdu_pos, i; struct sk_buff *skb; struct llc_pdu_sn *pdu; int nbr_acked = 0; struct llc_sock *llc = llc_sk(sk); int q_len = skb_queue_len(&llc->pdu_unack_q); if (!q_len) goto out; skb = skb_peek(&llc->pdu_unack_q); pdu = llc_pdu_sn_hdr(skb); /* finding position of last acked pdu in queue */ pdu_pos = ((int)LLC_2_SEQ_NBR_MODULO + (int)nr - (int)LLC_I_GET_NS(pdu)) % LLC_2_SEQ_NBR_MODULO; for (i = 0; i < pdu_pos && i < q_len; i++) { skb = skb_dequeue(&llc->pdu_unack_q); kfree_skb(skb); nbr_acked++; } out: *how_many_unacked = skb_queue_len(&llc->pdu_unack_q); return nbr_acked; } ",0 "OMX_ERRORTYPE omx_video::free_input_buffer(OMX_BUFFERHEADERTYPE *bufferHdr) { unsigned int index = 0; OMX_U8 *temp_buff ; if (bufferHdr == NULL || m_inp_mem_ptr == NULL) { DEBUG_PRINT_ERROR(""ERROR: free_input: Invalid bufferHdr[%p] or m_inp_mem_ptr[%p]"", bufferHdr, m_inp_mem_ptr); return OMX_ErrorBadParameter; } index = bufferHdr - ((!meta_mode_enable)?m_inp_mem_ptr:meta_buffer_hdr); #ifdef _ANDROID_ICS_ if (meta_mode_enable) { if (index < m_sInPortDef.nBufferCountActual) { memset(&meta_buffer_hdr[index], 0, sizeof(meta_buffer_hdr[index])); memset(&meta_buffers[index], 0, sizeof(meta_buffers[index])); } if (!mUseProxyColorFormat) return OMX_ErrorNone; else { c2d_conv.close(); opaque_buffer_hdr[index] = NULL; } } #endif if (index < m_sInPortDef.nBufferCountActual && !mUseProxyColorFormat && dev_free_buf(&m_pInput_pmem[index],PORT_INDEX_IN) != true) { DEBUG_PRINT_LOW(""ERROR: dev_free_buf() Failed for i/p buf""); } if (index < m_sInPortDef.nBufferCountActual && m_pInput_pmem) { if (m_pInput_pmem[index].fd > 0 && input_use_buffer == false) { DEBUG_PRINT_LOW(""FreeBuffer:: i/p AllocateBuffer case""); if(!secure_session) { munmap (m_pInput_pmem[index].buffer,m_pInput_pmem[index].size); } else { free(m_pInput_pmem[index].buffer); } close (m_pInput_pmem[index].fd); #ifdef USE_ION free_ion_memory(&m_pInput_ion[index]); #endif m_pInput_pmem[index].fd = -1; } else if (m_pInput_pmem[index].fd > 0 && (input_use_buffer == true && m_use_input_pmem == OMX_FALSE)) { DEBUG_PRINT_LOW(""FreeBuffer:: i/p Heap UseBuffer case""); if (dev_free_buf(&m_pInput_pmem[index],PORT_INDEX_IN) != true) { DEBUG_PRINT_ERROR(""ERROR: dev_free_buf() Failed for i/p buf""); } if(!secure_session) { munmap (m_pInput_pmem[index].buffer,m_pInput_pmem[index].size); } close (m_pInput_pmem[index].fd); #ifdef USE_ION free_ion_memory(&m_pInput_ion[index]); #endif m_pInput_pmem[index].fd = -1; } else { DEBUG_PRINT_ERROR(""FreeBuffer:: fd is invalid or i/p PMEM UseBuffer case""); } } return OMX_ErrorNone; } ",0 "int container_mem_lock(struct lxc_container *c) { return lxclock(c->privlock, 0); } ",0 "bool HTMLDocumentParser::processingData() const { return isScheduledForResume() || inPumpSession(); } ",0 " static int rawv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) { struct ipv6_txoptions opt_space; DECLARE_SOCKADDR(struct sockaddr_in6 *, sin6, msg->msg_name); struct in6_addr *daddr, *final_p, final; struct inet_sock *inet = inet_sk(sk); struct ipv6_pinfo *np = inet6_sk(sk); struct raw6_sock *rp = raw6_sk(sk); struct ipv6_txoptions *opt = NULL; struct ip6_flowlabel *flowlabel = NULL; struct dst_entry *dst = NULL; struct raw6_frag_vec rfv; struct flowi6 fl6; int addr_len = msg->msg_namelen; int hlimit = -1; int tclass = -1; int dontfrag = -1; u16 proto; int err; /* Rough check on arithmetic overflow, better check is made in ip6_append_data(). */ if (len > INT_MAX) return -EMSGSIZE; /* Mirror BSD error message compatibility */ if (msg->msg_flags & MSG_OOB) return -EOPNOTSUPP; /* * Get and verify the address. */ memset(&fl6, 0, sizeof(fl6)); fl6.flowi6_mark = sk->sk_mark; if (sin6) { if (addr_len < SIN6_LEN_RFC2133) return -EINVAL; if (sin6->sin6_family && sin6->sin6_family != AF_INET6) return -EAFNOSUPPORT; /* port is the proto value [0..255] carried in nexthdr */ proto = ntohs(sin6->sin6_port); if (!proto) proto = inet->inet_num; else if (proto != inet->inet_num) return -EINVAL; if (proto > 255) return -EINVAL; daddr = &sin6->sin6_addr; if (np->sndflow) { fl6.flowlabel = sin6->sin6_flowinfo&IPV6_FLOWINFO_MASK; if (fl6.flowlabel&IPV6_FLOWLABEL_MASK) { flowlabel = fl6_sock_lookup(sk, fl6.flowlabel); if (!flowlabel) return -EINVAL; } } /* * Otherwise it will be difficult to maintain * sk->sk_dst_cache. */ if (sk->sk_state == TCP_ESTABLISHED && ipv6_addr_equal(daddr, &sk->sk_v6_daddr)) daddr = &sk->sk_v6_daddr; if (addr_len >= sizeof(struct sockaddr_in6) && sin6->sin6_scope_id && __ipv6_addr_needs_scope_id(__ipv6_addr_type(daddr))) fl6.flowi6_oif = sin6->sin6_scope_id; } else { if (sk->sk_state != TCP_ESTABLISHED) return -EDESTADDRREQ; proto = inet->inet_num; daddr = &sk->sk_v6_daddr; fl6.flowlabel = np->flow_label; } if (fl6.flowi6_oif == 0) fl6.flowi6_oif = sk->sk_bound_dev_if; if (msg->msg_controllen) { opt = &opt_space; memset(opt, 0, sizeof(struct ipv6_txoptions)); opt->tot_len = sizeof(struct ipv6_txoptions); err = ip6_datagram_send_ctl(sock_net(sk), sk, msg, &fl6, opt, &hlimit, &tclass, &dontfrag); if (err < 0) { fl6_sock_release(flowlabel); return err; } if ((fl6.flowlabel&IPV6_FLOWLABEL_MASK) && !flowlabel) { flowlabel = fl6_sock_lookup(sk, fl6.flowlabel); if (!flowlabel) return -EINVAL; } if (!(opt->opt_nflen|opt->opt_flen)) opt = NULL; } if (!opt) opt = np->opt; if (flowlabel) opt = fl6_merge_options(&opt_space, flowlabel, opt); opt = ipv6_fixup_options(&opt_space, opt); fl6.flowi6_proto = proto; rfv.msg = msg; rfv.hlen = 0; err = rawv6_probe_proto_opt(&rfv, &fl6); if (err) goto out; if (!ipv6_addr_any(daddr)) fl6.daddr = *daddr; else fl6.daddr.s6_addr[15] = 0x1; /* :: means loopback (BSD'ism) */ if (ipv6_addr_any(&fl6.saddr) && !ipv6_addr_any(&np->saddr)) fl6.saddr = np->saddr; final_p = fl6_update_dst(&fl6, opt, &final); if (!fl6.flowi6_oif && ipv6_addr_is_multicast(&fl6.daddr)) fl6.flowi6_oif = np->mcast_oif; else if (!fl6.flowi6_oif) fl6.flowi6_oif = np->ucast_oif; security_sk_classify_flow(sk, flowi6_to_flowi(&fl6)); if (inet->hdrincl) fl6.flowi6_flags |= FLOWI_FLAG_KNOWN_NH; dst = ip6_dst_lookup_flow(sk, &fl6, final_p); if (IS_ERR(dst)) { err = PTR_ERR(dst); goto out; } if (hlimit < 0) hlimit = ip6_sk_dst_hoplimit(np, &fl6, dst); if (tclass < 0) tclass = np->tclass; if (dontfrag < 0) dontfrag = np->dontfrag; if (msg->msg_flags&MSG_CONFIRM) goto do_confirm; back_from_confirm: if (inet->hdrincl) err = rawv6_send_hdrinc(sk, msg, len, &fl6, &dst, msg->msg_flags); else { lock_sock(sk); err = ip6_append_data(sk, raw6_getfrag, &rfv, len, 0, hlimit, tclass, opt, &fl6, (struct rt6_info *)dst, msg->msg_flags, dontfrag); if (err) ip6_flush_pending_frames(sk); else if (!(msg->msg_flags & MSG_MORE)) err = rawv6_push_pending_frames(sk, &fl6, rp); release_sock(sk); } done: dst_release(dst); out: fl6_sock_release(flowlabel); return err < 0 ? err : len; do_confirm: dst_confirm(dst); if (!(msg->msg_flags & MSG_PROBE) || len) goto back_from_confirm; err = 0; goto done; } ",1 "const char* SegmentInfo::GetMuxingAppAsUTF8() const { return m_pMuxingAppAsUTF8; } ",0 "skb_zerocopy_headlen(const struct sk_buff *from) { unsigned int hlen = 0; if (!from->head_frag || skb_headlen(from) < L1_CACHE_BYTES || skb_shinfo(from)->nr_frags >= MAX_SKB_FRAGS) hlen = skb_headlen(from); if (skb_has_frag_list(from)) hlen = from->len; return hlen; } ",0 "void HTMLInputElement::didMoveToNewDocument(Document& oldDocument) { if (hasImageLoader()) imageLoader()->elementDidMoveToNewDocument(); if (isRadioButton()) oldDocument.formController()->checkedRadioButtons().removeButton(this); if (m_hasTouchEventHandler) oldDocument.didRemoveEventTargetNode(this); if (m_hasTouchEventHandler) document().didAddTouchEventHandler(this); HTMLTextFormControlElement::didMoveToNewDocument(oldDocument); } ",0 "static void __munlock_pagevec(struct pagevec *pvec, struct zone *zone) { int i; int nr = pagevec_count(pvec); int delta_munlocked; struct pagevec pvec_putback; int pgrescued = 0; pagevec_init(&pvec_putback, 0); /* Phase 1: page isolation */ spin_lock_irq(&zone->lru_lock); for (i = 0; i < nr; i++) { struct page *page = pvec->pages[i]; if (TestClearPageMlocked(page)) { /* * We already have pin from follow_page_mask() * so we can spare the get_page() here. */ if (__munlock_isolate_lru_page(page, false)) continue; else __munlock_isolation_failed(page); } /* * We won't be munlocking this page in the next phase * but we still need to release the follow_page_mask() * pin. We cannot do it under lru_lock however. If it's * the last pin, __page_cache_release() would deadlock. */ pagevec_add(&pvec_putback, pvec->pages[i]); pvec->pages[i] = NULL; } delta_munlocked = -nr + pagevec_count(&pvec_putback); __mod_zone_page_state(zone, NR_MLOCK, delta_munlocked); spin_unlock_irq(&zone->lru_lock); /* Now we can release pins of pages that we are not munlocking */ pagevec_release(&pvec_putback); /* Phase 2: page munlock */ for (i = 0; i < nr; i++) { struct page *page = pvec->pages[i]; if (page) { lock_page(page); if (!__putback_lru_fast_prepare(page, &pvec_putback, &pgrescued)) { /* * Slow path. We don't want to lose the last * pin before unlock_page() */ get_page(page); /* for putback_lru_page() */ __munlock_isolated_page(page); unlock_page(page); put_page(page); /* from follow_page_mask() */ } } } /* * Phase 3: page putback for pages that qualified for the fast path * This will also call put_page() to return pin from follow_page_mask() */ if (pagevec_count(&pvec_putback)) __putback_lru_fast(&pvec_putback, pgrescued); } ",0 "static void cmd_xconvmultisort(char *tag) { int c; struct sortcrit *sortcrit = NULL; struct searchargs *searchargs = NULL; struct windowargs *windowargs = NULL; struct conversations_state *cstate = NULL; clock_t start = clock(); char mytime[100]; int r; if (backend_current) { /* remote mailbox */ const char *cmd = ""Xconvmultisort""; prot_printf(backend_current->out, ""%s %s "", tag, cmd); if (!pipe_command(backend_current, 65536)) { pipe_including_tag(backend_current, tag, 0); } return; } assert(imapd_index); if (!config_getswitch(IMAPOPT_CONVERSATIONS)) { prot_printf(imapd_out, ""%s BAD Unrecognized command\r\n"", tag); eatline(imapd_in, ' '); return; } c = getsortcriteria(tag, &sortcrit); if (c == EOF) goto error; if (c != ' ') { prot_printf(imapd_out, ""%s BAD Missing window args in XConvMultiSort\r\n"", tag); goto error; } c = parse_windowargs(tag, &windowargs, /*updates*/0); if (c != ' ') goto error; /* open the conversations state first - we don't care if it fails, * because that probably just means it's already open */ conversations_open_mbox(index_mboxname(imapd_index), &cstate); /* need index loaded to even parse searchargs! */ searchargs = new_searchargs(tag, GETSEARCH_CHARSET_FIRST, &imapd_namespace, imapd_userid, imapd_authstate, imapd_userisadmin || imapd_userisproxyadmin); c = get_search_program(imapd_in, imapd_out, searchargs); if (c == EOF) goto error; if (c == '\r') c = prot_getc(imapd_in); if (c != '\n') { prot_printf(imapd_out, ""%s BAD Unexpected extra arguments to XconvMultiSort\r\n"", tag); goto error; } r = index_convmultisort(imapd_index, sortcrit, searchargs, windowargs); if (r < 0) { prot_printf(imapd_out, ""%s NO %s\r\n"", tag, error_message(r)); goto error; } snprintf(mytime, sizeof(mytime), ""%2.3f"", (clock() - start) / (double) CLOCKS_PER_SEC); if (CONFIG_TIMING_VERBOSE) { char *s = sortcrit_as_string(sortcrit); syslog(LOG_DEBUG, ""XCONVMULTISORT (%s) processing time %s sec"", s, mytime); free(s); } prot_printf(imapd_out, ""%s OK %s (in %s secs)\r\n"", tag, error_message(IMAP_OK_COMPLETED), mytime); out: if (cstate) conversations_commit(&cstate); freesortcrit(sortcrit); freesearchargs(searchargs); free_windowargs(windowargs); return; error: if (cstate) conversations_commit(&cstate); eatline(imapd_in, (c == EOF ? ' ' : c)); goto out; } ",0 "xmlXPtrNewRange(xmlNodePtr start, int startindex, xmlNodePtr end, int endindex) { xmlXPathObjectPtr ret; if (start == NULL) return(NULL); if (end == NULL) return(NULL); if (startindex < 0) return(NULL); if (endindex < 0) return(NULL); ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject)); if (ret == NULL) { xmlXPtrErrMemory(""allocating range""); return(NULL); } memset(ret, 0 , (size_t) sizeof(xmlXPathObject)); ret->type = XPATH_RANGE; ret->user = start; ret->index = startindex; ret->user2 = end; ret->index2 = endindex; xmlXPtrRangeCheckOrder(ret); return(ret); } ",0 "void WebGL2RenderingContextBase::clearBufferuiv( GLenum buffer, GLint drawbuffer, MaybeShared value, GLuint src_offset) { if (isContextLost() || !ValidateClearBuffer(""clearBufferuiv"", buffer, value.View()->length(), src_offset)) return; ContextGL()->ClearBufferuiv(buffer, drawbuffer, value.View()->DataMaybeShared() + src_offset); } ",0 "static inline u32 Maj(u32 x, u32 y, u32 z) { return (x & y) | (z & (x | y)); } ",0 "void BrowserView::ZoomChangedForActiveTab(bool can_show_bubble) { const AppMenuButton* app_menu_button = toolbar_button_provider()->GetAppMenuButton(); bool app_menu_showing = app_menu_button && app_menu_button->IsMenuShowing(); toolbar_button_provider() ->GetPageActionIconContainerView() ->ZoomChangedForActiveTab(can_show_bubble && !app_menu_showing); } ",0 "static inline unsigned int mul(unsigned int a, unsigned int b) { if (a == 0) return 0; if (div_down(UINT_MAX, a) < b) return UINT_MAX; return a * b; } ",0 "get_local_tgt(krb5_context context, const krb5_data *realm, krb5_db_entry *candidate, krb5_db_entry **alias_out, krb5_db_entry **storage_out) { krb5_error_code ret; krb5_principal princ; krb5_db_entry *tgt; *alias_out = NULL; *storage_out = NULL; ret = krb5_build_principal_ext(context, &princ, realm->length, realm->data, KRB5_TGS_NAME_SIZE, KRB5_TGS_NAME, realm->length, realm->data, 0); if (ret) return ret; if (!krb5_principal_compare(context, candidate->princ, princ)) { ret = krb5_db_get_principal(context, princ, 0, &tgt); if (!ret) *storage_out = *alias_out = tgt; } else { *alias_out = candidate; } krb5_free_principal(context, princ); return ret; } ",0 "pcmkRegisterNode(xmlNodePtr node) { xml_private_t *p = NULL; switch(node->type) { case XML_ELEMENT_NODE: case XML_DOCUMENT_NODE: case XML_ATTRIBUTE_NODE: case XML_COMMENT_NODE: p = calloc(1, sizeof(xml_private_t)); p->check = XML_PRIVATE_MAGIC; /* Flags will be reset if necessary when tracking is enabled */ p->flags |= (xpf_dirty|xpf_created); node->_private = p; break; case XML_TEXT_NODE: case XML_DTD_NODE: break; default: /* Ignore */ crm_trace(""Ignoring %p %d"", node, node->type); CRM_LOG_ASSERT(node->type == XML_ELEMENT_NODE); break; } if(p && TRACKING_CHANGES(node)) { /* XML_ELEMENT_NODE doesn't get picked up here, node->doc is * not hooked up at the point we are called */ set_doc_flag(node, xpf_dirty); __xml_node_dirty(node); } } ",0 "vips_foreign_load_gif_get_flags( VipsForeignLoad *load ) { return( VIPS_FOREIGN_SEQUENTIAL ); } ",0 "bool AccessibilityUIElement::isMultiSelectable() const { return checkElementState(m_element, ATK_STATE_MULTISELECTABLE); } ",0 "bool Element::hasAttribute(const AtomicString& localName) const { if (!elementData()) return false; synchronizeAttribute(localName); return elementData()->getAttributeItem(shouldIgnoreAttributeCase(this) ? localName.lower() : localName, false); } ",0 "void start_application(int no_sandbox, FILE *fp) { if (no_sandbox == 0) { env_defaults(); env_apply(); } umask(orig_umask); if (arg_debug) { printf(""starting application\n""); printf(""LD_PRELOAD=%s\n"", getenv(""LD_PRELOAD"")); } if (arg_audit) { assert(arg_audit_prog); if (fp) { fprintf(fp, ""ready\n""); fclose(fp); } #ifdef HAVE_GCOV __gcov_dump(); #endif #ifdef HAVE_SECCOMP seccomp_install_filters(); #endif execl(arg_audit_prog, arg_audit_prog, NULL); perror(""execl""); exit(1); } else if (arg_shell_none) { if (arg_debug) { int i; for (i = cfg.original_program_index; i < cfg.original_argc; i++) { if (cfg.original_argv[i] == NULL) break; printf(""execvp argument %d: %s\n"", i - cfg.original_program_index, cfg.original_argv[i]); } } if (cfg.original_program_index == 0) { fprintf(stderr, ""Error: --shell=none configured, but no program specified\n""); exit(1); } if (!arg_command && !arg_quiet) print_time(); int rv = ok_to_run(cfg.original_argv[cfg.original_program_index]); if (fp) { fprintf(fp, ""ready\n""); fclose(fp); } #ifdef HAVE_GCOV __gcov_dump(); #endif #ifdef HAVE_SECCOMP seccomp_install_filters(); #endif if (rv) execvp(cfg.original_argv[cfg.original_program_index], &cfg.original_argv[cfg.original_program_index]); else fprintf(stderr, ""Error: no suitable %s executable found\n"", cfg.original_argv[cfg.original_program_index]); exit(1); } else { assert(cfg.shell); assert(cfg.command_line); char *arg[5]; int index = 0; arg[index++] = cfg.shell; if (login_shell) { arg[index++] = ""-l""; if (arg_debug) printf(""Starting %s login shell\n"", cfg.shell); } else { arg[index++] = ""-c""; if (arg_debug) printf(""Running %s command through %s\n"", cfg.command_line, cfg.shell); if (arg_doubledash) arg[index++] = ""--""; arg[index++] = cfg.command_line; } arg[index] = NULL; assert(index < 5); if (arg_debug) { char *msg; if (asprintf(&msg, ""sandbox %d, execvp into %s"", sandbox_pid, cfg.command_line) == -1) errExit(""asprintf""); logmsg(msg); free(msg); } if (arg_debug) { int i; for (i = 0; i < 5; i++) { if (arg[i] == NULL) break; printf(""execvp argument %d: %s\n"", i, arg[i]); } } if (!arg_command && !arg_quiet) print_time(); if (fp) { fprintf(fp, ""ready\n""); fclose(fp); } #ifdef HAVE_GCOV __gcov_dump(); #endif #ifdef HAVE_SECCOMP seccomp_install_filters(); #endif execvp(arg[0], arg); } perror(""execvp""); exit(1); // it should never get here!!! } ",0 "int OxideQQuickWebView::loadProgress() const { Q_D(const OxideQQuickWebView); return d->load_progress_; } ",0 "mldv2_query_print(netdissect_options *ndo, const u_char *bp, u_int len) { const struct icmp6_hdr *icp = (const struct icmp6_hdr *) bp; u_int mrc; int mrt, qqi; u_int nsrcs; register u_int i; /* Minimum len is 28 */ if (len < 28) { ND_PRINT((ndo,"" [invalid len %d]"", len)); return; } ND_TCHECK(icp->icmp6_data16[0]); mrc = EXTRACT_16BITS(&icp->icmp6_data16[0]); if (mrc < 32768) { mrt = mrc; } else { mrt = ((mrc & 0x0fff) | 0x1000) << (((mrc & 0x7000) >> 12) + 3); } if (ndo->ndo_vflag) { ND_PRINT((ndo,"" [max resp delay=%d]"", mrt)); } ND_TCHECK2(bp[8], sizeof(struct in6_addr)); ND_PRINT((ndo,"" [gaddr %s"", ip6addr_string(ndo, &bp[8]))); if (ndo->ndo_vflag) { ND_TCHECK(bp[25]); if (bp[24] & 0x08) { ND_PRINT((ndo,"" sflag"")); } if (bp[24] & 0x07) { ND_PRINT((ndo,"" robustness=%d"", bp[24] & 0x07)); } if (bp[25] < 128) { qqi = bp[25]; } else { qqi = ((bp[25] & 0x0f) | 0x10) << (((bp[25] & 0x70) >> 4) + 3); } ND_PRINT((ndo,"" qqi=%d"", qqi)); } ND_TCHECK2(bp[26], 2); nsrcs = EXTRACT_16BITS(&bp[26]); if (nsrcs > 0) { if (len < 28 + nsrcs * sizeof(struct in6_addr)) ND_PRINT((ndo,"" [invalid number of sources]"")); else if (ndo->ndo_vflag > 1) { ND_PRINT((ndo,"" {"")); for (i = 0; i < nsrcs; i++) { ND_TCHECK2(bp[28 + i * sizeof(struct in6_addr)], sizeof(struct in6_addr)); ND_PRINT((ndo,"" %s"", ip6addr_string(ndo, &bp[28 + i * sizeof(struct in6_addr)]))); } ND_PRINT((ndo,"" }"")); } else ND_PRINT((ndo,"", %d source(s)"", nsrcs)); } ND_PRINT((ndo,""]"")); return; trunc: ND_PRINT((ndo,""[|icmp6]"")); return; } ",0 " static int GetCSITransitionType(WebNavigationType nav_type) { switch (nav_type) { case blink::WebNavigationTypeLinkClicked: case blink::WebNavigationTypeFormSubmitted: case blink::WebNavigationTypeFormResubmitted: return kTransitionLink; case blink::WebNavigationTypeBackForward: return kTransitionForwardBack; case blink::WebNavigationTypeReload: return kTransitionReload; case blink::WebNavigationTypeOther: return kTransitionOther; } return kTransitionOther; } ",0 "error::Error GLES2DecoderPassthroughImpl::DoUniform3ui(GLint location, GLuint x, GLuint y, GLuint z) { api()->glUniform3uiFn(location, x, y, z); return error::kNoError; } ",0 "nvmet_fc_transfer_fcp_data(struct nvmet_fc_tgtport *tgtport, struct nvmet_fc_fcp_iod *fod, u8 op) { struct nvmefc_tgt_fcp_req *fcpreq = fod->fcpreq; unsigned long flags; u32 tlen; int ret; fcpreq->op = op; fcpreq->offset = fod->offset; fcpreq->timeout = NVME_FC_TGTOP_TIMEOUT_SEC; tlen = min_t(u32, tgtport->max_sg_cnt * PAGE_SIZE, (fod->total_length - fod->offset)); fcpreq->transfer_length = tlen; fcpreq->transferred_length = 0; fcpreq->fcp_error = 0; fcpreq->rsplen = 0; fcpreq->sg = &fod->data_sg[fod->offset / PAGE_SIZE]; fcpreq->sg_cnt = DIV_ROUND_UP(tlen, PAGE_SIZE); /* * If the last READDATA request: check if LLDD supports * combined xfr with response. */ if ((op == NVMET_FCOP_READDATA) && ((fod->offset + fcpreq->transfer_length) == fod->total_length) && (tgtport->ops->target_features & NVMET_FCTGTFEAT_READDATA_RSP)) { fcpreq->op = NVMET_FCOP_READDATA_RSP; nvmet_fc_prep_fcp_rsp(tgtport, fod); } ret = tgtport->ops->fcp_op(&tgtport->fc_target_port, fod->fcpreq); if (ret) { /* * should be ok to set w/o lock as its in the thread of * execution (not an async timer routine) and doesn't * contend with any clearing action */ fod->abort = true; if (op == NVMET_FCOP_WRITEDATA) { spin_lock_irqsave(&fod->flock, flags); fod->writedataactive = false; spin_unlock_irqrestore(&fod->flock, flags); nvmet_req_complete(&fod->req, NVME_SC_INTERNAL); } else /* NVMET_FCOP_READDATA or NVMET_FCOP_READDATA_RSP */ { fcpreq->fcp_error = ret; fcpreq->transferred_length = 0; nvmet_fc_xmt_fcp_op_done(fod->fcpreq); } } } ",0 "static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu) { u32 intr_info = vmcs_read32(VM_EXIT_INTR_INFO); struct vcpu_vmx *vmx = to_vmx(vcpu); struct vmcs12 *vmcs12 = get_vmcs12(vcpu); u32 exit_reason = vmx->exit_reason; trace_kvm_nested_vmexit(kvm_rip_read(vcpu), exit_reason, vmcs_readl(EXIT_QUALIFICATION), vmx->idt_vectoring_info, intr_info, vmcs_read32(VM_EXIT_INTR_ERROR_CODE), KVM_ISA_VMX); if (vmx->nested.nested_run_pending) return 0; if (unlikely(vmx->fail)) { pr_info_ratelimited(""%s failed vm entry %x\n"", __func__, vmcs_read32(VM_INSTRUCTION_ERROR)); return 1; } switch (exit_reason) { case EXIT_REASON_EXCEPTION_NMI: if (!is_exception(intr_info)) return 0; else if (is_page_fault(intr_info)) return enable_ept; else if (is_no_device(intr_info) && !(vmcs12->guest_cr0 & X86_CR0_TS)) return 0; return vmcs12->exception_bitmap & (1u << (intr_info & INTR_INFO_VECTOR_MASK)); case EXIT_REASON_EXTERNAL_INTERRUPT: return 0; case EXIT_REASON_TRIPLE_FAULT: return 1; case EXIT_REASON_PENDING_INTERRUPT: return nested_cpu_has(vmcs12, CPU_BASED_VIRTUAL_INTR_PENDING); case EXIT_REASON_NMI_WINDOW: return nested_cpu_has(vmcs12, CPU_BASED_VIRTUAL_NMI_PENDING); case EXIT_REASON_TASK_SWITCH: return 1; case EXIT_REASON_CPUID: if (kvm_register_read(vcpu, VCPU_REGS_RAX) == 0xa) return 0; return 1; case EXIT_REASON_HLT: return nested_cpu_has(vmcs12, CPU_BASED_HLT_EXITING); case EXIT_REASON_INVD: return 1; case EXIT_REASON_INVLPG: return nested_cpu_has(vmcs12, CPU_BASED_INVLPG_EXITING); case EXIT_REASON_RDPMC: return nested_cpu_has(vmcs12, CPU_BASED_RDPMC_EXITING); case EXIT_REASON_RDTSC: return nested_cpu_has(vmcs12, CPU_BASED_RDTSC_EXITING); case EXIT_REASON_VMCALL: case EXIT_REASON_VMCLEAR: case EXIT_REASON_VMLAUNCH: case EXIT_REASON_VMPTRLD: case EXIT_REASON_VMPTRST: case EXIT_REASON_VMREAD: case EXIT_REASON_VMRESUME: case EXIT_REASON_VMWRITE: case EXIT_REASON_VMOFF: case EXIT_REASON_VMON: case EXIT_REASON_INVEPT: /* * VMX instructions trap unconditionally. This allows L1 to * emulate them for its L2 guest, i.e., allows 3-level nesting! */ return 1; case EXIT_REASON_CR_ACCESS: return nested_vmx_exit_handled_cr(vcpu, vmcs12); case EXIT_REASON_DR_ACCESS: return nested_cpu_has(vmcs12, CPU_BASED_MOV_DR_EXITING); case EXIT_REASON_IO_INSTRUCTION: return nested_vmx_exit_handled_io(vcpu, vmcs12); case EXIT_REASON_MSR_READ: case EXIT_REASON_MSR_WRITE: return nested_vmx_exit_handled_msr(vcpu, vmcs12, exit_reason); case EXIT_REASON_INVALID_STATE: return 1; case EXIT_REASON_MWAIT_INSTRUCTION: return nested_cpu_has(vmcs12, CPU_BASED_MWAIT_EXITING); case EXIT_REASON_MONITOR_INSTRUCTION: return nested_cpu_has(vmcs12, CPU_BASED_MONITOR_EXITING); case EXIT_REASON_PAUSE_INSTRUCTION: return nested_cpu_has(vmcs12, CPU_BASED_PAUSE_EXITING) || nested_cpu_has2(vmcs12, SECONDARY_EXEC_PAUSE_LOOP_EXITING); case EXIT_REASON_MCE_DURING_VMENTRY: return 0; case EXIT_REASON_TPR_BELOW_THRESHOLD: return nested_cpu_has(vmcs12, CPU_BASED_TPR_SHADOW); case EXIT_REASON_APIC_ACCESS: return nested_cpu_has2(vmcs12, SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES); case EXIT_REASON_EPT_VIOLATION: /* * L0 always deals with the EPT violation. If nested EPT is * used, and the nested mmu code discovers that the address is * missing in the guest EPT table (EPT12), the EPT violation * will be injected with nested_ept_inject_page_fault() */ return 0; case EXIT_REASON_EPT_MISCONFIG: /* * L2 never uses directly L1's EPT, but rather L0's own EPT * table (shadow on EPT) or a merged EPT table that L0 built * (EPT on EPT). So any problems with the structure of the * table is L0's fault. */ return 0; case EXIT_REASON_WBINVD: return nested_cpu_has2(vmcs12, SECONDARY_EXEC_WBINVD_EXITING); case EXIT_REASON_XSETBV: return 1; default: return 1; } } ",0 "bool RenderView::RendererAccessibilityNotification::ShouldIncludeChildren() { typedef ViewHostMsg_AccessibilityNotification_Params params; if (type == WebKit::WebAccessibilityNotificationChildrenChanged || type == WebKit::WebAccessibilityNotificationLoadComplete) { return true; } return false; } ",0 "wb_id(netdissect_options *ndo, const struct pkt_id *id, u_int len) { int i; const char *cp; const struct id_off *io; char c; int nid; ND_PRINT((ndo, "" wb-id:"")); if (len < sizeof(*id) || !ND_TTEST(*id)) return (-1); len -= sizeof(*id); ND_PRINT((ndo, "" %u/%s:%u (max %u/%s:%u) "", EXTRACT_32BITS(&id->pi_ps.slot), ipaddr_string(ndo, &id->pi_ps.page.p_sid), EXTRACT_32BITS(&id->pi_ps.page.p_uid), EXTRACT_32BITS(&id->pi_mslot), ipaddr_string(ndo, &id->pi_mpage.p_sid), EXTRACT_32BITS(&id->pi_mpage.p_uid))); nid = EXTRACT_16BITS(&id->pi_ps.nid); len -= sizeof(*io) * nid; io = (struct id_off *)(id + 1); cp = (char *)(io + nid); if (!ND_TTEST2(cp, len)) { ND_PRINT((ndo, ""\"""")); fn_print(ndo, (u_char *)cp, (u_char *)cp + len); ND_PRINT((ndo, ""\"""")); } c = '<'; for (i = 0; i < nid && ND_TTEST(*io); ++io, ++i) { ND_PRINT((ndo, ""%c%s:%u"", c, ipaddr_string(ndo, &io->id), EXTRACT_32BITS(&io->off))); c = ','; } if (i >= nid) { ND_PRINT((ndo, "">"")); return (0); } return (-1); } ",1 "e1000e_phy_reg_write(E1000ECore *core, uint8_t page, uint32_t addr, uint16_t data) { assert(page < E1000E_PHY_PAGES); assert(addr < E1000E_PHY_PAGE_SIZE); if (e1000e_phyreg_writeops[page][addr]) { e1000e_phyreg_writeops[page][addr](core, addr, data); } else { core->phy[page][addr] = data; } } ",0 "struct kvm_vcpu *kvm_arm_get_running_vcpu(void) { BUG_ON(preemptible()); return __get_cpu_var(kvm_arm_running_vcpu); } ",0 "static MagickBooleanType WritePCDTile(Image *image,const char *page_geometry, const char *tile_geometry) { GeometryInfo geometry_info; Image *downsample_image, *tile_image; MagickBooleanType status; MagickStatusType flags; RectangleInfo geometry; register const PixelPacket *p, *q; register ssize_t i, x; ssize_t y; /* Scale image to tile size. */ SetGeometry(image,&geometry); (void) ParseMetaGeometry(page_geometry,&geometry.x,&geometry.y, &geometry.width,&geometry.height); if ((geometry.width % 2) != 0) geometry.width--; if ((geometry.height % 2) != 0) geometry.height--; tile_image=ResizeImage(image,geometry.width,geometry.height,TriangleFilter, 1.0,&image->exception); if (tile_image == (Image *) NULL) return(MagickFalse); flags=ParseGeometry(page_geometry,&geometry_info); geometry.width=(size_t) geometry_info.rho; geometry.height=(size_t) geometry_info.sigma; if ((flags & SigmaValue) == 0) geometry.height=geometry.width; if ((tile_image->columns != geometry.width) || (tile_image->rows != geometry.height)) { Image *bordered_image; RectangleInfo border_info; /* Put a border around the image. */ border_info.width=(geometry.width-tile_image->columns+1) >> 1; border_info.height=(geometry.height-tile_image->rows+1) >> 1; bordered_image=BorderImage(tile_image,&border_info,&image->exception); if (bordered_image == (Image *) NULL) return(MagickFalse); tile_image=DestroyImage(tile_image); tile_image=bordered_image; } (void) TransformImage(&tile_image,(char *) NULL,tile_geometry); (void) TransformImageColorspace(tile_image,YCCColorspace); downsample_image=ResizeImage(tile_image,tile_image->columns/2, tile_image->rows/2,TriangleFilter,1.0,&image->exception); if (downsample_image == (Image *) NULL) return(MagickFalse); /* Write tile to PCD file. */ for (y=0; y < (ssize_t) tile_image->rows; y+=2) { p=GetVirtualPixels(tile_image,0,y,tile_image->columns,2, &tile_image->exception); if (p == (const PixelPacket *) NULL) break; for (x=0; x < (ssize_t) (tile_image->columns << 1); x++) { (void) WriteBlobByte(image,ScaleQuantumToChar(GetPixelRed(p))); p++; } q=GetVirtualPixels(downsample_image,0,y >> 1,downsample_image->columns, 1,&downsample_image->exception); if (q == (const PixelPacket *) NULL) break; for (x=0; x < (ssize_t) downsample_image->columns; x++) { (void) WriteBlobByte(image,ScaleQuantumToChar(GetPixelGreen(q))); q++; } q=GetVirtualPixels(downsample_image,0,y >> 1,downsample_image->columns, 1,&downsample_image->exception); if (q == (const PixelPacket *) NULL) break; for (x=0; x < (ssize_t) downsample_image->columns; x++) { (void) WriteBlobByte(image,ScaleQuantumToChar(GetPixelBlue(q))); q++; } status=SetImageProgress(image,SaveImageTag,y,tile_image->rows); if (status == MagickFalse) break; } for (i=0; i < 0x800; i++) (void) WriteBlobByte(image,'\0'); downsample_image=DestroyImage(downsample_image); tile_image=DestroyImage(tile_image); return(MagickTrue); } ",0 "int key_instantiate_and_link(struct key *key, const void *data, size_t datalen, struct key *keyring, struct key *authkey) { struct key_preparsed_payload prep; struct assoc_array_edit *edit; int ret; memset(&prep, 0, sizeof(prep)); prep.data = data; prep.datalen = datalen; prep.quotalen = key->type->def_datalen; prep.expiry = TIME_T_MAX; if (key->type->preparse) { ret = key->type->preparse(&prep); if (ret < 0) goto error; } if (keyring) { if (keyring->restrict_link) { ret = keyring->restrict_link(keyring, key->type, &prep.payload); if (ret < 0) goto error; } ret = __key_link_begin(keyring, &key->index_key, &edit); if (ret < 0) goto error; } ret = __key_instantiate_and_link(key, &prep, keyring, authkey, &edit); if (keyring) __key_link_end(keyring, &key->index_key, edit); error: if (key->type->preparse) key->type->free_preparse(&prep); return ret; } ",0 "static int dotl_to_open_flags(int flags) { int i; /* * We have same bits for P9_DOTL_READONLY, P9_DOTL_WRONLY * and P9_DOTL_NOACCESS */ int oflags = flags & O_ACCMODE; DotlOpenflagMap dotl_oflag_map[] = { { P9_DOTL_CREATE, O_CREAT }, { P9_DOTL_EXCL, O_EXCL }, { P9_DOTL_NOCTTY , O_NOCTTY }, { P9_DOTL_TRUNC, O_TRUNC }, { P9_DOTL_APPEND, O_APPEND }, { P9_DOTL_NONBLOCK, O_NONBLOCK } , { P9_DOTL_DSYNC, O_DSYNC }, { P9_DOTL_FASYNC, FASYNC }, { P9_DOTL_DIRECT, O_DIRECT }, { P9_DOTL_LARGEFILE, O_LARGEFILE }, { P9_DOTL_DIRECTORY, O_DIRECTORY }, { P9_DOTL_NOFOLLOW, O_NOFOLLOW }, { P9_DOTL_NOATIME, O_NOATIME }, { P9_DOTL_SYNC, O_SYNC }, }; for (i = 0; i < ARRAY_SIZE(dotl_oflag_map); i++) { if (flags & dotl_oflag_map[i].dotl_flag) { oflags |= dotl_oflag_map[i].open_flag; } } return oflags; } ",0 "void usb_enable_lpm(struct usb_device *udev) { struct usb_hcd *hcd; struct usb_hub *hub; struct usb_port *port_dev; if (!udev || !udev->parent || udev->speed < USB_SPEED_SUPER || !udev->lpm_capable || udev->state < USB_STATE_DEFAULT) return; udev->lpm_disable_count--; hcd = bus_to_hcd(udev->bus); /* Double check that we can both enable and disable LPM. * Device must be configured to accept set feature U1/U2 timeout. */ if (!hcd || !hcd->driver->enable_usb3_lpm_timeout || !hcd->driver->disable_usb3_lpm_timeout) return; if (udev->lpm_disable_count > 0) return; hub = usb_hub_to_struct_hub(udev->parent); if (!hub) return; port_dev = hub->ports[udev->portnum - 1]; if (port_dev->usb3_lpm_u1_permit) usb_enable_link_state(hcd, udev, USB3_LPM_U1); if (port_dev->usb3_lpm_u2_permit) usb_enable_link_state(hcd, udev, USB3_LPM_U2); } ",0 "static void check_stack_usage(void) { static DEFINE_SPINLOCK(low_water_lock); static int lowest_to_date = THREAD_SIZE; unsigned long free; free = stack_not_used(current); if (free >= lowest_to_date) return; spin_lock(&low_water_lock); if (free < lowest_to_date) { printk(KERN_WARNING ""%s used greatest stack depth: %lu bytes "" ""left\n"", current->comm, free); lowest_to_date = free; } spin_unlock(&low_water_lock); } ",0 "static void print_fatal_signal(int signr) { struct pt_regs *regs = signal_pt_regs(); pr_info(""potentially unexpected fatal signal %d.\n"", signr); #if defined(__i386__) && !defined(__arch_um__) pr_info(""code at %08lx: "", regs->ip); { int i; for (i = 0; i < 16; i++) { unsigned char insn; if (get_user(insn, (unsigned char *)(regs->ip + i))) break; pr_cont(""%02x "", insn); } } pr_cont(""\n""); #endif preempt_disable(); show_regs(regs); preempt_enable(); } ",0 "static int hash_sendmsg(struct kiocb *unused, struct socket *sock, struct msghdr *msg, size_t ignored) { int limit = ALG_MAX_PAGES * PAGE_SIZE; struct sock *sk = sock->sk; struct alg_sock *ask = alg_sk(sk); struct hash_ctx *ctx = ask->private; unsigned long iovlen; struct iovec *iov; long copied = 0; int err; if (limit > sk->sk_sndbuf) limit = sk->sk_sndbuf; lock_sock(sk); if (!ctx->more) { err = crypto_ahash_init(&ctx->req); if (err) goto unlock; } ctx->more = 0; for (iov = msg->msg_iov, iovlen = msg->msg_iovlen; iovlen > 0; iovlen--, iov++) { unsigned long seglen = iov->iov_len; char __user *from = iov->iov_base; while (seglen) { int len = min_t(unsigned long, seglen, limit); int newlen; newlen = af_alg_make_sg(&ctx->sgl, from, len, 0); if (newlen < 0) { err = copied ? 0 : newlen; goto unlock; } ahash_request_set_crypt(&ctx->req, ctx->sgl.sg, NULL, newlen); err = af_alg_wait_for_completion( crypto_ahash_update(&ctx->req), &ctx->completion); af_alg_free_sg(&ctx->sgl); if (err) goto unlock; seglen -= newlen; from += newlen; copied += newlen; } } err = 0; ctx->more = msg->msg_flags & MSG_MORE; if (!ctx->more) { ahash_request_set_crypt(&ctx->req, NULL, ctx->result, 0); err = af_alg_wait_for_completion(crypto_ahash_final(&ctx->req), &ctx->completion); } unlock: release_sock(sk); return err ?: copied; } ",0 "SYSCALL_DEFINE1(times, struct tms __user *, tbuf) { if (tbuf) { struct tms tmp; do_sys_times(&tmp); if (copy_to_user(tbuf, &tmp, sizeof(struct tms))) return -EFAULT; } force_successful_syscall_return(); return (long) jiffies_64_to_clock_t(get_jiffies_64()); } ",0 "const Shelf* ScrollableShelfView::GetShelf() const { return shelf_view_->shelf(); } ",0 "int FixedLengthEncoder::getChar() { if (length >= 0 && count >= length) return EOF; ++count; return str->getChar(); } ",0 "void GLES2DecoderImpl::RestoreState(const ContextState* prev_state) { TRACE_EVENT1(""gpu"", ""GLES2DecoderImpl::RestoreState"", ""context"", logger_.GetLogPrefix()); RestoreFramebufferBindings(); state_.RestoreState(prev_state); } ",0 "static unsigned int caif_poll(struct file *file, struct socket *sock, poll_table *wait) { struct sock *sk = sock->sk; unsigned int mask; struct caifsock *cf_sk = container_of(sk, struct caifsock, sk); sock_poll_wait(file, sk_sleep(sk), wait); mask = 0; /* exceptional events? */ if (sk->sk_err) mask |= POLLERR; if (sk->sk_shutdown == SHUTDOWN_MASK) mask |= POLLHUP; if (sk->sk_shutdown & RCV_SHUTDOWN) mask |= POLLRDHUP; /* readable? */ if (!skb_queue_empty(&sk->sk_receive_queue) || (sk->sk_shutdown & RCV_SHUTDOWN)) mask |= POLLIN | POLLRDNORM; /* * we set writable also when the other side has shut down the * connection. This prevents stuck sockets. */ if (sock_writeable(sk) && tx_flow_is_on(cf_sk)) mask |= POLLOUT | POLLWRNORM | POLLWRBAND; return mask; } ",0 "static int vmx_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) { unsigned long hw_cr4 = cr4 | (to_vmx(vcpu)->rmode.vm86_active ? KVM_RMODE_VM_CR4_ALWAYS_ON : KVM_PMODE_VM_CR4_ALWAYS_ON); if (cr4 & X86_CR4_VMXE) { /* * To use VMXON (and later other VMX instructions), a guest * must first be able to turn on cr4.VMXE (see handle_vmon()). * So basically the check on whether to allow nested VMX * is here. */ if (!nested_vmx_allowed(vcpu)) return 1; } if (to_vmx(vcpu)->nested.vmxon && ((cr4 & VMXON_CR4_ALWAYSON) != VMXON_CR4_ALWAYSON)) return 1; vcpu->arch.cr4 = cr4; if (enable_ept) { if (!is_paging(vcpu)) { hw_cr4 &= ~X86_CR4_PAE; hw_cr4 |= X86_CR4_PSE; /* * SMEP/SMAP is disabled if CPU is in non-paging mode * in hardware. However KVM always uses paging mode to * emulate guest non-paging mode with TDP. * To emulate this behavior, SMEP/SMAP needs to be * manually disabled when guest switches to non-paging * mode. */ hw_cr4 &= ~(X86_CR4_SMEP | X86_CR4_SMAP); } else if (!(cr4 & X86_CR4_PAE)) { hw_cr4 &= ~X86_CR4_PAE; } } vmcs_writel(CR4_READ_SHADOW, cr4); vmcs_writel(GUEST_CR4, hw_cr4); return 0; } ",0 "static void sysbus_esp_gpio_demux(void *opaque, int irq, int level) { SysBusESPState *sysbus = ESP(opaque); ESPState *s = &sysbus->esp; switch (irq) { case 0: parent_esp_reset(s, irq, level); break; case 1: esp_dma_enable(opaque, irq, level); break; } } ",0 "nfs4_atomic_open(struct inode *dir, struct nfs_open_context *ctx, int open_flags, struct iattr *attr) { struct nfs4_state *state; /* Protect against concurrent sillydeletes */ state = nfs4_do_open(dir, ctx->dentry, ctx->mode, open_flags, attr, ctx->cred); if (IS_ERR(state)) return ERR_CAST(state); ctx->state = state; return igrab(state->inode); } ",0 "static inline void perf_cgroup_sched_in(struct task_struct *prev, struct task_struct *task) { struct perf_cgroup *cgrp1; struct perf_cgroup *cgrp2 = NULL; rcu_read_lock(); /* * we come here when we know perf_cgroup_events > 0 * we do not need to pass the ctx here because we know * we are holding the rcu lock */ cgrp1 = perf_cgroup_from_task(task, NULL); /* prev can never be NULL */ cgrp2 = perf_cgroup_from_task(prev, NULL); /* * only need to schedule in cgroup events if we are changing * cgroup during ctxsw. Cgroup events were not scheduled * out of ctxsw out if that was not the case. */ if (cgrp1 != cgrp2) perf_cgroup_switch(task, PERF_CGROUP_SWIN); rcu_read_unlock(); } ",0 "static int mounts_open_common(struct inode *inode, struct file *file, const struct seq_operations *op) { struct task_struct *task = get_proc_task(inode); struct nsproxy *nsp; struct mnt_namespace *ns = NULL; struct path root; struct proc_mounts *p; int ret = -EINVAL; if (task) { rcu_read_lock(); nsp = task_nsproxy(task); if (nsp) { ns = nsp->mnt_ns; if (ns) get_mnt_ns(ns); } rcu_read_unlock(); if (ns && get_fs_path(task, &root, 1) == 0) ret = 0; put_task_struct(task); } if (!ns) goto err; if (ret) goto err_put_ns; ret = -ENOMEM; p = kmalloc(sizeof(struct proc_mounts), GFP_KERNEL); if (!p) goto err_put_path; file->private_data = &p->m; ret = seq_open(file, op); if (ret) goto err_free; p->m.private = p; p->ns = ns; p->root = root; p->event = ns->event; return 0; err_free: kfree(p); err_put_path: path_put(&root); err_put_ns: put_mnt_ns(ns); err: return ret; } ",0 "gfx::NativeWindow RenderWidgetHostViewAura::GetAttachedWindow() const { return window_; } ",0 "void QQuickWebViewPrivate::loadDidFail(const QtWebError& error) { Q_Q(QQuickWebView); ASSERT(!q->loading()); QWebLoadRequest loadRequest(error.url(), QQuickWebView::LoadFailedStatus, error.description(), static_cast(error.type()), error.errorCode()); emit q->loadingChanged(&loadRequest); } ",0 "ZEND_API void *zend_object_store_get_object(const zval *zobject TSRMLS_DC) { zend_object_handle handle = Z_OBJ_HANDLE_P(zobject); return EG(objects_store).object_buckets[handle].bucket.obj.object; } ",0 "js_grisu2(double v, char *buffer, int *K) { int length, mk; diy_fp_t w_m, w_p, c_mk, Wp, Wm, delta; int q = 64, alpha = -59, gamma = -56; normalized_boundaries(v, &w_m, &w_p); mk = k_comp(w_p.e + q, alpha, gamma); c_mk = cached_power(mk); Wp = multiply(w_p, c_mk); Wm = multiply(w_m, c_mk); Wm.f++; Wp.f--; delta = minus(Wp, Wm); *K = -mk; digit_gen(Wp, delta, buffer, &length, K); return length; } ",0 "void HTMLMediaElement::mediaEngineError(MediaError* err) { DCHECK_GE(m_readyState, kHaveMetadata); BLINK_MEDIA_LOG << ""mediaEngineError("" << (void*)this << "", "" << static_cast(err->code()) << "")""; stopPeriodicTimers(); m_loadState = WaitingForSource; m_error = err; scheduleEvent(EventTypeNames::error); setNetworkState(kNetworkIdle); setShouldDelayLoadEvent(false); m_currentSourceNode = nullptr; } ",0 "xdr_chrand_ret(XDR *xdrs, chrand_ret *objp) { if (!xdr_ui_4(xdrs, &objp->api_version)) { return (FALSE); } if (!xdr_kadm5_ret_t(xdrs, &objp->code)) { return (FALSE); } if (objp->code == KADM5_OK) { if (!xdr_array(xdrs, (char **)&objp->keys, (unsigned int *)&objp->n_keys, ~0, sizeof(krb5_keyblock), xdr_krb5_keyblock)) return FALSE; } return (TRUE); } ",0 "static void init_reap_node(int cpu) { per_cpu(slab_reap_node, cpu) = next_node_in(cpu_to_mem(cpu), node_online_map); } ",0 "AddPortMapping(struct upnphttp * h, const char * action, const char * ns) { int r; /*static const char resp[] = """";*/ static const char resp[] = """"; char body[512]; int bodylen; struct NameValueParserData data; char * int_ip, * int_port, * ext_port, * protocol, * desc; char * leaseduration_str; unsigned int leaseduration; char * r_host; unsigned short iport, eport; struct hostent *hp; /* getbyhostname() */ char ** ptr; /* getbyhostname() */ struct in_addr result_ip;/*unsigned char result_ip[16];*/ /* inet_pton() */ ParseNameValue(h->req_buf + h->req_contentoff, h->req_contentlen, &data); int_ip = GetValueFromNameValueList(&data, ""NewInternalClient""); if (int_ip) { /* trim */ while(int_ip[0] == ' ') int_ip++; } #ifdef UPNP_STRICT if (!int_ip || int_ip[0] == '\0') { ClearNameValueList(&data); SoapError(h, 402, ""Invalid Args""); return; } #endif /* IGD 2 MUST support both wildcard and specific IP address values * for RemoteHost (only the wildcard value was REQUIRED in release 1.0) */ r_host = GetValueFromNameValueList(&data, ""NewRemoteHost""); #ifndef SUPPORT_REMOTEHOST #ifdef UPNP_STRICT if (r_host && (r_host[0] != '\0') && (0 != strcmp(r_host, ""*""))) { ClearNameValueList(&data); SoapError(h, 726, ""RemoteHostOnlySupportsWildcard""); return; } #endif #endif #ifndef UPNP_STRICT /* if arg is empty, use client address * see https://github.com/miniupnp/miniupnp/issues/236 */ if (!int_ip || int_ip[0] == '\0') { int_ip = h->clientaddr_str; memcpy(&result_ip, &(h->clientaddr), sizeof(struct in_addr)); } else #endif /* if ip not valid assume hostname and convert */ if (inet_pton(AF_INET, int_ip, &result_ip) <= 0) { hp = gethostbyname(int_ip); if(hp && hp->h_addrtype == AF_INET) { for(ptr = hp->h_addr_list; ptr && *ptr; ptr++) { int_ip = inet_ntoa(*((struct in_addr *) *ptr)); result_ip = *((struct in_addr *) *ptr); /* TODO : deal with more than one ip per hostname */ break; } } else { syslog(LOG_ERR, ""Failed to convert hostname '%s' to ip address"", int_ip); ClearNameValueList(&data); SoapError(h, 402, ""Invalid Args""); return; } } /* check if NewInternalAddress is the client address */ if(GETFLAG(SECUREMODEMASK)) { if(h->clientaddr.s_addr != result_ip.s_addr) { syslog(LOG_INFO, ""Client %s tried to redirect port to %s"", inet_ntoa(h->clientaddr), int_ip); ClearNameValueList(&data); SoapError(h, 718, ""ConflictInMappingEntry""); return; } } int_port = GetValueFromNameValueList(&data, ""NewInternalPort""); ext_port = GetValueFromNameValueList(&data, ""NewExternalPort""); protocol = GetValueFromNameValueList(&data, ""NewProtocol""); desc = GetValueFromNameValueList(&data, ""NewPortMappingDescription""); leaseduration_str = GetValueFromNameValueList(&data, ""NewLeaseDuration""); if (!int_port || !ext_port || !protocol) { ClearNameValueList(&data); SoapError(h, 402, ""Invalid Args""); return; } eport = (unsigned short)atoi(ext_port); iport = (unsigned short)atoi(int_port); if (strcmp(ext_port, ""*"") == 0 || eport == 0) { ClearNameValueList(&data); SoapError(h, 716, ""Wildcard not permited in ExtPort""); return; } leaseduration = leaseduration_str ? atoi(leaseduration_str) : 0; #ifdef IGD_V2 /* PortMappingLeaseDuration can be either a value between 1 and * 604800 seconds or the zero value (for infinite lease time). * Note that an infinite lease time can be only set by out-of-band * mechanisms like WWW-administration, remote management or local * management. * If a control point uses the value 0 to indicate an infinite lease * time mapping, it is REQUIRED that gateway uses the maximum value * instead (e.g. 604800 seconds) */ if(leaseduration == 0 || leaseduration > 604800) leaseduration = 604800; #endif syslog(LOG_INFO, ""%s: ext port %hu to %s:%hu protocol %s for: %s leaseduration=%u rhost=%s"", action, eport, int_ip, iport, protocol, desc, leaseduration, r_host ? r_host : ""NULL""); r = upnp_redirect(r_host, eport, int_ip, iport, protocol, desc, leaseduration); ClearNameValueList(&data); /* possible error codes for AddPortMapping : * 402 - Invalid Args * 501 - Action Failed * 715 - Wildcard not permited in SrcAddr * 716 - Wildcard not permited in ExtPort * 718 - ConflictInMappingEntry * 724 - SamePortValuesRequired (deprecated in IGD v2) * 725 - OnlyPermanentLeasesSupported The NAT implementation only supports permanent lease times on port mappings (deprecated in IGD v2) * 726 - RemoteHostOnlySupportsWildcard RemoteHost must be a wildcard and cannot be a specific IP address or DNS name (deprecated in IGD v2) * 727 - ExternalPortOnlySupportsWildcard ExternalPort must be a wildcard and cannot be a specific port value (deprecated in IGD v2) * 728 - NoPortMapsAvailable There are not enough free ports available to complete the mapping (added in IGD v2) * 729 - ConflictWithOtherMechanisms (added in IGD v2) */ switch(r) { case 0: /* success */ bodylen = snprintf(body, sizeof(body), resp, action, ns/*SERVICE_TYPE_WANIPC*/); BuildSendAndCloseSoapResp(h, body, bodylen); break; case -4: #ifdef IGD_V2 SoapError(h, 729, ""ConflictWithOtherMechanisms""); break; #endif /* IGD_V2 */ case -2: /* already redirected */ case -3: /* not permitted */ SoapError(h, 718, ""ConflictInMappingEntry""); break; default: SoapError(h, 501, ""ActionFailed""); } } ",0 "int Element::offsetHeight() { document()->updateLayoutIgnorePendingStylesheets(); if (RenderBoxModelObject* renderer = renderBoxModelObject()) return adjustLayoutUnitForAbsoluteZoom(renderer->pixelSnappedOffsetHeight(), renderer).round(); return 0; } ",0 " ContentBrowserClient::GetCryptoPasswordDelegate(const GURL& url) { return NULL; } ",0 " void RegisterDomDistillerViewerSource(Profile* profile) { const base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess(); if (command_line.HasSwitch(switches::kEnableDomDistiller)) { dom_distiller::DomDistillerServiceFactory* dom_distiller_service_factory = dom_distiller::DomDistillerServiceFactory::GetInstance(); dom_distiller::LazyDomDistillerService* lazy_service = new dom_distiller::LazyDomDistillerService( profile, dom_distiller_service_factory); scoped_ptr reporter; #if defined(OS_ANDROID) reporter.reset( new dom_distiller::android::ExternalFeedbackReporterAndroid()); #endif // defined(OS_ANDROID) if (!dom_distiller::DistillerJavaScriptWorldIdIsSet()) { dom_distiller::SetDistillerJavaScriptWorldId( chrome::ISOLATED_WORLD_ID_CHROME_INTERNAL); } content::URLDataSource::Add( profile, new dom_distiller::DomDistillerViewerSource( lazy_service, dom_distiller::kDomDistillerScheme, reporter.Pass())); } } ",1 "SYSCALL_DEFINE5(linkat, int, olddfd, const char __user *, oldname, int, newdfd, const char __user *, newname, int, flags) { struct dentry *new_dentry; struct path old_path, new_path; struct inode *delegated_inode = NULL; int how = 0; int error; if ((flags & ~(AT_SYMLINK_FOLLOW | AT_EMPTY_PATH)) != 0) return -EINVAL; /* * To use null names we require CAP_DAC_READ_SEARCH * This ensures that not everyone will be able to create * handlink using the passed filedescriptor. */ if (flags & AT_EMPTY_PATH) { if (!capable(CAP_DAC_READ_SEARCH)) return -ENOENT; how = LOOKUP_EMPTY; } if (flags & AT_SYMLINK_FOLLOW) how |= LOOKUP_FOLLOW; retry: error = user_path_at(olddfd, oldname, how, &old_path); if (error) return error; new_dentry = user_path_create(newdfd, newname, &new_path, (how & LOOKUP_REVAL)); error = PTR_ERR(new_dentry); if (IS_ERR(new_dentry)) goto out; error = -EXDEV; if (old_path.mnt != new_path.mnt) goto out_dput; error = may_linkat(&old_path); if (unlikely(error)) goto out_dput; error = security_path_link(old_path.dentry, &new_path, new_dentry); if (error) goto out_dput; error = vfs_link(old_path.dentry, new_path.dentry->d_inode, new_dentry, &delegated_inode); out_dput: done_path_create(&new_path, new_dentry); if (delegated_inode) { error = break_deleg_wait(&delegated_inode); if (!error) { path_put(&old_path); goto retry; } } if (retry_estale(error, how)) { path_put(&old_path); how |= LOOKUP_REVAL; goto retry; } out: path_put(&old_path); return error; } ",0 "bool DesktopWindowTreeHostX11::CanDispatchEvent( const ui::PlatformEvent& event) { return event->xany.window == xwindow_ || (event->type == GenericEvent && static_cast(event->xcookie.data)->event == xwindow_); } ",0 "static void free_server_handle(kadm5_server_handle_t handle) { if (!handle) return; krb5_free_principal(handle->context, handle->current_caller); free(handle); } ",0 "void CL_SetRecommended_f( void ) { if ( Cmd_Argc() > 1 ) { Com_SetRecommended( qtrue ); } else { Com_SetRecommended( qfalse ); } } ",0 "static int parse_audio_processing_unit(struct mixer_build *state, int unitid, void *raw_desc) { return build_audio_procunit(state, unitid, raw_desc, procunits, ""Processing Unit""); } ",0 "error::Error GLES2DecoderImpl::HandleGetUniformfv( uint32 immediate_data_size, const gles2::GetUniformfv& c) { GLuint program = c.program; GLint fake_location = c.location; GLuint service_id; GLint real_location = -1; Error error; typedef gles2::GetUniformfv::Result Result; Result* result; GLenum result_type; if (GetUniformSetup( program, fake_location, c.params_shm_id, c.params_shm_offset, &error, &real_location, &service_id, reinterpret_cast(&result), &result_type)) { if (result_type == GL_BOOL || result_type == GL_BOOL_VEC2 || result_type == GL_BOOL_VEC3 || result_type == GL_BOOL_VEC4) { GLsizei num_values = result->GetNumResults(); scoped_array temp(new GLint[num_values]); glGetUniformiv(service_id, real_location, temp.get()); GLfloat* dst = result->GetData(); for (GLsizei ii = 0; ii < num_values; ++ii) { dst[ii] = (temp[ii] != 0); } } else { glGetUniformfv(service_id, real_location, result->GetData()); } } return error; } ",0 "static int tga_readheader(FILE *fp, unsigned int *bits_per_pixel, unsigned int *width, unsigned int *height, int *flip_image) { int palette_size; unsigned char tga[TGA_HEADER_SIZE]; unsigned char id_len, /*cmap_type,*/ image_type; unsigned char pixel_depth, image_desc; unsigned short /*cmap_index,*/ cmap_len, cmap_entry_size; unsigned short /*x_origin, y_origin,*/ image_w, image_h; if (!bits_per_pixel || !width || !height || !flip_image) { return 0; } if (fread(tga, TGA_HEADER_SIZE, 1, fp) != 1) { fprintf(stderr, ""\nError: fread return a number of element different from the expected.\n""); return 0 ; } id_len = tga[0]; /*cmap_type = tga[1];*/ image_type = tga[2]; /*cmap_index = get_tga_ushort(&tga[3]);*/ cmap_len = get_tga_ushort(&tga[5]); cmap_entry_size = tga[7]; #if 0 x_origin = get_tga_ushort(&tga[8]); y_origin = get_tga_ushort(&tga[10]); #endif image_w = get_tga_ushort(&tga[12]); image_h = get_tga_ushort(&tga[14]); pixel_depth = tga[16]; image_desc = tga[17]; *bits_per_pixel = (unsigned int)pixel_depth; *width = (unsigned int)image_w; *height = (unsigned int)image_h; /* Ignore tga identifier, if present ... */ if (id_len) { unsigned char *id = (unsigned char *) malloc(id_len); if (id == 0) { fprintf(stderr, ""tga_readheader: memory out\n""); return 0; } if (!fread(id, id_len, 1, fp)) { fprintf(stderr, ""\nError: fread return a number of element different from the expected.\n""); free(id); return 0 ; } free(id); } /* Test for compressed formats ... not yet supported ... if (image_type > 8) { fprintf(stderr, ""Sorry, compressed tga files are not currently supported.\n""); return 0 ; } *flip_image = !(image_desc & 32); /* Palettized formats are not yet supported, skip over the palette, if present ... */ palette_size = cmap_len * (cmap_entry_size / 8); if (palette_size > 0) { fprintf(stderr, ""File contains a palette - not yet supported.""); fseek(fp, palette_size, SEEK_CUR); } return 1; } ",0 "void AudioRendererHost::OnSetVolume(int stream_id, double volume) { DCHECK_CURRENTLY_ON(BrowserThread::IO); AudioOutputDelegate* delegate = LookupById(stream_id); if (!delegate) { SendErrorMessage(stream_id); return; } if (volume < 0 || volume > 1.0) return; delegate->OnSetVolume(volume); } ",0 "static void virtio_scsi_complete_req(VirtIOSCSIReq *req) { VirtIOSCSI *s = req->dev; VirtQueue *vq = req->vq; VirtIODevice *vdev = VIRTIO_DEVICE(s); virtqueue_push(vq, &req->elem, req->qsgl.size + req->elem.in_sg[0].iov_len); qemu_sglist_destroy(&req->qsgl); if (req->sreq) { req->sreq->hba_private = NULL; scsi_req_unref(req->sreq); } g_free(req); virtio_notify(vdev, vq); } ",0 "bool vrend_destroy_context(struct vrend_context *ctx) { bool switch_0 = (ctx == vrend_state.current_ctx); struct vrend_context *cur = vrend_state.current_ctx; struct vrend_sub_context *sub, *tmp; if (switch_0) { vrend_state.current_ctx = NULL; vrend_state.current_hw_ctx = NULL; } if (vrend_state.use_core_profile) { if (ctx->pstip_inited) glDeleteTextures(1, &ctx->pstipple_tex_id); ctx->pstip_inited = false; } /* reset references on framebuffers */ vrend_set_framebuffer_state(ctx, 0, NULL, 0); vrend_set_num_sampler_views(ctx, PIPE_SHADER_VERTEX, 0, 0); vrend_set_num_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, 0); vrend_set_num_sampler_views(ctx, PIPE_SHADER_GEOMETRY, 0, 0); vrend_set_streamout_targets(ctx, 0, 0, NULL); vrend_set_num_vbo(ctx, 0); vrend_set_index_buffer(ctx, 0, 0, 0); vrend_renderer_force_ctx_0(); LIST_FOR_EACH_ENTRY_SAFE(sub, tmp, &ctx->sub_ctxs, head) vrend_destroy_sub_context(sub); vrend_object_fini_ctx_table(ctx->res_hash); list_del(&ctx->ctx_entry); FREE(ctx); if (!switch_0 && cur) vrend_hw_switch_context(cur, true); return switch_0; } ",0 "gpgsm_get_req_version (void) { return ""2.0.4""; } ",0 "Mat_VarWrite4(mat_t *mat,matvar_t *matvar) { typedef struct { mat_int32_t type; mat_int32_t mrows; mat_int32_t ncols; mat_int32_t imagf; mat_int32_t namelen; } Fmatrix; mat_int32_t nelems = 1, i; Fmatrix x; if ( NULL == mat || NULL == matvar || NULL == matvar->name || matvar->rank != 2 ) return -1; switch ( matvar->data_type ) { case MAT_T_DOUBLE: x.type = 0; break; case MAT_T_SINGLE: x.type = 10; break; case MAT_T_INT32: x.type = 20; break; case MAT_T_INT16: x.type = 30; break; case MAT_T_UINT16: x.type = 40; break; case MAT_T_UINT8: x.type = 50; break; default: return 2; } #if defined(__GLIBC__) #if (__BYTE_ORDER == __LITTLE_ENDIAN) #elif (__BYTE_ORDER == __BIG_ENDIAN) x.type += 1000; #else return -1; #endif #elif defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN) x.type += 1000; #elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN) #elif defined(__sparc) || defined(__sparc__) || defined(_POWER) || defined(__powerpc__) || \ defined(__ppc__) || defined(__hpux) || defined(_MIPSEB) || defined(_POWER) || defined(__s390__) x.type += 1000; #elif defined(__i386__) || defined(__alpha__) || defined(__ia64) || defined(__ia64__) || \ defined(_M_IX86) || defined(_M_IA64) || defined(_M_ALPHA) || defined(__amd64) || \ defined(__amd64__) || defined(_M_AMD64) || defined(__x86_64) || defined(__x86_64__) || \ defined(_M_X64) || defined(__bfin__) #else return -1; #endif x.namelen = (mat_int32_t)strlen(matvar->name) + 1; /* FIXME: SEEK_END is not Guaranteed by the C standard */ (void)fseek((FILE*)mat->fp,0,SEEK_END); /* Always write at end of file */ switch ( matvar->class_type ) { case MAT_C_CHAR: x.type++; /* Fall through */ case MAT_C_DOUBLE: case MAT_C_SINGLE: case MAT_C_INT32: case MAT_C_INT16: case MAT_C_UINT16: case MAT_C_UINT8: for ( i = 0; i < matvar->rank; i++ ) { mat_int32_t dim; dim = (mat_int32_t)matvar->dims[i]; nelems *= dim; } x.mrows = (mat_int32_t)matvar->dims[0]; x.ncols = (mat_int32_t)matvar->dims[1]; x.imagf = matvar->isComplex ? 1 : 0; fwrite(&x, sizeof(Fmatrix), 1, (FILE*)mat->fp); fwrite(matvar->name, sizeof(char), x.namelen, (FILE*)mat->fp); if ( matvar->isComplex ) { mat_complex_split_t *complex_data; complex_data = (mat_complex_split_t*)matvar->data; fwrite(complex_data->Re, matvar->data_size, nelems, (FILE*)mat->fp); fwrite(complex_data->Im, matvar->data_size, nelems, (FILE*)mat->fp); } else { fwrite(matvar->data, matvar->data_size, nelems, (FILE*)mat->fp); } break; case MAT_C_SPARSE: { mat_sparse_t* sparse; double tmp; int j; size_t stride = Mat_SizeOf(matvar->data_type); #if !defined(EXTENDED_SPARSE) if ( MAT_T_DOUBLE != matvar->data_type ) break; #endif sparse = (mat_sparse_t*)matvar->data; x.type += 2; x.mrows = sparse->njc > 0 ? sparse->jc[sparse->njc - 1] + 1 : 1; x.ncols = matvar->isComplex ? 4 : 3; x.imagf = 0; fwrite(&x, sizeof(Fmatrix), 1, (FILE*)mat->fp); fwrite(matvar->name, sizeof(char), x.namelen, (FILE*)mat->fp); for ( i = 0; i < sparse->njc - 1; i++ ) { for ( j = sparse->jc[i]; j < sparse->jc[i + 1] && j < sparse->ndata; j++ ) { tmp = sparse->ir[j] + 1; fwrite(&tmp, sizeof(double), 1, (FILE*)mat->fp); } } tmp = (double)matvar->dims[0]; fwrite(&tmp, sizeof(double), 1, (FILE*)mat->fp); for ( i = 0; i < sparse->njc - 1; i++ ) { for ( j = sparse->jc[i]; j < sparse->jc[i + 1] && j < sparse->ndata; j++ ) { tmp = i + 1; fwrite(&tmp, sizeof(double), 1, (FILE*)mat->fp); } } tmp = (double)matvar->dims[1]; fwrite(&tmp, sizeof(double), 1, (FILE*)mat->fp); tmp = 0.; if ( matvar->isComplex ) { mat_complex_split_t *complex_data; char* re, *im; complex_data = (mat_complex_split_t*)sparse->data; re = (char*)complex_data->Re; im = (char*)complex_data->Im; for ( i = 0; i < sparse->njc - 1; i++ ) { for ( j = sparse->jc[i]; j < sparse->jc[i + 1] && j < sparse->ndata; j++ ) { fwrite(re + j*stride, stride, 1, (FILE*)mat->fp); } } fwrite(&tmp, stride, 1, (FILE*)mat->fp); for ( i = 0; i < sparse->njc - 1; i++ ) { for ( j = sparse->jc[i]; j < sparse->jc[i + 1] && j < sparse->ndata; j++ ) { fwrite(im + j*stride, stride, 1, (FILE*)mat->fp); } } } else { char *data = (char*)sparse->data; for ( i = 0; i < sparse->njc - 1; i++ ) { for ( j = sparse->jc[i]; j < sparse->jc[i + 1] && j < sparse->ndata; j++ ) { fwrite(data + j*stride, stride, 1, (FILE*)mat->fp); } } } fwrite(&tmp, stride, 1, (FILE*)mat->fp); break; } default: break; } return 0; } ",0 "static int StreamTcpTest06 (void) { Packet *p = SCMalloc(SIZE_OF_PACKET); if (unlikely(p == NULL)) return 0; Flow f; TcpSession ssn; ThreadVars tv; StreamTcpThread stt; TCPHdr tcph; memset(p, 0, SIZE_OF_PACKET); PacketQueue pq; memset(&pq,0,sizeof(PacketQueue)); memset (&f, 0, sizeof(Flow)); memset(&ssn, 0, sizeof (TcpSession)); memset(&tv, 0, sizeof (ThreadVars)); memset(&stt, 0, sizeof (StreamTcpThread)); memset(&tcph, 0, sizeof (TCPHdr)); FLOW_INITIALIZE(&f); p->flow = &f; int ret = 0; StreamTcpUTInit(&stt.ra_ctx); tcph.th_flags = TH_FIN; p->tcph = &tcph; /* StreamTcpPacket returns -1 on unsolicited FIN */ if (StreamTcpPacket(&tv, p, &stt, &pq) != -1) { printf(""StreamTcpPacket failed: ""); goto end; } if (((TcpSession *)(p->flow->protoctx)) != NULL) { printf(""we have a ssn while we shouldn't: ""); goto end; } p->tcph->th_flags = TH_RST; /* StreamTcpPacket returns -1 on unsolicited RST */ if (StreamTcpPacket(&tv, p, &stt, &pq) != -1) { printf(""StreamTcpPacket failed (2): ""); goto end; } if (((TcpSession *)(p->flow->protoctx)) != NULL) { printf(""we have a ssn while we shouldn't (2): ""); goto end; } ret = 1; end: SCFree(p); FLOW_DESTROY(&f); StreamTcpUTDeinit(stt.ra_ctx); return ret; } ",0 "static int apparmor_getprocattr(struct task_struct *task, char *name, char **value) { int error = -ENOENT; /* released below */ const struct cred *cred = get_task_cred(task); struct aa_task_cxt *cxt = cred_cxt(cred); struct aa_profile *profile = NULL; if (strcmp(name, ""current"") == 0) profile = aa_get_newest_profile(cxt->profile); else if (strcmp(name, ""prev"") == 0 && cxt->previous) profile = aa_get_newest_profile(cxt->previous); else if (strcmp(name, ""exec"") == 0 && cxt->onexec) profile = aa_get_newest_profile(cxt->onexec); else error = -EINVAL; if (profile) error = aa_getprocattr(profile, value); aa_put_profile(profile); put_cred(cred); return error; } ",0 " void OnTimeout() { LOG_IF(ERROR, is_removing_) << ""Timed out""; SignalDone(); } ",0 "static void RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q) { *p = r->p; *q = r->q; } ",0 " PHP_FUNCTION(xml_set_notation_decl_handler) { xml_parser *parser; zval *pind, **hdl; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""rZ"", &pind, &hdl) == FAILURE) { return; } ZEND_FETCH_RESOURCE(parser,xml_parser *, &pind, -1, ""XML Parser"", le_xml_parser); xml_set_handler(&parser->notationDeclHandler, hdl); XML_SetNotationDeclHandler(parser->parser, _xml_notationDeclHandler); RETVAL_TRUE; } ",0 "void Browser::OpenPasswordManager() { window_->ShowPasswordManager(); } ",0 "static int hns_nic_poll_rx_skb(struct hns_nic_ring_data *ring_data, struct sk_buff **out_skb, int *out_bnum) { struct hnae_ring *ring = ring_data->ring; struct net_device *ndev = ring_data->napi.dev; struct hns_nic_priv *priv = netdev_priv(ndev); struct sk_buff *skb; struct hnae_desc *desc; struct hnae_desc_cb *desc_cb; unsigned char *va; int bnum, length, i; int pull_len; u32 bnum_flag; desc = &ring->desc[ring->next_to_clean]; desc_cb = &ring->desc_cb[ring->next_to_clean]; prefetch(desc); va = (unsigned char *)desc_cb->buf + desc_cb->page_offset; /* prefetch first cache line of first page */ prefetch(va); #if L1_CACHE_BYTES < 128 prefetch(va + L1_CACHE_BYTES); #endif skb = *out_skb = napi_alloc_skb(&ring_data->napi, HNS_RX_HEAD_SIZE); if (unlikely(!skb)) { netdev_err(ndev, ""alloc rx skb fail\n""); ring->stats.sw_err_cnt++; return -ENOMEM; } prefetchw(skb->data); length = le16_to_cpu(desc->rx.pkt_len); bnum_flag = le32_to_cpu(desc->rx.ipoff_bnum_pid_flag); priv->ops.get_rxd_bnum(bnum_flag, &bnum); *out_bnum = bnum; if (length <= HNS_RX_HEAD_SIZE) { memcpy(__skb_put(skb, length), va, ALIGN(length, sizeof(long))); /* we can reuse buffer as-is, just make sure it is local */ if (likely(page_to_nid(desc_cb->priv) == numa_node_id())) desc_cb->reuse_flag = 1; else /* this page cannot be reused so discard it */ put_page(desc_cb->priv); ring_ptr_move_fw(ring, next_to_clean); if (unlikely(bnum != 1)) { /* check err*/ *out_bnum = 1; goto out_bnum_err; } } else { ring->stats.seg_pkt_cnt++; pull_len = hns_nic_get_headlen(va, bnum_flag, HNS_RX_HEAD_SIZE); memcpy(__skb_put(skb, pull_len), va, ALIGN(pull_len, sizeof(long))); hns_nic_reuse_page(skb, 0, ring, pull_len, desc_cb); ring_ptr_move_fw(ring, next_to_clean); if (unlikely(bnum >= (int)MAX_SKB_FRAGS)) { /* check err*/ *out_bnum = 1; goto out_bnum_err; } for (i = 1; i < bnum; i++) { desc = &ring->desc[ring->next_to_clean]; desc_cb = &ring->desc_cb[ring->next_to_clean]; hns_nic_reuse_page(skb, i, ring, 0, desc_cb); ring_ptr_move_fw(ring, next_to_clean); } } /* check except process, free skb and jump the desc */ if (unlikely((!bnum) || (bnum > ring->max_desc_num_per_pkt))) { out_bnum_err: *out_bnum = *out_bnum ? *out_bnum : 1; /* ntc moved,cannot 0*/ netdev_err(ndev, ""invalid bnum(%d,%d,%d,%d),%016llx,%016llx\n"", bnum, ring->max_desc_num_per_pkt, length, (int)MAX_SKB_FRAGS, ((u64 *)desc)[0], ((u64 *)desc)[1]); ring->stats.err_bd_num++; dev_kfree_skb_any(skb); return -EDOM; } bnum_flag = le32_to_cpu(desc->rx.ipoff_bnum_pid_flag); if (unlikely(!hnae_get_bit(bnum_flag, HNS_RXD_VLD_B))) { netdev_err(ndev, ""no valid bd,%016llx,%016llx\n"", ((u64 *)desc)[0], ((u64 *)desc)[1]); ring->stats.non_vld_descs++; dev_kfree_skb_any(skb); return -EINVAL; } if (unlikely((!desc->rx.pkt_len) || hnae_get_bit(bnum_flag, HNS_RXD_DROP_B))) { ring->stats.err_pkt_len++; dev_kfree_skb_any(skb); return -EFAULT; } if (unlikely(hnae_get_bit(bnum_flag, HNS_RXD_L2E_B))) { ring->stats.l2_err++; dev_kfree_skb_any(skb); return -EFAULT; } ring->stats.rx_pkts++; ring->stats.rx_bytes += skb->len; /* indicate to upper stack if our hardware has already calculated * the RX checksum */ hns_nic_rx_checksum(ring_data, skb, bnum_flag); return 0; } ",0 "bool current_chrooted(void) { /* Does the current process have a non-standard root */ struct path ns_root; struct path fs_root; bool chrooted; /* Find the namespace root */ ns_root.mnt = ¤t->nsproxy->mnt_ns->root->mnt; ns_root.dentry = ns_root.mnt->mnt_root; path_get(&ns_root); while (d_mountpoint(ns_root.dentry) && follow_down_one(&ns_root)) ; get_fs_root(current->fs, &fs_root); chrooted = !path_equal(&fs_root, &ns_root); path_put(&fs_root); path_put(&ns_root); return chrooted; } ",0 "void BrowserRenderProcessHost::OnChannelConnected(int32 peer_pid) { #if defined(IPC_MESSAGE_LOG_ENABLED) Send(new ChildProcessMsg_SetIPCLoggingEnabled( IPC::Logging::GetInstance()->Enabled())); #endif Send(new ChildProcessMsg_AskBeforeShutdown()); } ",0 "SYSCALL_DEFINE2(io_setup, unsigned, nr_events, aio_context_t __user *, ctxp) { struct kioctx *ioctx = NULL; unsigned long ctx; long ret; ret = get_user(ctx, ctxp); if (unlikely(ret)) goto out; ret = -EINVAL; if (unlikely(ctx || nr_events == 0)) { pr_debug(""EINVAL: io_setup: ctx %lu nr_events %u\n"", ctx, nr_events); goto out; } ioctx = ioctx_alloc(nr_events); ret = PTR_ERR(ioctx); if (!IS_ERR(ioctx)) { ret = put_user(ioctx->user_id, ctxp); if (!ret) return 0; get_ioctx(ioctx); /* io_destroy() expects us to hold a ref */ io_destroy(ioctx); } out: return ret; } ",0 "void __init free_initrd_mem(unsigned long start, unsigned long end) { /* * end could be not aligned, and We can not align that, * decompresser could be confused by aligned initrd_end * We already reserve the end partial page before in * - i386_start_kernel() * - x86_64_start_kernel() * - relocate_initrd() * So here We can do PAGE_ALIGN() safely to get partial page to be freed */ free_init_pages(""initrd"", start, PAGE_ALIGN(end)); } ",0 "static int _nfs4_free_stateid(struct nfs_server *server, nfs4_stateid *stateid) { struct nfs41_free_stateid_args args = { .stateid = stateid, }; struct nfs41_free_stateid_res res; struct rpc_message msg = { .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_FREE_STATEID], .rpc_argp = &args, .rpc_resp = &res, }; nfs41_init_sequence(&args.seq_args, &res.seq_res, 0); return nfs4_call_sync_sequence(server->client, server, &msg, &args.seq_args, &res.seq_res, 1); } ",0 "static int parse_strtoul(const char *buf, unsigned long max, unsigned long *value) { char *endp; *value = simple_strtoul(skip_spaces(buf), &endp, 0); endp = skip_spaces(endp); if (*endp || *value > max) return -EINVAL; return 0; } ",0 "void LoadingPredictor::CancelPageLoadHint(const GURL& url) { if (shutdown_) return; CancelActiveHint(active_hints_.find(url)); } ",0 "static int compat_standard_to_user(void __user *dst, const void *src) { compat_int_t cv = *(int *)src; if (cv > 0) cv -= xt_compat_calc_jump(NFPROTO_ARP, cv); return copy_to_user(dst, &cv, sizeof(cv)) ? -EFAULT : 0; } ",0 "void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos) { struct net_device *dev = (v == SEQ_START_TOKEN) ? first_net_device(seq_file_net(seq)) : next_net_device((struct net_device *)v); ++*pos; return rcu_dereference(dev); } ",0 "int PDFiumEngine::GetCharCount(int page_index) { DCHECK(PageIndexInBounds(page_index)); return pages_[page_index]->GetCharCount(); } ",0 "static void vmx_set_rvi(int vector) { u16 status; u8 old; if (vector == -1) vector = 0; status = vmcs_read16(GUEST_INTR_STATUS); old = (u8)status & 0xff; if ((u8)vector != old) { status &= ~0xff; status |= (u8)vector; vmcs_write16(GUEST_INTR_STATUS, status); } } ",0 "int getJobAdExitedBySignal(ClassAd *jad, int &exited_by_signal) { if( ! jad->LookupInteger(ATTR_ON_EXIT_BY_SIGNAL, exited_by_signal) ) { return FALSE; } return TRUE; } ",0 "xfs_attr_set( xfs_inode_t *dp, const unsigned char *name, unsigned char *value, int valuelen, int flags) { int error; struct xfs_name xname; XFS_STATS_INC(xs_attr_set); if (XFS_FORCED_SHUTDOWN(dp->i_mount)) return (EIO); error = xfs_attr_name_to_xname(&xname, name); if (error) return error; return xfs_attr_set_int(dp, &xname, value, valuelen, flags); } ",0 "const char* TaskQueueManager::WakeupPolicyToString( TaskQueueManager::WakeupPolicy wakeup_policy) { switch (wakeup_policy) { case TaskQueueManager::WakeupPolicy::CAN_WAKE_OTHER_QUEUES: return ""can_wake_other_queues""; case TaskQueueManager::WakeupPolicy::DONT_WAKE_OTHER_QUEUES: return ""dont_wake_other_queues""; default: NOTREACHED(); return nullptr; } } ",0 "static int __init msr_init(void) { int i, err = 0; i = 0; if (__register_chrdev(MSR_MAJOR, 0, NR_CPUS, ""cpu/msr"", &msr_fops)) { printk(KERN_ERR ""msr: unable to get major %d for msr\n"", MSR_MAJOR); err = -EBUSY; goto out; } msr_class = class_create(THIS_MODULE, ""msr""); if (IS_ERR(msr_class)) { err = PTR_ERR(msr_class); goto out_chrdev; } msr_class->devnode = msr_devnode; get_online_cpus(); for_each_online_cpu(i) { err = msr_device_create(i); if (err != 0) goto out_class; } register_hotcpu_notifier(&msr_class_cpu_notifier); put_online_cpus(); err = 0; goto out; out_class: i = 0; for_each_online_cpu(i) msr_device_destroy(i); put_online_cpus(); class_destroy(msr_class); out_chrdev: __unregister_chrdev(MSR_MAJOR, 0, NR_CPUS, ""cpu/msr""); out: return err; } ",0 "static void voidMethodTestInterfaceEmptyArgVariadicTestInterfaceEmptyArgMethod(const v8::FunctionCallbackInfo& info) { if (UNLIKELY(info.Length() < 1)) { throwTypeError(ExceptionMessages::failedToExecute(""voidMethodTestInterfaceEmptyArgVariadicTestInterfaceEmptyArg"", ""TestObjectPython"", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIsolate()); return; } TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); V8TRYCATCH_VOID(TestInterfaceEmpty*, testInterfaceEmptyArg, V8TestInterfaceEmpty::toNativeWithTypeCheck(info.GetIsolate(), info[0])); Vector > variadicTestInterfaceEmptyArgs; for (int i = 1; i < info.Length(); ++i) { if (!V8TestInterfaceEmpty::hasInstance(info[i], info.GetIsolate())) { throwTypeError(ExceptionMessages::failedToExecute(""voidMethodTestInterfaceEmptyArgVariadicTestInterfaceEmptyArg"", ""TestObjectPython"", ""parameter 2 is not of type 'TestInterfaceEmpty'.""), info.GetIsolate()); return; } variadicTestInterfaceEmptyArgs.append(V8TestInterfaceEmpty::toNative(v8::Handle::Cast(info[i]))); } imp->voidMethodTestInterfaceEmptyArgVariadicTestInterfaceEmptyArg(testInterfaceEmptyArg, variadicTestInterfaceEmptyArgs); } ",0 "static long __video_do_ioctl(struct file *file, unsigned int cmd, void *arg) { struct video_device *vfd = video_devdata(file); const struct v4l2_ioctl_ops *ops = vfd->ioctl_ops; void *fh = file->private_data; struct v4l2_format f_copy; long ret = -EINVAL; if (ops == NULL) { printk(KERN_WARNING ""videodev: \""%s\"" has no ioctl_ops.\n"", vfd->name); return -EINVAL; } if ((vfd->debug & V4L2_DEBUG_IOCTL) && !(vfd->debug & V4L2_DEBUG_IOCTL_ARG)) { v4l_print_ioctl(vfd->name, cmd); printk(KERN_CONT ""\n""); } switch (cmd) { /* --- capabilities ------------------------------------------ */ case VIDIOC_QUERYCAP: { struct v4l2_capability *cap = (struct v4l2_capability *)arg; if (!ops->vidioc_querycap) break; ret = ops->vidioc_querycap(file, fh, cap); if (!ret) dbgarg(cmd, ""driver=%s, card=%s, bus=%s, "" ""version=0x%08x, "" ""capabilities=0x%08x\n"", cap->driver, cap->card, cap->bus_info, cap->version, cap->capabilities); break; } /* --- priority ------------------------------------------ */ case VIDIOC_G_PRIORITY: { enum v4l2_priority *p = arg; if (!ops->vidioc_g_priority) break; ret = ops->vidioc_g_priority(file, fh, p); if (!ret) dbgarg(cmd, ""priority is %d\n"", *p); break; } case VIDIOC_S_PRIORITY: { enum v4l2_priority *p = arg; if (!ops->vidioc_s_priority) break; dbgarg(cmd, ""setting priority to %d\n"", *p); ret = ops->vidioc_s_priority(file, fh, *p); break; } /* --- capture ioctls ---------------------------------------- */ case VIDIOC_ENUM_FMT: { struct v4l2_fmtdesc *f = arg; switch (f->type) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: if (ops->vidioc_enum_fmt_vid_cap) ret = ops->vidioc_enum_fmt_vid_cap(file, fh, f); break; case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: if (ops->vidioc_enum_fmt_vid_cap_mplane) ret = ops->vidioc_enum_fmt_vid_cap_mplane(file, fh, f); break; case V4L2_BUF_TYPE_VIDEO_OVERLAY: if (ops->vidioc_enum_fmt_vid_overlay) ret = ops->vidioc_enum_fmt_vid_overlay(file, fh, f); break; case V4L2_BUF_TYPE_VIDEO_OUTPUT: if (ops->vidioc_enum_fmt_vid_out) ret = ops->vidioc_enum_fmt_vid_out(file, fh, f); break; case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: if (ops->vidioc_enum_fmt_vid_out_mplane) ret = ops->vidioc_enum_fmt_vid_out_mplane(file, fh, f); break; case V4L2_BUF_TYPE_PRIVATE: if (ops->vidioc_enum_fmt_type_private) ret = ops->vidioc_enum_fmt_type_private(file, fh, f); break; default: break; } if (!ret) dbgarg(cmd, ""index=%d, type=%d, flags=%d, "" ""pixelformat=%c%c%c%c, description='%s'\n"", f->index, f->type, f->flags, (f->pixelformat & 0xff), (f->pixelformat >> 8) & 0xff, (f->pixelformat >> 16) & 0xff, (f->pixelformat >> 24) & 0xff, f->description); break; } case VIDIOC_G_FMT: { struct v4l2_format *f = (struct v4l2_format *)arg; /* FIXME: Should be one dump per type */ dbgarg(cmd, ""type=%s\n"", prt_names(f->type, v4l2_type_names)); switch (f->type) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: if (ops->vidioc_g_fmt_vid_cap) { ret = ops->vidioc_g_fmt_vid_cap(file, fh, f); } else if (ops->vidioc_g_fmt_vid_cap_mplane) { if (fmt_sp_to_mp(f, &f_copy)) break; ret = ops->vidioc_g_fmt_vid_cap_mplane(file, fh, &f_copy); if (ret) break; /* Driver is currently in multi-planar format, * we can't return it in single-planar API*/ if (f_copy.fmt.pix_mp.num_planes > 1) { ret = -EBUSY; break; } ret = fmt_mp_to_sp(&f_copy, f); } if (!ret) v4l_print_pix_fmt(vfd, &f->fmt.pix); break; case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: if (ops->vidioc_g_fmt_vid_cap_mplane) { ret = ops->vidioc_g_fmt_vid_cap_mplane(file, fh, f); } else if (ops->vidioc_g_fmt_vid_cap) { if (fmt_mp_to_sp(f, &f_copy)) break; ret = ops->vidioc_g_fmt_vid_cap(file, fh, &f_copy); if (ret) break; ret = fmt_sp_to_mp(&f_copy, f); } if (!ret) v4l_print_pix_fmt_mplane(vfd, &f->fmt.pix_mp); break; case V4L2_BUF_TYPE_VIDEO_OVERLAY: if (ops->vidioc_g_fmt_vid_overlay) ret = ops->vidioc_g_fmt_vid_overlay(file, fh, f); break; case V4L2_BUF_TYPE_VIDEO_OUTPUT: if (ops->vidioc_g_fmt_vid_out) { ret = ops->vidioc_g_fmt_vid_out(file, fh, f); } else if (ops->vidioc_g_fmt_vid_out_mplane) { if (fmt_sp_to_mp(f, &f_copy)) break; ret = ops->vidioc_g_fmt_vid_out_mplane(file, fh, &f_copy); if (ret) break; /* Driver is currently in multi-planar format, * we can't return it in single-planar API*/ if (f_copy.fmt.pix_mp.num_planes > 1) { ret = -EBUSY; break; } ret = fmt_mp_to_sp(&f_copy, f); } if (!ret) v4l_print_pix_fmt(vfd, &f->fmt.pix); break; case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: if (ops->vidioc_g_fmt_vid_out_mplane) { ret = ops->vidioc_g_fmt_vid_out_mplane(file, fh, f); } else if (ops->vidioc_g_fmt_vid_out) { if (fmt_mp_to_sp(f, &f_copy)) break; ret = ops->vidioc_g_fmt_vid_out(file, fh, &f_copy); if (ret) break; ret = fmt_sp_to_mp(&f_copy, f); } if (!ret) v4l_print_pix_fmt_mplane(vfd, &f->fmt.pix_mp); break; case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: if (ops->vidioc_g_fmt_vid_out_overlay) ret = ops->vidioc_g_fmt_vid_out_overlay(file, fh, f); break; case V4L2_BUF_TYPE_VBI_CAPTURE: if (ops->vidioc_g_fmt_vbi_cap) ret = ops->vidioc_g_fmt_vbi_cap(file, fh, f); break; case V4L2_BUF_TYPE_VBI_OUTPUT: if (ops->vidioc_g_fmt_vbi_out) ret = ops->vidioc_g_fmt_vbi_out(file, fh, f); break; case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: if (ops->vidioc_g_fmt_sliced_vbi_cap) ret = ops->vidioc_g_fmt_sliced_vbi_cap(file, fh, f); break; case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT: if (ops->vidioc_g_fmt_sliced_vbi_out) ret = ops->vidioc_g_fmt_sliced_vbi_out(file, fh, f); break; case V4L2_BUF_TYPE_PRIVATE: if (ops->vidioc_g_fmt_type_private) ret = ops->vidioc_g_fmt_type_private(file, fh, f); break; } break; } case VIDIOC_S_FMT: { struct v4l2_format *f = (struct v4l2_format *)arg; /* FIXME: Should be one dump per type */ dbgarg(cmd, ""type=%s\n"", prt_names(f->type, v4l2_type_names)); switch (f->type) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: CLEAR_AFTER_FIELD(f, fmt.pix); v4l_print_pix_fmt(vfd, &f->fmt.pix); if (ops->vidioc_s_fmt_vid_cap) { ret = ops->vidioc_s_fmt_vid_cap(file, fh, f); } else if (ops->vidioc_s_fmt_vid_cap_mplane) { if (fmt_sp_to_mp(f, &f_copy)) break; ret = ops->vidioc_s_fmt_vid_cap_mplane(file, fh, &f_copy); if (ret) break; if (f_copy.fmt.pix_mp.num_planes > 1) { /* Drivers shouldn't adjust from 1-plane * to more than 1-plane formats */ ret = -EBUSY; WARN_ON(1); break; } ret = fmt_mp_to_sp(&f_copy, f); } break; case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: CLEAR_AFTER_FIELD(f, fmt.pix_mp); v4l_print_pix_fmt_mplane(vfd, &f->fmt.pix_mp); if (ops->vidioc_s_fmt_vid_cap_mplane) { ret = ops->vidioc_s_fmt_vid_cap_mplane(file, fh, f); } else if (ops->vidioc_s_fmt_vid_cap && f->fmt.pix_mp.num_planes == 1) { if (fmt_mp_to_sp(f, &f_copy)) break; ret = ops->vidioc_s_fmt_vid_cap(file, fh, &f_copy); if (ret) break; ret = fmt_sp_to_mp(&f_copy, f); } break; case V4L2_BUF_TYPE_VIDEO_OVERLAY: CLEAR_AFTER_FIELD(f, fmt.win); if (ops->vidioc_s_fmt_vid_overlay) ret = ops->vidioc_s_fmt_vid_overlay(file, fh, f); break; case V4L2_BUF_TYPE_VIDEO_OUTPUT: CLEAR_AFTER_FIELD(f, fmt.pix); v4l_print_pix_fmt(vfd, &f->fmt.pix); if (ops->vidioc_s_fmt_vid_out) { ret = ops->vidioc_s_fmt_vid_out(file, fh, f); } else if (ops->vidioc_s_fmt_vid_out_mplane) { if (fmt_sp_to_mp(f, &f_copy)) break; ret = ops->vidioc_s_fmt_vid_out_mplane(file, fh, &f_copy); if (ret) break; if (f_copy.fmt.pix_mp.num_planes > 1) { /* Drivers shouldn't adjust from 1-plane * to more than 1-plane formats */ ret = -EBUSY; WARN_ON(1); break; } ret = fmt_mp_to_sp(&f_copy, f); } break; case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: CLEAR_AFTER_FIELD(f, fmt.pix_mp); v4l_print_pix_fmt_mplane(vfd, &f->fmt.pix_mp); if (ops->vidioc_s_fmt_vid_out_mplane) { ret = ops->vidioc_s_fmt_vid_out_mplane(file, fh, f); } else if (ops->vidioc_s_fmt_vid_out && f->fmt.pix_mp.num_planes == 1) { if (fmt_mp_to_sp(f, &f_copy)) break; ret = ops->vidioc_s_fmt_vid_out(file, fh, &f_copy); if (ret) break; ret = fmt_mp_to_sp(&f_copy, f); } break; case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: CLEAR_AFTER_FIELD(f, fmt.win); if (ops->vidioc_s_fmt_vid_out_overlay) ret = ops->vidioc_s_fmt_vid_out_overlay(file, fh, f); break; case V4L2_BUF_TYPE_VBI_CAPTURE: CLEAR_AFTER_FIELD(f, fmt.vbi); if (ops->vidioc_s_fmt_vbi_cap) ret = ops->vidioc_s_fmt_vbi_cap(file, fh, f); break; case V4L2_BUF_TYPE_VBI_OUTPUT: CLEAR_AFTER_FIELD(f, fmt.vbi); if (ops->vidioc_s_fmt_vbi_out) ret = ops->vidioc_s_fmt_vbi_out(file, fh, f); break; case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: CLEAR_AFTER_FIELD(f, fmt.sliced); if (ops->vidioc_s_fmt_sliced_vbi_cap) ret = ops->vidioc_s_fmt_sliced_vbi_cap(file, fh, f); break; case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT: CLEAR_AFTER_FIELD(f, fmt.sliced); if (ops->vidioc_s_fmt_sliced_vbi_out) ret = ops->vidioc_s_fmt_sliced_vbi_out(file, fh, f); break; case V4L2_BUF_TYPE_PRIVATE: /* CLEAR_AFTER_FIELD(f, fmt.raw_data); <- does nothing */ if (ops->vidioc_s_fmt_type_private) ret = ops->vidioc_s_fmt_type_private(file, fh, f); break; } break; } case VIDIOC_TRY_FMT: { struct v4l2_format *f = (struct v4l2_format *)arg; /* FIXME: Should be one dump per type */ dbgarg(cmd, ""type=%s\n"", prt_names(f->type, v4l2_type_names)); switch (f->type) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: CLEAR_AFTER_FIELD(f, fmt.pix); if (ops->vidioc_try_fmt_vid_cap) { ret = ops->vidioc_try_fmt_vid_cap(file, fh, f); } else if (ops->vidioc_try_fmt_vid_cap_mplane) { if (fmt_sp_to_mp(f, &f_copy)) break; ret = ops->vidioc_try_fmt_vid_cap_mplane(file, fh, &f_copy); if (ret) break; if (f_copy.fmt.pix_mp.num_planes > 1) { /* Drivers shouldn't adjust from 1-plane * to more than 1-plane formats */ ret = -EBUSY; WARN_ON(1); break; } ret = fmt_mp_to_sp(&f_copy, f); } if (!ret) v4l_print_pix_fmt(vfd, &f->fmt.pix); break; case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: CLEAR_AFTER_FIELD(f, fmt.pix_mp); if (ops->vidioc_try_fmt_vid_cap_mplane) { ret = ops->vidioc_try_fmt_vid_cap_mplane(file, fh, f); } else if (ops->vidioc_try_fmt_vid_cap && f->fmt.pix_mp.num_planes == 1) { if (fmt_mp_to_sp(f, &f_copy)) break; ret = ops->vidioc_try_fmt_vid_cap(file, fh, &f_copy); if (ret) break; ret = fmt_sp_to_mp(&f_copy, f); } if (!ret) v4l_print_pix_fmt_mplane(vfd, &f->fmt.pix_mp); break; case V4L2_BUF_TYPE_VIDEO_OVERLAY: CLEAR_AFTER_FIELD(f, fmt.win); if (ops->vidioc_try_fmt_vid_overlay) ret = ops->vidioc_try_fmt_vid_overlay(file, fh, f); break; case V4L2_BUF_TYPE_VIDEO_OUTPUT: CLEAR_AFTER_FIELD(f, fmt.pix); if (ops->vidioc_try_fmt_vid_out) { ret = ops->vidioc_try_fmt_vid_out(file, fh, f); } else if (ops->vidioc_try_fmt_vid_out_mplane) { if (fmt_sp_to_mp(f, &f_copy)) break; ret = ops->vidioc_try_fmt_vid_out_mplane(file, fh, &f_copy); if (ret) break; if (f_copy.fmt.pix_mp.num_planes > 1) { /* Drivers shouldn't adjust from 1-plane * to more than 1-plane formats */ ret = -EBUSY; WARN_ON(1); break; } ret = fmt_mp_to_sp(&f_copy, f); } if (!ret) v4l_print_pix_fmt(vfd, &f->fmt.pix); break; case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: CLEAR_AFTER_FIELD(f, fmt.pix_mp); if (ops->vidioc_try_fmt_vid_out_mplane) { ret = ops->vidioc_try_fmt_vid_out_mplane(file, fh, f); } else if (ops->vidioc_try_fmt_vid_out && f->fmt.pix_mp.num_planes == 1) { if (fmt_mp_to_sp(f, &f_copy)) break; ret = ops->vidioc_try_fmt_vid_out(file, fh, &f_copy); if (ret) break; ret = fmt_sp_to_mp(&f_copy, f); } if (!ret) v4l_print_pix_fmt_mplane(vfd, &f->fmt.pix_mp); break; case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: CLEAR_AFTER_FIELD(f, fmt.win); if (ops->vidioc_try_fmt_vid_out_overlay) ret = ops->vidioc_try_fmt_vid_out_overlay(file, fh, f); break; case V4L2_BUF_TYPE_VBI_CAPTURE: CLEAR_AFTER_FIELD(f, fmt.vbi); if (ops->vidioc_try_fmt_vbi_cap) ret = ops->vidioc_try_fmt_vbi_cap(file, fh, f); break; case V4L2_BUF_TYPE_VBI_OUTPUT: CLEAR_AFTER_FIELD(f, fmt.vbi); if (ops->vidioc_try_fmt_vbi_out) ret = ops->vidioc_try_fmt_vbi_out(file, fh, f); break; case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: CLEAR_AFTER_FIELD(f, fmt.sliced); if (ops->vidioc_try_fmt_sliced_vbi_cap) ret = ops->vidioc_try_fmt_sliced_vbi_cap(file, fh, f); break; case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT: CLEAR_AFTER_FIELD(f, fmt.sliced); if (ops->vidioc_try_fmt_sliced_vbi_out) ret = ops->vidioc_try_fmt_sliced_vbi_out(file, fh, f); break; case V4L2_BUF_TYPE_PRIVATE: /* CLEAR_AFTER_FIELD(f, fmt.raw_data); <- does nothing */ if (ops->vidioc_try_fmt_type_private) ret = ops->vidioc_try_fmt_type_private(file, fh, f); break; } break; } /* FIXME: Those buf reqs could be handled here, with some changes on videobuf to allow its header to be included at videodev2.h or being merged at videodev2. */ case VIDIOC_REQBUFS: { struct v4l2_requestbuffers *p = arg; if (!ops->vidioc_reqbufs) break; ret = check_fmt(ops, p->type); if (ret) break; if (p->type < V4L2_BUF_TYPE_PRIVATE) CLEAR_AFTER_FIELD(p, memory); ret = ops->vidioc_reqbufs(file, fh, p); dbgarg(cmd, ""count=%d, type=%s, memory=%s\n"", p->count, prt_names(p->type, v4l2_type_names), prt_names(p->memory, v4l2_memory_names)); break; } case VIDIOC_QUERYBUF: { struct v4l2_buffer *p = arg; if (!ops->vidioc_querybuf) break; ret = check_fmt(ops, p->type); if (ret) break; ret = ops->vidioc_querybuf(file, fh, p); if (!ret) dbgbuf(cmd, vfd, p); break; } case VIDIOC_QBUF: { struct v4l2_buffer *p = arg; if (!ops->vidioc_qbuf) break; ret = check_fmt(ops, p->type); if (ret) break; ret = ops->vidioc_qbuf(file, fh, p); if (!ret) dbgbuf(cmd, vfd, p); break; } case VIDIOC_DQBUF: { struct v4l2_buffer *p = arg; if (!ops->vidioc_dqbuf) break; ret = check_fmt(ops, p->type); if (ret) break; ret = ops->vidioc_dqbuf(file, fh, p); if (!ret) dbgbuf(cmd, vfd, p); break; } case VIDIOC_OVERLAY: { int *i = arg; if (!ops->vidioc_overlay) break; dbgarg(cmd, ""value=%d\n"", *i); ret = ops->vidioc_overlay(file, fh, *i); break; } case VIDIOC_G_FBUF: { struct v4l2_framebuffer *p = arg; if (!ops->vidioc_g_fbuf) break; ret = ops->vidioc_g_fbuf(file, fh, arg); if (!ret) { dbgarg(cmd, ""capability=0x%x, flags=%d, base=0x%08lx\n"", p->capability, p->flags, (unsigned long)p->base); v4l_print_pix_fmt(vfd, &p->fmt); } break; } case VIDIOC_S_FBUF: { struct v4l2_framebuffer *p = arg; if (!ops->vidioc_s_fbuf) break; dbgarg(cmd, ""capability=0x%x, flags=%d, base=0x%08lx\n"", p->capability, p->flags, (unsigned long)p->base); v4l_print_pix_fmt(vfd, &p->fmt); ret = ops->vidioc_s_fbuf(file, fh, arg); break; } case VIDIOC_STREAMON: { enum v4l2_buf_type i = *(int *)arg; if (!ops->vidioc_streamon) break; dbgarg(cmd, ""type=%s\n"", prt_names(i, v4l2_type_names)); ret = ops->vidioc_streamon(file, fh, i); break; } case VIDIOC_STREAMOFF: { enum v4l2_buf_type i = *(int *)arg; if (!ops->vidioc_streamoff) break; dbgarg(cmd, ""type=%s\n"", prt_names(i, v4l2_type_names)); ret = ops->vidioc_streamoff(file, fh, i); break; } /* ---------- tv norms ---------- */ case VIDIOC_ENUMSTD: { struct v4l2_standard *p = arg; v4l2_std_id id = vfd->tvnorms, curr_id = 0; unsigned int index = p->index, i, j = 0; const char *descr = """"; /* Return norm array in a canonical way */ for (i = 0; i <= index && id; i++) { /* last std value in the standards array is 0, so this while always ends there since (id & 0) == 0. */ while ((id & standards[j].std) != standards[j].std) j++; curr_id = standards[j].std; descr = standards[j].descr; j++; if (curr_id == 0) break; if (curr_id != V4L2_STD_PAL && curr_id != V4L2_STD_SECAM && curr_id != V4L2_STD_NTSC) id &= ~curr_id; } if (i <= index) break; v4l2_video_std_construct(p, curr_id, descr); dbgarg(cmd, ""index=%d, id=0x%Lx, name=%s, fps=%d/%d, "" ""framelines=%d\n"", p->index, (unsigned long long)p->id, p->name, p->frameperiod.numerator, p->frameperiod.denominator, p->framelines); ret = 0; break; } case VIDIOC_G_STD: { v4l2_std_id *id = arg; ret = 0; /* Calls the specific handler */ if (ops->vidioc_g_std) ret = ops->vidioc_g_std(file, fh, id); else if (vfd->current_norm) *id = vfd->current_norm; else ret = -EINVAL; if (!ret) dbgarg(cmd, ""std=0x%08Lx\n"", (long long unsigned)*id); break; } case VIDIOC_S_STD: { v4l2_std_id *id = arg, norm; dbgarg(cmd, ""std=%08Lx\n"", (long long unsigned)*id); norm = (*id) & vfd->tvnorms; if (vfd->tvnorms && !norm) /* Check if std is supported */ break; /* Calls the specific handler */ if (ops->vidioc_s_std) ret = ops->vidioc_s_std(file, fh, &norm); else ret = -EINVAL; /* Updates standard information */ if (ret >= 0) vfd->current_norm = norm; break; } case VIDIOC_QUERYSTD: { v4l2_std_id *p = arg; if (!ops->vidioc_querystd) break; ret = ops->vidioc_querystd(file, fh, arg); if (!ret) dbgarg(cmd, ""detected std=%08Lx\n"", (unsigned long long)*p); break; } /* ------ input switching ---------- */ /* FIXME: Inputs can be handled inside videodev2 */ case VIDIOC_ENUMINPUT: { struct v4l2_input *p = arg; /* * We set the flags for CAP_PRESETS, CAP_CUSTOM_TIMINGS & * CAP_STD here based on ioctl handler provided by the * driver. If the driver doesn't support these * for a specific input, it must override these flags. */ if (ops->vidioc_s_std) p->capabilities |= V4L2_IN_CAP_STD; if (ops->vidioc_s_dv_preset) p->capabilities |= V4L2_IN_CAP_PRESETS; if (ops->vidioc_s_dv_timings) p->capabilities |= V4L2_IN_CAP_CUSTOM_TIMINGS; if (!ops->vidioc_enum_input) break; ret = ops->vidioc_enum_input(file, fh, p); if (!ret) dbgarg(cmd, ""index=%d, name=%s, type=%d, "" ""audioset=%d, "" ""tuner=%d, std=%08Lx, status=%d\n"", p->index, p->name, p->type, p->audioset, p->tuner, (unsigned long long)p->std, p->status); break; } case VIDIOC_G_INPUT: { unsigned int *i = arg; if (!ops->vidioc_g_input) break; ret = ops->vidioc_g_input(file, fh, i); if (!ret) dbgarg(cmd, ""value=%d\n"", *i); break; } case VIDIOC_S_INPUT: { unsigned int *i = arg; if (!ops->vidioc_s_input) break; dbgarg(cmd, ""value=%d\n"", *i); ret = ops->vidioc_s_input(file, fh, *i); break; } /* ------ output switching ---------- */ case VIDIOC_ENUMOUTPUT: { struct v4l2_output *p = arg; if (!ops->vidioc_enum_output) break; /* * We set the flags for CAP_PRESETS, CAP_CUSTOM_TIMINGS & * CAP_STD here based on ioctl handler provided by the * driver. If the driver doesn't support these * for a specific output, it must override these flags. */ if (ops->vidioc_s_std) p->capabilities |= V4L2_OUT_CAP_STD; if (ops->vidioc_s_dv_preset) p->capabilities |= V4L2_OUT_CAP_PRESETS; if (ops->vidioc_s_dv_timings) p->capabilities |= V4L2_OUT_CAP_CUSTOM_TIMINGS; ret = ops->vidioc_enum_output(file, fh, p); if (!ret) dbgarg(cmd, ""index=%d, name=%s, type=%d, "" ""audioset=0x%x, "" ""modulator=%d, std=0x%08Lx\n"", p->index, p->name, p->type, p->audioset, p->modulator, (unsigned long long)p->std); break; } case VIDIOC_G_OUTPUT: { unsigned int *i = arg; if (!ops->vidioc_g_output) break; ret = ops->vidioc_g_output(file, fh, i); if (!ret) dbgarg(cmd, ""value=%d\n"", *i); break; } case VIDIOC_S_OUTPUT: { unsigned int *i = arg; if (!ops->vidioc_s_output) break; dbgarg(cmd, ""value=%d\n"", *i); ret = ops->vidioc_s_output(file, fh, *i); break; } /* --- controls ---------------------------------------------- */ case VIDIOC_QUERYCTRL: { struct v4l2_queryctrl *p = arg; if (vfd->ctrl_handler) ret = v4l2_queryctrl(vfd->ctrl_handler, p); else if (ops->vidioc_queryctrl) ret = ops->vidioc_queryctrl(file, fh, p); else break; if (!ret) dbgarg(cmd, ""id=0x%x, type=%d, name=%s, min/max=%d/%d, "" ""step=%d, default=%d, flags=0x%08x\n"", p->id, p->type, p->name, p->minimum, p->maximum, p->step, p->default_value, p->flags); else dbgarg(cmd, ""id=0x%x\n"", p->id); break; } case VIDIOC_G_CTRL: { struct v4l2_control *p = arg; if (vfd->ctrl_handler) ret = v4l2_g_ctrl(vfd->ctrl_handler, p); else if (ops->vidioc_g_ctrl) ret = ops->vidioc_g_ctrl(file, fh, p); else if (ops->vidioc_g_ext_ctrls) { struct v4l2_ext_controls ctrls; struct v4l2_ext_control ctrl; ctrls.ctrl_class = V4L2_CTRL_ID2CLASS(p->id); ctrls.count = 1; ctrls.controls = &ctrl; ctrl.id = p->id; ctrl.value = p->value; if (check_ext_ctrls(&ctrls, 1)) { ret = ops->vidioc_g_ext_ctrls(file, fh, &ctrls); if (ret == 0) p->value = ctrl.value; } } else break; if (!ret) dbgarg(cmd, ""id=0x%x, value=%d\n"", p->id, p->value); else dbgarg(cmd, ""id=0x%x\n"", p->id); break; } case VIDIOC_S_CTRL: { struct v4l2_control *p = arg; struct v4l2_ext_controls ctrls; struct v4l2_ext_control ctrl; if (!vfd->ctrl_handler && !ops->vidioc_s_ctrl && !ops->vidioc_s_ext_ctrls) break; dbgarg(cmd, ""id=0x%x, value=%d\n"", p->id, p->value); if (vfd->ctrl_handler) { ret = v4l2_s_ctrl(vfd->ctrl_handler, p); break; } if (ops->vidioc_s_ctrl) { ret = ops->vidioc_s_ctrl(file, fh, p); break; } if (!ops->vidioc_s_ext_ctrls) break; ctrls.ctrl_class = V4L2_CTRL_ID2CLASS(p->id); ctrls.count = 1; ctrls.controls = &ctrl; ctrl.id = p->id; ctrl.value = p->value; if (check_ext_ctrls(&ctrls, 1)) ret = ops->vidioc_s_ext_ctrls(file, fh, &ctrls); break; } case VIDIOC_G_EXT_CTRLS: { struct v4l2_ext_controls *p = arg; p->error_idx = p->count; if (vfd->ctrl_handler) ret = v4l2_g_ext_ctrls(vfd->ctrl_handler, p); else if (ops->vidioc_g_ext_ctrls && check_ext_ctrls(p, 0)) ret = ops->vidioc_g_ext_ctrls(file, fh, p); else break; v4l_print_ext_ctrls(cmd, vfd, p, !ret); break; } case VIDIOC_S_EXT_CTRLS: { struct v4l2_ext_controls *p = arg; p->error_idx = p->count; if (!vfd->ctrl_handler && !ops->vidioc_s_ext_ctrls) break; v4l_print_ext_ctrls(cmd, vfd, p, 1); if (vfd->ctrl_handler) ret = v4l2_s_ext_ctrls(vfd->ctrl_handler, p); else if (check_ext_ctrls(p, 0)) ret = ops->vidioc_s_ext_ctrls(file, fh, p); break; } case VIDIOC_TRY_EXT_CTRLS: { struct v4l2_ext_controls *p = arg; p->error_idx = p->count; if (!vfd->ctrl_handler && !ops->vidioc_try_ext_ctrls) break; v4l_print_ext_ctrls(cmd, vfd, p, 1); if (vfd->ctrl_handler) ret = v4l2_try_ext_ctrls(vfd->ctrl_handler, p); else if (check_ext_ctrls(p, 0)) ret = ops->vidioc_try_ext_ctrls(file, fh, p); break; } case VIDIOC_QUERYMENU: { struct v4l2_querymenu *p = arg; if (vfd->ctrl_handler) ret = v4l2_querymenu(vfd->ctrl_handler, p); else if (ops->vidioc_querymenu) ret = ops->vidioc_querymenu(file, fh, p); else break; if (!ret) dbgarg(cmd, ""id=0x%x, index=%d, name=%s\n"", p->id, p->index, p->name); else dbgarg(cmd, ""id=0x%x, index=%d\n"", p->id, p->index); break; } /* --- audio ---------------------------------------------- */ case VIDIOC_ENUMAUDIO: { struct v4l2_audio *p = arg; if (!ops->vidioc_enumaudio) break; ret = ops->vidioc_enumaudio(file, fh, p); if (!ret) dbgarg(cmd, ""index=%d, name=%s, capability=0x%x, "" ""mode=0x%x\n"", p->index, p->name, p->capability, p->mode); else dbgarg(cmd, ""index=%d\n"", p->index); break; } case VIDIOC_G_AUDIO: { struct v4l2_audio *p = arg; if (!ops->vidioc_g_audio) break; ret = ops->vidioc_g_audio(file, fh, p); if (!ret) dbgarg(cmd, ""index=%d, name=%s, capability=0x%x, "" ""mode=0x%x\n"", p->index, p->name, p->capability, p->mode); else dbgarg(cmd, ""index=%d\n"", p->index); break; } case VIDIOC_S_AUDIO: { struct v4l2_audio *p = arg; if (!ops->vidioc_s_audio) break; dbgarg(cmd, ""index=%d, name=%s, capability=0x%x, "" ""mode=0x%x\n"", p->index, p->name, p->capability, p->mode); ret = ops->vidioc_s_audio(file, fh, p); break; } case VIDIOC_ENUMAUDOUT: { struct v4l2_audioout *p = arg; if (!ops->vidioc_enumaudout) break; dbgarg(cmd, ""Enum for index=%d\n"", p->index); ret = ops->vidioc_enumaudout(file, fh, p); if (!ret) dbgarg2(""index=%d, name=%s, capability=%d, "" ""mode=%d\n"", p->index, p->name, p->capability, p->mode); break; } case VIDIOC_G_AUDOUT: { struct v4l2_audioout *p = arg; if (!ops->vidioc_g_audout) break; ret = ops->vidioc_g_audout(file, fh, p); if (!ret) dbgarg2(""index=%d, name=%s, capability=%d, "" ""mode=%d\n"", p->index, p->name, p->capability, p->mode); break; } case VIDIOC_S_AUDOUT: { struct v4l2_audioout *p = arg; if (!ops->vidioc_s_audout) break; dbgarg(cmd, ""index=%d, name=%s, capability=%d, "" ""mode=%d\n"", p->index, p->name, p->capability, p->mode); ret = ops->vidioc_s_audout(file, fh, p); break; } case VIDIOC_G_MODULATOR: { struct v4l2_modulator *p = arg; if (!ops->vidioc_g_modulator) break; ret = ops->vidioc_g_modulator(file, fh, p); if (!ret) dbgarg(cmd, ""index=%d, name=%s, "" ""capability=%d, rangelow=%d,"" "" rangehigh=%d, txsubchans=%d\n"", p->index, p->name, p->capability, p->rangelow, p->rangehigh, p->txsubchans); break; } case VIDIOC_S_MODULATOR: { struct v4l2_modulator *p = arg; if (!ops->vidioc_s_modulator) break; dbgarg(cmd, ""index=%d, name=%s, capability=%d, "" ""rangelow=%d, rangehigh=%d, txsubchans=%d\n"", p->index, p->name, p->capability, p->rangelow, p->rangehigh, p->txsubchans); ret = ops->vidioc_s_modulator(file, fh, p); break; } case VIDIOC_G_CROP: { struct v4l2_crop *p = arg; if (!ops->vidioc_g_crop) break; dbgarg(cmd, ""type=%s\n"", prt_names(p->type, v4l2_type_names)); ret = ops->vidioc_g_crop(file, fh, p); if (!ret) dbgrect(vfd, """", &p->c); break; } case VIDIOC_S_CROP: { struct v4l2_crop *p = arg; if (!ops->vidioc_s_crop) break; dbgarg(cmd, ""type=%s\n"", prt_names(p->type, v4l2_type_names)); dbgrect(vfd, """", &p->c); ret = ops->vidioc_s_crop(file, fh, p); break; } case VIDIOC_CROPCAP: { struct v4l2_cropcap *p = arg; /*FIXME: Should also show v4l2_fract pixelaspect */ if (!ops->vidioc_cropcap) break; dbgarg(cmd, ""type=%s\n"", prt_names(p->type, v4l2_type_names)); ret = ops->vidioc_cropcap(file, fh, p); if (!ret) { dbgrect(vfd, ""bounds "", &p->bounds); dbgrect(vfd, ""defrect "", &p->defrect); } break; } case VIDIOC_G_JPEGCOMP: { struct v4l2_jpegcompression *p = arg; if (!ops->vidioc_g_jpegcomp) break; ret = ops->vidioc_g_jpegcomp(file, fh, p); if (!ret) dbgarg(cmd, ""quality=%d, APPn=%d, "" ""APP_len=%d, COM_len=%d, "" ""jpeg_markers=%d\n"", p->quality, p->APPn, p->APP_len, p->COM_len, p->jpeg_markers); break; } case VIDIOC_S_JPEGCOMP: { struct v4l2_jpegcompression *p = arg; if (!ops->vidioc_g_jpegcomp) break; dbgarg(cmd, ""quality=%d, APPn=%d, APP_len=%d, "" ""COM_len=%d, jpeg_markers=%d\n"", p->quality, p->APPn, p->APP_len, p->COM_len, p->jpeg_markers); ret = ops->vidioc_s_jpegcomp(file, fh, p); break; } case VIDIOC_G_ENC_INDEX: { struct v4l2_enc_idx *p = arg; if (!ops->vidioc_g_enc_index) break; ret = ops->vidioc_g_enc_index(file, fh, p); if (!ret) dbgarg(cmd, ""entries=%d, entries_cap=%d\n"", p->entries, p->entries_cap); break; } case VIDIOC_ENCODER_CMD: { struct v4l2_encoder_cmd *p = arg; if (!ops->vidioc_encoder_cmd) break; ret = ops->vidioc_encoder_cmd(file, fh, p); if (!ret) dbgarg(cmd, ""cmd=%d, flags=%x\n"", p->cmd, p->flags); break; } case VIDIOC_TRY_ENCODER_CMD: { struct v4l2_encoder_cmd *p = arg; if (!ops->vidioc_try_encoder_cmd) break; ret = ops->vidioc_try_encoder_cmd(file, fh, p); if (!ret) dbgarg(cmd, ""cmd=%d, flags=%x\n"", p->cmd, p->flags); break; } case VIDIOC_G_PARM: { struct v4l2_streamparm *p = arg; if (ops->vidioc_g_parm) { ret = check_fmt(ops, p->type); if (ret) break; ret = ops->vidioc_g_parm(file, fh, p); } else { v4l2_std_id std = vfd->current_norm; if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) break; ret = 0; if (ops->vidioc_g_std) ret = ops->vidioc_g_std(file, fh, &std); else if (std == 0) ret = -EINVAL; if (ret == 0) v4l2_video_std_frame_period(std, &p->parm.capture.timeperframe); } dbgarg(cmd, ""type=%d\n"", p->type); break; } case VIDIOC_S_PARM: { struct v4l2_streamparm *p = arg; if (!ops->vidioc_s_parm) break; ret = check_fmt(ops, p->type); if (ret) break; dbgarg(cmd, ""type=%d\n"", p->type); ret = ops->vidioc_s_parm(file, fh, p); break; } case VIDIOC_G_TUNER: { struct v4l2_tuner *p = arg; if (!ops->vidioc_g_tuner) break; ret = ops->vidioc_g_tuner(file, fh, p); if (!ret) dbgarg(cmd, ""index=%d, name=%s, type=%d, "" ""capability=0x%x, rangelow=%d, "" ""rangehigh=%d, signal=%d, afc=%d, "" ""rxsubchans=0x%x, audmode=%d\n"", p->index, p->name, p->type, p->capability, p->rangelow, p->rangehigh, p->signal, p->afc, p->rxsubchans, p->audmode); break; } case VIDIOC_S_TUNER: { struct v4l2_tuner *p = arg; if (!ops->vidioc_s_tuner) break; dbgarg(cmd, ""index=%d, name=%s, type=%d, "" ""capability=0x%x, rangelow=%d, "" ""rangehigh=%d, signal=%d, afc=%d, "" ""rxsubchans=0x%x, audmode=%d\n"", p->index, p->name, p->type, p->capability, p->rangelow, p->rangehigh, p->signal, p->afc, p->rxsubchans, p->audmode); ret = ops->vidioc_s_tuner(file, fh, p); break; } case VIDIOC_G_FREQUENCY: { struct v4l2_frequency *p = arg; if (!ops->vidioc_g_frequency) break; ret = ops->vidioc_g_frequency(file, fh, p); if (!ret) dbgarg(cmd, ""tuner=%d, type=%d, frequency=%d\n"", p->tuner, p->type, p->frequency); break; } case VIDIOC_S_FREQUENCY: { struct v4l2_frequency *p = arg; if (!ops->vidioc_s_frequency) break; dbgarg(cmd, ""tuner=%d, type=%d, frequency=%d\n"", p->tuner, p->type, p->frequency); ret = ops->vidioc_s_frequency(file, fh, p); break; } case VIDIOC_G_SLICED_VBI_CAP: { struct v4l2_sliced_vbi_cap *p = arg; if (!ops->vidioc_g_sliced_vbi_cap) break; /* Clear up to type, everything after type is zerod already */ memset(p, 0, offsetof(struct v4l2_sliced_vbi_cap, type)); dbgarg(cmd, ""type=%s\n"", prt_names(p->type, v4l2_type_names)); ret = ops->vidioc_g_sliced_vbi_cap(file, fh, p); if (!ret) dbgarg2(""service_set=%d\n"", p->service_set); break; } case VIDIOC_LOG_STATUS: { if (!ops->vidioc_log_status) break; ret = ops->vidioc_log_status(file, fh); break; } #ifdef CONFIG_VIDEO_ADV_DEBUG case VIDIOC_DBG_G_REGISTER: { struct v4l2_dbg_register *p = arg; if (ops->vidioc_g_register) { if (!capable(CAP_SYS_ADMIN)) ret = -EPERM; else ret = ops->vidioc_g_register(file, fh, p); } break; } case VIDIOC_DBG_S_REGISTER: { struct v4l2_dbg_register *p = arg; if (ops->vidioc_s_register) { if (!capable(CAP_SYS_ADMIN)) ret = -EPERM; else ret = ops->vidioc_s_register(file, fh, p); } break; } #endif case VIDIOC_DBG_G_CHIP_IDENT: { struct v4l2_dbg_chip_ident *p = arg; if (!ops->vidioc_g_chip_ident) break; p->ident = V4L2_IDENT_NONE; p->revision = 0; ret = ops->vidioc_g_chip_ident(file, fh, p); if (!ret) dbgarg(cmd, ""chip_ident=%u, revision=0x%x\n"", p->ident, p->revision); break; } case VIDIOC_S_HW_FREQ_SEEK: { struct v4l2_hw_freq_seek *p = arg; if (!ops->vidioc_s_hw_freq_seek) break; dbgarg(cmd, ""tuner=%d, type=%d, seek_upward=%d, wrap_around=%d\n"", p->tuner, p->type, p->seek_upward, p->wrap_around); ret = ops->vidioc_s_hw_freq_seek(file, fh, p); break; } case VIDIOC_ENUM_FRAMESIZES: { struct v4l2_frmsizeenum *p = arg; if (!ops->vidioc_enum_framesizes) break; ret = ops->vidioc_enum_framesizes(file, fh, p); dbgarg(cmd, ""index=%d, pixelformat=%c%c%c%c, type=%d "", p->index, (p->pixel_format & 0xff), (p->pixel_format >> 8) & 0xff, (p->pixel_format >> 16) & 0xff, (p->pixel_format >> 24) & 0xff, p->type); switch (p->type) { case V4L2_FRMSIZE_TYPE_DISCRETE: dbgarg3(""width = %d, height=%d\n"", p->discrete.width, p->discrete.height); break; case V4L2_FRMSIZE_TYPE_STEPWISE: dbgarg3(""min %dx%d, max %dx%d, step %dx%d\n"", p->stepwise.min_width, p->stepwise.min_height, p->stepwise.step_width, p->stepwise.step_height, p->stepwise.max_width, p->stepwise.max_height); break; case V4L2_FRMSIZE_TYPE_CONTINUOUS: dbgarg3(""continuous\n""); break; default: dbgarg3(""- Unknown type!\n""); } break; } case VIDIOC_ENUM_FRAMEINTERVALS: { struct v4l2_frmivalenum *p = arg; if (!ops->vidioc_enum_frameintervals) break; ret = ops->vidioc_enum_frameintervals(file, fh, p); dbgarg(cmd, ""index=%d, pixelformat=%d, width=%d, height=%d, type=%d "", p->index, p->pixel_format, p->width, p->height, p->type); switch (p->type) { case V4L2_FRMIVAL_TYPE_DISCRETE: dbgarg2(""fps=%d/%d\n"", p->discrete.numerator, p->discrete.denominator); break; case V4L2_FRMIVAL_TYPE_STEPWISE: dbgarg2(""min=%d/%d, max=%d/%d, step=%d/%d\n"", p->stepwise.min.numerator, p->stepwise.min.denominator, p->stepwise.max.numerator, p->stepwise.max.denominator, p->stepwise.step.numerator, p->stepwise.step.denominator); break; case V4L2_FRMIVAL_TYPE_CONTINUOUS: dbgarg2(""continuous\n""); break; default: dbgarg2(""- Unknown type!\n""); } break; } case VIDIOC_ENUM_DV_PRESETS: { struct v4l2_dv_enum_preset *p = arg; if (!ops->vidioc_enum_dv_presets) break; ret = ops->vidioc_enum_dv_presets(file, fh, p); if (!ret) dbgarg(cmd, ""index=%d, preset=%d, name=%s, width=%d,"" "" height=%d "", p->index, p->preset, p->name, p->width, p->height); break; } case VIDIOC_S_DV_PRESET: { struct v4l2_dv_preset *p = arg; if (!ops->vidioc_s_dv_preset) break; dbgarg(cmd, ""preset=%d\n"", p->preset); ret = ops->vidioc_s_dv_preset(file, fh, p); break; } case VIDIOC_G_DV_PRESET: { struct v4l2_dv_preset *p = arg; if (!ops->vidioc_g_dv_preset) break; ret = ops->vidioc_g_dv_preset(file, fh, p); if (!ret) dbgarg(cmd, ""preset=%d\n"", p->preset); break; } case VIDIOC_QUERY_DV_PRESET: { struct v4l2_dv_preset *p = arg; if (!ops->vidioc_query_dv_preset) break; ret = ops->vidioc_query_dv_preset(file, fh, p); if (!ret) dbgarg(cmd, ""preset=%d\n"", p->preset); break; } case VIDIOC_S_DV_TIMINGS: { struct v4l2_dv_timings *p = arg; if (!ops->vidioc_s_dv_timings) break; switch (p->type) { case V4L2_DV_BT_656_1120: dbgarg2(""bt-656/1120:interlaced=%d, pixelclock=%lld,"" "" width=%d, height=%d, polarities=%x,"" "" hfrontporch=%d, hsync=%d, hbackporch=%d,"" "" vfrontporch=%d, vsync=%d, vbackporch=%d,"" "" il_vfrontporch=%d, il_vsync=%d,"" "" il_vbackporch=%d\n"", p->bt.interlaced, p->bt.pixelclock, p->bt.width, p->bt.height, p->bt.polarities, p->bt.hfrontporch, p->bt.hsync, p->bt.hbackporch, p->bt.vfrontporch, p->bt.vsync, p->bt.vbackporch, p->bt.il_vfrontporch, p->bt.il_vsync, p->bt.il_vbackporch); ret = ops->vidioc_s_dv_timings(file, fh, p); break; default: dbgarg2(""Unknown type %d!\n"", p->type); break; } break; } case VIDIOC_G_DV_TIMINGS: { struct v4l2_dv_timings *p = arg; if (!ops->vidioc_g_dv_timings) break; ret = ops->vidioc_g_dv_timings(file, fh, p); if (!ret) { switch (p->type) { case V4L2_DV_BT_656_1120: dbgarg2(""bt-656/1120:interlaced=%d,"" "" pixelclock=%lld,"" "" width=%d, height=%d, polarities=%x,"" "" hfrontporch=%d, hsync=%d,"" "" hbackporch=%d, vfrontporch=%d,"" "" vsync=%d, vbackporch=%d,"" "" il_vfrontporch=%d, il_vsync=%d,"" "" il_vbackporch=%d\n"", p->bt.interlaced, p->bt.pixelclock, p->bt.width, p->bt.height, p->bt.polarities, p->bt.hfrontporch, p->bt.hsync, p->bt.hbackporch, p->bt.vfrontporch, p->bt.vsync, p->bt.vbackporch, p->bt.il_vfrontporch, p->bt.il_vsync, p->bt.il_vbackporch); break; default: dbgarg2(""Unknown type %d!\n"", p->type); break; } } break; } case VIDIOC_DQEVENT: { struct v4l2_event *ev = arg; if (!ops->vidioc_subscribe_event) break; ret = v4l2_event_dequeue(fh, ev, file->f_flags & O_NONBLOCK); if (ret < 0) { dbgarg(cmd, ""no pending events?""); break; } dbgarg(cmd, ""pending=%d, type=0x%8.8x, sequence=%d, "" ""timestamp=%lu.%9.9lu "", ev->pending, ev->type, ev->sequence, ev->timestamp.tv_sec, ev->timestamp.tv_nsec); break; } case VIDIOC_SUBSCRIBE_EVENT: { struct v4l2_event_subscription *sub = arg; if (!ops->vidioc_subscribe_event) break; ret = ops->vidioc_subscribe_event(fh, sub); if (ret < 0) { dbgarg(cmd, ""failed, ret=%ld"", ret); break; } dbgarg(cmd, ""type=0x%8.8x"", sub->type); break; } case VIDIOC_UNSUBSCRIBE_EVENT: { struct v4l2_event_subscription *sub = arg; if (!ops->vidioc_unsubscribe_event) break; ret = ops->vidioc_unsubscribe_event(fh, sub); if (ret < 0) { dbgarg(cmd, ""failed, ret=%ld"", ret); break; } dbgarg(cmd, ""type=0x%8.8x"", sub->type); break; } default: { if (!ops->vidioc_default) break; ret = ops->vidioc_default(file, fh, cmd, arg); break; } } /* switch */ if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) { if (ret < 0) { v4l_print_ioctl(vfd->name, cmd); printk(KERN_CONT "" error %ld\n"", ret); } } return ret; } ",0 "static int mailimf_ignore_unstructured_parse(const char * message, size_t length, size_t * indx) { size_t cur_token; int state; size_t terminal; cur_token = * indx; state = UNSTRUCTURED_START; terminal = cur_token; while (state != UNSTRUCTURED_OUT) { switch(state) { case UNSTRUCTURED_START: if (cur_token >= length) return MAILIMF_ERROR_PARSE; terminal = cur_token; switch(message[cur_token]) { case '\r': state = UNSTRUCTURED_CR; break; case '\n': state = UNSTRUCTURED_LF; break; default: state = UNSTRUCTURED_START; break; } break; case UNSTRUCTURED_CR: if (cur_token >= length) return MAILIMF_ERROR_PARSE; switch(message[cur_token]) { case '\n': state = UNSTRUCTURED_LF; break; default: state = UNSTRUCTURED_START; break; } break; case UNSTRUCTURED_LF: if (cur_token >= length) { state = UNSTRUCTURED_OUT; break; } switch(message[cur_token]) { case '\t': case ' ': state = UNSTRUCTURED_WSP; break; default: state = UNSTRUCTURED_OUT; break; } break; case UNSTRUCTURED_WSP: if (cur_token >= length) return MAILIMF_ERROR_PARSE; switch(message[cur_token]) { case '\r': state = UNSTRUCTURED_CR; break; case '\n': state = UNSTRUCTURED_LF; break; default: state = UNSTRUCTURED_START; break; } break; } cur_token ++; } * indx = terminal; return MAILIMF_NO_ERROR; } ",0 "gs_interp_alloc_stacks(gs_ref_memory_t *mem, gs_context_state_t * pcst) { int code; gs_ref_memory_t *smem = (gs_ref_memory_t *)gs_memory_stable((gs_memory_t *)mem); ref stk; #define REFS_SIZE_OSTACK OS_REFS_SIZE(MAX_OSTACK) #define REFS_SIZE_ESTACK ES_REFS_SIZE(MAX_ESTACK) #define REFS_SIZE_DSTACK DS_REFS_SIZE(MAX_DSTACK) code = gs_alloc_ref_array(smem, &stk, 0, REFS_SIZE_OSTACK + REFS_SIZE_ESTACK + REFS_SIZE_DSTACK, ""gs_interp_alloc_stacks""); if (code < 0) return code; { ref_stack_t *pos = &pcst->op_stack.stack; r_set_size(&stk, REFS_SIZE_OSTACK); code = ref_stack_init(pos, &stk, OS_GUARD_UNDER, OS_GUARD_OVER, NULL, smem, NULL); if (code < 0) return code; ref_stack_set_error_codes(pos, gs_error_stackunderflow, gs_error_stackoverflow); ref_stack_set_max_count(pos, MAX_OSTACK); stk.value.refs += REFS_SIZE_OSTACK; } { ref_stack_t *pes = &pcst->exec_stack.stack; ref euop; r_set_size(&stk, REFS_SIZE_ESTACK); make_oper(&euop, 0, estack_underflow); code = ref_stack_init(pes, &stk, ES_GUARD_UNDER, ES_GUARD_OVER, &euop, smem, NULL); if (code < 0) return code; ref_stack_set_error_codes(pes, gs_error_ExecStackUnderflow, gs_error_execstackoverflow); /**************** E-STACK EXPANSION IS NYI. ****************/ ref_stack_allow_expansion(pes, false); ref_stack_set_max_count(pes, MAX_ESTACK); stk.value.refs += REFS_SIZE_ESTACK; } { ref_stack_t *pds = &pcst->dict_stack.stack; r_set_size(&stk, REFS_SIZE_DSTACK); code = ref_stack_init(pds, &stk, 0, 0, NULL, smem, NULL); if (code < 0) return code; ref_stack_set_error_codes(pds, gs_error_dictstackunderflow, gs_error_dictstackoverflow); ref_stack_set_max_count(pds, MAX_DSTACK); } #undef REFS_SIZE_OSTACK #undef REFS_SIZE_ESTACK #undef REFS_SIZE_DSTACK return 0; } ",0 "void RenderFrameImpl::didCreateDocumentElement(blink::WebLocalFrame* frame) { DCHECK(!frame_ || frame_ == frame); GURL url = frame->document().url(); if (url.is_valid() && url.spec() != kAboutBlankURL) { if (frame == render_view_->webview()->mainFrame()) { render_view_->Send(new ViewHostMsg_DocumentAvailableInMainFrame( render_view_->GetRoutingID())); } } FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), DidCreateDocumentElement(frame)); } ",0 "PPB_Widget_Impl* PPB_Widget_Impl::AsPPB_Widget_Impl() { return this; } ",0 "void V8TestObject::IdAttributeGetterCallback(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_id_Getter""); test_object_v8_internal::IdAttributeGetter(info); } ",0 "static int rawv6_init_sk(struct sock *sk) { struct raw6_sock *rp = raw6_sk(sk); switch (inet_sk(sk)->inet_num) { case IPPROTO_ICMPV6: rp->checksum = 1; rp->offset = 2; break; case IPPROTO_MH: rp->checksum = 1; rp->offset = 4; break; default: break; } return 0; } ",0 "static void __exit_signal(struct task_struct *tsk) { struct signal_struct *sig = tsk->signal; struct sighand_struct *sighand; BUG_ON(!sig); BUG_ON(!atomic_read(&sig->count)); sighand = rcu_dereference(tsk->sighand); spin_lock(&sighand->siglock); posix_cpu_timers_exit(tsk); if (atomic_dec_and_test(&sig->count)) posix_cpu_timers_exit_group(tsk); else { /* * If there is any task waiting for the group exit * then notify it: */ if (sig->group_exit_task && atomic_read(&sig->count) == sig->notify_count) wake_up_process(sig->group_exit_task); if (tsk == sig->curr_target) sig->curr_target = next_thread(tsk); /* * Accumulate here the counters for all threads but the * group leader as they die, so they can be added into * the process-wide totals when those are taken. * The group leader stays around as a zombie as long * as there are other threads. When it gets reaped, * the exit.c code will add its counts into these totals. * We won't ever get here for the group leader, since it * will have been the last reference on the signal_struct. */ sig->utime = cputime_add(sig->utime, task_utime(tsk)); sig->stime = cputime_add(sig->stime, task_stime(tsk)); sig->gtime = cputime_add(sig->gtime, task_gtime(tsk)); sig->min_flt += tsk->min_flt; sig->maj_flt += tsk->maj_flt; sig->nvcsw += tsk->nvcsw; sig->nivcsw += tsk->nivcsw; sig->inblock += task_io_get_inblock(tsk); sig->oublock += task_io_get_oublock(tsk); task_io_accounting_add(&sig->ioac, &tsk->ioac); sig->sum_sched_runtime += tsk->se.sum_exec_runtime; sig = NULL; /* Marker for below. */ } __unhash_process(tsk); /* * Do this under ->siglock, we can race with another thread * doing sigqueue_free() if we have SIGQUEUE_PREALLOC signals. */ flush_sigqueue(&tsk->pending); tsk->signal = NULL; tsk->sighand = NULL; spin_unlock(&sighand->siglock); __cleanup_sighand(sighand); clear_tsk_thread_flag(tsk,TIF_SIGPENDING); if (sig) { flush_sigqueue(&sig->shared_pending); taskstats_tgid_free(sig); /* * Make sure ->signal can't go away under rq->lock, * see account_group_exec_runtime(). */ task_rq_unlock_wait(tsk); __cleanup_signal(sig); } } ",0 "void RenderFrameHostImpl::EnforceInsecureRequestPolicy( blink::WebInsecureRequestPolicy policy) { frame_tree_node()->SetInsecureRequestPolicy(policy); } ",0 "void ArcVoiceInteractionFrameworkService::OnConnectionReady() { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); if (is_request_pending_) { is_request_pending_ = false; if (is_pending_request_toggle_) { mojom::VoiceInteractionFrameworkInstance* framework_instance = ARC_GET_INSTANCE_FOR_METHOD( arc_bridge_service_->voice_interaction_framework(), ToggleVoiceInteractionSession); DCHECK(framework_instance); framework_instance->ToggleVoiceInteractionSession(IsHomescreenActive()); } else { mojom::VoiceInteractionFrameworkInstance* framework_instance = ARC_GET_INSTANCE_FOR_METHOD( arc_bridge_service_->voice_interaction_framework(), StartVoiceInteractionSession); DCHECK(framework_instance); framework_instance->StartVoiceInteractionSession(IsHomescreenActive()); } } highlighter_client_->Attach(); } ",0 "void bdt_le_test_mode(char *p) { int cmd; unsigned char buf[3]; int arg1, arg2, arg3; bdt_log(""BT LE TEST MODE""); if (!bt_enabled) { bdt_log(""Bluetooth must be enabled for le_test to work.""); return; } memset(buf, 0, sizeof(buf)); cmd = get_int(&p, 0); switch (cmd) { case 0x1: /* RX TEST */ arg1 = get_int(&p, -1); if (arg1 < 0) bdt_log(""%s Invalid arguments"", __FUNCTION__); buf[0] = arg1; status = sBtInterface->le_test_mode(HCI_LE_RECEIVER_TEST_OPCODE, buf, 1); break; case 0x2: /* TX TEST */ arg1 = get_int(&p, -1); arg2 = get_int(&p, -1); arg3 = get_int(&p, -1); if ((arg1 < 0) || (arg2 < 0) || (arg3 < 0)) bdt_log(""%s Invalid arguments"", __FUNCTION__); buf[0] = arg1; buf[1] = arg2; buf[2] = arg3; status = sBtInterface->le_test_mode(HCI_LE_TRANSMITTER_TEST_OPCODE, buf, 3); break; case 0x3: /* END TEST */ status = sBtInterface->le_test_mode(HCI_LE_END_TEST_OPCODE, buf, 0); break; default: bdt_log(""Unsupported command""); return; break; } if (status != BT_STATUS_SUCCESS) { bdt_log(""%s Test 0x%x Failed with status:0x%x"", __FUNCTION__, cmd, status); } return; } ",0 "void DiskCacheBackendTest::BackendInvalidEntry() { InitCache(); std::string key(""Some key""); disk_cache::Entry* entry; ASSERT_THAT(CreateEntry(key, &entry), IsOk()); const int kSize = 50; scoped_refptr buffer(new net::IOBuffer(kSize)); memset(buffer->data(), 0, kSize); base::strlcpy(buffer->data(), ""And the data to save"", kSize); EXPECT_EQ(kSize, WriteData(entry, 0, 0, buffer.get(), kSize, false)); SimulateCrash(); EXPECT_NE(net::OK, OpenEntry(key, &entry)); EXPECT_EQ(0, cache_->GetEntryCount()); } ",0 "int btrfs_insert_item(struct btrfs_trans_handle *trans, struct btrfs_root *root, struct btrfs_key *cpu_key, void *data, u32 data_size) { int ret = 0; struct btrfs_path *path; struct extent_buffer *leaf; unsigned long ptr; path = btrfs_alloc_path(); if (!path) return -ENOMEM; ret = btrfs_insert_empty_item(trans, root, path, cpu_key, data_size); if (!ret) { leaf = path->nodes[0]; ptr = btrfs_item_ptr_offset(leaf, path->slots[0]); write_extent_buffer(leaf, data, ptr, data_size); btrfs_mark_buffer_dirty(leaf); } btrfs_free_path(path); return ret; } ",0 "bool omx_vdec::omx_cmd_queue::insert_entry(unsigned long p1, unsigned long p2, unsigned long id) { bool ret = true; if (m_size < OMX_CORE_CONTROL_CMDQ_SIZE) { m_q[m_write].id = id; m_q[m_write].param1 = p1; m_q[m_write].param2 = p2; m_write++; m_size ++; if (m_write >= OMX_CORE_CONTROL_CMDQ_SIZE) { m_write = 0; } } else { ret = false; DEBUG_PRINT_ERROR(""ERROR: %s()::Command Queue Full"", __func__); } return ret; } ",0 "WebRunnerBrowserContext::GetBackgroundFetchDelegate() { return nullptr; } ",0 "static int perf_swevent_add(struct perf_event *event, int flags) { struct swevent_htable *swhash = &__get_cpu_var(swevent_htable); struct hw_perf_event *hwc = &event->hw; struct hlist_head *head; if (is_sampling_event(event)) { hwc->last_period = hwc->sample_period; perf_swevent_set_period(event); } hwc->state = !(flags & PERF_EF_START); head = find_swevent_head(swhash, event); if (WARN_ON_ONCE(!head)) return -EINVAL; hlist_add_head_rcu(&event->hlist_entry, head); return 0; } ",0 "void WebGLRenderingContextBase::TexImageImpl( TexImageFunctionID function_id, GLenum target, GLint level, GLint internalformat, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, Image* image, WebGLImageConversion::ImageHtmlDomSource dom_source, bool flip_y, bool premultiply_alpha, const IntRect& source_image_rect, GLsizei depth, GLint unpack_image_height) { const char* func_name = GetTexImageFunctionName(function_id); if (type == GL_UNSIGNED_INT_10F_11F_11F_REV) { type = GL_FLOAT; } Vector data; IntRect sub_rect = source_image_rect; if (sub_rect == SentinelEmptyRect()) { sub_rect = SafeGetImageSize(image); } bool selecting_sub_rectangle = false; if (!ValidateTexImageSubRectangle(func_name, function_id, image, sub_rect, depth, unpack_image_height, &selecting_sub_rectangle)) { return; } IntRect adjusted_source_image_rect = sub_rect; if (flip_y) { adjusted_source_image_rect.SetY(image->height() - adjusted_source_image_rect.MaxY()); } WebGLImageConversion::ImageExtractor image_extractor( image, dom_source, premultiply_alpha, unpack_colorspace_conversion_ == GL_NONE); if (!image_extractor.ImagePixelData()) { SynthesizeGLError(GL_INVALID_VALUE, func_name, ""bad image data""); return; } WebGLImageConversion::DataFormat source_data_format = image_extractor.ImageSourceFormat(); WebGLImageConversion::AlphaOp alpha_op = image_extractor.ImageAlphaOp(); const void* image_pixel_data = image_extractor.ImagePixelData(); bool need_conversion = true; if (type == GL_UNSIGNED_BYTE && source_data_format == WebGLImageConversion::kDataFormatRGBA8 && format == GL_RGBA && alpha_op == WebGLImageConversion::kAlphaDoNothing && !flip_y && !selecting_sub_rectangle && depth == 1) { need_conversion = false; } else { if (!WebGLImageConversion::PackImageData( image, image_pixel_data, format, type, flip_y, alpha_op, source_data_format, image_extractor.ImageWidth(), image_extractor.ImageHeight(), adjusted_source_image_rect, depth, image_extractor.ImageSourceUnpackAlignment(), unpack_image_height, data)) { SynthesizeGLError(GL_INVALID_VALUE, func_name, ""packImage error""); return; } } ScopedUnpackParametersResetRestore temporary_reset_unpack(this); if (function_id == kTexImage2D) { TexImage2DBase(target, level, internalformat, adjusted_source_image_rect.Width(), adjusted_source_image_rect.Height(), 0, format, type, need_conversion ? data.data() : image_pixel_data); } else if (function_id == kTexSubImage2D) { ContextGL()->TexSubImage2D( target, level, xoffset, yoffset, adjusted_source_image_rect.Width(), adjusted_source_image_rect.Height(), format, type, need_conversion ? data.data() : image_pixel_data); } else { if (function_id == kTexImage3D) { ContextGL()->TexImage3D( target, level, internalformat, adjusted_source_image_rect.Width(), adjusted_source_image_rect.Height(), depth, 0, format, type, need_conversion ? data.data() : image_pixel_data); } else { DCHECK_EQ(function_id, kTexSubImage3D); ContextGL()->TexSubImage3D( target, level, xoffset, yoffset, zoffset, adjusted_source_image_rect.Width(), adjusted_source_image_rect.Height(), depth, format, type, need_conversion ? data.data() : image_pixel_data); } } } ",0 "__be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope) { __be32 addr = 0; struct in_device *in_dev; struct net *net = dev_net(dev); int master_idx; rcu_read_lock(); in_dev = __in_dev_get_rcu(dev); if (!in_dev) goto no_in_dev; for_primary_ifa(in_dev) { if (ifa->ifa_scope > scope) continue; if (!dst || inet_ifa_match(dst, ifa)) { addr = ifa->ifa_local; break; } if (!addr) addr = ifa->ifa_local; } endfor_ifa(in_dev); if (addr) goto out_unlock; no_in_dev: master_idx = l3mdev_master_ifindex_rcu(dev); /* For VRFs, the VRF device takes the place of the loopback device, * with addresses on it being preferred. Note in such cases the * loopback device will be among the devices that fail the master_idx * equality check in the loop below. */ if (master_idx && (dev = dev_get_by_index_rcu(net, master_idx)) && (in_dev = __in_dev_get_rcu(dev))) { for_primary_ifa(in_dev) { if (ifa->ifa_scope != RT_SCOPE_LINK && ifa->ifa_scope <= scope) { addr = ifa->ifa_local; goto out_unlock; } } endfor_ifa(in_dev); } /* Not loopback addresses on loopback should be preferred in this case. It is important that lo is the first interface in dev_base list. */ for_each_netdev_rcu(net, dev) { if (l3mdev_master_ifindex_rcu(dev) != master_idx) continue; in_dev = __in_dev_get_rcu(dev); if (!in_dev) continue; for_primary_ifa(in_dev) { if (ifa->ifa_scope != RT_SCOPE_LINK && ifa->ifa_scope <= scope) { addr = ifa->ifa_local; goto out_unlock; } } endfor_ifa(in_dev); } out_unlock: rcu_read_unlock(); return addr; } ",0 "void ass_shrink_horz_c(int16_t *dst, const int16_t *src, uintptr_t src_width, uintptr_t src_height) { uintptr_t dst_width = (src_width + 5) >> 1; uintptr_t size = ((src_width + STRIPE_MASK) & ~STRIPE_MASK) * src_height; uintptr_t step = STRIPE_WIDTH * src_height; uintptr_t offs = 0; int16_t buf[3 * STRIPE_WIDTH]; int16_t *ptr = buf + STRIPE_WIDTH; for (uintptr_t x = 0; x < dst_width; x += STRIPE_WIDTH) { for (uintptr_t y = 0; y < src_height; ++y) { copy_line(ptr - 1 * STRIPE_WIDTH, src, offs - 1 * step, size); copy_line(ptr + 0 * STRIPE_WIDTH, src, offs + 0 * step, size); copy_line(ptr + 1 * STRIPE_WIDTH, src, offs + 1 * step, size); for (int k = 0; k < STRIPE_WIDTH; ++k) dst[k] = shrink_func(ptr[2 * k - 4], ptr[2 * k - 3], ptr[2 * k - 2], ptr[2 * k - 1], ptr[2 * k + 0], ptr[2 * k + 1]); dst += STRIPE_WIDTH; offs += STRIPE_WIDTH; } offs += step; } } ",0 "bool InspectorController::isUnderTest() { return m_isUnderTest; } ",0 " WebLocalFrame* LocalMainFrame() { return web_view_helper_->LocalMainFrame(); } ",0 "static void write_tIME_chunk(Image *image,png_struct *ping,png_info *info, const char *date) { const char *timestamp; int ret; int day, hour, minute, month, second, year; int addhours=0, addminutes=0; png_time ptime; if (date == (const char *) NULL) timestamp=GetImageProperty(image,""date:modify""); else timestamp=date; LogMagickEvent(CoderEvent,GetMagickModule(), "" Writing tIME chunk: timestamp property is %30s\n"",timestamp); ret=sscanf(timestamp,""%d-%d-%dT%d:%d:%d"",&year,&month,&day,&hour, &minute, &second); addhours=0; addminutes=0; ret=sscanf(timestamp,""%d-%d-%dT%d:%d:%d%d:%d"",&year,&month,&day,&hour, &minute, &second, &addhours, &addminutes); LogMagickEvent(CoderEvent,GetMagickModule(), "" Date format specified for png:tIME=%s"" ,timestamp); LogMagickEvent(CoderEvent,GetMagickModule(), "" ret=%d,y=%d, m=%d, d=%d, h=%d, m=%d, s=%d, ah=%d, as=%d"", ret,year,month,day,hour,minute,second,addhours,addminutes); if (ret < 6) { LogMagickEvent(CoderEvent,GetMagickModule(), "" Invalid date, ret=%d"",ret); (void) ThrowMagickException(&image->exception,GetMagickModule(),CoderError, ""Invalid date format specified for png:tIME"",""`%s' (ret=%d)"", image->filename,ret); return; } if (addhours < 0) { addhours+=24; addminutes=-addminutes; day--; } hour+=addhours; minute+=addminutes; if (day == 0) { month--; day=31; if(month == 2) day=28; else { if(month == 4 || month == 6 || month == 9 || month == 11) day=30; else day=31; } } if (month == 0) { month++; year--; } if (minute > 59) { hour++; minute-=60; } if (hour > 23) { day ++; hour -=24; } if (hour < 0) { day --; hour +=24; } /* To do: fix this for leap years */ if (day > 31 || (month == 2 && day > 28) || ((month == 4 || month == 6 || month == 9 || month == 11) && day > 30)) { month++; day = 1; } if (month > 12) { year++; month=1; } ptime.year = year; ptime.month = month; ptime.day = day; ptime.hour = hour; ptime.minute = minute; ptime.second = second; LogMagickEvent(CoderEvent,GetMagickModule(), "" png_set_tIME: y=%d, m=%d, d=%d, h=%d, m=%d, s=%d, ah=%d, am=%d"", ptime.year, ptime.month, ptime.day, ptime.hour, ptime.minute, ptime.second, addhours, addminutes); png_set_tIME(ping,info,&ptime); } ",0 "static void usb_ohci_realize_pci(PCIDevice *dev, Error **errp) { Error *err = NULL; OHCIPCIState *ohci = PCI_OHCI(dev); dev->config[PCI_CLASS_PROG] = 0x10; /* OHCI */ dev->config[PCI_INTERRUPT_PIN] = 0x01; /* interrupt pin A */ usb_ohci_init(&ohci->state, DEVICE(dev), ohci->num_ports, 0, ohci->masterbus, ohci->firstport, pci_get_address_space(dev), &err); if (err) { error_propagate(errp, err); return; } ohci->state.irq = pci_allocate_irq(dev); pci_register_bar(dev, 0, 0, &ohci->state.mem); } ",0 "static void vmx_inject_page_fault_nested(struct kvm_vcpu *vcpu, struct x86_exception *fault) { struct vmcs12 *vmcs12 = get_vmcs12(vcpu); WARN_ON(!is_guest_mode(vcpu)); /* TODO: also check PFEC_MATCH/MASK, not just EB.PF. */ if (vmcs12->exception_bitmap & (1u << PF_VECTOR)) nested_vmx_vmexit(vcpu, to_vmx(vcpu)->exit_reason, vmcs_read32(VM_EXIT_INTR_INFO), vmcs_readl(EXIT_QUALIFICATION)); else kvm_inject_page_fault(vcpu, fault); } ",0 "static inline size_t WriteChannelSize(const PSDInfo *psd_info,Image *image, const signed short channel) { size_t count; count=(size_t) WriteBlobShort(image,(const unsigned short) channel); count+=SetPSDSize(psd_info,image,0); return(count); } ",0 "alloc_pa_data(krb5_preauthtype pa_type, size_t len, krb5_pa_data **out) { krb5_pa_data *pa; uint8_t *buf = NULL; *out = NULL; if (len > 0) { buf = malloc(len); if (buf == NULL) return ENOMEM; } pa = malloc(sizeof(*pa)); if (pa == NULL) { free(buf); return ENOMEM; } pa->magic = KV5M_PA_DATA; pa->pa_type = pa_type; pa->length = len; pa->contents = buf; *out = pa; return 0; } ",0 "void CapturerMac::ScreenRefreshCallback(CGRectCount count, const CGRect *rect_array, void *user_parameter) { CapturerMac *capturer = reinterpret_cast(user_parameter); capturer->ScreenRefresh(count, rect_array); } ",0 "NetworkView* OobeUI::GetNetworkView() { return network_view_; } ",0 " static inline struct sched_entity *parent_entity(struct sched_entity *se) { return NULL; } ",0 "DownloadContent DownloadContentFromMimeType(const std::string& mime_type_string, bool record_content_subcategory) { DownloadContent download_content = DownloadContent::UNRECOGNIZED; for (const auto& entry : getMimeTypeToDownloadContentMap()) { if (entry.first == mime_type_string) { download_content = entry.second; } } if (download_content == DownloadContent::UNRECOGNIZED) { if (base::StartsWith(mime_type_string, ""text/"", base::CompareCase::SENSITIVE)) { download_content = DownloadContent::TEXT; if (record_content_subcategory) RecordDownloadTextType(mime_type_string); } else if (base::StartsWith(mime_type_string, ""image/"", base::CompareCase::SENSITIVE)) { download_content = DownloadContent::IMAGE; if (record_content_subcategory) RecordDownloadImageType(mime_type_string); } else if (base::StartsWith(mime_type_string, ""audio/"", base::CompareCase::SENSITIVE)) { download_content = DownloadContent::AUDIO; if (record_content_subcategory) RecordDownloadAudioType(mime_type_string); } else if (base::StartsWith(mime_type_string, ""video/"", base::CompareCase::SENSITIVE)) { download_content = DownloadContent::VIDEO; if (record_content_subcategory) RecordDownloadVideoType(mime_type_string); } else if (base::StartsWith(mime_type_string, ""font/"", base::CompareCase::SENSITIVE)) { download_content = DownloadContent::FONT; } } return download_content; } ",0 "find_insert(png_const_charp what, png_charp param) { png_uint_32 chunk = 0; png_charp parameter_list[1024]; int i, nparams; /* Assemble the chunk name */ for (i=0; i<4; ++i) { char ch = what[i]; if ((ch >= 65 && ch <= 90) || (ch >= 97 && ch <= 122)) chunk = (chunk << 8) + what[i]; else break; } if (i < 4 || what[4] != 0) { fprintf(stderr, ""makepng --insert \""%s\"": invalid chunk name\n"", what); exit(1); } /* Assemble the parameter list. */ nparams = find_parameters(what, param, parameter_list, 1024); # define CHUNK(a,b,c,d) (((a)<<24)+((b)<<16)+((c)<<8)+(d)) switch (chunk) { case CHUNK(105,67,67,80): /* iCCP */ if (nparams == 2) return make_insert(what, insert_iCCP, nparams, parameter_list); break; case CHUNK(116,69,88,116): /* tEXt */ if (nparams == 2) return make_insert(what, insert_tEXt, nparams, parameter_list); break; case CHUNK(122,84,88,116): /* zTXt */ if (nparams == 2) return make_insert(what, insert_zTXt, nparams, parameter_list); break; case CHUNK(105,84,88,116): /* iTXt */ if (nparams == 4) return make_insert(what, insert_iTXt, nparams, parameter_list); break; case CHUNK(104,73,83,84): /* hIST */ if (nparams <= 256) return make_insert(what, insert_hIST, nparams, parameter_list); break; #if 0 case CHUNK(115,80,76,84): /* sPLT */ return make_insert(what, insert_sPLT, nparams, parameter_list); #endif default: fprintf(stderr, ""makepng --insert \""%s\"": unrecognized chunk name\n"", what); exit(1); } bad_parameter_count(what, nparams); return NULL; } ",1 "void ewk_frame_hit_test_free(Ewk_Hit_Test* hitTest) { EINA_SAFETY_ON_NULL_RETURN(hitTest); eina_stringshare_del(hitTest->title); eina_stringshare_del(hitTest->alternate_text); eina_stringshare_del(hitTest->link.text); eina_stringshare_del(hitTest->link.url); eina_stringshare_del(hitTest->link.title); eina_stringshare_del(hitTest->image_uri); eina_stringshare_del(hitTest->media_uri); delete hitTest; } ",0 "static void __init early_reserve_initrd(void) { /* Assume only end is not page aligned */ u64 ramdisk_image = get_ramdisk_image(); u64 ramdisk_size = get_ramdisk_size(); u64 ramdisk_end = PAGE_ALIGN(ramdisk_image + ramdisk_size); if (!boot_params.hdr.type_of_loader || !ramdisk_image || !ramdisk_size) return; /* No initrd provided by bootloader */ memblock_reserve(ramdisk_image, ramdisk_end - ramdisk_image); } ",0 "static ssize_t ppp_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { struct ppp_file *pf = file->private_data; struct sk_buff *skb; ssize_t ret; if (!pf) return -ENXIO; ret = -ENOMEM; skb = alloc_skb(count + pf->hdrlen, GFP_KERNEL); if (!skb) goto out; skb_reserve(skb, pf->hdrlen); ret = -EFAULT; if (copy_from_user(skb_put(skb, count), buf, count)) { kfree_skb(skb); goto out; } skb_queue_tail(&pf->xq, skb); switch (pf->kind) { case INTERFACE: ppp_xmit_process(PF_TO_PPP(pf)); break; case CHANNEL: ppp_channel_push(PF_TO_CHANNEL(pf)); break; } ret = count; out: return ret; } ",0 "void rds_loop_exit(void) { struct rds_loop_connection *lc, *_lc; LIST_HEAD(tmp_list); /* avoid calling conn_destroy with irqs off */ spin_lock_irq(&loop_conns_lock); list_splice(&loop_conns, &tmp_list); INIT_LIST_HEAD(&loop_conns); spin_unlock_irq(&loop_conns_lock); list_for_each_entry_safe(lc, _lc, &tmp_list, loop_node) { WARN_ON(lc->conn->c_passive); rds_conn_destroy(lc->conn); } } ",0 "static int sas_configure_parent(struct domain_device *parent, struct domain_device *child, u8 *sas_addr, int include) { struct expander_device *ex_parent = &parent->ex_dev; int res = 0; int i; if (parent->parent) { res = sas_configure_parent(parent->parent, parent, sas_addr, include); if (res) return res; } if (ex_parent->conf_route_table == 0) { SAS_DPRINTK(""ex %016llx has self-configuring routing table\n"", SAS_ADDR(parent->sas_addr)); return 0; } for (i = 0; i < ex_parent->num_phys; i++) { struct ex_phy *phy = &ex_parent->ex_phy[i]; if ((phy->routing_attr == TABLE_ROUTING) && (SAS_ADDR(phy->attached_sas_addr) == SAS_ADDR(child->sas_addr))) { res = sas_configure_phy(parent, i, sas_addr, include); if (res) return res; } } return res; } ",0 "static void methodWithEnforceRangeUInt32Method(const v8::FunctionCallbackInfo& info) { ExceptionState exceptionState(ExceptionState::ExecutionContext, ""methodWithEnforceRangeUInt32"", ""TestObject"", info.Holder(), info.GetIsolate()); if (UNLIKELY(info.Length() < 1)) { exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length())); exceptionState.throwIfNeeded(); return; } TestObject* imp = V8TestObject::toNative(info.Holder()); V8TRYCATCH_EXCEPTION_VOID(unsigned, value, toUInt32(info[0], EnforceRange, exceptionState), exceptionState); imp->methodWithEnforceRangeUInt32(value); } ",0 "close_connection(struct mg_connection *conn) { #if defined(USE_SERVER_STATS) conn->conn_state = 6; /* to close */ #endif #if defined(USE_LUA) && defined(USE_WEBSOCKET) if (conn->lua_websocket_state) { lua_websocket_close(conn, conn->lua_websocket_state); conn->lua_websocket_state = NULL; } #endif mg_lock_connection(conn); /* Set close flag, so keep-alive loops will stop */ conn->must_close = 1; /* call the connection_close callback if assigned */ if (conn->phys_ctx->callbacks.connection_close != NULL) { if (conn->phys_ctx->context_type == CONTEXT_SERVER) { conn->phys_ctx->callbacks.connection_close(conn); } } /* Reset user data, after close callback is called. * Do not reuse it. If the user needs a destructor, * it must be done in the connection_close callback. */ mg_set_user_connection_data(conn, NULL); #if defined(USE_SERVER_STATS) conn->conn_state = 7; /* closing */ #endif #if !defined(NO_SSL) if (conn->ssl != NULL) { /* Run SSL_shutdown twice to ensure completely close SSL connection */ SSL_shutdown(conn->ssl); SSL_free(conn->ssl); /* Avoid CRYPTO_cleanup_all_ex_data(); See discussion: * https://wiki.openssl.org/index.php/Talk:Library_Initialization */ #if !defined(OPENSSL_API_1_1) ERR_remove_state(0); #endif conn->ssl = NULL; } #endif if (conn->client.sock != INVALID_SOCKET) { close_socket_gracefully(conn); conn->client.sock = INVALID_SOCKET; } if (conn->host) { mg_free((void *)conn->host); conn->host = NULL; } mg_unlock_connection(conn); #if defined(USE_SERVER_STATS) conn->conn_state = 8; /* closed */ #endif } ",0 "BufCompressedClose (BufFilePtr f, int doClose) { CompressedFile *file; BufFilePtr raw; file = (CompressedFile *) f->private; raw = file->file; free (file); BufFileClose (raw, doClose); return 1; } ",0 "testExternalEntityLoader(const char *URL, const char *ID, xmlParserCtxtPtr ctxt) { xmlParserInputPtr ret; if (checkTestFile(URL)) { ret = xmlNoNetExternalEntityLoader(URL, ID, ctxt); } else { int memused = xmlMemUsed(); ret = xmlNoNetExternalEntityLoader(URL, ID, ctxt); extraMemoryFromResolver += xmlMemUsed() - memused; } return(ret); } ",0 "bool SVGLayoutSupport::mapToVisualRectInAncestorSpace(const LayoutObject& object, const LayoutBoxModelObject* ancestor, const FloatRect& localPaintInvalidationRect, LayoutRect& resultRect, VisualRectFlags visualRectFlags) { AffineTransform rootBorderBoxTransform; const LayoutSVGRoot& svgRoot = computeTransformToSVGRoot(object, rootBorderBoxTransform); resultRect = transformPaintInvalidationRect(object, rootBorderBoxTransform, localPaintInvalidationRect); if (svgRoot.shouldApplyViewportClip()) { LayoutRect clipRect(svgRoot.pixelSnappedBorderBoxRect()); if (visualRectFlags & EdgeInclusive) { if (!resultRect.inclusiveIntersect(clipRect)) return false; } else { resultRect.intersect(clipRect); } } return svgRoot.mapToVisualRectInAncestorSpace(ancestor, resultRect, visualRectFlags); } ",0 "static int alpn_cb(SSL *s, const unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg) { tlsextalpnctx *alpn_ctx = arg; if (!s_quiet) { /* We can assume that |in| is syntactically valid. */ unsigned i; BIO_printf(bio_s_out, ""ALPN protocols advertised by the client: ""); for (i = 0; i < inlen;) { if (i) BIO_write(bio_s_out, "", "", 2); BIO_write(bio_s_out, &in[i + 1], in[i]); i += in[i] + 1; } BIO_write(bio_s_out, ""\n"", 1); } if (SSL_select_next_proto ((unsigned char **)out, outlen, alpn_ctx->data, alpn_ctx->len, in, inlen) != OPENSSL_NPN_NEGOTIATED) { return SSL_TLSEXT_ERR_NOACK; } if (!s_quiet) { BIO_printf(bio_s_out, ""ALPN protocols selected: ""); BIO_write(bio_s_out, *out, *outlen); BIO_write(bio_s_out, ""\n"", 1); } return SSL_TLSEXT_ERR_OK; } ",0 "cmsNAMEDCOLORLIST* CMSEXPORT cmsDupNamedColorList(const cmsNAMEDCOLORLIST* v) { cmsNAMEDCOLORLIST* NewNC; if (v == NULL) return NULL; NewNC= cmsAllocNamedColorList(v ->ContextID, v -> nColors, v ->ColorantCount, v ->Prefix, v ->Suffix); if (NewNC == NULL) return NULL; while (NewNC ->Allocated < v ->Allocated) GrowNamedColorList(NewNC); memmove(NewNC ->Prefix, v ->Prefix, sizeof(v ->Prefix)); memmove(NewNC ->Suffix, v ->Suffix, sizeof(v ->Suffix)); NewNC ->ColorantCount = v ->ColorantCount; memmove(NewNC->List, v ->List, v->nColors * sizeof(_cmsNAMEDCOLOR)); NewNC ->nColors = v ->nColors; return NewNC; } ",0 "static void ToColor_S4444_Opaque(SkColor dst[], const void* src, int width, SkColorTable*) { SkASSERT(width > 0); const SkPMColor16* s = (const SkPMColor16*)src; do { SkPMColor c = SkPixel4444ToPixel32(*s++); *dst++ = SkColorSetRGB(SkGetPackedR32(c), SkGetPackedG32(c), SkGetPackedB32(c)); } while (--width != 0); } ",0 "bool LocalDOMWindow::offscreenBuffering() const { return true; } ",0 " WillProcessResponseObserverThrottle(content::NavigationHandle* handle, bool* will_process_response_called) : NavigationThrottle(handle), will_process_response_called_(will_process_response_called) {} ",0 "static struct crypto_instance *seqiv_alloc(struct rtattr **tb) { struct crypto_attr_type *algt; struct crypto_instance *inst; int err; algt = crypto_get_attr_type(tb); if (IS_ERR(algt)) return ERR_CAST(algt); err = crypto_get_default_rng(); if (err) return ERR_PTR(err); if ((algt->type ^ CRYPTO_ALG_TYPE_AEAD) & CRYPTO_ALG_TYPE_MASK) inst = seqiv_ablkcipher_alloc(tb); else inst = seqiv_aead_alloc(tb); if (IS_ERR(inst)) goto put_rng; inst->alg.cra_alignmask |= __alignof__(u32) - 1; inst->alg.cra_ctxsize += sizeof(struct seqiv_ctx); out: return inst; put_rng: crypto_put_default_rng(); goto out; } ",0 "PHP_FUNCTION(nl_langinfo) { zend_long item; char *value; if (zend_parse_parameters(ZEND_NUM_ARGS(), ""l"", &item) == FAILURE) { return; } switch(item) { /* {{{ */ #ifdef ABDAY_1 case ABDAY_1: case ABDAY_2: case ABDAY_3: case ABDAY_4: case ABDAY_5: case ABDAY_6: case ABDAY_7: #endif #ifdef DAY_1 case DAY_1: case DAY_2: case DAY_3: case DAY_4: case DAY_5: case DAY_6: case DAY_7: #endif #ifdef ABMON_1 case ABMON_1: case ABMON_2: case ABMON_3: case ABMON_4: case ABMON_5: case ABMON_6: case ABMON_7: case ABMON_8: case ABMON_9: case ABMON_10: case ABMON_11: case ABMON_12: #endif #ifdef MON_1 case MON_1: case MON_2: case MON_3: case MON_4: case MON_5: case MON_6: case MON_7: case MON_8: case MON_9: case MON_10: case MON_11: case MON_12: #endif #ifdef AM_STR case AM_STR: #endif #ifdef PM_STR case PM_STR: #endif #ifdef D_T_FMT case D_T_FMT: #endif #ifdef D_FMT case D_FMT: #endif #ifdef T_FMT case T_FMT: #endif #ifdef T_FMT_AMPM case T_FMT_AMPM: #endif #ifdef ERA case ERA: #endif #ifdef ERA_YEAR case ERA_YEAR: #endif #ifdef ERA_D_T_FMT case ERA_D_T_FMT: #endif #ifdef ERA_D_FMT case ERA_D_FMT: #endif #ifdef ERA_T_FMT case ERA_T_FMT: #endif #ifdef ALT_DIGITS case ALT_DIGITS: #endif #ifdef INT_CURR_SYMBOL case INT_CURR_SYMBOL: #endif #ifdef CURRENCY_SYMBOL case CURRENCY_SYMBOL: #endif #ifdef CRNCYSTR case CRNCYSTR: #endif #ifdef MON_DECIMAL_POINT case MON_DECIMAL_POINT: #endif #ifdef MON_THOUSANDS_SEP case MON_THOUSANDS_SEP: #endif #ifdef MON_GROUPING case MON_GROUPING: #endif #ifdef POSITIVE_SIGN case POSITIVE_SIGN: #endif #ifdef NEGATIVE_SIGN case NEGATIVE_SIGN: #endif #ifdef INT_FRAC_DIGITS case INT_FRAC_DIGITS: #endif #ifdef FRAC_DIGITS case FRAC_DIGITS: #endif #ifdef P_CS_PRECEDES case P_CS_PRECEDES: #endif #ifdef P_SEP_BY_SPACE case P_SEP_BY_SPACE: #endif #ifdef N_CS_PRECEDES case N_CS_PRECEDES: #endif #ifdef N_SEP_BY_SPACE case N_SEP_BY_SPACE: #endif #ifdef P_SIGN_POSN case P_SIGN_POSN: #endif #ifdef N_SIGN_POSN case N_SIGN_POSN: #endif #ifdef DECIMAL_POINT case DECIMAL_POINT: #elif defined(RADIXCHAR) case RADIXCHAR: #endif #ifdef THOUSANDS_SEP case THOUSANDS_SEP: #elif defined(THOUSEP) case THOUSEP: #endif #ifdef GROUPING case GROUPING: #endif #ifdef YESEXPR case YESEXPR: #endif #ifdef NOEXPR case NOEXPR: #endif #ifdef YESSTR case YESSTR: #endif #ifdef NOSTR case NOSTR: #endif #ifdef CODESET case CODESET: #endif break; default: php_error_docref(NULL, E_WARNING, ""Item '"" ZEND_LONG_FMT ""' is not valid"", item); RETURN_FALSE; } /* }}} */ value = nl_langinfo(item); if (value == NULL) { RETURN_FALSE; } else { RETURN_STRING(value); } } ",0 "bool PrintBackendWin::IsValidPrinter(const std::string& printer_name) { ScopedPrinterHandle printer_handle; return printer_handle.OpenPrinter(base::UTF8ToWide(printer_name).c_str()); } ",0 "net::Error NavigationRequest::CheckCSPDirectives( RenderFrameHostImpl* parent, bool is_redirect, bool url_upgraded_after_redirect, bool is_response_check, CSPContext::CheckCSPDisposition disposition) { bool navigate_to_allowed = IsAllowedByCSPDirective( initiator_csp_context_.get(), CSPDirective::NavigateTo, is_redirect, url_upgraded_after_redirect, is_response_check, disposition); bool frame_src_allowed = true; if (parent) { frame_src_allowed = IsAllowedByCSPDirective( parent, CSPDirective::FrameSrc, is_redirect, url_upgraded_after_redirect, is_response_check, disposition); } if (navigate_to_allowed && frame_src_allowed) return net::OK; if (!frame_src_allowed) return net::ERR_BLOCKED_BY_CLIENT; return net::ERR_ABORTED; } ",0 "static void json_delete_object(json_object_t *object) { hashtable_close(&object->hashtable); jsonp_free(object); } ",0 "int CLASS fc (int row, int col) { static const char filter[16][16] = { { 2,1,1,3,2,3,2,0,3,2,3,0,1,2,1,0 }, { 0,3,0,2,0,1,3,1,0,1,1,2,0,3,3,2 }, { 2,3,3,2,3,1,1,3,3,1,2,1,2,0,0,3 }, { 0,1,0,1,0,2,0,2,2,0,3,0,1,3,2,1 }, { 3,1,1,2,0,1,0,2,1,3,1,3,0,1,3,0 }, { 2,0,0,3,3,2,3,1,2,0,2,0,3,2,2,1 }, { 2,3,3,1,2,1,2,1,2,1,1,2,3,0,0,1 }, { 1,0,0,2,3,0,0,3,0,3,0,3,2,1,2,3 }, { 2,3,3,1,1,2,1,0,3,2,3,0,2,3,1,3 }, { 1,0,2,0,3,0,3,2,0,1,1,2,0,1,0,2 }, { 0,1,1,3,3,2,2,1,1,3,3,0,2,1,3,2 }, { 2,3,2,0,0,1,3,0,2,0,1,2,3,0,1,0 }, { 1,3,1,2,3,2,3,2,0,2,0,1,1,0,3,0 }, { 0,2,0,3,1,0,0,1,1,3,3,2,3,2,2,1 }, { 2,1,3,2,3,1,2,1,0,3,0,2,0,2,0,2 }, { 0,3,1,0,0,2,0,3,2,1,3,1,1,3,1,3 } }; if (filters != 1) return FC(row,col); return filter[(row+top_margin) & 15][(col+left_margin) & 15]; } ",0 "void AwContents::OnPermissionRequestCanceled(AwPermissionRequest* request) { JNIEnv* env = AttachCurrentThread(); ScopedJavaLocalRef j_request = request->GetJavaObject(); ScopedJavaLocalRef j_ref = java_ref_.get(env); if (j_request.is_null() || j_ref.is_null()) return; Java_AwContents_onPermissionRequestCanceled( env, j_ref.obj(), j_request.obj()); } ",0 "bool task_set_jobctl_pending(struct task_struct *task, unsigned int mask) { BUG_ON(mask & ~(JOBCTL_PENDING_MASK | JOBCTL_STOP_CONSUME | JOBCTL_STOP_SIGMASK | JOBCTL_TRAPPING)); BUG_ON((mask & JOBCTL_TRAPPING) && !(mask & JOBCTL_PENDING_MASK)); if (unlikely(fatal_signal_pending(task) || (task->flags & PF_EXITING))) return false; if (mask & JOBCTL_STOP_SIGMASK) task->jobctl &= ~JOBCTL_STOP_SIGMASK; task->jobctl |= mask; return true; } ",0 "OMX::buffer_id OMXNodeInstance::findBufferID(OMX_BUFFERHEADERTYPE *bufferHeader) { if (bufferHeader == NULL) { return 0; } Mutex::Autolock autoLock(mBufferIDLock); return mBufferHeaderToBufferID.valueFor(bufferHeader); } ",0 "GF_Err gf_bin128_parse(const char *string, bin128 value) { u32 len; u32 i=0; if (!strnicmp(string, ""0x"", 2)) string += 2; len = (u32) strlen(string); if (len >= 32) { u32 j; for (j=0; jis_keyword_hint() && !event.IsShiftDown()) || model()->popup_model()->IsOpen())) { return true; } if (event.key_code() == ui::VKEY_ESCAPE) return model()->WillHandleEscapeKey(); return Textfield::SkipDefaultKeyEventProcessing(event); } ",0 "Eina_Bool ewk_view_setting_enable_plugins_set(Evas_Object* ewkView, Eina_Bool enable) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); enable = !!enable; if (priv->settings.enablePlugins != enable) { priv->pageSettings->setPluginsEnabled(enable); priv->settings.enablePlugins = enable; } return true; } ",0 "static int vma_expandable(struct vm_area_struct *vma, unsigned long delta) { unsigned long end = vma->vm_end + delta; if (end < vma->vm_end) /* overflow */ return 0; if (vma->vm_next && vma->vm_next->vm_start < end) /* intersection */ return 0; if (get_unmapped_area(NULL, vma->vm_start, end - vma->vm_start, 0, MAP_FIXED) & ~PAGE_MASK) return 0; return 1; } ",0 " TranslateInfoBarDelegate::AsTranslateInfoBarDelegate() { return this; } ",0 " PHP_FUNCTION(locale_compose) { smart_str loc_name_s = {0}; smart_str *loc_name = &loc_name_s; zval* arr = NULL; HashTable* hash_arr = NULL; int result = 0; intl_error_reset( NULL TSRMLS_CC ); if(zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, ""a"", &arr) == FAILURE) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, ""locale_compose: unable to parse input params"", 0 TSRMLS_CC ); RETURN_FALSE; } hash_arr = HASH_OF( arr ); if( !hash_arr || zend_hash_num_elements( hash_arr ) == 0 ) RETURN_FALSE; /* Check for grandfathered first */ result = append_key_value(loc_name, hash_arr, LOC_GRANDFATHERED_LANG_TAG); if( result == SUCCESS){ RETURN_SMART_STR(loc_name); } if( !handleAppendResult( result, loc_name TSRMLS_CC)){ RETURN_FALSE; } /* Not grandfathered */ result = append_key_value(loc_name, hash_arr , LOC_LANG_TAG); if( result == LOC_NOT_FOUND ){ intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, ""locale_compose: parameter array does not contain 'language' tag."", 0 TSRMLS_CC ); smart_str_free(loc_name); RETURN_FALSE; } if( !handleAppendResult( result, loc_name TSRMLS_CC)){ RETURN_FALSE; } /* Extlang */ result = append_multiple_key_values(loc_name, hash_arr , LOC_EXTLANG_TAG TSRMLS_CC); if( !handleAppendResult( result, loc_name TSRMLS_CC)){ RETURN_FALSE; } /* Script */ result = append_key_value(loc_name, hash_arr , LOC_SCRIPT_TAG); if( !handleAppendResult( result, loc_name TSRMLS_CC)){ RETURN_FALSE; } /* Region */ result = append_key_value( loc_name, hash_arr , LOC_REGION_TAG); if( !handleAppendResult( result, loc_name TSRMLS_CC)){ RETURN_FALSE; } /* Variant */ result = append_multiple_key_values( loc_name, hash_arr , LOC_VARIANT_TAG TSRMLS_CC); if( !handleAppendResult( result, loc_name TSRMLS_CC)){ RETURN_FALSE; } /* Private */ result = append_multiple_key_values( loc_name, hash_arr , LOC_PRIVATE_TAG TSRMLS_CC); if( !handleAppendResult( result, loc_name TSRMLS_CC)){ RETURN_FALSE; } RETURN_SMART_STR(loc_name); } ",1 "bool HostCache::RestoreFromListValue(const base::ListValue& old_cache) { for (auto it = old_cache.begin(); it != old_cache.end(); it++) { const base::DictionaryValue* entry_dict; if (!it->GetAsDictionary(&entry_dict)) return false; std::string hostname; int address_family; HostResolverFlags flags; int error = OK; std::string expiration; base::ListValue empty_list; const base::ListValue* addresses_value = &empty_list; AddressList address_list; if (!entry_dict->GetString(kHostnameKey, &hostname) || !entry_dict->GetInteger(kFlagsKey, &flags) || !entry_dict->GetInteger(kAddressFamilyKey, &address_family) || !entry_dict->GetString(kExpirationKey, &expiration)) { return false; } if (!entry_dict->GetInteger(kErrorKey, &error) && !entry_dict->GetList(kAddressesKey, &addresses_value)) { return false; } int64_t time_internal; if (!base::StringToInt64(expiration, &time_internal)) return false; base::TimeTicks expiration_time = base::TimeTicks::Now() - (base::Time::Now() - base::Time::FromInternalValue(time_internal)); Key key(hostname, static_cast(address_family), flags); if (error == OK && !AddressListFromListValue(addresses_value, &address_list)) { return false; } auto found = entries_.find(key); if (found == entries_.end() && size() < max_entries_) { AddEntry(key, Entry(error, address_list, expiration_time, network_changes_ - 1)); } } return true; } ",0 "bool ber_write_partial_OID_String(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, const char *partial_oid) { TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx); char *oid = talloc_strdup(tmp_ctx, partial_oid); char *p; /* truncate partial part so ber_write_OID_String() works */ p = strchr(oid, ':'); if (p) { *p = '\0'; p++; } if (!ber_write_OID_String(mem_ctx, blob, oid)) { talloc_free(tmp_ctx); return false; } /* Add partially encoded sub-identifier */ if (p) { DATA_BLOB tmp_blob = strhex_to_data_blob(tmp_ctx, p); if (!data_blob_append(mem_ctx, blob, tmp_blob.data, tmp_blob.length)) { talloc_free(tmp_ctx); return false; } } talloc_free(tmp_ctx); return true; } ",0 "void FS_SV_Rename( const char *from, const char *to, qboolean safe ) { char *from_ospath, *to_ospath; if ( !fs_searchpaths ) { Com_Error( ERR_FATAL, ""Filesystem call made without initialization"" ); } from_ospath = FS_BuildOSPath( fs_homepath->string, from, """" ); to_ospath = FS_BuildOSPath( fs_homepath->string, to, """" ); from_ospath[strlen( from_ospath ) - 1] = '\0'; to_ospath[strlen( to_ospath ) - 1] = '\0'; if ( fs_debug->integer ) { Com_Printf( ""FS_SV_Rename: %s --> %s\n"", from_ospath, to_ospath ); } if ( safe ) { FS_CheckFilenameIsMutable( to_ospath, __func__ ); } if ( rename( from_ospath, to_ospath ) ) { FS_CopyFile( from_ospath, to_ospath ); FS_Remove( from_ospath ); } } ",0 "static void floppy_ready(void) { if (FDCS->reset) { reset_fdc(); return; } if (start_motor(floppy_ready)) return; if (fdc_dtr()) return; debug_dcl(DP->flags, ""calling disk change from floppy_ready\n""); if (!(raw_cmd->flags & FD_RAW_NO_MOTOR) && disk_change(current_drive) && !DP->select_delay) twaddle(); /* this clears the dcl on certain * drive/controller combinations */ #ifdef fd_chose_dma_mode if ((raw_cmd->flags & FD_RAW_READ) || (raw_cmd->flags & FD_RAW_WRITE)) { unsigned long flags = claim_dma_lock(); fd_chose_dma_mode(raw_cmd->kernel_data, raw_cmd->length); release_dma_lock(flags); } #endif if (raw_cmd->flags & (FD_RAW_NEED_SEEK | FD_RAW_NEED_DISK)) { perpendicular_mode(); fdc_specify(); /* must be done here because of hut, hlt ... */ seek_floppy(); } else { if ((raw_cmd->flags & FD_RAW_READ) || (raw_cmd->flags & FD_RAW_WRITE)) fdc_specify(); setup_rw_floppy(); } } ",0 "HTMLImportsController::HTMLImportsController(Document& master) : root_(HTMLImportTreeRoot::Create(&master)) {} ",0 "static inline XMLTokenizer* getTokenizer(void* closure) { xmlParserCtxtPtr ctxt = static_cast(closure); return static_cast(ctxt->_private); } ",0 "FetchManager* FetchManager::Create(ExecutionContext* execution_context) { return new FetchManager(execution_context); } ",0 "static void objMethodWithArgsMethod(const v8::FunctionCallbackInfo& info) { ExceptionState exceptionState(ExceptionState::ExecutionContext, ""objMethodWithArgs"", ""TestObject"", info.Holder(), info.GetIsolate()); if (UNLIKELY(info.Length() < 3)) { exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(3, info.Length())); exceptionState.throwIfNeeded(); return; } TestObject* imp = V8TestObject::toNative(info.Holder()); V8TRYCATCH_EXCEPTION_VOID(int, longArg, toInt32(info[0], exceptionState), exceptionState); V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[1]); V8TRYCATCH_VOID(TestObject*, objArg, V8TestObject::toNativeWithTypeCheck(info.GetIsolate(), info[2])); v8SetReturnValue(info, imp->objMethodWithArgs(longArg, strArg, objArg)); } ",0 "void ShowExtensionInstalledBubble( const Extension* extension, Browser* browser, const SkBitmap& icon, Profile* profile) { ExtensionInstalledBubbleGtk::Show(extension, browser, icon); } ",0 "std::unique_ptr InspectorParseScriptEvent::Data( unsigned long identifier, const String& url) { String request_id = IdentifiersFactory::RequestId(identifier); std::unique_ptr value = TracedValue::Create(); value->SetString(""requestId"", request_id); value->SetString(""url"", url); return value; } ",0 " void testQueryListPair() { testQueryListPairHelper(""one+two+%26+three=%2B"", ""one two & three"", ""+""); testQueryListPairHelper(""one=two=three"", ""one"", ""two=three"", ""one=two%3Dthree""); testQueryListPairHelper(""one=two=three=four"", ""one"", ""two=three=four"", ""one=two%3Dthree%3Dfour""); } ",0 "void WebContentsImpl::SelectAll() { RenderFrameHostImpl* focused_frame = GetFocusedFrame(); if (!focused_frame) return; focused_frame->GetFrameInputHandler()->SelectAll(); RecordAction(base::UserMetricsAction(""SelectAll"")); } ",0 "EXPORTED int mboxlist_unsetquota(const char *root) { struct quota q; int r=0; if (!root[0] || root[0] == '.' || strchr(root, '/') || strchr(root, '*') || strchr(root, '%') || strchr(root, '?')) { return IMAP_MAILBOX_BADNAME; } quota_init(&q, root); r = quota_read(&q, NULL, 0); /* already unset */ if (r == IMAP_QUOTAROOT_NONEXISTENT) { r = 0; goto done; } if (r) goto done; r = quota_changelock(); /* * Have to remove it from all affected mailboxes */ mboxlist_mboxtree(root, mboxlist_rmquota, (void *)root, /*flags*/0); r = quota_deleteroot(root); quota_changelockrelease(); if (!r) sync_log_quota(root); done: quota_free(&q); return r; } ",0 "static int write_mmio(struct kvm_vcpu *vcpu, gpa_t gpa, int bytes, void *val) { trace_kvm_mmio(KVM_TRACE_MMIO_WRITE, bytes, gpa, *(u64 *)val); return vcpu_mmio_write(vcpu, gpa, bytes, val); } ",0 "bool AuthenticatorClientPinTapAgainSheetModel::IsActivityIndicatorVisible() const { return true; } ",0 "void NoopLocalSiteCharacteristicsDatabase::ReadSiteCharacteristicsFromDB( const url::Origin& origin, ReadSiteCharacteristicsFromDBCallback callback) { std::move(callback).Run(base::nullopt); } ",0 "void InterstitialPageImpl::DidNavigate( RenderViewHost* render_view_host, const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { if (!enabled()) { DontProceed(); return; } if (ui::PageTransitionCoreTypeIs(params.transition, ui::PAGE_TRANSITION_AUTO_SUBFRAME)) { return; } pause_throbber_ = true; if (!controller_->delegate()->IsHidden()) render_view_host_->GetWidget()->GetView()->Show(); controller_->delegate()->AttachInterstitialPage(this); RenderWidgetHostView* rwh_view = controller_->delegate()->GetRenderViewHost()->GetWidget()->GetView(); if (rwh_view) { if (rwh_view->HasFocus()) Focus(); rwh_view->Hide(); } } ",0 "struct fuse_req *fuse_get_req_nofail(struct fuse_conn *fc, struct file *file) { struct fuse_req *req; atomic_inc(&fc->num_waiting); wait_event(fc->blocked_waitq, !fc->blocked); req = fuse_request_alloc(); if (!req) req = get_reserved_req(fc, file); fuse_req_init_context(req); req->waiting = 1; return req; } ",0 "static int nfs4_run_open_task(struct nfs4_opendata *data, int isrecover) { struct inode *dir = data->dir->d_inode; struct nfs_server *server = NFS_SERVER(dir); struct nfs_openargs *o_arg = &data->o_arg; struct nfs_openres *o_res = &data->o_res; struct rpc_task *task; struct rpc_message msg = { .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN], .rpc_argp = o_arg, .rpc_resp = o_res, .rpc_cred = data->owner->so_cred, }; struct rpc_task_setup task_setup_data = { .rpc_client = server->client, .rpc_message = &msg, .callback_ops = &nfs4_open_ops, .callback_data = data, .workqueue = nfsiod_workqueue, .flags = RPC_TASK_ASYNC, }; int status; kref_get(&data->kref); data->rpc_done = 0; data->rpc_status = 0; data->cancelled = 0; if (isrecover) task_setup_data.callback_ops = &nfs4_recover_open_ops; task = rpc_run_task(&task_setup_data); if (IS_ERR(task)) return PTR_ERR(task); status = nfs4_wait_for_completion_rpc_task(task); if (status != 0) { data->cancelled = 1; smp_wmb(); } else status = data->rpc_status; rpc_put_task(task); return status; } ",0 " Project_x( TT_ExecContext exc, FT_Pos dx, FT_Pos dy ) { FT_UNUSED( exc ); FT_UNUSED( dy ); return dx; } ",0 "EC_KEY *d2i_EC_PUBKEY_fp(FILE *fp, EC_KEY **eckey) { return ASN1_d2i_fp_of(EC_KEY,EC_KEY_new,d2i_EC_PUBKEY,fp,eckey); } ",0 "bool VaapiVideoDecodeAccelerator::VaapiVP9Accelerator::SubmitDecode( const scoped_refptr& pic, const media::Vp9Segmentation& seg, const media::Vp9LoopFilter& lf, const std::vector>& ref_pictures) { VADecPictureParameterBufferVP9 pic_param; memset(&pic_param, 0, sizeof(pic_param)); const media::Vp9FrameHeader* frame_hdr = pic->frame_hdr.get(); DCHECK(frame_hdr); if (frame_hdr->profile != 0) { DVLOG(1) << ""Unsupported profile"" << frame_hdr->profile; return false; } pic_param.frame_width = base::checked_cast(frame_hdr->width); pic_param.frame_height = base::checked_cast(frame_hdr->height); CHECK_EQ(ref_pictures.size(), arraysize(pic_param.reference_frames)); for (size_t i = 0; i < arraysize(pic_param.reference_frames); ++i) { VASurfaceID va_surface_id; if (ref_pictures[i]) { scoped_refptr surface = VP9PictureToVaapiDecodeSurface(ref_pictures[i]); va_surface_id = surface->va_surface()->id(); } else { va_surface_id = VA_INVALID_SURFACE; } pic_param.reference_frames[i] = va_surface_id; } #define FHDR_TO_PP_PF1(a) pic_param.pic_fields.bits.a = frame_hdr->a #define FHDR_TO_PP_PF2(a, b) pic_param.pic_fields.bits.a = b FHDR_TO_PP_PF2(subsampling_x, frame_hdr->subsampling_x == 1); FHDR_TO_PP_PF2(subsampling_y, frame_hdr->subsampling_y == 1); FHDR_TO_PP_PF2(frame_type, frame_hdr->IsKeyframe() ? 0 : 1); FHDR_TO_PP_PF1(show_frame); FHDR_TO_PP_PF1(error_resilient_mode); FHDR_TO_PP_PF1(intra_only); FHDR_TO_PP_PF1(allow_high_precision_mv); FHDR_TO_PP_PF2(mcomp_filter_type, frame_hdr->interp_filter); FHDR_TO_PP_PF1(frame_parallel_decoding_mode); FHDR_TO_PP_PF2(reset_frame_context, frame_hdr->reset_context); FHDR_TO_PP_PF1(refresh_frame_context); FHDR_TO_PP_PF1(frame_context_idx); FHDR_TO_PP_PF2(segmentation_enabled, seg.enabled); FHDR_TO_PP_PF2(segmentation_temporal_update, seg.temporal_update); FHDR_TO_PP_PF2(segmentation_update_map, seg.update_map); FHDR_TO_PP_PF2(last_ref_frame, frame_hdr->frame_refs[0]); FHDR_TO_PP_PF2(last_ref_frame_sign_bias, frame_hdr->ref_sign_biases[0]); FHDR_TO_PP_PF2(golden_ref_frame, frame_hdr->frame_refs[1]); FHDR_TO_PP_PF2(golden_ref_frame_sign_bias, frame_hdr->ref_sign_biases[1]); FHDR_TO_PP_PF2(alt_ref_frame, frame_hdr->frame_refs[2]); FHDR_TO_PP_PF2(alt_ref_frame_sign_bias, frame_hdr->ref_sign_biases[2]); FHDR_TO_PP_PF2(lossless_flag, frame_hdr->quant_params.IsLossless()); #undef FHDR_TO_PP_PF2 #undef FHDR_TO_PP_PF1 pic_param.filter_level = lf.filter_level; pic_param.sharpness_level = lf.sharpness_level; pic_param.log2_tile_rows = frame_hdr->log2_tile_rows; pic_param.log2_tile_columns = frame_hdr->log2_tile_cols; pic_param.frame_header_length_in_bytes = frame_hdr->uncompressed_header_size; pic_param.first_partition_size = frame_hdr->first_partition_size; ARRAY_MEMCPY_CHECKED(pic_param.mb_segment_tree_probs, seg.tree_probs); ARRAY_MEMCPY_CHECKED(pic_param.segment_pred_probs, seg.pred_probs); pic_param.profile = frame_hdr->profile; if (!vaapi_wrapper_->SubmitBuffer(VAPictureParameterBufferType, sizeof(pic_param), &pic_param)) return false; VASliceParameterBufferVP9 slice_param; memset(&slice_param, 0, sizeof(slice_param)); slice_param.slice_data_size = frame_hdr->frame_size; slice_param.slice_data_offset = 0; slice_param.slice_data_flag = VA_SLICE_DATA_FLAG_ALL; static_assert(arraysize(media::Vp9Segmentation::feature_enabled) == arraysize(slice_param.seg_param), ""seg_param array of incorrect size""); for (size_t i = 0; i < arraysize(slice_param.seg_param); ++i) { VASegmentParameterVP9& seg_param = slice_param.seg_param[i]; #define SEG_TO_SP_SF(a, b) seg_param.segment_flags.fields.a = b SEG_TO_SP_SF( segment_reference_enabled, seg.FeatureEnabled(i, media::Vp9Segmentation::SEG_LVL_REF_FRAME)); SEG_TO_SP_SF(segment_reference, seg.FeatureData(i, media::Vp9Segmentation::SEG_LVL_REF_FRAME)); SEG_TO_SP_SF(segment_reference_skipped, seg.FeatureEnabled(i, media::Vp9Segmentation::SEG_LVL_SKIP)); #undef SEG_TO_SP_SF ARRAY_MEMCPY_CHECKED(seg_param.filter_level, lf.lvl[i]); seg_param.luma_dc_quant_scale = seg.y_dequant[i][0]; seg_param.luma_ac_quant_scale = seg.y_dequant[i][1]; seg_param.chroma_dc_quant_scale = seg.uv_dequant[i][0]; seg_param.chroma_ac_quant_scale = seg.uv_dequant[i][1]; } if (!vaapi_wrapper_->SubmitBuffer(VASliceParameterBufferType, sizeof(slice_param), &slice_param)) return false; void* non_const_ptr = const_cast(frame_hdr->data); if (!vaapi_wrapper_->SubmitBuffer(VASliceDataBufferType, frame_hdr->frame_size, non_const_ptr)) return false; scoped_refptr dec_surface = VP9PictureToVaapiDecodeSurface(pic); return vaapi_dec_->DecodeSurface(dec_surface); } ",1 " void set_wcv_resize_insets(const gfx::Size& wcv_resize_insets) { wcv_resize_insets_ = wcv_resize_insets; } ",0 " logger_get_mask_expanded (struct t_gui_buffer *buffer, const char *mask) { char *mask2, *mask_decoded, *mask_decoded2, *mask_decoded3, *mask_decoded4; char *mask_decoded5; const char *dir_separator; int length; time_t seconds; struct tm *date_tmp; mask2 = NULL; mask_decoded = NULL; mask_decoded2 = NULL; mask_decoded3 = NULL; mask_decoded4 = NULL; mask_decoded5 = NULL; dir_separator = weechat_info_get (""dir_separator"", """"); if (!dir_separator) return NULL; /* * we first replace directory separator (commonly '/') by \01 because * buffer mask can contain this char, and will be replaced by replacement * char ('_' by default) */ mask2 = weechat_string_replace (mask, dir_separator, ""\01""); if (!mask2) goto end; mask_decoded = weechat_buffer_string_replace_local_var (buffer, mask2); if (!mask_decoded) goto end; mask_decoded2 = weechat_string_replace (mask_decoded, dir_separator, weechat_config_string (logger_config_file_replacement_char)); if (!mask_decoded2) goto end; #ifdef __CYGWIN__ mask_decoded3 = weechat_string_replace (mask_decoded2, ""\\"", weechat_config_string (logger_config_file_replacement_char)); #else mask_decoded3 = strdup (mask_decoded2); #endif /* __CYGWIN__ */ if (!mask_decoded3) goto end; /* restore directory separator */ mask_decoded4 = weechat_string_replace (mask_decoded3, ""\01"", dir_separator); if (!mask_decoded4) goto end; /* replace date/time specifiers in mask */ length = strlen (mask_decoded4) + 256 + 1; mask_decoded5 = malloc (length); if (!mask_decoded5) goto end; seconds = time (NULL); date_tmp = localtime (&seconds); mask_decoded5[0] = '\0'; strftime (mask_decoded5, length - 1, mask_decoded4, date_tmp); /* convert to lower case? */ if (weechat_config_boolean (logger_config_file_name_lower_case)) weechat_string_tolower (mask_decoded5); if (weechat_logger_plugin->debug) { weechat_printf_date_tags (NULL, 0, ""no_log"", ""%s: buffer = \""%s\"", mask = \""%s\"", "" ""decoded mask = \""%s\"""", LOGGER_PLUGIN_NAME, weechat_buffer_get_string (buffer, ""name""), mask, mask_decoded5); } end: if (mask2) free (mask2); if (mask_decoded) free (mask_decoded); if (mask_decoded2) free (mask_decoded2); if (mask_decoded3) free (mask_decoded3); if (mask_decoded4) free (mask_decoded4); return mask_decoded5; } ",1 "static void cmdinfo() { fprintf(stderr, ""Image Information Utility (Version %s).\n"", JAS_VERSION); fprintf(stderr, ""Copyright (c) 2001 Michael David Adams.\n"" ""All rights reserved.\n"" ); } ",0 "xmlXPathDifference (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) { xmlNodeSetPtr ret; int i, l1; xmlNodePtr cur; if (xmlXPathNodeSetIsEmpty(nodes2)) return(nodes1); ret = xmlXPathNodeSetCreate(NULL); if (xmlXPathNodeSetIsEmpty(nodes1)) return(ret); l1 = xmlXPathNodeSetGetLength(nodes1); for (i = 0; i < l1; i++) { cur = xmlXPathNodeSetItem(nodes1, i); if (!xmlXPathNodeSetContains(nodes2, cur)) xmlXPathNodeSetAddUnique(ret, cur); } return(ret); } ",0 "MagickExport MagickBooleanType SetImageStorageClass(Image *image, const ClassType storage_class) { assert(image != (Image *) NULL); assert(image->signature == MagickSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"",image->filename); image->storage_class=storage_class; return(SyncImagePixelCache(image,&image->exception)); } ",0 "static void zend_mm_add_huge_block(zend_mm_heap *heap, void *ptr, size_t size, size_t dbg_size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) #else static void zend_mm_add_huge_block(zend_mm_heap *heap, void *ptr, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) #endif { zend_mm_huge_list *list = (zend_mm_huge_list*)zend_mm_alloc_heap(heap, sizeof(zend_mm_huge_list) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); list->ptr = ptr; list->size = size; list->next = heap->huge_list; #if ZEND_DEBUG list->dbg.size = dbg_size; list->dbg.filename = __zend_filename; list->dbg.orig_filename = __zend_orig_filename; list->dbg.lineno = __zend_lineno; list->dbg.orig_lineno = __zend_orig_lineno; #endif heap->huge_list = list; } ",0 "static void index_entry_free(git_index_entry *entry) { if (!entry) return; memset(&entry->id, 0, sizeof(entry->id)); git__free(entry); } ",0 "static void init_tg_cfs_entry(struct task_group *tg, struct cfs_rq *cfs_rq, struct sched_entity *se, int cpu, struct sched_entity *parent) { struct rq *rq = cpu_rq(cpu); tg->cfs_rq[cpu] = cfs_rq; init_cfs_rq(cfs_rq, rq); cfs_rq->tg = tg; tg->se[cpu] = se; /* se could be NULL for root_task_group */ if (!se) return; if (!parent) se->cfs_rq = &rq->cfs; else se->cfs_rq = parent->my_q; se->my_q = cfs_rq; update_load_set(&se->load, 0); se->parent = parent; } ",0 "struct dentry *d_obtain_alias(struct inode *inode) { return __d_obtain_alias(inode, 1); } ",0 "SYSCALL_DEFINE2(clock_gettime, const clockid_t, which_clock, struct __kernel_timespec __user *, tp) { const struct k_clock *kc = clockid_to_kclock(which_clock); struct timespec64 kernel_tp; int error; if (!kc) return -EINVAL; error = kc->clock_get(which_clock, &kernel_tp); if (!error && put_timespec64(&kernel_tp, tp)) error = -EFAULT; return error; } ",0 "zisofs_extract(struct archive_write *a, struct zisofs_extract *zisofs, const unsigned char *p, size_t bytes) { size_t avail; int r; if (!zisofs->initialized) { ssize_t rs = zisofs_extract_init(a, zisofs, p, bytes); if (rs < 0) return (rs); if (!zisofs->initialized) { /* We need more data. */ zisofs->pz_offset += (uint32_t)bytes; return (bytes); } avail = rs; p += bytes - avail; } else avail = bytes; /* * Get block offsets from block pointers. */ if (zisofs->block_avail == 0) { uint32_t bst, bed; if (zisofs->block_off + 4 >= zisofs->block_pointers_size) { /* There isn't a pair of offsets. */ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, ""Illegal zisofs block pointers""); return (ARCHIVE_FATAL); } bst = archive_le32dec( zisofs->block_pointers + zisofs->block_off); if (bst != zisofs->pz_offset + (bytes - avail)) { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, ""Illegal zisofs block pointers(cannot seek)""); return (ARCHIVE_FATAL); } bed = archive_le32dec( zisofs->block_pointers + zisofs->block_off + 4); if (bed < bst) { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, ""Illegal zisofs block pointers""); return (ARCHIVE_FATAL); } zisofs->block_avail = bed - bst; zisofs->block_off += 4; /* Initialize compression library for new block. */ if (zisofs->stream_valid) r = inflateReset(&zisofs->stream); else r = inflateInit(&zisofs->stream); if (r != Z_OK) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, ""Can't initialize zisofs decompression.""); return (ARCHIVE_FATAL); } zisofs->stream_valid = 1; zisofs->stream.total_in = 0; zisofs->stream.total_out = 0; } /* * Make uncompressed data. */ if (zisofs->block_avail == 0) { /* * It's basically 32K bytes NUL data. */ unsigned char *wb; size_t size, wsize; size = zisofs->uncompressed_buffer_size; while (size) { wb = wb_buffptr(a); if (size > wb_remaining(a)) wsize = wb_remaining(a); else wsize = size; memset(wb, 0, wsize); r = wb_consume(a, wsize); if (r < 0) return (r); size -= wsize; } } else { zisofs->stream.next_in = (Bytef *)(uintptr_t)(const void *)p; if (avail > zisofs->block_avail) zisofs->stream.avail_in = zisofs->block_avail; else zisofs->stream.avail_in = (uInt)avail; zisofs->stream.next_out = wb_buffptr(a); zisofs->stream.avail_out = (uInt)wb_remaining(a); r = inflate(&zisofs->stream, 0); switch (r) { case Z_OK: /* Decompressor made some progress.*/ case Z_STREAM_END: /* Found end of stream. */ break; default: archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, ""zisofs decompression failed (%d)"", r); return (ARCHIVE_FATAL); } avail -= zisofs->stream.next_in - p; zisofs->block_avail -= (uint32_t)(zisofs->stream.next_in - p); r = wb_consume(a, wb_remaining(a) - zisofs->stream.avail_out); if (r < 0) return (r); } zisofs->pz_offset += (uint32_t)bytes; return (bytes - avail); } ",0 "void Document::setReadyState(ReadyState readyState) { if (readyState == m_readyState) return; switch (readyState) { case Loading: if (!m_documentTiming.domLoading) { m_documentTiming.domLoading = monotonicallyIncreasingTime(); if (RuntimeEnabledFeatures::webAnimationsEnabled()) m_timeline->setZeroTimeAsPerfTime(m_documentTiming.domLoading); } break; case Interactive: if (!m_documentTiming.domInteractive) m_documentTiming.domInteractive = monotonicallyIncreasingTime(); break; case Complete: if (!m_documentTiming.domComplete) m_documentTiming.domComplete = monotonicallyIncreasingTime(); break; } m_readyState = readyState; dispatchEvent(Event::create(EventTypeNames::readystatechange)); } ",0 "int CMSEXPORT cmsIT8FindDataFormat(cmsHANDLE hIT8, const char* cSample) { cmsIT8* it8 = (cmsIT8*) hIT8; _cmsAssert(hIT8 != NULL); return LocateSample(it8, cSample); } ",0 "bool CheckDigestServerAuth(const AuthChallengeInfo* auth_challenge) { if (!auth_challenge) return false; EXPECT_FALSE(auth_challenge->is_proxy); EXPECT_EQ(""www.google.com:80"", auth_challenge->challenger.ToString()); EXPECT_EQ(""digestive"", auth_challenge->realm); EXPECT_EQ(""digest"", auth_challenge->scheme); return true; } ",0 "int sock_recv_all(int sock_fd, uint8_t* buf, int len) { int r = len; int ret = -1; while(r) { do ret = recv(sock_fd, buf, r, MSG_WAITALL); while(ret < 0 && errno == EINTR); if(ret <= 0) { BTIF_TRACE_ERROR(""sock fd:%d recv errno:%d, ret:%d"", sock_fd, errno, ret); return -1; } buf += ret; r -= ret; } return len; } ",1 "nfsd4_encode_stateid(struct xdr_stream *xdr, stateid_t *sid) { __be32 *p; p = xdr_reserve_space(xdr, sizeof(stateid_t)); if (!p) return nfserr_resource; *p++ = cpu_to_be32(sid->si_generation); p = xdr_encode_opaque_fixed(p, &sid->si_opaque, sizeof(stateid_opaque_t)); return 0; } ",0 "static void check_fat_state_bit(DOS_FS * fs, void *b) { if (fs->fat_bits == 32) { struct boot_sector *b32 = b; if (b32->reserved3 & FAT_STATE_DIRTY) { printf(""0x41: ""); if (print_fat_dirty_state() == '1') { b32->reserved3 &= ~FAT_STATE_DIRTY; fs_write(0, sizeof(*b32), b32); } } } else { struct boot_sector_16 *b16 = b; if (b16->reserved2 & FAT_STATE_DIRTY) { printf(""0x25: ""); if (print_fat_dirty_state() == '1') { b16->reserved2 &= ~FAT_STATE_DIRTY; fs_write(0, sizeof(*b16), b16); } } } } ",0 "static void rt_add_uncached_list(struct rtable *rt) { spin_lock_bh(&rt_uncached_lock); list_add_tail(&rt->rt_uncached, &rt_uncached_list); spin_unlock_bh(&rt_uncached_lock); } ",0 "v8::Handle V8Proxy::throwTypeError(const char* message) { return throwError(TypeError, (message ? message : ""Type error"")); } ",0 "static void nfs4_proc_write_rpc_prepare(struct rpc_task *task, struct nfs_write_data *data) { if (nfs4_setup_sequence(NFS_SERVER(data->header->inode), &data->args.seq_args, &data->res.seq_res, task)) return; rpc_call_start(task); } ",0 "WebView* RenderView::createView( WebFrame* creator, const WebWindowFeatures& features, const WebString& frame_name) { if (shared_popup_counter_->data > kMaximumNumberOfUnacknowledgedPopups) return NULL; script_can_close_ = false; ViewHostMsg_CreateWindow_Params params; params.opener_id = routing_id_; params.user_gesture = creator->isProcessingUserGesture(); params.window_container_type = WindowFeaturesToContainerType(features); params.session_storage_namespace_id = session_storage_namespace_id_; params.frame_name = frame_name; int32 routing_id = MSG_ROUTING_NONE; int64 cloned_session_storage_namespace_id; bool opener_suppressed = creator->willSuppressOpenerInNewFrame(); render_thread_->Send( new ViewHostMsg_CreateWindow(params, &routing_id, &cloned_session_storage_namespace_id)); if (routing_id == MSG_ROUTING_NONE) return NULL; RenderView* view = RenderView::Create(render_thread_, 0, routing_id_, renderer_preferences_, webkit_preferences_, shared_popup_counter_, routing_id, cloned_session_storage_namespace_id, frame_name); view->opened_by_user_gesture_ = params.user_gesture; view->opener_suppressed_ = opener_suppressed; GURL creator_url(creator->securityOrigin().toString().utf8()); if (!creator_url.is_valid() || !creator_url.IsStandard()) creator_url = GURL(); view->creator_url_ = creator_url; view->alternate_error_page_url_ = alternate_error_page_url_; return view->webview(); } ",0 "static bool cmd_read_native_max(IDEState *s, uint8_t cmd) { bool lba48 = (cmd == WIN_READ_NATIVE_MAX_EXT); /* Refuse if no sectors are addressable (e.g. medium not inserted) */ if (s->nb_sectors == 0) { ide_abort_command(s); return true; } ide_cmd_lba48_transform(s, lba48); ide_set_sector(s, s->nb_sectors - 1); return true; } ",0 "GF_Err dref_Read(GF_Box *s, GF_BitStream *bs) { GF_DataReferenceBox *ptr = (GF_DataReferenceBox *)s; if (ptr == NULL) return GF_BAD_PARAM; gf_bs_read_u32(bs); ISOM_DECREASE_SIZE(ptr, 4); return gf_isom_box_array_read(s, bs, dref_AddDataEntry); } ",0 "static void dumpRegion(String8& dump, const Region& region) { if (region.isEmpty()) { dump.append(""""); return; } bool first = true; Region::const_iterator cur = region.begin(); Region::const_iterator const tail = region.end(); while (cur != tail) { if (first) { first = false; } else { dump.append(""|""); } dump.appendFormat(""[%d,%d][%d,%d]"", cur->left, cur->top, cur->right, cur->bottom); cur++; } } ",0 "void QQuickWebView::dragMoveEvent(QDragMoveEvent* event) { Q_D(QQuickWebView); d->pageView->eventHandler()->handleDragMoveEvent(event); } ",0 " bool ChromeClientImpl::CanTakeFocus(WebFocusType) { return !LayoutTestSupport::IsRunningLayoutTest(); } ",0 "static void __net_exit default_device_exit_batch(struct list_head *net_list) { /* At exit all network devices most be removed from a network * namespace. Do this in the reverse order of registration. * Do this across as many network namespaces as possible to * improve batching efficiency. */ struct net_device *dev; struct net *net; LIST_HEAD(dev_kill_list); rtnl_lock(); list_for_each_entry(net, net_list, exit_list) { for_each_netdev_reverse(net, dev) { if (dev->rtnl_link_ops) dev->rtnl_link_ops->dellink(dev, &dev_kill_list); else unregister_netdevice_queue(dev, &dev_kill_list); } } unregister_netdevice_many(&dev_kill_list); list_del(&dev_kill_list); rtnl_unlock(); } ",0 "HRESULT DataObjectImpl::GetCanonicalFormatEtc( FORMATETC* format_etc, FORMATETC* result) { format_etc->ptd = NULL; return E_NOTIMPL; } ",0 " write_header( FT_Error error_code ) { FT_Face face; const char* basename; error = FTC_Manager_LookupFace( handle->cache_manager, handle->scaler.face_id, &face ); if ( error ) PanicZ( ""can't access font file"" ); if ( !status.header ) { basename = ft_basename( handle->current_font->filepathname ); switch ( error_code ) { case FT_Err_Ok: sprintf( status.header_buffer, ""%s %s (file `%s')"", face->family_name, face->style_name, basename ); break; case FT_Err_Invalid_Pixel_Size: sprintf( status.header_buffer, ""Invalid pixel size (file `%s')"", basename ); break; case FT_Err_Invalid_PPem: sprintf( status.header_buffer, ""Invalid ppem value (file `%s')"", basename ); break; default: sprintf( status.header_buffer, ""File `%s': error 0x%04x"", basename, (FT_UShort)error_code ); break; } status.header = status.header_buffer; } grWriteCellString( display->bitmap, 0, 0, status.header, display->fore_color ); sprintf( status.header_buffer, ""at %g points, angle = %d"", status.ptsize/64.0, status.angle ); grWriteCellString( display->bitmap, 0, CELLSTRING_HEIGHT, status.header_buffer, display->fore_color ); grRefreshSurface( display->surface ); } ",1 "static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64]) { Mpeg4DecContext *ctx = s->avctx->priv_data; int cbpc, cbpy, i, cbp, pred_x, pred_y, mx, my, dquant; int16_t *mot_val; static const int8_t quant_tab[4] = { -1, -2, 1, 2 }; const int xy = s->mb_x + s->mb_y * s->mb_stride; av_assert2(s == (void*)ctx); av_assert2(s->h263_pred); if (s->pict_type == AV_PICTURE_TYPE_P || s->pict_type == AV_PICTURE_TYPE_S) { do { if (get_bits1(&s->gb)) { /* skip mb */ s->mb_intra = 0; for (i = 0; i < 6; i++) s->block_last_index[i] = -1; s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; if (s->pict_type == AV_PICTURE_TYPE_S && ctx->vol_sprite_usage == GMC_SPRITE) { s->current_picture.mb_type[xy] = MB_TYPE_SKIP | MB_TYPE_GMC | MB_TYPE_16x16 | MB_TYPE_L0; s->mcsel = 1; s->mv[0][0][0] = get_amv(ctx, 0); s->mv[0][0][1] = get_amv(ctx, 1); s->mb_skipped = 0; } else { s->current_picture.mb_type[xy] = MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0; s->mcsel = 0; s->mv[0][0][0] = 0; s->mv[0][0][1] = 0; s->mb_skipped = 1; } goto end; } cbpc = get_vlc2(&s->gb, ff_h263_inter_MCBPC_vlc.table, INTER_MCBPC_VLC_BITS, 2); if (cbpc < 0) { av_log(s->avctx, AV_LOG_ERROR, ""mcbpc damaged at %d %d\n"", s->mb_x, s->mb_y); return AVERROR_INVALIDDATA; } } while (cbpc == 20); s->bdsp.clear_blocks(s->block[0]); dquant = cbpc & 8; s->mb_intra = ((cbpc & 4) != 0); if (s->mb_intra) goto intra; if (s->pict_type == AV_PICTURE_TYPE_S && ctx->vol_sprite_usage == GMC_SPRITE && (cbpc & 16) == 0) s->mcsel = get_bits1(&s->gb); else s->mcsel = 0; cbpy = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1) ^ 0x0F; if (cbpy < 0) { av_log(s->avctx, AV_LOG_ERROR, ""P cbpy damaged at %d %d\n"", s->mb_x, s->mb_y); return AVERROR_INVALIDDATA; } cbp = (cbpc & 3) | (cbpy << 2); if (dquant) ff_set_qscale(s, s->qscale + quant_tab[get_bits(&s->gb, 2)]); if ((!s->progressive_sequence) && (cbp || (s->workaround_bugs & FF_BUG_XVID_ILACE))) s->interlaced_dct = get_bits1(&s->gb); s->mv_dir = MV_DIR_FORWARD; if ((cbpc & 16) == 0) { if (s->mcsel) { s->current_picture.mb_type[xy] = MB_TYPE_GMC | MB_TYPE_16x16 | MB_TYPE_L0; /* 16x16 global motion prediction */ s->mv_type = MV_TYPE_16X16; mx = get_amv(ctx, 0); my = get_amv(ctx, 1); s->mv[0][0][0] = mx; s->mv[0][0][1] = my; } else if ((!s->progressive_sequence) && get_bits1(&s->gb)) { s->current_picture.mb_type[xy] = MB_TYPE_16x8 | MB_TYPE_L0 | MB_TYPE_INTERLACED; /* 16x8 field motion prediction */ s->mv_type = MV_TYPE_FIELD; s->field_select[0][0] = get_bits1(&s->gb); s->field_select[0][1] = get_bits1(&s->gb); ff_h263_pred_motion(s, 0, 0, &pred_x, &pred_y); for (i = 0; i < 2; i++) { mx = ff_h263_decode_motion(s, pred_x, s->f_code); if (mx >= 0xffff) return AVERROR_INVALIDDATA; my = ff_h263_decode_motion(s, pred_y / 2, s->f_code); if (my >= 0xffff) return AVERROR_INVALIDDATA; s->mv[0][i][0] = mx; s->mv[0][i][1] = my; } } else { s->current_picture.mb_type[xy] = MB_TYPE_16x16 | MB_TYPE_L0; /* 16x16 motion prediction */ s->mv_type = MV_TYPE_16X16; ff_h263_pred_motion(s, 0, 0, &pred_x, &pred_y); mx = ff_h263_decode_motion(s, pred_x, s->f_code); if (mx >= 0xffff) return AVERROR_INVALIDDATA; my = ff_h263_decode_motion(s, pred_y, s->f_code); if (my >= 0xffff) return AVERROR_INVALIDDATA; s->mv[0][0][0] = mx; s->mv[0][0][1] = my; } } else { s->current_picture.mb_type[xy] = MB_TYPE_8x8 | MB_TYPE_L0; s->mv_type = MV_TYPE_8X8; for (i = 0; i < 4; i++) { mot_val = ff_h263_pred_motion(s, i, 0, &pred_x, &pred_y); mx = ff_h263_decode_motion(s, pred_x, s->f_code); if (mx >= 0xffff) return AVERROR_INVALIDDATA; my = ff_h263_decode_motion(s, pred_y, s->f_code); if (my >= 0xffff) return AVERROR_INVALIDDATA; s->mv[0][i][0] = mx; s->mv[0][i][1] = my; mot_val[0] = mx; mot_val[1] = my; } } } else if (s->pict_type == AV_PICTURE_TYPE_B) { int modb1; // first bit of modb int modb2; // second bit of modb int mb_type; s->mb_intra = 0; // B-frames never contain intra blocks s->mcsel = 0; // ... true gmc blocks if (s->mb_x == 0) { for (i = 0; i < 2; i++) { s->last_mv[i][0][0] = s->last_mv[i][0][1] = s->last_mv[i][1][0] = s->last_mv[i][1][1] = 0; } ff_thread_await_progress(&s->next_picture_ptr->tf, s->mb_y, 0); } /* if we skipped it in the future P-frame than skip it now too */ s->mb_skipped = s->next_picture.mbskip_table[s->mb_y * s->mb_stride + s->mb_x]; // Note, skiptab=0 if last was GMC if (s->mb_skipped) { /* skip mb */ for (i = 0; i < 6; i++) s->block_last_index[i] = -1; s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; s->mv[0][0][0] = s->mv[0][0][1] = s->mv[1][0][0] = s->mv[1][0][1] = 0; s->current_picture.mb_type[xy] = MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0; goto end; } modb1 = get_bits1(&s->gb); if (modb1) { mb_type = MB_TYPE_DIRECT2 | MB_TYPE_SKIP | MB_TYPE_L0L1; cbp = 0; } else { modb2 = get_bits1(&s->gb); mb_type = get_vlc2(&s->gb, mb_type_b_vlc.table, MB_TYPE_B_VLC_BITS, 1); if (mb_type < 0) { av_log(s->avctx, AV_LOG_ERROR, ""illegal MB_type\n""); return AVERROR_INVALIDDATA; } mb_type = mb_type_b_map[mb_type]; if (modb2) { cbp = 0; } else { s->bdsp.clear_blocks(s->block[0]); cbp = get_bits(&s->gb, 6); } if ((!IS_DIRECT(mb_type)) && cbp) { if (get_bits1(&s->gb)) ff_set_qscale(s, s->qscale + get_bits1(&s->gb) * 4 - 2); } if (!s->progressive_sequence) { if (cbp) s->interlaced_dct = get_bits1(&s->gb); if (!IS_DIRECT(mb_type) && get_bits1(&s->gb)) { mb_type |= MB_TYPE_16x8 | MB_TYPE_INTERLACED; mb_type &= ~MB_TYPE_16x16; if (USES_LIST(mb_type, 0)) { s->field_select[0][0] = get_bits1(&s->gb); s->field_select[0][1] = get_bits1(&s->gb); } if (USES_LIST(mb_type, 1)) { s->field_select[1][0] = get_bits1(&s->gb); s->field_select[1][1] = get_bits1(&s->gb); } } } s->mv_dir = 0; if ((mb_type & (MB_TYPE_DIRECT2 | MB_TYPE_INTERLACED)) == 0) { s->mv_type = MV_TYPE_16X16; if (USES_LIST(mb_type, 0)) { s->mv_dir = MV_DIR_FORWARD; mx = ff_h263_decode_motion(s, s->last_mv[0][0][0], s->f_code); my = ff_h263_decode_motion(s, s->last_mv[0][0][1], s->f_code); s->last_mv[0][1][0] = s->last_mv[0][0][0] = s->mv[0][0][0] = mx; s->last_mv[0][1][1] = s->last_mv[0][0][1] = s->mv[0][0][1] = my; } if (USES_LIST(mb_type, 1)) { s->mv_dir |= MV_DIR_BACKWARD; mx = ff_h263_decode_motion(s, s->last_mv[1][0][0], s->b_code); my = ff_h263_decode_motion(s, s->last_mv[1][0][1], s->b_code); s->last_mv[1][1][0] = s->last_mv[1][0][0] = s->mv[1][0][0] = mx; s->last_mv[1][1][1] = s->last_mv[1][0][1] = s->mv[1][0][1] = my; } } else if (!IS_DIRECT(mb_type)) { s->mv_type = MV_TYPE_FIELD; if (USES_LIST(mb_type, 0)) { s->mv_dir = MV_DIR_FORWARD; for (i = 0; i < 2; i++) { mx = ff_h263_decode_motion(s, s->last_mv[0][i][0], s->f_code); my = ff_h263_decode_motion(s, s->last_mv[0][i][1] / 2, s->f_code); s->last_mv[0][i][0] = s->mv[0][i][0] = mx; s->last_mv[0][i][1] = (s->mv[0][i][1] = my) * 2; } } if (USES_LIST(mb_type, 1)) { s->mv_dir |= MV_DIR_BACKWARD; for (i = 0; i < 2; i++) { mx = ff_h263_decode_motion(s, s->last_mv[1][i][0], s->b_code); my = ff_h263_decode_motion(s, s->last_mv[1][i][1] / 2, s->b_code); s->last_mv[1][i][0] = s->mv[1][i][0] = mx; s->last_mv[1][i][1] = (s->mv[1][i][1] = my) * 2; } } } } if (IS_DIRECT(mb_type)) { if (IS_SKIP(mb_type)) { mx = my = 0; } else { mx = ff_h263_decode_motion(s, 0, 1); my = ff_h263_decode_motion(s, 0, 1); } s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT; mb_type |= ff_mpeg4_set_direct_mv(s, mx, my); } s->current_picture.mb_type[xy] = mb_type; } else { /* I-Frame */ do { cbpc = get_vlc2(&s->gb, ff_h263_intra_MCBPC_vlc.table, INTRA_MCBPC_VLC_BITS, 2); if (cbpc < 0) { av_log(s->avctx, AV_LOG_ERROR, ""I cbpc damaged at %d %d\n"", s->mb_x, s->mb_y); return AVERROR_INVALIDDATA; } } while (cbpc == 8); dquant = cbpc & 4; s->mb_intra = 1; intra: s->ac_pred = get_bits1(&s->gb); if (s->ac_pred) s->current_picture.mb_type[xy] = MB_TYPE_INTRA | MB_TYPE_ACPRED; else s->current_picture.mb_type[xy] = MB_TYPE_INTRA; cbpy = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1); if (cbpy < 0) { av_log(s->avctx, AV_LOG_ERROR, ""I cbpy damaged at %d %d\n"", s->mb_x, s->mb_y); return AVERROR_INVALIDDATA; } cbp = (cbpc & 3) | (cbpy << 2); ctx->use_intra_dc_vlc = s->qscale < ctx->intra_dc_threshold; if (dquant) ff_set_qscale(s, s->qscale + quant_tab[get_bits(&s->gb, 2)]); if (!s->progressive_sequence) s->interlaced_dct = get_bits1(&s->gb); s->bdsp.clear_blocks(s->block[0]); /* decode each block */ for (i = 0; i < 6; i++) { if (mpeg4_decode_block(ctx, block[i], i, cbp & 32, 1, 0) < 0) return AVERROR_INVALIDDATA; cbp += cbp; } goto end; } /* decode each block */ for (i = 0; i < 6; i++) { if (mpeg4_decode_block(ctx, block[i], i, cbp & 32, 0, 0) < 0) return AVERROR_INVALIDDATA; cbp += cbp; } end: /* per-MB end of slice check */ if (s->codec_id == AV_CODEC_ID_MPEG4) { int next = mpeg4_is_resync(ctx); if (next) { if (s->mb_x + s->mb_y*s->mb_width + 1 > next && (s->avctx->err_recognition & AV_EF_AGGRESSIVE)) { return AVERROR_INVALIDDATA; } else if (s->mb_x + s->mb_y*s->mb_width + 1 >= next) return SLICE_END; if (s->pict_type == AV_PICTURE_TYPE_B) { const int delta= s->mb_x + 1 == s->mb_width ? 2 : 1; ff_thread_await_progress(&s->next_picture_ptr->tf, (s->mb_x + delta >= s->mb_width) ? FFMIN(s->mb_y + 1, s->mb_height - 1) : s->mb_y, 0); if (s->next_picture.mbskip_table[xy + delta]) return SLICE_OK; } return SLICE_END; } } return SLICE_OK; } ",0 "WORD32 ih264d_set_default_params(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op) { dec_struct_t * ps_dec; WORD32 ret = IV_SUCCESS; ivd_ctl_set_config_op_t *ps_ctl_op = (ivd_ctl_set_config_op_t *)pv_api_op; ps_dec = (dec_struct_t *)(dec_hdl->pv_codec_handle); UNUSED(pv_api_ip); { ps_dec->u4_app_disp_width = 0; ps_dec->u4_skip_frm_mask = 0; ps_dec->i4_decode_header = 1; ps_ctl_op->u4_error_code = 0; } return ret; } ",0 " error_callback( png_structp png, png_const_charp error_msg ) { FT_Error* error = (FT_Error*)png_get_error_ptr( png ); FT_UNUSED( error_msg ); *error = FT_THROW( Out_Of_Memory ); #ifdef PNG_SETJMP_SUPPORTED ft_longjmp( png_jmpbuf( png ), 1 ); #endif /* if we get here, then we have no choice but to abort ... */ } ",0 "static PassRefPtr valueForGridTrackBreadth(const Length& trackLength, const RenderStyle* style) { if (trackLength.isPercent()) return cssValuePool().createValue(trackLength); if (trackLength.isAuto()) return cssValuePool().createIdentifierValue(CSSValueAuto); return zoomAdjustedPixelValue(trackLength.value(), style); } ",0 "add_async_iorequest(uint32 device, uint32 file, uint32 id, uint32 major, uint32 length, DEVICE_FNS * fns, uint32 total_timeout, uint32 interval_timeout, uint8 * buffer, uint32 offset) { struct async_iorequest *iorq; if (g_iorequest == NULL) { g_iorequest = (struct async_iorequest *) xmalloc(sizeof(struct async_iorequest)); if (!g_iorequest) return False; g_iorequest->fd = 0; g_iorequest->next = NULL; } iorq = g_iorequest; while (iorq->fd != 0) { /* create new element if needed */ if (iorq->next == NULL) { iorq->next = (struct async_iorequest *) xmalloc(sizeof(struct async_iorequest)); if (!iorq->next) return False; iorq->next->fd = 0; iorq->next->next = NULL; } iorq = iorq->next; } iorq->device = device; iorq->fd = file; iorq->id = id; iorq->major = major; iorq->length = length; iorq->partial_len = 0; iorq->fns = fns; iorq->timeout = total_timeout; iorq->itv_timeout = interval_timeout; iorq->buffer = buffer; iorq->offset = offset; return True; } ",0 "xmlReadFd(int fd, const char *URL, const char *encoding, int options) { xmlParserCtxtPtr ctxt; xmlParserInputBufferPtr input; xmlParserInputPtr stream; if (fd < 0) return (NULL); xmlInitParser(); input = xmlParserInputBufferCreateFd(fd, XML_CHAR_ENCODING_NONE); if (input == NULL) return (NULL); input->closecallback = NULL; ctxt = xmlNewParserCtxt(); if (ctxt == NULL) { xmlFreeParserInputBuffer(input); return (NULL); } stream = xmlNewIOInputStream(ctxt, input, XML_CHAR_ENCODING_NONE); if (stream == NULL) { xmlFreeParserInputBuffer(input); xmlFreeParserCtxt(ctxt); return (NULL); } inputPush(ctxt, stream); return (xmlDoRead(ctxt, URL, encoding, options, 0)); } ",0 "static BrotliResult ReadSymbolCodeLengths( uint32_t alphabet_size, BrotliState* s) { BrotliBitReader* br = &s->br; uint32_t symbol = s->symbol; uint32_t repeat = s->repeat; uint32_t space = s->space; uint32_t prev_code_len = s->prev_code_len; uint32_t repeat_code_len = s->repeat_code_len; uint16_t* symbol_lists = s->symbol_lists; uint16_t* code_length_histo = s->code_length_histo; int* next_symbol = s->next_symbol; if (!BrotliWarmupBitReader(br)) { return BROTLI_RESULT_NEEDS_MORE_INPUT; } while (symbol < alphabet_size && space > 0) { const HuffmanCode* p = s->table; uint32_t code_len; if (!BrotliCheckInputAmount(br, BROTLI_SHORT_FILL_BIT_WINDOW_READ)) { s->symbol = symbol; s->repeat = repeat; s->prev_code_len = prev_code_len; s->repeat_code_len = repeat_code_len; s->space = space; return BROTLI_RESULT_NEEDS_MORE_INPUT; } BrotliFillBitWindow16(br); p += BrotliGetBitsUnmasked(br) & BitMask(BROTLI_HUFFMAN_MAX_CODE_LENGTH_CODE_LENGTH); BrotliDropBits(br, p->bits); /* Use 1..5 bits */ code_len = p->value; /* code_len == 0..17 */ if (code_len < kCodeLengthRepeatCode) { ProcessSingleCodeLength(code_len, &symbol, &repeat, &space, &prev_code_len, symbol_lists, code_length_histo, next_symbol); } else { /* code_len == 16..17, extra_bits == 2..3 */ uint32_t repeat_delta = (uint32_t)BrotliGetBitsUnmasked(br) & BitMask(code_len - 14U); BrotliDropBits(br, code_len - 14U); ProcessRepeatedCodeLength(code_len, repeat_delta, alphabet_size, &symbol, &repeat, &space, &prev_code_len, &repeat_code_len, symbol_lists, code_length_histo, next_symbol); } } s->space = space; return BROTLI_RESULT_SUCCESS; } ",0 "static v8::Handle overloadedMethod4Callback(const v8::Arguments& args) { INC_STATS(""DOM.TestObj.overloadedMethod4""); if (args.Length() < 1) return V8Proxy::throwNotEnoughArgumentsError(); TestObj* imp = V8TestObj::toNative(args.Holder()); EXCEPTION_BLOCK(int, intArg, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))); imp->overloadedMethod(intArg); return v8::Handle(); } ",1 "void Browser::SetSuggestedText(const string16& text, InstantCompleteBehavior behavior) { if (window()->GetLocationBar()) window()->GetLocationBar()->SetSuggestedText(text, behavior); } ",0 "int dom_document_document_element_read(dom_object *obj, zval **retval TSRMLS_DC) { xmlDoc *docp; xmlNode *root; int ret; docp = (xmlDocPtr) dom_object_get_node(obj); if (docp == NULL) { php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC); return FAILURE; } ALLOC_ZVAL(*retval); root = xmlDocGetRootElement(docp); if (!root) { ZVAL_NULL(*retval); return SUCCESS; } if (NULL == (*retval = php_dom_create_object(root, &ret, *retval, obj TSRMLS_CC))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Cannot create required DOM object""); return FAILURE; } return SUCCESS; } ",0 "static bool CharacterIsValidForGLES(unsigned char c) { if (c >= 32 && c <= 126 && c != '""' && c != '$' && c != '`' && c != '@' && c != '\\' && c != '\'') { return true; } if (c >= 9 && c <= 13) { return true; } return false; } ",0 " virtual status_t getPropertyByteArray(String8 const &name, Vector &value) const { Parcel data, reply; data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); data.writeString8(name); status_t status = remote()->transact(GET_PROPERTY_BYTE_ARRAY, data, &reply); if (status != OK) { return status; } readVector(reply, value); return reply.readInt32(); } ",0 "bool RenderLayerCompositor::requiresCompositingForFrame(RenderObject* renderer) const { if (!renderer->isRenderPart()) return false; RenderPart* frameRenderer = toRenderPart(renderer); if (!frameRenderer->requiresAcceleratedCompositing()) return false; if (frameRenderer->node() && frameRenderer->node()->isFrameOwnerElement() && toHTMLFrameOwnerElement(frameRenderer->node())->contentFrame() && toHTMLFrameOwnerElement(frameRenderer->node())->contentFrame()->remotePlatformLayer()) return true; m_needsToRecomputeCompositingRequirements = true; RenderLayerCompositor* innerCompositor = frameContentsCompositor(frameRenderer); if (!innerCompositor) return false; if (renderer->needsLayout()) return frameRenderer->hasLayer() && frameRenderer->layer()->hasCompositedLayerMapping(); IntRect contentBox = pixelSnappedIntRect(frameRenderer->contentBoxRect()); return contentBox.height() * contentBox.width() > 0; } ",0 "void hrtick_start(struct rq *rq, u64 delay) { /* * Don't schedule slices shorter than 10000ns, that just * doesn't make sense. Rely on vruntime for fairness. */ delay = max_t(u64, delay, 10000LL); hrtimer_start(&rq->hrtick_timer, ns_to_ktime(delay), HRTIMER_MODE_REL_PINNED); } ",0 " virtual scoped_ptr Upgrade() { NOTREACHED(); return scoped_ptr(); } ",0 "static void check_wp(void) { if (test_bit(FD_VERIFY_BIT, &DRS->flags)) { /* check write protection */ output_byte(FD_GETSTATUS); output_byte(UNIT(current_drive)); if (result() != 1) { FDCS->reset = 1; return; } clear_bit(FD_VERIFY_BIT, &DRS->flags); clear_bit(FD_NEED_TWADDLE_BIT, &DRS->flags); debug_dcl(DP->flags, ""checking whether disk is write protected\n""); debug_dcl(DP->flags, ""wp=%x\n"", ST3 & 0x40); if (!(ST3 & 0x40)) set_bit(FD_DISK_WRITABLE_BIT, &DRS->flags); else clear_bit(FD_DISK_WRITABLE_BIT, &DRS->flags); } } ",0 "int cdc_ncm_rx_fixup(struct usbnet *dev, struct sk_buff *skb_in) { struct sk_buff *skb; struct cdc_ncm_ctx *ctx = (struct cdc_ncm_ctx *)dev->data[0]; int len; int nframes; int x; int offset; struct usb_cdc_ncm_ndp16 *ndp16; struct usb_cdc_ncm_dpe16 *dpe16; int ndpoffset; int loopcount = 50; /* arbitrary max preventing infinite loop */ u32 payload = 0; ndpoffset = cdc_ncm_rx_verify_nth16(ctx, skb_in); if (ndpoffset < 0) goto error; next_ndp: nframes = cdc_ncm_rx_verify_ndp16(skb_in, ndpoffset); if (nframes < 0) goto error; ndp16 = (struct usb_cdc_ncm_ndp16 *)(skb_in->data + ndpoffset); if (ndp16->dwSignature != cpu_to_le32(USB_CDC_NCM_NDP16_NOCRC_SIGN)) { netif_dbg(dev, rx_err, dev->net, ""invalid DPT16 signature <%#010x>\n"", le32_to_cpu(ndp16->dwSignature)); goto err_ndp; } dpe16 = ndp16->dpe16; for (x = 0; x < nframes; x++, dpe16++) { offset = le16_to_cpu(dpe16->wDatagramIndex); len = le16_to_cpu(dpe16->wDatagramLength); /* * CDC NCM ch. 3.7 * All entries after first NULL entry are to be ignored */ if ((offset == 0) || (len == 0)) { if (!x) goto err_ndp; /* empty NTB */ break; } /* sanity checking */ if (((offset + len) > skb_in->len) || (len > ctx->rx_max) || (len < ETH_HLEN)) { netif_dbg(dev, rx_err, dev->net, ""invalid frame detected (ignored) offset[%u]=%u, length=%u, skb=%p\n"", x, offset, len, skb_in); if (!x) goto err_ndp; break; } else { /* create a fresh copy to reduce truesize */ skb = netdev_alloc_skb_ip_align(dev->net, len); if (!skb) goto error; memcpy(skb_put(skb, len), skb_in->data + offset, len); usbnet_skb_return(dev, skb); payload += len; /* count payload bytes in this NTB */ } } err_ndp: /* are there more NDPs to process? */ ndpoffset = le16_to_cpu(ndp16->wNextNdpIndex); if (ndpoffset && loopcount--) goto next_ndp; /* update stats */ ctx->rx_overhead += skb_in->len - payload; ctx->rx_ntbs++; return 1; error: return 0; } ",0 "static int check_stack_write(struct bpf_verifier_state *state, int off, int size, int value_regno) { int i; /* caller checked that off % size == 0 and -MAX_BPF_STACK <= off < 0, * so it's aligned access and [off, off + size) are within stack limits */ if (value_regno >= 0 && is_spillable_regtype(state->regs[value_regno].type)) { /* register containing pointer is being spilled into stack */ if (size != BPF_REG_SIZE) { verbose(""invalid size of register spill\n""); return -EACCES; } /* save register state */ state->spilled_regs[(MAX_BPF_STACK + off) / BPF_REG_SIZE] = state->regs[value_regno]; for (i = 0; i < BPF_REG_SIZE; i++) state->stack_slot_type[MAX_BPF_STACK + off + i] = STACK_SPILL; } else { /* regular write of data into stack */ state->spilled_regs[(MAX_BPF_STACK + off) / BPF_REG_SIZE] = (struct bpf_reg_state) {}; for (i = 0; i < size; i++) state->stack_slot_type[MAX_BPF_STACK + off + i] = STACK_MISC; } return 0; } ",0 "static void RaisesExceptionLongAttributeAttributeSetter( v8::Local v8_value, const v8::FunctionCallbackInfo& info) { v8::Isolate* isolate = info.GetIsolate(); ALLOW_UNUSED_LOCAL(isolate); v8::Local holder = info.Holder(); ALLOW_UNUSED_LOCAL(holder); TestObject* impl = V8TestObject::ToImpl(holder); ExceptionState exception_state(isolate, ExceptionState::kSetterContext, ""TestObject"", ""raisesExceptionLongAttribute""); int32_t cpp_value = NativeValueTraits::NativeValue(info.GetIsolate(), v8_value, exception_state); if (exception_state.HadException()) return; impl->setRaisesExceptionLongAttribute(cpp_value, exception_state); } ",0 "void initServerConfig(void) { int j; getRandomHexChars(server.runid,CONFIG_RUN_ID_SIZE); server.configfile = NULL; server.executable = NULL; server.hz = CONFIG_DEFAULT_HZ; server.runid[CONFIG_RUN_ID_SIZE] = '\0'; server.arch_bits = (sizeof(long) == 8) ? 64 : 32; server.port = CONFIG_DEFAULT_SERVER_PORT; server.tcp_backlog = CONFIG_DEFAULT_TCP_BACKLOG; server.bindaddr_count = 0; server.unixsocket = NULL; server.unixsocketperm = CONFIG_DEFAULT_UNIX_SOCKET_PERM; server.ipfd_count = 0; server.sofd = -1; server.protected_mode = CONFIG_DEFAULT_PROTECTED_MODE; server.dbnum = CONFIG_DEFAULT_DBNUM; server.verbosity = CONFIG_DEFAULT_VERBOSITY; server.maxidletime = CONFIG_DEFAULT_CLIENT_TIMEOUT; server.tcpkeepalive = CONFIG_DEFAULT_TCP_KEEPALIVE; server.active_expire_enabled = 1; server.client_max_querybuf_len = PROTO_MAX_QUERYBUF_LEN; server.saveparams = NULL; server.loading = 0; server.logfile = zstrdup(CONFIG_DEFAULT_LOGFILE); server.syslog_enabled = CONFIG_DEFAULT_SYSLOG_ENABLED; server.syslog_ident = zstrdup(CONFIG_DEFAULT_SYSLOG_IDENT); server.syslog_facility = LOG_LOCAL0; server.daemonize = CONFIG_DEFAULT_DAEMONIZE; server.supervised = 0; server.supervised_mode = SUPERVISED_NONE; server.aof_state = AOF_OFF; server.aof_fsync = CONFIG_DEFAULT_AOF_FSYNC; server.aof_no_fsync_on_rewrite = CONFIG_DEFAULT_AOF_NO_FSYNC_ON_REWRITE; server.aof_rewrite_perc = AOF_REWRITE_PERC; server.aof_rewrite_min_size = AOF_REWRITE_MIN_SIZE; server.aof_rewrite_base_size = 0; server.aof_rewrite_scheduled = 0; server.aof_last_fsync = time(NULL); server.aof_rewrite_time_last = -1; server.aof_rewrite_time_start = -1; server.aof_lastbgrewrite_status = C_OK; server.aof_delayed_fsync = 0; server.aof_fd = -1; server.aof_selected_db = -1; /* Make sure the first time will not match */ server.aof_flush_postponed_start = 0; server.aof_rewrite_incremental_fsync = CONFIG_DEFAULT_AOF_REWRITE_INCREMENTAL_FSYNC; server.aof_load_truncated = CONFIG_DEFAULT_AOF_LOAD_TRUNCATED; server.pidfile = NULL; server.rdb_filename = zstrdup(CONFIG_DEFAULT_RDB_FILENAME); server.aof_filename = zstrdup(CONFIG_DEFAULT_AOF_FILENAME); server.requirepass = NULL; server.rdb_compression = CONFIG_DEFAULT_RDB_COMPRESSION; server.rdb_checksum = CONFIG_DEFAULT_RDB_CHECKSUM; server.stop_writes_on_bgsave_err = CONFIG_DEFAULT_STOP_WRITES_ON_BGSAVE_ERROR; server.activerehashing = CONFIG_DEFAULT_ACTIVE_REHASHING; server.notify_keyspace_events = 0; server.maxclients = CONFIG_DEFAULT_MAX_CLIENTS; server.bpop_blocked_clients = 0; server.maxmemory = CONFIG_DEFAULT_MAXMEMORY; server.maxmemory_policy = CONFIG_DEFAULT_MAXMEMORY_POLICY; server.maxmemory_samples = CONFIG_DEFAULT_MAXMEMORY_SAMPLES; server.hash_max_ziplist_entries = OBJ_HASH_MAX_ZIPLIST_ENTRIES; server.hash_max_ziplist_value = OBJ_HASH_MAX_ZIPLIST_VALUE; server.list_max_ziplist_size = OBJ_LIST_MAX_ZIPLIST_SIZE; server.list_compress_depth = OBJ_LIST_COMPRESS_DEPTH; server.set_max_intset_entries = OBJ_SET_MAX_INTSET_ENTRIES; server.zset_max_ziplist_entries = OBJ_ZSET_MAX_ZIPLIST_ENTRIES; server.zset_max_ziplist_value = OBJ_ZSET_MAX_ZIPLIST_VALUE; server.hll_sparse_max_bytes = CONFIG_DEFAULT_HLL_SPARSE_MAX_BYTES; server.shutdown_asap = 0; server.repl_ping_slave_period = CONFIG_DEFAULT_REPL_PING_SLAVE_PERIOD; server.repl_timeout = CONFIG_DEFAULT_REPL_TIMEOUT; server.repl_min_slaves_to_write = CONFIG_DEFAULT_MIN_SLAVES_TO_WRITE; server.repl_min_slaves_max_lag = CONFIG_DEFAULT_MIN_SLAVES_MAX_LAG; server.cluster_enabled = 0; server.cluster_node_timeout = CLUSTER_DEFAULT_NODE_TIMEOUT; server.cluster_migration_barrier = CLUSTER_DEFAULT_MIGRATION_BARRIER; server.cluster_slave_validity_factor = CLUSTER_DEFAULT_SLAVE_VALIDITY; server.cluster_require_full_coverage = CLUSTER_DEFAULT_REQUIRE_FULL_COVERAGE; server.cluster_configfile = zstrdup(CONFIG_DEFAULT_CLUSTER_CONFIG_FILE); server.migrate_cached_sockets = dictCreate(&migrateCacheDictType,NULL); server.next_client_id = 1; /* Client IDs, start from 1 .*/ server.loading_process_events_interval_bytes = (1024*1024*2); server.lruclock = getLRUClock(); resetServerSaveParams(); appendServerSaveParams(60*60,1); /* save after 1 hour and 1 change */ appendServerSaveParams(300,100); /* save after 5 minutes and 100 changes */ appendServerSaveParams(60,10000); /* save after 1 minute and 10000 changes */ /* Replication related */ server.masterauth = NULL; server.masterhost = NULL; server.masterport = 6379; server.master = NULL; server.cached_master = NULL; server.repl_master_initial_offset = -1; server.repl_state = REPL_STATE_NONE; server.repl_syncio_timeout = CONFIG_REPL_SYNCIO_TIMEOUT; server.repl_serve_stale_data = CONFIG_DEFAULT_SLAVE_SERVE_STALE_DATA; server.repl_slave_ro = CONFIG_DEFAULT_SLAVE_READ_ONLY; server.repl_down_since = 0; /* Never connected, repl is down since EVER. */ server.repl_disable_tcp_nodelay = CONFIG_DEFAULT_REPL_DISABLE_TCP_NODELAY; server.repl_diskless_sync = CONFIG_DEFAULT_REPL_DISKLESS_SYNC; server.repl_diskless_sync_delay = CONFIG_DEFAULT_REPL_DISKLESS_SYNC_DELAY; server.slave_priority = CONFIG_DEFAULT_SLAVE_PRIORITY; server.slave_announce_ip = CONFIG_DEFAULT_SLAVE_ANNOUNCE_IP; server.slave_announce_port = CONFIG_DEFAULT_SLAVE_ANNOUNCE_PORT; server.master_repl_offset = 0; /* Replication partial resync backlog */ server.repl_backlog = NULL; server.repl_backlog_size = CONFIG_DEFAULT_REPL_BACKLOG_SIZE; server.repl_backlog_histlen = 0; server.repl_backlog_idx = 0; server.repl_backlog_off = 0; server.repl_backlog_time_limit = CONFIG_DEFAULT_REPL_BACKLOG_TIME_LIMIT; server.repl_no_slaves_since = time(NULL); /* Client output buffer limits */ for (j = 0; j < CLIENT_TYPE_OBUF_COUNT; j++) server.client_obuf_limits[j] = clientBufferLimitsDefaults[j]; /* Double constants initialization */ R_Zero = 0.0; R_PosInf = 1.0/R_Zero; R_NegInf = -1.0/R_Zero; R_Nan = R_Zero/R_Zero; /* Command table -- we initiialize it here as it is part of the * initial configuration, since command names may be changed via * redis.conf using the rename-command directive. */ server.commands = dictCreate(&commandTableDictType,NULL); server.orig_commands = dictCreate(&commandTableDictType,NULL); populateCommandTable(); server.delCommand = lookupCommandByCString(""del""); server.multiCommand = lookupCommandByCString(""multi""); server.lpushCommand = lookupCommandByCString(""lpush""); server.lpopCommand = lookupCommandByCString(""lpop""); server.rpopCommand = lookupCommandByCString(""rpop""); server.sremCommand = lookupCommandByCString(""srem""); server.execCommand = lookupCommandByCString(""exec""); /* Slow log */ server.slowlog_log_slower_than = CONFIG_DEFAULT_SLOWLOG_LOG_SLOWER_THAN; server.slowlog_max_len = CONFIG_DEFAULT_SLOWLOG_MAX_LEN; /* Latency monitor */ server.latency_monitor_threshold = CONFIG_DEFAULT_LATENCY_MONITOR_THRESHOLD; /* Debugging */ server.assert_failed = """"; server.assert_file = """"; server.assert_line = 0; server.bug_report_start = 0; server.watchdog_period = 0; } ",0 "void OmniboxViewViews::ContentsChanged(views::Textfield* sender, const base::string16& new_contents) { } ",0 "void BackgroundContentsService::BackgroundContentsShutdown( BackgroundContents* background_contents) { DCHECK(IsTracked(background_contents)); string16 appid = GetParentApplicationId(background_contents); contents_map_.erase(appid); } ",0 "static MagickStatusType ReadPSDChannelPixels(Image *image,const size_t channels, const size_t row,const ssize_t type,const unsigned char *pixels, ExceptionInfo *exception) { Quantum pixel; register const unsigned char *p; register IndexPacket *indexes; register PixelPacket *q; register ssize_t x; size_t packet_size; unsigned short nibble; p=pixels; q=GetAuthenticPixels(image,0,row,image->columns,1,exception); if (q == (PixelPacket *) NULL) return MagickFalse; indexes=GetAuthenticIndexQueue(image); packet_size=GetPSDPacketSize(image); for (x=0; x < (ssize_t) image->columns; x++) { if (packet_size == 1) pixel=ScaleCharToQuantum(*p++); else { p=PushShortPixel(MSBEndian,p,&nibble); pixel=ScaleShortToQuantum(nibble); } switch (type) { case -1: { SetPixelAlpha(q,pixel); break; } case 0: { SetPixelRed(q,pixel); if (channels == 1) { SetPixelGreen(q,GetPixelRed(q)); SetPixelBlue(q,GetPixelRed(q)); } if (image->storage_class == PseudoClass) { if (packet_size == 1) SetPixelIndex(indexes+x,ScaleQuantumToChar(pixel)) else SetPixelIndex(indexes+x,ScaleQuantumToShort(pixel)) SetPixelRGBO(q,image->colormap+(ssize_t) ConstrainColormapIndex(image,GetPixelIndex(indexes+x))); if (image->depth == 1) { ssize_t bit, number_bits; number_bits=image->columns-x; if (number_bits > 8) number_bits=8; for (bit=0; bit < number_bits; bit++) { SetPixelIndex(indexes+x,(((unsigned char) pixel) & (0x01 << (7-bit))) != 0 ? 0 : 255); SetPixelRGBO(q,image->colormap+(ssize_t) GetPixelIndex(indexes+x)); q++; x++; } x--; continue; } } break; } case 1: { if (image->storage_class == PseudoClass) SetPixelAlpha(q,pixel); else SetPixelGreen(q,pixel); break; } case 2: { if (image->storage_class == PseudoClass) SetPixelAlpha(q,pixel); else SetPixelBlue(q,pixel); break; } case 3: { if (image->colorspace == CMYKColorspace) SetPixelIndex(indexes+x,pixel) else if (image->matte != MagickFalse) SetPixelAlpha(q,pixel); break; } case 4: { if ((IssRGBCompatibleColorspace(image->colorspace) != MagickFalse) && (channels > 3)) break; if (image->matte != MagickFalse) SetPixelAlpha(q,pixel); break; } default: break; } q++; } return(SyncAuthenticPixels(image,exception)); } ",0 " tt_sbit_decoder_load_bit_aligned( TT_SBitDecoder decoder, FT_Byte* p, FT_Byte* limit, FT_Int x_pos, FT_Int y_pos ) { FT_Error error = FT_Err_Ok; FT_Byte* line; FT_Int bit_height, bit_width, pitch, width, height, line_bits, h, nbits; FT_Bitmap* bitmap; FT_UShort rval; /* check that we can write the glyph into the bitmap */ bitmap = decoder->bitmap; bit_width = bitmap->width; bit_height = bitmap->rows; pitch = bitmap->pitch; line = bitmap->buffer; width = decoder->metrics->width; height = decoder->metrics->height; line_bits = width * decoder->bit_depth; if ( x_pos < 0 || x_pos + width > bit_width || y_pos < 0 || y_pos + height > bit_height ) { FT_TRACE1(( ""tt_sbit_decoder_load_bit_aligned:"" "" invalid bitmap dimensions\n"" )); error = FT_THROW( Invalid_File_Format ); goto Exit; } if ( p + ( ( line_bits * height + 7 ) >> 3 ) > limit ) { FT_TRACE1(( ""tt_sbit_decoder_load_bit_aligned: broken bitmap\n"" )); error = FT_THROW( Invalid_File_Format ); goto Exit; } /* now do the blit */ /* adjust `line' to point to the first byte of the bitmap */ line += y_pos * pitch + ( x_pos >> 3 ); x_pos &= 7; /* the higher byte of `rval' is used as a buffer */ rval = 0; nbits = 0; for ( h = height; h > 0; h--, line += pitch ) { FT_Byte* pwrite = line; FT_Int w = line_bits; /* handle initial byte (in target bitmap) specially if necessary */ if ( x_pos ) { w = ( line_bits < 8 - x_pos ) ? line_bits : 8 - x_pos; if ( h == height ) { rval = *p++; nbits = x_pos; } else if ( nbits < w ) { if ( p < limit ) rval |= *p++; nbits += 8 - w; } else { rval >>= 8; nbits -= w; } *pwrite++ |= ( ( rval >> nbits ) & 0xFF ) & ( ~( 0xFF << w ) << ( 8 - w - x_pos ) ); rval <<= 8; w = line_bits - w; } /* handle medial bytes */ for ( ; w >= 8; w -= 8 ) { rval |= *p++; *pwrite++ |= ( rval >> nbits ) & 0xFF; rval <<= 8; } /* handle final byte if necessary */ if ( w > 0 ) { if ( nbits < w ) { if ( p < limit ) rval |= *p++; *pwrite |= ( ( rval >> nbits ) & 0xFF ) & ( 0xFF00U >> w ); nbits += 8 - w; rval <<= 8; } else { *pwrite |= ( ( rval >> nbits ) & 0xFF ) & ( 0xFF00U >> w ); nbits -= w; } } } Exit: if ( !error ) FT_TRACE3(( ""tt_sbit_decoder_load_bit_aligned: loaded\n"" )); return error; } ",0 "void VRDisplay::OnSubmitFrameTransferred() { pending_submit_frame_ = false; } ",0 "void TreeView::CreateRootItems() { DCHECK(model_); DCHECK(tree_view_); TreeModelNode* root = model_->GetRoot(); if (root_shown_) { CreateItem(NULL, TVI_LAST, root); } else { for (int i = 0; i < model_->GetChildCount(root); ++i) CreateItem(NULL, TVI_LAST, model_->GetChild(root, i)); } } ",0 "mrb_gc_arena_restore(mrb_state *mrb, int idx) { mrb_gc *gc = &mrb->gc; #ifndef MRB_GC_FIXED_ARENA int capa = gc->arena_capa; if (idx < capa / 2) { capa = (int)(capa * 0.66); if (capa < MRB_GC_ARENA_SIZE) { capa = MRB_GC_ARENA_SIZE; } if (capa != gc->arena_capa) { gc->arena = (struct RBasic**)mrb_realloc(mrb, gc->arena, sizeof(struct RBasic*)*capa); gc->arena_capa = capa; } } #endif gc->arena_idx = idx; } ",0 "vrrp_bfd_thread(thread_t * thread) { bfd_event_t evt; bfd_thread = thread_add_read(master, vrrp_bfd_thread, NULL, thread->u.fd, TIMER_NEVER); if (thread->type != THREAD_READY_FD) return 0; while (read(thread->u.fd, &evt, sizeof(bfd_event_t)) != -1) vrrp_handle_bfd_event(&evt); return 0; } ",0 "void WebContentsImpl::UpdateZoom() { RenderWidgetHostImpl* rwh = GetRenderViewHost()->GetWidget(); if (rwh->GetView()) rwh->SynchronizeVisualProperties(); } ",0 "decode_NXAST_RAW_DEBUG_RECIRC(struct ofpbuf *out) { if (!enable_debug) { return OFPERR_OFPBAC_BAD_VENDOR_TYPE; } ofpact_put_DEBUG_RECIRC(out); return 0; } ",0 "static int __kvmppc_handle_load(struct kvm_run *run, struct kvm_vcpu *vcpu, unsigned int rt, unsigned int bytes, int is_default_endian, int sign_extend) { int idx, ret; bool host_swabbed; /* Pity C doesn't have a logical XOR operator */ if (kvmppc_need_byteswap(vcpu)) { host_swabbed = is_default_endian; } else { host_swabbed = !is_default_endian; } if (bytes > sizeof(run->mmio.data)) { printk(KERN_ERR ""%s: bad MMIO length: %d\n"", __func__, run->mmio.len); } run->mmio.phys_addr = vcpu->arch.paddr_accessed; run->mmio.len = bytes; run->mmio.is_write = 0; vcpu->arch.io_gpr = rt; vcpu->arch.mmio_host_swabbed = host_swabbed; vcpu->mmio_needed = 1; vcpu->mmio_is_write = 0; vcpu->arch.mmio_sign_extend = sign_extend; idx = srcu_read_lock(&vcpu->kvm->srcu); ret = kvm_io_bus_read(vcpu, KVM_MMIO_BUS, run->mmio.phys_addr, bytes, &run->mmio.data); srcu_read_unlock(&vcpu->kvm->srcu, idx); if (!ret) { kvmppc_complete_mmio_load(vcpu, run); vcpu->mmio_needed = 0; return EMULATE_DONE; } return EMULATE_DO_MMIO; } ",0 "static void vrend_use_program(struct vrend_context *ctx, GLuint program_id) { if (ctx->sub->program_id != program_id) { glUseProgram(program_id); ctx->sub->program_id = program_id; } } ",0 "static char *get_string(char **p, struct token *t, char delim, int lower) { char *b, *e; size_t len, i; /* * b and e both start at the beginning of the input stream. * * e is incremented until we find the ending delimiter, or a NUL byte * is reached. Then, we take e - b to find the length of the token. */ b = *p; e = *p; while (*e) { if ((delim == ' ' && isspace(*e)) || delim == *e) break; e++; } len = e - b; /* * Allocate memory to hold the string, and copy it in, converting * characters to lowercase if lower is != 0. */ t->val = malloc(len + 1); if (!t->val) return NULL; for (i = 0; i < len; i++, b++) { if (lower) t->val[i] = tolower(*b); else t->val[i] = *b; } t->val[len] = '\0'; /* * Update *p so the caller knows where to continue scanning. */ *p = e; t->type = T_STRING; return t->val; } ",0 "void PaletteDelegateChromeOS::TakePartialScreenshot() { auto* screenshot_controller = ash::Shell::GetInstance()->screenshot_controller(); auto* screenshot_delegate = ash::Shell::GetInstance() ->accelerator_controller_delegate() ->screenshot_delegate(); screenshot_controller->set_pen_events_only(true); screenshot_controller->StartPartialScreenshotSession( screenshot_delegate, false /* draw_overlay_immediately */); } ",0 "SoftVPX::SoftVPX( const char *name, const char *componentRole, OMX_VIDEO_CODINGTYPE codingType, const OMX_CALLBACKTYPE *callbacks, OMX_PTR appData, OMX_COMPONENTTYPE **component) : SoftVideoDecoderOMXComponent( name, componentRole, codingType, codingType == OMX_VIDEO_CodingVP8 ? NULL : kVP9ProfileLevels, codingType == OMX_VIDEO_CodingVP8 ? 0 : NELEM(kVP9ProfileLevels), 320 /* width */, 240 /* height */, callbacks, appData, component), mMode(codingType == OMX_VIDEO_CodingVP8 ? MODE_VP8 : MODE_VP9), mEOSStatus(INPUT_DATA_AVAILABLE), mCtx(NULL), mFrameParallelMode(false), mTimeStampIdx(0), mImg(NULL) { const size_t kMinCompressionRatio = mMode == MODE_VP8 ? 2 : 4; const char *mime = mMode == MODE_VP8 ? MEDIA_MIMETYPE_VIDEO_VP8 : MEDIA_MIMETYPE_VIDEO_VP9; const size_t kMaxOutputBufferSize = 2048 * 2048 * 3 / 2; initPorts( kNumBuffers, kMaxOutputBufferSize / kMinCompressionRatio /* inputBufferSize */, kNumBuffers, mime, kMinCompressionRatio); CHECK_EQ(initDecoder(), (status_t)OK); } ",0 "void SimpleSoftOMXComponent::onSendCommand( OMX_COMMANDTYPE cmd, OMX_U32 param) { switch (cmd) { case OMX_CommandStateSet: { onChangeState((OMX_STATETYPE)param); break; } case OMX_CommandPortEnable: case OMX_CommandPortDisable: { onPortEnable(param, cmd == OMX_CommandPortEnable); break; } case OMX_CommandFlush: { onPortFlush(param, true /* sendFlushComplete */); break; } default: TRESPASS(); break; } } ",0 "static int get_sidx_size(AVFormatContext *s) { int ret; AVIOContext *buf; MOVMuxContext *mov = s->priv_data; if ((ret = ffio_open_null_buf(&buf)) < 0) return ret; mov_write_sidx_tags(buf, mov, -1, 0); return ffio_close_null_buf(buf); } ",0 "static uint32_t vbe_ioport_read_index(void *opaque, uint32_t addr) { VGACommonState *s = opaque; return s->vbe_index; } ",0 "static void tnepres_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) { const u32 * const s = (const u32 * const)src; u32 * const d = (u32 * const)dst; u32 rs[4], rd[4]; rs[0] = swab32(s[3]); rs[1] = swab32(s[2]); rs[2] = swab32(s[1]); rs[3] = swab32(s[0]); serpent_encrypt(tfm, (u8 *)rd, (u8 *)rs); d[0] = swab32(rd[3]); d[1] = swab32(rd[2]); d[2] = swab32(rd[1]); d[3] = swab32(rd[0]); } ",0 "int FindStartOffsetOfFileInZipFile(const char* zip_file, const char* filename) { FileDescriptor fd; if (!fd.OpenReadOnly(zip_file)) { LOG_ERRNO(""%s: open failed trying to open zip file %s\n"", __FUNCTION__, zip_file); return CRAZY_OFFSET_FAILED; } struct stat stat_buf; if (stat(zip_file, &stat_buf) == -1) { LOG_ERRNO(""%s: stat failed trying to stat zip file %s\n"", __FUNCTION__, zip_file); return CRAZY_OFFSET_FAILED; } if (stat_buf.st_size > kMaxZipFileLength) { LOG(""%s: The size %ld of %s is too large to map\n"", __FUNCTION__, stat_buf.st_size, zip_file); return CRAZY_OFFSET_FAILED; } void* mem = fd.Map(NULL, stat_buf.st_size, PROT_READ, MAP_PRIVATE, 0); if (mem == MAP_FAILED) { LOG_ERRNO(""%s: mmap failed trying to mmap zip file %s\n"", __FUNCTION__, zip_file); return CRAZY_OFFSET_FAILED; } ScopedMMap scoped_mmap(mem, stat_buf.st_size); uint8_t* mem_bytes = static_cast(mem); int off; for (off = stat_buf.st_size - sizeof(kEndOfCentralDirectoryMarker); off >= 0; --off) { if (ReadUInt32(mem_bytes, off) == kEndOfCentralDirectoryMarker) { break; } } if (off == -1) { LOG(""%s: Failed to find end of central directory in %s\n"", __FUNCTION__, zip_file); return CRAZY_OFFSET_FAILED; } uint32_t length_of_central_dir = ReadUInt32( mem_bytes, off + kOffsetOfCentralDirLengthInEndOfCentralDirectory); uint32_t start_of_central_dir = ReadUInt32( mem_bytes, off + kOffsetOfStartOfCentralDirInEndOfCentralDirectory); if (start_of_central_dir > off) { LOG(""%s: Found out of range offset %u for start of directory in %s\n"", __FUNCTION__, start_of_central_dir, zip_file); return CRAZY_OFFSET_FAILED; } uint32_t end_of_central_dir = start_of_central_dir + length_of_central_dir; if (end_of_central_dir > off) { LOG(""%s: Found out of range offset %u for end of directory in %s\n"", __FUNCTION__, end_of_central_dir, zip_file); return CRAZY_OFFSET_FAILED; } uint32_t num_entries = ReadUInt16( mem_bytes, off + kOffsetNumOfEntriesInEndOfCentralDirectory); off = start_of_central_dir; const int target_len = strlen(filename); int n = 0; for (; n < num_entries && off < end_of_central_dir; ++n) { uint32_t marker = ReadUInt32(mem_bytes, off); if (marker != kCentralDirHeaderMarker) { LOG(""%s: Failed to find central directory header marker in %s. "" ""Found 0x%x but expected 0x%x\n"", __FUNCTION__, zip_file, marker, kCentralDirHeaderMarker); return CRAZY_OFFSET_FAILED; } uint32_t file_name_length = ReadUInt16(mem_bytes, off + kOffsetFilenameLengthInCentralDirectory); uint32_t extra_field_length = ReadUInt16(mem_bytes, off + kOffsetExtraFieldLengthInCentralDirectory); uint32_t comment_field_length = ReadUInt16(mem_bytes, off + kOffsetCommentLengthInCentralDirectory); uint32_t header_length = kOffsetFilenameInCentralDirectory + file_name_length + extra_field_length + comment_field_length; uint32_t local_header_offset = ReadUInt32(mem_bytes, off + kOffsetLocalHeaderOffsetInCentralDirectory); uint8_t* filename_bytes = mem_bytes + off + kOffsetFilenameInCentralDirectory; if (file_name_length == target_len && memcmp(filename_bytes, filename, target_len) == 0) { uint32_t marker = ReadUInt32(mem_bytes, local_header_offset); if (marker != kLocalHeaderMarker) { LOG(""%s: Failed to find local file header marker in %s. "" ""Found 0x%x but expected 0x%x\n"", __FUNCTION__, zip_file, marker, kLocalHeaderMarker); return CRAZY_OFFSET_FAILED; } uint32_t compression_method = ReadUInt16( mem_bytes, local_header_offset + kOffsetCompressionMethodInLocalHeader); if (compression_method != kCompressionMethodStored) { LOG(""%s: %s is compressed within %s. "" ""Found compression method %u but expected %u\n"", __FUNCTION__, filename, zip_file, compression_method, kCompressionMethodStored); return CRAZY_OFFSET_FAILED; } uint32_t file_name_length = ReadUInt16( mem_bytes, local_header_offset + kOffsetFilenameLengthInLocalHeader); uint32_t extra_field_length = ReadUInt16( mem_bytes, local_header_offset + kOffsetExtraFieldLengthInLocalHeader); uint32_t header_length = kOffsetFilenameInLocalHeader + file_name_length + extra_field_length; return local_header_offset + header_length; } off += header_length; } if (n < num_entries) { LOG(""%s: Did not find all the expected entries in the central directory. "" ""Found %d but expected %d\n"", __FUNCTION__, n, num_entries); } if (off < end_of_central_dir) { LOG(""%s: There are %d extra bytes at the end of the central directory.\n"", __FUNCTION__, end_of_central_dir - off); } LOG(""%s: Did not find %s in %s\n"", __FUNCTION__, filename, zip_file); return CRAZY_OFFSET_FAILED; } ",1 "UnloadedExtensionInfo::UnloadedExtensionInfo( const Extension* extension, Reason reason) : reason(reason), already_disabled(false), extension(extension) {} ",0 "xmlSetupParserForBuffer(xmlParserCtxtPtr ctxt, const xmlChar* buffer, const char* filename) { xmlParserInputPtr input; if ((ctxt == NULL) || (buffer == NULL)) return; input = xmlNewInputStream(ctxt); if (input == NULL) { xmlErrMemory(NULL, ""parsing new buffer: out of memory\n""); xmlClearParserCtxt(ctxt); return; } xmlClearParserCtxt(ctxt); if (filename != NULL) input->filename = (char *) xmlCanonicPath((const xmlChar *)filename); input->base = buffer; input->cur = buffer; input->end = &buffer[xmlStrlen(buffer)]; inputPush(ctxt, input); } ",0 " ~SiteInstanceTestBrowserClient() { WebUIControllerFactory::UnregisterFactoryForTesting(&factory_); } ",0 "void OffscreenCanvas::DidDraw() { DidDraw(FloatRect(0, 0, Size().Width(), Size().Height())); } ",0 "EntryInfoResult::~EntryInfoResult() { } ",0 "void WebPluginDelegateProxy::OnAcceleratedSurfaceBuffersSwapped( gfx::PluginWindowHandle window, uint64 surface_handle) { if (render_view_) render_view_->AcceleratedSurfaceBuffersSwapped(window, surface_handle); } ",0 "ar6000_txPwr_rx(void *devt, u8 txPwr) { struct ar6_softc *ar = (struct ar6_softc *)devt; ar->arTxPwr = txPwr; wake_up(&arEvent); } ",0 "int kvm_apic_has_interrupt(struct kvm_vcpu *vcpu) { struct kvm_lapic *apic = vcpu->arch.apic; int highest_irr; if (!kvm_vcpu_has_lapic(vcpu) || !apic_enabled(apic)) return -1; apic_update_ppr(apic); highest_irr = apic_find_highest_irr(apic); if ((highest_irr == -1) || ((highest_irr & 0xF0) <= kvm_apic_get_reg(apic, APIC_PROCPRI))) return -1; return highest_irr; } ",0 "void Document::AddListenerTypeIfNeeded(const AtomicString& event_type, EventTarget& event_target) { if (event_type == event_type_names::kDOMSubtreeModified) { UseCounter::Count(*this, WebFeature::kDOMSubtreeModifiedEvent); AddMutationEventListenerTypeIfEnabled(kDOMSubtreeModifiedListener); } else if (event_type == event_type_names::kDOMNodeInserted) { UseCounter::Count(*this, WebFeature::kDOMNodeInsertedEvent); AddMutationEventListenerTypeIfEnabled(kDOMNodeInsertedListener); } else if (event_type == event_type_names::kDOMNodeRemoved) { UseCounter::Count(*this, WebFeature::kDOMNodeRemovedEvent); AddMutationEventListenerTypeIfEnabled(kDOMNodeRemovedListener); } else if (event_type == event_type_names::kDOMNodeRemovedFromDocument) { UseCounter::Count(*this, WebFeature::kDOMNodeRemovedFromDocumentEvent); AddMutationEventListenerTypeIfEnabled(kDOMNodeRemovedFromDocumentListener); } else if (event_type == event_type_names::kDOMNodeInsertedIntoDocument) { UseCounter::Count(*this, WebFeature::kDOMNodeInsertedIntoDocumentEvent); AddMutationEventListenerTypeIfEnabled(kDOMNodeInsertedIntoDocumentListener); } else if (event_type == event_type_names::kDOMCharacterDataModified) { UseCounter::Count(*this, WebFeature::kDOMCharacterDataModifiedEvent); AddMutationEventListenerTypeIfEnabled(kDOMCharacterDataModifiedListener); } else if (event_type == event_type_names::kWebkitAnimationStart || event_type == event_type_names::kAnimationstart) { AddListenerType(kAnimationStartListener); } else if (event_type == event_type_names::kWebkitAnimationEnd || event_type == event_type_names::kAnimationend) { AddListenerType(kAnimationEndListener); } else if (event_type == event_type_names::kWebkitAnimationIteration || event_type == event_type_names::kAnimationiteration) { AddListenerType(kAnimationIterationListener); if (View()) { View()->ScheduleAnimation(); } } else if (event_type == event_type_names::kTransitioncancel) { AddListenerType(kTransitionCancelListener); } else if (event_type == event_type_names::kTransitionrun) { AddListenerType(kTransitionRunListener); } else if (event_type == event_type_names::kTransitionstart) { AddListenerType(kTransitionStartListener); } else if (event_type == event_type_names::kWebkitTransitionEnd || event_type == event_type_names::kTransitionend) { AddListenerType(kTransitionEndListener); } else if (event_type == event_type_names::kScroll) { AddListenerType(kScrollListener); } else if (event_type == event_type_names::kLoad) { if (Node* node = event_target.ToNode()) { if (IsHTMLStyleElement(*node)) { AddListenerType(kLoadListenerAtCapturePhaseOrAtStyleElement); return; } } if (event_target.HasCapturingEventListeners(event_type)) AddListenerType(kLoadListenerAtCapturePhaseOrAtStyleElement); } } ",0 "DictionaryValue* BookmarkSpecificsToValue( const sync_pb::BookmarkSpecifics& proto) { DictionaryValue* value = new DictionaryValue(); SET_STR(url); SET_BYTES(favicon); SET_STR(title); return value; } ",0 "void RenderFrameHostImpl::OnSerializeAsMHTMLResponse( int job_id, MhtmlSaveStatus save_status, const std::set& digests_of_uris_of_serialized_resources, base::TimeDelta renderer_main_thread_time) { MHTMLGenerationManager::GetInstance()->OnSerializeAsMHTMLResponse( this, job_id, save_status, digests_of_uris_of_serialized_resources, renderer_main_thread_time); } ",0 "static void __exit hci_uart_exit(void) { int err; #ifdef CONFIG_BT_HCIUART_H4 h4_deinit(); #endif #ifdef CONFIG_BT_HCIUART_BCSP bcsp_deinit(); #endif #ifdef CONFIG_BT_HCIUART_LL ll_deinit(); #endif #ifdef CONFIG_BT_HCIUART_ATH3K ath_deinit(); #endif #ifdef CONFIG_BT_HCIUART_3WIRE h5_deinit(); #endif #ifdef CONFIG_BT_HCIUART_INTEL intel_deinit(); #endif #ifdef CONFIG_BT_HCIUART_BCM bcm_deinit(); #endif #ifdef CONFIG_BT_HCIUART_QCA qca_deinit(); #endif #ifdef CONFIG_BT_HCIUART_AG6XX ag6xx_deinit(); #endif #ifdef CONFIG_BT_HCIUART_MRVL mrvl_deinit(); #endif /* Release tty registration of line discipline */ err = tty_unregister_ldisc(N_HCI); if (err) BT_ERR(""Can't unregister HCI line discipline (%d)"", err); } ",0 "extract_cookie_value(char *hdr, const char *hdr_end, char *cookie_name, size_t cookie_name_l, int list, char **value, int *value_l) { char *equal, *att_end, *att_beg, *val_beg, *val_end; char *next; /* we search at least a cookie name followed by an equal, and more * generally something like this : * Cookie: NAME1 = VALUE 1 ; NAME2 = VALUE2 ; NAME3 = VALUE3\r\n */ for (att_beg = hdr; att_beg + cookie_name_l + 1 < hdr_end; att_beg = next + 1) { /* Iterate through all cookies on this line */ while (att_beg < hdr_end && http_is_spht[(unsigned char)*att_beg]) att_beg++; /* find att_end : this is the first character after the last non * space before the equal. It may be equal to hdr_end. */ equal = att_end = att_beg; while (equal < hdr_end) { if (*equal == '=' || *equal == ';' || (list && *equal == ',')) break; if (http_is_spht[(unsigned char)*equal++]) continue; att_end = equal; } /* here, points to '=', a delimitor or the end. * is between and , both may be identical. */ /* look for end of cookie if there is an equal sign */ if (equal < hdr_end && *equal == '=') { /* look for the beginning of the value */ val_beg = equal + 1; while (val_beg < hdr_end && http_is_spht[(unsigned char)*val_beg]) val_beg++; /* find the end of the value, respecting quotes */ next = find_cookie_value_end(val_beg, hdr_end); /* make val_end point to the first white space or delimitor after the value */ val_end = next; while (val_end > val_beg && http_is_spht[(unsigned char)*(val_end - 1)]) val_end--; } else { val_beg = val_end = next = equal; } /* We have nothing to do with attributes beginning with '$'. However, * they will automatically be removed if a header before them is removed, * since they're supposed to be linked together. */ if (*att_beg == '$') continue; /* Ignore cookies with no equal sign */ if (equal == next) continue; /* Now we have the cookie name between att_beg and att_end, and * its value between val_beg and val_end. */ if (att_end - att_beg == cookie_name_l && memcmp(att_beg, cookie_name, cookie_name_l) == 0) { /* let's return this value and indicate where to go on from */ *value = val_beg; *value_l = val_end - val_beg; return next + 1; } /* Set-Cookie headers only have the name in the first attr=value part */ if (!list) break; } return NULL; } ",0 "static int setsockopt(struct socket *sock, int lvl, int opt, char __user *ov, unsigned int ol) { struct sock *sk = sock->sk; struct tipc_port *tport = tipc_sk_port(sk); u32 value; int res; if ((lvl == IPPROTO_TCP) && (sock->type == SOCK_STREAM)) return 0; if (lvl != SOL_TIPC) return -ENOPROTOOPT; if (ol < sizeof(value)) return -EINVAL; res = get_user(value, (u32 __user *)ov); if (res) return res; lock_sock(sk); switch (opt) { case TIPC_IMPORTANCE: res = tipc_set_portimportance(tport->ref, value); break; case TIPC_SRC_DROPPABLE: if (sock->type != SOCK_STREAM) res = tipc_set_portunreliable(tport->ref, value); else res = -ENOPROTOOPT; break; case TIPC_DEST_DROPPABLE: res = tipc_set_portunreturnable(tport->ref, value); break; case TIPC_CONN_TIMEOUT: tipc_sk(sk)->conn_timeout = value; /* no need to set ""res"", since already 0 at this point */ break; default: res = -EINVAL; } release_sock(sk); return res; } ",0 "rend_service_private_key_exists(const rend_service_t *service) { char *private_key_path = rend_service_path(service, private_key_fname); const file_status_t private_key_status = file_status(private_key_path); tor_free(private_key_path); /* Only non-empty regular private key files could have been used before. * fstatus can be FN_ERROR if the service directory does not exist, in that * case, there is obviously no private key. */ return private_key_status == FN_FILE; } ",0 "int main(int argc, char * * argv) { int ret = 0; int pid; struct sigaction sa; char buf[1500]; ssize_t n; int s_ssdp = -1; /* udp socket receiving ssdp packets */ #ifdef ENABLE_IPV6 int s_ssdp6 = -1; /* udp socket receiving ssdp packets IPv6*/ #else #define s_ssdp6 (-1) #endif int s_unix = -1; /* unix socket communicating with clients */ int s_ifacewatch = -1; /* socket to receive Route / network interface config changes */ int s; LIST_HEAD(reqstructhead, reqelem) reqlisthead; struct reqelem * req; struct reqelem * reqnext; fd_set readfds; const char * if_addr[MAX_IF_ADDR]; int n_if_addr = 0; int i; const char * sockpath = ""/var/run/minissdpd.sock""; const char * pidfilename = ""/var/run/minissdpd.pid""; int debug_flag = 0; int ipv6 = 0; int deltadev = 0; struct sockaddr_in sendername; socklen_t sendername_len; #ifdef ENABLE_IPV6 struct sockaddr_in6 sendername6; socklen_t sendername6_len; #endif LIST_INIT(&reqlisthead); LIST_INIT(&servicelisthead); /* process command line */ for(i=1; i [-i ] ...\n"", argv[0]); fprintf(stderr, ""\n is either an IPv4 address such as 192.168.1.42, or an\ninterface name such as eth0.\n""); fprintf(stderr, ""\n By default, socket will be open as %s\n"" ""and pid written to file %s\n"", sockpath, pidfilename); return 1; } /* open log */ openlog(""minissdpd"", LOG_CONS|LOG_PID|(debug_flag?LOG_PERROR:0), LOG_MINISSDPD); if(!debug_flag) /* speed things up and ignore LOG_INFO and LOG_DEBUG */ setlogmask(LOG_UPTO(LOG_NOTICE)); if(checkforrunning(pidfilename) < 0) { syslog(LOG_ERR, ""MiniSSDPd is already running. EXITING""); return 1; } /* set signal handlers */ memset(&sa, 0, sizeof(struct sigaction)); sa.sa_handler = sigterm; if(sigaction(SIGTERM, &sa, NULL)) { syslog(LOG_ERR, ""Failed to set SIGTERM handler. EXITING""); ret = 1; goto quit; } if(sigaction(SIGINT, &sa, NULL)) { syslog(LOG_ERR, ""Failed to set SIGINT handler. EXITING""); ret = 1; goto quit; } /* open route/interface config changes socket */ s_ifacewatch = OpenAndConfInterfaceWatchSocket(); /* open UDP socket(s) for receiving SSDP packets */ s_ssdp = OpenAndConfSSDPReceiveSocket(n_if_addr, if_addr, 0); if(s_ssdp < 0) { syslog(LOG_ERR, ""Cannot open socket for receiving SSDP messages, exiting""); ret = 1; goto quit; } #ifdef ENABLE_IPV6 if(ipv6) { s_ssdp6 = OpenAndConfSSDPReceiveSocket(n_if_addr, if_addr, 1); if(s_ssdp6 < 0) { syslog(LOG_ERR, ""Cannot open socket for receiving SSDP messages (IPv6), exiting""); ret = 1; goto quit; } } #endif /* Open Unix socket to communicate with other programs on * the same machine */ s_unix = OpenUnixSocket(sockpath); if(s_unix < 0) { syslog(LOG_ERR, ""Cannot open unix socket for communicating with clients. Exiting""); ret = 1; goto quit; } /* drop privileges */ #if 0 /* if we drop privileges, how to unlink(/var/run/minissdpd.sock) ? */ if(getuid() == 0) { struct passwd * user; struct group * group; user = getpwnam(""nobody""); if(!user) { syslog(LOG_ERR, ""getpwnam(\""%s\"") : %m"", ""nobody""); ret = 1; goto quit; } group = getgrnam(""nogroup""); if(!group) { syslog(LOG_ERR, ""getgrnam(\""%s\"") : %m"", ""nogroup""); ret = 1; goto quit; } if(setgid(group->gr_gid) < 0) { syslog(LOG_ERR, ""setgit(%d) : %m"", group->gr_gid); ret = 1; goto quit; } if(setuid(user->pw_uid) < 0) { syslog(LOG_ERR, ""setuid(%d) : %m"", user->pw_uid); ret = 1; goto quit; } } #endif /* daemonize or in any case get pid ! */ if(debug_flag) pid = getpid(); else { #ifdef USE_DAEMON if(daemon(0, 0) < 0) perror(""daemon()""); pid = getpid(); #else pid = daemonize(); #endif } writepidfile(pidfilename, pid); /* send M-SEARCH ssdp:all Requests */ ssdpDiscoverAll(s_ssdp, 0); if(s_ssdp6 >= 0) ssdpDiscoverAll(s_ssdp6, 1); /* Main loop */ while(!quitting) { /* fill readfds fd_set */ FD_ZERO(&readfds); if(s_ssdp >= 0) { FD_SET(s_ssdp, &readfds); } #ifdef ENABLE_IPV6 if(s_ssdp6 >= 0) { FD_SET(s_ssdp6, &readfds); } #endif if(s_ifacewatch >= 0) { FD_SET(s_ifacewatch, &readfds); } FD_SET(s_unix, &readfds); for(req = reqlisthead.lh_first; req; req = req->entries.le_next) { if(req->socket >= 0) FD_SET(req->socket, &readfds); } /* select call */ if(select(FD_SETSIZE, &readfds, 0, 0, 0) < 0) { if(errno != EINTR) { syslog(LOG_ERR, ""select: %m""); break; /* quit */ } continue; /* try again */ } #ifdef ENABLE_IPV6 if((s_ssdp6 >= 0) && FD_ISSET(s_ssdp6, &readfds)) { sendername6_len = sizeof(struct sockaddr_in6); n = recvfrom(s_ssdp6, buf, sizeof(buf), 0, (struct sockaddr *)&sendername6, &sendername6_len); if(n<0) { /* EAGAIN, EWOULDBLOCK, EINTR : silently ignore (try again next time) * other errors : log to LOG_ERR */ if(errno != EAGAIN && errno != EWOULDBLOCK && errno != EINTR) syslog(LOG_ERR, ""recvfrom: %m""); } else { /* Parse and process the packet received */ /*printf(""%.*s"", n, buf);*/ i = ParseSSDPPacket(s_ssdp6, buf, n, (struct sockaddr *)&sendername6); syslog(LOG_DEBUG, ""** i=%d deltadev=%d **"", i, deltadev); if(i==0 || (i*deltadev < 0)) { if(deltadev > 0) syslog(LOG_NOTICE, ""%d new devices added"", deltadev); else if(deltadev < 0) syslog(LOG_NOTICE, ""%d devices removed (good-bye!)"", -deltadev); deltadev = i; } else if((i*deltadev) >= 0) { deltadev += i; } } } #endif if(FD_ISSET(s_ssdp, &readfds)) { sendername_len = sizeof(struct sockaddr_in); n = recvfrom(s_ssdp, buf, sizeof(buf), 0, (struct sockaddr *)&sendername, &sendername_len); if(n<0) { /* EAGAIN, EWOULDBLOCK, EINTR : silently ignore (try again next time) * other errors : log to LOG_ERR */ if(errno != EAGAIN && errno != EWOULDBLOCK && errno != EINTR) syslog(LOG_ERR, ""recvfrom: %m""); } else { /* Parse and process the packet received */ /*printf(""%.*s"", n, buf);*/ i = ParseSSDPPacket(s_ssdp, buf, n, (struct sockaddr *)&sendername); syslog(LOG_DEBUG, ""** i=%d deltadev=%d **"", i, deltadev); if(i==0 || (i*deltadev < 0)) { if(deltadev > 0) syslog(LOG_NOTICE, ""%d new devices added"", deltadev); else if(deltadev < 0) syslog(LOG_NOTICE, ""%d devices removed (good-bye!)"", -deltadev); deltadev = i; } else if((i*deltadev) >= 0) { deltadev += i; } } } /* processing unix socket requests */ for(req = reqlisthead.lh_first; req;) { reqnext = req->entries.le_next; if((req->socket >= 0) && FD_ISSET(req->socket, &readfds)) { processRequest(req); } if(req->socket < 0) { LIST_REMOVE(req, entries); free(req); } req = reqnext; } /* processing new requests */ if(FD_ISSET(s_unix, &readfds)) { struct reqelem * tmp; s = accept(s_unix, NULL, NULL); if(s<0) { syslog(LOG_ERR, ""accept(s_unix): %m""); } else { syslog(LOG_INFO, ""(s=%d) new request connection"", s); if(!set_non_blocking(s)) syslog(LOG_WARNING, ""Failed to set new socket non blocking : %m""); tmp = malloc(sizeof(struct reqelem)); if(!tmp) { syslog(LOG_ERR, ""cannot allocate memory for request""); close(s); } else { tmp->socket = s; LIST_INSERT_HEAD(&reqlisthead, tmp, entries); } } } /* processing route/network interface config changes */ if((s_ifacewatch >= 0) && FD_ISSET(s_ifacewatch, &readfds)) { ProcessInterfaceWatch(s_ifacewatch, s_ssdp, s_ssdp6, n_if_addr, if_addr); } } /* closing and cleaning everything */ quit: if(s_ssdp >= 0) { close(s_ssdp); s_ssdp = -1; } #ifdef ENABLE_IPV6 if(s_ssdp6 >= 0) { close(s_ssdp6); s_ssdp6 = -1; } #endif if(s_unix >= 0) { close(s_unix); s_unix = -1; if(unlink(sockpath) < 0) syslog(LOG_ERR, ""unlink(%s): %m"", sockpath); } if(s_ifacewatch >= 0) { close(s_ifacewatch); s_ifacewatch = -1; } if(unlink(pidfilename) < 0) syslog(LOG_ERR, ""unlink(%s): %m"", pidfilename); closelog(); return ret; } ",0 "juniper_ether_print(netdissect_options *ndo, const struct pcap_pkthdr *h, register const u_char *p) { struct juniper_l2info_t l2info; l2info.pictype = DLT_JUNIPER_ETHER; if (juniper_parse_header(ndo, p, h, &l2info) == 0) return l2info.header_len; p+=l2info.header_len; /* this DLT contains nothing but raw Ethernet frames */ ether_print(ndo, p, l2info.length, l2info.caplen, NULL, NULL); return l2info.header_len; } ",0 "static int ovl_link(struct dentry *old, struct inode *newdir, struct dentry *new) { int err; struct dentry *upper; err = ovl_want_write(old); if (err) goto out; err = ovl_copy_up(old); if (err) goto out_drop_write; upper = ovl_dentry_upper(old); err = ovl_create_or_link(new, upper->d_inode->i_mode, 0, NULL, upper); out_drop_write: ovl_drop_write(old); out: return err; } ",0 "static apr_status_t php_server_context_cleanup(void *data_) { void **data = data_; *data = NULL; return APR_SUCCESS; } ",0 "void ClientControlledShellSurface::SetWidgetBounds(const gfx::Rect& bounds) { const auto* screen = display::Screen::GetScreen(); aura::Window* window = widget_->GetNativeWindow(); display::Display current_display = screen->GetDisplayNearestWindow(window); bool is_display_move_pending = false; display::Display target_display = current_display; display::Display display; if (screen->GetDisplayWithDisplayId(display_id_, &display)) { bool is_display_stale = display_id_ != current_display.id(); if (preserve_widget_bounds_ && is_display_stale) return; is_display_move_pending = window->GetProperty(ash::kLockedToRootKey) && is_display_stale; if (!is_display_move_pending) target_display = display; preserve_widget_bounds_ = is_display_move_pending; } else { preserve_widget_bounds_ = false; } gfx::Rect adjusted_bounds = bounds; if (!is_display_move_pending) { ash::wm::ClientControlledState::AdjustBoundsForMinimumWindowVisibility( target_display.bounds(), &adjusted_bounds); } if (adjusted_bounds == widget_->GetWindowBoundsInScreen() && target_display.id() == current_display.id()) { return; } bool set_bounds_locally = GetWindowState()->is_dragged() && !is_display_move_pending; if (set_bounds_locally || client_controlled_state_->set_bounds_locally()) { gfx::Point origin = bounds.origin(); wm::ConvertPointFromScreen(window->parent(), &origin); { ScopedSetBoundsLocally scoped_set_bounds(this); window->SetBounds(gfx::Rect(origin, adjusted_bounds.size())); } UpdateSurfaceBounds(); return; } { ScopedSetBoundsLocally scoped_set_bounds(this); window->SetBoundsInScreen(adjusted_bounds, target_display); } if (bounds != adjusted_bounds || is_display_move_pending) { auto state_type = GetWindowState()->GetStateType(); OnBoundsChangeEvent(state_type, state_type, target_display.id(), adjusted_bounds, 0); } UpdateSurfaceBounds(); } ",0 "static void free_buffer_page(struct buffer_page *bpage) { free_page((unsigned long)bpage->page); kfree(bpage); } ",0 "static void virtio_net_device_unrealize(DeviceState *dev, Error **errp) { VirtIODevice *vdev = VIRTIO_DEVICE(dev); VirtIONet *n = VIRTIO_NET(dev); int i; /* This will stop vhost backend if appropriate. */ virtio_net_set_status(vdev, 0); unregister_savevm(dev, ""virtio-net"", n); if (n->netclient_name) { g_free(n->netclient_name); n->netclient_name = NULL; } if (n->netclient_type) { g_free(n->netclient_type); n->netclient_type = NULL; } g_free(n->mac_table.macs); g_free(n->vlans); for (i = 0; i < n->max_queues; i++) { VirtIONetQueue *q = &n->vqs[i]; NetClientState *nc = qemu_get_subqueue(n->nic, i); qemu_purge_queued_packets(nc); if (q->tx_timer) { timer_del(q->tx_timer); timer_free(q->tx_timer); } else if (q->tx_bh) { qemu_bh_delete(q->tx_bh); } } g_free(n->vqs); qemu_del_nic(n->nic); virtio_cleanup(vdev); } ",0 "static int deliver_to_subscribers(struct snd_seq_client *client, struct snd_seq_event *event, int atomic, int hop) { struct snd_seq_subscribers *subs; int err, result = 0, num_ev = 0; struct snd_seq_event event_saved; struct snd_seq_client_port *src_port; struct snd_seq_port_subs_info *grp; src_port = snd_seq_port_use_ptr(client, event->source.port); if (src_port == NULL) return -EINVAL; /* invalid source port */ /* save original event record */ event_saved = *event; grp = &src_port->c_src; /* lock list */ if (atomic) read_lock(&grp->list_lock); else down_read(&grp->list_mutex); list_for_each_entry(subs, &grp->list_head, src_list) { event->dest = subs->info.dest; if (subs->info.flags & SNDRV_SEQ_PORT_SUBS_TIMESTAMP) /* convert time according to flag with subscription */ update_timestamp_of_queue(event, subs->info.queue, subs->info.flags & SNDRV_SEQ_PORT_SUBS_TIME_REAL); err = snd_seq_deliver_single_event(client, event, 0, atomic, hop); if (err < 0) { /* save first error that occurs and continue */ if (!result) result = err; continue; } num_ev++; /* restore original event record */ *event = event_saved; } if (atomic) read_unlock(&grp->list_lock); else up_read(&grp->list_mutex); *event = event_saved; /* restore */ snd_seq_port_unlock(src_port); return (result < 0) ? result : num_ev; } ",0 "static bool shuffle_freelist(struct kmem_cache *cachep, struct page *page) { unsigned int objfreelist = 0, i, rand, count = cachep->num; union freelist_init_state state; bool precomputed; if (count < 2) return false; precomputed = freelist_state_initialize(&state, cachep, count); /* Take a random entry as the objfreelist */ if (OBJFREELIST_SLAB(cachep)) { if (!precomputed) objfreelist = count - 1; else objfreelist = next_random_slot(&state); page->freelist = index_to_obj(cachep, page, objfreelist) + obj_offset(cachep); count--; } /* * On early boot, generate the list dynamically. * Later use a pre-computed list for speed. */ if (!precomputed) { for (i = 0; i < count; i++) set_free_obj(page, i, i); /* Fisher-Yates shuffle */ for (i = count - 1; i > 0; i--) { rand = prandom_u32_state(&state.rnd_state); rand %= (i + 1); swap_free_obj(page, i, rand); } } else { for (i = 0; i < count; i++) set_free_obj(page, i, next_random_slot(&state)); } if (OBJFREELIST_SLAB(cachep)) set_free_obj(page, cachep->num - 1, objfreelist); return true; } ",0 " PHP_FUNCTION(radius_get_vendor_attr) { int res; const void *data; int len; u_int32_t vendor; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""s"", &data, &len) == FAILURE) { return; } res = rad_get_vendor_attr(&vendor, &data, (size_t *) &len); if (res == -1) { RETURN_FALSE; } else { array_init(return_value); add_assoc_long(return_value, ""attr"", res); add_assoc_long(return_value, ""vendor"", vendor); add_assoc_stringl(return_value, ""data"", (char *) data, len, 1); return; } } ",1 "void TopSitesImpl::OnNavigationCommitted(const GURL& url) { DCHECK(thread_checker_.CalledOnValidThread()); if (!loaded_) return; if (can_add_url_to_history_.Run(url)) ScheduleUpdateTimer(); } ",0 "static int posix_get_monotonic_raw(clockid_t which_clock, struct timespec64 *tp) { ktime_get_raw_ts64(tp); return 0; } ",0 "evutil_make_socket_closeonexec(evutil_socket_t fd) { #if !defined(_WIN32) && defined(EVENT__HAVE_SETFD) int flags; if ((flags = fcntl(fd, F_GETFD, NULL)) < 0) { event_warn(""fcntl(%d, F_GETFD)"", fd); return -1; } if (!(flags & FD_CLOEXEC)) { if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) == -1) { event_warn(""fcntl(%d, F_SETFD)"", fd); return -1; } } #endif return 0; } ",0 "void RenderViewImpl::OnSetBackground(const SkBitmap& background) { if (webview()) webview()->setIsTransparent(!background.empty()); if (web_layer_tree_view_) web_layer_tree_view_->setHasTransparentBackground(!background.empty()); SetBackground(background); } ",0 "decomment(char *str) { bool quote = false; bool cont = false; char *skip = NULL; char *p = str + strspn(str, "" \t""); /* Remove leading whitespace */ if (p != str) memmove(str, p, strlen(p) + 1); p = str; while ((p = strpbrk(p, ""!#\""\\""))) { if (*p == '""') { if (!skip) quote = !quote; p++; continue; } if (*p == '\\') { if (p[1]) { /* Don't modify quoted strings */ if (!quote && (p[1] == '#' || p[1] == '!')) { memmove(p, p + 1, strlen(p + 1) + 1); p++; } else p += 2; continue; } *p = '\0'; cont = true; break; } if (!quote && !skip && (*p == '!' || *p == '#')) skip = p; p++; } if (quote) report_config_error(CONFIG_GENERAL_ERROR, ""Unterminated quote '%s'"", str); if (skip) *skip = '\0'; /* Remove trailing whitespace */ p = str + strlen(str) - 1; while (p >= str && isblank(*p)) *p-- = '\0'; if (cont) { *++p = '\\'; *++p = '\0'; } } ",0 "close_pl(PG_FUNCTION_ARGS) { Point *pt = PG_GETARG_POINT_P(0); LINE *line = PG_GETARG_LINE_P(1); Point *result; LINE *tmp; double invm; result = (Point *) palloc(sizeof(Point)); if (FPzero(line->B)) /* vertical? */ { result->x = line->C; result->y = pt->y; PG_RETURN_POINT_P(result); } if (FPzero(line->A)) /* horizontal? */ { result->x = pt->x; result->y = line->C; PG_RETURN_POINT_P(result); } /* drop a perpendicular and find the intersection point */ /* invert and flip the sign on the slope to get a perpendicular */ invm = line->B / line->A; tmp = line_construct_pm(pt, invm); result = line_interpt_internal(tmp, line); Assert(result != NULL); PG_RETURN_POINT_P(result); } ",0 "void HTMLSelectElement::setValue(const String &value) { if (value.isNull()) { setSelectedIndex(-1); return; } const Vector& items = listItems(); unsigned optionIndex = 0; for (unsigned i = 0; i < items.size(); i++) { if (items[i]->hasLocalName(optionTag)) { if (toHTMLOptionElement(items[i])->value() == value) { setSelectedIndex(optionIndex); return; } optionIndex++; } } setSelectedIndex(-1); } ",0 "CairoImage::CairoImage (double x1, double y1, double x2, double y2) { this->image = NULL; this->x1 = x1; this->y1 = y1; this->x2 = x2; this->y2 = y2; } ",0 "XML_SetDefaultHandlerExpand(XML_Parser parser, XML_DefaultHandler handler) { if (parser == NULL) return; parser->m_defaultHandler = handler; parser->m_defaultExpandInternalEntities = XML_TRUE; } ",0 "int kvm_get_dirty_log_protect(struct kvm *kvm, struct kvm_dirty_log *log, bool *flush) { struct kvm_memslots *slots; struct kvm_memory_slot *memslot; int i, as_id, id; unsigned long n; unsigned long *dirty_bitmap; unsigned long *dirty_bitmap_buffer; as_id = log->slot >> 16; id = (u16)log->slot; if (as_id >= KVM_ADDRESS_SPACE_NUM || id >= KVM_USER_MEM_SLOTS) return -EINVAL; slots = __kvm_memslots(kvm, as_id); memslot = id_to_memslot(slots, id); dirty_bitmap = memslot->dirty_bitmap; if (!dirty_bitmap) return -ENOENT; n = kvm_dirty_bitmap_bytes(memslot); *flush = false; if (kvm->manual_dirty_log_protect) { /* * Unlike kvm_get_dirty_log, we always return false in *flush, * because no flush is needed until KVM_CLEAR_DIRTY_LOG. There * is some code duplication between this function and * kvm_get_dirty_log, but hopefully all architecture * transition to kvm_get_dirty_log_protect and kvm_get_dirty_log * can be eliminated. */ dirty_bitmap_buffer = dirty_bitmap; } else { dirty_bitmap_buffer = kvm_second_dirty_bitmap(memslot); memset(dirty_bitmap_buffer, 0, n); spin_lock(&kvm->mmu_lock); for (i = 0; i < n / sizeof(long); i++) { unsigned long mask; gfn_t offset; if (!dirty_bitmap[i]) continue; *flush = true; mask = xchg(&dirty_bitmap[i], 0); dirty_bitmap_buffer[i] = mask; if (mask) { offset = i * BITS_PER_LONG; kvm_arch_mmu_enable_log_dirty_pt_masked(kvm, memslot, offset, mask); } } spin_unlock(&kvm->mmu_lock); } if (copy_to_user(log->dirty_bitmap, dirty_bitmap_buffer, n)) return -EFAULT; return 0; } ",0 "ExtensionPermissionSet* ExtensionPrefs::GetActivePermissions( const std::string& extension_id) { CHECK(Extension::IdIsValid(extension_id)); return ReadExtensionPrefPermissionSet(extension_id, kPrefActivePermissions); } ",0 "Node* TextTrackCue::Owner() const { return track_ ? track_->Owner() : nullptr; } ",0 "void RenderWidgetHostImpl::AccessibilityScrollToPoint( int acc_obj_id, gfx::Point point) { Send(new AccessibilityMsg_ScrollToPoint( GetRoutingID(), acc_obj_id, point)); } ",0 "void rfc_send_disc(tRFC_MCB* p_mcb, uint8_t dlci) { uint8_t* p_data; uint8_t cr = RFCOMM_CR(p_mcb->is_initiator, true); BT_HDR* p_buf = (BT_HDR*)osi_malloc(RFCOMM_CMD_BUF_SIZE); p_buf->offset = L2CAP_MIN_OFFSET; p_data = (uint8_t*)(p_buf + 1) + L2CAP_MIN_OFFSET; /* DISC frame, command, PF = 1, dlci */ *p_data++ = RFCOMM_EA | cr | (dlci << RFCOMM_SHIFT_DLCI); *p_data++ = RFCOMM_DISC | RFCOMM_PF; *p_data++ = RFCOMM_EA | 0; *p_data = RFCOMM_DISC_FCS((uint8_t*)(p_buf + 1) + L2CAP_MIN_OFFSET, cr, dlci); p_buf->len = 4; rfc_check_send_cmd(p_mcb, p_buf); } ",0 "static struct config_group *o2nm_cluster_group_make_group(struct config_group *group, const char *name) { struct o2nm_cluster *cluster = NULL; struct o2nm_node_group *ns = NULL; struct config_group *o2hb_group = NULL, *ret = NULL; /* this runs under the parent dir's i_mutex; there can be only * one caller in here at a time */ if (o2nm_single_cluster) return ERR_PTR(-ENOSPC); cluster = kzalloc(sizeof(struct o2nm_cluster), GFP_KERNEL); ns = kzalloc(sizeof(struct o2nm_node_group), GFP_KERNEL); o2hb_group = o2hb_alloc_hb_set(); if (cluster == NULL || ns == NULL || o2hb_group == NULL) goto out; config_group_init_type_name(&cluster->cl_group, name, &o2nm_cluster_type); configfs_add_default_group(&ns->ns_group, &cluster->cl_group); config_group_init_type_name(&ns->ns_group, ""node"", &o2nm_node_group_type); configfs_add_default_group(o2hb_group, &cluster->cl_group); rwlock_init(&cluster->cl_nodes_lock); cluster->cl_node_ip_tree = RB_ROOT; cluster->cl_reconnect_delay_ms = O2NET_RECONNECT_DELAY_MS_DEFAULT; cluster->cl_idle_timeout_ms = O2NET_IDLE_TIMEOUT_MS_DEFAULT; cluster->cl_keepalive_delay_ms = O2NET_KEEPALIVE_DELAY_MS_DEFAULT; cluster->cl_fence_method = O2NM_FENCE_RESET; ret = &cluster->cl_group; o2nm_single_cluster = cluster; out: if (ret == NULL) { kfree(cluster); kfree(ns); o2hb_free_hb_set(o2hb_group); ret = ERR_PTR(-ENOMEM); } return ret; } ",0 "png_set_gamma(png_structp png_ptr, double scrn_gamma, double file_gamma) { png_debug(1, ""in png_set_gamma""); if (png_ptr == NULL) return; if ((fabs(scrn_gamma * file_gamma - 1.0) > PNG_GAMMA_THRESHOLD) || (png_ptr->color_type & PNG_COLOR_MASK_ALPHA) || (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)) png_ptr->transformations |= PNG_GAMMA; png_ptr->gamma = (float)file_gamma; png_ptr->screen_gamma = (float)scrn_gamma; } ",0 "void GaiaCookieManagerService::OnLogOutFailure( const GoogleServiceAuthError& error) { DCHECK(requests_.front().request_type() == GaiaCookieRequestType::LOG_OUT); VLOG(1) << ""GaiaCookieManagerService::OnLogOutFailure""; if (++fetcher_retries_ < kMaxFetcherRetries) { fetcher_backoff_.InformOfRequest(false); fetcher_timer_.Start( FROM_HERE, fetcher_backoff_.GetTimeUntilRelease(), base::Bind(&SigninClient::DelayNetworkCall, base::Unretained(signin_client_), base::Bind(&GaiaCookieManagerService::StartFetchingLogOut, base::Unretained(this)))); return; } for (auto& observer : observer_list_) observer.OnLogOutAccountsFromCookieCompleted(error); HandleNextRequest(); } ",0 "bool smb2cli_conn_req_possible(struct smbXcli_conn *conn, uint32_t *max_dyn_len) { uint16_t credits = 1; if (conn->smb2.cur_credits == 0) { if (max_dyn_len != NULL) { *max_dyn_len = 0; } return false; } if (conn->smb2.server.capabilities & SMB2_CAP_LARGE_MTU) { credits = conn->smb2.cur_credits; } if (max_dyn_len != NULL) { *max_dyn_len = credits * 65536; } return true; } ",0 "static uint32_t *nfs_add_uint32(uint32_t *p, uint32_t val) { *p++ = hton32(val); return p; } ",0 "void Channel::ChannelImpl::OnFileCanWriteWithoutBlocking(int fd) { if (!ProcessOutgoingMessages()) { Close(); listener_->OnChannelError(); } } ",0 "void GlobalConfirmInfoBar::TabInsertedAt(TabStripModel* tab_strip_model, content::WebContents* web_contents, int index, bool foreground) { MaybeAddInfoBar(web_contents); } ",0 "static __init int svm_hardware_setup(void) { int cpu; struct page *iopm_pages; void *iopm_va; int r; iopm_pages = alloc_pages(GFP_KERNEL, IOPM_ALLOC_ORDER); if (!iopm_pages) return -ENOMEM; iopm_va = page_address(iopm_pages); memset(iopm_va, 0xff, PAGE_SIZE * (1 << IOPM_ALLOC_ORDER)); iopm_base = page_to_pfn(iopm_pages) << PAGE_SHIFT; init_msrpm_offsets(); if (boot_cpu_has(X86_FEATURE_NX)) kvm_enable_efer_bits(EFER_NX); if (boot_cpu_has(X86_FEATURE_FXSR_OPT)) kvm_enable_efer_bits(EFER_FFXSR); if (boot_cpu_has(X86_FEATURE_TSCRATEMSR)) { kvm_has_tsc_control = true; kvm_max_tsc_scaling_ratio = TSC_RATIO_MAX; kvm_tsc_scaling_ratio_frac_bits = 32; } if (nested) { printk(KERN_INFO ""kvm: Nested Virtualization enabled\n""); kvm_enable_efer_bits(EFER_SVME | EFER_LMSLE); } for_each_possible_cpu(cpu) { r = svm_cpu_init(cpu); if (r) goto err; } if (!boot_cpu_has(X86_FEATURE_NPT)) npt_enabled = false; if (npt_enabled && !npt) { printk(KERN_INFO ""kvm: Nested Paging disabled\n""); npt_enabled = false; } if (npt_enabled) { printk(KERN_INFO ""kvm: Nested Paging enabled\n""); kvm_enable_tdp(); } else kvm_disable_tdp(); return 0; err: __free_pages(iopm_pages, IOPM_ALLOC_ORDER); iopm_base = 0; return r; } ",0 "static u32 vmx_exec_control(struct vcpu_vmx *vmx) { u32 exec_control = vmcs_config.cpu_based_exec_ctrl; if (vmx->vcpu.arch.switch_db_regs & KVM_DEBUGREG_WONT_EXIT) exec_control &= ~CPU_BASED_MOV_DR_EXITING; if (!cpu_need_tpr_shadow(&vmx->vcpu)) { exec_control &= ~CPU_BASED_TPR_SHADOW; #ifdef CONFIG_X86_64 exec_control |= CPU_BASED_CR8_STORE_EXITING | CPU_BASED_CR8_LOAD_EXITING; #endif } if (!enable_ept) exec_control |= CPU_BASED_CR3_STORE_EXITING | CPU_BASED_CR3_LOAD_EXITING | CPU_BASED_INVLPG_EXITING; if (kvm_mwait_in_guest(vmx->vcpu.kvm)) exec_control &= ~(CPU_BASED_MWAIT_EXITING | CPU_BASED_MONITOR_EXITING); if (kvm_hlt_in_guest(vmx->vcpu.kvm)) exec_control &= ~CPU_BASED_HLT_EXITING; return exec_control; } ",0 "void FragmentPaintPropertyTreeBuilder::UpdateCssClip() { DCHECK(properties_); if (NeedsPaintPropertyUpdate()) { if (NeedsCssClip(object_)) { DCHECK(object_.CanContainAbsolutePositionObjects()); OnUpdateClip(properties_->UpdateCssClip( context_.current.clip, ClipPaintPropertyNode::State{context_.current.transform, ToClipRect(ToLayoutBox(object_).ClipRect( context_.current.paint_offset))})); } else { OnClearClip(properties_->ClearCssClip()); } } if (properties_->CssClip()) context_.current.clip = properties_->CssClip(); } ",1 "void license_decrypt_platform_challenge(rdpLicense* license) { CryptoRc4 rc4; license->PlatformChallenge->data = (BYTE*) malloc(license->EncryptedPlatformChallenge->length); license->PlatformChallenge->length = license->EncryptedPlatformChallenge->length; rc4 = crypto_rc4_init(license->LicensingEncryptionKey, LICENSING_ENCRYPTION_KEY_LENGTH); crypto_rc4(rc4, license->EncryptedPlatformChallenge->length, license->EncryptedPlatformChallenge->data, license->PlatformChallenge->data); crypto_rc4_free(rc4); } ",0 "static void show_smap_vma_flags(struct seq_file *m, struct vm_area_struct *vma) { /* * Don't forget to update Documentation/ on changes. */ static const char mnemonics[BITS_PER_LONG][2] = { /* * In case if we meet a flag we don't know about. */ [0 ... (BITS_PER_LONG-1)] = ""??"", [ilog2(VM_READ)] = ""rd"", [ilog2(VM_WRITE)] = ""wr"", [ilog2(VM_EXEC)] = ""ex"", [ilog2(VM_SHARED)] = ""sh"", [ilog2(VM_MAYREAD)] = ""mr"", [ilog2(VM_MAYWRITE)] = ""mw"", [ilog2(VM_MAYEXEC)] = ""me"", [ilog2(VM_MAYSHARE)] = ""ms"", [ilog2(VM_GROWSDOWN)] = ""gd"", [ilog2(VM_PFNMAP)] = ""pf"", [ilog2(VM_DENYWRITE)] = ""dw"", #ifdef CONFIG_X86_INTEL_MPX [ilog2(VM_MPX)] = ""mp"", #endif [ilog2(VM_LOCKED)] = ""lo"", [ilog2(VM_IO)] = ""io"", [ilog2(VM_SEQ_READ)] = ""sr"", [ilog2(VM_RAND_READ)] = ""rr"", [ilog2(VM_DONTCOPY)] = ""dc"", [ilog2(VM_DONTEXPAND)] = ""de"", [ilog2(VM_ACCOUNT)] = ""ac"", [ilog2(VM_NORESERVE)] = ""nr"", [ilog2(VM_HUGETLB)] = ""ht"", [ilog2(VM_SYNC)] = ""sf"", [ilog2(VM_ARCH_1)] = ""ar"", [ilog2(VM_WIPEONFORK)] = ""wf"", [ilog2(VM_DONTDUMP)] = ""dd"", #ifdef CONFIG_MEM_SOFT_DIRTY [ilog2(VM_SOFTDIRTY)] = ""sd"", #endif [ilog2(VM_MIXEDMAP)] = ""mm"", [ilog2(VM_HUGEPAGE)] = ""hg"", [ilog2(VM_NOHUGEPAGE)] = ""nh"", [ilog2(VM_MERGEABLE)] = ""mg"", [ilog2(VM_UFFD_MISSING)]= ""um"", [ilog2(VM_UFFD_WP)] = ""uw"", #ifdef CONFIG_ARCH_HAS_PKEYS /* These come out via ProtectionKey: */ [ilog2(VM_PKEY_BIT0)] = """", [ilog2(VM_PKEY_BIT1)] = """", [ilog2(VM_PKEY_BIT2)] = """", [ilog2(VM_PKEY_BIT3)] = """", #if VM_PKEY_BIT4 [ilog2(VM_PKEY_BIT4)] = """", #endif #endif /* CONFIG_ARCH_HAS_PKEYS */ }; size_t i; seq_puts(m, ""VmFlags: ""); for (i = 0; i < BITS_PER_LONG; i++) { if (!mnemonics[i][0]) continue; if (vma->vm_flags & (1UL << i)) { seq_putc(m, mnemonics[i][0]); seq_putc(m, mnemonics[i][1]); seq_putc(m, ' '); } } seq_putc(m, '\n'); } ",0 "void address_space_stq_le(AddressSpace *as, hwaddr addr, uint64_t val, MemTxAttrs attrs, MemTxResult *result) { MemTxResult r; val = cpu_to_le64(val); r = address_space_rw(as, addr, attrs, (void *) &val, 8, 1); if (result) { *result = r; } } ",0 "static void adev_close_input_stream(struct audio_hw_device *dev, struct audio_stream_in *stream) { struct audio_device *adev = (struct audio_device *)dev; struct stream_in *in = (struct stream_in*)stream; ALOGV(""%s"", __func__); /* prevent concurrent out_set_parameters, or out_write from standby */ pthread_mutex_lock(&adev->lock_inputs); in_standby_l(in); pthread_mutex_destroy(&in->lock); pthread_mutex_destroy(&in->pre_lock); free(in->proc_buf_out); #ifdef PREPROCESSING_ENABLED int i; for (i=0; inum_preprocessors; i++) { free(in->preprocessors[i].channel_configs); } if (in->read_buf) { free(in->read_buf); } if (in->proc_buf_in) { free(in->proc_buf_in); } if (in->resampler) { release_resampler(in->resampler); } #endif free(stream); pthread_mutex_unlock(&adev->lock_inputs); return; } ",0 "int kvm_io_bus_read(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr, int len, void *val) { int i; struct kvm_io_bus *bus; bus = srcu_dereference(kvm->buses[bus_idx], &kvm->srcu); for (i = 0; i < bus->dev_count; i++) if (!kvm_iodevice_read(bus->devs[i], addr, len, val)) return 0; return -EOPNOTSUPP; } ",0 "int tty_paranoia_check(struct tty_struct *tty, struct inode *inode, const char *routine) { #ifdef TTY_PARANOIA_CHECK if (!tty) { printk(KERN_WARNING ""null TTY for (%d:%d) in %s\n"", imajor(inode), iminor(inode), routine); return 1; } if (tty->magic != TTY_MAGIC) { printk(KERN_WARNING ""bad magic number for tty struct (%d:%d) in %s\n"", imajor(inode), iminor(inode), routine); return 1; } #endif return 0; } ",0 "static int wait_consider_task(struct task_struct *parent, int ptrace, struct task_struct *p, int *notask_error, enum pid_type type, struct pid *pid, int options, struct siginfo __user *infop, int __user *stat_addr, struct rusage __user *ru) { int ret = eligible_child(type, pid, options, p); if (!ret) return ret; if (unlikely(ret < 0)) { /* * If we have not yet seen any eligible child, * then let this error code replace -ECHILD. * A permission error will give the user a clue * to look for security policy problems, rather * than for mysterious wait bugs. */ if (*notask_error) *notask_error = ret; } if (likely(!ptrace) && unlikely(p->ptrace)) { /* * This child is hidden by ptrace. * We aren't allowed to see it now, but eventually we will. */ *notask_error = 0; return 0; } if (p->exit_state == EXIT_DEAD) return 0; /* * We don't reap group leaders with subthreads. */ if (p->exit_state == EXIT_ZOMBIE && !delay_group_leader(p)) return wait_task_zombie(p, options, infop, stat_addr, ru); /* * It's stopped or running now, so it might * later continue, exit, or stop again. */ *notask_error = 0; if (task_is_stopped_or_traced(p)) return wait_task_stopped(ptrace, p, options, infop, stat_addr, ru); return wait_task_continued(p, options, infop, stat_addr, ru); } ",0 " void HostCache::RecordSet(SetOutcome outcome, base::TimeTicks now, const Entry* old_entry, const Entry& new_entry) { CACHE_HISTOGRAM_ENUM(""Set"", outcome, MAX_SET_OUTCOME); switch (outcome) { case SET_INSERT: case SET_UPDATE_VALID: break; case SET_UPDATE_STALE: { EntryStaleness stale; old_entry->GetStaleness(now, network_changes_, &stale); CACHE_HISTOGRAM_TIME(""UpdateStale.ExpiredBy"", stale.expired_by); CACHE_HISTOGRAM_COUNT(""UpdateStale.NetworkChanges"", stale.network_changes); CACHE_HISTOGRAM_COUNT(""UpdateStale.StaleHits"", stale.stale_hits); if (old_entry->error() == OK && new_entry.error() == OK) { AddressListDeltaType delta = FindAddressListDeltaType( old_entry->addresses(), new_entry.addresses()); RecordUpdateStale(delta, stale); } break; } case MAX_SET_OUTCOME: NOTREACHED(); break; } } ",1 "static int shutdown_macvlan(struct lxc_handler *handler, struct lxc_netdev *netdev) { int err; if (netdev->downscript) { err = run_script(handler->name, ""net"", netdev->downscript, ""down"", ""macvlan"", netdev->link, (char*) NULL); if (err) return -1; } return 0; } ",0 "get_target_file_for_link (GFile *src, GFile *dest_dir, const char *dest_fs_type, int count) { const char *editname; char *basename, *new_name; GFileInfo *info; GFile *dest; int max_length; max_length = get_max_name_length (dest_dir); dest = NULL; info = g_file_query_info (src, G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME, 0, NULL, NULL); if (info != NULL) { editname = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME); if (editname != NULL) { new_name = get_link_name (editname, count, max_length); make_file_name_valid_for_dest_fs (new_name, dest_fs_type); dest = g_file_get_child_for_display_name (dest_dir, new_name, NULL); g_free (new_name); } g_object_unref (info); } if (dest == NULL) { basename = g_file_get_basename (src); make_file_name_valid_for_dest_fs (basename, dest_fs_type); if (g_utf8_validate (basename, -1, NULL)) { new_name = get_link_name (basename, count, max_length); make_file_name_valid_for_dest_fs (new_name, dest_fs_type); dest = g_file_get_child_for_display_name (dest_dir, new_name, NULL); g_free (new_name); } if (dest == NULL) { if (count == 1) { new_name = g_strdup_printf (""%s.lnk"", basename); } else { new_name = g_strdup_printf (""%s.lnk%d"", basename, count); } make_file_name_valid_for_dest_fs (new_name, dest_fs_type); dest = g_file_get_child (dest_dir, new_name); g_free (new_name); } g_free (basename); } return dest; } ",0 "v8::Persistent V8TestActiveDOMObject::GetRawTemplate() { V8BindingPerIsolateData* data = V8BindingPerIsolateData::current(); V8BindingPerIsolateData::TemplateMap::iterator result = data->rawTemplateMap().find(&info); if (result != data->rawTemplateMap().end()) return result->second; v8::HandleScope handleScope; v8::Persistent templ = createRawTemplate(); data->rawTemplateMap().add(&info, templ); return templ; } ",0 "void MediaStreamManager::CloseDevice(MediaStreamType type, int session_id) { DCHECK_CURRENTLY_ON(BrowserThread::IO); DVLOG(1) << ""CloseDevice("" << ""{type = "" << type << ""} "" << ""{session_id = "" << session_id << ""})""; GetDeviceManager(type)->Close(session_id); for (const LabeledDeviceRequest& labeled_request : requests_) { DeviceRequest* const request = labeled_request.second; for (const MediaStreamDevice& device : request->devices) { if (device.session_id == session_id && device.type == type) { request->SetState(type, MEDIA_REQUEST_STATE_CLOSING); } } } } ",0 "void WebMediaPlayerImpl::OnRemotePlaybackEnded() { DVLOG(1) << __func__; DCHECK(main_task_runner_->BelongsToCurrentThread()); ended_ = true; client_->TimeChanged(); } ",0 "static int snd_hrtimer_stop(struct snd_timer *t) { struct snd_hrtimer *stime = t->private_data; atomic_set(&stime->running, 0); return 0; } ",1 "void TimeoutCallback(const std::string& timeout_message) { FAIL() << timeout_message; MessageLoop::current()->Quit(); } ",0 "GahpClient::globus_gram_client_get_jobmanager_version(const char * resource_contact) { static const char* command = ""GRAM_GET_JOBMANAGER_VERSION""; if (server->m_commands_supported->contains_anycase(command)==FALSE) { return GAHPCLIENT_COMMAND_NOT_SUPPORTED; } if (!resource_contact) resource_contact=NULLSTRING; std::string reqline; int x = sprintf(reqline,""%s"",escapeGahpString(resource_contact)); ASSERT( x > 0 ); const char *buf = reqline.c_str(); if ( !is_pending(command,buf) ) { if ( m_mode == results_only ) { return GAHPCLIENT_COMMAND_NOT_SUBMITTED; } now_pending(command,buf,normal_proxy); } Gahp_Args* result = get_pending_result(command,buf); if ( result ) { if (result->argc < 2) { EXCEPT(""Bad %s Result"",command); } int rc = atoi(result->argv[1]); delete result; return rc; } if ( check_pending_timeout(command,buf) ) { sprintf( error_string, ""%s timed out"", command ); return GAHPCLIENT_COMMAND_TIMED_OUT; } return GAHPCLIENT_COMMAND_PENDING; } ",0 "static int coroutine_fn iscsi_co_readv(BlockDriverState *bs, int64_t sector_num, int nb_sectors, QEMUIOVector *iov) { IscsiLun *iscsilun = bs->opaque; struct IscsiTask iTask; uint64_t lba; uint32_t num_sectors; if (!is_request_lun_aligned(sector_num, nb_sectors, iscsilun)) { return -EINVAL; } if (bs->bl.max_transfer_length && nb_sectors > bs->bl.max_transfer_length) { error_report(""iSCSI Error: Read of %d sectors exceeds max_xfer_len "" ""of %d sectors"", nb_sectors, bs->bl.max_transfer_length); return -EINVAL; } if (iscsilun->lbprz && nb_sectors >= ISCSI_CHECKALLOC_THRES && !iscsi_allocationmap_is_allocated(iscsilun, sector_num, nb_sectors)) { int64_t ret; int pnum; BlockDriverState *file; ret = iscsi_co_get_block_status(bs, sector_num, INT_MAX, &pnum, &file); if (ret < 0) { return ret; } if (ret & BDRV_BLOCK_ZERO && pnum >= nb_sectors) { qemu_iovec_memset(iov, 0, 0x00, iov->size); return 0; } } lba = sector_qemu2lun(sector_num, iscsilun); num_sectors = sector_qemu2lun(nb_sectors, iscsilun); iscsi_co_init_iscsitask(iscsilun, &iTask); retry: if (iscsilun->use_16_for_rw) { iTask.task = iscsi_read16_task(iscsilun->iscsi, iscsilun->lun, lba, num_sectors * iscsilun->block_size, iscsilun->block_size, 0, 0, 0, 0, 0, iscsi_co_generic_cb, &iTask); } else { iTask.task = iscsi_read10_task(iscsilun->iscsi, iscsilun->lun, lba, num_sectors * iscsilun->block_size, iscsilun->block_size, 0, 0, 0, 0, 0, iscsi_co_generic_cb, &iTask); } if (iTask.task == NULL) { return -ENOMEM; } scsi_task_set_iov_in(iTask.task, (struct scsi_iovec *) iov->iov, iov->niov); while (!iTask.complete) { iscsi_set_events(iscsilun); qemu_coroutine_yield(); } if (iTask.task != NULL) { scsi_free_scsi_task(iTask.task); iTask.task = NULL; } if (iTask.do_retry) { iTask.complete = 0; goto retry; } if (iTask.status != SCSI_STATUS_GOOD) { return iTask.err_code; } return 0; } ",0 "size_t QuicStreamSequencerBuffer::BytesBuffered() const { return num_bytes_buffered_; } ",0 "ACTION_P(SetBool, var) { *var = true; } ",0 "void wake_up_klogd(void) { if (waitqueue_active(&log_wait)) this_cpu_or(printk_pending, PRINTK_PENDING_WAKEUP); } ",0 "static int sha1_export(struct shash_desc *desc, void *out) { struct s390_sha_ctx *sctx = shash_desc_ctx(desc); struct sha1_state *octx = out; octx->count = sctx->count; memcpy(octx->state, sctx->state, sizeof(octx->state)); memcpy(octx->buffer, sctx->buf, sizeof(octx->buffer)); return 0; } ",0 "static void ext4_da_page_release_reservation(struct page *page, unsigned long offset) { int to_release = 0; struct buffer_head *head, *bh; unsigned int curr_off = 0; head = page_buffers(page); bh = head; do { unsigned int next_off = curr_off + bh->b_size; if ((offset <= curr_off) && (buffer_delay(bh))) { to_release++; clear_buffer_delay(bh); } curr_off = next_off; } while ((bh = bh->b_this_page) != head); ext4_da_release_space(page->mapping->host, to_release); } ",0 "QStringList IrcViewMimeData::formats() const { if (!fragment.isEmpty()) return QStringList() << QString::fromLatin1(""text/plain""); else return QMimeData::formats(); } ",0 "void RenderWidgetHostViewAura::SendReclaimSoftwareFrames() { if (!released_software_frame_) return; cc::CompositorFrameAck ack; ack.last_software_frame_id = released_software_frame_->frame_id; RenderWidgetHostImpl::SendReclaimCompositorResources( host_->GetRoutingID(), released_software_frame_->output_surface_id, host_->GetProcess()->GetID(), ack); released_software_frame_.reset(); } ",0 "bool TranslateInfoBarDelegate::ShouldShowMessageInfoBarButton() { return !GetMessageInfoBarButtonText().empty(); } ",0 "void ram_handle_compressed(void *host, uint8_t ch, uint64_t size) { if (ch != 0 || !is_zero_range(host, size)) { memset(host, ch, size); } } ",0 "static int __init camellia_init(void) { return crypto_register_alg(&camellia_alg); } ",0 "pp::Rect PDFiumEngine::GetPageRect(int index) { pp::Rect rc(pages_[index]->rect()); rc.Inset(-kPageShadowLeft, -kPageShadowTop, -kPageShadowRight, -kPageShadowBottom); return rc; } ",0 " explicit TestFinishObserver(RenderViewHost* render_view_host, int timeout_s) : finished_(false), waiting_(false), timeout_s_(timeout_s) { registrar_.Add(this, content::NOTIFICATION_DOM_OPERATION_RESPONSE, content::Source(render_view_host)); timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(timeout_s), this, &TestFinishObserver::OnTimeout); } ",0 "void LayerTreeHost::PushPropertiesTo(LayerTreeImpl* tree_impl) { tree_impl->set_needs_full_tree_sync(needs_full_tree_sync_); needs_full_tree_sync_ = false; if (hud_layer_.get()) { LayerImpl* hud_impl = tree_impl->LayerById(hud_layer_->id()); tree_impl->set_hud_layer(static_cast(hud_impl)); } else { tree_impl->set_hud_layer(nullptr); } tree_impl->set_background_color(background_color_); tree_impl->set_has_transparent_background(has_transparent_background_); tree_impl->set_have_scroll_event_handlers(have_scroll_event_handlers_); tree_impl->set_event_listener_properties( EventListenerClass::kTouchStartOrMove, event_listener_properties(EventListenerClass::kTouchStartOrMove)); tree_impl->set_event_listener_properties( EventListenerClass::kMouseWheel, event_listener_properties(EventListenerClass::kMouseWheel)); tree_impl->set_event_listener_properties( EventListenerClass::kTouchEndOrCancel, event_listener_properties(EventListenerClass::kTouchEndOrCancel)); if (page_scale_layer_ && inner_viewport_scroll_layer_) { tree_impl->SetViewportLayersFromIds( overscroll_elasticity_layer_ ? overscroll_elasticity_layer_->id() : Layer::INVALID_ID, page_scale_layer_->id(), inner_viewport_scroll_layer_->id(), outer_viewport_scroll_layer_ ? outer_viewport_scroll_layer_->id() : Layer::INVALID_ID); DCHECK(inner_viewport_scroll_layer_->IsContainerForFixedPositionLayers()); } else { tree_impl->ClearViewportLayers(); } tree_impl->RegisterSelection(selection_); bool property_trees_changed_on_active_tree = tree_impl->IsActiveTree() && tree_impl->property_trees()->changed; if (root_layer_ && property_trees_changed_on_active_tree) { if (property_trees_.sequence_number == tree_impl->property_trees()->sequence_number) tree_impl->property_trees()->PushChangeTrackingTo(&property_trees_); else tree_impl->MoveChangeTrackingToLayers(); } tree_impl->SetPropertyTrees(&property_trees_); tree_impl->PushPageScaleFromMainThread( page_scale_factor_, min_page_scale_factor_, max_page_scale_factor_); tree_impl->set_browser_controls_shrink_blink_size( browser_controls_shrink_blink_size_); tree_impl->set_top_controls_height(top_controls_height_); tree_impl->set_bottom_controls_height(bottom_controls_height_); tree_impl->PushBrowserControlsFromMainThread(top_controls_shown_ratio_); tree_impl->elastic_overscroll()->PushFromMainThread(elastic_overscroll_); if (tree_impl->IsActiveTree()) tree_impl->elastic_overscroll()->PushPendingToActive(); tree_impl->set_painted_device_scale_factor(painted_device_scale_factor_); tree_impl->SetDeviceColorSpace(device_color_space_); if (pending_page_scale_animation_) { tree_impl->SetPendingPageScaleAnimation( std::move(pending_page_scale_animation_)); } DCHECK(!tree_impl->ViewportSizeInvalid()); tree_impl->set_has_ever_been_drawn(false); } ",1 "static bool GetTabById(int tab_id, Profile* profile, bool include_incognito, Browser** browser, TabStripModel** tab_strip, TabContents** contents, int* tab_index, std::string* error_message) { if (ExtensionTabUtil::GetTabById(tab_id, profile, include_incognito, browser, tab_strip, contents, tab_index)) return true; if (error_message) *error_message = ExtensionErrorUtils::FormatErrorMessage( keys::kTabNotFoundError, IntToString(tab_id)); return false; } ",0 "void HTMLConstructionSite::insertHTMLHtmlStartTagBeforeHTML(AtomicHTMLToken& token) { RefPtr element = HTMLHtmlElement::create(m_document); element->setAttributeMap(token.takeAtributes(), m_fragmentScriptingPermission); m_openElements.pushHTMLHtmlElement(attach(m_document, element.release())); dispatchDocumentElementAvailableIfNeeded(); } ",0 "static int build_ike_version() { return ((IKEv2_MAJOR_VERSION + (DBGP(IMPAIR_MAJOR_VERSION_BUMP) ? 1 : 0)) << ISA_MAJ_SHIFT) | (IKEv2_MINOR_VERSION + (DBGP(IMPAIR_MINOR_VERSION_BUMP) ? 1 : 0)); } ",0 "static int amd_pinconf_get(struct pinctrl_dev *pctldev, unsigned int pin, unsigned long *config) { u32 pin_reg; unsigned arg; unsigned long flags; struct amd_gpio *gpio_dev = pinctrl_dev_get_drvdata(pctldev); enum pin_config_param param = pinconf_to_config_param(*config); spin_lock_irqsave(&gpio_dev->lock, flags); pin_reg = readl(gpio_dev->base + pin*4); spin_unlock_irqrestore(&gpio_dev->lock, flags); switch (param) { case PIN_CONFIG_INPUT_DEBOUNCE: arg = pin_reg & DB_TMR_OUT_MASK; break; case PIN_CONFIG_BIAS_PULL_DOWN: arg = (pin_reg >> PULL_DOWN_ENABLE_OFF) & BIT(0); break; case PIN_CONFIG_BIAS_PULL_UP: arg = (pin_reg >> PULL_UP_SEL_OFF) & (BIT(0) | BIT(1)); break; case PIN_CONFIG_DRIVE_STRENGTH: arg = (pin_reg >> DRV_STRENGTH_SEL_OFF) & DRV_STRENGTH_SEL_MASK; break; default: dev_err(&gpio_dev->pdev->dev, ""Invalid config param %04x\n"", param); return -ENOTSUPP; } *config = pinconf_to_config_packed(param, arg); return 0; } ",0 "get_filter(struct archive *_a, int n) { struct archive_read *a = (struct archive_read *)_a; struct archive_read_filter *f = a->filter; /* We use n == -1 for 'the last filter', which is always the * client proxy. */ if (n == -1 && f != NULL) { struct archive_read_filter *last = f; f = f->upstream; while (f != NULL) { last = f; f = f->upstream; } return (last); } if (n < 0) return NULL; while (n > 0 && f != NULL) { f = f->upstream; --n; } return (f); } ",0 "static int ax25_accept(struct socket *sock, struct socket *newsock, int flags) { struct sk_buff *skb; struct sock *newsk; DEFINE_WAIT(wait); struct sock *sk; int err = 0; if (sock->state != SS_UNCONNECTED) return -EINVAL; if ((sk = sock->sk) == NULL) return -EINVAL; lock_sock(sk); if (sk->sk_type != SOCK_SEQPACKET) { err = -EOPNOTSUPP; goto out; } if (sk->sk_state != TCP_LISTEN) { err = -EINVAL; goto out; } /* * The read queue this time is holding sockets ready to use * hooked into the SABM we saved */ for (;;) { prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); skb = skb_dequeue(&sk->sk_receive_queue); if (skb) break; if (flags & O_NONBLOCK) { err = -EWOULDBLOCK; break; } if (!signal_pending(current)) { release_sock(sk); schedule(); lock_sock(sk); continue; } err = -ERESTARTSYS; break; } finish_wait(sk_sleep(sk), &wait); if (err) goto out; newsk = skb->sk; sock_graft(newsk, newsock); /* Now attach up the new socket */ kfree_skb(skb); sk->sk_ack_backlog--; newsock->state = SS_CONNECTED; out: release_sock(sk); return err; } ",0 "static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb) { struct net *net = sock_net(skb->sk); int h, s_h; int idx = 0, s_idx; struct net_device *dev; struct hlist_head *head; struct nlattr *tb[IFLA_MAX+1]; u32 ext_filter_mask = 0; s_h = cb->args[0]; s_idx = cb->args[1]; rcu_read_lock(); cb->seq = net->dev_base_seq; if (nlmsg_parse(cb->nlh, sizeof(struct rtgenmsg), tb, IFLA_MAX, ifla_policy) >= 0) { if (tb[IFLA_EXT_MASK]) ext_filter_mask = nla_get_u32(tb[IFLA_EXT_MASK]); } for (h = s_h; h < NETDEV_HASHENTRIES; h++, s_idx = 0) { idx = 0; head = &net->dev_index_head[h]; hlist_for_each_entry_rcu(dev, head, index_hlist) { if (idx < s_idx) goto cont; if (rtnl_fill_ifinfo(skb, dev, RTM_NEWLINK, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, 0, NLM_F_MULTI, ext_filter_mask) <= 0) goto out; nl_dump_check_consistent(cb, nlmsg_hdr(skb)); cont: idx++; } } out: rcu_read_unlock(); cb->args[1] = idx; cb->args[0] = h; return skb->len; } ",0 "static int vmx_get_cpl(struct kvm_vcpu *vcpu) { struct vcpu_vmx *vmx = to_vmx(vcpu); if (unlikely(vmx->rmode.vm86_active)) return 0; else { int ar = vmx_read_guest_seg_ar(vmx, VCPU_SREG_SS); return AR_DPL(ar); } } ",0 "void TestingAutomationProvider::WaitForProcessLauncherThreadToGoIdle( IPC::Message* reply_message) { new WaitForProcessLauncherThreadToGoIdleObserver(this, reply_message); } ",0 "static int get_parent_attributes(struct svc_export *exp, struct kstat *stat) { struct path path = exp->ex_path; int err; path_get(&path); while (follow_up(&path)) { if (path.dentry != path.mnt->mnt_root) break; } err = vfs_getattr(&path, stat, STATX_BASIC_STATS, AT_STATX_SYNC_AS_STAT); path_put(&path); return err; } ",0 "match_principals_option(const char *principal_list, struct sshkey_cert *cert) { char *result; u_int i; /* XXX percent_expand() sequences for authorized_principals? */ for (i = 0; i < cert->nprincipals; i++) { if ((result = match_list(cert->principals[i], principal_list, NULL)) != NULL) { debug3(""matched principal from key options \""%.100s\"""", result); free(result); return 1; } } return 0; } ",0 "void ProfileSyncService::StopAndSuppress() { sync_prefs_.SetStartSuppressed(true); ShutdownImpl(false); } ",0 "IW_IMPL(int) iw_parse_int(const char *s) { double result; int charsread; iw_parse_number_internal(s, &result, &charsread); return iw_round_to_int(result); } ",0 "iperf_set_test_role(struct iperf_test *ipt, char role) { ipt->role = role; if (role == 'c') ipt->sender = 1; else if (role == 's') ipt->sender = 0; if (ipt->reverse) ipt->sender = ! ipt->sender; check_sender_has_retransmits(ipt); } ",0 "void ShelfBackgroundAnimator::OnBackgroundTypeChanged( ShelfBackgroundType background_type, AnimationChangeType change_type) { PaintBackground(background_type, change_type); } ",0 "static bool startsSingleLineCommentAt(const String& string, size_t start) { return (start + 1 < string.length() && string[start] == '/' && string[start+1] == '/'); } ",0 "void LayerTreeHostImpl::UpdateTileManagerMemoryPolicy( const ManagedMemoryPolicy& policy) { if (!resource_pool_) return; global_tile_state_.hard_memory_limit_in_bytes = 0; global_tile_state_.soft_memory_limit_in_bytes = 0; if (visible_ && policy.bytes_limit_when_visible > 0) { global_tile_state_.hard_memory_limit_in_bytes = policy.bytes_limit_when_visible; global_tile_state_.soft_memory_limit_in_bytes = (static_cast(global_tile_state_.hard_memory_limit_in_bytes) * settings_.max_memory_for_prepaint_percentage) / 100; } global_tile_state_.memory_limit_policy = ManagedMemoryPolicy::PriorityCutoffToTileMemoryLimitPolicy( visible_ ? policy.priority_cutoff_when_visible : gpu::MemoryAllocation::CUTOFF_ALLOW_NOTHING); global_tile_state_.num_resources_limit = policy.num_resources_limit; if (global_tile_state_.hard_memory_limit_in_bytes > 0) { SetContextVisibility(true); if (image_decode_cache_) image_decode_cache_->SetShouldAggressivelyFreeResources(false); } DCHECK(resource_pool_); resource_pool_->CheckBusyResources(); resource_pool_->SetResourceUsageLimits( global_tile_state_.soft_memory_limit_in_bytes, global_tile_state_.num_resources_limit); DidModifyTilePriorities(); } ",0 "static int afiucv_hs_callback_rx(struct sock *sk, struct sk_buff *skb) { struct iucv_sock *iucv = iucv_sk(sk); if (!iucv) { kfree_skb(skb); return NET_RX_SUCCESS; } if (sk->sk_state != IUCV_CONNECTED) { kfree_skb(skb); return NET_RX_SUCCESS; } if (sk->sk_shutdown & RCV_SHUTDOWN) { kfree_skb(skb); return NET_RX_SUCCESS; } /* write stuff from iucv_msg to skb cb */ if (skb->len < sizeof(struct af_iucv_trans_hdr)) { kfree_skb(skb); return NET_RX_SUCCESS; } skb_pull(skb, sizeof(struct af_iucv_trans_hdr)); skb_reset_transport_header(skb); skb_reset_network_header(skb); spin_lock(&iucv->message_q.lock); if (skb_queue_empty(&iucv->backlog_skb_q)) { if (sock_queue_rcv_skb(sk, skb)) { /* handle rcv queue full */ skb_queue_tail(&iucv->backlog_skb_q, skb); } } else skb_queue_tail(&iucv_sk(sk)->backlog_skb_q, skb); spin_unlock(&iucv->message_q.lock); return NET_RX_SUCCESS; } ",0 "void InlineTextBox::selectionStartEnd(int& sPos, int& ePos) { int startPos, endPos; if (renderer()->selectionState() == RenderObject::SelectionInside) { startPos = 0; endPos = textRenderer()->textLength(); } else { textRenderer()->selectionStartEnd(startPos, endPos); if (renderer()->selectionState() == RenderObject::SelectionStart) endPos = textRenderer()->textLength(); else if (renderer()->selectionState() == RenderObject::SelectionEnd) startPos = 0; } sPos = max(startPos - m_start, 0); ePos = min(endPos - m_start, (int)m_len); } ",0 "scoped_ptr ResourceDispatcherHostImpl::AddStandardHandlers( net::URLRequest* request, ResourceType resource_type, ResourceContext* resource_context, AppCacheService* appcache_service, int child_id, int route_id, scoped_ptr handler) { if (IsBrowserSideNavigationEnabled() && IsResourceTypeFrame(resource_type) && child_id != -1) { DCHECK(request->url().SchemeIs(url::kBlobScheme)); return handler; } PluginService* plugin_service = nullptr; #if defined(ENABLE_PLUGINS) plugin_service = PluginService::GetInstance(); #endif handler.reset(new MimeTypeResourceHandler(std::move(handler), this, plugin_service, request)); ScopedVector throttles; if (!IsBrowserSideNavigationEnabled() && IsResourceTypeFrame(resource_type)) throttles.push_back(new NavigationResourceThrottle(request)); if (delegate_) { delegate_->RequestBeginning(request, resource_context, appcache_service, resource_type, &throttles); } if (request->has_upload()) { throttles.push_back( new PowerSaveBlockResourceThrottle(request->url().host())); } ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); throttles.push_back(scheduler_->ScheduleRequest(child_id, route_id, info->IsAsync(), request)); handler.reset(new ThrottlingResourceHandler(std::move(handler), request, std::move(throttles))); return handler; } ",0 "void btif_hl_free_buf(void **p) { if (*p != NULL) { BTIF_TRACE_DEBUG(""%s OK"", __FUNCTION__ ); GKI_freebuf(*p); *p = NULL; } else BTIF_TRACE_ERROR(""%s NULL pointer"",__FUNCTION__ ); } ",0 "oldgnu_add_sparse (struct tar_sparse_file *file, struct sparse *s) { struct sp_array sp; if (s->numbytes[0] == '\0') return add_finish; sp.offset = OFF_FROM_HEADER (s->offset); sp.numbytes = OFF_FROM_HEADER (s->numbytes); if (sp.offset < 0 || sp.numbytes < 0 || INT_ADD_OVERFLOW (sp.offset, sp.numbytes) || file->stat_info->stat.st_size < sp.offset + sp.numbytes || file->stat_info->archive_file_size < 0) return add_fail; sparse_add_map (file->stat_info, &sp); return add_ok; } ",0 "void FrameFetchContext::ParseAndPersistClientHints( const ResourceResponse& response) { ClientHintsPreferences hints_preferences; WebEnabledClientHints enabled_client_hints; TimeDelta persist_duration; FrameClientHintsPreferencesContext hints_context(GetFrame()); hints_preferences.UpdatePersistentHintsFromHeaders( response, &hints_context, enabled_client_hints, &persist_duration); if (persist_duration.InSeconds() <= 0) return; GetContentSettingsClient()->PersistClientHints( enabled_client_hints, persist_duration, response.Url()); } ",0 "void InspectorPageAgent::Will(const probe::RecalculateStyle&) {} ",0 "int dns_packet_append_uint16(DnsPacket *p, uint16_t v, size_t *start) { void *d; int r; assert(p); r = dns_packet_extend(p, sizeof(uint16_t), &d, start); if (r < 0) return r; unaligned_write_be16(d, v); return 0; } ",0 "ofproto_port_clear_cfm(struct ofproto *ofproto, ofp_port_t ofp_port) { struct ofport *ofport = ofproto_get_port(ofproto, ofp_port); if (ofport && ofproto->ofproto_class->set_cfm) { ofproto->ofproto_class->set_cfm(ofport, NULL); } } ",0 "apprentice_unmap(struct magic_map *map) { if (map == NULL) return; if (map->p != NULL) { #ifdef QUICK if (map->len) (void)munmap(map->p, map->len); else #endif free(map->p); } else { uint32_t j; for (j = 0; j < MAGIC_SETS; j++) free(map->magic[j]); } free(map); } ",0 "DefragTimeoutTest(void) { int i; int ret = 0; /* Setup a small numberr of trackers. */ if (ConfSet(""defrag.trackers"", ""16"") != 1) { printf(""ConfSet failed: ""); goto end; } DefragInit(); /* Load in 16 packets. */ for (i = 0; i < 16; i++) { Packet *p = BuildTestPacket(i, 0, 1, 'A' + i, 16); if (p == NULL) goto end; Packet *tp = Defrag(NULL, NULL, p, NULL); SCFree(p); if (tp != NULL) { SCFree(tp); goto end; } } /* Build a new packet but push the timestamp out by our timeout. * This should force our previous fragments to be timed out. */ Packet *p = BuildTestPacket(99, 0, 1, 'A' + i, 16); if (p == NULL) goto end; p->ts.tv_sec += (defrag_context->timeout + 1); Packet *tp = Defrag(NULL, NULL, p, NULL); if (tp != NULL) { SCFree(tp); goto end; } DefragTracker *tracker = DefragLookupTrackerFromHash(p); if (tracker == NULL) goto end; if (tracker->id != 99) goto end; SCFree(p); ret = 1; end: DefragDestroy(); return ret; } ",1 "string16 AudioManagerBase::GetAudioInputDeviceModel() { return string16(); } ",0 "iakerb_gss_inquire_context(OM_uint32 *minor_status, gss_ctx_id_t context_handle, gss_name_t *src_name, gss_name_t *targ_name, OM_uint32 *lifetime_rec, gss_OID *mech_type, OM_uint32 *ctx_flags, int *initiate, int *opened) { OM_uint32 ret; iakerb_ctx_id_t ctx = (iakerb_ctx_id_t)context_handle; if (src_name != NULL) *src_name = GSS_C_NO_NAME; if (targ_name != NULL) *targ_name = GSS_C_NO_NAME; if (lifetime_rec != NULL) *lifetime_rec = 0; if (mech_type != NULL) *mech_type = (gss_OID)gss_mech_iakerb; if (ctx_flags != NULL) *ctx_flags = 0; if (initiate != NULL) *initiate = ctx->initiate; if (opened != NULL) *opened = ctx->established; if (ctx->gssc == GSS_C_NO_CONTEXT) return GSS_S_COMPLETE; ret = krb5_gss_inquire_context(minor_status, ctx->gssc, src_name, targ_name, lifetime_rec, mech_type, ctx_flags, initiate, opened); if (!ctx->established) { /* Report IAKERB as the mech OID until the context is established. */ if (mech_type != NULL) *mech_type = (gss_OID)gss_mech_iakerb; /* We don't support exporting partially-established contexts. */ if (ctx_flags != NULL) *ctx_flags &= ~GSS_C_TRANS_FLAG; } return ret; } ",0 "void SystemKeyEventListener::GrabKey(int32 key, uint32 mask) { uint32 caps_lock_mask = LockMask; Display* display = ui::GetXDisplay(); Window root = DefaultRootWindow(display); XGrabKey(display, key, mask, root, True, GrabModeAsync, GrabModeAsync); XGrabKey(display, key, mask | caps_lock_mask, root, True, GrabModeAsync, GrabModeAsync); XGrabKey(display, key, mask | num_lock_mask_, root, True, GrabModeAsync, GrabModeAsync); XGrabKey(display, key, mask | caps_lock_mask | num_lock_mask_, root, True, GrabModeAsync, GrabModeAsync); } ",0 " explicit MockCanvas(int w, int h) : SkCanvas(w, h) {} ",0 "void WebLocalFrameImpl::Load(const WebURLRequest& request, WebFrameLoadType web_frame_load_type, const WebHistoryItem& item, WebHistoryLoadType web_history_load_type, bool is_client_redirect) { DCHECK(GetFrame()); DCHECK(!request.IsNull()); const ResourceRequest& resource_request = request.ToResourceRequest(); if (resource_request.Url().ProtocolIs(""javascript"") && web_frame_load_type == WebFrameLoadType::kStandard) { LoadJavaScriptURL(resource_request.Url()); return; } if (text_finder_) text_finder_->ClearActiveFindMatch(); FrameLoadRequest frame_request = FrameLoadRequest(nullptr, resource_request); if (is_client_redirect) frame_request.SetClientRedirect(ClientRedirectPolicy::kClientRedirect); HistoryItem* history_item = item; GetFrame()->Loader().Load( frame_request, static_cast(web_frame_load_type), history_item, static_cast(web_history_load_type)); } ",0 " renderbufferStorageMultisampleCHROMIUM( WGC3Denum target, WGC3Dsizei samples, WGC3Denum internalformat, WGC3Dsizei width, WGC3Dsizei height) { gl_->RenderbufferStorageMultisampleEXT( target, samples, internalformat, width, height); } ",0 "void LayoutTestContentBrowserClient::RenderProcessWillLaunch( RenderProcessHost* host) { ShellContentBrowserClient::RenderProcessWillLaunch(host); StoragePartition* partition = BrowserContext::GetDefaultStoragePartition(browser_context()); host->AddFilter(new LayoutTestMessageFilter( host->GetID(), partition->GetDatabaseTracker(), partition->GetQuotaManager(), partition->GetURLRequestContext())); host->Send(new ShellViewMsg_SetWebKitSourceDir(GetWebKitRootDirFilePath())); } ",0 "static void dumpBackForwardListItem(WKBundleBackForwardListItemRef item, unsigned indent, bool isCurrentItem, StringBuilder& stringBuilder) { unsigned column = 0; if (isCurrentItem) { stringBuilder.appendLiteral(""curr->""); column = 6; } for (unsigned i = column; i < indent; i++) stringBuilder.append(' '); WTF::String url = toWTFString(adoptWK(WKURLCopyString(adoptWK(WKBundleBackForwardListItemCopyURL(item)).get()))); if (hasPrefix(url, ""file:"")) { WTF::String directoryName = ""/LayoutTests/""; size_t start = url.find(directoryName); if (start == WTF::notFound) start = 0; else start += directoryName.length(); stringBuilder.appendLiteral(""(file test):""); stringBuilder.append(url.substring(start)); } else stringBuilder.append(url); WTF::String target = toWTFString(adoptWK(WKBundleBackForwardListItemCopyTarget(item))); if (target.length()) { stringBuilder.appendLiteral("" (in frame \""""); stringBuilder.append(target); stringBuilder.appendLiteral(""\"")""); } if (WKBundleBackForwardListItemIsTargetItem(item)) stringBuilder.appendLiteral("" **nav target**""); stringBuilder.append('\n'); if (WKRetainPtr kids = adoptWK(WKBundleBackForwardListItemCopyChildren(item))) { size_t size = WKArrayGetSize(kids.get()); Vector sortedKids(size); for (size_t i = 0; i < size; ++i) sortedKids[i] = static_cast(WKArrayGetItemAtIndex(kids.get(), i)); stable_sort(sortedKids.begin(), sortedKids.end(), compareByTargetName); for (size_t i = 0; i < size; ++i) dumpBackForwardListItem(sortedKids[i], indent + 4, false, stringBuilder); } } ",0 "void __show_regs(struct pt_regs *regs, int all) { unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L, fs, gs, shadowgs; unsigned long d0, d1, d2, d3, d6, d7; unsigned int fsindex, gsindex; unsigned int ds, cs, es; printk(KERN_DEFAULT ""RIP: %04lx:[<%016lx>] "", regs->cs & 0xffff, regs->ip); printk_address(regs->ip); printk(KERN_DEFAULT ""RSP: %04lx:%016lx EFLAGS: %08lx\n"", regs->ss, regs->sp, regs->flags); printk(KERN_DEFAULT ""RAX: %016lx RBX: %016lx RCX: %016lx\n"", regs->ax, regs->bx, regs->cx); printk(KERN_DEFAULT ""RDX: %016lx RSI: %016lx RDI: %016lx\n"", regs->dx, regs->si, regs->di); printk(KERN_DEFAULT ""RBP: %016lx R08: %016lx R09: %016lx\n"", regs->bp, regs->r8, regs->r9); printk(KERN_DEFAULT ""R10: %016lx R11: %016lx R12: %016lx\n"", regs->r10, regs->r11, regs->r12); printk(KERN_DEFAULT ""R13: %016lx R14: %016lx R15: %016lx\n"", regs->r13, regs->r14, regs->r15); asm(""movl %%ds,%0"" : ""=r"" (ds)); asm(""movl %%cs,%0"" : ""=r"" (cs)); asm(""movl %%es,%0"" : ""=r"" (es)); asm(""movl %%fs,%0"" : ""=r"" (fsindex)); asm(""movl %%gs,%0"" : ""=r"" (gsindex)); rdmsrl(MSR_FS_BASE, fs); rdmsrl(MSR_GS_BASE, gs); rdmsrl(MSR_KERNEL_GS_BASE, shadowgs); if (!all) return; cr0 = read_cr0(); cr2 = read_cr2(); cr3 = read_cr3(); cr4 = read_cr4(); printk(KERN_DEFAULT ""FS: %016lx(%04x) GS:%016lx(%04x) knlGS:%016lx\n"", fs, fsindex, gs, gsindex, shadowgs); printk(KERN_DEFAULT ""CS: %04x DS: %04x ES: %04x CR0: %016lx\n"", cs, ds, es, cr0); printk(KERN_DEFAULT ""CR2: %016lx CR3: %016lx CR4: %016lx\n"", cr2, cr3, cr4); get_debugreg(d0, 0); get_debugreg(d1, 1); get_debugreg(d2, 2); get_debugreg(d3, 3); get_debugreg(d6, 6); get_debugreg(d7, 7); /* Only print out debug registers if they are in their non-default state. */ if ((d0 == 0) && (d1 == 0) && (d2 == 0) && (d3 == 0) && (d6 == DR6_RESERVED) && (d7 == 0x400)) return; printk(KERN_DEFAULT ""DR0: %016lx DR1: %016lx DR2: %016lx\n"", d0, d1, d2); printk(KERN_DEFAULT ""DR3: %016lx DR6: %016lx DR7: %016lx\n"", d3, d6, d7); } ",0 "static inline void trace_insert_eval_map_file(struct module *mod, struct trace_eval_map **start, int len) { } ",0 "bool UsbPermissionCheckingFunction::HasDevicePermission( scoped_refptr device) { if (!device_permissions_manager_) { device_permissions_manager_ = DevicePermissionsManager::Get(browser_context()); } DevicePermissions* device_permissions = device_permissions_manager_->GetForExtension(extension_id()); DCHECK(device_permissions); permission_entry_ = device_permissions->FindUsbDeviceEntry(device); if (permission_entry_.get()) { return true; } UsbDevicePermission::CheckParam param( device->vendor_id(), device->product_id(), UsbDevicePermissionData::UNSPECIFIED_INTERFACE); if (extension()->permissions_data()->CheckAPIPermissionWithParam( APIPermission::kUsbDevice, ¶m)) { return true; } return false; } ",0 "static void entry_invoke_command(struct thread_smc_args *smc_args, struct optee_msg_arg *arg, uint32_t num_params) { TEE_Result res; TEE_ErrorOrigin err_orig = TEE_ORIGIN_TEE; struct tee_ta_session *s; struct tee_ta_param param = { 0 }; uint64_t saved_attr[TEE_NUM_PARAMS] = { 0 }; bm_timestamp(); res = copy_in_params(arg->params, num_params, ¶m, saved_attr); if (res != TEE_SUCCESS) goto out; s = tee_ta_get_session(arg->session, true, &tee_open_sessions); if (!s) { res = TEE_ERROR_BAD_PARAMETERS; goto out; } res = tee_ta_invoke_command(&err_orig, s, NSAPP_IDENTITY, TEE_TIMEOUT_INFINITE, arg->func, ¶m); bm_timestamp(); tee_ta_put_session(s); copy_out_param(¶m, num_params, arg->params, saved_attr); out: cleanup_shm_refs(saved_attr, ¶m, num_params); arg->ret = res; arg->ret_origin = err_orig; smc_args->a0 = OPTEE_SMC_RETURN_OK; } ",0 "void AbortRequestBeforeItStarts( IPC::Sender* sender, int request_id, network::mojom::URLLoaderClientPtr url_loader_client) { network::URLLoaderCompletionStatus status; status.error_code = net::ERR_ABORTED; status.exists_in_cache = false; status.completion_time = base::TimeTicks(); status.encoded_data_length = 0; status.encoded_body_length = 0; url_loader_client->OnComplete(status); } ",0 " bool IsNull(v8::Local value, const std::string& key) { v8::Local child = value->Get(v8::String::NewFromUtf8(isolate_, key.c_str())); if (child.IsEmpty()) { ADD_FAILURE(); return false; } return child->IsNull(); } ",0 " virtual void onContextLost() { MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&GpuProcessTransportFactory::OnLostSharedContext, callback_factory_.GetWeakPtr())); } ",0 "ScopedResolvedFramebufferBinder::ScopedResolvedFramebufferBinder( GLES2DecoderImpl* decoder, bool enforce_internal_framebuffer, bool internal) : decoder_(decoder) { resolve_and_bind_ = ( decoder_->offscreen_target_frame_buffer_.get() && decoder_->IsOffscreenBufferMultisampled() && (!decoder_->framebuffer_state_.bound_read_framebuffer.get() || enforce_internal_framebuffer)); if (!resolve_and_bind_) return; auto* api = decoder_->api(); ScopedGLErrorSuppressor suppressor(""ScopedResolvedFramebufferBinder::ctor"", decoder_->error_state_.get()); bool alpha_channel_needs_clear = decoder_->should_use_native_gmb_for_backbuffer_ && !decoder_->offscreen_buffer_should_have_alpha_ && decoder_->ChromiumImageNeedsRGBEmulation() && decoder_->workarounds() .disable_multisampling_color_mask_usage; if (alpha_channel_needs_clear) { api->glBindFramebufferEXTFn(GL_DRAW_FRAMEBUFFER_EXT, decoder_->offscreen_target_frame_buffer_->id()); decoder_->state_.SetDeviceColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE); decoder->state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); decoder->ClearDeviceWindowRectangles(); api->glClearColorFn(0, 0, 0, 1); api->glClearFn(GL_COLOR_BUFFER_BIT); decoder_->RestoreClearState(); } api->glBindFramebufferEXTFn(GL_READ_FRAMEBUFFER_EXT, decoder_->offscreen_target_frame_buffer_->id()); GLuint targetid; if (internal) { if (!decoder_->offscreen_resolved_frame_buffer_.get()) { decoder_->offscreen_resolved_frame_buffer_.reset( new BackFramebuffer(decoder_)); decoder_->offscreen_resolved_frame_buffer_->Create(); decoder_->offscreen_resolved_color_texture_.reset( new BackTexture(decoder)); decoder_->offscreen_resolved_color_texture_->Create(); DCHECK(decoder_->offscreen_saved_color_format_); decoder_->offscreen_resolved_color_texture_->AllocateStorage( decoder_->offscreen_size_, decoder_->offscreen_saved_color_format_, false); decoder_->offscreen_resolved_frame_buffer_->AttachRenderTexture( decoder_->offscreen_resolved_color_texture_.get()); if (decoder_->offscreen_resolved_frame_buffer_->CheckStatus() != GL_FRAMEBUFFER_COMPLETE) { LOG(ERROR) << ""ScopedResolvedFramebufferBinder failed "" << ""because offscreen resolved FBO was incomplete.""; return; } } targetid = decoder_->offscreen_resolved_frame_buffer_->id(); } else { targetid = decoder_->offscreen_saved_frame_buffer_->id(); } api->glBindFramebufferEXTFn(GL_DRAW_FRAMEBUFFER_EXT, targetid); const int width = decoder_->offscreen_size_.width(); const int height = decoder_->offscreen_size_.height(); decoder->state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); decoder->ClearDeviceWindowRectangles(); decoder->api()->glBlitFramebufferFn(0, 0, width, height, 0, 0, width, height, GL_COLOR_BUFFER_BIT, GL_NEAREST); api->glBindFramebufferEXTFn(GL_FRAMEBUFFER, targetid); } ",0 "bool TaskQueue::UpdateWorkQueue(LazyNow* lazy_now, bool should_trigger_wakeup, const base::PendingTask* previous_task) { if (!work_queue_.empty()) return true; { base::AutoLock lock(lock_); if (!ShouldAutoPumpQueueLocked(should_trigger_wakeup, previous_task)) return false; MoveReadyDelayedTasksToIncomingQueueLocked(lazy_now); work_queue_.Swap(&incoming_queue_); TraceQueueSize(true); return true; } } ",0 "XML_DefaultCurrent(XML_Parser parser) { if (parser == NULL) return; if (parser->m_defaultHandler) { if (parser->m_openInternalEntities) reportDefault(parser, parser->m_internalEncoding, parser->m_openInternalEntities->internalEventPtr, parser->m_openInternalEntities->internalEventEndPtr); else reportDefault(parser, parser->m_encoding, parser->m_eventPtr, parser->m_eventEndPtr); } } ",0 "extractContigSamples16bits (uint8 *in, uint8 *out, uint32 cols, tsample_t sample, uint16 spp, uint16 bps, tsample_t count, uint32 start, uint32 end) { int ready_bits = 0, sindex = 0; uint32 col, src_byte, src_bit, bit_offset; uint16 maskbits = 0, matchbits = 0; uint16 buff1 = 0, buff2 = 0; uint8 bytebuff = 0; uint8 *src = in; uint8 *dst = out; if ((src == NULL) || (dst == NULL)) { TIFFError(""extractContigSamples16bits"",""Invalid input or output buffer""); return (1); } if ((start > end) || (start > cols)) { TIFFError (""extractContigSamples16bits"", ""Invalid start column value %d ignored"", start); start = 0; } if ((end == 0) || (end > cols)) { TIFFError (""extractContigSamples16bits"", ""Invalid end column value %d ignored"", end); end = cols; } ready_bits = 0; maskbits = (uint16)-1 >> (16 - bps); for (col = start; col < end; col++) { /* Compute src byte(s) and bits within byte(s) */ bit_offset = col * bps * spp; for (sindex = sample; (sindex < spp) && (sindex < (sample + count)); sindex++) { if (sindex == 0) { src_byte = bit_offset / 8; src_bit = bit_offset % 8; } else { src_byte = (bit_offset + (sindex * bps)) / 8; src_bit = (bit_offset + (sindex * bps)) % 8; } src = in + src_byte; matchbits = maskbits << (16 - src_bit - bps); if (little_endian) buff1 = (src[0] << 8) | src[1]; else buff1 = (src[1] << 8) | src[0]; buff1 = (buff1 & matchbits) << (src_bit); if (ready_bits < 8) /* add another bps bits to the buffer */ { bytebuff = 0; buff2 = (buff2 | (buff1 >> ready_bits)); } else /* If we have a full buffer's worth, write it out */ { bytebuff = (buff2 >> 8); *dst++ = bytebuff; ready_bits -= 8; /* shift in new bits */ buff2 = ((buff2 << 8) | (buff1 >> ready_bits)); } ready_bits += bps; } } /* catch any trailing bits at the end of the line */ while (ready_bits > 0) { bytebuff = (buff2 >> 8); *dst++ = bytebuff; ready_bits -= 8; } return (0); } /* end extractContigSamples16bits */ ",0 "const SVGDocumentExtensions* Document::SvgExtensions() { return svg_extensions_.Get(); } ",0 "bool LocalFrameClientImpl::InShadowTree() const { return web_frame_->InShadowTree(); } ",0 "bgp_print(netdissect_options *ndo, const u_char *dat, int length) { const u_char *p; const u_char *ep; const u_char *start; const u_char marker[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, }; struct bgp bgp; uint16_t hlen; ep = dat + length; if (ndo->ndo_snapend < dat + length) ep = ndo->ndo_snapend; ND_PRINT((ndo, "": BGP"")); if (ndo->ndo_vflag < 1) /* lets be less chatty */ return; p = dat; start = p; while (p < ep) { if (!ND_TTEST2(p[0], 1)) break; if (p[0] != 0xff) { p++; continue; } if (!ND_TTEST2(p[0], sizeof(marker))) break; if (memcmp(p, marker, sizeof(marker)) != 0) { p++; continue; } /* found BGP header */ ND_TCHECK2(p[0], BGP_SIZE); /*XXX*/ memcpy(&bgp, p, BGP_SIZE); if (start != p) ND_PRINT((ndo, "" %s"", tstr)); hlen = ntohs(bgp.bgp_len); if (hlen < BGP_SIZE) { ND_PRINT((ndo, ""\n[|BGP Bogus header length %u < %u]"", hlen, BGP_SIZE)); break; } if (ND_TTEST2(p[0], hlen)) { if (!bgp_header_print(ndo, p, hlen)) return; p += hlen; start = p; } else { ND_PRINT((ndo, ""\n[|BGP %s]"", tok2str(bgp_msg_values, ""Unknown Message Type"", bgp.bgp_type))); break; } } return; trunc: ND_PRINT((ndo, ""%s"", tstr)); } ",0 "static void setHorizontalAdjustment(WebKitWebView* webView, GtkAdjustment* adjustment) { Page* page = core(webView); if (page) static_cast(page->chrome()->client())->adjustmentWatcher()->setHorizontalAdjustment(adjustment); } ",0 "void WebFrameLoaderClient::didChangeTitle(DocumentLoader*) { } ",0 "void SocketStreamDispatcherHost::OnSSLCertificateError( net::SocketStream* socket, const net::SSLInfo& ssl_info, bool fatal) { int socket_id = SocketStreamHost::SocketIdFromSocketStream(socket); DVLOG(1) << ""SocketStreamDispatcherHost::OnSSLCertificateError socket_id="" << socket_id; if (socket_id == content::kNoSocketId) { LOG(ERROR) << ""NoSocketId in OnSSLCertificateError""; return; } SocketStreamHost* socket_stream_host = hosts_.Lookup(socket_id); DCHECK(socket_stream_host); content::GlobalRequestID request_id(-1, socket_id); SSLManager::OnSSLCertificateError(ssl_delegate_weak_factory_.GetWeakPtr(), request_id, ResourceType::SUB_RESOURCE, socket->url(), render_process_id_, socket_stream_host->render_view_id(), ssl_info, fatal); } ",1 "void Gfx::doPatternFill(GBool eoFill) { GfxPattern *pattern; if (!out->needNonText()) { return; } if (!(pattern = state->getFillPattern())) { return; } switch (pattern->getType()) { case 1: doTilingPatternFill((GfxTilingPattern *)pattern, gFalse, eoFill); break; case 2: doShadingPatternFill((GfxShadingPattern *)pattern, gFalse, eoFill); break; default: error(getPos(), ""Unimplemented pattern type (%d) in fill"", pattern->getType()); break; } } ",0 "AsyncPipeOp(async_op_t op, HANDLE pipe, LPVOID buffer, DWORD size, DWORD count, LPHANDLE events) { int i; BOOL success; HANDLE io_event; DWORD res, bytes = 0; OVERLAPPED overlapped; LPHANDLE handles = NULL; io_event = InitOverlapped(&overlapped); if (!io_event) { goto out; } handles = malloc((count + 1) * sizeof(HANDLE)); if (!handles) { goto out; } if (op == write) { success = WriteFile(pipe, buffer, size, NULL, &overlapped); } else { success = ReadFile(pipe, buffer, size, NULL, &overlapped); } if (!success && GetLastError() != ERROR_IO_PENDING && GetLastError() != ERROR_MORE_DATA) { goto out; } handles[0] = io_event; for (i = 0; i < count; i++) { handles[i + 1] = events[i]; } res = WaitForMultipleObjects(count + 1, handles, FALSE, op == peek ? INFINITE : IO_TIMEOUT); if (res != WAIT_OBJECT_0) { CancelIo(pipe); goto out; } if (op == peek) { PeekNamedPipe(pipe, NULL, 0, NULL, &bytes, NULL); } else { GetOverlappedResult(pipe, &overlapped, &bytes, TRUE); } out: CloseHandleEx(&io_event); free(handles); return bytes; } ",0 " MigrationSingleClientTest() : MigrationTest(SINGLE_CLIENT) {} ",0 "int sc_mutex_unlock(const sc_context_t *ctx, void *mutex) { if (ctx == NULL) return SC_ERROR_INVALID_ARGUMENTS; if (ctx->thread_ctx != NULL && ctx->thread_ctx->unlock_mutex != NULL) return ctx->thread_ctx->unlock_mutex(mutex); else return SC_SUCCESS; } ",0 "xfs_vm_invalidatepage( struct page *page, unsigned int offset, unsigned int length) { trace_xfs_invalidatepage(page->mapping->host, page, offset, length); block_invalidatepage(page, offset, length); } ",0 "static RAND_DRBG *rand_drbg_new(int secure, int type, unsigned int flags, RAND_DRBG *parent) { RAND_DRBG *drbg = secure ? OPENSSL_secure_zalloc(sizeof(*drbg)) : OPENSSL_zalloc(sizeof(*drbg)); if (drbg == NULL) { RANDerr(RAND_F_RAND_DRBG_NEW, ERR_R_MALLOC_FAILURE); return NULL; } drbg->secure = secure && CRYPTO_secure_allocated(drbg); drbg->fork_count = rand_fork_count; drbg->parent = parent; if (parent == NULL) { drbg->get_entropy = rand_drbg_get_entropy; drbg->cleanup_entropy = rand_drbg_cleanup_entropy; #ifndef RAND_DRBG_GET_RANDOM_NONCE drbg->get_nonce = rand_drbg_get_nonce; drbg->cleanup_nonce = rand_drbg_cleanup_nonce; #endif drbg->reseed_interval = master_reseed_interval; drbg->reseed_time_interval = master_reseed_time_interval; } else { drbg->get_entropy = rand_drbg_get_entropy; drbg->cleanup_entropy = rand_drbg_cleanup_entropy; /* * Do not provide nonce callbacks, the child DRBGs will * obtain their nonce using random bits from the parent. */ drbg->reseed_interval = slave_reseed_interval; drbg->reseed_time_interval = slave_reseed_time_interval; } if (RAND_DRBG_set(drbg, type, flags) == 0) goto err; if (parent != NULL) { rand_drbg_lock(parent); if (drbg->strength > parent->strength) { /* * We currently don't support the algorithm from NIST SP 800-90C * 10.1.2 to use a weaker DRBG as source */ rand_drbg_unlock(parent); RANDerr(RAND_F_RAND_DRBG_NEW, RAND_R_PARENT_STRENGTH_TOO_WEAK); goto err; } rand_drbg_unlock(parent); } return drbg; err: RAND_DRBG_free(drbg); return NULL; } ",1 "static void __balloon_append(struct page *page) { /* Lowmem is re-populated first, so highmem pages go at list tail. */ if (PageHighMem(page)) { list_add_tail(&page->lru, &ballooned_pages); balloon_stats.balloon_high++; } else { list_add(&page->lru, &ballooned_pages); balloon_stats.balloon_low++; } wake_up(&balloon_wq); } ",0 "std::unique_ptr FrameFetchContext::CreateURLLoader( const ResourceRequest& request, WebTaskRunner* task_runner) { DCHECK(!IsDetached()); if (MasterDocumentLoader()->GetServiceWorkerNetworkProvider()) { WrappedResourceRequest webreq(request); auto loader = MasterDocumentLoader() ->GetServiceWorkerNetworkProvider() ->CreateURLLoader(webreq, task_runner->ToSingleThreadTaskRunner()); if (loader) return loader; } return GetFrame()->CreateURLLoader(request, task_runner); } ",0 "void ProfileChooserView::ShowViewFromMode(profiles::BubbleViewMode mode) { if (SigninViewController::ShouldShowSigninForMode(mode)) { Hide(); browser_->signin_view_controller()->ShowSignin(mode, browser_, access_point_); } else { ShowView(mode, avatar_menu_.get()); } } ",0 "DictionaryValue* GetNetworkInfoDict(const chromeos::Network* network) { DictionaryValue* item = new DictionaryValue; item->SetString(""name"", network->name()); item->SetString(""device_path"", network->device_path()); item->SetString(""ip_address"", network->ip_address()); item->SetString(""status"", network->GetStateString()); return item; } ",0 "static long keyring_read(const struct key *keyring, char __user *buffer, size_t buflen) { struct keyring_read_iterator_context ctx; unsigned long nr_keys; int ret; kenter(""{%d},,%zu"", key_serial(keyring), buflen); if (buflen & (sizeof(key_serial_t) - 1)) return -EINVAL; nr_keys = keyring->keys.nr_leaves_on_tree; if (nr_keys == 0) return 0; /* Calculate how much data we could return */ ctx.qty = nr_keys * sizeof(key_serial_t); if (!buffer || !buflen) return ctx.qty; if (buflen > ctx.qty) ctx.qty = buflen; /* Copy the IDs of the subscribed keys into the buffer */ ctx.buffer = (key_serial_t __user *)buffer; ctx.count = 0; ret = assoc_array_iterate(&keyring->keys, keyring_read_iterator, &ctx); if (ret < 0) { kleave("" = %d [iterate]"", ret); return ret; } kleave("" = %zu [ok]"", ctx.count); return ctx.count; } ",0 "static int ion_sync_for_device(struct ion_client *client, int fd) { struct dma_buf *dmabuf; struct ion_buffer *buffer; dmabuf = dma_buf_get(fd); if (IS_ERR(dmabuf)) return PTR_ERR(dmabuf); /* if this memory came from ion */ if (dmabuf->ops != &dma_buf_ops) { pr_err(""%s: can not sync dmabuf from another exporter\n"", __func__); dma_buf_put(dmabuf); return -EINVAL; } buffer = dmabuf->priv; dma_sync_sg_for_device(NULL, buffer->sg_table->sgl, buffer->sg_table->nents, DMA_BIDIRECTIONAL); dma_buf_put(dmabuf); return 0; } ",0 "bool RenderFrameHostImpl::CanCommitOrigin( const url::Origin& origin, const GURL& url) { if (base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kDisableWebSecurity)) { return true; } if (origin.scheme() == url::kFileScheme) { WebPreferences prefs = render_view_host_->GetWebkitPreferences(); if (prefs.allow_universal_access_from_file_urls) return true; } if (origin.unique()) return true; if (url.IsStandard() && !origin.IsSameOriginWith(url::Origin(url))) return false; GURL origin_url(origin.Serialize()); return CanCommitURL(origin_url); } ",0 "ssize_t intel_event_sysfs_show(char *page, u64 config) { u64 event = (config & ARCH_PERFMON_EVENTSEL_EVENT); return x86_event_sysfs_show(page, config, event); } ",0 "static void dump_tasks(struct mem_cgroup *memcg, const nodemask_t *nodemask) { struct task_struct *p; struct task_struct *task; pr_info(""[ pid ] uid tgid total_vm rss pgtables_bytes swapents oom_score_adj name\n""); rcu_read_lock(); for_each_process(p) { if (oom_unkillable_task(p, memcg, nodemask)) continue; task = find_lock_task_mm(p); if (!task) { /* * This is a kthread or all of p's threads have already * detached their mm's. There's no need to report * them; they can't be oom killed anyway. */ continue; } pr_info(""[%5d] %5d %5d %8lu %8lu %8ld %8lu %5hd %s\n"", task->pid, from_kuid(&init_user_ns, task_uid(task)), task->tgid, task->mm->total_vm, get_mm_rss(task->mm), mm_pgtables_bytes(task->mm), get_mm_counter(task->mm, MM_SWAPENTS), task->signal->oom_score_adj, task->comm); task_unlock(task); } rcu_read_unlock(); } ",0 "InspectorOverlay::~InspectorOverlay() { } ",0 " NullServiceProcessLauncherFactory() {} ",0 "int ssl3_get_req_cert_type(SSL *s, unsigned char *p) { int ret=0; unsigned long alg_k; alg_k = s->s3->tmp.new_cipher->algorithm_mkey; #ifndef OPENSSL_NO_GOST if (s->version >= TLS1_VERSION) { if (alg_k & SSL_kGOST) { p[ret++]=TLS_CT_GOST94_SIGN; p[ret++]=TLS_CT_GOST01_SIGN; return(ret); } } #endif #ifndef OPENSSL_NO_DH if (alg_k & (SSL_kDHr|SSL_kEDH)) { # ifndef OPENSSL_NO_RSA p[ret++]=SSL3_CT_RSA_FIXED_DH; # endif # ifndef OPENSSL_NO_DSA p[ret++]=SSL3_CT_DSS_FIXED_DH; # endif } if ((s->version == SSL3_VERSION) && (alg_k & (SSL_kEDH|SSL_kDHd|SSL_kDHr))) { # ifndef OPENSSL_NO_RSA p[ret++]=SSL3_CT_RSA_EPHEMERAL_DH; # endif # ifndef OPENSSL_NO_DSA p[ret++]=SSL3_CT_DSS_EPHEMERAL_DH; # endif } #endif /* !OPENSSL_NO_DH */ #ifndef OPENSSL_NO_RSA p[ret++]=SSL3_CT_RSA_SIGN; #endif #ifndef OPENSSL_NO_DSA p[ret++]=SSL3_CT_DSS_SIGN; #endif #ifndef OPENSSL_NO_ECDH if ((alg_k & (SSL_kECDHr|SSL_kECDHe)) && (s->version >= TLS1_VERSION)) { p[ret++]=TLS_CT_RSA_FIXED_ECDH; p[ret++]=TLS_CT_ECDSA_FIXED_ECDH; } #endif #ifndef OPENSSL_NO_ECDSA /* ECDSA certs can be used with RSA cipher suites as well * so we don't need to check for SSL_kECDH or SSL_kEECDH */ if (s->version >= TLS1_VERSION) { p[ret++]=TLS_CT_ECDSA_SIGN; } #endif return(ret); } ",0 "static struct net_bridge_mdb_entry *br_mdb_ip6_get( struct net_bridge_mdb_htable *mdb, const struct in6_addr *dst) { struct br_ip br_dst; ipv6_addr_copy(&br_dst.u.ip6, dst); br_dst.proto = htons(ETH_P_IPV6); return br_mdb_ip_get(mdb, &br_dst); } ",0 "static CURLcode parse_connect_to_slist(struct Curl_easy *data, struct connectdata *conn, struct curl_slist *conn_to_host) { CURLcode result = CURLE_OK; char *host = NULL; int port = -1; while(conn_to_host && !host && port == -1) { result = parse_connect_to_string(data, conn, conn_to_host->data, &host, &port); if(result) return result; if(host && *host) { conn->conn_to_host.rawalloc = host; conn->conn_to_host.name = host; conn->bits.conn_to_host = TRUE; infof(data, ""Connecting to hostname: %s\n"", host); } else { /* no ""connect to host"" */ conn->bits.conn_to_host = FALSE; Curl_safefree(host); } if(port >= 0) { conn->conn_to_port = port; conn->bits.conn_to_port = TRUE; infof(data, ""Connecting to port: %d\n"", port); } else { /* no ""connect to port"" */ conn->bits.conn_to_port = FALSE; port = -1; } conn_to_host = conn_to_host->next; } return result; } ",0 "clean_up(int rc) { #if ENABLE_SNMP netsnmp_session *session = crm_snmp_init(NULL, NULL); if (session) { snmp_close(session); snmp_shutdown(""snmpapp""); } #endif #if CURSES_ENABLED if (as_console) { as_console = FALSE; echo(); nocbreak(); endwin(); } #endif if (cib != NULL) { cib->cmds->signoff(cib); cib_delete(cib); cib = NULL; } free(as_html_file); free(xml_file); free(pid_file); if (rc >= 0) { crm_exit(rc); } return; } ",0 "static int emulator_get_dr(struct x86_emulate_ctxt *ctxt, int dr, unsigned long *dest) { return kvm_get_dr(emul_to_vcpu(ctxt), dr, dest); } ",0 "ikev1_sig_print(netdissect_options *ndo, u_char tpay _U_, const struct isakmp_gen *ext, u_int item_len _U_, const u_char *ep _U_, uint32_t phase _U_, uint32_t doi _U_, uint32_t proto _U_, int depth _U_) { struct isakmp_gen e; ND_PRINT((ndo,""%s:"", NPSTR(ISAKMP_NPTYPE_SIG))); ND_TCHECK(*ext); UNALIGNED_MEMCPY(&e, ext, sizeof(e)); ND_PRINT((ndo,"" len=%d"", ntohs(e.len) - 4)); if (2 < ndo->ndo_vflag && 4 < ntohs(e.len)) { ND_PRINT((ndo,"" "")); if (!rawprint(ndo, (const uint8_t *)(ext + 1), ntohs(e.len) - 4)) goto trunc; } return (const u_char *)ext + ntohs(e.len); trunc: ND_PRINT((ndo,"" [|%s]"", NPSTR(ISAKMP_NPTYPE_SIG))); return NULL; } ",0 " bool InitSkBitmapFromData(SkBitmap* bitmap, const char* pixels, size_t pixels_size) const { if (!bitmap->tryAllocPixels( SkImageInfo::Make(width, height, color_type, alpha_type))) return false; if (pixels_size != bitmap->computeByteSize()) return false; memcpy(bitmap->getPixels(), pixels, pixels_size); return true; } ",1 "void RemoteFrame::DidResume() { DCHECK(RuntimeEnabledFeatures::PageLifecycleEnabled()); } ",0 "MagickExport MagickBooleanType FileToImage(Image *image,const char *filename, ExceptionInfo *exception) { int file; MagickBooleanType status; size_t length, quantum; ssize_t count; struct stat file_stats; unsigned char *blob; assert(image != (const Image *) NULL); assert(image->signature == MagickCoreSignature); assert(filename != (const char *) NULL); (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"",filename); status=IsRightsAuthorized(PathPolicyDomain,WritePolicyRights,filename); if (status == MagickFalse) { errno=EPERM; (void) ThrowMagickException(exception,GetMagickModule(),PolicyError, ""NotAuthorized"",""`%s'"",filename); return(MagickFalse); } file=fileno(stdin); if (LocaleCompare(filename,""-"") != 0) file=open_utf8(filename,O_RDONLY | O_BINARY,0); if (file == -1) { ThrowFileException(exception,BlobError,""UnableToOpenBlob"",filename); return(MagickFalse); } quantum=(size_t) MagickMaxBufferExtent; if ((fstat(file,&file_stats) == 0) && (file_stats.st_size > 0)) quantum=(size_t) MagickMin(file_stats.st_size,MagickMaxBufferExtent); blob=(unsigned char *) AcquireQuantumMemory(quantum,sizeof(*blob)); if (blob == (unsigned char *) NULL) { file=close(file); ThrowFileException(exception,ResourceLimitError,""MemoryAllocationFailed"", filename); return(MagickFalse); } for ( ; ; ) { count=read(file,blob,quantum); if (count <= 0) { count=0; if (errno != EINTR) break; } length=(size_t) count; count=WriteBlobStream(image,length,blob); if (count != (ssize_t) length) { ThrowFileException(exception,BlobError,""UnableToWriteBlob"",filename); break; } } file=close(file); if (file == -1) ThrowFileException(exception,BlobError,""UnableToWriteBlob"",filename); blob=(unsigned char *) RelinquishMagickMemory(blob); return(MagickTrue); } ",0 "void WebContentsImpl::ForEachFrame( const base::Callback& on_frame) { for (FrameTreeNode* node : frame_tree_.Nodes()) { on_frame.Run(node->current_frame_host()); } } ",0 "void CairoOutputDev::clip(GfxState *state) { doPath (cairo, state, state->getPath()); cairo_set_fill_rule (cairo, CAIRO_FILL_RULE_WINDING); cairo_clip (cairo); LOG (printf (""clip\n"")); if (cairo_shape) { doPath (cairo_shape, state, state->getPath()); cairo_set_fill_rule (cairo_shape, CAIRO_FILL_RULE_WINDING); cairo_clip (cairo_shape); } } ",0 "static struct pdf_object *pdf_add_object(struct pdf_doc *pdf, int type) { struct pdf_object *obj; obj = calloc(1, sizeof(struct pdf_object)); if (!obj) { pdf_set_err(pdf, -errno, ""Unable to allocate object %d: %s"", flexarray_size(&pdf->objects) + 1, strerror(errno)); return NULL; } obj->type = type; if (pdf_append_object(pdf, obj) < 0) { free(obj); return NULL; } return obj; } ",0 "circle_distance(PG_FUNCTION_ARGS) { CIRCLE *circle1 = PG_GETARG_CIRCLE_P(0); CIRCLE *circle2 = PG_GETARG_CIRCLE_P(1); float8 result; result = point_dt(&circle1->center, &circle2->center) - (circle1->radius + circle2->radius); if (result < 0) result = 0; PG_RETURN_FLOAT8(result); } ",0 "ProcRenderAddGlyphsFromPicture(ClientPtr client) { return BadImplementation; } ",0 "static vpx_codec_err_t ctrl_set_skip_loop_filter(vpx_codec_alg_priv_t *ctx, va_list args) { ctx->skip_loop_filter = va_arg(args, int); if (ctx->frame_workers) { VPxWorker *const worker = ctx->frame_workers; FrameWorkerData *const frame_worker_data = (FrameWorkerData *)worker->data1; frame_worker_data->pbi->common.skip_loop_filter = ctx->skip_loop_filter; } return VPX_CODEC_OK; } ",0 "static void activityLoggedInIsolatedWorldsAttrGetterAttributeGetter(const v8::PropertyCallbackInfo& info) { TestObject* imp = V8TestObject::toNative(info.Holder()); v8SetReturnValueInt(info, imp->activityLoggedInIsolatedWorldsAttrGetter()); } ",0 "int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs) { struct msr_data apic_base_msr; int mmu_reset_needed = 0; int pending_vec, max_bits, idx; struct desc_ptr dt; if (!guest_cpuid_has_xsave(vcpu) && (sregs->cr4 & X86_CR4_OSXSAVE)) return -EINVAL; dt.size = sregs->idt.limit; dt.address = sregs->idt.base; kvm_x86_ops->set_idt(vcpu, &dt); dt.size = sregs->gdt.limit; dt.address = sregs->gdt.base; kvm_x86_ops->set_gdt(vcpu, &dt); vcpu->arch.cr2 = sregs->cr2; mmu_reset_needed |= kvm_read_cr3(vcpu) != sregs->cr3; vcpu->arch.cr3 = sregs->cr3; __set_bit(VCPU_EXREG_CR3, (ulong *)&vcpu->arch.regs_avail); kvm_set_cr8(vcpu, sregs->cr8); mmu_reset_needed |= vcpu->arch.efer != sregs->efer; kvm_x86_ops->set_efer(vcpu, sregs->efer); apic_base_msr.data = sregs->apic_base; apic_base_msr.host_initiated = true; kvm_set_apic_base(vcpu, &apic_base_msr); mmu_reset_needed |= kvm_read_cr0(vcpu) != sregs->cr0; kvm_x86_ops->set_cr0(vcpu, sregs->cr0); vcpu->arch.cr0 = sregs->cr0; mmu_reset_needed |= kvm_read_cr4(vcpu) != sregs->cr4; kvm_x86_ops->set_cr4(vcpu, sregs->cr4); if (sregs->cr4 & X86_CR4_OSXSAVE) kvm_update_cpuid(vcpu); idx = srcu_read_lock(&vcpu->kvm->srcu); if (!is_long_mode(vcpu) && is_pae(vcpu)) { load_pdptrs(vcpu, vcpu->arch.walk_mmu, kvm_read_cr3(vcpu)); mmu_reset_needed = 1; } srcu_read_unlock(&vcpu->kvm->srcu, idx); if (mmu_reset_needed) kvm_mmu_reset_context(vcpu); max_bits = KVM_NR_INTERRUPTS; pending_vec = find_first_bit( (const unsigned long *)sregs->interrupt_bitmap, max_bits); if (pending_vec < max_bits) { kvm_queue_interrupt(vcpu, pending_vec, false); pr_debug(""Set back pending irq %d\n"", pending_vec); } kvm_set_segment(vcpu, &sregs->cs, VCPU_SREG_CS); kvm_set_segment(vcpu, &sregs->ds, VCPU_SREG_DS); kvm_set_segment(vcpu, &sregs->es, VCPU_SREG_ES); kvm_set_segment(vcpu, &sregs->fs, VCPU_SREG_FS); kvm_set_segment(vcpu, &sregs->gs, VCPU_SREG_GS); kvm_set_segment(vcpu, &sregs->ss, VCPU_SREG_SS); kvm_set_segment(vcpu, &sregs->tr, VCPU_SREG_TR); kvm_set_segment(vcpu, &sregs->ldt, VCPU_SREG_LDTR); update_cr8_intercept(vcpu); /* Older userspace won't unhalt the vcpu on reset. */ if (kvm_vcpu_is_bsp(vcpu) && kvm_rip_read(vcpu) == 0xfff0 && sregs->cs.selector == 0xf000 && sregs->cs.base == 0xffff0000 && !is_protmode(vcpu)) vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE; kvm_make_request(KVM_REQ_EVENT, vcpu); return 0; } ",0 "void GaiaCookieManagerService::OnMergeSessionFailure( const GoogleServiceAuthError& error) { DCHECK(requests_.front().request_type() == GaiaCookieRequestType::ADD_ACCOUNT); VLOG(1) << ""Failed MergeSession"" << "" account="" << requests_.front().account_id() << "" error="" << error.ToString(); if (++fetcher_retries_ < kMaxFetcherRetries && error.IsTransientError()) { fetcher_backoff_.InformOfRequest(false); UMA_HISTOGRAM_ENUMERATION(""OAuth2Login.MergeSessionRetry"", error.state(), GoogleServiceAuthError::NUM_STATES); fetcher_timer_.Start( FROM_HERE, fetcher_backoff_.GetTimeUntilRelease(), base::Bind(&SigninClient::DelayNetworkCall, base::Unretained(signin_client_), base::Bind( &GaiaCookieManagerService::StartFetchingMergeSession, base::Unretained(this)))); return; } uber_token_ = std::string(); const std::string account_id = requests_.front().account_id(); UMA_HISTOGRAM_ENUMERATION(""OAuth2Login.MergeSessionFailure"", error.state(), GoogleServiceAuthError::NUM_STATES); HandleNextRequest(); SignalComplete(account_id, error); } ",0 "void Browser::UpdateCommandsForContentRestrictionState() { int restrictions = GetContentRestrictionsForSelectedTab(); command_updater_.UpdateCommandEnabled( IDC_COPY, !(restrictions & CONTENT_RESTRICTION_COPY)); command_updater_.UpdateCommandEnabled( IDC_CUT, !(restrictions & CONTENT_RESTRICTION_CUT)); command_updater_.UpdateCommandEnabled( IDC_PASTE, !(restrictions & CONTENT_RESTRICTION_PASTE)); UpdateSaveAsState(restrictions); UpdatePrintingState(restrictions); } ",0 "InterstitialPage* InterstitialPage::FromRenderFrameHost(RenderFrameHost* rfh) { if (!rfh) return nullptr; return static_cast(rfh) ->delegate() ->GetAsInterstitialPage(); } ",0 "static void gen_inc(DisasContext *s1, TCGMemOp ot, int d, int c) { if (s1->prefix & PREFIX_LOCK) { tcg_gen_movi_tl(cpu_T0, c > 0 ? 1 : -1); tcg_gen_atomic_add_fetch_tl(cpu_T0, cpu_A0, cpu_T0, s1->mem_index, ot | MO_LE); } else { if (d != OR_TMP0) { gen_op_mov_v_reg(ot, cpu_T0, d); } else { gen_op_ld_v(s1, ot, cpu_T0, cpu_A0); } tcg_gen_addi_tl(cpu_T0, cpu_T0, (c > 0 ? 1 : -1)); gen_op_st_rm_T0_A0(s1, ot, d); } gen_compute_eflags_c(s1, cpu_cc_src); tcg_gen_mov_tl(cpu_cc_dst, cpu_T0); set_cc_op(s1, (c > 0 ? CC_OP_INCB : CC_OP_DECB) + ot); } ",0 "CatalogueAddFPE (CataloguePtr cat, FontPathElementPtr fpe) { FontPathElementPtr *new; if (cat->fpeCount >= cat->fpeAlloc) { if (cat->fpeAlloc == 0) cat->fpeAlloc = 16; else cat->fpeAlloc *= 2; new = xrealloc(cat->fpeList, cat->fpeAlloc * sizeof(FontPathElementPtr)); if (new == NULL) return AllocError; cat->fpeList = new; } cat->fpeList[cat->fpeCount++] = fpe; return Successful; } ",0 "void RenderViewHostImpl::OnRequestMove(const gfx::Rect& pos) { if (!is_swapped_out_) delegate_->RequestMove(pos); Send(new ViewMsg_Move_ACK(GetRoutingID())); } ",0 "dissect_PRINTER_INFO_0(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { offset = dissect_spoolss_relstr( tvb, offset, pinfo, tree, di, drep, hf_printername, 0, NULL); offset = dissect_spoolss_relstr( tvb, offset, pinfo, tree, di, drep, hf_servername, 0, NULL); offset = dissect_ndr_uint32( tvb, offset, pinfo, tree, di, drep, hf_printer_cjobs, NULL); offset = dissect_ndr_uint32( tvb, offset, pinfo, tree, di, drep, hf_printer_total_jobs, NULL); offset = dissect_ndr_uint32( tvb, offset, pinfo, tree, di, drep, hf_printer_total_bytes, NULL); offset = dissect_SYSTEM_TIME( tvb, offset, pinfo, tree, di, drep, ""Unknown time"", TRUE, NULL); offset = dissect_ndr_uint32( tvb, offset, pinfo, tree, di, drep, hf_printer_global_counter, NULL); offset = dissect_ndr_uint32( tvb, offset, pinfo, tree, di, drep, hf_printer_total_pages, NULL); offset = dissect_ndr_uint16( tvb, offset, pinfo, tree, di, drep, hf_printer_major_version, NULL); offset = dissect_ndr_uint16( tvb, offset, pinfo, tree, di, drep, hf_printer_build_version, NULL); offset = dissect_ndr_uint32( tvb, offset, pinfo, tree, di, drep, hf_printer_unk7, NULL); offset = dissect_ndr_uint32( tvb, offset, pinfo, tree, di, drep, hf_printer_unk8, NULL); offset = dissect_ndr_uint32( tvb, offset, pinfo, tree, di, drep, hf_printer_unk9, NULL); offset = dissect_ndr_uint32( tvb, offset, pinfo, tree, di, drep, hf_printer_session_ctr, NULL); offset = dissect_ndr_uint32( tvb, offset, pinfo, tree, di, drep, hf_printer_unk11, NULL); offset = dissect_ndr_uint32( tvb, offset, pinfo, tree, di, drep, hf_printer_printer_errors, NULL); offset = dissect_ndr_uint32( tvb, offset, pinfo, tree, di, drep, hf_printer_unk13, NULL); offset = dissect_ndr_uint32( tvb, offset, pinfo, tree, di, drep, hf_printer_unk14, NULL); offset = dissect_ndr_uint32( tvb, offset, pinfo, tree, di, drep, hf_printer_unk15, NULL); offset = dissect_ndr_uint32( tvb, offset, pinfo, tree, di, drep, hf_printer_unk16, NULL); offset = dissect_ndr_uint32( tvb, offset, pinfo, tree, di, drep, hf_printer_changeid, NULL); offset = dissect_ndr_uint32( tvb, offset, pinfo, tree, di, drep, hf_printer_unk18, NULL); offset = dissect_ndr_uint32( tvb, offset, pinfo, tree, di, drep, hf_printer_status, NULL); offset = dissect_ndr_uint32( tvb, offset, pinfo, tree, di, drep, hf_printer_unk20, NULL); offset = dissect_ndr_uint32( tvb, offset, pinfo, tree, di, drep, hf_printer_c_setprinter, NULL); offset = dissect_ndr_uint16( tvb, offset, pinfo, tree, di, drep, hf_printer_unk22, NULL); offset = dissect_ndr_uint16( tvb, offset, pinfo, tree, di, drep, hf_printer_unk23, NULL); offset = dissect_ndr_uint16( tvb, offset, pinfo, tree, di, drep, hf_printer_unk24, NULL); offset = dissect_ndr_uint16( tvb, offset, pinfo, tree, di, drep, hf_printer_unk25, NULL); offset = dissect_ndr_uint16( tvb, offset, pinfo, tree, di, drep, hf_printer_unk26, NULL); offset = dissect_ndr_uint16( tvb, offset, pinfo, tree, di, drep, hf_printer_unk27, NULL); offset = dissect_ndr_uint16( tvb, offset, pinfo, tree, di, drep, hf_printer_unk28, NULL); offset = dissect_ndr_uint16( tvb, offset, pinfo, tree, di, drep, hf_printer_unk29, NULL); return offset; } ",0 "static void file_globals_dtor(php_file_globals *file_globals_p TSRMLS_DC) { } ",0 "static int cqspi_remove(struct platform_device *pdev) { struct cqspi_st *cqspi = platform_get_drvdata(pdev); int i; for (i = 0; i < CQSPI_MAX_CHIPSELECT; i++) if (cqspi->f_pdata[i].registered) mtd_device_unregister(&cqspi->f_pdata[i].nor.mtd); cqspi_controller_enable(cqspi, 0); clk_disable_unprepare(cqspi->clk); return 0; } ",0 "static struct kern_ipc_perm *ipc_findkey(struct ipc_ids *ids, key_t key) { struct kern_ipc_perm *ipc; int next_id; int total; for (total = 0, next_id = 0; total < ids->in_use; next_id++) { ipc = idr_find(&ids->ipcs_idr, next_id); if (ipc == NULL) continue; if (ipc->key != key) { total++; continue; } ipc_lock_by_ptr(ipc); return ipc; } return NULL; } ",0 "static bool IsNameOfInlineEventHandler(const Vector& name) { const size_t kLengthOfShortestInlineEventHandlerName = 5; // To wit: oncut. if (name.size() < kLengthOfShortestInlineEventHandlerName) return false; return name[0] == 'o' && name[1] == 'n'; } ",0 "int usb_hub_release_port(struct usb_device *hdev, unsigned port1, struct usb_dev_state *owner) { int rc; struct usb_dev_state **powner; rc = find_port_owner(hdev, port1, &powner); if (rc) return rc; if (*powner != owner) return -ENOENT; *powner = NULL; return rc; } ",0 "static int hardware_enable(void) { int cpu = raw_smp_processor_id(); u64 phys_addr = __pa(per_cpu(vmxarea, cpu)); u64 old, test_bits; if (cr4_read_shadow() & X86_CR4_VMXE) return -EBUSY; INIT_LIST_HEAD(&per_cpu(loaded_vmcss_on_cpu, cpu)); INIT_LIST_HEAD(&per_cpu(blocked_vcpu_on_cpu, cpu)); spin_lock_init(&per_cpu(blocked_vcpu_on_cpu_lock, cpu)); /* * Now we can enable the vmclear operation in kdump * since the loaded_vmcss_on_cpu list on this cpu * has been initialized. * * Though the cpu is not in VMX operation now, there * is no problem to enable the vmclear operation * for the loaded_vmcss_on_cpu list is empty! */ crash_enable_local_vmclear(cpu); rdmsrl(MSR_IA32_FEATURE_CONTROL, old); test_bits = FEATURE_CONTROL_LOCKED; test_bits |= FEATURE_CONTROL_VMXON_ENABLED_OUTSIDE_SMX; if (tboot_enabled()) test_bits |= FEATURE_CONTROL_VMXON_ENABLED_INSIDE_SMX; if ((old & test_bits) != test_bits) { /* enable and lock */ wrmsrl(MSR_IA32_FEATURE_CONTROL, old | test_bits); } kvm_cpu_vmxon(phys_addr); ept_sync_global(); return 0; } ",0 "MYSQLND_METHOD(mysqlnd_conn_data, query)(MYSQLND_CONN_DATA * conn, const char * query, unsigned int query_len TSRMLS_DC) { size_t this_func = STRUCT_OFFSET(struct st_mysqlnd_conn_data_methods, query); enum_func_status ret = FAIL; DBG_ENTER(""mysqlnd_conn_data::query""); DBG_INF_FMT(""conn=%llu query=%s"", conn->thread_id, query); if (PASS == conn->m->local_tx_start(conn, this_func TSRMLS_CC)) { if (PASS == conn->m->send_query(conn, query, query_len TSRMLS_CC) && PASS == conn->m->reap_query(conn TSRMLS_CC)) { ret = PASS; if (conn->last_query_type == QUERY_UPSERT && conn->upsert_status->affected_rows) { MYSQLND_INC_CONN_STATISTIC_W_VALUE(conn->stats, STAT_ROWS_AFFECTED_NORMAL, conn->upsert_status->affected_rows); } } conn->m->local_tx_end(conn, this_func, ret TSRMLS_CC); } DBG_RETURN(ret); } ",0 "pfetch (lin line) { return p_line[line]; } ",0 "tlv_get(const unsigned char *msg, int len, unsigned char tag, unsigned char *ret, int *ret_len) { int cur = 0; while (cur < len) { if (*(msg+cur)==tag) { int ii, ln = *(msg+cur+1); if (ln > *ret_len) return SC_ERROR_WRONG_LENGTH; for (ii=0; iiMappingSuceeded()) { DoWithTXLock([NBLHolder, this](){ m_SendList.PushBack(NBLHolder); }); DoPendingTasks(false); } else { NBLHolder->SetStatus(NDIS_STATUS_FAILURE); NBLHolder->Release(); } } ",0 "RenderView::~RenderView() { history_page_ids_.clear(); if (decrement_shared_popup_at_destruction_) shared_popup_counter_->data--; while (!file_chooser_completions_.empty()) { if (file_chooser_completions_.front()->completion) { file_chooser_completions_.front()->completion->didChooseFile( WebVector()); } file_chooser_completions_.pop_front(); } #if defined(OS_MACOSX) while (!fake_plugin_window_handles_.empty()) { DCHECK(*fake_plugin_window_handles_.begin()); DestroyFakePluginWindowHandle(*fake_plugin_window_handles_.begin()); } #endif #ifndef NDEBUG ViewMap* views = g_view_map.Pointer(); for (ViewMap::iterator it = views->begin(); it != views->end(); ++it) DCHECK_NE(this, it->second) << ""Failed to call Close?""; #endif FOR_EACH_OBSERVER(RenderViewObserver, observers_, set_render_view(NULL)); FOR_EACH_OBSERVER(RenderViewObserver, observers_, OnDestruct()); } ",0 "cJSON *cJSON_Duplicate(cJSON *item,int recurse) { cJSON *newitem,*cptr,*nptr=0,*newchild; /* Bail on bad ptr */ if (!item) return 0; /* Create new item */ newitem=cJSON_New_Item(); if (!newitem) return 0; /* Copy over all vars */ newitem->type=item->type&(~cJSON_IsReference),newitem->valueint=item->valueint,newitem->valuedouble=item->valuedouble; if (item->valuestring) {newitem->valuestring=cJSON_strdup(item->valuestring); if (!newitem->valuestring) {cJSON_Delete(newitem);return 0;}} if (item->string) {newitem->string=cJSON_strdup(item->string); if (!newitem->string) {cJSON_Delete(newitem);return 0;}} /* If non-recursive, then we're done! */ if (!recurse) return newitem; /* Walk the ->next chain for the child. */ cptr=item->child; while (cptr) { newchild=cJSON_Duplicate(cptr,1); /* Duplicate (with recurse) each item in the ->next chain */ if (!newchild) {cJSON_Delete(newitem);return 0;} if (nptr) {nptr->next=newchild,newchild->prev=nptr;nptr=newchild;} /* If newitem->child already set, then crosswire ->prev and ->next and move on */ else {newitem->child=newchild;nptr=newchild;} /* Set newitem->child and move to it */ cptr=cptr->next; } return newitem; } ",0 "init_ipxsaparray(netdissect_options *ndo) { register int i; register struct hnamemem *table; for (i = 0; ipxsap_db[i].s != NULL; i++) { int j = htons(ipxsap_db[i].v) & (HASHNAMESIZE-1); table = &ipxsaptable[j]; while (table->name) table = table->nxt; table->name = ipxsap_db[i].s; table->addr = htons(ipxsap_db[i].v); table->nxt = newhnamemem(ndo); } } ",0 "void RenderWidgetHostImpl::OnShowDisambiguationPopup( const gfx::Rect& rect_pixels, const gfx::Size& size, const cc::SharedBitmapId& id) { DCHECK(!rect_pixels.IsEmpty()); DCHECK(!size.IsEmpty()); scoped_ptr bitmap = HostSharedBitmapManager::current()->GetSharedBitmapFromId(size, id); if (!bitmap) { bad_message::ReceivedBadMessage(GetProcess(), bad_message::RWH_SHARED_BITMAP); return; } DCHECK(bitmap->pixels()); SkImageInfo info = SkImageInfo::MakeN32Premul(size.width(), size.height()); SkBitmap zoomed_bitmap; zoomed_bitmap.installPixels(info, bitmap->pixels(), info.minRowBytes()); if (view_) view_->ShowDisambiguationPopup(rect_pixels, zoomed_bitmap); zoomed_bitmap.setPixels(0); Send(new ViewMsg_ReleaseDisambiguationPopupBitmap(GetRoutingID(), id)); } ",0 "static inline size_t xfrm_polexpire_msgsize(struct xfrm_policy *xp) { return NLMSG_ALIGN(sizeof(struct xfrm_user_polexpire)) + nla_total_size(sizeof(struct xfrm_user_tmpl) * xp->xfrm_nr) + nla_total_size(xfrm_user_sec_ctx_size(xp->security)) + nla_total_size(sizeof(struct xfrm_mark)) + userpolicy_type_attrsize(); } ",0 "bool kvm_arch_intc_initialized(struct kvm *kvm) { #ifdef CONFIG_KVM_MPIC if (kvm->arch.mpic) return true; #endif #ifdef CONFIG_KVM_XICS if (kvm->arch.xics || kvm->arch.xive) return true; #endif return false; } ",0 "bos_reply_print(netdissect_options *ndo, register const u_char *bp, int length, int32_t opcode) { const struct rx_header *rxh; if (length <= (int)sizeof(struct rx_header)) return; rxh = (const struct rx_header *) bp; /* * Print out the afs call we're invoking. The table used here was * gleaned from volser/volint.xg */ ND_PRINT((ndo, "" bos reply %s"", tok2str(bos_req, ""op#%d"", opcode))); bp += sizeof(struct rx_header); /* * If it was a data packet, interpret the response. */ if (rxh->type == RX_PACKET_TYPE_DATA) /* Well, no, not really. Leave this for later */ ; else { /* * Otherwise, just print out the return code */ ND_PRINT((ndo, "" errcode"")); INTOUT(); } return; trunc: ND_PRINT((ndo, "" [|bos]"")); } ",0 " void EndScroll(bool is_fling, float velocity_y) { IncreaseTimestamp(); ui::GestureEventDetails event_details = is_fling ? ui::GestureEventDetails(ui::ET_SCROLL_FLING_START, 0, velocity_y) : ui::GestureEventDetails(ui::ET_GESTURE_SCROLL_END); ui::GestureEvent event = ui::GestureEvent(current_point_.x(), current_point_.y(), ui::EF_NONE, timestamp_, event_details); GetShelfLayoutManager()->ProcessGestureEvent(event); } ",0 "bool V4L2JpegEncodeAccelerator::EncodedInstanceDmaBuf::RequestOutputBuffers() { DCHECK(parent_->encoder_task_runner_->BelongsToCurrentThread()); struct v4l2_requestbuffers reqbufs; memset(&reqbufs, 0, sizeof(reqbufs)); reqbufs.count = kBufferCount; reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; reqbufs.memory = V4L2_MEMORY_DMABUF; IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_REQBUFS, &reqbufs); DCHECK(free_output_buffers_.empty()); for (size_t i = 0; i < reqbufs.count; ++i) { free_output_buffers_.push_back(i); } return true; } ",0 "void GraphicsContext::concatCTM(const AffineTransform& transform) { if (paintingDisabled()) return; #if USE(WXGC) wxGraphicsContext* gc = m_data->context->GetGraphicsContext(); if (gc) gc->ConcatTransform(transform); #endif return; } ",0 " int DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, int *ret) { int ok = 0; BIGNUM *q = NULL; *ret = 0; q = BN_new(); if (q == NULL) goto err; BN_set_word(q, 1); if (BN_cmp(pub_key, q) <= 0) *ret |= DH_CHECK_PUBKEY_TOO_SMALL; BN_copy(q, dh->p); BN_sub_word(q, 1); if (BN_cmp(pub_key, q) >= 0) *ret |= DH_CHECK_PUBKEY_TOO_LARGE; ok = 1; err: if (q != NULL) BN_free(q); return (ok); } ",1 "void LayerTreeHost::ApplyViewportDeltas(ScrollAndScaleSet* info) { gfx::Vector2dF inner_viewport_scroll_delta; if (info->inner_viewport_scroll.layer_id != Layer::INVALID_ID) inner_viewport_scroll_delta = info->inner_viewport_scroll.scroll_delta; if (inner_viewport_scroll_delta.IsZero() && info->page_scale_delta == 1.f && info->elastic_overscroll_delta.IsZero() && !info->top_controls_delta) return; if (inner_viewport_scroll_layer_) { inner_viewport_scroll_layer_->SetScrollOffsetFromImplSide( gfx::ScrollOffsetWithDelta( inner_viewport_scroll_layer_->scroll_offset(), inner_viewport_scroll_delta)); } ApplyPageScaleDeltaFromImplSide(info->page_scale_delta); SetElasticOverscrollFromImplSide(elastic_overscroll_ + info->elastic_overscroll_delta); client_->ApplyViewportDeltas(inner_viewport_scroll_delta, gfx::Vector2dF(), info->elastic_overscroll_delta, info->page_scale_delta, info->top_controls_delta); SetNeedsUpdateLayers(); } ",0 "grub_ext4_find_leaf (struct grub_ext2_data *data, char *buf, struct grub_ext4_extent_header *ext_block, grub_uint32_t fileblock) { struct grub_ext4_extent_idx *index; while (1) { int i; grub_disk_addr_t block; index = (struct grub_ext4_extent_idx *) (ext_block + 1); if (grub_le_to_cpu16(ext_block->magic) != EXT4_EXT_MAGIC) return 0; if (ext_block->depth == 0) return ext_block; for (i = 0; i < grub_le_to_cpu16 (ext_block->entries); i++) { if (fileblock < grub_le_to_cpu32(index[i].block)) break; } if (--i < 0) return 0; block = grub_le_to_cpu16 (index[i].leaf_hi); block = (block << 32) + grub_le_to_cpu32 (index[i].leaf); if (grub_disk_read (data->disk, block << LOG2_EXT2_BLOCK_SIZE (data), 0, EXT2_BLOCK_SIZE(data), buf)) return 0; ext_block = (struct grub_ext4_extent_header *) buf; } } ",0 "OMX_ERRORTYPE omx_vdec::component_deinit(OMX_IN OMX_HANDLETYPE hComp) { (void) hComp; #ifdef _ANDROID_ if (iDivXDrmDecrypt) { delete iDivXDrmDecrypt; iDivXDrmDecrypt=NULL; } #endif //_ANDROID_ unsigned i = 0; if (OMX_StateLoaded != m_state) { DEBUG_PRINT_ERROR(""WARNING:Rxd DeInit,OMX not in LOADED state %d"",\ m_state); DEBUG_PRINT_ERROR(""Playback Ended - FAILED""); } else { DEBUG_PRINT_HIGH(""Playback Ended - PASSED""); } /*Check if the output buffers have to be cleaned up*/ if (m_out_mem_ptr) { DEBUG_PRINT_LOW(""Freeing the Output Memory""); for (i = 0; i < drv_ctx.op_buf.actualcount; i++ ) { if (BITMASK_PRESENT(&m_out_bm_count, i)) { BITMASK_CLEAR(&m_out_bm_count, i); client_buffers.free_output_buffer (&m_out_mem_ptr[i]); } if (release_output_done()) { break; } } #ifdef _ANDROID_ICS_ memset(&native_buffer, 0, (sizeof(nativebuffer) * MAX_NUM_INPUT_OUTPUT_BUFFERS)); #endif } /*Check if the input buffers have to be cleaned up*/ if (m_inp_mem_ptr || m_inp_heap_ptr) { DEBUG_PRINT_LOW(""Freeing the Input Memory""); for (i = 0; imode_config.mutex); obj = drm_mode_object_find(dev, out_resp->connector_id, DRM_MODE_OBJECT_CONNECTOR); if (!obj) { goto out; } connector = obj_to_connector(obj); for (i = 0; i < DRM_CONNECTOR_MAX_PROPERTY; i++) { if (connector->property_ids[i] == out_resp->prop_id) break; } if (i == DRM_CONNECTOR_MAX_PROPERTY) { goto out; } obj = drm_mode_object_find(dev, out_resp->prop_id, DRM_MODE_OBJECT_PROPERTY); if (!obj) { goto out; } property = obj_to_property(obj); if (property->flags & DRM_MODE_PROP_IMMUTABLE) goto out; if (property->flags & DRM_MODE_PROP_RANGE) { if (out_resp->value < property->values[0]) goto out; if (out_resp->value > property->values[1]) goto out; } else { int found = 0; for (i = 0; i < property->num_values; i++) { if (property->values[i] == out_resp->value) { found = 1; break; } } if (!found) { goto out; } } /* Do DPMS ourselves */ if (property == connector->dev->mode_config.dpms_property) { if (connector->funcs->dpms) (*connector->funcs->dpms)(connector, (int) out_resp->value); ret = 0; } else if (connector->funcs->set_property) ret = connector->funcs->set_property(connector, property, out_resp->value); /* store the property value if successful */ if (!ret) drm_connector_property_set_value(connector, property, out_resp->value); out: mutex_unlock(&dev->mode_config.mutex); return ret; } ",0 "static void tcp_remove_reno_sacks(struct sock *sk, int acked) { struct tcp_sock *tp = tcp_sk(sk); if (acked > 0) { /* One ACK acked hole. The rest eat duplicate ACKs. */ if (acked - 1 >= tp->sacked_out) tp->sacked_out = 0; else tp->sacked_out -= acked - 1; } tcp_check_reno_reordering(sk, acked); tcp_verify_left_out(tp); } ",0 "static int ssl3_add_cert_to_buf(BUF_MEM *buf, unsigned long *l, X509 *x) { int n; unsigned char *p; n=i2d_X509(x,NULL); if (!BUF_MEM_grow_clean(buf,(int)(n+(*l)+3))) { SSLerr(SSL_F_SSL3_ADD_CERT_TO_BUF,ERR_R_BUF_LIB); return(-1); } p=(unsigned char *)&(buf->data[*l]); l2n3(n,p); i2d_X509(x,&p); *l+=n+3; return(0); } ",0 "void nft_unregister_set(struct nft_set_ops *ops) { nfnl_lock(NFNL_SUBSYS_NFTABLES); list_del_rcu(&ops->list); nfnl_unlock(NFNL_SUBSYS_NFTABLES); } ",0 "void WebLocalFrameImpl::ReloadWithOverrideURL(const WebURL& override_url, WebFrameLoadType load_type) { DCHECK(GetFrame()); DCHECK(IsReloadLoadType(static_cast(load_type))); WebURLRequest request = RequestForReload(load_type, override_url); if (request.IsNull()) return; Load(request, load_type, WebHistoryItem(), kWebHistoryDifferentDocumentLoad, false); } ",0 "CmdBufferImageTransportFactory::CmdBufferImageTransportFactory() { WebKit::WebGraphicsContext3D::Attributes attrs; attrs.shareResources = true; GpuChannelHostFactory* factory = BrowserGpuChannelHostFactory::instance(); GURL url(""chrome://gpu/ImageTransportFactoryAndroid""); base::WeakPtr swap_client; context_.reset(new WebGraphicsContext3DCommandBufferImpl(0, // offscreen url, factory, swap_client)); context_->Initialize( attrs, false, CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE); } ",0 "scoped_refptr RenderFrameImpl::GetURLLoaderFactory() { return GetLoaderFactoryBundle(); } ",0 "poppler_page_prepare_output_dev (PopplerPage *page, double scale, int rotation, gboolean transparent, OutputDevData *output_dev_data) { CairoOutputDev *output_dev; cairo_surface_t *surface; double width, height; int cairo_width, cairo_height, cairo_rowstride, rotate; unsigned char *cairo_data; rotate = rotation + page->page->getRotate (); if (rotate == 90 || rotate == 270) { height = page->page->getCropWidth (); width = page->page->getCropHeight (); } else { width = page->page->getCropWidth (); height = page->page->getCropHeight (); } cairo_width = (int) ceil(width * scale); cairo_height = (int) ceil(height * scale); output_dev = page->document->output_dev; cairo_rowstride = cairo_width * 4; cairo_data = (guchar *) gmallocn (cairo_height, cairo_rowstride); if (transparent) memset (cairo_data, 0x00, cairo_height * cairo_rowstride); else memset (cairo_data, 0xff, cairo_height * cairo_rowstride); surface = cairo_image_surface_create_for_data(cairo_data, CAIRO_FORMAT_ARGB32, cairo_width, cairo_height, cairo_rowstride); output_dev_data->cairo_data = cairo_data; output_dev_data->surface = surface; output_dev_data->cairo = cairo_create (surface); output_dev->setCairo (output_dev_data->cairo); } ",0 "JsVar *jspGetConstructor(JsVar *object) { if (!jsvIsObject(object)) return 0; JsVar *proto = jsvObjectGetChild(object, JSPARSE_INHERITS_VAR, 0); if (jsvIsObject(proto)) { JsVar *constr = jsvObjectGetChild(proto, JSPARSE_CONSTRUCTOR_VAR, 0); if (jsvIsFunction(constr)) { jsvUnLock(proto); return constr; } jsvUnLock(constr); } jsvUnLock(proto); return 0; } ",0 "PHP_FUNCTION(imagetypes) { int ret=0; #ifdef HAVE_GD_GIF_CREATE ret = 1; #endif #ifdef HAVE_GD_JPG ret |= 2; #endif #ifdef HAVE_GD_PNG ret |= 4; #endif #ifdef HAVE_GD_WBMP ret |= 8; #endif #if defined(HAVE_GD_XPM) && defined(HAVE_GD_BUNDLED) ret |= 16; #endif if (zend_parse_parameters_none() == FAILURE) { return; } RETURN_LONG(ret); } ",0 " RenderFrameHost* WebContentsImpl::GetFocusedFrameIncludingInnerWebContents() { WebContentsImpl* contents = this; FrameTreeNode* focused_node = contents->frame_tree_.GetFocusedFrame(); if (!focused_node) return nullptr; while (true) { contents = contents->node_.GetInnerWebContentsInFrame(focused_node); if (!contents) return focused_node->current_frame_host(); focused_node = contents->frame_tree_.GetFocusedFrame(); if (!focused_node) return contents->GetMainFrame(); } } ",0 "void ArthurOutputDev::eoFill(GfxState *state) { m_painter->fillPath( convertPath( state, state->getPath(), Qt::OddEvenFill ), m_currentBrush ); } ",0 "static void dw2102_disconnect(struct usb_interface *intf) { struct dvb_usb_device *d = usb_get_intfdata(intf); struct dw2102_state *st = (struct dw2102_state *)d->priv; struct i2c_client *client; /* remove I2C client for tuner */ client = st->i2c_client_tuner; if (client) { module_put(client->dev.driver->owner); i2c_unregister_device(client); } /* remove I2C client for demodulator */ client = st->i2c_client_demod; if (client) { module_put(client->dev.driver->owner); i2c_unregister_device(client); } dvb_usb_device_exit(intf); } ",0 "static inline int imgCoordMungeUpperC(SplashCoord x, GBool glyphMode) { return glyphMode ? (splashCeil(x + 0.5) - 1) : (splashFloor(x) + 1); } ",0 "void BluetoothAdapterChromeOS::SetName(const std::string& name, const base::Closure& callback, const ErrorCallback& error_callback) { DBusThreadManager::Get()->GetBluetoothAdapterClient()-> GetProperties(object_path_)->alias.Set( name, base::Bind(&BluetoothAdapterChromeOS::OnPropertyChangeCompleted, weak_ptr_factory_.GetWeakPtr(), callback, error_callback)); } ",0 "static inline u32 evmcs_read32(unsigned long field) { int offset = get_evmcs_offset(field, NULL); if (offset < 0) return 0; return *(u32 *)((char *)current_evmcs + offset); } ",0 "void TestOfflineLoadPage::NotifyBlockingPageComplete(bool proceed) { test_page_->OnBlockingPageComplete(proceed); } ",0 "xfs_set_dmattrs( xfs_inode_t *ip, u_int evmask, u_int16_t state) { xfs_mount_t *mp = ip->i_mount; xfs_trans_t *tp; int error; if (!capable(CAP_SYS_ADMIN)) return XFS_ERROR(EPERM); if (XFS_FORCED_SHUTDOWN(mp)) return XFS_ERROR(EIO); tp = xfs_trans_alloc(mp, XFS_TRANS_SET_DMATTRS); error = xfs_trans_reserve(tp, &M_RES(mp)->tr_ichange, 0, 0); if (error) { xfs_trans_cancel(tp, 0); return error; } xfs_ilock(ip, XFS_ILOCK_EXCL); xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); ip->i_d.di_dmevmask = evmask; ip->i_d.di_dmstate = state; xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); error = xfs_trans_commit(tp, 0); return error; } ",0 "static void rxfilter_notify(NetClientState *nc) { QObject *event_data; VirtIONet *n = qemu_get_nic_opaque(nc); if (nc->rxfilter_notify_enabled) { gchar *path = object_get_canonical_path(OBJECT(n->qdev)); if (n->netclient_name) { event_data = qobject_from_jsonf(""{ 'name': %s, 'path': %s }"", n->netclient_name, path); } else { event_data = qobject_from_jsonf(""{ 'path': %s }"", path); } monitor_protocol_event(QEVENT_NIC_RX_FILTER_CHANGED, event_data); qobject_decref(event_data); g_free(path); /* disable event notification to avoid events flooding */ nc->rxfilter_notify_enabled = 0; } } ",0 "static int check_cert(X509_STORE_CTX *ctx) { X509_CRL *crl = NULL, *dcrl = NULL; X509 *x = NULL; int ok = 0, cnum = 0; unsigned int last_reasons = 0; cnum = ctx->error_depth; x = sk_X509_value(ctx->chain, cnum); ctx->current_cert = x; ctx->current_issuer = NULL; ctx->current_crl_score = 0; ctx->current_reasons = 0; while (ctx->current_reasons != CRLDP_ALL_REASONS) { last_reasons = ctx->current_reasons; /* Try to retrieve relevant CRL */ if (ctx->get_crl) ok = ctx->get_crl(ctx, &crl, x); else ok = get_crl_delta(ctx, &crl, &dcrl, x); /* * If error looking up CRL, nothing we can do except notify callback */ if (!ok) { ctx->error = X509_V_ERR_UNABLE_TO_GET_CRL; ok = ctx->verify_cb(0, ctx); goto err; } ctx->current_crl = crl; ok = ctx->check_crl(ctx, crl); if (!ok) goto err; if (dcrl) { ok = ctx->check_crl(ctx, dcrl); if (!ok) goto err; ok = ctx->cert_crl(ctx, dcrl, x); if (!ok) goto err; } else ok = 1; /* Don't look in full CRL if delta reason is removefromCRL */ if (ok != 2) { ok = ctx->cert_crl(ctx, crl, x); if (!ok) goto err; } X509_CRL_free(crl); X509_CRL_free(dcrl); crl = NULL; dcrl = NULL; /* * If reasons not updated we wont get anywhere by another iteration, * so exit loop. */ if (last_reasons == ctx->current_reasons) { ctx->error = X509_V_ERR_UNABLE_TO_GET_CRL; ok = ctx->verify_cb(0, ctx); goto err; } } err: X509_CRL_free(crl); X509_CRL_free(dcrl); ctx->current_crl = NULL; return ok; } ",0 "int tty_alloc_file(struct file *file) { struct tty_file_private *priv; priv = kmalloc(sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; file->private_data = priv; return 0; } ",0 "KURL Document::openSearchDescriptionURL() { static const char* const openSearchMIMEType = ""application/opensearchdescription+xml""; static const char* const openSearchRelation = ""search""; if (!frame() || frame()->tree()->parent()) return KURL(); if (frame()->loader()->state() != FrameStateComplete) return KURL(); if (!head()) return KURL(); RefPtr children = head()->children(); for (unsigned i = 0; Node* child = children->item(i); i++) { if (!child->hasTagName(linkTag)) continue; HTMLLinkElement* linkElement = static_cast(child); if (!equalIgnoringCase(linkElement->type(), openSearchMIMEType) || !equalIgnoringCase(linkElement->rel(), openSearchRelation)) continue; if (linkElement->href().isEmpty()) continue; return linkElement->href(); } return KURL(); } ",0 "const AppCacheEntry* AppCache::GetEntryAndUrlWithResponseId( int64_t response_id, GURL* optional_url_out) { for (const auto& pair : entries_) { if (pair.second.response_id() == response_id) { if (optional_url_out) *optional_url_out = pair.first; return &pair.second; } } return nullptr; } ",0 "yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); YYSIZE_T yysize = yysize0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ const char *yyformat = YY_NULLPTR; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the ""unexpected"", one per ""expected""). */ int yycount = 0; /* There are many possibilities here to consider: - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action is an error action. In that case, don't check for expected tokens because there are none. - The only way there can be no lookahead present (in yychar) is if this state is a consistent state with a default action. Thus, detecting the absence of a lookahead is sufficient to determine that there is no unexpected or expected token to report. In that case, just report a simple ""syntax error"". - Don't assume there isn't a lookahead just because this state is a consistent state with a default action. There might have been a previous inconsistent state, consistent state with a non-default action, or user semantic action that manipulated yychar. - Of course, the expected token list depends on states to have correct lookahead information, and it depends on the parser not to perform extra reductions after fetching a lookahead from the scanner and before detecting a syntax error. Thus, state merging (from LALR or IELR) and default reductions corrupt the expected token list. However, the list is correct for canonical LR with one exception: it will still contain any token that will not be accepted due to an error action in a later state. */ if (yytoken != YYEMPTY) { int yyn = yypact[*yyssp]; yyarg[yycount++] = yytname[yytoken]; if (!yypact_value_is_default (yyn)) { /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. In other words, skip the first -YYN actions for this state because they are default actions. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn + 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yyx; for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR && !yytable_value_is_error (yytable[yyx + yyn])) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; break; } yyarg[yycount++] = yytname[yyx]; { YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; yysize = yysize1; } } } } switch (yycount) { # define YYCASE_(N, S) \ case N: \ yyformat = S; \ break YYCASE_(0, YY_(""syntax error"")); YYCASE_(1, YY_(""syntax error, unexpected %s"")); YYCASE_(2, YY_(""syntax error, unexpected %s, expecting %s"")); YYCASE_(3, YY_(""syntax error, unexpected %s, expecting %s or %s"")); YYCASE_(4, YY_(""syntax error, unexpected %s, expecting %s or %s or %s"")); YYCASE_(5, YY_(""syntax error, unexpected %s, expecting %s or %s or %s or %s"")); # undef YYCASE_ } { YYSIZE_T yysize1 = yysize + yystrlen (yyformat); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; yysize = yysize1; } if (*yymsg_alloc < yysize) { *yymsg_alloc = 2 * yysize; if (! (yysize <= *yymsg_alloc && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; return 1; } /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of ""%s""s. */ { char *yyp = *yymsg; int yyi = 0; while ((*yyp = *yyformat) != '\0') if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyformat += 2; } else { yyp++; yyformat++; } } return 0; } ",0 "xmlCreateEntityParserCtxt(const xmlChar *URL, const xmlChar *ID, const xmlChar *base) { return xmlCreateEntityParserCtxtInternal(URL, ID, base, NULL); } ",0 "static OMX_AUDIO_AMRBANDMODETYPE pickModeFromBitRate( bool isAMRWB, int32_t bps) { if (isAMRWB) { if (bps <= 6600) { return OMX_AUDIO_AMRBandModeWB0; } else if (bps <= 8850) { return OMX_AUDIO_AMRBandModeWB1; } else if (bps <= 12650) { return OMX_AUDIO_AMRBandModeWB2; } else if (bps <= 14250) { return OMX_AUDIO_AMRBandModeWB3; } else if (bps <= 15850) { return OMX_AUDIO_AMRBandModeWB4; } else if (bps <= 18250) { return OMX_AUDIO_AMRBandModeWB5; } else if (bps <= 19850) { return OMX_AUDIO_AMRBandModeWB6; } else if (bps <= 23050) { return OMX_AUDIO_AMRBandModeWB7; } return OMX_AUDIO_AMRBandModeWB8; } else { // AMRNB if (bps <= 4750) { return OMX_AUDIO_AMRBandModeNB0; } else if (bps <= 5150) { return OMX_AUDIO_AMRBandModeNB1; } else if (bps <= 5900) { return OMX_AUDIO_AMRBandModeNB2; } else if (bps <= 6700) { return OMX_AUDIO_AMRBandModeNB3; } else if (bps <= 7400) { return OMX_AUDIO_AMRBandModeNB4; } else if (bps <= 7950) { return OMX_AUDIO_AMRBandModeNB5; } else if (bps <= 10200) { return OMX_AUDIO_AMRBandModeNB6; } return OMX_AUDIO_AMRBandModeNB7; } } ",0 "convert_initialized_extent(handle_t *handle, struct inode *inode, struct ext4_map_blocks *map, struct ext4_ext_path **ppath, int flags, unsigned int allocated, ext4_fsblk_t newblock) { struct ext4_ext_path *path = *ppath; struct ext4_extent *ex; ext4_lblk_t ee_block; unsigned int ee_len; int depth; int err = 0; /* * Make sure that the extent is no bigger than we support with * unwritten extent */ if (map->m_len > EXT_UNWRITTEN_MAX_LEN) map->m_len = EXT_UNWRITTEN_MAX_LEN / 2; depth = ext_depth(inode); ex = path[depth].p_ext; ee_block = le32_to_cpu(ex->ee_block); ee_len = ext4_ext_get_actual_len(ex); ext_debug(""%s: inode %lu, logical"" ""block %llu, max_blocks %u\n"", __func__, inode->i_ino, (unsigned long long)ee_block, ee_len); if (ee_block != map->m_lblk || ee_len > map->m_len) { err = ext4_split_convert_extents(handle, inode, map, ppath, EXT4_GET_BLOCKS_CONVERT_UNWRITTEN); if (err < 0) return err; path = ext4_find_extent(inode, map->m_lblk, ppath, 0); if (IS_ERR(path)) return PTR_ERR(path); depth = ext_depth(inode); ex = path[depth].p_ext; if (!ex) { EXT4_ERROR_INODE(inode, ""unexpected hole at %lu"", (unsigned long) map->m_lblk); return -EIO; } } err = ext4_ext_get_access(handle, inode, path + depth); if (err) return err; /* first mark the extent as unwritten */ ext4_ext_mark_unwritten(ex); /* note: ext4_ext_correct_indexes() isn't needed here because * borders are not changed */ ext4_ext_try_to_merge(handle, inode, path, ex); /* Mark modified extent as dirty */ err = ext4_ext_dirty(handle, inode, path + path->p_depth); if (err) return err; ext4_ext_show_leaf(inode, path); ext4_update_inode_fsync_trans(handle, inode, 1); err = check_eofblocks_fl(handle, inode, map->m_lblk, path, map->m_len); if (err) return err; map->m_flags |= EXT4_MAP_UNWRITTEN; if (allocated > map->m_len) allocated = map->m_len; map->m_len = allocated; return allocated; } ",0 "void qemu_spice_del_memslot(SimpleSpiceDisplay *ssd, uint32_t gid, uint32_t sid) { trace_qemu_spice_del_memslot(ssd->qxl.id, gid, sid); spice_qxl_del_memslot(&ssd->qxl, gid, sid); } ",0 "static PrimitiveInfo *TraceStrokePolygon(const DrawInfo *draw_info, const PrimitiveInfo *primitive_info) { typedef struct _LineSegment { double p, q; } LineSegment; double delta_theta, dot_product, mid, miterlimit; LineSegment dx, dy, inverse_slope, slope, theta; MagickBooleanType closed_path; PointInfo box_p[5], box_q[5], center, offset, *path_p, *path_q; PrimitiveInfo *polygon_primitive, *stroke_polygon; register ssize_t i; size_t arc_segments, max_strokes, number_vertices; ssize_t j, n, p, q; /* Allocate paths. */ number_vertices=primitive_info->coordinates; max_strokes=2*number_vertices+6*BezierQuantum+360; path_p=(PointInfo *) AcquireQuantumMemory((size_t) max_strokes, sizeof(*path_p)); path_q=(PointInfo *) AcquireQuantumMemory((size_t) max_strokes, sizeof(*path_q)); polygon_primitive=(PrimitiveInfo *) AcquireQuantumMemory((size_t) number_vertices+2UL,sizeof(*polygon_primitive)); if ((path_p == (PointInfo *) NULL) || (path_q == (PointInfo *) NULL) || (polygon_primitive == (PrimitiveInfo *) NULL)) return((PrimitiveInfo *) NULL); (void) CopyMagickMemory(polygon_primitive,primitive_info,(size_t) number_vertices*sizeof(*polygon_primitive)); closed_path= (fabs(primitive_info[number_vertices-1].point.x-primitive_info[0].point.x) < DrawEpsilon) && (fabs(primitive_info[number_vertices-1].point.y-primitive_info[0].point.y) < DrawEpsilon) ? MagickTrue : MagickFalse; if ((draw_info->linejoin == RoundJoin) || ((draw_info->linejoin == MiterJoin) && (closed_path != MagickFalse))) { polygon_primitive[number_vertices]=primitive_info[1]; number_vertices++; } polygon_primitive[number_vertices].primitive=UndefinedPrimitive; /* Compute the slope for the first line segment, p. */ dx.p=0.0; dy.p=0.0; for (n=1; n < (ssize_t) number_vertices; n++) { dx.p=polygon_primitive[n].point.x-polygon_primitive[0].point.x; dy.p=polygon_primitive[n].point.y-polygon_primitive[0].point.y; if ((fabs(dx.p) >= DrawEpsilon) || (fabs(dy.p) >= DrawEpsilon)) break; } if (n == (ssize_t) number_vertices) n=(ssize_t) number_vertices-1L; slope.p=0.0; inverse_slope.p=0.0; if (fabs(dx.p) < DrawEpsilon) { if (dx.p >= 0.0) slope.p=dy.p < 0.0 ? -1.0/DrawEpsilon : 1.0/DrawEpsilon; else slope.p=dy.p < 0.0 ? 1.0/DrawEpsilon : -1.0/DrawEpsilon; } else if (fabs(dy.p) < DrawEpsilon) { if (dy.p >= 0.0) inverse_slope.p=dx.p < 0.0 ? -1.0/DrawEpsilon : 1.0/DrawEpsilon; else inverse_slope.p=dx.p < 0.0 ? 1.0/DrawEpsilon : -1.0/DrawEpsilon; } else { slope.p=dy.p/dx.p; inverse_slope.p=(-1.0/slope.p); } mid=ExpandAffine(&draw_info->affine)*draw_info->stroke_width/2.0; miterlimit=(double) (draw_info->miterlimit*draw_info->miterlimit*mid*mid); if ((draw_info->linecap == SquareCap) && (closed_path == MagickFalse)) TraceSquareLinecap(polygon_primitive,number_vertices,mid); offset.x=sqrt((double) (mid*mid/(inverse_slope.p*inverse_slope.p+1.0))); offset.y=(double) (offset.x*inverse_slope.p); if ((dy.p*offset.x-dx.p*offset.y) > 0.0) { box_p[0].x=polygon_primitive[0].point.x-offset.x; box_p[0].y=polygon_primitive[0].point.y-offset.x*inverse_slope.p; box_p[1].x=polygon_primitive[n].point.x-offset.x; box_p[1].y=polygon_primitive[n].point.y-offset.x*inverse_slope.p; box_q[0].x=polygon_primitive[0].point.x+offset.x; box_q[0].y=polygon_primitive[0].point.y+offset.x*inverse_slope.p; box_q[1].x=polygon_primitive[n].point.x+offset.x; box_q[1].y=polygon_primitive[n].point.y+offset.x*inverse_slope.p; } else { box_p[0].x=polygon_primitive[0].point.x+offset.x; box_p[0].y=polygon_primitive[0].point.y+offset.y; box_p[1].x=polygon_primitive[n].point.x+offset.x; box_p[1].y=polygon_primitive[n].point.y+offset.y; box_q[0].x=polygon_primitive[0].point.x-offset.x; box_q[0].y=polygon_primitive[0].point.y-offset.y; box_q[1].x=polygon_primitive[n].point.x-offset.x; box_q[1].y=polygon_primitive[n].point.y-offset.y; } /* Create strokes for the line join attribute: bevel, miter, round. */ p=0; q=0; path_q[p++]=box_q[0]; path_p[q++]=box_p[0]; for (i=(ssize_t) n+1; i < (ssize_t) number_vertices; i++) { /* Compute the slope for this line segment, q. */ dx.q=polygon_primitive[i].point.x-polygon_primitive[n].point.x; dy.q=polygon_primitive[i].point.y-polygon_primitive[n].point.y; dot_product=dx.q*dx.q+dy.q*dy.q; if (dot_product < 0.25) continue; slope.q=0.0; inverse_slope.q=0.0; if (fabs(dx.q) < DrawEpsilon) { if (dx.q >= 0.0) slope.q=dy.q < 0.0 ? -1.0/DrawEpsilon : 1.0/DrawEpsilon; else slope.q=dy.q < 0.0 ? 1.0/DrawEpsilon : -1.0/DrawEpsilon; } else if (fabs(dy.q) < DrawEpsilon) { if (dy.q >= 0.0) inverse_slope.q=dx.q < 0.0 ? -1.0/DrawEpsilon : 1.0/DrawEpsilon; else inverse_slope.q=dx.q < 0.0 ? 1.0/DrawEpsilon : -1.0/DrawEpsilon; } else { slope.q=dy.q/dx.q; inverse_slope.q=(-1.0/slope.q); } offset.x=sqrt((double) (mid*mid/(inverse_slope.q*inverse_slope.q+1.0))); offset.y=(double) (offset.x*inverse_slope.q); dot_product=dy.q*offset.x-dx.q*offset.y; if (dot_product > 0.0) { box_p[2].x=polygon_primitive[n].point.x-offset.x; box_p[2].y=polygon_primitive[n].point.y-offset.y; box_p[3].x=polygon_primitive[i].point.x-offset.x; box_p[3].y=polygon_primitive[i].point.y-offset.y; box_q[2].x=polygon_primitive[n].point.x+offset.x; box_q[2].y=polygon_primitive[n].point.y+offset.y; box_q[3].x=polygon_primitive[i].point.x+offset.x; box_q[3].y=polygon_primitive[i].point.y+offset.y; } else { box_p[2].x=polygon_primitive[n].point.x+offset.x; box_p[2].y=polygon_primitive[n].point.y+offset.y; box_p[3].x=polygon_primitive[i].point.x+offset.x; box_p[3].y=polygon_primitive[i].point.y+offset.y; box_q[2].x=polygon_primitive[n].point.x-offset.x; box_q[2].y=polygon_primitive[n].point.y-offset.y; box_q[3].x=polygon_primitive[i].point.x-offset.x; box_q[3].y=polygon_primitive[i].point.y-offset.y; } if (fabs((double) (slope.p-slope.q)) < DrawEpsilon) { box_p[4]=box_p[1]; box_q[4]=box_q[1]; } else { box_p[4].x=(double) ((slope.p*box_p[0].x-box_p[0].y-slope.q*box_p[3].x+ box_p[3].y)/(slope.p-slope.q)); box_p[4].y=(double) (slope.p*(box_p[4].x-box_p[0].x)+box_p[0].y); box_q[4].x=(double) ((slope.p*box_q[0].x-box_q[0].y-slope.q*box_q[3].x+ box_q[3].y)/(slope.p-slope.q)); box_q[4].y=(double) (slope.p*(box_q[4].x-box_q[0].x)+box_q[0].y); } if (q >= (ssize_t) (max_strokes-6*BezierQuantum-360)) { if (~max_strokes < (6*BezierQuantum+360)) { path_p=(PointInfo *) RelinquishMagickMemory(path_p); path_q=(PointInfo *) RelinquishMagickMemory(path_q); } else { max_strokes+=6*BezierQuantum+360; path_p=(PointInfo *) ResizeQuantumMemory(path_p,max_strokes, sizeof(*path_p)); path_q=(PointInfo *) ResizeQuantumMemory(path_q,max_strokes, sizeof(*path_q)); } if ((path_p == (PointInfo *) NULL) || (path_q == (PointInfo *) NULL)) { if (path_p != (PointInfo *) NULL) path_p=(PointInfo *) RelinquishMagickMemory(path_p); if (path_q != (PointInfo *) NULL) path_q=(PointInfo *) RelinquishMagickMemory(path_q); polygon_primitive=(PrimitiveInfo *) RelinquishMagickMemory(polygon_primitive); return((PrimitiveInfo *) NULL); } } dot_product=dx.q*dy.p-dx.p*dy.q; if (dot_product <= 0.0) switch (draw_info->linejoin) { case BevelJoin: { path_q[q++]=box_q[1]; path_q[q++]=box_q[2]; dot_product=(box_q[4].x-box_p[4].x)*(box_q[4].x-box_p[4].x)+ (box_q[4].y-box_p[4].y)*(box_q[4].y-box_p[4].y); if (dot_product <= miterlimit) path_p[p++]=box_p[4]; else { path_p[p++]=box_p[1]; path_p[p++]=box_p[2]; } break; } case MiterJoin: { dot_product=(box_q[4].x-box_p[4].x)*(box_q[4].x-box_p[4].x)+ (box_q[4].y-box_p[4].y)*(box_q[4].y-box_p[4].y); if (dot_product <= miterlimit) { path_q[q++]=box_q[4]; path_p[p++]=box_p[4]; } else { path_q[q++]=box_q[1]; path_q[q++]=box_q[2]; path_p[p++]=box_p[1]; path_p[p++]=box_p[2]; } break; } case RoundJoin: { dot_product=(box_q[4].x-box_p[4].x)*(box_q[4].x-box_p[4].x)+ (box_q[4].y-box_p[4].y)*(box_q[4].y-box_p[4].y); if (dot_product <= miterlimit) path_p[p++]=box_p[4]; else { path_p[p++]=box_p[1]; path_p[p++]=box_p[2]; } center=polygon_primitive[n].point; theta.p=atan2(box_q[1].y-center.y,box_q[1].x-center.x); theta.q=atan2(box_q[2].y-center.y,box_q[2].x-center.x); if (theta.q < theta.p) theta.q+=2.0*MagickPI; arc_segments=(size_t) ceil((double) ((theta.q-theta.p)/ (2.0*sqrt((double) (1.0/mid))))); path_q[q].x=box_q[1].x; path_q[q].y=box_q[1].y; q++; for (j=1; j < (ssize_t) arc_segments; j++) { delta_theta=(double) (j*(theta.q-theta.p)/arc_segments); path_q[q].x=(double) (center.x+mid*cos(fmod((double) (theta.p+delta_theta),DegreesToRadians(360.0)))); path_q[q].y=(double) (center.y+mid*sin(fmod((double) (theta.p+delta_theta),DegreesToRadians(360.0)))); q++; } path_q[q++]=box_q[2]; break; } default: break; } else switch (draw_info->linejoin) { case BevelJoin: { path_p[p++]=box_p[1]; path_p[p++]=box_p[2]; dot_product=(box_q[4].x-box_p[4].x)*(box_q[4].x-box_p[4].x)+ (box_q[4].y-box_p[4].y)*(box_q[4].y-box_p[4].y); if (dot_product <= miterlimit) path_q[q++]=box_q[4]; else { path_q[q++]=box_q[1]; path_q[q++]=box_q[2]; } break; } case MiterJoin: { dot_product=(box_q[4].x-box_p[4].x)*(box_q[4].x-box_p[4].x)+ (box_q[4].y-box_p[4].y)*(box_q[4].y-box_p[4].y); if (dot_product <= miterlimit) { path_q[q++]=box_q[4]; path_p[p++]=box_p[4]; } else { path_q[q++]=box_q[1]; path_q[q++]=box_q[2]; path_p[p++]=box_p[1]; path_p[p++]=box_p[2]; } break; } case RoundJoin: { dot_product=(box_q[4].x-box_p[4].x)*(box_q[4].x-box_p[4].x)+ (box_q[4].y-box_p[4].y)*(box_q[4].y-box_p[4].y); if (dot_product <= miterlimit) path_q[q++]=box_q[4]; else { path_q[q++]=box_q[1]; path_q[q++]=box_q[2]; } center=polygon_primitive[n].point; theta.p=atan2(box_p[1].y-center.y,box_p[1].x-center.x); theta.q=atan2(box_p[2].y-center.y,box_p[2].x-center.x); if (theta.p < theta.q) theta.p+=2.0*MagickPI; arc_segments=(size_t) ceil((double) ((theta.p-theta.q)/ (2.0*sqrt((double) (1.0/mid))))); path_p[p++]=box_p[1]; for (j=1; j < (ssize_t) arc_segments; j++) { delta_theta=(double) (j*(theta.q-theta.p)/arc_segments); path_p[p].x=(double) (center.x+mid*cos(fmod((double) (theta.p+delta_theta),DegreesToRadians(360.0)))); path_p[p].y=(double) (center.y+mid*sin(fmod((double) (theta.p+delta_theta),DegreesToRadians(360.0)))); p++; } path_p[p++]=box_p[2]; break; } default: break; } slope.p=slope.q; inverse_slope.p=inverse_slope.q; box_p[0]=box_p[2]; box_p[1]=box_p[3]; box_q[0]=box_q[2]; box_q[1]=box_q[3]; dx.p=dx.q; dy.p=dy.q; n=i; } path_p[p++]=box_p[1]; path_q[q++]=box_q[1]; /* Trace stroked polygon. */ stroke_polygon=(PrimitiveInfo *) AcquireQuantumMemory((size_t) (p+q+2UL*closed_path+2UL),sizeof(*stroke_polygon)); if (stroke_polygon != (PrimitiveInfo *) NULL) { for (i=0; i < (ssize_t) p; i++) { stroke_polygon[i]=polygon_primitive[0]; stroke_polygon[i].point=path_p[i]; } if (closed_path != MagickFalse) { stroke_polygon[i]=polygon_primitive[0]; stroke_polygon[i].point=stroke_polygon[0].point; i++; } for ( ; i < (ssize_t) (p+q+closed_path); i++) { stroke_polygon[i]=polygon_primitive[0]; stroke_polygon[i].point=path_q[p+q+closed_path-(i+1)]; } if (closed_path != MagickFalse) { stroke_polygon[i]=polygon_primitive[0]; stroke_polygon[i].point=stroke_polygon[p+closed_path].point; i++; } stroke_polygon[i]=polygon_primitive[0]; stroke_polygon[i].point=stroke_polygon[0].point; i++; stroke_polygon[i].primitive=UndefinedPrimitive; stroke_polygon[0].coordinates=(size_t) (p+q+2*closed_path+1); } path_p=(PointInfo *) RelinquishMagickMemory(path_p); path_q=(PointInfo *) RelinquishMagickMemory(path_q); polygon_primitive=(PrimitiveInfo *) RelinquishMagickMemory(polygon_primitive); return(stroke_polygon); } ",0 "bool time_more(struct timeval *a, struct timeval *b) { return timercmp(a, b, >); } ",0 "void ResourceMessageFilter::OnKeygen(uint32 key_size_index, const std::string& challenge_string, const GURL& url, std::string* signed_public_key) { int key_size_in_bits; switch (key_size_index) { case 0: key_size_in_bits = 2048; break; case 1: key_size_in_bits = 1024; break; default: DCHECK(false) << ""Illegal key_size_index "" << key_size_index; *signed_public_key = std::string(); return; } net::KeygenHandler keygen_handler(key_size_in_bits, challenge_string); *signed_public_key = keygen_handler.GenKeyAndSignChallenge(); } ",0 "SyncManager::Status::Summary SyncManager::GetStatusSummary() const { return data_->GetStatus().summary; } ",0 "SYSCALL_DEFINE3(timer_create, const clockid_t, which_clock, struct sigevent __user *, timer_event_spec, timer_t __user *, created_timer_id) { if (timer_event_spec) { sigevent_t event; if (copy_from_user(&event, timer_event_spec, sizeof (event))) return -EFAULT; return do_timer_create(which_clock, &event, created_timer_id); } return do_timer_create(which_clock, NULL, created_timer_id); } ",0 "void HTMLFormControlElement::Reset() { SetAutofillState(WebAutofillState::kNotFilled); ResetImpl(); } ",0 "static int show_map(struct seq_file *m, void *v) { show_map_vma(m, v); m_cache_vma(m, v); return 0; } ",0 "static unsigned long get_sb_block(void **data) { unsigned long sb_block; char *options = (char *) *data; if (!options || strncmp(options, ""sb="", 3) != 0) return 1; /* Default location */ options += 3; sb_block = simple_strtoul(options, &options, 0); if (*options && *options != ',') { printk(""EXT2-fs: Invalid sb specification: %s\n"", (char *) *data); return 1; } if (*options == ',') options++; *data = (void *) options; return sb_block; } ",0 "void vrend_set_blend_color(struct vrend_context *ctx, struct pipe_blend_color *color) { ctx->sub->blend_color = *color; glBlendColor(color->color[0], color->color[1], color->color[2], color->color[3]); } ",0 "void BlobStorageContext::OnEnoughSpaceForCopies(const std::string& uuid, bool success) { if (!success) { CancelBuildingBlob(uuid, BlobStatus::ERR_OUT_OF_MEMORY); return; } BlobEntry* entry = registry_.GetEntry(uuid); if (!entry) return; if (entry->CanFinishBuilding()) FinishBuilding(entry); } ",0 "static int create_server_sdp_record(rfc_slot_t *slot) { if(slot->scn == 0) { return false; } slot->sdp_handle = add_rfc_sdp_rec(slot->service_name, slot->service_uuid, slot->scn); return (slot->sdp_handle > 0); } ",0 "static bool authenticated(conn *c) { assert(settings.sasl); bool rv = false; switch (c->cmd) { case PROTOCOL_BINARY_CMD_SASL_LIST_MECHS: /* FALLTHROUGH */ case PROTOCOL_BINARY_CMD_SASL_AUTH: /* FALLTHROUGH */ case PROTOCOL_BINARY_CMD_SASL_STEP: /* FALLTHROUGH */ case PROTOCOL_BINARY_CMD_VERSION: /* FALLTHROUGH */ rv = true; break; default: rv = c->authenticated; } if (settings.verbose > 1) { fprintf(stderr, ""authenticated() in cmd 0x%02x is %s\n"", c->cmd, rv ? ""true"" : ""false""); } return rv; } ",0 "inline uint32_t web_client_api_request_v1_data_format(char *name) { uint32_t hash = simple_hash(name); int i; for(i = 0; api_v1_data_formats[i].name ; i++) { if (unlikely(hash == api_v1_data_formats[i].hash && !strcmp(name, api_v1_data_formats[i].name))) { return api_v1_data_formats[i].value; } } return DATASOURCE_JSON; } ",0 "static gboolean cosine_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) { gint64 offset; int pkt_len; char line[COSINE_LINE_LENGTH]; /* Find the next packet */ offset = cosine_seek_next_packet(wth, err, err_info, line); if (offset < 0) return FALSE; *data_offset = offset; /* Parse the header */ pkt_len = parse_cosine_rec_hdr(&wth->phdr, line, err, err_info); if (pkt_len == -1) return FALSE; /* Convert the ASCII hex dump to binary data */ return parse_cosine_hex_dump(wth->fh, &wth->phdr, pkt_len, wth->frame_buffer, err, err_info); } ",1 "JsVarRef jsvGetFirstChild(const JsVar *v) { return (JsVarRef)(v->varData.ref.firstChild | (((v->varData.ref.pack)&JSVARREF_PACKED_BIT_MASK))<<8); } ",0 "void LocalFrame::SetTextZoomFactor(float factor) { SetPageAndTextZoomFactors(page_zoom_factor_, factor); } ",0 "u8 remove_sta(struct ar6_softc *ar, u8 *mac, u16 reason) { u8 i, removed=0; if(IS_MAC_NULL(mac)) { return removed; } if(IS_MAC_BCAST(mac)) { A_PRINTF(""DEL ALL STA\n""); for(i=0; i < AP_MAX_NUM_STA; i++) { if(!IS_MAC_NULL(ar->sta_list[i].mac)) { sta_cleanup(ar, i); removed = 1; } } } else { for(i=0; i < AP_MAX_NUM_STA; i++) { if(memcmp(ar->sta_list[i].mac, mac, ATH_MAC_LEN)==0) { A_PRINTF(""DEL STA %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x "" "" aid=%d REASON=%d\n"", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], ar->sta_list[i].aid, reason); sta_cleanup(ar, i); removed = 1; break; } } } return removed; } ",0 "static PassRefPtr valueForGridPosition(const Length& position) { if (position.isAuto()) return cssValuePool().createIdentifierValue(CSSValueAuto); ASSERT(position.isFixed()); return cssValuePool().createValue(position.value(), CSSPrimitiveValue::CSS_NUMBER); } ",0 "huff_get_next_word(Jbig2HuffmanState *hs, int offset) { uint32_t word = 0; Jbig2WordStream *ws = hs->ws; if ((ws->get_next_word(ws, offset, &word)) && ((hs->offset_limit == 0) || (offset < hs->offset_limit))) hs->offset_limit = offset; return word; } ",1 "DownloadManagerImpl::DownloadManagerImpl(BrowserContext* browser_context) : item_factory_(new DownloadItemFactoryImpl()), shutdown_needed_(true), initialized_(false), history_db_initialized_(false), in_progress_cache_initialized_(false), browser_context_(browser_context), delegate_(nullptr), in_progress_manager_( browser_context_->RetriveInProgressDownloadManager()), next_download_id_(download::DownloadItem::kInvalidId), is_history_download_id_retrieved_(false), should_persist_new_download_(false), cancelled_download_cleared_from_history_(0), interrupted_download_cleared_from_history_(0), weak_factory_(this) { DCHECK(browser_context); download::SetIOTaskRunner( base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::IO})); if (!base::FeatureList::IsEnabled(network::features::kNetworkService)) download::UrlDownloadHandlerFactory::Install(new UrlDownloaderFactory()); if (!in_progress_manager_) { in_progress_manager_ = std::make_unique( this, IsOffTheRecord() ? base::FilePath() : browser_context_->GetPath(), base::BindRepeating(&IsOriginSecure), base::BindRepeating(&DownloadRequestUtils::IsURLSafe)); } else { in_progress_manager_->set_delegate(this); in_progress_manager_->set_download_start_observer(nullptr); in_progress_manager_->set_is_origin_secure_cb( base::BindRepeating(&IsOriginSecure)); } in_progress_manager_->NotifyWhenInitialized(base::BindOnce( &DownloadManagerImpl::OnInProgressDownloadManagerInitialized, weak_factory_.GetWeakPtr())); } ",0 "static int reset_card( struct net_device *dev , int lock) { struct airo_info *ai = dev->ml_priv; if (lock && down_interruptible(&ai->sem)) return -1; waitbusy (ai); OUT4500(ai,COMMAND,CMD_SOFTRESET); msleep(200); waitbusy (ai); msleep(200); if (lock) up(&ai->sem); return 0; } ",0 "void DateTimeChooserImpl::setValueAndClosePopup(int numValue, const String& stringValue) { RefPtr protector(this); if (numValue >= 0) setValue(stringValue); endChooser(); } ",0 "bool RenderWidgetHostViewAura::CanComposeInline() const { return can_compose_inline_; } ",0 "bool DeserializeNotificationDatabaseData(const std::string& input, NotificationDatabaseData* output) { DCHECK(output); NotificationDatabaseDataProto message; if (!message.ParseFromString(input)) return false; output->notification_id = message.notification_id(); output->origin = GURL(message.origin()); output->service_worker_registration_id = message.service_worker_registration_id(); PlatformNotificationData* notification_data = &output->notification_data; const NotificationDatabaseDataProto::NotificationData& payload = message.notification_data(); notification_data->title = base::UTF8ToUTF16(payload.title()); switch (payload.direction()) { case NotificationDatabaseDataProto::NotificationData::LEFT_TO_RIGHT: notification_data->direction = PlatformNotificationData::DIRECTION_LEFT_TO_RIGHT; break; case NotificationDatabaseDataProto::NotificationData::RIGHT_TO_LEFT: notification_data->direction = PlatformNotificationData::DIRECTION_RIGHT_TO_LEFT; break; case NotificationDatabaseDataProto::NotificationData::AUTO: notification_data->direction = PlatformNotificationData::DIRECTION_AUTO; break; } notification_data->lang = payload.lang(); notification_data->body = base::UTF8ToUTF16(payload.body()); notification_data->tag = payload.tag(); notification_data->icon = GURL(payload.icon()); if (payload.vibration_pattern().size() > 0) { notification_data->vibration_pattern.assign( payload.vibration_pattern().begin(), payload.vibration_pattern().end()); } notification_data->timestamp = base::Time::FromInternalValue(payload.timestamp()); notification_data->silent = payload.silent(); notification_data->require_interaction = payload.require_interaction(); if (payload.data().length()) { notification_data->data.assign(payload.data().begin(), payload.data().end()); } for (const auto& payload_action : payload.actions()) { PlatformNotificationAction action; action.action = payload_action.action(); action.title = base::UTF8ToUTF16(payload_action.title()); notification_data->actions.push_back(action); } return true; } ",1 "PHP_METHOD(Phar, canCompress) { long method = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""|l"", &method) == FAILURE) { return; } phar_request_initialize(TSRMLS_C); switch (method) { case PHAR_ENT_COMPRESSED_GZ: if (PHAR_G(has_zlib)) { RETURN_TRUE; } else { RETURN_FALSE; } case PHAR_ENT_COMPRESSED_BZ2: if (PHAR_G(has_bz2)) { RETURN_TRUE; } else { RETURN_FALSE; } default: if (PHAR_G(has_zlib) || PHAR_G(has_bz2)) { RETURN_TRUE; } else { RETURN_FALSE; } } } ",0 "void HTMLCanvasElement::Dispose() { if (PlaceholderFrame()) ReleasePlaceholderFrame(); if (context_) { context_->DetachHost(); context_ = nullptr; } if (canvas2d_bridge_) { canvas2d_bridge_->SetCanvasResourceHost(nullptr); canvas2d_bridge_ = nullptr; } if (gpu_memory_usage_) { DCHECK_GT(global_accelerated_context_count_, 0u); global_accelerated_context_count_--; } global_gpu_memory_usage_ -= gpu_memory_usage_; } ",1 "static PixelPacket *GetAuthenticPixelsFromCache(const Image *image) { CacheInfo *magick_restrict cache_info; const int id = GetOpenMPThreadId(); assert(image != (const Image *) NULL); assert(image->signature == MagickSignature); assert(image->cache != (Cache) NULL); cache_info=(CacheInfo *) image->cache; assert(cache_info->signature == MagickSignature); assert(id < (int) cache_info->number_threads); return(cache_info->nexus_info[id]->pixels); } ",0 " void DoAuthCallback(NetworkDelegate::AuthRequiredResponse response) { ASSERT_EQ(ON_AUTH_REQUIRED, state_); AuthCallback auth_callback = auth_callback_; Reset(); auth_callback.Run(response); } ",0 "int imap_check(struct ImapData *idata, int force) { /* overload keyboard timeout to avoid many mailbox checks in a row. * Most users don't like having to wait exactly when they press a key. */ int result = 0; /* try IDLE first, unless force is set */ if (!force && ImapIdle && mutt_bit_isset(idata->capabilities, IDLE) && (idata->state != IMAP_IDLE || time(NULL) >= idata->lastread + ImapKeepalive)) { if (imap_cmd_idle(idata) < 0) return -1; } if (idata->state == IMAP_IDLE) { while ((result = mutt_socket_poll(idata->conn, 0)) > 0) { if (imap_cmd_step(idata) != IMAP_CMD_CONTINUE) { mutt_debug(1, ""Error reading IDLE response\n""); return -1; } } if (result < 0) { mutt_debug(1, ""Poll failed, disabling IDLE\n""); mutt_bit_unset(idata->capabilities, IDLE); } } if ((force || (idata->state != IMAP_IDLE && time(NULL) >= idata->lastread + Timeout)) && imap_exec(idata, ""NOOP"", IMAP_CMD_POLL) != 0) { return -1; } /* We call this even when we haven't run NOOP in case we have pending * changes to process, since we can reopen here. */ imap_cmd_finish(idata); if (idata->check_status & IMAP_EXPUNGE_PENDING) result = MUTT_REOPENED; else if (idata->check_status & IMAP_NEWMAIL_PENDING) result = MUTT_NEW_MAIL; else if (idata->check_status & IMAP_FLAGS_PENDING) result = MUTT_FLAGS; idata->check_status = 0; return result; } ",0 "error::Error GLES2DecoderImpl::HandleMultiDrawElementsInstancedCHROMIUM( uint32_t immediate_data_size, const volatile void* cmd_data) { const volatile gles2::cmds::MultiDrawElementsInstancedCHROMIUM& c = *static_cast< const volatile gles2::cmds::MultiDrawElementsInstancedCHROMIUM*>( cmd_data); if (!features().webgl_multi_draw_instanced) { return error::kUnknownCommand; } GLenum mode = static_cast(c.mode); GLenum type = static_cast(c.type); GLsizei drawcount = static_cast(c.drawcount); uint32_t counts_size, offsets_size, instance_counts_size; base::CheckedNumeric checked_size(drawcount); if (!(checked_size * sizeof(GLsizei)).AssignIfValid(&counts_size)) { return error::kOutOfBounds; } if (!(checked_size * sizeof(GLsizei)).AssignIfValid(&offsets_size)) { return error::kOutOfBounds; } if (!(checked_size * sizeof(GLsizei)).AssignIfValid(&instance_counts_size)) { return error::kOutOfBounds; } const GLsizei* counts = GetSharedMemoryAs( c.counts_shm_id, c.counts_shm_offset, counts_size); const GLsizei* offsets = GetSharedMemoryAs( c.offsets_shm_id, c.offsets_shm_offset, offsets_size); const GLsizei* instance_counts = GetSharedMemoryAs( c.instance_counts_shm_id, c.instance_counts_shm_offset, instance_counts_size); if (counts == nullptr) { return error::kOutOfBounds; } if (offsets == nullptr) { return error::kOutOfBounds; } if (instance_counts == nullptr) { return error::kOutOfBounds; } if (!multi_draw_manager_->MultiDrawElementsInstanced( mode, counts, type, offsets, instance_counts, drawcount)) { return error::kInvalidArguments; } return error::kNoError; } ",0 " DownloadItem* CreateDownloadItem(DownloadItem::DownloadState state) { scoped_ptr info_; info_.reset(new DownloadCreateInfo()); static int next_id; info_->download_id = content::DownloadId(kValidDownloadItemIdDomain, ++next_id); info_->prompt_user_for_save_location = false; info_->url_chain.push_back(GURL()); info_->state = state; scoped_ptr request_handle( new testing::NiceMock); DownloadItem* download = new DownloadItemImpl(&delegate_, *(info_.get()), request_handle.Pass(), false, net::BoundNetLog()); allocated_downloads_.insert(download); return download; } ",0 " virtual ~Trans16x16DCT() {} ",0 "static int translate_desc(struct vhost_virtqueue *vq, u64 addr, u32 len, struct iovec iov[], int iov_size) { const struct vhost_memory_region *reg; struct vhost_memory *mem; struct iovec *_iov; u64 s = 0; int ret = 0; mem = vq->memory; while ((u64)len > s) { u64 size; if (unlikely(ret >= iov_size)) { ret = -ENOBUFS; break; } reg = find_region(mem, addr, len); if (unlikely(!reg)) { ret = -EFAULT; break; } _iov = iov + ret; size = reg->memory_size - addr + reg->guest_phys_addr; _iov->iov_len = min((u64)len - s, size); _iov->iov_base = (void __user *)(unsigned long) (reg->userspace_addr + addr - reg->guest_phys_addr); s += size; addr += size; ++ret; } return ret; } ",0 "custom_time_to_string (char *format, va_list va) { int secs; secs = va_arg (va, int); return format_time (secs); } ",0 "static void register_sched_domain_sysctl(void) { } ",0 "static void cmd_create(char *tag, char *name, struct dlist *extargs, int localonly) { int r = 0; int mbtype = 0; const char *partition = NULL; const char *server = NULL; struct buf specialuse = BUF_INITIALIZER; struct dlist *use; /* We don't care about trailing hierarchy delimiters. */ if (name[0] && name[strlen(name)-1] == imapd_namespace.hier_sep) { name[strlen(name)-1] = '\0'; } mbname_t *mbname = mbname_from_extname(name, &imapd_namespace, imapd_userid); dlist_getatom(extargs, ""PARTITION"", &partition); dlist_getatom(extargs, ""SERVER"", &server); const char *type = NULL; dlist_getatom(extargs, ""PARTITION"", &partition); dlist_getatom(extargs, ""SERVER"", &server); if (dlist_getatom(extargs, ""TYPE"", &type)) { if (!strcasecmp(type, ""CALENDAR"")) mbtype |= MBTYPE_CALENDAR; else if (!strcasecmp(type, ""COLLECTION"")) mbtype |= MBTYPE_COLLECTION; else if (!strcasecmp(type, ""ADDRESSBOOK"")) mbtype |= MBTYPE_ADDRESSBOOK; else { r = IMAP_MAILBOX_BADTYPE; goto err; } } use = dlist_getchild(extargs, ""USE""); if (use) { /* only user mailboxes can have specialuse, and they must be user toplevel folders */ if (!mbname_userid(mbname) || strarray_size(mbname_boxes(mbname)) != 1) { r = IMAP_MAILBOX_SPECIALUSE; goto err; } /* I would much prefer to create the specialuse annotation FIRST * and do the sanity check on the values, so we can return the * correct error. Sadly, that's a pain - so we compromise by * ""normalising"" first */ struct dlist *item; char *raw; strarray_t *su = strarray_new(); for (item = use->head; item; item = item->next) { strarray_append(su, dlist_cstring(item)); } raw = strarray_join(su, "" ""); strarray_free(su); r = specialuse_validate(imapd_userid, raw, &specialuse); free(raw); if (r) { prot_printf(imapd_out, ""%s NO [USEATTR] %s\r\n"", tag, error_message(r)); goto done; } } if ((server || partition) && !imapd_userisadmin) { if (config_mupdate_config == IMAP_ENUM_MUPDATE_CONFIG_STANDARD || config_mupdate_config == IMAP_ENUM_MUPDATE_CONFIG_UNIFIED) { if (!config_getstring(IMAPOPT_PROXYSERVERS)) { r = IMAP_PERMISSION_DENIED; goto err; } } } /* check for INBOX.INBOX creation by broken Apple clients */ const strarray_t *boxes = mbname_boxes(mbname); if (strarray_size(boxes) > 1 && !strcasecmp(strarray_nth(boxes, 0), ""INBOX"") && !strcasecmp(strarray_nth(boxes, 1), ""INBOX"")) r = IMAP_MAILBOX_BADNAME; if (r) { err: prot_printf(imapd_out, ""%s NO %s\r\n"", tag, error_message(r)); goto done; } if (!localonly) { if (config_mupdate_server) { if ( config_mupdate_config == IMAP_ENUM_MUPDATE_CONFIG_STANDARD || config_mupdate_config == IMAP_ENUM_MUPDATE_CONFIG_UNIFIED ) { if (!config_getstring(IMAPOPT_PROXYSERVERS)) { mbentry_t *parent = NULL; r = mboxlist_findparent(mbname_intname(mbname), &parent); if (r) { if (r != IMAP_MAILBOX_NONEXISTENT) { prot_printf(imapd_out, ""%s NO %s (%s:%d)\r\n"", tag, error_message(r), __FILE__, __LINE__); goto done; } } if (!server && !partition) { if (!parent) { server = find_free_server(); if (!server) { prot_printf(imapd_out, ""%s NO %s\r\n"", tag, error_message(IMAP_SERVER_UNAVAILABLE)); goto done; } } else { server = parent->server; /* DO NOT set the partition: only admins are allowed to do this and the backend will use the partition of the parent by default anyways. partition = parent->partition; */ } } struct backend *s_conn = NULL; s_conn = proxy_findserver( server, &imap_protocol, proxy_userid, &backend_cached, &backend_current, &backend_inbox, imapd_in ); if (!s_conn) { prot_printf(imapd_out, ""%s NO %s\r\n"", tag, error_message(IMAP_SERVER_UNAVAILABLE)); goto done; } if (imapd_userisadmin && supports_referrals) { imapd_refer(tag, server, name); referral_kick = 1; return; } if (!CAPA(s_conn, CAPA_MUPDATE)) { syslog(LOG_WARNING, ""backend %s is not advertising any MUPDATE capability (%s:%d)"", server, __FILE__, __LINE__); } prot_printf(s_conn->out, ""%s CREATE "", tag); prot_printastring(s_conn->out, name); if (specialuse.len) { prot_printf(s_conn->out, ""(USE (%s)"", buf_cstring(&specialuse)); if (partition) { prot_printf(s_conn->out, "" PARTITION ""); prot_printastring(s_conn->out, partition); } prot_putc(')', s_conn->out); } else if (partition) { prot_putc(' ', s_conn->out); prot_printastring(s_conn->out, partition); } prot_printf(s_conn->out, ""\r\n""); int res = pipe_until_tag(s_conn, tag, 0); if (!CAPA(s_conn, CAPA_MUPDATE)) { syslog(LOG_WARNING, ""backend %s is not advertising any MUPDATE capability (%s:%d)"", server, __FILE__, __LINE__); } /* make sure we've seen the update */ if (ultraparanoid && res == PROXY_OK) kick_mupdate(); imapd_check(s_conn, 0); prot_printf(imapd_out, ""%s %s"", tag, s_conn->last_result.s); goto done; } else { // (!config_getstring(IMAPOPT_PROXYSERVERS)) goto localcreate; } // (!config_getstring(IMAPOPT_PROXYSERVERS)) } // (config_mupdate_config == IMAP_ENUM_MUPDATE_CONFIG_STANDARD) else if (config_mupdate_config == IMAP_ENUM_MUPDATE_CONFIG_REPLICATED) { goto localcreate; } // (config_mupdate_config == IMAP_ENUM_MUPDATE_CONFIG_REPLICATED) else { syslog(LOG_ERR, ""murder configuration I cannot deal with""); prot_printf(imapd_out, ""%s NO %s\r\n"", tag, error_message(IMAP_SERVER_UNAVAILABLE)); goto done; } } else { // (config_mupdate_server) goto localcreate; } // (config_mupdate_server) } else { // (!localonly) goto localcreate; } localcreate: r = mboxlist_createmailbox( mbname_intname(mbname), // const char name mbtype, // int mbtype partition, // const char partition imapd_userisadmin || imapd_userisproxyadmin, // int isadmin imapd_userid, // const char userid imapd_authstate, // struct auth_state auth_state localonly, // int localonly localonly, // int forceuser 0, // int dbonly 1, // int notify NULL // struct mailbox mailboxptr ); #ifdef USE_AUTOCREATE if (r == IMAP_PERMISSION_DENIED) { if (!strcasecmp(name, ""INBOX"")) { int autocreatequotastorage = config_getint(IMAPOPT_AUTOCREATE_QUOTA); if (autocreatequotastorage > 0) { r = mboxlist_createmailbox( mbname_intname(mbname), 0, partition, 1, imapd_userid, imapd_authstate, 0, 0, 0, 1, NULL ); if (r) { prot_printf(imapd_out, ""%s NO %s\r\n"", tag, error_message(r)); goto done; } int autocreatequotamessage = config_getint(IMAPOPT_AUTOCREATE_QUOTA_MESSAGES); if ((autocreatequotastorage > 0) || (autocreatequotamessage > 0)) { quota_t newquotas[QUOTA_NUMRESOURCES]; int res; for (res = 0; res < QUOTA_NUMRESOURCES; res++) { newquotas[res] = QUOTA_UNLIMITED; } newquotas[QUOTA_STORAGE] = autocreatequotastorage; newquotas[QUOTA_MESSAGE] = autocreatequotamessage; (void) mboxlist_setquotas(mbname_intname(mbname), newquotas, 0); } // (autocreatequotastorage > 0) || (autocreatequotamessage > 0) } else { // (autocreatequotastorage = config_getint(IMAPOPT_AUTOCREATEQUOTA)) prot_printf(imapd_out, ""%s NO %s\r\n"", tag, error_message(IMAP_PERMISSION_DENIED)); goto done; } // (autocreatequotastorage = config_getint(IMAPOPT_AUTOCREATEQUOTA)) } else { // (!strcasecmp(name, ""INBOX"")) prot_printf(imapd_out, ""%s NO %s\r\n"", tag, error_message(IMAP_PERMISSION_DENIED)); goto done; } // (!strcasecmp(name, ""INBOX"")) } else if (r) { // (r == IMAP_PERMISSION_DENIED) prot_printf(imapd_out, ""%s NO %s\r\n"", tag, error_message(r)); goto done; } else { // (r == IMAP_PERMISSION_DENIED) /* no error: carry on */ } // (r == IMAP_PERMISSION_DENIED) #else // USE_AUTOCREATE if (r) { prot_printf(imapd_out, ""%s NO %s\r\n"", tag, error_message(r)); goto done; } // (r) #endif // USE_AUTOCREATE if (specialuse.len) { r = annotatemore_write(mbname_intname(mbname), ""/specialuse"", mbname_userid(mbname), &specialuse); if (r) { /* XXX - failure here SHOULD cause a cleanup of the created mailbox */ syslog( LOG_ERR, ""IOERROR: failed to write specialuse for %s on %s (%s) (%s:%d)"", imapd_userid, mbname_intname(mbname), buf_cstring(&specialuse), __FILE__, __LINE__ ); prot_printf(imapd_out, ""%s NO %s (%s:%d)\r\n"", tag, error_message(r), __FILE__, __LINE__); goto done; } } prot_printf(imapd_out, ""%s OK Completed\r\n"", tag); imapd_check(NULL, 0); done: buf_free(&specialuse); mbname_free(&mbname); } ",0 "void WebMediaPlayerImpl::EnteredFullscreen() { overlay_info_.is_fullscreen = true; if (!always_enable_overlays_ && overlay_mode_ != OverlayMode::kNoOverlays && DoesOverlaySupportMetadata()) { EnableOverlay(); } if (!decoder_requires_restart_for_overlay_) MaybeSendOverlayInfoToDecoder(); } ",0 " static void CopyElementsImpl(FixedArrayBase* from, uint32_t from_start, FixedArrayBase* to, ElementsKind from_kind, uint32_t to_start, int packed_size, int copy_size) { DCHECK(!to->IsDictionary()); if (from_kind == SLOW_STRING_WRAPPER_ELEMENTS) { CopyDictionaryToObjectElements(from, from_start, to, FAST_HOLEY_ELEMENTS, to_start, copy_size); } else { DCHECK_EQ(FAST_STRING_WRAPPER_ELEMENTS, from_kind); CopyObjectToObjectElements(from, FAST_HOLEY_ELEMENTS, from_start, to, FAST_HOLEY_ELEMENTS, to_start, copy_size); } } ",0 "inline void Splash::drawAAPixel(SplashPipe *pipe, int x, int y) { #if splashAASize == 4 static int bitCount4[16] = { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4 }; int w; #else int xx, yy; #endif SplashColorPtr p; int x0, x1, t; if (x < 0 || x >= bitmap->width || y < state->clip->getYMinI() || y > state->clip->getYMaxI()) { return; } if (y != aaBufY) { memset(aaBuf->getDataPtr(), 0xff, aaBuf->getRowSize() * aaBuf->getHeight()); x0 = 0; x1 = bitmap->width - 1; state->clip->clipAALine(aaBuf, &x0, &x1, y); aaBufY = y; } #if splashAASize == 4 p = aaBuf->getDataPtr() + (x >> 1); w = aaBuf->getRowSize(); if (x & 1) { t = bitCount4[*p & 0x0f] + bitCount4[p[w] & 0x0f] + bitCount4[p[2*w] & 0x0f] + bitCount4[p[3*w] & 0x0f]; } else { t = bitCount4[*p >> 4] + bitCount4[p[w] >> 4] + bitCount4[p[2*w] >> 4] + bitCount4[p[3*w] >> 4]; } #else t = 0; for (yy = 0; yy < splashAASize; ++yy) { for (xx = 0; xx < splashAASize; ++xx) { p = aaBuf->getDataPtr() + yy * aaBuf->getRowSize() + ((x * splashAASize + xx) >> 3); t += (*p >> (7 - ((x * splashAASize + xx) & 7))) & 1; } } #endif if (t != 0) { pipeSetXY(pipe, x, y); pipe->shape = div255(aaGamma[t] * pipe->shape); (this->*pipe->run)(pipe); updateModX(x); updateModY(y); } } ",0 "static int ip_error(struct sk_buff *skb) { struct in_device *in_dev = __in_dev_get_rcu(skb->dev); struct rtable *rt = skb_rtable(skb); struct inet_peer *peer; unsigned long now; struct net *net; bool send; int code; /* IP on this device is disabled. */ if (!in_dev) goto out; net = dev_net(rt->dst.dev); if (!IN_DEV_FORWARD(in_dev)) { switch (rt->dst.error) { case EHOSTUNREACH: IP_INC_STATS_BH(net, IPSTATS_MIB_INADDRERRORS); break; case ENETUNREACH: IP_INC_STATS_BH(net, IPSTATS_MIB_INNOROUTES); break; } goto out; } switch (rt->dst.error) { case EINVAL: default: goto out; case EHOSTUNREACH: code = ICMP_HOST_UNREACH; break; case ENETUNREACH: code = ICMP_NET_UNREACH; IP_INC_STATS_BH(net, IPSTATS_MIB_INNOROUTES); break; case EACCES: code = ICMP_PKT_FILTERED; break; } peer = inet_getpeer_v4(net->ipv4.peers, ip_hdr(skb)->saddr, 1); send = true; if (peer) { now = jiffies; peer->rate_tokens += now - peer->rate_last; if (peer->rate_tokens > ip_rt_error_burst) peer->rate_tokens = ip_rt_error_burst; peer->rate_last = now; if (peer->rate_tokens >= ip_rt_error_cost) peer->rate_tokens -= ip_rt_error_cost; else send = false; inet_putpeer(peer); } if (send) icmp_send(skb, ICMP_DEST_UNREACH, code, 0); out: kfree_skb(skb); return 0; } ",0 "void SoftG711::onQueueFilled(OMX_U32 /* portIndex */) { if (mSignalledError) { return; } List &inQueue = getPortQueue(0); List &outQueue = getPortQueue(1); while (!inQueue.empty() && !outQueue.empty()) { BufferInfo *inInfo = *inQueue.begin(); OMX_BUFFERHEADERTYPE *inHeader = inInfo->mHeader; BufferInfo *outInfo = *outQueue.begin(); OMX_BUFFERHEADERTYPE *outHeader = outInfo->mHeader; if (inHeader->nFlags & OMX_BUFFERFLAG_EOS) { inQueue.erase(inQueue.begin()); inInfo->mOwnedByUs = false; notifyEmptyBufferDone(inHeader); outHeader->nFilledLen = 0; outHeader->nFlags = OMX_BUFFERFLAG_EOS; outQueue.erase(outQueue.begin()); outInfo->mOwnedByUs = false; notifyFillBufferDone(outHeader); return; } if (inHeader->nFilledLen > kMaxNumSamplesPerFrame) { ALOGE(""input buffer too large (%d)."", inHeader->nFilledLen); notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL); mSignalledError = true; } const uint8_t *inputptr = inHeader->pBuffer + inHeader->nOffset; if (mIsMLaw) { DecodeMLaw( reinterpret_cast(outHeader->pBuffer), inputptr, inHeader->nFilledLen); } else { DecodeALaw( reinterpret_cast(outHeader->pBuffer), inputptr, inHeader->nFilledLen); } outHeader->nTimeStamp = inHeader->nTimeStamp; outHeader->nOffset = 0; outHeader->nFilledLen = inHeader->nFilledLen * sizeof(int16_t); outHeader->nFlags = 0; inInfo->mOwnedByUs = false; inQueue.erase(inQueue.begin()); inInfo = NULL; notifyEmptyBufferDone(inHeader); inHeader = NULL; outInfo->mOwnedByUs = false; outQueue.erase(outQueue.begin()); outInfo = NULL; notifyFillBufferDone(outHeader); outHeader = NULL; } } ",1 " void FillAutofillFormDataAndSaveResults(int input_query_id, const FormData& input_form, const FormFieldData& input_field, int unique_id, int* response_query_id, FormData* response_data) { EXPECT_CALL(*autofill_driver_, SendFormDataToRenderer(_, _, _)) .WillOnce((DoAll(testing::SaveArg<0>(response_query_id), testing::SaveArg<2>(response_data)))); FillAutofillFormData(input_query_id, input_form, input_field, unique_id); } ",0 "BrowserPluginGuest::BrowserPluginGuest( int instance_id, WebContentsImpl* web_contents, const BrowserPluginHostMsg_CreateGuest_Params& params) : WebContentsObserver(web_contents), embedder_web_contents_(NULL), instance_id_(instance_id), #if defined(OS_WIN) damage_buffer_size_(0), remote_damage_buffer_handle_(0), #endif damage_buffer_scale_factor_(1.0f), pending_update_counter_(0), guest_hang_timeout_( base::TimeDelta::FromMilliseconds(kGuestHangTimeoutMs)), focused_(params.focused), visible_(params.visible), auto_size_enabled_(params.auto_size_params.enable), max_auto_size_(params.auto_size_params.max_size), min_auto_size_(params.auto_size_params.min_size) { DCHECK(web_contents); } ",0 "GF_Err asrt_dump(GF_Box *a, FILE * trace) { u32 i; GF_AdobeSegmentRunTableBox *p = (GF_AdobeSegmentRunTableBox*)a; gf_isom_box_dump_start(a, ""AdobeSegmentRunTableBox"", trace); fprintf(trace, "">\n""); for (i=0; iquality_entry_count; i++) { char *str = (char*)gf_list_get(p->quality_segment_url_modifiers, i); fprintf(trace, ""%s\n"", str); } for (i=0; isegment_run_entry_count; i++) { GF_AdobeSegmentRunEntry *sre = (GF_AdobeSegmentRunEntry *)gf_list_get(p->segment_run_entry_table, i); fprintf(trace, ""\n"", sre->first_segment, sre->fragment_per_segment); } gf_isom_box_dump_done(""AdobeSegmentRunTableBox"", a, trace); return GF_OK; } ",0 "NO_INLINE JsVar *jspeArrowFunction(JsVar *funcVar, JsVar *a) { assert(!a || jsvIsName(a)); JSP_ASSERT_MATCH(LEX_ARROW_FUNCTION); funcVar = jspeAddNamedFunctionParameter(funcVar, a); bool expressionOnly = lex->tk!='{'; jspeFunctionDefinitionInternal(funcVar, expressionOnly); if (execInfo.thisVar) { jsvObjectSetChild(funcVar, JSPARSE_FUNCTION_THIS_NAME, execInfo.thisVar); } return funcVar; } NO_INLINE JsVar *jspeExpressionOrArrowFunction() { JsVar *a = 0; JsVar *funcVar = 0; bool allNames = true; while (lex->tk!=')' && !JSP_SHOULDNT_PARSE) { if (allNames && a) { funcVar = jspeAddNamedFunctionParameter(funcVar, a); } jsvUnLock(a); a = jspeAssignmentExpression(); if (!(jsvIsName(a) && jsvIsString(a))) allNames = false; if (lex->tk!=')') JSP_MATCH_WITH_CLEANUP_AND_RETURN(',', jsvUnLock2(a,funcVar), 0); } JSP_MATCH_WITH_CLEANUP_AND_RETURN(')', jsvUnLock2(a,funcVar), 0); if (allNames && lex->tk==LEX_ARROW_FUNCTION) { funcVar = jspeArrowFunction(funcVar, a); jsvUnLock(a); return funcVar; } else { jsvUnLock(funcVar); return a; } } NO_INLINE JsVar *jspeClassDefinition(bool parseNamedClass) { JsVar *classFunction = 0; JsVar *classPrototype = 0; JsVar *classInternalName = 0; bool actuallyCreateClass = JSP_SHOULD_EXECUTE; if (actuallyCreateClass) classFunction = jsvNewWithFlags(JSV_FUNCTION); if (parseNamedClass && lex->tk==LEX_ID) { if (classFunction) classInternalName = jslGetTokenValueAsVar(lex); JSP_ASSERT_MATCH(LEX_ID); } if (classFunction) { JsVar *prototypeName = jsvFindChildFromString(classFunction, JSPARSE_PROTOTYPE_VAR, true); jspEnsureIsPrototype(classFunction, prototypeName); // make sure it's an object classPrototype = jsvSkipName(prototypeName); jsvUnLock(prototypeName); } if (lex->tk==LEX_R_EXTENDS) { JSP_ASSERT_MATCH(LEX_R_EXTENDS); JsVar *extendsFrom = actuallyCreateClass ? jsvSkipNameAndUnLock(jspGetNamedVariable(jslGetTokenValueAsString(lex))) : 0; JSP_MATCH_WITH_CLEANUP_AND_RETURN(LEX_ID,jsvUnLock4(extendsFrom,classFunction,classInternalName,classPrototype),0); if (classPrototype) { if (jsvIsFunction(extendsFrom)) { jsvObjectSetChild(classPrototype, JSPARSE_INHERITS_VAR, extendsFrom); jsvObjectSetChildAndUnLock(classFunction, JSPARSE_FUNCTION_CODE_NAME, jsvNewFromString(""if(this.__proto__.__proto__)this.__proto__.__proto__.apply(this,arguments)"")); } else jsExceptionHere(JSET_SYNTAXERROR, ""'extends' argument should be a function, got %t"", extendsFrom); } jsvUnLock(extendsFrom); } JSP_MATCH_WITH_CLEANUP_AND_RETURN('{',jsvUnLock3(classFunction,classInternalName,classPrototype),0); while ((lex->tk==LEX_ID || lex->tk==LEX_R_STATIC) && !jspIsInterrupted()) { bool isStatic = lex->tk==LEX_R_STATIC; if (isStatic) JSP_ASSERT_MATCH(LEX_R_STATIC); JsVar *funcName = jslGetTokenValueAsVar(lex); JSP_MATCH_WITH_CLEANUP_AND_RETURN(LEX_ID,jsvUnLock4(funcName,classFunction,classInternalName,classPrototype),0); #ifndef SAVE_ON_FLASH bool isGetter, isSetter; if (lex->tk==LEX_ID) { isGetter = jsvIsStringEqual(funcName, ""get""); isSetter = jsvIsStringEqual(funcName, ""set""); if (isGetter || isSetter) { jsvUnLock(funcName); funcName = jslGetTokenValueAsVar(lex); JSP_ASSERT_MATCH(LEX_ID); } } #endif JsVar *method = jspeFunctionDefinition(false); if (classFunction && classPrototype) { JsVar *obj = isStatic ? classFunction : classPrototype; if (jsvIsStringEqual(funcName, ""constructor"")) { jswrap_function_replaceWith(classFunction, method); #ifndef SAVE_ON_FLASH } else if (isGetter || isSetter) { jsvAddGetterOrSetter(obj, funcName, isGetter, method); #endif } else { funcName = jsvMakeIntoVariableName(funcName, 0); jsvSetValueOfName(funcName, method); jsvAddName(obj, funcName); } } jsvUnLock2(method,funcName); } jsvUnLock(classPrototype); if (classInternalName) jsvObjectSetChildAndUnLock(classFunction, JSPARSE_FUNCTION_NAME_NAME, classInternalName); JSP_MATCH_WITH_CLEANUP_AND_RETURN('}',jsvUnLock(classFunction),0); return classFunction; } #endif NO_INLINE JsVar *jspeFactor() { if (lex->tk==LEX_ID) { JsVar *a = jspGetNamedVariable(jslGetTokenValueAsString(lex)); JSP_ASSERT_MATCH(LEX_ID); #ifndef SAVE_ON_FLASH if (lex->tk==LEX_TEMPLATE_LITERAL) jsExceptionHere(JSET_SYNTAXERROR, ""Tagged template literals not supported""); else if (lex->tk==LEX_ARROW_FUNCTION && jsvIsName(a)) { JsVar *funcVar = jspeArrowFunction(0,a); jsvUnLock(a); a=funcVar; } #endif return a; } else if (lex->tk==LEX_INT) { JsVar *v = 0; if (JSP_SHOULD_EXECUTE) { v = jsvNewFromLongInteger(stringToInt(jslGetTokenValueAsString(lex))); } JSP_ASSERT_MATCH(LEX_INT); return v; } else if (lex->tk==LEX_FLOAT) { JsVar *v = 0; if (JSP_SHOULD_EXECUTE) { v = jsvNewFromFloat(stringToFloat(jslGetTokenValueAsString(lex))); } JSP_ASSERT_MATCH(LEX_FLOAT); return v; } else if (lex->tk=='(') { JSP_ASSERT_MATCH('('); if (!jspCheckStackPosition()) return 0; #ifdef SAVE_ON_FLASH JsVar *a = jspeExpression(); if (!JSP_SHOULDNT_PARSE) JSP_MATCH_WITH_RETURN(')',a); return a; #else return jspeExpressionOrArrowFunction(); #endif } else if (lex->tk==LEX_R_TRUE) { JSP_ASSERT_MATCH(LEX_R_TRUE); return JSP_SHOULD_EXECUTE ? jsvNewFromBool(true) : 0; } else if (lex->tk==LEX_R_FALSE) { JSP_ASSERT_MATCH(LEX_R_FALSE); return JSP_SHOULD_EXECUTE ? jsvNewFromBool(false) : 0; } else if (lex->tk==LEX_R_NULL) { JSP_ASSERT_MATCH(LEX_R_NULL); return JSP_SHOULD_EXECUTE ? jsvNewWithFlags(JSV_NULL) : 0; } else if (lex->tk==LEX_R_UNDEFINED) { JSP_ASSERT_MATCH(LEX_R_UNDEFINED); return 0; } else if (lex->tk==LEX_STR) { JsVar *a = 0; if (JSP_SHOULD_EXECUTE) a = jslGetTokenValueAsVar(lex); JSP_ASSERT_MATCH(LEX_STR); return a; #ifndef SAVE_ON_FLASH } else if (lex->tk==LEX_TEMPLATE_LITERAL) { return jspeTemplateLiteral(); #endif } else if (lex->tk==LEX_REGEX) { JsVar *a = 0; #ifdef SAVE_ON_FLASH jsExceptionHere(JSET_SYNTAXERROR, ""RegEx are not supported in this version of Espruino\n""); #else JsVar *regex = jslGetTokenValueAsVar(lex); size_t regexEnd = 0, regexLen = 0; JsvStringIterator it; jsvStringIteratorNew(&it, regex, 0); while (jsvStringIteratorHasChar(&it)) { regexLen++; if (jsvStringIteratorGetChar(&it)=='/') regexEnd = regexLen; jsvStringIteratorNext(&it); } jsvStringIteratorFree(&it); JsVar *flags = 0; if (regexEnd < regexLen) flags = jsvNewFromStringVar(regex, regexEnd, JSVAPPENDSTRINGVAR_MAXLENGTH); JsVar *regexSource = jsvNewFromStringVar(regex, 1, regexEnd-2); a = jswrap_regexp_constructor(regexSource, flags); jsvUnLock3(regex, flags, regexSource); #endif JSP_ASSERT_MATCH(LEX_REGEX); return a; } else if (lex->tk=='{') { if (!jspCheckStackPosition()) return 0; return jspeFactorObject(); } else if (lex->tk=='[') { if (!jspCheckStackPosition()) return 0; return jspeFactorArray(); } else if (lex->tk==LEX_R_FUNCTION) { if (!jspCheckStackPosition()) return 0; JSP_ASSERT_MATCH(LEX_R_FUNCTION); return jspeFunctionDefinition(true); #ifndef SAVE_ON_FLASH } else if (lex->tk==LEX_R_CLASS) { if (!jspCheckStackPosition()) return 0; JSP_ASSERT_MATCH(LEX_R_CLASS); return jspeClassDefinition(true); } else if (lex->tk==LEX_R_SUPER) { JSP_ASSERT_MATCH(LEX_R_SUPER); /* This is kind of nasty, since super appears to do three different things. * In the constructor it references the extended class's constructor * in a method it references the constructor's prototype. * in a static method it references the extended class's constructor (but this is different) */ if (jsvIsObject(execInfo.thisVar)) { JsVar *proto1 = jsvObjectGetChild(execInfo.thisVar, JSPARSE_INHERITS_VAR, 0); // if we're in a method, get __proto__ first JsVar *proto2 = jsvIsObject(proto1) ? jsvObjectGetChild(proto1, JSPARSE_INHERITS_VAR, 0) : 0; // still in method, get __proto__.__proto__ jsvUnLock(proto1); if (!proto2) { jsExceptionHere(JSET_SYNTAXERROR, ""Calling 'super' outside of class""); return 0; } if (lex->tk=='(') return proto2; // eg. used in a constructor JsVar *proto3 = jsvIsFunction(proto2) ? jsvObjectGetChild(proto2, JSPARSE_PROTOTYPE_VAR, 0) : 0; jsvUnLock(proto2); return proto3; } else if (jsvIsFunction(execInfo.thisVar)) { JsVar *proto1 = jsvObjectGetChild(execInfo.thisVar, JSPARSE_PROTOTYPE_VAR, 0); JsVar *proto2 = jsvIsObject(proto1) ? jsvObjectGetChild(proto1, JSPARSE_INHERITS_VAR, 0) : 0; jsvUnLock(proto1); if (!proto2) { jsExceptionHere(JSET_SYNTAXERROR, ""Calling 'super' outside of class""); return 0; } return proto2; } jsExceptionHere(JSET_SYNTAXERROR, ""Calling 'super' outside of class""); return 0; #endif } else if (lex->tk==LEX_R_THIS) { JSP_ASSERT_MATCH(LEX_R_THIS); return jsvLockAgain( execInfo.thisVar ? execInfo.thisVar : execInfo.root ); } else if (lex->tk==LEX_R_DELETE) { if (!jspCheckStackPosition()) return 0; return jspeFactorDelete(); } else if (lex->tk==LEX_R_TYPEOF) { if (!jspCheckStackPosition()) return 0; return jspeFactorTypeOf(); } else if (lex->tk==LEX_R_VOID) { if (!jspCheckStackPosition()) return 0; JSP_ASSERT_MATCH(LEX_R_VOID); jsvUnLock(jspeUnaryExpression()); return 0; } JSP_MATCH(LEX_EOF); jsExceptionHere(JSET_SYNTAXERROR, ""Unexpected end of Input\n""); return 0; } NO_INLINE JsVar *__jspePostfixExpression(JsVar *a) { while (lex->tk==LEX_PLUSPLUS || lex->tk==LEX_MINUSMINUS) { int op = lex->tk; JSP_ASSERT_MATCH(op); if (JSP_SHOULD_EXECUTE) { JsVar *one = jsvNewFromInteger(1); JsVar *oldValue = jsvAsNumberAndUnLock(jsvSkipName(a)); // keep the old value (but convert to number) JsVar *res = jsvMathsOpSkipNames(oldValue, one, op==LEX_PLUSPLUS ? '+' : '-'); jsvUnLock(one); jsvReplaceWith(a, res); jsvUnLock(res); jsvUnLock(a); a = oldValue; } } return a; } NO_INLINE JsVar *jspePostfixExpression() { JsVar *a; if (lex->tk==LEX_PLUSPLUS || lex->tk==LEX_MINUSMINUS) { int op = lex->tk; JSP_ASSERT_MATCH(op); a = jspePostfixExpression(); if (JSP_SHOULD_EXECUTE) { JsVar *one = jsvNewFromInteger(1); JsVar *res = jsvMathsOpSkipNames(a, one, op==LEX_PLUSPLUS ? '+' : '-'); jsvUnLock(one); jsvReplaceWith(a, res); jsvUnLock(res); } } else a = jspeFactorFunctionCall(); return __jspePostfixExpression(a); } NO_INLINE JsVar *jspeUnaryExpression() { if (lex->tk=='!' || lex->tk=='~' || lex->tk=='-' || lex->tk=='+') { short tk = lex->tk; JSP_ASSERT_MATCH(tk); if (!JSP_SHOULD_EXECUTE) { return jspeUnaryExpression(); } if (tk=='!') { // logical not return jsvNewFromBool(!jsvGetBoolAndUnLock(jsvSkipNameAndUnLock(jspeUnaryExpression()))); } else if (tk=='~') { // bitwise not return jsvNewFromInteger(~jsvGetIntegerAndUnLock(jsvSkipNameAndUnLock(jspeUnaryExpression()))); } else if (tk=='-') { // unary minus return jsvNegateAndUnLock(jspeUnaryExpression()); // names already skipped } else if (tk=='+') { // unary plus (convert to number) JsVar *v = jsvSkipNameAndUnLock(jspeUnaryExpression()); JsVar *r = jsvAsNumber(v); // names already skipped jsvUnLock(v); return r; } assert(0); return 0; } else return jspePostfixExpression(); } unsigned int jspeGetBinaryExpressionPrecedence(int op) { switch (op) { case LEX_OROR: return 1; break; case LEX_ANDAND: return 2; break; case '|' : return 3; break; case '^' : return 4; break; case '&' : return 5; break; case LEX_EQUAL: case LEX_NEQUAL: case LEX_TYPEEQUAL: case LEX_NTYPEEQUAL: return 6; case LEX_LEQUAL: case LEX_GEQUAL: case '<': case '>': case LEX_R_INSTANCEOF: return 7; case LEX_R_IN: return (execInfo.execute&EXEC_FOR_INIT)?0:7; case LEX_LSHIFT: case LEX_RSHIFT: case LEX_RSHIFTUNSIGNED: return 8; case '+': case '-': return 9; case '*': case '/': case '%': return 10; default: return 0; } } NO_INLINE JsVar *__jspeBinaryExpression(JsVar *a, unsigned int lastPrecedence) { /* This one's a bit strange. Basically all the ops have their own precedence, it's not * like & and | share the same precedence. We don't want to recurse for each one, * so instead we do this. * * We deal with an expression in recursion ONLY if it's of higher precedence * than the current one, otherwise we stick in the while loop. */ unsigned int precedence = jspeGetBinaryExpressionPrecedence(lex->tk); while (precedence && precedence>lastPrecedence) { int op = lex->tk; JSP_ASSERT_MATCH(op); if (op==LEX_ANDAND || op==LEX_OROR) { bool aValue = jsvGetBoolAndUnLock(jsvSkipName(a)); if ((!aValue && op==LEX_ANDAND) || (aValue && op==LEX_OROR)) { JSP_SAVE_EXECUTE(); jspSetNoExecute(); jsvUnLock(__jspeBinaryExpression(jspeUnaryExpression(),precedence)); JSP_RESTORE_EXECUTE(); } else { jsvUnLock(a); a = __jspeBinaryExpression(jspeUnaryExpression(),precedence); } } else { // else it's a more 'normal' logical expression - just use Maths JsVar *b = __jspeBinaryExpression(jspeUnaryExpression(),precedence); if (JSP_SHOULD_EXECUTE) { if (op==LEX_R_IN) { JsVar *av = jsvSkipName(a); // needle JsVar *bv = jsvSkipName(b); // haystack if (jsvIsArray(bv) || jsvIsObject(bv)) { // search keys, NOT values av = jsvAsArrayIndexAndUnLock(av); JsVar *varFound = jspGetVarNamedField( bv, av, true); jsvUnLock(a); a = jsvNewFromBool(varFound!=0); jsvUnLock(varFound); } else {// else it will be undefined jsExceptionHere(JSET_ERROR, ""Cannot use 'in' operator to search a %t"", bv); jsvUnLock(a); a = 0; } jsvUnLock2(av, bv); } else if (op==LEX_R_INSTANCEOF) { bool inst = false; JsVar *av = jsvSkipName(a); JsVar *bv = jsvSkipName(b); if (!jsvIsFunction(bv)) { jsExceptionHere(JSET_ERROR, ""Expecting a function on RHS in instanceof check, got %t"", bv); } else { if (jsvIsObject(av) || jsvIsFunction(av)) { JsVar *bproto = jspGetNamedField(bv, JSPARSE_PROTOTYPE_VAR, false); JsVar *proto = jsvObjectGetChild(av, JSPARSE_INHERITS_VAR, 0); while (proto) { if (proto == bproto) inst=true; JsVar *childProto = jsvObjectGetChild(proto, JSPARSE_INHERITS_VAR, 0); jsvUnLock(proto); proto = childProto; } if (jspIsConstructor(bv, ""Object"")) inst = true; jsvUnLock(bproto); } if (!inst) { const char *name = jswGetBasicObjectName(av); if (name) { inst = jspIsConstructor(bv, name); } if (!inst && (jsvIsArray(av) || jsvIsArrayBuffer(av)) && jspIsConstructor(bv, ""Object"")) inst = true; } } jsvUnLock3(av, bv, a); a = jsvNewFromBool(inst); } else { // --------------------------------------------- NORMAL JsVar *res = jsvMathsOpSkipNames(a, b, op); jsvUnLock(a); a = res; } } jsvUnLock(b); } precedence = jspeGetBinaryExpressionPrecedence(lex->tk); } return a; } JsVar *jspeBinaryExpression() { return __jspeBinaryExpression(jspeUnaryExpression(),0); } NO_INLINE JsVar *__jspeConditionalExpression(JsVar *lhs) { if (lex->tk=='?') { JSP_ASSERT_MATCH('?'); if (!JSP_SHOULD_EXECUTE) { jsvUnLock(jspeAssignmentExpression()); JSP_MATCH(':'); jsvUnLock(jspeAssignmentExpression()); } else { bool first = jsvGetBoolAndUnLock(jsvSkipName(lhs)); jsvUnLock(lhs); if (first) { lhs = jspeAssignmentExpression(); JSP_MATCH(':'); JSP_SAVE_EXECUTE(); jspSetNoExecute(); jsvUnLock(jspeAssignmentExpression()); JSP_RESTORE_EXECUTE(); } else { JSP_SAVE_EXECUTE(); jspSetNoExecute(); jsvUnLock(jspeAssignmentExpression()); JSP_RESTORE_EXECUTE(); JSP_MATCH(':'); lhs = jspeAssignmentExpression(); } } } return lhs; } JsVar *jspeConditionalExpression() { return __jspeConditionalExpression(jspeBinaryExpression()); } NO_INLINE JsVar *__jspeAssignmentExpression(JsVar *lhs) { if (lex->tk=='=' || lex->tk==LEX_PLUSEQUAL || lex->tk==LEX_MINUSEQUAL || lex->tk==LEX_MULEQUAL || lex->tk==LEX_DIVEQUAL || lex->tk==LEX_MODEQUAL || lex->tk==LEX_ANDEQUAL || lex->tk==LEX_OREQUAL || lex->tk==LEX_XOREQUAL || lex->tk==LEX_RSHIFTEQUAL || lex->tk==LEX_LSHIFTEQUAL || lex->tk==LEX_RSHIFTUNSIGNEDEQUAL) { JsVar *rhs; int op = lex->tk; JSP_ASSERT_MATCH(op); rhs = jspeAssignmentExpression(); rhs = jsvSkipNameAndUnLock(rhs); // ensure we get rid of any references on the RHS if (JSP_SHOULD_EXECUTE && lhs) { if (op=='=') { jsvReplaceWithOrAddToRoot(lhs, rhs); } else { if (op==LEX_PLUSEQUAL) op='+'; else if (op==LEX_MINUSEQUAL) op='-'; else if (op==LEX_MULEQUAL) op='*'; else if (op==LEX_DIVEQUAL) op='/'; else if (op==LEX_MODEQUAL) op='%'; else if (op==LEX_ANDEQUAL) op='&'; else if (op==LEX_OREQUAL) op='|'; else if (op==LEX_XOREQUAL) op='^'; else if (op==LEX_RSHIFTEQUAL) op=LEX_RSHIFT; else if (op==LEX_LSHIFTEQUAL) op=LEX_LSHIFT; else if (op==LEX_RSHIFTUNSIGNEDEQUAL) op=LEX_RSHIFTUNSIGNED; if (op=='+' && jsvIsName(lhs)) { JsVar *currentValue = jsvSkipName(lhs); if (jsvIsString(currentValue) && !jsvIsFlatString(currentValue) && jsvGetRefs(currentValue)==1 && rhs!=currentValue) { /* A special case for string += where this is the only use of the string * and we're not appending to ourselves. In this case we can do a * simple append (rather than clone + append)*/ JsVar *str = jsvAsString(rhs, false); jsvAppendStringVarComplete(currentValue, str); jsvUnLock(str); op = 0; } jsvUnLock(currentValue); } if (op) { /* Fallback which does a proper add */ JsVar *res = jsvMathsOpSkipNames(lhs,rhs,op); jsvReplaceWith(lhs, res); jsvUnLock(res); } } } jsvUnLock(rhs); } return lhs; } JsVar *jspeAssignmentExpression() { return __jspeAssignmentExpression(jspeConditionalExpression()); } NO_INLINE JsVar *jspeExpression() { while (!JSP_SHOULDNT_PARSE) { JsVar *a = jspeAssignmentExpression(); if (lex->tk!=',') return a; jsvCheckReferenceError(a); jsvUnLock(a); JSP_ASSERT_MATCH(','); } return 0; } /** Parse a block `{ ... }` */ NO_INLINE void jspeSkipBlock() { int brackets = 1; while (lex->tk && brackets) { if (lex->tk == '{') brackets++; else if (lex->tk == '}') { brackets--; if (!brackets) return; } JSP_ASSERT_MATCH(lex->tk); } } /** Parse a block `{ ... }` but assume brackets are already parsed */ NO_INLINE void jspeBlockNoBrackets() { if (JSP_SHOULD_EXECUTE) { while (lex->tk && lex->tk!='}') { JsVar *a = jspeStatement(); jsvCheckReferenceError(a); jsvUnLock(a); if (JSP_HAS_ERROR) { if (lex && !(execInfo.execute&EXEC_ERROR_LINE_REPORTED)) { execInfo.execute = (JsExecFlags)(execInfo.execute | EXEC_ERROR_LINE_REPORTED); JsVar *stackTrace = jsvObjectGetChild(execInfo.hiddenRoot, JSPARSE_STACKTRACE_VAR, JSV_STRING_0); if (stackTrace) { jsvAppendPrintf(stackTrace, ""at ""); jspAppendStackTrace(stackTrace); jsvUnLock(stackTrace); } } } if (JSP_SHOULDNT_PARSE) return; if (!JSP_SHOULD_EXECUTE) { jspeSkipBlock(); return; } } } else { jspeSkipBlock(); } return; } /** Parse a block `{ ... }` */ NO_INLINE void jspeBlock() { JSP_MATCH_WITH_RETURN('{',); jspeBlockNoBrackets(); if (!JSP_SHOULDNT_PARSE) JSP_MATCH_WITH_RETURN('}',); return; } NO_INLINE JsVar *jspeBlockOrStatement() { if (lex->tk=='{') { jspeBlock(); return 0; } else { JsVar *v = jspeStatement(); if (lex->tk==';') JSP_ASSERT_MATCH(';'); return v; } } /** Parse using current lexer until we hit the end of * input or there was some problem. */ NO_INLINE JsVar *jspParse() { JsVar *v = 0; while (!JSP_SHOULDNT_PARSE && lex->tk != LEX_EOF) { jsvUnLock(v); v = jspeBlockOrStatement(); } return v; } NO_INLINE JsVar *jspeStatementVar() { JsVar *lastDefined = 0; /* variable creation. TODO - we need a better way of parsing the left * hand side. Maybe just have a flag called can_create_var that we * set and then we parse as if we're doing a normal equals.*/ assert(lex->tk==LEX_R_VAR || lex->tk==LEX_R_LET || lex->tk==LEX_R_CONST); jslGetNextToken(); bool hasComma = true; // for first time in loop while (hasComma && lex->tk == LEX_ID && !jspIsInterrupted()) { JsVar *a = 0; if (JSP_SHOULD_EXECUTE) { a = jspeiFindOnTop(jslGetTokenValueAsString(lex), true); if (!a) { // out of memory jspSetError(false); return lastDefined; } } JSP_MATCH_WITH_CLEANUP_AND_RETURN(LEX_ID, jsvUnLock(a), lastDefined); if (lex->tk == '=') { JsVar *var; JSP_MATCH_WITH_CLEANUP_AND_RETURN('=', jsvUnLock(a), lastDefined); var = jsvSkipNameAndUnLock(jspeAssignmentExpression()); if (JSP_SHOULD_EXECUTE) jsvReplaceWith(a, var); jsvUnLock(var); } jsvUnLock(lastDefined); lastDefined = a; hasComma = lex->tk == ','; if (hasComma) JSP_MATCH_WITH_RETURN(',', lastDefined); } return lastDefined; } NO_INLINE JsVar *jspeStatementIf() { bool cond; JsVar *var, *result = 0; JSP_ASSERT_MATCH(LEX_R_IF); JSP_MATCH('('); var = jspeExpression(); if (JSP_SHOULDNT_PARSE) return var; JSP_MATCH(')'); cond = JSP_SHOULD_EXECUTE && jsvGetBoolAndUnLock(jsvSkipName(var)); jsvUnLock(var); JSP_SAVE_EXECUTE(); if (!cond) jspSetNoExecute(); JsVar *a = jspeBlockOrStatement(); if (!cond) { jsvUnLock(a); JSP_RESTORE_EXECUTE(); } else { result = a; } if (lex->tk==LEX_R_ELSE) { JSP_ASSERT_MATCH(LEX_R_ELSE); JSP_SAVE_EXECUTE(); if (cond) jspSetNoExecute(); JsVar *a = jspeBlockOrStatement(); if (cond) { jsvUnLock(a); JSP_RESTORE_EXECUTE(); } else { result = a; } } return result; } NO_INLINE JsVar *jspeStatementSwitch() { JSP_ASSERT_MATCH(LEX_R_SWITCH); JSP_MATCH('('); JsVar *switchOn = jspeExpression(); JSP_SAVE_EXECUTE(); bool execute = JSP_SHOULD_EXECUTE; JSP_MATCH_WITH_CLEANUP_AND_RETURN(')', jsvUnLock(switchOn), 0); if (!execute) { jsvUnLock(switchOn); jspeBlock(); return 0; } JSP_MATCH_WITH_CLEANUP_AND_RETURN('{', jsvUnLock(switchOn), 0); bool executeDefault = true; if (execute) execInfo.execute=EXEC_NO|EXEC_IN_SWITCH; while (lex->tk==LEX_R_CASE) { JSP_MATCH_WITH_CLEANUP_AND_RETURN(LEX_R_CASE, jsvUnLock(switchOn), 0); JsExecFlags oldFlags = execInfo.execute; if (execute) execInfo.execute=EXEC_YES|EXEC_IN_SWITCH; JsVar *test = jspeAssignmentExpression(); execInfo.execute = oldFlags|EXEC_IN_SWITCH;; JSP_MATCH_WITH_CLEANUP_AND_RETURN(':', jsvUnLock2(switchOn, test), 0); bool cond = false; if (execute) cond = jsvGetBoolAndUnLock(jsvMathsOpSkipNames(switchOn, test, LEX_TYPEEQUAL)); if (cond) executeDefault = false; jsvUnLock(test); if (cond && (execInfo.execute&EXEC_RUN_MASK)==EXEC_NO) execInfo.execute=EXEC_YES|EXEC_IN_SWITCH; while (!JSP_SHOULDNT_PARSE && lex->tk!=LEX_EOF && lex->tk!=LEX_R_CASE && lex->tk!=LEX_R_DEFAULT && lex->tk!='}') jsvUnLock(jspeBlockOrStatement()); oldExecute |= execInfo.execute & (EXEC_ERROR_MASK|EXEC_RETURN); // copy across any errors/exceptions/returns } jsvUnLock(switchOn); if (execute && (execInfo.execute&EXEC_RUN_MASK)==EXEC_BREAK) { execInfo.execute=EXEC_YES|EXEC_IN_SWITCH; } else { executeDefault = true; } JSP_RESTORE_EXECUTE(); if (lex->tk==LEX_R_DEFAULT) { JSP_ASSERT_MATCH(LEX_R_DEFAULT); JSP_MATCH(':'); JSP_SAVE_EXECUTE(); if (!executeDefault) jspSetNoExecute(); else execInfo.execute |= EXEC_IN_SWITCH; while (!JSP_SHOULDNT_PARSE && lex->tk!=LEX_EOF && lex->tk!='}') jsvUnLock(jspeBlockOrStatement()); oldExecute |= execInfo.execute & (EXEC_ERROR_MASK|EXEC_RETURN); // copy across any errors/exceptions/returns execInfo.execute = execInfo.execute & (JsExecFlags)~EXEC_BREAK; JSP_RESTORE_EXECUTE(); } JSP_MATCH('}'); return 0; } ",0 " tt_cmap4_init( TT_CMap4 cmap, FT_Byte* table ) { FT_Byte* p; cmap->cmap.data = table; p = table + 6; cmap->num_ranges = FT_PEEK_USHORT( p ) >> 1; cmap->cur_charcode = 0xFFFFFFFFUL; cmap->cur_gindex = 0; return SFNT_Err_Ok; } ",0 "WebGLTexture* WebGL2RenderingContextBase::ValidateTexture3DBinding( const char* function_name, GLenum target) { WebGLTexture* tex = nullptr; switch (target) { case GL_TEXTURE_2D_ARRAY: tex = texture_units_[active_texture_unit_].texture2d_array_binding_.Get(); break; case GL_TEXTURE_3D: tex = texture_units_[active_texture_unit_].texture3d_binding_.Get(); break; default: SynthesizeGLError(GL_INVALID_ENUM, function_name, ""invalid texture target""); return nullptr; } if (!tex) SynthesizeGLError(GL_INVALID_OPERATION, function_name, ""no texture bound to target""); return tex; } ",0 "bool JSArray::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) { if (propertyName == exec->propertyNames().length) { descriptor.setDescriptor(jsNumber(length()), DontDelete | DontEnum); return true; } ArrayStorage* storage = m_storage; bool isArrayIndex; unsigned i = propertyName.toArrayIndex(isArrayIndex); if (isArrayIndex) { if (i >= storage->m_length) return false; if (i < m_vectorLength) { WriteBarrier& value = storage->m_vector[i]; if (value) { descriptor.setDescriptor(value.get(), 0); return true; } } else if (SparseArrayValueMap* map = storage->m_sparseValueMap) { if (i >= MIN_SPARSE_ARRAY_INDEX) { SparseArrayValueMap::iterator it = map->find(i); if (it != map->end()) { descriptor.setDescriptor(it->second.get(), 0); return true; } } } } return JSObject::getOwnPropertyDescriptor(exec, propertyName, descriptor); } ",0 "static int stream_pri_cmp(int sid1, int sid2, void *ctx) { h2_session *session = ctx; nghttp2_stream *s1, *s2; s1 = nghttp2_session_find_stream(session->ngh2, sid1); s2 = nghttp2_session_find_stream(session->ngh2, sid2); if (s1 == s2) { return 0; } else if (!s1) { return 1; } else if (!s2) { return -1; } return spri_cmp(sid1, s1, sid2, s2, session); } ",0 "PersistentSparseHistogramDataManager::GetSampleMapRecordsWhileLocked( uint64_t id) { lock_.AssertAcquired(); auto found = sample_records_.find(id); if (found != sample_records_.end()) return found->second.get(); std::unique_ptr& samples = sample_records_[id]; samples = std::make_unique(this, id); return samples.get(); } ",0 "bool ChildProcessSecurityPolicyImpl::CanReadFileSystem( int child_id, const std::string& filesystem_id) { return HasPermissionsForFileSystem(child_id, filesystem_id, READ_FILE_GRANT); } ",0 "void ExtensionInstallPrompt::OnImageLoaded(const gfx::Image& image) { SetIcon(image.IsEmpty() ? NULL : image.ToSkBitmap()); ShowConfirmation(); } ",0 "int netdev_set_master(struct net_device *slave, struct net_device *master) { struct net_device *old = slave->master; ASSERT_RTNL(); if (master) { if (old) return -EBUSY; dev_hold(master); } slave->master = master; synchronize_net(); if (old) dev_put(old); if (master) slave->flags |= IFF_SLAVE; else slave->flags &= ~IFF_SLAVE; rtmsg_ifinfo(RTM_NEWLINK, slave, IFF_SLAVE); return 0; } ",0 "lzh_make_huffman_table(struct huffman *hf) { uint16_t *tbl; const unsigned char *bitlen; int bitptn[17], weight[17]; int i, maxbits = 0, ptn, tbl_size, w; int diffbits, len_avail; /* * Initialize bit patterns. */ ptn = 0; for (i = 1, w = 1 << 15; i <= 16; i++, w >>= 1) { bitptn[i] = ptn; weight[i] = w; if (hf->freq[i]) { ptn += hf->freq[i] * w; maxbits = i; } } if (ptn != 0x10000 || maxbits > hf->tbl_bits) return (0);/* Invalid */ hf->max_bits = maxbits; /* * Cut out extra bits which we won't house in the table. * This preparation reduces the same calculation in the for-loop * making the table. */ if (maxbits < 16) { int ebits = 16 - maxbits; for (i = 1; i <= maxbits; i++) { bitptn[i] >>= ebits; weight[i] >>= ebits; } } if (maxbits > HTBL_BITS) { unsigned htbl_max; uint16_t *p; diffbits = maxbits - HTBL_BITS; for (i = 1; i <= HTBL_BITS; i++) { bitptn[i] >>= diffbits; weight[i] >>= diffbits; } htbl_max = bitptn[HTBL_BITS] + weight[HTBL_BITS] * hf->freq[HTBL_BITS]; p = &(hf->tbl[htbl_max]); while (p < &hf->tbl[1U<shift_bits = diffbits; /* * Make the table. */ tbl_size = 1 << HTBL_BITS; tbl = hf->tbl; bitlen = hf->bitlen; len_avail = hf->len_avail; hf->tree_used = 0; for (i = 0; i < len_avail; i++) { uint16_t *p; int len, cnt; uint16_t bit; int extlen; struct htree_t *ht; if (bitlen[i] == 0) continue; /* Get a bit pattern */ len = bitlen[i]; ptn = bitptn[len]; cnt = weight[len]; if (len <= HTBL_BITS) { /* Calculate next bit pattern */ if ((bitptn[len] = ptn + cnt) > tbl_size) return (0);/* Invalid */ /* Update the table */ p = &(tbl[ptn]); if (cnt > 7) { uint16_t *pc; cnt -= 8; pc = &p[cnt]; pc[0] = (uint16_t)i; pc[1] = (uint16_t)i; pc[2] = (uint16_t)i; pc[3] = (uint16_t)i; pc[4] = (uint16_t)i; pc[5] = (uint16_t)i; pc[6] = (uint16_t)i; pc[7] = (uint16_t)i; if (cnt > 7) { cnt -= 8; memcpy(&p[cnt], pc, 8 * sizeof(uint16_t)); pc = &p[cnt]; while (cnt > 15) { cnt -= 16; memcpy(&p[cnt], pc, 16 * sizeof(uint16_t)); } } if (cnt) memcpy(p, pc, cnt * sizeof(uint16_t)); } else { while (cnt > 1) { p[--cnt] = (uint16_t)i; p[--cnt] = (uint16_t)i; } if (cnt) p[--cnt] = (uint16_t)i; } continue; } /* * A bit length is too big to be housed to a direct table, * so we use a tree model for its extra bits. */ bitptn[len] = ptn + cnt; bit = 1U << (diffbits -1); extlen = len - HTBL_BITS; p = &(tbl[ptn >> diffbits]); if (*p == 0) { *p = len_avail + hf->tree_used; ht = &(hf->tree[hf->tree_used++]); if (hf->tree_used > hf->tree_avail) return (0);/* Invalid */ ht->left = 0; ht->right = 0; } else { if (*p < len_avail || *p >= (len_avail + hf->tree_used)) return (0);/* Invalid */ ht = &(hf->tree[*p - len_avail]); } while (--extlen > 0) { if (ptn & bit) { if (ht->left < len_avail) { ht->left = len_avail + hf->tree_used; ht = &(hf->tree[hf->tree_used++]); if (hf->tree_used > hf->tree_avail) return (0);/* Invalid */ ht->left = 0; ht->right = 0; } else { ht = &(hf->tree[ht->left - len_avail]); } } else { if (ht->right < len_avail) { ht->right = len_avail + hf->tree_used; ht = &(hf->tree[hf->tree_used++]); if (hf->tree_used > hf->tree_avail) return (0);/* Invalid */ ht->left = 0; ht->right = 0; } else { ht = &(hf->tree[ht->right - len_avail]); } } bit >>= 1; } if (ptn & bit) { if (ht->left != 0) return (0);/* Invalid */ ht->left = (uint16_t)i; } else { if (ht->right != 0) return (0);/* Invalid */ ht->right = (uint16_t)i; } } return (1); } ",0 "static void ZSTD_invalidateMatchState(ZSTD_matchState_t* ms) { ZSTD_window_clear(&ms->window); ms->nextToUpdate = ms->window.dictLimit + 1; ms->nextToUpdate3 = ms->window.dictLimit + 1; ms->loadedDictEnd = 0; ms->opt.litLengthSum = 0; /* force reset of btopt stats */ ms->dictMatchState = NULL; } ",0 "static int _nfs41_test_stateid(struct nfs_server *server, nfs4_stateid *stateid) { int status; struct nfs41_test_stateid_args args = { .stateid = stateid, }; struct nfs41_test_stateid_res res; struct rpc_message msg = { .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_TEST_STATEID], .rpc_argp = &args, .rpc_resp = &res, }; nfs41_init_sequence(&args.seq_args, &res.seq_res, 0); status = nfs4_call_sync_sequence(server->client, server, &msg, &args.seq_args, &res.seq_res, 1); if (status == NFS_OK) return res.status; return status; } ",0 "GF_Err minf_Size(GF_Box *s) { GF_Err e; GF_MediaInformationBox *ptr = (GF_MediaInformationBox *)s; if (ptr->InfoHeader) { e = gf_isom_box_size((GF_Box *) ptr->InfoHeader); if (e) return e; ptr->size += ptr->InfoHeader->size; } if (ptr->dataInformation) { e = gf_isom_box_size((GF_Box *) ptr->dataInformation); if (e) return e; ptr->size += ptr->dataInformation->size; } if (ptr->sampleTable) { e = gf_isom_box_size((GF_Box *) ptr->sampleTable); if (e) return e; ptr->size += ptr->sampleTable->size; } return GF_OK; } ",0 "static void coroutine_fn v9fs_create(void *opaque) { int32_t fid; int err = 0; size_t offset = 7; V9fsFidState *fidp; V9fsQID qid; int32_t perm; int8_t mode; V9fsPath path; struct stat stbuf; V9fsString name; V9fsString extension; int iounit; V9fsPDU *pdu = opaque; V9fsState *s = pdu->s; v9fs_path_init(&path); v9fs_string_init(&name); v9fs_string_init(&extension); err = pdu_unmarshal(pdu, offset, ""dsdbs"", &fid, &name, &perm, &mode, &extension); if (err < 0) { goto out_nofid; } trace_v9fs_create(pdu->tag, pdu->id, fid, name.data, perm, mode); if (name_is_illegal(name.data)) { err = -ENOENT; goto out_nofid; } if (!strcmp(""."", name.data) || !strcmp("".."", name.data)) { err = -EEXIST; goto out_nofid; } fidp = get_fid(pdu, fid); if (fidp == NULL) { err = -EINVAL; goto out_nofid; } if (fidp->fid_type != P9_FID_NONE) { err = -EINVAL; goto out; } if (perm & P9_STAT_MODE_DIR) { err = v9fs_co_mkdir(pdu, fidp, &name, perm & 0777, fidp->uid, -1, &stbuf); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { goto out; } v9fs_path_write_lock(s); v9fs_path_copy(&fidp->path, &path); v9fs_path_unlock(s); err = v9fs_co_opendir(pdu, fidp); if (err < 0) { goto out; } fidp->fid_type = P9_FID_DIR; } else if (perm & P9_STAT_MODE_SYMLINK) { err = v9fs_co_symlink(pdu, fidp, &name, extension.data, -1 , &stbuf); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { goto out; } v9fs_path_write_lock(s); v9fs_path_copy(&fidp->path, &path); v9fs_path_unlock(s); } else if (perm & P9_STAT_MODE_LINK) { int32_t ofid = atoi(extension.data); V9fsFidState *ofidp = get_fid(pdu, ofid); if (ofidp == NULL) { err = -EINVAL; goto out; } err = v9fs_co_link(pdu, ofidp, fidp, &name); put_fid(pdu, ofidp); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { fidp->fid_type = P9_FID_NONE; goto out; } v9fs_path_write_lock(s); v9fs_path_copy(&fidp->path, &path); v9fs_path_unlock(s); err = v9fs_co_lstat(pdu, &fidp->path, &stbuf); if (err < 0) { fidp->fid_type = P9_FID_NONE; goto out; } } else if (perm & P9_STAT_MODE_DEVICE) { char ctype; uint32_t major, minor; mode_t nmode = 0; if (sscanf(extension.data, ""%c %u %u"", &ctype, &major, &minor) != 3) { err = -errno; goto out; } switch (ctype) { case 'c': nmode = S_IFCHR; break; case 'b': nmode = S_IFBLK; break; default: err = -EIO; goto out; } nmode |= perm & 0777; err = v9fs_co_mknod(pdu, fidp, &name, fidp->uid, -1, makedev(major, minor), nmode, &stbuf); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { goto out; } v9fs_path_write_lock(s); v9fs_path_copy(&fidp->path, &path); v9fs_path_unlock(s); } else if (perm & P9_STAT_MODE_NAMED_PIPE) { err = v9fs_co_mknod(pdu, fidp, &name, fidp->uid, -1, 0, S_IFIFO | (perm & 0777), &stbuf); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { goto out; } v9fs_path_write_lock(s); v9fs_path_copy(&fidp->path, &path); v9fs_path_unlock(s); } else if (perm & P9_STAT_MODE_SOCKET) { err = v9fs_co_mknod(pdu, fidp, &name, fidp->uid, -1, 0, S_IFSOCK | (perm & 0777), &stbuf); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { goto out; } v9fs_path_write_lock(s); v9fs_path_copy(&fidp->path, &path); v9fs_path_unlock(s); } else { err = v9fs_co_open2(pdu, fidp, &name, -1, omode_to_uflags(mode)|O_CREAT, perm, &stbuf); if (err < 0) { goto out; } fidp->fid_type = P9_FID_FILE; fidp->open_flags = omode_to_uflags(mode); if (fidp->open_flags & O_EXCL) { /* * We let the host file system do O_EXCL check * We should not reclaim such fd */ fidp->flags |= FID_NON_RECLAIMABLE; } } iounit = get_iounit(pdu, &fidp->path); stat_to_qid(&stbuf, &qid); err = pdu_marshal(pdu, offset, ""Qd"", &qid, iounit); if (err < 0) { goto out; } err += offset; trace_v9fs_create_return(pdu->tag, pdu->id, qid.type, qid.version, qid.path, iounit); out: put_fid(pdu, fidp); out_nofid: pdu_complete(pdu, err); v9fs_string_free(&name); v9fs_string_free(&extension); v9fs_path_free(&path); } ",0 "static int area_io(struct pstore *ps, int rw) { int r; chunk_t chunk; chunk = area_location(ps, ps->current_area); r = chunk_io(ps, ps->area, chunk, rw, 0); if (r) return r; return 0; } ",0 "xfs_buf_trylock( struct xfs_buf *bp) { int locked; locked = down_trylock(&bp->b_sema) == 0; if (locked) XB_SET_OWNER(bp); else if (atomic_read(&bp->b_pin_count) && (bp->b_flags & XBF_STALE)) xfs_log_force(bp->b_target->bt_mount, 0); trace_xfs_buf_trylock(bp, _RET_IP_); return locked; } ",0 "void GDataFileSystem::TransferFileForResourceId( const FilePath& local_file_path, const FilePath& remote_dest_file_path, const FileOperationCallback& callback, std::string* resource_id) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(resource_id); DCHECK(!callback.is_null()); if (resource_id->empty()) { TransferRegularFile(local_file_path, remote_dest_file_path, callback); return; } CopyDocumentToDirectory( remote_dest_file_path.DirName(), *resource_id, remote_dest_file_path.BaseName().RemoveExtension().value(), callback); } ",0 "static inline int decode_attr_length(struct xdr_stream *xdr, uint32_t *attrlen, __be32 **savep) { __be32 *p; READ_BUF(4); READ32(*attrlen); *savep = xdr->p; return 0; } ",0 "void OmniboxViewViews::SetFocus() { RequestFocus(); model()->SetCaretVisibility(true); } ",0 "AuthenticatorNoAvailableTransportsErrorModel::GetStepDescription() const { return l10n_util::GetStringUTF16( IDS_WEBAUTHN_ERROR_NO_TRANSPORTS_DESCRIPTION); } ",0 "bool GpuProcessHost::Send(IPC::Message* msg) { DCHECK(CalledOnValidThread()); if (process_->GetHost()->IsChannelOpening()) { queued_messages_.push(msg); return true; } bool result = process_->Send(msg); if (!result) valid_ = false; return result; } ",0 "static inline int ipv6_is_local_multicast(const struct in6_addr *addr) { if (ipv6_addr_is_multicast(addr) && IPV6_ADDR_MC_SCOPE(addr) <= IPV6_ADDR_SCOPE_LINKLOCAL) return 1; return 0; } ",0 "int compat_restore_altstack(const compat_stack_t __user *uss) { int err = compat_sys_sigaltstack(uss, NULL); /* squash all but -EFAULT for now */ return err == -EFAULT ? err : 0; } ",0 "void NavigationController::Reload(bool check_for_repost) { ReloadInternal(check_for_repost, RELOAD); } ",0 "static int mac80211_hwsim_conf_tx( struct ieee80211_hw *hw, struct ieee80211_vif *vif, u16 queue, const struct ieee80211_tx_queue_params *params) { wiphy_dbg(hw->wiphy, ""%s (queue=%d txop=%d cw_min=%d cw_max=%d aifs=%d)\n"", __func__, queue, params->txop, params->cw_min, params->cw_max, params->aifs); return 0; } ",0 "static void computeInlineStaticDistance(Length& logicalLeft, Length& logicalRight, const RenderBox* child, const RenderBoxModelObject* containerBlock, int containerLogicalWidth, TextDirection containerDirection) { if (!logicalLeft.isAuto() || !logicalRight.isAuto()) return; if (containerDirection == LTR) { int staticPosition = child->layer()->staticInlinePosition() - containerBlock->borderLogicalLeft(); for (RenderObject* curr = child->parent(); curr && curr != containerBlock; curr = curr->container()) { if (curr->isBox()) staticPosition += toRenderBox(curr)->logicalLeft(); } logicalLeft.setValue(Fixed, staticPosition); } else { RenderBox* enclosingBox = child->parent()->enclosingBox(); int staticPosition = child->layer()->staticInlinePosition() + containerLogicalWidth + containerBlock->borderLogicalRight(); staticPosition -= enclosingBox->logicalWidth(); for (RenderObject* curr = enclosingBox; curr && curr != containerBlock; curr = curr->container()) { if (curr->isBox()) staticPosition -= toRenderBox(curr)->logicalLeft(); } logicalRight.setValue(Fixed, staticPosition); } } ",0 "FileError::ErrorCode FileReaderLoader::httpStatusCodeToErrorCode(int httpStatusCode) { switch (httpStatusCode) { case 403: return FileError::SECURITY_ERR; case 404: return FileError::NOT_FOUND_ERR; default: return FileError::NOT_READABLE_ERR; } } ",0 "void Textfield::SetHorizontalAlignment(gfx::HorizontalAlignment alignment) { GetRenderText()->SetHorizontalAlignment(alignment); } ",0 " testing::AssertionResult ScriptAllowedExclusivelyOnTab( const Extension* extension, const std::set& allowed_urls, int tab_id) { std::vector errors; for (const GURL& url : urls_) { bool allowed = IsAllowedScript(extension, url, tab_id); if (allowed && !allowed_urls.count(url)) errors.push_back(""Script unexpectedly disallowed on "" + url.spec()); else if (!allowed && allowed_urls.count(url)) errors.push_back(""Script unexpectedly allowed on "" + url.spec()); } if (!errors.empty()) return testing::AssertionFailure() << base::JoinString(errors, ""\n""); return testing::AssertionSuccess(); } ",1 "std::string BrowserDevToolsAgentHost::GetTitle() { return """"; } ",0 "static int add_push_report_sideband_pkt(git_push *push, git_pkt_data *data_pkt, git_buf *data_pkt_buf) { git_pkt *pkt; const char *line, *line_end; size_t line_len; int error; int reading_from_buf = data_pkt_buf->size > 0; if (reading_from_buf) { /* We had an existing partial packet, so add the new * packet to the buffer and parse the whole thing */ git_buf_put(data_pkt_buf, data_pkt->data, data_pkt->len); line = data_pkt_buf->ptr; line_len = data_pkt_buf->size; } else { line = data_pkt->data; line_len = data_pkt->len; } while (line_len > 0) { error = git_pkt_parse_line(&pkt, line, &line_end, line_len); if (error == GIT_EBUFS) { /* Buffer the data when the inner packet is split * across multiple sideband packets */ if (!reading_from_buf) git_buf_put(data_pkt_buf, line, line_len); error = 0; goto done; } else if (error < 0) goto done; /* Advance in the buffer */ line_len -= (line_end - line); line = line_end; /* When a valid packet with no content has been * read, git_pkt_parse_line does not report an * error, but the pkt pointer has not been set. * Handle this by skipping over empty packets. */ if (pkt == NULL) continue; error = add_push_report_pkt(push, pkt); git_pkt_free(pkt); if (error < 0 && error != GIT_ITEROVER) goto done; } error = 0; done: if (reading_from_buf) git_buf_consume(data_pkt_buf, line_end); return error; } ",1 "SwapXResResourceSizeSpec(xXResResourceSizeSpec *size) { SwapXResResourceIdSpec(&size->spec); swapl(&size->bytes); swapl(&size->refCount); swapl(&size->useCount); } ",0 "AutofillManager::~AutofillManager() {} ",0 "void Browser::WebContentsFocused(WebContents* contents) { window_->WebContentsFocused(contents); } ",0 "void Shell::OnOverviewModeStarting() { FOR_EACH_OBSERVER(ShellObserver, observers_, OnOverviewModeStarting()); } ",0 "int inet_ctl_sock_create(struct sock **sk, unsigned short family, unsigned short type, unsigned char protocol, struct net *net) { struct socket *sock; int rc = sock_create_kern(net, family, type, protocol, &sock); if (rc == 0) { *sk = sock->sk; (*sk)->sk_allocation = GFP_ATOMIC; /* * Unhash it so that IP input processing does not even see it, * we do not wish this socket to see incoming packets. */ (*sk)->sk_prot->unhash(*sk); } return rc; } ",0 "int32_t IPCThreadState::getStrictModePolicy() const { return mStrictModePolicy; } ",0 "static RBinElfSection* get_sections_from_phdr(ELFOBJ *bin) { RBinElfSection *ret; int i, num_sections = 0; ut64 reldyn = 0, relava = 0, pltgotva = 0, relva = 0; ut64 reldynsz = 0, relasz = 0, pltgotsz = 0; if (!bin || !bin->phdr || !bin->ehdr.e_phnum) return NULL; for (i = 0; i < bin->dyn_entries; i++) { switch (bin->dyn_buf[i].d_tag) { case DT_REL: reldyn = bin->dyn_buf[i].d_un.d_ptr; num_sections++; break; case DT_RELA: relva = bin->dyn_buf[i].d_un.d_ptr; num_sections++; break; case DT_RELSZ: reldynsz = bin->dyn_buf[i].d_un.d_val; break; case DT_RELASZ: relasz = bin->dyn_buf[i].d_un.d_val; break; case DT_PLTGOT: pltgotva = bin->dyn_buf[i].d_un.d_ptr; num_sections++; break; case DT_PLTRELSZ: pltgotsz = bin->dyn_buf[i].d_un.d_val; break; case DT_JMPREL: relava = bin->dyn_buf[i].d_un.d_ptr; num_sections++; break; default: break; } } ret = calloc (num_sections + 1, sizeof(RBinElfSection)); if (!ret) { return NULL; } i = 0; if (reldyn) { ret[i].offset = Elf_(r_bin_elf_v2p) (bin, reldyn); ret[i].rva = reldyn; ret[i].size = reldynsz; strcpy (ret[i].name, "".rel.dyn""); ret[i].last = 0; i++; } if (relava) { ret[i].offset = Elf_(r_bin_elf_v2p) (bin, relava); ret[i].rva = relava; ret[i].size = pltgotsz; strcpy (ret[i].name, "".rela.plt""); ret[i].last = 0; i++; } if (relva) { ret[i].offset = Elf_(r_bin_elf_v2p) (bin, relva); ret[i].rva = relva; ret[i].size = relasz; strcpy (ret[i].name, "".rel.plt""); ret[i].last = 0; i++; } if (pltgotva) { ret[i].offset = Elf_(r_bin_elf_v2p) (bin, pltgotva); ret[i].rva = pltgotva; ret[i].size = pltgotsz; strcpy (ret[i].name, "".got.plt""); ret[i].last = 0; i++; } ret[i].last = 1; return ret; } ",0 " virtual void ResetModel() { last_pts_ = 0; bits_in_buffer_model_ = cfg_.rc_target_bitrate * cfg_.rc_buf_initial_sz; frame_number_ = 0; first_drop_ = 0; bits_total_ = 0; duration_ = 0.0; } ",1 " virtual bool requiresSecureDecoderComponent( const char *mime) const { Parcel data, reply; data.writeInterfaceToken(ICrypto::getInterfaceDescriptor()); data.writeCString(mime); remote()->transact(REQUIRES_SECURE_COMPONENT, data, &reply); return reply.readInt32() != 0; } ",0 "uint8_t ndp_msg_opt_route_prefix_len(struct ndp_msg *msg, int offset) { struct __nd_opt_route_info *ri = ndp_msg_payload_opts_offset(msg, offset); return ri->nd_opt_ri_prefix_len; } ",0 "void TCSleep (int milliSeconds) { PKTIMER timer = (PKTIMER) TCalloc (sizeof (KTIMER)); LARGE_INTEGER duetime; if (!timer) return; duetime.QuadPart = (__int64) milliSeconds * -10000; KeInitializeTimerEx(timer, NotificationTimer); KeSetTimerEx(timer, duetime, 0, NULL); KeWaitForSingleObject (timer, Executive, KernelMode, FALSE, NULL); TCfree (timer); } ",0 "static int wc_ecc_shared_secret_gen_sync(ecc_key* private_key, ecc_point* point, byte* out, word32* outlen, ecc_curve_spec* curve) { int err; #ifndef WOLFSSL_SP_MATH ecc_point* result = NULL; word32 x = 0; #endif mp_int* k = &private_key->k; #ifdef HAVE_ECC_CDH mp_int k_lcl; /* if cofactor flag has been set */ if (private_key->flags & WC_ECC_FLAG_COFACTOR) { mp_digit cofactor = (mp_digit)private_key->dp->cofactor; /* only perform cofactor calc if not equal to 1 */ if (cofactor != 1) { k = &k_lcl; if (mp_init(k) != MP_OKAY) return MEMORY_E; /* multiply cofactor times private key ""k"" */ err = mp_mul_d(&private_key->k, cofactor, k); if (err != MP_OKAY) { mp_clear(k); return err; } } } #endif #ifdef WOLFSSL_HAVE_SP_ECC #ifndef WOLFSSL_SP_NO_256 if (private_key->idx != ECC_CUSTOM_IDX && ecc_sets[private_key->idx].id == ECC_SECP256R1) { err = sp_ecc_secret_gen_256(k, point, out, outlen, private_key->heap); } else #endif #endif #ifdef WOLFSSL_SP_MATH { err = WC_KEY_SIZE_E; (void)curve; } #else { /* make new point */ result = wc_ecc_new_point_h(private_key->heap); if (result == NULL) { #ifdef HAVE_ECC_CDH if (k == &k_lcl) mp_clear(k); #endif return MEMORY_E; } err = wc_ecc_mulmod_ex(k, point, result, curve->Af, curve->prime, 1, private_key->heap); if (err == MP_OKAY) { x = mp_unsigned_bin_size(curve->prime); if (*outlen < x) { err = BUFFER_E; } } if (err == MP_OKAY) { XMEMSET(out, 0, x); err = mp_to_unsigned_bin(result->x,out + (x - mp_unsigned_bin_size(result->x))); } *outlen = x; wc_ecc_del_point_h(result, private_key->heap); } #endif #ifdef HAVE_ECC_CDH if (k == &k_lcl) mp_clear(k); #endif return err; } ",0 "static int sd_resume(struct device *dev) { struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev); int ret = 0; if (!sdkp->device->manage_start_stop) goto done; sd_printk(KERN_NOTICE, sdkp, ""Starting disk\n""); ret = sd_start_stop_device(sdkp, 1); done: scsi_disk_put(sdkp); return ret; } ",0 "void V8TestObject::UnscopableLongAttributeAttributeSetterCallback( const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_unscopableLongAttribute_Setter""); v8::Local v8_value = info[0]; test_object_v8_internal::UnscopableLongAttributeAttributeSetter(v8_value, info); } ",0 "void Document::inheritHtmlAndBodyElementStyles(StyleRecalcChange change) { ASSERT(inStyleRecalc()); ASSERT(documentElement()); bool didRecalcDocumentElement = false; RefPtr documentElementStyle = documentElement()->mutableComputedStyle(); if (change == Force) documentElement()->clearAnimationStyleChange(); if (!documentElementStyle || documentElement()->needsStyleRecalc() || change == Force) { documentElementStyle = ensureStyleResolver().styleForElement(documentElement()); didRecalcDocumentElement = true; } WritingMode rootWritingMode = documentElementStyle->writingMode(); TextDirection rootDirection = documentElementStyle->direction(); HTMLElement* body = this->body(); RefPtr bodyStyle; if (body) { bodyStyle = body->mutableComputedStyle(); if (didRecalcDocumentElement) body->clearAnimationStyleChange(); if (!bodyStyle || body->needsStyleRecalc() || didRecalcDocumentElement) bodyStyle = ensureStyleResolver().styleForElement(body, documentElementStyle.get()); rootWritingMode = bodyStyle->writingMode(); rootDirection = bodyStyle->direction(); } RefPtr overflowStyle; if (Element* element = viewportDefiningElement(documentElementStyle.get())) { if (element == body) { overflowStyle = bodyStyle; } else { ASSERT(element == documentElement()); overflowStyle = documentElementStyle; } } if (styleEngine().usesRemUnits() && (documentElement()->needsAttach() || documentElement()->ensureComputedStyle()->fontSize() != documentElementStyle->fontSize())) { ensureStyleResolver().invalidateMatchedPropertiesCache(); documentElement()->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::FontSizeChange)); } EOverflow overflowX = OAUTO; EOverflow overflowY = OAUTO; float columnGap = 0; if (overflowStyle) { overflowX = overflowStyle->overflowX(); overflowY = overflowStyle->overflowY(); if (overflowX == OVISIBLE) overflowX = OAUTO; if (overflowY == OVISIBLE) overflowY = OAUTO; columnGap = overflowStyle->columnGap(); } WebScrollBlocksOn scrollBlocksOn = documentElementStyle->scrollBlocksOn(); RefPtr documentStyle = layoutView()->mutableStyle(); if (documentStyle->writingMode() != rootWritingMode || documentStyle->direction() != rootDirection || documentStyle->overflowX() != overflowX || documentStyle->overflowY() != overflowY || documentStyle->columnGap() != columnGap || documentStyle->scrollBlocksOn() != scrollBlocksOn) { RefPtr newStyle = ComputedStyle::clone(*documentStyle); newStyle->setWritingMode(rootWritingMode); newStyle->setDirection(rootDirection); newStyle->setColumnGap(columnGap); newStyle->setOverflowX(overflowX); newStyle->setOverflowY(overflowY); newStyle->setScrollBlocksOn(scrollBlocksOn); layoutView()->setStyle(newStyle); setupFontBuilder(*newStyle); } if (body) { if (const ComputedStyle* style = body->computedStyle()) { if (style->direction() != rootDirection || style->writingMode() != rootWritingMode) body->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::WritingModeChange)); } } if (const ComputedStyle* style = documentElement()->computedStyle()) { if (style->direction() != rootDirection || style->writingMode() != rootWritingMode) documentElement()->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::WritingModeChange)); } } ",0 "void PDFiumEngine::SelectionChangeInvalidator::Invalidate( const pp::Rect& selection) { pp::Rect expanded_selection = selection; expanded_selection.Inset(-1, -1); engine_->client_->Invalidate(expanded_selection); } ",0 "PHPAPI MYSQLND * mysqlnd_connect(MYSQLND * conn_handle, const char * host, const char * user, const char * passwd, unsigned int passwd_len, const char * db, unsigned int db_len, unsigned int port, const char * socket_or_pipe, unsigned int mysql_flags TSRMLS_DC) { enum_func_status ret = FAIL; zend_bool self_alloced = FALSE; DBG_ENTER(""mysqlnd_connect""); DBG_INF_FMT(""host=%s user=%s db=%s port=%u flags=%u"", host?host:"""", user?user:"""", db?db:"""", port, mysql_flags); if (!conn_handle) { self_alloced = TRUE; if (!(conn_handle = mysqlnd_init(FALSE))) { /* OOM */ DBG_RETURN(NULL); } } ret = conn_handle->m->connect(conn_handle, host, user, passwd, passwd_len, db, db_len, port, socket_or_pipe, mysql_flags TSRMLS_CC); if (ret == FAIL) { if (self_alloced) { /* We have alloced, thus there are no references to this object - we are free to kill it! */ conn_handle->m->dtor(conn_handle TSRMLS_CC); } DBG_RETURN(NULL); } DBG_RETURN(conn_handle); } ",0 "static int opsldt(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { case 1: if ( a->bits == 64 ) { data[l++] = 0x48; } data[l++] = 0x0f; data[l++] = 0x00; if ( op->operands[0].type & OT_MEMORY ) { data[l++] = 0x00 | op->operands[0].regs[0]; } else { data[l++] = 0xc0 | op->operands[0].reg; } break; default: return -1; } return l; } ",0 "Eina_Bool ewk_frame_text_matches_highlight_get(const Evas_Object* ewkFrame) { EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData, false); EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->frame, false); return smartData->frame->editor()->markedTextMatchesAreHighlighted(); } ",0 "void Con_StopLimboMode_f( void ) { chat_limbo = qfalse; } ",0 "check_authorization_challenge_cb (AuthenticationAgent *agent, PolkitSubject *subject, PolkitIdentity *user_of_subject, PolkitSubject *caller, PolkitBackendInteractiveAuthority *authority, const gchar *action_id, PolkitDetails *details, PolkitImplicitAuthorization implicit_authorization, gboolean authentication_success, gboolean was_dismissed, PolkitIdentity *authenticated_identity, gpointer user_data) { GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (user_data); PolkitBackendInteractiveAuthorityPrivate *priv; PolkitAuthorizationResult *result; gchar *scope_str; gchar *subject_str; gchar *user_of_subject_str; gchar *authenticated_identity_str; gchar *subject_cmdline; gboolean is_temp; priv = POLKIT_BACKEND_INTERACTIVE_AUTHORITY_GET_PRIVATE (authority); result = NULL; scope_str = polkit_subject_to_string (agent->scope); subject_str = polkit_subject_to_string (subject); user_of_subject_str = polkit_identity_to_string (user_of_subject); authenticated_identity_str = NULL; if (authenticated_identity != NULL) authenticated_identity_str = polkit_identity_to_string (authenticated_identity); subject_cmdline = _polkit_subject_get_cmdline (subject); if (subject_cmdline == NULL) subject_cmdline = g_strdup (""""); g_debug (""In check_authorization_challenge_cb\n"" "" subject %s\n"" "" action_id %s\n"" "" was_dismissed %d\n"" "" authentication_success %d\n"", subject_str, action_id, was_dismissed, authentication_success); if (implicit_authorization == POLKIT_IMPLICIT_AUTHORIZATION_AUTHENTICATION_REQUIRED_RETAINED || implicit_authorization == POLKIT_IMPLICIT_AUTHORIZATION_ADMINISTRATOR_AUTHENTICATION_REQUIRED_RETAINED) polkit_details_insert (details, ""polkit.retains_authorization_after_challenge"", ""true""); is_temp = FALSE; if (authentication_success) { /* store temporary authorization depending on value of implicit_authorization */ if (implicit_authorization == POLKIT_IMPLICIT_AUTHORIZATION_AUTHENTICATION_REQUIRED_RETAINED || implicit_authorization == POLKIT_IMPLICIT_AUTHORIZATION_ADMINISTRATOR_AUTHENTICATION_REQUIRED_RETAINED) { const gchar *id; is_temp = TRUE; id = temporary_authorization_store_add_authorization (priv->temporary_authorization_store, subject, authentication_agent_get_scope (agent), action_id); polkit_details_insert (details, ""polkit.temporary_authorization_id"", id); /* we've added a temporary authorization, let the user know */ g_signal_emit_by_name (authority, ""changed""); } result = polkit_authorization_result_new (TRUE, FALSE, details); } else { /* TODO: maybe return set is_challenge? */ if (was_dismissed) polkit_details_insert (details, ""polkit.dismissed"", ""true""); result = polkit_authorization_result_new (FALSE, FALSE, details); } /* Log the event */ if (authentication_success) { if (is_temp) { polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), ""Operator of %s successfully authenticated as %s to gain "" ""TEMPORARY authorization for action %s for %s [%s] (owned by %s)"", scope_str, authenticated_identity_str, action_id, subject_str, subject_cmdline, user_of_subject_str); } else { polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), ""Operator of %s successfully authenticated as %s to gain "" ""ONE-SHOT authorization for action %s for %s [%s] (owned by %s)"", scope_str, authenticated_identity_str, action_id, subject_str, subject_cmdline, user_of_subject_str); } } else { polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), ""Operator of %s FAILED to authenticate to gain "" ""authorization for action %s for %s [%s] (owned by %s)"", scope_str, action_id, subject_str, subject_cmdline, user_of_subject_str); } /* log_result (authority, action_id, subject, caller, result); */ g_simple_async_result_set_op_res_gpointer (simple, result, g_object_unref); g_simple_async_result_complete (simple); g_object_unref (simple); g_free (subject_cmdline); g_free (authenticated_identity_str); g_free (user_of_subject_str); g_free (subject_str); g_free (scope_str); } ",0 "xmlXPathStringLengthFunction(xmlXPathParserContextPtr ctxt, int nargs) { xmlXPathObjectPtr cur; if (nargs == 0) { if ((ctxt == NULL) || (ctxt->context == NULL)) return; if (ctxt->context->node == NULL) { valuePush(ctxt, xmlXPathCacheNewFloat(ctxt->context, 0)); } else { xmlChar *content; content = xmlXPathCastNodeToString(ctxt->context->node); valuePush(ctxt, xmlXPathCacheNewFloat(ctxt->context, xmlUTF8Strlen(content))); xmlFree(content); } return; } CHECK_ARITY(1); CAST_TO_STRING; CHECK_TYPE(XPATH_STRING); cur = valuePop(ctxt); valuePush(ctxt, xmlXPathCacheNewFloat(ctxt->context, xmlUTF8Strlen(cur->stringval))); xmlXPathReleaseObject(ctxt->context, cur); } ",0 "void BrowserActionsContainer::BubbleBrowserWindowMoved(BrowserBubble* bubble) { } ",0 "static int kvp_key_delete(int pool, __u8 *key, int key_size) { int i; int j, k; int num_records; struct kvp_record *record; /* * First update the in-memory state. */ kvp_update_mem_state(pool); num_records = kvp_file_info[pool].num_records; record = kvp_file_info[pool].records; for (i = 0; i < num_records; i++) { if (memcmp(key, record[i].key, key_size)) continue; /* * Found a match; just move the remaining * entries up. */ if (i == num_records) { kvp_file_info[pool].num_records--; kvp_update_file(pool); return 0; } j = i; k = j + 1; for (; k < num_records; k++) { strcpy(record[j].key, record[k].key); strcpy(record[j].value, record[k].value); j++; } kvp_file_info[pool].num_records--; kvp_update_file(pool); return 0; } return 1; } ",0 "static bool ExecuteDeleteToMark(LocalFrame& frame, Event*, EditorCommandSource, const String&) { const EphemeralRange mark = frame.GetEditor().Mark().ToNormalizedEphemeralRange(); if (mark.IsNotNull()) { frame.Selection().SetSelection( SelectionInDOMTree::Builder() .SetBaseAndExtent( UnionEphemeralRanges(mark, frame.GetEditor().SelectedRange())) .Build(), FrameSelection::kCloseTyping); } frame.GetEditor().PerformDelete(); frame.GetEditor().SetMark( frame.Selection().ComputeVisibleSelectionInDOMTreeDeprecated()); return true; } ",0 "int ssl3_get_server_hello(SSL *s) { STACK_OF(SSL_CIPHER) *sk; const SSL_CIPHER *c; unsigned char *p, *d; int i, al = SSL_AD_INTERNAL_ERROR, ok; unsigned int j; long n; #ifndef OPENSSL_NO_COMP SSL_COMP *comp; #endif /* * Hello verify request and/or server hello version may not match so set * first packet if we're negotiating version. */ s->first_packet = 1; n = s->method->ssl_get_message(s, SSL3_ST_CR_SRVR_HELLO_A, SSL3_ST_CR_SRVR_HELLO_B, -1, 20000, &ok); if (!ok) return ((int)n); s->first_packet = 0; if (SSL_IS_DTLS(s)) { if (s->s3->tmp.message_type == DTLS1_MT_HELLO_VERIFY_REQUEST) { if (s->d1->send_cookie == 0) { s->s3->tmp.reuse_message = 1; return 1; } else { /* already sent a cookie */ al = SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_GET_SERVER_HELLO, SSL_R_BAD_MESSAGE_TYPE); goto f_err; } } } if (s->s3->tmp.message_type != SSL3_MT_SERVER_HELLO) { al = SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_GET_SERVER_HELLO, SSL_R_BAD_MESSAGE_TYPE); goto f_err; } d = p = (unsigned char *)s->init_msg; if (s->method->version == TLS_ANY_VERSION) { int sversion = (p[0] << 8) | p[1]; #if TLS_MAX_VERSION != TLS1_2_VERSION #error Code needs updating for new TLS version #endif #ifndef OPENSSL_NO_SSL3 if ((sversion == SSL3_VERSION) && !(s->options & SSL_OP_NO_SSLv3)) { if (FIPS_mode()) { SSLerr(SSL_F_SSL3_GET_SERVER_HELLO, SSL_R_ONLY_TLS_ALLOWED_IN_FIPS_MODE); al = SSL_AD_PROTOCOL_VERSION; goto f_err; } s->method = SSLv3_client_method(); } else #endif if ((sversion == TLS1_VERSION) && !(s->options & SSL_OP_NO_TLSv1)) { s->method = TLSv1_client_method(); } else if ((sversion == TLS1_1_VERSION) && !(s->options & SSL_OP_NO_TLSv1_1)) { s->method = TLSv1_1_client_method(); } else if ((sversion == TLS1_2_VERSION) && !(s->options & SSL_OP_NO_TLSv1_2)) { s->method = TLSv1_2_client_method(); } else { SSLerr(SSL_F_SSL3_GET_SERVER_HELLO, SSL_R_UNSUPPORTED_PROTOCOL); al = SSL_AD_PROTOCOL_VERSION; goto f_err; } s->session->ssl_version = s->version = s->method->version; if (!ssl_security(s, SSL_SECOP_VERSION, 0, s->version, NULL)) { SSLerr(SSL_F_SSL3_GET_SERVER_HELLO, SSL_R_VERSION_TOO_LOW); al = SSL_AD_PROTOCOL_VERSION; goto f_err; } } else if (s->method->version == DTLS_ANY_VERSION) { /* Work out correct protocol version to use */ int hversion = (p[0] << 8) | p[1]; int options = s->options; if (hversion == DTLS1_2_VERSION && !(options & SSL_OP_NO_DTLSv1_2)) s->method = DTLSv1_2_client_method(); else if (tls1_suiteb(s)) { SSLerr(SSL_F_SSL3_GET_SERVER_HELLO, SSL_R_ONLY_DTLS_1_2_ALLOWED_IN_SUITEB_MODE); s->version = hversion; al = SSL_AD_PROTOCOL_VERSION; goto f_err; } else if (hversion == DTLS1_VERSION && !(options & SSL_OP_NO_DTLSv1)) s->method = DTLSv1_client_method(); else { SSLerr(SSL_F_SSL3_GET_SERVER_HELLO, SSL_R_WRONG_SSL_VERSION); s->version = hversion; al = SSL_AD_PROTOCOL_VERSION; goto f_err; } s->version = s->method->version; } else if ((p[0] != (s->version >> 8)) || (p[1] != (s->version & 0xff))) { SSLerr(SSL_F_SSL3_GET_SERVER_HELLO, SSL_R_WRONG_SSL_VERSION); s->version = (s->version & 0xff00) | p[1]; al = SSL_AD_PROTOCOL_VERSION; goto f_err; } p += 2; /* load the server hello data */ /* load the server random */ memcpy(s->s3->server_random, p, SSL3_RANDOM_SIZE); p += SSL3_RANDOM_SIZE; s->hit = 0; /* get the session-id */ j = *(p++); if ((j > sizeof s->session->session_id) || (j > SSL3_SESSION_ID_SIZE)) { al = SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_GET_SERVER_HELLO, SSL_R_SSL3_SESSION_ID_TOO_LONG); goto f_err; } /* * Check if we can resume the session based on external pre-shared secret. * EAP-FAST (RFC 4851) supports two types of session resumption. * Resumption based on server-side state works with session IDs. * Resumption based on pre-shared Protected Access Credentials (PACs) * works by overriding the SessionTicket extension at the application * layer, and does not send a session ID. (We do not know whether EAP-FAST * servers would honour the session ID.) Therefore, the session ID alone * is not a reliable indicator of session resumption, so we first check if * we can resume, and later peek at the next handshake message to see if the * server wants to resume. */ if (s->version >= TLS1_VERSION && s->tls_session_secret_cb && s->session->tlsext_tick) { SSL_CIPHER *pref_cipher = NULL; s->session->master_key_length = sizeof(s->session->master_key); if (s->tls_session_secret_cb(s, s->session->master_key, &s->session->master_key_length, NULL, &pref_cipher, s->tls_session_secret_cb_arg)) { s->session->cipher = pref_cipher ? pref_cipher : ssl_get_cipher_by_char(s, p + j); } else { SSLerr(SSL_F_SSL3_GET_SERVER_HELLO, ERR_R_INTERNAL_ERROR); al = SSL_AD_INTERNAL_ERROR; goto f_err; } } if (j != 0 && j == s->session->session_id_length && memcmp(p, s->session->session_id, j) == 0) { if (s->sid_ctx_length != s->session->sid_ctx_length || memcmp(s->session->sid_ctx, s->sid_ctx, s->sid_ctx_length)) { /* actually a client application bug */ al = SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_GET_SERVER_HELLO, SSL_R_ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT); goto f_err; } s->hit = 1; } else { /* * If we were trying for session-id reuse but the server * didn't echo the ID, make a new SSL_SESSION. * In the case of EAP-FAST and PAC, we do not send a session ID, * so the PAC-based session secret is always preserved. It'll be * overwritten if the server refuses resumption. */ if (s->session->session_id_length > 0) { if (!ssl_get_new_session(s, 0)) { goto f_err; } } s->session->session_id_length = j; memcpy(s->session->session_id, p, j); /* j could be 0 */ } p += j; c = ssl_get_cipher_by_char(s, p); if (c == NULL) { /* unknown cipher */ al = SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_GET_SERVER_HELLO, SSL_R_UNKNOWN_CIPHER_RETURNED); goto f_err; } /* Set version disabled mask now we know version */ if (!SSL_USE_TLS1_2_CIPHERS(s)) s->s3->tmp.mask_ssl = SSL_TLSV1_2; else s->s3->tmp.mask_ssl = 0; /* * If it is a disabled cipher we didn't send it in client hello, so * return an error. */ if (ssl_cipher_disabled(s, c, SSL_SECOP_CIPHER_CHECK)) { al = SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_GET_SERVER_HELLO, SSL_R_WRONG_CIPHER_RETURNED); goto f_err; } p += ssl_put_cipher_by_char(s, NULL, NULL); sk = ssl_get_ciphers_by_id(s); i = sk_SSL_CIPHER_find(sk, c); if (i < 0) { /* we did not say we would use this cipher */ al = SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_GET_SERVER_HELLO, SSL_R_WRONG_CIPHER_RETURNED); goto f_err; } /* * Depending on the session caching (internal/external), the cipher * and/or cipher_id values may not be set. Make sure that cipher_id is * set and use it for comparison. */ if (s->session->cipher) s->session->cipher_id = s->session->cipher->id; if (s->hit && (s->session->cipher_id != c->id)) { al = SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_GET_SERVER_HELLO, SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED); goto f_err; } s->s3->tmp.new_cipher = c; /* * Don't digest cached records if no sigalgs: we may need them for client * authentication. */ if (!SSL_USE_SIGALGS(s) && !ssl3_digest_cached_records(s)) goto f_err; /* lets get the compression algorithm */ /* COMPRESSION */ #ifdef OPENSSL_NO_COMP if (*(p++) != 0) { al = SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_GET_SERVER_HELLO, SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM); goto f_err; } /* * If compression is disabled we'd better not try to resume a session * using compression. */ if (s->session->compress_meth != 0) { SSLerr(SSL_F_SSL3_GET_SERVER_HELLO, SSL_R_INCONSISTENT_COMPRESSION); goto f_err; } #else j = *(p++); if (s->hit && j != s->session->compress_meth) { al = SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_GET_SERVER_HELLO, SSL_R_OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED); goto f_err; } if (j == 0) comp = NULL; else if (!ssl_allow_compression(s)) { al = SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_GET_SERVER_HELLO, SSL_R_COMPRESSION_DISABLED); goto f_err; } else comp = ssl3_comp_find(s->ctx->comp_methods, j); if ((j != 0) && (comp == NULL)) { al = SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_GET_SERVER_HELLO, SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM); goto f_err; } else { s->s3->tmp.new_compression = comp; } #endif /* TLS extensions */ if (!ssl_parse_serverhello_tlsext(s, &p, d, n)) { SSLerr(SSL_F_SSL3_GET_SERVER_HELLO, SSL_R_PARSE_TLSEXT); goto err; } if (p != (d + n)) { /* wrong packet length */ al = SSL_AD_DECODE_ERROR; SSLerr(SSL_F_SSL3_GET_SERVER_HELLO, SSL_R_BAD_PACKET_LENGTH); goto f_err; } return (1); f_err: ssl3_send_alert(s, SSL3_AL_FATAL, al); err: s->state = SSL_ST_ERR; return (-1); } ",0 "static int qeth_query_ipassists_cb(struct qeth_card *card, struct qeth_reply *reply, unsigned long data) { struct qeth_ipa_cmd *cmd; QETH_DBF_TEXT(SETUP, 2, ""qipasscb""); cmd = (struct qeth_ipa_cmd *) data; switch (cmd->hdr.return_code) { case IPA_RC_NOTSUPP: case IPA_RC_L2_UNSUPPORTED_CMD: QETH_DBF_TEXT(SETUP, 2, ""ipaunsup""); card->options.ipa4.supported_funcs |= IPA_SETADAPTERPARMS; card->options.ipa6.supported_funcs |= IPA_SETADAPTERPARMS; return -0; default: if (cmd->hdr.return_code) { QETH_DBF_MESSAGE(1, ""%s IPA_CMD_QIPASSIST: Unhandled "" ""rc=%d\n"", dev_name(&card->gdev->dev), cmd->hdr.return_code); return 0; } } if (cmd->hdr.prot_version == QETH_PROT_IPV4) { card->options.ipa4.supported_funcs = cmd->hdr.ipa_supported; card->options.ipa4.enabled_funcs = cmd->hdr.ipa_enabled; } else if (cmd->hdr.prot_version == QETH_PROT_IPV6) { card->options.ipa6.supported_funcs = cmd->hdr.ipa_supported; card->options.ipa6.enabled_funcs = cmd->hdr.ipa_enabled; } else QETH_DBF_MESSAGE(1, ""%s IPA_CMD_QIPASSIST: Flawed LIC detected"" ""\n"", dev_name(&card->gdev->dev)); return 0; } ",0 " virtual bool IsCurrentlyOffline() const { return false; } ",0 " static int crypto_report_one(struct crypto_alg *alg, struct crypto_user_alg *ualg, struct sk_buff *skb) { memcpy(&ualg->cru_name, &alg->cra_name, sizeof(ualg->cru_name)); memcpy(&ualg->cru_driver_name, &alg->cra_driver_name, sizeof(ualg->cru_driver_name)); memcpy(&ualg->cru_module_name, module_name(alg->cra_module), CRYPTO_MAX_ALG_NAME); ualg->cru_flags = alg->cra_flags; ualg->cru_refcnt = atomic_read(&alg->cra_refcnt); if (nla_put_u32(skb, CRYPTOCFGA_PRIORITY_VAL, alg->cra_priority)) goto nla_put_failure; if (alg->cra_flags & CRYPTO_ALG_LARVAL) { struct crypto_report_larval rl; snprintf(rl.type, CRYPTO_MAX_ALG_NAME, ""%s"", ""larval""); if (nla_put(skb, CRYPTOCFGA_REPORT_LARVAL, sizeof(struct crypto_report_larval), &rl)) goto nla_put_failure; goto out; } if (alg->cra_type && alg->cra_type->report) { if (alg->cra_type->report(skb, alg)) goto nla_put_failure; goto out; } switch (alg->cra_flags & (CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_LARVAL)) { case CRYPTO_ALG_TYPE_CIPHER: if (crypto_report_cipher(skb, alg)) goto nla_put_failure; break; case CRYPTO_ALG_TYPE_COMPRESS: if (crypto_report_comp(skb, alg)) goto nla_put_failure; break; } out: return 0; nla_put_failure: return -EMSGSIZE; } ",1 "int64_t DataReductionProxySettings::GetTotalHttpContentLengthSaved() { DCHECK(thread_checker_.CalledOnValidThread()); return data_reduction_proxy_service_->compression_stats() ->GetHttpOriginalContentLength() - data_reduction_proxy_service_->compression_stats() ->GetHttpReceivedContentLength(); } ",0 "void BluetoothDeviceChromeOS::OnConnect(bool after_pairing, const base::Closure& callback) { if (--num_connecting_calls_ == 0) adapter_->NotifyDeviceChanged(this); DCHECK(num_connecting_calls_ >= 0); VLOG(1) << object_path_.value() << "": Connected, "" << num_connecting_calls_ << "" still in progress""; SetTrusted(); if (after_pairing) UMA_HISTOGRAM_ENUMERATION(""Bluetooth.PairingResult"", UMA_PAIRING_RESULT_SUCCESS, UMA_PAIRING_RESULT_COUNT); callback.Run(); } ",0 "SWFInput_file_getChar(SWFInput input) { int c = fgetc((FILE *)input->data); if ( c == EOF ) input->length = input->offset; else ++input->offset; return c; } ",0 "MagickExport QuantumInfo *DestroyQuantumInfo(QuantumInfo *quantum_info) { assert(quantum_info != (QuantumInfo *) NULL); assert(quantum_info->signature == MagickCoreSignature); if (quantum_info->pixels != (unsigned char **) NULL) DestroyQuantumPixels(quantum_info); if (quantum_info->semaphore != (SemaphoreInfo *) NULL) RelinquishSemaphoreInfo(&quantum_info->semaphore); quantum_info->signature=(~MagickCoreSignature); quantum_info=(QuantumInfo *) RelinquishMagickMemory(quantum_info); return(quantum_info); } ",0 " ScopedSendOnIOThread(int host_id, IPC::Message* msg) : host_id_(host_id), msg_(msg), cancelled_(false) { } ",0 "int __fsnotify_parent(const struct path *path, struct dentry *dentry, __u32 mask) { struct dentry *parent; struct inode *p_inode; int ret = 0; if (!dentry) dentry = path->dentry; if (!(dentry->d_flags & DCACHE_FSNOTIFY_PARENT_WATCHED)) return 0; parent = dget_parent(dentry); p_inode = parent->d_inode; if (unlikely(!fsnotify_inode_watches_children(p_inode))) __fsnotify_update_child_dentry_flags(p_inode); else if (p_inode->i_fsnotify_mask & mask) { /* we are notifying a parent so come up with the new mask which * specifies these are events which came from a child. */ mask |= FS_EVENT_ON_CHILD; if (path) ret = fsnotify(p_inode, mask, path, FSNOTIFY_EVENT_PATH, dentry->d_name.name, 0); else ret = fsnotify(p_inode, mask, dentry->d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0); } dput(parent); return ret; } ",1 "int x86_emulate_instruction(struct kvm_vcpu *vcpu, unsigned long cr2, int emulation_type, void *insn, int insn_len) { int r; struct x86_emulate_ctxt *ctxt = &vcpu->arch.emulate_ctxt; bool writeback = true; bool write_fault_to_spt = vcpu->arch.write_fault_to_shadow_pgtable; /* * Clear write_fault_to_shadow_pgtable here to ensure it is * never reused. */ vcpu->arch.write_fault_to_shadow_pgtable = false; kvm_clear_exception_queue(vcpu); if (!(emulation_type & EMULTYPE_NO_DECODE)) { init_emulate_ctxt(vcpu); /* * We will reenter on the same instruction since * we do not set complete_userspace_io. This does not * handle watchpoints yet, those would be handled in * the emulate_ops. */ if (kvm_vcpu_check_breakpoint(vcpu, &r)) return r; ctxt->interruptibility = 0; ctxt->have_exception = false; ctxt->exception.vector = -1; ctxt->perm_ok = false; ctxt->ud = emulation_type & EMULTYPE_TRAP_UD; r = x86_decode_insn(ctxt, insn, insn_len); trace_kvm_emulate_insn_start(vcpu); ++vcpu->stat.insn_emulation; if (r != EMULATION_OK) { if (emulation_type & EMULTYPE_TRAP_UD) return EMULATE_FAIL; if (reexecute_instruction(vcpu, cr2, write_fault_to_spt, emulation_type)) return EMULATE_DONE; if (emulation_type & EMULTYPE_SKIP) return EMULATE_FAIL; return handle_emulation_failure(vcpu); } } if (emulation_type & EMULTYPE_SKIP) { kvm_rip_write(vcpu, ctxt->_eip); if (ctxt->eflags & X86_EFLAGS_RF) kvm_set_rflags(vcpu, ctxt->eflags & ~X86_EFLAGS_RF); return EMULATE_DONE; } if (retry_instruction(ctxt, cr2, emulation_type)) return EMULATE_DONE; /* this is needed for vmware backdoor interface to work since it changes registers values during IO operation */ if (vcpu->arch.emulate_regs_need_sync_from_vcpu) { vcpu->arch.emulate_regs_need_sync_from_vcpu = false; emulator_invalidate_register_cache(ctxt); } restart: r = x86_emulate_insn(ctxt); if (r == EMULATION_INTERCEPTED) return EMULATE_DONE; if (r == EMULATION_FAILED) { if (reexecute_instruction(vcpu, cr2, write_fault_to_spt, emulation_type)) return EMULATE_DONE; return handle_emulation_failure(vcpu); } if (ctxt->have_exception) { r = EMULATE_DONE; if (inject_emulated_exception(vcpu)) return r; } else if (vcpu->arch.pio.count) { if (!vcpu->arch.pio.in) { /* FIXME: return into emulator if single-stepping. */ vcpu->arch.pio.count = 0; } else { writeback = false; vcpu->arch.complete_userspace_io = complete_emulated_pio; } r = EMULATE_USER_EXIT; } else if (vcpu->mmio_needed) { if (!vcpu->mmio_is_write) writeback = false; r = EMULATE_USER_EXIT; vcpu->arch.complete_userspace_io = complete_emulated_mmio; } else if (r == EMULATION_RESTART) goto restart; else r = EMULATE_DONE; if (writeback) { unsigned long rflags = kvm_x86_ops->get_rflags(vcpu); toggle_interruptibility(vcpu, ctxt->interruptibility); vcpu->arch.emulate_regs_need_sync_to_vcpu = false; if (vcpu->arch.hflags != ctxt->emul_flags) kvm_set_hflags(vcpu, ctxt->emul_flags); kvm_rip_write(vcpu, ctxt->eip); if (r == EMULATE_DONE) kvm_vcpu_check_singlestep(vcpu, rflags, &r); if (!ctxt->have_exception || exception_type(ctxt->exception.vector) == EXCPT_TRAP) __kvm_set_rflags(vcpu, ctxt->eflags); /* * For STI, interrupts are shadowed; so KVM_REQ_EVENT will * do nothing, and it will be requested again as soon as * the shadow expires. But we still need to check here, * because POPF has no interrupt shadow. */ if (unlikely((ctxt->eflags & ~rflags) & X86_EFLAGS_IF)) kvm_make_request(KVM_REQ_EVENT, vcpu); } else vcpu->arch.emulate_regs_need_sync_to_vcpu = true; return r; } ",0 "static int vmci_transport_notify_recv_post_dequeue( struct vsock_sock *vsk, size_t target, ssize_t copied, bool data_read, struct vsock_transport_recv_notify_data *data) { return vmci_trans(vsk)->notify_ops->recv_post_dequeue( &vsk->sk, target, copied, data_read, (struct vmci_transport_recv_notify_data *)data); } ",0 "bool WebPage::mouseEvent(const Platform::MouseEvent& mouseEvent, bool* wheelDeltaAccepted) { if (!d->m_mainFrame->view()) return false; if (d->m_page->defersLoading()) return false; PluginView* pluginView = d->m_fullScreenPluginView.get(); if (pluginView) return d->dispatchMouseEventToFullScreenPlugin(pluginView, mouseEvent); if (mouseEvent.type() == Platform::MouseEvent::MouseAborted) { d->m_mainFrame->eventHandler()->setMousePressed(false); return false; } d->m_pluginMayOpenNewTab = true; d->m_lastUserEventTimestamp = currentTime(); int clickCount = (d->m_selectionHandler->isSelectionActive() || mouseEvent.type() != Platform::MouseEvent::MouseMove) ? 1 : 0; MouseButton buttonType = NoButton; if (mouseEvent.isLeftButton()) buttonType = LeftButton; else if (mouseEvent.isRightButton()) buttonType = RightButton; else if (mouseEvent.isMiddleButton()) buttonType = MiddleButton; PlatformMouseEvent platformMouseEvent(d->mapFromTransformed(mouseEvent.position()), mouseEvent.screenPosition(), toWebCoreMouseEventType(mouseEvent.type()), clickCount, buttonType, mouseEvent.shiftActive(), mouseEvent.ctrlActive(), mouseEvent.altActive(), PointingDevice); d->m_lastMouseEvent = platformMouseEvent; bool success = d->handleMouseEvent(platformMouseEvent); if (mouseEvent.wheelTicks()) { PlatformWheelEvent wheelEvent(d->mapFromTransformed(mouseEvent.position()), mouseEvent.screenPosition(), 0, -mouseEvent.wheelDelta(), 0, -mouseEvent.wheelTicks(), ScrollByPixelWheelEvent, mouseEvent.shiftActive(), mouseEvent.ctrlActive(), mouseEvent.altActive(), false /* metaKey */); if (wheelDeltaAccepted) *wheelDeltaAccepted = d->handleWheelEvent(wheelEvent); } else if (wheelDeltaAccepted) *wheelDeltaAccepted = false; return success; } ",0 "static int may_mknod(mode_t mode) { switch (mode & S_IFMT) { case S_IFREG: case S_IFCHR: case S_IFBLK: case S_IFIFO: case S_IFSOCK: case 0: /* zero mode translates to S_IFREG */ return 0; case S_IFDIR: return -EPERM; default: return -EINVAL; } } ",0 "RenderProcessHostImpl::GetInProcessRendererThreadForTesting() { return g_in_process_thread; } ",0 "void RenderView::OnLoadBlockedPlugins() { NotificationService::current()->Notify(NotificationType::SHOULD_LOAD_PLUGINS, Source(this), NotificationService::NoDetails()); } ",0 "void __dev_remove_pack(struct packet_type *pt) { struct list_head *head = ptype_head(pt); struct packet_type *pt1; spin_lock(&ptype_lock); list_for_each_entry(pt1, head, list) { if (pt == pt1) { list_del_rcu(&pt->list); goto out; } } pr_warn(""dev_remove_pack: %p not found\n"", pt); out: spin_unlock(&ptype_lock); } ",0 "status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) { ALOGV(""entering parseChunk %lld/%d"", *offset, depth); uint32_t hdr[2]; if (mDataSource->readAt(*offset, hdr, 8) < 8) { return ERROR_IO; } uint64_t chunk_size = ntohl(hdr[0]); uint32_t chunk_type = ntohl(hdr[1]); off64_t data_offset = *offset + 8; if (chunk_size == 1) { if (mDataSource->readAt(*offset + 8, &chunk_size, 8) < 8) { return ERROR_IO; } chunk_size = ntoh64(chunk_size); data_offset += 8; if (chunk_size < 16) { return ERROR_MALFORMED; } } else if (chunk_size == 0) { if (depth == 0) { off64_t sourceSize; if (mDataSource->getSize(&sourceSize) == OK) { chunk_size = (sourceSize - *offset); } else { ALOGE(""atom size is 0, and data source has no size""); return ERROR_MALFORMED; } } else { *offset += 4; return OK; } } else if (chunk_size < 8) { ALOGE(""invalid chunk size: %"" PRIu64, chunk_size); return ERROR_MALFORMED; } char chunk[5]; MakeFourCCString(chunk_type, chunk); ALOGV(""chunk: %s @ %lld, %d"", chunk, *offset, depth); #if 0 static const char kWhitespace[] = "" ""; const char *indent = &kWhitespace[sizeof(kWhitespace) - 1 - 2 * depth]; printf(""%sfound chunk '%s' of size %"" PRIu64 ""\n"", indent, chunk, chunk_size); char buffer[256]; size_t n = chunk_size; if (n > sizeof(buffer)) { n = sizeof(buffer); } if (mDataSource->readAt(*offset, buffer, n) < (ssize_t)n) { return ERROR_IO; } hexdump(buffer, n); #endif PathAdder autoAdder(&mPath, chunk_type); off64_t chunk_data_size = *offset + chunk_size - data_offset; if (chunk_type != FOURCC('c', 'p', 'r', 't') && chunk_type != FOURCC('c', 'o', 'v', 'r') && mPath.size() == 5 && underMetaDataPath(mPath)) { off64_t stop_offset = *offset + chunk_size; *offset = data_offset; while (*offset < stop_offset) { status_t err = parseChunk(offset, depth + 1); if (err != OK) { return err; } } if (*offset != stop_offset) { return ERROR_MALFORMED; } return OK; } switch(chunk_type) { case FOURCC('m', 'o', 'o', 'v'): case FOURCC('t', 'r', 'a', 'k'): case FOURCC('m', 'd', 'i', 'a'): case FOURCC('m', 'i', 'n', 'f'): case FOURCC('d', 'i', 'n', 'f'): case FOURCC('s', 't', 'b', 'l'): case FOURCC('m', 'v', 'e', 'x'): case FOURCC('m', 'o', 'o', 'f'): case FOURCC('t', 'r', 'a', 'f'): case FOURCC('m', 'f', 'r', 'a'): case FOURCC('u', 'd', 't', 'a'): case FOURCC('i', 'l', 's', 't'): case FOURCC('s', 'i', 'n', 'f'): case FOURCC('s', 'c', 'h', 'i'): case FOURCC('e', 'd', 't', 's'): { if (chunk_type == FOURCC('s', 't', 'b', 'l')) { ALOGV(""sampleTable chunk is %"" PRIu64 "" bytes long."", chunk_size); if (mDataSource->flags() & (DataSource::kWantsPrefetching | DataSource::kIsCachingDataSource)) { sp cachedSource = new MPEG4DataSource(mDataSource); if (cachedSource->setCachedRange(*offset, chunk_size) == OK) { mDataSource = cachedSource; } } mLastTrack->sampleTable = new SampleTable(mDataSource); } bool isTrack = false; if (chunk_type == FOURCC('t', 'r', 'a', 'k')) { isTrack = true; Track *track = new Track; track->next = NULL; if (mLastTrack) { mLastTrack->next = track; } else { mFirstTrack = track; } mLastTrack = track; track->meta = new MetaData; track->includes_expensive_metadata = false; track->skipTrack = false; track->timescale = 0; track->meta->setCString(kKeyMIMEType, ""application/octet-stream""); } off64_t stop_offset = *offset + chunk_size; *offset = data_offset; while (*offset < stop_offset) { status_t err = parseChunk(offset, depth + 1); if (err != OK) { return err; } } if (*offset != stop_offset) { return ERROR_MALFORMED; } if (isTrack) { if (mLastTrack->skipTrack) { Track *cur = mFirstTrack; if (cur == mLastTrack) { delete cur; mFirstTrack = mLastTrack = NULL; } else { while (cur && cur->next != mLastTrack) { cur = cur->next; } cur->next = NULL; delete mLastTrack; mLastTrack = cur; } return OK; } status_t err = verifyTrack(mLastTrack); if (err != OK) { return err; } } else if (chunk_type == FOURCC('m', 'o', 'o', 'v')) { mInitCheck = OK; if (!mIsDrm) { return UNKNOWN_ERROR; // Return a dummy error. } else { return OK; } } break; } case FOURCC('e', 'l', 's', 't'): { *offset += chunk_size; uint8_t version; if (mDataSource->readAt(data_offset, &version, 1) < 1) { return ERROR_IO; } uint32_t entry_count; if (!mDataSource->getUInt32(data_offset + 4, &entry_count)) { return ERROR_IO; } if (entry_count != 1) { ALOGW(""ignoring edit list with %d entries"", entry_count); } else if (mHeaderTimescale == 0) { ALOGW(""ignoring edit list because timescale is 0""); } else { off64_t entriesoffset = data_offset + 8; uint64_t segment_duration; int64_t media_time; if (version == 1) { if (!mDataSource->getUInt64(entriesoffset, &segment_duration) || !mDataSource->getUInt64(entriesoffset + 8, (uint64_t*)&media_time)) { return ERROR_IO; } } else if (version == 0) { uint32_t sd; int32_t mt; if (!mDataSource->getUInt32(entriesoffset, &sd) || !mDataSource->getUInt32(entriesoffset + 4, (uint32_t*)&mt)) { return ERROR_IO; } segment_duration = sd; media_time = mt; } else { return ERROR_IO; } uint64_t halfscale = mHeaderTimescale / 2; segment_duration = (segment_duration * 1000000 + halfscale)/ mHeaderTimescale; media_time = (media_time * 1000000 + halfscale) / mHeaderTimescale; int64_t duration; int32_t samplerate; if (!mLastTrack) { return ERROR_MALFORMED; } if (mLastTrack->meta->findInt64(kKeyDuration, &duration) && mLastTrack->meta->findInt32(kKeySampleRate, &samplerate)) { int64_t delay = (media_time * samplerate + 500000) / 1000000; mLastTrack->meta->setInt32(kKeyEncoderDelay, delay); int64_t paddingus = duration - (segment_duration + media_time); if (paddingus < 0) { paddingus = 0; } int64_t paddingsamples = (paddingus * samplerate + 500000) / 1000000; mLastTrack->meta->setInt32(kKeyEncoderPadding, paddingsamples); } } break; } case FOURCC('f', 'r', 'm', 'a'): { *offset += chunk_size; uint32_t original_fourcc; if (mDataSource->readAt(data_offset, &original_fourcc, 4) < 4) { return ERROR_IO; } original_fourcc = ntohl(original_fourcc); ALOGV(""read original format: %d"", original_fourcc); mLastTrack->meta->setCString(kKeyMIMEType, FourCC2MIME(original_fourcc)); uint32_t num_channels = 0; uint32_t sample_rate = 0; if (AdjustChannelsAndRate(original_fourcc, &num_channels, &sample_rate)) { mLastTrack->meta->setInt32(kKeyChannelCount, num_channels); mLastTrack->meta->setInt32(kKeySampleRate, sample_rate); } break; } case FOURCC('t', 'e', 'n', 'c'): { *offset += chunk_size; if (chunk_size < 32) { return ERROR_MALFORMED; } char buf[4]; memset(buf, 0, 4); if (mDataSource->readAt(data_offset + 4, buf + 1, 3) < 3) { return ERROR_IO; } uint32_t defaultAlgorithmId = ntohl(*((int32_t*)buf)); if (defaultAlgorithmId > 1) { return ERROR_MALFORMED; } memset(buf, 0, 4); if (mDataSource->readAt(data_offset + 7, buf + 3, 1) < 1) { return ERROR_IO; } uint32_t defaultIVSize = ntohl(*((int32_t*)buf)); if ((defaultAlgorithmId == 0 && defaultIVSize != 0) || (defaultAlgorithmId != 0 && defaultIVSize == 0)) { return ERROR_MALFORMED; } else if (defaultIVSize != 0 && defaultIVSize != 8 && defaultIVSize != 16) { return ERROR_MALFORMED; } uint8_t defaultKeyId[16]; if (mDataSource->readAt(data_offset + 8, &defaultKeyId, 16) < 16) { return ERROR_IO; } mLastTrack->meta->setInt32(kKeyCryptoMode, defaultAlgorithmId); mLastTrack->meta->setInt32(kKeyCryptoDefaultIVSize, defaultIVSize); mLastTrack->meta->setData(kKeyCryptoKey, 'tenc', defaultKeyId, 16); break; } case FOURCC('t', 'k', 'h', 'd'): { *offset += chunk_size; status_t err; if ((err = parseTrackHeader(data_offset, chunk_data_size)) != OK) { return err; } break; } case FOURCC('p', 's', 's', 'h'): { *offset += chunk_size; PsshInfo pssh; if (mDataSource->readAt(data_offset + 4, &pssh.uuid, 16) < 16) { return ERROR_IO; } uint32_t psshdatalen = 0; if (mDataSource->readAt(data_offset + 20, &psshdatalen, 4) < 4) { return ERROR_IO; } pssh.datalen = ntohl(psshdatalen); ALOGV(""pssh data size: %d"", pssh.datalen); if (pssh.datalen + 20 > chunk_size) { return ERROR_MALFORMED; } pssh.data = new (std::nothrow) uint8_t[pssh.datalen]; if (pssh.data == NULL) { return ERROR_MALFORMED; } ALOGV(""allocated pssh @ %p"", pssh.data); ssize_t requested = (ssize_t) pssh.datalen; if (mDataSource->readAt(data_offset + 24, pssh.data, requested) < requested) { return ERROR_IO; } mPssh.push_back(pssh); break; } case FOURCC('m', 'd', 'h', 'd'): { *offset += chunk_size; if (chunk_data_size < 4 || mLastTrack == NULL) { return ERROR_MALFORMED; } uint8_t version; if (mDataSource->readAt( data_offset, &version, sizeof(version)) < (ssize_t)sizeof(version)) { return ERROR_IO; } off64_t timescale_offset; if (version == 1) { timescale_offset = data_offset + 4 + 16; } else if (version == 0) { timescale_offset = data_offset + 4 + 8; } else { return ERROR_IO; } uint32_t timescale; if (mDataSource->readAt( timescale_offset, ×cale, sizeof(timescale)) < (ssize_t)sizeof(timescale)) { return ERROR_IO; } mLastTrack->timescale = ntohl(timescale); int64_t duration = 0; if (version == 1) { if (mDataSource->readAt( timescale_offset + 4, &duration, sizeof(duration)) < (ssize_t)sizeof(duration)) { return ERROR_IO; } if (duration != -1) { duration = ntoh64(duration); } } else { uint32_t duration32; if (mDataSource->readAt( timescale_offset + 4, &duration32, sizeof(duration32)) < (ssize_t)sizeof(duration32)) { return ERROR_IO; } if (duration32 != 0xffffffff) { duration = ntohl(duration32); } } if (duration != 0) { mLastTrack->meta->setInt64( kKeyDuration, (duration * 1000000) / mLastTrack->timescale); } uint8_t lang[2]; off64_t lang_offset; if (version == 1) { lang_offset = timescale_offset + 4 + 8; } else if (version == 0) { lang_offset = timescale_offset + 4 + 4; } else { return ERROR_IO; } if (mDataSource->readAt(lang_offset, &lang, sizeof(lang)) < (ssize_t)sizeof(lang)) { return ERROR_IO; } char lang_code[4]; lang_code[0] = ((lang[0] >> 2) & 0x1f) + 0x60; lang_code[1] = ((lang[0] & 0x3) << 3 | (lang[1] >> 5)) + 0x60; lang_code[2] = (lang[1] & 0x1f) + 0x60; lang_code[3] = '\0'; mLastTrack->meta->setCString( kKeyMediaLanguage, lang_code); break; } case FOURCC('s', 't', 's', 'd'): { if (chunk_data_size < 8) { return ERROR_MALFORMED; } uint8_t buffer[8]; if (chunk_data_size < (off64_t)sizeof(buffer)) { return ERROR_MALFORMED; } if (mDataSource->readAt( data_offset, buffer, 8) < 8) { return ERROR_IO; } if (U32_AT(buffer) != 0) { return ERROR_MALFORMED; } uint32_t entry_count = U32_AT(&buffer[4]); if (entry_count > 1) { const char *mime; CHECK(mLastTrack->meta->findCString(kKeyMIMEType, &mime)); if (strcasecmp(mime, MEDIA_MIMETYPE_TEXT_3GPP) && strcasecmp(mime, ""application/octet-stream"")) { mLastTrack->skipTrack = true; *offset += chunk_size; break; } } off64_t stop_offset = *offset + chunk_size; *offset = data_offset + 8; for (uint32_t i = 0; i < entry_count; ++i) { status_t err = parseChunk(offset, depth + 1); if (err != OK) { return err; } } if (*offset != stop_offset) { return ERROR_MALFORMED; } break; } case FOURCC('m', 'p', '4', 'a'): case FOURCC('e', 'n', 'c', 'a'): case FOURCC('s', 'a', 'm', 'r'): case FOURCC('s', 'a', 'w', 'b'): { uint8_t buffer[8 + 20]; if (chunk_data_size < (ssize_t)sizeof(buffer)) { return ERROR_MALFORMED; } if (mDataSource->readAt( data_offset, buffer, sizeof(buffer)) < (ssize_t)sizeof(buffer)) { return ERROR_IO; } uint16_t data_ref_index = U16_AT(&buffer[6]); uint32_t num_channels = U16_AT(&buffer[16]); uint16_t sample_size = U16_AT(&buffer[18]); uint32_t sample_rate = U32_AT(&buffer[24]) >> 16; if (chunk_type != FOURCC('e', 'n', 'c', 'a')) { mLastTrack->meta->setCString(kKeyMIMEType, FourCC2MIME(chunk_type)); AdjustChannelsAndRate(chunk_type, &num_channels, &sample_rate); } ALOGV(""*** coding='%s' %d channels, size %d, rate %d\n"", chunk, num_channels, sample_size, sample_rate); mLastTrack->meta->setInt32(kKeyChannelCount, num_channels); mLastTrack->meta->setInt32(kKeySampleRate, sample_rate); off64_t stop_offset = *offset + chunk_size; *offset = data_offset + sizeof(buffer); while (*offset < stop_offset) { status_t err = parseChunk(offset, depth + 1); if (err != OK) { return err; } } if (*offset != stop_offset) { return ERROR_MALFORMED; } break; } case FOURCC('m', 'p', '4', 'v'): case FOURCC('e', 'n', 'c', 'v'): case FOURCC('s', '2', '6', '3'): case FOURCC('H', '2', '6', '3'): case FOURCC('h', '2', '6', '3'): case FOURCC('a', 'v', 'c', '1'): case FOURCC('h', 'v', 'c', '1'): case FOURCC('h', 'e', 'v', '1'): { mHasVideo = true; uint8_t buffer[78]; if (chunk_data_size < (ssize_t)sizeof(buffer)) { return ERROR_MALFORMED; } if (mDataSource->readAt( data_offset, buffer, sizeof(buffer)) < (ssize_t)sizeof(buffer)) { return ERROR_IO; } uint16_t data_ref_index = U16_AT(&buffer[6]); uint16_t width = U16_AT(&buffer[6 + 18]); uint16_t height = U16_AT(&buffer[6 + 20]); if (width == 0) width = 352; if (height == 0) height = 288; if (chunk_type != FOURCC('e', 'n', 'c', 'v')) { mLastTrack->meta->setCString(kKeyMIMEType, FourCC2MIME(chunk_type)); } mLastTrack->meta->setInt32(kKeyWidth, width); mLastTrack->meta->setInt32(kKeyHeight, height); off64_t stop_offset = *offset + chunk_size; *offset = data_offset + sizeof(buffer); while (*offset < stop_offset) { status_t err = parseChunk(offset, depth + 1); if (err != OK) { return err; } } if (*offset != stop_offset) { return ERROR_MALFORMED; } break; } case FOURCC('s', 't', 'c', 'o'): case FOURCC('c', 'o', '6', '4'): { status_t err = mLastTrack->sampleTable->setChunkOffsetParams( chunk_type, data_offset, chunk_data_size); *offset += chunk_size; if (err != OK) { return err; } break; } case FOURCC('s', 't', 's', 'c'): { status_t err = mLastTrack->sampleTable->setSampleToChunkParams( data_offset, chunk_data_size); *offset += chunk_size; if (err != OK) { return err; } break; } case FOURCC('s', 't', 's', 'z'): case FOURCC('s', 't', 'z', '2'): { status_t err = mLastTrack->sampleTable->setSampleSizeParams( chunk_type, data_offset, chunk_data_size); *offset += chunk_size; if (err != OK) { return err; } size_t max_size; err = mLastTrack->sampleTable->getMaxSampleSize(&max_size); if (err != OK) { return err; } if (max_size != 0) { mLastTrack->meta->setInt32(kKeyMaxInputSize, max_size + 10 * 2); } else { int32_t width, height; if (!mLastTrack->meta->findInt32(kKeyWidth, &width) || !mLastTrack->meta->findInt32(kKeyHeight, &height)) { ALOGE(""No width or height, assuming worst case 1080p""); width = 1920; height = 1080; } const char *mime; CHECK(mLastTrack->meta->findCString(kKeyMIMEType, &mime)); if (!strcmp(mime, MEDIA_MIMETYPE_VIDEO_AVC)) { max_size = ((width + 15) / 16) * ((height + 15) / 16) * 192; } else { max_size = width * height * 3 / 2; } mLastTrack->meta->setInt32(kKeyMaxInputSize, max_size); } const char *mime; CHECK(mLastTrack->meta->findCString(kKeyMIMEType, &mime)); if (!strncasecmp(""video/"", mime, 6)) { size_t nSamples = mLastTrack->sampleTable->countSamples(); int64_t durationUs; if (mLastTrack->meta->findInt64(kKeyDuration, &durationUs)) { if (durationUs > 0) { int32_t frameRate = (nSamples * 1000000LL + (durationUs >> 1)) / durationUs; mLastTrack->meta->setInt32(kKeyFrameRate, frameRate); } } } break; } case FOURCC('s', 't', 't', 's'): { *offset += chunk_size; status_t err = mLastTrack->sampleTable->setTimeToSampleParams( data_offset, chunk_data_size); if (err != OK) { return err; } break; } case FOURCC('c', 't', 't', 's'): { *offset += chunk_size; status_t err = mLastTrack->sampleTable->setCompositionTimeToSampleParams( data_offset, chunk_data_size); if (err != OK) { return err; } break; } case FOURCC('s', 't', 's', 's'): { *offset += chunk_size; status_t err = mLastTrack->sampleTable->setSyncSampleParams( data_offset, chunk_data_size); if (err != OK) { return err; } break; } case FOURCC('\xA9', 'x', 'y', 'z'): { *offset += chunk_size; if (chunk_data_size < 8) { return ERROR_MALFORMED; } char buffer[18]; off64_t location_length = chunk_data_size - 5; if (location_length >= (off64_t) sizeof(buffer)) { return ERROR_MALFORMED; } if (mDataSource->readAt( data_offset + 4, buffer, location_length) < location_length) { return ERROR_IO; } buffer[location_length] = '\0'; mFileMetaData->setCString(kKeyLocation, buffer); break; } case FOURCC('e', 's', 'd', 's'): { *offset += chunk_size; if (chunk_data_size < 4) { return ERROR_MALFORMED; } uint8_t buffer[256]; if (chunk_data_size > (off64_t)sizeof(buffer)) { return ERROR_BUFFER_TOO_SMALL; } if (mDataSource->readAt( data_offset, buffer, chunk_data_size) < chunk_data_size) { return ERROR_IO; } if (U32_AT(buffer) != 0) { return ERROR_MALFORMED; } mLastTrack->meta->setData( kKeyESDS, kTypeESDS, &buffer[4], chunk_data_size - 4); if (mPath.size() >= 2 && mPath[mPath.size() - 2] == FOURCC('m', 'p', '4', 'a')) { status_t err = updateAudioTrackInfoFromESDS_MPEG4Audio( &buffer[4], chunk_data_size - 4); if (err != OK) { return err; } } break; } case FOURCC('a', 'v', 'c', 'C'): { *offset += chunk_size; sp buffer = new ABuffer(chunk_data_size); if (mDataSource->readAt( data_offset, buffer->data(), chunk_data_size) < chunk_data_size) { return ERROR_IO; } mLastTrack->meta->setData( kKeyAVCC, kTypeAVCC, buffer->data(), chunk_data_size); break; } case FOURCC('h', 'v', 'c', 'C'): { sp buffer = new ABuffer(chunk_data_size); if (mDataSource->readAt( data_offset, buffer->data(), chunk_data_size) < chunk_data_size) { return ERROR_IO; } mLastTrack->meta->setData( kKeyHVCC, kTypeHVCC, buffer->data(), chunk_data_size); *offset += chunk_size; break; } case FOURCC('d', '2', '6', '3'): { *offset += chunk_size; /* * d263 contains a fixed 7 bytes part: * vendor - 4 bytes * version - 1 byte * level - 1 byte * profile - 1 byte * optionally, ""d263"" box itself may contain a 16-byte * bit rate box (bitr) * average bit rate - 4 bytes * max bit rate - 4 bytes */ char buffer[23]; if (chunk_data_size != 7 && chunk_data_size != 23) { ALOGE(""Incorrect D263 box size %lld"", chunk_data_size); return ERROR_MALFORMED; } if (mDataSource->readAt( data_offset, buffer, chunk_data_size) < chunk_data_size) { return ERROR_IO; } mLastTrack->meta->setData(kKeyD263, kTypeD263, buffer, chunk_data_size); break; } case FOURCC('m', 'e', 't', 'a'): { uint8_t buffer[4]; if (chunk_data_size < (off64_t)sizeof(buffer)) { *offset += chunk_size; return ERROR_MALFORMED; } if (mDataSource->readAt( data_offset, buffer, 4) < 4) { *offset += chunk_size; return ERROR_IO; } if (U32_AT(buffer) != 0) { *offset += chunk_size; return OK; } off64_t stop_offset = *offset + chunk_size; *offset = data_offset + sizeof(buffer); while (*offset < stop_offset) { status_t err = parseChunk(offset, depth + 1); if (err != OK) { return err; } } if (*offset != stop_offset) { return ERROR_MALFORMED; } break; } case FOURCC('m', 'e', 'a', 'n'): case FOURCC('n', 'a', 'm', 'e'): case FOURCC('d', 'a', 't', 'a'): { *offset += chunk_size; if (mPath.size() == 6 && underMetaDataPath(mPath)) { status_t err = parseITunesMetaData(data_offset, chunk_data_size); if (err != OK) { return err; } } break; } case FOURCC('m', 'v', 'h', 'd'): { *offset += chunk_size; if (chunk_data_size < 32) { return ERROR_MALFORMED; } uint8_t header[32]; if (mDataSource->readAt( data_offset, header, sizeof(header)) < (ssize_t)sizeof(header)) { return ERROR_IO; } uint64_t creationTime; uint64_t duration = 0; if (header[0] == 1) { creationTime = U64_AT(&header[4]); mHeaderTimescale = U32_AT(&header[20]); duration = U64_AT(&header[24]); if (duration == 0xffffffffffffffff) { duration = 0; } } else if (header[0] != 0) { return ERROR_MALFORMED; } else { creationTime = U32_AT(&header[4]); mHeaderTimescale = U32_AT(&header[12]); uint32_t d32 = U32_AT(&header[16]); if (d32 == 0xffffffff) { d32 = 0; } duration = d32; } if (duration != 0) { mFileMetaData->setInt64(kKeyDuration, duration * 1000000 / mHeaderTimescale); } String8 s; convertTimeToDate(creationTime, &s); mFileMetaData->setCString(kKeyDate, s.string()); break; } case FOURCC('m', 'e', 'h', 'd'): { *offset += chunk_size; if (chunk_data_size < 8) { return ERROR_MALFORMED; } uint8_t flags[4]; if (mDataSource->readAt( data_offset, flags, sizeof(flags)) < (ssize_t)sizeof(flags)) { return ERROR_IO; } uint64_t duration = 0; if (flags[0] == 1) { if (chunk_data_size < 12) { return ERROR_MALFORMED; } mDataSource->getUInt64(data_offset + 4, &duration); if (duration == 0xffffffffffffffff) { duration = 0; } } else if (flags[0] == 0) { uint32_t d32; mDataSource->getUInt32(data_offset + 4, &d32); if (d32 == 0xffffffff) { d32 = 0; } duration = d32; } else { return ERROR_MALFORMED; } if (duration != 0) { mFileMetaData->setInt64(kKeyDuration, duration * 1000000 / mHeaderTimescale); } break; } case FOURCC('m', 'd', 'a', 't'): { ALOGV(""mdat chunk, drm: %d"", mIsDrm); if (!mIsDrm) { *offset += chunk_size; break; } if (chunk_size < 8) { return ERROR_MALFORMED; } return parseDrmSINF(offset, data_offset); } case FOURCC('h', 'd', 'l', 'r'): { *offset += chunk_size; uint32_t buffer; if (mDataSource->readAt( data_offset + 8, &buffer, 4) < 4) { return ERROR_IO; } uint32_t type = ntohl(buffer); if (type == FOURCC('t', 'e', 'x', 't') || type == FOURCC('s', 'b', 't', 'l')) { mLastTrack->meta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_TEXT_3GPP); } break; } case FOURCC('t', 'r', 'e', 'x'): { *offset += chunk_size; if (chunk_data_size < 24) { return ERROR_IO; } uint32_t duration; Trex trex; if (!mDataSource->getUInt32(data_offset + 4, &trex.track_ID) || !mDataSource->getUInt32(data_offset + 8, &trex.default_sample_description_index) || !mDataSource->getUInt32(data_offset + 12, &trex.default_sample_duration) || !mDataSource->getUInt32(data_offset + 16, &trex.default_sample_size) || !mDataSource->getUInt32(data_offset + 20, &trex.default_sample_flags)) { return ERROR_IO; } mTrex.add(trex); break; } case FOURCC('t', 'x', '3', 'g'): { uint32_t type; const void *data; size_t size = 0; if (!mLastTrack->meta->findData( kKeyTextFormatData, &type, &data, &size)) { size = 0; } if (SIZE_MAX - chunk_size <= size) { return ERROR_MALFORMED; } uint8_t *buffer = new uint8_t[size + chunk_size]; if (buffer == NULL) { return ERROR_MALFORMED; } if (size > 0) { memcpy(buffer, data, size); } if ((size_t)(mDataSource->readAt(*offset, buffer + size, chunk_size)) < chunk_size) { delete[] buffer; buffer = NULL; *offset += chunk_size; return ERROR_IO; } mLastTrack->meta->setData( kKeyTextFormatData, 0, buffer, size + chunk_size); delete[] buffer; *offset += chunk_size; break; } case FOURCC('c', 'o', 'v', 'r'): { *offset += chunk_size; if (mFileMetaData != NULL) { ALOGV(""chunk_data_size = %lld and data_offset = %lld"", chunk_data_size, data_offset); if (chunk_data_size >= SIZE_MAX - 1) { return ERROR_MALFORMED; } sp buffer = new ABuffer(chunk_data_size + 1); if (mDataSource->readAt( data_offset, buffer->data(), chunk_data_size) != (ssize_t)chunk_data_size) { return ERROR_IO; } const int kSkipBytesOfDataBox = 16; if (chunk_data_size <= kSkipBytesOfDataBox) { return ERROR_MALFORMED; } mFileMetaData->setData( kKeyAlbumArt, MetaData::TYPE_NONE, buffer->data() + kSkipBytesOfDataBox, chunk_data_size - kSkipBytesOfDataBox); } break; } case FOURCC('t', 'i', 't', 'l'): case FOURCC('p', 'e', 'r', 'f'): case FOURCC('a', 'u', 't', 'h'): case FOURCC('g', 'n', 'r', 'e'): case FOURCC('a', 'l', 'b', 'm'): case FOURCC('y', 'r', 'r', 'c'): { *offset += chunk_size; status_t err = parse3GPPMetaData(data_offset, chunk_data_size, depth); if (err != OK) { return err; } break; } case FOURCC('I', 'D', '3', '2'): { *offset += chunk_size; if (chunk_data_size < 6) { return ERROR_MALFORMED; } parseID3v2MetaData(data_offset + 6); break; } case FOURCC('-', '-', '-', '-'): { mLastCommentMean.clear(); mLastCommentName.clear(); mLastCommentData.clear(); *offset += chunk_size; break; } case FOURCC('s', 'i', 'd', 'x'): { parseSegmentIndex(data_offset, chunk_data_size); *offset += chunk_size; return UNKNOWN_ERROR; // stop parsing after sidx } default: { *offset += chunk_size; break; } } return OK; } ",1 "static void free_ftrace_hash_rcu(struct ftrace_hash *hash) { if (!hash || hash == EMPTY_HASH) return; call_rcu_sched(&hash->rcu, __free_ftrace_hash_rcu); } ",0 "ScopedRenderBufferBinder::~ScopedRenderBufferBinder() { ScopedGLErrorSuppressor suppressor(decoder_); glBindRenderbufferEXT( GL_RENDERBUFFER, decoder_->bound_renderbuffer_ ? decoder_->bound_renderbuffer_->service_id() : 0); } ",0 "mark_all_guards_maybe_reachable(guard_selection_t *gs) { tor_assert(gs); SMARTLIST_FOREACH_BEGIN(gs->sampled_entry_guards, entry_guard_t *, guard) { mark_guard_maybe_reachable(guard); } SMARTLIST_FOREACH_END(guard); } ",0 "call_allocate(struct rpc_task *task) { unsigned int slack = task->tk_rqstp->rq_cred->cr_auth->au_cslack; struct rpc_rqst *req = task->tk_rqstp; struct rpc_xprt *xprt = task->tk_xprt; struct rpc_procinfo *proc = task->tk_msg.rpc_proc; dprint_status(task); task->tk_status = 0; task->tk_action = call_bind; if (req->rq_buffer) return; if (proc->p_proc != 0) { BUG_ON(proc->p_arglen == 0); if (proc->p_decode != NULL) BUG_ON(proc->p_replen == 0); } /* * Calculate the size (in quads) of the RPC call * and reply headers, and convert both values * to byte sizes. */ req->rq_callsize = RPC_CALLHDRSIZE + (slack << 1) + proc->p_arglen; req->rq_callsize <<= 2; req->rq_rcvsize = RPC_REPHDRSIZE + slack + proc->p_replen; req->rq_rcvsize <<= 2; req->rq_buffer = xprt->ops->buf_alloc(task, req->rq_callsize + req->rq_rcvsize); if (req->rq_buffer != NULL) return; dprintk(""RPC: %5u rpc_buffer allocation failed\n"", task->tk_pid); if (RPC_IS_ASYNC(task) || !signalled()) { task->tk_action = call_allocate; rpc_delay(task, HZ>>4); return; } rpc_exit(task, -ERESTARTSYS); } ",0 "static void dequantization_int(int x, int y, Jpeg2000Cblk *cblk, Jpeg2000Component *comp, Jpeg2000T1Context *t1, Jpeg2000Band *band) { int i, j; int w = cblk->coord[0][1] - cblk->coord[0][0]; for (j = 0; j < (cblk->coord[1][1] - cblk->coord[1][0]); ++j) { int32_t *datap = &comp->i_data[(comp->coord[0][1] - comp->coord[0][0]) * (y + j) + x]; int *src = t1->data[j]; for (i = 0; i < w; ++i) datap[i] = (src[i] * band->i_stepsize + (1 << 14)) >> 15; } } ",0 "int nlm_async_reply(struct nlm_rqst *req, u32 proc, const struct rpc_call_ops *tk_ops) { struct rpc_message msg = { .rpc_argp = &req->a_res, }; return nlm_do_async_call(req, proc, &msg, tk_ops); } ",0 "static int tiocsti(struct tty_struct *tty, char __user *p) { char ch, mbz = 0; struct tty_ldisc *ld; if ((current->signal->tty != tty) && !capable(CAP_SYS_ADMIN)) return -EPERM; if (get_user(ch, p)) return -EFAULT; tty_audit_tiocsti(tty, ch); ld = tty_ldisc_ref_wait(tty); ld->ops->receive_buf(tty, &ch, &mbz, 1); tty_ldisc_deref(ld); return 0; } ",0 "void ewk_frame_editor_client_contents_changed(Evas_Object* ewkFrame) { evas_object_smart_callback_call(ewkFrame, ""editorclient,contents,changed"", 0); EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData); ewk_view_editor_client_contents_changed(smartData->view); } ",0 "void BrowserPluginGuest::SetFocus(bool focused) { if (focused_ == focused) return; focused_ = focused; Send(new ViewMsg_SetFocus(routing_id(), focused)); } ",0 "void WebGLRenderingContextBase::framebufferRenderbuffer( GLenum target, GLenum attachment, GLenum renderbuffertarget, WebGLRenderbuffer* buffer) { if (isContextLost() || !ValidateFramebufferFuncParameters( ""framebufferRenderbuffer"", target, attachment)) return; if (renderbuffertarget != GL_RENDERBUFFER) { SynthesizeGLError(GL_INVALID_ENUM, ""framebufferRenderbuffer"", ""invalid target""); return; } if (buffer && (!buffer->HasEverBeenBound() || !buffer->Validate(ContextGroup(), this))) { SynthesizeGLError(GL_INVALID_OPERATION, ""framebufferRenderbuffer"", ""buffer never bound or buffer not from this context""); return; } WebGLFramebuffer* framebuffer_binding = GetFramebufferBinding(target); if (!framebuffer_binding || !framebuffer_binding->Object()) { SynthesizeGLError(GL_INVALID_OPERATION, ""framebufferRenderbuffer"", ""no framebuffer bound""); return; } if (framebuffer_binding && framebuffer_binding->Opaque()) { SynthesizeGLError(GL_INVALID_OPERATION, ""framebufferRenderbuffer"", ""opaque framebuffer bound""); return; } framebuffer_binding->SetAttachmentForBoundFramebuffer(target, attachment, buffer); ApplyStencilTest(); } ",0 "char *_dom_get_valid_file_path(char *source, char *resolved_path, int resolved_path_len TSRMLS_DC) /* {{{ */ { xmlURI *uri; xmlChar *escsource; char *file_dest; int isFileUri = 0; uri = xmlCreateURI(); escsource = xmlURIEscapeStr(source, "":""); xmlParseURIReference(uri, escsource); xmlFree(escsource); if (uri->scheme != NULL) { /* absolute file uris - libxml only supports localhost or empty host */ #ifdef PHP_WIN32 if (strncasecmp(source, ""file://"",7) == 0 && ':' == source[8]) { isFileUri = 1; source += 7; } else #endif if (strncasecmp(source, ""file:///"",8) == 0) { isFileUri = 1; #ifdef PHP_WIN32 source += 8; #else source += 7; #endif } else if (strncasecmp(source, ""file://localhost/"",17) == 0) { isFileUri = 1; #ifdef PHP_WIN32 source += 17; #else source += 16; #endif } } file_dest = source; if ((uri->scheme == NULL || isFileUri)) { /* XXX possible buffer overflow if VCWD_REALPATH does not know size of resolved_path */ if (!VCWD_REALPATH(source, resolved_path) && !expand_filepath(source, resolved_path TSRMLS_CC)) { xmlFreeURI(uri); return NULL; } file_dest = resolved_path; } xmlFreeURI(uri); return file_dest; } /* }}} */ ",0 "static int reset_config_defines(void *dummy) { ap_server_config_defines = saved_server_config_defines; saved_server_config_defines = NULL; server_config_defined_vars = NULL; return OK; } ",0 "static inline int __strnlen(const char *str, int len) { int l = 0; while (IS_PRINTABLE (*str) && --len) { if (((ut8)*str) == 0xff) { break; } str++; l++; } return l + 1; } ",0 " TT_Set_Var_Design( TT_Face face, FT_UInt num_coords, FT_Fixed* coords ) { FT_Error error = TT_Err_Ok; FT_Fixed* normalized = NULL; GX_Blend blend; FT_MM_Var* mmvar; FT_UInt i, j; FT_Var_Axis* a; GX_AVarSegment av; FT_Memory memory = face->root.memory; if ( face->blend == NULL ) { if ( (error = TT_Get_MM_Var( face, NULL )) != 0 ) goto Exit; } blend = face->blend; mmvar = blend->mmvar; if ( num_coords != mmvar->num_axis ) { error = TT_Err_Invalid_Argument; goto Exit; } /* Axis normalization is a two stage process. First we normalize */ /* based on the [min,def,max] values for the axis to be [-1,0,1]. */ /* Then, if there's an `avar' table, we renormalize this range. */ if ( FT_NEW_ARRAY( normalized, mmvar->num_axis ) ) goto Exit; a = mmvar->axis; for ( i = 0; i < mmvar->num_axis; ++i, ++a ) { if ( coords[i] > a->maximum || coords[i] < a->minimum ) { error = TT_Err_Invalid_Argument; goto Exit; } if ( coords[i] < a->def ) { normalized[i] = -FT_MulDiv( coords[i] - a->def, 0x10000L, a->minimum - a->def ); } else if ( a->maximum == a->def ) normalized[i] = 0; else { normalized[i] = FT_MulDiv( coords[i] - a->def, 0x10000L, a->maximum - a->def ); } } if ( !blend->avar_checked ) ft_var_load_avar( face ); if ( blend->avar_segment != NULL ) { av = blend->avar_segment; for ( i = 0; i < mmvar->num_axis; ++i, ++av ) { for ( j = 1; j < (FT_UInt)av->pairCount; ++j ) if ( normalized[i] < av->correspondence[j].fromCoord ) { normalized[i] = FT_MulDiv( FT_MulDiv( normalized[i] - av->correspondence[j - 1].fromCoord, 0x10000L, av->correspondence[j].fromCoord - av->correspondence[j - 1].fromCoord ), av->correspondence[j].toCoord - av->correspondence[j - 1].toCoord, 0x10000L ) + av->correspondence[j - 1].toCoord; break; } } } error = TT_Set_MM_Blend( face, num_coords, normalized ); Exit: FT_FREE( normalized ); return error; } ",0 "void impeg2d_get_bottom_field_buf(yuv_buf_t *ps_src_buf,yuv_buf_t *ps_dst_buf, UWORD32 u4_width) { ps_dst_buf->pu1_y = ps_src_buf->pu1_y + u4_width; ps_dst_buf->pu1_u = ps_src_buf->pu1_u + (u4_width>>1); ps_dst_buf->pu1_v = ps_src_buf->pu1_v + (u4_width>>1); } ",0 "CJSON_PUBLIC(cJSON_bool) cJSON_IsTrue(const cJSON * const item) { if (item == NULL) { return false; } return (item->type & 0xff) == cJSON_True; } ",0 "void handle_incoming_vpn_data(int sock) { vpn_packet_t pkt; char *hostname; sockaddr_t from; socklen_t fromlen = sizeof(from); node_t *n; pkt.len = recvfrom(listen_socket[sock].udp, (char *) &pkt.seqno, MAXSIZE, 0, &from.sa, &fromlen); if(pkt.len < 0) { if(!sockwouldblock(sockerrno)) logger(LOG_ERR, ""Receiving packet failed: %s"", sockstrerror(sockerrno)); return; } sockaddrunmap(&from); /* Some braindead IPv6 implementations do stupid things. */ n = lookup_node_udp(&from); if(!n) { n = try_harder(&from, &pkt); if(n) update_node_udp(n, &from); else ifdebug(PROTOCOL) { hostname = sockaddr2hostname(&from); logger(LOG_WARNING, ""Received UDP packet from unknown source %s"", hostname); free(hostname); return; } else return; } n->sock = sock; receive_udppacket(n, &pkt); } ",0 "RenderFrameHostImpl::GetNavigationClientFromInterfaceProvider() { mojom::NavigationClientAssociatedPtr navigation_client_ptr; GetRemoteAssociatedInterfaces()->GetInterface(&navigation_client_ptr); return navigation_client_ptr; } ",0 "PassRefPtr Document::all() { return ensureRareData()->ensureNodeLists()->addCacheWithAtomicName(this, DocAll); } ",0 "void Document::enqueueAnimationFrameEvent(PassRefPtrWillBeRawPtr event) { ensureScriptedAnimationController().enqueueEvent(event); } ",0 "float MSG_ReadAngle16( msg_t *msg ) { return SHORT2ANGLE(MSG_ReadShort(msg)); } ",0 " void WebPluginDelegateProxy::DidReceiveManualResponse( const GURL& url, const std::string& mime_type, const std::string& headers, uint32 expected_length, uint32 last_modified) { PluginMsg_DidReceiveResponseParams params; params.id = 0; params.mime_type = mime_type; params.headers = headers; params.expected_length = expected_length; params.last_modified = last_modified; Send(new PluginMsg_DidReceiveManualResponse(instance_id_, url, params)); } ",0 "gstate_to_update(fz_context *ctx, pdf_filter_processor *p) { filter_gstate *gstate = p->gstate; /* If we're not the top, that's fine */ if (gstate->next != NULL) return gstate; /* We are the top. Push a group, so we're not */ filter_push(ctx, p); gstate = p->gstate; gstate->pushed = 1; if (p->chain->op_q) p->chain->op_q(ctx, p->chain); return p->gstate; } ",0 "static struct dm_table *dm_get_live_table_fast(struct mapped_device *md) __acquires(RCU) { rcu_read_lock(); return rcu_dereference(md->map); } ",0 "sample_scale(double sample_value, unsigned int scale) { sample_value = floor(sample_value * scale + .5); /* Return NaN as 0: */ if (!(sample_value > 0)) sample_value = 0; else if (sample_value > scale) sample_value = scale; return (unsigned int)sample_value; } ",0 "const LayerRendererCapabilities& CCThreadProxy::layerRendererCapabilities() const { return m_layerRendererCapabilitiesMainThreadCopy; } ",0 "GLuint GetTextureServiceID(gl::GLApi* api, GLuint client_id, PassthroughResources* resources, bool create_if_missing) { GLuint service_id = resources->texture_id_map.invalid_service_id(); if (resources->texture_id_map.GetServiceID(client_id, &service_id)) { return service_id; } if (create_if_missing) { GLuint service_id = 0; api->glGenTexturesFn(1, &service_id); resources->texture_id_map.SetIDMapping(client_id, service_id); return service_id; } return resources->texture_id_map.invalid_service_id(); } ",0 "ofputil_decode_ofp11_port(struct ofputil_phy_port *pp, const struct ofp11_port *op) { enum ofperr error; error = ofputil_port_from_ofp11(op->port_no, &pp->port_no); if (error) { return error; } pp->hw_addr = op->hw_addr; ovs_strlcpy(pp->name, op->name, OFP_MAX_PORT_NAME_LEN); pp->config = ntohl(op->config) & OFPPC11_ALL; pp->state = ntohl(op->state) & OFPPS11_ALL; pp->curr = netdev_port_features_from_ofp11(op->curr); pp->advertised = netdev_port_features_from_ofp11(op->advertised); pp->supported = netdev_port_features_from_ofp11(op->supported); pp->peer = netdev_port_features_from_ofp11(op->peer); pp->curr_speed = ntohl(op->curr_speed); pp->max_speed = ntohl(op->max_speed); return 0; } ",0 "static void remove_port(struct kref *kref) { struct port *port; port = container_of(kref, struct port, kref); kfree(port); } ",0 "void RenderFrameHostImpl::DidSetFramePolicyHeaders( blink::WebSandboxFlags sandbox_flags, const blink::ParsedFeaturePolicy& parsed_header) { if (!is_active()) return; ResetFeaturePolicy(); feature_policy_->SetHeaderPolicy(*DirectivesWithDisposition( blink::mojom::FeaturePolicyDisposition::kEnforce, parsed_header)); frame_tree_node()->UpdateFramePolicyHeaders(sandbox_flags, parsed_header); active_sandbox_flags_ = frame_tree_node()->active_sandbox_flags(); } ",0 "void HttpResponseHeaders::MergeWithHeaders(const std::string& raw_headers, const HeaderSet& headers_to_remove) { std::string new_raw_headers(raw_headers); for (size_t i = 0; i < parsed_.size(); ++i) { DCHECK(!parsed_[i].is_continuation()); size_t k = i; while (++k < parsed_.size() && parsed_[k].is_continuation()) {} --k; std::string name(parsed_[i].name_begin, parsed_[i].name_end); StringToLowerASCII(&name); if (headers_to_remove.find(name) == headers_to_remove.end()) { new_raw_headers.append(parsed_[i].name_begin, parsed_[k].value_end); new_raw_headers.push_back('\0'); } i = k; } new_raw_headers.push_back('\0'); raw_headers_.clear(); parsed_.clear(); Parse(new_raw_headers); } ",0 "static int __init crct10dif_intel_mod_init(void) { if (!x86_match_cpu(crct10dif_cpu_id)) return -ENODEV; return crypto_register_shash(&alg); } ",0 "void v9fs_put_acl(struct posix_acl *dacl, struct posix_acl *acl) { posix_acl_release(dacl); posix_acl_release(acl); } ",0 "void GDataDirectory::RemoveChild(GDataEntry* entry) { DCHECK(entry); const std::string& base_name(entry->base_name()); DCHECK_EQ(entry, FindChild(base_name)); if (directory_service_) directory_service_->RemoveEntryFromResourceMap(entry); child_files_.erase(base_name); child_directories_.erase(base_name); } ",0 "void dmed_del(GF_Box *s) { gf_free((GF_DMEDBox *)s); } ",0 "static struct vm_area_struct *__install_special_mapping( struct mm_struct *mm, unsigned long addr, unsigned long len, unsigned long vm_flags, void *priv, const struct vm_operations_struct *ops) { int ret; struct vm_area_struct *vma; vma = vm_area_alloc(mm); if (unlikely(vma == NULL)) return ERR_PTR(-ENOMEM); vma->vm_start = addr; vma->vm_end = addr + len; vma->vm_flags = vm_flags | mm->def_flags | VM_DONTEXPAND | VM_SOFTDIRTY; vma->vm_page_prot = vm_get_page_prot(vma->vm_flags); vma->vm_ops = ops; vma->vm_private_data = priv; ret = insert_vm_struct(mm, vma); if (ret) goto out; vm_stat_account(mm, vma->vm_flags, len >> PAGE_SHIFT); perf_event_mmap(vma); return vma; out: vm_area_free(vma); return ERR_PTR(ret); } ",0 "static int rawv6_send_hdrinc(struct sock *sk, void *from, int length, struct flowi6 *fl6, struct dst_entry **dstp, unsigned int flags) { struct ipv6_pinfo *np = inet6_sk(sk); struct ipv6hdr *iph; struct sk_buff *skb; int err; struct rt6_info *rt = (struct rt6_info *)*dstp; int hlen = LL_RESERVED_SPACE(rt->dst.dev); int tlen = rt->dst.dev->needed_tailroom; if (length > rt->dst.dev->mtu) { ipv6_local_error(sk, EMSGSIZE, fl6, rt->dst.dev->mtu); return -EMSGSIZE; } if (flags&MSG_PROBE) goto out; skb = sock_alloc_send_skb(sk, length + hlen + tlen + 15, flags & MSG_DONTWAIT, &err); if (skb == NULL) goto error; skb_reserve(skb, hlen); skb->protocol = htons(ETH_P_IPV6); skb->priority = sk->sk_priority; skb->mark = sk->sk_mark; skb_dst_set(skb, &rt->dst); *dstp = NULL; skb_put(skb, length); skb_reset_network_header(skb); iph = ipv6_hdr(skb); skb->ip_summed = CHECKSUM_NONE; skb->transport_header = skb->network_header; err = memcpy_fromiovecend((void *)iph, from, 0, length); if (err) goto error_fault; IP6_UPD_PO_STATS(sock_net(sk), rt->rt6i_idev, IPSTATS_MIB_OUT, skb->len); err = NF_HOOK(NFPROTO_IPV6, NF_INET_LOCAL_OUT, skb, NULL, rt->dst.dev, dst_output); if (err > 0) err = net_xmit_errno(err); if (err) goto error; out: return 0; error_fault: err = -EFAULT; kfree_skb(skb); error: IP6_INC_STATS(sock_net(sk), rt->rt6i_idev, IPSTATS_MIB_OUTDISCARDS); if (err == -ENOBUFS && !np->recverr) err = 0; return err; } ",0 "void ExtensionUnloadNotificationObserver::Observe( int type, const content::NotificationSource& source, const content::NotificationDetails& details) { if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { did_receive_unload_notification_ = true; } else { NOTREACHED(); } } ",0 "sctp_disposition_t sctp_sf_do_asconf_ack(struct net *net, const struct sctp_endpoint *ep, const struct sctp_association *asoc, const sctp_subtype_t type, void *arg, sctp_cmd_seq_t *commands) { struct sctp_chunk *asconf_ack = arg; struct sctp_chunk *last_asconf = asoc->addip_last_asconf; struct sctp_chunk *abort; struct sctp_paramhdr *err_param = NULL; sctp_addiphdr_t *addip_hdr; __u32 sent_serial, rcvd_serial; if (!sctp_vtag_verify(asconf_ack, asoc)) { sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_BAD_TAG, SCTP_NULL()); return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); } /* ADD-IP, Section 4.1.2: * This chunk MUST be sent in an authenticated way by using * the mechanism defined in [I-D.ietf-tsvwg-sctp-auth]. If this chunk * is received unauthenticated it MUST be silently discarded as * described in [I-D.ietf-tsvwg-sctp-auth]. */ if (!net->sctp.addip_noauth && !asconf_ack->auth) return sctp_sf_discard_chunk(net, ep, asoc, type, arg, commands); /* Make sure that the ADDIP chunk has a valid length. */ if (!sctp_chunk_length_valid(asconf_ack, sizeof(sctp_addip_chunk_t))) return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, commands); addip_hdr = (sctp_addiphdr_t *)asconf_ack->skb->data; rcvd_serial = ntohl(addip_hdr->serial); /* Verify the ASCONF-ACK chunk before processing it. */ if (!sctp_verify_asconf(asoc, (sctp_paramhdr_t *)addip_hdr->params, (void *)asconf_ack->chunk_end, &err_param)) return sctp_sf_violation_paramlen(net, ep, asoc, type, arg, (void *)err_param, commands); if (last_asconf) { addip_hdr = (sctp_addiphdr_t *)last_asconf->subh.addip_hdr; sent_serial = ntohl(addip_hdr->serial); } else { sent_serial = asoc->addip_serial - 1; } /* D0) If an endpoint receives an ASCONF-ACK that is greater than or * equal to the next serial number to be used but no ASCONF chunk is * outstanding the endpoint MUST ABORT the association. Note that a * sequence number is greater than if it is no more than 2^^31-1 * larger than the current sequence number (using serial arithmetic). */ if (ADDIP_SERIAL_gte(rcvd_serial, sent_serial + 1) && !(asoc->addip_last_asconf)) { abort = sctp_make_abort(asoc, asconf_ack, sizeof(sctp_errhdr_t)); if (abort) { sctp_init_cause(abort, SCTP_ERROR_ASCONF_ACK, 0); sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort)); } /* We are going to ABORT, so we might as well stop * processing the rest of the chunks in the packet. */ sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP, SCTP_TO(SCTP_EVENT_TIMEOUT_T4_RTO)); sctp_add_cmd_sf(commands, SCTP_CMD_DISCARD_PACKET, SCTP_NULL()); sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, SCTP_ERROR(ECONNABORTED)); sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED, SCTP_PERR(SCTP_ERROR_ASCONF_ACK)); SCTP_INC_STATS(net, SCTP_MIB_ABORTEDS); SCTP_DEC_STATS(net, SCTP_MIB_CURRESTAB); return SCTP_DISPOSITION_ABORT; } if ((rcvd_serial == sent_serial) && asoc->addip_last_asconf) { sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP, SCTP_TO(SCTP_EVENT_TIMEOUT_T4_RTO)); if (!sctp_process_asconf_ack((struct sctp_association *)asoc, asconf_ack)) { /* Successfully processed ASCONF_ACK. We can * release the next asconf if we have one. */ sctp_add_cmd_sf(commands, SCTP_CMD_SEND_NEXT_ASCONF, SCTP_NULL()); return SCTP_DISPOSITION_CONSUME; } abort = sctp_make_abort(asoc, asconf_ack, sizeof(sctp_errhdr_t)); if (abort) { sctp_init_cause(abort, SCTP_ERROR_RSRC_LOW, 0); sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort)); } /* We are going to ABORT, so we might as well stop * processing the rest of the chunks in the packet. */ sctp_add_cmd_sf(commands, SCTP_CMD_DISCARD_PACKET, SCTP_NULL()); sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, SCTP_ERROR(ECONNABORTED)); sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED, SCTP_PERR(SCTP_ERROR_ASCONF_ACK)); SCTP_INC_STATS(net, SCTP_MIB_ABORTEDS); SCTP_DEC_STATS(net, SCTP_MIB_CURRESTAB); return SCTP_DISPOSITION_ABORT; } return SCTP_DISPOSITION_DISCARD; } ",0 "static int f2fs_file_mmap(struct file *file, struct vm_area_struct *vma) { file_accessed(file); vma->vm_ops = &f2fs_file_vm_ops; return 0; } ",0 "GDataFileError GDataFileSystem::UpdateFromFeedForTesting( const std::vector& feed_list, int64 start_changestamp, int64 root_feed_changestamp) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); return feed_loader_->UpdateFromFeed(feed_list, start_changestamp, root_feed_changestamp); } ",0 "handle_log_close(int handle, char *emsg) { if (handle_is_ok(handle, HANDLE_FILE)) { logit(""%s%sclose \""%s\"" bytes read %llu written %llu"", emsg == NULL ? """" : emsg, emsg == NULL ? """" : "" "", handle_to_name(handle), (unsigned long long)handle_bytes_read(handle), (unsigned long long)handle_bytes_write(handle)); } else { logit(""%s%sclosedir \""%s\"""", emsg == NULL ? """" : emsg, emsg == NULL ? """" : "" "", handle_to_name(handle)); } } ",0 "void FrameLoader::setURL(const KURL& url) { KURL ref(url); ref.setUser(String()); ref.setPass(String()); ref.removeFragmentIdentifier(); m_outgoingReferrer = ref.string(); m_URL = url; } ",0 "int __kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr) { u64 xcr0; u64 valid_bits; /* Only support XCR_XFEATURE_ENABLED_MASK(xcr0) now */ if (index != XCR_XFEATURE_ENABLED_MASK) return 1; xcr0 = xcr; if (!(xcr0 & XSTATE_FP)) return 1; if ((xcr0 & XSTATE_YMM) && !(xcr0 & XSTATE_SSE)) return 1; /* * Do not allow the guest to set bits that we do not support * saving. However, xcr0 bit 0 is always set, even if the * emulated CPU does not support XSAVE (see fx_init). */ valid_bits = vcpu->arch.guest_supported_xcr0 | XSTATE_FP; if (xcr0 & ~valid_bits) return 1; kvm_put_guest_xcr0(vcpu); vcpu->arch.xcr0 = xcr0; return 0; } ",0 "pdf14_cmykspot_get_color_mapping_procs(const gx_device * dev) { return &pdf14_DeviceCMYKspot_procs; } ",0 "static int mo_open_write(struct cdrom_device_info *cdi) { struct packet_command cgc; char buffer[255]; int ret; init_cdrom_command(&cgc, &buffer, 4, CGC_DATA_READ); cgc.quiet = 1; /* * obtain write protect information as per * drivers/scsi/sd.c:sd_read_write_protect_flag */ ret = cdrom_mode_sense(cdi, &cgc, GPMODE_ALL_PAGES, 0); if (ret) ret = cdrom_mode_sense(cdi, &cgc, GPMODE_VENDOR_PAGE, 0); if (ret) { cgc.buflen = 255; ret = cdrom_mode_sense(cdi, &cgc, GPMODE_ALL_PAGES, 0); } /* drive gave us no info, let the user go ahead */ if (ret) return 0; return buffer[3] & 0x80; } ",0 "static unsigned char *get_params(unsigned char *p, int *param, int *len) { int n; *len = 0; while (*p != '\0') { while (*p == ' ' || *p == '\t') { p++; } if (isdigit((int) ((unsigned char) *p))) { for (n = 0; isdigit((int) ((unsigned char) *p)); p++) { n = (int) ((ssize_t) n * 10 + (*p - '0')); } if (*len < 10) { param[(*len)++] = n; } while (*p == ' ' || *p == '\t') { p++; } if (*p == ';') { p++; } } else if (*p == ';') { if (*len < 10) { param[(*len)++] = 0; } p++; } else break; } return p; } ",0 "void AddV4L2GpuWhitelist(std::vector* permissions) { if (IsAcceleratedVideoDecodeEnabled()) { static const char kDevVideoDecPath[] = ""/dev/video-dec""; permissions->push_back(BrokerFilePermission::ReadWrite(kDevVideoDecPath)); } static const char kDevVideoEncPath[] = ""/dev/video-enc""; permissions->push_back(BrokerFilePermission::ReadWrite(kDevVideoEncPath)); static const char kDevJpegDecPath[] = ""/dev/jpeg-dec""; permissions->push_back(BrokerFilePermission::ReadWrite(kDevJpegDecPath)); } ",0 "Stream *Stream::makeFilter(char *name, Stream *str, Object *params) { int pred; // parameters int colors; int bits; int early; int encoding; GBool endOfLine, byteAlign, endOfBlock, black; int columns, rows; int colorXform; Object globals, obj; if (!strcmp(name, ""ASCIIHexDecode"") || !strcmp(name, ""AHx"")) { str = new ASCIIHexStream(str); } else if (!strcmp(name, ""ASCII85Decode"") || !strcmp(name, ""A85"")) { str = new ASCII85Stream(str); } else if (!strcmp(name, ""LZWDecode"") || !strcmp(name, ""LZW"")) { pred = 1; columns = 1; colors = 1; bits = 8; early = 1; if (params->isDict()) { params->dictLookup(""Predictor"", &obj); if (obj.isInt()) pred = obj.getInt(); obj.free(); params->dictLookup(""Columns"", &obj); if (obj.isInt()) columns = obj.getInt(); obj.free(); params->dictLookup(""Colors"", &obj); if (obj.isInt()) colors = obj.getInt(); obj.free(); params->dictLookup(""BitsPerComponent"", &obj); if (obj.isInt()) bits = obj.getInt(); obj.free(); params->dictLookup(""EarlyChange"", &obj); if (obj.isInt()) early = obj.getInt(); obj.free(); } str = new LZWStream(str, pred, columns, colors, bits, early); } else if (!strcmp(name, ""RunLengthDecode"") || !strcmp(name, ""RL"")) { str = new RunLengthStream(str); } else if (!strcmp(name, ""CCITTFaxDecode"") || !strcmp(name, ""CCF"")) { encoding = 0; endOfLine = gFalse; byteAlign = gFalse; columns = 1728; rows = 0; endOfBlock = gTrue; black = gFalse; if (params->isDict()) { params->dictLookup(""K"", &obj); if (obj.isInt()) { encoding = obj.getInt(); } obj.free(); params->dictLookup(""EndOfLine"", &obj); if (obj.isBool()) { endOfLine = obj.getBool(); } obj.free(); params->dictLookup(""EncodedByteAlign"", &obj); if (obj.isBool()) { byteAlign = obj.getBool(); } obj.free(); params->dictLookup(""Columns"", &obj); if (obj.isInt()) { columns = obj.getInt(); } obj.free(); params->dictLookup(""Rows"", &obj); if (obj.isInt()) { rows = obj.getInt(); } obj.free(); params->dictLookup(""EndOfBlock"", &obj); if (obj.isBool()) { endOfBlock = obj.getBool(); } obj.free(); params->dictLookup(""BlackIs1"", &obj); if (obj.isBool()) { black = obj.getBool(); } obj.free(); } str = new CCITTFaxStream(str, encoding, endOfLine, byteAlign, columns, rows, endOfBlock, black); } else if (!strcmp(name, ""DCTDecode"") || !strcmp(name, ""DCT"")) { colorXform = -1; if (params->isDict()) { if (params->dictLookup(""ColorTransform"", &obj)->isInt()) { colorXform = obj.getInt(); } obj.free(); } str = new DCTStream(str, colorXform); } else if (!strcmp(name, ""FlateDecode"") || !strcmp(name, ""Fl"")) { pred = 1; columns = 1; colors = 1; bits = 8; if (params->isDict()) { params->dictLookup(""Predictor"", &obj); if (obj.isInt()) pred = obj.getInt(); obj.free(); params->dictLookup(""Columns"", &obj); if (obj.isInt()) columns = obj.getInt(); obj.free(); params->dictLookup(""Colors"", &obj); if (obj.isInt()) colors = obj.getInt(); obj.free(); params->dictLookup(""BitsPerComponent"", &obj); if (obj.isInt()) bits = obj.getInt(); obj.free(); } str = new FlateStream(str, pred, columns, colors, bits); } else if (!strcmp(name, ""JBIG2Decode"")) { if (params->isDict()) { params->dictLookup(""JBIG2Globals"", &globals); } str = new JBIG2Stream(str, &globals); globals.free(); } else if (!strcmp(name, ""JPXDecode"")) { str = new JPXStream(str); } else { error(errSyntaxError, getPos(), ""Unknown filter '{0:s}'"", name); str = new EOFStream(str); } return str; } ",0 "void PictureLayerImpl::PushPropertiesTo(LayerImpl* base_layer) { DoPostCommitInitializationIfNeeded(); PictureLayerImpl* layer_impl = static_cast(base_layer); DCHECK_EQ(layer_impl->is_mask_, is_mask_); LayerImpl::PushPropertiesTo(base_layer); DCHECK_IMPLIES(twin_layer_, twin_layer_ == layer_impl); DCHECK_IMPLIES(twin_layer_, layer_impl->twin_layer_ == this); twin_layer_ = layer_impl; layer_impl->twin_layer_ = this; layer_impl->SetNearestNeighbor(nearest_neighbor_); DCHECK_IMPLIES(raster_source_->IsSolidColor(), tilings_->num_tilings() == 0); DCHECK_LE(tilings_->num_tilings(), layer_tree_impl()->create_low_res_tiling() ? 2u : 1u); layer_impl->UpdateRasterSource(raster_source_, &invalidation_, tilings_.get()); DCHECK(invalidation_.IsEmpty()); DCHECK_IMPLIES(raster_source_->IsSolidColor(), layer_impl->tilings_->num_tilings() == 0); layer_impl->raster_page_scale_ = raster_page_scale_; layer_impl->raster_device_scale_ = raster_device_scale_; layer_impl->raster_source_scale_ = raster_source_scale_; layer_impl->raster_contents_scale_ = raster_contents_scale_; layer_impl->low_res_raster_contents_scale_ = low_res_raster_contents_scale_; layer_impl->SanityCheckTilingState(); layer_impl->needs_post_commit_initialization_ = false; needs_post_commit_initialization_ = true; needs_push_properties_ = true; } ",0 "MODRET set_maxloginattempts(cmd_rec *cmd) { int max; config_rec *c = NULL; CHECK_ARGS(cmd, 1); CHECK_CONF(cmd, CONF_ROOT|CONF_VIRTUAL|CONF_GLOBAL); if (strcasecmp(cmd->argv[1], ""none"") == 0) { max = 0; } else { char *endp = NULL; max = (int) strtol(cmd->argv[1], &endp, 10); if ((endp && *endp) || max < 1) CONF_ERROR(cmd, ""parameter must be 'none' or a number greater than 0""); } c = add_config_param(cmd->argv[0], 1, NULL); c->argv[0] = pcalloc(c->pool, sizeof(unsigned int)); *((unsigned int *) c->argv[0]) = max; return PR_HANDLED(cmd); } ",0 "epass2003_restore_security_env(struct sc_card *card, int se_num) { LOG_FUNC_CALLED(card->ctx); LOG_FUNC_RETURN(card->ctx, SC_SUCCESS); } ",0 "void V8TestObject::DeprecateAsOverloadedMethodMethodCallback(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_DeprecateAsOverloadedMethod""); test_object_v8_internal::DeprecateAsOverloadedMethodMethod(info); } ",0 "int ext4_ext_tree_init(handle_t *handle, struct inode *inode) { struct ext4_extent_header *eh; eh = ext_inode_hdr(inode); eh->eh_depth = 0; eh->eh_entries = 0; eh->eh_magic = EXT4_EXT_MAGIC; eh->eh_max = cpu_to_le16(ext4_ext_space_root(inode, 0)); ext4_mark_inode_dirty(handle, inode); ext4_ext_invalidate_cache(inode); return 0; } ",0 "syncable::ModelTypeSet ProfileSyncService::GetEncryptedDataTypes() const { DCHECK(encrypted_types_.Has(syncable::PASSWORDS)); return encrypted_types_; } ",0 "GF_Box *payt_New() { ISOM_DECL_BOX_ALLOC(GF_PAYTBox, GF_ISOM_BOX_TYPE_PAYT); return (GF_Box *)tmp; } ",0 "initialize_realms(krb5_context kcontext, int argc, char **argv) { int c; char *db_name = (char *) NULL; char *lrealm = (char *) NULL; char *mkey_name = (char *) NULL; krb5_error_code retval; krb5_enctype menctype = ENCTYPE_UNKNOWN; kdc_realm_t *rdatap = NULL; krb5_boolean manual = FALSE; krb5_boolean def_restrict_anon; char *default_udp_ports = 0; char *default_tcp_ports = 0; krb5_pointer aprof; const char *hierarchy[3]; char *no_refrls = NULL; char *host_based_srvcs = NULL; int db_args_size = 0; char **db_args = NULL; extern char *optarg; if (!krb5_aprof_init(DEFAULT_KDC_PROFILE, KDC_PROFILE_ENV, &aprof)) { hierarchy[0] = KRB5_CONF_KDCDEFAULTS; hierarchy[1] = KRB5_CONF_KDC_PORTS; hierarchy[2] = (char *) NULL; if (krb5_aprof_get_string(aprof, hierarchy, TRUE, &default_udp_ports)) default_udp_ports = 0; hierarchy[1] = KRB5_CONF_KDC_TCP_PORTS; if (krb5_aprof_get_string(aprof, hierarchy, TRUE, &default_tcp_ports)) default_tcp_ports = 0; hierarchy[1] = KRB5_CONF_MAX_DGRAM_REPLY_SIZE; if (krb5_aprof_get_int32(aprof, hierarchy, TRUE, &max_dgram_reply_size)) max_dgram_reply_size = MAX_DGRAM_SIZE; hierarchy[1] = KRB5_CONF_RESTRICT_ANONYMOUS_TO_TGT; if (krb5_aprof_get_boolean(aprof, hierarchy, TRUE, &def_restrict_anon)) def_restrict_anon = FALSE; hierarchy[1] = KRB5_CONF_NO_HOST_REFERRAL; if (krb5_aprof_get_string_all(aprof, hierarchy, &no_refrls)) no_refrls = 0; if (!no_refrls || krb5_match_config_pattern(no_refrls, KRB5_CONF_ASTERISK) == FALSE) { hierarchy[1] = KRB5_CONF_HOST_BASED_SERVICES; if (krb5_aprof_get_string_all(aprof, hierarchy, &host_based_srvcs)) host_based_srvcs = 0; } krb5_aprof_finish(aprof); } if (default_udp_ports == 0) { default_udp_ports = strdup(DEFAULT_KDC_UDP_PORTLIST); if (default_udp_ports == 0) { fprintf(stderr, _("" KDC cannot initialize. Not enough memory\n"")); exit(1); } } if (default_tcp_ports == 0) { default_tcp_ports = strdup(DEFAULT_KDC_TCP_PORTLIST); if (default_tcp_ports == 0) { fprintf(stderr, _("" KDC cannot initialize. Not enough memory\n"")); exit(1); } } /* * Loop through the option list. Each time we encounter a realm name, * use the previously scanned options to fill in for defaults. */ while ((c = getopt(argc, argv, ""x:r:d:mM:k:R:e:P:p:s:nw:4:X3"")) != -1) { switch(c) { case 'x': db_args_size++; { char **temp = realloc( db_args, sizeof(char*) * (db_args_size+1)); /* one for NULL */ if( temp == NULL ) { fprintf(stderr, _(""%s: KDC cannot initialize. Not enough "" ""memory\n""), argv[0]); exit(1); } db_args = temp; } db_args[db_args_size-1] = optarg; db_args[db_args_size] = NULL; break; case 'r': /* realm name for db */ if (!find_realm_data(optarg, (krb5_ui_4) strlen(optarg))) { if ((rdatap = (kdc_realm_t *) malloc(sizeof(kdc_realm_t)))) { if ((retval = init_realm(rdatap, optarg, mkey_name, menctype, default_udp_ports, default_tcp_ports, manual, def_restrict_anon, db_args, no_refrls, host_based_srvcs))) { fprintf(stderr, _(""%s: cannot initialize realm %s - "" ""see log file for details\n""), argv[0], optarg); exit(1); } kdc_realmlist[kdc_numrealms] = rdatap; kdc_numrealms++; free(db_args), db_args=NULL, db_args_size = 0; } else { fprintf(stderr, _(""%s: cannot initialize realm %s. Not "" ""enough memory\n""), argv[0], optarg); exit(1); } } break; case 'd': /* pathname for db */ /* now db_name is not a seperate argument. * It has to be passed as part of the db_args */ if( db_name == NULL ) { if (asprintf(&db_name, ""dbname=%s"", optarg) < 0) { fprintf(stderr, _(""%s: KDC cannot initialize. Not enough "" ""memory\n""), argv[0]); exit(1); } } db_args_size++; { char **temp = realloc( db_args, sizeof(char*) * (db_args_size+1)); /* one for NULL */ if( temp == NULL ) { fprintf(stderr, _(""%s: KDC cannot initialize. Not enough "" ""memory\n""), argv[0]); exit(1); } db_args = temp; } db_args[db_args_size-1] = db_name; db_args[db_args_size] = NULL; break; case 'm': /* manual type-in of master key */ manual = TRUE; if (menctype == ENCTYPE_UNKNOWN) menctype = ENCTYPE_DES_CBC_CRC; break; case 'M': /* master key name in DB */ mkey_name = optarg; break; case 'n': nofork++; /* don't detach from terminal */ break; case 'w': /* create multiple worker processes */ workers = atoi(optarg); if (workers <= 0) usage(argv[0]); break; case 'k': /* enctype for master key */ if (krb5_string_to_enctype(optarg, &menctype)) com_err(argv[0], 0, _(""invalid enctype %s""), optarg); break; case 'R': /* Replay cache name; defunct since we don't use a replay cache. */ break; case 'P': pid_file = optarg; break; case 'p': if (default_udp_ports) free(default_udp_ports); default_udp_ports = strdup(optarg); if (!default_udp_ports) { fprintf(stderr, _("" KDC cannot initialize. Not enough "" ""memory\n"")); exit(1); } #if 0 /* not yet */ if (default_tcp_ports) free(default_tcp_ports); default_tcp_ports = strdup(optarg); #endif break; case '4': break; case 'X': break; case '?': default: usage(argv[0]); } } /* * Check to see if we processed any realms. */ if (kdc_numrealms == 0) { /* no realm specified, use default realm */ if ((retval = krb5_get_default_realm(kcontext, &lrealm))) { com_err(argv[0], retval, _(""while attempting to retrieve default realm"")); fprintf (stderr, _(""%s: %s, attempting to retrieve default realm\n""), argv[0], krb5_get_error_message(kcontext, retval)); exit(1); } if ((rdatap = (kdc_realm_t *) malloc(sizeof(kdc_realm_t)))) { if ((retval = init_realm(rdatap, lrealm, mkey_name, menctype, default_udp_ports, default_tcp_ports, manual, def_restrict_anon, db_args, no_refrls, host_based_srvcs))) { fprintf(stderr, _(""%s: cannot initialize realm %s - see log "" ""file for details\n""), argv[0], lrealm); exit(1); } kdc_realmlist[0] = rdatap; kdc_numrealms++; } krb5_free_default_realm(kcontext, lrealm); } /* Ensure that this is set for our first request. */ kdc_active_realm = kdc_realmlist[0]; if (default_udp_ports) free(default_udp_ports); if (default_tcp_ports) free(default_tcp_ports); if (db_args) free(db_args); if (db_name) free(db_name); if (host_based_srvcs) free(host_based_srvcs); if (no_refrls) free(no_refrls); return; } ",0 "ptaRemovePt(PTA *pta, l_int32 index) { l_int32 i, n; PROCNAME(""ptaRemovePt""); if (!pta) return ERROR_INT(""pta not defined"", procName, 1); n = ptaGetCount(pta); if (index < 0 || index >= n) return ERROR_INT(""index not in {0...n - 1}"", procName, 1); /* Remove the point */ for (i = index + 1; i < n; i++) { pta->x[i - 1] = pta->x[i]; pta->y[i - 1] = pta->y[i]; } pta->n--; return 0; } ",0 "ptaaTruncate(PTAA *ptaa) { l_int32 i, n, np; PTA *pta; PROCNAME(""ptaaTruncate""); if (!ptaa) return ERROR_INT(""ptaa not defined"", procName, 1); n = ptaaGetCount(ptaa); for (i = n - 1; i >= 0; i--) { pta = ptaaGetPta(ptaa, i, L_CLONE); if (!pta) { ptaa->n--; continue; } np = ptaGetCount(pta); ptaDestroy(&pta); if (np == 0) { ptaDestroy(&ptaa->pta[i]); ptaa->n--; } else { break; } } return 0; } ",0 "_rpc_job_notify(slurm_msg_t *msg) { job_notify_msg_t *req = msg->data; uid_t req_uid = g_slurm_auth_get_uid(msg->auth_cred, conf->auth_info); uid_t job_uid; List steps; ListIterator i; step_loc_t *stepd = NULL; int step_cnt = 0; int fd; debug(""_rpc_job_notify, uid = %d, jobid = %u"", req_uid, req->job_id); job_uid = _get_job_uid(req->job_id); if ((int)job_uid < 0) goto no_job; /* * check that requesting user ID is the SLURM UID or root */ if ((req_uid != job_uid) && (!_slurm_authorized_user(req_uid))) { error(""Security violation: job_notify(%u) from uid %d"", req->job_id, req_uid); return; } steps = stepd_available(conf->spooldir, conf->node_name); i = list_iterator_create(steps); while ((stepd = list_next(i))) { if ((stepd->jobid != req->job_id) || (stepd->stepid != SLURM_BATCH_SCRIPT)) { continue; } step_cnt++; fd = stepd_connect(stepd->directory, stepd->nodename, stepd->jobid, stepd->stepid, &stepd->protocol_version); if (fd == -1) { debug3(""Unable to connect to step %u.%u"", stepd->jobid, stepd->stepid); continue; } info(""send notification to job %u.%u"", stepd->jobid, stepd->stepid); if (stepd_notify_job(fd, stepd->protocol_version, req->message) < 0) debug(""notify jobid=%u failed: %m"", stepd->jobid); close(fd); } list_iterator_destroy(i); FREE_NULL_LIST(steps); no_job: if (step_cnt == 0) { debug2(""Can't find jobid %u to send notification message"", req->job_id); } } ",0 "const AtomicString& RTCPeerConnection::interfaceName() const { return eventNames().interfaceForRTCPeerConnection; } ",0 "static char *get_field_name(PGconn *pgsql, Oid oid, HashTable *list TSRMLS_DC) { PGresult *result; smart_str str = {0}; zend_rsrc_list_entry *field_type; char *ret=NULL; /* try to lookup the type in the resource list */ smart_str_appends(&str, ""pgsql_oid_""); smart_str_append_unsigned(&str, oid); smart_str_0(&str); if (zend_hash_find(list,str.c,str.len+1,(void **) &field_type)==SUCCESS) { ret = estrdup((char *)field_type->ptr); } else { /* hash all oid's */ int i,num_rows; int oid_offset,name_offset; char *tmp_oid, *end_ptr, *tmp_name; zend_rsrc_list_entry new_oid_entry; if ((result = PQexec(pgsql,""select oid,typname from pg_type"")) == NULL || PQresultStatus(result) != PGRES_TUPLES_OK) { if (result) { PQclear(result); } smart_str_free(&str); return STR_EMPTY_ALLOC(); } num_rows = PQntuples(result); oid_offset = PQfnumber(result,""oid""); name_offset = PQfnumber(result,""typname""); for (i=0; i strlen(LOCK_TMP_PREFIX) ? strlen(LOCK_PREFIX) : strlen(LOCK_TMP_PREFIX); len += strlen(tmppath) + strlen(port) + strlen(LOCK_SUFFIX) + 1; if (len > sizeof(LockFile)) FatalError(""Display name `%s' is too long\n"", port); (void)sprintf(tmp, ""%s"" LOCK_TMP_PREFIX ""%s"" LOCK_SUFFIX, tmppath, port); (void)sprintf(LockFile, ""%s"" LOCK_PREFIX ""%s"" LOCK_SUFFIX, tmppath, port); /* * Create a temporary file containing our PID. Attempt three times * to create the file. */ StillLocking = TRUE; i = 0; do { i++; lfd = open(tmp, O_CREAT | O_EXCL | O_WRONLY, 0644); if (lfd < 0) sleep(2); else break; } while (i < 3); if (lfd < 0) { unlink(tmp); i = 0; do { i++; lfd = open(tmp, O_CREAT | O_EXCL | O_WRONLY, 0644); if (lfd < 0) sleep(2); else break; } while (i < 3); } if (lfd < 0) FatalError(""Could not create lock file in %s\n"", tmp); (void) sprintf(pid_str, ""%10ld\n"", (long)getpid()); (void) write(lfd, pid_str, 11); (void) chmod(tmp, 0444); (void) close(lfd); /* * OK. Now the tmp file exists. Try three times to move it in place * for the lock. */ i = 0; haslock = 0; while ((!haslock) && (i++ < 3)) { haslock = (link(tmp,LockFile) == 0); if (haslock) { /* * We're done. */ break; } else { /* * Read the pid from the existing file */ lfd = open(LockFile, O_RDONLY|O_NOFOLLOW); if (lfd < 0) { unlink(tmp); FatalError(""Can't read lock file %s\n"", LockFile); } pid_str[0] = '\0'; if (read(lfd, pid_str, 11) != 11) { /* * Bogus lock file. */ unlink(LockFile); close(lfd); continue; } pid_str[11] = '\0'; sscanf(pid_str, ""%d"", &l_pid); close(lfd); /* * Now try to kill the PID to see if it exists. */ errno = 0; t = kill(l_pid, 0); if ((t< 0) && (errno == ESRCH)) { /* * Stale lock file. */ unlink(LockFile); continue; } else if (((t < 0) && (errno == EPERM)) || (t == 0)) { /* * Process is still active. */ unlink(tmp); FatalError(""Server is already active for display %s\n%s %s\n%s\n"", port, ""\tIf this server is no longer running, remove"", LockFile, ""\tand start again.""); } } } unlink(tmp); if (!haslock) FatalError(""Could not create server lock file: %s\n"", LockFile); StillLocking = FALSE; } ",1 "static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt) { KLVPacket klv; MXFContext *mxf = s->priv_data; int ret; while (1) { int64_t max_data_size; int64_t pos = avio_tell(s->pb); if (pos < mxf->current_klv_data.next_klv - mxf->current_klv_data.length || pos >= mxf->current_klv_data.next_klv) { mxf->current_klv_data = (KLVPacket){{0}}; ret = klv_read_packet(&klv, s->pb); if (ret < 0) break; max_data_size = klv.length; pos = klv.next_klv - klv.length; PRINT_KEY(s, ""read packet"", klv.key); av_log(s, AV_LOG_TRACE, ""size %""PRIu64"" offset %#""PRIx64""\n"", klv.length, klv.offset); if (IS_KLV_KEY(klv.key, mxf_encrypted_triplet_key)) { ret = mxf_decrypt_triplet(s, pkt, &klv); if (ret < 0) { av_log(s, AV_LOG_ERROR, ""invalid encoded triplet\n""); return ret; } return 0; } } else { klv = mxf->current_klv_data; max_data_size = klv.next_klv - pos; } if (IS_KLV_KEY(klv.key, mxf_essence_element_key) || IS_KLV_KEY(klv.key, mxf_canopus_essence_element_key) || IS_KLV_KEY(klv.key, mxf_avid_essence_element_key)) { int body_sid = find_body_sid_by_offset(mxf, klv.offset); int index = mxf_get_stream_index(s, &klv, body_sid); int64_t next_ofs; AVStream *st; MXFTrack *track; if (index < 0) { av_log(s, AV_LOG_ERROR, ""error getting stream index %""PRIu32""\n"", AV_RB32(klv.key + 12)); goto skip; } st = s->streams[index]; track = st->priv_data; if (s->streams[index]->discard == AVDISCARD_ALL) goto skip; next_ofs = mxf_set_current_edit_unit(mxf, st, pos, 1); if (track->wrapping != FrameWrapped) { int64_t size; if (next_ofs <= 0) { if (klv.next_klv - klv.length == pos && max_data_size > MXF_MAX_CHUNK_SIZE) { st->need_parsing = AVSTREAM_PARSE_FULL; avpriv_request_sample(s, ""Huge KLV without proper index in non-frame wrapped essence""); } size = FFMIN(max_data_size, MXF_MAX_CHUNK_SIZE); } else { if ((size = next_ofs - pos) <= 0) { av_log(s, AV_LOG_ERROR, ""bad size: %""PRId64""\n"", size); ret = AVERROR_INVALIDDATA; goto skip; } if (size > max_data_size) size = max_data_size; } mxf->current_klv_data = klv; klv.offset = pos; klv.length = size; klv.next_klv = klv.offset + klv.length; } /* check for 8 channels AES3 element */ if (klv.key[12] == 0x06 && klv.key[13] == 0x01 && klv.key[14] == 0x10) { ret = mxf_get_d10_aes3_packet(s->pb, s->streams[index], pkt, klv.length); if (ret < 0) { av_log(s, AV_LOG_ERROR, ""error reading D-10 aes3 frame\n""); mxf->current_klv_data = (KLVPacket){{0}}; return ret; } } else { ret = av_get_packet(s->pb, pkt, klv.length); if (ret < 0) { mxf->current_klv_data = (KLVPacket){{0}}; return ret; } } pkt->stream_index = index; pkt->pos = klv.offset; ret = mxf_set_pts(mxf, st, pkt); if (ret < 0) { mxf->current_klv_data = (KLVPacket){{0}}; return ret; } /* seek for truncated packets */ avio_seek(s->pb, klv.next_klv, SEEK_SET); return 0; } else { skip: avio_skip(s->pb, max_data_size); mxf->current_klv_data = (KLVPacket){{0}}; } } return avio_feof(s->pb) ? AVERROR_EOF : ret; } ",0 "static const char *parse_array(cJSON *item,const char *value,const char **ep) { cJSON *child; if (*value!='[') {*ep=value;return 0;} /* not an array! */ item->type=cJSON_Array; value=skip(value+1); if (*value==']') return value+1; /* empty array. */ item->child=child=cJSON_New_Item(); if (!item->child) return 0; /* memory fail */ value=skip(parse_value(child,skip(value),ep)); /* skip any spacing, get the value. */ if (!value) return 0; while (*value==',') { cJSON *new_item; if (!(new_item=cJSON_New_Item())) return 0; /* memory fail */ child->next=new_item;new_item->prev=child;child=new_item; value=skip(parse_value(child,skip(value+1),ep)); if (!value) return 0; /* memory fail */ } if (*value==']') return value+1; /* end of array */ *ep=value;return 0; /* malformed. */ } ",0 "void RenderBlock::determineEndPosition(LineLayoutState& layoutState, RootInlineBox* startLine, InlineIterator& cleanLineStart, BidiStatus& cleanLineBidiStatus) { ASSERT(!layoutState.endLine()); size_t floatIndex = layoutState.floatIndex(); RootInlineBox* last = 0; for (RootInlineBox* curr = startLine->nextRootBox(); curr; curr = curr->nextRootBox()) { if (!curr->isDirty()) { bool encounteredNewFloat = false; bool dirtiedByFloat = false; checkFloatsInCleanLine(curr, layoutState.floats(), floatIndex, encounteredNewFloat, dirtiedByFloat); if (encounteredNewFloat) return; } if (curr->isDirty()) last = 0; else if (!last) last = curr; } if (!last) return; RootInlineBox* prev = last->prevRootBox(); cleanLineStart = InlineIterator(this, prev->lineBreakObj(), prev->lineBreakPos()); cleanLineBidiStatus = prev->lineBreakBidiStatus(); layoutState.setEndLineLogicalTop(prev->lineBottomWithLeading()); for (RootInlineBox* line = last; line; line = line->nextRootBox()) line->extractLine(); // Disconnect all line boxes from their render objects while preserving layoutState.setEndLine(last); } ",0 "static zend_object *spl_dllist_object_clone(zval *zobject) /* {{{ */ { zend_object *old_object; zend_object *new_object; old_object = Z_OBJ_P(zobject); new_object = spl_dllist_object_new_ex(old_object->ce, zobject, 1); zend_objects_clone_members(new_object, old_object); return new_object; } /* }}} */ ",0 "hstore_gt(PG_FUNCTION_ARGS) { int res = DatumGetInt32(DirectFunctionCall2(hstore_cmp, PG_GETARG_DATUM(0), PG_GETARG_DATUM(1))); PG_RETURN_BOOL(res > 0); } ",0 "sha1_says_nonexistent(char const *sha1) { char const *empty_sha1 = ""e69de29bb2d1d6434b8b29ae775ad8c2e48c5391""; char const *s; /* Nonexisting files have an all-zero checksum. */ for (s = sha1; *s; s++) if (*s != '0') break; if (! *s) return 2; /* Empty files have empty_sha1 as their checksum. */ for (s = sha1; *s; s++, empty_sha1++) if (*s != *empty_sha1) break; return ! *s; } ",0 "static int check_defrag_in_cache(struct inode *inode, u64 offset, int thresh) { struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree; struct extent_map *em = NULL; struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree; u64 end; read_lock(&em_tree->lock); em = lookup_extent_mapping(em_tree, offset, PAGE_CACHE_SIZE); read_unlock(&em_tree->lock); if (em) { end = extent_map_end(em); free_extent_map(em); if (end - offset > thresh) return 0; } /* if we already have a nice delalloc here, just stop */ thresh /= 2; end = count_range_bits(io_tree, &offset, offset + thresh, thresh, EXTENT_DELALLOC, 1); if (end >= thresh) return 0; return 1; } ",0 "int ssl_handshake_step( ssl_context *ssl ) { int ret = POLARSSL_ERR_SSL_FEATURE_UNAVAILABLE; #if defined(POLARSSL_SSL_CLI_C) if( ssl->endpoint == SSL_IS_CLIENT ) ret = ssl_handshake_client_step( ssl ); #endif #if defined(POLARSSL_SSL_SRV_C) if( ssl->endpoint == SSL_IS_SERVER ) ret = ssl_handshake_server_step( ssl ); #endif return( ret ); } ",0 "void SyncerUtil::MarkDeletedChildrenSynced( const syncable::ScopedDirLookup &dir, std::set* deleted_folders) { if (deleted_folders->empty()) return; Directory::UnsyncedMetaHandles handles; { ReadTransaction trans(FROM_HERE, dir); dir->GetUnsyncedMetaHandles(&trans, &handles); } if (handles.empty()) return; Directory::UnsyncedMetaHandles::iterator it; for (it = handles.begin() ; it != handles.end() ; ++it) { WriteTransaction trans(FROM_HERE, SYNCER, dir); MutableEntry entry(&trans, GET_BY_HANDLE, *it); if (!entry.Get(IS_UNSYNCED) || !entry.Get(IS_DEL)) continue; syncable::Id id = entry.Get(PARENT_ID); while (id != trans.root_id()) { if (deleted_folders->find(id) != deleted_folders->end()) { entry.Put(IS_UNSYNCED, false); break; } Entry parent(&trans, GET_BY_ID, id); if (!parent.good() || !parent.Get(IS_DEL)) break; id = parent.Get(PARENT_ID); } } } ",0 "static ssize_t v86d_show(struct device_driver *dev, char *buf) { return snprintf(buf, PAGE_SIZE, ""%s\n"", v86d_path); } ",0 "static int oz_set_port_feature(struct usb_hcd *hcd, u16 wvalue, u16 windex) { struct oz_port *port; u8 port_id = (u8)windex; struct oz_hcd *ozhcd = oz_hcd_private(hcd); unsigned set_bits = 0; unsigned clear_bits = 0; if ((port_id < 1) || (port_id > OZ_NB_PORTS)) return -EPIPE; port = &ozhcd->ports[port_id-1]; switch (wvalue) { case USB_PORT_FEAT_CONNECTION: oz_dbg(HUB, ""USB_PORT_FEAT_CONNECTION\n""); break; case USB_PORT_FEAT_ENABLE: oz_dbg(HUB, ""USB_PORT_FEAT_ENABLE\n""); break; case USB_PORT_FEAT_SUSPEND: oz_dbg(HUB, ""USB_PORT_FEAT_SUSPEND\n""); break; case USB_PORT_FEAT_OVER_CURRENT: oz_dbg(HUB, ""USB_PORT_FEAT_OVER_CURRENT\n""); break; case USB_PORT_FEAT_RESET: oz_dbg(HUB, ""USB_PORT_FEAT_RESET\n""); set_bits = USB_PORT_STAT_ENABLE | (USB_PORT_STAT_C_RESET<<16); clear_bits = USB_PORT_STAT_RESET; ozhcd->ports[port_id-1].bus_addr = 0; break; case USB_PORT_FEAT_POWER: oz_dbg(HUB, ""USB_PORT_FEAT_POWER\n""); set_bits |= USB_PORT_STAT_POWER; break; case USB_PORT_FEAT_LOWSPEED: oz_dbg(HUB, ""USB_PORT_FEAT_LOWSPEED\n""); break; case USB_PORT_FEAT_C_CONNECTION: oz_dbg(HUB, ""USB_PORT_FEAT_C_CONNECTION\n""); break; case USB_PORT_FEAT_C_ENABLE: oz_dbg(HUB, ""USB_PORT_FEAT_C_ENABLE\n""); break; case USB_PORT_FEAT_C_SUSPEND: oz_dbg(HUB, ""USB_PORT_FEAT_C_SUSPEND\n""); break; case USB_PORT_FEAT_C_OVER_CURRENT: oz_dbg(HUB, ""USB_PORT_FEAT_C_OVER_CURRENT\n""); break; case USB_PORT_FEAT_C_RESET: oz_dbg(HUB, ""USB_PORT_FEAT_C_RESET\n""); break; case USB_PORT_FEAT_TEST: oz_dbg(HUB, ""USB_PORT_FEAT_TEST\n""); break; case USB_PORT_FEAT_INDICATOR: oz_dbg(HUB, ""USB_PORT_FEAT_INDICATOR\n""); break; default: oz_dbg(HUB, ""Other %d\n"", wvalue); break; } if (set_bits || clear_bits) { spin_lock_bh(&port->port_lock); port->status &= ~clear_bits; port->status |= set_bits; spin_unlock_bh(&port->port_lock); } oz_dbg(HUB, ""Port[%d] status = 0x%x\n"", port_id, port->status); return 0; } ",0 "static void dumpFrameScrollPosition(WKBundleFrameRef frame, StringBuilder& stringBuilder, FrameNamePolicy shouldIncludeFrameName = ShouldNotIncludeFrameName) { double x = numericWindowPropertyValue(frame, ""pageXOffset""); double y = numericWindowPropertyValue(frame, ""pageYOffset""); if (fabs(x) <= 0.00000001 && fabs(y) <= 0.00000001) return; if (shouldIncludeFrameName) { WKRetainPtr name(AdoptWK, WKBundleFrameCopyName(frame)); stringBuilder.appendLiteral(""frame '""); stringBuilder.append(toWTFString(name)); stringBuilder.appendLiteral(""' ""); } stringBuilder.appendLiteral(""scrolled to ""); stringBuilder.append(WTF::String::number(x)); stringBuilder.append(','); stringBuilder.append(WTF::String::number(y)); stringBuilder.append('\n'); } ",0 "void RenderWidgetHostImpl::ForwardTouchEvent( const WebKit::WebTouchEvent& touch_event) { touch_event_queue_->QueueEvent(touch_event); } ",0 "image_transform_png_set_strip_16_set(PNG_CONST image_transform *this, transform_display *that, png_structp pp, png_infop pi) { png_set_strip_16(pp); this->next->set(this->next, that, pp, pi); } ",1 "static int calc_deflate_block_size(int tmpblock_size) { z_stream zstream; int size; zstream.zalloc = Z_NULL; zstream.zfree = Z_NULL; zstream.opaque = Z_NULL; if (deflateInit(&zstream, 0) != Z_OK) return -1; size = deflateBound(&zstream, tmpblock_size); deflateEnd(&zstream); return size; } ",0 "void ResourceDispatcherHostImpl::EnableStaleWhileRevalidateForTesting() { if (!async_revalidation_manager_) async_revalidation_manager_.reset(new AsyncRevalidationManager); } ",0 "static inline bool nested_cpu_has_posted_intr(struct vmcs12 *vmcs12) { return vmcs12->pin_based_vm_exec_control & PIN_BASED_POSTED_INTR; } ",0 "ZEND_API int zend_startup_module_ex(zend_module_entry *module TSRMLS_DC) /* {{{ */ { int name_len; char *lcname; if (module->module_started) { return SUCCESS; } module->module_started = 1; /* Check module dependencies */ if (module->deps) { const zend_module_dep *dep = module->deps; while (dep->name) { if (dep->type == MODULE_DEP_REQUIRED) { zend_module_entry *req_mod; name_len = strlen(dep->name); lcname = zend_str_tolower_dup(dep->name, name_len); if (zend_hash_find(&module_registry, lcname, name_len+1, (void**)&req_mod) == FAILURE || !req_mod->module_started) { efree(lcname); /* TODO: Check version relationship */ zend_error(E_CORE_WARNING, ""Cannot load module '%s' because required module '%s' is not loaded"", module->name, dep->name); module->module_started = 0; return FAILURE; } efree(lcname); } ++dep; } } /* Initialize module globals */ if (module->globals_size) { #ifdef ZTS ts_allocate_id(module->globals_id_ptr, module->globals_size, (ts_allocate_ctor) module->globals_ctor, (ts_allocate_dtor) module->globals_dtor); #else if (module->globals_ctor) { module->globals_ctor(module->globals_ptr TSRMLS_CC); } #endif } if (module->module_startup_func) { EG(current_module) = module; if (module->module_startup_func(module->type, module->module_number TSRMLS_CC)==FAILURE) { zend_error(E_CORE_ERROR,""Unable to start %s module"", module->name); EG(current_module) = NULL; return FAILURE; } EG(current_module) = NULL; } return SUCCESS; } /* }}} */ ",0 "int sched_group_set_shares(struct task_group *tg, unsigned long shares) { int i; unsigned long flags; /* * We can't change the weight of the root cgroup. */ if (!tg->se[0]) return -EINVAL; if (shares < MIN_SHARES) shares = MIN_SHARES; else if (shares > MAX_SHARES) shares = MAX_SHARES; mutex_lock(&shares_mutex); if (tg->shares == shares) goto done; tg->shares = shares; for_each_possible_cpu(i) { struct rq *rq = cpu_rq(i); struct sched_entity *se; se = tg->se[i]; /* Propagate contribution to hierarchy */ raw_spin_lock_irqsave(&rq->lock, flags); for_each_sched_entity(se) update_cfs_shares(group_cfs_rq(se)); raw_spin_unlock_irqrestore(&rq->lock, flags); } done: mutex_unlock(&shares_mutex); return 0; } ",0 "scoped_refptr ImageProcessorClient::CreateInputFrame( const Image& input_image) const { DCHECK_CALLED_ON_VALID_THREAD(test_main_thread_checker_); LOG_ASSERT(image_processor_); LOG_ASSERT(input_image.IsLoaded()); LOG_ASSERT(input_image.DataSize() == VideoFrame::AllocationSize(input_image.PixelFormat(), input_image.Size())); const auto format = input_image.PixelFormat(); const auto visible_size = input_image.Size(); const size_t num_planes = VideoFrame::NumPlanes(format); std::vector planes(num_planes); const auto strides = VideoFrame::ComputeStrides(format, visible_size); size_t offset = 0; for (size_t i = 0; i < num_planes; ++i) { planes[i].stride = strides[i]; planes[i].offset = offset; offset += VideoFrame::PlaneSize(format, i, visible_size).GetArea(); } auto layout = VideoFrameLayout::CreateWithPlanes( format, visible_size, std::move(planes), {input_image.DataSize()}); if (!layout) { LOG(ERROR) << ""Failed to create VideoFrameLayout""; return nullptr; } auto frame = VideoFrame::WrapExternalDataWithLayout( *layout, gfx::Rect(visible_size), visible_size, input_image.Data(), input_image.DataSize(), base::TimeDelta()); if (!frame) { LOG(ERROR) << ""Failed to create VideoFrame""; return nullptr; } const auto& input_layout = image_processor_->input_layout(); if (VideoFrame::IsStorageTypeMappable( image_processor_->input_storage_type())) { return CloneVideoFrameWithLayout(frame.get(), input_layout); } else { #if defined(OS_CHROMEOS) LOG_ASSERT(image_processor_->input_storage_type() == VideoFrame::STORAGE_DMABUFS); #endif NOTIMPLEMENTED(); return nullptr; } } ",0 "int ip_local_out(struct sk_buff *skb) { int err; err = __ip_local_out(skb); if (likely(err == 1)) err = dst_output(skb); return err; } ",0 "_PUBLIC_ size_t strlen_m_term_null(const char *s) { return strlen_m_ext_term_null(s, CH_UNIX, CH_UTF16LE); } ",0 "bool WebGLRenderingContextBase::ExtensionSupportedAndAllowed( const ExtensionTracker* tracker) { if (tracker->Draft() && !RuntimeEnabledFeatures::WebGLDraftExtensionsEnabled()) return false; if (!tracker->Supported(this)) return false; return true; } ",0 " void notify(WebDataConsumerHandle::Client* client) { client->didGetReadable(); } ",0 "auth_pin_verify_pinpad(struct sc_card *card, int pin_reference, int *tries_left) { struct sc_card_driver *iso_drv = sc_get_iso7816_driver(); struct sc_pin_cmd_data pin_cmd; struct sc_apdu apdu; unsigned char ffs1[0x100]; int rv; LOG_FUNC_CALLED(card->ctx); memset(ffs1, 0xFF, sizeof(ffs1)); memset(&pin_cmd, 0, sizeof(pin_cmd)); rv = auth_pin_is_verified(card, pin_reference, tries_left); sc_log(card->ctx, ""auth_pin_is_verified returned rv %i"", rv); /* Return SUCCESS without verifying if * PIN has been already verified and PIN pad has to be used. */ if (!rv) LOG_FUNC_RETURN(card->ctx, rv); pin_cmd.flags |= SC_PIN_CMD_NEED_PADDING; /* For Oberthur card, PIN command data length has to be 0x40. * In PCSC10 v2.06 the upper limit of pin.max_length is 8. * * The standard sc_build_pin() throws an error when 'pin.len > pin.max_length' . * So, let's build our own APDU. */ sc_format_apdu(card, &apdu, SC_APDU_CASE_3_SHORT, 0x20, 0x00, pin_reference); apdu.lc = OBERTHUR_AUTH_MAX_LENGTH_PIN; apdu.datalen = OBERTHUR_AUTH_MAX_LENGTH_PIN; apdu.data = ffs1; pin_cmd.apdu = &apdu; pin_cmd.pin_type = SC_AC_CHV; pin_cmd.cmd = SC_PIN_CMD_VERIFY; pin_cmd.flags |= SC_PIN_CMD_USE_PINPAD; pin_cmd.pin_reference = pin_reference; if (pin_cmd.pin1.min_length < 4) pin_cmd.pin1.min_length = 4; pin_cmd.pin1.max_length = 8; pin_cmd.pin1.encoding = SC_PIN_ENCODING_ASCII; pin_cmd.pin1.offset = 5; pin_cmd.pin1.data = ffs1; pin_cmd.pin1.len = OBERTHUR_AUTH_MAX_LENGTH_PIN; pin_cmd.pin1.pad_length = OBERTHUR_AUTH_MAX_LENGTH_PIN; rv = iso_drv->ops->pin_cmd(card, &pin_cmd, tries_left); LOG_TEST_RET(card->ctx, rv, ""PIN CMD 'VERIFY' with pinpad failed""); LOG_FUNC_RETURN(card->ctx, rv); } ",0 "mrb_field_write_barrier(mrb_state *mrb, struct RBasic *obj, struct RBasic *value) { mrb_gc *gc = &mrb->gc; if (!is_black(obj)) return; if (!is_white(value)) return; mrb_assert(gc->state == MRB_GC_STATE_MARK || (!is_dead(gc, value) && !is_dead(gc, obj))); mrb_assert(is_generational(gc) || gc->state != MRB_GC_STATE_ROOT); if (is_generational(gc) || gc->state == MRB_GC_STATE_MARK) { add_gray_list(mrb, gc, value); } else { mrb_assert(gc->state == MRB_GC_STATE_SWEEP); paint_partial_white(gc, obj); /* for never write barriers */ } } ",0 "static int uio_mmap_physical(struct vm_area_struct *vma) { struct uio_device *idev = vma->vm_private_data; int mi = uio_find_mem_index(vma); if (mi < 0) return -EINVAL; vma->vm_ops = &uio_physical_vm_ops; vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); return remap_pfn_range(vma, vma->vm_start, idev->info->mem[mi].addr >> PAGE_SHIFT, vma->vm_end - vma->vm_start, vma->vm_page_prot); } ",1 "bool DocumentInit::IsHostedInReservedIPRange() const { if (DocumentLoader* loader = MasterDocumentLoader()) { if (!loader->GetResponse().RemoteIPAddress().IsEmpty()) { return NetworkUtils::IsReservedIPAddress( loader->GetResponse().RemoteIPAddress()); } } return false; } ",0 "void WebLocalFrameImpl::AddMessageToConsole(const WebConsoleMessage& message) { DCHECK(GetFrame()); MessageLevel web_core_message_level = kInfoMessageLevel; switch (message.level) { case WebConsoleMessage::kLevelVerbose: web_core_message_level = kVerboseMessageLevel; break; case WebConsoleMessage::kLevelInfo: web_core_message_level = kInfoMessageLevel; break; case WebConsoleMessage::kLevelWarning: web_core_message_level = kWarningMessageLevel; break; case WebConsoleMessage::kLevelError: web_core_message_level = kErrorMessageLevel; break; } GetFrame()->GetDocument()->AddConsoleMessage(ConsoleMessage::Create( kOtherMessageSource, web_core_message_level, message.text, SourceLocation::Create(message.url, message.line_number, message.column_number, nullptr))); } ",0 "static void net_close(struct wif *wi) { struct priv_net *pn = wi_priv(wi); close(pn->pn_s); do_net_free(wi); } ",0 "xmlParseQNameAndCompare(xmlParserCtxtPtr ctxt, xmlChar const *name, xmlChar const *prefix) { const xmlChar *cmp; const xmlChar *in; const xmlChar *ret; const xmlChar *prefix2; if (prefix == NULL) return(xmlParseNameAndCompare(ctxt, name)); GROW; in = ctxt->input->cur; cmp = prefix; while (*in != 0 && *in == *cmp) { ++in; ++cmp; } if ((*cmp == 0) && (*in == ':')) { in++; cmp = name; while (*in != 0 && *in == *cmp) { ++in; ++cmp; } if (*cmp == 0 && (*in == '>' || IS_BLANK_CH (*in))) { /* success */ ctxt->input->cur = in; return((const xmlChar*) 1); } } /* * all strings coms from the dictionary, equality can be done directly */ ret = xmlParseQName (ctxt, &prefix2); if ((ret == name) && (prefix == prefix2)) return((const xmlChar*) 1); return ret; } ",0 "_asn1_set_value_m (asn1_node node, void *value, unsigned int len) { if (node == NULL) return node; if (node->value) { if (node->value != node->small_value) free (node->value); node->value = NULL; node->value_len = 0; } if (!len) return node; node->value = value; node->value_len = len; return node; } ",0 "error::Error GLES2DecoderPassthroughImpl::DoVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) { api()->glVertexAttrib2fFn(indx, x, y); return error::kNoError; } ",0 " int flush_completed_IO(struct inode *inode) { ext4_io_end_t *io; int ret = 0; int ret2 = 0; if (list_empty(&EXT4_I(inode)->i_completed_io_list)) return ret; dump_completed_IO(inode); while (!list_empty(&EXT4_I(inode)->i_completed_io_list)){ io = list_entry(EXT4_I(inode)->i_completed_io_list.next, ext4_io_end_t, list); /* * Calling ext4_end_io_nolock() to convert completed * IO to written. * * When ext4_sync_file() is called, run_queue() may already * about to flush the work corresponding to this io structure. * It will be upset if it founds the io structure related * to the work-to-be schedule is freed. * * Thus we need to keep the io structure still valid here after * convertion finished. The io structure has a flag to * avoid double converting from both fsync and background work * queue work. */ ret = ext4_end_io_nolock(io); if (ret < 0) ret2 = ret; else list_del_init(&io->list); } return (ret2 < 0) ? ret2 : 0; } ",1 "int task_can_attach(struct task_struct *p, const struct cpumask *cs_cpus_allowed) { int ret = 0; /* * Kthreads which disallow setaffinity shouldn't be moved * to a new cpuset; we don't want to change their cpu * affinity and isolating such threads by their set of * allowed nodes is unnecessary. Thus, cpusets are not * applicable for such threads. This prevents checking for * success of set_cpus_allowed_ptr() on all attached tasks * before cpus_allowed may be changed. */ if (p->flags & PF_NO_SETAFFINITY) { ret = -EINVAL; goto out; } #ifdef CONFIG_SMP if (dl_task(p) && !cpumask_intersects(task_rq(p)->rd->span, cs_cpus_allowed)) { unsigned int dest_cpu = cpumask_any_and(cpu_active_mask, cs_cpus_allowed); struct dl_bw *dl_b; bool overflow; int cpus; unsigned long flags; rcu_read_lock_sched(); dl_b = dl_bw_of(dest_cpu); raw_spin_lock_irqsave(&dl_b->lock, flags); cpus = dl_bw_cpus(dest_cpu); overflow = __dl_overflow(dl_b, cpus, 0, p->dl.dl_bw); if (overflow) ret = -EBUSY; else { /* * We reserve space for this task in the destination * root_domain, as we can't fail after this point. * We will free resources in the source root_domain * later on (see set_cpus_allowed_dl()). */ __dl_add(dl_b, p->dl.dl_bw); } raw_spin_unlock_irqrestore(&dl_b->lock, flags); rcu_read_unlock_sched(); } #endif out: return ret; } ",0 "void RenderBox::paintCustomHighlight(const LayoutPoint& paintOffset, const AtomicString& type, bool behindText) { Frame* frame = this->frame(); if (!frame) return; Page* page = frame->page(); if (!page) return; InlineBox* boxWrap = inlineBoxWrapper(); RootInlineBox* r = boxWrap ? boxWrap->root() : 0; if (r) { FloatRect rootRect(paintOffset.x() + r->x(), paintOffset.y() + r->selectionTop(), r->logicalWidth(), r->selectionHeight()); FloatRect imageRect(paintOffset.x() + x(), rootRect.y(), width(), rootRect.height()); page->chrome()->client()->paintCustomHighlight(node(), type, imageRect, rootRect, behindText, false); } else { FloatRect imageRect(paintOffset.x() + x(), paintOffset.y() + y(), width(), height()); page->chrome()->client()->paintCustomHighlight(node(), type, imageRect, imageRect, behindText, false); } } ",0 "PassRefPtrWillBeRawPtr Document::createAttributeNS(const AtomicString& namespaceURI, const AtomicString& qualifiedName, ExceptionState& exceptionState, bool shouldIgnoreNamespaceChecks) { AtomicString prefix, localName; if (!parseQualifiedName(qualifiedName, prefix, localName, exceptionState)) return nullptr; QualifiedName qName(prefix, localName, namespaceURI); if (!shouldIgnoreNamespaceChecks && !hasValidNamespaceForAttributes(qName)) { exceptionState.throwDOMException(NamespaceError, ""The namespace URI provided ('"" + namespaceURI + ""') is not valid for the qualified name provided ('"" + qualifiedName + ""').""); return nullptr; } return Attr::create(*this, qName, emptyAtom); } ",0 "static ssize_t aio_setup_vectored_rw(struct kiocb *kiocb, int rw, char __user *buf, unsigned long *nr_segs, size_t *len, struct iovec **iovec, bool compat) { ssize_t ret; *nr_segs = *len; #ifdef CONFIG_COMPAT if (compat) ret = compat_rw_copy_check_uvector(rw, (struct compat_iovec __user *)buf, *nr_segs, UIO_FASTIOV, *iovec, iovec); else #endif ret = rw_copy_check_uvector(rw, (struct iovec __user *)buf, *nr_segs, UIO_FASTIOV, *iovec, iovec); if (ret < 0) return ret; /* len now reflect bytes instead of segs */ *len = ret; return 0; } ",1 " void ScrollbarOverlayChanged(pp::Scrollbar_Dev scrollbar, bool overlay) { if (ppp_scrollbar_ != NULL) { ppp_scrollbar_->OverlayChanged(plugin_->pp_instance(), scrollbar.pp_resource(), PP_FromBool(overlay)); } } ",0 "void H264SwDecMemcpy(void *dest, void *src, u32 count) { memcpy(dest, src, count); } ",0 " void OnInit(const CompletionCallback& callback) { base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(callback, init_result_)); } ",0 "void tty_vhangup(struct tty_struct *tty) { #ifdef TTY_DEBUG_HANGUP char buf[64]; printk(KERN_DEBUG ""%s vhangup...\n"", tty_name(tty, buf)); #endif __tty_hangup(tty); } ",0 "bool ExtensionDevToolsClientHost::MayDiscoverTargets() { return false; } ",0 "HB_Error HB_GPOS_Apply_String( HB_Font font, HB_GPOSHeader* gpos, HB_UShort load_flags, HB_Buffer buffer, HB_Bool dvi, HB_Bool r2l ) { HB_Error error, retError = HB_Err_Not_Covered; GPOS_Instance gpi; int i, j, lookup_count, num_features; if ( !font || !gpos || !buffer ) return ERR(HB_Err_Invalid_Argument); if ( buffer->in_length == 0 ) return HB_Err_Not_Covered; gpi.font = font; gpi.gpos = gpos; gpi.load_flags = load_flags; gpi.r2l = r2l; gpi.dvi = dvi; lookup_count = gpos->LookupList.LookupCount; num_features = gpos->FeatureList.ApplyCount; if ( num_features ) { error = _hb_buffer_clear_positions( buffer ); if ( error ) return error; } for ( i = 0; i < num_features; i++ ) { HB_UShort feature_index = gpos->FeatureList.ApplyOrder[i]; HB_Feature feature = gpos->FeatureList.FeatureRecord[feature_index].Feature; for ( j = 0; j < feature.LookupListCount; j++ ) { HB_UShort lookup_index = feature.LookupListIndex[j]; /* Skip nonexistant lookups */ if (lookup_index >= lookup_count) continue; error = GPOS_Do_String_Lookup( &gpi, lookup_index, buffer ); if ( error ) { if ( error != HB_Err_Not_Covered ) return error; } else retError = error; } } if ( num_features ) { error = Position_CursiveChain ( buffer ); if ( error ) return error; } return retError; } ",0 "put_u32(struct ofpbuf *b, uint32_t x) { put_be32(b, htonl(x)); } ",0 "static int msgctl_down(struct ipc_namespace *ns, int msqid, int cmd, struct msqid_ds __user *buf, int version) { struct kern_ipc_perm *ipcp; struct msqid64_ds uninitialized_var(msqid64); struct msg_queue *msq; int err; if (cmd == IPC_SET) { if (copy_msqid_from_user(&msqid64, buf, version)) return -EFAULT; } down_write(&msg_ids(ns).rwsem); rcu_read_lock(); ipcp = ipcctl_pre_down_nolock(ns, &msg_ids(ns), msqid, cmd, &msqid64.msg_perm, msqid64.msg_qbytes); if (IS_ERR(ipcp)) { err = PTR_ERR(ipcp); goto out_unlock1; } msq = container_of(ipcp, struct msg_queue, q_perm); err = security_msg_queue_msgctl(msq, cmd); if (err) goto out_unlock1; switch (cmd) { case IPC_RMID: ipc_lock_object(&msq->q_perm); /* freeque unlocks the ipc object and rcu */ freeque(ns, ipcp); goto out_up; case IPC_SET: if (msqid64.msg_qbytes > ns->msg_ctlmnb && !capable(CAP_SYS_RESOURCE)) { err = -EPERM; goto out_unlock1; } ipc_lock_object(&msq->q_perm); err = ipc_update_perm(&msqid64.msg_perm, ipcp); if (err) goto out_unlock0; msq->q_qbytes = msqid64.msg_qbytes; msq->q_ctime = get_seconds(); /* sleeping receivers might be excluded by * stricter permissions. */ expunge_all(msq, -EAGAIN); /* sleeping senders might be able to send * due to a larger queue size. */ ss_wakeup(&msq->q_senders, 0); break; default: err = -EINVAL; goto out_unlock1; } out_unlock0: ipc_unlock_object(&msq->q_perm); out_unlock1: rcu_read_unlock(); out_up: up_write(&msg_ids(ns).rwsem); return err; } ",0 "void RenderFrameImpl::DidFailLoad(const WebURLError& error, blink::WebHistoryCommitType commit_type) { TRACE_EVENT1(""navigation,rail"", ""RenderFrameImpl::didFailLoad"", ""id"", routing_id_); WebDocumentLoader* document_loader = frame_->GetDocumentLoader(); DCHECK(document_loader); base::string16 error_description; GetContentClient()->renderer()->GetErrorDescription( error, document_loader->HttpMethod().Ascii(), &error_description); Send(new FrameHostMsg_DidFailLoadWithError( routing_id_, document_loader->GetUrl(), error.reason(), error_description)); } ",0 "ModuleExport size_t RegisterMTVImage(void) { MagickInfo *entry; entry=SetMagickInfo(""MTV""); entry->decoder=(DecodeImageHandler *) ReadMTVImage; entry->encoder=(EncodeImageHandler *) WriteMTVImage; entry->description=ConstantString(""MTV Raytracing image format""); entry->module=ConstantString(""MTV""); (void) RegisterMagickInfo(entry); return(MagickImageCoderSignature); } ",0 " void WaitTopSitesLoaded() { DCHECK(top_sites_impl_); WaitTopSitesLoadedObserver wait_top_sites_loaded_observer(top_sites_impl_); wait_top_sites_loaded_observer.Run(); } ",0 "static size_t curl_passwd(void *ctx, char *prompt, char *buf, int buflen) { php_curl *ch = (php_curl *) ctx; zval *func = &ch->handlers->passwd; zval argv[3]; zval retval; int error; int ret = -1; ZVAL_RES(&argv[0], ch->res); Z_ADDREF(argv[0]); ZVAL_STRING(&argv[1], prompt); ZVAL_LONG(&argv[2], buflen); error = call_user_function(EG(function_table), NULL, func, &retval, 2, argv); if (error == FAILURE) { php_error_docref(NULL, E_WARNING, ""Could not call the CURLOPT_PASSWDFUNCTION""); } else if (Z_TYPE(retval) == IS_STRING) { if (Z_STRLEN(retval) > buflen) { php_error_docref(NULL, E_WARNING, ""Returned password is too long for libcurl to handle""); } else { memcpy(buf, Z_STRVAL(retval), Z_STRLEN(retval) + 1); } } else { php_error_docref(NULL, E_WARNING, ""User handler '%s' did not return a string"", Z_STRVAL_P(func)); } zval_ptr_dtor(&argv[0]); zval_ptr_dtor(&argv[1]); zval_ptr_dtor(&argv[2]); zval_ptr_dtor(&retval); return ret; } ",0 "int register_pernet_device(struct pernet_operations *ops) { int error; mutex_lock(&net_mutex); error = register_pernet_operations(&pernet_list, ops); if (!error && (first_device == &pernet_list)) first_device = &ops->list; mutex_unlock(&net_mutex); return error; } ",0 " static void SetImpl(Handle holder, uint32_t entry, Object* value) { uint32_t length = static_cast(GetString(*holder)->length()); if (entry < length) { return; // String contents are read-only. } BackingStoreAccessor::SetImpl(holder->elements(), entry - length, value); } ",0 "void netdev_run_todo(void) { struct list_head list; /* Snapshot list, allow later requests */ list_replace_init(&net_todo_list, &list); __rtnl_unlock(); while (!list_empty(&list)) { struct net_device *dev = list_first_entry(&list, struct net_device, todo_list); list_del(&dev->todo_list); if (unlikely(dev->reg_state != NETREG_UNREGISTERING)) { printk(KERN_ERR ""network todo '%s' but state %d\n"", dev->name, dev->reg_state); dump_stack(); continue; } dev->reg_state = NETREG_UNREGISTERED; on_each_cpu(flush_backlog, dev, 1); netdev_wait_allrefs(dev); /* paranoia */ BUG_ON(netdev_refcnt_read(dev)); WARN_ON(rcu_dereference_raw(dev->ip_ptr)); WARN_ON(rcu_dereference_raw(dev->ip6_ptr)); WARN_ON(dev->dn_ptr); if (dev->destructor) dev->destructor(dev); /* Free network device */ kobject_put(&dev->dev.kobj); } } ",0 "static void perf_event_ctx_deactivate(struct perf_event_context *ctx) { WARN_ON(!irqs_disabled()); WARN_ON(list_empty(&ctx->active_ctx_list)); list_del_init(&ctx->active_ctx_list); } ",0 "SWFInput_buffer_seek(SWFInput input, long offset, int whence) { if ( whence == SEEK_CUR ) { if ( offset >= 0 ) input->offset = min(input->length, input->offset + offset); else input->offset = max(0, input->offset + offset); } else if ( whence == SEEK_END ) input->offset = max(0, input->length - offset); else if ( whence == SEEK_SET ) input->offset = min(input->length, offset); } ",0 " void SetupDefaultTrees(const gfx::Size& layer_bounds) { gfx::Size tile_size(100, 100); scoped_refptr pending_pile = FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); scoped_refptr active_pile = FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); SetupTrees(pending_pile, active_pile); } ",0 "SPICE_GNUC_VISIBLE int spice_server_set_image_compression(SpiceServer *s, spice_image_compression_t comp) { spice_assert(reds == s); set_image_compression(comp); return 0; } ",0 "void LayerTreeHost::UnregisterElement(ElementId element_id, ElementListType list_type, Layer* layer) { mutator_host_->UnregisterElement(element_id, list_type); if (layer->element_id()) { element_layers_map_.erase(layer->element_id()); } } ",0 "ptaCreate(l_int32 n) { PTA *pta; PROCNAME(""ptaCreate""); if (n <= 0) n = INITIAL_PTR_ARRAYSIZE; pta = (PTA *)LEPT_CALLOC(1, sizeof(PTA)); pta->n = 0; pta->nalloc = n; ptaChangeRefcount(pta, 1); /* sets to 1 */ pta->x = (l_float32 *)LEPT_CALLOC(n, sizeof(l_float32)); pta->y = (l_float32 *)LEPT_CALLOC(n, sizeof(l_float32)); if (!pta->x || !pta->y) { ptaDestroy(&pta); return (PTA *)ERROR_PTR(""x and y arrays not both made"", procName, NULL); } return pta; } ",0 "static struct sock *__l2tp_ip6_bind_lookup(struct net *net, struct in6_addr *laddr, int dif, u32 tunnel_id) { struct sock *sk; sk_for_each_bound(sk, &l2tp_ip6_bind_table) { const struct in6_addr *addr = inet6_rcv_saddr(sk); struct l2tp_ip6_sock *l2tp = l2tp_ip6_sk(sk); if (l2tp == NULL) continue; if ((l2tp->conn_id == tunnel_id) && net_eq(sock_net(sk), net) && !(addr && ipv6_addr_equal(addr, laddr)) && !(sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif)) goto found; } sk = NULL; found: return sk; } ",0 "bool InputMethodBase::IsTextInputClientFocused(const TextInputClient* client) { return client && (client == GetTextInputClient()); } ",0 "bool JSTestInterfaceConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) { return getStaticPropertySlot(exec, &JSTestInterfaceConstructorTable, jsCast(cell), propertyName, slot); } ",0 "void InlineFlowBox::clearTruncation() { for (InlineBox *box = firstChild(); box; box = box->nextOnLine()) box->clearTruncation(); } ",0 "void base64_encode(const char *buf, int len, char *out, int pad) { char *b64 = ""ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/""; int bit_offset, byte_offset, idx, i; const uchar *d = (const uchar *)buf; int bytes = (len*8 + 5)/6; for (i = 0; i < bytes; i++) { byte_offset = (i*6)/8; bit_offset = (i*6)%8; if (bit_offset < 3) { idx = (d[byte_offset] >> (2-bit_offset)) & 0x3F; } else { idx = (d[byte_offset] << (bit_offset-2)) & 0x3F; if (byte_offset+1 < len) { idx |= (d[byte_offset+1] >> (8-(bit_offset-2))); } } out[i] = b64[idx]; } while (pad && (i % 4)) out[i++] = '='; out[i] = '\0'; } ",0 "static journal_t *ext4_get_dev_journal(struct super_block *sb, dev_t j_dev) { struct buffer_head *bh; journal_t *journal; ext4_fsblk_t start; ext4_fsblk_t len; int hblock, blocksize; ext4_fsblk_t sb_block; unsigned long offset; struct ext4_super_block *es; struct block_device *bdev; BUG_ON(!EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_HAS_JOURNAL)); bdev = ext4_blkdev_get(j_dev, sb); if (bdev == NULL) return NULL; if (bd_claim(bdev, sb)) { ext4_msg(sb, KERN_ERR, ""failed to claim external journal device""); blkdev_put(bdev, FMODE_READ|FMODE_WRITE); return NULL; } blocksize = sb->s_blocksize; hblock = bdev_logical_block_size(bdev); if (blocksize < hblock) { ext4_msg(sb, KERN_ERR, ""blocksize too small for journal device""); goto out_bdev; } sb_block = EXT4_MIN_BLOCK_SIZE / blocksize; offset = EXT4_MIN_BLOCK_SIZE % blocksize; set_blocksize(bdev, blocksize); if (!(bh = __bread(bdev, sb_block, blocksize))) { ext4_msg(sb, KERN_ERR, ""couldn't read superblock of "" ""external journal""); goto out_bdev; } es = (struct ext4_super_block *) (((char *)bh->b_data) + offset); if ((le16_to_cpu(es->s_magic) != EXT4_SUPER_MAGIC) || !(le32_to_cpu(es->s_feature_incompat) & EXT4_FEATURE_INCOMPAT_JOURNAL_DEV)) { ext4_msg(sb, KERN_ERR, ""external journal has "" ""bad superblock""); brelse(bh); goto out_bdev; } if (memcmp(EXT4_SB(sb)->s_es->s_journal_uuid, es->s_uuid, 16)) { ext4_msg(sb, KERN_ERR, ""journal UUID does not match""); brelse(bh); goto out_bdev; } len = ext4_blocks_count(es); start = sb_block + 1; brelse(bh); /* we're done with the superblock */ journal = jbd2_journal_init_dev(bdev, sb->s_bdev, start, len, blocksize); if (!journal) { ext4_msg(sb, KERN_ERR, ""failed to create device journal""); goto out_bdev; } journal->j_private = sb; ll_rw_block(READ, 1, &journal->j_sb_buffer); wait_on_buffer(journal->j_sb_buffer); if (!buffer_uptodate(journal->j_sb_buffer)) { ext4_msg(sb, KERN_ERR, ""I/O error on journal device""); goto out_journal; } if (be32_to_cpu(journal->j_superblock->s_nr_users) != 1) { ext4_msg(sb, KERN_ERR, ""External journal has more than one "" ""user (unsupported) - %d"", be32_to_cpu(journal->j_superblock->s_nr_users)); goto out_journal; } EXT4_SB(sb)->journal_bdev = bdev; ext4_init_journal_params(sb, journal); return journal; out_journal: jbd2_journal_destroy(journal); out_bdev: ext4_blkdev_put(bdev); return NULL; } ",0 "android::SoftOMXComponent *createSoftOMXComponent( const char *name, const OMX_CALLBACKTYPE *callbacks, OMX_PTR appData, OMX_COMPONENTTYPE **component) { return new android::SoftAMR(name, callbacks, appData, component); } ",0 "void udf_write_aext(struct inode *inode, struct extent_position *epos, struct kernel_lb_addr *eloc, uint32_t elen, int inc) { int adsize; uint8_t *ptr; struct short_ad *sad; struct long_ad *lad; struct udf_inode_info *iinfo = UDF_I(inode); if (!epos->bh) ptr = iinfo->i_ext.i_data + epos->offset - udf_file_entry_alloc_offset(inode) + iinfo->i_lenEAttr; else ptr = epos->bh->b_data + epos->offset; switch (iinfo->i_alloc_type) { case ICBTAG_FLAG_AD_SHORT: sad = (struct short_ad *)ptr; sad->extLength = cpu_to_le32(elen); sad->extPosition = cpu_to_le32(eloc->logicalBlockNum); adsize = sizeof(struct short_ad); break; case ICBTAG_FLAG_AD_LONG: lad = (struct long_ad *)ptr; lad->extLength = cpu_to_le32(elen); lad->extLocation = cpu_to_lelb(*eloc); memset(lad->impUse, 0x00, sizeof(lad->impUse)); adsize = sizeof(struct long_ad); break; default: return; } if (epos->bh) { if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || UDF_SB(inode->i_sb)->s_udfrev >= 0x0201) { struct allocExtDesc *aed = (struct allocExtDesc *)epos->bh->b_data; udf_update_tag(epos->bh->b_data, le32_to_cpu(aed->lengthAllocDescs) + sizeof(struct allocExtDesc)); } mark_buffer_dirty_inode(epos->bh, inode); } else { mark_inode_dirty(inode); } if (inc) epos->offset += adsize; } ",0 "UpdateActionMods(struct xkb_keymap *keymap, union xkb_action *act, xkb_mod_mask_t modmap) { switch (act->type) { case ACTION_TYPE_MOD_SET: case ACTION_TYPE_MOD_LATCH: case ACTION_TYPE_MOD_LOCK: if (act->mods.flags & ACTION_MODS_LOOKUP_MODMAP) act->mods.mods.mods = modmap; ComputeEffectiveMask(keymap, &act->mods.mods); break; default: break; } } ",0 "status_t NuMediaExtractor::seekTo( int64_t timeUs, MediaSource::ReadOptions::SeekMode mode) { Mutex::Autolock autoLock(mLock); ssize_t minIndex = fetchTrackSamples(timeUs, mode); if (minIndex < 0) { return ERROR_END_OF_STREAM; } return OK; } ",0 " base::string16 GetAppForProtocolUsingAssocQuery(const GURL& url) { base::string16 url_scheme = base::ASCIIToUTF16(url.scheme()); if (url_scheme.empty()) return base::string16(); wchar_t out_buffer[1024]; DWORD buffer_size = arraysize(out_buffer); HRESULT hr = AssocQueryString(ASSOCF_IS_PROTOCOL, ASSOCSTR_FRIENDLYAPPNAME, url_scheme.c_str(), NULL, out_buffer, &buffer_size); if (FAILED(hr)) { DLOG(WARNING) << ""AssocQueryString failed!""; return base::string16(); } return base::string16(out_buffer); } ",1 "bool RenderProcessHostImpl::WaitForBackingStoreMsg( int render_widget_id, const base::TimeDelta& max_delay, IPC::Message* msg) { if (child_process_launcher_.get() && child_process_launcher_->IsStarting()) return false; return widget_helper_->WaitForBackingStoreMsg(render_widget_id, max_delay, msg); } ",0 "bool Downmix_foldGeneric( uint32_t mask, int16_t *pSrc, int16_t*pDst, size_t numFrames, bool accumulate) { if (mask & kUnsupported) { ALOGE(""Unsupported channels (top or front left/right of center)""); return false; } if ((mask & AUDIO_CHANNEL_OUT_STEREO) != AUDIO_CHANNEL_OUT_STEREO) { ALOGE(""Front channels must be present""); return false; } bool hasSides = false; if ((mask & kSides) != 0) { if ((mask & kSides) != kSides) { ALOGE(""Side channels must be used as a pair""); return false; } hasSides = true; } bool hasBacks = false; if ((mask & kBacks) != 0) { if ((mask & kBacks) != kBacks) { ALOGE(""Back channels must be used as a pair""); return false; } hasBacks = true; } const int numChan = audio_channel_count_from_out_mask(mask); const bool hasFC = ((mask & AUDIO_CHANNEL_OUT_FRONT_CENTER) == AUDIO_CHANNEL_OUT_FRONT_CENTER); const bool hasLFE = ((mask & AUDIO_CHANNEL_OUT_LOW_FREQUENCY) == AUDIO_CHANNEL_OUT_LOW_FREQUENCY); const bool hasBC = ((mask & AUDIO_CHANNEL_OUT_BACK_CENTER) == AUDIO_CHANNEL_OUT_BACK_CENTER); const int indexFC = hasFC ? 2 : 1; // front center const int indexLFE = hasLFE ? indexFC + 1 : indexFC; // low frequency const int indexBL = hasBacks ? indexLFE + 1 : indexLFE; // back left const int indexBR = hasBacks ? indexBL + 1 : indexBL; // back right const int indexBC = hasBC ? indexBR + 1 : indexBR; // back center const int indexSL = hasSides ? indexBC + 1 : indexBC; // side left const int indexSR = hasSides ? indexSL + 1 : indexSL; // side right int32_t lt, rt, centersLfeContrib; // samples in Q19.12 format if (accumulate) { while (numFrames) { centersLfeContrib = 0; if (hasFC) { centersLfeContrib += pSrc[indexFC]; } if (hasLFE) { centersLfeContrib += pSrc[indexLFE]; } if (hasBC) { centersLfeContrib += pSrc[indexBC]; } centersLfeContrib *= MINUS_3_DB_IN_Q19_12; lt = (pSrc[0] << 12); rt = (pSrc[1] << 12); if (hasSides) { lt += pSrc[indexSL] << 12; rt += pSrc[indexSR] << 12; } if (hasBacks) { lt += pSrc[indexBL] << 12; rt += pSrc[indexBR] << 12; } lt += centersLfeContrib; rt += centersLfeContrib; pDst[0] = clamp16(pDst[0] + (lt >> 13)); pDst[1] = clamp16(pDst[1] + (rt >> 13)); pSrc += numChan; pDst += 2; numFrames--; } } else { while (numFrames) { centersLfeContrib = 0; if (hasFC) { centersLfeContrib += pSrc[indexFC]; } if (hasLFE) { centersLfeContrib += pSrc[indexLFE]; } if (hasBC) { centersLfeContrib += pSrc[indexBC]; } centersLfeContrib *= MINUS_3_DB_IN_Q19_12; lt = (pSrc[0] << 12); rt = (pSrc[1] << 12); if (hasSides) { lt += pSrc[indexSL] << 12; rt += pSrc[indexSR] << 12; } if (hasBacks) { lt += pSrc[indexBL] << 12; rt += pSrc[indexBR] << 12; } lt += centersLfeContrib; rt += centersLfeContrib; pDst[0] = clamp16(lt >> 13); // differs from when accumulate is true above pDst[1] = clamp16(rt >> 13); // differs from when accumulate is true above pSrc += numChan; pDst += 2; numFrames--; } } return true; } ",0 "CStarter::createTempExecuteDir( void ) { if( is_gridshell ) { dprintf( D_ALWAYS, ""gridshell running in: \""%s\""\n"", WorkingDir.Value() ); return true; } #ifndef WIN32 bool use_chown = false; if (can_switch_ids()) { struct stat st; if (stat(Execute, &st) == -1) { EXCEPT(""stat failed on %s: %s"", Execute, strerror(errno)); } if (!(st.st_mode & S_IWOTH)) { use_chown = true; } } priv_state priv; if (use_chown) { priv = set_condor_priv(); } else { priv = set_user_priv(); } #else priv_state priv = set_condor_priv(); #endif CondorPrivSepHelper* cpsh = condorPrivSepHelper(); if (cpsh != NULL) { cpsh->initialize_sandbox(WorkingDir.Value()); WriteAdFiles(); } else { if( mkdir(WorkingDir.Value(), 0777) < 0 ) { dprintf( D_FAILURE|D_ALWAYS, ""couldn't create dir %s: %s\n"", WorkingDir.Value(), strerror(errno) ); set_priv( priv ); return false; } WriteAdFiles(); #if !defined(WIN32) if (use_chown) { priv_state p = set_root_priv(); if (chown(WorkingDir.Value(), get_user_uid(), get_user_gid()) == -1) { EXCEPT(""chown error on %s: %s"", WorkingDir.Value(), strerror(errno)); } set_priv(p); } #endif } #ifdef WIN32 { canonicalize_dir_delimiters(WorkingDir); perm dirperm; const char * nobody_login = get_user_loginname(); ASSERT(nobody_login); dirperm.init(nobody_login); bool ret_val = dirperm.set_acls( WorkingDir.Value() ); if ( !ret_val ) { dprintf(D_ALWAYS,""UNABLE TO SET PERMISSIONS ON EXECUTE DIRECTORY\n""); set_priv( priv ); return false; } } if ( param_boolean_crufty(""ENCRYPT_EXECUTE_DIRECTORY"", false) ) { typedef BOOL (WINAPI *FPEncryptionDisable)(LPCWSTR,BOOL); typedef BOOL (WINAPI *FPEncryptFileA)(LPCSTR); bool efs_support = true; HINSTANCE advapi = LoadLibrary(""ADVAPI32.dll""); if ( !advapi ) { dprintf(D_FULLDEBUG, ""Can't load advapi32.dll\n""); efs_support = false; } FPEncryptionDisable EncryptionDisable = (FPEncryptionDisable) GetProcAddress(advapi,""EncryptionDisable""); if ( !EncryptionDisable ) { dprintf(D_FULLDEBUG, ""cannot get address for EncryptionDisable()""); efs_support = false; } FPEncryptFileA EncryptFile = (FPEncryptFileA) GetProcAddress(advapi,""EncryptFileA""); if ( !EncryptFile ) { dprintf(D_FULLDEBUG, ""cannot get address for EncryptFile()""); efs_support = false; } if ( efs_support ) { wchar_t *WorkingDir_w = new wchar_t[WorkingDir.Length()+1]; swprintf(WorkingDir_w, L""%S"", WorkingDir.Value()); EncryptionDisable(WorkingDir_w, FALSE); delete[] WorkingDir_w; if ( EncryptFile(WorkingDir.Value()) == 0 ) { dprintf(D_ALWAYS, ""Could not encrypt execute directory "" ""(err=%li)\n"", GetLastError()); } FreeLibrary(advapi); // don't leak the dll library handle } else { dprintf(D_ALWAYS, ""ENCRYPT_EXECUTE_DIRECTORY set to True, "" ""but the Encryption"" "" functions are unavailable!""); } } // ENCRYPT_EXECUTE_DIRECTORY is True #endif /* WIN32 */ if( chdir(WorkingDir.Value()) < 0 ) { dprintf( D_FAILURE|D_ALWAYS, ""couldn't move to %s: %s\n"", WorkingDir.Value(), strerror(errno) ); set_priv( priv ); return false; } dprintf( D_FULLDEBUG, ""Done moving to directory \""%s\""\n"", WorkingDir.Value() ); set_priv( priv ); return true; } ",0 "static int pid_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) { struct inode *inode = dentry->d_inode; struct task_struct *task; const struct cred *cred; generic_fillattr(inode, stat); rcu_read_lock(); stat->uid = 0; stat->gid = 0; task = pid_task(proc_pid(inode), PIDTYPE_PID); if (task) { if ((inode->i_mode == (S_IFDIR|S_IRUGO|S_IXUGO)) || task_dumpable(task)) { cred = __task_cred(task); stat->uid = cred->euid; stat->gid = cred->egid; } } rcu_read_unlock(); return 0; } ",0 "void GDataFileSystem::OnUpdateChecked(ContentOrigin initial_origin, GDataFileError error, GDataEntry* /* entry */) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (error != GDATA_FILE_OK) { directory_service_->set_origin(initial_origin); } } ",0 "void AwContents::UpdateLastHitTestData(JNIEnv* env, jobject obj) { DCHECK_CURRENTLY_ON(BrowserThread::UI); if (!render_view_host_ext_->HasNewHitTestData()) return; const AwHitTestData& data = render_view_host_ext_->GetLastHitTestData(); render_view_host_ext_->MarkHitTestDataRead(); ScopedJavaLocalRef extra_data_for_type; if (data.extra_data_for_type.length()) extra_data_for_type = ConvertUTF8ToJavaString( env, data.extra_data_for_type); ScopedJavaLocalRef href; if (data.href.length()) href = ConvertUTF16ToJavaString(env, data.href); ScopedJavaLocalRef anchor_text; if (data.anchor_text.length()) anchor_text = ConvertUTF16ToJavaString(env, data.anchor_text); ScopedJavaLocalRef img_src; if (data.img_src.is_valid()) img_src = ConvertUTF8ToJavaString(env, data.img_src.spec()); Java_AwContents_updateHitTestData(env, obj, data.type, extra_data_for_type.obj(), href.obj(), anchor_text.obj(), img_src.obj()); } ",0 "int dgnc_mgmt_close(struct inode *inode, struct file *file) { unsigned long flags; unsigned int minor = iminor(inode); spin_lock_irqsave(&dgnc_global_lock, flags); /* mgmt device */ if (minor < MAXMGMTDEVICES) { if (dgnc_mgmt_in_use[minor]) dgnc_mgmt_in_use[minor] = 0; } spin_unlock_irqrestore(&dgnc_global_lock, flags); return 0; } ",0 "void gitn_del(GF_Box *s) { u32 i; GroupIdToNameBox *ptr = (GroupIdToNameBox *)s; if (ptr == NULL) return; for (i=0; inb_entries; i++) { if (ptr->entries[i].name) gf_free(ptr->entries[i].name); } if (ptr->entries) gf_free(ptr->entries); gf_free(ptr); } ",0 "static int check_ld_abs(struct verifier_env *env, struct bpf_insn *insn) { struct reg_state *regs = env->cur_state.regs; u8 mode = BPF_MODE(insn->code); struct reg_state *reg; int i, err; if (!may_access_skb(env->prog->type)) { verbose(""BPF_LD_ABS|IND instructions not allowed for this program type\n""); return -EINVAL; } if (insn->dst_reg != BPF_REG_0 || insn->off != 0 || BPF_SIZE(insn->code) == BPF_DW || (mode == BPF_ABS && insn->src_reg != BPF_REG_0)) { verbose(""BPF_LD_ABS uses reserved fields\n""); return -EINVAL; } /* check whether implicit source operand (register R6) is readable */ err = check_reg_arg(regs, BPF_REG_6, SRC_OP); if (err) return err; if (regs[BPF_REG_6].type != PTR_TO_CTX) { verbose(""at the time of BPF_LD_ABS|IND R6 != pointer to skb\n""); return -EINVAL; } if (mode == BPF_IND) { /* check explicit source operand */ err = check_reg_arg(regs, insn->src_reg, SRC_OP); if (err) return err; } /* reset caller saved regs to unreadable */ for (i = 0; i < CALLER_SAVED_REGS; i++) { reg = regs + caller_saved[i]; reg->type = NOT_INIT; reg->imm = 0; } /* mark destination R0 register as readable, since it contains * the value fetched from the packet */ regs[BPF_REG_0].type = UNKNOWN_VALUE; return 0; } ",0 "bool IsBytes(DataElement::Type type) { return type == DataElement::TYPE_BYTES || type == DataElement::TYPE_BYTES_DESCRIPTION; } ",0 "double WebPagePrivate::newScaleForBlockZoomRect(const IntRect& rect, double oldScale, double margin) { if (rect.isEmpty()) return std::numeric_limits::max(); ASSERT(rect.width() + margin); double newScale = oldScale * static_cast(transformedActualVisibleSize().width()) / (rect.width() + margin); return newScale; } ",0 "int ClearCacheFunction::GetRemovalMask() const { return BrowsingDataRemover::REMOVE_CACHE; } ",0 "void XMLRPC_SetValueDouble(XMLRPC_VALUE value, double val) { if(value) { value->type = xmlrpc_double; value->d = val; } } ",0 "static int move_addr_to_user(struct sockaddr_storage *kaddr, int klen, void __user *uaddr, int __user *ulen) { int err; int len; err = get_user(len, ulen); if (err) return err; if (len > klen) len = klen; if (len < 0 || len > sizeof(struct sockaddr_storage)) return -EINVAL; if (len) { if (audit_sockaddr(klen, kaddr)) return -ENOMEM; if (copy_to_user(uaddr, kaddr, len)) return -EFAULT; } /* * ""fromlen shall refer to the value before truncation.."" * 1003.1g */ return __put_user(klen, ulen); } ",0 "static long calc_group_runnable(struct cfs_rq *cfs_rq, long shares) { long runnable, load_avg; load_avg = max(cfs_rq->avg.load_avg, scale_load_down(cfs_rq->load.weight)); runnable = max(cfs_rq->avg.runnable_load_avg, scale_load_down(cfs_rq->runnable_weight)); runnable *= shares; if (load_avg) runnable /= load_avg; return clamp_t(long, runnable, MIN_SHARES, shares); } ",0 "int PropertyTreeManager::EnsureCompositorTransformNode( const TransformPaintPropertyNode* transform_node) { DCHECK(transform_node); if (!transform_node) return kSecondaryRootNodeId; auto it = transform_node_map_.find(transform_node); if (it != transform_node_map_.end()) return it->value; int parent_id = EnsureCompositorTransformNode(transform_node->Parent()); int id = GetTransformTree().Insert(cc::TransformNode(), parent_id); cc::TransformNode& compositor_node = *GetTransformTree().Node(id); compositor_node.source_node_id = parent_id; FloatPoint3D origin = transform_node->Origin(); compositor_node.pre_local.matrix().setTranslate(-origin.X(), -origin.Y(), -origin.Z()); compositor_node.local.matrix() = TransformationMatrix::ToSkMatrix44(transform_node->Matrix()); compositor_node.post_local.matrix().setTranslate(origin.X(), origin.Y(), origin.Z()); compositor_node.needs_local_transform_update = true; compositor_node.flattens_inherited_transform = transform_node->FlattensInheritedTransform(); compositor_node.sorting_context_id = transform_node->RenderingContextId(); CompositorElementId compositor_element_id = transform_node->GetCompositorElementId(); if (compositor_element_id) { property_trees_.element_id_to_transform_node_index[compositor_element_id] = id; } if (auto* scroll_node = transform_node->ScrollNode()) { auto scroll_offset_size = transform_node->Matrix().To2DTranslation(); auto scroll_offset = gfx::ScrollOffset(-scroll_offset_size.Width(), -scroll_offset_size.Height()); DCHECK(compositor_node.local.IsIdentityOr2DTranslation()); compositor_node.scroll_offset = scroll_offset; compositor_node.local.MakeIdentity(); compositor_node.scrolls = true; CreateCompositorScrollNode(scroll_node, compositor_node); } auto result = transform_node_map_.Set(transform_node, id); DCHECK(result.is_new_entry); GetTransformTree().set_needs_update(true); return id; } ",0 "void SVGDocumentExtensions::serviceAnimations(double monotonicAnimationStartTime) { WillBeHeapVector > timeContainers; timeContainers.appendRange(m_timeContainers.begin(), m_timeContainers.end()); WillBeHeapVector >::iterator end = timeContainers.end(); for (WillBeHeapVector >::iterator itr = timeContainers.begin(); itr != end; ++itr) (*itr)->timeContainer()->serviceAnimations(monotonicAnimationStartTime); } ",0 "sshpkt_get_cstring(struct ssh *ssh, char **valp, size_t *lenp) { return sshbuf_get_cstring(ssh->state->incoming_packet, valp, lenp); } ",0 "int yr_re_parse( const char* re_string, RE_AST** re_ast, RE_ERROR* error) { return yr_parse_re_string(re_string, re_ast, error); } ",0 "static int parse_hw_handler(struct dm_arg_set *as, struct multipath *m) { unsigned hw_argc; int ret; struct dm_target *ti = m->ti; static struct dm_arg _args[] = { {0, 1024, ""invalid number of hardware handler args""}, }; if (dm_read_arg_group(_args, as, &hw_argc, &ti->error)) return -EINVAL; if (!hw_argc) return 0; m->hw_handler_name = kstrdup(dm_shift_arg(as), GFP_KERNEL); request_module(""scsi_dh_%s"", m->hw_handler_name); if (scsi_dh_handler_exist(m->hw_handler_name) == 0) { ti->error = ""unknown hardware handler type""; ret = -EINVAL; goto fail; } if (hw_argc > 1) { char *p; int i, j, len = 4; for (i = 0; i <= hw_argc - 2; i++) len += strlen(as->argv[i]) + 1; p = m->hw_handler_params = kzalloc(len, GFP_KERNEL); if (!p) { ti->error = ""memory allocation failed""; ret = -ENOMEM; goto fail; } j = sprintf(p, ""%d"", hw_argc - 1); for (i = 0, p+=j+1; i <= hw_argc - 2; i++, p+=j+1) j = sprintf(p, ""%s"", as->argv[i]); } dm_consume_args(as, hw_argc - 1); return 0; fail: kfree(m->hw_handler_name); m->hw_handler_name = NULL; return ret; } ",0 "static void xhci_stall_ep(XHCITransfer *xfer) { XHCIEPContext *epctx = xfer->epctx; XHCIState *xhci = epctx->xhci; uint32_t err; XHCIStreamContext *sctx; if (epctx->nr_pstreams) { sctx = xhci_find_stream(epctx, xfer->streamid, &err); if (sctx == NULL) { return; } sctx->ring.dequeue = xfer->trbs[0].addr; sctx->ring.ccs = xfer->trbs[0].ccs; xhci_set_ep_state(xhci, epctx, sctx, EP_HALTED); } else { epctx->ring.dequeue = xfer->trbs[0].addr; epctx->ring.ccs = xfer->trbs[0].ccs; xhci_set_ep_state(xhci, epctx, NULL, EP_HALTED); } } ",0 "clamp_indexed(const fz_colorspace *cs, const float *in, float *out) { struct indexed *idx = cs->data; *out = fz_clamp(*in, 0, idx->high) / 255.0f; /* To do, avoid 255 divide */ } ",0 "bool ModifyAttachmentsForEmulatedFramebuffer(std::vector* attachments) { for (GLenum& attachment : *attachments) { if (!ModifyAttachmentForEmulatedFramebuffer(&attachment)) { return false; } } return true; } ",0 "static int ext3_statfs (struct dentry * dentry, struct kstatfs * buf) { struct super_block *sb = dentry->d_sb; struct ext3_sb_info *sbi = EXT3_SB(sb); struct ext3_super_block *es = sbi->s_es; u64 fsid; if (test_opt(sb, MINIX_DF)) { sbi->s_overhead_last = 0; } else if (sbi->s_blocks_last != le32_to_cpu(es->s_blocks_count)) { unsigned long ngroups = sbi->s_groups_count, i; ext3_fsblk_t overhead = 0; smp_rmb(); /* * Compute the overhead (FS structures). This is constant * for a given filesystem unless the number of block groups * changes so we cache the previous value until it does. */ /* * All of the blocks before first_data_block are * overhead */ overhead = le32_to_cpu(es->s_first_data_block); /* * Add the overhead attributed to the superblock and * block group descriptors. If the sparse superblocks * feature is turned on, then not all groups have this. */ for (i = 0; i < ngroups; i++) { overhead += ext3_bg_has_super(sb, i) + ext3_bg_num_gdb(sb, i); cond_resched(); } /* * Every block group has an inode bitmap, a block * bitmap, and an inode table. */ overhead += ngroups * (2 + sbi->s_itb_per_group); sbi->s_overhead_last = overhead; smp_wmb(); sbi->s_blocks_last = le32_to_cpu(es->s_blocks_count); } buf->f_type = EXT3_SUPER_MAGIC; buf->f_bsize = sb->s_blocksize; buf->f_blocks = le32_to_cpu(es->s_blocks_count) - sbi->s_overhead_last; buf->f_bfree = percpu_counter_sum_positive(&sbi->s_freeblocks_counter); buf->f_bavail = buf->f_bfree - le32_to_cpu(es->s_r_blocks_count); if (buf->f_bfree < le32_to_cpu(es->s_r_blocks_count)) buf->f_bavail = 0; buf->f_files = le32_to_cpu(es->s_inodes_count); buf->f_ffree = percpu_counter_sum_positive(&sbi->s_freeinodes_counter); buf->f_namelen = EXT3_NAME_LEN; fsid = le64_to_cpup((void *)es->s_uuid) ^ le64_to_cpup((void *)es->s_uuid + sizeof(u64)); buf->f_fsid.val[0] = fsid & 0xFFFFFFFFUL; buf->f_fsid.val[1] = (fsid >> 32) & 0xFFFFFFFFUL; return 0; } ",0 "void HTMLStyleElement::FinishParsingChildren() { StyleElement::ProcessingResult result = StyleElement::FinishParsingChildren(*this); HTMLElement::FinishParsingChildren(); if (result == StyleElement::kProcessingFatalError) NotifyLoadedSheetAndAllCriticalSubresources( kErrorOccurredLoadingSubresource); } ",0 "error::Error GLES2DecoderImpl::HandleStencilStrokePathCHROMIUM( uint32_t immediate_data_size, const volatile void* cmd_data) { static const char kFunctionName[] = ""glStencilStrokePathCHROMIUM""; const volatile gles2::cmds::StencilStrokePathCHROMIUM& c = *static_cast( cmd_data); if (!features().chromium_path_rendering) return error::kUnknownCommand; GLuint service_id = 0; if (!path_manager()->GetPath(static_cast(c.path), &service_id)) { return error::kNoError; } GLint reference = static_cast(c.reference); GLuint mask = static_cast(c.mask); if (!CheckBoundDrawFramebufferValid(kFunctionName)) return error::kNoError; ApplyDirtyState(); api()->glStencilStrokePathNVFn(service_id, reference, mask); return error::kNoError; } ",0 "static void VoidMethodAllowSharedArrayBufferViewArgMethod(const v8::FunctionCallbackInfo& info) { ExceptionState exception_state(info.GetIsolate(), ExceptionState::kExecutionContext, ""TestObject"", ""voidMethodAllowSharedArrayBufferViewArg""); TestObject* impl = V8TestObject::ToImpl(info.Holder()); if (UNLIKELY(info.Length() < 1)) { exception_state.ThrowTypeError(ExceptionMessages::NotEnoughArguments(1, info.Length())); return; } MaybeShared array_buffer_view_arg; array_buffer_view_arg = ToMaybeShared>(info.GetIsolate(), info[0], exception_state); if (exception_state.HadException()) return; if (!array_buffer_view_arg) { exception_state.ThrowTypeError(ExceptionMessages::ArgumentNotOfType(0, ""ArrayBufferView"")); return; } impl->voidMethodAllowSharedArrayBufferViewArg(array_buffer_view_arg); } ",0 "static int vmci_transport_notify_poll_in( struct vsock_sock *vsk, size_t target, bool *data_ready_now) { return vmci_trans(vsk)->notify_ops->poll_in( &vsk->sk, target, data_ready_now); } ",0 "PHP_FUNCTION(mcrypt_ecb) { zval **mode; char *cipher, *key, *data, *iv = NULL; int cipher_len, key_len, data_len, iv_len = 0; MCRYPT_GET_CRYPT_ARGS convert_to_long_ex(mode); php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, ""ecb"", iv, iv_len, ZEND_NUM_ARGS(), Z_LVAL_PP(mode), return_value TSRMLS_CC); } ",1 "MagickExport MagickBooleanType SyncAuthenticPixels(Image *image, ExceptionInfo *exception) { CacheInfo *restrict cache_info; const int id = GetOpenMPThreadId(); MagickBooleanType status; assert(image != (Image *) NULL); assert(image->signature == MagickSignature); assert(image->cache != (Cache) NULL); cache_info=(CacheInfo *) image->cache; assert(cache_info->signature == MagickSignature); if (cache_info->methods.sync_authentic_pixels_handler != (SyncAuthenticPixelsHandler) NULL) return(cache_info->methods.sync_authentic_pixels_handler(image,exception)); assert(id < (int) cache_info->number_threads); status=SyncAuthenticPixelCacheNexus(image,cache_info->nexus_info[id], exception); return(status); } ",0 "bool TestBrowserWindow::IsToolbarVisible() const { return false; } ",0 "RenderWidgetHostImpl* WebContentsImpl::GetRenderWidgetHostWithPageFocus() { WebContentsImpl* focused_web_contents = GetFocusedWebContents(); if (focused_web_contents->ShowingInterstitialPage()) { return static_cast( focused_web_contents->GetRenderManager() ->interstitial_page() ->GetMainFrame()) ->GetRenderWidgetHost(); } return focused_web_contents->GetMainFrame()->GetRenderWidgetHost(); } ",0 "bool AXObjectCacheImpl::accessibilityEnabled() { Settings* settings = this->settings(); if (!settings) return false; return settings->getAccessibilityEnabled(); } ",0 "int dtls1_is_timer_expired(SSL *s) { struct timeval timeleft; /* Get time left until timeout, return false if no timer running */ if (dtls1_get_timeout(s, &timeleft) == NULL) { return 0; } /* Return false if timer is not expired yet */ if (timeleft.tv_sec > 0 || timeleft.tv_usec > 0) { return 0; } /* Timer expired, so return true */ return 1; } ",0 "const ContentEncoding* Track::GetContentEncodingByIndex( unsigned long idx) const { const ptrdiff_t count = content_encoding_entries_end_ - content_encoding_entries_; assert(count >= 0); if (idx >= static_cast(count)) return NULL; return content_encoding_entries_[idx]; } ",0 "static int reg_vif_get_iflink(const struct net_device *dev) { return 0; } ",0 "static void free_sched_groups(struct sched_group *sg, int free_sgp) { struct sched_group *tmp, *first; if (!sg) return; first = sg; do { tmp = sg->next; if (free_sgp && atomic_dec_and_test(&sg->sgp->ref)) kfree(sg->sgp); kfree(sg); sg = tmp; } while (sg != first); } ",0 "void BrowserChildProcessHostImpl::CreateMetricsAllocator() { if (!base::GlobalHistogramAllocator::Get()) return; size_t memory_size; base::StringPiece metrics_name; switch (data_.process_type) { case PROCESS_TYPE_UTILITY: memory_size = 256 << 10; // 256 KiB metrics_name = ""UtilityMetrics""; break; case PROCESS_TYPE_ZYGOTE: memory_size = 64 << 10; // 64 KiB metrics_name = ""ZygoteMetrics""; break; case PROCESS_TYPE_SANDBOX_HELPER: memory_size = 64 << 10; // 64 KiB metrics_name = ""SandboxHelperMetrics""; break; case PROCESS_TYPE_GPU: memory_size = 64 << 10; // 64 KiB metrics_name = ""GpuMetrics""; break; case PROCESS_TYPE_PPAPI_PLUGIN: memory_size = 64 << 10; // 64 KiB metrics_name = ""PpapiPluginMetrics""; break; case PROCESS_TYPE_PPAPI_BROKER: memory_size = 64 << 10; // 64 KiB metrics_name = ""PpapiBrokerMetrics""; break; default: int process_type = data_.process_type; if (process_type >= PROCESS_TYPE_CONTENT_END) process_type += 1000 - PROCESS_TYPE_CONTENT_END; base::UmaHistogramSparse( ""UMA.SubprocessMetricsProvider.UntrackedProcesses"", process_type); return; } std::unique_ptr shm(new base::SharedMemory()); if (!shm->CreateAndMapAnonymous(memory_size)) return; metrics_allocator_.reset(new base::SharedPersistentMemoryAllocator( std::move(shm), static_cast(data_.id), metrics_name, /*readonly=*/false)); } ",0 "JsVar *jswrap_graphics_getModified(JsVar *parent, bool reset) { JsGraphics gfx; if (!graphicsGetFromVar(&gfx, parent)) return 0; JsVar *obj = 0; if (gfx.data.modMinX <= gfx.data.modMaxX) { // do we have a rect? obj = jsvNewObject(); if (obj) { jsvObjectSetChildAndUnLock(obj, ""x1"", jsvNewFromInteger(gfx.data.modMinX)); jsvObjectSetChildAndUnLock(obj, ""y1"", jsvNewFromInteger(gfx.data.modMinY)); jsvObjectSetChildAndUnLock(obj, ""x2"", jsvNewFromInteger(gfx.data.modMaxX)); jsvObjectSetChildAndUnLock(obj, ""y2"", jsvNewFromInteger(gfx.data.modMaxY)); } } if (reset) { gfx.data.modMaxX = -32768; gfx.data.modMaxY = -32768; gfx.data.modMinX = 32767; gfx.data.modMinY = 32767; graphicsSetVar(&gfx); } return obj; } ",0 "GaiaCookieManagerService::GaiaCookieRequest::GaiaCookieRequest( GaiaCookieRequestType request_type, const std::string& account_id, const std::string& source) : request_type_(request_type), account_id_(account_id), source_(source) {} ",0 "static int decode_attr_maxfilesize(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) { __be32 *p; int status = 0; *res = 0; if (unlikely(bitmap[0] & (FATTR4_WORD0_MAXFILESIZE - 1U))) return -EIO; if (likely(bitmap[0] & FATTR4_WORD0_MAXFILESIZE)) { READ_BUF(8); READ64(*res); bitmap[0] &= ~FATTR4_WORD0_MAXFILESIZE; } dprintk(""%s: maxfilesize=%Lu\n"", __func__, (unsigned long long)*res); return status; } ",0 "gx_device_set_media_from_hwsize(gx_device *dev) { int rot = (dev->LeadingEdge & 1); double x = dev->width * 72.0 / dev->HWResolution[0]; double y = dev->height * 72.0 / dev->HWResolution[1]; if (rot) { dev->MediaSize[1] = x; dev->MediaSize[0] = y; } else { dev->MediaSize[0] = x; dev->MediaSize[1] = y; } } ",0 "int PDFiumEngine::GetNumberOfPages() { return pages_.size(); } ",0 "void Shell::OnRootWindowAdded(aura::Window* root_window) { FOR_EACH_OBSERVER(ShellObserver, observers_, OnRootWindowAdded(root_window)); } ",0 "static void ion_vm_close(struct vm_area_struct *vma) { struct ion_buffer *buffer = vma->vm_private_data; struct ion_vma_list *vma_list, *tmp; pr_debug(""%s\n"", __func__); mutex_lock(&buffer->lock); list_for_each_entry_safe(vma_list, tmp, &buffer->vmas, list) { if (vma_list->vma != vma) continue; list_del(&vma_list->list); kfree(vma_list); pr_debug(""%s: deleting %p\n"", __func__, vma); break; } mutex_unlock(&buffer->lock); } ",0 "void SynchronizeVisualPropertiesMessageFilter::WaitForRect() { screen_space_rect_run_loop_->Run(); } ",0 "HTMLDialogElement* Document::ActiveModalDialog() const { for (auto it = top_layer_elements_.rbegin(); it != top_layer_elements_.rend(); ++it) { if (auto* dialog = ToHTMLDialogElementOrNull(*it)) return dialog; } return nullptr; } ",0 "void GLES2Implementation::InvalidateReadbackBufferShadowDataCHROMIUM( GLuint buffer_id) { readback_buffer_shadow_tracker_->OnBufferWrite(buffer_id); } ",0 "test_bson_append_dbpointer (void) { bson_oid_t oid; bson_t *b; bson_t *b2; uint8_t malformed_data[] = { 0x0C, 0x00, 0x00, 0x00, /* document length (12) */ 0x0C, /* dbpointer type */ 0x00, /* empty string key */ 0x04, 0x00, 0x00, 0x00, /* string length (4). This is OOB. */ 0x00, /* empty string */ 0x00 /* end of document */ }; size_t error_offset = 0; b = bson_new (); bson_oid_init_from_string (&oid, ""0123abcd0123abcd0123abcd""); BSON_ASSERT (bson_append_dbpointer (b, ""dbpointer"", -1, ""foo"", &oid)); b2 = get_bson (""test28.bson""); BSON_ASSERT_BSON_EQUAL (b, b2); bson_destroy (b); bson_destroy (b2); b = bson_new_from_data (malformed_data, sizeof (malformed_data)); BSON_ASSERT (b); BSON_ASSERT (!bson_validate (b, BSON_VALIDATE_NONE, &error_offset)); BSON_ASSERT (error_offset == 6); bson_destroy (b); } ",0 "acpi_os_write_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, u64 value, u32 width) { int result, size; switch (width) { case 8: size = 1; break; case 16: size = 2; break; case 32: size = 4; break; default: return AE_ERROR; } result = raw_pci_write(pci_id->segment, pci_id->bus, PCI_DEVFN(pci_id->device, pci_id->function), reg, size, value); return (result ? AE_ERROR : AE_OK); } ",0 "static inline int _setEdgePixel(const gdImagePtr src, unsigned int x, unsigned int y, gdFixed coverage, const int bgColor) { const gdFixed f_127 = gd_itofx(127); register int c = src->tpixels[y][x]; c = c | (( (int) (gd_fxtof(gd_mulfx(coverage, f_127)) + 50.5f)) << 24); return _color_blend(bgColor, c); } ",1 "static int StreamTcpTest13 (void) { Packet *p = SCMalloc(SIZE_OF_PACKET); if (unlikely(p == NULL)) return 0; Flow f; ThreadVars tv; StreamTcpThread stt; TCPHdr tcph; uint8_t payload[4]; memset(p, 0, SIZE_OF_PACKET); PacketQueue pq; memset(&pq,0,sizeof(PacketQueue)); memset (&f, 0, sizeof(Flow)); memset(&tv, 0, sizeof (ThreadVars)); memset(&stt, 0, sizeof (StreamTcpThread)); memset(&tcph, 0, sizeof (TCPHdr)); FLOW_INITIALIZE(&f); p->flow = &f; StreamTcpUTInit(&stt.ra_ctx); tcph.th_win = htons(5480); tcph.th_seq = htonl(10); tcph.th_ack = htonl(11); tcph.th_flags = TH_ACK; p->tcph = &tcph; int ret = 0; if (StreamTcpPacket(&tv, p, &stt, &pq) == -1) goto end; p->tcph->th_seq = htonl(10); p->tcph->th_ack = htonl(11); p->tcph->th_flags = TH_ACK|TH_PUSH; p->flowflags = FLOW_PKT_TOSERVER; StreamTcpCreateTestPacket(payload, 0x42, 3, 4); /*BBB*/ p->payload = payload; p->payload_len = 3; if (StreamTcpPacket(&tv, p, &stt, &pq) == -1) goto end; p->tcph->th_seq = htonl(6); p->tcph->th_ack = htonl(11); p->tcph->th_flags = TH_ACK|TH_PUSH; p->flowflags = FLOW_PKT_TOSERVER; StreamTcpCreateTestPacket(payload, 0x42, 3, 4); /*BBB*/ p->payload = payload; p->payload_len = 3; if (StreamTcpPacket(&tv, p, &stt, &pq) == -1) goto end; if (stream_config.async_oneside != TRUE) { ret = 1; goto end; } if (! (((TcpSession *)(p->flow->protoctx))->flags & STREAMTCP_FLAG_ASYNC)) { printf(""failed in setting asynchronous session\n""); goto end; } if (((TcpSession *)(p->flow->protoctx))->state != TCP_ESTABLISHED) { printf(""failed in setting state\n""); goto end; } p->tcph->th_seq = htonl(11); p->tcph->th_ack = htonl(9); p->tcph->th_flags = TH_ACK|TH_PUSH; p->flowflags = FLOW_PKT_TOCLIENT; StreamTcpCreateTestPacket(payload, 0x42, 3, 4); /*BBB*/ p->payload = payload; p->payload_len = 3; if (StreamTcpPacket(&tv, p, &stt, &pq) == -1) goto end; if (((TcpSession *)(p->flow->protoctx))->client.last_ack != 9 && ((TcpSession *)(p->flow->protoctx))->server.next_seq != 14) { printf(""failed in seq %""PRIu32"" match\n"", ((TcpSession *)(p->flow->protoctx))->client.last_ack); goto end; } StreamTcpSessionPktFree(p); ret = 1; end: SCFree(p); FLOW_DESTROY(&f); StreamTcpUTDeinit(stt.ra_ctx); return ret; } ",0 "static void php_snmp_session_destructor(zend_rsrc_list_entry *rsrc TSRMLS_DC) { php_snmp_session *session = (php_snmp_session *)rsrc->ptr; netsnmp_session_free(&session); } ",0 "static inline struct sock *l2cap_get_sock_by_psm(int state, __le16 psm, bdaddr_t *src) { struct sock *s; read_lock(&l2cap_sk_list.lock); s = __l2cap_get_sock_by_psm(state, psm, src); if (s) bh_lock_sock(s); read_unlock(&l2cap_sk_list.lock); return s; } ",0 "static void vmcs12_save_pending_event(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12) { u32 idt_vectoring; unsigned int nr; if (vcpu->arch.exception.injected) { nr = vcpu->arch.exception.nr; idt_vectoring = nr | VECTORING_INFO_VALID_MASK; if (kvm_exception_is_soft(nr)) { vmcs12->vm_exit_instruction_len = vcpu->arch.event_exit_inst_len; idt_vectoring |= INTR_TYPE_SOFT_EXCEPTION; } else idt_vectoring |= INTR_TYPE_HARD_EXCEPTION; if (vcpu->arch.exception.has_error_code) { idt_vectoring |= VECTORING_INFO_DELIVER_CODE_MASK; vmcs12->idt_vectoring_error_code = vcpu->arch.exception.error_code; } vmcs12->idt_vectoring_info_field = idt_vectoring; } else if (vcpu->arch.nmi_injected) { vmcs12->idt_vectoring_info_field = INTR_TYPE_NMI_INTR | INTR_INFO_VALID_MASK | NMI_VECTOR; } else if (vcpu->arch.interrupt.injected) { nr = vcpu->arch.interrupt.nr; idt_vectoring = nr | VECTORING_INFO_VALID_MASK; if (vcpu->arch.interrupt.soft) { idt_vectoring |= INTR_TYPE_SOFT_INTR; vmcs12->vm_entry_instruction_len = vcpu->arch.event_exit_inst_len; } else idt_vectoring |= INTR_TYPE_EXT_INTR; vmcs12->idt_vectoring_info_field = idt_vectoring; } } ",0 "std::string TopSitesImpl::GetURLHash(const GURL& url) { return base::MD5String(url.spec()); } ",0 "int set_cpus_allowed_ptr(struct task_struct *p, const struct cpumask *new_mask) { unsigned long flags; struct rq *rq; unsigned int dest_cpu; int ret = 0; rq = task_rq_lock(p, &flags); if (cpumask_equal(&p->cpus_allowed, new_mask)) goto out; if (!cpumask_intersects(new_mask, cpu_active_mask)) { ret = -EINVAL; goto out; } do_set_cpus_allowed(p, new_mask); /* Can the task run on the task's current CPU? If so, we're done */ if (cpumask_test_cpu(task_cpu(p), new_mask)) goto out; dest_cpu = cpumask_any_and(cpu_active_mask, new_mask); if (p->on_rq) { struct migration_arg arg = { p, dest_cpu }; /* Need help from migration thread: drop lock and wait. */ task_rq_unlock(rq, p, &flags); stop_one_cpu(cpu_of(rq), migration_cpu_stop, &arg); tlb_migrate_finish(p->mm); return 0; } out: task_rq_unlock(rq, p, &flags); return ret; } ",0 "void GpuChannel::DidDestroyCommandBuffer(gfx::GpuPreference gpu_preference) { if (gpu_preference == gfx::PreferDiscreteGpu) --num_contexts_preferring_discrete_gpu_; DCHECK_GE(num_contexts_preferring_discrete_gpu_, 0); } ",0 "void HttpStreamParser::GetSSLInfo(SSLInfo* ssl_info) { if (request_->url.SchemeIs(""https"") && connection_->socket()) { SSLClientSocket* ssl_socket = static_cast(connection_->socket()); ssl_socket->GetSSLInfo(ssl_info); } } ",0 "bool CSPSource::matches(const KURL& url, ContentSecurityPolicy::RedirectStatus redirectStatus) const { if (!schemeMatches(url)) return false; if (isSchemeOnly()) return true; bool pathsMatch = (redirectStatus == ContentSecurityPolicy::DidRedirect) || pathMatches(url); return hostMatches(url) && portMatches(url) && pathsMatch; } ",0 "base::Optional GetOriginForURLLoaderFactory( GURL target_url, SiteInstanceImpl* site_instance) { if (target_url.SchemeIs(url::kAboutScheme)) { if (SiteIsolationPolicy::UseDedicatedProcessesForAllSites()) return url::Origin::Create(site_instance->GetSiteURL()); return base::nullopt; } return url::Origin::Create(target_url); } ",0 "get_caller_loginuid (GDBusMethodInvocation *context, gchar *loginuid, gint size) { PolkitSubject *subject; gchar *cmdline; gint pid; gint uid; gchar *path; gchar *buf; subject = polkit_system_bus_name_new (g_dbus_method_invocation_get_sender (context)); cmdline = _polkit_subject_get_cmdline (subject, &pid, &uid); g_free (cmdline); g_object_unref (subject); path = g_strdup_printf (""/proc/%d/loginuid"", pid); if (g_file_get_contents (path, &buf, NULL, NULL)) { strncpy (loginuid, buf, size); g_free (buf); } else { g_snprintf (loginuid, size, ""%d"", uid); } g_free (path); } ",0 "PassRefPtrWillBeRawPtr Document::embeds() { return ensureCachedCollection(DocEmbeds); } ",0 "CloudPolicyCacheBase::~CloudPolicyCacheBase() { FOR_EACH_OBSERVER(Observer, observer_list_, OnCacheGoingAway(this)); } ",0 "spannable_string_t* InputHandler::spannableTextInRange(int start, int end, int32_t flags) { if (!isActiveTextEdit()) return 0; if (start >= end) return 0; int length = end - start; WTF::String textString = elementText().substring(start, length); spannable_string_t* pst = (spannable_string_t*)fastMalloc(sizeof(spannable_string_t)); pst->str = (wchar_t*)malloc(sizeof(wchar_t) * (length + 1)); if (!pst->str) { logAlways(LogLevelCritical, ""InputHandler::spannableTextInRange Cannot allocate memory for string.""); free(pst); return 0; } int stringLength = 0; if (!convertStringToWchar(textString, pst->str, length + 1, &stringLength)) { logAlways(LogLevelCritical, ""InputHandler::spannableTextInRange failed to convert string.""); free(pst->str); free(pst); return 0; } pst->length = stringLength; pst->spans_count = 0; pst->spans = 0; return pst; } ",0 "void WebContentsImpl::RenderWidgetWasResized( RenderWidgetHostImpl* render_widget_host, const ScreenInfo& screen_info, bool width_changed) { RenderFrameHostImpl* rfh = GetMainFrame(); if (!rfh || render_widget_host != rfh->GetRenderWidgetHost()) return; SendPageMessage(new PageMsg_UpdateScreenInfo(MSG_ROUTING_NONE, screen_info)); for (auto& observer : observers_) observer.MainFrameWasResized(width_changed); } ",0 "QUrl QQuickWebView::icon() const { Q_D(const QQuickWebView); return QUrl(d->m_iconUrl); } ",0 "static int cxusb_read_status(struct dvb_frontend *fe, enum fe_status *status) { struct dvb_usb_adapter *adap = (struct dvb_usb_adapter *)fe->dvb->priv; struct cxusb_state *state = (struct cxusb_state *)adap->dev->priv; int ret; ret = state->fe_read_status(fe, status); /* it need resync slave fifo when signal change from unlock to lock.*/ if ((*status & FE_HAS_LOCK) && (!state->last_lock)) { mutex_lock(&state->stream_mutex); cxusb_streaming_ctrl(adap, 1); mutex_unlock(&state->stream_mutex); } state->last_lock = (*status & FE_HAS_LOCK) ? 1 : 0; return ret; } ",0 "static int pegasus_nway_reset(struct net_device *dev) { pegasus_t *pegasus = netdev_priv(dev); return mii_nway_restart(&pegasus->mii); } ",0 " static Maybe CollectValuesOrEntriesImpl( Isolate* isolate, Handle object, Handle values_or_entries, bool get_entries, int* nof_items, PropertyFilter filter) { int count = 0; KeyAccumulator accumulator(isolate, KeyCollectionMode::kOwnOnly, ALL_PROPERTIES); Subclass::CollectElementIndicesImpl( object, handle(object->elements(), isolate), &accumulator); Handle keys = accumulator.GetKeys(); for (int i = 0; i < keys->length(); ++i) { Handle key(keys->get(i), isolate); Handle value; uint32_t index; if (!key->ToUint32(&index)) continue; uint32_t entry = Subclass::GetEntryForIndexImpl( isolate, *object, object->elements(), index, filter); if (entry == kMaxUInt32) continue; PropertyDetails details = Subclass::GetDetailsImpl(*object, entry); if (details.kind() == kData) { value = Subclass::GetImpl(isolate, object->elements(), entry); } else { LookupIterator it(isolate, object, index, LookupIterator::OWN); ASSIGN_RETURN_ON_EXCEPTION_VALUE( isolate, value, Object::GetProperty(&it), Nothing()); } if (get_entries) { value = MakeEntryPair(isolate, index, value); } values_or_entries->set(count++, *value); } *nof_items = count; return Just(true); } ",1 "static int csnmp_config_add_data(oconfig_item_t *ci) { data_definition_t *dd; int status = 0; dd = calloc(1, sizeof(*dd)); if (dd == NULL) return (-1); status = cf_util_get_string(ci, &dd->name); if (status != 0) { free(dd); return (-1); } dd->scale = 1.0; dd->shift = 0.0; for (int i = 0; i < ci->children_num; i++) { oconfig_item_t *option = ci->children + i; if (strcasecmp(""Type"", option->key) == 0) status = cf_util_get_string(option, &dd->type); else if (strcasecmp(""Table"", option->key) == 0) status = cf_util_get_boolean(option, &dd->is_table); else if (strcasecmp(""Instance"", option->key) == 0) status = csnmp_config_add_data_instance(dd, option); else if (strcasecmp(""InstancePrefix"", option->key) == 0) status = csnmp_config_add_data_instance_prefix(dd, option); else if (strcasecmp(""Values"", option->key) == 0) status = csnmp_config_add_data_values(dd, option); else if (strcasecmp(""Shift"", option->key) == 0) status = cf_util_get_double(option, &dd->shift); else if (strcasecmp(""Scale"", option->key) == 0) status = cf_util_get_double(option, &dd->scale); else if (strcasecmp(""Ignore"", option->key) == 0) status = csnmp_config_add_data_blacklist(dd, option); else if (strcasecmp(""InvertMatch"", option->key) == 0) status = csnmp_config_add_data_blacklist_match_inverted(dd, option); else { WARNING(""snmp plugin: Option `%s' not allowed here."", option->key); status = -1; } if (status != 0) break; } /* for (ci->children) */ while (status == 0) { if (dd->type == NULL) { WARNING(""snmp plugin: `Type' not given for data `%s'"", dd->name); status = -1; break; } if (dd->values == NULL) { WARNING(""snmp plugin: No `Value' given for data `%s'"", dd->name); status = -1; break; } break; } /* while (status == 0) */ if (status != 0) { sfree(dd->name); sfree(dd->instance_prefix); sfree(dd->values); sfree(dd->ignores); sfree(dd); return (-1); } DEBUG(""snmp plugin: dd = { name = %s, type = %s, is_table = %s, values_len = "" ""%zu }"", dd->name, dd->type, (dd->is_table != 0) ? ""true"" : ""false"", dd->values_len); if (data_head == NULL) data_head = dd; else { data_definition_t *last; last = data_head; while (last->next != NULL) last = last->next; last->next = dd; } return (0); } /* int csnmp_config_add_data */ ",0 "PassRefPtr Document::createRange() { return Range::create(*this); } ",0 "static inline unsigned int uffd_ctx_features(__u64 user_features) { /* * For the current set of features the bits just coincide */ return (unsigned int)user_features; } ",0 "void SyncBackendHost::Initialize( SyncFrontend* frontend, const WeakHandle& event_handler, const GURL& sync_service_url, const syncable::ModelTypeSet& initial_types, const SyncCredentials& credentials, bool delete_sync_data_folder) { if (!sync_thread_.Start()) return; frontend_ = frontend; DCHECK(frontend); syncable::ModelTypeSet initial_types_with_nigori(initial_types); if (profile_->GetPrefs()->GetBoolean(prefs::kSyncHasSetupCompleted)) initial_types_with_nigori.insert(syncable::NIGORI); registrar_.reset(new SyncBackendRegistrar(initial_types_with_nigori, name_, profile_, sync_thread_.message_loop())); InitCore(Core::DoInitializeOptions( registrar_.get(), event_handler, sync_service_url, profile_->GetRequestContext(), credentials, delete_sync_data_folder, RestoreEncryptionBootstrapToken(), false)); } ",0 "static int sctp_getsockopt_peer_auth_chunks(struct sock *sk, int len, char __user *optval, int __user *optlen) { struct net *net = sock_net(sk); struct sctp_authchunks __user *p = (void __user *)optval; struct sctp_authchunks val; struct sctp_association *asoc; struct sctp_chunks_param *ch; u32 num_chunks = 0; char __user *to; if (!net->sctp.auth_enable) return -EACCES; if (len < sizeof(struct sctp_authchunks)) return -EINVAL; if (copy_from_user(&val, optval, sizeof(struct sctp_authchunks))) return -EFAULT; to = p->gauth_chunks; asoc = sctp_id2assoc(sk, val.gauth_assoc_id); if (!asoc) return -EINVAL; ch = asoc->peer.peer_chunks; if (!ch) goto num; /* See if the user provided enough room for all the data */ num_chunks = ntohs(ch->param_hdr.length) - sizeof(sctp_paramhdr_t); if (len < num_chunks) return -EINVAL; if (copy_to_user(to, ch->chunks, num_chunks)) return -EFAULT; num: len = sizeof(struct sctp_authchunks) + num_chunks; if (put_user(len, optlen)) return -EFAULT; if (put_user(num_chunks, &p->gauth_number_of_chunks)) return -EFAULT; return 0; } ",0 "PHP_FUNCTION(snmp_set_quick_print) { zend_long a1; if (zend_parse_parameters(ZEND_NUM_ARGS(), ""l"", &a1) == FAILURE) { RETURN_FALSE; } netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT, (int)a1); RETURN_TRUE; } ",0 "bool RenderProcessHostImpl::Send(IPC::Message* msg) { if (!channel_.get()) { if (!is_initialized_) { queued_messages_.push(msg); return true; } else { delete msg; return false; } } if (child_process_launcher_.get() && child_process_launcher_->IsStarting()) { queued_messages_.push(msg); return true; } return channel_->Send(msg); } ",0 " int32_t bitstream_id() const { return bitstream_id_; } ",0 "transform_image_validate(transform_display *dp, png_const_structp pp, png_infop pi) { /* Constants for the loop below: */ PNG_CONST png_store* PNG_CONST ps = dp->this.ps; PNG_CONST png_byte in_ct = dp->this.colour_type; PNG_CONST png_byte in_bd = dp->this.bit_depth; PNG_CONST png_uint_32 w = dp->this.w; PNG_CONST png_uint_32 h = dp->this.h; PNG_CONST png_byte out_ct = dp->output_colour_type; PNG_CONST png_byte out_bd = dp->output_bit_depth; PNG_CONST png_byte sample_depth = (png_byte)(out_ct == PNG_COLOR_TYPE_PALETTE ? 8 : out_bd); PNG_CONST png_byte red_sBIT = dp->this.red_sBIT; PNG_CONST png_byte green_sBIT = dp->this.green_sBIT; PNG_CONST png_byte blue_sBIT = dp->this.blue_sBIT; PNG_CONST png_byte alpha_sBIT = dp->this.alpha_sBIT; PNG_CONST int have_tRNS = dp->this.is_transparent; double digitization_error; store_palette out_palette; png_uint_32 y; UNUSED(pi) /* Check for row overwrite errors */ store_image_check(dp->this.ps, pp, 0); /* Read the palette corresponding to the output if the output colour type * indicates a palette, othewise set out_palette to garbage. */ if (out_ct == PNG_COLOR_TYPE_PALETTE) { /* Validate that the palette count itself has not changed - this is not * expected. */ int npalette = (-1); (void)read_palette(out_palette, &npalette, pp, pi); if (npalette != dp->this.npalette) png_error(pp, ""unexpected change in palette size""); digitization_error = .5; } else { png_byte in_sample_depth; memset(out_palette, 0x5e, sizeof out_palette); /* use-input-precision means assume that if the input has 8 bit (or less) * samples and the output has 16 bit samples the calculations will be done * with 8 bit precision, not 16. */ if (in_ct == PNG_COLOR_TYPE_PALETTE || in_bd < 16) in_sample_depth = 8; else in_sample_depth = in_bd; if (sample_depth != 16 || in_sample_depth > 8 || !dp->pm->calculations_use_input_precision) digitization_error = .5; /* Else calculations are at 8 bit precision, and the output actually * consists of scaled 8-bit values, so scale .5 in 8 bits to the 16 bits: */ else digitization_error = .5 * 257; } for (y=0; ythis.palette); in_pixel.red_sBIT = red_sBIT; in_pixel.green_sBIT = green_sBIT; in_pixel.blue_sBIT = blue_sBIT; in_pixel.alpha_sBIT = alpha_sBIT; in_pixel.have_tRNS = have_tRNS; /* For error detection, below. */ r = in_pixel.red; g = in_pixel.green; b = in_pixel.blue; a = in_pixel.alpha; dp->transform_list->mod(dp->transform_list, &in_pixel, pp, dp); /* Read the output pixel and compare it to what we got, we don't * use the error field here, so no need to update sBIT. */ image_pixel_init(&out_pixel, pRow, out_ct, out_bd, x, out_palette); /* We don't expect changes to the index here even if the bit depth is * changed. */ if (in_ct == PNG_COLOR_TYPE_PALETTE && out_ct == PNG_COLOR_TYPE_PALETTE) { if (in_pixel.palette_index != out_pixel.palette_index) png_error(pp, ""unexpected transformed palette index""); } /* Check the colours for palette images too - in fact the palette could * be separately verified itself in most cases. */ if (in_pixel.red != out_pixel.red) transform_range_check(pp, r, g, b, a, in_pixel.red, in_pixel.redf, out_pixel.red, sample_depth, in_pixel.rede, dp->pm->limit + 1./(2*((1U<pm->limit + 1./(2*((1U<pm->limit + 1./(2*((1U<pm->limit + 1./(2*((1U<this.ps->validated = 1; } ",1 " virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video, ::libvpx_test::Encoder *encoder) { if (video->frame() == 1) { encoder->Control(VP8E_SET_CPUUSED, set_cpu_used_); encoder->Control(VP9E_SET_AQ_MODE, aq_mode_); encoder->Control(VP8E_SET_MAX_INTRA_BITRATE_PCT, 100); } } ",0 " virtual void performInternal(WebPagePrivate* webPagePrivate) { webPagePrivate->m_mainFrame->script()->executeIfJavaScriptURL(webPagePrivate->m_cachedManualScript, DoNotReplaceDocumentIfJavaScriptURL); } ",0 "NaClListener::~NaClListener() { NOTREACHED(); shutdown_event_.Signal(); #if defined(OS_WIN) g_listener = NULL; #endif } ",0 "void GDataFileSystem::OnGetFileCompleteForOpenFile( const OpenFileCallback& callback, const GetFileCompleteForOpenParams& entry_proto, GDataFileError error, const FilePath& file_path, const std::string& mime_type, GDataFileType file_type) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (error != GDATA_FILE_OK) { if (!callback.is_null()) callback.Run(error, FilePath()); return; } DCHECK_EQ(REGULAR_FILE, file_type); cache_->MarkDirtyOnUIThread( entry_proto.resource_id, entry_proto.md5, base::Bind(&GDataFileSystem::OnMarkDirtyInCacheCompleteForOpenFile, ui_weak_ptr_, callback)); } ",0 "nfsd4_delegreturn(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_delegreturn *dr) { struct nfs4_delegation *dp; stateid_t *stateid = &dr->dr_stateid; struct nfs4_stid *s; __be32 status; struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id); if ((status = fh_verify(rqstp, &cstate->current_fh, S_IFREG, 0))) return status; status = nfsd4_lookup_stateid(cstate, stateid, NFS4_DELEG_STID, &s, nn); if (status) goto out; dp = delegstateid(s); status = check_stateid_generation(stateid, &dp->dl_stid.sc_stateid, nfsd4_has_session(cstate)); if (status) goto put_stateid; destroy_delegation(dp); put_stateid: nfs4_put_stid(&dp->dl_stid); out: return status; } ",0 "aura::Window* PartialMagnificationController::GetCurrentRootWindow() { aura::Window::Windows root_windows = Shell::GetAllRootWindows(); for (aura::Window::Windows::const_iterator iter = root_windows.begin(); iter != root_windows.end(); ++iter) { aura::Window* root_window = *iter; if (root_window->ContainsPointInRoot( root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot())) return root_window; } return NULL; } ",1 "const struct perf_event_attr *perf_event_attrs(struct perf_event *event) { if (!event) return ERR_PTR(-EINVAL); return &event->attr; } ",0 "void TestingAutomationProvider::ExecuteJavascriptJSON( DictionaryValue* args, IPC::Message* reply_message) { if (SendErrorIfModalDialogActive(this, reply_message)) return; string16 frame_xpath, javascript; std::string error; RenderViewHost* render_view; if (!GetRenderViewFromJSONArgs(args, profile(), &render_view, &error)) { AutomationJSONReply(this, reply_message).SendError(error); return; } if (!args->GetString(""frame_xpath"", &frame_xpath)) { AutomationJSONReply(this, reply_message) .SendError(""'frame_xpath' missing or invalid""); return; } if (!args->GetString(""javascript"", &javascript)) { AutomationJSONReply(this, reply_message) .SendError(""'javascript' missing or invalid""); return; } new DomOperationMessageSender(this, reply_message, true); ExecuteJavascriptInRenderViewFrame(frame_xpath, javascript, reply_message, render_view); } ",0 "static void unsignedShortAttributeAttributeGetter(const v8::PropertyCallbackInfo& info) { TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); v8SetReturnValueUnsigned(info, imp->unsignedShortAttribute()); } ",0 "static void pmcraid_set_timestamp(struct pmcraid_cmd *cmd) { struct pmcraid_instance *pinstance = cmd->drv_inst; struct pmcraid_ioarcb *ioarcb = &cmd->ioa_cb->ioarcb; __be32 time_stamp_len = cpu_to_be32(PMCRAID_TIMESTAMP_LEN); struct pmcraid_ioadl_desc *ioadl = ioarcb->add_data.u.ioadl; struct timeval tv; __le64 timestamp; do_gettimeofday(&tv); timestamp = tv.tv_sec * 1000; pinstance->timestamp_data->timestamp[0] = (__u8)(timestamp); pinstance->timestamp_data->timestamp[1] = (__u8)((timestamp) >> 8); pinstance->timestamp_data->timestamp[2] = (__u8)((timestamp) >> 16); pinstance->timestamp_data->timestamp[3] = (__u8)((timestamp) >> 24); pinstance->timestamp_data->timestamp[4] = (__u8)((timestamp) >> 32); pinstance->timestamp_data->timestamp[5] = (__u8)((timestamp) >> 40); pmcraid_reinit_cmdblk(cmd); ioarcb->request_type = REQ_TYPE_SCSI; ioarcb->resource_handle = cpu_to_le32(PMCRAID_IOA_RES_HANDLE); ioarcb->cdb[0] = PMCRAID_SCSI_SET_TIMESTAMP; ioarcb->cdb[1] = PMCRAID_SCSI_SERVICE_ACTION; memcpy(&(ioarcb->cdb[6]), &time_stamp_len, sizeof(time_stamp_len)); ioarcb->ioadl_bus_addr = cpu_to_le64((cmd->ioa_cb_bus_addr) + offsetof(struct pmcraid_ioarcb, add_data.u.ioadl[0])); ioarcb->ioadl_length = cpu_to_le32(sizeof(struct pmcraid_ioadl_desc)); ioarcb->ioarcb_bus_addr &= ~(0x1FULL); ioarcb->request_flags0 |= NO_LINK_DESCS; ioarcb->request_flags0 |= TRANSFER_DIR_WRITE; ioarcb->data_transfer_length = cpu_to_le32(sizeof(struct pmcraid_timestamp_data)); ioadl = &(ioarcb->add_data.u.ioadl[0]); ioadl->flags = IOADL_FLAGS_LAST_DESC; ioadl->address = cpu_to_le64(pinstance->timestamp_data_baddr); ioadl->data_len = cpu_to_le32(sizeof(struct pmcraid_timestamp_data)); if (!pinstance->timestamp_error) { pinstance->timestamp_error = 0; pmcraid_send_cmd(cmd, pmcraid_set_supported_devs, PMCRAID_INTERNAL_TIMEOUT, pmcraid_timeout_handler); } else { pmcraid_send_cmd(cmd, pmcraid_return_cmd, PMCRAID_INTERNAL_TIMEOUT, pmcraid_timeout_handler); return; } } ",0 "MagickExport MagickBooleanType LevelImageColors(Image *image, const PixelInfo *black_color,const PixelInfo *white_color, const MagickBooleanType invert,ExceptionInfo *exception) { ChannelType channel_mask; MagickStatusType status; /* Allocate and initialize levels map. */ assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"",image->filename); if ((IsGrayColorspace(image->colorspace) != MagickFalse) && ((IsGrayColorspace(black_color->colorspace) == MagickFalse) || (IsGrayColorspace(white_color->colorspace) == MagickFalse))) (void) SetImageColorspace(image,sRGBColorspace,exception); status=MagickTrue; if (invert == MagickFalse) { if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0) { channel_mask=SetImageChannelMask(image,RedChannel); status&=LevelImage(image,black_color->red,white_color->red,1.0, exception); (void) SetImageChannelMask(image,channel_mask); } if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0) { channel_mask=SetImageChannelMask(image,GreenChannel); status&=LevelImage(image,black_color->green,white_color->green,1.0, exception); (void) SetImageChannelMask(image,channel_mask); } if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0) { channel_mask=SetImageChannelMask(image,BlueChannel); status&=LevelImage(image,black_color->blue,white_color->blue,1.0, exception); (void) SetImageChannelMask(image,channel_mask); } if (((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0) && (image->colorspace == CMYKColorspace)) { channel_mask=SetImageChannelMask(image,BlackChannel); status&=LevelImage(image,black_color->black,white_color->black,1.0, exception); (void) SetImageChannelMask(image,channel_mask); } if (((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0) && (image->alpha_trait != UndefinedPixelTrait)) { channel_mask=SetImageChannelMask(image,AlphaChannel); status&=LevelImage(image,black_color->alpha,white_color->alpha,1.0, exception); (void) SetImageChannelMask(image,channel_mask); } } else { if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0) { channel_mask=SetImageChannelMask(image,RedChannel); status&=LevelizeImage(image,black_color->red,white_color->red,1.0, exception); (void) SetImageChannelMask(image,channel_mask); } if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0) { channel_mask=SetImageChannelMask(image,GreenChannel); status&=LevelizeImage(image,black_color->green,white_color->green,1.0, exception); (void) SetImageChannelMask(image,channel_mask); } if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0) { channel_mask=SetImageChannelMask(image,BlueChannel); status&=LevelizeImage(image,black_color->blue,white_color->blue,1.0, exception); (void) SetImageChannelMask(image,channel_mask); } if (((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0) && (image->colorspace == CMYKColorspace)) { channel_mask=SetImageChannelMask(image,BlackChannel); status&=LevelizeImage(image,black_color->black,white_color->black,1.0, exception); (void) SetImageChannelMask(image,channel_mask); } if (((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0) && (image->alpha_trait != UndefinedPixelTrait)) { channel_mask=SetImageChannelMask(image,AlphaChannel); status&=LevelizeImage(image,black_color->alpha,white_color->alpha,1.0, exception); (void) SetImageChannelMask(image,channel_mask); } } return(status != 0 ? MagickTrue : MagickFalse); } ",0 "static void test_two_locks(void) { struct lxc_lock *l; pid_t pid; int ret, status; int p[2]; char c; if (pipe(p) < 0) exit(1); if ((pid = fork()) < 0) exit(1); if (pid == 0) { if (read(p[0], &c, 1) < 0) { perror(""read""); exit(1); } l = lxc_newlock(""/tmp"", ""lxctest-sem""); if (!l) { fprintf(stderr, ""%d: child: failed to create lock\n"", __LINE__); exit(1); } if (lxclock(l, 0) < 0) { fprintf(stderr, ""%d: child: failed to grab lock\n"", __LINE__); exit(1); } fprintf(stderr, ""%d: child: grabbed lock\n"", __LINE__); exit(0); } l = lxc_newlock(""/tmp"", ""lxctest-sem""); if (!l) { fprintf(stderr, ""%d: failed to create lock\n"", __LINE__); exit(1); } if (lxclock(l, 0) < 0) { fprintf(stderr, ""%d; failed to get lock\n"", __LINE__); exit(1); } if (write(p[1], ""a"", 1) < 0) { perror(""write""); exit(1); } sleep(3); ret = waitpid(pid, &status, WNOHANG); if (ret == pid) { // task exited if (WIFEXITED(status)) { printf(""%d exited normally with exit code %d\n"", pid, WEXITSTATUS(status)); if (WEXITSTATUS(status) == 0) exit(1); } else printf(""%d did not exit normally\n"", pid); return; } else if (ret < 0) { perror(""waitpid""); exit(1); } kill(pid, SIGKILL); wait(&status); close(p[1]); close(p[0]); lxcunlock(l); lxc_putlock(l); } ",0 "GapRects RenderBlock::selectionGaps(RenderBlock* rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& lastLogicalRight, const PaintInfo* paintInfo) { if (paintInfo) { LayoutRect flippedBlockRect(offsetFromRootBlock.width(), offsetFromRootBlock.height(), width(), height()); rootBlock->flipForWritingMode(flippedBlockRect); flippedBlockRect.moveBy(rootBlockPhysicalPosition); clipOutPositionedObjects(paintInfo, flippedBlockRect.location(), positionedObjects()); if (isBody() || isDocumentElement()) // The must make sure to examine its containingBlock's positioned objects. for (RenderBlock* cb = containingBlock(); cb && !cb->isRenderView(); cb = cb->containingBlock()) clipOutPositionedObjects(paintInfo, LayoutPoint(cb->x(), cb->y()), cb->positionedObjects()); // FIXME: Not right for flipped writing modes. clipOutFloatingObjects(rootBlock, paintInfo, rootBlockPhysicalPosition, offsetFromRootBlock); } GapRects result; if (!isRenderBlockFlow() && !isFlexibleBoxIncludingDeprecated()) // FIXME: Make multi-column selection gap filling work someday. return result; if (hasColumns() || hasTransform() || style()->columnSpan()) { lastLogicalTop = rootBlock->blockDirectionOffset(offsetFromRootBlock) + logicalHeight(); lastLogicalLeft = logicalLeftSelectionOffset(rootBlock, logicalHeight()); lastLogicalRight = logicalRightSelectionOffset(rootBlock, logicalHeight()); return result; } if (childrenInline()) result = toRenderBlockFlow(this)->inlineSelectionGaps(rootBlock, rootBlockPhysicalPosition, offsetFromRootBlock, lastLogicalTop, lastLogicalLeft, lastLogicalRight, paintInfo); else result = blockSelectionGaps(rootBlock, rootBlockPhysicalPosition, offsetFromRootBlock, lastLogicalTop, lastLogicalLeft, lastLogicalRight, paintInfo); if (rootBlock == this && (selectionState() != SelectionBoth && selectionState() != SelectionEnd)) result.uniteCenter(blockSelectionGap(rootBlock, rootBlockPhysicalPosition, offsetFromRootBlock, lastLogicalTop, lastLogicalLeft, lastLogicalRight, logicalHeight(), paintInfo)); return result; } ",0 "string_is_word_char (const char *string) { wint_t c = utf8_wide_char (string); if (c == WEOF) return 0; if (iswalnum (c)) return 1; switch (c) { case '-': case '_': case '|': return 1; } /* not a 'word char' */ return 0; } ",0 "static __le16 brcmf_get_mcs_map(u32 nchain, enum ieee80211_vht_mcs_support supp) { u16 mcs_map; int i; for (i = 0, mcs_map = 0xFFFF; i < nchain; i++) mcs_map = (mcs_map << 2) | supp; return cpu_to_le16(mcs_map); } ",0 "void WebSocketJob::SaveCookiesAndNotifyHeaderComplete() { DCHECK(handshake_response_->HasResponse()); response_cookies_.clear(); response_cookies_save_index_ = 0; handshake_response_->GetHeaders( kSetCookieHeaders, arraysize(kSetCookieHeaders), &response_cookies_); SaveNextCookie(); } ",0 " static Bool Ins_Goto_CodeRange( EXEC_OPS Int aRange, Int aIP ) { TCodeRange* WITH; if ( aRange < 1 || aRange > 3 ) { CUR.error = TT_Err_Bad_Argument; return FAILURE; } WITH = &CUR.codeRangeTable[aRange - 1]; if ( WITH->Base == NULL ) /* invalid coderange */ { CUR.error = TT_Err_Invalid_CodeRange; return FAILURE; } /* NOTE: Because the last instruction of a program may be a CALL */ /* which will return to the first byte *after* the code */ /* range, we test for AIP <= Size, instead of AIP < Size. */ if ( aIP > WITH->Size ) { CUR.error = TT_Err_Code_Overflow; return FAILURE; } CUR.code = WITH->Base; CUR.codeSize = WITH->Size; CUR.IP = aIP; CUR.curRange = aRange; return SUCCESS; } ",0 "static struct urb *iso_alloc_urb( struct usb_device *udev, int pipe, struct usb_endpoint_descriptor *desc, long bytes, unsigned offset ) { struct urb *urb; unsigned i, maxp, packets; if (bytes < 0 || !desc) return NULL; maxp = 0x7ff & usb_endpoint_maxp(desc); maxp *= usb_endpoint_maxp_mult(desc); packets = DIV_ROUND_UP(bytes, maxp); urb = usb_alloc_urb(packets, GFP_KERNEL); if (!urb) return urb; urb->dev = udev; urb->pipe = pipe; urb->number_of_packets = packets; urb->transfer_buffer_length = bytes; urb->transfer_buffer = usb_alloc_coherent(udev, bytes + offset, GFP_KERNEL, &urb->transfer_dma); if (!urb->transfer_buffer) { usb_free_urb(urb); return NULL; } if (offset) { memset(urb->transfer_buffer, GUARD_BYTE, offset); urb->transfer_buffer += offset; urb->transfer_dma += offset; } /* For inbound transfers use guard byte so that test fails if data not correctly copied */ memset(urb->transfer_buffer, usb_pipein(urb->pipe) ? GUARD_BYTE : 0, bytes); for (i = 0; i < packets; i++) { /* here, only the last packet will be short */ urb->iso_frame_desc[i].length = min((unsigned) bytes, maxp); bytes -= urb->iso_frame_desc[i].length; urb->iso_frame_desc[i].offset = maxp * i; } urb->complete = complicated_callback; /* urb->context = SET BY CALLER */ urb->interval = 1 << (desc->bInterval - 1); urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP; return urb; } ",0 "static const char *register_type_checker_hook(cmd_parms *cmd, void *_cfg, const char *file, const char *function) { return register_named_file_function_hook(""type_checker"", cmd, _cfg, file, function, APR_HOOK_MIDDLE); } ",0 "static bool ieee80211_tx_frags(struct ieee80211_local *local, struct ieee80211_vif *vif, struct ieee80211_sta *sta, struct sk_buff_head *skbs, bool txpending) { struct ieee80211_tx_control control; struct sk_buff *skb, *tmp; unsigned long flags; skb_queue_walk_safe(skbs, skb, tmp) { struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); int q = info->hw_queue; #ifdef CONFIG_MAC80211_VERBOSE_DEBUG if (WARN_ON_ONCE(q >= local->hw.queues)) { __skb_unlink(skb, skbs); ieee80211_free_txskb(&local->hw, skb); continue; } #endif spin_lock_irqsave(&local->queue_stop_reason_lock, flags); if (local->queue_stop_reasons[q] || (!txpending && !skb_queue_empty(&local->pending[q]))) { if (unlikely(info->flags & IEEE80211_TX_INTFL_OFFCHAN_TX_OK)) { if (local->queue_stop_reasons[q] & ~BIT(IEEE80211_QUEUE_STOP_REASON_OFFCHANNEL)) { /* * Drop off-channel frames if queues * are stopped for any reason other * than off-channel operation. Never * queue them. */ spin_unlock_irqrestore( &local->queue_stop_reason_lock, flags); ieee80211_purge_tx_queue(&local->hw, skbs); return true; } } else { /* * Since queue is stopped, queue up frames for * later transmission from the tx-pending * tasklet when the queue is woken again. */ if (txpending) skb_queue_splice_init(skbs, &local->pending[q]); else skb_queue_splice_tail_init(skbs, &local->pending[q]); spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); return false; } } spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); info->control.vif = vif; control.sta = sta; __skb_unlink(skb, skbs); drv_tx(local, &control, skb); } return true; } ",0 "bool ResourceDispatcherHostImpl::ShouldServiceRequest( int child_id, const network::ResourceRequest& request_data, const net::HttpRequestHeaders& headers, ResourceRequesterInfo* requester_info, ResourceContext* resource_context) { ChildProcessSecurityPolicyImpl* policy = ChildProcessSecurityPolicyImpl::GetInstance(); if (!policy->CanRequestURL(child_id, request_data.url)) { VLOG(1) << ""Denied unauthorized request for "" << request_data.url.possibly_invalid_spec(); return false; } std::string origin_string; bool has_origin = headers.GetHeader(""Origin"", &origin_string) && origin_string != ""null""; if (has_origin) { GURL origin(origin_string); if (!policy->CanSetAsOriginHeader(child_id, origin)) { VLOG(1) << ""Killed renderer for illegal origin: "" << origin_string; bad_message::ReceivedBadMessage(requester_info->filter(), bad_message::RDH_ILLEGAL_ORIGIN); return false; } } if (!policy->CanReadRequestBody(child_id, requester_info->file_system_context(), request_data.request_body)) { NOTREACHED() << ""Denied unauthorized upload""; return false; } if (!ValidatePluginChildId(request_data.plugin_child_id)) { NOTREACHED() << ""Invalid request_data.plugin_child_id: "" << request_data.plugin_child_id << "" ("" << child_id << "", "" << request_data.render_frame_id << "")""; return false; } return true; } ",0 "void ssl2_write_error(SSL *s) { unsigned char buf[3]; int i, error; buf[0] = SSL2_MT_ERROR; buf[1] = (s->error_code >> 8) & 0xff; buf[2] = (s->error_code) & 0xff; /* state=s->rwstate;*/ error = s->error; /* number of bytes left to write */ s->error = 0; OPENSSL_assert(error >= 0 && error <= (int)sizeof(buf)); i = ssl2_write(s, &(buf[3 - error]), error); /* if (i == error) s->rwstate=state; */ if (i < 0) s->error = error; else { s->error = error - i; if (s->error == 0) if (s->msg_callback) { /* ERROR */ s->msg_callback(1, s->version, 0, buf, 3, s, s->msg_callback_arg); } } } ",0 "status_t OMX::getState( node_id node, OMX_STATETYPE* state) { return findInstance(node)->getState( state); } ",0 "void RenderFlexibleBox::layoutBlock(bool relayoutChildren) { ASSERT(needsLayout()); if (!relayoutChildren && simplifiedLayout()) return; LayoutRepainter repainter(*this, checkForRepaintDuringLayout()); if (updateLogicalWidthAndColumnWidth()) relayoutChildren = true; LayoutUnit previousHeight = logicalHeight(); setLogicalHeight(borderAndPaddingLogicalHeight() + scrollbarLogicalHeight()); { LayoutStateMaintainer statePusher(*this, locationOffset()); m_numberOfInFlowChildrenOnFirstLine = -1; RenderBlock::startDelayUpdateScrollInfo(); prepareOrderIteratorAndMargins(); ChildFrameRects oldChildRects; appendChildFrameRects(oldChildRects); layoutFlexItems(relayoutChildren); RenderBlock::finishDelayUpdateScrollInfo(); if (logicalHeight() != previousHeight) relayoutChildren = true; layoutPositionedObjects(relayoutChildren || isDocumentElement()); computeRegionRangeForBlock(flowThreadContainingBlock()); repaintChildrenDuringLayoutIfMoved(oldChildRects); computeOverflow(clientLogicalBottomAfterRepositioning()); } updateLayerTransform(); updateScrollInfoAfterLayout(); repainter.repaintAfterLayout(); clearNeedsLayout(); } ",0 "void ExtensionSettingsHandler::Initialize() { } ",0 "monitor_read(struct monitor *pmonitor, struct mon_table *ent, struct mon_table **pent) { Buffer m; int ret; u_char type; struct pollfd pfd[2]; for (;;) { memset(&pfd, 0, sizeof(pfd)); pfd[0].fd = pmonitor->m_sendfd; pfd[0].events = POLLIN; pfd[1].fd = pmonitor->m_log_recvfd; pfd[1].events = pfd[1].fd == -1 ? 0 : POLLIN; if (poll(pfd, pfd[1].fd == -1 ? 1 : 2, -1) == -1) { if (errno == EINTR || errno == EAGAIN) continue; fatal(""%s: poll: %s"", __func__, strerror(errno)); } if (pfd[1].revents) { /* * Drain all log messages before processing next * monitor request. */ monitor_read_log(pmonitor); continue; } if (pfd[0].revents) break; /* Continues below */ } buffer_init(&m); mm_request_receive(pmonitor->m_sendfd, &m); type = buffer_get_char(&m); debug3(""%s: checking request %d"", __func__, type); while (ent->f != NULL) { if (ent->type == type) break; ent++; } if (ent->f != NULL) { if (!(ent->flags & MON_PERMIT)) fatal(""%s: unpermitted request %d"", __func__, type); ret = (*ent->f)(pmonitor->m_sendfd, &m); buffer_free(&m); /* The child may use this request only once, disable it */ if (ent->flags & MON_ONCE) { debug2(""%s: %d used once, disabling now"", __func__, type); ent->flags &= ~MON_PERMIT; } if (pent != NULL) *pent = ent; return ret; } fatal(""%s: unsupported request: %d"", __func__, type); /* NOTREACHED */ return (-1); } ",0 "EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodReturningSequence(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) return throwVMTypeError(exec); JSTestObj* castedThis = jsCast(asObject(thisValue)); ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info); TestObj* impl = static_cast(castedThis->impl()); if (exec->argumentCount() < 1) return throwVMError(exec, createTypeError(exec, ""Not enough arguments"")); int intArg(MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined).toInt32(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); JSC::JSValue result = jsArray(exec, castedThis->globalObject(), impl->methodReturningSequence(intArg)); return JSValue::encode(result); } ",1 "JsVar *jsvMathsOpSkipNames(JsVar *a, JsVar *b, int op) { JsVar *pa = jsvSkipName(a); JsVar *pb = jsvSkipName(b); JsVar *oa = jsvGetValueOf(pa); JsVar *ob = jsvGetValueOf(pb); jsvUnLock2(pa, pb); JsVar *res = jsvMathsOp(oa,ob,op); jsvUnLock2(oa, ob); return res; } ",0 "GF_Err stsc_Write(GF_Box *s, GF_BitStream *bs) { GF_Err e; u32 i; GF_SampleToChunkBox *ptr = (GF_SampleToChunkBox *)s; e = gf_isom_full_box_write(s, bs); if (e) return e; gf_bs_write_u32(bs, ptr->nb_entries); for (i=0; inb_entries; i++) { gf_bs_write_u32(bs, ptr->entries[i].firstChunk); gf_bs_write_u32(bs, ptr->entries[i].samplesPerChunk); gf_bs_write_u32(bs, ptr->entries[i].sampleDescriptionIndex); } return GF_OK; } ",0 "xdr_cprinc_arg(XDR *xdrs, cprinc_arg *objp) { if (!xdr_ui_4(xdrs, &objp->api_version)) { return (FALSE); } if (!_xdr_kadm5_principal_ent_rec(xdrs, &objp->rec, objp->api_version)) { return (FALSE); } if (!xdr_long(xdrs, &objp->mask)) { return (FALSE); } if (!xdr_nullstring(xdrs, &objp->passwd)) { return (FALSE); } return (TRUE); } ",0 "int vhost_net_set_ubuf_info(struct vhost_net *n) { bool zcopy; int i; for (i = 0; i < VHOST_NET_VQ_MAX; ++i) { zcopy = vhost_net_zcopy_mask & (0x1 << i); if (!zcopy) continue; n->vqs[i].ubuf_info = kmalloc(sizeof(*n->vqs[i].ubuf_info) * UIO_MAXIOV, GFP_KERNEL); if (!n->vqs[i].ubuf_info) goto err; } return 0; err: vhost_net_clear_ubuf_info(n); return -ENOMEM; } ",0 "content::MediaObserver* ChromeContentBrowserClient::GetMediaObserver() { return MediaCaptureDevicesDispatcher::GetInstance(); } ",0 "static int _store_item_copy_data(int comm, item *old_it, item *new_it, item *add_it) { if (comm == NREAD_APPEND) { if (new_it->it_flags & ITEM_CHUNKED) { if (_store_item_copy_chunks(new_it, old_it, old_it->nbytes - 2) == -1 || _store_item_copy_chunks(new_it, add_it, add_it->nbytes) == -1) { return -1; } } else { memcpy(ITEM_data(new_it), ITEM_data(old_it), old_it->nbytes); memcpy(ITEM_data(new_it) + old_it->nbytes - 2 /* CRLF */, ITEM_data(add_it), add_it->nbytes); } } else { /* NREAD_PREPEND */ if (new_it->it_flags & ITEM_CHUNKED) { if (_store_item_copy_chunks(new_it, add_it, add_it->nbytes - 2) == -1 || _store_item_copy_chunks(new_it, old_it, old_it->nbytes) == -1) { return -1; } } else { memcpy(ITEM_data(new_it), ITEM_data(add_it), add_it->nbytes); memcpy(ITEM_data(new_it) + add_it->nbytes - 2 /* CRLF */, ITEM_data(old_it), old_it->nbytes); } } return 0; } ",0 " cdf_read_short_sector(const cdf_stream_t *sst, void *buf, size_t offs, size_t len, const cdf_header_t *h, cdf_secid_t id) { assert((size_t)CDF_SHORT_SEC_SIZE(h) == len); (void)memcpy(((char *)buf) + offs, ((const char *)sst->sst_tab) + CDF_SHORT_SEC_POS(h, id), len); return len; } ",1 "void DownloadItemImpl::OnAllDataSaved( int64_t total_bytes, std::unique_ptr hash_state) { DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK(!AllDataSaved()); destination_info_.all_data_saved = true; SetTotalBytes(total_bytes); UpdateProgress(total_bytes, 0); received_slices_.clear(); SetHashState(std::move(hash_state)); hash_state_.reset(); // No need to retain hash_state_ since we are done with if (received_bytes_at_length_mismatch_ > 0) { if (total_bytes > received_bytes_at_length_mismatch_) { RecordDownloadCount( MORE_BYTES_RECEIVED_AFTER_CONTENT_LENGTH_MISMATCH_COUNT); } else if (total_bytes == received_bytes_at_length_mismatch_) { RecordDownloadCount( NO_BYTES_RECEIVED_AFTER_CONTENT_LENGTH_MISMATCH_COUNT); } else { } } DVLOG(20) << __func__ << ""() download="" << DebugString(true); UpdateObservers(); } ",0 "static v8::Handle unsignedLongLongAttrAttrGetter(v8::Local name, const v8::AccessorInfo& info) { INC_STATS(""DOM.TestObj.unsignedLongLongAttr._get""); TestObj* imp = V8TestObj::toNative(info.Holder()); return v8::Number::New(static_cast(imp->unsignedLongLongAttr())); } ",0 "static void xmlAttributeAttributeSetter(v8::Local jsValue, const v8::PropertyCallbackInfo& info) { ExceptionState exceptionState(ExceptionState::SetterContext, ""xmlAttribute"", ""TestObjectPython"", info.Holder(), info.GetIsolate()); TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); V8TRYCATCH_EXCEPTION_VOID(int, cppValue, toInt32(jsValue, exceptionState), exceptionState); imp->setXMLAttribute(cppValue); } ",0 "MagickExport DrawInfo *DestroyDrawInfo(DrawInfo *draw_info) { if (draw_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""...""); assert(draw_info != (DrawInfo *) NULL); assert(draw_info->signature == MagickSignature); if (draw_info->primitive != (char *) NULL) draw_info->primitive=DestroyString(draw_info->primitive); if (draw_info->text != (char *) NULL) draw_info->text=DestroyString(draw_info->text); if (draw_info->geometry != (char *) NULL) draw_info->geometry=DestroyString(draw_info->geometry); if (draw_info->tile != (Image *) NULL) draw_info->tile=DestroyImage(draw_info->tile); if (draw_info->fill_pattern != (Image *) NULL) draw_info->fill_pattern=DestroyImage(draw_info->fill_pattern); if (draw_info->stroke_pattern != (Image *) NULL) draw_info->stroke_pattern=DestroyImage(draw_info->stroke_pattern); if (draw_info->font != (char *) NULL) draw_info->font=DestroyString(draw_info->font); if (draw_info->metrics != (char *) NULL) draw_info->metrics=DestroyString(draw_info->metrics); if (draw_info->family != (char *) NULL) draw_info->family=DestroyString(draw_info->family); if (draw_info->encoding != (char *) NULL) draw_info->encoding=DestroyString(draw_info->encoding); if (draw_info->density != (char *) NULL) draw_info->density=DestroyString(draw_info->density); if (draw_info->server_name != (char *) NULL) draw_info->server_name=(char *) RelinquishMagickMemory(draw_info->server_name); if (draw_info->dash_pattern != (double *) NULL) draw_info->dash_pattern=(double *) RelinquishMagickMemory( draw_info->dash_pattern); if (draw_info->gradient.stops != (StopInfo *) NULL) draw_info->gradient.stops=(StopInfo *) RelinquishMagickMemory( draw_info->gradient.stops); if (draw_info->clip_mask != (char *) NULL) draw_info->clip_mask=DestroyString(draw_info->clip_mask); draw_info->signature=(~MagickSignature); draw_info=(DrawInfo *) RelinquishMagickMemory(draw_info); return(draw_info); } ",0 "static uint64_t ahci_mem_read_32(void *opaque, hwaddr addr) { AHCIState *s = opaque; uint32_t val = 0; if (addr < AHCI_GENERIC_HOST_CONTROL_REGS_MAX_ADDR) { switch (addr) { case HOST_CAP: val = s->control_regs.cap; break; case HOST_CTL: val = s->control_regs.ghc; break; case HOST_IRQ_STAT: val = s->control_regs.irqstatus; break; case HOST_PORTS_IMPL: val = s->control_regs.impl; break; case HOST_VERSION: val = s->control_regs.version; break; } DPRINTF(-1, ""(addr 0x%08X), val 0x%08X\n"", (unsigned) addr, val); } else if ((addr >= AHCI_PORT_REGS_START_ADDR) && (addr < (AHCI_PORT_REGS_START_ADDR + (s->ports * AHCI_PORT_ADDR_OFFSET_LEN)))) { val = ahci_port_read(s, (addr - AHCI_PORT_REGS_START_ADDR) >> 7, addr & AHCI_PORT_ADDR_OFFSET_MASK); } return val; } ",0 "my_object_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { MyObject *mobject; mobject = MY_OBJECT (object); switch (prop_id) { case PROP_THIS_IS_A_STRING: g_free (mobject->this_is_a_string); mobject->this_is_a_string = g_value_dup_string (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } ",1 "bool Editor::insertText(const String& text, KeyboardEvent* triggeringEvent) { return frame().eventHandler().handleTextInputEvent(text, triggeringEvent); } ",0 "gfx::Rect DraggedTabGtk::bounds() const { gint x, y, width, height; gtk_window_get_position(GTK_WINDOW(container_), &x, &y); gtk_window_get_size(GTK_WINDOW(container_), &width, &height); return gfx::Rect(x, y, width, height); } ",0 "ThreadHeap::ThreadHeap(ThreadState* thread_state) : thread_state_(thread_state), heap_stats_collector_(std::make_unique()), region_tree_(std::make_unique()), address_cache_(std::make_unique()), free_page_pool_(std::make_unique()), marking_worklist_(nullptr), not_fully_constructed_worklist_(nullptr), weak_callback_worklist_(nullptr), vector_backing_arena_index_(BlinkGC::kVector1ArenaIndex), current_arena_ages_(0) { if (ThreadState::Current()->IsMainThread()) main_thread_heap_ = this; for (int arena_index = 0; arena_index < BlinkGC::kLargeObjectArenaIndex; arena_index++) arenas_[arena_index] = new NormalPageArena(thread_state_, arena_index); arenas_[BlinkGC::kLargeObjectArenaIndex] = new LargeObjectArena(thread_state_, BlinkGC::kLargeObjectArenaIndex); likely_to_be_promptly_freed_ = std::make_unique(kLikelyToBePromptlyFreedArraySize); ClearArenaAges(); } ",0 "int socket_send(int fd, void *data, size_t length) { int flags = 0; #ifdef MSG_NOSIGNAL flags |= MSG_NOSIGNAL; #endif return send(fd, data, length, flags); } ",0 "processCropSelections(struct image_data *image, struct crop_mask *crop, unsigned char **read_buff_ptr, struct buffinfo seg_buffs[]) { int i; uint32 width, length, total_width, total_length; tsize_t cropsize; unsigned char *crop_buff = NULL; unsigned char *read_buff = NULL; unsigned char *next_buff = NULL; tsize_t prev_cropsize = 0; read_buff = *read_buff_ptr; if (crop->img_mode == COMPOSITE_IMAGES) { cropsize = crop->bufftotal; crop_buff = seg_buffs[0].buffer; if (!crop_buff) crop_buff = (unsigned char *)_TIFFmalloc(cropsize); else { prev_cropsize = seg_buffs[0].size; if (prev_cropsize < cropsize) { next_buff = _TIFFrealloc(crop_buff, cropsize); if (! next_buff) { _TIFFfree (crop_buff); crop_buff = (unsigned char *)_TIFFmalloc(cropsize); } else crop_buff = next_buff; } } if (!crop_buff) { TIFFError(""processCropSelections"", ""Unable to allocate/reallocate crop buffer""); return (-1); } _TIFFmemset(crop_buff, 0, cropsize); seg_buffs[0].buffer = crop_buff; seg_buffs[0].size = cropsize; /* Checks for matching width or length as required */ if (extractCompositeRegions(image, crop, read_buff, crop_buff) != 0) return (1); if (crop->crop_mode & CROP_INVERT) { switch (crop->photometric) { /* Just change the interpretation */ case PHOTOMETRIC_MINISWHITE: case PHOTOMETRIC_MINISBLACK: image->photometric = crop->photometric; break; case INVERT_DATA_ONLY: case INVERT_DATA_AND_TAG: if (invertImage(image->photometric, image->spp, image->bps, crop->combined_width, crop->combined_length, crop_buff)) { TIFFError(""processCropSelections"", ""Failed to invert colorspace for composite regions""); return (-1); } if (crop->photometric == INVERT_DATA_AND_TAG) { switch (image->photometric) { case PHOTOMETRIC_MINISWHITE: image->photometric = PHOTOMETRIC_MINISBLACK; break; case PHOTOMETRIC_MINISBLACK: image->photometric = PHOTOMETRIC_MINISWHITE; break; default: break; } } break; default: break; } } /* Mirror and Rotate will not work with multiple regions unless they are the same width */ if (crop->crop_mode & CROP_MIRROR) { if (mirrorImage(image->spp, image->bps, crop->mirror, crop->combined_width, crop->combined_length, crop_buff)) { TIFFError(""processCropSelections"", ""Failed to mirror composite regions %s"", (crop->rotation == MIRROR_HORIZ) ? ""horizontally"" : ""vertically""); return (-1); } } if (crop->crop_mode & CROP_ROTATE) /* rotate should be last as it can reallocate the buffer */ { if (rotateImage(crop->rotation, image, &crop->combined_width, &crop->combined_length, &crop_buff)) { TIFFError(""processCropSelections"", ""Failed to rotate composite regions by %d degrees"", crop->rotation); return (-1); } seg_buffs[0].buffer = crop_buff; seg_buffs[0].size = (((crop->combined_width * image->bps + 7 ) / 8) * image->spp) * crop->combined_length; } } else /* Separated Images */ { total_width = total_length = 0; for (i = 0; i < crop->selections; i++) { cropsize = crop->bufftotal; crop_buff = seg_buffs[i].buffer; if (!crop_buff) crop_buff = (unsigned char *)_TIFFmalloc(cropsize); else { prev_cropsize = seg_buffs[0].size; if (prev_cropsize < cropsize) { next_buff = _TIFFrealloc(crop_buff, cropsize); if (! next_buff) { _TIFFfree (crop_buff); crop_buff = (unsigned char *)_TIFFmalloc(cropsize); } else crop_buff = next_buff; } } if (!crop_buff) { TIFFError(""processCropSelections"", ""Unable to allocate/reallocate crop buffer""); return (-1); } _TIFFmemset(crop_buff, 0, cropsize); seg_buffs[i].buffer = crop_buff; seg_buffs[i].size = cropsize; if (extractSeparateRegion(image, crop, read_buff, crop_buff, i)) { TIFFError(""processCropSelections"", ""Unable to extract cropped region %d from image"", i); return (-1); } width = crop->regionlist[i].width; length = crop->regionlist[i].length; if (crop->crop_mode & CROP_INVERT) { switch (crop->photometric) { /* Just change the interpretation */ case PHOTOMETRIC_MINISWHITE: case PHOTOMETRIC_MINISBLACK: image->photometric = crop->photometric; break; case INVERT_DATA_ONLY: case INVERT_DATA_AND_TAG: if (invertImage(image->photometric, image->spp, image->bps, width, length, crop_buff)) { TIFFError(""processCropSelections"", ""Failed to invert colorspace for region""); return (-1); } if (crop->photometric == INVERT_DATA_AND_TAG) { switch (image->photometric) { case PHOTOMETRIC_MINISWHITE: image->photometric = PHOTOMETRIC_MINISBLACK; break; case PHOTOMETRIC_MINISBLACK: image->photometric = PHOTOMETRIC_MINISWHITE; break; default: break; } } break; default: break; } } if (crop->crop_mode & CROP_MIRROR) { if (mirrorImage(image->spp, image->bps, crop->mirror, width, length, crop_buff)) { TIFFError(""processCropSelections"", ""Failed to mirror crop region %s"", (crop->rotation == MIRROR_HORIZ) ? ""horizontally"" : ""vertically""); return (-1); } } if (crop->crop_mode & CROP_ROTATE) /* rotate should be last as it can reallocate the buffer */ { if (rotateImage(crop->rotation, image, &crop->regionlist[i].width, &crop->regionlist[i].length, &crop_buff)) { TIFFError(""processCropSelections"", ""Failed to rotate crop region by %d degrees"", crop->rotation); return (-1); } total_width += crop->regionlist[i].width; total_length += crop->regionlist[i].length; crop->combined_width = total_width; crop->combined_length = total_length; seg_buffs[i].buffer = crop_buff; seg_buffs[i].size = (((crop->regionlist[i].width * image->bps + 7 ) / 8) * image->spp) * crop->regionlist[i].length; } } } return (0); } /* end processCropSelections */ ",0 "void tq_freeze(struct thread_q *tq) { tq_freezethaw(tq, true); } ",0 "int config_get_int(const config_t *config, const char *section, const char *key, int def_value) { assert(config != NULL); assert(section != NULL); assert(key != NULL); entry_t *entry = entry_find(config, section, key); if (!entry) return def_value; char *endptr; int ret = strtol(entry->value, &endptr, 0); return (*endptr == '\0') ? ret : def_value; } ",0 "static UINT drdynvc_process_data_first(drdynvcPlugin* drdynvc, int Sp, int cbChId, wStream* s) { UINT status; UINT32 Length; UINT32 ChannelId; ChannelId = drdynvc_read_variable_uint(s, cbChId); Length = drdynvc_read_variable_uint(s, Sp); WLog_Print(drdynvc->log, WLOG_DEBUG, ""process_data_first: Sp=%d cbChId=%d, ChannelId=%""PRIu32"" Length=%""PRIu32"""", Sp, cbChId, ChannelId, Length); status = dvcman_receive_channel_data_first(drdynvc, drdynvc->channel_mgr, ChannelId, Length); if (status) return status; return dvcman_receive_channel_data(drdynvc, drdynvc->channel_mgr, ChannelId, s); } ",1 "json_recv(PG_FUNCTION_ARGS) { StringInfo buf = (StringInfo) PG_GETARG_POINTER(0); char *str; int nbytes; JsonLexContext *lex; str = pq_getmsgtext(buf, buf->len - buf->cursor, &nbytes); /* Validate it. */ lex = makeJsonLexContextCstringLen(str, nbytes, false); pg_parse_json(lex, &nullSemAction); PG_RETURN_TEXT_P(cstring_to_text_with_len(str, nbytes)); } ",0 "xsltExtStyleShutdownTest(xsltStylesheetPtr style ATTRIBUTE_UNUSED, const xmlChar * URI, void *data) { if (testStyleData == NULL) { xsltGenericError(xsltGenericErrorContext, ""xsltExtShutdownTest: not initialized\n""); return; } if (data != testStyleData) { xsltTransformError(NULL, NULL, NULL, ""xsltExtShutdownTest: wrong data\n""); } testStyleData = NULL; xsltGenericDebug(xsltGenericDebugContext, ""Unregistered test module : %s\n"", URI); } ",0 "const char *arch_vma_name(struct vm_area_struct *vma) { if (vma->vm_flags & VM_MPX) return ""[mpx]""; return NULL; } ",0 "static void __netdev_adjacent_dev_unlink_neighbour(struct net_device *dev, struct net_device *upper_dev) { __netdev_adjacent_dev_unlink(dev, upper_dev); __netdev_adjacent_dev_unlink_lists(dev, upper_dev, &dev->adj_list.upper, &upper_dev->adj_list.lower); } ",0 "const CreditCard SaveCardBubbleControllerImpl::GetCard() const { return card_; } ",0 "void WebLocalFrameImpl::Alert(const WebString& message) { DCHECK(GetFrame()); ScriptState* script_state = ToScriptStateForMainWorld(GetFrame()); DCHECK(script_state); GetFrame()->DomWindow()->alert(script_state, message); } ",0 "GF_Err clap_Read(GF_Box *s, GF_BitStream *bs) { GF_CleanAppertureBox *ptr = (GF_CleanAppertureBox*)s; ISOM_DECREASE_SIZE(ptr, 32); ptr->cleanApertureWidthN = gf_bs_read_u32(bs); ptr->cleanApertureWidthD = gf_bs_read_u32(bs); ptr->cleanApertureHeightN = gf_bs_read_u32(bs); ptr->cleanApertureHeightD = gf_bs_read_u32(bs); ptr->horizOffN = gf_bs_read_u32(bs); ptr->horizOffD = gf_bs_read_u32(bs); ptr->vertOffN = gf_bs_read_u32(bs); ptr->vertOffD = gf_bs_read_u32(bs); return GF_OK; } ",0 "static int crypto_grab_nivaead(struct crypto_aead_spawn *spawn, const char *name, u32 type, u32 mask) { struct crypto_alg *alg; int err; type &= ~(CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_GENIV); type |= CRYPTO_ALG_TYPE_AEAD; mask |= CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_GENIV; alg = crypto_alg_mod_lookup(name, type, mask); if (IS_ERR(alg)) return PTR_ERR(alg); err = crypto_init_spawn(&spawn->base, alg, spawn->base.inst, mask); crypto_mod_put(alg); return err; } ",0 "void AXObjectCacheImpl::textChanged(Node* node) { textChanged(getOrCreate(node)); } ",0 "void FetchContext::DispatchDidChangeResourcePriority(unsigned long, ResourceLoadPriority, int) {} ",0 "IntPoint RenderLayerScrollableArea::maximumScrollPosition() const { if (!box().hasOverflowClip()) return -scrollOrigin(); return -scrollOrigin() + IntPoint(pixelSnappedScrollWidth(), pixelSnappedScrollHeight()) - enclosingIntRect(box().clientBoxRect()).size(); } ",0 "static int dev_ifsioc_locked(struct net *net, struct ifreq *ifr, unsigned int cmd) { int err; struct net_device *dev = dev_get_by_name_rcu(net, ifr->ifr_name); if (!dev) return -ENODEV; switch (cmd) { case SIOCGIFFLAGS: /* Get interface flags */ ifr->ifr_flags = (short) dev_get_flags(dev); return 0; case SIOCGIFMETRIC: /* Get the metric on the interface (currently unused) */ ifr->ifr_metric = 0; return 0; case SIOCGIFMTU: /* Get the MTU of a device */ ifr->ifr_mtu = dev->mtu; return 0; case SIOCGIFHWADDR: if (!dev->addr_len) memset(ifr->ifr_hwaddr.sa_data, 0, sizeof ifr->ifr_hwaddr.sa_data); else memcpy(ifr->ifr_hwaddr.sa_data, dev->dev_addr, min(sizeof ifr->ifr_hwaddr.sa_data, (size_t) dev->addr_len)); ifr->ifr_hwaddr.sa_family = dev->type; return 0; case SIOCGIFSLAVE: err = -EINVAL; break; case SIOCGIFMAP: ifr->ifr_map.mem_start = dev->mem_start; ifr->ifr_map.mem_end = dev->mem_end; ifr->ifr_map.base_addr = dev->base_addr; ifr->ifr_map.irq = dev->irq; ifr->ifr_map.dma = dev->dma; ifr->ifr_map.port = dev->if_port; return 0; case SIOCGIFINDEX: ifr->ifr_ifindex = dev->ifindex; return 0; case SIOCGIFTXQLEN: ifr->ifr_qlen = dev->tx_queue_len; return 0; default: /* dev_ioctl() should ensure this case * is never reached */ WARN_ON(1); err = -EINVAL; break; } return err; } ",0 "void XMLHttpRequest::clearRequest() { m_requestHeaders.clear(); m_requestEntityBody = 0; } ",0 "int AutofillDialogViews::SuggestionView::GetHeightForWidth(int width) const { int height = 0; CanUseVerticallyCompactText(width, &height); return height; } ",0 "static s32 brcmf_inform_ibss(struct brcmf_cfg80211_info *cfg, struct net_device *ndev, const u8 *bssid) { struct wiphy *wiphy = cfg_to_wiphy(cfg); struct ieee80211_channel *notify_channel; struct brcmf_bss_info_le *bi = NULL; struct ieee80211_supported_band *band; struct cfg80211_bss *bss; struct brcmu_chan ch; u8 *buf = NULL; s32 err = 0; u32 freq; u16 notify_capability; u16 notify_interval; u8 *notify_ie; size_t notify_ielen; s32 notify_signal; brcmf_dbg(TRACE, ""Enter\n""); buf = kzalloc(WL_BSS_INFO_MAX, GFP_KERNEL); if (buf == NULL) { err = -ENOMEM; goto CleanUp; } *(__le32 *)buf = cpu_to_le32(WL_BSS_INFO_MAX); err = brcmf_fil_cmd_data_get(netdev_priv(ndev), BRCMF_C_GET_BSS_INFO, buf, WL_BSS_INFO_MAX); if (err) { brcmf_err(""WLC_GET_BSS_INFO failed: %d\n"", err); goto CleanUp; } bi = (struct brcmf_bss_info_le *)(buf + 4); ch.chspec = le16_to_cpu(bi->chanspec); cfg->d11inf.decchspec(&ch); if (ch.band == BRCMU_CHAN_BAND_2G) band = wiphy->bands[NL80211_BAND_2GHZ]; else band = wiphy->bands[NL80211_BAND_5GHZ]; freq = ieee80211_channel_to_frequency(ch.control_ch_num, band->band); cfg->channel = freq; notify_channel = ieee80211_get_channel(wiphy, freq); notify_capability = le16_to_cpu(bi->capability); notify_interval = le16_to_cpu(bi->beacon_period); notify_ie = (u8 *)bi + le16_to_cpu(bi->ie_offset); notify_ielen = le32_to_cpu(bi->ie_length); notify_signal = (s16)le16_to_cpu(bi->RSSI) * 100; brcmf_dbg(CONN, ""channel: %d(%d)\n"", ch.control_ch_num, freq); brcmf_dbg(CONN, ""capability: %X\n"", notify_capability); brcmf_dbg(CONN, ""beacon interval: %d\n"", notify_interval); brcmf_dbg(CONN, ""signal: %d\n"", notify_signal); bss = cfg80211_inform_bss(wiphy, notify_channel, CFG80211_BSS_FTYPE_UNKNOWN, bssid, 0, notify_capability, notify_interval, notify_ie, notify_ielen, notify_signal, GFP_KERNEL); if (!bss) { err = -ENOMEM; goto CleanUp; } cfg80211_put_bss(wiphy, bss); CleanUp: kfree(buf); brcmf_dbg(TRACE, ""Exit\n""); return err; } ",0 "static void print_modules(TSRMLS_D) { HashTable sorted_registry; zend_module_entry tmp; zend_hash_init(&sorted_registry, 50, NULL, NULL, 1); zend_hash_copy(&sorted_registry, &module_registry, NULL, &tmp, sizeof(zend_module_entry)); zend_hash_sort(&sorted_registry, zend_qsort, module_name_cmp, 0 TSRMLS_CC); zend_hash_apply_with_argument(&sorted_registry, (apply_func_arg_t) print_module_info, NULL TSRMLS_CC); zend_hash_destroy(&sorted_registry); } ",0 "static enum transmit_result transmit(conn *c) { assert(c != NULL); if (c->msgcurr < c->msgused && c->msglist[c->msgcurr].msg_iovlen == 0) { /* Finished writing the current msg; advance to the next. */ c->msgcurr++; } if (c->msgcurr < c->msgused) { ssize_t res; struct msghdr *m = &c->msglist[c->msgcurr]; res = sendmsg(c->sfd, m, 0); if (res > 0) { pthread_mutex_lock(&c->thread->stats.mutex); c->thread->stats.bytes_written += res; pthread_mutex_unlock(&c->thread->stats.mutex); /* We've written some of the data. Remove the completed iovec entries from the list of pending writes. */ while (m->msg_iovlen > 0 && res >= m->msg_iov->iov_len) { res -= m->msg_iov->iov_len; m->msg_iovlen--; m->msg_iov++; } /* Might have written just part of the last iovec entry; adjust it so the next write will do the rest. */ if (res > 0) { m->msg_iov->iov_base = (caddr_t)m->msg_iov->iov_base + res; m->msg_iov->iov_len -= res; } return TRANSMIT_INCOMPLETE; } if (res == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)) { if (!update_event(c, EV_WRITE | EV_PERSIST)) { if (settings.verbose > 0) fprintf(stderr, ""Couldn't update event\n""); conn_set_state(c, conn_closing); return TRANSMIT_HARD_ERROR; } return TRANSMIT_SOFT_ERROR; } /* if res == 0 or res == -1 and error is not EAGAIN or EWOULDBLOCK, we have a real error, on which we close the connection */ if (settings.verbose > 0) perror(""Failed to write, and not due to blocking""); if (IS_UDP(c->transport)) conn_set_state(c, conn_read); else conn_set_state(c, conn_closing); return TRANSMIT_HARD_ERROR; } else { return TRANSMIT_COMPLETE; } } ",0 "bool AutofillManager::GetHost(const std::vector& profiles, const std::vector& credit_cards, RenderViewHost** host) const { if (!IsAutofillEnabled()) return false; if (profiles.empty() && credit_cards.empty()) return false; *host = tab_contents()->render_view_host(); if (!*host) return false; return true; } ",0 "bool AffineTransform::decompose(DecomposedType& decomp) const { AffineTransform m(*this); double sx = xScale(); double sy = yScale(); if (m.a() * m.d() - m.c() * m.b() < 0) { if (m.a() < m.d()) sx = -sx; else sy = -sy; } m.scale(1 / sx, 1 / sy); double angle = atan2(m.b(), m.a()); m.rotateRadians(-angle); decomp.scaleX = sx; decomp.scaleY = sy; decomp.angle = angle; decomp.remainderA = m.a(); decomp.remainderB = m.b(); decomp.remainderC = m.c(); decomp.remainderD = m.d(); decomp.translateX = m.e(); decomp.translateY = m.f(); return true; } ",0 "static void alias_grab( /*! [out] XML alias object. */ struct xml_alias_t *alias) { ithread_mutex_lock(&gWebMutex); assert(is_valid_alias(&gAliasDoc)); memcpy(alias, &gAliasDoc, sizeof(struct xml_alias_t)); *alias->ct = *alias->ct + 1; ithread_mutex_unlock(&gWebMutex); } ",0 "int snd_usb_lock_shutdown(struct snd_usb_audio *chip) { int err; atomic_inc(&chip->usage_count); if (atomic_read(&chip->shutdown)) { err = -EIO; goto error; } err = snd_usb_autoresume(chip); if (err < 0) goto error; return 0; error: if (atomic_dec_and_test(&chip->usage_count)) wake_up(&chip->shutdown_wait); return err; } ",0 "DownloadManagerImpl::UniqueUrlDownloadHandlerPtr BeginResourceDownload( std::unique_ptr params, std::unique_ptr request, scoped_refptr url_loader_factory_getter, scoped_refptr file_system_context, uint32_t download_id, base::WeakPtr download_manager) { DCHECK_CURRENTLY_ON(BrowserThread::IO); if (params->render_process_host_id() >= 0 && !CanRequestURLFromRenderer(params->render_process_host_id(), params->url())) { CreateInterruptedDownload(params.get(), DOWNLOAD_INTERRUPT_REASON_NETWORK_INVALID_REQUEST, download_manager); return nullptr; } ResourceRequestInfo::WebContentsGetter getter = base::Bind(&GetWebContents, params->render_process_host_id(), params->render_frame_host_routing_id(), -1); return DownloadManagerImpl::UniqueUrlDownloadHandlerPtr( ResourceDownloader::BeginDownload( download_manager, std::move(params), std::move(request), url_loader_factory_getter, file_system_context, getter, download_id, false) .release()); } ",0 "static int dw210x_op_rw(struct usb_device *dev, u8 request, u16 value, u16 index, u8 * data, u16 len, int flags) { int ret; u8 *u8buf; unsigned int pipe = (flags == DW210X_READ_MSG) ? usb_rcvctrlpipe(dev, 0) : usb_sndctrlpipe(dev, 0); u8 request_type = (flags == DW210X_READ_MSG) ? USB_DIR_IN : USB_DIR_OUT; u8buf = kmalloc(len, GFP_KERNEL); if (!u8buf) return -ENOMEM; if (flags == DW210X_WRITE_MSG) memcpy(u8buf, data, len); ret = usb_control_msg(dev, pipe, request, request_type | USB_TYPE_VENDOR, value, index , u8buf, len, 2000); if (flags == DW210X_READ_MSG) memcpy(data, u8buf, len); kfree(u8buf); return ret; } ",0 "int PopupContainer::layoutAndGetRTLOffset() { m_listBox->layout(); m_listBox->move(kBorderSize, kBorderSize); int listBoxWidth = m_listBox->width() + kBorderSize * 2; resize(listBoxWidth, m_listBox->height() + kBorderSize * 2); invalidate(); return m_originalFrameRect.width() - listBoxWidth; } ",0 "static ssize_t show_uart_mode(struct device *dev, struct device_attribute *attr, char *buf) { struct usb_serial_port *port = to_usb_serial_port(dev); struct edgeport_port *edge_port = usb_get_serial_port_data(port); return sprintf(buf, ""%d\n"", edge_port->bUartMode); } ",0 "int phar_is_tar(char *buf, char *fname) /* {{{ */ { tar_header *header = (tar_header *) buf; php_uint32 checksum = phar_tar_number(header->checksum, sizeof(header->checksum)); php_uint32 ret; char save[sizeof(header->checksum)]; /* assume that the first filename in a tar won't begin with checksum, sizeof(header->checksum)); memset(header->checksum, ' ', sizeof(header->checksum)); ret = (checksum == phar_tar_checksum(buf, 512)); memcpy(header->checksum, save, sizeof(header->checksum)); if (!ret && strstr(fname, "".tar"")) { /* probably a corrupted tar - so we will pretend it is one */ return 1; } return ret; } /* }}} */ ",0 "void LayerTreeHost::SetNextCommitWaitsForActivation() { proxy_->SetNextCommitWaitsForActivation(); } ",0 "const SelectionInDOMTree& FrameSelection::GetSelectionInDOMTree() const { return selection_editor_->GetSelectionInDOMTree(); } ",0 "static int tcp_ack_update_window(struct sock *sk, const struct sk_buff *skb, u32 ack, u32 ack_seq) { struct tcp_sock *tp = tcp_sk(sk); int flag = 0; u32 nwin = ntohs(tcp_hdr(skb)->window); if (likely(!tcp_hdr(skb)->syn)) nwin <<= tp->rx_opt.snd_wscale; if (tcp_may_update_window(tp, ack, ack_seq, nwin)) { flag |= FLAG_WIN_UPDATE; tcp_update_wl(tp, ack_seq); if (tp->snd_wnd != nwin) { tp->snd_wnd = nwin; /* Note, it is the only place, where * fast path is recovered for sending TCP. */ tp->pred_flags = 0; tcp_fast_path_check(sk); if (tcp_send_head(sk)) tcp_slow_start_after_idle_check(sk); if (nwin > tp->max_window) { tp->max_window = nwin; tcp_sync_mss(sk, inet_csk(sk)->icsk_pmtu_cookie); } } } tcp_snd_una_update(tp, ack); return flag; } ",0 "bgp_attr_prefix_sid(int32_t tlength, struct bgp_attr_parser_args *args, struct bgp_nlri *mp_update) { struct peer *const peer = args->peer; struct attr *const attr = args->attr; bgp_attr_parse_ret_t ret; attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_PREFIX_SID); while (tlength) { int32_t type, length; type = stream_getc(peer->curr); length = stream_getw(peer->curr); ret = bgp_attr_psid_sub(type, length, args, mp_update); if (ret != BGP_ATTR_PARSE_PROCEED) return ret; /* * Subtract length + the T and the L * since length is the Vector portion */ tlength -= length + 3; if (tlength < 0) { flog_err( EC_BGP_ATTR_LEN, ""Prefix SID internal length %d causes us to read beyond the total Prefix SID length"", length); return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR, args->total); } } return BGP_ATTR_PARSE_PROCEED; } ",0 "RenderWidgetHostImpl::RenderWidgetHostImpl(RenderWidgetHostDelegate* delegate, RenderProcessHost* process, int32_t routing_id, bool hidden) : renderer_initialized_(false), destroyed_(false), delegate_(delegate), owner_delegate_(nullptr), process_(process), routing_id_(routing_id), is_loading_(false), is_hidden_(hidden), repaint_ack_pending_(false), resize_ack_pending_(false), color_profile_out_of_date_(false), auto_resize_enabled_(false), waiting_for_screen_rects_ack_(false), needs_repainting_on_restore_(false), is_unresponsive_(false), in_flight_event_count_(0), in_get_backing_store_(false), ignore_input_events_(false), text_direction_updated_(false), text_direction_(blink::WebTextDirectionLeftToRight), text_direction_canceled_(false), suppress_next_char_events_(false), pending_mouse_lock_request_(false), allow_privileged_mouse_lock_(false), has_touch_handler_(false), is_in_gesture_scroll_(false), received_paint_after_load_(false), next_browser_snapshot_id_(1), owned_by_render_frame_host_(false), is_focused_(false), scale_input_to_viewport_(IsUseZoomForDSFEnabled()), hung_renderer_delay_( base::TimeDelta::FromMilliseconds(kHungRendererDelayMs)), new_content_rendering_delay_( base::TimeDelta::FromMilliseconds(kNewContentRenderingDelayMs)), mouse_wheel_coalesce_timer_(new base::ElapsedTimer()), weak_factory_(this) { CHECK(delegate_); CHECK_NE(MSG_ROUTING_NONE, routing_id_); std::pair result = g_routing_id_widget_map.Get().insert(std::make_pair( RenderWidgetHostID(process->GetID(), routing_id_), this)); CHECK(result.second) << ""Inserting a duplicate item!""; process_->AddRoute(routing_id_, this); if (!hidden) process_->WidgetRestored(); latency_tracker_.Initialize(routing_id_, GetProcess()->GetID()); input_router_.reset(new InputRouterImpl( process_, this, this, routing_id_, GetInputRouterConfigForPlatform())); touch_emulator_.reset(); if (!base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kDisableHangMonitor)) { hang_monitor_timeout_.reset(new TimeoutMonitor( base::Bind(&RenderWidgetHostImpl::RendererIsUnresponsive, weak_factory_.GetWeakPtr()))); } new_content_rendering_timeout_.reset(new TimeoutMonitor( base::Bind(&RenderWidgetHostImpl::ClearDisplayedGraphics, weak_factory_.GetWeakPtr()))); delegate_->RenderWidgetCreated(this); } ",0 "zcallendpage(i_ctx_t *i_ctx_p) { os_ptr op = osp; gx_device *dev = gs_currentdevice(igs); int code; check_type(op[-1], t_integer); check_type(*op, t_integer); if ((dev = (*dev_proc(dev, get_page_device))(dev)) != 0) { code = (*dev->page_procs.end_page)(dev, (int)op->value.intval, igs); if (code < 0) return code; if (code > 1) return_error(gs_error_rangecheck); } else { code = (op->value.intval == 2 ? 0 : 1); } make_bool(op - 1, code); pop(1); return 0; } ",0 "const char *am_get_mime_header(request_rec *r, const char *m, const char *h) { const char *line; char *l1; const char *value; char *l2; for (line = am_xstrtok(r, m, ""\n"", &l1); line && *line; line = am_xstrtok(r, NULL, ""\n"", &l1)) { am_strip_blank(&line); if (((value = am_xstrtok(r, line, "":"", &l2)) != NULL) && (strcasecmp(value, h) == 0)) { if ((value = am_xstrtok(r, NULL, "":"", &l2)) != NULL) am_strip_blank(&value); return value; } } return NULL; } ",0 "void RenderViewImpl::DidAutoResize(const blink::WebSize& newSize) { GetWidget()->DidAutoResize(newSize); } ",0 "void HTMLDocument::setAlinkColor(const AtomicString& value) { setBodyAttribute(alinkAttr, value); } ",0 "ElementShadow* ShadowRoot::owner() const { if (host()) return host()->shadow(); return 0; } ",0 "void l2cap_cleanup_sockets(void) { if (bt_sock_unregister(BTPROTO_L2CAP) < 0) BT_ERR(""L2CAP socket unregistration failed""); proto_unregister(&l2cap_proto); } ",0 "static glfs_t* tcmu_create_glfs_object(char *config, gluster_server **hosts) { gluster_server *entry = NULL; char logfilepath[PATH_MAX]; glfs_t *fs = NULL; int ret = -1; if (parse_imagepath(config, hosts) == -1) { tcmu_err(""hostaddr, volname, or path missing\n""); goto fail; } entry = *hosts; fs = gluster_cache_query(entry, config); if (fs) return fs; fs = glfs_new(entry->volname); if (!fs) { tcmu_err(""glfs_new failed\n""); goto fail; } ret = gluster_cache_add(entry, fs, config); if (ret) { tcmu_err(""gluster_cache_add failed: %m\n""); goto fail; } ret = glfs_set_volfile_server(fs, gluster_transport_lookup[entry->server->type], entry->server->u.inet.addr, atoi(entry->server->u.inet.port)); if (ret) { tcmu_err(""glfs_set_volfile_server failed: %m\n""); goto unref; } ret = tcmu_make_absolute_logfile(logfilepath, TCMU_GLFS_LOG_FILENAME); if (ret < 0) { tcmu_err(""tcmu_make_absolute_logfile failed: %m\n""); goto unref; } ret = glfs_set_logging(fs, logfilepath, TCMU_GLFS_DEBUG_LEVEL); if (ret < 0) { tcmu_err(""glfs_set_logging failed: %m\n""); goto unref; } ret = glfs_init(fs); if (ret) { tcmu_err(""glfs_init failed: %m\n""); goto unref; } return fs; unref: gluster_cache_refresh(fs, config); fail: gluster_free_server(hosts); return NULL; } ",0 "static void enabledAtRuntimeAttr1AttrSetter(v8::Local name, v8::Local value, const v8::AccessorInfo& info) { INC_STATS(""DOM.TestObj.enabledAtRuntimeAttr1._set""); TestObj* imp = V8TestObj::toNative(info.Holder()); int v = toInt32(value); imp->setEnabledAtRuntimeAttr1(v); return; } ",0 "reportDefault(XML_Parser parser, const ENCODING *enc, const char *s, const char *end) { if (MUST_CONVERT(enc, s)) { enum XML_Convert_Result convert_res; const char **eventPP; const char **eventEndPP; if (enc == parser->m_encoding) { eventPP = &parser->m_eventPtr; eventEndPP = &parser->m_eventEndPtr; } else { /* To get here, two things must be true; the parser must be * using a character encoding that is not the same as the * encoding passed in, and the encoding passed in must need * conversion to the internal format (UTF-8 unless XML_UNICODE * is defined). The only occasions on which the encoding passed * in is not the same as the parser's encoding are when it is * the internal encoding (e.g. a previously defined parameter * entity, already converted to internal format). This by * definition doesn't need conversion, so the whole branch never * gets executed. * * For safety's sake we don't delete these lines and merely * exclude them from coverage statistics. * * LCOV_EXCL_START */ eventPP = &(parser->m_openInternalEntities->internalEventPtr); eventEndPP = &(parser->m_openInternalEntities->internalEventEndPtr); /* LCOV_EXCL_STOP */ } do { ICHAR *dataPtr = (ICHAR *)parser->m_dataBuf; convert_res = XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)parser->m_dataBufEnd); *eventEndPP = s; parser->m_defaultHandler(parser->m_handlerArg, parser->m_dataBuf, (int)(dataPtr - (ICHAR *)parser->m_dataBuf)); *eventPP = s; } while ((convert_res != XML_CONVERT_COMPLETED) && (convert_res != XML_CONVERT_INPUT_INCOMPLETE)); } else parser->m_defaultHandler(parser->m_handlerArg, (XML_Char *)s, (int)((XML_Char *)end - (XML_Char *)s)); } ",0 "static void hash_openowner(struct nfs4_openowner *oo, struct nfs4_client *clp, unsigned int strhashval) { lockdep_assert_held(&clp->cl_lock); list_add(&oo->oo_owner.so_strhash, &clp->cl_ownerstr_hashtbl[strhashval]); list_add(&oo->oo_perclient, &clp->cl_openowners); } ",0 "modifier_init(png_modifier *pm) { memset(pm, 0, sizeof *pm); store_init(&pm->this); pm->modifications = NULL; pm->state = modifier_start; pm->sbitlow = 1U; pm->ngammas = 0; pm->ngamma_tests = 0; pm->gammas = 0; pm->current_gamma = 0; pm->encodings = 0; pm->nencodings = 0; pm->current_encoding = 0; pm->encoding_counter = 0; pm->encoding_ignored = 0; pm->repeat = 0; pm->test_uses_encoding = 0; pm->maxout8 = pm->maxpc8 = pm->maxabs8 = pm->maxcalc8 = 0; pm->maxout16 = pm->maxpc16 = pm->maxabs16 = pm->maxcalc16 = 0; pm->maxcalcG = 0; pm->limit = 4E-3; pm->log8 = pm->log16 = 0; /* Means 'off' */ pm->error_gray_2 = pm->error_gray_4 = pm->error_gray_8 = 0; pm->error_gray_16 = pm->error_color_8 = pm->error_color_16 = 0; pm->error_indexed = 0; pm->use_update_info = 0; pm->interlace_type = PNG_INTERLACE_NONE; pm->test_standard = 0; pm->test_size = 0; pm->test_transform = 0; pm->use_input_precision = 0; pm->use_input_precision_sbit = 0; pm->use_input_precision_16to8 = 0; pm->calculations_use_input_precision = 0; pm->assume_16_bit_calculations = 0; pm->test_gamma_threshold = 0; pm->test_gamma_transform = 0; pm->test_gamma_sbit = 0; pm->test_gamma_scale16 = 0; pm->test_gamma_background = 0; pm->test_gamma_alpha_mode = 0; pm->test_gamma_expand16 = 0; pm->test_exhaustive = 0; pm->log = 0; /* Rely on the memset for all the other fields - there are no pointers */ } ",1 "HB_Bool HB_MyanmarShape(HB_ShaperItem *item) { HB_Bool openType = FALSE; unsigned short *logClusters = item->log_clusters; HB_ShaperItem syllable = *item; int first_glyph = 0; int sstart = item->item.pos; int end = sstart + item->item.length; int i = 0; assert(item->item.script == HB_Script_Myanmar); #ifndef NO_OPENTYPE openType = HB_SelectScript(item, myanmar_features); #endif MMDEBUG(""myanmar_shape: from %d length %d"", item->item.pos, item->item.length); while (sstart < end) { HB_Bool invalid; int send = myanmar_nextSyllableBoundary(item->string, sstart, end, &invalid); MMDEBUG(""syllable from %d, length %d, invalid=%s"", sstart, send-sstart, invalid ? ""TRUE"" : ""FALSE""); syllable.item.pos = sstart; syllable.item.length = send-sstart; syllable.glyphs = item->glyphs + first_glyph; syllable.attributes = item->attributes + first_glyph; syllable.advances = item->advances + first_glyph; syllable.offsets = item->offsets + first_glyph; syllable.num_glyphs = item->num_glyphs - first_glyph; if (!myanmar_shape_syllable(openType, &syllable, invalid)) { MMDEBUG(""syllable shaping failed, syllable requests %d glyphs"", syllable.num_glyphs); item->num_glyphs += syllable.num_glyphs; return FALSE; } /* fix logcluster array */ MMDEBUG(""syllable:""); for (i = first_glyph; i < first_glyph + (int)syllable.num_glyphs; ++i) MMDEBUG("" %d -> glyph %x"", i, item->glyphs[i]); MMDEBUG("" logclusters:""); for (i = sstart; i < send; ++i) { MMDEBUG("" %d -> glyph %d"", i, first_glyph); logClusters[i-item->item.pos] = first_glyph; } sstart = send; first_glyph += syllable.num_glyphs; } item->num_glyphs = first_glyph; return TRUE; } ",0 "frobnicate_signal_handler (DBusGProxy *proxy, int val, void *user_data) { n_times_frobnicate_received += 1; g_assert (val == 42); g_print (""Got Frobnicate signal\n""); g_main_loop_quit (loop); g_source_remove (exit_timeout); } ",0 "account_entity_dequeue(struct cfs_rq *cfs_rq, struct sched_entity *se) { update_load_sub(&cfs_rq->load, se->load.weight); if (!parent_entity(se)) update_load_sub(&rq_of(cfs_rq)->load, se->load.weight); #ifdef CONFIG_SMP if (entity_is_task(se)) { account_numa_dequeue(rq_of(cfs_rq), task_of(se)); list_del_init(&se->group_node); } #endif cfs_rq->nr_running--; } ",0 "static int t220_frontend_attach(struct dvb_usb_adapter *d) { u8 obuf[3] = { 0xe, 0x87, 0 }; u8 ibuf[] = { 0 }; if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0) err(""command 0x0e transfer failed.""); obuf[0] = 0xe; obuf[1] = 0x86; obuf[2] = 1; if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0) err(""command 0x0e transfer failed.""); obuf[0] = 0xe; obuf[1] = 0x80; obuf[2] = 0; if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0) err(""command 0x0e transfer failed.""); msleep(50); obuf[0] = 0xe; obuf[1] = 0x80; obuf[2] = 1; if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0) err(""command 0x0e transfer failed.""); obuf[0] = 0x51; if (dvb_usb_generic_rw(d->dev, obuf, 1, ibuf, 1, 0) < 0) err(""command 0x51 transfer failed.""); d->fe_adap[0].fe = dvb_attach(cxd2820r_attach, &cxd2820r_config, &d->dev->i2c_adap, NULL); if (d->fe_adap[0].fe != NULL) { if (dvb_attach(tda18271_attach, d->fe_adap[0].fe, 0x60, &d->dev->i2c_adap, &tda18271_config)) { info(""Attached TDA18271HD/CXD2820R!""); return 0; } } info(""Failed to attach TDA18271HD/CXD2820R!""); return -EIO; } ",1 "void PanelBrowserView::AnimationEnded(const ui::Animation* animation) { panel_->manager()->OnPanelAnimationEnded(panel_.get()); } ",0 "static int check_ctx_access(struct bpf_verifier_env *env, int insn_idx, int off, int size, enum bpf_access_type t, enum bpf_reg_type *reg_type) { struct bpf_insn_access_aux info = { .reg_type = *reg_type, }; if (env->ops->is_valid_access && env->ops->is_valid_access(off, size, t, &info)) { /* A non zero info.ctx_field_size indicates that this field is a * candidate for later verifier transformation to load the whole * field and then apply a mask when accessed with a narrower * access than actual ctx access size. A zero info.ctx_field_size * will only allow for whole field access and rejects any other * type of narrower access. */ *reg_type = info.reg_type; env->insn_aux_data[insn_idx].ctx_field_size = info.ctx_field_size; /* remember the offset of last byte accessed in ctx */ if (env->prog->aux->max_ctx_offset < off + size) env->prog->aux->max_ctx_offset = off + size; return 0; } verbose(env, ""invalid bpf_context access off=%d size=%d\n"", off, size); return -EACCES; } ",0 "bool AppCacheUpdateJob::MaybeLoadFromNewestCache(const GURL& url, AppCacheEntry& entry) { if (update_type_ != UPGRADE_ATTEMPT) return false; AppCache* newest = group_->newest_complete_cache(); AppCacheEntry* copy_me = newest->GetEntry(url); if (!copy_me || !copy_me->has_response_id()) return false; loading_responses_.insert( LoadingResponses::value_type(copy_me->response_id(), url)); storage_->LoadResponseInfo(manifest_url_, group_->group_id(), copy_me->response_id(), this); return true; } ",0 "struct posix_acl *f2fs_get_acl(struct inode *inode, int type) { return __f2fs_get_acl(inode, type, NULL); } ",0 "void serveloop(GArray* servers) { struct sockaddr_storage addrin; socklen_t addrinlen=sizeof(addrin); int i; int max; fd_set mset; fd_set rset; /* * Set up the master fd_set. The set of descriptors we need * to select() for never changes anyway and it buys us a *lot* * of time to only build this once. However, if we ever choose * to not fork() for clients anymore, we may have to revisit * this. */ max=0; FD_ZERO(&mset); for(i=0;ilen;i++) { int sock; if((sock=(g_array_index(servers, SERVER, i)).socket) >= 0) { FD_SET(sock, &mset); max=sock>max?sock:max; } } for(i=0;ilen;i++) { int sock = g_array_index(modernsocks, int, i); FD_SET(sock, &mset); max=sock>max?sock:max; } for(;;) { /* SIGHUP causes the root server process to reconfigure * itself and add new export servers for each newly * found export configuration group, i.e. spawn new * server processes for each previously non-existent * export. This does not alter old runtime configuration * but just appends new exports. */ if (is_sighup_caught) { int n; GError *gerror = NULL; msg(LOG_INFO, ""reconfiguration request received""); is_sighup_caught = 0; /* Reset to allow catching * it again. */ n = append_new_servers(servers, &gerror); if (n == -1) msg(LOG_ERR, ""failed to append new servers: %s"", gerror->message); for (i = servers->len - n; i < servers->len; ++i) { const SERVER server = g_array_index(servers, SERVER, i); if (server.socket >= 0) { FD_SET(server.socket, &mset); max = server.socket > max ? server.socket : max; } msg(LOG_INFO, ""reconfigured new server: %s"", server.servename); } } memcpy(&rset, &mset, sizeof(fd_set)); if(select(max+1, &rset, NULL, NULL, NULL)>0) { int net; DEBUG(""accept, ""); for(i=0; i < modernsocks->len; i++) { int sock = g_array_index(modernsocks, int, i); if(!FD_ISSET(sock, &rset)) { continue; } CLIENT *client; if((net=accept(sock, (struct sockaddr *) &addrin, &addrinlen)) < 0) { err_nonfatal(""accept: %m""); continue; } client = negotiate(net, NULL, servers, NEG_INIT | NEG_MODERN); if(!client) { close(net); continue; } handle_connection(servers, net, client->server, client); } for(i=0; i < servers->len; i++) { SERVER *serve; serve=&(g_array_index(servers, SERVER, i)); if(serve->socket < 0) { continue; } if(FD_ISSET(serve->socket, &rset)) { if ((net=accept(serve->socket, (struct sockaddr *) &addrin, &addrinlen)) < 0) { err_nonfatal(""accept: %m""); continue; } handle_connection(servers, net, serve, NULL); } } } } } ",1 "void PDFiumEngine::Form_KillTimer(FPDF_FORMFILLINFO* param, int timer_id) { PDFiumEngine* engine = static_cast(param); engine->timers_.erase(timer_id); } ",0 "int RenderViewImpl::GetEnabledBindings() { return enabled_bindings_; } ",0 "void HTMLMediaElement::AudioClientImpl::Trace(blink::Visitor* visitor) { visitor->Trace(client_); } ",0 "void OutputPointer(void* pointer, BacktraceOutputHandler* handler) { char buf[17] = { '\0' }; handler->HandleOutput(""0x""); internal::itoa_r(reinterpret_cast(pointer), buf, sizeof(buf), 16, 12); handler->HandleOutput(buf); } ",0 "void FrameLoader::CommitProvisionalLoad() { DCHECK(Client()->HasWebView()); if (frame_->GetDocument()) { scoped_refptr security_origin = SecurityOrigin::Create(provisional_document_loader_->Url()); provisional_document_loader_->GetTiming() .SetHasSameOriginAsPreviousDocument( security_origin->CanRequest(frame_->GetDocument()->Url())); } virtual_time_pauser_.UnpauseVirtualTime(); if (!PrepareForCommit()) return; Client()->TransitionToCommittedForNewPage(); frame_->GetNavigationScheduler().Cancel(); } ",0 "SProcRenderQueryPictIndexValues (ClientPtr client) { register int n; REQUEST(xRenderQueryPictIndexValuesReq); swaps(&stuff->length, n); swapl(&stuff->format, n); return (*ProcRenderVector[stuff->renderReqType]) (client); } ",0 "static void nfs4_handle_setlk_error(struct nfs_server *server, struct nfs4_lock_state *lsp, int new_lock_owner, int error) { switch (error) { case -NFS4ERR_ADMIN_REVOKED: case -NFS4ERR_BAD_STATEID: lsp->ls_seqid.flags &= ~NFS_SEQID_CONFIRMED; if (new_lock_owner != 0 || (lsp->ls_flags & NFS_LOCK_INITIALIZED) != 0) nfs4_schedule_stateid_recovery(server, lsp->ls_state); break; case -NFS4ERR_STALE_STATEID: lsp->ls_seqid.flags &= ~NFS_SEQID_CONFIRMED; case -NFS4ERR_EXPIRED: nfs4_schedule_lease_recovery(server->nfs_client); }; } ",0 "void json_tokener_reset(struct json_tokener *tok) { int i; if (!tok) return; for(i = tok->depth; i >= 0; i--) json_tokener_reset_level(tok, i); tok->depth = 0; tok->err = json_tokener_success; } ",0 "void Document::updateLayoutTreeIgnorePendingStylesheets() { StyleEngine::IgnoringPendingStylesheet ignoring(styleEngine()); if (styleEngine().hasPendingSheets()) { HTMLElement* bodyElement = body(); if (bodyElement && !bodyElement->layoutObject() && m_pendingSheetLayout == NoLayoutWithPendingSheets) { m_pendingSheetLayout = DidLayoutWithPendingSheets; styleResolverChanged(); } else if (m_hasNodesWithPlaceholderStyle) { updateLayoutTree(Force); } } updateLayoutTreeIfNeeded(); } ",0 "static inline void rb_end_commit(struct ring_buffer_per_cpu *cpu_buffer) { unsigned long commits; if (RB_WARN_ON(cpu_buffer, !local_read(&cpu_buffer->committing))) return; again: commits = local_read(&cpu_buffer->commits); /* synchronize with interrupts */ barrier(); if (local_read(&cpu_buffer->committing) == 1) rb_set_commit_to_write(cpu_buffer); local_dec(&cpu_buffer->committing); /* synchronize with interrupts */ barrier(); /* * Need to account for interrupts coming in between the * updating of the commit page and the clearing of the * committing counter. */ if (unlikely(local_read(&cpu_buffer->commits) != commits) && !local_read(&cpu_buffer->committing)) { local_inc(&cpu_buffer->committing); goto again; } } ",0 "void WT_InterpolateNoLoop (S_WT_VOICE *pWTVoice, S_WT_INT_FRAME *pWTIntFrame) { EAS_PCM *pOutputBuffer; EAS_I32 phaseInc; EAS_I32 phaseFrac; EAS_I32 acc0; const EAS_SAMPLE *pSamples; EAS_I32 samp1; EAS_I32 samp2; EAS_I32 numSamples; /* initialize some local variables */ numSamples = pWTIntFrame->numSamples; pOutputBuffer = pWTIntFrame->pAudioBuffer; phaseInc = pWTIntFrame->frame.phaseIncrement; pSamples = (const EAS_SAMPLE*) pWTVoice->phaseAccum; phaseFrac = (EAS_I32)pWTVoice->phaseFrac; /* fetch adjacent samples */ #if defined(_8_BIT_SAMPLES) /*lint -e{701} */ samp1 = pSamples[0] << 8; /*lint -e{701} */ samp2 = pSamples[1] << 8; #else samp1 = pSamples[0]; samp2 = pSamples[1]; #endif while (numSamples--) { /* linear interpolation */ acc0 = samp2 - samp1; acc0 = acc0 * phaseFrac; /*lint -e{704} */ acc0 = samp1 + (acc0 >> NUM_PHASE_FRAC_BITS); /* save new output sample in buffer */ /*lint -e{704} */ *pOutputBuffer++ = (EAS_I16)(acc0 >> 2); /* increment phase */ phaseFrac += phaseInc; /*lint -e{704} */ acc0 = phaseFrac >> NUM_PHASE_FRAC_BITS; /* next sample */ if (acc0 > 0) { /* advance sample pointer */ pSamples += acc0; phaseFrac = (EAS_I32)((EAS_U32)phaseFrac & PHASE_FRAC_MASK); /* fetch new samples */ #if defined(_8_BIT_SAMPLES) /*lint -e{701} */ samp1 = pSamples[0] << 8; /*lint -e{701} */ samp2 = pSamples[1] << 8; #else samp1 = pSamples[0]; samp2 = pSamples[1]; #endif } } /* save pointer and phase */ pWTVoice->phaseAccum = (EAS_U32) pSamples; pWTVoice->phaseFrac = (EAS_U32) phaseFrac; } ",1 "static int walk_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, struct mm_walk *walk) { pte_t *pte; int err = 0; pte = pte_offset_map(pmd, addr); for (;;) { err = walk->pte_entry(pte, addr, addr + PAGE_SIZE, walk); if (err) break; addr += PAGE_SIZE; if (addr == end) break; pte++; } pte_unmap(pte); return err; } ",0 "static void netlink_remove(struct sock *sk) { struct netlink_table *table; table = &nl_table[sk->sk_protocol]; if (!rhashtable_remove_fast(&table->hash, &nlk_sk(sk)->node, netlink_rhashtable_params)) { WARN_ON(atomic_read(&sk->sk_refcnt) == 1); __sock_put(sk); } netlink_table_grab(); if (nlk_sk(sk)->subscriptions) { __sk_del_bind_node(sk); netlink_update_listeners(sk); } if (sk->sk_protocol == NETLINK_GENERIC) atomic_inc(&genl_sk_destructing_cnt); netlink_table_ungrab(); } ",0 "static void _php_pgsql_notice_handler(void *resource_id, const char *message) { php_pgsql_notice *notice; TSRMLS_FETCH(); if (! PGG(ignore_notices)) { notice = (php_pgsql_notice *)emalloc(sizeof(php_pgsql_notice)); notice->message = _php_pgsql_trim_message(message, (int *)¬ice->len); if (PGG(log_notices)) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""%s"", notice->message); } zend_hash_index_update(&PGG(notices), (ulong)resource_id, (void **)¬ice, sizeof(php_pgsql_notice *), NULL); } } ",0 "void V8TestObject::MeasureAsFeatureNameTestInterfaceEmptyConstructorAttributeConstructorGetterCallback( v8::Local property, const v8::PropertyCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_measureAsFeatureNameTestInterfaceEmptyConstructorAttribute_ConstructorGetterCallback""); ExecutionContext* execution_context_for_measurement = CurrentExecutionContext(info.GetIsolate()); UseCounter::Count(execution_context_for_measurement, WebFeature::kFeatureName); V8ConstructorAttributeGetter(property, info, V8TestInterfaceEmpty::GetWrapperTypeInfo()); } ",0 "ikev1_ke_print(netdissect_options *ndo, u_char tpay _U_, const struct isakmp_gen *ext, u_int item_len _U_, const u_char *ep _U_, uint32_t phase _U_, uint32_t doi _U_, uint32_t proto _U_, int depth _U_) { struct isakmp_gen e; ND_PRINT((ndo,""%s:"", NPSTR(ISAKMP_NPTYPE_KE))); ND_TCHECK(*ext); UNALIGNED_MEMCPY(&e, ext, sizeof(e)); ND_PRINT((ndo,"" key len=%d"", ntohs(e.len) - 4)); if (2 < ndo->ndo_vflag && 4 < ntohs(e.len)) { /* Print the entire payload in hex */ ND_PRINT((ndo,"" "")); if (!rawprint(ndo, (const uint8_t *)(ext + 1), ntohs(e.len) - 4)) goto trunc; } return (const u_char *)ext + ntohs(e.len); trunc: ND_PRINT((ndo,"" [|%s]"", NPSTR(ISAKMP_NPTYPE_KE))); return NULL; } ",0 "bool RendererSchedulerImpl::ShouldDisableThrottlingBecauseOfAudio( base::TimeTicks now) { if (!main_thread_only().last_audio_state_change) return false; if (main_thread_only().is_audio_playing) return true; return main_thread_only().last_audio_state_change.value() + kThrottlingDelayAfterAudioIsPlayed > now; } ",0 "static inline int apic_enabled(struct kvm_lapic *apic) { return kvm_apic_sw_enabled(apic) && kvm_apic_hw_enabled(apic); } ",0 "bool GLES2Implementation::IsExtensionAvailable(const char* ext) { const char* extensions = reinterpret_cast(GetStringHelper(GL_EXTENSIONS)); if (!extensions) return false; int length = strlen(ext); while (true) { int n = strcspn(extensions, "" ""); if (n == length && 0 == strncmp(ext, extensions, length)) { return true; } if ('\0' == extensions[n]) { return false; } extensions += n + 1; } } ",0 "static long vhost_set_vring_endian(struct vhost_virtqueue *vq, int __user *argp) { struct vhost_vring_state s; if (vq->private_data) return -EBUSY; if (copy_from_user(&s, argp, sizeof(s))) return -EFAULT; if (s.num != VHOST_VRING_LITTLE_ENDIAN && s.num != VHOST_VRING_BIG_ENDIAN) return -EINVAL; vq->user_be = s.num; return 0; } ",0 "bool Document::hasFocus() const { Page* page = this->page(); if (!page) return false; if (!page->focusController().isActive() || !page->focusController().isFocused()) return false; Frame* focusedFrame = page->focusController().focusedFrame(); if (focusedFrame && focusedFrame->isLocalFrame()) { if (toLocalFrame(focusedFrame)->tree().isDescendantOf(frame())) return true; } return false; } ",0 "int dup_userfaultfd(struct vm_area_struct *vma, struct list_head *fcs) { struct userfaultfd_ctx *ctx = NULL, *octx; struct userfaultfd_fork_ctx *fctx; octx = vma->vm_userfaultfd_ctx.ctx; if (!octx || !(octx->features & UFFD_FEATURE_EVENT_FORK)) { vma->vm_userfaultfd_ctx = NULL_VM_UFFD_CTX; vma->vm_flags &= ~(VM_UFFD_WP | VM_UFFD_MISSING); return 0; } list_for_each_entry(fctx, fcs, list) if (fctx->orig == octx) { ctx = fctx->new; break; } if (!ctx) { fctx = kmalloc(sizeof(*fctx), GFP_KERNEL); if (!fctx) return -ENOMEM; ctx = kmem_cache_alloc(userfaultfd_ctx_cachep, GFP_KERNEL); if (!ctx) { kfree(fctx); return -ENOMEM; } atomic_set(&ctx->refcount, 1); ctx->flags = octx->flags; ctx->state = UFFD_STATE_RUNNING; ctx->features = octx->features; ctx->released = false; ctx->mmap_changing = false; ctx->mm = vma->vm_mm; mmgrab(ctx->mm); userfaultfd_ctx_get(octx); WRITE_ONCE(octx->mmap_changing, true); fctx->orig = octx; fctx->new = ctx; list_add_tail(&fctx->list, fcs); } vma->vm_userfaultfd_ctx.ctx = ctx; return 0; } ",0 "void SplitStringAlongWhitespace(const std::wstring& str, std::vector* result) { SplitStringAlongWhitespaceT(str, result); } ",0 "int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen, struct inode *inode, const char *path, int aclflag) { int oplock = 0; unsigned int xid; int rc, access_flags, create_options = 0; struct cifs_tcon *tcon; struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); struct tcon_link *tlink = cifs_sb_tlink(cifs_sb); struct cifs_fid fid; struct cifs_open_parms oparms; if (IS_ERR(tlink)) return PTR_ERR(tlink); tcon = tlink_tcon(tlink); xid = get_xid(); if (backup_cred(cifs_sb)) create_options |= CREATE_OPEN_BACKUP_INTENT; if (aclflag == CIFS_ACL_OWNER || aclflag == CIFS_ACL_GROUP) access_flags = WRITE_OWNER; else access_flags = WRITE_DAC; oparms.tcon = tcon; oparms.cifs_sb = cifs_sb; oparms.desired_access = access_flags; oparms.create_options = create_options; oparms.disposition = FILE_OPEN; oparms.path = path; oparms.fid = &fid; oparms.reconnect = false; rc = CIFS_open(xid, &oparms, &oplock, NULL); if (rc) { cifs_dbg(VFS, ""Unable to open file to set ACL\n""); goto out; } rc = CIFSSMBSetCIFSACL(xid, tcon, fid.netfid, pnntsd, acllen, aclflag); cifs_dbg(NOISY, ""SetCIFSACL rc = %d\n"", rc); CIFSSMBClose(xid, tcon, fid.netfid); out: free_xid(xid); cifs_put_tlink(tlink); return rc; } ",0 "static int do_setcontext_tm(struct ucontext __user *ucp, struct ucontext __user *tm_ucp, struct pt_regs *regs) { sigset_t set; struct mcontext __user *mcp; struct mcontext __user *tm_mcp; u32 cmcp; u32 tm_cmcp; if (get_sigset_t(&set, &ucp->uc_sigmask)) return -EFAULT; if (__get_user(cmcp, &ucp->uc_regs) || __get_user(tm_cmcp, &tm_ucp->uc_regs)) return -EFAULT; mcp = (struct mcontext __user *)(u64)cmcp; tm_mcp = (struct mcontext __user *)(u64)tm_cmcp; /* no need to check access_ok(mcp), since mcp < 4GB */ set_current_blocked(&set); if (restore_tm_user_regs(regs, mcp, tm_mcp)) return -EFAULT; return 0; } ",0 "perform_interlace_macro_validation(void) { /* The macros to validate, first those that depend only on pass: * * PNG_PASS_START_ROW(pass) * PNG_PASS_START_COL(pass) * PNG_PASS_ROW_SHIFT(pass) * PNG_PASS_COL_SHIFT(pass) */ int pass; for (pass=0; pass<7; ++pass) { png_uint_32 m, f, v; m = PNG_PASS_START_ROW(pass); f = png_pass_start_row(pass); if (m != f) { fprintf(stderr, ""PNG_PASS_START_ROW(%d) = %u != %x\n"", pass, m, f); exit(99); } m = PNG_PASS_START_COL(pass); f = png_pass_start_col(pass); if (m != f) { fprintf(stderr, ""PNG_PASS_START_COL(%d) = %u != %x\n"", pass, m, f); exit(99); } m = PNG_PASS_ROW_SHIFT(pass); f = png_pass_row_shift(pass); if (m != f) { fprintf(stderr, ""PNG_PASS_ROW_SHIFT(%d) = %u != %x\n"", pass, m, f); exit(99); } m = PNG_PASS_COL_SHIFT(pass); f = png_pass_col_shift(pass); if (m != f) { fprintf(stderr, ""PNG_PASS_COL_SHIFT(%d) = %u != %x\n"", pass, m, f); exit(99); } /* Macros that depend on the image or sub-image height too: * * PNG_PASS_ROWS(height, pass) * PNG_PASS_COLS(width, pass) * PNG_ROW_FROM_PASS_ROW(yIn, pass) * PNG_COL_FROM_PASS_COL(xIn, pass) * PNG_ROW_IN_INTERLACE_PASS(y, pass) * PNG_COL_IN_INTERLACE_PASS(x, pass) */ for (v=0;;) { /* First the base 0 stuff: */ m = PNG_ROW_FROM_PASS_ROW(v, pass); f = png_row_from_pass_row(v, pass); if (m != f) { fprintf(stderr, ""PNG_ROW_FROM_PASS_ROW(%u, %d) = %u != %x\n"", v, pass, m, f); exit(99); } m = PNG_COL_FROM_PASS_COL(v, pass); f = png_col_from_pass_col(v, pass); if (m != f) { fprintf(stderr, ""PNG_COL_FROM_PASS_COL(%u, %d) = %u != %x\n"", v, pass, m, f); exit(99); } m = PNG_ROW_IN_INTERLACE_PASS(v, pass); f = png_row_in_interlace_pass(v, pass); if (m != f) { fprintf(stderr, ""PNG_ROW_IN_INTERLACE_PASS(%u, %d) = %u != %x\n"", v, pass, m, f); exit(99); } m = PNG_COL_IN_INTERLACE_PASS(v, pass); f = png_col_in_interlace_pass(v, pass); if (m != f) { fprintf(stderr, ""PNG_COL_IN_INTERLACE_PASS(%u, %d) = %u != %x\n"", v, pass, m, f); exit(99); } /* Then the base 1 stuff: */ ++v; m = PNG_PASS_ROWS(v, pass); f = png_pass_rows(v, pass); if (m != f) { fprintf(stderr, ""PNG_PASS_ROWS(%u, %d) = %u != %x\n"", v, pass, m, f); exit(99); } m = PNG_PASS_COLS(v, pass); f = png_pass_cols(v, pass); if (m != f) { fprintf(stderr, ""PNG_PASS_COLS(%u, %d) = %u != %x\n"", v, pass, m, f); exit(99); } /* Move to the next v - the stepping algorithm starts skipping * values above 1024. */ if (v > 1024) { if (v == PNG_UINT_31_MAX) break; v = (v << 1) ^ v; if (v >= PNG_UINT_31_MAX) v = PNG_UINT_31_MAX-1; } } } } ",0 "void GamepadProvider::OnDevicesChanged(base::SystemMonitor::DeviceType type) { base::AutoLock lock(devices_changed_lock_); devices_changed_ = true; } ",0 "addresses_are_duplicate (const NMPlatformIP4Address *a, const NMPlatformIP4Address *b, gboolean consider_plen) { return a->address == b->address && (!consider_plen || a->plen == b->plen); } ",0 "krb5_gss_wrap(minor_status, context_handle, conf_req_flag, qop_req, input_message_buffer, conf_state, output_message_buffer) OM_uint32 *minor_status; gss_ctx_id_t context_handle; int conf_req_flag; gss_qop_t qop_req; gss_buffer_t input_message_buffer; int *conf_state; gss_buffer_t output_message_buffer; { return(kg_seal(minor_status, context_handle, conf_req_flag, qop_req, input_message_buffer, conf_state, output_message_buffer, KG_TOK_WRAP_MSG)); } ",0 "GF_Err prft_Size(GF_Box *s) { GF_ProducerReferenceTimeBox *ptr = (GF_ProducerReferenceTimeBox*)s; ptr->size += 4+8+ (ptr->version ? 8 : 4); return GF_OK; } ",0 "static void netlbl_cipsov4_doi_free(struct rcu_head *entry) { struct cipso_v4_doi *ptr; ptr = container_of(entry, struct cipso_v4_doi, rcu); switch (ptr->type) { case CIPSO_V4_MAP_STD: kfree(ptr->map.std->lvl.cipso); kfree(ptr->map.std->lvl.local); kfree(ptr->map.std->cat.cipso); kfree(ptr->map.std->cat.local); break; } kfree(ptr); } ",0 "bool GpuCommandBufferStub::Send(IPC::Message* message) { return channel_->Send(message); } ",0 "void QQuickWebView::focusInEvent(QFocusEvent* event) { Q_D(QQuickWebView); d->pageView->eventHandler()->handleFocusInEvent(event); } ",0 "static inline bool checkAddChild(ContainerNode* newParent, Node* newChild, ExceptionState& es) { return checkAcceptChild(newParent, newChild, 0, es); } ",0 "void RenderWidgetHostViewAura::OnCaptureLost() { host_->LostCapture(); if (touch_editing_client_) touch_editing_client_->EndTouchEditing(false); } ",0 "void RenderView::didNavigateWithinPage( WebFrame* frame, bool is_new_navigation) { NavigationState* state = NavigationState::FromDataSource(frame->dataSource()); bool idle_scheduler_ran = state->user_script_idle_scheduler()->has_run(); didCreateDataSource(frame, frame->dataSource()); if (idle_scheduler_ran) { NavigationState* new_state = NavigationState::FromDataSource(frame->dataSource()); new_state->user_script_idle_scheduler()->set_has_run(true); } didCommitProvisionalLoad(frame, is_new_navigation); UpdateTitle(frame, frame->view()->mainFrame()->dataSource()->pageTitle()); } ",0 "void BrowserView::ShowBookmarkBubble(const GURL& url, bool already_bookmarked) { toolbar_->ShowBookmarkBubble(url, already_bookmarked, bookmark_bar_view_.get()); } ",0 "static inline void gen_op_mov_v_reg(TCGMemOp ot, TCGv t0, int reg) { if (ot == MO_8 && byte_reg_is_xH(reg)) { tcg_gen_extract_tl(t0, cpu_regs[reg - 4], 8, 8); } else { tcg_gen_mov_tl(t0, cpu_regs[reg]); } } ",0 "static void limitedWithMissingDefaultAttributeAttributeGetterCallback(v8::Local, const v8::PropertyCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMGetter""); TestObjectV8Internal::limitedWithMissingDefaultAttributeAttributeGetter(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "status_t StreamingProcessor::stopStream() { ATRACE_CALL(); status_t res; Mutex::Autolock m(mMutex); sp device = mDevice.promote(); if (device == 0) { ALOGE(""%s: Camera %d: Device does not exist"", __FUNCTION__, mId); return INVALID_OPERATION; } res = device->clearStreamingRequest(); if (res != OK) { ALOGE(""%s: Camera %d: Can't clear stream request: %s (%d)"", __FUNCTION__, mId, strerror(-res), res); return res; } mActiveRequest = NONE; mActiveStreamIds.clear(); mPaused = false; return OK; } ",0 "void bt_accept_unlink(struct sock *sk) { BT_DBG(""sk %p state %d"", sk, sk->sk_state); list_del_init(&bt_sk(sk)->accept_q); bt_sk(sk)->parent->sk_ack_backlog--; bt_sk(sk)->parent = NULL; sock_put(sk); } ",0 "const FilePath& GlobalHistogramAllocator::GetPersistentLocation() const { return persistent_location_; } ",0 "static int ip6_forward_proxy_check(struct sk_buff *skb) { struct ipv6hdr *hdr = ipv6_hdr(skb); u8 nexthdr = hdr->nexthdr; int offset; if (ipv6_ext_hdr(nexthdr)) { offset = ipv6_skip_exthdr(skb, sizeof(*hdr), &nexthdr); if (offset < 0) return 0; } else offset = sizeof(struct ipv6hdr); if (nexthdr == IPPROTO_ICMPV6) { struct icmp6hdr *icmp6; if (!pskb_may_pull(skb, (skb_network_header(skb) + offset + 1 - skb->data))) return 0; icmp6 = (struct icmp6hdr *)(skb_network_header(skb) + offset); switch (icmp6->icmp6_type) { case NDISC_ROUTER_SOLICITATION: case NDISC_ROUTER_ADVERTISEMENT: case NDISC_NEIGHBOUR_SOLICITATION: case NDISC_NEIGHBOUR_ADVERTISEMENT: case NDISC_REDIRECT: /* For reaction involving unicast neighbor discovery * message destined to the proxied address, pass it to * input function. */ return 1; default: break; } } /* * The proxying router can't forward traffic sent to a link-local * address, so signal the sender and discard the packet. This * behavior is clarified by the MIPv6 specification. */ if (ipv6_addr_type(&hdr->daddr) & IPV6_ADDR_LINKLOCAL) { dst_link_failure(skb); return -1; } return 0; } ",0 " LayoutUnit negativeMargin() const { return m_negativeMargin; } ",0 "static enum srpt_command_state srpt_get_cmd_state(struct srpt_send_ioctx *ioctx) { enum srpt_command_state state; unsigned long flags; BUG_ON(!ioctx); spin_lock_irqsave(&ioctx->spinlock, flags); state = ioctx->state; spin_unlock_irqrestore(&ioctx->spinlock, flags); return state; } ",0 "__napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb) { struct sk_buff *p; for (p = napi->gro_list; p; p = p->next) { unsigned long diffs; diffs = (unsigned long)p->dev ^ (unsigned long)skb->dev; diffs |= p->vlan_tci ^ skb->vlan_tci; diffs |= compare_ether_header(skb_mac_header(p), skb_gro_mac_header(skb)); NAPI_GRO_CB(p)->same_flow = !diffs; NAPI_GRO_CB(p)->flush = 0; } return dev_gro_receive(napi, skb); } ",0 "static int tg3_phy_toggle_auxctl_smdsp(struct tg3 *tp, bool enable) { u32 val; int err; err = tg3_phy_auxctl_read(tp, MII_TG3_AUXCTL_SHDWSEL_AUXCTL, &val); if (err) return err; if (enable) val |= MII_TG3_AUXCTL_ACTL_SMDSP_ENA; else val &= ~MII_TG3_AUXCTL_ACTL_SMDSP_ENA; err = tg3_phy_auxctl_write((tp), MII_TG3_AUXCTL_SHDWSEL_AUXCTL, val | MII_TG3_AUXCTL_ACTL_TX_6DB); return err; } ",0 "void CreateStatusBar(void) { SIZE sz = {0, 0}; RECT rect; LONG x, y, width, height; int edge[3]; TBBUTTON tbbStatusToolbarButtons[1]; TBBUTTONINFO tbi; HFONT hFont; HDC hDC; hStatus = CreateWindowExW(0, STATUSCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | SBARS_TOOLTIPS | WS_CLIPSIBLINGS, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hMainDialog, (HMENU)IDC_STATUS, hMainInstance, NULL); GetClientRect(hStatus, &rect); height = rect.bottom; hFont = CreateFontA(-MulDiv(10, GetDeviceCaps(GetDC(hMainDialog), LOGPIXELSY), 72), 0, 0, 0, FW_MEDIUM, FALSE, FALSE, FALSE, DEFAULT_CHARSET, 0, 0, PROOF_QUALITY, 0, (nWindowsVersion >= WINDOWS_VISTA)?""Segoe UI"":""Arial Unicode MS""); hDC = GetDC(hMainDialog); SelectObject(hDC, hFont); GetTextExtentPoint32W(hDC, L""#"", 1, &sz); if (hDC != NULL) ReleaseDC(hMainDialog, hDC); GetClientRect(hMainDialog, &rect); edge[1] = rect.right - (int)(SB_TIMER_SECTION_SIZE * fScale); edge[0] = edge[1] - (8 + sz.cx + 8 + 1); // There's 8 absolute pixels on right and left of the text edge[2] = rect.right; SendMessage(hStatus, SB_SETPARTS, (WPARAM)ARRAYSIZE(edge), (LPARAM)&edge); x = edge[0]; if (nWindowsVersion <= WINDOWS_XP) { x -= 1; height -= 2; } y = rect.bottom - height + 1; width = edge[1] - edge[0] - 1; if ((fScale > 1.20f) && (fScale <2.40f)) height -= 1; if (nWindowsVersion <= WINDOWS_7) height += 1; hStatusToolbar = CreateWindowExW(WS_EX_TRANSPARENT, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_TABSTOP | WS_DISABLED | TBSTYLE_LIST | CCS_NOPARENTALIGN | CCS_NODIVIDER | CCS_NORESIZE, x, y, width, height, hMainDialog, (HMENU)IDC_STATUS_TOOLBAR, hMainInstance, NULL); SendMessage(hStatusToolbar, WM_SETFONT, (WPARAM)hFont, TRUE); SendMessage(hStatusToolbar, TB_SETEXTENDEDSTYLE, 0, (LPARAM)TBSTYLE_EX_MIXEDBUTTONS); SendMessage(hStatusToolbar, TB_SETIMAGELIST, 0, (LPARAM)NULL); SendMessage(hStatusToolbar, TB_SETDISABLEDIMAGELIST, 0, (LPARAM)NULL); SendMessage(hStatusToolbar, TB_SETBITMAPSIZE, 0, MAKELONG(0,0)); memset(tbbStatusToolbarButtons, 0, sizeof(TBBUTTON)); tbbStatusToolbarButtons[0].idCommand = IDC_HASH; tbbStatusToolbarButtons[0].fsStyle = BTNS_SHOWTEXT; tbbStatusToolbarButtons[0].fsState = TBSTATE_ENABLED; tbbStatusToolbarButtons[0].iString = (INT_PTR)L""#""; SendMessage(hStatusToolbar, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0); SendMessage(hStatusToolbar, TB_ADDBUTTONS, (WPARAM)1, (LPARAM)&tbbStatusToolbarButtons); SendMessage(hStatusToolbar, TB_SETBUTTONSIZE, 0, MAKELPARAM(width, height - 1)); tbi.cbSize = sizeof(tbi); tbi.dwMask = TBIF_SIZE | TBIF_COMMAND; tbi.cx = (WORD)width; tbi.idCommand = IDC_HASH; SendMessage(hStatusToolbar, TB_SETBUTTONINFO, (WPARAM)IDC_HASH, (LPARAM)&tbi); SetWindowPos(hStatusToolbar, GetDlgItem(hMainDialog, IDCANCEL), x, y, width, height, 0); ShowWindow(hStatusToolbar, SW_SHOWNORMAL); } ",0 "_bus_service_find_owner_link (BusService *service, DBusConnection *connection) { DBusList *link; link = _dbus_list_get_first_link (&service->owners); while (link != NULL) { BusOwner *bus_owner; bus_owner = (BusOwner *) link->data; if (bus_owner->conn == connection) break; link = _dbus_list_get_next_link (&service->owners, link); } return link; } ",0 "static DictionaryValue* CreateTaskGroupValue(const TaskManagerModel* tm, const int group_index) { DictionaryValue* val = new DictionaryValue(); const int group_count = tm->GroupCount(); if (group_index >= group_count) return val; int index = tm->GetResourceIndexForGroup(group_index, 0); std::pair group_range; group_range = tm->GetGroupRangeForResource(index); int length = group_range.second; val->SetInteger(""index"", index); val->SetBoolean(""isBackgroundResource"", tm->IsBackgroundResource(index)); CreateGroupColumnList(tm, ""type"", index, 1, val); CreateGroupColumnList(tm, ""processId"", index, 1, val); CreateGroupColumnList(tm, ""processIdValue"", index, 1, val); CreateGroupColumnList(tm, ""cpuUsage"", index, 1, val); CreateGroupColumnList(tm, ""cpuUsageValue"", index, 1, val); CreateGroupColumnList(tm, ""physicalMemory"", index, 1, val); CreateGroupColumnList(tm, ""physicalMemoryValue"", index, 1, val); CreateGroupColumnList(tm, ""sharedMemory"", index, 1, val); CreateGroupColumnList(tm, ""sharedMemoryValue"", index, 1, val); CreateGroupColumnList(tm, ""privateMemory"", index, 1, val); CreateGroupColumnList(tm, ""privateMemoryValue"", index, 1, val); CreateGroupColumnList(tm, ""webCoreImageCacheSize"", index, 1, val); CreateGroupColumnList(tm, ""webCoreImageCacheSizeValue"", index, 1, val); CreateGroupColumnList(tm, ""webCoreScriptsCacheSize"", index, 1, val); CreateGroupColumnList(tm, ""webCoreScriptsCacheSizeValue"", index, 1, val); CreateGroupColumnList(tm, ""webCoreCSSCacheSize"", index, 1, val); CreateGroupColumnList(tm, ""webCoreCSSCacheSizeValue"", index, 1, val); CreateGroupColumnList(tm, ""sqliteMemoryUsed"", index, 1, val); CreateGroupColumnList(tm, ""sqliteMemoryUsedValue"", index, 1, val); CreateGroupColumnList(tm, ""v8MemoryAllocatedSize"", index, 1, val); CreateGroupColumnList(tm, ""v8MemoryAllocatedSizeValue"", index, 1, val); CreateGroupColumnList(tm, ""uniqueId"", index, length, val); CreateGroupColumnList(tm, ""icon"", index, length, val); CreateGroupColumnList(tm, ""title"", index, length, val); CreateGroupColumnList(tm, ""profileName"", index, length, val); CreateGroupColumnList(tm, ""networkUsage"", index, length, val); CreateGroupColumnList(tm, ""networkUsageValue"", index, length, val); CreateGroupColumnList(tm, ""fps"", index, length, val); CreateGroupColumnList(tm, ""fpsValue"", index, length, val); CreateGroupColumnList(tm, ""goatsTeleported"", index, length, val); CreateGroupColumnList(tm, ""goatsTeleportedValue"", index, length, val); CreateGroupColumnList(tm, ""canInspect"", index, length, val); CreateGroupColumnList(tm, ""canActivate"", index, length, val); return val; } ",0 "static int wddx_stack_destroy(wddx_stack *stack) { register int i; if (stack->elements) { for (i = 0; i < stack->top; i++) { if (Z_TYPE(((st_entry *)stack->elements[i])->data) != IS_UNDEF && ((st_entry *)stack->elements[i])->type != ST_FIELD) { zval_ptr_dtor(&((st_entry *)stack->elements[i])->data); } if (((st_entry *)stack->elements[i])->varname) { efree(((st_entry *)stack->elements[i])->varname); } efree(stack->elements[i]); } efree(stack->elements); } return SUCCESS; } ",0 "static void serial_unlink_irq_chain(struct mp_port *mtpt) { struct irq_info *i = irq_lists + mtpt->port.irq; if (list_empty(i->head)) { free_irq(mtpt->port.irq, i); } serial_do_unlink(i, mtpt); } ",0 "xmlParseExternalSubset(xmlParserCtxtPtr ctxt, const xmlChar *ExternalID, const xmlChar *SystemID) { xmlDetectSAX2(ctxt); GROW; if ((ctxt->encoding == NULL) && (ctxt->input->end - ctxt->input->cur >= 4)) { xmlChar start[4]; xmlCharEncoding enc; start[0] = RAW; start[1] = NXT(1); start[2] = NXT(2); start[3] = NXT(3); enc = xmlDetectCharEncoding(start, 4); if (enc != XML_CHAR_ENCODING_NONE) xmlSwitchEncoding(ctxt, enc); } if (CMP5(CUR_PTR, '<', '?', 'x', 'm', 'l')) { xmlParseTextDecl(ctxt); if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) { /* * The XML REC instructs us to stop parsing right here */ xmlHaltParser(ctxt); return; } } if (ctxt->myDoc == NULL) { ctxt->myDoc = xmlNewDoc(BAD_CAST ""1.0""); if (ctxt->myDoc == NULL) { xmlErrMemory(ctxt, ""New Doc failed""); return; } ctxt->myDoc->properties = XML_DOC_INTERNAL; } if ((ctxt->myDoc != NULL) && (ctxt->myDoc->intSubset == NULL)) xmlCreateIntSubset(ctxt->myDoc, NULL, ExternalID, SystemID); ctxt->instate = XML_PARSER_DTD; ctxt->external = 1; SKIP_BLANKS; while (((RAW == '<') && (NXT(1) == '?')) || ((RAW == '<') && (NXT(1) == '!')) || (RAW == '%')) { const xmlChar *check = CUR_PTR; unsigned int cons = ctxt->input->consumed; GROW; if ((RAW == '<') && (NXT(1) == '!') && (NXT(2) == '[')) { xmlParseConditionalSections(ctxt); } else xmlParseMarkupDecl(ctxt); SKIP_BLANKS; if ((CUR_PTR == check) && (cons == ctxt->input->consumed)) { xmlFatalErr(ctxt, XML_ERR_EXT_SUBSET_NOT_FINISHED, NULL); break; } } if (RAW != 0) { xmlFatalErr(ctxt, XML_ERR_EXT_SUBSET_NOT_FINISHED, NULL); } } ",0 "JSON_read(int fd) { uint32_t hsize, nsize; char *str; cJSON *json = NULL; if (Nread(fd, (char*) &nsize, sizeof(nsize), Ptcp) >= 0) { hsize = ntohl(nsize); str = (char *) malloc(hsize+1); /* +1 for EOS */ if (str != NULL) { if (Nread(fd, str, hsize, Ptcp) >= 0) { str[hsize] = '\0'; /* add the EOS */ json = cJSON_Parse(str); } } free(str); } return json; } ",0 "void GLES2DecoderPassthroughImpl::VerifyServiceTextureObjectsExist() { resources_->texture_object_map.ForEach( [this](GLuint client_id, scoped_refptr texture) { DCHECK_EQ(GL_TRUE, api()->glIsTextureFn(texture->service_id())); }); } ",0 "static int in_dump(const struct audio_stream *stream, int fd) { (void)stream; (void)fd; return 0; } ",0 " static gfx::Size GetSize() { return gfx::Size(); } ",0 "R_API int is_class_interface(RBinJavaObj *bin, RBinJavaCPTypeObj *cp_obj) { RBinJavaInterfaceInfo *ifobj; RListIter *iter; int res = false; r_list_foreach (bin->interfaces_list, iter, ifobj) { if (ifobj) { res = cp_obj == ifobj->cp_class; if (res) { break; } } } return res; } ",0 "static bool StartsSingleLineCommentAt(const String& string, size_t start) { return (start + 1 < string.length() && string[start] == '/' && string[start + 1] == '/'); } ",0 "static void cm_mask_copy(u8 *dst, u8 *src, u8 *mask) { int i; for (i = 0; i < IB_CM_COMPARE_SIZE / sizeof(unsigned long); i++) ((unsigned long *) dst)[i] = ((unsigned long *) src)[i] & ((unsigned long *) mask)[i]; } ",0 "error::Error GLES2DecoderImpl::HandleBeginQueryEXT( uint32 immediate_data_size, const cmds::BeginQueryEXT& c) { GLenum target = static_cast(c.target); GLuint client_id = static_cast(c.id); int32 sync_shm_id = static_cast(c.sync_data_shm_id); uint32 sync_shm_offset = static_cast(c.sync_data_shm_offset); switch (target) { case GL_COMMANDS_ISSUED_CHROMIUM: case GL_LATENCY_QUERY_CHROMIUM: case GL_ASYNC_PIXEL_UNPACK_COMPLETED_CHROMIUM: case GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM: case GL_GET_ERROR_QUERY_CHROMIUM: break; case GL_COMMANDS_COMPLETED_CHROMIUM: if (!features().chromium_sync_query) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, ""glBeginQueryEXT"", ""not enabled for commands completed queries""); return error::kNoError; } break; default: if (!features().occlusion_query_boolean) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, ""glBeginQueryEXT"", ""not enabled for occlusion queries""); return error::kNoError; } break; } if (state_.current_queries.find(target) != state_.current_queries.end()) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, ""glBeginQueryEXT"", ""query already in progress""); return error::kNoError; } if (client_id == 0) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, ""glBeginQueryEXT"", ""id is 0""); return error::kNoError; } QueryManager::Query* query = query_manager_->GetQuery(client_id); if (!query) { if (!query_manager_->IsValidQuery(client_id)) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, ""glBeginQueryEXT"", ""id not made by glGenQueriesEXT""); return error::kNoError; } query = query_manager_->CreateQuery( target, client_id, sync_shm_id, sync_shm_offset); } if (query->target() != target) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, ""glBeginQueryEXT"", ""target does not match""); return error::kNoError; } else if (query->shm_id() != sync_shm_id || query->shm_offset() != sync_shm_offset) { DLOG(ERROR) << ""Shared memory used by query not the same as before""; return error::kInvalidArguments; } if (!query_manager_->BeginQuery(query)) { return error::kOutOfBounds; } state_.current_queries[target] = query; return error::kNoError; } ",0 "static void mpol_rebind_policy(struct mempolicy *pol, const nodemask_t *newmask, enum mpol_rebind_step step) { if (!pol) return; if (!mpol_store_user_nodemask(pol) && step == MPOL_REBIND_ONCE && nodes_equal(pol->w.cpuset_mems_allowed, *newmask)) return; if (step == MPOL_REBIND_STEP1 && (pol->flags & MPOL_F_REBINDING)) return; if (step == MPOL_REBIND_STEP2 && !(pol->flags & MPOL_F_REBINDING)) BUG(); if (step == MPOL_REBIND_STEP1) pol->flags |= MPOL_F_REBINDING; else if (step == MPOL_REBIND_STEP2) pol->flags &= ~MPOL_F_REBINDING; else if (step >= MPOL_REBIND_NSTEP) BUG(); mpol_ops[pol->mode].rebind(pol, newmask, step); } ",0 "MagickExport MagickBooleanType SetQuantumDepth(const Image *image, QuantumInfo *quantum_info,const size_t depth) { size_t extent, quantum; /* Allocate the quantum pixel buffer. */ assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"",image->filename); assert(quantum_info != (QuantumInfo *) NULL); assert(quantum_info->signature == MagickCoreSignature); quantum_info->depth=depth; if (quantum_info->format == FloatingPointQuantumFormat) { if (quantum_info->depth > 32) quantum_info->depth=64; else if (quantum_info->depth > 16) quantum_info->depth=32; else quantum_info->depth=16; } if (quantum_info->pixels != (unsigned char **) NULL) DestroyQuantumPixels(quantum_info); quantum=(quantum_info->pad+6)*(quantum_info->depth+7)/8; extent=image->columns*quantum; if ((image->columns != 0) && (quantum != (extent/image->columns))) return(MagickFalse); return(AcquireQuantumPixels(quantum_info,extent)); } ",1 "xscale2_pmnc_counter_has_overflowed(unsigned long of_flags, enum xscale_counters counter) { int ret = 0; switch (counter) { case XSCALE_CYCLE_COUNTER: ret = of_flags & XSCALE2_CCOUNT_OVERFLOW; break; case XSCALE_COUNTER0: ret = of_flags & XSCALE2_COUNT0_OVERFLOW; break; case XSCALE_COUNTER1: ret = of_flags & XSCALE2_COUNT1_OVERFLOW; break; case XSCALE_COUNTER2: ret = of_flags & XSCALE2_COUNT2_OVERFLOW; break; case XSCALE_COUNTER3: ret = of_flags & XSCALE2_COUNT3_OVERFLOW; break; default: WARN_ONCE(1, ""invalid counter number (%d)\n"", counter); } return ret; } ",0 "file_free(struct xar_file *file) { struct xattr *xattr; archive_string_free(&(file->pathname)); archive_string_free(&(file->symlink)); archive_string_free(&(file->uname)); archive_string_free(&(file->gname)); archive_string_free(&(file->hardlink)); xattr = file->xattr_list; while (xattr != NULL) { struct xattr *next; next = xattr->next; xattr_free(xattr); xattr = next; } free(file); } ",0 "const std::set AXTree::GetAllChildTreeIds() const { std::set result; for (auto entry : child_tree_id_reverse_map_) result.insert(entry.first); return result; } ",0 "status_t StreamingProcessor::incrementStreamingIds() { ATRACE_CALL(); Mutex::Autolock m(mMutex); mPreviewRequestId++; if (mPreviewRequestId >= Camera2Client::kPreviewRequestIdEnd) { mPreviewRequestId = Camera2Client::kPreviewRequestIdStart; } mRecordingRequestId++; if (mRecordingRequestId >= Camera2Client::kRecordingRequestIdEnd) { mRecordingRequestId = Camera2Client::kRecordingRequestIdStart; } return OK; } ",0 "sms_error_handler (SmsConn conn, Bool swap, int offending_minor_opcode, unsigned long offending_sequence_num, int error_class, int severity, IcePointer values) { g_debug (""GsmXsmpServer: sms_error_handler (%p, %s, %d, %lx, %d, %d)"", conn, swap ? ""TRUE"" : ""FALSE"", offending_minor_opcode, offending_sequence_num, error_class, severity); /* We don't need to do anything here; if the connection needs to be * closed, libSM will do that itself. */ } ",0 "__imlib_generic_render(DATA32 * src, int jump, int w, int h, int dx, int dy, XImage * xim, Visual * v, Context * ct) { int x, y, hh; unsigned int r, g, b, val; unsigned int rmask, gmask, bmask; int i, rshift, gshift, bshift; static const DATA8 _dither_88[8][8] = { {0, 32, 8, 40, 2, 34, 10, 42}, {48, 16, 56, 24, 50, 18, 58, 26}, {12, 44, 4, 36, 14, 46, 6, 38}, {60, 28, 52, 20, 62, 30, 54, 22}, {3, 35, 11, 43, 1, 33, 9, 41}, {51, 19, 59, 27, 49, 17, 57, 25}, {15, 47, 7, 39, 13, 45, 5, 37}, {63, 31, 55, 23, 61, 29, 53, 21} }; if (xim->depth == 1) { hh = dy + h; for (y = dy; y < hh; y++) { for (x = dx; x < w; x++) { r = R_VAL(src); g = G_VAL(src); b = B_VAL(src); val = (R_VAL(src) + G_VAL(src) + B_VAL(src)) / 12; if (val > _dither_88[x & 0x3][y & 0x3]) val = ct->palette[1]; else val = ct->palette[0]; XPutPixel(xim, x, y, val); src++; } } return; } rmask = xim->red_mask; gmask = xim->green_mask; bmask = xim->blue_mask; rshift = 0; gshift = 0; bshift = 0; for (i = 31; i >= 0; i--) { if (rmask >= (1U << i)) { rshift = i - 7; break; } } for (i = 31; i >= 0; i--) { if (gmask >= (1U << i)) { gshift = i - 7; break; } } for (i = 31; i >= 0; i--) { if (bmask >= (1U << i)) { bshift = i - 7; break; } } hh = dy + h; for (y = dy; y < hh; y++) { for (x = dx; x < w; x++) { r = R_VAL(src); if (rshift >= 0) val = ((r << rshift) & rmask); else val = ((r >> (-rshift)) & rmask); g = G_VAL(src); if (gshift >= 0) val |= ((g << gshift) & gmask); else val |= ((g >> (-gshift)) & gmask); b = B_VAL(src); if (bshift >= 0) val |= ((b << bshift) & bmask); else val |= ((b >> (-bshift)) & bmask); XPutPixel(xim, x, y, val); src++; } } } ",0 "void AutocompleteEditModel::OnPopupDataChanged( const string16& text, GURL* destination_for_temporary_text_change, const string16& keyword, bool is_keyword_hint) { bool keyword_state_changed = (keyword_ != keyword) || ((is_keyword_hint_ != is_keyword_hint) && !keyword.empty()); if (keyword_state_changed) { keyword_ = keyword; is_keyword_hint_ = is_keyword_hint; DCHECK(!keyword_.empty() || !is_keyword_hint_); } if (destination_for_temporary_text_change != NULL) { const bool save_original_selection = !has_temporary_text_; if (save_original_selection) { has_temporary_text_ = true; original_url_ = *destination_for_temporary_text_change; inline_autocomplete_text_.clear(); } if (control_key_state_ == DOWN_WITHOUT_CHANGE) { control_key_state_ = DOWN_WITH_CHANGE; } view_->OnTemporaryTextMaybeChanged(DisplayTextFromUserText(text), save_original_selection); return; } bool call_controller_onchanged = true; inline_autocomplete_text_ = text; if (view_->OnInlineAutocompleteTextMaybeChanged( DisplayTextFromUserText(user_text_ + inline_autocomplete_text_), DisplayTextFromUserText(user_text_).length())) call_controller_onchanged = false; if (has_temporary_text_) { RevertTemporaryText(false); call_controller_onchanged = false; } if (call_controller_onchanged) OnChanged(); } ",0 "cmsBool CheckEOLN(cmsIT8* it8) { if (!Check(it8, SEOLN, ""Expected separator"")) return FALSE; while (it8 -> sy == SEOLN) InSymbol(it8); return TRUE; } ",0 "static TcpSession *StreamTcpNewSession (Packet *p, int id) { TcpSession *ssn = (TcpSession *)p->flow->protoctx; if (ssn == NULL) { p->flow->protoctx = PoolThreadGetById(ssn_pool, id); #ifdef DEBUG SCMutexLock(&ssn_pool_mutex); if (p->flow->protoctx != NULL) ssn_pool_cnt++; SCMutexUnlock(&ssn_pool_mutex); #endif ssn = (TcpSession *)p->flow->protoctx; if (ssn == NULL) { SCLogDebug(""ssn_pool is empty""); return NULL; } ssn->state = TCP_NONE; ssn->reassembly_depth = stream_config.reassembly_depth; ssn->tcp_packet_flags = p->tcph ? p->tcph->th_flags : 0; ssn->server.flags = stream_config.stream_init_flags; ssn->client.flags = stream_config.stream_init_flags; StreamingBuffer x = STREAMING_BUFFER_INITIALIZER(&stream_config.sbcnf); ssn->client.sb = x; ssn->server.sb = x; if (PKT_IS_TOSERVER(p)) { ssn->client.tcp_flags = p->tcph ? p->tcph->th_flags : 0; ssn->server.tcp_flags = 0; } else if (PKT_IS_TOCLIENT(p)) { ssn->server.tcp_flags = p->tcph ? p->tcph->th_flags : 0; ssn->client.tcp_flags = 0; } } return ssn; } ",0 "EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionConditionalMethod3(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) return throwVMTypeError(exec); JSTestObj* castedThis = jsCast(asObject(thisValue)); ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info); TestObj* impl = static_cast(castedThis->impl()); impl->conditionalMethod3(); return JSValue::encode(jsUndefined()); } ",0 "static Image *ReadMIFFImage(const ImageInfo *image_info, ExceptionInfo *exception) { #define BZipMaxExtent(x) ((x)+((x)/100)+600) #define LZMAMaxExtent(x) ((x)+((x)/3)+128) #define ZipMaxExtent(x) ((x)+(((x)+7) >> 3)+(((x)+63) >> 6)+11) #if defined(MAGICKCORE_BZLIB_DELEGATE) bz_stream bzip_info; #endif char id[MaxTextExtent], keyword[MaxTextExtent], *options; const unsigned char *p; double version; GeometryInfo geometry_info; Image *image; IndexPacket index; int c; LinkedListInfo *profiles; #if defined(MAGICKCORE_LZMA_DELEGATE) lzma_stream initialize_lzma = LZMA_STREAM_INIT, lzma_info; lzma_allocator allocator; #endif MagickBooleanType status; MagickStatusType flags; PixelPacket pixel; QuantumFormatType quantum_format; QuantumInfo *quantum_info; QuantumType quantum_type; register ssize_t i; size_t length, packet_size; ssize_t count; unsigned char *compress_pixels, *pixels; size_t colors; ssize_t y; #if defined(MAGICKCORE_ZLIB_DELEGATE) z_stream zip_info; #endif /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickSignature); image=AcquireImage(image_info); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } /* Decode image header; header terminates one character beyond a ':'. */ c=ReadBlobByte(image); if (c == EOF) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); *id='\0'; (void) ResetMagickMemory(keyword,0,sizeof(keyword)); version=0.0; (void) version; do { /* Decode image header; header terminates one character beyond a ':'. */ length=MaxTextExtent; options=AcquireString((char *) NULL); quantum_format=UndefinedQuantumFormat; profiles=(LinkedListInfo *) NULL; colors=0; image->depth=8UL; image->compression=NoCompression; while ((isgraph(c) != MagickFalse) && (c != (int) ':')) { register char *p; if (c == (int) '{') { char *comment; /* Read comment-- any text between { }. */ length=MaxTextExtent; comment=AcquireString((char *) NULL); for (p=comment; comment != (char *) NULL; p++) { c=ReadBlobByte(image); if (c == (int) '\\') c=ReadBlobByte(image); else if ((c == EOF) || (c == (int) '}')) break; if ((size_t) (p-comment+1) >= length) { *p='\0'; length<<=1; comment=(char *) ResizeQuantumMemory(comment,length+ MaxTextExtent,sizeof(*comment)); if (comment == (char *) NULL) break; p=comment+strlen(comment); } *p=(char) c; } if (comment == (char *) NULL) ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); *p='\0'; (void) SetImageProperty(image,""comment"",comment); comment=DestroyString(comment); c=ReadBlobByte(image); } else if (isalnum(c) != MagickFalse) { /* Get the keyword. */ p=keyword; do { if (c == (int) '=') break; if ((size_t) (p-keyword) < (MaxTextExtent-1)) *p++=(char) c; c=ReadBlobByte(image); } while (c != EOF); *p='\0'; p=options; while ((isspace((int) ((unsigned char) c)) != 0) && (c != EOF)) c=ReadBlobByte(image); if (c == (int) '=') { /* Get the keyword value. */ c=ReadBlobByte(image); while ((c != (int) '}') && (c != EOF)) { if ((size_t) (p-options+1) >= length) { *p='\0'; length<<=1; options=(char *) ResizeQuantumMemory(options,length+ MaxTextExtent,sizeof(*options)); if (options == (char *) NULL) break; p=options+strlen(options); } if (options == (char *) NULL) ThrowReaderException(ResourceLimitError, ""MemoryAllocationFailed""); *p++=(char) c; c=ReadBlobByte(image); if (c == '\\') { c=ReadBlobByte(image); if (c == (int) '}') { *p++=(char) c; c=ReadBlobByte(image); } } if (*options != '{') if (isspace((int) ((unsigned char) c)) != 0) break; } } *p='\0'; if (*options == '{') (void) CopyMagickString(options,options+1,strlen(options)); /* Assign a value to the specified keyword. */ switch (*keyword) { case 'b': case 'B': { if (LocaleCompare(keyword,""background-color"") == 0) { (void) QueryColorDatabase(options,&image->background_color, exception); break; } if (LocaleCompare(keyword,""blue-primary"") == 0) { flags=ParseGeometry(options,&geometry_info); image->chromaticity.blue_primary.x=geometry_info.rho; image->chromaticity.blue_primary.y=geometry_info.sigma; if ((flags & SigmaValue) == 0) image->chromaticity.blue_primary.y= image->chromaticity.blue_primary.x; break; } if (LocaleCompare(keyword,""border-color"") == 0) { (void) QueryColorDatabase(options,&image->border_color, exception); break; } (void) SetImageProperty(image,keyword,options); break; } case 'c': case 'C': { if (LocaleCompare(keyword,""class"") == 0) { ssize_t storage_class; storage_class=ParseCommandOption(MagickClassOptions, MagickFalse,options); if (storage_class < 0) break; image->storage_class=(ClassType) storage_class; break; } if (LocaleCompare(keyword,""colors"") == 0) { colors=StringToUnsignedLong(options); break; } if (LocaleCompare(keyword,""colorspace"") == 0) { ssize_t colorspace; colorspace=ParseCommandOption(MagickColorspaceOptions, MagickFalse,options); if (colorspace < 0) break; image->colorspace=(ColorspaceType) colorspace; break; } if (LocaleCompare(keyword,""compression"") == 0) { ssize_t compression; compression=ParseCommandOption(MagickCompressOptions, MagickFalse,options); if (compression < 0) break; image->compression=(CompressionType) compression; break; } if (LocaleCompare(keyword,""columns"") == 0) { image->columns=StringToUnsignedLong(options); break; } (void) SetImageProperty(image,keyword,options); break; } case 'd': case 'D': { if (LocaleCompare(keyword,""delay"") == 0) { image->delay=StringToUnsignedLong(options); break; } if (LocaleCompare(keyword,""depth"") == 0) { image->depth=StringToUnsignedLong(options); break; } if (LocaleCompare(keyword,""dispose"") == 0) { ssize_t dispose; dispose=ParseCommandOption(MagickDisposeOptions,MagickFalse, options); if (dispose < 0) break; image->dispose=(DisposeType) dispose; break; } (void) SetImageProperty(image,keyword,options); break; } case 'e': case 'E': { if (LocaleCompare(keyword,""endian"") == 0) { ssize_t endian; endian=ParseCommandOption(MagickEndianOptions,MagickFalse, options); if (endian < 0) break; image->endian=(EndianType) endian; break; } (void) SetImageProperty(image,keyword,options); break; } case 'g': case 'G': { if (LocaleCompare(keyword,""gamma"") == 0) { image->gamma=StringToDouble(options,(char **) NULL); break; } if (LocaleCompare(keyword,""gravity"") == 0) { ssize_t gravity; gravity=ParseCommandOption(MagickGravityOptions,MagickFalse, options); if (gravity < 0) break; image->gravity=(GravityType) gravity; break; } if (LocaleCompare(keyword,""green-primary"") == 0) { flags=ParseGeometry(options,&geometry_info); image->chromaticity.green_primary.x=geometry_info.rho; image->chromaticity.green_primary.y=geometry_info.sigma; if ((flags & SigmaValue) == 0) image->chromaticity.green_primary.y= image->chromaticity.green_primary.x; break; } (void) SetImageProperty(image,keyword,options); break; } case 'i': case 'I': { if (LocaleCompare(keyword,""id"") == 0) { (void) CopyMagickString(id,options,MaxTextExtent); break; } if (LocaleCompare(keyword,""iterations"") == 0) { image->iterations=StringToUnsignedLong(options); break; } (void) SetImageProperty(image,keyword,options); break; } case 'm': case 'M': { if (LocaleCompare(keyword,""matte"") == 0) { ssize_t matte; matte=ParseCommandOption(MagickBooleanOptions,MagickFalse, options); if (matte < 0) break; image->matte=(MagickBooleanType) matte; break; } if (LocaleCompare(keyword,""matte-color"") == 0) { (void) QueryColorDatabase(options,&image->matte_color, exception); break; } if (LocaleCompare(keyword,""montage"") == 0) { (void) CloneString(&image->montage,options); break; } (void) SetImageProperty(image,keyword,options); break; } case 'o': case 'O': { if (LocaleCompare(keyword,""opaque"") == 0) { ssize_t matte; matte=ParseCommandOption(MagickBooleanOptions,MagickFalse, options); if (matte < 0) break; image->matte=(MagickBooleanType) matte; break; } if (LocaleCompare(keyword,""orientation"") == 0) { ssize_t orientation; orientation=ParseCommandOption(MagickOrientationOptions, MagickFalse,options); if (orientation < 0) break; image->orientation=(OrientationType) orientation; break; } (void) SetImageProperty(image,keyword,options); break; } case 'p': case 'P': { if (LocaleCompare(keyword,""page"") == 0) { char *geometry; geometry=GetPageGeometry(options); (void) ParseAbsoluteGeometry(geometry,&image->page); geometry=DestroyString(geometry); break; } if (LocaleCompare(keyword,""pixel-intensity"") == 0) { ssize_t intensity; intensity=ParseCommandOption(MagickPixelIntensityOptions, MagickFalse,options); if (intensity < 0) break; image->intensity=(PixelIntensityMethod) intensity; break; } if ((LocaleNCompare(keyword,""profile:"",8) == 0) || (LocaleNCompare(keyword,""profile-"",8) == 0)) { StringInfo *profile; if (profiles == (LinkedListInfo *) NULL) profiles=NewLinkedList(0); (void) AppendValueToLinkedList(profiles, AcquireString(keyword+8)); profile=BlobToStringInfo((const void *) NULL,(size_t) StringToLong(options)); if (profile == (StringInfo *) NULL) ThrowReaderException(ResourceLimitError, ""MemoryAllocationFailed""); (void) SetImageProfile(image,keyword+8,profile); profile=DestroyStringInfo(profile); break; } (void) SetImageProperty(image,keyword,options); break; } case 'q': case 'Q': { if (LocaleCompare(keyword,""quality"") == 0) { image->quality=StringToUnsignedLong(options); break; } if ((LocaleCompare(keyword,""quantum-format"") == 0) || (LocaleCompare(keyword,""quantum:format"") == 0)) { ssize_t format; format=ParseCommandOption(MagickQuantumFormatOptions, MagickFalse,options); if (format < 0) break; quantum_format=(QuantumFormatType) format; break; } (void) SetImageProperty(image,keyword,options); break; } case 'r': case 'R': { if (LocaleCompare(keyword,""red-primary"") == 0) { flags=ParseGeometry(options,&geometry_info); image->chromaticity.red_primary.x=geometry_info.rho; image->chromaticity.red_primary.y=geometry_info.sigma; if ((flags & SigmaValue) == 0) image->chromaticity.red_primary.y= image->chromaticity.red_primary.x; break; } if (LocaleCompare(keyword,""rendering-intent"") == 0) { ssize_t rendering_intent; rendering_intent=ParseCommandOption(MagickIntentOptions, MagickFalse,options); if (rendering_intent < 0) break; image->rendering_intent=(RenderingIntent) rendering_intent; break; } if (LocaleCompare(keyword,""resolution"") == 0) { flags=ParseGeometry(options,&geometry_info); image->x_resolution=geometry_info.rho; image->y_resolution=geometry_info.sigma; if ((flags & SigmaValue) == 0) image->y_resolution=image->x_resolution; break; } if (LocaleCompare(keyword,""rows"") == 0) { image->rows=StringToUnsignedLong(options); break; } (void) SetImageProperty(image,keyword,options); break; } case 's': case 'S': { if (LocaleCompare(keyword,""scene"") == 0) { image->scene=StringToUnsignedLong(options); break; } (void) SetImageProperty(image,keyword,options); break; } case 't': case 'T': { if (LocaleCompare(keyword,""ticks-per-second"") == 0) { image->ticks_per_second=(ssize_t) StringToLong(options); break; } if (LocaleCompare(keyword,""tile-offset"") == 0) { char *geometry; geometry=GetPageGeometry(options); (void) ParseAbsoluteGeometry(geometry,&image->tile_offset); geometry=DestroyString(geometry); break; } if (LocaleCompare(keyword,""type"") == 0) { ssize_t type; type=ParseCommandOption(MagickTypeOptions,MagickFalse, options); if (type < 0) break; image->type=(ImageType) type; break; } (void) SetImageProperty(image,keyword,options); break; } case 'u': case 'U': { if (LocaleCompare(keyword,""units"") == 0) { ssize_t units; units=ParseCommandOption(MagickResolutionOptions, MagickFalse,options); if (units < 0) break; image->units=(ResolutionType) units; break; } (void) SetImageProperty(image,keyword,options); break; } case 'v': case 'V': { if (LocaleCompare(keyword,""version"") == 0) { version=StringToDouble(options,(char **) NULL); break; } (void) SetImageProperty(image,keyword,options); break; } case 'w': case 'W': { if (LocaleCompare(keyword,""white-point"") == 0) { flags=ParseGeometry(options,&geometry_info); image->chromaticity.white_point.x=geometry_info.rho; image->chromaticity.white_point.y=geometry_info.sigma; if ((flags & SigmaValue) == 0) image->chromaticity.white_point.y= image->chromaticity.white_point.x; break; } (void) SetImageProperty(image,keyword,options); break; } default: { (void) SetImageProperty(image,keyword,options); break; } } } else c=ReadBlobByte(image); while (isspace((int) ((unsigned char) c)) != 0) c=ReadBlobByte(image); } options=DestroyString(options); (void) ReadBlobByte(image); /* Verify that required image information is defined. */ if ((LocaleCompare(id,""ImageMagick"") != 0) || (image->storage_class == UndefinedClass) || (image->columns == 0) || (image->rows == 0)) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); if (image->montage != (char *) NULL) { register char *p; /* Image directory. */ length=MaxTextExtent; image->directory=AcquireString((char *) NULL); p=image->directory; do { *p='\0'; if ((strlen(image->directory)+MaxTextExtent) >= length) { /* Allocate more memory for the image directory. */ length<<=1; image->directory=(char *) ResizeQuantumMemory(image->directory, length+MaxTextExtent,sizeof(*image->directory)); if (image->directory == (char *) NULL) ThrowReaderException(CorruptImageError,""UnableToReadImageData""); p=image->directory+strlen(image->directory); } c=ReadBlobByte(image); *p++=(char) c; } while (c != (int) '\0'); } if (profiles != (LinkedListInfo *) NULL) { const char *name; const StringInfo *profile; /* Read image profiles. */ ResetLinkedListIterator(profiles); name=(const char *) GetNextValueInLinkedList(profiles); while (name != (const char *) NULL) { profile=GetImageProfile(image,name); if (profile != (StringInfo *) NULL) { register unsigned char *p; p=GetStringInfoDatum(profile); count=ReadBlob(image,GetStringInfoLength(profile),p); (void) count; } name=(const char *) GetNextValueInLinkedList(profiles); } profiles=DestroyLinkedList(profiles,RelinquishMagickMemory); } image->depth=GetImageQuantumDepth(image,MagickFalse); if (image->storage_class == PseudoClass) { /* Create image colormap. */ status=AcquireImageColormap(image,colors != 0 ? colors : 256); if (status == MagickFalse) ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); if (colors != 0) { size_t packet_size; unsigned char *colormap; /* Read image colormap from file. */ packet_size=(size_t) (3UL*image->depth/8UL); colormap=(unsigned char *) AcquireQuantumMemory(image->colors, packet_size*sizeof(*colormap)); if (colormap == (unsigned char *) NULL) ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); count=ReadBlob(image,packet_size*image->colors,colormap); p=colormap; switch (image->depth) { default: ThrowReaderException(CorruptImageError, ""ImageDepthNotSupported""); case 8: { unsigned char pixel; for (i=0; i < (ssize_t) image->colors; i++) { p=PushCharPixel(p,&pixel); image->colormap[i].red=ScaleCharToQuantum(pixel); p=PushCharPixel(p,&pixel); image->colormap[i].green=ScaleCharToQuantum(pixel); p=PushCharPixel(p,&pixel); image->colormap[i].blue=ScaleCharToQuantum(pixel); } break; } case 16: { unsigned short pixel; for (i=0; i < (ssize_t) image->colors; i++) { p=PushShortPixel(MSBEndian,p,&pixel); image->colormap[i].red=ScaleShortToQuantum(pixel); p=PushShortPixel(MSBEndian,p,&pixel); image->colormap[i].green=ScaleShortToQuantum(pixel); p=PushShortPixel(MSBEndian,p,&pixel); image->colormap[i].blue=ScaleShortToQuantum(pixel); } break; } case 32: { unsigned int pixel; for (i=0; i < (ssize_t) image->colors; i++) { p=PushLongPixel(MSBEndian,p,&pixel); image->colormap[i].red=ScaleLongToQuantum(pixel); p=PushLongPixel(MSBEndian,p,&pixel); image->colormap[i].green=ScaleLongToQuantum(pixel); p=PushLongPixel(MSBEndian,p,&pixel); image->colormap[i].blue=ScaleLongToQuantum(pixel); } break; } } colormap=(unsigned char *) RelinquishMagickMemory(colormap); } } if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0)) if (image->scene >= (image_info->scene+image_info->number_scenes-1)) break; /* Allocate image pixels. */ quantum_info=AcquireQuantumInfo(image_info,image); if (quantum_info == (QuantumInfo *) NULL) ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); if (quantum_format != UndefinedQuantumFormat) { status=SetQuantumFormat(image,quantum_info,quantum_format); if (status == MagickFalse) ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); } packet_size=(size_t) (quantum_info->depth/8); if (image->storage_class == DirectClass) packet_size=(size_t) (3*quantum_info->depth/8); if (IsGrayColorspace(image->colorspace) != MagickFalse) packet_size=quantum_info->depth/8; if (image->matte != MagickFalse) packet_size+=quantum_info->depth/8; if (image->colorspace == CMYKColorspace) packet_size+=quantum_info->depth/8; if (image->compression == RLECompression) packet_size++; length=image->columns; length=MagickMax(MagickMax(BZipMaxExtent(packet_size*image->columns), LZMAMaxExtent(packet_size*image->columns)),ZipMaxExtent(packet_size* image->columns)); compress_pixels=(unsigned char *) AcquireQuantumMemory(length, sizeof(*compress_pixels)); if (compress_pixels == (unsigned char *) NULL) ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); /* Read image pixels. */ quantum_type=RGBQuantum; if (image->matte != MagickFalse) quantum_type=RGBAQuantum; if (image->colorspace == CMYKColorspace) { quantum_type=CMYKQuantum; if (image->matte != MagickFalse) quantum_type=CMYKAQuantum; } if (IsGrayColorspace(image->colorspace) != MagickFalse) { quantum_type=GrayQuantum; if (image->matte != MagickFalse) quantum_type=GrayAlphaQuantum; } if (image->storage_class == PseudoClass) { quantum_type=IndexQuantum; if (image->matte != MagickFalse) quantum_type=IndexAlphaQuantum; } status=MagickTrue; (void) ResetMagickMemory(&pixel,0,sizeof(pixel)); #if defined(MAGICKCORE_BZLIB_DELEGATE) (void) ResetMagickMemory(&bzip_info,0,sizeof(bzip_info)); #endif #if defined(MAGICKCORE_LZMA_DELEGATE) (void) ResetMagickMemory(&allocator,0,sizeof(allocator)); #endif #if defined(MAGICKCORE_ZLIB_DELEGATE) (void) ResetMagickMemory(&zip_info,0,sizeof(zip_info)); #endif switch (image->compression) { #if defined(MAGICKCORE_BZLIB_DELEGATE) case BZipCompression: { int code; bzip_info.bzalloc=AcquireBZIPMemory; bzip_info.bzfree=RelinquishBZIPMemory; bzip_info.opaque=(void *) NULL; code=BZ2_bzDecompressInit(&bzip_info,(int) image_info->verbose, MagickFalse); if (code != BZ_OK) status=MagickFalse; break; } #endif #if defined(MAGICKCORE_LZMA_DELEGATE) case LZMACompression: { int code; allocator.alloc=AcquireLZMAMemory; allocator.free=RelinquishLZMAMemory; lzma_info=initialize_lzma; lzma_info.allocator=(&allocator); (void) ResetMagickMemory(&allocator,0,sizeof(allocator)); allocator.alloc=AcquireLZMAMemory; allocator.free=RelinquishLZMAMemory; lzma_info=initialize_lzma; lzma_info.allocator=(&allocator); code=lzma_auto_decoder(&lzma_info,-1,0); if (code != LZMA_OK) status=MagickFalse; break; } #endif #if defined(MAGICKCORE_ZLIB_DELEGATE) case LZWCompression: case ZipCompression: { int code; zip_info.zalloc=AcquireZIPMemory; zip_info.zfree=RelinquishZIPMemory; zip_info.opaque=(voidpf) NULL; code=inflateInit(&zip_info); if (code != Z_OK) status=MagickFalse; break; } #endif case RLECompression: { pixel.opacity=(Quantum) TransparentOpacity; index=(IndexPacket) 0; break; } default: break; } pixels=GetQuantumPixels(quantum_info); index=(IndexPacket) 0; length=0; for (y=0; y < (ssize_t) image->rows; y++) { register IndexPacket *restrict indexes; register ssize_t x; register PixelPacket *restrict q; if (status == MagickFalse) break; q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (PixelPacket *) NULL) break; indexes=GetAuthenticIndexQueue(image); switch (image->compression) { #if defined(MAGICKCORE_BZLIB_DELEGATE) case BZipCompression: { bzip_info.next_out=(char *) pixels; bzip_info.avail_out=(unsigned int) (packet_size*image->columns); do { if (bzip_info.avail_in == 0) { bzip_info.next_in=(char *) compress_pixels; length=(size_t) BZipMaxExtent(packet_size*image->columns); if (version != 0.0) length=(size_t) ReadBlobMSBLong(image); bzip_info.avail_in=(unsigned int) ReadBlob(image,length, (unsigned char *) bzip_info.next_in); } if (BZ2_bzDecompress(&bzip_info) == BZ_STREAM_END) break; } while (bzip_info.avail_out != 0); (void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info, quantum_type,pixels,exception); break; } #endif #if defined(MAGICKCORE_LZMA_DELEGATE) case LZMACompression: { lzma_info.next_out=pixels; lzma_info.avail_out=packet_size*image->columns; do { int code; if (lzma_info.avail_in == 0) { lzma_info.next_in=compress_pixels; length=(size_t) ReadBlobMSBLong(image); lzma_info.avail_in=(unsigned int) ReadBlob(image,length, (unsigned char *) lzma_info.next_in); } code=lzma_code(&lzma_info,LZMA_RUN); if (code < 0) { status=MagickFalse; break; } if (code == LZMA_STREAM_END) break; } while (lzma_info.avail_out != 0); (void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info, quantum_type,pixels,exception); break; } #endif #if defined(MAGICKCORE_ZLIB_DELEGATE) case LZWCompression: case ZipCompression: { zip_info.next_out=pixels; zip_info.avail_out=(uInt) (packet_size*image->columns); do { if (zip_info.avail_in == 0) { zip_info.next_in=compress_pixels; length=(size_t) ZipMaxExtent(packet_size*image->columns); if (version != 0.0) length=(size_t) ReadBlobMSBLong(image); zip_info.avail_in=(unsigned int) ReadBlob(image,length, zip_info.next_in); } if (inflate(&zip_info,Z_SYNC_FLUSH) == Z_STREAM_END) break; } while (zip_info.avail_out != 0); (void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info, quantum_type,pixels,exception); break; } #endif case RLECompression: { for (x=0; x < (ssize_t) image->columns; x++) { if (length == 0) { count=ReadBlob(image,packet_size,pixels); PushRunlengthPacket(image,pixels,&length,&pixel,&index); } length--; if ((image->storage_class == PseudoClass) || (image->colorspace == CMYKColorspace)) SetPixelIndex(indexes+x,index); SetPixelRed(q,pixel.red); SetPixelGreen(q,pixel.green); SetPixelBlue(q,pixel.blue); SetPixelOpacity(q,pixel.opacity); q++; } break; } default: { count=ReadBlob(image,packet_size*image->columns,pixels); (void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info, quantum_type,pixels,exception); break; } } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; } SetQuantumImageType(image,quantum_type); switch (image->compression) { #if defined(MAGICKCORE_BZLIB_DELEGATE) case BZipCompression: { int code; if (version == 0.0) { MagickOffsetType offset; offset=SeekBlob(image,-((MagickOffsetType) bzip_info.avail_in), SEEK_CUR); if (offset < 0) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); } code=BZ2_bzDecompressEnd(&bzip_info); if (code != BZ_OK) status=MagickFalse; break; } #endif #if defined(MAGICKCORE_LZMA_DELEGATE) case LZMACompression: { int code; code=lzma_code(&lzma_info,LZMA_FINISH); if ((code != LZMA_STREAM_END) && (code != LZMA_OK)) status=MagickFalse; lzma_end(&lzma_info); break; } #endif #if defined(MAGICKCORE_ZLIB_DELEGATE) case LZWCompression: case ZipCompression: { int code; if (version == 0.0) { MagickOffsetType offset; offset=SeekBlob(image,-((MagickOffsetType) zip_info.avail_in), SEEK_CUR); if (offset < 0) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); } code=inflateEnd(&zip_info); if (code != LZMA_OK) status=MagickFalse; break; } #endif default: break; } quantum_info=DestroyQuantumInfo(quantum_info); compress_pixels=(unsigned char *) RelinquishMagickMemory(compress_pixels); if (((y != (ssize_t) image->rows)) || (status == MagickFalse)) { image=DestroyImageList(image); return((Image *) NULL); } if (EOFBlob(image) != MagickFalse) { ThrowFileException(exception,CorruptImageError,""UnexpectedEndOfFile"", image->filename); break; } /* Proceed to next image. */ if (image_info->number_scenes != 0) if (image->scene >= (image_info->scene+image_info->number_scenes-1)) break; do { c=ReadBlobByte(image); } while ((isgraph(c) == MagickFalse) && (c != EOF)); if (c != EOF) { /* Allocate next image structure. */ AcquireNextImage(image_info,image); if (GetNextImageInList(image) == (Image *) NULL) { image=DestroyImageList(image); return((Image *) NULL); } image=SyncNextImageInList(image); status=SetImageProgress(image,LoadImagesTag,TellBlob(image), GetBlobSize(image)); if (status == MagickFalse) break; } } while (c != EOF); (void) CloseBlob(image); return(GetFirstImageInList(image)); } ",1 "svcauth_gss_validate(struct svc_req *rqst, struct svc_rpc_gss_data *gd, struct rpc_msg *msg) { struct opaque_auth *oa; gss_buffer_desc rpcbuf, checksum; OM_uint32 maj_stat, min_stat, qop_state; u_char rpchdr[128]; int32_t *buf; log_debug(""in svcauth_gss_validate()""); memset(rpchdr, 0, sizeof(rpchdr)); /* XXX - Reconstruct RPC header for signing (from xdr_callmsg). */ oa = &msg->rm_call.cb_cred; if (oa->oa_length > MAX_AUTH_BYTES) return (FALSE); /* 8 XDR units from the IXDR macro calls. */ if (sizeof(rpchdr) < (8 * BYTES_PER_XDR_UNIT + RNDUP(oa->oa_length))) return (FALSE); buf = (int32_t *)(void *)rpchdr; IXDR_PUT_LONG(buf, msg->rm_xid); IXDR_PUT_ENUM(buf, msg->rm_direction); IXDR_PUT_LONG(buf, msg->rm_call.cb_rpcvers); IXDR_PUT_LONG(buf, msg->rm_call.cb_prog); IXDR_PUT_LONG(buf, msg->rm_call.cb_vers); IXDR_PUT_LONG(buf, msg->rm_call.cb_proc); IXDR_PUT_ENUM(buf, oa->oa_flavor); IXDR_PUT_LONG(buf, oa->oa_length); if (oa->oa_length) { memcpy((caddr_t)buf, oa->oa_base, oa->oa_length); buf += RNDUP(oa->oa_length) / sizeof(int32_t); } rpcbuf.value = rpchdr; rpcbuf.length = (u_char *)buf - rpchdr; checksum.value = msg->rm_call.cb_verf.oa_base; checksum.length = msg->rm_call.cb_verf.oa_length; maj_stat = gss_verify_mic(&min_stat, gd->ctx, &rpcbuf, &checksum, &qop_state); if (maj_stat != GSS_S_COMPLETE) { log_status(""gss_verify_mic"", maj_stat, min_stat); if (log_badverf != NULL) (*log_badverf)(gd->client_name, svcauth_gss_name, rqst, msg, log_badverf_data); return (FALSE); } return (TRUE); } ",0 "static int snd_msnd_write_cfg_io0(int cfg, int num, u16 io) { if (snd_msnd_write_cfg(cfg, IREG_LOGDEVICE, num)) return -EIO; if (snd_msnd_write_cfg(cfg, IREG_IO0_BASEHI, HIBYTE(io))) return -EIO; if (snd_msnd_write_cfg(cfg, IREG_IO0_BASELO, LOBYTE(io))) return -EIO; return 0; } ",0 "static HB_Error Load_ChainContextPos3( HB_ChainContextPosFormat3* ccpf3, HB_Stream stream ) { HB_Error error; HB_UShort n, nb, ni, nl, m, count; HB_UShort backtrack_count, input_count, lookahead_count; HB_UInt cur_offset, new_offset, base_offset; HB_Coverage* b; HB_Coverage* i; HB_Coverage* l; HB_PosLookupRecord* plr; base_offset = FILE_Pos() - 2L; if ( ACCESS_Frame( 2L ) ) return error; ccpf3->BacktrackGlyphCount = GET_UShort(); FORGET_Frame(); ccpf3->BacktrackCoverage = NULL; backtrack_count = ccpf3->BacktrackGlyphCount; if ( ALLOC_ARRAY( ccpf3->BacktrackCoverage, backtrack_count, HB_Coverage ) ) return error; b = ccpf3->BacktrackCoverage; for ( nb = 0; nb < backtrack_count; nb++ ) { if ( ACCESS_Frame( 2L ) ) goto Fail4; new_offset = GET_UShort() + base_offset; FORGET_Frame(); cur_offset = FILE_Pos(); if ( FILE_Seek( new_offset ) || ( error = _HB_OPEN_Load_Coverage( &b[nb], stream ) ) != HB_Err_Ok ) goto Fail4; (void)FILE_Seek( cur_offset ); } if ( ACCESS_Frame( 2L ) ) goto Fail4; ccpf3->InputGlyphCount = GET_UShort(); FORGET_Frame(); ccpf3->InputCoverage = NULL; input_count = ccpf3->InputGlyphCount; if ( ALLOC_ARRAY( ccpf3->InputCoverage, input_count, HB_Coverage ) ) goto Fail4; i = ccpf3->InputCoverage; for ( ni = 0; ni < input_count; ni++ ) { if ( ACCESS_Frame( 2L ) ) goto Fail3; new_offset = GET_UShort() + base_offset; FORGET_Frame(); cur_offset = FILE_Pos(); if ( FILE_Seek( new_offset ) || ( error = _HB_OPEN_Load_Coverage( &i[ni], stream ) ) != HB_Err_Ok ) goto Fail3; (void)FILE_Seek( cur_offset ); } if ( ACCESS_Frame( 2L ) ) goto Fail3; ccpf3->LookaheadGlyphCount = GET_UShort(); FORGET_Frame(); ccpf3->LookaheadCoverage = NULL; lookahead_count = ccpf3->LookaheadGlyphCount; if ( ALLOC_ARRAY( ccpf3->LookaheadCoverage, lookahead_count, HB_Coverage ) ) goto Fail3; l = ccpf3->LookaheadCoverage; for ( nl = 0; nl < lookahead_count; nl++ ) { if ( ACCESS_Frame( 2L ) ) goto Fail2; new_offset = GET_UShort() + base_offset; FORGET_Frame(); cur_offset = FILE_Pos(); if ( FILE_Seek( new_offset ) || ( error = _HB_OPEN_Load_Coverage( &l[nl], stream ) ) != HB_Err_Ok ) goto Fail2; (void)FILE_Seek( cur_offset ); } if ( ACCESS_Frame( 2L ) ) goto Fail2; ccpf3->PosCount = GET_UShort(); FORGET_Frame(); ccpf3->PosLookupRecord = NULL; count = ccpf3->PosCount; if ( ALLOC_ARRAY( ccpf3->PosLookupRecord, count, HB_PosLookupRecord ) ) goto Fail2; plr = ccpf3->PosLookupRecord; if ( ACCESS_Frame( count * 4L ) ) goto Fail1; for ( n = 0; n < count; n++ ) { plr[n].SequenceIndex = GET_UShort(); plr[n].LookupListIndex = GET_UShort(); } FORGET_Frame(); return HB_Err_Ok; Fail1: FREE( plr ); Fail2: for ( m = 0; m < nl; m++ ) _HB_OPEN_Free_Coverage( &l[m] ); FREE( l ); Fail3: for ( m = 0; m < ni; m++ ) _HB_OPEN_Free_Coverage( &i[m] ); FREE( i ); Fail4: for ( m = 0; m < nb; m++ ) _HB_OPEN_Free_Coverage( &b[m] ); FREE( b ); return error; } ",0 " void DiscardTest(DiscardReason reason) { const base::TimeTicks kDummyLastActiveTime = base::TimeTicks() + kShortDelay; LifecycleUnit* background_lifecycle_unit = nullptr; LifecycleUnit* foreground_lifecycle_unit = nullptr; CreateTwoTabs(true /* focus_tab_strip */, &background_lifecycle_unit, &foreground_lifecycle_unit); content::WebContents* initial_web_contents = tab_strip_model_->GetWebContentsAt(0); content::WebContentsTester::For(initial_web_contents) ->SetLastActiveTime(kDummyLastActiveTime); EXPECT_EQ(LifecycleUnitState::ACTIVE, background_lifecycle_unit->GetState()); EXPECT_CALL(tab_observer_, OnDiscardedStateChange(testing::_, true)); background_lifecycle_unit->Discard(reason); testing::Mock::VerifyAndClear(&tab_observer_); TransitionFromPendingDiscardToDiscardedIfNeeded(reason, background_lifecycle_unit); EXPECT_NE(initial_web_contents, tab_strip_model_->GetWebContentsAt(0)); EXPECT_FALSE(tab_strip_model_->GetWebContentsAt(0) ->GetController() .GetPendingEntry()); EXPECT_EQ(kDummyLastActiveTime, tab_strip_model_->GetWebContentsAt(0)->GetLastActiveTime()); source_->SetFocusedTabStripModelForTesting(nullptr); } ",1 "bool EnterpriseEnrollmentScreen::GetInitialUser(std::string* user) { chromeos::CryptohomeLibrary* cryptohome = chromeos::CrosLibrary::Get()->GetCryptohomeLibrary(); if (cryptohome && cryptohome->InstallAttributesIsReady() && !cryptohome->InstallAttributesIsFirstInstall()) { std::string value; if (cryptohome->InstallAttributesGet(""enterprise.owned"", &value) && value == ""true"") { if (cryptohome->InstallAttributesGet(""enterprise.user"", &value)) { *user = value; actor_->SetEditableUser(false); return true; } } LOG(ERROR) << ""Enrollment will not finish because the InstallAttrs has "" << ""been locked already but does not contain valid data.""; } return false; } ",0 "poly_same(PG_FUNCTION_ARGS) { POLYGON *polya = PG_GETARG_POLYGON_P(0); POLYGON *polyb = PG_GETARG_POLYGON_P(1); bool result; if (polya->npts != polyb->npts) result = false; else result = plist_same(polya->npts, polya->p, polyb->p); /* * Avoid leaking memory for toasted inputs ... needed for rtree indexes */ PG_FREE_IF_COPY(polya, 0); PG_FREE_IF_COPY(polyb, 1); PG_RETURN_BOOL(result); } ",0 "RenderViewTest::RenderViewTest() : view_(NULL) { } ",0 "MagickExport void *AcquireQuantumMemory(const size_t count,const size_t quantum) { size_t extent; if (CheckMemoryOverflow(count,quantum) != MagickFalse) return((void *) NULL); extent=count*quantum; return(AcquireMagickMemory(extent)); } ",1 "int ssl3_get_next_proto(SSL *s) { int ok; int proto_len, padding_len; long n; const unsigned char *p; /* Clients cannot send a NextProtocol message if we didn't see the * extension in their ClientHello */ if (!s->s3->next_proto_neg_seen) { SSLerr(SSL_F_SSL3_GET_NEXT_PROTO,SSL_R_GOT_NEXT_PROTO_WITHOUT_EXTENSION); return -1; } n=s->method->ssl_get_message(s, SSL3_ST_SR_NEXT_PROTO_A, SSL3_ST_SR_NEXT_PROTO_B, SSL3_MT_NEXT_PROTO, 514, /* See the payload format below */ &ok); if (!ok) return((int)n); /* s->state doesn't reflect whether ChangeCipherSpec has been received * in this handshake, but s->s3->change_cipher_spec does (will be reset * by ssl3_get_finished). */ if (!s->s3->change_cipher_spec) { SSLerr(SSL_F_SSL3_GET_NEXT_PROTO,SSL_R_GOT_NEXT_PROTO_BEFORE_A_CCS); return -1; } if (n < 2) return 0; /* The body must be > 1 bytes long */ p=(unsigned char *)s->init_msg; /*- * The payload looks like: * uint8 proto_len; * uint8 proto[proto_len]; * uint8 padding_len; * uint8 padding[padding_len]; */ proto_len = p[0]; if (proto_len + 2 > s->init_num) return 0; padding_len = p[proto_len + 1]; if (proto_len + padding_len + 2 != s->init_num) return 0; s->next_proto_negotiated = OPENSSL_malloc(proto_len); if (!s->next_proto_negotiated) { SSLerr(SSL_F_SSL3_GET_NEXT_PROTO,ERR_R_MALLOC_FAILURE); return 0; } memcpy(s->next_proto_negotiated, p + 1, proto_len); s->next_proto_negotiated_len = proto_len; return 1; } ",0 "void WebPluginProxy::DidPaint() { waiting_for_paint_ = false; if (!damaged_rect_.IsEmpty()) InvalidateRect(damaged_rect_); } ",0 "void WebPageSerializerImpl::endTagToString(Element* element, SerializeDomParam* param) { bool needSkip; StringBuilder result; result.append(preActionBeforeSerializeEndTag(element, param, &needSkip)); if (needSkip) return; if (element->hasChildren() || param->haveAddedContentsBeforeEnd) { result.appendLiteral(""nodeName().lower()); result.append('>'); } else { if (param->isHTMLDocument) { result.append('>'); if (!element->isHTMLElement() || !toHTMLElement(element)->ieForbidsInsertHTML()) { result.appendLiteral(""nodeName().lower()); result.append('>'); } } else { result.appendLiteral("" />""); } } result.append(postActionAfterSerializeEndTag(element, param)); saveHTMLContentToBuffer(result.toString(), param); } ",0 "void RenderThread::InformHostOfCacheStatsLater() { if (cache_stats_task_pending_) return; cache_stats_task_pending_ = true; MessageLoop::current()->PostDelayedTask(FROM_HERE, task_factory_->NewRunnableMethod( &RenderThread::InformHostOfCacheStats), kCacheStatsDelayMS); } ",0 "static int robots_fsio_fstat(pr_fh_t *fh, int fd, struct stat *st) { if (fd != AUTH_ROBOTS_TXT_FD) { errno = EINVAL; return -1; } return robots_fsio_stat(NULL, NULL, st); } ",0 "int _yr_scan_verify_re_match( YR_SCAN_CONTEXT* context, YR_AC_MATCH* ac_match, uint8_t* data, size_t data_size, size_t data_base, size_t offset) { CALLBACK_ARGS callback_args; RE_EXEC_FUNC exec; int forward_matches = -1; int backward_matches = -1; int flags = 0; if (STRING_IS_GREEDY_REGEXP(ac_match->string)) flags |= RE_FLAGS_GREEDY; if (STRING_IS_NO_CASE(ac_match->string)) flags |= RE_FLAGS_NO_CASE; if (STRING_IS_DOT_ALL(ac_match->string)) flags |= RE_FLAGS_DOT_ALL; if (STRING_IS_FAST_REGEXP(ac_match->string)) exec = yr_re_fast_exec; else exec = yr_re_exec; if (STRING_IS_ASCII(ac_match->string)) { forward_matches = exec( ac_match->forward_code, data + offset, data_size - offset, offset > 0 ? flags | RE_FLAGS_NOT_AT_START : flags, NULL, NULL); } if (STRING_IS_WIDE(ac_match->string) && forward_matches == -1) { flags |= RE_FLAGS_WIDE; forward_matches = exec( ac_match->forward_code, data + offset, data_size - offset, offset > 0 ? flags | RE_FLAGS_NOT_AT_START : flags, NULL, NULL); } switch(forward_matches) { case -1: return ERROR_SUCCESS; case -2: return ERROR_INSUFFICIENT_MEMORY; case -3: return ERROR_TOO_MANY_MATCHES; case -4: return ERROR_TOO_MANY_RE_FIBERS; case -5: return ERROR_INTERNAL_FATAL_ERROR; } if (forward_matches == 0 && ac_match->backward_code == NULL) return ERROR_SUCCESS; callback_args.string = ac_match->string; callback_args.context = context; callback_args.data = data; callback_args.data_size = data_size; callback_args.data_base = data_base; callback_args.forward_matches = forward_matches; callback_args.full_word = STRING_IS_FULL_WORD(ac_match->string); if (ac_match->backward_code != NULL) { backward_matches = exec( ac_match->backward_code, data + offset, offset, flags | RE_FLAGS_BACKWARDS | RE_FLAGS_EXHAUSTIVE, _yr_scan_match_callback, (void*) &callback_args); switch(backward_matches) { case -2: return ERROR_INSUFFICIENT_MEMORY; case -3: return ERROR_TOO_MANY_MATCHES; case -4: return ERROR_TOO_MANY_RE_FIBERS; case -5: return ERROR_INTERNAL_FATAL_ERROR; } } else { FAIL_ON_ERROR(_yr_scan_match_callback( data + offset, 0, flags, &callback_args)); } return ERROR_SUCCESS; } ",1 "void ResourceDispatcherHostImpl::UpdateLoadInfoOnUIThread( scoped_ptr info_map) { tracked_objects::ScopedTracker tracking_profile( FROM_HERE_WITH_EXPLICIT_FUNCTION( ""466285 ResourceDispatcherHostImpl::UpdateLoadInfoOnUIThread"")); DCHECK_CURRENTLY_ON(BrowserThread::UI); for (const auto& load_info : *info_map) { RenderViewHostImpl* view = RenderViewHostImpl::FromID( load_info.first.child_id, load_info.first.route_id); if (view) { view->LoadStateChanged(load_info.second.url, load_info.second.load_state, load_info.second.upload_position, load_info.second.upload_size); } } } ",0 "static int tcos_set_security_env(sc_card_t *card, const sc_security_env_t *env, int se_num) { sc_context_t *ctx; sc_apdu_t apdu; u8 sbuf[SC_MAX_APDU_BUFFER_SIZE], *p; int r, default_key, tcos3; tcos_data *data; assert(card != NULL && env != NULL); ctx = card->ctx; tcos3=(card->type==SC_CARD_TYPE_TCOS_V3); data=(tcos_data *)card->drv_data; if (se_num || (env->operation!=SC_SEC_OPERATION_DECIPHER && env->operation!=SC_SEC_OPERATION_SIGN)){ SC_FUNC_RETURN(ctx, SC_LOG_DEBUG_NORMAL, SC_ERROR_INVALID_ARGUMENTS); } if(!(env->flags & SC_SEC_ENV_KEY_REF_PRESENT)) sc_debug(ctx, SC_LOG_DEBUG_NORMAL, ""No Key-Reference in SecEnvironment\n""); else sc_debug(ctx, SC_LOG_DEBUG_NORMAL, ""Key-Reference %02X (len=%""SC_FORMAT_LEN_SIZE_T""u)\n"", env->key_ref[0], env->key_ref_len); /* Key-Reference 0x80 ?? */ default_key= !(env->flags & SC_SEC_ENV_KEY_REF_PRESENT) || (env->key_ref_len==1 && env->key_ref[0]==0x80); sc_debug(ctx, SC_LOG_DEBUG_NORMAL, ""TCOS3:%d PKCS1:%d\n"", tcos3, !!(env->algorithm_flags & SC_ALGORITHM_RSA_PAD_PKCS1)); data->pad_flags = env->algorithm_flags; data->next_sign = default_key; sc_format_apdu(card, &apdu, SC_APDU_CASE_3_SHORT, 0x22, tcos3 ? 0x41 : 0xC1, 0xB8); p = sbuf; *p++=0x80; *p++=0x01; *p++=tcos3 ? 0x0A : 0x10; if (env->flags & SC_SEC_ENV_KEY_REF_PRESENT) { *p++ = (env->flags & SC_SEC_ENV_KEY_REF_SYMMETRIC) ? 0x83 : 0x84; *p++ = env->key_ref_len; memcpy(p, env->key_ref, env->key_ref_len); p += env->key_ref_len; } apdu.data = sbuf; apdu.lc = apdu.datalen = (p - sbuf); r=sc_transmit_apdu(card, &apdu); if (r) { sc_debug(ctx, SC_LOG_DEBUG_NORMAL, ""%s: APDU transmit failed"", sc_strerror(r)); return r; } if (apdu.sw1==0x6A && (apdu.sw2==0x81 || apdu.sw2==0x88)) { sc_debug(ctx, SC_LOG_DEBUG_NORMAL, ""Detected Signature-Only key\n""); if (env->operation==SC_SEC_OPERATION_SIGN && default_key) return SC_SUCCESS; } SC_FUNC_RETURN(ctx, SC_LOG_DEBUG_VERBOSE, sc_check_sw(card, apdu.sw1, apdu.sw2)); } ",0 "void DownloadProtectionService::ShowDetailsForDownload( const content::DownloadItem& item, content::PageNavigator* navigator) { GURL learn_more_url(chrome::kDownloadScanningLearnMoreURL); learn_more_url = google_util::AppendGoogleLocaleParam( learn_more_url, g_browser_process->GetApplicationLocale()); learn_more_url = net::AppendQueryParameter( learn_more_url, ""ctx"", base::IntToString(static_cast(item.GetDangerType()))); navigator->OpenURL( content::OpenURLParams(learn_more_url, content::Referrer(), NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, false)); } ",0 "void Document::updateBaseURL() { KURL oldBaseURL = m_baseURL; if (!m_baseElementURL.isEmpty()) m_baseURL = m_baseElementURL; else if (!m_baseURLOverride.isEmpty()) m_baseURL = m_baseURLOverride; else m_baseURL = m_url; selectorQueryCache().invalidate(); if (!m_baseURL.isValid()) m_baseURL = KURL(); if (m_elemSheet) { DCHECK(!m_elemSheet->contents()->ruleCount()); m_elemSheet = CSSStyleSheet::createInline(this, m_baseURL); } if (!equalIgnoringFragmentIdentifier(oldBaseURL, m_baseURL)) { for (HTMLAnchorElement& anchor : Traversal::startsAfter(*this)) anchor.invalidateCachedVisitedLinkHash(); } } ",0 "int ptrace_put_reg(struct task_struct *task, int regno, unsigned long data) { if (task->thread.regs == NULL) return -EIO; if (regno == PT_MSR) return set_user_msr(task, data); if (regno == PT_TRAP) return set_user_trap(task, data); if (regno <= PT_MAX_PUT_REG) { ((unsigned long *)task->thread.regs)[regno] = data; return 0; } return -EIO; } ",0 "static int WM_GetOutput_Linear(midi * handle, int8_t *buffer, uint32_t size) { uint32_t buffer_used = 0; uint32_t i; struct _mdi *mdi = (struct _mdi *) handle; uint32_t real_samples_to_mix = 0; uint32_t data_pos; int32_t premix, left_mix, right_mix; struct _note *note_data = NULL; uint32_t count; struct _event *event = mdi->current_event; int32_t *tmp_buffer; int32_t *out_buffer; _WM_Lock(&mdi->lock); buffer_used = 0; memset(buffer, 0, size); if ( (size / 2) > mdi->mix_buffer_size) { if ( (size / 2) <= ( mdi->mix_buffer_size * 2 )) { mdi->mix_buffer_size += MEM_CHUNK; } else { mdi->mix_buffer_size = size / 2; } mdi->mix_buffer = realloc(mdi->mix_buffer, mdi->mix_buffer_size * sizeof(int32_t)); } tmp_buffer = mdi->mix_buffer; memset(tmp_buffer, 0, ((size / 2) * sizeof(int32_t))); out_buffer = tmp_buffer; do { if (__builtin_expect((!mdi->samples_to_mix), 0)) { while ((!mdi->samples_to_mix) && (event->do_event)) { event->do_event(mdi, &event->event_data); if ((mdi->extra_info.mixer_options & WM_MO_LOOP) && (event[0].do_event == *_WM_do_meta_endoftrack)) { _WM_ResetToStart(mdi); event = mdi->current_event; } else { mdi->samples_to_mix = event->samples_to_next; event++; mdi->current_event = event; } } if (__builtin_expect((!mdi->samples_to_mix), 0)) { if (mdi->extra_info.current_sample >= mdi->extra_info.approx_total_samples) { break; } else if ((mdi->extra_info.approx_total_samples - mdi->extra_info.current_sample) > (size >> 2)) { mdi->samples_to_mix = size >> 2; } else { mdi->samples_to_mix = mdi->extra_info.approx_total_samples - mdi->extra_info.current_sample; } } } if (__builtin_expect((mdi->samples_to_mix > (size >> 2)), 1)) { real_samples_to_mix = size >> 2; } else { real_samples_to_mix = mdi->samples_to_mix; if (real_samples_to_mix == 0) { continue; } } /* do mixing here */ count = real_samples_to_mix; do { note_data = mdi->note; left_mix = right_mix = 0; RESAMPLE_DEBUGI(""SAMPLES_TO_MIX"",count); if (__builtin_expect((note_data != NULL), 1)) { RESAMPLE_DEBUGS(""Processing Notes""); while (note_data) { /* * =================== * resample the sample * =================== */ data_pos = note_data->sample_pos >> FPBITS; premix = ((note_data->sample->data[data_pos] + (((note_data->sample->data[data_pos + 1] - note_data->sample->data[data_pos]) * (int32_t)(note_data->sample_pos & FPMASK)) / 1024)) * (note_data->env_level >> 12)) / 1024; left_mix += (premix * (int32_t)note_data->left_mix_volume) / 1024; right_mix += (premix * (int32_t)note_data->right_mix_volume) / 1024; /* * ======================== * sample position checking * ======================== */ #ifdef DEBUG_RESAMPLE fprintf(stderr,""\r\n%d -> INC %i, ENV %i, LEVEL %i, TARGET %d, RATE %i, SAMPLE POS %i, SAMPLE LENGTH %i, PREMIX %i (%i:%i)"", (uint32_t)note_data, note_data->env_inc, note_data->env, note_data->env_level, note_data->sample->env_target[note_data->env], note_data->sample->env_rate[note_data->env], note_data->sample_pos, note_data->sample->data_length, premix, left_mix, right_mix); if (note_data->modes & SAMPLE_LOOP) fprintf(stderr,"", LOOP %i + %i"", note_data->sample->loop_start, note_data->sample->loop_size); fprintf(stderr,""\r\n""); #endif note_data->sample_pos += note_data->sample_inc; if (__builtin_expect((note_data->modes & SAMPLE_LOOP), 1)) { if (__builtin_expect( (note_data->sample_pos > note_data->sample->loop_end), 0)) { note_data->sample_pos = note_data->sample->loop_start + ((note_data->sample_pos - note_data->sample->loop_start) % note_data->sample->loop_size); } } else if (__builtin_expect( (note_data->sample_pos >= note_data->sample->data_length), 0)) { goto _END_THIS_NOTE; } if (__builtin_expect((note_data->env_inc == 0), 0)) { note_data = note_data->next; RESAMPLE_DEBUGS(""Next Note: 0 env_inc""); continue; } note_data->env_level += note_data->env_inc; if (note_data->env_inc < 0) { if (__builtin_expect((note_data->env_level > note_data->sample->env_target[note_data->env]), 0)) { note_data = note_data->next; RESAMPLE_DEBUGS(""Next Note: env_lvl > env_target""); continue; } } else if (note_data->env_inc > 0) { if (__builtin_expect((note_data->env_level < note_data->sample->env_target[note_data->env]), 0)) { note_data = note_data->next; RESAMPLE_DEBUGS(""Next Note: env_lvl < env_target""); continue; } } note_data->env_level = note_data->sample->env_target[note_data->env]; switch (note_data->env) { case 0: if (!(note_data->modes & SAMPLE_ENVELOPE)) { note_data->env_inc = 0; note_data = note_data->next; RESAMPLE_DEBUGS(""Next Note: No Envelope""); continue; } break; case 2: if (note_data->modes & SAMPLE_SUSTAIN /*|| note_data->hold*/) { note_data->env_inc = 0; note_data = note_data->next; RESAMPLE_DEBUGS(""Next Note: SAMPLE_SUSTAIN""); continue; } else if (note_data->modes & SAMPLE_CLAMPED) { note_data->env = 5; if (note_data->env_level > note_data->sample->env_target[5]) { note_data->env_inc = -note_data->sample->env_rate[5]; } else { note_data->env_inc = note_data->sample->env_rate[5]; } continue; } break; case 5: if (__builtin_expect((note_data->env_level == 0), 1)) { goto _END_THIS_NOTE; } /* sample release */ if (note_data->modes & SAMPLE_LOOP) note_data->modes ^= SAMPLE_LOOP; note_data->env_inc = 0; note_data = note_data->next; RESAMPLE_DEBUGS(""Next Note: Sample Release""); continue; case 6: _END_THIS_NOTE: if (__builtin_expect((note_data->replay != NULL), 1)) { note_data->active = 0; { struct _note *prev_note = NULL; struct _note *nte_array = mdi->note; if (nte_array != note_data) { do { prev_note = nte_array; nte_array = nte_array->next; } while (nte_array != note_data); } if (prev_note) { prev_note->next = note_data->replay; } else { mdi->note = note_data->replay; } note_data->replay->next = note_data->next; note_data = note_data->replay; note_data->active = 1; } } else { note_data->active = 0; { struct _note *prev_note = NULL; struct _note *nte_array = mdi->note; if (nte_array != note_data) { do { prev_note = nte_array; nte_array = nte_array->next; } while ((nte_array != note_data) && (nte_array)); } if (prev_note) { prev_note->next = note_data->next; } else { mdi->note = note_data->next; } note_data = note_data->next; } } RESAMPLE_DEBUGS(""Next Note: Killed Off Note""); continue; } note_data->env++; if (note_data->is_off == 1) { _WM_do_note_off_extra(note_data); } else { if (note_data->env_level >= note_data->sample->env_target[note_data->env]) { note_data->env_inc = -note_data->sample->env_rate[note_data->env]; } else { note_data->env_inc = note_data->sample->env_rate[note_data->env]; } } note_data = note_data->next; #ifdef DEBUG_RESAMPLE if (note_data != NULL) RESAMPLE_DEBUGI(""Next Note: Next ENV "", note_data->env); else RESAMPLE_DEBUGS(""Next Note: Next ENV""); #endif continue; } } *tmp_buffer++ = left_mix; *tmp_buffer++ = right_mix; } while (--count); buffer_used += real_samples_to_mix * 4; size -= (real_samples_to_mix << 2); mdi->extra_info.current_sample += real_samples_to_mix; mdi->samples_to_mix -= real_samples_to_mix; } while (size); tmp_buffer = out_buffer; if (mdi->extra_info.mixer_options & WM_MO_REVERB) { _WM_do_reverb(mdi->reverb, tmp_buffer, (buffer_used / 2)); } for (i = 0; i < buffer_used; i += 4) { left_mix = *tmp_buffer++; right_mix = *tmp_buffer++; /* * =================== * Write to the buffer * =================== */ #ifdef WORDS_BIGENDIAN (*buffer++) = ((left_mix >> 8) & 0x7f) | ((left_mix >> 24) & 0x80); (*buffer++) = left_mix & 0xff; (*buffer++) = ((right_mix >> 8) & 0x7f) | ((right_mix >> 24) & 0x80); (*buffer++) = right_mix & 0xff; #else (*buffer++) = left_mix & 0xff; (*buffer++) = ((left_mix >> 8) & 0x7f) | ((left_mix >> 24) & 0x80); (*buffer++) = right_mix & 0xff; (*buffer++) = ((right_mix >> 8) & 0x7f) | ((right_mix >> 24) & 0x80); #endif } _WM_Unlock(&mdi->lock); return (buffer_used); } ",0 "bool GpuCommandBufferStub::IsInSameContextShareGroup( const GpuCommandBufferStubBase& other) const { return context_group_ == static_cast(other).context_group_; } ",0 "static int pmcraid_notify_ccn(struct pmcraid_instance *pinstance) { return pmcraid_notify_aen(pinstance, pinstance->ccn.msg, pinstance->ccn.hcam->data_len + sizeof(struct pmcraid_hcam_hdr)); } ",0 "error::Error GLES2DecoderImpl::HandleGetShaderPrecisionFormat( uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::GetShaderPrecisionFormat& c = *static_cast(cmd_data); GLenum shader_type = static_cast(c.shadertype); GLenum precision_type = static_cast(c.precisiontype); typedef cmds::GetShaderPrecisionFormat::Result Result; Result* result = GetSharedMemoryAs( c.result_shm_id, c.result_shm_offset, sizeof(*result)); if (!result) { return error::kOutOfBounds; } if (result->success != 0) { return error::kInvalidArguments; } if (!validators_->shader_type.IsValid(shader_type)) { LOCAL_SET_GL_ERROR_INVALID_ENUM( ""glGetShaderPrecisionFormat"", shader_type, ""shader_type""); return error::kNoError; } if (!validators_->shader_precision.IsValid(precision_type)) { LOCAL_SET_GL_ERROR_INVALID_ENUM( ""glGetShaderPrecisionFormat"", precision_type, ""precision_type""); return error::kNoError; } result->success = 1; // true GLint range[2] = { 0, 0 }; GLint precision = 0; GetShaderPrecisionFormatImpl(shader_type, precision_type, range, &precision); result->min_range = range[0]; result->max_range = range[1]; result->precision = precision; return error::kNoError; } ",0 "OPJ_BOOL opj_tcd_decode_tile( opj_tcd_t *p_tcd, OPJ_BYTE *p_src, OPJ_UINT32 p_max_length, OPJ_UINT32 p_tile_no, opj_codestream_index_t *p_cstr_index, opj_event_mgr_t *p_manager ) { OPJ_UINT32 l_data_read; p_tcd->tcd_tileno = p_tile_no; p_tcd->tcp = &(p_tcd->cp->tcps[p_tile_no]); #ifdef TODO_MSD /* FIXME */ /* INDEX >> */ if(p_cstr_info) { OPJ_UINT32 resno, compno, numprec = 0; for (compno = 0; compno < (OPJ_UINT32) p_cstr_info->numcomps; compno++) { opj_tcp_t *tcp = &p_tcd->cp->tcps[0]; opj_tccp_t *tccp = &tcp->tccps[compno]; opj_tcd_tilecomp_t *tilec_idx = &p_tcd->tcd_image->tiles->comps[compno]; for (resno = 0; resno < tilec_idx->numresolutions; resno++) { opj_tcd_resolution_t *res_idx = &tilec_idx->resolutions[resno]; p_cstr_info->tile[p_tile_no].pw[resno] = res_idx->pw; p_cstr_info->tile[p_tile_no].ph[resno] = res_idx->ph; numprec += res_idx->pw * res_idx->ph; p_cstr_info->tile[p_tile_no].pdx[resno] = tccp->prcw[resno]; p_cstr_info->tile[p_tile_no].pdy[resno] = tccp->prch[resno]; } } p_cstr_info->tile[p_tile_no].packet = (opj_packet_info_t *) opj_malloc(p_cstr_info->numlayers * numprec * sizeof(opj_packet_info_t)); p_cstr_info->packno = 0; } /* << INDEX */ #endif /*--------------TIER2------------------*/ /* FIXME _ProfStart(PGROUP_T2); */ l_data_read = 0; if (! opj_tcd_t2_decode(p_tcd, p_src, &l_data_read, p_max_length, p_cstr_index, p_manager)) { return OPJ_FALSE; } /* FIXME _ProfStop(PGROUP_T2); */ /*------------------TIER1-----------------*/ /* FIXME _ProfStart(PGROUP_T1); */ if (! opj_tcd_t1_decode(p_tcd)) { return OPJ_FALSE; } /* FIXME _ProfStop(PGROUP_T1); */ /*----------------DWT---------------------*/ /* FIXME _ProfStart(PGROUP_DWT); */ if (! opj_tcd_dwt_decode(p_tcd)) { return OPJ_FALSE; } /* FIXME _ProfStop(PGROUP_DWT); */ /*----------------MCT-------------------*/ /* FIXME _ProfStart(PGROUP_MCT); */ if (! opj_tcd_mct_decode(p_tcd, p_manager)) { return OPJ_FALSE; } /* FIXME _ProfStop(PGROUP_MCT); */ /* FIXME _ProfStart(PGROUP_DC_SHIFT); */ if (! opj_tcd_dc_level_shift_decode(p_tcd)) { return OPJ_FALSE; } /* FIXME _ProfStop(PGROUP_DC_SHIFT); */ /*---------------TILE-------------------*/ return OPJ_TRUE; } ",0 "void FLTPreParseFilterForAliasAndGroup(FilterEncodingNode *psFilterNode, mapObj *map, int i, const char *namespaces) { layerObj *lp=NULL; char szTmp[256]; const char *pszFullName = NULL; int layerWasOpened = MS_FALSE; #if defined(USE_WMS_SVR) || defined (USE_WFS_SVR) || defined (USE_WCS_SVR) || defined(USE_SOS_SVR) if (psFilterNode && map && i>=0 && inumlayers) { /*strip name spaces before hand*/ FLTStripNameSpacesFromPropertyName(psFilterNode); lp = GET_LAYER(map, i); layerWasOpened = msLayerIsOpen(lp); if (msLayerOpen(lp) == MS_SUCCESS && msLayerGetItems(lp) == MS_SUCCESS) { /* Remove group names from property names if using groupname/itemname syntax */ gmlGroupListObj* groupList = msGMLGetGroups(lp, namespaces); if( groupList && groupList->numgroups > 0 ) FLTRemoveGroupName(psFilterNode, groupList); msGMLFreeGroups(groupList); for(i=0; inumitems; i++) { if (!lp->items[i] || strlen(lp->items[i]) <= 0) continue; snprintf(szTmp, sizeof(szTmp), ""%s_alias"", lp->items[i]); pszFullName = msOWSLookupMetadata(&(lp->metadata), namespaces, szTmp); if (pszFullName) { FLTReplacePropertyName(psFilterNode, pszFullName, lp->items[i]); } } if (!layerWasOpened) /* do not close the layer if it has been opened somewhere else (paging?) */ msLayerClose(lp); } } #else msSetError(MS_MISCERR, ""OWS support is not available."", ""FLTPreParseFilterForAlias()""); #endif } ",0 "poly_npoints(PG_FUNCTION_ARGS) { POLYGON *poly = PG_GETARG_POLYGON_P(0); PG_RETURN_INT32(poly->npts); } ",0 "blink::WebPlugin* RenderFrameImpl::CreatePlugin( blink::WebFrame* frame, const WebPluginInfo& info, const blink::WebPluginParams& params) { DCHECK_EQ(frame_, frame); #if defined(ENABLE_PLUGINS) bool pepper_plugin_was_registered = false; scoped_refptr pepper_module(PluginModule::Create( this, info, &pepper_plugin_was_registered)); if (pepper_plugin_was_registered) { if (pepper_module.get()) { return new PepperWebPluginImpl(pepper_module.get(), params, this); } } #if defined(OS_CHROMEOS) LOG(WARNING) << ""Pepper module/plugin creation failed.""; return NULL; #else return new WebPluginImpl(frame, params, info.path, render_view_, this); #endif #else return NULL; #endif } ",0 "void ChooserContextBase::AddObserver(PermissionObserver* observer) { permission_observer_list_.AddObserver(observer); } ",0 "psf_open_rsrc (SF_PRIVATE *psf) { if (psf->rsrc.handle != NULL) return 0 ; /* Test for MacOSX style resource fork on HPFS or HPFS+ filesystems. */ snprintf (psf->rsrc.path.c, sizeof (psf->rsrc.path.c), ""%s/rsrc"", psf->file.path.c) ; psf->error = SFE_NO_ERROR ; if ((psf->rsrc.handle = psf_open_handle (&psf->rsrc)) != NULL) { psf->rsrclength = psf_get_filelen_handle (psf->rsrc.handle) ; return SFE_NO_ERROR ; } ; /* ** Now try for a resource fork stored as a separate file in the same ** directory, but preceded with a dot underscore. */ snprintf (psf->rsrc.path.c, sizeof (psf->rsrc.path.c), ""%s._%s"", psf->file.dir.c, psf->file.name.c) ; psf->error = SFE_NO_ERROR ; if ((psf->rsrc.handle = psf_open_handle (&psf->rsrc)) != NULL) { psf->rsrclength = psf_get_filelen_handle (psf->rsrc.handle) ; return SFE_NO_ERROR ; } ; /* ** Now try for a resource fork stored in a separate file in the ** .AppleDouble/ directory. */ snprintf (psf->rsrc.path.c, sizeof (psf->rsrc.path.c), ""%s.AppleDouble/%s"", psf->file.dir.c, psf->file.name.c) ; psf->error = SFE_NO_ERROR ; if ((psf->rsrc.handle = psf_open_handle (&psf->rsrc)) != NULL) { psf->rsrclength = psf_get_filelen_handle (psf->rsrc.handle) ; return SFE_NO_ERROR ; } ; /* No resource file found. */ if (psf->rsrc.handle == NULL) psf_log_syserr (psf, GetLastError ()) ; psf->rsrc.handle = NULL ; return psf->error ; } /* psf_open_rsrc */ ",0 "bool RenderThreadImpl::IsPartialRasterEnabled() { return is_partial_raster_enabled_; } ",0 "void RenderFrameHostImpl::RenderProcessGone(SiteInstanceImpl* site_instance) { DCHECK_EQ(site_instance_.get(), site_instance); if (GetNavigationHandle()) GetNavigationHandle()->set_net_error_code(net::ERR_ABORTED); ResetLoadingState(); stream_handle_.reset(); set_nav_entry_id(0); if (is_audible_) GetProcess()->OnMediaStreamRemoved(); } ",0 "struct b43_dmaring *parse_cookie(struct b43_wldev *dev, u16 cookie, int *slot) { struct b43_dma *dma = &dev->dma; struct b43_dmaring *ring = NULL; switch (cookie & 0xF000) { case 0x1000: ring = dma->tx_ring_AC_BK; break; case 0x2000: ring = dma->tx_ring_AC_BE; break; case 0x3000: ring = dma->tx_ring_AC_VI; break; case 0x4000: ring = dma->tx_ring_AC_VO; break; case 0x5000: ring = dma->tx_ring_mcast; break; } *slot = (cookie & 0x0FFF); if (unlikely(!ring || *slot < 0 || *slot >= ring->nr_slots)) { b43dbg(dev->wl, ""TX-status contains "" ""invalid cookie: 0x%04X\n"", cookie); return NULL; } return ring; } ",0 "ChromeContentBrowserClient::CreateClientCertStore( content::ResourceContext* resource_context) { if (!resource_context) return nullptr; return ProfileIOData::FromResourceContext(resource_context) ->CreateClientCertStore(); } ",0 "nfs_disable_share_one(const char *sharepath, const char *host, const char *security, const char *access, void *cookie) { int rc; char *linuxhost, *hostpath; char *argv[4]; rc = get_linux_hostspec(host, &linuxhost); if (rc < 0) exit(1); hostpath = malloc(strlen(linuxhost) + 1 + strlen(sharepath) + 1); if (hostpath == NULL) { free(linuxhost); exit(1); } sprintf(hostpath, ""%s:%s"", linuxhost, sharepath); free(linuxhost); #ifdef DEBUG fprintf(stderr, ""unsharing %s\n"", hostpath); #endif argv[0] = ""/usr/sbin/exportfs""; argv[1] = ""-u""; argv[2] = hostpath; argv[3] = NULL; rc = libzfs_run_process(argv[0], argv, 0); free(hostpath); if (rc < 0) return (SA_SYSTEM_ERR); else return (SA_OK); } ",0 "std::string TestURLLoader::TestCustomRequestHeader() { pp::URLRequestInfo request(instance_); request.SetURL(""/echoheader?Foo""); request.SetHeaders(""Foo: 1""); return LoadAndCompareBody(request, ""1""); } ",0 "int generic_ptrace_pokedata(struct task_struct *tsk, unsigned long addr, unsigned long data) { int copied; copied = access_process_vm(tsk, addr, &data, sizeof(data), 1); return (copied == sizeof(data)) ? 0 : -EIO; } ",0 "static inline bool isEditingBoundary(RenderObject* ancestor, RenderObject* child) { ASSERT(!ancestor || ancestor->nonPseudoNode()); ASSERT(child && child->nonPseudoNode()); return !ancestor || !ancestor->parent() || (ancestor->hasLayer() && ancestor->parent()->isRenderView()) || ancestor->nonPseudoNode()->rendererIsEditable() == child->nonPseudoNode()->rendererIsEditable(); } ",0 "fst_cpurelease(struct fst_card_info *card) { if (card->family == FST_FAMILY_TXU) { /* * Force posted writes to complete */ (void) readb(card->mem); /* * Release LRESET DO = 1 * Then release Local Hold, DO = 1 */ outw(0x040e, card->pci_conf + CNTRL_9054 + 2); outw(0x040f, card->pci_conf + CNTRL_9054 + 2); } else { (void) readb(card->ctlmem); } } ",0 "static void js_defvar(js_State *J, const char *name) { jsR_defproperty(J, J->E->variables, name, JS_DONTENUM | JS_DONTCONF, NULL, NULL, NULL); } ",0 "void RenderFrameImpl::ExecuteJavaScript(const base::string16& javascript) { JavaScriptExecuteRequest(javascript, base::DoNothing()); } ",0 "void remove_entity_load_avg(struct sched_entity *se) { struct cfs_rq *cfs_rq = cfs_rq_of(se); unsigned long flags; /* * tasks cannot exit without having gone through wake_up_new_task() -> * post_init_entity_util_avg() which will have added things to the * cfs_rq, so we can remove unconditionally. * * Similarly for groups, they will have passed through * post_init_entity_util_avg() before unregister_sched_fair_group() * calls this. */ sync_entity_load_avg(se); raw_spin_lock_irqsave(&cfs_rq->removed.lock, flags); ++cfs_rq->removed.nr; cfs_rq->removed.util_avg += se->avg.util_avg; cfs_rq->removed.load_avg += se->avg.load_avg; cfs_rq->removed.runnable_sum += se->avg.load_sum; /* == runnable_sum */ raw_spin_unlock_irqrestore(&cfs_rq->removed.lock, flags); } ",0 "void RenderProcessHostWatcher::RenderProcessHostDestroyed( RenderProcessHost* host) { render_process_host_ = nullptr; if (type_ == WATCH_FOR_HOST_DESTRUCTION) message_loop_runner_->Quit(); } ",0 "void audit_core_dumps(long signr) { struct audit_buffer *ab; if (!audit_enabled) return; if (signr == SIGQUIT) /* don't care for those */ return; ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_ANOM_ABEND); if (unlikely(!ab)) return; audit_log_task(ab); audit_log_format(ab, "" sig=%ld"", signr); audit_log_end(ab); } ",0 "fbCombineAtopU (CARD32 *dest, const CARD32 *src, int width) { int i; for (i = 0; i < width; ++i) { CARD32 s = READ(src + i); CARD32 d = READ(dest + i); CARD32 dest_a = Alpha(d); CARD32 src_ia = Alpha(~s); FbByteAddMul(s, dest_a, d, src_ia); WRITE(dest + i, s); } } ",0 "HandleGlobalVar(CompatInfo *info, VarDef *stmt) { const char *elem, *field; ExprDef *ndx; bool ret; if (!ExprResolveLhs(info->ctx, stmt->name, &elem, &field, &ndx)) ret = false; else if (elem && istreq(elem, ""interpret"")) ret = SetInterpField(info, &info->default_interp, field, ndx, stmt->value); else if (elem && istreq(elem, ""indicator"")) ret = SetLedMapField(info, &info->default_led, field, ndx, stmt->value); else ret = SetActionField(info->ctx, info->actions, &info->mods, elem, field, ndx, stmt->value); return ret; } ",0 " bool CertificateChainIsWhitelisted( const ClientDownloadRequest_CertificateChain& chain) { DCHECK_CURRENTLY_ON(BrowserThread::IO); if (chain.element_size() < 2) { return false; } scoped_refptr cert = net::X509Certificate::CreateFromBytes( chain.element(0).certificate().data(), chain.element(0).certificate().size()); if (!cert.get()) { return false; } for (int i = 1; i < chain.element_size(); ++i) { scoped_refptr issuer = net::X509Certificate::CreateFromBytes( chain.element(i).certificate().data(), chain.element(i).certificate().size()); if (!issuer.get()) { return false; } std::vector whitelist_strings; DownloadProtectionService::GetCertificateWhitelistStrings( *cert.get(), *issuer.get(), &whitelist_strings); for (size_t j = 0; j < whitelist_strings.size(); ++j) { if (database_manager_->MatchDownloadWhitelistString( whitelist_strings[j])) { DVLOG(2) << ""Certificate matched whitelist, cert="" << cert->subject().GetDisplayName() << "" issuer="" << issuer->subject().GetDisplayName(); return true; } } cert = issuer; } return false; } ",0 "static inline long object_common1(UNSERIALIZE_PARAMETER, zend_class_entry *ce) { long elements; elements = parse_iv2((*p) + 2, p); (*p) += 2; if (ce->serialize == NULL) { object_init_ex(*rval, ce); } else { /* If this class implements Serializable, it should not land here but in object_custom(). The passed string obviously doesn't descend from the regular serializer. */ zend_error(E_WARNING, ""Erroneous data format for unserializing '%s'"", ce->name); return 0; } return elements; } ",1 "static int adev_open_output_stream(struct audio_hw_device *dev, audio_io_handle_t handle, audio_devices_t devices, audio_output_flags_t flags, struct audio_config *config, struct audio_stream_out **stream_out, const char *address __unused) { struct audio_device *adev = (struct audio_device *)dev; struct stream_out *out; int i, ret; struct pcm_device_profile *pcm_profile; ALOGV(""%s: enter: sample_rate(%d) channel_mask(%#x) devices(%#x) flags(%#x)"", __func__, config->sample_rate, config->channel_mask, devices, flags); *stream_out = NULL; out = (struct stream_out *)calloc(1, sizeof(struct stream_out)); if (devices == AUDIO_DEVICE_NONE) devices = AUDIO_DEVICE_OUT_SPEAKER; out->flags = flags; out->devices = devices; out->dev = adev; out->format = config->format; out->sample_rate = config->sample_rate; out->channel_mask = AUDIO_CHANNEL_OUT_STEREO; out->supported_channel_masks[0] = AUDIO_CHANNEL_OUT_STEREO; out->handle = handle; pcm_profile = get_pcm_device(PCM_PLAYBACK, devices); if (pcm_profile == NULL) { ret = -EINVAL; goto error_open; } out->config = pcm_profile->config; /* Init use case and pcm_config */ if (out->flags & (AUDIO_OUTPUT_FLAG_DEEP_BUFFER)) { out->usecase = USECASE_AUDIO_PLAYBACK_DEEP_BUFFER; out->config = pcm_config_deep_buffer; out->sample_rate = out->config.rate; ALOGV(""%s: use AUDIO_PLAYBACK_DEEP_BUFFER"",__func__); } else { out->usecase = USECASE_AUDIO_PLAYBACK; out->sample_rate = out->config.rate; } if (flags & AUDIO_OUTPUT_FLAG_PRIMARY) { if (adev->primary_output == NULL) adev->primary_output = out; else { ALOGE(""%s: Primary output is already opened"", __func__); ret = -EEXIST; goto error_open; } } /* Check if this usecase is already existing */ pthread_mutex_lock(&adev->lock); if (get_usecase_from_id(adev, out->usecase) != NULL) { ALOGE(""%s: Usecase (%d) is already present"", __func__, out->usecase); pthread_mutex_unlock(&adev->lock); ret = -EEXIST; goto error_open; } pthread_mutex_unlock(&adev->lock); out->stream.common.get_sample_rate = out_get_sample_rate; out->stream.common.set_sample_rate = out_set_sample_rate; out->stream.common.get_buffer_size = out_get_buffer_size; out->stream.common.get_channels = out_get_channels; out->stream.common.get_format = out_get_format; out->stream.common.set_format = out_set_format; out->stream.common.standby = out_standby; out->stream.common.dump = out_dump; out->stream.common.set_parameters = out_set_parameters; out->stream.common.get_parameters = out_get_parameters; out->stream.common.add_audio_effect = out_add_audio_effect; out->stream.common.remove_audio_effect = out_remove_audio_effect; out->stream.get_latency = out_get_latency; out->stream.set_volume = out_set_volume; out->stream.write = out_write; out->stream.get_render_position = out_get_render_position; out->stream.get_next_write_timestamp = out_get_next_write_timestamp; out->stream.get_presentation_position = out_get_presentation_position; out->standby = 1; /* out->muted = false; by calloc() */ /* out->written = 0; by calloc() */ pthread_mutex_init(&out->lock, (const pthread_mutexattr_t *) NULL); pthread_mutex_init(&out->pre_lock, (const pthread_mutexattr_t *) NULL); pthread_cond_init(&out->cond, (const pthread_condattr_t *) NULL); config->format = out->stream.common.get_format(&out->stream.common); config->channel_mask = out->stream.common.get_channels(&out->stream.common); config->sample_rate = out->stream.common.get_sample_rate(&out->stream.common); *stream_out = &out->stream; ALOGV(""%s: exit"", __func__); return 0; error_open: free(out); *stream_out = NULL; ALOGV(""%s: exit: ret %d"", __func__, ret); return ret; } ",0 "parse_eeprom (struct net_device *dev) { int i, j; long ioaddr = dev->base_addr; u8 sromdata[256]; u8 *psib; u32 crc; PSROM_t psrom = (PSROM_t) sromdata; struct netdev_private *np = netdev_priv(dev); int cid, next; #ifdef MEM_MAPPING ioaddr = pci_resource_start (np->pdev, 0); #endif /* Read eeprom */ for (i = 0; i < 128; i++) { ((__le16 *) sromdata)[i] = cpu_to_le16(read_eeprom (ioaddr, i)); } #ifdef MEM_MAPPING ioaddr = dev->base_addr; #endif if (np->pdev->vendor == PCI_VENDOR_ID_DLINK) { /* D-Link Only */ /* Check CRC */ crc = ~ether_crc_le (256 - 4, sromdata); if (psrom->crc != cpu_to_le32(crc)) { printk (KERN_ERR ""%s: EEPROM data CRC error.\n"", dev->name); return -1; } } /* Set MAC address */ for (i = 0; i < 6; i++) dev->dev_addr[i] = psrom->mac_addr[i]; if (np->pdev->vendor != PCI_VENDOR_ID_DLINK) { return 0; } /* Parse Software Information Block */ i = 0x30; psib = (u8 *) sromdata; do { cid = psib[i++]; next = psib[i++]; if ((cid == 0 && next == 0) || (cid == 0xff && next == 0xff)) { printk (KERN_ERR ""Cell data error\n""); return -1; } switch (cid) { case 0: /* Format version */ break; case 1: /* End of cell */ return 0; case 2: /* Duplex Polarity */ np->duplex_polarity = psib[i]; writeb (readb (ioaddr + PhyCtrl) | psib[i], ioaddr + PhyCtrl); break; case 3: /* Wake Polarity */ np->wake_polarity = psib[i]; break; case 9: /* Adapter description */ j = (next - i > 255) ? 255 : next - i; memcpy (np->name, &(psib[i]), j); break; case 4: case 5: case 6: case 7: case 8: /* Reversed */ break; default: /* Unknown cell */ return -1; } i = next; } while (1); return 0; } ",0 "static void release_tree_entry(struct tree_entry *e) { if (e->tree) release_tree_content_recursive(e->tree); *((void**)e) = avail_tree_entry; avail_tree_entry = e; } ",0 "set_num_722(unsigned char *p, uint16_t value) { archive_be16enc(p, value); } ",0 " static void add_bytes_c(uint8_t *dst, uint8_t *src, int w){ long i; for(i=0; i<=w-sizeof(long); i+=sizeof(long)){ long a = *(long*)(src+i); long b = *(long*)(dst+i); *(long*)(dst+i) = ((a&pb_7f) + (b&pb_7f)) ^ ((a^b)&pb_80); } for(; i= 11 && strncmp((char *)&nbuf[noff], ""NetBSD-CORE"", 11) == 0)) { os_style = OS_STYLE_NETBSD; } if (os_style != -1 && (*flags & FLAGS_DID_CORE_STYLE) == 0) { if (file_printf(ms, "", %s-style"", os_style_names[os_style]) == -1) return 1; *flags |= FLAGS_DID_CORE_STYLE; *flags |= os_style; } switch (os_style) { case OS_STYLE_NETBSD: if (type == NT_NETBSD_CORE_PROCINFO) { char sbuf[512]; struct NetBSD_elfcore_procinfo pi; memset(&pi, 0, sizeof(pi)); memcpy(&pi, nbuf + doff, descsz); if (file_printf(ms, "", from '%.31s', pid=%u, uid=%u, "" ""gid=%u, nlwps=%u, lwp=%u (signal %u/code %u)"", file_printable(sbuf, sizeof(sbuf), CAST(char *, pi.cpi_name)), elf_getu32(swap, (uint32_t)pi.cpi_pid), elf_getu32(swap, pi.cpi_euid), elf_getu32(swap, pi.cpi_egid), elf_getu32(swap, pi.cpi_nlwps), elf_getu32(swap, (uint32_t)pi.cpi_siglwp), elf_getu32(swap, pi.cpi_signo), elf_getu32(swap, pi.cpi_sigcode)) == -1) return 1; *flags |= FLAGS_DID_CORE; return 1; } break; default: if (type == NT_PRPSINFO && *flags & FLAGS_IS_CORE) { size_t i, j; unsigned char c; /* * Extract the program name. We assume * it to be 16 characters (that's what it * is in SunOS 5.x and Linux). * * Unfortunately, it's at a different offset * in various OSes, so try multiple offsets. * If the characters aren't all printable, * reject it. */ for (i = 0; i < NOFFSETS; i++) { unsigned char *cname, *cp; size_t reloffset = prpsoffsets(i); size_t noffset = doff + reloffset; size_t k; for (j = 0; j < 16; j++, noffset++, reloffset++) { /* * Make sure we're not past * the end of the buffer; if * we are, just give up. */ if (noffset >= size) goto tryanother; /* * Make sure we're not past * the end of the contents; * if we are, this obviously * isn't the right offset. */ if (reloffset >= descsz) goto tryanother; c = nbuf[noffset]; if (c == '\0') { /* * A '\0' at the * beginning is * obviously wrong. * Any other '\0' * means we're done. */ if (j == 0) goto tryanother; else break; } else { /* * A nonprintable * character is also * wrong. */ if (!isprint(c) || isquote(c)) goto tryanother; } } /* * Well, that worked. */ /* * Try next offsets, in case this match is * in the middle of a string. */ for (k = i + 1 ; k < NOFFSETS; k++) { size_t no; int adjust = 1; if (prpsoffsets(k) >= prpsoffsets(i)) continue; for (no = doff + prpsoffsets(k); no < doff + prpsoffsets(i); no++) adjust = adjust && isprint(nbuf[no]); if (adjust) i = k; } cname = (unsigned char *) &nbuf[doff + prpsoffsets(i)]; for (cp = cname; *cp && isprint(*cp); cp++) continue; /* * Linux apparently appends a space at the end * of the command line: remove it. */ while (cp > cname && isspace(cp[-1])) cp--; if (file_printf(ms, "", from '%.*s'"", (int)(cp - cname), cname) == -1) return 1; *flags |= FLAGS_DID_CORE; return 1; tryanother: ; } } break; } #endif return 0; } ",1 "static void ipip_tunnel_bind_dev(struct net_device *dev) { struct net_device *tdev = NULL; struct ip_tunnel *tunnel; struct iphdr *iph; tunnel = netdev_priv(dev); iph = &tunnel->parms.iph; if (iph->daddr) { struct flowi fl = { .oif = tunnel->parms.link, .nl_u = { .ip4_u = { .daddr = iph->daddr, .saddr = iph->saddr, .tos = RT_TOS(iph->tos) } }, .proto = IPPROTO_IPIP }; struct rtable *rt; if (!ip_route_output_key(dev_net(dev), &rt, &fl)) { tdev = rt->u.dst.dev; ip_rt_put(rt); } dev->flags |= IFF_POINTOPOINT; } if (!tdev && tunnel->parms.link) tdev = __dev_get_by_index(dev_net(dev), tunnel->parms.link); if (tdev) { dev->hard_header_len = tdev->hard_header_len + sizeof(struct iphdr); dev->mtu = tdev->mtu - sizeof(struct iphdr); } dev->iflink = tunnel->parms.link; } ",0 "void GLES2DecoderImpl::DeleteSyncHelper(GLuint sync) { GLsync service_id = 0; if (group_->GetSyncServiceId(sync, &service_id)) { api()->glDeleteSyncFn(service_id); group_->RemoveSyncId(sync); } else if (sync != 0) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, ""glDeleteSync"", ""unknown sync""); } } ",0 " void OnSwapBuffersCompleted(std::vector latency_info, gfx::Size swap_size, const gpu::SwapBuffersCompleteParams& params) { client_->DidReceiveSwapBuffersAck(); swap_buffers_callback_.Run(swap_size); UpdateLatencyInfoOnSwap(params.swap_response, &latency_info); latency_tracker_.OnGpuSwapBuffersCompleted(latency_info); } ",0 "void PlatformSensorWin::OnSensorError() { task_runner_->PostTask(FROM_HERE, base::Bind(&PlatformSensorWin::NotifySensorError, weak_factory_.GetWeakPtr())); } ",0 "bool IsUnownedPasswordFormVisible(blink::WebFrame* frame, const GURL& action, const GURL& origin, const FormData& form_data, const FormsPredictionsMap& form_predictions) { std::unique_ptr unowned_password_form( CreatePasswordFormFromUnownedInputElements(*frame, nullptr, &form_predictions)); if (!unowned_password_form) return false; std::vector control_elements = form_util::GetUnownedAutofillableFormFieldElements( frame->document().all(), nullptr); if (!form_util::IsSomeControlElementVisible(control_elements)) return false; #if !defined(OS_MACOSX) && !defined(OS_ANDROID) const bool action_is_empty = action == origin; bool forms_are_same = action_is_empty ? form_data.SameFormAs(unowned_password_form->form_data) : action == unowned_password_form->action; return forms_are_same; #else // OS_MACOSX or OS_ANDROID return action == unowned_password_form->action; #endif } ",0 "int CreateAndOpenFdForTemporaryFile(FilePath directory, FilePath* path) { base::ThreadRestrictions::AssertIOAllowed(); // For call to mkstemp(). *path = directory.Append(TempFileName()); const std::string& tmpdir_string = path->value(); char* buffer = const_cast(tmpdir_string.c_str()); return HANDLE_EINTR(mkstemp(buffer)); } ",0 "png_set_progressive_read_fn(png_structp png_ptr, png_voidp progressive_ptr, png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn, png_progressive_end_ptr end_fn) { if (png_ptr == NULL) return; png_ptr->info_fn = info_fn; png_ptr->row_fn = row_fn; png_ptr->end_fn = end_fn; png_set_read_fn(png_ptr, progressive_ptr, png_push_fill_buffer); } ",0 " void RemoveValuebuffer(GLuint client_id) { valuebuffer_manager()->RemoveValuebuffer(client_id); } ",0 "swap2(uint16_t sv) { uint16_t rv; uint8_t *s = (uint8_t *)(void *)&sv; uint8_t *d = (uint8_t *)(void *)&rv; d[0] = s[1]; d[1] = s[0]; return rv; } ",0 " void TrackMemoryAllocatedChange(size_t old_size, size_t new_size) { gpu_memory_manager_tracking_group_->TrackMemoryAllocatedChange( old_size, new_size); } ",0 "static inline int may_follow_link(struct path *link, struct nameidata *nd) { const struct inode *inode; const struct inode *parent; if (!sysctl_protected_symlinks) return 0; /* Allowed if owner and follower match. */ inode = link->dentry->d_inode; if (uid_eq(current_cred()->fsuid, inode->i_uid)) return 0; /* Allowed if parent directory not sticky and world-writable. */ parent = nd->path.dentry->d_inode; if ((parent->i_mode & (S_ISVTX|S_IWOTH)) != (S_ISVTX|S_IWOTH)) return 0; /* Allowed if parent directory and link owner match. */ if (uid_eq(parent->i_uid, inode->i_uid)) return 0; audit_log_link_denied(""follow_link"", link); path_put_conditional(link, nd); path_put(&nd->path); return -EACCES; } ",0 "static void gen_nop_modrm(CPUX86State *env, DisasContext *s, int modrm) { (void)gen_lea_modrm_0(env, s, modrm); } ",0 "void WallpaperManagerBase::InitInitialUserWallpaper(const AccountId& account_id, bool is_persistent) { current_user_wallpaper_info_.location = """"; current_user_wallpaper_info_.layout = WALLPAPER_LAYOUT_CENTER_CROPPED; current_user_wallpaper_info_.type = DEFAULT; current_user_wallpaper_info_.date = base::Time::Now().LocalMidnight(); WallpaperInfo info = current_user_wallpaper_info_; SetUserWallpaperInfo(account_id, info, is_persistent); } ",0 " void setCodec(const sp &target) { mTarget = target; } ",0 "void JSTestActiveDOMObject::destroy(JSC::JSCell* cell) { JSTestActiveDOMObject* thisObject = jsCast(cell); thisObject->JSTestActiveDOMObject::~JSTestActiveDOMObject(); } ",0 "CredentialManagerImpl::~CredentialManagerImpl() {} ",0 "PHP_METHOD(Phar, offsetGet) { char *fname, *error; size_t fname_len; zval zfname; phar_entry_info *entry; zend_string *sfname; PHAR_ARCHIVE_OBJECT(); if (zend_parse_parameters(ZEND_NUM_ARGS(), ""s"", &fname, &fname_len) == FAILURE) { return; } /* security is 0 here so that we can get a better error message than ""entry doesn't exist"" */ if (!(entry = phar_get_entry_info_dir(phar_obj->archive, fname, fname_len, 1, &error, 0))) { zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, ""Entry %s does not exist%s%s"", fname, error?"", "":"""", error?error:""""); } else { if (fname_len == sizeof("".phar/stub.php"")-1 && !memcmp(fname, "".phar/stub.php"", sizeof("".phar/stub.php"")-1)) { zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, ""Cannot get stub \"".phar/stub.php\"" directly in phar \""%s\"", use getStub"", phar_obj->archive->fname); return; } if (fname_len == sizeof("".phar/alias.txt"")-1 && !memcmp(fname, "".phar/alias.txt"", sizeof("".phar/alias.txt"")-1)) { zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, ""Cannot get alias \"".phar/alias.txt\"" directly in phar \""%s\"", use getAlias"", phar_obj->archive->fname); return; } if (fname_len >= sizeof("".phar"")-1 && !memcmp(fname, "".phar"", sizeof("".phar"")-1)) { zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, ""Cannot directly get any files or directories in magic \"".phar\"" directory"", phar_obj->archive->fname); return; } if (entry->is_temp_dir) { efree(entry->filename); efree(entry); } sfname = strpprintf(0, ""phar://%s/%s"", phar_obj->archive->fname, fname); ZVAL_NEW_STR(&zfname, sfname); spl_instantiate_arg_ex1(phar_obj->spl.info_class, return_value, &zfname); zval_ptr_dtor(&zfname); } } ",1 " static void Ins_JMPR( INS_ARG ) { CUR.IP += (Int)(args[0]); CUR.step_ins = FALSE; if(CUR.IP > CUR.codeSize || (CUR.code[CUR.IP] != 0x2D && CUR.code[CUR.IP - 1] == 0x2D)) /* The JPMR is meant to stop at the ENDF instruction to finish * the function. However the programmer made a mistake, and ended * up one byte too far. I suspect that some TT interpreters handle this * by detecting that the IP has gone off the end of the function. We can * allow for simple cases here by just checking the preceding byte. * Fonts with this problem are not uncommon. */ CUR.IP -= 1; } ",0 "void SerializedFlashMenu::WriteToMessage(IPC::Message* m) const { WriteMenu(m, pp_menu_); } ",0 "static int xfrm_flush_sa(struct sk_buff *skb, struct nlmsghdr *nlh, struct nlattr **attrs) { struct net *net = sock_net(skb->sk); struct km_event c; struct xfrm_usersa_flush *p = nlmsg_data(nlh); int err; err = xfrm_state_flush(net, p->proto, true); if (err) { if (err == -ESRCH) /* empty table */ return 0; return err; } c.data.proto = p->proto; c.event = nlh->nlmsg_type; c.seq = nlh->nlmsg_seq; c.portid = nlh->nlmsg_pid; c.net = net; km_state_notify(NULL, &c); return 0; } ",0 "static int is_hwaccel_pix_fmt(enum AVPixelFormat pix_fmt) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); return desc->flags & AV_PIX_FMT_FLAG_HWACCEL; } ",0 "void TabStrip::DoLayout() { last_layout_size_ = size(); StopAnimating(false); SwapLayoutIfNecessary(); if (touch_layout_) touch_layout_->SetWidth(GetTabAreaWidth()); UpdateIdealBounds(); views::ViewModelUtils::SetViewBoundsToIdealBounds(tabs_); SetTabVisibility(); SchedulePaint(); bounds_animator_.StopAnimatingView(new_tab_button_); new_tab_button_->SetBoundsRect(new_tab_button_bounds_); } ",0 "void LocalFrameClientImpl::DidCreateNewDocument() { if (web_frame_->Client()) web_frame_->Client()->DidCreateNewDocument(); } ",0 "void ion_device_destroy(struct ion_device *dev) { misc_deregister(&dev->dev); debugfs_remove_recursive(dev->debug_root); /* XXX need to free the heaps and clients ? */ kfree(dev); } ",0 "static s32 __brcmf_cfg80211_down(struct brcmf_if *ifp) { struct brcmf_cfg80211_info *cfg = ifp->drvr->config; /* * While going down, if associated with AP disassociate * from AP to save power */ if (check_vif_up(ifp->vif)) { brcmf_link_down(ifp->vif, WLAN_REASON_UNSPECIFIED); /* Make sure WPA_Supplicant receives all the event generated due to DISASSOC call to the fw to keep the state fw and WPA_Supplicant state consistent */ brcmf_delay(500); } brcmf_abort_scanning(cfg); clear_bit(BRCMF_VIF_STATUS_READY, &ifp->vif->sme_state); return 0; } ",0 "static void TIFFGetProperties(TIFF *tiff,Image *image) { char message[MaxTextExtent], *text; uint32 count, length, type; unsigned long *tietz; if ((TIFFGetField(tiff,TIFFTAG_ARTIST,&text) == 1) && (text != (char *) NULL)) (void) SetImageProperty(image,""tiff:artist"",text); if ((TIFFGetField(tiff,TIFFTAG_COPYRIGHT,&text) == 1) && (text != (char *) NULL)) (void) SetImageProperty(image,""tiff:copyright"",text); if ((TIFFGetField(tiff,TIFFTAG_DATETIME,&text) == 1) && (text != (char *) NULL)) (void) SetImageProperty(image,""tiff:timestamp"",text); if ((TIFFGetField(tiff,TIFFTAG_DOCUMENTNAME,&text) == 1) && (text != (char *) NULL)) (void) SetImageProperty(image,""tiff:document"",text); if ((TIFFGetField(tiff,TIFFTAG_HOSTCOMPUTER,&text) == 1) && (text != (char *) NULL)) (void) SetImageProperty(image,""tiff:hostcomputer"",text); if ((TIFFGetField(tiff,TIFFTAG_IMAGEDESCRIPTION,&text) == 1) && (text != (char *) NULL)) (void) SetImageProperty(image,""comment"",text); if ((TIFFGetField(tiff,TIFFTAG_MAKE,&text) == 1) && (text != (char *) NULL)) (void) SetImageProperty(image,""tiff:make"",text); if ((TIFFGetField(tiff,TIFFTAG_MODEL,&text) == 1) && (text != (char *) NULL)) (void) SetImageProperty(image,""tiff:model"",text); if ((TIFFGetField(tiff,TIFFTAG_OPIIMAGEID,&count,&text) == 1) && (text != (char *) NULL)) { if (count >= MaxTextExtent) count=MaxTextExtent-1; (void) CopyMagickString(message,text,count+1); (void) SetImageProperty(image,""tiff:image-id"",message); } if ((TIFFGetField(tiff,TIFFTAG_PAGENAME,&text) == 1) && (text != (char *) NULL)) (void) SetImageProperty(image,""label"",text); if ((TIFFGetField(tiff,TIFFTAG_SOFTWARE,&text) == 1) && (text != (char *) NULL)) (void) SetImageProperty(image,""tiff:software"",text); if ((TIFFGetField(tiff,33423,&count,&text) == 1) && (text != (char *) NULL)) { if (count >= MaxTextExtent) count=MaxTextExtent-1; (void) CopyMagickString(message,text,count+1); (void) SetImageProperty(image,""tiff:kodak-33423"",message); } if ((TIFFGetField(tiff,36867,&count,&text) == 1) && (text != (char *) NULL)) { if (count >= MaxTextExtent) count=MaxTextExtent-1; (void) CopyMagickString(message,text,count+1); (void) SetImageProperty(image,""tiff:kodak-36867"",message); } if (TIFFGetField(tiff,TIFFTAG_SUBFILETYPE,&type) == 1) switch (type) { case 0x01: { (void) SetImageProperty(image,""tiff:subfiletype"",""REDUCEDIMAGE""); break; } case 0x02: { (void) SetImageProperty(image,""tiff:subfiletype"",""PAGE""); break; } case 0x04: { (void) SetImageProperty(image,""tiff:subfiletype"",""MASK""); break; } default: break; } if ((TIFFGetField(tiff,37706,&length,&tietz) == 1) && (tietz != (unsigned long *) NULL)) { (void) FormatLocaleString(message,MaxTextExtent,""%lu"",tietz[0]); (void) SetImageProperty(image,""tiff:tietz_offset"",message); } } ",0 "HeadlessWebContents::Builder& HeadlessWebContents::Builder::SetAllowTabSockets( bool tab_sockets_allowed) { tab_sockets_allowed_ = tab_sockets_allowed; return *this; } ",0 "SMB2_negotiate(const unsigned int xid, struct cifs_ses *ses) { struct smb2_negotiate_req *req; struct smb2_negotiate_rsp *rsp; struct kvec iov[1]; int rc = 0; int resp_buftype; struct TCP_Server_Info *server = ses->server; int blob_offset, blob_length; char *security_blob; int flags = CIFS_NEG_OP; cifs_dbg(FYI, ""Negotiate protocol\n""); if (!server) { WARN(1, ""%s: server is NULL!\n"", __func__); return -EIO; } rc = small_smb2_init(SMB2_NEGOTIATE, NULL, (void **) &req); if (rc) return rc; req->hdr.SessionId = 0; req->Dialects[0] = cpu_to_le16(ses->server->vals->protocol_id); req->DialectCount = cpu_to_le16(1); /* One vers= at a time for now */ inc_rfc1001_len(req, 2); /* only one of SMB2 signing flags may be set in SMB2 request */ if (ses->sign) req->SecurityMode = cpu_to_le16(SMB2_NEGOTIATE_SIGNING_REQUIRED); else if (global_secflags & CIFSSEC_MAY_SIGN) req->SecurityMode = cpu_to_le16(SMB2_NEGOTIATE_SIGNING_ENABLED); else req->SecurityMode = 0; req->Capabilities = cpu_to_le32(ses->server->vals->req_capabilities); /* ClientGUID must be zero for SMB2.02 dialect */ if (ses->server->vals->protocol_id == SMB20_PROT_ID) memset(req->ClientGUID, 0, SMB2_CLIENT_GUID_SIZE); else memcpy(req->ClientGUID, server->client_guid, SMB2_CLIENT_GUID_SIZE); iov[0].iov_base = (char *)req; /* 4 for rfc1002 length field */ iov[0].iov_len = get_rfc1002_length(req) + 4; rc = SendReceive2(xid, ses, iov, 1, &resp_buftype, flags); rsp = (struct smb2_negotiate_rsp *)iov[0].iov_base; /* * No tcon so can't do * cifs_stats_inc(&tcon->stats.smb2_stats.smb2_com_fail[SMB2...]); */ if (rc != 0) goto neg_exit; cifs_dbg(FYI, ""mode 0x%x\n"", rsp->SecurityMode); /* BB we may eventually want to match the negotiated vs. requested dialect, even though we are only requesting one at a time */ if (rsp->DialectRevision == cpu_to_le16(SMB20_PROT_ID)) cifs_dbg(FYI, ""negotiated smb2.0 dialect\n""); else if (rsp->DialectRevision == cpu_to_le16(SMB21_PROT_ID)) cifs_dbg(FYI, ""negotiated smb2.1 dialect\n""); else if (rsp->DialectRevision == cpu_to_le16(SMB30_PROT_ID)) cifs_dbg(FYI, ""negotiated smb3.0 dialect\n""); else if (rsp->DialectRevision == cpu_to_le16(SMB302_PROT_ID)) cifs_dbg(FYI, ""negotiated smb3.02 dialect\n""); else { cifs_dbg(VFS, ""Illegal dialect returned by server %d\n"", le16_to_cpu(rsp->DialectRevision)); rc = -EIO; goto neg_exit; } server->dialect = le16_to_cpu(rsp->DialectRevision); /* SMB2 only has an extended negflavor */ server->negflavor = CIFS_NEGFLAVOR_EXTENDED; /* set it to the maximum buffer size value we can send with 1 credit */ server->maxBuf = min_t(unsigned int, le32_to_cpu(rsp->MaxTransactSize), SMB2_MAX_BUFFER_SIZE); server->max_read = le32_to_cpu(rsp->MaxReadSize); server->max_write = le32_to_cpu(rsp->MaxWriteSize); /* BB Do we need to validate the SecurityMode? */ server->sec_mode = le16_to_cpu(rsp->SecurityMode); server->capabilities = le32_to_cpu(rsp->Capabilities); /* Internal types */ server->capabilities |= SMB2_NT_FIND | SMB2_LARGE_FILES; security_blob = smb2_get_data_area_len(&blob_offset, &blob_length, &rsp->hdr); /* * See MS-SMB2 section 2.2.4: if no blob, client picks default which * for us will be * ses->sectype = RawNTLMSSP; * but for time being this is our only auth choice so doesn't matter. * We just found a server which sets blob length to zero expecting raw. */ if (blob_length == 0) cifs_dbg(FYI, ""missing security blob on negprot\n""); rc = cifs_enable_signing(server, ses->sign); #ifdef CONFIG_SMB2_ASN1 /* BB REMOVEME when updated asn1.c ready */ if (rc) goto neg_exit; if (blob_length) rc = decode_neg_token_init(security_blob, blob_length, &server->sec_type); if (rc == 1) rc = 0; else if (rc == 0) { rc = -EIO; goto neg_exit; } #endif neg_exit: free_rsp_buf(resp_buftype, rsp); return rc; } ",0 "void perf_event_exec(void) { struct perf_event_context *ctx; int ctxn; rcu_read_lock(); for_each_task_context_nr(ctxn) { ctx = current->perf_event_ctxp[ctxn]; if (!ctx) continue; perf_event_enable_on_exec(ctx); } rcu_read_unlock(); } ",0 "void pin_insert_group(struct fs_pin *pin, struct vfsmount *m, struct hlist_head *p) { spin_lock(&pin_lock); if (p) hlist_add_head(&pin->s_list, p); hlist_add_head(&pin->m_list, &real_mount(m)->mnt_pins); spin_unlock(&pin_lock); } ",0 "int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr, int len, struct kvm_io_device *dev) { struct kvm_io_bus *new_bus, *bus; bus = kvm->buses[bus_idx]; /* exclude ioeventfd which is limited by maximum fd */ if (bus->dev_count - bus->ioeventfd_count > NR_IOBUS_DEVS - 1) return -ENOSPC; new_bus = kmalloc(sizeof(*bus) + ((bus->dev_count + 1) * sizeof(struct kvm_io_range)), GFP_KERNEL); if (!new_bus) return -ENOMEM; memcpy(new_bus, bus, sizeof(*bus) + (bus->dev_count * sizeof(struct kvm_io_range))); kvm_io_bus_insert_dev(new_bus, dev, addr, len); rcu_assign_pointer(kvm->buses[bus_idx], new_bus); synchronize_srcu_expedited(&kvm->srcu); kfree(bus); return 0; } ",0 "void GLES2DecoderImpl::DoRenderbufferStorageMultisample( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { if (!feature_info_->feature_flags().chromium_framebuffer_multisample) { SetGLError(GL_INVALID_OPERATION, ""glRenderbufferStorageMultisampleEXT"", ""function not available""); return; } RenderbufferManager::RenderbufferInfo* renderbuffer = GetRenderbufferInfoForTarget(GL_RENDERBUFFER); if (!renderbuffer) { SetGLError(GL_INVALID_OPERATION, ""glGetRenderbufferStorageMultisample"", ""no renderbuffer bound""); return; } if (samples > renderbuffer_manager()->max_samples()) { SetGLError(GL_INVALID_VALUE, ""glGetRenderbufferStorageMultisample"", ""samples too large""); return; } if (width > renderbuffer_manager()->max_renderbuffer_size() || height > renderbuffer_manager()->max_renderbuffer_size()) { SetGLError(GL_INVALID_VALUE, ""glGetRenderbufferStorageMultisample"", ""size too large""); return; } GLenum impl_format = internalformat; if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { switch (impl_format) { case GL_DEPTH_COMPONENT16: impl_format = GL_DEPTH_COMPONENT; break; case GL_RGBA4: case GL_RGB5_A1: impl_format = GL_RGBA; break; case GL_RGB565: impl_format = GL_RGB; break; } } CopyRealGLErrorsToWrapper(); if (IsAngle()) { glRenderbufferStorageMultisampleANGLE( target, samples, impl_format, width, height); } else { glRenderbufferStorageMultisampleEXT( target, samples, impl_format, width, height); } GLenum error = PeekGLError(); if (error == GL_NO_ERROR) { framebuffer_manager()->IncFramebufferStateChangeCount(); renderbuffer_manager()->SetInfo( renderbuffer, samples, internalformat, width, height); } } ",0 "pseudo_begin_execution() { thisRemoteResource->beginExecution(); return 0; } ",0 "void RenderProcessHostImpl::OnAec3Enabled() { DCHECK_CURRENTLY_ON(BrowserThread::UI); if (!aec3_set_callback_.is_null()) std::move(aec3_set_callback_).Run(true, std::string()); } ",0 "process_read(u_int32_t id) { u_char buf[64*1024]; u_int32_t len; int r, handle, fd, ret, status = SSH2_FX_FAILURE; u_int64_t off; if ((r = get_handle(iqueue, &handle)) != 0 || (r = sshbuf_get_u64(iqueue, &off)) != 0 || (r = sshbuf_get_u32(iqueue, &len)) != 0) fatal(""%s: buffer error: %s"", __func__, ssh_err(r)); debug(""request %u: read \""%s\"" (handle %d) off %llu len %d"", id, handle_to_name(handle), handle, (unsigned long long)off, len); if (len > sizeof buf) { len = sizeof buf; debug2(""read change len %d"", len); } fd = handle_to_fd(handle); if (fd >= 0) { if (lseek(fd, off, SEEK_SET) < 0) { error(""process_read: seek failed""); status = errno_to_portable(errno); } else { ret = read(fd, buf, len); if (ret < 0) { status = errno_to_portable(errno); } else if (ret == 0) { status = SSH2_FX_EOF; } else { send_data(id, buf, ret); status = SSH2_FX_OK; handle_update_read(handle, ret); } } } if (status != SSH2_FX_OK) send_status(id, status); } ",0 "BGD_DECLARE(int) gdTransformAffineGetImage(gdImagePtr *dst, const gdImagePtr src, gdRectPtr src_area, const double affine[6]) { int res; double m[6]; gdRect bbox; gdRect area_full; if (src_area == NULL) { area_full.x = 0; area_full.y = 0; area_full.width = gdImageSX(src); area_full.height = gdImageSY(src); src_area = &area_full; } gdTransformAffineBoundingBox(src_area, affine, &bbox); *dst = gdImageCreateTrueColor(bbox.width, bbox.height); if (*dst == NULL) { return GD_FALSE; } (*dst)->saveAlphaFlag = 1; if (!src->trueColor) { gdImagePaletteToTrueColor(src); } /* Translate to dst origin (0,0) */ gdAffineTranslate(m, -bbox.x, -bbox.y); gdAffineConcat(m, affine, m); gdImageAlphaBlending(*dst, 0); res = gdTransformAffineCopy(*dst, 0,0, src, src_area, m); if (res != GD_TRUE) { gdImageDestroy(*dst); *dst = NULL; return GD_FALSE; } else { return GD_TRUE; } } ",0 "static int verify_aead(struct nlattr **attrs) { struct nlattr *rt = attrs[XFRMA_ALG_AEAD]; struct xfrm_algo_aead *algp; if (!rt) return 0; algp = nla_data(rt); if (nla_len(rt) < aead_len(algp)) return -EINVAL; algp->alg_name[CRYPTO_MAX_ALG_NAME - 1] = '\0'; return 0; } ",0 "int tipc_socket_init(void) { int res; res = proto_register(&tipc_proto, 1); if (res) { pr_err(""Failed to register TIPC protocol type\n""); goto out; } res = sock_register(&tipc_family_ops); if (res) { pr_err(""Failed to register TIPC socket type\n""); proto_unregister(&tipc_proto); goto out; } sockets_enabled = 1; out: return res; } ",0 "static void ActivityLoggingAccessForIsolatedWorldsPerWorldBindingsLongAttributeAttributeGetterForMainWorld(const v8::FunctionCallbackInfo& info) { v8::Local holder = info.Holder(); TestObject* impl = V8TestObject::ToImpl(holder); V8SetReturnValueInt(info, impl->activityLoggingAccessForIsolatedWorldsPerWorldBindingsLongAttribute()); } ",0 "static inline unsigned short cma_family(struct rdma_id_private *id_priv) { return id_priv->id.route.addr.src_addr.ss_family; } ",0 "ReportSIBadType(CompatInfo *info, SymInterpInfo *si, const char *field, const char *wanted) { return ReportBadType(info->ctx, ""symbol interpretation"", field, siText(si, info), wanted); } ",0 "void XmlConfigParser::Parse(const std::string& input_buffer, std::string* output_buffer) { using logging::LOG_WARNING; DCHECK(output_buffer); xmlSAXHandler sax_handler = {}; sax_handler.startElement = &XmlConfigParser::StartElementImpl; sax_handler.endElement = &XmlConfigParser::EndElementImpl; sax_handler.characters = &XmlConfigParser::CharactersImpl; XmlConfigParser parser; int error = xmlSAXUserParseMemory(&sax_handler, &parser, input_buffer.c_str(), input_buffer.size()); if (error) { VLOG(LOG_WARNING) << ""Error parsing brandcoded master prefs, err="" << error; } else { output_buffer->swap(parser.master_prefs_); } } ",0 "static void write_branch_report(FILE *rpt, struct branch *b) { fprintf(rpt, ""%s:\n"", b->name); fprintf(rpt, "" status :""); if (b->active) fputs("" active"", rpt); if (b->branch_tree.tree) fputs("" loaded"", rpt); if (is_null_sha1(b->branch_tree.versions[1].sha1)) fputs("" dirty"", rpt); fputc('\n', rpt); fprintf(rpt, "" tip commit : %s\n"", sha1_to_hex(b->sha1)); fprintf(rpt, "" old tree : %s\n"", sha1_to_hex(b->branch_tree.versions[0].sha1)); fprintf(rpt, "" cur tree : %s\n"", sha1_to_hex(b->branch_tree.versions[1].sha1)); fprintf(rpt, "" commit clock: %"" PRIuMAX ""\n"", b->last_commit); fputs("" last pack : "", rpt); if (b->pack_id < MAX_PACK_ID) fprintf(rpt, ""%u"", b->pack_id); fputc('\n', rpt); fputc('\n', rpt); } ",0 "static int compact_treesame(struct rev_info *revs, struct commit *commit, unsigned nth_parent) { struct treesame_state *st; int old_same; if (!commit->parents) { /* * Have just removed the only parent from a non-merge. * Different handling, as we lack decoration. */ if (nth_parent != 0) die(""compact_treesame %u"", nth_parent); old_same = !!(commit->object.flags & TREESAME); if (rev_same_tree_as_empty(revs, commit)) commit->object.flags |= TREESAME; else commit->object.flags &= ~TREESAME; return old_same; } st = lookup_decoration(&revs->treesame, &commit->object); if (!st || nth_parent >= st->nparents) die(""compact_treesame %u"", nth_parent); old_same = st->treesame[nth_parent]; memmove(st->treesame + nth_parent, st->treesame + nth_parent + 1, st->nparents - nth_parent - 1); /* * If we've just become a non-merge commit, update TREESAME * immediately, and remove the no-longer-needed decoration. * If still a merge, defer update until update_treesame(). */ if (--st->nparents == 1) { if (commit->parents->next) die(""compact_treesame parents mismatch""); if (st->treesame[0] && revs->dense) commit->object.flags |= TREESAME; else commit->object.flags &= ~TREESAME; free(add_decoration(&revs->treesame, &commit->object, NULL)); } return old_same; } ",0 " FolderNameView() { SetBorder(views::Border::CreateEmptyBorder(1, 1, 1, 1)); const SkColor kFocusBorderColor = SkColorSetRGB(64, 128, 250); SetFocusPainter(views::Painter::CreateSolidFocusPainter( kFocusBorderColor, gfx::Insets(0, 0, 1, 1))); } ",0 " bool triggered() const { return m_triggered; } ",0 "static int encode_private_key(RSA *rsa, u8 *key, size_t *keysize) { u8 buf[1024], *p = buf; u8 bnbuf[256]; int base = 0; int r; const BIGNUM *rsa_p, *rsa_q, *rsa_dmp1, *rsa_dmq1, *rsa_iqmp; switch (RSA_bits(rsa)) { case 512: base = 32; break; case 768: base = 48; break; case 1024: base = 64; break; case 2048: base = 128; break; } if (base == 0) { fprintf(stderr, ""Key length invalid.\n""); return 2; } *p++ = (5 * base + 3) >> 8; *p++ = (5 * base + 3) & 0xFF; *p++ = opt_key_num; RSA_get0_factors(rsa, &rsa_p, &rsa_q); r = bn2cf(rsa_p, bnbuf); if (r != base) { fprintf(stderr, ""Invalid private key.\n""); return 2; } memcpy(p, bnbuf, base); p += base; r = bn2cf(rsa_q, bnbuf); if (r != base) { fprintf(stderr, ""Invalid private key.\n""); return 2; } memcpy(p, bnbuf, base); p += base; RSA_get0_crt_params(rsa, &rsa_dmp1, &rsa_dmq1, &rsa_iqmp); r = bn2cf(rsa_iqmp, bnbuf); if (r != base) { fprintf(stderr, ""Invalid private key.\n""); return 2; } memcpy(p, bnbuf, base); p += base; r = bn2cf(rsa_dmp1, bnbuf); if (r != base) { fprintf(stderr, ""Invalid private key.\n""); return 2; } memcpy(p, bnbuf, base); p += base; r = bn2cf(rsa_dmq1, bnbuf); if (r != base) { fprintf(stderr, ""Invalid private key.\n""); return 2; } memcpy(p, bnbuf, base); p += base; memcpy(key, buf, p - buf); *keysize = p - buf; return 0; } ",0 "OSCL_EXPORT_REF Bool PVCleanUpVideoDecoder(VideoDecControls *decCtrl) { int idx; VideoDecData *video = (VideoDecData *) decCtrl->videoDecoderData; #ifdef DEC_INTERNAL_MEMORY_OPT if (video) { #ifdef PV_POSTPROC_ON video->pstprcTypCur = NULL; video->pstprcTypPrv = NULL; #endif video->acPredFlag = NULL; video->sliceNo = NULL; video->motX = NULL; video->motY = NULL; video->mblock = NULL; video->QPMB = NULL; video->predDC = NULL; video->predDCAC_row = NULL; video->predDCAC_col = NULL; video->headerInfo.Mode = NULL; video->headerInfo.CBP = NULL; if (video->numberOfLayers > 1) { if (video->prevEnhcVop) { video->prevEnhcVop->uChan = NULL; video->prevEnhcVop->vChan = NULL; if (video->prevEnhcVop->yChan) oscl_free(video->prevEnhcVop->yChan); oscl_free(video->prevEnhcVop); } } if (video->currVop) { video->currVop->uChan = NULL; video->currVop->vChan = NULL; if (video->currVop->yChan) video->currVop->yChan = NULL; video->currVop = NULL; } if (video->prevVop) { video->prevVop->uChan = NULL; video->prevVop->vChan = NULL; if (video->prevVop->yChan) video->prevVop->yChan = NULL; video->prevVop = NULL; } if (video->vol) { for (idx = 0; idx < video->numberOfLayers; idx++) { if (video->vol[idx]) { BitstreamClose(video->vol[idx]->bitstream); video->vol[idx]->bitstream = NULL; video->vol[idx] = NULL; } video->vopHeader[idx] = NULL; } video->vol = NULL; video->vopHeader = NULL; } video = NULL; decCtrl->videoDecoderData = NULL; } #else if (video) { #ifdef PV_POSTPROC_ON if (video->pstprcTypCur) oscl_free(video->pstprcTypCur); if (video->pstprcTypPrv) oscl_free(video->pstprcTypPrv); #endif if (video->predDC) oscl_free(video->predDC); video->predDCAC_row = NULL; if (video->predDCAC_col) oscl_free(video->predDCAC_col); if (video->motX) oscl_free(video->motX); if (video->motY) oscl_free(video->motY); if (video->mblock) oscl_free(video->mblock); if (video->QPMB) oscl_free(video->QPMB); if (video->headerInfo.Mode) oscl_free(video->headerInfo.Mode); if (video->headerInfo.CBP) oscl_free(video->headerInfo.CBP); if (video->sliceNo) oscl_free(video->sliceNo); if (video->acPredFlag) oscl_free(video->acPredFlag); if (video->numberOfLayers > 1) { if (video->prevEnhcVop) { video->prevEnhcVop->uChan = NULL; video->prevEnhcVop->vChan = NULL; if (video->prevEnhcVop->yChan) oscl_free(video->prevEnhcVop->yChan); oscl_free(video->prevEnhcVop); } } if (video->currVop) { #ifndef PV_MEMORY_POOL video->currVop->uChan = NULL; video->currVop->vChan = NULL; if (video->currVop->yChan) oscl_free(video->currVop->yChan); #endif oscl_free(video->currVop); } if (video->prevVop) { #ifndef PV_MEMORY_POOL video->prevVop->uChan = NULL; video->prevVop->vChan = NULL; if (video->prevVop->yChan) oscl_free(video->prevVop->yChan); #endif oscl_free(video->prevVop); } if (video->vol) { for (idx = 0; idx < video->numberOfLayers; idx++) { if (video->vol[idx]) { if (video->vol[idx]->bitstream) { BitstreamClose(video->vol[idx]->bitstream); oscl_free(video->vol[idx]->bitstream); } oscl_free(video->vol[idx]); } } oscl_free(video->vol); } for (idx = 0; idx < video->numberOfLayers; idx++) { if (video->vopHeader[idx]) oscl_free(video->vopHeader[idx]); } if (video->vopHeader) oscl_free(video->vopHeader); oscl_free(video); decCtrl->videoDecoderData = NULL; } #endif return PV_TRUE; } ",0 "RunLengthStream::RunLengthStream(Stream *strA): FilterStream(strA) { bufPtr = bufEnd = buf; eof = gFalse; } ",0 "void task_mem(struct seq_file *m, struct mm_struct *mm) { unsigned long data, text, lib, swap; unsigned long hiwater_vm, total_vm, hiwater_rss, total_rss; /* * Note: to minimize their overhead, mm maintains hiwater_vm and * hiwater_rss only when about to *lower* total_vm or rss. Any * collector of these hiwater stats must therefore get total_vm * and rss too, which will usually be the higher. Barriers? not * worth the effort, such snapshots can always be inconsistent. */ hiwater_vm = total_vm = mm->total_vm; if (hiwater_vm < mm->hiwater_vm) hiwater_vm = mm->hiwater_vm; hiwater_rss = total_rss = get_mm_rss(mm); if (hiwater_rss < mm->hiwater_rss) hiwater_rss = mm->hiwater_rss; data = mm->total_vm - mm->shared_vm - mm->stack_vm; text = (PAGE_ALIGN(mm->end_code) - (mm->start_code & PAGE_MASK)) >> 10; lib = (mm->exec_vm << (PAGE_SHIFT-10)) - text; swap = get_mm_counter(mm, MM_SWAPENTS); seq_printf(m, ""VmPeak:\t%8lu kB\n"" ""VmSize:\t%8lu kB\n"" ""VmLck:\t%8lu kB\n"" ""VmHWM:\t%8lu kB\n"" ""VmRSS:\t%8lu kB\n"" ""VmData:\t%8lu kB\n"" ""VmStk:\t%8lu kB\n"" ""VmExe:\t%8lu kB\n"" ""VmLib:\t%8lu kB\n"" ""VmPTE:\t%8lu kB\n"" ""VmSwap:\t%8lu kB\n"", hiwater_vm << (PAGE_SHIFT-10), (total_vm - mm->reserved_vm) << (PAGE_SHIFT-10), mm->locked_vm << (PAGE_SHIFT-10), hiwater_rss << (PAGE_SHIFT-10), total_rss << (PAGE_SHIFT-10), data << (PAGE_SHIFT-10), mm->stack_vm << (PAGE_SHIFT-10), text, lib, (PTRS_PER_PTE*sizeof(pte_t)*mm->nr_ptes) >> 10, swap << (PAGE_SHIFT-10)); } ",0 "size_t mptsas_config_phy_1(MPTSASState *s, uint8_t **data, int address) { int phy_handle = -1; int dev_handle = -1; int i = mptsas_phy_addr_get(s, address); if (i < 0) { trace_mptsas_config_sas_phy(s, address, i, phy_handle, dev_handle, 1); return i; } (void) mptsas_phy_get_device(s, i, &phy_handle, &dev_handle); trace_mptsas_config_sas_phy(s, address, i, phy_handle, dev_handle, 1); return MPTSAS_CONFIG_PACK_EXT(1, MPI_CONFIG_EXTPAGETYPE_SAS_PHY, 0x01, ""*l*l*l*l*l""); } ",0 "void WallpaperManager::OnDeviceWallpaperExists(const AccountId& account_id, const std::string& url, const std::string& hash, bool exist) { if (exist) { base::PostTaskWithTraitsAndReplyWithResult( FROM_HERE, {base::MayBlock()}, base::Bind(&CheckDeviceWallpaperMatchHash, GetDeviceWallpaperFilePath(), hash), base::Bind(&WallpaperManager::OnCheckDeviceWallpaperMatchHash, weak_factory_.GetWeakPtr(), account_id, url, hash)); } else { GURL device_wallpaper_url(url); device_wallpaper_downloader_.reset(new CustomizationWallpaperDownloader( g_browser_process->system_request_context(), device_wallpaper_url, GetDeviceWallpaperDir(), GetDeviceWallpaperFilePath(), base::Bind(&WallpaperManager::OnDeviceWallpaperDownloaded, weak_factory_.GetWeakPtr(), account_id, hash))); device_wallpaper_downloader_->Start(); } } ",0 "void HTMLFormControlElement::setFormAction(const AtomicString& value) { setAttribute(formactionAttr, value); } ",0 "static void longMethodMethodCallback(const v8::FunctionCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMMethod""); TestObjectPythonV8Internal::longMethodMethod(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "uint64_t GLManager::GenerateFenceSyncRelease() { return next_fence_sync_release_++; } ",0 " void EnableAllActions() { actions_.insert(MediaSessionAction::kPlay); actions_.insert(MediaSessionAction::kPause); actions_.insert(MediaSessionAction::kPreviousTrack); actions_.insert(MediaSessionAction::kNextTrack); actions_.insert(MediaSessionAction::kSeekBackward); actions_.insert(MediaSessionAction::kSeekForward); actions_.insert(MediaSessionAction::kStop); NotifyUpdatedActions(); } ",0 "void CompositedLayerRasterInvalidator::Generate( const PaintArtifact& paint_artifact, const gfx::Rect& layer_bounds, const PropertyTreeState& layer_state, const FloatSize& visual_rect_subpixel_offset) { Generate(paint_artifact, paint_artifact.PaintChunks(), layer_bounds, layer_state, visual_rect_subpixel_offset); } ",0 "std::unique_ptr V8Debugger::createStackTrace(v8::Local stackTrace) { int contextGroupId = m_isolate->InContext() ? getGroupId(m_isolate->GetCurrentContext()) : 0; return V8StackTraceImpl::create(this, contextGroupId, stackTrace, V8StackTraceImpl::maxCallStackSizeToCapture); } ",0 " v8::Isolate* isolate() { return getScriptState()->isolate(); } ",0 " void WaitForHistory() { BlockUntilHistoryProcessesPendingRequests(history_service()); } ",0 "void V8TestObject::NodeFilterAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_nodeFilterAttribute_Getter""); test_object_v8_internal::NodeFilterAttributeAttributeGetter(info); } ",0 "void vsock_remove_connected(struct vsock_sock *vsk) { spin_lock_bh(&vsock_table_lock); __vsock_remove_connected(vsk); spin_unlock_bh(&vsock_table_lock); } ",0 "job_local_end (Device *device) { if (!device->priv->job_in_progress || device->priv->job != NULL) { g_warning (""There is no job running""); goto out; } device->priv->job_in_progress = FALSE; g_free (device->priv->job_id); device->priv->job_id = NULL; device->priv->job_initiated_by_uid = 0; device->priv->job_is_cancellable = FALSE; device->priv->job_percentage = -1.0; emit_job_changed (device); out: ; } ",0 "CanvasGradient* BaseRenderingContext2D::createRadialGradient( double x0, double y0, double r0, double x1, double y1, double r1, ExceptionState& exception_state) { if (r0 < 0 || r1 < 0) { exception_state.ThrowDOMException( kIndexSizeError, String::Format(""The %s provided is less than 0."", r0 < 0 ? ""r0"" : ""r1"")); return nullptr; } CanvasGradient* gradient = CanvasGradient::Create(FloatPoint(x0, y0), r0, FloatPoint(x1, y1), r1); return gradient; } ",0 "ecryptfs_write_metadata_to_contents(struct inode *ecryptfs_inode, char *virt, size_t virt_len) { int rc; rc = ecryptfs_write_lower(ecryptfs_inode, virt, 0, virt_len); if (rc < 0) printk(KERN_ERR ""%s: Error attempting to write header "" ""information to lower file; rc = [%d]\n"", __func__, rc); else rc = 0; return rc; } ",0 "void OfflinePageModelImpl::DeletePagesMissingArchiveFile( const std::set& archive_paths) { std::vector ids_of_pages_missing_archive_file; for (const auto& id_page_pair : offline_pages_) { if (archive_paths.count(id_page_pair.second.file_path) == 0UL) ids_of_pages_missing_archive_file.push_back(id_page_pair.first); } if (ids_of_pages_missing_archive_file.empty()) return; DeletePagesByOfflineId( ids_of_pages_missing_archive_file, base::Bind(&OfflinePageModelImpl::OnDeletePagesMissingArchiveFileDone, weak_ptr_factory_.GetWeakPtr(), ids_of_pages_missing_archive_file)); } ",0 "dotraplinkage void do_iret_error(struct pt_regs *regs, long error_code) { siginfo_t info; RCU_LOCKDEP_WARN(!rcu_is_watching(), ""entry code didn't wake RCU""); local_irq_enable(); info.si_signo = SIGILL; info.si_errno = 0; info.si_code = ILL_BADSTK; info.si_addr = NULL; if (notify_die(DIE_TRAP, ""iret exception"", regs, error_code, X86_TRAP_IRET, SIGILL) != NOTIFY_STOP) { do_trap(X86_TRAP_IRET, SIGILL, ""iret exception"", regs, error_code, &info); } } ",0 "gst_asf_demux_process_ext_content_desc (GstASFDemux * demux, guint8 * data, guint64 size) { /* Other known (and unused) 'text/unicode' metadata available : * * WM/Lyrics = * WM/MediaPrimaryClassID = {D1607DBC-E323-4BE2-86A1-48A42A28441E} * WMFSDKVersion = 9.00.00.2980 * WMFSDKNeeded = 0.0.0.0000 * WM/UniqueFileIdentifier = AMGa_id=R 15334;AMGp_id=P 5149;AMGt_id=T 2324984 * WM/Publisher = 4AD * WM/Provider = AMG * WM/ProviderRating = 8 * WM/ProviderStyle = Rock (similar to WM/Genre) * WM/GenreID (similar to WM/Genre) * WM/TrackNumber (same as WM/Track but as a string) * * Other known (and unused) 'non-text' metadata available : * * WM/EncodingTime * WM/MCDI * IsVBR * * We might want to read WM/TrackNumber and use atoi() if we don't have * WM/Track */ GstTagList *taglist; guint16 blockcount, i; gboolean content3D = FALSE; struct { const gchar *interleave_name; GstASF3DMode interleaving_type; } stereoscopic_layout_map[] = { { ""SideBySideRF"", GST_ASF_3D_SIDE_BY_SIDE_HALF_RL}, { ""SideBySideLF"", GST_ASF_3D_SIDE_BY_SIDE_HALF_LR}, { ""OverUnderRT"", GST_ASF_3D_TOP_AND_BOTTOM_HALF_RL}, { ""OverUnderLT"", GST_ASF_3D_TOP_AND_BOTTOM_HALF_LR}, { ""DualStream"", GST_ASF_3D_DUAL_STREAM} }; GST_INFO_OBJECT (demux, ""object is an extended content description""); taglist = gst_tag_list_new_empty (); /* Content Descriptor Count */ if (size < 2) goto not_enough_data; blockcount = gst_asf_demux_get_uint16 (&data, &size); for (i = 1; i <= blockcount; ++i) { const gchar *gst_tag_name; guint16 datatype; guint16 value_len; guint16 name_len; GValue tag_value = { 0, }; gsize in, out; gchar *name; gchar *name_utf8 = NULL; gchar *value; /* Descriptor */ if (!gst_asf_demux_get_string (&name, &name_len, &data, &size)) goto not_enough_data; if (size < 2) { g_free (name); goto not_enough_data; } /* Descriptor Value Data Type */ datatype = gst_asf_demux_get_uint16 (&data, &size); /* Descriptor Value (not really a string, but same thing reading-wise) */ if (!gst_asf_demux_get_string (&value, &value_len, &data, &size)) { g_free (name); goto not_enough_data; } name_utf8 = g_convert (name, name_len, ""UTF-8"", ""UTF-16LE"", &in, &out, NULL); if (name_utf8 != NULL) { GST_DEBUG (""Found tag/metadata %s"", name_utf8); gst_tag_name = gst_asf_demux_get_gst_tag_from_tag_name (name_utf8); GST_DEBUG (""gst_tag_name %s"", GST_STR_NULL (gst_tag_name)); switch (datatype) { case ASF_DEMUX_DATA_TYPE_UTF16LE_STRING:{ gchar *value_utf8; value_utf8 = g_convert (value, value_len, ""UTF-8"", ""UTF-16LE"", &in, &out, NULL); /* get rid of tags with empty value */ if (value_utf8 != NULL && *value_utf8 != '\0') { GST_DEBUG (""string value %s"", value_utf8); value_utf8[out] = '\0'; if (gst_tag_name != NULL) { if (strcmp (gst_tag_name, GST_TAG_DATE_TIME) == 0) { guint year = atoi (value_utf8); if (year > 0) { g_value_init (&tag_value, GST_TYPE_DATE_TIME); g_value_take_boxed (&tag_value, gst_date_time_new_y (year)); } } else if (strcmp (gst_tag_name, GST_TAG_GENRE) == 0) { guint id3v1_genre_id; const gchar *genre_str; if (sscanf (value_utf8, ""(%u)"", &id3v1_genre_id) == 1 && ((genre_str = gst_tag_id3_genre_get (id3v1_genre_id)))) { GST_DEBUG (""Genre: %s -> %s"", value_utf8, genre_str); g_free (value_utf8); value_utf8 = g_strdup (genre_str); } } else { GType tag_type; /* convert tag from string to other type if required */ tag_type = gst_tag_get_type (gst_tag_name); g_value_init (&tag_value, tag_type); if (!gst_value_deserialize (&tag_value, value_utf8)) { GValue from_val = { 0, }; g_value_init (&from_val, G_TYPE_STRING); g_value_set_string (&from_val, value_utf8); if (!g_value_transform (&from_val, &tag_value)) { GST_WARNING_OBJECT (demux, ""Could not transform string tag to "" ""%s tag type %s"", gst_tag_name, g_type_name (tag_type)); g_value_unset (&tag_value); } g_value_unset (&from_val); } } } else { /* metadata ! */ GST_DEBUG (""Setting metadata""); g_value_init (&tag_value, G_TYPE_STRING); g_value_set_string (&tag_value, value_utf8); /* If we found a stereoscopic marker, look for StereoscopicLayout * metadata */ if (content3D) { guint i; if (strncmp (""StereoscopicLayout"", name_utf8, strlen (name_utf8)) == 0) { for (i = 0; i < G_N_ELEMENTS (stereoscopic_layout_map); i++) { if (g_str_equal (stereoscopic_layout_map[i].interleave_name, value_utf8)) { demux->asf_3D_mode = stereoscopic_layout_map[i].interleaving_type; GST_INFO (""find interleave type %u"", demux->asf_3D_mode); } } } GST_INFO_OBJECT (demux, ""3d type is %u"", demux->asf_3D_mode); } else { demux->asf_3D_mode = GST_ASF_3D_NONE; GST_INFO_OBJECT (demux, ""None 3d type""); } } } else if (value_utf8 == NULL) { GST_WARNING (""Failed to convert string value to UTF8, skipping""); } else { GST_DEBUG (""Skipping empty string value for %s"", GST_STR_NULL (gst_tag_name)); } g_free (value_utf8); break; } case ASF_DEMUX_DATA_TYPE_BYTE_ARRAY:{ if (gst_tag_name) { if (!g_str_equal (gst_tag_name, GST_TAG_IMAGE)) { GST_FIXME (""Unhandled byte array tag %s"", GST_STR_NULL (gst_tag_name)); break; } else { asf_demux_parse_picture_tag (taglist, (guint8 *) value, value_len); } } break; } case ASF_DEMUX_DATA_TYPE_DWORD:{ guint uint_val = GST_READ_UINT32_LE (value); /* this is the track number */ g_value_init (&tag_value, G_TYPE_UINT); /* WM/Track counts from 0 */ if (!strcmp (name_utf8, ""WM/Track"")) ++uint_val; g_value_set_uint (&tag_value, uint_val); break; } /* Detect 3D */ case ASF_DEMUX_DATA_TYPE_BOOL:{ gboolean bool_val = GST_READ_UINT32_LE (value); if (strncmp (""Stereoscopic"", name_utf8, strlen (name_utf8)) == 0) { if (bool_val) { GST_INFO_OBJECT (demux, ""This is 3D contents""); content3D = TRUE; } else { GST_INFO_OBJECT (demux, ""This is not 3D contenst""); content3D = FALSE; } } break; } default:{ GST_DEBUG (""Skipping tag %s of type %d"", gst_tag_name, datatype); break; } } if (G_IS_VALUE (&tag_value)) { if (gst_tag_name) { GstTagMergeMode merge_mode = GST_TAG_MERGE_APPEND; /* WM/TrackNumber is more reliable than WM/Track, since the latter * is supposed to have a 0 base but is often wrongly written to start * from 1 as well, so prefer WM/TrackNumber when we have it: either * replace the value added earlier from WM/Track or put it first in * the list, so that it will get picked up by _get_uint() */ if (strcmp (name_utf8, ""WM/TrackNumber"") == 0) merge_mode = GST_TAG_MERGE_REPLACE; gst_tag_list_add_values (taglist, merge_mode, gst_tag_name, &tag_value, NULL); } else { GST_DEBUG (""Setting global metadata %s"", name_utf8); gst_structure_set_value (demux->global_metadata, name_utf8, &tag_value); } g_value_unset (&tag_value); } } g_free (name); g_free (value); g_free (name_utf8); } gst_asf_demux_add_global_tags (demux, taglist); return GST_FLOW_OK; /* Errors */ not_enough_data: { GST_WARNING (""Unexpected end of data parsing ext content desc object""); gst_tag_list_unref (taglist); return GST_FLOW_OK; /* not really fatal */ } } ",1 "static int walk_component(struct nameidata *nd, int flags) { struct path path; struct inode *inode; unsigned seq; int err; /* * ""."" and "".."" are special - "".."" especially so because it has * to be able to know about the current root directory and * parent relationships. */ if (unlikely(nd->last_type != LAST_NORM)) { err = handle_dots(nd, nd->last_type); if (flags & WALK_PUT) put_link(nd); return err; } err = lookup_fast(nd, &path, &inode, &seq); if (unlikely(err <= 0)) { if (err < 0) return err; path.dentry = lookup_slow(&nd->last, nd->path.dentry, nd->flags); if (IS_ERR(path.dentry)) return PTR_ERR(path.dentry); path.mnt = nd->path.mnt; err = follow_managed(&path, nd); if (unlikely(err < 0)) return err; if (unlikely(d_is_negative(path.dentry))) { path_to_nameidata(&path, nd); return -ENOENT; } seq = 0; /* we are already out of RCU mode */ inode = d_backing_inode(path.dentry); } if (flags & WALK_PUT) put_link(nd); err = should_follow_link(nd, &path, flags & WALK_GET, inode, seq); if (unlikely(err)) return err; path_to_nameidata(&path, nd); nd->inode = inode; nd->seq = seq; return 0; } ",0 "static void ip6_copy_metadata(struct sk_buff *to, struct sk_buff *from) { to->pkt_type = from->pkt_type; to->priority = from->priority; to->protocol = from->protocol; skb_dst_drop(to); skb_dst_set(to, dst_clone(skb_dst(from))); to->dev = from->dev; to->mark = from->mark; skb_copy_hash(to, from); #ifdef CONFIG_NET_SCHED to->tc_index = from->tc_index; #endif nf_copy(to, from); skb_copy_secmark(to, from); } ",0 "static void mntns_put(void *ns) { put_mnt_ns(ns); } ",0 "SegmentInfo::SegmentInfo( Segment* pSegment, long long start, long long size_, long long element_start, long long element_size) : m_pSegment(pSegment), m_start(start), m_size(size_), m_element_start(element_start), m_element_size(element_size), m_pMuxingAppAsUTF8(NULL), m_pWritingAppAsUTF8(NULL), m_pTitleAsUTF8(NULL) { } ",1 "void set_scl(int state) { I2C_SCL(state); } ",0 "static ZIPARCHIVE_METHOD(unchangeName) { struct zip *intern; zval *this = getThis(); struct zip_stat sb; char *name; int name_len; if (!this) { RETURN_FALSE; } ZIP_FROM_OBJECT(intern, this); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""s"", &name, &name_len) == FAILURE) { return; } if (name_len < 1) { RETURN_FALSE; } PHP_ZIP_STAT_PATH(intern, name, name_len, 0, sb); if (zip_unchange(intern, sb.index) != 0) { RETURN_FALSE; } else { RETURN_TRUE; } } ",0 "static ssize_t environ_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { char *page; unsigned long src = *ppos; int ret = 0; struct mm_struct *mm = file->private_data; unsigned long env_start, env_end; if (!mm) return 0; page = (char *)__get_free_page(GFP_TEMPORARY); if (!page) return -ENOMEM; ret = 0; if (!atomic_inc_not_zero(&mm->mm_users)) goto free; down_read(&mm->mmap_sem); env_start = mm->env_start; env_end = mm->env_end; up_read(&mm->mmap_sem); while (count > 0) { size_t this_len, max_len; int retval; if (src >= (env_end - env_start)) break; this_len = env_end - (env_start + src); max_len = min_t(size_t, PAGE_SIZE, count); this_len = min(max_len, this_len); retval = access_remote_vm(mm, (env_start + src), page, this_len, 0); if (retval <= 0) { ret = retval; break; } if (copy_to_user(buf, page, retval)) { ret = -EFAULT; break; } ret += retval; src += retval; buf += retval; count -= retval; } *ppos = src; mmput(mm); free: free_page((unsigned long) page); return ret; } ",1 "static void send_monitor_event(struct sk_buff *skb) { struct sock *sk; BT_DBG(""len %d"", skb->len); read_lock(&hci_sk_list.lock); sk_for_each(sk, &hci_sk_list.head) { struct sk_buff *nskb; if (sk->sk_state != BT_BOUND) continue; if (hci_pi(sk)->channel != HCI_CHANNEL_MONITOR) continue; nskb = skb_clone(skb, GFP_ATOMIC); if (!nskb) continue; if (sock_queue_rcv_skb(sk, nskb)) kfree_skb(nskb); } read_unlock(&hci_sk_list.lock); } ",0 "static int smb311_decode_neg_context(struct smb2_negotiate_rsp *rsp, struct TCP_Server_Info *server, unsigned int len_of_smb) { struct smb2_neg_context *pctx; unsigned int offset = le32_to_cpu(rsp->NegotiateContextOffset); unsigned int ctxt_cnt = le16_to_cpu(rsp->NegotiateContextCount); unsigned int len_of_ctxts, i; int rc = 0; cifs_dbg(FYI, ""decoding %d negotiate contexts\n"", ctxt_cnt); if (len_of_smb <= offset) { cifs_dbg(VFS, ""Invalid response: negotiate context offset\n""); return -EINVAL; } len_of_ctxts = len_of_smb - offset; for (i = 0; i < ctxt_cnt; i++) { int clen; /* check that offset is not beyond end of SMB */ if (len_of_ctxts == 0) break; if (len_of_ctxts < sizeof(struct smb2_neg_context)) break; pctx = (struct smb2_neg_context *)(offset + (char *)rsp); clen = le16_to_cpu(pctx->DataLength); if (clen > len_of_ctxts) break; if (pctx->ContextType == SMB2_PREAUTH_INTEGRITY_CAPABILITIES) decode_preauth_context( (struct smb2_preauth_neg_context *)pctx); else if (pctx->ContextType == SMB2_ENCRYPTION_CAPABILITIES) rc = decode_encrypt_ctx(server, (struct smb2_encryption_neg_context *)pctx); else if (pctx->ContextType == SMB2_POSIX_EXTENSIONS_AVAILABLE) server->posix_ext_supported = true; else cifs_dbg(VFS, ""unknown negcontext of type %d ignored\n"", le16_to_cpu(pctx->ContextType)); if (rc) break; /* offsets must be 8 byte aligned */ clen = (clen + 7) & ~0x7; offset += clen + sizeof(struct smb2_neg_context); len_of_ctxts -= clen; } return rc; } ",0 "INST_HANDLER (subi) { // SUBI Rd, k int d = ((buf[0] >> 4) & 0xf) + 16; int k = ((buf[1] & 0xf) << 4) | (buf[0] & 0xf); op->val = k; ESIL_A (""%d,r%d,-,"", k, d); // 0: (Rd-k) __generic_sub_update_flags_rk (op, d, k, 1); // FLAGS (no carry) ESIL_A (""r%d,=,"", d); // Rd = Result } ",0 "static struct vm_area_struct *next_vma(struct vm_area_struct *this_vma, struct vm_area_struct *gate_vma) { struct vm_area_struct *ret; ret = this_vma->vm_next; if (ret) return ret; if (this_vma == gate_vma) return NULL; return gate_vma; } ",0 "int SVGElement::tabIndex() const { if (SupportsFocus()) return Element::tabIndex(); return -1; } ",0 "ExtensionContextMenuModel::~ExtensionContextMenuModel() { } ",0 "size_t nlmsg_get_max_size(struct nl_msg *msg) { return msg->nm_size; } ",0 "void HTMLSelectElement::listBoxOnChange() { ASSERT(!usesMenuList() || m_multiple); const Vector& items = listItems(); if (m_lastOnChangeSelection.isEmpty() || m_lastOnChangeSelection.size() != items.size()) { dispatchFormControlChangeEvent(); return; } bool fireOnChange = false; for (unsigned i = 0; i < items.size(); ++i) { HTMLElement* element = items[i]; bool selected = element->hasTagName(optionTag) && toHTMLOptionElement(element)->selected(); if (selected != m_lastOnChangeSelection[i]) fireOnChange = true; m_lastOnChangeSelection[i] = selected; } if (fireOnChange) dispatchFormControlChangeEvent(); } ",0 "static union _zend_function *row_get_ctor(zval *object TSRMLS_DC) { static zend_internal_function ctor = {0}; ctor.type = ZEND_INTERNAL_FUNCTION; ctor.function_name = ""__construct""; ctor.scope = pdo_row_ce; ctor.handler = ZEND_FN(dbstmt_constructor); ctor.fn_flags = ZEND_ACC_PUBLIC; return (union _zend_function*)&ctor; } ",0 "run_question (CommonJob *job, char *primary_text, char *secondary_text, const char *details_text, gboolean show_all, ...) { va_list varargs; int res; va_start (varargs, show_all); res = run_simple_dialog_va (job, FALSE, GTK_MESSAGE_QUESTION, primary_text, secondary_text, details_text, show_all, varargs); va_end (varargs); return res; } ",0 "void recompute_msgmni(struct ipc_namespace *ns) { struct sysinfo i; unsigned long allowed; int nb_ns; si_meminfo(&i); allowed = (((i.totalram - i.totalhigh) / MSG_MEM_SCALE) * i.mem_unit) / MSGMNB; nb_ns = atomic_read(&nr_ipc_ns); allowed /= nb_ns; if (allowed < MSGMNI) { ns->msg_ctlmni = MSGMNI; return; } if (allowed > IPCMNI / nb_ns) { ns->msg_ctlmni = IPCMNI / nb_ns; return; } ns->msg_ctlmni = allowed; } ",0 "static int dbstmt_compare(zval *object1, zval *object2 TSRMLS_DC) { return -1; } ",0 "static void f_midi_rmidi_free(struct snd_rawmidi *rmidi) { f_midi_free(rmidi->private_data); } ",0 "DOMHighResTimeStamp Performance::MonotonicTimeToDOMHighResTimeStamp( TimeTicks time_origin, TimeTicks monotonic_time, bool allow_negative_value) { if (monotonic_time.is_null() || time_origin.is_null()) return 0.0; double clamped_time_in_seconds = ClampTimeResolution(TimeTicksInSeconds(monotonic_time)) - ClampTimeResolution(TimeTicksInSeconds(time_origin)); if (clamped_time_in_seconds < 0 && !allow_negative_value) return 0.0; return ConvertSecondsToDOMHighResTimeStamp(clamped_time_in_seconds); } ",0 "bool XSSAuditor::isSafeToSendToAnotherThread() const { return m_documentURL.isSafeToSendToAnotherThread() && m_decodedURL.isSafeToSendToAnotherThread() && m_decodedHTTPBody.isSafeToSendToAnotherThread(); } ",0 "void ExtensionPrefs::SetBrowserActionVisibility(const Extension* extension, bool visible) { if (GetBrowserActionVisibility(extension) == visible) return; UpdateExtensionPref(extension->id(), kBrowserActionVisible, Value::CreateBooleanValue(visible)); content::NotificationService::current()->Notify( chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED, content::Source(this), content::Details(extension)); } ",0 "void AudioOutputDeviceTest::ExpectRenderCallback(bool synchronized_io) { const int kMemorySize = CalculateMemorySize(synchronized_io); EXPECT_CALL(audio_output_ipc_, PlayStream(kStreamId)) .WillOnce(SendPendingBytes(&browser_socket_, kMemorySize)); if (synchronized_io) { EXPECT_CALL(callback_, RenderIO(_, _, _)) .WillOnce(QuitLoop(io_loop_.message_loop_proxy())); } else { const int kNumberOfFramesToProcess = 0; EXPECT_CALL(callback_, Render(_, _)) .WillOnce(DoAll( QuitLoop(io_loop_.message_loop_proxy()), Return(kNumberOfFramesToProcess))); } } ",0 "void RenderBox::computeAndSetBlockDirectionMargins(const RenderBlock* containingBlock) { LayoutUnit marginBefore; LayoutUnit marginAfter; computeBlockDirectionMargins(containingBlock, marginBefore, marginAfter); containingBlock->setMarginBeforeForChild(this, marginBefore); containingBlock->setMarginAfterForChild(this, marginAfter); } ",0 "dns_run_resolution(struct dns_resolution *resolution) { struct dns_resolvers *resolvers = resolution->resolvers; int query_id, i; /* Avoid sending requests for resolutions that don't yet have an * hostname, ie resolutions linked to servers that do not yet have an * fqdn */ if (!resolution->hostname_dn) return 0; /* Check if a resolution has already been started for this server return * directly to avoid resolution pill up. */ if (resolution->step != RSLV_STEP_NONE) return 0; /* Generates a new query id. We try at most 100 times to find a free * query id */ for (i = 0; i < 100; ++i) { query_id = dns_rnd16(); if (!eb32_lookup(&resolvers->query_ids, query_id)) break; query_id = -1; } if (query_id == -1) { send_log(NULL, LOG_NOTICE, ""could not generate a query id for %s, in resolvers %s.\n"", resolution->hostname_dn, resolvers->id); return -1; } /* Update resolution parameters */ resolution->query_id = query_id; resolution->qid.key = query_id; resolution->step = RSLV_STEP_RUNNING; resolution->query_type = resolution->prefered_query_type; resolution->try = resolvers->resolve_retries; eb32_insert(&resolvers->query_ids, &resolution->qid); /* Send the DNS query */ resolution->try -= 1; dns_send_query(resolution); return 1; } ",0 " void HTMLMediaElement::ContextDestroyed(ExecutionContext*) { BLINK_MEDIA_LOG << ""contextDestroyed("" << (void*)this << "")""; CancelPendingEventsAndCallbacks(); ClearMediaPlayer(); ready_state_ = kHaveNothing; ready_state_maximum_ = kHaveNothing; SetNetworkState(kNetworkEmpty); SetShouldDelayLoadEvent(false); current_source_node_ = nullptr; official_playback_position_ = 0; official_playback_position_needs_update_ = true; GetCueTimeline().UpdateActiveCues(0); playing_ = false; paused_ = true; seeking_ = false; if (GetLayoutObject()) GetLayoutObject()->UpdateFromElement(); StopPeriodicTimers(); removed_from_document_timer_.Stop(); } ",0 "static int init_shdr(ELFOBJ *bin) { ut32 shdr_size; ut8 shdr[sizeof (Elf_(Shdr))] = {0}; int i, j, len; if (!bin || bin->shdr) { return true; } if (!UT32_MUL (&shdr_size, bin->ehdr.e_shnum, sizeof (Elf_(Shdr)))) { return false; } if (shdr_size < 1) { return false; } if (shdr_size > bin->size) { return false; } if (bin->ehdr.e_shoff > bin->size) { return false; } if (bin->ehdr.e_shoff + shdr_size > bin->size) { return false; } if (!(bin->shdr = calloc (1, shdr_size + 1))) { perror (""malloc (shdr)""); return false; } sdb_num_set (bin->kv, ""elf_shdr.offset"", bin->ehdr.e_shoff, 0); sdb_num_set (bin->kv, ""elf_shdr.size"", sizeof (Elf_(Shdr)), 0); sdb_set (bin->kv, ""elf_s_type.cparse"", ""enum elf_s_type {SHT_NULL=0,SHT_PROGBITS=1,"" ""SHT_SYMTAB=2,SHT_STRTAB=3,SHT_RELA=4,SHT_HASH=5,SHT_DYNAMIC=6,SHT_NOTE=7,"" ""SHT_NOBITS=8,SHT_REL=9,SHT_SHLIB=10,SHT_DYNSYM=11,SHT_LOOS=0x60000000,"" ""SHT_HIOS=0x6fffffff,SHT_LOPROC=0x70000000,SHT_HIPROC=0x7fffffff};"", 0); for (i = 0; i < bin->ehdr.e_shnum; i++) { j = 0; len = r_buf_read_at (bin->b, bin->ehdr.e_shoff + i * sizeof (Elf_(Shdr)), shdr, sizeof (Elf_(Shdr))); if (len < 1) { bprintf (""Warning: read (shdr) at 0x%""PFMT64x""\n"", (ut64) bin->ehdr.e_shoff); R_FREE (bin->shdr); return false; } bin->shdr[i].sh_name = READ32 (shdr, j) bin->shdr[i].sh_type = READ32 (shdr, j) #if R_BIN_ELF64 bin->shdr[i].sh_flags = READ64 (shdr, j) bin->shdr[i].sh_addr = READ64 (shdr, j) bin->shdr[i].sh_offset = READ64 (shdr, j) bin->shdr[i].sh_size = READ64 (shdr, j) bin->shdr[i].sh_link = READ32 (shdr, j) bin->shdr[i].sh_info = READ32 (shdr, j) bin->shdr[i].sh_addralign = READ64 (shdr, j) bin->shdr[i].sh_entsize = READ64 (shdr, j) #else bin->shdr[i].sh_flags = READ32 (shdr, j) bin->shdr[i].sh_addr = READ32 (shdr, j) bin->shdr[i].sh_offset = READ32 (shdr, j) bin->shdr[i].sh_size = READ32 (shdr, j) bin->shdr[i].sh_link = READ32 (shdr, j) bin->shdr[i].sh_info = READ32 (shdr, j) bin->shdr[i].sh_addralign = READ32 (shdr, j) bin->shdr[i].sh_entsize = READ32 (shdr, j) #endif } #if R_BIN_ELF64 sdb_set (bin->kv, ""elf_s_flags_64.cparse"", ""enum elf_s_flags_64 {SF64_None=0,SF64_Exec=1,"" ""SF64_Alloc=2,SF64_Alloc_Exec=3,SF64_Write=4,SF64_Write_Exec=5,"" ""SF64_Write_Alloc=6,SF64_Write_Alloc_Exec=7};"", 0); sdb_set (bin->kv, ""elf_shdr.format"", ""x[4]E[8]Eqqqxxqq name (elf_s_type)type"" "" (elf_s_flags_64)flags addr offset size link info addralign entsize"", 0); #else sdb_set (bin->kv, ""elf_s_flags_32.cparse"", ""enum elf_s_flags_32 {SF32_None=0,SF32_Exec=1,"" ""SF32_Alloc=2,SF32_Alloc_Exec=3,SF32_Write=4,SF32_Write_Exec=5,"" ""SF32_Write_Alloc=6,SF32_Write_Alloc_Exec=7};"", 0); sdb_set (bin->kv, ""elf_shdr.format"", ""x[4]E[4]Exxxxxxx name (elf_s_type)type"" "" (elf_s_flags_32)flags addr offset size link info addralign entsize"", 0); #endif return true; } ",0 "SVGAnimateElement::SVGAnimateElement(const QualifiedName& tagName, Document& document) : SVGAnimationElement(tagName, document) , m_animatedPropertyType(AnimatedString) { ASSERT(hasTagName(SVGNames::animateTag) || hasTagName(SVGNames::setTag) || hasTagName(SVGNames::animateColorTag) || hasTagName(SVGNames::animateTransformTag)); ScriptWrappable::init(this); } ",0 "static bool sock_needs_netstamp(const struct sock *sk) { switch (sk->sk_family) { case AF_UNSPEC: case AF_UNIX: return false; default: return true; } } ",0 "int32_t Parcel::readExceptionCode() const { binder::Status status; status.readFromParcel(*this); return status.exceptionCode(); } ",0 "static void conditionalRuntimeEnabledLongAttributeAttributeGetterCallback(v8::Local, const v8::PropertyCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMGetter""); TestObjectPythonV8Internal::conditionalRuntimeEnabledLongAttributeAttributeGetter(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "static inline bool ShouldAlwaysUseDirectionalSelection(LocalFrame* frame) { return frame->GetEditor().Behavior().ShouldConsiderSelectionAsDirectional(); } ",0 " virtual status_t getUri(String8 *uri) { *uri = String8(""""); Parcel data, reply; data.writeInterfaceToken( IMediaHTTPConnection::getInterfaceDescriptor()); remote()->transact(GET_URI, data, &reply); int32_t exceptionCode = reply.readExceptionCode(); if (exceptionCode) { return UNKNOWN_ERROR; } *uri = String8(reply.readString16()); return OK; } ",0 "void ChangeListLoader::LoadChangeListFromServerAfterUpdate( ChangeListProcessor* change_list_processor, bool should_notify_changed_directories, const base::Time& start_time, FileError error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); const base::TimeDelta elapsed = base::Time::Now() - start_time; util::Log(logging::LOG_INFO, ""Change lists applied (elapsed time: %sms)"", base::Int64ToString(elapsed.InMilliseconds()).c_str()); if (should_notify_changed_directories) { for (std::set::iterator dir_iter = change_list_processor->changed_dirs().begin(); dir_iter != change_list_processor->changed_dirs().end(); ++dir_iter) { FOR_EACH_OBSERVER(ChangeListLoaderObserver, observers_, OnDirectoryChanged(*dir_iter)); } } OnChangeListLoadComplete(error); FOR_EACH_OBSERVER(ChangeListLoaderObserver, observers_, OnLoadFromServerComplete()); } ",0 "static int pcrypt_aead_decrypt(struct aead_request *req) { int err; struct pcrypt_request *preq = aead_request_ctx(req); struct aead_request *creq = pcrypt_request_ctx(preq); struct padata_priv *padata = pcrypt_request_padata(preq); struct crypto_aead *aead = crypto_aead_reqtfm(req); struct pcrypt_aead_ctx *ctx = crypto_aead_ctx(aead); u32 flags = aead_request_flags(req); memset(padata, 0, sizeof(struct padata_priv)); padata->parallel = pcrypt_aead_dec; padata->serial = pcrypt_aead_serial; aead_request_set_tfm(creq, ctx->child); aead_request_set_callback(creq, flags & ~CRYPTO_TFM_REQ_MAY_SLEEP, pcrypt_aead_done, req); aead_request_set_crypt(creq, req->src, req->dst, req->cryptlen, req->iv); aead_request_set_ad(creq, req->assoclen); err = pcrypt_do_parallel(padata, &ctx->cb_cpu, &pdecrypt); if (!err) return -EINPROGRESS; return err; } ",0 "chomp (char *s) { size_t len; if (s && (len = strlen (s)) > 0 && s[len - 1] == '\n') { s[--len] = 0; if (len > 0 && s[len - 1] == '\r') s[--len] = 0; } } ",0 "void qeth_clear_thread_start_bit(struct qeth_card *card, unsigned long thread) { unsigned long flags; spin_lock_irqsave(&card->thread_mask_lock, flags); card->thread_start_mask &= ~thread; spin_unlock_irqrestore(&card->thread_mask_lock, flags); wake_up(&card->wait_q); } ",0 " explicit ChromePrintContext(LocalFrame* frame) : PrintContext(frame), printed_page_width_(0) {} ",0 "static inline void perf_read_regs(struct pt_regs *regs) { } ",0 "static struct MHD_Response *create_response_file(const char *nurl, const char *method, unsigned int *rp_code, const char *fpath) { struct stat st; int ret; FILE *file; ret = stat(fpath, &st); if (!ret && (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode))) { file = fopen(fpath, ""rb""); if (file) { *rp_code = MHD_HTTP_OK; if (!st.st_size) { fclose(file); return MHD_create_response_from_data (0, NULL, MHD_NO, MHD_NO); } return MHD_create_response_from_callback (st.st_size, 32 * 1024, &file_reader, file, (MHD_ContentReaderFreeCallback)&fclose); } else { log_err(""Failed to open: %s."", fpath); } } return NULL; } ",0 "archive_read_support_format_xar(struct archive *_a) { struct archive_read *a = (struct archive_read *)_a; archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_NEW, ""archive_read_support_format_xar""); archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, ""Xar not supported on this platform""); return (ARCHIVE_WARN); } ",0 "xfs_da_grow_inode( struct xfs_da_args *args, xfs_dablk_t *new_blkno) { xfs_fileoff_t bno; int count; int error; trace_xfs_da_grow_inode(args); if (args->whichfork == XFS_DATA_FORK) { bno = args->dp->i_mount->m_dirleafblk; count = args->dp->i_mount->m_dirblkfsbs; } else { bno = 0; count = 1; } error = xfs_da_grow_inode_int(args, &bno, count); if (!error) *new_blkno = (xfs_dablk_t)bno; return error; } ",0 "AuthenticatorNoAvailableTransportsErrorModel::GetStepIllustration( ImageColorScheme color_scheme) const { return color_scheme == ImageColorScheme::kDark ? kWebauthnErrorDarkIcon : kWebauthnErrorIcon; } ",0 "static ssize_t aio_run_iocb(struct kiocb *req, unsigned opcode, char __user *buf, size_t len, bool compat) { struct file *file = req->ki_filp; ssize_t ret; int rw; fmode_t mode; rw_iter_op *iter_op; struct iovec inline_vecs[UIO_FASTIOV], *iovec = inline_vecs; struct iov_iter iter; switch (opcode) { case IOCB_CMD_PREAD: case IOCB_CMD_PREADV: mode = FMODE_READ; rw = READ; iter_op = file->f_op->read_iter; goto rw_common; case IOCB_CMD_PWRITE: case IOCB_CMD_PWRITEV: mode = FMODE_WRITE; rw = WRITE; iter_op = file->f_op->write_iter; goto rw_common; rw_common: if (unlikely(!(file->f_mode & mode))) return -EBADF; if (!iter_op) return -EINVAL; if (opcode == IOCB_CMD_PREADV || opcode == IOCB_CMD_PWRITEV) ret = aio_setup_vectored_rw(rw, buf, len, &iovec, compat, &iter); else { ret = import_single_range(rw, buf, len, iovec, &iter); iovec = NULL; } if (!ret) ret = rw_verify_area(rw, file, &req->ki_pos, iov_iter_count(&iter)); if (ret < 0) { kfree(iovec); return ret; } if (rw == WRITE) file_start_write(file); ret = iter_op(req, &iter); if (rw == WRITE) file_end_write(file); kfree(iovec); break; case IOCB_CMD_FDSYNC: if (!file->f_op->aio_fsync) return -EINVAL; ret = file->f_op->aio_fsync(req, 1); break; case IOCB_CMD_FSYNC: if (!file->f_op->aio_fsync) return -EINVAL; ret = file->f_op->aio_fsync(req, 0); break; default: pr_debug(""EINVAL: no operation provided\n""); return -EINVAL; } if (ret != -EIOCBQUEUED) { /* * There's no easy way to restart the syscall since other AIO's * may be already running. Just fail this IO with EINTR. */ if (unlikely(ret == -ERESTARTSYS || ret == -ERESTARTNOINTR || ret == -ERESTARTNOHAND || ret == -ERESTART_RESTARTBLOCK)) ret = -EINTR; aio_complete(req, ret, 0); } return 0; } ",0 "const EVP_MD *tls12_get_hash(unsigned char hash_alg) { switch(hash_alg) { #ifndef OPENSSL_NO_SHA case TLSEXT_hash_sha1: return EVP_sha1(); #endif #ifndef OPENSSL_NO_SHA256 case TLSEXT_hash_sha224: return EVP_sha224(); case TLSEXT_hash_sha256: return EVP_sha256(); #endif #ifndef OPENSSL_NO_SHA512 case TLSEXT_hash_sha384: return EVP_sha384(); case TLSEXT_hash_sha512: return EVP_sha512(); #endif default: return NULL; } } ",0 "static void sctp_v4_to_sk_saddr(union sctp_addr *addr, struct sock *sk) { inet_sk(sk)->inet_rcv_saddr = addr->v4.sin_addr.s_addr; } ",0 "bool InputDispatcher::shouldSendKeyToInputFilterLocked(const NotifyKeyArgs* args) { return mInputFilterEnabled; } ",0 "int jswrap_graphics_getWidthOrHeight(JsVar *parent, bool height) { JsGraphics gfx; if (!graphicsGetFromVar(&gfx, parent)) return 0; if (gfx.data.flags & JSGRAPHICSFLAGS_SWAP_XY) height=!height; return height ? gfx.data.height : gfx.data.width; } ",0 "bgp_open_print(netdissect_options *ndo, const u_char *dat, int length) { struct bgp_open bgpo; struct bgp_opt bgpopt; const u_char *opt; int i; ND_TCHECK2(dat[0], BGP_OPEN_SIZE); memcpy(&bgpo, dat, BGP_OPEN_SIZE); ND_PRINT((ndo, ""\n\t Version %d, "", bgpo.bgpo_version)); ND_PRINT((ndo, ""my AS %s, "", as_printf(ndo, astostr, sizeof(astostr), ntohs(bgpo.bgpo_myas)))); ND_PRINT((ndo, ""Holdtime %us, "", ntohs(bgpo.bgpo_holdtime))); ND_PRINT((ndo, ""ID %s"", ipaddr_string(ndo, &bgpo.bgpo_id))); ND_PRINT((ndo, ""\n\t Optional parameters, length: %u"", bgpo.bgpo_optlen)); /* some little sanity checking */ if (length < bgpo.bgpo_optlen+BGP_OPEN_SIZE) return; /* ugly! */ opt = &((const struct bgp_open *)dat)->bgpo_optlen; opt++; i = 0; while (i < bgpo.bgpo_optlen) { ND_TCHECK2(opt[i], BGP_OPT_SIZE); memcpy(&bgpopt, &opt[i], BGP_OPT_SIZE); if (i + 2 + bgpopt.bgpopt_len > bgpo.bgpo_optlen) { ND_PRINT((ndo, ""\n\t Option %d, length: %u"", bgpopt.bgpopt_type, bgpopt.bgpopt_len)); break; } ND_PRINT((ndo, ""\n\t Option %s (%u), length: %u"", tok2str(bgp_opt_values,""Unknown"", bgpopt.bgpopt_type), bgpopt.bgpopt_type, bgpopt.bgpopt_len)); /* now let's decode the options we know*/ switch(bgpopt.bgpopt_type) { case BGP_OPT_CAP: bgp_capabilities_print(ndo, &opt[i+BGP_OPT_SIZE], bgpopt.bgpopt_len); break; case BGP_OPT_AUTH: default: ND_PRINT((ndo, ""\n\t no decoder for option %u"", bgpopt.bgpopt_type)); break; } i += BGP_OPT_SIZE + bgpopt.bgpopt_len; } return; trunc: ND_PRINT((ndo, ""[|BGP]"")); } ",0 "static char *alloc_one_pg_vec_page(unsigned long order) { char *buffer = NULL; gfp_t gfp_flags = GFP_KERNEL | __GFP_COMP | __GFP_ZERO | __GFP_NOWARN | __GFP_NORETRY; buffer = (char *) __get_free_pages(gfp_flags, order); if (buffer) return buffer; /* * __get_free_pages failed, fall back to vmalloc */ buffer = vzalloc((1 << order) * PAGE_SIZE); if (buffer) return buffer; /* * vmalloc failed, lets dig into swap here */ gfp_flags &= ~__GFP_NORETRY; buffer = (char *)__get_free_pages(gfp_flags, order); if (buffer) return buffer; /* * complete and utter failure */ return NULL; } ",0 "void __init signals_init(void) { sigqueue_cachep = KMEM_CACHE(sigqueue, SLAB_PANIC); } ",0 "void SelectionEditor::DidUpdateCharacterData(CharacterData* node, unsigned offset, unsigned old_length, unsigned new_length) { if (selection_.IsNone() || !node || !node->isConnected()) { DidFinishDOMMutation(); return; } const Position& new_base = UpdatePositionAfterAdoptingTextReplacement( selection_.base_, node, offset, old_length, new_length); const Position& new_extent = UpdatePositionAfterAdoptingTextReplacement( selection_.extent_, node, offset, old_length, new_length); DidFinishTextChange(new_base, new_extent); } ",0 "pattern_instance_uses_base_space(const gs_pattern_instance_t * pinst) { return pinst->type->procs.uses_base_space( pinst->type->procs.get_pattern(pinst) ); } ",0 "static const char *lookup_name(uint32_t index, const char **list, uint32_t llen) { if (index >= llen || list[index] == NULL) { return ""???""; } return list[index]; } ",0 "TIFFDefaultStripSize(TIFF* tif, uint32 request) { return (*tif->tif_defstripsize)(tif, request); } ",0 "static int crypto_ccm_init_tfm(struct crypto_aead *tfm) { struct aead_instance *inst = aead_alg_instance(tfm); struct ccm_instance_ctx *ictx = aead_instance_ctx(inst); struct crypto_ccm_ctx *ctx = crypto_aead_ctx(tfm); struct crypto_ahash *mac; struct crypto_skcipher *ctr; unsigned long align; int err; mac = crypto_spawn_ahash(&ictx->mac); if (IS_ERR(mac)) return PTR_ERR(mac); ctr = crypto_spawn_skcipher(&ictx->ctr); err = PTR_ERR(ctr); if (IS_ERR(ctr)) goto err_free_mac; ctx->mac = mac; ctx->ctr = ctr; align = crypto_aead_alignmask(tfm); align &= ~(crypto_tfm_ctx_alignment() - 1); crypto_aead_set_reqsize( tfm, align + sizeof(struct crypto_ccm_req_priv_ctx) + crypto_skcipher_reqsize(ctr)); return 0; err_free_mac: crypto_free_ahash(mac); return err; } ",0 "void ImageResource::ResponseReceived( const ResourceResponse& response, std::unique_ptr handle) { DCHECK(!handle); DCHECK(!multipart_parser_); if (response.IsMultipart() && !response.MultipartBoundary().IsEmpty()) { multipart_parser_ = new MultipartImageResourceParser( response, response.MultipartBoundary(), this); } Resource::ResponseReceived(response, std::move(handle)); device_pixel_ratio_header_value_ = GetResponse() .HttpHeaderField(HTTPNames::Content_DPR) .ToFloat(&has_device_pixel_ratio_header_value_); if (!has_device_pixel_ratio_header_value_ || device_pixel_ratio_header_value_ <= 0.0) { device_pixel_ratio_header_value_ = 1.0; has_device_pixel_ratio_header_value_ = false; } if (placeholder_option_ == PlaceholderOption::kShowAndReloadPlaceholderAlways && IsEntireResource(GetResponse())) { if (GetResponse().HttpStatusCode() < 400 || GetResponse().HttpStatusCode() >= 600) { placeholder_option_ = PlaceholderOption::kDoNotReloadPlaceholder; } else { placeholder_option_ = PlaceholderOption::kReloadPlaceholderOnDecodeError; } } if (HasServerLoFiResponseHeaders(GetResponse())) { SetPreviewsState(GetResourceRequest().GetPreviewsState() | WebURLRequest::kServerLoFiOn); } else if (GetResourceRequest().GetPreviewsState() & WebURLRequest::kServerLoFiOn) { WebURLRequest::PreviewsState new_previews_state = GetResourceRequest().GetPreviewsState(); new_previews_state &= ~WebURLRequest::kServerLoFiOn; if (new_previews_state == WebURLRequest::kPreviewsUnspecified) new_previews_state = WebURLRequest::kPreviewsOff; SetPreviewsState(new_previews_state); } } ",0 "fn_print_char(netdissect_options *ndo, u_char c) { if (!ND_ISASCII(c)) { c = ND_TOASCII(c); ND_PRINT((ndo, ""M-"")); } if (!ND_ISPRINT(c)) { c ^= 0x40; /* DEL to ?, others to alpha */ ND_PRINT((ndo, ""^"")); } ND_PRINT((ndo, ""%c"", c)); } ",0 "void InlineSigninHelper::OnClientOAuthFailure( const GoogleServiceAuthError& error) { if (handler_) handler_->HandleLoginError(error.ToString(), base::string16()); AboutSigninInternals* about_signin_internals = AboutSigninInternalsFactory::GetForProfile(profile_); about_signin_internals->OnRefreshTokenReceived(""Failure""); base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this); } ",0 "PassRefPtr Document::registerElement(WebCore::ScriptState* state, const AtomicString& name, const Dictionary& options, ExceptionCode& ec) { if (!isHTMLDocument() && !isXHTMLDocument()) { ec = NOT_SUPPORTED_ERR; return 0; } if (!m_registry) m_registry = adoptRef(new CustomElementRegistry(this)); return m_registry->registerElement(state, name, options, ec); } ",0 "MessagePumpForIO* ToPumpIO(MessagePump* pump) { return static_cast(pump); } ",0 "UsbInterruptTransferFunction::UsbInterruptTransferFunction() { } ",0 "static int ptrace_detach(struct task_struct *child, unsigned int data) { if (!valid_signal(data)) return -EIO; /* Architecture-specific hardware disable .. */ ptrace_disable(child); write_lock_irq(&tasklist_lock); /* * We rely on ptrace_freeze_traced(). It can't be killed and * untraced by another thread, it can't be a zombie. */ WARN_ON(!child->ptrace || child->exit_state); /* * tasklist_lock avoids the race with wait_task_stopped(), see * the comment in ptrace_resume(). */ child->exit_code = data; __ptrace_detach(current, child); write_unlock_irq(&tasklist_lock); proc_ptrace_connector(child, PTRACE_DETACH); return 0; } ",0 "void DocumentLoader::cancelMainResourceLoad(const ResourceError& resourceError) { RefPtr protect(this); ResourceError error = resourceError.isNull() ? frameLoader()->cancelledError(m_request) : resourceError; m_dataLoadTimer.stop(); if (m_waitingForContentPolicy) { frameLoader()->policyChecker()->cancelCheck(); ASSERT(m_waitingForContentPolicy); m_waitingForContentPolicy = false; } if (mainResourceLoader()) mainResourceLoader()->cancel(error); mainReceivedError(error); } ",0 "bson_iter_next (bson_iter_t *iter) /* INOUT */ { uint32_t bson_type; const char *key; bool unsupported; return _bson_iter_next_internal (iter, 0, &key, &bson_type, &unsupported); } ",0 "void brcmf_free_vif(struct brcmf_cfg80211_vif *vif) { list_del(&vif->list); kfree(vif); } ",0 "void TestController::decidePolicyForResponse(WKFrameRef frame, WKURLResponseRef response, WKFramePolicyListenerRef listener) { WKRetainPtr wkMIMEType(AdoptWK, WKURLResponseCopyMIMEType(response)); if (WKFrameCanShowMIMEType(frame, wkMIMEType.get())) { WKFramePolicyListenerUse(listener); return; } WKFramePolicyListenerIgnore(listener); } ",0 "pk_proxy_appeared_cb (GObject *source, GAsyncResult *res, gpointer user_data) { ActivateParametersInstall *parameters_install = user_data; char *mime_type, *name_owner; char *error_message; GtkWidget *dialog; GDBusProxy *proxy; GError *error = NULL; proxy = g_dbus_proxy_new_for_bus_finish (res, &error); name_owner = g_dbus_proxy_get_name_owner (proxy); if (error != NULL || name_owner == NULL) { g_warning (""Couldn't call Modify on the PackageKit interface: %s"", error != NULL ? error->message : ""no owner for PackageKit""); g_clear_error (&error); /* show an unhelpful dialog */ show_unhandled_type_error (parameters_install); return; } g_free (name_owner); mime_type = nautilus_file_get_mime_type (parameters_install->file); error_message = get_application_no_mime_type_handler_message (parameters_install->file, parameters_install->uri); /* use a custom dialog to prompt the user to install new software */ dialog = gtk_message_dialog_new (parameters_install->parent_window, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_YES_NO, ""%s"", error_message); gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), _(""There is no application installed for “%s” files.\n"" ""Do you want to search for an application to open this file?""), g_content_type_get_description (mime_type)); gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); parameters_install->dialog = dialog; parameters_install->proxy = proxy; g_signal_connect (dialog, ""response"", G_CALLBACK (application_unhandled_file_install), parameters_install); g_signal_connect (dialog, ""delete-event"", G_CALLBACK (delete_cb), NULL); gtk_widget_show_all (dialog); g_free (mime_type); } ",0 "void RenderWidgetHostViewGuest::InitAsChild( gfx::NativeView parent_view) { NOTIMPLEMENTED(); } ",0 "DWORD SetDWValue(HKEY* key, const wchar_t* property, DWORD value) { return ::RegSetValueEx(*key, property, 0, REG_DWORD, reinterpret_cast(&value), sizeof(value)); } ",0 "LayoutUnit RenderBox::viewLogicalHeightForPercentages() const { if (document().printing()) return static_cast(view()->pageLogicalHeight()); return view()->viewLogicalHeight(); } ",0 "SMB2_get_srv_num(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, u64 volatile_fid, __le64 *uniqueid) { return query_info(xid, tcon, persistent_fid, volatile_fid, FILE_INTERNAL_INFORMATION, sizeof(struct smb2_file_internal_info), sizeof(struct smb2_file_internal_info), uniqueid); } ",0 "static int check_refcounts_l1(BlockDriverState *bs, BdrvCheckResult *res, uint16_t *refcount_table, int refcount_table_size, int64_t l1_table_offset, int l1_size, int flags) { BDRVQcowState *s = bs->opaque; uint64_t *l1_table, l2_offset, l1_size2; int i, ret; l1_size2 = l1_size * sizeof(uint64_t); /* Mark L1 table as used */ inc_refcounts(bs, res, refcount_table, refcount_table_size, l1_table_offset, l1_size2); /* Read L1 table entries from disk */ if (l1_size2 == 0) { l1_table = NULL; } else { l1_table = g_malloc(l1_size2); if (bdrv_pread(bs->file, l1_table_offset, l1_table, l1_size2) != l1_size2) goto fail; for(i = 0;i < l1_size; i++) be64_to_cpus(&l1_table[i]); } /* Do the actual checks */ for(i = 0; i < l1_size; i++) { l2_offset = l1_table[i]; if (l2_offset) { /* Mark L2 table as used */ l2_offset &= L1E_OFFSET_MASK; inc_refcounts(bs, res, refcount_table, refcount_table_size, l2_offset, s->cluster_size); /* L2 tables are cluster aligned */ if (offset_into_cluster(s, l2_offset)) { fprintf(stderr, ""ERROR l2_offset=%"" PRIx64 "": Table is not "" ""cluster aligned; L1 entry corrupted\n"", l2_offset); res->corruptions++; } /* Process and check L2 entries */ ret = check_refcounts_l2(bs, res, refcount_table, refcount_table_size, l2_offset, flags); if (ret < 0) { goto fail; } } } g_free(l1_table); return 0; fail: fprintf(stderr, ""ERROR: I/O error in check_refcounts_l1\n""); res->check_errors++; g_free(l1_table); return -EIO; } ",0 "int qcow2_alloc_clusters_at(BlockDriverState *bs, uint64_t offset, int nb_clusters) { BDRVQcowState *s = bs->opaque; uint64_t cluster_index; uint64_t i; int refcount, ret; assert(nb_clusters >= 0); if (nb_clusters == 0) { return 0; } do { /* Check how many clusters there are free */ cluster_index = offset >> s->cluster_bits; for(i = 0; i < nb_clusters; i++) { refcount = get_refcount(bs, cluster_index++); if (refcount < 0) { return refcount; } else if (refcount != 0) { break; } } /* And then allocate them */ ret = update_refcount(bs, offset, i << s->cluster_bits, 1, QCOW2_DISCARD_NEVER); } while (ret == -EAGAIN); if (ret < 0) { return ret; } return i; } ",0 "NuMediaExtractor::~NuMediaExtractor() { releaseTrackSamples(); for (size_t i = 0; i < mSelectedTracks.size(); ++i) { TrackInfo *info = &mSelectedTracks.editItemAt(i); CHECK_EQ((status_t)OK, info->mSource->stop()); } mSelectedTracks.clear(); if (mDataSource != NULL) { mDataSource->close(); } } ",0 "user_local_unregister (User *user) { g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON (user)); } ",0 "void ImageProcessorClient::FrameReady(size_t frame_index, scoped_refptr frame) { DCHECK_CALLED_ON_VALID_THREAD(image_processor_client_thread_checker_); base::AutoLock auto_lock_(output_lock_); EXPECT_EQ(frame_index, num_processed_frames_); for (auto& processor : frame_processors_) processor->ProcessVideoFrame(std::move(frame), frame_index); num_processed_frames_++; output_cv_.Signal(); } ",0 " bool IDNToUnicodeOneComponent(const base::char16* comp, size_t comp_len, bool is_tld_ascii, bool enable_spoof_checks, base::string16* out, bool* has_idn_component) { DCHECK(out); DCHECK(has_idn_component); *has_idn_component = false; if (comp_len == 0) return false; static const base::char16 kIdnPrefix[] = {'x', 'n', '-', '-'}; if (comp_len <= base::size(kIdnPrefix) || memcmp(comp, kIdnPrefix, sizeof(kIdnPrefix)) != 0) { out->append(comp, comp_len); return false; } UIDNA* uidna = g_uidna.Get().value; DCHECK(uidna != nullptr); size_t original_length = out->length(); int32_t output_length = 64; UIDNAInfo info = UIDNA_INFO_INITIALIZER; UErrorCode status; do { out->resize(original_length + output_length); status = U_ZERO_ERROR; output_length = uidna_labelToUnicode( uidna, comp, static_cast(comp_len), &(*out)[original_length], output_length, &info, &status); } while ((status == U_BUFFER_OVERFLOW_ERROR && info.errors == 0)); if (U_SUCCESS(status) && info.errors == 0) { *has_idn_component = true; out->resize(original_length + output_length); if (!enable_spoof_checks) { return true; } if (IsIDNComponentSafe( base::StringPiece16(out->data() + original_length, base::checked_cast(output_length)), is_tld_ascii)) { return true; } } out->resize(original_length); out->append(comp, comp_len); return false; } ",1 "static void do_error_trap(struct pt_regs *regs, long error_code, char *str, unsigned long trapnr, int signr) { siginfo_t info; RCU_LOCKDEP_WARN(!rcu_is_watching(), ""entry code didn't wake RCU""); /* * WARN*()s end up here; fix them up before we call the * notifier chain. */ if (!user_mode(regs) && fixup_bug(regs, trapnr)) return; if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) != NOTIFY_STOP) { cond_local_irq_enable(regs); do_trap(trapnr, signr, str, regs, error_code, fill_trap_info(regs, signr, trapnr, &info)); } } ",0 "static int nested_vmx_check_msr_switch_controls(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12) { if (vmcs12->vm_exit_msr_load_count == 0 && vmcs12->vm_exit_msr_store_count == 0 && vmcs12->vm_entry_msr_load_count == 0) return 0; /* Fast path */ if (nested_vmx_check_msr_switch(vcpu, VM_EXIT_MSR_LOAD_COUNT, VM_EXIT_MSR_LOAD_ADDR) || nested_vmx_check_msr_switch(vcpu, VM_EXIT_MSR_STORE_COUNT, VM_EXIT_MSR_STORE_ADDR) || nested_vmx_check_msr_switch(vcpu, VM_ENTRY_MSR_LOAD_COUNT, VM_ENTRY_MSR_LOAD_ADDR)) return -EINVAL; return 0; } ",0 "inline int PacketCopyData(Packet *p, uint8_t *pktdata, uint32_t pktlen) { SET_PKT_LEN(p, (size_t)pktlen); return PacketCopyDataOffset(p, 0, pktdata, pktlen); } ",0 "static int entersafe_write_key(sc_card_t *card, sc_entersafe_wkey_data *data) { struct sc_pkcs15_prkey_rsa* rsa=data->key_data.rsa; SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE); switch(data->usage) { case 0x22: if(rsa->modulus.len < 256) return entersafe_write_small_rsa_key(card,data->key_id,rsa); else return entersafe_write_large_rsa_key(card,data->key_id,rsa); break; case 0x2A: SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE,SC_ERROR_NOT_SUPPORTED); break; default: return entersafe_write_symmetric_key(card,data->key_id,data->usage, data->key_data.symmetric.EC, data->key_data.symmetric.ver, data->key_data.symmetric.key_val, data->key_data.symmetric.key_len); break; } SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE,SC_SUCCESS); } ",0 "void InterstitialPageImpl::Proceed() { if (!render_view_host_) return; if (action_taken_ != NO_ACTION) { NOTREACHED(); return; } Disable(); action_taken_ = PROCEED_ACTION; pause_throbber_ = false; controller_->delegate()->DidProceedOnInterstitial(); if (new_navigation_) TakeActionOnResourceDispatcher(CANCEL); else TakeActionOnResourceDispatcher(RESUME); if (!new_navigation_) { Hide(); delegate_->OnProceed(); return; } delegate_->OnProceed(); } ",0 "void ChromeClientImpl::ScheduleAnimation( const PlatformFrameView* platform_frame_view) { DCHECK(platform_frame_view->IsLocalFrameView()); LocalFrame& frame = ToLocalFrameView(platform_frame_view)->GetFrame().LocalFrameRoot(); if (WebLocalFrameImpl::FromFrame(&frame) && WebLocalFrameImpl::FromFrame(&frame)->FrameWidget()) WebLocalFrameImpl::FromFrame(&frame)->FrameWidget()->ScheduleAnimation(); } ",0 "bool AwContents::OnReceivedHttpAuthRequest(const JavaRef& handler, const std::string& host, const std::string& realm) { DCHECK_CURRENTLY_ON(BrowserThread::UI); JNIEnv* env = AttachCurrentThread(); ScopedJavaLocalRef obj = java_ref_.get(env); if (obj.is_null()) return false; ScopedJavaLocalRef jhost = ConvertUTF8ToJavaString(env, host); ScopedJavaLocalRef jrealm = ConvertUTF8ToJavaString(env, realm); devtools_instrumentation::ScopedEmbedderCallbackTask embedder_callback( ""onReceivedHttpAuthRequest""); Java_AwContents_onReceivedHttpAuthRequest(env, obj.obj(), handler.obj(), jhost.obj(), jrealm.obj()); return true; } ",0 "void WebContentsImpl::OnUpdateFaviconURL( const std::vector& candidates) { RenderViewHostImpl* rvhi = static_cast(render_view_message_source_); if (!rvhi->is_active()) return; FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidUpdateFaviconURL(candidates)); } ",0 "LayoutTestContentBrowserClient::~LayoutTestContentBrowserClient() { g_layout_test_browser_client = nullptr; } ",0 "void Instance::OnClientTimerFired(int32_t id) { engine_->OnCallback(id); } ",0 "void Document::ApplyFeaturePolicy(const ParsedFeaturePolicy& declared_policy) { const FeaturePolicy::FeatureState* opener_feature_state = nullptr; if (frame_ && frame_->IsMainFrame() && !frame_->Client()->GetOpenerFeatureState().empty()) { opener_feature_state = &frame_->Client()->GetOpenerFeatureState(); } InitializeFeaturePolicy(declared_policy, GetOwnerContainerPolicy(), GetParentFeaturePolicy(), opener_feature_state); is_vertical_scroll_enforced_ = frame_ && !frame_->IsMainFrame() && RuntimeEnabledFeatures::ExperimentalProductivityFeaturesEnabled() && !GetFeaturePolicy()->IsFeatureEnabled( mojom::FeaturePolicyFeature::kVerticalScroll); } ",0 "mainloop_get_child_timeout(mainloop_child_t *child) { return child->timeout; } ",0 "int gdImageColorAllocate (gdImagePtr im, int r, int g, int b) { return gdImageColorAllocateAlpha (im, r, g, b, gdAlphaOpaque); } ",0 "static int xfrm_add_pol_expire(struct sk_buff *skb, struct nlmsghdr *nlh, struct nlattr **attrs) { struct net *net = sock_net(skb->sk); struct xfrm_policy *xp; struct xfrm_user_polexpire *up = nlmsg_data(nlh); struct xfrm_userpolicy_info *p = &up->pol; u8 type = XFRM_POLICY_TYPE_MAIN; int err = -ENOENT; struct xfrm_mark m; u32 mark = xfrm_mark_get(attrs, &m); err = copy_from_user_policy_type(&type, attrs); if (err) return err; err = verify_policy_dir(p->dir); if (err) return err; if (p->index) xp = xfrm_policy_byid(net, mark, type, p->dir, p->index, 0, &err); else { struct nlattr *rt = attrs[XFRMA_SEC_CTX]; struct xfrm_sec_ctx *ctx; err = verify_sec_ctx_len(attrs); if (err) return err; ctx = NULL; if (rt) { struct xfrm_user_sec_ctx *uctx = nla_data(rt); err = security_xfrm_policy_alloc(&ctx, uctx, GFP_KERNEL); if (err) return err; } xp = xfrm_policy_bysel_ctx(net, mark, type, p->dir, &p->sel, ctx, 0, &err); security_xfrm_policy_free(ctx); } if (xp == NULL) return -ENOENT; if (unlikely(xp->walk.dead)) goto out; err = 0; if (up->hard) { xfrm_policy_delete(xp, p->dir); xfrm_audit_policy_delete(xp, 1, true); } km_policy_expired(xp, p->dir, up->hard, nlh->nlmsg_pid); out: xfrm_pol_put(xp); return err; } ",0 " TabletModeWindowManager* CreateTabletModeWindowManager() { EXPECT_FALSE(tablet_mode_window_manager()); Shell::Get()->tablet_mode_controller()->EnableTabletModeWindowManager(true); return tablet_mode_window_manager(); } ",0 "static int __esil_pop_argument(RAnalEsil *esil, ut64 *v) { char *t = r_anal_esil_pop (esil); if (!t || !r_anal_esil_get_parm (esil, t, v)) { free (t); return false; } free (t); return true; } ",0 "rdpdr_send_client_name_request(void) { /* DR_CORE_CLIENT_NAME_REQ */ STREAM s; struct stream name = { 0 }; if (NULL == g_rdpdr_clientname) { g_rdpdr_clientname = g_hostname; } s_realloc(&name, 512 * 4); s_reset(&name); out_utf16s(&name, g_rdpdr_clientname); s_mark_end(&name); s = channel_init(rdpdr_channel, 16 + s_length(&name)); out_uint16_le(s, RDPDR_CTYP_CORE); out_uint16_le(s, PAKID_CORE_CLIENT_NAME); out_uint32_le(s, 1); /* UnicodeFlag */ out_uint32_le(s, 0); /* CodePage */ out_uint32_le(s, s_length(&name)); /* ComputerNameLen */ out_stream(s, &name); s_mark_end(s); channel_send(s, rdpdr_channel); } ",0 "void GLES2DecoderImpl::DoVertexAttrib1fv(GLuint index, const GLfloat* v) { VertexAttribManager::VertexAttribInfo* info = vertex_attrib_manager_->GetVertexAttribInfo(index); if (!info) { SetGLError(GL_INVALID_VALUE, ""glVertexAttrib1fv: index out of range""); return; } VertexAttribManager::VertexAttribInfo::Vec4 value; value.v[0] = v[0]; value.v[1] = 0.0f; value.v[2] = 0.0f; value.v[3] = 1.0f; info->set_value(value); glVertexAttrib1fv(index, v); } ",0 "bool FrameFetchContext::ShouldSendClientHint( mojom::WebClientHintsType type, const ClientHintsPreferences& hints_preferences, const WebEnabledClientHints& enabled_hints) const { return GetClientHintsPreferences().ShouldSend(type) || hints_preferences.ShouldSend(type) || enabled_hints.IsEnabled(type); } ",0 "TestCustomNamedGetter* toTestCustomNamedGetter(JSC::JSValue value) { return value.inherits(&JSTestCustomNamedGetter::s_info) ? jsCast(asObject(value))->impl() : 0; } ",0 "static void WT_UpdateEG1 (S_WT_VOICE *pWTVoice, const S_ENVELOPE *pEnv) { EAS_I32 temp; switch (pWTVoice->eg1State) { case eEnvelopeStateAttack: temp = pWTVoice->eg1Value + pWTVoice->eg1Increment; /* check if we have reached peak amplitude */ if (temp >= SYNTH_FULL_SCALE_EG1_GAIN) { /* limit the volume */ temp = SYNTH_FULL_SCALE_EG1_GAIN; /* prepare to move to decay state */ pWTVoice->eg1State = eEnvelopeStateDecay; pWTVoice->eg1Increment = pEnv->decayTime; } break; /* exponential decay */ case eEnvelopeStateDecay: temp = MULT_EG1_EG1(pWTVoice->eg1Value, pWTVoice->eg1Increment); /* check if we have reached sustain level */ if (temp <= pEnv->sustainLevel) { /* enforce the sustain level */ temp = pEnv->sustainLevel; /* if sustain level is zero, skip sustain & release the voice */ if (temp > 0) pWTVoice->eg1State = eEnvelopeStateSustain; /* move to sustain state */ else pWTVoice->eg1State = eEnvelopeStateMuted; } break; case eEnvelopeStateSustain: return; case eEnvelopeStateRelease: temp = MULT_EG1_EG1(pWTVoice->eg1Value, pWTVoice->eg1Increment); /* if we hit zero, this voice isn't contributing any audio */ if (temp <= 0) { temp = 0; pWTVoice->eg1State = eEnvelopeStateMuted; } break; /* voice is muted, set target to zero */ case eEnvelopeStateMuted: temp = 0; break; case eEnvelopeStateInvalid: default: temp = 0; #ifdef _DEBUG_SYNTH { /* dpp: EAS_ReportEx(_EAS_SEVERITY_INFO, ""WT_UpdateEG1: error, %d is an unrecognized state\n"", pWTVoice->eg1State); */ } #endif break; } pWTVoice->eg1Value = (EAS_I16) temp; } ",0 "xdr_encode_pages(struct xdr_buf *xdr, struct page **pages, unsigned int base, unsigned int len) { struct kvec *tail = xdr->tail; u32 *p; xdr->pages = pages; xdr->page_base = base; xdr->page_len = len; p = (u32 *)xdr->head[0].iov_base + XDR_QUADLEN(xdr->head[0].iov_len); tail->iov_base = p; tail->iov_len = 0; if (len & 3) { unsigned int pad = 4 - (len & 3); *p = 0; tail->iov_base = (char *)p + (len & 3); tail->iov_len = pad; len += pad; } xdr->buflen += len; xdr->len += len; } ",0 "static void __free_event(struct perf_event *event) { if (!event->parent) { if (event->attr.sample_type & PERF_SAMPLE_CALLCHAIN) put_callchain_buffers(); } perf_event_free_bpf_prog(event); if (event->destroy) event->destroy(event); if (event->ctx) put_ctx(event->ctx); if (event->pmu) { exclusive_event_destroy(event); module_put(event->pmu->module); } call_rcu(&event->rcu_head, free_event_rcu); } ",0 "static IW_INLINE iw_tmpsample linear_to_rec709_sample(iw_tmpsample v_linear) { if(v_linear < 0.020) { return 4.5*v_linear; } return 1.099*pow(v_linear,0.45) - 0.099; } ",0 "param_integer( const char *name, int default_value, int min_value, int max_value, bool use_param_table ) { int result; param_integer( name, result, true, default_value, true, min_value, max_value, NULL, NULL, use_param_table ); return result; } ",0 "bool CameraDeviceClient::enforceRequestPermissions(CameraMetadata& metadata) { const int pid = IPCThreadState::self()->getCallingPid(); const int selfPid = getpid(); camera_metadata_entry_t entry; /** * Mixin default important security values * - android.led.transmit = defaulted ON */ CameraMetadata staticInfo = mDevice->info(); entry = staticInfo.find(ANDROID_LED_AVAILABLE_LEDS); for(size_t i = 0; i < entry.count; ++i) { uint8_t led = entry.data.u8[i]; switch(led) { case ANDROID_LED_AVAILABLE_LEDS_TRANSMIT: { uint8_t transmitDefault = ANDROID_LED_TRANSMIT_ON; if (!metadata.exists(ANDROID_LED_TRANSMIT)) { metadata.update(ANDROID_LED_TRANSMIT, &transmitDefault, 1); } break; } } } if (pid == selfPid) { return true; } /** * Permission check special fields in the request * - android.led.transmit = android.permission.CAMERA_DISABLE_TRANSMIT */ entry = metadata.find(ANDROID_LED_TRANSMIT); if (entry.count > 0 && entry.data.u8[0] != ANDROID_LED_TRANSMIT_ON) { String16 permissionString = String16(""android.permission.CAMERA_DISABLE_TRANSMIT_LED""); if (!checkCallingPermission(permissionString)) { const int uid = IPCThreadState::self()->getCallingUid(); ALOGE(""Permission Denial: "" ""can't disable transmit LED pid=%d, uid=%d"", pid, uid); return false; } } return true; } ",0 "int GetBlockForJpeg(void* param, unsigned long pos, unsigned char* buf, unsigned long size) { std::vector* data_vector = static_cast*>(param); if (pos + size < pos || pos + size > data_vector->size()) return 0; memcpy(buf, data_vector->data() + pos, size); return 1; } ",0 "png_write_hIST(png_structp png_ptr, png_uint_16p hist, int num_hist) { #ifdef PNG_USE_LOCAL_ARRAYS PNG_hIST; #endif int i; png_byte buf[3]; png_debug(1, ""in png_write_hIST""); if (num_hist > (int)png_ptr->num_palette) { png_debug2(3, ""num_hist = %d, num_palette = %d"", num_hist, png_ptr->num_palette); png_warning(png_ptr, ""Invalid number of histogram entries specified""); return; } png_write_chunk_start(png_ptr, (png_bytep)png_hIST, (png_uint_32)(num_hist * 2)); for (i = 0; i < num_hist; i++) { png_save_uint_16(buf, hist[i]); png_write_chunk_data(png_ptr, buf, (png_size_t)2); } png_write_chunk_end(png_ptr); } ",0 "bool OSExchangeData::GetString(base::string16* data) const { return provider_->GetString(data); } ",0 "WebKeyboardEvent* BuildKeyEvent(const PP_InputEvent& event) { WebKeyboardEvent* key_event = new WebKeyboardEvent(); switch (event.type) { case PP_INPUTEVENT_TYPE_RAWKEYDOWN: key_event->type = WebInputEvent::RawKeyDown; break; case PP_INPUTEVENT_TYPE_KEYDOWN: key_event->type = WebInputEvent::KeyDown; break; case PP_INPUTEVENT_TYPE_KEYUP: key_event->type = WebInputEvent::KeyUp; break; default: NOTREACHED(); } key_event->timeStampSeconds = event.time_stamp; key_event->modifiers = event.u.key.modifier; key_event->windowsKeyCode = event.u.key.key_code; return key_event; } ",0 " static void rtc_irq_eoi_tracking_reset(struct kvm_ioapic *ioapic) { ioapic->rtc_status.pending_eoi = 0; bitmap_zero(ioapic->rtc_status.dest_map.map, KVM_MAX_VCPUS); } ",1 " SPL_METHOD(DirectoryIterator, isDot) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); if (zend_parse_parameters_none() == FAILURE) { return; } RETURN_BOOL(spl_filesystem_is_dot(intern->u.dir.entry.d_name)); } ",1 "error::Error GLES2DecoderPassthroughImpl::DoStencilFillPathCHROMIUM( GLuint path, GLenum fillMode, GLuint mask) { NOTIMPLEMENTED(); return error::kNoError; } ",0 "void md_wait_for_blocked_rdev(struct md_rdev *rdev, struct mddev *mddev) { sysfs_notify_dirent_safe(rdev->sysfs_state); wait_event_timeout(rdev->blocked_wait, !test_bit(Blocked, &rdev->flags) && !test_bit(BlockedBadBlocks, &rdev->flags), msecs_to_jiffies(5000)); rdev_dec_pending(rdev, mddev); } ",0 "bufgets( httpd_conn* hc ) { int i; char c; for ( i = hc->checked_idx; hc->checked_idx < hc->read_idx; ++hc->checked_idx ) { c = hc->read_buf[hc->checked_idx]; if ( c == '\012' || c == '\015' ) { hc->read_buf[hc->checked_idx] = '\0'; ++hc->checked_idx; if ( c == '\015' && hc->checked_idx < hc->read_idx && hc->read_buf[hc->checked_idx] == '\012' ) { hc->read_buf[hc->checked_idx] = '\0'; ++hc->checked_idx; } return &(hc->read_buf[i]); } } return (char*) 0; } ",0 "static bool vmacache_valid(struct mm_struct *mm) { struct task_struct *curr; if (!vmacache_valid_mm(mm)) return false; curr = current; if (mm->vmacache_seqnum != curr->vmacache.seqnum) { /* * First attempt will always be invalid, initialize * the new cache for this task here. */ curr->vmacache.seqnum = mm->vmacache_seqnum; vmacache_flush(curr); return false; } return true; } ",0 " int touch_pressed_count() const { return touch_pressed_count_; } ",0 "void WebContentsImpl::ShowCreatedWidget(int route_id, bool is_fullscreen, const gfx::Rect& initial_pos) { if (delegate_) delegate_->RenderWidgetShowing(); RenderWidgetHostViewPort* widget_host_view = RenderWidgetHostViewPort::FromRWHV(GetCreatedWidget(route_id)); if (!widget_host_view) return; bool allow_privileged = false; if (is_fullscreen) { if (delegate_ && delegate_->EmbedsFullscreenWidget()) { widget_host_view->InitAsChild(GetRenderWidgetHostView()->GetNativeView()); delegate_->ToggleFullscreenModeForTab(this, true); } else { widget_host_view->InitAsFullscreen(GetRenderWidgetHostViewPort()); allow_privileged = true; } DCHECK_EQ(MSG_ROUTING_NONE, fullscreen_widget_routing_id_); fullscreen_widget_routing_id_ = route_id; FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidShowFullscreenWidget(route_id)); if (!widget_host_view->HasFocus()) widget_host_view->Focus(); } else { widget_host_view->InitAsPopup(GetRenderWidgetHostViewPort(), initial_pos); } RenderWidgetHostImpl* render_widget_host_impl = RenderWidgetHostImpl::From(widget_host_view->GetRenderWidgetHost()); render_widget_host_impl->Init(); render_widget_host_impl->set_allow_privileged_mouse_lock(allow_privileged); #if defined(OS_MACOSX) base::mac::NSObjectRelease(widget_host_view->GetNativeView()); #endif } ",0 "uint64_t Core::ConnectToPeer(ConnectionParams connection_params, const ports::PortRef& port) { RequestContext request_context; return GetNodeController()->ConnectToPeer(std::move(connection_params), port); } ",0 "void WebContext::setLegacyUserAgentOverrideEnabled(bool enabled) { if (IsInitialized()) { UserAgentSettings::Get(context_.get())->SetLegacyUserAgentOverrideEnabled( enabled); } else { construct_props_->legacy_user_agent_override_enabled = enabled; } } ",0 "void WebMediaPlayerImpl::OnVideoConfigChange(const VideoDecoderConfig& config) { DCHECK(main_task_runner_->BelongsToCurrentThread()); DCHECK_NE(ready_state_, WebMediaPlayer::kReadyStateHaveNothing); const bool codec_change = pipeline_metadata_.video_decoder_config.codec() != config.codec(); pipeline_metadata_.video_decoder_config = config; if (observer_) observer_->OnMetadataChanged(pipeline_metadata_); if (video_decode_stats_reporter_) video_decode_stats_reporter_->OnVideoConfigChanged(config); if (codec_change) UpdateSecondaryProperties(); } ",0 "static bool ParseOpusHeader(const uint8_t *data, size_t data_size, OpusHeader* header) { const size_t kOpusHeaderSize = 19; const size_t kOpusHeaderChannelsOffset = 9; const size_t kOpusHeaderSkipSamplesOffset = 10; const size_t kOpusHeaderGainOffset = 16; const size_t kOpusHeaderChannelMappingOffset = 18; const size_t kOpusHeaderNumStreamsOffset = kOpusHeaderSize; const size_t kOpusHeaderNumCoupledOffset = kOpusHeaderNumStreamsOffset + 1; const size_t kOpusHeaderStreamMapOffset = kOpusHeaderNumStreamsOffset + 2; if (data_size < kOpusHeaderSize) { ALOGV(""Header size is too small.""); return false; } header->channels = *(data + kOpusHeaderChannelsOffset); if (header->channels <= 0 || header->channels > kMaxChannels) { ALOGV(""Invalid Header, wrong channel count: %d"", header->channels); return false; } header->skip_samples = ReadLE16(data, data_size, kOpusHeaderSkipSamplesOffset); header->gain_db = static_cast( ReadLE16(data, data_size, kOpusHeaderGainOffset)); header->channel_mapping = *(data + kOpusHeaderChannelMappingOffset); if (!header->channel_mapping) { if (header->channels > kMaxChannelsWithDefaultLayout) { ALOGV(""Invalid Header, missing stream map.""); return false; } header->num_streams = 1; header->num_coupled = header->channels > 1; header->stream_map[0] = 0; header->stream_map[1] = 1; return true; } if (data_size < kOpusHeaderStreamMapOffset + header->channels) { ALOGV(""Invalid stream map; insufficient data for current channel "" ""count: %d"", header->channels); return false; } header->num_streams = *(data + kOpusHeaderNumStreamsOffset); header->num_coupled = *(data + kOpusHeaderNumCoupledOffset); if (header->num_streams + header->num_coupled != header->channels) { ALOGV(""Inconsistent channel mapping.""); return false; } for (int i = 0; i < header->channels; ++i) header->stream_map[i] = *(data + kOpusHeaderStreamMapOffset + i); return true; } ",0 "HeadlessTabSocket* HeadlessWebContentsImpl::GetHeadlessTabSocket() const { return headless_tab_socket_.get(); } ",0 "static int rawv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6, struct raw6_sock *rp) { struct sk_buff *skb; int err = 0; int offset; int len; int total_len; __wsum tmp_csum; __sum16 csum; if (!rp->checksum) goto send; if ((skb = skb_peek(&sk->sk_write_queue)) == NULL) goto out; offset = rp->offset; total_len = inet_sk(sk)->cork.base.length; if (offset >= total_len - 1) { err = -EINVAL; ip6_flush_pending_frames(sk); goto out; } /* should be check HW csum miyazawa */ if (skb_queue_len(&sk->sk_write_queue) == 1) { /* * Only one fragment on the socket. */ tmp_csum = skb->csum; } else { struct sk_buff *csum_skb = NULL; tmp_csum = 0; skb_queue_walk(&sk->sk_write_queue, skb) { tmp_csum = csum_add(tmp_csum, skb->csum); if (csum_skb) continue; len = skb->len - skb_transport_offset(skb); if (offset >= len) { offset -= len; continue; } csum_skb = skb; } skb = csum_skb; } offset += skb_transport_offset(skb); if (skb_copy_bits(skb, offset, &csum, 2)) BUG(); /* in case cksum was not initialized */ if (unlikely(csum)) tmp_csum = csum_sub(tmp_csum, csum_unfold(csum)); csum = csum_ipv6_magic(&fl6->saddr, &fl6->daddr, total_len, fl6->flowi6_proto, tmp_csum); if (csum == 0 && fl6->flowi6_proto == IPPROTO_UDP) csum = CSUM_MANGLED_0; if (skb_store_bits(skb, offset, &csum, 2)) BUG(); send: err = ip6_push_pending_frames(sk); out: return err; } ",0 "IHEVCD_ERROR_T ihevcd_parse_sao(codec_t *ps_codec) { IHEVCD_ERROR_T ret = (IHEVCD_ERROR_T)IHEVCD_SUCCESS; sps_t *ps_sps; sao_t *ps_sao; WORD32 rx; WORD32 ry; WORD32 value; bitstrm_t *ps_bitstrm = &ps_codec->s_parse.s_bitstrm; WORD32 sao_merge_left_flag; WORD32 sao_merge_up_flag; slice_header_t *ps_slice_hdr; cab_ctxt_t *ps_cabac = &ps_codec->s_parse.s_cabac; WORD32 ctxt_idx; ps_slice_hdr = ps_codec->s_parse.ps_slice_hdr_base; ps_slice_hdr += (ps_codec->s_parse.i4_cur_slice_idx & (MAX_SLICE_HDR_CNT - 1)); ps_sps = (ps_codec->s_parse.ps_sps); rx = ps_codec->s_parse.i4_ctb_x; ry = ps_codec->s_parse.i4_ctb_y; ps_sao = ps_codec->s_parse.ps_pic_sao + rx + ry * ps_sps->i2_pic_wd_in_ctb; /* Default values */ ps_sao->b3_y_type_idx = 0; ps_sao->b3_cb_type_idx = 0; ps_sao->b3_cr_type_idx = 0; UNUSED(value); ctxt_idx = IHEVC_CAB_SAO_MERGE; sao_merge_left_flag = 0; sao_merge_up_flag = 0; if(rx > 0) { /*TODO:Implemented only for slice. condition for tile is not tested*/ if(((0 != ps_codec->s_parse.i4_ctb_slice_x) || (0 != ps_codec->s_parse.i4_ctb_slice_y)) && (0 != ps_codec->s_parse.i4_ctb_tile_x)) { TRACE_CABAC_CTXT(""sao_merge_flag"", ps_cabac->u4_range, ctxt_idx); sao_merge_left_flag = ihevcd_cabac_decode_bin(ps_cabac, ps_bitstrm, ctxt_idx); AEV_TRACE(""sao_merge_flag"", sao_merge_left_flag, ps_cabac->u4_range); } } if(ry > 0 && !sao_merge_left_flag) { if((ps_codec->s_parse.i4_ctb_slice_y > 0) && (ps_codec->s_parse.i4_ctb_tile_y > 0)) { TRACE_CABAC_CTXT(""sao_merge_flag"", ps_cabac->u4_range, ctxt_idx); sao_merge_up_flag = ihevcd_cabac_decode_bin(ps_cabac, ps_bitstrm, ctxt_idx); AEV_TRACE(""sao_merge_flag"", sao_merge_up_flag, ps_cabac->u4_range); } } ctxt_idx = IHEVC_CAB_SAO_TYPE; if(sao_merge_left_flag) { *ps_sao = *(ps_sao - 1); } else if(sao_merge_up_flag) { *ps_sao = *(ps_sao - ps_sps->i2_pic_wd_in_ctb); } else // if(!sao_merge_up_flag && !sao_merge_left_flag) { WORD32 c_idx; WORD32 sao_type_idx = 0; for(c_idx = 0; c_idx < 3; c_idx++) { if((ps_slice_hdr->i1_slice_sao_luma_flag && c_idx == 0) || (ps_slice_hdr->i1_slice_sao_chroma_flag && c_idx > 0)) { /* sao_type_idx will be same for c_idx == 1 and c_idx == 2 - hence not initialized to zero for c_idx == 2*/ if(c_idx == 0) { sao_type_idx = 0; TRACE_CABAC_CTXT(""sao_type_idx"", ps_cabac->u4_range, ctxt_idx); sao_type_idx = ihevcd_cabac_decode_bin(ps_cabac, ps_bitstrm, ctxt_idx); if(sao_type_idx) { sao_type_idx += ihevcd_cabac_decode_bypass_bin(ps_cabac, ps_bitstrm); } AEV_TRACE(""sao_type_idx"", sao_type_idx, ps_cabac->u4_range); ps_sao->b3_y_type_idx = sao_type_idx; } if(c_idx == 1) { sao_type_idx = 0; TRACE_CABAC_CTXT(""sao_type_idx"", ps_cabac->u4_range, ctxt_idx); sao_type_idx = ihevcd_cabac_decode_bin(ps_cabac, ps_bitstrm, ctxt_idx); if(sao_type_idx) { sao_type_idx += ihevcd_cabac_decode_bypass_bin(ps_cabac, ps_bitstrm); } AEV_TRACE(""sao_type_idx"", sao_type_idx, ps_cabac->u4_range); ps_sao->b3_cb_type_idx = sao_type_idx; ps_sao->b3_cr_type_idx = sao_type_idx; } if(sao_type_idx != 0) { WORD32 i; WORD32 sao_offset[4]; WORD32 sao_band_position = 0; WORD32 c_max = (1 << (MIN(BIT_DEPTH, 10) - 5)) - 1; for(i = 0; i < 4; i++) { sao_offset[i] = ihevcd_cabac_decode_bypass_bins_tunary(ps_cabac, ps_bitstrm, c_max); AEV_TRACE(""sao_offset_abs"", sao_offset[i], ps_cabac->u4_range); if((2 == sao_type_idx) && (i > 1)) { sao_offset[i] = -sao_offset[i]; } } if(sao_type_idx == 1) { for(i = 0; i < 4; i++) { if(sao_offset[i] != 0) { value = ihevcd_cabac_decode_bypass_bin(ps_cabac, ps_bitstrm); AEV_TRACE(""sao_offset_sign"", value, ps_cabac->u4_range); if(value) { sao_offset[i] = -sao_offset[i]; } } } value = ihevcd_cabac_decode_bypass_bins(ps_cabac, ps_bitstrm, 5); AEV_TRACE(""sao_band_position"", value, ps_cabac->u4_range); sao_band_position = value; } else { if(c_idx == 0) { value = ihevcd_cabac_decode_bypass_bins(ps_cabac, ps_bitstrm, 2); AEV_TRACE(""sao_eo_class"", value, ps_cabac->u4_range); ps_sao->b3_y_type_idx += value; } if(c_idx == 1) { value = ihevcd_cabac_decode_bypass_bins(ps_cabac, ps_bitstrm, 2); AEV_TRACE(""sao_eo_class"", value, ps_cabac->u4_range); ps_sao->b3_cb_type_idx += value; ps_sao->b3_cr_type_idx += value; } } if(0 == c_idx) { ps_sao->b4_y_offset_1 = sao_offset[0]; ps_sao->b4_y_offset_2 = sao_offset[1]; ps_sao->b4_y_offset_3 = sao_offset[2]; ps_sao->b4_y_offset_4 = sao_offset[3]; ps_sao->b5_y_band_pos = sao_band_position; } else if(1 == c_idx) { ps_sao->b4_cb_offset_1 = sao_offset[0]; ps_sao->b4_cb_offset_2 = sao_offset[1]; ps_sao->b4_cb_offset_3 = sao_offset[2]; ps_sao->b4_cb_offset_4 = sao_offset[3]; ps_sao->b5_cb_band_pos = sao_band_position; } else // 2 == c_idx { ps_sao->b4_cr_offset_1 = sao_offset[0]; ps_sao->b4_cr_offset_2 = sao_offset[1]; ps_sao->b4_cr_offset_3 = sao_offset[2]; ps_sao->b4_cr_offset_4 = sao_offset[3]; ps_sao->b5_cr_band_pos = sao_band_position; } } } } } return ret; } ",0 "void BrowserView::OnWindowEndUserBoundsChange() { if (!interactive_resize_) return; auto now = base::TimeTicks::Now(); DCHECK(!interactive_resize_->begin_timestamp.is_null()); UMA_HISTOGRAM_TIMES(""BrowserWindow.Resize.Duration"", now - interactive_resize_->begin_timestamp); UMA_HISTOGRAM_COUNTS_1000(""BrowserWindow.Resize.StepCount"", interactive_resize_->step_count); interactive_resize_.reset(); } ",0 "JBIG2Bitmap *JBIG2Stream::readGenericRefinementRegion(int w, int h, int templ, GBool tpgrOn, JBIG2Bitmap *refBitmap, int refDX, int refDY, int *atx, int *aty) { JBIG2Bitmap *bitmap; GBool ltp; Guint ltpCX, cx, cx0, cx2, cx3, cx4, tpgrCX0, tpgrCX1, tpgrCX2; JBIG2BitmapPtr cxPtr0 = {0}; JBIG2BitmapPtr cxPtr1 = {0}; JBIG2BitmapPtr cxPtr2 = {0}; JBIG2BitmapPtr cxPtr3 = {0}; JBIG2BitmapPtr cxPtr4 = {0}; JBIG2BitmapPtr cxPtr5 = {0}; JBIG2BitmapPtr cxPtr6 = {0}; JBIG2BitmapPtr tpgrCXPtr0 = {0}; JBIG2BitmapPtr tpgrCXPtr1 = {0}; JBIG2BitmapPtr tpgrCXPtr2 = {0}; int x, y, pix; bitmap = new JBIG2Bitmap(0, w, h); if (!bitmap->isOk()) { delete bitmap; return NULL; } bitmap->clearToZero(); if (templ) { ltpCX = 0x008; } else { ltpCX = 0x0010; } ltp = 0; for (y = 0; y < h; ++y) { if (templ) { bitmap->getPixelPtr(0, y-1, &cxPtr0); cx0 = bitmap->nextPixel(&cxPtr0); bitmap->getPixelPtr(-1, y, &cxPtr1); refBitmap->getPixelPtr(-refDX, y-1-refDY, &cxPtr2); refBitmap->getPixelPtr(-1-refDX, y-refDY, &cxPtr3); cx3 = refBitmap->nextPixel(&cxPtr3); cx3 = (cx3 << 1) | refBitmap->nextPixel(&cxPtr3); refBitmap->getPixelPtr(-refDX, y+1-refDY, &cxPtr4); cx4 = refBitmap->nextPixel(&cxPtr4); tpgrCX0 = tpgrCX1 = tpgrCX2 = 0; // make gcc happy if (tpgrOn) { refBitmap->getPixelPtr(-1-refDX, y-1-refDY, &tpgrCXPtr0); tpgrCX0 = refBitmap->nextPixel(&tpgrCXPtr0); tpgrCX0 = (tpgrCX0 << 1) | refBitmap->nextPixel(&tpgrCXPtr0); tpgrCX0 = (tpgrCX0 << 1) | refBitmap->nextPixel(&tpgrCXPtr0); refBitmap->getPixelPtr(-1-refDX, y-refDY, &tpgrCXPtr1); tpgrCX1 = refBitmap->nextPixel(&tpgrCXPtr1); tpgrCX1 = (tpgrCX1 << 1) | refBitmap->nextPixel(&tpgrCXPtr1); tpgrCX1 = (tpgrCX1 << 1) | refBitmap->nextPixel(&tpgrCXPtr1); refBitmap->getPixelPtr(-1-refDX, y+1-refDY, &tpgrCXPtr2); tpgrCX2 = refBitmap->nextPixel(&tpgrCXPtr2); tpgrCX2 = (tpgrCX2 << 1) | refBitmap->nextPixel(&tpgrCXPtr2); tpgrCX2 = (tpgrCX2 << 1) | refBitmap->nextPixel(&tpgrCXPtr2); } else { tpgrCXPtr0.p = tpgrCXPtr1.p = tpgrCXPtr2.p = NULL; // make gcc happy tpgrCXPtr0.shift = tpgrCXPtr1.shift = tpgrCXPtr2.shift = 0; tpgrCXPtr0.x = tpgrCXPtr1.x = tpgrCXPtr2.x = 0; } for (x = 0; x < w; ++x) { cx0 = ((cx0 << 1) | bitmap->nextPixel(&cxPtr0)) & 7; cx3 = ((cx3 << 1) | refBitmap->nextPixel(&cxPtr3)) & 7; cx4 = ((cx4 << 1) | refBitmap->nextPixel(&cxPtr4)) & 3; if (tpgrOn) { tpgrCX0 = ((tpgrCX0 << 1) | refBitmap->nextPixel(&tpgrCXPtr0)) & 7; tpgrCX1 = ((tpgrCX1 << 1) | refBitmap->nextPixel(&tpgrCXPtr1)) & 7; tpgrCX2 = ((tpgrCX2 << 1) | refBitmap->nextPixel(&tpgrCXPtr2)) & 7; if (arithDecoder->decodeBit(ltpCX, refinementRegionStats)) { ltp = !ltp; } if (tpgrCX0 == 0 && tpgrCX1 == 0 && tpgrCX2 == 0) { bitmap->clearPixel(x, y); continue; } else if (tpgrCX0 == 7 && tpgrCX1 == 7 && tpgrCX2 == 7) { bitmap->setPixel(x, y); continue; } } cx = (cx0 << 7) | (bitmap->nextPixel(&cxPtr1) << 6) | (refBitmap->nextPixel(&cxPtr2) << 5) | (cx3 << 2) | cx4; if ((pix = arithDecoder->decodeBit(cx, refinementRegionStats))) { bitmap->setPixel(x, y); } } } else { bitmap->getPixelPtr(0, y-1, &cxPtr0); cx0 = bitmap->nextPixel(&cxPtr0); bitmap->getPixelPtr(-1, y, &cxPtr1); refBitmap->getPixelPtr(-refDX, y-1-refDY, &cxPtr2); cx2 = refBitmap->nextPixel(&cxPtr2); refBitmap->getPixelPtr(-1-refDX, y-refDY, &cxPtr3); cx3 = refBitmap->nextPixel(&cxPtr3); cx3 = (cx3 << 1) | refBitmap->nextPixel(&cxPtr3); refBitmap->getPixelPtr(-1-refDX, y+1-refDY, &cxPtr4); cx4 = refBitmap->nextPixel(&cxPtr4); cx4 = (cx4 << 1) | refBitmap->nextPixel(&cxPtr4); bitmap->getPixelPtr(atx[0], y+aty[0], &cxPtr5); refBitmap->getPixelPtr(atx[1]-refDX, y+aty[1]-refDY, &cxPtr6); tpgrCX0 = tpgrCX1 = tpgrCX2 = 0; // make gcc happy if (tpgrOn) { refBitmap->getPixelPtr(-1-refDX, y-1-refDY, &tpgrCXPtr0); tpgrCX0 = refBitmap->nextPixel(&tpgrCXPtr0); tpgrCX0 = (tpgrCX0 << 1) | refBitmap->nextPixel(&tpgrCXPtr0); tpgrCX0 = (tpgrCX0 << 1) | refBitmap->nextPixel(&tpgrCXPtr0); refBitmap->getPixelPtr(-1-refDX, y-refDY, &tpgrCXPtr1); tpgrCX1 = refBitmap->nextPixel(&tpgrCXPtr1); tpgrCX1 = (tpgrCX1 << 1) | refBitmap->nextPixel(&tpgrCXPtr1); tpgrCX1 = (tpgrCX1 << 1) | refBitmap->nextPixel(&tpgrCXPtr1); refBitmap->getPixelPtr(-1-refDX, y+1-refDY, &tpgrCXPtr2); tpgrCX2 = refBitmap->nextPixel(&tpgrCXPtr2); tpgrCX2 = (tpgrCX2 << 1) | refBitmap->nextPixel(&tpgrCXPtr2); tpgrCX2 = (tpgrCX2 << 1) | refBitmap->nextPixel(&tpgrCXPtr2); } else { tpgrCXPtr0.p = tpgrCXPtr1.p = tpgrCXPtr2.p = NULL; // make gcc happy tpgrCXPtr0.shift = tpgrCXPtr1.shift = tpgrCXPtr2.shift = 0; tpgrCXPtr0.x = tpgrCXPtr1.x = tpgrCXPtr2.x = 0; } for (x = 0; x < w; ++x) { cx0 = ((cx0 << 1) | bitmap->nextPixel(&cxPtr0)) & 3; cx2 = ((cx2 << 1) | refBitmap->nextPixel(&cxPtr2)) & 3; cx3 = ((cx3 << 1) | refBitmap->nextPixel(&cxPtr3)) & 7; cx4 = ((cx4 << 1) | refBitmap->nextPixel(&cxPtr4)) & 7; if (tpgrOn) { tpgrCX0 = ((tpgrCX0 << 1) | refBitmap->nextPixel(&tpgrCXPtr0)) & 7; tpgrCX1 = ((tpgrCX1 << 1) | refBitmap->nextPixel(&tpgrCXPtr1)) & 7; tpgrCX2 = ((tpgrCX2 << 1) | refBitmap->nextPixel(&tpgrCXPtr2)) & 7; if (arithDecoder->decodeBit(ltpCX, refinementRegionStats)) { ltp = !ltp; } if (tpgrCX0 == 0 && tpgrCX1 == 0 && tpgrCX2 == 0) { bitmap->clearPixel(x, y); continue; } else if (tpgrCX0 == 7 && tpgrCX1 == 7 && tpgrCX2 == 7) { bitmap->setPixel(x, y); continue; } } cx = (cx0 << 11) | (bitmap->nextPixel(&cxPtr1) << 10) | (cx2 << 8) | (cx3 << 5) | (cx4 << 2) | (bitmap->nextPixel(&cxPtr5) << 1) | refBitmap->nextPixel(&cxPtr6); if ((pix = arithDecoder->decodeBit(cx, refinementRegionStats))) { bitmap->setPixel(x, y); } } } } return bitmap; } ",0 "void pci_of_setup(void *blob, bd_t *bd) { FT_FSL_PCI_SETUP; } ",0 "static int zlib_compress_final(struct crypto_pcomp *tfm, struct comp_request *req) { int ret; struct zlib_ctx *dctx = crypto_tfm_ctx(crypto_pcomp_tfm(tfm)); struct z_stream_s *stream = &dctx->comp_stream; pr_debug(""avail_in %u, avail_out %u\n"", req->avail_in, req->avail_out); stream->next_in = req->next_in; stream->avail_in = req->avail_in; stream->next_out = req->next_out; stream->avail_out = req->avail_out; ret = zlib_deflate(stream, Z_FINISH); if (ret != Z_STREAM_END) { pr_debug(""zlib_deflate failed %d\n"", ret); return -EINVAL; } ret = req->avail_out - stream->avail_out; pr_debug(""avail_in %lu, avail_out %lu (consumed %lu, produced %u)\n"", stream->avail_in, stream->avail_out, req->avail_in - stream->avail_in, ret); req->next_in = stream->next_in; req->avail_in = stream->avail_in; req->next_out = stream->next_out; req->avail_out = stream->avail_out; return ret; } ",0 "AppProto AppLayerProtoDetectGetProto(AppLayerProtoDetectThreadCtx *tctx, Flow *f, uint8_t *buf, uint32_t buflen, uint8_t ipproto, uint8_t direction) { SCEnter(); SCLogDebug(""buflen %u for %s direction"", buflen, (direction & STREAM_TOSERVER) ? ""toserver"" : ""toclient""); AppProto alproto = ALPROTO_UNKNOWN; if (!FLOW_IS_PM_DONE(f, direction)) { AppProto pm_results[ALPROTO_MAX]; uint16_t pm_matches = AppLayerProtoDetectPMGetProto(tctx, f, buf, buflen, direction, ipproto, pm_results); if (pm_matches > 0) { alproto = pm_results[0]; goto end; } } if (!FLOW_IS_PP_DONE(f, direction)) { alproto = AppLayerProtoDetectPPGetProto(f, buf, buflen, ipproto, direction); if (alproto != ALPROTO_UNKNOWN) goto end; } /* Look if flow can be found in expectation list */ if (!FLOW_IS_PE_DONE(f, direction)) { alproto = AppLayerProtoDetectPEGetProto(f, ipproto, direction); } end: SCReturnUInt(alproto); } ",1 "static int coroutine_fn v9fs_complete_rename(V9fsPDU *pdu, V9fsFidState *fidp, int32_t newdirfid, V9fsString *name) { int err = 0; V9fsPath new_path; V9fsFidState *tfidp; V9fsState *s = pdu->s; V9fsFidState *dirfidp = NULL; v9fs_path_init(&new_path); if (newdirfid != -1) { dirfidp = get_fid(pdu, newdirfid); if (dirfidp == NULL) { err = -ENOENT; goto out_nofid; } if (fidp->fid_type != P9_FID_NONE) { err = -EINVAL; goto out; } err = v9fs_co_name_to_path(pdu, &dirfidp->path, name->data, &new_path); if (err < 0) { goto out; } } else { char *dir_name = g_path_get_dirname(fidp->path.data); V9fsPath dir_path; v9fs_path_init(&dir_path); v9fs_path_sprintf(&dir_path, ""%s"", dir_name); g_free(dir_name); err = v9fs_co_name_to_path(pdu, &dir_path, name->data, &new_path); v9fs_path_free(&dir_path); if (err < 0) { goto out; } } err = v9fs_co_rename(pdu, &fidp->path, &new_path); if (err < 0) { goto out; } /* * Fixup fid's pointing to the old name to * start pointing to the new name */ for (tfidp = s->fid_list; tfidp; tfidp = tfidp->next) { if (v9fs_path_is_ancestor(&fidp->path, &tfidp->path)) { /* replace the name */ v9fs_fix_path(&tfidp->path, &new_path, strlen(fidp->path.data)); } } out: if (dirfidp) { put_fid(pdu, dirfidp); } v9fs_path_free(&new_path); out_nofid: return err; } ",0 "static bool bond_addr_in_mc_list(unsigned char *addr, struct netdev_hw_addr_list *list, int addrlen) { struct netdev_hw_addr *ha; netdev_hw_addr_list_for_each(ha, list) if (!memcmp(ha->addr, addr, addrlen)) return true; return false; } ",0 "expand_getcertele(uschar * field, uschar * certvar) { var_entry * vp; certfield * cp; if (!(vp = find_var_ent(certvar))) { expand_string_message = string_sprintf(""no variable named \""%s\"""", certvar); return NULL; /* Unknown variable name */ } /* NB this stops us passing certs around in variable. Might want to do that in future */ if (vp->type != vtype_cert) { expand_string_message = string_sprintf(""\""%s\"" is not a certificate"", certvar); return NULL; /* Unknown variable name */ } if (!*(void **)vp->value) return NULL; if (*field >= '0' && *field <= '9') return tls_cert_ext_by_oid(*(void **)vp->value, field, 0); for(cp = certfields; cp < certfields + nelements(certfields); cp++) if (Ustrncmp(cp->name, field, cp->namelen) == 0) { uschar * modifier = *(field += cp->namelen) == ',' ? ++field : NULL; return (*cp->getfn)( *(void **)vp->value, modifier ); } expand_string_message = string_sprintf(""bad field selector \""%s\"" for certextract"", field); return NULL; } ",0 "void Document::detach(const AttachContext& context) { TRACE_EVENT0(""blink"", ""Document::detach""); RELEASE_ASSERT(!m_frame || m_frame->tree().childCount() == 0); if (!isActive()) return; FrameNavigationDisabler navigationDisabler(*m_frame); HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates; ScriptForbiddenScope forbidScript; view()->dispose(); m_markers->prepareForDestruction(); if (LocalDOMWindow* window = this->domWindow()) window->willDetachDocumentFromFrame(); m_lifecycle.advanceTo(DocumentLifecycle::Stopping); if (page()) page()->documentDetached(this); InspectorInstrumentation::documentDetached(this); if (m_frame->loader().client()->sharedWorkerRepositoryClient()) m_frame->loader().client()->sharedWorkerRepositoryClient()->documentDetached(this); stopActiveDOMObjects(); if (m_scriptedAnimationController) m_scriptedAnimationController->clearDocumentPointer(); m_scriptedAnimationController.clear(); m_scriptedIdleTaskController.clear(); if (svgExtensions()) accessSVGExtensions().pauseAnimations(); if (m_domWindow) m_domWindow->clearEventQueue(); if (m_layoutView) m_layoutView->setIsInWindow(false); if (registrationContext()) registrationContext()->documentWasDetached(); m_hoverNode = nullptr; m_activeHoverElement = nullptr; m_autofocusElement = nullptr; if (m_focusedElement.get()) { Element* oldFocusedElement = m_focusedElement; m_focusedElement = nullptr; if (frameHost()) frameHost()->chromeClient().focusedNodeChanged(oldFocusedElement, nullptr); } m_sequentialFocusNavigationStartingPoint = nullptr; if (this == &axObjectCacheOwner()) clearAXObjectCache(); m_layoutView = nullptr; ContainerNode::detach(context); if (this != &axObjectCacheOwner()) { if (AXObjectCache* cache = existingAXObjectCache()) { for (Node& node : NodeTraversal::descendantsOf(*this)) { cache->remove(&node); } } } styleEngine().didDetach(); frameHost()->eventHandlerRegistry().documentDetached(*this); m_frame->selection().documentDetached(*this); m_frame->inputMethodController().documentDetached(); if (!loader()) m_fetcher->clearContext(); if (m_importsController) { m_importsController->dispose(); setImportsController(nullptr); } m_timers.setTimerTaskRunner( Platform::current()->currentThread()->scheduler()->timerTaskRunner()->adoptClone()); m_frame = nullptr; if (m_mediaQueryMatcher) m_mediaQueryMatcher->documentDetached(); m_lifecycle.advanceTo(DocumentLifecycle::Stopped); ExecutionContext::notifyContextDestroyed(); } ",0 "magic_file(struct magic_set *ms, const char *inname) { if (ms == NULL) return NULL; return file_or_fd(ms, inname, STDIN_FILENO); } ",0 "static int vhost_scsi_make_nexus(struct vhost_scsi_tpg *tpg, const char *name) { struct se_portal_group *se_tpg; struct se_session *se_sess; struct vhost_scsi_nexus *tv_nexus; struct vhost_scsi_cmd *tv_cmd; unsigned int i; mutex_lock(&tpg->tv_tpg_mutex); if (tpg->tpg_nexus) { mutex_unlock(&tpg->tv_tpg_mutex); pr_debug(""tpg->tpg_nexus already exists\n""); return -EEXIST; } se_tpg = &tpg->se_tpg; tv_nexus = kzalloc(sizeof(struct vhost_scsi_nexus), GFP_KERNEL); if (!tv_nexus) { mutex_unlock(&tpg->tv_tpg_mutex); pr_err(""Unable to allocate struct vhost_scsi_nexus\n""); return -ENOMEM; } /* * Initialize the struct se_session pointer and setup tagpool * for struct vhost_scsi_cmd descriptors */ tv_nexus->tvn_se_sess = transport_init_session_tags( VHOST_SCSI_DEFAULT_TAGS, sizeof(struct vhost_scsi_cmd), TARGET_PROT_DIN_PASS | TARGET_PROT_DOUT_PASS); if (IS_ERR(tv_nexus->tvn_se_sess)) { mutex_unlock(&tpg->tv_tpg_mutex); kfree(tv_nexus); return -ENOMEM; } se_sess = tv_nexus->tvn_se_sess; for (i = 0; i < VHOST_SCSI_DEFAULT_TAGS; i++) { tv_cmd = &((struct vhost_scsi_cmd *)se_sess->sess_cmd_map)[i]; tv_cmd->tvc_sgl = kzalloc(sizeof(struct scatterlist) * VHOST_SCSI_PREALLOC_SGLS, GFP_KERNEL); if (!tv_cmd->tvc_sgl) { mutex_unlock(&tpg->tv_tpg_mutex); pr_err(""Unable to allocate tv_cmd->tvc_sgl\n""); goto out; } tv_cmd->tvc_upages = kzalloc(sizeof(struct page *) * VHOST_SCSI_PREALLOC_UPAGES, GFP_KERNEL); if (!tv_cmd->tvc_upages) { mutex_unlock(&tpg->tv_tpg_mutex); pr_err(""Unable to allocate tv_cmd->tvc_upages\n""); goto out; } tv_cmd->tvc_prot_sgl = kzalloc(sizeof(struct scatterlist) * VHOST_SCSI_PREALLOC_PROT_SGLS, GFP_KERNEL); if (!tv_cmd->tvc_prot_sgl) { mutex_unlock(&tpg->tv_tpg_mutex); pr_err(""Unable to allocate tv_cmd->tvc_prot_sgl\n""); goto out; } } /* * Since we are running in 'demo mode' this call with generate a * struct se_node_acl for the vhost_scsi struct se_portal_group with * the SCSI Initiator port name of the passed configfs group 'name'. */ tv_nexus->tvn_se_sess->se_node_acl = core_tpg_check_initiator_node_acl( se_tpg, (unsigned char *)name); if (!tv_nexus->tvn_se_sess->se_node_acl) { mutex_unlock(&tpg->tv_tpg_mutex); pr_debug(""core_tpg_check_initiator_node_acl() failed"" "" for %s\n"", name); goto out; } /* * Now register the TCM vhost virtual I_T Nexus as active with the * call to __transport_register_session() */ __transport_register_session(se_tpg, tv_nexus->tvn_se_sess->se_node_acl, tv_nexus->tvn_se_sess, tv_nexus); tpg->tpg_nexus = tv_nexus; mutex_unlock(&tpg->tv_tpg_mutex); return 0; out: vhost_scsi_free_cmd_map_res(tv_nexus, se_sess); transport_free_session(se_sess); kfree(tv_nexus); return -ENOMEM; } ",0 "is_config_change(xmlNode *xml) { GListPtr gIter = NULL; xml_private_t *p = NULL; xmlNode *config = first_named_child(xml, XML_CIB_TAG_CONFIGURATION); if(config) { p = config->_private; } if(p && is_set(p->flags, xpf_dirty)) { return TRUE; } if(xml->doc && xml->doc->_private) { p = xml->doc->_private; for(gIter = p->deleted_paths; gIter; gIter = gIter->next) { char *path = gIter->data; if(strstr(path, ""/""XML_TAG_CIB""/""XML_CIB_TAG_CONFIGURATION) != NULL) { return TRUE; } } } return FALSE; } ",0 "void ContentSecurityPolicy::ApplyPolicySideEffectsToExecutionContext() { DCHECK(execution_context_ && execution_context_->GetSecurityContext().GetSecurityOrigin()); SecurityContext& security_context = execution_context_->GetSecurityContext(); SetupSelf(*security_context.GetSecurityOrigin()); Document* document = this->GetDocument(); if (sandbox_mask_ != kSandboxNone) { UseCounter::Count(execution_context_, WebFeature::kSandboxViaCSP); if (document) document->EnforceSandboxFlags(sandbox_mask_); else security_context.ApplySandboxFlags(sandbox_mask_); } if (treat_as_public_address_) { security_context.SetAddressSpace(mojom::IPAddressSpace::kPublic); } if (require_safe_types_) { security_context.SetRequireTrustedTypes(); } security_context.SetInsecureRequestPolicy( security_context.GetInsecureRequestPolicy() | insecure_request_policy_); if (document) document->DidEnforceInsecureRequestPolicy(); if (insecure_request_policy_ & kUpgradeInsecureRequests) { UseCounter::Count(execution_context_, WebFeature::kUpgradeInsecureRequestsEnabled); if (!execution_context_->Url().Host().IsEmpty()) { uint32_t hash = execution_context_->Url().Host().Impl()->GetHash(); security_context.AddInsecureNavigationUpgrade(hash); if (document) document->DidEnforceInsecureNavigationsSet(); } } for (const auto& console_message : console_messages_) execution_context_->AddConsoleMessage(console_message); console_messages_.clear(); for (const auto& policy : policies_) { UseCounter::Count(execution_context_, GetUseCounterType(policy->HeaderType())); if (policy->AllowDynamic( ContentSecurityPolicy::DirectiveType::kScriptSrcAttr) || policy->AllowDynamic( ContentSecurityPolicy::DirectiveType::kScriptSrcElem)) { UseCounter::Count(execution_context_, WebFeature::kCSPWithStrictDynamic); } if (policy->AllowEval(nullptr, SecurityViolationReportingPolicy::kSuppressReporting, kWillNotThrowException, g_empty_string)) { UseCounter::Count(execution_context_, WebFeature::kCSPWithUnsafeEval); } } if (!disable_eval_error_message_.IsNull()) execution_context_->DisableEval(disable_eval_error_message_); } ",0 "int dom_document_substitue_entities_write(dom_object *obj, zval *newval TSRMLS_DC) { zval value_copy; dom_doc_propsptr doc_prop; if(Z_REFCOUNT_P(newval) > 1) { value_copy = *newval; zval_copy_ctor(&value_copy); newval = &value_copy; } convert_to_boolean(newval); if (obj->document) { doc_prop = dom_get_doc_props(obj->document); doc_prop->substituteentities = Z_LVAL_P(newval); } if (newval == &value_copy) { zval_dtor(newval); } return SUCCESS; } ",0 "void Document::DidRemoveText(const CharacterData& text, unsigned offset, unsigned length) { for (Range* range : ranges_) range->DidRemoveText(text, offset, length); } ",0 "void RenderFrameImpl::OnAdvanceFocus(blink::WebFocusType type, int32_t source_routing_id) { RenderFrameProxy* source_frame = RenderFrameProxy::FromRoutingID(source_routing_id); if (!source_frame) { render_view_->webview()->SetInitialFocus(type == blink::kWebFocusTypeBackward); return; } render_view_->webview()->AdvanceFocusAcrossFrames( type, source_frame->web_frame(), frame_); } ",0 "void PrepareFrameAndViewForPrint::CopySelectionIfNeeded( const WebPreferences& preferences, const base::Closure& on_ready) { on_ready_ = on_ready; if (should_print_selection_only_) { CopySelection(preferences); } else { CallOnReady(); } } ",0 "bool PDFiumEngine::OnMouseDown(const pp::MouseInputEvent& event) { pp::MouseInputEvent normalized_event = NormalizeMouseEvent(client_->GetPluginInstance(), event); if (normalized_event.GetButton() == PP_INPUTEVENT_MOUSEBUTTON_LEFT) return OnLeftMouseDown(normalized_event); if (normalized_event.GetButton() == PP_INPUTEVENT_MOUSEBUTTON_MIDDLE) return OnMiddleMouseDown(normalized_event); if (normalized_event.GetButton() == PP_INPUTEVENT_MOUSEBUTTON_RIGHT) return OnRightMouseDown(normalized_event); return false; } ",0 "uint32_t MediaHTTP::flags() { return kWantsPrefetching | kIsHTTPBasedSource; } ",0 "struct page *alloc_pages_current(gfp_t gfp, unsigned order) { struct mempolicy *pol = &default_policy; struct page *page; if (!in_interrupt() && !(gfp & __GFP_THISNODE)) pol = get_task_policy(current); /* * No reference counting needed for current->mempolicy * nor system default_policy */ if (pol->mode == MPOL_INTERLEAVE) page = alloc_page_interleave(gfp, order, interleave_nodes(pol)); else page = __alloc_pages_nodemask(gfp, order, policy_node(gfp, pol, numa_node_id()), policy_nodemask(gfp, pol)); return page; } ",0 "void DebuggerGetTargetsFunction::SendTargetList( const content::DevToolsAgentHost::List& target_list) { std::unique_ptr result(new base::ListValue()); for (size_t i = 0; i < target_list.size(); ++i) result->Append(SerializeTarget(target_list[i])); SetResult(std::move(result)); SendResponse(true); } ",0 "static CURLcode nss_fail_connect(struct ssl_connect_data *connssl, struct Curl_easy *data, CURLcode curlerr) { PRErrorCode err = 0; if(is_nss_error(curlerr)) { /* read NSPR error code */ err = PR_GetError(); if(is_cc_error(err)) curlerr = CURLE_SSL_CERTPROBLEM; /* print the error number and error string */ infof(data, ""NSS error %d (%s)\n"", err, nss_error_to_name(err)); /* print a human-readable message describing the error if available */ nss_print_error_message(data, err); } /* cleanup on connection failure */ Curl_llist_destroy(connssl->obj_list, NULL); connssl->obj_list = NULL; return curlerr; } ",0 "MagickExport unsigned char *GetQuantumPixels(const QuantumInfo *quantum_info) { const int id = GetOpenMPThreadId(); assert(quantum_info != (QuantumInfo *) NULL); assert(quantum_info->signature == MagickCoreSignature); return(quantum_info->pixels[id]); } ",0 "static void handle_init_section_args(struct init_section_info *info, const char *key, int key_len, char **dest, int *dest_len) { if (!strncmp(key, ""URI="", key_len)) { *dest = info->uri; *dest_len = sizeof(info->uri); } else if (!strncmp(key, ""BYTERANGE="", key_len)) { *dest = info->byterange; *dest_len = sizeof(info->byterange); } } ",0 "void ServiceWorkerContextCore::RemoveLiveRegistration(int64_t id) { live_registrations_.erase(id); } ",0 " sync_pb::EntitySpecifics DefaultBookmarkSpecifics() { sync_pb::EntitySpecifics result; AddDefaultExtensionValue(syncable::BOOKMARKS, &result); return result; } ",0 " swabHorAcc32(TIFF* tif, uint8* cp0, tmsize_t cc) { uint32* wp = (uint32*) cp0; tmsize_t wc = cc / 4; TIFFSwabArrayOfLong(wp, wc); horAcc32(tif, cp0, cc); } ",1 "LayoutSVGViewportContainer::LayoutSVGViewportContainer(SVGElement* node) : LayoutSVGContainer(node) , m_isLayoutSizeChanged(false) , m_needsTransformUpdate(true) { } ",0 " WebRtcGetUserMediaBrowserTest() : trace_log_(NULL) {} ",0 "static int filter_frame(AVFilterLink *inlink, AVFrame *in) { AVFilterContext *ctx = inlink->dst; LutContext *s = ctx->priv; AVFilterLink *outlink = ctx->outputs[0]; AVFrame *out; uint8_t *inrow, *outrow, *inrow0, *outrow0; int i, j, plane, direct = 0; if (av_frame_is_writable(in)) { direct = 1; out = in; } else { out = ff_get_video_buffer(outlink, outlink->w, outlink->h); if (!out) { av_frame_free(&in); return AVERROR(ENOMEM); } av_frame_copy_props(out, in); } if (s->is_rgb) { /* packed */ inrow0 = in ->data[0]; outrow0 = out->data[0]; for (i = 0; i < in->height; i ++) { int w = inlink->w; const uint8_t (*tab)[256] = (const uint8_t (*)[256])s->lut; inrow = inrow0; outrow = outrow0; for (j = 0; j < w; j++) { switch (s->step) { case 4: outrow[3] = tab[3][inrow[3]]; // Fall-through case 3: outrow[2] = tab[2][inrow[2]]; // Fall-through case 2: outrow[1] = tab[1][inrow[1]]; // Fall-through default: outrow[0] = tab[0][inrow[0]]; } outrow += s->step; inrow += s->step; } inrow0 += in ->linesize[0]; outrow0 += out->linesize[0]; } } else { /* planar */ for (plane = 0; plane < 4 && in->data[plane]; plane++) { int vsub = plane == 1 || plane == 2 ? s->vsub : 0; int hsub = plane == 1 || plane == 2 ? s->hsub : 0; int h = FF_CEIL_RSHIFT(inlink->h, vsub); int w = FF_CEIL_RSHIFT(inlink->w, hsub); inrow = in ->data[plane]; outrow = out->data[plane]; for (i = 0; i < h; i++) { const uint8_t *tab = s->lut[plane]; for (j = 0; j < w; j++) outrow[j] = tab[inrow[j]]; inrow += in ->linesize[plane]; outrow += out->linesize[plane]; } } } if (!direct) av_frame_free(&in); return ff_filter_frame(outlink, out); } ",1 "static void spl_dllist_it_dtor(zend_object_iterator *iter) /* {{{ */ { spl_dllist_it *iterator = (spl_dllist_it *)iter; SPL_LLIST_CHECK_DELREF(iterator->traverse_pointer); zend_user_it_invalidate_current(iter); zval_ptr_dtor(&iterator->intern.it.data); } /* }}} */ ",0 "static inline void mark_all_clean(struct vmcb *vmcb) { vmcb->control.clean = ((1 << VMCB_DIRTY_MAX) - 1) & ~VMCB_ALWAYS_DIRTY_MASK; } ",0 "perf_event_create_kernel_counter(struct perf_event_attr *attr, int cpu, struct task_struct *task, perf_overflow_handler_t overflow_handler, void *context) { struct perf_event_context *ctx; struct perf_event *event; int err; /* * Get the target context (task or percpu): */ event = perf_event_alloc(attr, cpu, task, NULL, NULL, overflow_handler, context); if (IS_ERR(event)) { err = PTR_ERR(event); goto err; } /* Mark owner so we could distinguish it from user events. */ event->owner = EVENT_OWNER_KERNEL; account_event(event); ctx = find_get_context(event->pmu, task, cpu); if (IS_ERR(ctx)) { err = PTR_ERR(ctx); goto err_free; } WARN_ON_ONCE(ctx->parent_ctx); mutex_lock(&ctx->mutex); perf_install_in_context(ctx, event, cpu); perf_unpin_context(ctx); mutex_unlock(&ctx->mutex); return event; err_free: free_event(event); err: return ERR_PTR(err); } ",0 "void RenderFrameImpl::reportFindInPageMatchCount(int request_id, int count, bool final_update) { int active_match_ordinal = -1; // -1 = don't update active match ordinal if (!count) active_match_ordinal = 0; render_view_->Send(new ViewHostMsg_Find_Reply( render_view_->GetRoutingID(), request_id, count, gfx::Rect(), active_match_ordinal, final_update)); } ",0 "void WebRuntimeFeatures::EnableSharedWorker(bool enable) { RuntimeEnabledFeatures::SetSharedWorkerEnabled(enable); } ",0 " static inline ogg_uint32_t decode_packed_entry_number(codebook *book, oggpack_buffer *b){ ogg_uint32_t chase=0; int read=book->dec_maxlength; long lok = oggpack_look(b,read),i; while(lok<0 && read>1) lok = oggpack_look(b, --read); if(lok<0){ oggpack_adv(b,1); /* force eop */ return -1; } /* chase the tree with the bits we got */ switch (book->dec_method) { case 0: { /* book->dec_nodeb==1, book->dec_leafw==1 */ /* 8/8 - Used */ unsigned char *t=(unsigned char *)book->dec_table; for(i=0;i>i)&1)]; if(chase&0x80UL)break; } chase&=0x7fUL; break; } case 1: { /* book->dec_nodeb==1, book->dec_leafw!=1 */ /* 8/16 - Used by infile2 */ unsigned char *t=(unsigned char *)book->dec_table; for(i=0;i>i)&1; int next=t[chase+bit]; if(next&0x80){ chase= (next<<8) | t[chase+bit+1+(!bit || t[chase]&0x80)]; break; } chase=next; } chase&=~0x8000UL; break; } case 2: { /* book->dec_nodeb==2, book->dec_leafw==1 */ /* 16/16 - Used */ for(i=0;idec_table))[chase*2+((lok>>i)&1)]; if(chase&0x8000UL)break; } chase&=~0x8000UL; break; } case 3: { /* book->dec_nodeb==2, book->dec_leafw!=1 */ /* 16/32 - Used by infile2 */ ogg_uint16_t *t=(ogg_uint16_t *)book->dec_table; for(i=0;i>i)&1; int next=t[chase+bit]; if(next&0x8000){ chase= (next<<16) | t[chase+bit+1+(!bit || t[chase]&0x8000)]; break; } chase=next; } chase&=~0x80000000UL; break; } case 4: { for(i=0;idec_table))[chase*2+((lok>>i)&1)]; if(chase&0x80000000UL)break; } chase&=~0x80000000UL; break; } } if(iflags & HF_SVMI_MASK))) return; gen_update_cc_op(s); gen_jmp_im(pc_start - s->cs_base); gen_helper_svm_check_intercept_param(cpu_env, tcg_const_i32(type), tcg_const_i64(param)); } ",0 "void CLASS read_shorts (ushort *pixel, unsigned count) { if (fread (pixel, 2, count, ifp) < count) derror(); if ((order == 0x4949) == (ntohs(0x1234) == 0x1234)) swab ((const char *)pixel, (char *)pixel, count*2); /*mingw support UF*/ } ",0 "static int nfs_mount_req(struct nfs_priv *npriv) { uint32_t data[1024]; uint32_t *p; int len; int pathlen; struct packet *nfs_packet; pathlen = strlen(npriv->path); debug(""%s: %s\n"", __func__, npriv->path); p = &(data[0]); p = rpc_add_credentials(p); *p++ = hton32(pathlen); if (pathlen & 3) *(p + pathlen / 4) = 0; memcpy (p, npriv->path, pathlen); p += (pathlen + 3) / 4; len = p - &(data[0]); nfs_packet = rpc_req(npriv, PROG_MOUNT, MOUNT_ADDENTRY, data, len); if (IS_ERR(nfs_packet)) return PTR_ERR(nfs_packet); p = (void *)nfs_packet->data + sizeof(struct rpc_reply) + 4; npriv->rootfh.size = ntoh32(net_read_uint32(p++)); if (npriv->rootfh.size > NFS3_FHSIZE) { printf(""%s: file handle too big: %lu\n"", __func__, (unsigned long)npriv->rootfh.size); free(nfs_packet); return -EIO; } memcpy(npriv->rootfh.data, p, npriv->rootfh.size); free(nfs_packet); return 0; } ",0 "int jas_image_getfmt(jas_stream_t *in) { jas_image_fmtinfo_t *fmtinfo; int found; int i; /* Check for data in each of the supported formats. */ found = 0; for (i = 0, fmtinfo = jas_image_fmtinfos; i < jas_image_numfmts; ++i, ++fmtinfo) { if (fmtinfo->ops.validate) { /* Is the input data valid for this format? */ if (!(*fmtinfo->ops.validate)(in)) { found = 1; break; } } } return found ? fmtinfo->id : (-1); } ",0 "onig_number_of_capture_histories(regex_t* reg) { #ifdef USE_CAPTURE_HISTORY int i, n; n = 0; for (i = 0; i <= ONIG_MAX_CAPTURE_HISTORY_GROUP; i++) { if (BIT_STATUS_AT(reg->capture_history, i) != 0) n++; } return n; #else return 0; #endif } ",0 " SkipCode( EXEC_OP ) { CUR.IP += CUR.length; if ( CUR.IP < CUR.codeSize ) { CUR.opcode = CUR.code[CUR.IP]; CUR.length = opcode_length[CUR.opcode]; if ( CUR.length < 0 ) { if ( CUR.IP + 1 > CUR.codeSize ) goto Fail_Overflow; CUR.length = 2 - CUR.length * CUR.code[CUR.IP + 1]; } if ( CUR.IP + CUR.length <= CUR.codeSize ) return SUCCESS; } Fail_Overflow: CUR.error = TT_Err_Code_Overflow; return FAILURE; } ",0 "fetch_name_with_level(OnigCodePoint start_code, UChar** src, UChar* end, UChar** rname_end, ScanEnv* env, int* rback_num, int* rlevel) { int r, sign, is_num, exist_level; OnigCodePoint end_code; OnigCodePoint c = 0; OnigEncoding enc = env->enc; UChar *name_end; UChar *pnum_head; UChar *p = *src; PFETCH_READY; *rback_num = 0; is_num = exist_level = 0; sign = 1; pnum_head = *src; end_code = get_name_end_code_point(start_code); name_end = end; r = 0; if (PEND) { return ONIGERR_EMPTY_GROUP_NAME; } else { PFETCH(c); if (c == end_code) return ONIGERR_EMPTY_GROUP_NAME; if (ONIGENC_IS_CODE_DIGIT(enc, c)) { is_num = 1; } else if (c == '-') { is_num = 2; sign = -1; pnum_head = p; } else if (!ONIGENC_IS_CODE_WORD(enc, c)) { r = ONIGERR_INVALID_CHAR_IN_GROUP_NAME; } } while (!PEND) { name_end = p; PFETCH(c); if (c == end_code || c == ')' || c == '+' || c == '-') { if (is_num == 2) r = ONIGERR_INVALID_GROUP_NAME; break; } if (is_num != 0) { if (ONIGENC_IS_CODE_DIGIT(enc, c)) { is_num = 1; } else { r = ONIGERR_INVALID_GROUP_NAME; is_num = 0; } } else if (!ONIGENC_IS_CODE_WORD(enc, c)) { r = ONIGERR_INVALID_CHAR_IN_GROUP_NAME; } } if (r == 0 && c != end_code) { if (c == '+' || c == '-') { int level; int flag = (c == '-' ? -1 : 1); if (PEND) { r = ONIGERR_INVALID_CHAR_IN_GROUP_NAME; goto end; } PFETCH(c); if (! ONIGENC_IS_CODE_DIGIT(enc, c)) goto err; PUNFETCH; level = onig_scan_unsigned_number(&p, end, enc); if (level < 0) return ONIGERR_TOO_BIG_NUMBER; *rlevel = (level * flag); exist_level = 1; if (!PEND) { PFETCH(c); if (c == end_code) goto end; } } err: r = ONIGERR_INVALID_GROUP_NAME; name_end = end; } end: if (r == 0) { if (is_num != 0) { *rback_num = onig_scan_unsigned_number(&pnum_head, name_end, enc); if (*rback_num < 0) return ONIGERR_TOO_BIG_NUMBER; else if (*rback_num == 0) goto err; *rback_num *= sign; } *rname_end = name_end; *src = p; return (exist_level ? 1 : 0); } else { onig_scan_env_set_error_string(env, r, *src, name_end); return r; } } ",0 "void WebContentsImpl::SetIgnoreInputEvents(bool ignore_input_events) { ignore_input_events_ = ignore_input_events; } ",0 "ACodec::BufferInfo *ACodec::dequeueBufferFromNativeWindow() { ANativeWindowBuffer *buf; CHECK(mNativeWindow.get() != NULL); if (mTunneled) { ALOGW(""dequeueBufferFromNativeWindow() should not be called in tunnel"" "" video playback mode mode!""); return NULL; } if (mFatalError) { ALOGW(""not dequeuing from native window due to fatal error""); return NULL; } int fenceFd = -1; do { status_t err = mNativeWindow->dequeueBuffer(mNativeWindow.get(), &buf, &fenceFd); if (err != 0) { ALOGE(""dequeueBuffer failed: %s(%d)."", asString(err), err); return NULL; } bool stale = false; for (size_t i = mBuffers[kPortIndexOutput].size(); i-- > 0;) { BufferInfo *info = &mBuffers[kPortIndexOutput].editItemAt(i); if (info->mGraphicBuffer != NULL && info->mGraphicBuffer->handle == buf->handle) { if (info->mStatus != BufferInfo::OWNED_BY_NATIVE_WINDOW) { ALOGI(""dequeued stale buffer %p. discarding"", buf); stale = true; break; } ALOGV(""dequeued buffer %p"", info->mGraphicBuffer->getNativeBuffer()); info->mStatus = BufferInfo::OWNED_BY_US; info->setWriteFence(fenceFd, ""dequeueBufferFromNativeWindow""); updateRenderInfoForDequeuedBuffer(buf, fenceFd, info); return info; } } if (!stale && (!storingMetadataInDecodedBuffers() || mLegacyAdaptiveExperiment)) { ALOGI(""dequeued unrecognized (stale) buffer %p. discarding"", buf); stale = true; } if (stale) { buf = NULL; } } while (buf == NULL); BufferInfo *oldest = NULL; for (size_t i = mBuffers[kPortIndexOutput].size(); i-- > 0;) { BufferInfo *info = &mBuffers[kPortIndexOutput].editItemAt(i); if (info->mStatus == BufferInfo::OWNED_BY_NATIVE_WINDOW && (oldest == NULL || mDequeueCounter - info->mDequeuedAt > mDequeueCounter - oldest->mDequeuedAt)) { oldest = info; } } CHECK(oldest != NULL); CHECK(storingMetadataInDecodedBuffers()); oldest->mGraphicBuffer = new GraphicBuffer(buf, false); oldest->mStatus = BufferInfo::OWNED_BY_US; oldest->setWriteFence(fenceFd, ""dequeueBufferFromNativeWindow for oldest""); mRenderTracker.untrackFrame(oldest->mRenderInfo); oldest->mRenderInfo = NULL; mOMX->updateGraphicBufferInMeta( mNode, kPortIndexOutput, oldest->mGraphicBuffer, oldest->mBufferID); if (mOutputMetadataType == kMetadataBufferTypeGrallocSource) { VideoGrallocMetadata *grallocMeta = reinterpret_cast(oldest->mData->base()); ALOGV(""replaced oldest buffer #%u with age %u (%p/%p stored in %p)"", (unsigned)(oldest - &mBuffers[kPortIndexOutput][0]), mDequeueCounter - oldest->mDequeuedAt, (void *)(uintptr_t)grallocMeta->pHandle, oldest->mGraphicBuffer->handle, oldest->mData->base()); } else if (mOutputMetadataType == kMetadataBufferTypeANWBuffer) { VideoNativeMetadata *nativeMeta = reinterpret_cast(oldest->mData->base()); ALOGV(""replaced oldest buffer #%u with age %u (%p/%p stored in %p)"", (unsigned)(oldest - &mBuffers[kPortIndexOutput][0]), mDequeueCounter - oldest->mDequeuedAt, (void *)(uintptr_t)nativeMeta->pBuffer, oldest->mGraphicBuffer->getNativeBuffer(), oldest->mData->base()); } updateRenderInfoForDequeuedBuffer(buf, fenceFd, oldest); return oldest; } ",0 "void WebPageProxy::didRestoreFrameFromPageCache(uint64_t frameID, uint64_t parentFrameID) { MESSAGE_CHECK(m_mainFrame); WebFrameProxy* subframe = process()->webFrame(frameID); MESSAGE_CHECK(subframe); MESSAGE_CHECK(!subframe->parentFrame()); MESSAGE_CHECK(subframe->page() == m_mainFrame->page()); WebFrameProxy* parentFrame = process()->webFrame(parentFrameID); MESSAGE_CHECK(parentFrame); MESSAGE_CHECK(parentFrame->isDescendantOf(m_mainFrame.get())); parentFrame->appendChild(subframe); } ",0 "GF_Err mvex_AddBox(GF_Box *s, GF_Box *a) { GF_MovieExtendsBox *ptr = (GF_MovieExtendsBox *)s; switch (a->type) { case GF_ISOM_BOX_TYPE_TREX: return gf_list_add(ptr->TrackExList, a); case GF_ISOM_BOX_TYPE_TREP: return gf_list_add(ptr->TrackExPropList, a); case GF_ISOM_BOX_TYPE_MEHD: if (ptr->mehd) break; ptr->mehd = (GF_MovieExtendsHeaderBox*)a; return GF_OK; default: return gf_isom_box_add_default(s, a); } return GF_OK; } ",0 "static void persistent_commit_exception(struct dm_exception_store *store, struct dm_exception *e, void (*callback) (void *, int success), void *callback_context) { unsigned int i; struct pstore *ps = get_info(store); struct core_exception ce; struct commit_callback *cb; ce.old_chunk = e->old_chunk; ce.new_chunk = e->new_chunk; write_exception(ps, ps->current_committed++, &ce); /* * Add the callback to the back of the array. This code * is the only place where the callback array is * manipulated, and we know that it will never be called * multiple times concurrently. */ cb = ps->callbacks + ps->callback_count++; cb->callback = callback; cb->context = callback_context; /* * If there are exceptions in flight and we have not yet * filled this metadata area there's nothing more to do. */ if (!atomic_dec_and_test(&ps->pending_count) && (ps->current_committed != ps->exceptions_per_area)) return; /* * If we completely filled the current area, then wipe the next one. */ if ((ps->current_committed == ps->exceptions_per_area) && zero_disk_area(ps, ps->current_area + 1)) ps->valid = 0; /* * Commit exceptions to disk. */ if (ps->valid && area_io(ps, WRITE_FLUSH_FUA)) ps->valid = 0; /* * Advance to the next area if this one is full. */ if (ps->current_committed == ps->exceptions_per_area) { ps->current_committed = 0; ps->current_area++; zero_memory_area(ps); } for (i = 0; i < ps->callback_count; i++) { cb = ps->callbacks + i; cb->callback(cb->context, ps->valid); } ps->callback_count = 0; } ",0 "void PrintDialogGtk::ReleaseDialog() { Release(); } ",0 "PHP_FUNCTION(curl_file_create) { object_init_ex( return_value, curl_CURLFile_class ); curlfile_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU); } ",0 "static int read_registers(modbus_t *ctx, int function, int addr, int nb, uint16_t *dest) { int rc; int req_length; uint8_t req[_MIN_REQ_LENGTH]; uint8_t rsp[MAX_MESSAGE_LENGTH]; if (nb > MODBUS_MAX_READ_REGISTERS) { if (ctx->debug) { fprintf(stderr, ""ERROR Too many registers requested (%d > %d)\n"", nb, MODBUS_MAX_READ_REGISTERS); } errno = EMBMDATA; return -1; } req_length = ctx->backend->build_request_basis(ctx, function, addr, nb, req); rc = send_msg(ctx, req, req_length); if (rc > 0) { int offset; int i; rc = _modbus_receive_msg(ctx, rsp, MSG_CONFIRMATION); if (rc == -1) return -1; rc = check_confirmation(ctx, req, rsp, rc); if (rc == -1) return -1; offset = ctx->backend->header_length; for (i = 0; i < rc; i++) { /* shift reg hi_byte to temp OR with lo_byte */ dest[i] = (rsp[offset + 2 + (i << 1)] << 8) | rsp[offset + 3 + (i << 1)]; } } return rc; } ",0 "static int is_valid_veth_mtu(int new_mtu) { return (new_mtu >= MIN_MTU && new_mtu <= MAX_MTU); } ",0 " bool MatchFilter::MatchesCookie( const net::CookieMonster::CookieListPair& cookie_pair) { const net::CookieMonster::CanonicalCookie& cookie = cookie_pair.second; if (!MatchesString(keys::kNameKey, cookie.Name())) return false; if (!MatchesDomain(cookie_pair.first)) return false; if (!MatchesString(keys::kPathKey, cookie.Path())) return false; if (!MatchesBoolean(keys::kSecureKey, cookie.IsSecure())) return false; if (!MatchesBoolean(keys::kSessionKey, !cookie.DoesExpire())) return false; return true; } ",1 "void SecurityHandler::SetRenderer(RenderProcessHost* process_host, RenderFrameHostImpl* frame_host) { host_ = frame_host; if (enabled_ && host_) AttachToRenderFrameHost(); } ",1 "static int nf_tables_fill_set(struct sk_buff *skb, const struct nft_ctx *ctx, const struct nft_set *set, u16 event, u16 flags) { struct nfgenmsg *nfmsg; struct nlmsghdr *nlh; struct nlattr *desc; u32 portid = ctx->portid; u32 seq = ctx->seq; event |= NFNL_SUBSYS_NFTABLES << 8; nlh = nlmsg_put(skb, portid, seq, event, sizeof(struct nfgenmsg), flags); if (nlh == NULL) goto nla_put_failure; nfmsg = nlmsg_data(nlh); nfmsg->nfgen_family = ctx->afi->family; nfmsg->version = NFNETLINK_V0; nfmsg->res_id = htons(ctx->net->nft.base_seq & 0xffff); if (nla_put_string(skb, NFTA_SET_TABLE, ctx->table->name)) goto nla_put_failure; if (nla_put_string(skb, NFTA_SET_NAME, set->name)) goto nla_put_failure; if (set->flags != 0) if (nla_put_be32(skb, NFTA_SET_FLAGS, htonl(set->flags))) goto nla_put_failure; if (nla_put_be32(skb, NFTA_SET_KEY_TYPE, htonl(set->ktype))) goto nla_put_failure; if (nla_put_be32(skb, NFTA_SET_KEY_LEN, htonl(set->klen))) goto nla_put_failure; if (set->flags & NFT_SET_MAP) { if (nla_put_be32(skb, NFTA_SET_DATA_TYPE, htonl(set->dtype))) goto nla_put_failure; if (nla_put_be32(skb, NFTA_SET_DATA_LEN, htonl(set->dlen))) goto nla_put_failure; } if (set->policy != NFT_SET_POL_PERFORMANCE) { if (nla_put_be32(skb, NFTA_SET_POLICY, htonl(set->policy))) goto nla_put_failure; } desc = nla_nest_start(skb, NFTA_SET_DESC); if (desc == NULL) goto nla_put_failure; if (set->size && nla_put_be32(skb, NFTA_SET_DESC_SIZE, htonl(set->size))) goto nla_put_failure; nla_nest_end(skb, desc); return nlmsg_end(skb, nlh); nla_put_failure: nlmsg_trim(skb, nlh); return -1; } ",0 "static int apparmor_path_mknod(struct path *dir, struct dentry *dentry, int mode, unsigned int dev) { return common_perm_create(OP_MKNOD, dir, dentry, AA_MAY_CREATE, mode); } ",0 "static bool valid_packet_size(size_t len) { /* * A WRITEX with CAP_LARGE_WRITEX can be 64k worth of data plus 65 bytes * of header. Don't print the error if this fits.... JRA. */ if (len > (BUFFER_SIZE + LARGE_WRITEX_HDR_SIZE)) { DEBUG(0,(""Invalid packet length! (%lu bytes).\n"", (unsigned long)len)); return false; } return true; } ",0 "void LayerTreeHostImpl::DidLoseCompositorFrameSink() { if (resource_provider_) resource_provider_->DidLoseContextProvider(); has_valid_compositor_frame_sink_ = false; client_->DidLoseCompositorFrameSinkOnImplThread(); } ",0 "static int handle_lstat(FsContext *fs_ctx, V9fsPath *fs_path, struct stat *stbuf) { int fd, ret; struct handle_data *data = (struct handle_data *)fs_ctx->private; fd = open_by_handle(data->mountfd, fs_path->data, O_PATH); if (fd < 0) { return fd; } ret = fstatat(fd, """", stbuf, AT_EMPTY_PATH); close(fd); return ret; } ",0 "int nfnetlink_has_listeners(struct net *net, unsigned int group) { return netlink_has_listeners(net->nfnl, group); } ",0 "int jas_stream_isseekable(jas_stream_t *stream) { if (stream->ops_ == &jas_stream_memops) { return 1; } else if (stream->ops_ == &jas_stream_fileops) { if ((*stream->ops_->seek_)(stream->obj_, 0, SEEK_CUR) < 0) { return 0; } return 1; } else { return 0; } } ",0 "static int crypto_rfc4309_init_tfm(struct crypto_tfm *tfm) { struct crypto_instance *inst = (void *)tfm->__crt_alg; struct crypto_aead_spawn *spawn = crypto_instance_ctx(inst); struct crypto_rfc4309_ctx *ctx = crypto_tfm_ctx(tfm); struct crypto_aead *aead; unsigned long align; aead = crypto_spawn_aead(spawn); if (IS_ERR(aead)) return PTR_ERR(aead); ctx->child = aead; align = crypto_aead_alignmask(aead); align &= ~(crypto_tfm_ctx_alignment() - 1); tfm->crt_aead.reqsize = sizeof(struct aead_request) + ALIGN(crypto_aead_reqsize(aead), crypto_tfm_ctx_alignment()) + align + 16; return 0; } ",0 "static PixelPacket *QueueAuthenticPixelsCache(Image *image,const ssize_t x, const ssize_t y,const size_t columns,const size_t rows, ExceptionInfo *exception) { CacheInfo *restrict cache_info; const int id = GetOpenMPThreadId(); assert(image != (const Image *) NULL); assert(image->signature == MagickSignature); assert(image->cache != (Cache) NULL); cache_info=(CacheInfo *) image->cache; assert(cache_info->signature == MagickSignature); assert(id < (int) cache_info->number_threads); return(QueueAuthenticPixelCacheNexus(image,x,y,columns,rows,MagickFalse, cache_info->nexus_info[id],exception)); } ",0 "void Browser::BookmarkAllTabs() { BookmarkModel* model = profile()->GetBookmarkModel(); DCHECK(model && model->IsLoaded()); BookmarkEditor::EditDetails details; details.type = BookmarkEditor::EditDetails::NEW_FOLDER; bookmark_utils::GetURLsForOpenTabs(this, &(details.urls)); DCHECK(!details.urls.empty()); BookmarkEditor::Show(window()->GetNativeHandle(), profile_, model->GetParentForNewNodes(), details, BookmarkEditor::SHOW_TREE); } ",0 "MagickPrivate void ResetPixelCacheEpoch(void) { cache_epoch=0; } ",0 "void MediaStreamImpl::OnDeviceOpened( int request_id, const std::string& label, const media_stream::StreamDeviceInfo& video_device) { DVLOG(1) << ""MediaStreamImpl::OnDeviceOpened("" << request_id << "", "" << label << "")""; NOTIMPLEMENTED(); } ",0 "static int rfcomm_sock_getsockopt_old(struct socket *sock, int optname, char __user *optval, int __user *optlen) { struct sock *sk = sock->sk; struct rfcomm_conninfo cinfo; struct l2cap_conn *conn = l2cap_pi(sk)->chan->conn; int len, err = 0; u32 opt; BT_DBG(""sk %p"", sk); if (get_user(len, optlen)) return -EFAULT; lock_sock(sk); switch (optname) { case RFCOMM_LM: switch (rfcomm_pi(sk)->sec_level) { case BT_SECURITY_LOW: opt = RFCOMM_LM_AUTH; break; case BT_SECURITY_MEDIUM: opt = RFCOMM_LM_AUTH | RFCOMM_LM_ENCRYPT; break; case BT_SECURITY_HIGH: opt = RFCOMM_LM_AUTH | RFCOMM_LM_ENCRYPT | RFCOMM_LM_SECURE; break; default: opt = 0; break; } if (rfcomm_pi(sk)->role_switch) opt |= RFCOMM_LM_MASTER; if (put_user(opt, (u32 __user *) optval)) err = -EFAULT; break; case RFCOMM_CONNINFO: if (sk->sk_state != BT_CONNECTED && !rfcomm_pi(sk)->dlc->defer_setup) { err = -ENOTCONN; break; } memset(&cinfo, 0, sizeof(cinfo)); cinfo.hci_handle = conn->hcon->handle; memcpy(cinfo.dev_class, conn->hcon->dev_class, 3); len = min_t(unsigned int, len, sizeof(cinfo)); if (copy_to_user(optval, (char *) &cinfo, len)) err = -EFAULT; break; default: err = -ENOPROTOOPT; break; } release_sock(sk); return err; } ",0 " OVS_EXCLUDED(ofproto_mutex) { struct rule **orig_rules = rules; if (*rules) { struct ofproto *ofproto = rules[0]->ofproto; unsigned long tables[BITMAP_N_LONGS(256)]; struct rule *rule; size_t table_id; memset(tables, 0, sizeof tables); ovs_mutex_lock(&ofproto_mutex); while ((rule = *rules++)) { /* Defer once for each new table. This defers the subtable cleanup * until later, so that when removing large number of flows the * operation is faster. */ if (!bitmap_is_set(tables, rule->table_id)) { struct classifier *cls = &ofproto->tables[rule->table_id].cls; bitmap_set1(tables, rule->table_id); classifier_defer(cls); } remove_rule_rcu__(rule); } BITMAP_FOR_EACH_1(table_id, 256, tables) { struct classifier *cls = &ofproto->tables[table_id].cls; classifier_publish(cls); } ovs_mutex_unlock(&ofproto_mutex); } free(orig_rules); } ",0 "const unsigned char* Track::GetCodecPrivate(size_t& size) const { size = m_info.codecPrivateSize; return m_info.codecPrivate; } ",1 "static unsigned char *read_chunk(struct mschm_decompressor_p *self, struct mschmd_header *chm, struct mspack_file *fh, unsigned int chunk_num) { struct mspack_system *sys = self->system; unsigned char *buf; /* check arguments - most are already checked by chmd_fast_find */ if (chunk_num >= chm->num_chunks) return NULL; /* ensure chunk cache is available */ if (!chm->chunk_cache) { size_t size = sizeof(unsigned char *) * chm->num_chunks; if (!(chm->chunk_cache = (unsigned char **) sys->alloc(sys, size))) { self->error = MSPACK_ERR_NOMEMORY; return NULL; } memset(chm->chunk_cache, 0, size); } /* try to answer out of chunk cache */ if (chm->chunk_cache[chunk_num]) return chm->chunk_cache[chunk_num]; /* need to read chunk - allocate memory for it */ if (!(buf = (unsigned char *) sys->alloc(sys, chm->chunk_size))) { self->error = MSPACK_ERR_NOMEMORY; return NULL; } /* seek to block and read it */ if (sys->seek(fh, (off_t) (chm->dir_offset + (chunk_num * chm->chunk_size)), MSPACK_SYS_SEEK_START)) { self->error = MSPACK_ERR_SEEK; sys->free(buf); return NULL; } if (sys->read(fh, buf, (int)chm->chunk_size) != (int)chm->chunk_size) { self->error = MSPACK_ERR_READ; sys->free(buf); return NULL; } /* check the signature. Is is PMGL or PMGI? */ if (!((buf[0] == 0x50) && (buf[1] == 0x4D) && (buf[2] == 0x47) && ((buf[3] == 0x4C) || (buf[3] == 0x49)))) { self->error = MSPACK_ERR_SEEK; sys->free(buf); return NULL; } /* all OK. Store chunk in cache and return it */ return chm->chunk_cache[chunk_num] = buf; } ",0 "static unsigned long weighted_cpuload(const int cpu) { return cpu_rq(cpu)->load.weight; } ",0 "void XMLHttpRequest::createRequest(ExceptionState& es) { if (m_url.protocolIs(""blob"") && m_method != ""GET"") { es.throwDOMException(NetworkError, ExceptionMessages::failedToExecute(""send"", ""XMLHttpRequest"", ""'GET' is the only method allowed for 'blob:' URLs."")); return; } bool uploadEvents = false; if (m_async) { m_progressEventThrottle.dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadstartEvent)); if (m_requestEntityBody && m_upload) { uploadEvents = m_upload->hasEventListeners(); m_upload->dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadstartEvent)); } } m_sameOriginRequest = securityOrigin()->canRequest(m_url); m_uploadEventsAllowed = m_sameOriginRequest || uploadEvents || !isSimpleCrossOriginAccessRequest(m_method, m_requestHeaders); ResourceRequest request(m_url); request.setHTTPMethod(m_method); request.setTargetType(ResourceRequest::TargetIsXHR); InspectorInstrumentation::willLoadXHR(scriptExecutionContext(), this, m_method, m_url, m_async, m_requestEntityBody ? m_requestEntityBody->deepCopy() : 0, m_requestHeaders, m_includeCredentials); if (m_requestEntityBody) { ASSERT(m_method != ""GET""); ASSERT(m_method != ""HEAD""); request.setHTTPBody(m_requestEntityBody.release()); } if (m_requestHeaders.size() > 0) request.addHTTPHeaderFields(m_requestHeaders); ThreadableLoaderOptions options; options.sendLoadCallbacks = SendCallbacks; options.sniffContent = DoNotSniffContent; options.preflightPolicy = uploadEvents ? ForcePreflight : ConsiderPreflight; options.allowCredentials = (m_sameOriginRequest || m_includeCredentials) ? AllowStoredCredentials : DoNotAllowStoredCredentials; options.credentialsRequested = m_includeCredentials ? ClientRequestedCredentials : ClientDidNotRequestCredentials; options.crossOriginRequestPolicy = UseAccessControl; options.securityOrigin = securityOrigin(); options.initiator = FetchInitiatorTypeNames::xmlhttprequest; options.contentSecurityPolicyEnforcement = ContentSecurityPolicy::shouldBypassMainWorld(scriptExecutionContext()) ? DoNotEnforceContentSecurityPolicy : EnforceConnectSrcDirective; options.mixedContentBlockingTreatment = TreatAsActiveContent; options.timeoutMilliseconds = m_timeoutMilliseconds; m_exceptionCode = 0; m_error = false; if (m_async) { if (m_upload) request.setReportUploadProgress(true); ASSERT(!m_loader); m_loader = ThreadableLoader::create(scriptExecutionContext(), this, request, options); if (m_loader) { ASSERT(!hasPendingActivity()); setPendingActivity(this); } } else { request.setPriority(ResourceLoadPriorityVeryHigh); InspectorInstrumentation::willLoadXHRSynchronously(scriptExecutionContext()); ThreadableLoader::loadResourceSynchronously(scriptExecutionContext(), request, *this, options); InspectorInstrumentation::didLoadXHRSynchronously(scriptExecutionContext()); } if (!m_exceptionCode && m_error) m_exceptionCode = NetworkError; if (m_exceptionCode) es.throwDOMException(m_exceptionCode); } ",0 "void SoftFlacEncoder::onQueueFilled(OMX_U32 portIndex) { UNUSED_UNLESS_VERBOSE(portIndex); ALOGV(""SoftFlacEncoder::onQueueFilled(portIndex=%d)"", portIndex); if (mSignalledError) { return; } List &inQueue = getPortQueue(0); List &outQueue = getPortQueue(1); while (!inQueue.empty() && !outQueue.empty()) { BufferInfo *inInfo = *inQueue.begin(); OMX_BUFFERHEADERTYPE *inHeader = inInfo->mHeader; BufferInfo *outInfo = *outQueue.begin(); OMX_BUFFERHEADERTYPE *outHeader = outInfo->mHeader; if (inHeader->nFlags & OMX_BUFFERFLAG_EOS) { inQueue.erase(inQueue.begin()); inInfo->mOwnedByUs = false; notifyEmptyBufferDone(inHeader); outHeader->nFilledLen = 0; outHeader->nFlags = OMX_BUFFERFLAG_EOS; outQueue.erase(outQueue.begin()); outInfo->mOwnedByUs = false; notifyFillBufferDone(outHeader); return; } if (inHeader->nFilledLen > kMaxInputBufferSize) { ALOGE(""input buffer too large (%d)."", inHeader->nFilledLen); mSignalledError = true; notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL); return; } assert(mNumChannels != 0); mEncoderWriteData = true; mEncoderReturnedEncodedData = false; mEncoderReturnedNbBytes = 0; mCurrentInputTimeStamp = inHeader->nTimeStamp; const unsigned nbInputFrames = inHeader->nFilledLen / (2 * mNumChannels); const unsigned nbInputSamples = inHeader->nFilledLen / 2; const OMX_S16 * const pcm16 = reinterpret_cast(inHeader->pBuffer); CHECK_LE(nbInputSamples, 2 * kMaxNumSamplesPerFrame); for (unsigned i=0 ; i < nbInputSamples ; i++) { mInputBufferPcm32[i] = (FLAC__int32) pcm16[i]; } ALOGV("" about to encode %u samples per channel"", nbInputFrames); FLAC__bool ok = FLAC__stream_encoder_process_interleaved( mFlacStreamEncoder, mInputBufferPcm32, nbInputFrames /*samples per channel*/ ); if (ok) { if (mEncoderReturnedEncodedData && (mEncoderReturnedNbBytes != 0)) { ALOGV("" dequeueing buffer on output port after writing data""); outInfo->mOwnedByUs = false; outQueue.erase(outQueue.begin()); outInfo = NULL; notifyFillBufferDone(outHeader); outHeader = NULL; mEncoderReturnedEncodedData = false; } else { ALOGV("" encoder process_interleaved returned without data to write""); } } else { ALOGE("" error encountered during encoding""); mSignalledError = true; notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL); return; } inInfo->mOwnedByUs = false; inQueue.erase(inQueue.begin()); inInfo = NULL; notifyEmptyBufferDone(inHeader); inHeader = NULL; } } ",0 "void TCGetNTNameFromNumber (LPWSTR ntname, int cbNtName, int nDriveNo) { WCHAR tmp[2] = {0, 0}; int j = nDriveNo + (WCHAR) 'A'; tmp[0] = (short) j; RtlStringCbCopyW (ntname, cbNtName,(LPWSTR) NT_MOUNT_PREFIX); RtlStringCbCatW (ntname, cbNtName, tmp); } ",0 " void OnQuerySelector(std::unique_ptr result) { EXPECT_EQ(nullptr, result); FinishAsynchronousTest(); } ",0 "static void perf_event_mmap_output(struct perf_event *event, void *data) { struct perf_mmap_event *mmap_event = data; struct perf_output_handle handle; struct perf_sample_data sample; int size = mmap_event->event_id.header.size; int ret; if (!perf_event_mmap_match(event, data)) return; if (event->attr.mmap2) { mmap_event->event_id.header.type = PERF_RECORD_MMAP2; mmap_event->event_id.header.size += sizeof(mmap_event->maj); mmap_event->event_id.header.size += sizeof(mmap_event->min); mmap_event->event_id.header.size += sizeof(mmap_event->ino); mmap_event->event_id.header.size += sizeof(mmap_event->ino_generation); mmap_event->event_id.header.size += sizeof(mmap_event->prot); mmap_event->event_id.header.size += sizeof(mmap_event->flags); } perf_event_header__init_id(&mmap_event->event_id.header, &sample, event); ret = perf_output_begin(&handle, event, mmap_event->event_id.header.size); if (ret) goto out; mmap_event->event_id.pid = perf_event_pid(event, current); mmap_event->event_id.tid = perf_event_tid(event, current); perf_output_put(&handle, mmap_event->event_id); if (event->attr.mmap2) { perf_output_put(&handle, mmap_event->maj); perf_output_put(&handle, mmap_event->min); perf_output_put(&handle, mmap_event->ino); perf_output_put(&handle, mmap_event->ino_generation); perf_output_put(&handle, mmap_event->prot); perf_output_put(&handle, mmap_event->flags); } __output_copy(&handle, mmap_event->file_name, mmap_event->file_size); perf_event__output_id_sample(event, &handle, &sample); perf_output_end(&handle); out: mmap_event->event_id.header.size = size; } ",0 "bool IsBrowserInitiated(NavigationParams* pending) { return pending && !pending->common_params.url.SchemeIs(url::kJavaScriptScheme); } ",0 "event_wait(void *eventhdl) { int res = WaitForSingleObject((HANDLE)eventhdl, (DWORD)INFINITE); return (res == WAIT_OBJECT_0); } ",0 "BGD_DECLARE(int) gdImageGetTrueColorPixel (gdImagePtr im, int x, int y) { int p = gdImageGetPixel (im, x, y); if (!im->trueColor) { return gdTrueColorAlpha (im->red[p], im->green[p], im->blue[p], (im->transparent == p) ? gdAlphaTransparent : im->alpha[p]); } else { return p; } } ",0 " void OnRunning(bool state) { DoOnRunning(state); } ",0 "void __init zone_sizes_init(void) { unsigned long max_zone_pfns[MAX_NR_ZONES]; memset(max_zone_pfns, 0, sizeof(max_zone_pfns)); #ifdef CONFIG_ZONE_DMA max_zone_pfns[ZONE_DMA] = min(MAX_DMA_PFN, max_low_pfn); #endif #ifdef CONFIG_ZONE_DMA32 max_zone_pfns[ZONE_DMA32] = min(MAX_DMA32_PFN, max_low_pfn); #endif max_zone_pfns[ZONE_NORMAL] = max_low_pfn; #ifdef CONFIG_HIGHMEM max_zone_pfns[ZONE_HIGHMEM] = max_pfn; #endif free_area_init_nodes(max_zone_pfns); } ",0 "static int vsock_send_shutdown(struct sock *sk, int mode) { return transport->shutdown(vsock_sk(sk), mode); } ",0 "static struct sk_buff *llcp_add_header(struct sk_buff *pdu, u8 dsap, u8 ssap, u8 ptype) { u8 header[2]; pr_debug(""ptype 0x%x dsap 0x%x ssap 0x%x\n"", ptype, dsap, ssap); header[0] = (u8)((dsap << 2) | (ptype >> 2)); header[1] = (u8)((ptype << 6) | ssap); pr_debug(""header 0x%x 0x%x\n"", header[0], header[1]); skb_put_data(pdu, header, LLCP_HEADER_SIZE); return pdu; } ",0 " TabLifecycleUnitSource::TabLifecycleUnit::TabLifecycleUnit( base::ObserverList* observers, content::WebContents* web_contents, TabStripModel* tab_strip_model) : LifecycleUnitBase(web_contents->GetVisibility()), content::WebContentsObserver(web_contents), observers_(observers), tab_strip_model_(tab_strip_model) { DCHECK(observers_); DCHECK(GetWebContents()); DCHECK(tab_strip_model_); } ",0 "static void coin_cleanup(void* c) { uivector_cleanup(&((Coin*)c)->symbols); } ",0 "DEFUN(execsh, EXEC_SHELL SHELL, ""Execute shell command and display output"") { char *cmd; CurrentKeyData = NULL; /* not allowed in w3m-control: */ cmd = searchKeyData(); if (cmd == NULL || *cmd == '\0') { cmd = inputLineHist(""(exec shell)!"", """", IN_COMMAND, ShellHist); } if (cmd != NULL) cmd = conv_to_system(cmd); if (cmd != NULL && *cmd != '\0') { fmTerm(); printf(""\n""); system(cmd); /* FIXME: gettextize? */ printf(""\n[Hit any key]""); fflush(stdout); fmInit(); getch(); } displayBuffer(Currentbuf, B_FORCE_REDRAW); } ",0 "static int unregister_transfer_cb(int id, void *ptr, void *data) { struct loop_device *lo = ptr; struct loop_func_table *xfer = data; mutex_lock(&lo->lo_ctl_mutex); if (lo->lo_encryption == xfer) loop_release_xfer(lo); mutex_unlock(&lo->lo_ctl_mutex); return 0; } ",0 "void Browser::TabInsertedAt(TabStripModel* tab_strip_model, WebContents* contents, int index, bool foreground) { SetAsDelegate(contents, true); SessionTabHelper* session_tab_helper = SessionTabHelper::FromWebContents(contents); session_tab_helper->SetWindowID(session_id()); content::NotificationService::current()->Notify( chrome::NOTIFICATION_TAB_PARENTED, content::Source(contents), content::NotificationService::NoDetails()); SyncHistoryWithTabs(index); LoadingStateChanged(contents, true); interstitial_observers_.push_back(new InterstitialObserver(this, contents)); SessionService* session_service = SessionServiceFactory::GetForProfile(profile_); if (session_service) { session_service->TabInserted(contents); int new_active_index = tab_strip_model_->active_index(); if (index < new_active_index) session_service->SetSelectedTabInWindow(session_id(), new_active_index); } } ",0 "static void atl2_vlan_mode(struct net_device *netdev, netdev_features_t features) { struct atl2_adapter *adapter = netdev_priv(netdev); u32 ctrl; atl2_irq_disable(adapter); ctrl = ATL2_READ_REG(&adapter->hw, REG_MAC_CTRL); __atl2_vlan_mode(features, &ctrl); ATL2_WRITE_REG(&adapter->hw, REG_MAC_CTRL, ctrl); atl2_irq_enable(adapter); } ",0 "void GLES2Implementation::CoverStrokePathInstancedCHROMIUM( GLsizei num_paths, GLenum path_name_type, const GLvoid* paths, GLuint path_base, GLenum cover_mode, GLenum transform_type, const GLfloat* transform_values) { GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG(""["" << GetLogPrefix() << ""] glCoverStrokePathInstancedCHROMIUM("" << num_paths << "", "" << path_name_type << "", "" << paths << "", "" << path_base << "", "" << cover_mode << "", "" << transform_type << "", "" << transform_values << "")""); ScopedTransferBufferPtr buffer(helper_, transfer_buffer_); uint32_t paths_shm_id = 0; uint32_t paths_offset = 0; uint32_t transforms_shm_id = 0; uint32_t transforms_offset = 0; if (!PrepareInstancedPathCommand( ""glCoverStrokePathInstancedCHROMIUM"", num_paths, path_name_type, paths, transform_type, transform_values, &buffer, &paths_shm_id, &paths_offset, &transforms_shm_id, &transforms_offset)) { return; } helper_->CoverStrokePathInstancedCHROMIUM( num_paths, path_name_type, paths_shm_id, paths_offset, path_base, cover_mode, transform_type, transforms_shm_id, transforms_offset); CheckGLError(); } ",0 " MessageLoop* message_loop() { return message_loop_; } ",0 "static void sd_prot_op(struct scsi_cmnd *scmd, unsigned int dif) { unsigned int prot_op = SCSI_PROT_NORMAL; unsigned int dix = scsi_prot_sg_count(scmd); if (scmd->sc_data_direction == DMA_FROM_DEVICE) { if (dif && dix) prot_op = SCSI_PROT_READ_PASS; else if (dif && !dix) prot_op = SCSI_PROT_READ_STRIP; else if (!dif && dix) prot_op = SCSI_PROT_READ_INSERT; } else { if (dif && dix) prot_op = SCSI_PROT_WRITE_PASS; else if (dif && !dix) prot_op = SCSI_PROT_WRITE_INSERT; else if (!dif && dix) prot_op = SCSI_PROT_WRITE_STRIP; } scsi_set_prot_op(scmd, prot_op); scsi_set_prot_type(scmd, dif); } ",0 "static void perWorldAttributeAttributeGetterForMainWorld(const v8::PropertyCallbackInfo& info) { TestObject* imp = V8TestObject::toNative(info.Holder()); v8SetReturnValueForMainWorld(info, WTF::getPtr(imp->perWorldAttribute())); } ",0 "static void __generic_bitop_flags(RAnalOp *op) { ESIL_A (""0,vf,=,""); // V ESIL_A (""0,RPICK,0x80,&,!,!,nf,=,""); // N ESIL_A (""0,RPICK,!,zf,=,""); // Z ESIL_A (""vf,nf,^,sf,=,""); // S } ",0 "PHP_FUNCTION(unregister_tick_function) { zval *function; user_tick_function_entry tick_fe; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""z/"", &function) == FAILURE) { return; } if (!BG(user_tick_functions)) { return; } if (Z_TYPE_P(function) != IS_ARRAY && Z_TYPE_P(function) != IS_OBJECT) { convert_to_string(function); } tick_fe.arguments = (zval **) emalloc(sizeof(zval *)); tick_fe.arguments[0] = function; tick_fe.arg_count = 1; zend_llist_del_element(BG(user_tick_functions), &tick_fe, (int (*)(void *, void *)) user_tick_function_compare); efree(tick_fe.arguments); } ",0 "inline int PacketCopyDataOffset(Packet *p, uint32_t offset, uint8_t *data, uint32_t datalen) { if (unlikely(offset + datalen > MAX_PAYLOAD_SIZE)) { /* too big */ return -1; } /* Do we have already an packet with allocated data */ if (! p->ext_pkt) { uint32_t newsize = offset + datalen; if (newsize < offset) return -1; if (newsize <= default_packet_size) { /* data will fit in memory allocated with packet */ memcpy(GET_PKT_DIRECT_DATA(p) + offset, data, datalen); } else { /* here we need a dynamic allocation */ p->ext_pkt = SCMalloc(MAX_PAYLOAD_SIZE); if (unlikely(p->ext_pkt == NULL)) { SET_PKT_LEN(p, 0); return -1; } /* copy initial data */ memcpy(p->ext_pkt, GET_PKT_DIRECT_DATA(p), GET_PKT_DIRECT_MAX_SIZE(p)); /* copy data as asked */ memcpy(p->ext_pkt + offset, data, datalen); } } else { memcpy(p->ext_pkt + offset, data, datalen); } return 0; } ",0 "void DevToolsWindow::Inspect(scoped_refptr host) { DevToolsWindow::OpenDevToolsWindow(host, profile_); } ",0 "static void _6502_anal_esil_get_addr_pattern2(RAnalOp *op, const ut8* data, char* addrbuf, int addrsize, char reg) { switch(data[0] & 0x1f) { // 0x1f = b00111111 case 0x02: // op #$ff op->cycles = 2; snprintf (addrbuf, addrsize, ""0x%02x"", data[1]); break; case 0x0a: //op a op->cycles = 2; snprintf (addrbuf, addrsize, ""a""); break; case 0x06: // op $ff op->cycles = 5; snprintf (addrbuf, addrsize, ""0x%02x"", data[1]); break; case 0x16: // op $ff,x op->cycles = 6; snprintf (addrbuf, addrsize, ""%c,0x%02x,+"", reg, data[1]); break; case 0x0e: // op $ffff op->cycles = 6; snprintf (addrbuf, addrsize, ""0x%04x"", data[1] | data[2] << 8); break; case 0x1e: // op $ffff,x op->cycles = 7; snprintf (addrbuf, addrsize, ""%c,0x%04x,+"", reg, data[1] | data[2] << 8); break; } } ",0 "static inline void encode_claim_previous(struct xdr_stream *xdr, fmode_t type) { __be32 *p; p = reserve_space(xdr, 4); *p = cpu_to_be32(NFS4_OPEN_CLAIM_PREVIOUS); encode_delegation_type(xdr, type); } ",0 "xfs_reclaim_inodes_count( struct xfs_mount *mp) { struct xfs_perag *pag; xfs_agnumber_t ag = 0; int reclaimable = 0; while ((pag = xfs_perag_get_tag(mp, ag, XFS_ICI_RECLAIM_TAG))) { ag = pag->pag_agno + 1; reclaimable += pag->pag_ici_reclaimable; xfs_perag_put(pag); } return reclaimable; } ",0 "bool TabStrip::IsRectInWindowCaption(const gfx::Rect& rect) { const views::View* v = GetEventHandlerForRect(rect); if (v == this) return true; const int drag_handle_extension = TabStyle::GetDragHandleExtension(height()); bool extend_drag_handle = !controller_->IsFrameCondensed() && !controller_->EverHasVisibleBackgroundTabShapes(); const int tab_index = tabs_.GetIndexOfView(v); if (IsValidModelIndex(tab_index)) { Tab* tab = tab_at(tab_index); gfx::Rect tab_drag_handle = tab->GetMirroredBounds(); tab_drag_handle.set_height(drag_handle_extension); return extend_drag_handle && !tab->IsActive() && tab_drag_handle.Intersects(rect); } gfx::Rect new_tab_button_drag_handle = new_tab_button_->GetMirroredBounds(); new_tab_button_drag_handle.set_height(drag_handle_extension); if (extend_drag_handle && new_tab_button_drag_handle.Intersects(rect)) return true; gfx::RectF rect_in_new_tab_coords_f(rect); View::ConvertRectToTarget(this, new_tab_button_, &rect_in_new_tab_coords_f); gfx::Rect rect_in_new_tab_coords = gfx::ToEnclosingRect(rect_in_new_tab_coords_f); return new_tab_button_->GetLocalBounds().Intersects(rect_in_new_tab_coords) && !new_tab_button_->HitTestRect(rect_in_new_tab_coords); } ",0 "void AutomationProvider::OnSetPageFontSize(int tab_handle, int font_size) { AutomationPageFontSize automation_font_size = static_cast(font_size); if (automation_font_size < SMALLEST_FONT || automation_font_size > LARGEST_FONT) { DLOG(ERROR) << ""Invalid font size specified : "" << font_size; return; } if (tab_tracker_->ContainsHandle(tab_handle)) { NavigationController* tab = tab_tracker_->GetResource(tab_handle); DCHECK(tab != NULL); if (tab && tab->tab_contents()) { DCHECK(tab->tab_contents()->profile() != NULL); tab->tab_contents()->profile()->GetPrefs()->SetInteger( prefs::kWebKitDefaultFontSize, font_size); } } } ",0 "bool WebView::onIMEComposition(LPARAM lparam) { LOG(TextInput, ""onIMEComposition %s"", imeCompositionArgumentNames(lparam).latin1().data()); HIMC hInputContext = getIMMContext(); if (!hInputContext) return true; if (!m_page->selectionState().isContentEditable) return true; prepareCandidateWindow(hInputContext); if (lparam & GCS_RESULTSTR || !lparam) { String compositionString; if (!getCompositionString(hInputContext, GCS_RESULTSTR, compositionString) && lparam) return true; m_page->confirmComposition(compositionString); return true; } String compositionString; if (!getCompositionString(hInputContext, GCS_COMPSTR, compositionString)) return true; int numAttributes = Ime::ImmGetCompositionStringW(hInputContext, GCS_COMPATTR, 0, 0); Vector attributes(numAttributes); Ime::ImmGetCompositionStringW(hInputContext, GCS_COMPATTR, attributes.data(), numAttributes); int numBytes = Ime::ImmGetCompositionStringW(hInputContext, GCS_COMPCLAUSE, 0, 0); Vector clauses(numBytes / sizeof(DWORD)); Ime::ImmGetCompositionStringW(hInputContext, GCS_COMPCLAUSE, clauses.data(), numBytes); Vector underlines; compositionToUnderlines(clauses, attributes, underlines); int cursorPosition = LOWORD(Ime::ImmGetCompositionStringW(hInputContext, GCS_CURSORPOS, 0, 0)); m_page->setComposition(compositionString, underlines, cursorPosition); return true; } ",0 " static int find_low_bit(unsigned int x) { int i; for(i=0;i<=31;i++) { if(x&(1<::get(); for (ViewMap::iterator it = views->begin(); it != views->end(); ++it) { if (!visitor->Visit(it->second)) return; } } ",0 "static TcpStateQueue *StreamTcp3whsFindSynAckByAck(TcpSession *ssn, Packet *p) { uint32_t ack = TCP_GET_SEQ(p); uint32_t seq = TCP_GET_ACK(p) - 1; TcpStateQueue *q = ssn->queue; while (q != NULL) { if (seq == q->seq && ack == q->ack) { return q; } q = q->next; } return NULL; } ",0 "gfx::NativeView RenderWidgetHostViewAura::GetNativeView() const { return window_; } ",0 "void jsvKill() { #ifdef RESIZABLE_JSVARS unsigned int i; for (i=0;i>JSVAR_BLOCK_SHIFT;i++) free(jsVarBlocks[i]); free(jsVarBlocks); jsVarBlocks = 0; jsVarsSize = 0; #endif } ",0 " GURL testUrl(const FilePath& file_path) { const FilePath kTestDir(FILE_PATH_LITERAL(""indexeddb"")); return ui_test_utils::GetTestUrl(kTestDir, file_path); } ",0 "static struct bpf_func_state *func(struct bpf_verifier_env *env, const struct bpf_reg_state *reg) { struct bpf_verifier_state *cur = env->cur_state; return cur->frame[reg->frameno]; } ",0 " ~ScopedPackStateRowLengthReset() { if (row_length_ != 0) { api_->glPixelStoreiFn(GL_PACK_ROW_LENGTH, row_length_); } } ",0 "XML_GetCurrentByteCount(XML_Parser parser) { if (parser == NULL) return 0; if (parser->m_eventEndPtr && parser->m_eventPtr) return (int)(parser->m_eventEndPtr - parser->m_eventPtr); return 0; } ",0 "status_t IGraphicBufferProducer::QueueBufferInput::unflatten( void const*& buffer, size_t& size, int const*& fds, size_t& count) { size_t minNeeded = sizeof(timestamp) + sizeof(isAutoTimestamp) + sizeof(crop) + sizeof(scalingMode) + sizeof(transform) + sizeof(async); if (size < minNeeded) { return NO_MEMORY; } FlattenableUtils::read(buffer, size, timestamp); FlattenableUtils::read(buffer, size, isAutoTimestamp); FlattenableUtils::read(buffer, size, crop); FlattenableUtils::read(buffer, size, scalingMode); FlattenableUtils::read(buffer, size, transform); FlattenableUtils::read(buffer, size, async); fence = new Fence(); return fence->unflatten(buffer, size, fds, count); } ",0 "check_format(struct magic_set *ms, struct magic *m) { char *ptr; for (ptr = m->desc; *ptr; ptr++) if (*ptr == '%') break; if (*ptr == '\0') { /* No format string; ok */ return 1; } assert(file_nformats == file_nnames); if (m->type >= file_nformats) { file_magwarn(ms, ""Internal error inconsistency between "" ""m->type and format strings""); return -1; } if (file_formats[m->type] == FILE_FMT_NONE) { file_magwarn(ms, ""No format string for `%s' with description "" ""`%s'"", m->desc, file_names[m->type]); return -1; } ptr++; if (check_format_type(ptr, m->type) == -1) { /* * TODO: this error message is unhelpful if the format * string is not one character long */ file_magwarn(ms, ""Printf format `%c' is not valid for type "" ""`%s' in description `%s'"", *ptr ? *ptr : '?', file_names[m->type], m->desc); return -1; } for (; *ptr; ptr++) { if (*ptr == '%') { file_magwarn(ms, ""Too many format strings (should have at most one) "" ""for `%s' with description `%s'"", file_names[m->type], m->desc); return -1; } } return 0; } ",0 "static void PerWorldBindingsReadonlyTestInterfaceEmptyAttributeAttributeGetterForMainWorld(const v8::FunctionCallbackInfo& info) { v8::Local holder = info.Holder(); TestObject* impl = V8TestObject::ToImpl(holder); TestInterfaceEmpty* cpp_value(WTF::GetPtr(impl->perWorldBindingsReadonlyTestInterfaceEmptyAttribute())); if (cpp_value && DOMDataStore::SetReturnValueForMainWorld(info.GetReturnValue(), cpp_value)) return; v8::Local v8_value(ToV8(cpp_value, holder, info.GetIsolate())); static const V8PrivateProperty::SymbolKey kKeepAliveKey; V8PrivateProperty::GetSymbol(info.GetIsolate(), kKeepAliveKey) .Set(holder, v8_value); V8SetReturnValue(info, v8_value); } ",0 "static struct netpoll_info *bond_netpoll_info(struct bonding *bond) { return bond->dev->npinfo; } ",0 "static STACK_OF(X509) * load_all_certs_from_file(char *certfile) { STACK_OF(X509_INFO) *sk=NULL; STACK_OF(X509) *stack=NULL, *ret=NULL; BIO *in=NULL; X509_INFO *xi; if(!(stack = sk_X509_new_null())) { php_openssl_store_errors(); php_error_docref(NULL, E_ERROR, ""memory allocation failure""); goto end; } if (php_openssl_open_base_dir_chk(certfile)) { sk_X509_free(stack); goto end; } if(!(in=BIO_new_file(certfile, ""r""))) { php_openssl_store_errors(); php_error_docref(NULL, E_WARNING, ""error opening the file, %s"", certfile); sk_X509_free(stack); goto end; } /* This loads from a file, a stack of x509/crl/pkey sets */ if(!(sk=PEM_X509_INFO_read_bio(in, NULL, NULL, NULL))) { php_openssl_store_errors(); php_error_docref(NULL, E_WARNING, ""error reading the file, %s"", certfile); sk_X509_free(stack); goto end; } /* scan over it and pull out the certs */ while (sk_X509_INFO_num(sk)) { xi=sk_X509_INFO_shift(sk); if (xi->x509 != NULL) { sk_X509_push(stack,xi->x509); xi->x509=NULL; } X509_INFO_free(xi); } if(!sk_X509_num(stack)) { php_error_docref(NULL, E_WARNING, ""no certificates in file, %s"", certfile); sk_X509_free(stack); goto end; } ret=stack; end: BIO_free(in); sk_X509_INFO_free(sk); return ret; } ",0 "static bt_status_t register_notification_rsp(btrc_event_id_t event_id, btrc_notification_type_t type, btrc_register_notification_t *p_param) { tAVRC_RESPONSE avrc_rsp; CHECK_RC_CONNECTED BTIF_TRACE_EVENT(""## %s ## event_id:%s"", __FUNCTION__, dump_rc_notification_event_id(event_id)); if (btif_rc_cb.rc_notif[event_id-1].bNotify == FALSE) { BTIF_TRACE_ERROR(""Avrcp Event id not registered: event_id = %x"", event_id); return BT_STATUS_NOT_READY; } memset(&(avrc_rsp.reg_notif), 0, sizeof(tAVRC_REG_NOTIF_RSP)); avrc_rsp.reg_notif.event_id = event_id; switch(event_id) { case BTRC_EVT_PLAY_STATUS_CHANGED: avrc_rsp.reg_notif.param.play_status = p_param->play_status; if (avrc_rsp.reg_notif.param.play_status == PLAY_STATUS_PLAYING) btif_av_clear_remote_suspend_flag(); break; case BTRC_EVT_TRACK_CHANGE: memcpy(&(avrc_rsp.reg_notif.param.track), &(p_param->track), sizeof(btrc_uid_t)); break; case BTRC_EVT_PLAY_POS_CHANGED: avrc_rsp.reg_notif.param.play_pos = p_param->song_pos; break; default: BTIF_TRACE_WARNING(""%s : Unhandled event ID : 0x%x"", __FUNCTION__, event_id); return BT_STATUS_UNHANDLED; } avrc_rsp.reg_notif.pdu = AVRC_PDU_REGISTER_NOTIFICATION; avrc_rsp.reg_notif.opcode = opcode_from_pdu(AVRC_PDU_REGISTER_NOTIFICATION); avrc_rsp.get_play_status.status = AVRC_STS_NO_ERROR; /* Send the response. */ send_metamsg_rsp(btif_rc_cb.rc_handle, btif_rc_cb.rc_notif[event_id-1].label, ((type == BTRC_NOTIFICATION_TYPE_INTERIM)?AVRC_CMD_NOTIF:AVRC_RSP_CHANGED), &avrc_rsp); return BT_STATUS_SUCCESS; } ",0 "static int setup_rootfs(struct lxc_conf *conf) { const struct lxc_rootfs *rootfs = &conf->rootfs; if (!rootfs->path) { if (mount("""", ""/"", NULL, MS_SLAVE|MS_REC, 0)) { SYSERROR(""Failed to make / rslave""); return -1; } return 0; } if (access(rootfs->mount, F_OK)) { SYSERROR(""failed to access to '%s', check it is present"", rootfs->mount); return -1; } struct bdev *bdev = bdev_init(conf, rootfs->path, rootfs->mount, rootfs->options); if (bdev && bdev->ops->mount(bdev) == 0) { bdev_put(bdev); DEBUG(""mounted '%s' on '%s'"", rootfs->path, rootfs->mount); return 0; } if (bdev) bdev_put(bdev); if (mount_rootfs(rootfs->path, rootfs->mount, rootfs->options)) { ERROR(""failed to mount rootfs""); return -1; } DEBUG(""mounted '%s' on '%s'"", rootfs->path, rootfs->mount); return 0; } ",0 "static inline void gen_movs(DisasContext *s, TCGMemOp ot) { gen_string_movl_A0_ESI(s); gen_op_ld_v(s, ot, cpu_T0, cpu_A0); gen_string_movl_A0_EDI(s); gen_op_st_v(s, ot, cpu_T0, cpu_A0); gen_op_movl_T0_Dshift(ot); gen_op_add_reg_T0(s->aflag, R_ESI); gen_op_add_reg_T0(s->aflag, R_EDI); } ",0 "static void __exit vmx_exit(void) { #ifdef CONFIG_KEXEC_CORE RCU_INIT_POINTER(crash_vmclear_loaded_vmcss, NULL); synchronize_rcu(); #endif kvm_exit(); } ",0 "static void php_zlib_output_compression_start(TSRMLS_D) { zval *zoh; php_output_handler *h; switch (ZLIBG(output_compression)) { case 0: break; case 1: ZLIBG(output_compression) = PHP_OUTPUT_HANDLER_DEFAULT_SIZE; /* break omitted intentionally */ default: if ( php_zlib_output_encoding(TSRMLS_C) && (h = php_zlib_output_handler_init(ZEND_STRL(PHP_ZLIB_OUTPUT_HANDLER_NAME), ZLIBG(output_compression), PHP_OUTPUT_HANDLER_STDFLAGS TSRMLS_CC)) && (SUCCESS == php_output_handler_start(h TSRMLS_CC))) { if (ZLIBG(output_handler) && *ZLIBG(output_handler)) { MAKE_STD_ZVAL(zoh); ZVAL_STRING(zoh, ZLIBG(output_handler), 1); php_output_start_user(zoh, ZLIBG(output_compression), PHP_OUTPUT_HANDLER_STDFLAGS TSRMLS_CC); zval_ptr_dtor(&zoh); } } break; } } ",0 "void ResourceFetcher::garbageCollectDocumentResources() { typedef Vector StringVector; StringVector resourcesToDelete; for (DocumentResourceMap::iterator it = m_documentResources.begin(); it != m_documentResources.end(); ++it) { if (it->value->hasOneHandle()) resourcesToDelete.append(it->key); } m_documentResources.removeAll(resourcesToDelete); } ",0 "void PrintWebViewHelper::PrintNode(const WebKit::WebNode& node) { if (node.isNull() || !node.document().frame()) { return; } if (is_preview_enabled_) { print_preview_context_.InitWithNode(node); RequestPrintPreview(PRINT_PREVIEW_USER_INITIATED_CONTEXT_NODE); } else { WebKit::WebNode duplicate_node(node); Print(duplicate_node.document().frame(), duplicate_node); } } ",1 "FrameTree* WebContentsImpl::GetFrameTree() { return &frame_tree_; } ",0 "static int submit_bulk_transfer(struct usbi_transfer *itransfer) { struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer); struct libusb_context *ctx = DEVICE_CTX(transfer->dev_handle->dev); struct windows_transfer_priv *transfer_priv = (struct windows_transfer_priv*)usbi_transfer_get_os_priv(itransfer); struct windows_device_priv *priv = _device_priv(transfer->dev_handle->dev); int r; r = priv->apib->submit_bulk_transfer(SUB_API_NOTSET, itransfer); if (r != LIBUSB_SUCCESS) { return r; } usbi_add_pollfd(ctx, transfer_priv->pollable_fd.fd, (short)(IS_XFERIN(transfer) ? POLLIN : POLLOUT)); itransfer->flags |= USBI_TRANSFER_UPDATED_FDS; return LIBUSB_SUCCESS; } ",0 "int snd_pcm_hw_constraint_ratnums(struct snd_pcm_runtime *runtime, unsigned int cond, snd_pcm_hw_param_t var, const struct snd_pcm_hw_constraint_ratnums *r) { return snd_pcm_hw_rule_add(runtime, cond, var, snd_pcm_hw_rule_ratnums, (void *)r, var, -1); } ",0 "static int airo_open(struct net_device *dev) { struct airo_info *ai = dev->ml_priv; int rc = 0; if (test_bit(FLAG_FLASHING, &ai->flags)) return -EIO; /* Make sure the card is configured. * Wireless Extensions may postpone config changes until the card * is open (to pipeline changes and speed-up card setup). If * those changes are not yet committed, do it now - Jean II */ if (test_bit(FLAG_COMMIT, &ai->flags)) { disable_MAC(ai, 1); writeConfigRid(ai, 1); } if (ai->wifidev != dev) { clear_bit(JOB_DIE, &ai->jobs); ai->airo_thread_task = kthread_run(airo_thread, dev, dev->name); if (IS_ERR(ai->airo_thread_task)) return (int)PTR_ERR(ai->airo_thread_task); rc = request_irq(dev->irq, airo_interrupt, IRQF_SHARED, dev->name, dev); if (rc) { airo_print_err(dev->name, ""register interrupt %d failed, rc %d"", dev->irq, rc); set_bit(JOB_DIE, &ai->jobs); kthread_stop(ai->airo_thread_task); return rc; } /* Power on the MAC controller (which may have been disabled) */ clear_bit(FLAG_RADIO_DOWN, &ai->flags); enable_interrupts(ai); try_auto_wep(ai); } enable_MAC(ai, 1); netif_start_queue(dev); return 0; } ",0 "static int cr_interception(struct vcpu_svm *svm) { int reg, cr; unsigned long val; int err; if (!static_cpu_has(X86_FEATURE_DECODEASSISTS)) return emulate_on_interception(svm); if (unlikely((svm->vmcb->control.exit_info_1 & CR_VALID) == 0)) return emulate_on_interception(svm); reg = svm->vmcb->control.exit_info_1 & SVM_EXITINFO_REG_MASK; cr = svm->vmcb->control.exit_code - SVM_EXIT_READ_CR0; err = 0; if (cr >= 16) { /* mov to cr */ cr -= 16; val = kvm_register_read(&svm->vcpu, reg); switch (cr) { case 0: if (!check_selective_cr0_intercepted(svm, val)) err = kvm_set_cr0(&svm->vcpu, val); else return 1; break; case 3: err = kvm_set_cr3(&svm->vcpu, val); break; case 4: err = kvm_set_cr4(&svm->vcpu, val); break; case 8: err = kvm_set_cr8(&svm->vcpu, val); break; default: WARN(1, ""unhandled write to CR%d"", cr); kvm_queue_exception(&svm->vcpu, UD_VECTOR); return 1; } } else { /* mov from cr */ switch (cr) { case 0: val = kvm_read_cr0(&svm->vcpu); break; case 2: val = svm->vcpu.arch.cr2; break; case 3: val = kvm_read_cr3(&svm->vcpu); break; case 4: val = kvm_read_cr4(&svm->vcpu); break; case 8: val = kvm_get_cr8(&svm->vcpu); break; default: WARN(1, ""unhandled read from CR%d"", cr); kvm_queue_exception(&svm->vcpu, UD_VECTOR); return 1; } kvm_register_write(&svm->vcpu, reg, val); } kvm_complete_insn_gp(&svm->vcpu, err); return 1; } ",0 "static noinline struct kmem_cache *dma_kmalloc_cache(int index, gfp_t flags) { struct kmem_cache *s; char *text; size_t realsize; s = kmalloc_caches_dma[index]; if (s) return s; /* Dynamically create dma cache */ if (flags & __GFP_WAIT) down_write(&slub_lock); else { if (!down_write_trylock(&slub_lock)) goto out; } if (kmalloc_caches_dma[index]) goto unlock_out; realsize = kmalloc_caches[index].objsize; text = kasprintf(flags & ~SLUB_DMA, ""kmalloc_dma-%d"", (unsigned int)realsize); s = kmalloc(kmem_size, flags & ~SLUB_DMA); if (!s || !text || !kmem_cache_open(s, flags, text, realsize, ARCH_KMALLOC_MINALIGN, SLAB_CACHE_DMA|__SYSFS_ADD_DEFERRED, NULL)) { kfree(s); kfree(text); goto unlock_out; } list_add(&s->list, &slab_caches); kmalloc_caches_dma[index] = s; schedule_work(&sysfs_add_work); unlock_out: up_write(&slub_lock); out: return kmalloc_caches_dma[index]; } ",0 "void Document::registerNodeList(const LiveNodeListBase* list) { DCHECK(!m_nodeLists[list->invalidationType()].contains(list)); m_nodeLists[list->invalidationType()].add(list); if (list->isRootedAtTreeScope()) m_listsInvalidatedAtDocument.add(list); } ",0 " static void TearDownTestCase() { vpx_free(source_data_); source_data_ = NULL; vpx_free(reference_data_); reference_data_ = NULL; } ",1 "void TestingAutomationProvider::GoBack( DictionaryValue* args, IPC::Message* reply_message) { if (SendErrorIfModalDialogActive(this, reply_message)) return; WebContents* web_contents; std::string error; if (!GetTabFromJSONArgs(args, &web_contents, &error)) { AutomationJSONReply(this, reply_message).SendError(error); return; } NavigationController& controller = web_contents->GetController(); if (!controller.CanGoBack()) { DictionaryValue dict; dict.SetBoolean(""did_go_back"", false); AutomationJSONReply(this, reply_message).SendSuccess(&dict); return; } new NavigationNotificationObserver(&controller, this, reply_message, 1, false, true); controller.GoBack(); } ",0 "struct sk_buff *__netdev_alloc_skb(struct net_device *dev, unsigned int len, gfp_t gfp_mask) { struct page_frag_cache *nc; unsigned long flags; struct sk_buff *skb; bool pfmemalloc; void *data; len += NET_SKB_PAD; if ((len > SKB_WITH_OVERHEAD(PAGE_SIZE)) || (gfp_mask & (__GFP_DIRECT_RECLAIM | GFP_DMA))) { skb = __alloc_skb(len, gfp_mask, SKB_ALLOC_RX, NUMA_NO_NODE); if (!skb) goto skb_fail; goto skb_success; } len += SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); len = SKB_DATA_ALIGN(len); if (sk_memalloc_socks()) gfp_mask |= __GFP_MEMALLOC; local_irq_save(flags); nc = this_cpu_ptr(&netdev_alloc_cache); data = page_frag_alloc(nc, len, gfp_mask); pfmemalloc = nc->pfmemalloc; local_irq_restore(flags); if (unlikely(!data)) return NULL; skb = __build_skb(data, len); if (unlikely(!skb)) { skb_free_frag(data); return NULL; } /* use OR instead of assignment to avoid clearing of bits in mask */ if (pfmemalloc) skb->pfmemalloc = 1; skb->head_frag = 1; skb_success: skb_reserve(skb, NET_SKB_PAD); skb->dev = dev; skb_fail: return skb; } ",0 "void WebMediaPlayerMS::OnSeekBackward(double seconds) { } ",0 "PHP_FUNCTION(pg_client_encoding) { zval *pgsql_link = NULL; int id = -1, argc = ZEND_NUM_ARGS(); PGconn *pgsql; if (zend_parse_parameters(argc TSRMLS_CC, ""|r"", &pgsql_link) == FAILURE) { return; } if (argc == 0) { id = PGG(default_link); CHECK_DEFAULT_LINK(id); } if (pgsql_link == NULL && id == -1) { RETURN_FALSE; } ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, ""PostgreSQL link"", le_link, le_plink); /* Just do the same as found in PostgreSQL sources... */ Z_STRVAL_P(return_value) = (char *) pg_encoding_to_char(PQclientEncoding(pgsql)); Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value)); Z_STRVAL_P(return_value) = (char *) estrdup(Z_STRVAL_P(return_value)); Z_TYPE_P(return_value) = IS_STRING; } ",0 "PHP_GSHUTDOWN_FUNCTION(phar) /* {{{ */ { zend_hash_destroy(&phar_globals->mime_types); } /* }}} */ ",0 "void RenderFrameHostImpl::OnUpdateToUniqueOrigin( bool is_potentially_trustworthy_unique_origin) { url::Origin origin; DCHECK(origin.unique()); frame_tree_node()->SetCurrentOrigin(origin, is_potentially_trustworthy_unique_origin); } ",0 " chromeos::NoteTakingLockScreenSupport GetAppLockScreenStatus( const std::string& app_id) { std::unique_ptr info = chromeos::NoteTakingHelper::Get()->GetPreferredChromeAppInfo( browser()->profile()); if (!info || info->app_id != app_id) return chromeos::NoteTakingLockScreenSupport::kNotSupported; return info->lock_screen_support; } ",0 "static void ExtentToStringSet(const URLPatternSet& host_extent, std::set* result) { URLPatternList patterns = host_extent.patterns(); URLPatternList::const_iterator i; for (i = patterns.begin(); i != patterns.end(); ++i) result->insert(i->GetAsString()); } ",0 "static void nsc_rle_decompress_data(NSC_CONTEXT* context) { UINT16 i; BYTE* rle; UINT32 planeSize; UINT32 originalSize; rle = context->Planes; for (i = 0; i < 4; i++) { originalSize = context->OrgByteCount[i]; planeSize = context->PlaneByteCount[i]; if (planeSize == 0) FillMemory(context->priv->PlaneBuffers[i], originalSize, 0xFF); else if (planeSize < originalSize) nsc_rle_decode(rle, context->priv->PlaneBuffers[i], originalSize); else CopyMemory(context->priv->PlaneBuffers[i], rle, originalSize); rle += planeSize; } } ",1 "static int proc_pid_limits(struct task_struct *task, char *buffer) { unsigned int i; int count = 0; unsigned long flags; char *bufptr = buffer; struct rlimit rlim[RLIM_NLIMITS]; if (!lock_task_sighand(task, &flags)) return 0; memcpy(rlim, task->signal->rlim, sizeof(struct rlimit) * RLIM_NLIMITS); unlock_task_sighand(task, &flags); /* * print the file header */ count += sprintf(&bufptr[count], ""%-25s %-20s %-20s %-10s\n"", ""Limit"", ""Soft Limit"", ""Hard Limit"", ""Units""); for (i = 0; i < RLIM_NLIMITS; i++) { if (rlim[i].rlim_cur == RLIM_INFINITY) count += sprintf(&bufptr[count], ""%-25s %-20s "", lnames[i].name, ""unlimited""); else count += sprintf(&bufptr[count], ""%-25s %-20lu "", lnames[i].name, rlim[i].rlim_cur); if (rlim[i].rlim_max == RLIM_INFINITY) count += sprintf(&bufptr[count], ""%-20s "", ""unlimited""); else count += sprintf(&bufptr[count], ""%-20lu "", rlim[i].rlim_max); if (lnames[i].unit) count += sprintf(&bufptr[count], ""%-10s\n"", lnames[i].unit); else count += sprintf(&bufptr[count], ""\n""); } return count; } ",0 "static int dvb_usbv2_i2c_init(struct dvb_usb_device *d) { int ret; dev_dbg(&d->udev->dev, ""%s:\n"", __func__); if (!d->props->i2c_algo) return 0; strlcpy(d->i2c_adap.name, d->name, sizeof(d->i2c_adap.name)); d->i2c_adap.algo = d->props->i2c_algo; d->i2c_adap.dev.parent = &d->udev->dev; i2c_set_adapdata(&d->i2c_adap, d); ret = i2c_add_adapter(&d->i2c_adap); if (ret < 0) { d->i2c_adap.algo = NULL; goto err; } return 0; err: dev_dbg(&d->udev->dev, ""%s: failed=%d\n"", __func__, ret); return ret; } ",0 "static int crypto_pcbc_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) { struct blkcipher_walk walk; struct crypto_blkcipher *tfm = desc->tfm; struct crypto_pcbc_ctx *ctx = crypto_blkcipher_ctx(tfm); struct crypto_cipher *child = ctx->child; int err; blkcipher_walk_init(&walk, dst, src, nbytes); err = blkcipher_walk_virt(desc, &walk); while ((nbytes = walk.nbytes)) { if (walk.src.virt.addr == walk.dst.virt.addr) nbytes = crypto_pcbc_decrypt_inplace(desc, &walk, child); else nbytes = crypto_pcbc_decrypt_segment(desc, &walk, child); err = blkcipher_walk_done(desc, &walk, nbytes); } return err; } ",0 "void BackingStoreGtk::PaintToBackingStore( RenderProcessHost* process, TransportDIB::Id bitmap, const gfx::Rect& bitmap_rect, const std::vector& copy_rects, float scale_factor, const base::Closure& completion_callback, bool* scheduled_completion_callback) { *scheduled_completion_callback = false; if (!display_) return; if (bitmap_rect.IsEmpty()) return; const int width = bitmap_rect.width(); const int height = bitmap_rect.height(); if (width <= 0 || width > kMaxVideoLayerSize || height <= 0 || height > kMaxVideoLayerSize) return; TransportDIB* dib = process->GetTransportDIB(bitmap); if (!dib) return; if (!use_render_) return PaintRectWithoutXrender(dib, bitmap_rect, copy_rects); Picture picture; Pixmap pixmap; if (shared_memory_support_ == ui::SHARED_MEMORY_PIXMAP) { XShmSegmentInfo shminfo = {0}; shminfo.shmseg = dib->MapToX(display_); pixmap = XShmCreatePixmap(display_, root_window_, NULL, &shminfo, width, height, 32); } else { pixmap = XCreatePixmap(display_, root_window_, width, height, 32); GC gc = XCreateGC(display_, pixmap, 0, NULL); if (shared_memory_support_ == ui::SHARED_MEMORY_PUTIMAGE) { const XID shmseg = dib->MapToX(display_); XShmSegmentInfo shminfo; memset(&shminfo, 0, sizeof(shminfo)); shminfo.shmseg = shmseg; shminfo.shmaddr = static_cast(dib->memory()); XImage* image = XShmCreateImage(display_, static_cast(visual_), 32, ZPixmap, shminfo.shmaddr, &shminfo, width, height); #if defined(ARCH_CPU_ARM_FAMILY) for (size_t i = 0; i < copy_rects.size(); i++) { const gfx::Rect& copy_rect = copy_rects[i]; XShmPutImage(display_, pixmap, gc, image, copy_rect.x() - bitmap_rect.x(), /* source x */ copy_rect.y() - bitmap_rect.y(), /* source y */ copy_rect.x() - bitmap_rect.x(), /* dest x */ copy_rect.y() - bitmap_rect.y(), /* dest y */ copy_rect.width(), copy_rect.height(), False /* send_event */); } #else XShmPutImage(display_, pixmap, gc, image, 0, 0 /* source x, y */, 0, 0 /* dest x, y */, width, height, False /* send_event */); #endif XDestroyImage(image); } else { // case SHARED_MEMORY_NONE XImage image; memset(&image, 0, sizeof(image)); image.width = width; image.height = height; image.depth = 32; image.bits_per_pixel = 32; image.format = ZPixmap; image.byte_order = LSBFirst; image.bitmap_unit = 8; image.bitmap_bit_order = LSBFirst; image.bytes_per_line = width * 4; image.red_mask = 0xff; image.green_mask = 0xff00; image.blue_mask = 0xff0000; image.data = static_cast(dib->memory()); XPutImage(display_, pixmap, gc, &image, 0, 0 /* source x, y */, 0, 0 /* dest x, y */, width, height); } XFreeGC(display_, gc); } picture = ui::CreatePictureFromSkiaPixmap(display_, pixmap); for (size_t i = 0; i < copy_rects.size(); i++) { const gfx::Rect& copy_rect = copy_rects[i]; XRenderComposite(display_, PictOpSrc, // op picture, // src 0, // mask picture_, // dest copy_rect.x() - bitmap_rect.x(), // src_x copy_rect.y() - bitmap_rect.y(), // src_y 0, // mask_x 0, // mask_y copy_rect.x(), // dest_x copy_rect.y(), // dest_y copy_rect.width(), // width copy_rect.height()); // height } if (shared_memory_support_ != ui::SHARED_MEMORY_NONE) { XSyncHandler* handler = XSyncHandler::GetInstance(); if (handler->Enabled()) { *scheduled_completion_callback = true; handler->PushPaintCounter(display_, picture, pixmap, completion_callback); } else { XSync(display_, False); } } if (*scheduled_completion_callback == false) { XRenderFreePicture(display_, picture); XFreePixmap(display_, pixmap); } } ",0 "static bool create_outbuf(TALLOC_CTX *mem_ctx, struct smb_request *req, const char *inbuf, char **outbuf, uint8_t num_words, uint32_t num_bytes) { /* * Protect against integer wrap */ if ((num_bytes > 0xffffff) || ((num_bytes + smb_size + num_words*2) > 0xffffff)) { char *msg; if (asprintf(&msg, ""num_bytes too large: %u"", (unsigned)num_bytes) == -1) { msg = CONST_DISCARD(char *, ""num_bytes too large""); } smb_panic(msg); } *outbuf = TALLOC_ARRAY(mem_ctx, char, smb_size + num_words*2 + num_bytes); if (*outbuf == NULL) { return false; } construct_reply_common(req, inbuf, *outbuf); srv_set_message(*outbuf, num_words, num_bytes, false); /* * Zero out the word area, the caller has to take care of the bcc area * himself */ if (num_words != 0) { memset(*outbuf + smb_vwv0, 0, num_words*2); } return true; } ",0 "RTCPeerConnectionHandler::RTCPeerConnectionHandler( blink::WebRTCPeerConnectionHandlerClient* client, PeerConnectionDependencyFactory* dependency_factory, scoped_refptr task_runner) : id_(base::ToUpperASCII(base::UnguessableToken::Create().ToString())), initialize_called_(false), client_(client), is_closed_(false), dependency_factory_(dependency_factory), track_adapter_map_( new WebRtcMediaStreamTrackAdapterMap(dependency_factory_, task_runner)), task_runner_(std::move(task_runner)), weak_factory_(this) { CHECK(client_); GetPeerConnectionHandlers()->insert(this); } ",0 "bool CSSStyleSheet::isLoading() { unsigned len = length(); for (unsigned i = 0; i < len; ++i) { StyleBase* rule = item(i); if (rule->isImportRule() && static_cast(rule)->isLoading()) return true; } return false; } ",0 "static void interface_get_init_info(QXLInstance *sin, QXLDevInitInfo *info) { SimpleSpiceDisplay *ssd = container_of(sin, SimpleSpiceDisplay, qxl); info->memslot_gen_bits = MEMSLOT_GENERATION_BITS; info->memslot_id_bits = MEMSLOT_SLOT_BITS; info->num_memslots = NUM_MEMSLOTS; info->num_memslots_groups = NUM_MEMSLOTS_GROUPS; info->internal_groupslot_id = 0; info->qxl_ram_size = ssd->bufsize; info->n_surfaces = ssd->num_surfaces; } ",0 "void Document::dataWillChange(const CharacterData& characterData) { if (LocalFrame* frame = this->frame()) frame->selection().dataWillChange(characterData); } ",0 "nfsd4_write(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_write *write) { stateid_t *stateid = &write->wr_stateid; struct file *filp = NULL; __be32 status = nfs_ok; unsigned long cnt; int nvecs; if (write->wr_offset >= OFFSET_MAX) return nfserr_inval; status = nfs4_preprocess_stateid_op(rqstp, cstate, &cstate->current_fh, stateid, WR_STATE, &filp, NULL); if (status) { dprintk(""NFSD: nfsd4_write: couldn't process stateid!\n""); return status; } cnt = write->wr_buflen; write->wr_how_written = write->wr_stable_how; gen_boot_verifier(&write->wr_verifier, SVC_NET(rqstp)); nvecs = fill_in_write_vector(rqstp->rq_vec, write); WARN_ON_ONCE(nvecs > ARRAY_SIZE(rqstp->rq_vec)); status = nfsd_vfs_write(rqstp, &cstate->current_fh, filp, write->wr_offset, rqstp->rq_vec, nvecs, &cnt, write->wr_how_written); fput(filp); write->wr_bytes_written = cnt; return status; } ",0 "int postgresTimeStampForTimeString(const char *timestring, char *dest, size_t destsize) { int nlength = strlen(timestring); int timeresolution = msTimeGetResolution(timestring); int bNoDate = (*timestring == 'T'); if (timeresolution < 0) return MS_FALSE; switch(timeresolution) { case TIME_RESOLUTION_YEAR: if (timestring[nlength-1] != '-') { snprintf(dest, destsize,""date '%s-01-01'"",timestring); } else { snprintf(dest, destsize,""date '%s01-01'"",timestring); } break; case TIME_RESOLUTION_MONTH: if (timestring[nlength-1] != '-') { snprintf(dest, destsize,""date '%s-01'"",timestring); } else { snprintf(dest, destsize,""date '%s01'"",timestring); } break; case TIME_RESOLUTION_DAY: snprintf(dest, destsize,""date '%s'"",timestring); break; case TIME_RESOLUTION_HOUR: if (timestring[nlength-1] != ':') { if(bNoDate) snprintf(dest, destsize,""time '%s:00:00'"", timestring); else snprintf(dest, destsize,""timestamp '%s:00:00'"", timestring); } else { if(bNoDate) snprintf(dest, destsize,""time '%s00:00'"", timestring); else snprintf(dest, destsize,""timestamp '%s00:00'"", timestring); } break; case TIME_RESOLUTION_MINUTE: if (timestring[nlength-1] != ':') { if(bNoDate) snprintf(dest, destsize,""time '%s:00'"", timestring); else snprintf(dest, destsize,""timestamp '%s:00'"", timestring); } else { if(bNoDate) snprintf(dest, destsize,""time '%s00'"", timestring); else snprintf(dest, destsize,""timestamp '%s00'"", timestring); } break; case TIME_RESOLUTION_SECOND: if(bNoDate) snprintf(dest, destsize,""time '%s'"", timestring); else snprintf(dest, destsize,""timestamp '%s'"", timestring); break; default: return MS_FAILURE; } return MS_SUCCESS; } ",0 "static int network_config_set_string (const oconfig_item_t *ci, /* {{{ */ char **ret_string) { char *tmp; if ((ci->values_num != 1) || (ci->values[0].type != OCONFIG_TYPE_STRING)) { WARNING (""network plugin: The `%s' config option needs exactly "" ""one string argument."", ci->key); return (-1); } tmp = strdup (ci->values[0].value.string); if (tmp == NULL) return (-1); sfree (*ret_string); *ret_string = tmp; return (0); } /* }}} int network_config_set_string */ ",0 "ResourceMultiBuffer* UrlData::multibuffer() { DCHECK(thread_checker_.CalledOnValidThread()); return &multibuffer_; } ",0 "void RenderBox::flipForWritingMode(FloatRect& rect) const { if (!style()->isFlippedBlocksWritingMode()) return; if (isHorizontalWritingMode()) rect.setY(height() - rect.maxY()); else rect.setX(width() - rect.maxX()); } ",0 "void LayerTreeHostImpl::ElementIsAnimatingChanged( ElementId element_id, ElementListType list_type, const PropertyAnimationState& mask, const PropertyAnimationState& state) { LayerTreeImpl* tree = list_type == ElementListType::ACTIVE ? active_tree() : pending_tree(); if (!tree) return; LayerImpl* layer = tree->LayerByElementId(element_id); if (layer) layer->OnIsAnimatingChanged(mask, state); } ",0 "ssize_t MPEG4DataSource::readAt(off64_t offset, void *data, size_t size) { Mutex::Autolock autoLock(mLock); if (isInRange(mCachedOffset, mCachedSize, offset, size)) { memcpy(data, &mCache[offset - mCachedOffset], size); return size; } return mSource->readAt(offset, data, size); } ",0 "void Gfx::opCurveTo(Object args[], int numArgs) { double x1, y1, x2, y2, x3, y3; if (!state->isCurPt()) { error(getPos(), ""No current point in curveto""); return; } x1 = args[0].getNum(); y1 = args[1].getNum(); x2 = args[2].getNum(); y2 = args[3].getNum(); x3 = args[4].getNum(); y3 = args[5].getNum(); state->curveTo(x1, y1, x2, y2, x3, y3); } ",0 "GF_Err frma_dump(GF_Box *a, FILE * trace) { GF_OriginalFormatBox *p; p = (GF_OriginalFormatBox *)a; gf_isom_box_dump_start(a, ""OriginalFormatBox"", trace); fprintf(trace, ""data_format=\""%s\"">\n"", gf_4cc_to_str(p->data_format)); gf_isom_box_dump_done(""OriginalFormatBox"", a, trace); return GF_OK; } ",0 " virtual ~TransientWindowObserver() {} ",0 "static WKRetainPtr NavigationTypeToString(WKFrameNavigationType type) { switch (type) { case kWKFrameNavigationTypeLinkClicked: return adoptWK(WKStringCreateWithUTF8CString(""link clicked"")); case kWKFrameNavigationTypeFormSubmitted: return adoptWK(WKStringCreateWithUTF8CString(""form submitted"")); case kWKFrameNavigationTypeBackForward: return adoptWK(WKStringCreateWithUTF8CString(""back/forward"")); case kWKFrameNavigationTypeReload: return adoptWK(WKStringCreateWithUTF8CString(""reload"")); case kWKFrameNavigationTypeFormResubmitted: return adoptWK(WKStringCreateWithUTF8CString(""form resubmitted"")); case kWKFrameNavigationTypeOther: return adoptWK(WKStringCreateWithUTF8CString(""other"")); } return adoptWK(WKStringCreateWithUTF8CString(""illegal value"")); } ",0 "int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) { struct fxregs_state *fxsave = &vcpu->arch.guest_fpu.state.fxsave; memcpy(fpu->fpr, fxsave->st_space, 128); fpu->fcw = fxsave->cwd; fpu->fsw = fxsave->swd; fpu->ftwx = fxsave->twd; fpu->last_opcode = fxsave->fop; fpu->last_ip = fxsave->rip; fpu->last_dp = fxsave->rdp; memcpy(fpu->xmm, fxsave->xmm_space, sizeof fxsave->xmm_space); return 0; } ",0 "int kern_path(const char *name, unsigned int flags, struct path *path) { return filename_lookup(AT_FDCWD, getname_kernel(name), flags, path, NULL); } ",0 "static MagickBooleanType ComparePixels(const LayerMethod method, const PixelInfo *p,const PixelInfo *q) { double o1, o2; /* Any change in pixel values */ if (method == CompareAnyLayer) return((MagickBooleanType)(IsFuzzyEquivalencePixelInfo(p,q) == MagickFalse)); o1 = (p->alpha_trait != UndefinedPixelTrait) ? p->alpha : OpaqueAlpha; o2 = (q->alpha_trait != UndefinedPixelTrait) ? q->alpha : OpaqueAlpha; /* Pixel goes from opaque to transprency. */ if (method == CompareClearLayer) return((MagickBooleanType) ( (o1 >= ((double) QuantumRange/2.0)) && (o2 < ((double) QuantumRange/2.0)) ) ); /* Overlay would change first pixel by second. */ if (method == CompareOverlayLayer) { if (o2 < ((double) QuantumRange/2.0)) return MagickFalse; return((MagickBooleanType) (IsFuzzyEquivalencePixelInfo(p,q) == MagickFalse)); } return(MagickFalse); } ",0 "pvscsi_ring_flush_req(PVSCSIRingInfo *mgr) { RS_SET_FIELD(mgr, reqConsIdx, mgr->consumed_ptr); } ",0 "SimpleSoftOMXComponent::SimpleSoftOMXComponent( const char *name, const OMX_CALLBACKTYPE *callbacks, OMX_PTR appData, OMX_COMPONENTTYPE **component) : SoftOMXComponent(name, callbacks, appData, component), mLooper(new ALooper), mHandler(new AHandlerReflector(this)), mState(OMX_StateLoaded), mTargetState(OMX_StateLoaded) { mLooper->setName(name); mLooper->registerHandler(mHandler); mLooper->start( false, // runOnCallingThread false, // canCallJava ANDROID_PRIORITY_FOREGROUND); } ",0 "static inline void put_binfmt(struct linux_binfmt * fmt) { module_put(fmt->module); } ",0 "bool IsOzoneDrmMojo() { return base::FeatureList::IsEnabled(kEnableOzoneDrmMojo) || !IsAshInBrowserProcess(); } ",0 "void *vfs_add_fsp_extension_notype(vfs_handle_struct *handle, files_struct *fsp, size_t ext_size, void (*destroy_fn)(void *p_data)) { struct vfs_fsp_data *ext; void * ext_data; /* Prevent VFS modules adding multiple extensions. */ if ((ext_data = vfs_fetch_fsp_extension(handle, fsp))) { return ext_data; } ext = (struct vfs_fsp_data *)TALLOC_ZERO( handle->conn, sizeof(struct vfs_fsp_data) + ext_size); if (ext == NULL) { return NULL; } ext->owner = handle; ext->next = fsp->vfs_extension; ext->destroy = destroy_fn; fsp->vfs_extension = ext; return EXT_DATA_AREA(ext); } ",0 "static inline int copy_to_user_sec_ctx(struct xfrm_policy *xp, struct sk_buff *skb) { if (xp->security) return copy_sec_ctx(xp->security, skb); return 0; } ",0 "irc_server_login (struct t_irc_server *server) { const char *password, *username, *realname; password = IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_PASSWORD); username = IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_USERNAME); realname = IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_REALNAME); if (password && password[0]) irc_server_sendf (server, 0, NULL, ""PASS %s"", password); if (!server->nick) { irc_server_set_nick (server, (server->nicks_array) ? server->nicks_array[0] : ""weechat""); server->nick_first_tried = 0; } else server->nick_first_tried = irc_server_get_nick_index (server); if (irc_server_sasl_enabled (server)) { irc_server_sendf (server, 0, NULL, ""CAP LS""); } irc_server_sendf (server, 0, NULL, ""NICK %s\n"" ""USER %s %s %s :%s"", server->nick, (username && username[0]) ? username : ""weechat"", (username && username[0]) ? username : ""weechat"", server->current_address, (realname && realname[0]) ? realname : ((username && username[0]) ? username : ""weechat"")); if (server->hook_timer_connection) weechat_unhook (server->hook_timer_connection); server->hook_timer_connection = weechat_hook_timer ( IRC_SERVER_OPTION_INTEGER (server, IRC_SERVER_OPTION_CONNECTION_TIMEOUT) * 1000, 0, 1, &irc_server_timer_connection_cb, server); } ",0 "static int tcmu_glfs_flush(struct tcmu_device *dev, struct tcmulib_cmd *cmd) { struct glfs_state *state = tcmu_get_dev_private(dev); glfs_cbk_cookie *cookie; cookie = calloc(1, sizeof(*cookie)); if (!cookie) { tcmu_err(""Could not allocate cookie: %m\n""); goto out; } cookie->dev = dev; cookie->cmd = cmd; cookie->length = 0; cookie->op = TCMU_GLFS_FLUSH; if (glfs_fdatasync_async(state->gfd, glfs_async_cbk, cookie) < 0) { tcmu_err(""glfs_fdatasync_async failed: %m\n""); goto out; } return 0; out: free(cookie); return SAM_STAT_TASK_SET_FULL; } ",0 "void SystemKeyEventListener::OnVolumeDown() { AudioHandler* audio_handler = GetAudioHandler(); if (!audio_handler) return; if (audio_handler->IsMuted()) audio_handler->SetVolumePercent(0.0); else audio_handler->AdjustVolumeByPercent(-kStepPercentage); SendAccessibilityVolumeNotification( audio_handler->GetVolumePercent(), audio_handler->IsMuted()); ShowVolumeBubble(); } ",0 "static int __tipc_nl_list_sk_publ(struct sk_buff *skb, struct netlink_callback *cb, struct tipc_sock *tsk, u32 *last_publ) { int err; struct publication *p; if (*last_publ) { list_for_each_entry(p, &tsk->publications, pport_list) { if (p->key == *last_publ) break; } if (p->key != *last_publ) { /* We never set seq or call nl_dump_check_consistent() * this means that setting prev_seq here will cause the * consistence check to fail in the netlink callback * handler. Resulting in the last NLMSG_DONE message * having the NLM_F_DUMP_INTR flag set. */ cb->prev_seq = 1; *last_publ = 0; return -EPIPE; } } else { p = list_first_entry(&tsk->publications, struct publication, pport_list); } list_for_each_entry_from(p, &tsk->publications, pport_list) { err = __tipc_nl_add_sk_publ(skb, cb, p); if (err) { *last_publ = p->key; return err; } } *last_publ = 0; return 0; } ",0 " QuotaDatabase* database() const { return database_; } ",0 "GF_Err co64_Size(GF_Box *s) { GF_ChunkLargeOffsetBox *ptr = (GF_ChunkLargeOffsetBox *) s; ptr->size += 4 + (8 * ptr->nb_entries); return GF_OK; } ",0 "static void DrawRoundLinecap(Image *image,const DrawInfo *draw_info, const PrimitiveInfo *primitive_info,ExceptionInfo *exception) { PrimitiveInfo linecap[5]; register ssize_t i; for (i=0; i < 4; i++) linecap[i]=(*primitive_info); linecap[0].coordinates=4; linecap[1].point.x+=(double) (10.0*MagickEpsilon); linecap[2].point.x+=(double) (10.0*MagickEpsilon); linecap[2].point.y+=(double) (10.0*MagickEpsilon); linecap[3].point.y+=(double) (10.0*MagickEpsilon); linecap[4].primitive=UndefinedPrimitive; (void) DrawPolygonPrimitive(image,draw_info,linecap,exception); } ",0 "void WebPageProxy::getGuessesForWord(const String& word, const String& context, Vector& guesses) { TextChecker::getGuessesForWord(spellDocumentTag(), word, context, guesses); } ",0 "static void calc_global_nohz(unsigned long ticks) { long delta, active, n; if (time_before(jiffies, calc_load_update)) return; /* * If we crossed a calc_load_update boundary, make sure to fold * any pending idle changes, the respective CPUs might have * missed the tick driven calc_load_account_active() update * due to NO_HZ. */ delta = calc_load_fold_idle(); if (delta) atomic_long_add(delta, &calc_load_tasks); /* * If we were idle for multiple load cycles, apply them. */ if (ticks >= LOAD_FREQ) { n = ticks / LOAD_FREQ; active = atomic_long_read(&calc_load_tasks); active = active > 0 ? active * FIXED_1 : 0; avenrun[0] = calc_load_n(avenrun[0], EXP_1, active, n); avenrun[1] = calc_load_n(avenrun[1], EXP_5, active, n); avenrun[2] = calc_load_n(avenrun[2], EXP_15, active, n); calc_load_update += n * LOAD_FREQ; } /* * Its possible the remainder of the above division also crosses * a LOAD_FREQ period, the regular check in calc_global_load() * which comes after this will take care of that. * * Consider us being 11 ticks before a cycle completion, and us * sleeping for 4*LOAD_FREQ + 22 ticks, then the above code will * age us 4 cycles, and the test in calc_global_load() will * pick up the final one. */ } ",0 " void PerformPaste() { const base::string16 expected_title = base::UTF8ToUTF16(""TEXT_CHANGED""); content::TitleWatcher title_watcher(shell()->web_contents(), expected_title); RenderFrameHostImpl* rfh = static_cast(interstitial_->GetMainFrame()); rfh->GetRenderWidgetHost()->delegate()->Paste(); EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); } ",0 " bool has_delegate() const { return has_delegate_; } ",0 "void ChromeClientImpl::SetCursor(const Cursor& cursor, LocalFrame* local_frame) { last_set_mouse_cursor_for_testing_ = cursor; SetCursor(WebCursorInfo(cursor), local_frame); } ",0 "void SerializedScriptValue::registerMemoryAllocatedWithCurrentScriptContext() { if (m_externallyAllocatedMemory) return; m_externallyAllocatedMemory = static_cast(m_data.length()); v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(m_externallyAllocatedMemory); } ",0 "std::string TemplateURLRef::ReplaceSearchTerms( const SearchTermsArgs& search_terms_args, const SearchTermsData& search_terms_data, PostContent* post_content) const { ParseIfNecessary(search_terms_data); if (!valid_) return std::string(); std::string url(HandleReplacements(search_terms_args, search_terms_data, post_content)); GURL gurl(url); if (!gurl.is_valid()) return url; std::vector query_params; if (search_terms_args.append_extra_query_params) { std::string extra_params( base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( switches::kExtraSearchQueryParams)); if (!extra_params.empty()) query_params.push_back(extra_params); } if (!search_terms_args.suggest_query_params.empty()) query_params.push_back(search_terms_args.suggest_query_params); if (!gurl.query().empty()) query_params.push_back(gurl.query()); if (query_params.empty()) return url; GURL::Replacements replacements; std::string query_str = base::JoinString(query_params, ""&""); replacements.SetQueryStr(query_str); return gurl.ReplaceComponents(replacements).possibly_invalid_spec(); } ",0 "parse_extra(struct magic_set *ms, struct magic_entry *me, const char *line, off_t off, size_t len, const char *name, const char *extra, int nt) { size_t i; const char *l = line; struct magic *m = &me->mp[me->cont_count == 0 ? 0 : me->cont_count - 1]; char *buf = (char *)m + off; if (buf[0] != '\0') { len = nt ? strlen(buf) : len; file_magwarn(ms, ""Current entry already has a %s type "" ""`%.*s', new type `%s'"", name, (int)len, buf, l); return -1; } if (*m->desc == '\0') { file_magwarn(ms, ""Current entry does not yet have a "" ""description for adding a %s type"", name); return -1; } EATAB; for (i = 0; *l && i < len && goodchar(*l, extra); buf[i++] = *l++) continue; if (i == len && *l) { if (nt) buf[len - 1] = '\0'; if (ms->flags & MAGIC_CHECK) file_magwarn(ms, ""%s type `%s' truncated %"" SIZE_T_FORMAT ""u"", name, line, i); } else { if (!isspace((unsigned char)*l) && !goodchar(*l, extra)) file_magwarn(ms, ""%s type `%s' has bad char '%c'"", name, line, *l); if (nt) buf[i] = '\0'; } if (i > 0) return 0; file_magerror(ms, ""Bad magic entry '%s'"", line); return -1; } ",0 "static int is_hex(char c) { if (((c >= '0') && (c <= '9')) || ((c >= 'a') && (c <= 'f')) || ((c >= 'A') && (c <= 'F'))) return(1); return(0); } ",0 "int ip6_mroute_getsockopt(struct sock *sk, int optname, char __user *optval, int __user *optlen) { int olr; int val; struct net *net = sock_net(sk); struct mr6_table *mrt; mrt = ip6mr_get_table(net, raw6_sk(sk)->ip6mr_table ? : RT6_TABLE_DFLT); if (!mrt) return -ENOENT; switch (optname) { case MRT6_VERSION: val = 0x0305; break; #ifdef CONFIG_IPV6_PIMSM_V2 case MRT6_PIM: val = mrt->mroute_do_pim; break; #endif case MRT6_ASSERT: val = mrt->mroute_do_assert; break; default: return -ENOPROTOOPT; } if (get_user(olr, optlen)) return -EFAULT; olr = min_t(int, olr, sizeof(int)); if (olr < 0) return -EINVAL; if (put_user(olr, optlen)) return -EFAULT; if (copy_to_user(optval, &val, olr)) return -EFAULT; return 0; } ",1 "static int usb_audio_probe(struct usb_interface *intf, const struct usb_device_id *usb_id) { struct usb_device *dev = interface_to_usbdev(intf); const struct snd_usb_audio_quirk *quirk = (const struct snd_usb_audio_quirk *)usb_id->driver_info; struct snd_usb_audio *chip; int i, err; struct usb_host_interface *alts; int ifnum; u32 id; alts = &intf->altsetting[0]; ifnum = get_iface_desc(alts)->bInterfaceNumber; id = USB_ID(le16_to_cpu(dev->descriptor.idVendor), le16_to_cpu(dev->descriptor.idProduct)); if (get_alias_id(dev, &id)) quirk = get_alias_quirk(dev, id); if (quirk && quirk->ifnum >= 0 && ifnum != quirk->ifnum) return -ENXIO; err = snd_usb_apply_boot_quirk(dev, intf, quirk, id); if (err < 0) return err; /* * found a config. now register to ALSA */ /* check whether it's already registered */ chip = NULL; mutex_lock(®ister_mutex); for (i = 0; i < SNDRV_CARDS; i++) { if (usb_chip[i] && usb_chip[i]->dev == dev) { if (atomic_read(&usb_chip[i]->shutdown)) { dev_err(&dev->dev, ""USB device is in the shutdown state, cannot create a card instance\n""); err = -EIO; goto __error; } chip = usb_chip[i]; atomic_inc(&chip->active); /* avoid autopm */ break; } } if (! chip) { /* it's a fresh one. * now look for an empty slot and create a new card instance */ for (i = 0; i < SNDRV_CARDS; i++) if (!usb_chip[i] && (vid[i] == -1 || vid[i] == USB_ID_VENDOR(id)) && (pid[i] == -1 || pid[i] == USB_ID_PRODUCT(id))) { if (enable[i]) { err = snd_usb_audio_create(intf, dev, i, quirk, id, &chip); if (err < 0) goto __error; chip->pm_intf = intf; break; } else if (vid[i] != -1 || pid[i] != -1) { dev_info(&dev->dev, ""device (%04x:%04x) is disabled\n"", USB_ID_VENDOR(id), USB_ID_PRODUCT(id)); err = -ENOENT; goto __error; } } if (!chip) { dev_err(&dev->dev, ""no available usb audio device\n""); err = -ENODEV; goto __error; } } dev_set_drvdata(&dev->dev, chip); /* * For devices with more than one control interface, we assume the * first contains the audio controls. We might need a more specific * check here in the future. */ if (!chip->ctrl_intf) chip->ctrl_intf = alts; chip->txfr_quirk = 0; err = 1; /* continue */ if (quirk && quirk->ifnum != QUIRK_NO_INTERFACE) { /* need some special handlings */ err = snd_usb_create_quirk(chip, intf, &usb_audio_driver, quirk); if (err < 0) goto __error; } if (err > 0) { /* create normal USB audio interfaces */ err = snd_usb_create_streams(chip, ifnum); if (err < 0) goto __error; err = snd_usb_create_mixer(chip, ifnum, ignore_ctl_error); if (err < 0) goto __error; } /* we are allowed to call snd_card_register() many times */ err = snd_card_register(chip->card); if (err < 0) goto __error; usb_chip[chip->index] = chip; chip->num_interfaces++; usb_set_intfdata(intf, chip); atomic_dec(&chip->active); mutex_unlock(®ister_mutex); return 0; __error: if (chip) { if (!chip->num_interfaces) snd_card_free(chip->card); atomic_dec(&chip->active); } mutex_unlock(®ister_mutex); return err; } ",1 "IW_IMPL(double) iw_convert_sample_from_linear(double v, const struct iw_csdescr *csdescr) { return (double)linear_to_x_sample(v,csdescr); } ",0 "void crypto_alg_tested(const char *name, int err) { struct crypto_larval *test; struct crypto_alg *alg; struct crypto_alg *q; LIST_HEAD(list); down_write(&crypto_alg_sem); list_for_each_entry(q, &crypto_alg_list, cra_list) { if (crypto_is_moribund(q) || !crypto_is_larval(q)) continue; test = (struct crypto_larval *)q; if (!strcmp(q->cra_driver_name, name)) goto found; } printk(KERN_ERR ""alg: Unexpected test result for %s: %d\n"", name, err); goto unlock; found: q->cra_flags |= CRYPTO_ALG_DEAD; alg = test->adult; if (err || list_empty(&alg->cra_list)) goto complete; alg->cra_flags |= CRYPTO_ALG_TESTED; list_for_each_entry(q, &crypto_alg_list, cra_list) { if (q == alg) continue; if (crypto_is_moribund(q)) continue; if (crypto_is_larval(q)) { struct crypto_larval *larval = (void *)q; /* * Check to see if either our generic name or * specific name can satisfy the name requested * by the larval entry q. */ if (strcmp(alg->cra_name, q->cra_name) && strcmp(alg->cra_driver_name, q->cra_name)) continue; if (larval->adult) continue; if ((q->cra_flags ^ alg->cra_flags) & larval->mask) continue; if (!crypto_mod_get(alg)) continue; larval->adult = alg; continue; } if (strcmp(alg->cra_name, q->cra_name)) continue; if (strcmp(alg->cra_driver_name, q->cra_driver_name) && q->cra_priority > alg->cra_priority) continue; crypto_remove_spawns(q, &list, alg); } complete: complete_all(&test->completion); unlock: up_write(&crypto_alg_sem); crypto_remove_final(&list); } ",0 "void DevToolsUIBindings::SetDelegate(Delegate* delegate) { delegate_.reset(delegate); } ",0 "BlockDNSErrHandler(DWORD err, const char *msg) { TCHAR buf[256]; LPCTSTR err_str; if (!err) { return; } err_str = TEXT(""Unknown Win32 Error""); if (FormatMessage(FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ARGUMENT_ARRAY, NULL, err, 0, buf, sizeof(buf), NULL)) { err_str = buf; } #ifdef UNICODE MsgToEventLog(M_ERR, L""%S (status = %lu): %s"", msg, err, err_str); #else MsgToEventLog(M_ERR, ""%s (status = %lu): %s"", msg, err, err_str); #endif } ",0 "pp::VarArray PDFiumEngine::GetBookmarks() { pp::VarDictionary dict = TraverseBookmarks(nullptr, 0); return pp::VarArray(dict.Get(pp::Var(""children""))); } ",0 "void ScreenRecorder::Start() { capture_loop_->PostTask( FROM_HERE, base::Bind(&ScreenRecorder::DoStart, this)); } ",0 "static int loop_set_capacity(struct loop_device *lo) { if (unlikely(lo->lo_state != Lo_bound)) return -ENXIO; return figure_loop_size(lo, lo->lo_offset, lo->lo_sizelimit); } ",0 " void TestFindFormForInputElement(const char* html, bool unowned) { LoadHTML(html); WebLocalFrame* web_frame = GetMainFrame(); ASSERT_NE(nullptr, web_frame); FormCache form_cache(web_frame); std::vector forms = form_cache.ExtractNewForms(); ASSERT_EQ(1U, forms.size()); WebInputElement input_element = GetInputElementById(""firstname""); FormData form; FormFieldData field; EXPECT_TRUE( FindFormAndFieldForFormControlElement(input_element, &form, &field)); EXPECT_EQ(GetCanonicalOriginForDocument(web_frame->GetDocument()), form.origin); if (!unowned) { EXPECT_EQ(ASCIIToUTF16(""TestForm""), form.name); EXPECT_EQ(GURL(""http://abc.com""), form.action); } const std::vector& fields = form.fields; ASSERT_EQ(4U, fields.size()); FormFieldData expected; expected.form_control_type = ""text""; expected.max_length = WebInputElement::DefaultMaxLength(); expected.id_attribute = ASCIIToUTF16(""firstname""); expected.name = expected.id_attribute; expected.value = ASCIIToUTF16(""John""); expected.label = ASCIIToUTF16(""John""); EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[0]); EXPECT_FORM_FIELD_DATA_EQUALS(expected, field); expected.id_attribute = ASCIIToUTF16(""lastname""); expected.name = expected.id_attribute; expected.value = ASCIIToUTF16(""Smith""); expected.label = ASCIIToUTF16(""Smith""); EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[1]); expected.id_attribute = ASCIIToUTF16(""email""); expected.name = expected.id_attribute; expected.value = ASCIIToUTF16(""john@example.com""); expected.label = ASCIIToUTF16(""john@example.com""); expected.autocomplete_attribute = ""off""; EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[2]); expected.autocomplete_attribute.clear(); expected.id_attribute = ASCIIToUTF16(""phone""); expected.name = expected.id_attribute; expected.value = ASCIIToUTF16(""1.800.555.1234""); expected.label = ASCIIToUTF16(""1.800.555.1234""); EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[3]); } ",0 "ProcXvShmPutImage(ClientPtr client) { ShmDescPtr shmdesc; DrawablePtr pDraw; XvPortPtr pPort; XvImagePtr pImage = NULL; GCPtr pGC; int status, size_needed, i; CARD16 width, height; REQUEST(xvShmPutImageReq); REQUEST_SIZE_MATCH(xvShmPutImageReq); VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess); if (!(pPort->pAdaptor->type & XvImageMask) || !(pPort->pAdaptor->type & XvInputMask)) { client->errorValue = stuff->port; return BadMatch; } status = XvdiMatchPort(pPort, pDraw); if (status != Success) { return status; } for (i = 0; i < pPort->pAdaptor->nImages; i++) { if (pPort->pAdaptor->pImages[i].id == stuff->id) { pImage = &(pPort->pAdaptor->pImages[i]); break; } } if (!pImage) return BadMatch; status = dixLookupResourceByType((void **) &shmdesc, stuff->shmseg, ShmSegType, serverClient, DixReadAccess); if (status != Success) return status; width = stuff->width; height = stuff->height; size_needed = (*pPort->pAdaptor->ddQueryImageAttributes) (pPort, pImage, &width, &height, NULL, NULL); if ((size_needed + stuff->offset) > shmdesc->size) return BadAccess; if ((width < stuff->width) || (height < stuff->height)) return BadValue; status = XvdiPutImage(client, pDraw, pPort, pGC, stuff->src_x, stuff->src_y, stuff->src_w, stuff->src_h, stuff->drw_x, stuff->drw_y, stuff->drw_w, stuff->drw_h, pImage, (unsigned char *) shmdesc->addr + stuff->offset, stuff->send_event, stuff->width, stuff->height); if ((status == Success) && stuff->send_event) { xShmCompletionEvent ev = { .type = ShmCompletionCode, .drawable = stuff->drawable, .minorEvent = xv_ShmPutImage, .majorEvent = XvReqCode, .shmseg = stuff->shmseg, .offset = stuff->offset }; WriteEventsToClient(client, 1, (xEvent *) &ev); } return status; } ",0 "bool ChromeContentBrowserClient::AllowGetCookie( const GURL& url, const GURL& first_party, const net::CookieList& cookie_list, content::ResourceContext* context, int render_process_id, int render_frame_id) { DCHECK_CURRENTLY_ON(BrowserThread::IO); ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); bool allow = io_data->GetCookieSettings()->IsCookieAccessAllowed(url, first_party); OnCookiesRead(render_process_id, render_frame_id, url, first_party, cookie_list, !allow); return allow; } ",0 "mobility_print(netdissect_options *ndo, const u_char *bp, const u_char *bp2 _U_) { const struct ip6_mobility *mh; const u_char *ep; unsigned mhlen, hlen; uint8_t type; mh = (const struct ip6_mobility *)bp; /* 'ep' points to the end of available data. */ ep = ndo->ndo_snapend; if (!ND_TTEST(mh->ip6m_len)) { /* * There's not enough captured data to include the * mobility header length. * * Our caller expects us to return the length, however, * so return a value that will run to the end of the * captured data. * * XXX - ""ip6_print()"" doesn't do anything with the * returned length, however, as it breaks out of the * header-processing loop. */ mhlen = ep - bp; goto trunc; } mhlen = (mh->ip6m_len + 1) << 3; /* XXX ip6m_cksum */ ND_TCHECK(mh->ip6m_type); type = mh->ip6m_type; if (type <= IP6M_MAX && mhlen < ip6m_hdrlen[type]) { ND_PRINT((ndo, ""(header length %u is too small for type %u)"", mhlen, type)); goto trunc; } ND_PRINT((ndo, ""mobility: %s"", tok2str(ip6m_str, ""type-#%u"", type))); switch (type) { case IP6M_BINDING_REQUEST: hlen = IP6M_MINLEN; break; case IP6M_HOME_TEST_INIT: case IP6M_CAREOF_TEST_INIT: hlen = IP6M_MINLEN; if (ndo->ndo_vflag) { ND_TCHECK_32BITS(&bp[hlen + 4]); ND_PRINT((ndo, "" %s Init Cookie=%08x:%08x"", type == IP6M_HOME_TEST_INIT ? ""Home"" : ""Care-of"", EXTRACT_32BITS(&bp[hlen]), EXTRACT_32BITS(&bp[hlen + 4]))); } hlen += 8; break; case IP6M_HOME_TEST: case IP6M_CAREOF_TEST: ND_TCHECK(mh->ip6m_data16[0]); ND_PRINT((ndo, "" nonce id=0x%x"", EXTRACT_16BITS(&mh->ip6m_data16[0]))); hlen = IP6M_MINLEN; if (ndo->ndo_vflag) { ND_TCHECK_32BITS(&bp[hlen + 4]); ND_PRINT((ndo, "" %s Init Cookie=%08x:%08x"", type == IP6M_HOME_TEST ? ""Home"" : ""Care-of"", EXTRACT_32BITS(&bp[hlen]), EXTRACT_32BITS(&bp[hlen + 4]))); } hlen += 8; if (ndo->ndo_vflag) { ND_TCHECK_32BITS(&bp[hlen + 4]); ND_PRINT((ndo, "" %s Keygen Token=%08x:%08x"", type == IP6M_HOME_TEST ? ""Home"" : ""Care-of"", EXTRACT_32BITS(&bp[hlen]), EXTRACT_32BITS(&bp[hlen + 4]))); } hlen += 8; break; case IP6M_BINDING_UPDATE: ND_TCHECK(mh->ip6m_data16[0]); ND_PRINT((ndo, "" seq#=%u"", EXTRACT_16BITS(&mh->ip6m_data16[0]))); hlen = IP6M_MINLEN; ND_TCHECK_16BITS(&bp[hlen]); if (bp[hlen] & 0xf0) { ND_PRINT((ndo, "" "")); if (bp[hlen] & 0x80) ND_PRINT((ndo, ""A"")); if (bp[hlen] & 0x40) ND_PRINT((ndo, ""H"")); if (bp[hlen] & 0x20) ND_PRINT((ndo, ""L"")); if (bp[hlen] & 0x10) ND_PRINT((ndo, ""K"")); } /* Reserved (4bits) */ hlen += 1; /* Reserved (8bits) */ hlen += 1; ND_TCHECK_16BITS(&bp[hlen]); /* units of 4 secs */ ND_PRINT((ndo, "" lifetime=%u"", EXTRACT_16BITS(&bp[hlen]) << 2)); hlen += 2; break; case IP6M_BINDING_ACK: ND_TCHECK(mh->ip6m_data8[0]); ND_PRINT((ndo, "" status=%u"", mh->ip6m_data8[0])); ND_TCHECK(mh->ip6m_data8[1]); if (mh->ip6m_data8[1] & 0x80) ND_PRINT((ndo, "" K"")); /* Reserved (7bits) */ hlen = IP6M_MINLEN; ND_TCHECK_16BITS(&bp[hlen]); ND_PRINT((ndo, "" seq#=%u"", EXTRACT_16BITS(&bp[hlen]))); hlen += 2; ND_TCHECK_16BITS(&bp[hlen]); /* units of 4 secs */ ND_PRINT((ndo, "" lifetime=%u"", EXTRACT_16BITS(&bp[hlen]) << 2)); hlen += 2; break; case IP6M_BINDING_ERROR: ND_TCHECK(mh->ip6m_data8[0]); ND_PRINT((ndo, "" status=%u"", mh->ip6m_data8[0])); /* Reserved */ hlen = IP6M_MINLEN; ND_TCHECK2(bp[hlen], 16); ND_PRINT((ndo, "" homeaddr %s"", ip6addr_string(ndo, &bp[hlen]))); hlen += 16; break; default: ND_PRINT((ndo, "" len=%u"", mh->ip6m_len)); return(mhlen); break; } if (ndo->ndo_vflag) if (mobility_opt_print(ndo, &bp[hlen], mhlen - hlen)) goto trunc; return(mhlen); trunc: ND_PRINT((ndo, ""%s"", tstr)); return(-1); } ",0 " void SendInterstitialCommand( content::WebContents* tab, security_interstitials::SecurityInterstitialCommand command) { if (AreCommittedInterstitialsEnabled()) { security_interstitials::SecurityInterstitialTabHelper* helper = security_interstitials::SecurityInterstitialTabHelper:: FromWebContents(tab); helper->GetBlockingPageForCurrentlyCommittedNavigationForTesting() ->CommandReceived(base::IntToString(command)); return; } tab->GetInterstitialPage()->GetDelegateForTesting()->CommandReceived( base::IntToString(command)); } ",0 "WebFrameLoadType FrameLoader::DetermineFrameLoadType( const KURL& url, const AtomicString& http_method, Document* origin_document, const KURL& failing_url, WebFrameLoadType frame_load_type) { if (frame_load_type == WebFrameLoadType::kStandard || frame_load_type == WebFrameLoadType::kReplaceCurrentItem) { if (frame_->Tree().Parent() && !state_machine_.CommittedFirstRealDocumentLoad()) return WebFrameLoadType::kReplaceCurrentItem; if (!frame_->Tree().Parent() && !Client()->BackForwardLength()) { if (Opener() && url.IsEmpty()) return WebFrameLoadType::kReplaceCurrentItem; return WebFrameLoadType::kStandard; } } if (frame_load_type != WebFrameLoadType::kStandard) return frame_load_type; if ((!state_machine_.CommittedMultipleRealLoads() && DeprecatedEqualIgnoringCase(frame_->GetDocument()->Url(), BlankURL()))) return WebFrameLoadType::kReplaceCurrentItem; if (url == document_loader_->UrlForHistory()) { if (http_method == http_names::kPOST) return WebFrameLoadType::kStandard; if (!origin_document) return WebFrameLoadType::kReload; return WebFrameLoadType::kReplaceCurrentItem; } if (failing_url == document_loader_->UrlForHistory() && document_loader_->LoadType() == WebFrameLoadType::kReload) return WebFrameLoadType::kReload; if (url.IsEmpty() && failing_url.IsEmpty()) { return WebFrameLoadType::kReplaceCurrentItem; } if (origin_document && !origin_document->CanCreateHistoryEntry()) return WebFrameLoadType::kReplaceCurrentItem; return WebFrameLoadType::kStandard; } ",0 "static int set_msr_hyperv_pw(struct kvm_vcpu *vcpu, u32 msr, u64 data) { struct kvm *kvm = vcpu->kvm; switch (msr) { case HV_X64_MSR_GUEST_OS_ID: kvm->arch.hv_guest_os_id = data; /* setting guest os id to zero disables hypercall page */ if (!kvm->arch.hv_guest_os_id) kvm->arch.hv_hypercall &= ~HV_X64_MSR_HYPERCALL_ENABLE; break; case HV_X64_MSR_HYPERCALL: { u64 gfn; unsigned long addr; u8 instructions[4]; /* if guest os id is not set hypercall should remain disabled */ if (!kvm->arch.hv_guest_os_id) break; if (!(data & HV_X64_MSR_HYPERCALL_ENABLE)) { kvm->arch.hv_hypercall = data; break; } gfn = data >> HV_X64_MSR_HYPERCALL_PAGE_ADDRESS_SHIFT; addr = gfn_to_hva(kvm, gfn); if (kvm_is_error_hva(addr)) return 1; kvm_x86_ops->patch_hypercall(vcpu, instructions); ((unsigned char *)instructions)[3] = 0xc3; /* ret */ if (__copy_to_user((void __user *)addr, instructions, 4)) return 1; kvm->arch.hv_hypercall = data; mark_page_dirty(kvm, gfn); break; } case HV_X64_MSR_REFERENCE_TSC: { u64 gfn; HV_REFERENCE_TSC_PAGE tsc_ref; memset(&tsc_ref, 0, sizeof(tsc_ref)); kvm->arch.hv_tsc_page = data; if (!(data & HV_X64_MSR_TSC_REFERENCE_ENABLE)) break; gfn = data >> HV_X64_MSR_TSC_REFERENCE_ADDRESS_SHIFT; if (kvm_write_guest(kvm, data, &tsc_ref, sizeof(tsc_ref))) return 1; mark_page_dirty(kvm, gfn); break; } default: vcpu_unimpl(vcpu, ""HYPER-V unimplemented wrmsr: 0x%x "" ""data 0x%llx\n"", msr, data); return 1; } return 0; } ",0 "void PanelBrowserView::DestroyPanelBrowser() { DestroyBrowser(); } ",0 "void RenderBlock::computeRegionRangeForBlock(RenderFlowThread* flowThread) { if (flowThread) flowThread->setRegionRangeForBox(this, offsetFromLogicalTopOfFirstPage()); } ",0 "static void dwc3_free_trb_pool(struct dwc3_ep *dep) { struct dwc3 *dwc = dep->dwc; dma_free_coherent(dwc->sysdev, sizeof(struct dwc3_trb) * DWC3_TRB_NUM, dep->trb_pool, dep->trb_pool_dma); dep->trb_pool = NULL; dep->trb_pool_dma = 0; } ",0 "void allocate_new_segments(struct f2fs_sb_info *sbi) { struct curseg_info *curseg; unsigned int old_segno; int i; for (i = CURSEG_HOT_DATA; i <= CURSEG_COLD_DATA; i++) { curseg = CURSEG_I(sbi, i); old_segno = curseg->segno; SIT_I(sbi)->s_ops->allocate_segment(sbi, i, true); locate_dirty_segment(sbi, old_segno); } } ",0 "static inline void *load_pointer(const struct sk_buff *skb, int k, unsigned int size, void *buffer) { if (k >= 0) return skb_header_pointer(skb, k, size, buffer); return bpf_internal_load_pointer_neg_helper(skb, k, size); } ",0 "SkISize SkIcoCodec::onGetScaledDimensions(float desiredScale) const { int origWidth = this->getInfo().width(); int origHeight = this->getInfo().height(); float desiredSize = desiredScale * origWidth * origHeight; float minError = ((float) (origWidth * origHeight)) - desiredSize + 1.0f; int32_t minIndex = -1; for (int32_t i = 0; i < fEmbeddedCodecs->count(); i++) { int width = fEmbeddedCodecs->operator[](i)->getInfo().width(); int height = fEmbeddedCodecs->operator[](i)->getInfo().height(); float error = SkTAbs(((float) (width * height)) - desiredSize); if (error < minError) { minError = error; minIndex = i; } } SkASSERT(minIndex >= 0); return fEmbeddedCodecs->operator[](minIndex)->getInfo().dimensions(); } ",0 "PluginObserver::~PluginObserver() { } ",0 "void RenderMessageFilter::SendLoadFontReply(IPC::Message* reply, FontLoader::Result* result) { base::SharedMemoryHandle handle; if (result->font_data_size == 0 || result->font_id == 0) { result->font_data_size = 0; result->font_id = 0; handle = base::SharedMemory::NULLHandle(); } else { result->font_data.GiveToProcess(base::GetCurrentProcessHandle(), &handle); } ViewHostMsg_LoadFont::WriteReplyParams( reply, result->font_data_size, handle, result->font_id); Send(reply); } ",0 "raptor_rss_copy_field(raptor_rss_parser* rss_parser, raptor_rss_item* item, const raptor_field_pair* pair) { raptor_rss_fields_type from_field = pair->from; raptor_rss_fields_type to_field = pair->to; raptor_rss_field* field = NULL; if(!(item->fields[from_field] && item->fields[from_field]->value)) return 1; if(from_field == to_field) { field = item->fields[from_field]; } else { if(item->fields[to_field] && item->fields[to_field]->value) return 1; field = raptor_rss_new_field(item->world); field->is_mapped = 1; raptor_rss_item_add_field(item, to_field, field); } /* Ensure output namespace is declared */ rss_parser->nspaces_seen[raptor_rss_fields_info[to_field].nspace] = 'Y'; if(!field->value) { if(pair->conversion) pair->conversion(item->fields[from_field], field); else { size_t len; /* Otherwise default action is to copy from_field value */ len = strlen((const char*)item->fields[from_field]->value); field->value = RAPTOR_MALLOC(unsigned char*, len + 1); if(!field->value) return 1; memcpy(field->value, item->fields[from_field]->value, len + 1); } } return 0; } ",0 "static void btif_update_source_codec(void* p_data) { BTIF_TRACE_DEBUG(""%s"", __func__); btav_a2dp_codec_config_t req; memcpy(&req, p_data, sizeof(req)); btif_a2dp_source_encoder_user_config_update_req(req); } ",0 "int RenderFrameHostImpl::GetEnabledBindings() { return enabled_bindings_; } ",0 "parse_integer(krb5_context context, char **p, const char *file, int lineno, const char *name, heim_integer *integer) { int ret; char *p1; p1 = strsep(p, "" \t""); if (p1 == NULL) { krb5_set_error_message(context, EINVAL, N_(""moduli file %s missing %s on line %d"", """"), file, name, lineno); return EINVAL; } ret = der_parse_hex_heim_integer(p1, integer); if (ret) { krb5_set_error_message(context, ret, N_(""moduli file %s failed parsing %s "" ""on line %d"", """"), file, name, lineno); return ret; } return 0; } ",0 "void PreconnectManager::FinishPreresolveJob(PreresolveJobId job_id, bool success) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); PreresolveJob* job = preresolve_jobs_.Lookup(job_id); DCHECK(job); bool need_preconnect = success && job->need_preconnect(); if (need_preconnect) { PreconnectUrl(job->url, job->num_sockets, job->allow_credentials, job->network_isolation_key); } PreresolveInfo* info = job->info; if (info) info->stats->requests_stats.emplace_back(job->url, need_preconnect); preresolve_jobs_.Remove(job_id); --inflight_preresolves_count_; if (info) { DCHECK_LE(1u, info->inflight_count); --info->inflight_count; } if (info && info->is_done()) AllPreresolvesForUrlFinished(info); TryToLaunchPreresolveJobs(); } ",1 "BOOL SetProcessDPIAwareWrapper() { typedef BOOL(WINAPI *SetProcessDPIAwarePtr)(VOID); SetProcessDPIAwarePtr set_process_dpi_aware_func = reinterpret_cast( GetProcAddress(GetModuleHandleA(""user32.dll""), ""SetProcessDPIAware"")); return set_process_dpi_aware_func && set_process_dpi_aware_func(); } ",0 "static int pseudo_lld_bus_match(struct device *dev, struct device_driver *dev_driver) { return 1; } ",0 "static void entersafe_reverse_buffer(u8* buff,size_t size) { u8 t; u8 * end=buff+size-1; while(buff 1)) { xmlXPathSetArityError(ctxt); return; } if (nargs == 1) { dt = xmlXPathPopString(ctxt); if (xmlXPathCheckError(ctxt)) { xmlXPathSetTypeError(ctxt); return; } } ret = exsltDateMonthAbbreviation(dt); if (dt != NULL) xmlFree(dt); if (ret == NULL) xmlXPathReturnEmptyString(ctxt); else xmlXPathReturnString(ctxt, xmlStrdup(ret)); } ",0 "ofputil_decode_queue_get_config_request(const struct ofp_header *oh, ofp_port_t *port, uint32_t *queue) { const struct ofp10_queue_get_config_request *qgcr10; const struct ofp11_queue_get_config_request *qgcr11; const struct ofp14_queue_desc_request *qdr14; struct ofpbuf b = ofpbuf_const_initializer(oh, ntohs(oh->length)); enum ofpraw raw = ofpraw_pull_assert(&b); switch ((int) raw) { case OFPRAW_OFPT10_QUEUE_GET_CONFIG_REQUEST: qgcr10 = b.data; *port = u16_to_ofp(ntohs(qgcr10->port)); *queue = OFPQ_ALL; break; case OFPRAW_OFPT11_QUEUE_GET_CONFIG_REQUEST: qgcr11 = b.data; *queue = OFPQ_ALL; enum ofperr error = ofputil_port_from_ofp11(qgcr11->port, port); if (error || *port == OFPP_ANY) { return error; } break; case OFPRAW_OFPST14_QUEUE_DESC_REQUEST: qdr14 = b.data; *queue = ntohl(qdr14->queue); return ofputil_port_from_ofp11(qdr14->port, port); default: OVS_NOT_REACHED(); } return (ofp_to_u16(*port) < ofp_to_u16(OFPP_MAX) ? 0 : OFPERR_OFPQOFC_BAD_PORT); } ",0 " void SetJsEventHandler(const WeakHandle& event_handler) { js_backend_.Call(FROM_HERE, &JsBackend::SetJsEventHandler, event_handler); PumpLoop(); } ",0 "GraphicsSurfaceToken GraphicsSurface::platformExport() { return GraphicsSurfaceToken(m_platformSurface); } ",0 "QuotaManager::~QuotaManager() { proxy_->manager_ = NULL; std::for_each(clients_.begin(), clients_.end(), std::mem_fun(&QuotaClient::OnQuotaManagerDestroyed)); if (database_.get()) db_thread_->DeleteSoon(FROM_HERE, database_.release()); } ",0 "ZEND_API int zend_ts_hash_index_del(TsHashTable *ht, zend_ulong h) { int retval; begin_write(ht); retval = zend_hash_index_del(TS_HASH(ht), h); end_write(ht); return retval; } ",0 "static int read_index(struct iowarrior *dev) { int intr_idx, read_idx; read_idx = atomic_read(&dev->read_idx); intr_idx = atomic_read(&dev->intr_idx); return (read_idx == intr_idx ? -1 : read_idx); } ",0 "void ContainerNode::dispatchPostAttachCallbacks() { for (size_t i = 0; i < s_postAttachCallbackQueue->size(); ++i) { const CallbackInfo& info = (*s_postAttachCallbackQueue)[i]; NodeCallback callback = info.first; CallbackParameters params = info.second; callback(params.first.get(), params.second); } s_postAttachCallbackQueue->clear(); } ",0 "static int log_write(void __user *log_base, u64 write_address, u64 write_length) { u64 write_page = write_address / VHOST_PAGE_SIZE; int r; if (!write_length) return 0; write_length += write_address % VHOST_PAGE_SIZE; for (;;) { u64 base = (u64)(unsigned long)log_base; u64 log = base + write_page / 8; int bit = write_page % 8; if ((u64)(unsigned long)log != log) return -EFAULT; r = set_bit_to_user(bit, (void __user *)(unsigned long)log); if (r < 0) return r; if (write_length <= VHOST_PAGE_SIZE) break; write_length -= VHOST_PAGE_SIZE; write_page += 1; } return r; } ",0 "pkinit_check_kdc_pkid(krb5_context context, pkinit_plg_crypto_context plg_cryptoctx, pkinit_req_crypto_context req_cryptoctx, pkinit_identity_crypto_context id_cryptoctx, unsigned char *pdid_buf, unsigned int pkid_len, int *valid_kdcPkId) { krb5_error_code retval = KRB5KDC_ERR_PREAUTH_FAILED; PKCS7_ISSUER_AND_SERIAL *is = NULL; const unsigned char *p = pdid_buf; int status = 1; X509 *kdc_cert = sk_X509_value(id_cryptoctx->my_certs, id_cryptoctx->cert_index); *valid_kdcPkId = 0; pkiDebug(""found kdcPkId in AS REQ\n""); is = d2i_PKCS7_ISSUER_AND_SERIAL(NULL, &p, (int)pkid_len); if (is == NULL) goto cleanup; status = X509_NAME_cmp(X509_get_issuer_name(kdc_cert), is->issuer); if (!status) { status = ASN1_INTEGER_cmp(X509_get_serialNumber(kdc_cert), is->serial); if (!status) *valid_kdcPkId = 1; } retval = 0; cleanup: X509_NAME_free(is->issuer); ASN1_INTEGER_free(is->serial); free(is); return retval; } ",1 " virtual ~TestHttpPostProviderFactory() {} ",0 "static int fuse_direct_mmap(struct file *file, struct vm_area_struct *vma) { /* Can't provide the coherency needed for MAP_SHARED */ if (vma->vm_flags & VM_MAYSHARE) return -ENODEV; invalidate_inode_pages2(file->f_mapping); return generic_file_mmap(file, vma); } ",0 "void RenderFrameImpl::clearContextMenu() { context_menu_node_.reset(); } ",0 "inline void ImageLoader::dispatchErrorEvent() { m_hasPendingErrorEvent = true; errorEventSender().dispatchEventSoon(this); } ",0 "PasswordStoreLoginsChangedObserver::PasswordStoreLoginsChangedObserver( AutomationProvider* automation, IPC::Message* reply_message, PasswordStoreChange::Type expected_type, const std::string& result_key) : automation_(automation->AsWeakPtr()), reply_message_(reply_message), expected_type_(expected_type), result_key_(result_key), done_event_(false, false) { AddRef(); } ",0 "static int crypto_init_blkcipher_ops(struct crypto_tfm *tfm, u32 type, u32 mask) { struct blkcipher_alg *alg = &tfm->__crt_alg->cra_blkcipher; if (alg->ivsize > PAGE_SIZE / 8) return -EINVAL; if ((mask & CRYPTO_ALG_TYPE_MASK) == CRYPTO_ALG_TYPE_MASK) return crypto_init_blkcipher_ops_sync(tfm); else return crypto_init_blkcipher_ops_async(tfm); } ",0 "void qemu_spice_wakeup(SimpleSpiceDisplay *ssd) { trace_qemu_spice_wakeup(ssd->qxl.id); spice_qxl_wakeup(&ssd->qxl); } ",0 "void WebContentsImpl::OnIgnoredUIEvent() { for (auto& observer : observers_) observer.DidGetIgnoredUIEvent(); } ",0 "void WebGLRenderingContextBase::MaybeRestoreContext(TimerBase*) { DCHECK(isContextLost()); if (!restore_allowed_) return; if (canvas()) { LocalFrame* frame = canvas()->GetDocument().GetFrame(); if (!frame) return; if (frame->Client()->ShouldBlockWebGL()) return; Settings* settings = frame->GetSettings(); if (settings && ((version_ == 1 && !settings->GetWebGL1Enabled()) || (version_ == 2 && !settings->GetWebGL2Enabled()))) { return; } } if (GetDrawingBuffer()) { drawing_buffer_->BeginDestruction(); drawing_buffer_ = nullptr; } auto execution_context = Host()->GetTopExecutionContext(); Platform::ContextAttributes attributes = ToPlatformContextAttributes( CreationAttributes(), Version(), SupportOwnOffscreenSurface(execution_context)); Platform::GraphicsInfo gl_info; std::unique_ptr context_provider; bool using_gpu_compositing; const auto& url = Host()->GetExecutionContextUrl(); if (IsMainThread()) { using_gpu_compositing = !Platform::Current()->IsGpuCompositingDisabled(); context_provider = Platform::Current()->CreateOffscreenGraphicsContext3DProvider( attributes, url, nullptr, &gl_info); } else { context_provider = CreateContextProviderOnWorkerThread( attributes, &gl_info, &using_gpu_compositing, url); } scoped_refptr buffer; if (context_provider && context_provider->BindToCurrentThread()) { buffer = CreateDrawingBuffer(std::move(context_provider), using_gpu_compositing); } if (!buffer) { if (context_lost_mode_ == kRealLostContext) { restore_timer_.StartOneShot(kSecondsBetweenRestoreAttempts, FROM_HERE); } else { SynthesizeGLError(GL_INVALID_OPERATION, """", ""error restoring context""); } return; } drawing_buffer_ = std::move(buffer); GetDrawingBuffer()->Bind(GL_FRAMEBUFFER); lost_context_errors_.clear(); context_lost_mode_ = kNotLostContext; auto_recovery_method_ = kManual; restore_allowed_ = false; RemoveFromEvictedList(this); SetupFlags(); InitializeNewContext(); MarkContextChanged(kCanvasContextChanged); WebGLContextEvent* event = WebGLContextEvent::Create( EventTypeNames::webglcontextrestored, false, true, """"); Host()->HostDispatchEvent(event); } ",0 "EXPORTED int mboxlist_parse_entry(mbentry_t **mbentryptr, const char *name, size_t namelen, const char *data, size_t datalen) { static struct buf aclbuf; int r = IMAP_MAILBOX_BADFORMAT; char *freeme = NULL; char **target; char *p, *q; mbentry_t *mbentry = mboxlist_entry_create(); if (!datalen) goto done; /* copy name */ if (namelen) mbentry->name = xstrndup(name, namelen); else mbentry->name = xstrdup(name); /* check for DLIST mboxlist */ if (*data == '%') { struct parseentry_rock rock; memset(&rock, 0, sizeof(struct parseentry_rock)); rock.mbentry = mbentry; rock.aclbuf = &aclbuf; aclbuf.len = 0; r = dlist_parsesax(data, datalen, 0, parseentry_cb, &rock); if (!r) mbentry->acl = buf_newcstring(&aclbuf); goto done; } /* copy data */ freeme = p = xstrndup(data, datalen); /* check for extended mboxlist entry */ if (*p == '(') { int last = 0; p++; /* past leading '(' */ while (!last) { target = NULL; q = p; while (*q && *q != ' ' && *q != ')') q++; if (*q != ' ') break; *q++ = '\0'; if (!strcmp(p, ""uniqueid"")) target = &mbentry->uniqueid; if (!strcmp(p, ""specialuse"")) target = &mbentry->legacy_specialuse; p = q; while (*q && *q != ' ' && *q != ')') q++; if (*q != ' ') last = 1; if (*q) *q++ = '\0'; if (target) *target = xstrdup(p); p = q; } if (*p == ' ') p++; /* past trailing ' ' */ } /* copy out interesting parts */ mbentry->mbtype = strtol(p, &p, 10); if (*p == ' ') p++; q = p; while (*q && *q != ' ' && *q != '!') q++; if (*q == '!') { *q++ = '\0'; mbentry->server = xstrdup(p); p = q; while (*q && *q != ' ') q++; } if (*q) *q++ = '\0'; mbentry->partition = xstrdup(p); mbentry->acl = xstrdup(q); r = 0; done: if (!r && mbentryptr) *mbentryptr = mbentry; else mboxlist_entry_free(&mbentry); free(freeme); return r; } ",0 "R_API RAnalBlock *r_anal_bb_get_jumpbb(RAnalFunction *fcn, RAnalBlock *bb) { if (bb->jump == UT64_MAX) { return NULL; } if (bb->jumpbb) { return bb->jumpbb; } RListIter *iter; RAnalBlock *b; r_list_foreach (fcn->bbs, iter, b) { if (b->addr == bb->jump) { bb->jumpbb = b; b->prev = bb; return b; } } return NULL; } ",0 "static LayoutPoint VisualOffsetFromPaintOffsetRoot( const PaintPropertyTreeBuilderFragmentContext& context, const PaintLayer* child) { const LayoutObject* paint_offset_root = context.current.paint_offset_root; PaintLayer* painting_layer = paint_offset_root->PaintingLayer(); LayoutPoint result = child->VisualOffsetFromAncestor(painting_layer); if (!paint_offset_root->HasLayer() || ToLayoutBoxModelObject(paint_offset_root)->Layer() != painting_layer) { result.Move(-paint_offset_root->OffsetFromAncestorContainer( &painting_layer->GetLayoutObject())); } if (paint_offset_root->HasOverflowClip()) result += ToLayoutBox(paint_offset_root)->ScrolledContentOffset(); return result; } ",0 "bool Document::setFocusedElement(PassRefPtrWillBeRawPtr prpNewFocusedElement, const FocusParams& params) { ASSERT(!m_lifecycle.inDetach()); m_clearFocusedElementTimer.stop(); RefPtrWillBeRawPtr newFocusedElement = prpNewFocusedElement; if (newFocusedElement && (newFocusedElement->document() != this)) return true; if (NodeChildRemovalTracker::isBeingRemoved(newFocusedElement.get())) return true; if (m_focusedElement == newFocusedElement) return true; bool focusChangeBlocked = false; RefPtrWillBeRawPtr oldFocusedElement = m_focusedElement; m_focusedElement = nullptr; if (oldFocusedElement) { if (oldFocusedElement->active()) oldFocusedElement->setActive(false); oldFocusedElement->setFocus(false); if (page() && (page()->focusController().isFocused())) { oldFocusedElement->dispatchBlurEvent(newFocusedElement.get(), params.type, params.sourceCapabilities); if (m_focusedElement) { focusChangeBlocked = true; newFocusedElement = nullptr; } oldFocusedElement->dispatchFocusOutEvent(EventTypeNames::focusout, newFocusedElement.get(), params.sourceCapabilities); // DOM level 3 name for the bubbling blur event. oldFocusedElement->dispatchFocusOutEvent(EventTypeNames::DOMFocusOut, newFocusedElement.get(), params.sourceCapabilities); // DOM level 2 name for compatibility. if (m_focusedElement) { focusChangeBlocked = true; newFocusedElement = nullptr; } if (newFocusedElement) updateLayoutTreeIgnorePendingStylesheets(); } if (view()) { Widget* oldWidget = widgetForElement(*oldFocusedElement); if (oldWidget) oldWidget->setFocus(false, params.type); else view()->setFocus(false, params.type); } } if (newFocusedElement && newFocusedElement->isFocusable()) { if (newFocusedElement->isRootEditableElement() && !acceptsEditingFocus(*newFocusedElement)) { focusChangeBlocked = true; goto SetFocusedElementDone; } m_focusedElement = newFocusedElement; m_focusedElement->setFocus(true); cancelFocusAppearanceUpdate(); m_focusedElement->updateFocusAppearance(params.selectionBehavior); if (page() && (page()->focusController().isFocused())) { m_focusedElement->dispatchFocusEvent(oldFocusedElement.get(), params.type, params.sourceCapabilities); if (m_focusedElement != newFocusedElement) { focusChangeBlocked = true; goto SetFocusedElementDone; } m_focusedElement->dispatchFocusInEvent(EventTypeNames::focusin, oldFocusedElement.get(), params.type, params.sourceCapabilities); // DOM level 3 bubbling focus event. if (m_focusedElement != newFocusedElement) { focusChangeBlocked = true; goto SetFocusedElementDone; } m_focusedElement->dispatchFocusInEvent(EventTypeNames::DOMFocusIn, oldFocusedElement.get(), params.type, params.sourceCapabilities); // DOM level 2 for compatibility. if (m_focusedElement != newFocusedElement) { focusChangeBlocked = true; goto SetFocusedElementDone; } } if (m_focusedElement->isRootEditableElement()) frame()->spellChecker().didBeginEditing(m_focusedElement.get()); if (view()) { Widget* focusWidget = widgetForElement(*m_focusedElement); if (focusWidget) { updateLayout(); focusWidget = widgetForElement(*m_focusedElement); } if (focusWidget) focusWidget->setFocus(true, params.type); else view()->setFocus(true, params.type); } } if (!focusChangeBlocked && m_focusedElement) { if (AXObjectCache* cache = axObjectCache()) cache->handleFocusedUIElementChanged(oldFocusedElement.get(), newFocusedElement.get()); } if (!focusChangeBlocked && frameHost()) frameHost()->chromeClient().focusedNodeChanged(oldFocusedElement.get(), m_focusedElement.get()); SetFocusedElementDone: updateLayoutTreeIfNeeded(); if (LocalFrame* frame = this->frame()) frame->selection().didChangeFocus(); return !focusChangeBlocked; } ",0 "handle_to_dir(int handle) { if (handle_is_ok(handle, HANDLE_DIR)) return handles[handle].dirp; return NULL; } ",0 "static void pvscsi_realize(DeviceState *qdev, Error **errp) { PVSCSIClass *pvs_c = PVSCSI_DEVICE_GET_CLASS(qdev); PCIDevice *pci_dev = PCI_DEVICE(qdev); PVSCSIState *s = PVSCSI(qdev); if (!(s->compat_flags & PVSCSI_COMPAT_DISABLE_PCIE)) { pci_dev->cap_present |= QEMU_PCI_CAP_EXPRESS; } pvs_c->parent_dc_realize(qdev, errp); } ",0 "Frame* FrameLoaderClient::dispatchCreatePage() { WebKitWebView* webView = getViewFromFrame(m_frame); WebKitWebView* newWebView = 0; g_signal_emit_by_name(webView, ""create-web-view"", m_frame, &newWebView); if (!newWebView) return 0; WebKitWebViewPrivate* privateData = WEBKIT_WEB_VIEW_GET_PRIVATE(newWebView); return core(privateData->mainFrame); } ",0 "void InspectorPageAgent::FrameStoppedLoading(LocalFrame* frame) { GetFrontend()->frameStoppedLoading(IdentifiersFactory::FrameId(frame)); } ",0 "is_device_in_fstab (Device *device, char **out_mount_point) { GList *l; GList *mount_points; gboolean ret; ret = FALSE; mount_points = g_unix_mount_points_get (NULL); for (l = mount_points; l != NULL; l = l->next) { GUnixMountPoint *mount_point = l->data; char canonical_device_file[PATH_MAX]; char *device_path; char *s; device_path = g_strdup (g_unix_mount_point_get_device_path (mount_point)); /* get the canonical path; e.g. resolve * * /dev/disk/by-path/pci-0000:00:1d.7-usb-0:3:1.0-scsi-0:0:0:3-part5 * UUID=78af6939-adac-4ea5-a2a8-576e141da010 * LABEL=foobar * * into something like /dev/sde5. */ if (g_str_has_prefix (device_path, ""UUID="")) { s = device_path; device_path = g_strdup_printf (""/dev/disk/by-uuid/%s"", device_path + 5); g_free (s); } else if (g_str_has_prefix (device_path, ""LABEL="")) { s = device_path; device_path = g_strdup_printf (""/dev/disk/by-label/%s"", device_path + 6); g_free (s); } if (realpath (device_path, canonical_device_file) == NULL) { g_free (device_path); continue; } g_free (device_path); if (strcmp (device->priv->device_file, canonical_device_file) == 0) { ret = TRUE; if (out_mount_point != NULL) *out_mount_point = g_strdup (g_unix_mount_point_get_mount_path (mount_point)); break; } } g_list_foreach (mount_points, (GFunc) g_unix_mount_point_free, NULL); g_list_free (mount_points); return ret; } ",0 "static struct nfs4_delegation *find_deleg_stateid(struct nfs4_client *cl, stateid_t *s) { struct nfs4_stid *ret; ret = find_stateid_by_type(cl, s, NFS4_DELEG_STID); if (!ret) return NULL; return delegstateid(ret); } ",0 "void WebContentsImpl::ShowCreatedWidget(int process_id, int route_id, bool is_fullscreen, const gfx::Rect& initial_rect) { RenderWidgetHostViewBase* widget_host_view = static_cast( GetCreatedWidget(process_id, route_id)); if (!widget_host_view) return; RenderWidgetHostView* view = nullptr; if (GetOuterWebContents()) { view = GetOuterWebContents()->GetRenderWidgetHostView(); } else { view = GetRenderWidgetHostView(); } if (is_fullscreen) { DCHECK_EQ(MSG_ROUTING_NONE, fullscreen_widget_routing_id_); view_->StoreFocus(); fullscreen_widget_process_id_ = widget_host_view->GetRenderWidgetHost()->GetProcess()->GetID(); fullscreen_widget_routing_id_ = route_id; if (delegate_ && delegate_->EmbedsFullscreenWidget()) { widget_host_view->InitAsChild(GetRenderWidgetHostView()->GetNativeView()); delegate_->EnterFullscreenModeForTab(this, GURL()); } else { widget_host_view->InitAsFullscreen(view); } for (auto& observer : observers_) observer.DidShowFullscreenWidget(); if (!widget_host_view->HasFocus()) widget_host_view->Focus(); } else { widget_host_view->InitAsPopup(view, initial_rect); } RenderWidgetHostImpl* render_widget_host_impl = widget_host_view->host(); render_widget_host_impl->Init(); render_widget_host_impl->set_allow_privileged_mouse_lock(is_fullscreen); #if defined(OS_MACOSX) base::mac::NSObjectRelease(widget_host_view->GetNativeView()); #endif } ",0 "bool InterstitialPageImpl::OnMessageReceived( RenderViewHostImpl* render_view_host, const IPC::Message& message) { return false; } ",0 "scoped_refptr Document::GetTaskRunner(TaskType type) { DCHECK(IsMainThread()); if (ContextDocument() && ContextDocument()->GetFrame()) return ContextDocument()->GetFrame()->GetTaskRunner(type); return Platform::Current()->CurrentThread()->GetWebTaskRunner(); } ",0 "void HTMLInputElement::requiredAttributeChanged() { HTMLTextFormControlElement::requiredAttributeChanged(); if (CheckedRadioButtons* buttons = checkedRadioButtons()) buttons->requiredAttributeChanged(this); m_inputType->requiredAttributeChanged(); } ",0 "rdp_out_ts_cache_definition(STREAM s, uint16 entries, uint16 maxcellsize) { out_uint16_le(s, entries); out_uint16_le(s, maxcellsize); } ",0 "OMXNodeInstance::OMXNodeInstance( OMX *owner, const sp &observer, const char *name) : mOwner(owner), mNodeID(0), mHandle(NULL), mObserver(observer), mDying(false) #ifdef __LP64__ , mBufferIDCount(0) #endif { mName = ADebug::GetDebugName(name); DEBUG = ADebug::GetDebugLevelFromProperty(name, ""debug.stagefright.omx-debug""); ALOGV(""debug level for %s is %d"", name, DEBUG); DEBUG_BUMP = DEBUG; mNumPortBuffers[0] = 0; mNumPortBuffers[1] = 0; mDebugLevelBumpPendingBuffers[0] = 0; mDebugLevelBumpPendingBuffers[1] = 0; } ",0 "bool Frame::isMainFrame() const { return !tree().parent(); } ",0 "static ssize_t debug_cow_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { return single_flag_show(kobj, attr, buf, TRANSPARENT_HUGEPAGE_DEBUG_COW_FLAG); } ",0 "static void sig_channel_destroyed(CHANNEL_REC *channel) { g_return_if_fail(IS_CHANNEL(channel)); g_hash_table_foreach(channel->nicks, (GHFunc) nicklist_remove_hash, channel); g_hash_table_destroy(channel->nicks); } ",0 "static void dn_enter_memory_pressure(struct sock *sk) { if (!dn_memory_pressure) { dn_memory_pressure = 1; } } ",0 "int kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf) { return VM_FAULT_SIGBUS; } ",0 "PHP_FUNCTION(dom_document_create_attribute) { zval *id; xmlAttrPtr node; xmlDocPtr docp; int ret, name_len; dom_object *intern; char *name; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), ""Os"", &id, dom_document_class_entry, &name, &name_len) == FAILURE) { return; } DOM_GET_OBJ(docp, id, xmlDocPtr, intern); if (xmlValidateName((xmlChar *) name, 0) != 0) { php_dom_throw_error(INVALID_CHARACTER_ERR, dom_get_strict_error(intern->document) TSRMLS_CC); RETURN_FALSE; } node = xmlNewDocProp(docp, (xmlChar *) name, NULL); if (!node) { RETURN_FALSE; } DOM_RET_OBJ((xmlNodePtr) node, &ret, intern); } ",0 "static ssize_t proc_loginuid_read(struct file * file, char __user * buf, size_t count, loff_t *ppos) { struct inode * inode = file->f_path.dentry->d_inode; struct task_struct *task = get_proc_task(inode); ssize_t length; char tmpbuf[TMPBUFLEN]; if (!task) return -ESRCH; length = scnprintf(tmpbuf, TMPBUFLEN, ""%u"", audit_get_loginuid(task)); put_task_struct(task); return simple_read_from_buffer(buf, count, ppos, tmpbuf, length); } ",0 "bool IsAutofillUpstreamEditableCardholderNameExperimentEnabled() { return base::FeatureList::IsEnabled(kAutofillUpstreamEditableCardholderName); } ",0 "bool Document::CanAcceptChild(const Node& new_child, const Node* next, const Node* old_child, ExceptionState& exception_state) const { DCHECK(!(next && old_child)); if (old_child && old_child->getNodeType() == new_child.getNodeType()) return true; int num_doctypes = 0; int num_elements = 0; bool has_doctype_after_reference_node = false; bool has_element_after_reference_node = false; bool saw_reference_node = false; for (Node& child : NodeTraversal::ChildrenOf(*this)) { if (old_child && *old_child == child) { saw_reference_node = true; continue; } if (&child == next) saw_reference_node = true; switch (child.getNodeType()) { case kDocumentTypeNode: num_doctypes++; has_doctype_after_reference_node = saw_reference_node; break; case kElementNode: num_elements++; has_element_after_reference_node = saw_reference_node; break; default: break; } } if (new_child.IsDocumentFragment()) { for (Node& child : NodeTraversal::ChildrenOf(ToDocumentFragment(new_child))) { switch (child.getNodeType()) { case kAttributeNode: case kCdataSectionNode: case kDocumentFragmentNode: case kDocumentNode: case kTextNode: exception_state.ThrowDOMException( DOMExceptionCode::kHierarchyRequestError, ""Nodes of type '"" + new_child.nodeName() + ""' may not be inserted inside nodes of type '#document'.""); return false; case kCommentNode: case kProcessingInstructionNode: break; case kDocumentTypeNode: num_doctypes++; break; case kElementNode: num_elements++; if (has_doctype_after_reference_node) { exception_state.ThrowDOMException( DOMExceptionCode::kHierarchyRequestError, ""Can't insert an element before a doctype.""); return false; } break; } } } else { switch (new_child.getNodeType()) { case kAttributeNode: case kCdataSectionNode: case kDocumentFragmentNode: case kDocumentNode: case kTextNode: exception_state.ThrowDOMException( DOMExceptionCode::kHierarchyRequestError, ""Nodes of type '"" + new_child.nodeName() + ""' may not be inserted inside nodes of type '#document'.""); return false; case kCommentNode: case kProcessingInstructionNode: return true; case kDocumentTypeNode: num_doctypes++; if (num_elements > 0 && !has_element_after_reference_node) { exception_state.ThrowDOMException( DOMExceptionCode::kHierarchyRequestError, ""Can't insert a doctype before the root element.""); return false; } break; case kElementNode: num_elements++; if (has_doctype_after_reference_node) { exception_state.ThrowDOMException( DOMExceptionCode::kHierarchyRequestError, ""Can't insert an element before a doctype.""); return false; } break; } } if (num_elements > 1 || num_doctypes > 1) { exception_state.ThrowDOMException( DOMExceptionCode::kHierarchyRequestError, String::Format(""Only one %s on document allowed."", num_elements > 1 ? ""element"" : ""doctype"")); return false; } return true; } ",0 "static inline MagickBooleanType IsSupportedCombination( const VIPSBandFormat format,const VIPSType type) { switch(type) { case VIPSTypeB_W: case VIPSTypeCMYK: case VIPSTypeRGB: case VIPSTypesRGB: return(MagickTrue); case VIPSTypeGREY16: case VIPSTypeRGB16: switch(format) { case VIPSBandFormatUSHORT: case VIPSBandFormatSHORT: case VIPSBandFormatUINT: case VIPSBandFormatINT: case VIPSBandFormatFLOAT: case VIPSBandFormatDOUBLE: return(MagickTrue); default: return(MagickFalse); } default: return(MagickFalse); } } ",0 "ui::Layer* GetLayer(views::Widget* widget) { return widget->GetNativeView()->layer(); } ",0 " void OnDataMethod(const DataMethodCallback& callback, dbus::Response* response) { if (!response) { callback.Run(DBUS_METHOD_CALL_FAILURE, false, std::string()); return; } dbus::MessageReader reader(response); const uint8* data_buffer = NULL; size_t data_length = 0; bool result = false; if (!reader.PopArrayOfBytes(&data_buffer, &data_length) || !reader.PopBool(&result)) { callback.Run(DBUS_METHOD_CALL_FAILURE, false, std::string()); return; } std::string data(reinterpret_cast(data_buffer), data_length); callback.Run(DBUS_METHOD_CALL_SUCCESS, result, data); } ",0 "int ar6000_remove_ap_interface(struct ar6_softc *ar) { if (arApNetDev) { ar6000_stop_ap_interface(ar); unregister_netdev(arApNetDev); free_netdev(apApNetDev); A_PRINTF(""Remove AP interface\n""); } ar->arApDev = NULL; arApNetDev = NULL; return 0; } ",0 " void TestingPlatformSupport::cryptographicallyRandomValues(unsigned char* buffer, size_t length) { } ",1 "cmsBool WriteCountAndSting(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cmsMLU* mlu, const char* Section) { cmsUInt32Number TextSize; char* Text; TextSize = cmsMLUgetASCII(mlu, ""PS"", Section, NULL, 0); Text = (char*) _cmsMalloc(self ->ContextID, TextSize); if (!_cmsWriteUInt32Number(io, TextSize)) return FALSE; if (cmsMLUgetASCII(mlu, ""PS"", Section, Text, TextSize) == 0) return FALSE; if (!io ->Write(io, TextSize, Text)) return FALSE; _cmsFree(self ->ContextID, Text); return TRUE; } ",0 " Direct_Move( EXEC_OP_ TT_GlyphZone zone, FT_UShort point, FT_F26Dot6 distance ) { FT_F26Dot6 v; #ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING FT_ASSERT( !CUR.face->unpatented_hinting ); #endif v = CUR.GS.freeVector.x; if ( v != 0 ) { zone->cur[point].x += TT_MULDIV( distance, v * 0x10000L, CUR.F_dot_P ); zone->tags[point] |= FT_CURVE_TAG_TOUCH_X; } v = CUR.GS.freeVector.y; if ( v != 0 ) { zone->cur[point].y += TT_MULDIV( distance, v * 0x10000L, CUR.F_dot_P ); zone->tags[point] |= FT_CURVE_TAG_TOUCH_Y; } } ",0 " Ins_JMPR( TT_ExecContext exc, FT_Long* args ) { if ( args[0] == 0 && exc->args == 0 ) { exc->error = FT_THROW( Bad_Argument ); return; } exc->IP += args[0]; if ( exc->IP < 0 || ( exc->callTop > 0 && exc->IP > exc->callStack[exc->callTop - 1].Def->end ) ) { exc->error = FT_THROW( Bad_Argument ); return; } exc->step_ins = FALSE; if ( args[0] < 0 ) { if ( ++exc->neg_jump_counter > exc->neg_jump_counter_max ) exc->error = FT_THROW( Execution_Too_Long ); } } ",0 "void IncrementNumber(size_t* number, BlobStatus status) { EXPECT_EQ(BlobStatus::DONE, status); *number = *number + 1; } ",0 "static int add_persistent_gnt(struct xen_blkif_ring *ring, struct persistent_gnt *persistent_gnt) { struct rb_node **new = NULL, *parent = NULL; struct persistent_gnt *this; struct xen_blkif *blkif = ring->blkif; if (ring->persistent_gnt_c >= xen_blkif_max_pgrants) { if (!blkif->vbd.overflow_max_grants) blkif->vbd.overflow_max_grants = 1; return -EBUSY; } /* Figure out where to put new node */ new = &ring->persistent_gnts.rb_node; while (*new) { this = container_of(*new, struct persistent_gnt, node); parent = *new; if (persistent_gnt->gnt < this->gnt) new = &((*new)->rb_left); else if (persistent_gnt->gnt > this->gnt) new = &((*new)->rb_right); else { pr_alert_ratelimited(""trying to add a gref that's already in the tree\n""); return -EINVAL; } } bitmap_zero(persistent_gnt->flags, PERSISTENT_GNT_FLAGS_SIZE); set_bit(PERSISTENT_GNT_ACTIVE, persistent_gnt->flags); /* Add new node and rebalance tree. */ rb_link_node(&(persistent_gnt->node), parent, new); rb_insert_color(&(persistent_gnt->node), &ring->persistent_gnts); ring->persistent_gnt_c++; atomic_inc(&ring->persistent_gnt_in_use); return 0; } ",0 "static int __scan_channels(struct ipmi_smi *intf, struct ipmi_device_id *id) { int rv; if (ipmi_version_major(id) > 1 || (ipmi_version_major(id) == 1 && ipmi_version_minor(id) >= 5)) { unsigned int set; /* * Start scanning the channels to see what is * available. */ set = !intf->curr_working_cset; intf->curr_working_cset = set; memset(&intf->wchannels[set], 0, sizeof(struct ipmi_channel_set)); intf->null_user_handler = channel_handler; intf->curr_channel = 0; rv = send_channel_info_cmd(intf, 0); if (rv) { dev_warn(intf->si_dev, ""Error sending channel information for channel 0, %d\n"", rv); return -EIO; } /* Wait for the channel info to be read. */ wait_event(intf->waitq, intf->channels_ready); intf->null_user_handler = NULL; } else { unsigned int set = intf->curr_working_cset; /* Assume a single IPMB channel at zero. */ intf->wchannels[set].c[0].medium = IPMI_CHANNEL_MEDIUM_IPMB; intf->wchannels[set].c[0].protocol = IPMI_CHANNEL_PROTOCOL_IPMB; intf->channel_list = intf->wchannels + set; intf->channels_ready = true; } return 0; } ",0 "SYSCALL_DEFINE3(recvmsg, int, fd, struct user_msghdr __user *, msg, unsigned int, flags) { return __sys_recvmsg(fd, msg, flags, true); } ",0 "static inline size_t xfrm_migrate_msgsize(int num_migrate, int with_kma) { return NLMSG_ALIGN(sizeof(struct xfrm_userpolicy_id)) + (with_kma ? nla_total_size(sizeof(struct xfrm_kmaddress)) : 0) + nla_total_size(sizeof(struct xfrm_user_migrate) * num_migrate) + userpolicy_type_attrsize(); } ",0 "makepol(TSQueryParserState state, PushFunction pushval, Datum opaque) { int8 operator = 0; ts_tokentype type; int lenval = 0; char *strval = NULL; int8 opstack[STACKDEPTH]; int lenstack = 0; int16 weight = 0; bool prefix; /* since this function recurses, it could be driven to stack overflow */ check_stack_depth(); while ((type = gettoken_query(state, &operator, &lenval, &strval, &weight, &prefix)) != PT_END) { switch (type) { case PT_VAL: pushval(opaque, state, strval, lenval, weight, prefix); while (lenstack && (opstack[lenstack - 1] == OP_AND || opstack[lenstack - 1] == OP_NOT)) { lenstack--; pushOperator(state, opstack[lenstack]); } break; case PT_OPR: if (lenstack && operator == OP_OR) pushOperator(state, OP_OR); else { if (lenstack == STACKDEPTH) /* internal error */ elog(ERROR, ""tsquery stack too small""); opstack[lenstack] = operator; lenstack++; } break; case PT_OPEN: makepol(state, pushval, opaque); while (lenstack && (opstack[lenstack - 1] == OP_AND || opstack[lenstack - 1] == OP_NOT)) { lenstack--; pushOperator(state, opstack[lenstack]); } break; case PT_CLOSE: while (lenstack) { lenstack--; pushOperator(state, opstack[lenstack]); }; return; case PT_ERR: default: ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg(""syntax error in tsquery: \""%s\"""", state->buffer))); } } while (lenstack) { lenstack--; pushOperator(state, opstack[lenstack]); } } ",0 "uint16_t AVRC_PassCmd(uint8_t handle, uint8_t label, tAVRC_MSG_PASS* p_msg) { BT_HDR* p_buf; uint16_t status = AVRC_NO_RESOURCES; if (!p_msg) return AVRC_BAD_PARAM; p_msg->hdr.ctype = AVRC_CMD_CTRL; p_buf = avrc_pass_msg(p_msg); if (p_buf) { status = AVCT_MsgReq(handle, label, AVCT_CMD, p_buf); if (status == AVCT_SUCCESS) { /* Start command timer to wait for response */ avrc_start_cmd_timer(handle, label, 0); } } return (status); } ",0 "static int windows_set_interface_altsetting(struct libusb_device_handle *dev_handle, int iface, int altsetting) { int r = LIBUSB_SUCCESS; struct windows_device_priv *priv = _device_priv(dev_handle->dev); safe_free(priv->usb_interface[iface].endpoint); priv->usb_interface[iface].nb_endpoints= 0; r = priv->apib->set_interface_altsetting(SUB_API_NOTSET, dev_handle, iface, altsetting); if (r == LIBUSB_SUCCESS) { r = windows_assign_endpoints(dev_handle, iface, altsetting); } return r; } ",0 "bool XSSAuditor::eraseAttributeIfInjected(const FilterTokenRequest& request, const QualifiedName& attributeName, const String& replacementValue, AttributeKind treatment) { size_t indexOfAttribute = 0; if (findAttributeWithName(request.token, attributeName, indexOfAttribute)) { const HTMLToken::Attribute& attribute = request.token.attributes().at(indexOfAttribute); if (isContainedInRequest(decodedSnippetForAttribute(request, attribute, treatment))) { if (threadSafeMatch(attributeName, srcAttr) && isLikelySafeResource(String(attribute.value))) return false; if (threadSafeMatch(attributeName, http_equivAttr) && !isDangerousHTTPEquiv(String(attribute.value))) return false; request.token.eraseValueOfAttribute(indexOfAttribute); if (!replacementValue.isEmpty()) request.token.appendToAttributeValue(indexOfAttribute, replacementValue); return true; } } return false; } ",0 "int qemu_fdt_setprop_sized_cells_from_array(void *fdt, const char *node_path, const char *property, int numvalues, uint64_t *values) { uint32_t *propcells; uint64_t value; int cellnum, vnum, ncells; uint32_t hival; int ret; propcells = g_new0(uint32_t, numvalues * 2); cellnum = 0; for (vnum = 0; vnum < numvalues; vnum++) { ncells = values[vnum * 2]; if (ncells != 1 && ncells != 2) { ret = -1; goto out; } value = values[vnum * 2 + 1]; hival = cpu_to_be32(value >> 32); if (ncells > 1) { propcells[cellnum++] = hival; } else if (hival != 0) { ret = -1; goto out; } propcells[cellnum++] = cpu_to_be32(value); } ret = qemu_fdt_setprop(fdt, node_path, property, propcells, cellnum * sizeof(uint32_t)); out: g_free(propcells); return ret; } ",0 "int dns_packet_append_label(DnsPacket *p, const char *d, size_t l, bool canonical_candidate, size_t *start) { uint8_t *w; int r; /* Append a label to a packet. Optionally, does this in DNSSEC * canonical form, if this label is marked as a candidate for * it, and the canonical form logic is enabled for the * packet */ assert(p); assert(d); if (l > DNS_LABEL_MAX) return -E2BIG; r = dns_packet_extend(p, 1 + l, (void**) &w, start); if (r < 0) return r; *(w++) = (uint8_t) l; if (p->canonical_form && canonical_candidate) { size_t i; /* Generate in canonical form, as defined by DNSSEC * RFC 4034, Section 6.2, i.e. all lower-case. */ for (i = 0; i < l; i++) w[i] = (uint8_t) ascii_tolower(d[i]); } else /* Otherwise, just copy the string unaltered. This is * essential for DNS-SD, where the casing of labels * matters and needs to be retained. */ memcpy(w, d, l); return 0; } ",0 "bool ImeObserver::ConvertInputContextAutoComplete( ui::IMEEngineHandlerInterface::InputContext input_context) { return !(input_context.flags & ui::TEXT_INPUT_FLAG_AUTOCOMPLETE_OFF); } ",0 "IW_IMPL(void) iw_make_gamma_csdescr(struct iw_csdescr *cs, double gamma) { cs->cstype = IW_CSTYPE_GAMMA; cs->gamma = gamma; if(cs->gamma<0.1) cs->gamma=0.1; if(cs->gamma>10.0) cs->gamma=10.0; cs->srgb_intent = 0; optimize_csdescr(cs); } ",0 "unhash_client_locked(struct nfs4_client *clp) { struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id); struct nfsd4_session *ses; lockdep_assert_held(&nn->client_lock); /* Mark the client as expired! */ clp->cl_time = 0; /* Make it invisible */ if (!list_empty(&clp->cl_idhash)) { list_del_init(&clp->cl_idhash); if (test_bit(NFSD4_CLIENT_CONFIRMED, &clp->cl_flags)) rb_erase(&clp->cl_namenode, &nn->conf_name_tree); else rb_erase(&clp->cl_namenode, &nn->unconf_name_tree); } list_del_init(&clp->cl_lru); spin_lock(&clp->cl_lock); list_for_each_entry(ses, &clp->cl_sessions, se_perclnt) list_del_init(&ses->se_hash); spin_unlock(&clp->cl_lock); } ",0 "static int nfs4_get_referral(struct inode *dir, const struct qstr *name, struct nfs_fattr *fattr, struct nfs_fh *fhandle) { int status = -ENOMEM; struct page *page = NULL; struct nfs4_fs_locations *locations = NULL; page = alloc_page(GFP_KERNEL); if (page == NULL) goto out; locations = kmalloc(sizeof(struct nfs4_fs_locations), GFP_KERNEL); if (locations == NULL) goto out; status = nfs4_proc_fs_locations(dir, name, locations, page); if (status != 0) goto out; /* Make sure server returned a different fsid for the referral */ if (nfs_fsid_equal(&NFS_SERVER(dir)->fsid, &locations->fattr.fsid)) { dprintk(""%s: server did not return a different fsid for a referral at %s\n"", __func__, name->name); status = -EIO; goto out; } memcpy(fattr, &locations->fattr, sizeof(struct nfs_fattr)); fattr->valid |= NFS_ATTR_FATTR_V4_REFERRAL; if (!fattr->mode) fattr->mode = S_IFDIR; memset(fhandle, 0, sizeof(struct nfs_fh)); out: if (page) __free_page(page); if (locations) kfree(locations); return status; } ",0 "static long int getreaperage(pid_t qpid) { int pid, mypipe[2], ret; struct timeval tv; fd_set s; long int mtime, answer = 0; if (pipe(mypipe)) { return 0; } pid = fork(); if (!pid) { // child mtime = get_pid1_time(qpid); if (write(mypipe[1], &mtime, sizeof(mtime)) != sizeof(mtime)) fprintf(stderr, ""Warning: bad write from getreaperage\n""); _exit(0); } close(mypipe[1]); FD_ZERO(&s); FD_SET(mypipe[0], &s); tv.tv_sec = 1; tv.tv_usec = 0; ret = select(mypipe[0]+1, &s, NULL, NULL, &tv); if (ret <= 0) { perror(""select""); goto out; } if (!ret) { fprintf(stderr, ""timed out\n""); goto out; } if (read(mypipe[0], &mtime, sizeof(mtime)) != sizeof(mtime)) { perror(""read""); goto out; } answer = mtime; out: wait_for_pid(pid); close(mypipe[0]); return answer; } ",0 "PictureLayerImpl::Pair::~Pair() { } ",0 "void LocalFrameClientImpl::DidChangeFramePolicy( Frame* child_frame, SandboxFlags flags, const ParsedFeaturePolicy& container_policy) { if (!web_frame_->Client()) return; web_frame_->Client()->DidChangeFramePolicy( WebFrame::FromFrame(child_frame), static_cast(flags), container_policy); } ",0 "const WTF::Vector& PopupContainer:: popupData() const { return m_listBox->items(); } ",0 "LocalFrame& LocalFrame::LocalFrameRoot() const { const LocalFrame* cur_frame = this; while (cur_frame && cur_frame->Tree().Parent() && cur_frame->Tree().Parent()->IsLocalFrame()) cur_frame = ToLocalFrame(cur_frame->Tree().Parent()); return const_cast(*cur_frame); } ",0 "int tpm_pm_resume(struct device *dev) { struct tpm_chip *chip = dev_get_drvdata(dev); if (chip == NULL) return -ENODEV; return 0; } ",0 "void WebPluginProxy::OnPaint(const gfx::Rect& damaged_rect) { child_process_logging::SetActiveURL(page_url_); Paint(damaged_rect); Send(new PluginHostMsg_InvalidateRect(route_id_, damaged_rect)); } ",0 "long keyctl_instantiate_key_common(key_serial_t id, struct iov_iter *from, key_serial_t ringid) { const struct cred *cred = current_cred(); struct request_key_auth *rka; struct key *instkey, *dest_keyring; size_t plen = from ? iov_iter_count(from) : 0; void *payload; long ret; kenter(""%d,,%zu,%d"", id, plen, ringid); if (!plen) from = NULL; ret = -EINVAL; if (plen > 1024 * 1024 - 1) goto error; /* the appropriate instantiation authorisation key must have been * assumed before calling this */ ret = -EPERM; instkey = cred->request_key_auth; if (!instkey) goto error; rka = instkey->payload.data[0]; if (rka->target_key->serial != id) goto error; /* pull the payload in if one was supplied */ payload = NULL; if (from) { ret = -ENOMEM; payload = kvmalloc(plen, GFP_KERNEL); if (!payload) goto error; ret = -EFAULT; if (!copy_from_iter_full(payload, plen, from)) goto error2; } /* find the destination keyring amongst those belonging to the * requesting task */ ret = get_instantiation_keyring(ringid, rka, &dest_keyring); if (ret < 0) goto error2; /* instantiate the key and link it into a keyring */ ret = key_instantiate_and_link(rka->target_key, payload, plen, dest_keyring, instkey); key_put(dest_keyring); /* discard the assumed authority if it's just been disabled by * instantiation of the key */ if (ret == 0) keyctl_change_reqkey_auth(NULL); error2: kvfree(payload); error: return ret; } ",0 "static void ffs_event_add(struct ffs_data *ffs, enum usb_functionfs_event_type type) { unsigned long flags; spin_lock_irqsave(&ffs->ev.waitq.lock, flags); __ffs_event_add(ffs, type); spin_unlock_irqrestore(&ffs->ev.waitq.lock, flags); } ",0 "int _yr_emit_split( RE_EMIT_CONTEXT* emit_context, uint8_t opcode, int16_t argument, uint8_t** instruction_addr, int16_t** argument_addr, size_t* code_size) { assert(opcode == RE_OPCODE_SPLIT_A || opcode == RE_OPCODE_SPLIT_B); if (emit_context->next_split_id == RE_MAX_SPLIT_ID) return ERROR_REGULAR_EXPRESSION_TOO_COMPLEX; FAIL_ON_ERROR(yr_arena_write_data( emit_context->arena, &opcode, sizeof(uint8_t), (void**) instruction_addr)); FAIL_ON_ERROR(yr_arena_write_data( emit_context->arena, &emit_context->next_split_id, sizeof(RE_SPLIT_ID_TYPE), NULL)); emit_context->next_split_id++; FAIL_ON_ERROR(yr_arena_write_data( emit_context->arena, &argument, sizeof(int16_t), (void**) argument_addr)); *code_size = sizeof(uint8_t) + sizeof(RE_SPLIT_ID_TYPE) + sizeof(int16_t); return ERROR_SUCCESS; } ",0 "const String& DocumentLoader::responseMIMEType() const { return m_response.mimeType(); } ",0 "static int chmd_fast_find(struct mschm_decompressor *base, struct mschmd_header *chm, const char *filename, struct mschmd_file *f_ptr, int f_size) { struct mschm_decompressor_p *self = (struct mschm_decompressor_p *) base; struct mspack_system *sys; struct mspack_file *fh; const unsigned char *chunk, *p, *end; int err = MSPACK_ERR_OK, result = -1; unsigned int n, sec; if (!self || !chm || !f_ptr || (f_size != sizeof(struct mschmd_file))) { return MSPACK_ERR_ARGS; } sys = self->system; /* clear the results structure */ memset(f_ptr, 0, f_size); if (!(fh = sys->open(sys, chm->filename, MSPACK_SYS_OPEN_READ))) { return MSPACK_ERR_OPEN; } /* go through PMGI chunk hierarchy to reach PMGL chunk */ if (chm->index_root < chm->num_chunks) { n = chm->index_root; for (;;) { if (!(chunk = read_chunk(self, chm, fh, n))) { sys->close(fh); return self->error; } /* search PMGI/PMGL chunk. exit early if no entry found */ if ((result = search_chunk(chm, chunk, filename, &p, &end)) <= 0) { break; } /* found result. loop around for next chunk if this is PMGI */ if (chunk[3] == 0x4C) break; else READ_ENCINT(n); } } else { /* PMGL chunks only, search from first_pmgl to last_pmgl */ for (n = chm->first_pmgl; n <= chm->last_pmgl; n = EndGetI32(&chunk[pmgl_NextChunk])) { if (!(chunk = read_chunk(self, chm, fh, n))) { err = self->error; break; } /* search PMGL chunk. exit if file found */ if ((result = search_chunk(chm, chunk, filename, &p, &end)) > 0) { break; } /* stop simple infinite loops: can't visit the same chunk twice */ if ((int)n == EndGetI32(&chunk[pmgl_NextChunk])) { break; } } } /* if we found a file, read it */ if (result > 0) { READ_ENCINT(sec); f_ptr->section = (sec == 0) ? (struct mschmd_section *) &chm->sec0 : (struct mschmd_section *) &chm->sec1; READ_ENCINT(f_ptr->offset); READ_ENCINT(f_ptr->length); } else if (result < 0) { err = MSPACK_ERR_DATAFORMAT; } sys->close(fh); return self->error = err; chunk_end: D((""read beyond end of chunk entries"")) sys->close(fh); return self->error = MSPACK_ERR_DATAFORMAT; } ",0 "size_t ZSTD_compress_usingDict(ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize, const void* dict, size_t dictSize, int compressionLevel) { ZSTD_parameters const params = ZSTD_getParams(compressionLevel, srcSize + (!srcSize), dict ? dictSize : 0); ZSTD_CCtx_params cctxParams = ZSTD_assignParamsToCCtxParams(cctx->requestedParams, params); assert(params.fParams.contentSizeFlag == 1); return ZSTD_compress_advanced_internal(cctx, dst, dstCapacity, src, srcSize, dict, dictSize, cctxParams); } ",0 "char jsvGetCharInString(JsVar *v, size_t idx) { if (!jsvIsString(v)) return 0; JsvStringIterator it; jsvStringIteratorNew(&it, v, idx); char ch = jsvStringIteratorGetChar(&it); jsvStringIteratorFree(&it); return ch; } ",0 "md5sum (uint8_t *buf, int len, int n_print_chars, struct gc_arena *gc) { uint8_t digest[MD5_DIGEST_LENGTH]; const md_kt_t *md5_kt = md_kt_get(""MD5""); md_full(md5_kt, buf, len, digest); return format_hex (digest, MD5_DIGEST_LENGTH, n_print_chars, gc); } ",0 "json_bool lh_table_lookup_ex(struct lh_table* t, const void* k, void **v) { struct lh_entry *e = lh_table_lookup_entry(t, k); if (e != NULL) { if (v != NULL) *v = (void *)e->v; return TRUE; /* key found */ } if (v != NULL) *v = NULL; return FALSE; /* key not found */ } ",0 "static int snd_msnd_init_sma(struct snd_msnd *chip) { static int initted; u16 mastVolLeft, mastVolRight; unsigned long flags; #ifdef MSND_CLASSIC outb(chip->memid, chip->io + HP_MEMM); #endif outb(HPBLKSEL_0, chip->io + HP_BLKS); /* Motorola 56k shared memory base */ chip->SMA = chip->mappedbase + SMA_STRUCT_START; if (initted) { mastVolLeft = readw(chip->SMA + SMA_wCurrMastVolLeft); mastVolRight = readw(chip->SMA + SMA_wCurrMastVolRight); } else mastVolLeft = mastVolRight = 0; memset_io(chip->mappedbase, 0, 0x8000); /* Critical section: bank 1 access */ spin_lock_irqsave(&chip->lock, flags); outb(HPBLKSEL_1, chip->io + HP_BLKS); memset_io(chip->mappedbase, 0, 0x8000); outb(HPBLKSEL_0, chip->io + HP_BLKS); spin_unlock_irqrestore(&chip->lock, flags); /* Digital audio play queue */ chip->DAPQ = chip->mappedbase + DAPQ_OFFSET; snd_msnd_init_queue(chip->DAPQ, DAPQ_DATA_BUFF, DAPQ_BUFF_SIZE); /* Digital audio record queue */ chip->DARQ = chip->mappedbase + DARQ_OFFSET; snd_msnd_init_queue(chip->DARQ, DARQ_DATA_BUFF, DARQ_BUFF_SIZE); /* MIDI out queue */ chip->MODQ = chip->mappedbase + MODQ_OFFSET; snd_msnd_init_queue(chip->MODQ, MODQ_DATA_BUFF, MODQ_BUFF_SIZE); /* MIDI in queue */ chip->MIDQ = chip->mappedbase + MIDQ_OFFSET; snd_msnd_init_queue(chip->MIDQ, MIDQ_DATA_BUFF, MIDQ_BUFF_SIZE); /* DSP -> host message queue */ chip->DSPQ = chip->mappedbase + DSPQ_OFFSET; snd_msnd_init_queue(chip->DSPQ, DSPQ_DATA_BUFF, DSPQ_BUFF_SIZE); /* Setup some DSP values */ #ifndef MSND_CLASSIC writew(1, chip->SMA + SMA_wCurrPlayFormat); writew(chip->play_sample_size, chip->SMA + SMA_wCurrPlaySampleSize); writew(chip->play_channels, chip->SMA + SMA_wCurrPlayChannels); writew(chip->play_sample_rate, chip->SMA + SMA_wCurrPlaySampleRate); #endif writew(chip->play_sample_rate, chip->SMA + SMA_wCalFreqAtoD); writew(mastVolLeft, chip->SMA + SMA_wCurrMastVolLeft); writew(mastVolRight, chip->SMA + SMA_wCurrMastVolRight); #ifndef MSND_CLASSIC writel(0x00010000, chip->SMA + SMA_dwCurrPlayPitch); writel(0x00000001, chip->SMA + SMA_dwCurrPlayRate); #endif writew(0x303, chip->SMA + SMA_wCurrInputTagBits); initted = 1; return 0; } ",0 "void TestingAutomationProvider::AutofillHighlightSuggestion( Browser* browser, DictionaryValue* args, IPC::Message* reply_message) { int tab_index; if (!args->GetInteger(""tab_index"", &tab_index)) { AutomationJSONReply(this, reply_message).SendError( ""Invalid or missing args""); return; } WebContents* web_contents = browser->GetWebContentsAt(tab_index); if (!web_contents) { AutomationJSONReply(this, reply_message).SendError( StringPrintf(""No such tab at index %d"", tab_index)); return; } std::string direction; if (!args->GetString(""direction"", &direction) || (direction != ""up"" && direction != ""down"")) { AutomationJSONReply(this, reply_message).SendError( ""Must specify a direction of either 'up' or 'down'.""); return; } int key_code = (direction == ""up"") ? ui::VKEY_UP : ui::VKEY_DOWN; new AutofillDisplayedObserver( chrome::NOTIFICATION_AUTOFILL_DID_FILL_FORM_DATA, web_contents->GetRenderViewHost(), this, reply_message); SendWebKeyPressEventAsync(key_code, web_contents); } ",0 "bool TestRenderWidgetHostView::IsSpeaking() const { return false; } ",0 "void WebContentsImpl::CreateNewWidget(int32_t render_process_id, int32_t route_id, bool is_fullscreen, blink::WebPopupType popup_type) { RenderProcessHost* process = RenderProcessHost::FromID(render_process_id); if (!HasMatchingProcess(&frame_tree_, render_process_id)) { base::ProcessHandle process_handle = process->GetHandle(); if (process_handle != base::kNullProcessHandle) { RecordAction( base::UserMetricsAction(""Terminate_ProcessMismatch_CreateNewWidget"")); process->Shutdown(RESULT_CODE_KILLED, false); } return; } RenderWidgetHostImpl* widget_host = new RenderWidgetHostImpl(this, process, route_id, IsHidden()); RenderWidgetHostViewBase* widget_view = static_cast( view_->CreateViewForPopupWidget(widget_host)); if (!widget_view) return; if (!is_fullscreen) { widget_view->SetPopupType(popup_type); } pending_widget_views_[std::make_pair(render_process_id, route_id)] = widget_view; #if defined(OS_MACOSX) base::mac::NSObjectRetain(widget_view->GetNativeView()); #endif } ",0 "static inline int l2cap_disconnect_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u8 *data) { struct l2cap_disconn_req *req = (struct l2cap_disconn_req *) data; struct l2cap_disconn_rsp rsp; u16 dcid, scid; struct sock *sk; scid = __le16_to_cpu(req->scid); dcid = __le16_to_cpu(req->dcid); BT_DBG(""scid 0x%4.4x dcid 0x%4.4x"", scid, dcid); sk = l2cap_get_chan_by_scid(&conn->chan_list, dcid); if (!sk) return 0; rsp.dcid = cpu_to_le16(l2cap_pi(sk)->scid); rsp.scid = cpu_to_le16(l2cap_pi(sk)->dcid); l2cap_send_cmd(conn, cmd->ident, L2CAP_DISCONN_RSP, sizeof(rsp), &rsp); sk->sk_shutdown = SHUTDOWN_MASK; l2cap_chan_del(sk, ECONNRESET); bh_unlock_sock(sk); l2cap_sock_kill(sk); return 0; } ",0 "bool GetErrorQuery::Process() { NOTREACHED(); return true; } ",0 "magic_entry_free(struct magic_entry *me, uint32_t nme) { uint32_t i; if (me == NULL) return; for (i = 0; i < nme; i++) free(me[i].mp); free(me); } ",0 "static int checkMutexEnd(void){ pGlobalMutexMethods = 0; return SQLITE_OK; } ",0 "void PushMessagingServiceObserverAndroid::OnMessageHandled() { chrome::android::Java_PushMessagingServiceObserver_onMessageHandled( base::android::AttachCurrentThread()); } ",0 "xmlHasFeature(xmlFeature feature) { switch (feature) { case XML_WITH_THREAD: #ifdef LIBXML_THREAD_ENABLED return(1); #else return(0); #endif case XML_WITH_TREE: #ifdef LIBXML_TREE_ENABLED return(1); #else return(0); #endif case XML_WITH_OUTPUT: #ifdef LIBXML_OUTPUT_ENABLED return(1); #else return(0); #endif case XML_WITH_PUSH: #ifdef LIBXML_PUSH_ENABLED return(1); #else return(0); #endif case XML_WITH_READER: #ifdef LIBXML_READER_ENABLED return(1); #else return(0); #endif case XML_WITH_PATTERN: #ifdef LIBXML_PATTERN_ENABLED return(1); #else return(0); #endif case XML_WITH_WRITER: #ifdef LIBXML_WRITER_ENABLED return(1); #else return(0); #endif case XML_WITH_SAX1: #ifdef LIBXML_SAX1_ENABLED return(1); #else return(0); #endif case XML_WITH_FTP: #ifdef LIBXML_FTP_ENABLED return(1); #else return(0); #endif case XML_WITH_HTTP: #ifdef LIBXML_HTTP_ENABLED return(1); #else return(0); #endif case XML_WITH_VALID: #ifdef LIBXML_VALID_ENABLED return(1); #else return(0); #endif case XML_WITH_HTML: #ifdef LIBXML_HTML_ENABLED return(1); #else return(0); #endif case XML_WITH_LEGACY: #ifdef LIBXML_LEGACY_ENABLED return(1); #else return(0); #endif case XML_WITH_C14N: #ifdef LIBXML_C14N_ENABLED return(1); #else return(0); #endif case XML_WITH_CATALOG: #ifdef LIBXML_CATALOG_ENABLED return(1); #else return(0); #endif case XML_WITH_XPATH: #ifdef LIBXML_XPATH_ENABLED return(1); #else return(0); #endif case XML_WITH_XPTR: #ifdef LIBXML_XPTR_ENABLED return(1); #else return(0); #endif case XML_WITH_XINCLUDE: #ifdef LIBXML_XINCLUDE_ENABLED return(1); #else return(0); #endif case XML_WITH_ICONV: #ifdef LIBXML_ICONV_ENABLED return(1); #else return(0); #endif case XML_WITH_ISO8859X: #ifdef LIBXML_ISO8859X_ENABLED return(1); #else return(0); #endif case XML_WITH_UNICODE: #ifdef LIBXML_UNICODE_ENABLED return(1); #else return(0); #endif case XML_WITH_REGEXP: #ifdef LIBXML_REGEXP_ENABLED return(1); #else return(0); #endif case XML_WITH_AUTOMATA: #ifdef LIBXML_AUTOMATA_ENABLED return(1); #else return(0); #endif case XML_WITH_EXPR: #ifdef LIBXML_EXPR_ENABLED return(1); #else return(0); #endif case XML_WITH_SCHEMAS: #ifdef LIBXML_SCHEMAS_ENABLED return(1); #else return(0); #endif case XML_WITH_SCHEMATRON: #ifdef LIBXML_SCHEMATRON_ENABLED return(1); #else return(0); #endif case XML_WITH_MODULES: #ifdef LIBXML_MODULES_ENABLED return(1); #else return(0); #endif case XML_WITH_DEBUG: #ifdef LIBXML_DEBUG_ENABLED return(1); #else return(0); #endif case XML_WITH_DEBUG_MEM: #ifdef DEBUG_MEMORY_LOCATION return(1); #else return(0); #endif case XML_WITH_DEBUG_RUN: #ifdef LIBXML_DEBUG_RUNTIME return(1); #else return(0); #endif case XML_WITH_ZLIB: #ifdef LIBXML_ZLIB_ENABLED return(1); #else return(0); #endif case XML_WITH_LZMA: #ifdef LIBXML_LZMA_ENABLED return(1); #else return(0); #endif case XML_WITH_ICU: #ifdef LIBXML_ICU_ENABLED return(1); #else return(0); #endif default: break; } return(0); } ",0 "void FragmentPaintPropertyTreeBuilder::UpdateSvgLocalToBorderBoxTransform() { DCHECK(properties_); if (!object_.IsSVGRoot()) return; if (NeedsPaintPropertyUpdate()) { AffineTransform transform_to_border_box = SVGRootPainter(ToLayoutSVGRoot(object_)) .TransformToPixelSnappedBorderBox(context_.current.paint_offset); if (!transform_to_border_box.IsIdentity() && NeedsSVGLocalToBorderBoxTransform(object_)) { OnUpdate(properties_->UpdateSvgLocalToBorderBoxTransform( context_.current.transform, TransformPaintPropertyNode::State{transform_to_border_box})); } else { OnClear(properties_->ClearSvgLocalToBorderBoxTransform()); } } if (properties_->SvgLocalToBorderBoxTransform()) { context_.current.transform = properties_->SvgLocalToBorderBoxTransform(); context_.current.should_flatten_inherited_transform = false; context_.current.rendering_context_id = 0; } context_.current.paint_offset = LayoutPoint(); } ",1 "const LayerTreeSettings& LayerTreeHost::GetSettings() const { return settings_; } ",0 "virDomainMigratePrepare(virConnectPtr dconn, char **cookie, int *cookielen, const char *uri_in, char **uri_out, unsigned long flags, const char *dname, unsigned long bandwidth) { VIR_DEBUG(""dconn=%p, cookie=%p, cookielen=%p, uri_in=%s, uri_out=%p, "" ""flags=%lx, dname=%s, bandwidth=%lu"", dconn, cookie, cookielen, NULLSTR(uri_in), uri_out, flags, NULLSTR(dname), bandwidth); virResetLastError(); virCheckConnectReturn(dconn, -1); virCheckReadOnlyGoto(dconn->flags, error); if (dconn->driver->domainMigratePrepare) { int ret; ret = dconn->driver->domainMigratePrepare(dconn, cookie, cookielen, uri_in, uri_out, flags, dname, bandwidth); if (ret < 0) goto error; return ret; } virReportUnsupportedError(); error: virDispatchError(dconn); return -1; } ",0 "PlatformFileHandle openFile(const String& path, FileOpenMode mode) { DWORD desiredAccess = 0; DWORD creationDisposition = 0; switch (mode) { case OpenForRead: desiredAccess = GENERIC_READ; creationDisposition = OPEN_EXISTING; break; case OpenForWrite: desiredAccess = GENERIC_WRITE; creationDisposition = CREATE_ALWAYS; break; default: ASSERT_NOT_REACHED(); } String destination = path; return CreateFile(destination.charactersWithNullTermination(), desiredAccess, 0, 0, creationDisposition, FILE_ATTRIBUTE_NORMAL, 0); } ",0 "gfx::ImageSkia NewTabButton::GetImageForScale( ui::ScaleFactor scale_factor) const { if (!hover_animation_->is_animating()) return GetImageForState(state(), scale_factor); return gfx::ImageSkiaOperations::CreateBlendedImage( GetImageForState(views::CustomButton::STATE_NORMAL, scale_factor), GetImageForState(views::CustomButton::STATE_HOVERED, scale_factor), hover_animation_->GetCurrentValue()); } ",0 "PassRefPtr WebFrameLoaderClient::createFrame( const KURL& url, const String& name, HTMLFrameOwnerElement* owner_element, const String& referrer, bool allows_scrolling, int margin_width, int margin_height) { FrameLoadRequest frame_request(ResourceRequest(url, referrer), name); return webframe_->CreateChildFrame(frame_request, owner_element); } ",0 "int OBJ_txt2nid(const char *s) { ASN1_OBJECT *obj; int nid; obj = OBJ_txt2obj(s, 0); nid = OBJ_obj2nid(obj); ASN1_OBJECT_free(obj); return nid; } ",0 "broke_oneline (char *oneline, char *parray[]) { char *pt, *ppt; int i; i = 0; ppt = pt = oneline + 1; while ((pt = strchr (pt, '/'))) { *pt = 0; parray[i++] = ppt; ppt = ++pt; } parray[i++] = ppt; parray[i] = NULL; } ",0 "bool SplitStringIntoKeyValues( const std::string& line, char key_value_delimiter, std::string* key, std::vector* values) { key->clear(); values->clear(); size_t end_key_pos = line.find_first_of(key_value_delimiter); if (end_key_pos == std::string::npos) { DVLOG(1) << ""cannot parse key from line: "" << line; return false; // no key } key->assign(line, 0, end_key_pos); std::string remains(line, end_key_pos, line.size() - end_key_pos); size_t begin_values_pos = remains.find_first_not_of(key_value_delimiter); if (begin_values_pos == std::string::npos) { DVLOG(1) << ""cannot parse value from line: "" << line; return false; // no value } std::string values_string(remains, begin_values_pos, remains.size() - begin_values_pos); values->push_back(values_string); return true; } ",0 "void MediaPlayerService::AudioOutput::setAudioStreamType(audio_stream_type_t streamType) { Mutex::Autolock lock(mLock); if (mAttributes == NULL) { mStreamType = streamType; } } ",0 "void V8TestObject::OctetAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_octetAttribute_Getter""); test_object_v8_internal::OctetAttributeAttributeGetter(info); } ",0 "DownloadItemImpl::DownloadItemImpl( DownloadItemImplDelegate* delegate, const std::string& guid, uint32_t download_id, const base::FilePath& current_path, const base::FilePath& target_path, const std::vector& url_chain, const GURL& referrer_url, const GURL& site_url, const GURL& tab_url, const GURL& tab_refererr_url, const std::string& mime_type, const std::string& original_mime_type, base::Time start_time, base::Time end_time, const std::string& etag, const std::string& last_modified, int64_t received_bytes, int64_t total_bytes, const std::string& hash, DownloadItem::DownloadState state, DownloadDangerType danger_type, DownloadInterruptReason interrupt_reason, bool opened, base::Time last_access_time, bool transient, const std::vector& received_slices) : request_info_(url_chain, referrer_url, site_url, tab_url, tab_refererr_url, std::string(), base::FilePath(), ui::PAGE_TRANSITION_LINK, false, std::string(), start_time), guid_(guid), download_id_(download_id), mime_type_(mime_type), original_mime_type_(original_mime_type), total_bytes_(total_bytes), last_reason_(interrupt_reason), start_tick_(base::TimeTicks()), state_(ExternalToInternalState(state)), danger_type_(danger_type), delegate_(delegate), opened_(opened), last_access_time_(last_access_time), transient_(transient), destination_info_(target_path, current_path, received_bytes, state == COMPLETE, hash, end_time), last_modified_time_(last_modified), etag_(etag), received_slices_(received_slices), is_updating_observers_(false), weak_ptr_factory_(this) { delegate_->Attach(); DCHECK(state_ == COMPLETE_INTERNAL || state_ == INTERRUPTED_INTERNAL || state_ == CANCELLED_INTERNAL); DCHECK(base::IsValidGUID(guid_)); Init(false /* not actively downloading */, TYPE_HISTORY_IMPORT); } ",0 "bool ShouldCoalesceMouseWheelEvents(const WebMouseWheelEvent& last_event, const WebMouseWheelEvent& new_event) { return last_event.modifiers == new_event.modifiers && last_event.scrollByPage == new_event.scrollByPage && last_event.hasPreciseScrollingDeltas == new_event.hasPreciseScrollingDeltas && last_event.phase == new_event.phase && last_event.momentumPhase == new_event.momentumPhase; } ",0 "GapRects LayoutBlockFlow::selectionGaps(const LayoutBlock* rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& lastLogicalRight, const PaintInfo* paintInfo, ClipScope* clipScope) const { if (clipScope) { LayoutRect flippedBlockRect(LayoutPoint(offsetFromRootBlock), size()); rootBlock->flipForWritingMode(flippedBlockRect); flippedBlockRect.moveBy(rootBlockPhysicalPosition); clipOutPositionedObjects(*clipScope, flippedBlockRect.location(), positionedObjects()); if (isBody() || isDocumentElement()) // The must make sure to examine its containingBlock's positioned objects. for (LayoutBlock* cb = containingBlock(); cb && !cb->isLayoutView(); cb = cb->containingBlock()) clipOutPositionedObjects(*clipScope, cb->location(), cb->positionedObjects()); // FIXME: Not right for flipped writing modes. clipOutFloatingObjects(rootBlock, *clipScope, rootBlockPhysicalPosition, offsetFromRootBlock); } GapRects result; if (hasTransformRelatedProperty() || style()->columnSpan()) return result; if (childrenInline()) result = inlineSelectionGaps(rootBlock, rootBlockPhysicalPosition, offsetFromRootBlock, lastLogicalTop, lastLogicalLeft, lastLogicalRight, paintInfo); else result = blockSelectionGaps(rootBlock, rootBlockPhysicalPosition, offsetFromRootBlock, lastLogicalTop, lastLogicalLeft, lastLogicalRight, paintInfo); if (rootBlock == this && (selectionState() != SelectionBoth && selectionState() != SelectionEnd)) { result.uniteCenter(blockSelectionGap(rootBlock, rootBlockPhysicalPosition, offsetFromRootBlock, lastLogicalTop, lastLogicalLeft, lastLogicalRight, logicalHeight(), paintInfo)); } return result; } ",0 "BrowserViewRenderer::BrowserViewRenderer( BrowserViewRendererClient* client, const scoped_refptr& ui_task_runner) : client_(client), shared_renderer_state_(ui_task_runner, this), ui_task_runner_(ui_task_runner), compositor_(NULL), is_paused_(false), view_visible_(false), window_visible_(false), attached_to_window_(false), hardware_enabled_(false), dip_scale_(0.0), page_scale_factor_(1.0), on_new_picture_enable_(false), clear_view_(false), offscreen_pre_raster_(false), fallback_tick_pending_(false) { } ",0 "static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) { struct vcpu_vmx *vmx = to_vmx(vcpu); struct shared_msr_entry *msr; int ret = 0; u32 msr_index = msr_info->index; u64 data = msr_info->data; switch (msr_index) { case MSR_EFER: ret = kvm_set_msr_common(vcpu, msr_info); break; #ifdef CONFIG_X86_64 case MSR_FS_BASE: vmx_segment_cache_clear(vmx); vmcs_writel(GUEST_FS_BASE, data); break; case MSR_GS_BASE: vmx_segment_cache_clear(vmx); vmcs_writel(GUEST_GS_BASE, data); break; case MSR_KERNEL_GS_BASE: vmx_load_host_state(vmx); vmx->msr_guest_kernel_gs_base = data; break; #endif case MSR_IA32_SYSENTER_CS: vmcs_write32(GUEST_SYSENTER_CS, data); break; case MSR_IA32_SYSENTER_EIP: vmcs_writel(GUEST_SYSENTER_EIP, data); break; case MSR_IA32_SYSENTER_ESP: vmcs_writel(GUEST_SYSENTER_ESP, data); break; case MSR_IA32_BNDCFGS: if (!kvm_mpx_supported()) return 1; vmcs_write64(GUEST_BNDCFGS, data); break; case MSR_IA32_TSC: kvm_write_tsc(vcpu, msr_info); break; case MSR_IA32_CR_PAT: if (vmcs_config.vmentry_ctrl & VM_ENTRY_LOAD_IA32_PAT) { if (!kvm_mtrr_valid(vcpu, MSR_IA32_CR_PAT, data)) return 1; vmcs_write64(GUEST_IA32_PAT, data); vcpu->arch.pat = data; break; } ret = kvm_set_msr_common(vcpu, msr_info); break; case MSR_IA32_TSC_ADJUST: ret = kvm_set_msr_common(vcpu, msr_info); break; case MSR_IA32_FEATURE_CONTROL: if (!nested_vmx_allowed(vcpu) || (to_vmx(vcpu)->nested.msr_ia32_feature_control & FEATURE_CONTROL_LOCKED && !msr_info->host_initiated)) return 1; vmx->nested.msr_ia32_feature_control = data; if (msr_info->host_initiated && data == 0) vmx_leave_nested(vcpu); break; case MSR_IA32_VMX_BASIC ... MSR_IA32_VMX_VMFUNC: return 1; /* they are read-only */ case MSR_IA32_XSS: if (!vmx_xsaves_supported()) return 1; /* * The only supported bit as of Skylake is bit 8, but * it is not supported on KVM. */ if (data != 0) return 1; vcpu->arch.ia32_xss = data; if (vcpu->arch.ia32_xss != host_xss) add_atomic_switch_msr(vmx, MSR_IA32_XSS, vcpu->arch.ia32_xss, host_xss); else clear_atomic_switch_msr(vmx, MSR_IA32_XSS); break; case MSR_TSC_AUX: if (!guest_cpuid_has_rdtscp(vcpu) && !msr_info->host_initiated) return 1; /* Check reserved bit, higher 32 bits should be zero */ if ((data >> 32) != 0) return 1; /* Otherwise falls through */ default: msr = find_msr_entry(vmx, msr_index); if (msr) { u64 old_msr_data = msr->data; msr->data = data; if (msr - vmx->guest_msrs < vmx->save_nmsrs) { preempt_disable(); ret = kvm_set_shared_msr(msr->index, msr->data, msr->mask); preempt_enable(); if (ret) msr->data = old_msr_data; } break; } ret = kvm_set_msr_common(vcpu, msr_info); } return ret; } ",0 "AffineTransform LayoutSVGResourceMarker::markerTransformation(const FloatPoint& origin, float autoAngle, float strokeWidth) const { float markerScale = markerUnits() == SVGMarkerUnitsStrokeWidth ? strokeWidth : 1; AffineTransform transform; transform.translate(origin.x(), origin.y()); transform.rotate(orientType() == SVGMarkerOrientAngle ? angle() : autoAngle); transform.scale(markerScale); FloatPoint mappedReferencePoint = viewportTransform().mapPoint(referencePoint()); transform.translate(-mappedReferencePoint.x(), -mappedReferencePoint.y()); return transform; } ",0 "static MagickBooleanType ForwardFourierTransform(FourierInfo *fourier_info, const Image *image,double *magnitude_pixels,double *phase_pixels, ExceptionInfo *exception) { CacheView *image_view; const char *value; double *source_pixels; fftw_complex *forward_pixels; fftw_plan fftw_r2c_plan; MemoryInfo *forward_info, *source_info; register const IndexPacket *indexes; register const PixelPacket *p; register ssize_t i, x; ssize_t y; /* Generate the forward Fourier transform. */ source_info=AcquireVirtualMemory((size_t) fourier_info->width, fourier_info->height*sizeof(*source_pixels)); if (source_info == (MemoryInfo *) NULL) { (void) ThrowMagickException(exception,GetMagickModule(), ResourceLimitError,""MemoryAllocationFailed"",""`%s'"",image->filename); return(MagickFalse); } source_pixels=(double *) GetVirtualMemoryBlob(source_info); memset(source_pixels,0,fourier_info->width*fourier_info->height* sizeof(*source_pixels)); i=0L; image_view=AcquireVirtualCacheView(image,exception); for (y=0L; y < (ssize_t) fourier_info->height; y++) { p=GetCacheViewVirtualPixels(image_view,0L,y,fourier_info->width,1UL, exception); if (p == (const PixelPacket *) NULL) break; indexes=GetCacheViewVirtualIndexQueue(image_view); for (x=0L; x < (ssize_t) fourier_info->width; x++) { switch (fourier_info->channel) { case RedChannel: default: { source_pixels[i]=QuantumScale*GetPixelRed(p); break; } case GreenChannel: { source_pixels[i]=QuantumScale*GetPixelGreen(p); break; } case BlueChannel: { source_pixels[i]=QuantumScale*GetPixelBlue(p); break; } case OpacityChannel: { source_pixels[i]=QuantumScale*GetPixelOpacity(p); break; } case IndexChannel: { source_pixels[i]=QuantumScale*GetPixelIndex(indexes+x); break; } case GrayChannels: { source_pixels[i]=QuantumScale*GetPixelGray(p); break; } } i++; p++; } } image_view=DestroyCacheView(image_view); forward_info=AcquireVirtualMemory((size_t) fourier_info->width, (fourier_info->height/2+1)*sizeof(*forward_pixels)); if (forward_info == (MemoryInfo *) NULL) { (void) ThrowMagickException(exception,GetMagickModule(), ResourceLimitError,""MemoryAllocationFailed"",""`%s'"",image->filename); source_info=(MemoryInfo *) RelinquishVirtualMemory(source_info); return(MagickFalse); } forward_pixels=(fftw_complex *) GetVirtualMemoryBlob(forward_info); #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp critical (MagickCore_ForwardFourierTransform) #endif fftw_r2c_plan=fftw_plan_dft_r2c_2d(fourier_info->width,fourier_info->height, source_pixels,forward_pixels,FFTW_ESTIMATE); fftw_execute_dft_r2c(fftw_r2c_plan,source_pixels,forward_pixels); fftw_destroy_plan(fftw_r2c_plan); source_info=(MemoryInfo *) RelinquishVirtualMemory(source_info); value=GetImageArtifact(image,""fourier:normalize""); if ((value == (const char *) NULL) || (LocaleCompare(value,""forward"") == 0)) { double gamma; /* Normalize Fourier transform. */ i=0L; gamma=PerceptibleReciprocal((double) fourier_info->width* fourier_info->height); for (y=0L; y < (ssize_t) fourier_info->height; y++) for (x=0L; x < (ssize_t) fourier_info->center; x++) { #if defined(MAGICKCORE_HAVE_COMPLEX_H) forward_pixels[i]*=gamma; #else forward_pixels[i][0]*=gamma; forward_pixels[i][1]*=gamma; #endif i++; } } /* Generate magnitude and phase (or real and imaginary). */ i=0L; if (fourier_info->modulus != MagickFalse) for (y=0L; y < (ssize_t) fourier_info->height; y++) for (x=0L; x < (ssize_t) fourier_info->center; x++) { magnitude_pixels[i]=cabs(forward_pixels[i]); phase_pixels[i]=carg(forward_pixels[i]); i++; } else for (y=0L; y < (ssize_t) fourier_info->height; y++) for (x=0L; x < (ssize_t) fourier_info->center; x++) { magnitude_pixels[i]=creal(forward_pixels[i]); phase_pixels[i]=cimag(forward_pixels[i]); i++; } forward_info=(MemoryInfo *) RelinquishVirtualMemory(forward_info); return(MagickTrue); } ",0 "void WebPagePrivate::updateDelegatedOverlays(bool dispatched) { if (dispatched) m_updateDelegatedOverlaysDispatched = false; else if (m_updateDelegatedOverlaysDispatched) { return; } if (Platform::webKitThreadMessageClient()->isCurrentThread()) { if (m_selectionHandler->isSelectionActive()) m_selectionHandler->selectionPositionChanged(); if (m_inspectorOverlay) m_inspectorOverlay->update(); } else if (m_selectionHandler->isSelectionActive()) { m_updateDelegatedOverlaysDispatched = true; Platform::webKitThreadMessageClient()->dispatchMessage(Platform::createMethodCallMessage(&WebPagePrivate::updateDelegatedOverlays, this, true /*dispatched*/)); } } ",0 "bool RenderWidgetHostViewAura::DeleteRange(const gfx::Range& range) { NOTIMPLEMENTED(); return false; } ",0 "static unsigned char *ExpandBuffer(unsigned char *pixels, MagickSizeType *bytes_per_line,const unsigned int bits_per_pixel) { register ssize_t i; register unsigned char *p, *q; static unsigned char scanline[8*256]; p=pixels; q=scanline; switch (bits_per_pixel) { case 8: case 16: case 32: return(pixels); case 4: { for (i=0; i < (ssize_t) *bytes_per_line; i++) { *q++=(*p >> 4) & 0xff; *q++=(*p & 15); p++; } *bytes_per_line*=2; break; } case 2: { for (i=0; i < (ssize_t) *bytes_per_line; i++) { *q++=(*p >> 6) & 0x03; *q++=(*p >> 4) & 0x03; *q++=(*p >> 2) & 0x03; *q++=(*p & 3); p++; } *bytes_per_line*=4; break; } case 1: { for (i=0; i < (ssize_t) *bytes_per_line; i++) { *q++=(*p >> 7) & 0x01; *q++=(*p >> 6) & 0x01; *q++=(*p >> 5) & 0x01; *q++=(*p >> 4) & 0x01; *q++=(*p >> 3) & 0x01; *q++=(*p >> 2) & 0x01; *q++=(*p >> 1) & 0x01; *q++=(*p & 0x01); p++; } *bytes_per_line*=8; break; } default: break; } return(scanline); } ",0 "bool PrintWebViewHelper::CopyMetafileDataToSharedMem( printing::Metafile* metafile, base::SharedMemoryHandle* shared_mem_handle) { uint32 buf_size = metafile->GetDataSize(); base::SharedMemoryHandle mem_handle = content::RenderThread::Get()->HostAllocateSharedMemoryBuffer(buf_size); if (base::SharedMemory::IsHandleValid(mem_handle)) { base::SharedMemory shared_buf(mem_handle, false); if (shared_buf.Map(buf_size)) { metafile->GetData(shared_buf.memory(), buf_size); shared_buf.GiveToProcess(base::GetCurrentProcessHandle(), shared_mem_handle); return true; } } NOTREACHED(); return false; } ",0 "static u8 nfc_llcp_ssap(struct sk_buff *pdu) { return pdu->data[1] & 0x3f; } ",0 " std::string DistillerNativeJavaScript::DistillerEcho( const std::string& message) { EnsureServiceConnected(); distiller_js_service_->HandleDistillerEchoCall(message); return message; } ",0 "int tls1_heartbeat(SSL *s) { unsigned char *buf, *p; int ret; unsigned int payload = 18; /* Sequence number + random bytes */ unsigned int padding = 16; /* Use minimum padding */ /* Only send if peer supports and accepts HB requests... */ if (!(s->tlsext_heartbeat & SSL_TLSEXT_HB_ENABLED) || s->tlsext_heartbeat & SSL_TLSEXT_HB_DONT_SEND_REQUESTS) { SSLerr(SSL_F_TLS1_HEARTBEAT, SSL_R_TLS_HEARTBEAT_PEER_DOESNT_ACCEPT); return -1; } /* ...and there is none in flight yet... */ if (s->tlsext_hb_pending) { SSLerr(SSL_F_TLS1_HEARTBEAT, SSL_R_TLS_HEARTBEAT_PENDING); return -1; } /* ...and no handshake in progress. */ if (SSL_in_init(s) || s->in_handshake) { SSLerr(SSL_F_TLS1_HEARTBEAT, SSL_R_UNEXPECTED_MESSAGE); return -1; } /* * Check if padding is too long, payload and padding must not exceed 2^14 * - 3 = 16381 bytes in total. */ OPENSSL_assert(payload + padding <= 16381); /*- * Create HeartBeat message, we just use a sequence number * as payload to distuingish different messages and add * some random stuff. * - Message Type, 1 byte * - Payload Length, 2 bytes (unsigned int) * - Payload, the sequence number (2 bytes uint) * - Payload, random bytes (16 bytes uint) * - Padding */ buf = OPENSSL_malloc(1 + 2 + payload + padding); p = buf; /* Message Type */ *p++ = TLS1_HB_REQUEST; /* Payload length (18 bytes here) */ s2n(payload, p); /* Sequence number */ s2n(s->tlsext_hb_seq, p); /* 16 random bytes */ RAND_pseudo_bytes(p, 16); p += 16; /* Random padding */ RAND_pseudo_bytes(p, padding); ret = ssl3_write_bytes(s, TLS1_RT_HEARTBEAT, buf, 3 + payload + padding); if (ret >= 0) { if (s->msg_callback) s->msg_callback(1, s->version, TLS1_RT_HEARTBEAT, buf, 3 + payload + padding, s, s->msg_callback_arg); s->tlsext_hb_pending = 1; } OPENSSL_free(buf); return ret; } ",0 "void dtls1_stop_timer(SSL *s) { /* Reset everything */ memset(&(s->d1->timeout), 0, sizeof(struct dtls1_timeout_st)); memset(&(s->d1->next_timeout), 0, sizeof(struct timeval)); s->d1->timeout_duration = 1; BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT, 0, &(s->d1->next_timeout)); /* Clear retransmission buffer */ dtls1_clear_record_buffer(s); } ",0 "static inline u16 llc_ui_next_link_no(int sap) { return llc_ui_sap_link_no_max[sap]++; } ",0 "static void http_log(const char *fmt, ...) { va_list vargs; va_start(vargs, fmt); http_vlog(fmt, vargs); va_end(vargs); } ",0 "DGAProcessKeyboardEvent(ScreenPtr pScreen, DGAEvent * event, DeviceIntPtr keybd) { KeyClassPtr keyc = keybd->key; DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); DeviceIntPtr pointer = GetMaster(keybd, POINTER_OR_FLOAT); DeviceEvent ev = { .header = ET_Internal, .length = sizeof(ev), .detail.key = event->detail, .type = event->subtype, .root_x = 0, .root_y = 0, .corestate = XkbStateFieldFromRec(&keyc->xkbInfo->state) }; ev.corestate |= pointer->button->state; UpdateDeviceState(keybd, &ev); if (!IsMaster(keybd)) return; /* * Deliver the DGA event */ if (pScreenPriv->client) { dgaEvent de = { .u.event.time = event->time, .u.event.dx = event->dx, .u.event.dy = event->dy, .u.event.screen = pScreen->myNum, .u.event.state = ev.corestate }; de.u.u.type = DGAEventBase + GetCoreType(ev.type); de.u.u.detail = event->detail; /* If the DGA client has selected input, then deliver based on the usual filter */ TryClientEvents(pScreenPriv->client, keybd, (xEvent *) &de, 1, filters[ev.type], pScreenPriv->input, 0); } else { /* If the keyboard is actively grabbed, deliver a grabbed core event */ if (keybd->deviceGrab.grab && !keybd->deviceGrab.fromPassiveGrab) { ev.detail.key = event->detail; ev.time = event->time; ev.root_x = event->dx; ev.root_y = event->dy; ev.corestate = event->state; ev.deviceid = keybd->id; DeliverGrabbedEvent((InternalEvent *) &ev, keybd, FALSE); } } } ",0 "static void nfs4_init_channel_attrs(struct nfs41_create_session_args *args) { struct nfs4_session *session = args->client->cl_session; unsigned int mxrqst_sz = session->fc_attrs.max_rqst_sz, mxresp_sz = session->fc_attrs.max_resp_sz; if (mxrqst_sz == 0) mxrqst_sz = NFS_MAX_FILE_IO_SIZE; if (mxresp_sz == 0) mxresp_sz = NFS_MAX_FILE_IO_SIZE; /* Fore channel attributes */ args->fc_attrs.max_rqst_sz = mxrqst_sz; args->fc_attrs.max_resp_sz = mxresp_sz; args->fc_attrs.max_ops = NFS4_MAX_OPS; args->fc_attrs.max_reqs = max_session_slots; dprintk(""%s: Fore Channel : max_rqst_sz=%u max_resp_sz=%u "" ""max_ops=%u max_reqs=%u\n"", __func__, args->fc_attrs.max_rqst_sz, args->fc_attrs.max_resp_sz, args->fc_attrs.max_ops, args->fc_attrs.max_reqs); /* Back channel attributes */ args->bc_attrs.max_rqst_sz = PAGE_SIZE; args->bc_attrs.max_resp_sz = PAGE_SIZE; args->bc_attrs.max_resp_sz_cached = 0; args->bc_attrs.max_ops = NFS4_MAX_BACK_CHANNEL_OPS; args->bc_attrs.max_reqs = 1; dprintk(""%s: Back Channel : max_rqst_sz=%u max_resp_sz=%u "" ""max_resp_sz_cached=%u max_ops=%u max_reqs=%u\n"", __func__, args->bc_attrs.max_rqst_sz, args->bc_attrs.max_resp_sz, args->bc_attrs.max_resp_sz_cached, args->bc_attrs.max_ops, args->bc_attrs.max_reqs); } ",0 " TestAutofillPopupViewViews(AutofillPopupController* controller, views::Widget* parent_widget) : AutofillPopupViewViews(controller, parent_widget) {} ",0 "void FileSystemOperationRunner::Shutdown() { operations_.clear(); } ",0 "void unmap_mapping_range(struct address_space *mapping, loff_t const holebegin, loff_t const holelen, int even_cows) { struct zap_details details; pgoff_t hba = holebegin >> PAGE_SHIFT; pgoff_t hlen = (holelen + PAGE_SIZE - 1) >> PAGE_SHIFT; /* Check for overflow. */ if (sizeof(holelen) > sizeof(hlen)) { long long holeend = (holebegin + holelen + PAGE_SIZE - 1) >> PAGE_SHIFT; if (holeend & ~(long long)ULONG_MAX) hlen = ULONG_MAX - hba + 1; } details.check_mapping = even_cows? NULL: mapping; details.nonlinear_vma = NULL; details.first_index = hba; details.last_index = hba + hlen - 1; if (details.last_index < details.first_index) details.last_index = ULONG_MAX; mutex_lock(&mapping->i_mmap_mutex); if (unlikely(!RB_EMPTY_ROOT(&mapping->i_mmap))) unmap_mapping_range_tree(&mapping->i_mmap, &details); if (unlikely(!list_empty(&mapping->i_mmap_nonlinear))) unmap_mapping_range_list(&mapping->i_mmap_nonlinear, &details); mutex_unlock(&mapping->i_mmap_mutex); } ",0 "PHP_FUNCTION(openssl_seal) { zval *pubkeys, **pubkey, *sealdata, *ekeys; HashTable *pubkeysht; HashPosition pos; EVP_PKEY **pkeys; long * key_resources; /* so we know what to cleanup */ int i, len1, len2, *eksl, nkeys; unsigned char *buf = NULL, **eks; char * data; int data_len; char *method =NULL; int method_len = 0; const EVP_CIPHER *cipher; EVP_CIPHER_CTX ctx; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""szza/|s"", &data, &data_len, &sealdata, &ekeys, &pubkeys, &method, &method_len) == FAILURE) { return; } pubkeysht = HASH_OF(pubkeys); nkeys = pubkeysht ? zend_hash_num_elements(pubkeysht) : 0; if (!nkeys) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Fourth argument to openssl_seal() must be a non-empty array""); RETURN_FALSE; } if (method) { cipher = EVP_get_cipherbyname(method); if (!cipher) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Unknown signature algorithm.""); RETURN_FALSE; } } else { cipher = EVP_rc4(); } pkeys = safe_emalloc(nkeys, sizeof(*pkeys), 0); eksl = safe_emalloc(nkeys, sizeof(*eksl), 0); eks = safe_emalloc(nkeys, sizeof(*eks), 0); memset(eks, 0, sizeof(*eks) * nkeys); key_resources = safe_emalloc(nkeys, sizeof(long), 0); memset(key_resources, 0, sizeof(*key_resources) * nkeys); /* get the public keys we are using to seal this data */ zend_hash_internal_pointer_reset_ex(pubkeysht, &pos); i = 0; while (zend_hash_get_current_data_ex(pubkeysht, (void **) &pubkey, &pos) == SUCCESS) { pkeys[i] = php_openssl_evp_from_zval(pubkey, 1, NULL, 0, &key_resources[i] TSRMLS_CC); if (pkeys[i] == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""not a public key (%dth member of pubkeys)"", i+1); RETVAL_FALSE; goto clean_exit; } eks[i] = emalloc(EVP_PKEY_size(pkeys[i]) + 1); zend_hash_move_forward_ex(pubkeysht, &pos); i++; } if (!EVP_EncryptInit(&ctx,cipher,NULL,NULL)) { RETVAL_FALSE; goto clean_exit; } #if 0 /* Need this if allow ciphers that require initialization vector */ ivlen = EVP_CIPHER_CTX_iv_length(&ctx); iv = ivlen ? emalloc(ivlen + 1) : NULL; #endif /* allocate one byte extra to make room for \0 */ buf = emalloc(data_len + EVP_CIPHER_CTX_block_size(&ctx)); if (!EVP_SealInit(&ctx, cipher, eks, eksl, NULL, pkeys, nkeys) || !EVP_SealUpdate(&ctx, buf, &len1, (unsigned char *)data, data_len)) { RETVAL_FALSE; efree(buf); goto clean_exit; } EVP_SealFinal(&ctx, buf + len1, &len2); if (len1 + len2 > 0) { zval_dtor(sealdata); buf[len1 + len2] = '\0'; buf = erealloc(buf, len1 + len2 + 1); ZVAL_STRINGL(sealdata, (char *)buf, len1 + len2, 0); zval_dtor(ekeys); array_init(ekeys); for (i=0; ihead)) { if (!skb->cloned || !atomic_dec_return(&(skb_shinfo(skb)->dataref))) vfree(skb->head); skb->head = NULL; } if (skb->sk != NULL) sock_rfree(skb); } ",0 "ModuleExport size_t RegisterFITSImage(void) { MagickInfo *entry; entry=SetMagickInfo(""FITS""); entry->decoder=(DecodeImageHandler *) ReadFITSImage; entry->encoder=(EncodeImageHandler *) WriteFITSImage; entry->magick=(IsImageFormatHandler *) IsFITS; entry->adjoin=MagickFalse; entry->seekable_stream=MagickTrue; entry->description=ConstantString(""Flexible Image Transport System""); entry->module=ConstantString(""FITS""); (void) RegisterMagickInfo(entry); entry=SetMagickInfo(""FTS""); entry->decoder=(DecodeImageHandler *) ReadFITSImage; entry->encoder=(EncodeImageHandler *) WriteFITSImage; entry->magick=(IsImageFormatHandler *) IsFITS; entry->adjoin=MagickFalse; entry->seekable_stream=MagickTrue; entry->description=ConstantString(""Flexible Image Transport System""); entry->module=ConstantString(""FTS""); (void) RegisterMagickInfo(entry); return(MagickImageCoderSignature); } ",0 "void SyncManager::SyncInternal::SetExtraChangeRecordData(int64 id, syncable::ModelType type, ChangeReorderBuffer* buffer, Cryptographer* cryptographer, const syncable::EntryKernel& original, bool existed_before, bool exists_now) { if (!exists_now && existed_before) { sync_pb::EntitySpecifics original_specifics(original.ref(SPECIFICS)); if (type == syncable::PASSWORDS) { scoped_ptr data( DecryptPasswordSpecifics(original_specifics, cryptographer)); if (!data.get()) { NOTREACHED(); return; } buffer->SetExtraDataForId(id, new ExtraPasswordChangeRecordData(*data)); } else if (original_specifics.has_encrypted()) { const sync_pb::EncryptedData& encrypted = original_specifics.encrypted(); if (!cryptographer->Decrypt(encrypted, &original_specifics)) { NOTREACHED(); return; } } buffer->SetSpecificsForId(id, original_specifics); } } ",0 "void DisableDetectFlowFileFlags(Flow *f) { DetectPostInspectFileFlagsUpdate(f, NULL /* no sgh */, STREAM_TOSERVER); DetectPostInspectFileFlagsUpdate(f, NULL /* no sgh */, STREAM_TOCLIENT); } ",0 "void RenderView::DestroyFakePluginWindowHandle(gfx::PluginWindowHandle window) { if (window) Send(new ViewHostMsg_DestroyFakePluginWindowHandle(routing_id(), window)); } ",0 "void PrintWebViewHelper::GetPageSizeAndMarginsInPoints( WebFrame* frame, int page_index, const PrintMsg_Print_Params& default_params, PageSizeMargins* page_layout_in_points) { int dpi = GetDPI(&default_params); WebSize page_size_in_pixels( ConvertUnit(default_params.page_size.width(), dpi, printing::kPixelsPerInch), ConvertUnit(default_params.page_size.height(), dpi, printing::kPixelsPerInch)); int margin_top_in_pixels = ConvertUnit( default_params.margin_top, dpi, printing::kPixelsPerInch); int margin_right_in_pixels = ConvertUnit( default_params.page_size.width() - default_params.printable_size.width() - default_params.margin_left, dpi, printing::kPixelsPerInch); int margin_bottom_in_pixels = ConvertUnit( default_params.page_size.height() - default_params.printable_size.height() - default_params.margin_top, dpi, printing::kPixelsPerInch); int margin_left_in_pixels = ConvertUnit( default_params.margin_left, dpi, printing::kPixelsPerInch); if (frame) { frame->pageSizeAndMarginsInPixels(page_index, page_size_in_pixels, margin_top_in_pixels, margin_right_in_pixels, margin_bottom_in_pixels, margin_left_in_pixels); } page_layout_in_points->content_width = ConvertPixelsToPoint(page_size_in_pixels.width - margin_left_in_pixels - margin_right_in_pixels); page_layout_in_points->content_height = ConvertPixelsToPoint(page_size_in_pixels.height - margin_top_in_pixels - margin_bottom_in_pixels); if (page_layout_in_points->content_width < 1.0 || page_layout_in_points->content_height < 1.0) { CHECK(frame != NULL); GetPageSizeAndMarginsInPoints(NULL, page_index, default_params, page_layout_in_points); return; } page_layout_in_points->margin_top = ConvertPixelsToPointDouble(margin_top_in_pixels); page_layout_in_points->margin_right = ConvertPixelsToPointDouble(margin_right_in_pixels); page_layout_in_points->margin_bottom = ConvertPixelsToPointDouble(margin_bottom_in_pixels); page_layout_in_points->margin_left = ConvertPixelsToPointDouble(margin_left_in_pixels); } ",0 "void V8TestObject::ShortMethodMethodCallback(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_shortMethod""); test_object_v8_internal::ShortMethodMethod(info); } ",0 "void RenderWidgetHostImpl::PaintAtSize(TransportDIB::Handle dib_handle, int tag, const gfx::Size& page_size, const gfx::Size& desired_size) { Send(new ViewMsg_PaintAtSize(routing_id_, dib_handle, tag, page_size, desired_size)); } ",0 "static NPError g_NPP_New(NPMIMEType plugin_type, uint32_t instance_id, uint16_t mode, int16_t argc, char *argn[], char *argv[], NPSavedData *saved) { PluginInstance *plugin = npw_plugin_instance_new(&PluginInstanceClass); if (plugin == NULL) return NPERR_OUT_OF_MEMORY_ERROR; plugin->instance_id = instance_id; id_link(instance_id, plugin); NPP instance = malloc(sizeof(*instance)); if (instance == NULL) return NPERR_OUT_OF_MEMORY_ERROR; memset(instance, 0, sizeof(*instance)); instance->ndata = plugin; plugin->instance = instance; for (int i = 0; i < argc; i++) { if (argn[i] == NULL) continue; if (strcasecmp(argn[i], ""width"") == 0) { if (i < argc && argv[i]) plugin->width = atoi(argv[i]); } else if (strcasecmp(argn[i], ""height"") == 0) { if (i < argc && argv[i]) plugin->height = atoi(argv[i]); } } D(bugiI(""NPP_New instance=%p\n"", instance)); NPError ret = plugin_funcs.newp(plugin_type, instance, mode, argc, argn, argv, saved); D(bugiD(""NPP_New return: %d [%s]\n"", ret, string_of_NPError(ret))); long supports_XEmbed = FALSE; if (mozilla_funcs.getvalue) { NPError error = mozilla_funcs.getvalue(NULL, NPNVSupportsXEmbedBool, (void *)&supports_XEmbed); if (error == NPERR_NO_ERROR && plugin_funcs.getvalue) { long needs_XEmbed = FALSE; error = plugin_funcs.getvalue(instance, NPPVpluginNeedsXEmbed, (void *)&needs_XEmbed); if (error == NPERR_NO_ERROR) plugin->use_xembed = supports_XEmbed && needs_XEmbed; } } if (!plugin->use_xembed) { if (xt_source_create() < 0) return NPERR_GENERIC_ERROR; } return ret; } ",0 "static void ip_copy_addrs(struct iphdr *iph, const struct flowi4 *fl4) { BUILD_BUG_ON(offsetof(typeof(*fl4), daddr) != offsetof(typeof(*fl4), saddr) + sizeof(fl4->saddr)); memcpy(&iph->saddr, &fl4->saddr, sizeof(fl4->saddr) + sizeof(fl4->daddr)); } ",0 "int dm_hold(struct mapped_device *md) { spin_lock(&_minor_lock); if (test_bit(DMF_FREEING, &md->flags)) { spin_unlock(&_minor_lock); return -EBUSY; } dm_get(md); spin_unlock(&_minor_lock); return 0; } ",0 "void RenderView::OnResize(const gfx::Size& new_size, const gfx::Rect& resizer_rect) { if (webview()) { webview()->hidePopups(); if (send_preferred_size_changes_) { webview()->mainFrame()->setCanHaveScrollbars( should_display_scrollbars(new_size.width(), new_size.height())); } } RenderWidget::OnResize(new_size, resizer_rect); } ",0 "static inline void ModulateLCHab(const double percent_luma, const double percent_chroma,const double percent_hue,double *red, double *green,double *blue) { double hue, luma, chroma; /* Increase or decrease color luma, chroma, or hue. */ ConvertRGBToLCHab(*red,*green,*blue,&luma,&chroma,&hue); luma*=0.01*percent_luma; chroma*=0.01*percent_chroma; hue+=fmod((percent_hue-100.0),200.0)/200.0; ConvertLCHabToRGB(luma,chroma,hue,red,green,blue); } ",0 "bool FakeCentral::IsPresent() const { switch (state_) { case mojom::CentralState::ABSENT: return false; case mojom::CentralState::POWERED_OFF: case mojom::CentralState::POWERED_ON: return true; } NOTREACHED(); return false; } ",0 "void hci_send_to_control(struct sk_buff *skb, struct sock *skip_sk) { struct sock *sk; BT_DBG(""len %d"", skb->len); read_lock(&hci_sk_list.lock); sk_for_each(sk, &hci_sk_list.head) { struct sk_buff *nskb; /* Skip the original socket */ if (sk == skip_sk) continue; if (sk->sk_state != BT_BOUND) continue; if (hci_pi(sk)->channel != HCI_CHANNEL_CONTROL) continue; nskb = skb_clone(skb, GFP_ATOMIC); if (!nskb) continue; if (sock_queue_rcv_skb(sk, nskb)) kfree_skb(nskb); } read_unlock(&hci_sk_list.lock); } ",0 "ResourcePtr ResourceFetcher::fetchSVGDocument(FetchRequest& request) { return toDocumentResource(requestResource(Resource::SVGDocument, request)); } ",0 "bool ACodec::BaseState::onOMXFrameRendered( int64_t mediaTimeUs __unused, nsecs_t systemNano __unused) { return true; } ",0 "rx_print(netdissect_options *ndo, register const u_char *bp, int length, int sport, int dport, const u_char *bp2) { register const struct rx_header *rxh; int i; int32_t opcode; if (ndo->ndo_snapend - bp < (int)sizeof (struct rx_header)) { ND_PRINT((ndo, "" [|rx] (%d)"", length)); return; } rxh = (const struct rx_header *) bp; ND_PRINT((ndo, "" rx %s"", tok2str(rx_types, ""type %d"", rxh->type))); if (ndo->ndo_vflag) { int firstflag = 0; if (ndo->ndo_vflag > 1) ND_PRINT((ndo, "" cid %08x call# %d"", (int) EXTRACT_32BITS(&rxh->cid), (int) EXTRACT_32BITS(&rxh->callNumber))); ND_PRINT((ndo, "" seq %d ser %d"", (int) EXTRACT_32BITS(&rxh->seq), (int) EXTRACT_32BITS(&rxh->serial))); if (ndo->ndo_vflag > 2) ND_PRINT((ndo, "" secindex %d serviceid %hu"", (int) rxh->securityIndex, EXTRACT_16BITS(&rxh->serviceId))); if (ndo->ndo_vflag > 1) for (i = 0; i < NUM_RX_FLAGS; i++) { if (rxh->flags & rx_flags[i].flag && (!rx_flags[i].packetType || rxh->type == rx_flags[i].packetType)) { if (!firstflag) { firstflag = 1; ND_PRINT((ndo, "" "")); } else { ND_PRINT((ndo, "","")); } ND_PRINT((ndo, ""<%s>"", rx_flags[i].s)); } } } /* * Try to handle AFS calls that we know about. Check the destination * port and make sure it's a data packet. Also, make sure the * seq number is 1 (because otherwise it's a continuation packet, * and we can't interpret that). Also, seems that reply packets * do not have the client-init flag set, so we check for that * as well. */ if (rxh->type == RX_PACKET_TYPE_DATA && EXTRACT_32BITS(&rxh->seq) == 1 && rxh->flags & RX_CLIENT_INITIATED) { /* * Insert this call into the call cache table, so we * have a chance to print out replies */ rx_cache_insert(ndo, bp, (const struct ip *) bp2, dport); switch (dport) { case FS_RX_PORT: /* AFS file service */ fs_print(ndo, bp, length); break; case CB_RX_PORT: /* AFS callback service */ cb_print(ndo, bp, length); break; case PROT_RX_PORT: /* AFS protection service */ prot_print(ndo, bp, length); break; case VLDB_RX_PORT: /* AFS VLDB service */ vldb_print(ndo, bp, length); break; case KAUTH_RX_PORT: /* AFS Kerberos auth service */ kauth_print(ndo, bp, length); break; case VOL_RX_PORT: /* AFS Volume service */ vol_print(ndo, bp, length); break; case BOS_RX_PORT: /* AFS BOS service */ bos_print(ndo, bp, length); break; default: ; } /* * If it's a reply (client-init is _not_ set, but seq is one) * then look it up in the cache. If we find it, call the reply * printing functions Note that we handle abort packets here, * because printing out the return code can be useful at times. */ } else if (((rxh->type == RX_PACKET_TYPE_DATA && EXTRACT_32BITS(&rxh->seq) == 1) || rxh->type == RX_PACKET_TYPE_ABORT) && (rxh->flags & RX_CLIENT_INITIATED) == 0 && rx_cache_find(rxh, (const struct ip *) bp2, sport, &opcode)) { switch (sport) { case FS_RX_PORT: /* AFS file service */ fs_reply_print(ndo, bp, length, opcode); break; case CB_RX_PORT: /* AFS callback service */ cb_reply_print(ndo, bp, length, opcode); break; case PROT_RX_PORT: /* AFS PT service */ prot_reply_print(ndo, bp, length, opcode); break; case VLDB_RX_PORT: /* AFS VLDB service */ vldb_reply_print(ndo, bp, length, opcode); break; case KAUTH_RX_PORT: /* AFS Kerberos auth service */ kauth_reply_print(ndo, bp, length, opcode); break; case VOL_RX_PORT: /* AFS Volume service */ vol_reply_print(ndo, bp, length, opcode); break; case BOS_RX_PORT: /* AFS BOS service */ bos_reply_print(ndo, bp, length, opcode); break; default: ; } /* * If it's an RX ack packet, then use the appropriate ack decoding * function (there isn't any service-specific information in the * ack packet, so we can use one for all AFS services) */ } else if (rxh->type == RX_PACKET_TYPE_ACK) rx_ack_print(ndo, bp, length); ND_PRINT((ndo, "" (%d)"", length)); } ",0 "bool blk_mq_can_queue(struct blk_mq_hw_ctx *hctx) { return blk_mq_has_free_tags(hctx->tags); } ",0 "static struct ip_mc_list *igmp_mc_get_idx(struct seq_file *seq, loff_t pos) { struct ip_mc_list *im = igmp_mc_get_first(seq); if (im) while (pos && (im = igmp_mc_get_next(seq, im)) != NULL) --pos; return pos ? NULL : im; } ",0 "PassRefPtr Document::createTreeWalker(Node* root, ExceptionState& es) { if (!root) { es.throwUninformativeAndGenericDOMException(NotSupportedError); return 0; } return TreeWalker::create(root, NodeFilter::SHOW_ALL, PassRefPtr()); } ",0 "static int nf_tables_delsetelem(struct sock *nlsk, struct sk_buff *skb, const struct nlmsghdr *nlh, const struct nlattr * const nla[]) { const struct nlattr *attr; struct nft_set *set; struct nft_ctx ctx; int rem, err = 0; if (nla[NFTA_SET_ELEM_LIST_ELEMENTS] == NULL) return -EINVAL; err = nft_ctx_init_from_elemattr(&ctx, skb, nlh, nla, false); if (err < 0) return err; set = nf_tables_set_lookup(ctx.table, nla[NFTA_SET_ELEM_LIST_SET]); if (IS_ERR(set)) return PTR_ERR(set); if (!list_empty(&set->bindings) && set->flags & NFT_SET_CONSTANT) return -EBUSY; nla_for_each_nested(attr, nla[NFTA_SET_ELEM_LIST_ELEMENTS], rem) { err = nft_del_setelem(&ctx, set, attr); if (err < 0) break; set->nelems--; } return err; } ",0 "name_type_str(int name_type) { const char *f = NULL; switch (name_type) { case 0: f = ""Workstation""; break; case 0x03: f = ""Client?""; break; case 0x20: f = ""Server""; break; case 0x1d: f = ""Master Browser""; break; case 0x1b: f = ""Domain Controller""; break; case 0x1e: f = ""Browser Server""; break; default: f = ""Unknown""; break; } return(f); } ",0 "static void ipv4_link_failure(struct sk_buff *skb) { struct rtable *rt; icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_UNREACH, 0); rt = skb_rtable(skb); if (rt) dst_set_expires(&rt->dst, 0); } ",0 "int __pte_alloc(struct mm_struct *mm, struct vm_area_struct *vma, pmd_t *pmd, unsigned long address) { pgtable_t new = pte_alloc_one(mm, address); int wait_split_huge_page; if (!new) return -ENOMEM; /* * Ensure all pte setup (eg. pte page lock and page clearing) are * visible before the pte is made visible to other CPUs by being * put into page tables. * * The other side of the story is the pointer chasing in the page * table walking code (when walking the page table without locking; * ie. most of the time). Fortunately, these data accesses consist * of a chain of data-dependent loads, meaning most CPUs (alpha * being the notable exception) will already guarantee loads are * seen in-order. See the alpha page table accessors for the * smp_read_barrier_depends() barriers in page table walking code. */ smp_wmb(); /* Could be smp_wmb__xxx(before|after)_spin_lock */ spin_lock(&mm->page_table_lock); wait_split_huge_page = 0; if (likely(pmd_none(*pmd))) { /* Has another populated it ? */ mm->nr_ptes++; pmd_populate(mm, pmd, new); new = NULL; } else if (unlikely(pmd_trans_splitting(*pmd))) wait_split_huge_page = 1; spin_unlock(&mm->page_table_lock); if (new) pte_free(mm, new); if (wait_split_huge_page) wait_split_huge_page(vma->anon_vma, pmd); return 0; } ",0 "set_last_default(struct magic_set *ms, struct magic_entry *me, uint32_t nme) { uint32_t i; for (i = 0; i < nme; i++) { if (me[i].mp->cont_level == 0 && me[i].mp->type == FILE_DEFAULT) { while (++i < nme) if (me[i].mp->cont_level == 0) break; if (i != nme) { /* XXX - Ugh! */ ms->line = me[i].mp->lineno; file_magwarn(ms, ""level 0 \""default\"" did not sort last""); } return; } } } ",0 "static int avi_read_header(AVFormatContext *s) { AVIContext *avi = s->priv_data; AVIOContext *pb = s->pb; unsigned int tag, tag1, handler; int codec_type, stream_index, frame_period; unsigned int size; int i; AVStream *st; AVIStream *ast = NULL; int avih_width = 0, avih_height = 0; int amv_file_format = 0; uint64_t list_end = 0; int64_t pos; int ret; AVDictionaryEntry *dict_entry; avi->stream_index = -1; ret = get_riff(s, pb); if (ret < 0) return ret; av_log(avi, AV_LOG_DEBUG, ""use odml:%d\n"", avi->use_odml); avi->io_fsize = avi->fsize = avio_size(pb); if (avi->fsize <= 0 || avi->fsize < avi->riff_end) avi->fsize = avi->riff_end == 8 ? INT64_MAX : avi->riff_end; /* first list tag */ stream_index = -1; codec_type = -1; frame_period = 0; for (;;) { if (avio_feof(pb)) goto fail; tag = avio_rl32(pb); size = avio_rl32(pb); print_tag(""tag"", tag, size); switch (tag) { case MKTAG('L', 'I', 'S', 'T'): list_end = avio_tell(pb) + size; /* Ignored, except at start of video packets. */ tag1 = avio_rl32(pb); print_tag(""list"", tag1, 0); if (tag1 == MKTAG('m', 'o', 'v', 'i')) { avi->movi_list = avio_tell(pb) - 4; if (size) avi->movi_end = avi->movi_list + size + (size & 1); else avi->movi_end = avi->fsize; av_log(NULL, AV_LOG_TRACE, ""movi end=%""PRIx64""\n"", avi->movi_end); goto end_of_header; } else if (tag1 == MKTAG('I', 'N', 'F', 'O')) ff_read_riff_info(s, size - 4); else if (tag1 == MKTAG('n', 'c', 'd', 't')) avi_read_nikon(s, list_end); break; case MKTAG('I', 'D', 'I', 'T'): { unsigned char date[64] = { 0 }; size += (size & 1); size -= avio_read(pb, date, FFMIN(size, sizeof(date) - 1)); avio_skip(pb, size); avi_metadata_creation_time(&s->metadata, date); break; } case MKTAG('d', 'm', 'l', 'h'): avi->is_odml = 1; avio_skip(pb, size + (size & 1)); break; case MKTAG('a', 'm', 'v', 'h'): amv_file_format = 1; case MKTAG('a', 'v', 'i', 'h'): /* AVI header */ /* using frame_period is bad idea */ frame_period = avio_rl32(pb); avio_rl32(pb); /* max. bytes per second */ avio_rl32(pb); avi->non_interleaved |= avio_rl32(pb) & AVIF_MUSTUSEINDEX; avio_skip(pb, 2 * 4); avio_rl32(pb); avio_rl32(pb); avih_width = avio_rl32(pb); avih_height = avio_rl32(pb); avio_skip(pb, size - 10 * 4); break; case MKTAG('s', 't', 'r', 'h'): /* stream header */ tag1 = avio_rl32(pb); handler = avio_rl32(pb); /* codec tag */ if (tag1 == MKTAG('p', 'a', 'd', 's')) { avio_skip(pb, size - 8); break; } else { stream_index++; st = avformat_new_stream(s, NULL); if (!st) goto fail; st->id = stream_index; ast = av_mallocz(sizeof(AVIStream)); if (!ast) goto fail; st->priv_data = ast; } if (amv_file_format) tag1 = stream_index ? MKTAG('a', 'u', 'd', 's') : MKTAG('v', 'i', 'd', 's'); print_tag(""strh"", tag1, -1); if (tag1 == MKTAG('i', 'a', 'v', 's') || tag1 == MKTAG('i', 'v', 'a', 's')) { int64_t dv_dur; /* After some consideration -- I don't think we * have to support anything but DV in type1 AVIs. */ if (s->nb_streams != 1) goto fail; if (handler != MKTAG('d', 'v', 's', 'd') && handler != MKTAG('d', 'v', 'h', 'd') && handler != MKTAG('d', 'v', 's', 'l')) goto fail; ast = s->streams[0]->priv_data; av_freep(&s->streams[0]->codecpar->extradata); av_freep(&s->streams[0]->codecpar); #if FF_API_LAVF_AVCTX FF_DISABLE_DEPRECATION_WARNINGS av_freep(&s->streams[0]->codec); FF_ENABLE_DEPRECATION_WARNINGS #endif if (s->streams[0]->info) av_freep(&s->streams[0]->info->duration_error); av_freep(&s->streams[0]->info); if (s->streams[0]->internal) av_freep(&s->streams[0]->internal->avctx); av_freep(&s->streams[0]->internal); av_freep(&s->streams[0]); s->nb_streams = 0; if (CONFIG_DV_DEMUXER) { avi->dv_demux = avpriv_dv_init_demux(s); if (!avi->dv_demux) goto fail; } else goto fail; s->streams[0]->priv_data = ast; avio_skip(pb, 3 * 4); ast->scale = avio_rl32(pb); ast->rate = avio_rl32(pb); avio_skip(pb, 4); /* start time */ dv_dur = avio_rl32(pb); if (ast->scale > 0 && ast->rate > 0 && dv_dur > 0) { dv_dur *= AV_TIME_BASE; s->duration = av_rescale(dv_dur, ast->scale, ast->rate); } /* else, leave duration alone; timing estimation in utils.c * will make a guess based on bitrate. */ stream_index = s->nb_streams - 1; avio_skip(pb, size - 9 * 4); break; } av_assert0(stream_index < s->nb_streams); ast->handler = handler; avio_rl32(pb); /* flags */ avio_rl16(pb); /* priority */ avio_rl16(pb); /* language */ avio_rl32(pb); /* initial frame */ ast->scale = avio_rl32(pb); ast->rate = avio_rl32(pb); if (!(ast->scale && ast->rate)) { av_log(s, AV_LOG_WARNING, ""scale/rate is %""PRIu32""/%""PRIu32"" which is invalid. "" ""(This file has been generated by broken software.)\n"", ast->scale, ast->rate); if (frame_period) { ast->rate = 1000000; ast->scale = frame_period; } else { ast->rate = 25; ast->scale = 1; } } avpriv_set_pts_info(st, 64, ast->scale, ast->rate); ast->cum_len = avio_rl32(pb); /* start */ st->nb_frames = avio_rl32(pb); st->start_time = 0; avio_rl32(pb); /* buffer size */ avio_rl32(pb); /* quality */ if (ast->cum_len*ast->scale/ast->rate > 3600) { av_log(s, AV_LOG_ERROR, ""crazy start time, iam scared, giving up\n""); ast->cum_len = 0; } ast->sample_size = avio_rl32(pb); ast->cum_len *= FFMAX(1, ast->sample_size); av_log(s, AV_LOG_TRACE, ""%""PRIu32"" %""PRIu32"" %d\n"", ast->rate, ast->scale, ast->sample_size); switch (tag1) { case MKTAG('v', 'i', 'd', 's'): codec_type = AVMEDIA_TYPE_VIDEO; ast->sample_size = 0; st->avg_frame_rate = av_inv_q(st->time_base); break; case MKTAG('a', 'u', 'd', 's'): codec_type = AVMEDIA_TYPE_AUDIO; break; case MKTAG('t', 'x', 't', 's'): codec_type = AVMEDIA_TYPE_SUBTITLE; break; case MKTAG('d', 'a', 't', 's'): codec_type = AVMEDIA_TYPE_DATA; break; default: av_log(s, AV_LOG_INFO, ""unknown stream type %X\n"", tag1); } if (ast->sample_size < 0) { if (s->error_recognition & AV_EF_EXPLODE) { av_log(s, AV_LOG_ERROR, ""Invalid sample_size %d at stream %d\n"", ast->sample_size, stream_index); goto fail; } av_log(s, AV_LOG_WARNING, ""Invalid sample_size %d at stream %d "" ""setting it to 0\n"", ast->sample_size, stream_index); ast->sample_size = 0; } if (ast->sample_size == 0) { st->duration = st->nb_frames; if (st->duration > 0 && avi->io_fsize > 0 && avi->riff_end > avi->io_fsize) { av_log(s, AV_LOG_DEBUG, ""File is truncated adjusting duration\n""); st->duration = av_rescale(st->duration, avi->io_fsize, avi->riff_end); } } ast->frame_offset = ast->cum_len; avio_skip(pb, size - 12 * 4); break; case MKTAG('s', 't', 'r', 'f'): /* stream header */ if (!size && (codec_type == AVMEDIA_TYPE_AUDIO || codec_type == AVMEDIA_TYPE_VIDEO)) break; if (stream_index >= (unsigned)s->nb_streams || avi->dv_demux) { avio_skip(pb, size); } else { uint64_t cur_pos = avio_tell(pb); unsigned esize; if (cur_pos < list_end) size = FFMIN(size, list_end - cur_pos); st = s->streams[stream_index]; if (st->codecpar->codec_type != AVMEDIA_TYPE_UNKNOWN) { avio_skip(pb, size); break; } switch (codec_type) { case AVMEDIA_TYPE_VIDEO: if (amv_file_format) { st->codecpar->width = avih_width; st->codecpar->height = avih_height; st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; st->codecpar->codec_id = AV_CODEC_ID_AMV; avio_skip(pb, size); break; } tag1 = ff_get_bmp_header(pb, st, &esize); if (tag1 == MKTAG('D', 'X', 'S', 'B') || tag1 == MKTAG('D', 'X', 'S', 'A')) { st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE; st->codecpar->codec_tag = tag1; st->codecpar->codec_id = AV_CODEC_ID_XSUB; break; } if (size > 10 * 4 && size < (1 << 30) && size < avi->fsize) { if (esize == size-1 && (esize&1)) { st->codecpar->extradata_size = esize - 10 * 4; } else st->codecpar->extradata_size = size - 10 * 4; if (st->codecpar->extradata) { av_log(s, AV_LOG_WARNING, ""New extradata in strf chunk, freeing previous one.\n""); av_freep(&st->codecpar->extradata); } if (ff_get_extradata(s, st->codecpar, pb, st->codecpar->extradata_size) < 0) return AVERROR(ENOMEM); } if (st->codecpar->extradata_size & 1) avio_r8(pb); /* Extract palette from extradata if bpp <= 8. * This code assumes that extradata contains only palette. * This is true for all paletted codecs implemented in * FFmpeg. */ if (st->codecpar->extradata_size && (st->codecpar->bits_per_coded_sample <= 8)) { int pal_size = (1 << st->codecpar->bits_per_coded_sample) << 2; const uint8_t *pal_src; pal_size = FFMIN(pal_size, st->codecpar->extradata_size); pal_src = st->codecpar->extradata + st->codecpar->extradata_size - pal_size; /* Exclude the ""BottomUp"" field from the palette */ if (pal_src - st->codecpar->extradata >= 9 && !memcmp(st->codecpar->extradata + st->codecpar->extradata_size - 9, ""BottomUp"", 9)) pal_src -= 9; for (i = 0; i < pal_size / 4; i++) ast->pal[i] = 0xFFU<<24 | AV_RL32(pal_src + 4 * i); ast->has_pal = 1; } print_tag(""video"", tag1, 0); st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; st->codecpar->codec_tag = tag1; st->codecpar->codec_id = ff_codec_get_id(ff_codec_bmp_tags, tag1); /* If codec is not found yet, try with the mov tags. */ if (!st->codecpar->codec_id) { st->codecpar->codec_id = ff_codec_get_id(ff_codec_movvideo_tags, tag1); if (st->codecpar->codec_id) av_log(s, AV_LOG_WARNING, ""mov tag found in avi (fourcc %s)\n"", av_fourcc2str(tag1)); } /* This is needed to get the pict type which is necessary * for generating correct pts. */ st->need_parsing = AVSTREAM_PARSE_HEADERS; if (st->codecpar->codec_id == AV_CODEC_ID_MPEG4 && ast->handler == MKTAG('X', 'V', 'I', 'D')) st->codecpar->codec_tag = MKTAG('X', 'V', 'I', 'D'); if (st->codecpar->codec_tag == MKTAG('V', 'S', 'S', 'H')) st->need_parsing = AVSTREAM_PARSE_FULL; if (st->codecpar->codec_id == AV_CODEC_ID_RV40) st->need_parsing = AVSTREAM_PARSE_NONE; if (st->codecpar->codec_tag == 0 && st->codecpar->height > 0 && st->codecpar->extradata_size < 1U << 30) { st->codecpar->extradata_size += 9; if ((ret = av_reallocp(&st->codecpar->extradata, st->codecpar->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE)) < 0) { st->codecpar->extradata_size = 0; return ret; } else memcpy(st->codecpar->extradata + st->codecpar->extradata_size - 9, ""BottomUp"", 9); } st->codecpar->height = FFABS(st->codecpar->height); break; case AVMEDIA_TYPE_AUDIO: ret = ff_get_wav_header(s, pb, st->codecpar, size, 0); if (ret < 0) return ret; ast->dshow_block_align = st->codecpar->block_align; if (ast->sample_size && st->codecpar->block_align && ast->sample_size != st->codecpar->block_align) { av_log(s, AV_LOG_WARNING, ""sample size (%d) != block align (%d)\n"", ast->sample_size, st->codecpar->block_align); ast->sample_size = st->codecpar->block_align; } /* 2-aligned * (fix for Stargate SG-1 - 3x18 - Shades of Grey.avi) */ if (size & 1) avio_skip(pb, 1); /* Force parsing as several audio frames can be in * one packet and timestamps refer to packet start. */ st->need_parsing = AVSTREAM_PARSE_TIMESTAMPS; /* ADTS header is in extradata, AAC without header must be * stored as exact frames. Parser not needed and it will * fail. */ if (st->codecpar->codec_id == AV_CODEC_ID_AAC && st->codecpar->extradata_size) st->need_parsing = AVSTREAM_PARSE_NONE; if (st->codecpar->codec_id == AV_CODEC_ID_FLAC) st->need_parsing = AVSTREAM_PARSE_NONE; /* AVI files with Xan DPCM audio (wrongly) declare PCM * audio in the header but have Axan as stream_code_tag. */ if (ast->handler == AV_RL32(""Axan"")) { st->codecpar->codec_id = AV_CODEC_ID_XAN_DPCM; st->codecpar->codec_tag = 0; ast->dshow_block_align = 0; } if (amv_file_format) { st->codecpar->codec_id = AV_CODEC_ID_ADPCM_IMA_AMV; ast->dshow_block_align = 0; } if ((st->codecpar->codec_id == AV_CODEC_ID_AAC || st->codecpar->codec_id == AV_CODEC_ID_FLAC || st->codecpar->codec_id == AV_CODEC_ID_MP2 ) && ast->dshow_block_align <= 4 && ast->dshow_block_align) { av_log(s, AV_LOG_DEBUG, ""overriding invalid dshow_block_align of %d\n"", ast->dshow_block_align); ast->dshow_block_align = 0; } if (st->codecpar->codec_id == AV_CODEC_ID_AAC && ast->dshow_block_align == 1024 && ast->sample_size == 1024 || st->codecpar->codec_id == AV_CODEC_ID_AAC && ast->dshow_block_align == 4096 && ast->sample_size == 4096 || st->codecpar->codec_id == AV_CODEC_ID_MP3 && ast->dshow_block_align == 1152 && ast->sample_size == 1152) { av_log(s, AV_LOG_DEBUG, ""overriding sample_size\n""); ast->sample_size = 0; } break; case AVMEDIA_TYPE_SUBTITLE: st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE; st->request_probe= 1; avio_skip(pb, size); break; default: st->codecpar->codec_type = AVMEDIA_TYPE_DATA; st->codecpar->codec_id = AV_CODEC_ID_NONE; st->codecpar->codec_tag = 0; avio_skip(pb, size); break; } } break; case MKTAG('s', 't', 'r', 'd'): if (stream_index >= (unsigned)s->nb_streams || s->streams[stream_index]->codecpar->extradata_size || s->streams[stream_index]->codecpar->codec_tag == MKTAG('H','2','6','4')) { avio_skip(pb, size); } else { uint64_t cur_pos = avio_tell(pb); if (cur_pos < list_end) size = FFMIN(size, list_end - cur_pos); st = s->streams[stream_index]; if (size<(1<<30)) { if (st->codecpar->extradata) { av_log(s, AV_LOG_WARNING, ""New extradata in strd chunk, freeing previous one.\n""); av_freep(&st->codecpar->extradata); } if (ff_get_extradata(s, st->codecpar, pb, size) < 0) return AVERROR(ENOMEM); } if (st->codecpar->extradata_size & 1) //FIXME check if the encoder really did this correctly avio_r8(pb); ret = avi_extract_stream_metadata(s, st); if (ret < 0) { av_log(s, AV_LOG_WARNING, ""could not decoding EXIF data in stream header.\n""); } } break; case MKTAG('i', 'n', 'd', 'x'): pos = avio_tell(pb); if ((pb->seekable & AVIO_SEEKABLE_NORMAL) && !(s->flags & AVFMT_FLAG_IGNIDX) && avi->use_odml && read_odml_index(s, 0) < 0 && (s->error_recognition & AV_EF_EXPLODE)) goto fail; avio_seek(pb, pos + size, SEEK_SET); break; case MKTAG('v', 'p', 'r', 'p'): if (stream_index < (unsigned)s->nb_streams && size > 9 * 4) { AVRational active, active_aspect; st = s->streams[stream_index]; avio_rl32(pb); avio_rl32(pb); avio_rl32(pb); avio_rl32(pb); avio_rl32(pb); active_aspect.den = avio_rl16(pb); active_aspect.num = avio_rl16(pb); active.num = avio_rl32(pb); active.den = avio_rl32(pb); avio_rl32(pb); // nbFieldsPerFrame if (active_aspect.num && active_aspect.den && active.num && active.den) { st->sample_aspect_ratio = av_div_q(active_aspect, active); av_log(s, AV_LOG_TRACE, ""vprp %d/%d %d/%d\n"", active_aspect.num, active_aspect.den, active.num, active.den); } size -= 9 * 4; } avio_skip(pb, size); break; case MKTAG('s', 't', 'r', 'n'): if (s->nb_streams) { ret = avi_read_tag(s, s->streams[s->nb_streams - 1], tag, size); if (ret < 0) return ret; break; } default: if (size > 1000000) { av_log(s, AV_LOG_ERROR, ""Something went wrong during header parsing, "" ""tag %s has size %u, "" ""I will ignore it and try to continue anyway.\n"", av_fourcc2str(tag), size); if (s->error_recognition & AV_EF_EXPLODE) goto fail; avi->movi_list = avio_tell(pb) - 4; avi->movi_end = avi->fsize; goto end_of_header; } /* Do not fail for very large idx1 tags */ case MKTAG('i', 'd', 'x', '1'): /* skip tag */ size += (size & 1); avio_skip(pb, size); break; } } end_of_header: /* check stream number */ if (stream_index != s->nb_streams - 1) { fail: return AVERROR_INVALIDDATA; } if (!avi->index_loaded && (pb->seekable & AVIO_SEEKABLE_NORMAL)) avi_load_index(s); calculate_bitrate(s); avi->index_loaded |= 1; if ((ret = guess_ni_flag(s)) < 0) return ret; avi->non_interleaved |= ret | (s->flags & AVFMT_FLAG_SORT_DTS); dict_entry = av_dict_get(s->metadata, ""ISFT"", NULL, 0); if (dict_entry && !strcmp(dict_entry->value, ""PotEncoder"")) for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; if ( st->codecpar->codec_id == AV_CODEC_ID_MPEG1VIDEO || st->codecpar->codec_id == AV_CODEC_ID_MPEG2VIDEO) st->need_parsing = AVSTREAM_PARSE_FULL; } for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; if (st->nb_index_entries) break; } if (avi->dv_demux) avi->non_interleaved = 0; if (i == s->nb_streams && avi->non_interleaved) { av_log(s, AV_LOG_WARNING, ""Non-interleaved AVI without index, switching to interleaved\n""); avi->non_interleaved = 0; } if (avi->non_interleaved) { av_log(s, AV_LOG_INFO, ""non-interleaved AVI\n""); clean_index(s); } ff_metadata_conv_ctx(s, NULL, avi_metadata_conv); ff_metadata_conv_ctx(s, NULL, ff_riff_info_conv); return 0; } ",0 " ShaderManager::ShaderInfo* GetShaderInfo(GLuint client_id) { return shader_manager()->GetShaderInfo(client_id); } ",0 "juniper_pppoe_atm_print(netdissect_options *ndo, const struct pcap_pkthdr *h, register const u_char *p) { struct juniper_l2info_t l2info; uint16_t extracted_ethertype; l2info.pictype = DLT_JUNIPER_PPPOE_ATM; if (juniper_parse_header(ndo, p, h, &l2info) == 0) return l2info.header_len; p+=l2info.header_len; extracted_ethertype = EXTRACT_16BITS(p); /* this DLT contains nothing but raw PPPoE frames, * prepended with a type field*/ if (ethertype_print(ndo, extracted_ethertype, p+ETHERTYPE_LEN, l2info.length-ETHERTYPE_LEN, l2info.caplen-ETHERTYPE_LEN, NULL, NULL) == 0) /* ether_type not known, probably it wasn't one */ ND_PRINT((ndo, ""unknown ethertype 0x%04x"", extracted_ethertype)); return l2info.header_len; } ",1 "void WebsiteSettings::PresentSiteIdentity() { DCHECK_NE(site_identity_status_, SITE_IDENTITY_STATUS_UNKNOWN); DCHECK_NE(site_connection_status_, SITE_CONNECTION_STATUS_UNKNOWN); WebsiteSettingsUI::IdentityInfo info; if (site_identity_status_ == SITE_IDENTITY_STATUS_EV_CERT) info.site_identity = UTF16ToUTF8(organization_name()); else info.site_identity = site_url_.host(); info.connection_status = site_connection_status_; info.connection_status_description = UTF16ToUTF8(site_connection_details_); info.identity_status = site_identity_status_; info.identity_status_description = UTF16ToUTF8(site_identity_details_); info.cert_id = cert_id_; info.show_ssl_decision_revoke_button = show_ssl_decision_revoke_button_; ui_->SetIdentityInfo(info); } ",0 "static void conditionalAttr2AttrSetter(v8::Local name, v8::Local value, const v8::AccessorInfo& info) { INC_STATS(""DOM.TestObj.conditionalAttr2._set""); TestObj* imp = V8TestObj::toNative(info.Holder()); int v = toInt32(value); imp->setConditionalAttr2(v); return; } ",0 "CIFSPOSIXCreate(const int xid, struct cifs_tcon *tcon, __u32 posix_flags, __u64 mode, __u16 *netfid, FILE_UNIX_BASIC_INFO *pRetData, __u32 *pOplock, const char *name, const struct nls_table *nls_codepage, int remap) { TRANSACTION2_SPI_REQ *pSMB = NULL; TRANSACTION2_SPI_RSP *pSMBr = NULL; int name_len; int rc = 0; int bytes_returned = 0; __u16 params, param_offset, offset, byte_count, count; OPEN_PSX_REQ *pdata; OPEN_PSX_RSP *psx_rsp; cFYI(1, ""In POSIX Create""); PsxCreat: rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB, (void **) &pSMBr); if (rc) return rc; if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { name_len = cifsConvertToUCS((__le16 *) pSMB->FileName, name, PATH_MAX, nls_codepage, remap); name_len++; /* trailing null */ name_len *= 2; } else { /* BB improve the check for buffer overruns BB */ name_len = strnlen(name, PATH_MAX); name_len++; /* trailing null */ strncpy(pSMB->FileName, name, name_len); } params = 6 + name_len; count = sizeof(OPEN_PSX_REQ); pSMB->MaxParameterCount = cpu_to_le16(2); pSMB->MaxDataCount = cpu_to_le16(1000); /* large enough */ pSMB->MaxSetupCount = 0; pSMB->Reserved = 0; pSMB->Flags = 0; pSMB->Timeout = 0; pSMB->Reserved2 = 0; param_offset = offsetof(struct smb_com_transaction2_spi_req, InformationLevel) - 4; offset = param_offset + params; pdata = (OPEN_PSX_REQ *)(((char *)&pSMB->hdr.Protocol) + offset); pdata->Level = cpu_to_le16(SMB_QUERY_FILE_UNIX_BASIC); pdata->Permissions = cpu_to_le64(mode); pdata->PosixOpenFlags = cpu_to_le32(posix_flags); pdata->OpenFlags = cpu_to_le32(*pOplock); pSMB->ParameterOffset = cpu_to_le16(param_offset); pSMB->DataOffset = cpu_to_le16(offset); pSMB->SetupCount = 1; pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION); byte_count = 3 /* pad */ + params + count; pSMB->DataCount = cpu_to_le16(count); pSMB->ParameterCount = cpu_to_le16(params); pSMB->TotalDataCount = pSMB->DataCount; pSMB->TotalParameterCount = pSMB->ParameterCount; pSMB->InformationLevel = cpu_to_le16(SMB_POSIX_OPEN); pSMB->Reserved4 = 0; inc_rfc1001_len(pSMB, byte_count); pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { cFYI(1, ""Posix create returned %d"", rc); goto psx_create_err; } cFYI(1, ""copying inode info""); rc = validate_t2((struct smb_t2_rsp *)pSMBr); if (rc || get_bcc(&pSMBr->hdr) < sizeof(OPEN_PSX_RSP)) { rc = -EIO; /* bad smb */ goto psx_create_err; } /* copy return information to pRetData */ psx_rsp = (OPEN_PSX_RSP *)((char *) &pSMBr->hdr.Protocol + le16_to_cpu(pSMBr->t2.DataOffset)); *pOplock = le16_to_cpu(psx_rsp->OplockFlags); if (netfid) *netfid = psx_rsp->Fid; /* cifs fid stays in le */ /* Let caller know file was created so we can set the mode. */ /* Do we care about the CreateAction in any other cases? */ if (cpu_to_le32(FILE_CREATE) == psx_rsp->CreateAction) *pOplock |= CIFS_CREATE_ACTION; /* check to make sure response data is there */ if (psx_rsp->ReturnedLevel != cpu_to_le16(SMB_QUERY_FILE_UNIX_BASIC)) { pRetData->Type = cpu_to_le32(-1); /* unknown */ cFYI(DBG2, ""unknown type""); } else { if (get_bcc(&pSMBr->hdr) < sizeof(OPEN_PSX_RSP) + sizeof(FILE_UNIX_BASIC_INFO)) { cERROR(1, ""Open response data too small""); pRetData->Type = cpu_to_le32(-1); goto psx_create_err; } memcpy((char *) pRetData, (char *)psx_rsp + sizeof(OPEN_PSX_RSP), sizeof(FILE_UNIX_BASIC_INFO)); } psx_create_err: cifs_buf_release(pSMB); if (posix_flags & SMB_O_DIRECTORY) cifs_stats_inc(&tcon->num_posixmkdirs); else cifs_stats_inc(&tcon->num_posixopens); if (rc == -EAGAIN) goto PsxCreat; return rc; } ",0 "bool PermissionsData::HasAPIPermission( const std::string& permission_name) const { return active_permissions()->HasAPIPermission(permission_name); } ",0 " bool shouldAnnotate() { return m_shouldAnnotate == AnnotateForInterchange; } ",0 "static void iscsi_release_extra_responses(struct iscsi_param_list *param_list) { struct iscsi_extra_response *er, *er_tmp; list_for_each_entry_safe(er, er_tmp, ¶m_list->extra_response_list, er_list) { list_del(&er->er_list); kfree(er); } } ",0 "void GDataFileSystem::OnMarkDirtyInCacheCompleteForOpenFile( const OpenFileCallback& callback, GDataFileError error, const std::string& resource_id, const std::string& md5, const FilePath& cache_file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (!callback.is_null()) callback.Run(error, cache_file_path); } ",0 "LayoutSVGContainer::~LayoutSVGContainer() { } ",0 "str_to_color(char *value) { if (value == NULL) return 8; /* terminal */ switch (TOLOWER(*value)) { case '0': return 0; /* black */ case '1': case 'r': return 1; /* red */ case '2': case 'g': return 2; /* green */ case '3': case 'y': return 3; /* yellow */ case '4': return 4; /* blue */ case '5': case 'm': return 5; /* magenta */ case '6': case 'c': return 6; /* cyan */ case '7': case 'w': return 7; /* white */ case '8': case 't': return 8; /* terminal */ case 'b': if (!strncasecmp(value, ""blu"", 3)) return 4; /* blue */ else return 0; /* black */ } return 8; /* terminal */ } ",0 "static int add_oid_section(struct php_x509_request * req) /* {{{ */ { char * str; STACK_OF(CONF_VALUE) * sktmp; CONF_VALUE * cnf; int i; str = CONF_get_string(req->req_config, NULL, ""oid_section""); if (str == NULL) { return SUCCESS; } sktmp = CONF_get_section(req->req_config, str); if (sktmp == NULL) { php_error_docref(NULL, E_WARNING, ""problem loading oid section %s"", str); return FAILURE; } for (i = 0; i < sk_CONF_VALUE_num(sktmp); i++) { cnf = sk_CONF_VALUE_value(sktmp, i); if (OBJ_sn2nid(cnf->name) == NID_undef && OBJ_ln2nid(cnf->name) == NID_undef && OBJ_create(cnf->value, cnf->name, cnf->name) == NID_undef) { php_error_docref(NULL, E_WARNING, ""problem creating object %s=%s"", cnf->name, cnf->value); return FAILURE; } } return SUCCESS; } /* }}} */ ",0 "void InjectedBundlePage::didDetectXSSForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef*, const void* clientInfo) { static_cast(const_cast(clientInfo))->didDetectXSSForFrame(frame); } ",0 "xsltNewExtData(xsltExtModulePtr extModule, void *extData) { xsltExtDataPtr cur; if (extModule == NULL) return (NULL); cur = (xsltExtDataPtr) xmlMalloc(sizeof(xsltExtData)); if (cur == NULL) { xsltTransformError(NULL, NULL, NULL, ""xsltNewExtData : malloc failed\n""); return (NULL); } cur->extModule = extModule; cur->extData = extData; return (cur); } ",0 "static void put_ctx(struct perf_event_context *ctx) { if (atomic_dec_and_test(&ctx->refcount)) { if (ctx->parent_ctx) put_ctx(ctx->parent_ctx); if (ctx->task) put_task_struct(ctx->task); call_rcu(&ctx->rcu_head, free_ctx); } } ",0 "void DevToolsAgent::OnDispatchOnInspectorBackend(const std::string& message) { WebDevToolsAgent* web_agent = GetWebAgent(); if (web_agent) web_agent->dispatchOnInspectorBackend(WebString::fromUTF8(message)); } ",0 "static int RSA_set0_crt_params(RSA *r, BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp) { r->dmp1 = dmp1; r->dmq1 = dmq1; r->iqmp = iqmp; return 1; } ",0 "static int StreamTcpPacketStateSynSent(ThreadVars *tv, Packet *p, StreamTcpThread *stt, TcpSession *ssn, PacketQueue *pq) { if (ssn == NULL) return -1; SCLogDebug(""ssn %p: pkt received: %s"", ssn, PKT_IS_TOCLIENT(p) ? ""toclient"":""toserver""); /* RST */ if (p->tcph->th_flags & TH_RST) { if (!StreamTcpValidateRst(ssn, p)) return -1; if (PKT_IS_TOSERVER(p)) { if (SEQ_EQ(TCP_GET_SEQ(p), ssn->client.isn) && SEQ_EQ(TCP_GET_WINDOW(p), 0) && SEQ_EQ(TCP_GET_ACK(p), (ssn->client.isn + 1))) { StreamTcpPacketSetState(p, ssn, TCP_CLOSED); SCLogDebug(""ssn %p: Reset received and state changed to "" ""TCP_CLOSED"", ssn); } } else { StreamTcpPacketSetState(p, ssn, TCP_CLOSED); SCLogDebug(""ssn %p: Reset received and state changed to "" ""TCP_CLOSED"", ssn); } /* FIN */ } else if (p->tcph->th_flags & TH_FIN) { /** \todo */ /* SYN/ACK */ } else if ((p->tcph->th_flags & (TH_SYN|TH_ACK)) == (TH_SYN|TH_ACK)) { if ((ssn->flags & STREAMTCP_FLAG_4WHS) && PKT_IS_TOSERVER(p)) { SCLogDebug(""ssn %p: SYN/ACK received on 4WHS session"", ssn); /* Check if the SYN/ACK packet ack's the earlier * received SYN packet. */ if (!(SEQ_EQ(TCP_GET_ACK(p), ssn->server.isn + 1))) { StreamTcpSetEvent(p, STREAM_4WHS_SYNACK_WITH_WRONG_ACK); SCLogDebug(""ssn %p: 4WHS ACK mismatch, packet ACK %""PRIu32"""" "" != %"" PRIu32 "" from stream"", ssn, TCP_GET_ACK(p), ssn->server.isn + 1); return -1; } /* Check if the SYN/ACK packet SEQ's the *FIRST* received SYN * packet. */ if (!(SEQ_EQ(TCP_GET_SEQ(p), ssn->client.isn))) { StreamTcpSetEvent(p, STREAM_4WHS_SYNACK_WITH_WRONG_SYN); SCLogDebug(""ssn %p: 4WHS SEQ mismatch, packet SEQ %""PRIu32"""" "" != %"" PRIu32 "" from *first* SYN pkt"", ssn, TCP_GET_SEQ(p), ssn->client.isn); return -1; } /* update state */ StreamTcpPacketSetState(p, ssn, TCP_SYN_RECV); SCLogDebug(""ssn %p: =~ 4WHS ssn state is now TCP_SYN_RECV"", ssn); /* sequence number & window */ ssn->client.isn = TCP_GET_SEQ(p); STREAMTCP_SET_RA_BASE_SEQ(&ssn->client, ssn->client.isn); ssn->client.next_seq = ssn->client.isn + 1; ssn->server.window = TCP_GET_WINDOW(p); SCLogDebug(""ssn %p: 4WHS window %"" PRIu32 """", ssn, ssn->client.window); /* Set the timestamp values used to validate the timestamp of * received packets. */ if ((TCP_HAS_TS(p)) && (ssn->server.flags & STREAMTCP_STREAM_FLAG_TIMESTAMP)) { ssn->client.last_ts = TCP_GET_TSVAL(p); SCLogDebug(""ssn %p: 4WHS ssn->client.last_ts %"" PRIu32"" "" ""ssn->server.last_ts %"" PRIu32"""", ssn, ssn->client.last_ts, ssn->server.last_ts); ssn->flags |= STREAMTCP_FLAG_TIMESTAMP; ssn->client.last_pkt_ts = p->ts.tv_sec; if (ssn->client.last_ts == 0) ssn->client.flags |= STREAMTCP_STREAM_FLAG_ZERO_TIMESTAMP; } else { ssn->server.last_ts = 0; ssn->client.last_ts = 0; ssn->server.flags &= ~STREAMTCP_STREAM_FLAG_ZERO_TIMESTAMP; } ssn->server.last_ack = TCP_GET_ACK(p); ssn->client.last_ack = ssn->client.isn + 1; /** check for the presense of the ws ptr to determine if we * support wscale at all */ if ((ssn->flags & STREAMTCP_FLAG_SERVER_WSCALE) && (TCP_HAS_WSCALE(p))) { ssn->server.wscale = TCP_GET_WSCALE(p); } else { ssn->server.wscale = 0; } if ((ssn->flags & STREAMTCP_FLAG_CLIENT_SACKOK) && TCP_GET_SACKOK(p) == 1) { ssn->flags |= STREAMTCP_FLAG_SACKOK; SCLogDebug(""ssn %p: SACK permitted for 4WHS session"", ssn); } ssn->client.next_win = ssn->client.last_ack + ssn->client.window; ssn->server.next_win = ssn->server.last_ack + ssn->server.window; SCLogDebug(""ssn %p: 4WHS ssn->client.next_win %"" PRIu32 """", ssn, ssn->client.next_win); SCLogDebug(""ssn %p: 4WHS ssn->server.next_win %"" PRIu32 """", ssn, ssn->server.next_win); SCLogDebug(""ssn %p: 4WHS ssn->client.isn %"" PRIu32 "", "" ""ssn->client.next_seq %"" PRIu32 "", "" ""ssn->client.last_ack %"" PRIu32 "" "" ""(ssn->server.last_ack %"" PRIu32 "")"", ssn, ssn->client.isn, ssn->client.next_seq, ssn->client.last_ack, ssn->server.last_ack); /* done here */ return 0; } if (PKT_IS_TOSERVER(p)) { StreamTcpSetEvent(p, STREAM_3WHS_SYNACK_IN_WRONG_DIRECTION); SCLogDebug(""ssn %p: SYN/ACK received in the wrong direction"", ssn); return -1; } /* Check if the SYN/ACK packet ack's the earlier * received SYN packet. */ if (!(SEQ_EQ(TCP_GET_ACK(p), ssn->client.isn + 1))) { StreamTcpSetEvent(p, STREAM_3WHS_SYNACK_WITH_WRONG_ACK); SCLogDebug(""ssn %p: ACK mismatch, packet ACK %"" PRIu32 "" != "" ""%"" PRIu32 "" from stream"", ssn, TCP_GET_ACK(p), ssn->client.isn + 1); return -1; } StreamTcp3whsSynAckUpdate(ssn, p, /* no queue override */NULL); } else if (p->tcph->th_flags & TH_SYN) { SCLogDebug(""ssn %p: SYN packet on state SYN_SENT... resent"", ssn); if (ssn->flags & STREAMTCP_FLAG_4WHS) { SCLogDebug(""ssn %p: SYN packet on state SYN_SENT... resent of "" ""4WHS SYN"", ssn); } if (PKT_IS_TOCLIENT(p)) { /** a SYN only packet in the opposite direction could be: * http://www.breakingpointsystems.com/community/blog/tcp- * portals-the-three-way-handshake-is-a-lie * * \todo improve resetting the session */ /* indicate that we're dealing with 4WHS here */ ssn->flags |= STREAMTCP_FLAG_4WHS; SCLogDebug(""ssn %p: STREAMTCP_FLAG_4WHS flag set"", ssn); /* set the sequence numbers and window for server * We leave the ssn->client.isn in place as we will * check the SYN/ACK pkt with that. */ ssn->server.isn = TCP_GET_SEQ(p); STREAMTCP_SET_RA_BASE_SEQ(&ssn->server, ssn->server.isn); ssn->server.next_seq = ssn->server.isn + 1; /* Set the stream timestamp value, if packet has timestamp * option enabled. */ if (TCP_HAS_TS(p)) { ssn->server.last_ts = TCP_GET_TSVAL(p); SCLogDebug(""ssn %p: %02x"", ssn, ssn->server.last_ts); if (ssn->server.last_ts == 0) ssn->server.flags |= STREAMTCP_STREAM_FLAG_ZERO_TIMESTAMP; ssn->server.last_pkt_ts = p->ts.tv_sec; ssn->server.flags |= STREAMTCP_STREAM_FLAG_TIMESTAMP; } ssn->server.window = TCP_GET_WINDOW(p); if (TCP_HAS_WSCALE(p)) { ssn->flags |= STREAMTCP_FLAG_SERVER_WSCALE; ssn->server.wscale = TCP_GET_WSCALE(p); } else { ssn->flags &= ~STREAMTCP_FLAG_SERVER_WSCALE; ssn->server.wscale = 0; } if (TCP_GET_SACKOK(p) == 1) { ssn->flags |= STREAMTCP_FLAG_CLIENT_SACKOK; } else { ssn->flags &= ~STREAMTCP_FLAG_CLIENT_SACKOK; } SCLogDebug(""ssn %p: 4WHS ssn->server.isn %"" PRIu32 "", "" ""ssn->server.next_seq %"" PRIu32 "", "" ""ssn->server.last_ack %""PRIu32"""", ssn, ssn->server.isn, ssn->server.next_seq, ssn->server.last_ack); SCLogDebug(""ssn %p: 4WHS ssn->client.isn %"" PRIu32 "", "" ""ssn->client.next_seq %"" PRIu32 "", "" ""ssn->client.last_ack %""PRIu32"""", ssn, ssn->client.isn, ssn->client.next_seq, ssn->client.last_ack); } /** \todo check if it's correct or set event */ } else if (p->tcph->th_flags & TH_ACK) { /* Handle the asynchronous stream, when we receive a SYN packet and now istead of receving a SYN/ACK we receive a ACK from the same host, which sent the SYN, this suggests the ASNYC streams.*/ if (stream_config.async_oneside == FALSE) return 0; /* we are in AYNC (one side) mode now. */ /* one side async means we won't see a SYN/ACK, so we can * only check the SYN. */ if (!(SEQ_EQ(TCP_GET_SEQ(p), ssn->client.next_seq))) { StreamTcpSetEvent(p, STREAM_3WHS_ASYNC_WRONG_SEQ); SCLogDebug(""ssn %p: SEQ mismatch, packet SEQ %"" PRIu32 "" != "" ""%"" PRIu32 "" from stream"",ssn, TCP_GET_SEQ(p), ssn->client.next_seq); return -1; } ssn->flags |= STREAMTCP_FLAG_ASYNC; StreamTcpPacketSetState(p, ssn, TCP_ESTABLISHED); SCLogDebug(""ssn %p: =~ ssn state is now TCP_ESTABLISHED"", ssn); ssn->client.window = TCP_GET_WINDOW(p); ssn->client.last_ack = TCP_GET_SEQ(p); ssn->client.next_win = ssn->client.last_ack + ssn->client.window; /* Set the server side parameters */ ssn->server.isn = TCP_GET_ACK(p) - 1; STREAMTCP_SET_RA_BASE_SEQ(&ssn->server, ssn->server.isn); ssn->server.next_seq = ssn->server.isn + 1; ssn->server.last_ack = ssn->server.next_seq; ssn->server.next_win = ssn->server.last_ack; SCLogDebug(""ssn %p: synsent => Asynchronous stream, packet SEQ"" "" %"" PRIu32 "", payload size %"" PRIu32 "" (%"" PRIu32 ""), "" ""ssn->client.next_seq %"" PRIu32 """" ,ssn, TCP_GET_SEQ(p), p->payload_len, TCP_GET_SEQ(p) + p->payload_len, ssn->client.next_seq); /* if SYN had wscale, assume it to be supported. Otherwise * we know it not to be supported. */ if (ssn->flags & STREAMTCP_FLAG_SERVER_WSCALE) { ssn->client.wscale = TCP_WSCALE_MAX; } /* Set the timestamp values used to validate the timestamp of * received packets.*/ if (TCP_HAS_TS(p) && (ssn->client.flags & STREAMTCP_STREAM_FLAG_TIMESTAMP)) { ssn->flags |= STREAMTCP_FLAG_TIMESTAMP; ssn->client.flags &= ~STREAMTCP_STREAM_FLAG_TIMESTAMP; ssn->client.last_pkt_ts = p->ts.tv_sec; } else { ssn->client.last_ts = 0; ssn->client.flags &= ~STREAMTCP_STREAM_FLAG_ZERO_TIMESTAMP; } if (ssn->flags & STREAMTCP_FLAG_CLIENT_SACKOK) { ssn->flags |= STREAMTCP_FLAG_SACKOK; } StreamTcpReassembleHandleSegment(tv, stt->ra_ctx, ssn, &ssn->client, p, pq); } else { SCLogDebug(""ssn %p: default case"", ssn); } return 0; } ",0 "void SynchronousCompositorImpl::UpdateFrameMetaData( const cc::CompositorFrameMetadata& frame_metadata) { rwhva_->SynchronousFrameMetadata(frame_metadata); DeliverMessages(); } ",0 "static uint32_t ssd0323_transfer(SSISlave *dev, uint32_t data) { ssd0323_state *s = FROM_SSI_SLAVE(ssd0323_state, dev); switch (s->mode) { case SSD0323_DATA: DPRINTF(""data 0x%02x\n"", data); s->framebuffer[s->col + s->row * 64] = data; if (s->remap & REMAP_VERTICAL) { s->row++; if (s->row > s->row_end) { s->row = s->row_start; s->col++; } if (s->col > s->col_end) { s->col = s->col_start; } } else { s->col++; if (s->col > s->col_end) { s->row++; s->col = s->col_start; } if (s->row > s->row_end) { s->row = s->row_start; } } s->redraw = 1; break; case SSD0323_CMD: DPRINTF(""cmd 0x%02x\n"", data); if (s->cmd_len == 0) { s->cmd = data; } else { s->cmd_data[s->cmd_len - 1] = data; } s->cmd_len++; switch (s->cmd) { #define DATA(x) if (s->cmd_len <= (x)) return 0 case 0x15: /* Set column. */ DATA(2); s->col = s->col_start = s->cmd_data[0] % 64; s->col_end = s->cmd_data[1] % 64; break; case 0x75: /* Set row. */ DATA(2); s->row = s->row_start = s->cmd_data[0] % 80; s->row_end = s->cmd_data[1] % 80; break; case 0x81: /* Set contrast */ DATA(1); break; case 0x84: case 0x85: case 0x86: /* Max current. */ DATA(0); break; case 0xa0: /* Set remapping. */ /* FIXME: Implement this. */ DATA(1); s->remap = s->cmd_data[0]; break; case 0xa1: /* Set display start line. */ case 0xa2: /* Set display offset. */ /* FIXME: Implement these. */ DATA(1); break; case 0xa4: /* Normal mode. */ case 0xa5: /* All on. */ case 0xa6: /* All off. */ case 0xa7: /* Inverse. */ /* FIXME: Implement these. */ DATA(0); break; case 0xa8: /* Set multiplex ratio. */ case 0xad: /* Set DC-DC converter. */ DATA(1); /* Ignored. Don't care. */ break; case 0xae: /* Display off. */ case 0xaf: /* Display on. */ DATA(0); /* TODO: Implement power control. */ break; case 0xb1: /* Set phase length. */ case 0xb2: /* Set row period. */ case 0xb3: /* Set clock rate. */ case 0xbc: /* Set precharge. */ case 0xbe: /* Set VCOMH. */ case 0xbf: /* Set segment low. */ DATA(1); /* Ignored. Don't care. */ break; case 0xb8: /* Set grey scale table. */ /* FIXME: Implement this. */ DATA(8); break; case 0xe3: /* NOP. */ DATA(0); break; case 0xff: /* Nasty hack because we don't handle chip selects properly. */ break; default: BADF(""Unknown command: 0x%x\n"", data); } s->cmd_len = 0; return 0; } return 0; } ",0 "CSSStyleSheet* Document::createCSSStyleSheetSync( ScriptState* script_state, const String& text, ExceptionState& exception_state) { return Document::createCSSStyleSheetSync( script_state, text, CSSStyleSheetInit::Create(), exception_state); } ",0 "static void tcp_skb_mark_lost(struct tcp_sock *tp, struct sk_buff *skb) { if (!(TCP_SKB_CB(skb)->sacked & (TCPCB_LOST|TCPCB_SACKED_ACKED))) { tcp_verify_retransmit_hint(tp, skb); tp->lost_out += tcp_skb_pcount(skb); TCP_SKB_CB(skb)->sacked |= TCPCB_LOST; } } ",0 "void DiceResponseHandler::OnTokenExchangeSuccess( DiceTokenFetcher* token_fetcher, const std::string& refresh_token, bool is_under_advanced_protection) { const std::string& email = token_fetcher->email(); const std::string& gaia_id = token_fetcher->gaia_id(); if (!CanGetTokenForAccount(gaia_id, email)) return; VLOG(1) << ""[Dice] OAuth success for email "" << email; bool should_enable_sync = token_fetcher->should_enable_sync(); std::string account_id = account_tracker_service_->SeedAccountInfo(gaia_id, email); account_tracker_service_->SetIsAdvancedProtectionAccount( account_id, is_under_advanced_protection); token_service_->UpdateCredentials(account_id, refresh_token); about_signin_internals_->OnRefreshTokenReceived( base::StringPrintf(""Successful (%s)"", account_id.c_str())); if (should_enable_sync) token_fetcher->delegate()->EnableSync(account_id); DeleteTokenFetcher(token_fetcher); } ",1 "perf_ftrace_function_call(unsigned long ip, unsigned long parent_ip, struct ftrace_ops *ops, struct pt_regs *pt_regs) { struct ftrace_entry *entry; struct hlist_head *head; struct pt_regs regs; int rctx; head = this_cpu_ptr(event_function.perf_events); if (hlist_empty(head)) return; #define ENTRY_SIZE (ALIGN(sizeof(struct ftrace_entry) + sizeof(u32), \ sizeof(u64)) - sizeof(u32)) BUILD_BUG_ON(ENTRY_SIZE > PERF_MAX_TRACE_SIZE); perf_fetch_caller_regs(®s); entry = perf_trace_buf_prepare(ENTRY_SIZE, TRACE_FN, NULL, &rctx); if (!entry) return; entry->ip = ip; entry->parent_ip = parent_ip; perf_trace_buf_submit(entry, ENTRY_SIZE, rctx, 0, 1, ®s, head, NULL); #undef ENTRY_SIZE } ",0 "void RenderViewImpl::willSendRequest(WebFrame* frame, unsigned identifier, WebURLRequest& request, const WebURLResponse& redirect_response) { WebFrame* top_frame = frame->top(); if (!top_frame) top_frame = frame; WebDataSource* provisional_data_source = top_frame->provisionalDataSource(); WebDataSource* top_data_source = top_frame->dataSource(); WebDataSource* data_source = provisional_data_source ? provisional_data_source : top_data_source; content::PageTransition transition_type = content::PAGE_TRANSITION_LINK; DocumentState* document_state = DocumentState::FromDataSource(data_source); DCHECK(document_state); NavigationState* navigation_state = document_state->navigation_state(); transition_type = navigation_state->transition_type(); GURL request_url(request.url()); GURL new_url; if (content::GetContentClient()->renderer()->WillSendRequest( frame, transition_type, request_url, &new_url)) { request.setURL(WebURL(new_url)); } if (document_state->is_cache_policy_override_set()) request.setCachePolicy(document_state->cache_policy_override()); WebKit::WebReferrerPolicy referrer_policy; if (document_state && document_state->is_referrer_policy_set()) { referrer_policy = document_state->referrer_policy(); document_state->clear_referrer_policy(); } else { referrer_policy = frame->document().referrerPolicy(); } WebString custom_user_agent; if (request.extraData()) { webkit_glue::WebURLRequestExtraDataImpl* old_extra_data = static_cast( request.extraData()); custom_user_agent = old_extra_data->custom_user_agent(); if (!custom_user_agent.isNull()) { if (custom_user_agent.isEmpty()) request.clearHTTPHeaderField(""User-Agent""); else request.setHTTPHeaderField(""User-Agent"", custom_user_agent); } } request.setExtraData( new RequestExtraData(referrer_policy, custom_user_agent, (frame == top_frame), frame->identifier(), frame->parent() == top_frame, frame->parent() ? frame->parent()->identifier() : -1, navigation_state->allow_download(), transition_type, navigation_state->transferred_request_child_id(), navigation_state->transferred_request_request_id())); DocumentState* top_document_state = DocumentState::FromDataSource(top_data_source); if (top_document_state && request.targetType() == WebURLRequest::TargetIsPrefetch) top_document_state->set_was_prefetcher(true); request.setRequestorID(routing_id_); request.setHasUserGesture(frame->isProcessingUserGesture()); if (!renderer_preferences_.enable_referrers) request.clearHTTPHeaderField(""Referer""); } ",0 " xmlParseMisc(xmlParserCtxtPtr ctxt) { while (((RAW == '<') && (NXT(1) == '?')) || (CMP4(CUR_PTR, '<', '!', '-', '-')) || IS_BLANK_CH(CUR)) { if ((RAW == '<') && (NXT(1) == '?')) { xmlParsePI(ctxt); } else if (IS_BLANK_CH(CUR)) { NEXT; } else xmlParseComment(ctxt); } } ",1 " static void FillFormIncludingNonFocusableElementsWrapper( const FormData& form, const WebFormControlElement& element) { FillFormIncludingNonFocusableElements(form, element.Form()); } ",0 "void MarkKeyboardLoadFinished() { if (!g_keyboard_load_time_start.Get().ToInternalValue()) return; DCHECK(g_keyboard_load_time_start.Get().ToInternalValue()); static bool logged = false; if (!logged) { UMA_HISTOGRAM_TIMES( ""VirtualKeyboard.FirstLoadTime"", base::Time::Now() - g_keyboard_load_time_start.Get()); logged = true; } } ",0 "AutocompleteController::AutocompleteController( Profile* profile, AutocompleteControllerDelegate* delegate) : delegate_(delegate), keyword_provider_(NULL), done_(true), in_start_(false), profile_(profile) { search_provider_ = new SearchProvider(this, profile); providers_.push_back(search_provider_); bool hqp_enabled = !CommandLine::ForCurrentProcess()->HasSwitch( switches::kDisableHistoryQuickProvider); if (hqp_enabled) providers_.push_back(new HistoryQuickProvider(this, profile)); if (!CommandLine::ForCurrentProcess()->HasSwitch( switches::kDisableShortcutsProvider)) providers_.push_back(new ShortcutsProvider(this, profile)); if (!CommandLine::ForCurrentProcess()->HasSwitch( switches::kDisableHistoryURLProvider)) providers_.push_back(new HistoryURLProvider(this, profile)); #if !defined(OS_ANDROID) keyword_provider_ = new KeywordProvider(this, profile); providers_.push_back(keyword_provider_); #endif // !OS_ANDROID providers_.push_back(new HistoryContentsProvider(this, profile, hqp_enabled)); providers_.push_back(new BuiltinProvider(this, profile)); providers_.push_back(new ExtensionAppProvider(this, profile)); for (ACProviders::iterator i(providers_.begin()); i != providers_.end(); ++i) (*i)->AddRef(); } ",0 "gfx::Rect TestBrowserWindow::GetRestoredBounds() const { return gfx::Rect(); } ",0 "static void sco_config_callback(UNUSED_ATTR bool success) { LOG_INFO(""%s postload finished."", __func__); } ",0 "void CL_Rcon_f( void ) { char message[MAX_RCON_MESSAGE]; netadr_t to; if ( !rcon_client_password->string[0] ) { Com_Printf( ""You must set 'rconpassword' before\n"" ""issuing an rcon command.\n"" ); return; } message[0] = -1; message[1] = -1; message[2] = -1; message[3] = -1; message[4] = 0; Q_strcat (message, MAX_RCON_MESSAGE, ""rcon ""); Q_strcat (message, MAX_RCON_MESSAGE, rcon_client_password->string); Q_strcat (message, MAX_RCON_MESSAGE, "" ""); Q_strcat (message, MAX_RCON_MESSAGE, Cmd_Cmd()+5); if ( clc.state >= CA_CONNECTED ) { to = clc.netchan.remoteAddress; } else { if ( !strlen( rconAddress->string ) ) { Com_Printf( ""You must either be connected,\n"" ""or set the 'rconAddress' cvar\n"" ""to issue rcon commands\n"" ); return; } NET_StringToAdr (rconAddress->string, &to, NA_UNSPEC); if ( to.port == 0 ) { to.port = BigShort( PORT_SERVER ); } } NET_SendPacket( NS_CLIENT, strlen( message ) + 1, message, to ); } ",0 " base::WeakPtr GetWeakPtr() { return weak_factory_.GetWeakPtr(); } ",0 "static zend_bool php_auto_globals_create_server(zend_string *name) { if (PG(variables_order) && (strchr(PG(variables_order),'S') || strchr(PG(variables_order),'s'))) { php_register_server_variables(); if (PG(register_argc_argv)) { if (SG(request_info).argc) { zval *argc, *argv; if ((argc = zend_hash_str_find_ind(&EG(symbol_table), ""argc"", sizeof(""argc"")-1)) != NULL && (argv = zend_hash_str_find_ind(&EG(symbol_table), ""argv"", sizeof(""argv"")-1)) != NULL) { Z_ADDREF_P(argv); zend_hash_str_update(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]), ""argv"", sizeof(""argv"")-1, argv); zend_hash_str_update(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]), ""argc"", sizeof(""argc"")-1, argc); } } else { php_build_argv(SG(request_info).query_string, &PG(http_globals)[TRACK_VARS_SERVER]); } } } else { zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_SERVER]); array_init(&PG(http_globals)[TRACK_VARS_SERVER]); } check_http_proxy(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER])); zend_hash_update(&EG(symbol_table), name, &PG(http_globals)[TRACK_VARS_SERVER]); Z_ADDREF(PG(http_globals)[TRACK_VARS_SERVER]); return 0; /* don't rearm */ } ",0 "static int cmd_status(const char *s) { s = imap_next_word((char *) s); if (mutt_str_strncasecmp(""OK"", s, 2) == 0) return IMAP_CMD_OK; if (mutt_str_strncasecmp(""NO"", s, 2) == 0) return IMAP_CMD_NO; return IMAP_CMD_BAD; } ",0 "static unsigned int Sys_CountFileList(char **list) { int i = 0; if (list) { while (*list) { list++; i++; } } return i; } ",0 "void WebBluetoothServiceImpl::RemoteDescriptorReadValue( const std::string& descriptor_instance_id, RemoteDescriptorReadValueCallback callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); const CacheQueryResult query_result = QueryCacheForDescriptor(descriptor_instance_id); if (query_result.outcome == CacheQueryOutcome::BAD_RENDERER) { return; } if (query_result.outcome != CacheQueryOutcome::SUCCESS) { RecordDescriptorReadValueOutcome(query_result.outcome); std::move(callback).Run(query_result.GetWebResult(), base::nullopt /* value */); return; } if (BluetoothBlocklist::Get().IsExcludedFromReads( query_result.descriptor->GetUUID())) { RecordDescriptorReadValueOutcome(UMAGATTOperationOutcome::BLOCKLISTED); std::move(callback).Run(blink::mojom::WebBluetoothResult::BLOCKLISTED_READ, base::nullopt /* value */); return; } auto copyable_callback = base::AdaptCallbackForRepeating(std::move(callback)); query_result.descriptor->ReadRemoteDescriptor( base::Bind(&WebBluetoothServiceImpl::OnDescriptorReadValueSuccess, weak_ptr_factory_.GetWeakPtr(), copyable_callback), base::Bind(&WebBluetoothServiceImpl::OnDescriptorReadValueFailed, weak_ptr_factory_.GetWeakPtr(), copyable_callback)); } ",0 "LayerTreeHostImpl::BuildEvictionQueue(TreePriority tree_priority) { TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT(""cc.debug""), ""LayerTreeHostImpl::BuildEvictionQueue""); std::unique_ptr queue( new EvictionTilePriorityQueue); queue->Build(active_tree_->picture_layers(), pending_tree_ ? pending_tree_->picture_layers() : std::vector(), tree_priority); return queue; } ",0 " vpx_codec_err_t DecodeOneFrame() { const vpx_codec_err_t res = decoder_->DecodeFrame(video_->cxdata(), video_->frame_size()); CheckDecodedFrames(); if (res == VPX_CODEC_OK) video_->Next(); return res; } ",0 "static void evmcs_load(u64 phys_addr) { struct hv_vp_assist_page *vp_ap = hv_get_vp_assist_page(smp_processor_id()); vp_ap->current_nested_vmcs = phys_addr; vp_ap->enlighten_vmentry = 1; } ",0 "int WebSocketExperimentTask::DoWebSocketKeepIdle() { DCHECK(websocket_); next_state_ = STATE_WEBSOCKET_KEEP_IDLE_COMPLETE; websocket_idle_start_time_ = base::TimeTicks::Now(); SetTimeout(config_.websocket_idle_ms); return net::ERR_IO_PENDING; } ",0 "static int issue_discard_thread(void *data) { struct f2fs_sb_info *sbi = data; struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; wait_queue_head_t *q = &dcc->discard_wait_queue; unsigned int wait_ms = DEF_MIN_DISCARD_ISSUE_TIME; int issued; set_freezable(); do { wait_event_interruptible_timeout(*q, kthread_should_stop() || freezing(current) || dcc->discard_wake, msecs_to_jiffies(wait_ms)); if (try_to_freeze()) continue; if (kthread_should_stop()) return 0; if (dcc->discard_wake) { dcc->discard_wake = 0; if (sbi->gc_thread && sbi->gc_thread->gc_urgent) mark_discard_range_all(sbi); } sb_start_intwrite(sbi->sb); issued = __issue_discard_cmd(sbi, true); if (issued) { __wait_discard_cmd(sbi, true); wait_ms = DEF_MIN_DISCARD_ISSUE_TIME; } else { wait_ms = DEF_MAX_DISCARD_ISSUE_TIME; } sb_end_intwrite(sbi->sb); } while (!kthread_should_stop()); return 0; } ",0 "XMLRPC_VALUE XMLRPC_UtilityCreateFault(int fault_code, const char* fault_string) { XMLRPC_VALUE xOutput = NULL; char* string = NULL; simplestring description; simplestring_init(&description); switch (fault_code) { case xmlrpc_error_parse_xml_syntax: string = xmlrpc_error_parse_xml_syntax_str; break; case xmlrpc_error_parse_unknown_encoding: string = xmlrpc_error_parse_unknown_encoding_str; break; case xmlrpc_error_parse_bad_encoding: string = xmlrpc_error_parse_bad_encoding_str; break; case xmlrpc_error_invalid_xmlrpc: string = xmlrpc_error_invalid_xmlrpc_str; break; case xmlrpc_error_unknown_method: string = xmlrpc_error_unknown_method_str; break; case xmlrpc_error_invalid_params: string = xmlrpc_error_invalid_params_str; break; case xmlrpc_error_internal_server: string = xmlrpc_error_internal_server_str; break; case xmlrpc_error_application: string = xmlrpc_error_application_str; break; case xmlrpc_error_system: string = xmlrpc_error_system_str; break; case xmlrpc_error_transport: string = xmlrpc_error_transport_str; break; } simplestring_add(&description, string); if(string && fault_string) { simplestring_add(&description, ""\n\n""); } simplestring_add(&description, fault_string); if(description.len) { xOutput = XMLRPC_CreateVector(NULL, xmlrpc_vector_struct); XMLRPC_VectorAppendString (xOutput, ""faultString"", description.str, description.len); XMLRPC_VectorAppendInt(xOutput, ""faultCode"", fault_code); } simplestring_free(&description); return xOutput; } ",0 "bool WebLocalFrameImpl::ExecuteCommand(const WebString& name, const WebString& value) { DCHECK(GetFrame()); std::unique_ptr gesture_indicator = Frame::NotifyUserActivation(GetFrame(), UserGestureToken::kNewGesture); WebPluginContainerImpl* plugin_container = GetFrame()->GetWebPluginContainer(); if (plugin_container && plugin_container->ExecuteEditCommand(name, value)) return true; return GetFrame()->GetEditor().ExecuteCommand(name, value); } ",0 "static void debugCallback (int fd, short flags, void *param) { int acceptFD, option; struct sockaddr_un peeraddr; socklen_t socklen = sizeof (peeraddr); int data; unsigned int qxdm_data[6]; const char *deactData[1] = {""1""}; char *actData[1]; RIL_Dial dialData; int hangupData[1] = {1}; int number; char **args; RIL_SOCKET_ID socket_id = RIL_SOCKET_1; int sim_id = 0; RLOGI(""debugCallback for socket %s"", rilSocketIdToString(socket_id)); acceptFD = accept (fd, (sockaddr *) &peeraddr, &socklen); if (acceptFD < 0) { RLOGE (""error accepting on debug port: %d\n"", errno); return; } if (recv(acceptFD, &number, sizeof(int), 0) != sizeof(int)) { RLOGE (""error reading on socket: number of Args: \n""); close(acceptFD); return; } if (number < 0) { RLOGE (""Invalid number of arguments: \n""); close(acceptFD); return; } args = (char **) calloc(number, sizeof(char*)); if (args == NULL) { RLOGE(""Memory allocation failed for debug args""); close(acceptFD); return; } for (int i = 0; i < number; i++) { int len; if (recv(acceptFD, &len, sizeof(int), 0) != sizeof(int)) { RLOGE (""error reading on socket: Len of Args: \n""); freeDebugCallbackArgs(i, args); close(acceptFD); return; } if (len == INT_MAX || len < 0) { RLOGE(""Invalid value of len: \n""); freeDebugCallbackArgs(i, args); close(acceptFD); return; } args[i] = (char *) calloc(len + 1, sizeof(char)); if (args[i] == NULL) { RLOGE(""Memory allocation failed for debug args""); freeDebugCallbackArgs(i, args); close(acceptFD); return; } if (recv(acceptFD, args[i], sizeof(char) * len, 0) != (int)sizeof(char) * len) { RLOGE (""error reading on socket: Args[%d] \n"", i); freeDebugCallbackArgs(i, args); close(acceptFD); return; } char * buf = args[i]; buf[len] = 0; if ((i+1) == number) { /* The last argument should be sim id 0(SIM1)~3(SIM4) */ sim_id = atoi(args[i]); switch (sim_id) { case 0: socket_id = RIL_SOCKET_1; break; #if (SIM_COUNT >= 2) case 1: socket_id = RIL_SOCKET_2; break; #endif #if (SIM_COUNT >= 3) case 2: socket_id = RIL_SOCKET_3; break; #endif #if (SIM_COUNT >= 4) case 3: socket_id = RIL_SOCKET_4; break; #endif default: socket_id = RIL_SOCKET_1; break; } } } switch (atoi(args[0])) { case 0: RLOGI (""Connection on debug port: issuing reset.""); issueLocalRequest(RIL_REQUEST_RESET_RADIO, NULL, 0, socket_id); break; case 1: RLOGI (""Connection on debug port: issuing radio power off.""); data = 0; issueLocalRequest(RIL_REQUEST_RADIO_POWER, &data, sizeof(int), socket_id); if (socket_id == RIL_SOCKET_1 && s_ril_param_socket.fdCommand > 0) { close(s_ril_param_socket.fdCommand); s_ril_param_socket.fdCommand = -1; } #if (SIM_COUNT == 2) else if (socket_id == RIL_SOCKET_2 && s_ril_param_socket2.fdCommand > 0) { close(s_ril_param_socket2.fdCommand); s_ril_param_socket2.fdCommand = -1; } #endif break; case 2: RLOGI (""Debug port: issuing unsolicited voice network change.""); RIL_UNSOL_RESPONSE(RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED, NULL, 0, socket_id); break; case 3: RLOGI (""Debug port: QXDM log enable.""); qxdm_data[0] = 65536; // head.func_tag qxdm_data[1] = 16; // head.len qxdm_data[2] = 1; // mode: 1 for 'start logging' qxdm_data[3] = 32; // log_file_size: 32megabytes qxdm_data[4] = 0; // log_mask qxdm_data[5] = 8; // log_max_fileindex issueLocalRequest(RIL_REQUEST_OEM_HOOK_RAW, qxdm_data, 6 * sizeof(int), socket_id); break; case 4: RLOGI (""Debug port: QXDM log disable.""); qxdm_data[0] = 65536; qxdm_data[1] = 16; qxdm_data[2] = 0; // mode: 0 for 'stop logging' qxdm_data[3] = 32; qxdm_data[4] = 0; qxdm_data[5] = 8; issueLocalRequest(RIL_REQUEST_OEM_HOOK_RAW, qxdm_data, 6 * sizeof(int), socket_id); break; case 5: RLOGI(""Debug port: Radio On""); data = 1; issueLocalRequest(RIL_REQUEST_RADIO_POWER, &data, sizeof(int), socket_id); sleep(2); issueLocalRequest(RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC, NULL, 0, socket_id); break; case 6: RLOGI(""Debug port: Setup Data Call, Apn :%s\n"", args[1]); actData[0] = args[1]; issueLocalRequest(RIL_REQUEST_SETUP_DATA_CALL, &actData, sizeof(actData), socket_id); break; case 7: RLOGI(""Debug port: Deactivate Data Call""); issueLocalRequest(RIL_REQUEST_DEACTIVATE_DATA_CALL, &deactData, sizeof(deactData), socket_id); break; case 8: RLOGI(""Debug port: Dial Call""); dialData.clir = 0; dialData.address = args[1]; issueLocalRequest(RIL_REQUEST_DIAL, &dialData, sizeof(dialData), socket_id); break; case 9: RLOGI(""Debug port: Answer Call""); issueLocalRequest(RIL_REQUEST_ANSWER, NULL, 0, socket_id); break; case 10: RLOGI(""Debug port: End Call""); issueLocalRequest(RIL_REQUEST_HANGUP, &hangupData, sizeof(hangupData), socket_id); break; default: RLOGE (""Invalid request""); break; } freeDebugCallbackArgs(number, args); close(acceptFD); } ",1 "void ReverbSetDecayTime(ReverbContext *pContext, uint32_t time){ LVREV_ControlParams_st ActiveParams; /* Current control Parameters */ LVREV_ReturnStatus_en LvmStatus=LVREV_SUCCESS; /* Function call status */ /* Get the current settings */ LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams); LVM_ERROR_CHECK(LvmStatus, ""LVREV_GetControlParameters"", ""ReverbSetDecayTime"") if (time <= LVREV_MAX_T60) { ActiveParams.T60 = (LVM_UINT16)time; } else { ActiveParams.T60 = LVREV_MAX_T60; } /* Activate the initial settings */ LvmStatus = LVREV_SetControlParameters(pContext->hInstance, &ActiveParams); LVM_ERROR_CHECK(LvmStatus, ""LVREV_SetControlParameters"", ""ReverbSetDecayTime"") pContext->SamplesToExitCount = (ActiveParams.T60 * pContext->config.inputCfg.samplingRate)/1000; pContext->SavedDecayTime = (int16_t)time; return; } ",0 "Vector Document::IconURLs(int icon_types_mask) { IconURL first_favicon; IconURL first_touch_icon; IconURL first_touch_precomposed_icon; Vector secondary_icons; using TraversalFunction = HTMLLinkElement* (*)(const Node&); TraversalFunction find_next_candidate = &Traversal::NextSibling; HTMLLinkElement* first_element = nullptr; if (head()) { first_element = Traversal::FirstChild(*head()); } else if (IsSVGDocument() && IsSVGSVGElement(documentElement())) { first_element = Traversal::FirstWithin(*documentElement()); find_next_candidate = &Traversal::Next; } for (HTMLLinkElement* link_element = first_element; link_element; link_element = find_next_candidate(*link_element)) { if (!(link_element->GetIconType() & icon_types_mask)) continue; if (link_element->Href().IsEmpty()) continue; IconURL new_url(link_element->Href(), link_element->IconSizes(), link_element->GetType(), link_element->GetIconType()); if (link_element->GetIconType() == kFavicon) { if (first_favicon.icon_type_ != kInvalidIcon) secondary_icons.push_back(first_favicon); first_favicon = new_url; } else if (link_element->GetIconType() == kTouchIcon) { if (first_touch_icon.icon_type_ != kInvalidIcon) secondary_icons.push_back(first_touch_icon); first_touch_icon = new_url; } else if (link_element->GetIconType() == kTouchPrecomposedIcon) { if (first_touch_precomposed_icon.icon_type_ != kInvalidIcon) secondary_icons.push_back(first_touch_precomposed_icon); first_touch_precomposed_icon = new_url; } else { NOTREACHED(); } } Vector icon_urls; if (first_favicon.icon_type_ != kInvalidIcon) icon_urls.push_back(first_favicon); else if (url_.ProtocolIsInHTTPFamily() && icon_types_mask & kFavicon) icon_urls.push_back(IconURL::DefaultFavicon(url_)); if (first_touch_icon.icon_type_ != kInvalidIcon) icon_urls.push_back(first_touch_icon); if (first_touch_precomposed_icon.icon_type_ != kInvalidIcon) icon_urls.push_back(first_touch_precomposed_icon); for (int i = secondary_icons.size() - 1; i >= 0; --i) icon_urls.push_back(secondary_icons[i]); return icon_urls; } ",0 "SProcRenderAddGlyphsFromPicture (ClientPtr client) { return BadImplementation; } ",0 "void GLES2DecoderPassthroughImpl::EmulatedDefaultFramebuffer::Destroy( bool have_context) { if (have_context) { api->glDeleteFramebuffersEXTFn(1, &framebuffer_service_id); framebuffer_service_id = 0; api->glDeleteRenderbuffersEXTFn(1, &color_buffer_service_id); color_buffer_service_id = 0; api->glDeleteRenderbuffersEXTFn(1, &depth_stencil_buffer_service_id); color_buffer_service_id = 0; api->glDeleteRenderbuffersEXTFn(1, &depth_buffer_service_id); depth_buffer_service_id = 0; api->glDeleteRenderbuffersEXTFn(1, &stencil_buffer_service_id); stencil_buffer_service_id = 0; } if (color_texture) { color_texture->Destroy(have_context); } } ",0 "static int pppol2tp_getname(struct socket *sock, struct sockaddr *uaddr, int *usockaddr_len, int peer) { int len = 0; int error = 0; struct l2tp_session *session; struct l2tp_tunnel *tunnel; struct sock *sk = sock->sk; struct inet_sock *inet; struct pppol2tp_session *pls; error = -ENOTCONN; if (sk == NULL) goto end; if (sk->sk_state != PPPOX_CONNECTED) goto end; error = -EBADF; session = pppol2tp_sock_to_session(sk); if (session == NULL) goto end; pls = l2tp_session_priv(session); tunnel = l2tp_sock_to_tunnel(pls->tunnel_sock); if (tunnel == NULL) { error = -EBADF; goto end_put_sess; } inet = inet_sk(tunnel->sock); if ((tunnel->version == 2) && (tunnel->sock->sk_family == AF_INET)) { struct sockaddr_pppol2tp sp; len = sizeof(sp); memset(&sp, 0, len); sp.sa_family = AF_PPPOX; sp.sa_protocol = PX_PROTO_OL2TP; sp.pppol2tp.fd = tunnel->fd; sp.pppol2tp.pid = pls->owner; sp.pppol2tp.s_tunnel = tunnel->tunnel_id; sp.pppol2tp.d_tunnel = tunnel->peer_tunnel_id; sp.pppol2tp.s_session = session->session_id; sp.pppol2tp.d_session = session->peer_session_id; sp.pppol2tp.addr.sin_family = AF_INET; sp.pppol2tp.addr.sin_port = inet->inet_dport; sp.pppol2tp.addr.sin_addr.s_addr = inet->inet_daddr; memcpy(uaddr, &sp, len); #if IS_ENABLED(CONFIG_IPV6) } else if ((tunnel->version == 2) && (tunnel->sock->sk_family == AF_INET6)) { struct sockaddr_pppol2tpin6 sp; len = sizeof(sp); memset(&sp, 0, len); sp.sa_family = AF_PPPOX; sp.sa_protocol = PX_PROTO_OL2TP; sp.pppol2tp.fd = tunnel->fd; sp.pppol2tp.pid = pls->owner; sp.pppol2tp.s_tunnel = tunnel->tunnel_id; sp.pppol2tp.d_tunnel = tunnel->peer_tunnel_id; sp.pppol2tp.s_session = session->session_id; sp.pppol2tp.d_session = session->peer_session_id; sp.pppol2tp.addr.sin6_family = AF_INET6; sp.pppol2tp.addr.sin6_port = inet->inet_dport; memcpy(&sp.pppol2tp.addr.sin6_addr, &tunnel->sock->sk_v6_daddr, sizeof(tunnel->sock->sk_v6_daddr)); memcpy(uaddr, &sp, len); } else if ((tunnel->version == 3) && (tunnel->sock->sk_family == AF_INET6)) { struct sockaddr_pppol2tpv3in6 sp; len = sizeof(sp); memset(&sp, 0, len); sp.sa_family = AF_PPPOX; sp.sa_protocol = PX_PROTO_OL2TP; sp.pppol2tp.fd = tunnel->fd; sp.pppol2tp.pid = pls->owner; sp.pppol2tp.s_tunnel = tunnel->tunnel_id; sp.pppol2tp.d_tunnel = tunnel->peer_tunnel_id; sp.pppol2tp.s_session = session->session_id; sp.pppol2tp.d_session = session->peer_session_id; sp.pppol2tp.addr.sin6_family = AF_INET6; sp.pppol2tp.addr.sin6_port = inet->inet_dport; memcpy(&sp.pppol2tp.addr.sin6_addr, &tunnel->sock->sk_v6_daddr, sizeof(tunnel->sock->sk_v6_daddr)); memcpy(uaddr, &sp, len); #endif } else if (tunnel->version == 3) { struct sockaddr_pppol2tpv3 sp; len = sizeof(sp); memset(&sp, 0, len); sp.sa_family = AF_PPPOX; sp.sa_protocol = PX_PROTO_OL2TP; sp.pppol2tp.fd = tunnel->fd; sp.pppol2tp.pid = pls->owner; sp.pppol2tp.s_tunnel = tunnel->tunnel_id; sp.pppol2tp.d_tunnel = tunnel->peer_tunnel_id; sp.pppol2tp.s_session = session->session_id; sp.pppol2tp.d_session = session->peer_session_id; sp.pppol2tp.addr.sin_family = AF_INET; sp.pppol2tp.addr.sin_port = inet->inet_dport; sp.pppol2tp.addr.sin_addr.s_addr = inet->inet_daddr; memcpy(uaddr, &sp, len); } *usockaddr_len = len; sock_put(pls->tunnel_sock); end_put_sess: sock_put(sk); error = 0; end: return error; } ",0 "ApplyBlockElementCommand::ApplyBlockElementCommand(Document& document, const QualifiedName& tagName) : CompositeEditCommand(document) , m_tagName(tagName) { } ",0 "static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, long elements, int objprops) { while (elements-- > 0) { zval *key, *data, **old_data; ALLOC_INIT_ZVAL(key); if (!php_var_unserialize(&key, p, max, NULL TSRMLS_CC)) { zval_dtor(key); FREE_ZVAL(key); return 0; } if (Z_TYPE_P(key) != IS_LONG && Z_TYPE_P(key) != IS_STRING) { zval_dtor(key); FREE_ZVAL(key); return 0; } ALLOC_INIT_ZVAL(data); if (!php_var_unserialize(&data, p, max, var_hash TSRMLS_CC)) { zval_dtor(key); FREE_ZVAL(key); zval_dtor(data); FREE_ZVAL(data); return 0; } if (!objprops) { switch (Z_TYPE_P(key)) { case IS_LONG: if (zend_hash_index_find(ht, Z_LVAL_P(key), (void **)&old_data)==SUCCESS) { var_push_dtor(var_hash, old_data); } zend_hash_index_update(ht, Z_LVAL_P(key), &data, sizeof(data), NULL); break; case IS_STRING: if (zend_symtable_find(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&old_data)==SUCCESS) { var_push_dtor(var_hash, old_data); } zend_symtable_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data, sizeof(data), NULL); break; } } else { /* object properties should include no integers */ convert_to_string(key); zend_hash_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data, sizeof data, NULL); } if (elements && *(*p-1) != ';' && *(*p-1) != '}') { (*p)--; return 0; } } ",1 "void conn_free(conn *c) { if (c) { assert(c != NULL); assert(c->sfd >= 0 && c->sfd < max_fds); MEMCACHED_CONN_DESTROY(c); conns[c->sfd] = NULL; if (c->hdrbuf) free(c->hdrbuf); if (c->msglist) free(c->msglist); if (c->rbuf) free(c->rbuf); if (c->wbuf) free(c->wbuf); if (c->ilist) free(c->ilist); if (c->suffixlist) free(c->suffixlist); if (c->iov) free(c->iov); free(c); } } ",0 " static void registerStreamURLTask(void* context) { OwnPtr blobRegistryContext = adoptPtr(static_cast(context)); blobRegistry().registerStreamURL(blobRegistryContext->url, blobRegistryContext->type); } ",1 "int phar_entry_delref(phar_entry_data *idata) /* {{{ */ { int ret = 0; if (idata->internal_file && !idata->internal_file->is_persistent) { if (--idata->internal_file->fp_refcount < 0) { idata->internal_file->fp_refcount = 0; } if (idata->fp && idata->fp != idata->phar->fp && idata->fp != idata->phar->ufp && idata->fp != idata->internal_file->fp) { php_stream_close(idata->fp); } /* if phar_get_or_create_entry_data returns a sub-directory, we have to free it */ if (idata->internal_file->is_temp_dir) { destroy_phar_manifest_entry_int(idata->internal_file); efree(idata->internal_file); } } phar_archive_delref(idata->phar); efree(idata); return ret; } /* }}} */ ",0 "error::Error GLES2DecoderPassthroughImpl::DoDescheduleUntilFinishedCHROMIUM() { if (!gl::GLFence::IsSupported()) { return error::kNoError; } deschedule_until_finished_fences_.push_back(gl::GLFence::Create()); if (deschedule_until_finished_fences_.size() == 1) { return error::kNoError; } DCHECK_EQ(2u, deschedule_until_finished_fences_.size()); if (deschedule_until_finished_fences_[0]->HasCompleted()) { deschedule_until_finished_fences_.erase( deschedule_until_finished_fences_.begin()); return error::kNoError; } TRACE_EVENT_ASYNC_BEGIN0( ""cc"", ""GLES2DecoderPassthroughImpl::DescheduleUntilFinished"", this); client()->OnDescheduleUntilFinished(); return error::kDeferLaterCommands; } ",0 "void HTMLCanvasElement::SetSize(const IntSize& new_size) { if (new_size == Size()) return; ignore_reset_ = true; SetIntegralAttribute(kWidthAttr, new_size.Width()); SetIntegralAttribute(kHeightAttr, new_size.Height()); ignore_reset_ = false; Reset(); } ",0 "FPDF_SYSTEMTIME PDFiumEngine::Form_GetLocalTime(FPDF_FORMFILLINFO* param) { base::Time time = base::Time::Now(); base::Time::Exploded exploded; time.LocalExplode(&exploded); FPDF_SYSTEMTIME rv; rv.wYear = exploded.year; rv.wMonth = exploded.month; rv.wDayOfWeek = exploded.day_of_week; rv.wDay = exploded.day_of_month; rv.wHour = exploded.hour; rv.wMinute = exploded.minute; rv.wSecond = exploded.second; rv.wMilliseconds = exploded.millisecond; return rv; } ",0 "error::Error GLES2DecoderImpl::HandleCompressedTexImage3DBucket( uint32_t immediate_data_size, const volatile void* cmd_data) { if (!feature_info_->IsWebGL2OrES3Context()) return error::kUnknownCommand; const volatile gles2::cmds::CompressedTexImage3DBucket& c = *static_cast( cmd_data); GLenum target = static_cast(c.target); GLint level = static_cast(c.level); GLenum internal_format = static_cast(c.internalformat); GLsizei width = static_cast(c.width); GLsizei height = static_cast(c.height); GLsizei depth = static_cast(c.depth); GLuint bucket_id = static_cast(c.bucket_id); GLint border = static_cast(c.border); if (state_.bound_pixel_unpack_buffer.get()) { return error::kInvalidArguments; } Bucket* bucket = GetBucket(bucket_id); if (!bucket) return error::kInvalidArguments; uint32_t image_size = bucket->size(); const void* data = bucket->GetData(0, image_size); DCHECK(data || !image_size); return DoCompressedTexImage(target, level, internal_format, width, height, depth, border, image_size, data, ContextState::k3D); } ",0 "bool GLManager::CanWaitUnverifiedSyncToken(const gpu::SyncToken& sync_token) { return false; } ",0 "LayerTreeHostImpl::ScrollbarAnimationControllerForId( int scroll_layer_id) const { if (InnerViewportScrollLayer() && OuterViewportScrollLayer() && scroll_layer_id == InnerViewportScrollLayer()->id()) scroll_layer_id = OuterViewportScrollLayer()->id(); auto i = scrollbar_animation_controllers_.find(scroll_layer_id); if (i == scrollbar_animation_controllers_.end()) return nullptr; return i->second.get(); } ",0 "VOID ProcessSGListHandler( IN PDEVICE_OBJECT pDO, IN PVOID Reserved, IN PSCATTER_GATHER_LIST pSGL, IN PVOID Context ) { UNREFERENCED_PARAMETER(Reserved); UNREFERENCED_PARAMETER(pDO); auto NBHolder = static_cast(Context); NBHolder->MappingDone(pSGL); } ",0 "void LayoutTestContentBrowserClient::GetAdditionalNavigatorConnectServices( const scoped_refptr& context) { context->AddFactory( make_scoped_ptr(new LayoutTestNavigatorConnectServiceFactory)); } ",0 "status_t CameraClient::setPreviewCallbackTarget( const sp& callbackProducer) { (void)callbackProducer; ALOGE(""%s: Unimplemented!"", __FUNCTION__); return INVALID_OPERATION; } ",0 "static int AppLayerProtoDetectPMMapSignatures(AppLayerProtoDetectPMCtx *ctx) { SCEnter(); int ret = 0; AppLayerProtoDetectPMSignature *s, *next_s; int mpm_ret; SigIntId id = 0; ctx->map = SCMalloc(ctx->max_sig_id * sizeof(AppLayerProtoDetectPMSignature *)); if (ctx->map == NULL) goto error; memset(ctx->map, 0, ctx->max_sig_id * sizeof(AppLayerProtoDetectPMSignature *)); /* add an array indexed by rule id to look up the sig */ for (s = ctx->head; s != NULL; ) { next_s = s->next; s->id = id++; SCLogDebug(""s->id %u"", s->id); if (s->cd->flags & DETECT_CONTENT_NOCASE) { mpm_ret = MpmAddPatternCI(&ctx->mpm_ctx, s->cd->content, s->cd->content_len, 0, 0, s->cd->id, s->id, 0); if (mpm_ret < 0) goto error; } else { mpm_ret = MpmAddPatternCS(&ctx->mpm_ctx, s->cd->content, s->cd->content_len, 0, 0, s->cd->id, s->id, 0); if (mpm_ret < 0) goto error; } ctx->map[s->id] = s; s->next = NULL; s = next_s; } ctx->head = NULL; goto end; error: ret = -1; end: SCReturnInt(ret); } ",0 "FcDirCacheBasename (const FcChar8 * dir, FcChar8 cache_base[CACHEBASE_LEN]) { unsigned char hash[16]; FcChar8 *hex_hash; int cnt; struct MD5Context ctx; MD5Init (&ctx); MD5Update (&ctx, (const unsigned char *)dir, strlen ((const char *) dir)); MD5Final (hash, &ctx); cache_base[0] = '/'; hex_hash = cache_base + 1; for (cnt = 0; cnt < 16; ++cnt) { hex_hash[2*cnt ] = bin2hex[hash[cnt] >> 4]; hex_hash[2*cnt+1] = bin2hex[hash[cnt] & 0xf]; } hex_hash[2*cnt] = 0; strcat ((char *) cache_base, ""-"" FC_ARCHITECTURE FC_CACHE_SUFFIX); return cache_base; } ",0 "void QQuickWebViewPrivate::addAttachedPropertyTo(QObject* object) { Q_Q(QQuickWebView); QQuickWebViewAttached* attached = static_cast(qmlAttachedPropertiesObject(object)); attached->setView(q); } ",0 "static void cmd_parse_expunge(struct ImapData *idata, const char *s) { unsigned int exp_msn; struct Header *h = NULL; mutt_debug(2, ""Handling EXPUNGE\n""); if (mutt_str_atoui(s, &exp_msn) < 0 || exp_msn < 1 || exp_msn > idata->max_msn) return; h = idata->msn_index[exp_msn - 1]; if (h) { /* imap_expunge_mailbox() will rewrite h->index. * It needs to resort using SORT_ORDER anyway, so setting to INT_MAX * makes the code simpler and possibly more efficient. */ h->index = INT_MAX; HEADER_DATA(h)->msn = 0; } /* decrement seqno of those above. */ for (unsigned int cur = exp_msn; cur < idata->max_msn; cur++) { h = idata->msn_index[cur]; if (h) HEADER_DATA(h)->msn--; idata->msn_index[cur - 1] = h; } idata->msn_index[idata->max_msn - 1] = NULL; idata->max_msn--; idata->reopen |= IMAP_EXPUNGE_PENDING; } ",0 " PP_Bool LaunchSelLdr(PP_Instance instance, const char* alleged_url, int socket_count, void* imc_handles) { std::vector sockets; IPC::Sender* sender = content::RenderThread::Get(); if (sender == NULL) sender = g_background_thread_sender.Pointer()->get(); IPC::ChannelHandle channel_handle; if (!sender->Send(new ChromeViewHostMsg_LaunchNaCl( GURL(alleged_url), socket_count, &sockets, &channel_handle))) { return PP_FALSE; } bool invalid_handle = channel_handle.name.empty(); #if defined(OS_POSIX) if (!invalid_handle) invalid_handle = (channel_handle.socket.fd == -1); #endif if (!invalid_handle) g_channel_handle_map.Get()[instance] = channel_handle; CHECK(static_cast(sockets.size()) == socket_count); for (int i = 0; i < socket_count; i++) { static_cast(imc_handles)[i] = nacl::ToNativeHandle(sockets[i]); } return PP_TRUE; } ",1 "VideoCaptureManager::GetControllerSharedRef( VideoCaptureController* controller) const { DCHECK_CURRENTLY_ON(BrowserThread::IO); for (const auto& entry : controllers_) { if (entry.get() == controller) return entry; } return nullptr; } ",0 " bool received_notification() const { return received_notification_; } ",0 "void WebPluginDelegatePepper::UpdateGeometry( const gfx::Rect& window_rect, const gfx::Rect& clip_rect) { if (window_rect == window_rect_ && clip_rect == clip_rect_) return; clip_rect_ = clip_rect; cutout_rects_.clear(); if (window_rect_ == window_rect) return; window_rect_ = window_rect; SkBitmap new_committed; new_committed.setConfig(SkBitmap::kARGB_8888_Config, window_rect_.width(), window_rect.height()); new_committed.allocPixels(); committed_bitmap_ = new_committed; if (nested_delegate_) nested_delegate_->UpdateGeometry(window_rect, clip_rect); if (!instance()) return; window_.clipRect.top = clip_rect_.y(); window_.clipRect.left = clip_rect_.x(); window_.clipRect.bottom = clip_rect_.y() + clip_rect_.height(); window_.clipRect.right = clip_rect_.x() + clip_rect_.width(); window_.height = window_rect_.height(); window_.width = window_rect_.width(); window_.x = window_rect_.x(); window_.y = window_rect_.y(); window_.type = NPWindowTypeDrawable; instance()->NPP_SetWindow(&window_); } ",0 "void ExtensionSystemImpl::Shutdown() { extension_process_manager_.reset(); } ",0 "void BrowserPluginGuest::UpdateRect( RenderViewHost* render_view_host, const ViewHostMsg_UpdateRect_Params& params) { if (!params.needs_ack) return; if (((auto_size_enabled_ && InAutoSizeBounds(params.view_size)) || (params.view_size.width() == damage_view_size().width() && params.view_size.height() == damage_view_size().height())) && params.scale_factor == damage_buffer_scale_factor()) { TransportDIB* dib = render_view_host->GetProcess()-> GetTransportDIB(params.bitmap); if (dib) { #if defined(OS_WIN) size_t guest_damage_buffer_size = params.bitmap_rect.width() * params.bitmap_rect.height() * 4; size_t embedder_damage_buffer_size = damage_buffer_size_; #else size_t guest_damage_buffer_size = dib->size(); size_t embedder_damage_buffer_size = damage_buffer_->size(); #endif void* guest_memory = dib->memory(); void* embedder_memory = damage_buffer_->memory(); size_t size = std::min(guest_damage_buffer_size, embedder_damage_buffer_size); memcpy(embedder_memory, guest_memory, size); } } BrowserPluginMsg_UpdateRect_Params relay_params; #if defined(OS_MACOSX) relay_params.damage_buffer_identifier = damage_buffer_->id(); #elif defined(OS_WIN) relay_params.damage_buffer_identifier = remote_damage_buffer_handle_; #else relay_params.damage_buffer_identifier = damage_buffer_->handle(); #endif relay_params.bitmap_rect = params.bitmap_rect; relay_params.scroll_delta = params.scroll_delta; relay_params.scroll_rect = params.scroll_rect; relay_params.copy_rects = params.copy_rects; relay_params.view_size = params.view_size; relay_params.scale_factor = params.scale_factor; relay_params.is_resize_ack = ViewHostMsg_UpdateRect_Flags::is_resize_ack( params.flags); int message_id = pending_update_counter_++; pending_updates_.AddWithID(render_view_host, message_id); SendMessageToEmbedder(new BrowserPluginMsg_UpdateRect(embedder_routing_id(), instance_id(), message_id, relay_params)); } ",0 "void RenderViewHostManager::SetWebUIPostCommit(WebUIImpl* web_ui) { DCHECK(!web_ui_.get()); web_ui_.reset(web_ui); } ",0 "static long __vma_reservation_common(struct hstate *h, struct vm_area_struct *vma, unsigned long addr, enum vma_resv_mode mode) { struct resv_map *resv; pgoff_t idx; long ret; resv = vma_resv_map(vma); if (!resv) return 1; idx = vma_hugecache_offset(h, vma, addr); switch (mode) { case VMA_NEEDS_RESV: ret = region_chg(resv, idx, idx + 1); break; case VMA_COMMIT_RESV: ret = region_add(resv, idx, idx + 1); break; case VMA_END_RESV: region_abort(resv, idx, idx + 1); ret = 0; break; case VMA_ADD_RESV: if (vma->vm_flags & VM_MAYSHARE) ret = region_add(resv, idx, idx + 1); else { region_abort(resv, idx, idx + 1); ret = region_del(resv, idx, idx + 1); } break; default: BUG(); } if (vma->vm_flags & VM_MAYSHARE) return ret; else if (is_vma_resv_set(vma, HPAGE_RESV_OWNER) && ret >= 0) { /* * In most cases, reserves always exist for private mappings. * However, a file associated with mapping could have been * hole punched or truncated after reserves were consumed. * As subsequent fault on such a range will not use reserves. * Subtle - The reserve map for private mappings has the * opposite meaning than that of shared mappings. If NO * entry is in the reserve map, it means a reservation exists. * If an entry exists in the reserve map, it means the * reservation has already been consumed. As a result, the * return value of this routine is the opposite of the * value returned from reserve map manipulation routines above. */ if (ret) return 0; else return 1; } else return ret < 0 ? ret : 0; } ",0 "void WebContentsViewAura::OnDragEntered(const ui::DropTargetEvent& event) { if (drag_dest_delegate_) drag_dest_delegate_->DragInitialize(web_contents_); current_drop_data_.reset(new DropData()); PrepareDropData(current_drop_data_.get(), event.data()); blink::WebDragOperationsMask op = ConvertToWeb(event.source_operations()); gfx::Point screen_pt = gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(); current_rvh_for_drag_ = web_contents_->GetRenderViewHost(); web_contents_->GetRenderViewHost()->DragTargetDragEnter( *current_drop_data_.get(), event.location(), screen_pt, op, ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); if (drag_dest_delegate_) { drag_dest_delegate_->OnReceiveDragData(event.data()); drag_dest_delegate_->OnDragEnter(); } } ",0 "bool PrintWebViewHelper::GetPrintSettingsFromUser(WebFrame* frame, int expected_pages_count, bool use_browser_overlays) { ViewHostMsg_ScriptedPrint_Params params; ViewMsg_PrintPages_Params print_settings; params.routing_id = routing_id(); params.host_window_id = render_view_->host_window(); params.cookie = (*print_pages_params_).params.document_cookie; params.has_selection = frame->hasSelection(); params.expected_pages_count = expected_pages_count; params.use_overlays = use_browser_overlays; print_pages_params_.reset(); IPC::SyncMessage* msg = new ViewHostMsg_ScriptedPrint(routing_id(), params, &print_settings); msg->EnableMessagePumping(); if (Send(msg)) { print_pages_params_.reset(new ViewMsg_PrintPages_Params(print_settings)); } else { NOTREACHED(); return false; } return (print_settings.params.dpi && print_settings.params.document_cookie); } ",0 "static ssize_t macvtap_aio_read(struct kiocb *iocb, const struct iovec *iv, unsigned long count, loff_t pos) { struct file *file = iocb->ki_filp; struct macvtap_queue *q = file->private_data; ssize_t len, ret = 0; len = iov_length(iv, count); if (len < 0) { ret = -EINVAL; goto out; } ret = macvtap_do_read(q, iocb, iv, len, file->f_flags & O_NONBLOCK); ret = min_t(ssize_t, ret, len); /* XXX copied from tun.c. Why? */ out: return ret; } ",0 "Node* Range::firstNode() const { if (!m_start.container()) return 0; if (m_start.container()->offsetInCharacters()) return m_start.container(); if (Node* child = m_start.container()->childNode(m_start.offset())) return child; if (!m_start.offset()) return m_start.container(); return m_start.container()->traverseNextSibling(); } ",0 "void GKI_enable(void) { pthread_mutex_unlock(&gki_cb.lock); } ",0 "static int __init tg3_init(void) { return pci_register_driver(&tg3_driver); } ",0 "vmxnet3_receive(NetClientState *nc, const uint8_t *buf, size_t size) { VMXNET3State *s = qemu_get_nic_opaque(nc); size_t bytes_indicated; uint8_t min_buf[MIN_BUF_SIZE]; if (!vmxnet3_can_receive(nc)) { VMW_PKPRN(""Cannot receive now""); return -1; } if (s->peer_has_vhdr) { net_rx_pkt_set_vhdr(s->rx_pkt, (struct virtio_net_hdr *)buf); buf += sizeof(struct virtio_net_hdr); size -= sizeof(struct virtio_net_hdr); } /* Pad to minimum Ethernet frame length */ if (size < sizeof(min_buf)) { memcpy(min_buf, buf, size); memset(&min_buf[size], 0, sizeof(min_buf) - size); buf = min_buf; size = sizeof(min_buf); } net_rx_pkt_set_packet_type(s->rx_pkt, get_eth_packet_type(PKT_GET_ETH_HDR(buf))); if (vmxnet3_rx_filter_may_indicate(s, buf, size)) { net_rx_pkt_set_protocols(s->rx_pkt, buf, size); vmxnet3_rx_need_csum_calculate(s->rx_pkt, buf, size); net_rx_pkt_attach_data(s->rx_pkt, buf, size, s->rx_vlan_stripping); bytes_indicated = vmxnet3_indicate_packet(s) ? size : -1; if (bytes_indicated < size) { VMW_PKPRN(""RX: %zu of %zu bytes indicated"", bytes_indicated, size); } } else { VMW_PKPRN(""Packet dropped by RX filter""); bytes_indicated = size; } assert(size > 0); assert(bytes_indicated != 0); return bytes_indicated; } ",0 "static inline float measureHyphenWidth(RenderText* renderer, const Font& font) { RenderStyle* style = renderer->style(); return font.width(RenderBlock::constructTextRun(renderer, font, style->hyphenString().string(), style)); } ",0 "static void rdma_dealloc_frmr_q(struct svcxprt_rdma *xprt) { struct svc_rdma_fastreg_mr *frmr; while (!list_empty(&xprt->sc_frmr_q)) { frmr = list_entry(xprt->sc_frmr_q.next, struct svc_rdma_fastreg_mr, frmr_list); list_del_init(&frmr->frmr_list); kfree(frmr->sg); ib_dereg_mr(frmr->mr); kfree(frmr); } } ",0 "WakeLockServiceContext* WebContentsImpl::GetWakeLockServiceContext() { return wake_lock_service_context_.get(); } ",0 " inline HTMLIFrameElement::HTMLIFrameElement(Document& document) : HTMLFrameElementBase(iframeTag, document), did_load_non_empty_document_(false), collapsed_by_client_(false), sandbox_(HTMLIFrameElementSandbox::Create(this)), referrer_policy_(kReferrerPolicyDefault) {} ",1 "static size_t ComplexTextLayout(const Image *image,const DrawInfo *draw_info, const char *text,const size_t length,const FT_Face face,const FT_Int32 flags, GraphemeInfo **grapheme) { #if defined(MAGICKCORE_RAQM_DELEGATE) const char *features; raqm_t *rq; raqm_glyph_t *glyphs; register ssize_t i; size_t extent; extent=0; rq=raqm_create(); if (rq == (raqm_t *) NULL) goto cleanup; if (raqm_set_text_utf8(rq,text,length) == 0) goto cleanup; if (raqm_set_par_direction(rq,(raqm_direction_t) draw_info->direction) == 0) goto cleanup; if (raqm_set_freetype_face(rq,face) == 0) goto cleanup; features=GetImageProperty(image,""type:features""); if (features != (const char *) NULL) { char breaker, quote, *token; int next, status_token; TokenInfo *token_info; next=0; token_info=AcquireTokenInfo(); token=AcquireString(""""); status_token=Tokenizer(token_info,0,token,50,features,"""","","","""",'\0', &breaker,&next,"e); while (status_token == 0) { raqm_add_font_feature(rq,token,strlen(token)); status_token=Tokenizer(token_info,0,token,50,features,"""","","","""",'\0', &breaker,&next,"e); } token_info=DestroyTokenInfo(token_info); token=DestroyString(token); } if (raqm_layout(rq) == 0) goto cleanup; glyphs=raqm_get_glyphs(rq,&extent); if (glyphs == (raqm_glyph_t *) NULL) { extent=0; goto cleanup; } *grapheme=(GraphemeInfo *) AcquireQuantumMemory(extent,sizeof(**grapheme)); if (*grapheme == (GraphemeInfo *) NULL) { extent=0; goto cleanup; } for (i=0; i < (ssize_t) extent; i++) { (*grapheme)[i].index=glyphs[i].index; (*grapheme)[i].x_offset=glyphs[i].x_offset; (*grapheme)[i].x_advance=glyphs[i].x_advance; (*grapheme)[i].y_offset=glyphs[i].y_offset; (*grapheme)[i].cluster=glyphs[i].cluster; } cleanup: raqm_destroy(rq); return(extent); #else const char *p; FT_Error ft_status; register ssize_t i; ssize_t last_glyph; /* Simple layout for bi-directional text (right-to-left or left-to-right). */ magick_unreferenced(image); *grapheme=(GraphemeInfo *) AcquireQuantumMemory(length+1,sizeof(**grapheme)); if (*grapheme == (GraphemeInfo *) NULL) return(0); last_glyph=0; p=text; for (i=0; GetUTFCode(p) != 0; p+=GetUTFOctets(p), i++) { (*grapheme)[i].index=FT_Get_Char_Index(face,GetUTFCode(p)); (*grapheme)[i].x_offset=0; (*grapheme)[i].y_offset=0; if (((*grapheme)[i].index != 0) && (last_glyph != 0)) { if (FT_HAS_KERNING(face)) { FT_Vector kerning; ft_status=FT_Get_Kerning(face,(FT_UInt) last_glyph,(FT_UInt) (*grapheme)[i].index,ft_kerning_default,&kerning); if (ft_status == 0) (*grapheme)[i-1].x_advance+=(FT_Pos) ((draw_info->direction == RightToLeftDirection ? -1.0 : 1.0)*kerning.x); } } ft_status=FT_Load_Glyph(face,(*grapheme)[i].index,flags); (*grapheme)[i].x_advance=face->glyph->advance.x; (*grapheme)[i].cluster=p-text; last_glyph=(*grapheme)[i].index; } return((size_t) i); #endif } ",0 "void PaymentRequest::OnShippingOptionIdSelected( std::string shipping_option_id) { client_->OnShippingOptionChange(shipping_option_id); } ",0 "FLAC_API FLAC__bool FLAC__stream_decoder_process_until_end_of_metadata(FLAC__StreamDecoder *decoder) { FLAC__ASSERT(0 != decoder); FLAC__ASSERT(0 != decoder->protected_); while(1) { switch(decoder->protected_->state) { case FLAC__STREAM_DECODER_SEARCH_FOR_METADATA: if(!find_metadata_(decoder)) return false; /* above function sets the status for us */ break; case FLAC__STREAM_DECODER_READ_METADATA: if(!read_metadata_(decoder)) return false; /* above function sets the status for us */ break; case FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC: case FLAC__STREAM_DECODER_READ_FRAME: case FLAC__STREAM_DECODER_END_OF_STREAM: case FLAC__STREAM_DECODER_ABORTED: return true; default: FLAC__ASSERT(0); return false; } } } ",0 "xps_true_callback_glyph_name(gs_font *pfont, gs_glyph glyph, gs_const_string *pstr) { /* This function is copied verbatim from plfont.c */ int table_length; int table_offset; ulong format; int numGlyphs; uint glyph_name_index; const byte *postp; /* post table pointer */ if (glyph >= GS_MIN_GLYPH_INDEX) { glyph -= GS_MIN_GLYPH_INDEX; } /* guess if the font type is not truetype */ if ( pfont->FontType != ft_TrueType ) { glyph -= 29; if (glyph < 258 ) { pstr->data = (byte*) pl_mac_names[glyph]; pstr->size = strlen((char*)pstr->data); return 0; } else { return gs_throw1(-1, ""glyph index %lu out of range"", (ulong)glyph); } } table_offset = xps_find_sfnt_table((xps_font_t*)pfont->client_data, ""post"", &table_length); /* no post table */ if (table_offset < 0) return gs_throw(-1, ""no post table""); /* this shoudn't happen but... */ if ( table_length == 0 ) return gs_throw(-1, ""zero-size post table""); ((gs_font_type42 *)pfont)->data.string_proc((gs_font_type42 *)pfont, table_offset, table_length, &postp); format = u32(postp); /* Format 1.0 (mac encoding) is a simple table see the TT spec. * We don't implement this because we don't see it in practice. * Format 2.5 is deprecated. * Format 3.0 means that there is no post data in the font file. * We see this a lot but can't do much about it. * The only format we support is 2.0. */ if ( format != 0x20000 ) { /* Invent a name if we don't know the table format. */ char buf[32]; gs_sprintf(buf, ""glyph%d"", (int)glyph); pstr->data = (byte*)buf; pstr->size = strlen((char*)pstr->data); return 0; } /* skip over the post header */ numGlyphs = (int)u16(postp + 32); if ((int)glyph > numGlyphs - 1) { return gs_throw1(-1, ""glyph index %lu out of range"", (ulong)glyph); } /* glyph name index starts at post + 34 each entry is 2 bytes */ glyph_name_index = u16(postp + 34 + (glyph * 2)); /* this shouldn't happen */ if ( glyph_name_index > 0x7fff ) return gs_throw(-1, ""post table format error""); /* mac easy */ if ( glyph_name_index < 258 ) { pstr->data = (byte*) pl_mac_names[glyph_name_index]; pstr->size = strlen((char*)pstr->data); return 0; } /* not mac */ else { byte *mydata; /* and here's the tricky part */ const byte *pascal_stringp = postp + 34 + (numGlyphs * 2); /* 0 - 257 lives in the mac table above */ glyph_name_index -= 258; /* The string we want is the index'th pascal string, * so we ""hop"" to each length byte ""index"" times. */ while (glyph_name_index > 0) { pascal_stringp += ((int)(*pascal_stringp)+1); glyph_name_index--; } /* length byte */ pstr->size = (int)(*pascal_stringp); /* + 1 is for the length byte */ pstr->data = pascal_stringp + 1; /* sanity check */ if ( pstr->data + pstr->size > postp + table_length || pstr->data - 1 < postp) return gs_throw(-1, ""data out of range""); /* sigh - we have to allocate a copy of the data - by the * time a high level device makes use of it the font data * may be freed. This is a necessary leak. */ mydata = gs_alloc_bytes(pfont->memory, pstr->size + 1, ""glyph to name""); if ( mydata == 0 ) return -1; memcpy(mydata, pascal_stringp + 1, pstr->size); pstr->data = mydata; mydata[pstr->size] = 0; return 0; } } ",0 "int RenderFlexibleBox::firstLineBoxBaseline() const { if (isWritingModeRoot() || m_numberOfInFlowChildrenOnFirstLine <= 0) return -1; RenderBox* baselineChild = 0; int childNumber = 0; for (RenderBox* child = m_orderIterator.first(); child; child = m_orderIterator.next()) { if (child->isOutOfFlowPositioned()) continue; if (alignmentForChild(child) == ItemPositionBaseline && !hasAutoMarginsInCrossAxis(child)) { baselineChild = child; break; } if (!baselineChild) baselineChild = child; ++childNumber; if (childNumber == m_numberOfInFlowChildrenOnFirstLine) break; } if (!baselineChild) return -1; if (!isColumnFlow() && hasOrthogonalFlow(baselineChild)) return crossAxisExtentForChild(baselineChild) + baselineChild->logicalTop(); if (isColumnFlow() && !hasOrthogonalFlow(baselineChild)) return mainAxisExtentForChild(baselineChild) + baselineChild->logicalTop(); int baseline = baselineChild->firstLineBoxBaseline(); if (baseline == -1) { LineDirectionMode direction = isHorizontalWritingMode() ? HorizontalLine : VerticalLine; return synthesizedBaselineFromContentBox(baselineChild, direction) + baselineChild->logicalTop(); } return baseline + baselineChild->logicalTop(); } ",0 "static struct file *path_openat(int dfd, struct filename *pathname, struct nameidata *nd, const struct open_flags *op, int flags) { struct file *file; struct path path; int opened = 0; int error; file = get_empty_filp(); if (IS_ERR(file)) return file; file->f_flags = op->open_flag; if (unlikely(file->f_flags & __O_TMPFILE)) { error = do_tmpfile(dfd, pathname, nd, flags, op, file, &opened); goto out; } error = path_init(dfd, pathname, flags, nd); if (unlikely(error)) goto out; error = do_last(nd, &path, file, op, &opened, pathname); while (unlikely(error > 0)) { /* trailing symlink */ struct path link = path; void *cookie; if (!(nd->flags & LOOKUP_FOLLOW)) { path_put_conditional(&path, nd); path_put(&nd->path); error = -ELOOP; break; } error = may_follow_link(&link, nd); if (unlikely(error)) break; nd->flags |= LOOKUP_PARENT; nd->flags &= ~(LOOKUP_OPEN|LOOKUP_CREATE|LOOKUP_EXCL); error = follow_link(&link, nd, &cookie); if (unlikely(error)) break; error = do_last(nd, &path, file, op, &opened, pathname); put_link(nd, &link, cookie); } out: path_cleanup(nd); if (!(opened & FILE_OPENED)) { BUG_ON(!error); put_filp(file); } if (unlikely(error)) { if (error == -EOPENSTALE) { if (flags & LOOKUP_RCU) error = -ECHILD; else error = -ESTALE; } file = ERR_PTR(error); } return file; } ",1 "static inline int lookup_flags(unsigned int f) { unsigned long retval = LOOKUP_FOLLOW; if (f & O_NOFOLLOW) retval &= ~LOOKUP_FOLLOW; if (f & O_DIRECTORY) retval |= LOOKUP_DIRECTORY; return retval; } ",0 "PHP_FUNCTION(count_chars) { zend_string *input; int chars[256]; zend_long mymode=0; unsigned char *buf; int inx; char retstr[256]; size_t retlen=0; size_t tmp = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), ""S|l"", &input, &mymode) == FAILURE) { return; } if (mymode < 0 || mymode > 4) { php_error_docref(NULL, E_WARNING, ""Unknown mode""); RETURN_FALSE; } buf = (unsigned char *) ZSTR_VAL(input); memset((void*) chars, 0, sizeof(chars)); while (tmp < ZSTR_LEN(input)) { chars[*buf]++; buf++; tmp++; } if (mymode < 3) { array_init(return_value); } for (inx = 0; inx < 256; inx++) { switch (mymode) { case 0: add_index_long(return_value, inx, chars[inx]); break; case 1: if (chars[inx] != 0) { add_index_long(return_value, inx, chars[inx]); } break; case 2: if (chars[inx] == 0) { add_index_long(return_value, inx, chars[inx]); } break; case 3: if (chars[inx] != 0) { retstr[retlen++] = inx; } break; case 4: if (chars[inx] == 0) { retstr[retlen++] = inx; } break; } } if (mymode >= 3 && mymode <= 4) { RETURN_STRINGL(retstr, retlen); } } ",0 "getproxy (struct url *u) { char *proxy = NULL; char *rewritten_url; if (!opt.use_proxy) return NULL; if (no_proxy_match (u->host, (const char **)opt.no_proxy)) return NULL; switch (u->scheme) { case SCHEME_HTTP: proxy = opt.http_proxy ? opt.http_proxy : getenv (""http_proxy""); break; #ifdef HAVE_SSL case SCHEME_HTTPS: proxy = opt.https_proxy ? opt.https_proxy : getenv (""https_proxy""); break; case SCHEME_FTPS: proxy = opt.ftp_proxy ? opt.ftp_proxy : getenv (""ftps_proxy""); break; #endif case SCHEME_FTP: proxy = opt.ftp_proxy ? opt.ftp_proxy : getenv (""ftp_proxy""); break; case SCHEME_INVALID: break; } if (!proxy || !*proxy) return NULL; /* Handle shorthands. `rewritten_storage' is a kludge to allow getproxy() to return static storage. */ rewritten_url = rewrite_shorthand_url (proxy); if (rewritten_url) return rewritten_url; return strdup(proxy); } ",0 "GeometryMapper::SourceToDestinationProjectionInternal( const TransformPaintPropertyNode* source, const TransformPaintPropertyNode* destination, bool& success) { DCHECK(source && destination); DEFINE_STATIC_LOCAL(TransformationMatrix, identity, (TransformationMatrix())); DEFINE_STATIC_LOCAL(TransformationMatrix, temp, (TransformationMatrix())); if (source == destination) { success = true; return identity; } const GeometryMapperTransformCache& source_cache = source->GetTransformCache(); const GeometryMapperTransformCache& destination_cache = destination->GetTransformCache(); if (source_cache.plane_root() == destination_cache.plane_root()) { success = true; if (source == destination_cache.plane_root()) return destination_cache.from_plane_root(); if (destination == source_cache.plane_root()) return source_cache.to_plane_root(); temp = destination_cache.from_plane_root(); temp.Multiply(source_cache.to_plane_root()); return temp; } if (!destination_cache.projection_from_screen_is_valid()) { success = false; return identity; } const auto* root = TransformPaintPropertyNode::Root(); success = true; if (source == root) return destination_cache.projection_from_screen(); if (destination == root) { temp = source_cache.to_screen(); } else { temp = destination_cache.projection_from_screen(); temp.Multiply(source_cache.to_screen()); } temp.FlattenTo2d(); return temp; } ",1 "_movD(int n) { int i, m = searchKeyNum(); if (Currentbuf->firstLine == NULL) return; for (i = 0; i < m; i++) cursorDown(Currentbuf, n); displayBuffer(Currentbuf, B_NORMAL); } ",0 "static void conn_init(void) { /* We're unlikely to see an FD much higher than maxconns. */ int next_fd = dup(1); int headroom = 10; /* account for extra unexpected open FDs */ struct rlimit rl; max_fds = settings.maxconns + headroom + next_fd; /* But if possible, get the actual highest FD we can possibly ever see. */ if (getrlimit(RLIMIT_NOFILE, &rl) == 0) { max_fds = rl.rlim_max; } else { fprintf(stderr, ""Failed to query maximum file descriptor; "" ""falling back to maxconns\n""); } close(next_fd); if ((conns = calloc(max_fds, sizeof(conn *))) == NULL) { fprintf(stderr, ""Failed to allocate connection structures\n""); /* This is unrecoverable so bail out early. */ exit(1); } } ",0 "void DatabaseImpl::Count( int64_t transaction_id, int64_t object_store_id, int64_t index_id, const IndexedDBKeyRange& key_range, ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info) { scoped_refptr callbacks( new IndexedDBCallbacks(dispatcher_host_->AsWeakPtr(), origin_, std::move(callbacks_info), idb_runner_)); idb_runner_->PostTask( FROM_HERE, base::Bind(&IDBThreadHelper::Count, base::Unretained(helper_), transaction_id, object_store_id, index_id, key_range, base::Passed(&callbacks))); } ",0 "void AppLauncherHandler::ExtensionEnableFlowAborted(bool user_initiated) { DCHECK_EQ(extension_id_prompting_, extension_enable_flow_->extension_id()); const Extension* extension = extension_service_->GetExtensionById(extension_id_prompting_, true); std::string histogram_name = user_initiated ? ""Extensions.Permissions_ReEnableCancel"" : ""Extensions.Permissions_ReEnableAbort""; ExtensionService::RecordPermissionMessagesHistogram( extension, histogram_name.c_str()); extension_enable_flow_.reset(); CleanupAfterUninstall(); } ",0 "static int rb_head_page_replace(struct buffer_page *old, struct buffer_page *new) { unsigned long *ptr = (unsigned long *)&old->list.prev->next; unsigned long val; unsigned long ret; val = *ptr & ~RB_FLAG_MASK; val |= RB_PAGE_HEAD; ret = cmpxchg(ptr, val, (unsigned long)&new->list); return ret == val; } ",0 "static void usb_net_handle_data(USBDevice *dev, USBPacket *p) { USBNetState *s = (USBNetState *) dev; switch(p->pid) { case USB_TOKEN_IN: switch (p->ep->nr) { case 1: usb_net_handle_statusin(s, p); break; case 2: usb_net_handle_datain(s, p); break; default: goto fail; } break; case USB_TOKEN_OUT: switch (p->ep->nr) { case 2: usb_net_handle_dataout(s, p); break; default: goto fail; } break; default: fail: p->status = USB_RET_STALL; break; } if (p->status == USB_RET_STALL) { fprintf(stderr, ""usbnet: failed data transaction: "" ""pid 0x%x ep 0x%x len 0x%zx\n"", p->pid, p->ep->nr, p->iov.size); } } ",0 "size_t iov_iter_copy_from_user(struct page *page, struct iov_iter *i, unsigned long offset, size_t bytes) { char *kaddr; size_t copied; kaddr = kmap(page); if (likely(i->nr_segs == 1)) { int left; char __user *buf = i->iov->iov_base + i->iov_offset; left = __copy_from_user_nocache(kaddr + offset, buf, bytes); copied = bytes - left; } else { copied = __iovec_copy_from_user_inatomic(kaddr + offset, i->iov, i->iov_offset, bytes); } kunmap(page); return copied; } ",0 "AP_DECLARE(void) ap_hook_check_access(ap_HOOK_access_checker_t *pf, const char * const *aszPre, const char * const *aszSucc, int nOrder, int type) { if ((type & AP_AUTH_INTERNAL_MASK) == AP_AUTH_INTERNAL_PER_CONF) { ++auth_internal_per_conf_hooks; } ap_hook_access_checker(pf, aszPre, aszSucc, nOrder); } ",0 " Ins_S45ROUND( INS_ARG ) { DO_S45ROUND } ",0 "void TestController::processDidCrash() { if (!m_didPrintWebProcessCrashedMessage) { #if PLATFORM(MAC) pid_t pid = WKPageGetProcessIdentifier(m_mainWebView->page()); fprintf(stderr, ""#CRASHED - WebProcess (pid %ld)\n"", static_cast(pid)); #else fputs(""#CRASHED - WebProcess\n"", stderr); #endif fflush(stderr); m_didPrintWebProcessCrashedMessage = true; } if (m_shouldExitWhenWebProcessCrashes) exit(1); } ",0 "WebMediaPlayer::TrackId HTMLMediaElement::AddVideoTrack( const WebString& id, WebMediaPlayerClient::VideoTrackKind kind, const WebString& label, const WebString& language, bool selected) { AtomicString kind_string = VideoKindToString(kind); BLINK_MEDIA_LOG << ""addVideoTrack("" << (void*)this << "", '"" << (String)id << ""', '"" << (AtomicString)kind_string << ""', '"" << (String)label << ""', '"" << (String)language << ""', "" << BoolString(selected) << "")""; if (selected && videoTracks().selectedIndex() != -1) selected = false; VideoTrack* video_track = VideoTrack::Create(id, kind_string, label, language, selected); videoTracks().Add(video_track); return video_track->id(); } ",0 "static __poll_t ib_uverbs_event_poll(struct ib_uverbs_event_queue *ev_queue, struct file *filp, struct poll_table_struct *wait) { __poll_t pollflags = 0; poll_wait(filp, &ev_queue->poll_wait, wait); spin_lock_irq(&ev_queue->lock); if (!list_empty(&ev_queue->event_list)) pollflags = EPOLLIN | EPOLLRDNORM; spin_unlock_irq(&ev_queue->lock); return pollflags; } ",0 "static int open_user_core(uid_t uid, uid_t fsuid, pid_t pid, char **percent_values) { errno = 0; if (user_pwd == NULL || chdir(user_pwd) != 0 ) { perror_msg(""Can't cd to '%s'"", user_pwd); return -1; } struct passwd* pw = getpwuid(uid); gid_t gid = pw ? pw->pw_gid : uid; xsetegid(gid); xseteuid(fsuid); if (strcmp(core_basename, ""core"") == 0) { /* Mimic ""core.PID"" if requested */ char buf[] = ""0\n""; int fd = open(""/proc/sys/kernel/core_uses_pid"", O_RDONLY); if (fd >= 0) { IGNORE_RESULT(read(fd, buf, sizeof(buf))); close(fd); } if (strcmp(buf, ""1\n"") == 0) { core_basename = xasprintf(""%s.%lu"", core_basename, (long)pid); } } else { /* Expand old core pattern, put expanded name in core_basename */ core_basename = xstrdup(core_basename); unsigned idx = 0; while (1) { char c = core_basename[idx]; if (!c) break; idx++; if (c != '%') continue; /* We just copied %, look at following char and expand %c */ c = core_basename[idx]; unsigned specifier_num = strchrnul(percent_specifiers, c) - percent_specifiers; if (percent_specifiers[specifier_num] != '\0') /* valid %c (might be %% too) */ { const char *val = ""%""; if (specifier_num > 0) /* not %% */ val = percent_values[specifier_num - 1]; /* Replace %c at core_basename[idx] by its value */ idx--; char *old = core_basename; core_basename = xasprintf(""%.*s%s%s"", idx, core_basename, val, core_basename + idx + 2); free(old); idx += strlen(val); } /* else: invalid %c, % is already copied verbatim, * next loop iteration will copy c */ } } full_core_basename = core_basename; if (core_basename[0] != '/') core_basename = concat_path_file(user_pwd, core_basename); /* Open (create) compat core file. * man core: * There are various circumstances in which a core dump file * is not produced: * * [skipped obvious ones] * The process does not have permission to write the core file. * ...if a file with the same name exists and is not writable * or is not a regular file (e.g., it is a directory or a symbolic link). * * A file with the same name already exists, but there is more * than one hard link to that file. * * The file system where the core dump file would be created is full; * or has run out of inodes; or is mounted read-only; * or the user has reached their quota for the file system. * * The RLIMIT_CORE or RLIMIT_FSIZE resource limits for the process * are set to zero. * [we check RLIMIT_CORE, but how can we check RLIMIT_FSIZE?] * * The binary being executed by the process does not have * read permission enabled. [how we can check it here?] * * The process is executing a set-user-ID (set-group-ID) program * that is owned by a user (group) other than the real * user (group) ID of the process. [TODO?] * (However, see the description of the prctl(2) PR_SET_DUMPABLE operation, * and the description of the /proc/sys/fs/suid_dumpable file in proc(5).) */ struct stat sb; errno = 0; /* Do not O_TRUNC: if later checks fail, we do not want to have file already modified here */ int user_core_fd = open(core_basename, O_WRONLY | O_CREAT | O_NOFOLLOW, 0600); /* kernel makes 0600 too */ xsetegid(0); xseteuid(0); if (user_core_fd < 0 || fstat(user_core_fd, &sb) != 0 || !S_ISREG(sb.st_mode) || sb.st_nlink != 1 /* kernel internal dumper checks this too: if (inode->i_uid != current->fsuid) , need to mimic? */ ) { if (user_core_fd < 0) perror_msg(""Can't open '%s'"", full_core_basename); else perror_msg(""'%s' is not a regular file with link count 1"", full_core_basename); return -1; } if (ftruncate(user_core_fd, 0) != 0) { /* perror first, otherwise unlink may trash errno */ perror_msg(""Can't truncate '%s' to size 0"", full_core_basename); unlink(core_basename); return -1; } return user_core_fd; } ",0 "static int keyboard_load_and_wait(const char *vc, const char *map, const char *map_toggle, bool utf8) { const char *args[8]; unsigned i = 0; pid_t pid; int r; /* An empty map means kernel map */ if (isempty(map)) return 0; args[i++] = KBD_LOADKEYS; args[i++] = ""-q""; args[i++] = ""-C""; args[i++] = vc; if (utf8) args[i++] = ""-u""; args[i++] = map; if (map_toggle) args[i++] = map_toggle; args[i++] = NULL; if (DEBUG_LOGGING) { _cleanup_free_ char *cmd; cmd = strv_join((char**) args, "" ""); log_debug(""Executing \""%s\""..."", strnull(cmd)); } r = safe_fork(""(loadkeys)"", FORK_RESET_SIGNALS|FORK_CLOSE_ALL_FDS|FORK_RLIMIT_NOFILE_SAFE|FORK_LOG, &pid); if (r < 0) return r; if (r == 0) { execv(args[0], (char **) args); _exit(EXIT_FAILURE); } return wait_for_terminate_and_check(KBD_LOADKEYS, pid, WAIT_LOG); } ",0 "static vpx_codec_err_t vp8_set_dbg_color_mb_modes(vpx_codec_alg_priv_t *ctx, va_list args) { #if CONFIG_POSTPROC_VISUALIZER && CONFIG_POSTPROC ctx->dbg_color_mb_modes_flag = va_arg(args, int); return VPX_CODEC_OK; #else (void)ctx; (void)args; return VPX_CODEC_INCAPABLE; #endif } ",0 "static void _ewk_view_smart_changed(Ewk_View_Smart_Data* smartData) { if (smartData->changed.any) return; smartData->changed.any = true; evas_object_smart_changed(smartData->self); } ",0 "static void databuf_free(struct data_buffer *db) { if (!db) return; free(db->buf); memset(db, 0, sizeof(*db)); } ",0 "static void check_mm(struct mm_struct *mm) { int i; for (i = 0; i < NR_MM_COUNTERS; i++) { long x = atomic_long_read(&mm->rss_stat.count[i]); if (unlikely(x)) printk(KERN_ALERT ""BUG: Bad rss-counter state "" ""mm:%p idx:%d val:%ld\n"", mm, i, x); } #ifdef CONFIG_TRANSPARENT_HUGEPAGE VM_BUG_ON(mm->pmd_huge_pte); #endif } ",0 "v8::Handle V8ThrowException::throwRangeError(v8::Isolate* isolate, const String& message) { v8::Handle exception = V8ThrowException::createRangeError(isolate, message); return V8ThrowException::throwException(exception, isolate); } ",0 "static void shape_harfbuzz(ASS_Shaper *shaper, GlyphInfo *glyphs, size_t len) { int i; hb_buffer_t *buf = hb_buffer_create(); hb_segment_properties_t props = HB_SEGMENT_PROPERTIES_DEFAULT; for (i = 0; i < len; i++) glyphs[i].skip = 1; for (i = 0; i < len; i++) { int offset = i; hb_font_t *font = get_hb_font(shaper, glyphs + offset); int level = glyphs[offset].shape_run_id; int direction = shaper->emblevels[offset] % 2; while (i < (len - 1) && level == glyphs[i+1].shape_run_id) i++; hb_buffer_pre_allocate(buf, i - offset + 1); hb_buffer_add_utf32(buf, shaper->event_text + offset, i - offset + 1, 0, i - offset + 1); props.direction = direction ? HB_DIRECTION_RTL : HB_DIRECTION_LTR; props.script = glyphs[offset].script; props.language = hb_shaper_get_run_language(shaper, props.script); hb_buffer_set_segment_properties(buf, &props); set_run_features(shaper, glyphs + offset); hb_shape(font, buf, shaper->features, shaper->n_features); shape_harfbuzz_process_run(glyphs, buf, offset); hb_buffer_reset(buf); } hb_buffer_destroy(buf); } ",0 " SpareRenderProcessHostManager() {} ",0 "static inline void unmap_mapping_range_list(struct list_head *head, struct zap_details *details) { struct vm_area_struct *vma; /* * In nonlinear VMAs there is no correspondence between virtual address * offset and file offset. So we must perform an exhaustive search * across *all* the pages in each nonlinear VMA, not just the pages * whose virtual address lies outside the file truncation point. */ list_for_each_entry(vma, head, shared.vm_set.list) { details->nonlinear_vma = vma; unmap_mapping_range_vma(vma, vma->vm_start, vma->vm_end, details); } } ",0 "static int register_leaf_sysctl_tables(const char *path, char *pos, struct ctl_table_header ***subheader, struct ctl_table_set *set, struct ctl_table *table) { struct ctl_table *ctl_table_arg = NULL; struct ctl_table *entry, *files; int nr_files = 0; int nr_dirs = 0; int err = -ENOMEM; for (entry = table; entry->procname; entry++) { if (entry->child) nr_dirs++; else nr_files++; } files = table; /* If there are mixed files and directories we need a new table */ if (nr_dirs && nr_files) { struct ctl_table *new; files = kzalloc(sizeof(struct ctl_table) * (nr_files + 1), GFP_KERNEL); if (!files) goto out; ctl_table_arg = files; for (new = files, entry = table; entry->procname; entry++) { if (entry->child) continue; *new = *entry; new++; } } /* Register everything except a directory full of subdirectories */ if (nr_files || !nr_dirs) { struct ctl_table_header *header; header = __register_sysctl_table(set, path, files); if (!header) { kfree(ctl_table_arg); goto out; } /* Remember if we need to free the file table */ header->ctl_table_arg = ctl_table_arg; **subheader = header; (*subheader)++; } /* Recurse into the subdirectories. */ for (entry = table; entry->procname; entry++) { char *child_pos; if (!entry->child) continue; err = -ENAMETOOLONG; child_pos = append_path(path, pos, entry->procname); if (!child_pos) goto out; err = register_leaf_sysctl_tables(path, child_pos, subheader, set, entry->child); pos[0] = '\0'; if (err) goto out; } err = 0; out: /* On failure our caller will unregister all registered subheaders */ return err; } ",0 "HistogramBase* Histogram::Factory::Build() { HistogramBase* histogram = StatisticsRecorder::FindHistogram(name_); if (!histogram) { const BucketRanges* created_ranges = CreateRanges(); const BucketRanges* registered_ranges = StatisticsRecorder::RegisterOrDeleteDuplicateRanges(created_ranges); if (bucket_count_ == 0) { bucket_count_ = static_cast(registered_ranges->bucket_count()); minimum_ = registered_ranges->range(1); maximum_ = registered_ranges->range(bucket_count_ - 1); } PersistentHistogramAllocator::Reference histogram_ref = 0; std::unique_ptr tentative_histogram; PersistentHistogramAllocator* allocator = GlobalHistogramAllocator::Get(); if (allocator) { tentative_histogram = allocator->AllocateHistogram( histogram_type_, name_, minimum_, maximum_, registered_ranges, flags_, &histogram_ref); } if (!tentative_histogram) { DCHECK(!histogram_ref); // Should never have been set. DCHECK(!allocator); // Shouldn't have failed. flags_ &= ~HistogramBase::kIsPersistent; tentative_histogram = HeapAlloc(registered_ranges); tentative_histogram->SetFlags(flags_); } FillHistogram(tentative_histogram.get()); const void* tentative_histogram_ptr = tentative_histogram.get(); histogram = StatisticsRecorder::RegisterOrDeleteDuplicate( tentative_histogram.release()); if (histogram_ref) { allocator->FinalizeHistogram(histogram_ref, histogram == tentative_histogram_ptr); } ReportHistogramActivity(*histogram, HISTOGRAM_CREATED); } else { ReportHistogramActivity(*histogram, HISTOGRAM_LOOKUP); } DCHECK_EQ(histogram_type_, histogram->GetHistogramType()) << name_; if (bucket_count_ != 0 && !histogram->HasConstructionArguments(minimum_, maximum_, bucket_count_)) { DLOG(ERROR) << ""Histogram "" << name_ << "" has bad construction arguments""; return nullptr; } return histogram; } ",1 "DriveFileStreamReader::~DriveFileStreamReader() { } ",0 "static int local_lstat(FsContext *fs_ctx, V9fsPath *fs_path, struct stat *stbuf) { int err = -1; char *dirpath = g_path_get_dirname(fs_path->data); char *name = g_path_get_basename(fs_path->data); int dirfd; dirfd = local_opendir_nofollow(fs_ctx, dirpath); if (dirfd == -1) { goto out; } err = fstatat(dirfd, name, stbuf, AT_SYMLINK_NOFOLLOW); if (err) { goto err_out; } if (fs_ctx->export_flags & V9FS_SM_MAPPED) { /* Actual credentials are part of extended attrs */ uid_t tmp_uid; gid_t tmp_gid; mode_t tmp_mode; dev_t tmp_dev; if (fgetxattrat_nofollow(dirfd, name, ""user.virtfs.uid"", &tmp_uid, sizeof(uid_t)) > 0) { stbuf->st_uid = le32_to_cpu(tmp_uid); } if (fgetxattrat_nofollow(dirfd, name, ""user.virtfs.gid"", &tmp_gid, sizeof(gid_t)) > 0) { stbuf->st_gid = le32_to_cpu(tmp_gid); } if (fgetxattrat_nofollow(dirfd, name, ""user.virtfs.mode"", &tmp_mode, sizeof(mode_t)) > 0) { stbuf->st_mode = le32_to_cpu(tmp_mode); } if (fgetxattrat_nofollow(dirfd, name, ""user.virtfs.rdev"", &tmp_dev, sizeof(dev_t)) > 0) { stbuf->st_rdev = le64_to_cpu(tmp_dev); } } else if (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE) { local_mapped_file_attr(dirfd, name, stbuf); } err_out: close_preserve_errno(dirfd); out: g_free(name); g_free(dirpath); return err; } ",0 "static int do_mq_getsetattr(int mqdes, struct mq_attr *new, struct mq_attr *old) { struct fd f; struct inode *inode; struct mqueue_inode_info *info; if (new && (new->mq_flags & (~O_NONBLOCK))) return -EINVAL; f = fdget(mqdes); if (!f.file) return -EBADF; if (unlikely(f.file->f_op != &mqueue_file_operations)) { fdput(f); return -EBADF; } inode = file_inode(f.file); info = MQUEUE_I(inode); spin_lock(&info->lock); if (old) { *old = info->attr; old->mq_flags = f.file->f_flags & O_NONBLOCK; } if (new) { audit_mq_getsetattr(mqdes, new); spin_lock(&f.file->f_lock); if (new->mq_flags & O_NONBLOCK) f.file->f_flags |= O_NONBLOCK; else f.file->f_flags &= ~O_NONBLOCK; spin_unlock(&f.file->f_lock); inode->i_atime = inode->i_ctime = current_time(inode); } spin_unlock(&info->lock); fdput(f); return 0; } ",0 "BlackBerry::Platform::String WebPage::cutSelectedText() { BlackBerry::Platform::String selectedText = d->m_selectionHandler->selectedText(); if (!d->m_page->defersLoading() && !selectedText.empty()) d->m_inputHandler->deleteSelection(); return selectedText; } ",0 "static void set_max_drc(void) { #define NFSD_DRC_SIZE_SHIFT 10 nfsd_drc_max_mem = (nr_free_buffer_pages() >> NFSD_DRC_SIZE_SHIFT) * PAGE_SIZE; nfsd_drc_mem_used = 0; spin_lock_init(&nfsd_drc_lock); dprintk(""%s nfsd_drc_max_mem %lu \n"", __func__, nfsd_drc_max_mem); } ",0 "void S_AL_SrcLock(srcHandle_t src) { srcList[src].isLocked = qtrue; } ",0 "void ExtensionPrefs::OnExtensionMoved( const std::string& moved_extension_id, const std::string& predecessor_extension_id, const std::string& successor_extension_id) { if (predecessor_extension_id.empty() && successor_extension_id.empty()) return; if (predecessor_extension_id.empty()) { SetAppLaunchOrdinal( moved_extension_id, GetAppLaunchOrdinal(successor_extension_id).CreateBefore()); } else if (successor_extension_id.empty()) { SetAppLaunchOrdinal( moved_extension_id, GetAppLaunchOrdinal(predecessor_extension_id).CreateAfter()); } else { const StringOrdinal& predecessor_ordinal = GetAppLaunchOrdinal(predecessor_extension_id); const StringOrdinal& successor_ordinal = GetAppLaunchOrdinal(successor_extension_id); SetAppLaunchOrdinal(moved_extension_id, predecessor_ordinal.CreateBetween(successor_ordinal)); } content::NotificationService::current()->Notify( chrome::NOTIFICATION_EXTENSION_LAUNCHER_REORDERED, content::Source(this), content::NotificationService::NoDetails()); } ",0 "void RenderFrameImpl::OnBeforeUnload() { CHECK(!frame_->parent()); base::TimeTicks before_unload_start_time = base::TimeTicks::Now(); bool proceed = frame_->dispatchBeforeUnloadEvent(); base::TimeTicks before_unload_end_time = base::TimeTicks::Now(); Send(new FrameHostMsg_BeforeUnload_ACK(routing_id_, proceed, before_unload_start_time, before_unload_end_time)); } ",0 "struct sock *inet6_lookup(struct net *net, struct inet_hashinfo *hashinfo, const struct in6_addr *saddr, const __be16 sport, const struct in6_addr *daddr, const __be16 dport, const int dif) { struct sock *sk; local_bh_disable(); sk = __inet6_lookup(net, hashinfo, saddr, sport, daddr, ntohs(dport), dif); local_bh_enable(); return sk; } ",0 "CameraSource::~CameraSource() { if (mStarted) { reset(); } else if (mInitCheck == OK) { releaseCamera(); } } ",0 "static ssize_t proxy_preadv(FsContext *ctx, V9fsFidOpenState *fs, const struct iovec *iov, int iovcnt, off_t offset) { ssize_t ret; #ifdef CONFIG_PREADV ret = preadv(fs->fd, iov, iovcnt, offset); #else ret = lseek(fs->fd, offset, SEEK_SET); if (ret >= 0) { ret = readv(fs->fd, iov, iovcnt); } #endif return ret; } ",0 "bool ChromeContentBrowserClient::CanCreateWindow( RenderFrameHost* opener, const GURL& opener_url, const GURL& opener_top_level_frame_url, const url::Origin& source_origin, content::mojom::WindowContainerType container_type, const GURL& target_url, const content::Referrer& referrer, const std::string& frame_name, WindowOpenDisposition disposition, const blink::mojom::WindowFeatures& features, bool user_gesture, bool opener_suppressed, bool* no_javascript_access) { DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK(opener); content::WebContents* web_contents = content::WebContents::FromRenderFrameHost(opener); Profile* profile = Profile::FromBrowserContext(web_contents->GetBrowserContext()); DCHECK(profile); *no_javascript_access = false; if (container_type == content::mojom::WindowContainerType::BACKGROUND) { #if BUILDFLAG(ENABLE_EXTENSIONS) auto* process_map = extensions::ProcessMap::Get(profile); auto* registry = extensions::ExtensionRegistry::Get(profile); if (!URLHasExtensionBackgroundPermission(process_map, registry, opener_url, opener->GetProcess()->GetID())) { return false; } const Extension* extension = registry->enabled_extensions().GetExtensionOrAppByURL(opener_url); if (extension && !extensions::BackgroundInfo::AllowJSAccess(extension)) *no_javascript_access = true; #endif return true; } #if BUILDFLAG(ENABLE_EXTENSIONS) if (extensions::WebViewRendererState::GetInstance()->IsGuest( opener->GetProcess()->GetID())) { return true; } if (target_url.SchemeIs(extensions::kExtensionScheme)) { auto* registry = extensions::ExtensionRegistry::Get(profile); const Extension* extension = registry->enabled_extensions().GetExtensionOrAppByURL(target_url); if (extension && extension->is_platform_app()) { UMA_HISTOGRAM_ENUMERATION( ""Extensions.AppLoadedInTab"", ClassifyAppLoadedInTabSource(opener_url, extension), APP_LOADED_IN_TAB_SOURCE_MAX); return false; } } #endif #if BUILDFLAG(ENABLE_PLUGINS) HostContentSettingsMap* content_settings = HostContentSettingsMapFactory::GetForProfile(profile); if (FlashDownloadInterception::ShouldStopFlashDownloadAction( content_settings, opener_top_level_frame_url, target_url, user_gesture)) { FlashDownloadInterception::InterceptFlashDownloadNavigation( web_contents, opener_top_level_frame_url); return false; } #endif if (auto* prerender_contents = prerender::PrerenderContents::FromWebContents(web_contents)) { prerender_contents->Destroy(prerender::FINAL_STATUS_CREATE_NEW_WINDOW); return false; } BlockedWindowParams blocked_params(target_url, source_origin, referrer, frame_name, disposition, features, user_gesture, opener_suppressed); NavigateParams nav_params = blocked_params.CreateNavigateParams(web_contents); if (MaybeBlockPopup(web_contents, opener_top_level_frame_url, &nav_params, nullptr /*=open_url_params*/, blocked_params.features())) { return false; } #if defined(OS_ANDROID) auto* single_tab_mode_helper = SingleTabModeTabHelper::FromWebContents(web_contents); if (single_tab_mode_helper && single_tab_mode_helper->block_all_new_windows()) { TabModelList::HandlePopupNavigation(&nav_params); return false; } #endif return true; } ",0 "DOMFileSystemSync::~DOMFileSystemSync() { } ",0 "GLvoid StubGLStencilMaskSeparate(GLenum face, GLuint mask) { glStencilMaskSeparate(face, mask); } ",0 "static struct dentry *ext4_fh_to_dentry(struct super_block *sb, struct fid *fid, int fh_len, int fh_type) { return generic_fh_to_dentry(sb, fid, fh_len, fh_type, ext4_nfs_get_inode); } ",0 "perf_cgroup_set_shadow_time(struct perf_event *event, u64 now) { } ",0 " ExtensionScriptAndCaptureVisibleTest() : http_url(""http://www.google.com""), http_url_with_path(""http://www.google.com/index.html""), https_url(""https://www.google.com""), example_com(""https://example.com""), test_example_com(""https://test.example.com""), sample_example_com(""https://sample.example.com""), file_url(""file:///foo/bar""), favicon_url(""chrome://favicon/http://www.google.com""), extension_url(""chrome-extension://"" + crx_file::id_util::GenerateIdForPath( base::FilePath(FILE_PATH_LITERAL(""foo"")))), settings_url(""chrome://settings""), about_flags_url(""about:flags"") { urls_.insert(http_url); urls_.insert(http_url_with_path); urls_.insert(https_url); urls_.insert(example_com); urls_.insert(test_example_com); urls_.insert(sample_example_com); urls_.insert(file_url); urls_.insert(favicon_url); urls_.insert(extension_url); urls_.insert(settings_url); urls_.insert(about_flags_url); PermissionsData::SetPolicyDelegate(NULL); } ",0 "static int open_input(HLSContext *c, struct playlist *pls, struct segment *seg) { AVDictionary *opts = NULL; int ret; int is_http = 0; av_dict_set(&opts, ""user_agent"", c->user_agent, 0); av_dict_set(&opts, ""cookies"", c->cookies, 0); av_dict_set(&opts, ""headers"", c->headers, 0); av_dict_set(&opts, ""http_proxy"", c->http_proxy, 0); av_dict_set(&opts, ""seekable"", ""0"", 0); if (seg->size >= 0) { /* try to restrict the HTTP request to the part we want * (if this is in fact a HTTP request) */ av_dict_set_int(&opts, ""offset"", seg->url_offset, 0); av_dict_set_int(&opts, ""end_offset"", seg->url_offset + seg->size, 0); } av_log(pls->parent, AV_LOG_VERBOSE, ""HLS request for url '%s', offset %""PRId64"", playlist %d\n"", seg->url, seg->url_offset, pls->index); if (seg->key_type == KEY_NONE) { ret = open_url(pls->parent, &pls->input, seg->url, c->avio_opts, opts, &is_http); } else if (seg->key_type == KEY_AES_128) { AVDictionary *opts2 = NULL; char iv[33], key[33], url[MAX_URL_SIZE]; if (strcmp(seg->key, pls->key_url)) { AVIOContext *pb; if (open_url(pls->parent, &pb, seg->key, c->avio_opts, opts, NULL) == 0) { ret = avio_read(pb, pls->key, sizeof(pls->key)); if (ret != sizeof(pls->key)) { av_log(NULL, AV_LOG_ERROR, ""Unable to read key file %s\n"", seg->key); } ff_format_io_close(pls->parent, &pb); } else { av_log(NULL, AV_LOG_ERROR, ""Unable to open key file %s\n"", seg->key); } av_strlcpy(pls->key_url, seg->key, sizeof(pls->key_url)); } ff_data_to_hex(iv, seg->iv, sizeof(seg->iv), 0); ff_data_to_hex(key, pls->key, sizeof(pls->key), 0); iv[32] = key[32] = '\0'; if (strstr(seg->url, ""://"")) snprintf(url, sizeof(url), ""crypto+%s"", seg->url); else snprintf(url, sizeof(url), ""crypto:%s"", seg->url); av_dict_copy(&opts2, c->avio_opts, 0); av_dict_set(&opts2, ""key"", key, 0); av_dict_set(&opts2, ""iv"", iv, 0); ret = open_url(pls->parent, &pls->input, url, opts2, opts, &is_http); av_dict_free(&opts2); if (ret < 0) { goto cleanup; } ret = 0; } else if (seg->key_type == KEY_SAMPLE_AES) { av_log(pls->parent, AV_LOG_ERROR, ""SAMPLE-AES encryption is not supported yet\n""); ret = AVERROR_PATCHWELCOME; } else ret = AVERROR(ENOSYS); /* Seek to the requested position. If this was a HTTP request, the offset * should already be where want it to, but this allows e.g. local testing * without a HTTP server. * * This is not done for HTTP at all as avio_seek() does internal bookkeeping * of file offset which is out-of-sync with the actual offset when ""offset"" * AVOption is used with http protocol, causing the seek to not be a no-op * as would be expected. Wrong offset received from the server will not be * noticed without the call, though. */ if (ret == 0 && !is_http && seg->key_type == KEY_NONE && seg->url_offset) { int64_t seekret = avio_seek(pls->input, seg->url_offset, SEEK_SET); if (seekret < 0) { av_log(pls->parent, AV_LOG_ERROR, ""Unable to seek to offset %""PRId64"" of HLS segment '%s'\n"", seg->url_offset, seg->url); ret = seekret; ff_format_io_close(pls->parent, &pls->input); } } cleanup: av_dict_free(&opts); pls->cur_seg_offset = 0; return ret; } ",0 "bool BrowserView::CanResize() const { return true; } ",0 "static size_t ZSTD_checkDictNCount(short* normalizedCounter, unsigned dictMaxSymbolValue, unsigned maxSymbolValue) { U32 s; if (dictMaxSymbolValue < maxSymbolValue) return ERROR(dictionary_corrupted); for (s = 0; s <= maxSymbolValue; ++s) { if (normalizedCounter[s] == 0) return ERROR(dictionary_corrupted); } return 0; } ",0 "static int i8042_start(struct serio *serio) { struct i8042_port *port = serio->port_data; port->exists = true; mb(); return 0; } ",1 "static long tty_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { struct tty_struct *tty = file_tty(file); struct tty_ldisc *ld; int retval = -ENOIOCTLCMD; if (tty_paranoia_check(tty, file_inode(file), ""tty_ioctl"")) return -EINVAL; if (tty->ops->compat_ioctl) { retval = tty->ops->compat_ioctl(tty, cmd, arg); if (retval != -ENOIOCTLCMD) return retval; } ld = tty_ldisc_ref_wait(tty); if (ld->ops->compat_ioctl) retval = ld->ops->compat_ioctl(tty, file, cmd, arg); else retval = n_tty_compat_ioctl_helper(tty, file, cmd, arg); tty_ldisc_deref(ld); return retval; } ",0 "WebKit::WebFileUtilities* TestWebKitPlatformSupport::fileUtilities() { return &file_utilities_; } ",0 "xmlCheckLanguageID(const xmlChar * lang) { const xmlChar *cur = lang, *nxt; if (cur == NULL) return (0); if (((cur[0] == 'i') && (cur[1] == '-')) || ((cur[0] == 'I') && (cur[1] == '-')) || ((cur[0] == 'x') && (cur[1] == '-')) || ((cur[0] == 'X') && (cur[1] == '-'))) { /* * Still allow IANA code and user code which were coming * from the previous version of the XML-1.0 specification * it's deprecated but we should not fail */ cur += 2; while (((cur[0] >= 'A') && (cur[0] <= 'Z')) || ((cur[0] >= 'a') && (cur[0] <= 'z'))) cur++; return(cur[0] == 0); } nxt = cur; while (((nxt[0] >= 'A') && (nxt[0] <= 'Z')) || ((nxt[0] >= 'a') && (nxt[0] <= 'z'))) nxt++; if (nxt - cur >= 4) { /* * Reserved */ if ((nxt - cur > 8) || (nxt[0] != 0)) return(0); return(1); } if (nxt - cur < 2) return(0); /* we got an ISO 639 code */ if (nxt[0] == 0) return(1); if (nxt[0] != '-') return(0); nxt++; cur = nxt; /* now we can have extlang or script or region or variant */ if ((nxt[0] >= '0') && (nxt[0] <= '9')) goto region_m49; while (((nxt[0] >= 'A') && (nxt[0] <= 'Z')) || ((nxt[0] >= 'a') && (nxt[0] <= 'z'))) nxt++; if (nxt - cur == 4) goto script; if (nxt - cur == 2) goto region; if ((nxt - cur >= 5) && (nxt - cur <= 8)) goto variant; if (nxt - cur != 3) return(0); /* we parsed an extlang */ if (nxt[0] == 0) return(1); if (nxt[0] != '-') return(0); nxt++; cur = nxt; /* now we can have script or region or variant */ if ((nxt[0] >= '0') && (nxt[0] <= '9')) goto region_m49; while (((nxt[0] >= 'A') && (nxt[0] <= 'Z')) || ((nxt[0] >= 'a') && (nxt[0] <= 'z'))) nxt++; if (nxt - cur == 2) goto region; if ((nxt - cur >= 5) && (nxt - cur <= 8)) goto variant; if (nxt - cur != 4) return(0); /* we parsed a script */ script: if (nxt[0] == 0) return(1); if (nxt[0] != '-') return(0); nxt++; cur = nxt; /* now we can have region or variant */ if ((nxt[0] >= '0') && (nxt[0] <= '9')) goto region_m49; while (((nxt[0] >= 'A') && (nxt[0] <= 'Z')) || ((nxt[0] >= 'a') && (nxt[0] <= 'z'))) nxt++; if ((nxt - cur >= 5) && (nxt - cur <= 8)) goto variant; if (nxt - cur != 2) return(0); /* we parsed a region */ region: if (nxt[0] == 0) return(1); if (nxt[0] != '-') return(0); nxt++; cur = nxt; /* now we can just have a variant */ while (((nxt[0] >= 'A') && (nxt[0] <= 'Z')) || ((nxt[0] >= 'a') && (nxt[0] <= 'z'))) nxt++; if ((nxt - cur < 5) || (nxt - cur > 8)) return(0); /* we parsed a variant */ variant: if (nxt[0] == 0) return(1); if (nxt[0] != '-') return(0); /* extensions and private use subtags not checked */ return (1); region_m49: if (((nxt[1] >= '0') && (nxt[1] <= '9')) && ((nxt[2] >= '0') && (nxt[2] <= '9'))) { nxt += 3; goto region; } return(0); } ",0 "__xmlDoValidityCheckingDefaultValue(void) { if (IS_MAIN_THREAD) return (&xmlDoValidityCheckingDefaultValue); else return (&xmlGetGlobalState()->xmlDoValidityCheckingDefaultValue); } ",0 "void BluetoothDeviceChromeOS::OnPairError( const ConnectErrorCallback& error_callback, const std::string& error_name, const std::string& error_message) { if (--num_connecting_calls_ == 0) adapter_->NotifyDeviceChanged(this); DCHECK(num_connecting_calls_ >= 0); LOG(WARNING) << object_path_.value() << "": Failed to pair device: "" << error_name << "": "" << error_message; VLOG(1) << object_path_.value() << "": "" << num_connecting_calls_ << "" still in progress""; UnregisterAgent(); ConnectErrorCode error_code = ERROR_UNKNOWN; if (error_name == bluetooth_device::kErrorConnectionAttemptFailed) { error_code = ERROR_FAILED; } else if (error_name == bluetooth_device::kErrorFailed) { error_code = ERROR_FAILED; } else if (error_name == bluetooth_device::kErrorAuthenticationFailed) { error_code = ERROR_AUTH_FAILED; } else if (error_name == bluetooth_device::kErrorAuthenticationCanceled) { error_code = ERROR_AUTH_CANCELED; } else if (error_name == bluetooth_device::kErrorAuthenticationRejected) { error_code = ERROR_AUTH_REJECTED; } else if (error_name == bluetooth_device::kErrorAuthenticationTimeout) { error_code = ERROR_AUTH_TIMEOUT; } RecordPairingResult(error_code); error_callback.Run(error_code); } ",1 "OxideQQuickWebView::OxideQQuickWebView(QQuickItem* parent) : QQuickItem(parent), d_ptr(new OxideQQuickWebViewPrivate(this)) { oxide::qquick::EnsureChromiumStarted(); Q_D(OxideQQuickWebView); setFlags(QQuickItem::ItemClipsChildrenToShape | QQuickItem::ItemHasContents | QQuickItem::ItemIsFocusScope | QQuickItem::ItemAcceptsDrops); setAcceptedMouseButtons(Qt::AllButtons); setAcceptHoverEvents(true); } ",0 "ExtensionResource Extension::GetResource( const std::string& relative_path) const { #if defined(OS_POSIX) FilePath relative_file_path(relative_path); #elif defined(OS_WIN) FilePath relative_file_path(UTF8ToWide(relative_path)); #endif return ExtensionResource(id(), path(), relative_file_path); } ",0 "auth_pin_cmd(struct sc_card *card, struct sc_pin_cmd_data *data, int *tries_left) { int rv = SC_ERROR_INTERNAL; LOG_FUNC_CALLED(card->ctx); if (data->pin_type != SC_AC_CHV) LOG_TEST_RET(card->ctx, SC_ERROR_NOT_SUPPORTED, ""auth_pin_cmd() unsupported PIN type""); sc_log(card->ctx, ""PIN CMD:%i; reference:%i; pin1:%p/%i, pin2:%p/%i"", data->cmd, data->pin_reference, data->pin1.data, data->pin1.len, data->pin2.data, data->pin2.len); switch (data->cmd) { case SC_PIN_CMD_VERIFY: rv = auth_pin_verify(card, SC_AC_CHV, data, tries_left); LOG_TEST_RET(card->ctx, rv, ""CMD 'PIN VERIFY' failed""); break; case SC_PIN_CMD_CHANGE: rv = auth_pin_change(card, SC_AC_CHV, data, tries_left); LOG_TEST_RET(card->ctx, rv, ""CMD 'PIN VERIFY' failed""); break; case SC_PIN_CMD_UNBLOCK: rv = auth_pin_reset(card, SC_AC_CHV, data, tries_left); LOG_TEST_RET(card->ctx, rv, ""CMD 'PIN VERIFY' failed""); break; default: LOG_TEST_RET(card->ctx, SC_ERROR_NOT_SUPPORTED, ""Unsupported PIN operation""); } LOG_FUNC_RETURN(card->ctx, rv); } ",0 "xmlCheckLanguageID(const xmlChar * lang) { const xmlChar *cur = lang; if (cur == NULL) return (0); if (((cur[0] == 'i') && (cur[1] == '-')) || ((cur[0] == 'I') && (cur[1] == '-'))) { /* * IANA code */ cur += 2; while (((cur[0] >= 'A') && (cur[0] <= 'Z')) || /* non input consuming */ ((cur[0] >= 'a') && (cur[0] <= 'z'))) cur++; } else if (((cur[0] == 'x') && (cur[1] == '-')) || ((cur[0] == 'X') && (cur[1] == '-'))) { /* * User code */ cur += 2; while (((cur[0] >= 'A') && (cur[0] <= 'Z')) || /* non input consuming */ ((cur[0] >= 'a') && (cur[0] <= 'z'))) cur++; } else if (((cur[0] >= 'A') && (cur[0] <= 'Z')) || ((cur[0] >= 'a') && (cur[0] <= 'z'))) { /* * ISO639 */ cur++; if (((cur[0] >= 'A') && (cur[0] <= 'Z')) || ((cur[0] >= 'a') && (cur[0] <= 'z'))) cur++; else return (0); } else return (0); while (cur[0] != 0) { /* non input consuming */ if (cur[0] != '-') return (0); cur++; if (((cur[0] >= 'A') && (cur[0] <= 'Z')) || ((cur[0] >= 'a') && (cur[0] <= 'z'))) cur++; else return (0); while (((cur[0] >= 'A') && (cur[0] <= 'Z')) || /* non input consuming */ ((cur[0] >= 'a') && (cur[0] <= 'z'))) cur++; } return (1); } ",0 "int phar_zip_flush(phar_archive_data *phar, char *user_stub, zend_long len, int defaultstub, char **error) /* {{{ */ { char *pos; smart_str main_metadata_str = {0}; static const char newstub[] = ""is_persistent) { if (error) { spprintf(error, 0, ""internal error: attempt to flush cached zip-based phar \""%s\"""", phar->fname); } return EOF; } if (phar->is_data) { goto nostub; } /* set alias */ if (!phar->is_temporary_alias && phar->alias_len) { entry.fp = php_stream_fopen_tmpfile(); if (entry.fp == NULL) { spprintf(error, 0, ""phar error: unable to create temporary file""); return EOF; } if (phar->alias_len != (int)php_stream_write(entry.fp, phar->alias, phar->alias_len)) { if (error) { spprintf(error, 0, ""unable to set alias in zip-based phar \""%s\"""", phar->fname); } return EOF; } entry.uncompressed_filesize = entry.compressed_filesize = phar->alias_len; entry.filename = estrndup("".phar/alias.txt"", sizeof("".phar/alias.txt"")-1); entry.filename_len = sizeof("".phar/alias.txt"")-1; if (NULL == zend_hash_str_update_mem(&phar->manifest, entry.filename, entry.filename_len, (void*)&entry, sizeof(phar_entry_info))) { if (error) { spprintf(error, 0, ""unable to set alias in zip-based phar \""%s\"""", phar->fname); } return EOF; } } else { zend_hash_str_del(&phar->manifest, "".phar/alias.txt"", sizeof("".phar/alias.txt"")-1); } /* register alias */ if (phar->alias_len) { if (FAILURE == phar_get_archive(&phar, phar->fname, phar->fname_len, phar->alias, phar->alias_len, error)) { return EOF; } } /* set stub */ if (user_stub && !defaultstub) { if (len < 0) { /* resource passed in */ if (!(php_stream_from_zval_no_verify(stubfile, (zval *)user_stub))) { if (error) { spprintf(error, 0, ""unable to access resource to copy stub to new zip-based phar \""%s\"""", phar->fname); } return EOF; } if (len == -1) { len = PHP_STREAM_COPY_ALL; } else { len = -len; } user_stub = 0; { zend_string *str = php_stream_copy_to_mem(stubfile, len, 0); if (str) { len = ZSTR_LEN(str); user_stub = estrndup(ZSTR_VAL(str), ZSTR_LEN(str)); zend_string_release(str); } else { user_stub = NULL; len = 0; } } if (!len || !user_stub) { if (error) { spprintf(error, 0, ""unable to read resource to copy stub to new zip-based phar \""%s\"""", phar->fname); } return EOF; } free_user_stub = 1; } else { free_user_stub = 0; } tmp = estrndup(user_stub, len); if ((pos = php_stristr(tmp, halt_stub, len, sizeof(halt_stub) - 1)) == NULL) { efree(tmp); if (error) { spprintf(error, 0, ""illegal stub for zip-based phar \""%s\"""", phar->fname); } if (free_user_stub) { efree(user_stub); } return EOF; } pos = user_stub + (pos - tmp); efree(tmp); len = pos - user_stub + 18; entry.fp = php_stream_fopen_tmpfile(); if (entry.fp == NULL) { spprintf(error, 0, ""phar error: unable to create temporary file""); return EOF; } entry.uncompressed_filesize = len + 5; if ((size_t)len != php_stream_write(entry.fp, user_stub, len) || 5 != php_stream_write(entry.fp, "" ?>\r\n"", 5)) { if (error) { spprintf(error, 0, ""unable to create stub from string in new zip-based phar \""%s\"""", phar->fname); } if (free_user_stub) { efree(user_stub); } php_stream_close(entry.fp); return EOF; } entry.filename = estrndup("".phar/stub.php"", sizeof("".phar/stub.php"")-1); entry.filename_len = sizeof("".phar/stub.php"")-1; if (NULL == zend_hash_str_update_mem(&phar->manifest, entry.filename, entry.filename_len, (void*)&entry, sizeof(phar_entry_info))) { if (free_user_stub) { efree(user_stub); } if (error) { spprintf(error, 0, ""unable to set stub in zip-based phar \""%s\"""", phar->fname); } return EOF; } if (free_user_stub) { efree(user_stub); } } else { /* Either this is a brand new phar (add the stub), or the default stub is required (overwrite the stub) */ entry.fp = php_stream_fopen_tmpfile(); if (entry.fp == NULL) { spprintf(error, 0, ""phar error: unable to create temporary file""); return EOF; } if (sizeof(newstub)-1 != php_stream_write(entry.fp, newstub, sizeof(newstub)-1)) { php_stream_close(entry.fp); if (error) { spprintf(error, 0, ""unable to %s stub in%szip-based phar \""%s\"", failed"", user_stub ? ""overwrite"" : ""create"", user_stub ? "" "" : "" new "", phar->fname); } return EOF; } entry.uncompressed_filesize = entry.compressed_filesize = sizeof(newstub) - 1; entry.filename = estrndup("".phar/stub.php"", sizeof("".phar/stub.php"")-1); entry.filename_len = sizeof("".phar/stub.php"")-1; if (!defaultstub) { if (!zend_hash_str_exists(&phar->manifest, "".phar/stub.php"", sizeof("".phar/stub.php"")-1)) { if (NULL == zend_hash_str_add_mem(&phar->manifest, entry.filename, entry.filename_len, (void*)&entry, sizeof(phar_entry_info))) { php_stream_close(entry.fp); efree(entry.filename); if (error) { spprintf(error, 0, ""unable to create stub in zip-based phar \""%s\"""", phar->fname); } return EOF; } } else { php_stream_close(entry.fp); efree(entry.filename); } } else { if (NULL == zend_hash_str_update_mem(&phar->manifest, entry.filename, entry.filename_len, (void*)&entry, sizeof(phar_entry_info))) { php_stream_close(entry.fp); efree(entry.filename); if (error) { spprintf(error, 0, ""unable to overwrite stub in zip-based phar \""%s\"""", phar->fname); } return EOF; } } } nostub: if (phar->fp && !phar->is_brandnew) { oldfile = phar->fp; closeoldfile = 0; php_stream_rewind(oldfile); } else { oldfile = php_stream_open_wrapper(phar->fname, ""rb"", 0, NULL); closeoldfile = oldfile != NULL; } /* save modified files to the zip */ pass.old = oldfile; pass.filefp = php_stream_fopen_tmpfile(); if (!pass.filefp) { fperror: if (closeoldfile) { php_stream_close(oldfile); } if (error) { spprintf(error, 4096, ""phar zip flush of \""%s\"" failed: unable to open temporary file"", phar->fname); } return EOF; } pass.centralfp = php_stream_fopen_tmpfile(); if (!pass.centralfp) { goto fperror; } pass.free_fp = pass.free_ufp = 1; memset(&eocd, 0, sizeof(eocd)); strncpy(eocd.signature, ""PK\5\6"", 4); if (!phar->is_data && !phar->sig_flags) { phar->sig_flags = PHAR_SIG_SHA1; } if (phar->sig_flags) { PHAR_SET_16(eocd.counthere, zend_hash_num_elements(&phar->manifest) + 1); PHAR_SET_16(eocd.count, zend_hash_num_elements(&phar->manifest) + 1); } else { PHAR_SET_16(eocd.counthere, zend_hash_num_elements(&phar->manifest)); PHAR_SET_16(eocd.count, zend_hash_num_elements(&phar->manifest)); } zend_hash_apply_with_argument(&phar->manifest, phar_zip_changed_apply, (void *) &pass); if (Z_TYPE(phar->metadata) != IS_UNDEF) { /* set phar metadata */ PHP_VAR_SERIALIZE_INIT(metadata_hash); php_var_serialize(&main_metadata_str, &phar->metadata, &metadata_hash); PHP_VAR_SERIALIZE_DESTROY(metadata_hash); } if (temperr) { if (error) { spprintf(error, 4096, ""phar zip flush of \""%s\"" failed: %s"", phar->fname, temperr); } efree(temperr); temperror: php_stream_close(pass.centralfp); nocentralerror: if (Z_TYPE(phar->metadata) != IS_UNDEF) { smart_str_free(&main_metadata_str); } php_stream_close(pass.filefp); if (closeoldfile) { php_stream_close(oldfile); } return EOF; } if (FAILURE == phar_zip_applysignature(phar, &pass, &main_metadata_str)) { goto temperror; } /* save zip */ cdir_size = php_stream_tell(pass.centralfp); cdir_offset = php_stream_tell(pass.filefp); PHAR_SET_32(eocd.cdir_size, cdir_size); PHAR_SET_32(eocd.cdir_offset, cdir_offset); php_stream_seek(pass.centralfp, 0, SEEK_SET); { size_t clen; int ret = php_stream_copy_to_stream_ex(pass.centralfp, pass.filefp, PHP_STREAM_COPY_ALL, &clen); if (SUCCESS != ret || clen != cdir_size) { if (error) { spprintf(error, 4096, ""phar zip flush of \""%s\"" failed: unable to write central-directory"", phar->fname); } goto temperror; } } php_stream_close(pass.centralfp); if (Z_TYPE(phar->metadata) != IS_UNDEF) { /* set phar metadata */ PHAR_SET_16(eocd.comment_len, ZSTR_LEN(main_metadata_str.s)); if (sizeof(eocd) != php_stream_write(pass.filefp, (char *)&eocd, sizeof(eocd))) { if (error) { spprintf(error, 4096, ""phar zip flush of \""%s\"" failed: unable to write end of central-directory"", phar->fname); } goto nocentralerror; } if (ZSTR_LEN(main_metadata_str.s) != php_stream_write(pass.filefp, ZSTR_VAL(main_metadata_str.s), ZSTR_LEN(main_metadata_str.s))) { if (error) { spprintf(error, 4096, ""phar zip flush of \""%s\"" failed: unable to write metadata to zip comment"", phar->fname); } goto nocentralerror; } smart_str_free(&main_metadata_str); } else { if (sizeof(eocd) != php_stream_write(pass.filefp, (char *)&eocd, sizeof(eocd))) { if (error) { spprintf(error, 4096, ""phar zip flush of \""%s\"" failed: unable to write end of central-directory"", phar->fname); } goto nocentralerror; } } if (phar->fp && pass.free_fp) { php_stream_close(phar->fp); } if (phar->ufp) { if (pass.free_ufp) { php_stream_close(phar->ufp); } phar->ufp = NULL; } /* re-open */ phar->is_brandnew = 0; if (phar->donotflush) { /* deferred flush */ phar->fp = pass.filefp; } else { phar->fp = php_stream_open_wrapper(phar->fname, ""w+b"", IGNORE_URL|STREAM_MUST_SEEK|REPORT_ERRORS, NULL); if (!phar->fp) { if (closeoldfile) { php_stream_close(oldfile); } phar->fp = pass.filefp; if (error) { spprintf(error, 4096, ""unable to open new phar \""%s\"" for writing"", phar->fname); } return EOF; } php_stream_rewind(pass.filefp); php_stream_copy_to_stream_ex(pass.filefp, phar->fp, PHP_STREAM_COPY_ALL, NULL); /* we could also reopen the file in ""rb"" mode but there is no need for that */ php_stream_close(pass.filefp); } if (closeoldfile) { php_stream_close(oldfile); } return EOF; } /* }}} */ ",0 " _bdf_add_property( bdf_font_t* font, char* name, char* value, unsigned long lineno ) { size_t propid; hashnode hn; bdf_property_t *prop, *fp; FT_Memory memory = font->memory; FT_Error error = BDF_Err_Ok; /* First, check whether the property already exists in the font. */ if ( ( hn = hash_lookup( name, (hashtable *)font->internal ) ) != 0 ) { /* The property already exists in the font, so simply replace */ /* the value of the property with the current value. */ fp = font->props + hn->data; switch ( fp->format ) { case BDF_ATOM: /* Delete the current atom if it exists. */ FT_FREE( fp->value.atom ); if ( value && value[0] != 0 ) { if ( FT_STRDUP( fp->value.atom, value ) ) goto Exit; } break; case BDF_INTEGER: fp->value.l = _bdf_atol( value, 0, 10 ); break; case BDF_CARDINAL: fp->value.ul = _bdf_atoul( value, 0, 10 ); break; default: ; } goto Exit; } /* See whether this property type exists yet or not. */ /* If not, create it. */ hn = hash_lookup( name, &(font->proptbl) ); if ( hn == 0 ) { error = bdf_create_property( name, BDF_ATOM, font ); if ( error ) goto Exit; hn = hash_lookup( name, &(font->proptbl) ); } /* Allocate another property if this is overflow. */ if ( font->props_used == font->props_size ) { if ( font->props_size == 0 ) { if ( FT_NEW_ARRAY( font->props, 1 ) ) goto Exit; } else { if ( FT_RENEW_ARRAY( font->props, font->props_size, font->props_size + 1 ) ) goto Exit; } fp = font->props + font->props_size; FT_MEM_ZERO( fp, sizeof ( bdf_property_t ) ); font->props_size++; } propid = hn->data; if ( propid >= _num_bdf_properties ) prop = font->user_props + ( propid - _num_bdf_properties ); else prop = (bdf_property_t*)_bdf_properties + propid; fp = font->props + font->props_used; fp->name = prop->name; fp->format = prop->format; fp->builtin = prop->builtin; switch ( prop->format ) { case BDF_ATOM: fp->value.atom = 0; if ( value != 0 && value[0] ) { if ( FT_STRDUP( fp->value.atom, value ) ) goto Exit; } break; case BDF_INTEGER: fp->value.l = _bdf_atol( value, 0, 10 ); break; case BDF_CARDINAL: fp->value.ul = _bdf_atoul( value, 0, 10 ); break; } /* If the property happens to be a comment, then it doesn't need */ /* to be added to the internal hash table. */ if ( ft_memcmp( name, ""COMMENT"", 7 ) != 0 ) { /* Add the property to the font property table. */ error = hash_insert( fp->name, font->props_used, (hashtable *)font->internal, memory ); if ( error ) goto Exit; } font->props_used++; /* Some special cases need to be handled here. The DEFAULT_CHAR */ /* property needs to be located if it exists in the property list, the */ /* FONT_ASCENT and FONT_DESCENT need to be assigned if they are */ /* present, and the SPACING property should override the default */ /* spacing. */ if ( ft_memcmp( name, ""DEFAULT_CHAR"", 12 ) == 0 ) font->default_char = fp->value.l; else if ( ft_memcmp( name, ""FONT_ASCENT"", 11 ) == 0 ) font->font_ascent = fp->value.l; else if ( ft_memcmp( name, ""FONT_DESCENT"", 12 ) == 0 ) font->font_descent = fp->value.l; else if ( ft_memcmp( name, ""SPACING"", 7 ) == 0 ) { if ( !fp->value.atom ) { FT_ERROR(( ""_bdf_add_property: "" ERRMSG8, lineno, ""SPACING"" )); error = BDF_Err_Invalid_File_Format; goto Exit; } if ( fp->value.atom[0] == 'p' || fp->value.atom[0] == 'P' ) font->spacing = BDF_PROPORTIONAL; else if ( fp->value.atom[0] == 'm' || fp->value.atom[0] == 'M' ) font->spacing = BDF_MONOWIDTH; else if ( fp->value.atom[0] == 'c' || fp->value.atom[0] == 'C' ) font->spacing = BDF_CHARCELL; } Exit: return error; } ",0 "status_t Parcel::read(FlattenableHelperInterface& val) const { const size_t len = this->readInt32(); const size_t fd_count = this->readInt32(); if (len > INT32_MAX) { return BAD_VALUE; } void const* const buf = this->readInplace(pad_size(len)); if (buf == NULL) return BAD_VALUE; int* fds = NULL; if (fd_count) { fds = new int[fd_count]; } status_t err = NO_ERROR; for (size_t i=0 ; ireadFileDescriptor()); if (fds[i] < 0) { err = BAD_VALUE; ALOGE(""dup() failed in Parcel::read, i is %zu, fds[i] is %d, fd_count is %zu, error: %s"", i, fds[i], fd_count, strerror(errno)); } } if (err == NO_ERROR) { err = val.unflatten(buf, len, fds, fd_count); } if (fd_count) { delete [] fds; } return err; } ",0 "void ScriptLoader::handleSourceAttribute(const String& sourceUrl) { if (ignoresLoadRequest() || sourceUrl.isEmpty()) return; prepareScript(); // FIXME: Provide a real starting line number here. } ",0 "void LayerTreeCoordinator::cancelPendingLayerFlush() { m_layerFlushTimer.stop(); } ",0 "gx_device_copy_color_params(gx_device *dev, const gx_device *target) { COPY_PARAM(color_info); COPY_PARAM(cached_colors); gx_device_copy_color_procs(dev, target); } ",0 "spnego_gss_inquire_cred( OM_uint32 *minor_status, gss_cred_id_t cred_handle, gss_name_t *name, OM_uint32 *lifetime, int *cred_usage, gss_OID_set *mechanisms) { OM_uint32 status; spnego_gss_cred_id_t spcred = NULL; gss_cred_id_t creds = GSS_C_NO_CREDENTIAL; OM_uint32 tmp_minor_status; OM_uint32 initiator_lifetime, acceptor_lifetime; dsyslog(""Entering inquire_cred\n""); /* * To avoid infinite recursion, if GSS_C_NO_CREDENTIAL is * supplied we call gss_inquire_cred_by_mech() on the * first non-SPNEGO mechanism. */ spcred = (spnego_gss_cred_id_t)cred_handle; if (spcred == NULL) { status = get_available_mechs(minor_status, GSS_C_NO_NAME, GSS_C_BOTH, GSS_C_NO_CRED_STORE, &creds, mechanisms); if (status != GSS_S_COMPLETE) { dsyslog(""Leaving inquire_cred\n""); return (status); } if ((*mechanisms)->count == 0) { gss_release_cred(&tmp_minor_status, &creds); gss_release_oid_set(&tmp_minor_status, mechanisms); dsyslog(""Leaving inquire_cred\n""); return (GSS_S_DEFECTIVE_CREDENTIAL); } assert((*mechanisms)->elements != NULL); status = gss_inquire_cred_by_mech(minor_status, creds, &(*mechanisms)->elements[0], name, &initiator_lifetime, &acceptor_lifetime, cred_usage); if (status != GSS_S_COMPLETE) { gss_release_cred(&tmp_minor_status, &creds); dsyslog(""Leaving inquire_cred\n""); return (status); } if (lifetime != NULL) *lifetime = (*cred_usage == GSS_C_ACCEPT) ? acceptor_lifetime : initiator_lifetime; gss_release_cred(&tmp_minor_status, &creds); } else { status = gss_inquire_cred(minor_status, spcred->mcred, name, lifetime, cred_usage, mechanisms); } dsyslog(""Leaving inquire_cred\n""); return (status); } ",0 "choose_pool(struct svc_serv *serv, struct svc_pool *pool, unsigned int *state) { if (pool != NULL) return pool; return &serv->sv_pools[(*state)++ % serv->sv_nrpools]; } ",0 "flatpak_proxy_client_update_unique_id_policy_from_name (FlatpakProxyClient *client, const char *unique_id, const char *as_name) { flatpak_proxy_client_update_unique_id_policy (client, unique_id, flatpak_proxy_get_policy (client->proxy, as_name)); } ",0 "static void ip6_append_data_mtu(unsigned int *mtu, int *maxfraglen, unsigned int fragheaderlen, struct sk_buff *skb, struct rt6_info *rt, unsigned int orig_mtu) { if (!(rt->dst.flags & DST_XFRM_TUNNEL)) { if (skb == NULL) { /* first fragment, reserve header_len */ *mtu = orig_mtu - rt->dst.header_len; } else { /* * this fragment is not first, the headers * space is regarded as data space. */ *mtu = orig_mtu; } *maxfraglen = ((*mtu - fragheaderlen) & ~7) + fragheaderlen - sizeof(struct frag_hdr); } } ",0 "idtab_init(void) { int i; for (i = 0; i <=2; i++) { TAILQ_INIT(&idtable[i].idlist); idtable[i].nentries = 0; } } ",0 "static void free_smi_msg(struct ipmi_smi_msg *msg) { atomic_dec(&smi_msg_inuse_count); kfree(msg); } ",0 "static void rfcomm_dev_del(struct rfcomm_dev *dev) { unsigned long flags; BT_DBG(""dev %p"", dev); BUG_ON(test_and_set_bit(RFCOMM_TTY_RELEASED, &dev->flags)); spin_lock_irqsave(&dev->port.lock, flags); if (dev->port.count > 0) { spin_unlock_irqrestore(&dev->port.lock, flags); return; } spin_unlock_irqrestore(&dev->port.lock, flags); spin_lock(&rfcomm_dev_lock); list_del_init(&dev->list); spin_unlock(&rfcomm_dev_lock); tty_port_put(&dev->port); } ",0 "WebKitHitTestResult* webkit_web_view_get_hit_test_result(WebKitWebView* webView, GdkEventButton* event) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), NULL); g_return_val_if_fail(event, NULL); PlatformMouseEvent mouseEvent = PlatformMouseEvent(event); Frame* frame = core(webView)->focusController()->focusedOrMainFrame(); HitTestRequest request(HitTestRequest::Active); IntPoint documentPoint = documentPointForWindowPoint(frame, mouseEvent.pos()); MouseEventWithHitTestResults mev = frame->document()->prepareMouseEvent(request, documentPoint, mouseEvent); return kit(mev.hitTestResult()); } ",0 "void GLES2Implementation::GetUniformfv(GLuint program, GLint location, GLfloat* params) { GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG(""["" << GetLogPrefix() << ""] glGetUniformfv("" << program << "", "" << location << "", "" << static_cast(params) << "")""); TRACE_EVENT0(""gpu"", ""GLES2::GetUniformfv""); typedef cmds::GetUniformfv::Result Result; auto result = GetResultAs(); if (!result) { return; } result->SetNumResults(0); helper_->GetUniformfv(program, location, GetResultShmId(), result.offset()); WaitForCmd(); result->CopyResult(params); GPU_CLIENT_LOG_CODE_BLOCK({ for (int32_t i = 0; i < result->GetNumResults(); ++i) { GPU_CLIENT_LOG("" "" << i << "": "" << result->GetData()[i]); } }); CheckGLError(); } ",0 "int dm_get_table_device(struct mapped_device *md, dev_t dev, fmode_t mode, struct dm_dev **result) { int r; struct table_device *td; mutex_lock(&md->table_devices_lock); td = find_table_device(&md->table_devices, dev, mode); if (!td) { td = kmalloc_node(sizeof(*td), GFP_KERNEL, md->numa_node_id); if (!td) { mutex_unlock(&md->table_devices_lock); return -ENOMEM; } td->dm_dev.mode = mode; td->dm_dev.bdev = NULL; if ((r = open_table_device(td, dev, md))) { mutex_unlock(&md->table_devices_lock); kfree(td); return r; } format_dev_t(td->dm_dev.name, dev); refcount_set(&td->count, 1); list_add(&td->list, &md->table_devices); } else { refcount_inc(&td->count); } mutex_unlock(&md->table_devices_lock); *result = &td->dm_dev; return 0; } ",0 "void GLES2Implementation::CallDeferredErrorCallbacks() { if (deferred_error_callbacks_.empty()) return; if (error_message_callback_.is_null()) { deferred_error_callbacks_.clear(); return; } std::deque local_callbacks; std::swap(deferred_error_callbacks_, local_callbacks); for (auto c : local_callbacks) { error_message_callback_.Run(c.message.c_str(), c.id); } } ",0 "ofputil_protocols_from_version_bitmap(uint32_t bitmap) { enum ofputil_protocol protocols = 0; for (; bitmap; bitmap = zero_rightmost_1bit(bitmap)) { enum ofp_version version = rightmost_1bit_idx(bitmap); protocols |= ofputil_protocols_from_ofp_version(version); } return protocols; } ",0 "static void print_event_info(struct trace_buffer *buf, struct seq_file *m) { unsigned long total; unsigned long entries; get_total_entries(buf, &total, &entries); seq_printf(m, ""# entries-in-buffer/entries-written: %lu/%lu #P:%d\n"", entries, total, num_online_cpus()); seq_puts(m, ""#\n""); } ",0 "status_t MediaHTTP::connect( const char *uri, const KeyedVector *headers, off64_t /* offset */) { if (mInitCheck != OK) { return mInitCheck; } KeyedVector extHeaders; if (headers != NULL) { extHeaders = *headers; } if (extHeaders.indexOfKey(String8(""User-Agent"")) < 0) { extHeaders.add(String8(""User-Agent""), String8(MakeUserAgent().c_str())); } bool success = mHTTPConnection->connect(uri, &extHeaders); mLastHeaders = extHeaders; mLastURI = uri; mCachedSizeValid = false; if (success) { AString sanitized = uriDebugString(uri); mName = String8::format(""MediaHTTP(%s)"", sanitized.c_str()); } return success ? OK : UNKNOWN_ERROR; } ",1 "int jbd2_journal_try_to_free_buffers(journal_t *journal, struct page *page, gfp_t gfp_mask) { struct buffer_head *head; struct buffer_head *bh; int ret = 0; J_ASSERT(PageLocked(page)); head = page_buffers(page); bh = head; do { struct journal_head *jh; /* * We take our own ref against the journal_head here to avoid * having to add tons of locking around each instance of * jbd2_journal_put_journal_head(). */ jh = jbd2_journal_grab_journal_head(bh); if (!jh) continue; jbd_lock_bh_state(bh); __journal_try_to_free_buffer(journal, bh); jbd2_journal_put_journal_head(jh); jbd_unlock_bh_state(bh); if (buffer_jbd(bh)) goto busy; } while ((bh = bh->b_this_page) != head); ret = try_to_free_buffers(page); busy: return ret; } ",0 "CLIENT* negotiate(int net, CLIENT *client, GArray* servers) { char zeros[128]; uint64_t size_host; uint32_t flags = NBD_FLAG_HAS_FLAGS; uint16_t smallflags = 0; uint64_t magic; memset(zeros, '\0', sizeof(zeros)); if(!client || !client->modern) { /* common */ if (write(net, INIT_PASSWD, 8) < 0) { err_nonfatal(""Negotiation failed: %m""); if(client) exit(EXIT_FAILURE); } if(!client || client->modern) { /* modern */ magic = htonll(opts_magic); } else { /* oldstyle */ magic = htonll(cliserv_magic); } if (write(net, &magic, sizeof(magic)) < 0) { err_nonfatal(""Negotiation failed: %m""); if(client) exit(EXIT_FAILURE); } } if(!client) { /* modern */ uint32_t reserved; uint32_t opt; uint32_t namelen; char* name; int i; if(!servers) err(""programmer error""); if (write(net, &smallflags, sizeof(uint16_t)) < 0) err(""Negotiation failed: %m""); if (read(net, &reserved, sizeof(reserved)) < 0) err(""Negotiation failed: %m""); if (read(net, &magic, sizeof(magic)) < 0) err(""Negotiation failed: %m""); magic = ntohll(magic); if(magic != opts_magic) { close(net); return NULL; } if (read(net, &opt, sizeof(opt)) < 0) err(""Negotiation failed: %m""); opt = ntohl(opt); if(opt != NBD_OPT_EXPORT_NAME) { close(net); return NULL; } if (read(net, &namelen, sizeof(namelen)) < 0) err(""Negotiation failed: %m""); namelen = ntohl(namelen); name = malloc(namelen+1); name[namelen]=0; if (read(net, name, namelen) < 0) err(""Negotiation failed: %m""); for(i=0; ilen; i++) { SERVER* serve = &(g_array_index(servers, SERVER, i)); if(!strcmp(serve->servename, name)) { CLIENT* client = g_new0(CLIENT, 1); client->server = serve; client->exportsize = OFFT_MAX; client->net = net; client->modern = TRUE; return client; } } return NULL; } /* common */ size_host = htonll((u64)(client->exportsize)); if (write(net, &size_host, 8) < 0) err(""Negotiation failed: %m""); if (client->server->flags & F_READONLY) flags |= NBD_FLAG_READ_ONLY; if (!client->modern) { /* oldstyle */ flags = htonl(flags); if (write(client->net, &flags, 4) < 0) err(""Negotiation failed: %m""); } else { /* modern */ smallflags = (uint16_t)(flags & ~((uint16_t)0)); smallflags = htons(smallflags); if (write(client->net, &smallflags, sizeof(smallflags)) < 0) { err(""Negotiation failed: %m""); } } /* common */ if (write(client->net, zeros, 124) < 0) err(""Negotiation failed: %m""); return NULL; } ",0 "static int set_msr_hyperv(struct kvm_vcpu *vcpu, u32 msr, u64 data) { switch (msr) { case HV_X64_MSR_APIC_ASSIST_PAGE: { unsigned long addr; if (!(data & HV_X64_MSR_APIC_ASSIST_PAGE_ENABLE)) { vcpu->arch.hv_vapic = data; break; } addr = gfn_to_hva(vcpu->kvm, data >> HV_X64_MSR_APIC_ASSIST_PAGE_ADDRESS_SHIFT); if (kvm_is_error_hva(addr)) return 1; if (__clear_user((void __user *)addr, PAGE_SIZE)) return 1; vcpu->arch.hv_vapic = data; break; } case HV_X64_MSR_EOI: return kvm_hv_vapic_msr_write(vcpu, APIC_EOI, data); case HV_X64_MSR_ICR: return kvm_hv_vapic_msr_write(vcpu, APIC_ICR, data); case HV_X64_MSR_TPR: return kvm_hv_vapic_msr_write(vcpu, APIC_TASKPRI, data); default: vcpu_unimpl(vcpu, ""HYPER-V unimplemented wrmsr: 0x%x "" ""data 0x%llx\n"", msr, data); return 1; } return 0; } ",0 "unsigned long FrameLoader::loadResourceSynchronously(const ResourceRequest& request, StoredCredentials storedCredentials, ResourceError& error, ResourceResponse& response, Vector& data) { ASSERT(m_frame->document()); String referrer = SecurityPolicy::generateReferrerHeader(m_frame->document()->referrerPolicy(), request.url(), outgoingReferrer()); ResourceRequest initialRequest = request; initialRequest.setTimeoutInterval(10); if (!referrer.isEmpty()) initialRequest.setHTTPReferrer(referrer); addHTTPOriginIfNeeded(initialRequest, outgoingOrigin()); addExtraFieldsToRequest(initialRequest); unsigned long identifier = 0; ResourceRequest newRequest(initialRequest); requestFromDelegate(newRequest, identifier, error); if (error.isNull()) { ASSERT(!newRequest.isNull()); documentLoader()->applicationCacheHost()->willStartLoadingSynchronously(newRequest); ResourceLoader::loadResourceSynchronously(newRequest, storedCredentials, error, response, data); } int encodedDataLength = response.resourceLoadInfo() ? static_cast(response.resourceLoadInfo()->encodedDataLength) : -1; notifier()->sendRemainingDelegateMessages(m_documentLoader.get(), identifier, response, data.data(), data.size(), encodedDataLength, error); return identifier; } ",0 "static int intel_pmu_cpu_prepare(int cpu) { struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu); if (!cpu_has_ht_siblings()) return NOTIFY_OK; cpuc->per_core = kzalloc_node(sizeof(struct intel_percore), GFP_KERNEL, cpu_to_node(cpu)); if (!cpuc->per_core) return NOTIFY_BAD; raw_spin_lock_init(&cpuc->per_core->lock); cpuc->per_core->core_id = -1; return NOTIFY_OK; } ",0 "void FrameLoader::commitProvisionalLoad(PassRefPtr prpCachedPage) { RefPtr cachedPage = prpCachedPage; RefPtr pdl = m_provisionalDocumentLoader; LOG(PageCache, ""WebCoreLoading %s: About to commit provisional load from previous URL '%s' to new URL '%s'"", m_frame->tree()->name().string().utf8().data(), m_URL.string().utf8().data(), pdl ? pdl->url().string().utf8().data() : """"); cachePageForHistoryItem(history()->currentItem()); if (m_loadType != FrameLoadTypeReplace) closeOldDataSources(); if (!cachedPage && !m_creatingInitialEmptyDocument) m_client->makeRepresentation(pdl.get()); transitionToCommitted(cachedPage); if (m_sentRedirectNotification) clientRedirectCancelledOrFinished(false); if (cachedPage && cachedPage->document()) open(*cachedPage); else { KURL url = pdl->substituteData().responseURL(); if (url.isEmpty()) url = pdl->url(); if (url.isEmpty()) url = pdl->responseURL(); if (url.isEmpty()) url = blankURL(); didOpenURL(url); } LOG(Loading, ""WebCoreLoading %s: Finished committing provisional load to URL %s"", m_frame->tree()->name().string().utf8().data(), m_URL.string().utf8().data()); if (m_loadType == FrameLoadTypeStandard && m_documentLoader->isClientRedirect()) history()->updateForClientRedirect(); if (m_loadingFromCachedPage) { m_frame->document()->documentDidBecomeActive(); m_frame->view()->forceLayout(); const ResponseVector& responses = m_documentLoader->responses(); size_t count = responses.size(); for (size_t i = 0; i < count; i++) { const ResourceResponse& response = responses[i]; ResourceError error; unsigned long identifier; ResourceRequest request(response.url()); requestFromDelegate(request, identifier, error); notifier()->sendRemainingDelegateMessages(m_documentLoader.get(), identifier, response, static_cast(response.expectedContentLength()), error); } pageCache()->remove(history()->currentItem()); m_documentLoader->setPrimaryLoadComplete(true); checkLoadCompleteForThisFrame(); } } ",0 " PermissionsRequestFunction::~PermissionsRequestFunction() {} ",0 "void ContentSearchCallback(MessageLoop* message_loop, base::PlatformFileError error, scoped_ptr dir_proto) { ASSERT_EQ(base::PLATFORM_FILE_OK, error); ASSERT_TRUE(dir_proto.get()); ASSERT_EQ(1, dir_proto->child_files_size()); EXPECT_EQ(""file:2_file_resouce_id.SubDirectory File 1.txt"", dir_proto->child_files(0).gdata_entry().file_name()); ASSERT_EQ(1, dir_proto->child_directories_size()); EXPECT_EQ(""folder:1_folder_resource_id.Directory 1"", dir_proto->child_directories(0).gdata_entry().file_name()); message_loop->Quit(); } ",0 "svcauth_gss_get_principal(SVCAUTH *auth) { struct svc_rpc_gss_data *gd; char *pname; gd = SVCAUTH_PRIVATE(auth); if (gd->cname.length == 0 || gd->cname.length >= SIZE_MAX) return (NULL); if ((pname = malloc(gd->cname.length + 1)) == NULL) return (NULL); memcpy(pname, gd->cname.value, gd->cname.length); pname[gd->cname.length] = '\0'; return (pname); } ",0 "static int lua_ap_mpm_query(lua_State *L) { int x, y; x = lua_tointeger(L, 1); ap_mpm_query(x, &y); lua_pushinteger(L, y); return 1; } ",0 "void sigterm_handler(int s) { g_hash_table_foreach(children, killchild, NULL); unlink(pidfname); exit(EXIT_SUCCESS); } ",0 "asmlinkage void user_unaligned_trap(struct pt_regs *regs, unsigned int insn) { enum direction dir; if(!(current->thread.flags & SPARC_FLAG_UNALIGNED) || (((insn >> 30) & 3) != 3)) goto kill_user; dir = decode_direction(insn); if(!ok_for_user(regs, insn, dir)) { goto kill_user; } else { int err, size = decode_access_size(insn); unsigned long addr; if(floating_point_load_or_store_p(insn)) { printk(""User FPU load/store unaligned unsupported.\n""); goto kill_user; } addr = compute_effective_address(regs, insn); perf_sw_event(PERF_COUNT_SW_ALIGNMENT_FAULTS, 1, 0, regs, addr); switch(dir) { case load: err = do_int_load(fetch_reg_addr(((insn>>25)&0x1f), regs), size, (unsigned long *) addr, decode_signedness(insn)); break; case store: err = do_int_store(((insn>>25)&0x1f), size, (unsigned long *) addr, regs); break; case both: /* * This was supported in 2.4. However, we question * the value of SWAP instruction across word boundaries. */ printk(""Unaligned SWAP unsupported.\n""); err = -EFAULT; break; default: unaligned_panic(""Impossible user unaligned trap.""); goto out; } if (err) goto kill_user; else advance(regs); goto out; } kill_user: user_mna_trap_fault(regs, insn); out: ; } ",1 "MagickExport char *GetNextImageProfile(const Image *image) { assert(image != (Image *) NULL); assert(image->signature == MagickSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"",image->filename); if (image->profiles == (SplayTreeInfo *) NULL) return((char *) NULL); return((char *) GetNextKeyInSplayTree((SplayTreeInfo *) image->profiles)); } ",0 "bool SelectionEditor::ShouldAlwaysUseDirectionalSelection() const { return GetFrame() ->GetEditor() .Behavior() .ShouldConsiderSelectionAsDirectional(); } ",0 "MediaStreamProvider* MediaStreamManager::GetDeviceManager( MediaStreamType stream_type) { if (IsVideoMediaType(stream_type)) return video_capture_manager(); else if (IsAudioInputMediaType(stream_type)) return audio_input_device_manager(); NOTREACHED(); return nullptr; } ",0 "ar6000_channel_change_event(struct ar6_softc *ar, u16 oldChannel, u16 newChannel) { A_PRINTF(""Channel Change notification\nOld Channel: %d, New Channel: %d\n"", oldChannel, newChannel); } ",0 "bool ExecuteCodeInTabFunction::Init() { if (details_.get()) return true; int tab_id = -1; if (args_->GetInteger(0, &tab_id)) EXTENSION_FUNCTION_VALIDATE(tab_id >= 0); DictionaryValue* details_value = NULL; if (!args_->GetDictionary(1, &details_value)) return false; scoped_ptr details(new InjectDetails()); if (!InjectDetails::Populate(*details_value, details.get())) return false; if (tab_id == -1) { Browser* browser = GetCurrentBrowser(); if (!browser) return false; content::WebContents* web_contents = NULL; if (!ExtensionTabUtil::GetDefaultTab(browser, &web_contents, &tab_id)) return false; } execute_tab_id_ = tab_id; details_ = details.Pass(); return true; } ",0 "static void voidMethodWithArgsMethod(const v8::FunctionCallbackInfo& info) { ExceptionState exceptionState(ExceptionState::ExecutionContext, ""voidMethodWithArgs"", ""TestObject"", info.Holder(), info.GetIsolate()); if (UNLIKELY(info.Length() < 3)) { exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(3, info.Length())); exceptionState.throwIfNeeded(); return; } TestObject* imp = V8TestObject::toNative(info.Holder()); V8TRYCATCH_EXCEPTION_VOID(int, longArg, toInt32(info[0], exceptionState), exceptionState); V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[1]); V8TRYCATCH_VOID(TestObject*, objArg, V8TestObject::toNativeWithTypeCheck(info.GetIsolate(), info[2])); imp->voidMethodWithArgs(longArg, strArg, objArg); } ",0 "zlib_end(struct zlib *zlib) { /* Output the summary line now; this ensures a summary line always gets * output regardless of the manner of exit. */ if (!zlib->global->quiet) { if (zlib->ok_bits < 16) /* stream was read ok */ { const char *reason; if (zlib->cksum) reason = ""CHK""; /* checksum error */ else if (zlib->ok_bits > zlib->file_bits) reason = ""TFB""; /* fixing a too-far-back error */ else if (zlib->ok_bits == zlib->file_bits) reason = ""OK ""; else reason = ""OPT""; /* optimizing window bits */ /* SUMMARY FORMAT (for a successful zlib inflate): * * IDAT reason flevel file-bits ok-bits compressed uncompressed file */ type_name(zlib->chunk->chunk_type, stdout); printf("" %s %s %d %d "", reason, zlib_flevel(zlib), zlib->file_bits, zlib->ok_bits); uarb_print(zlib->compressed_bytes, zlib->compressed_digits, stdout); putc(' ', stdout); uarb_print(zlib->uncompressed_bytes, zlib->uncompressed_digits, stdout); putc(' ', stdout); fputs(zlib->file->file_name, stdout); putc('\n', stdout); } else { /* This is a zlib read error; the chunk will be skipped. For an IDAT * stream this will also cause a fatal read error (via stop()). * * SUMMARY FORMAT: * * IDAT SKP flevel file-bits z-rc compressed message file * * z-rc is the zlib failure code; message is the error message with * spaces replaced by '-'. The compressed byte count indicates where * in the zlib stream the error occured. */ type_name(zlib->chunk->chunk_type, stdout); printf("" SKP %s %d %s "", zlib_flevel(zlib), zlib->file_bits, zlib_rc(zlib)); uarb_print(zlib->compressed_bytes, zlib->compressed_digits, stdout); putc(' ', stdout); emit_string(zlib->z.msg ? zlib->z.msg : ""[no_message]"", stdout); putc(' ', stdout); fputs(zlib->file->file_name, stdout); putc('\n', stdout); } } if (zlib->state >= 0) { zlib->rc = inflateEnd(&zlib->z); if (zlib->rc != Z_OK) zlib_message(zlib, 1/*unexpected*/); } CLEAR(*zlib); } ",1 "R_API RBinJavaBootStrapArgument *r_bin_java_bootstrap_method_argument_new(ut8 *buffer, ut64 sz, ut64 buf_offset) { RBinJavaBootStrapArgument *bsm_arg = NULL; ut64 offset = 0; bsm_arg = (RBinJavaBootStrapArgument *) malloc (sizeof (RBinJavaBootStrapArgument)); if (bsm_arg == NULL) { return bsm_arg; } memset (bsm_arg, 0, sizeof (RBinJavaBootStrapArgument)); bsm_arg->file_offset = buf_offset; bsm_arg->argument_info_idx = R_BIN_JAVA_USHORT (buffer, offset); offset += 2; bsm_arg->argument_info_cp_obj = r_bin_java_clone_cp_idx (R_BIN_JAVA_GLOBAL_BIN, bsm_arg->argument_info_idx); bsm_arg->size = offset; return bsm_arg; } ",0 "bool DesktopWindowTreeHostX11::ShouldCreateVisibilityController() const { return true; } ",0 "void Compositor::SetDisplayColorMatrix(const SkMatrix44& matrix) { display_color_matrix_ = matrix; if (context_factory_private_) context_factory_private_->SetDisplayColorMatrix(this, matrix); } ",0 "BGD_DECLARE(void) gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color, int style) { gdPoint pts[363]; int i, pti; int lx = 0, ly = 0; int fx = 0, fy = 0; if ((s % 360) == (e % 360)) { s = 0; e = 360; } else { if (s > 360) { s = s % 360; } if (e > 360) { e = e % 360; } while (s < 0) { s += 360; } while (e < s) { e += 360; } if (s == e) { s = 0; e = 360; } } for (i = s, pti = 1; (i <= e); i++, pti++) { int x, y; x = ((long) gdCosT[i % 360] * (long) w / (2 * 1024)) + cx; y = ((long) gdSinT[i % 360] * (long) h / (2 * 1024)) + cy; if (i != s) { if (!(style & gdChord)) { if (style & gdNoFill) { gdImageLine (im, lx, ly, x, y, color); } else { if (y == ly) { pti--; /* don't add this point */ if (((i > 270 || i < 90) && x > lx) || ((i > 90 && i < 270) && x < lx)) { /* replace the old x coord, if increasing on the right side or decreasing on the left side */ pts[pti].x = x; } } else { pts[pti].x = x; pts[pti].y = y; } } } } else { fx = x; fy = y; if (!(style & (gdChord | gdNoFill))) { pts[0].x = cx; pts[0].y = cy; pts[pti].x = x; pts[pti].y = y; } } lx = x; ly = y; } if (style & gdChord) { if (style & gdNoFill) { if (style & gdEdged) { gdImageLine (im, cx, cy, lx, ly, color); gdImageLine (im, cx, cy, fx, fy, color); } gdImageLine (im, fx, fy, lx, ly, color); } else { pts[0].x = fx; pts[0].y = fy; pts[1].x = lx; pts[1].y = ly; pts[2].x = cx; pts[2].y = cy; gdImageFilledPolygon (im, pts, 3, color); } } else { if (style & gdNoFill) { if (style & gdEdged) { gdImageLine (im, cx, cy, lx, ly, color); gdImageLine (im, cx, cy, fx, fy, color); } } else { pts[pti].x = cx; pts[pti].y = cy; gdImageFilledPolygon(im, pts, pti+1, color); } } } ",0 "static struct skcipher_request *init_skcipher_req(const u8 *key, unsigned int key_len) { struct skcipher_request *req; struct crypto_skcipher *tfm; int ret; tfm = crypto_alloc_skcipher(blkcipher_alg, 0, CRYPTO_ALG_ASYNC); if (IS_ERR(tfm)) { pr_err(""encrypted_key: failed to load %s transform (%ld)\n"", blkcipher_alg, PTR_ERR(tfm)); return ERR_CAST(tfm); } ret = crypto_skcipher_setkey(tfm, key, key_len); if (ret < 0) { pr_err(""encrypted_key: failed to setkey (%d)\n"", ret); crypto_free_skcipher(tfm); return ERR_PTR(ret); } req = skcipher_request_alloc(tfm, GFP_KERNEL); if (!req) { pr_err(""encrypted_key: failed to allocate request for %s\n"", blkcipher_alg); crypto_free_skcipher(tfm); return ERR_PTR(-ENOMEM); } skcipher_request_set_callback(req, 0, NULL, NULL); return req; } ",0 "base::string16 ShellDelegateImpl::GetProductName() const { return base::string16(); } ",0 " void InspectorPageAgent::updateTouchEventEmulationInPage(bool enabled) { m_state->setBoolean(PageAgentState::touchEventEmulationEnabled, enabled); if (mainFrame() && mainFrame()->settings()) mainFrame()->settings()->setTouchEventEmulationEnabled(enabled); m_overlay->setOverride(InspectorOverlay::TouchOverride, enabled); } ",1 "void CoordinatorImpl::OnChromeMemoryDumpResponse( mojom::ClientProcess* client, bool success, uint64_t dump_guid, std::unique_ptr chrome_memory_dump) { using ResponseType = QueuedRequest::PendingResponse::Type; DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); QueuedRequest* request = GetCurrentRequest(); if (request == nullptr || request->dump_guid != dump_guid) { return; } RemovePendingResponse(client, ResponseType::kChromeDump); if (!clients_.count(client)) { VLOG(1) << ""Received a memory dump response from an unregistered client""; return; } auto* response = &request->responses[client]; response->chrome_dump = std::move(chrome_memory_dump); if (!success) { request->failed_memory_dump_count++; VLOG(1) << ""RequestGlobalMemoryDump() FAIL: NACK from client process""; } FinalizeGlobalMemoryDumpIfAllManagersReplied(); } ",0 "void virtio_queue_set_addr(VirtIODevice *vdev, int n, hwaddr addr) { vdev->vq[n].pa = addr; virtqueue_init(&vdev->vq[n]); } ",0 "bool GLSurface::InitializeOneOffInternal() { switch (GetGLImplementation()) { case kGLImplementationEGLGLES2: if (!GLSurfaceEGL::InitializeOneOff()) { LOG(ERROR) << ""GLSurfaceEGL::InitializeOneOff failed.""; return false; } return true; case kGLImplementationOSMesaGL: case kGLImplementationMockGL: return true; default: return false; } } ",0 "struct inode *proc_pid_make_inode(struct super_block * sb, struct task_struct *task) { struct inode * inode; struct proc_inode *ei; const struct cred *cred; /* We need a new inode */ inode = new_inode(sb); if (!inode) goto out; /* Common stuff */ ei = PROC_I(inode); inode->i_ino = get_next_ino(); inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; inode->i_op = &proc_def_inode_operations; /* * grab the reference to task. */ ei->pid = get_task_pid(task, PIDTYPE_PID); if (!ei->pid) goto out_unlock; if (task_dumpable(task)) { rcu_read_lock(); cred = __task_cred(task); inode->i_uid = cred->euid; inode->i_gid = cred->egid; rcu_read_unlock(); } security_task_to_inode(task, inode); out: return inode; out_unlock: iput(inode); return NULL; } ",0 "static int dalvik_disassemble (RAsm *a, RAsmOp *op, const ut8 *buf, int len) { int vA, vB, vC, payload = 0, i = (int) buf[0]; int size = dalvik_opcodes[i].len; char str[1024], *strasm; ut64 offset; const char *flag_str; op->buf_asm[0] = 0; if (buf[0] == 0x00) { /* nop */ switch (buf[1]) { case 0x01: /* packed-switch-payload */ { unsigned short array_size = buf[2] | (buf[3] << 8); int first_key = buf[4] | (buf[5] << 8) | (buf[6] << 16) | (buf[7] << 24); sprintf (op->buf_asm, ""packed-switch-payload %d, %d"", array_size, first_key); size = 8; payload = 2 * (array_size * 2); len = 0; } break; case 0x02: /* sparse-switch-payload */ { unsigned short array_size = buf[2] | (buf[3] << 8); sprintf (op->buf_asm, ""sparse-switch-payload %d"", array_size); size = 4; payload = 2 * (array_size*4); len = 0; } break; case 0x03: /* fill-array-data-payload */ if (len > 7) { unsigned short elem_width = buf[2] | (buf[3] << 8); unsigned int array_size = buf[4] | (buf[5] << 8) | (buf[6] << 16) | (buf[7] << 24); snprintf (op->buf_asm, sizeof (op->buf_asm), ""fill-array-data-payload %d, %d"", elem_width, array_size); payload = 2 * ((array_size * elem_width+1)/2); } size = 8; len = 0; break; default: /* nop */ break; } } strasm = NULL; if (size <= len) { strncpy (op->buf_asm, dalvik_opcodes[i].name, sizeof (op->buf_asm) - 1); strasm = strdup (op->buf_asm); size = dalvik_opcodes[i].len; switch (dalvik_opcodes[i].fmt) { case fmtop: break; case fmtopvAvB: vA = buf[1] & 0x0f; vB = (buf[1] & 0xf0) >> 4; sprintf (str, "" v%i, v%i"", vA, vB); strasm = r_str_concat (strasm, str); break; case fmtopvAAvBBBB: vA = (int) buf[1]; vB = (buf[3] << 8) | buf[2]; sprintf (str, "" v%i, v%i"", vA, vB); strasm = r_str_concat (strasm, str); break; case fmtopvAAAAvBBBB: // buf[1] seems useless :/ vA = (buf[3] << 8) | buf[2]; vB = (buf[5] << 8) | buf[4]; sprintf (str, "" v%i, v%i"", vA, vB); strasm = r_str_concat (strasm, str); break; case fmtopvAA: vA = (int) buf[1]; sprintf (str, "" v%i"", vA); strasm = r_str_concat (strasm, str); break; case fmtopvAcB: vA = buf[1] & 0x0f; vB = (buf[1] & 0xf0) >> 4; sprintf (str, "" v%i, %#x"", vA, vB); strasm = r_str_concat (strasm, str); break; case fmtopvAAcBBBB: vA = (int) buf[1]; { short sB = (buf[3] << 8) | buf[2]; sprintf (str, "" v%i, %#04hx"", vA, sB); strasm = r_str_concat (strasm, str); } break; case fmtopvAAcBBBBBBBB: vA = (int) buf[1]; vB = buf[2] | (buf[3] << 8) | (buf[4] << 16) | (buf[5] << 24); if (buf[0] == 0x17) { //const-wide/32 snprintf (str, sizeof (str), "" v%i:v%i, 0x%08x"", vA, vA + 1, vB); } else { //const snprintf (str, sizeof (str), "" v%i, 0x%08x"", vA, vB); } strasm = r_str_concat (strasm, str); break; case fmtopvAAcBBBB0000: vA = (int) buf[1]; vB = 0 | (buf[2] << 16) | (buf[3] << 24); if (buf[0] == 0x19) { // const-wide/high16 snprintf (str, sizeof (str), "" v%i:v%i, 0x%08x"", vA, vA + 1, vB); } else { snprintf (str, sizeof (str), "" v%i, 0x%08x"", vA, vB); } strasm = r_str_concat (strasm, str); break; case fmtopvAAcBBBBBBBBBBBBBBBB: vA = (int) buf[1]; #define llint long long int llint lB = (llint)buf[2] | ((llint)buf[3] << 8)| ((llint)buf[4] << 16) | ((llint)buf[5] << 24)| ((llint)buf[6] << 32) | ((llint)buf[7] << 40)| ((llint)buf[8] << 48) | ((llint)buf[9] << 56); #undef llint sprintf (str, "" v%i:v%i, 0x%""PFMT64x, vA, vA + 1, lB); strasm = r_str_concat (strasm, str); break; case fmtopvAAvBBvCC: vA = (int) buf[1]; vB = (int) buf[2]; vC = (int) buf[3]; sprintf (str, "" v%i, v%i, v%i"", vA, vB, vC); strasm = r_str_concat (strasm, str); break; case fmtopvAAvBBcCC: vA = (int) buf[1]; vB = (int) buf[2]; vC = (int) buf[3]; sprintf (str, "" v%i, v%i, %#x"", vA, vB, vC); strasm = r_str_concat (strasm, str); break; case fmtopvAvBcCCCC: vA = buf[1] & 0x0f; vB = (buf[1] & 0xf0) >> 4; vC = (buf[3] << 8) | buf[2]; sprintf (str, "" v%i, v%i, %#x"", vA, vB, vC); strasm = r_str_concat (strasm, str); break; case fmtoppAA: vA = (char) buf[1]; snprintf (str, sizeof (str), "" 0x%08""PFMT64x, a->pc + (vA * 2)); // vA : word -> byte strasm = r_str_concat (strasm, str); break; case fmtoppAAAA: vA = (short) (buf[3] << 8 | buf[2]); snprintf (str, sizeof (str), "" 0x%08""PFMT64x, a->pc + (vA * 2)); // vA : word -> byte strasm = r_str_concat (strasm, str); break; case fmtopvAApBBBB: // if-*z vA = (int) buf[1]; vB = (int) (buf[3] << 8 | buf[2]); snprintf (str, sizeof (str), "" v%i, 0x%08""PFMT64x, vA, a->pc + (vB * 2)); strasm = r_str_concat (strasm, str); break; case fmtoppAAAAAAAA: vA = (int) (buf[2] | (buf[3] << 8) | (buf[4] << 16) | (buf[5] << 24)); snprintf (str, sizeof (str), "" 0x%08""PFMT64x, a->pc + (vA*2)); // vA : word -> byte strasm = r_str_concat (strasm, str); break; case fmtopvAvBpCCCC: // if-* vA = buf[1] & 0x0f; vB = (buf[1] & 0xf0) >> 4; vC = (int) (buf[3] << 8 | buf[2]); snprintf (str, sizeof (str),"" v%i, v%i, 0x%08""PFMT64x, vA, vB, a->pc + (vC * 2)); strasm = r_str_concat (strasm, str); break; case fmtopvAApBBBBBBBB: vA = (int) buf[1]; vB = (int) (buf[2] | (buf[3] << 8) | (buf[4] << 16) | (buf[5] << 24)); snprintf (str, sizeof (str), "" v%i, 0x%08""PFMT64x, vA, a->pc + vB); // + (vB*2)); strasm = r_str_concat (strasm, str); break; case fmtoptinlineI: vA = (int) (buf[1] & 0x0f); vB = (buf[3] << 8) | buf[2]; *str = 0; switch (vA) { case 1: sprintf (str, "" {v%i}"", buf[4] & 0x0f); break; case 2: sprintf (str, "" {v%i, v%i}"", buf[4] & 0x0f, (buf[4] & 0xf0) >> 4); break; case 3: sprintf (str, "" {v%i, v%i, v%i}"", buf[4] & 0x0f, (buf[4] & 0xf0) >> 4, buf[5] & 0x0f); break; case 4: sprintf (str, "" {v%i, v%i, v%i, v%i}"", buf[4] & 0x0f, (buf[4] & 0xf0) >> 4, buf[5] & 0x0f, (buf[5] & 0xf0) >> 4); break; default: sprintf (str, "" {}""); } strasm = r_str_concat (strasm, str); sprintf (str, "", [%04x]"", vB); strasm = r_str_concat (strasm, str); break; case fmtoptinlineIR: case fmtoptinvokeVSR: vA = (int) buf[1]; vB = (buf[3] << 8) | buf[2]; vC = (buf[5] << 8) | buf[4]; sprintf (str, "" {v%i..v%i}, [%04x]"", vC, vC + vA - 1, vB); strasm = r_str_concat (strasm, str); break; case fmtoptinvokeVS: vA = (int) (buf[1] & 0xf0) >> 4; vB = (buf[3] << 8) | buf[2]; switch (vA) { case 1: sprintf (str, "" {v%i}"", buf[4] & 0x0f); break; case 2: sprintf (str, "" {v%i, v%i}"", buf[4] & 0x0f, (buf[4] & 0xf0) >> 4); break; case 3: sprintf (str, "" {v%i, v%i, v%i}"", buf[4] & 0x0f, (buf[4] & 0xf0) >> 4, buf[5] & 0x0f); break; case 4: sprintf (str, "" {v%i, v%i, v%i, v%i}"", buf[4] & 0x0f, (buf[4] & 0xf0) >> 4, buf[5] & 0x0f, (buf[5] & 0xf0) >> 4); break; default: sprintf (str, "" {}""); break; } strasm = r_str_concat (strasm, str); sprintf (str, "", [%04x]"", vB); strasm = r_str_concat (strasm, str); break; case fmtopvAAtBBBB: // ""sput-*"" vA = (int) buf[1]; vB = (buf[3] << 8) | buf[2]; if (buf[0] == 0x1a) { offset = R_ASM_GET_OFFSET (a, 's', vB); if (offset == -1) { sprintf (str, "" v%i, string+%i"", vA, vB); } else { sprintf (str, "" v%i, 0x%""PFMT64x, vA, offset); } } else if (buf[0] == 0x1c || buf[0] == 0x1f || buf[0] == 0x22) { flag_str = R_ASM_GET_NAME (a, 'c', vB); if (!flag_str) { sprintf (str, "" v%i, class+%i"", vA, vB); } else { sprintf (str, "" v%i, %s"", vA, flag_str); } } else { flag_str = R_ASM_GET_NAME (a, 'f', vB); if (!flag_str) { sprintf (str, "" v%i, field+%i"", vA, vB); } else { sprintf (str, "" v%i, %s"", vA, flag_str); } } strasm = r_str_concat (strasm, str); break; case fmtoptopvAvBoCCCC: vA = (buf[1] & 0x0f); vB = (buf[1] & 0xf0) >> 4; vC = (buf[3]<<8) | buf[2]; offset = R_ASM_GET_OFFSET (a, 'o', vC); if (offset == -1) { sprintf (str, "" v%i, v%i, [obj+%04x]"", vA, vB, vC); } else { sprintf (str, "" v%i, v%i, [0x%""PFMT64x""]"", vA, vB, offset); } strasm = r_str_concat (strasm, str); break; case fmtopAAtBBBB: vA = (int) buf[1]; vB = (buf[3] << 8) | buf[2]; offset = R_ASM_GET_OFFSET (a, 't', vB); if (offset == -1) { sprintf (str, "" v%i, thing+%i"", vA, vB); } else { sprintf (str, "" v%i, 0x%""PFMT64x, vA, offset); } strasm = r_str_concat (strasm, str); break; case fmtopvAvBtCCCC: vA = (buf[1] & 0x0f); vB = (buf[1] & 0xf0) >> 4; vC = (buf[3] << 8) | buf[2]; if (buf[0] == 0x20 || buf[0] == 0x23) { //instance-of & new-array flag_str = R_ASM_GET_NAME (a, 'c', vC); if (flag_str) { sprintf (str, "" v%i, v%i, %s"", vA, vB, flag_str); } else { sprintf (str, "" v%i, v%i, class+%i"", vA, vB, vC); } } else { flag_str = R_ASM_GET_NAME (a, 'f', vC); if (flag_str) { sprintf (str, "" v%i, v%i, %s"", vA, vB, flag_str); } else { sprintf (str, "" v%i, v%i, field+%i"", vA, vB, vC); } } strasm = r_str_concat (strasm, str); break; case fmtopvAAtBBBBBBBB: vA = (int) buf[1]; vB = (int) (buf[5] | (buf[4] << 8) | (buf[3] << 16) | (buf[2] << 24)); offset = R_ASM_GET_OFFSET (a, 's', vB); if (offset == -1) { sprintf (str, "" v%i, string+%i"", vA, vB); } else { sprintf (str, "" v%i, 0x%""PFMT64x, vA, offset); } strasm = r_str_concat (strasm, str); break; case fmtopvCCCCmBBBB: vA = (int) buf[1]; vB = (buf[3] << 8) | buf[2]; vC = (buf[5] << 8) | buf[4]; if (buf[0] == 0x25) { // filled-new-array/range flag_str = R_ASM_GET_NAME (a, 'c', vB); if (flag_str) { sprintf (str, "" {v%i..v%i}, %s"", vC, vC + vA - 1, flag_str); } else { sprintf (str, "" {v%i..v%i}, class+%i"", vC, vC + vA - 1, vB); } } else { flag_str = R_ASM_GET_NAME (a, 'm', vB); if (flag_str) { sprintf (str, "" {v%i..v%i}, %s"", vC, vC + vA - 1, flag_str); } else { sprintf (str, "" {v%i..v%i}, method+%i"", vC, vC + vA - 1, vB); } } strasm = r_str_concat (strasm, str); break; case fmtopvXtBBBB: vA = (int) (buf[1] & 0xf0) >> 4; vB = (buf[3] << 8) | buf[2]; switch (vA) { case 1: sprintf (str, "" {v%i}"", buf[4] & 0x0f); break; case 2: sprintf (str, "" {v%i, v%i}"", buf[4] & 0x0f, (buf[4] & 0xf0) >> 4); break; case 3: sprintf (str, "" {v%i, v%i, v%i}"", buf[4] & 0x0f, (buf[4] & 0xf0) >> 4, buf[5] & 0x0f); break; case 4: sprintf (str, "" {v%i, v%i, v%i, v%i}"", buf[4] & 0x0f, (buf[4] & 0xf0) >> 4, buf[5] & 0x0f, (buf[5] & 0xf0) >> 4); break; case 5: sprintf (str, "" {v%i, v%i, v%i, v%i, v%i}"", buf[4] & 0x0f, (buf[4] & 0xf0) >> 4, buf[5] & 0x0f, (buf[5] & 0xf0) >> 4, buf[1] & 0x0f); // TOODO: recheck this break; default: sprintf (str, "" {}""); } strasm = r_str_concat (strasm, str); if (buf[0] == 0x24) { // filled-new-array flag_str = R_ASM_GET_NAME (a, 'c', vB); if (flag_str) { sprintf (str, "", %s ; 0x%x"", flag_str, vB); } else { sprintf (str, "", class+%i"", vB); } } else { flag_str = R_ASM_GET_NAME (a, 'm', vB); if (flag_str) { sprintf (str, "", %s ; 0x%x"", flag_str, vB); } else { sprintf (str, "", method+%i"", vB); } } strasm = r_str_concat (strasm, str); break; case fmtoptinvokeI: // Any opcode has this formats case fmtoptinvokeIR: case fmt00: default: strcpy (op->buf_asm, ""invalid ""); free (strasm); strasm = NULL; size = 2; } if (strasm) { strncpy (op->buf_asm, strasm, sizeof (op->buf_asm) - 1); op->buf_asm[sizeof (op->buf_asm) - 1] = 0; } else { strcpy (op->buf_asm , ""invalid""); } } else if (len > 0) { strcpy (op->buf_asm, ""invalid ""); op->size = len; size = len; } op->payload = payload; size += payload; // XXX op->size = size; free (strasm); return size; } ",1 "static void json_print_section_footer(WriterContext *wctx) { JSONContext *json = wctx->priv; const struct section *section = wctx->section[wctx->level]; if (wctx->level == 0) { json->indent_level--; printf(""\n}\n""); } else if (section->flags & SECTION_FLAG_IS_ARRAY) { printf(""\n""); json->indent_level--; JSON_INDENT(); printf(""]""); } else { printf(""%s"", json->item_start_end); json->indent_level--; if (!json->compact) JSON_INDENT(); printf(""}""); ",0 "readfile(argv) char **argv; { return options_from_file(*argv, 1, 1, privileged_option); } ",0 "static struct macvtap_queue *macvtap_get_queue(struct net_device *dev, struct sk_buff *skb) { struct macvlan_dev *vlan = netdev_priv(dev); struct macvtap_queue *tap = NULL; int numvtaps = vlan->numvtaps; __u32 rxq; if (!numvtaps) goto out; /* Check if we can use flow to select a queue */ rxq = skb_get_rxhash(skb); if (rxq) { tap = rcu_dereference(vlan->taps[rxq % numvtaps]); if (tap) goto out; } if (likely(skb_rx_queue_recorded(skb))) { rxq = skb_get_rx_queue(skb); while (unlikely(rxq >= numvtaps)) rxq -= numvtaps; tap = rcu_dereference(vlan->taps[rxq]); if (tap) goto out; } /* Everything failed - find first available queue */ for (rxq = 0; rxq < MAX_MACVTAP_QUEUES; rxq++) { tap = rcu_dereference(vlan->taps[rxq]); if (tap) break; } out: return tap; } ",0 "static bool new_idmap_permitted(const struct file *file, struct user_namespace *ns, int cap_setid, struct uid_gid_map *new_map) { const struct cred *cred = file->f_cred; /* Don't allow mappings that would allow anything that wouldn't * be allowed without the establishment of unprivileged mappings. */ if ((new_map->nr_extents == 1) && (new_map->extent[0].count == 1) && uid_eq(ns->owner, cred->euid)) { u32 id = new_map->extent[0].lower_first; if (cap_setid == CAP_SETUID) { kuid_t uid = make_kuid(ns->parent, id); if (uid_eq(uid, cred->euid)) return true; } else if (cap_setid == CAP_SETGID) { kgid_t gid = make_kgid(ns->parent, id); if (!(ns->flags & USERNS_SETGROUPS_ALLOWED) && gid_eq(gid, cred->egid)) return true; } } /* Allow anyone to set a mapping that doesn't require privilege */ if (!cap_valid(cap_setid)) return true; /* Allow the specified ids if we have the appropriate capability * (CAP_SETUID or CAP_SETGID) over the parent user namespace. * And the opener of the id file also had the approprpiate capability. */ if (ns_capable(ns->parent, cap_setid) && file_ns_capable(file, ns->parent, cap_setid)) return true; return false; } ",0 "static int pdo_stmt_do_next_rowset(pdo_stmt_t *stmt TSRMLS_DC) { /* un-describe */ if (stmt->columns) { int i; struct pdo_column_data *cols = stmt->columns; for (i = 0; i < stmt->column_count; i++) { efree(cols[i].name); } efree(stmt->columns); stmt->columns = NULL; stmt->column_count = 0; } if (!stmt->methods->next_rowset(stmt TSRMLS_CC)) { /* Set the executed flag to 0 to reallocate columns on next execute */ stmt->executed = 0; return 0; } pdo_stmt_describe_columns(stmt TSRMLS_CC); return 1; } ",0 "static void on_btn_add_file(GtkButton *button) { GtkWidget *dialog = gtk_file_chooser_dialog_new( ""Attach File"", GTK_WINDOW(g_wnd_assistant), GTK_FILE_CHOOSER_ACTION_OPEN, _(""_Cancel""), GTK_RESPONSE_CANCEL, _(""_Open""), GTK_RESPONSE_ACCEPT, NULL ); char *filename = NULL; if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); gtk_widget_destroy(dialog); if (filename) { char *basename = strrchr(filename, '/'); if (!basename) /* wtf? (never happens) */ goto free_and_ret; basename++; /* TODO: ask for the name to save it as? For now, just use basename */ char *message = NULL; struct stat statbuf; if (stat(filename, &statbuf) != 0 || !S_ISREG(statbuf.st_mode)) { message = xasprintf(_(""'%s' is not an ordinary file""), filename); goto show_msgbox; } struct problem_item *item = problem_data_get_item_or_NULL(g_cd, basename); if (!item || (item->flags & CD_FLAG_ISEDITABLE)) { struct dump_dir *dd = wizard_open_directory_for_writing(g_dump_dir_name); if (dd) { dd_close(dd); char *new_name = concat_path_file(g_dump_dir_name, basename); if (strcmp(filename, new_name) == 0) { message = xstrdup(_(""You are trying to copy a file onto itself"")); } else { off_t r = copy_file(filename, new_name, 0666); if (r < 0) { message = xasprintf(_(""Can't copy '%s': %s""), filename, strerror(errno)); unlink(new_name); } if (!message) { problem_data_reload_from_dump_dir(); update_gui_state_from_problem_data(/* don't update selected event */ 0); /* Set flags for the new item */ update_ls_details_checkboxes(g_event_selected); } } free(new_name); } } else message = xasprintf(_(""Item '%s' already exists and is not modifiable""), basename); if (message) { show_msgbox: ; GtkWidget *dlg = gtk_message_dialog_new(GTK_WINDOW(g_wnd_assistant), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_CLOSE, message); free(message); gtk_window_set_transient_for(GTK_WINDOW(dlg), GTK_WINDOW(g_wnd_assistant)); gtk_dialog_run(GTK_DIALOG(dlg)); gtk_widget_destroy(dlg); } free_and_ret: g_free(filename); } } ",0 "void H264DPB::RemoveByPOC(int poc) { for (Pictures::iterator it = pics_.begin(); it != pics_.end(); ++it) { if ((*it)->pic_order_cnt == poc) { pics_.erase(it); return; } } NOTREACHED() << ""Missing POC: "" << poc; } ",0 "static int __btrfs_prealloc_file_range(struct inode *inode, int mode, u64 start, u64 num_bytes, u64 min_size, loff_t actual_len, u64 *alloc_hint, struct btrfs_trans_handle *trans) { struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree; struct extent_map *em; struct btrfs_root *root = BTRFS_I(inode)->root; struct btrfs_key ins; u64 cur_offset = start; u64 i_size; int ret = 0; bool own_trans = true; if (trans) own_trans = false; while (num_bytes > 0) { if (own_trans) { trans = btrfs_start_transaction(root, 3); if (IS_ERR(trans)) { ret = PTR_ERR(trans); break; } } ret = btrfs_reserve_extent(trans, root, num_bytes, min_size, 0, *alloc_hint, &ins, 1); if (ret) { if (own_trans) btrfs_end_transaction(trans, root); break; } ret = insert_reserved_file_extent(trans, inode, cur_offset, ins.objectid, ins.offset, ins.offset, ins.offset, 0, 0, 0, BTRFS_FILE_EXTENT_PREALLOC); if (ret) { btrfs_abort_transaction(trans, root, ret); if (own_trans) btrfs_end_transaction(trans, root); break; } btrfs_drop_extent_cache(inode, cur_offset, cur_offset + ins.offset -1, 0); em = alloc_extent_map(); if (!em) { set_bit(BTRFS_INODE_NEEDS_FULL_SYNC, &BTRFS_I(inode)->runtime_flags); goto next; } em->start = cur_offset; em->orig_start = cur_offset; em->len = ins.offset; em->block_start = ins.objectid; em->block_len = ins.offset; em->orig_block_len = ins.offset; em->bdev = root->fs_info->fs_devices->latest_bdev; set_bit(EXTENT_FLAG_PREALLOC, &em->flags); em->generation = trans->transid; while (1) { write_lock(&em_tree->lock); ret = add_extent_mapping(em_tree, em); if (!ret) list_move(&em->list, &em_tree->modified_extents); write_unlock(&em_tree->lock); if (ret != -EEXIST) break; btrfs_drop_extent_cache(inode, cur_offset, cur_offset + ins.offset - 1, 0); } free_extent_map(em); next: num_bytes -= ins.offset; cur_offset += ins.offset; *alloc_hint = ins.objectid + ins.offset; inode_inc_iversion(inode); inode->i_ctime = CURRENT_TIME; BTRFS_I(inode)->flags |= BTRFS_INODE_PREALLOC; if (!(mode & FALLOC_FL_KEEP_SIZE) && (actual_len > inode->i_size) && (cur_offset > inode->i_size)) { if (cur_offset > actual_len) i_size = actual_len; else i_size = cur_offset; i_size_write(inode, i_size); btrfs_ordered_update_i_size(inode, i_size, NULL); } ret = btrfs_update_inode(trans, root, inode); if (ret) { btrfs_abort_transaction(trans, root, ret); if (own_trans) btrfs_end_transaction(trans, root); break; } if (own_trans) btrfs_end_transaction(trans, root); } return ret; } ",0 "__be16 ipx_cksum(struct ipxhdr *packet, int length) { /* * NOTE: sum is a net byte order quantity, which optimizes the * loop. This only works on big and little endian machines. (I * don't know of a machine that isn't.) */ /* handle the first 3 words separately; checksum should be skipped * and ipx_tctrl masked out */ __u16 *p = (__u16 *)packet; __u32 sum = p[1] + (p[2] & (__force u16)htons(0x00ff)); __u32 i = (length >> 1) - 3; /* Number of remaining complete words */ /* Loop through them */ p += 3; while (i--) sum += *p++; /* Add on the last part word if it exists */ if (packet->ipx_pktsize & htons(1)) sum += (__force u16)htons(0xff00) & *p; /* Do final fixup */ sum = (sum & 0xffff) + (sum >> 16); /* It's a pity there's no concept of carry in C */ if (sum >= 0x10000) sum++; /* * Leave 0 alone; we don't want 0xffff here. Note that we can't get * here with 0x10000, so this check is the same as ((__u16)sum) */ if (sum) sum = ~sum; return (__force __be16)sum; } ",0 "LayoutUnit RenderFlexibleBox::flowAwareBorderBefore() const { switch (transformedWritingMode()) { case TopToBottomWritingMode: return borderTop(); case BottomToTopWritingMode: return borderBottom(); case LeftToRightWritingMode: return borderLeft(); case RightToLeftWritingMode: return borderRight(); } ASSERT_NOT_REACHED(); return borderTop(); } ",0 "void HTMLFormControlElement::didRecalcStyle(StyleRecalcChange) { if (LayoutObject* layoutObject = this->layoutObject()) layoutObject->updateFromElement(); } ",0 "ZEND_METHOD(CURLFile, getMimeType) { curlfile_get_property(""mime"", INTERNAL_FUNCTION_PARAM_PASSTHRU); } ",0 "bool RenderProcessHostImpl::IsReady() const { return GetHandle() && channel_connected_; } ",0 "static int crypto_init_givcipher_ops(struct crypto_tfm *tfm, u32 type, u32 mask) { struct ablkcipher_alg *alg = &tfm->__crt_alg->cra_ablkcipher; struct ablkcipher_tfm *crt = &tfm->crt_ablkcipher; if (alg->ivsize > PAGE_SIZE / 8) return -EINVAL; crt->setkey = tfm->__crt_alg->cra_flags & CRYPTO_ALG_GENIV ? alg->setkey : setkey; crt->encrypt = alg->encrypt; crt->decrypt = alg->decrypt; crt->givencrypt = alg->givencrypt; crt->givdecrypt = alg->givdecrypt ?: no_givdecrypt; crt->base = __crypto_ablkcipher_cast(tfm); crt->ivsize = alg->ivsize; return 0; } ",0 "static void __exit pptp_exit_module(void) { unregister_pppox_proto(PX_PROTO_PPTP); proto_unregister(&pptp_sk_proto); gre_del_protocol(&gre_pptp_protocol, GREPROTO_PPTP); vfree(callid_sock); } ",0 "QTNBinary(QTNode *in) { int i; /* since this function recurses, it could be driven to stack overflow. */ check_stack_depth(); if (in->valnode->type != QI_OPR) return; for (i = 0; i < in->nchild; i++) QTNBinary(in->child[i]); if (in->nchild <= 2) return; while (in->nchild > 2) { QTNode *nn = (QTNode *) palloc0(sizeof(QTNode)); nn->valnode = (QueryItem *) palloc0(sizeof(QueryItem)); nn->child = (QTNode **) palloc0(sizeof(QTNode *) * 2); nn->nchild = 2; nn->flags = QTN_NEEDFREE; nn->child[0] = in->child[0]; nn->child[1] = in->child[1]; nn->sign = nn->child[0]->sign | nn->child[1]->sign; nn->valnode->type = in->valnode->type; nn->valnode->qoperator.oper = in->valnode->qoperator.oper; in->child[0] = nn; in->child[1] = in->child[in->nchild - 1]; in->nchild--; } } ",0 "void RenderBlockFlow::setCollapsedBottomMargin(const MarginInfo& marginInfo) { if (marginInfo.canCollapseWithMarginAfter() && !marginInfo.canCollapseWithMarginBefore()) { if (marginInfo.discardMargin()) { setMustDiscardMarginAfter(); return; } setMaxMarginAfterValues(max(maxPositiveMarginAfter(), marginInfo.positiveMargin()), max(maxNegativeMarginAfter(), marginInfo.negativeMargin())); if (!marginInfo.hasMarginAfterQuirk()) setHasMarginAfterQuirk(false); if (marginInfo.hasMarginAfterQuirk() && !marginAfter()) { setHasMarginAfterQuirk(true); } } } ",0 " tt_cmap10_char_index( TT_CMap cmap, FT_UInt32 char_code ) { FT_Byte* table = cmap->data; FT_UInt result = 0; FT_Byte* p = table + 12; FT_UInt32 start = TT_NEXT_ULONG( p ); FT_UInt32 count = TT_NEXT_ULONG( p ); FT_UInt32 idx = (FT_ULong)( char_code - start ); if ( idx < count ) { p += 2 * idx; result = TT_PEEK_USHORT( p ); } return result; } ",0 "bool GLES2DecoderImpl::BoundFramebufferHasStencilAttachment() { Framebuffer* framebuffer = GetBoundDrawFramebuffer(); if (framebuffer) { return framebuffer->HasStencilAttachment(); } if (offscreen_target_frame_buffer_.get()) { return offscreen_target_stencil_format_ != 0 || offscreen_target_depth_format_ == GL_DEPTH24_STENCIL8; } return back_buffer_has_stencil_; } ",0 "static int __init set_cmdline_ftrace(char *str) { strlcpy(bootup_tracer_buf, str, MAX_TRACER_SIZE); default_bootup_tracer = bootup_tracer_buf; /* We are using ftrace early, expand it */ ring_buffer_expanded = true; return 1; } ",0 "AutoFillManager::AutoFillManager(TabContents* tab_contents) : tab_contents_(tab_contents), personal_data_(NULL), download_manager_(tab_contents_->profile()), disable_download_manager_requests_(false), metric_logger_(new AutoFillMetrics), cc_infobar_(NULL) { DCHECK(tab_contents); personal_data_ = tab_contents_->profile()->GetOriginalProfile()->GetPersonalDataManager(); download_manager_.SetObserver(this); } ",0 "static int function_stat_headers(struct seq_file *m) { #ifdef CONFIG_FUNCTION_GRAPH_TRACER seq_printf(m, "" Function "" ""Hit Time Avg s^2\n"" "" -------- "" ""--- ---- --- ---\n""); #else seq_printf(m, "" Function Hit\n"" "" -------- ---\n""); #endif return 0; } ",0 "static int create_problem_dir(GHashTable *problem_info, unsigned pid) { /* Exit if free space is less than 1/4 of MaxCrashReportsSize */ if (g_settings_nMaxCrashReportsSize > 0) { if (low_free_space(g_settings_nMaxCrashReportsSize, g_settings_dump_location)) exit(1); } /* Create temp directory with the problem data. * This directory is renamed to final directory name after * all files have been stored into it. */ gchar *dir_basename = g_hash_table_lookup(problem_info, ""basename""); if (!dir_basename) dir_basename = g_hash_table_lookup(problem_info, FILENAME_TYPE); char *path = xasprintf(""%s/%s-%s-%u.new"", g_settings_dump_location, dir_basename, iso_date_string(NULL), pid); /* This item is useless, don't save it */ g_hash_table_remove(problem_info, ""basename""); /* No need to check the path length, as all variables used are limited, * and dd_create() fails if the path is too long. */ struct dump_dir *dd = dd_create(path, client_uid, DEFAULT_DUMP_DIR_MODE); if (!dd) { error_msg_and_die(""Error creating problem directory '%s'"", path); } dd_create_basic_files(dd, client_uid, NULL); dd_save_text(dd, FILENAME_ABRT_VERSION, VERSION); gpointer gpkey = g_hash_table_lookup(problem_info, FILENAME_CMDLINE); if (!gpkey) { /* Obtain and save the command line. */ char *cmdline = get_cmdline(pid); if (cmdline) { dd_save_text(dd, FILENAME_CMDLINE, cmdline); free(cmdline); } } /* Store id of the user whose application crashed. */ char uid_str[sizeof(long) * 3 + 2]; sprintf(uid_str, ""%lu"", (long)client_uid); dd_save_text(dd, FILENAME_UID, uid_str); GHashTableIter iter; gpointer gpvalue; g_hash_table_iter_init(&iter, problem_info); while (g_hash_table_iter_next(&iter, &gpkey, &gpvalue)) { dd_save_text(dd, (gchar *) gpkey, (gchar *) gpvalue); } dd_close(dd); /* Not needing it anymore */ g_hash_table_destroy(problem_info); /* Move the completely created problem directory * to final directory. */ char *newpath = xstrndup(path, strlen(path) - strlen("".new"")); if (rename(path, newpath) == 0) strcpy(path, newpath); free(newpath); log_notice(""Saved problem directory of pid %u to '%s'"", pid, path); /* We let the peer know that problem dir was created successfully * _before_ we run potentially long-running post-create. */ printf(""HTTP/1.1 201 Created\r\n\r\n""); fflush(NULL); close(STDOUT_FILENO); xdup2(STDERR_FILENO, STDOUT_FILENO); /* paranoia: don't leave stdout fd closed */ /* Trim old problem directories if necessary */ if (g_settings_nMaxCrashReportsSize > 0) { trim_problem_dirs(g_settings_dump_location, g_settings_nMaxCrashReportsSize * (double)(1024*1024), path); } run_post_create(path); /* free(path); */ exit(0); } ",1 "void InputType::DisableSecureTextInput() {} ",0 "bool RenderWidgetHostViewAura::GetCompositionTextRange(ui::Range* range) { NOTIMPLEMENTED(); return false; } ",0 "void Document::suspendScheduledTasks(ActiveDOMObject::ReasonForSuspension reason) { ASSERT(!m_scheduledTasksAreSuspended); suspendScriptedAnimationControllerCallbacks(); suspendActiveDOMObjects(reason); scriptRunner()->suspend(); m_pendingTasksTimer.stop(); if (m_parser) m_parser->suspendScheduledTasks(); m_scheduledTasksAreSuspended = true; } ",0 "JsVar *jsvGetArrayBufferBackingString(JsVar *arrayBuffer) { jsvLockAgain(arrayBuffer); while (jsvIsArrayBuffer(arrayBuffer)) { JsVar *s = jsvLock(jsvGetFirstChild(arrayBuffer)); jsvUnLock(arrayBuffer); arrayBuffer = s; } assert(jsvIsString(arrayBuffer)); return arrayBuffer; } ",0 "nfs_clear_request_commit(struct nfs_page *req) { if (test_bit(PG_CLEAN, &req->wb_flags)) { struct inode *inode = req->wb_context->dentry->d_inode; struct nfs_commit_info cinfo; nfs_init_cinfo_from_inode(&cinfo, inode); if (!pnfs_clear_request_commit(req, &cinfo)) { spin_lock(cinfo.lock); nfs_request_remove_commit_list(req, &cinfo); spin_unlock(cinfo.lock); } nfs_clear_page_commit(req->wb_page); } } ",0 "XML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status) { if (parser == NULL) return; assert(status != NULL); *status = parser->m_parsingStatus; } ",0 "int kvm_mmu_get_spte_hierarchy(struct kvm_vcpu *vcpu, u64 addr, u64 sptes[4]) { struct kvm_shadow_walk_iterator iterator; u64 spte; int nr_sptes = 0; walk_shadow_page_lockless_begin(vcpu); for_each_shadow_entry_lockless(vcpu, addr, iterator, spte) { sptes[iterator.level-1] = spte; nr_sptes++; if (!is_shadow_present_pte(spte)) break; } walk_shadow_page_lockless_end(vcpu); return nr_sptes; } ",0 "bool WallpaperManagerBase::ResizeAndSaveWallpaper(const gfx::ImageSkia& image, const base::FilePath& path, WallpaperLayout layout, int preferred_width, int preferred_height, gfx::ImageSkia* output_skia) { if (layout == WALLPAPER_LAYOUT_CENTER) { if (base::PathExists(path)) base::DeleteFile(path, false); return false; } scoped_refptr data; if (ResizeImage(image, layout, preferred_width, preferred_height, &data, output_skia)) { return SaveWallpaperInternal( path, reinterpret_cast(data->front()), data->size()); } return false; } ",0 "PlatformSensorWin::~PlatformSensorWin() { sensor_reader_->SetClient(nullptr); sensor_thread_runner_->DeleteSoon(FROM_HERE, sensor_reader_); } ",0 "blink::WebURLRequest::PreviewsState RenderFrameImpl::GetPreviewsStateForFrame() const { PreviewsState disabled_state = previews_state_ & kDisabledPreviewsBits; if (disabled_state) { DCHECK(!(previews_state_ & ~kDisabledPreviewsBits)) << previews_state_; return disabled_state; } return static_cast(previews_state_); } ",0 "void GLES2DecoderTest::CheckReadPixelsOutOfRange( GLint in_read_x, GLint in_read_y, GLsizei in_read_width, GLsizei in_read_height, bool init) { const GLsizei kWidth = 5; const GLsizei kHeight = 3; const GLint kBytesPerPixel = 3; const GLint kPackAlignment = 4; const GLenum kFormat = GL_RGB; static const int8 kSrcPixels[kWidth * kHeight * kBytesPerPixel] = { 12, 13, 14, 18, 19, 18, 19, 12, 13, 14, 18, 19, 18, 19, 13, 29, 28, 23, 22, 21, 22, 21, 29, 28, 23, 22, 21, 22, 21, 28, 31, 34, 39, 37, 32, 37, 32, 31, 34, 39, 37, 32, 37, 32, 34, }; ClearSharedMemory(); if (init) { DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); DoTexImage2D(GL_TEXTURE_2D, 0, kFormat, kWidth, kHeight, 0, kFormat, GL_UNSIGNED_BYTE, 0, 0); DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); EXPECT_CALL(*gl_, GetError()) .WillOnce(Return(GL_NO_ERROR)) .RetiresOnSaturation(); EXPECT_CALL(*gl_, FramebufferTexture2DEXT( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, kServiceTextureId, 0)) .Times(1) .RetiresOnSaturation(); EXPECT_CALL(*gl_, GetError()) .WillOnce(Return(GL_NO_ERROR)) .RetiresOnSaturation(); SetupExpectationsForFramebufferAttachment( 0, // clear bits 0, 0, 0, 0, // color 0, // stencil 1.0f, // depth false); // scissor test FramebufferTexture2D fbtex_cmd; fbtex_cmd.Init( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, client_texture_id_, 0); EXPECT_EQ(error::kNoError, ExecuteCmd(fbtex_cmd)); } ReadPixelsEmulator emu( kWidth, kHeight, kBytesPerPixel, kSrcPixels, kSrcPixels, kPackAlignment); typedef ReadPixels::Result Result; Result* result = GetSharedMemoryAs(); uint32 result_shm_id = kSharedMemoryId; uint32 result_shm_offset = kSharedMemoryOffset; uint32 pixels_shm_id = kSharedMemoryId; uint32 pixels_shm_offset = kSharedMemoryOffset + sizeof(*result); void* dest = &result[1]; EXPECT_CALL(*gl_, GetError()) .WillOnce(Return(GL_NO_ERROR)) .WillOnce(Return(GL_NO_ERROR)) .RetiresOnSaturation(); GLint read_x = std::max(0, in_read_x); GLint read_y = std::max(0, in_read_y); GLint read_end_x = std::max(0, std::min(kWidth, in_read_x + in_read_width)); GLint read_end_y = std::max(0, std::min(kHeight, in_read_y + in_read_height)); GLint read_width = read_end_x - read_x; GLint read_height = read_end_y - read_y; if (read_width > 0 && read_height > 0) { for (GLint yy = read_y; yy < read_end_y; ++yy) { EXPECT_CALL( *gl_, ReadPixels(read_x, yy, read_width, 1, kFormat, GL_UNSIGNED_BYTE, _)) .WillOnce(Invoke(&emu, &ReadPixelsEmulator::ReadPixels)) .RetiresOnSaturation(); } } ReadPixels cmd; cmd.Init(in_read_x, in_read_y, in_read_width, in_read_height, kFormat, GL_UNSIGNED_BYTE, pixels_shm_id, pixels_shm_offset, result_shm_id, result_shm_offset); EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); GLint unpadded_row_size = emu.ComputeImageDataSize(in_read_width, 1); scoped_array zero(new int8[unpadded_row_size]); scoped_array pack(new int8[kPackAlignment]); memset(zero.get(), 0, unpadded_row_size); memset(pack.get(), kInitialMemoryValue, kPackAlignment); for (GLint yy = 0; yy < in_read_height; ++yy) { const int8* row = static_cast( emu.ComputePackAlignmentAddress(0, yy, in_read_width, dest)); GLint y = in_read_y + yy; if (y < 0 || y >= kHeight) { EXPECT_EQ(0, memcmp(zero.get(), row, unpadded_row_size)); } else { GLint num_left_pixels = std::max(-in_read_x, 0); GLint num_left_bytes = num_left_pixels * kBytesPerPixel; EXPECT_EQ(0, memcmp(zero.get(), row, num_left_bytes)); GLint num_right_pixels = std::max(in_read_x + in_read_width - kWidth, 0); GLint num_right_bytes = num_right_pixels * kBytesPerPixel; EXPECT_EQ(0, memcmp(zero.get(), row + unpadded_row_size - num_right_bytes, num_right_bytes)); GLint x = std::max(in_read_x, 0); GLint num_middle_pixels = std::max(in_read_width - num_left_pixels - num_right_pixels, 0); EXPECT_TRUE(emu.CompareRowSegment( x, y, num_middle_pixels, row + num_left_bytes)); } if (yy != in_read_height - 1) { GLint num_padding_bytes = (kPackAlignment - 1) - (unpadded_row_size % kPackAlignment); EXPECT_EQ(0, memcmp(pack.get(), row + unpadded_row_size, num_padding_bytes)); } } } ",0 "long tg_get_cfs_period(struct task_group *tg) { u64 cfs_period_us; cfs_period_us = ktime_to_ns(tg->cfs_bandwidth.period); do_div(cfs_period_us, NSEC_PER_USEC); return cfs_period_us; } ",0 "static void get_v2rx_desc_bnum(u32 bnum_flag, int *out_bnum) { *out_bnum = hnae_get_field(bnum_flag, HNS_RXD_BUFNUM_M, HNS_RXD_BUFNUM_S) + 1; } ",0 "bool AutofillDownloadManager::CancelRequest( const std::string& form_signature, AutofillDownloadManager::AutofillRequestType request_type) { for (std::map::iterator it = url_fetchers_.begin(); it != url_fetchers_.end(); ++it) { if (std::find(it->second.form_signatures.begin(), it->second.form_signatures.end(), form_signature) != it->second.form_signatures.end() && it->second.request_type == request_type) { delete it->first; url_fetchers_.erase(it); return true; } } return false; } ",0 "there_is_another_patch (bool need_header, mode_t *file_type) { if (p_base != 0 && p_base >= p_filesize) { if (verbosity == VERBOSE) say (""done\n""); return false; } if (verbosity == VERBOSE) say (""Hmm...""); diff_type = intuit_diff_type (need_header, file_type); if (diff_type == NO_DIFF) { if (verbosity == VERBOSE) say (p_base ? "" Ignoring the trailing garbage.\ndone\n"" : "" I can't seem to find a patch in there anywhere.\n""); if (! p_base && p_filesize) fatal (""Only garbage was found in the patch input.""); return false; } if (skip_rest_of_patch) { Fseek (pfp, p_start, SEEK_SET); p_input_line = p_sline - 1; return true; } if (verbosity == VERBOSE) say ("" %sooks like %s to me...\n"", (p_base == 0 ? ""L"" : ""The next patch l""), diff_type == UNI_DIFF ? ""a unified diff"" : diff_type == CONTEXT_DIFF ? ""a context diff"" : diff_type == NEW_CONTEXT_DIFF ? ""a new-style context diff"" : diff_type == NORMAL_DIFF ? ""a normal diff"" : diff_type == GIT_BINARY_DIFF ? ""a git binary diff"" : ""an ed script"" ); if (no_strip_trailing_cr) p_strip_trailing_cr = false; if (verbosity != SILENT) { if (p_indent) say (""(Patch is indented %lu space%s.)\n"", (unsigned long int) p_indent, p_indent==1?"""":""s""); if (p_strip_trailing_cr) say (""(Stripping trailing CRs from patch; use --binary to disable.)\n""); if (! inname) { char numbuf[LINENUM_LENGTH_BOUND + 1]; say (""can't find file to patch at input line %s\n"", format_linenum (numbuf, p_sline)); if (diff_type != ED_DIFF && diff_type != NORMAL_DIFF) say (strippath == -1 ? ""Perhaps you should have used the -p or --strip option?\n"" : ""Perhaps you used the wrong -p or --strip option?\n""); } } skip_to(p_start,p_sline); while (!inname) { char *t; if (force | batch) { say (""No file to patch. Skipping patch.\n""); skip_rest_of_patch = true; return true; } ask (""File to patch: ""); t = buf + strlen (buf); if (t > buf + 1 && *(t - 1) == '\n') { inname = xmemdup0 (buf, t - buf - 1); inerrno = stat_file (inname, &instat); if (inerrno) { perror (inname); fflush (stderr); free (inname); inname = 0; } else invc = -1; } if (!inname) { ask (""Skip this patch? [y] ""); if (*buf != 'n') { if (verbosity != SILENT) say (""Skipping patch.\n""); skip_rest_of_patch = true; return true; } } } return true; } ",0 "static int __init init_pipe_fs(void) { int err = register_filesystem(&pipe_fs_type); if (!err) { pipe_mnt = kern_mount(&pipe_fs_type); if (IS_ERR(pipe_mnt)) { err = PTR_ERR(pipe_mnt); unregister_filesystem(&pipe_fs_type); } } return err; } ",0 "static void perf_event_context_sched_in(struct perf_event_context *ctx, struct task_struct *task) { struct perf_cpu_context *cpuctx; cpuctx = __get_cpu_context(ctx); if (cpuctx->task_ctx == ctx) return; perf_ctx_lock(cpuctx, ctx); perf_pmu_disable(ctx->pmu); /* * We want to keep the following priority order: * cpu pinned (that don't need to move), task pinned, * cpu flexible, task flexible. */ cpu_ctx_sched_out(cpuctx, EVENT_FLEXIBLE); perf_event_sched_in(cpuctx, ctx, task); perf_pmu_enable(ctx->pmu); perf_ctx_unlock(cpuctx, ctx); } ",0 "void MockRenderProcess::ReleaseTransportDIB(TransportDIB* memory) { delete memory; } ",0 "void V8TestObject::UnrestrictedFloatAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_unrestrictedFloatAttribute_Getter""); test_object_v8_internal::UnrestrictedFloatAttributeAttributeGetter(info); } ",0 " virtual void ResetModel() { last_pts_ = 0; bits_in_buffer_model_ = cfg_.rc_target_bitrate * cfg_.rc_buf_initial_sz; frame_number_ = 0; tot_frame_number_ = 0; first_drop_ = 0; num_drops_ = 0; for (int i = 0; i < 3; ++i) { bits_total_[i] = 0; } } ",1 "rend_check_authorization(rend_service_t *service, const char *descriptor_cookie, size_t cookie_len) { rend_authorized_client_t *auth_client = NULL; tor_assert(service); tor_assert(descriptor_cookie); if (!service->clients) { log_warn(LD_BUG, ""Can't check authorization for a service that has no "" ""authorized clients configured.""); return 0; } if (cookie_len != REND_DESC_COOKIE_LEN) { log_info(LD_REND, ""Descriptor cookie is %lu bytes, but we expected "" ""%lu bytes. Dropping cell."", (unsigned long)cookie_len, (unsigned long)REND_DESC_COOKIE_LEN); return 0; } /* Look up client authorization by descriptor cookie. */ SMARTLIST_FOREACH(service->clients, rend_authorized_client_t *, client, { if (tor_memeq(client->descriptor_cookie, descriptor_cookie, REND_DESC_COOKIE_LEN)) { auth_client = client; break; } }); if (!auth_client) { char descriptor_cookie_base64[3*REND_DESC_COOKIE_LEN_BASE64]; base64_encode(descriptor_cookie_base64, sizeof(descriptor_cookie_base64), descriptor_cookie, REND_DESC_COOKIE_LEN, 0); log_info(LD_REND, ""No authorization found for descriptor cookie '%s'! "" ""Dropping cell!"", descriptor_cookie_base64); return 0; } /* Allow the request. */ log_info(LD_REND, ""Client %s authorized for service %s."", auth_client->client_name, service->service_id); return 1; } ",0 "btrfs_lookup_dir_index_item(struct btrfs_trans_handle *trans, struct btrfs_root *root, struct btrfs_path *path, u64 dir, u64 objectid, const char *name, int name_len, int mod) { int ret; struct btrfs_key key; int ins_len = mod < 0 ? -1 : 0; int cow = mod != 0; key.objectid = dir; key.type = BTRFS_DIR_INDEX_KEY; key.offset = objectid; ret = btrfs_search_slot(trans, root, &key, path, ins_len, cow); if (ret < 0) return ERR_PTR(ret); if (ret > 0) return ERR_PTR(-ENOENT); return btrfs_match_dir_item_name(root, path, name, name_len); } ",0 "Rect DIPToScreenRect(const Rect& dip_bounds) { return ToFlooredRectDeprecated( ScaleRect(dip_bounds, GetDeviceScaleFactor())); } ",0 "struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie) { struct dst_entry *dst = __sk_dst_get(sk); if (dst && dst->obsolete && dst->ops->check(dst, cookie) == NULL) { sk_tx_queue_clear(sk); RCU_INIT_POINTER(sk->sk_dst_cache, NULL); dst_release(dst); return NULL; } return dst; } ",0 " static freelist_idx_t next_random_slot(union freelist_init_state *state) { return (state->list[state->pos++] + state->rand) % state->count; } ",1 " static JSON_INLINE void list_init(list_t *list) { list->next = list; list->prev = list; } ",0 "static ssize_t cdc_ncm_show_min_tx_pkt(struct device *d, struct device_attribute *attr, char *buf) { struct usbnet *dev = netdev_priv(to_net_dev(d)); struct cdc_ncm_ctx *ctx = (struct cdc_ncm_ctx *)dev->data[0]; return sprintf(buf, ""%u\n"", ctx->min_tx_pkt); } ",0 "static SECStatus SelectClientCert(void *arg, PRFileDesc *sock, struct CERTDistNamesStr *caNames, struct CERTCertificateStr **pRetCert, struct SECKEYPrivateKeyStr **pRetKey) { struct ssl_connect_data *connssl = (struct ssl_connect_data *)arg; struct Curl_easy *data = connssl->data; const char *nickname = connssl->client_nickname; if(connssl->obj_clicert) { /* use the cert/key provided by PEM reader */ static const char pem_slotname[] = ""PEM Token #1""; SECItem cert_der = { 0, NULL, 0 }; void *proto_win = SSL_RevealPinArg(sock); struct CERTCertificateStr *cert; struct SECKEYPrivateKeyStr *key; PK11SlotInfo *slot = PK11_FindSlotByName(pem_slotname); if(NULL == slot) { failf(data, ""NSS: PK11 slot not found: %s"", pem_slotname); return SECFailure; } if(PK11_ReadRawAttribute(PK11_TypeGeneric, connssl->obj_clicert, CKA_VALUE, &cert_der) != SECSuccess) { failf(data, ""NSS: CKA_VALUE not found in PK11 generic object""); PK11_FreeSlot(slot); return SECFailure; } cert = PK11_FindCertFromDERCertItem(slot, &cert_der, proto_win); SECITEM_FreeItem(&cert_der, PR_FALSE); if(NULL == cert) { failf(data, ""NSS: client certificate from file not found""); PK11_FreeSlot(slot); return SECFailure; } key = PK11_FindPrivateKeyFromCert(slot, cert, NULL); PK11_FreeSlot(slot); if(NULL == key) { failf(data, ""NSS: private key from file not found""); CERT_DestroyCertificate(cert); return SECFailure; } infof(data, ""NSS: client certificate from file\n""); display_cert_info(data, cert); *pRetCert = cert; *pRetKey = key; return SECSuccess; } /* use the default NSS hook */ if(SECSuccess != NSS_GetClientAuthData((void *)nickname, sock, caNames, pRetCert, pRetKey) || NULL == *pRetCert) { if(NULL == nickname) failf(data, ""NSS: client certificate not found (nickname not "" ""specified)""); else failf(data, ""NSS: client certificate not found: %s"", nickname); return SECFailure; } /* get certificate nickname if any */ nickname = (*pRetCert)->nickname; if(NULL == nickname) nickname = ""[unknown]""; if(NULL == *pRetKey) { failf(data, ""NSS: private key not found for certificate: %s"", nickname); return SECFailure; } infof(data, ""NSS: using client certificate: %s\n"", nickname); display_cert_info(data, *pRetCert); return SECSuccess; } ",1 "static void mcryptd_hash_exit_tfm(struct crypto_tfm *tfm) { struct mcryptd_hash_ctx *ctx = crypto_tfm_ctx(tfm); crypto_free_ahash(ctx->child); } ",0 "RenderBlockFlow::MarginValues RenderBlockFlow::marginValuesForChild(RenderBox* child) const { LayoutUnit childBeforePositive = 0; LayoutUnit childBeforeNegative = 0; LayoutUnit childAfterPositive = 0; LayoutUnit childAfterNegative = 0; LayoutUnit beforeMargin = 0; LayoutUnit afterMargin = 0; RenderBlockFlow* childRenderBlockFlow = child->isRenderBlockFlow() ? toRenderBlockFlow(child) : 0; if (!child->isWritingModeRoot()) { if (childRenderBlockFlow) { childBeforePositive = childRenderBlockFlow->maxPositiveMarginBefore(); childBeforeNegative = childRenderBlockFlow->maxNegativeMarginBefore(); childAfterPositive = childRenderBlockFlow->maxPositiveMarginAfter(); childAfterNegative = childRenderBlockFlow->maxNegativeMarginAfter(); } else { beforeMargin = child->marginBefore(); afterMargin = child->marginAfter(); } } else if (child->isHorizontalWritingMode() == isHorizontalWritingMode()) { if (childRenderBlockFlow) { childBeforePositive = childRenderBlockFlow->maxPositiveMarginAfter(); childBeforeNegative = childRenderBlockFlow->maxNegativeMarginAfter(); childAfterPositive = childRenderBlockFlow->maxPositiveMarginBefore(); childAfterNegative = childRenderBlockFlow->maxNegativeMarginBefore(); } else { beforeMargin = child->marginAfter(); afterMargin = child->marginBefore(); } } else { beforeMargin = marginBeforeForChild(child); afterMargin = marginAfterForChild(child); } if (beforeMargin) { if (beforeMargin > 0) childBeforePositive = beforeMargin; else childBeforeNegative = -beforeMargin; } if (afterMargin) { if (afterMargin > 0) childAfterPositive = afterMargin; else childAfterNegative = -afterMargin; } return RenderBlockFlow::MarginValues(childBeforePositive, childBeforeNegative, childAfterPositive, childAfterNegative); } ",0 "static inline struct sock *unix_find_socket_byname(struct net *net, struct sockaddr_un *sunname, int len, int type, unsigned int hash) { struct sock *s; spin_lock(&unix_table_lock); s = __unix_find_socket_byname(net, sunname, len, type, hash); if (s) sock_hold(s); spin_unlock(&unix_table_lock); return s; } ",0 "void arm_iommu_release_mapping(struct dma_iommu_mapping *mapping) { if (mapping) kref_put(&mapping->kref, release_iommu_mapping); } ",0 "static bool link_kind_filtered(const struct net_device *dev, const struct rtnl_link_ops *kind_ops) { if (kind_ops && dev->rtnl_link_ops != kind_ops) return true; return false; } ",0 "int GetCustomCommandId(GdkEventKey* event) { guint modifier = event->state & gtk_accelerator_get_default_mod_mask(); switch (event->keyval) { case GDK_Tab: case GDK_ISO_Left_Tab: case GDK_KP_Tab: if (GDK_CONTROL_MASK == modifier) { return IDC_SELECT_NEXT_TAB; } else if ((GDK_CONTROL_MASK | GDK_SHIFT_MASK) == modifier) { return IDC_SELECT_PREVIOUS_TAB; } break; default: break; } return -1; } ",0 " tcp_v4_md5_do_lookup(struct sock *sk, __be32 addr) { struct tcp_sock *tp = tcp_sk(sk); int i; if (!tp->md5sig_info || !tp->md5sig_info->entries4) return NULL; for (i = 0; i < tp->md5sig_info->entries4; i++) { if (tp->md5sig_info->keys4[i].addr == addr) return &tp->md5sig_info->keys4[i].base; } return NULL; } ",0 "int show_line(FILE *stream, struct name_list **acl_names, acl_t acl, acl_entry_t *acl_ent, const char *acl_mask, struct name_list **dacl_names, acl_t dacl, acl_entry_t *dacl_ent, const char *dacl_mask) { acl_tag_t tag_type; const char *tag, *name; char acl_perm[ACL_PERMS+1], dacl_perm[ACL_PERMS+1]; if (acl) { acl_get_tag_type(*acl_ent, &tag_type); name = (*acl_names)->name; } else { acl_get_tag_type(*dacl_ent, &tag_type); name = (*dacl_names)->name; } switch(tag_type) { case ACL_USER_OBJ: tag = ""USER""; break; case ACL_USER: tag = ""user""; break; case ACL_GROUP_OBJ: tag = ""GROUP""; break; case ACL_GROUP: tag = ""group""; break; case ACL_MASK: tag = ""mask""; break; case ACL_OTHER: tag = ""other""; break; default: return -1; } memset(acl_perm, ' ', ACL_PERMS); acl_perm[ACL_PERMS] = '\0'; if (acl_ent) { acl_perm_str(*acl_ent, acl_perm); if (tag_type != ACL_USER_OBJ && tag_type != ACL_OTHER && tag_type != ACL_MASK) apply_mask(acl_perm, acl_mask); } memset(dacl_perm, ' ', ACL_PERMS); dacl_perm[ACL_PERMS] = '\0'; if (dacl_ent) { acl_perm_str(*dacl_ent, dacl_perm); if (tag_type != ACL_USER_OBJ && tag_type != ACL_OTHER && tag_type != ACL_MASK) apply_mask(dacl_perm, dacl_mask); } fprintf(stream, ""%-5s %*s %*s %*s\n"", tag, -names_width, name, -(int)ACL_PERMS, acl_perm, -(int)ACL_PERMS, dacl_perm); if (acl_names) { acl_get_entry(acl, ACL_NEXT_ENTRY, acl_ent); (*acl_names) = (*acl_names)->next; } if (dacl_names) { acl_get_entry(dacl, ACL_NEXT_ENTRY, dacl_ent); (*dacl_names) = (*dacl_names)->next; } return 0; } ",0 "int ssl3_check_cert_and_algorithm(SSL *s) { int i, idx; long alg_k, alg_a; EVP_PKEY *pkey = NULL; int pkey_bits; SESS_CERT *sc; #ifndef OPENSSL_NO_RSA RSA *rsa; #endif #ifndef OPENSSL_NO_DH DH *dh; #endif int al = SSL_AD_HANDSHAKE_FAILURE; alg_k = s->s3->tmp.new_cipher->algorithm_mkey; alg_a = s->s3->tmp.new_cipher->algorithm_auth; /* we don't have a certificate */ if ((alg_a & (SSL_aNULL | SSL_aKRB5)) || (alg_k & SSL_kPSK)) return (1); sc = s->session->sess_cert; if (sc == NULL) { SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM, ERR_R_INTERNAL_ERROR); goto err; } #ifndef OPENSSL_NO_RSA rsa = s->session->sess_cert->peer_rsa_tmp; #endif #ifndef OPENSSL_NO_DH dh = s->session->sess_cert->peer_dh_tmp; #endif /* This is the passed certificate */ idx = sc->peer_cert_type; #ifndef OPENSSL_NO_ECDH if (idx == SSL_PKEY_ECC) { if (ssl_check_srvr_ecc_cert_and_alg(sc->peer_pkeys[idx].x509, s) == 0) { /* check failed */ SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM, SSL_R_BAD_ECC_CERT); goto f_err; } else { return 1; } } else if (alg_a & SSL_aECDSA) { SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM, SSL_R_MISSING_ECDSA_SIGNING_CERT); goto f_err; } else if (alg_k & (SSL_kECDHr | SSL_kECDHe)) { SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM, SSL_R_MISSING_ECDH_CERT); goto f_err; } #endif pkey = X509_get_pubkey(sc->peer_pkeys[idx].x509); pkey_bits = EVP_PKEY_bits(pkey); i = X509_certificate_type(sc->peer_pkeys[idx].x509, pkey); EVP_PKEY_free(pkey); /* Check that we have a certificate if we require one */ if ((alg_a & SSL_aRSA) && !has_bits(i, EVP_PK_RSA | EVP_PKT_SIGN)) { SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM, SSL_R_MISSING_RSA_SIGNING_CERT); goto f_err; } #ifndef OPENSSL_NO_DSA else if ((alg_a & SSL_aDSS) && !has_bits(i, EVP_PK_DSA | EVP_PKT_SIGN)) { SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM, SSL_R_MISSING_DSA_SIGNING_CERT); goto f_err; } #endif #ifndef OPENSSL_NO_RSA if (alg_k & SSL_kRSA) { if (!SSL_C_IS_EXPORT(s->s3->tmp.new_cipher) && !has_bits(i, EVP_PK_RSA | EVP_PKT_ENC)) { SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM, SSL_R_MISSING_RSA_ENCRYPTING_CERT); goto f_err; } else if (SSL_C_IS_EXPORT(s->s3->tmp.new_cipher)) { if (pkey_bits <= SSL_C_EXPORT_PKEYLENGTH(s->s3->tmp.new_cipher)) { if (!has_bits(i, EVP_PK_RSA | EVP_PKT_ENC)) { SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM, SSL_R_MISSING_RSA_ENCRYPTING_CERT); goto f_err; } if (rsa != NULL) { /* server key exchange is not allowed. */ al = SSL_AD_INTERNAL_ERROR; SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM, ERR_R_INTERNAL_ERROR); goto f_err; } } } } #endif #ifndef OPENSSL_NO_DH if ((alg_k & SSL_kEDH) && dh == NULL) { al = SSL_AD_INTERNAL_ERROR; SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM, ERR_R_INTERNAL_ERROR); goto f_err; } if ((alg_k & SSL_kDHr) && !SSL_USE_SIGALGS(s) && !has_bits(i, EVP_PK_DH | EVP_PKS_RSA)) { SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM, SSL_R_MISSING_DH_RSA_CERT); goto f_err; } # ifndef OPENSSL_NO_DSA if ((alg_k & SSL_kDHd) && !SSL_USE_SIGALGS(s) && !has_bits(i, EVP_PK_DH | EVP_PKS_DSA)) { SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM, SSL_R_MISSING_DH_DSA_CERT); goto f_err; } # endif if (alg_k & (SSL_kDHE | SSL_kDHr | SSL_kDHd)) { int dh_size; if (alg_k & SSL_kDHE) { dh_size = BN_num_bits(dh->p); } else { DH *dh_srvr = get_server_static_dh_key(sc); if (dh_srvr == NULL) goto f_err; dh_size = BN_num_bits(dh_srvr->p); DH_free(dh_srvr); } if ((!SSL_C_IS_EXPORT(s->s3->tmp.new_cipher) && dh_size < 768) || (SSL_C_IS_EXPORT(s->s3->tmp.new_cipher) && dh_size < 512)) { SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM, SSL_R_DH_KEY_TOO_SMALL); goto f_err; } } #endif /* !OPENSSL_NO_DH */ if (SSL_C_IS_EXPORT(s->s3->tmp.new_cipher) && pkey_bits > SSL_C_EXPORT_PKEYLENGTH(s->s3->tmp.new_cipher)) { #ifndef OPENSSL_NO_RSA if (alg_k & SSL_kRSA) { if (rsa == NULL) { SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM, SSL_R_MISSING_EXPORT_TMP_RSA_KEY); goto f_err; } else if (BN_num_bits(rsa->n) > SSL_C_EXPORT_PKEYLENGTH(s->s3->tmp.new_cipher)) { /* We have a temporary RSA key but it's too large. */ al = SSL_AD_EXPORT_RESTRICTION; SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM, SSL_R_MISSING_EXPORT_TMP_RSA_KEY); goto f_err; } } else #endif #ifndef OPENSSL_NO_DH if (alg_k & SSL_kDHE) { if (BN_num_bits(dh->p) > SSL_C_EXPORT_PKEYLENGTH(s->s3->tmp.new_cipher)) { /* We have a temporary DH key but it's too large. */ al = SSL_AD_EXPORT_RESTRICTION; SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM, SSL_R_MISSING_EXPORT_TMP_DH_KEY); goto f_err; } } else if (alg_k & (SSL_kDHr | SSL_kDHd)) { /* The cert should have had an export DH key. */ al = SSL_AD_EXPORT_RESTRICTION; SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM, SSL_R_MISSING_EXPORT_TMP_DH_KEY); goto f_err; } else #endif { SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM, SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE); goto f_err; } } return (1); f_err: ssl3_send_alert(s, SSL3_AL_FATAL, al); err: return (0); } ",0 "JsVar *jsvGetIndexOf(JsVar *arr, JsVar *value, bool matchExact) { return jsvGetIndexOfFull(arr, value, matchExact, false, 0); } ",0 "void jas_free(void *ptr) { JAS_DBGLOG(100, (""jas_free(%p)\n"", ptr)); free(ptr); } ",0 "static int in_set_sample_rate(struct audio_stream *stream, uint32_t rate) { (void)stream; (void)rate; return -ENOSYS; } ",0 "static inline void put_tpel_pixels_mc20_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ int i,j; for (i=0; i < height; i++) { for (j=0; j < width; j++) { dst[j] = (683*(src[j] + 2*src[j+1] + 1)) >> 11; } src += stride; dst += stride; } } ",0 "void AddPreviewNavigationToBlackListCallback( content::BrowserContext* browser_context, const GURL& url, previews::PreviewsType type, uint64_t page_id, bool opt_out) { PreviewsService* previews_service = PreviewsServiceFactory::GetForProfile( Profile::FromBrowserContext(browser_context)); if (previews_service && previews_service->previews_ui_service()) { previews_service->previews_ui_service()->AddPreviewNavigation( url, type, opt_out, page_id); } } ",0 "static void ims_pcu_buffers_free(struct ims_pcu *pcu) { usb_kill_urb(pcu->urb_in); usb_free_urb(pcu->urb_in); usb_free_coherent(pcu->udev, pcu->max_out_size, pcu->urb_in_buf, pcu->read_dma); kfree(pcu->urb_out_buf); usb_kill_urb(pcu->urb_ctrl); usb_free_urb(pcu->urb_ctrl); usb_free_coherent(pcu->udev, pcu->max_ctrl_size, pcu->urb_ctrl_buf, pcu->ctrl_dma); } ",0 "static bool vmx_segment_cache_test_set(struct vcpu_vmx *vmx, unsigned seg, unsigned field) { bool ret; u32 mask = 1 << (seg * SEG_FIELD_NR + field); if (!(vmx->vcpu.arch.regs_avail & (1 << VCPU_EXREG_SEGMENTS))) { vmx->vcpu.arch.regs_avail |= (1 << VCPU_EXREG_SEGMENTS); vmx->segment_cache.bitmask = 0; } ret = vmx->segment_cache.bitmask & mask; vmx->segment_cache.bitmask |= mask; return ret; } ",0 "bool IPAttributesGetterMac::IsInitialized() const { return ioctl_socket_ >= 0; } ",0 "void ieee80211_sta_eosp(struct ieee80211_sta *pubsta) { struct sta_info *sta = container_of(pubsta, struct sta_info, sta); struct ieee80211_local *local = sta->local; trace_api_eosp(local, pubsta); clear_sta_flag(sta, WLAN_STA_SP); } ",0 "uint8_t rfc_parse_data(tRFC_MCB* p_mcb, MX_FRAME* p_frame, BT_HDR* p_buf) { uint8_t ead, eal, fcs; uint8_t* p_data = (uint8_t*)(p_buf + 1) + p_buf->offset; uint8_t* p_start = p_data; uint16_t len; if (p_buf->len < RFCOMM_CTRL_FRAME_LEN) { RFCOMM_TRACE_ERROR(""Bad Length1: %d"", p_buf->len); return (RFC_EVENT_BAD_FRAME); } RFCOMM_PARSE_CTRL_FIELD(ead, p_frame->cr, p_frame->dlci, p_data); if (!ead) { RFCOMM_TRACE_ERROR(""Bad Address(EA must be 1)""); return (RFC_EVENT_BAD_FRAME); } RFCOMM_PARSE_TYPE_FIELD(p_frame->type, p_frame->pf, p_data); RFCOMM_PARSE_LEN_FIELD(eal, len, p_data); p_buf->len -= (3 + !ead + !eal + 1); /* Additional 1 for FCS */ p_buf->offset += (3 + !ead + !eal); /* handle credit if credit based flow control */ if ((p_mcb->flow == PORT_FC_CREDIT) && (p_frame->type == RFCOMM_UIH) && (p_frame->dlci != RFCOMM_MX_DLCI) && (p_frame->pf == 1)) { p_frame->credit = *p_data++; p_buf->len--; p_buf->offset++; } else p_frame->credit = 0; if (p_buf->len != len) { RFCOMM_TRACE_ERROR(""Bad Length2 %d %d"", p_buf->len, len); return (RFC_EVENT_BAD_FRAME); } fcs = *(p_data + len); /* All control frames that we are sending are sent with P=1, expect */ /* reply with F=1 */ /* According to TS 07.10 spec ivalid frames are discarded without */ /* notification to the sender */ switch (p_frame->type) { case RFCOMM_SABME: if (RFCOMM_FRAME_IS_RSP(p_mcb->is_initiator, p_frame->cr) || !p_frame->pf || len || !RFCOMM_VALID_DLCI(p_frame->dlci) || !rfc_check_fcs(RFCOMM_CTRL_FRAME_LEN, p_start, fcs)) { RFCOMM_TRACE_ERROR(""Bad SABME""); return (RFC_EVENT_BAD_FRAME); } else return (RFC_EVENT_SABME); case RFCOMM_UA: if (RFCOMM_FRAME_IS_CMD(p_mcb->is_initiator, p_frame->cr) || !p_frame->pf || len || !RFCOMM_VALID_DLCI(p_frame->dlci) || !rfc_check_fcs(RFCOMM_CTRL_FRAME_LEN, p_start, fcs)) { RFCOMM_TRACE_ERROR(""Bad UA""); return (RFC_EVENT_BAD_FRAME); } else return (RFC_EVENT_UA); case RFCOMM_DM: if (RFCOMM_FRAME_IS_CMD(p_mcb->is_initiator, p_frame->cr) || len || !RFCOMM_VALID_DLCI(p_frame->dlci) || !rfc_check_fcs(RFCOMM_CTRL_FRAME_LEN, p_start, fcs)) { RFCOMM_TRACE_ERROR(""Bad DM""); return (RFC_EVENT_BAD_FRAME); } else return (RFC_EVENT_DM); case RFCOMM_DISC: if (RFCOMM_FRAME_IS_RSP(p_mcb->is_initiator, p_frame->cr) || !p_frame->pf || len || !RFCOMM_VALID_DLCI(p_frame->dlci) || !rfc_check_fcs(RFCOMM_CTRL_FRAME_LEN, p_start, fcs)) { RFCOMM_TRACE_ERROR(""Bad DISC""); return (RFC_EVENT_BAD_FRAME); } else return (RFC_EVENT_DISC); case RFCOMM_UIH: if (!RFCOMM_VALID_DLCI(p_frame->dlci)) { RFCOMM_TRACE_ERROR(""Bad UIH - invalid DLCI""); return (RFC_EVENT_BAD_FRAME); } else if (!rfc_check_fcs(2, p_start, fcs)) { RFCOMM_TRACE_ERROR(""Bad UIH - FCS""); return (RFC_EVENT_BAD_FRAME); } else if (RFCOMM_FRAME_IS_RSP(p_mcb->is_initiator, p_frame->cr)) { /* we assume that this is ok to allow bad implementations to work */ RFCOMM_TRACE_ERROR(""Bad UIH - response""); return (RFC_EVENT_UIH); } else return (RFC_EVENT_UIH); } return (RFC_EVENT_BAD_FRAME); } ",1 "static struct file *do_open(struct path *path, int oflag) { static const int oflag2acc[O_ACCMODE] = { MAY_READ, MAY_WRITE, MAY_READ | MAY_WRITE }; int acc; if ((oflag & O_ACCMODE) == (O_RDWR | O_WRONLY)) return ERR_PTR(-EINVAL); acc = oflag2acc[oflag & O_ACCMODE]; if (inode_permission(d_inode(path->dentry), acc)) return ERR_PTR(-EACCES); return dentry_open(path, oflag, current_cred()); } ",0 "static MagickBooleanType InsertRow(Image *image,ssize_t bpp,unsigned char *p, ssize_t y,ExceptionInfo *exception) { int bit; Quantum index; register Quantum *q; ssize_t x; q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) return(MagickFalse); switch (bpp) { case 1: /* Convert bitmap scanline. */ { for (x=0; x < ((ssize_t) image->columns-7); x+=8) { for (bit=0; bit < 8; bit++) { index=((*p) & (0x80 >> bit) ? 0x01 : 0x00); SetPixelIndex(image,index,q); if (index < image->colors) SetPixelViaPixelInfo(image,image->colormap+(ssize_t) index,q); q+=GetPixelChannels(image); } p++; } if ((image->columns % 8) != 0) { for (bit=0; bit < (ssize_t) (image->columns % 8); bit++) { index=((*p) & (0x80 >> bit) ? 0x01 : 0x00); SetPixelIndex(image,index,q); if (index < image->colors) SetPixelViaPixelInfo(image,image->colormap+(ssize_t) index,q); SetPixelViaPixelInfo(image,image->colormap+(ssize_t) index,q); q+=GetPixelChannels(image); } p++; } break; } case 2: /* Convert PseudoColor scanline. */ { for (x=0; x < ((ssize_t) image->columns-3); x+=4) { index=ConstrainColormapIndex(image,(*p >> 6) & 0x3,exception); SetPixelIndex(image,index,q); if (index < image->colors) SetPixelViaPixelInfo(image,image->colormap+(ssize_t) index,q); q+=GetPixelChannels(image); index=ConstrainColormapIndex(image,(*p >> 4) & 0x3,exception); SetPixelIndex(image,index,q); if (index < image->colors) SetPixelViaPixelInfo(image,image->colormap+(ssize_t) index,q); q+=GetPixelChannels(image); index=ConstrainColormapIndex(image,(*p >> 2) & 0x3,exception); SetPixelIndex(image,index,q); if (index < image->colors) SetPixelViaPixelInfo(image,image->colormap+(ssize_t) index,q); q+=GetPixelChannels(image); index=ConstrainColormapIndex(image,(*p) & 0x3,exception); SetPixelIndex(image,index,q); if (index < image->colors) SetPixelViaPixelInfo(image,image->colormap+(ssize_t) index,q); q+=GetPixelChannels(image); p++; } if ((image->columns % 4) != 0) { index=ConstrainColormapIndex(image,(*p >> 6) & 0x3,exception); SetPixelIndex(image,index,q); if (index < image->colors) SetPixelViaPixelInfo(image,image->colormap+(ssize_t) index,q); q+=GetPixelChannels(image); if ((image->columns % 4) > 1) { index=ConstrainColormapIndex(image,(*p >> 4) & 0x3,exception); SetPixelIndex(image,index,q); if (index < image->colors) SetPixelViaPixelInfo(image,image->colormap+(ssize_t) index,q); q+=GetPixelChannels(image); if ((image->columns % 4) > 2) { index=ConstrainColormapIndex(image,(*p >> 2) & 0x3, exception); SetPixelIndex(image,index,q); if (index < image->colors) SetPixelViaPixelInfo(image,image->colormap+(ssize_t) index,q); q+=GetPixelChannels(image); } } p++; } break; } case 4: /* Convert PseudoColor scanline. */ { for (x=0; x < ((ssize_t) image->columns-1); x+=2) { index=ConstrainColormapIndex(image,(*p >> 4) & 0x0f,exception); SetPixelIndex(image,index,q); if (index < image->colors) SetPixelViaPixelInfo(image,image->colormap+(ssize_t) index,q); q+=GetPixelChannels(image); index=ConstrainColormapIndex(image,(*p) & 0x0f,exception); SetPixelIndex(image,index,q); if (index < image->colors) SetPixelViaPixelInfo(image,image->colormap+(ssize_t) index,q); p++; q+=GetPixelChannels(image); } if ((image->columns % 2) != 0) { index=ConstrainColormapIndex(image,(*p >> 4) & 0x0f,exception); SetPixelIndex(image,index,q); if (index < image->colors) SetPixelViaPixelInfo(image,image->colormap+(ssize_t) index,q); p++; q+=GetPixelChannels(image); } break; } case 8: /* Convert PseudoColor scanline. */ { for (x=0; x < (ssize_t) image->columns; x++) { index=ConstrainColormapIndex(image,*p,exception); SetPixelIndex(image,index,q); if (index < image->colors) SetPixelViaPixelInfo(image,image->colormap+(ssize_t) index,q); p++; q+=GetPixelChannels(image); } } break; case 24: /* Convert DirectColor scanline. */ for (x=0; x < (ssize_t) image->columns; x++) { SetPixelRed(image,ScaleCharToQuantum(*p++),q); SetPixelGreen(image,ScaleCharToQuantum(*p++),q); SetPixelBlue(image,ScaleCharToQuantum(*p++),q); q+=GetPixelChannels(image); } break; } if (!SyncAuthenticPixels(image,exception)) return(MagickFalse); return(MagickTrue); } ",0 "void SyncBackendHost::Core::DeleteSyncDataFolder() { if (file_util::DirectoryExists(host_->sync_data_folder_path())) { if (!file_util::Delete(host_->sync_data_folder_path(), true)) SLOG(DFATAL) << ""Could not delete the Sync Data folder.""; } } ",0 "void kvm_emulate_cpuid(struct kvm_vcpu *vcpu) { u32 function, index; struct kvm_cpuid_entry2 *best; function = kvm_register_read(vcpu, VCPU_REGS_RAX); index = kvm_register_read(vcpu, VCPU_REGS_RCX); kvm_register_write(vcpu, VCPU_REGS_RAX, 0); kvm_register_write(vcpu, VCPU_REGS_RBX, 0); kvm_register_write(vcpu, VCPU_REGS_RCX, 0); kvm_register_write(vcpu, VCPU_REGS_RDX, 0); best = kvm_find_cpuid_entry(vcpu, function, index); if (best) { kvm_register_write(vcpu, VCPU_REGS_RAX, best->eax); kvm_register_write(vcpu, VCPU_REGS_RBX, best->ebx); kvm_register_write(vcpu, VCPU_REGS_RCX, best->ecx); kvm_register_write(vcpu, VCPU_REGS_RDX, best->edx); } kvm_x86_ops->skip_emulated_instruction(vcpu); trace_kvm_cpuid(function, kvm_register_read(vcpu, VCPU_REGS_RAX), kvm_register_read(vcpu, VCPU_REGS_RBX), kvm_register_read(vcpu, VCPU_REGS_RCX), kvm_register_read(vcpu, VCPU_REGS_RDX)); } ",0 "cupsdSendCommand( cupsd_client_t *con, /* I - Client connection */ char *command, /* I - Command to run */ char *options, /* I - Command-line options */ int root) /* I - Run as root? */ { int fd; /* Standard input file descriptor */ if (con->filename) { fd = open(con->filename, O_RDONLY); if (fd < 0) { cupsdLogClient(con, CUPSD_LOG_ERROR, ""Unable to open \""%s\"" for reading: %s"", con->filename ? con->filename : ""/dev/null"", strerror(errno)); return (0); } fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC); } else fd = -1; con->pipe_pid = pipe_command(con, fd, &(con->file), command, options, root); con->pipe_status = HTTP_STATUS_OK; httpClearFields(con->http); if (fd >= 0) close(fd); cupsdLogClient(con, CUPSD_LOG_INFO, ""Started \""%s\"" (pid=%d, file=%d)"", command, con->pipe_pid, con->file); if (con->pipe_pid == 0) return (0); fcntl(con->file, F_SETFD, fcntl(con->file, F_GETFD) | FD_CLOEXEC); cupsdAddSelect(con->file, (cupsd_selfunc_t)write_pipe, NULL, con); cupsdLogClient(con, CUPSD_LOG_DEBUG, ""Waiting for CGI data.""); con->sent_header = 0; con->file_ready = 0; con->got_fields = 0; con->header_used = 0; return (1); } ",0 "struct fib6_table *fib6_new_table(struct net *net, u32 id) { return fib6_get_table(net, id); } ",0 "static void voidMethodDefaultUndefinedTestInterfaceEmptyArgMethod(const v8::FunctionCallbackInfo& info) { TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); V8TRYCATCH_VOID(TestInterfaceEmpty*, defaultUndefinedTestInterfaceEmptyArg, V8TestInterfaceEmpty::toNativeWithTypeCheck(info.GetIsolate(), info[0])); imp->voidMethodDefaultUndefinedTestInterfaceEmptyArg(defaultUndefinedTestInterfaceEmptyArg); } ",0 "static bool set_wake_alarm_callout(uint64_t delay_millis, bool should_wake, alarm_cb cb, void *data) { JNIEnv *env; JavaVM *vm = AndroidRuntime::getJavaVM(); jint status = vm->GetEnv((void **)&env, JNI_VERSION_1_6); if (status != JNI_OK && status != JNI_EDETACHED) { ALOGE(""%s unable to get environment for JNI call"", __func__); return false; } if (status == JNI_EDETACHED && vm->AttachCurrentThread(&env, &sAttachArgs) != 0) { ALOGE(""%s unable to attach thread to VM"", __func__); return false; } sAlarmCallback = cb; sAlarmCallbackData = data; jboolean jshould_wake = should_wake ? JNI_TRUE : JNI_FALSE; jboolean ret = env->CallBooleanMethod(sJniAdapterServiceObj, method_setWakeAlarm, (jlong)delay_millis, jshould_wake); if (!ret) { sAlarmCallback = NULL; sAlarmCallbackData = NULL; } if (status == JNI_EDETACHED) { vm->DetachCurrentThread(); } return !!ret; } ",0 "static void nfsd_shutdown_generic(void) { if (--nfsd_users) return; nfs4_state_shutdown(); nfsd_racache_shutdown(); } ",0 "ExtensionServiceBackend::ExtensionServiceBackend( base::WeakPtr frontend, const FilePath& install_directory) : frontend_(frontend), install_directory_(install_directory) { CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); } ",0 "static void insert_to_mm_slots_hash(struct mm_struct *mm, struct mm_slot *mm_slot) { struct hlist_head *bucket; bucket = &mm_slots_hash[((unsigned long)mm / sizeof(struct mm_struct)) % MM_SLOTS_HASH_HEADS]; mm_slot->mm = mm; hlist_add_head(&mm_slot->hash, bucket); } ",0 "static void cs_store(boolean is_subr) { char *p; cs_entry *ptr; int subr; for (p = t1_line_array, t1_buf_ptr = t1_buf_array; *p != ' '; *t1_buf_ptr++ = *p++); *t1_buf_ptr = 0; if (is_subr) { subr = (int) t1_scan_num(p + 1, 0); check_subr(subr); ptr = subr_tab + subr; } else { ptr = cs_ptr++; if (cs_ptr - cs_tab > cs_size) formatted_error(""type 1"",""CharStrings dict: more entries than dict size '%i'"", cs_size); if (strcmp(t1_buf_array + 1, notdef) == 0) /* skip the slash */ ptr->name = (char *) notdef; else ptr->name = xstrdup(t1_buf_array + 1); } /*tex Copy |"" RD "" + cs data| to |t1_buf_array|. */ memcpy(t1_buf_array, t1_line_array + cs_start - 4, (unsigned) (t1_cslen + 4)); /*tex Copy the end of cs data to |t1_buf_array|. */ for (p = t1_line_array + cs_start + t1_cslen, t1_buf_ptr = t1_buf_array + t1_cslen + 4; *p != 10; *t1_buf_ptr++ = *p++); *t1_buf_ptr++ = 10; if (is_subr && cs_token_pair == NULL) cs_token_pair = check_cs_token_pair(); ptr->len = (unsigned short) (t1_buf_ptr - t1_buf_array); ptr->cslen = t1_cslen; xfree(ptr->data); ptr->data = xtalloc(ptr->len, byte); memcpy(ptr->data, t1_buf_array, ptr->len); ptr->valid = true; } ",0 "uWireSlave *tsc2301_init(qemu_irq penirq, qemu_irq kbirq, qemu_irq dav) { TSC210xState *s; s = (TSC210xState *) g_malloc0(sizeof(TSC210xState)); memset(s, 0, sizeof(TSC210xState)); s->x = 400; s->y = 240; s->pressure = 0; s->precision = s->nextprecision = 0; s->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, tsc210x_timer_tick, s); s->pint = penirq; s->kbint = kbirq; s->davint = dav; s->model = 0x2301; s->name = ""tsc2301""; s->tr[0] = 0; s->tr[1] = 1; s->tr[2] = 1; s->tr[3] = 0; s->tr[4] = 1; s->tr[5] = 0; s->tr[6] = 1; s->tr[7] = 0; s->chip.opaque = s; s->chip.send = (void *) tsc210x_write; s->chip.receive = (void *) tsc210x_read; s->codec.opaque = s; s->codec.tx_swallow = (void *) tsc210x_i2s_swallow; s->codec.set_rate = (void *) tsc210x_i2s_set_rate; s->codec.in.fifo = s->in_fifo; s->codec.out.fifo = s->out_fifo; tsc210x_reset(s); qemu_add_mouse_event_handler(tsc210x_touchscreen_event, s, 1, ""QEMU TSC2301-driven Touchscreen""); AUD_register_card(s->name, &s->card); qemu_register_reset((void *) tsc210x_reset, s); register_savevm(NULL, s->name, -1, 0, tsc210x_save, tsc210x_load, s); return &s->chip; } ",0 "ScriptPromise Notification::requestPermission(ScriptState* scriptState, NotificationPermissionCallback* deprecatedCallback) { ExecutionContext* context = scriptState->executionContext(); if (NotificationPermissionClient* permissionClient = NotificationPermissionClient::from(context)) return permissionClient->requestPermission(scriptState, deprecatedCallback); ASSERT(context->activeDOMObjectsAreStopped()); return ScriptPromise(); } ",0 "GfxShadingPattern *GfxShadingPattern::parse(Object *patObj) { Dict *dict; GfxShading *shadingA; double matrixA[6]; Object obj1, obj2; int i; if (!patObj->isDict()) { return NULL; } dict = patObj->getDict(); dict->lookup(""Shading"", &obj1); shadingA = GfxShading::parse(&obj1); obj1.free(); if (!shadingA) { return NULL; } matrixA[0] = 1; matrixA[1] = 0; matrixA[2] = 0; matrixA[3] = 1; matrixA[4] = 0; matrixA[5] = 0; if (dict->lookup(""Matrix"", &obj1)->isArray() && obj1.arrayGetLength() == 6) { for (i = 0; i < 6; ++i) { if (obj1.arrayGet(i, &obj2)->isNum()) { matrixA[i] = obj2.getNum(); } obj2.free(); } } obj1.free(); return new GfxShadingPattern(shadingA, matrixA); } ",0 "bool WebContentsImpl::IsFullAccessibilityModeForTesting() const { return accessibility_mode_ == AccessibilityModeComplete; } ",0 "void bond_activebackup_arp_mon(struct work_struct *work) { struct bonding *bond = container_of(work, struct bonding, arp_work.work); bool should_notify_peers = false; int delta_in_ticks; read_lock(&bond->lock); if (bond->kill_timers) goto out; delta_in_ticks = msecs_to_jiffies(bond->params.arp_interval); if (bond->slave_cnt == 0) goto re_arm; should_notify_peers = bond_should_notify_peers(bond); if (bond_ab_arp_inspect(bond, delta_in_ticks)) { read_unlock(&bond->lock); rtnl_lock(); read_lock(&bond->lock); bond_ab_arp_commit(bond, delta_in_ticks); read_unlock(&bond->lock); rtnl_unlock(); read_lock(&bond->lock); } bond_ab_arp_probe(bond); re_arm: if (bond->params.arp_interval) queue_delayed_work(bond->wq, &bond->arp_work, delta_in_ticks); out: read_unlock(&bond->lock); if (should_notify_peers) { rtnl_lock(); netdev_bonding_change(bond->dev, NETDEV_NOTIFY_PEERS); rtnl_unlock(); } } ",0 "static inline int l2cap_command_rej(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u8 *data) { struct l2cap_cmd_rej *rej = (struct l2cap_cmd_rej *) data; if (rej->reason != 0x0000) return 0; if ((conn->info_state & L2CAP_INFO_FEAT_MASK_REQ_SENT) && cmd->ident == conn->info_ident) { del_timer(&conn->info_timer); conn->info_state |= L2CAP_INFO_FEAT_MASK_REQ_DONE; conn->info_ident = 0; l2cap_conn_start(conn); } return 0; } ",0 "void ssh_connshare_log(Ssh ssh, int event, const char *logtext, const char *ds_err, const char *us_err) { if (event == SHARE_NONE) { /* In this case, 'logtext' is an error message indicating a * reason why connection sharing couldn't be set up _at all_. * Failing that, ds_err and us_err indicate why we couldn't be * a downstream and an upstream respectively. */ if (logtext) { logeventf(ssh, ""Could not set up connection sharing: %s"", logtext); } else { if (ds_err) logeventf(ssh, ""Could not set up connection sharing"" "" as downstream: %s"", ds_err); if (us_err) logeventf(ssh, ""Could not set up connection sharing"" "" as upstream: %s"", us_err); } } else if (event == SHARE_DOWNSTREAM) { /* In this case, 'logtext' is a local endpoint address */ logeventf(ssh, ""Using existing shared connection at %s"", logtext); /* Also we should mention this in the console window to avoid * confusing users as to why this window doesn't behave the * usual way. */ if ((flags & FLAG_VERBOSE) || (flags & FLAG_INTERACTIVE)) { c_write_str(ssh,""Reusing a shared connection to this server.\r\n""); } } else if (event == SHARE_UPSTREAM) { /* In this case, 'logtext' is a local endpoint address too */ logeventf(ssh, ""Sharing this connection at %s"", logtext); } } ",0 "person_get_frame(const person_t* person) { int num_frames; num_frames = spriteset_num_frames(person->sprite, person->direction); return person->frame % num_frames; } ",0 "Browser::Browser(const CreateParams& params) : extension_registry_observer_(this), type_(params.type), profile_(params.profile), window_(NULL), tab_strip_model_delegate_(new chrome::BrowserTabStripModelDelegate(this)), tab_strip_model_( new TabStripModel(tab_strip_model_delegate_.get(), params.profile)), app_name_(params.app_name), is_trusted_source_(params.trusted_source), cancel_download_confirmation_state_(NOT_PROMPTED), override_bounds_(params.initial_bounds), initial_show_state_(params.initial_show_state), initial_workspace_(params.initial_workspace), is_session_restore_(params.is_session_restore), content_setting_bubble_model_delegate_( new BrowserContentSettingBubbleModelDelegate(this)), toolbar_model_delegate_(new BrowserToolbarModelDelegate(this)), live_tab_context_(new BrowserLiveTabContext(this)), synced_window_delegate_(new BrowserSyncedWindowDelegate(this)), bookmark_bar_state_(BookmarkBar::HIDDEN), command_controller_(new chrome::BrowserCommandController(this)), window_has_shown_(false), chrome_updater_factory_(this), weak_factory_(this) { CHECK(IncognitoModePrefs::CanOpenBrowser(profile_)); CHECK(!profile_->IsGuestSession() || profile_->IsOffTheRecord()) << ""Only off the record browser may be opened in guest mode""; DCHECK(!profile_->IsSystemProfile()) << ""The system profile should never have a real browser.""; if (profile_->IsSystemProfile()) content::RecordAction(base::UserMetricsAction(""BrowserForSystemProfile"")); if (IsFastTabUnloadEnabled()) fast_unload_controller_.reset(new chrome::FastUnloadController(this)); else unload_controller_.reset(new chrome::UnloadController(this)); tab_strip_model_->AddObserver(this); toolbar_model_.reset(new ToolbarModelImpl(toolbar_model_delegate_.get(), content::kMaxURLDisplayChars)); search_model_.reset(new SearchModel()); search_delegate_.reset(new SearchDelegate(search_model_.get())); extension_registry_observer_.Add( extensions::ExtensionRegistry::Get(profile_)); registrar_.Add(this, extensions::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, content::NotificationService::AllSources()); #if !defined(OS_ANDROID) registrar_.Add( this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, content::Source( ThemeServiceFactory::GetForProfile(profile_))); #endif registrar_.Add(this, chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED, content::NotificationService::AllSources()); profile_pref_registrar_.Init(profile_->GetPrefs()); profile_pref_registrar_.Add( prefs::kDevToolsDisabled, base::Bind(&Browser::OnDevToolsDisabledChanged, base::Unretained(this))); profile_pref_registrar_.Add( bookmarks::prefs::kShowBookmarkBar, base::Bind(&Browser::UpdateBookmarkBarState, base::Unretained(this), BOOKMARK_BAR_STATE_CHANGE_PREF_CHANGE)); if (search::IsInstantExtendedAPIEnabled() && is_type_tabbed()) instant_controller_.reset(new BrowserInstantController(this)); if (extensions::HostedAppBrowserController::IsForHostedApp(this)) { hosted_app_controller_.reset( new extensions::HostedAppBrowserController(this)); } UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_INIT); ProfileMetrics::LogProfileLaunch(profile_); window_ = params.window ? params.window : CreateBrowserWindow(this); if (hosted_app_controller_) hosted_app_controller_->UpdateLocationBarVisibility(false); extension_window_controller_.reset( new BrowserExtensionWindowController(this)); SessionService* session_service = SessionServiceFactory::GetForProfileForSessionRestore(profile_); if (session_service) session_service->WindowOpened(this); if (first_run::ShouldDoPersonalDataManagerFirstRun()) { #if defined(OS_WIN) ImportAutofillDataWin( autofill::PersonalDataManagerFactory::GetForProfile(profile_)); #endif // defined(OS_WIN) } exclusive_access_manager_.reset( new ExclusiveAccessManager(window_->GetExclusiveAccessContext())); BrowserList::AddBrowser(this); content::NotificationService::current()->Notify( chrome::NOTIFICATION_BROWSER_WINDOW_READY, content::Source(this), content::NotificationService::NoDetails()); } ",0 "static long snd_seq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { struct snd_seq_client *client = file->private_data; if (snd_BUG_ON(!client)) return -ENXIO; return snd_seq_do_ioctl(client, cmd, (void __user *) arg); } ",0 "void GDataFileSystem::CreateFile(const FilePath& file_path, bool is_exclusive, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || BrowserThread::CurrentlyOn(BrowserThread::IO)); RunTaskOnUIThread(base::Bind(&GDataFileSystem::CreateFileOnUIThread, ui_weak_ptr_, file_path, is_exclusive, CreateRelayCallback(callback))); } ",0 "xmlXPathTrailing (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) { if (xmlXPathNodeSetIsEmpty(nodes2)) return(nodes1); if (xmlXPathNodeSetIsEmpty(nodes1)) return(xmlXPathNodeSetCreate(NULL)); xmlXPathNodeSetSort(nodes1); xmlXPathNodeSetSort(nodes2); return(xmlXPathNodeTrailingSorted(nodes1, xmlXPathNodeSetItem(nodes2, 0))); } ",0 "bool push_deferred_smb_message(struct smb_request *req, struct timeval request_time, struct timeval timeout, char *private_data, size_t priv_len) { struct timeval end_time; if (req->unread_bytes) { DEBUG(0,(""push_deferred_smb_message: logic error ! "" ""unread_bytes = %u\n"", (unsigned int)req->unread_bytes )); smb_panic(""push_deferred_smb_message: "" ""logic error unread_bytes != 0"" ); } end_time = timeval_sum(&request_time, &timeout); DEBUG(10,(""push_deferred_open_smb_message: pushing message len %u mid %u "" ""timeout time [%u.%06u]\n"", (unsigned int) smb_len(req->inbuf)+4, (unsigned int)req->mid, (unsigned int)end_time.tv_sec, (unsigned int)end_time.tv_usec)); return push_queued_message(req, request_time, end_time, private_data, priv_len); } ",0 "static int spl_heap_object_count_elements(zval *object, long *count TSRMLS_DC) /* {{{ */ { spl_heap_object *intern = (spl_heap_object*)zend_object_store_get_object(object TSRMLS_CC); if (intern->fptr_count) { zval *rv; zend_call_method_with_0_params(&object, intern->std.ce, &intern->fptr_count, ""count"", &rv); if (rv) { zval_ptr_dtor(&intern->retval); MAKE_STD_ZVAL(intern->retval); ZVAL_ZVAL(intern->retval, rv, 1, 1); convert_to_long(intern->retval); *count = (long) Z_LVAL_P(intern->retval); return SUCCESS; } *count = 0; return FAILURE; } *count = spl_ptr_heap_count(intern->heap); return SUCCESS; } /* }}} */ ",0 "MATCHER(IsLightDump, """") { return arg.level_of_detail == MemoryDumpLevelOfDetail::LIGHT; } ",0 "gst_asf_demux_add_audio_stream (GstASFDemux * demux, asf_stream_audio * audio, guint16 id, guint8 ** p_data, guint64 * p_size) { GstTagList *tags = NULL; GstBuffer *extradata = NULL; GstPad *src_pad; GstCaps *caps; guint16 size_left = 0; gchar *codec_name = NULL; gchar *name = NULL; size_left = audio->size; /* Create the audio pad */ name = g_strdup_printf (""audio_%u"", demux->num_audio_streams); src_pad = gst_pad_new_from_static_template (&audio_src_template, name); g_free (name); /* Swallow up any left over data and set up the * standard properties from the header info */ if (size_left) { GST_INFO_OBJECT (demux, ""Audio header contains %d bytes of "" ""codec specific data"", size_left); g_assert (size_left <= *p_size); gst_asf_demux_get_buffer (&extradata, size_left, p_data, p_size); } /* asf_stream_audio is the same as gst_riff_strf_auds, but with an * additional two bytes indicating extradata. */ /* FIXME: Handle the channel reorder map here */ caps = gst_riff_create_audio_caps (audio->codec_tag, NULL, (gst_riff_strf_auds *) audio, extradata, NULL, &codec_name, NULL); if (caps == NULL) { caps = gst_caps_new_simple (""audio/x-asf-unknown"", ""codec_id"", G_TYPE_INT, (gint) audio->codec_tag, NULL); } /* Informing about that audio format we just added */ if (codec_name) { tags = gst_tag_list_new (GST_TAG_AUDIO_CODEC, codec_name, NULL); g_free (codec_name); } if (audio->byte_rate > 0) { /* Some ASF files have no bitrate props object (often seen with * ASF files that contain raw audio data). Example files can * be generated with FFmpeg (tested with v2.8.6), like this: * * ffmpeg -i sine-wave.wav -c:a pcm_alaw file.asf * * In this case, if audio->byte_rate is nonzero, use that as * the bitrate. */ guint bitrate = audio->byte_rate * 8; if (tags == NULL) tags = gst_tag_list_new_empty (); /* Add bitrate, but only if there is none set already, since * this is just a fallback in case there is no bitrate tag * already present */ gst_tag_list_add (tags, GST_TAG_MERGE_KEEP, GST_TAG_BITRATE, bitrate, NULL); } if (extradata) gst_buffer_unref (extradata); GST_INFO (""Adding audio stream #%u, id %u codec %u (0x%04x), tags=%"" GST_PTR_FORMAT, demux->num_audio_streams, id, audio->codec_tag, audio->codec_tag, tags); ++demux->num_audio_streams; return gst_asf_demux_setup_pad (demux, src_pad, caps, id, FALSE, NULL, tags); } ",0 "void QuotaManager::DidInitializeTemporaryGlobalQuota(int64 quota) { temporary_global_quota_ = quota; temporary_global_quota_callbacks_.Run( db_disabled_ ? kQuotaErrorInvalidAccess : kQuotaStatusOk, kStorageTypeTemporary, quota); if (db_disabled_ || eviction_disabled_) return; if (!need_initialize_origins_) { StartEviction(); return; } temporary_usage_tracker_->GetGlobalUsage(callback_factory_.NewCallback( &QuotaManager::DidRunInitialGetTemporaryGlobalUsage)); } ",0 "addDownloadList(pid_t pid, char *url, char *save, char *lock, clen_t size) { DownloadList *d; d = New(DownloadList); d->pid = pid; d->url = url; if (save[0] != '/' && save[0] != '~') save = Strnew_m_charp(CurrentDir, ""/"", save, NULL)->ptr; d->save = expandPath(save); d->lock = lock; d->size = size; d->time = time(0); d->running = TRUE; d->err = 0; d->next = NULL; d->prev = LastDL; if (LastDL) LastDL->next = d; else FirstDL = d; LastDL = d; add_download_list = TRUE; } ",0 "void TestLoadTimingReused(const net::LoadTimingInfo& load_timing_info) { EXPECT_TRUE(load_timing_info.socket_reused); EXPECT_NE(net::NetLog::Source::kInvalidId, load_timing_info.socket_log_id); EXPECT_TRUE(load_timing_info.proxy_resolve_start.is_null()); EXPECT_TRUE(load_timing_info.proxy_resolve_end.is_null()); net::ExpectConnectTimingHasNoTimes(load_timing_info.connect_timing); EXPECT_FALSE(load_timing_info.send_start.is_null()); EXPECT_LE(load_timing_info.send_start, load_timing_info.send_end); EXPECT_TRUE(load_timing_info.request_start_time.is_null()); EXPECT_TRUE(load_timing_info.request_start.is_null()); EXPECT_TRUE(load_timing_info.receive_headers_end.is_null()); } ",0 "bool OSExchangeData::HasCustomFormat(const CustomFormat& format) const { return provider_->HasCustomFormat(format); } ",0 "static BROTLI_NOINLINE BrotliResult ProcessCommands(BrotliState* s) { return ProcessCommandsInternal(0, s); } ",0 "const char *FS_ReferencedPakNames( void ) { static char info[BIG_INFO_STRING]; searchpath_t *search; info[0] = 0; for ( search = fs_searchpaths ; search ; search = search->next ) { if ( search->pack ) { if (search->pack->referenced || Q_stricmpn(search->pack->pakGamename, com_basegame->string, strlen(com_basegame->string))) { if (*info) { Q_strcat(info, sizeof( info ), "" "" ); } Q_strcat( info, sizeof( info ), search->pack->pakGamename ); Q_strcat( info, sizeof( info ), ""/"" ); Q_strcat( info, sizeof( info ), search->pack->pakBasename ); } } } return info; } ",0 "void GfxState::shift(double dx, double dy) { curX += dx; curY += dy; } ",0 "bool decode(ArgumentDecoder* decoder, RetainPtr& result) { RetainPtr baseURL; bool hasBaseURL; if (!decoder->decodeBool(hasBaseURL)) return false; if (hasBaseURL) { if (!decode(decoder, baseURL)) return false; } RetainPtr string; if (!decode(decoder, string)) return false; CFURLRef url = CFURLCreateWithString(0, string.get(), baseURL.get()); if (!url) return false; result.adoptCF(url); return true; } ",1 "static struct hci_conn *hidp_get_connection(struct hidp_session *session) { bdaddr_t *src = &bt_sk(session->ctrl_sock->sk)->src; bdaddr_t *dst = &bt_sk(session->ctrl_sock->sk)->dst; struct hci_conn *conn; struct hci_dev *hdev; hdev = hci_get_route(dst, src); if (!hdev) return NULL; hci_dev_lock(hdev); conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst); if (conn) hci_conn_hold_device(conn); hci_dev_unlock(hdev); hci_dev_put(hdev); return conn; } ",0 "static u32 gen_reqid(struct net *net) { struct xfrm_policy_walk walk; u32 start; int rc; static u32 reqid = IPSEC_MANUAL_REQID_MAX; start = reqid; do { ++reqid; if (reqid == 0) reqid = IPSEC_MANUAL_REQID_MAX+1; xfrm_policy_walk_init(&walk, XFRM_POLICY_TYPE_MAIN); rc = xfrm_policy_walk(net, &walk, check_reqid, (void*)&reqid); xfrm_policy_walk_done(&walk); if (rc != -EEXIST) return reqid; } while (reqid != start); return 0; } ",0 "void SystemClipboard::SetSelectionMode(bool selection_mode) { buffer_ = selection_mode ? mojom::ClipboardBuffer::kSelection : mojom::ClipboardBuffer::kStandard; } ",0 "static int mk_request_process(struct client_session *cs, struct session_request *sr) { int status = 0; int socket = cs->socket; struct mk_list *hosts = &config->hosts; struct mk_list *alias; /* Always assign the first node 'default vhost' */ sr->host_conf = mk_list_entry_first(hosts, struct host, _head); /* Parse request */ status = mk_request_header_process(sr); if (status < 0) { mk_header_set_http_status(sr, MK_CLIENT_BAD_REQUEST); mk_request_error(MK_CLIENT_BAD_REQUEST, cs, sr); return EXIT_ABORT; } sr->user_home = MK_FALSE; /* Valid request URI? */ if (sr->uri_processed.data[0] != '/') { mk_request_error(MK_CLIENT_BAD_REQUEST, cs, sr); return EXIT_NORMAL; } /* HTTP/1.1 needs Host header */ if (!sr->host.data && sr->protocol == MK_HTTP_PROTOCOL_11) { mk_request_error(MK_CLIENT_BAD_REQUEST, cs, sr); return EXIT_NORMAL; } /* Validating protocol version */ if (sr->protocol == MK_HTTP_PROTOCOL_UNKNOWN) { mk_request_error(MK_SERVER_HTTP_VERSION_UNSUP, cs, sr); return EXIT_ABORT; } /* Assign the first node alias */ alias = &sr->host_conf->server_names; sr->host_alias = mk_list_entry_first(alias, struct host_alias, _head); if (sr->host.data) { /* Match the virtual host */ mk_vhost_get(sr->host, &sr->host_conf, &sr->host_alias); /* Check if this virtual host have some redirection */ if (sr->host_conf->header_redirect.data) { mk_header_set_http_status(sr, MK_REDIR_MOVED); sr->headers.location = mk_string_dup(sr->host_conf->header_redirect.data); sr->headers.content_length = 0; mk_header_send(cs->socket, cs, sr); sr->headers.location = NULL; mk_server_cork_flag(cs->socket, TCP_CORK_OFF); return 0; } } /* Is requesting an user home directory ? */ if (config->user_dir && sr->uri_processed.len > 2 && sr->uri_processed.data[1] == MK_USER_HOME) { if (mk_user_init(cs, sr) != 0) { mk_request_error(MK_CLIENT_NOT_FOUND, cs, sr); return EXIT_ABORT; } } /* Handling method requested */ if (sr->method == MK_HTTP_METHOD_POST || sr->method == MK_HTTP_METHOD_PUT) { if ((status = mk_method_parse_data(cs, sr)) != 0) { return status; } } /* Plugins Stage 20 */ int ret; ret = mk_plugin_stage_run(MK_PLUGIN_STAGE_20, socket, NULL, cs, sr); if (ret == MK_PLUGIN_RET_CLOSE_CONX) { MK_TRACE(""STAGE 20 requested close conexion""); return EXIT_ABORT; } /* Normal HTTP process */ status = mk_http_init(cs, sr); MK_TRACE(""[FD %i] HTTP Init returning %i"", socket, status); return status; } ",0 "static void testInspectorDefault(InspectorTest* test, gconstpointer) { test->showInWindowAndWaitUntilMapped(GTK_WINDOW_TOPLEVEL); test->resizeView(200, 200); test->loadHtml(""

WebKitGTK+ Inspector test

"", 0); test->waitUntilLoadFinished(); test->showAndWaitUntilFinished(false); GRefPtr inspectorView = webkit_web_inspector_get_web_view(test->m_inspector); g_assert(inspectorView.get()); test->assertObjectIsDeletedWhenTestFinishes(G_OBJECT(inspectorView.get())); g_assert(!webkit_web_inspector_is_attached(test->m_inspector)); g_assert_cmpuint(webkit_web_inspector_get_attached_height(test->m_inspector), ==, 0); Vector& events = test->m_events; g_assert_cmpint(events.size(), ==, 2); g_assert_cmpint(events[0], ==, InspectorTest::BringToFront); g_assert_cmpint(events[1], ==, InspectorTest::OpenWindow); test->m_events.clear(); test->showAndWaitUntilFinished(true); events = test->m_events; g_assert_cmpint(events.size(), ==, 1); g_assert_cmpint(events[0], ==, InspectorTest::BringToFront); test->m_events.clear(); test->resizeViewAndAttach(); g_assert(webkit_web_inspector_is_attached(test->m_inspector)); events = test->m_events; g_assert_cmpint(events.size(), ==, 1); g_assert_cmpint(events[0], ==, InspectorTest::Attach); test->m_events.clear(); test->detachAndWaitUntilWindowOpened(); g_assert(!webkit_web_inspector_is_attached(test->m_inspector)); events = test->m_events; g_assert_cmpint(events.size(), ==, 2); g_assert_cmpint(events[0], ==, InspectorTest::Detach); g_assert_cmpint(events[1], ==, InspectorTest::OpenWindow); test->m_events.clear(); test->closeAndWaitUntilClosed(); events = test->m_events; g_assert_cmpint(events.size(), ==, 1); g_assert_cmpint(events[0], ==, InspectorTest::Closed); test->m_events.clear(); } ",1 "void GenerateMHTMLCallback(ScopedJavaGlobalRef* callback, const base::FilePath& path, int64 size) { JNIEnv* env = AttachCurrentThread(); Java_AwContents_generateMHTMLCallback( env, ConvertUTF8ToJavaString(env, path.AsUTF8Unsafe()).obj(), size, callback->obj()); } ",0 "OMX_ERRORTYPE SoftGSM::internalGetParameter( OMX_INDEXTYPE index, OMX_PTR params) { switch (index) { case OMX_IndexParamAudioPcm: { OMX_AUDIO_PARAM_PCMMODETYPE *pcmParams = (OMX_AUDIO_PARAM_PCMMODETYPE *)params; if (pcmParams->nPortIndex > 1) { return OMX_ErrorUndefined; } pcmParams->eNumData = OMX_NumericalDataSigned; pcmParams->eEndian = OMX_EndianBig; pcmParams->bInterleaved = OMX_TRUE; pcmParams->nBitPerSample = 16; pcmParams->ePCMMode = OMX_AUDIO_PCMModeLinear; pcmParams->eChannelMapping[0] = OMX_AUDIO_ChannelLF; pcmParams->eChannelMapping[1] = OMX_AUDIO_ChannelRF; pcmParams->nChannels = 1; pcmParams->nSamplingRate = 8000; return OMX_ErrorNone; } default: return SimpleSoftOMXComponent::internalGetParameter(index, params); } } ",1 "void NavigationController::PruneAllButActive() { if (transient_entry_index_ != -1) { DCHECK_EQ(entry_count() - 1, transient_entry_index_); entries_.erase(entries_.begin(), entries_.begin() + transient_entry_index_); transient_entry_index_ = 0; last_committed_entry_index_ = -1; pending_entry_index_ = -1; } else if (!pending_entry_) { if (!entry_count()) return; DCHECK(last_committed_entry_index_ >= 0); entries_.erase(entries_.begin(), entries_.begin() + last_committed_entry_index_); entries_.erase(entries_.begin() + 1, entries_.end()); last_committed_entry_index_ = 0; } else if (pending_entry_index_ != -1) { entries_.erase(entries_.begin(), entries_.begin() + pending_entry_index_); entries_.erase(entries_.begin() + 1, entries_.end()); pending_entry_index_ = 0; last_committed_entry_index_ = 0; } else { pending_entry_index_ = -1; last_committed_entry_index_ = -1; entries_.clear(); } if (tab_contents_->interstitial_page()) { tab_contents_->interstitial_page()->set_reload_on_dont_proceed(true); } } ",0 "struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc, const struct sctp_chunk *chunk, gfp_t gfp, int unkparam_len) { sctp_inithdr_t initack; struct sctp_chunk *retval; union sctp_params addrs; struct sctp_sock *sp; int addrs_len; sctp_cookie_param_t *cookie; int cookie_len; size_t chunksize; sctp_adaptation_ind_param_t aiparam; sctp_supported_ext_param_t ext_param; int num_ext = 0; __u8 extensions[3]; sctp_paramhdr_t *auth_chunks = NULL, *auth_hmacs = NULL, *auth_random = NULL; retval = NULL; /* Note: there may be no addresses to embed. */ addrs = sctp_bind_addrs_to_raw(&asoc->base.bind_addr, &addrs_len, gfp); initack.init_tag = htonl(asoc->c.my_vtag); initack.a_rwnd = htonl(asoc->rwnd); initack.num_outbound_streams = htons(asoc->c.sinit_num_ostreams); initack.num_inbound_streams = htons(asoc->c.sinit_max_instreams); initack.initial_tsn = htonl(asoc->c.initial_tsn); /* FIXME: We really ought to build the cookie right * into the packet instead of allocating more fresh memory. */ cookie = sctp_pack_cookie(asoc->ep, asoc, chunk, &cookie_len, addrs.v, addrs_len); if (!cookie) goto nomem_cookie; /* Calculate the total size of allocation, include the reserved * space for reporting unknown parameters if it is specified. */ sp = sctp_sk(asoc->base.sk); chunksize = sizeof(initack) + addrs_len + cookie_len + unkparam_len; /* Tell peer that we'll do ECN only if peer advertised such cap. */ if (asoc->peer.ecn_capable) chunksize += sizeof(ecap_param); if (asoc->peer.prsctp_capable) chunksize += sizeof(prsctp_param); if (asoc->peer.asconf_capable) { extensions[num_ext] = SCTP_CID_ASCONF; extensions[num_ext+1] = SCTP_CID_ASCONF_ACK; num_ext += 2; } if (sp->adaptation_ind) chunksize += sizeof(aiparam); if (asoc->peer.auth_capable) { auth_random = (sctp_paramhdr_t *)asoc->c.auth_random; chunksize += ntohs(auth_random->length); auth_hmacs = (sctp_paramhdr_t *)asoc->c.auth_hmacs; if (auth_hmacs->length) chunksize += WORD_ROUND(ntohs(auth_hmacs->length)); else auth_hmacs = NULL; auth_chunks = (sctp_paramhdr_t *)asoc->c.auth_chunks; if (auth_chunks->length) chunksize += WORD_ROUND(ntohs(auth_chunks->length)); else auth_chunks = NULL; extensions[num_ext] = SCTP_CID_AUTH; num_ext += 1; } if (num_ext) chunksize += WORD_ROUND(sizeof(sctp_supported_ext_param_t) + num_ext); /* Now allocate and fill out the chunk. */ retval = sctp_make_control(asoc, SCTP_CID_INIT_ACK, 0, chunksize); if (!retval) goto nomem_chunk; /* RFC 2960 6.4 Multi-homed SCTP Endpoints * * An endpoint SHOULD transmit reply chunks (e.g., SACK, * HEARTBEAT ACK, * etc.) to the same destination transport * address from which it received the DATA or control chunk * to which it is replying. * * [INIT ACK back to where the INIT came from.] */ retval->transport = chunk->transport; retval->subh.init_hdr = sctp_addto_chunk(retval, sizeof(initack), &initack); retval->param_hdr.v = sctp_addto_chunk(retval, addrs_len, addrs.v); sctp_addto_chunk(retval, cookie_len, cookie); if (asoc->peer.ecn_capable) sctp_addto_chunk(retval, sizeof(ecap_param), &ecap_param); if (num_ext) { ext_param.param_hdr.type = SCTP_PARAM_SUPPORTED_EXT; ext_param.param_hdr.length = htons(sizeof(sctp_supported_ext_param_t) + num_ext); sctp_addto_chunk(retval, sizeof(sctp_supported_ext_param_t), &ext_param); sctp_addto_param(retval, num_ext, extensions); } if (asoc->peer.prsctp_capable) sctp_addto_chunk(retval, sizeof(prsctp_param), &prsctp_param); if (sp->adaptation_ind) { aiparam.param_hdr.type = SCTP_PARAM_ADAPTATION_LAYER_IND; aiparam.param_hdr.length = htons(sizeof(aiparam)); aiparam.adaptation_ind = htonl(sp->adaptation_ind); sctp_addto_chunk(retval, sizeof(aiparam), &aiparam); } if (asoc->peer.auth_capable) { sctp_addto_chunk(retval, ntohs(auth_random->length), auth_random); if (auth_hmacs) sctp_addto_chunk(retval, ntohs(auth_hmacs->length), auth_hmacs); if (auth_chunks) sctp_addto_chunk(retval, ntohs(auth_chunks->length), auth_chunks); } /* We need to remove the const qualifier at this point. */ retval->asoc = (struct sctp_association *) asoc; nomem_chunk: kfree(cookie); nomem_cookie: kfree(addrs.v); return retval; } ",0 "GetDefaultConnectionService(struct upnphttp * h, const char * action, const char * ns) { static const char resp[] = """" #ifdef IGD_V2 ""%s:WANConnectionDevice:2,"" #else ""%s:WANConnectionDevice:1,"" #endif SERVICE_ID_WANIPC """" """"; /* example from UPnP_IGD_Layer3Forwarding 1.0.pdf : * uuid:44f5824f-c57d-418c-a131-f22b34e14111:WANConnectionDevice:1, * urn:upnp-org:serviceId:WANPPPConn1 */ char body[1024]; int bodylen; /* namespace : urn:schemas-upnp-org:service:Layer3Forwarding:1 */ bodylen = snprintf(body, sizeof(body), resp, action, ns, uuidvalue_wcd, action); BuildSendAndCloseSoapResp(h, body, bodylen); } ",0 "static int decode_ihdr_chunk(AVCodecContext *avctx, PNGDecContext *s, uint32_t length) { if (length != 13) return AVERROR_INVALIDDATA; if (s->state & PNG_IDAT) { av_log(avctx, AV_LOG_ERROR, ""IHDR after IDAT\n""); return AVERROR_INVALIDDATA; } if (s->state & PNG_IHDR) { av_log(avctx, AV_LOG_ERROR, ""Multiple IHDR\n""); return AVERROR_INVALIDDATA; } s->width = s->cur_w = bytestream2_get_be32(&s->gb); s->height = s->cur_h = bytestream2_get_be32(&s->gb); if (av_image_check_size(s->width, s->height, 0, avctx)) { s->cur_w = s->cur_h = s->width = s->height = 0; av_log(avctx, AV_LOG_ERROR, ""Invalid image size\n""); return AVERROR_INVALIDDATA; } s->bit_depth = bytestream2_get_byte(&s->gb); s->color_type = bytestream2_get_byte(&s->gb); s->compression_type = bytestream2_get_byte(&s->gb); s->filter_type = bytestream2_get_byte(&s->gb); s->interlace_type = bytestream2_get_byte(&s->gb); bytestream2_skip(&s->gb, 4); /* crc */ s->state |= PNG_IHDR; if (avctx->debug & FF_DEBUG_PICT_INFO) av_log(avctx, AV_LOG_DEBUG, ""width=%d height=%d depth=%d color_type=%d "" ""compression_type=%d filter_type=%d interlace_type=%d\n"", s->width, s->height, s->bit_depth, s->color_type, s->compression_type, s->filter_type, s->interlace_type); return 0; } ",0 "static void perf_output_wakeup(struct perf_output_handle *handle) { atomic_set(&handle->rb->poll, POLL_IN); if (handle->nmi) { handle->event->pending_wakeup = 1; irq_work_queue(&handle->event->pending); } else perf_event_wakeup(handle->event); } ",1 "static bool IsSemicolonSeparatedAttribute( const HTMLToken::Attribute& attribute) { return ThreadSafeMatch(attribute.NameAsVector(), SVGNames::valuesAttr); } ",0 "ProcScreenSaverQueryVersion(ClientPtr client) { xScreenSaverQueryVersionReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, .majorVersion = SERVER_SAVER_MAJOR_VERSION, .minorVersion = SERVER_SAVER_MINOR_VERSION }; REQUEST_SIZE_MATCH(xScreenSaverQueryVersionReq); if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); } WriteToClient(client, sizeof(xScreenSaverQueryVersionReply), &rep); return Success; } ",0 "ChopUpSingleUncompressedStrip(TIFF* tif) { register TIFFDirectory *td = &tif->tif_dir; uint64 bytecount; uint64 offset; uint32 rowblock; uint64 rowblockbytes; uint64 stripbytes; uint32 strip; uint64 nstrips64; uint32 nstrips32; uint32 rowsperstrip; uint64* newcounts; uint64* newoffsets; bytecount = td->td_stripbytecount[0]; offset = td->td_stripoffset[0]; assert(td->td_planarconfig == PLANARCONFIG_CONTIG); if ((td->td_photometric == PHOTOMETRIC_YCBCR)&& (!isUpSampled(tif))) rowblock = td->td_ycbcrsubsampling[1]; else rowblock = 1; rowblockbytes = TIFFVTileSize64(tif, rowblock); /* * Make the rows hold at least one scanline, but fill specified amount * of data if possible. */ if (rowblockbytes > STRIP_SIZE_DEFAULT) { stripbytes = rowblockbytes; rowsperstrip = rowblock; } else if (rowblockbytes > 0 ) { uint32 rowblocksperstrip; rowblocksperstrip = (uint32) (STRIP_SIZE_DEFAULT / rowblockbytes); rowsperstrip = rowblocksperstrip * rowblock; stripbytes = rowblocksperstrip * rowblockbytes; } else return; /* * never increase the number of strips in an image */ if (rowsperstrip >= td->td_rowsperstrip) return; nstrips64 = TIFFhowmany_64(bytecount, stripbytes); if ((nstrips64==0)||(nstrips64>0xFFFFFFFF)) /* something is wonky, do nothing. */ return; nstrips32 = (uint32)nstrips64; newcounts = (uint64*) _TIFFCheckMalloc(tif, nstrips32, sizeof (uint64), ""for chopped \""StripByteCounts\"" array""); newoffsets = (uint64*) _TIFFCheckMalloc(tif, nstrips32, sizeof (uint64), ""for chopped \""StripOffsets\"" array""); if (newcounts == NULL || newoffsets == NULL) { /* * Unable to allocate new strip information, give up and use * the original one strip information. */ if (newcounts != NULL) _TIFFfree(newcounts); if (newoffsets != NULL) _TIFFfree(newoffsets); return; } /* * Fill the strip information arrays with new bytecounts and offsets * that reflect the broken-up format. */ for (strip = 0; strip < nstrips32; strip++) { if (stripbytes > bytecount) stripbytes = bytecount; newcounts[strip] = stripbytes; newoffsets[strip] = offset; offset += stripbytes; bytecount -= stripbytes; } /* * Replace old single strip info with multi-strip info. */ td->td_stripsperimage = td->td_nstrips = nstrips32; TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, rowsperstrip); _TIFFfree(td->td_stripbytecount); _TIFFfree(td->td_stripoffset); td->td_stripbytecount = newcounts; td->td_stripoffset = newoffsets; td->td_stripbytecountsorted = 1; } ",1 "SkBitmap* ChromeContentRendererClient::GetSadPluginBitmap() { return ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_SAD_PLUGIN); } ",0 "bool InputDispatcher::InputState::trackMotion(const MotionEntry* entry, int32_t action, int32_t flags) { int32_t actionMasked = action & AMOTION_EVENT_ACTION_MASK; switch (actionMasked) { case AMOTION_EVENT_ACTION_UP: case AMOTION_EVENT_ACTION_CANCEL: { ssize_t index = findMotionMemento(entry, false /*hovering*/); if (index >= 0) { mMotionMementos.removeAt(index); return true; } #if DEBUG_OUTBOUND_EVENT_DETAILS ALOGD(""Dropping inconsistent motion up or cancel event: deviceId=%d, source=%08x, "" ""actionMasked=%d"", entry->deviceId, entry->source, actionMasked); #endif return false; } case AMOTION_EVENT_ACTION_DOWN: { ssize_t index = findMotionMemento(entry, false /*hovering*/); if (index >= 0) { mMotionMementos.removeAt(index); } addMotionMemento(entry, flags, false /*hovering*/); return true; } case AMOTION_EVENT_ACTION_POINTER_UP: case AMOTION_EVENT_ACTION_POINTER_DOWN: case AMOTION_EVENT_ACTION_MOVE: { if (entry->source & AINPUT_SOURCE_CLASS_NAVIGATION) { return true; } ssize_t index = findMotionMemento(entry, false /*hovering*/); if (entry->source & AINPUT_SOURCE_CLASS_JOYSTICK) { if (index >= 0) { if (entry->pointerCoords[0].isEmpty()) { mMotionMementos.removeAt(index); } else { MotionMemento& memento = mMotionMementos.editItemAt(index); memento.setPointers(entry); } } else if (!entry->pointerCoords[0].isEmpty()) { addMotionMemento(entry, flags, false /*hovering*/); } return true; } if (index >= 0) { MotionMemento& memento = mMotionMementos.editItemAt(index); memento.setPointers(entry); return true; } #if DEBUG_OUTBOUND_EVENT_DETAILS ALOGD(""Dropping inconsistent motion pointer up/down or move event: "" ""deviceId=%d, source=%08x, actionMasked=%d"", entry->deviceId, entry->source, actionMasked); #endif return false; } case AMOTION_EVENT_ACTION_HOVER_EXIT: { ssize_t index = findMotionMemento(entry, true /*hovering*/); if (index >= 0) { mMotionMementos.removeAt(index); return true; } #if DEBUG_OUTBOUND_EVENT_DETAILS ALOGD(""Dropping inconsistent motion hover exit event: deviceId=%d, source=%08x"", entry->deviceId, entry->source); #endif return false; } case AMOTION_EVENT_ACTION_HOVER_ENTER: case AMOTION_EVENT_ACTION_HOVER_MOVE: { ssize_t index = findMotionMemento(entry, true /*hovering*/); if (index >= 0) { mMotionMementos.removeAt(index); } addMotionMemento(entry, flags, true /*hovering*/); return true; } default: return true; } } ",0 "static void snd_timer_user_tinterrupt(struct snd_timer_instance *timeri, unsigned long resolution, unsigned long ticks) { struct snd_timer_user *tu = timeri->callback_data; struct snd_timer_tread *r, r1; struct timespec tstamp; int prev, append = 0; memset(&r1, 0, sizeof(r1)); memset(&tstamp, 0, sizeof(tstamp)); spin_lock(&tu->qlock); if ((tu->filter & ((1 << SNDRV_TIMER_EVENT_RESOLUTION) | (1 << SNDRV_TIMER_EVENT_TICK))) == 0) { spin_unlock(&tu->qlock); return; } if (tu->last_resolution != resolution || ticks > 0) { if (timer_tstamp_monotonic) ktime_get_ts(&tstamp); else getnstimeofday(&tstamp); } if ((tu->filter & (1 << SNDRV_TIMER_EVENT_RESOLUTION)) && tu->last_resolution != resolution) { r1.event = SNDRV_TIMER_EVENT_RESOLUTION; r1.tstamp = tstamp; r1.val = resolution; snd_timer_user_append_to_tqueue(tu, &r1); tu->last_resolution = resolution; append++; } if ((tu->filter & (1 << SNDRV_TIMER_EVENT_TICK)) == 0) goto __wake; if (ticks == 0) goto __wake; if (tu->qused > 0) { prev = tu->qtail == 0 ? tu->queue_size - 1 : tu->qtail - 1; r = &tu->tqueue[prev]; if (r->event == SNDRV_TIMER_EVENT_TICK) { r->tstamp = tstamp; r->val += ticks; append++; goto __wake; } } r1.event = SNDRV_TIMER_EVENT_TICK; r1.tstamp = tstamp; r1.val = ticks; snd_timer_user_append_to_tqueue(tu, &r1); append++; __wake: spin_unlock(&tu->qlock); if (append == 0) return; kill_fasync(&tu->fasync, SIGIO, POLL_IN); wake_up(&tu->qchange_sleep); } ",0 "static void RaisesExceptionGetterLongAttributeAttributeGetter(const v8::FunctionCallbackInfo& info) { v8::Local holder = info.Holder(); TestObject* impl = V8TestObject::ToImpl(holder); ExceptionState exception_state(info.GetIsolate(), ExceptionState::kGetterContext, ""TestObject"", ""raisesExceptionGetterLongAttribute""); int32_t cpp_value(impl->raisesExceptionGetterLongAttribute(exception_state)); if (UNLIKELY(exception_state.HadException())) return; V8SetReturnValueInt(info, cpp_value); } ",0 "int set_attributes(char *pathname, int mode, uid_t uid, gid_t guid, time_t time, unsigned int xattr, unsigned int set_mode) { struct utimbuf times = { time, time }; if(utime(pathname, ×) == -1) { ERROR(""set_attributes: failed to set time on %s, because %s\n"", pathname, strerror(errno)); return FALSE; } if(root_process) { if(chown(pathname, uid, guid) == -1) { ERROR(""set_attributes: failed to change uid and gids "" ""on %s, because %s\n"", pathname, strerror(errno)); return FALSE; } } else mode &= ~07000; if((set_mode || (mode & 07000)) && chmod(pathname, (mode_t) mode) == -1) { ERROR(""set_attributes: failed to change mode %s, because %s\n"", pathname, strerror(errno)); return FALSE; } write_xattr(pathname, xattr); return TRUE; } ",0 "status_t ATSParser::Stream::parse( unsigned continuity_counter, unsigned payload_unit_start_indicator, ABitReader *br, SyncEvent *event) { if (mQueue == NULL) { return OK; } if (mExpectedContinuityCounter >= 0 && (unsigned)mExpectedContinuityCounter != continuity_counter) { ALOGI(""discontinuity on stream pid 0x%04x"", mElementaryPID); mPayloadStarted = false; mBuffer->setRange(0, 0); mExpectedContinuityCounter = -1; #if 0 if (mStreamType == STREAMTYPE_H264) { ALOGI(""clearing video queue""); mQueue->clear(true /* clearFormat */); } #endif if (!payload_unit_start_indicator) { return OK; } } mExpectedContinuityCounter = (continuity_counter + 1) & 0x0f; if (payload_unit_start_indicator) { off64_t offset = (event != NULL) ? event->getOffset() : 0; if (mPayloadStarted) { status_t err = flush(event); if (err != OK) { ALOGW(""Error (%08x) happened while flushing; we simply discard "" ""the PES packet and continue."", err); } } mPayloadStarted = true; mPesStartOffset = offset; } if (!mPayloadStarted) { return OK; } size_t payloadSizeBits = br->numBitsLeft(); if (payloadSizeBits % 8 != 0u) { ALOGE(""Wrong value""); return BAD_VALUE; } size_t neededSize = mBuffer->size() + payloadSizeBits / 8; if (mBuffer->capacity() < neededSize) { neededSize = (neededSize + 65535) & ~65535; ALOGI(""resizing buffer to %zu bytes"", neededSize); sp newBuffer = new ABuffer(neededSize); memcpy(newBuffer->data(), mBuffer->data(), mBuffer->size()); newBuffer->setRange(0, mBuffer->size()); mBuffer = newBuffer; } memcpy(mBuffer->data() + mBuffer->size(), br->data(), payloadSizeBits / 8); mBuffer->setRange(0, mBuffer->size() + payloadSizeBits / 8); return OK; } ",0 "xmlXPathRoot(xmlXPathParserContextPtr ctxt) { if ((ctxt == NULL) || (ctxt->context == NULL)) return; ctxt->context->node = (xmlNodePtr) ctxt->context->doc; valuePush(ctxt, xmlXPathCacheNewNodeSet(ctxt->context, ctxt->context->node)); } ",0 "MediaControlTimelineElement::MediaControlTimelineElement( MediaControls& mediaControls) : MediaControlInputElement(mediaControls, MediaSlider) {} ",0 "RenderWidgetHostImpl* RenderWidgetHostImpl::FromID( int32_t process_id, int32_t routing_id) { DCHECK_CURRENTLY_ON(BrowserThread::UI); RoutingIDWidgetMap* widgets = g_routing_id_widget_map.Pointer(); RoutingIDWidgetMap::iterator it = widgets->find( RenderWidgetHostID(process_id, routing_id)); return it == widgets->end() ? NULL : it->second; } ",0 "static long ppc_set_hwdebug(struct task_struct *child, struct ppc_hw_breakpoint *bp_info) { #ifdef CONFIG_HAVE_HW_BREAKPOINT int len = 0; struct thread_struct *thread = &(child->thread); struct perf_event *bp; struct perf_event_attr attr; #endif /* CONFIG_HAVE_HW_BREAKPOINT */ #ifndef CONFIG_PPC_ADV_DEBUG_REGS struct arch_hw_breakpoint brk; #endif if (bp_info->version != 1) return -ENOTSUPP; #ifdef CONFIG_PPC_ADV_DEBUG_REGS /* * Check for invalid flags and combinations */ if ((bp_info->trigger_type == 0) || (bp_info->trigger_type & ~(PPC_BREAKPOINT_TRIGGER_EXECUTE | PPC_BREAKPOINT_TRIGGER_RW)) || (bp_info->addr_mode & ~PPC_BREAKPOINT_MODE_MASK) || (bp_info->condition_mode & ~(PPC_BREAKPOINT_CONDITION_MODE | PPC_BREAKPOINT_CONDITION_BE_ALL))) return -EINVAL; #if CONFIG_PPC_ADV_DEBUG_DVCS == 0 if (bp_info->condition_mode != PPC_BREAKPOINT_CONDITION_NONE) return -EINVAL; #endif if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_EXECUTE) { if ((bp_info->trigger_type != PPC_BREAKPOINT_TRIGGER_EXECUTE) || (bp_info->condition_mode != PPC_BREAKPOINT_CONDITION_NONE)) return -EINVAL; return set_instruction_bp(child, bp_info); } if (bp_info->addr_mode == PPC_BREAKPOINT_MODE_EXACT) return set_dac(child, bp_info); #ifdef CONFIG_PPC_ADV_DEBUG_DAC_RANGE return set_dac_range(child, bp_info); #else return -EINVAL; #endif #else /* !CONFIG_PPC_ADV_DEBUG_DVCS */ /* * We only support one data breakpoint */ if ((bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_RW) == 0 || (bp_info->trigger_type & ~PPC_BREAKPOINT_TRIGGER_RW) != 0 || bp_info->condition_mode != PPC_BREAKPOINT_CONDITION_NONE) return -EINVAL; if ((unsigned long)bp_info->addr >= TASK_SIZE) return -EIO; brk.address = bp_info->addr & ~7UL; brk.type = HW_BRK_TYPE_TRANSLATE; brk.len = 8; if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_READ) brk.type |= HW_BRK_TYPE_READ; if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_WRITE) brk.type |= HW_BRK_TYPE_WRITE; #ifdef CONFIG_HAVE_HW_BREAKPOINT /* * Check if the request is for 'range' breakpoints. We can * support it if range < 8 bytes. */ if (bp_info->addr_mode == PPC_BREAKPOINT_MODE_RANGE_INCLUSIVE) len = bp_info->addr2 - bp_info->addr; else if (bp_info->addr_mode == PPC_BREAKPOINT_MODE_EXACT) len = 1; else return -EINVAL; bp = thread->ptrace_bps[0]; if (bp) return -ENOSPC; /* Create a new breakpoint request if one doesn't exist already */ hw_breakpoint_init(&attr); attr.bp_addr = (unsigned long)bp_info->addr & ~HW_BREAKPOINT_ALIGN; attr.bp_len = len; arch_bp_generic_fields(brk.type, &attr.bp_type); thread->ptrace_bps[0] = bp = register_user_hw_breakpoint(&attr, ptrace_triggered, NULL, child); if (IS_ERR(bp)) { thread->ptrace_bps[0] = NULL; return PTR_ERR(bp); } return 1; #endif /* CONFIG_HAVE_HW_BREAKPOINT */ if (bp_info->addr_mode != PPC_BREAKPOINT_MODE_EXACT) return -EINVAL; if (child->thread.hw_brk.address) return -ENOSPC; child->thread.hw_brk = brk; return 1; #endif /* !CONFIG_PPC_ADV_DEBUG_DVCS */ } ",0 "virDomainCoreDumpWithFormat(virDomainPtr domain, const char *to, unsigned int dumpformat, unsigned int flags) { virConnectPtr conn; VIR_DOMAIN_DEBUG(domain, ""to=%s, dumpformat=%u, flags=%x"", to, dumpformat, flags); virResetLastError(); virCheckDomainReturn(domain, -1); conn = domain->conn; virCheckReadOnlyGoto(conn->flags, error); virCheckNonNullArgGoto(to, error); if (dumpformat >= VIR_DOMAIN_CORE_DUMP_FORMAT_LAST) { virReportInvalidArg(flags, _(""dumpformat '%d' is not supported""), dumpformat); goto error; } VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DUMP_CRASH, VIR_DUMP_LIVE, error); VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DUMP_CRASH, VIR_DUMP_RESET, error); VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DUMP_LIVE, VIR_DUMP_RESET, error); if (conn->driver->domainCoreDumpWithFormat) { int ret; char *absolute_to; /* We must absolutize the file path as the save is done out of process */ if (virFileAbsPath(to, &absolute_to) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, ""%s"", _(""could not build absolute core file path"")); goto error; } ret = conn->driver->domainCoreDumpWithFormat(domain, absolute_to, dumpformat, flags); VIR_FREE(absolute_to); if (ret < 0) goto error; return ret; } virReportUnsupportedError(); error: virDispatchError(domain->conn); return -1; } ",0 "void WebSettingsImpl::setFantasyFontFamily(const WebString& font) { m_settings->setFantasyFontFamily((String)font); } ",0 "static void kvm_mmu_unlink_parents(struct kvm *kvm, struct kvm_mmu_page *sp) { u64 *sptep; struct rmap_iterator iter; while ((sptep = rmap_get_first(sp->parent_ptes, &iter))) drop_parent_pte(sp, sptep); } ",0 "void RenderViewImpl::OnDisableAutoResize(const gfx::Size& new_size) { DCHECK(disable_scrollbars_size_limit_.IsEmpty()); if (!webview()) return; auto_resize_mode_ = false; webview()->disableAutoResizeMode(); Resize(new_size, physical_backing_size_, resizer_rect_, is_fullscreen_, NO_RESIZE_ACK); } ",0 "static void limitedToOnlyOneAttributeAttributeGetterCallback(v8::Local, const v8::PropertyCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMGetter""); TestObjectV8Internal::limitedToOnlyOneAttributeAttributeGetter(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 " status_t ProCamera2Client::dump(int fd, const Vector& args) { String8 result; result.appendFormat(""ProCamera2Client[%d] (%p) PID: %d, dump:\n"", mCameraId, getRemoteCallback()->asBinder().get(), mClientPid); result.append("" State: ""); mFrameProcessor->dump(fd, args); return dumpDevice(fd, args); } ",1 " static void SignalEvent(base::WaitableEvent* event) { event->Signal(); } ",0 "void DownloadItemImpl::Init(bool active, download_net_logs::DownloadType download_type) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (active) download_stats::RecordDownloadCount(download_stats::START_COUNT); if (target_path_.empty()) target_path_ = current_path_; std::string file_name; if (download_type == download_net_logs::SRC_HISTORY_IMPORT) { file_name = target_path_.AsUTF8Unsafe(); } else { file_name = forced_file_path_.AsUTF8Unsafe(); if (file_name.empty()) file_name = suggested_filename_; if (file_name.empty()) file_name = GetURL().ExtractFileName(); } bound_net_log_.BeginEvent( net::NetLog::TYPE_DOWNLOAD_ITEM_ACTIVE, base::Bind(&download_net_logs::ItemActivatedCallback, this, download_type, &file_name)); if (!active) { bound_net_log_.AddEvent( net::NetLog::TYPE_DOWNLOAD_ITEM_IN_HISTORY, net::NetLog::Int64Callback(""db_handle"", db_handle_)); bound_net_log_.EndEvent(net::NetLog::TYPE_DOWNLOAD_ITEM_ACTIVE); } VLOG(20) << __FUNCTION__ << ""() "" << DebugString(true); } ",0 "static void __exit fini(void) { crypto_unregister_algs(camellia_algs, ARRAY_SIZE(camellia_algs)); } ",0 " void DontProceedThroughInterstitial() { TabContents* contents = browser()->GetSelectedTabContents(); InterstitialPage* interstitial_page = InterstitialPage::GetInterstitialPage( contents); ASSERT_TRUE(interstitial_page); interstitial_page->DontProceed(); } ",0 "static int rmd256_init(struct shash_desc *desc) { struct rmd256_ctx *rctx = shash_desc_ctx(desc); rctx->byte_count = 0; rctx->state[0] = RMD_H0; rctx->state[1] = RMD_H1; rctx->state[2] = RMD_H2; rctx->state[3] = RMD_H3; rctx->state[4] = RMD_H5; rctx->state[5] = RMD_H6; rctx->state[6] = RMD_H7; rctx->state[7] = RMD_H8; memset(rctx->buffer, 0, sizeof(rctx->buffer)); return 0; } ",0 "int JBIG2MMRDecoder::getWhiteCode() { const CCITTCode *p; Guint code; if (bufLen == 0) { buf = str->getChar() & 0xff; bufLen = 8; ++nBytesRead; } while (1) { if (bufLen >= 11 && ((buf >> (bufLen - 7)) & 0x7f) == 0) { if (bufLen <= 12) { code = buf << (12 - bufLen); } else { code = buf >> (bufLen - 12); } p = &whiteTab1[code & 0x1f]; } else { if (bufLen <= 9) { code = buf << (9 - bufLen); } else { code = buf >> (bufLen - 9); } p = &whiteTab2[code & 0x1ff]; } if (p->bits > 0 && p->bits <= (int)bufLen) { bufLen -= p->bits; return p->n; } if (bufLen >= 12) { break; } buf = (buf << 8) | (str->getChar() & 0xff); bufLen += 8; ++nBytesRead; } error(errSyntaxError, str->getPos(), ""Bad white code in JBIG2 MMR stream""); --bufLen; return 1; } ",0 "static size_t copy_page_to_iter_pipe(struct page *page, size_t offset, size_t bytes, struct iov_iter *i) { struct pipe_inode_info *pipe = i->pipe; struct pipe_buffer *buf; size_t off; int idx; if (unlikely(bytes > i->count)) bytes = i->count; if (unlikely(!bytes)) return 0; if (!sanity(i)) return 0; off = i->iov_offset; idx = i->idx; buf = &pipe->bufs[idx]; if (off) { if (offset == off && buf->page == page) { /* merge with the last one */ buf->len += bytes; i->iov_offset += bytes; goto out; } idx = next_idx(idx, pipe); buf = &pipe->bufs[idx]; } if (idx == pipe->curbuf && pipe->nrbufs) return 0; pipe->nrbufs++; buf->ops = &page_cache_pipe_buf_ops; get_page(buf->page = page); buf->offset = offset; buf->len = bytes; i->iov_offset = offset + bytes; i->idx = idx; out: i->count -= bytes; return bytes; } ",0 "static void mpage_release_unused_pages(struct mpage_da_data *mpd, bool invalidate) { int nr_pages, i; pgoff_t index, end; struct pagevec pvec; struct inode *inode = mpd->inode; struct address_space *mapping = inode->i_mapping; /* This is necessary when next_page == 0. */ if (mpd->first_page >= mpd->next_page) return; index = mpd->first_page; end = mpd->next_page - 1; if (invalidate) { ext4_lblk_t start, last; start = index << (PAGE_SHIFT - inode->i_blkbits); last = end << (PAGE_SHIFT - inode->i_blkbits); ext4_es_remove_extent(inode, start, last - start + 1); } pagevec_init(&pvec, 0); while (index <= end) { nr_pages = pagevec_lookup(&pvec, mapping, index, PAGEVEC_SIZE); if (nr_pages == 0) break; for (i = 0; i < nr_pages; i++) { struct page *page = pvec.pages[i]; if (page->index > end) break; BUG_ON(!PageLocked(page)); BUG_ON(PageWriteback(page)); if (invalidate) { block_invalidatepage(page, 0, PAGE_SIZE); ClearPageUptodate(page); } unlock_page(page); } index = pvec.pages[nr_pages - 1]->index + 1; pagevec_release(&pvec); } } ",0 "void ChromeRenderProcessObserver::OnSetContentSettingRules( const RendererContentSettingRules& rules) { content_setting_rules_ = rules; } ",0 " MockCanceledPluginServiceClient(ResourceContext* context) : context_(context), get_resource_context_called_(false) { } ",0 "void SetWithinSameDocument( const GURL& url, FrameHostMsg_DidCommitProvisionalLoad_Params* params) { params->was_within_same_document = true; params->url = url; params->origin = url::Origin(url); } ",0 "ofputil_uninit_tlv_table(struct ovs_list *mappings) { struct ofputil_tlv_map *map; LIST_FOR_EACH_POP (map, list_node, mappings) { free(map); } } ",0 "Vector Document::iconURLs(int iconTypesMask) { IconURL firstFavicon; IconURL firstTouchIcon; IconURL firstTouchPrecomposedIcon; Vector secondaryIcons; for (HTMLLinkElement* linkElement = head() ? Traversal::firstChild(*head()) : 0; linkElement; linkElement = Traversal::nextSibling(*linkElement)) { if (!(linkElement->iconType() & iconTypesMask)) continue; if (linkElement->href().isEmpty()) continue; if (!RuntimeEnabledFeatures::touchIconLoadingEnabled() && linkElement->iconType() != Favicon) continue; IconURL newURL(linkElement->href(), linkElement->iconSizes(), linkElement->type(), linkElement->iconType()); if (linkElement->iconType() == Favicon) { if (firstFavicon.m_iconType != InvalidIcon) secondaryIcons.append(firstFavicon); firstFavicon = newURL; } else if (linkElement->iconType() == TouchIcon) { if (firstTouchIcon.m_iconType != InvalidIcon) secondaryIcons.append(firstTouchIcon); firstTouchIcon = newURL; } else if (linkElement->iconType() == TouchPrecomposedIcon) { if (firstTouchPrecomposedIcon.m_iconType != InvalidIcon) secondaryIcons.append(firstTouchPrecomposedIcon); firstTouchPrecomposedIcon = newURL; } else { ASSERT_NOT_REACHED(); } } Vector iconURLs; if (firstFavicon.m_iconType != InvalidIcon) iconURLs.append(firstFavicon); else if (m_url.protocolIsInHTTPFamily() && iconTypesMask & Favicon) iconURLs.append(IconURL::defaultFavicon(m_url)); if (firstTouchIcon.m_iconType != InvalidIcon) iconURLs.append(firstTouchIcon); if (firstTouchPrecomposedIcon.m_iconType != InvalidIcon) iconURLs.append(firstTouchPrecomposedIcon); for (int i = secondaryIcons.size() - 1; i >= 0; --i) iconURLs.append(secondaryIcons[i]); return iconURLs; } ",0 "void OmniboxViewViews::SetAccessibilityLabel(const base::string16& display_text, const AutocompleteMatch& match) { bool is_tab_switch_button_focused = model()->popup_model()->selected_line_state() == OmniboxPopupModel::BUTTON_FOCUSED; friendly_suggestion_text_ = AutocompleteMatchType::ToAccessibilityLabel( match, display_text, model()->popup_model()->selected_line(), model()->result().size(), is_tab_switch_button_focused, &friendly_suggestion_text_prefix_length_); #if defined(OS_MACOSX) GetViewAccessibility().AnnounceText(friendly_suggestion_text_); #endif } ",0 "static int pcd_reset(struct pcd_unit *cd) { int i, k, flg; int expect[5] = { 1, 1, 1, 0x14, 0xeb }; pi_connect(cd->pi); write_reg(cd, 6, 0xa0 + 0x10 * cd->drive); write_reg(cd, 7, 8); pcd_sleep(20 * HZ / 1000); /* delay a bit */ k = 0; while ((k++ < PCD_RESET_TMO) && (status_reg(cd) & IDE_BUSY)) pcd_sleep(HZ / 10); flg = 1; for (i = 0; i < 5; i++) flg &= (read_reg(cd, i + 1) == expect[i]); if (verbose) { printk(""%s: Reset (%d) signature = "", cd->name, k); for (i = 0; i < 5; i++) printk(""%3x"", read_reg(cd, i + 1)); if (!flg) printk("" (incorrect)""); printk(""\n""); } pi_disconnect(cd->pi); return flg - 1; } ",0 "void ClearFileReferenceOnIOThread( scoped_refptr) {} ",0 "void ProfileDependencyManager::AssertFactoriesBuilt() { if (built_factories_) return; #if defined(ENABLE_BACKGROUND) BackgroundContentsServiceFactory::GetInstance(); #endif BookmarkModelFactory::GetInstance(); #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) captive_portal::CaptivePortalServiceFactory::GetInstance(); #endif ChromeURLDataManagerFactory::GetInstance(); #if defined(ENABLE_PRINTING) CloudPrintProxyServiceFactory::GetInstance(); #endif CookieSettings::Factory::GetInstance(); #if defined(ENABLE_NOTIFICATIONS) DesktopNotificationServiceFactory::GetInstance(); #endif DownloadServiceFactory::GetInstance(); #if defined(ENABLE_EXTENSIONS) extensions::AppRestoreServiceFactory::GetInstance(); extensions::BluetoothAPIFactory::GetInstance(); extensions::CommandServiceFactory::GetInstance(); extensions::CookiesAPIFactory::GetInstance(); extensions::ExtensionSystemFactory::GetInstance(); extensions::FontSettingsAPIFactory::GetInstance(); extensions::IdleManagerFactory::GetInstance(); extensions::ManagedModeAPIFactory::GetInstance(); extensions::ProcessesAPIFactory::GetInstance(); extensions::SuggestedLinksRegistryFactory::GetInstance(); extensions::TabCaptureRegistryFactory::GetInstance(); extensions::WebNavigationAPIFactory::GetInstance(); ExtensionManagementAPIFactory::GetInstance(); #endif FaviconServiceFactory::GetInstance(); FindBarStateFactory::GetInstance(); #if defined(USE_AURA) GesturePrefsObserverFactoryAura::GetInstance(); #endif GlobalErrorServiceFactory::GetInstance(); GoogleURLTrackerFactory::GetInstance(); HistoryServiceFactory::GetInstance(); MediaGalleriesPreferencesFactory::GetInstance(); NTPResourceCacheFactory::GetInstance(); PasswordStoreFactory::GetInstance(); PersonalDataManagerFactory::GetInstance(); #if !defined(OS_ANDROID) PinnedTabServiceFactory::GetInstance(); #endif PluginPrefsFactory::GetInstance(); #if defined(ENABLE_CONFIGURATION_POLICY) && !defined(OS_CHROMEOS) policy::UserPolicySigninServiceFactory::GetInstance(); #endif predictors::AutocompleteActionPredictorFactory::GetInstance(); predictors::PredictorDatabaseFactory::GetInstance(); predictors::ResourcePrefetchPredictorFactory::GetInstance(); prerender::PrerenderManagerFactory::GetInstance(); prerender::PrerenderLinkManagerFactory::GetInstance(); ProfileSyncServiceFactory::GetInstance(); ProtocolHandlerRegistryFactory::GetInstance(); #if defined(ENABLE_PROTECTOR_SERVICE) protector::ProtectorServiceFactory::GetInstance(); #endif #if defined(ENABLE_SESSION_SERVICE) SessionServiceFactory::GetInstance(); #endif ShortcutsBackendFactory::GetInstance(); ThumbnailServiceFactory::GetInstance(); SigninManagerFactory::GetInstance(); #if defined(ENABLE_INPUT_SPEECH) SpeechInputExtensionManager::InitializeFactory(); ChromeSpeechRecognitionPreferences::InitializeFactory(); #endif SpellcheckServiceFactory::GetInstance(); TabRestoreServiceFactory::GetInstance(); TemplateURLFetcherFactory::GetInstance(); TemplateURLServiceFactory::GetInstance(); #if defined(ENABLE_THEMES) ThemeServiceFactory::GetInstance(); #endif TokenServiceFactory::GetInstance(); UserStyleSheetWatcherFactory::GetInstance(); VisitedLinkMasterFactory::GetInstance(); WebDataServiceFactory::GetInstance(); #if defined(ENABLE_WEB_INTENTS) WebIntentsRegistryFactory::GetInstance(); #endif built_factories_ = true; } ",1 "bool PDFiumEngineExports::GetPDFPageSizeByIndex(const void* pdf_buffer, int pdf_buffer_size, int page_number, double* width, double* height) { FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr); if (!doc) return false; bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; FPDF_CloseDocument(doc); return success; } ",0 "static MagickBooleanType WriteTXTImage(const ImageInfo *image_info,Image *image) { char buffer[MaxTextExtent], colorspace[MaxTextExtent], tuple[MaxTextExtent]; MagickBooleanType status; MagickOffsetType scene; MagickPixelPacket pixel; register const IndexPacket *indexes; register const PixelPacket *p; register ssize_t x; ssize_t y; /* Open output image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickSignature); assert(image != (Image *) NULL); assert(image->signature == MagickSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"",image->filename); status=OpenBlob(image_info,image,WriteBlobMode,&image->exception); if (status == MagickFalse) return(status); scene=0; do { ComplianceType compliance; (void) CopyMagickString(colorspace,CommandOptionToMnemonic( MagickColorspaceOptions,(ssize_t) image->colorspace),MaxTextExtent); LocaleLower(colorspace); image->depth=GetImageQuantumDepth(image,MagickTrue); if (image->matte != MagickFalse) (void) ConcatenateMagickString(colorspace,""a"",MaxTextExtent); compliance=NoCompliance; if (LocaleCompare(image_info->magick,""SPARSE-COLOR"") != 0) { (void) FormatLocaleString(buffer,MaxTextExtent, ""# ImageMagick pixel enumeration: %.20g,%.20g,%.20g,%s\n"",(double) image->columns,(double) image->rows,(double) ((MagickOffsetType) GetQuantumRange(image->depth)),colorspace); (void) WriteBlobString(image,buffer); compliance=SVGCompliance; } GetMagickPixelPacket(image,&pixel); for (y=0; y < (ssize_t) image->rows; y++) { p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception); if (p == (const PixelPacket *) NULL) break; indexes=GetVirtualIndexQueue(image); for (x=0; x < (ssize_t) image->columns; x++) { SetMagickPixelPacket(image,p,indexes+x,&pixel); if (pixel.colorspace == LabColorspace) { pixel.green-=(QuantumRange+1)/2.0; pixel.blue-=(QuantumRange+1)/2.0; } if (LocaleCompare(image_info->magick,""SPARSE-COLOR"") == 0) { /* Sparse-color format. */ if (GetPixelOpacity(p) == (Quantum) OpaqueOpacity) { GetColorTuple(&pixel,MagickFalse,tuple); (void) QueryMagickColorname(image,&pixel,SVGCompliance,tuple, &image->exception); (void) FormatLocaleString(buffer,MaxTextExtent,""%.20g,%.20g,"", (double) x,(double) y); (void) WriteBlobString(image,buffer); (void) WriteBlobString(image,tuple); (void) WriteBlobString(image,"" ""); } p++; continue; } (void) FormatLocaleString(buffer,MaxTextExtent,""%.20g,%.20g: "",(double) x,(double) y); (void) WriteBlobString(image,buffer); (void) CopyMagickString(tuple,""("",MaxTextExtent); ConcatenateColorComponent(&pixel,RedChannel,compliance,tuple); (void) ConcatenateMagickString(tuple,"","",MaxTextExtent); ConcatenateColorComponent(&pixel,GreenChannel,compliance,tuple); (void) ConcatenateMagickString(tuple,"","",MaxTextExtent); ConcatenateColorComponent(&pixel,BlueChannel,compliance,tuple); if (pixel.colorspace == CMYKColorspace) { (void) ConcatenateMagickString(tuple,"","",MaxTextExtent); ConcatenateColorComponent(&pixel,IndexChannel,compliance,tuple); } if (pixel.matte != MagickFalse) { (void) ConcatenateMagickString(tuple,"","",MaxTextExtent); ConcatenateColorComponent(&pixel,AlphaChannel,compliance,tuple); } (void) ConcatenateMagickString(tuple,"")"",MaxTextExtent); (void) WriteBlobString(image,tuple); (void) WriteBlobString(image,"" ""); GetColorTuple(&pixel,MagickTrue,tuple); (void) FormatLocaleString(buffer,MaxTextExtent,""%s"",tuple); (void) WriteBlobString(image,buffer); (void) WriteBlobString(image,"" ""); (void) QueryMagickColorname(image,&pixel,SVGCompliance,tuple, &image->exception); (void) WriteBlobString(image,tuple); (void) WriteBlobString(image,""\n""); p++; } status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } if (GetNextImageInList(image) == (Image *) NULL) break; image=SyncNextImageInList(image); status=SetImageProgress(image,SaveImagesTag,scene++, GetImageListLength(image)); if (status == MagickFalse) break; } while (image_info->adjoin != MagickFalse); (void) CloseBlob(image); return(MagickTrue); } ",0 "void TestingAutomationProvider::ReparentBookmark(int handle, int64 id, int64 new_parent_id, int index, bool* success) { if (browser_tracker_->ContainsHandle(handle)) { Browser* browser = browser_tracker_->GetResource(handle); if (browser) { BookmarkModel* model = browser->profile()->GetBookmarkModel(); if (!model->IsLoaded()) { *success = false; return; } const BookmarkNode* node = model->GetNodeByID(id); DCHECK(node); const BookmarkNode* new_parent = model->GetNodeByID(new_parent_id); DCHECK(new_parent); if (node && new_parent) { model->Move(node, new_parent, index); *success = true; } } } *success = false; } ",0 "int reserve_new_blocks(struct dnode_of_data *dn, blkcnt_t count) { struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode); if (!count) return 0; if (unlikely(is_inode_flag_set(dn->inode, FI_NO_ALLOC))) return -EPERM; if (unlikely(!inc_valid_block_count(sbi, dn->inode, &count))) return -ENOSPC; trace_f2fs_reserve_new_blocks(dn->inode, dn->nid, dn->ofs_in_node, count); f2fs_wait_on_page_writeback(dn->node_page, NODE, true); for (; count > 0; dn->ofs_in_node++) { block_t blkaddr = datablock_addr(dn->node_page, dn->ofs_in_node); if (blkaddr == NULL_ADDR) { dn->data_blkaddr = NEW_ADDR; __set_data_blkaddr(dn); count--; } } if (set_page_dirty(dn->node_page)) dn->node_changed = true; return 0; } ",0 "_PUBLIC_ char *strupper_talloc(TALLOC_CTX *ctx, const char *src) { return strupper_talloc_n(ctx, src, src?strlen(src):0); } ",0 "static int vrend_decode_set_framebuffer_state(struct vrend_decode_ctx *ctx, int length) { if (length < 2) return EINVAL; uint32_t nr_cbufs = get_buf_entry(ctx, VIRGL_SET_FRAMEBUFFER_STATE_NR_CBUFS); uint32_t zsurf_handle = get_buf_entry(ctx, VIRGL_SET_FRAMEBUFFER_STATE_NR_ZSURF_HANDLE); uint32_t surf_handle[8]; int i; if (length != (2 + nr_cbufs)) return EINVAL; for (i = 0; i < nr_cbufs; i++) surf_handle[i] = get_buf_entry(ctx, VIRGL_SET_FRAMEBUFFER_STATE_CBUF_HANDLE(i)); vrend_set_framebuffer_state(ctx->grctx, nr_cbufs, surf_handle, zsurf_handle); return 0; } ",0 "static inline signed short ReadProfileMSBShort(unsigned char **p, size_t *length) { signed short value; if (*length < 2) return(0); value=ReadProfileShort(MSBEndian,*p); (*length)-=2; *p+=2; return(value); } ",0 "static int mem_cgroup_force_empty_list(struct mem_cgroup *memcg, int node, int zid, enum lru_list lru) { struct mem_cgroup_per_zone *mz; unsigned long flags, loop; struct list_head *list; struct page *busy; struct zone *zone; int ret = 0; zone = &NODE_DATA(node)->node_zones[zid]; mz = mem_cgroup_zoneinfo(memcg, node, zid); list = &mz->lruvec.lists[lru]; loop = MEM_CGROUP_ZSTAT(mz, lru); /* give some margin against EBUSY etc...*/ loop += 256; busy = NULL; while (loop--) { struct page_cgroup *pc; struct page *page; ret = 0; spin_lock_irqsave(&zone->lru_lock, flags); if (list_empty(list)) { spin_unlock_irqrestore(&zone->lru_lock, flags); break; } page = list_entry(list->prev, struct page, lru); if (busy == page) { list_move(&page->lru, list); busy = NULL; spin_unlock_irqrestore(&zone->lru_lock, flags); continue; } spin_unlock_irqrestore(&zone->lru_lock, flags); pc = lookup_page_cgroup(page); ret = mem_cgroup_move_parent(page, pc, memcg, GFP_KERNEL); if (ret == -ENOMEM || ret == -EINTR) break; if (ret == -EBUSY || ret == -EINVAL) { /* found lock contention or ""pc"" is obsolete. */ busy = page; cond_resched(); } else busy = NULL; } if (!ret && !list_empty(list)) return -EBUSY; return ret; } ",0 "void Dispatcher::RegisterNativeHandlers(ModuleSystem* module_system, ScriptContext* context, Dispatcher* dispatcher, RequestSender* request_sender, V8SchemaRegistry* v8_schema_registry) { module_system->RegisterNativeHandler( ""chrome"", scoped_ptr(new ChromeNativeHandler(context))); module_system->RegisterNativeHandler( ""lazy_background_page"", scoped_ptr(new LazyBackgroundPageNativeHandler(context))); module_system->RegisterNativeHandler( ""logging"", scoped_ptr(new LoggingNativeHandler(context))); module_system->RegisterNativeHandler(""schema_registry"", v8_schema_registry->AsNativeHandler()); module_system->RegisterNativeHandler( ""print"", scoped_ptr(new PrintNativeHandler(context))); module_system->RegisterNativeHandler( ""test_features"", scoped_ptr(new TestFeaturesNativeHandler(context))); module_system->RegisterNativeHandler( ""test_native_handler"", scoped_ptr(new TestNativeHandler(context))); module_system->RegisterNativeHandler( ""user_gestures"", scoped_ptr(new UserGesturesNativeHandler(context))); module_system->RegisterNativeHandler( ""utils"", scoped_ptr(new UtilsNativeHandler(context))); module_system->RegisterNativeHandler( ""v8_context"", scoped_ptr(new V8ContextNativeHandler(context))); module_system->RegisterNativeHandler( ""event_natives"", scoped_ptr(new EventBindings(context))); module_system->RegisterNativeHandler( ""messaging_natives"", scoped_ptr(MessagingBindings::Get(dispatcher, context))); module_system->RegisterNativeHandler( ""apiDefinitions"", scoped_ptr( new ApiDefinitionsNatives(dispatcher, context))); module_system->RegisterNativeHandler( ""sendRequest"", scoped_ptr( new SendRequestNatives(request_sender, context))); module_system->RegisterNativeHandler( ""setIcon"", scoped_ptr(new SetIconNatives(context))); module_system->RegisterNativeHandler( ""activityLogger"", scoped_ptr(new APIActivityLogger(context))); module_system->RegisterNativeHandler( ""renderFrameObserverNatives"", scoped_ptr(new RenderFrameObserverNatives(context))); module_system->RegisterNativeHandler( ""file_system_natives"", scoped_ptr(new FileSystemNatives(context))); module_system->RegisterNativeHandler( ""app_window_natives"", scoped_ptr(new AppWindowCustomBindings(context))); module_system->RegisterNativeHandler( ""blob_natives"", scoped_ptr(new BlobNativeHandler(context))); module_system->RegisterNativeHandler( ""context_menus"", scoped_ptr(new ContextMenusCustomBindings(context))); module_system->RegisterNativeHandler( ""css_natives"", scoped_ptr(new CssNativeHandler(context))); module_system->RegisterNativeHandler( ""document_natives"", scoped_ptr(new DocumentCustomBindings(context))); module_system->RegisterNativeHandler( ""guest_view_internal"", scoped_ptr( new GuestViewInternalCustomBindings(context))); module_system->RegisterNativeHandler( ""i18n"", scoped_ptr(new I18NCustomBindings(context))); module_system->RegisterNativeHandler( ""id_generator"", scoped_ptr(new IdGeneratorCustomBindings(context))); module_system->RegisterNativeHandler( ""runtime"", scoped_ptr(new RuntimeCustomBindings(context))); module_system->RegisterNativeHandler( ""display_source"", scoped_ptr(new DisplaySourceCustomBindings(context))); } ",1 "rpc_setbufsize(struct rpc_clnt *clnt, unsigned int sndsize, unsigned int rcvsize) { struct rpc_xprt *xprt = clnt->cl_xprt; if (xprt->ops->set_buffer_size) xprt->ops->set_buffer_size(xprt, sndsize, rcvsize); } ",0 "poly_box(PG_FUNCTION_ARGS) { POLYGON *poly = PG_GETARG_POLYGON_P(0); BOX *box; if (poly->npts < 1) PG_RETURN_NULL(); box = box_copy(&poly->boundbox); PG_RETURN_BOX_P(box); } ",0 "static int vnc_server_info_put(QDict *qdict) { if (vnc_server_addr_put(qdict, vnc_display->lsock) < 0) { return -1; } qdict_put(qdict, ""auth"", qstring_from_str(vnc_auth_name(vnc_display))); return 0; } ",0 "void DelegatedFrameHostClient::RequestCopyOfOutput( scoped_ptr request) { GetDelegatedFrameHost()->RequestCopyOfOutput(request.Pass()); } ",0 "static ssize_t lbs_rdrf_write(struct file *file, const char __user *userbuf, size_t count, loff_t *ppos) { struct lbs_private *priv = file->private_data; ssize_t res, buf_size; unsigned long addr = get_zeroed_page(GFP_KERNEL); char *buf = (char *)addr; if (!buf) return -ENOMEM; buf_size = min(count, len - 1); if (copy_from_user(buf, userbuf, buf_size)) { res = -EFAULT; goto out_unlock; } priv->rf_offset = simple_strtoul(buf, NULL, 16); res = count; out_unlock: free_page(addr); return res; } ",0 "bool CustomButton::IsTriggerableEvent(const ui::Event& event) { return event.type() == ui::ET_GESTURE_TAP_DOWN || event.type() == ui::ET_GESTURE_TAP || (event.IsMouseEvent() && (triggerable_event_flags_ & event.flags()) != 0); } ",0 "void WebGLRenderingContextBase::RestoreScissorEnabled() { if (isContextLost()) return; if (scissor_enabled_) { ContextGL()->Enable(GL_SCISSOR_TEST); } else { ContextGL()->Disable(GL_SCISSOR_TEST); } } ",0 "void ewk_view_mixed_content_displayed_set(Evas_Object* ewkView, bool hasDisplayed) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); priv->flags.hasDisplayedMixedContent = hasDisplayed; if (hasDisplayed) evas_object_smart_callback_call(ewkView, ""mixedcontent,displayed"", 0); } ",0 "SingleThreadTaskRunner* WebLocalFrameImpl::UnthrottledTaskRunner() { return GetFrame() ->FrameScheduler() ->UnthrottledTaskRunner() ->ToSingleThreadTaskRunner(); } ",0 "static int mov_read_packet(AVFormatContext *s, AVPacket *pkt) { MOVContext *mov = s->priv_data; MOVStreamContext *sc; AVIndexEntry *sample; AVStream *st = NULL; int ret; mov->fc = s; retry: sample = mov_find_next_sample(s, &st); if (!sample) { mov->found_mdat = 0; if (!mov->next_root_atom) return AVERROR_EOF; avio_seek(s->pb, mov->next_root_atom, SEEK_SET); mov->next_root_atom = 0; if (mov_read_default(mov, s->pb, (MOVAtom){ AV_RL32(""root""), INT64_MAX }) < 0 || url_feof(s->pb)) return AVERROR_EOF; av_dlog(s, ""read fragments, offset 0x%""PRIx64""\n"", avio_tell(s->pb)); goto retry; } sc = st->priv_data; /* must be done just before reading, to avoid infinite loop on sample */ sc->current_sample++; if (st->discard != AVDISCARD_ALL) { if (avio_seek(sc->pb, sample->pos, SEEK_SET) != sample->pos) { av_log(mov->fc, AV_LOG_ERROR, ""stream %d, offset 0x%""PRIx64"": partial file\n"", sc->ffindex, sample->pos); return AVERROR_INVALIDDATA; } ret = av_get_packet(sc->pb, pkt, sample->size); if (ret < 0) return ret; if (sc->has_palette) { uint8_t *pal; pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, AVPALETTE_SIZE); if (!pal) { av_log(mov->fc, AV_LOG_ERROR, ""Cannot append palette to packet\n""); } else { memcpy(pal, sc->palette, AVPALETTE_SIZE); sc->has_palette = 0; } } #if CONFIG_DV_DEMUXER if (mov->dv_demux && sc->dv_audio_container) { avpriv_dv_produce_packet(mov->dv_demux, pkt, pkt->data, pkt->size, pkt->pos); av_free(pkt->data); pkt->size = 0; ret = avpriv_dv_get_packet(mov->dv_demux, pkt); if (ret < 0) return ret; } #endif } pkt->stream_index = sc->ffindex; pkt->dts = sample->timestamp; if (sc->ctts_data && sc->ctts_index < sc->ctts_count) { pkt->pts = pkt->dts + sc->dts_shift + sc->ctts_data[sc->ctts_index].duration; /* update ctts context */ sc->ctts_sample++; if (sc->ctts_index < sc->ctts_count && sc->ctts_data[sc->ctts_index].count == sc->ctts_sample) { sc->ctts_index++; sc->ctts_sample = 0; } if (sc->wrong_dts) pkt->dts = AV_NOPTS_VALUE; } else { int64_t next_dts = (sc->current_sample < st->nb_index_entries) ? st->index_entries[sc->current_sample].timestamp : st->duration; pkt->duration = next_dts - pkt->dts; pkt->pts = pkt->dts; } if (st->discard == AVDISCARD_ALL) goto retry; pkt->flags |= sample->flags & AVINDEX_KEYFRAME ? AV_PKT_FLAG_KEY : 0; pkt->pos = sample->pos; av_dlog(s, ""stream %d, pts %""PRId64"", dts %""PRId64"", pos 0x%""PRIx64"", duration %d\n"", pkt->stream_index, pkt->pts, pkt->dts, pkt->pos, pkt->duration); return 0; } ",0 "static void r_bin_dwarf_row_free(void *p) { RBinDwarfRow *row = (RBinDwarfRow*)p; free (row->file); free (row); } ",0 "static int open_collection(struct hid_parser *parser, unsigned type) { struct hid_collection *collection; unsigned usage; usage = parser->local.usage[0]; if (parser->collection_stack_ptr == HID_COLLECTION_STACK_SIZE) { hid_err(parser->device, ""collection stack overflow\n""); return -EINVAL; } if (parser->device->maxcollection == parser->device->collection_size) { collection = kmalloc(sizeof(struct hid_collection) * parser->device->collection_size * 2, GFP_KERNEL); if (collection == NULL) { hid_err(parser->device, ""failed to reallocate collection array\n""); return -ENOMEM; } memcpy(collection, parser->device->collection, sizeof(struct hid_collection) * parser->device->collection_size); memset(collection + parser->device->collection_size, 0, sizeof(struct hid_collection) * parser->device->collection_size); kfree(parser->device->collection); parser->device->collection = collection; parser->device->collection_size *= 2; } parser->collection_stack[parser->collection_stack_ptr++] = parser->device->maxcollection; collection = parser->device->collection + parser->device->maxcollection++; collection->type = type; collection->usage = usage; collection->level = parser->collection_stack_ptr - 1; if (type == HID_COLLECTION_APPLICATION) parser->device->maxapplication++; return 0; } ",0 "static void webkit_web_view_grab_focus(GtkWidget* widget) { if (gtk_widget_is_sensitive(widget)) { WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); FocusController* focusController = core(webView)->focusController(); focusController->setActive(true); if (focusController->focusedFrame()) focusController->setFocused(true); else focusController->setFocusedFrame(core(webView)->mainFrame()); } return GTK_WIDGET_CLASS(webkit_web_view_parent_class)->grab_focus(widget); } ",0 "PHP_METHOD(PharFileInfo, delMetadata) { char *error; PHAR_ENTRY_OBJECT(); if (zend_parse_parameters_none() == FAILURE) { return; } if (PHAR_G(readonly) && !entry_obj->ent.entry->phar->is_data) { zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, ""Write operations disabled by the php.ini setting phar.readonly""); return; } if (entry_obj->ent.entry->is_temp_dir) { zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, \ ""Phar entry is a temporary directory (not an actual entry in the archive), cannot delete metadata""); \ return; } if (entry_obj->ent.entry->metadata) { if (entry_obj->ent.entry->is_persistent) { phar_archive_data *phar = entry_obj->ent.entry->phar; if (FAILURE == phar_copy_on_write(&phar TSRMLS_CC)) { zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, ""phar \""%s\"" is persistent, unable to copy on write"", phar->fname); return; } /* re-populate after copy-on-write */ zend_hash_find(&phar->manifest, entry_obj->ent.entry->filename, entry_obj->ent.entry->filename_len, (void **)&entry_obj->ent.entry); } zval_ptr_dtor(&entry_obj->ent.entry->metadata); entry_obj->ent.entry->metadata = NULL; entry_obj->ent.entry->is_modified = 1; entry_obj->ent.entry->phar->is_modified = 1; phar_flush(entry_obj->ent.entry->phar, 0, 0, 0, &error TSRMLS_CC); if (error) { zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, ""%s"", error); efree(error); RETURN_FALSE; } else { RETURN_TRUE; } } else { RETURN_TRUE; } } ",0 "xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler) { xmlMutexLock(xmlThrDefMutex); xmlStructuredErrorContextThrDef = ctx; xmlStructuredErrorThrDef = handler; xmlMutexUnlock(xmlThrDefMutex); } ",0 "static int nested_svm_vmexit(struct vcpu_svm *svm) { struct vmcb *nested_vmcb; struct vmcb *hsave = svm->nested.hsave; struct vmcb *vmcb = svm->vmcb; struct page *page; trace_kvm_nested_vmexit_inject(vmcb->control.exit_code, vmcb->control.exit_info_1, vmcb->control.exit_info_2, vmcb->control.exit_int_info, vmcb->control.exit_int_info_err, KVM_ISA_SVM); nested_vmcb = nested_svm_map(svm, svm->nested.vmcb, &page); if (!nested_vmcb) return 1; /* Exit Guest-Mode */ leave_guest_mode(&svm->vcpu); svm->nested.vmcb = 0; /* Give the current vmcb to the guest */ disable_gif(svm); nested_vmcb->save.es = vmcb->save.es; nested_vmcb->save.cs = vmcb->save.cs; nested_vmcb->save.ss = vmcb->save.ss; nested_vmcb->save.ds = vmcb->save.ds; nested_vmcb->save.gdtr = vmcb->save.gdtr; nested_vmcb->save.idtr = vmcb->save.idtr; nested_vmcb->save.efer = svm->vcpu.arch.efer; nested_vmcb->save.cr0 = kvm_read_cr0(&svm->vcpu); nested_vmcb->save.cr3 = kvm_read_cr3(&svm->vcpu); nested_vmcb->save.cr2 = vmcb->save.cr2; nested_vmcb->save.cr4 = svm->vcpu.arch.cr4; nested_vmcb->save.rflags = kvm_get_rflags(&svm->vcpu); nested_vmcb->save.rip = vmcb->save.rip; nested_vmcb->save.rsp = vmcb->save.rsp; nested_vmcb->save.rax = vmcb->save.rax; nested_vmcb->save.dr7 = vmcb->save.dr7; nested_vmcb->save.dr6 = vmcb->save.dr6; nested_vmcb->save.cpl = vmcb->save.cpl; nested_vmcb->control.int_ctl = vmcb->control.int_ctl; nested_vmcb->control.int_vector = vmcb->control.int_vector; nested_vmcb->control.int_state = vmcb->control.int_state; nested_vmcb->control.exit_code = vmcb->control.exit_code; nested_vmcb->control.exit_code_hi = vmcb->control.exit_code_hi; nested_vmcb->control.exit_info_1 = vmcb->control.exit_info_1; nested_vmcb->control.exit_info_2 = vmcb->control.exit_info_2; nested_vmcb->control.exit_int_info = vmcb->control.exit_int_info; nested_vmcb->control.exit_int_info_err = vmcb->control.exit_int_info_err; if (svm->nrips_enabled) nested_vmcb->control.next_rip = vmcb->control.next_rip; /* * If we emulate a VMRUN/#VMEXIT in the same host #vmexit cycle we have * to make sure that we do not lose injected events. So check event_inj * here and copy it to exit_int_info if it is valid. * Exit_int_info and event_inj can't be both valid because the case * below only happens on a VMRUN instruction intercept which has * no valid exit_int_info set. */ if (vmcb->control.event_inj & SVM_EVTINJ_VALID) { struct vmcb_control_area *nc = &nested_vmcb->control; nc->exit_int_info = vmcb->control.event_inj; nc->exit_int_info_err = vmcb->control.event_inj_err; } nested_vmcb->control.tlb_ctl = 0; nested_vmcb->control.event_inj = 0; nested_vmcb->control.event_inj_err = 0; /* We always set V_INTR_MASKING and remember the old value in hflags */ if (!(svm->vcpu.arch.hflags & HF_VINTR_MASK)) nested_vmcb->control.int_ctl &= ~V_INTR_MASKING_MASK; /* Restore the original control entries */ copy_vmcb_control_area(vmcb, hsave); kvm_clear_exception_queue(&svm->vcpu); kvm_clear_interrupt_queue(&svm->vcpu); svm->nested.nested_cr3 = 0; /* Restore selected save entries */ svm->vmcb->save.es = hsave->save.es; svm->vmcb->save.cs = hsave->save.cs; svm->vmcb->save.ss = hsave->save.ss; svm->vmcb->save.ds = hsave->save.ds; svm->vmcb->save.gdtr = hsave->save.gdtr; svm->vmcb->save.idtr = hsave->save.idtr; kvm_set_rflags(&svm->vcpu, hsave->save.rflags); svm_set_efer(&svm->vcpu, hsave->save.efer); svm_set_cr0(&svm->vcpu, hsave->save.cr0 | X86_CR0_PE); svm_set_cr4(&svm->vcpu, hsave->save.cr4); if (npt_enabled) { svm->vmcb->save.cr3 = hsave->save.cr3; svm->vcpu.arch.cr3 = hsave->save.cr3; } else { (void)kvm_set_cr3(&svm->vcpu, hsave->save.cr3); } kvm_register_write(&svm->vcpu, VCPU_REGS_RAX, hsave->save.rax); kvm_register_write(&svm->vcpu, VCPU_REGS_RSP, hsave->save.rsp); kvm_register_write(&svm->vcpu, VCPU_REGS_RIP, hsave->save.rip); svm->vmcb->save.dr7 = 0; svm->vmcb->save.cpl = 0; svm->vmcb->control.exit_int_info = 0; mark_all_dirty(svm->vmcb); nested_svm_unmap(page); nested_svm_uninit_mmu_context(&svm->vcpu); kvm_mmu_reset_context(&svm->vcpu); kvm_mmu_load(&svm->vcpu); return 0; } ",0 "bool HTMLMediaElement::SupportsFocus() const { if (ownerDocument()->IsMediaDocument()) return false; return ShouldShowControls() || HTMLElement::SupportsFocus(); } ",0 "int ext4_collapse_range(struct inode *inode, loff_t offset, loff_t len) { struct super_block *sb = inode->i_sb; ext4_lblk_t punch_start, punch_stop; handle_t *handle; unsigned int credits; loff_t new_size, ioffset; int ret; /* * We need to test this early because xfstests assumes that a * collapse range of (0, 1) will return EOPNOTSUPP if the file * system does not support collapse range. */ if (!ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) return -EOPNOTSUPP; /* Collapse range works only on fs block size aligned offsets. */ if (offset & (EXT4_CLUSTER_SIZE(sb) - 1) || len & (EXT4_CLUSTER_SIZE(sb) - 1)) return -EINVAL; if (!S_ISREG(inode->i_mode)) return -EINVAL; trace_ext4_collapse_range(inode, offset, len); punch_start = offset >> EXT4_BLOCK_SIZE_BITS(sb); punch_stop = (offset + len) >> EXT4_BLOCK_SIZE_BITS(sb); /* Call ext4_force_commit to flush all data in case of data=journal. */ if (ext4_should_journal_data(inode)) { ret = ext4_force_commit(inode->i_sb); if (ret) return ret; } inode_lock(inode); /* * There is no need to overlap collapse range with EOF, in which case * it is effectively a truncate operation */ if (offset + len >= i_size_read(inode)) { ret = -EINVAL; goto out_mutex; } /* Currently just for extent based files */ if (!ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) { ret = -EOPNOTSUPP; goto out_mutex; } /* Wait for existing dio to complete */ inode_dio_wait(inode); /* * Prevent page faults from reinstantiating pages we have released from * page cache. */ down_write(&EXT4_I(inode)->i_mmap_sem); ret = ext4_break_layouts(inode); if (ret) goto out_mmap; /* * Need to round down offset to be aligned with page size boundary * for page size > block size. */ ioffset = round_down(offset, PAGE_SIZE); /* * Write tail of the last page before removed range since it will get * removed from the page cache below. */ ret = filemap_write_and_wait_range(inode->i_mapping, ioffset, offset); if (ret) goto out_mmap; /* * Write data that will be shifted to preserve them when discarding * page cache below. We are also protected from pages becoming dirty * by i_mmap_sem. */ ret = filemap_write_and_wait_range(inode->i_mapping, offset + len, LLONG_MAX); if (ret) goto out_mmap; truncate_pagecache(inode, ioffset); credits = ext4_writepage_trans_blocks(inode); handle = ext4_journal_start(inode, EXT4_HT_TRUNCATE, credits); if (IS_ERR(handle)) { ret = PTR_ERR(handle); goto out_mmap; } down_write(&EXT4_I(inode)->i_data_sem); ext4_discard_preallocations(inode); ret = ext4_es_remove_extent(inode, punch_start, EXT_MAX_BLOCKS - punch_start); if (ret) { up_write(&EXT4_I(inode)->i_data_sem); goto out_stop; } ret = ext4_ext_remove_space(inode, punch_start, punch_stop - 1); if (ret) { up_write(&EXT4_I(inode)->i_data_sem); goto out_stop; } ext4_discard_preallocations(inode); ret = ext4_ext_shift_extents(inode, handle, punch_stop, punch_stop - punch_start, SHIFT_LEFT); if (ret) { up_write(&EXT4_I(inode)->i_data_sem); goto out_stop; } new_size = i_size_read(inode) - len; i_size_write(inode, new_size); EXT4_I(inode)->i_disksize = new_size; up_write(&EXT4_I(inode)->i_data_sem); if (IS_SYNC(inode)) ext4_handle_sync(handle); inode->i_mtime = inode->i_ctime = current_time(inode); ext4_mark_inode_dirty(handle, inode); ext4_update_inode_fsync_trans(handle, inode, 1); out_stop: ext4_journal_stop(handle); out_mmap: up_write(&EXT4_I(inode)->i_mmap_sem); out_mutex: inode_unlock(inode); return ret; } ",0 "bool LiveSyncTest::AwaitQuiescence() { return ProfileSyncServiceHarness::AwaitQuiescence(clients()); } ",0 "gboolean OmniboxPopupViewGtk::HandleMotion(GtkWidget* widget, GdkEventMotion* event) { size_t line = LineFromY(static_cast(event->y)); model_->SetHoveredLine(line); if (!ignore_mouse_drag_ && (event->state & GDK_BUTTON1_MASK)) model_->SetSelectedLine(line, false, false); return TRUE; } ",0 "JSRetainPtr AccessibilityUIElement::attributesOfRows() { return JSStringCreateWithCharacters(0, 0); } ",0 " PanelBrowserTest() : BasePanelBrowserTest() { } ",0 " status_t OMXNodeInstance::storeMetaDataInBuffers_l( OMX_U32 portIndex, OMX_BOOL enable, MetadataBufferType *type) { if (portIndex != kPortIndexInput && portIndex != kPortIndexOutput) { android_errorWriteLog(0x534e4554, ""26324358""); if (type != NULL) { *type = kMetadataBufferTypeInvalid; } return BAD_VALUE; } OMX_INDEXTYPE index; OMX_STRING name = const_cast( ""OMX.google.android.index.storeMetaDataInBuffers""); OMX_STRING nativeBufferName = const_cast( ""OMX.google.android.index.storeANWBufferInMetadata""); MetadataBufferType negotiatedType; MetadataBufferType requestedType = type != NULL ? *type : kMetadataBufferTypeANWBuffer; StoreMetaDataInBuffersParams params; InitOMXParams(¶ms); params.nPortIndex = portIndex; params.bStoreMetaData = enable; OMX_ERRORTYPE err = requestedType == kMetadataBufferTypeANWBuffer ? OMX_GetExtensionIndex(mHandle, nativeBufferName, &index) : OMX_ErrorUnsupportedIndex; OMX_ERRORTYPE xerr = err; if (err == OMX_ErrorNone) { err = OMX_SetParameter(mHandle, index, ¶ms); if (err == OMX_ErrorNone) { name = nativeBufferName; // set name for debugging negotiatedType = requestedType; } } if (err != OMX_ErrorNone) { err = OMX_GetExtensionIndex(mHandle, name, &index); xerr = err; if (err == OMX_ErrorNone) { negotiatedType = requestedType == kMetadataBufferTypeANWBuffer ? kMetadataBufferTypeGrallocSource : requestedType; err = OMX_SetParameter(mHandle, index, ¶ms); } } if (err != OMX_ErrorNone) { if (err == OMX_ErrorUnsupportedIndex && portIndex == kPortIndexOutput) { CLOGW(""component does not support metadata mode; using fallback""); } else if (xerr != OMX_ErrorNone) { CLOG_ERROR(getExtensionIndex, xerr, ""%s"", name); } else { CLOG_ERROR(setParameter, err, ""%s(%#x): %s:%u en=%d type=%d"", name, index, portString(portIndex), portIndex, enable, negotiatedType); } negotiatedType = mMetadataType[portIndex]; } else { if (!enable) { negotiatedType = kMetadataBufferTypeInvalid; } mMetadataType[portIndex] = negotiatedType; } CLOG_CONFIG(storeMetaDataInBuffers, ""%s:%u %srequested %s:%d negotiated %s:%d"", portString(portIndex), portIndex, enable ? """" : ""UN"", asString(requestedType), requestedType, asString(negotiatedType), negotiatedType); if (type != NULL) { *type = negotiatedType; } return StatusFromOMXError(err); } ",1 "bool Parcel::checkInterface(IBinder* binder) const { return enforceInterface(binder->getInterfaceDescriptor()); } ",0 "static int wait_port_writable(struct port *port, bool nonblock) { int ret; if (will_write_block(port)) { if (nonblock) return -EAGAIN; ret = wait_event_freezable(port->waitqueue, !will_write_block(port)); if (ret < 0) return ret; } /* Port got hot-unplugged. */ if (!port->guest_connected) return -ENODEV; return 0; } ",0 "static int cmd_system(void *data, const char *input) { RCore *core = (RCore*)data; ut64 n; int ret = 0; switch (*input) { case '-': //!- if (input[1]) { r_line_hist_free(); r_line_hist_save (R2_HOME_HISTORY); } else { r_line_hist_free(); } break; case '=': //!= if (input[1] == '?') { r_cons_printf (""Usage: !=[!] - enable/disable remote commands\n""); } else { if (!r_sandbox_enable (0)) { core->cmdremote = input[1]? 1: 0; r_cons_println (r_str_bool (core->cmdremote)); } } break; case '!': //!! if (input[1] == '!') { // !!! & !!!- cmd_autocomplete (core, input + 2); } else if (input[1] == '?') { cmd_help_exclamation (core); } else if (input[1] == '*') { char *cmd = r_str_trim_dup (input + 1); (void)r_core_cmdf (core, ""\""#!pipe %s\"""", cmd); free (cmd); } else { if (r_sandbox_enable (0)) { eprintf (""This command is disabled in sandbox mode\n""); return 0; } if (input[1]) { int olen; char *out = NULL; char *cmd = r_core_sysenv_begin (core, input); if (cmd) { void *bed = r_cons_sleep_begin (); ret = r_sys_cmd_str_full (cmd + 1, NULL, &out, &olen, NULL); r_cons_sleep_end (bed); r_core_sysenv_end (core, input); r_cons_memcat (out, olen); free (out); free (cmd); } //else eprintf (""Error setting up system environment\n""); } else { eprintf (""History saved to ""R2_HOME_HISTORY""\n""); r_line_hist_save (R2_HOME_HISTORY); } } break; case '\0': r_line_hist_list (); break; case '?': //!? cmd_help_exclamation (core); break; case '*': { char *cmd = r_str_trim_dup (input + 1); cmd = r_str_replace (cmd, "" "", ""\\ "", true); cmd = r_str_replace (cmd, ""\\ "", "" "", false); cmd = r_str_replace (cmd, ""\"""", ""'"", false); ret = r_core_cmdf (core, ""\""#!pipe %s\"""", cmd); free (cmd); } break; default: n = atoi (input); if (*input == '0' || n > 0) { const char *cmd = r_line_hist_get (n); if (cmd) { r_core_cmd0 (core, cmd); } } else { char *cmd = r_core_sysenv_begin (core, input); if (cmd) { void *bed = r_cons_sleep_begin (); ret = r_sys_cmd (cmd); r_cons_sleep_end (bed); r_core_sysenv_end (core, input); free (cmd); } else { eprintf (""Error setting up system environment\n""); } } break; } return ret; } ",0 "static const char *set_async_filter(cmd_parms *cmd, void *dummy, const char *arg) { core_server_config *conf = ap_get_core_module_config(cmd->server->module_config); const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE); if (err) { return err; } if (ap_cstr_casecmp(arg, ""network"") == 0) { conf->async_filter = AP_FTYPE_NETWORK; } else if (ap_cstr_casecmp(arg, ""connection"") == 0) { conf->async_filter = AP_FTYPE_CONNECTION; } else if (ap_cstr_casecmp(arg, ""request"") == 0) { conf->async_filter = 0; } else { return ""AsyncFilter must be 'network', 'connection' or 'request'""; } conf->async_filter_set = 1; return NULL; } ",0 "int kvm_mmu_reset_context(struct kvm_vcpu *vcpu) { destroy_kvm_mmu(vcpu); return init_kvm_mmu(vcpu); } ",0 "bool V8TestInterfaceNode::hasInstance(v8::Local v8Value, v8::Isolate* isolate) { return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value); } ",0 "decode_OFPAT_RAW_SET_NW_TOS(uint8_t dscp, enum ofp_version ofp_version OVS_UNUSED, struct ofpbuf *out) { if (dscp & ~IP_DSCP_MASK) { return OFPERR_OFPBAC_BAD_ARGUMENT; } else { ofpact_put_SET_IP_DSCP(out)->dscp = dscp; return 0; } } ",0 "static ssize_t red_zone_store(struct kmem_cache *s, const char *buf, size_t length) { if (any_slab_objects(s)) return -EBUSY; s->flags &= ~SLAB_RED_ZONE; if (buf[0] == '1') s->flags |= SLAB_RED_ZONE; calculate_sizes(s, -1); return length; } ",0 "local void *yarn_malloc(size_t size) { return malloc_track(&mem_track, size); } ",0 "void Parcel::acquireObjects() { const sp proc(ProcessState::self()); size_t i = mObjectsSize; uint8_t* const data = mData; binder_size_t* const objects = mObjects; while (i > 0) { i--; const flat_binder_object* flat = reinterpret_cast(data+objects[i]); acquire_object(proc, *flat, this); } } ",0 "SplashError Splash::composite(SplashBitmap *src, int xSrc, int ySrc, int xDest, int yDest, int w, int h, GBool noClip, GBool nonIsolated, GBool knockout, SplashCoord knockoutOpacity) { SplashPipe pipe; SplashColor pixel; Guchar alpha; Guchar *ap; int x, y; if (src->mode != bitmap->mode) { return splashErrModeMismatch; } if(src->getSeparationList()->getLength() > bitmap->getSeparationList()->getLength()) { for (x = bitmap->getSeparationList()->getLength(); x < src->getSeparationList()->getLength(); x++) bitmap->getSeparationList()->append(((GfxSeparationColorSpace *)src->getSeparationList()->get(x))->copy()); } if (src->alpha) { pipeInit(&pipe, xDest, yDest, NULL, pixel, (Guchar)splashRound(state->fillAlpha * 255), gTrue, nonIsolated, knockout, (Guchar)splashRound(knockoutOpacity * 255)); if (noClip) { for (y = 0; y < h; ++y) { pipeSetXY(&pipe, xDest, yDest + y); ap = src->getAlphaPtr() + (ySrc + y) * src->getWidth() + xSrc; for (x = 0; x < w; ++x) { src->getPixel(xSrc + x, ySrc + y, pixel); alpha = *ap++; pipe.shape = alpha; (this->*pipe.run)(&pipe); } } updateModX(xDest); updateModX(xDest + w - 1); updateModY(yDest); updateModY(yDest + h - 1); } else { for (y = 0; y < h; ++y) { pipeSetXY(&pipe, xDest, yDest + y); ap = src->getAlphaPtr() + (ySrc + y) * src->getWidth() + xSrc; for (x = 0; x < w; ++x) { src->getPixel(xSrc + x, ySrc + y, pixel); alpha = *ap++; if (state->clip->test(xDest + x, yDest + y)) { pipe.shape = alpha; (this->*pipe.run)(&pipe); updateModX(xDest + x); updateModY(yDest + y); } else { pipeIncX(&pipe); } } } } } else { pipeInit(&pipe, xDest, yDest, NULL, pixel, (Guchar)splashRound(state->fillAlpha * 255), gFalse, nonIsolated); if (noClip) { for (y = 0; y < h; ++y) { pipeSetXY(&pipe, xDest, yDest + y); for (x = 0; x < w; ++x) { src->getPixel(xSrc + x, ySrc + y, pixel); (this->*pipe.run)(&pipe); } } updateModX(xDest); updateModX(xDest + w - 1); updateModY(yDest); updateModY(yDest + h - 1); } else { for (y = 0; y < h; ++y) { pipeSetXY(&pipe, xDest, yDest + y); for (x = 0; x < w; ++x) { src->getPixel(xSrc + x, ySrc + y, pixel); if (state->clip->test(xDest + x, yDest + y)) { (this->*pipe.run)(&pipe); updateModX(xDest + x); updateModY(yDest + y); } else { pipeIncX(&pipe); } } } } } return splashOk; } ",0 "static struct bsg_device *bsg_add_device(struct inode *inode, struct request_queue *rq, struct file *file) { struct bsg_device *bd; #ifdef BSG_DEBUG unsigned char buf[32]; #endif if (!blk_get_queue(rq)) return ERR_PTR(-ENXIO); bd = bsg_alloc_device(); if (!bd) { blk_put_queue(rq); return ERR_PTR(-ENOMEM); } bd->queue = rq; bsg_set_block(bd, file); atomic_set(&bd->ref_count, 1); mutex_lock(&bsg_mutex); hlist_add_head(&bd->dev_list, bsg_dev_idx_hash(iminor(inode))); strncpy(bd->name, dev_name(rq->bsg_dev.class_dev), sizeof(bd->name) - 1); dprintk(""bound to <%s>, max queue %d\n"", format_dev_t(buf, inode->i_rdev), bd->max_queue); mutex_unlock(&bsg_mutex); return bd; } ",0 "CanvasResourceDispatcher* OffscreenCanvas::GetOrCreateResourceDispatcher() { DCHECK(HasPlaceholderCanvas()); if (!frame_dispatcher_) { frame_dispatcher_ = std::make_unique( this, client_id_, sink_id_, placeholder_canvas_id_, size_); } return frame_dispatcher_.get(); } ",0 "std::string TestURLLoader::TestFollowURLRedirect() { pp::URLRequestInfo request(instance_); std::string redirect_prefix(""/server-redirect?""); std::string redirect_url = GetReachableAbsoluteURL(""test_url_loader_data/hello.txt""); request.SetURL(redirect_prefix.append(redirect_url)); return LoadAndCompareBody(request, ""hello\n""); } ",0 " DeleteRequest(scoped_refptr db, scoped_refptr callbacks) : ConnectionRequest(db), callbacks_(callbacks), weak_factory_(this) {} ",0 "LRESULT TreeView::OnNotify(int w_param, LPNMHDR l_param) { switch (l_param->code) { case TVN_GETDISPINFO: { DCHECK(model_); NMTVDISPINFO* info = reinterpret_cast(l_param); if (!id_to_details_map_.empty()) { const NodeDetails* details = GetNodeDetailsByID(static_cast(info->item.lParam)); if (info->item.mask & TVIF_CHILDREN) info->item.cChildren = model_->GetChildCount(details->node); if (info->item.mask & TVIF_TEXT) { std::wstring text = details->node->GetTitle(); DCHECK(info->item.cchTextMax); base::i18n::AdjustStringForLocaleDirection(&text); wcsncpy_s(info->item.pszText, info->item.cchTextMax, text.c_str(), _TRUNCATE); } info->item.mask |= TVIF_DI_SETITEM; } else { if (info->item.mask & TVIF_CHILDREN) info->item.cChildren = 0; if (info->item.mask & TVIF_TEXT) wcsncpy_s(info->item.pszText, info->item.cchTextMax, L"""", _TRUNCATE); } return 0; } case TVN_ITEMEXPANDING: { DCHECK(model_); NMTREEVIEW* info = reinterpret_cast(l_param); NodeDetails* details = GetNodeDetailsByID(static_cast(info->itemNew.lParam)); if (!details->loaded_children) { details->loaded_children = true; for (int i = 0; i < model_->GetChildCount(details->node); ++i) { CreateItem(details->tree_item, TVI_LAST, model_->GetChild(details->node, i)); if (auto_expand_children_) Expand(model_->GetChild(details->node, i)); } } return FALSE; } case TVN_SELCHANGED: if (controller_) controller_->OnTreeViewSelectionChanged(this); break; case TVN_BEGINLABELEDIT: { NMTVDISPINFO* info = reinterpret_cast(l_param); NodeDetails* details = GetNodeDetailsByID(static_cast(info->item.lParam)); if (!controller_ || controller_->CanEdit(this, details->node)) { editing_node_ = details->node; return FALSE; } return TRUE; } case TVN_ENDLABELEDIT: { NMTVDISPINFO* info = reinterpret_cast(l_param); if (info->item.pszText) { NodeDetails* details = GetNodeDetailsByID(static_cast(info->item.lParam)); model_->SetTitle(details->node, info->item.pszText); editing_node_ = NULL; return FALSE; } editing_node_ = NULL; return 0; } case TVN_KEYDOWN: if (controller_) { NMTVKEYDOWN* key_down_message = reinterpret_cast(l_param); controller_->OnTreeViewKeyDown( ui::KeyboardCodeForWindowsKeyCode(key_down_message->wVKey)); } break; default: break; } return 0; } ",0 "XMPChunk::XMPChunk(Container* parent, WEBP_MetaHandler* handler) : Chunk(parent, handler) { handler->packetInfo.offset = this->pos + 8; handler->packetInfo.length = (XMP_Int32) this->data.size(); handler->xmpPacket.reserve(handler->packetInfo.length); handler->xmpPacket.assign(handler->packetInfo.length, '\0'); handler->xmpPacket.insert(handler->xmpPacket.begin(), this->data.begin(), this->data.end()); handler->containsXMP = true; // last, after all possible failure handler->xmpChunk = this; } ",0 "void DelegatedFrameHost::WasHidden() { frame_evictor_->SetVisible(false); released_front_lock_ = NULL; } ",0 "PHP_FUNCTION(radius_put_vendor_string) { char *str; int str_len; long type, vendor; radius_descriptor *raddesc; zval *z_radh; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""rlls"", &z_radh, &vendor, &type, &str, &str_len) == FAILURE) { return; } ZEND_FETCH_RESOURCE(raddesc, radius_descriptor *, &z_radh, -1, ""rad_handle"", le_radius); if (rad_put_vendor_string(raddesc->radh, vendor, type, str) == -1) { RETURN_FALSE; } else { RETURN_TRUE; } } ",0 "static long madvise_behavior(struct vm_area_struct * vma, struct vm_area_struct **prev, unsigned long start, unsigned long end, int behavior) { struct mm_struct * mm = vma->vm_mm; int error = 0; pgoff_t pgoff; unsigned long new_flags = vma->vm_flags; switch (behavior) { case MADV_NORMAL: new_flags = new_flags & ~VM_RAND_READ & ~VM_SEQ_READ; break; case MADV_SEQUENTIAL: new_flags = (new_flags & ~VM_RAND_READ) | VM_SEQ_READ; break; case MADV_RANDOM: new_flags = (new_flags & ~VM_SEQ_READ) | VM_RAND_READ; break; case MADV_DONTFORK: new_flags |= VM_DONTCOPY; break; case MADV_DOFORK: if (vma->vm_flags & VM_IO) { error = -EINVAL; goto out; } new_flags &= ~VM_DONTCOPY; break; case MADV_DONTDUMP: new_flags |= VM_NODUMP; break; case MADV_DODUMP: new_flags &= ~VM_NODUMP; break; case MADV_MERGEABLE: case MADV_UNMERGEABLE: error = ksm_madvise(vma, start, end, behavior, &new_flags); if (error) goto out; break; case MADV_HUGEPAGE: case MADV_NOHUGEPAGE: error = hugepage_madvise(vma, &new_flags, behavior); if (error) goto out; break; } if (new_flags == vma->vm_flags) { *prev = vma; goto out; } pgoff = vma->vm_pgoff + ((start - vma->vm_start) >> PAGE_SHIFT); *prev = vma_merge(mm, *prev, start, end, new_flags, vma->anon_vma, vma->vm_file, pgoff, vma_policy(vma)); if (*prev) { vma = *prev; goto success; } *prev = vma; if (start != vma->vm_start) { error = split_vma(mm, vma, start, 1); if (error) goto out; } if (end != vma->vm_end) { error = split_vma(mm, vma, end, 0); if (error) goto out; } success: /* * vm_flags is protected by the mmap_sem held in write mode. */ vma->vm_flags = new_flags; out: if (error == -ENOMEM) error = -EAGAIN; return error; } ",0 "const char* RendererSchedulerImpl::TimeDomainTypeToString( TimeDomainType domain_type) { switch (domain_type) { case TimeDomainType::kReal: return ""real""; case TimeDomainType::kThrottled: return ""throttled""; case TimeDomainType::kVirtual: return ""virtual""; default: NOTREACHED(); return nullptr; } } ",0 "TabContents* PrintPreviewHandler::preview_tab_contents() const { return TabContents::FromWebContents(preview_web_contents()); } ",0 "ProcPolyFillArc(ClientPtr client) { int narcs; GC *pGC; DrawablePtr pDraw; REQUEST(xPolyFillArcReq); REQUEST_AT_LEAST_SIZE(xPolyFillArcReq); VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); narcs = (client->req_len << 2) - sizeof(xPolyFillArcReq); if (narcs % sizeof(xArc)) return BadLength; narcs /= sizeof(xArc); if (narcs) (*pGC->ops->PolyFillArc) (pDraw, pGC, narcs, (xArc *) &stuff[1]); return Success; } ",0 "static unsigned long change_prot_numa(struct vm_area_struct *vma, unsigned long addr, unsigned long end) { return 0; } ",0 "bool TestLifecycleUnit::CanPurge() const { return false; } ",0 "Status _xvmc_destroy_subpicture( Display *dpy, XvMCSubpicture *subpicture ) { XExtDisplayInfo *info = xvmc_find_display(dpy); xvmcDestroySubpictureReq *req; XvMCCheckExtension (dpy, info, BadImplementation); LockDisplay (dpy); XvMCGetReq (DestroySubpicture, req); req->subpicture_id = subpicture->subpicture_id; UnlockDisplay (dpy); SyncHandle (); return Success; } ",0 "void initServer(void) { int j; signal(SIGHUP, SIG_IGN); signal(SIGPIPE, SIG_IGN); setupSignalHandlers(); if (server.syslog_enabled) { openlog(server.syslog_ident, LOG_PID | LOG_NDELAY | LOG_NOWAIT, server.syslog_facility); } server.pid = getpid(); server.current_client = NULL; server.clients = listCreate(); server.clients_to_close = listCreate(); server.slaves = listCreate(); server.monitors = listCreate(); server.clients_pending_write = listCreate(); server.slaveseldb = -1; /* Force to emit the first SELECT command. */ server.unblocked_clients = listCreate(); server.ready_keys = listCreate(); server.clients_waiting_acks = listCreate(); server.get_ack_from_slaves = 0; server.clients_paused = 0; server.system_memory_size = zmalloc_get_memory_size(); createSharedObjects(); adjustOpenFilesLimit(); server.el = aeCreateEventLoop(server.maxclients+CONFIG_FDSET_INCR); server.db = zmalloc(sizeof(redisDb)*server.dbnum); /* Open the TCP listening socket for the user commands. */ if (server.port != 0 && listenToPort(server.port,server.ipfd,&server.ipfd_count) == C_ERR) exit(1); /* Open the listening Unix domain socket. */ if (server.unixsocket != NULL) { unlink(server.unixsocket); /* don't care if this fails */ server.sofd = anetUnixServer(server.neterr,server.unixsocket, server.unixsocketperm, server.tcp_backlog); if (server.sofd == ANET_ERR) { serverLog(LL_WARNING, ""Opening Unix socket: %s"", server.neterr); exit(1); } anetNonBlock(NULL,server.sofd); } /* Abort if there are no listening sockets at all. */ if (server.ipfd_count == 0 && server.sofd < 0) { serverLog(LL_WARNING, ""Configured to not listen anywhere, exiting.""); exit(1); } /* Create the Redis databases, and initialize other internal state. */ for (j = 0; j < server.dbnum; j++) { server.db[j].dict = dictCreate(&dbDictType,NULL); server.db[j].expires = dictCreate(&keyptrDictType,NULL); server.db[j].blocking_keys = dictCreate(&keylistDictType,NULL); server.db[j].ready_keys = dictCreate(&setDictType,NULL); server.db[j].watched_keys = dictCreate(&keylistDictType,NULL); server.db[j].eviction_pool = evictionPoolAlloc(); server.db[j].id = j; server.db[j].avg_ttl = 0; } server.pubsub_channels = dictCreate(&keylistDictType,NULL); server.pubsub_patterns = listCreate(); listSetFreeMethod(server.pubsub_patterns,freePubsubPattern); listSetMatchMethod(server.pubsub_patterns,listMatchPubsubPattern); server.cronloops = 0; server.rdb_child_pid = -1; server.aof_child_pid = -1; server.rdb_child_type = RDB_CHILD_TYPE_NONE; server.rdb_bgsave_scheduled = 0; aofRewriteBufferReset(); server.aof_buf = sdsempty(); server.lastsave = time(NULL); /* At startup we consider the DB saved. */ server.lastbgsave_try = 0; /* At startup we never tried to BGSAVE. */ server.rdb_save_time_last = -1; server.rdb_save_time_start = -1; server.dirty = 0; resetServerStats(); /* A few stats we don't want to reset: server startup time, and peak mem. */ server.stat_starttime = time(NULL); server.stat_peak_memory = 0; server.resident_set_size = 0; server.lastbgsave_status = C_OK; server.aof_last_write_status = C_OK; server.aof_last_write_errno = 0; server.repl_good_slaves_count = 0; updateCachedTime(); /* Create the serverCron() time event, that's our main way to process * background operations. */ if(aeCreateTimeEvent(server.el, 1, serverCron, NULL, NULL) == AE_ERR) { serverPanic(""Can't create the serverCron time event.""); exit(1); } /* Create an event handler for accepting new connections in TCP and Unix * domain sockets. */ for (j = 0; j < server.ipfd_count; j++) { if (aeCreateFileEvent(server.el, server.ipfd[j], AE_READABLE, acceptTcpHandler,NULL) == AE_ERR) { serverPanic( ""Unrecoverable error creating server.ipfd file event.""); } } if (server.sofd > 0 && aeCreateFileEvent(server.el,server.sofd,AE_READABLE, acceptUnixHandler,NULL) == AE_ERR) serverPanic(""Unrecoverable error creating server.sofd file event.""); /* Open the AOF file if needed. */ if (server.aof_state == AOF_ON) { server.aof_fd = open(server.aof_filename, O_WRONLY|O_APPEND|O_CREAT,0644); if (server.aof_fd == -1) { serverLog(LL_WARNING, ""Can't open the append-only file: %s"", strerror(errno)); exit(1); } } /* 32 bit instances are limited to 4GB of address space, so if there is * no explicit limit in the user provided configuration we set a limit * at 3 GB using maxmemory with 'noeviction' policy'. This avoids * useless crashes of the Redis instance for out of memory. */ if (server.arch_bits == 32 && server.maxmemory == 0) { serverLog(LL_WARNING,""Warning: 32 bit instance detected but no memory limit set. Setting 3 GB maxmemory limit with 'noeviction' policy now.""); server.maxmemory = 3072LL*(1024*1024); /* 3 GB */ server.maxmemory_policy = MAXMEMORY_NO_EVICTION; } if (server.cluster_enabled) clusterInit(); replicationScriptCacheInit(); scriptingInit(1); slowlogInit(); latencyMonitorInit(); bioInit(); } ",0 "void VerifySubmitFormUkm(const ukm::TestAutoSetUkmRecorder& ukm_recorder, const FormData& form, AutofillMetrics::AutofillFormSubmittedState state, bool is_for_credit_card, const std::set& form_types) { VerifyFormInteractionUkm( ukm_recorder, form, UkmFormSubmittedType::kEntryName, {{{UkmFormSubmittedType::kAutofillFormSubmittedStateName, state}, {UkmSuggestionFilledType::kMillisecondsSinceFormParsedName, 0}, {UkmFormSubmittedType::kIsForCreditCardName, is_for_credit_card}, {UkmFormSubmittedType::kFormTypesName, AutofillMetrics::FormTypesToBitVector(form_types)}, {UkmFormSubmittedType::kFormSignatureName, Collapse(CalculateFormSignature(form))}}}); } ",0 "void ResourceMessageFilter::OnGetScreenInfo(gfx::NativeViewId view, IPC::Message* reply_msg) { ChromeThread::PostTask( ChromeThread::BACKGROUND_X11, FROM_HERE, NewRunnableMethod( this, &ResourceMessageFilter::DoOnGetScreenInfo, view, reply_msg)); } ",0 " PageSerializerTest() : m_folder(WebString::fromUTF8(""pageserializer/"")) , m_baseUrl(toKURL(""http://www.test.com"")) { } ",0 "void InputHandler::sendLearnTextDetails(const WTF::String& string) { Vector wcharString; if (!convertStringToWcharVector(string, wcharString) || wcharString.isEmpty()) return; m_webPage->m_client->inputLearnText(wcharString.data(), wcharString.size()); } ",0 "insertEmphasisEnd(const EmphasisInfo *buffer, const int at, const EmphRuleNumber emphRule, const EmphasisClass class, const TranslationTableHeader *table, int pos, const InString *input, OutString *output, int *posMapping, int *cursorPosition, int *cursorStatus) { if (buffer[at].end & class) { const TranslationTableRule *indicRule; if (buffer[at].word & class) { if (brailleIndicatorDefined( table->emphRules[emphRule][endWordOffset], table, &indicRule)) for_updatePositions(&indicRule->charsdots[0], 0, indicRule->dotslen, -1, pos, input, output, posMapping, cursorPosition, cursorStatus); } else { if (brailleIndicatorDefined( table->emphRules[emphRule][endOffset], table, &indicRule)) for_updatePositions(&indicRule->charsdots[0], 0, indicRule->dotslen, -1, pos, input, output, posMapping, cursorPosition, cursorStatus); else if (brailleIndicatorDefined( table->emphRules[emphRule][endPhraseAfterOffset], table, &indicRule)) for_updatePositions(&indicRule->charsdots[0], 0, indicRule->dotslen, -1, pos, input, output, posMapping, cursorPosition, cursorStatus); else if (brailleIndicatorDefined( table->emphRules[emphRule][endPhraseBeforeOffset], table, &indicRule)) for_updatePositions(&indicRule->charsdots[0], 0, indicRule->dotslen, 0, pos, input, output, posMapping, cursorPosition, cursorStatus); } } } ",0 "bool BrowserPpapiHostImpl::IsPotentiallySecurePluginContext( PP_Instance instance) { auto it = instance_map_.find(instance); if (it == instance_map_.end()) return false; return it->second->renderer_data.is_potentially_secure_plugin_context; } ",0 "SPL_METHOD(DirectoryIterator, getBasename) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); char *suffix = 0, *fname; int slen = 0; size_t flen; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""|s"", &suffix, &slen) == FAILURE) { return; } php_basename(intern->u.dir.entry.d_name, strlen(intern->u.dir.entry.d_name), suffix, slen, &fname, &flen TSRMLS_CC); RETURN_STRINGL(fname, flen, 0); } ",1 "gfx::Insets BrowserActionButton::GetInsets() const { static gfx::Insets zero_inset; return zero_inset; } ",0 "void OmniboxViewViews::Update() { const ToolbarModel::SecurityLevel old_security_level = security_level_; security_level_ = controller()->GetToolbarModel()->GetSecurityLevel(false); if (model()->UpdatePermanentText()) { controller()->GetToolbarModel()->set_url_replacement_enabled(true); model()->UpdatePermanentText(); const gfx::Range range(GetSelectedRange()); const bool was_select_all = (range.length() == text().length()); RevertAll(); if (was_select_all && model()->has_focus()) SelectAll(range.is_reversed()); } else if (old_security_level != security_level_) { EmphasizeURLComponents(); } } ",0 "bool GpuProcessHost::LaunchGpuProcess(const std::string& channel_id) { if (!(gpu_enabled_ && GpuDataManagerImpl::GetInstance()->ShouldUseSoftwareRendering()) && !hardware_gpu_enabled_) { SendOutstandingReplies(); return false; } const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); CommandLine::StringType gpu_launcher = browser_command_line.GetSwitchValueNative(switches::kGpuLauncher); #if defined(OS_LINUX) int child_flags = gpu_launcher.empty() ? ChildProcessHost::CHILD_ALLOW_SELF : ChildProcessHost::CHILD_NORMAL; #else int child_flags = ChildProcessHost::CHILD_NORMAL; #endif FilePath exe_path = ChildProcessHost::GetChildPath(child_flags); if (exe_path.empty()) return false; CommandLine* cmd_line = new CommandLine(exe_path); cmd_line->AppendSwitchASCII(switches::kProcessType, switches::kGpuProcess); cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id); if (kind_ == GPU_PROCESS_KIND_UNSANDBOXED) cmd_line->AppendSwitch(switches::kDisableGpuSandbox); static const char* const kSwitchNames[] = { switches::kDisableBreakpad, switches::kDisableGLMultisampling, switches::kDisableGpuDriverBugWorkarounds, switches::kDisableGpuSandbox, switches::kReduceGpuSandbox, switches::kDisableGpuVsync, switches::kDisableGpuWatchdog, switches::kDisableImageTransportSurface, switches::kDisableLogging, switches::kEnableLogging, #if defined(OS_MACOSX) switches::kEnableSandboxLogging, #endif switches::kGpuNoContextLost, switches::kGpuStartupDialog, switches::kLoggingLevel, switches::kNoSandbox, switches::kTestGLLib, switches::kTraceStartup, switches::kV, switches::kVModule, }; cmd_line->CopySwitchesFrom(browser_command_line, kSwitchNames, arraysize(kSwitchNames)); cmd_line->CopySwitchesFrom( browser_command_line, switches::kGpuSwitches, switches::kNumGpuSwitches); content::GetContentClient()->browser()->AppendExtraCommandLineSwitches( cmd_line, process_->GetData().id); GpuDataManagerImpl::GetInstance()->AppendGpuCommandLine(cmd_line); if (cmd_line->HasSwitch(switches::kUseGL)) software_rendering_ = (cmd_line->GetSwitchValueASCII(switches::kUseGL) == ""swiftshader""); UMA_HISTOGRAM_BOOLEAN(""GPU.GPUProcessSoftwareRendering"", software_rendering_); if (!gpu_launcher.empty()) cmd_line->PrependWrapper(gpu_launcher); process_->Launch( #if defined(OS_WIN) FilePath(), #elif defined(OS_POSIX) false, // Never use the zygote (GPU plugin can't be sandboxed). base::EnvironmentVector(), #endif cmd_line); process_launched_ = true; UMA_HISTOGRAM_ENUMERATION(""GPU.GPUProcessLifetimeEvents"", LAUNCHED, GPU_PROCESS_LIFETIME_EVENT_MAX); return true; } ",0 "static inline int l2cap_check_security(struct sock *sk) { struct l2cap_conn *conn = l2cap_pi(sk)->conn; __u8 auth_type; if (l2cap_pi(sk)->psm == cpu_to_le16(0x0001)) { if (l2cap_pi(sk)->sec_level == BT_SECURITY_HIGH) auth_type = HCI_AT_NO_BONDING_MITM; else auth_type = HCI_AT_NO_BONDING; if (l2cap_pi(sk)->sec_level == BT_SECURITY_LOW) l2cap_pi(sk)->sec_level = BT_SECURITY_SDP; } else { switch (l2cap_pi(sk)->sec_level) { case BT_SECURITY_HIGH: auth_type = HCI_AT_GENERAL_BONDING_MITM; break; case BT_SECURITY_MEDIUM: auth_type = HCI_AT_GENERAL_BONDING; break; default: auth_type = HCI_AT_NO_BONDING; break; } } return hci_conn_security(conn->hcon, l2cap_pi(sk)->sec_level, auth_type); } ",0 "void RenderProcessHostImpl::OnGpuSwitched() { RecomputeAndUpdateWebKitPreferences(); } ",0 "bool isAllowedByAll(const CSPDirectiveListVector& policies, const KURL& url, RedirectStatus redirectStatus, SecurityViolationReportingPolicy reportingPolicy) { if (ContentSecurityPolicy::shouldBypassContentSecurityPolicy(url)) return true; bool isAllowed = true; for (const auto& policy : policies) { isAllowed &= (policy.get()->*allowFromURL)(url, redirectStatus, reportingPolicy); } return isAllowed; } ",0 "writeRandomBytes_getrandom_nonblock(void *target, size_t count) { int success = 0; /* full count bytes written? */ size_t bytesWrittenTotal = 0; const unsigned int getrandomFlags = GRND_NONBLOCK; do { void *const currentTarget = (void *)((char *)target + bytesWrittenTotal); const size_t bytesToWrite = count - bytesWrittenTotal; const int bytesWrittenMore = # if defined(HAVE_GETRANDOM) getrandom(currentTarget, bytesToWrite, getrandomFlags); # else syscall(SYS_getrandom, currentTarget, bytesToWrite, getrandomFlags); # endif if (bytesWrittenMore > 0) { bytesWrittenTotal += bytesWrittenMore; if (bytesWrittenTotal >= count) success = 1; } } while (! success && (errno == EINTR)); return success; } ",0 "static Bool get_time_list(char *arg, u32 *times, u32 *nb_times) { char *str; Float var; Double sec; u32 h, m, s, ms, f, fps; if (!arg || (arg[0]=='-') || !isdigit(arg[0])) return 0; /*SMPTE time code*/ if (strchr(arg, ':') && strchr(arg, ';') && strchr(arg, '/')) { if (sscanf(arg, ""%02ud:%02ud:%02ud;%02ud/%02ud"", &h, &m, &s, &f, &fps)==5) { sec = 0; if (fps) sec = ((Double)f) / fps; sec += 3600*h + 60*m + s; times[*nb_times] = (u32) (1000*sec); (*nb_times) ++; return 1; } } while (arg) { str = strchr(arg, '-'); if (str) str[0] = 0; /*HH:MM:SS:MS time code*/ if (strchr(arg, ':') && (sscanf(arg, ""%u:%u:%u:%u"", &h, &m, &s, &ms)==4)) { sec = ms; sec /= 1000; sec += 3600*h + 60*m + s; times[*nb_times] = (u32) (1000*sec); (*nb_times) ++; } else if (sscanf(arg, ""%f"", &var)==1) { sec = atof(arg); times[*nb_times] = (u32) (1000*sec); (*nb_times) ++; } if (!str) break; str[0] = '-'; arg = str+1; } return 1; } ",0 "static void edge_disconnect(struct usb_serial *serial) { struct edgeport_serial *edge_serial = usb_get_serial_data(serial); cancel_delayed_work_sync(&edge_serial->heartbeat_work); } ",0 "void AwContents::InitAutofillIfNecessary(bool enabled) { if (!enabled) return; content::WebContents* web_contents = web_contents_.get(); if (ContentAutofillDriverFactory::FromWebContents(web_contents)) return; AwAutofillClient::CreateForWebContents(web_contents); ContentAutofillDriverFactory::CreateForWebContentsAndDelegate( web_contents, AwAutofillClient::FromWebContents(web_contents), base::android::GetDefaultLocale(), AutofillManager::DISABLE_AUTOFILL_DOWNLOAD_MANAGER); } ",0 "static int cac_read_binary(sc_card_t *card, unsigned int idx, unsigned char *buf, size_t count, unsigned long flags) { cac_private_data_t * priv = CAC_DATA(card); int r = 0; u8 *tl = NULL, *val = NULL; u8 *tl_ptr, *val_ptr, *tlv_ptr, *tl_start; u8 *cert_ptr; size_t tl_len, val_len, tlv_len; size_t len, tl_head_len, cert_len; u8 cert_type, tag; SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE); /* if we didn't return it all last time, return the remainder */ if (priv->cached) { sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, ""returning cached value idx=%d count=%""SC_FORMAT_LEN_SIZE_T""u"", idx, count); if (idx > priv->cache_buf_len) { SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_NORMAL, SC_ERROR_FILE_END_REACHED); } len = MIN(count, priv->cache_buf_len-idx); memcpy(buf, &priv->cache_buf[idx], len); SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_NORMAL, len); } sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, ""clearing cache idx=%d count=%""SC_FORMAT_LEN_SIZE_T""u"", idx, count); if (priv->cache_buf) { free(priv->cache_buf); priv->cache_buf = NULL; priv->cache_buf_len = 0; } if (priv->object_type <= 0) SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_NORMAL, SC_ERROR_INTERNAL); r = cac_read_file(card, CAC_FILE_TAG, &tl, &tl_len); if (r < 0) { goto done; } r = cac_read_file(card, CAC_FILE_VALUE, &val, &val_len); if (r < 0) goto done; switch (priv->object_type) { case CAC_OBJECT_TYPE_TLV_FILE: tlv_len = tl_len + val_len; priv->cache_buf = malloc(tlv_len); if (priv->cache_buf == NULL) { r = SC_ERROR_OUT_OF_MEMORY; goto done; } priv->cache_buf_len = tlv_len; for (tl_ptr = tl, val_ptr=val, tlv_ptr = priv->cache_buf; tl_len >= 2 && tlv_len > 0; val_len -= len, tlv_len -= len, val_ptr += len, tlv_ptr += len) { /* get the tag and the length */ tl_start = tl_ptr; if (sc_simpletlv_read_tag(&tl_ptr, tl_len, &tag, &len) != SC_SUCCESS) break; tl_head_len = (tl_ptr - tl_start); sc_simpletlv_put_tag(tag, len, tlv_ptr, tlv_len, &tlv_ptr); tlv_len -= tl_head_len; tl_len -= tl_head_len; /* don't crash on bad data */ if (val_len < len) { len = val_len; } /* if we run out of return space, truncate */ if (tlv_len < len) { len = tlv_len; } memcpy(tlv_ptr, val_ptr, len); } break; case CAC_OBJECT_TYPE_CERT: /* read file */ sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, "" obj= cert_file, val_len=%""SC_FORMAT_LEN_SIZE_T""u (0x%04""SC_FORMAT_LEN_SIZE_T""x)"", val_len, val_len); cert_len = 0; cert_ptr = NULL; cert_type = 0; for (tl_ptr = tl, val_ptr = val; tl_len >= 2; val_len -= len, val_ptr += len, tl_len -= tl_head_len) { tl_start = tl_ptr; if (sc_simpletlv_read_tag(&tl_ptr, tl_len, &tag, &len) != SC_SUCCESS) break; tl_head_len = tl_ptr - tl_start; /* incomplete value */ if (val_len < len) break; if (tag == CAC_TAG_CERTIFICATE) { cert_len = len; cert_ptr = val_ptr; } if (tag == CAC_TAG_CERTINFO) { if ((len >= 1) && (val_len >=1)) { cert_type = *val_ptr; } } if (tag == CAC_TAG_MSCUID) { sc_log_hex(card->ctx, ""MSCUID"", val_ptr, len); } if ((val_len < len) || (tl_len < tl_head_len)) { break; } } /* if the info byte is 1, then the cert is compressed, decompress it */ if ((cert_type & 0x3) == 1) { #ifdef ENABLE_ZLIB r = sc_decompress_alloc(&priv->cache_buf, &priv->cache_buf_len, cert_ptr, cert_len, COMPRESSION_AUTO); #else sc_log(card->ctx, ""CAC compression not supported, no zlib""); r = SC_ERROR_NOT_SUPPORTED; #endif if (r) goto done; } else if (cert_len > 0) { priv->cache_buf = malloc(cert_len); if (priv->cache_buf == NULL) { r = SC_ERROR_OUT_OF_MEMORY; goto done; } priv->cache_buf_len = cert_len; memcpy(priv->cache_buf, cert_ptr, cert_len); } else { sc_log(card->ctx, ""Can't read zero-length certificate""); goto done; } break; case CAC_OBJECT_TYPE_GENERIC: /* TODO * We have some two buffers in unknown encoding that we * need to present in PKCS#15 layer. */ default: /* Unknown object type */ sc_log(card->ctx, ""Unknown object type: %x"", priv->object_type); r = SC_ERROR_INTERNAL; goto done; } /* OK we've read the data, now copy the required portion out to the callers buffer */ priv->cached = 1; len = MIN(count, priv->cache_buf_len-idx); memcpy(buf, &priv->cache_buf[idx], len); r = len; done: if (tl) free(tl); if (val) free(val); SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_NORMAL, r); } ",0 "scoped_refptr WebGLRenderingContextBase::GetImage( AccelerationHint hint, SnapshotReason reason) const { if (!GetDrawingBuffer()) return nullptr; if (IsMainThread()) { GetDrawingBuffer()->ResolveAndBindForReadAndDraw(); IntSize size = ClampedCanvasSize(); std::unique_ptr surface = std::make_unique(size, ColorParams()); if (!surface->IsValid()) return nullptr; std::unique_ptr buffer = ImageBuffer::Create(std::move(surface)); if (!buffer->CopyRenderingResultsFromDrawingBuffer(GetDrawingBuffer(), kBackBuffer)) { NOTREACHED(); return nullptr; } return buffer->NewImageSnapshot(hint, reason); } int width = GetDrawingBuffer()->Size().Width(); int height = GetDrawingBuffer()->Size().Height(); SkImageInfo image_info = SkImageInfo::Make( width, height, kRGBA_8888_SkColorType, CreationAttributes().alpha() ? kPremul_SkAlphaType : kOpaque_SkAlphaType); return this->MakeImageSnapshot(image_info); } ",0 "static void __exit usbtest_exit(void) { usb_deregister(&usbtest_driver); } ",0 "bool HTMLInputElement::ReceiveDroppedFiles(const DragData* drag_data) { return input_type_->ReceiveDroppedFiles(drag_data); } ",0 "bool ChildProcessSecurityPolicyImpl::CanCreateReadWriteFile( int child_id, const base::FilePath& file) { return HasPermissionsForFile(child_id, file, CREATE_READ_WRITE_FILE_GRANT); } ",0 "void Document::SetAutofocusElement(Element* element) { if (!element) { autofocus_element_ = nullptr; return; } if (has_autofocused_) return; has_autofocused_ = true; DCHECK(!autofocus_element_); autofocus_element_ = element; TaskRunnerHelper::Get(TaskType::kUserInteraction, this) ->PostTask(BLINK_FROM_HERE, WTF::Bind(&RunAutofocusTask, WrapWeakPersistent(this))); } ",0 " StateBase* writeBlob(v8::Handle value, StateBase* next) { Blob* blob = V8Blob::toNative(value.As()); if (!blob) return 0; if (blob->hasBeenClosed()) return handleError(DataCloneError, ""A Blob object has been closed, and could therefore not be cloned."", next); int blobIndex = -1; m_blobDataHandles.add(blob->uuid(), blob->blobDataHandle()); if (appendBlobInfo(blob->uuid(), blob->type(), blob->size(), &blobIndex)) m_writer.writeBlobIndex(blobIndex); else m_writer.writeBlob(blob->uuid(), blob->type(), blob->size()); return 0; } ",1 "const char16_t* Parcel::readString16Inplace(size_t* outLen) const { int32_t size = readInt32(); if (size >= 0 && size < INT32_MAX) { *outLen = size; const char16_t* str = (const char16_t*)readInplace((size+1)*sizeof(char16_t)); if (str != NULL) { return str; } } *outLen = 0; return NULL; } ",0 "void CLASS ppg_interpolate() { int dir[5] = { 1, width, -1, -width, 1 }; int row, col, diff[2], guess[2], c, d, i; ushort (*pix)[4]; border_interpolate(3); dcraw_message (DCRAW_VERBOSE,_(""PPG interpolation...\n"")); /* Fill in the green layer with gradients and pattern recognition: */ for (row=3; row < height-3; row++) for (col=3+(FC(row,3) & 1), c=FC(row,col); col < width-3; col+=2) { pix = image + row*width+col; for (i=0; (d=dir[i]) > 0; i++) { guess[i] = (pix[-d][1] + pix[0][c] + pix[d][1]) * 2 - pix[-2*d][c] - pix[2*d][c]; diff[i] = ( ABS(pix[-2*d][c] - pix[ 0][c]) + ABS(pix[ 2*d][c] - pix[ 0][c]) + ABS(pix[ -d][1] - pix[ d][1]) ) * 3 + ( ABS(pix[ 3*d][1] - pix[ d][1]) + ABS(pix[-3*d][1] - pix[-d][1]) ) * 2; } d = dir[i = diff[0] > diff[1]]; pix[0][1] = ULIM(guess[i] >> 2, pix[d][1], pix[-d][1]); } /* Calculate red and blue for each green pixel: */ for (row=1; row < height-1; row++) for (col=1+(FC(row,2) & 1), c=FC(row,col+1); col < width-1; col+=2) { pix = image + row*width+col; for (i=0; (d=dir[i]) > 0; c=2-c, i++) pix[0][c] = CLIP((pix[-d][c] + pix[d][c] + 2*pix[0][1] - pix[-d][1] - pix[d][1]) >> 1); } /* Calculate blue for red pixels and vice versa: */ for (row=1; row < height-1; row++) for (col=1+(FC(row,1) & 1), c=2-FC(row,col); col < width-1; col+=2) { pix = image + row*width+col; for (i=0; (d=dir[i]+dir[i+1]) > 0; i++) { diff[i] = ABS(pix[-d][c] - pix[d][c]) + ABS(pix[-d][1] - pix[0][1]) + ABS(pix[ d][1] - pix[0][1]); guess[i] = pix[-d][c] + pix[d][c] + 2*pix[0][1] - pix[-d][1] - pix[d][1]; } if (diff[0] != diff[1]) pix[0][c] = CLIP(guess[diff[0] > diff[1]] >> 1); else pix[0][c] = CLIP((guess[0]+guess[1]) >> 2); } } ",0 "static ssize_t order_show(struct kmem_cache *s, char *buf) { return sprintf(buf, ""%d\n"", oo_order(s->oo)); } ",0 "static void seq_chn_voice_event(unsigned char *event_rec) { #define dev event_rec[1] #define cmd event_rec[2] #define chn event_rec[3] #define note event_rec[4] #define parm event_rec[5] int voice = -1; if ((int) dev > max_synthdev || synth_devs[dev] == NULL) return; if (!(synth_open_mask & (1 << dev))) return; if (!synth_devs[dev]) return; if (seq_mode == SEQ_2) { if (synth_devs[dev]->alloc_voice) voice = find_voice(dev, chn, note); if (cmd == MIDI_NOTEON && parm == 0) { cmd = MIDI_NOTEOFF; parm = 64; } } switch (cmd) { case MIDI_NOTEON: if (note > 127 && note != 255) /* Not a seq2 feature */ return; if (voice == -1 && seq_mode == SEQ_2 && synth_devs[dev]->alloc_voice) { /* Internal synthesizer (FM, GUS, etc) */ voice = alloc_voice(dev, chn, note); } if (voice == -1) voice = chn; if (seq_mode == SEQ_2 && (int) dev < num_synths) { /* * The MIDI channel 10 is a percussive channel. Use the note * number to select the proper patch (128 to 255) to play. */ if (chn == 9) { synth_devs[dev]->set_instr(dev, voice, 128 + note); synth_devs[dev]->chn_info[chn].pgm_num = 128 + note; } synth_devs[dev]->setup_voice(dev, voice, chn); } synth_devs[dev]->start_note(dev, voice, note, parm); break; case MIDI_NOTEOFF: if (voice == -1) voice = chn; synth_devs[dev]->kill_note(dev, voice, note, parm); break; case MIDI_KEY_PRESSURE: if (voice == -1) voice = chn; synth_devs[dev]->aftertouch(dev, voice, parm); break; default:; } #undef dev #undef cmd #undef chn #undef note #undef parm } ",0 "void OmniboxEditModel::OnUpOrDownKeyPressed(int count) { if (popup_model() && popup_model()->IsOpen()) { popup_model()->Move(count); return; } if (!query_in_progress()) { if (!user_input_in_progress_) InternalSetUserText(permanent_text_); view_->UpdatePopup(); return; } } ",0 "inf_gtk_certificate_manager_notify_status_cb(GObject* object, GParamSpec* pspec, gpointer user_data) { InfGtkCertificateManagerQuery* query; InfGtkCertificateManagerPrivate* priv; InfXmppConnection* connection; InfXmlConnectionStatus status; query = (InfGtkCertificateManagerQuery*)user_data; priv = INF_GTK_CERTIFICATE_MANAGER_PRIVATE(query->manager); connection = INF_XMPP_CONNECTION(object); g_object_get(G_OBJECT(connection), ""status"", &status, NULL); if(status == INF_XML_CONNECTION_CLOSING || status == INF_XML_CONNECTION_CLOSED) { priv->queries = g_slist_remove(priv->queries, query); inf_gtk_certificate_manager_query_free(query); } } ",0 "void Camera3Device::RequestThread::setErrorState(const char *fmt, ...) { sp parent = mParent.promote(); if (parent != NULL) { va_list args; va_start(args, fmt); parent->setErrorStateV(fmt, args); va_end(args); } } ",0 "void WebPageProxy::didFailToFindString(const String& string) { m_findClient.didFailToFindString(this, string); } ",0 "PHP_FUNCTION(openssl_public_encrypt) { zval **key, *crypted; EVP_PKEY *pkey; int cryptedlen; unsigned char *cryptedbuf; int successful = 0; long keyresource = -1; long padding = RSA_PKCS1_PADDING; char * data; int data_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""szZ|l"", &data, &data_len, &crypted, &key, &padding) == FAILURE) return; RETVAL_FALSE; pkey = php_openssl_evp_from_zval(key, 1, NULL, 0, &keyresource TSRMLS_CC); if (pkey == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""key parameter is not a valid public key""); RETURN_FALSE; } cryptedlen = EVP_PKEY_size(pkey); cryptedbuf = emalloc(cryptedlen + 1); switch (pkey->type) { case EVP_PKEY_RSA: case EVP_PKEY_RSA2: successful = (RSA_public_encrypt(data_len, (unsigned char *)data, cryptedbuf, pkey->pkey.rsa, padding) == cryptedlen); break; default: php_error_docref(NULL TSRMLS_CC, E_WARNING, ""key type not supported in this PHP build!""); } if (successful) { zval_dtor(crypted); cryptedbuf[cryptedlen] = '\0'; ZVAL_STRINGL(crypted, (char *)cryptedbuf, cryptedlen, 0); cryptedbuf = NULL; RETVAL_TRUE; } if (keyresource == -1) { EVP_PKEY_free(pkey); } if (cryptedbuf) { efree(cryptedbuf); } } ",0 "bool WebGL2RenderingContextBase::ValidateUniformBlockIndex( const char* function_name, WebGLProgram* program, GLuint block_index) { DCHECK(program); if (!program->LinkStatus(this)) { SynthesizeGLError(GL_INVALID_OPERATION, function_name, ""program not linked""); return false; } GLint active_uniform_blocks = 0; ContextGL()->GetProgramiv(ObjectOrZero(program), GL_ACTIVE_UNIFORM_BLOCKS, &active_uniform_blocks); if (block_index >= static_cast(active_uniform_blocks)) { SynthesizeGLError(GL_INVALID_VALUE, function_name, ""invalid uniform block index""); return false; } return true; } ",0 "int BrowserWindowGtk::GetExtraRenderViewHeight() const { int sum = infobar_container_->TotalHeightOfAnimatingBars(); if (IsBookmarkBarSupported() && bookmark_bar_->IsAnimating()) sum += bookmark_bar_->GetHeight(); if (download_shelf_.get() && download_shelf_->IsClosing()) sum += download_shelf_->GetHeight(); return sum; } ",0 "DesktopWindowTreeHostX11::DesktopWindowTreeHostX11( internal::NativeWidgetDelegate* native_widget_delegate, DesktopNativeWidgetAura* desktop_native_widget_aura) : xdisplay_(gfx::GetXDisplay()), x_root_window_(DefaultRootWindow(xdisplay_)), native_widget_delegate_(native_widget_delegate), desktop_native_widget_aura_(desktop_native_widget_aura) {} ",0 "void ProfileSyncService::SetEncryptionPassphrase(const std::string& passphrase, PassphraseType type) { DCHECK(sync_initialized()); DCHECK(!(type == IMPLICIT && IsUsingSecondaryPassphrase())) << ""Data is already encrypted using an explicit passphrase""; DCHECK(!(type == EXPLICIT && IsPassphraseRequired())) << ""Cannot switch to an explicit passphrase if a passphrase is required""; if (type == EXPLICIT) UMA_HISTOGRAM_BOOLEAN(""Sync.CustomPassphrase"", true); DVLOG(1) << ""Setting "" << (type == EXPLICIT ? ""explicit"" : ""implicit"") << "" passphrase for encryption.""; if (passphrase_required_reason_ == sync_api::REASON_ENCRYPTION) { passphrase_required_reason_ = sync_api::REASON_PASSPHRASE_NOT_REQUIRED; NotifyObservers(); } backend_->SetEncryptionPassphrase(passphrase, type == EXPLICIT); } ",0 "void AutofillPopupBaseView::OnMouseCaptureLost() { ClearSelection(); } ",0 "void ChromeRenderMessageFilter::OnExtensionRemoveListener( const std::string& extension_id, const std::string& event_name) { content::RenderProcessHost* process = content::RenderProcessHost::FromID(render_process_id_); if (!process || !profile_->GetExtensionEventRouter()) return; profile_->GetExtensionEventRouter()->RemoveEventListener( event_name, process, extension_id); } ",0 "static int dccp_nlattr_size(void) { return nla_total_size(0) /* CTA_PROTOINFO_DCCP */ + nla_policy_len(dccp_nla_policy, CTA_PROTOINFO_DCCP_MAX + 1); } ",0 "void WebPluginDelegateStub::OnUpdateGeometry( const PluginMsg_UpdateGeometry_Param& param) { webplugin_->UpdateGeometry( param.window_rect, param.clip_rect, param.windowless_buffer, param.background_buffer #if defined(OS_MACOSX) , param.ack_key #endif ); } ",0 "void RenderFrameHostImpl::ResetFeaturePolicy() { RenderFrameHostImpl* parent_frame_host = GetParent(); if (!parent_frame_host && !frame_tree_node_->current_replication_state() .opener_feature_state.empty()) { DCHECK(base::FeatureList::IsEnabled(features::kFeaturePolicyForSandbox)); feature_policy_ = blink::FeaturePolicy::CreateWithOpenerPolicy( frame_tree_node_->current_replication_state().opener_feature_state, last_committed_origin_); return; } const blink::FeaturePolicy* parent_policy = parent_frame_host ? parent_frame_host->feature_policy() : nullptr; blink::ParsedFeaturePolicy container_policy = frame_tree_node()->effective_frame_policy().container_policy; feature_policy_ = blink::FeaturePolicy::CreateFromParentPolicy( parent_policy, container_policy, last_committed_origin_); } ",0 "void PDFiumEngine::SelectAll() { SelectionChangeInvalidator selection_invalidator(this); selection_.clear(); for (const auto& page : pages_) { if (page->available()) selection_.push_back(PDFiumRange(page, 0, page->GetCharCount())); } } ",0 "base::FilePath ContentBrowserClient::GetDefaultDownloadDirectory() { return base::FilePath(); } ",0 "list_del_event(struct perf_event *event, struct perf_event_context *ctx) { struct perf_cpu_context *cpuctx; WARN_ON_ONCE(event->ctx != ctx); lockdep_assert_held(&ctx->lock); /* * We can have double detach due to exit/hot-unplug + close. */ if (!(event->attach_state & PERF_ATTACH_CONTEXT)) return; event->attach_state &= ~PERF_ATTACH_CONTEXT; if (is_cgroup_event(event)) { ctx->nr_cgroups--; cpuctx = __get_cpu_context(ctx); /* * if there are no more cgroup events * then cler cgrp to avoid stale pointer * in update_cgrp_time_from_cpuctx() */ if (!ctx->nr_cgroups) cpuctx->cgrp = NULL; } if (has_branch_stack(event)) ctx->nr_branch_stack--; ctx->nr_events--; if (event->attr.inherit_stat) ctx->nr_stat--; list_del_rcu(&event->event_entry); if (event->group_leader == event) list_del_init(&event->group_entry); update_group_times(event); /* * If event was in error state, then keep it * that way, otherwise bogus counts will be * returned on read(). The only way to get out * of error state is by explicit re-enabling * of the event */ if (event->state > PERF_EVENT_STATE_OFF) event->state = PERF_EVENT_STATE_OFF; ctx->generation++; } ",0 "set_times(struct archive_write_disk *a, int fd, int mode, const char *name, time_t atime, long atime_nanos, time_t birthtime, long birthtime_nanos, time_t mtime, long mtime_nanos, time_t cctime, long ctime_nanos) { /* Note: set_time doesn't use libarchive return conventions! * It uses syscall conventions. So 0 here instead of ARCHIVE_OK. */ int r1 = 0, r2 = 0; #ifdef F_SETTIMES /* * on Tru64 try own fcntl first which can restore even the * ctime, fall back to default code path below if it fails * or if we are not running as root */ if (a->user_uid == 0 && set_time_tru64(fd, mode, name, atime, atime_nanos, mtime, mtime_nanos, cctime, ctime_nanos) == 0) { return (ARCHIVE_OK); } #else /* Tru64 */ (void)cctime; /* UNUSED */ (void)ctime_nanos; /* UNUSED */ #endif /* Tru64 */ #ifdef HAVE_STRUCT_STAT_ST_BIRTHTIME /* * If you have struct stat.st_birthtime, we assume BSD * birthtime semantics, in which {f,l,}utimes() updates * birthtime to earliest mtime. So we set the time twice, * first using the birthtime, then using the mtime. If * birthtime == mtime, this isn't necessary, so we skip it. * If birthtime > mtime, then this won't work, so we skip it. */ if (birthtime < mtime || (birthtime == mtime && birthtime_nanos < mtime_nanos)) r1 = set_time(fd, mode, name, atime, atime_nanos, birthtime, birthtime_nanos); #else (void)birthtime; /* UNUSED */ (void)birthtime_nanos; /* UNUSED */ #endif r2 = set_time(fd, mode, name, atime, atime_nanos, mtime, mtime_nanos); if (r1 != 0 || r2 != 0) { archive_set_error(&a->archive, errno, ""Can't restore time""); return (ARCHIVE_WARN); } return (ARCHIVE_OK); } ",0 "static unsigned shmem_find_get_pages_and_swap(struct address_space *mapping, pgoff_t start, unsigned int nr_pages, struct page **pages, pgoff_t *indices) { void **slot; unsigned int ret = 0; struct radix_tree_iter iter; if (!nr_pages) return 0; rcu_read_lock(); restart: radix_tree_for_each_slot(slot, &mapping->page_tree, &iter, start) { struct page *page; repeat: page = radix_tree_deref_slot(slot); if (unlikely(!page)) continue; if (radix_tree_exception(page)) { if (radix_tree_deref_retry(page)) goto restart; /* * Otherwise, we must be storing a swap entry * here as an exceptional entry: so return it * without attempting to raise page count. */ goto export; } if (!page_cache_get_speculative(page)) goto repeat; /* Has the page moved? */ if (unlikely(page != *slot)) { page_cache_release(page); goto repeat; } export: indices[ret] = iter.index; pages[ret] = page; if (++ret == nr_pages) break; } rcu_read_unlock(); return ret; } ",0 "struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask, int flags, int node) { struct kmem_cache *cache; struct skb_shared_info *shinfo; struct sk_buff *skb; u8 *data; bool pfmemalloc; cache = (flags & SKB_ALLOC_FCLONE) ? skbuff_fclone_cache : skbuff_head_cache; if (sk_memalloc_socks() && (flags & SKB_ALLOC_RX)) gfp_mask |= __GFP_MEMALLOC; /* Get the HEAD */ skb = kmem_cache_alloc_node(cache, gfp_mask & ~__GFP_DMA, node); if (!skb) goto out; prefetchw(skb); /* We do our best to align skb_shared_info on a separate cache * line. It usually works because kmalloc(X > SMP_CACHE_BYTES) gives * aligned memory blocks, unless SLUB/SLAB debug is enabled. * Both skb->head and skb_shared_info are cache line aligned. */ size = SKB_DATA_ALIGN(size); size += SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); data = kmalloc_reserve(size, gfp_mask, node, &pfmemalloc); if (!data) goto nodata; /* kmalloc(size) might give us more room than requested. * Put skb_shared_info exactly at the end of allocated zone, * to allow max possible filling before reallocation. */ size = SKB_WITH_OVERHEAD(ksize(data)); prefetchw(data + size); /* * Only clear those fields we need to clear, not those that we will * actually initialise below. Hence, don't put any more fields after * the tail pointer in struct sk_buff! */ memset(skb, 0, offsetof(struct sk_buff, tail)); /* Account for allocated memory : skb + skb->head */ skb->truesize = SKB_TRUESIZE(size); skb->pfmemalloc = pfmemalloc; atomic_set(&skb->users, 1); skb->head = data; skb->data = data; skb_reset_tail_pointer(skb); skb->end = skb->tail + size; skb->mac_header = (typeof(skb->mac_header))~0U; skb->transport_header = (typeof(skb->transport_header))~0U; /* make sure we initialize shinfo sequentially */ shinfo = skb_shinfo(skb); memset(shinfo, 0, offsetof(struct skb_shared_info, dataref)); atomic_set(&shinfo->dataref, 1); kmemcheck_annotate_variable(shinfo->destructor_arg); if (flags & SKB_ALLOC_FCLONE) { struct sk_buff *child = skb + 1; atomic_t *fclone_ref = (atomic_t *) (child + 1); kmemcheck_annotate_bitfield(child, flags1); kmemcheck_annotate_bitfield(child, flags2); skb->fclone = SKB_FCLONE_ORIG; atomic_set(fclone_ref, 1); child->fclone = SKB_FCLONE_UNAVAILABLE; child->pfmemalloc = pfmemalloc; } out: return skb; nodata: kmem_cache_free(cache, skb); skb = NULL; goto out; } ",0 "static void complete_incr_bin(conn *c) { item *it; char *key; size_t nkey; /* Weird magic in add_delta forces me to pad here */ char tmpbuf[INCR_MAX_STORAGE_LEN]; uint64_t cas = 0; protocol_binary_response_incr* rsp = (protocol_binary_response_incr*)c->wbuf; protocol_binary_request_incr* req = binary_get_request(c); assert(c != NULL); assert(c->wsize >= sizeof(*rsp)); /* fix byteorder in the request */ req->message.body.delta = ntohll(req->message.body.delta); req->message.body.initial = ntohll(req->message.body.initial); req->message.body.expiration = ntohl(req->message.body.expiration); key = binary_get_key(c); nkey = c->binary_header.request.keylen; if (settings.verbose > 1) { int i; fprintf(stderr, ""incr ""); for (i = 0; i < nkey; i++) { fprintf(stderr, ""%c"", key[i]); } fprintf(stderr, "" %lld, %llu, %d\n"", (long long)req->message.body.delta, (long long)req->message.body.initial, req->message.body.expiration); } if (c->binary_header.request.cas != 0) { cas = c->binary_header.request.cas; } switch(add_delta(c, key, nkey, c->cmd == PROTOCOL_BINARY_CMD_INCREMENT, req->message.body.delta, tmpbuf, &cas)) { case OK: rsp->message.body.value = htonll(strtoull(tmpbuf, NULL, 10)); if (cas) { c->cas = cas; } write_bin_response(c, &rsp->message.body, 0, 0, sizeof(rsp->message.body.value)); break; case NON_NUMERIC: write_bin_error(c, PROTOCOL_BINARY_RESPONSE_DELTA_BADVAL, NULL, 0); break; case EOM: out_of_memory(c, ""SERVER_ERROR Out of memory incrementing value""); break; case DELTA_ITEM_NOT_FOUND: if (req->message.body.expiration != 0xffffffff) { /* Save some room for the response */ rsp->message.body.value = htonll(req->message.body.initial); snprintf(tmpbuf, INCR_MAX_STORAGE_LEN, ""%llu"", (unsigned long long)req->message.body.initial); int res = strlen(tmpbuf); it = item_alloc(key, nkey, 0, realtime(req->message.body.expiration), res + 2); if (it != NULL) { memcpy(ITEM_data(it), tmpbuf, res); memcpy(ITEM_data(it) + res, ""\r\n"", 2); if (store_item(it, NREAD_ADD, c)) { c->cas = ITEM_get_cas(it); write_bin_response(c, &rsp->message.body, 0, 0, sizeof(rsp->message.body.value)); } else { write_bin_error(c, PROTOCOL_BINARY_RESPONSE_NOT_STORED, NULL, 0); } item_remove(it); /* release our reference */ } else { out_of_memory(c, ""SERVER_ERROR Out of memory allocating new item""); } } else { pthread_mutex_lock(&c->thread->stats.mutex); if (c->cmd == PROTOCOL_BINARY_CMD_INCREMENT) { c->thread->stats.incr_misses++; } else { c->thread->stats.decr_misses++; } pthread_mutex_unlock(&c->thread->stats.mutex); write_bin_error(c, PROTOCOL_BINARY_RESPONSE_KEY_ENOENT, NULL, 0); } break; case DELTA_ITEM_CAS_MISMATCH: write_bin_error(c, PROTOCOL_BINARY_RESPONSE_KEY_EEXISTS, NULL, 0); break; } } ",0 "void FrameLoader::Init() { ScriptForbiddenScope forbid_scripts; ResourceRequest initial_request{KURL(g_empty_string)}; initial_request.SetRequestContext(WebURLRequest::kRequestContextInternal); initial_request.SetFrameType( frame_->IsMainFrame() ? network::mojom::RequestContextFrameType::kTopLevel : network::mojom::RequestContextFrameType::kNested); provisional_document_loader_ = Client()->CreateDocumentLoader(frame_, initial_request, SubstituteData(), ClientRedirectPolicy::kNotClientRedirect, base::UnguessableToken::Create()); provisional_document_loader_->StartLoading(); frame_->GetDocument()->CancelParsing(); state_machine_.AdvanceTo( FrameLoaderStateMachine::kDisplayingInitialEmptyDocument); document_loader_->SetSentDidFinishLoad(); if (frame_->GetPage()->Paused()) SetDefersLoading(true); TakeObjectSnapshot(); } ",0 "GBool JBIG2Stream::readByte(int *x) { int c0; if ((c0 = curStr->getChar()) == EOF) { return gFalse; } *x = c0; if (c0 & 0x80) { *x |= -1 - 0xff; } return gTrue; } ",0 "void RenderFrameDevToolsAgentHost::UpdateFrameHost( RenderFrameHostImpl* frame_host) { if (frame_host == frame_host_) { if (frame_host && !render_frame_alive_) { render_frame_alive_ = true; MaybeReattachToRenderFrame(); } return; } if (frame_host && !ShouldCreateDevToolsForHost(frame_host)) { DestroyOnRenderFrameGone(); return; } if (IsAttached()) RevokePolicy(); frame_host_ = frame_host; agent_ptr_.reset(); render_frame_alive_ = true; if (IsAttached()) { GrantPolicy(); for (DevToolsSession* session : sessions()) { session->SetRenderer(frame_host ? frame_host->GetProcess() : nullptr, frame_host); } MaybeReattachToRenderFrame(); } } ",1 "void enable_kernel_spe(void) { WARN_ON(preemptible()); #ifdef CONFIG_SMP if (current->thread.regs && (current->thread.regs->msr & MSR_SPE)) giveup_spe(current); else giveup_spe(NULL); /* just enable SPE for kernel - force */ #else giveup_spe(last_task_used_spe); #endif /* __SMP __ */ } ",0 "bool OmniboxViewWin::IsSelectAllForRange(const CHARRANGE& sel) const { const int text_length = GetTextLength(); return ((sel.cpMin == 0) && (sel.cpMax >= text_length)) || ((sel.cpMax == 0) && (sel.cpMin >= text_length)); } ",0 "bool LargeObjectPage::contains(Address object) { return roundToBlinkPageStart(getAddress()) <= object && object < roundToBlinkPageEnd(getAddress() + size()); } ",0 "void RenderFlexibleBox::updateAutoMarginsInMainAxis(RenderBox* child, LayoutUnit autoMarginOffset) { ASSERT(autoMarginOffset >= 0); if (isHorizontalFlow()) { if (child->style()->marginLeft().isAuto()) child->setMarginLeft(autoMarginOffset); if (child->style()->marginRight().isAuto()) child->setMarginRight(autoMarginOffset); } else { if (child->style()->marginTop().isAuto()) child->setMarginTop(autoMarginOffset); if (child->style()->marginBottom().isAuto()) child->setMarginBottom(autoMarginOffset); } } ",0 "void h2o_http2_conn_request_write(h2o_http2_conn_t *conn) { if (conn->state == H2O_HTTP2_CONN_STATE_IS_CLOSING) return; request_gathered_write(conn); } ",0 "void GLES2DecoderImpl::DeleteRenderbuffersHelper( GLsizei n, const GLuint* client_ids) { bool supports_separate_framebuffer_binds = feature_info_->feature_flags().chromium_framebuffer_multisample; for (GLsizei ii = 0; ii < n; ++ii) { RenderbufferManager::RenderbufferInfo* renderbuffer = GetRenderbufferInfo(client_ids[ii]); if (renderbuffer && !renderbuffer->IsDeleted()) { if (bound_renderbuffer_ == renderbuffer) { bound_renderbuffer_ = NULL; } if (supports_separate_framebuffer_binds) { if (bound_read_framebuffer_) { bound_read_framebuffer_->UnbindRenderbuffer( GL_READ_FRAMEBUFFER_EXT, renderbuffer); } if (bound_draw_framebuffer_) { bound_draw_framebuffer_->UnbindRenderbuffer( GL_DRAW_FRAMEBUFFER_EXT, renderbuffer); } } else { if (bound_draw_framebuffer_) { bound_draw_framebuffer_->UnbindRenderbuffer( GL_FRAMEBUFFER, renderbuffer); } } state_dirty_ = true; RemoveRenderbufferInfo(client_ids[ii]); } } } ",0 "SYSCALL_DEFINE3(semop, int, semid, struct sembuf __user *, tsops, unsigned, nsops) { return sys_semtimedop(semid, tsops, nsops, NULL); } ",0 " __releases(ax25_list_lock) { spin_unlock_bh(&ax25_list_lock); } ",0 "void AutocompleteEditModel::RevertTemporaryText(bool revert_popup) { just_deleted_text_ = false; has_temporary_text_ = false; if (revert_popup) popup_->ResetToDefaultMatch(); view_->OnRevertTemporaryText(); } ",0 "enum nss_status _nss_mymachines_gethostbyname4_r( const char *name, struct gaih_addrtuple **pat, char *buffer, size_t buflen, int *errnop, int *h_errnop, int32_t *ttlp) { struct gaih_addrtuple *r_tuple, *r_tuple_first = NULL; _cleanup_bus_message_unref_ sd_bus_message* reply = NULL; _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL; _cleanup_free_ int *ifindices = NULL; _cleanup_free_ char *class = NULL; size_t l, ms, idx; unsigned i = 0, c = 0; char *r_name; int n_ifindices, r; assert(name); assert(pat); assert(buffer); assert(errnop); assert(h_errnop); r = sd_machine_get_class(name, &class); if (r < 0) goto fail; if (!streq(class, ""container"")) { r = -ENOTTY; goto fail; } n_ifindices = sd_machine_get_ifindices(name, &ifindices); if (n_ifindices < 0) { r = n_ifindices; goto fail; } r = sd_bus_open_system(&bus); if (r < 0) goto fail; r = sd_bus_call_method(bus, ""org.freedesktop.machine1"", ""/org/freedesktop/machine1"", ""org.freedesktop.machine1.Manager"", ""GetMachineAddresses"", NULL, &reply, ""s"", name); if (r < 0) goto fail; r = sd_bus_message_enter_container(reply, 'a', ""(iay)""); if (r < 0) goto fail; r = count_addresses(reply, AF_UNSPEC, &c); if (r < 0) goto fail; if (c <= 0) { *errnop = ESRCH; *h_errnop = HOST_NOT_FOUND; return NSS_STATUS_NOTFOUND; } l = strlen(name); ms = ALIGN(l+1) + ALIGN(sizeof(struct gaih_addrtuple)) * c; if (buflen < ms) { *errnop = ENOMEM; *h_errnop = TRY_AGAIN; return NSS_STATUS_TRYAGAIN; } /* First, append name */ r_name = buffer; memcpy(r_name, name, l+1); idx = ALIGN(l+1); /* Second, append addresses */ r_tuple_first = (struct gaih_addrtuple*) (buffer + idx); while ((r = sd_bus_message_enter_container(reply, 'r', ""iay"")) > 0) { int family; const void *a; size_t sz; r = sd_bus_message_read(reply, ""i"", &family); if (r < 0) goto fail; r = sd_bus_message_read_array(reply, 'y', &a, &sz); if (r < 0) goto fail; r = sd_bus_message_exit_container(reply); if (r < 0) goto fail; if (!IN_SET(family, AF_INET, AF_INET6)) { r = -EAFNOSUPPORT; goto fail; } if (sz != FAMILY_ADDRESS_SIZE(family)) { r = -EINVAL; goto fail; } r_tuple = (struct gaih_addrtuple*) (buffer + idx); r_tuple->next = i == c-1 ? NULL : (struct gaih_addrtuple*) ((char*) r_tuple + ALIGN(sizeof(struct gaih_addrtuple))); r_tuple->name = r_name; r_tuple->family = family; r_tuple->scopeid = n_ifindices == 1 ? ifindices[0] : 0; memcpy(r_tuple->addr, a, sz); idx += ALIGN(sizeof(struct gaih_addrtuple)); i++; } assert(i == c); r = sd_bus_message_exit_container(reply); if (r < 0) goto fail; assert(idx == ms); if (*pat) **pat = *r_tuple_first; else *pat = r_tuple_first; if (ttlp) *ttlp = 0; /* Explicitly reset all error variables */ *errnop = 0; *h_errnop = NETDB_SUCCESS; h_errno = 0; return NSS_STATUS_SUCCESS; fail: *errnop = -r; *h_errnop = NO_DATA; return NSS_STATUS_UNAVAIL; } ",0 "void handle_ld_nf(u32 insn, struct pt_regs *regs) { int rd = ((insn >> 25) & 0x1f); int from_kernel = (regs->tstate & TSTATE_PRIV) != 0; unsigned long *reg; perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, 0, regs, 0); maybe_flush_windows(0, 0, rd, from_kernel); reg = fetch_reg_addr(rd, regs); if (from_kernel || rd < 16) { reg[0] = 0; if ((insn & 0x780000) == 0x180000) reg[1] = 0; } else if (test_thread_flag(TIF_32BIT)) { put_user(0, (int __user *) reg); if ((insn & 0x780000) == 0x180000) put_user(0, ((int __user *) reg) + 1); } else { put_user(0, (unsigned long __user *) reg); if ((insn & 0x780000) == 0x180000) put_user(0, (unsigned long __user *) reg + 1); } advance(regs); } ",1 "EventRouter* ExtensionSystemImpl::event_router() { return shared_->event_router(); } ",0 "ControllerConnectionProxy::ControllerConnectionProxy( blink::WebPresentationConnection* controller_connection) : PresentationConnectionProxy(controller_connection) {} ",0 "void DesktopWindowTreeHostX11::SetUseNativeFrame(bool use_native_frame) { use_native_frame_ = use_native_frame; ui::SetUseOSWindowFrame(xwindow_, use_native_frame); ResetWindowRegion(); } ",0 "static int decode_level1_header(LHAFileHeader **header, LHAInputStream *stream) { unsigned int ext_header_start; if (!decode_level0_header(header, stream)) { return 0; } ext_header_start = RAW_DATA_LEN(header) - 2; if (!read_l1_extended_headers(header, stream) || !decode_extended_headers(header, ext_header_start)) { return 0; } return 1; } ",0 "bool ExtensionService::UninstallExtension( const std::string& extension_id_unsafe, bool external_uninstall, std::string* error) { CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); std::string extension_id(extension_id_unsafe); const Extension* extension = GetInstalledExtension(extension_id); CHECK(extension); GURL extension_url(extension->url()); Extension::Location location(extension->location()); if (!Extension::UserMayDisable(location) && !external_uninstall) { NotificationService::current()->Notify( chrome::NOTIFICATION_EXTENSION_UNINSTALL_NOT_ALLOWED, Source(profile_), Details(extension)); if (error != NULL) { *error = errors::kCannotUninstallManagedExtension; } return false; } SyncBundle* sync_bundle = GetSyncBundleForExtension(*extension); SyncChange sync_change; if (sync_bundle) { ExtensionSyncData extension_sync_data(*extension, IsExtensionEnabled(extension_id), IsIncognitoEnabled(extension_id)); sync_change = extension_sync_data.GetSyncChange(SyncChange::ACTION_DELETE); } UninstalledExtensionInfo uninstalled_extension_info(*extension); UMA_HISTOGRAM_ENUMERATION(""Extensions.UninstallType"", extension->GetType(), 100); RecordPermissionMessagesHistogram( extension, ""Extensions.Permissions_Uninstall""); TemplateURLService* url_service = TemplateURLServiceFactory::GetForProfile(profile_); if (url_service) url_service->UnregisterExtensionKeyword(extension); UnloadExtension(extension_id, extension_misc::UNLOAD_REASON_UNINSTALL); extension_prefs_->OnExtensionUninstalled(extension_id, location, external_uninstall); if (Extension::LOAD != location) { if (!BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, NewRunnableFunction( &extension_file_util::UninstallExtension, install_directory_, extension_id))) NOTREACHED(); } ClearExtensionData(extension_url); UntrackTerminatedExtension(extension_id); NotificationService::current()->Notify( chrome::NOTIFICATION_EXTENSION_UNINSTALLED, Source(profile_), Details(&uninstalled_extension_info)); if (sync_bundle && sync_bundle->HasExtensionId(extension_id)) { sync_bundle->sync_processor->ProcessSyncChanges( FROM_HERE, SyncChangeList(1, sync_change)); sync_bundle->synced_extensions.erase(extension_id); } return true; } ",0 "void WebBluetoothServiceImpl::RunPendingPrimaryServicesRequests( device::BluetoothDevice* device) { const std::string& device_address = device->GetAddress(); auto iter = pending_primary_services_requests_.find(device_address); if (iter == pending_primary_services_requests_.end()) { return; } std::vector requests = std::move(iter->second); pending_primary_services_requests_.erase(iter); for (PrimaryServicesRequestCallback& request : requests) { std::move(request).Run(device); } DCHECK( !base::ContainsKey(pending_primary_services_requests_, device_address)); } ",0 "static int __init file_caps_disable(char *str) { file_caps_enabled = 0; return 1; } ",0 "void CSoundFile::CheckCPUUsage(UINT nCPU) { if (nCPU > 100) nCPU = 100; gnCPUUsage = nCPU; if (nCPU < 90) { m_dwSongFlags &= ~SONG_CPUVERYHIGH; } else if ((m_dwSongFlags & SONG_CPUVERYHIGH) && (nCPU >= 94)) { UINT i=MAX_CHANNELS; while (i >= 8) { i--; if (Chn[i].nLength) { Chn[i].nLength = Chn[i].nPos = 0; nCPU -= 2; if (nCPU < 94) break; } } } else if (nCPU > 90) { m_dwSongFlags |= SONG_CPUVERYHIGH; } } ",0 "TrackedRendererListHashSet* RenderBlock::percentHeightDescendants() const { return gPercentHeightDescendantsMap ? gPercentHeightDescendantsMap->get(this) : 0; } ",0 "get_supported_image_extensions(void) { GSList *extensions = NULL; GSList *formats = gdk_pixbuf_get_formats (); GSList *l; for (l = formats; l != NULL; l = l->next) { int i; gchar **ext = gdk_pixbuf_format_get_extensions (l->data); for (i = 0; ext[i] != NULL; i++) { extensions = g_slist_append (extensions, g_strdup (ext[i])); } g_strfreev (ext); } g_slist_free (formats); return extensions; } ",0 "static void TIFFTagExtender(TIFF *tiff) { static const TIFFFieldInfo TIFFExtensions[] = { { 37724, -3, -3, TIFF_UNDEFINED, FIELD_CUSTOM, 1, 1, (char *) ""PhotoshopLayerData"" }, { 34118, -3, -3, TIFF_UNDEFINED, FIELD_CUSTOM, 1, 1, (char *) ""Microscope"" } }; TIFFMergeFieldInfo(tiff,TIFFExtensions,sizeof(TIFFExtensions)/ sizeof(*TIFFExtensions)); if (tag_extender != (TIFFExtendProc) NULL) (*tag_extender)(tiff); TIFFIgnoreTags(tiff); } ",0 "void MojoAudioOutputIPC::OnError() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(delegate_); delegate_->OnError(); } ",0 "bool ShouldPropagateUserActivation(const url::Origin& previous_origin, const url::Origin& new_origin) { if ((previous_origin.scheme() != ""http"" && previous_origin.scheme() != ""https"") || (new_origin.scheme() != ""http"" && new_origin.scheme() != ""https"")) { return false; } if (previous_origin.host() == new_origin.host()) return true; std::string previous_domain = net::registry_controlled_domains::GetDomainAndRegistry( previous_origin.host(), net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); std::string new_domain = net::registry_controlled_domains::GetDomainAndRegistry( new_origin.host(), net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); return !previous_domain.empty() && previous_domain == new_domain; } ",0 "osf_ufs_mount(char *dirname, struct ufs_args __user *args, int flags) { int retval; struct cdfs_args tmp; char *devname; retval = -EFAULT; if (copy_from_user(&tmp, args, sizeof(tmp))) goto out; devname = getname(tmp.devname); retval = PTR_ERR(devname); if (IS_ERR(devname)) goto out; retval = do_mount(devname, dirname, ""ext2"", flags, NULL); putname(devname); out: return retval; } ",0 "static bool handle_client_startup(PgSocket *client, PktHdr *pkt) { const char *passwd; const uint8_t *key; bool ok; SBuf *sbuf = &client->sbuf; /* don't tolerate partial packets */ if (incomplete_pkt(pkt)) { disconnect_client(client, true, ""client sent partial pkt in startup phase""); return false; } if (client->wait_for_welcome) { if (finish_client_login(client)) { /* the packet was already parsed */ sbuf_prepare_skip(sbuf, pkt->len); return true; } else { return false; } } switch (pkt->type) { case PKT_SSLREQ: slog_noise(client, ""C: req SSL""); if (client->sbuf.tls) { disconnect_client(client, false, ""SSL req inside SSL""); return false; } if (cf_client_tls_sslmode != SSLMODE_DISABLED) { slog_noise(client, ""P: SSL ack""); if (!sbuf_answer(&client->sbuf, ""S"", 1)) { disconnect_client(client, false, ""failed to ack SSL""); return false; } if (!sbuf_tls_accept(&client->sbuf)) { disconnect_client(client, false, ""failed to accept SSL""); return false; } break; } /* reject SSL attempt */ slog_noise(client, ""P: nak""); if (!sbuf_answer(&client->sbuf, ""N"", 1)) { disconnect_client(client, false, ""failed to nak SSL""); return false; } break; case PKT_STARTUP_V2: disconnect_client(client, true, ""Old V2 protocol not supported""); return false; case PKT_STARTUP: /* require SSL except on unix socket */ if (cf_client_tls_sslmode >= SSLMODE_REQUIRE && !client->sbuf.tls && !pga_is_unix(&client->remote_addr)) { disconnect_client(client, true, ""SSL required""); return false; } if (client->pool && !client->wait_for_user_conn && !client->wait_for_user) { disconnect_client(client, true, ""client re-sent startup pkt""); return false; } if (client->wait_for_user) { client->wait_for_user = false; if (!finish_set_pool(client, false)) return false; } else if (!decide_startup_pool(client, pkt)) { return false; } break; case 'p': /* PasswordMessage */ /* too early */ if (!client->auth_user) { disconnect_client(client, true, ""client password pkt before startup packet""); return false; } ok = mbuf_get_string(&pkt->data, &passwd); if (ok && check_client_passwd(client, passwd)) { if (!finish_client_login(client)) return false; } else { disconnect_client(client, true, ""Auth failed""); return false; } break; case PKT_CANCEL: if (mbuf_avail_for_read(&pkt->data) == BACKENDKEY_LEN && mbuf_get_bytes(&pkt->data, BACKENDKEY_LEN, &key)) { memcpy(client->cancel_key, key, BACKENDKEY_LEN); accept_cancel_request(client); } else { disconnect_client(client, false, ""bad cancel request""); } return false; default: disconnect_client(client, false, ""bad packet""); return false; } sbuf_prepare_skip(sbuf, pkt->len); client->request_time = get_cached_time(); return true; } ",0 "void GLES2DecoderImpl::DoInsertEventMarkerEXT( GLsizei length, const GLchar* marker) { if (!marker) { marker = """"; } debug_marker_manager_.SetMarker( length ? std::string(marker, length) : std::string(marker)); } ",0 "static void SetSaturation(double saturation,FPXColorTwistMatrix *color_twist) { FPXColorTwistMatrix effect, result; /* Set image saturation in color twist matrix. */ assert(color_twist != (FPXColorTwistMatrix *) NULL); effect.byy=1.0; effect.byc1=0.0; effect.byc2=0.0; effect.dummy1_zero=0.0; effect.bc1y=0.0; effect.bc1c1=saturation; effect.bc1c2=0.0; effect.dummy2_zero=0.0; effect.bc2y=0.0; effect.bc2c1=0.0; effect.bc2c2=saturation; effect.dummy3_zero=0.0; effect.dummy4_zero=0.0; effect.dummy5_zero=0.0; effect.dummy6_zero=0.0; effect.dummy7_one=1.0; ColorTwistMultiply(*color_twist,effect,&result); *color_twist=result; } ",0 "static unsigned int mnt_get_writers(struct mount *mnt) { #ifdef CONFIG_SMP unsigned int count = 0; int cpu; for_each_possible_cpu(cpu) { count += per_cpu_ptr(mnt->mnt_pcp, cpu)->mnt_writers; } return count; #else return mnt->mnt_writers; #endif } ",0 "void ChromeClientImpl::exitFullScreenForElement(Element* element) { m_webView->exitFullScreenForElement(element); } ",0 "uint32_t vga_ioport_read(void *opaque, uint32_t addr) { VGACommonState *s = opaque; int val, index; if (vga_ioport_invalid(s, addr)) { val = 0xff; } else { switch(addr) { case VGA_ATT_W: if (s->ar_flip_flop == 0) { val = s->ar_index; } else { val = 0; } break; case VGA_ATT_R: index = s->ar_index & 0x1f; if (index < VGA_ATT_C) { val = s->ar[index]; } else { val = 0; } break; case VGA_MIS_W: val = s->st00; break; case VGA_SEQ_I: val = s->sr_index; break; case VGA_SEQ_D: val = s->sr[s->sr_index]; #ifdef DEBUG_VGA_REG printf(""vga: read SR%x = 0x%02x\n"", s->sr_index, val); #endif break; case VGA_PEL_IR: val = s->dac_state; break; case VGA_PEL_IW: val = s->dac_write_index; break; case VGA_PEL_D: val = s->palette[s->dac_read_index * 3 + s->dac_sub_index]; if (++s->dac_sub_index == 3) { s->dac_sub_index = 0; s->dac_read_index++; } break; case VGA_FTC_R: val = s->fcr; break; case VGA_MIS_R: val = s->msr; break; case VGA_GFX_I: val = s->gr_index; break; case VGA_GFX_D: val = s->gr[s->gr_index]; #ifdef DEBUG_VGA_REG printf(""vga: read GR%x = 0x%02x\n"", s->gr_index, val); #endif break; case VGA_CRT_IM: case VGA_CRT_IC: val = s->cr_index; break; case VGA_CRT_DM: case VGA_CRT_DC: val = s->cr[s->cr_index]; #ifdef DEBUG_VGA_REG printf(""vga: read CR%x = 0x%02x\n"", s->cr_index, val); #endif break; case VGA_IS1_RM: case VGA_IS1_RC: /* just toggle to fool polling */ val = s->st01 = s->retrace(s); s->ar_flip_flop = 0; break; default: val = 0x00; break; } } trace_vga_std_read_io(addr, val); return val; } ",0 "PHP_METHOD(PharFileInfo, chmod) { char *error; zend_long perms; PHAR_ENTRY_OBJECT(); if (entry_obj->entry->is_temp_dir) { zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, \ ""Phar entry \""%s\"" is a temporary directory (not an actual entry in the archive), cannot chmod"", entry_obj->entry->filename); \ return; } if (PHAR_G(readonly) && !entry_obj->entry->phar->is_data) { zend_throw_exception_ex(phar_ce_PharException, 0, ""Cannot modify permissions for file \""%s\"" in phar \""%s\"", write operations are prohibited"", entry_obj->entry->filename, entry_obj->entry->phar->fname); return; } if (zend_parse_parameters(ZEND_NUM_ARGS(), ""l"", &perms) == FAILURE) { return; } if (entry_obj->entry->is_persistent) { phar_archive_data *phar = entry_obj->entry->phar; if (FAILURE == phar_copy_on_write(&phar)) { zend_throw_exception_ex(phar_ce_PharException, 0, ""phar \""%s\"" is persistent, unable to copy on write"", phar->fname); return; } /* re-populate after copy-on-write */ entry_obj->entry = zend_hash_str_find_ptr(&phar->manifest, entry_obj->entry->filename, entry_obj->entry->filename_len); } /* clear permissions */ entry_obj->entry->flags &= ~PHAR_ENT_PERM_MASK; perms &= 0777; entry_obj->entry->flags |= perms; entry_obj->entry->old_flags = entry_obj->entry->flags; entry_obj->entry->phar->is_modified = 1; entry_obj->entry->is_modified = 1; /* hackish cache in php_stat needs to be cleared */ /* if this code fails to work, check main/streams/streams.c, _php_stream_stat_path */ if (BG(CurrentLStatFile)) { efree(BG(CurrentLStatFile)); } if (BG(CurrentStatFile)) { efree(BG(CurrentStatFile)); } BG(CurrentLStatFile) = NULL; BG(CurrentStatFile) = NULL; phar_flush(entry_obj->entry->phar, 0, 0, 0, &error); if (error) { zend_throw_exception_ex(phar_ce_PharException, 0, ""%s"", error); efree(error); } } ",0 "gdImagePtr gdImageScaleBicubicFixed(gdImagePtr src, const unsigned int width, const unsigned int height) { const long new_width = MAX(1, width); const long new_height = MAX(1, height); const int src_w = gdImageSX(src); const int src_h = gdImageSY(src); const gdFixed f_dx = gd_ftofx((float)src_w / (float)new_width); const gdFixed f_dy = gd_ftofx((float)src_h / (float)new_height); const gdFixed f_1 = gd_itofx(1); const gdFixed f_2 = gd_itofx(2); const gdFixed f_4 = gd_itofx(4); const gdFixed f_6 = gd_itofx(6); const gdFixed f_gamma = gd_ftofx(1.04f); gdImagePtr dst; unsigned int dst_offset_x; unsigned int dst_offset_y = 0; long i; /* impact perf a bit, but not that much. Implementation for palette images can be done at a later point. */ if (src->trueColor == 0) { gdImagePaletteToTrueColor(src); } dst = gdImageCreateTrueColor(new_width, new_height); if (!dst) { return NULL; } dst->saveAlphaFlag = 1; for (i=0; i < new_height; i++) { long j; dst_offset_x = 0; for (j=0; j < new_width; j++) { const gdFixed f_a = gd_mulfx(gd_itofx(i), f_dy); const gdFixed f_b = gd_mulfx(gd_itofx(j), f_dx); const long m = gd_fxtoi(f_a); const long n = gd_fxtoi(f_b); const gdFixed f_f = f_a - gd_itofx(m); const gdFixed f_g = f_b - gd_itofx(n); unsigned int src_offset_x[16], src_offset_y[16]; long k; register gdFixed f_red = 0, f_green = 0, f_blue = 0, f_alpha = 0; unsigned char red, green, blue, alpha = 0; int *dst_row = dst->tpixels[dst_offset_y]; if ((m < 1) || (n < 1)) { src_offset_x[0] = n; src_offset_y[0] = m; } else { src_offset_x[0] = n - 1; src_offset_y[0] = m; } if (m < 1) { src_offset_x[1] = n; src_offset_y[1] = m; } else { src_offset_x[1] = n; src_offset_y[1] = m; } if ((m < 1) || (n >= src_w - 1)) { src_offset_x[2] = n; src_offset_y[2] = m; } else { src_offset_x[2] = n + 1; src_offset_y[2] = m; } if ((m < 1) || (n >= src_w - 2)) { src_offset_x[3] = n; src_offset_y[3] = m; } else { src_offset_x[3] = n + 1 + 1; src_offset_y[3] = m; } if (n < 1) { src_offset_x[4] = n; src_offset_y[4] = m; } else { src_offset_x[4] = n - 1; src_offset_y[4] = m; } src_offset_x[5] = n; src_offset_y[5] = m; if (n >= src_w-1) { src_offset_x[6] = n; src_offset_y[6] = m; } else { src_offset_x[6] = n + 1; src_offset_y[6] = m; } if (n >= src_w - 2) { src_offset_x[7] = n; src_offset_y[7] = m; } else { src_offset_x[7] = n + 1 + 1; src_offset_y[7] = m; } if ((m >= src_h - 1) || (n < 1)) { src_offset_x[8] = n; src_offset_y[8] = m; } else { src_offset_x[8] = n - 1; src_offset_y[8] = m; } if (m >= src_h - 1) { src_offset_x[8] = n; src_offset_y[8] = m; } else { src_offset_x[9] = n; src_offset_y[9] = m; } if ((m >= src_h-1) || (n >= src_w-1)) { src_offset_x[10] = n; src_offset_y[10] = m; } else { src_offset_x[10] = n + 1; src_offset_y[10] = m; } if ((m >= src_h - 1) || (n >= src_w - 2)) { src_offset_x[11] = n; src_offset_y[11] = m; } else { src_offset_x[11] = n + 1 + 1; src_offset_y[11] = m; } if ((m >= src_h - 2) || (n < 1)) { src_offset_x[12] = n; src_offset_y[12] = m; } else { src_offset_x[12] = n - 1; src_offset_y[12] = m; } if (m >= src_h - 2) { src_offset_x[13] = n; src_offset_y[13] = m; } else { src_offset_x[13] = n; src_offset_y[13] = m; } if ((m >= src_h - 2) || (n >= src_w - 1)) { src_offset_x[14] = n; src_offset_y[14] = m; } else { src_offset_x[14] = n + 1; src_offset_y[14] = m; } if ((m >= src_h - 2) || (n >= src_w - 2)) { src_offset_x[15] = n; src_offset_y[15] = m; } else { src_offset_x[15] = n + 1 + 1; src_offset_y[15] = m; } for (k = -1; k < 3; k++) { const gdFixed f = gd_itofx(k)-f_f; const gdFixed f_fm1 = f - f_1; const gdFixed f_fp1 = f + f_1; const gdFixed f_fp2 = f + f_2; register gdFixed f_a = 0, f_b = 0, f_d = 0, f_c = 0; register gdFixed f_RY; int l; if (f_fp2 > 0) f_a = gd_mulfx(f_fp2, gd_mulfx(f_fp2,f_fp2)); if (f_fp1 > 0) f_b = gd_mulfx(f_fp1, gd_mulfx(f_fp1,f_fp1)); if (f > 0) f_c = gd_mulfx(f, gd_mulfx(f,f)); if (f_fm1 > 0) f_d = gd_mulfx(f_fm1, gd_mulfx(f_fm1,f_fm1)); f_RY = gd_divfx((f_a - gd_mulfx(f_4,f_b) + gd_mulfx(f_6,f_c) - gd_mulfx(f_4,f_d)),f_6); for (l = -1; l < 3; l++) { const gdFixed f = gd_itofx(l) - f_g; const gdFixed f_fm1 = f - f_1; const gdFixed f_fp1 = f + f_1; const gdFixed f_fp2 = f + f_2; register gdFixed f_a = 0, f_b = 0, f_c = 0, f_d = 0; register gdFixed f_RX, f_R, f_rs, f_gs, f_bs, f_ba; register int c; const int _k = ((k+1)*4) + (l+1); if (f_fp2 > 0) f_a = gd_mulfx(f_fp2,gd_mulfx(f_fp2,f_fp2)); if (f_fp1 > 0) f_b = gd_mulfx(f_fp1,gd_mulfx(f_fp1,f_fp1)); if (f > 0) f_c = gd_mulfx(f,gd_mulfx(f,f)); if (f_fm1 > 0) f_d = gd_mulfx(f_fm1,gd_mulfx(f_fm1,f_fm1)); f_RX = gd_divfx((f_a-gd_mulfx(f_4,f_b)+gd_mulfx(f_6,f_c)-gd_mulfx(f_4,f_d)),f_6); f_R = gd_mulfx(f_RY,f_RX); c = src->tpixels[*(src_offset_y + _k)][*(src_offset_x + _k)]; f_rs = gd_itofx(gdTrueColorGetRed(c)); f_gs = gd_itofx(gdTrueColorGetGreen(c)); f_bs = gd_itofx(gdTrueColorGetBlue(c)); f_ba = gd_itofx(gdTrueColorGetAlpha(c)); f_red += gd_mulfx(f_rs,f_R); f_green += gd_mulfx(f_gs,f_R); f_blue += gd_mulfx(f_bs,f_R); f_alpha += gd_mulfx(f_ba,f_R); } } red = (unsigned char) CLAMP(gd_fxtoi(gd_mulfx(f_red, f_gamma)), 0, 255); green = (unsigned char) CLAMP(gd_fxtoi(gd_mulfx(f_green, f_gamma)), 0, 255); blue = (unsigned char) CLAMP(gd_fxtoi(gd_mulfx(f_blue, f_gamma)), 0, 255); alpha = (unsigned char) CLAMP(gd_fxtoi(gd_mulfx(f_alpha, f_gamma)), 0, 127); *(dst_row + dst_offset_x) = gdTrueColorAlpha(red, green, blue, alpha); dst_offset_x++; } dst_offset_y++; } return dst; } ",0 "GF_Box *mdhd_New() { ISOM_DECL_BOX_ALLOC(GF_MediaHeaderBox, GF_ISOM_BOX_TYPE_MDHD); tmp->packedLanguage[0] = 'u'; tmp->packedLanguage[1] = 'n'; tmp->packedLanguage[2] = 'd'; return (GF_Box *)tmp; } ",0 "OJPEGEncode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s) { static const char module[]=""OJPEGEncode""; (void)buf; (void)cc; (void)s; TIFFErrorExt(tif->tif_clientdata,module,""OJPEG encoding not supported; use new-style JPEG compression instead""); return(0); } ",0 "static int check_slab(struct kmem_cache *s, struct page *page) { int maxobj; VM_BUG_ON(!irqs_disabled()); if (!PageSlab(page)) { slab_err(s, page, ""Not a valid slab page""); return 0; } maxobj = (PAGE_SIZE << compound_order(page)) / s->size; if (page->objects > maxobj) { slab_err(s, page, ""objects %u > max %u"", s->name, page->objects, maxobj); return 0; } if (page->inuse > page->objects) { slab_err(s, page, ""inuse %u > max %u"", s->name, page->inuse, page->objects); return 0; } /* Slab_pad_check fixes things up after itself */ slab_pad_check(s, page); return 1; } ",0 "bool SiteInstanceImpl::ShouldAssignSiteForURL(const GURL& url) { if (url == url::kAboutBlankURL) return false; return GetContentClient()->browser()->ShouldAssignSiteForURL(url); } ",0 "void Document::didUpdateSecurityOrigin() { if (!m_frame) return; m_frame->script().updateSecurityOrigin(securityOrigin()); } ",0 "bool TextureManager::Initialize() { UpdateMemRepresented(); default_textures_[kTexture2D] = CreateDefaultAndBlackTextures( GL_TEXTURE_2D, &black_texture_ids_[kTexture2D]); default_textures_[kCubeMap] = CreateDefaultAndBlackTextures( GL_TEXTURE_CUBE_MAP, &black_texture_ids_[kCubeMap]); if (feature_info_->feature_flags().oes_egl_image_external) { default_textures_[kExternalOES] = CreateDefaultAndBlackTextures( GL_TEXTURE_EXTERNAL_OES, &black_texture_ids_[kExternalOES]); } if (feature_info_->feature_flags().arb_texture_rectangle) { default_textures_[kRectangleARB] = CreateDefaultAndBlackTextures( GL_TEXTURE_RECTANGLE_ARB, &black_texture_ids_[kRectangleARB]); } return true; } ",0 "ofputil_decode_tlv_table_reply(const struct ofp_header *oh, struct ofputil_tlv_table_reply *ttr) { struct ofpbuf msg = ofpbuf_const_initializer(oh, ntohs(oh->length)); ofpraw_pull_assert(&msg); struct nx_tlv_table_reply *nx_ttr = ofpbuf_pull(&msg, sizeof *nx_ttr); ttr->max_option_space = ntohl(nx_ttr->max_option_space); ttr->max_fields = ntohs(nx_ttr->max_fields); return decode_tlv_table_mappings(&msg, ttr->max_fields, &ttr->mappings); } ",0 "void ShellContentBrowserClient::PreSpawnRenderer(sandbox::TargetPolicy* policy, bool* success) { std::vector font_files = GetSideloadFontFiles(); for (std::vector::const_iterator i(font_files.begin()); i != font_files.end(); ++i) { policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES, sandbox::TargetPolicy::FILES_ALLOW_READONLY, base::UTF8ToWide(*i).c_str()); } } ",0 "static int allocate_cmdlines_buffer(unsigned int val, struct saved_cmdlines_buffer *s) { s->map_cmdline_to_pid = kmalloc_array(val, sizeof(*s->map_cmdline_to_pid), GFP_KERNEL); if (!s->map_cmdline_to_pid) return -ENOMEM; s->saved_cmdlines = kmalloc_array(TASK_COMM_LEN, val, GFP_KERNEL); if (!s->saved_cmdlines) { kfree(s->map_cmdline_to_pid); return -ENOMEM; } s->cmdline_idx = 0; s->cmdline_num = val; memset(&s->map_pid_to_cmdline, NO_CMDLINE_MAP, sizeof(s->map_pid_to_cmdline)); memset(s->map_cmdline_to_pid, NO_CMDLINE_MAP, val * sizeof(*s->map_cmdline_to_pid)); return 0; } ",0 "HttpResponseHeaders::HttpResponseHeaders(const std::string& raw_input) : response_code_(-1) { Parse(raw_input); UMA_HISTOGRAM_CUSTOM_ENUMERATION(""Net.HttpResponseCode"", MapHttpResponseCode(response_code_), GetAllHttpResponseCodes()); } ",0 "static void nfs4_xdr_enc_release_lockowner(struct rpc_rqst *req, struct xdr_stream *xdr, struct nfs_release_lockowner_args *args) { struct compound_hdr hdr = { .minorversion = 0, }; encode_compound_hdr(xdr, req, &hdr); encode_release_lockowner(xdr, &args->lock_owner, &hdr); encode_nops(&hdr); } ",0 "void NetworkReaderProxy::OnGetContent(scoped_ptr data) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK(data && !data->empty()); pending_data_.push_back(data.release()); if (!buffer_) { return; } int result = ReadInternal(&pending_data_, buffer_.get(), buffer_length_); remaining_content_length_ -= result; DCHECK_GE(remaining_content_length_, 0); buffer_ = NULL; buffer_length_ = 0; DCHECK(!callback_.is_null()); base::ResetAndReturn(&callback_).Run(result); } ",1 "static void raisesExceptionGetterLongAttributeAttributeGetter(const v8::PropertyCallbackInfo& info) { TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); ExceptionState exceptionState(ExceptionState::GetterContext, ""raisesExceptionGetterLongAttribute"", ""TestObjectPython"", info.Holder(), info.GetIsolate()); int jsValue = imp->raisesExceptionGetterLongAttribute(exceptionState); if (UNLIKELY(exceptionState.throwIfNeeded())) return; v8SetReturnValueInt(info, jsValue); } ",0 "static void get_tcp6_sock(struct seq_file *seq, struct sock *sp, int i) { const struct in6_addr *dest, *src; __u16 destp, srcp; int timer_active; unsigned long timer_expires; struct inet_sock *inet = inet_sk(sp); struct tcp_sock *tp = tcp_sk(sp); const struct inet_connection_sock *icsk = inet_csk(sp); struct ipv6_pinfo *np = inet6_sk(sp); dest = &np->daddr; src = &np->rcv_saddr; destp = ntohs(inet->inet_dport); srcp = ntohs(inet->inet_sport); if (icsk->icsk_pending == ICSK_TIME_RETRANS) { timer_active = 1; timer_expires = icsk->icsk_timeout; } else if (icsk->icsk_pending == ICSK_TIME_PROBE0) { timer_active = 4; timer_expires = icsk->icsk_timeout; } else if (timer_pending(&sp->sk_timer)) { timer_active = 2; timer_expires = sp->sk_timer.expires; } else { timer_active = 0; timer_expires = jiffies; } seq_printf(seq, ""%4d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X "" ""%02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %pK %lu %lu %u %u %d\n"", i, src->s6_addr32[0], src->s6_addr32[1], src->s6_addr32[2], src->s6_addr32[3], srcp, dest->s6_addr32[0], dest->s6_addr32[1], dest->s6_addr32[2], dest->s6_addr32[3], destp, sp->sk_state, tp->write_seq-tp->snd_una, (sp->sk_state == TCP_LISTEN) ? sp->sk_ack_backlog : (tp->rcv_nxt - tp->copied_seq), timer_active, jiffies_to_clock_t(timer_expires - jiffies), icsk->icsk_retransmits, sock_i_uid(sp), icsk->icsk_probes_out, sock_i_ino(sp), atomic_read(&sp->sk_refcnt), sp, jiffies_to_clock_t(icsk->icsk_rto), jiffies_to_clock_t(icsk->icsk_ack.ato), (icsk->icsk_ack.quick << 1 ) | icsk->icsk_ack.pingpong, tp->snd_cwnd, tcp_in_initial_slowstart(tp) ? -1 : tp->snd_ssthresh ); } ",0 "void RenderFrameImpl::SetHostZoomLevel(const GURL& url, double zoom_level) { #if !defined(OS_ANDROID) host_zoom_levels_[url] = zoom_level; #endif } ",0 "static int bin_pe_read_metadata_string(char* to, char* from) { int covered = 0; while (covered < MAX_METADATA_STRING_LENGTH) { to[covered] = from[covered]; if (from[covered] == '\0') { covered += 1; break; } covered++; } while (covered % 4 != 0) { covered++; } return covered; } ",0 "static int __init crypto_algapi_init(void) { crypto_init_proc(); return 0; } ",0 "void GdkPixbufFree(guchar* pixels, gpointer data) { free(pixels); } ",0 "static int __perf_event_stop(void *info) { struct stop_event_data *sd = info; struct perf_event *event = sd->event; /* if it's already INACTIVE, do nothing */ if (READ_ONCE(event->state) != PERF_EVENT_STATE_ACTIVE) return 0; /* matches smp_wmb() in event_sched_in() */ smp_rmb(); /* * There is a window with interrupts enabled before we get here, * so we need to check again lest we try to stop another CPU's event. */ if (READ_ONCE(event->oncpu) != smp_processor_id()) return -EAGAIN; event->pmu->stop(event, PERF_EF_UPDATE); /* * May race with the actual stop (through perf_pmu_output_stop()), * but it is only used for events with AUX ring buffer, and such * events will refuse to restart because of rb::aux_mmap_count==0, * see comments in perf_aux_output_begin(). * * Since this is happening on a event-local CPU, no trace is lost * while restarting. */ if (sd->restart) event->pmu->start(event, 0); return 0; } ",0 "KEYVALUE* AddAvailableProperty(cmsIT8* it8, const char* Key, WRITEMODE as) { return AddToList(it8, &it8->ValidKeywords, Key, NULL, NULL, as); } ",0 "PHP_FUNCTION(openssl_csr_export_to_file) { X509_REQ * csr; zval * zcsr = NULL; zend_bool notext = 1; char * filename = NULL; size_t filename_len; BIO * bio_out; zend_resource *csr_resource; if (zend_parse_parameters(ZEND_NUM_ARGS(), ""rp|b"", &zcsr, &filename, &filename_len, ¬ext) == FAILURE) { return; } RETVAL_FALSE; csr = php_openssl_csr_from_zval(zcsr, 0, &csr_resource); if (csr == NULL) { php_error_docref(NULL, E_WARNING, ""cannot get CSR from parameter 1""); return; } if (php_openssl_open_base_dir_chk(filename)) { return; } bio_out = BIO_new_file(filename, ""w""); if (bio_out != NULL) { if (!notext && !X509_REQ_print(bio_out, csr)) { php_openssl_store_errors(); } if (!PEM_write_bio_X509_REQ(bio_out, csr)) { php_error_docref(NULL, E_WARNING, ""error writing PEM to file %s"", filename); php_openssl_store_errors(); } else { RETVAL_TRUE; } BIO_free(bio_out); } else { php_openssl_store_errors(); php_error_docref(NULL, E_WARNING, ""error opening file %s"", filename); } if (csr_resource == NULL && csr != NULL) { X509_REQ_free(csr); } } ",0 "ip6_tnl_change(struct ip6_tnl *t, struct ip6_tnl_parm *p) { ipv6_addr_copy(&t->parms.laddr, &p->laddr); ipv6_addr_copy(&t->parms.raddr, &p->raddr); t->parms.flags = p->flags; t->parms.hop_limit = p->hop_limit; t->parms.encap_limit = p->encap_limit; t->parms.flowinfo = p->flowinfo; t->parms.link = p->link; t->parms.proto = p->proto; ip6_tnl_dst_reset(t); ip6_tnl_link_config(t); return 0; } ",0 "static int rename_node_locked(struct node *node, const char *name, const char* actual_name) { size_t namelen = strlen(name); int need_actual_name = strcmp(name, actual_name); /* make the storage bigger without actually changing the name * in case an error occurs part way */ if (namelen > node->namelen) { char* new_name = realloc(node->name, namelen + 1); if (!new_name) { return -ENOMEM; } node->name = new_name; if (need_actual_name && node->actual_name) { char* new_actual_name = realloc(node->actual_name, namelen + 1); if (!new_actual_name) { return -ENOMEM; } node->actual_name = new_actual_name; } } /* update the name, taking care to allocate storage before overwriting the old name */ if (need_actual_name) { if (!node->actual_name) { node->actual_name = malloc(namelen + 1); if (!node->actual_name) { return -ENOMEM; } } memcpy(node->actual_name, actual_name, namelen + 1); } else { free(node->actual_name); node->actual_name = NULL; } memcpy(node->name, name, namelen + 1); node->namelen = namelen; return 0; } ",0 "Tags::SimpleTag::~SimpleTag() {} ",0 "gx_dc_pattern2_fill_rectangle(const gx_device_color * pdevc, int x, int y, int w, int h, gx_device * dev, gs_logical_operation_t lop, const gx_rop_source_t * source) { if (dev_proc(dev, dev_spec_op)(dev, gxdso_pattern_is_cpath_accum, NULL, 0)) { /* Performing a conversion of imagemask into a clipping path. Fall back to the device procedure. */ return dev_proc(dev, fill_rectangle)(dev, x, y, w, h, (gx_color_index)0/*any*/); } else { gs_fixed_rect rect; gs_pattern2_instance_t *pinst = (gs_pattern2_instance_t *)pdevc->ccolor.pattern; rect.p.x = int2fixed(x); rect.p.y = int2fixed(y); rect.q.x = int2fixed(x + w); rect.q.y = int2fixed(y + h); return gs_shading_do_fill_rectangle(pinst->templat.Shading, &rect, dev, (gs_gstate *)pinst->saved, !pinst->shfill); } } ",0 "static size_t in_get_buffer_size(const struct audio_stream *stream) { UNUSED(stream); FNLOG(); return 320; } ",0 "bool WallpaperManager::SetDeviceWallpaperIfApplicable( const AccountId& account_id) { std::string url; std::string hash; if (ShouldSetDeviceWallpaper(account_id, &url, &hash)) { base::PostTaskWithTraitsAndReplyWithResult( FROM_HERE, {base::MayBlock()}, base::Bind(&base::PathExists, GetDeviceWallpaperFilePath()), base::Bind(&WallpaperManager::OnDeviceWallpaperExists, weak_factory_.GetWeakPtr(), account_id, url, hash)); return true; } return false; } ",0 "string_strcasecmp (const char *string1, const char *string2) { int diff; if (!string1 || !string2) return (string1) ? 1 : ((string2) ? -1 : 0); while (string1[0] && string2[0]) { diff = utf8_charcasecmp (string1, string2); if (diff != 0) return diff; string1 = utf8_next_char (string1); string2 = utf8_next_char (string2); } return (string1[0]) ? 1 : ((string2[0]) ? -1 : 0); } ",0 "static void read_app(GDataInputStream* f, MenuCacheApp* app, MenuCache* cache) { char *line; gsize len; GString *str; /* generic name */ line = g_data_input_stream_read_line(f, &len, cache->cancellable, NULL); if(G_UNLIKELY(line == NULL)) return; if(G_LIKELY(len > 0)) app->generic_name = _unescape_lf(line); else g_free(line); /* exec */ line = g_data_input_stream_read_line(f, &len, cache->cancellable, NULL); if(G_UNLIKELY(line == NULL)) return; if(G_LIKELY(len > 0)) app->exec = _unescape_lf(line); else g_free(line); /* terminal / startup notify */ line = g_data_input_stream_read_line(f, &len, cache->cancellable, NULL); if(G_UNLIKELY(line == NULL)) return; app->flags = (guint32)atoi(line); g_free(line); /* ShowIn flags */ line = g_data_input_stream_read_line(f, &len, cache->cancellable, NULL); if(G_UNLIKELY(line == NULL)) return; app->show_in_flags = (guint32)atol(line); g_free(line); if (cache->version < 2) return; /* TryExec */ line = g_data_input_stream_read_line(f, &len, cache->cancellable, NULL); if (G_UNLIKELY(line == NULL)) return; if (G_LIKELY(len > 0)) app->try_exec = g_strchomp(line); else g_free(line); /* Path */ line = g_data_input_stream_read_line(f, &len, cache->cancellable, NULL); if (G_UNLIKELY(line == NULL)) return; if (G_LIKELY(len > 0)) app->working_dir = line; else g_free(line); /* Categories */ line = g_data_input_stream_read_line(f, &len, cache->cancellable, NULL); if (G_UNLIKELY(line == NULL)) return; if (G_LIKELY(len > 0)) { const char **x; /* split and intern all the strings so categories can be processed later for search doing g_quark_try_string()+g_quark_to_string() */ app->categories = x = (const char **)g_strsplit(line, "";"", 0); while (*x != NULL) { char *cat = (char *)*x; *x = g_intern_string(cat); g_free(cat); x++; } } g_free(line); /* Keywords */ str = g_string_new(MENU_CACHE_ITEM(app)->name); if (G_LIKELY(app->exec != NULL)) { char *sp = strchr(app->exec, ' '); char *bn = strrchr(app->exec, G_DIR_SEPARATOR); g_string_append_c(str, ','); if (bn == NULL && sp == NULL) g_string_append(str, app->exec); else if (bn == NULL || (sp != NULL && sp < bn)) g_string_append_len(str, app->exec, sp - app->exec); else if (sp == NULL) g_string_append(str, &bn[1]); else g_string_append_len(str, &bn[1], sp - &bn[1]); } if (app->generic_name != NULL) { g_string_append_c(str, ','); g_string_append(str, app->generic_name); } line = g_data_input_stream_read_line(f, &len, cache->cancellable, NULL); if (G_UNLIKELY(line == NULL)) return; if (len > 0) { g_string_append_c(str, ','); g_string_append(str, line); } app->keywords = g_utf8_casefold(str->str, str->len); g_string_free(str, TRUE); g_free(line); } ",0 "channel_request_start(int id, char *service, int wantconfirm) { Channel *c = channel_lookup(id); if (c == NULL) { logit(""channel_request_start: %d: unknown channel id"", id); return; } debug2(""channel %d: request %s confirm %d"", id, service, wantconfirm); packet_start(SSH2_MSG_CHANNEL_REQUEST); packet_put_int(c->remote_id); packet_put_cstring(service); packet_put_char(wantconfirm); } ",0 "void WebURLLoaderImpl::Context::OnDownloadedData(int len) { if (client_) client_->didDownloadData(loader_, len); } ",0 "static int atl2_nway_reset(struct net_device *netdev) { struct atl2_adapter *adapter = netdev_priv(netdev); if (netif_running(netdev)) atl2_reinit_locked(adapter); return 0; } ",0 "add_restore_pending_to_transaction (BusTransaction *transaction, BusPendingActivation *pending_activation) { RestorePendingData *d; d = dbus_new (RestorePendingData, 1); if (d == NULL) return FALSE; d->pending_activation = pending_activation; d->hash_entry = _dbus_hash_table_preallocate_entry (d->pending_activation->activation->pending_activations); bus_pending_activation_ref (d->pending_activation); if (d->hash_entry == NULL || !bus_transaction_add_cancel_hook (transaction, restore_pending, d, free_pending_restore_data)) { free_pending_restore_data (d); return FALSE; } _dbus_verbose (""Saved pending activation to be restored if the transaction fails\n""); return TRUE; } ",0 "void DispatchCompositionUpdateEvent(LocalFrame& frame, const String& text) { Element* target = frame.GetDocument()->FocusedElement(); if (!target) return; CompositionEvent* event = CompositionEvent::Create( EventTypeNames::compositionupdate, frame.DomWindow(), text); target->DispatchEvent(event); } ",0 "bool WebContentsImpl::IsShowingContextMenuOnPage() const { return showing_context_menu_; } ",0 "FontFileSortDir(FontDirectoryPtr dir) { FontFileSortTable (&dir->scalable); FontFileSortTable (&dir->nonScalable); /* now that the table is fixed in size, swizzle the pointers */ FontFileSwitchStringsToBitmapPointers (dir); } ",0 "const AtomicString& HTMLStyleElement::type() const { return getAttribute(typeAttr); } ",0 "static void reds_set_mouse_mode(uint32_t mode) { if (reds->mouse_mode == mode) { return; } reds->mouse_mode = mode; red_dispatcher_set_mouse_mode(reds->mouse_mode); main_channel_push_mouse_mode(reds->main_channel, reds->mouse_mode, reds->is_client_mouse_allowed); } ",0 "base::Optional FrameSelection::LayoutSelectionEnd() const { return layout_selection_->SelectionEnd(); } ",0 "size_t bgp_packet_mpunreach_start(struct stream *s, afi_t afi, safi_t safi) { unsigned long attrlen_pnt; iana_afi_t pkt_afi; iana_safi_t pkt_safi; /* Set extended bit always to encode the attribute length as 2 bytes */ stream_putc(s, BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_EXTLEN); stream_putc(s, BGP_ATTR_MP_UNREACH_NLRI); attrlen_pnt = stream_get_endp(s); stream_putw(s, 0); /* Length of this attribute. */ /* Convert AFI, SAFI to values for packet. */ bgp_map_afi_safi_int2iana(afi, safi, &pkt_afi, &pkt_safi); stream_putw(s, pkt_afi); stream_putc(s, pkt_safi); return attrlen_pnt; } ",0 "static void dm_blk_close(struct gendisk *disk, fmode_t mode) { struct mapped_device *md; spin_lock(&_minor_lock); md = disk->private_data; if (WARN_ON(!md)) goto out; if (atomic_dec_and_test(&md->open_count) && (test_bit(DMF_DEFERRED_REMOVE, &md->flags))) queue_work(deferred_remove_workqueue, &deferred_remove_work); dm_put(md); out: spin_unlock(&_minor_lock); } ",0 "InfoBar* CreateAutofillCcInfoBar(ConfirmInfoBarDelegate* delegate) { DCHECK(delegate); return new SaveCCInfoConfirmInfoBar(delegate); } ",0 "ProcXvShmPutImage(ClientPtr client) { return BadImplementation; } ",0 " void unix_notinflight(struct file *fp) { struct sock *s = unix_get_socket(fp); if (s) { struct unix_sock *u = unix_sk(s); spin_lock(&unix_gc_lock); BUG_ON(list_empty(&u->link)); if (atomic_long_dec_and_test(&u->inflight)) list_del_init(&u->link); unix_tot_inflight--; spin_unlock(&unix_gc_lock); } } ",1 "static int caif_create(struct net *net, struct socket *sock, int protocol, int kern) { struct sock *sk = NULL; struct caifsock *cf_sk = NULL; static struct proto prot = {.name = ""PF_CAIF"", .owner = THIS_MODULE, .obj_size = sizeof(struct caifsock), }; if (!capable(CAP_SYS_ADMIN) && !capable(CAP_NET_ADMIN)) return -EPERM; /* * The sock->type specifies the socket type to use. * The CAIF socket is a packet stream in the sense * that it is packet based. CAIF trusts the reliability * of the link, no resending is implemented. */ if (sock->type == SOCK_SEQPACKET) sock->ops = &caif_seqpacket_ops; else if (sock->type == SOCK_STREAM) sock->ops = &caif_stream_ops; else return -ESOCKTNOSUPPORT; if (protocol < 0 || protocol >= CAIFPROTO_MAX) return -EPROTONOSUPPORT; /* * Set the socket state to unconnected. The socket state * is really not used at all in the net/core or socket.c but the * initialization makes sure that sock->state is not uninitialized. */ sk = sk_alloc(net, PF_CAIF, GFP_KERNEL, &prot); if (!sk) return -ENOMEM; cf_sk = container_of(sk, struct caifsock, sk); /* Store the protocol */ sk->sk_protocol = (unsigned char) protocol; /* Initialize default priority for well-known cases */ switch (protocol) { case CAIFPROTO_AT: sk->sk_priority = TC_PRIO_CONTROL; break; case CAIFPROTO_RFM: sk->sk_priority = TC_PRIO_INTERACTIVE_BULK; break; default: sk->sk_priority = TC_PRIO_BESTEFFORT; } /* * Lock in order to try to stop someone from opening the socket * too early. */ lock_sock(&(cf_sk->sk)); /* Initialize the nozero default sock structure data. */ sock_init_data(sock, sk); sk->sk_destruct = caif_sock_destructor; mutex_init(&cf_sk->readlock); /* single task reading lock */ cf_sk->layer.ctrlcmd = caif_ctrl_cb; cf_sk->sk.sk_socket->state = SS_UNCONNECTED; cf_sk->sk.sk_state = CAIF_DISCONNECTED; set_tx_flow_off(cf_sk); set_rx_flow_on(cf_sk); /* Set default options on configuration */ cf_sk->conn_req.link_selector = CAIF_LINK_LOW_LATENCY; cf_sk->conn_req.protocol = protocol; release_sock(&cf_sk->sk); return 0; } ",0 "static void pvclock_update_vm_gtod_copy(struct kvm *kvm) { #ifdef CONFIG_X86_64 struct kvm_arch *ka = &kvm->arch; int vclock_mode; bool host_tsc_clocksource, vcpus_matched; vcpus_matched = (ka->nr_vcpus_matched_tsc + 1 == atomic_read(&kvm->online_vcpus)); /* * If the host uses TSC clock, then passthrough TSC as stable * to the guest. */ host_tsc_clocksource = kvm_get_time_and_clockread( &ka->master_kernel_ns, &ka->master_cycle_now); ka->use_master_clock = host_tsc_clocksource & vcpus_matched; if (ka->use_master_clock) atomic_set(&kvm_guest_has_master_clock, 1); vclock_mode = pvclock_gtod_data.clock.vclock_mode; trace_kvm_update_master_clock(ka->use_master_clock, vclock_mode, vcpus_matched); #endif } ",0 "void ConvertRGB32ToYUV(const uint8* rgbframe, uint8* yplane, uint8* uplane, uint8* vplane, int width, int height, int rgbstride, int ystride, int uvstride) { static void (*convert_proc)(const uint8*, uint8*, uint8*, uint8*, int, int, int, int, int) = NULL; if (!convert_proc) { #if defined(ARCH_CPU_ARM_FAMILY) convert_proc = &ConvertRGB32ToYUV_C; #else if (hasSSE2()) convert_proc = &ConvertRGB32ToYUV_SSE2; else convert_proc = &ConvertRGB32ToYUV_C; #endif } convert_proc(rgbframe, yplane, uplane, vplane, width, height, rgbstride, ystride, uvstride); } ",0 "void RenderFrameImpl::OnHostZoomClientRequest( mojom::HostZoomAssociatedRequest request) { DCHECK(!host_zoom_binding_.is_bound()); host_zoom_binding_.Bind(std::move(request)); } ",0 "static struct nfs4_unlockdata *nfs4_alloc_unlockdata(struct file_lock *fl, struct nfs_open_context *ctx, struct nfs4_lock_state *lsp, struct nfs_seqid *seqid) { struct nfs4_unlockdata *p; struct inode *inode = lsp->ls_state->inode; p = kmalloc(sizeof(*p), GFP_KERNEL); if (p == NULL) return NULL; p->arg.fh = NFS_FH(inode); p->arg.fl = &p->fl; p->arg.seqid = seqid; p->res.seqid = seqid; p->arg.stateid = &lsp->ls_stateid; p->lsp = lsp; atomic_inc(&lsp->ls_count); /* Ensure we don't close file until we're done freeing locks! */ p->ctx = get_nfs_open_context(ctx); memcpy(&p->fl, fl, sizeof(p->fl)); p->server = NFS_SERVER(inode); return p; } ",0 "void GLES2DecoderImpl::DeleteFramebuffersHelper( GLsizei n, const volatile GLuint* client_ids) { for (GLsizei ii = 0; ii < n; ++ii) { GLuint client_id = client_ids[ii]; Framebuffer* framebuffer = GetFramebuffer(client_id); if (framebuffer && !framebuffer->IsDeleted()) { if (framebuffer == framebuffer_state_.bound_draw_framebuffer.get()) { GLenum target = GetDrawFramebufferTarget(); if (workarounds().unbind_attachments_on_bound_render_fbo_delete) framebuffer->DoUnbindGLAttachmentsForWorkaround(target); api()->glBindFramebufferEXTFn(target, GetBackbufferServiceId()); state_.UpdateWindowRectanglesForBoundDrawFramebufferClientID(0); framebuffer_state_.bound_draw_framebuffer = nullptr; framebuffer_state_.clear_state_dirty = true; } if (framebuffer == framebuffer_state_.bound_read_framebuffer.get()) { framebuffer_state_.bound_read_framebuffer = nullptr; GLenum target = GetReadFramebufferTarget(); api()->glBindFramebufferEXTFn(target, GetBackbufferServiceId()); } OnFboChanged(); RemoveFramebuffer(client_id); } } } ",0 "XSLTProcessor::~XSLTProcessor() { ASSERT(!m_stylesheetRootNode || !m_stylesheet || m_stylesheet->hasOneRef()); } ",0 "void mark_page_dirty_in_slot(struct kvm *kvm, struct kvm_memory_slot *memslot, gfn_t gfn) { if (memslot && memslot->dirty_bitmap) { unsigned long rel_gfn = gfn - memslot->base_gfn; set_bit_le(rel_gfn, memslot->dirty_bitmap); } } ",0 "static PolygonInfo *ConvertPathToPolygon(const PathInfo *path_info) { long direction, next_direction; PointInfo point, *points; PolygonInfo *polygon_info; SegmentInfo bounds; register ssize_t i, n; MagickBooleanType ghostline; size_t edge, number_edges, number_points; /* Convert a path to the more efficient sorted rendering form. */ polygon_info=(PolygonInfo *) AcquireMagickMemory(sizeof(*polygon_info)); if (polygon_info == (PolygonInfo *) NULL) return((PolygonInfo *) NULL); number_edges=16; polygon_info->edges=(EdgeInfo *) AcquireQuantumMemory(number_edges, sizeof(*polygon_info->edges)); if (polygon_info->edges == (EdgeInfo *) NULL) return((PolygonInfo *) NULL); (void) memset(polygon_info->edges,0,number_edges* sizeof(*polygon_info->edges)); direction=0; edge=0; ghostline=MagickFalse; n=0; number_points=0; points=(PointInfo *) NULL; (void) memset(&point,0,sizeof(point)); (void) memset(&bounds,0,sizeof(bounds)); polygon_info->edges[edge].number_points=(size_t) n; polygon_info->edges[edge].scanline=0.0; polygon_info->edges[edge].highwater=0; polygon_info->edges[edge].ghostline=ghostline; polygon_info->edges[edge].direction=(ssize_t) direction; polygon_info->edges[edge].points=points; polygon_info->edges[edge].bounds=bounds; polygon_info->number_edges=0; for (i=0; path_info[i].code != EndCode; i++) { if ((path_info[i].code == MoveToCode) || (path_info[i].code == OpenCode) || (path_info[i].code == GhostlineCode)) { /* Move to. */ if ((points != (PointInfo *) NULL) && (n >= 2)) { if (edge == number_edges) { number_edges<<=1; polygon_info->edges=(EdgeInfo *) ResizeQuantumMemory( polygon_info->edges,(size_t) number_edges, sizeof(*polygon_info->edges)); if (polygon_info->edges == (EdgeInfo *) NULL) return((PolygonInfo *) NULL); } polygon_info->edges[edge].number_points=(size_t) n; polygon_info->edges[edge].scanline=(-1.0); polygon_info->edges[edge].highwater=0; polygon_info->edges[edge].ghostline=ghostline; polygon_info->edges[edge].direction=(ssize_t) (direction > 0); if (direction < 0) ReversePoints(points,(size_t) n); polygon_info->edges[edge].points=points; polygon_info->edges[edge].bounds=bounds; polygon_info->edges[edge].bounds.y1=points[0].y; polygon_info->edges[edge].bounds.y2=points[n-1].y; points=(PointInfo *) NULL; ghostline=MagickFalse; edge++; } if (points == (PointInfo *) NULL) { number_points=16; points=(PointInfo *) AcquireQuantumMemory((size_t) number_points, sizeof(*points)); if (points == (PointInfo *) NULL) return((PolygonInfo *) NULL); } ghostline=path_info[i].code == GhostlineCode ? MagickTrue : MagickFalse; point=path_info[i].point; points[0]=point; bounds.x1=point.x; bounds.x2=point.x; direction=0; n=1; continue; } /* Line to. */ next_direction=((path_info[i].point.y > point.y) || ((fabs(path_info[i].point.y-point.y) < MagickEpsilon) && (path_info[i].point.x > point.x))) ? 1 : -1; if ((points != (PointInfo *) NULL) && (direction != 0) && (direction != next_direction)) { /* New edge. */ point=points[n-1]; if (edge == number_edges) { number_edges<<=1; polygon_info->edges=(EdgeInfo *) ResizeQuantumMemory( polygon_info->edges,(size_t) number_edges, sizeof(*polygon_info->edges)); if (polygon_info->edges == (EdgeInfo *) NULL) return((PolygonInfo *) NULL); } polygon_info->edges[edge].number_points=(size_t) n; polygon_info->edges[edge].scanline=(-1.0); polygon_info->edges[edge].highwater=0; polygon_info->edges[edge].ghostline=ghostline; polygon_info->edges[edge].direction=(ssize_t) (direction > 0); if (direction < 0) ReversePoints(points,(size_t) n); polygon_info->edges[edge].points=points; polygon_info->edges[edge].bounds=bounds; polygon_info->edges[edge].bounds.y1=points[0].y; polygon_info->edges[edge].bounds.y2=points[n-1].y; number_points=16; points=(PointInfo *) AcquireQuantumMemory((size_t) number_points, sizeof(*points)); if (points == (PointInfo *) NULL) return((PolygonInfo *) NULL); n=1; ghostline=MagickFalse; points[0]=point; bounds.x1=point.x; bounds.x2=point.x; edge++; } direction=next_direction; if (points == (PointInfo *) NULL) continue; if (n == (ssize_t) number_points) { number_points<<=1; points=(PointInfo *) ResizeQuantumMemory(points,(size_t) number_points, sizeof(*points)); if (points == (PointInfo *) NULL) return((PolygonInfo *) NULL); } point=path_info[i].point; points[n]=point; if (point.x < bounds.x1) bounds.x1=point.x; if (point.x > bounds.x2) bounds.x2=point.x; n++; } if (points != (PointInfo *) NULL) { if (n < 2) points=(PointInfo *) RelinquishMagickMemory(points); else { if (edge == number_edges) { number_edges<<=1; polygon_info->edges=(EdgeInfo *) ResizeQuantumMemory( polygon_info->edges,(size_t) number_edges, sizeof(*polygon_info->edges)); if (polygon_info->edges == (EdgeInfo *) NULL) return((PolygonInfo *) NULL); } polygon_info->edges[edge].number_points=(size_t) n; polygon_info->edges[edge].scanline=(-1.0); polygon_info->edges[edge].highwater=0; polygon_info->edges[edge].ghostline=ghostline; polygon_info->edges[edge].direction=(ssize_t) (direction > 0); if (direction < 0) ReversePoints(points,(size_t) n); polygon_info->edges[edge].points=points; polygon_info->edges[edge].bounds=bounds; polygon_info->edges[edge].bounds.y1=points[0].y; polygon_info->edges[edge].bounds.y2=points[n-1].y; ghostline=MagickFalse; edge++; } } polygon_info->number_edges=edge; qsort(polygon_info->edges,(size_t) polygon_info->number_edges, sizeof(*polygon_info->edges),DrawCompareEdges); if (IsEventLogging() != MagickFalse) LogPolygonInfo(polygon_info); return(polygon_info); } ",0 "void AutofillManager::GetAvailableSuggestions( const FormData& form, const FormFieldData& field, std::vector* suggestions, SuggestionsContext* context) { DCHECK(suggestions); DCHECK(context); bool is_autofill_possible = RefreshDataModels(); bool got_autofillable_form = GetCachedFormAndField(form, field, &context->form_structure, &context->focused_field) && context->form_structure->ShouldBeParsed(); if (got_autofillable_form) { if (context->focused_field->Type().group() == CREDIT_CARD) { context->is_filling_credit_card = true; driver()->DidInteractWithCreditCardForm(); credit_card_form_event_logger_->OnDidInteractWithAutofillableForm( context->form_structure->form_signature()); } else { address_form_event_logger_->OnDidInteractWithAutofillableForm( context->form_structure->form_signature()); } } context->is_context_secure = !IsFormNonSecure(form) || !base::FeatureList::IsEnabled( features::kAutofillRequireSecureCreditCardContext); if (!is_autofill_possible || !driver()->RendererIsAvailable() || !got_autofillable_form) return; context->is_autofill_available = true; if (context->is_filling_credit_card) { *suggestions = GetCreditCardSuggestions(field, context->focused_field->Type(), &context->is_all_server_suggestions); if (base::FeatureList::IsEnabled(kAutofillCreditCardAblationExperiment) && !suggestions->empty()) { context->suppress_reason = SuppressReason::kCreditCardsAblation; suggestions->clear(); return; } } else { if (!base::FeatureList::IsEnabled(kAutofillAlwaysFillAddresses) && IsDesktopPlatform() && !field.should_autocomplete) { context->suppress_reason = SuppressReason::kAutocompleteOff; return; } *suggestions = GetProfileSuggestions(*context->form_structure, field, *context->focused_field); } if (!suggestions->empty() && context->is_filling_credit_card && !context->is_context_secure) { Suggestion warning_suggestion( l10n_util::GetStringUTF16(IDS_AUTOFILL_WARNING_INSECURE_CONNECTION)); warning_suggestion.frontend_id = POPUP_ITEM_ID_INSECURE_CONTEXT_PAYMENT_DISABLED_MESSAGE; suggestions->assign(1, warning_suggestion); } else { context->section_has_autofilled_field = SectionHasAutofilledField( *context->form_structure, form, context->focused_field->section); if (context->section_has_autofilled_field) { std::set seen_values; for (auto iter = suggestions->begin(); iter != suggestions->end();) { if (!seen_values.insert(iter->value).second) { iter = suggestions->erase(iter); } else { iter->label.clear(); iter->icon.clear(); ++iter; } } } } } ",1 "int touch_file(const char *path, bool parents, usec_t stamp, uid_t uid, gid_t gid, mode_t mode) { _cleanup_close_ int fd; int r; assert(path); if (parents) mkdir_parents(path, 0755); fd = open(path, O_WRONLY|O_CREAT|O_CLOEXEC|O_NOCTTY, mode > 0 ? mode : 0644); if (fd < 0) return -errno; if (mode > 0) { r = fchmod(fd, mode); if (r < 0) return -errno; } if (uid != UID_INVALID || gid != GID_INVALID) { r = fchown(fd, uid, gid); if (r < 0) return -errno; } if (stamp != USEC_INFINITY) { struct timespec ts[2]; timespec_store(&ts[0], stamp); ts[1] = ts[0]; r = futimens(fd, ts); } else r = futimens(fd, NULL); if (r < 0) return -errno; return 0; } ",1 "static bool CheckMov(const uint8_t* buffer, int buffer_size) { RCHECK(buffer_size > 8); int offset = 0; int valid_top_level_boxes = 0; while (offset + 8 < buffer_size) { uint32_t atomsize = Read32(buffer + offset); uint32_t atomtype = Read32(buffer + offset + 4); switch (atomtype) { case TAG('f', 't', 'y', 'p'): case TAG('p', 'd', 'i', 'n'): case TAG('b', 'l', 'o', 'c'): case TAG('m', 'o', 'o', 'v'): case TAG('m', 'o', 'o', 'f'): case TAG('m', 'f', 'r', 'a'): case TAG('m', 'd', 'a', 't'): case TAG('f', 'r', 'e', 'e'): case TAG('s', 'k', 'i', 'p'): case TAG('m', 'e', 't', 'a'): case TAG('m', 'e', 'c', 'o'): case TAG('s', 't', 'y', 'p'): case TAG('s', 'i', 'd', 'x'): case TAG('s', 's', 'i', 'x'): case TAG('p', 'r', 'f', 't'): case TAG('u', 'u', 'i', 'd'): case TAG('e', 'm', 's', 'g'): ++valid_top_level_boxes; break; } if (atomsize == 1) { if (offset + 16 > buffer_size) break; if (Read32(buffer + offset + 8) != 0) break; // Offset is way past buffer size. atomsize = Read32(buffer + offset + 12); } if (atomsize == 0 || atomsize > static_cast(buffer_size)) break; // Indicates the last atom or length too big. offset += atomsize; } return valid_top_level_boxes >= 2; } ",0 "xmlParseName(xmlParserCtxtPtr ctxt) { const xmlChar *in; const xmlChar *ret; int count = 0; GROW; #ifdef DEBUG nbParseName++; #endif /* * Accelerator for simple ASCII names */ in = ctxt->input->cur; if (((*in >= 0x61) && (*in <= 0x7A)) || ((*in >= 0x41) && (*in <= 0x5A)) || (*in == '_') || (*in == ':')) { in++; while (((*in >= 0x61) && (*in <= 0x7A)) || ((*in >= 0x41) && (*in <= 0x5A)) || ((*in >= 0x30) && (*in <= 0x39)) || (*in == '_') || (*in == '-') || (*in == ':') || (*in == '.')) in++; if ((*in > 0) && (*in < 0x80)) { count = in - ctxt->input->cur; ret = xmlDictLookup(ctxt->dict, ctxt->input->cur, count); ctxt->input->cur = in; ctxt->nbChars += count; ctxt->input->col += count; if (ret == NULL) xmlErrMemory(ctxt, NULL); return(ret); } } /* accelerator for special cases */ return(xmlParseNameComplex(ctxt)); } ",0 "BGD_DECLARE(void) gdImageCharUp (gdImagePtr im, gdFontPtr f, int x, int y, int c, int color) { int cx, cy; int px, py; int fline; cx = 0; cy = 0; #ifdef CHARSET_EBCDIC c = ASC (c); #endif /*CHARSET_EBCDIC */ if ((c < f->offset) || (c >= (f->offset + f->nchars))) { return; } fline = (c - f->offset) * f->h * f->w; for (py = y; (py > (y - f->w)); py--) { for (px = x; (px < (x + f->h)); px++) { if (f->data[fline + cy * f->w + cx]) { gdImageSetPixel (im, px, py, color); } cy++; } cy = 0; cx++; } } ",0 "void PeopleHandler::HandleShowSetupUI(const base::ListValue* args) { AllowJavascript(); ProfileSyncService* service = GetSyncService(); if (unified_consent::IsUnifiedConsentFeatureEnabled()) { if (service && !sync_blocker_) sync_blocker_ = service->GetSetupInProgressHandle(); GetLoginUIService()->SetLoginUI(this); PushSyncPrefs(); return; } if (!service) { CloseUI(); return; } if (!SigninManagerFactory::GetForProfile(profile_)->IsAuthenticated()) { DLOG(WARNING) << ""Cannot display sync setup UI when not signed in""; CloseUI(); return; } GetLoginUIService()->SetLoginUI(this); if (!sync_blocker_) sync_blocker_ = service->GetSetupInProgressHandle(); if (sync_startup_tracker_) return; if (!service->IsEngineInitialized() || service->HasDisableReason( syncer::SyncService::DISABLE_REASON_USER_CHOICE)) { sync_startup_tracker_ = std::make_unique(profile_, this); service->RequestStart(); if (SyncStartupTracker::GetSyncServiceState(profile_) != SyncStartupTracker::SYNC_STARTUP_ERROR) { DisplaySpinner(); } return; } PushSyncPrefs(); } ",0 "get_lease(struct dhcp_lease *lease, const struct dhcp_message *dhcp) { struct timeval now; lease->cookie = dhcp->cookie; /* BOOTP does not set yiaddr for replies when ciaddr is set. */ if (dhcp->yiaddr) lease->addr.s_addr = dhcp->yiaddr; else lease->addr.s_addr = dhcp->ciaddr; if (get_option_addr(&lease->net, dhcp, DHO_SUBNETMASK) == -1) lease->net.s_addr = get_netmask(lease->addr.s_addr); if (get_option_addr(&lease->brd, dhcp, DHO_BROADCAST) == -1) lease->brd.s_addr = lease->addr.s_addr | ~lease->net.s_addr; if (get_option_uint32(&lease->leasetime, dhcp, DHO_LEASETIME) == 0) { /* Ensure that we can use the lease */ get_monotonic(&now); if (now.tv_sec + (time_t)lease->leasetime < now.tv_sec) lease->leasetime = ~0U; /* Infinite lease */ } else lease->leasetime = ~0U; /* Default to infinite lease */ if (get_option_uint32(&lease->renewaltime, dhcp, DHO_RENEWALTIME) != 0) lease->renewaltime = 0; if (get_option_uint32(&lease->rebindtime, dhcp, DHO_REBINDTIME) != 0) lease->rebindtime = 0; if (get_option_addr(&lease->server, dhcp, DHO_SERVERID) != 0) lease->server.s_addr = INADDR_ANY; } ",0 "mem_cgroup_zone_nr_lru_pages(struct mem_cgroup *memcg, int nid, int zid, unsigned int lru_mask) { struct mem_cgroup_per_zone *mz; enum lru_list l; unsigned long ret = 0; mz = mem_cgroup_zoneinfo(memcg, nid, zid); for_each_lru(l) { if (BIT(l) & lru_mask) ret += MEM_CGROUP_ZSTAT(mz, l); } return ret; } ",0 "static int blkcg_reset_stats(struct cgroup_subsys_state *css, struct cftype *cftype, u64 val) { struct blkcg *blkcg = css_to_blkcg(css); struct blkcg_gq *blkg; int i; mutex_lock(&blkcg_pol_mutex); spin_lock_irq(&blkcg->lock); /* * Note that stat reset is racy - it doesn't synchronize against * stat updates. This is a debug feature which shouldn't exist * anyway. If you get hit by a race, retry. */ hlist_for_each_entry(blkg, &blkcg->blkg_list, blkcg_node) { blkg_rwstat_reset(&blkg->stat_bytes); blkg_rwstat_reset(&blkg->stat_ios); for (i = 0; i < BLKCG_MAX_POLS; i++) { struct blkcg_policy *pol = blkcg_policy[i]; if (blkg->pd[i] && pol->pd_reset_stats_fn) pol->pd_reset_stats_fn(blkg->pd[i]); } } spin_unlock_irq(&blkcg->lock); mutex_unlock(&blkcg_pol_mutex); return 0; } ",0 "bool Textfield::SetSelectionRange(const gfx::Range& range) { if (!ImeEditingAllowed() || !range.IsValid()) return false; OnBeforeUserAction(); SelectRange(range); OnAfterUserAction(); return true; } ",0 "SVGSVGElement* SVGDocumentExtensions::rootElement() const { ASSERT(m_document); return rootElement(*m_document); } ",0 " HistoryService* history_service() { return history_service_.get(); } ",0 "void WebContentsImpl::NotifyManifestUrlChanged( const base::Optional& manifest_url) { for (auto& observer : observers_) observer.DidUpdateWebManifestURL(manifest_url); } ",0 "void WebLocalFrameImpl::UsageCountChromeLoadTimes(const WebString& metric) { WebFeature feature = WebFeature::kChromeLoadTimesUnknown; if (metric == ""requestTime"") { feature = WebFeature::kChromeLoadTimesRequestTime; } else if (metric == ""startLoadTime"") { feature = WebFeature::kChromeLoadTimesStartLoadTime; } else if (metric == ""commitLoadTime"") { feature = WebFeature::kChromeLoadTimesCommitLoadTime; } else if (metric == ""finishDocumentLoadTime"") { feature = WebFeature::kChromeLoadTimesFinishDocumentLoadTime; } else if (metric == ""finishLoadTime"") { feature = WebFeature::kChromeLoadTimesFinishLoadTime; } else if (metric == ""firstPaintTime"") { feature = WebFeature::kChromeLoadTimesFirstPaintTime; } else if (metric == ""firstPaintAfterLoadTime"") { feature = WebFeature::kChromeLoadTimesFirstPaintAfterLoadTime; } else if (metric == ""navigationType"") { feature = WebFeature::kChromeLoadTimesNavigationType; } else if (metric == ""wasFetchedViaSpdy"") { feature = WebFeature::kChromeLoadTimesWasFetchedViaSpdy; } else if (metric == ""wasNpnNegotiated"") { feature = WebFeature::kChromeLoadTimesWasNpnNegotiated; } else if (metric == ""npnNegotiatedProtocol"") { feature = WebFeature::kChromeLoadTimesNpnNegotiatedProtocol; } else if (metric == ""wasAlternateProtocolAvailable"") { feature = WebFeature::kChromeLoadTimesWasAlternateProtocolAvailable; } else if (metric == ""connectionInfo"") { feature = WebFeature::kChromeLoadTimesConnectionInfo; } UseCounter::Count(GetFrame(), feature); } ",0 "static int udf_CS0toNLS(struct nls_table *nls, struct ustr *utf_o, const struct ustr *ocu_i) { const uint8_t *ocu; uint8_t cmp_id, ocu_len; int i, len; ocu_len = ocu_i->u_len; if (ocu_len == 0) { memset(utf_o, 0, sizeof(struct ustr)); return 0; } cmp_id = ocu_i->u_cmpID; if (cmp_id != 8 && cmp_id != 16) { memset(utf_o, 0, sizeof(struct ustr)); pr_err(""unknown compression code (%d) stri=%s\n"", cmp_id, ocu_i->u_name); return 0; } ocu = ocu_i->u_name; utf_o->u_len = 0; for (i = 0; (i < ocu_len) && (utf_o->u_len <= (UDF_NAME_LEN - 3));) { /* Expand OSTA compressed Unicode to Unicode */ uint32_t c = ocu[i++]; if (cmp_id == 16) c = (c << 8) | ocu[i++]; len = nls->uni2char(c, &utf_o->u_name[utf_o->u_len], UDF_NAME_LEN - utf_o->u_len); /* Valid character? */ if (len >= 0) utf_o->u_len += len; else utf_o->u_name[utf_o->u_len++] = '?'; } utf_o->u_cmpID = 8; return utf_o->u_len; } ",0 "static void create_details_treeview(void) { GtkCellRenderer *renderer; GtkTreeViewColumn *column; renderer = gtk_cell_renderer_toggle_new(); column = gtk_tree_view_column_new_with_attributes( _(""Include""), renderer, /* which ""attr"" of renderer to set from which COLUMN? (can be repeated) */ ""active"", DETAIL_COLUMN_CHECKBOX, NULL); g_tv_details_col_checkbox = column; gtk_tree_view_append_column(g_tv_details, column); /* This column has a handler */ g_signal_connect(renderer, ""toggled"", G_CALLBACK(g_tv_details_checkbox_toggled), NULL); renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes( _(""Name""), renderer, ""text"", DETAIL_COLUMN_NAME, NULL); gtk_tree_view_append_column(g_tv_details, column); /* This column has a clickable header for sorting */ gtk_tree_view_column_set_sort_column_id(column, DETAIL_COLUMN_NAME); g_tv_details_renderer_value = renderer = gtk_cell_renderer_text_new(); g_signal_connect(renderer, ""edited"", G_CALLBACK(save_edited_one_liner), NULL); column = gtk_tree_view_column_new_with_attributes( _(""Value""), renderer, ""text"", DETAIL_COLUMN_VALUE, NULL); gtk_tree_view_append_column(g_tv_details, column); /* This column has a clickable header for sorting */ gtk_tree_view_column_set_sort_column_id(column, DETAIL_COLUMN_VALUE); /* renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes( _(""Path""), renderer, ""text"", DETAIL_COLUMN_PATH, NULL); gtk_tree_view_append_column(g_tv_details, column); */ g_ls_details = gtk_list_store_new(DETAIL_NUM_COLUMNS, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING); gtk_tree_view_set_model(g_tv_details, GTK_TREE_MODEL(g_ls_details)); g_signal_connect(g_tv_details, ""row-activated"", G_CALLBACK(tv_details_row_activated), NULL); g_signal_connect(g_tv_details, ""cursor-changed"", G_CALLBACK(tv_details_cursor_changed), NULL); /* [Enter] on a row: * g_signal_connect(g_tv_details, ""select-cursor-row"", G_CALLBACK(tv_details_select_cursor_row), NULL); */ } ",0 "void *Type_Signature_Read(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cmsUInt32Number* nItems, cmsUInt32Number SizeOfTag) { cmsSignature* SigPtr = (cmsSignature*) _cmsMalloc(self ->ContextID, sizeof(cmsSignature)); if (SigPtr == NULL) return NULL; if (!_cmsReadUInt32Number(io, SigPtr)) return NULL; *nItems = 1; return SigPtr; cmsUNUSED_PARAMETER(SizeOfTag); } ",0 " SyncManager::ExtraPasswordChangeRecordData::unencrypted() const { return unencrypted_; } ",0 "bool ChromeContentBrowserClient::ShouldEnableStrictSiteIsolation() { return base::FeatureList::IsEnabled(features::kSitePerProcess); } ",0 "set_saved_history () { /* XXX - compensate for assumption that history was `shuffled' if it was actually not. */ if (HISTORY_FULL () && hist_last_line_added == 0 && saved_history_line_to_use < history_length - 1) saved_history_line_to_use++; if (saved_history_line_to_use >= 0) { rl_get_previous_history (history_length - saved_history_line_to_use, 0); last_saved_history_line = saved_history_line_to_use; } saved_history_line_to_use = -1; rl_startup_hook = old_rl_startup_hook; return (0); } ",0 "static void update_changeattr(struct inode *dir, struct nfs4_change_info *cinfo) { struct nfs_inode *nfsi = NFS_I(dir); spin_lock(&dir->i_lock); nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA; if (!cinfo->atomic || cinfo->before != dir->i_version) nfs_force_lookup_revalidate(dir); dir->i_version = cinfo->after; spin_unlock(&dir->i_lock); } ",0 "int EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx) { if (group->meth->mul == 0) /* use default */ return ec_wNAF_precompute_mult(group, ctx); if (group->meth->precompute_mult != 0) return group->meth->precompute_mult(group, ctx); else return 1; /* nothing to do, so report success */ } ",0 " StateBase(v8::Handle composite, StateBase* next) : m_composite(composite) , m_next(next) { } ",0 "void mbedtls_ecdsa_init( mbedtls_ecdsa_context *ctx ) { ECDSA_VALIDATE( ctx != NULL ); mbedtls_ecp_keypair_init( ctx ); } ",0 "void HTMLFormControlElement::updateAncestorDisabledState() const { HTMLFieldSetElement* fieldSetAncestor = 0; ContainerNode* legendAncestor = 0; for (ContainerNode* ancestor = parentNode(); ancestor; ancestor = ancestor->parentNode()) { if (!legendAncestor && ancestor->hasTagName(legendTag)) legendAncestor = ancestor; if (ancestor->hasTagName(fieldsetTag)) { fieldSetAncestor = toHTMLFieldSetElement(ancestor); break; } } m_ancestorDisabledState = (fieldSetAncestor && fieldSetAncestor->isDisabledFormControl() && !(legendAncestor && legendAncestor == fieldSetAncestor->legend())) ? AncestorDisabledStateDisabled : AncestorDisabledStateEnabled; } ",0 "static hb_font_t *get_hb_font(ASS_Shaper *shaper, GlyphInfo *info) { ASS_Font *font = info->font; hb_font_t **hb_fonts; if (!font->shaper_priv) font->shaper_priv = calloc(sizeof(ASS_ShaperFontData), 1); hb_fonts = font->shaper_priv->fonts; if (!hb_fonts[info->face_index]) { hb_fonts[info->face_index] = hb_ft_font_create(font->faces[info->face_index], NULL); font->shaper_priv->metrics_data[info->face_index] = calloc(sizeof(struct ass_shaper_metrics_data), 1); struct ass_shaper_metrics_data *metrics = font->shaper_priv->metrics_data[info->face_index]; metrics->metrics_cache = shaper->metrics_cache; metrics->vertical = info->font->desc.vertical; hb_font_funcs_t *funcs = hb_font_funcs_create(); font->shaper_priv->font_funcs[info->face_index] = funcs; hb_font_funcs_set_glyph_func(funcs, get_glyph, metrics, NULL); hb_font_funcs_set_glyph_h_advance_func(funcs, cached_h_advance, metrics, NULL); hb_font_funcs_set_glyph_v_advance_func(funcs, cached_v_advance, metrics, NULL); hb_font_funcs_set_glyph_h_origin_func(funcs, cached_h_origin, metrics, NULL); hb_font_funcs_set_glyph_v_origin_func(funcs, cached_v_origin, metrics, NULL); hb_font_funcs_set_glyph_h_kerning_func(funcs, get_h_kerning, metrics, NULL); hb_font_funcs_set_glyph_v_kerning_func(funcs, get_v_kerning, metrics, NULL); hb_font_funcs_set_glyph_extents_func(funcs, cached_extents, metrics, NULL); hb_font_funcs_set_glyph_contour_point_func(funcs, get_contour_point, metrics, NULL); hb_font_set_funcs(hb_fonts[info->face_index], funcs, font->faces[info->face_index], NULL); } ass_face_set_size(font->faces[info->face_index], info->font_size); update_hb_size(hb_fonts[info->face_index], font->faces[info->face_index]); struct ass_shaper_metrics_data *metrics = font->shaper_priv->metrics_data[info->face_index]; metrics->hash_key.font = info->font; metrics->hash_key.face_index = info->face_index; metrics->hash_key.size = info->font_size; metrics->hash_key.scale_x = double_to_d6(info->scale_x); metrics->hash_key.scale_y = double_to_d6(info->scale_y); return hb_fonts[info->face_index]; } ",0 "bool HTMLAnchorElement::hasRel(uint32_t relation) const { return m_linkRelations & relation; } ",0 "static int show_pid_map(struct seq_file *m, void *v) { return show_map(m, v, 1); } ",0 "static void cpu_clock_event_start(struct perf_event *event, int flags) { local64_set(&event->hw.prev_count, local_clock()); perf_swevent_start_hrtimer(event); } ",0 "bool BlinkTestRunner::AllowExternalPages() { return test_config_.allow_external_pages; } ",0 "static struct tevent_req *smbXcli_negprot_smb1_subreq(struct smbXcli_negprot_state *state) { size_t i; DATA_BLOB bytes = data_blob_null; uint8_t flags; uint16_t flags2; /* setup the protocol strings */ for (i=0; i < ARRAY_SIZE(smb1cli_prots); i++) { uint8_t c = 2; bool ok; if (smb1cli_prots[i].proto < state->conn->min_protocol) { continue; } if (smb1cli_prots[i].proto > state->conn->max_protocol) { continue; } ok = data_blob_append(state, &bytes, &c, sizeof(c)); if (!ok) { return NULL; } /* * We now it is already ascii and * we want NULL termination. */ ok = data_blob_append(state, &bytes, smb1cli_prots[i].smb1_name, strlen(smb1cli_prots[i].smb1_name)+1); if (!ok) { return NULL; } } smb1cli_req_flags(state->conn->max_protocol, state->conn->smb1.client.capabilities, SMBnegprot, 0, 0, &flags, 0, 0, &flags2); return smb1cli_req_send(state, state->ev, state->conn, SMBnegprot, flags, ~flags, flags2, ~flags2, state->timeout_msec, 0xFFFE, 0, NULL, /* pid, tid, session */ 0, NULL, /* wct, vwv */ bytes.length, bytes.data); } ",0 "void WebGL2RenderingContextBase::uniform1iv( const WebGLUniformLocation* location, Vector& v, GLuint src_offset, GLuint src_length) { if (isContextLost() || !ValidateUniformParameters(""uniform1iv"", location, v.data(), v.size(), 1, src_offset, src_length)) return; ContextGL()->Uniform1iv(location->Location(), src_length ? src_length : (v.size() - src_offset), v.data() + src_offset); } ",0 "static void _6502_anal_esil_flags(RAnalOp *op, ut8 data0) { int enabled=0; char flag ='u'; switch(data0) { case 0x78: // sei enabled = 1; flag = 'I'; break; case 0x58: // cli enabled = 0; flag = 'I'; break; case 0x38: // sec enabled = 1; flag = 'C'; break; case 0x18: // clc enabled = 0; flag = 'C'; break; case 0xf8: // sed enabled = 1; flag = 'D'; break; case 0xd8: // cld enabled = 0; flag = 'D'; break; case 0xb8: // clv enabled = 0; flag = 'V'; break; break; } r_strbuf_setf (&op->esil, ""%d,%c,="", enabled, flag); } ",0 " static void TearDownTestCase() { io_runner.reset(); background_thread.reset(); scoped_task_environment.reset(); } ",0 "static int ext4_dx_add_entry(handle_t *handle, struct dentry *dentry, struct inode *inode) { struct dx_frame frames[2], *frame; struct dx_entry *entries, *at; struct dx_hash_info hinfo; struct buffer_head *bh; struct inode *dir = dentry->d_parent->d_inode; struct super_block *sb = dir->i_sb; struct ext4_dir_entry_2 *de; int err; frame = dx_probe(&dentry->d_name, dir, &hinfo, frames, &err); if (!frame) return err; entries = frame->entries; at = frame->at; if (!(bh = ext4_bread(handle, dir, dx_get_block(frame->at), 0, &err))) { if (!err) { err = -EIO; ext4_error(dir->i_sb, ""Directory hole detected on inode %lu\n"", dir->i_ino); } goto cleanup; } if (!buffer_verified(bh) && !ext4_dirent_csum_verify(dir, (struct ext4_dir_entry *)bh->b_data)) goto journal_error; set_buffer_verified(bh); BUFFER_TRACE(bh, ""get_write_access""); err = ext4_journal_get_write_access(handle, bh); if (err) goto journal_error; err = add_dirent_to_buf(handle, dentry, inode, NULL, bh); if (err != -ENOSPC) goto cleanup; /* Block full, should compress but for now just split */ dxtrace(printk(KERN_DEBUG ""using %u of %u node entries\n"", dx_get_count(entries), dx_get_limit(entries))); /* Need to split index? */ if (dx_get_count(entries) == dx_get_limit(entries)) { ext4_lblk_t newblock; unsigned icount = dx_get_count(entries); int levels = frame - frames; struct dx_entry *entries2; struct dx_node *node2; struct buffer_head *bh2; if (levels && (dx_get_count(frames->entries) == dx_get_limit(frames->entries))) { ext4_warning(sb, ""Directory index full!""); err = -ENOSPC; goto cleanup; } bh2 = ext4_append (handle, dir, &newblock, &err); if (!(bh2)) goto cleanup; node2 = (struct dx_node *)(bh2->b_data); entries2 = node2->entries; memset(&node2->fake, 0, sizeof(struct fake_dirent)); node2->fake.rec_len = ext4_rec_len_to_disk(sb->s_blocksize, sb->s_blocksize); BUFFER_TRACE(frame->bh, ""get_write_access""); err = ext4_journal_get_write_access(handle, frame->bh); if (err) goto journal_error; if (levels) { unsigned icount1 = icount/2, icount2 = icount - icount1; unsigned hash2 = dx_get_hash(entries + icount1); dxtrace(printk(KERN_DEBUG ""Split index %i/%i\n"", icount1, icount2)); BUFFER_TRACE(frame->bh, ""get_write_access""); /* index root */ err = ext4_journal_get_write_access(handle, frames[0].bh); if (err) goto journal_error; memcpy((char *) entries2, (char *) (entries + icount1), icount2 * sizeof(struct dx_entry)); dx_set_count(entries, icount1); dx_set_count(entries2, icount2); dx_set_limit(entries2, dx_node_limit(dir)); /* Which index block gets the new entry? */ if (at - entries >= icount1) { frame->at = at = at - entries - icount1 + entries2; frame->entries = entries = entries2; swap(frame->bh, bh2); } dx_insert_block(frames + 0, hash2, newblock); dxtrace(dx_show_index(""node"", frames[1].entries)); dxtrace(dx_show_index(""node"", ((struct dx_node *) bh2->b_data)->entries)); err = ext4_handle_dirty_dx_node(handle, dir, bh2); if (err) goto journal_error; brelse (bh2); } else { dxtrace(printk(KERN_DEBUG ""Creating second level index...\n"")); memcpy((char *) entries2, (char *) entries, icount * sizeof(struct dx_entry)); dx_set_limit(entries2, dx_node_limit(dir)); /* Set up root */ dx_set_count(entries, 1); dx_set_block(entries + 0, newblock); ((struct dx_root *) frames[0].bh->b_data)->info.indirect_levels = 1; /* Add new access path frame */ frame = frames + 1; frame->at = at = at - entries + entries2; frame->entries = entries = entries2; frame->bh = bh2; err = ext4_journal_get_write_access(handle, frame->bh); if (err) goto journal_error; } err = ext4_handle_dirty_dx_node(handle, dir, frames[0].bh); if (err) { ext4_std_error(inode->i_sb, err); goto cleanup; } } de = do_split(handle, dir, &bh, frame, &hinfo, &err); if (!de) goto cleanup; err = add_dirent_to_buf(handle, dentry, inode, de, bh); goto cleanup; journal_error: ext4_std_error(dir->i_sb, err); cleanup: if (bh) brelse(bh); dx_release(frames); return err; } ",0 "ebt_check_entry(struct ebt_entry *e, struct net *net, const struct ebt_table_info *newinfo, const char *name, unsigned int *cnt, struct ebt_cl_stack *cl_s, unsigned int udc_cnt) { struct ebt_entry_target *t; struct xt_target *target; unsigned int i, j, hook = 0, hookmask = 0; size_t gap; int ret; struct xt_mtchk_param mtpar; struct xt_tgchk_param tgpar; /* don't mess with the struct ebt_entries */ if (e->bitmask == 0) return 0; if (e->bitmask & ~EBT_F_MASK) { BUGPRINT(""Unknown flag for bitmask\n""); return -EINVAL; } if (e->invflags & ~EBT_INV_MASK) { BUGPRINT(""Unknown flag for inv bitmask\n""); return -EINVAL; } if ((e->bitmask & EBT_NOPROTO) && (e->bitmask & EBT_802_3)) { BUGPRINT(""NOPROTO & 802_3 not allowed\n""); return -EINVAL; } /* what hook do we belong to? */ for (i = 0; i < NF_BR_NUMHOOKS; i++) { if (!newinfo->hook_entry[i]) continue; if ((char *)newinfo->hook_entry[i] < (char *)e) hook = i; else break; } /* (1 << NF_BR_NUMHOOKS) tells the check functions the rule is on * a base chain */ if (i < NF_BR_NUMHOOKS) hookmask = (1 << hook) | (1 << NF_BR_NUMHOOKS); else { for (i = 0; i < udc_cnt; i++) if ((char *)(cl_s[i].cs.chaininfo) > (char *)e) break; if (i == 0) hookmask = (1 << hook) | (1 << NF_BR_NUMHOOKS); else hookmask = cl_s[i - 1].hookmask; } i = 0; mtpar.net = tgpar.net = net; mtpar.table = tgpar.table = name; mtpar.entryinfo = tgpar.entryinfo = e; mtpar.hook_mask = tgpar.hook_mask = hookmask; mtpar.family = tgpar.family = NFPROTO_BRIDGE; ret = EBT_MATCH_ITERATE(e, ebt_check_match, &mtpar, &i); if (ret != 0) goto cleanup_matches; j = 0; ret = EBT_WATCHER_ITERATE(e, ebt_check_watcher, &tgpar, &j); if (ret != 0) goto cleanup_watchers; t = (struct ebt_entry_target *)(((char *)e) + e->target_offset); gap = e->next_offset - e->target_offset; target = xt_request_find_target(NFPROTO_BRIDGE, t->u.name, 0); if (IS_ERR(target)) { ret = PTR_ERR(target); goto cleanup_watchers; } t->u.target = target; if (t->u.target == &ebt_standard_target) { if (gap < sizeof(struct ebt_standard_target)) { BUGPRINT(""Standard target size too big\n""); ret = -EFAULT; goto cleanup_watchers; } if (((struct ebt_standard_target *)t)->verdict < -NUM_STANDARD_TARGETS) { BUGPRINT(""Invalid standard target\n""); ret = -EFAULT; goto cleanup_watchers; } } else if (t->target_size > gap - sizeof(struct ebt_entry_target)) { module_put(t->u.target->me); ret = -EFAULT; goto cleanup_watchers; } tgpar.target = target; tgpar.targinfo = t->data; ret = xt_check_target(&tgpar, t->target_size, e->ethproto, e->invflags & EBT_IPROTO); if (ret < 0) { module_put(target->me); goto cleanup_watchers; } (*cnt)++; return 0; cleanup_watchers: EBT_WATCHER_ITERATE(e, ebt_cleanup_watcher, net, &j); cleanup_matches: EBT_MATCH_ITERATE(e, ebt_cleanup_match, net, &i); return ret; } ",0 "PassOwnPtr WebView::createDrawingAreaProxy() { if (useNewDrawingArea()) return DrawingAreaProxyImpl::create(m_page.get()); return ChunkedUpdateDrawingAreaProxy::create(this, m_page.get()); } ",0 "static void conditionalAttr3AttributeSetterCallback(v8::Local, v8::Local jsValue, const v8::PropertyCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMSetter""); TestObjectV8Internal::conditionalAttr3AttributeSetter(jsValue, info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "static enum test_return test_binary_flush(void) { return test_binary_flush_impl(""test_binary_flush"", PROTOCOL_BINARY_CMD_FLUSH); } ",0 " void ReopenDatabase() { session_helper_.set_service(NULL); profile()->set_session_service(NULL); SessionService* service = new SessionService(profile()); profile()->set_session_service(service); session_helper_.set_service(service); } ",0 "QueryManager::Query::~Query() { RunCallbacks(); if (manager_) { manager_->StopTracking(this); manager_ = NULL; } } ",0 "WebPageProxy* WebInspectorProxy::platformCreateInspectorPage() { ASSERT(m_page); ASSERT(!m_inspectorView); m_inspectorView = GTK_WIDGET(webkitWebViewBaseCreate(page()->process()->context(), inspectorPageGroup())); g_object_add_weak_pointer(G_OBJECT(m_inspectorView), reinterpret_cast(&m_inspectorView)); return webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(m_inspectorView)); } ",0 "static void vsock_connect_timeout(struct work_struct *work) { struct sock *sk; struct vsock_sock *vsk; vsk = container_of(work, struct vsock_sock, dwork.work); sk = sk_vsock(vsk); lock_sock(sk); if (sk->sk_state == SS_CONNECTING && (sk->sk_shutdown != SHUTDOWN_MASK)) { sk->sk_state = SS_UNCONNECTED; sk->sk_err = ETIMEDOUT; sk->sk_error_report(sk); } release_sock(sk); sock_put(sk); } ",0 "const AtomicString& TextTrack::SubtitlesKeyword() { DEFINE_STATIC_LOCAL(const AtomicString, subtitles, (""subtitles"")); return subtitles; } ",0 "static int nfs4_setup_session_slot_tables(struct nfs4_session *ses) { struct nfs4_slot_table *tbl; int status; dprintk(""--> %s\n"", __func__); /* Fore channel */ tbl = &ses->fc_slot_table; status = nfs4_realloc_slot_table(tbl, ses->fc_attrs.max_reqs, 1); if (status) /* -ENOMEM */ return status; /* Back channel */ tbl = &ses->bc_slot_table; status = nfs4_realloc_slot_table(tbl, ses->bc_attrs.max_reqs, 0); if (status && tbl->slots == NULL) /* Fore and back channel share a connection so get * both slot tables or neither */ nfs4_destroy_slot_tables(ses); return status; } ",0 "static int ecp_safe_invert_jac( const mbedtls_ecp_group *grp, mbedtls_ecp_point *Q, unsigned char inv ) { int ret; unsigned char nonzero; mbedtls_mpi mQY; mbedtls_mpi_init( &mQY ); /* Use the fact that -Q.Y mod P = P - Q.Y unless Q.Y == 0 */ MBEDTLS_MPI_CHK( mbedtls_mpi_sub_mpi( &mQY, &grp->P, &Q->Y ) ); nonzero = mbedtls_mpi_cmp_int( &Q->Y, 0 ) != 0; MBEDTLS_MPI_CHK( mbedtls_mpi_safe_cond_assign( &Q->Y, &mQY, inv & nonzero ) ); cleanup: mbedtls_mpi_free( &mQY ); return( ret ); } ",0 "static void ax25_fillin_cb_from_dev(ax25_cb *ax25, ax25_dev *ax25_dev) { ax25->rtt = msecs_to_jiffies(ax25_dev->values[AX25_VALUES_T1]) / 2; ax25->t1 = msecs_to_jiffies(ax25_dev->values[AX25_VALUES_T1]); ax25->t2 = msecs_to_jiffies(ax25_dev->values[AX25_VALUES_T2]); ax25->t3 = msecs_to_jiffies(ax25_dev->values[AX25_VALUES_T3]); ax25->n2 = ax25_dev->values[AX25_VALUES_N2]; ax25->paclen = ax25_dev->values[AX25_VALUES_PACLEN]; ax25->idle = msecs_to_jiffies(ax25_dev->values[AX25_VALUES_IDLE]); ax25->backoff = ax25_dev->values[AX25_VALUES_BACKOFF]; if (ax25_dev->values[AX25_VALUES_AXDEFMODE]) { ax25->modulus = AX25_EMODULUS; ax25->window = ax25_dev->values[AX25_VALUES_EWINDOW]; } else { ax25->modulus = AX25_MODULUS; ax25->window = ax25_dev->values[AX25_VALUES_WINDOW]; } } ",0 "static int vcpu_stat_get_per_vm(void *data, u64 *val) { int i; struct kvm_stat_data *stat_data = (struct kvm_stat_data *)data; struct kvm_vcpu *vcpu; *val = 0; kvm_for_each_vcpu(i, vcpu, stat_data->kvm) *val += *(u64 *)((void *)vcpu + stat_data->offset); return 0; } ",0 "isofile_add_entry(struct iso9660 *iso9660, struct isofile *file) { file->allnext = NULL; *iso9660->all_file_list.last = file; iso9660->all_file_list.last = &(file->allnext); } ",0 "void Browser::OpenLanguageOptionsDialog() { UserMetrics::RecordAction(UserMetricsAction(""OpenLanguageOptionsDialog""), profile_); ShowOptionsTab(chrome::kLanguageOptionsSubPage); } ",0 "void WebGraphicsContext3DCommandBufferImpl::deleteTexture(WebGLId texture) { gl_->DeleteTextures(1, &texture); } ",0 "void RenderFrameHostImpl::SetAccessibilityCallbackForTesting( const AccessibilityCallbackForTesting& callback) { accessibility_testing_callback_ = callback; } ",0 "FilterRawEvents(const ClientPtr client, const GrabPtr grab, WindowPtr root) { XIClientPtr client_xi_version; int cmp; /* device not grabbed -> don't filter */ if (!grab) return FALSE; client_xi_version = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey); cmp = version_compare(client_xi_version->major_version, client_xi_version->minor_version, 2, 0); /* XI 2.0: if device is grabbed, skip XI 2.1: if device is grabbed by us, skip, we've already delivered */ if (cmp == 0) return TRUE; return (grab->window != root) ? FALSE : SameClient(grab, client); } ",0 "static int l2tp_ip6_disconnect(struct sock *sk, int flags) { if (sock_flag(sk, SOCK_ZAPPED)) return 0; return udp_disconnect(sk, flags); } ",0 "static __init void intel_nehalem_quirk(void) { union cpuid10_ebx ebx; ebx.full = x86_pmu.events_maskl; if (ebx.split.no_branch_misses_retired) { /* * Erratum AAJ80 detected, we work it around by using * the BR_MISP_EXEC.ANY event. This will over-count * branch-misses, but it's still much better than the * architectural event which is often completely bogus: */ intel_perfmon_event_map[PERF_COUNT_HW_BRANCH_MISSES] = 0x7f89; ebx.split.no_branch_misses_retired = 0; x86_pmu.events_maskl = ebx.full; pr_info(""CPU erratum AAJ80 worked around\n""); } } ",0 "PHP_HASH_API int php_hash_copy(const void *ops, void *orig_context, void *dest_context) /* {{{ */ { php_hash_ops *hash_ops = (php_hash_ops *)ops; memcpy(dest_context, orig_context, hash_ops->context_size); return SUCCESS; } /* }}} */ ",0 "proposals_match(char *my[PROPOSAL_MAX], char *peer[PROPOSAL_MAX]) { static int check[] = { PROPOSAL_KEX_ALGS, PROPOSAL_SERVER_HOST_KEY_ALGS, -1 }; int *idx; char *p; for (idx = &check[0]; *idx != -1; idx++) { if ((p = strchr(my[*idx], ',')) != NULL) *p = '\0'; if ((p = strchr(peer[*idx], ',')) != NULL) *p = '\0'; if (strcmp(my[*idx], peer[*idx]) != 0) { debug2(""proposal mismatch: my %s peer %s"", my[*idx], peer[*idx]); return (0); } } debug2(""proposals match""); return (1); } ",0 "static struct dentry *ext3_mount(struct file_system_type *fs_type, int flags, const char *dev_name, void *data) { return mount_bdev(fs_type, flags, dev_name, data, ext3_fill_super); } ",0 "void GaiaOAuthClient::RefreshToken(const OAuthClientInfo& oauth_client_info, const std::string& refresh_token, Delegate* delegate) { return core_->RefreshToken(oauth_client_info, refresh_token, delegate); } ",0 "int SSLClientSocketOpenSSL::Read(IOBuffer* buf, int buf_len, const CompletionCallback& callback) { user_read_buf_ = buf; user_read_buf_len_ = buf_len; int rv = DoReadLoop(OK); if (rv == ERR_IO_PENDING) { user_read_callback_ = callback; } else { user_read_buf_ = NULL; user_read_buf_len_ = 0; } return rv; } ",0 "static uint64_t xhci_port_read(void *ptr, hwaddr reg, unsigned size) { XHCIPort *port = ptr; uint32_t ret; switch (reg) { case 0x00: /* PORTSC */ ret = port->portsc; break; case 0x04: /* PORTPMSC */ case 0x08: /* PORTLI */ ret = 0; break; case 0x0c: /* reserved */ default: trace_usb_xhci_unimplemented(""port read"", reg); ret = 0; } trace_usb_xhci_port_read(port->portnr, reg, ret); return ret; } ",0 "GF_Box *video_sample_entry_New() { GF_MPEGVisualSampleEntryBox *tmp; GF_SAFEALLOC(tmp, GF_MPEGVisualSampleEntryBox); if (tmp == NULL) return NULL; gf_isom_video_sample_entry_init((GF_VisualSampleEntryBox *)tmp); return (GF_Box *)tmp; } ",0 "base::string16 AuthenticatorNoAvailableTransportsErrorModel::GetStepTitle() const { return l10n_util::GetStringUTF16(IDS_WEBAUTHN_ERROR_NO_TRANSPORTS_TITLE); } ",0 "void addReplyMultiBulkLen(client *c, long length) { if (length < OBJ_SHARED_BULKHDR_LEN) addReply(c,shared.mbulkhdr[length]); else addReplyLongLongWithPrefix(c,length,'*'); } ",0 "error::Error GLES2DecoderImpl::HandleGetString( uint32 immediate_data_size, const gles2::GetString& c) { GLenum name = static_cast(c.name); if (!validators_->string_type.IsValid(name)) { SetGLErrorInvalidEnum(""glGetString"", name, ""name""); return error::kNoError; } const char* gl_str = reinterpret_cast(glGetString(name)); const char* str = NULL; std::string extensions; switch (name) { case GL_VERSION: str = ""OpenGL ES 2.0 Chromium""; break; case GL_SHADING_LANGUAGE_VERSION: str = ""OpenGL ES GLSL ES 1.0 Chromium""; break; case GL_RENDERER: str = ""Chromium""; break; case GL_VENDOR: str = ""Chromium""; break; case GL_EXTENSIONS: { if (force_webgl_glsl_validation_ && !derivatives_explicitly_enabled_) { extensions = feature_info_->extensions(); size_t offset = extensions.find(kOESDerivativeExtension); if (std::string::npos != offset) { extensions.replace(offset, offset + arraysize(kOESDerivativeExtension), std::string()); } } else { extensions = feature_info_->extensions().c_str(); } std::string surface_extensions = surface_->GetExtensions(); if (!surface_extensions.empty()) extensions += "" "" + surface_extensions; str = extensions.c_str(); } break; default: str = gl_str; break; } Bucket* bucket = CreateBucket(c.bucket_id); bucket->SetFromString(str); return error::kNoError; } ",0 "void GLES2Implementation::GenFramebuffersHelper( GLsizei /* n */, const GLuint* /* framebuffers */) {} ",0 "write_function(png_structp pp, png_bytep data, png_size_t size) { buffer_write(get_dp(pp), get_buffer(pp), data, size); } ",0 "ScriptProcessorNode* BaseAudioContext::createScriptProcessor( uint32_t buffer_size, uint32_t number_of_input_channels, ExceptionState& exception_state) { DCHECK(IsMainThread()); return ScriptProcessorNode::Create(*this, buffer_size, number_of_input_channels, exception_state); } ",0 "int tls12_get_req_sig_algs(SSL *s, unsigned char *p) { size_t slen = sizeof(tls12_sigalgs); if (p) memcpy(p, tls12_sigalgs, slen); return (int)slen; } ",0 "static int fd_sector(FDrive *drv) { return fd_sector_calc(drv->head, drv->track, drv->sect, drv->last_sect, NUM_SIDES(drv)); } ",0 "void RecordCmdLineAppHistogram() { UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram, extension_misc::APP_LAUNCH_CMD_LINE_APP, extension_misc::APP_LAUNCH_BUCKET_BOUNDARY); } ",0 "xmlBufGetAllocationScheme(xmlBufPtr buf) { if (buf == NULL) { #ifdef DEBUG_BUFFER xmlGenericError(xmlGenericErrorContext, ""xmlBufGetAllocationScheme: buf == NULL\n""); #endif return(-1); } return(buf->alloc); } ",0 "static int _server_handle_Hg(libgdbr_t *g, int (*cmd_cb) (void*, const char*, char*, size_t), void *core_ptr) { char cmd[32]; int tid; if (send_ack (g) < 0) { return -1; } if (g->data_len <= 2 || isalpha (g->data[2])) { return send_msg (g, ""E01""); } if (g->data[2] == '0' || !strncmp (g->data + 2, ""-1"", 2)) { return send_msg (g, ""OK""); } sscanf (g->data + 2, ""%x"", &tid); snprintf (cmd, sizeof (cmd) - 1, ""dpt=%d"", tid); if (cmd_cb (core_ptr, cmd, NULL, 0) < 0) { send_msg (g, ""E01""); return -1; } return send_msg (g, ""OK""); } ",0 "void RenderFrameImpl::FocusedNodeChanged(const WebNode& node) { FOR_EACH_OBSERVER(RenderFrameObserver, observers_, FocusedNodeChanged(node)); } ",0 "static int parse_from(struct branch *b) { const char *from; struct branch *s; unsigned char sha1[20]; if (!skip_prefix(command_buf.buf, ""from "", &from)) return 0; hashcpy(sha1, b->branch_tree.versions[1].sha1); s = lookup_branch(from); if (b == s) die(""Can't create a branch from itself: %s"", b->name); else if (s) { unsigned char *t = s->branch_tree.versions[1].sha1; hashcpy(b->sha1, s->sha1); hashcpy(b->branch_tree.versions[0].sha1, t); hashcpy(b->branch_tree.versions[1].sha1, t); } else if (*from == ':') { uintmax_t idnum = parse_mark_ref_eol(from); struct object_entry *oe = find_mark(idnum); if (oe->type != OBJ_COMMIT) die(""Mark :%"" PRIuMAX "" not a commit"", idnum); if (hashcmp(b->sha1, oe->idx.sha1)) { hashcpy(b->sha1, oe->idx.sha1); if (oe->pack_id != MAX_PACK_ID) { unsigned long size; char *buf = gfi_unpack_entry(oe, &size); parse_from_commit(b, buf, size); free(buf); } else parse_from_existing(b); } } else if (!get_sha1(from, b->sha1)) { parse_from_existing(b); if (is_null_sha1(b->sha1)) b->delete = 1; } else die(""Invalid ref name or SHA1 expression: %s"", from); if (b->branch_tree.tree && hashcmp(sha1, b->branch_tree.versions[1].sha1)) { release_tree_content_recursive(b->branch_tree.tree); b->branch_tree.tree = NULL; } read_next_command(); return 1; } ",0 "void V8TestObjectPython::installPerContextEnabledMethods(v8::Handle prototypeTemplate, v8::Isolate* isolate) { v8::Local defaultSignature = v8::Signature::New(isolate, domTemplate(isolate)); ExecutionContext* context = toExecutionContext(prototypeTemplate->CreationContext()); if (context && context->isDocument() && ContextFeatures::featureNameEnabled(toDocument(context))) prototypeTemplate->Set(v8AtomicString(isolate, ""perContextEnabledVoidMethod""), v8::FunctionTemplate::New(isolate, TestObjectPythonV8Internal::perContextEnabledVoidMethodMethodCallback, v8Undefined(), defaultSignature, 0)->GetFunction()); } ",0 "ContentSecurityPolicy::ContentSecurityPolicy() : execution_context_(nullptr), override_inline_style_allowed_(false), script_hash_algorithms_used_(kContentSecurityPolicyHashAlgorithmNone), style_hash_algorithms_used_(kContentSecurityPolicyHashAlgorithmNone), sandbox_mask_(0), treat_as_public_address_(false), require_safe_types_(false), insecure_request_policy_(kLeaveInsecureRequestsAlone) {} ",0 "int ip_route_input_common(struct sk_buff *skb, __be32 daddr, __be32 saddr, u8 tos, struct net_device *dev, bool noref) { struct rtable * rth; unsigned hash; int iif = dev->ifindex; struct net *net; int res; net = dev_net(dev); rcu_read_lock(); if (!rt_caching(net)) goto skip_cache; tos &= IPTOS_RT_MASK; hash = rt_hash(daddr, saddr, iif, rt_genid(net)); for (rth = rcu_dereference(rt_hash_table[hash].chain); rth; rth = rcu_dereference(rth->dst.rt_next)) { if ((((__force u32)rth->rt_key_dst ^ (__force u32)daddr) | ((__force u32)rth->rt_key_src ^ (__force u32)saddr) | (rth->rt_iif ^ iif) | rth->rt_oif | (rth->rt_key_tos ^ tos)) == 0 && rth->rt_mark == skb->mark && net_eq(dev_net(rth->dst.dev), net) && !rt_is_expired(rth)) { if (noref) { dst_use_noref(&rth->dst, jiffies); skb_dst_set_noref(skb, &rth->dst); } else { dst_use(&rth->dst, jiffies); skb_dst_set(skb, &rth->dst); } RT_CACHE_STAT_INC(in_hit); rcu_read_unlock(); return 0; } RT_CACHE_STAT_INC(in_hlist_search); } skip_cache: /* Multicast recognition logic is moved from route cache to here. The problem was that too many Ethernet cards have broken/missing hardware multicast filters :-( As result the host on multicasting network acquires a lot of useless route cache entries, sort of SDR messages from all the world. Now we try to get rid of them. Really, provided software IP multicast filter is organized reasonably (at least, hashed), it does not result in a slowdown comparing with route cache reject entries. Note, that multicast routers are not affected, because route cache entry is created eventually. */ if (ipv4_is_multicast(daddr)) { struct in_device *in_dev = __in_dev_get_rcu(dev); if (in_dev) { int our = ip_check_mc_rcu(in_dev, daddr, saddr, ip_hdr(skb)->protocol); if (our #ifdef CONFIG_IP_MROUTE || (!ipv4_is_local_multicast(daddr) && IN_DEV_MFORWARD(in_dev)) #endif ) { int res = ip_route_input_mc(skb, daddr, saddr, tos, dev, our); rcu_read_unlock(); return res; } } rcu_read_unlock(); return -EINVAL; } res = ip_route_input_slow(skb, daddr, saddr, tos, dev); rcu_read_unlock(); return res; } ",0 "void qcow2_process_discards(BlockDriverState *bs, int ret) { BDRVQcowState *s = bs->opaque; Qcow2DiscardRegion *d, *next; QTAILQ_FOREACH_SAFE(d, &s->discards, next, next) { QTAILQ_REMOVE(&s->discards, d, next); /* Discard is optional, ignore the return value */ if (ret >= 0) { bdrv_discard(bs->file, d->offset >> BDRV_SECTOR_BITS, d->bytes >> BDRV_SECTOR_BITS); } g_free(d); } } ",0 "static void sctp_cmd_setup_t4(sctp_cmd_seq_t *cmds, struct sctp_association *asoc, struct sctp_chunk *chunk) { struct sctp_transport *t; t = sctp_assoc_choose_alter_transport(asoc, chunk->transport); asoc->timeouts[SCTP_EVENT_TIMEOUT_T4_RTO] = t->rto; chunk->transport = t; } ",0 "static void __remove_discard_cmd(struct f2fs_sb_info *sbi, struct discard_cmd *dc) { struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; if (dc->error == -EOPNOTSUPP) dc->error = 0; if (dc->error) f2fs_msg(sbi->sb, KERN_INFO, ""Issue discard(%u, %u, %u) failed, ret: %d"", dc->lstart, dc->start, dc->len, dc->error); __detach_discard_cmd(dcc, dc); } ",0 "static int ovl_statfs(struct dentry *dentry, struct kstatfs *buf) { struct ovl_fs *ofs = dentry->d_sb->s_fs_info; struct dentry *root_dentry = dentry->d_sb->s_root; struct path path; int err; ovl_path_upper(root_dentry, &path); err = vfs_statfs(&path, buf); if (!err) { buf->f_namelen = max(buf->f_namelen, ofs->lower_namelen); buf->f_type = OVERLAYFS_SUPER_MAGIC; } return err; } ",0 "void OmniboxViewWin::OnRevertTemporaryText() { SetSelectionRange(original_selection_); TextChanged(); } ",0 "static char *lex_steal_string(lex_t *lex, size_t *out_len) { char *result = NULL; if(lex->token == TOKEN_STRING) { result = lex->value.string.val; *out_len = lex->value.string.len; lex->value.string.val = NULL; lex->value.string.len = 0; } return result; } ",0 "static int ocfs2_try_to_write_inline_data(struct address_space *mapping, struct inode *inode, loff_t pos, unsigned len, struct page *mmap_page, struct ocfs2_write_ctxt *wc) { int ret, written = 0; loff_t end = pos + len; struct ocfs2_inode_info *oi = OCFS2_I(inode); struct ocfs2_dinode *di = NULL; trace_ocfs2_try_to_write_inline_data((unsigned long long)oi->ip_blkno, len, (unsigned long long)pos, oi->ip_dyn_features); /* * Handle inodes which already have inline data 1st. */ if (oi->ip_dyn_features & OCFS2_INLINE_DATA_FL) { if (mmap_page == NULL && ocfs2_size_fits_inline_data(wc->w_di_bh, end)) goto do_inline_write; /* * The write won't fit - we have to give this inode an * inline extent list now. */ ret = ocfs2_convert_inline_data_to_extents(inode, wc->w_di_bh); if (ret) mlog_errno(ret); goto out; } /* * Check whether the inode can accept inline data. */ if (oi->ip_clusters != 0 || i_size_read(inode) != 0) return 0; /* * Check whether the write can fit. */ di = (struct ocfs2_dinode *)wc->w_di_bh->b_data; if (mmap_page || end > ocfs2_max_inline_data_with_xattr(inode->i_sb, di)) return 0; do_inline_write: ret = ocfs2_write_begin_inline(mapping, inode, wc); if (ret) { mlog_errno(ret); goto out; } /* * This signals to the caller that the data can be written * inline. */ written = 1; out: return written ? written : ret; } ",0 "static void snd_usbmidi_standard_input(struct snd_usb_midi_in_endpoint *ep, uint8_t *buffer, int buffer_length) { int i; for (i = 0; i + 3 < buffer_length; i += 4) if (buffer[i] != 0) { int cable = buffer[i] >> 4; int length = snd_usbmidi_cin_length[buffer[i] & 0x0f]; snd_usbmidi_input_data(ep, cable, &buffer[i + 1], length); } } ",0 "status_t Parcel::setDataSize(size_t size) { if (size > INT32_MAX) { return BAD_VALUE; } status_t err; err = continueWrite(size); if (err == NO_ERROR) { mDataSize = size; ALOGV(""setDataSize Setting data size of %p to %zu"", this, mDataSize); } return err; } ",0 "static ssize_t cache_dma_show(struct kmem_cache *s, char *buf) { return sprintf(buf, ""%d\n"", !!(s->flags & SLAB_CACHE_DMA)); } ",0 "static int ext4_unfreeze(struct super_block *sb) { if (sb->s_flags & MS_RDONLY) return 0; lock_super(sb); /* Reset the needs_recovery flag before the fs is unlocked. */ EXT4_SET_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER); ext4_commit_super(sb, 1); unlock_super(sb); jbd2_journal_unlock_updates(EXT4_SB(sb)->s_journal); return 0; } ",0 "start_input_ppm(j_compress_ptr cinfo, cjpeg_source_ptr sinfo) { ppm_source_ptr source = (ppm_source_ptr)sinfo; int c; unsigned int w, h, maxval; boolean need_iobuffer, use_raw_buffer, need_rescale; if (getc(source->pub.input_file) != 'P') ERREXIT(cinfo, JERR_PPM_NOT); c = getc(source->pub.input_file); /* subformat discriminator character */ /* detect unsupported variants (ie, PBM) before trying to read header */ switch (c) { case '2': /* it's a text-format PGM file */ case '3': /* it's a text-format PPM file */ case '5': /* it's a raw-format PGM file */ case '6': /* it's a raw-format PPM file */ break; default: ERREXIT(cinfo, JERR_PPM_NOT); break; } /* fetch the remaining header info */ w = read_pbm_integer(cinfo, source->pub.input_file, 65535); h = read_pbm_integer(cinfo, source->pub.input_file, 65535); maxval = read_pbm_integer(cinfo, source->pub.input_file, 65535); if (w <= 0 || h <= 0 || maxval <= 0) /* error check */ ERREXIT(cinfo, JERR_PPM_NOT); cinfo->data_precision = BITS_IN_JSAMPLE; /* we always rescale data to this */ cinfo->image_width = (JDIMENSION)w; cinfo->image_height = (JDIMENSION)h; source->maxval = maxval; /* initialize flags to most common settings */ need_iobuffer = TRUE; /* do we need an I/O buffer? */ use_raw_buffer = FALSE; /* do we map input buffer onto I/O buffer? */ need_rescale = TRUE; /* do we need a rescale array? */ switch (c) { case '2': /* it's a text-format PGM file */ if (cinfo->in_color_space == JCS_UNKNOWN) cinfo->in_color_space = JCS_GRAYSCALE; TRACEMS2(cinfo, 1, JTRC_PGM_TEXT, w, h); if (cinfo->in_color_space == JCS_GRAYSCALE) source->pub.get_pixel_rows = get_text_gray_row; else if (IsExtRGB(cinfo->in_color_space)) source->pub.get_pixel_rows = get_text_gray_rgb_row; else if (cinfo->in_color_space == JCS_CMYK) source->pub.get_pixel_rows = get_text_gray_cmyk_row; else ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE); need_iobuffer = FALSE; break; case '3': /* it's a text-format PPM file */ if (cinfo->in_color_space == JCS_UNKNOWN) cinfo->in_color_space = JCS_EXT_RGB; TRACEMS2(cinfo, 1, JTRC_PPM_TEXT, w, h); if (IsExtRGB(cinfo->in_color_space)) source->pub.get_pixel_rows = get_text_rgb_row; else if (cinfo->in_color_space == JCS_CMYK) source->pub.get_pixel_rows = get_text_rgb_cmyk_row; else ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE); need_iobuffer = FALSE; break; case '5': /* it's a raw-format PGM file */ if (cinfo->in_color_space == JCS_UNKNOWN) cinfo->in_color_space = JCS_GRAYSCALE; TRACEMS2(cinfo, 1, JTRC_PGM, w, h); if (maxval > 255) { source->pub.get_pixel_rows = get_word_gray_row; } else if (maxval == MAXJSAMPLE && sizeof(JSAMPLE) == sizeof(U_CHAR) && cinfo->in_color_space == JCS_GRAYSCALE) { source->pub.get_pixel_rows = get_raw_row; use_raw_buffer = TRUE; need_rescale = FALSE; } else { if (cinfo->in_color_space == JCS_GRAYSCALE) source->pub.get_pixel_rows = get_scaled_gray_row; else if (IsExtRGB(cinfo->in_color_space)) source->pub.get_pixel_rows = get_gray_rgb_row; else if (cinfo->in_color_space == JCS_CMYK) source->pub.get_pixel_rows = get_gray_cmyk_row; else ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE); } break; case '6': /* it's a raw-format PPM file */ if (cinfo->in_color_space == JCS_UNKNOWN) cinfo->in_color_space = JCS_EXT_RGB; TRACEMS2(cinfo, 1, JTRC_PPM, w, h); if (maxval > 255) { source->pub.get_pixel_rows = get_word_rgb_row; } else if (maxval == MAXJSAMPLE && sizeof(JSAMPLE) == sizeof(U_CHAR) && (cinfo->in_color_space == JCS_EXT_RGB #if RGB_RED == 0 && RGB_GREEN == 1 && RGB_BLUE == 2 && RGB_PIXELSIZE == 3 || cinfo->in_color_space == JCS_RGB #endif )) { source->pub.get_pixel_rows = get_raw_row; use_raw_buffer = TRUE; need_rescale = FALSE; } else { if (IsExtRGB(cinfo->in_color_space)) source->pub.get_pixel_rows = get_rgb_row; else if (cinfo->in_color_space == JCS_CMYK) source->pub.get_pixel_rows = get_rgb_cmyk_row; else ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE); } break; } if (IsExtRGB(cinfo->in_color_space)) cinfo->input_components = rgb_pixelsize[cinfo->in_color_space]; else if (cinfo->in_color_space == JCS_GRAYSCALE) cinfo->input_components = 1; else if (cinfo->in_color_space == JCS_CMYK) cinfo->input_components = 4; /* Allocate space for I/O buffer: 1 or 3 bytes or words/pixel. */ if (need_iobuffer) { if (c == '6') source->buffer_width = (size_t)w * 3 * ((maxval <= 255) ? sizeof(U_CHAR) : (2 * sizeof(U_CHAR))); else source->buffer_width = (size_t)w * ((maxval <= 255) ? sizeof(U_CHAR) : (2 * sizeof(U_CHAR))); source->iobuffer = (U_CHAR *) (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE, source->buffer_width); } /* Create compressor input buffer. */ if (use_raw_buffer) { /* For unscaled raw-input case, we can just map it onto the I/O buffer. */ /* Synthesize a JSAMPARRAY pointer structure */ source->pixrow = (JSAMPROW)source->iobuffer; source->pub.buffer = &source->pixrow; source->pub.buffer_height = 1; } else { /* Need to translate anyway, so make a separate sample buffer. */ source->pub.buffer = (*cinfo->mem->alloc_sarray) ((j_common_ptr)cinfo, JPOOL_IMAGE, (JDIMENSION)w * cinfo->input_components, (JDIMENSION)1); source->pub.buffer_height = 1; } /* Compute the rescaling array if required. */ if (need_rescale) { long val, half_maxval; /* On 16-bit-int machines we have to be careful of maxval = 65535 */ source->rescale = (JSAMPLE *) (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE, (size_t)(((long)maxval + 1L) * sizeof(JSAMPLE))); half_maxval = maxval / 2; for (val = 0; val <= (long)maxval; val++) { /* The multiplication here must be done in 32 bits to avoid overflow */ source->rescale[val] = (JSAMPLE)((val * MAXJSAMPLE + half_maxval) / maxval); } } } ",0 "static void __perf_event_exit_context(void *__info) { struct perf_event_context *ctx = __info; struct perf_event *event, *tmp; perf_pmu_rotate_stop(ctx->pmu); list_for_each_entry_safe(event, tmp, &ctx->pinned_groups, group_entry) __perf_remove_from_context(event); list_for_each_entry_safe(event, tmp, &ctx->flexible_groups, group_entry) __perf_remove_from_context(event); } ",0 "void InputDispatcher::abortBrokenDispatchCycleLocked(nsecs_t currentTime, const sp& connection, bool notify) { #if DEBUG_DISPATCH_CYCLE ALOGD(""channel '%s' ~ abortBrokenDispatchCycle - notify=%s"", connection->getInputChannelName(), toString(notify)); #endif drainDispatchQueueLocked(&connection->outboundQueue); traceOutboundQueueLengthLocked(connection); drainDispatchQueueLocked(&connection->waitQueue); traceWaitQueueLengthLocked(connection); if (connection->status == Connection::STATUS_NORMAL) { connection->status = Connection::STATUS_BROKEN; if (notify) { onDispatchCycleBrokenLocked(currentTime, connection); } } } ",0 " bool Cues::Find(long long time_ns, const Track* pTrack, const CuePoint*& pCP, const CuePoint::TrackPosition*& pTP) const { assert(time_ns >= 0); assert(pTrack); #if 0 LoadCuePoint(); //establish invariant assert(m_cue_points); assert(m_count > 0); CuePoint** const ii = m_cue_points; CuePoint** i = ii; CuePoint** const jj = ii + m_count + m_preload_count; CuePoint** j = jj; pCP = *i; assert(pCP); if (time_ns <= pCP->GetTime(m_pSegment)) { pTP = pCP->Find(pTrack); return (pTP != NULL); } IMkvReader* const pReader = m_pSegment->m_pReader; while (i < j) { CuePoint** const k = i + (j - i) / 2; assert(k < jj); CuePoint* const pCP = *k; assert(pCP); pCP->Load(pReader); const long long t = pCP->GetTime(m_pSegment); if (t <= time_ns) i = k + 1; else j = k; assert(i <= j); } assert(i == j); assert(i <= jj); assert(i > ii); pCP = *--i; assert(pCP); assert(pCP->GetTime(m_pSegment) <= time_ns); #else if (m_cue_points == NULL) return false; if (m_count == 0) return false; CuePoint** const ii = m_cue_points; CuePoint** i = ii; CuePoint** const jj = ii + m_count; CuePoint** j = jj; pCP = *i; assert(pCP); if (time_ns <= pCP->GetTime(m_pSegment)) { pTP = pCP->Find(pTrack); return (pTP != NULL); } while (i < j) { CuePoint** const k = i + (j - i) / 2; assert(k < jj); CuePoint* const pCP = *k; assert(pCP); const long long t = pCP->GetTime(m_pSegment); if (t <= time_ns) i = k + 1; else j = k; assert(i <= j); } assert(i == j); assert(i <= jj); assert(i > ii); pCP = *--i; assert(pCP); assert(pCP->GetTime(m_pSegment) <= time_ns); #endif pTP = pCP->Find(pTrack); return (pTP != NULL); } ",1 "void WebPageProxy::setFindIndicator(const FloatRect& selectionRectInWindowCoordinates, const Vector& textRectsInSelectionRectCoordinates, const ShareableBitmap::Handle& contentImageHandle, bool fadeOut) { RefPtr findIndicator = FindIndicator::create(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, contentImageHandle); m_pageClient->setFindIndicator(findIndicator.release(), fadeOut); } ",0 "void Browser::MoveTabNext() { UserMetrics::RecordAction(UserMetricsAction(""MoveTabNext""), profile_); tab_handler_->GetTabStripModel()->MoveTabNext(); } ",0 "inline void Splash::pipeIncX(SplashPipe *pipe) { ++pipe->x; if (state->softMask) { ++pipe->softMaskPtr; } switch (bitmap->mode) { case splashModeMono1: if (!(pipe->destColorMask >>= 1)) { pipe->destColorMask = 0x80; ++pipe->destColorPtr; } break; case splashModeMono8: ++pipe->destColorPtr; break; case splashModeRGB8: case splashModeBGR8: pipe->destColorPtr += 3; break; case splashModeXBGR8: pipe->destColorPtr += 4; break; #if SPLASH_CMYK case splashModeCMYK8: pipe->destColorPtr += 4; break; case splashModeDeviceN8: pipe->destColorPtr += (SPOT_NCOMPS+4); break; #endif } if (pipe->destAlphaPtr) { ++pipe->destAlphaPtr; } if (pipe->alpha0Ptr) { ++pipe->alpha0Ptr; } } ",0 "void RenderFrameImpl::DidAddMessageToConsole( const blink::WebConsoleMessage& message, const blink::WebString& source_name, unsigned source_line, const blink::WebString& stack_trace) { logging::LogSeverity log_severity = logging::LOG_VERBOSE; switch (message.level) { case blink::mojom::ConsoleMessageLevel::kVerbose: log_severity = logging::LOG_VERBOSE; break; case blink::mojom::ConsoleMessageLevel::kInfo: log_severity = logging::LOG_INFO; break; case blink::mojom::ConsoleMessageLevel::kWarning: log_severity = logging::LOG_WARNING; break; case blink::mojom::ConsoleMessageLevel::kError: log_severity = logging::LOG_ERROR; break; default: log_severity = logging::LOG_VERBOSE; } if (ShouldReportDetailedMessageForSource(source_name)) { for (auto& observer : observers_) { observer.DetailedConsoleMessageAdded( message.text.Utf16(), source_name.Utf16(), stack_trace.Utf16(), source_line, static_cast(log_severity)); } } Send(new FrameHostMsg_DidAddMessageToConsole( routing_id_, static_cast(log_severity), message.text.Utf16(), static_cast(source_line), source_name.Utf16())); } ",1 "void Document::UnregisterNodeListWithIdNameCache(const LiveNodeListBase* list) { node_lists_.Remove(list, kInvalidateOnIdNameAttrChange); } ",0 "parse_WRITE_ACTIONS(char *arg, struct ofpbuf *ofpacts, enum ofputil_protocol *usable_protocols) { size_t ofs = ofpacts_pull(ofpacts); struct ofpact_nest *on; char *error; /* Add a Write-Actions instruction and then pull it off. */ ofpact_put(ofpacts, OFPACT_WRITE_ACTIONS, sizeof *on); ofpbuf_pull(ofpacts, sizeof *on); /* Parse nested actions. * * We pulled off ""write-actions"" and the previous actions because the * OFPACT_WRITE_ACTIONS is only partially constructed: its length is such * that it doesn't actually include the nested actions. That means that * ofpacts_parse() would reject them as being part of an Apply-Actions that * follows a Write-Actions, which is an invalid order. */ error = ofpacts_parse(arg, ofpacts, usable_protocols, false, OFPACT_WRITE_ACTIONS); /* Put the Write-Actions back on and update its length. */ on = ofpbuf_push_uninit(ofpacts, sizeof *on); on->ofpact.len = ofpacts->size; /* Put any previous actions or instructions back on. */ ofpbuf_push_uninit(ofpacts, ofs); return error; } ",0 "static inline void put_tpel_pixels_mc01_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ int i,j; for (i=0; i < height; i++) { for (j=0; j < width; j++) { dst[j] = (683*(2*src[j] + src[j+stride] + 1)) >> 11; } src += stride; dst += stride; } } ",0 "pdf_array_delete(fz_context *ctx, pdf_obj *obj, int i) { RESOLVE(obj); if (!OBJ_IS_ARRAY(obj)) fz_throw(ctx, FZ_ERROR_GENERIC, ""not an array (%s)"", pdf_objkindstr(obj)); if (i < 0 || i >= ARRAY(obj)->len) fz_throw(ctx, FZ_ERROR_GENERIC, ""index out of bounds""); pdf_drop_obj(ctx, ARRAY(obj)->items[i]); ARRAY(obj)->items[i] = 0; ARRAY(obj)->len--; memmove(ARRAY(obj)->items + i, ARRAY(obj)->items + i + 1, (ARRAY(obj)->len - i) * sizeof(pdf_obj*)); } ",0 "const KURL& Document::firstPartyForCookies() const { if (SchemeRegistry::shouldTreatURLSchemeAsFirstPartyWhenTopLevel(topDocument().url().protocol())) return topDocument().url(); OriginAccessEntry accessEntry(topDocument().url().protocol(), topDocument().url().host(), OriginAccessEntry::AllowRegisterableDomains); const Document* currentDocument = this; while (currentDocument) { while (currentDocument->isSrcdocDocument()) currentDocument = currentDocument->parentDocument(); ASSERT(currentDocument); if (accessEntry.matchesOrigin(*currentDocument->securityOrigin()) == OriginAccessEntry::DoesNotMatchOrigin) return SecurityOrigin::urlWithUniqueSecurityOrigin(); currentDocument = currentDocument->parentDocument(); } return topDocument().url(); } ",0 "ImageView::Alignment ImageView::GetHorizontalAlignment() { return horiz_alignment_; } ",0 "SavePackage::~SavePackage() { if (!finished_ && !canceled()) { Cancel(true); } CHECK(!download_); DCHECK(all_save_items_count_ == (waiting_item_queue_.size() + completed_count() + in_process_count())); while (!waiting_item_queue_.empty()) { SaveItem* save_item = waiting_item_queue_.front(); waiting_item_queue_.pop(); delete save_item; } STLDeleteValues(&saved_success_items_); STLDeleteValues(&in_progress_items_); STLDeleteValues(&saved_failed_items_); file_manager_ = NULL; } ",0 "static struct kvm *kvm_create_vm(void) { int r, i; struct kvm *kvm = kvm_arch_alloc_vm(); if (!kvm) return ERR_PTR(-ENOMEM); r = kvm_arch_init_vm(kvm); if (r) goto out_err_nodisable; r = hardware_enable_all(); if (r) goto out_err_nodisable; #ifdef CONFIG_HAVE_KVM_IRQCHIP INIT_HLIST_HEAD(&kvm->mask_notifier_list); INIT_HLIST_HEAD(&kvm->irq_ack_notifier_list); #endif r = -ENOMEM; kvm->memslots = kzalloc(sizeof(struct kvm_memslots), GFP_KERNEL); if (!kvm->memslots) goto out_err_nosrcu; if (init_srcu_struct(&kvm->srcu)) goto out_err_nosrcu; for (i = 0; i < KVM_NR_BUSES; i++) { kvm->buses[i] = kzalloc(sizeof(struct kvm_io_bus), GFP_KERNEL); if (!kvm->buses[i]) goto out_err; } r = kvm_init_mmu_notifier(kvm); if (r) goto out_err; kvm->mm = current->mm; atomic_inc(&kvm->mm->mm_count); spin_lock_init(&kvm->mmu_lock); kvm_eventfd_init(kvm); mutex_init(&kvm->lock); mutex_init(&kvm->irq_lock); mutex_init(&kvm->slots_lock); atomic_set(&kvm->users_count, 1); raw_spin_lock(&kvm_lock); list_add(&kvm->vm_list, &vm_list); raw_spin_unlock(&kvm_lock); return kvm; out_err: cleanup_srcu_struct(&kvm->srcu); out_err_nosrcu: hardware_disable_all(); out_err_nodisable: for (i = 0; i < KVM_NR_BUSES; i++) kfree(kvm->buses[i]); kfree(kvm->memslots); kvm_arch_free_vm(kvm); return ERR_PTR(r); } ",0 "static bool tracked_request_overlaps(BdrvTrackedRequest *req, int64_t offset, unsigned int bytes) { /* aaaa bbbb */ if (offset >= req->overlap_offset + req->overlap_bytes) { return false; } /* bbbb aaaa */ if (req->overlap_offset >= offset + bytes) { return false; } return true; } ",0 "void DevToolsWindow::OpenDevToolsWindow( content::WebContents* inspected_web_contents, const DevToolsToggleAction& action) { ToggleDevToolsWindow(inspected_web_contents, true, action, """"); } ",0 "format_REG_MOVE(const struct ofpact_reg_move *a, struct ds *s) { nxm_format_reg_move(a, s); } ",0 "void ResourceDispatcherHost::CancelRequestsForRoute(int child_id, int route_id) { std::vector matching_requests; for (PendingRequestList::const_iterator i = pending_requests_.begin(); i != pending_requests_.end(); ++i) { if (i->first.child_id == child_id) { ResourceDispatcherHostRequestInfo* info = InfoForRequest(i->second); if (!info->is_download() && (route_id == -1 || route_id == info->route_id())) { matching_requests.push_back( GlobalRequestID(child_id, i->first.request_id)); } } } for (size_t i = 0; i < matching_requests.size(); ++i) { PendingRequestList::iterator iter = pending_requests_.find(matching_requests[i]); if (iter != pending_requests_.end()) RemovePendingRequest(iter); } if (route_id != -1) { if (blocked_requests_map_.find(std::pair(child_id, route_id)) != blocked_requests_map_.end()) { CancelBlockedRequestsForRoute(child_id, route_id); } } else { std::set route_ids; for (BlockedRequestMap::const_iterator iter = blocked_requests_map_.begin(); iter != blocked_requests_map_.end(); ++iter) { if (iter->first.first == child_id) route_ids.insert(iter->first.second); } for (std::set::const_iterator iter = route_ids.begin(); iter != route_ids.end(); ++iter) { CancelBlockedRequestsForRoute(child_id, *iter); } } } ",0 "int btrfs_start_delalloc_roots(struct btrfs_fs_info *fs_info, int delay_iput, int nr) { struct btrfs_root *root; struct list_head splice; int ret; if (test_bit(BTRFS_FS_STATE_ERROR, &fs_info->fs_state)) return -EROFS; INIT_LIST_HEAD(&splice); mutex_lock(&fs_info->delalloc_root_mutex); spin_lock(&fs_info->delalloc_root_lock); list_splice_init(&fs_info->delalloc_roots, &splice); while (!list_empty(&splice) && nr) { root = list_first_entry(&splice, struct btrfs_root, delalloc_root); root = btrfs_grab_fs_root(root); BUG_ON(!root); list_move_tail(&root->delalloc_root, &fs_info->delalloc_roots); spin_unlock(&fs_info->delalloc_root_lock); ret = __start_delalloc_inodes(root, delay_iput, nr); btrfs_put_fs_root(root); if (ret < 0) goto out; if (nr != -1) { nr -= ret; WARN_ON(nr < 0); } spin_lock(&fs_info->delalloc_root_lock); } spin_unlock(&fs_info->delalloc_root_lock); ret = 0; atomic_inc(&fs_info->async_submit_draining); while (atomic_read(&fs_info->nr_async_submits) || atomic_read(&fs_info->async_delalloc_pages)) { wait_event(fs_info->async_submit_wait, (atomic_read(&fs_info->nr_async_submits) == 0 && atomic_read(&fs_info->async_delalloc_pages) == 0)); } atomic_dec(&fs_info->async_submit_draining); out: if (!list_empty_careful(&splice)) { spin_lock(&fs_info->delalloc_root_lock); list_splice_tail(&splice, &fs_info->delalloc_roots); spin_unlock(&fs_info->delalloc_root_lock); } mutex_unlock(&fs_info->delalloc_root_mutex); return ret; } ",0 "static struct sk_buff *compose_sadb_supported(const struct sadb_msg *orig, gfp_t allocation) { struct sk_buff *skb; struct sadb_msg *hdr; int len, auth_len, enc_len, i; auth_len = xfrm_count_pfkey_auth_supported(); if (auth_len) { auth_len *= sizeof(struct sadb_alg); auth_len += sizeof(struct sadb_supported); } enc_len = xfrm_count_pfkey_enc_supported(); if (enc_len) { enc_len *= sizeof(struct sadb_alg); enc_len += sizeof(struct sadb_supported); } len = enc_len + auth_len + sizeof(struct sadb_msg); skb = alloc_skb(len + 16, allocation); if (!skb) goto out_put_algs; hdr = (struct sadb_msg *) skb_put(skb, sizeof(*hdr)); pfkey_hdr_dup(hdr, orig); hdr->sadb_msg_errno = 0; hdr->sadb_msg_len = len / sizeof(uint64_t); if (auth_len) { struct sadb_supported *sp; struct sadb_alg *ap; sp = (struct sadb_supported *) skb_put(skb, auth_len); ap = (struct sadb_alg *) (sp + 1); sp->sadb_supported_len = auth_len / sizeof(uint64_t); sp->sadb_supported_exttype = SADB_EXT_SUPPORTED_AUTH; for (i = 0; ; i++) { struct xfrm_algo_desc *aalg = xfrm_aalg_get_byidx(i); if (!aalg) break; if (!aalg->pfkey_supported) continue; if (aalg->available) *ap++ = aalg->desc; } } if (enc_len) { struct sadb_supported *sp; struct sadb_alg *ap; sp = (struct sadb_supported *) skb_put(skb, enc_len); ap = (struct sadb_alg *) (sp + 1); sp->sadb_supported_len = enc_len / sizeof(uint64_t); sp->sadb_supported_exttype = SADB_EXT_SUPPORTED_ENCRYPT; for (i = 0; ; i++) { struct xfrm_algo_desc *ealg = xfrm_ealg_get_byidx(i); if (!ealg) break; if (!ealg->pfkey_supported) continue; if (ealg->available) *ap++ = ealg->desc; } } out_put_algs: return skb; } ",0 "void WebContentsImpl::DragSourceMovedTo(int client_x, int client_y, int screen_x, int screen_y) { if (browser_plugin_embedder_.get()) browser_plugin_embedder_->DragSourceMovedTo(client_x, client_y, screen_x, screen_y); if (GetRenderViewHost()) GetRenderViewHostImpl()->DragSourceMovedTo(client_x, client_y, screen_x, screen_y); } ",0 "static void red_channel_client_on_output(void *opaque, int n) { RedChannelClient *rcc = opaque; stat_inc_counter(rcc->channel->out_bytes_counter, n); } ",0 "void RenderFrameImpl::OnCollapseSelection() { const WebRange& range = frame_->GetInputMethodController()->GetSelectionOffsets(); if (range.IsNull()) return; AutoResetMember handling_select_range( this, &RenderFrameImpl::handling_select_range_, true); frame_->SelectRange(WebRange(range.EndOffset(), 0), WebLocalFrame::kHideSelectionHandle, SelectionMenuBehavior::kHide); } ",0 "static int dccp_error(struct net *net, struct nf_conn *tmpl, struct sk_buff *skb, unsigned int dataoff, enum ip_conntrack_info *ctinfo, u_int8_t pf, unsigned int hooknum) { struct dccp_hdr _dh, *dh; unsigned int dccp_len = skb->len - dataoff; unsigned int cscov; const char *msg; dh = skb_header_pointer(skb, dataoff, sizeof(_dh), &dh); if (dh == NULL) { msg = ""nf_ct_dccp: short packet ""; goto out_invalid; } if (dh->dccph_doff * 4 < sizeof(struct dccp_hdr) || dh->dccph_doff * 4 > dccp_len) { msg = ""nf_ct_dccp: truncated/malformed packet ""; goto out_invalid; } cscov = dccp_len; if (dh->dccph_cscov) { cscov = (dh->dccph_cscov - 1) * 4; if (cscov > dccp_len) { msg = ""nf_ct_dccp: bad checksum coverage ""; goto out_invalid; } } if (net->ct.sysctl_checksum && hooknum == NF_INET_PRE_ROUTING && nf_checksum_partial(skb, hooknum, dataoff, cscov, IPPROTO_DCCP, pf)) { msg = ""nf_ct_dccp: bad checksum ""; goto out_invalid; } if (dh->dccph_type >= DCCP_PKT_INVALID) { msg = ""nf_ct_dccp: reserved packet type ""; goto out_invalid; } return NF_ACCEPT; out_invalid: if (LOG_INVALID(net, IPPROTO_DCCP)) nf_log_packet(net, pf, 0, skb, NULL, NULL, NULL, ""%s"", msg); return -NF_ACCEPT; } ",1 "int handle_early_requeue_pi_wakeup(struct futex_hash_bucket *hb, struct futex_q *q, union futex_key *key2, struct hrtimer_sleeper *timeout) { int ret = 0; /* * With the hb lock held, we avoid races while we process the wakeup. * We only need to hold hb (and not hb2) to ensure atomicity as the * wakeup code can't change q.key from uaddr to uaddr2 if we hold hb. * It can't be requeued from uaddr2 to something else since we don't * support a PI aware source futex for requeue. */ if (!match_futex(&q->key, key2)) { WARN_ON(q->lock_ptr && (&hb->lock != q->lock_ptr)); /* * We were woken prior to requeue by a timeout or a signal. * Unqueue the futex_q and determine which it was. */ plist_del(&q->list, &q->list.plist); /* Handle spurious wakeups gracefully */ ret = -EWOULDBLOCK; if (timeout && !timeout->task) ret = -ETIMEDOUT; else if (signal_pending(current)) ret = -ERESTARTNOINTR; } return ret; } ",0 "int Channel::ChannelImpl::GetClientFileDescriptor() const { return client_pipe_; } ",0 "isoent_traverse_tree(struct archive_write *a, struct vdd* vdd) { struct iso9660 *iso9660 = a->format_data; struct isoent *np; struct idr idr; int depth; int r; int (*genid)(struct archive_write *, struct isoent *, struct idr *); idr_init(iso9660, vdd, &idr); np = vdd->rootent; depth = 0; if (vdd->vdd_type == VDD_JOLIET) genid = isoent_gen_joliet_identifier; else genid = isoent_gen_iso9660_identifier; do { if (np->virtual && !archive_entry_mtime_is_set(np->file->entry)) { /* Set properly times to virtual directory */ archive_entry_set_mtime(np->file->entry, iso9660->birth_time, 0); archive_entry_set_atime(np->file->entry, iso9660->birth_time, 0); archive_entry_set_ctime(np->file->entry, iso9660->birth_time, 0); } if (np->children.first != NULL) { if (vdd->vdd_type != VDD_JOLIET && !iso9660->opt.rr && depth + 1 >= vdd->max_depth) { if (np->children.cnt > 0) iso9660->directories_too_deep = np; } else { /* Generate Identifier */ r = genid(a, np, &idr); if (r < 0) goto exit_traverse_tree; r = isoent_make_sorted_files(a, np, &idr); if (r < 0) goto exit_traverse_tree; if (np->subdirs.first != NULL && depth + 1 < vdd->max_depth) { /* Enter to sub directories. */ np = np->subdirs.first; depth++; continue; } } } while (np != np->parent) { if (np->drnext == NULL) { /* Return to the parent directory. */ np = np->parent; depth--; } else { np = np->drnext; break; } } } while (np != np->parent); r = ARCHIVE_OK; exit_traverse_tree: idr_cleanup(&idr); return (r); } ",0 "void Type_U16Fixed16_Free(struct _cms_typehandler_struct* self, void* Ptr) { _cmsFree(self ->ContextID, Ptr); } ",0 "static inline void clear_AC(struct kernel_vm86_regs *regs) { regs->pt.flags &= ~X86_EFLAGS_AC; } ",0 "append_port_stat(struct ofport *port, struct ovs_list *replies) { struct ofputil_port_stats ops = { .port_no = port->pp.port_no }; calc_duration(port->created, time_msec(), &ops.duration_sec, &ops.duration_nsec); /* Intentionally ignore return value, since errors will set * 'stats' to all-1s, which is correct for OpenFlow, and * netdev_get_stats() will log errors. */ ofproto_port_get_stats(port, &ops.stats); ofputil_append_port_stat(replies, &ops); } ",0 "void GLES2Implementation::RemoveMappedBufferRangeByTarget(GLenum target) { GLuint buffer = GetBoundBufferHelper(target); RemoveMappedBufferRangeById(buffer); } ",0 "void InjectedBundlePage::willPerformClientRedirectForFrame(WKBundleFrameRef frame, WKURLRef url, double delay, double date) { if (!InjectedBundle::shared().isTestRunning()) return; if (!InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks()) return; StringBuilder stringBuilder; dumpFrameDescriptionSuitableForTestResult(frame, stringBuilder); stringBuilder.appendLiteral("" - willPerformClientRedirectToURL: ""); stringBuilder.append(pathSuitableForTestResult(url)); stringBuilder.appendLiteral("" \n""); InjectedBundle::shared().outputText(stringBuilder.toString()); } ",0 " discourse_context::ClientDiscourseContext GetDiscourseContextFromRequest() { discourse_context::ClientDiscourseContext cdc; net::HttpRequestHeaders fetch_headers; fetcher()->GetExtraRequestHeaders(&fetch_headers); if (fetch_headers.HasHeader(kDiscourseContextHeaderName)) { std::string actual_header_value; fetch_headers.GetHeader(kDiscourseContextHeaderName, &actual_header_value); std::string unescaped_header = actual_header_value; std::replace(unescaped_header.begin(), unescaped_header.end(), '-', '+'); std::replace(unescaped_header.begin(), unescaped_header.end(), '_', '/'); std::string decoded_header; if (base::Base64Decode(unescaped_header, &decoded_header)) { cdc.ParseFromString(decoded_header); } } return cdc; } ",0 "PHP_FUNCTION(pg_num_rows) { php_pgsql_get_result_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_NUM_ROWS); } ",0 "struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name, void (*setup)(struct net_device *), unsigned int txqs, unsigned int rxqs) { struct net_device *dev; size_t alloc_size; struct net_device *p; BUG_ON(strlen(name) >= sizeof(dev->name)); if (txqs < 1) { pr_err(""alloc_netdev: Unable to allocate device "" ""with zero queues.\n""); return NULL; } #ifdef CONFIG_RPS if (rxqs < 1) { pr_err(""alloc_netdev: Unable to allocate device "" ""with zero RX queues.\n""); return NULL; } #endif alloc_size = sizeof(struct net_device); if (sizeof_priv) { /* ensure 32-byte alignment of private area */ alloc_size = ALIGN(alloc_size, NETDEV_ALIGN); alloc_size += sizeof_priv; } /* ensure 32-byte alignment of whole construct */ alloc_size += NETDEV_ALIGN - 1; p = kzalloc(alloc_size, GFP_KERNEL); if (!p) { printk(KERN_ERR ""alloc_netdev: Unable to allocate device.\n""); return NULL; } dev = PTR_ALIGN(p, NETDEV_ALIGN); dev->padded = (char *)dev - (char *)p; dev->pcpu_refcnt = alloc_percpu(int); if (!dev->pcpu_refcnt) goto free_p; if (dev_addr_init(dev)) goto free_pcpu; dev_mc_init(dev); dev_uc_init(dev); dev_net_set(dev, &init_net); dev->gso_max_size = GSO_MAX_SIZE; INIT_LIST_HEAD(&dev->ethtool_ntuple_list.list); dev->ethtool_ntuple_list.count = 0; INIT_LIST_HEAD(&dev->napi_list); INIT_LIST_HEAD(&dev->unreg_list); INIT_LIST_HEAD(&dev->link_watch_list); dev->priv_flags = IFF_XMIT_DST_RELEASE; setup(dev); dev->num_tx_queues = txqs; dev->real_num_tx_queues = txqs; if (netif_alloc_netdev_queues(dev)) goto free_all; #ifdef CONFIG_RPS dev->num_rx_queues = rxqs; dev->real_num_rx_queues = rxqs; if (netif_alloc_rx_queues(dev)) goto free_all; #endif strcpy(dev->name, name); return dev; free_all: free_netdev(dev); return NULL; free_pcpu: free_percpu(dev->pcpu_refcnt); kfree(dev->_tx); #ifdef CONFIG_RPS kfree(dev->_rx); #endif free_p: kfree(p); return NULL; } ",0 "PDFiumEngine::SelectionChangeInvalidator::~SelectionChangeInvalidator() { pp::Point offset = previous_origin_ - engine_->GetVisibleRect().point(); for (auto& old_selection : old_selections_) old_selection.Offset(offset); std::vector new_selections; GetVisibleSelectionsScreenRects(&new_selections); for (auto& new_selection : new_selections) { for (auto& old_selection : old_selections_) { if (!old_selection.IsEmpty() && new_selection == old_selection) { new_selection = old_selection = pp::Rect(); break; } } } for (const auto& old_selection : old_selections_) { if (!old_selection.IsEmpty()) engine_->client_->Invalidate(old_selection); } for (const auto& new_selection : new_selections) { if (!new_selection.IsEmpty()) engine_->client_->Invalidate(new_selection); } engine_->OnSelectionChanged(); } ",0 "std::string WebRTCAudioDeviceTest::GetTestDataPath( const FilePath::StringType& file_name) { FilePath path; EXPECT_TRUE(PathService::Get(content::DIR_TEST_DATA, &path)); path = path.Append(file_name); EXPECT_TRUE(file_util::PathExists(path)); #ifdef OS_WIN return WideToUTF8(path.value()); #else return path.value(); #endif } ",0 "ExtensionDevToolsInfoBar::~ExtensionDevToolsInfoBar() { g_extension_info_bars.Get().erase(extension_id_); if (infobar_) infobar_->Close(); } ",0 "InspectorStyleInvalidatorInvalidateEvent::SelectorPart( Element& element, const char* reason, const InvalidationSet& invalidation_set, const String& selector_part) { std::unique_ptr value = FillCommonPart(element, reason); value->BeginArray(""invalidationList""); invalidation_set.ToTracedValue(value.get()); value->EndArray(); value->SetString(""selectorPart"", selector_part); return value; } ",0 "void NavigationControllerImpl::LoadIfNecessary() { if (!needs_reload_) return; pending_entry_index_ = last_committed_entry_index_; NavigateToPendingEntry(NO_RELOAD); } ",0 "int nntp_add_group(char *line, void *data) { struct NntpServer *nserv = data; struct NntpData *nntp_data = NULL; char group[LONG_STRING] = """"; char desc[HUGE_STRING] = """"; char mod; anum_t first, last; if (!nserv || !line) return 0; /* These sscanf limits must match the sizes of the group and desc arrays */ if (sscanf(line, ""%1023s "" ANUM "" "" ANUM "" %c %8191[^\n]"", group, &last, &first, &mod, desc) < 4) { mutt_debug(4, ""Cannot parse server line: %s\n"", line); return 0; } nntp_data = nntp_data_find(nserv, group); nntp_data->deleted = false; nntp_data->first_message = first; nntp_data->last_message = last; nntp_data->allowed = (mod == 'y') || (mod == 'm'); mutt_str_replace(&nntp_data->desc, desc); if (nntp_data->newsrc_ent || nntp_data->last_cached) nntp_group_unread_stat(nntp_data); else if (nntp_data->last_message && nntp_data->first_message <= nntp_data->last_message) nntp_data->unread = nntp_data->last_message - nntp_data->first_message + 1; else nntp_data->unread = 0; return 0; } ",0 "AutofillManager::AutofillManager(TabContentsWrapper* tab_contents) : TabContentsObserver(tab_contents->tab_contents()), tab_contents_wrapper_(tab_contents), personal_data_(NULL), download_manager_(tab_contents->profile()), disable_download_manager_requests_(false), metric_logger_(new AutofillMetrics), has_logged_autofill_enabled_(false), has_logged_address_suggestions_count_(false) { DCHECK(tab_contents); personal_data_ = tab_contents->profile()->GetOriginalProfile()->GetPersonalDataManager(); download_manager_.SetObserver(this); } ",0 "bgp_attr_cluster_list(struct bgp_attr_parser_args *args) { struct peer *const peer = args->peer; struct attr *const attr = args->attr; const bgp_size_t length = args->length; /* Check length. */ if (length % 4) { flog_err(EC_BGP_ATTR_LEN, ""Bad cluster list length %d"", length); return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR, args->total); } attr->cluster = cluster_parse((struct in_addr *)stream_pnt(peer->curr), length); /* XXX: Fix cluster_parse to use stream API and then remove this */ stream_forward_getp(peer->curr, length); attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST); return BGP_ATTR_PARSE_PROCEED; } ",0 "on_user_changed_timeout (User *user) { user->changed_timeout_id = 0; accounts_user_emit_changed (ACCOUNTS_USER (user)); return G_SOURCE_REMOVE; } ",0 "int __netlink_dump_start(struct sock *ssk, struct sk_buff *skb, const struct nlmsghdr *nlh, struct netlink_dump_control *control) { struct netlink_callback *cb; struct sock *sk; struct netlink_sock *nlk; int ret; atomic_inc(&skb->users); sk = netlink_lookup(sock_net(ssk), ssk->sk_protocol, NETLINK_CB(skb).portid); if (sk == NULL) { ret = -ECONNREFUSED; goto error_free; } nlk = nlk_sk(sk); mutex_lock(nlk->cb_mutex); /* A dump is in progress... */ if (nlk->cb_running) { ret = -EBUSY; goto error_unlock; } /* add reference of module which cb->dump belongs to */ if (!try_module_get(control->module)) { ret = -EPROTONOSUPPORT; goto error_unlock; } cb = &nlk->cb; memset(cb, 0, sizeof(*cb)); cb->start = control->start; cb->dump = control->dump; cb->done = control->done; cb->nlh = nlh; cb->data = control->data; cb->module = control->module; cb->min_dump_alloc = control->min_dump_alloc; cb->skb = skb; nlk->cb_running = true; mutex_unlock(nlk->cb_mutex); if (cb->start) cb->start(cb); ret = netlink_dump(sk); sock_put(sk); if (ret) return ret; /* We successfully started a dump, by returning -EINTR we * signal not to send ACK even if it was requested. */ return -EINTR; error_unlock: sock_put(sk); mutex_unlock(nlk->cb_mutex); error_free: kfree_skb(skb); return ret; } ",0 "broken_splay() { dlprintf(""Broken splay tree!\n""); } ",0 "static int fwnet_stop(struct net_device *net) { struct fwnet_device *dev = netdev_priv(net); netif_stop_queue(net); fwnet_broadcast_stop(dev); return 0; } ",0 " bool determinedMarginBeforeQuirk() const { return m_determinedMarginBeforeQuirk; } ",0 "void RTCPeerConnectionHandlerChromium::didChangeReadyState(WebKit::WebRTCPeerConnectionHandlerClient::ReadyState state) { m_client->didChangeReadyState(static_cast(state)); } ",0 "void reclaim_file(DOS_FS * fs) { DOS_FILE orphan; int reclaimed, files; int changed = 0; uint32_t i, next, walk; uint32_t *num_refs = NULL; /* Only for orphaned clusters */ uint32_t total_num_clusters; if (verbose) printf(""Reclaiming unconnected clusters.\n""); total_num_clusters = fs->clusters + 2UL; num_refs = alloc(total_num_clusters * sizeof(uint32_t)); memset(num_refs, 0, (total_num_clusters * sizeof(uint32_t))); /* Guarantee that all orphan chains (except cycles) end cleanly * with an end-of-chain mark. */ for (i = 2; i < total_num_clusters; i++) { FAT_ENTRY curEntry; get_fat(&curEntry, fs->fat, i, fs); next = curEntry.value; if (!get_owner(fs, i) && next && next < fs->clusters + 2) { /* Cluster is linked, but not owned (orphan) */ FAT_ENTRY nextEntry; get_fat(&nextEntry, fs->fat, next, fs); /* Mark it end-of-chain if it links into an owned cluster, * a free cluster, or a bad cluster. */ if (get_owner(fs, next) || !nextEntry.value || FAT_IS_BAD(fs, nextEntry.value)) set_fat(fs, i, -1); else num_refs[next]++; } } /* Scan until all the orphans are accounted for, * and all cycles and cross-links are broken */ do { tag_free(fs, &orphan, num_refs, changed); changed = 0; /* Any unaccounted-for orphans must be part of a cycle */ for (i = 2; i < total_num_clusters; i++) { FAT_ENTRY curEntry; get_fat(&curEntry, fs->fat, i, fs); if (curEntry.value && !FAT_IS_BAD(fs, curEntry.value) && !get_owner(fs, i)) { if (!num_refs[curEntry.value]--) die(""Internal error: num_refs going below zero""); set_fat(fs, i, -1); changed = curEntry.value; printf(""Broke cycle at cluster %lu in free chain.\n"", (unsigned long)i); /* If we've created a new chain head, * tag_free() can claim it */ if (num_refs[curEntry.value] == 0) break; } } } while (changed); /* Now we can start recovery */ files = reclaimed = 0; for (i = 2; i < total_num_clusters; i++) /* If this cluster is the head of an orphan chain... */ if (get_owner(fs, i) == &orphan && !num_refs[i]) { DIR_ENT de; loff_t offset; files++; offset = alloc_rootdir_entry(fs, &de, ""FSCK%04dREC""); de.start = htole16(i & 0xffff); if (fs->fat_bits == 32) de.starthi = htole16(i >> 16); for (walk = i; walk > 0 && walk != -1; walk = next_cluster(fs, walk)) { de.size = htole32(le32toh(de.size) + fs->cluster_size); reclaimed++; } fs_write(offset, sizeof(DIR_ENT), &de); } if (reclaimed) printf(""Reclaimed %d unused cluster%s (%llu bytes) in %d chain%s.\n"", reclaimed, reclaimed == 1 ? """" : ""s"", (unsigned long long)reclaimed * fs->cluster_size, files, files == 1 ? """" : ""s""); free(num_refs); } ",0 "void GDataFileSystem::RequestDirectoryRefresh(const FilePath& file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || BrowserThread::CurrentlyOn(BrowserThread::IO)); RunTaskOnUIThread( base::Bind(&GDataFileSystem::RequestDirectoryRefreshOnUIThread, ui_weak_ptr_, file_path)); } ",0 "status_t IGraphicBufferProducer::QueueBufferInput::flatten( void*& buffer, size_t& size, int*& fds, size_t& count) const { if (size < getFlattenedSize()) { return NO_MEMORY; } FlattenableUtils::write(buffer, size, timestamp); FlattenableUtils::write(buffer, size, isAutoTimestamp); FlattenableUtils::write(buffer, size, dataSpace); FlattenableUtils::write(buffer, size, crop); FlattenableUtils::write(buffer, size, scalingMode); FlattenableUtils::write(buffer, size, transform); FlattenableUtils::write(buffer, size, stickyTransform); FlattenableUtils::write(buffer, size, async); status_t result = fence->flatten(buffer, size, fds, count); if (result != NO_ERROR) { return result; } return surfaceDamage.flatten(buffer, size); } ",0 "void HTMLFormControlElement::dispatchBlurEvent( Element* newFocusedElement, WebFocusType type, InputDeviceCapabilities* sourceCapabilities) { if (type != WebFocusTypePage) m_wasFocusedByMouse = false; HTMLElement::dispatchBlurEvent(newFocusedElement, type, sourceCapabilities); hideVisibleValidationMessage(); } ",0 "static int WMFReadBlob(void *image) { return(ReadBlobByte((Image *) image)); } ",0 " explicit TestVariationsSeedStore(PrefService* local_state) : VariationsSeedStore(local_state) {} ",0 "int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len) { return kvm_write_guest_page(kvm, gfn, (const void *) empty_zero_page, offset, len); } ",0 "bool ChromeMetricsServiceClient::IsWebstoreExtension(base::StringPiece id) { #if BUILDFLAG(ENABLE_EXTENSIONS) bool matched = false; ProfileManager* profile_manager = g_browser_process->profile_manager(); DCHECK(profile_manager); auto profiles = profile_manager->GetLoadedProfiles(); for (Profile* profile : profiles) { DCHECK(profile); extensions::ExtensionRegistry* registry = extensions::ExtensionRegistry::Get(profile); if (!registry) continue; const extensions::Extension* extension = registry->GetExtensionById( id.as_string(), extensions::ExtensionRegistry::ENABLED); if (!extension) continue; if (!extension->from_webstore()) return false; matched = true; } return matched; #else return false; #endif } ",0 " CapturingProxyResolver() : ProxyResolver(false /* expects_pac_bytes */) {} ",0 "Magick_png_read_raw_profile(png_struct *ping,Image *image, const ImageInfo *image_info, png_textp text,int ii,ExceptionInfo *exception) { register ssize_t i; register unsigned char *dp; register png_charp sp; size_t extent, length, nibbles; StringInfo *profile; static const unsigned char unhex[103]={0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,1, 2,3,4,5,6,7,8,9,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,10,11,12, 13,14,15}; sp=text[ii].text+1; extent=text[ii].text_length; /* look for newline */ while ((*sp != '\n') && extent--) sp++; /* look for length */ while (((*sp == '\0' || *sp == ' ' || *sp == '\n')) && extent--) sp++; if (extent == 0) { png_warning(ping,""invalid profile length""); return(MagickFalse); } length=StringToLong(sp); (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" length: %lu"",(unsigned long) length); while ((*sp != ' ' && *sp != '\n') && extent--) sp++; if (extent == 0) { png_warning(ping,""missing profile length""); return(MagickFalse); } /* allocate space */ if (length == 0) { png_warning(ping,""invalid profile length""); return(MagickFalse); } profile=BlobToStringInfo((const void *) NULL,length); if (profile == (StringInfo *) NULL) { png_warning(ping, ""unable to copy profile""); return(MagickFalse); } /* copy profile, skipping white space and column 1 ""="" signs */ dp=GetStringInfoDatum(profile); nibbles=length*2; for (i=0; i < (ssize_t) nibbles; i++) { while (*sp < '0' || (*sp > '9' && *sp < 'a') || *sp > 'f') { if (*sp == '\0') { png_warning(ping, ""ran out of profile data""); profile=DestroyStringInfo(profile); return(MagickFalse); } sp++; } if (i%2 == 0) *dp=(unsigned char) (16*unhex[(int) *sp++]); else (*dp++)+=unhex[(int) *sp++]; } /* We have already read ""Raw profile type. */ (void) SetImageProfile(image,&text[ii].key[17],profile,exception); profile=DestroyStringInfo(profile); if (image_info->verbose) (void) printf("" Found a generic profile, type %s\n"",&text[ii].key[17]); return MagickTrue; } ",0 "parse_str_rsrc (SF_PRIVATE *psf, SD2_RSRC * rsrc) { char name [32], value [32] ; int k, str_offset, rsrc_id, data_offset = 0, data_len = 0 ; psf_log_printf (psf, ""Finding parameters :\n"") ; str_offset = rsrc->string_offset ; psf_log_printf (psf, "" Offset RsrcId dlen slen Value\n"") ; for (k = 0 ; data_offset + data_len < rsrc->rsrc_len ; k++) { int slen ; slen = read_rsrc_char (rsrc, str_offset) ; read_rsrc_str (rsrc, str_offset + 1, name, SF_MIN (SIGNED_SIZEOF (name), slen + 1)) ; str_offset += slen + 1 ; rsrc_id = read_rsrc_short (rsrc, rsrc->item_offset + k * 12) ; data_offset = rsrc->data_offset + read_rsrc_int (rsrc, rsrc->item_offset + k * 12 + 4) ; if (data_offset < 0 || data_offset > rsrc->rsrc_len) { psf_log_printf (psf, ""Exiting parser on data offset of %d.\n"", data_offset) ; break ; } ; data_len = read_rsrc_int (rsrc, data_offset) ; if (data_len < 0 || data_len > rsrc->rsrc_len) { psf_log_printf (psf, ""Exiting parser on data length of %d.\n"", data_len) ; break ; } ; slen = read_rsrc_char (rsrc, data_offset + 4) ; read_rsrc_str (rsrc, data_offset + 5, value, SF_MIN (SIGNED_SIZEOF (value), slen + 1)) ; psf_log_printf (psf, "" 0x%04x %4d %4d %3d '%s'\n"", data_offset, rsrc_id, data_len, slen, value) ; if (rsrc_id == 1000 && rsrc->sample_size == 0) rsrc->sample_size = strtol (value, NULL, 10) ; else if (rsrc_id == 1001 && rsrc->sample_rate == 0) rsrc->sample_rate = strtol (value, NULL, 10) ; else if (rsrc_id == 1002 && rsrc->channels == 0) rsrc->channels = strtol (value, NULL, 10) ; } ; psf_log_printf (psf, ""Found Parameters :\n"") ; psf_log_printf (psf, "" sample-size : %d\n"", rsrc->sample_size) ; psf_log_printf (psf, "" sample-rate : %d\n"", rsrc->sample_rate) ; psf_log_printf (psf, "" channels : %d\n"", rsrc->channels) ; if (rsrc->sample_rate <= 4 && rsrc->sample_size > 4) { int temp ; psf_log_printf (psf, ""Geez!! Looks like sample rate and sample size got switched.\nCorrecting this screw up.\n"") ; temp = rsrc->sample_rate ; rsrc->sample_rate = rsrc->sample_size ; rsrc->sample_size = temp ; } ; if (rsrc->sample_rate < 0) { psf_log_printf (psf, ""Bad sample rate (%d)\n"", rsrc->sample_rate) ; return SFE_SD2_BAD_RSRC ; } ; if (rsrc->channels < 0) { psf_log_printf (psf, ""Bad channel count (%d)\n"", rsrc->channels) ; return SFE_SD2_BAD_RSRC ; } ; psf->sf.samplerate = rsrc->sample_rate ; psf->sf.channels = rsrc->channels ; psf->bytewidth = rsrc->sample_size ; switch (rsrc->sample_size) { case 1 : psf->sf.format = SF_FORMAT_SD2 | SF_FORMAT_PCM_S8 ; break ; case 2 : psf->sf.format = SF_FORMAT_SD2 | SF_FORMAT_PCM_16 ; break ; case 3 : psf->sf.format = SF_FORMAT_SD2 | SF_FORMAT_PCM_24 ; break ; case 4 : psf->sf.format = SF_FORMAT_SD2 | SF_FORMAT_PCM_32 ; break ; default : psf_log_printf (psf, ""Bad sample size (%d)\n"", rsrc->sample_size) ; return SFE_SD2_BAD_SAMPLE_SIZE ; } ; psf_log_printf (psf, ""ok\n"") ; return 0 ; } /* parse_str_rsrc */ ",0 "PHP_MINIT_FUNCTION(dns) { REGISTER_LONG_CONSTANT(""DNS_A"", PHP_DNS_A, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""DNS_NS"", PHP_DNS_NS, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""DNS_CNAME"", PHP_DNS_CNAME, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""DNS_SOA"", PHP_DNS_SOA, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""DNS_PTR"", PHP_DNS_PTR, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""DNS_HINFO"", PHP_DNS_HINFO, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""DNS_MX"", PHP_DNS_MX, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""DNS_TXT"", PHP_DNS_TXT, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""DNS_SRV"", PHP_DNS_SRV, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""DNS_NAPTR"", PHP_DNS_NAPTR, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""DNS_AAAA"", PHP_DNS_AAAA, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""DNS_A6"", PHP_DNS_A6, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""DNS_ANY"", PHP_DNS_ANY, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""DNS_ALL"", PHP_DNS_ALL, CONST_CS | CONST_PERSISTENT); return SUCCESS; } ",0 "syncable::Id SyncerUtil::FindLocalIdToUpdate( syncable::BaseTransaction* trans, const SyncEntity& update) { const std::string& client_id = trans->directory()->cache_guid(); if (update.has_client_defined_unique_tag() && !update.client_defined_unique_tag().empty()) { syncable::Entry local_entry(trans, syncable::GET_BY_CLIENT_TAG, update.client_defined_unique_tag()); if (local_entry.good()) { if (local_entry.Get(ID).ServerKnows()) { if (local_entry.Get(ID) != update.id()) { LOG(WARNING) << ""Duplicated client tag.""; if (local_entry.Get(ID) < update.id()) { return syncable::GetNullId(); } } return local_entry.Get(ID); } else { DCHECK(0 == local_entry.Get(BASE_VERSION) || CHANGES_VERSION == local_entry.Get(BASE_VERSION)); return local_entry.Get(ID); } } } else if (update.has_originator_cache_guid() && update.originator_cache_guid() == client_id) { syncable::Id client_item_id = syncable::Id::CreateFromClientString( update.originator_client_item_id()); DCHECK(!client_item_id.ServerKnows()); syncable::Entry local_entry(trans, GET_BY_ID, client_item_id); if (local_entry.good() && !local_entry.Get(IS_DEL)) { int64 old_version = local_entry.Get(BASE_VERSION); int64 new_version = update.version(); DCHECK_LE(old_version, 0); DCHECK_GT(new_version, 0); DCHECK(local_entry.Get(IS_UNSYNCED)); DCHECK(!local_entry.Get(ID).ServerKnows()); VLOG(1) << ""Reuniting lost commit response IDs. server id: "" << update.id() << "" local id: "" << local_entry.Get(ID) << "" new version: "" << new_version; return local_entry.Get(ID); } } return update.id(); } ",0 "bool PrintRenderFrameHelper::Delegate::IsAskPrintSettingsEnabled() { return true; } ",0 "void WebContentsImpl::RenderWidgetDeleted( RenderWidgetHostImpl* render_widget_host) { if (is_being_destroyed_) { return; } std::set::iterator iter = created_widgets_.find(render_widget_host); if (iter != created_widgets_.end()) created_widgets_.erase(iter); if (render_widget_host && render_widget_host->GetRoutingID() == fullscreen_widget_routing_id_) { FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidDestroyFullscreenWidget( fullscreen_widget_routing_id_)); fullscreen_widget_routing_id_ = MSG_ROUTING_NONE; } } ",0 "RendererProcessClosedObserver::RendererProcessClosedObserver( AutomationProvider* automation, IPC::Message* reply_message) : automation_(automation->AsWeakPtr()), reply_message_(reply_message) { registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, content::NotificationService::AllSources()); } ",0 "static struct crypto_instance *crypto_rfc4543_alloc(struct rtattr **tb) { struct crypto_attr_type *algt; struct crypto_instance *inst; struct crypto_aead_spawn *spawn; struct crypto_alg *alg; struct crypto_rfc4543_instance_ctx *ctx; const char *ccm_name; int err; algt = crypto_get_attr_type(tb); if (IS_ERR(algt)) return ERR_CAST(algt); if ((algt->type ^ CRYPTO_ALG_TYPE_AEAD) & algt->mask) return ERR_PTR(-EINVAL); ccm_name = crypto_attr_alg_name(tb[1]); if (IS_ERR(ccm_name)) return ERR_CAST(ccm_name); inst = kzalloc(sizeof(*inst) + sizeof(*ctx), GFP_KERNEL); if (!inst) return ERR_PTR(-ENOMEM); ctx = crypto_instance_ctx(inst); spawn = &ctx->aead; crypto_set_aead_spawn(spawn, inst); err = crypto_grab_aead(spawn, ccm_name, 0, crypto_requires_sync(algt->type, algt->mask)); if (err) goto out_free_inst; alg = crypto_aead_spawn_alg(spawn); crypto_set_skcipher_spawn(&ctx->null, inst); err = crypto_grab_skcipher(&ctx->null, ""ecb(cipher_null)"", 0, CRYPTO_ALG_ASYNC); if (err) goto out_drop_alg; crypto_skcipher_spawn_alg(&ctx->null); err = -EINVAL; /* We only support 16-byte blocks. */ if (alg->cra_aead.ivsize != 16) goto out_drop_ecbnull; /* Not a stream cipher? */ if (alg->cra_blocksize != 1) goto out_drop_ecbnull; err = -ENAMETOOLONG; if (snprintf(inst->alg.cra_name, CRYPTO_MAX_ALG_NAME, ""rfc4543(%s)"", alg->cra_name) >= CRYPTO_MAX_ALG_NAME || snprintf(inst->alg.cra_driver_name, CRYPTO_MAX_ALG_NAME, ""rfc4543(%s)"", alg->cra_driver_name) >= CRYPTO_MAX_ALG_NAME) goto out_drop_ecbnull; inst->alg.cra_flags = CRYPTO_ALG_TYPE_AEAD; inst->alg.cra_flags |= alg->cra_flags & CRYPTO_ALG_ASYNC; inst->alg.cra_priority = alg->cra_priority; inst->alg.cra_blocksize = 1; inst->alg.cra_alignmask = alg->cra_alignmask; inst->alg.cra_type = &crypto_nivaead_type; inst->alg.cra_aead.ivsize = 8; inst->alg.cra_aead.maxauthsize = 16; inst->alg.cra_ctxsize = sizeof(struct crypto_rfc4543_ctx); inst->alg.cra_init = crypto_rfc4543_init_tfm; inst->alg.cra_exit = crypto_rfc4543_exit_tfm; inst->alg.cra_aead.setkey = crypto_rfc4543_setkey; inst->alg.cra_aead.setauthsize = crypto_rfc4543_setauthsize; inst->alg.cra_aead.encrypt = crypto_rfc4543_encrypt; inst->alg.cra_aead.decrypt = crypto_rfc4543_decrypt; inst->alg.cra_aead.geniv = ""seqiv""; out: return inst; out_drop_ecbnull: crypto_drop_skcipher(&ctx->null); out_drop_alg: crypto_drop_aead(spawn); out_free_inst: kfree(inst); inst = ERR_PTR(err); goto out; } ",0 "static int block_add_checksum (unsigned char *buffer_start, unsigned char *buffer_end, int bytes) { WavpackHeader *wphdr = (WavpackHeader *) buffer_start; #ifdef BITSTREAM_SHORTS uint16_t *csptr = (uint16_t*) buffer_start; #else unsigned char *csptr = buffer_start; #endif int bcount = wphdr->ckSize + 8, wcount; uint32_t csum = (uint32_t) -1; if (bytes != 2 && bytes != 4) return FALSE; if (bcount < sizeof (WavpackHeader) || (bcount & 1) || buffer_start + bcount + 2 + bytes > buffer_end) return FALSE; wphdr->flags |= HAS_CHECKSUM; wphdr->ckSize += 2 + bytes; wcount = bcount >> 1; #ifdef BITSTREAM_SHORTS while (wcount--) csum = (csum * 3) + *csptr++; #else WavpackNativeToLittleEndian ((WavpackHeader *) buffer_start, WavpackHeaderFormat); while (wcount--) { csum = (csum * 3) + csptr [0] + (csptr [1] << 8); csptr += 2; } WavpackLittleEndianToNative ((WavpackHeader *) buffer_start, WavpackHeaderFormat); #endif buffer_start += bcount; *buffer_start++ = ID_BLOCK_CHECKSUM; *buffer_start++ = bytes >> 1; if (bytes == 4) { *buffer_start++ = csum; *buffer_start++ = csum >> 8; *buffer_start++ = csum >> 16; *buffer_start++ = csum >> 24; } else { csum ^= csum >> 16; *buffer_start++ = csum; *buffer_start++ = csum >> 8; } return TRUE; } ",0 "static size_t rtnl_link_get_size(const struct net_device *dev) { const struct rtnl_link_ops *ops = dev->rtnl_link_ops; size_t size; if (!ops) return 0; size = nla_total_size(sizeof(struct nlattr)) + /* IFLA_LINKINFO */ nla_total_size(strlen(ops->kind) + 1); /* IFLA_INFO_KIND */ if (ops->get_size) /* IFLA_INFO_DATA + nested data */ size += nla_total_size(sizeof(struct nlattr)) + ops->get_size(dev); if (ops->get_xstats_size) /* IFLA_INFO_XSTATS */ size += nla_total_size(ops->get_xstats_size(dev)); return size; } ",0 "DevToolsWindow::~DevToolsWindow() { life_stage_ = kClosing; UpdateBrowserWindow(); UpdateBrowserToolbar(); if (toolbox_web_contents_) delete toolbox_web_contents_; DevToolsWindows* instances = g_instances.Pointer(); DevToolsWindows::iterator it( std::find(instances->begin(), instances->end(), this)); DCHECK(it != instances->end()); instances->erase(it); if (!close_callback_.is_null()) { close_callback_.Run(); close_callback_ = base::Closure(); } } ",0 "void PepperVideoRenderer3D::DecodeNextPacket() { if (!initialization_finished_ || decode_pending_ || pending_packets_.empty()) return; ++latest_frame_id_; frame_decode_timestamps_.push_back( FrameDecodeTimestamp(latest_frame_id_, base::TimeTicks::Now())); const VideoPacket* packet = pending_packets_.front()->packet(); int32_t result = video_decoder_.Decode( latest_frame_id_, packet->data().size(), packet->data().data(), callback_factory_.NewCallback(&PepperVideoRenderer3D::OnDecodeDone)); CHECK_EQ(result, PP_OK_COMPLETIONPENDING); decode_pending_ = true; } ",0 "int phar_open_archive_fp(phar_archive_data *phar TSRMLS_DC) /* {{{ */ { if (phar_get_pharfp(phar TSRMLS_CC)) { return SUCCESS; } if (php_check_open_basedir(phar->fname TSRMLS_CC)) { return FAILURE; } phar_set_pharfp(phar, php_stream_open_wrapper(phar->fname, ""rb"", IGNORE_URL|STREAM_MUST_SEEK|0, NULL) TSRMLS_CC); if (!phar_get_pharfp(phar TSRMLS_CC)) { return FAILURE; } return SUCCESS; } /* }}} */ ",0 "status_t String8::setTo(const char* other) { const char *newString = allocFromUTF8(other, strlen(other)); SharedBuffer::bufferFromData(mString)->release(); mString = newString; if (mString) return NO_ERROR; mString = getEmptyString(); return NO_MEMORY; } ",0 "void MetricsWebContentsObserver::RemoveTestingObserver( TestingObserver* observer) { testing_observers_.RemoveObserver(observer); } ",0 "static __be32 nfsd4_decode_destroy_clientid(struct nfsd4_compoundargs *argp, struct nfsd4_destroy_clientid *dc) { DECODE_HEAD; READ_BUF(8); COPYMEM(&dc->clientid, 8); DECODE_TAIL; } ",0 "void ServiceWorkerContextCore::HasMainFrameProviderHost( const GURL& origin, BoolCallback callback) const { DCHECK_CURRENTLY_ON(BrowserThread::IO); ProviderHostIterator provider_host_iterator( providers_.get(), base::BindRepeating(IsSameOriginWindowProviderHost, origin)); if (provider_host_iterator.IsAtEnd()) { base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(std::move(callback), false)); return; } std::unique_ptr>> render_frames( new std::vector>()); while (!provider_host_iterator.IsAtEnd()) { ServiceWorkerProviderHost* provider_host = provider_host_iterator.GetProviderHost(); render_frames->push_back( std::make_pair(provider_host->process_id(), provider_host->frame_id())); provider_host_iterator.Advance(); } base::PostTaskWithTraitsAndReplyWithResult( FROM_HERE, {BrowserThread::UI}, base::BindOnce(&FrameListContainsMainFrameOnUI, std::move(render_frames)), std::move(callback)); } ",0 "bool venc_dev::venc_set_slice_delivery_mode(OMX_U32 enable) { struct v4l2_control control; if (enable) { control.id = V4L2_CID_MPEG_VIDEO_MULTI_SLICE_DELIVERY_MODE; control.value = 1; DEBUG_PRINT_LOW(""Set slice_delivery_mode: %d"", control.value); if (multislice.mslice_mode == V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_MB && m_sVenc_cfg.codectype == V4L2_PIX_FMT_H264) { if (ioctl(m_nDriver_fd, VIDIOC_S_CTRL, &control)) { DEBUG_PRINT_ERROR(""Request for setting slice delivery mode failed""); return false; } else { DEBUG_PRINT_LOW(""Successfully set Slice delivery mode id: %d, value=%d"", control.id, control.value); slice_mode.enable = 1; } } else { DEBUG_PRINT_ERROR(""Failed to set slice delivery mode, slice_mode [%lu] "" ""is not MB BASED or [%lu] is not H264 codec "", multislice.mslice_mode, m_sVenc_cfg.codectype); } } else { DEBUG_PRINT_ERROR(""Slice_DELIVERY_MODE not enabled""); } return true; } ",0 "add_char_opt_map(OptMap* m, UChar c, OnigEncoding enc) { if (m->map[c] == 0) { m->map[c] = 1; m->value += map_position_value(enc, c); } } ",0 "void PageHandler::DidDetachInterstitialPage() { if (!enabled_) return; frontend_->InterstitialHidden(); } ",0 "int SyncTest::NumberOfDefaultSyncItems() const { return number_of_default_sync_items_; } ",0 "bool MediaElementAudioSourceHandler::PassesCurrentSrcCORSAccessCheck( const KURL& current_src) { DCHECK(IsMainThread()); return Context()->GetSecurityOrigin() && Context()->GetSecurityOrigin()->CanRequest(current_src); } ",1 "LayoutUnit LayoutBlockFlow::adjustLogicalRightOffsetForLine(LayoutUnit offsetFromFloats, bool applyTextIndent) const { LayoutUnit right = offsetFromFloats; if (applyTextIndent && !style()->isLeftToRightDirection()) right -= textIndentOffset(); return right; } ",0 "static inline bool skb_loop_sk(struct packet_type *ptype, struct sk_buff *skb) { if (!ptype->af_packet_priv || !skb->sk) return false; if (ptype->id_match) return ptype->id_match(ptype, skb->sk); else if ((struct sock *)ptype->af_packet_priv == skb->sk) return true; return false; } ",0 "OJPEGLibjpegJpegSourceMgrInitSource(jpeg_decompress_struct* cinfo) { (void)cinfo; } ",0 "void WebContentsImpl::EnsureOpenerProxiesExist(RenderFrameHost* source_rfh) { WebContentsImpl* source_web_contents = static_cast( WebContents::FromRenderFrameHost(source_rfh)); if (source_web_contents) { if (GetBrowserPluginEmbedder() && BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) { return; } if (this != source_web_contents && GetBrowserPluginGuest()) { if (SiteIsolationPolicy::IsSwappedOutStateForbidden()) { source_web_contents->GetRenderManager()->CreateRenderFrameProxy( GetSiteInstance()); } else { source_web_contents->CreateSwappedOutRenderView(GetSiteInstance()); } } else { RenderFrameHostImpl* source_rfhi = static_cast(source_rfh); source_rfhi->frame_tree_node()->render_manager()->CreateOpenerProxies( GetSiteInstance(), nullptr); } } } ",0 "static void dm_put_live_table_fast(struct mapped_device *md) __releases(RCU) { rcu_read_unlock(); } ",0 "void __perf_event_task_sched_out(struct task_struct *task, struct task_struct *next) { int ctxn; if (__this_cpu_read(perf_sched_cb_usages)) perf_pmu_sched_task(task, next, false); if (atomic_read(&nr_switch_events)) perf_event_switch(task, next, false); for_each_task_context_nr(ctxn) perf_event_context_sched_out(task, ctxn, next); /* * if cgroup events exist on this CPU, then we need * to check if we have to switch out PMU state. * cgroup event are system-wide mode only */ if (atomic_read(this_cpu_ptr(&perf_cgroup_events))) perf_cgroup_sched_out(task, next); } ",0 "u8 *nfc_llcp_build_tlv(u8 type, u8 *value, u8 value_length, u8 *tlv_length) { u8 *tlv, length; pr_debug(""type %d\n"", type); if (type >= LLCP_TLV_MAX) return NULL; length = llcp_tlv_length[type]; if (length == 0 && value_length == 0) return NULL; else if (length == 0) length = value_length; *tlv_length = 2 + length; tlv = kzalloc(2 + length, GFP_KERNEL); if (tlv == NULL) return tlv; tlv[0] = type; tlv[1] = length; memcpy(tlv + 2, value, length); return tlv; } ",0 "void skb_trim(struct sk_buff *skb, unsigned int len) { if (skb->len > len) __skb_trim(skb, len); } ",0 "static int suspend_prepare(struct regulator_dev *rdev, suspend_state_t state) { if (!rdev->constraints) return -EINVAL; switch (state) { case PM_SUSPEND_STANDBY: return suspend_set_state(rdev, &rdev->constraints->state_standby); case PM_SUSPEND_MEM: return suspend_set_state(rdev, &rdev->constraints->state_mem); case PM_SUSPEND_MAX: return suspend_set_state(rdev, &rdev->constraints->state_disk); default: return -EINVAL; } } ",0 "static int tg3_fw_img_is_valid(struct tg3 *tp, u32 offset) { u32 val; if (tg3_nvram_read(tp, offset, &val) || (val & 0xfc000000) != 0x0c000000 || tg3_nvram_read(tp, offset + 4, &val) || val != 0) return 0; return 1; } ",0 "void snd_usb_mixer_elem_free(struct snd_kcontrol *kctl) { kfree(kctl->private_data); kctl->private_data = NULL; } ",0 "ofputil_pull_ofp15_group_mod(struct ofpbuf *msg, enum ofp_version ofp_version, struct ofputil_group_mod *gm) { const struct ofp15_group_mod *ogm; uint16_t bucket_list_len; enum ofperr error = OFPERR_OFPGMFC_BAD_BUCKET; ogm = ofpbuf_pull(msg, sizeof *ogm); gm->command = ntohs(ogm->command); gm->type = ogm->type; gm->group_id = ntohl(ogm->group_id); gm->command_bucket_id = ntohl(ogm->command_bucket_id); switch (gm->command) { case OFPGC15_REMOVE_BUCKET: if (gm->command_bucket_id == OFPG15_BUCKET_ALL) { error = 0; } /* Fall through */ case OFPGC15_INSERT_BUCKET: if (gm->command_bucket_id <= OFPG15_BUCKET_MAX || gm->command_bucket_id == OFPG15_BUCKET_FIRST || gm->command_bucket_id == OFPG15_BUCKET_LAST) { error = 0; } break; case OFPGC11_ADD: case OFPGC11_MODIFY: case OFPGC11_ADD_OR_MOD: case OFPGC11_DELETE: default: if (gm->command_bucket_id == OFPG15_BUCKET_ALL) { error = 0; } break; } if (error) { VLOG_WARN_RL(&bad_ofmsg_rl, ""group command bucket id (%u) is out of range"", gm->command_bucket_id); return OFPERR_OFPGMFC_BAD_BUCKET; } bucket_list_len = ntohs(ogm->bucket_array_len); if (bucket_list_len > msg->size) { return OFPERR_OFPBRC_BAD_LEN; } error = ofputil_pull_ofp15_buckets(msg, bucket_list_len, ofp_version, gm->type, &gm->buckets); if (error) { return error; } error = parse_ofp15_group_properties(msg, gm->type, gm->command, &gm->props, msg->size); if (error) { ofputil_bucket_list_destroy(&gm->buckets); } return error; } ",0 "int restartServer(int flags, mstime_t delay) { int j; /* Check if we still have accesses to the executable that started this * server instance. */ if (access(server.executable,X_OK) == -1) return C_ERR; /* Config rewriting. */ if (flags & RESTART_SERVER_CONFIG_REWRITE && server.configfile && rewriteConfig(server.configfile) == -1) return C_ERR; /* Perform a proper shutdown. */ if (flags & RESTART_SERVER_GRACEFULLY && prepareForShutdown(SHUTDOWN_NOFLAGS) != C_OK) return C_ERR; /* Close all file descriptors, with the exception of stdin, stdout, strerr * which are useful if we restart a Redis server which is not daemonized. */ for (j = 3; j < (int)server.maxclients + 1024; j++) close(j); /* Execute the server with the original command line. */ if (delay) usleep(delay*1000); execve(server.executable,server.exec_argv,environ); /* If an error occurred here, there is nothing we can do, but exit. */ _exit(1); return C_ERR; /* Never reached. */ } ",0 " tt_cmap13_next( TT_CMap13 cmap ) { FT_Byte* p; FT_ULong start, end, glyph_id, char_code; FT_ULong n; FT_UInt gindex; if ( cmap->cur_charcode >= 0xFFFFFFFFUL ) goto Fail; char_code = cmap->cur_charcode + 1; for ( n = cmap->cur_group; n < cmap->num_groups; n++ ) { p = cmap->cmap.data + 16 + 12 * n; start = TT_NEXT_ULONG( p ); end = TT_NEXT_ULONG( p ); glyph_id = TT_PEEK_ULONG( p ); if ( char_code < start ) char_code = start; if ( char_code <= end ) { gindex = (FT_UInt)glyph_id; if ( gindex ) { cmap->cur_charcode = char_code;; cmap->cur_gindex = gindex; cmap->cur_group = n; return; } } } Fail: cmap->valid = 0; } ",0 "PassRefPtr UniqueElementData::makeShareableCopy() const { void* slot = WTF::fastMalloc(sizeForShareableElementDataWithAttributeCount(m_attributeVector.size())); return adoptRef(new (slot) ShareableElementData(*this)); } ",0 "bool FileUtilProxy::Touch( scoped_refptr message_loop_proxy, const FilePath& file_path, const base::Time& last_access_time, const base::Time& last_modified_time, StatusCallback* callback) { return Start(FROM_HERE, message_loop_proxy, new RelayTouchFilePath(file_path, last_access_time, last_modified_time, callback)); } ",0 "lmp_print_data_link_subobjs(netdissect_options *ndo, const u_char *obj_tptr, int total_subobj_len, int offset) { int hexdump = FALSE; int subobj_type, subobj_len; union { /* int to float conversion buffer */ float f; uint32_t i; } bw; while (total_subobj_len > 0 && hexdump == FALSE ) { subobj_type = EXTRACT_8BITS(obj_tptr + offset); subobj_len = EXTRACT_8BITS(obj_tptr + offset + 1); ND_PRINT((ndo, ""\n\t Subobject, Type: %s (%u), Length: %u"", tok2str(lmp_data_link_subobj, ""Unknown"", subobj_type), subobj_type, subobj_len)); if (subobj_len < 4) { ND_PRINT((ndo, "" (too short)"")); break; } if ((subobj_len % 4) != 0) { ND_PRINT((ndo, "" (not a multiple of 4)"")); break; } if (total_subobj_len < subobj_len) { ND_PRINT((ndo, "" (goes past the end of the object)"")); break; } switch(subobj_type) { case INT_SWITCHING_TYPE_SUBOBJ: ND_PRINT((ndo, ""\n\t Switching Type: %s (%u)"", tok2str(gmpls_switch_cap_values, ""Unknown"", EXTRACT_8BITS(obj_tptr + offset + 2)), EXTRACT_8BITS(obj_tptr + offset + 2))); ND_PRINT((ndo, ""\n\t Encoding Type: %s (%u)"", tok2str(gmpls_encoding_values, ""Unknown"", EXTRACT_8BITS(obj_tptr + offset + 3)), EXTRACT_8BITS(obj_tptr + offset + 3))); bw.i = EXTRACT_32BITS(obj_tptr+offset+4); ND_PRINT((ndo, ""\n\t Min Reservable Bandwidth: %.3f Mbps"", bw.f*8/1000000)); bw.i = EXTRACT_32BITS(obj_tptr+offset+8); ND_PRINT((ndo, ""\n\t Max Reservable Bandwidth: %.3f Mbps"", bw.f*8/1000000)); break; case WAVELENGTH_SUBOBJ: ND_PRINT((ndo, ""\n\t Wavelength: %u"", EXTRACT_32BITS(obj_tptr+offset+4))); break; default: /* Any Unknown Subobject ==> Exit loop */ hexdump=TRUE; break; } total_subobj_len-=subobj_len; offset+=subobj_len; } return (hexdump); } ",1 "ProcRenderTransform(ClientPtr client) { return BadImplementation; } ",0 "static void t1_stop_eexec(PDF pdf) { int c; get_length2(); save_offset(); t1_eexec_encrypt = false; if (!t1_pfa) t1_check_block_len(true); else { c = edecrypt((byte) t1_getbyte()); if (!(c == 10 || c == 13)) { if (last_hexbyte == 0) t1_puts(pdf, ""00""); else normal_error(""type 1"",""unexpected data after eexec""); } } t1_cs = false; t1_in_eexec = 2; } ",0 " static testing::Matcher Make( std::initializer_list args) { return testing::MakeMatcher(new PaintRecordMatcher(args)); } ",0 "void HTMLStyleElement::ParseAttribute( const AttributeModificationParams& params) { if (params.name == titleAttr && sheet_ && IsInDocumentTree()) { sheet_->SetTitle(params.new_value); } else if (params.name == mediaAttr && isConnected() && GetDocument().IsActive() && sheet_) { sheet_->SetMediaQueries(MediaQuerySet::Create(params.new_value)); GetDocument().GetStyleEngine().MediaQueriesChangedInScope(GetTreeScope()); } else if (params.name == typeAttr) { HTMLElement::ParseAttribute(params); StyleElement::ChildrenChanged(*this); } else { HTMLElement::ParseAttribute(params); } } ",0 "static int __find_interface(struct device *dev, void *data) { struct find_interface_arg *arg = data; struct usb_interface *intf; if (!is_usb_interface(dev)) return 0; if (dev->driver != arg->drv) return 0; intf = to_usb_interface(dev); return intf->minor == arg->minor; } ",0 "void ewk_view_load_provisional(Evas_Object* ewkView) { DBG(""ewkView=%p"", ewkView); evas_object_smart_callback_call(ewkView, ""load,provisional"", 0); } ",0 "void sem_init_ns(struct ipc_namespace *ns) { ns->sc_semmsl = SEMMSL; ns->sc_semmns = SEMMNS; ns->sc_semopm = SEMOPM; ns->sc_semmni = SEMMNI; ns->used_sems = 0; ipc_init_ids(&ns->ids[IPC_SEM_IDS]); } ",0 "void CCITTFaxStream::ccittReset(GBool unfiltered) { if (unfiltered) str->unfilteredReset(); else str->reset(); row = 0; nextLine2D = encoding < 0; inputBits = 0; a0i = 0; outputBits = 0; buf = EOF; } ",0 " bool UnSetVarImpl(const char* variable_name) { #if defined(OS_POSIX) return unsetenv(variable_name) == 0; #elif defined(OS_WIN) return ::SetEnvironmentVariable(ASCIIToWide(variable_name).c_str(), NULL) != 0; #endif } ",1 "V4L2JpegEncodeAccelerator::JpegBufferRecord::~JpegBufferRecord() {} ",0 "void GLES2DecoderPassthroughImpl::OnAbstractTextureDestroyed( PassthroughAbstractTextureImpl* abstract_texture, scoped_refptr texture) { DCHECK(texture); abstract_textures_.erase(abstract_texture); if (context_->IsCurrent(nullptr)) { resources_->DestroyPendingTextures(true); } else { resources_->textures_pending_destruction.insert(std::move(texture)); } } ",0 "AutoFillManager::AutoFillManager(TabContents* tab_contents, PersonalDataManager* personal_data) : tab_contents_(tab_contents), personal_data_(personal_data), download_manager_(NULL) { DCHECK(tab_contents); } ",0 "bool ValidateRangeChecksum(const HistogramBase& histogram, uint32_t range_checksum) { const Histogram& casted_histogram = static_cast(histogram); return casted_histogram.bucket_ranges()->checksum() == range_checksum; } ",0 "void ResourceFetcher::requestLoadStarted(Resource* resource, const FetchRequest& request, ResourceLoadStartType type) { if (type == ResourceLoadingFromCache) notifyLoadedFromMemoryCache(resource); if (request.resourceRequest().url().protocolIsData() || (m_documentLoader && m_documentLoader->substituteData().isValid())) return; if (type == ResourceLoadingFromCache && !m_validatedURLs.contains(request.resourceRequest().url())) { RefPtr info = ResourceTimingInfo::create(request.options().initiatorInfo.name, monotonicallyIncreasingTime()); populateResourceTiming(info.get(), resource, true); m_scheduledResourceTimingReports.add(info, resource->type() == Resource::MainResource); if (!m_resourceTimingReportTimer.isActive()) m_resourceTimingReportTimer.startOneShot(0, FROM_HERE); } m_validatedURLs.add(request.resourceRequest().url()); } ",0 "void FrameSelection::ScheduleVisualUpdateForPaintInvalidationIfNeeded() const { if (LocalFrameView* frame_view = frame_->View()) frame_view->ScheduleVisualUpdateForPaintInvalidationIfNeeded(); } ",0 "static void _dlist_free_children(struct dlist *dl) { struct dlist *next; struct dlist *i; if (!dl) return; i = dl->head; while (i) { next = i->next; dlist_free(&i); i = next; } dl->head = dl->tail = NULL; } ",0 "void SyncBackendHost::HandleConnectionStatusChangeOnFrontendLoop( sync_api::ConnectionStatus status) { if (!frontend_) return; DCHECK_EQ(MessageLoop::current(), frontend_loop_); frontend_->OnConnectionStatusChange(status); } ",0 "static int sas_ex_manuf_info(struct domain_device *dev) { u8 *mi_req; u8 *mi_resp; int res; mi_req = alloc_smp_req(MI_REQ_SIZE); if (!mi_req) return -ENOMEM; mi_resp = alloc_smp_resp(MI_RESP_SIZE); if (!mi_resp) { kfree(mi_req); return -ENOMEM; } mi_req[1] = SMP_REPORT_MANUF_INFO; res = smp_execute_task(dev, mi_req, MI_REQ_SIZE, mi_resp,MI_RESP_SIZE); if (res) { SAS_DPRINTK(""MI: ex %016llx failed:0x%x\n"", SAS_ADDR(dev->sas_addr), res); goto out; } else if (mi_resp[2] != SMP_RESP_FUNC_ACC) { SAS_DPRINTK(""MI ex %016llx returned SMP result:0x%x\n"", SAS_ADDR(dev->sas_addr), mi_resp[2]); goto out; } ex_assign_manuf_info(dev, mi_resp); out: kfree(mi_req); kfree(mi_resp); return res; } ",0 "static NOINLINE int send_decline(/*uint32_t xid,*/ uint32_t server, uint32_t requested) { struct dhcp_packet packet; /* Fill in: op, htype, hlen, cookie, chaddr, random xid fields, * client-id option (unless -C), message type option: */ init_packet(&packet, DHCPDECLINE); #if 0 /* RFC 2131 says DHCPDECLINE's xid is randomly selected by client, * but in case the server is buggy and wants DHCPDECLINE's xid * to match the xid which started entire handshake, * we use the same xid we used in initial DHCPDISCOVER: */ packet.xid = xid; #endif /* DHCPDECLINE uses ""requested ip"", not ciaddr, to store offered IP */ udhcp_add_simple_option(&packet, DHCP_REQUESTED_IP, requested); udhcp_add_simple_option(&packet, DHCP_SERVER_ID, server); bb_info_msg(""Sending decline...""); return raw_bcast_from_client_config_ifindex(&packet); } ",0 " Ins_IF( INS_ARG ) { FT_Int nIfs; FT_Bool Out; if ( args[0] != 0 ) return; nIfs = 1; Out = 0; do { if ( SKIP_Code() == FAILURE ) return; switch ( CUR.opcode ) { case 0x58: /* IF */ nIfs++; break; case 0x1B: /* ELSE */ Out = FT_BOOL( nIfs == 1 ); break; case 0x59: /* EIF */ nIfs--; Out = FT_BOOL( nIfs == 0 ); break; } } while ( Out == 0 ); } ",0 "GF_Err mdhd_dump(GF_Box *a, FILE * trace) { GF_MediaHeaderBox *p; p = (GF_MediaHeaderBox *)a; gf_isom_box_dump_start(a, ""MediaHeaderBox"", trace); fprintf(trace, ""CreationTime=\""""LLD""\"" "", LLD_CAST p->creationTime); fprintf(trace, ""ModificationTime=\""""LLD""\"" "", LLD_CAST p->modificationTime); fprintf(trace, ""TimeScale=\""%d\"" "", p->timeScale); fprintf(trace, ""Duration=\""""LLD""\"" "", LLD_CAST p->duration); fprintf(trace, ""LanguageCode=\""%c%c%c\"">\n"", p->packedLanguage[0], p->packedLanguage[1], p->packedLanguage[2]); gf_isom_box_dump_done(""MediaHeaderBox"", a, trace); return GF_OK; } ",0 "static struct device_node *of_get_regulator(struct device *dev, const char *supply) { struct device_node *regnode = NULL; char prop_name[32]; /* 32 is max size of property name */ dev_dbg(dev, ""Looking up %s-supply from device tree\n"", supply); snprintf(prop_name, 32, ""%s-supply"", supply); regnode = of_parse_phandle(dev->of_node, prop_name, 0); if (!regnode) { dev_dbg(dev, ""Looking up %s property in node %s failed"", prop_name, dev->of_node->full_name); return NULL; } return regnode; } ",0 "xmlParseAttribute2(xmlParserCtxtPtr ctxt, const xmlChar * pref, const xmlChar * elem, const xmlChar ** prefix, xmlChar ** value, int *len, int *alloc) { const xmlChar *name; xmlChar *val, *internal_val = NULL; int normalize = 0; *value = NULL; GROW; name = xmlParseQName(ctxt, prefix); if (name == NULL) { xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED, ""error parsing attribute name\n""); return (NULL); } /* * get the type if needed */ if (ctxt->attsSpecial != NULL) { int type; type = (int) (long) xmlHashQLookup2(ctxt->attsSpecial, pref, elem, *prefix, name); if (type != 0) normalize = 1; } /* * read the value */ SKIP_BLANKS; if (RAW == '=') { NEXT; SKIP_BLANKS; val = xmlParseAttValueInternal(ctxt, len, alloc, normalize); if (normalize) { /* * Sometimes a second normalisation pass for spaces is needed * but that only happens if charrefs or entities refernces * have been used in the attribute value, i.e. the attribute * value have been extracted in an allocated string already. */ if (*alloc) { const xmlChar *val2; val2 = xmlAttrNormalizeSpace2(ctxt, val, len); if ((val2 != NULL) && (val2 != val)) { xmlFree(val); val = (xmlChar *) val2; } } } ctxt->instate = XML_PARSER_CONTENT; } else { xmlFatalErrMsgStr(ctxt, XML_ERR_ATTRIBUTE_WITHOUT_VALUE, ""Specification mandates value for attribute %s\n"", name); return (NULL); } if (*prefix == ctxt->str_xml) { /* * Check that xml:lang conforms to the specification * No more registered as an error, just generate a warning now * since this was deprecated in XML second edition */ if ((ctxt->pedantic) && (xmlStrEqual(name, BAD_CAST ""lang""))) { internal_val = xmlStrndup(val, *len); if (!xmlCheckLanguageID(internal_val)) { xmlWarningMsg(ctxt, XML_WAR_LANG_VALUE, ""Malformed value for xml:lang : %s\n"", internal_val, NULL); } } /* * Check that xml:space conforms to the specification */ if (xmlStrEqual(name, BAD_CAST ""space"")) { internal_val = xmlStrndup(val, *len); if (xmlStrEqual(internal_val, BAD_CAST ""default"")) *(ctxt->space) = 0; else if (xmlStrEqual(internal_val, BAD_CAST ""preserve"")) *(ctxt->space) = 1; else { xmlWarningMsg(ctxt, XML_WAR_SPACE_VALUE, ""Invalid value \""%s\"" for xml:space : \""default\"" or \""preserve\"" expected\n"", internal_val, NULL); } } if (internal_val) { xmlFree(internal_val); } } *value = val; return (name); } ",0 "struct tee_ta_ctx *tee_mmu_get_ctx(void) { return thread_get_tsd()->ctx; } ",0 "perf_event_create_kernel_counter(struct perf_event_attr *attr, int cpu, struct task_struct *task, perf_overflow_handler_t overflow_handler, void *context) { struct perf_event_context *ctx; struct perf_event *event; int err; /* * Get the target context (task or percpu): */ event = perf_event_alloc(attr, cpu, task, NULL, NULL, overflow_handler, context, -1); if (IS_ERR(event)) { err = PTR_ERR(event); goto err; } /* Mark owner so we could distinguish it from user events. */ event->owner = TASK_TOMBSTONE; ctx = find_get_context(event->pmu, task, event); if (IS_ERR(ctx)) { err = PTR_ERR(ctx); goto err_free; } WARN_ON_ONCE(ctx->parent_ctx); mutex_lock(&ctx->mutex); if (ctx->task == TASK_TOMBSTONE) { err = -ESRCH; goto err_unlock; } if (!exclusive_event_installable(event, ctx)) { err = -EBUSY; goto err_unlock; } perf_install_in_context(ctx, event, cpu); perf_unpin_context(ctx); mutex_unlock(&ctx->mutex); return event; err_unlock: mutex_unlock(&ctx->mutex); perf_unpin_context(ctx); put_ctx(ctx); err_free: free_event(event); err: return ERR_PTR(err); } ",0 "SkColor RenderWidgetHostViewAndroid::GetCachedBackgroundColor() const { return cached_background_color_; } ",0 "ofputil_decode_group_desc_request(const struct ofp_header *oh) { struct ofpbuf request = ofpbuf_const_initializer(oh, ntohs(oh->length)); enum ofpraw raw = ofpraw_pull_assert(&request); if (raw == OFPRAW_OFPST11_GROUP_DESC_REQUEST) { return OFPG_ALL; } else if (raw == OFPRAW_OFPST15_GROUP_DESC_REQUEST) { ovs_be32 *group_id = ofpbuf_pull(&request, sizeof *group_id); return ntohl(*group_id); } else { OVS_NOT_REACHED(); } } ",0 " virtual ~FolderNameView() { } ",0 "char *am_extract_query_parameter(apr_pool_t *pool, const char *query_string, const char *name) { const char *ip; const char *value_end; apr_size_t namelen; if (query_string == NULL) { return NULL; } ip = query_string; namelen = strlen(name); /* Find parameter. Searches for /[^&][&=$]/. * Moves ip to the first character after the name (either '&', '=' * or '\0'). */ for (;;) { /* First we find the name of the parameter. */ ip = strstr(ip, name); if (ip == NULL) { /* Parameter not found. */ return NULL; } /* Then we check what is before the parameter name. */ if (ip != query_string && ip[-1] != '&') { /* Name not preceded by [^&]. */ ip++; continue; } /* And last we check what follows the parameter name. */ if (ip[namelen] != '=' && ip[namelen] != '&' && ip[namelen] != '\0') { /* Name not followed by [&=$]. */ ip++; continue; } /* We have found the pattern. */ ip += namelen; break; } /* Now ip points to the first character after the name. If this * character is '&' or '\0', then this field doesn't have a value. * If this character is '=', then this field has a value. */ if (ip[0] == '=') { ip += 1; } /* The value is from ip to '&' or to the end of the string, whichever * comes first. */ value_end = strchr(ip, '&'); if (value_end != NULL) { /* '&' comes first. */ return apr_pstrndup(pool, ip, value_end - ip); } else { /* Value continues until the end of the string. */ return apr_pstrdup(pool, ip); } } ",0 "static int cxusb_mt352_demod_init(struct dvb_frontend* fe) { /* used in both lgz201 and th7579 */ static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x29 }; static u8 reset [] = { RESET, 0x80 }; static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 }; static u8 agc_cfg [] = { AGC_TARGET, 0x24, 0x20 }; static u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 }; static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 }; mt352_write(fe, clock_config, sizeof(clock_config)); udelay(200); mt352_write(fe, reset, sizeof(reset)); mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg)); mt352_write(fe, agc_cfg, sizeof(agc_cfg)); mt352_write(fe, gpp_ctl_cfg, sizeof(gpp_ctl_cfg)); mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg)); return 0; } ",0 "PluginDelegate::PlatformImage2D* ImageDataNaClBackend::PlatformImage() const { return NULL; } ",0 "static inline void SetSlabDebug(struct page *page) { page->flags |= SLABDEBUG; } ",0 "static inline struct usb_request *hidg_alloc_ep_req(struct usb_ep *ep, unsigned length) { return alloc_ep_req(ep, length); } ",0 "ring_buffer_read_finish(struct ring_buffer_iter *iter) { struct ring_buffer_per_cpu *cpu_buffer = iter->cpu_buffer; unsigned long flags; /* * Ring buffer is disabled from recording, here's a good place * to check the integrity of the ring buffer. * Must prevent readers from trying to read, as the check * clears the HEAD page and readers require it. */ raw_spin_lock_irqsave(&cpu_buffer->reader_lock, flags); rb_check_pages(cpu_buffer); raw_spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags); atomic_dec(&cpu_buffer->record_disabled); atomic_dec(&cpu_buffer->buffer->resize_disabled); kfree(iter); } ",0 "GLvoid StubGLCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data) { glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data); } ",0 "static void _ewk_view_smart_calculate(Evas_Object* ewkView) { EWK_VIEW_SD_GET(ewkView, smartData); EWK_VIEW_PRIV_GET(smartData, priv); EINA_SAFETY_ON_NULL_RETURN(smartData->api->contents_resize); EINA_SAFETY_ON_NULL_RETURN(smartData->api->scrolls_process); EINA_SAFETY_ON_NULL_RETURN(smartData->api->repaints_process); Evas_Coord x, y, width, height; smartData->changed.any = false; if (!smartData->main_frame || !priv->mainFrame) return; evas_object_geometry_get(ewkView, &x, &y, &width, &height); DBG(""ewkView=%p geo=[%d, %d + %dx%d], changed: size=%hhu, "" ""scrolls=%zu, repaints=%zu"", ewkView, x, y, width, height, smartData->changed.size, priv->scrolls.count, priv->repaints.count); if (smartData->changed.size && ((width != smartData->view.w) || (height != smartData->view.h))) { WebCore::FrameView* view = priv->mainFrame->view(); if (view) { view->resize(width, height); view->forceLayout(); view->adjustViewSize(); } evas_object_resize(smartData->main_frame, width, height); evas_object_resize(smartData->events_rect, width, height); smartData->changed.frame_rect = true; smartData->view.w = width; smartData->view.h = height; _ewk_view_repaint_add(priv, 0, 0, width, height); evas_object_smart_callback_call(ewkView, ""view,resized"", 0); } smartData->changed.size = false; if (smartData->changed.position && ((x != smartData->view.x) || (y != smartData->view.y))) { evas_object_move(smartData->main_frame, x, y); evas_object_move(smartData->backing_store, x, y); evas_object_move(smartData->events_rect, x, y); smartData->changed.frame_rect = true; smartData->view.x = x; smartData->view.y = y; } smartData->changed.position = false; if (!smartData->api->scrolls_process(smartData)) ERR(""failed to process scrolls.""); _ewk_view_scrolls_flush(priv); if (!smartData->api->repaints_process(smartData)) ERR(""failed to process repaints.""); _ewk_view_repaints_flush(priv); if (smartData->changed.frame_rect) { WebCore::FrameView* view = priv->mainFrame->view(); view->frameRectsChanged(); /* force tree to get position from root */ smartData->changed.frame_rect = false; } } ",0 "void Launcher::SetFocusCycler(internal::FocusCycler* focus_cycler) { delegate_view_->set_focus_cycler(focus_cycler); focus_cycler->AddWidget(widget_.get()); } ",0 "void GLES2DecoderImpl::DoGetTexParameterfv( GLenum target, GLenum pname, GLfloat* params) { InitTextureMaxAnisotropyIfNeeded(target, pname); glGetTexParameterfv(target, pname, params); } ",0 "static void ts_log(char *tag, int val, struct timespec *pprev_opt) { struct timespec now; static struct timespec prev = {0,0}; unsigned long long now_us; unsigned long long diff_us; UNUSED(tag); UNUSED(val); clock_gettime(CLOCK_MONOTONIC, &now); now_us = now.tv_sec*USEC_PER_SEC + now.tv_nsec/1000; if (pprev_opt) { diff_us = (now.tv_sec - prev.tv_sec) * USEC_PER_SEC + (now.tv_nsec - prev.tv_nsec)/1000; *pprev_opt = now; DEBUG(""[%s] ts %08lld, *diff %08lld, val %d"", tag, now_us, diff_us, val); } else { diff_us = (now.tv_sec - prev.tv_sec) * USEC_PER_SEC + (now.tv_nsec - prev.tv_nsec)/1000; prev = now; DEBUG(""[%s] ts %08lld, diff %08lld, val %d"", tag, now_us, diff_us, val); } } ",0 "bool WebPluginDelegateProxy::OnMessageReceived(const IPC::Message& msg) { content::GetContentClient()->SetActiveURL(page_url_); bool handled = true; IPC_BEGIN_MESSAGE_MAP(WebPluginDelegateProxy, msg) IPC_MESSAGE_HANDLER(PluginHostMsg_SetWindow, OnSetWindow) #if defined(OS_WIN) IPC_MESSAGE_HANDLER(PluginHostMsg_SetWindowlessPumpEvent, OnSetWindowlessPumpEvent) IPC_MESSAGE_HANDLER(PluginHostMsg_NotifyIMEStatus, OnNotifyIMEStatus) #endif IPC_MESSAGE_HANDLER(PluginHostMsg_CancelResource, OnCancelResource) IPC_MESSAGE_HANDLER(PluginHostMsg_InvalidateRect, OnInvalidateRect) IPC_MESSAGE_HANDLER(PluginHostMsg_GetWindowScriptNPObject, OnGetWindowScriptNPObject) IPC_MESSAGE_HANDLER(PluginHostMsg_GetPluginElement, OnGetPluginElement) IPC_MESSAGE_HANDLER(PluginHostMsg_ResolveProxy, OnResolveProxy) IPC_MESSAGE_HANDLER(PluginHostMsg_SetCookie, OnSetCookie) IPC_MESSAGE_HANDLER(PluginHostMsg_GetCookies, OnGetCookies) IPC_MESSAGE_HANDLER(PluginHostMsg_URLRequest, OnHandleURLRequest) IPC_MESSAGE_HANDLER(PluginHostMsg_CancelDocumentLoad, OnCancelDocumentLoad) IPC_MESSAGE_HANDLER(PluginHostMsg_InitiateHTTPRangeRequest, OnInitiateHTTPRangeRequest) IPC_MESSAGE_HANDLER(PluginHostMsg_DeferResourceLoading, OnDeferResourceLoading) #if defined(OS_MACOSX) IPC_MESSAGE_HANDLER(PluginHostMsg_FocusChanged, OnFocusChanged); IPC_MESSAGE_HANDLER(PluginHostMsg_StartIme, OnStartIme); IPC_MESSAGE_HANDLER(PluginHostMsg_BindFakePluginWindowHandle, OnBindFakePluginWindowHandle); IPC_MESSAGE_HANDLER(PluginHostMsg_AcceleratedSurfaceSetIOSurface, OnAcceleratedSurfaceSetIOSurface) IPC_MESSAGE_HANDLER(PluginHostMsg_AcceleratedSurfaceSetTransportDIB, OnAcceleratedSurfaceSetTransportDIB) IPC_MESSAGE_HANDLER(PluginHostMsg_AllocTransportDIB, OnAcceleratedSurfaceAllocTransportDIB) IPC_MESSAGE_HANDLER(PluginHostMsg_FreeTransportDIB, OnAcceleratedSurfaceFreeTransportDIB) IPC_MESSAGE_HANDLER(PluginHostMsg_AcceleratedSurfaceBuffersSwapped, OnAcceleratedSurfaceBuffersSwapped) IPC_MESSAGE_HANDLER(PluginHostMsg_AcceleratedPluginEnabledRendering, OnAcceleratedPluginEnabledRendering) IPC_MESSAGE_HANDLER(PluginHostMsg_AcceleratedPluginAllocatedIOSurface, OnAcceleratedPluginAllocatedIOSurface) IPC_MESSAGE_HANDLER(PluginHostMsg_AcceleratedPluginSwappedIOSurface, OnAcceleratedPluginSwappedIOSurface) #endif IPC_MESSAGE_HANDLER(PluginHostMsg_URLRedirectResponse, OnURLRedirectResponse) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() DCHECK(handled); return handled; } ",0 "void TestController::ensureViewSupportsOptions(WKDictionaryRef options) { if (m_mainWebView && !m_mainWebView->viewSupportsOptions(options)) { WKPageSetPageUIClient(m_mainWebView->page(), 0); WKPageSetPageLoaderClient(m_mainWebView->page(), 0); WKPageSetPagePolicyClient(m_mainWebView->page(), 0); WKPageClose(m_mainWebView->page()); m_mainWebView = nullptr; createWebViewWithOptions(options); resetStateToConsistentValues(); } } ",0 " virtual void OnCertificateRequested( URLRequest* request, SSLCertRequestInfo* cert_request_info) { on_certificate_requested_count_++; MessageLoop::current()->Quit(); } ",0 "ScopedModifyPixels::~ScopedModifyPixels() { if (ref_) ref_->texture()->OnDidModifyPixels(); } ",0 "int QQuickWebViewExperimental::preferredMinimumContentsWidth() const { Q_D(const QQuickWebView); return d->webPageProxy->pageGroup()->preferences()->layoutFallbackWidth(); } ",0 "static void overloadedMethodH1Method(const v8::FunctionCallbackInfo& info) { TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); imp->overloadedMethodH(); } ",0 "void TabCloseableStateWatcher::OnBrowserRemoved(const Browser* browser) { if (browser->type() != Browser::TYPE_NORMAL) return; for (std::vector::iterator it = tabstrip_watchers_.begin(); it != tabstrip_watchers_.end(); ++it) { if ((*it)->browser() == browser) { delete (*it); tabstrip_watchers_.erase(it); break; } } CheckAndUpdateState(NULL); } ",0 "void RenderFrameHostImpl::UpdatePermissionsForNavigation( const CommonNavigationParams& common_params, const RequestNavigationParams& request_params) { if (!GetProcess()->IsForGuestsOnly()) { ChildProcessSecurityPolicyImpl::GetInstance()->GrantRequestURL( GetProcess()->GetID(), common_params.url); if (common_params.url.SchemeIs(url::kDataScheme) && !common_params.base_url_for_data_url.is_empty()) { ChildProcessSecurityPolicyImpl::GetInstance()->GrantRequestURL( GetProcess()->GetID(), common_params.base_url_for_data_url); } } if (request_params.page_state.IsValid()) GrantFileAccessFromPageState(request_params.page_state); if (common_params.post_data) GrantFileAccessFromResourceRequestBody(*common_params.post_data); } ",0 "int kvm_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data) { return kvm_x86_ops->set_msr(vcpu, msr_index, data); } ",0 "void set_task_comm(struct task_struct *tsk, char *buf) { task_lock(tsk); trace_task_rename(tsk, buf); strlcpy(tsk->comm, buf, sizeof(tsk->comm)); task_unlock(tsk); perf_event_comm(tsk); } ",0 "void FrameView::removeFromAXObjectCache() { if (AXObjectCache* cache = axObjectCache()) cache->remove(this); } ",0 "void ring_buffer_record_disable_cpu(struct ring_buffer *buffer, int cpu) { struct ring_buffer_per_cpu *cpu_buffer; if (!cpumask_test_cpu(cpu, buffer->cpumask)) return; cpu_buffer = buffer->buffers[cpu]; atomic_inc(&cpu_buffer->record_disabled); } ",0 "void remove_socket(asocket* s) { if (s->prev && s->next) { s->prev->next = s->next; s->next->prev = s->prev; s->next = 0; s->prev = 0; s->id = 0; } } ",0 "net::CookieMonster::CookieList GetCookieListFromStore( net::CookieStore* cookie_store, const GURL& url) { DCHECK(cookie_store); net::CookieMonster* monster = cookie_store->GetCookieMonster(); if (!url.is_empty()) { DCHECK(url.is_valid()); return monster->GetAllCookiesForURL(url); } else { return monster->GetAllCookies(); } } ",1 "void RenderFrameHostImpl::AdoptPortal( const base::UnguessableToken& portal_token, AdoptPortalCallback callback) { Portal* portal = Portal::FromToken(portal_token); if (!portal) { mojo::ReportBadMessage(""Unknown portal_token when adopting portal.""); return; } if (portal->owner_render_frame_host() != this) { mojo::ReportBadMessage(""AdoptPortal called from wrong frame.""); return; } RenderFrameProxyHost* proxy_host = portal->CreateProxyAndAttachPortal(); std::move(callback).Run(proxy_host->GetRoutingID()); } ",0 "void replaceClientCommandVector(client *c, int argc, robj **argv) { freeClientArgv(c); zfree(c->argv); c->argv = argv; c->argc = argc; c->cmd = lookupCommandOrOriginal(c->argv[0]->ptr); serverAssertWithInfo(c,NULL,c->cmd != NULL); } ",0 "PluginHelper::~PluginHelper() { DCHECK(CalledOnValidThread()); } ",0 " Sampler* GetSampler(GLuint client_id) { return sampler_manager()->GetSampler(client_id); } ",0 "void DecodeGlobalConfig(void) { DecodeTeredoConfig(); } ",0 "void WorkerThread::didStartRunLoop() { ASSERT(isCurrentThread()); Platform::current()->didStartWorkerRunLoop(); } ",0 "void Dispatcher::OnTransferBlobs(const std::vector& blob_uuids) { RenderThread::Get()->Send(new ExtensionHostMsg_TransferBlobsAck(blob_uuids)); } ",0 "LRESULT InputMethodWin::OnQueryCharPosition(IMECHARPOSITION* char_positon) { if (!char_positon) return 0; if (char_positon->dwSize < sizeof(IMECHARPOSITION)) return 0; ui::TextInputClient* client = GetTextInputClient(); if (!client) return 0; gfx::Rect rect; if (client->HasCompositionText()) { if (!client->GetCompositionCharacterBounds(char_positon->dwCharPos, &rect)) { return 0; } } else { if (char_positon->dwCharPos != 0) return 0; rect = client->GetCaretBounds(); } char_positon->pt.x = rect.x(); char_positon->pt.y = rect.y(); char_positon->cLineHeight = rect.height(); return 1; // returns non-zero value when succeeded. } ",0 "static void __net_exit fib_net_exit(struct net *net) { fib_proc_exit(net); nl_fib_lookup_exit(net); ip_fib_net_exit(net); } ",0 "static u8 rds_tcp_get_tos_map(u8 tos) { /* all user tos mapped to default 0 for TCP transport */ return 0; } ",0 "static void kvm_set_mmio_spte_mask(void) { u64 mask; int maxphyaddr = boot_cpu_data.x86_phys_bits; /* * Set the reserved bits and the present bit of an paging-structure * entry to generate page fault with PFER.RSV = 1. */ /* Mask the reserved physical address bits. */ mask = rsvd_bits(maxphyaddr, 51); /* Bit 62 is always reserved for 32bit host. */ mask |= 0x3ull << 62; /* Set the present bit. */ mask |= 1ull; #ifdef CONFIG_X86_64 /* * If reserved bit is not supported, clear the present bit to disable * mmio page fault. */ if (maxphyaddr == 52) mask &= ~1ull; #endif kvm_mmu_set_mmio_spte_mask(mask); } ",0 "RefPtr FrameFetchContext::GetRequestorOriginForFrameLoading() { if (IsDetached()) return frozen_state_->requestor_origin; return GetFrame()->GetDocument()->GetSecurityOrigin(); } ",0 "bool Document::attemptedToDetermineEncodingFromContentSniffing() const { return m_encodingData.attemptedToDetermineEncodingFromContentSniffing(); } ",0 "MagickExport Image *AdaptiveThresholdImage(const Image *image, const size_t width,const size_t height,const ssize_t offset, ExceptionInfo *exception) { #define ThresholdImageTag ""Threshold/Image"" CacheView *image_view, *threshold_view; Image *threshold_image; MagickBooleanType status; MagickOffsetType progress; MagickPixelPacket zero; MagickRealType number_pixels; ssize_t y; assert(image != (const Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"",image->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); threshold_image=CloneImage(image,0,0,MagickTrue,exception); if (threshold_image == (Image *) NULL) return((Image *) NULL); if (SetImageStorageClass(threshold_image,DirectClass) == MagickFalse) { InheritException(exception,&threshold_image->exception); threshold_image=DestroyImage(threshold_image); return((Image *) NULL); } /* Local adaptive threshold. */ status=MagickTrue; progress=0; GetMagickPixelPacket(image,&zero); number_pixels=(MagickRealType) (width*height); image_view=AcquireVirtualCacheView(image,exception); threshold_view=AcquireAuthenticCacheView(threshold_image,exception); #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static) shared(progress,status) \ magick_number_threads(image,threshold_image,image->rows,1) #endif for (y=0; y < (ssize_t) image->rows; y++) { MagickBooleanType sync; MagickPixelPacket channel_bias, channel_sum; register const IndexPacket *magick_restrict indexes; register const PixelPacket *magick_restrict p, *magick_restrict r; register IndexPacket *magick_restrict threshold_indexes; register PixelPacket *magick_restrict q; register ssize_t x; ssize_t u, v; if (status == MagickFalse) continue; p=GetCacheViewVirtualPixels(image_view,-((ssize_t) width/2L),y-(ssize_t) height/2L,image->columns+width,height,exception); q=GetCacheViewAuthenticPixels(threshold_view,0,y,threshold_image->columns,1, exception); if ((p == (const PixelPacket *) NULL) || (q == (PixelPacket *) NULL)) { status=MagickFalse; continue; } indexes=GetCacheViewVirtualIndexQueue(image_view); threshold_indexes=GetCacheViewAuthenticIndexQueue(threshold_view); channel_bias=zero; channel_sum=zero; r=p; for (v=0; v < (ssize_t) height; v++) { for (u=0; u < (ssize_t) width; u++) { if (u == (ssize_t) (width-1)) { channel_bias.red+=r[u].red; channel_bias.green+=r[u].green; channel_bias.blue+=r[u].blue; channel_bias.opacity+=r[u].opacity; if (image->colorspace == CMYKColorspace) channel_bias.index=(MagickRealType) GetPixelIndex(indexes+(r-p)+u); } channel_sum.red+=r[u].red; channel_sum.green+=r[u].green; channel_sum.blue+=r[u].blue; channel_sum.opacity+=r[u].opacity; if (image->colorspace == CMYKColorspace) channel_sum.index=(MagickRealType) GetPixelIndex(indexes+(r-p)+u); } r+=image->columns+width; } for (x=0; x < (ssize_t) image->columns; x++) { MagickPixelPacket mean; mean=zero; r=p; channel_sum.red-=channel_bias.red; channel_sum.green-=channel_bias.green; channel_sum.blue-=channel_bias.blue; channel_sum.opacity-=channel_bias.opacity; channel_sum.index-=channel_bias.index; channel_bias=zero; for (v=0; v < (ssize_t) height; v++) { channel_bias.red+=r[0].red; channel_bias.green+=r[0].green; channel_bias.blue+=r[0].blue; channel_bias.opacity+=r[0].opacity; if (image->colorspace == CMYKColorspace) channel_bias.index=(MagickRealType) GetPixelIndex(indexes+x+(r-p)+0); channel_sum.red+=r[width-1].red; channel_sum.green+=r[width-1].green; channel_sum.blue+=r[width-1].blue; channel_sum.opacity+=r[width-1].opacity; if (image->colorspace == CMYKColorspace) channel_sum.index=(MagickRealType) GetPixelIndex(indexes+x+(r-p)+ width-1); r+=image->columns+width; } mean.red=(MagickRealType) (channel_sum.red/number_pixels+offset); mean.green=(MagickRealType) (channel_sum.green/number_pixels+offset); mean.blue=(MagickRealType) (channel_sum.blue/number_pixels+offset); mean.opacity=(MagickRealType) (channel_sum.opacity/number_pixels+offset); if (image->colorspace == CMYKColorspace) mean.index=(MagickRealType) (channel_sum.index/number_pixels+offset); SetPixelRed(q,((MagickRealType) GetPixelRed(q) <= mean.red) ? 0 : QuantumRange); SetPixelGreen(q,((MagickRealType) GetPixelGreen(q) <= mean.green) ? 0 : QuantumRange); SetPixelBlue(q,((MagickRealType) GetPixelBlue(q) <= mean.blue) ? 0 : QuantumRange); SetPixelOpacity(q,((MagickRealType) GetPixelOpacity(q) <= mean.opacity) ? 0 : QuantumRange); if (image->colorspace == CMYKColorspace) SetPixelIndex(threshold_indexes+x,(((MagickRealType) GetPixelIndex( threshold_indexes+x) <= mean.index) ? 0 : QuantumRange)); p++; q++; } sync=SyncCacheViewAuthenticPixels(threshold_view,exception); if (sync == MagickFalse) status=MagickFalse; if (image->progress_monitor != (MagickProgressMonitor) NULL) { MagickBooleanType proceed; #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp atomic #endif progress++; proceed=SetImageProgress(image,ThresholdImageTag,progress,image->rows); if (proceed == MagickFalse) status=MagickFalse; } } threshold_view=DestroyCacheView(threshold_view); image_view=DestroyCacheView(image_view); if (status == MagickFalse) threshold_image=DestroyImage(threshold_image); return(threshold_image); } ",1 "gpc_cb16(Pixel *out, const Pixel *in, const Background *back) { if (in->a <= 0) { out->r = back->ir; out->g = back->ig; out->b = back->ib; } else if (in->a >= 65535) { out->r = isRGB(in->r); out->g = isRGB(in->g); out->b = isRGB(in->b); } else { double a = in->a / 65535.; double a1 = 1-a; a /= 65535; out->r = sRGB(in->r * a + back->dr * a1); out->g = sRGB(in->g * a + back->dg * a1); out->b = sRGB(in->b * a + back->db * a1); } out->a = 255; } ",0 "PagePopup* ChromeClientImpl::openPagePopup(PagePopupClient* client, const IntRect& originBoundsInRootView) { ASSERT(m_pagePopupDriver); return m_pagePopupDriver->openPagePopup(client, originBoundsInRootView); } ",0 "void PresentationConnectionProxy::close() const { DCHECK(target_connection_ptr_); target_connection_ptr_->OnClose(); } ",0 "static void jpc_com_destroyparms(jpc_ms_t *ms) { jpc_com_t *com = &ms->parms.com; if (com->data) { jas_free(com->data); } } ",0 "int mwifiex_set_secure_params(struct mwifiex_private *priv, struct mwifiex_uap_bss_param *bss_config, struct cfg80211_ap_settings *params) { int i; struct mwifiex_wep_key wep_key; if (!params->privacy) { bss_config->protocol = PROTOCOL_NO_SECURITY; bss_config->key_mgmt = KEY_MGMT_NONE; bss_config->wpa_cfg.length = 0; priv->sec_info.wep_enabled = 0; priv->sec_info.wpa_enabled = 0; priv->sec_info.wpa2_enabled = 0; return 0; } switch (params->auth_type) { case NL80211_AUTHTYPE_OPEN_SYSTEM: bss_config->auth_mode = WLAN_AUTH_OPEN; break; case NL80211_AUTHTYPE_SHARED_KEY: bss_config->auth_mode = WLAN_AUTH_SHARED_KEY; break; case NL80211_AUTHTYPE_NETWORK_EAP: bss_config->auth_mode = WLAN_AUTH_LEAP; break; default: bss_config->auth_mode = MWIFIEX_AUTH_MODE_AUTO; break; } bss_config->key_mgmt_operation |= KEY_MGMT_ON_HOST; for (i = 0; i < params->crypto.n_akm_suites; i++) { switch (params->crypto.akm_suites[i]) { case WLAN_AKM_SUITE_8021X: if (params->crypto.wpa_versions & NL80211_WPA_VERSION_1) { bss_config->protocol = PROTOCOL_WPA; bss_config->key_mgmt = KEY_MGMT_EAP; } if (params->crypto.wpa_versions & NL80211_WPA_VERSION_2) { bss_config->protocol |= PROTOCOL_WPA2; bss_config->key_mgmt = KEY_MGMT_EAP; } break; case WLAN_AKM_SUITE_PSK: if (params->crypto.wpa_versions & NL80211_WPA_VERSION_1) { bss_config->protocol = PROTOCOL_WPA; bss_config->key_mgmt = KEY_MGMT_PSK; } if (params->crypto.wpa_versions & NL80211_WPA_VERSION_2) { bss_config->protocol |= PROTOCOL_WPA2; bss_config->key_mgmt = KEY_MGMT_PSK; } break; default: break; } } for (i = 0; i < params->crypto.n_ciphers_pairwise; i++) { switch (params->crypto.ciphers_pairwise[i]) { case WLAN_CIPHER_SUITE_WEP40: case WLAN_CIPHER_SUITE_WEP104: break; case WLAN_CIPHER_SUITE_TKIP: if (params->crypto.wpa_versions & NL80211_WPA_VERSION_1) bss_config->wpa_cfg.pairwise_cipher_wpa |= CIPHER_TKIP; if (params->crypto.wpa_versions & NL80211_WPA_VERSION_2) bss_config->wpa_cfg.pairwise_cipher_wpa2 |= CIPHER_TKIP; break; case WLAN_CIPHER_SUITE_CCMP: if (params->crypto.wpa_versions & NL80211_WPA_VERSION_1) bss_config->wpa_cfg.pairwise_cipher_wpa |= CIPHER_AES_CCMP; if (params->crypto.wpa_versions & NL80211_WPA_VERSION_2) bss_config->wpa_cfg.pairwise_cipher_wpa2 |= CIPHER_AES_CCMP; default: break; } } switch (params->crypto.cipher_group) { case WLAN_CIPHER_SUITE_WEP40: case WLAN_CIPHER_SUITE_WEP104: if (priv->sec_info.wep_enabled) { bss_config->protocol = PROTOCOL_STATIC_WEP; bss_config->key_mgmt = KEY_MGMT_NONE; bss_config->wpa_cfg.length = 0; for (i = 0; i < NUM_WEP_KEYS; i++) { wep_key = priv->wep_key[i]; bss_config->wep_cfg[i].key_index = i; if (priv->wep_key_curr_index == i) bss_config->wep_cfg[i].is_default = 1; else bss_config->wep_cfg[i].is_default = 0; bss_config->wep_cfg[i].length = wep_key.key_length; memcpy(&bss_config->wep_cfg[i].key, &wep_key.key_material, wep_key.key_length); } } break; case WLAN_CIPHER_SUITE_TKIP: bss_config->wpa_cfg.group_cipher = CIPHER_TKIP; break; case WLAN_CIPHER_SUITE_CCMP: bss_config->wpa_cfg.group_cipher = CIPHER_AES_CCMP; break; default: break; } return 0; } ",0 " CuePoint::~CuePoint() { delete[] m_track_positions; } ",0 "void OmniboxViewViews::Update() { if (model()->ResetDisplayTexts()) { RevertAll(); if (model()->has_focus()) { SelectAllForUserGesture(); } } else { EmphasizeURLComponents(); } } ",0 "static int phar_zip_changed_apply(zval *zv, void *arg) /* {{{ */ { return phar_zip_changed_apply_int(Z_PTR_P(zv), arg); } /* }}} */ ",0 "R_API int r_bin_has_dbg_syms(RBin *bin) { RBinObject *o = r_bin_cur_object (bin); return o? (R_BIN_DBG_SYMS & o->info->dbg_info): false; } ",0 "void Document::initSecurityContext() { initSecurityContext(DocumentInit(m_url, m_frame, contextDocument(), m_importsController)); } ",0 "void RenderThreadImpl::OnMemoryPressure( base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level) { base::allocator::ReleaseFreeMemory(); if (webkit_platform_support_ && blink::mainThreadIsolate()) { blink::mainThreadIsolate()->LowMemoryNotification(); } if (memory_pressure_level == base::MemoryPressureListener::MEMORY_PRESSURE_CRITICAL) { if (webkit_platform_support_) { blink::WebImageCache::clear(); } size_t font_cache_limit = SkGraphics::SetFontCacheLimit(0); SkGraphics::SetFontCacheLimit(font_cache_limit); } } ",0 "static inline bool cpu_has_vmx_ept(void) { return vmcs_config.cpu_based_2nd_exec_ctrl & SECONDARY_EXEC_ENABLE_EPT; } ",0 "PanoramiXRenderSetPictureClipRectangles (ClientPtr client) { REQUEST(xRenderSetPictureClipRectanglesReq); int result = Success, j; PanoramiXRes *pict; REQUEST_AT_LEAST_SIZE(xRenderSetPictureClipRectanglesReq); VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess); FOR_NSCREENS_BACKWARD(j) { stuff->picture = pict->info[j].id; result = (*PanoramiXSaveRenderVector[X_RenderSetPictureClipRectangles]) (client); if(result != Success) break; } return result; } ",0 "void omx_video::complete_pending_buffer_done_cbs() { unsigned long p1; unsigned long p2; unsigned long ident; omx_cmd_queue tmp_q, pending_bd_q; pthread_mutex_lock(&m_lock); while (m_ftb_q.m_size) { m_ftb_q.pop_entry(&p1,&p2,&ident); if (ident == OMX_COMPONENT_GENERATE_FBD) { pending_bd_q.insert_entry(p1,p2,ident); } else { tmp_q.insert_entry(p1,p2,ident); } } while (tmp_q.m_size) { tmp_q.pop_entry(&p1,&p2,&ident); m_ftb_q.insert_entry(p1,p2,ident); } while (m_etb_q.m_size) { m_etb_q.pop_entry(&p1,&p2,&ident); if (ident == OMX_COMPONENT_GENERATE_EBD) { pending_bd_q.insert_entry(p1,p2,ident); } else { tmp_q.insert_entry(p1,p2,ident); } } while (tmp_q.m_size) { tmp_q.pop_entry(&p1,&p2,&ident); m_etb_q.insert_entry(p1,p2,ident); } pthread_mutex_unlock(&m_lock); while (pending_bd_q.m_size) { pending_bd_q.pop_entry(&p1,&p2,&ident); switch (ident) { case OMX_COMPONENT_GENERATE_EBD: if (empty_buffer_done(&m_cmp, (OMX_BUFFERHEADERTYPE *)p1) != OMX_ErrorNone) { DEBUG_PRINT_ERROR(""ERROR: empty_buffer_done() failed!""); omx_report_error (); } break; case OMX_COMPONENT_GENERATE_FBD: if (fill_buffer_done(&m_cmp, (OMX_BUFFERHEADERTYPE *)p1) != OMX_ErrorNone ) { DEBUG_PRINT_ERROR(""ERROR: fill_buffer_done() failed!""); omx_report_error (); } break; } } } ",0 "void unregister_netdev(struct net_device *dev) { rtnl_lock(); unregister_netdevice(dev); rtnl_unlock(); } ",0 "void mbedtls_ecp_keypair_init( mbedtls_ecp_keypair *key ) { if( key == NULL ) return; mbedtls_ecp_group_init( &key->grp ); mbedtls_mpi_init( &key->d ); mbedtls_ecp_point_init( &key->Q ); } ",0 "void ContextState::RestoreVertexAttribArrays( const scoped_refptr attrib_manager) const { GLuint vao_service_id = attrib_manager->service_id(); DCHECK(vao_service_id == 0); if (feature_info_->feature_flags().native_vertex_array_object) api()->glBindVertexArrayOESFn(vao_service_id); for (size_t attrib_index = 0; attrib_index < attrib_manager->num_attribs(); ++attrib_index) { const VertexAttrib* attrib = attrib_manager->GetVertexAttrib(attrib_index); Buffer* buffer = attrib->buffer(); GLuint buffer_service_id = buffer ? buffer->service_id() : 0; api()->glBindBufferFn(GL_ARRAY_BUFFER, buffer_service_id); const void* ptr = reinterpret_cast(attrib->offset()); api()->glVertexAttribPointerFn(attrib_index, attrib->size(), attrib->type(), attrib->normalized(), attrib->gl_stride(), ptr); if (feature_info_->feature_flags().angle_instanced_arrays) api()->glVertexAttribDivisorANGLEFn(attrib_index, attrib->divisor()); if (attrib->enabled_in_driver()) { api()->glEnableVertexAttribArrayFn(attrib_index); } else { api()->glDisableVertexAttribArrayFn(attrib_index); } } } ",0 " cff_parse_vsindex( CFF_Parser parser ) { /* vsindex operator can only be used in a Private DICT */ CFF_Private priv = (CFF_Private)parser->object; FT_Byte** data = parser->stack; CFF_Blend blend; FT_Error error; if ( !priv || !priv->subfont ) { error = FT_THROW( Invalid_File_Format ); goto Exit; } blend = &priv->subfont->blend; if ( blend->usedBV ) { FT_ERROR(( "" cff_parse_vsindex: vsindex not allowed after blend\n"" )); error = FT_THROW( Syntax_Error ); goto Exit; } priv->vsindex = (FT_UInt)cff_parse_num( parser, data++ ); FT_TRACE4(( "" %d\n"", priv->vsindex )); error = FT_Err_Ok; Exit: return error; } ",0 "void SaveCardBubbleControllerImpl::HideBubble() { if (save_card_bubble_view_) { save_card_bubble_view_->Hide(); save_card_bubble_view_ = nullptr; } } ",0 "static struct sock *iucv_sock_alloc(struct socket *sock, int proto, gfp_t prio) { struct sock *sk; struct iucv_sock *iucv; sk = sk_alloc(&init_net, PF_IUCV, prio, &iucv_proto); if (!sk) return NULL; iucv = iucv_sk(sk); sock_init_data(sock, sk); INIT_LIST_HEAD(&iucv->accept_q); spin_lock_init(&iucv->accept_q_lock); skb_queue_head_init(&iucv->send_skb_q); INIT_LIST_HEAD(&iucv->message_q.list); spin_lock_init(&iucv->message_q.lock); skb_queue_head_init(&iucv->backlog_skb_q); iucv->send_tag = 0; atomic_set(&iucv->pendings, 0); iucv->flags = 0; iucv->msglimit = 0; atomic_set(&iucv->msg_sent, 0); atomic_set(&iucv->msg_recv, 0); iucv->path = NULL; iucv->sk_txnotify = afiucv_hs_callback_txnotify; memset(&iucv->src_user_id , 0, 32); if (pr_iucv) iucv->transport = AF_IUCV_TRANS_IUCV; else iucv->transport = AF_IUCV_TRANS_HIPER; sk->sk_destruct = iucv_sock_destruct; sk->sk_sndtimeo = IUCV_CONN_TIMEOUT; sk->sk_allocation = GFP_DMA; sock_reset_flag(sk, SOCK_ZAPPED); sk->sk_protocol = proto; sk->sk_state = IUCV_OPEN; iucv_sock_link(&iucv_sk_list, sk); return sk; } ",0 "static int config_input(AVFilterLink *inlink) { AVFilterContext *ctx = inlink->dst; FieldOrderContext *s = ctx->priv; int plane; /** full an array with the number of bytes that the video * data occupies per line for each plane of the input video */ for (plane = 0; plane < 4; plane++) { s->line_size[plane] = av_image_get_linesize(inlink->format, inlink->w, plane); } return 0; } ",0 "GLvoid StubGLGenBuffers(GLsizei n, GLuint* buffers) { glGenBuffersARB(n, buffers); } ",0 "static ssize_t fuse_direct_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { ssize_t res; struct inode *inode = file->f_path.dentry->d_inode; if (is_bad_inode(inode)) return -EIO; res = fuse_direct_io(file, buf, count, ppos, 0); fuse_invalidate_attr(inode); return res; } ",0 " void StoreNewGroup() { PushNextTask(base::BindOnce(&AppCacheStorageImplTest::Verify_StoreNewGroup, base::Unretained(this))); group_ = new AppCacheGroup(storage(), kManifestUrl, storage()->NewGroupId()); cache_ = new AppCache(storage(), storage()->NewCacheId()); cache_->AddEntry(kEntryUrl, AppCacheEntry(AppCacheEntry::EXPLICIT, 1, kDefaultEntrySize)); mock_quota_manager_proxy_->mock_manager_->async_ = true; storage()->StoreGroupAndNewestCache(group_.get(), cache_.get(), delegate()); EXPECT_FALSE(delegate()->stored_group_success_); } ",1 "void V8WindowShell::namedItemAdded(HTMLDocument* document, const AtomicString& name) { ASSERT(m_world->isMainWorld()); if (m_context.isEmpty()) return; v8::HandleScope handleScope(m_isolate); v8::Context::Scope contextScope(m_context.newLocal(m_isolate)); ASSERT(!m_document.isEmpty()); v8::Handle documentHandle = m_document.newLocal(m_isolate); checkDocumentWrapper(documentHandle, document); documentHandle->SetAccessor(v8String(name, m_isolate), getter); } ",0 "static int samldb_rodc_add(struct samldb_ctx *ac) { struct ldb_context *ldb = ldb_module_get_ctx(ac->module); uint32_t krbtgt_number, i_start, i; int ret; char *newpass; struct ldb_val newpass_utf16; /* find a unused msDC-SecondaryKrbTgtNumber */ i_start = generate_random() & 0xFFFF; if (i_start == 0) { i_start = 1; } for (i=i_start; i<=0xFFFF; i++) { if (samldb_krbtgtnumber_available(ac, i)) { krbtgt_number = i; goto found; } } for (i=1; imsg, ""msDS-SecondaryKrbTgtNumber"", LDB_FLAG_INTERNAL_DISABLE_VALIDATION, NULL); if (ret != LDB_SUCCESS) { return ldb_operr(ldb); } ret = samdb_msg_add_uint(ldb, ac->msg, ac->msg, ""msDS-SecondaryKrbTgtNumber"", krbtgt_number); if (ret != LDB_SUCCESS) { return ldb_operr(ldb); } ret = ldb_msg_add_fmt(ac->msg, ""sAMAccountName"", ""krbtgt_%u"", krbtgt_number); if (ret != LDB_SUCCESS) { return ldb_operr(ldb); } newpass = generate_random_password(ac->msg, 128, 255); if (newpass == NULL) { return ldb_operr(ldb); } if (!convert_string_talloc(ac, CH_UNIX, CH_UTF16, newpass, strlen(newpass), (void *)&newpass_utf16.data, &newpass_utf16.length)) { ldb_asprintf_errstring(ldb, ""samldb_rodc_add: "" ""failed to generate UTF16 password from random password""); return LDB_ERR_OPERATIONS_ERROR; } ret = ldb_msg_add_steal_value(ac->msg, ""clearTextPassword"", &newpass_utf16); if (ret != LDB_SUCCESS) { return ldb_operr(ldb); } return samldb_next_step(ac); } ",0 "void *ns_get_path(struct path *path, struct task_struct *task, const struct proc_ns_operations *ns_ops) { struct ns_common *ns; void *ret; again: ns = ns_ops->get(task); if (!ns) return ERR_PTR(-ENOENT); ret = __ns_get_path(path, ns); if (IS_ERR(ret) && PTR_ERR(ret) == -EAGAIN) goto again; return ret; } ",0 "void TestingAutomationProvider::WaitForAllViewsToStopLoading( DictionaryValue* args, IPC::Message* reply_message) { if (AppModalDialogQueue::GetInstance()->HasActiveDialog()) { AutomationJSONReply(this, reply_message).SendSuccess(NULL); return; } new AllViewsStoppedLoadingObserver( this, reply_message, profile()->GetExtensionProcessManager()); } ",0 "pdf_show_shade(fz_context *ctx, pdf_run_processor *pr, fz_shade *shd) { pdf_gstate *gstate = pr->gstate + pr->gtop; fz_rect bbox; softmask_save softmask = { NULL }; if (pr->super.hidden) return; fz_bound_shade(ctx, shd, &gstate->ctm, &bbox); gstate = pdf_begin_group(ctx, pr, &bbox, &softmask); /* FIXME: The gstate->ctm in the next line may be wrong; maybe * it should be the parent gstates ctm? */ fz_fill_shade(ctx, pr->dev, shd, &gstate->ctm, gstate->fill.alpha, &gstate->fill.color_params); pdf_end_group(ctx, pr, &softmask); } ",0 "static int jpc_dec_tileinit(jpc_dec_t *dec, jpc_dec_tile_t *tile) { jpc_dec_tcomp_t *tcomp; int compno; int rlvlno; jpc_dec_rlvl_t *rlvl; jpc_dec_band_t *band; jpc_dec_prc_t *prc; int bndno; jpc_tsfb_band_t *bnd; int bandno; jpc_dec_ccp_t *ccp; int prccnt; jpc_dec_cblk_t *cblk; int cblkcnt; uint_fast32_t tlprcxstart; uint_fast32_t tlprcystart; uint_fast32_t brprcxend; uint_fast32_t brprcyend; uint_fast32_t tlcbgxstart; uint_fast32_t tlcbgystart; uint_fast32_t brcbgxend; uint_fast32_t brcbgyend; uint_fast32_t cbgxstart; uint_fast32_t cbgystart; uint_fast32_t cbgxend; uint_fast32_t cbgyend; uint_fast32_t tlcblkxstart; uint_fast32_t tlcblkystart; uint_fast32_t brcblkxend; uint_fast32_t brcblkyend; uint_fast32_t cblkxstart; uint_fast32_t cblkystart; uint_fast32_t cblkxend; uint_fast32_t cblkyend; uint_fast32_t tmpxstart; uint_fast32_t tmpystart; uint_fast32_t tmpxend; uint_fast32_t tmpyend; jpc_dec_cp_t *cp; jpc_tsfb_band_t bnds[64]; jpc_pchg_t *pchg; int pchgno; jpc_dec_cmpt_t *cmpt; cp = tile->cp; tile->realmode = 0; if (cp->mctid == JPC_MCT_ICT) { tile->realmode = 1; } for (compno = 0, tcomp = tile->tcomps, cmpt = dec->cmpts; compno < dec->numcomps; ++compno, ++tcomp, ++cmpt) { ccp = &tile->cp->ccps[compno]; if (ccp->qmfbid == JPC_COX_INS) { tile->realmode = 1; } tcomp->numrlvls = ccp->numrlvls; if (!(tcomp->rlvls = jas_alloc2(tcomp->numrlvls, sizeof(jpc_dec_rlvl_t)))) { return -1; } if (!(tcomp->data = jas_seq2d_create(JPC_CEILDIV(tile->xstart, cmpt->hstep), JPC_CEILDIV(tile->ystart, cmpt->vstep), JPC_CEILDIV(tile->xend, cmpt->hstep), JPC_CEILDIV(tile->yend, cmpt->vstep)))) { return -1; } if (!(tcomp->tsfb = jpc_cod_gettsfb(ccp->qmfbid, tcomp->numrlvls - 1))) { return -1; } { jpc_tsfb_getbands(tcomp->tsfb, jas_seq2d_xstart(tcomp->data), jas_seq2d_ystart(tcomp->data), jas_seq2d_xend(tcomp->data), jas_seq2d_yend(tcomp->data), bnds); } for (rlvlno = 0, rlvl = tcomp->rlvls; rlvlno < tcomp->numrlvls; ++rlvlno, ++rlvl) { rlvl->bands = 0; rlvl->xstart = JPC_CEILDIVPOW2(tcomp->xstart, tcomp->numrlvls - 1 - rlvlno); rlvl->ystart = JPC_CEILDIVPOW2(tcomp->ystart, tcomp->numrlvls - 1 - rlvlno); rlvl->xend = JPC_CEILDIVPOW2(tcomp->xend, tcomp->numrlvls - 1 - rlvlno); rlvl->yend = JPC_CEILDIVPOW2(tcomp->yend, tcomp->numrlvls - 1 - rlvlno); rlvl->prcwidthexpn = ccp->prcwidthexpns[rlvlno]; rlvl->prcheightexpn = ccp->prcheightexpns[rlvlno]; tlprcxstart = JPC_FLOORDIVPOW2(rlvl->xstart, rlvl->prcwidthexpn) << rlvl->prcwidthexpn; tlprcystart = JPC_FLOORDIVPOW2(rlvl->ystart, rlvl->prcheightexpn) << rlvl->prcheightexpn; brprcxend = JPC_CEILDIVPOW2(rlvl->xend, rlvl->prcwidthexpn) << rlvl->prcwidthexpn; brprcyend = JPC_CEILDIVPOW2(rlvl->yend, rlvl->prcheightexpn) << rlvl->prcheightexpn; rlvl->numhprcs = (brprcxend - tlprcxstart) >> rlvl->prcwidthexpn; rlvl->numvprcs = (brprcyend - tlprcystart) >> rlvl->prcheightexpn; rlvl->numprcs = rlvl->numhprcs * rlvl->numvprcs; if (rlvl->xstart >= rlvl->xend || rlvl->ystart >= rlvl->yend) { rlvl->bands = 0; rlvl->numprcs = 0; rlvl->numhprcs = 0; rlvl->numvprcs = 0; continue; } if (!rlvlno) { tlcbgxstart = tlprcxstart; tlcbgystart = tlprcystart; brcbgxend = brprcxend; brcbgyend = brprcyend; rlvl->cbgwidthexpn = rlvl->prcwidthexpn; rlvl->cbgheightexpn = rlvl->prcheightexpn; } else { tlcbgxstart = JPC_CEILDIVPOW2(tlprcxstart, 1); tlcbgystart = JPC_CEILDIVPOW2(tlprcystart, 1); brcbgxend = JPC_CEILDIVPOW2(brprcxend, 1); brcbgyend = JPC_CEILDIVPOW2(brprcyend, 1); rlvl->cbgwidthexpn = rlvl->prcwidthexpn - 1; rlvl->cbgheightexpn = rlvl->prcheightexpn - 1; } rlvl->cblkwidthexpn = JAS_MIN(ccp->cblkwidthexpn, rlvl->cbgwidthexpn); rlvl->cblkheightexpn = JAS_MIN(ccp->cblkheightexpn, rlvl->cbgheightexpn); rlvl->numbands = (!rlvlno) ? 1 : 3; if (!(rlvl->bands = jas_alloc2(rlvl->numbands, sizeof(jpc_dec_band_t)))) { return -1; } for (bandno = 0, band = rlvl->bands; bandno < rlvl->numbands; ++bandno, ++band) { bndno = (!rlvlno) ? 0 : (3 * (rlvlno - 1) + bandno + 1); bnd = &bnds[bndno]; band->orient = bnd->orient; band->stepsize = ccp->stepsizes[bndno]; band->analgain = JPC_NOMINALGAIN(ccp->qmfbid, tcomp->numrlvls - 1, rlvlno, band->orient); band->absstepsize = jpc_calcabsstepsize(band->stepsize, cmpt->prec + band->analgain); band->numbps = ccp->numguardbits + JPC_QCX_GETEXPN(band->stepsize) - 1; band->roishift = (ccp->roishift + band->numbps >= JPC_PREC) ? (JPC_PREC - 1 - band->numbps) : ccp->roishift; band->data = 0; band->prcs = 0; if (bnd->xstart == bnd->xend || bnd->ystart == bnd->yend) { continue; } if (!(band->data = jas_seq2d_create(0, 0, 0, 0))) { return -1; } jas_seq2d_bindsub(band->data, tcomp->data, bnd->locxstart, bnd->locystart, bnd->locxend, bnd->locyend); jas_seq2d_setshift(band->data, bnd->xstart, bnd->ystart); assert(rlvl->numprcs); if (!(band->prcs = jas_alloc2(rlvl->numprcs, sizeof(jpc_dec_prc_t)))) { return -1; } /************************************************/ cbgxstart = tlcbgxstart; cbgystart = tlcbgystart; for (prccnt = rlvl->numprcs, prc = band->prcs; prccnt > 0; --prccnt, ++prc) { cbgxend = cbgxstart + (1 << rlvl->cbgwidthexpn); cbgyend = cbgystart + (1 << rlvl->cbgheightexpn); prc->xstart = JAS_MAX(cbgxstart, JAS_CAST(uint_fast32_t, jas_seq2d_xstart(band->data))); prc->ystart = JAS_MAX(cbgystart, JAS_CAST(uint_fast32_t, jas_seq2d_ystart(band->data))); prc->xend = JAS_MIN(cbgxend, JAS_CAST(uint_fast32_t, jas_seq2d_xend(band->data))); prc->yend = JAS_MIN(cbgyend, JAS_CAST(uint_fast32_t, jas_seq2d_yend(band->data))); if (prc->xend > prc->xstart && prc->yend > prc->ystart) { tlcblkxstart = JPC_FLOORDIVPOW2(prc->xstart, rlvl->cblkwidthexpn) << rlvl->cblkwidthexpn; tlcblkystart = JPC_FLOORDIVPOW2(prc->ystart, rlvl->cblkheightexpn) << rlvl->cblkheightexpn; brcblkxend = JPC_CEILDIVPOW2(prc->xend, rlvl->cblkwidthexpn) << rlvl->cblkwidthexpn; brcblkyend = JPC_CEILDIVPOW2(prc->yend, rlvl->cblkheightexpn) << rlvl->cblkheightexpn; prc->numhcblks = (brcblkxend - tlcblkxstart) >> rlvl->cblkwidthexpn; prc->numvcblks = (brcblkyend - tlcblkystart) >> rlvl->cblkheightexpn; prc->numcblks = prc->numhcblks * prc->numvcblks; assert(prc->numcblks > 0); if (!(prc->incltagtree = jpc_tagtree_create( prc->numhcblks, prc->numvcblks))) { return -1; } if (!(prc->numimsbstagtree = jpc_tagtree_create( prc->numhcblks, prc->numvcblks))) { return -1; } if (!(prc->cblks = jas_alloc2(prc->numcblks, sizeof(jpc_dec_cblk_t)))) { return -1; } cblkxstart = cbgxstart; cblkystart = cbgystart; for (cblkcnt = prc->numcblks, cblk = prc->cblks; cblkcnt > 0;) { cblkxend = cblkxstart + (1 << rlvl->cblkwidthexpn); cblkyend = cblkystart + (1 << rlvl->cblkheightexpn); tmpxstart = JAS_MAX(cblkxstart, prc->xstart); tmpystart = JAS_MAX(cblkystart, prc->ystart); tmpxend = JAS_MIN(cblkxend, prc->xend); tmpyend = JAS_MIN(cblkyend, prc->yend); if (tmpxend > tmpxstart && tmpyend > tmpystart) { cblk->firstpassno = -1; cblk->mqdec = 0; cblk->nulldec = 0; cblk->flags = 0; cblk->numpasses = 0; cblk->segs.head = 0; cblk->segs.tail = 0; cblk->curseg = 0; cblk->numimsbs = 0; cblk->numlenbits = 3; cblk->flags = 0; if (!(cblk->data = jas_seq2d_create(0, 0, 0, 0))) { return -1; } jas_seq2d_bindsub(cblk->data, band->data, tmpxstart, tmpystart, tmpxend, tmpyend); ++cblk; --cblkcnt; } cblkxstart += 1 << rlvl->cblkwidthexpn; if (cblkxstart >= cbgxend) { cblkxstart = cbgxstart; cblkystart += 1 << rlvl->cblkheightexpn; } } } else { prc->cblks = 0; prc->incltagtree = 0; prc->numimsbstagtree = 0; } cbgxstart += 1 << rlvl->cbgwidthexpn; if (cbgxstart >= brcbgxend) { cbgxstart = tlcbgxstart; cbgystart += 1 << rlvl->cbgheightexpn; } } /********************************************/ } } } if (!(tile->pi = jpc_dec_pi_create(dec, tile))) { return -1; } for (pchgno = 0; pchgno < jpc_pchglist_numpchgs(tile->cp->pchglist); ++pchgno) { pchg = jpc_pchg_copy(jpc_pchglist_get(tile->cp->pchglist, pchgno)); assert(pchg); jpc_pi_addpchg(tile->pi, pchg); } jpc_pi_init(tile->pi); return 0; } ",0 "static void __wait_discard_cmd(struct f2fs_sb_info *sbi, bool wait_cond) { struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; struct list_head *wait_list = &(dcc->wait_list); struct discard_cmd *dc, *tmp; bool need_wait; next: need_wait = false; mutex_lock(&dcc->cmd_lock); list_for_each_entry_safe(dc, tmp, wait_list, list) { if (!wait_cond || (dc->state == D_DONE && !dc->ref)) { wait_for_completion_io(&dc->wait); __remove_discard_cmd(sbi, dc); } else { dc->ref++; need_wait = true; break; } } mutex_unlock(&dcc->cmd_lock); if (need_wait) { __wait_one_discard_bio(sbi, dc); goto next; } } ",0 "void v9fs_path_init(V9fsPath *path) { path->data = NULL; path->size = 0; } ",0 "static int ip4ip6_gro_complete(struct sk_buff *skb, int nhoff) { skb->encapsulation = 1; skb_shinfo(skb)->gso_type |= SKB_GSO_IPXIP6; return inet_gro_complete(skb, nhoff); } ",0 "void BluetoothRemoteGATTCharacteristic::ReadValueCallback( ScriptPromiseResolver* resolver, mojom::blink::WebBluetoothResult result, const Optional>& value) { if (!resolver->getExecutionContext() || resolver->getExecutionContext()->isContextDestroyed()) return; if (!getGatt()->RemoveFromActiveAlgorithms(resolver)) { resolver->reject(BluetoothRemoteGATTUtils::CreateDOMException( BluetoothRemoteGATTUtils::ExceptionType::kGATTServerDisconnected)); return; } if (result == mojom::blink::WebBluetoothResult::SUCCESS) { DCHECK(value); DOMDataView* domDataView = BluetoothRemoteGATTUtils::ConvertWTFVectorToDataView(value.value()); setValue(domDataView); resolver->resolve(domDataView); } else { resolver->reject(BluetoothError::take(resolver, result)); } } ",0 "void xen_netbk_deschedule_xenvif(struct xenvif *vif) { struct xen_netbk *netbk = vif->netbk; spin_lock_irq(&netbk->net_schedule_list_lock); remove_from_net_schedule_list(vif); spin_unlock_irq(&netbk->net_schedule_list_lock); } ",0 "base::TimeTicks RendererSchedulerImpl::IncrementVirtualTimePauseCount() { main_thread_only().virtual_time_pause_count++; ApplyVirtualTimePolicy(); if (virtual_time_domain_) return virtual_time_domain_->Now(); return tick_clock()->NowTicks(); } ",0 "static int crc32_digest(struct shash_desc *desc, const u8 *data, unsigned int len, u8 *out) { return __crc32_finup(crypto_shash_ctx(desc->tfm), data, len, out); } ",0 "void blk_account_io_start(struct request *rq, bool new_io) { struct hd_struct *part; int rw = rq_data_dir(rq); int cpu; if (!blk_do_io_stat(rq)) return; cpu = part_stat_lock(); if (!new_io) { part = rq->part; part_stat_inc(cpu, part, merges[rw]); } else { part = disk_map_sector_rcu(rq->rq_disk, blk_rq_pos(rq)); if (!hd_struct_try_get(part)) { /* * The partition is already being removed, * the request will be accounted on the disk only * * We take a reference on disk->part0 although that * partition will never be deleted, so we can treat * it as any other partition. */ part = &rq->rq_disk->part0; hd_struct_get(part); } part_round_stats(rq->q, cpu, part); part_inc_in_flight(rq->q, part, rw); rq->part = part; } part_stat_unlock(); } ",0 "ssize_t reds_stream_write(RedsStream *s, const void *buf, size_t nbyte) { ssize_t ret; #if HAVE_SASL if (s->sasl.conn && s->sasl.runSSF) { ret = reds_stream_sasl_write(s, buf, nbyte); } else #endif ret = s->write(s, buf, nbyte); return ret; } ",0 "void ExtensionPrefs::AcknowledgeExternalExtension( const std::string& extension_id) { DCHECK(Extension::IdIsValid(extension_id)); UpdateExtensionPref(extension_id, kPrefExternalAcknowledged, Value::CreateBooleanValue(true)); } ",0 "pp::Instance* Instance::GetPluginInstance() { return GetInstance(); } ",0 "GfxColorSpace::GfxColorSpace() { } ",0 "infobars::InfoBar* ExtensionDevToolsInfoBarDelegate::Create( RenderViewHost* rvh, const std::string& client_name) { if (!rvh) return NULL; WebContents* web_contents = WebContents::FromRenderViewHost(rvh); if (!web_contents) return NULL; InfoBarService* infobar_service = InfoBarService::FromWebContents(web_contents); if (!infobar_service) return NULL; return infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( scoped_ptr( new ExtensionDevToolsInfoBarDelegate(client_name)))); } ",0 "ProcListFontsWithInfo(ClientPtr client) { REQUEST(xListFontsWithInfoReq); REQUEST_FIXED_SIZE(xListFontsWithInfoReq, stuff->nbytes); return StartListFontsWithInfo(client, stuff->nbytes, (unsigned char *) &stuff[1], stuff->maxNames); } ",0 "xmlParseElementDecl(xmlParserCtxtPtr ctxt) { const xmlChar *name; int ret = -1; xmlElementContentPtr content = NULL; /* GROW; done in the caller */ if (CMP9(CUR_PTR, '<', '!', 'E', 'L', 'E', 'M', 'E', 'N', 'T')) { xmlParserInputPtr input = ctxt->input; SKIP(9); if (!IS_BLANK_CH(CUR)) { xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, ""Space required after 'ELEMENT'\n""); return(-1); } SKIP_BLANKS; name = xmlParseName(ctxt); if (name == NULL) { xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED, ""xmlParseElementDecl: no name for Element\n""); return(-1); } while ((RAW == 0) && (ctxt->inputNr > 1)) xmlPopInput(ctxt); if (!IS_BLANK_CH(CUR)) { xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, ""Space required after the element name\n""); } SKIP_BLANKS; if (CMP5(CUR_PTR, 'E', 'M', 'P', 'T', 'Y')) { SKIP(5); /* * Element must always be empty. */ ret = XML_ELEMENT_TYPE_EMPTY; } else if ((RAW == 'A') && (NXT(1) == 'N') && (NXT(2) == 'Y')) { SKIP(3); /* * Element is a generic container. */ ret = XML_ELEMENT_TYPE_ANY; } else if (RAW == '(') { ret = xmlParseElementContentDecl(ctxt, name, &content); } else { /* * [ WFC: PEs in Internal Subset ] error handling. */ if ((RAW == '%') && (ctxt->external == 0) && (ctxt->inputNr == 1)) { xmlFatalErrMsg(ctxt, XML_ERR_PEREF_IN_INT_SUBSET, ""PEReference: forbidden within markup decl in internal subset\n""); } else { xmlFatalErrMsg(ctxt, XML_ERR_ELEMCONTENT_NOT_STARTED, ""xmlParseElementDecl: 'EMPTY', 'ANY' or '(' expected\n""); } return(-1); } SKIP_BLANKS; /* * Pop-up of finished entities. */ while ((RAW == 0) && (ctxt->inputNr > 1)) xmlPopInput(ctxt); SKIP_BLANKS; if (RAW != '>') { xmlFatalErr(ctxt, XML_ERR_GT_REQUIRED, NULL); if (content != NULL) { xmlFreeDocElementContent(ctxt->myDoc, content); } } else { if (input != ctxt->input) { xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY, ""Element declaration doesn't start and stop in the same entity\n""); } NEXT; if ((ctxt->sax != NULL) && (!ctxt->disableSAX) && (ctxt->sax->elementDecl != NULL)) { if (content != NULL) content->parent = NULL; ctxt->sax->elementDecl(ctxt->userData, name, ret, content); if ((content != NULL) && (content->parent == NULL)) { /* * this is a trick: if xmlAddElementDecl is called, * instead of copying the full tree it is plugged directly * if called from the parser. Avoid duplicating the * interfaces or change the API/ABI */ xmlFreeDocElementContent(ctxt->myDoc, content); } } else if (content != NULL) { xmlFreeDocElementContent(ctxt->myDoc, content); } } } return(ret); } ",0 "static int _regulator_force_disable(struct regulator_dev *rdev) { int ret = 0; ret = _regulator_do_disable(rdev); if (ret < 0) { rdev_err(rdev, ""failed to force disable\n""); return ret; } _notifier_call_chain(rdev, REGULATOR_EVENT_FORCE_DISABLE | REGULATOR_EVENT_DISABLE, NULL); return 0; } ",0 "void V8ValueConverterImpl::SetFunctionAllowed(bool val) { function_allowed_ = val; } ",0 "static size_t _jsvCountJsVarsUsedRecursive(JsVar *v, bool resetRecursionFlag) { if (!v) return 0; if (resetRecursionFlag) { if (!(v->flags & JSV_IS_RECURSING)) return 0; v->flags &= ~JSV_IS_RECURSING; } else { if (v->flags & JSV_IS_RECURSING) return 0; v->flags |= JSV_IS_RECURSING; } size_t count = 1; if (jsvHasSingleChild(v) || jsvHasChildren(v)) { JsVarRef childref = jsvGetFirstChild(v); while (childref) { JsVar *child = jsvLock(childref); count += _jsvCountJsVarsUsedRecursive(child, resetRecursionFlag); if (jsvHasChildren(v)) childref = jsvGetNextSibling(child); else childref = 0; jsvUnLock(child); } } else if (jsvIsFlatString(v)) count += jsvGetFlatStringBlocks(v); if (jsvHasCharacterData(v)) { JsVarRef childref = jsvGetLastChild(v); while (childref) { JsVar *child = jsvLock(childref); count++; childref = jsvGetLastChild(child); jsvUnLock(child); } } if (jsvIsName(v) && !jsvIsNameWithValue(v) && jsvGetFirstChild(v)) { JsVar *child = jsvLock(jsvGetFirstChild(v)); count += _jsvCountJsVarsUsedRecursive(child, resetRecursionFlag); jsvUnLock(child); } return count; } ",0 "void HTMLMediaElement::honorUserPreferencesForAutomaticTextTrackSelection() { if (!m_textTracks || !m_textTracks->length()) return; if (!m_shouldPerformAutomaticTrackSelection) return; AutomaticTrackSelection::Configuration configuration; if (m_processingPreferenceChange) configuration.disableCurrentlyEnabledTracks = true; if (m_textTracksVisible) configuration.forceEnableSubtitleOrCaptionTrack = true; Settings* settings = document().settings(); if (settings) { configuration.textTrackKindUserPreference = settings->getTextTrackKindUserPreference(); } AutomaticTrackSelection trackSelection(configuration); trackSelection.perform(*m_textTracks); } ",0 "void WebPluginImpl::RemoveClient(size_t i) { clients_.erase(clients_.begin() + i); } ",0 "void PDFiumEngine::OnDocumentCanceled() { if (visible_pages_.empty()) client_->DocumentLoadFailed(); else OnDocumentComplete(); } ",0 " static void assertCellInfo(BtCursor *pCur){ CellInfo info; memset(&info, 0, sizeof(info)); btreeParseCell(pCur->pPage, pCur->ix, &info); assert( CORRUPT_DB || cellInfoEqual(&info, &pCur->info) ); } ",0 "MagickPrivate MagickBooleanType SyncImageProfiles(Image *image) { MagickBooleanType status; StringInfo *profile; status=MagickTrue; profile=(StringInfo *) GetImageProfile(image,""8BIM""); if (profile != (StringInfo *) NULL) if (Sync8BimProfile(image,profile) == MagickFalse) status=MagickFalse; profile=(StringInfo *) GetImageProfile(image,""EXIF""); if (profile != (StringInfo *) NULL) if (SyncExifProfile(image,profile) == MagickFalse) status=MagickFalse; return(status); } ",0 "static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info) { struct cfg80211_registered_device *rdev = info->user_ptr[0]; struct net_device *dev = info->user_ptr[1]; struct ieee80211_channel *chan; enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT; bool channel_type_valid = false; u32 freq; int err; void *hdr; u64 cookie; struct sk_buff *msg; unsigned int wait = 0; bool offchan; if (!info->attrs[NL80211_ATTR_FRAME] || !info->attrs[NL80211_ATTR_WIPHY_FREQ]) return -EINVAL; if (!rdev->ops->mgmt_tx) return -EOPNOTSUPP; if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION && dev->ieee80211_ptr->iftype != NL80211_IFTYPE_ADHOC && dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT && dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN && dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT && dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) return -EOPNOTSUPP; if (info->attrs[NL80211_ATTR_DURATION]) { if (!rdev->ops->mgmt_tx_cancel_wait) return -EINVAL; wait = nla_get_u32(info->attrs[NL80211_ATTR_DURATION]); } if (info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]) { channel_type = nla_get_u32( info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]); if (channel_type != NL80211_CHAN_NO_HT && channel_type != NL80211_CHAN_HT20 && channel_type != NL80211_CHAN_HT40PLUS && channel_type != NL80211_CHAN_HT40MINUS) return -EINVAL; channel_type_valid = true; } offchan = info->attrs[NL80211_ATTR_OFFCHANNEL_TX_OK]; freq = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]); chan = rdev_freq_to_chan(rdev, freq, channel_type); if (chan == NULL) return -EINVAL; msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); if (!msg) return -ENOMEM; hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0, NL80211_CMD_FRAME); if (IS_ERR(hdr)) { err = PTR_ERR(hdr); goto free_msg; } err = cfg80211_mlme_mgmt_tx(rdev, dev, chan, offchan, channel_type, channel_type_valid, wait, nla_data(info->attrs[NL80211_ATTR_FRAME]), nla_len(info->attrs[NL80211_ATTR_FRAME]), &cookie); if (err) goto free_msg; NLA_PUT_U64(msg, NL80211_ATTR_COOKIE, cookie); genlmsg_end(msg, hdr); return genlmsg_reply(msg, info); nla_put_failure: err = -ENOBUFS; free_msg: nlmsg_free(msg); return err; } ",0 "static void xhci_free_streams(XHCIEPContext *epctx) { assert(epctx->pstreams != NULL); g_free(epctx->pstreams); epctx->pstreams = NULL; epctx->nr_pstreams = 0; } ",0 "process_global_set(struct archive_read *a, struct mtree_option **global, const char *line) { const char *next, *eq; size_t len; int r; line += 4; for (;;) { next = line + strspn(line, "" \t\r\n""); if (*next == '\0') return (ARCHIVE_OK); line = next; next = line + strcspn(line, "" \t\r\n""); eq = strchr(line, '='); if (eq > next) len = next - line; else len = eq - line; remove_option(global, line, len); r = add_option(a, global, line, next - line); if (r != ARCHIVE_OK) return (r); line = next; } } ",0 "bool HttpResponseHeaders::IsRedirect(std::string* location) const { if (!IsRedirectResponseCode(response_code_)) return false; size_t i = std::string::npos; do { i = FindHeader(++i, ""location""); if (i == std::string::npos) return false; } while (parsed_[i].value_begin == parsed_[i].value_end); if (location) { *location = EscapeNonASCII( std::string(parsed_[i].value_begin, parsed_[i].value_end)); } return true; } ",0 "bool ChromeContentBrowserClient::AllowWorkerCacheStorage( const GURL& url, content::ResourceContext* context, const std::vector& render_frames) { DCHECK_CURRENTLY_ON(BrowserThread::IO); ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); content_settings::CookieSettings* cookie_settings = io_data->GetCookieSettings(); bool allow = cookie_settings->IsCookieAccessAllowed(url, url); for (const auto& it : render_frames) { base::PostTaskWithTraits( FROM_HERE, {BrowserThread::UI}, base::BindOnce(&TabSpecificContentSettings::CacheStorageAccessed, it.child_id, it.frame_routing_id, url, !allow)); } return allow; } ",0 "static void methodWithEnforceRangeInt32Method(const v8::FunctionCallbackInfo& info) { ExceptionState exceptionState(ExceptionState::ExecutionContext, ""methodWithEnforceRangeInt32"", ""TestObject"", info.Holder(), info.GetIsolate()); if (UNLIKELY(info.Length() < 1)) { exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length())); exceptionState.throwIfNeeded(); return; } TestObject* imp = V8TestObject::toNative(info.Holder()); V8TRYCATCH_EXCEPTION_VOID(int, value, toInt32(info[0], EnforceRange, exceptionState), exceptionState); imp->methodWithEnforceRangeInt32(value); } ",0 "static void dccp_v6_reqsk_destructor(struct request_sock *req) { dccp_feat_list_purge(&dccp_rsk(req)->dreq_featneg); kfree_skb(inet_rsk(req)->pktopts); } ",0 "static void fuse_request_init(struct fuse_req *req) { memset(req, 0, sizeof(*req)); INIT_LIST_HEAD(&req->list); INIT_LIST_HEAD(&req->intr_entry); init_waitqueue_head(&req->waitq); atomic_set(&req->count, 1); } ",0 "xsltSetXIncludeDefault(int xinclude) { xsltDoXIncludeDefault = (xinclude != 0); } ",0 "static int pmcraid_expose_resource(u16 fw_version, struct pmcraid_config_table_entry *cfgte) { int retval = 0; if (cfgte->resource_type == RES_TYPE_VSET) { if (fw_version <= PMCRAID_FW_VERSION_1) retval = ((cfgte->unique_flags1 & 0x80) == 0); else retval = ((cfgte->unique_flags0 & 0x80) == 0 && (cfgte->unique_flags1 & 0x80) == 0); } else if (cfgte->resource_type == RES_TYPE_GSCSI) retval = (RES_BUS(cfgte->resource_address) != PMCRAID_VIRTUAL_ENCL_BUS_ID); return retval; } ",0 "static status_t ConvertOmxAvcLevelToAvcSpecLevel( OMX_U32 omxLevel, AVCLevel *avcLevel) { for (size_t i = 0, n = sizeof(ConversionTable)/sizeof(ConversionTable[0]); i < n; ++i) { if (omxLevel == ConversionTable[i].omxLevel) { *avcLevel = ConversionTable[i].avcLevel; return OK; } } ALOGE(""ConvertOmxAvcLevelToAvcSpecLevel: %d level not supported"", (int32_t)omxLevel); return BAD_VALUE; } ",0 "bool AuthenticatorBlePowerOnAutomaticSheetModel::IsAcceptButtonEnabled() const { return !busy_powering_on_ble_; } ",0 "ofpact_decode_raw(enum ofp_version ofp_version, const struct ofp_action_header *oah, size_t length, const struct ofpact_raw_instance **instp) { const struct ofpact_raw_instance *inst; struct ofpact_hdrs hdrs; *instp = NULL; if (length < sizeof *oah) { return OFPERR_OFPBAC_BAD_LEN; } /* Get base action type. */ if (oah->type == htons(OFPAT_VENDOR)) { /* Get vendor. */ hdrs.vendor = ntohl(oah->vendor); if (hdrs.vendor == NX_VENDOR_ID || hdrs.vendor == ONF_VENDOR_ID) { /* Get extension subtype. */ const struct ext_action_header *nah; nah = ALIGNED_CAST(const struct ext_action_header *, oah); if (length < sizeof *nah) { return OFPERR_OFPBAC_BAD_LEN; } hdrs.type = ntohs(nah->subtype); } else { VLOG_WARN_RL(&rl, ""OpenFlow action has unknown vendor %#""PRIx32, hdrs.vendor); return OFPERR_OFPBAC_BAD_VENDOR; } } else { hdrs.vendor = 0; hdrs.type = ntohs(oah->type); } hdrs.ofp_version = ofp_version; HMAP_FOR_EACH_WITH_HASH (inst, decode_node, ofpact_hdrs_hash(&hdrs), ofpact_decode_hmap()) { if (ofpact_hdrs_equal(&hdrs, &inst->hdrs)) { *instp = inst; return 0; } } return (hdrs.vendor ? OFPERR_OFPBAC_BAD_VENDOR_TYPE : OFPERR_OFPBAC_BAD_TYPE); } ",0 "void RenderFrameImpl::DidStartResponse( const GURL& response_url, int request_id, const network::ResourceResponseHead& response_head, content::ResourceType resource_type) { for (auto& observer : observers_) observer.DidStartResponse(response_url, request_id, response_head, resource_type); } ",0 "static void vmx_save_host_state(struct kvm_vcpu *vcpu) { struct vcpu_vmx *vmx = to_vmx(vcpu); #ifdef CONFIG_X86_64 int cpu = raw_smp_processor_id(); #endif int i; if (vmx->host_state.loaded) return; vmx->host_state.loaded = 1; /* * Set host fs and gs selectors. Unfortunately, 22.2.3 does not * allow segment selectors with cpl > 0 or ti == 1. */ vmx->host_state.ldt_sel = kvm_read_ldt(); vmx->host_state.gs_ldt_reload_needed = vmx->host_state.ldt_sel; #ifdef CONFIG_X86_64 save_fsgs_for_kvm(); vmx->host_state.fs_sel = current->thread.fsindex; vmx->host_state.gs_sel = current->thread.gsindex; #else savesegment(fs, vmx->host_state.fs_sel); savesegment(gs, vmx->host_state.gs_sel); #endif if (!(vmx->host_state.fs_sel & 7)) { vmcs_write16(HOST_FS_SELECTOR, vmx->host_state.fs_sel); vmx->host_state.fs_reload_needed = 0; } else { vmcs_write16(HOST_FS_SELECTOR, 0); vmx->host_state.fs_reload_needed = 1; } if (!(vmx->host_state.gs_sel & 7)) vmcs_write16(HOST_GS_SELECTOR, vmx->host_state.gs_sel); else { vmcs_write16(HOST_GS_SELECTOR, 0); vmx->host_state.gs_ldt_reload_needed = 1; } #ifdef CONFIG_X86_64 savesegment(ds, vmx->host_state.ds_sel); savesegment(es, vmx->host_state.es_sel); vmcs_writel(HOST_FS_BASE, current->thread.fsbase); vmcs_writel(HOST_GS_BASE, cpu_kernelmode_gs_base(cpu)); vmx->msr_host_kernel_gs_base = current->thread.gsbase; if (is_long_mode(&vmx->vcpu)) wrmsrl(MSR_KERNEL_GS_BASE, vmx->msr_guest_kernel_gs_base); #else vmcs_writel(HOST_FS_BASE, segment_base(vmx->host_state.fs_sel)); vmcs_writel(HOST_GS_BASE, segment_base(vmx->host_state.gs_sel)); #endif if (boot_cpu_has(X86_FEATURE_MPX)) rdmsrl(MSR_IA32_BNDCFGS, vmx->host_state.msr_host_bndcfgs); for (i = 0; i < vmx->save_nmsrs; ++i) kvm_set_shared_msr(vmx->guest_msrs[i].index, vmx->guest_msrs[i].data, vmx->guest_msrs[i].mask); } ",0 "void Browser::URLStarredChanged(content::WebContents* web_contents, bool starred) { if (web_contents == tab_strip_model_->GetActiveWebContents()) window_->SetStarredState(starred); } ",0 "static void update_audio_tstamp(struct snd_pcm_substream *substream, struct timespec *curr_tstamp, struct timespec *audio_tstamp) { struct snd_pcm_runtime *runtime = substream->runtime; u64 audio_frames, audio_nsecs; struct timespec driver_tstamp; if (runtime->tstamp_mode != SNDRV_PCM_TSTAMP_ENABLE) return; if (!(substream->ops->get_time_info) || (runtime->audio_tstamp_report.actual_type == SNDRV_PCM_AUDIO_TSTAMP_TYPE_DEFAULT)) { /* * provide audio timestamp derived from pointer position * add delay only if requested */ audio_frames = runtime->hw_ptr_wrap + runtime->status->hw_ptr; if (runtime->audio_tstamp_config.report_delay) { if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) audio_frames -= runtime->delay; else audio_frames += runtime->delay; } audio_nsecs = div_u64(audio_frames * 1000000000LL, runtime->rate); *audio_tstamp = ns_to_timespec(audio_nsecs); } runtime->status->audio_tstamp = *audio_tstamp; runtime->status->tstamp = *curr_tstamp; /* * re-take a driver timestamp to let apps detect if the reference tstamp * read by low-level hardware was provided with a delay */ snd_pcm_gettime(substream->runtime, (struct timespec *)&driver_tstamp); runtime->driver_tstamp = driver_tstamp; } ",0 "static int vfat_find_form(struct inode *dir, unsigned char *name) { struct fat_slot_info sinfo; int err = fat_scan(dir, name, &sinfo); if (err) return -ENOENT; brelse(sinfo.bh); return 0; } ",0 "void ext4_block_bitmap_set(struct super_block *sb, struct ext4_group_desc *bg, ext4_fsblk_t blk) { bg->bg_block_bitmap_lo = cpu_to_le32((u32)blk); if (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT) bg->bg_block_bitmap_hi = cpu_to_le32(blk >> 32); } ",0 "void DevToolsUIBindings::DocumentAvailableInMainFrame() { if (!reloading_) return; reloading_ = false; if (agent_host_.get()) { agent_host_->DetachClient(this); agent_host_->AttachClient(this); } } ",0 " void OnGotTpmIsReady(base::Optional tpm_is_ready) { if (!tpm_is_ready.has_value() || !tpm_is_ready.value()) { VLOG(1) << ""SystemTokenCertDBInitializer: TPM is not ready - not loading "" ""system token.""; if (ShallAttemptTpmOwnership()) { LOG(WARNING) << ""Request attempting TPM ownership.""; DBusThreadManager::Get()->GetCryptohomeClient()->TpmCanAttemptOwnership( EmptyVoidDBusMethodCallback()); } return; } VLOG(1) << ""SystemTokenCertDBInitializer: TPM is ready, loading system token.""; TPMTokenLoader::Get()->EnsureStarted(); base::Callback callback = base::BindRepeating(&SystemTokenCertDBInitializer::InitializeDatabase, weak_ptr_factory_.GetWeakPtr()); content::BrowserThread::PostTask( content::BrowserThread::IO, FROM_HERE, base::BindOnce(&GetSystemSlotOnIOThread, callback)); } ",0 "void RenderViewImpl::PpapiPluginCancelComposition() { Send(new ViewHostMsg_ImeCancelComposition(routing_id())); const ui::Range range(ui::Range::InvalidRange()); const std::vector empty_bounds; UpdateCompositionInfo(range, empty_bounds); } ",0 "TestingAutomationProvider::TestingAutomationProvider(Profile* profile) : AutomationProvider(profile), #if defined(TOOLKIT_VIEWS) popup_menu_waiter_(NULL), #endif #if defined(OS_CHROMEOS) power_manager_observer_(NULL), #endif redirect_query_(0) { BrowserList::AddObserver(this); registrar_.Add(this, chrome::NOTIFICATION_SESSION_END, content::NotificationService::AllSources()); #if defined(OS_CHROMEOS) AddChromeosObservers(); #endif } ",0 "static void gen_sse(CPUX86State *env, DisasContext *s, int b, target_ulong pc_start, int rex_r) { int b1, op1_offset, op2_offset, is_xmm, val; int modrm, mod, rm, reg; SSEFunc_0_epp sse_fn_epp; SSEFunc_0_eppi sse_fn_eppi; SSEFunc_0_ppi sse_fn_ppi; SSEFunc_0_eppt sse_fn_eppt; TCGMemOp ot; b &= 0xff; if (s->prefix & PREFIX_DATA) b1 = 1; else if (s->prefix & PREFIX_REPZ) b1 = 2; else if (s->prefix & PREFIX_REPNZ) b1 = 3; else b1 = 0; sse_fn_epp = sse_op_table1[b][b1]; if (!sse_fn_epp) { goto unknown_op; } if ((b <= 0x5f && b >= 0x10) || b == 0xc6 || b == 0xc2) { is_xmm = 1; } else { if (b1 == 0) { /* MMX case */ is_xmm = 0; } else { is_xmm = 1; } } /* simple MMX/SSE operation */ if (s->flags & HF_TS_MASK) { gen_exception(s, EXCP07_PREX, pc_start - s->cs_base); return; } if (s->flags & HF_EM_MASK) { illegal_op: gen_illegal_opcode(s); return; } if (is_xmm && !(s->flags & HF_OSFXSR_MASK) && ((b != 0x38 && b != 0x3a) || (s->prefix & PREFIX_DATA))) { goto unknown_op; } if (b == 0x0e) { if (!(s->cpuid_ext2_features & CPUID_EXT2_3DNOW)) { /* If we were fully decoding this we might use illegal_op. */ goto unknown_op; } /* femms */ gen_helper_emms(cpu_env); return; } if (b == 0x77) { /* emms */ gen_helper_emms(cpu_env); return; } /* prepare MMX state (XXX: optimize by storing fptt and fptags in the static cpu state) */ if (!is_xmm) { gen_helper_enter_mmx(cpu_env); } modrm = cpu_ldub_code(env, s->pc++); reg = ((modrm >> 3) & 7); if (is_xmm) reg |= rex_r; mod = (modrm >> 6) & 3; if (sse_fn_epp == SSE_SPECIAL) { b |= (b1 << 8); switch(b) { case 0x0e7: /* movntq */ if (mod == 3) { goto illegal_op; } gen_lea_modrm(env, s, modrm); gen_stq_env_A0(s, offsetof(CPUX86State, fpregs[reg].mmx)); break; case 0x1e7: /* movntdq */ case 0x02b: /* movntps */ case 0x12b: /* movntps */ if (mod == 3) goto illegal_op; gen_lea_modrm(env, s, modrm); gen_sto_env_A0(s, offsetof(CPUX86State, xmm_regs[reg])); break; case 0x3f0: /* lddqu */ if (mod == 3) goto illegal_op; gen_lea_modrm(env, s, modrm); gen_ldo_env_A0(s, offsetof(CPUX86State, xmm_regs[reg])); break; case 0x22b: /* movntss */ case 0x32b: /* movntsd */ if (mod == 3) goto illegal_op; gen_lea_modrm(env, s, modrm); if (b1 & 1) { gen_stq_env_A0(s, offsetof(CPUX86State, xmm_regs[reg].ZMM_Q(0))); } else { tcg_gen_ld32u_tl(cpu_T0, cpu_env, offsetof(CPUX86State, xmm_regs[reg].ZMM_L(0))); gen_op_st_v(s, MO_32, cpu_T0, cpu_A0); } break; case 0x6e: /* movd mm, ea */ #ifdef TARGET_X86_64 if (s->dflag == MO_64) { gen_ldst_modrm(env, s, modrm, MO_64, OR_TMP0, 0); tcg_gen_st_tl(cpu_T0, cpu_env, offsetof(CPUX86State,fpregs[reg].mmx)); } else #endif { gen_ldst_modrm(env, s, modrm, MO_32, OR_TMP0, 0); tcg_gen_addi_ptr(cpu_ptr0, cpu_env, offsetof(CPUX86State,fpregs[reg].mmx)); tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T0); gen_helper_movl_mm_T0_mmx(cpu_ptr0, cpu_tmp2_i32); } break; case 0x16e: /* movd xmm, ea */ #ifdef TARGET_X86_64 if (s->dflag == MO_64) { gen_ldst_modrm(env, s, modrm, MO_64, OR_TMP0, 0); tcg_gen_addi_ptr(cpu_ptr0, cpu_env, offsetof(CPUX86State,xmm_regs[reg])); gen_helper_movq_mm_T0_xmm(cpu_ptr0, cpu_T0); } else #endif { gen_ldst_modrm(env, s, modrm, MO_32, OR_TMP0, 0); tcg_gen_addi_ptr(cpu_ptr0, cpu_env, offsetof(CPUX86State,xmm_regs[reg])); tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T0); gen_helper_movl_mm_T0_xmm(cpu_ptr0, cpu_tmp2_i32); } break; case 0x6f: /* movq mm, ea */ if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_ldq_env_A0(s, offsetof(CPUX86State, fpregs[reg].mmx)); } else { rm = (modrm & 7); tcg_gen_ld_i64(cpu_tmp1_i64, cpu_env, offsetof(CPUX86State,fpregs[rm].mmx)); tcg_gen_st_i64(cpu_tmp1_i64, cpu_env, offsetof(CPUX86State,fpregs[reg].mmx)); } break; case 0x010: /* movups */ case 0x110: /* movupd */ case 0x028: /* movaps */ case 0x128: /* movapd */ case 0x16f: /* movdqa xmm, ea */ case 0x26f: /* movdqu xmm, ea */ if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_ldo_env_A0(s, offsetof(CPUX86State, xmm_regs[reg])); } else { rm = (modrm & 7) | REX_B(s); gen_op_movo(offsetof(CPUX86State,xmm_regs[reg]), offsetof(CPUX86State,xmm_regs[rm])); } break; case 0x210: /* movss xmm, ea */ if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_op_ld_v(s, MO_32, cpu_T0, cpu_A0); tcg_gen_st32_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_regs[reg].ZMM_L(0))); tcg_gen_movi_tl(cpu_T0, 0); tcg_gen_st32_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_regs[reg].ZMM_L(1))); tcg_gen_st32_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_regs[reg].ZMM_L(2))); tcg_gen_st32_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_regs[reg].ZMM_L(3))); } else { rm = (modrm & 7) | REX_B(s); gen_op_movl(offsetof(CPUX86State,xmm_regs[reg].ZMM_L(0)), offsetof(CPUX86State,xmm_regs[rm].ZMM_L(0))); } break; case 0x310: /* movsd xmm, ea */ if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_ldq_env_A0(s, offsetof(CPUX86State, xmm_regs[reg].ZMM_Q(0))); tcg_gen_movi_tl(cpu_T0, 0); tcg_gen_st32_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_regs[reg].ZMM_L(2))); tcg_gen_st32_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_regs[reg].ZMM_L(3))); } else { rm = (modrm & 7) | REX_B(s); gen_op_movq(offsetof(CPUX86State,xmm_regs[reg].ZMM_Q(0)), offsetof(CPUX86State,xmm_regs[rm].ZMM_Q(0))); } break; case 0x012: /* movlps */ case 0x112: /* movlpd */ if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_ldq_env_A0(s, offsetof(CPUX86State, xmm_regs[reg].ZMM_Q(0))); } else { /* movhlps */ rm = (modrm & 7) | REX_B(s); gen_op_movq(offsetof(CPUX86State,xmm_regs[reg].ZMM_Q(0)), offsetof(CPUX86State,xmm_regs[rm].ZMM_Q(1))); } break; case 0x212: /* movsldup */ if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_ldo_env_A0(s, offsetof(CPUX86State, xmm_regs[reg])); } else { rm = (modrm & 7) | REX_B(s); gen_op_movl(offsetof(CPUX86State,xmm_regs[reg].ZMM_L(0)), offsetof(CPUX86State,xmm_regs[rm].ZMM_L(0))); gen_op_movl(offsetof(CPUX86State,xmm_regs[reg].ZMM_L(2)), offsetof(CPUX86State,xmm_regs[rm].ZMM_L(2))); } gen_op_movl(offsetof(CPUX86State,xmm_regs[reg].ZMM_L(1)), offsetof(CPUX86State,xmm_regs[reg].ZMM_L(0))); gen_op_movl(offsetof(CPUX86State,xmm_regs[reg].ZMM_L(3)), offsetof(CPUX86State,xmm_regs[reg].ZMM_L(2))); break; case 0x312: /* movddup */ if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_ldq_env_A0(s, offsetof(CPUX86State, xmm_regs[reg].ZMM_Q(0))); } else { rm = (modrm & 7) | REX_B(s); gen_op_movq(offsetof(CPUX86State,xmm_regs[reg].ZMM_Q(0)), offsetof(CPUX86State,xmm_regs[rm].ZMM_Q(0))); } gen_op_movq(offsetof(CPUX86State,xmm_regs[reg].ZMM_Q(1)), offsetof(CPUX86State,xmm_regs[reg].ZMM_Q(0))); break; case 0x016: /* movhps */ case 0x116: /* movhpd */ if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_ldq_env_A0(s, offsetof(CPUX86State, xmm_regs[reg].ZMM_Q(1))); } else { /* movlhps */ rm = (modrm & 7) | REX_B(s); gen_op_movq(offsetof(CPUX86State,xmm_regs[reg].ZMM_Q(1)), offsetof(CPUX86State,xmm_regs[rm].ZMM_Q(0))); } break; case 0x216: /* movshdup */ if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_ldo_env_A0(s, offsetof(CPUX86State, xmm_regs[reg])); } else { rm = (modrm & 7) | REX_B(s); gen_op_movl(offsetof(CPUX86State,xmm_regs[reg].ZMM_L(1)), offsetof(CPUX86State,xmm_regs[rm].ZMM_L(1))); gen_op_movl(offsetof(CPUX86State,xmm_regs[reg].ZMM_L(3)), offsetof(CPUX86State,xmm_regs[rm].ZMM_L(3))); } gen_op_movl(offsetof(CPUX86State,xmm_regs[reg].ZMM_L(0)), offsetof(CPUX86State,xmm_regs[reg].ZMM_L(1))); gen_op_movl(offsetof(CPUX86State,xmm_regs[reg].ZMM_L(2)), offsetof(CPUX86State,xmm_regs[reg].ZMM_L(3))); break; case 0x178: case 0x378: { int bit_index, field_length; if (b1 == 1 && reg != 0) goto illegal_op; field_length = cpu_ldub_code(env, s->pc++) & 0x3F; bit_index = cpu_ldub_code(env, s->pc++) & 0x3F; tcg_gen_addi_ptr(cpu_ptr0, cpu_env, offsetof(CPUX86State,xmm_regs[reg])); if (b1 == 1) gen_helper_extrq_i(cpu_env, cpu_ptr0, tcg_const_i32(bit_index), tcg_const_i32(field_length)); else gen_helper_insertq_i(cpu_env, cpu_ptr0, tcg_const_i32(bit_index), tcg_const_i32(field_length)); } break; case 0x7e: /* movd ea, mm */ #ifdef TARGET_X86_64 if (s->dflag == MO_64) { tcg_gen_ld_i64(cpu_T0, cpu_env, offsetof(CPUX86State,fpregs[reg].mmx)); gen_ldst_modrm(env, s, modrm, MO_64, OR_TMP0, 1); } else #endif { tcg_gen_ld32u_tl(cpu_T0, cpu_env, offsetof(CPUX86State,fpregs[reg].mmx.MMX_L(0))); gen_ldst_modrm(env, s, modrm, MO_32, OR_TMP0, 1); } break; case 0x17e: /* movd ea, xmm */ #ifdef TARGET_X86_64 if (s->dflag == MO_64) { tcg_gen_ld_i64(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_regs[reg].ZMM_Q(0))); gen_ldst_modrm(env, s, modrm, MO_64, OR_TMP0, 1); } else #endif { tcg_gen_ld32u_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_regs[reg].ZMM_L(0))); gen_ldst_modrm(env, s, modrm, MO_32, OR_TMP0, 1); } break; case 0x27e: /* movq xmm, ea */ if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_ldq_env_A0(s, offsetof(CPUX86State, xmm_regs[reg].ZMM_Q(0))); } else { rm = (modrm & 7) | REX_B(s); gen_op_movq(offsetof(CPUX86State,xmm_regs[reg].ZMM_Q(0)), offsetof(CPUX86State,xmm_regs[rm].ZMM_Q(0))); } gen_op_movq_env_0(offsetof(CPUX86State,xmm_regs[reg].ZMM_Q(1))); break; case 0x7f: /* movq ea, mm */ if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_stq_env_A0(s, offsetof(CPUX86State, fpregs[reg].mmx)); } else { rm = (modrm & 7); gen_op_movq(offsetof(CPUX86State,fpregs[rm].mmx), offsetof(CPUX86State,fpregs[reg].mmx)); } break; case 0x011: /* movups */ case 0x111: /* movupd */ case 0x029: /* movaps */ case 0x129: /* movapd */ case 0x17f: /* movdqa ea, xmm */ case 0x27f: /* movdqu ea, xmm */ if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_sto_env_A0(s, offsetof(CPUX86State, xmm_regs[reg])); } else { rm = (modrm & 7) | REX_B(s); gen_op_movo(offsetof(CPUX86State,xmm_regs[rm]), offsetof(CPUX86State,xmm_regs[reg])); } break; case 0x211: /* movss ea, xmm */ if (mod != 3) { gen_lea_modrm(env, s, modrm); tcg_gen_ld32u_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_regs[reg].ZMM_L(0))); gen_op_st_v(s, MO_32, cpu_T0, cpu_A0); } else { rm = (modrm & 7) | REX_B(s); gen_op_movl(offsetof(CPUX86State,xmm_regs[rm].ZMM_L(0)), offsetof(CPUX86State,xmm_regs[reg].ZMM_L(0))); } break; case 0x311: /* movsd ea, xmm */ if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_stq_env_A0(s, offsetof(CPUX86State, xmm_regs[reg].ZMM_Q(0))); } else { rm = (modrm & 7) | REX_B(s); gen_op_movq(offsetof(CPUX86State,xmm_regs[rm].ZMM_Q(0)), offsetof(CPUX86State,xmm_regs[reg].ZMM_Q(0))); } break; case 0x013: /* movlps */ case 0x113: /* movlpd */ if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_stq_env_A0(s, offsetof(CPUX86State, xmm_regs[reg].ZMM_Q(0))); } else { goto illegal_op; } break; case 0x017: /* movhps */ case 0x117: /* movhpd */ if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_stq_env_A0(s, offsetof(CPUX86State, xmm_regs[reg].ZMM_Q(1))); } else { goto illegal_op; } break; case 0x71: /* shift mm, im */ case 0x72: case 0x73: case 0x171: /* shift xmm, im */ case 0x172: case 0x173: if (b1 >= 2) { goto unknown_op; } val = cpu_ldub_code(env, s->pc++); if (is_xmm) { tcg_gen_movi_tl(cpu_T0, val); tcg_gen_st32_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_t0.ZMM_L(0))); tcg_gen_movi_tl(cpu_T0, 0); tcg_gen_st32_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_t0.ZMM_L(1))); op1_offset = offsetof(CPUX86State,xmm_t0); } else { tcg_gen_movi_tl(cpu_T0, val); tcg_gen_st32_tl(cpu_T0, cpu_env, offsetof(CPUX86State,mmx_t0.MMX_L(0))); tcg_gen_movi_tl(cpu_T0, 0); tcg_gen_st32_tl(cpu_T0, cpu_env, offsetof(CPUX86State,mmx_t0.MMX_L(1))); op1_offset = offsetof(CPUX86State,mmx_t0); } sse_fn_epp = sse_op_table2[((b - 1) & 3) * 8 + (((modrm >> 3)) & 7)][b1]; if (!sse_fn_epp) { goto unknown_op; } if (is_xmm) { rm = (modrm & 7) | REX_B(s); op2_offset = offsetof(CPUX86State,xmm_regs[rm]); } else { rm = (modrm & 7); op2_offset = offsetof(CPUX86State,fpregs[rm].mmx); } tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op2_offset); tcg_gen_addi_ptr(cpu_ptr1, cpu_env, op1_offset); sse_fn_epp(cpu_env, cpu_ptr0, cpu_ptr1); break; case 0x050: /* movmskps */ rm = (modrm & 7) | REX_B(s); tcg_gen_addi_ptr(cpu_ptr0, cpu_env, offsetof(CPUX86State,xmm_regs[rm])); gen_helper_movmskps(cpu_tmp2_i32, cpu_env, cpu_ptr0); tcg_gen_extu_i32_tl(cpu_regs[reg], cpu_tmp2_i32); break; case 0x150: /* movmskpd */ rm = (modrm & 7) | REX_B(s); tcg_gen_addi_ptr(cpu_ptr0, cpu_env, offsetof(CPUX86State,xmm_regs[rm])); gen_helper_movmskpd(cpu_tmp2_i32, cpu_env, cpu_ptr0); tcg_gen_extu_i32_tl(cpu_regs[reg], cpu_tmp2_i32); break; case 0x02a: /* cvtpi2ps */ case 0x12a: /* cvtpi2pd */ gen_helper_enter_mmx(cpu_env); if (mod != 3) { gen_lea_modrm(env, s, modrm); op2_offset = offsetof(CPUX86State,mmx_t0); gen_ldq_env_A0(s, op2_offset); } else { rm = (modrm & 7); op2_offset = offsetof(CPUX86State,fpregs[rm].mmx); } op1_offset = offsetof(CPUX86State,xmm_regs[reg]); tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset); tcg_gen_addi_ptr(cpu_ptr1, cpu_env, op2_offset); switch(b >> 8) { case 0x0: gen_helper_cvtpi2ps(cpu_env, cpu_ptr0, cpu_ptr1); break; default: case 0x1: gen_helper_cvtpi2pd(cpu_env, cpu_ptr0, cpu_ptr1); break; } break; case 0x22a: /* cvtsi2ss */ case 0x32a: /* cvtsi2sd */ ot = mo_64_32(s->dflag); gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); op1_offset = offsetof(CPUX86State,xmm_regs[reg]); tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset); if (ot == MO_32) { SSEFunc_0_epi sse_fn_epi = sse_op_table3ai[(b >> 8) & 1]; tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T0); sse_fn_epi(cpu_env, cpu_ptr0, cpu_tmp2_i32); } else { #ifdef TARGET_X86_64 SSEFunc_0_epl sse_fn_epl = sse_op_table3aq[(b >> 8) & 1]; sse_fn_epl(cpu_env, cpu_ptr0, cpu_T0); #else goto illegal_op; #endif } break; case 0x02c: /* cvttps2pi */ case 0x12c: /* cvttpd2pi */ case 0x02d: /* cvtps2pi */ case 0x12d: /* cvtpd2pi */ gen_helper_enter_mmx(cpu_env); if (mod != 3) { gen_lea_modrm(env, s, modrm); op2_offset = offsetof(CPUX86State,xmm_t0); gen_ldo_env_A0(s, op2_offset); } else { rm = (modrm & 7) | REX_B(s); op2_offset = offsetof(CPUX86State,xmm_regs[rm]); } op1_offset = offsetof(CPUX86State,fpregs[reg & 7].mmx); tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset); tcg_gen_addi_ptr(cpu_ptr1, cpu_env, op2_offset); switch(b) { case 0x02c: gen_helper_cvttps2pi(cpu_env, cpu_ptr0, cpu_ptr1); break; case 0x12c: gen_helper_cvttpd2pi(cpu_env, cpu_ptr0, cpu_ptr1); break; case 0x02d: gen_helper_cvtps2pi(cpu_env, cpu_ptr0, cpu_ptr1); break; case 0x12d: gen_helper_cvtpd2pi(cpu_env, cpu_ptr0, cpu_ptr1); break; } break; case 0x22c: /* cvttss2si */ case 0x32c: /* cvttsd2si */ case 0x22d: /* cvtss2si */ case 0x32d: /* cvtsd2si */ ot = mo_64_32(s->dflag); if (mod != 3) { gen_lea_modrm(env, s, modrm); if ((b >> 8) & 1) { gen_ldq_env_A0(s, offsetof(CPUX86State, xmm_t0.ZMM_Q(0))); } else { gen_op_ld_v(s, MO_32, cpu_T0, cpu_A0); tcg_gen_st32_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_t0.ZMM_L(0))); } op2_offset = offsetof(CPUX86State,xmm_t0); } else { rm = (modrm & 7) | REX_B(s); op2_offset = offsetof(CPUX86State,xmm_regs[rm]); } tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op2_offset); if (ot == MO_32) { SSEFunc_i_ep sse_fn_i_ep = sse_op_table3bi[((b >> 7) & 2) | (b & 1)]; sse_fn_i_ep(cpu_tmp2_i32, cpu_env, cpu_ptr0); tcg_gen_extu_i32_tl(cpu_T0, cpu_tmp2_i32); } else { #ifdef TARGET_X86_64 SSEFunc_l_ep sse_fn_l_ep = sse_op_table3bq[((b >> 7) & 2) | (b & 1)]; sse_fn_l_ep(cpu_T0, cpu_env, cpu_ptr0); #else goto illegal_op; #endif } gen_op_mov_reg_v(ot, reg, cpu_T0); break; case 0xc4: /* pinsrw */ case 0x1c4: s->rip_offset = 1; gen_ldst_modrm(env, s, modrm, MO_16, OR_TMP0, 0); val = cpu_ldub_code(env, s->pc++); if (b1) { val &= 7; tcg_gen_st16_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_regs[reg].ZMM_W(val))); } else { val &= 3; tcg_gen_st16_tl(cpu_T0, cpu_env, offsetof(CPUX86State,fpregs[reg].mmx.MMX_W(val))); } break; case 0xc5: /* pextrw */ case 0x1c5: if (mod != 3) goto illegal_op; ot = mo_64_32(s->dflag); val = cpu_ldub_code(env, s->pc++); if (b1) { val &= 7; rm = (modrm & 7) | REX_B(s); tcg_gen_ld16u_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_regs[rm].ZMM_W(val))); } else { val &= 3; rm = (modrm & 7); tcg_gen_ld16u_tl(cpu_T0, cpu_env, offsetof(CPUX86State,fpregs[rm].mmx.MMX_W(val))); } reg = ((modrm >> 3) & 7) | rex_r; gen_op_mov_reg_v(ot, reg, cpu_T0); break; case 0x1d6: /* movq ea, xmm */ if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_stq_env_A0(s, offsetof(CPUX86State, xmm_regs[reg].ZMM_Q(0))); } else { rm = (modrm & 7) | REX_B(s); gen_op_movq(offsetof(CPUX86State,xmm_regs[rm].ZMM_Q(0)), offsetof(CPUX86State,xmm_regs[reg].ZMM_Q(0))); gen_op_movq_env_0(offsetof(CPUX86State,xmm_regs[rm].ZMM_Q(1))); } break; case 0x2d6: /* movq2dq */ gen_helper_enter_mmx(cpu_env); rm = (modrm & 7); gen_op_movq(offsetof(CPUX86State,xmm_regs[reg].ZMM_Q(0)), offsetof(CPUX86State,fpregs[rm].mmx)); gen_op_movq_env_0(offsetof(CPUX86State,xmm_regs[reg].ZMM_Q(1))); break; case 0x3d6: /* movdq2q */ gen_helper_enter_mmx(cpu_env); rm = (modrm & 7) | REX_B(s); gen_op_movq(offsetof(CPUX86State,fpregs[reg & 7].mmx), offsetof(CPUX86State,xmm_regs[rm].ZMM_Q(0))); break; case 0xd7: /* pmovmskb */ case 0x1d7: if (mod != 3) goto illegal_op; if (b1) { rm = (modrm & 7) | REX_B(s); tcg_gen_addi_ptr(cpu_ptr0, cpu_env, offsetof(CPUX86State,xmm_regs[rm])); gen_helper_pmovmskb_xmm(cpu_tmp2_i32, cpu_env, cpu_ptr0); } else { rm = (modrm & 7); tcg_gen_addi_ptr(cpu_ptr0, cpu_env, offsetof(CPUX86State,fpregs[rm].mmx)); gen_helper_pmovmskb_mmx(cpu_tmp2_i32, cpu_env, cpu_ptr0); } reg = ((modrm >> 3) & 7) | rex_r; tcg_gen_extu_i32_tl(cpu_regs[reg], cpu_tmp2_i32); break; case 0x138: case 0x038: b = modrm; if ((b & 0xf0) == 0xf0) { goto do_0f_38_fx; } modrm = cpu_ldub_code(env, s->pc++); rm = modrm & 7; reg = ((modrm >> 3) & 7) | rex_r; mod = (modrm >> 6) & 3; if (b1 >= 2) { goto unknown_op; } sse_fn_epp = sse_op_table6[b].op[b1]; if (!sse_fn_epp) { goto unknown_op; } if (!(s->cpuid_ext_features & sse_op_table6[b].ext_mask)) goto illegal_op; if (b1) { op1_offset = offsetof(CPUX86State,xmm_regs[reg]); if (mod == 3) { op2_offset = offsetof(CPUX86State,xmm_regs[rm | REX_B(s)]); } else { op2_offset = offsetof(CPUX86State,xmm_t0); gen_lea_modrm(env, s, modrm); switch (b) { case 0x20: case 0x30: /* pmovsxbw, pmovzxbw */ case 0x23: case 0x33: /* pmovsxwd, pmovzxwd */ case 0x25: case 0x35: /* pmovsxdq, pmovzxdq */ gen_ldq_env_A0(s, op2_offset + offsetof(ZMMReg, ZMM_Q(0))); break; case 0x21: case 0x31: /* pmovsxbd, pmovzxbd */ case 0x24: case 0x34: /* pmovsxwq, pmovzxwq */ tcg_gen_qemu_ld_i32(cpu_tmp2_i32, cpu_A0, s->mem_index, MO_LEUL); tcg_gen_st_i32(cpu_tmp2_i32, cpu_env, op2_offset + offsetof(ZMMReg, ZMM_L(0))); break; case 0x22: case 0x32: /* pmovsxbq, pmovzxbq */ tcg_gen_qemu_ld_tl(cpu_tmp0, cpu_A0, s->mem_index, MO_LEUW); tcg_gen_st16_tl(cpu_tmp0, cpu_env, op2_offset + offsetof(ZMMReg, ZMM_W(0))); break; case 0x2a: /* movntqda */ gen_ldo_env_A0(s, op1_offset); return; default: gen_ldo_env_A0(s, op2_offset); } } } else { op1_offset = offsetof(CPUX86State,fpregs[reg].mmx); if (mod == 3) { op2_offset = offsetof(CPUX86State,fpregs[rm].mmx); } else { op2_offset = offsetof(CPUX86State,mmx_t0); gen_lea_modrm(env, s, modrm); gen_ldq_env_A0(s, op2_offset); } } if (sse_fn_epp == SSE_SPECIAL) { goto unknown_op; } tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset); tcg_gen_addi_ptr(cpu_ptr1, cpu_env, op2_offset); sse_fn_epp(cpu_env, cpu_ptr0, cpu_ptr1); if (b == 0x17) { set_cc_op(s, CC_OP_EFLAGS); } break; case 0x238: case 0x338: do_0f_38_fx: /* Various integer extensions at 0f 38 f[0-f]. */ b = modrm | (b1 << 8); modrm = cpu_ldub_code(env, s->pc++); reg = ((modrm >> 3) & 7) | rex_r; switch (b) { case 0x3f0: /* crc32 Gd,Eb */ case 0x3f1: /* crc32 Gd,Ey */ do_crc32: if (!(s->cpuid_ext_features & CPUID_EXT_SSE42)) { goto illegal_op; } if ((b & 0xff) == 0xf0) { ot = MO_8; } else if (s->dflag != MO_64) { ot = (s->prefix & PREFIX_DATA ? MO_16 : MO_32); } else { ot = MO_64; } tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_regs[reg]); gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); gen_helper_crc32(cpu_T0, cpu_tmp2_i32, cpu_T0, tcg_const_i32(8 << ot)); ot = mo_64_32(s->dflag); gen_op_mov_reg_v(ot, reg, cpu_T0); break; case 0x1f0: /* crc32 or movbe */ case 0x1f1: /* For these insns, the f3 prefix is supposed to have priority over the 66 prefix, but that's not what we implement above setting b1. */ if (s->prefix & PREFIX_REPNZ) { goto do_crc32; } /* FALLTHRU */ case 0x0f0: /* movbe Gy,My */ case 0x0f1: /* movbe My,Gy */ if (!(s->cpuid_ext_features & CPUID_EXT_MOVBE)) { goto illegal_op; } if (s->dflag != MO_64) { ot = (s->prefix & PREFIX_DATA ? MO_16 : MO_32); } else { ot = MO_64; } gen_lea_modrm(env, s, modrm); if ((b & 1) == 0) { tcg_gen_qemu_ld_tl(cpu_T0, cpu_A0, s->mem_index, ot | MO_BE); gen_op_mov_reg_v(ot, reg, cpu_T0); } else { tcg_gen_qemu_st_tl(cpu_regs[reg], cpu_A0, s->mem_index, ot | MO_BE); } break; case 0x0f2: /* andn Gy, By, Ey */ if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_BMI1) || !(s->prefix & PREFIX_VEX) || s->vex_l != 0) { goto illegal_op; } ot = mo_64_32(s->dflag); gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); tcg_gen_andc_tl(cpu_T0, cpu_regs[s->vex_v], cpu_T0); gen_op_mov_reg_v(ot, reg, cpu_T0); gen_op_update1_cc(); set_cc_op(s, CC_OP_LOGICB + ot); break; case 0x0f7: /* bextr Gy, Ey, By */ if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_BMI1) || !(s->prefix & PREFIX_VEX) || s->vex_l != 0) { goto illegal_op; } ot = mo_64_32(s->dflag); { TCGv bound, zero; gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); /* Extract START, and shift the operand. Shifts larger than operand size get zeros. */ tcg_gen_ext8u_tl(cpu_A0, cpu_regs[s->vex_v]); tcg_gen_shr_tl(cpu_T0, cpu_T0, cpu_A0); bound = tcg_const_tl(ot == MO_64 ? 63 : 31); zero = tcg_const_tl(0); tcg_gen_movcond_tl(TCG_COND_LEU, cpu_T0, cpu_A0, bound, cpu_T0, zero); tcg_temp_free(zero); /* Extract the LEN into a mask. Lengths larger than operand size get all ones. */ tcg_gen_extract_tl(cpu_A0, cpu_regs[s->vex_v], 8, 8); tcg_gen_movcond_tl(TCG_COND_LEU, cpu_A0, cpu_A0, bound, cpu_A0, bound); tcg_temp_free(bound); tcg_gen_movi_tl(cpu_T1, 1); tcg_gen_shl_tl(cpu_T1, cpu_T1, cpu_A0); tcg_gen_subi_tl(cpu_T1, cpu_T1, 1); tcg_gen_and_tl(cpu_T0, cpu_T0, cpu_T1); gen_op_mov_reg_v(ot, reg, cpu_T0); gen_op_update1_cc(); set_cc_op(s, CC_OP_LOGICB + ot); } break; case 0x0f5: /* bzhi Gy, Ey, By */ if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_BMI2) || !(s->prefix & PREFIX_VEX) || s->vex_l != 0) { goto illegal_op; } ot = mo_64_32(s->dflag); gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); tcg_gen_ext8u_tl(cpu_T1, cpu_regs[s->vex_v]); { TCGv bound = tcg_const_tl(ot == MO_64 ? 63 : 31); /* Note that since we're using BMILG (in order to get O cleared) we need to store the inverse into C. */ tcg_gen_setcond_tl(TCG_COND_LT, cpu_cc_src, cpu_T1, bound); tcg_gen_movcond_tl(TCG_COND_GT, cpu_T1, cpu_T1, bound, bound, cpu_T1); tcg_temp_free(bound); } tcg_gen_movi_tl(cpu_A0, -1); tcg_gen_shl_tl(cpu_A0, cpu_A0, cpu_T1); tcg_gen_andc_tl(cpu_T0, cpu_T0, cpu_A0); gen_op_mov_reg_v(ot, reg, cpu_T0); gen_op_update1_cc(); set_cc_op(s, CC_OP_BMILGB + ot); break; case 0x3f6: /* mulx By, Gy, rdx, Ey */ if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_BMI2) || !(s->prefix & PREFIX_VEX) || s->vex_l != 0) { goto illegal_op; } ot = mo_64_32(s->dflag); gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); switch (ot) { default: tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T0); tcg_gen_trunc_tl_i32(cpu_tmp3_i32, cpu_regs[R_EDX]); tcg_gen_mulu2_i32(cpu_tmp2_i32, cpu_tmp3_i32, cpu_tmp2_i32, cpu_tmp3_i32); tcg_gen_extu_i32_tl(cpu_regs[s->vex_v], cpu_tmp2_i32); tcg_gen_extu_i32_tl(cpu_regs[reg], cpu_tmp3_i32); break; #ifdef TARGET_X86_64 case MO_64: tcg_gen_mulu2_i64(cpu_T0, cpu_T1, cpu_T0, cpu_regs[R_EDX]); tcg_gen_mov_i64(cpu_regs[s->vex_v], cpu_T0); tcg_gen_mov_i64(cpu_regs[reg], cpu_T1); break; #endif } break; case 0x3f5: /* pdep Gy, By, Ey */ if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_BMI2) || !(s->prefix & PREFIX_VEX) || s->vex_l != 0) { goto illegal_op; } ot = mo_64_32(s->dflag); gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); /* Note that by zero-extending the mask operand, we automatically handle zero-extending the result. */ if (ot == MO_64) { tcg_gen_mov_tl(cpu_T1, cpu_regs[s->vex_v]); } else { tcg_gen_ext32u_tl(cpu_T1, cpu_regs[s->vex_v]); } gen_helper_pdep(cpu_regs[reg], cpu_T0, cpu_T1); break; case 0x2f5: /* pext Gy, By, Ey */ if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_BMI2) || !(s->prefix & PREFIX_VEX) || s->vex_l != 0) { goto illegal_op; } ot = mo_64_32(s->dflag); gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); /* Note that by zero-extending the mask operand, we automatically handle zero-extending the result. */ if (ot == MO_64) { tcg_gen_mov_tl(cpu_T1, cpu_regs[s->vex_v]); } else { tcg_gen_ext32u_tl(cpu_T1, cpu_regs[s->vex_v]); } gen_helper_pext(cpu_regs[reg], cpu_T0, cpu_T1); break; case 0x1f6: /* adcx Gy, Ey */ case 0x2f6: /* adox Gy, Ey */ if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_ADX)) { goto illegal_op; } else { TCGv carry_in, carry_out, zero; int end_op; ot = mo_64_32(s->dflag); gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); /* Re-use the carry-out from a previous round. */ TCGV_UNUSED(carry_in); carry_out = (b == 0x1f6 ? cpu_cc_dst : cpu_cc_src2); switch (s->cc_op) { case CC_OP_ADCX: if (b == 0x1f6) { carry_in = cpu_cc_dst; end_op = CC_OP_ADCX; } else { end_op = CC_OP_ADCOX; } break; case CC_OP_ADOX: if (b == 0x1f6) { end_op = CC_OP_ADCOX; } else { carry_in = cpu_cc_src2; end_op = CC_OP_ADOX; } break; case CC_OP_ADCOX: end_op = CC_OP_ADCOX; carry_in = carry_out; break; default: end_op = (b == 0x1f6 ? CC_OP_ADCX : CC_OP_ADOX); break; } /* If we can't reuse carry-out, get it out of EFLAGS. */ if (TCGV_IS_UNUSED(carry_in)) { if (s->cc_op != CC_OP_ADCX && s->cc_op != CC_OP_ADOX) { gen_compute_eflags(s); } carry_in = cpu_tmp0; tcg_gen_extract_tl(carry_in, cpu_cc_src, ctz32(b == 0x1f6 ? CC_C : CC_O), 1); } switch (ot) { #ifdef TARGET_X86_64 case MO_32: /* If we know TL is 64-bit, and we want a 32-bit result, just do everything in 64-bit arithmetic. */ tcg_gen_ext32u_i64(cpu_regs[reg], cpu_regs[reg]); tcg_gen_ext32u_i64(cpu_T0, cpu_T0); tcg_gen_add_i64(cpu_T0, cpu_T0, cpu_regs[reg]); tcg_gen_add_i64(cpu_T0, cpu_T0, carry_in); tcg_gen_ext32u_i64(cpu_regs[reg], cpu_T0); tcg_gen_shri_i64(carry_out, cpu_T0, 32); break; #endif default: /* Otherwise compute the carry-out in two steps. */ zero = tcg_const_tl(0); tcg_gen_add2_tl(cpu_T0, carry_out, cpu_T0, zero, carry_in, zero); tcg_gen_add2_tl(cpu_regs[reg], carry_out, cpu_regs[reg], carry_out, cpu_T0, zero); tcg_temp_free(zero); break; } set_cc_op(s, end_op); } break; case 0x1f7: /* shlx Gy, Ey, By */ case 0x2f7: /* sarx Gy, Ey, By */ case 0x3f7: /* shrx Gy, Ey, By */ if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_BMI2) || !(s->prefix & PREFIX_VEX) || s->vex_l != 0) { goto illegal_op; } ot = mo_64_32(s->dflag); gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); if (ot == MO_64) { tcg_gen_andi_tl(cpu_T1, cpu_regs[s->vex_v], 63); } else { tcg_gen_andi_tl(cpu_T1, cpu_regs[s->vex_v], 31); } if (b == 0x1f7) { tcg_gen_shl_tl(cpu_T0, cpu_T0, cpu_T1); } else if (b == 0x2f7) { if (ot != MO_64) { tcg_gen_ext32s_tl(cpu_T0, cpu_T0); } tcg_gen_sar_tl(cpu_T0, cpu_T0, cpu_T1); } else { if (ot != MO_64) { tcg_gen_ext32u_tl(cpu_T0, cpu_T0); } tcg_gen_shr_tl(cpu_T0, cpu_T0, cpu_T1); } gen_op_mov_reg_v(ot, reg, cpu_T0); break; case 0x0f3: case 0x1f3: case 0x2f3: case 0x3f3: /* Group 17 */ if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_BMI1) || !(s->prefix & PREFIX_VEX) || s->vex_l != 0) { goto illegal_op; } ot = mo_64_32(s->dflag); gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); switch (reg & 7) { case 1: /* blsr By,Ey */ tcg_gen_neg_tl(cpu_T1, cpu_T0); tcg_gen_and_tl(cpu_T0, cpu_T0, cpu_T1); gen_op_mov_reg_v(ot, s->vex_v, cpu_T0); gen_op_update2_cc(); set_cc_op(s, CC_OP_BMILGB + ot); break; case 2: /* blsmsk By,Ey */ tcg_gen_mov_tl(cpu_cc_src, cpu_T0); tcg_gen_subi_tl(cpu_T0, cpu_T0, 1); tcg_gen_xor_tl(cpu_T0, cpu_T0, cpu_cc_src); tcg_gen_mov_tl(cpu_cc_dst, cpu_T0); set_cc_op(s, CC_OP_BMILGB + ot); break; case 3: /* blsi By, Ey */ tcg_gen_mov_tl(cpu_cc_src, cpu_T0); tcg_gen_subi_tl(cpu_T0, cpu_T0, 1); tcg_gen_and_tl(cpu_T0, cpu_T0, cpu_cc_src); tcg_gen_mov_tl(cpu_cc_dst, cpu_T0); set_cc_op(s, CC_OP_BMILGB + ot); break; default: goto unknown_op; } break; default: goto unknown_op; } break; case 0x03a: case 0x13a: b = modrm; modrm = cpu_ldub_code(env, s->pc++); rm = modrm & 7; reg = ((modrm >> 3) & 7) | rex_r; mod = (modrm >> 6) & 3; if (b1 >= 2) { goto unknown_op; } sse_fn_eppi = sse_op_table7[b].op[b1]; if (!sse_fn_eppi) { goto unknown_op; } if (!(s->cpuid_ext_features & sse_op_table7[b].ext_mask)) goto illegal_op; if (sse_fn_eppi == SSE_SPECIAL) { ot = mo_64_32(s->dflag); rm = (modrm & 7) | REX_B(s); if (mod != 3) gen_lea_modrm(env, s, modrm); reg = ((modrm >> 3) & 7) | rex_r; val = cpu_ldub_code(env, s->pc++); switch (b) { case 0x14: /* pextrb */ tcg_gen_ld8u_tl(cpu_T0, cpu_env, offsetof(CPUX86State, xmm_regs[reg].ZMM_B(val & 15))); if (mod == 3) { gen_op_mov_reg_v(ot, rm, cpu_T0); } else { tcg_gen_qemu_st_tl(cpu_T0, cpu_A0, s->mem_index, MO_UB); } break; case 0x15: /* pextrw */ tcg_gen_ld16u_tl(cpu_T0, cpu_env, offsetof(CPUX86State, xmm_regs[reg].ZMM_W(val & 7))); if (mod == 3) { gen_op_mov_reg_v(ot, rm, cpu_T0); } else { tcg_gen_qemu_st_tl(cpu_T0, cpu_A0, s->mem_index, MO_LEUW); } break; case 0x16: if (ot == MO_32) { /* pextrd */ tcg_gen_ld_i32(cpu_tmp2_i32, cpu_env, offsetof(CPUX86State, xmm_regs[reg].ZMM_L(val & 3))); if (mod == 3) { tcg_gen_extu_i32_tl(cpu_regs[rm], cpu_tmp2_i32); } else { tcg_gen_qemu_st_i32(cpu_tmp2_i32, cpu_A0, s->mem_index, MO_LEUL); } } else { /* pextrq */ #ifdef TARGET_X86_64 tcg_gen_ld_i64(cpu_tmp1_i64, cpu_env, offsetof(CPUX86State, xmm_regs[reg].ZMM_Q(val & 1))); if (mod == 3) { tcg_gen_mov_i64(cpu_regs[rm], cpu_tmp1_i64); } else { tcg_gen_qemu_st_i64(cpu_tmp1_i64, cpu_A0, s->mem_index, MO_LEQ); } #else goto illegal_op; #endif } break; case 0x17: /* extractps */ tcg_gen_ld32u_tl(cpu_T0, cpu_env, offsetof(CPUX86State, xmm_regs[reg].ZMM_L(val & 3))); if (mod == 3) { gen_op_mov_reg_v(ot, rm, cpu_T0); } else { tcg_gen_qemu_st_tl(cpu_T0, cpu_A0, s->mem_index, MO_LEUL); } break; case 0x20: /* pinsrb */ if (mod == 3) { gen_op_mov_v_reg(MO_32, cpu_T0, rm); } else { tcg_gen_qemu_ld_tl(cpu_T0, cpu_A0, s->mem_index, MO_UB); } tcg_gen_st8_tl(cpu_T0, cpu_env, offsetof(CPUX86State, xmm_regs[reg].ZMM_B(val & 15))); break; case 0x21: /* insertps */ if (mod == 3) { tcg_gen_ld_i32(cpu_tmp2_i32, cpu_env, offsetof(CPUX86State,xmm_regs[rm] .ZMM_L((val >> 6) & 3))); } else { tcg_gen_qemu_ld_i32(cpu_tmp2_i32, cpu_A0, s->mem_index, MO_LEUL); } tcg_gen_st_i32(cpu_tmp2_i32, cpu_env, offsetof(CPUX86State,xmm_regs[reg] .ZMM_L((val >> 4) & 3))); if ((val >> 0) & 1) tcg_gen_st_i32(tcg_const_i32(0 /*float32_zero*/), cpu_env, offsetof(CPUX86State, xmm_regs[reg].ZMM_L(0))); if ((val >> 1) & 1) tcg_gen_st_i32(tcg_const_i32(0 /*float32_zero*/), cpu_env, offsetof(CPUX86State, xmm_regs[reg].ZMM_L(1))); if ((val >> 2) & 1) tcg_gen_st_i32(tcg_const_i32(0 /*float32_zero*/), cpu_env, offsetof(CPUX86State, xmm_regs[reg].ZMM_L(2))); if ((val >> 3) & 1) tcg_gen_st_i32(tcg_const_i32(0 /*float32_zero*/), cpu_env, offsetof(CPUX86State, xmm_regs[reg].ZMM_L(3))); break; case 0x22: if (ot == MO_32) { /* pinsrd */ if (mod == 3) { tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_regs[rm]); } else { tcg_gen_qemu_ld_i32(cpu_tmp2_i32, cpu_A0, s->mem_index, MO_LEUL); } tcg_gen_st_i32(cpu_tmp2_i32, cpu_env, offsetof(CPUX86State, xmm_regs[reg].ZMM_L(val & 3))); } else { /* pinsrq */ #ifdef TARGET_X86_64 if (mod == 3) { gen_op_mov_v_reg(ot, cpu_tmp1_i64, rm); } else { tcg_gen_qemu_ld_i64(cpu_tmp1_i64, cpu_A0, s->mem_index, MO_LEQ); } tcg_gen_st_i64(cpu_tmp1_i64, cpu_env, offsetof(CPUX86State, xmm_regs[reg].ZMM_Q(val & 1))); #else goto illegal_op; #endif } break; } return; } if (b1) { op1_offset = offsetof(CPUX86State,xmm_regs[reg]); if (mod == 3) { op2_offset = offsetof(CPUX86State,xmm_regs[rm | REX_B(s)]); } else { op2_offset = offsetof(CPUX86State,xmm_t0); gen_lea_modrm(env, s, modrm); gen_ldo_env_A0(s, op2_offset); } } else { op1_offset = offsetof(CPUX86State,fpregs[reg].mmx); if (mod == 3) { op2_offset = offsetof(CPUX86State,fpregs[rm].mmx); } else { op2_offset = offsetof(CPUX86State,mmx_t0); gen_lea_modrm(env, s, modrm); gen_ldq_env_A0(s, op2_offset); } } val = cpu_ldub_code(env, s->pc++); if ((b & 0xfc) == 0x60) { /* pcmpXstrX */ set_cc_op(s, CC_OP_EFLAGS); if (s->dflag == MO_64) { /* The helper must use entire 64-bit gp registers */ val |= 1 << 8; } } tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset); tcg_gen_addi_ptr(cpu_ptr1, cpu_env, op2_offset); sse_fn_eppi(cpu_env, cpu_ptr0, cpu_ptr1, tcg_const_i32(val)); break; case 0x33a: /* Various integer extensions at 0f 3a f[0-f]. */ b = modrm | (b1 << 8); modrm = cpu_ldub_code(env, s->pc++); reg = ((modrm >> 3) & 7) | rex_r; switch (b) { case 0x3f0: /* rorx Gy,Ey, Ib */ if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_BMI2) || !(s->prefix & PREFIX_VEX) || s->vex_l != 0) { goto illegal_op; } ot = mo_64_32(s->dflag); gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); b = cpu_ldub_code(env, s->pc++); if (ot == MO_64) { tcg_gen_rotri_tl(cpu_T0, cpu_T0, b & 63); } else { tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T0); tcg_gen_rotri_i32(cpu_tmp2_i32, cpu_tmp2_i32, b & 31); tcg_gen_extu_i32_tl(cpu_T0, cpu_tmp2_i32); } gen_op_mov_reg_v(ot, reg, cpu_T0); break; default: goto unknown_op; } break; default: unknown_op: gen_unknown_opcode(env, s); return; } } else { /* generic MMX or SSE operation */ switch(b) { case 0x70: /* pshufx insn */ case 0xc6: /* pshufx insn */ case 0xc2: /* compare insns */ s->rip_offset = 1; break; default: break; } if (is_xmm) { op1_offset = offsetof(CPUX86State,xmm_regs[reg]); if (mod != 3) { int sz = 4; gen_lea_modrm(env, s, modrm); op2_offset = offsetof(CPUX86State,xmm_t0); switch (b) { case 0x50 ... 0x5a: case 0x5c ... 0x5f: case 0xc2: /* Most sse scalar operations. */ if (b1 == 2) { sz = 2; } else if (b1 == 3) { sz = 3; } break; case 0x2e: /* ucomis[sd] */ case 0x2f: /* comis[sd] */ if (b1 == 0) { sz = 2; } else { sz = 3; } break; } switch (sz) { case 2: /* 32 bit access */ gen_op_ld_v(s, MO_32, cpu_T0, cpu_A0); tcg_gen_st32_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_t0.ZMM_L(0))); break; case 3: /* 64 bit access */ gen_ldq_env_A0(s, offsetof(CPUX86State, xmm_t0.ZMM_D(0))); break; default: /* 128 bit access */ gen_ldo_env_A0(s, op2_offset); break; } } else { rm = (modrm & 7) | REX_B(s); op2_offset = offsetof(CPUX86State,xmm_regs[rm]); } } else { op1_offset = offsetof(CPUX86State,fpregs[reg].mmx); if (mod != 3) { gen_lea_modrm(env, s, modrm); op2_offset = offsetof(CPUX86State,mmx_t0); gen_ldq_env_A0(s, op2_offset); } else { rm = (modrm & 7); op2_offset = offsetof(CPUX86State,fpregs[rm].mmx); } } switch(b) { case 0x0f: /* 3DNow! data insns */ val = cpu_ldub_code(env, s->pc++); sse_fn_epp = sse_op_table5[val]; if (!sse_fn_epp) { goto unknown_op; } if (!(s->cpuid_ext2_features & CPUID_EXT2_3DNOW)) { goto illegal_op; } tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset); tcg_gen_addi_ptr(cpu_ptr1, cpu_env, op2_offset); sse_fn_epp(cpu_env, cpu_ptr0, cpu_ptr1); break; case 0x70: /* pshufx insn */ case 0xc6: /* pshufx insn */ val = cpu_ldub_code(env, s->pc++); tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset); tcg_gen_addi_ptr(cpu_ptr1, cpu_env, op2_offset); /* XXX: introduce a new table? */ sse_fn_ppi = (SSEFunc_0_ppi)sse_fn_epp; sse_fn_ppi(cpu_ptr0, cpu_ptr1, tcg_const_i32(val)); break; case 0xc2: /* compare insns */ val = cpu_ldub_code(env, s->pc++); if (val >= 8) goto unknown_op; sse_fn_epp = sse_op_table4[val][b1]; tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset); tcg_gen_addi_ptr(cpu_ptr1, cpu_env, op2_offset); sse_fn_epp(cpu_env, cpu_ptr0, cpu_ptr1); break; case 0xf7: /* maskmov : we must prepare A0 */ if (mod != 3) goto illegal_op; tcg_gen_mov_tl(cpu_A0, cpu_regs[R_EDI]); gen_extu(s->aflag, cpu_A0); gen_add_A0_ds_seg(s); tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset); tcg_gen_addi_ptr(cpu_ptr1, cpu_env, op2_offset); /* XXX: introduce a new table? */ sse_fn_eppt = (SSEFunc_0_eppt)sse_fn_epp; sse_fn_eppt(cpu_env, cpu_ptr0, cpu_ptr1, cpu_A0); break; default: tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset); tcg_gen_addi_ptr(cpu_ptr1, cpu_env, op2_offset); sse_fn_epp(cpu_env, cpu_ptr0, cpu_ptr1); break; } if (b == 0x2e || b == 0x2f) { set_cc_op(s, CC_OP_EFLAGS); } } } ",0 "cmd_http_rxchunk(CMD_ARGS) { struct http *hp; int ll, i; (void)cmd; (void)vl; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); ONLY_CLIENT(hp, av); i = http_rxchunk(hp); if (i == 0) { ll = hp->rxbuf + hp->prxbuf - hp->body; hp->bodyl = ll; sprintf(hp->bodylen, ""%d"", ll); vtc_log(hp->vl, 4, ""bodylen = %s"", hp->bodylen); } } ",0 "static int lookup_fast(struct nameidata *nd, struct path *path, struct inode **inode) { struct vfsmount *mnt = nd->path.mnt; struct dentry *dentry, *parent = nd->path.dentry; int need_reval = 1; int status = 1; int err; /* * Rename seqlock is not required here because in the off chance * of a false negative due to a concurrent rename, we're going to * do the non-racy lookup, below. */ if (nd->flags & LOOKUP_RCU) { unsigned seq; bool negative; dentry = __d_lookup_rcu(parent, &nd->last, &seq); if (!dentry) goto unlazy; /* * This sequence count validates that the inode matches * the dentry name information from lookup. */ *inode = dentry->d_inode; negative = d_is_negative(dentry); if (read_seqcount_retry(&dentry->d_seq, seq)) return -ECHILD; if (negative) return -ENOENT; /* * This sequence count validates that the parent had no * changes while we did the lookup of the dentry above. * * The memory barrier in read_seqcount_begin of child is * enough, we can use __read_seqcount_retry here. */ if (__read_seqcount_retry(&parent->d_seq, nd->seq)) return -ECHILD; nd->seq = seq; if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE)) { status = d_revalidate(dentry, nd->flags); if (unlikely(status <= 0)) { if (status != -ECHILD) need_reval = 0; goto unlazy; } } path->mnt = mnt; path->dentry = dentry; if (likely(__follow_mount_rcu(nd, path, inode))) return 0; unlazy: if (unlazy_walk(nd, dentry)) return -ECHILD; } else { dentry = __d_lookup(parent, &nd->last); } if (unlikely(!dentry)) goto need_lookup; if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE) && need_reval) status = d_revalidate(dentry, nd->flags); if (unlikely(status <= 0)) { if (status < 0) { dput(dentry); return status; } d_invalidate(dentry); dput(dentry); goto need_lookup; } if (unlikely(d_is_negative(dentry))) { dput(dentry); return -ENOENT; } path->mnt = mnt; path->dentry = dentry; err = follow_managed(path, nd->flags); if (unlikely(err < 0)) { path_put_conditional(path, nd); return err; } if (err) nd->flags |= LOOKUP_JUMPED; *inode = path->dentry->d_inode; return 0; need_lookup: return 1; } ",0 "error::Error GLES2DecoderImpl::GetAttribLocationHelper( GLuint client_id, uint32 location_shm_id, uint32 location_shm_offset, const std::string& name_str) { ProgramManager::ProgramInfo* info = GetProgramInfoNotShader( client_id, ""glGetAttribLocation""); if (!info) { return error::kNoError; } if (!info->IsValid()) { SetGLError(GL_INVALID_OPERATION, ""glGetAttribLocation: program not linked""); return error::kNoError; } GLint* location = GetSharedMemoryAs( location_shm_id, location_shm_offset, sizeof(GLint)); if (!location) { return error::kOutOfBounds; } if (*location != -1) { return error::kGenericError; } *location = info->GetAttribLocation(name_str); return error::kNoError; } ",0 "delete_cb (GtkDialog *dialog) { gtk_dialog_response (dialog, GTK_RESPONSE_DELETE_EVENT); return TRUE; } ",0 "static void optionsObjectMethodCallback(const v8::FunctionCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMMethod""); TestObjectV8Internal::optionsObjectMethod(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 " void Wait() { if (web_contents()->GetController().GetVisibleEntry()) return; run_loop_.Run(); } ",0 "void RenderFrameImpl::PrepareRenderViewForNavigation( const GURL& url, const RequestNavigationParams& request_params) { DCHECK(render_view_->webview()); if (is_main_frame_) { for (auto& observer : render_view_->observers_) observer.Navigate(url); } render_view_->history_list_offset_ = request_params.current_history_list_offset; render_view_->history_list_length_ = request_params.current_history_list_length; } ",0 "mboxlist_sync_setacls(const char *name, const char *newacl) { mbentry_t *mbentry = NULL; int r; struct txn *tid = NULL; /* 1. Start Transaction */ /* lookup the mailbox to make sure it exists and get its acl */ do { r = mboxlist_mylookup(name, &mbentry, &tid, 1); } while(r == IMAP_AGAIN); /* Can't do this to an in-transit or reserved mailbox */ if (!r && mbentry->mbtype & (MBTYPE_MOVING | MBTYPE_RESERVE | MBTYPE_DELETED)) { r = IMAP_MAILBOX_NOTSUPPORTED; } /* 2. Set DB Entry */ if (!r) { /* ok, change the database */ free(mbentry->acl); mbentry->acl = xstrdupnull(newacl); r = mboxlist_update_entry(name, mbentry, &tid); if (r) { syslog(LOG_ERR, ""DBERROR: error updating acl %s: %s"", name, cyrusdb_strerror(r)); r = IMAP_IOERROR; } } /* 3. Commit transaction */ if (!r) { r = cyrusdb_commit(mbdb, tid); if (r) { syslog(LOG_ERR, ""DBERROR: failed on commit %s: %s"", name, cyrusdb_strerror(r)); r = IMAP_IOERROR; } tid = NULL; } /* 4. Change mupdate entry */ if (!r && config_mupdate_server) { mupdate_handle *mupdate_h = NULL; /* commit the update to MUPDATE */ char buf[MAX_PARTITION_LEN + HOSTNAME_SIZE + 2]; sprintf(buf, ""%s!%s"", config_servername, mbentry->partition); r = mupdate_connect(config_mupdate_server, NULL, &mupdate_h, NULL); if (r) { syslog(LOG_ERR, ""cannot connect to mupdate server for syncacl on '%s'"", name); } else { r = mupdate_activate(mupdate_h, name, buf, newacl); if(r) { syslog(LOG_ERR, ""MUPDATE: can't update mailbox entry for '%s'"", name); } } mupdate_disconnect(&mupdate_h); } if (r && tid) { /* if we are mid-transaction, abort it! */ int r2 = cyrusdb_abort(mbdb, tid); if (r2) { syslog(LOG_ERR, ""DBERROR: error aborting txn in sync_setacls %s: %s"", name, cyrusdb_strerror(r2)); } } mboxlist_entry_free(&mbentry); return r; } ",0 "SProcXvStopVideo(ClientPtr client) { REQUEST(xvStopVideoReq); REQUEST_SIZE_MATCH(xvStopVideoReq); swaps(&stuff->length); swapl(&stuff->port); swapl(&stuff->drawable); return XvProcVector[xv_StopVideo] (client); } ",0 "bool JSTestInterface::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) { JSTestInterface* thisObject = jsCast(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info); return getStaticValueSlot(exec, &JSTestInterfaceTable, thisObject, propertyName, slot); } ",0 "void DevToolsUIBindings::AddFileSystem(const std::string& file_system_path) { CHECK(web_contents_->GetURL().SchemeIs(content::kChromeDevToolsScheme)); file_helper_->AddFileSystem( file_system_path, base::Bind(&DevToolsUIBindings::ShowDevToolsConfirmInfoBar, weak_factory_.GetWeakPtr())); } ",0 "static inline int is_real_num_char(int c) { return (c >= '0' && c <= '9') || c == 'e' || c == 'E' || c == '+' || c == '-' || c == '.'; } ",0 " void WaitUntilReceivedGesture(ui::EventType type) { wait_until_event_ = type; run_loop_.reset(new base::RunLoop()); run_loop_->Run(); } ",0 "void install_exec_creds(struct linux_binprm *bprm) { security_bprm_committing_creds(bprm); commit_creds(bprm->cred); bprm->cred = NULL; /* * Disable monitoring for regular users * when executing setuid binaries. Must * wait until new credentials are committed * by commit_creds() above */ if (get_dumpable(current->mm) != SUID_DUMP_USER) perf_event_exit_task(current); /* * cred_guard_mutex must be held at least to this point to prevent * ptrace_attach() from altering our determination of the task's * credentials; any time after this it may be unlocked. */ security_bprm_committed_creds(bprm); mutex_unlock(¤t->signal->cred_guard_mutex); } ",0 "void NetworkScreen::StopWaitingForConnection(const string16& network_id) { NetworkLibrary* network = CrosLibrary::Get()->GetNetworkLibrary(); bool is_connected = network && network->Connected(); if (is_connected && continue_pressed_) { NotifyOnConnection(); return; } continue_pressed_ = false; connection_timer_.Stop(); network_id_ = network_id; view()->ShowConnectingStatus(false, network_id_); view()->EnableContinue(is_connected); } ",0 "static int __net_init icmpv6_sk_init(struct net *net) { struct sock *sk; int err, i, j; net->ipv6.icmp_sk = kzalloc(nr_cpu_ids * sizeof(struct sock *), GFP_KERNEL); if (!net->ipv6.icmp_sk) return -ENOMEM; for_each_possible_cpu(i) { err = inet_ctl_sock_create(&sk, PF_INET6, SOCK_RAW, IPPROTO_ICMPV6, net); if (err < 0) { pr_err(""Failed to initialize the ICMP6 control socket (err %d)\n"", err); goto fail; } net->ipv6.icmp_sk[i] = sk; /* Enough space for 2 64K ICMP packets, including * sk_buff struct overhead. */ sk->sk_sndbuf = 2 * SKB_TRUESIZE(64 * 1024); } return 0; fail: for (j = 0; j < i; j++) inet_ctl_sock_destroy(net->ipv6.icmp_sk[j]); kfree(net->ipv6.icmp_sk); return err; } ",0 "int is_subdir(struct dentry *new_dentry, struct dentry *old_dentry) { int result; unsigned seq; if (new_dentry == old_dentry) return 1; do { /* for restarting inner loop in case of seq retry */ seq = read_seqbegin(&rename_lock); /* * Need rcu_readlock to protect against the d_parent trashing * due to d_move */ rcu_read_lock(); if (d_ancestor(old_dentry, new_dentry)) result = 1; else result = 0; rcu_read_unlock(); } while (read_seqretry(&rename_lock, seq)); return result; } ",0 "static inline void namespace_lock(void) { down_write(&namespace_sem); } ",0 "static void ucma_close_id(struct work_struct *work) { struct ucma_context *ctx = container_of(work, struct ucma_context, close_work); /* once all inflight tasks are finished, we close all underlying * resources. The context is still alive till its explicit destryoing * by its creator. */ ucma_put_ctx(ctx); wait_for_completion(&ctx->comp); /* No new events will be generated after destroying the id. */ rdma_destroy_id(ctx->cm_id); } ",0 "void GLES2DecoderImpl::UpdateParentTextureInfo() { if (parent_) { TextureManager* parent_texture_manager = parent_->texture_manager(); parent_texture_manager->SetLevelInfo( offscreen_saved_color_texture_info_, GL_TEXTURE_2D, 0, // level GL_RGBA, offscreen_size_.width(), offscreen_size_.height(), 1, // depth 0, // border GL_RGBA, GL_UNSIGNED_BYTE, true); parent_texture_manager->SetParameter( offscreen_saved_color_texture_info_, GL_TEXTURE_MAG_FILTER, GL_NEAREST); parent_texture_manager->SetParameter( offscreen_saved_color_texture_info_, GL_TEXTURE_MIN_FILTER, GL_NEAREST); parent_texture_manager->SetParameter( offscreen_saved_color_texture_info_, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); parent_texture_manager->SetParameter( offscreen_saved_color_texture_info_, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); } else { offscreen_saved_color_texture_info_ = NULL; } } ",0 "status_t MPEG4Extractor::readMetaData() { if (mInitCheck != NO_INIT) { return mInitCheck; } off64_t offset = 0; status_t err; bool sawMoovOrSidx = false; while (!(sawMoovOrSidx && (mMdatFound || mMoofFound))) { off64_t orig_offset = offset; err = parseChunk(&offset, 0); if (err != OK && err != UNKNOWN_ERROR) { break; } else if (offset <= orig_offset) { ALOGE(""did not advance: %lld->%lld"", (long long)orig_offset, (long long)offset); err = ERROR_MALFORMED; break; } else if (err == UNKNOWN_ERROR) { sawMoovOrSidx = true; } } if (mInitCheck == OK) { if (mHasVideo) { mFileMetaData->setCString( kKeyMIMEType, MEDIA_MIMETYPE_CONTAINER_MPEG4); } else { mFileMetaData->setCString(kKeyMIMEType, ""audio/mp4""); } } else { mInitCheck = err; } CHECK_NE(err, (status_t)NO_INIT); uint64_t psshsize = 0; for (size_t i = 0; i < mPssh.size(); i++) { psshsize += 20 + mPssh[i].datalen; } if (psshsize > 0 && psshsize <= UINT32_MAX) { char *buf = (char*)malloc(psshsize); char *ptr = buf; for (size_t i = 0; i < mPssh.size(); i++) { memcpy(ptr, mPssh[i].uuid, 20); // uuid + length memcpy(ptr + 20, mPssh[i].data, mPssh[i].datalen); ptr += (20 + mPssh[i].datalen); } mFileMetaData->setData(kKeyPssh, 'pssh', buf, psshsize); free(buf); } return mInitCheck; } ",1 "bool Document::allowInlineEventHandler(Node* node, EventListener* listener, const String& contextURL, const WTF::OrdinalNumber& contextLine) { if (!ContentSecurityPolicy::shouldBypassMainWorld(this) && !contentSecurityPolicy()->allowInlineEventHandler(listener->code(), contextURL, contextLine)) return false; LocalFrame* frame = executingFrame(); if (!frame) return false; if (!frame->script().canExecuteScripts(NotAboutToExecuteScript)) return false; if (node && node->document() != this && !node->document().allowInlineEventHandler(node, listener, contextURL, contextLine)) return false; return true; } ",0 "sctp_disposition_t sctp_sf_shutdown_sent_abort(struct net *net, const struct sctp_endpoint *ep, const struct sctp_association *asoc, const sctp_subtype_t type, void *arg, sctp_cmd_seq_t *commands) { struct sctp_chunk *chunk = arg; if (!sctp_vtag_verify_either(chunk, asoc)) return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); /* Make sure that the ABORT chunk has a valid length. * Since this is an ABORT chunk, we have to discard it * because of the following text: * RFC 2960, Section 3.3.7 * If an endpoint receives an ABORT with a format error or for an * association that doesn't exist, it MUST silently discard it. * Because the length is ""invalid"", we can't really discard just * as we do not know its true length. So, to be safe, discard the * packet. */ if (!sctp_chunk_length_valid(chunk, sizeof(sctp_abort_chunk_t))) return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); /* ADD-IP: Special case for ABORT chunks * F4) One special consideration is that ABORT Chunks arriving * destined to the IP address being deleted MUST be * ignored (see Section 5.3.1 for further details). */ if (SCTP_ADDR_DEL == sctp_bind_addr_state(&asoc->base.bind_addr, &chunk->dest)) return sctp_sf_discard_chunk(net, ep, asoc, type, arg, commands); /* Stop the T2-shutdown timer. */ sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP, SCTP_TO(SCTP_EVENT_TIMEOUT_T2_SHUTDOWN)); /* Stop the T5-shutdown guard timer. */ sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP, SCTP_TO(SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD)); return __sctp_sf_do_9_1_abort(net, ep, asoc, type, arg, commands); } ",0 "bool DefaultTabHandler::CanRestoreTab() { return delegate_->AsBrowser()->CanRestoreTab(); } ",0 "std::unique_ptr CreateMediaService() { return std::unique_ptr( new ::media::MediaService(base::MakeUnique())); } ",1 "void OnEncodingInfoError( std::unique_ptr callbacks) { callbacks->OnError(); } ",0 "DWORD SetObjectIntegrityLabel(HANDLE handle, SE_OBJECT_TYPE type, const wchar_t* ace_access, const wchar_t* integrity_level_sid) { std::wstring sddl = L""S:(""; // SDDL for a SACL. sddl += SDDL_MANDATORY_LABEL; // Ace Type is ""Mandatory Label"". sddl += L"";;""; // No Ace Flags. sddl += ace_access; // Add the ACE access. sddl += L"";;;""; // No ObjectType and Inherited Object Type. sddl += integrity_level_sid; // Trustee Sid. sddl += L"")""; DWORD error = ERROR_SUCCESS; PSECURITY_DESCRIPTOR sec_desc = NULL; PACL sacl = NULL; BOOL sacl_present = FALSE; BOOL sacl_defaulted = FALSE; if (::ConvertStringSecurityDescriptorToSecurityDescriptorW(sddl.c_str(), SDDL_REVISION, &sec_desc, NULL)) { if (::GetSecurityDescriptorSacl(sec_desc, &sacl_present, &sacl, &sacl_defaulted)) { error = ::SetSecurityInfo(handle, type, LABEL_SECURITY_INFORMATION, NULL, NULL, NULL, sacl); } else { error = ::GetLastError(); } ::LocalFree(sec_desc); } else { return::GetLastError(); } return error; } ",0 " static void HandleCrash(int signo, siginfo_t* siginfo, void* context) { SandboxedHandler* state = Get(); state->HandleCrashNonFatal(signo, siginfo, context); Signals::RestoreHandlerAndReraiseSignalOnReturn( siginfo, state->old_actions_.ActionForSignal(signo)); } ",0 "int is_mem_section_removable(unsigned long start_pfn, unsigned long nr_pages) { struct page *page = pfn_to_page(start_pfn); struct page *end_page = page + nr_pages; /* Check the starting page of each pageblock within the range */ for (; page < end_page; page = next_active_pageblock(page)) { if (!is_pageblock_removable_nolock(page)) return 0; cond_resched(); } /* All pageblocks in the memory block are likely to be hot-removable */ return 1; } ",0 "static void out_string(conn *c, const char *str) { size_t len; assert(c != NULL); if (c->noreply) { if (settings.verbose > 1) fprintf(stderr, "">%d NOREPLY %s\n"", c->sfd, str); c->noreply = false; conn_set_state(c, conn_new_cmd); return; } if (settings.verbose > 1) fprintf(stderr, "">%d %s\n"", c->sfd, str); len = strlen(str); if ((len + 2) > c->wsize) { /* ought to be always enough. just fail for simplicity */ str = ""SERVER_ERROR output line too long""; len = strlen(str); } memcpy(c->wbuf, str, len); memcpy(c->wbuf + len, ""\r\n"", 2); c->wbytes = len + 2; c->wcurr = c->wbuf; conn_set_state(c, conn_write); c->write_and_go = conn_new_cmd; return; } ",0 "void LayerTreeHostImpl::DidChangeScrollbarVisibility() { client_->SetNeedsCommitOnImplThread(); } ",0 " PendingWallpaper(const base::TimeDelta delay, const AccountId& account_id) : account_id_(account_id), default_(false), on_finish_(new MovableOnDestroyCallback( base::Bind(&WallpaperManager::PendingWallpaper::OnWallpaperSet, this))) { timer.Start( FROM_HERE, delay, base::Bind(&WallpaperManager::PendingWallpaper::ProcessRequest, this)); } ",0 "void WriteVirtIODeviceByte(ULONG_PTR ulRegister, u8 bValue) { DPrintf(6, (""[%s]R[%x]=%x\n"", __FUNCTION__, (ULONG)ulRegister, bValue) ); NdisRawWritePortUchar(ulRegister, bValue); } ",0 "static int irda_open_lsap(struct irda_sock *self, int pid) { notify_t notify; if (self->lsap) { net_warn_ratelimited(""%s(), busy!\n"", __func__); return -EBUSY; } /* Initialize callbacks to be used by the IrDA stack */ irda_notify_init(¬ify); notify.udata_indication = irda_data_indication; notify.instance = self; strncpy(notify.name, ""Ultra"", NOTIFY_MAX_NAME); self->lsap = irlmp_open_lsap(LSAP_CONNLESS, ¬ify, pid); if (self->lsap == NULL) { pr_debug(""%s(), Unable to allocate LSAP!\n"", __func__); return -ENOMEM; } return 0; } ",0 "vbf_stp_condfetch(struct worker *wrk, struct busyobj *bo) { CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); AZ(vbf_beresp2obj(bo)); if (ObjHasAttr(bo->wrk, bo->stale_oc, OA_ESIDATA)) AZ(ObjCopyAttr(bo->wrk, bo->fetch_objcore, bo->stale_oc, OA_ESIDATA)); AZ(ObjCopyAttr(bo->wrk, bo->fetch_objcore, bo->stale_oc, OA_FLAGS)); AZ(ObjCopyAttr(bo->wrk, bo->fetch_objcore, bo->stale_oc, OA_GZIPBITS)); if (bo->do_stream) { ObjSetState(wrk, bo->fetch_objcore, BOS_PREP_STREAM); HSH_Unbusy(wrk, bo->fetch_objcore); ObjSetState(wrk, bo->fetch_objcore, BOS_STREAM); } if (ObjIterate(wrk, bo->stale_oc, bo, vbf_objiterator, 0)) (void)VFP_Error(bo->vfc, ""Template object failed""); if (bo->stale_oc->flags & OC_F_FAILED) (void)VFP_Error(bo->vfc, ""Template object failed""); if (bo->vfc->failed) { VDI_Finish(bo->wrk, bo); wrk->stats->fetch_failed++; return (F_STP_FAIL); } return (F_STP_FETCHEND); } ",0 "static void rb_wake_up_waiters(struct irq_work *work) { struct rb_irq_work *rbwork = container_of(work, struct rb_irq_work, work); wake_up_all(&rbwork->waiters); if (rbwork->wakeup_full) { rbwork->wakeup_full = false; wake_up_all(&rbwork->full_waiters); } } ",0 "nbt_udp138_print(netdissect_options *ndo, const u_char *data, int length) { const u_char *maxbuf = data + length; if (maxbuf > ndo->ndo_snapend) maxbuf = ndo->ndo_snapend; if (maxbuf <= data) return; startbuf = data; if (ndo->ndo_vflag < 2) { ND_PRINT((ndo, ""NBT UDP PACKET(138)"")); return; } data = smb_fdata(ndo, data, ""\n>>> NBT UDP PACKET(138) Res=[rw] ID=[rw] IP=[b.b.b.b] Port=[rd] Length=[rd] Res2=[rw]\nSourceName=[n1]\nDestName=[n1]\n#"", maxbuf, 0); if (data != NULL) { /* If there isn't enough data for ""\377SMB"", don't check for it. */ if (&data[3] >= maxbuf) goto out; if (memcmp(data, ""\377SMB"",4) == 0) print_smb(ndo, data, maxbuf); } out: ND_PRINT((ndo, ""\n"")); } ",0 "void sock_tx_timestamp(struct sock *sk, __u8 *tx_flags) { *tx_flags = 0; if (sock_flag(sk, SOCK_TIMESTAMPING_TX_HARDWARE)) *tx_flags |= SKBTX_HW_TSTAMP; if (sock_flag(sk, SOCK_TIMESTAMPING_TX_SOFTWARE)) *tx_flags |= SKBTX_SW_TSTAMP; if (sock_flag(sk, SOCK_WIFI_STATUS)) *tx_flags |= SKBTX_WIFI_STATUS; } ",0 "PHP_FUNCTION(mb_ereg_search_getpos) { RETVAL_LONG(MBREX(search_pos)); } ",0 "int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event * ev, int atomic, int hop) { return kernel_client_enqueue(client, ev, NULL, 0, atomic, hop); } ",0 "void QuotaThreadTask::Run() { target_task_runner_->PostTask( FROM_HERE, base::Bind(&QuotaThreadTask::CallRunOnTargetThread, this)); } ",0 "static inline uint16_t vring_avail_flags(VirtQueue *vq) { hwaddr pa; pa = vq->vring.avail + offsetof(VRingAvail, flags); return virtio_lduw_phys(vq->vdev, pa); } ",0 "void Tags::SimpleTag::Clear() { delete[] m_tag_name; m_tag_name = NULL; delete[] m_tag_string; m_tag_string = NULL; } ",0 "void dev_remove_offload(struct packet_offload *po) { __dev_remove_offload(po); synchronize_net(); } ",0 "void hashbin_insert(hashbin_t* hashbin, irda_queue_t* entry, long hashv, const char* name) { unsigned long flags = 0; int bin; IRDA_ASSERT( hashbin != NULL, return;); IRDA_ASSERT( hashbin->magic == HB_MAGIC, return;); /* * Locate hashbin */ if ( name ) hashv = hash( name ); bin = GET_HASHBIN( hashv ); /* Synchronize */ if ( hashbin->hb_type & HB_LOCK ) { spin_lock_irqsave(&hashbin->hb_spinlock, flags); } /* Default is no-lock */ /* * Store name and key */ entry->q_hash = hashv; if ( name ) strlcpy( entry->q_name, name, sizeof(entry->q_name)); /* * Insert new entry first */ enqueue_first( (irda_queue_t**) &hashbin->hb_queue[ bin ], entry); hashbin->hb_size++; /* Release lock */ if ( hashbin->hb_type & HB_LOCK ) { spin_unlock_irqrestore(&hashbin->hb_spinlock, flags); } /* Default is no-lock */ } ",0 "bool ChromeDownloadManagerDelegate::DetermineDownloadTarget( DownloadItem* download, const content::DownloadTargetCallback& callback) { if (download->GetTargetFilePath().empty() && download->GetMimeType() == kPDFMimeType && !download->HasUserGesture()) { ReportPDFLoadStatus(PDFLoadStatus::kTriggeredNoGestureDriveByDownload); } DownloadTargetDeterminer::CompletionCallback target_determined_callback = base::Bind(&ChromeDownloadManagerDelegate::OnDownloadTargetDetermined, weak_ptr_factory_.GetWeakPtr(), download->GetId(), callback); DownloadTargetDeterminer::Start( download, GetPlatformDownloadPath(profile_, download, PLATFORM_TARGET_PATH), kDefaultPlatformConflictAction, download_prefs_.get(), this, target_determined_callback); return true; } ",0 "evutil_hex_char_to_int_(char c) { switch(c) { case '0': return 0; case '1': return 1; case '2': return 2; case '3': return 3; case '4': return 4; case '5': return 5; case '6': return 6; case '7': return 7; case '8': return 8; case '9': return 9; case 'A': case 'a': return 10; case 'B': case 'b': return 11; case 'C': case 'c': return 12; case 'D': case 'd': return 13; case 'E': case 'e': return 14; case 'F': case 'f': return 15; } return -1; } ",0 "void SystemKeyEventListener::OnBrightnessDown() { DBusThreadManager::Get()->GetPowerManagerClient()-> DecreaseScreenBrightness(true); } ",0 "is_kerb_mech(gss_OID oid) { int answer = 0; OM_uint32 minor; extern const gss_OID_set_desc * const gss_mech_set_krb5_both; (void) gss_test_oid_set_member(&minor, oid, (gss_OID_set)gss_mech_set_krb5_both, &answer); return (answer); } ",0 "void SupervisedUserService::AddExtensionInstallRequest( const std::string& extension_id, const base::Version& version, SuccessCallback callback) { std::string id = GetExtensionRequestId(extension_id, version); AddPermissionRequestInternal( base::BindRepeating(CreateExtensionInstallRequest, id), std::move(callback), 0); } ",0 "sf_writef_int (SNDFILE *sndfile, const int *ptr, sf_count_t frames) { SF_PRIVATE *psf ; sf_count_t count ; VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ; if (psf->file.mode == SFM_READ) { psf->error = SFE_NOT_WRITEMODE ; return 0 ; } ; if (psf->write_int == NULL || psf->seek == NULL) { psf->error = SFE_UNIMPLEMENTED ; return 0 ; } ; if (psf->last_op != SFM_WRITE) if (psf->seek (psf, SFM_WRITE, psf->write_current) < 0) return 0 ; if (psf->have_written == SF_FALSE && psf->write_header != NULL) psf->write_header (psf, SF_FALSE) ; psf->have_written = SF_TRUE ; count = psf->write_int (psf, ptr, frames * psf->sf.channels) ; psf->write_current += count / psf->sf.channels ; psf->last_op = SFM_WRITE ; if (psf->write_current > psf->sf.frames) { psf->sf.frames = psf->write_current ; psf->dataend = 0 ; } ; if (psf->auto_header && psf->write_header != NULL) psf->write_header (psf, SF_TRUE) ; return count / psf->sf.channels ; } /* sf_writef_int */ ",0 "static int http_transform_header(struct session* s, struct http_msg *msg, const char* name, uint name_len, char* buf, struct hdr_idx* idx, struct list *fmt, struct my_regex *re, struct hdr_ctx* ctx, int action) { ctx->idx = 0; while (http_find_full_header2(name, name_len, buf, idx, ctx)) { struct hdr_idx_elem *hdr = idx->v + ctx->idx; int delta; char* val = (char*)ctx->line + name_len + 2; char* val_end = (char*)ctx->line + hdr->len; char* reg_dst_buf; uint reg_dst_buf_size; int n_replaced; trash.len = build_logline(s, trash.str, trash.size, fmt); if (trash.len >= trash.size - 1) return -1; reg_dst_buf = trash.str + trash.len + 1; reg_dst_buf_size = trash.size - trash.len - 1; switch (action) { case HTTP_REQ_ACT_REPLACE_VAL: case HTTP_RES_ACT_REPLACE_VAL: n_replaced = http_replace_value(re, reg_dst_buf, reg_dst_buf_size, val, val_end-val, ',', trash.str); break; case HTTP_REQ_ACT_REPLACE_HDR: case HTTP_RES_ACT_REPLACE_HDR: n_replaced = http_replace_header(re, reg_dst_buf, reg_dst_buf_size, val, val_end-val, trash.str); break; default: /* impossible */ return -1; } switch (n_replaced) { case -1: return -1; case -2: continue; } delta = buffer_replace2(msg->chn->buf, val, val_end, reg_dst_buf, n_replaced); hdr->len += delta; http_msg_move_end(msg, delta); } return 0; } ",0 "OutOfProcessInstance::~OutOfProcessInstance() { RemovePerInstanceObject(kPPPPdfInterface, this); engine_.reset(); } ",0 "bool DevToolsDataSource::ShouldServeMimeTypeAsContentTypeHeader() const { return true; } ",0 "void rtp_hnti_del(GF_Box *s) { GF_RTPBox *ptr = (GF_RTPBox *)s; if (ptr->sdpText) gf_free(ptr->sdpText); gf_free(ptr); } ",0 "RootInlineBox* RenderBlockFlow::createRootInlineBox() { return new RootInlineBox(*this); } ",0 " void GenerateEvents(aura::Window* window) { ui::test::EventGenerator event_generator(Shell::GetPrimaryRootWindow(), window); event_generator.ClickLeftButton(); event_generator.ScrollSequence(window->bounds().CenterPoint(), base::TimeDelta(), 0, 10, 1, 2); event_generator.PressTouch(); event_generator.ReleaseTouch(); event_generator.GestureTapAt(window->bounds().CenterPoint()); } ",0 "static void sk_prot_free(struct proto *prot, struct sock *sk) { struct kmem_cache *slab; struct module *owner; owner = prot->owner; slab = prot->slab; cgroup_sk_free(&sk->sk_cgrp_data); mem_cgroup_sk_free(sk); security_sk_free(sk); if (slab != NULL) kmem_cache_free(slab, sk); else kfree(sk); module_put(owner); } ",0 "static struct sk_buff *igmpv3_newpack(struct net_device *dev, int size) { struct sk_buff *skb; struct rtable *rt; struct iphdr *pip; struct igmpv3_report *pig; struct net *net = dev_net(dev); struct flowi4 fl4; while (1) { skb = alloc_skb(size + LL_ALLOCATED_SPACE(dev), GFP_ATOMIC | __GFP_NOWARN); if (skb) break; size >>= 1; if (size < 256) return NULL; } igmp_skb_size(skb) = size; rt = ip_route_output_ports(net, &fl4, NULL, IGMPV3_ALL_MCR, 0, 0, 0, IPPROTO_IGMP, 0, dev->ifindex); if (IS_ERR(rt)) { kfree_skb(skb); return NULL; } skb_dst_set(skb, &rt->dst); skb->dev = dev; skb_reserve(skb, LL_RESERVED_SPACE(dev)); skb_reset_network_header(skb); pip = ip_hdr(skb); skb_put(skb, sizeof(struct iphdr) + 4); pip->version = 4; pip->ihl = (sizeof(struct iphdr)+4)>>2; pip->tos = 0xc0; pip->frag_off = htons(IP_DF); pip->ttl = 1; pip->daddr = fl4.daddr; pip->saddr = fl4.saddr; pip->protocol = IPPROTO_IGMP; pip->tot_len = 0; /* filled in later */ ip_select_ident(pip, &rt->dst, NULL); ((u8*)&pip[1])[0] = IPOPT_RA; ((u8*)&pip[1])[1] = 4; ((u8*)&pip[1])[2] = 0; ((u8*)&pip[1])[3] = 0; skb->transport_header = skb->network_header + sizeof(struct iphdr) + 4; skb_put(skb, sizeof(*pig)); pig = igmpv3_report_hdr(skb); pig->type = IGMPV3_HOST_MEMBERSHIP_REPORT; pig->resv1 = 0; pig->csum = 0; pig->resv2 = 0; pig->ngrec = 0; return skb; } ",0 "read_graphic_control_extension(Gif_Context *gfc, Gif_Image *gfi, Gif_Reader *grr) { uint8_t len; uint8_t crap[GIF_MAX_BLOCK]; len = gifgetbyte(grr); if (len == 4) { uint8_t packed = gifgetbyte(grr); gfi->disposal = (packed >> 2) & 0x07; gfi->delay = gifgetunsigned(grr); gfi->transparent = gifgetbyte(grr); if (!(packed & 0x01)) /* transparent color doesn't exist */ gfi->transparent = -1; len -= 4; } if (len > 0) { gif_read_error(gfc, 1, ""bad graphic extension""); gifgetblock(crap, len, grr); } len = gifgetbyte(grr); while (len > 0) { gif_read_error(gfc, 1, ""bad graphic extension""); gifgetblock(crap, len, grr); len = gifgetbyte(grr); } } ",0 "void ExtensionService::AddExtension(const Extension* extension) { scoped_refptr scoped_extension(extension); if (!extensions_enabled() && !extension->is_theme() && extension->location() != Extension::COMPONENT && !Extension::IsExternalLocation(extension->location())) return; SetBeingUpgraded(extension, false); unloaded_extension_paths_.erase(extension->id()); UntrackTerminatedExtension(extension->id()); if (disabled_extension_paths_.erase(extension->id()) > 0) EnableExtension(extension->id()); DisableIfPrivilegeIncrease(extension); Extension::State state = extension_prefs_->GetExtensionState(extension->id()); if (state == Extension::DISABLED) { disabled_extensions_.push_back(scoped_extension); NotificationService::current()->Notify( NotificationType::EXTENSION_UPDATE_DISABLED, Source(profile_), Details(extension)); return; } CHECK(state == Extension::ENABLED); extensions_.push_back(scoped_extension); NotifyExtensionLoaded(extension); } ",0 "bool IsEvictableError(AppCacheUpdateJob::ResultType result, const AppCacheErrorDetails& details) { switch (result) { case AppCacheUpdateJob::DB_ERROR: case AppCacheUpdateJob::DISKCACHE_ERROR: case AppCacheUpdateJob::QUOTA_ERROR: case AppCacheUpdateJob::NETWORK_ERROR: case AppCacheUpdateJob::CANCELLED_ERROR: return false; case AppCacheUpdateJob::REDIRECT_ERROR: case AppCacheUpdateJob::SERVER_ERROR: case AppCacheUpdateJob::SECURITY_ERROR: return true; case AppCacheUpdateJob::MANIFEST_ERROR: return details.reason == APPCACHE_SIGNATURE_ERROR; default: NOTREACHED(); return true; } } ",0 "bool ChangeWindowDesktop(XID window, XID destination) { int desktop; if (!GetWindowDesktop(destination, &desktop)) return false; if (desktop == kAllDesktops && !GetCurrentDesktop(&desktop)) return false; XEvent event; event.xclient.type = ClientMessage; event.xclient.window = window; event.xclient.message_type = GetAtom(""_NET_WM_DESKTOP""); event.xclient.format = 32; event.xclient.data.l[0] = desktop; event.xclient.data.l[1] = 1; // source indication int result = XSendEvent(GetXDisplay(), GetX11RootWindow(), False, SubstructureNotifyMask, &event); return result == Success; } ",0 "int ldsem_down_read_trylock(struct ld_semaphore *sem) { long count = sem->count; while (count >= 0) { if (ldsem_cmpxchg(&count, count + LDSEM_READ_BIAS, sem)) { lockdep_acquire_read(sem, 0, 1, _RET_IP_); lock_stat(sem, acquired); return 1; } } return 0; } ",0 "static int jpc_sot_getparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *in) { jpc_sot_t *sot = &ms->parms.sot; /* Eliminate compiler warning about unused variables. */ cstate = 0; if (jpc_getuint16(in, &sot->tileno) || jpc_getuint32(in, &sot->len) || jpc_getuint8(in, &sot->partno) || jpc_getuint8(in, &sot->numparts)) { return -1; } if (sot->tileno > 65534 || sot->len < 12 || sot->partno > 254 || sot->numparts < 1 || sot->numparts > 255) { return -1; } if (jas_stream_eof(in)) { return -1; } return 0; } ",0 "static inline struct vmcb *get_host_vmcb(struct vcpu_svm *svm) { if (is_guest_mode(&svm->vcpu)) return svm->nested.hsave; else return svm->vmcb; } ",0 "static bool tcp_try_coalesce(struct sock *sk, struct sk_buff *to, struct sk_buff *from, bool *fragstolen) { int delta; *fragstolen = false; /* Its possible this segment overlaps with prior segment in queue */ if (TCP_SKB_CB(from)->seq != TCP_SKB_CB(to)->end_seq) return false; if (!skb_try_coalesce(to, from, fragstolen, &delta)) return false; atomic_add(delta, &sk->sk_rmem_alloc); sk_mem_charge(sk, delta); NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPRCVCOALESCE); TCP_SKB_CB(to)->end_seq = TCP_SKB_CB(from)->end_seq; TCP_SKB_CB(to)->ack_seq = TCP_SKB_CB(from)->ack_seq; TCP_SKB_CB(to)->tcp_flags |= TCP_SKB_CB(from)->tcp_flags; return true; } ",0 "static sector_t fuse_bmap(struct address_space *mapping, sector_t block) { struct inode *inode = mapping->host; struct fuse_conn *fc = get_fuse_conn(inode); struct fuse_req *req; struct fuse_bmap_in inarg; struct fuse_bmap_out outarg; int err; if (!inode->i_sb->s_bdev || fc->no_bmap) return 0; req = fuse_get_req(fc); if (IS_ERR(req)) return 0; memset(&inarg, 0, sizeof(inarg)); inarg.block = block; inarg.blocksize = inode->i_sb->s_blocksize; req->in.h.opcode = FUSE_BMAP; req->in.h.nodeid = get_node_id(inode); req->in.numargs = 1; req->in.args[0].size = sizeof(inarg); req->in.args[0].value = &inarg; req->out.numargs = 1; req->out.args[0].size = sizeof(outarg); req->out.args[0].value = &outarg; fuse_request_send(fc, req); err = req->out.h.error; fuse_put_request(fc, req); if (err == -ENOSYS) fc->no_bmap = 1; return err ? 0 : outarg.block; } ",0 "ModuleExport size_t RegisterGIFImage(void) { MagickInfo *entry; entry=AcquireMagickInfo(""GIF"",""GIF"", ""CompuServe graphics interchange format""); entry->decoder=(DecodeImageHandler *) ReadGIFImage; entry->encoder=(EncodeImageHandler *) WriteGIFImage; entry->magick=(IsImageFormatHandler *) IsGIF; entry->mime_type=ConstantString(""image/gif""); (void) RegisterMagickInfo(entry); entry=AcquireMagickInfo(""GIF"",""GIF87"", ""CompuServe graphics interchange format""); entry->decoder=(DecodeImageHandler *) ReadGIFImage; entry->encoder=(EncodeImageHandler *) WriteGIFImage; entry->magick=(IsImageFormatHandler *) IsGIF; entry->flags^=CoderAdjoinFlag; entry->version=ConstantString(""version 87a""); entry->mime_type=ConstantString(""image/gif""); (void) RegisterMagickInfo(entry); return(MagickImageCoderSignature); } ",0 "static int emulator_write_emulated(struct x86_emulate_ctxt *ctxt, unsigned long addr, const void *val, unsigned int bytes, struct x86_exception *exception) { return emulator_read_write(ctxt, addr, (void *)val, bytes, exception, &write_emultor); } ",0 "bool HTMLInputElement::hasCustomFocusLogic() const { return m_inputType->hasCustomFocusLogic(); } ",0 "gst_vmnc_dec_handle_frame (GstVideoDecoder * decoder, GstVideoCodecFrame * frame) { GstVMncDec *dec = GST_VMNC_DEC (decoder); int res; GstFlowReturn ret = GST_FLOW_OK; GstMapInfo map; if (!gst_buffer_map (frame->input_buffer, &map, GST_MAP_READ)) return GST_FLOW_ERROR; res = vmnc_handle_packet (dec, map.data, map.size, TRUE); gst_buffer_unmap (frame->input_buffer, &map); if (!dec->have_format) { GST_VIDEO_DECODER_ERROR (decoder, 2, STREAM, DECODE, (NULL), (""Data found before header""), ret); gst_video_decoder_drop_frame (decoder, frame); } else if (res < 0) { ret = GST_FLOW_ERROR; gst_video_decoder_drop_frame (decoder, frame); GST_VIDEO_DECODER_ERROR (decoder, 1, STREAM, DECODE, (NULL), (""Couldn't decode packet""), ret); } else { GST_LOG_OBJECT (dec, ""read %d bytes of %"" G_GSIZE_FORMAT, res, gst_buffer_get_size (frame->input_buffer)); /* inbuf may be NULL; that's ok */ ret = vmnc_fill_buffer (dec, frame); if (ret == GST_FLOW_OK) gst_video_decoder_finish_frame (decoder, frame); else gst_video_decoder_drop_frame (decoder, frame); } return ret; } ",0 "log2vis_encoded_string (PyObject * string, const char *encoding, FriBidiParType base_direction, int clean, int reordernsm) { PyObject *logical = NULL; /* logical unicode object */ PyObject *result = NULL; /* output string object */ /* Always needed for the string length */ logical = PyUnicode_Decode (PyString_AS_STRING (string), PyString_GET_SIZE (string), encoding, ""strict""); if (logical == NULL) return NULL; if (strcmp (encoding, ""utf-8"") == 0) /* Shortcut for utf8 strings (little faster) */ result = log2vis_utf8 (string, PyUnicode_GET_SIZE (logical), base_direction, clean, reordernsm); else { /* Invoke log2vis_unicode and encode back to encoding */ PyObject *visual = log2vis_unicode (logical, base_direction, clean, reordernsm); if (visual) { result = PyUnicode_Encode (PyUnicode_AS_UNICODE (visual), PyUnicode_GET_SIZE (visual), encoding, ""strict""); Py_DECREF (visual); } } Py_DECREF (logical); return result; } ",1 "static inline int is_x86_event(struct perf_event *event) { return event->pmu == &pmu; } ",0 "static void leave_lazy(enum paravirt_lazy_mode mode) { BUG_ON(this_cpu_read(paravirt_lazy_mode) != mode); this_cpu_write(paravirt_lazy_mode, PARAVIRT_LAZY_NONE); } ",0 "static uint32 GetFineLinearSlideDownTable(const CSoundFile *sndFile, uint32 i) { MPT_ASSERT(i < CountOf(FineLinearSlideDownTable)); return sndFile->m_playBehaviour[kHertzInLinearMode] ? FineLinearSlideDownTable[i] : FineLinearSlideUpTable[i]; } ",0 "static const char *parse_value(cJSON *item,const char *value,const char **ep) { if (!value) return 0; /* Fail on null. */ if (!strncmp(value,""null"",4)) { item->type=cJSON_NULL; return value+4; } if (!strncmp(value,""false"",5)) { item->type=cJSON_False; return value+5; } if (!strncmp(value,""true"",4)) { item->type=cJSON_True; item->valueint=1; return value+4; } if (*value=='\""') { return parse_string(item,value,ep); } if (*value=='-' || (*value>='0' && *value<='9')) { return parse_number(item,value); } if (*value=='[') { return parse_array(item,value,ep); } if (*value=='{') { return parse_object(item,value,ep); } *ep=value;return 0; /* failure. */ } /* Render a value to text. */ static char *print_value(cJSON *item,int depth,int fmt,printbuffer *p) { char *out=0; if (!item) return 0; if (p) { switch ((item->type)&255) { case cJSON_NULL: {out=ensure(p,5); if (out) strcpy(out,""null""); break;} case cJSON_False: {out=ensure(p,6); if (out) strcpy(out,""false""); break;} case cJSON_True: {out=ensure(p,5); if (out) strcpy(out,""true""); break;} case cJSON_Number: out=print_number(item,p);break; case cJSON_String: out=print_string(item,p);break; case cJSON_Array: out=print_array(item,depth,fmt,p);break; case cJSON_Object: out=print_object(item,depth,fmt,p);break; } } else { switch ((item->type)&255) { case cJSON_NULL: out=cJSON_strdup(""null""); break; case cJSON_False: out=cJSON_strdup(""false"");break; case cJSON_True: out=cJSON_strdup(""true""); break; case cJSON_Number: out=print_number(item,0);break; case cJSON_String: out=print_string(item,0);break; case cJSON_Array: out=print_array(item,depth,fmt,0);break; case cJSON_Object: out=print_object(item,depth,fmt,0);break; } } return out; } /* Build an array from input text. */ static const char *parse_array(cJSON *item,const char *value,const char **ep) { cJSON *child; if (*value!='[') {*ep=value;return 0;} /* not an array! */ item->type=cJSON_Array; value=skip(value+1); if (*value==']') return value+1; /* empty array. */ item->child=child=cJSON_New_Item(); if (!item->child) return 0; /* memory fail */ value=skip(parse_value(child,skip(value),ep)); /* skip any spacing, get the value. */ if (!value) return 0; while (*value==',') { cJSON *new_item; if (!(new_item=cJSON_New_Item())) return 0; /* memory fail */ child->next=new_item;new_item->prev=child;child=new_item; value=skip(parse_value(child,skip(value+1),ep)); if (!value) return 0; /* memory fail */ } if (*value==']') return value+1; /* end of array */ *ep=value;return 0; /* malformed. */ } /* Render an array to text */ static char *print_array(cJSON *item,int depth,int fmt,printbuffer *p) { char **entries; char *out=0,*ptr,*ret;int len=5; cJSON *child=item->child; int numentries=0,i=0,fail=0; size_t tmplen=0; /* How many entries in the array? */ while (child) numentries++,child=child->next; /* Explicitly handle numentries==0 */ if (!numentries) { if (p) out=ensure(p,3); else out=(char*)cJSON_malloc(3); if (out) strcpy(out,""[]""); return out; } if (p) { /* Compose the output array. */ i=p->offset; ptr=ensure(p,1);if (!ptr) return 0; *ptr='['; p->offset++; child=item->child; while (child && !fail) { print_value(child,depth+1,fmt,p); p->offset=update(p); if (child->next) {len=fmt?2:1;ptr=ensure(p,len+1);if (!ptr) return 0;*ptr++=',';if(fmt)*ptr++=' ';*ptr=0;p->offset+=len;} child=child->next; } ptr=ensure(p,2);if (!ptr) return 0; *ptr++=']';*ptr=0; out=(p->buffer)+i; } else { /* Allocate an array to hold the values for each */ entries=(char**)cJSON_malloc(numentries*sizeof(char*)); if (!entries) return 0; memset(entries,0,numentries*sizeof(char*)); /* Retrieve all the results: */ child=item->child; while (child && !fail) { ret=print_value(child,depth+1,fmt,0); entries[i++]=ret; if (ret) len+=strlen(ret)+2+(fmt?1:0); else fail=1; child=child->next; } /* If we didn't fail, try to malloc the output string */ if (!fail) out=(char*)cJSON_malloc(len); /* If that fails, we fail. */ if (!out) fail=1; /* Handle failure. */ if (fail) { for (i=0;itype=cJSON_Object; value=skip(value+1); if (*value=='}') return value+1; /* empty array. */ item->child=child=cJSON_New_Item(); if (!item->child) return 0; value=skip(parse_string(child,skip(value),ep)); if (!value) return 0; child->string=child->valuestring;child->valuestring=0; if (*value!=':') {*ep=value;return 0;} /* fail! */ value=skip(parse_value(child,skip(value+1),ep)); /* skip any spacing, get the value. */ if (!value) return 0; while (*value==',') { cJSON *new_item; if (!(new_item=cJSON_New_Item())) return 0; /* memory fail */ child->next=new_item;new_item->prev=child;child=new_item; value=skip(parse_string(child,skip(value+1),ep)); if (!value) return 0; child->string=child->valuestring;child->valuestring=0; if (*value!=':') {*ep=value;return 0;} /* fail! */ value=skip(parse_value(child,skip(value+1),ep)); /* skip any spacing, get the value. */ if (!value) return 0; } if (*value=='}') return value+1; /* end of array */ *ep=value;return 0; /* malformed. */ } ",0 "SPL_METHOD(SplObjectStorage, current) { spl_SplObjectStorageElement *element; spl_SplObjectStorage *intern = Z_SPLOBJSTORAGE_P(getThis()); if (zend_parse_parameters_none() == FAILURE) { return; } if ((element = zend_hash_get_current_data_ptr_ex(&intern->storage, &intern->pos)) == NULL) { return; } ZVAL_COPY(return_value, &element->obj); } /* }}} */ /* {{{ proto mixed SplObjectStorage::getInfo() ",0 "static void local_socket_ready_notify(asocket* s) { s->ready = local_socket_ready; s->shutdown = NULL; s->close = local_socket_close; SendOkay(s->fd); s->ready(s); } ",0 "int svc_bind(struct svc_serv *serv, struct net *net) { if (!svc_uses_rpcbind(serv)) return 0; return svc_rpcb_setup(serv, net); } ",0 "status_t Parcel::readCharVector(std::vector* val) const { return readTypedVector(val, &Parcel::readChar); } ",0 "static void prepare_vmcs12(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12) { /* update guest state fields: */ vmcs12->guest_cr0 = vmcs12_guest_cr0(vcpu, vmcs12); vmcs12->guest_cr4 = vmcs12_guest_cr4(vcpu, vmcs12); kvm_get_dr(vcpu, 7, (unsigned long *)&vmcs12->guest_dr7); vmcs12->guest_rsp = kvm_register_read(vcpu, VCPU_REGS_RSP); vmcs12->guest_rip = kvm_register_read(vcpu, VCPU_REGS_RIP); vmcs12->guest_rflags = vmcs_readl(GUEST_RFLAGS); vmcs12->guest_es_selector = vmcs_read16(GUEST_ES_SELECTOR); vmcs12->guest_cs_selector = vmcs_read16(GUEST_CS_SELECTOR); vmcs12->guest_ss_selector = vmcs_read16(GUEST_SS_SELECTOR); vmcs12->guest_ds_selector = vmcs_read16(GUEST_DS_SELECTOR); vmcs12->guest_fs_selector = vmcs_read16(GUEST_FS_SELECTOR); vmcs12->guest_gs_selector = vmcs_read16(GUEST_GS_SELECTOR); vmcs12->guest_ldtr_selector = vmcs_read16(GUEST_LDTR_SELECTOR); vmcs12->guest_tr_selector = vmcs_read16(GUEST_TR_SELECTOR); vmcs12->guest_es_limit = vmcs_read32(GUEST_ES_LIMIT); vmcs12->guest_cs_limit = vmcs_read32(GUEST_CS_LIMIT); vmcs12->guest_ss_limit = vmcs_read32(GUEST_SS_LIMIT); vmcs12->guest_ds_limit = vmcs_read32(GUEST_DS_LIMIT); vmcs12->guest_fs_limit = vmcs_read32(GUEST_FS_LIMIT); vmcs12->guest_gs_limit = vmcs_read32(GUEST_GS_LIMIT); vmcs12->guest_ldtr_limit = vmcs_read32(GUEST_LDTR_LIMIT); vmcs12->guest_tr_limit = vmcs_read32(GUEST_TR_LIMIT); vmcs12->guest_gdtr_limit = vmcs_read32(GUEST_GDTR_LIMIT); vmcs12->guest_idtr_limit = vmcs_read32(GUEST_IDTR_LIMIT); vmcs12->guest_es_ar_bytes = vmcs_read32(GUEST_ES_AR_BYTES); vmcs12->guest_cs_ar_bytes = vmcs_read32(GUEST_CS_AR_BYTES); vmcs12->guest_ss_ar_bytes = vmcs_read32(GUEST_SS_AR_BYTES); vmcs12->guest_ds_ar_bytes = vmcs_read32(GUEST_DS_AR_BYTES); vmcs12->guest_fs_ar_bytes = vmcs_read32(GUEST_FS_AR_BYTES); vmcs12->guest_gs_ar_bytes = vmcs_read32(GUEST_GS_AR_BYTES); vmcs12->guest_ldtr_ar_bytes = vmcs_read32(GUEST_LDTR_AR_BYTES); vmcs12->guest_tr_ar_bytes = vmcs_read32(GUEST_TR_AR_BYTES); vmcs12->guest_es_base = vmcs_readl(GUEST_ES_BASE); vmcs12->guest_cs_base = vmcs_readl(GUEST_CS_BASE); vmcs12->guest_ss_base = vmcs_readl(GUEST_SS_BASE); vmcs12->guest_ds_base = vmcs_readl(GUEST_DS_BASE); vmcs12->guest_fs_base = vmcs_readl(GUEST_FS_BASE); vmcs12->guest_gs_base = vmcs_readl(GUEST_GS_BASE); vmcs12->guest_ldtr_base = vmcs_readl(GUEST_LDTR_BASE); vmcs12->guest_tr_base = vmcs_readl(GUEST_TR_BASE); vmcs12->guest_gdtr_base = vmcs_readl(GUEST_GDTR_BASE); vmcs12->guest_idtr_base = vmcs_readl(GUEST_IDTR_BASE); vmcs12->guest_interruptibility_info = vmcs_read32(GUEST_INTERRUPTIBILITY_INFO); vmcs12->guest_pending_dbg_exceptions = vmcs_readl(GUEST_PENDING_DBG_EXCEPTIONS); /* * In some cases (usually, nested EPT), L2 is allowed to change its * own CR3 without exiting. If it has changed it, we must keep it. * Of course, if L0 is using shadow page tables, GUEST_CR3 was defined * by L0, not L1 or L2, so we mustn't unconditionally copy it to vmcs12. * * Additionally, restore L2's PDPTR to vmcs12. */ if (enable_ept) { vmcs12->guest_cr3 = vmcs_read64(GUEST_CR3); vmcs12->guest_pdptr0 = vmcs_read64(GUEST_PDPTR0); vmcs12->guest_pdptr1 = vmcs_read64(GUEST_PDPTR1); vmcs12->guest_pdptr2 = vmcs_read64(GUEST_PDPTR2); vmcs12->guest_pdptr3 = vmcs_read64(GUEST_PDPTR3); } vmcs12->vm_entry_controls = (vmcs12->vm_entry_controls & ~VM_ENTRY_IA32E_MODE) | (vmcs_read32(VM_ENTRY_CONTROLS) & VM_ENTRY_IA32E_MODE); /* TODO: These cannot have changed unless we have MSR bitmaps and * the relevant bit asks not to trap the change */ vmcs12->guest_ia32_debugctl = vmcs_read64(GUEST_IA32_DEBUGCTL); if (vmcs12->vm_exit_controls & VM_EXIT_SAVE_IA32_PAT) vmcs12->guest_ia32_pat = vmcs_read64(GUEST_IA32_PAT); vmcs12->guest_sysenter_cs = vmcs_read32(GUEST_SYSENTER_CS); vmcs12->guest_sysenter_esp = vmcs_readl(GUEST_SYSENTER_ESP); vmcs12->guest_sysenter_eip = vmcs_readl(GUEST_SYSENTER_EIP); /* update exit information fields: */ vmcs12->vm_exit_reason = to_vmx(vcpu)->exit_reason; vmcs12->exit_qualification = vmcs_readl(EXIT_QUALIFICATION); vmcs12->vm_exit_intr_info = vmcs_read32(VM_EXIT_INTR_INFO); if ((vmcs12->vm_exit_intr_info & (INTR_INFO_VALID_MASK | INTR_INFO_DELIVER_CODE_MASK)) == (INTR_INFO_VALID_MASK | INTR_INFO_DELIVER_CODE_MASK)) vmcs12->vm_exit_intr_error_code = vmcs_read32(VM_EXIT_INTR_ERROR_CODE); vmcs12->idt_vectoring_info_field = 0; vmcs12->vm_exit_instruction_len = vmcs_read32(VM_EXIT_INSTRUCTION_LEN); vmcs12->vmx_instruction_info = vmcs_read32(VMX_INSTRUCTION_INFO); if (!(vmcs12->vm_exit_reason & VMX_EXIT_REASONS_FAILED_VMENTRY)) { /* vm_entry_intr_info_field is cleared on exit. Emulate this * instead of reading the real value. */ vmcs12->vm_entry_intr_info_field &= ~INTR_INFO_VALID_MASK; /* * Transfer the event that L0 or L1 may wanted to inject into * L2 to IDT_VECTORING_INFO_FIELD. */ vmcs12_save_pending_event(vcpu, vmcs12); } /* * Drop what we picked up for L2 via vmx_complete_interrupts. It is * preserved above and would only end up incorrectly in L1. */ vcpu->arch.nmi_injected = false; kvm_clear_exception_queue(vcpu); kvm_clear_interrupt_queue(vcpu); } ",0 "spannable_string_t* WebPage::textBeforeCursor(int32_t length, int32_t flags) { return d->m_inputHandler->textBeforeCursor(length, flags); } ",0 "static int parseOperand(RAsm *a, const char *str, Operand *op, bool isrepop) { size_t pos, nextpos = 0; x86newTokenType last_type; int size_token = 1; bool explicit_size = false; int reg_index = 0; op->type = 0; while (size_token) { pos = nextpos; last_type = getToken (str, &pos, &nextpos); if (!r_str_ncasecmp (str + pos, ""ptr"", 3)) { continue; } else if (!r_str_ncasecmp (str + pos, ""byte"", 4)) { op->type |= OT_MEMORY | OT_BYTE; op->dest_size = OT_BYTE; explicit_size = true; } else if (!r_str_ncasecmp (str + pos, ""word"", 4)) { op->type |= OT_MEMORY | OT_WORD; op->dest_size = OT_WORD; explicit_size = true; } else if (!r_str_ncasecmp (str + pos, ""dword"", 5)) { op->type |= OT_MEMORY | OT_DWORD; op->dest_size = OT_DWORD; explicit_size = true; } else if (!r_str_ncasecmp (str + pos, ""qword"", 5)) { op->type |= OT_MEMORY | OT_QWORD; op->dest_size = OT_QWORD; explicit_size = true; } else if (!r_str_ncasecmp (str + pos, ""oword"", 5)) { op->type |= OT_MEMORY | OT_OWORD; op->dest_size = OT_OWORD; explicit_size = true; } else if (!r_str_ncasecmp (str + pos, ""tbyte"", 5)) { op->type |= OT_MEMORY | OT_TBYTE; op->dest_size = OT_TBYTE; explicit_size = true; } else { // the current token doesn't denote a size size_token = 0; } } if (str[pos] == '[') { if (!op->type) { op->type = OT_MEMORY; } op->offset = op->scale[0] = op->scale[1] = 0; ut64 temp = 1; Register reg = X86R_UNDEFINED; bool first_reg = true; while (str[pos] != ']') { if (pos > nextpos) { break; } pos = nextpos; if (!str[pos]) { break; } last_type = getToken (str, &pos, &nextpos); if (last_type == TT_SPECIAL) { if (str[pos] == '+' || str[pos] == '-' || str[pos] == ']') { if (reg != X86R_UNDEFINED) { op->regs[reg_index] = reg; op->scale[reg_index] = temp; ++reg_index; } else { op->offset += temp; op->regs[reg_index] = X86R_UNDEFINED; } temp = 1; reg = X86R_UNDEFINED; } else if (str[pos] == '*') { } } else if (last_type == TT_WORD) { ut32 reg_type = 0; if (reg != X86R_UNDEFINED) { op->type = 0; // Make the result invalid } nextpos = pos; reg = parseReg (a, str, &nextpos, ®_type); if (first_reg) { op->extended = false; if (reg > 8) { op->extended = true; op->reg = reg - 9; } first_reg = false; } else if (reg > 8) { op->reg = reg - 9; } if (reg_type & OT_REGTYPE & OT_SEGMENTREG) { op->reg = reg; op->type = reg_type; parse_segment_offset (a, str, &nextpos, op, reg_index); return nextpos; } if (!explicit_size) { op->type |= reg_type; } op->reg_size = reg_type; op->explicit_size = explicit_size; if (!(reg_type & OT_GPREG)) { op->type = 0; // Make the result invalid } } else { char *p = strchr (str, '+'); op->offset_sign = 1; if (!p) { p = strchr (str, '-'); if (p) { op->offset_sign = -1; } } char * plus = strchr (str, '+'); char * minus = strchr (str, '-'); char * closeB = strchr (str, ']'); if (plus && minus && plus < closeB && minus < closeB) { op->offset_sign = -1; } char *tmp; tmp = malloc (strlen (str + pos) + 1); strcpy (tmp, str + pos); strtok (tmp, ""+-""); st64 read = getnum (a, tmp); free (tmp); temp *= read; } } } else if (last_type == TT_WORD) { // register nextpos = pos; RFlagItem *flag; if (isrepop) { op->is_good_flag = false; strncpy (op->rep_op, str, MAX_REPOP_LENGTH - 1); op->rep_op[MAX_REPOP_LENGTH - 1] = '\0'; return nextpos; } op->reg = parseReg (a, str, &nextpos, &op->type); op->extended = false; if (op->reg > 8) { op->extended = true; op->reg -= 9; } if (op->type & OT_REGTYPE & OT_SEGMENTREG) { parse_segment_offset (a, str, &nextpos, op, reg_index); return nextpos; } if (op->reg == X86R_UNDEFINED) { op->is_good_flag = false; if (a->num && a->num->value == 0) { return nextpos; } op->type = OT_CONSTANT; RCore *core = a->num? (RCore *)(a->num->userptr): NULL; if (core && (flag = r_flag_get (core->flags, str))) { op->is_good_flag = true; } char *p = strchr (str, '-'); if (p) { op->sign = -1; str = ++p; } op->immediate = getnum (a, str); } else if (op->reg < X86R_UNDEFINED) { strncpy (op->rep_op, str, MAX_REPOP_LENGTH - 1); op->rep_op[MAX_REPOP_LENGTH - 1] = '\0'; } } else { // immediate op->type = OT_CONSTANT; op->sign = 1; char *p = strchr (str, '-'); if (p) { op->sign = -1; str = ++p; } op->immediate = getnum (a, str); } return nextpos; } ",1 "pkinit_server_return_padata(krb5_context context, krb5_pa_data * padata, krb5_data *req_pkt, krb5_kdc_req * request, krb5_kdc_rep * reply, krb5_keyblock * encrypting_key, krb5_pa_data ** send_pa, krb5_kdcpreauth_callbacks cb, krb5_kdcpreauth_rock rock, krb5_kdcpreauth_moddata moddata, krb5_kdcpreauth_modreq modreq) { krb5_error_code retval = 0; krb5_data scratch = {0, 0, NULL}; krb5_pa_pk_as_req *reqp = NULL; krb5_pa_pk_as_req_draft9 *reqp9 = NULL; int i = 0; unsigned char *subjectPublicKey = NULL; unsigned char *dh_pubkey = NULL, *server_key = NULL; unsigned int subjectPublicKey_len = 0; unsigned int server_key_len = 0, dh_pubkey_len = 0; krb5_kdc_dh_key_info dhkey_info; krb5_data *encoded_dhkey_info = NULL; krb5_pa_pk_as_rep *rep = NULL; krb5_pa_pk_as_rep_draft9 *rep9 = NULL; krb5_data *out_data = NULL; krb5_octet_data secret; krb5_enctype enctype = -1; krb5_reply_key_pack *key_pack = NULL; krb5_reply_key_pack_draft9 *key_pack9 = NULL; krb5_data *encoded_key_pack = NULL; pkinit_kdc_context plgctx; pkinit_kdc_req_context reqctx; int fixed_keypack = 0; *send_pa = NULL; if (padata->pa_type == KRB5_PADATA_PKINIT_KX) { return return_pkinit_kx(context, request, reply, encrypting_key, send_pa); } if (padata->length <= 0 || padata->contents == NULL) return 0; if (modreq == NULL) { pkiDebug(""missing request context \n""); return EINVAL; } plgctx = pkinit_find_realm_context(context, moddata, request->server); if (plgctx == NULL) { pkiDebug(""Unable to locate correct realm context\n""); return ENOENT; } pkiDebug(""pkinit_return_padata: entered!\n""); reqctx = (pkinit_kdc_req_context)modreq; if (encrypting_key->contents) { free(encrypting_key->contents); encrypting_key->length = 0; encrypting_key->contents = NULL; } for(i = 0; i < request->nktypes; i++) { enctype = request->ktype[i]; if (!krb5_c_valid_enctype(enctype)) continue; else { pkiDebug(""KDC picked etype = %d\n"", enctype); break; } } if (i == request->nktypes) { retval = KRB5KDC_ERR_ETYPE_NOSUPP; goto cleanup; } switch((int)reqctx->pa_type) { case KRB5_PADATA_PK_AS_REQ: init_krb5_pa_pk_as_rep(&rep); if (rep == NULL) { retval = ENOMEM; goto cleanup; } /* let's assume it's RSA. we'll reset it to DH if needed */ rep->choice = choice_pa_pk_as_rep_encKeyPack; break; case KRB5_PADATA_PK_AS_REP_OLD: case KRB5_PADATA_PK_AS_REQ_OLD: init_krb5_pa_pk_as_rep_draft9(&rep9); if (rep9 == NULL) { retval = ENOMEM; goto cleanup; } rep9->choice = choice_pa_pk_as_rep_draft9_encKeyPack; break; default: retval = KRB5KDC_ERR_PREAUTH_FAILED; goto cleanup; } if (reqctx->rcv_auth_pack != NULL && reqctx->rcv_auth_pack->clientPublicValue != NULL) { subjectPublicKey = reqctx->rcv_auth_pack->clientPublicValue->subjectPublicKey.data; subjectPublicKey_len = reqctx->rcv_auth_pack->clientPublicValue->subjectPublicKey.length; rep->choice = choice_pa_pk_as_rep_dhInfo; } else if (reqctx->rcv_auth_pack9 != NULL && reqctx->rcv_auth_pack9->clientPublicValue != NULL) { subjectPublicKey = reqctx->rcv_auth_pack9->clientPublicValue->subjectPublicKey.data; subjectPublicKey_len = reqctx->rcv_auth_pack9->clientPublicValue->subjectPublicKey.length; rep9->choice = choice_pa_pk_as_rep_draft9_dhSignedData; } /* if this DH, then process finish computing DH key */ if (rep != NULL && (rep->choice == choice_pa_pk_as_rep_dhInfo || rep->choice == choice_pa_pk_as_rep_draft9_dhSignedData)) { pkiDebug(""received DH key delivery AS REQ\n""); retval = server_process_dh(context, plgctx->cryptoctx, reqctx->cryptoctx, plgctx->idctx, subjectPublicKey, subjectPublicKey_len, &dh_pubkey, &dh_pubkey_len, &server_key, &server_key_len); if (retval) { pkiDebug(""failed to process/create dh paramters\n""); goto cleanup; } } if ((rep9 != NULL && rep9->choice == choice_pa_pk_as_rep_draft9_dhSignedData) || (rep != NULL && rep->choice == choice_pa_pk_as_rep_dhInfo)) { /* * This is DH, so don't generate the key until after we * encode the reply, because the encoded reply is needed * to generate the key in some cases. */ dhkey_info.subjectPublicKey.length = dh_pubkey_len; dhkey_info.subjectPublicKey.data = dh_pubkey; dhkey_info.nonce = request->nonce; dhkey_info.dhKeyExpiration = 0; retval = k5int_encode_krb5_kdc_dh_key_info(&dhkey_info, &encoded_dhkey_info); if (retval) { pkiDebug(""encode_krb5_kdc_dh_key_info failed\n""); goto cleanup; } #ifdef DEBUG_ASN1 print_buffer_bin((unsigned char *)encoded_dhkey_info->data, encoded_dhkey_info->length, ""/tmp/kdc_dh_key_info""); #endif switch ((int)padata->pa_type) { case KRB5_PADATA_PK_AS_REQ: retval = cms_signeddata_create(context, plgctx->cryptoctx, reqctx->cryptoctx, plgctx->idctx, CMS_SIGN_SERVER, 1, (unsigned char *)encoded_dhkey_info->data, encoded_dhkey_info->length, &rep->u.dh_Info.dhSignedData.data, &rep->u.dh_Info.dhSignedData.length); if (retval) { pkiDebug(""failed to create pkcs7 signed data\n""); goto cleanup; } break; case KRB5_PADATA_PK_AS_REP_OLD: case KRB5_PADATA_PK_AS_REQ_OLD: retval = cms_signeddata_create(context, plgctx->cryptoctx, reqctx->cryptoctx, plgctx->idctx, CMS_SIGN_DRAFT9, 1, (unsigned char *)encoded_dhkey_info->data, encoded_dhkey_info->length, &rep9->u.dhSignedData.data, &rep9->u.dhSignedData.length); if (retval) { pkiDebug(""failed to create pkcs7 signed data\n""); goto cleanup; } break; } } else { pkiDebug(""received RSA key delivery AS REQ\n""); retval = krb5_c_make_random_key(context, enctype, encrypting_key); if (retval) { pkiDebug(""unable to make a session key\n""); goto cleanup; } /* check if PA_TYPE of 132 is present which means the client is * requesting that a checksum is send back instead of the nonce */ for (i = 0; request->padata[i] != NULL; i++) { pkiDebug(""%s: Checking pa_type 0x%08x\n"", __FUNCTION__, request->padata[i]->pa_type); if (request->padata[i]->pa_type == 132) fixed_keypack = 1; } pkiDebug(""%s: return checksum instead of nonce = %d\n"", __FUNCTION__, fixed_keypack); /* if this is an RFC reply or draft9 client requested a checksum * in the reply instead of the nonce, create an RFC-style keypack */ if ((int)padata->pa_type == KRB5_PADATA_PK_AS_REQ || fixed_keypack) { init_krb5_reply_key_pack(&key_pack); if (key_pack == NULL) { retval = ENOMEM; goto cleanup; } retval = krb5_c_make_checksum(context, 0, encrypting_key, KRB5_KEYUSAGE_TGS_REQ_AUTH_CKSUM, req_pkt, &key_pack->asChecksum); if (retval) { pkiDebug(""unable to calculate AS REQ checksum\n""); goto cleanup; } #ifdef DEBUG_CKSUM pkiDebug(""calculating checksum on buf size = %d\n"", req_pkt->length); print_buffer(req_pkt->data, req_pkt->length); pkiDebug(""checksum size = %d\n"", key_pack->asChecksum.length); print_buffer(key_pack->asChecksum.contents, key_pack->asChecksum.length); pkiDebug(""encrypting key (%d)\n"", encrypting_key->length); print_buffer(encrypting_key->contents, encrypting_key->length); #endif krb5_copy_keyblock_contents(context, encrypting_key, &key_pack->replyKey); retval = k5int_encode_krb5_reply_key_pack(key_pack, &encoded_key_pack); if (retval) { pkiDebug(""failed to encode reply_key_pack\n""); goto cleanup; } } switch ((int)padata->pa_type) { case KRB5_PADATA_PK_AS_REQ: rep->choice = choice_pa_pk_as_rep_encKeyPack; retval = cms_envelopeddata_create(context, plgctx->cryptoctx, reqctx->cryptoctx, plgctx->idctx, padata->pa_type, 1, (unsigned char *)encoded_key_pack->data, encoded_key_pack->length, &rep->u.encKeyPack.data, &rep->u.encKeyPack.length); break; case KRB5_PADATA_PK_AS_REP_OLD: case KRB5_PADATA_PK_AS_REQ_OLD: /* if the request is from the broken draft9 client that * expects back a nonce, create it now */ if (!fixed_keypack) { init_krb5_reply_key_pack_draft9(&key_pack9); if (key_pack9 == NULL) { retval = ENOMEM; goto cleanup; } key_pack9->nonce = reqctx->rcv_auth_pack9->pkAuthenticator.nonce; krb5_copy_keyblock_contents(context, encrypting_key, &key_pack9->replyKey); retval = k5int_encode_krb5_reply_key_pack_draft9(key_pack9, &encoded_key_pack); if (retval) { pkiDebug(""failed to encode reply_key_pack\n""); goto cleanup; } } rep9->choice = choice_pa_pk_as_rep_draft9_encKeyPack; retval = cms_envelopeddata_create(context, plgctx->cryptoctx, reqctx->cryptoctx, plgctx->idctx, padata->pa_type, 1, (unsigned char *)encoded_key_pack->data, encoded_key_pack->length, &rep9->u.encKeyPack.data, &rep9->u.encKeyPack.length); break; } if (retval) { pkiDebug(""failed to create pkcs7 enveloped data: %s\n"", error_message(retval)); goto cleanup; } #ifdef DEBUG_ASN1 print_buffer_bin((unsigned char *)encoded_key_pack->data, encoded_key_pack->length, ""/tmp/kdc_key_pack""); switch ((int)padata->pa_type) { case KRB5_PADATA_PK_AS_REQ: print_buffer_bin(rep->u.encKeyPack.data, rep->u.encKeyPack.length, ""/tmp/kdc_enc_key_pack""); break; case KRB5_PADATA_PK_AS_REP_OLD: case KRB5_PADATA_PK_AS_REQ_OLD: print_buffer_bin(rep9->u.encKeyPack.data, rep9->u.encKeyPack.length, ""/tmp/kdc_enc_key_pack""); break; } #endif } if ((rep != NULL && rep->choice == choice_pa_pk_as_rep_dhInfo) && ((reqctx->rcv_auth_pack != NULL && reqctx->rcv_auth_pack->supportedKDFs != NULL))) { /* If using the alg-agility KDF, put the algorithm in the reply * before encoding it. */ if (reqctx->rcv_auth_pack != NULL && reqctx->rcv_auth_pack->supportedKDFs != NULL) { retval = pkinit_pick_kdf_alg(context, reqctx->rcv_auth_pack->supportedKDFs, &(rep->u.dh_Info.kdfID)); if (retval) { pkiDebug(""pkinit_pick_kdf_alg failed: %s\n"", error_message(retval)); goto cleanup; } } } switch ((int)padata->pa_type) { case KRB5_PADATA_PK_AS_REQ: retval = k5int_encode_krb5_pa_pk_as_rep(rep, &out_data); break; case KRB5_PADATA_PK_AS_REP_OLD: case KRB5_PADATA_PK_AS_REQ_OLD: retval = k5int_encode_krb5_pa_pk_as_rep_draft9(rep9, &out_data); break; } if (retval) { pkiDebug(""failed to encode AS_REP\n""); goto cleanup; } #ifdef DEBUG_ASN1 if (out_data != NULL) print_buffer_bin((unsigned char *)out_data->data, out_data->length, ""/tmp/kdc_as_rep""); #endif /* If this is DH, we haven't computed the key yet, so do it now. */ if ((rep9 != NULL && rep9->choice == choice_pa_pk_as_rep_draft9_dhSignedData) || (rep != NULL && rep->choice == choice_pa_pk_as_rep_dhInfo)) { /* If mutually supported KDFs were found, use the alg agility KDF */ if (rep->u.dh_Info.kdfID) { secret.data = server_key; secret.length = server_key_len; retval = pkinit_alg_agility_kdf(context, &secret, rep->u.dh_Info.kdfID, request->client, request->server, enctype, (krb5_octet_data *)req_pkt, (krb5_octet_data *)out_data, encrypting_key); if (retval) { pkiDebug(""pkinit_alg_agility_kdf failed: %s\n"", error_message(retval)); goto cleanup; } /* Otherwise, use the older octetstring2key() function */ } else { retval = pkinit_octetstring2key(context, enctype, server_key, server_key_len, encrypting_key); if (retval) { pkiDebug(""pkinit_octetstring2key failed: %s\n"", error_message(retval)); goto cleanup; } } } *send_pa = malloc(sizeof(krb5_pa_data)); if (*send_pa == NULL) { retval = ENOMEM; free(out_data->data); free(out_data); out_data = NULL; goto cleanup; } (*send_pa)->magic = KV5M_PA_DATA; switch ((int)padata->pa_type) { case KRB5_PADATA_PK_AS_REQ: (*send_pa)->pa_type = KRB5_PADATA_PK_AS_REP; break; case KRB5_PADATA_PK_AS_REQ_OLD: case KRB5_PADATA_PK_AS_REP_OLD: (*send_pa)->pa_type = KRB5_PADATA_PK_AS_REP_OLD; break; } (*send_pa)->length = out_data->length; (*send_pa)->contents = (krb5_octet *) out_data->data; cleanup: pkinit_fini_kdc_req_context(context, reqctx); free(scratch.data); free(out_data); if (encoded_dhkey_info != NULL) krb5_free_data(context, encoded_dhkey_info); if (encoded_key_pack != NULL) krb5_free_data(context, encoded_key_pack); free(dh_pubkey); free(server_key); switch ((int)padata->pa_type) { case KRB5_PADATA_PK_AS_REQ: free_krb5_pa_pk_as_req(&reqp); free_krb5_pa_pk_as_rep(&rep); free_krb5_reply_key_pack(&key_pack); break; case KRB5_PADATA_PK_AS_REP_OLD: case KRB5_PADATA_PK_AS_REQ_OLD: free_krb5_pa_pk_as_req_draft9(&reqp9); free_krb5_pa_pk_as_rep_draft9(&rep9); if (!fixed_keypack) free_krb5_reply_key_pack_draft9(&key_pack9); else free_krb5_reply_key_pack(&key_pack); break; } if (retval) pkiDebug(""pkinit_verify_padata failure""); return retval; } ",1 "int wvlan_uil_get_info(struct uilreq *urq, struct wl_private *lp) { int result = 0; int i; /*------------------------------------------------------------------------*/ DBG_FUNC(""wvlan_uil_get_info""); DBG_ENTER(DbgInfo); if (urq->hcfCtx == &(lp->hcfCtx)) { if ((urq->data != NULL) && (urq->len != 0)) { ltv_t *pLtv; bool_t ltvAllocated = FALSE; /* Make sure that we have at least a command and length */ if (urq->len < (sizeof(hcf_16) * 2)) { urq->len = sizeof(lp->ltvRecord); DBG_ERROR(DbgInfo, ""No Length/Type in LTV!!!\n""); DBG_ERROR(DbgInfo, ""UIL_ERR_LEN\n""); urq->result = UIL_ERR_LEN; DBG_LEAVE(DbgInfo); return result; } /* Verify the user's LTV record header. */ result = verify_area(VERIFY_READ, urq->data, sizeof(hcf_16) * 2); if (result != 0) { DBG_ERROR(DbgInfo, ""verify_area(), VERIFY_READ FAILED\n""); urq->result = UIL_FAILURE; DBG_LEAVE(DbgInfo); return result; } /* Get only the command and length information. */ result = copy_from_user(&(lp->ltvRecord), urq->data, sizeof(hcf_16) * 2); /* Make sure the incoming LTV record length is within the bounds of the IOCTL length. */ if (((lp->ltvRecord.len + 1) * sizeof(hcf_16)) > urq->len) { DBG_ERROR(DbgInfo, ""Incoming LTV too big\n""); urq->len = sizeof(lp->ltvRecord); urq->result = UIL_ERR_LEN; DBG_LEAVE(DbgInfo); return result; } /* Determine if hcf_get_info() is needed or not */ switch (lp->ltvRecord.typ) { case CFG_NIC_IDENTITY: memcpy(&lp->ltvRecord.u.u8[0], &lp->NICIdentity, sizeof(lp->NICIdentity)); break; case CFG_PRI_IDENTITY: memcpy(&lp->ltvRecord.u.u8[0], &lp->PrimaryIdentity, sizeof(lp->PrimaryIdentity)); break; case CFG_AP_MODE: DBG_ERROR(DbgInfo, ""set CFG_AP_MODE no longer supported, so is get useful ????\n""); lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(lp->hcfCtx.IFB_FWIdentity.comp_id) == COMP_ID_FW_AP; break; /* case CFG_DRV_INFO: */ case CFG_ENCRYPT_STRING: case CFG_COUNTRY_STRING: case CFG_DRIVER_ENABLE: case CFG_WOLAS_ENABLE: /* TODO: determine if we're going to support these */ urq->result = UIL_FAILURE; break; case CFG_DRV_INFO: DBG_TRACE(DbgInfo, ""Intercept CFG_DRV_INFO\n""); result = cfg_driver_info(urq, lp); break; case CFG_DRV_IDENTITY: DBG_TRACE(DbgInfo, ""Intercept CFG_DRV_IDENTITY\n""); result = cfg_driver_identity(urq, lp); break; case CFG_IFB: /* IFB can be a security hole */ if (!capable(CAP_NET_ADMIN)) { result = -EPERM; break; } /* Else fall through to the default */ case CFG_FW_IDENTITY: /* For Hermes-1, this is cached */ default: /* Verify the user buffer */ result = verify_area(VERIFY_WRITE, urq->data, urq->len); if (result != 0) { DBG_ERROR(DbgInfo, ""verify_area(), VERIFY_WRITE FAILED\n""); urq->result = UIL_FAILURE; break; } /* If the requested length is greater than the size of our local LTV record, try to allocate it from the kernel stack. Otherwise, we just use our local LTV record. */ if (urq->len > sizeof(lp->ltvRecord)) { pLtv = kmalloc(urq->len, GFP_KERNEL); if (pLtv != NULL) { ltvAllocated = TRUE; /* Copy the command/length information into the new buffer. */ memcpy(pLtv, &(lp->ltvRecord), sizeof(hcf_16) * 2); } else { urq->len = sizeof(lp->ltvRecord); urq->result = UIL_ERR_LEN; DBG_ERROR(DbgInfo, ""kmalloc FAILED\n""); DBG_ERROR(DbgInfo, ""UIL_ERR_LEN\n""); result = -ENOMEM; break; } } else { pLtv = &(lp->ltvRecord); } wl_act_int_off(lp); urq->result = hcf_get_info(&(lp->hcfCtx), (LTVP) pLtv); wl_act_int_on(lp); /* Copy the LTV into the user's buffer. */ /*copy_to_user(urq->data, pLtv, urq->len); */ /*if(ltvAllocated) { kfree(pLtv); }*/ /* urq->result = UIL_SUCCESS; */ break; } /* Handle endian conversion of special fields */ switch (lp->ltvRecord.typ) { /* simple int gets just need the first hcf_16 byte flipped */ case CFG_CNF_PORT_TYPE: case CFG_CNF_OWN_CHANNEL: case CFG_CNF_OWN_ATIM_WINDOW: case CFG_CNF_SYSTEM_SCALE: case CFG_CNF_MAX_DATA_LEN: case CFG_CNF_PM_ENABLED: case CFG_CNF_MCAST_RX: case CFG_CNF_MAX_SLEEP_DURATION: case CFG_CNF_HOLDOVER_DURATION: case CFG_CNF_OWN_DTIM_PERIOD: case CFG_CNF_MCAST_PM_BUF: case CFG_CNF_REJECT_ANY: case CFG_CNF_ENCRYPTION: case CFG_CNF_AUTHENTICATION: case CFG_CNF_EXCL_UNENCRYPTED: case CFG_CNF_INTRA_BSS_RELAY: case CFG_CNF_MICRO_WAVE: case CFG_CNF_LOAD_BALANCING: case CFG_CNF_MEDIUM_DISTRIBUTION: #ifdef WARP case CFG_CNF_TX_POW_LVL: case CFG_CNF_CONNECTION_CNTL: case CFG_CNF_OWN_BEACON_INTERVAL: /* Own Beacon Interval */ case CFG_COEXISTENSE_BEHAVIOUR: /* Coexistence Behavior */ /*case CFG_CNF_RX_ALL_GROUP_ADDRESS: */ #endif /* HERMES25 */ case CFG_CREATE_IBSS: case CFG_RTS_THRH: case CFG_PROMISCUOUS_MODE: /*case CFG_WAKE_ON_LAN: */ case CFG_RTS_THRH0: case CFG_RTS_THRH1: case CFG_RTS_THRH2: case CFG_RTS_THRH3: case CFG_RTS_THRH4: case CFG_RTS_THRH5: case CFG_RTS_THRH6: case CFG_TX_RATE_CNTL0: case CFG_TX_RATE_CNTL1: case CFG_TX_RATE_CNTL2: case CFG_TX_RATE_CNTL3: case CFG_TX_RATE_CNTL4: case CFG_TX_RATE_CNTL5: case CFG_TX_RATE_CNTL6: case CFG_TX_KEY_ID: case CFG_TICK_TIME: case CFG_MAX_LOAD_TIME: case CFG_NIC_TEMP_TYPE: case CFG_PORT_STAT: case CFG_CUR_TX_RATE: case CFG_CUR_BEACON_INTERVAL: case CFG_PROTOCOL_RSP_TIME: case CFG_CUR_SHORT_RETRY_LIMIT: case CFG_CUR_LONG_RETRY_LIMIT: case CFG_MAX_TX_LIFETIME: case CFG_MAX_RX_LIFETIME: case CFG_CF_POLLABLE: case CFG_PRIVACY_OPT_IMPLEMENTED: /* case CFG_CURRENT_REMOTE_RATES: */ /* case CFG_CURRENT_USED_RATES: */ /* case CFG_CURRENT_SYSTEM_SCALE: */ /* case CFG_CURRENT_TX_RATE1: */ /* case CFG_CURRENT_TX_RATE2: */ /* case CFG_CURRENT_TX_RATE3: */ /* case CFG_CURRENT_TX_RATE4: */ /* case CFG_CURRENT_TX_RATE5: */ /* case CFG_CURRENT_TX_RATE6: */ case CFG_PHY_TYPE: case CFG_CUR_CHANNEL: /* case CFG_CURRENT_POWER_STATE: */ /* case CFG_CCAMODE: */ /* lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[0]); */ /* break; */ /* name string gets just need the first hcf_16 byte flipped (length of string) */ case CFG_CNF_OWN_SSID: case CFG_CNF_OWN_NAME: /* case CNF_DESIRED_SSID: */ case CFG_DESIRED_SSID: case CFG_SCAN_SSID: case CFG_CUR_SSID: lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[0]); break; /* non-length counted strings need no byte flipping */ case CFG_CNF_OWN_MAC_ADDR: /* this case is no longer valid: CFG_CNF_WDS_ADDR */ case CFG_CNF_WDS_ADDR1: case CFG_CNF_WDS_ADDR2: case CFG_CNF_WDS_ADDR3: case CFG_CNF_WDS_ADDR4: case CFG_CNF_WDS_ADDR5: case CFG_CNF_WDS_ADDR6: case CFG_GROUP_ADDR: case CFG_NIC_SERIAL_NUMBER: case CFG_CUR_BSSID: case CFG_NIC_MAC_ADDR: case CFG_SUPPORTED_DATA_RATES: /* need to ensure we can treat this as a string */ break; /* case CFG_CNF_COUNTRY_INFO: */ /* special case, see page 75 of 022486, Rev C. */ /* case CFG_CURRENT_COUNTRY_INFO: */ /* special case, see page 101 of 022486, Rev C. */ /* lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[0]); lp->ltvRecord.u.u16[3] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[3]); for(i = 4; i < lp->ltvRecord.len; i++) { lp->ltvRecord.u.u16[i] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[i]); } break; */ case CFG_DEFAULT_KEYS: { CFG_DEFAULT_KEYS_STRCT *pKeys = (CFG_DEFAULT_KEYS_STRCT *)&lp->ltvRecord.u.u8[0]; pKeys[0].len = CNV_INT_TO_LITTLE(pKeys[0].len); pKeys[1].len = CNV_INT_TO_LITTLE(pKeys[1].len); pKeys[2].len = CNV_INT_TO_LITTLE(pKeys[2].len); pKeys[3].len = CNV_INT_TO_LITTLE(pKeys[3].len); } break; case CFG_CNF_MCAST_RATE: case CFG_TX_RATE_CNTL: case CFG_SUPPORTED_RATE_SET_CNTL: /* Supported Rate Set Control */ case CFG_BASIC_RATE_SET_CNTL: /* Basic Rate Set Control */ lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[0]); lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[1]); break; case CFG_DL_BUF: case CFG_NIC_IDENTITY: case CFG_COMMS_QUALITY: case CFG_PCF_INFO: lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[0]); lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[1]); lp->ltvRecord.u.u16[2] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[2]); break; case CFG_FW_IDENTITY: lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[0]); lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[1]); lp->ltvRecord.u.u16[2] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[2]); lp->ltvRecord.u.u16[3] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[3]); break; /* case CFG_HSI_SUP_RANGE: */ case CFG_NIC_MFI_SUP_RANGE: case CFG_NIC_CFI_SUP_RANGE: case CFG_NIC_PROFILE: case CFG_FW_SUP_RANGE: lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[0]); lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[1]); lp->ltvRecord.u.u16[2] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[2]); lp->ltvRecord.u.u16[3] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[3]); lp->ltvRecord.u.u16[4] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[4]); break; case CFG_MFI_ACT_RANGES_STA: case CFG_CFI_ACT_RANGES_STA: case CFG_CUR_SCALE_THRH: case CFG_AUTHENTICATION_ALGORITHMS: for (i = 0; i < (lp->ltvRecord.len - 1); i++) lp->ltvRecord.u.u16[i] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[i]); break; /* done at init time, and endian handled then */ case CFG_PRI_IDENTITY: break; case CFG_MB_INFO: /* wvlanEndianTranslateMailbox(pLtv); */ break; /* MSF and HCF RIDS */ case CFG_IFB: case CFG_DRV_INFO: case CFG_AP_MODE: case CFG_ENCRYPT_STRING: case CFG_COUNTRY_STRING: case CFG_DRIVER_ENABLE: case CFG_WOLAS_ENABLE: default: break; } /* Copy the LTV into the user's buffer. */ copy_to_user(urq->data, &(lp->ltvRecord), urq->len); if (ltvAllocated) kfree(&(lp->ltvRecord)); urq->result = UIL_SUCCESS; } else { urq->result = UIL_FAILURE; } } else { DBG_ERROR(DbgInfo, ""UIL_ERR_WRONG_IFB\n""); urq->result = UIL_ERR_WRONG_IFB; } DBG_LEAVE(DbgInfo); return result; } /* wvlan_uil_get_info */ ",0 "static int hls_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) { HLSContext *c = s->priv_data; struct playlist *seek_pls = NULL; int i, seq_no; int j; int stream_subdemuxer_index; int64_t first_timestamp, seek_timestamp, duration; if ((flags & AVSEEK_FLAG_BYTE) || !(c->variants[0]->playlists[0]->finished || c->variants[0]->playlists[0]->type == PLS_TYPE_EVENT)) return AVERROR(ENOSYS); first_timestamp = c->first_timestamp == AV_NOPTS_VALUE ? 0 : c->first_timestamp; seek_timestamp = av_rescale_rnd(timestamp, AV_TIME_BASE, s->streams[stream_index]->time_base.den, flags & AVSEEK_FLAG_BACKWARD ? AV_ROUND_DOWN : AV_ROUND_UP); duration = s->duration == AV_NOPTS_VALUE ? 0 : s->duration; if (0 < duration && duration < seek_timestamp - first_timestamp) return AVERROR(EIO); /* find the playlist with the specified stream */ for (i = 0; i < c->n_playlists; i++) { struct playlist *pls = c->playlists[i]; for (j = 0; j < pls->n_main_streams; j++) { if (pls->main_streams[j] == s->streams[stream_index]) { seek_pls = pls; stream_subdemuxer_index = j; break; } } } /* check if the timestamp is valid for the playlist with the * specified stream index */ if (!seek_pls || !find_timestamp_in_playlist(c, seek_pls, seek_timestamp, &seq_no)) return AVERROR(EIO); /* set segment now so we do not need to search again below */ seek_pls->cur_seq_no = seq_no; seek_pls->seek_stream_index = stream_subdemuxer_index; for (i = 0; i < c->n_playlists; i++) { /* Reset reading */ struct playlist *pls = c->playlists[i]; if (pls->input) ff_format_io_close(pls->parent, &pls->input); av_packet_unref(&pls->pkt); reset_packet(&pls->pkt); pls->pb.eof_reached = 0; /* Clear any buffered data */ pls->pb.buf_end = pls->pb.buf_ptr = pls->pb.buffer; /* Reset the pos, to let the mpegts demuxer know we've seeked. */ pls->pb.pos = 0; /* Flush the packet queue of the subdemuxer. */ ff_read_frame_flush(pls->ctx); pls->seek_timestamp = seek_timestamp; pls->seek_flags = flags; if (pls != seek_pls) { /* set closest segment seq_no for playlists not handled above */ find_timestamp_in_playlist(c, pls, seek_timestamp, &pls->cur_seq_no); /* seek the playlist to the given position without taking * keyframes into account since this playlist does not have the * specified stream where we should look for the keyframes */ pls->seek_stream_index = -1; pls->seek_flags |= AVSEEK_FLAG_ANY; } } c->cur_timestamp = seek_timestamp; return 0; } ",0 "void user_free_preparse(struct key_preparsed_payload *prep) { kfree(prep->payload[0]); } ",0 "int parse_server_match_testspec(struct connection_info *ci, char *spec) { char *p; while ((p = strsep(&spec, "","")) && *p != '\0') { if (strncmp(p, ""addr="", 5) == 0) { ci->address = xstrdup(p + 5); } else if (strncmp(p, ""host="", 5) == 0) { ci->host = xstrdup(p + 5); } else if (strncmp(p, ""user="", 5) == 0) { ci->user = xstrdup(p + 5); } else if (strncmp(p, ""laddr="", 6) == 0) { ci->laddress = xstrdup(p + 6); } else if (strncmp(p, ""lport="", 6) == 0) { ci->lport = a2port(p + 6); if (ci->lport == -1) { fprintf(stderr, ""Invalid port '%s' in test mode"" "" specification %s\n"", p+6, p); return -1; } } else { fprintf(stderr, ""Invalid test mode specification %s\n"", p); return -1; } } return 0; } ",0 "void reds_register_channel(RedChannel *channel) { spice_assert(reds); ring_add(&reds->channels, &channel->link); reds->num_of_channels++; } ",0 "long long Chapters::Atom::GetStopTime(const Chapters* pChapters) const { return GetTime(pChapters, m_stop_timecode); } ",1 "ash::NewWindowDelegate* ShellDelegateImpl::CreateNewWindowDelegate() { return new NewWindowDelegateImpl; } ",0 "static int lua_ap_stat(lua_State *L) { request_rec *r; const char *filename; apr_finfo_t file_info; apr_int32_t wanted; luaL_checktype(L, 1, LUA_TUSERDATA); luaL_checktype(L, 2, LUA_TSTRING); r = ap_lua_check_request_rec(L, 1); filename = lua_tostring(L, 2); wanted = luaL_optinteger(L, 3, APR_FINFO_MIN); if (apr_stat(&file_info, filename, wanted, r->pool) == OK) { lua_newtable(L); if (wanted & APR_FINFO_MTIME) { lua_pushstring(L, ""mtime""); lua_pushnumber(L, (lua_Number) file_info.mtime); lua_settable(L, -3); } if (wanted & APR_FINFO_ATIME) { lua_pushstring(L, ""atime""); lua_pushnumber(L, (lua_Number) file_info.atime); lua_settable(L, -3); } if (wanted & APR_FINFO_CTIME) { lua_pushstring(L, ""ctime""); lua_pushnumber(L, (lua_Number) file_info.ctime); lua_settable(L, -3); } if (wanted & APR_FINFO_SIZE) { lua_pushstring(L, ""size""); lua_pushnumber(L, (lua_Number) file_info.size); lua_settable(L, -3); } if (wanted & APR_FINFO_TYPE) { lua_pushstring(L, ""filetype""); lua_pushinteger(L, file_info.filetype); lua_settable(L, -3); } if (wanted & APR_FINFO_PROT) { lua_pushstring(L, ""protection""); lua_pushinteger(L, file_info.protection); lua_settable(L, -3); } return 1; } else { return 0; } } ",0 "void WebPage::platformPreferencesDidChange(const WebPreferencesStore& store) { FontSmoothingLevel fontSmoothingLevel = static_cast(store.getUInt32ValueForKey(WebPreferencesKey::fontSmoothingLevelKey())); #if PLATFORM(CG) FontSmoothingLevel adjustedLevel = fontSmoothingLevel; if (adjustedLevel == FontSmoothingLevelWindows) adjustedLevel = FontSmoothingLevelMedium; wkSetFontSmoothingLevel(adjustedLevel); #endif m_page->settings()->setFontRenderingMode(fontSmoothingLevel == FontSmoothingLevelWindows ? AlternateRenderingMode : NormalRenderingMode); } ",0 "filesystem_mount_completed_cb (DBusGMethodInvocation *context, Device *device, gboolean job_was_cancelled, int status, const char *stderr, const char *stdout, gpointer user_data) { MountData *data = (MountData *) user_data; uid_t uid; daemon_local_get_uid (device->priv->daemon, &uid, context); if (WEXITSTATUS (status) == 0 && !job_was_cancelled) { update_info (device); drain_pending_changes (device, FALSE); unlock_cd_tray (device); dbus_g_method_return (context, data->mount_point); } else { if (data->remove_dir_on_unmount) { mount_file_remove (device->priv->device_file, data->mount_point); if (g_rmdir (data->mount_point) != 0) { g_warning (""Error removing dir in late mount error path: %m""); } } if (job_was_cancelled) { throw_error (context, ERROR_CANCELLED, ""Job was cancelled""); } else if (WEXITSTATUS (status) == 32) { throw_error (context, ERROR_FILESYSTEM_DRIVER_MISSING, ""Error mounting: %s"", stderr); } else { throw_error (context, ERROR_FAILED, ""Error mounting: mount exited with exit code %d: %s"", WEXITSTATUS (status), stderr); } } } ",0 "static int exitcode_proc_open(struct inode *inode, struct file *file) { return single_open(file, exitcode_proc_show, NULL); } ",0 " void ResourcePrefetchPredictor::LearnOrigins( const std::string& host, const GURL& main_frame_origin, const std::map& summaries) { DCHECK_CURRENTLY_ON(BrowserThread::UI); if (host.size() > ResourcePrefetchPredictorTables::kMaxStringLength) return; OriginData data; bool exists = origin_data_->TryGetData(host, &data); if (!exists) { data.set_host(host); data.set_last_visit_time(base::Time::Now().ToInternalValue()); size_t origins_size = summaries.size(); auto ordered_origins = std::vector(origins_size); for (const auto& kv : summaries) { size_t index = kv.second.first_occurrence; DCHECK_LT(index, origins_size); ordered_origins[index] = &kv.second; } for (const OriginRequestSummary* summary : ordered_origins) { auto* origin_to_add = data.add_origins(); InitializeOriginStatFromOriginRequestSummary(origin_to_add, *summary); } } else { data.set_last_visit_time(base::Time::Now().ToInternalValue()); std::map old_index; int old_size = static_cast(data.origins_size()); for (int i = 0; i < old_size; ++i) { bool is_new = old_index.insert({GURL(data.origins(i).origin()), i}).second; DCHECK(is_new); } for (int i = 0; i < old_size; ++i) { auto* old_origin = data.mutable_origins(i); GURL origin(old_origin->origin()); auto it = summaries.find(origin); if (it == summaries.end()) { old_origin->set_number_of_misses(old_origin->number_of_misses() + 1); old_origin->set_consecutive_misses(old_origin->consecutive_misses() + 1); } else { const auto& new_origin = it->second; old_origin->set_always_access_network(new_origin.always_access_network); old_origin->set_accessed_network(new_origin.accessed_network); int position = new_origin.first_occurrence + 1; int total = old_origin->number_of_hits() + old_origin->number_of_misses(); old_origin->set_average_position( ((old_origin->average_position() * total) + position) / (total + 1)); old_origin->set_number_of_hits(old_origin->number_of_hits() + 1); old_origin->set_consecutive_misses(0); } } for (const auto& kv : summaries) { if (old_index.find(kv.first) != old_index.end()) continue; auto* origin_to_add = data.add_origins(); InitializeOriginStatFromOriginRequestSummary(origin_to_add, kv.second); } } ResourcePrefetchPredictorTables::TrimOrigins(&data, config_.max_consecutive_misses); ResourcePrefetchPredictorTables::SortOrigins(&data, main_frame_origin.spec()); if (data.origins_size() > static_cast(config_.max_origins_per_entry)) { data.mutable_origins()->DeleteSubrange( config_.max_origins_per_entry, data.origins_size() - config_.max_origins_per_entry); } if (data.origins_size() == 0) origin_data_->DeleteData({host}); else origin_data_->UpdateData(host, data); } ",1 "static void drop_spte(struct kvm *kvm, u64 *sptep) { if (mmu_spte_clear_track_bits(sptep)) rmap_remove(kvm, sptep); } ",0 "static void hns_xgmac_exc_irq_en(struct mac_driver *drv, u32 en) { u32 clr_vlue = 0xfffffffful; u32 msk_vlue = en ? 0xfffffffful : 0; /*1 is en, 0 is dis*/ dsaf_write_dev(drv, XGMAC_INT_STATUS_REG, clr_vlue); dsaf_write_dev(drv, XGMAC_INT_ENABLE_REG, msk_vlue); } ",0 "static const char *direct_chunkreader(lua_State *lvm, void *udata, size_t *plen) { const char *p; struct cr_ctx *ctx = udata; if (ctx->startline) { *plen = ctx->startline > N_LF ? N_LF : ctx->startline; ctx->startline -= *plen; return lf; } *plen = config_getstr(ctx->cfp, ctx->buf, HUGE_STRING_LEN); for (p = ctx->buf; isspace(*p); ++p); if (p[0] == '<' && p[1] == '/') { apr_size_t i = 0; while (i < strlen(ctx->endstr)) { if (tolower(p[i + 2]) != ctx->endstr[i]) return ctx->buf; ++i; } *plen = 0; return NULL; } /*fprintf(stderr, ""buf read: %s\n"", ctx->buf); */ return ctx->buf; } ",0 "size_t pktlen(unsigned char *buf) { size_t hdr = sizeof(struct udphdr); return strlen((char *)buf + hdr) + hdr; } ",0 "long Segment::ParseNext( const Cluster* pCurr, const Cluster*& pResult, long long& pos, long& len) { assert(pCurr); assert(!pCurr->EOS()); assert(m_clusters); pResult = 0; if (pCurr->m_index >= 0) //loaded (not merely preloaded) { assert(m_clusters[pCurr->m_index] == pCurr); const long next_idx = pCurr->m_index + 1; if (next_idx < m_clusterCount) { pResult = m_clusters[next_idx]; return 0; //success } const long result = LoadCluster(pos, len); if (result < 0) //error or underflow return result; if (result > 0) //no more clusters { return 1; } pResult = GetLast(); return 0; //success } assert(m_pos > 0); long long total, avail; long status = m_pReader->Length(&total, &avail); if (status < 0) //error return status; assert((total < 0) || (avail <= total)); const long long segment_stop = (m_size < 0) ? -1 : m_start + m_size; pos = pCurr->m_element_start; if (pCurr->m_element_size >= 0) pos += pCurr->m_element_size; else { if ((pos + 1) > avail) { len = 1; return E_BUFFER_NOT_FULL; } long long result = GetUIntLength(m_pReader, pos, len); if (result < 0) //error return static_cast(result); if (result > 0) //weird return E_BUFFER_NOT_FULL; if ((segment_stop >= 0) && ((pos + len) > segment_stop)) return E_FILE_FORMAT_INVALID; if ((pos + len) > avail) return E_BUFFER_NOT_FULL; const long long id = ReadUInt(m_pReader, pos, len); if (id != 0x0F43B675) //weird: not Cluster ID return -1; pos += len; //consume ID if ((pos + 1) > avail) { len = 1; return E_BUFFER_NOT_FULL; } result = GetUIntLength(m_pReader, pos, len); if (result < 0) //error return static_cast(result); if (result > 0) //weird return E_BUFFER_NOT_FULL; if ((segment_stop >= 0) && ((pos + len) > segment_stop)) return E_FILE_FORMAT_INVALID; if ((pos + len) > avail) return E_BUFFER_NOT_FULL; const long long size = ReadUInt(m_pReader, pos, len); if (size < 0) //error return static_cast(size); pos += len; //consume size field const long long unknown_size = (1LL << (7 * len)) - 1; if (size == unknown_size) //TODO: should never happen return E_FILE_FORMAT_INVALID; //TODO: resolve this if ((segment_stop >= 0) && ((pos + size) > segment_stop)) return E_FILE_FORMAT_INVALID; pos += size; //consume payload (that is, the current cluster) assert((segment_stop < 0) || (pos <= segment_stop)); } for (;;) { const long status = DoParseNext(pResult, pos, len); if (status <= 1) return status; } } ",1 "static int vlan_dev_fcoe_get_wwn(struct net_device *dev, u64 *wwn, int type) { struct net_device *real_dev = vlan_dev_info(dev)->real_dev; const struct net_device_ops *ops = real_dev->netdev_ops; int rc = -EINVAL; if (ops->ndo_fcoe_get_wwn) rc = ops->ndo_fcoe_get_wwn(real_dev, wwn, type); return rc; } ",0 "xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL); /* * the parent of an attribute or namespace node is the element * to which the attribute or namespace node is attached * !!!!!!!!!!!!! */ if (cur == NULL) { if (ctxt->context->node == NULL) return(NULL); switch (ctxt->context->node->type) { case XML_ELEMENT_NODE: case XML_TEXT_NODE: case XML_CDATA_SECTION_NODE: case XML_ENTITY_REF_NODE: case XML_ENTITY_NODE: case XML_PI_NODE: case XML_COMMENT_NODE: case XML_DTD_NODE: case XML_ELEMENT_DECL: case XML_ATTRIBUTE_DECL: case XML_ENTITY_DECL: case XML_NOTATION_NODE: case XML_XINCLUDE_START: case XML_XINCLUDE_END: if (ctxt->context->node->parent == NULL) return((xmlNodePtr) ctxt->context->doc); if ((ctxt->context->node->parent->type == XML_ELEMENT_NODE) && ((ctxt->context->node->parent->name[0] == ' ') || (xmlStrEqual(ctxt->context->node->parent->name, BAD_CAST ""fake node libxslt"")))) return(NULL); return(ctxt->context->node->parent); case XML_ATTRIBUTE_NODE: { xmlAttrPtr tmp = (xmlAttrPtr) ctxt->context->node; return(tmp->parent); } case XML_DOCUMENT_NODE: case XML_DOCUMENT_TYPE_NODE: case XML_DOCUMENT_FRAG_NODE: case XML_HTML_DOCUMENT_NODE: #ifdef LIBXML_DOCB_ENABLED case XML_DOCB_DOCUMENT_NODE: #endif return(NULL); case XML_NAMESPACE_DECL: { xmlNsPtr ns = (xmlNsPtr) ctxt->context->node; if ((ns->next != NULL) && (ns->next->type != XML_NAMESPACE_DECL)) return((xmlNodePtr) ns->next); /* Bad, how did that namespace end up here ? */ return(NULL); } } return(NULL); } if (cur == ctxt->context->doc->children) return((xmlNodePtr) ctxt->context->doc); if (cur == (xmlNodePtr) ctxt->context->doc) return(NULL); switch (cur->type) { case XML_ELEMENT_NODE: case XML_TEXT_NODE: case XML_CDATA_SECTION_NODE: case XML_ENTITY_REF_NODE: case XML_ENTITY_NODE: case XML_PI_NODE: case XML_COMMENT_NODE: case XML_NOTATION_NODE: case XML_DTD_NODE: case XML_ELEMENT_DECL: case XML_ATTRIBUTE_DECL: case XML_ENTITY_DECL: case XML_XINCLUDE_START: case XML_XINCLUDE_END: if (cur->parent == NULL) return(NULL); if ((cur->parent->type == XML_ELEMENT_NODE) && ((cur->parent->name[0] == ' ') || (xmlStrEqual(cur->parent->name, BAD_CAST ""fake node libxslt"")))) return(NULL); return(cur->parent); case XML_ATTRIBUTE_NODE: { xmlAttrPtr att = (xmlAttrPtr) ctxt->context->node; return(att->parent); } case XML_NAMESPACE_DECL: { xmlNsPtr ns = (xmlNsPtr) ctxt->context->node; if ((ns->next != NULL) && (ns->next->type != XML_NAMESPACE_DECL)) return((xmlNodePtr) ns->next); /* Bad, how did that namespace end up here ? */ return(NULL); } case XML_DOCUMENT_NODE: case XML_DOCUMENT_TYPE_NODE: case XML_DOCUMENT_FRAG_NODE: case XML_HTML_DOCUMENT_NODE: #ifdef LIBXML_DOCB_ENABLED case XML_DOCB_DOCUMENT_NODE: #endif return(NULL); } return(NULL); } ",0 "mayUserForceRm( ) { const char * PARAM_ALLOW_FORCE_RM = ""ALLOW_FORCE_RM""; char* tmp = param( PARAM_ALLOW_FORCE_RM ); if( tmp == NULL) { return true; } ClassAd tmpAd; const char * TESTNAME = ""test""; if(tmpAd.AssignExpr(TESTNAME, tmp) == FALSE) { fprintf(stderr, ""The configuration setting %s may be invalid. Treating as TRUE.\n"", PARAM_ALLOW_FORCE_RM); free(tmp); return true; } free(tmp); int is_okay = 0; if(tmpAd.EvalBool(TESTNAME, 0, is_okay)) { return is_okay; } else { return true; } } ",0 "std::string SizeToString(const gfx::Size& max_size) { return base::IntToString(max_size.width()) + ""x"" + base::IntToString(max_size.height()); } ",0 "void WebsiteSettings::PresentSitePermissions() { PermissionInfoList permission_info_list; WebsiteSettingsUI::PermissionInfo permission_info; for (size_t i = 0; i < arraysize(kPermissionType); ++i) { permission_info.type = kPermissionType[i]; content_settings::SettingInfo info; scoped_ptr value = content_settings_->GetWebsiteSetting( site_url_, site_url_, permission_info.type, std::string(), &info); DCHECK(value.get()); if (value->GetType() == base::Value::TYPE_INTEGER) { permission_info.setting = content_settings::ValueToContentSetting(value.get()); } else { NOTREACHED(); } permission_info.source = info.source; if (info.primary_pattern == ContentSettingsPattern::Wildcard() && info.secondary_pattern == ContentSettingsPattern::Wildcard()) { permission_info.default_setting = permission_info.setting; permission_info.setting = CONTENT_SETTING_DEFAULT; } else { permission_info.default_setting = content_settings_->GetDefaultContentSetting(permission_info.type, NULL); } if (permission_info.setting != CONTENT_SETTING_DEFAULT && permission_info.setting != permission_info.default_setting) { permission_info_list.push_back(permission_info); } } ui_->SetPermissionInfo(permission_info_list); } ",0 "void Document::dispatchUnloadEvents() { PluginScriptForbiddenScope forbidPluginDestructorScripting; if (m_parser) m_parser->stopParsing(); if (m_loadEventProgress == LoadEventNotRun) return; if (m_loadEventProgress <= UnloadEventInProgress) { Element* currentFocusedElement = focusedElement(); if (isHTMLInputElement(currentFocusedElement)) toHTMLInputElement(*currentFocusedElement).endEditing(); if (m_loadEventProgress < PageHideInProgress) { m_loadEventProgress = PageHideInProgress; if (LocalDOMWindow* window = domWindow()) window->dispatchEvent(PageTransitionEvent::create(EventTypeNames::pagehide, false), this); if (!m_frame) return; PageVisibilityState visibilityState = pageVisibilityState(); m_loadEventProgress = UnloadVisibilityChangeInProgress; if (visibilityState != PageVisibilityStateHidden && RuntimeEnabledFeatures::visibilityChangeOnUnloadEnabled()) { dispatchEvent(Event::createBubble(EventTypeNames::visibilitychange)); dispatchEvent(Event::createBubble(EventTypeNames::webkitvisibilitychange)); } if (!m_frame) return; DocumentLoader* documentLoader = m_frame->loader().provisionalDocumentLoader(); m_loadEventProgress = UnloadEventInProgress; Event* unloadEvent(Event::create(EventTypeNames::unload)); if (documentLoader && !documentLoader->timing().unloadEventStart() && !documentLoader->timing().unloadEventEnd()) { DocumentLoadTiming& timing = documentLoader->timing(); DCHECK(timing.navigationStart()); timing.markUnloadEventStart(); m_frame->localDOMWindow()->dispatchEvent(unloadEvent, this); timing.markUnloadEventEnd(); } else { m_frame->localDOMWindow()->dispatchEvent(unloadEvent, m_frame->document()); } } m_loadEventProgress = UnloadEventHandled; } if (!m_frame) return; bool keepEventListeners = m_frame->loader().provisionalDocumentLoader() && m_frame->shouldReuseDefaultView(m_frame->loader().provisionalDocumentLoader()->url()); if (!keepEventListeners) removeAllEventListenersRecursively(); } ",0 "static void mqueue_i_callback(struct rcu_head *head) { struct inode *inode = container_of(head, struct inode, i_rcu); kmem_cache_free(mqueue_inode_cachep, MQUEUE_I(inode)); } ",0 "int Document::RequestIdleCallback( ScriptedIdleTaskController::IdleTask* idle_task, const IdleRequestOptions& options) { return EnsureScriptedIdleTaskController().RegisterCallback(idle_task, options); } ",0 "free_cache(struct name_cache *cache) { size_t i; if (cache != NULL) { for (i = 0; i < cache->size; i++) free(cache->cache[i].name); free(cache); } } ",0 "static int macvlan_newlink(struct net *src_net, struct net_device *dev, struct nlattr *tb[], struct nlattr *data[]) { return macvlan_common_newlink(src_net, dev, tb, data, netif_rx, dev_forward_skb); } ",0 "bool InputMethodWin::IsWindowFocused(const TextInputClient* client) const { if (!client) return false; HWND attached_window_handle = GetAttachedWindowHandle(client); #if defined(USE_AURA) return attached_window_handle && GetActiveWindow() == attached_window_handle; #else return attached_window_handle && GetFocus() == attached_window_handle; #endif } ",0 "void RenderFrameImpl::OnCustomContextMenuAction( const CustomContextMenuContext& custom_context, unsigned action) { if (custom_context.request_id) { ContextMenuClient* client = pending_context_menus_.Lookup(custom_context.request_id); if (client) client->OnMenuAction(custom_context.request_id, action); } else { render_view_->webview()->PerformCustomContextMenuAction(action); } } ",0 "bool CSSStyleSheet::IsAlternate() const { if (owner_node_) { return owner_node_->IsElementNode() && ToElement(owner_node_)->getAttribute(relAttr).Contains(""alternate""); } return alternate_from_constructor_; } ",0 "error::Error GLES2DecoderImpl::HandleBindUniformLocationCHROMIUMBucket( uint32_t immediate_data_size, const volatile void* cmd_data) { const volatile gles2::cmds::BindUniformLocationCHROMIUMBucket& c = *static_cast< const volatile gles2::cmds::BindUniformLocationCHROMIUMBucket*>( cmd_data); GLuint program = static_cast(c.program); GLint location = static_cast(c.location); Bucket* bucket = GetBucket(c.name_bucket_id); if (!bucket || bucket->size() == 0) { return error::kInvalidArguments; } std::string name_str; if (!bucket->GetAsString(&name_str)) { return error::kInvalidArguments; } DoBindUniformLocationCHROMIUM(program, location, name_str); return error::kNoError; } ",0 "static void compat_dh_get0_key(const DH *dh, const BIGNUM **pub, const BIGNUM **priv) { if (pub != NULL) *pub = dh->pub_key; if (priv != NULL) *priv = dh->priv_key; } ",0 "void LockContentsView::DoLayout() { bool landscape = login_layout_util::ShouldShowLandscape(GetWidget()); for (auto& action : rotation_actions_) action.Run(landscape); const display::Display& display = display::Screen::GetScreen()->GetDisplayNearestWindow( GetWidget()->GetNativeWindow()); SetPreferredSize(display.size()); SizeToPreferredSize(); Layout(); } ",0 "void TopSitesCache::StoreRedirectChain(const RedirectList& redirects, size_t destination) { for (size_t i = 0; i < redirects.size(); i++) { if (!IsKnownURL(redirects[i])) { CanonicalURLEntry entry; entry.first = &(top_sites_[destination]); entry.second = i; canonical_urls_[entry] = destination; } } } ",0 "load_uri (WebKitWebView *web_view, GArray *argv, GString *result) { (void) web_view; (void) result; load_uri_imp (argv_idx (argv, 0)); } ",0 "void WorkerProcessLauncherTest::SetUp() { task_runner_ = new AutoThreadTaskRunner( message_loop_.message_loop_proxy(), base::Bind(&WorkerProcessLauncherTest::QuitMainMessageLoop, base::Unretained(this))); exit_code_ = STILL_ACTIVE; launcher_delegate_.reset(new MockProcessLauncherDelegate()); EXPECT_CALL(*launcher_delegate_, Send(_)) .Times(AnyNumber()) .WillRepeatedly(Return(false)); EXPECT_CALL(*launcher_delegate_, GetExitCode()) .Times(AnyNumber()) .WillRepeatedly(ReturnPointee(&exit_code_)); EXPECT_CALL(*launcher_delegate_, KillProcess(_)) .Times(AnyNumber()) .WillRepeatedly(Invoke(this, &WorkerProcessLauncherTest::KillProcess)); EXPECT_CALL(ipc_delegate_, OnMessageReceived(_)) .Times(AnyNumber()) .WillRepeatedly(Return(false)); } ",1 "static int cypress_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct usb_serial_port *port = tty->driver_data; struct cypress_private *priv = usb_get_serial_port_data(port); unsigned long flags; spin_lock_irqsave(&priv->lock, flags); if (set & TIOCM_RTS) priv->line_control |= CONTROL_RTS; if (set & TIOCM_DTR) priv->line_control |= CONTROL_DTR; if (clear & TIOCM_RTS) priv->line_control &= ~CONTROL_RTS; if (clear & TIOCM_DTR) priv->line_control &= ~CONTROL_DTR; priv->cmd_ctrl = 1; spin_unlock_irqrestore(&priv->lock, flags); return cypress_write(tty, port, NULL, 0); } ",0 "std::string Instance::GetURL() { return url_; } ",0 "JSValue jsTestObjConditionalAttr2(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestObj* castedThis = jsCast(asObject(slotBase)); UNUSED_PARAM(exec); TestObj* impl = static_cast(castedThis->impl()); JSValue result = jsNumber(impl->conditionalAttr2()); return result; } ",0 "static Image *ReadRGFImage(const ImageInfo *image_info,ExceptionInfo *exception) { Image *image; MagickBooleanType status; register IndexPacket *indexes; register PixelPacket *q; register ssize_t i, x; register unsigned char *p; size_t bit, byte; ssize_t y; unsigned char *data; /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickSignature); image=AcquireImage(image_info); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } /* Read RGF header. */ image->columns = (unsigned long) ReadBlobByte(image); image->rows = (unsigned long) ReadBlobByte(image); image->depth=8; image->storage_class=PseudoClass; image->colors=2; /* Initialize image structure. */ if (AcquireImageColormap(image,image->colors) == MagickFalse) ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); /* Initialize colormap. */ image->colormap[0].red=QuantumRange; image->colormap[0].green=QuantumRange; image->colormap[0].blue=QuantumRange; image->colormap[1].red=(Quantum) 0; image->colormap[1].green=(Quantum) 0; image->colormap[1].blue=(Quantum) 0; if (image_info->ping != MagickFalse) { (void) CloseBlob(image); return(GetFirstImageInList(image)); } /* Read hex image data. */ data=(unsigned char *) AcquireQuantumMemory(image->rows,image->columns* sizeof(*data)); if (data == (unsigned char *) NULL) ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); p=data; for (i=0; i < (ssize_t) (image->columns * image->rows); i++) { *p++=ReadBlobByte(image); } /* Convert RGF image to pixel packets. */ p=data; for (y=0; y < (ssize_t) image->rows; y++) { q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (PixelPacket *) NULL) break; indexes=GetAuthenticIndexQueue(image); bit=0; byte=0; for (x=0; x < (ssize_t) image->columns; x++) { if (bit == 0) byte=(size_t) (*p++); SetPixelIndex(indexes+x,(Quantum) ((byte & 0x01) != 0 ? 0x01 : 0x00)); bit++; byte>>=1; if (bit == 8) bit=0; } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } data=(unsigned char *) RelinquishMagickMemory(data); (void) SyncImage(image); (void) CloseBlob(image); return(GetFirstImageInList(image)); } ",1 "Node::NodeType Document::nodeType() const { return DOCUMENT_NODE; } ",0 "static PassRefPtr getBorderRadiusShorthandValue(const RenderStyle* style, RenderView* renderView) { RefPtr list = CSSValueList::createSlashSeparated(); bool showHorizontalBottomLeft = style->borderTopRightRadius().width() != style->borderBottomLeftRadius().width(); bool showHorizontalBottomRight = style->borderBottomRightRadius().width() != style->borderTopLeftRadius().width(); bool showHorizontalTopRight = style->borderTopRightRadius().width() != style->borderTopLeftRadius().width(); bool showVerticalBottomLeft = style->borderTopRightRadius().height() != style->borderBottomLeftRadius().height(); bool showVerticalBottomRight = (style->borderBottomRightRadius().height() != style->borderTopLeftRadius().height()) || showVerticalBottomLeft; bool showVerticalTopRight = (style->borderTopRightRadius().height() != style->borderTopLeftRadius().height()) || showVerticalBottomRight; bool showVerticalTopLeft = (style->borderTopLeftRadius().width() != style->borderTopLeftRadius().height()); RefPtr topLeftRadius = getBorderRadiusCornerValues(style->borderTopLeftRadius(), style, renderView); RefPtr topRightRadius = getBorderRadiusCornerValues(style->borderTopRightRadius(), style, renderView); RefPtr bottomRightRadius = getBorderRadiusCornerValues(style->borderBottomRightRadius(), style, renderView); RefPtr bottomLeftRadius = getBorderRadiusCornerValues(style->borderBottomLeftRadius(), style, renderView); RefPtr horizontalRadii = CSSValueList::createSpaceSeparated(); horizontalRadii->append(topLeftRadius->item(0)); if (showHorizontalTopRight) horizontalRadii->append(topRightRadius->item(0)); if (showHorizontalBottomRight) horizontalRadii->append(bottomRightRadius->item(0)); if (showHorizontalBottomLeft) horizontalRadii->append(bottomLeftRadius->item(0)); list->append(horizontalRadii); if (showVerticalTopLeft) { RefPtr verticalRadii = CSSValueList::createSpaceSeparated(); verticalRadii->append(topLeftRadius->item(1)); if (showVerticalTopRight) verticalRadii->append(topRightRadius->item(1)); if (showVerticalBottomRight) verticalRadii->append(bottomRightRadius->item(1)); if (showVerticalBottomLeft) verticalRadii->append(bottomLeftRadius->item(1)); list->append(verticalRadii); } return list.release(); } ",0 "void FrameLoader::handleFallbackContent() { HTMLFrameOwnerElement* owner = m_frame->ownerElement(); if (!owner || !owner->hasTagName(objectTag)) return; static_cast(owner)->renderFallbackContent(); } ",0 "mark_trusted_task_done (GObject *source_object, GAsyncResult *res, gpointer user_data) { MarkTrustedJob *job = user_data; g_object_unref (job->file); if (job->done_callback) { job->done_callback (!job_aborted ((CommonJob *) job), job->done_callback_data); } finalize_common ((CommonJob *) job); } ",1 "void SessionService::TabNavigationPathPrunedFromBack(const SessionID& window_id, const SessionID& tab_id, int count) { if (!ShouldTrackChangesToWindow(window_id)) return; TabNavigationPathPrunedFromBackPayload payload = { 0 }; payload.id = tab_id.id(); payload.index = count; SessionCommand* command = new SessionCommand(kCommandTabNavigationPathPrunedFromBack, sizeof(payload)); memcpy(command->contents(), &payload, sizeof(payload)); ScheduleCommand(command); } ",0 "void btrfs_destroy_cachep(void) { /* * Make sure all delayed rcu free inodes are flushed before we * destroy cache. */ rcu_barrier(); if (btrfs_inode_cachep) kmem_cache_destroy(btrfs_inode_cachep); if (btrfs_trans_handle_cachep) kmem_cache_destroy(btrfs_trans_handle_cachep); if (btrfs_transaction_cachep) kmem_cache_destroy(btrfs_transaction_cachep); if (btrfs_path_cachep) kmem_cache_destroy(btrfs_path_cachep); if (btrfs_free_space_cachep) kmem_cache_destroy(btrfs_free_space_cachep); if (btrfs_delalloc_work_cachep) kmem_cache_destroy(btrfs_delalloc_work_cachep); } ",0 "static void __exit l2tp_ip6_exit(void) { inet6_unregister_protosw(&l2tp_ip6_protosw); inet6_del_protocol(&l2tp_ip6_protocol, IPPROTO_L2TP); proto_unregister(&l2tp_ip6_prot); } ",0 "void BrowserView::ProcessFullscreen(bool fullscreen, FullscreenType type, const GURL& url, FullscreenExitBubbleType bubble_type) { ignore_layout_ = true; LocationBarView* location_bar = GetLocationBarView(); #if defined(OS_WIN) && !defined(USE_AURA) OmniboxViewWin* omnibox_win = GetOmniboxViewWin(location_bar->GetLocationEntry()); #endif if (type == FOR_METRO || !fullscreen) { fullscreen_bubble_.reset(); } if (fullscreen) { views::FocusManager* focus_manager = GetFocusManager(); DCHECK(focus_manager); if (location_bar->Contains(focus_manager->GetFocusedView())) focus_manager->ClearFocus(); #if defined(OS_WIN) && !defined(USE_AURA) if (omnibox_win) { omnibox_win->set_force_hidden(true); ShowWindow(omnibox_win->m_hWnd, SW_HIDE); } #endif } #if defined(OS_WIN) && !defined(USE_AURA) views::ScopedFullscreenVisibility visibility(frame_->GetNativeView()); #endif if (type == FOR_METRO) { #if defined(OS_WIN) && !defined(USE_AURA) static_cast( frame_->native_widget())->SetMetroSnapFullscreen(fullscreen); #endif } else { frame_->SetFullscreen(fullscreen); } browser_->WindowFullscreenStateChanged(); if (fullscreen) { bool is_kiosk = CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode); if (!is_kiosk && type != FOR_METRO) { fullscreen_bubble_.reset(new FullscreenExitBubbleViews( GetWidget(), browser_.get(), url, bubble_type)); } } else { #if defined(OS_WIN) && !defined(USE_AURA) if (omnibox_win) { omnibox_win->set_force_hidden(false); ShowWindow(omnibox_win->m_hWnd, SW_SHOW); } #endif } ignore_layout_ = false; Layout(); } ",0 " static u32 vmx_exec_control(struct vcpu_vmx *vmx) { u32 exec_control = vmcs_config.cpu_based_exec_ctrl; if (vmx->vcpu.arch.switch_db_regs & KVM_DEBUGREG_WONT_EXIT) exec_control &= ~CPU_BASED_MOV_DR_EXITING; if (!cpu_need_tpr_shadow(&vmx->vcpu)) { exec_control &= ~CPU_BASED_TPR_SHADOW; #ifdef CONFIG_X86_64 exec_control |= CPU_BASED_CR8_STORE_EXITING | CPU_BASED_CR8_LOAD_EXITING; #endif } if (!enable_ept) exec_control |= CPU_BASED_CR3_STORE_EXITING | CPU_BASED_CR3_LOAD_EXITING | CPU_BASED_INVLPG_EXITING; return exec_control; } ",0 "bool cg_completion_timeout(void *fn, void *fnarg, int timeout) { struct cg_completion *cgc; pthread_t pthread; bool ret = false; cgc = (struct cg_completion *)malloc(sizeof(struct cg_completion)); if (unlikely(!cgc)) return ret; cgsem_init(&cgc->cgsem); #ifdef _MSC_VER cgc->fn = (void(__cdecl *)(void *))fn; #else cgc->fn = fn; #endif cgc->fnarg = fnarg; pthread_create(&pthread, NULL, completion_thread, (void *)cgc); ret = cgsem_mswait(&cgc->cgsem, timeout); if (ret) pthread_cancel(pthread); pthread_join(pthread, NULL); free(cgc); return !ret; } ",0 " image_transform_png_set_gray_to_rgb_add(image_transform *this, PNG_CONST image_transform **that, png_byte colour_type, png_byte bit_depth) { UNUSED(bit_depth) this->next = *that; *that = this; return (colour_type & PNG_COLOR_MASK_COLOR) == 0; } ",1 "const char *pdf_get_err(struct pdf_doc *pdf, int *errval) { if (!pdf) return NULL; if (pdf->errstr[0] == '\0') return NULL; if (errval) *errval = pdf->errval; return pdf->errstr; } ",0 "static void cherry_pick_list(struct commit_list *list, struct rev_info *revs) { struct commit_list *p; int left_count = 0, right_count = 0; int left_first; struct patch_ids ids; unsigned cherry_flag; /* First count the commits on the left and on the right */ for (p = list; p; p = p->next) { struct commit *commit = p->item; unsigned flags = commit->object.flags; if (flags & BOUNDARY) ; else if (flags & SYMMETRIC_LEFT) left_count++; else right_count++; } if (!left_count || !right_count) return; left_first = left_count < right_count; init_patch_ids(&ids); ids.diffopts.pathspec = revs->diffopt.pathspec; /* Compute patch-ids for one side */ for (p = list; p; p = p->next) { struct commit *commit = p->item; unsigned flags = commit->object.flags; if (flags & BOUNDARY) continue; /* * If we have fewer left, left_first is set and we omit * commits on the right branch in this loop. If we have * fewer right, we skip the left ones. */ if (left_first != !!(flags & SYMMETRIC_LEFT)) continue; commit->util = add_commit_patch_id(commit, &ids); } /* either cherry_mark or cherry_pick are true */ cherry_flag = revs->cherry_mark ? PATCHSAME : SHOWN; /* Check the other side */ for (p = list; p; p = p->next) { struct commit *commit = p->item; struct patch_id *id; unsigned flags = commit->object.flags; if (flags & BOUNDARY) continue; /* * If we have fewer left, left_first is set and we omit * commits on the left branch in this loop. */ if (left_first == !!(flags & SYMMETRIC_LEFT)) continue; /* * Have we seen the same patch id? */ id = has_commit_patch_id(commit, &ids); if (!id) continue; id->seen = 1; commit->object.flags |= cherry_flag; } /* Now check the original side for seen ones */ for (p = list; p; p = p->next) { struct commit *commit = p->item; struct patch_id *ent; ent = commit->util; if (!ent) continue; if (ent->seen) commit->object.flags |= cherry_flag; commit->util = NULL; } free_patch_ids(&ids); } ",0 "static int fsck_walk_tree(struct tree *tree, void *data, struct fsck_options *options) { struct tree_desc desc; struct name_entry entry; int res = 0; const char *name; if (parse_tree(tree)) return -1; name = get_object_name(options, &tree->object); if (init_tree_desc_gently(&desc, tree->buffer, tree->size)) return -1; while (tree_entry_gently(&desc, &entry)) { struct object *obj; int result; if (S_ISGITLINK(entry.mode)) continue; if (S_ISDIR(entry.mode)) { obj = (struct object *)lookup_tree(entry.oid); if (name && obj) put_object_name(options, obj, ""%s%s/"", name, entry.path); result = options->walk(obj, OBJ_TREE, data, options); } else if (S_ISREG(entry.mode) || S_ISLNK(entry.mode)) { obj = (struct object *)lookup_blob(entry.oid); if (name && obj) put_object_name(options, obj, ""%s%s"", name, entry.path); result = options->walk(obj, OBJ_BLOB, data, options); } else { result = error(""in tree %s: entry %s has bad mode %.6o"", describe_object(options, &tree->object), entry.path, entry.mode); } if (result < 0) return result; if (!res) res = result; } return res; } ",0 "bool InputMethodController::SetSelectionOffsets( const PlainTextRange& selection_offsets) { return SetSelectionOffsets(selection_offsets, TypingContinuation::kEnd); } ",0 " FromMojom(media::mojom::VideoCaptureApi input, media::VideoCaptureApi* output) { switch (input) { case media::mojom::VideoCaptureApi::LINUX_V4L2_SINGLE_PLANE: *output = media::VideoCaptureApi::LINUX_V4L2_SINGLE_PLANE; return true; case media::mojom::VideoCaptureApi::WIN_MEDIA_FOUNDATION: *output = media::VideoCaptureApi::WIN_MEDIA_FOUNDATION; return true; case media::mojom::VideoCaptureApi::WIN_MEDIA_FOUNDATION_SENSOR: *output = media::VideoCaptureApi::WIN_MEDIA_FOUNDATION_SENSOR; return true; case media::mojom::VideoCaptureApi::WIN_DIRECT_SHOW: *output = media::VideoCaptureApi::WIN_DIRECT_SHOW; return true; case media::mojom::VideoCaptureApi::MACOSX_AVFOUNDATION: *output = media::VideoCaptureApi::MACOSX_AVFOUNDATION; return true; case media::mojom::VideoCaptureApi::MACOSX_DECKLINK: *output = media::VideoCaptureApi::MACOSX_DECKLINK; return true; case media::mojom::VideoCaptureApi::ANDROID_API1: *output = media::VideoCaptureApi::ANDROID_API1; return true; case media::mojom::VideoCaptureApi::ANDROID_API2_LEGACY: *output = media::VideoCaptureApi::ANDROID_API2_LEGACY; return true; case media::mojom::VideoCaptureApi::ANDROID_API2_FULL: *output = media::VideoCaptureApi::ANDROID_API2_FULL; return true; case media::mojom::VideoCaptureApi::ANDROID_API2_LIMITED: *output = media::VideoCaptureApi::ANDROID_API2_LIMITED; return true; case media::mojom::VideoCaptureApi::VIRTUAL_DEVICE: *output = media::VideoCaptureApi::VIRTUAL_DEVICE; return true; case media::mojom::VideoCaptureApi::UNKNOWN: *output = media::VideoCaptureApi::UNKNOWN; return true; } NOTREACHED(); return false; } ",0 "static void acpi_pcihp_update(AcpiPciHpState *s) { int i; for (i = 0; i < ACPI_PCIHP_MAX_HOTPLUG_BUS; ++i) { acpi_pcihp_update_hotplug_bus(s, i); } } ",0 "void RenderWidgetHostViewAura::HandleParentBoundsChanged() { SnapToPhysicalPixelBoundary(); #if defined(OS_WIN) if (legacy_render_widget_host_HWND_) { legacy_render_widget_host_HWND_->SetBounds( window_->GetBoundsInRootWindow()); } #endif if (!in_shutdown_) { if (host_->delegate()) host_->delegate()->SendScreenRects(); else host_->SendScreenRects(); } } ",0 "::Cursor CreateInvisibleCursor() { Display* xdisplay = ui::GetXDisplay(); ::Cursor invisible_cursor; char nodata[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; XColor black; black.red = black.green = black.blue = 0; Pixmap blank = XCreateBitmapFromData(xdisplay, DefaultRootWindow(xdisplay), nodata, 8, 8); invisible_cursor = XCreatePixmapCursor(xdisplay, blank, blank, &black, &black, 0, 0); XFreePixmap(xdisplay, blank); return invisible_cursor; } ",0 " virtual void SetupFakeUI(bool expect_started) { media_stream_manager_->UseFakeUIFactoryForTests( base::Bind(&MediaStreamDispatcherHostTest::CreateMockUI, base::Unretained(this), expect_started)); } ",0 "static int comparearrays(i_ctx_t * i_ctx_p, ref *m1, ref *m2) { int i, code; ref ref1, ref2; if (r_size(m1) != r_size(m2)) return 0; for (i=0;i < r_size(m1);i++) { code = array_get(imemory, m1, i, &ref1); if (code < 0) return 0; code = array_get(imemory, m2, i, &ref2); if (code < 0) return 0; if (r_type(&ref1) != r_type(&ref2)) return 0; code = r_type(&ref1); if (code < 0) return code; switch(r_type(&ref1)) { case t_null: break; case t_boolean: if (ref1.value.boolval != ref2.value.boolval) return 0; break; case t_integer: if (ref1.value.intval != ref2.value.intval) return 0; break; case t_real: if (ref1.value.realval != ref2.value.realval) return 0; break; case t_name: if (!name_eq(&ref1, &ref2)) return 0; break; case t_string: if (r_size(&ref1) != r_size(&ref2)) return 0; if (strncmp((const char *)ref1.value.const_bytes, (const char *)ref2.value.const_bytes, r_size(&ref1)) != 0) return 0; break; case t_array: case t_mixedarray: case t_shortarray: if (!comparearrays(i_ctx_p, &ref1, &ref2)) return 0; break; case t_oparray: break; case t_operator: if (ref1.value.opproc != ref2.value.opproc) return 0; break; case t__invalid: case t_dictionary: case t_file: case t_unused_array_: case t_struct: case t_astruct: case t_fontID: case t_save: case t_mark: case t_device: return 0; default: /* Some high frequency operators are defined starting at t_next_index * I think as long as the 'type' of each is the same, we are OK */ break; } } return 1; } ",0 "static void kvm_set_hflags(struct kvm_vcpu *vcpu, unsigned emul_flags) { unsigned changed = vcpu->arch.hflags ^ emul_flags; vcpu->arch.hflags = emul_flags; if (changed & HF_SMM_MASK) kvm_smm_changed(vcpu); } ",0 " ExtensionDevToolsClientHost::~ExtensionDevToolsClientHost() { if (infobar_) infobar_->Remove(this); g_attached_client_hosts.Get().erase(this); } ",0 "std::unique_ptr CreateSession( SpdySessionDependencies* session_deps) { return SpdySessionDependencies::SpdyCreateSession(session_deps); } ",0 "drop_capabilities(int parent) { int rc, ncaps; cap_t caps; cap_value_t cap_list[3]; rc = prune_bounding_set(); if (rc) return rc; caps = cap_get_proc(); if (caps == NULL) { fprintf(stderr, ""Unable to get current capability set: %s\n"", strerror(errno)); return EX_SYSERR; } if (cap_clear(caps) == -1) { fprintf(stderr, ""Unable to clear capability set: %s\n"", strerror(errno)); rc = EX_SYSERR; goto free_caps; } if (parent || getuid() == 0) { ncaps = 1; cap_list[0] = CAP_DAC_READ_SEARCH; if (parent) { cap_list[1] = CAP_DAC_OVERRIDE; cap_list[2] = CAP_SYS_ADMIN; ncaps += 2; } if (cap_set_flag(caps, CAP_PERMITTED, ncaps, cap_list, CAP_SET) == -1) { fprintf(stderr, ""Unable to set permitted capabilities: %s\n"", strerror(errno)); rc = EX_SYSERR; goto free_caps; } if (parent) { cap_list[0] = CAP_SYS_ADMIN; if (cap_set_flag(caps, CAP_EFFECTIVE, 1, cap_list, CAP_SET) == -1) { fprintf(stderr, ""Unable to set effective capabilities: %s\n"", strerror(errno)); rc = EX_SYSERR; goto free_caps; } } } if (cap_set_proc(caps) != 0) { fprintf(stderr, ""Unable to set current process capabilities: %s\n"", strerror(errno)); rc = EX_SYSERR; } free_caps: cap_free(caps); return rc; } ",0 "void LocalDOMWindow::DispatchWindowLoadEvent() { #if DCHECK_IS_ON() DCHECK(!EventDispatchForbiddenScope::IsEventDispatchForbidden()); #endif if (ScopedEventQueue::Instance()->ShouldQueueEvents() && document_) { document_->GetTaskRunner(TaskType::kNetworking) ->PostTask(FROM_HERE, WTF::Bind(&LocalDOMWindow::DispatchLoadEvent, WrapPersistent(this))); return; } DispatchLoadEvent(); } ",0 "void WebContentsImpl::CreateNewWindow( int route_id, int main_frame_route_id, const ViewHostMsg_CreateWindow_Params& params, SessionStorageNamespace* session_storage_namespace) { bool is_guest = GetRenderProcessHost()->IsGuest(); scoped_refptr site_instance = params.opener_suppressed && !is_guest ? SiteInstance::CreateForURL(GetBrowserContext(), params.target_url) : GetSiteInstance(); const std::string& partition_id = GetContentClient()->browser()-> GetStoragePartitionIdForSite(GetBrowserContext(), site_instance->GetSiteURL()); StoragePartition* partition = BrowserContext::GetStoragePartition( GetBrowserContext(), site_instance.get()); DOMStorageContextWrapper* dom_storage_context = static_cast(partition->GetDOMStorageContext()); SessionStorageNamespaceImpl* session_storage_namespace_impl = static_cast(session_storage_namespace); CHECK(session_storage_namespace_impl->IsFromContext(dom_storage_context)); if (delegate_ && !delegate_->ShouldCreateWebContents(this, route_id, params.window_container_type, params.frame_name, params.target_url, partition_id, session_storage_namespace)) { GetRenderViewHost()->GetProcess()->ResumeRequestsForView(route_id); GetRenderViewHost()->GetProcess()->ResumeRequestsForView( main_frame_route_id); return; } WebContentsImpl* new_contents = new WebContentsImpl(GetBrowserContext(), params.opener_suppressed ? NULL : this); new_contents->GetController().SetSessionStorageNamespace( partition_id, session_storage_namespace); CreateParams create_params(GetBrowserContext(), site_instance.get()); create_params.routing_id = route_id; create_params.main_frame_routing_id = main_frame_route_id; if (!is_guest) { create_params.context = view_->GetNativeView(); create_params.initial_size = view_->GetContainerSize(); } else { int instance_id = GetBrowserPluginGuestManager()->get_next_instance_id(); WebContentsImpl* new_contents_impl = static_cast(new_contents); BrowserPluginGuest::CreateWithOpener(instance_id, new_contents_impl, GetBrowserPluginGuest(), !!new_contents_impl->opener()); } if (params.disposition == NEW_BACKGROUND_TAB) create_params.initially_hidden = true; new_contents->Init(create_params); if (!params.opener_suppressed) { if (!is_guest) { WebContentsViewPort* new_view = new_contents->view_.get(); new_view->CreateViewForWidget(new_contents->GetRenderViewHost()); } DCHECK_NE(MSG_ROUTING_NONE, route_id); pending_contents_[route_id] = new_contents; AddDestructionObserver(new_contents); } if (delegate_) { delegate_->WebContentsCreated( this, params.opener_frame_id, params.frame_name, params.target_url, new_contents); } if (params.opener_suppressed) { bool was_blocked = false; if (delegate_) { gfx::Rect initial_pos; delegate_->AddNewContents( this, new_contents, params.disposition, initial_pos, params.user_gesture, &was_blocked); } if (!was_blocked) { OpenURLParams open_params(params.target_url, Referrer(), CURRENT_TAB, PAGE_TRANSITION_LINK, true /* is_renderer_initiated */); open_params.user_gesture = params.user_gesture; new_contents->OpenURL(open_params); } } } ",0 "void RendererSchedulerImpl::AddWebViewScheduler( WebViewSchedulerImpl* web_view_scheduler) { main_thread_only().web_view_schedulers.insert(web_view_scheduler); } ",0 "GF_Box *stss_New() { ISOM_DECL_BOX_ALLOC(GF_SyncSampleBox, GF_ISOM_BOX_TYPE_STSS); return (GF_Box*)tmp; } ",0 "static enum entity_charset determine_charset(char *charset_hint TSRMLS_DC) { int i; enum entity_charset charset = cs_utf_8; int len = 0; const zend_encoding *zenc; /* Default is now UTF-8 */ if (charset_hint == NULL) return cs_utf_8; if ((len = strlen(charset_hint)) != 0) { goto det_charset; } zenc = zend_multibyte_get_internal_encoding(TSRMLS_C); if (zenc != NULL) { charset_hint = (char *)zend_multibyte_get_encoding_name(zenc); if (charset_hint != NULL && (len=strlen(charset_hint)) != 0) { if ((len == 4) /* sizeof (none|auto|pass) */ && (!memcmp(""pass"", charset_hint, 4) || !memcmp(""auto"", charset_hint, 4) || !memcmp(""auto"", charset_hint, 4))) { charset_hint = NULL; len = 0; } else { goto det_charset; } } } charset_hint = SG(default_charset); if (charset_hint != NULL && (len=strlen(charset_hint)) != 0) { goto det_charset; } /* try to detect the charset for the locale */ #if HAVE_NL_LANGINFO && HAVE_LOCALE_H && defined(CODESET) charset_hint = nl_langinfo(CODESET); if (charset_hint != NULL && (len=strlen(charset_hint)) != 0) { goto det_charset; } #endif #if HAVE_LOCALE_H /* try to figure out the charset from the locale */ { char *localename; char *dot, *at; /* lang[_territory][.codeset][@modifier] */ localename = setlocale(LC_CTYPE, NULL); dot = strchr(localename, '.'); if (dot) { dot++; /* locale specifies a codeset */ at = strchr(dot, '@'); if (at) len = at - dot; else len = strlen(dot); charset_hint = dot; } else { /* no explicit name; see if the name itself * is the charset */ charset_hint = localename; len = strlen(charset_hint); } } #endif det_charset: if (charset_hint) { int found = 0; /* now walk the charset map and look for the codeset */ for (i = 0; charset_map[i].codeset; i++) { if (len == strlen(charset_map[i].codeset) && strncasecmp(charset_hint, charset_map[i].codeset, len) == 0) { charset = charset_map[i].charset; found = 1; break; } } if (!found) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""charset `%s' not supported, assuming utf-8"", charset_hint); } } return charset; } ",1 "void SSLClientSocketOpenSSL::SetSubresourceSpeculation() { if (transport_.get() && transport_->socket()) { transport_->socket()->SetSubresourceSpeculation(); } else { NOTREACHED(); } } ",0 "gst_asf_demux_parse_stream_object (GstASFDemux * demux, guint8 * data, guint64 size) { AsfCorrectionType correction_type; AsfStreamType stream_type; GstClockTime time_offset; gboolean is_encrypted G_GNUC_UNUSED; guint16 stream_id; guint16 flags; ASFGuid guid; guint stream_specific_size; guint type_specific_size G_GNUC_UNUSED; guint unknown G_GNUC_UNUSED; gboolean inspect_payload = FALSE; AsfStream *stream = NULL; /* Get the rest of the header's header */ if (size < (16 + 16 + 8 + 4 + 4 + 2 + 4)) goto not_enough_data; gst_asf_demux_get_guid (&guid, &data, &size); stream_type = gst_asf_demux_identify_guid (asf_stream_guids, &guid); gst_asf_demux_get_guid (&guid, &data, &size); correction_type = gst_asf_demux_identify_guid (asf_correction_guids, &guid); time_offset = gst_asf_demux_get_uint64 (&data, &size) * 100; type_specific_size = gst_asf_demux_get_uint32 (&data, &size); stream_specific_size = gst_asf_demux_get_uint32 (&data, &size); flags = gst_asf_demux_get_uint16 (&data, &size); stream_id = flags & 0x7f; is_encrypted = ! !((flags & 0x8000) << 15); unknown = gst_asf_demux_get_uint32 (&data, &size); GST_DEBUG_OBJECT (demux, ""Found stream %u, time_offset=%"" GST_TIME_FORMAT, stream_id, GST_TIME_ARGS (time_offset)); /* dvr-ms has audio stream declared in stream specific data */ if (stream_type == ASF_STREAM_EXT_EMBED_HEADER) { AsfExtStreamType ext_stream_type; gst_asf_demux_get_guid (&guid, &data, &size); ext_stream_type = gst_asf_demux_identify_guid (asf_ext_stream_guids, &guid); if (ext_stream_type == ASF_EXT_STREAM_AUDIO) { inspect_payload = TRUE; gst_asf_demux_get_guid (&guid, &data, &size); gst_asf_demux_get_uint32 (&data, &size); gst_asf_demux_get_uint32 (&data, &size); gst_asf_demux_get_uint32 (&data, &size); gst_asf_demux_get_guid (&guid, &data, &size); gst_asf_demux_get_uint32 (&data, &size); stream_type = ASF_STREAM_AUDIO; } } switch (stream_type) { case ASF_STREAM_AUDIO:{ asf_stream_audio audio_object; if (!gst_asf_demux_get_stream_audio (&audio_object, &data, &size)) goto not_enough_data; GST_INFO (""Object is an audio stream with %u bytes of additional data"", audio_object.size); stream = gst_asf_demux_add_audio_stream (demux, &audio_object, stream_id, &data, &size); switch (correction_type) { case ASF_CORRECTION_ON:{ guint span, packet_size, chunk_size, data_size, silence_data; GST_INFO (""Using error correction""); if (size < (1 + 2 + 2 + 2 + 1)) goto not_enough_data; span = gst_asf_demux_get_uint8 (&data, &size); packet_size = gst_asf_demux_get_uint16 (&data, &size); chunk_size = gst_asf_demux_get_uint16 (&data, &size); data_size = gst_asf_demux_get_uint16 (&data, &size); silence_data = gst_asf_demux_get_uint8 (&data, &size); stream->span = span; GST_DEBUG_OBJECT (demux, ""Descrambling ps:%u cs:%u ds:%u s:%u sd:%u"", packet_size, chunk_size, data_size, span, silence_data); if (stream->span > 1) { if (chunk_size == 0 || ((packet_size / chunk_size) <= 1)) { /* Disable descrambling */ stream->span = 0; } else { /* FIXME: this else branch was added for * weird_al_yankovic - the saga begins.asf */ stream->ds_packet_size = packet_size; stream->ds_chunk_size = chunk_size; } } else { /* Descambling is enabled */ stream->ds_packet_size = packet_size; stream->ds_chunk_size = chunk_size; } #if 0 /* Now skip the rest of the silence data */ if (data_size > 1) gst_bytestream_flush (demux->bs, data_size - 1); #else /* FIXME: CHECKME. And why -1? */ if (data_size > 1) { if (!gst_asf_demux_skip_bytes (data_size - 1, &data, &size)) { goto not_enough_data; } } #endif break; } case ASF_CORRECTION_OFF:{ GST_INFO (""Error correction off""); if (!gst_asf_demux_skip_bytes (stream_specific_size, &data, &size)) goto not_enough_data; break; } default: GST_ELEMENT_ERROR (demux, STREAM, DEMUX, (NULL), (""Audio stream using unknown error correction"")); return NULL; } break; } case ASF_STREAM_VIDEO:{ asf_stream_video_format video_format_object; asf_stream_video video_object; guint16 vsize; if (!gst_asf_demux_get_stream_video (&video_object, &data, &size)) goto not_enough_data; vsize = video_object.size - 40; /* Byte order gets offset by single byte */ GST_INFO (""object is a video stream with %u bytes of "" ""additional data"", vsize); if (!gst_asf_demux_get_stream_video_format (&video_format_object, &data, &size)) { goto not_enough_data; } stream = gst_asf_demux_add_video_stream (demux, &video_format_object, stream_id, &data, &size); break; } default: GST_WARNING_OBJECT (demux, ""Unknown stream type for stream %u"", stream_id); demux->other_streams = g_slist_append (demux->other_streams, GINT_TO_POINTER (stream_id)); break; } if (stream) stream->inspect_payload = inspect_payload; return stream; not_enough_data: { GST_WARNING_OBJECT (demux, ""Unexpected end of data parsing stream object""); /* we'll error out later if we found no streams */ return NULL; } } ",0 "struct inet_peer *inet_getpeer(const struct inetpeer_addr *daddr, int create) { struct inet_peer __rcu **stack[PEER_MAXDEPTH], ***stackptr; struct inet_peer_base *base = family_to_base(daddr->family); struct inet_peer *p; unsigned int sequence; int invalidated, gccnt = 0; /* Attempt a lockless lookup first. * Because of a concurrent writer, we might not find an existing entry. */ rcu_read_lock(); sequence = read_seqbegin(&base->lock); p = lookup_rcu(daddr, base); invalidated = read_seqretry(&base->lock, sequence); rcu_read_unlock(); if (p) return p; /* If no writer did a change during our lookup, we can return early. */ if (!create && !invalidated) return NULL; /* retry an exact lookup, taking the lock before. * At least, nodes should be hot in our cache. */ write_seqlock_bh(&base->lock); relookup: p = lookup(daddr, stack, base); if (p != peer_avl_empty) { atomic_inc(&p->refcnt); write_sequnlock_bh(&base->lock); return p; } if (!gccnt) { gccnt = inet_peer_gc(base, stack, stackptr); if (gccnt && create) goto relookup; } p = create ? kmem_cache_alloc(peer_cachep, GFP_ATOMIC) : NULL; if (p) { p->daddr = *daddr; atomic_set(&p->refcnt, 1); atomic_set(&p->rid, 0); atomic_set(&p->ip_id_count, (daddr->family == AF_INET) ? secure_ip_id(daddr->addr.a4) : secure_ipv6_id(daddr->addr.a6)); p->tcp_ts_stamp = 0; p->metrics[RTAX_LOCK-1] = INETPEER_METRICS_NEW; p->rate_tokens = 0; p->rate_last = 0; p->pmtu_expires = 0; p->pmtu_orig = 0; memset(&p->redirect_learned, 0, sizeof(p->redirect_learned)); /* Link the node. */ link_to_pool(p, base); base->total++; } write_sequnlock_bh(&base->lock); return p; } ",0 "void SocketStream::OnIOCompleted(int result) { DoLoop(result); } ",0 "void V8TestObject::NullableLongMethodMethodCallback(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_nullableLongMethod""); test_object_v8_internal::NullableLongMethodMethod(info); } ",0 "size_t crypto_sec_header_size( const char *crypto_cipher_type, const char *crypto_hash_type) { int crypto_cipher = string_to_crypto_cipher_type(crypto_cipher_type); int crypto_hash = string_to_crypto_hash_type(crypto_hash_type); size_t hdr_size = 0; hdr_size = sizeof(struct crypto_config_header); if (crypto_hash) { hdr_size += hash_len[crypto_hash]; } if (crypto_cipher) { hdr_size += SALT_SIZE; hdr_size += cypher_block_len[crypto_cipher]; } return hdr_size; } ",0 "string16 AutocompleteEditModel::GetDesiredTLD() const { return (control_key_state_ == DOWN_WITHOUT_CHANGE && inline_autocomplete_text_.empty() && !KeywordIsSelected())? ASCIIToUTF16(""com"") : string16(); } ",0 "static HTMLImageElement* ImageElementFromImageDocument(Document* document) { if (!document) return 0; if (!document->IsImageDocument()) return 0; HTMLElement* body = document->body(); if (!body) return 0; Node* node = body->firstChild(); if (!isHTMLImageElement(node)) return 0; return toHTMLImageElement(node); } ",0 " void CleanupSpareRenderProcessHost() { if (spare_render_process_host_) { spare_render_process_host_->Cleanup(); DropSpareRenderProcessHost(spare_render_process_host_); } } ",0 "summarize_gamma_errors(png_modifier *pm, png_const_charp who, int low_bit_depth, int indexed) { fflush(stderr); if (who) printf(""\nGamma correction with %s:\n"", who); else printf(""\nBasic gamma correction:\n""); if (low_bit_depth) { print_one("" 2 bit gray: "", pm->error_gray_2); print_one("" 4 bit gray: "", pm->error_gray_4); print_one("" 8 bit gray: "", pm->error_gray_8); print_one("" 8 bit color:"", pm->error_color_8); if (indexed) print_one("" indexed: "", pm->error_indexed); } print_one(""16 bit gray: "", pm->error_gray_16); print_one(""16 bit color:"", pm->error_color_16); fflush(stdout); } ",0 "void ff_thread_await_progress(ThreadFrame *f, int progress, int field) { } ",0 "static struct xps_map *expand_xps_map(struct xps_map *map, int cpu, u16 index) { struct xps_map *new_map; int alloc_len = XPS_MIN_MAP_ALLOC; int i, pos; for (pos = 0; map && pos < map->len; pos++) { if (map->queues[pos] != index) continue; return map; } /* Need to add queue to this CPU's existing map */ if (map) { if (pos < map->alloc_len) return map; alloc_len = map->alloc_len * 2; } /* Need to allocate new map to store queue on this CPU's map */ new_map = kzalloc_node(XPS_MAP_SIZE(alloc_len), GFP_KERNEL, cpu_to_node(cpu)); if (!new_map) return NULL; for (i = 0; i < pos; i++) new_map->queues[i] = map->queues[i]; new_map->alloc_len = alloc_len; new_map->len = pos; return new_map; } ",0 "ofputil_encode_port_desc_stats_request(enum ofp_version ofp_version, ofp_port_t port) { struct ofpbuf *request; switch (ofp_version) { case OFP10_VERSION: case OFP11_VERSION: case OFP12_VERSION: case OFP13_VERSION: case OFP14_VERSION: request = ofpraw_alloc(OFPRAW_OFPST10_PORT_DESC_REQUEST, ofp_version, 0); break; case OFP15_VERSION: case OFP16_VERSION:{ struct ofp15_port_desc_request *req; request = ofpraw_alloc(OFPRAW_OFPST15_PORT_DESC_REQUEST, ofp_version, 0); req = ofpbuf_put_zeros(request, sizeof *req); req->port_no = ofputil_port_to_ofp11(port); break; } default: OVS_NOT_REACHED(); } return request; } ",0 "static void ims_pcu_destroy_backlight(struct ims_pcu *pcu) { struct ims_pcu_backlight *backlight = &pcu->backlight; led_classdev_unregister(&backlight->cdev); cancel_work_sync(&backlight->work); } ",0 "void smp_br_send_pair_response(tSMP_CB* p_cb, tSMP_INT_DATA* p_data) { SMP_TRACE_DEBUG(""%s"", __func__); p_cb->local_i_key &= p_cb->peer_i_key; p_cb->local_r_key &= p_cb->peer_r_key; smp_send_cmd(SMP_OPCODE_PAIRING_RSP, p_cb); } ",0 "ExtensionWebContentsObserver::ExtensionWebContentsObserver( content::WebContents* web_contents) : content::WebContentsObserver(web_contents), browser_context_(web_contents->GetBrowserContext()), dispatcher_(browser_context_) { web_contents->ForEachFrame( base::Bind(&ExtensionWebContentsObserver::InitializeFrameHelper, base::Unretained(this))); dispatcher_.set_delegate(this); } ",0 "void Document::NavigateLocalAdsFrames() { DCHECK(frame_); for (Frame* child = frame_->Tree().FirstChild(); child; child = child->Tree().TraverseNext(frame_)) { if (child->IsLocalFrame()) { if (ToLocalFrame(child)->IsAdSubframe()) { ToLocalFrame(child)->Navigate( FrameLoadRequest(this, ResourceRequest(BlankURL())), WebFrameLoadType::kStandard); } } } } ",0 "void bgp_attr_unintern(struct attr **pattr) { struct attr *attr = *pattr; struct attr *ret; struct attr tmp; /* Decrement attribute reference. */ attr->refcnt--; tmp = *attr; /* If reference becomes zero then free attribute object. */ if (attr->refcnt == 0) { ret = hash_release(attrhash, attr); assert(ret != NULL); XFREE(MTYPE_ATTR, attr); *pattr = NULL; } bgp_attr_unintern_sub(&tmp); } ",0 "static void limitedToOnlyAttributeAttributeGetterCallback(v8::Local, const v8::PropertyCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMGetter""); TestObjectV8Internal::limitedToOnlyAttributeAttributeGetter(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "static struct dentry *end_creating(struct dentry *dentry) { inode_unlock(d_inode(dentry->d_parent)); return dentry; } ",0 "Buffer::Buffer(const HostResource& resource, const base::SharedMemoryHandle& shm_handle, uint32_t size) : Resource(OBJECT_IS_PROXY, resource), shm_(shm_handle, false), size_(size), map_count_(0) { } ",0 "void ExtensionPrefs::MakePathsAbsolute(DictionaryValue* dict) { if (!dict || dict->empty()) return; for (DictionaryValue::key_iterator i = dict->begin_keys(); i != dict->end_keys(); ++i) { DictionaryValue* extension_dict = NULL; if (!dict->GetDictionaryWithoutPathExpansion(*i, &extension_dict)) { NOTREACHED(); continue; } int location_value; if (extension_dict->GetInteger(kPrefLocation, &location_value) && location_value == Extension::LOAD) { continue; } FilePath::StringType path_string; if (!extension_dict->GetString(kPrefPath, &path_string)) continue; DCHECK(!FilePath(path_string).IsAbsolute()); extension_dict->SetString( kPrefPath, install_directory_.Append(path_string).value()); } } ",0 "void WorkerFetchContext::AddResourceTiming(const ResourceTimingInfo& info) { if (global_scope_->IsWorkletGlobalScope()) return; WorkerGlobalScopePerformance::performance(*ToWorkerGlobalScope(global_scope_)) ->AddResourceTiming(info); } ",0 "bool omx_vdec::execute_omx_flush(OMX_U32 flushType) { bool bRet = false; struct v4l2_plane plane; struct v4l2_buffer v4l2_buf; struct v4l2_decoder_cmd dec; DEBUG_PRINT_LOW(""in %s, flushing %u"", __func__, (unsigned int)flushType); memset((void *)&v4l2_buf,0,sizeof(v4l2_buf)); dec.cmd = V4L2_DEC_QCOM_CMD_FLUSH; DEBUG_PRINT_HIGH(""in %s: reconfig? %d"", __func__, in_reconfig); if (in_reconfig && flushType == OMX_CORE_OUTPUT_PORT_INDEX) { output_flush_progress = true; dec.flags = V4L2_DEC_QCOM_CMD_FLUSH_CAPTURE; } else { /* XXX: The driver/hardware does not support flushing of individual ports * in all states. So we pretty much need to flush both ports internally, * but client should only get the FLUSH_(INPUT|OUTPUT)_DONE for the one it * requested. Since OMX_COMPONENT_(OUTPUT|INPUT)_FLUSH_PENDING isn't set, * we automatically omit sending the FLUSH done for the ""opposite"" port. */ input_flush_progress = true; output_flush_progress = true; dec.flags = V4L2_DEC_QCOM_CMD_FLUSH_OUTPUT | V4L2_DEC_QCOM_CMD_FLUSH_CAPTURE; } if (ioctl(drv_ctx.video_driver_fd, VIDIOC_DECODER_CMD, &dec)) { DEBUG_PRINT_ERROR(""Flush Port (%u) Failed "", (unsigned int)flushType); bRet = false; } return bRet; } ",0 "static int cac_card_ctl(sc_card_t *card, unsigned long cmd, void *ptr) { cac_private_data_t * priv = CAC_DATA(card); LOG_FUNC_CALLED(card->ctx); sc_log(card->ctx, ""cmd=%ld ptr=%p"", cmd, ptr); if (priv == NULL) { LOG_FUNC_RETURN(card->ctx, SC_ERROR_INTERNAL); } switch(cmd) { case SC_CARDCTL_CAC_GET_ACA_PATH: return cac_get_ACA_path(card, (sc_path_t *) ptr); case SC_CARDCTL_GET_SERIALNR: return cac_get_serial_nr_from_CUID(card, (sc_serial_number_t *) ptr); case SC_CARDCTL_CAC_INIT_GET_GENERIC_OBJECTS: return cac_get_init_and_get_count(&priv->general_list, &priv->general_current, (int *)ptr); case SC_CARDCTL_CAC_INIT_GET_CERT_OBJECTS: return cac_get_init_and_get_count(&priv->pki_list, &priv->pki_current, (int *)ptr); case SC_CARDCTL_CAC_GET_NEXT_GENERIC_OBJECT: return cac_fill_object_info(&priv->general_list, &priv->general_current, (sc_pkcs15_data_info_t *)ptr); case SC_CARDCTL_CAC_GET_NEXT_CERT_OBJECT: return cac_fill_object_info(&priv->pki_list, &priv->pki_current, (sc_pkcs15_data_info_t *)ptr); case SC_CARDCTL_CAC_FINAL_GET_GENERIC_OBJECTS: return cac_final_iterator(&priv->general_list); case SC_CARDCTL_CAC_FINAL_GET_CERT_OBJECTS: return cac_final_iterator(&priv->pki_list); } LOG_FUNC_RETURN(card->ctx, SC_ERROR_NOT_SUPPORTED); } ",0 "Node* EventTargetNodeForDocument(Document* doc) { if (!doc) return 0; Node* node = doc->FocusedElement(); if (!node && doc->IsPluginDocument()) { PluginDocument* plugin_document = ToPluginDocument(doc); node = plugin_document->PluginNode(); } if (!node && doc->IsHTMLDocument()) node = doc->body(); if (!node) node = doc->documentElement(); return node; } ",0 " void JSExpect(const std::string& expression) { bool result; EXPECT_TRUE(content::ExecuteScriptAndExtractBool( browser()->tab_strip_model()->GetActiveWebContents(), ""window.domAutomationController.send(!!("" + expression + ""));"", &result)); EXPECT_TRUE(result) << expression; } ",0 "const AtomicString& Element::imageSourceURL() const { return getAttribute(srcAttr); } ",0 "void OneClickSigninSyncStarter::ConfirmAndSignin() { SigninManager* signin = SigninManagerFactory::GetForProfile(profile_); if (confirmation_required_ == CONFIRM_UNTRUSTED_SIGNIN) { EnsureBrowser(); browser_->window()->ShowOneClickSigninBubble( BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_SAML_MODAL_DIALOG, UTF8ToUTF16(signin->GetUsernameForAuthInProgress()), string16(), // No error message to display. base::Bind(&OneClickSigninSyncStarter::UntrustedSigninConfirmed, weak_pointer_factory_.GetWeakPtr())); } else { signin->CompletePendingSignin(); } } ",0 "void BrowserPluginGuest::DidFailProvisionalLoad( int64 frame_id, bool is_main_frame, const GURL& validated_url, int error_code, const string16& error_description, RenderViewHost* render_view_host) { std::string error_type; RemoveChars(net::ErrorToString(error_code), ""net::"", &error_type); SendMessageToEmbedder( new BrowserPluginMsg_LoadAbort(embedder_routing_id(), instance_id(), validated_url, is_main_frame, error_type)); } ",0 "user_set_location (AccountsUser *auser, GDBusMethodInvocation *context, const gchar *location) { User *user = (User*)auser; int uid; const gchar *action_id; if (!get_caller_uid (context, &uid)) { throw_error (context, ERROR_FAILED, ""identifying caller failed""); return FALSE; } if (accounts_user_get_uid (ACCOUNTS_USER (user)) == (uid_t) uid) action_id = ""org.freedesktop.accounts.change-own-user-data""; else action_id = ""org.freedesktop.accounts.user-administration""; daemon_local_check_auth (user->daemon, user, action_id, TRUE, user_change_location_authorized_cb, context, g_strdup (location), (GDestroyNotify)g_free); return TRUE; } ",0 "void svc_rdma_put_context(struct svc_rdma_op_ctxt *ctxt, int free_pages) { struct svcxprt_rdma *xprt = ctxt->xprt; int i; if (free_pages) for (i = 0; i < ctxt->count; i++) put_page(ctxt->pages[i]); spin_lock(&xprt->sc_ctxt_lock); xprt->sc_ctxt_used--; list_add(&ctxt->list, &xprt->sc_ctxts); spin_unlock(&xprt->sc_ctxt_lock); } ",0 "XNFrealloc(void *ptr, unsigned long amount) { void *ret = realloc(ptr, amount); if (!ret) FatalError(""XNFrealloc: Out of memory""); return ret; } ",0 "sess_auth_ntlm(struct sess_data *sess_data) { int rc = 0; struct smb_hdr *smb_buf; SESSION_SETUP_ANDX *pSMB; char *bcc_ptr; struct cifs_ses *ses = sess_data->ses; __u32 capabilities; __u16 bytes_remaining; /* old style NTLM sessionsetup */ /* wct = 13 */ rc = sess_alloc_buffer(sess_data, 13); if (rc) goto out; pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; bcc_ptr = sess_data->iov[2].iov_base; capabilities = cifs_ssetup_hdr(ses, pSMB); pSMB->req_no_secext.Capabilities = cpu_to_le32(capabilities); if (ses->user_name != NULL) { pSMB->req_no_secext.CaseInsensitivePasswordLength = cpu_to_le16(CIFS_AUTH_RESP_SIZE); pSMB->req_no_secext.CaseSensitivePasswordLength = cpu_to_le16(CIFS_AUTH_RESP_SIZE); /* calculate ntlm response and session key */ rc = setup_ntlm_response(ses, sess_data->nls_cp); if (rc) { cifs_dbg(VFS, ""Error %d during NTLM authentication\n"", rc); goto out; } /* copy ntlm response */ memcpy(bcc_ptr, ses->auth_key.response + CIFS_SESS_KEY_SIZE, CIFS_AUTH_RESP_SIZE); bcc_ptr += CIFS_AUTH_RESP_SIZE; memcpy(bcc_ptr, ses->auth_key.response + CIFS_SESS_KEY_SIZE, CIFS_AUTH_RESP_SIZE); bcc_ptr += CIFS_AUTH_RESP_SIZE; } else { pSMB->req_no_secext.CaseInsensitivePasswordLength = 0; pSMB->req_no_secext.CaseSensitivePasswordLength = 0; } if (ses->capabilities & CAP_UNICODE) { /* unicode strings must be word aligned */ if (sess_data->iov[0].iov_len % 2) { *bcc_ptr = 0; bcc_ptr++; } unicode_ssetup_strings(&bcc_ptr, ses, sess_data->nls_cp); } else { ascii_ssetup_strings(&bcc_ptr, ses, sess_data->nls_cp); } sess_data->iov[2].iov_len = (long) bcc_ptr - (long) sess_data->iov[2].iov_base; rc = sess_sendreceive(sess_data); if (rc) goto out; pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; smb_buf = (struct smb_hdr *)sess_data->iov[0].iov_base; if (smb_buf->WordCount != 3) { rc = -EIO; cifs_dbg(VFS, ""bad word count %d\n"", smb_buf->WordCount); goto out; } if (le16_to_cpu(pSMB->resp.Action) & GUEST_LOGIN) cifs_dbg(FYI, ""Guest login\n""); /* BB mark SesInfo struct? */ ses->Suid = smb_buf->Uid; /* UID left in wire format (le) */ cifs_dbg(FYI, ""UID = %llu\n"", ses->Suid); bytes_remaining = get_bcc(smb_buf); bcc_ptr = pByteArea(smb_buf); /* BB check if Unicode and decode strings */ if (bytes_remaining == 0) { /* no string area to decode, do nothing */ } else if (smb_buf->Flags2 & SMBFLG2_UNICODE) { /* unicode string area must be word-aligned */ if (((unsigned long) bcc_ptr - (unsigned long) smb_buf) % 2) { ++bcc_ptr; --bytes_remaining; } decode_unicode_ssetup(&bcc_ptr, bytes_remaining, ses, sess_data->nls_cp); } else { decode_ascii_ssetup(&bcc_ptr, bytes_remaining, ses, sess_data->nls_cp); } rc = sess_establish_session(sess_data); out: sess_data->result = rc; sess_data->func = NULL; sess_free_buffer(sess_data); kfree(ses->auth_key.response); ses->auth_key.response = NULL; } ",0 "static void vrend_draw_bind_vertex_binding(struct vrend_context *ctx, struct vrend_vertex_element_array *va) { int i; glBindVertexArray(va->id); if (ctx->sub->vbo_dirty) { for (i = 0; i < ctx->sub->num_vbos; i++) { struct vrend_resource *res = (struct vrend_resource *)ctx->sub->vbo[i].buffer; if (!res) glBindVertexBuffer(i, 0, 0, 0); else glBindVertexBuffer(i, res->id, ctx->sub->vbo[i].buffer_offset, ctx->sub->vbo[i].stride); } for (i = ctx->sub->num_vbos; i < ctx->sub->old_num_vbos; i++) { glBindVertexBuffer(i, 0, 0, 0); } ctx->sub->vbo_dirty = false; } } ",0 " SynchronousCompositorImpl::SynchronousCompositorImpl(WebContents* contents) : compositor_client_(NULL), output_surface_(NULL), begin_frame_source_(nullptr), contents_(contents), routing_id_(contents->GetRoutingID()), input_handler_(NULL), is_active_(false), renderer_needs_begin_frames_(false), weak_ptr_factory_(this) { DCHECK(contents); DCHECK_NE(routing_id_, MSG_ROUTING_NONE); } ",1 "static int ext4_write_begin(struct file *file, struct address_space *mapping, loff_t pos, unsigned len, unsigned flags, struct page **pagep, void **fsdata) { struct inode *inode = mapping->host; int ret, needed_blocks; handle_t *handle; int retries = 0; struct page *page; pgoff_t index; unsigned from, to; trace_ext4_write_begin(inode, pos, len, flags); /* * Reserve one block more for addition to orphan list in case * we allocate blocks but write fails for some reason */ needed_blocks = ext4_writepage_trans_blocks(inode) + 1; index = pos >> PAGE_CACHE_SHIFT; from = pos & (PAGE_CACHE_SIZE - 1); to = from + len; if (ext4_test_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA)) { ret = ext4_try_to_write_inline_data(mapping, inode, pos, len, flags, pagep); if (ret < 0) return ret; if (ret == 1) return 0; } /* * grab_cache_page_write_begin() can take a long time if the * system is thrashing due to memory pressure, or if the page * is being written back. So grab it first before we start * the transaction handle. This also allows us to allocate * the page (if needed) without using GFP_NOFS. */ retry_grab: page = grab_cache_page_write_begin(mapping, index, flags); if (!page) return -ENOMEM; unlock_page(page); retry_journal: handle = ext4_journal_start(inode, EXT4_HT_WRITE_PAGE, needed_blocks); if (IS_ERR(handle)) { page_cache_release(page); return PTR_ERR(handle); } lock_page(page); if (page->mapping != mapping) { /* The page got truncated from under us */ unlock_page(page); page_cache_release(page); ext4_journal_stop(handle); goto retry_grab; } /* In case writeback began while the page was unlocked */ wait_for_stable_page(page); #ifdef CONFIG_EXT4_FS_ENCRYPTION if (ext4_should_dioread_nolock(inode)) ret = ext4_block_write_begin(page, pos, len, ext4_get_block_write); else ret = ext4_block_write_begin(page, pos, len, ext4_get_block); #else if (ext4_should_dioread_nolock(inode)) ret = __block_write_begin(page, pos, len, ext4_get_block_write); else ret = __block_write_begin(page, pos, len, ext4_get_block); #endif if (!ret && ext4_should_journal_data(inode)) { ret = ext4_walk_page_buffers(handle, page_buffers(page), from, to, NULL, do_journal_get_write_access); } if (ret) { unlock_page(page); /* * __block_write_begin may have instantiated a few blocks * outside i_size. Trim these off again. Don't need * i_size_read because we hold i_mutex. * * Add inode to orphan list in case we crash before * truncate finishes */ if (pos + len > inode->i_size && ext4_can_truncate(inode)) ext4_orphan_add(handle, inode); ext4_journal_stop(handle); if (pos + len > inode->i_size) { ext4_truncate_failed_write(inode); /* * If truncate failed early the inode might * still be on the orphan list; we need to * make sure the inode is removed from the * orphan list in that case. */ if (inode->i_nlink) ext4_orphan_del(NULL, inode); } if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)) goto retry_journal; page_cache_release(page); return ret; } *pagep = page; return ret; } ",0 "void RenderViewImpl::OnResize(const gfx::Size& new_size, const gfx::Rect& resizer_rect, bool is_fullscreen) { if (webview()) { webview()->hidePopups(); if (send_preferred_size_changes_) { webview()->mainFrame()->setCanHaveScrollbars( ShouldDisplayScrollbars(new_size.width(), new_size.height())); } UpdateScrollState(webview()->mainFrame()); } RenderWidget::OnResize(new_size, resizer_rect, is_fullscreen); } ",0 "nfsd4_lookup_stateid(struct nfsd4_compound_state *cstate, stateid_t *stateid, unsigned char typemask, struct nfs4_stid **s, struct nfsd_net *nn) { __be32 status; if (ZERO_STATEID(stateid) || ONE_STATEID(stateid)) return nfserr_bad_stateid; status = lookup_clientid(&stateid->si_opaque.so_clid, cstate, nn); if (status == nfserr_stale_clientid) { if (cstate->session) return nfserr_bad_stateid; return nfserr_stale_stateid; } if (status) return status; *s = find_stateid_by_type(cstate->clp, stateid, typemask); if (!*s) return nfserr_bad_stateid; return nfs_ok; } ",0 "void InjectedBundlePage::didClearWindowForFrame(WKBundleFrameRef frame, WKBundleScriptWorldRef world) { if (!InjectedBundle::shared().isTestRunning()) return; JSGlobalContextRef context = WKBundleFrameGetJavaScriptContextForWorld(frame, world); JSObjectRef window = JSContextGetGlobalObject(context); if (WKBundleScriptWorldNormalWorld() != world) { JSObjectSetProperty(context, window, toJS(""__worldID"").get(), JSValueMakeNumber(context, TestRunner::worldIDForWorld(world)), kJSPropertyAttributeReadOnly, 0); return; } JSValueRef exception = 0; InjectedBundle::shared().testRunner()->makeWindowObject(context, window, &exception); InjectedBundle::shared().gcController()->makeWindowObject(context, window, &exception); InjectedBundle::shared().eventSendingController()->makeWindowObject(context, window, &exception); InjectedBundle::shared().textInputController()->makeWindowObject(context, window, &exception); InjectedBundle::shared().accessibilityController()->makeWindowObject(context, window, &exception); #if PLATFORM(QT) DumpRenderTreeSupportQt::injectInternalsObject(context); #else WebCoreTestSupport::injectInternalsObject(context); #endif } ",0 " t42_parse_charstrings( T42_Face face, T42_Loader loader ) { T42_Parser parser = &loader->parser; PS_Table code_table = &loader->charstrings; PS_Table name_table = &loader->glyph_names; PS_Table swap_table = &loader->swap_table; FT_Memory memory = parser->root.memory; FT_Error error; PSAux_Service psaux = (PSAux_Service)face->psaux; FT_Byte* cur; FT_Byte* limit = parser->root.limit; FT_UInt n; FT_UInt notdef_index = 0; FT_Byte notdef_found = 0; T1_Skip_Spaces( parser ); if ( parser->root.cursor >= limit ) { FT_ERROR(( ""t42_parse_charstrings: out of bounds\n"" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } if ( ft_isdigit( *parser->root.cursor ) ) { loader->num_glyphs = (FT_UInt)T1_ToInt( parser ); if ( parser->root.error ) return; } else if ( *parser->root.cursor == '<' ) { /* We have `<< ... >>'. Count the number of `/' in the dictionary */ /* to get its size. */ FT_UInt count = 0; T1_Skip_PS_Token( parser ); if ( parser->root.error ) return; T1_Skip_Spaces( parser ); cur = parser->root.cursor; while ( parser->root.cursor < limit ) { if ( *parser->root.cursor == '/' ) count++; else if ( *parser->root.cursor == '>' ) { loader->num_glyphs = count; parser->root.cursor = cur; /* rewind */ break; } T1_Skip_PS_Token( parser ); if ( parser->root.error ) return; T1_Skip_Spaces( parser ); } } else { FT_ERROR(( ""t42_parse_charstrings: invalid token\n"" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } if ( parser->root.cursor >= limit ) { FT_ERROR(( ""t42_parse_charstrings: out of bounds\n"" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } /* initialize tables */ error = psaux->ps_table_funcs->init( code_table, loader->num_glyphs, memory ); if ( error ) goto Fail; error = psaux->ps_table_funcs->init( name_table, loader->num_glyphs, memory ); if ( error ) goto Fail; /* Initialize table for swapping index notdef_index and */ /* index 0 names and codes (if necessary). */ error = psaux->ps_table_funcs->init( swap_table, 4, memory ); if ( error ) goto Fail; n = 0; for (;;) { /* The format is simple: */ /* `/glyphname' + index [+ def] */ T1_Skip_Spaces( parser ); cur = parser->root.cursor; if ( cur >= limit ) break; /* We stop when we find an `end' keyword or '>' */ if ( *cur == 'e' && cur + 3 < limit && cur[1] == 'n' && cur[2] == 'd' && t42_is_space( cur[3] ) ) break; if ( *cur == '>' ) break; T1_Skip_PS_Token( parser ); if ( parser->root.error ) return; if ( *cur == '/' ) { FT_PtrDist len; if ( cur + 1 >= limit ) { FT_ERROR(( ""t42_parse_charstrings: out of bounds\n"" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } cur++; /* skip `/' */ len = parser->root.cursor - cur; error = T1_Add_Table( name_table, n, cur, len + 1 ); if ( error ) goto Fail; /* add a trailing zero to the name table */ name_table->elements[n][len] = '\0'; /* record index of /.notdef */ if ( *cur == '.' && ft_strcmp( "".notdef"", (const char*)(name_table->elements[n]) ) == 0 ) { notdef_index = n; notdef_found = 1; } T1_Skip_Spaces( parser ); cur = parser->root.cursor; (void)T1_ToInt( parser ); if ( parser->root.cursor >= limit ) { FT_ERROR(( ""t42_parse_charstrings: out of bounds\n"" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } len = parser->root.cursor - cur; error = T1_Add_Table( code_table, n, cur, len + 1 ); if ( error ) goto Fail; code_table->elements[n][len] = '\0'; n++; if ( n >= loader->num_glyphs ) break; } } loader->num_glyphs = n; if ( !notdef_found ) { FT_ERROR(( ""t42_parse_charstrings: no /.notdef glyph\n"" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } /* if /.notdef does not occupy index 0, do our magic. */ if ( ft_strcmp( (const char*)"".notdef"", (const char*)name_table->elements[0] ) ) { /* Swap glyph in index 0 with /.notdef glyph. First, add index 0 */ /* name and code entries to swap_table. Then place notdef_index */ /* name and code entries into swap_table. Then swap name and code */ /* entries at indices notdef_index and 0 using values stored in */ /* swap_table. */ /* Index 0 name */ error = T1_Add_Table( swap_table, 0, name_table->elements[0], name_table->lengths [0] ); if ( error ) goto Fail; /* Index 0 code */ error = T1_Add_Table( swap_table, 1, code_table->elements[0], code_table->lengths [0] ); if ( error ) goto Fail; /* Index notdef_index name */ error = T1_Add_Table( swap_table, 2, name_table->elements[notdef_index], name_table->lengths [notdef_index] ); if ( error ) goto Fail; /* Index notdef_index code */ error = T1_Add_Table( swap_table, 3, code_table->elements[notdef_index], code_table->lengths [notdef_index] ); if ( error ) goto Fail; error = T1_Add_Table( name_table, notdef_index, swap_table->elements[0], swap_table->lengths [0] ); if ( error ) goto Fail; error = T1_Add_Table( code_table, notdef_index, swap_table->elements[1], swap_table->lengths [1] ); if ( error ) goto Fail; error = T1_Add_Table( name_table, 0, swap_table->elements[2], swap_table->lengths [2] ); if ( error ) goto Fail; error = T1_Add_Table( code_table, 0, swap_table->elements[3], swap_table->lengths [3] ); if ( error ) goto Fail; } return; Fail: parser->root.error = error; } ",1 "static int cfg_ivs(struct cryp_device_data *device_data, struct cryp_ctx *ctx) { int i; int status = 0; int num_of_regs = ctx->blocksize / 8; u32 iv[AES_BLOCK_SIZE / 4]; dev_dbg(device_data->dev, ""[%s]"", __func__); /* * Since we loop on num_of_regs we need to have a check in case * someone provides an incorrect blocksize which would force calling * cfg_iv with i greater than 2 which is an error. */ if (num_of_regs > 2) { dev_err(device_data->dev, ""[%s] Incorrect blocksize %d"", __func__, ctx->blocksize); return -EINVAL; } for (i = 0; i < ctx->blocksize / 4; i++) iv[i] = uint8p_to_uint32_be(ctx->iv + i*4); for (i = 0; i < num_of_regs; i++) { status = cfg_iv(device_data, iv[i*2], iv[i*2+1], (enum cryp_init_vector_index) i); if (status != 0) return status; } return status; } ",0 "PHP_FUNCTION(imageline) { zval *IM; long x1, y1, x2, y2, col; gdImagePtr im; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""rlllll"", &IM, &x1, &y1, &x2, &y2, &col) == FAILURE) { return; } ZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, ""Image"", le_gd); #ifdef HAVE_GD_BUNDLED if (im->antialias) { gdImageAALine(im, x1, y1, x2, y2, col); } else #endif { gdImageLine(im, x1, y1, x2, y2, col); } RETURN_TRUE; } ",0 "void sock_init_data(struct socket *sock, struct sock *sk) { skb_queue_head_init(&sk->sk_receive_queue); skb_queue_head_init(&sk->sk_write_queue); skb_queue_head_init(&sk->sk_error_queue); sk->sk_send_head = NULL; init_timer(&sk->sk_timer); sk->sk_allocation = GFP_KERNEL; sk->sk_rcvbuf = sysctl_rmem_default; sk->sk_sndbuf = sysctl_wmem_default; sk->sk_state = TCP_CLOSE; sk_set_socket(sk, sock); sock_set_flag(sk, SOCK_ZAPPED); if (sock) { sk->sk_type = sock->type; sk->sk_wq = sock->wq; sock->sk = sk; } else sk->sk_wq = NULL; rwlock_init(&sk->sk_callback_lock); lockdep_set_class_and_name(&sk->sk_callback_lock, af_callback_keys + sk->sk_family, af_family_clock_key_strings[sk->sk_family]); sk->sk_state_change = sock_def_wakeup; sk->sk_data_ready = sock_def_readable; sk->sk_write_space = sock_def_write_space; sk->sk_error_report = sock_def_error_report; sk->sk_destruct = sock_def_destruct; sk->sk_frag.page = NULL; sk->sk_frag.offset = 0; sk->sk_peek_off = -1; sk->sk_peer_pid = NULL; sk->sk_peer_cred = NULL; sk->sk_write_pending = 0; sk->sk_rcvlowat = 1; sk->sk_rcvtimeo = MAX_SCHEDULE_TIMEOUT; sk->sk_sndtimeo = MAX_SCHEDULE_TIMEOUT; sk->sk_stamp = ktime_set(-1L, 0); #ifdef CONFIG_NET_RX_BUSY_POLL sk->sk_napi_id = 0; sk->sk_ll_usec = sysctl_net_busy_read; #endif sk->sk_max_pacing_rate = ~0U; sk->sk_pacing_rate = ~0U; sk->sk_incoming_cpu = -1; /* * Before updating sk_refcnt, we must commit prior changes to memory * (Documentation/RCU/rculist_nulls.txt for details) */ smp_wmb(); atomic_set(&sk->sk_refcnt, 1); atomic_set(&sk->sk_drops, 0); } ",0 " void CloseDevToolsWindow() { DevToolsManager* devtools_manager = DevToolsManager::GetInstance(); Browser* browser = window_->browser(); devtools_manager->UnregisterDevToolsClientHostFor(inspected_rvh_); if (browser) BrowserClosedObserver close_observer(browser); } ",0 " void Initialize(MockRead* reads, size_t reads_count, MockWrite* writes, size_t writes_count, MockRead* spdy_reads, size_t spdy_reads_count, MockWrite* spdy_writes, size_t spdy_writes_count) { if (GetParam() == SPDY) { data_.reset(new DeterministicSocketData(spdy_reads, spdy_reads_count, spdy_writes, spdy_writes_count)); } else { data_.reset(new DeterministicSocketData(reads, reads_count, writes, writes_count)); } data_->set_connect_data(MockConnect(SYNCHRONOUS, OK)); data_->StopAfter(2); // Request / Response socket_factory().AddSocketDataProvider(data_.get()); if (GetParam() != HTTP) { ssl_data_.reset(new SSLSocketDataProvider(SYNCHRONOUS, OK)); if (GetParam() == SPDY) { InitializeSpdySsl(); } socket_factory().AddSSLSocketDataProvider(ssl_data_.get()); } } ",0 "void LoadingPredictor::HandleOmniboxHint(const GURL& url, bool preconnectable) { if (!url.is_valid() || !url.has_host() || !IsPreconnectAllowed(profile_)) return; GURL origin = url.GetOrigin(); bool is_new_origin = origin != last_omnibox_origin_; last_omnibox_origin_ = origin; base::TimeTicks now = base::TimeTicks::Now(); if (preconnectable) { if (is_new_origin || now - last_omnibox_preconnect_time_ >= kMinDelayBetweenPreconnectRequests) { last_omnibox_preconnect_time_ = now; url::Origin url_origin = url::Origin::Create(url); preconnect_manager()->StartPreconnectUrl( url, true, net::NetworkIsolationKey(url_origin, url_origin)); } return; } if (is_new_origin || now - last_omnibox_preresolve_time_ >= kMinDelayBetweenPreresolveRequests) { last_omnibox_preresolve_time_ = now; preconnect_manager()->StartPreresolveHost(url); } } ",0 "AXObject* AXLayoutObject::remoteSVGElementHitTest(const IntPoint& point) const { AXObject* remote = remoteSVGRootElement(); if (!remote) return 0; IntSize offset = point - roundedIntPoint(getBoundsInFrameCoordinates().location()); return remote->accessibilityHitTest(IntPoint(offset)); } ",0 "hashTableClear(HASH_TABLE *table) { size_t i; for (i = 0; i < table->size; i++) { table->mem->free_fcn(table->v[i]); table->v[i] = NULL; } table->used = 0; } ",0 "AutoAdvancingVirtualTimeDomain* RendererSchedulerImpl::GetVirtualTimeDomain() { return virtual_time_domain_.get(); } ",0 "void sock_release(struct socket *sock) { if (sock->ops) { struct module *owner = sock->ops->owner; sock->ops->release(sock); sock->ops = NULL; module_put(owner); } if (rcu_dereference_protected(sock->wq, 1)->fasync_list) pr_err(""%s: fasync list not empty!\n"", __func__); if (!sock->file) { iput(SOCK_INODE(sock)); return; } sock->file = NULL; } ",1 "struct inode *new_inode(struct super_block *sb) { struct inode *inode; spin_lock_prefetch(&inode_sb_list_lock); inode = new_inode_pseudo(sb); if (inode) inode_sb_list_add(inode); return inode; } ",0 " void appendCommentCallback(const xmlChar* s) { PendingCommentCallback* callback = new PendingCommentCallback; callback->s = xmlStrdup(s); m_callbacks.append(callback); } ",0 "static int get_bvr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd, const struct kvm_one_reg *reg, void __user *uaddr) { __u64 *r = &vcpu->arch.vcpu_debug_state.dbg_bvr[rd->reg]; if (copy_to_user(uaddr, r, KVM_REG_SIZE(reg->id)) != 0) return -EFAULT; return 0; } ",0 "const Vector& Document::shortcutIconURLs() { return iconURLs(Favicon); } ",0 "void HTMLConstructionSite::insertHTMLHtmlElement(AtomicHTMLToken& token) { ASSERT(!shouldFosterParent()); m_openElements.pushHTMLHtmlElement(attachToCurrent(createHTMLElement(token))); dispatchDocumentElementAvailableIfNeeded(); } ",0 "const extensions::Extension* FindCastExtension() { Profile* profile = ProfileManager::GetActiveUserProfile(); const extensions::ExtensionRegistry* extension_registry = extensions::ExtensionRegistry::Get(profile); const extensions::ExtensionSet& enabled_extensions = extension_registry->enabled_extensions(); for (size_t i = 0; i < arraysize(extensions::kChromecastExtensionIds); ++i) { const std::string extension_id(extensions::kChromecastExtensionIds[i]); if (enabled_extensions.Contains(extension_id)) { return extension_registry->GetExtensionById( extension_id, extensions::ExtensionRegistry::ENABLED); } } return nullptr; } ",0 "void webkit_web_view_load_uri(WebKitWebView* webView, const gchar* uri) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); g_return_if_fail(uri); WebKitWebFrame* frame = webView->priv->mainFrame; webkit_web_frame_load_uri(frame, uri); } ",0 "void RenderFrameImpl::UpdateNavigationState(DocumentState* document_state, bool was_within_same_document, bool content_initiated) { if (!pending_navigation_params_ || content_initiated) { document_state->set_navigation_state( NavigationStateImpl::CreateContentInitiated()); return; } DCHECK(!pending_navigation_params_->common_params.navigation_start.is_null()); document_state->set_navigation_state(CreateNavigationStateFromPending()); if (!was_within_same_document) { const CommonNavigationParams& common_params = pending_navigation_params_->common_params; bool load_data = !common_params.base_url_for_data_url.is_empty() && !common_params.history_url_for_data_url.is_empty() && common_params.url.SchemeIs(url::kDataScheme); document_state->set_was_load_data_with_base_url_request(load_data); if (load_data) document_state->set_data_url(common_params.url); } pending_navigation_params_.reset(); } ",0 "static void intr_callback(struct urb *urb) { pegasus_t *pegasus = urb->context; struct net_device *net; int res, status = urb->status; if (!pegasus) return; net = pegasus->net; switch (status) { case 0: break; case -ECONNRESET: /* unlink */ case -ENOENT: case -ESHUTDOWN: return; default: /* some Pegasus-I products report LOTS of data * toggle errors... avoid log spamming */ netif_dbg(pegasus, timer, net, ""intr status %d\n"", status); } if (urb->actual_length >= 6) { u8 *d = urb->transfer_buffer; /* byte 0 == tx_status1, reg 2B */ if (d[0] & (TX_UNDERRUN|EXCESSIVE_COL |LATE_COL|JABBER_TIMEOUT)) { pegasus->stats.tx_errors++; if (d[0] & TX_UNDERRUN) pegasus->stats.tx_fifo_errors++; if (d[0] & (EXCESSIVE_COL | JABBER_TIMEOUT)) pegasus->stats.tx_aborted_errors++; if (d[0] & LATE_COL) pegasus->stats.tx_window_errors++; } /* d[5].LINK_STATUS lies on some adapters. * d[0].NO_CARRIER kicks in only with failed TX. * ... so monitoring with MII may be safest. */ /* bytes 3-4 == rx_lostpkt, reg 2E/2F */ pegasus->stats.rx_missed_errors += ((d[3] & 0x7f) << 8) | d[4]; } res = usb_submit_urb(urb, GFP_ATOMIC); if (res == -ENODEV) netif_device_detach(pegasus->net); if (res) netif_err(pegasus, timer, net, ""can't resubmit interrupt urb, %d\n"", res); } ",0 " LayerTreeHostTestCompositeImmediatelyStateTransitions() : current_state_(kInvalid), current_begin_frame_args_() {} ",0 "static int gfs2_mmap(struct file *file, struct vm_area_struct *vma) { struct gfs2_inode *ip = GFS2_I(file->f_mapping->host); if (!(file->f_flags & O_NOATIME) && !IS_NOATIME(&ip->i_inode)) { struct gfs2_holder i_gh; int error; error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &i_gh); if (error) return error; /* grab lock to update inode */ gfs2_glock_dq_uninit(&i_gh); file_accessed(file); } vma->vm_ops = &gfs2_vm_ops; return 0; } ",0 "ResizeObserverController& Document::EnsureResizeObserverController() { if (!resize_observer_controller_) { resize_observer_controller_ = MakeGarbageCollected(); } return *resize_observer_controller_; } ",0 "static int cmp_gss_krb5_name(kadm5_server_handle_t handle, gss_name_t gss_name, krb5_principal princ) { krb5_principal princ2; int status; if (! gss_to_krb5_name(handle, gss_name, &princ2)) return 0; status = krb5_principal_compare(handle->context, princ, princ2); krb5_free_principal(handle->context, princ2); return status; } ",0 "void zend_shared_alloc_create_lock(void) { int val; #ifdef ZTS zts_lock = tsrm_mutex_alloc(); #endif sprintf(lockfile_name, ""%s/%sXXXXXX"", TMP_DIR, SEM_FILENAME_PREFIX); lock_file = mkstemp(lockfile_name); fchmod(lock_file, 0666); if (lock_file == -1) { zend_accel_error(ACCEL_LOG_FATAL, ""Unable to create lock file: %s (%d)"", strerror(errno), errno); } val = fcntl(lock_file, F_GETFD, 0); val |= FD_CLOEXEC; fcntl(lock_file, F_SETFD, val); unlink(lockfile_name); } ",0 "print_distance_range(FILE* f, OnigLen a, OnigLen b) { if (a == INFINITE_LEN) fputs(""inf"", f); else fprintf(f, ""(%u)"", a); fputs(""-"", f); if (b == INFINITE_LEN) fputs(""inf"", f); else fprintf(f, ""(%u)"", b); } ",0 "void RenderFrameImpl::SetCustomURLLoaderFactory( network::mojom::URLLoaderFactoryPtr factory) { GetLoaderFactoryBundle()->SetDefaultFactory(std::move(factory)); } ",0 "int xt_register_match(struct xt_match *match) { u_int8_t af = match->family; mutex_lock(&xt[af].mutex); list_add(&match->list, &xt[af].match); mutex_unlock(&xt[af].mutex); return 0; } ",0 "ofputil_count_queue_stats(const struct ofp_header *oh) { struct ofpbuf b = ofpbuf_const_initializer(oh, ntohs(oh->length)); ofpraw_pull_assert(&b); for (size_t n = 0; ; n++) { struct ofputil_queue_stats qs; if (ofputil_decode_queue_stats(&qs, &b)) { return n; } } } ",0 "static bool get_reqs_available(struct kioctx *ctx) { struct kioctx_cpu *kcpu; bool ret = false; unsigned long flags; local_irq_save(flags); kcpu = this_cpu_ptr(ctx->cpu); if (!kcpu->reqs_available) { int old, avail = atomic_read(&ctx->reqs_available); do { if (avail < ctx->req_batch) goto out; old = avail; avail = atomic_cmpxchg(&ctx->reqs_available, avail, avail - ctx->req_batch); } while (avail != old); kcpu->reqs_available += ctx->req_batch; } ret = true; kcpu->reqs_available--; out: local_irq_restore(flags); return ret; } ",0 "void CSoundFile::RetrigNote(CHANNELINDEX nChn, int param, int offset) { ModChannel &chn = m_PlayState.Chn[nChn]; int retrigSpeed = param & 0x0F; int16 retrigCount = chn.nRetrigCount; bool doRetrig = false; if(m_playBehaviour[kITRetrigger]) { if(m_PlayState.m_nTickCount == 0 && chn.rowCommand.note) { chn.nRetrigCount = param & 0xf; } else if(!chn.nRetrigCount || !--chn.nRetrigCount) { chn.nRetrigCount = param & 0xf; doRetrig = true; } } else if(m_playBehaviour[kFT2Retrigger] && (param & 0x100)) { if(m_SongFlags[SONG_FIRSTTICK]) { if(chn.rowCommand.instr > 0 && chn.rowCommand.IsNoteOrEmpty()) retrigCount = 1; if(chn.rowCommand.volcmd == VOLCMD_VOLUME && chn.rowCommand.vol != 0) { chn.nRetrigCount = retrigCount; return; } } if(retrigCount >= retrigSpeed) { if(!m_SongFlags[SONG_FIRSTTICK] || !chn.rowCommand.IsNote()) { doRetrig = true; retrigCount = 0; } } } else { if (GetType() & (MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT)) { if (!retrigSpeed) retrigSpeed = 1; if ((retrigCount) && (!(retrigCount % retrigSpeed))) doRetrig = true; retrigCount++; } else if(GetType() == MOD_TYPE_MTM) { doRetrig = m_PlayState.m_nTickCount == static_cast(param & 0x0F) && retrigSpeed != 0; } else { int realspeed = retrigSpeed; if ((param & 0x100) && (chn.rowCommand.volcmd == VOLCMD_VOLUME) && (chn.rowCommand.param & 0xF0)) realspeed++; if(!m_SongFlags[SONG_FIRSTTICK] || (param & 0x100)) { if (!realspeed) realspeed = 1; if ((!(param & 0x100)) && (m_PlayState.m_nMusicSpeed) && (!(m_PlayState.m_nTickCount % realspeed))) doRetrig = true; retrigCount++; } else if (GetType() & (MOD_TYPE_XM|MOD_TYPE_MT2)) retrigCount = 0; if (retrigCount >= realspeed) { if ((m_PlayState.m_nTickCount) || ((param & 0x100) && (!chn.rowCommand.note))) doRetrig = true; } if(m_playBehaviour[kFT2Retrigger] && param == 0) { doRetrig = (m_PlayState.m_nTickCount == 0); } } } if(chn.nLength == 0 && m_playBehaviour[kITShortSampleRetrig] && !chn.HasMIDIOutput()) { return; } if(doRetrig) { uint32 dv = (param >> 4) & 0x0F; int vol = chn.nVolume; if (dv) { if(!m_playBehaviour[kFT2Retrigger] || !(chn.rowCommand.volcmd == VOLCMD_VOLUME)) { if (retrigTable1[dv]) vol = (vol * retrigTable1[dv]) >> 4; else vol += ((int)retrigTable2[dv]) << 2; } Limit(vol, 0, 256); chn.dwFlags.set(CHN_FASTVOLRAMP); } uint32 note = chn.nNewNote; int32 oldPeriod = chn.nPeriod; if (note >= NOTE_MIN && note <= NOTE_MAX && chn.nLength) CheckNNA(nChn, 0, note, true); bool resetEnv = false; if(GetType() & (MOD_TYPE_XM | MOD_TYPE_MT2)) { if((chn.rowCommand.instr) && (param < 0x100)) { InstrumentChange(&chn, chn.rowCommand.instr, false, false); resetEnv = true; } if (param < 0x100) resetEnv = true; } bool fading = chn.dwFlags[CHN_NOTEFADE]; NoteChange(&chn, note, m_playBehaviour[kITRetrigger], resetEnv); if(fading && GetType() == MOD_TYPE_XM) chn.dwFlags.set(CHN_NOTEFADE); chn.nVolume = vol; if(m_nInstruments) { chn.rowCommand.note = static_cast(note); // No retrig without note... #ifndef NO_PLUGINS ProcessMidiOut(nChn); //Send retrig to Midi #endif // NO_PLUGINS } if ((GetType() & (MOD_TYPE_IT|MOD_TYPE_MPT)) && (!chn.rowCommand.note) && (oldPeriod)) chn.nPeriod = oldPeriod; if (!(GetType() & (MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT))) retrigCount = 0; if(m_playBehaviour[kITRetrigger]) chn.position.Set(0); offset--; if(offset >= 0 && offset <= static_cast(CountOf(chn.pModSample->cues)) && chn.pModSample != nullptr) { if(offset == 0) offset = chn.oldOffset; else offset = chn.oldOffset = chn.pModSample->cues[offset - 1]; SampleOffset(chn, offset); } } if(m_playBehaviour[kFT2Retrigger] && (param & 0x100)) retrigCount++; if(!m_playBehaviour[kITRetrigger]) chn.nRetrigCount = retrigCount; } ",0 "void TargetHandler::Wire(UberDispatcher* dispatcher) { frontend_.reset(new Target::Frontend(dispatcher->channel())); Target::Dispatcher::wire(dispatcher, this); } ",0 "void NaClProcessHost::OnResourcesReady() { NaClBrowser* nacl_browser = NaClBrowser::GetInstance(); if (!nacl_browser->IsReady() || !SendStart()) { DLOG(ERROR) << ""Cannot launch NaCl process""; delete this; } } ",0 "static int pskb_carve(struct sk_buff *skb, const u32 len, gfp_t gfp) { int headlen = skb_headlen(skb); if (len < headlen) return pskb_carve_inside_header(skb, len, headlen, gfp); else return pskb_carve_inside_nonlinear(skb, len, headlen, gfp); } ",0 "static inline int __ap_query_configuration(struct ap_config_info *config) { register unsigned long reg0 asm (""0"") = 0x04000000UL; register unsigned long reg1 asm (""1"") = -EINVAL; register unsigned char *reg2 asm (""2"") = (unsigned char *)config; asm volatile( "".long 0xb2af0000\n"" /* PQAP(QCI) */ ""0: la %1,0\n"" ""1:\n"" EX_TABLE(0b, 1b) : ""+d"" (reg0), ""+d"" (reg1), ""+d"" (reg2) : : ""cc""); return reg1; } ",0 "bool Document::dispatchBeforeUnloadEvent(ChromeClient& chromeClient, bool& didAllowNavigation) { if (!m_domWindow) return true; if (!body()) return true; if (processingBeforeUnload()) return false; RefPtrWillBeRawPtr protect(this); RefPtrWillBeRawPtr beforeUnloadEvent = BeforeUnloadEvent::create(); m_loadEventProgress = BeforeUnloadEventInProgress; m_domWindow->dispatchEvent(beforeUnloadEvent.get(), this); m_loadEventProgress = BeforeUnloadEventCompleted; if (!beforeUnloadEvent->defaultPrevented()) defaultEventHandler(beforeUnloadEvent.get()); if (!frame() || beforeUnloadEvent->returnValue().isNull()) return true; if (didAllowNavigation) { addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, ""Blocked attempt to show multiple 'beforeunload' confirmation panels for a single navigation."")); return true; } String text = beforeUnloadEvent->returnValue(); if (chromeClient.openBeforeUnloadConfirmPanel(text, m_frame)) { didAllowNavigation = true; return true; } return false; } ",0 "void netdev_run_todo(void) { struct list_head list; /* Snapshot list, allow later requests */ list_replace_init(&net_todo_list, &list); __rtnl_unlock(); while (!list_empty(&list)) { struct net_device *dev = list_first_entry(&list, struct net_device, todo_list); list_del(&dev->todo_list); if (unlikely(dev->reg_state != NETREG_UNREGISTERING)) { printk(KERN_ERR ""network todo '%s' but state %d\n"", dev->name, dev->reg_state); dump_stack(); continue; } dev->reg_state = NETREG_UNREGISTERED; on_each_cpu(flush_backlog, dev, 1); netdev_wait_allrefs(dev); /* paranoia */ BUG_ON(atomic_read(&dev->refcnt)); WARN_ON(dev->ip_ptr); WARN_ON(dev->ip6_ptr); WARN_ON(dev->dn_ptr); if (dev->destructor) dev->destructor(dev); /* Free network device */ kobject_put(&dev->dev.kobj); } } ",0 "void ATSParser::PSISection::clear() { if (mBuffer != NULL) { mBuffer->setRange(0, 0); } mSkipBytes = 0; } ",0 "void mnt_set_mountpoint(struct mount *mnt, struct mountpoint *mp, struct mount *child_mnt) { mp->m_count++; mnt_add_count(mnt, 1); /* essentially, that's mntget */ child_mnt->mnt_mountpoint = dget(mp->m_dentry); child_mnt->mnt_parent = mnt; child_mnt->mnt_mp = mp; hlist_add_head(&child_mnt->mnt_mp_list, &mp->m_list); } ",0 "static void writepng_error_handler(png_structp png_ptr, png_const_charp msg) { mainprog_info *mainprog_ptr; /* This function, aside from the extra step of retrieving the ""error * pointer"" (below) and the fact that it exists within the application * rather than within libpng, is essentially identical to libpng's * default error handler. The second point is critical: since both * setjmp() and longjmp() are called from the same code, they are * guaranteed to have compatible notions of how big a jmp_buf is, * regardless of whether _BSD_SOURCE or anything else has (or has not) * been defined. */ fprintf(stderr, ""writepng libpng error: %s\n"", msg); fflush(stderr); mainprog_ptr = png_get_error_ptr(png_ptr); if (mainprog_ptr == NULL) { /* we are completely hosed now */ fprintf(stderr, ""writepng severe error: jmpbuf not recoverable; terminating.\n""); fflush(stderr); exit(99); } /* Now we have our data structure we can use the information in it * to return control to our own higher level code (all the points * where 'setjmp' is called in this file.) This will work with other * error handling mechanisms as well - libpng always calls png_error * when it can proceed no further, thus, so long as the error handler * is intercepted, application code can do its own error recovery. */ longjmp(mainprog_ptr->jmpbuf, 1); } ",0 "static void __exit ib_ucm_cleanup(void) { ib_unregister_client(&ucm_client); class_remove_file(&cm_class, &class_attr_abi_version.attr); unregister_chrdev_region(IB_UCM_BASE_DEV, IB_UCM_MAX_DEVICES); if (overflow_maj) unregister_chrdev_region(overflow_maj, IB_UCM_MAX_DEVICES); idr_destroy(&ctx_id_table); } ",0 "bool FakePluginServiceFilter::CanLoadPlugin(int render_process_id, const FilePath& path) { return true; } ",0 "static int max_bfregs(struct mlx5_ib_dev *dev, struct mlx5_bfreg_info *bfregi) { return get_num_static_uars(dev, bfregi) * MLX5_NON_FP_BFREGS_PER_UAR; } ",0 "static int tg3_get_device_address(struct tg3 *tp) { struct net_device *dev = tp->dev; u32 hi, lo, mac_offset; int addr_ok = 0; int err; #ifdef CONFIG_SPARC if (!tg3_get_macaddr_sparc(tp)) return 0; #endif if (tg3_flag(tp, IS_SSB_CORE)) { err = ssb_gige_get_macaddr(tp->pdev, &dev->dev_addr[0]); if (!err && is_valid_ether_addr(&dev->dev_addr[0])) return 0; } mac_offset = 0x7c; if (tg3_asic_rev(tp) == ASIC_REV_5704 || tg3_flag(tp, 5780_CLASS)) { if (tr32(TG3PCI_DUAL_MAC_CTRL) & DUAL_MAC_CTRL_ID) mac_offset = 0xcc; if (tg3_nvram_lock(tp)) tw32_f(NVRAM_CMD, NVRAM_CMD_RESET); else tg3_nvram_unlock(tp); } else if (tg3_flag(tp, 5717_PLUS)) { if (tp->pci_fn & 1) mac_offset = 0xcc; if (tp->pci_fn > 1) mac_offset += 0x18c; } else if (tg3_asic_rev(tp) == ASIC_REV_5906) mac_offset = 0x10; /* First try to get it from MAC address mailbox. */ tg3_read_mem(tp, NIC_SRAM_MAC_ADDR_HIGH_MBOX, &hi); if ((hi >> 16) == 0x484b) { dev->dev_addr[0] = (hi >> 8) & 0xff; dev->dev_addr[1] = (hi >> 0) & 0xff; tg3_read_mem(tp, NIC_SRAM_MAC_ADDR_LOW_MBOX, &lo); dev->dev_addr[2] = (lo >> 24) & 0xff; dev->dev_addr[3] = (lo >> 16) & 0xff; dev->dev_addr[4] = (lo >> 8) & 0xff; dev->dev_addr[5] = (lo >> 0) & 0xff; /* Some old bootcode may report a 0 MAC address in SRAM */ addr_ok = is_valid_ether_addr(&dev->dev_addr[0]); } if (!addr_ok) { /* Next, try NVRAM. */ if (!tg3_flag(tp, NO_NVRAM) && !tg3_nvram_read_be32(tp, mac_offset + 0, &hi) && !tg3_nvram_read_be32(tp, mac_offset + 4, &lo)) { memcpy(&dev->dev_addr[0], ((char *)&hi) + 2, 2); memcpy(&dev->dev_addr[2], (char *)&lo, sizeof(lo)); } /* Finally just fetch it out of the MAC control regs. */ else { hi = tr32(MAC_ADDR_0_HIGH); lo = tr32(MAC_ADDR_0_LOW); dev->dev_addr[5] = lo & 0xff; dev->dev_addr[4] = (lo >> 8) & 0xff; dev->dev_addr[3] = (lo >> 16) & 0xff; dev->dev_addr[2] = (lo >> 24) & 0xff; dev->dev_addr[1] = hi & 0xff; dev->dev_addr[0] = (hi >> 8) & 0xff; } } if (!is_valid_ether_addr(&dev->dev_addr[0])) { #ifdef CONFIG_SPARC if (!tg3_get_default_macaddr_sparc(tp)) return 0; #endif return -EINVAL; } return 0; } ",0 "void SoftMPEG4Encoder::initPorts() { OMX_PARAM_PORTDEFINITIONTYPE def; InitOMXParams(&def); const size_t kInputBufferSize = (mVideoWidth * mVideoHeight * 3) >> 1; const size_t kOutputBufferSize = (kInputBufferSize > 256 * 1024) ? kInputBufferSize: 256 * 1024; def.nPortIndex = 0; def.eDir = OMX_DirInput; def.nBufferCountMin = kNumBuffers; def.nBufferCountActual = def.nBufferCountMin; def.nBufferSize = kInputBufferSize; def.bEnabled = OMX_TRUE; def.bPopulated = OMX_FALSE; def.eDomain = OMX_PortDomainVideo; def.bBuffersContiguous = OMX_FALSE; def.nBufferAlignment = 1; def.format.video.cMIMEType = const_cast(""video/raw""); def.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused; def.format.video.eColorFormat = OMX_COLOR_FormatYUV420Planar; def.format.video.xFramerate = (mVideoFrameRate << 16); // Q16 format def.format.video.nBitrate = mVideoBitRate; def.format.video.nFrameWidth = mVideoWidth; def.format.video.nFrameHeight = mVideoHeight; def.format.video.nStride = mVideoWidth; def.format.video.nSliceHeight = mVideoHeight; addPort(def); def.nPortIndex = 1; def.eDir = OMX_DirOutput; def.nBufferCountMin = kNumBuffers; def.nBufferCountActual = def.nBufferCountMin; def.nBufferSize = kOutputBufferSize; def.bEnabled = OMX_TRUE; def.bPopulated = OMX_FALSE; def.eDomain = OMX_PortDomainVideo; def.bBuffersContiguous = OMX_FALSE; def.nBufferAlignment = 2; def.format.video.cMIMEType = (mEncodeMode == COMBINE_MODE_WITH_ERR_RES) ? const_cast(MEDIA_MIMETYPE_VIDEO_MPEG4) : const_cast(MEDIA_MIMETYPE_VIDEO_H263); def.format.video.eCompressionFormat = (mEncodeMode == COMBINE_MODE_WITH_ERR_RES) ? OMX_VIDEO_CodingMPEG4 : OMX_VIDEO_CodingH263; def.format.video.eColorFormat = OMX_COLOR_FormatUnused; def.format.video.xFramerate = (0 << 16); // Q16 format def.format.video.nBitrate = mVideoBitRate; def.format.video.nFrameWidth = mVideoWidth; def.format.video.nFrameHeight = mVideoHeight; def.format.video.nStride = mVideoWidth; def.format.video.nSliceHeight = mVideoHeight; addPort(def); } ",0 "bool GLES2DecoderImpl::ValidateUniformBlockBackings(const char* func_name) { DCHECK(feature_info_->IsWebGL2OrES3Context()); if (!state_.current_program.get()) return true; int32_t max_index = -1; for (auto info : state_.current_program->uniform_block_size_info()) { int32_t index = static_cast(info.binding); if (index > max_index) max_index = index; } if (max_index < 0) return true; std::vector uniform_block_sizes(max_index + 1); for (int32_t ii = 0; ii <= max_index; ++ii) uniform_block_sizes[ii] = 0; for (auto info : state_.current_program->uniform_block_size_info()) { uint32_t index = info.binding; uniform_block_sizes[index] = static_cast(info.data_size); } return buffer_manager()->RequestBuffersAccess( error_state_.get(), state_.indexed_uniform_buffer_bindings.get(), uniform_block_sizes, 1, func_name, ""uniform buffers""); } ",0 "static void digi_disconnect(struct usb_serial *serial) { int i; /* stop reads and writes on all ports */ for (i = 0; i < serial->type->num_ports + 1; i++) { usb_kill_urb(serial->port[i]->read_urb); usb_kill_urb(serial->port[i]->write_urb); } } ",0 " std::string::size_type CountTrailingChars( const std::string input, const std::string::value_type trailing_chars[]) { const size_t last_good_char = input.find_last_not_of(trailing_chars); return (last_good_char == std::string::npos) ? input.length() : (input.length() - last_good_char - 1); } ",1 "int nfs4_proc_bind_conn_to_session(struct nfs_client *clp, struct rpc_cred *cred) { int status; struct nfs41_bind_conn_to_session_args args = { .client = clp, .dir = NFS4_CDFC4_FORE_OR_BOTH, }; struct nfs41_bind_conn_to_session_res res; struct rpc_message msg = { .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_BIND_CONN_TO_SESSION], .rpc_argp = &args, .rpc_resp = &res, .rpc_cred = cred, }; dprintk(""--> %s\n"", __func__); nfs4_copy_sessionid(&args.sessionid, &clp->cl_session->sess_id); if (!(clp->cl_session->flags & SESSION4_BACK_CHAN)) args.dir = NFS4_CDFC4_FORE; status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT); trace_nfs4_bind_conn_to_session(clp, status); if (status == 0) { if (memcmp(res.sessionid.data, clp->cl_session->sess_id.data, NFS4_MAX_SESSIONID_LEN)) { dprintk(""NFS: %s: Session ID mismatch\n"", __func__); status = -EIO; goto out; } if ((res.dir & args.dir) != res.dir || res.dir == 0) { dprintk(""NFS: %s: Unexpected direction from server\n"", __func__); status = -EIO; goto out; } if (res.use_conn_in_rdma_mode != args.use_conn_in_rdma_mode) { dprintk(""NFS: %s: Server returned RDMA mode = true\n"", __func__); status = -EIO; goto out; } } out: dprintk(""<-- %s status= %d\n"", __func__, status); return status; } ",0 " void InformHostOfCacheStats() { WebCache::UsageStats stats; WebCache::getUsageStats(&stats); RenderThread::Get()->Send(new ChromeViewHostMsg_UpdatedCacheStats(stats)); } ",0 "void DevToolsWindow::OpenExternalFrontend( Profile* profile, const std::string& frontend_url, const scoped_refptr& agent_host, bool is_worker, bool is_v8_only) { DevToolsWindow* window = FindDevToolsWindow(agent_host.get()); if (!window) { window = Create(profile, GURL(), nullptr, is_worker, is_v8_only, DevToolsUI::GetProxyURL(frontend_url).spec(), false, std::string(), std::string()); if (!window) return; window->bindings_->AttachTo(agent_host); window->close_on_detach_ = false; } window->ScheduleShow(DevToolsToggleAction::Show()); } ",0 "static int crl_crldp_check(X509 *x, X509_CRL *crl, int crl_score, unsigned int *preasons) { int i; if (crl->idp_flags & IDP_ONLYATTR) return 0; if (x->ex_flags & EXFLAG_CA) { if (crl->idp_flags & IDP_ONLYUSER) return 0; } else { if (crl->idp_flags & IDP_ONLYCA) return 0; } *preasons = crl->idp_reasons; for (i = 0; i < sk_DIST_POINT_num(x->crldp); i++) { DIST_POINT *dp = sk_DIST_POINT_value(x->crldp, i); if (crldp_check_crlissuer(dp, crl, crl_score)) { if (!crl->idp || idp_check_dp(dp->distpoint, crl->idp->distpoint)) { *preasons &= dp->dp_reasons; return 1; } } } if ((!crl->idp || !crl->idp->distpoint) && (crl_score & CRL_SCORE_ISSUER_NAME)) return 1; return 0; } ",0 "static inline void maybe_flush_windows(unsigned int rs1, unsigned int rs2, unsigned int rd) { if(rs2 >= 16 || rs1 >= 16 || rd >= 16) { /* Wheee... */ __asm__ __volatile__(""save %sp, -0x40, %sp\n\t"" ""save %sp, -0x40, %sp\n\t"" ""save %sp, -0x40, %sp\n\t"" ""save %sp, -0x40, %sp\n\t"" ""save %sp, -0x40, %sp\n\t"" ""save %sp, -0x40, %sp\n\t"" ""save %sp, -0x40, %sp\n\t"" ""restore; restore; restore; restore;\n\t"" ""restore; restore; restore;\n\t""); } } ",0 "bool QuicStreamSequencerBuffer::RetireBlock(size_t idx) { if (blocks_[idx] == nullptr) { QUIC_BUG << ""Try to retire block twice""; return false; } delete blocks_[idx]; blocks_[idx] = nullptr; QUIC_DVLOG(1) << ""Retired block with index: "" << idx; return true; } ",0 "void BrowserView::ExitFullscreen() { if (!IsFullscreen()) return; // Nothing to do. ProcessFullscreen(false, GURL(), EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE); } ",0 "static void khazad_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) { struct khazad_ctx *ctx = crypto_tfm_ctx(tfm); khazad_crypt(ctx->E, dst, src); } ",0 "static int ssl_parse_server_ecdh_params( mbedtls_ssl_context *ssl, unsigned char **p, unsigned char *end ) { int ret = MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE; /* * Ephemeral ECDH parameters: * * struct { * ECParameters curve_params; * ECPoint public; * } ServerECDHParams; */ if( ( ret = mbedtls_ecdh_read_params( &ssl->handshake->ecdh_ctx, (const unsigned char **) p, end ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, ( ""mbedtls_ecdh_read_params"" ), ret ); return( ret ); } if( ssl_check_server_ecdh_params( ssl ) != 0 ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( ""bad server key exchange message (ECDHE curve)"" ) ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE ); } return( ret ); } ",0 "grid_status_draw_grid( GridStatus st ) { int x_org = (int)st->x_origin; int y_org = (int)st->y_origin; double xy_incr = 64.0 * st->scale; if ( xy_incr >= 2. ) { double x2 = x_org; double y2 = y_org; for ( ; x2 < st->disp_width; x2 += xy_incr ) grFillVLine( st->disp_bitmap, (int)x2, 0, st->disp_height, st->grid_color ); for ( x2 = x_org - xy_incr; (int)x2 >= 0; x2 -= xy_incr ) grFillVLine( st->disp_bitmap, (int)x2, 0, st->disp_height, st->grid_color ); for ( ; y2 < st->disp_height; y2 += xy_incr ) grFillHLine( st->disp_bitmap, 0, (int)y2, st->disp_width, st->grid_color ); for ( y2 = y_org - xy_incr; (int)y2 >= 0; y2 -= xy_incr ) grFillHLine( st->disp_bitmap, 0, (int)y2, st->disp_width, st->grid_color ); } grFillVLine( st->disp_bitmap, x_org, 0, st->disp_height, st->axis_color ); grFillHLine( st->disp_bitmap, 0, y_org, st->disp_width, st->axis_color ); } ",0 "void validate_creds_for_do_exit(struct task_struct *tsk) { kdebug(""validate_creds_for_do_exit(%p,%p{%d,%d})"", tsk->real_cred, tsk->cred, atomic_read(&tsk->cred->usage), read_cred_subscribers(tsk->cred)); __validate_process_creds(tsk, __FILE__, __LINE__); } ",0 "static s32 atl2_read_phy_reg(struct atl2_hw *hw, u16 reg_addr, u16 *phy_data) { u32 val; int i; val = ((u32)(reg_addr & MDIO_REG_ADDR_MASK)) << MDIO_REG_ADDR_SHIFT | MDIO_START | MDIO_SUP_PREAMBLE | MDIO_RW | MDIO_CLK_25_4 << MDIO_CLK_SEL_SHIFT; ATL2_WRITE_REG(hw, REG_MDIO_CTRL, val); wmb(); for (i = 0; i < MDIO_WAIT_TIMES; i++) { udelay(2); val = ATL2_READ_REG(hw, REG_MDIO_CTRL); if (!(val & (MDIO_START | MDIO_BUSY))) break; wmb(); } if (!(val & (MDIO_START | MDIO_BUSY))) { *phy_data = (u16)val; return 0; } return ATLX_ERR_PHY; } ",0 " virtual std::string GetKeyboardOverlayId(const std::string& input_method_id) { KeyboardOverlayMap::const_iterator iter = keyboard_overlay_map_->find(input_method_id); return (iter != keyboard_overlay_map_->end()) ? iter->second : """"; } ",0 "static ssize_t chars_in_buffer(struct tty_struct *tty) { struct n_tty_data *ldata = tty->disc_data; ssize_t n = 0; if (!ldata->icanon) n = read_cnt(ldata); else n = ldata->canon_head - ldata->read_tail; return n; } ",0 "ProcXvQueryBestSize(ClientPtr client) { unsigned int actual_width, actual_height; XvPortPtr pPort; xvQueryBestSizeReply rep; REQUEST(xvQueryBestSizeReq); REQUEST_SIZE_MATCH(xvQueryBestSizeReq); VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess); (*pPort->pAdaptor->ddQueryBestSize) (pPort, stuff->motion, stuff->vid_w, stuff->vid_h, stuff->drw_w, stuff->drw_h, &actual_width, &actual_height); rep = (xvQueryBestSizeReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, .actual_width = actual_width, .actual_height = actual_height }; _WriteQueryBestSizeReply(client, &rep); return Success; } ",0 "unsigned long ptrace_get_reg(struct task_struct *task, int regno) { if (task->thread.regs == NULL) return -EIO; if (regno == PT_MSR) return get_user_msr(task); if (regno < (sizeof(struct pt_regs) / sizeof(unsigned long))) return ((unsigned long *)task->thread.regs)[regno]; return -EIO; } ",0 "static int __net_init rtnetlink_net_init(struct net *net) { struct sock *sk; struct netlink_kernel_cfg cfg = { .groups = RTNLGRP_MAX, .input = rtnetlink_rcv, .cb_mutex = &rtnl_mutex, .flags = NL_CFG_F_NONROOT_RECV, }; sk = netlink_kernel_create(net, NETLINK_ROUTE, &cfg); if (!sk) return -ENOMEM; net->rtnl = sk; return 0; } ",0 "bool VaapiWrapper::InitializeVpp_Locked() { va_lock_->AssertAcquired(); VA_SUCCESS_OR_RETURN( vaCreateConfig(va_display_, VAProfileNone, VAEntrypointVideoProc, NULL, 0, &va_vpp_config_id_), ""Couldn't create config"", false); VA_SUCCESS_OR_RETURN(vaCreateContext(va_display_, va_vpp_config_id_, 1, 1, 0, NULL, 0, &va_vpp_context_id_), ""Couldn't create context"", false); VA_SUCCESS_OR_RETURN(vaCreateBuffer(va_display_, va_vpp_context_id_, VAProcPipelineParameterBufferType, sizeof(VAProcPipelineParameterBuffer), 1, NULL, &va_vpp_buffer_id_), ""Couldn't create buffer"", false); return true; } ",0 "static int rsa_pub_decode(EVP_PKEY *pkey, X509_PUBKEY *pubkey) { const unsigned char *p; int pklen; RSA *rsa = NULL; if (!X509_PUBKEY_get0_param(NULL, &p, &pklen, NULL, pubkey)) return 0; if (!(rsa = d2i_RSAPublicKey(NULL, &p, pklen))) { RSAerr(RSA_F_RSA_PUB_DECODE, ERR_R_RSA_LIB); return 0; } EVP_PKEY_assign_RSA(pkey, rsa); return 1; } ",0 "static int hash_init(struct ahash_request *req) { struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); struct hash_ctx *ctx = crypto_ahash_ctx(tfm); struct hash_req_ctx *req_ctx = ahash_request_ctx(req); if (!ctx->key) ctx->keylen = 0; memset(&req_ctx->state, 0, sizeof(struct hash_state)); req_ctx->updated = 0; if (hash_mode == HASH_MODE_DMA) { if (req->nbytes < HASH_DMA_ALIGN_SIZE) { req_ctx->dma_mode = false; /* Don't use DMA */ pr_debug(""%s: DMA mode, but direct to CPU mode for data size < %d\n"", __func__, HASH_DMA_ALIGN_SIZE); } else { if (req->nbytes >= HASH_DMA_PERFORMANCE_MIN_SIZE && hash_dma_valid_data(req->src, req->nbytes)) { req_ctx->dma_mode = true; } else { req_ctx->dma_mode = false; pr_debug(""%s: DMA mode, but use CPU mode for datalength < %d or non-aligned data, except in last nent\n"", __func__, HASH_DMA_PERFORMANCE_MIN_SIZE); } } } return 0; } ",0 "free_parent_mallocs_exit(void) { #ifdef _WITH_VRRP_ if (free_vrrp_pidfile) FREE_PTR(vrrp_pidfile); #endif #ifdef _WITH_LVS_ if (free_checkers_pidfile) FREE_PTR(checkers_pidfile); #endif #ifdef _WITH_BFD_ if (free_bfd_pidfile) FREE_PTR(bfd_pidfile); #endif FREE_PTR(config_id); } ",0 "SimpleBlock::SimpleBlock(Cluster* pCluster, long idx, long long start, long long size) : BlockEntry(pCluster, idx), m_block(start, size, 0) {} ",0 "struct inode *ilookup5(struct super_block *sb, unsigned long hashval, int (*test)(struct inode *, void *), void *data) { struct inode *inode = ilookup5_nowait(sb, hashval, test, data); if (inode) wait_on_inode(inode); return inode; } ",0 "gs_currentsrcgtagicc(const gs_gstate * pgs, gs_param_string * pval) { if (pgs->icc_manager->srcgtag_profile == NULL) { pval->data = NULL; pval->size = 0; pval->persistent = true; } else { pval->data = (byte *)pgs->icc_manager->srcgtag_profile->name; pval->size = strlen((const char *)pval->data); pval->persistent = false; } } ",0 "static void put_uint32(QEMUFile *f, void *pv, size_t size) { uint32_t *v = pv; qemu_put_be32s(f, v); } ",0 "archive_read_set_skip_callback(struct archive *_a, archive_skip_callback *client_skipper) { struct archive_read *a = (struct archive_read *)_a; archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_NEW, ""archive_read_set_skip_callback""); a->client.skipper = client_skipper; return ARCHIVE_OK; } ",0 "void prft_del(GF_Box *s) { gf_free(s); } ",0 "int32_t EqualizerGetBandFreqRange(EffectContext *pContext, int32_t band, uint32_t *pLow, uint32_t *pHi){ *pLow = bandFreqRange[band][0]; *pHi = bandFreqRange[band][1]; return 0; } ",0 "void fuse_abort_conn(struct fuse_conn *fc, bool is_abort) { struct fuse_iqueue *fiq = &fc->iq; spin_lock(&fc->lock); if (fc->connected) { struct fuse_dev *fud; struct fuse_req *req, *next; LIST_HEAD(to_end); unsigned int i; /* Background queuing checks fc->connected under bg_lock */ spin_lock(&fc->bg_lock); fc->connected = 0; spin_unlock(&fc->bg_lock); fc->aborted = is_abort; fuse_set_initialized(fc); list_for_each_entry(fud, &fc->devices, entry) { struct fuse_pqueue *fpq = &fud->pq; spin_lock(&fpq->lock); fpq->connected = 0; list_for_each_entry_safe(req, next, &fpq->io, list) { req->out.h.error = -ECONNABORTED; spin_lock(&req->waitq.lock); set_bit(FR_ABORTED, &req->flags); if (!test_bit(FR_LOCKED, &req->flags)) { set_bit(FR_PRIVATE, &req->flags); __fuse_get_request(req); list_move(&req->list, &to_end); } spin_unlock(&req->waitq.lock); } for (i = 0; i < FUSE_PQ_HASH_SIZE; i++) list_splice_tail_init(&fpq->processing[i], &to_end); spin_unlock(&fpq->lock); } spin_lock(&fc->bg_lock); fc->blocked = 0; fc->max_background = UINT_MAX; flush_bg_queue(fc); spin_unlock(&fc->bg_lock); spin_lock(&fiq->waitq.lock); fiq->connected = 0; list_for_each_entry(req, &fiq->pending, list) clear_bit(FR_PENDING, &req->flags); list_splice_tail_init(&fiq->pending, &to_end); while (forget_pending(fiq)) kfree(dequeue_forget(fiq, 1, NULL)); wake_up_all_locked(&fiq->waitq); spin_unlock(&fiq->waitq.lock); kill_fasync(&fiq->fasync, SIGIO, POLL_IN); end_polls(fc); wake_up_all(&fc->blocked_waitq); spin_unlock(&fc->lock); end_requests(fc, &to_end); } else { spin_unlock(&fc->lock); } } ",0 "list_update_cgroup_event(struct perf_event *event, struct perf_event_context *ctx, bool add) { } ",0 "void xaddCommand(client *c) { streamID id; int id_given = 0; /* Was an ID different than ""*"" specified? */ long long maxlen = 0; /* 0 means no maximum length. */ int approx_maxlen = 0; /* If 1 only delete whole radix tree nodes, so the maxium length is not applied verbatim. */ int maxlen_arg_idx = 0; /* Index of the count in MAXLEN, for rewriting. */ /* Parse options. */ int i = 2; /* This is the first argument position where we could find an option, or the ID. */ for (; i < c->argc; i++) { int moreargs = (c->argc-1) - i; /* Number of additional arguments. */ char *opt = c->argv[i]->ptr; if (opt[0] == '*' && opt[1] == '\0') { /* This is just a fast path for the common case of auto-ID * creation. */ break; } else if (!strcasecmp(opt,""maxlen"") && moreargs) { char *next = c->argv[i+1]->ptr; /* Check for the form MAXLEN ~ . */ if (moreargs >= 2 && next[0] == '~' && next[1] == '\0') { approx_maxlen = 1; i++; } if (getLongLongFromObjectOrReply(c,c->argv[i+1],&maxlen,NULL) != C_OK) return; i++; maxlen_arg_idx = i; } else { /* If we are here is a syntax error or a valid ID. */ if (streamParseIDOrReply(c,c->argv[i],&id,0) != C_OK) return; id_given = 1; break; } } int field_pos = i+1; /* Check arity. */ if ((c->argc - field_pos) < 2 || ((c->argc-field_pos) % 2) == 1) { addReplyError(c,""wrong number of arguments for XADD""); return; } /* Lookup the stream at key. */ robj *o; stream *s; if ((o = streamTypeLookupWriteOrCreate(c,c->argv[1])) == NULL) return; s = o->ptr; /* Append using the low level function and return the ID. */ if (streamAppendItem(s,c->argv+field_pos,(c->argc-field_pos)/2, &id, id_given ? &id : NULL) == C_ERR) { addReplyError(c,""The ID specified in XADD is equal or smaller than the "" ""target stream top item""); return; } addReplyStreamID(c,&id); signalModifiedKey(c->db,c->argv[1]); notifyKeyspaceEvent(NOTIFY_STREAM,""xadd"",c->argv[1],c->db->id); server.dirty++; /* Remove older elements if MAXLEN was specified. */ if (maxlen) { if (!streamTrimByLength(s,maxlen,approx_maxlen)) { /* If no trimming was performed, for instance because approximated * trimming length was specified, rewrite the MAXLEN argument * as zero, so that the command is propagated without trimming. */ robj *zeroobj = createStringObjectFromLongLong(0); rewriteClientCommandArgument(c,maxlen_arg_idx,zeroobj); decrRefCount(zeroobj); } else { notifyKeyspaceEvent(NOTIFY_STREAM,""xtrim"",c->argv[1],c->db->id); } } /* Let's rewrite the ID argument with the one actually generated for * AOF/replication propagation. */ robj *idarg = createObjectFromStreamID(&id); rewriteClientCommandArgument(c,i,idarg); decrRefCount(idarg); /* We need to signal to blocked clients that there is new data on this * stream. */ if (server.blocked_clients_by_type[BLOCKED_STREAM]) signalKeyAsReady(c->db, c->argv[1]); } ",0 "addrinfo_from_hostent(const struct hostent *ent, int port, const struct evutil_addrinfo *hints) { int i; struct sockaddr_in sin; struct sockaddr_in6 sin6; struct sockaddr *sa; int socklen; struct evutil_addrinfo *res=NULL, *ai; void *addrp; if (ent->h_addrtype == PF_INET) { memset(&sin, 0, sizeof(sin)); sin.sin_family = AF_INET; sin.sin_port = htons(port); sa = (struct sockaddr *)&sin; socklen = sizeof(struct sockaddr_in); addrp = &sin.sin_addr; if (ent->h_length != sizeof(sin.sin_addr)) { event_warnx(""Weird h_length from gethostbyname""); return NULL; } } else if (ent->h_addrtype == PF_INET6) { memset(&sin6, 0, sizeof(sin6)); sin6.sin6_family = AF_INET6; sin6.sin6_port = htons(port); sa = (struct sockaddr *)&sin6; socklen = sizeof(struct sockaddr_in6); addrp = &sin6.sin6_addr; if (ent->h_length != sizeof(sin6.sin6_addr)) { event_warnx(""Weird h_length from gethostbyname""); return NULL; } } else return NULL; for (i = 0; ent->h_addr_list[i]; ++i) { memcpy(addrp, ent->h_addr_list[i], ent->h_length); ai = evutil_new_addrinfo_(sa, socklen, hints); if (!ai) { evutil_freeaddrinfo(res); return NULL; } res = evutil_addrinfo_append_(res, ai); } if (res && ((hints->ai_flags & EVUTIL_AI_CANONNAME) && ent->h_name)) { res->ai_canonname = mm_strdup(ent->h_name); if (res->ai_canonname == NULL) { evutil_freeaddrinfo(res); return NULL; } } return res; } ",0 "void RenderFrameDevToolsAgentHost::OnNavigationResponseReceived( const NavigationRequest& nav_request, const network::ResourceResponse& response) { FrameTreeNode* ftn = nav_request.frame_tree_node(); std::string id = nav_request.devtools_navigation_token().ToString(); std::string frame_id = ftn->devtools_frame_token().ToString(); GURL url = nav_request.common_params().url; DispatchToAgents(ftn, &protocol::NetworkHandler::ResponseReceived, id, id, url, protocol::Page::ResourceTypeEnum::Document, response.head, frame_id); } ",0 "Response TargetHandler::GetTargetInfo( const std::string& target_id, std::unique_ptr* target_info) { scoped_refptr agent_host( DevToolsAgentHost::GetForId(target_id)); if (!agent_host) return Response::InvalidParams(""No target with given id found""); *target_info = CreateInfo(agent_host.get()); return Response::OK(); } ",0 "static void vmx_set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3) { unsigned long guest_cr3; u64 eptp; guest_cr3 = cr3; if (enable_ept) { eptp = construct_eptp(vcpu, cr3); vmcs_write64(EPT_POINTER, eptp); if (enable_unrestricted_guest || is_paging(vcpu) || is_guest_mode(vcpu)) guest_cr3 = kvm_read_cr3(vcpu); else guest_cr3 = to_kvm_vmx(vcpu->kvm)->ept_identity_map_addr; ept_load_pdptrs(vcpu); } vmx_flush_tlb(vcpu, true); vmcs_writel(GUEST_CR3, guest_cr3); } ",0 "static int crypto_xcbc_digest_final(struct shash_desc *pdesc, u8 *out) { struct crypto_shash *parent = pdesc->tfm; unsigned long alignmask = crypto_shash_alignmask(parent); struct xcbc_tfm_ctx *tctx = crypto_shash_ctx(parent); struct xcbc_desc_ctx *ctx = shash_desc_ctx(pdesc); struct crypto_cipher *tfm = tctx->child; int bs = crypto_shash_blocksize(parent); u8 *consts = PTR_ALIGN(&tctx->ctx[0], alignmask + 1); u8 *odds = PTR_ALIGN(&ctx->ctx[0], alignmask + 1); u8 *prev = odds + bs; unsigned int offset = 0; if (ctx->len != bs) { unsigned int rlen; u8 *p = odds + ctx->len; *p = 0x80; p++; rlen = bs - ctx->len -1; if (rlen) memset(p, 0, rlen); offset += bs; } crypto_xor(prev, odds, bs); crypto_xor(prev, consts + offset, bs); crypto_cipher_encrypt_one(tfm, out, prev); return 0; } ",0 "std::wstring AppendExtensionIfNeeded(const std::wstring& filename, const std::wstring& filter_selected, const std::wstring& suggested_ext) { DCHECK(!filename.empty()); std::wstring return_value = filename; std::wstring file_extension( GetExtensionWithoutLeadingDot(FilePath(filename).Extension())); std::wstring key(L""."" + file_extension); if (!(filter_selected.empty() || filter_selected == L""*.*"") && !base::win::RegKey(HKEY_CLASSES_ROOT, key.c_str(), KEY_READ).Valid() && file_extension != suggested_ext) { if (return_value[return_value.length() - 1] != L'.') return_value.append(L"".""); return_value.append(suggested_ext); } size_t index = return_value.find_last_not_of(L'.'); if (index < return_value.size() - 1) return_value.resize(index + 1); return return_value; } ",0 "void HWNDMessageHandler::SetAlwaysOnTop(bool on_top) { ::SetWindowPos(hwnd(), on_top ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); } ",0 "static int snd_ctl_elem_read_user(struct snd_card *card, struct snd_ctl_elem_value __user *_control) { struct snd_ctl_elem_value *control; int result; control = memdup_user(_control, sizeof(*control)); if (IS_ERR(control)) return PTR_ERR(control); snd_power_lock(card); result = snd_power_wait(card, SNDRV_CTL_POWER_D0); if (result >= 0) result = snd_ctl_elem_read(card, control); snd_power_unlock(card); if (result >= 0) if (copy_to_user(_control, control, sizeof(*control))) result = -EFAULT; kfree(control); return result; } ",0 "CMYKGrayEncoder::CMYKGrayEncoder(Stream *strA): FilterStream(strA) { bufPtr = bufEnd = buf; eof = gFalse; } ",0 "static void overloadedMethodH2Method(const v8::FunctionCallbackInfo& info) { if (UNLIKELY(info.Length() < 1)) { throwTypeError(ExceptionMessages::failedToExecute(""overloadedMethodH"", ""TestObjectPython"", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIsolate()); return; } TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); if (info.Length() <= 0 || !info[0]->IsFunction()) { throwTypeError(ExceptionMessages::failedToExecute(""overloadedMethodH"", ""TestObjectPython"", ""The callback provided as parameter 1 is not a function.""), info.GetIsolate()); return; } OwnPtr testCallbackInterfaceArg = V8TestCallbackInterface::create(v8::Handle::Cast(info[0]), currentExecutionContext(info.GetIsolate())); imp->overloadedMethodH(testCallbackInterfaceArg.release()); } ",0 "int fb_get_options(char *name, char **option) { char *opt, *options = NULL; int retval = 0; int name_len = strlen(name), i; if (name_len && ofonly && strncmp(name, ""offb"", 4)) retval = 1; if (name_len && !retval) { for (i = 0; i < FB_MAX; i++) { if (video_options[i] == NULL) continue; if (!video_options[i][0]) continue; opt = video_options[i]; if (!strncmp(name, opt, name_len) && opt[name_len] == ':') options = opt + name_len + 1; } } if (options && !strncmp(options, ""off"", 3)) retval = 1; if (option) *option = options; return retval; } ",0 "static u32 beta(u32 da, u32 dm) { u32 d2, d3; d2 = dm / 10; if (da <= d2) return BETA_MIN; d3 = (8 * dm) / 10; if (da >= d3 || d3 <= d2) return BETA_MAX; /* * Based on: * * bmin d3 - bmax d2 * k3 = ------------------- * d3 - d2 * * bmax - bmin * k4 = ------------- * d3 - d2 * * b = k3 + k4 da */ return (BETA_MIN * d3 - BETA_MAX * d2 + (BETA_MAX - BETA_MIN) * da) / (d3 - d2); } ",0 "static void validate_mm(struct mm_struct *mm) { int bug = 0; int i = 0; unsigned long highest_address = 0; struct vm_area_struct *vma = mm->mmap; while (vma) { struct anon_vma *anon_vma = vma->anon_vma; struct anon_vma_chain *avc; if (anon_vma) { anon_vma_lock_read(anon_vma); list_for_each_entry(avc, &vma->anon_vma_chain, same_vma) anon_vma_interval_tree_verify(avc); anon_vma_unlock_read(anon_vma); } highest_address = vm_end_gap(vma); vma = vma->vm_next; i++; } if (i != mm->map_count) { pr_emerg(""map_count %d vm_next %d\n"", mm->map_count, i); bug = 1; } if (highest_address != mm->highest_vm_end) { pr_emerg(""mm->highest_vm_end %lx, found %lx\n"", mm->highest_vm_end, highest_address); bug = 1; } i = browse_rb(mm); if (i != mm->map_count) { if (i != -1) pr_emerg(""map_count %d rb %d\n"", mm->map_count, i); bug = 1; } VM_BUG_ON_MM(bug, mm); } ",0 "void Element::createPseudoElementIfNeeded(PseudoId pseudoId) { if (!document()->styleSheetCollection()->usesBeforeAfterRules()) return; if (!renderer() || !pseudoElementRendererIsNeeded(renderer()->getCachedPseudoStyle(pseudoId))) return; if (!renderer()->canHaveGeneratedChildren()) return; ASSERT(!isPseudoElement()); RefPtr element = PseudoElement::create(this, pseudoId); element->attach(); ensureElementRareData()->setPseudoElement(pseudoId, element.release()); } ",0 "int HttpStreamParser::SendRequest(const std::string& request_line, const HttpRequestHeaders& headers, HttpResponseInfo* response, const CompletionCallback& callback) { DCHECK_EQ(STATE_NONE, io_state_); DCHECK(callback_.is_null()); DCHECK(!callback.is_null()); DCHECK(response); net_log_.AddEvent( NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST_HEADERS, base::Bind(&HttpRequestHeaders::NetLogCallback, base::Unretained(&headers), &request_line)); DVLOG(1) << __FUNCTION__ << ""()"" << "" request_line = \"""" << request_line << ""\"""" << "" headers = \"""" << headers.ToString() << ""\""""; response_ = response; IPEndPoint ip_endpoint; int result = connection_->socket()->GetPeerAddress(&ip_endpoint); if (result != OK) return result; response_->socket_address = HostPortPair::FromIPEndPoint(ip_endpoint); std::string request = request_line + headers.ToString(); if (request_->upload_data_stream != NULL) { request_body_send_buf_ = new SeekableIOBuffer(kRequestBodyBufferSize); if (request_->upload_data_stream->is_chunked()) { request_body_read_buf_ = new SeekableIOBuffer(kRequestBodyBufferSize - kChunkHeaderFooterSize); } else { request_body_read_buf_ = request_body_send_buf_; } } io_state_ = STATE_SENDING_HEADERS; bool did_merge = false; if (ShouldMergeRequestHeadersAndBody(request, request_->upload_data_stream)) { size_t merged_size = request.size() + request_->upload_data_stream->size(); scoped_refptr merged_request_headers_and_body( new IOBuffer(merged_size)); request_headers_ = new DrainableIOBuffer( merged_request_headers_and_body, merged_size); memcpy(request_headers_->data(), request.data(), request.size()); request_headers_->DidConsume(request.size()); size_t todo = request_->upload_data_stream->size(); while (todo) { int consumed = request_->upload_data_stream->Read(request_headers_, todo, CompletionCallback()); DCHECK_GT(consumed, 0); // Read() won't fail if not chunked. request_headers_->DidConsume(consumed); todo -= consumed; } DCHECK(request_->upload_data_stream->IsEOF()); request_headers_->SetOffset(0); did_merge = true; net_log_.AddEvent( NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST_BODY, base::Bind(&NetLogSendRequestBodyCallback, request_->upload_data_stream->size(), false, /* not chunked */ true /* merged */)); } if (!did_merge) { scoped_refptr headers_io_buf(new StringIOBuffer(request)); request_headers_ = new DrainableIOBuffer(headers_io_buf, headers_io_buf->size()); } result = DoLoop(OK); if (result == ERR_IO_PENDING) callback_ = callback; return result > 0 ? OK : result; } ",0 "ZEND_API int _zend_ts_hash_quick_add_or_update(TsHashTable *ht, char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) { int retval; begin_write(ht); retval = _zend_hash_quick_add_or_update(TS_HASH(ht), arKey, nKeyLength, h, pData, nDataSize, pDest, flag ZEND_FILE_LINE_RELAY_CC); end_write(ht); return retval; } ",0 "static void shm_add_rss_swap(struct shmid_kernel *shp, unsigned long *rss_add, unsigned long *swp_add) { struct inode *inode; inode = file_inode(shp->shm_file); if (is_file_hugepages(shp->shm_file)) { struct address_space *mapping = inode->i_mapping; struct hstate *h = hstate_file(shp->shm_file); *rss_add += pages_per_huge_page(h) * mapping->nrpages; } else { #ifdef CONFIG_SHMEM struct shmem_inode_info *info = SHMEM_I(inode); spin_lock(&info->lock); *rss_add += inode->i_mapping->nrpages; *swp_add += info->swapped; spin_unlock(&info->lock); #else *rss_add += inode->i_mapping->nrpages; #endif } } ",0 "void PepperPlatformVideoCapture::OnStateUpdate(VideoCaptureState state) { if (!handler_) return; switch (state) { case VIDEO_CAPTURE_STATE_STARTED: handler_->OnStarted(); break; case VIDEO_CAPTURE_STATE_STOPPED: handler_->OnStopped(); break; case VIDEO_CAPTURE_STATE_PAUSED: handler_->OnPaused(); break; case VIDEO_CAPTURE_STATE_ERROR: handler_->OnError(); break; default: NOTREACHED() << ""Unexpected state: "" << state << "".""; } } ",0 "int OBJ_ln2nid(const char *s) { ASN1_OBJECT o; const ASN1_OBJECT *oo= &o; ADDED_OBJ ad,*adp; const unsigned int *op; o.ln=s; if (added != NULL) { ad.type=ADDED_LNAME; ad.obj= &o; adp=lh_ADDED_OBJ_retrieve(added,&ad); if (adp != NULL) return (adp->obj->nid); } op=OBJ_bsearch_ln(&oo, ln_objs, NUM_LN); if (op == NULL) return(NID_undef); return(nid_objs[*op].nid); } ",0 "ofputil_append_ofp15_group_desc_reply(const struct ofputil_group_desc *gds, const struct ovs_list *buckets, struct ovs_list *replies, enum ofp_version version) { struct ofpbuf *reply = ofpbuf_from_list(ovs_list_back(replies)); struct ofp15_group_desc_stats *ogds; struct ofputil_bucket *bucket; size_t start_ogds, start_buckets; start_ogds = reply->size; ofpbuf_put_zeros(reply, sizeof *ogds); start_buckets = reply->size; LIST_FOR_EACH (bucket, list_node, buckets) { ofputil_put_ofp15_bucket(bucket, bucket->bucket_id, gds->type, reply, version); } ogds = ofpbuf_at_assert(reply, start_ogds, sizeof *ogds); ogds->type = gds->type; ogds->group_id = htonl(gds->group_id); ogds->bucket_list_len = htons(reply->size - start_buckets); /* Add group properties */ if (gds->props.selection_method[0]) { ofputil_put_group_prop_ntr_selection_method(version, &gds->props, reply); } ogds = ofpbuf_at_assert(reply, start_ogds, sizeof *ogds); ogds->length = htons(reply->size - start_ogds); ofpmp_postappend(replies, start_ogds); } ",0 "ServiceStartInteractiveOwn(DWORD dwArgc, LPTSTR *lpszArgv) { status.dwServiceType = SERVICE_WIN32_OWN_PROCESS; ServiceStartInteractive(dwArgc, lpszArgv); } ",0 "void TabSpecificContentSettings::FileSystemAccessed(int render_process_id, int render_view_id, const GURL& url, bool blocked_by_policy) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); TabSpecificContentSettings* settings = Get(render_process_id, render_view_id); if (settings) settings->OnFileSystemAccessed(url, blocked_by_policy); } ",0 " bool OnHostTalkGadgetPrefixPolicyUpdate( const std::string& talkgadget_prefix) { DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); if (talkgadget_prefix != talkgadget_prefix_) { LOG(INFO) << ""Updated talkgadget policy.""; talkgadget_prefix_ = talkgadget_prefix; return true; } return false; } ",0 "__be32 flow_get_u32_src(const struct flow_keys *flow) { switch (flow->control.addr_type) { case FLOW_DISSECTOR_KEY_IPV4_ADDRS: return flow->addrs.v4addrs.src; case FLOW_DISSECTOR_KEY_IPV6_ADDRS: return (__force __be32)ipv6_addr_hash( &flow->addrs.v6addrs.src); case FLOW_DISSECTOR_KEY_TIPC_ADDRS: return flow->addrs.tipcaddrs.srcnode; default: return 0; } } ",0 "int main(int argc, char **argv) { int exitcode = 0; int ii = 0, num_cases = 0; for (num_cases = 0; testcases[num_cases].description; num_cases++) { /* Just counting */ } printf(""1..%d\n"", num_cases); for (ii = 0; testcases[ii].description != NULL; ++ii) { fflush(stdout); #ifndef DEBUG /* the test program shouldn't run longer than 10 minutes... */ alarm(600); #endif enum test_return ret = testcases[ii].function(); if (ret == TEST_SKIP) { fprintf(stdout, ""ok # SKIP %d - %s\n"", ii + 1, testcases[ii].description); } else if (ret == TEST_PASS) { fprintf(stdout, ""ok %d - %s\n"", ii + 1, testcases[ii].description); } else { fprintf(stdout, ""not ok %d - %s\n"", ii + 1, testcases[ii].description); exitcode = 1; } fflush(stdout); } return exitcode; } ",0 "void EnterpriseEnrollmentScreen::OnOAuthTokenAvailable( const std::string& user, const std::string& token) { user_ = user; RegisterForDevicePolicy(token, policy::BrowserPolicyConnector::TOKEN_TYPE_OAUTH); } ",0 "cmsBool CMSEXPORT cmsIT8SetPropertyDbl(cmsHANDLE hIT8, const char* cProp, cmsFloat64Number Val) { cmsIT8* it8 = (cmsIT8*) hIT8; char Buffer[1024]; snprintf(Buffer, 1023, it8->DoubleFormatter, Val); return AddToList(it8, &GetTable(it8)->HeaderList, cProp, NULL, Buffer, WRITE_UNCOOKED) != NULL; } ",0 "void CanvasSurfaceLayerBridgeClientImpl::asyncRequestSurfaceCreation(const cc::SurfaceId& surfaceId) { m_service->RequestSurfaceCreation(surfaceId); } ",1 "GfxGouraudTriangleShading::~GfxGouraudTriangleShading() { int i; gfree(vertices); gfree(triangles); for (i = 0; i < nFuncs; ++i) { delete funcs[i]; } } ",0 "static void reds_channel_do_link(RedChannel *channel, RedClient *client, SpiceLinkMess *link_msg, RedsStream *stream) { uint32_t *caps; spice_assert(channel); spice_assert(link_msg); spice_assert(stream); caps = (uint32_t *)((uint8_t *)link_msg + link_msg->caps_offset); channel->client_cbs.connect(channel, client, stream, red_client_during_migrate_at_target(client), link_msg->num_common_caps, link_msg->num_common_caps ? caps : NULL, link_msg->num_channel_caps, link_msg->num_channel_caps ? caps + link_msg->num_common_caps : NULL); } ",0 "static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr) { struct sctp_bind_hashbucket *head; /* hash list */ struct sctp_bind_bucket *pp; unsigned short snum; int ret; snum = ntohs(addr->v4.sin_port); pr_debug(""%s: begins, snum:%d\n"", __func__, snum); local_bh_disable(); if (snum == 0) { /* Search for an available port. */ int low, high, remaining, index; unsigned int rover; struct net *net = sock_net(sk); inet_get_local_port_range(net, &low, &high); remaining = (high - low) + 1; rover = prandom_u32() % remaining + low; do { rover++; if ((rover < low) || (rover > high)) rover = low; if (inet_is_local_reserved_port(net, rover)) continue; index = sctp_phashfn(sock_net(sk), rover); head = &sctp_port_hashtable[index]; spin_lock(&head->lock); sctp_for_each_hentry(pp, &head->chain) if ((pp->port == rover) && net_eq(sock_net(sk), pp->net)) goto next; break; next: spin_unlock(&head->lock); } while (--remaining > 0); /* Exhausted local port range during search? */ ret = 1; if (remaining <= 0) goto fail; /* OK, here is the one we will use. HEAD (the port * hash table list entry) is non-NULL and we hold it's * mutex. */ snum = rover; } else { /* We are given an specific port number; we verify * that it is not being used. If it is used, we will * exahust the search in the hash list corresponding * to the port number (snum) - we detect that with the * port iterator, pp being NULL. */ head = &sctp_port_hashtable[sctp_phashfn(sock_net(sk), snum)]; spin_lock(&head->lock); sctp_for_each_hentry(pp, &head->chain) { if ((pp->port == snum) && net_eq(pp->net, sock_net(sk))) goto pp_found; } } pp = NULL; goto pp_not_found; pp_found: if (!hlist_empty(&pp->owner)) { /* We had a port hash table hit - there is an * available port (pp != NULL) and it is being * used by other socket (pp->owner not empty); that other * socket is going to be sk2. */ int reuse = sk->sk_reuse; struct sock *sk2; pr_debug(""%s: found a possible match\n"", __func__); if (pp->fastreuse && sk->sk_reuse && sk->sk_state != SCTP_SS_LISTENING) goto success; /* Run through the list of sockets bound to the port * (pp->port) [via the pointers bind_next and * bind_pprev in the struct sock *sk2 (pp->sk)]. On each one, * we get the endpoint they describe and run through * the endpoint's list of IP (v4 or v6) addresses, * comparing each of the addresses with the address of * the socket sk. If we find a match, then that means * that this port/socket (sk) combination are already * in an endpoint. */ sk_for_each_bound(sk2, &pp->owner) { struct sctp_endpoint *ep2; ep2 = sctp_sk(sk2)->ep; if (sk == sk2 || (reuse && sk2->sk_reuse && sk2->sk_state != SCTP_SS_LISTENING)) continue; if (sctp_bind_addr_conflict(&ep2->base.bind_addr, addr, sctp_sk(sk2), sctp_sk(sk))) { ret = (long)sk2; goto fail_unlock; } } pr_debug(""%s: found a match\n"", __func__); } pp_not_found: /* If there was a hash table miss, create a new port. */ ret = 1; if (!pp && !(pp = sctp_bucket_create(head, sock_net(sk), snum))) goto fail_unlock; /* In either case (hit or miss), make sure fastreuse is 1 only * if sk->sk_reuse is too (that is, if the caller requested * SO_REUSEADDR on this socket -sk-). */ if (hlist_empty(&pp->owner)) { if (sk->sk_reuse && sk->sk_state != SCTP_SS_LISTENING) pp->fastreuse = 1; else pp->fastreuse = 0; } else if (pp->fastreuse && (!sk->sk_reuse || sk->sk_state == SCTP_SS_LISTENING)) pp->fastreuse = 0; /* We are set, so fill up all the data in the hash table * entry, tie the socket list information with the rest of the * sockets FIXME: Blurry, NPI (ipg). */ success: if (!sctp_sk(sk)->bind_hash) { inet_sk(sk)->inet_num = snum; sk_add_bind_node(sk, &pp->owner); sctp_sk(sk)->bind_hash = pp; } ret = 0; fail_unlock: spin_unlock(&head->lock); fail: local_bh_enable(); return ret; } ",0 "DownloadItemImpl::ResumeMode DownloadItemImpl::GetResumeMode() const { DCHECK_CURRENTLY_ON(BrowserThread::UI); if (!GetURL().SchemeIsHTTPOrHTTPS()) return RESUME_MODE_INVALID; bool restart_required = (GetFullPath().empty() || (etag_.empty() && last_modified_time_.empty())); bool user_action_required = (auto_resume_count_ >= kMaxAutoResumeAttempts || IsPaused()); switch (last_reason_) { case DOWNLOAD_INTERRUPT_REASON_FILE_TRANSIENT_ERROR: case DOWNLOAD_INTERRUPT_REASON_NETWORK_TIMEOUT: case DOWNLOAD_INTERRUPT_REASON_SERVER_CONTENT_LENGTH_MISMATCH: break; case DOWNLOAD_INTERRUPT_REASON_SERVER_NO_RANGE: case DOWNLOAD_INTERRUPT_REASON_FILE_HASH_MISMATCH: case DOWNLOAD_INTERRUPT_REASON_FILE_TOO_SHORT: restart_required = true; break; case DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED: case DOWNLOAD_INTERRUPT_REASON_NETWORK_DISCONNECTED: case DOWNLOAD_INTERRUPT_REASON_NETWORK_SERVER_DOWN: case DOWNLOAD_INTERRUPT_REASON_SERVER_FAILED: case DOWNLOAD_INTERRUPT_REASON_SERVER_UNREACHABLE: case DOWNLOAD_INTERRUPT_REASON_USER_SHUTDOWN: case DOWNLOAD_INTERRUPT_REASON_CRASH: user_action_required = true; break; case DOWNLOAD_INTERRUPT_REASON_FILE_NO_SPACE: user_action_required = true; break; case DOWNLOAD_INTERRUPT_REASON_FILE_FAILED: case DOWNLOAD_INTERRUPT_REASON_FILE_ACCESS_DENIED: case DOWNLOAD_INTERRUPT_REASON_FILE_NAME_TOO_LONG: case DOWNLOAD_INTERRUPT_REASON_FILE_TOO_LARGE: user_action_required = true; restart_required = true; break; case DOWNLOAD_INTERRUPT_REASON_NONE: case DOWNLOAD_INTERRUPT_REASON_NETWORK_INVALID_REQUEST: case DOWNLOAD_INTERRUPT_REASON_FILE_VIRUS_INFECTED: case DOWNLOAD_INTERRUPT_REASON_SERVER_BAD_CONTENT: case DOWNLOAD_INTERRUPT_REASON_USER_CANCELED: case DOWNLOAD_INTERRUPT_REASON_FILE_BLOCKED: case DOWNLOAD_INTERRUPT_REASON_FILE_SECURITY_CHECK_FAILED: case DOWNLOAD_INTERRUPT_REASON_SERVER_UNAUTHORIZED: case DOWNLOAD_INTERRUPT_REASON_SERVER_CERT_PROBLEM: case DOWNLOAD_INTERRUPT_REASON_SERVER_FORBIDDEN: case DOWNLOAD_INTERRUPT_REASON_FILE_SAME_AS_SOURCE: return RESUME_MODE_INVALID; } if (user_action_required && restart_required) return RESUME_MODE_USER_RESTART; if (restart_required) return RESUME_MODE_IMMEDIATE_RESTART; if (user_action_required) return RESUME_MODE_USER_CONTINUE; return RESUME_MODE_IMMEDIATE_CONTINUE; } ",0 "static void voidMethodArrayBufferViewArgMethodCallback(const v8::FunctionCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMMethod""); TestObjectPythonV8Internal::voidMethodArrayBufferViewArgMethod(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "MimeUtil::MimeUtil() : allow_proprietary_codecs_(false) { #if defined(OS_ANDROID) platform_info_.has_platform_decoders = HasPlatformDecoderSupport(); platform_info_.has_platform_vp8_decoder = MediaCodecUtil::IsVp8DecoderAvailable(); platform_info_.has_platform_vp9_decoder = MediaCodecUtil::IsVp9DecoderAvailable(); platform_info_.supports_opus = PlatformHasOpusSupport(); #endif InitializeMimeTypeMaps(); } ",0 "void Layer::RemoveScrollChild(Layer* child) { scroll_children_->erase(child); if (scroll_children_->empty()) scroll_children_.reset(); SetNeedsCommit(); } ",0 "Document* CSSStyleSheet::OwnerDocument() const { const CSSStyleSheet* root = this; while (root->parentStyleSheet()) root = root->parentStyleSheet(); return root->ownerNode() ? &root->ownerNode()->GetDocument() : nullptr; } ",0 "static void ZSTD_initCCtx(ZSTD_CCtx* cctx, ZSTD_customMem memManager) { assert(cctx != NULL); memset(cctx, 0, sizeof(*cctx)); cctx->customMem = memManager; cctx->bmi2 = ZSTD_cpuid_bmi2(ZSTD_cpuid()); { size_t const err = ZSTD_CCtx_resetParameters(cctx); assert(!ZSTD_isError(err)); (void)err; } } ",0 "static int __init fwnet_init(void) { int err; err = fw_core_add_descriptor(&rfc2374_unit_directory); if (err) return err; #if IS_ENABLED(CONFIG_IPV6) err = fw_core_add_descriptor(&rfc3146_unit_directory); if (err) goto out; #endif fwnet_packet_task_cache = kmem_cache_create(""packet_task"", sizeof(struct fwnet_packet_task), 0, 0, NULL); if (!fwnet_packet_task_cache) { err = -ENOMEM; goto out2; } err = driver_register(&fwnet_driver.driver); if (!err) return 0; kmem_cache_destroy(fwnet_packet_task_cache); out2: #if IS_ENABLED(CONFIG_IPV6) fw_core_remove_descriptor(&rfc3146_unit_directory); out: #endif fw_core_remove_descriptor(&rfc2374_unit_directory); return err; } ",0 "PHP_FUNCTION(trim) { php_do_trim(INTERNAL_FUNCTION_PARAM_PASSTHRU, 3); } ",0 "nbt_tcp_print(netdissect_options *ndo, const u_char *data, int length) { int caplen; int type; u_int nbt_len; const u_char *maxbuf; if (length < 4) goto trunc; if (ndo->ndo_snapend < data) goto trunc; caplen = ndo->ndo_snapend - data; if (caplen < 4) goto trunc; maxbuf = data + caplen; ND_TCHECK_8BITS(data); type = data[0]; ND_TCHECK_16BITS(data + 2); nbt_len = EXTRACT_16BITS(data + 2); length -= 4; caplen -= 4; startbuf = data; if (ndo->ndo_vflag < 2) { ND_PRINT((ndo, "" NBT Session Packet: "")); switch (type) { case 0x00: ND_PRINT((ndo, ""Session Message"")); break; case 0x81: ND_PRINT((ndo, ""Session Request"")); break; case 0x82: ND_PRINT((ndo, ""Session Granted"")); break; case 0x83: { int ecode; if (nbt_len < 4) goto trunc; if (length < 4) goto trunc; if (caplen < 4) goto trunc; ecode = data[4]; ND_PRINT((ndo, ""Session Reject, "")); switch (ecode) { case 0x80: ND_PRINT((ndo, ""Not listening on called name"")); break; case 0x81: ND_PRINT((ndo, ""Not listening for calling name"")); break; case 0x82: ND_PRINT((ndo, ""Called name not present"")); break; case 0x83: ND_PRINT((ndo, ""Called name present, but insufficient resources"")); break; default: ND_PRINT((ndo, ""Unspecified error 0x%X"", ecode)); break; } } break; case 0x85: ND_PRINT((ndo, ""Session Keepalive"")); break; default: data = smb_fdata(ndo, data, ""Unknown packet type [rB]"", maxbuf, 0); break; } } else { ND_PRINT((ndo, ""\n>>> NBT Session Packet\n"")); switch (type) { case 0x00: data = smb_fdata(ndo, data, ""[P1]NBT Session Message\nFlags=[B]\nLength=[rd]\n"", data + 4, 0); if (data == NULL) break; if (nbt_len >= 4 && caplen >= 4 && memcmp(data,""\377SMB"",4) == 0) { if ((int)nbt_len > caplen) { if ((int)nbt_len > length) ND_PRINT((ndo, ""WARNING: Packet is continued in later TCP segments\n"")); else ND_PRINT((ndo, ""WARNING: Short packet. Try increasing the snap length by %d\n"", nbt_len - caplen)); } print_smb(ndo, data, maxbuf > data + nbt_len ? data + nbt_len : maxbuf); } else ND_PRINT((ndo, ""Session packet:(raw data or continuation?)\n"")); break; case 0x81: data = smb_fdata(ndo, data, ""[P1]NBT Session Request\nFlags=[B]\nLength=[rd]\nDestination=[n1]\nSource=[n1]\n"", maxbuf, 0); break; case 0x82: data = smb_fdata(ndo, data, ""[P1]NBT Session Granted\nFlags=[B]\nLength=[rd]\n"", maxbuf, 0); break; case 0x83: { const u_char *origdata; int ecode; origdata = data; data = smb_fdata(ndo, data, ""[P1]NBT SessionReject\nFlags=[B]\nLength=[rd]\nReason=[B]\n"", maxbuf, 0); if (data == NULL) break; if (nbt_len >= 1 && caplen >= 1) { ecode = origdata[4]; switch (ecode) { case 0x80: ND_PRINT((ndo, ""Not listening on called name\n"")); break; case 0x81: ND_PRINT((ndo, ""Not listening for calling name\n"")); break; case 0x82: ND_PRINT((ndo, ""Called name not present\n"")); break; case 0x83: ND_PRINT((ndo, ""Called name present, but insufficient resources\n"")); break; default: ND_PRINT((ndo, ""Unspecified error 0x%X\n"", ecode)); break; } } } break; case 0x85: data = smb_fdata(ndo, data, ""[P1]NBT Session Keepalive\nFlags=[B]\nLength=[rd]\n"", maxbuf, 0); break; default: data = smb_fdata(ndo, data, ""NBT - Unknown packet type\nType=[B]\n"", maxbuf, 0); break; } ND_PRINT((ndo, ""\n"")); } return; trunc: ND_PRINT((ndo, ""%s"", tstr)); } ",0 "static const char *register_mapped_file_function_hook(const char *pattern, cmd_parms *cmd, void *_cfg, const char *file, const char *function) { ap_lua_mapped_handler_spec *spec; ap_lua_dir_cfg *cfg = (ap_lua_dir_cfg *) _cfg; ap_regex_t *regex = apr_pcalloc(cmd->pool, sizeof(ap_regex_t)); if (ap_regcomp(regex, pattern,0)) { return ""Invalid regex pattern!""; } spec = apr_pcalloc(cmd->pool, sizeof(ap_lua_mapped_handler_spec)); spec->file_name = apr_pstrdup(cmd->pool, file); spec->function_name = apr_pstrdup(cmd->pool, function); spec->scope = cfg->vm_scope; spec->uri_pattern = regex; *(ap_lua_mapped_handler_spec **) apr_array_push(cfg->mapped_handlers) = spec; return NULL; } ",0 "void RenderWidgetHostViewAura::SchedulePaintIfNotInClip( const gfx::Rect& rect, const gfx::Rect& clip) { if (!clip.IsEmpty()) { gfx::Rect to_paint = gfx::SubtractRects(rect, clip); if (!to_paint.IsEmpty()) window_->SchedulePaintInRect(to_paint); } else { window_->SchedulePaintInRect(rect); } } ",0 "static void ImportRGBOQuantum(const Image *image,QuantumInfo *quantum_info, const MagickSizeType number_pixels,const unsigned char *magick_restrict p, Quantum *magick_restrict q,ExceptionInfo *exception) { QuantumAny range; register ssize_t x; unsigned int pixel; assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); switch (quantum_info->depth) { case 8: { unsigned char pixel; for (x=0; x < (ssize_t) number_pixels; x++) { p=PushCharPixel(p,&pixel); SetPixelRed(image,ScaleCharToQuantum(pixel),q); p=PushCharPixel(p,&pixel); SetPixelGreen(image,ScaleCharToQuantum(pixel),q); p=PushCharPixel(p,&pixel); SetPixelBlue(image,ScaleCharToQuantum(pixel),q); p=PushCharPixel(p,&pixel); SetPixelOpacity(image,ScaleCharToQuantum(pixel),q); p+=quantum_info->pad; q+=GetPixelChannels(image); } break; } case 10: { pixel=0; if (quantum_info->pack == MagickFalse) { register ssize_t i; size_t quantum; ssize_t n; n=0; quantum=0; for (x=0; x < (ssize_t) number_pixels; x++) { for (i=0; i < 4; i++) { switch (n % 3) { case 0: { p=PushLongPixel(quantum_info->endian,p,&pixel); quantum=(size_t) (ScaleShortToQuantum((unsigned short) (((pixel >> 22) & 0x3ff) << 6))); break; } case 1: { quantum=(size_t) (ScaleShortToQuantum((unsigned short) (((pixel >> 12) & 0x3ff) << 6))); break; } case 2: { quantum=(size_t) (ScaleShortToQuantum((unsigned short) (((pixel >> 2) & 0x3ff) << 6))); break; } } switch (i) { case 0: SetPixelRed(image,(Quantum) quantum,q); break; case 1: SetPixelGreen(image,(Quantum) quantum,q); break; case 2: SetPixelBlue(image,(Quantum) quantum,q); break; case 3: SetPixelOpacity(image,(Quantum) quantum,q); break; } n++; } p+=quantum_info->pad; q+=GetPixelChannels(image); } break; } for (x=0; x < (ssize_t) number_pixels; x++) { p=PushQuantumPixel(quantum_info,p,&pixel); SetPixelRed(image,ScaleShortToQuantum((unsigned short) (pixel << 6)),q); p=PushQuantumPixel(quantum_info,p,&pixel); SetPixelGreen(image,ScaleShortToQuantum((unsigned short) (pixel << 6)), q); p=PushQuantumPixel(quantum_info,p,&pixel); SetPixelBlue(image,ScaleShortToQuantum((unsigned short) (pixel << 6)), q); p=PushQuantumPixel(quantum_info,p,&pixel); SetPixelOpacity(image,ScaleShortToQuantum((unsigned short) (pixel << 6)), q); q+=GetPixelChannels(image); } break; } case 16: { unsigned short pixel; if (quantum_info->format == FloatingPointQuantumFormat) { for (x=0; x < (ssize_t) number_pixels; x++) { p=PushShortPixel(quantum_info->endian,p,&pixel); SetPixelRed(image,ClampToQuantum(QuantumRange* HalfToSinglePrecision(pixel)),q); p=PushShortPixel(quantum_info->endian,p,&pixel); SetPixelGreen(image,ClampToQuantum(QuantumRange* HalfToSinglePrecision(pixel)),q); p=PushShortPixel(quantum_info->endian,p,&pixel); SetPixelBlue(image,ClampToQuantum(QuantumRange* HalfToSinglePrecision(pixel)),q); p=PushShortPixel(quantum_info->endian,p,&pixel); SetPixelOpacity(image,ClampToQuantum(QuantumRange* HalfToSinglePrecision(pixel)),q); p+=quantum_info->pad; q+=GetPixelChannels(image); } break; } for (x=0; x < (ssize_t) number_pixels; x++) { p=PushShortPixel(quantum_info->endian,p,&pixel); SetPixelRed(image,ScaleShortToQuantum(pixel),q); p=PushShortPixel(quantum_info->endian,p,&pixel); SetPixelGreen(image,ScaleShortToQuantum(pixel),q); p=PushShortPixel(quantum_info->endian,p,&pixel); SetPixelBlue(image,ScaleShortToQuantum(pixel),q); p=PushShortPixel(quantum_info->endian,p,&pixel); SetPixelOpacity(image,ScaleShortToQuantum(pixel),q); p+=quantum_info->pad; q+=GetPixelChannels(image); } break; } case 32: { unsigned int pixel; if (quantum_info->format == FloatingPointQuantumFormat) { float pixel; for (x=0; x < (ssize_t) number_pixels; x++) { p=PushFloatPixel(quantum_info,p,&pixel); SetPixelRed(image,ClampToQuantum(pixel),q); p=PushFloatPixel(quantum_info,p,&pixel); SetPixelGreen(image,ClampToQuantum(pixel),q); p=PushFloatPixel(quantum_info,p,&pixel); SetPixelBlue(image,ClampToQuantum(pixel),q); p=PushFloatPixel(quantum_info,p,&pixel); SetPixelOpacity(image,ClampToQuantum(pixel),q); p+=quantum_info->pad; q+=GetPixelChannels(image); } break; } for (x=0; x < (ssize_t) number_pixels; x++) { p=PushLongPixel(quantum_info->endian,p,&pixel); SetPixelRed(image,ScaleLongToQuantum(pixel),q); p=PushLongPixel(quantum_info->endian,p,&pixel); SetPixelGreen(image,ScaleLongToQuantum(pixel),q); p=PushLongPixel(quantum_info->endian,p,&pixel); SetPixelBlue(image,ScaleLongToQuantum(pixel),q); p=PushLongPixel(quantum_info->endian,p,&pixel); SetPixelOpacity(image,ScaleLongToQuantum(pixel),q); p+=quantum_info->pad; q+=GetPixelChannels(image); } break; } case 64: { if (quantum_info->format == FloatingPointQuantumFormat) { double pixel; for (x=0; x < (ssize_t) number_pixels; x++) { p=PushDoublePixel(quantum_info,p,&pixel); SetPixelRed(image,ClampToQuantum(pixel),q); p=PushDoublePixel(quantum_info,p,&pixel); SetPixelGreen(image,ClampToQuantum(pixel),q); p=PushDoublePixel(quantum_info,p,&pixel); SetPixelBlue(image,ClampToQuantum(pixel),q); p=PushDoublePixel(quantum_info,p,&pixel); SetPixelOpacity(image,ClampToQuantum(pixel),q); p+=quantum_info->pad; q+=GetPixelChannels(image); } break; } } default: { range=GetQuantumRange(quantum_info->depth); for (x=0; x < (ssize_t) number_pixels; x++) { p=PushQuantumPixel(quantum_info,p,&pixel); SetPixelRed(image,ScaleAnyToQuantum(pixel,range),q); p=PushQuantumPixel(quantum_info,p,&pixel); SetPixelGreen(image,ScaleAnyToQuantum(pixel,range),q); p=PushQuantumPixel(quantum_info,p,&pixel); SetPixelBlue(image,ScaleAnyToQuantum(pixel,range),q); p=PushQuantumPixel(quantum_info,p,&pixel); SetPixelOpacity(image,ScaleAnyToQuantum(pixel,range),q); q+=GetPixelChannels(image); } break; } } } ",0 " bool WaitUntilSatisfied() { if (!was_observed_) message_loop_runner_->Run(); if (observer_.IsObserving(render_widget_)) observer_.Remove(render_widget_); return !did_fail_; } ",0 "png_write_row(png_structp png_ptr, png_bytep row) { if (png_ptr == NULL) return; png_debug2(1, ""in png_write_row (row %ld, pass %d)"", png_ptr->row_number, png_ptr->pass); /* Initialize transformations and other stuff if first time */ if (png_ptr->row_number == 0 && png_ptr->pass == 0) { /* Make sure we wrote the header info */ if (!(png_ptr->mode & PNG_WROTE_INFO_BEFORE_PLTE)) png_error(png_ptr, ""png_write_info was never called before png_write_row.""); /* Check for transforms that have been set but were defined out */ #if !defined(PNG_WRITE_INVERT_SUPPORTED) && defined(PNG_READ_INVERT_SUPPORTED) if (png_ptr->transformations & PNG_INVERT_MONO) png_warning(png_ptr, ""PNG_WRITE_INVERT_SUPPORTED is not defined.""); #endif #if !defined(PNG_WRITE_FILLER_SUPPORTED) && defined(PNG_READ_FILLER_SUPPORTED) if (png_ptr->transformations & PNG_FILLER) png_warning(png_ptr, ""PNG_WRITE_FILLER_SUPPORTED is not defined.""); #endif #if !defined(PNG_WRITE_PACKSWAP_SUPPORTED) && \ defined(PNG_READ_PACKSWAP_SUPPORTED) if (png_ptr->transformations & PNG_PACKSWAP) png_warning(png_ptr, ""PNG_WRITE_PACKSWAP_SUPPORTED is not defined.""); #endif #if !defined(PNG_WRITE_PACK_SUPPORTED) && defined(PNG_READ_PACK_SUPPORTED) if (png_ptr->transformations & PNG_PACK) png_warning(png_ptr, ""PNG_WRITE_PACK_SUPPORTED is not defined.""); #endif #if !defined(PNG_WRITE_SHIFT_SUPPORTED) && defined(PNG_READ_SHIFT_SUPPORTED) if (png_ptr->transformations & PNG_SHIFT) png_warning(png_ptr, ""PNG_WRITE_SHIFT_SUPPORTED is not defined.""); #endif #if !defined(PNG_WRITE_BGR_SUPPORTED) && defined(PNG_READ_BGR_SUPPORTED) if (png_ptr->transformations & PNG_BGR) png_warning(png_ptr, ""PNG_WRITE_BGR_SUPPORTED is not defined.""); #endif #if !defined(PNG_WRITE_SWAP_SUPPORTED) && defined(PNG_READ_SWAP_SUPPORTED) if (png_ptr->transformations & PNG_SWAP_BYTES) png_warning(png_ptr, ""PNG_WRITE_SWAP_SUPPORTED is not defined.""); #endif png_write_start_row(png_ptr); } #ifdef PNG_WRITE_INTERLACING_SUPPORTED /* If interlaced and not interested in row, return */ if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE)) { switch (png_ptr->pass) { case 0: if (png_ptr->row_number & 0x07) { png_write_finish_row(png_ptr); return; } break; case 1: if ((png_ptr->row_number & 0x07) || png_ptr->width < 5) { png_write_finish_row(png_ptr); return; } break; case 2: if ((png_ptr->row_number & 0x07) != 4) { png_write_finish_row(png_ptr); return; } break; case 3: if ((png_ptr->row_number & 0x03) || png_ptr->width < 3) { png_write_finish_row(png_ptr); return; } break; case 4: if ((png_ptr->row_number & 0x03) != 2) { png_write_finish_row(png_ptr); return; } break; case 5: if ((png_ptr->row_number & 0x01) || png_ptr->width < 2) { png_write_finish_row(png_ptr); return; } break; case 6: if (!(png_ptr->row_number & 0x01)) { png_write_finish_row(png_ptr); return; } break; } } #endif /* Set up row info for transformations */ png_ptr->row_info.color_type = png_ptr->color_type; png_ptr->row_info.width = png_ptr->usr_width; png_ptr->row_info.channels = png_ptr->usr_channels; png_ptr->row_info.bit_depth = png_ptr->usr_bit_depth; png_ptr->row_info.pixel_depth = (png_byte)(png_ptr->row_info.bit_depth * png_ptr->row_info.channels); png_ptr->row_info.rowbytes = PNG_ROWBYTES(png_ptr->row_info.pixel_depth, png_ptr->row_info.width); png_debug1(3, ""row_info->color_type = %d"", png_ptr->row_info.color_type); png_debug1(3, ""row_info->width = %lu"", png_ptr->row_info.width); png_debug1(3, ""row_info->channels = %d"", png_ptr->row_info.channels); png_debug1(3, ""row_info->bit_depth = %d"", png_ptr->row_info.bit_depth); png_debug1(3, ""row_info->pixel_depth = %d"", png_ptr->row_info.pixel_depth); png_debug1(3, ""row_info->rowbytes = %lu"", png_ptr->row_info.rowbytes); /* Copy user's row into buffer, leaving room for filter byte. */ png_memcpy_check(png_ptr, png_ptr->row_buf + 1, row, png_ptr->row_info.rowbytes); #ifdef PNG_WRITE_INTERLACING_SUPPORTED /* Handle interlacing */ if (png_ptr->interlaced && png_ptr->pass < 6 && (png_ptr->transformations & PNG_INTERLACE)) { png_do_write_interlace(&(png_ptr->row_info), png_ptr->row_buf + 1, png_ptr->pass); /* This should always get caught above, but still ... */ if (!(png_ptr->row_info.width)) { png_write_finish_row(png_ptr); return; } } #endif /* Handle other transformations */ if (png_ptr->transformations) png_do_write_transformations(png_ptr); #ifdef PNG_MNG_FEATURES_SUPPORTED /* Write filter_method 64 (intrapixel differencing) only if * 1. Libpng was compiled with PNG_MNG_FEATURES_SUPPORTED and * 2. Libpng did not write a PNG signature (this filter_method is only * used in PNG datastreams that are embedded in MNG datastreams) and * 3. The application called png_permit_mng_features with a mask that * included PNG_FLAG_MNG_FILTER_64 and * 4. The filter_method is 64 and * 5. The color_type is RGB or RGBA */ if ((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) && (png_ptr->filter_type == PNG_INTRAPIXEL_DIFFERENCING)) { /* Intrapixel differencing */ png_do_write_intrapixel(&(png_ptr->row_info), png_ptr->row_buf + 1); } #endif /* Find a filter if necessary, filter the row and write it out. */ png_write_find_filter(png_ptr, &(png_ptr->row_info)); if (png_ptr->write_row_fn != NULL) (*(png_ptr->write_row_fn))(png_ptr, png_ptr->row_number, png_ptr->pass); } ",0 " void ReceiveSnapshot(bool is_root, const ui::AXTreeUpdate& snapshot) { combiner_.AddTree(snapshot, is_root); } ",0 "void StyleResolver::collectFeatures() { m_features.clear(); if (CSSDefaultStyleSheets::defaultStyle) m_features.add(CSSDefaultStyleSheets::defaultStyle->features()); if (document().isViewSource()) m_features.add(CSSDefaultStyleSheets::viewSourceStyle()->features()); if (m_watchedSelectorsRules) m_features.add(m_watchedSelectorsRules->features()); m_treeBoundaryCrossingRules.collectFeaturesTo(m_features); m_styleTree.collectFeaturesTo(m_features); m_siblingRuleSet = makeRuleSet(m_features.siblingRules); m_uncommonAttributeRuleSet = makeRuleSet(m_features.uncommonAttributeRules); } ",0 "static char *shadow_copy2_convert(TALLOC_CTX *mem_ctx, struct vfs_handle_struct *handle, const char *name, time_t timestamp) { struct smb_filename converted_fname; char *result = NULL; size_t *slashes = NULL; unsigned num_slashes; char *path = NULL; size_t pathlen; char *insert = NULL; char *converted = NULL; size_t insertlen; int i, saved_errno; size_t min_offset; struct shadow_copy2_config *config; SMB_VFS_HANDLE_GET_DATA(handle, config, struct shadow_copy2_config, return NULL); DEBUG(10, (""converting '%s'\n"", name)); if (!config->snapdirseverywhere) { int ret; char *snapshot_path; snapshot_path = shadow_copy2_snapshot_path(talloc_tos(), handle, timestamp); if (snapshot_path == NULL) { goto fail; } if (config->rel_connectpath == NULL) { converted = talloc_asprintf(mem_ctx, ""%s/%s"", snapshot_path, name); } else { converted = talloc_asprintf(mem_ctx, ""%s/%s/%s"", snapshot_path, config->rel_connectpath, name); } if (converted == NULL) { goto fail; } ZERO_STRUCT(converted_fname); converted_fname.base_name = converted; ret = SMB_VFS_NEXT_LSTAT(handle, &converted_fname); DEBUG(10, (""Trying[not snapdirseverywhere] %s: %d (%s)\n"", converted, ret, ret == 0 ? ""ok"" : strerror(errno))); if (ret == 0) { DEBUG(10, (""Found %s\n"", converted)); result = converted; converted = NULL; goto fail; } else { errno = ENOENT; goto fail; } /* never reached ... */ } if (name[0] == 0) { path = talloc_strdup(mem_ctx, handle->conn->connectpath); } else { path = talloc_asprintf( mem_ctx, ""%s/%s"", handle->conn->connectpath, name); } if (path == NULL) { errno = ENOMEM; goto fail; } pathlen = talloc_get_size(path)-1; if (!shadow_copy2_find_slashes(talloc_tos(), path, &slashes, &num_slashes)) { goto fail; } insert = shadow_copy2_insert_string(talloc_tos(), handle, timestamp); if (insert == NULL) { goto fail; } insertlen = talloc_get_size(insert)-1; /* * Note: We deliberatly don't expensively initialize the * array with talloc_zero here: Putting zero into * converted[pathlen+insertlen] below is sufficient, because * in the following for loop, the insert string is inserted * at various slash places. So the memory up to position * pathlen+insertlen will always be initialized when the * converted string is used. */ converted = talloc_array(mem_ctx, char, pathlen + insertlen + 1); if (converted == NULL) { goto fail; } if (path[pathlen-1] != '/') { /* * Append a fake slash to find the snapshot root */ size_t *tmp; tmp = talloc_realloc(talloc_tos(), slashes, size_t, num_slashes+1); if (tmp == NULL) { goto fail; } slashes = tmp; slashes[num_slashes] = pathlen; num_slashes += 1; } min_offset = 0; if (!config->crossmountpoints) { min_offset = strlen(config->mount_point); } memcpy(converted, path, pathlen+1); converted[pathlen+insertlen] = '\0'; ZERO_STRUCT(converted_fname); converted_fname.base_name = converted; for (i = num_slashes-1; i>=0; i--) { int ret; size_t offset; offset = slashes[i]; if (offset < min_offset) { errno = ENOENT; goto fail; } memcpy(converted+offset, insert, insertlen); offset += insertlen; memcpy(converted+offset, path + slashes[i], pathlen - slashes[i]); ret = SMB_VFS_NEXT_LSTAT(handle, &converted_fname); DEBUG(10, (""Trying[snapdirseverywhere] %s: %d (%s)\n"", converted, ret, ret == 0 ? ""ok"" : strerror(errno))); if (ret == 0) { /* success */ break; } if (errno == ENOTDIR) { /* * This is a valid condition: We appended the * .snaphots/@GMT.. to a file name. Just try * with the upper levels. */ continue; } if (errno != ENOENT) { /* Other problem than ""not found"" */ goto fail; } } if (i >= 0) { /* * Found something */ DEBUG(10, (""Found %s\n"", converted)); result = converted; converted = NULL; } else { errno = ENOENT; } fail: saved_errno = errno; TALLOC_FREE(converted); TALLOC_FREE(insert); TALLOC_FREE(slashes); TALLOC_FREE(path); errno = saved_errno; return result; } ",0 " Blob::Blob(PassOwnPtr blobData, long long size) : m_type(blobData->contentType()) , m_size(size) { ASSERT(blobData); ScriptWrappable::init(this); m_internalURL = BlobURL::createInternalURL(); ThreadableBlobRegistry::registerBlobURL(m_internalURL, blobData); } ",1 "iakerb_make_exts(iakerb_ctx_id_t ctx, krb5_gss_ctx_ext_rec *exts) { memset(exts, 0, sizeof(*exts)); if (ctx->conv.length != 0) exts->iakerb.conv = &ctx->conv; } ",0 "static bool clp_used_exchangeid(struct nfs4_client *clp) { return clp->cl_exchange_flags != 0; } ",0 "static int ehci_state_executing(EHCIQueue *q) { EHCIPacket *p = QTAILQ_FIRST(&q->packets); assert(p != NULL); assert(p->qtdaddr == q->qtdaddr); ehci_execute_complete(q); /* 4.10.3 */ if (!q->async && q->transact_ctr > 0) { q->transact_ctr--; } /* 4.10.5 */ if (p->packet.status == USB_RET_NAK) { ehci_set_state(q->ehci, q->async, EST_HORIZONTALQH); } else { ehci_set_state(q->ehci, q->async, EST_WRITEBACK); } ehci_flush_qh(q); return 1; } ",0 "hfs_cat_get_record_offset(HFS_INFO * hfs, const hfs_btree_key_cat * needle) { HFS_CAT_GET_RECORD_OFFSET_DATA offset_data; offset_data.off = 0; offset_data.targ_key = needle; if (hfs_cat_traverse(hfs, hfs_cat_get_record_offset_cb, &offset_data)) { return 0; } return offset_data.off; } ",0 "ComponentControllerImpl::~ComponentControllerImpl() { for (WaitCallback& next_callback : termination_wait_callbacks_) { next_callback(did_terminate_abnormally_ ? 1 : 0); } } ",0 "bitmap_decompress(uint8 * output, int width, int height, uint8 * input, int size, int Bpp) { RD_BOOL rv = False; switch (Bpp) { case 1: rv = bitmap_decompress1(output, width, height, input, size); break; case 2: rv = bitmap_decompress2(output, width, height, input, size); break; case 3: rv = bitmap_decompress3(output, width, height, input, size); break; case 4: rv = bitmap_decompress4(output, width, height, input, size); break; default: logger(Core, Debug, ""bitmap_decompress(), unhandled BPP %d"", Bpp); break; } return rv; } ",0 "int regulator_list_hardware_vsel(struct regulator *regulator, unsigned selector) { struct regulator_dev *rdev = regulator->rdev; const struct regulator_ops *ops = rdev->desc->ops; if (selector >= rdev->desc->n_voltages) return -EINVAL; if (ops->set_voltage_sel != regulator_set_voltage_sel_regmap) return -EOPNOTSUPP; return selector; } ",0 "mailimf_resent_bcc_parse(const char * message, size_t length, size_t * indx, struct mailimf_bcc ** result) { struct mailimf_address_list * addr_list; struct mailimf_bcc * bcc; size_t cur_token; int r; int res; cur_token = * indx; bcc = NULL; r = mailimf_token_case_insensitive_parse(message, length, &cur_token, ""Resent-Bcc""); if (r != MAILIMF_NO_ERROR) { res = r; goto err; } r = mailimf_colon_parse(message, length, &cur_token); if (r != MAILIMF_NO_ERROR) { res = r; goto err; } addr_list = NULL; r = mailimf_address_list_parse(message, length, &cur_token, &addr_list); if ((r != MAILIMF_NO_ERROR) && (r != MAILIMF_ERROR_PARSE)) { res = r; goto err; } r = mailimf_unstrict_crlf_parse(message, length, &cur_token); if (r != MAILIMF_NO_ERROR) { res = r; goto free_addr_list; } bcc = mailimf_bcc_new(addr_list); if (bcc == NULL) { res = MAILIMF_ERROR_MEMORY; goto free_addr_list; } * result = bcc; * indx = cur_token; return TRUE; free_addr_list: mailimf_address_list_free(addr_list); err: return res; } ",0 "MagickBooleanType sixel_decode(unsigned char /* in */ *p, /* sixel bytes */ unsigned char /* out */ **pixels, /* decoded pixels */ size_t /* out */ *pwidth, /* image width */ size_t /* out */ *pheight, /* image height */ unsigned char /* out */ **palette, /* ARGB palette */ size_t /* out */ *ncolors /* palette size (<= 256) */) { int n, i, r, g, b, sixel_vertical_mask, c; int posision_x, posision_y; int max_x, max_y; int attributed_pan, attributed_pad; int attributed_ph, attributed_pv; int repeat_count, color_index, max_color_index = 2, background_color_index; int param[10]; int sixel_palet[SIXEL_PALETTE_MAX]; unsigned char *imbuf, *dmbuf; int imsx, imsy; int dmsx, dmsy; int y; posision_x = posision_y = 0; max_x = max_y = 0; attributed_pan = 2; attributed_pad = 1; attributed_ph = attributed_pv = 0; repeat_count = 1; color_index = 0; background_color_index = 0; imsx = 2048; imsy = 2048; imbuf = (unsigned char *) AcquireQuantumMemory(imsx * imsy,1); if (imbuf == NULL) { return(MagickFalse); } for (n = 0; n < 16; n++) { sixel_palet[n] = sixel_default_color_table[n]; } /* colors 16-231 are a 6x6x6 color cube */ for (r = 0; r < 6; r++) { for (g = 0; g < 6; g++) { for (b = 0; b < 6; b++) { sixel_palet[n++] = SIXEL_RGB(r * 51, g * 51, b * 51); } } } /* colors 232-255 are a grayscale ramp, intentionally leaving out */ for (i = 0; i < 24; i++) { sixel_palet[n++] = SIXEL_RGB(i * 11, i * 11, i * 11); } for (; n < SIXEL_PALETTE_MAX; n++) { sixel_palet[n] = SIXEL_RGB(255, 255, 255); } (void) ResetMagickMemory(imbuf, background_color_index, imsx * imsy); while (*p != '\0') { if ((p[0] == '\033' && p[1] == 'P') || *p == 0x90) { if (*p == '\033') { p++; } p = get_params(++p, param, &n); if (*p == 'q') { p++; if (n > 0) { /* Pn1 */ switch(param[0]) { case 0: case 1: attributed_pad = 2; break; case 2: attributed_pad = 5; break; case 3: attributed_pad = 4; break; case 4: attributed_pad = 4; break; case 5: attributed_pad = 3; break; case 6: attributed_pad = 3; break; case 7: attributed_pad = 2; break; case 8: attributed_pad = 2; break; case 9: attributed_pad = 1; break; } } if (n > 2) { /* Pn3 */ if (param[2] == 0) { param[2] = 10; } attributed_pan = attributed_pan * param[2] / 10; attributed_pad = attributed_pad * param[2] / 10; if (attributed_pan <= 0) attributed_pan = 1; if (attributed_pad <= 0) attributed_pad = 1; } } } else if ((p[0] == '\033' && p[1] == '\\') || *p == 0x9C) { break; } else if (*p == '""') { /* DECGRA Set Raster Attributes "" Pan; Pad; Ph; Pv */ p = get_params(++p, param, &n); if (n > 0) attributed_pad = param[0]; if (n > 1) attributed_pan = param[1]; if (n > 2 && param[2] > 0) attributed_ph = param[2]; if (n > 3 && param[3] > 0) attributed_pv = param[3]; if (attributed_pan <= 0) attributed_pan = 1; if (attributed_pad <= 0) attributed_pad = 1; if (imsx < attributed_ph || imsy < attributed_pv) { dmsx = imsx > attributed_ph ? imsx : attributed_ph; dmsy = imsy > attributed_pv ? imsy : attributed_pv; dmbuf = (unsigned char *) AcquireQuantumMemory(dmsx * dmsy,1); if (dmbuf == (unsigned char *) NULL) { imbuf = (unsigned char *) RelinquishMagickMemory(imbuf); return (MagickFalse); } (void) ResetMagickMemory(dmbuf, background_color_index, dmsx * dmsy); for (y = 0; y < imsy; ++y) { (void) CopyMagickMemory(dmbuf + dmsx * y, imbuf + imsx * y, imsx); } imbuf = (unsigned char *) RelinquishMagickMemory(imbuf); imsx = dmsx; imsy = dmsy; imbuf = dmbuf; } } else if (*p == '!') { /* DECGRI Graphics Repeat Introducer ! Pn Ch */ p = get_params(++p, param, &n); if (n > 0) { repeat_count = param[0]; } } else if (*p == '#') { /* DECGCI Graphics Color Introducer # Pc; Pu; Px; Py; Pz */ p = get_params(++p, param, &n); if (n > 0) { if ((color_index = param[0]) < 0) { color_index = 0; } else if (color_index >= SIXEL_PALETTE_MAX) { color_index = SIXEL_PALETTE_MAX - 1; } } if (n > 4) { if (param[1] == 1) { /* HLS */ if (param[2] > 360) param[2] = 360; if (param[3] > 100) param[3] = 100; if (param[4] > 100) param[4] = 100; sixel_palet[color_index] = hls_to_rgb(param[2] * 100 / 360, param[3], param[4]); } else if (param[1] == 2) { /* RGB */ if (param[2] > 100) param[2] = 100; if (param[3] > 100) param[3] = 100; if (param[4] > 100) param[4] = 100; sixel_palet[color_index] = SIXEL_XRGB(param[2], param[3], param[4]); } } } else if (*p == '$') { /* DECGCR Graphics Carriage Return */ p++; posision_x = 0; repeat_count = 1; } else if (*p == '-') { /* DECGNL Graphics Next Line */ p++; posision_x = 0; posision_y += 6; repeat_count = 1; } else if (*p >= '?' && *p <= '\177') { if (imsx < (posision_x + repeat_count) || imsy < (posision_y + 6)) { int nx = imsx * 2; int ny = imsy * 2; while (nx < (posision_x + repeat_count) || ny < (posision_y + 6)) { nx *= 2; ny *= 2; } dmsx = nx; dmsy = ny; dmbuf = (unsigned char *) AcquireQuantumMemory(dmsx * dmsy,1); if (dmbuf == (unsigned char *) NULL) { imbuf = (unsigned char *) RelinquishMagickMemory(imbuf); return (MagickFalse); } (void) ResetMagickMemory(dmbuf, background_color_index, dmsx * dmsy); for (y = 0; y < imsy; ++y) { (void) CopyMagickMemory(dmbuf + dmsx * y, imbuf + imsx * y, imsx); } imbuf = (unsigned char *) RelinquishMagickMemory(imbuf); imsx = dmsx; imsy = dmsy; imbuf = dmbuf; } if (color_index > max_color_index) { max_color_index = color_index; } if ((b = *(p++) - '?') == 0) { posision_x += repeat_count; } else { sixel_vertical_mask = 0x01; if (repeat_count <= 1) { for (i = 0; i < 6; i++) { if ((b & sixel_vertical_mask) != 0) { imbuf[imsx * (posision_y + i) + posision_x] = color_index; if (max_x < posision_x) { max_x = posision_x; } if (max_y < (posision_y + i)) { max_y = posision_y + i; } } sixel_vertical_mask <<= 1; } posision_x += 1; } else { /* repeat_count > 1 */ for (i = 0; i < 6; i++) { if ((b & sixel_vertical_mask) != 0) { c = sixel_vertical_mask << 1; for (n = 1; (i + n) < 6; n++) { if ((b & c) == 0) { break; } c <<= 1; } for (y = posision_y + i; y < posision_y + i + n; ++y) { (void) ResetMagickMemory(imbuf + imsx * y + posision_x, color_index, repeat_count); } if (max_x < (posision_x + repeat_count - 1)) { max_x = posision_x + repeat_count - 1; } if (max_y < (posision_y + i + n - 1)) { max_y = posision_y + i + n - 1; } i += (n - 1); sixel_vertical_mask <<= (n - 1); } sixel_vertical_mask <<= 1; } posision_x += repeat_count; } } repeat_count = 1; } else { p++; } } if (++max_x < attributed_ph) { max_x = attributed_ph; } if (++max_y < attributed_pv) { max_y = attributed_pv; } if (imsx > max_x || imsy > max_y) { dmsx = max_x; dmsy = max_y; if ((dmbuf = (unsigned char *) AcquireQuantumMemory(dmsx * dmsy,1)) == NULL) { imbuf = (unsigned char *) RelinquishMagickMemory(imbuf); return (MagickFalse); } for (y = 0; y < dmsy; ++y) { (void) CopyMagickMemory(dmbuf + dmsx * y, imbuf + imsx * y, dmsx); } imbuf = (unsigned char *) RelinquishMagickMemory(imbuf); imsx = dmsx; imsy = dmsy; imbuf = dmbuf; } *pixels = imbuf; *pwidth = imsx; *pheight = imsy; *ncolors = max_color_index + 1; *palette = (unsigned char *) AcquireQuantumMemory(*ncolors,4); for (n = 0; n < (ssize_t) *ncolors; ++n) { (*palette)[n * 4 + 0] = sixel_palet[n] >> 16 & 0xff; (*palette)[n * 4 + 1] = sixel_palet[n] >> 8 & 0xff; (*palette)[n * 4 + 2] = sixel_palet[n] & 0xff; (*palette)[n * 4 + 3] = 0xff; } return(MagickTrue); } ",1 "FileTransfer::RemoveInputFiles(const char *sandbox_path) { char *old_iwd; int old_transfer_flag; StringList do_not_remove; const char *f; if (!sandbox_path) { ASSERT(SpoolSpace); sandbox_path = SpoolSpace; } if ( !IsDirectory(sandbox_path) ) { return; } old_iwd = Iwd; old_transfer_flag = m_final_transfer_flag; Iwd = strdup(sandbox_path); m_final_transfer_flag = 1; ComputeFilesToSend(); if ( FilesToSend == NULL ) { FilesToSend = OutputFiles; EncryptFiles = EncryptOutputFiles; DontEncryptFiles = DontEncryptOutputFiles; } FilesToSend->rewind(); while ( (f=FilesToSend->next()) ) { do_not_remove.append( condor_basename(f) ); } Directory dir( sandbox_path, desired_priv_state ); while( (f=dir.Next()) ) { if( dir.IsDirectory() ) { continue; } if ( do_not_remove.file_contains(f) == TRUE ) { continue; } dir.Remove_Current_File(); } m_final_transfer_flag = old_transfer_flag; free(Iwd); Iwd = old_iwd; return; } ",0 " void GetOriginsModifiedSince(StorageType type, base::Time modified_since) { modified_origins_.clear(); modified_origins_type_ = kStorageTypeUnknown; quota_manager_->GetOriginsModifiedSince(type, modified_since, callback_factory_.NewCallback( &QuotaManagerTest::DidGetModifiedOrigins)); } ",0 "unsigned lodepng_encode_memory(unsigned char** out, size_t* outsize, const unsigned char* image, unsigned w, unsigned h, LodePNGColorType colortype, unsigned bitdepth) { unsigned error; LodePNGState state; lodepng_state_init(&state); state.info_raw.colortype = colortype; state.info_raw.bitdepth = bitdepth; state.info_png.color.colortype = colortype; state.info_png.color.bitdepth = bitdepth; lodepng_encode(out, outsize, image, w, h, &state); error = state.error; lodepng_state_cleanup(&state); return error; } ",0 "void svc_rdma_wc_inv(struct ib_cq *cq, struct ib_wc *wc) { svc_rdma_send_wc_common_put(cq, wc, ""localInv""); } ",0 "void LocalFrame::SetIsInert(bool inert) { is_inert_ = inert; PropagateInertToChildFrames(); } ",0 "SProcXvSelectVideoNotify(ClientPtr client) { REQUEST(xvSelectVideoNotifyReq); REQUEST_SIZE_MATCH(xvSelectVideoNotifyReq); swaps(&stuff->length); swapl(&stuff->drawable); return XvProcVector[xv_SelectVideoNotify] (client); } ",0 "static int ext4_load_journal(struct super_block *sb, struct ext4_super_block *es, unsigned long journal_devnum) { journal_t *journal; unsigned int journal_inum = le32_to_cpu(es->s_journal_inum); dev_t journal_dev; int err = 0; int really_read_only; BUG_ON(!ext4_has_feature_journal(sb)); if (journal_devnum && journal_devnum != le32_to_cpu(es->s_journal_dev)) { ext4_msg(sb, KERN_INFO, ""external journal device major/minor "" ""numbers have changed""); journal_dev = new_decode_dev(journal_devnum); } else journal_dev = new_decode_dev(le32_to_cpu(es->s_journal_dev)); really_read_only = bdev_read_only(sb->s_bdev); /* * Are we loading a blank journal or performing recovery after a * crash? For recovery, we need to check in advance whether we * can get read-write access to the device. */ if (ext4_has_feature_journal_needs_recovery(sb)) { if (sb->s_flags & MS_RDONLY) { ext4_msg(sb, KERN_INFO, ""INFO: recovery "" ""required on readonly filesystem""); if (really_read_only) { ext4_msg(sb, KERN_ERR, ""write access "" ""unavailable, cannot proceed""); return -EROFS; } ext4_msg(sb, KERN_INFO, ""write access will "" ""be enabled during recovery""); } } if (journal_inum && journal_dev) { ext4_msg(sb, KERN_ERR, ""filesystem has both journal "" ""and inode journals!""); return -EINVAL; } if (journal_inum) { if (!(journal = ext4_get_journal(sb, journal_inum))) return -EINVAL; } else { if (!(journal = ext4_get_dev_journal(sb, journal_dev))) return -EINVAL; } if (!(journal->j_flags & JBD2_BARRIER)) ext4_msg(sb, KERN_INFO, ""barriers disabled""); if (!ext4_has_feature_journal_needs_recovery(sb)) err = jbd2_journal_wipe(journal, !really_read_only); if (!err) { char *save = kmalloc(EXT4_S_ERR_LEN, GFP_KERNEL); if (save) memcpy(save, ((char *) es) + EXT4_S_ERR_START, EXT4_S_ERR_LEN); err = jbd2_journal_load(journal); if (save) memcpy(((char *) es) + EXT4_S_ERR_START, save, EXT4_S_ERR_LEN); kfree(save); } if (err) { ext4_msg(sb, KERN_ERR, ""error loading journal""); jbd2_journal_destroy(journal); return err; } EXT4_SB(sb)->s_journal = journal; ext4_clear_journal_err(sb, es); if (!really_read_only && journal_devnum && journal_devnum != le32_to_cpu(es->s_journal_dev)) { es->s_journal_dev = cpu_to_le32(journal_devnum); /* Make sure we flush the recovery flag to disk. */ ext4_commit_super(sb, 1); } return 0; } ",0 "void RenderFrameImpl::DidRunContentWithCertificateErrors() { Send(new FrameHostMsg_DidRunContentWithCertificateErrors(routing_id_)); } ",0 "static struct page **__atomic_get_pages(void *addr) { struct dma_pool *pool = &atomic_pool; struct page **pages = pool->pages; int offs = (addr - pool->vaddr) >> PAGE_SHIFT; return pages + offs; } ",0 "PluginInfoMessageFilter::Context::Context() : render_process_id_(0), resource_context_(NULL), host_content_settings_map_(NULL) { } ",0 "void EnsureBlinkInitialized() { g_mock_blink_platform.Get(); } ",0 "ar6000_ratemask_rx(void *devt, u32 ratemask) { struct ar6_softc *ar = (struct ar6_softc *)devt; ar->arRateMask = ratemask; wake_up(&arEvent); } ",0 "bool DirectoryBackingStore::SaveChanges( const Directory::SaveChangesSnapshot& snapshot) { sqlite3* dbhandle = LazyGetSaveHandle(); bool save_info = (Directory::KERNEL_SHARE_INFO_DIRTY == snapshot.kernel_info_status); if (snapshot.dirty_metas.size() < 1 && !save_info) return true; sqlite_utils::SQLTransaction transaction(dbhandle); if (SQLITE_OK != transaction.BeginExclusive()) return false; for (EntryKernelSet::const_iterator i = snapshot.dirty_metas.begin(); i != snapshot.dirty_metas.end(); ++i) { DCHECK(i->is_dirty()); if (!SaveEntryToDB(*i)) return false; } if (!DeleteEntries(snapshot.metahandles_to_purge)) return false; if (save_info) { const Directory::PersistedKernelInfo& info = snapshot.kernel_info; sqlite_utils::SQLStatement update; update.prepare(dbhandle, ""UPDATE share_info "" ""SET store_birthday = ?, "" ""next_id = ?, "" ""notification_state = ? ""); update.bind_string(0, info.store_birthday); update.bind_int64(1, info.next_id); update.bind_blob(2, info.notification_state.data(), info.notification_state.size()); if (!(SQLITE_DONE == update.step() && SQLITE_OK == update.reset() && 1 == update.changes())) { return false; } for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { sqlite_utils::SQLStatement op; op.prepare(dbhandle, ""INSERT OR REPLACE INTO models (model_id, "" ""progress_marker, initial_sync_ended) VALUES ( ?, ?, ?)""); string model_id = ModelTypeEnumToModelId(ModelTypeFromInt(i)); string progress_marker; info.download_progress[i].SerializeToString(&progress_marker); op.bind_blob(0, model_id.data(), model_id.length()); op.bind_blob(1, progress_marker.data(), progress_marker.length()); op.bind_bool(2, info.initial_sync_ended[i]); if (!(SQLITE_DONE == op.step() && SQLITE_OK == op.reset() && 1 == op.changes())) { return false; } } } return (SQLITE_OK == transaction.Commit()); } ",0 "void dump_stack(void) { show_stack(NULL, NULL); } ",0 "void ap_cancel_message(struct ap_device *ap_dev, struct ap_message *ap_msg) { struct ap_message *tmp; spin_lock_bh(&ap_dev->lock); if (!list_empty(&ap_msg->list)) { list_for_each_entry(tmp, &ap_dev->pendingq, list) if (tmp->psmid == ap_msg->psmid) { ap_dev->pendingq_count--; goto found; } ap_dev->requestq_count--; found: list_del_init(&ap_msg->list); } spin_unlock_bh(&ap_dev->lock); } ",0 "void DownloadItemImpl::DetermineDownloadTarget() { DCHECK_CURRENTLY_ON(BrowserThread::UI); DVLOG(20) << __func__ << ""() "" << DebugString(true); RecordDownloadCount(DETERMINE_DOWNLOAD_TARGET_COUNT); delegate_->DetermineDownloadTarget( this, base::Bind(&DownloadItemImpl::OnDownloadTargetDetermined, weak_ptr_factory_.GetWeakPtr())); } ",0 "static ssize_t local_readlink(FsContext *fs_ctx, V9fsPath *fs_path, char *buf, size_t bufsz) { ssize_t tsize = -1; if ((fs_ctx->export_flags & V9FS_SM_MAPPED) || (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE)) { int fd; fd = local_open_nofollow(fs_ctx, fs_path->data, O_RDONLY, 0); if (fd == -1) { return -1; } do { tsize = read(fd, (void *)buf, bufsz); } while (tsize == -1 && errno == EINTR); close_preserve_errno(fd); } else if ((fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) || (fs_ctx->export_flags & V9FS_SM_NONE)) { char *dirpath = g_path_get_dirname(fs_path->data); char *name = g_path_get_basename(fs_path->data); int dirfd; dirfd = local_opendir_nofollow(fs_ctx, dirpath); if (dirfd == -1) { goto out; } tsize = readlinkat(dirfd, name, buf, bufsz); close_preserve_errno(dirfd); out: g_free(name); g_free(dirpath); } return tsize; } ",0 "static inline void tcp_init_undo(struct tcp_sock *tp) { tp->undo_marker = tp->snd_una; /* Retransmission still in flight may cause DSACKs later. */ tp->undo_retrans = tp->retrans_out ? : -1; } ",0 "JSObject* JSTestNamedConstructorPrototype::self(ExecState* exec, JSGlobalObject* globalObject) { return getDOMPrototype(exec, globalObject); } ",0 "struct sctp_chunk *sctp_make_asconf_set_prim(struct sctp_association *asoc, union sctp_addr *addr) { sctp_addip_param_t param; struct sctp_chunk *retval; int len = sizeof(param); union sctp_addr_param addrparam; int addrlen; struct sctp_af *af = sctp_get_af_specific(addr->v4.sin_family); addrlen = af->to_addr_param(addr, &addrparam); if (!addrlen) return NULL; len += addrlen; /* Create the chunk and make asconf header. */ retval = sctp_make_asconf(asoc, addr, len); if (!retval) return NULL; param.param_hdr.type = SCTP_PARAM_SET_PRIMARY; param.param_hdr.length = htons(len); param.crr_id = 0; sctp_addto_chunk(retval, sizeof(param), ¶m); sctp_addto_chunk(retval, addrlen, &addrparam); return retval; } ",0 "struct nfc_llcp_local *nfc_llcp_find_local(struct nfc_dev *dev) { struct nfc_llcp_local *local; list_for_each_entry(local, &llcp_devices, list) if (local->dev == dev) return local; pr_debug(""No device found\n""); return NULL; } ",0 "void GLES2DecoderImpl::DoBindTexture(GLenum target, GLuint client_id) { TextureManager::TextureInfo* info = NULL; GLuint service_id = 0; if (client_id != 0) { info = GetTextureInfo(client_id); if (!info) { if (!group_->bind_generates_resource()) { LOG(ERROR) << ""glBindTexture: id not generated by glGenTextures""; current_decoder_error_ = error::kGenericError; return; } glGenTextures(1, &service_id); DCHECK_NE(0u, service_id); CreateTextureInfo(client_id, service_id); info = GetTextureInfo(client_id); IdAllocatorInterface* id_allocator = group_->GetIdAllocator(id_namespaces::kTextures); id_allocator->MarkAsUsed(client_id); } } else { info = texture_manager()->GetDefaultTextureInfo(target); } if (info->target() != 0 && info->target() != target) { SetGLError(GL_INVALID_OPERATION, ""glBindTexture"", ""texture bound to more than 1 target.""); return; } if (info->IsStreamTexture() && target != GL_TEXTURE_EXTERNAL_OES) { SetGLError(GL_INVALID_OPERATION, ""glBindTexture"", ""illegal target for stream texture.""); return; } if (info->target() == 0) { texture_manager()->SetInfoTarget(info, target); } glBindTexture(target, info->service_id()); TextureUnit& unit = texture_units_[active_texture_unit_]; unit.bind_target = target; switch (target) { case GL_TEXTURE_2D: unit.bound_texture_2d = info; break; case GL_TEXTURE_CUBE_MAP: unit.bound_texture_cube_map = info; break; case GL_TEXTURE_EXTERNAL_OES: unit.bound_texture_external_oes = info; if (info->IsStreamTexture()) { DCHECK(stream_texture_manager_); StreamTexture* stream_tex = stream_texture_manager_->LookupStreamTexture(info->service_id()); if (stream_tex) stream_tex->Update(); } break; case GL_TEXTURE_RECTANGLE_ARB: unit.bound_texture_rectangle_arb = info; break; default: NOTREACHED(); // Validation should prevent us getting here. break; } } ",0 "void ServiceWorkerHandler::OnWorkerRegistrationUpdated( const std::vector& registrations) { using Registration = ServiceWorker::ServiceWorkerRegistration; std::unique_ptr> result = protocol::Array::create(); for (const auto& registration : registrations) { result->addItem(Registration::Create() .SetRegistrationId( base::Int64ToString(registration.registration_id)) .SetScopeURL(registration.pattern.spec()) .SetIsDeleted(registration.delete_flag == ServiceWorkerRegistrationInfo::IS_DELETED) .Build()); } frontend_->WorkerRegistrationUpdated(std::move(result)); } ",0 "static struct request *__get_request(struct request_list *rl, unsigned int op, struct bio *bio, blk_mq_req_flags_t flags, gfp_t gfp_mask) { struct request_queue *q = rl->q; struct request *rq; struct elevator_type *et = q->elevator->type; struct io_context *ioc = rq_ioc(bio); struct io_cq *icq = NULL; const bool is_sync = op_is_sync(op); int may_queue; req_flags_t rq_flags = RQF_ALLOCED; lockdep_assert_held(q->queue_lock); if (unlikely(blk_queue_dying(q))) return ERR_PTR(-ENODEV); may_queue = elv_may_queue(q, op); if (may_queue == ELV_MQUEUE_NO) goto rq_starved; if (rl->count[is_sync]+1 >= queue_congestion_on_threshold(q)) { if (rl->count[is_sync]+1 >= q->nr_requests) { /* * The queue will fill after this allocation, so set * it as full, and mark this process as ""batching"". * This process will be allowed to complete a batch of * requests, others will be blocked. */ if (!blk_rl_full(rl, is_sync)) { ioc_set_batching(q, ioc); blk_set_rl_full(rl, is_sync); } else { if (may_queue != ELV_MQUEUE_MUST && !ioc_batching(q, ioc)) { /* * The queue is full and the allocating * process is not a ""batcher"", and not * exempted by the IO scheduler */ return ERR_PTR(-ENOMEM); } } } blk_set_congested(rl, is_sync); } /* * Only allow batching queuers to allocate up to 50% over the defined * limit of requests, otherwise we could have thousands of requests * allocated with any setting of ->nr_requests */ if (rl->count[is_sync] >= (3 * q->nr_requests / 2)) return ERR_PTR(-ENOMEM); q->nr_rqs[is_sync]++; rl->count[is_sync]++; rl->starved[is_sync] = 0; /* * Decide whether the new request will be managed by elevator. If * so, mark @rq_flags and increment elvpriv. Non-zero elvpriv will * prevent the current elevator from being destroyed until the new * request is freed. This guarantees icq's won't be destroyed and * makes creating new ones safe. * * Flush requests do not use the elevator so skip initialization. * This allows a request to share the flush and elevator data. * * Also, lookup icq while holding queue_lock. If it doesn't exist, * it will be created after releasing queue_lock. */ if (!op_is_flush(op) && !blk_queue_bypass(q)) { rq_flags |= RQF_ELVPRIV; q->nr_rqs_elvpriv++; if (et->icq_cache && ioc) icq = ioc_lookup_icq(ioc, q); } if (blk_queue_io_stat(q)) rq_flags |= RQF_IO_STAT; spin_unlock_irq(q->queue_lock); /* allocate and init request */ rq = mempool_alloc(rl->rq_pool, gfp_mask); if (!rq) goto fail_alloc; blk_rq_init(q, rq); blk_rq_set_rl(rq, rl); rq->cmd_flags = op; rq->rq_flags = rq_flags; if (flags & BLK_MQ_REQ_PREEMPT) rq->rq_flags |= RQF_PREEMPT; /* init elvpriv */ if (rq_flags & RQF_ELVPRIV) { if (unlikely(et->icq_cache && !icq)) { if (ioc) icq = ioc_create_icq(ioc, q, gfp_mask); if (!icq) goto fail_elvpriv; } rq->elv.icq = icq; if (unlikely(elv_set_request(q, rq, bio, gfp_mask))) goto fail_elvpriv; /* @rq->elv.icq holds io_context until @rq is freed */ if (icq) get_io_context(icq->ioc); } out: /* * ioc may be NULL here, and ioc_batching will be false. That's * OK, if the queue is under the request limit then requests need * not count toward the nr_batch_requests limit. There will always * be some limit enforced by BLK_BATCH_TIME. */ if (ioc_batching(q, ioc)) ioc->nr_batch_requests--; trace_block_getrq(q, bio, op); return rq; fail_elvpriv: /* * elvpriv init failed. ioc, icq and elvpriv aren't mempool backed * and may fail indefinitely under memory pressure and thus * shouldn't stall IO. Treat this request as !elvpriv. This will * disturb iosched and blkcg but weird is bettern than dead. */ printk_ratelimited(KERN_WARNING ""%s: dev %s: request aux data allocation failed, iosched may be disturbed\n"", __func__, dev_name(q->backing_dev_info->dev)); rq->rq_flags &= ~RQF_ELVPRIV; rq->elv.icq = NULL; spin_lock_irq(q->queue_lock); q->nr_rqs_elvpriv--; spin_unlock_irq(q->queue_lock); goto out; fail_alloc: /* * Allocation failed presumably due to memory. Undo anything we * might have messed up. * * Allocating task should really be put onto the front of the wait * queue, but this is pretty rare. */ spin_lock_irq(q->queue_lock); freed_request(rl, is_sync, rq_flags); /* * in the very unlikely event that allocation failed and no * requests for this direction was pending, mark us starved so that * freeing of a request in the other direction will notice * us. another possible fix would be to split the rq mempool into * READ and WRITE */ rq_starved: if (unlikely(rl->count[is_sync] == 0)) rl->starved[is_sync] = 1; return ERR_PTR(-ENOMEM); } ",0 "pgp_strip_path(sc_card_t *card, const sc_path_t *path) { unsigned int start_point = 0; /* start_point will move through the path string */ if (path->len == 0) return 0; /* ignore 3F00 (MF) at the beginning */ start_point = (memcmp(path->value, ""\x3f\x00"", 2) == 0) ? 2 : 0; /* strip path of PKCS15-App DF (5015) */ start_point += (memcmp(path->value + start_point, ""\x50\x15"", 2) == 0) ? 2 : 0; return start_point; } ",0 " void EnablePreferredSizeMode() { view()->OnEnablePreferredSizeChangedMode(); } ",0 "void InspectorController::setDeviceScaleAdjustment(float deviceScaleAdjustment) { m_pageAgent->setDeviceScaleAdjustment(deviceScaleAdjustment); } ",0 " std::list* GetDetails() { return &details_; } ",0 " void InspectorResourceAgent::canClearBrowserCookies(ErrorString*, bool* result) { *result = true; } ",0 "PHP_FUNCTION(openssl_csr_new) { struct php_x509_request req; zval * args = NULL, * dn, *attribs = NULL; zval * out_pkey; X509_REQ * csr = NULL; int we_made_the_key = 1; zend_resource *key_resource; if (zend_parse_parameters(ZEND_NUM_ARGS(), ""az/|a!a!"", &dn, &out_pkey, &args, &attribs) == FAILURE) { return; } RETVAL_FALSE; PHP_SSL_REQ_INIT(&req); if (PHP_SSL_REQ_PARSE(&req, args) == SUCCESS) { /* Generate or use a private key */ if (Z_TYPE_P(out_pkey) != IS_NULL) { req.priv_key = php_openssl_evp_from_zval(out_pkey, 0, NULL, 0, 0, &key_resource); if (req.priv_key != NULL) { we_made_the_key = 0; } } if (req.priv_key == NULL) { php_openssl_generate_private_key(&req); } if (req.priv_key == NULL) { php_error_docref(NULL, E_WARNING, ""Unable to generate a private key""); } else { csr = X509_REQ_new(); if (csr) { if (php_openssl_make_REQ(&req, csr, dn, attribs) == SUCCESS) { X509V3_CTX ext_ctx; X509V3_set_ctx(&ext_ctx, NULL, NULL, csr, NULL, 0); X509V3_set_conf_lhash(&ext_ctx, req.req_config); /* Add extensions */ if (req.request_extensions_section && !X509V3_EXT_REQ_add_conf(req.req_config, &ext_ctx, req.request_extensions_section, csr)) { php_error_docref(NULL, E_WARNING, ""Error loading extension section %s"", req.request_extensions_section); } else { RETVAL_TRUE; if (X509_REQ_sign(csr, req.priv_key, req.digest)) { ZVAL_RES(return_value, zend_register_resource(csr, le_csr)); csr = NULL; } else { php_error_docref(NULL, E_WARNING, ""Error signing request""); } if (we_made_the_key) { /* and a resource for the private key */ zval_dtor(out_pkey); ZVAL_RES(out_pkey, zend_register_resource(req.priv_key, le_key)); req.priv_key = NULL; /* make sure the cleanup code doesn't zap it! */ } else if (key_resource != NULL) { req.priv_key = NULL; /* make sure the cleanup code doesn't zap it! */ } } } else { if (!we_made_the_key) { /* if we have not made the key we are not supposed to zap it by calling dispose! */ req.priv_key = NULL; } } } } } if (csr) { X509_REQ_free(csr); } PHP_SSL_REQ_DISPOSE(&req); } ",0 "ewk_frame_scroll_pos_get(const Evas_Object* ewkFrame, int* x, int* y) { if (x) *x = 0; if (y) *y = 0; EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData, false); EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->frame, false); EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->frame->view(), false); WebCore::IntPoint pos = smartData->frame->view()->scrollPosition(); if (x) *x = pos.x(); if (y) *y = pos.y(); return true; } ",0 " static PaintChunk Chunk(const PropertyTreeState& state) { DEFINE_STATIC_LOCAL(FakeDisplayItemClient, fake_client, ()); DEFINE_STATIC_LOCAL( base::Optional, id, (PaintChunk::Id(fake_client, DisplayItem::kDrawingFirst))); PaintChunk chunk(0, 0, *id, state); return chunk; } ",0 "void WebPageProxy::didFailProvisionalLoadForFrame(uint64_t frameID, const ResourceError& error, CoreIPC::ArgumentDecoder* arguments) { RefPtr userData; WebContextUserMessageDecoder messageDecoder(userData, context()); if (!arguments->decode(messageDecoder)) return; WebFrameProxy* frame = process()->webFrame(frameID); MESSAGE_CHECK(frame); frame->didFailProvisionalLoad(); m_loaderClient.didFailProvisionalLoadWithErrorForFrame(this, frame, error, userData.get()); } ",0 "void ff_gradfun_blur_line_c(uint16_t *dc, uint16_t *buf, const uint16_t *buf1, const uint8_t *src, int src_linesize, int width) { int x, v, old; for (x = 0; x < width; x++) { v = buf1[x] + src[2 * x] + src[2 * x + 1] + src[2 * x + src_linesize] + src[2 * x + 1 + src_linesize]; old = buf[x]; buf[x] = v; dc[x] = v - old; } } ",0 "OPJ_BOOL opj_tcd_dc_level_shift_encode ( opj_tcd_t *p_tcd ) { OPJ_UINT32 compno; opj_tcd_tilecomp_t * l_tile_comp = 00; opj_tccp_t * l_tccp = 00; opj_image_comp_t * l_img_comp = 00; opj_tcd_tile_t * l_tile; OPJ_UINT32 l_nb_elem,i; OPJ_INT32 * l_current_ptr; l_tile = p_tcd->tcd_image->tiles; l_tile_comp = l_tile->comps; l_tccp = p_tcd->tcp->tccps; l_img_comp = p_tcd->image->comps; for (compno = 0; compno < l_tile->numcomps; compno++) { l_current_ptr = l_tile_comp->data; l_nb_elem = (OPJ_UINT32)((l_tile_comp->x1 - l_tile_comp->x0) * (l_tile_comp->y1 - l_tile_comp->y0)); if (l_tccp->qmfbid == 1) { for (i = 0; i < l_nb_elem; ++i) { *l_current_ptr -= l_tccp->m_dc_level_shift ; ++l_current_ptr; } } else { for (i = 0; i < l_nb_elem; ++i) { *l_current_ptr = (*l_current_ptr - l_tccp->m_dc_level_shift) << 11 ; ++l_current_ptr; } } ++l_img_comp; ++l_tccp; ++l_tile_comp; } return OPJ_TRUE; } ",0 "void DownloadItemImpl::DeleteFile(const base::Callback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); if (GetState() != DownloadItem::COMPLETE) { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::BindOnce(&DeleteDownloadedFileDone, base::WeakPtr(), callback, false)); return; } if (GetFullPath().empty() || file_externally_removed_) { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::BindOnce(&DeleteDownloadedFileDone, base::WeakPtr(), callback, true)); return; } base::PostTaskAndReplyWithResult( GetDownloadTaskRunner().get(), FROM_HERE, base::Bind(&DeleteDownloadedFile, GetFullPath()), base::Bind(&DeleteDownloadedFileDone, weak_ptr_factory_.GetWeakPtr(), callback)); } ",0 "int LayerTreeHost::ScheduleMicroBenchmark( const std::string& benchmark_name, std::unique_ptr value, const MicroBenchmark::DoneCallback& callback) { return micro_benchmark_controller_.ScheduleRun(benchmark_name, std::move(value), callback); } ",0 "DeleteRoute(PMIB_IPFORWARD_ROW2 fwd_row) { return DeleteIpForwardEntry2(fwd_row); } ",0 "void AutofillExternalDelegate::OnPopupSuppressed() { manager_->DidSuppressPopup(query_form_, query_field_); } ",0 "getifs () { return ifs_value; } ",0 "static void brcmf_update_bw40_channel_flag(struct ieee80211_channel *channel, struct brcmu_chan *ch) { u32 ht40_flag; ht40_flag = channel->flags & IEEE80211_CHAN_NO_HT40; if (ch->sb == BRCMU_CHAN_SB_U) { if (ht40_flag == IEEE80211_CHAN_NO_HT40) channel->flags &= ~IEEE80211_CHAN_NO_HT40; channel->flags |= IEEE80211_CHAN_NO_HT40PLUS; } else { /* It should be one of * IEEE80211_CHAN_NO_HT40 or * IEEE80211_CHAN_NO_HT40PLUS */ channel->flags &= ~IEEE80211_CHAN_NO_HT40; if (ht40_flag == IEEE80211_CHAN_NO_HT40) channel->flags |= IEEE80211_CHAN_NO_HT40MINUS; } } ",0 "compile_tree_empty_check(Node* node, regex_t* reg, int empty_info, ScanEnv* env) { int r; int saved_num_null_check = reg->num_null_check; if (empty_info != BODY_IS_NOT_EMPTY) { r = add_op(reg, OP_EMPTY_CHECK_START); if (r != 0) return r; COP(reg)->empty_check_start.mem = reg->num_null_check; /* NULL CHECK ID */ reg->num_null_check++; } r = compile_tree(node, reg, env); if (r != 0) return r; if (empty_info != BODY_IS_NOT_EMPTY) { if (empty_info == BODY_IS_EMPTY) r = add_op(reg, OP_EMPTY_CHECK_END); else if (empty_info == BODY_IS_EMPTY_MEM) r = add_op(reg, OP_EMPTY_CHECK_END_MEMST); else if (empty_info == BODY_IS_EMPTY_REC) r = add_op(reg, OP_EMPTY_CHECK_END_MEMST_PUSH); if (r != 0) return r; COP(reg)->empty_check_end.mem = saved_num_null_check; /* NULL CHECK ID */ } return r; } ",0 "static void addrconf_dad_kick(struct inet6_ifaddr *ifp) { unsigned long rand_num; struct inet6_dev *idev = ifp->idev; if (ifp->flags & IFA_F_OPTIMISTIC) rand_num = 0; else rand_num = prandom_u32() % (idev->cnf.rtr_solicit_delay ? : 1); ifp->dad_probes = idev->cnf.dad_transmits; addrconf_mod_dad_work(ifp, rand_num); } ",0 "HeadlessDevToolsManagerDelegate::CloseTarget( content::DevToolsAgentHost* agent_host, int session_id, int command_id, const base::DictionaryValue* params) { std::string target_id; if (!params || !params->GetString(""targetId"", &target_id)) return CreateInvalidParamResponse(command_id, ""targetId""); HeadlessWebContents* web_contents = browser_->GetWebContentsForDevToolsAgentHostId(target_id); bool success = false; if (web_contents) { web_contents->Close(); success = true; } std::unique_ptr result(target::CloseTargetResult::Builder() .SetSuccess(success) .Build() ->Serialize()); return CreateSuccessResponse(command_id, std::move(result)); } ",0 "wiki_get_pages(int *n_pages, char *expr) { WikiPageList **pages; struct dirent **namelist; int n, i = 0; struct stat st; n = scandir(""."", &namelist, 0, (void *)changes_compar); pages = malloc(sizeof(WikiPageList*)*n); while(n--) { if ((namelist[n]->d_name)[0] == '.' || !strcmp(namelist[n]->d_name, ""styles.css"")) goto cleanup; if (expr != NULL) { /* Super Simple Search */ char *data = NULL; if ((data = file_read(namelist[n]->d_name)) != NULL) if (strstr(data, expr) == NULL) if (strcmp(namelist[n]->d_name, expr) != 0) goto cleanup; } stat(namelist[n]->d_name, &st); /* ignore anything but regular readable files */ if (S_ISREG(st.st_mode) && access(namelist[n]->d_name, R_OK) == 0) { pages[i] = malloc(sizeof(WikiPageList)); pages[i]->name = strdup (namelist[n]->d_name); pages[i]->mtime = st.st_mtime; i++; } cleanup: free(namelist[n]); } *n_pages = i; free(namelist); if (i==0) return NULL; return pages; } ",0 "cifs_writedata_release(struct kref *refcount) { struct cifs_writedata *wdata = container_of(refcount, struct cifs_writedata, refcount); if (wdata->cfile) cifsFileInfo_put(wdata->cfile); kfree(wdata); } ",0 "TransportDIB* BrowserRenderProcessHost::MapTransportDIB( TransportDIB::Id dib_id) { #if defined(OS_WIN) HANDLE section = win_util::GetSectionFromProcess( dib_id.handle, GetRendererProcessHandle(), false /* read write */); return TransportDIB::Map(section); #elif defined(OS_MACOSX) return widget_helper_->MapTransportDIB(dib_id); #elif defined(OS_LINUX) return TransportDIB::Map(dib_id); #endif // defined(OS_LINUX) } ",0 "static ut64 addr_to_offset(struct MACH0_(obj_t)* bin, ut64 addr) { ut64 segment_base, segment_size; int i; if (!bin->segs) { return 0; } for (i = 0; i < bin->nsegs; i++) { segment_base = (ut64)bin->segs[i].vmaddr; segment_size = (ut64)bin->segs[i].vmsize; if (addr >= segment_base && addr < segment_base + segment_size) { return bin->segs[i].fileoff + (addr - segment_base); } } return 0; } ",0 " void DevToolsAgentHostImpl::ForceAttachClient(DevToolsAgentHostClient* client) { if (SessionByClient(client)) return; scoped_refptr protect(this); if (!sessions_.empty()) ForceDetachAllClients(); DCHECK(sessions_.empty()); InnerAttachClient(client); } ",1 "size_t GLES2Util::GetComponentCountForGLTransformType(uint32_t type) { switch (type) { case GL_TRANSLATE_X_CHROMIUM: case GL_TRANSLATE_Y_CHROMIUM: return 1; case GL_TRANSLATE_2D_CHROMIUM: return 2; case GL_TRANSLATE_3D_CHROMIUM: return 3; case GL_AFFINE_2D_CHROMIUM: case GL_TRANSPOSE_AFFINE_2D_CHROMIUM: return 6; case GL_AFFINE_3D_CHROMIUM: case GL_TRANSPOSE_AFFINE_3D_CHROMIUM: return 12; default: return 0; } } ",0 "tls1_process_heartbeat(SSL *s) { unsigned char *p = &s->s3->rrec.data[0], *pl; unsigned short hbtype; unsigned int payload; unsigned int padding = 16; /* Use minimum padding */ if (s->msg_callback) s->msg_callback(0, s->version, TLS1_RT_HEARTBEAT, &s->s3->rrec.data[0], s->s3->rrec.length, s, s->msg_callback_arg); /* Read type and payload length first */ if (1 + 2 + 16 > s->s3->rrec.length) return 0; /* silently discard */ hbtype = *p++; n2s(p, payload); if (1 + 2 + payload + 16 > s->s3->rrec.length) return 0; /* silently discard per RFC 6520 sec. 4 */ pl = p; if (hbtype == TLS1_HB_REQUEST) { unsigned char *buffer, *bp; int r; /* Allocate memory for the response, size is 1 bytes * message type, plus 2 bytes payload length, plus * payload, plus padding */ buffer = OPENSSL_malloc(1 + 2 + payload + padding); bp = buffer; /* Enter response type, length and copy payload */ *bp++ = TLS1_HB_RESPONSE; s2n(payload, bp); memcpy(bp, pl, payload); bp += payload; /* Random padding */ RAND_pseudo_bytes(bp, padding); r = ssl3_write_bytes(s, TLS1_RT_HEARTBEAT, buffer, 3 + payload + padding); if (r >= 0 && s->msg_callback) s->msg_callback(1, s->version, TLS1_RT_HEARTBEAT, buffer, 3 + payload + padding, s, s->msg_callback_arg); OPENSSL_free(buffer); if (r < 0) return r; } else if (hbtype == TLS1_HB_RESPONSE) { unsigned int seq; /* We only send sequence numbers (2 bytes unsigned int), * and 16 random bytes, so we just try to read the * sequence number */ n2s(pl, seq); if (payload == 18 && seq == s->tlsext_hb_seq) { s->tlsext_hb_seq++; s->tlsext_hb_pending = 0; } } return 0; } ",0 "http_DoConnection(const struct http *hp) { char *p, *q; const char *ret; unsigned u; if (!http_GetHdr(hp, H_Connection, &p)) { if (hp->protover < 11) return (""not HTTP/1.1""); return (NULL); } ret = NULL; AN(p); for (; *p; p++) { if (vct_issp(*p)) continue; if (*p == ',') continue; for (q = p + 1; *q; q++) if (*q == ',' || vct_issp(*q)) break; u = pdiff(p, q); if (u == 5 && !strncasecmp(p, ""close"", u)) ret = ""Connection: close""; u = http_findhdr(hp, u, p); if (u != 0) hp->hdf[u] |= HDF_FILTER; if (!*q) break; p = q; } return (ret); } ",0 "static int mcryptd_hash_init_tfm(struct crypto_tfm *tfm) { struct crypto_instance *inst = crypto_tfm_alg_instance(tfm); struct hashd_instance_ctx *ictx = crypto_instance_ctx(inst); struct crypto_shash_spawn *spawn = &ictx->spawn; struct mcryptd_hash_ctx *ctx = crypto_tfm_ctx(tfm); struct crypto_shash *hash; hash = crypto_spawn_shash(spawn); if (IS_ERR(hash)) return PTR_ERR(hash); ctx->child = hash; crypto_ahash_set_reqsize(__crypto_ahash_cast(tfm), sizeof(struct mcryptd_hash_request_ctx) + crypto_shash_descsize(hash)); return 0; } ",0 "static int qeth_peer_func_level(int level) { if ((level & 0xff) == 8) return (level & 0xff) + 0x400; if (((level >> 8) & 3) == 1) return (level & 0xff) + 0x200; return level; } ",0 "static int l_open_channel (lua_State *L) { ssh_userdata *state = (ssh_userdata *)lua_touserdata(L, 1); LIBSSH2_CHANNEL **channel = (LIBSSH2_CHANNEL **)lua_newuserdata(L, sizeof(LIBSSH2_CHANNEL *)); while ((*channel = libssh2_channel_open_session(state->session)) == NULL && libssh2_session_last_errno(state->session) == LIBSSH2_ERROR_EAGAIN) { luaL_getmetafield(L, 1, ""filter""); lua_pushvalue(L, 1); lua_callk(L, 1, 0, 0, finish_open_channel); } return l_setup_channel(L); } ",0 "R_API RBinJavaBootStrapMethod *r_bin_java_bootstrap_method_new(ut8 *buffer, ut64 sz, ut64 buf_offset) { RBinJavaBootStrapMethod *bsm = NULL; RBinJavaBootStrapArgument *bsm_arg = NULL; ut32 i = 0; ut64 offset = 0; bsm = (RBinJavaBootStrapMethod *) malloc (sizeof (RBinJavaBootStrapMethod)); if (bsm == NULL) { return bsm; } memset (bsm, 0, sizeof (RBinJavaBootStrapMethod)); bsm->file_offset = buf_offset; bsm->bootstrap_method_ref = R_BIN_JAVA_USHORT (buffer, offset); offset += 2; bsm->num_bootstrap_arguments = R_BIN_JAVA_USHORT (buffer, offset); offset += 2; bsm->bootstrap_arguments = r_list_new (); for (i = 0; i < bsm->num_bootstrap_arguments; i++) { bsm_arg = r_bin_java_bootstrap_method_argument_new (buffer + offset, sz - offset, buf_offset + offset); if (bsm_arg) { offset += bsm_arg->size; r_list_append (bsm->bootstrap_arguments, (void *) bsm_arg); } else { } } bsm->size = offset; return bsm; } ",0 "void WebView::setViewNeedsDisplay(const WebCore::IntRect& rect) { RECT r = rect; ::InvalidateRect(m_window, &r, false); } ",0 "static int serdes_set_mode(struct phy *phy, enum phy_mode mode) { struct serdes_macro *macro = phy_get_drvdata(phy); unsigned int i; int ret; for (i = 0; i < ARRAY_SIZE(ocelot_serdes_muxes); i++) { if (macro->idx != ocelot_serdes_muxes[i].idx || mode != ocelot_serdes_muxes[i].mode) continue; if (mode != PHY_MODE_QSGMII && macro->port != ocelot_serdes_muxes[i].port) continue; ret = regmap_update_bits(macro->ctrl->regs, HSIO_HW_CFG, ocelot_serdes_muxes[i].mask, ocelot_serdes_muxes[i].mux); if (ret) return ret; if (macro->idx <= SERDES1G_MAX) return serdes_init_s1g(macro->ctrl->regs, macro->idx); /* SERDES6G and PCIe not supported yet */ return -EOPNOTSUPP; } return -EINVAL; } ",0 "void kvm_apic_write_nodecode(struct kvm_vcpu *vcpu, u32 offset) { u32 val = 0; /* hw has done the conditional check and inst decode */ offset &= 0xff0; apic_reg_read(vcpu->arch.apic, offset, 4, &val); /* TODO: optimize to just emulate side effect w/o one more write */ apic_reg_write(vcpu->arch.apic, offset, val); } ",0 "void NormalPageArena::TakeFreelistSnapshot(const String& dump_name) { if (free_list_.TakeSnapshot(dump_name)) { base::trace_event::MemoryAllocatorDump* buckets_dump = BlinkGCMemoryDumpProvider::Instance() ->CreateMemoryAllocatorDumpForCurrentGC(dump_name + ""/buckets""); base::trace_event::MemoryAllocatorDump* pages_dump = BlinkGCMemoryDumpProvider::Instance() ->CreateMemoryAllocatorDumpForCurrentGC(dump_name + ""/pages""); BlinkGCMemoryDumpProvider::Instance() ->CurrentProcessMemoryDump() ->AddOwnershipEdge(pages_dump->guid(), buckets_dump->guid()); } } ",0 "static enum test_return test_binary_decrq(void) { return test_binary_decr_impl(""test_binary_decrq"", PROTOCOL_BINARY_CMD_DECREMENTQ); } ",0 "reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th, struct inode *dir, struct dentry *dentry, struct inode *inode) { struct posix_acl *default_acl, *acl; int err = 0; /* ACLs only get applied to files and directories */ if (S_ISLNK(inode->i_mode)) return 0; /* * ACLs can only be used on ""new"" objects, so if it's an old object * there is nothing to inherit from */ if (get_inode_sd_version(dir) == STAT_DATA_V1) goto apply_umask; /* * Don't apply ACLs to objects in the .reiserfs_priv tree.. This * would be useless since permissions are ignored, and a pain because * it introduces locking cycles */ if (IS_PRIVATE(dir)) { inode->i_flags |= S_PRIVATE; goto apply_umask; } err = posix_acl_create(dir, &inode->i_mode, &default_acl, &acl); if (err) return err; if (default_acl) { err = __reiserfs_set_acl(th, inode, ACL_TYPE_DEFAULT, default_acl); posix_acl_release(default_acl); } if (acl) { if (!err) err = __reiserfs_set_acl(th, inode, ACL_TYPE_ACCESS, acl); posix_acl_release(acl); } return err; apply_umask: /* no ACL, apply umask */ inode->i_mode &= ~current_umask(); return err; } ",0 "PHP_FUNCTION(openssl_pkey_export) { struct php_x509_request req; zval ** zpkey, * args = NULL, *out; char * passphrase = NULL; int passphrase_len = 0; long key_resource = -1; EVP_PKEY * key; BIO * bio_out = NULL; const EVP_CIPHER * cipher; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""Zz|s!a!"", &zpkey, &out, &passphrase, &passphrase_len, &args) == FAILURE) { return; } RETVAL_FALSE; key = php_openssl_evp_from_zval(zpkey, 0, passphrase, 0, &key_resource TSRMLS_CC); if (key == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""cannot get key from parameter 1""); RETURN_FALSE; } PHP_SSL_REQ_INIT(&req); if (PHP_SSL_REQ_PARSE(&req, args) == SUCCESS) { bio_out = BIO_new(BIO_s_mem()); if (passphrase && req.priv_key_encrypt) { cipher = (EVP_CIPHER *) EVP_des_ede3_cbc(); } else { cipher = NULL; } if (PEM_write_bio_PrivateKey(bio_out, key, cipher, (unsigned char *)passphrase, passphrase_len, NULL, NULL)) { /* Success! * If returning the output as a string, do so now */ char * bio_mem_ptr; long bio_mem_len; RETVAL_TRUE; bio_mem_len = BIO_get_mem_data(bio_out, &bio_mem_ptr); zval_dtor(out); ZVAL_STRINGL(out, bio_mem_ptr, bio_mem_len, 1); } } PHP_SSL_REQ_DISPOSE(&req); if (key_resource == -1 && key) { EVP_PKEY_free(key); } if (bio_out) { BIO_free(bio_out); } } ",0 "int kernel_getsockname(struct socket *sock, struct sockaddr *addr) { return sock->ops->getname(sock, addr, 0); } ",0 "scoped_refptr RenderFrameHostManager::ConvertToSiteInstance( const SiteInstanceDescriptor& descriptor, SiteInstance* candidate_instance) { SiteInstanceImpl* current_instance = render_frame_host_->GetSiteInstance(); if (descriptor.existing_site_instance) return descriptor.existing_site_instance; if (descriptor.relation == SiteInstanceRelation::RELATED) return current_instance->GetRelatedSiteInstance(descriptor.dest_url); if (descriptor.relation == SiteInstanceRelation::RELATED_DEFAULT_SUBFRAME) return current_instance->GetDefaultSubframeSiteInstance(); if (candidate_instance && !current_instance->IsRelatedSiteInstance(candidate_instance) && candidate_instance->GetSiteURL() == SiteInstance::GetSiteForURL(descriptor.browser_context, descriptor.dest_url)) { return candidate_instance; } return SiteInstance::CreateForURL( delegate_->GetControllerForRenderManager().GetBrowserContext(), descriptor.dest_url); } ",0 "int OmniboxViewWin::GetHorizontalMargin() const { RECT rect; GetRect(&rect); RECT client_rect; GetClientRect(&client_rect); return (rect.left - client_rect.left) + (client_rect.right - rect.right); } ",0 "char *am_generate_id(request_rec *r) { int rc; char *ret; int rand_data_len; unsigned char *rand_data; int i; unsigned char b; int hi, low; ret = (char *)apr_palloc(r->pool, AM_ID_LENGTH + 1); /* We need to round the length of the random data _up_, in case the * length of the session id isn't even. */ rand_data_len = (AM_ID_LENGTH + 1) / 2; /* Fill the last rand_data_len bytes of the string with * random bytes. This allows us to overwrite from the beginning of * the string. */ rand_data = (unsigned char *)&ret[AM_ID_LENGTH - rand_data_len]; /* Generate random numbers. */ rc = am_generate_random_bytes(r, rand_data, rand_data_len); if(rc != OK) { return NULL; } /* Convert the random bytes to hexadecimal. Note that we will write * AM_ID_LENGTH+1 characters if we have a non-even length of the * session id. This is OK - we will simply overwrite the last character * with the null-terminator afterwards. */ for(i = 0; i < AM_ID_LENGTH; i += 2) { b = rand_data[i / 2]; hi = (b >> 4) & 0xf; low = b & 0xf; if(hi >= 0xa) { ret[i] = 'a' + hi - 0xa; } else { ret[i] = '0' + hi; } if(low >= 0xa) { ret[i+1] = 'a' + low - 0xa; } else { ret[i+1] = '0' + low; } } /* Add null-terminator- */ ret[AM_ID_LENGTH] = '\0'; return ret; } ",0 "int bta_co_rfc_data_incoming(void *user_data, BT_HDR *p_buf) { pthread_mutex_lock(&slot_lock); int ret = 0; uint32_t id = (uintptr_t)user_data; rfc_slot_t *slot = find_rfc_slot_by_id(id); if (!slot) goto out; if (list_is_empty(slot->incoming_queue)) { switch (send_data_to_app(slot->fd, p_buf)) { case SENT_NONE: case SENT_PARTIAL: list_append(slot->incoming_queue, p_buf); btsock_thread_add_fd(pth, slot->fd, BTSOCK_RFCOMM, SOCK_THREAD_FD_WR, slot->id); break; case SENT_ALL: GKI_freebuf(p_buf); ret = 1; // Enable data flow. break; case SENT_FAILED: GKI_freebuf(p_buf); cleanup_rfc_slot(slot); break; } } else { list_append(slot->incoming_queue, p_buf); } out:; pthread_mutex_unlock(&slot_lock); return ret; // Return 0 to disable data flow. } ",0 "guint_slice_free (gpointer data) { g_slice_free (guint, data); } ",0 "ber_out_sequence(STREAM out, STREAM content) { size_t length; length = (content ? s_length(content) : 0); ber_out_header(out, BER_TAG_SEQUENCE | BER_TAG_CONSTRUCTED, length); if (content) out_stream(out, content); } ",0 "void HTMLMediaElement::SelectedVideoTrackChanged(VideoTrack* track) { BLINK_MEDIA_LOG << ""selectedVideoTrackChanged("" << (void*)this << "") selectedTrackId="" << (track->selected() ? String(track->id()) : ""none""); DCHECK(MediaTracksEnabledInternally()); if (track->selected()) videoTracks().TrackSelected(track->id()); videoTracks().ScheduleChangeEvent(); if (media_source_) media_source_->OnTrackChanged(track); WebMediaPlayer::TrackId id = track->id(); GetWebMediaPlayer()->SelectedVideoTrackChanged(track->selected() ? &id : nullptr); } ",0 "void MediaRecorder::start(int time_slice, ExceptionState& exception_state) { if (state_ != State::kInactive) { exception_state.ThrowDOMException( DOMExceptionCode::kInvalidStateError, ""The MediaRecorder's state is '"" + StateToString(state_) + ""'.""); return; } state_ = State::kRecording; if (!recorder_handler_->Start(time_slice)) { exception_state.ThrowDOMException(DOMExceptionCode::kUnknownError, ""The MediaRecorder failed to start "" ""because there are no audio or video "" ""tracks available.""); return; } ScheduleDispatchEvent(Event::Create(event_type_names::kStart)); } ",0 "void ext4_truncate(struct inode *inode) { handle_t *handle; struct ext4_inode_info *ei = EXT4_I(inode); __le32 *i_data = ei->i_data; int addr_per_block = EXT4_ADDR_PER_BLOCK(inode->i_sb); struct address_space *mapping = inode->i_mapping; ext4_lblk_t offsets[4]; Indirect chain[4]; Indirect *partial; __le32 nr = 0; int n; ext4_lblk_t last_block; unsigned blocksize = inode->i_sb->s_blocksize; if (!ext4_can_truncate(inode)) return; EXT4_I(inode)->i_flags &= ~EXT4_EOFBLOCKS_FL; if (inode->i_size == 0 && !test_opt(inode->i_sb, NO_AUTO_DA_ALLOC)) ext4_set_inode_state(inode, EXT4_STATE_DA_ALLOC_CLOSE); if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL) { ext4_ext_truncate(inode); return; } handle = start_transaction(inode); if (IS_ERR(handle)) return; /* AKPM: return what? */ last_block = (inode->i_size + blocksize-1) >> EXT4_BLOCK_SIZE_BITS(inode->i_sb); if (inode->i_size & (blocksize - 1)) if (ext4_block_truncate_page(handle, mapping, inode->i_size)) goto out_stop; n = ext4_block_to_path(inode, last_block, offsets, NULL); if (n == 0) goto out_stop; /* error */ /* * OK. This truncate is going to happen. We add the inode to the * orphan list, so that if this truncate spans multiple transactions, * and we crash, we will resume the truncate when the filesystem * recovers. It also marks the inode dirty, to catch the new size. * * Implication: the file must always be in a sane, consistent * truncatable state while each transaction commits. */ if (ext4_orphan_add(handle, inode)) goto out_stop; /* * From here we block out all ext4_get_block() callers who want to * modify the block allocation tree. */ down_write(&ei->i_data_sem); ext4_discard_preallocations(inode); /* * The orphan list entry will now protect us from any crash which * occurs before the truncate completes, so it is now safe to propagate * the new, shorter inode size (held for now in i_size) into the * on-disk inode. We do this via i_disksize, which is the value which * ext4 *really* writes onto the disk inode. */ ei->i_disksize = inode->i_size; if (n == 1) { /* direct blocks */ ext4_free_data(handle, inode, NULL, i_data+offsets[0], i_data + EXT4_NDIR_BLOCKS); goto do_indirects; } partial = ext4_find_shared(inode, n, offsets, chain, &nr); /* Kill the top of shared branch (not detached) */ if (nr) { if (partial == chain) { /* Shared branch grows from the inode */ ext4_free_branches(handle, inode, NULL, &nr, &nr+1, (chain+n-1) - partial); *partial->p = 0; /* * We mark the inode dirty prior to restart, * and prior to stop. No need for it here. */ } else { /* Shared branch grows from an indirect block */ BUFFER_TRACE(partial->bh, ""get_write_access""); ext4_free_branches(handle, inode, partial->bh, partial->p, partial->p+1, (chain+n-1) - partial); } } /* Clear the ends of indirect blocks on the shared branch */ while (partial > chain) { ext4_free_branches(handle, inode, partial->bh, partial->p + 1, (__le32*)partial->bh->b_data+addr_per_block, (chain+n-1) - partial); BUFFER_TRACE(partial->bh, ""call brelse""); brelse(partial->bh); partial--; } do_indirects: /* Kill the remaining (whole) subtrees */ switch (offsets[0]) { default: nr = i_data[EXT4_IND_BLOCK]; if (nr) { ext4_free_branches(handle, inode, NULL, &nr, &nr+1, 1); i_data[EXT4_IND_BLOCK] = 0; } case EXT4_IND_BLOCK: nr = i_data[EXT4_DIND_BLOCK]; if (nr) { ext4_free_branches(handle, inode, NULL, &nr, &nr+1, 2); i_data[EXT4_DIND_BLOCK] = 0; } case EXT4_DIND_BLOCK: nr = i_data[EXT4_TIND_BLOCK]; if (nr) { ext4_free_branches(handle, inode, NULL, &nr, &nr+1, 3); i_data[EXT4_TIND_BLOCK] = 0; } case EXT4_TIND_BLOCK: ; } up_write(&ei->i_data_sem); inode->i_mtime = inode->i_ctime = ext4_current_time(inode); ext4_mark_inode_dirty(handle, inode); /* * In a multi-transaction truncate, we only make the final transaction * synchronous */ if (IS_SYNC(inode)) ext4_handle_sync(handle); out_stop: /* * If this was a simple ftruncate(), and the file will remain alive * then we need to clear up the orphan record which we created above. * However, if this was a real unlink then we were called by * ext4_delete_inode(), and we allow that function to clean up the * orphan info for us. */ if (inode->i_nlink) ext4_orphan_del(handle, inode); ext4_journal_stop(handle); } ",0 "void AccessibilityUIElement::removeSelection() { } ",0 "void OxideQQuickWebView::mousePressEvent(QMouseEvent* event) { Q_D(OxideQQuickWebView); QQuickItem::mousePressEvent(event); d->contents_view_->handleMousePressEvent(event); } ",0 "NetworkChangeNotifier::NetworkChangeNotifier() : ip_address_observer_list_( new ObserverListThreadSafe( ObserverListBase::NOTIFY_EXISTING_ONLY)), online_state_observer_list_( new ObserverListThreadSafe( ObserverListBase::NOTIFY_EXISTING_ONLY)), resolver_state_observer_list_( new ObserverListThreadSafe( ObserverListBase::NOTIFY_EXISTING_ONLY)) { DCHECK(!g_network_change_notifier); g_network_change_notifier = this; } ",0 "fz_cmm_avoid_white_fix_flag(fz_context *ctx) { if (ctx && ctx->colorspace && ctx->colorspace->cmm && ctx->cmm_instance) return ctx->colorspace->cmm->avoid_white_fix_flag; return 0; } ",0 " vpx_codec_err_t Decoder::DecodeFrame(const uint8_t *cxdata, size_t size) { vpx_codec_err_t res_dec; InitOnce(); REGISTER_STATE_CHECK( res_dec = vpx_codec_decode(&decoder_, cxdata, static_cast(size), NULL, 0)); return res_dec; } ",1 "static noinline size_t if_nlmsg_size(const struct net_device *dev, u32 ext_filter_mask) { return NLMSG_ALIGN(sizeof(struct ifinfomsg)) + nla_total_size(IFNAMSIZ) /* IFLA_IFNAME */ + nla_total_size(IFALIASZ) /* IFLA_IFALIAS */ + nla_total_size(IFNAMSIZ) /* IFLA_QDISC */ + nla_total_size(sizeof(struct rtnl_link_ifmap)) + nla_total_size(sizeof(struct rtnl_link_stats)) + nla_total_size(sizeof(struct rtnl_link_stats64)) + nla_total_size(MAX_ADDR_LEN) /* IFLA_ADDRESS */ + nla_total_size(MAX_ADDR_LEN) /* IFLA_BROADCAST */ + nla_total_size(4) /* IFLA_TXQLEN */ + nla_total_size(4) /* IFLA_WEIGHT */ + nla_total_size(4) /* IFLA_MTU */ + nla_total_size(4) /* IFLA_LINK */ + nla_total_size(4) /* IFLA_MASTER */ + nla_total_size(1) /* IFLA_CARRIER */ + nla_total_size(4) /* IFLA_PROMISCUITY */ + nla_total_size(4) /* IFLA_NUM_TX_QUEUES */ + nla_total_size(4) /* IFLA_NUM_RX_QUEUES */ + nla_total_size(4) /* IFLA_MAX_GSO_SEGS */ + nla_total_size(4) /* IFLA_MAX_GSO_SIZE */ + nla_total_size(1) /* IFLA_OPERSTATE */ + nla_total_size(1) /* IFLA_LINKMODE */ + nla_total_size(4) /* IFLA_CARRIER_CHANGES */ + nla_total_size(4) /* IFLA_LINK_NETNSID */ + nla_total_size(ext_filter_mask & RTEXT_FILTER_VF ? 4 : 0) /* IFLA_NUM_VF */ + rtnl_vfinfo_size(dev, ext_filter_mask) /* IFLA_VFINFO_LIST */ + rtnl_port_size(dev, ext_filter_mask) /* IFLA_VF_PORTS + IFLA_PORT_SELF */ + rtnl_link_get_size(dev) /* IFLA_LINKINFO */ + rtnl_link_get_af_size(dev, ext_filter_mask) /* IFLA_AF_SPEC */ + nla_total_size(MAX_PHYS_ITEM_ID_LEN) /* IFLA_PHYS_PORT_ID */ + nla_total_size(MAX_PHYS_ITEM_ID_LEN) /* IFLA_PHYS_SWITCH_ID */ + nla_total_size(IFNAMSIZ) /* IFLA_PHYS_PORT_NAME */ + nla_total_size(1); /* IFLA_PROTO_DOWN */ } ",0 " void Run(const v8::FunctionCallbackInfo& args) { v8::Isolate* isolate = automation_bindings_->GetIsolate(); if (args.Length() < 4 || !args[0]->IsNumber() || !args[1]->IsNumber() || !args[2]->IsNumber() || !args[3]->IsNumber()) { ThrowInvalidArgumentsException(automation_bindings_); } int tree_id = args[0]->Int32Value(); int node_id = args[1]->Int32Value(); int start = args[2]->Int32Value(); int end = args[3]->Int32Value(); TreeCache* cache = automation_bindings_->GetTreeCacheFromTreeID(tree_id); if (!cache) return; ui::AXNode* node = cache->tree.GetFromId(node_id); if (!node) return; function_(isolate, args.GetReturnValue(), cache, node, start, end); } ",0 "UINT CSoundFile::GetMaxPosition() const { UINT max = 0; UINT i = 0; while ((i < MAX_ORDERS) && (Order[i] != 0xFF)) { if (Order[i] < MAX_PATTERNS) max += PatternSize[Order[i]]; i++; } return max; } ",0 "static inline bool slave_dev_support_netpoll(struct net_device *slave_dev) { if (slave_dev->priv_flags & IFF_DISABLE_NETPOLL) return false; if (!slave_dev->netdev_ops->ndo_poll_controller) return false; return true; } ",0 "long Cluster::GetFirst(const BlockEntry*& pFirst) const { if (m_entries_count <= 0) { long long pos; long len; const long status = Parse(pos, len); if (status < 0) //error { pFirst = NULL; return status; } if (m_entries_count <= 0) //empty cluster { pFirst = NULL; return 0; } } assert(m_entries); pFirst = m_entries[0]; assert(pFirst); return 0; //success } ",1 "void WebContentsImpl::AttachInterstitialPage( InterstitialPageImpl* interstitial_page) { DCHECK(interstitial_page); GetRenderManager()->set_interstitial_page(interstitial_page); if (dialog_manager_) dialog_manager_->CancelActiveAndPendingDialogs(this); FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidAttachInterstitialPage()); } ",0 "void unmap_hugepage_range(struct vm_area_struct *vma, unsigned long start, unsigned long end, struct page *ref_page) { struct mm_struct *mm; struct mmu_gather tlb; unsigned long tlb_start = start; unsigned long tlb_end = end; /* * If shared PMDs were possibly used within this vma range, adjust * start/end for worst case tlb flushing. * Note that we can not be sure if PMDs are shared until we try to * unmap pages. However, we want to make sure TLB flushing covers * the largest possible range. */ adjust_range_if_pmd_sharing_possible(vma, &tlb_start, &tlb_end); mm = vma->vm_mm; tlb_gather_mmu(&tlb, mm, tlb_start, tlb_end); __unmap_hugepage_range(&tlb, vma, start, end, ref_page); tlb_finish_mmu(&tlb, tlb_start, tlb_end); } ",0 "static unsigned int pcd_check_events(struct cdrom_device_info *cdi, unsigned int clearing, int slot_nr) { struct pcd_unit *cd = cdi->handle; int res = cd->changed; if (res) cd->changed = 0; return res ? DISK_EVENT_MEDIA_CHANGE : 0; } ",0 "TextTrackCueList::TextTrackCueList() : first_invalid_index_(0) {} ",0 "psf_open_fd (PSF_FILE * pfile) { int fd, oflag, mode ; /* ** Sanity check. If everything is OK, this test and the printfs will ** be optimised out. This is meant to catch the problems caused by ** ""sfconfig.h"" being included after . */ if (sizeof (sf_count_t) != 8) { puts (""\n\n*** Fatal error : sizeof (sf_count_t) != 8"") ; puts (""*** This means that libsndfile was not configured correctly.\n"") ; exit (1) ; } ; switch (pfile->mode) { case SFM_READ : oflag = O_RDONLY | O_BINARY ; mode = 0 ; break ; case SFM_WRITE : oflag = O_WRONLY | O_CREAT | O_TRUNC | O_BINARY ; mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH ; break ; case SFM_RDWR : oflag = O_RDWR | O_CREAT | O_BINARY ; mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH ; break ; default : return - SFE_BAD_OPEN_MODE ; break ; } ; if (mode == 0) fd = open (pfile->path.c, oflag) ; else fd = open (pfile->path.c, oflag, mode) ; return fd ; } /* psf_open_fd */ ",0 "input_userauth_error(int type, u_int32_t seq, void *ctxt) { fatal(""input_userauth_error: bad message during authentication: "" ""type %d"", type); return 0; } ",0 "static int windows_release_interface(struct libusb_device_handle *dev_handle, int iface) { struct windows_device_priv *priv = _device_priv(dev_handle->dev); return priv->apib->release_interface(SUB_API_NOTSET, dev_handle, iface); } ",0 "void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) { int need_software_tstamp = sock_flag(sk, SOCK_RCVTSTAMP); struct scm_timestamping tss; int empty = 1; struct skb_shared_hwtstamps *shhwtstamps = skb_hwtstamps(skb); /* Race occurred between timestamp enabling and packet receiving. Fill in the current time for now. */ if (need_software_tstamp && skb->tstamp.tv64 == 0) __net_timestamp(skb); if (need_software_tstamp) { if (!sock_flag(sk, SOCK_RCVTSTAMPNS)) { struct timeval tv; skb_get_timestamp(skb, &tv); put_cmsg(msg, SOL_SOCKET, SCM_TIMESTAMP, sizeof(tv), &tv); } else { struct timespec ts; skb_get_timestampns(skb, &ts); put_cmsg(msg, SOL_SOCKET, SCM_TIMESTAMPNS, sizeof(ts), &ts); } } memset(&tss, 0, sizeof(tss)); if ((sk->sk_tsflags & SOF_TIMESTAMPING_SOFTWARE) && ktime_to_timespec_cond(skb->tstamp, tss.ts + 0)) empty = 0; if (shhwtstamps && (sk->sk_tsflags & SOF_TIMESTAMPING_RAW_HARDWARE) && ktime_to_timespec_cond(shhwtstamps->hwtstamp, tss.ts + 2)) empty = 0; if (!empty) put_cmsg(msg, SOL_SOCKET, SCM_TIMESTAMPING, sizeof(tss), &tss); } ",0 "static inline bool cpu_has_vmx_ept_2m_page(void) { return vmx_capability.ept & VMX_EPT_2MB_PAGE_BIT; } ",0 " BrowserGpuChannelHostFactory::EstablishRequest::~EstablishRequest() { } ",0 "int tcp_v4_md5_hash_skb(char *md5_hash, const struct tcp_md5sig_key *key, const struct sock *sk, const struct sk_buff *skb) { struct tcp_md5sig_pool *hp; struct ahash_request *req; const struct tcphdr *th = tcp_hdr(skb); __be32 saddr, daddr; if (sk) { /* valid for establish/request sockets */ saddr = sk->sk_rcv_saddr; daddr = sk->sk_daddr; } else { const struct iphdr *iph = ip_hdr(skb); saddr = iph->saddr; daddr = iph->daddr; } hp = tcp_get_md5sig_pool(); if (!hp) goto clear_hash_noput; req = hp->md5_req; if (crypto_ahash_init(req)) goto clear_hash; if (tcp_v4_md5_hash_headers(hp, daddr, saddr, th, skb->len)) goto clear_hash; if (tcp_md5_hash_skb_data(hp, skb, th->doff << 2)) goto clear_hash; if (tcp_md5_hash_key(hp, key)) goto clear_hash; ahash_request_set_crypt(req, NULL, md5_hash, 0); if (crypto_ahash_final(req)) goto clear_hash; tcp_put_md5sig_pool(); return 0; clear_hash: tcp_put_md5sig_pool(); clear_hash_noput: memset(md5_hash, 0, 16); return 1; } ",0 "DataReductionProxyConfig::FindConfiguredDataReductionProxy( const net::ProxyServer& proxy_server) const { DCHECK(thread_checker_.CalledOnValidThread()); return config_values_->FindConfiguredDataReductionProxy(proxy_server); } ",0 "show_usage(char *name) { char *s; s = strrchr(name, '/'); s = s ? s+1 : name; printf(""picocom v%s\n"", VERSION_STR); printf(""\nCompiled-in options:\n""); printf("" TTY_Q_SZ is %d\n"", TTY_Q_SZ); #ifdef USE_HIGH_BAUD printf("" HIGH_BAUD is enabled\n""); #endif #ifdef USE_FLOCK printf("" USE_FLOCK is enabled\n""); #endif #ifdef UUCP_LOCK_DIR printf("" UUCP_LOCK_DIR is: %s\n"", UUCP_LOCK_DIR); #endif #ifdef LINENOISE printf("" LINENOISE is enabled\n""); printf("" SEND_RECEIVE_HISTFILE is: %s\n"", SEND_RECEIVE_HISTFILE); #endif printf(""\nUsage is: %s [options] \n"", s); printf(""Options are:\n""); printf("" --aud \n""); printf("" --low s (=soft) | h (=hard) | n (=none)\n""); printf("" --

arity o (=odd) | e (=even) | n (=none)\n""); printf("" --atabits 5 | 6 | 7 | 8\n""); printf("" --scape \n""); printf("" --eho\n""); printf("" --nonit\n""); printf("" --noeset\n""); printf("" --noock\n""); printf("" --end-cmd \n""); printf("" --receie-cmd \n""); printf("" --imap (input mappings)\n""); printf("" --omap (output mappings)\n""); printf("" --emap (local-echo mappings)\n""); printf("" --elp\n""); printf("" is a comma-separated list of one or more of:\n""); printf("" crlf : map CR --> LF\n""); printf("" crcrlf : map CR --> CR + LF\n""); printf("" igncr : ignore CR\n""); printf("" lfcr : map LF --> CR\n""); printf("" lfcrlf : map LF --> CR + LF\n""); printf("" ignlf : ignore LF\n""); printf("" bsdel : map BS --> DEL\n""); printf("" delbs : map DEL --> BS\n""); printf("" indicates the equivalent short option.\n""); printf(""Short options are prefixed by \""-\"" instead of by \""--\"".\n""); } ",0 "bool HostNPScriptObject::Connect(const NPVariant* args, uint32_t arg_count, NPVariant* result) { CHECK_EQ(base::PlatformThread::CurrentId(), np_thread_id_); LOG(INFO) << ""Connecting...""; if (arg_count != 2) { SetException(""connect: bad number of arguments""); return false; } if (state_ != kDisconnected) { SetException(""connect: can be called only when disconnected""); return false; } std::string uid = StringFromNPVariant(args[0]); if (uid.empty()) { SetException(""connect: bad uid argument""); return false; } std::string auth_service_with_token = StringFromNPVariant(args[1]); std::string auth_token; std::string auth_service; ParseAuthTokenWithService(auth_service_with_token, &auth_token, &auth_service); if (auth_token.empty()) { SetException(""connect: auth_service_with_token argument has empty token""); return false; } ReadPolicyAndConnect(uid, auth_token, auth_service); return true; } ",0 "void WebContentsImpl::OnAudioStateChanged(bool is_audible) { SendPageMessage(new PageMsg_AudioStateChanged(MSG_ROUTING_NONE, is_audible)); NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB); was_ever_audible_ = was_ever_audible_ || is_audible; if (delegate_) delegate_->OnAudioStateChanged(this, is_audible); } ",0 "static void SSL_SESSION_list_add(SSL_CTX *ctx, SSL_SESSION *s) { if ((s->next != NULL) && (s->prev != NULL)) SSL_SESSION_list_remove(ctx, s); if (ctx->session_cache_head == NULL) { ctx->session_cache_head = s; ctx->session_cache_tail = s; s->prev = (SSL_SESSION *)&(ctx->session_cache_head); s->next = (SSL_SESSION *)&(ctx->session_cache_tail); } else { s->next = ctx->session_cache_head; s->next->prev = s; s->prev = (SSL_SESSION *)&(ctx->session_cache_head); ctx->session_cache_head = s; } } ",0 " FT_Get_Char_Index( FT_Face face, FT_ULong charcode ) { FT_UInt result = 0; if ( face && face->charmap ) { FT_CMap cmap = FT_CMAP( face->charmap ); if ( charcode > 0xFFFFFFFFUL ) { FT_TRACE1(( ""FT_Get_Char_Index: too large charcode"" )); FT_TRACE1(( "" 0x%x is truncated\n"", charcode )); } result = cmap->clazz->char_index( cmap, (FT_UInt32)charcode ); } return result; } ",0 "void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64, const struct net_device_stats *netdev_stats) { #if BITS_PER_LONG == 64 BUILD_BUG_ON(sizeof(*stats64) < sizeof(*netdev_stats)); memcpy(stats64, netdev_stats, sizeof(*netdev_stats)); /* zero out counters that only exist in rtnl_link_stats64 */ memset((char *)stats64 + sizeof(*netdev_stats), 0, sizeof(*stats64) - sizeof(*netdev_stats)); #else size_t i, n = sizeof(*netdev_stats) / sizeof(unsigned long); const unsigned long *src = (const unsigned long *)netdev_stats; u64 *dst = (u64 *)stats64; BUILD_BUG_ON(n > sizeof(*stats64) / sizeof(u64)); for (i = 0; i < n; i++) dst[i] = src[i]; /* zero out counters that only exist in rtnl_link_stats64 */ memset((char *)stats64 + n * sizeof(u64), 0, sizeof(*stats64) - n * sizeof(u64)); #endif } ",0 "void WebPage::assignFocus(Platform::FocusDirection direction) { if (d->m_page->defersLoading()) return; d->assignFocus(direction); } ",0 "irc_server_remove_away (struct t_irc_server *server) { struct t_irc_channel *ptr_channel; if (server->is_connected) { for (ptr_channel = server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel) { if (ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL) irc_channel_remove_away (server, ptr_channel); } server->last_away_check = 0; } } ",0 "static int crypto_rfc4309_decrypt(struct aead_request *req) { if (req->assoclen != 16 && req->assoclen != 20) return -EINVAL; req = crypto_rfc4309_crypt(req); return crypto_aead_decrypt(req); } ",0 "void FrameSelection::NodeChildrenWillBeRemoved(ContainerNode& container) { if (!container.InActiveDocument()) return; if (!GetDocument().IsRunningExecCommand()) TypingCommand::CloseTyping(frame_); } ",0 "void RenderWidgetHostViewAura::OnWindowDestroying() { #if defined(OS_WIN) HWND parent = NULL; if (!window_->GetRootWindow() || host_->is_hidden()) { parent = ui::GetHiddenWindow(); } else { parent = window_->GetRootWindow()->GetAcceleratedWidget(); } LPARAM lparam = reinterpret_cast(this); EnumChildWindows(parent, WindowDestroyingCallback, lparam); #endif } ",0 " std::unique_ptr CreateMakeCredentialTask( FidoDevice* device) { PublicKeyCredentialRpEntity rp(test_data::kRelyingPartyId); PublicKeyCredentialUserEntity user( fido_parsing_utils::Materialize(test_data::kUserId)); return std::make_unique( device, CtapMakeCredentialRequest( test_data::kClientDataHash, std::move(rp), std::move(user), PublicKeyCredentialParams( std::vector(1))), callback_receiver_.callback()); } ",0 "base::FilePath PlatformCrashpadInitialization( bool initial_client, bool browser_process, bool embedded_handler, const std::string& user_data_dir, const base::FilePath& exe_path, const std::vector& initial_arguments) { DCHECK_EQ(initial_client, browser_process); DCHECK(initial_arguments.empty()); DCHECK(!embedded_handler); DCHECK(exe_path.empty()); g_is_browser = browser_process; bool dump_at_crash = true; #if defined(OS_ANDROID) base::android::SetJavaExceptionCallback(SetJavaExceptionInfo); unsigned int dump_percentage = GetCrashReporterClient()->GetCrashDumpPercentageForWebView(); if (dump_percentage < 100 && rand() % 100 >= dump_percentage) { dump_at_crash = false; } #endif // OS_ANDROID if (browser_process) { HandlerStarter* starter = HandlerStarter::Get(); return starter->Initialize(dump_at_crash); } crashpad::SandboxedHandler* handler = crashpad::SandboxedHandler::Get(); bool result = handler->Initialize(dump_at_crash); DCHECK(result); return base::FilePath(); } ",0 "bool WebContentsImpl::AddMessageToConsole(int32 level, const string16& message, int32 line_no, const string16& source_id) { if (!delegate_) return false; return delegate_->AddMessageToConsole(this, level, message, line_no, source_id); } ",0 "static int jpc_dec_process_ppt(jpc_dec_t *dec, jpc_ms_t *ms) { jpc_ppt_t *ppt = &ms->parms.ppt; jpc_dec_tile_t *tile; jpc_ppxstabent_t *pptstabent; tile = dec->curtile; if (!tile->pptstab) { if (!(tile->pptstab = jpc_ppxstab_create())) { return -1; } } if (!(pptstabent = jpc_ppxstabent_create())) { return -1; } pptstabent->ind = ppt->ind; pptstabent->data = ppt->data; ppt->data = 0; pptstabent->len = ppt->len; if (jpc_ppxstab_insert(tile->pptstab, pptstabent)) { return -1; } return 0; } ",0 "static char *ask_helper(const char *msg, void *args, bool password) { GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(g_wnd_assistant), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, ""%s"", msg); char *tagged_msg = tag_url(msg, ""\n""); gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK); gtk_message_dialog_set_markup(GTK_MESSAGE_DIALOG(dialog), tagged_msg); free(tagged_msg); GtkWidget *vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); GtkWidget *textbox = gtk_entry_new(); /* gtk_entry_set_editable(GTK_ENTRY(textbox), TRUE); * is not available in gtk3, so please use the highlevel * g_object_set */ g_object_set(G_OBJECT(textbox), ""editable"", TRUE, NULL); g_signal_connect(textbox, ""activate"", G_CALLBACK(gtk_entry_emit_dialog_response_ok), dialog); if (password) gtk_entry_set_visibility(GTK_ENTRY(textbox), FALSE); gtk_box_pack_start(GTK_BOX(vbox), textbox, TRUE, TRUE, 0); gtk_widget_show(textbox); char *response = NULL; if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) { const char *text = gtk_entry_get_text(GTK_ENTRY(textbox)); response = xstrdup(text); } gtk_widget_destroy(textbox); gtk_widget_destroy(dialog); const char *log_response = """"; if (response) log_response = password ? ""********"" : response; log_request_response_communication(msg, log_response, (struct analyze_event_data *)args); return response ? response : xstrdup(""""); } ",0 "xfs_attr_calc_size( struct xfs_da_args *args, int *local) { struct xfs_mount *mp = args->dp->i_mount; int size; int nblks; /* * Determine space new attribute will use, and if it would be * ""local"" or ""remote"" (note: local != inline). */ size = xfs_attr_leaf_newentsize(args, local); nblks = XFS_DAENTER_SPACE_RES(mp, XFS_ATTR_FORK); if (*local) { if (size > (args->geo->blksize / 2)) { /* Double split possible */ nblks *= 2; } } else { /* * Out of line attribute, cannot double split, but * make room for the attribute value itself. */ uint dblocks = xfs_attr3_rmt_blocks(mp, args->valuelen); nblks += dblocks; nblks += XFS_NEXTENTADD_SPACE_RES(mp, dblocks, XFS_ATTR_FORK); } return nblks; } ",0 "void WebGL2RenderingContextBase::bindTransformFeedback( GLenum target, WebGLTransformFeedback* feedback) { bool deleted; if (!CheckObjectToBeBound(""bindTransformFeedback"", feedback, deleted)) return; if (deleted) { SynthesizeGLError(GL_INVALID_OPERATION, ""bindTransformFeedback"", ""attempted to bind a deleted transform feedback object""); return; } if (target != GL_TRANSFORM_FEEDBACK) { SynthesizeGLError(GL_INVALID_ENUM, ""bindTransformFeedback"", ""target must be TRANSFORM_FEEDBACK""); return; } if (transform_feedback_binding_->active() && !transform_feedback_binding_->paused()) { SynthesizeGLError(GL_INVALID_OPERATION, ""bindTransformFeedback"", ""transform feedback is active and not paused""); return; } WebGLTransformFeedback* feedback_to_be_bound; if (feedback) { feedback_to_be_bound = feedback; feedback_to_be_bound->SetTarget(target); } else { feedback_to_be_bound = default_transform_feedback_.Get(); } transform_feedback_binding_ = feedback_to_be_bound; ContextGL()->BindTransformFeedback(target, ObjectOrZero(feedback_to_be_bound)); } ",0 "static void register_types(void) { type_register_static(&rng_backend_info); } ",0 "static void __devexit airo_pci_remove(struct pci_dev *pdev) { struct net_device *dev = pci_get_drvdata(pdev); airo_print_info(dev->name, ""Unregistering...""); stop_airo_card(dev, 1); pci_disable_device(pdev); pci_set_drvdata(pdev, NULL); } ",0 " virtual ~PendingProcessingInstructionCallback() { xmlFree(target); xmlFree(data); } ",0 "void Document::SetAutofocusElement(Element* element) { if (!element) { autofocus_element_ = nullptr; return; } if (has_autofocused_) return; has_autofocused_ = true; DCHECK(!autofocus_element_); autofocus_element_ = element; GetTaskRunner(TaskType::kUserInteraction) ->PostTask(BLINK_FROM_HERE, WTF::Bind(&RunAutofocusTask, WrapWeakPersistent(this))); } ",0 "key_ref_t search_my_process_keyrings(struct keyring_search_context *ctx) { key_ref_t key_ref, ret, err; /* we want to return -EAGAIN or -ENOKEY if any of the keyrings were * searchable, but we failed to find a key or we found a negative key; * otherwise we want to return a sample error (probably -EACCES) if * none of the keyrings were searchable * * in terms of priority: success > -ENOKEY > -EAGAIN > other error */ key_ref = NULL; ret = NULL; err = ERR_PTR(-EAGAIN); /* search the thread keyring first */ if (ctx->cred->thread_keyring) { key_ref = keyring_search_aux( make_key_ref(ctx->cred->thread_keyring, 1), ctx); if (!IS_ERR(key_ref)) goto found; switch (PTR_ERR(key_ref)) { case -EAGAIN: /* no key */ case -ENOKEY: /* negative key */ ret = key_ref; break; default: err = key_ref; break; } } /* search the process keyring second */ if (ctx->cred->process_keyring) { key_ref = keyring_search_aux( make_key_ref(ctx->cred->process_keyring, 1), ctx); if (!IS_ERR(key_ref)) goto found; switch (PTR_ERR(key_ref)) { case -EAGAIN: /* no key */ if (ret) break; case -ENOKEY: /* negative key */ ret = key_ref; break; default: err = key_ref; break; } } /* search the session keyring */ if (ctx->cred->session_keyring) { rcu_read_lock(); key_ref = keyring_search_aux( make_key_ref(rcu_dereference(ctx->cred->session_keyring), 1), ctx); rcu_read_unlock(); if (!IS_ERR(key_ref)) goto found; switch (PTR_ERR(key_ref)) { case -EAGAIN: /* no key */ if (ret) break; case -ENOKEY: /* negative key */ ret = key_ref; break; default: err = key_ref; break; } } /* or search the user-session keyring */ else if (ctx->cred->user->session_keyring) { key_ref = keyring_search_aux( make_key_ref(ctx->cred->user->session_keyring, 1), ctx); if (!IS_ERR(key_ref)) goto found; switch (PTR_ERR(key_ref)) { case -EAGAIN: /* no key */ if (ret) break; case -ENOKEY: /* negative key */ ret = key_ref; break; default: err = key_ref; break; } } /* no key - decide on the error we're going to go for */ key_ref = ret ? ret : err; found: return key_ref; } ",0 "void InterstitialPage::InterstitialPageRVHViewDelegate::CreateNewWindow( int route_id) { NOTREACHED() << ""InterstitialPage does not support showing popups yet.""; } ",0 "gfx::Point RootWindow::GetHostOrigin() const { return host_->GetBounds().origin(); } ",0 "strfree(gchar *str) { g_free(str); return NULL; } ",0 "static void showUnderInvalidationError(const char* messagePrefix, const char* reason, const DisplayItem* newItem, const DisplayItem* oldItem) { #ifndef NDEBUG WTFLogAlways(""%s %s:\nNew display item: %s\nOld display item: %s\nSee http://crbug.com/450725."", messagePrefix, reason, newItem ? newItem->asDebugString().utf8().data() : ""None"", oldItem ? oldItem->asDebugString().utf8().data() : ""None""); #else WTFLogAlways(""%s %s. Run debug build to get more details\nSee http://crbug.com/450725."", messagePrefix, reason); #endif // NDEBUG } ",0 "void PasswordInputType::OnDetachWithLayoutObject() { GetElement().GetDocument().DecrementPasswordCount(); } ",0 "megasas_fire_cmd_xscale(struct megasas_instance *instance, dma_addr_t frame_phys_addr, u32 frame_count, struct megasas_register_set __iomem *regs) { unsigned long flags; spin_lock_irqsave(&instance->hba_lock, flags); writel((frame_phys_addr >> 3)|(frame_count), &(regs)->inbound_queue_port); spin_unlock_irqrestore(&instance->hba_lock, flags); } ",0 "struct sock *inet_csk_clone(struct sock *sk, const struct request_sock *req, const gfp_t priority) { struct sock *newsk = sk_clone(sk, priority); if (newsk != NULL) { struct inet_connection_sock *newicsk = inet_csk(newsk); newsk->sk_state = TCP_SYN_RECV; newicsk->icsk_bind_hash = NULL; inet_sk(newsk)->inet_dport = inet_rsk(req)->rmt_port; inet_sk(newsk)->inet_num = ntohs(inet_rsk(req)->loc_port); inet_sk(newsk)->inet_sport = inet_rsk(req)->loc_port; newsk->sk_write_space = sk_stream_write_space; newicsk->icsk_retransmits = 0; newicsk->icsk_backoff = 0; newicsk->icsk_probes_out = 0; /* Deinitialize accept_queue to trap illegal accesses. */ memset(&newicsk->icsk_accept_queue, 0, sizeof(newicsk->icsk_accept_queue)); security_inet_csk_clone(newsk, req); } return newsk; } ",0 "status_t SoftAVC::resetPlugin() { mIsInFlush = false; mReceivedEOS = false; memset(mTimeStamps, 0, sizeof(mTimeStamps)); memset(mTimeStampsValid, 0, sizeof(mTimeStampsValid)); /* Initialize both start and end times */ gettimeofday(&mTimeStart, NULL); gettimeofday(&mTimeEnd, NULL); return OK; } ",0 "int kgdb_ll_trap(int cmd, const char *str, struct pt_regs *regs, long err, int trap, int sig) { struct die_args args = { .regs = regs, .str = str, .err = err, .trapnr = trap, .signr = sig, }; if (!kgdb_io_module_registered) return NOTIFY_DONE; return __kgdb_notify(&args, cmd); } ",0 "MagickExport Image *SpliceImage(const Image *image, const RectangleInfo *geometry,ExceptionInfo *exception) { #define SpliceImageTag ""Splice/Image"" CacheView *image_view, *splice_view; Image *splice_image; MagickBooleanType status; MagickOffsetType progress; RectangleInfo splice_geometry; ssize_t y; /* Allocate splice image. */ assert(image != (const Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"",image->filename); assert(geometry != (const RectangleInfo *) NULL); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); splice_geometry=(*geometry); splice_image=CloneImage(image,image->columns+splice_geometry.width, image->rows+splice_geometry.height,MagickTrue,exception); if (splice_image == (Image *) NULL) return((Image *) NULL); if (SetImageStorageClass(splice_image,DirectClass,exception) == MagickFalse) { splice_image=DestroyImage(splice_image); return((Image *) NULL); } if ((IsPixelInfoGray(&splice_image->background_color) == MagickFalse) && (IsGrayColorspace(splice_image->colorspace) != MagickFalse)) (void) SetImageColorspace(splice_image,sRGBColorspace,exception); if ((splice_image->background_color.alpha_trait != UndefinedPixelTrait) && (splice_image->alpha_trait == UndefinedPixelTrait)) (void) SetImageAlpha(splice_image,OpaqueAlpha,exception); (void) SetImageBackgroundColor(splice_image,exception); /* Respect image geometry. */ switch (image->gravity) { default: case UndefinedGravity: case NorthWestGravity: break; case NorthGravity: { splice_geometry.x+=(ssize_t) splice_geometry.width/2; break; } case NorthEastGravity: { splice_geometry.x+=(ssize_t) splice_geometry.width; break; } case WestGravity: { splice_geometry.y+=(ssize_t) splice_geometry.width/2; break; } case CenterGravity: { splice_geometry.x+=(ssize_t) splice_geometry.width/2; splice_geometry.y+=(ssize_t) splice_geometry.height/2; break; } case EastGravity: { splice_geometry.x+=(ssize_t) splice_geometry.width; splice_geometry.y+=(ssize_t) splice_geometry.height/2; break; } case SouthWestGravity: { splice_geometry.y+=(ssize_t) splice_geometry.height; break; } case SouthGravity: { splice_geometry.x+=(ssize_t) splice_geometry.width/2; splice_geometry.y+=(ssize_t) splice_geometry.height; break; } case SouthEastGravity: { splice_geometry.x+=(ssize_t) splice_geometry.width; splice_geometry.y+=(ssize_t) splice_geometry.height; break; } } /* Splice image. */ status=MagickTrue; progress=0; image_view=AcquireVirtualCacheView(image,exception); splice_view=AcquireAuthenticCacheView(splice_image,exception); #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static,4) shared(progress,status) \ magick_threads(image,splice_image,1,1) #endif for (y=0; y < (ssize_t) splice_geometry.y; y++) { register const Quantum *restrict p; register ssize_t x; register Quantum *restrict q; if (status == MagickFalse) continue; p=GetCacheViewVirtualPixels(image_view,0,y,image->columns,1,exception); q=QueueCacheViewAuthenticPixels(splice_view,0,y,splice_image->columns,1, exception); if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL)) { status=MagickFalse; continue; } for (x=0; x < splice_geometry.x; x++) { register ssize_t i; if (GetPixelReadMask(image,p) == 0) { SetPixelBackgoundColor(splice_image,q); p+=GetPixelChannels(image); q+=GetPixelChannels(splice_image); continue; } for (i=0; i < (ssize_t) GetPixelChannels(image); i++) { PixelChannel channel=GetPixelChannelChannel(image,i); PixelTrait traits=GetPixelChannelTraits(image,channel); PixelTrait splice_traits=GetPixelChannelTraits(splice_image,channel); if ((traits == UndefinedPixelTrait) || (splice_traits == UndefinedPixelTrait)) continue; SetPixelChannel(splice_image,channel,p[i],q); } SetPixelRed(splice_image,GetPixelRed(image,p),q); SetPixelGreen(splice_image,GetPixelGreen(image,p),q); SetPixelBlue(splice_image,GetPixelBlue(image,p),q); SetPixelAlpha(splice_image,GetPixelAlpha(image,p),q); p+=GetPixelChannels(image); q+=GetPixelChannels(splice_image); } for ( ; x < (ssize_t) (splice_geometry.x+splice_geometry.width); x++) q+=GetPixelChannels(splice_image); for ( ; x < (ssize_t) splice_image->columns; x++) { register ssize_t i; if (GetPixelReadMask(image,p) == 0) { SetPixelBackgoundColor(splice_image,q); p+=GetPixelChannels(image); q+=GetPixelChannels(splice_image); continue; } for (i=0; i < (ssize_t) GetPixelChannels(image); i++) { PixelChannel channel=GetPixelChannelChannel(image,i); PixelTrait traits=GetPixelChannelTraits(image,channel); PixelTrait splice_traits=GetPixelChannelTraits(splice_image,channel); if ((traits == UndefinedPixelTrait) || (splice_traits == UndefinedPixelTrait)) continue; SetPixelChannel(splice_image,channel,p[i],q); } SetPixelRed(splice_image,GetPixelRed(image,p),q); SetPixelGreen(splice_image,GetPixelGreen(image,p),q); SetPixelBlue(splice_image,GetPixelBlue(image,p),q); SetPixelAlpha(splice_image,GetPixelAlpha(image,p),q); p+=GetPixelChannels(image); q+=GetPixelChannels(splice_image); } if (SyncCacheViewAuthenticPixels(splice_view,exception) == MagickFalse) status=MagickFalse; if (image->progress_monitor != (MagickProgressMonitor) NULL) { MagickBooleanType proceed; #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp critical (MagickCore_TransposeImage) #endif proceed=SetImageProgress(image,SpliceImageTag,progress++, splice_image->rows); if (proceed == MagickFalse) status=MagickFalse; } } #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static,4) shared(progress,status) \ magick_threads(image,splice_image,1,1) #endif for (y=(ssize_t) (splice_geometry.y+splice_geometry.height); y < (ssize_t) splice_image->rows; y++) { register const Quantum *restrict p; register ssize_t x; register Quantum *restrict q; if (status == MagickFalse) continue; p=GetCacheViewVirtualPixels(image_view,0,y-(ssize_t) splice_geometry.height, image->columns,1,exception); if ((y < 0) || (y >= (ssize_t) splice_image->rows)) continue; q=QueueCacheViewAuthenticPixels(splice_view,0,y,splice_image->columns,1, exception); if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL)) { status=MagickFalse; continue; } for (x=0; x < splice_geometry.x; x++) { register ssize_t i; if (GetPixelReadMask(image,q) == 0) { SetPixelBackgoundColor(splice_image,q); p+=GetPixelChannels(image); q+=GetPixelChannels(splice_image); continue; } for (i=0; i < (ssize_t) GetPixelChannels(image); i++) { PixelChannel channel=GetPixelChannelChannel(image,i); PixelTrait traits=GetPixelChannelTraits(image,channel); PixelTrait splice_traits=GetPixelChannelTraits(splice_image,channel); if ((traits == UndefinedPixelTrait) || (splice_traits == UndefinedPixelTrait)) continue; SetPixelChannel(splice_image,channel,p[i],q); } SetPixelRed(splice_image,GetPixelRed(image,p),q); SetPixelGreen(splice_image,GetPixelGreen(image,p),q); SetPixelBlue(splice_image,GetPixelBlue(image,p),q); SetPixelAlpha(splice_image,GetPixelAlpha(image,p),q); p+=GetPixelChannels(image); q+=GetPixelChannels(splice_image); } for ( ; x < (ssize_t) (splice_geometry.x+splice_geometry.width); x++) q+=GetPixelChannels(splice_image); for ( ; x < (ssize_t) splice_image->columns; x++) { register ssize_t i; if (GetPixelReadMask(image,q) == 0) { SetPixelBackgoundColor(splice_image,q); p+=GetPixelChannels(image); q+=GetPixelChannels(splice_image); continue; } for (i=0; i < (ssize_t) GetPixelChannels(image); i++) { PixelChannel channel=GetPixelChannelChannel(image,i); PixelTrait traits=GetPixelChannelTraits(image,channel); PixelTrait splice_traits=GetPixelChannelTraits(splice_image,channel); if ((traits == UndefinedPixelTrait) || (splice_traits == UndefinedPixelTrait)) continue; SetPixelChannel(splice_image,channel,p[i],q); } SetPixelRed(splice_image,GetPixelRed(image,p),q); SetPixelGreen(splice_image,GetPixelGreen(image,p),q); SetPixelBlue(splice_image,GetPixelBlue(image,p),q); SetPixelAlpha(splice_image,GetPixelAlpha(image,p),q); p+=GetPixelChannels(image); q+=GetPixelChannels(splice_image); } if (SyncCacheViewAuthenticPixels(splice_view,exception) == MagickFalse) status=MagickFalse; if (image->progress_monitor != (MagickProgressMonitor) NULL) { MagickBooleanType proceed; #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp critical (MagickCore_TransposeImage) #endif proceed=SetImageProgress(image,SpliceImageTag,progress++, splice_image->rows); if (proceed == MagickFalse) status=MagickFalse; } } splice_view=DestroyCacheView(splice_view); image_view=DestroyCacheView(image_view); if (status == MagickFalse) splice_image=DestroyImage(splice_image); return(splice_image); } ",1 " DiscardableMemoryImpl(ClientDiscardableSharedMemoryManager* manager, std::unique_ptr span) : manager_(manager), span_(std::move(span)), is_locked_(true) {} ",0 "void RenderFrameSubmissionObserver::OnRenderFrameSubmission() { render_frame_count_++; if (break_on_any_frame_) Quit(); } ",0 "static int nfs4_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsinfo *info) { int minor_version = server->nfs_client->cl_minorversion; int status = nfs4_lookup_root(server, fhandle, info); if ((status == -NFS4ERR_WRONGSEC) && !(server->flags & NFS_MOUNT_SECFLAVOUR)) /* * A status of -NFS4ERR_WRONGSEC will be mapped to -EPERM * by nfs4_map_errors() as this function exits. */ status = nfs_v4_minor_ops[minor_version]->find_root_sec(server, fhandle, info); if (status == 0) status = nfs4_server_capabilities(server, fhandle); if (status == 0) status = nfs4_do_fsinfo(server, fhandle, info); return nfs4_map_errors(status); } ",0 "void DoNothingWithBool(bool b) {} ",0 "PHP_FUNCTION(openssl_open) { zval *privkey, *opendata; EVP_PKEY *pkey; int len1, len2, cipher_iv_len; unsigned char *buf, *iv_buf; zend_resource *keyresource = NULL; EVP_CIPHER_CTX *ctx; char * data; size_t data_len; char * ekey; size_t ekey_len; char *method = NULL, *iv = NULL; size_t method_len = 0, iv_len = 0; const EVP_CIPHER *cipher; if (zend_parse_parameters(ZEND_NUM_ARGS(), ""sz/sz|ss"", &data, &data_len, &opendata, &ekey, &ekey_len, &privkey, &method, &method_len, &iv, &iv_len) == FAILURE) { return; } pkey = php_openssl_evp_from_zval(privkey, 0, """", 0, 0, &keyresource); if (pkey == NULL) { php_error_docref(NULL, E_WARNING, ""unable to coerce parameter 4 into a private key""); RETURN_FALSE; } PHP_OPENSSL_CHECK_SIZE_T_TO_INT(ekey_len, ekey); PHP_OPENSSL_CHECK_SIZE_T_TO_INT(data_len, data); if (method) { cipher = EVP_get_cipherbyname(method); if (!cipher) { php_error_docref(NULL, E_WARNING, ""Unknown signature algorithm.""); RETURN_FALSE; } } else { cipher = EVP_rc4(); } cipher_iv_len = EVP_CIPHER_iv_length(cipher); if (cipher_iv_len > 0) { if (!iv) { php_error_docref(NULL, E_WARNING, ""Cipher algorithm requires an IV to be supplied as a sixth parameter""); RETURN_FALSE; } if (cipher_iv_len != iv_len) { php_error_docref(NULL, E_WARNING, ""IV length is invalid""); RETURN_FALSE; } iv_buf = (unsigned char *)iv; } else { iv_buf = NULL; } buf = emalloc(data_len + 1); ctx = EVP_CIPHER_CTX_new(); if (ctx != NULL && EVP_OpenInit(ctx, cipher, (unsigned char *)ekey, (int)ekey_len, iv_buf, pkey) && EVP_OpenUpdate(ctx, buf, &len1, (unsigned char *)data, (int)data_len) && EVP_OpenFinal(ctx, buf + len1, &len2) && (len1 + len2 > 0)) { zval_dtor(opendata); buf[len1 + len2] = '\0'; ZVAL_NEW_STR(opendata, zend_string_init((char*)buf, len1 + len2, 0)); RETVAL_TRUE; } else { RETVAL_FALSE; } efree(buf); if (keyresource == NULL) { EVP_PKEY_free(pkey); } EVP_CIPHER_CTX_free(ctx); } ",0 "void RenderViewImpl::showContextMenu( WebFrame* frame, const WebContextMenuData& data) { content::ContextMenuParams params(data); if (frame) params.frame_id = frame->identifier(); if (params.src_url.spec().size() > content::kMaxURLChars) params.src_url = GURL(); context_menu_node_ = data.node; Send(new ViewHostMsg_ContextMenu(routing_id_, params)); } ",0 "xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx, const xmlChar *URL, const xmlChar *ID, xmlNodePtr *lst) { xmlParserCtxtPtr ctxt; xmlDocPtr newDoc; xmlNodePtr newRoot; xmlSAXHandlerPtr oldsax = NULL; int ret = 0; xmlChar start[4]; xmlCharEncoding enc; if (ctx == NULL) return(-1); if (((ctx->depth > 40) && ((ctx->options & XML_PARSE_HUGE) == 0)) || (ctx->depth > 1024)) { return(XML_ERR_ENTITY_LOOP); } if (lst != NULL) *lst = NULL; if ((URL == NULL) && (ID == NULL)) return(-1); if (ctx->myDoc == NULL) /* @@ relax but check for dereferences */ return(-1); ctxt = xmlCreateEntityParserCtxtInternal(URL, ID, NULL, ctx); if (ctxt == NULL) { return(-1); } oldsax = ctxt->sax; ctxt->sax = ctx->sax; xmlDetectSAX2(ctxt); newDoc = xmlNewDoc(BAD_CAST ""1.0""); if (newDoc == NULL) { xmlFreeParserCtxt(ctxt); return(-1); } newDoc->properties = XML_DOC_INTERNAL; if (ctx->myDoc->dict) { newDoc->dict = ctx->myDoc->dict; xmlDictReference(newDoc->dict); } if (ctx->myDoc != NULL) { newDoc->intSubset = ctx->myDoc->intSubset; newDoc->extSubset = ctx->myDoc->extSubset; } if (ctx->myDoc->URL != NULL) { newDoc->URL = xmlStrdup(ctx->myDoc->URL); } newRoot = xmlNewDocNode(newDoc, NULL, BAD_CAST ""pseudoroot"", NULL); if (newRoot == NULL) { ctxt->sax = oldsax; xmlFreeParserCtxt(ctxt); newDoc->intSubset = NULL; newDoc->extSubset = NULL; xmlFreeDoc(newDoc); return(-1); } xmlAddChild((xmlNodePtr) newDoc, newRoot); nodePush(ctxt, newDoc->children); if (ctx->myDoc == NULL) { ctxt->myDoc = newDoc; } else { ctxt->myDoc = ctx->myDoc; newDoc->children->doc = ctx->myDoc; } /* * Get the 4 first bytes and decode the charset * if enc != XML_CHAR_ENCODING_NONE * plug some encoding conversion routines. */ GROW if ((ctxt->input->end - ctxt->input->cur) >= 4) { start[0] = RAW; start[1] = NXT(1); start[2] = NXT(2); start[3] = NXT(3); enc = xmlDetectCharEncoding(start, 4); if (enc != XML_CHAR_ENCODING_NONE) { xmlSwitchEncoding(ctxt, enc); } } /* * Parse a possible text declaration first */ if ((CMP5(CUR_PTR, '<', '?', 'x', 'm', 'l')) && (IS_BLANK_CH(NXT(5)))) { xmlParseTextDecl(ctxt); /* * An XML-1.0 document can't reference an entity not XML-1.0 */ if ((xmlStrEqual(ctx->version, BAD_CAST ""1.0"")) && (!xmlStrEqual(ctxt->input->version, BAD_CAST ""1.0""))) { xmlFatalErrMsg(ctxt, XML_ERR_VERSION_MISMATCH, ""Version mismatch between document and entity\n""); } } /* * If the user provided its own SAX callbacks then reuse the * useData callback field, otherwise the expected setup in a * DOM builder is to have userData == ctxt */ if (ctx->userData == ctx) ctxt->userData = ctxt; else ctxt->userData = ctx->userData; /* * Doing validity checking on chunk doesn't make sense */ ctxt->instate = XML_PARSER_CONTENT; ctxt->validate = ctx->validate; ctxt->valid = ctx->valid; ctxt->loadsubset = ctx->loadsubset; ctxt->depth = ctx->depth + 1; ctxt->replaceEntities = ctx->replaceEntities; if (ctxt->validate) { ctxt->vctxt.error = ctx->vctxt.error; ctxt->vctxt.warning = ctx->vctxt.warning; } else { ctxt->vctxt.error = NULL; ctxt->vctxt.warning = NULL; } ctxt->vctxt.nodeTab = NULL; ctxt->vctxt.nodeNr = 0; ctxt->vctxt.nodeMax = 0; ctxt->vctxt.node = NULL; if (ctxt->dict != NULL) xmlDictFree(ctxt->dict); ctxt->dict = ctx->dict; ctxt->str_xml = xmlDictLookup(ctxt->dict, BAD_CAST ""xml"", 3); ctxt->str_xmlns = xmlDictLookup(ctxt->dict, BAD_CAST ""xmlns"", 5); ctxt->str_xml_ns = xmlDictLookup(ctxt->dict, XML_XML_NAMESPACE, 36); ctxt->dictNames = ctx->dictNames; ctxt->attsDefault = ctx->attsDefault; ctxt->attsSpecial = ctx->attsSpecial; ctxt->linenumbers = ctx->linenumbers; xmlParseContent(ctxt); ctx->validate = ctxt->validate; ctx->valid = ctxt->valid; if ((RAW == '<') && (NXT(1) == '/')) { xmlFatalErr(ctxt, XML_ERR_NOT_WELL_BALANCED, NULL); } else if (RAW != 0) { xmlFatalErr(ctxt, XML_ERR_EXTRA_CONTENT, NULL); } if (ctxt->node != newDoc->children) { xmlFatalErr(ctxt, XML_ERR_NOT_WELL_BALANCED, NULL); } if (!ctxt->wellFormed) { if (ctxt->errNo == 0) ret = 1; else ret = ctxt->errNo; } else { if (lst != NULL) { xmlNodePtr cur; /* * Return the newly created nodeset after unlinking it from * they pseudo parent. */ cur = newDoc->children->children; *lst = cur; while (cur != NULL) { cur->parent = NULL; cur = cur->next; } newDoc->children->children = NULL; } ret = 0; } ctxt->sax = oldsax; ctxt->dict = NULL; ctxt->attsDefault = NULL; ctxt->attsSpecial = NULL; xmlFreeParserCtxt(ctxt); newDoc->intSubset = NULL; newDoc->extSubset = NULL; xmlFreeDoc(newDoc); return(ret); } ",0 "INST_HANDLER (ldi) { // LDI Rd, K int k = (buf[0] & 0xf) + ((buf[1] & 0xf) << 4); int d = ((buf[0] >> 4) & 0xf) + 16; op->val = k; ESIL_A (""0x%x,r%d,=,"", k, d); } ",0 "int cac_list_compare_path(const void *a, const void *b) { if (a == NULL || b == NULL) return 1; return memcmp( &((cac_object_t *) a)->path, &((cac_object_t *) b)->path, sizeof(sc_path_t)); } ",0 "ofport_is_mtu_overridden(const struct ofproto *p, const struct ofport *port) { return ofport_is_internal_or_patch(p, port) && !netdev_mtu_is_user_config(port->netdev); } ",0 "void RTCPeerConnectionHandler::OnSignalingChange( webrtc::PeerConnectionInterface::SignalingState new_state) { DCHECK(task_runner_->RunsTasksInCurrentSequence()); TRACE_EVENT0(""webrtc"", ""RTCPeerConnectionHandler::OnSignalingChange""); if (peer_connection_tracker_) peer_connection_tracker_->TrackSignalingStateChange(this, new_state); if (!is_closed_) client_->DidChangeSignalingState(new_state); } ",0 "const u8 *sc_asn1_skip_tag(sc_context_t *ctx, const u8 ** buf, size_t *buflen, unsigned int tag_in, size_t *taglen_out) { const u8 *p = *buf; size_t len = *buflen, taglen; unsigned int cla = 0, tag; if (sc_asn1_read_tag((const u8 **) &p, len, &cla, &tag, &taglen) != SC_SUCCESS || p == NULL) return NULL; switch (cla & 0xC0) { case SC_ASN1_TAG_UNIVERSAL: if ((tag_in & SC_ASN1_CLASS_MASK) != SC_ASN1_UNI) return NULL; break; case SC_ASN1_TAG_APPLICATION: if ((tag_in & SC_ASN1_CLASS_MASK) != SC_ASN1_APP) return NULL; break; case SC_ASN1_TAG_CONTEXT: if ((tag_in & SC_ASN1_CLASS_MASK) != SC_ASN1_CTX) return NULL; break; case SC_ASN1_TAG_PRIVATE: if ((tag_in & SC_ASN1_CLASS_MASK) != SC_ASN1_PRV) return NULL; break; } if (cla & SC_ASN1_TAG_CONSTRUCTED) { if ((tag_in & SC_ASN1_CONS) == 0) return NULL; } else if (tag_in & SC_ASN1_CONS) return NULL; if ((tag_in & SC_ASN1_TAG_MASK) != tag) return NULL; len -= (p - *buf); /* header size */ if (taglen > len) { sc_debug(ctx, SC_LOG_DEBUG_ASN1, ""too long ASN.1 object (size %""SC_FORMAT_LEN_SIZE_T""u while only %""SC_FORMAT_LEN_SIZE_T""u available)\n"", taglen, len); return NULL; } *buflen -= (p - *buf) + taglen; *buf = p + taglen; /* point to next tag */ *taglen_out = taglen; return p; } ",0 "HarfBuzzShaper::HarfBuzzRun::~HarfBuzzRun() { } ",0 "void GLES2Implementation::GetActiveUniformBlockName(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, char* name) { GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG(""["" << GetLogPrefix() << ""] glGetActiveUniformBlockName("" << program << "", "" << index << "", "" << bufsize << "", "" << static_cast(length) << "", "" << static_cast(name) << "")""); if (bufsize < 0) { SetGLError(GL_INVALID_VALUE, ""glGetActiveUniformBlockName"", ""bufsize < 0""); return; } TRACE_EVENT0(""gpu"", ""GLES2::GetActiveUniformBlockName""); bool success = share_group_->program_info_manager()->GetActiveUniformBlockName( this, program, index, bufsize, length, name); if (success) { if (name) { GPU_CLIENT_LOG("" name: "" << name); } } CheckGLError(); } ",0 "static bool nested_vmx_exit_handled_io(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12) { unsigned long exit_qualification; gpa_t bitmap, last_bitmap; unsigned int port; int size; u8 b; if (nested_cpu_has(vmcs12, CPU_BASED_UNCOND_IO_EXITING)) return 1; if (!nested_cpu_has(vmcs12, CPU_BASED_USE_IO_BITMAPS)) return 0; exit_qualification = vmcs_readl(EXIT_QUALIFICATION); port = exit_qualification >> 16; size = (exit_qualification & 7) + 1; last_bitmap = (gpa_t)-1; b = -1; while (size > 0) { if (port < 0x8000) bitmap = vmcs12->io_bitmap_a; else if (port < 0x10000) bitmap = vmcs12->io_bitmap_b; else return 1; bitmap += (port & 0x7fff) / 8; if (last_bitmap != bitmap) if (kvm_read_guest(vcpu->kvm, bitmap, &b, 1)) return 1; if (b & (1 << (port & 7))) return 1; port++; size--; last_bitmap = bitmap; } return 0; } ",0 "ActivateKeyboardGrab(DeviceIntPtr keybd, GrabPtr grab, TimeStamp time, Bool passive) { GrabInfoPtr grabinfo = &keybd->deviceGrab; GrabPtr oldgrab = grabinfo->grab; WindowPtr oldWin; /* slave devices need to float for the duration of the grab. */ if (grab->grabtype == XI2 && keybd->enabled && !(passive & ImplicitGrabMask) && !IsMaster(keybd)) DetachFromMaster(keybd); if (!keybd->enabled) oldWin = NULL; else if (grabinfo->grab) oldWin = grabinfo->grab->window; else if (keybd->focus) oldWin = keybd->focus->win; else oldWin = keybd->spriteInfo->sprite->win; if (oldWin == FollowKeyboardWin) oldWin = keybd->focus->win; if (keybd->valuator) keybd->valuator->motionHintWindow = NullWindow; if (oldWin) DoFocusEvents(keybd, oldWin, grab->window, NotifyGrab); if (syncEvents.playingEvents) grabinfo->grabTime = syncEvents.time; else grabinfo->grabTime = time; grabinfo->grab = AllocGrab(grab); grabinfo->fromPassiveGrab = passive; grabinfo->implicitGrab = passive & ImplicitGrabMask; CheckGrabForSyncs(keybd, (Bool) grab->keyboardMode, (Bool) grab->pointerMode); if (oldgrab) FreeGrab(oldgrab); } ",0 "int mp_jacobi(mp_int* a, mp_int* n, int* c) { mp_int a1, n1; int res; /* step 3. write a = a1 * 2**k */ if ((res = mp_init_multi(&a1, &n1, NULL, NULL, NULL, NULL)) != MP_OKAY) { return res; } if ((res = mp_copy(a, &a1)) != MP_OKAY) { goto done; } if ((res = mp_copy(n, &n1)) != MP_OKAY) { goto done; } res = do_mp_jacobi(&a1, &n1, c); done: /* cleanup */ mp_clear(&n1); mp_clear(&a1); return res; } ",0 "void VirtualAuthenticator::AddRegistration( blink::test::mojom::RegisteredKeyPtr registration, AddRegistrationCallback callback) { if (registration->application_parameter.size() != device::kRpIdHashLength) { std::move(callback).Run(false); return; } bool success = false; std::tie(std::ignore, success) = state_->registrations.emplace( std::move(registration->key_handle), ::device::VirtualFidoDevice::RegistrationData( crypto::ECPrivateKey::CreateFromPrivateKeyInfo( registration->private_key), registration->application_parameter, registration->counter)); std::move(callback).Run(success); } ",1 "static void gcm_hash_init_done(struct crypto_async_request *areq, int err) { struct aead_request *req = areq->data; __gcm_hash_init_done(req, err); } ",0 "views::Label* AutofillPopupItemView::CreateLabelWithStyleAndContext( const base::string16& text, int text_context, int text_style) const { views::Label* label = CreateLabelWithColorReadabilityDisabled(text, text_context, text_style); label->SetHorizontalAlignment(gfx::ALIGN_LEFT); return label; } ",0 "static void nfs4_xdr_enc_create(struct rpc_rqst *req, struct xdr_stream *xdr, const struct nfs4_create_arg *args) { struct compound_hdr hdr = { .minorversion = nfs4_xdr_minorversion(&args->seq_args), }; encode_compound_hdr(xdr, req, &hdr); encode_sequence(xdr, &args->seq_args, &hdr); encode_putfh(xdr, args->dir_fh, &hdr); encode_savefh(xdr, &hdr); encode_create(xdr, args, &hdr); encode_getfh(xdr, &hdr); encode_getfattr(xdr, args->bitmask, &hdr); encode_restorefh(xdr, &hdr); encode_getfattr(xdr, args->bitmask, &hdr); encode_nops(&hdr); } ",0 "RenderWidgetHost* GetMouseLockWidget(WebContents* web_contents) { return static_cast(web_contents)->GetMouseLockWidget(); } ",0 "static bool cmd_smart(IDEState *s, uint8_t cmd) { int n; if (s->hcyl != 0xc2 || s->lcyl != 0x4f) { goto abort_cmd; } if (!s->smart_enabled && s->feature != SMART_ENABLE) { goto abort_cmd; } switch (s->feature) { case SMART_DISABLE: s->smart_enabled = 0; return true; case SMART_ENABLE: s->smart_enabled = 1; return true; case SMART_ATTR_AUTOSAVE: switch (s->sector) { case 0x00: s->smart_autosave = 0; break; case 0xf1: s->smart_autosave = 1; break; default: goto abort_cmd; } return true; case SMART_STATUS: if (!s->smart_errors) { s->hcyl = 0xc2; s->lcyl = 0x4f; } else { s->hcyl = 0x2c; s->lcyl = 0xf4; } return true; case SMART_READ_THRESH: memset(s->io_buffer, 0, 0x200); s->io_buffer[0] = 0x01; /* smart struct version */ for (n = 0; n < ARRAY_SIZE(smart_attributes); n++) { s->io_buffer[2 + 0 + (n * 12)] = smart_attributes[n][0]; s->io_buffer[2 + 1 + (n * 12)] = smart_attributes[n][11]; } /* checksum */ for (n = 0; n < 511; n++) { s->io_buffer[511] += s->io_buffer[n]; } s->io_buffer[511] = 0x100 - s->io_buffer[511]; s->status = READY_STAT | SEEK_STAT; ide_transfer_start(s, s->io_buffer, 0x200, ide_transfer_stop); ide_set_irq(s->bus); return false; case SMART_READ_DATA: memset(s->io_buffer, 0, 0x200); s->io_buffer[0] = 0x01; /* smart struct version */ for (n = 0; n < ARRAY_SIZE(smart_attributes); n++) { int i; for (i = 0; i < 11; i++) { s->io_buffer[2 + i + (n * 12)] = smart_attributes[n][i]; } } s->io_buffer[362] = 0x02 | (s->smart_autosave ? 0x80 : 0x00); if (s->smart_selftest_count == 0) { s->io_buffer[363] = 0; } else { s->io_buffer[363] = s->smart_selftest_data[3 + (s->smart_selftest_count - 1) * 24]; } s->io_buffer[364] = 0x20; s->io_buffer[365] = 0x01; /* offline data collection capacity: execute + self-test*/ s->io_buffer[367] = (1 << 4 | 1 << 3 | 1); s->io_buffer[368] = 0x03; /* smart capability (1) */ s->io_buffer[369] = 0x00; /* smart capability (2) */ s->io_buffer[370] = 0x01; /* error logging supported */ s->io_buffer[372] = 0x02; /* minutes for poll short test */ s->io_buffer[373] = 0x36; /* minutes for poll ext test */ s->io_buffer[374] = 0x01; /* minutes for poll conveyance */ for (n = 0; n < 511; n++) { s->io_buffer[511] += s->io_buffer[n]; } s->io_buffer[511] = 0x100 - s->io_buffer[511]; s->status = READY_STAT | SEEK_STAT; ide_transfer_start(s, s->io_buffer, 0x200, ide_transfer_stop); ide_set_irq(s->bus); return false; case SMART_READ_LOG: switch (s->sector) { case 0x01: /* summary smart error log */ memset(s->io_buffer, 0, 0x200); s->io_buffer[0] = 0x01; s->io_buffer[1] = 0x00; /* no error entries */ s->io_buffer[452] = s->smart_errors & 0xff; s->io_buffer[453] = (s->smart_errors & 0xff00) >> 8; for (n = 0; n < 511; n++) { s->io_buffer[511] += s->io_buffer[n]; } s->io_buffer[511] = 0x100 - s->io_buffer[511]; break; case 0x06: /* smart self test log */ memset(s->io_buffer, 0, 0x200); s->io_buffer[0] = 0x01; if (s->smart_selftest_count == 0) { s->io_buffer[508] = 0; } else { s->io_buffer[508] = s->smart_selftest_count; for (n = 2; n < 506; n++) { s->io_buffer[n] = s->smart_selftest_data[n]; } } for (n = 0; n < 511; n++) { s->io_buffer[511] += s->io_buffer[n]; } s->io_buffer[511] = 0x100 - s->io_buffer[511]; break; default: goto abort_cmd; } s->status = READY_STAT | SEEK_STAT; ide_transfer_start(s, s->io_buffer, 0x200, ide_transfer_stop); ide_set_irq(s->bus); return false; case SMART_EXECUTE_OFFLINE: switch (s->sector) { case 0: /* off-line routine */ case 1: /* short self test */ case 2: /* extended self test */ s->smart_selftest_count++; if (s->smart_selftest_count > 21) { s->smart_selftest_count = 1; } n = 2 + (s->smart_selftest_count - 1) * 24; s->smart_selftest_data[n] = s->sector; s->smart_selftest_data[n + 1] = 0x00; /* OK and finished */ s->smart_selftest_data[n + 2] = 0x34; /* hour count lsb */ s->smart_selftest_data[n + 3] = 0x12; /* hour count msb */ break; default: goto abort_cmd; } return true; } abort_cmd: ide_abort_command(s); return true; } ",0 "static void snd_usbmidi_switch_roland_altsetting(struct snd_usb_midi *umidi) { struct usb_interface *intf; struct usb_host_interface *hostif; struct usb_interface_descriptor *intfd; intf = umidi->iface; if (!intf || intf->num_altsetting != 2) return; hostif = &intf->altsetting[1]; intfd = get_iface_desc(hostif); /* If either or both of the endpoints support interrupt transfer, * then use the alternate setting */ if (intfd->bNumEndpoints != 2 || !((get_endpoint(hostif, 0)->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT || (get_endpoint(hostif, 1)->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT)) return; dev_dbg(&umidi->dev->dev, ""switching to altsetting %d with int ep\n"", intfd->bAlternateSetting); usb_set_interface(umidi->dev, intfd->bInterfaceNumber, intfd->bAlternateSetting); umidi->roland_load_ctl = snd_ctl_new1(&roland_load_ctl, umidi); if (snd_ctl_add(umidi->card, umidi->roland_load_ctl) < 0) umidi->roland_load_ctl = NULL; } ",0 "void NavigationControllerImpl::GoBack() { if (!CanGoBack()) { NOTREACHED(); return; } int current_index = GetCurrentEntryIndex(); DiscardNonCommittedEntries(); pending_entry_index_ = current_index - 1; entries_[pending_entry_index_]->SetTransitionType( PageTransitionFromInt( entries_[pending_entry_index_]->GetTransitionType() | PAGE_TRANSITION_FORWARD_BACK)); NavigateToPendingEntry(NO_RELOAD); } ",0 "VOID ixheaacd_inv_emodulation(WORD32 *qmf_real, ia_sbr_qmf_filter_bank_struct *syn_qmf, ia_qmf_dec_tables_struct *qmf_dec_tables_ptr) { ixheaacd_cos_sin_mod(qmf_real, syn_qmf, (WORD16 *)qmf_dec_tables_ptr->w1024, (WORD32 *)qmf_dec_tables_ptr->dig_rev_table2_128); } ",0 "BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2 (FILE * inFile) { gdIOCtx *in = gdNewFileCtx (inFile); gdImagePtr im; if (in == NULL) return NULL; im = gdImageCreateFromGd2Ctx (in); in->gd_free (in); return im; } ",0 "xmlParseExtParsedEnt(xmlParserCtxtPtr ctxt) { xmlChar start[4]; xmlCharEncoding enc; if ((ctxt == NULL) || (ctxt->input == NULL)) return(-1); xmlDefaultSAXHandlerInit(); xmlDetectSAX2(ctxt); GROW; /* * SAX: beginning of the document processing. */ if ((ctxt->sax) && (ctxt->sax->setDocumentLocator)) ctxt->sax->setDocumentLocator(ctxt->userData, &xmlDefaultSAXLocator); /* * Get the 4 first bytes and decode the charset * if enc != XML_CHAR_ENCODING_NONE * plug some encoding conversion routines. */ if ((ctxt->input->end - ctxt->input->cur) >= 4) { start[0] = RAW; start[1] = NXT(1); start[2] = NXT(2); start[3] = NXT(3); enc = xmlDetectCharEncoding(start, 4); if (enc != XML_CHAR_ENCODING_NONE) { xmlSwitchEncoding(ctxt, enc); } } if (CUR == 0) { xmlFatalErr(ctxt, XML_ERR_DOCUMENT_EMPTY, NULL); } /* * Check for the XMLDecl in the Prolog. */ GROW; if ((CMP5(CUR_PTR, '<', '?', 'x', 'm', 'l')) && (IS_BLANK_CH(NXT(5)))) { /* * Note that we will switch encoding on the fly. */ xmlParseXMLDecl(ctxt); if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) { /* * The XML REC instructs us to stop parsing right here */ return(-1); } SKIP_BLANKS; } else { ctxt->version = xmlCharStrdup(XML_DEFAULT_VERSION); } if ((ctxt->sax) && (ctxt->sax->startDocument) && (!ctxt->disableSAX)) ctxt->sax->startDocument(ctxt->userData); /* * Doing validity checking on chunk doesn't make sense */ ctxt->instate = XML_PARSER_CONTENT; ctxt->validate = 0; ctxt->loadsubset = 0; ctxt->depth = 0; xmlParseContent(ctxt); if ((RAW == '<') && (NXT(1) == '/')) { xmlFatalErr(ctxt, XML_ERR_NOT_WELL_BALANCED, NULL); } else if (RAW != 0) { xmlFatalErr(ctxt, XML_ERR_EXTRA_CONTENT, NULL); } /* * SAX: end of the document processing. */ if ((ctxt->sax) && (ctxt->sax->endDocument != NULL)) ctxt->sax->endDocument(ctxt->userData); if (! ctxt->wellFormed) return(-1); return(0); } ",1 "void WebGLRenderingContextBase::linkProgram(WebGLProgram* program) { if (isContextLost() || !ValidateWebGLObject(""linkProgram"", program)) return; if (program->ActiveTransformFeedbackCount() > 0) { SynthesizeGLError( GL_INVALID_OPERATION, ""linkProgram"", ""program being used by one or more active transform feedback objects""); return; } ContextGL()->LinkProgram(ObjectOrZero(program)); program->IncreaseLinkCount(); } ",0 "void GDataFileSystem::OnGetFileCompleteForTransferFile( const FilePath& local_dest_file_path, const FileOperationCallback& callback, GDataFileError error, const FilePath& local_file_path, const std::string& unused_mime_type, GDataFileType file_type) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); if (error != GDATA_FILE_OK) { callback.Run(error); return; } GDataFileError* copy_file_error = new GDataFileError(GDATA_FILE_OK); util::PostBlockingPoolSequencedTaskAndReply( FROM_HERE, blocking_task_runner_, base::Bind(&CopyLocalFileOnBlockingPool, local_file_path, local_dest_file_path, copy_file_error), base::Bind(&RunFileOperationCallbackHelper, callback, base::Owned(copy_file_error))); } ",0 "long long mkvparser::GetUIntLength( IMkvReader* pReader, long long pos, long& len) { assert(pReader); assert(pos >= 0); long long total, available; int status = pReader->Length(&total, &available); assert(status >= 0); assert((total < 0) || (available <= total)); len = 1; if (pos >= available) return pos; //too few bytes available //// TODO(vigneshv): This function assumes that unsigned values never have their //// high bit set. unsigned char b; status = pReader->Read(pos, 1, &b); if (status < 0) return status; assert(status == 0); if (b == 0) //we can't handle u-int values larger than 8 bytes return E_FILE_FORMAT_INVALID; unsigned char m = 0x80; while (!(b & m)) { m >>= 1; ++len; } return 0; //success } ",1 "void *queue_get(struct queue *queue) { void *data; pthread_mutex_lock(&queue->mutex); while(queue->readp == queue->writep) pthread_cond_wait(&queue->empty, &queue->mutex); data = queue->data[queue->readp]; queue->readp = (queue->readp + 1) % queue->size; pthread_cond_signal(&queue->full); pthread_mutex_unlock(&queue->mutex); return data; } ",0 "void LayerTreeHostQt::setLayerFlushSchedulingEnabled(bool layerFlushingEnabled) { if (m_layerFlushSchedulingEnabled == layerFlushingEnabled) return; m_layerFlushSchedulingEnabled = layerFlushingEnabled; if (m_layerFlushSchedulingEnabled) { scheduleLayerFlush(); return; } cancelPendingLayerFlush(); } ",0 "void RenderWidgetHostViewAura::DidReceiveFrameFromRenderer() { if (frame_subscriber() && CanCopyToVideoFrame()) { const base::TimeTicks present_time = base::TimeTicks::Now(); scoped_refptr frame; RenderWidgetHostViewFrameSubscriber::DeliverFrameCallback callback; if (frame_subscriber()->ShouldCaptureFrame(present_time, &frame, &callback)) { CopyFromCompositingSurfaceToVideoFrame( gfx::Rect(current_frame_size_), frame, base::Bind(callback, present_time)); } } } ",0 "add_option(struct archive_read *a, struct mtree_option **global, const char *value, size_t len) { struct mtree_option *opt; if ((opt = malloc(sizeof(*opt))) == NULL) { archive_set_error(&a->archive, errno, ""Can't allocate memory""); return (ARCHIVE_FATAL); } if ((opt->value = malloc(len + 1)) == NULL) { free(opt); archive_set_error(&a->archive, errno, ""Can't allocate memory""); return (ARCHIVE_FATAL); } memcpy(opt->value, value, len); opt->value[len] = '\0'; opt->next = *global; *global = opt; return (ARCHIVE_OK); } ",0 "static inline dma_addr_t xhci_addr64(uint32_t low, uint32_t high) { if (sizeof(dma_addr_t) == 4) { return low; } else { return low | (((dma_addr_t)high << 16) << 16); } } ",0 "archive_read_support_format_iso9660(struct archive *_a) { struct archive_read *a = (struct archive_read *)_a; struct iso9660 *iso9660; int r; archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_NEW, ""archive_read_support_format_iso9660""); iso9660 = (struct iso9660 *)calloc(1, sizeof(*iso9660)); if (iso9660 == NULL) { archive_set_error(&a->archive, ENOMEM, ""Can't allocate iso9660 data""); return (ARCHIVE_FATAL); } iso9660->magic = ISO9660_MAGIC; iso9660->cache_files.first = NULL; iso9660->cache_files.last = &(iso9660->cache_files.first); iso9660->re_files.first = NULL; iso9660->re_files.last = &(iso9660->re_files.first); /* Enable to support Joliet extensions by default. */ iso9660->opt_support_joliet = 1; /* Enable to support Rock Ridge extensions by default. */ iso9660->opt_support_rockridge = 1; r = __archive_read_register_format(a, iso9660, ""iso9660"", archive_read_format_iso9660_bid, archive_read_format_iso9660_options, archive_read_format_iso9660_read_header, archive_read_format_iso9660_read_data, archive_read_format_iso9660_read_data_skip, NULL, archive_read_format_iso9660_cleanup, NULL, NULL); if (r != ARCHIVE_OK) { free(iso9660); return (r); } return (ARCHIVE_OK); } ",0 "static void specialuse_flags(const mbentry_t *mbentry, struct buf *attrib, int isxlist) { if (!mbentry) return; char *inbox = mboxname_user_mbox(imapd_userid, NULL); int inboxlen = strlen(inbox); /* doesn't match inbox, not xlistable */ if (strncmp(mbentry->name, inbox, inboxlen)) { free(inbox); return; } /* inbox - only print if command is XLIST */ if (mbentry->name[inboxlen] == '\0') { if (isxlist) buf_init_ro_cstr(attrib, ""\\Inbox""); } /* subdir */ else if (mbentry->name[inboxlen] == '.') { /* check if there's a special use flag set */ annotatemore_lookup(mbentry->name, ""/specialuse"", imapd_userid, attrib); } free(inbox); /* otherwise it's actually another user who matches for * the substr. Ok to just print nothing */ } ",0 "void RenderFrameHostImpl::DidSetFramePolicyHeaders( blink::WebSandboxFlags sandbox_flags, const blink::ParsedFeaturePolicy& parsed_header) { if (!is_active()) return; ResetFeaturePolicy(); feature_policy_->SetHeaderPolicy(parsed_header); frame_tree_node()->UpdateFramePolicyHeaders(sandbox_flags, parsed_header); active_sandbox_flags_ = frame_tree_node()->active_sandbox_flags(); } ",0 " void ChromeContentBrowserClient::OpenURL( content::BrowserContext* browser_context, const content::OpenURLParams& params, const base::Callback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); #if defined(OS_ANDROID) ServiceTabLauncher::GetInstance()->LaunchTab(browser_context, params, callback); #else NavigateParams nav_params(Profile::FromBrowserContext(browser_context), params.url, params.transition); nav_params.FillNavigateParamsFromOpenURLParams(params); nav_params.user_gesture = params.user_gesture; Navigate(&nav_params); callback.Run(nav_params.navigated_or_inserted_contents); #endif } ",1 " cf2_hint_isValid( const CF2_Hint hint ) { return (FT_Bool)( hint->flags != 0 ); } ",0 "void BrowserRenderProcessHost::AppendRendererCommandLine( CommandLine* command_line) const { command_line->AppendSwitchASCII(switches::kProcessType, is_extension_process_ ? switches::kExtensionProcess : switches::kRendererProcess); if (accessibility_enabled_) command_line->AppendSwitch(switches::kEnableAccessibility); const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); PropagateBrowserCommandLineToRenderer(browser_command_line, command_line); const std::string locale = content::GetContentClient()->browser()->GetApplicationLocale(); command_line->AppendSwitchASCII(switches::kLang, locale); std::string field_trial_states; base::FieldTrialList::StatesToString(&field_trial_states); if (!field_trial_states.empty()) { command_line->AppendSwitchASCII(switches::kForceFieldTestNameAndValue, field_trial_states); } content::GetContentClient()->browser()->AppendExtraCommandLineSwitches( command_line, id()); GpuDataManager* gpu_data_manager = GpuDataManager::GetInstance(); DCHECK(gpu_data_manager); gpu_data_manager->AppendRendererCommandLine(command_line); } ",0 "SPL_METHOD(Array, getFlags) { zval *object = getThis(); spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); if (zend_parse_parameters_none() == FAILURE) { return; } RETURN_LONG(intern->ar_flags & ~SPL_ARRAY_INT_MASK); } ",0 " bool AddInitialUrlToPreconnectPrediction(const GURL& initial_url, PreconnectPrediction* prediction) { GURL initial_origin = initial_url.GetOrigin(); static const int kMinSockets = 2; if (!prediction->requests.empty() && prediction->requests.front().origin == initial_origin) { prediction->requests.front().num_sockets = std::max(prediction->requests.front().num_sockets, kMinSockets); } else if (initial_origin.is_valid() && initial_origin.SchemeIsHTTPOrHTTPS()) { url::Origin origin = url::Origin::Create(initial_origin); prediction->requests.emplace(prediction->requests.begin(), initial_origin, kMinSockets, net::NetworkIsolationKey(origin, origin)); } return !prediction->requests.empty(); } ",1 "static int kvm_fetch_guest_virt(struct x86_emulate_ctxt *ctxt, gva_t addr, void *val, unsigned int bytes, struct x86_exception *exception) { struct kvm_vcpu *vcpu = emul_to_vcpu(ctxt); u32 access = (kvm_x86_ops->get_cpl(vcpu) == 3) ? PFERR_USER_MASK : 0; return kvm_read_guest_virt_helper(addr, val, bytes, vcpu, access | PFERR_FETCH_MASK, exception); } ",0 "void Splash::setFillOverprint(GBool fop) { state->fillOverprint = fop; } ",0 "void NavigationControllerImpl::CancelPendingReload() { DCHECK(pending_reload_ != ReloadType::NONE); pending_reload_ = ReloadType::NONE; } ",0 "SYSCALL_DEFINE5(add_key, const char __user *, _type, const char __user *, _description, const void __user *, _payload, size_t, plen, key_serial_t, ringid) { key_ref_t keyring_ref, key_ref; char type[32], *description; void *payload; long ret; ret = -EINVAL; if (plen > 1024 * 1024 - 1) goto error; /* draw all the data into kernel space */ ret = key_get_type_from_user(type, _type, sizeof(type)); if (ret < 0) goto error; description = NULL; if (_description) { description = strndup_user(_description, KEY_MAX_DESC_SIZE); if (IS_ERR(description)) { ret = PTR_ERR(description); goto error; } if (!*description) { kfree(description); description = NULL; } else if ((description[0] == '.') && (strncmp(type, ""keyring"", 7) == 0)) { ret = -EPERM; goto error2; } } /* pull the payload in if one was supplied */ payload = NULL; if (plen) { ret = -ENOMEM; payload = kvmalloc(plen, GFP_KERNEL); if (!payload) goto error2; ret = -EFAULT; if (copy_from_user(payload, _payload, plen) != 0) goto error3; } /* find the target keyring (which must be writable) */ keyring_ref = lookup_user_key(ringid, KEY_LOOKUP_CREATE, KEY_NEED_WRITE); if (IS_ERR(keyring_ref)) { ret = PTR_ERR(keyring_ref); goto error3; } /* create or update the requested key and add it to the target * keyring */ key_ref = key_create_or_update(keyring_ref, type, description, payload, plen, KEY_PERM_UNDEF, KEY_ALLOC_IN_QUOTA); if (!IS_ERR(key_ref)) { ret = key_ref_to_ptr(key_ref)->serial; key_ref_put(key_ref); } else { ret = PTR_ERR(key_ref); } key_ref_put(keyring_ref); error3: if (payload) { memzero_explicit(payload, plen); kvfree(payload); } error2: kfree(description); error: return ret; } ",0 "bool PrintWebViewHelper::PreviewPageRendered(int page_number, printing::Metafile* metafile) { DCHECK_GE(page_number, printing::FIRST_PAGE_INDEX); if (!print_preview_context_.IsModifiable() || !print_preview_context_.generate_draft_pages()) { DCHECK(!metafile); return true; } if (!metafile) { NOTREACHED(); print_preview_context_.set_error( PREVIEW_ERROR_PAGE_RENDERED_WITHOUT_METAFILE); return false; } PrintHostMsg_DidPreviewPage_Params preview_page_params; uint32 buf_size = metafile->GetDataSize(); DCHECK_GT(buf_size, 0u); if (!CopyMetafileDataToSharedMem( metafile, &(preview_page_params.metafile_data_handle))) { LOG(ERROR) << ""CopyMetafileDataToSharedMem failed""; print_preview_context_.set_error(PREVIEW_ERROR_METAFILE_COPY_FAILED); return false; } preview_page_params.data_size = buf_size; preview_page_params.page_number = page_number; preview_page_params.preview_request_id = print_pages_params_->params.preview_request_id; Send(new PrintHostMsg_DidPreviewPage(routing_id(), preview_page_params)); return true; } ",0 "struct aac_driver_ident* aac_get_driver_ident(int devtype) { return &aac_drivers[devtype]; } ",0 "MagickExport MagickBooleanType RandomThresholdImageChannel(Image *image, const ChannelType channel,const char *thresholds,ExceptionInfo *exception) { #define ThresholdImageTag ""Threshold/Image"" CacheView *image_view; GeometryInfo geometry_info; MagickStatusType flags; MagickBooleanType status; MagickOffsetType progress; MagickPixelPacket threshold; MagickRealType min_threshold, max_threshold; RandomInfo **magick_restrict random_info; ssize_t y; #if defined(MAGICKCORE_OPENMP_SUPPORT) unsigned long key; #endif assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"",image->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); if (thresholds == (const char *) NULL) return(MagickTrue); GetMagickPixelPacket(image,&threshold); min_threshold=0.0; max_threshold=(MagickRealType) QuantumRange; flags=ParseGeometry(thresholds,&geometry_info); min_threshold=geometry_info.rho; max_threshold=geometry_info.sigma; if ((flags & SigmaValue) == 0) max_threshold=min_threshold; if (strchr(thresholds,'%') != (char *) NULL) { max_threshold*=(MagickRealType) (0.01*QuantumRange); min_threshold*=(MagickRealType) (0.01*QuantumRange); } else if (((max_threshold == min_threshold) || (max_threshold == 1)) && (min_threshold <= 8)) { /* Backward Compatibility -- ordered-dither -- IM v 6.2.9-6. */ status=OrderedPosterizeImageChannel(image,channel,thresholds,exception); return(status); } /* Random threshold image. */ status=MagickTrue; progress=0; if (channel == CompositeChannels) { if (AcquireImageColormap(image,2) == MagickFalse) ThrowBinaryException(ResourceLimitError,""MemoryAllocationFailed"", image->filename); random_info=AcquireRandomInfoThreadSet(); image_view=AcquireAuthenticCacheView(image,exception); #if defined(MAGICKCORE_OPENMP_SUPPORT) key=GetRandomSecretKey(random_info[0]); #pragma omp parallel for schedule(static) shared(progress,status) \ magick_number_threads(image,image,image->rows,key == ~0UL) #endif for (y=0; y < (ssize_t) image->rows; y++) { const int id = GetOpenMPThreadId(); MagickBooleanType sync; register IndexPacket *magick_restrict indexes; register ssize_t x; register PixelPacket *magick_restrict q; if (status == MagickFalse) continue; q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1, exception); if (q == (PixelPacket *) NULL) { status=MagickFalse; continue; } indexes=GetCacheViewAuthenticIndexQueue(image_view); for (x=0; x < (ssize_t) image->columns; x++) { IndexPacket index; MagickRealType intensity; intensity=GetPixelIntensity(image,q); if (intensity < min_threshold) threshold.index=min_threshold; else if (intensity > max_threshold) threshold.index=max_threshold; else threshold.index=(MagickRealType)(QuantumRange* GetPseudoRandomValue(random_info[id])); index=(IndexPacket) (intensity <= threshold.index ? 0 : 1); SetPixelIndex(indexes+x,index); SetPixelRGBO(q,image->colormap+(ssize_t) index); q++; } sync=SyncCacheViewAuthenticPixels(image_view,exception); if (sync == MagickFalse) status=MagickFalse; if (image->progress_monitor != (MagickProgressMonitor) NULL) { MagickBooleanType proceed; #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp atomic #endif progress++; proceed=SetImageProgress(image,ThresholdImageTag,progress, image->rows); if (proceed == MagickFalse) status=MagickFalse; } } image_view=DestroyCacheView(image_view); random_info=DestroyRandomInfoThreadSet(random_info); return(status); } if (SetImageStorageClass(image,DirectClass) == MagickFalse) { InheritException(exception,&image->exception); return(MagickFalse); } random_info=AcquireRandomInfoThreadSet(); image_view=AcquireAuthenticCacheView(image,exception); #if defined(MAGICKCORE_OPENMP_SUPPORT) key=GetRandomSecretKey(random_info[0]); #pragma omp parallel for schedule(static) shared(progress,status) \ magick_number_threads(image,image,image->rows,key == ~0UL) #endif for (y=0; y < (ssize_t) image->rows; y++) { const int id = GetOpenMPThreadId(); register IndexPacket *magick_restrict indexes; register PixelPacket *magick_restrict q; register ssize_t x; if (status == MagickFalse) continue; q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception); if (q == (PixelPacket *) NULL) { status=MagickFalse; continue; } indexes=GetCacheViewAuthenticIndexQueue(image_view); for (x=0; x < (ssize_t) image->columns; x++) { if ((channel & RedChannel) != 0) { if ((MagickRealType) GetPixelRed(q) < min_threshold) threshold.red=min_threshold; else if ((MagickRealType) GetPixelRed(q) > max_threshold) threshold.red=max_threshold; else threshold.red=(MagickRealType) (QuantumRange* GetPseudoRandomValue(random_info[id])); } if ((channel & GreenChannel) != 0) { if ((MagickRealType) GetPixelGreen(q) < min_threshold) threshold.green=min_threshold; else if ((MagickRealType) GetPixelGreen(q) > max_threshold) threshold.green=max_threshold; else threshold.green=(MagickRealType) (QuantumRange* GetPseudoRandomValue(random_info[id])); } if ((channel & BlueChannel) != 0) { if ((MagickRealType) GetPixelBlue(q) < min_threshold) threshold.blue=min_threshold; else if ((MagickRealType) GetPixelBlue(q) > max_threshold) threshold.blue=max_threshold; else threshold.blue=(MagickRealType) (QuantumRange* GetPseudoRandomValue(random_info[id])); } if ((channel & OpacityChannel) != 0) { if ((MagickRealType) GetPixelOpacity(q) < min_threshold) threshold.opacity=min_threshold; else if ((MagickRealType) GetPixelOpacity(q) > max_threshold) threshold.opacity=max_threshold; else threshold.opacity=(MagickRealType) (QuantumRange* GetPseudoRandomValue(random_info[id])); } if (((channel & IndexChannel) != 0) && (image->colorspace == CMYKColorspace)) { if ((MagickRealType) GetPixelIndex(indexes+x) < min_threshold) threshold.index=min_threshold; else if ((MagickRealType) GetPixelIndex(indexes+x) > max_threshold) threshold.index=max_threshold; else threshold.index=(MagickRealType) (QuantumRange* GetPseudoRandomValue(random_info[id])); } if ((channel & RedChannel) != 0) SetPixelRed(q,(MagickRealType) GetPixelRed(q) <= threshold.red ? 0 : QuantumRange); if ((channel & GreenChannel) != 0) SetPixelGreen(q,(MagickRealType) GetPixelGreen(q) <= threshold.green ? 0 : QuantumRange); if ((channel & BlueChannel) != 0) SetPixelBlue(q,(MagickRealType) GetPixelBlue(q) <= threshold.blue ? 0 : QuantumRange); if ((channel & OpacityChannel) != 0) SetPixelOpacity(q,(MagickRealType) GetPixelOpacity(q) <= threshold.opacity ? 0 : QuantumRange); if (((channel & IndexChannel) != 0) && (image->colorspace == CMYKColorspace)) SetPixelIndex(indexes+x,(MagickRealType) GetPixelIndex(indexes+x) <= threshold.index ? 0 : QuantumRange); q++; } if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse) status=MagickFalse; if (image->progress_monitor != (MagickProgressMonitor) NULL) { MagickBooleanType proceed; #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp atomic #endif progress++; proceed=SetImageProgress(image,ThresholdImageTag,progress,image->rows); if (proceed == MagickFalse) status=MagickFalse; } } image_view=DestroyCacheView(image_view); random_info=DestroyRandomInfoThreadSet(random_info); return(status); } ",0 "int kvm_write_guest_virt_system(struct x86_emulate_ctxt *ctxt, gva_t addr, void *val, unsigned int bytes, struct x86_exception *exception) { struct kvm_vcpu *vcpu = emul_to_vcpu(ctxt); void *data = val; int r = X86EMUL_CONTINUE; while (bytes) { gpa_t gpa = vcpu->arch.walk_mmu->gva_to_gpa(vcpu, addr, PFERR_WRITE_MASK, exception); unsigned offset = addr & (PAGE_SIZE-1); unsigned towrite = min(bytes, (unsigned)PAGE_SIZE - offset); int ret; if (gpa == UNMAPPED_GVA) return X86EMUL_PROPAGATE_FAULT; ret = kvm_vcpu_write_guest(vcpu, gpa, data, towrite); if (ret < 0) { r = X86EMUL_IO_NEEDED; goto out; } bytes -= towrite; data += towrite; addr += towrite; } out: return r; } ",0 "PassRefPtr HTMLDocument::cloneDocumentWithoutChildren() { return create(DocumentInit(url()).withRegistrationContext(registrationContext())); } ",0 "int nlmsg_get_proto(struct nl_msg *msg) { return msg->nm_protocol; } ",0 "PDFiumPage::Area PDFiumEngine::GetCharIndex(const pp::Point& point, int* page_index, int* char_index, int* form_type, PDFiumPage::LinkTarget* target) { int page = -1; pp::Point point_in_page( static_cast((point.x() + position_.x()) / current_zoom_), static_cast((point.y() + position_.y()) / current_zoom_)); for (int visible_page : visible_pages_) { if (pages_[visible_page]->rect().Contains(point_in_page)) { page = visible_page; break; } } if (page == -1) return PDFiumPage::NONSELECTABLE_AREA; for (const auto& paint : progressive_paints_) { if (paint.page_index == page) return PDFiumPage::NONSELECTABLE_AREA; } *page_index = page; return pages_[page]->GetCharIndex( point_in_page, current_rotation_, char_index, form_type, target); } ",0 "BinaryUploadService::BinaryUploadService( scoped_refptr url_loader_factory, Profile* profile) : url_loader_factory_(url_loader_factory), binary_fcm_service_(BinaryFCMService::Create(profile)), weakptr_factory_(this) {} ",0 "static handle_t *ocfs2_zero_start_ordered_transaction(struct inode *inode, struct buffer_head *di_bh) { struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); handle_t *handle = NULL; int ret = 0; if (!ocfs2_should_order_data(inode)) goto out; handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); if (IS_ERR(handle)) { ret = -ENOMEM; mlog_errno(ret); goto out; } ret = ocfs2_jbd2_file_inode(handle, inode); if (ret < 0) { mlog_errno(ret); goto out; } ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode), di_bh, OCFS2_JOURNAL_ACCESS_WRITE); if (ret) mlog_errno(ret); ocfs2_update_inode_fsync_trans(handle, inode, 1); out: if (ret) { if (!IS_ERR(handle)) ocfs2_commit_trans(osb, handle); handle = ERR_PTR(ret); } return handle; } ",0 "static inline void sched_submit_work(struct task_struct *tsk) { if (!tsk->state || tsk_is_pi_blocked(tsk)) return; /* * If we are going to sleep and we have plugged IO queued, * make sure to submit it to avoid deadlocks. */ if (blk_needs_flush_plug(tsk)) blk_schedule_flush_plug(tsk); } ",0 "xmlParseDTD(const xmlChar *ExternalID, const xmlChar *SystemID) { return(xmlSAXParseDTD(NULL, ExternalID, SystemID)); } ",0 "void ExtensionGlobalError::set_cancel_callback( ExtensionGlobalErrorCallback callback) { cancel_callback_ = callback; } ",0 "void DefragTrackerFree(DefragTracker *dt) { if (dt != NULL) { DefragTrackerClearMemory(dt); SCMutexDestroy(&dt->lock); SCFree(dt); (void) SC_ATOMIC_SUB(defrag_memuse, sizeof(DefragTracker)); } } ",0 "bool SharedMemory::Open(const std::string& name, bool read_only) { FilePath path; if (!FilePathForMemoryName(name, &path)) return false; read_only_ = read_only; const char *mode = read_only ? ""r"" : ""r+""; FILE *fp = file_util::OpenFile(path, mode); return PrepareMapFile(fp); } ",0 "bool IsAutoReloadEnabled() { const base::CommandLine& browser_command_line = *base::CommandLine::ForCurrentProcess(); if (browser_command_line.HasSwitch(switches::kEnableOfflineAutoReload)) return true; if (browser_command_line.HasSwitch(switches::kDisableOfflineAutoReload)) return false; return true; } ",0 "static int migrate_to_node(struct mm_struct *mm, int source, int dest, int flags) { nodemask_t nmask; LIST_HEAD(pagelist); int err = 0; nodes_clear(nmask); node_set(source, nmask); /* * This does not ""check"" the range but isolates all pages that * need migration. Between passing in the full user address * space range and MPOL_MF_DISCONTIG_OK, this call can not fail. */ VM_BUG_ON(!(flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL))); queue_pages_range(mm, mm->mmap->vm_start, mm->task_size, &nmask, flags | MPOL_MF_DISCONTIG_OK, &pagelist); if (!list_empty(&pagelist)) { err = migrate_pages(&pagelist, new_node_page, NULL, dest, MIGRATE_SYNC, MR_SYSCALL); if (err) putback_movable_pages(&pagelist); } return err; } ",0 "ns_nskip(netdissect_options *ndo, register const u_char *cp) { register u_char i; if (!ND_TTEST2(*cp, 1)) return (NULL); i = *cp++; while (i) { if ((i & INDIR_MASK) == INDIR_MASK) return (cp + 1); if ((i & INDIR_MASK) == EDNS0_MASK) { int bitlen, bytelen; if ((i & ~INDIR_MASK) != EDNS0_ELT_BITLABEL) return(NULL); /* unknown ELT */ if (!ND_TTEST2(*cp, 1)) return (NULL); if ((bitlen = *cp++) == 0) bitlen = 256; bytelen = (bitlen + 7) / 8; cp += bytelen; } else cp += i; if (!ND_TTEST2(*cp, 1)) return (NULL); i = *cp++; } return (cp); } ",0 "static int get_cox(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c) { uint8_t byte; if (bytestream2_get_bytes_left(&s->g) < 5) return AVERROR_INVALIDDATA; /* nreslevels = number of resolution levels = number of decomposition level +1 */ c->nreslevels = bytestream2_get_byteu(&s->g) + 1; if (c->nreslevels >= JPEG2000_MAX_RESLEVELS) { av_log(s->avctx, AV_LOG_ERROR, ""nreslevels %d is invalid\n"", c->nreslevels); return AVERROR_INVALIDDATA; } /* compute number of resolution levels to decode */ if (c->nreslevels < s->reduction_factor) c->nreslevels2decode = 1; else c->nreslevels2decode = c->nreslevels - s->reduction_factor; c->log2_cblk_width = (bytestream2_get_byteu(&s->g) & 15) + 2; // cblk width c->log2_cblk_height = (bytestream2_get_byteu(&s->g) & 15) + 2; // cblk height if (c->log2_cblk_width > 10 || c->log2_cblk_height > 10 || c->log2_cblk_width + c->log2_cblk_height > 12) { av_log(s->avctx, AV_LOG_ERROR, ""cblk size invalid\n""); return AVERROR_INVALIDDATA; } c->cblk_style = bytestream2_get_byteu(&s->g); if (c->cblk_style != 0) { // cblk style av_log(s->avctx, AV_LOG_WARNING, ""extra cblk styles %X\n"", c->cblk_style); } c->transform = bytestream2_get_byteu(&s->g); // DWT transformation type /* set integer 9/7 DWT in case of BITEXACT flag */ if ((s->avctx->flags & CODEC_FLAG_BITEXACT) && (c->transform == FF_DWT97)) c->transform = FF_DWT97_INT; if (c->csty & JPEG2000_CSTY_PREC) { int i; for (i = 0; i < c->nreslevels; i++) { byte = bytestream2_get_byte(&s->g); c->log2_prec_widths[i] = byte & 0x0F; // precinct PPx c->log2_prec_heights[i] = (byte >> 4) & 0x0F; // precinct PPy } } else { memset(c->log2_prec_widths , 15, sizeof(c->log2_prec_widths )); memset(c->log2_prec_heights, 15, sizeof(c->log2_prec_heights)); } return 0; } ",0 "static int do_decode(AVCodecContext *avctx, AVPacket *pkt) { int got_frame; int ret; av_assert0(!avctx->internal->buffer_frame->buf[0]); if (!pkt) pkt = avctx->internal->buffer_pkt; avctx->refcounted_frames = 1; if (avctx->internal->draining_done) return AVERROR_EOF; if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) { ret = avcodec_decode_video2(avctx, avctx->internal->buffer_frame, &got_frame, pkt); if (ret >= 0 && !(avctx->flags & AV_CODEC_FLAG_TRUNCATED)) ret = pkt->size; } else if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) { ret = avcodec_decode_audio4(avctx, avctx->internal->buffer_frame, &got_frame, pkt); } else { ret = AVERROR(EINVAL); } if (ret == AVERROR(EAGAIN)) ret = pkt->size; if (ret < 0) return ret; if (avctx->internal->draining && !got_frame) avctx->internal->draining_done = 1; if (ret >= pkt->size) { av_packet_unref(avctx->internal->buffer_pkt); } else { int consumed = ret; if (pkt != avctx->internal->buffer_pkt) { av_packet_unref(avctx->internal->buffer_pkt); if ((ret = av_packet_ref(avctx->internal->buffer_pkt, pkt)) < 0) return ret; } avctx->internal->buffer_pkt->data += consumed; avctx->internal->buffer_pkt->size -= consumed; avctx->internal->buffer_pkt->pts = AV_NOPTS_VALUE; avctx->internal->buffer_pkt->dts = AV_NOPTS_VALUE; } if (got_frame) av_assert0(avctx->internal->buffer_frame->buf[0]); return 0; } ",0 "static int pmcraid_slave_alloc(struct scsi_device *scsi_dev) { struct pmcraid_resource_entry *temp, *res = NULL; struct pmcraid_instance *pinstance; u8 target, bus, lun; unsigned long lock_flags; int rc = -ENXIO; u16 fw_version; pinstance = shost_priv(scsi_dev->host); fw_version = be16_to_cpu(pinstance->inq_data->fw_version); /* Driver exposes VSET and GSCSI resources only; all other device types * are not exposed. Resource list is synchronized using resource lock * so any traversal or modifications to the list should be done inside * this lock */ spin_lock_irqsave(&pinstance->resource_lock, lock_flags); list_for_each_entry(temp, &pinstance->used_res_q, queue) { /* do not expose VSETs with order-ids > MAX_VSET_TARGETS */ if (RES_IS_VSET(temp->cfg_entry)) { if (fw_version <= PMCRAID_FW_VERSION_1) target = temp->cfg_entry.unique_flags1; else target = temp->cfg_entry.array_id & 0xFF; if (target > PMCRAID_MAX_VSET_TARGETS) continue; bus = PMCRAID_VSET_BUS_ID; lun = 0; } else if (RES_IS_GSCSI(temp->cfg_entry)) { target = RES_TARGET(temp->cfg_entry.resource_address); bus = PMCRAID_PHYS_BUS_ID; lun = RES_LUN(temp->cfg_entry.resource_address); } else { continue; } if (bus == scsi_dev->channel && target == scsi_dev->id && lun == scsi_dev->lun) { res = temp; break; } } if (res) { res->scsi_dev = scsi_dev; scsi_dev->hostdata = res; res->change_detected = 0; atomic_set(&res->read_failures, 0); atomic_set(&res->write_failures, 0); rc = 0; } spin_unlock_irqrestore(&pinstance->resource_lock, lock_flags); return rc; } ",0 "void DefaultBindingsDelegate::ActivateWindow() { web_contents_->GetDelegate()->ActivateContents(web_contents_); web_contents_->Focus(); } ",0 "static int fuse_setlk(struct file *file, struct file_lock *fl, int flock) { struct inode *inode = file->f_path.dentry->d_inode; struct fuse_conn *fc = get_fuse_conn(inode); struct fuse_req *req; int opcode = (fl->fl_flags & FL_SLEEP) ? FUSE_SETLKW : FUSE_SETLK; pid_t pid = fl->fl_type != F_UNLCK ? current->tgid : 0; int err; if (fl->fl_lmops && fl->fl_lmops->fl_grant) { /* NLM needs asynchronous locks, which we don't support yet */ return -ENOLCK; } /* Unlock on close is handled by the flush method */ if (fl->fl_flags & FL_CLOSE) return 0; req = fuse_get_req(fc); if (IS_ERR(req)) return PTR_ERR(req); fuse_lk_fill(req, file, fl, opcode, pid, flock); fuse_request_send(fc, req); err = req->out.h.error; /* locking is restartable */ if (err == -EINTR) err = -ERESTARTSYS; fuse_put_request(fc, req); return err; } ",0 "static void ZSTD_reduceTable_btlazy2(U32* const table, U32 const size, U32 const reducerValue) { ZSTD_reduceTable_internal(table, size, reducerValue, 1); } ",0 " const MidiPortInfoList& output_ports() { return client_->output_ports_; } ",0 " static void Ins_IDEF( INS_ARG ) { if (CUR.countIDefs >= CUR.numIDefs || args[0] > 255) CUR.error = TT_Err_Storage_Overflow; else { PDefRecord pTDR; CUR.IDefPtr[(Byte)(args[0])] = CUR.countIDefs; pTDR = &CUR.IDefs[CUR.countIDefs++]; pTDR->Opc = (Byte)(args[0]); pTDR->Start = CUR.IP + 1; pTDR->Range = CUR.curRange; pTDR->Active = TRUE; skip_FDEF(EXEC_ARG); } } ",0 "void PaymentRequestState::FinishedGetAllSWPaymentInstruments() { PopulateProfileCache(); SetDefaultProfileSelections(); get_all_instruments_finished_ = true; are_requested_methods_supported_ |= !available_instruments_.empty(); NotifyOnGetAllPaymentInstrumentsFinished(); NotifyInitialized(); if (can_make_payment_callback_) { CheckCanMakePayment(can_make_payment_legacy_mode_, std::move(can_make_payment_callback_)); } if (has_enrolled_instrument_callback_) CheckHasEnrolledInstrument(std::move(has_enrolled_instrument_callback_)); if (are_requested_methods_supported_callback_) CheckRequestedMethodsSupported( std::move(are_requested_methods_supported_callback_)); } ",0 " void RunScrollbarThumbDragLatencyTest() { #if !defined(OS_ANDROID) blink::WebFloatPoint scrollbar_thumb(795, 30); blink::WebMouseEvent mouse_down = SyntheticWebMouseEventBuilder::Build( blink::WebInputEvent::kMouseDown, scrollbar_thumb.x, scrollbar_thumb.y, 0); mouse_down.button = blink::WebMouseEvent::Button::kLeft; mouse_down.SetTimeStamp(base::TimeTicks::Now()); GetWidgetHost()->ForwardMouseEvent(mouse_down); blink::WebMouseEvent mouse_move = SyntheticWebMouseEventBuilder::Build( blink::WebInputEvent::kMouseMove, scrollbar_thumb.x, scrollbar_thumb.y + 10, 0); mouse_move.button = blink::WebMouseEvent::Button::kLeft; mouse_move.SetTimeStamp(base::TimeTicks::Now()); GetWidgetHost()->ForwardMouseEvent(mouse_move); RunUntilInputProcessed(GetWidgetHost()); mouse_move.SetPositionInWidget(scrollbar_thumb.x, scrollbar_thumb.y + 20); mouse_move.SetPositionInScreen(scrollbar_thumb.x, scrollbar_thumb.y + 20); GetWidgetHost()->ForwardMouseEvent(mouse_move); RunUntilInputProcessed(GetWidgetHost()); blink::WebMouseEvent mouse_up = SyntheticWebMouseEventBuilder::Build( blink::WebInputEvent::kMouseUp, scrollbar_thumb.x, scrollbar_thumb.y + 20, 0); mouse_up.button = blink::WebMouseEvent::Button::kLeft; mouse_up.SetTimeStamp(base::TimeTicks::Now()); GetWidgetHost()->ForwardMouseEvent(mouse_up); RunUntilInputProcessed(GetWidgetHost()); FetchHistogramsFromChildProcesses(); const std::string scroll_types[] = {""ScrollBegin"", ""ScrollUpdate""}; for (const std::string& scroll_type : scroll_types) { EXPECT_TRUE(VerifyRecordedSamplesForHistogram( 1, ""Event.Latency."" + scroll_type + "".Scrollbar.TimeToScrollUpdateSwapBegin4"")); EXPECT_TRUE(VerifyRecordedSamplesForHistogram( 1, ""Event.Latency."" + scroll_type + "".Scrollbar.RendererSwapToBrowserNotified2"")); EXPECT_TRUE(VerifyRecordedSamplesForHistogram( 1, ""Event.Latency."" + scroll_type + "".Scrollbar.BrowserNotifiedToBeforeGpuSwap2"")); EXPECT_TRUE(VerifyRecordedSamplesForHistogram( 1, ""Event.Latency."" + scroll_type + "".Scrollbar.GpuSwap2"")); std::string thread_name = DoesScrollbarScrollOnMainThread() ? ""Main"" : ""Impl""; EXPECT_TRUE(VerifyRecordedSamplesForHistogram( 1, ""Event.Latency."" + scroll_type + "".Scrollbar.TimeToHandled2_"" + thread_name)); EXPECT_TRUE(VerifyRecordedSamplesForHistogram( 1, ""Event.Latency."" + scroll_type + "".Scrollbar.HandledToRendererSwap2_"" + thread_name)); } #endif // !defined(OS_ANDROID) } ",1 "static void ehci_trace_guest_bug(EHCIState *s, const char *message) { trace_usb_ehci_guest_bug(message); fprintf(stderr, ""ehci warning: %s\n"", message); } ",0 "void AwContents::PreauthorizePermission( JNIEnv* env, jobject obj, jstring origin, jlong resources) { permission_request_handler_->PreauthorizePermission( GURL(base::android::ConvertJavaStringToUTF8(env, origin)), resources); } ",0 "void AXObjectCacheImpl::didShowMenuListPopup(LayoutMenuList* menuList) { AXObject* obj = get(menuList); if (!obj || !obj->isMenuList()) return; toAXMenuList(obj)->didShowPopup(); } ",0 "static int decode_renew(struct xdr_stream *xdr) { return decode_op_hdr(xdr, OP_RENEW); } ",0 "map_engine_on_update(script_t* script) { script_unref(s_update_script); s_update_script = script_ref(script); } ",0 " ~FragmentPaintPropertyTreeBuilder() { full_context_.force_subtree_update |= property_added_or_removed_; #if DCHECK_IS_ON() if (properties_) PaintPropertyTreePrinter::UpdateDebugNames(object_, *properties_); #endif } ",0 "XFreeFontPath (char **list) { if (list != NULL) { Xfree (list[0]-1); Xfree (list); } return 1; } ",0 "pvscsi_build_sglist(PVSCSIState *s, PVSCSIRequest *r) { PCIDevice *d = PCI_DEVICE(s); pci_dma_sglist_init(&r->sgl, d, 1); if (r->req.flags & PVSCSI_FLAG_CMD_WITH_SG_LIST) { pvscsi_convert_sglist(r); } else { qemu_sglist_add(&r->sgl, r->req.dataAddr, r->req.dataLen); } } ",0 "static void rekey_seq_generator(struct work_struct *work) { struct keydata *keyptr = &ip_keydata[1 ^ (ip_cnt & 1)]; get_random_bytes(keyptr->secret, sizeof(keyptr->secret)); keyptr->count = (ip_cnt & COUNT_MASK) << HASH_BITS; smp_wmb(); ip_cnt++; schedule_delayed_work(&rekey_work, round_jiffies_relative(REKEY_INTERVAL)); } ",1 "static int scsi_get_bus(struct request_queue *q, int __user *p) { return put_user(0, p); } ",0 "void btif_rc_handler(tBTA_AV_EVT event, tBTA_AV *p_data) { BTIF_TRACE_DEBUG (""%s event:%s"", __FUNCTION__, dump_rc_event(event)); switch (event) { case BTA_AV_RC_OPEN_EVT: { BTIF_TRACE_DEBUG(""Peer_features:%x"", p_data->rc_open.peer_features); handle_rc_connect( &(p_data->rc_open) ); }break; case BTA_AV_RC_CLOSE_EVT: { handle_rc_disconnect( &(p_data->rc_close) ); }break; case BTA_AV_REMOTE_CMD_EVT: { BTIF_TRACE_DEBUG(""rc_id:0x%x key_state:%d"", p_data->remote_cmd.rc_id, p_data->remote_cmd.key_state); handle_rc_passthrough_cmd( (&p_data->remote_cmd) ); } break; #if (AVRC_CTLR_INCLUDED == TRUE) case BTA_AV_REMOTE_RSP_EVT: { BTIF_TRACE_DEBUG(""RSP: rc_id:0x%x key_state:%d"", p_data->remote_rsp.rc_id, p_data->remote_rsp.key_state); handle_rc_passthrough_rsp( (&p_data->remote_rsp) ); } break; #endif case BTA_AV_RC_FEAT_EVT: { BTIF_TRACE_DEBUG(""Peer_features:%x"", p_data->rc_feat.peer_features); btif_rc_cb.rc_features = p_data->rc_feat.peer_features; handle_rc_features(); } break; case BTA_AV_META_MSG_EVT: { BTIF_TRACE_DEBUG(""BTA_AV_META_MSG_EVT code:%d label:%d"", p_data->meta_msg.code, p_data->meta_msg.label); BTIF_TRACE_DEBUG("" company_id:0x%x len:%d handle:%d"", p_data->meta_msg.company_id, p_data->meta_msg.len, p_data->meta_msg.rc_handle); /* handle the metamsg command */ handle_rc_metamsg_cmd(&(p_data->meta_msg)); } break; default: BTIF_TRACE_DEBUG(""Unhandled RC event : 0x%x"", event); } } ",0 "static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle) { struct nfs4_server_caps_arg args = { .fhandle = fhandle, }; struct nfs4_server_caps_res res = {}; struct rpc_message msg = { .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_SERVER_CAPS], .rpc_argp = &args, .rpc_resp = &res, }; int status; status = nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0); if (status == 0) { memcpy(server->attr_bitmask, res.attr_bitmask, sizeof(server->attr_bitmask)); server->caps &= ~(NFS_CAP_ACLS|NFS_CAP_HARDLINKS| NFS_CAP_SYMLINKS|NFS_CAP_FILEID| NFS_CAP_MODE|NFS_CAP_NLINK|NFS_CAP_OWNER| NFS_CAP_OWNER_GROUP|NFS_CAP_ATIME| NFS_CAP_CTIME|NFS_CAP_MTIME); if (res.attr_bitmask[0] & FATTR4_WORD0_ACL) server->caps |= NFS_CAP_ACLS; if (res.has_links != 0) server->caps |= NFS_CAP_HARDLINKS; if (res.has_symlinks != 0) server->caps |= NFS_CAP_SYMLINKS; if (res.attr_bitmask[0] & FATTR4_WORD0_FILEID) server->caps |= NFS_CAP_FILEID; if (res.attr_bitmask[1] & FATTR4_WORD1_MODE) server->caps |= NFS_CAP_MODE; if (res.attr_bitmask[1] & FATTR4_WORD1_NUMLINKS) server->caps |= NFS_CAP_NLINK; if (res.attr_bitmask[1] & FATTR4_WORD1_OWNER) server->caps |= NFS_CAP_OWNER; if (res.attr_bitmask[1] & FATTR4_WORD1_OWNER_GROUP) server->caps |= NFS_CAP_OWNER_GROUP; if (res.attr_bitmask[1] & FATTR4_WORD1_TIME_ACCESS) server->caps |= NFS_CAP_ATIME; if (res.attr_bitmask[1] & FATTR4_WORD1_TIME_METADATA) server->caps |= NFS_CAP_CTIME; if (res.attr_bitmask[1] & FATTR4_WORD1_TIME_MODIFY) server->caps |= NFS_CAP_MTIME; memcpy(server->cache_consistency_bitmask, res.attr_bitmask, sizeof(server->cache_consistency_bitmask)); server->cache_consistency_bitmask[0] &= FATTR4_WORD0_CHANGE|FATTR4_WORD0_SIZE; server->cache_consistency_bitmask[1] &= FATTR4_WORD1_TIME_METADATA|FATTR4_WORD1_TIME_MODIFY; server->acl_bitmask = res.acl_bitmask; } return status; } ",0 "void InputMethodIBus::ConfirmCompositionText() { TextInputClient* client = GetTextInputClient(); if (client && client->HasCompositionText()) client->ConfirmCompositionText(); ResetContext(); } ",0 "String AXObject::language() const { const AtomicString& lang = getAttribute(langAttr); if (!lang.isEmpty()) return lang; AXObject* parent = parentObject(); if (!parent) { Document* doc = getDocument(); if (doc) return doc->contentLanguage(); return nullAtom; } return parent->language(); } ",0 "void __cpuinit init_idle(struct task_struct *idle, int cpu) { struct rq *rq = cpu_rq(cpu); unsigned long flags; raw_spin_lock_irqsave(&rq->lock, flags); __sched_fork(idle); idle->state = TASK_RUNNING; idle->se.exec_start = sched_clock(); cpumask_copy(&idle->cpus_allowed, cpumask_of(cpu)); /* * We're having a chicken and egg problem, even though we are * holding rq->lock, the cpu isn't yet set to this cpu so the * lockdep check in task_group() will fail. * * Similar case to sched_fork(). / Alternatively we could * use task_rq_lock() here and obtain the other rq->lock. * * Silence PROVE_RCU */ rcu_read_lock(); __set_task_cpu(idle, cpu); rcu_read_unlock(); rq->curr = rq->idle = idle; #if defined(CONFIG_SMP) && defined(__ARCH_WANT_UNLOCKED_CTXSW) idle->oncpu = 1; #endif raw_spin_unlock_irqrestore(&rq->lock, flags); /* Set the preempt count _outside_ the spinlocks! */ #if defined(CONFIG_PREEMPT) task_thread_info(idle)->preempt_count = (idle->lock_depth >= 0); #else task_thread_info(idle)->preempt_count = 0; #endif /* * The idle tasks have their own, simple scheduling class: */ idle->sched_class = &idle_sched_class; ftrace_graph_init_task(idle); } ",0 "parse_opt_writemask( struct translate_ctx *ctx, uint *writemask ) { const char *cur; cur = ctx->cur; eat_opt_white( &cur ); if (*cur == '.') { cur++; *writemask = TGSI_WRITEMASK_NONE; eat_opt_white( &cur ); if (uprcase( *cur ) == 'X') { cur++; *writemask |= TGSI_WRITEMASK_X; } if (uprcase( *cur ) == 'Y') { cur++; *writemask |= TGSI_WRITEMASK_Y; } if (uprcase( *cur ) == 'Z') { cur++; *writemask |= TGSI_WRITEMASK_Z; } if (uprcase( *cur ) == 'W') { cur++; *writemask |= TGSI_WRITEMASK_W; } if (*writemask == TGSI_WRITEMASK_NONE) { report_error( ctx, ""Writemask expected"" ); return FALSE; } ctx->cur = cur; } else { *writemask = TGSI_WRITEMASK_XYZW; } return TRUE; } ",0 "pgp_delete_file(sc_card_t *card, const sc_path_t *path) { struct pgp_priv_data *priv = DRVDATA(card); pgp_blob_t *blob; sc_file_t *file; int r; LOG_FUNC_CALLED(card->ctx); /* sc_pkcs15init_delete_by_path() sets the path type to SC_PATH_TYPE_FILE_ID */ r = pgp_select_file(card, path, &file); LOG_TEST_RET(card->ctx, r, ""Cannot select file.""); /* save ""current"" blob */ blob = priv->current; /* don't try to delete MF */ if (blob == priv->mf) LOG_FUNC_RETURN(card->ctx, SC_ERROR_NOT_SUPPORTED); if (card->type != SC_CARD_TYPE_OPENPGP_GNUK && (file->id == DO_SIGN_SYM || file->id == DO_ENCR_SYM || file->id == DO_AUTH_SYM)) { /* These tags are just symbolic. We don't really delete them. */ r = SC_SUCCESS; } else if (card->type == SC_CARD_TYPE_OPENPGP_GNUK && file->id == DO_SIGN_SYM) { r = gnuk_delete_key(card, 1); } else if (card->type == SC_CARD_TYPE_OPENPGP_GNUK && file->id == DO_ENCR_SYM) { r = gnuk_delete_key(card, 2); } else if (card->type == SC_CARD_TYPE_OPENPGP_GNUK && file->id == DO_AUTH_SYM) { r = gnuk_delete_key(card, 3); } else { /* call pgp_put_data() with zero-sized NULL-buffer to zap the DO contents */ r = pgp_put_data(card, file->id, NULL, 0); } /* set ""current"" blob to parent */ priv->current = blob->parent; LOG_FUNC_RETURN(card->ctx, r); } ",0 "static int backref_match_at_nested_level(regex_t* reg , OnigStackType* top, OnigStackType* stk_base , int ignore_case, int case_fold_flag , int nest, int mem_num, UChar* memp, UChar** s, const UChar* send) { UChar *ss, *p, *pstart, *pend = NULL_UCHARP; int level; OnigStackType* k; level = 0; k = top; k--; while (k >= stk_base) { if (k->type == STK_CALL_FRAME) { level--; } else if (k->type == STK_RETURN) { level++; } else if (level == nest) { if (k->type == STK_MEM_START) { if (mem_is_in_memp(k->u.mem.num, mem_num, memp)) { pstart = k->u.mem.pstr; if (pend != NULL_UCHARP) { if (pend - pstart > send - *s) return 0; /* or goto next_mem; */ p = pstart; ss = *s; if (ignore_case != 0) { if (string_cmp_ic(reg->enc, case_fold_flag, pstart, &ss, (int )(pend - pstart)) == 0) return 0; /* or goto next_mem; */ } else { while (p < pend) { if (*p++ != *ss++) return 0; /* or goto next_mem; */ } } *s = ss; return 1; } } } else if (k->type == STK_MEM_END) { if (mem_is_in_memp(k->u.mem.num, mem_num, memp)) { pend = k->u.mem.pstr; } } } k--; } return 0; } ",0 "MagickExport QuantumType GetQuantumType(Image *image,ExceptionInfo *exception) { QuantumType quantum_type; assert(image != (Image *) NULL); assert(image->signature == MagickSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"",image->filename); (void) exception; quantum_type=RGBQuantum; if (image->matte != MagickFalse) quantum_type=RGBAQuantum; if (image->colorspace == CMYKColorspace) { quantum_type=CMYKQuantum; if (image->matte != MagickFalse) quantum_type=CMYKAQuantum; } if (IsGrayColorspace(image->colorspace) != MagickFalse) { quantum_type=GrayQuantum; if (image->matte != MagickFalse) quantum_type=GrayAlphaQuantum; } if (image->storage_class == PseudoClass) { quantum_type=IndexQuantum; if (image->matte != MagickFalse) quantum_type=IndexAlphaQuantum; } return(quantum_type); } ",0 "static HashTable *date_object_get_properties_timezone(zval *object TSRMLS_DC) { HashTable *props; zval *zv; php_timezone_obj *tzobj; tzobj = (php_timezone_obj *) zend_object_store_get_object(object TSRMLS_CC); props = zend_std_get_properties(object TSRMLS_CC); if (!tzobj->initialized) { return props; } MAKE_STD_ZVAL(zv); ZVAL_LONG(zv, tzobj->type); zend_hash_update(props, ""timezone_type"", 14, &zv, sizeof(zv), NULL); MAKE_STD_ZVAL(zv); switch (tzobj->type) { case TIMELIB_ZONETYPE_ID: ZVAL_STRING(zv, tzobj->tzi.tz->name, 1); break; case TIMELIB_ZONETYPE_OFFSET: { char *tmpstr = emalloc(sizeof(""UTC+05:00"")); snprintf(tmpstr, sizeof(""+05:00""), ""%c%02d:%02d"", tzobj->tzi.utc_offset > 0 ? '-' : '+', abs(tzobj->tzi.utc_offset / 60), abs((tzobj->tzi.utc_offset % 60))); ZVAL_STRING(zv, tmpstr, 0); } break; case TIMELIB_ZONETYPE_ABBR: ZVAL_STRING(zv, tzobj->tzi.z.abbr, 1); break; } zend_hash_update(props, ""timezone"", 9, &zv, sizeof(zv), NULL); return props; } ",0 "void omx_vdec::perf_control::load_lib() { char perf_lib_path[PROPERTY_VALUE_MAX] = {0}; if (m_perf_lib) return; if((property_get(""ro.vendor.extension_library"", perf_lib_path, NULL) <= 0)) { DEBUG_PRINT_ERROR(""vendor library not set in ro.vendor.extension_library""); return; } if ((m_perf_lib = dlopen(perf_lib_path, RTLD_NOW)) == NULL) { DEBUG_PRINT_ERROR(""Failed to open %s : %s"",perf_lib_path, dlerror()); } else { m_perf_lock_acquire = (perf_lock_acquire_t)dlsym(m_perf_lib, ""perf_lock_acq""); if (m_perf_lock_acquire == NULL) { DEBUG_PRINT_ERROR(""Failed to load symbol: perf_lock_acq""); } m_perf_lock_release = (perf_lock_release_t)dlsym(m_perf_lib, ""perf_lock_rel""); if (m_perf_lock_release == NULL) { DEBUG_PRINT_ERROR(""Failed to load symbol: perf_lock_rel""); } } } ",0 "int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, char *str_name TSRMLS_DC) { zend_lex_state original_lex_state; zval tmp = *str; str = &tmp; zval_copy_ctor(str); zend_save_lexical_state(&original_lex_state TSRMLS_CC); if (zend_prepare_string_for_scanning(str, str_name TSRMLS_CC)==FAILURE) { zend_restore_lexical_state(&original_lex_state TSRMLS_CC); return FAILURE; } BEGIN(INITIAL); zend_highlight(syntax_highlighter_ini TSRMLS_CC); if (SCNG(script_filtered)) { efree(SCNG(script_filtered)); SCNG(script_filtered) = NULL; } zend_restore_lexical_state(&original_lex_state TSRMLS_CC); zval_dtor(str); return SUCCESS; } ",0 "WebContents* WebContents::CreateWithSessionStorage( const WebContents::CreateParams& params, const SessionStorageNamespaceMap& session_storage_namespace_map) { WebContentsImpl* new_contents = new WebContentsImpl(params.browser_context); new_contents->SetOpenerForNewContents(FindOpener(params), params.opener_suppressed); for (SessionStorageNamespaceMap::const_iterator it = session_storage_namespace_map.begin(); it != session_storage_namespace_map.end(); ++it) { new_contents->GetController() .SetSessionStorageNamespace(it->first, it->second.get()); } new_contents->Init(params); return new_contents; } ",0 "static void _launch_complete_rm(uint32_t job_id) { int j; slurm_mutex_lock(&job_state_mutex); for (j = 0; j < JOB_STATE_CNT; j++) { if (job_id == active_job_id[j]) break; } if (j < JOB_STATE_CNT && job_id == active_job_id[j]) { for (j = j + 1; j < JOB_STATE_CNT; j++) { active_job_id[j - 1] = active_job_id[j]; } active_job_id[JOB_STATE_CNT - 1] = 0; } slurm_mutex_unlock(&job_state_mutex); _launch_complete_log(""job remove"", job_id); } ",0 " TestPrerenderContents( PrerenderManager* prerender_manager, Profile* profile, const GURL& url, const GURL& referrer, int number_of_loads, FinalStatus expected_final_status) : PrerenderContents(prerender_manager, profile, url, referrer), number_of_loads_(0), expected_number_of_loads_(number_of_loads), expected_final_status_(expected_final_status) { } ",0 "PluginProcessHost* PluginServiceImpl::FindOrStartNpapiPluginProcess( int render_process_id, const FilePath& plugin_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); if (filter_ && !filter_->CanLoadPlugin(render_process_id, plugin_path)) return NULL; PluginProcessHost* plugin_host = FindNpapiPluginProcess(plugin_path); if (plugin_host) return plugin_host; webkit::WebPluginInfo info; if (!GetPluginInfoByPath(plugin_path, &info)) { return NULL; } scoped_ptr new_host(new PluginProcessHost()); if (!new_host->Init(info)) { NOTREACHED(); // Init is not expected to fail. return NULL; } return new_host.release(); } ",0 "void vrend_end_query(struct vrend_context *ctx, uint32_t handle) { struct vrend_query *q; q = vrend_object_lookup(ctx->sub->object_hash, handle, VIRGL_OBJECT_QUERY); if (!q) return; if (vrend_is_timer_query(q->gltype)) { if (q->gltype == GL_TIMESTAMP) glQueryCounter(q->id, q->gltype); /* remove from active query list for this context */ else glEndQuery(q->gltype); return; } glEndQuery(q->gltype); } ",0 " static void sycc422_to_rgb(opj_image_t *img) { int *d0, *d1, *d2, *r, *g, *b; const int *y, *cb, *cr; unsigned int maxw, maxh, max; int offset, upb; unsigned int i, j; upb = (int)img->comps[0].prec; offset = 1<<(upb - 1); upb = (1<comps[0].w; maxh = (unsigned int)img->comps[0].h; max = maxw * maxh; y = img->comps[0].data; cb = img->comps[1].data; cr = img->comps[2].data; d0 = r = (int*)malloc(sizeof(int) * (size_t)max); d1 = g = (int*)malloc(sizeof(int) * (size_t)max); d2 = b = (int*)malloc(sizeof(int) * (size_t)max); if(r == NULL || g == NULL || b == NULL) goto fails; for(i=0U; i < maxh; ++i) { for(j=0U; j < (maxw & ~(unsigned int)1U); j += 2U) { sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b); ++y; ++r; ++g; ++b; sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b); ++y; ++r; ++g; ++b; ++cb; ++cr; } if (j < maxw) { sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b); ++y; ++r; ++g; ++b; ++cb; ++cr; } } free(img->comps[0].data); img->comps[0].data = d0; free(img->comps[1].data); img->comps[1].data = d1; free(img->comps[2].data); img->comps[2].data = d2; #if defined(USE_JPWL) || defined(USE_MJ2) img->comps[1].w = maxw; img->comps[1].h = maxh; img->comps[2].w = maxw; img->comps[2].h = maxh; #else img->comps[1].w = (OPJ_UINT32)maxw; img->comps[1].h = (OPJ_UINT32)maxh; img->comps[2].w = (OPJ_UINT32)maxw; img->comps[2].h = (OPJ_UINT32)maxh; #endif img->comps[1].dx = img->comps[0].dx; img->comps[2].dx = img->comps[0].dx; img->comps[1].dy = img->comps[0].dy; img->comps[2].dy = img->comps[0].dy; return; fails: if(r) free(r); if(g) free(g); if(b) free(b); }/* sycc422_to_rgb() */ ",1 " DataReductionProxyWarmupURLBrowsertest() : via_header_(std::get<1>(GetParam()) ? ""1.1 Chrome-Compression-Proxy"" : ""bad""), primary_server_(GetTestServerType()), secondary_server_(GetTestServerType()) {} ",0 "void vsock_for_each_connected_socket(void (*fn)(struct sock *sk)) { int i; spin_lock_bh(&vsock_table_lock); for (i = 0; i < ARRAY_SIZE(vsock_connected_table); i++) { struct vsock_sock *vsk; list_for_each_entry(vsk, &vsock_connected_table[i], connected_table) fn(sk_vsock(vsk)); } spin_unlock_bh(&vsock_table_lock); } ",0 "static inline unsigned int tg3_has_work(struct tg3_napi *tnapi) { struct tg3 *tp = tnapi->tp; struct tg3_hw_status *sblk = tnapi->hw_status; unsigned int work_exists = 0; /* check for phy events */ if (!(tg3_flag(tp, USE_LINKCHG_REG) || tg3_flag(tp, POLL_SERDES))) { if (sblk->status & SD_STATUS_LINK_CHG) work_exists = 1; } /* check for TX work to do */ if (sblk->idx[0].tx_consumer != tnapi->tx_cons) work_exists = 1; /* check for RX work to do */ if (tnapi->rx_rcb_prod_idx && *(tnapi->rx_rcb_prod_idx) != tnapi->rx_rcb_ptr) work_exists = 1; return work_exists; } ",0 "void Splash::scaleMaskYuXd(SplashImageMaskSource src, void *srcData, int srcWidth, int srcHeight, int scaledWidth, int scaledHeight, SplashBitmap *dest) { Guchar *lineBuf; Guint pix; Guchar *destPtr0, *destPtr; int yp, yq, xp, xq, yt, y, yStep, xt, x, xStep, xx, d, d0, d1; int i; destPtr0 = dest->data; if (destPtr0 == NULL) { error(errInternal, -1, ""dest->data is NULL in Splash::scaleMaskYuXd""); return; } yp = scaledHeight / srcHeight; yq = scaledHeight % srcHeight; xp = srcWidth / scaledWidth; xq = srcWidth % scaledWidth; lineBuf = (Guchar *)gmalloc(srcWidth); yt = 0; for (y = 0; y < srcHeight; ++y) { if ((yt += yq) >= srcHeight) { yt -= srcHeight; yStep = yp + 1; } else { yStep = yp; } (*src)(srcData, lineBuf); xt = 0; d0 = (255 << 23) / xp; d1 = (255 << 23) / (xp + 1); xx = 0; for (x = 0; x < scaledWidth; ++x) { if ((xt += xq) >= scaledWidth) { xt -= scaledWidth; xStep = xp + 1; d = d1; } else { xStep = xp; d = d0; } pix = 0; for (i = 0; i < xStep; ++i) { pix += lineBuf[xx++]; } pix = (pix * d) >> 23; for (i = 0; i < yStep; ++i) { destPtr = destPtr0 + i * scaledWidth + x; *destPtr = (Guchar)pix; } } destPtr0 += yStep * scaledWidth; } gfree(lineBuf); } ",0 " virtual ~FakePluginServiceFilter() {} ",0 "void IndexedDBDispatcher::CursorDestroyed(int32 cursor_id) { cursors_.erase(cursor_id); } ",0 "ready_callback_key_compare_only_active (gconstpointer a, gconstpointer b) { const ReadyCallback *callback_a; callback_a = a; /* Non active callbacks never match */ if (!callback_a->active) { return -1; } return ready_callback_key_compare (a, b); } ",0 "void TypingCommand::deleteKeyPressed(TextGranularity granularity, bool killRing, EditingState* editingState) { LocalFrame* frame = document().frame(); if (!frame) return; frame->spellChecker().updateMarkersForWordsAffectedByEditing(false); VisibleSelection selectionToDelete; VisibleSelection selectionAfterUndo; switch (endingSelection().getSelectionType()) { case RangeSelection: selectionToDelete = endingSelection(); selectionAfterUndo = selectionToDelete; break; case CaretSelection: { bool breakOutResult = breakOutOfEmptyMailBlockquotedParagraph(editingState); if (editingState->isAborted()) return; if (breakOutResult) typingAddedToOpenCommand(DeleteKey); m_smartDelete = false; document().updateStyleAndLayoutIgnorePendingStylesheets(); SelectionModifier selectionModifier(*frame, endingSelection()); selectionModifier.modify(FrameSelection::AlterationExtend, DirectionBackward, granularity); if (killRing && selectionModifier.selection().isCaret() && granularity != CharacterGranularity) selectionModifier.modify(FrameSelection::AlterationExtend, DirectionBackward, CharacterGranularity); VisiblePosition visibleStart(endingSelection().visibleStart()); if (previousPositionOf(visibleStart, CannotCrossEditingBoundary) .isNull()) { bool breakOutOfEmptyListItemResult = breakOutOfEmptyListItem(editingState); if (editingState->isAborted()) return; if (breakOutOfEmptyListItemResult) { typingAddedToOpenCommand(DeleteKey); return; } if (nextPositionOf(visibleStart, CannotCrossEditingBoundary).isNull() && makeEditableRootEmpty(editingState)) { typingAddedToOpenCommand(DeleteKey); return; } if (editingState->isAborted()) return; } Node* enclosingTableCell = enclosingNodeOfType(visibleStart.deepEquivalent(), &isTableCell); if (enclosingTableCell && visibleStart.deepEquivalent() == VisiblePosition::firstPositionInNode(enclosingTableCell) .deepEquivalent()) return; if (isStartOfParagraph(visibleStart) && tableElementJustBefore( previousPositionOf(visibleStart, CannotCrossEditingBoundary))) { if (tableElementJustAfter(visibleStart)) return; selectionModifier.modify(FrameSelection::AlterationExtend, DirectionBackward, granularity); } else if (Element* table = tableElementJustBefore(visibleStart)) { setEndingSelection( SelectionInDOMTree::Builder() .collapse(Position::beforeNode(table)) .extend(endingSelection().start()) .setIsDirectional(endingSelection().isDirectional()) .build()); typingAddedToOpenCommand(DeleteKey); return; } selectionToDelete = selectionModifier.selection(); if (granularity == CharacterGranularity && selectionToDelete.end().computeContainerNode() == selectionToDelete.start().computeContainerNode() && selectionToDelete.end().computeOffsetInContainerNode() - selectionToDelete.start().computeOffsetInContainerNode() > 1) { selectionToDelete.setWithoutValidation( selectionToDelete.end(), previousPositionOf(selectionToDelete.end(), PositionMoveType::BackwardDeletion)); } if (!startingSelection().isRange() || selectionToDelete.base() != startingSelection().start()) { selectionAfterUndo = selectionToDelete; } else { selectionAfterUndo.setWithoutValidation(startingSelection().end(), selectionToDelete.extent()); } break; } case NoSelection: NOTREACHED(); break; } DCHECK(!selectionToDelete.isNone()); if (selectionToDelete.isNone()) return; if (selectionToDelete.isCaret()) return; if (killRing) frame->editor().addToKillRing( selectionToDelete.toNormalizedEphemeralRange()); if (frame->editor().behavior().shouldUndoOfDeleteSelectText() && m_openedByBackwardDelete) setStartingSelection(selectionAfterUndo); deleteSelectionIfRange(selectionToDelete, editingState, m_smartDelete); if (editingState->isAborted()) return; setSmartDelete(false); typingAddedToOpenCommand(DeleteKey); } ",0 "static void unsignedShortMethodMethodCallback(const v8::FunctionCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMMethod""); TestObjectPythonV8Internal::unsignedShortMethodMethod(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "static void blk_dequeue_request(struct request *rq) { struct request_queue *q = rq->q; BUG_ON(list_empty(&rq->queuelist)); BUG_ON(ELV_ON_HASH(rq)); list_del_init(&rq->queuelist); /* * the time frame between a request being removed from the lists * and to it is freed is accounted as io that is in progress at * the driver side. */ if (blk_account_rq(rq)) q->in_flight[rq_is_sync(rq)]++; } ",0 "device_linux_md_check (Device *device, char **options, DBusGMethodInvocation *context) { guint n; const gchar *job_name; job_name = ""LinuxMdCheck""; for (n = 0; options != NULL && options[n] != NULL; n++) if (strcmp (options[n], ""repair"") == 0) job_name = ""LinuxMdRepair""; if (!device->priv->device_is_linux_md) { throw_error (context, ERROR_FAILED, ""Device is not a Linux md drive""); goto out; } if (g_strcmp0 (device->priv->linux_md_sync_action, ""idle"") != 0) { throw_error (context, ERROR_FAILED, ""Array is not idle""); goto out; } daemon_local_check_auth (device->priv->daemon, device, ""org.freedesktop.udisks.linux-md"", job_name, TRUE, device_linux_md_check_authorized_cb, context, 1, g_strdupv (options), g_strfreev); out: return TRUE; } ",0 "nvmet_fc_alloc_fcp_iod(struct nvmet_fc_tgt_queue *queue) { struct nvmet_fc_fcp_iod *fod; lockdep_assert_held(&queue->qlock); fod = list_first_entry_or_null(&queue->fod_list, struct nvmet_fc_fcp_iod, fcp_list); if (fod) { list_del(&fod->fcp_list); fod->active = true; /* * no queue reference is taken, as it was taken by the * queue lookup just prior to the allocation. The iod * will ""inherit"" that reference. */ } return fod; } ",0 "int kvm_handle_cp14_load_store(struct kvm_vcpu *vcpu, struct kvm_run *run) { kvm_inject_undefined(vcpu); return 1; } ",0 "static char *get_object_from_here(FILE *fp, size_t *size, int *is_stream) { long start; char buf[256]; int obj_id; xref_t xref; xref_entry_t entry; start = ftell(fp); /* Object ID */ memset(buf, 0, 256); SAFE_E(fread(buf, 1, 255, fp), 255, ""Failed to load object ID.\n""); if (!(obj_id = atoi(buf))) { fseek(fp, start, SEEK_SET); return NULL; } /* Create xref entry to pass to the get_object routine */ memset(&entry, 0, sizeof(xref_entry_t)); entry.obj_id = obj_id; entry.offset = start; /* Xref and single entry for the object we want data from */ memset(&xref, 0, sizeof(xref_t)); xref.n_entries = 1; xref.entries = &entry; fseek(fp, start, SEEK_SET); return get_object(fp, obj_id, &xref, size, is_stream); } ",0 "static void disk_check_events(struct disk_events *ev, unsigned int *clearing_ptr) { struct gendisk *disk = ev->disk; char *envp[ARRAY_SIZE(disk_uevents) + 1] = { }; unsigned int clearing = *clearing_ptr; unsigned int events; unsigned long intv; int nr_events = 0, i; /* check events */ events = disk->fops->check_events(disk, clearing); /* accumulate pending events and schedule next poll if necessary */ spin_lock_irq(&ev->lock); events &= ~ev->pending; ev->pending |= events; *clearing_ptr &= ~clearing; intv = disk_events_poll_jiffies(disk); if (!ev->block && intv) queue_delayed_work(system_freezable_power_efficient_wq, &ev->dwork, intv); spin_unlock_irq(&ev->lock); /* * Tell userland about new events. Only the events listed in * @disk->events are reported. Unlisted events are processed the * same internally but never get reported to userland. */ for (i = 0; i < ARRAY_SIZE(disk_uevents); i++) if (events & disk->events & (1 << i)) envp[nr_events++] = disk_uevents[i]; if (nr_events) kobject_uevent_env(&disk_to_dev(disk)->kobj, KOBJ_CHANGE, envp); } ",0 "static struct cgroup_meta_data *lxc_cgroup_load_meta2(const char **subsystem_whitelist) { bool all_kernel_subsystems = true; bool all_named_subsystems = false; struct cgroup_meta_data *meta_data = NULL; char **kernel_subsystems = NULL; int saved_errno = 0; /* if the subsystem whitelist is not specified, include all * hierarchies that contain kernel subsystems by default but * no hierarchies that only contain named subsystems * * if it is specified, the specifier @all will select all * hierarchies, @kernel will select all hierarchies with * kernel subsystems and @named will select all named * hierarchies */ all_kernel_subsystems = subsystem_whitelist ? (lxc_string_in_array(""@kernel"", subsystem_whitelist) || lxc_string_in_array(""@all"", subsystem_whitelist)) : true; all_named_subsystems = subsystem_whitelist ? (lxc_string_in_array(""@named"", subsystem_whitelist) || lxc_string_in_array(""@all"", subsystem_whitelist)) : false; meta_data = calloc(1, sizeof(struct cgroup_meta_data)); if (!meta_data) return NULL; meta_data->ref = 1; if (!find_cgroup_subsystems(&kernel_subsystems)) goto out_error; if (!find_cgroup_hierarchies(meta_data, all_kernel_subsystems, all_named_subsystems, subsystem_whitelist)) goto out_error; if (!find_hierarchy_mountpts(meta_data, kernel_subsystems)) goto out_error; /* oops, we couldn't find anything */ if (!meta_data->hierarchies || !meta_data->mount_points) { errno = EINVAL; goto out_error; } lxc_free_array((void **)kernel_subsystems, free); return meta_data; out_error: saved_errno = errno; lxc_free_array((void **)kernel_subsystems, free); lxc_cgroup_put_meta(meta_data); errno = saved_errno; return NULL; } ",0 "GBool Splash::getStrokeAdjust() { return state->strokeAdjust; } ",0 "void WebGraphicsContext3DDefaultImpl::deleteRenderbuffer(unsigned renderbuffer) { makeContextCurrent(); glDeleteRenderbuffersEXT(1, &renderbuffer); } ",0 "static inline struct msg_msg *prepare_copy(void __user *buf, size_t bufsz) { return ERR_PTR(-ENOSYS); } ",0 "static bool shouldEmitTabBeforeNode(Node* node) { RenderObject* r = node->renderer(); if (!r || !isTableCell(node)) return false; RenderTableCell* rc = toRenderTableCell(r); RenderTable* t = rc->table(); return t && (t->cellBefore(rc) || t->cellAbove(rc)); } ",0 "static int count_total(struct page *page) { return page->objects; } ",0 "void LocalFrame::PrintNavigationWarning(const String& message) { console_->AddMessage( ConsoleMessage::Create(kJSMessageSource, kWarningMessageLevel, message)); } ",0 "ext2_acl_to_disk(const struct posix_acl *acl, size_t *size) { ext2_acl_header *ext_acl; char *e; size_t n; *size = ext2_acl_size(acl->a_count); ext_acl = kmalloc(sizeof(ext2_acl_header) + acl->a_count * sizeof(ext2_acl_entry), GFP_KERNEL); if (!ext_acl) return ERR_PTR(-ENOMEM); ext_acl->a_version = cpu_to_le32(EXT2_ACL_VERSION); e = (char *)ext_acl + sizeof(ext2_acl_header); for (n=0; n < acl->a_count; n++) { const struct posix_acl_entry *acl_e = &acl->a_entries[n]; ext2_acl_entry *entry = (ext2_acl_entry *)e; entry->e_tag = cpu_to_le16(acl_e->e_tag); entry->e_perm = cpu_to_le16(acl_e->e_perm); switch(acl_e->e_tag) { case ACL_USER: entry->e_id = cpu_to_le32( from_kuid(&init_user_ns, acl_e->e_uid)); e += sizeof(ext2_acl_entry); break; case ACL_GROUP: entry->e_id = cpu_to_le32( from_kgid(&init_user_ns, acl_e->e_gid)); e += sizeof(ext2_acl_entry); break; case ACL_USER_OBJ: case ACL_GROUP_OBJ: case ACL_MASK: case ACL_OTHER: e += sizeof(ext2_acl_entry_short); break; default: goto fail; } } return (char *)ext_acl; fail: kfree(ext_acl); return ERR_PTR(-EINVAL); } ",0 "XML_FreeContentModel(XML_Parser parser, XML_Content *model) { if (parser != NULL) FREE(parser, model); } ",0 "uint32_t faad_get_processed_bits(bitfile *ld) { return (uint32_t)(8 * (4*(ld->tail - ld->start) - 4) - (ld->bits_left)); } ",0 "vmci_transport_datagram_create_hnd(u32 resource_id, u32 flags, vmci_datagram_recv_cb recv_cb, void *client_data, struct vmci_handle *out_handle) { int err = 0; /* Try to allocate our datagram handler as trusted. This will only work * if vsock is running in the host. */ err = vmci_datagram_create_handle_priv(resource_id, flags, VMCI_PRIVILEGE_FLAG_TRUSTED, recv_cb, client_data, out_handle); if (err == VMCI_ERROR_NO_ACCESS) err = vmci_datagram_create_handle(resource_id, flags, recv_cb, client_data, out_handle); return err; } ",0 "void sock_diag_unregister_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh)) { mutex_lock(&sock_diag_table_mutex); inet_rcv_compat = NULL; mutex_unlock(&sock_diag_table_mutex); } ",0 "void FrameLoader::willSetEncoding() { if (!m_workingURL.isEmpty()) receivedFirstData(); } ",0 "void GLClearFramebufferTest::SetDrawColor(GLfloat r, GLfloat g, GLfloat b, GLfloat a) { glUniform4f(color_handle_, r, g, b, a); } ",0 "encode_secinfo_no_name(struct xdr_stream *xdr, const struct nfs41_secinfo_no_name_args *args, struct compound_hdr *hdr) { __be32 *p; p = reserve_space(xdr, 8); *p++ = cpu_to_be32(OP_SECINFO_NO_NAME); *p++ = cpu_to_be32(args->style); hdr->nops++; hdr->replen += decode_secinfo_no_name_maxsz; return 0; } ",0 "GF_Err rssr_Size(GF_Box *s) { s->size += 4; return GF_OK; } ",0 "struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src) { skb_release_all(dst); return __skb_clone(dst, src); } ",0 "long ssl3_callback_ctrl(SSL *s, int cmd, void (*fp)(void)) { int ret=0; #if !defined(OPENSSL_NO_DSA) || !defined(OPENSSL_NO_RSA) if ( #ifndef OPENSSL_NO_RSA cmd == SSL_CTRL_SET_TMP_RSA_CB || #endif #ifndef OPENSSL_NO_DSA cmd == SSL_CTRL_SET_TMP_DH_CB || #endif 0) { if (!ssl_cert_inst(&s->cert)) { SSLerr(SSL_F_SSL3_CALLBACK_CTRL, ERR_R_MALLOC_FAILURE); return(0); } } #endif switch (cmd) { #ifndef OPENSSL_NO_RSA case SSL_CTRL_SET_TMP_RSA_CB: { s->cert->rsa_tmp_cb = (RSA *(*)(SSL *, int, int))fp; } break; #endif #ifndef OPENSSL_NO_DH case SSL_CTRL_SET_TMP_DH_CB: { s->cert->dh_tmp_cb = (DH *(*)(SSL *, int, int))fp; } break; #endif #ifndef OPENSSL_NO_ECDH case SSL_CTRL_SET_TMP_ECDH_CB: { s->cert->ecdh_tmp_cb = (EC_KEY *(*)(SSL *, int, int))fp; } break; #endif #ifndef OPENSSL_NO_TLSEXT case SSL_CTRL_SET_TLSEXT_DEBUG_CB: s->tlsext_debug_cb=(void (*)(SSL *,int ,int, unsigned char *, int, void *))fp; break; #endif default: break; } return(ret); } ",0 " const GpuDriverBugWorkarounds& workarounds() const { return feature_info_->workarounds(); } ",0 "void RenderWidgetHostImpl::Destroy(bool also_delete) { DCHECK(!destroyed_); destroyed_ = true; NotificationService::current()->Notify( NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, Source(this), NotificationService::NoDetails()); if (view_) { view_->Destroy(); view_.reset(); } process_->RemoveRoute(routing_id_); g_routing_id_widget_map.Get().erase( RenderWidgetHostID(process_->GetID(), routing_id_)); if (delegate_) delegate_->RenderWidgetDeleted(this); if (also_delete) delete this; } ",1 "void ResourceDispatcherHostImpl::AddResourceContext(ResourceContext* context) { DCHECK_CURRENTLY_ON(BrowserThread::IO); active_resource_contexts_.insert(context); } ",0 "BlockEntry::Kind Track::EOSBlock::GetKind() const { return kBlockEOS; } ",0 "browser::NavigateParams Browser::GetSingletonTabNavigateParams( const GURL& url) { browser::NavigateParams params(this, url, PageTransition::AUTO_BOOKMARK); params.disposition = SINGLETON_TAB; params.window_action = browser::NavigateParams::SHOW_WINDOW; params.user_gesture = true; return params; } ",0 "auth_decipher(struct sc_card *card, const unsigned char *in, size_t inlen, unsigned char *out, size_t outlen) { struct sc_apdu apdu; unsigned char resp[SC_MAX_APDU_BUFFER_SIZE]; int rv, _inlen = inlen; LOG_FUNC_CALLED(card->ctx); sc_log(card->ctx, ""crgram_len %""SC_FORMAT_LEN_SIZE_T""u; outlen %""SC_FORMAT_LEN_SIZE_T""u"", inlen, outlen); if (!out || !outlen || inlen > SC_MAX_APDU_BUFFER_SIZE) LOG_FUNC_RETURN(card->ctx, SC_ERROR_INVALID_ARGUMENTS); sc_format_apdu(card, &apdu, SC_APDU_CASE_4_SHORT, 0x2A, 0x80, 0x86); sc_log(card->ctx, ""algorithm SC_ALGORITHM_RSA""); if (inlen % 64) { rv = SC_ERROR_INVALID_ARGUMENTS; goto done; } _inlen = inlen; if (_inlen == 256) { apdu.cla |= 0x10; apdu.data = in; apdu.datalen = 8; apdu.resp = resp; apdu.resplen = SC_MAX_APDU_BUFFER_SIZE; apdu.lc = 8; apdu.le = 256; rv = sc_transmit_apdu(card, &apdu); sc_log(card->ctx, ""rv %i"", rv); LOG_TEST_RET(card->ctx, rv, ""APDU transmit failed""); rv = sc_check_sw(card, apdu.sw1, apdu.sw2); LOG_TEST_RET(card->ctx, rv, ""Card returned error""); _inlen -= 8; in += 8; apdu.cla &= ~0x10; } apdu.data = in; apdu.datalen = _inlen; apdu.resp = resp; apdu.resplen = SC_MAX_APDU_BUFFER_SIZE; apdu.lc = _inlen; apdu.le = _inlen; rv = sc_transmit_apdu(card, &apdu); sc_log(card->ctx, ""rv %i"", rv); LOG_TEST_RET(card->ctx, rv, ""APDU transmit failed""); rv = sc_check_sw(card, apdu.sw1, apdu.sw2); sc_log(card->ctx, ""rv %i"", rv); LOG_TEST_RET(card->ctx, rv, ""Card returned error""); if (outlen > apdu.resplen) outlen = apdu.resplen; memcpy(out, apdu.resp, outlen); rv = outlen; done: LOG_FUNC_RETURN(card->ctx, rv); } ",0 "void OutOfProcessInstance::DocumentPaintOccurred() { } ",0 "test_bson_append_time_t (void) { bson_t *b; bson_t *b2; time_t t; t = 1234567890; b = bson_new (); BSON_ASSERT (bson_append_time_t (b, ""time_t"", -1, t)); b2 = get_bson (""test26.bson""); BSON_ASSERT_BSON_EQUAL (b, b2); bson_destroy (b); bson_destroy (b2); } ",0 "static void pmcraid_identify_hrrq(struct pmcraid_cmd *cmd) { struct pmcraid_instance *pinstance = cmd->drv_inst; struct pmcraid_ioarcb *ioarcb = &cmd->ioa_cb->ioarcb; int index = cmd->hrrq_index; __be64 hrrq_addr = cpu_to_be64(pinstance->hrrq_start_bus_addr[index]); u32 hrrq_size = cpu_to_be32(sizeof(u32) * PMCRAID_MAX_CMD); void (*done_function)(struct pmcraid_cmd *); pmcraid_reinit_cmdblk(cmd); cmd->hrrq_index = index + 1; if (cmd->hrrq_index < pinstance->num_hrrq) { done_function = pmcraid_identify_hrrq; } else { cmd->hrrq_index = 0; done_function = pmcraid_get_fwversion; } /* Initialize ioarcb */ ioarcb->request_type = REQ_TYPE_IOACMD; ioarcb->resource_handle = cpu_to_le32(PMCRAID_IOA_RES_HANDLE); /* initialize the hrrq number where IOA will respond to this command */ ioarcb->hrrq_id = index; ioarcb->cdb[0] = PMCRAID_IDENTIFY_HRRQ; ioarcb->cdb[1] = index; /* IOA expects 64-bit pci address to be written in B.E format * (i.e cdb[2]=MSByte..cdb[9]=LSB. */ pmcraid_info(""HRRQ_IDENTIFY with hrrq:ioarcb:index => %llx:%llx:%x\n"", hrrq_addr, ioarcb->ioarcb_bus_addr, index); memcpy(&(ioarcb->cdb[2]), &hrrq_addr, sizeof(hrrq_addr)); memcpy(&(ioarcb->cdb[10]), &hrrq_size, sizeof(hrrq_size)); /* Subsequent commands require HRRQ identification to be successful. * Note that this gets called even during reset from SCSI mid-layer * or tasklet */ pmcraid_send_cmd(cmd, done_function, PMCRAID_INTERNAL_TIMEOUT, pmcraid_timeout_handler); } ",0 "net::URLRequestContextGetter* DownloadManagerImpl::GetURLRequestContextGetter( const download::DownloadCreateInfo& info) { StoragePartition* storage_partition = GetStoragePartition( browser_context_, info.render_process_id, info.render_frame_id); return storage_partition ? storage_partition->GetURLRequestContext() : nullptr; } ",0 "static struct clk_hw *hi3660_stub_clk_hw_get(struct of_phandle_args *clkspec, void *data) { unsigned int idx = clkspec->args[0]; if (idx >= HI3660_CLK_STUB_NUM) { pr_err(""%s: invalid index %u\n"", __func__, idx); return ERR_PTR(-EINVAL); } return &hi3660_stub_clks[idx].hw; } ",0 " static TabIcon* GetTabIcon(const Tab& tab) { return tab.icon_; } ",0 "FloatRect DragController::ClippedSelection(const LocalFrame& frame) { DCHECK(frame.View()); return DataTransfer::ClipByVisualViewport( FloatRect(frame.Selection().UnclippedBoundsInDocument()), frame); } ",0 " JSAMPARRAY samples() const { return m_samples; } ",0 "void WebGLRenderingContextBase::TexImageImpl( TexImageFunctionID function_id, GLenum target, GLint level, GLint internalformat, GLint xoffset, GLint yoffset, GLint zoffset, GLenum format, GLenum type, Image* image, WebGLImageConversion::ImageHtmlDomSource dom_source, bool flip_y, bool premultiply_alpha, const IntRect& source_image_rect, GLsizei depth, GLint unpack_image_height) { const char* func_name = GetTexImageFunctionName(function_id); if (type == GL_UNSIGNED_INT_10F_11F_11F_REV) { type = GL_FLOAT; } Vector data; IntRect sub_rect = source_image_rect; if (sub_rect.IsValid() && sub_rect == SentinelEmptyRect()) { sub_rect = SafeGetImageSize(image); } bool selecting_sub_rectangle = false; if (!ValidateTexImageSubRectangle(func_name, function_id, image, sub_rect, depth, unpack_image_height, &selecting_sub_rectangle)) { return; } IntRect adjusted_source_image_rect = sub_rect; if (flip_y) { adjusted_source_image_rect.SetY(image->height() - adjusted_source_image_rect.MaxY()); } WebGLImageConversion::ImageExtractor image_extractor( image, dom_source, premultiply_alpha, unpack_colorspace_conversion_ == GL_NONE); if (!image_extractor.ImagePixelData()) { SynthesizeGLError(GL_INVALID_VALUE, func_name, ""bad image data""); return; } WebGLImageConversion::DataFormat source_data_format = image_extractor.ImageSourceFormat(); WebGLImageConversion::AlphaOp alpha_op = image_extractor.ImageAlphaOp(); const void* image_pixel_data = image_extractor.ImagePixelData(); bool need_conversion = true; if (type == GL_UNSIGNED_BYTE && source_data_format == WebGLImageConversion::kDataFormatRGBA8 && format == GL_RGBA && alpha_op == WebGLImageConversion::kAlphaDoNothing && !flip_y && !selecting_sub_rectangle && depth == 1) { need_conversion = false; } else { if (!WebGLImageConversion::PackImageData( image, image_pixel_data, format, type, flip_y, alpha_op, source_data_format, image_extractor.ImageWidth(), image_extractor.ImageHeight(), adjusted_source_image_rect, depth, image_extractor.ImageSourceUnpackAlignment(), unpack_image_height, data)) { SynthesizeGLError(GL_INVALID_VALUE, func_name, ""packImage error""); return; } } ScopedUnpackParametersResetRestore temporary_reset_unpack(this); if (function_id == kTexImage2D) { TexImage2DBase(target, level, internalformat, adjusted_source_image_rect.Width(), adjusted_source_image_rect.Height(), 0, format, type, need_conversion ? data.data() : image_pixel_data); } else if (function_id == kTexSubImage2D) { ContextGL()->TexSubImage2D( target, level, xoffset, yoffset, adjusted_source_image_rect.Width(), adjusted_source_image_rect.Height(), format, type, need_conversion ? data.data() : image_pixel_data); } else { if (function_id == kTexImage3D) { ContextGL()->TexImage3D( target, level, internalformat, adjusted_source_image_rect.Width(), adjusted_source_image_rect.Height(), depth, 0, format, type, need_conversion ? data.data() : image_pixel_data); } else { DCHECK_EQ(function_id, kTexSubImage3D); ContextGL()->TexSubImage3D( target, level, xoffset, yoffset, zoffset, adjusted_source_image_rect.Width(), adjusted_source_image_rect.Height(), depth, format, type, need_conversion ? data.data() : image_pixel_data); } } } ",0 " static int SelectNextProtoCallback(SSL* ssl, unsigned char** out, unsigned char* outlen, const unsigned char* in, unsigned int inlen, void* arg) { SSLClientSocketOpenSSL* socket = GetInstance()->GetClientSocketFromSSL(ssl); return socket->SelectNextProtoCallback(out, outlen, in, inlen); } ",0 "void VideoRendererBase::Seek(base::TimeDelta time, const PipelineStatusCB& cb) { base::AutoLock auto_lock(lock_); DCHECK_EQ(state_, kFlushed) << ""Must flush prior to seeking.""; DCHECK(!cb.is_null()); DCHECK(seek_cb_.is_null()); state_ = kSeeking; seek_cb_ = cb; seek_timestamp_ = time; AttemptRead_Locked(); } ",0 "std::string ChromeContentBrowserClient::GetAcceptLangs(const TabContents* tab) { return tab->profile()->GetPrefs()->GetString(prefs::kAcceptLanguages); } ",0 "void ProfileSyncService::Initialize() { InitSettings(); ClearStaleErrors(); sync_prefs_.AddSyncPrefObserver(this); if (IsManaged()) { DisableForUser(); return; } RegisterAuthNotifications(); if (!HasSyncSetupCompleted() || signin_->GetAuthenticatedUsername().empty()) { DisableForUser(); } TryStart(); } ",0 "static int emulate_pop(struct x86_emulate_ctxt *ctxt, void *dest, int len) { int rc; struct segmented_address addr; addr.ea = register_address(ctxt, ctxt->regs[VCPU_REGS_RSP]); addr.seg = VCPU_SREG_SS; rc = segmented_read(ctxt, addr, dest, len); if (rc != X86EMUL_CONTINUE) return rc; register_address_increment(ctxt, &ctxt->regs[VCPU_REGS_RSP], len); return rc; } ",0 " static void dump_completed_IO(struct inode * inode) { #ifdef EXT4_DEBUG struct list_head *cur, *before, *after; ext4_io_end_t *io, *io0, *io1; if (list_empty(&EXT4_I(inode)->i_completed_io_list)){ ext4_debug(""inode %lu completed_io list is empty\n"", inode->i_ino); return; } ext4_debug(""Dump inode %lu completed_io list \n"", inode->i_ino); list_for_each_entry(io, &EXT4_I(inode)->i_completed_io_list, list){ cur = &io->list; before = cur->prev; io0 = container_of(before, ext4_io_end_t, list); after = cur->next; io1 = container_of(after, ext4_io_end_t, list); ext4_debug(""io 0x%p from inode %lu,prev 0x%p,next 0x%p\n"", io, inode->i_ino, io0, io1); } #endif } ",1 "void Smb4KGlobal::initCore(bool modifyCursor, bool initClasses) { p->modifyCursor = modifyCursor; p->setDefaultSettings(); if (initClasses) { Smb4KScanner::self()->start(); Smb4KMounter::self()->start(); } else { } p->makeConnections(); p->coreInitialized = true; } ",0 "BackgroundLoaderOffliner* BackgroundLoaderOffliner::FromWebContents( content::WebContents* contents) { Offliner* offliner = OfflinerUserData::OfflinerFromWebContents(contents); if (offliner) return static_cast(offliner); return nullptr; } ",0 "static int userfaultfd_release(struct inode *inode, struct file *file) { struct userfaultfd_ctx *ctx = file->private_data; struct mm_struct *mm = ctx->mm; struct vm_area_struct *vma, *prev; /* len == 0 means wake all */ struct userfaultfd_wake_range range = { .len = 0, }; unsigned long new_flags; ACCESS_ONCE(ctx->released) = true; if (!mmget_not_zero(mm)) goto wakeup; /* * Flush page faults out of all CPUs. NOTE: all page faults * must be retried without returning VM_FAULT_SIGBUS if * userfaultfd_ctx_get() succeeds but vma->vma_userfault_ctx * changes while handle_userfault released the mmap_sem. So * it's critical that released is set to true (above), before * taking the mmap_sem for writing. */ down_write(&mm->mmap_sem); prev = NULL; for (vma = mm->mmap; vma; vma = vma->vm_next) { cond_resched(); BUG_ON(!!vma->vm_userfaultfd_ctx.ctx ^ !!(vma->vm_flags & (VM_UFFD_MISSING | VM_UFFD_WP))); if (vma->vm_userfaultfd_ctx.ctx != ctx) { prev = vma; continue; } new_flags = vma->vm_flags & ~(VM_UFFD_MISSING | VM_UFFD_WP); prev = vma_merge(mm, prev, vma->vm_start, vma->vm_end, new_flags, vma->anon_vma, vma->vm_file, vma->vm_pgoff, vma_policy(vma), NULL_VM_UFFD_CTX); if (prev) vma = prev; else prev = vma; vma->vm_flags = new_flags; vma->vm_userfaultfd_ctx = NULL_VM_UFFD_CTX; } up_write(&mm->mmap_sem); mmput(mm); wakeup: /* * After no new page faults can wait on this fault_*wqh, flush * the last page faults that may have been already waiting on * the fault_*wqh. */ spin_lock(&ctx->fault_pending_wqh.lock); __wake_up_locked_key(&ctx->fault_pending_wqh, TASK_NORMAL, &range); __wake_up_locked_key(&ctx->fault_wqh, TASK_NORMAL, &range); spin_unlock(&ctx->fault_pending_wqh.lock); /* Flush pending events that may still wait on event_wqh */ wake_up_all(&ctx->event_wqh); wake_up_poll(&ctx->fd_wqh, POLLHUP); userfaultfd_ctx_put(ctx); return 0; } ",0 "SYSCALL_DEFINE2(shutdown, int, fd, int, how) { return __sys_shutdown(fd, how); } ",0 "static int skcipher_walk_first(struct skcipher_walk *walk) { walk->nbytes = 0; if (WARN_ON_ONCE(in_irq())) return -EDEADLK; if (unlikely(!walk->total)) return 0; walk->buffer = NULL; if (unlikely(((unsigned long)walk->iv & walk->alignmask))) { int err = skcipher_copy_iv(walk); if (err) return err; } walk->page = NULL; walk->nbytes = walk->total; return skcipher_walk_next(walk); } ",0 "MagickExport ExceptionInfo *DestroyExceptionInfo(ExceptionInfo *exception) { if (ClearExceptionInfo(exception,MagickFalse) != MagickFalse) exception=(ExceptionInfo *) RelinquishMagickMemory(exception); return(exception); } ",0 "int git_delta_index_init( git_delta_index **out, const void *buf, size_t bufsize) { unsigned int i, hsize, hmask, entries, prev_val, *hash_count; const unsigned char *data, *buffer = buf; struct git_delta_index *index; struct index_entry *entry, **hash; void *mem; unsigned long memsize; *out = NULL; if (!buf || !bufsize) return 0; /* Determine index hash size. Note that indexing skips the first byte to allow for optimizing the rabin polynomial initialization in create_delta(). */ entries = (unsigned int)(bufsize - 1) / RABIN_WINDOW; if (bufsize >= 0xffffffffUL) { /* * Current delta format can't encode offsets into * reference buffer with more than 32 bits. */ entries = 0xfffffffeU / RABIN_WINDOW; } hsize = entries / 4; for (i = 4; i < 31 && (1u << i) < hsize; i++); hsize = 1 << i; hmask = hsize - 1; if (lookup_index_alloc(&mem, &memsize, entries, hsize) < 0) return -1; index = mem; mem = index->hash; hash = mem; mem = hash + hsize; entry = mem; index->memsize = memsize; index->src_buf = buf; index->src_size = bufsize; index->hash_mask = hmask; memset(hash, 0, hsize * sizeof(*hash)); /* allocate an array to count hash entries */ hash_count = git__calloc(hsize, sizeof(*hash_count)); if (!hash_count) { git__free(index); return -1; } /* then populate the index */ prev_val = ~0; for (data = buffer + entries * RABIN_WINDOW - RABIN_WINDOW; data >= buffer; data -= RABIN_WINDOW) { unsigned int val = 0; for (i = 1; i <= RABIN_WINDOW; i++) val = ((val << 8) | data[i]) ^ T[val >> RABIN_SHIFT]; if (val == prev_val) { /* keep the lowest of consecutive identical blocks */ entry[-1].ptr = data + RABIN_WINDOW; } else { prev_val = val; i = val & hmask; entry->ptr = data + RABIN_WINDOW; entry->val = val; entry->next = hash[i]; hash[i] = entry++; hash_count[i]++; } } /* * Determine a limit on the number of entries in the same hash * bucket. This guard us against patological data sets causing * really bad hash distribution with most entries in the same hash * bucket that would bring us to O(m*n) computing costs (m and n * corresponding to reference and target buffer sizes). * * Make sure none of the hash buckets has more entries than * we're willing to test. Otherwise we cull the entry list * uniformly to still preserve a good repartition across * the reference buffer. */ for (i = 0; i < hsize; i++) { if (hash_count[i] < HASH_LIMIT) continue; entry = hash[i]; do { struct index_entry *keep = entry; int skip = hash_count[i] / HASH_LIMIT / 2; do { entry = entry->next; } while(--skip && entry); keep->next = entry; } while (entry); } git__free(hash_count); *out = index; return 0; } ",0 "void __skb_tstamp_tx(struct sk_buff *orig_skb, struct skb_shared_hwtstamps *hwtstamps, struct sock *sk, int tstype) { struct sk_buff *skb; bool tsonly; if (!sk) return; tsonly = sk->sk_tsflags & SOF_TIMESTAMPING_OPT_TSONLY; if (!skb_may_tx_timestamp(sk, tsonly)) return; if (tsonly) { #ifdef CONFIG_INET if ((sk->sk_tsflags & SOF_TIMESTAMPING_OPT_STATS) && sk->sk_protocol == IPPROTO_TCP && sk->sk_type == SOCK_STREAM) skb = tcp_get_timestamping_opt_stats(sk); else #endif skb = alloc_skb(0, GFP_ATOMIC); } else { skb = skb_clone(orig_skb, GFP_ATOMIC); } if (!skb) return; if (tsonly) { skb_shinfo(skb)->tx_flags = skb_shinfo(orig_skb)->tx_flags; skb_shinfo(skb)->tskey = skb_shinfo(orig_skb)->tskey; } if (hwtstamps) *skb_hwtstamps(skb) = *hwtstamps; else skb->tstamp = ktime_get_real(); __skb_complete_tx_timestamp(skb, sk, tstype); } ",0 "PassRefPtr CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropertyID propertyID) const { return getPropertyCSSValue(propertyID, UpdateLayout); } ",0 "void ScriptLoader::handleAsyncAttribute() { m_forceAsync = false; } ",0 "static int handle_chown(FsContext *fs_ctx, V9fsPath *fs_path, FsCred *credp) { int fd, ret; struct handle_data *data = (struct handle_data *)fs_ctx->private; fd = open_by_handle(data->mountfd, fs_path->data, O_PATH); if (fd < 0) { return fd; } ret = fchownat(fd, """", credp->fc_uid, credp->fc_gid, AT_EMPTY_PATH); close(fd); return ret; } ",0 "void OmniboxViewViews::OnNativeThemeChanged(const ui::NativeTheme* theme) { views::Textfield::OnNativeThemeChanged(theme); if (location_bar_view_) { SetBackgroundColor( location_bar_view_->GetColor(LocationBarView::BACKGROUND)); } EmphasizeURLComponents(); } ",0 "void BookmarkExtensionBackground::Paint(gfx::Canvas* canvas, views::View* view) const { ui::ThemeProvider* tp = host_view_->GetThemeProvider(); const chrome::search::Mode& search_mode = browser_view_->browser()->search_model()->mode(); if (search_mode.is_ntp()) { BookmarkModel* bookmark_model = BookmarkModelFactory::GetForProfile(browser_->profile()); if (bookmark_model && bookmark_model->HasBookmarks()) { if (tp->HasCustomImage(IDR_THEME_NTP_BACKGROUND)) { const U8CPU kBackgroundOpacity = 204; // 80% opacity SkColor color = tp->GetColor(ThemeService::COLOR_NTP_BACKGROUND); if (gfx::IsInvertedColorScheme()) color = color_utils::InvertColor(color); if (SkColorGetA(color) > kBackgroundOpacity) color = SkColorSetA(color, kBackgroundOpacity); canvas->DrawColor(color); DetachableToolbarView::PaintHorizontalBorder(canvas, host_view_); } else { const SkColor kBorderColor = SkColorSetARGB(25, 0, 0, 0); // 10% black DetachableToolbarView::PaintHorizontalBorderWithColor( canvas, host_view_, kBorderColor); } } return; } int toolbar_overlap = host_view_->GetToolbarOverlap(); if (toolbar_overlap) toolbar_overlap += views::NonClientFrameView::kClientEdgeThickness; if (host_view_->IsDetached()) { int height = 0; WebContents* contents = chrome::GetActiveWebContents(browser_); if (contents && contents->GetView()) height = contents->GetView()->GetContainerSize().height(); NtpBackgroundUtil::PaintBackgroundDetachedMode( tp, canvas, gfx::Rect(0, toolbar_overlap, host_view_->width(), host_view_->height() - toolbar_overlap), height); double current_state = 1 - host_view_->GetAnimationValue(); double h_padding = static_cast(BookmarkBarView::kNewtabHorizontalPadding) * current_state; double v_padding = static_cast(BookmarkBarView::kNewtabVerticalPadding) * current_state; SkRect rect; double roundness = 0; DetachableToolbarView::CalculateContentArea(current_state, h_padding, v_padding, &rect, &roundness, host_view_); DetachableToolbarView::PaintContentAreaBackground(canvas, tp, rect, roundness); DetachableToolbarView::PaintContentAreaBorder(canvas, tp, rect, roundness); if (!toolbar_overlap) DetachableToolbarView::PaintHorizontalBorder(canvas, host_view_); } else { DetachableToolbarView::PaintBackgroundAttachedMode(canvas, host_view_, browser_view_->OffsetPointForToolbarBackgroundImage( gfx::Point(host_view_->GetMirroredX(), host_view_->y()))); if (host_view_->height() >= toolbar_overlap) DetachableToolbarView::PaintHorizontalBorder(canvas, host_view_); } } ",0 "void ShelfLayoutManager::OnSessionStateChanged( session_manager::SessionState state) { const bool was_adding_user = state_.IsAddingSecondaryUser(); const bool was_locked = state_.IsScreenLocked(); state_.session_state = state; MaybeUpdateShelfBackground(AnimationChangeType::ANIMATE); if (was_adding_user != state_.IsAddingSecondaryUser()) { UpdateShelfVisibilityAfterLoginUIChange(); return; } if (was_locked != state_.IsScreenLocked()) UpdateShelfVisibilityAfterLoginUIChange(); TargetBounds target_bounds; CalculateTargetBoundsAndUpdateWorkArea(&target_bounds); UpdateBoundsAndOpacity(target_bounds, true /* animate */, nullptr); UpdateVisibilityState(); } ",0 "struct task_group *sched_create_group(struct task_group *parent) { struct task_group *tg; unsigned long flags; tg = kzalloc(sizeof(*tg), GFP_KERNEL); if (!tg) return ERR_PTR(-ENOMEM); if (!alloc_fair_sched_group(tg, parent)) goto err; if (!alloc_rt_sched_group(tg, parent)) goto err; spin_lock_irqsave(&task_group_lock, flags); list_add_rcu(&tg->list, &task_groups); WARN_ON(!parent); /* root should already exist */ tg->parent = parent; INIT_LIST_HEAD(&tg->children); list_add_rcu(&tg->siblings, &parent->children); spin_unlock_irqrestore(&task_group_lock, flags); return tg; err: free_sched_group(tg); return ERR_PTR(-ENOMEM); } ",0 "ofputil_encode_resume(const struct ofputil_packet_in *pin, const struct ofpbuf *continuation, enum ofputil_protocol protocol) { enum ofp_version version = ofputil_protocol_to_ofp_version(protocol); size_t extra = pin->packet_len + NXM_TYPICAL_LEN + continuation->size; struct ofpbuf *msg = ofpraw_alloc_xid(OFPRAW_NXT_RESUME, version, 0, extra); ofputil_put_packet_in(pin, version, pin->packet_len, msg); ofpprop_put_nested(msg, NXPINT_CONTINUATION, continuation); ofpmsg_update_length(msg); return msg; } ",0 "IMPEG2D_ERROR_CODES_T impeg2d_dec_seq_scale_ext(dec_state_t *ps_dec) { UNUSED(ps_dec); return IMPEG2D_SCALABILITIY_NOT_SUPPORTED; } ",0 " CCLayerTreeHostTest() : m_beginning(false) , m_endWhenBeginReturns(false) , m_running(false) , m_timedOut(false) { m_webThread = adoptPtr(webKitPlatformSupport()->createThread(""CCLayerTreeHostTest"")); WebCompositor::setThread(m_webThread.get()); #if USE(THREADED_COMPOSITING) m_settings.enableCompositorThread = true; #else m_settings.enableCompositorThread = false; #endif } ",1 " ~SecurityState() { scheme_policy_.clear(); fileapi::IsolatedContext* isolated_context = fileapi::IsolatedContext::GetInstance(); for (FileSystemMap::iterator iter = filesystem_permissions_.begin(); iter != filesystem_permissions_.end(); ++iter) { isolated_context->RemoveReference(iter->first); } UMA_HISTOGRAM_COUNTS(""ChildProcessSecurityPolicy.PerChildFilePermissions"", file_permissions_.size()); } ",0 "static int StreamTcpPacketStateFinWait1(ThreadVars *tv, Packet *p, StreamTcpThread *stt, TcpSession *ssn, PacketQueue *pq) { if (ssn == NULL) return -1; if (p->tcph->th_flags & TH_RST) { if (!StreamTcpValidateRst(ssn, p)) return -1; StreamTcpPacketSetState(p, ssn, TCP_CLOSED); SCLogDebug(""ssn %p: Reset received state changed to TCP_CLOSED"", ssn); if (PKT_IS_TOSERVER(p)) { if ((p->tcph->th_flags & TH_ACK) && StreamTcpValidateAck(ssn, &ssn->server, p) == 0) StreamTcpUpdateLastAck(ssn, &ssn->server, StreamTcpResetGetMaxAck(&ssn->server, TCP_GET_ACK(p))); StreamTcpUpdateLastAck(ssn, &ssn->client, StreamTcpResetGetMaxAck(&ssn->client, TCP_GET_SEQ(p))); if (ssn->flags & STREAMTCP_FLAG_TIMESTAMP) { StreamTcpHandleTimestamp(ssn, p); } StreamTcpReassembleHandleSegment(tv, stt->ra_ctx, ssn, &ssn->client, p, pq); } else { if ((p->tcph->th_flags & TH_ACK) && StreamTcpValidateAck(ssn, &ssn->client, p) == 0) StreamTcpUpdateLastAck(ssn, &ssn->client, StreamTcpResetGetMaxAck(&ssn->client, TCP_GET_ACK(p))); StreamTcpUpdateLastAck(ssn, &ssn->server, StreamTcpResetGetMaxAck(&ssn->server, TCP_GET_SEQ(p))); if (ssn->flags & STREAMTCP_FLAG_TIMESTAMP) { StreamTcpHandleTimestamp(ssn, p); } StreamTcpReassembleHandleSegment(tv, stt->ra_ctx, ssn, &ssn->server, p, pq); } } else if ((p->tcph->th_flags & (TH_FIN|TH_ACK)) == (TH_FIN|TH_ACK)) { if (ssn->flags & STREAMTCP_FLAG_TIMESTAMP) { if (!StreamTcpValidateTimestamp(ssn, p)) return -1; } if (PKT_IS_TOSERVER(p)) { SCLogDebug(""ssn %p: pkt (%"" PRIu32 "") is to server: SEQ "" ""%"" PRIu32 "", ACK %"" PRIu32 """", ssn, p->payload_len, TCP_GET_SEQ(p), TCP_GET_ACK(p)); int retransmission = 0; if (StreamTcpPacketIsRetransmission(&ssn->client, p)) { SCLogDebug(""ssn %p: packet is retransmission"", ssn); retransmission = 1; } else if (SEQ_LT(TCP_GET_SEQ(p), ssn->client.next_seq) || SEQ_GT(TCP_GET_SEQ(p), (ssn->client.last_ack + ssn->client.window))) { SCLogDebug(""ssn %p: -> SEQ mismatch, packet SEQ %"" PRIu32 """" "" != %"" PRIu32 "" from stream"", ssn, TCP_GET_SEQ(p), ssn->client.next_seq); StreamTcpSetEvent(p, STREAM_FIN1_FIN_WRONG_SEQ); return -1; } if (StreamTcpValidateAck(ssn, &ssn->server, p) == -1) { SCLogDebug(""ssn %p: rejecting because of invalid ack value"", ssn); StreamTcpSetEvent(p, STREAM_FIN1_INVALID_ACK); return -1; } if (!retransmission) { StreamTcpPacketSetState(p, ssn, TCP_TIME_WAIT); SCLogDebug(""ssn %p: state changed to TCP_TIME_WAIT"", ssn); ssn->server.window = TCP_GET_WINDOW(p) << ssn->server.wscale; } StreamTcpUpdateLastAck(ssn, &ssn->server, TCP_GET_ACK(p)); if (ssn->flags & STREAMTCP_FLAG_TIMESTAMP) { StreamTcpHandleTimestamp(ssn, p); } /* Update the next_seq, in case if we have missed the client packet and server has already received and acked it */ if (SEQ_LT(ssn->server.next_seq, TCP_GET_ACK(p))) ssn->server.next_seq = TCP_GET_ACK(p); if (SEQ_EQ(ssn->client.next_seq, TCP_GET_SEQ(p))) { StreamTcpUpdateNextSeq(ssn, &ssn->client, (ssn->client.next_seq + p->payload_len)); } StreamTcpReassembleHandleSegment(tv, stt->ra_ctx, ssn, &ssn->client, p, pq); SCLogDebug(""ssn %p: =+ next SEQ %"" PRIu32 "", last ACK "" ""%"" PRIu32 """", ssn, ssn->client.next_seq, ssn->server.last_ack); } else { /* implied to client */ SCLogDebug(""ssn %p: pkt (%"" PRIu32 "") is to client: SEQ "" ""%"" PRIu32 "", ACK %"" PRIu32 """", ssn, p->payload_len, TCP_GET_SEQ(p), TCP_GET_ACK(p)); int retransmission = 0; if (StreamTcpPacketIsRetransmission(&ssn->server, p)) { SCLogDebug(""ssn %p: packet is retransmission"", ssn); retransmission = 1; } else if (SEQ_LT(TCP_GET_SEQ(p), ssn->server.next_seq) || SEQ_GT(TCP_GET_SEQ(p), (ssn->server.last_ack + ssn->server.window))) { SCLogDebug(""ssn %p: -> SEQ mismatch, packet SEQ %"" PRIu32 """" "" != %"" PRIu32 "" from stream"", ssn, TCP_GET_SEQ(p), ssn->server.next_seq); StreamTcpSetEvent(p, STREAM_FIN1_FIN_WRONG_SEQ); return -1; } if (StreamTcpValidateAck(ssn, &ssn->client, p) == -1) { SCLogDebug(""ssn %p: rejecting because of invalid ack value"", ssn); StreamTcpSetEvent(p, STREAM_FIN1_INVALID_ACK); return -1; } if (!retransmission) { StreamTcpPacketSetState(p, ssn, TCP_TIME_WAIT); SCLogDebug(""ssn %p: state changed to TCP_TIME_WAIT"", ssn); ssn->client.window = TCP_GET_WINDOW(p) << ssn->client.wscale; } StreamTcpUpdateLastAck(ssn, &ssn->client, TCP_GET_ACK(p)); if (ssn->flags & STREAMTCP_FLAG_TIMESTAMP) { StreamTcpHandleTimestamp(ssn, p); } /* Update the next_seq, in case if we have missed the client packet and server has already received and acked it */ if (SEQ_LT(ssn->client.next_seq, TCP_GET_ACK(p))) ssn->client.next_seq = TCP_GET_ACK(p); if (SEQ_EQ(ssn->server.next_seq, TCP_GET_SEQ(p))) { StreamTcpUpdateNextSeq(ssn, &ssn->server, (ssn->server.next_seq + p->payload_len)); } StreamTcpReassembleHandleSegment(tv, stt->ra_ctx, ssn, &ssn->server, p, pq); SCLogDebug(""ssn %p: =+ next SEQ %"" PRIu32 "", last ACK "" ""%"" PRIu32 """", ssn, ssn->server.next_seq, ssn->client.last_ack); } } else if (p->tcph->th_flags & TH_FIN) { if (ssn->flags & STREAMTCP_FLAG_TIMESTAMP) { if (!StreamTcpValidateTimestamp(ssn, p)) return -1; } if (PKT_IS_TOSERVER(p)) { SCLogDebug(""ssn %p: pkt (%"" PRIu32 "") is to server: SEQ "" ""%"" PRIu32 "", ACK %"" PRIu32 """", ssn, p->payload_len, TCP_GET_SEQ(p), TCP_GET_ACK(p)); int retransmission = 0; if (StreamTcpPacketIsRetransmission(&ssn->client, p)) { SCLogDebug(""ssn %p: packet is retransmission"", ssn); retransmission = 1; } else if (SEQ_LT(TCP_GET_SEQ(p), ssn->client.next_seq) || SEQ_GT(TCP_GET_SEQ(p), (ssn->client.last_ack + ssn->client.window))) { SCLogDebug(""ssn %p: -> SEQ mismatch, packet SEQ %"" PRIu32 """" "" != %"" PRIu32 "" from stream"", ssn, TCP_GET_SEQ(p), ssn->client.next_seq); StreamTcpSetEvent(p, STREAM_FIN1_FIN_WRONG_SEQ); return -1; } if (StreamTcpValidateAck(ssn, &ssn->server, p) == -1) { SCLogDebug(""ssn %p: rejecting because of invalid ack value"", ssn); StreamTcpSetEvent(p, STREAM_FIN1_INVALID_ACK); return -1; } if (!retransmission) { StreamTcpPacketSetState(p, ssn, TCP_CLOSING); SCLogDebug(""ssn %p: state changed to TCP_CLOSING"", ssn); ssn->server.window = TCP_GET_WINDOW(p) << ssn->server.wscale; } StreamTcpUpdateLastAck(ssn, &ssn->server, TCP_GET_ACK(p)); if (ssn->flags & STREAMTCP_FLAG_TIMESTAMP) { StreamTcpHandleTimestamp(ssn, p); } /* Update the next_seq, in case if we have missed the client packet and server has already received and acked it */ if (SEQ_LT(ssn->server.next_seq, TCP_GET_ACK(p))) ssn->server.next_seq = TCP_GET_ACK(p); if (SEQ_EQ(ssn->client.next_seq, TCP_GET_SEQ(p))) { StreamTcpUpdateNextSeq(ssn, &ssn->client, (ssn->client.next_seq + p->payload_len)); } StreamTcpReassembleHandleSegment(tv, stt->ra_ctx, ssn, &ssn->client, p, pq); SCLogDebug(""ssn %p: =+ next SEQ %"" PRIu32 "", last ACK "" ""%"" PRIu32 """", ssn, ssn->client.next_seq, ssn->server.last_ack); } else { /* implied to client */ SCLogDebug(""ssn %p: pkt (%"" PRIu32 "") is to client: SEQ "" ""%"" PRIu32 "", ACK %"" PRIu32 """", ssn, p->payload_len, TCP_GET_SEQ(p), TCP_GET_ACK(p)); int retransmission = 0; if (StreamTcpPacketIsRetransmission(&ssn->server, p)) { SCLogDebug(""ssn %p: packet is retransmission"", ssn); retransmission = 1; } else if (SEQ_LT(TCP_GET_SEQ(p), ssn->server.next_seq) || SEQ_GT(TCP_GET_SEQ(p), (ssn->server.last_ack + ssn->server.window))) { SCLogDebug(""ssn %p: -> SEQ mismatch, packet SEQ %"" PRIu32 """" "" != %"" PRIu32 "" from stream"", ssn, TCP_GET_SEQ(p), ssn->server.next_seq); StreamTcpSetEvent(p, STREAM_FIN1_FIN_WRONG_SEQ); return -1; } if (StreamTcpValidateAck(ssn, &ssn->client, p) == -1) { SCLogDebug(""ssn %p: rejecting because of invalid ack value"", ssn); StreamTcpSetEvent(p, STREAM_FIN1_INVALID_ACK); return -1; } if (!retransmission) { StreamTcpPacketSetState(p, ssn, TCP_CLOSING); SCLogDebug(""ssn %p: state changed to TCP_CLOSING"", ssn); ssn->client.window = TCP_GET_WINDOW(p) << ssn->client.wscale; } StreamTcpUpdateLastAck(ssn, &ssn->client, TCP_GET_ACK(p)); if (ssn->flags & STREAMTCP_FLAG_TIMESTAMP) { StreamTcpHandleTimestamp(ssn, p); } /* Update the next_seq, in case if we have missed the client packet and server has already received and acked it */ if (SEQ_LT(ssn->client.next_seq, TCP_GET_ACK(p))) ssn->client.next_seq = TCP_GET_ACK(p); if (SEQ_EQ(ssn->server.next_seq, TCP_GET_SEQ(p))) { StreamTcpUpdateNextSeq(ssn, &ssn->server, (ssn->server.next_seq + p->payload_len)); } StreamTcpReassembleHandleSegment(tv, stt->ra_ctx, ssn, &ssn->server, p, pq); SCLogDebug(""ssn %p: =+ next SEQ %"" PRIu32 "", last ACK "" ""%"" PRIu32 """", ssn, ssn->server.next_seq, ssn->client.last_ack); } } else if (p->tcph->th_flags & TH_SYN) { SCLogDebug(""ssn (%p): SYN pkt on FinWait1"", ssn); StreamTcpSetEvent(p, STREAM_SHUTDOWN_SYN_RESEND); return -1; } else if (p->tcph->th_flags & TH_ACK) { if (ssn->flags & STREAMTCP_FLAG_TIMESTAMP) { if (!StreamTcpValidateTimestamp(ssn, p)) return -1; } if (PKT_IS_TOSERVER(p)) { SCLogDebug(""ssn %p: pkt (%"" PRIu32 "") is to server: SEQ "" ""%"" PRIu32 "", ACK %"" PRIu32 """", ssn, p->payload_len, TCP_GET_SEQ(p), TCP_GET_ACK(p)); int retransmission = 0; if (StreamTcpPacketIsRetransmission(&ssn->client, p)) { SCLogDebug(""ssn %p: packet is retransmission"", ssn); retransmission = 1; } if (StreamTcpValidateAck(ssn, &ssn->server, p) == -1) { SCLogDebug(""ssn %p: rejecting because of invalid ack value"", ssn); StreamTcpSetEvent(p, STREAM_FIN1_INVALID_ACK); return -1; } if (!retransmission) { if (SEQ_LEQ(TCP_GET_SEQ(p) + p->payload_len, ssn->client.next_win) || (ssn->flags & (STREAMTCP_FLAG_MIDSTREAM|STREAMTCP_FLAG_ASYNC))) { SCLogDebug(""ssn %p: seq %""PRIu32"" in window, ssn->client.next_win "" ""%"" PRIu32 """", ssn, TCP_GET_SEQ(p), ssn->client.next_win); if (TCP_GET_SEQ(p) == ssn->client.next_seq) { StreamTcpPacketSetState(p, ssn, TCP_FIN_WAIT2); SCLogDebug(""ssn %p: state changed to TCP_FIN_WAIT2"", ssn); } } else { SCLogDebug(""ssn %p: -> SEQ mismatch, packet SEQ %"" PRIu32 """" "" != %"" PRIu32 "" from stream"", ssn, TCP_GET_SEQ(p), ssn->client.next_seq); StreamTcpSetEvent(p, STREAM_FIN1_ACK_WRONG_SEQ); return -1; } ssn->server.window = TCP_GET_WINDOW(p) << ssn->server.wscale; } StreamTcpUpdateLastAck(ssn, &ssn->server, TCP_GET_ACK(p)); if (ssn->flags & STREAMTCP_FLAG_TIMESTAMP) { StreamTcpHandleTimestamp(ssn, p); } /* Update the next_seq, in case if we have missed the client packet and server has already received and acked it */ if (SEQ_LT(ssn->server.next_seq, TCP_GET_ACK(p))) ssn->server.next_seq = TCP_GET_ACK(p); if (SEQ_EQ(ssn->client.next_seq, TCP_GET_SEQ(p))) { StreamTcpUpdateNextSeq(ssn, &ssn->client, (ssn->client.next_seq + p->payload_len)); } StreamTcpSackUpdatePacket(&ssn->server, p); /* update next_win */ StreamTcpUpdateNextWin(ssn, &ssn->server, (ssn->server.last_ack + ssn->server.window)); StreamTcpReassembleHandleSegment(tv, stt->ra_ctx, ssn, &ssn->client, p, pq); SCLogDebug(""ssn %p: =+ next SEQ %"" PRIu32 "", last ACK "" ""%"" PRIu32 """", ssn, ssn->client.next_seq, ssn->server.last_ack); } else { /* implied to client */ SCLogDebug(""ssn %p: pkt (%"" PRIu32 "") is to client: SEQ "" ""%"" PRIu32 "", ACK %"" PRIu32 """", ssn, p->payload_len, TCP_GET_SEQ(p), TCP_GET_ACK(p)); int retransmission = 0; if (StreamTcpPacketIsRetransmission(&ssn->server, p)) { SCLogDebug(""ssn %p: packet is retransmission"", ssn); retransmission = 1; } if (StreamTcpValidateAck(ssn, &ssn->client, p) == -1) { SCLogDebug(""ssn %p: rejecting because of invalid ack value"", ssn); StreamTcpSetEvent(p, STREAM_FIN1_INVALID_ACK); return -1; } if (!retransmission) { if (SEQ_LEQ(TCP_GET_SEQ(p) + p->payload_len, ssn->server.next_win) || (ssn->flags & (STREAMTCP_FLAG_MIDSTREAM|STREAMTCP_FLAG_ASYNC))) { SCLogDebug(""ssn %p: seq %""PRIu32"" in window, ssn->server.next_win "" ""%"" PRIu32 """", ssn, TCP_GET_SEQ(p), ssn->server.next_win); if (TCP_GET_SEQ(p) == ssn->server.next_seq) { StreamTcpPacketSetState(p, ssn, TCP_FIN_WAIT2); SCLogDebug(""ssn %p: state changed to TCP_FIN_WAIT2"", ssn); } } else { SCLogDebug(""ssn %p: -> SEQ mismatch, packet SEQ %"" PRIu32 """" "" != %"" PRIu32 "" from stream"", ssn, TCP_GET_SEQ(p), ssn->server.next_seq); StreamTcpSetEvent(p, STREAM_FIN1_ACK_WRONG_SEQ); return -1; } ssn->client.window = TCP_GET_WINDOW(p) << ssn->client.wscale; } StreamTcpUpdateLastAck(ssn, &ssn->client, TCP_GET_ACK(p)); if (ssn->flags & STREAMTCP_FLAG_TIMESTAMP) { StreamTcpHandleTimestamp(ssn, p); } /* Update the next_seq, in case if we have missed the client packet and server has already received and acked it */ if (SEQ_LT(ssn->client.next_seq, TCP_GET_ACK(p))) ssn->client.next_seq = TCP_GET_ACK(p); if (SEQ_EQ(ssn->server.next_seq, TCP_GET_SEQ(p))) { StreamTcpUpdateNextSeq(ssn, &ssn->server, (ssn->server.next_seq + p->payload_len)); } StreamTcpSackUpdatePacket(&ssn->client, p); /* update next_win */ StreamTcpUpdateNextWin(ssn, &ssn->client, (ssn->client.last_ack + ssn->client.window)); StreamTcpReassembleHandleSegment(tv, stt->ra_ctx, ssn, &ssn->server, p, pq); SCLogDebug(""ssn %p: =+ next SEQ %"" PRIu32 "", last ACK "" ""%"" PRIu32 """", ssn, ssn->server.next_seq, ssn->client.last_ack); } } else { SCLogDebug(""ssn (%p): default case"", ssn); } return 0; } ",0 "void fb_append_extra_logo(const struct linux_logo *logo, unsigned int n) { if (!n || fb_logo_ex_num == FB_LOGO_EX_NUM_MAX) return; fb_logo_ex[fb_logo_ex_num].logo = logo; fb_logo_ex[fb_logo_ex_num].n = n; fb_logo_ex_num++; } ",0 "NaClProcessHost::~NaClProcessHost() { #ifndef DISABLE_NACL for (size_t i = 0; i < internal_->sockets_for_renderer.size(); i++) { if (nacl::Close(internal_->sockets_for_renderer[i]) != 0) { LOG(ERROR) << ""nacl::Close() failed""; } } for (size_t i = 0; i < internal_->sockets_for_sel_ldr.size(); i++) { if (nacl::Close(internal_->sockets_for_sel_ldr[i]) != 0) { LOG(ERROR) << ""nacl::Close() failed""; } } #endif if (reply_msg_) { reply_msg_->set_reply_error(); chrome_render_message_filter_->Send(reply_msg_); } } ",0 "bool HTMLTextAreaElement::hasCustomFocusLogic() const { return true; } ",0 "void h264bsdFreeDpb(dpbStorage_t *dpb) { /* Variables */ u32 i; /* Code */ ASSERT(dpb); if (dpb->buffer) { for (i = 0; i < dpb->dpbSize+1; i++) { FREE(dpb->buffer[i].pAllocatedData); } } FREE(dpb->buffer); FREE(dpb->list); FREE(dpb->outBuf); } ",0 "static int sctp_inet6_bind_verify(struct sctp_sock *opt, union sctp_addr *addr) { struct sctp_af *af; /* ASSERT: address family has already been verified. */ if (addr->sa.sa_family != AF_INET6) af = sctp_get_af_specific(addr->sa.sa_family); else { int type = ipv6_addr_type(&addr->v6.sin6_addr); struct net_device *dev; if (type & IPV6_ADDR_LINKLOCAL) { struct net *net; if (!addr->v6.sin6_scope_id) return 0; net = sock_net(&opt->inet.sk); rcu_read_lock(); dev = dev_get_by_index_rcu(net, addr->v6.sin6_scope_id); if (!dev || !ipv6_chk_addr(net, &addr->v6.sin6_addr, dev, 0)) { rcu_read_unlock(); return 0; } rcu_read_unlock(); } af = opt->pf->af; } return af->available(addr, opt); } ",0 "void InputMethodIBus::ProcessKeyEventDone(uint32 id, XEvent* event, uint32 ibus_keyval, uint32 ibus_keycode, uint32 ibus_state, bool is_handled) { DCHECK(event); std::set::iterator it = pending_key_events_.find(id); if (it == pending_key_events_.end()) return; // Abandoned key event. if (event->type == KeyPress) { if (is_handled) { character_composer_.Reset(); } else { is_handled = ExecuteCharacterComposer(ibus_keyval, ibus_keycode, ibus_state); } } if (event->type == KeyPress || event->type == KeyRelease) ProcessKeyEventPostIME(event, ibus_state, is_handled); pending_key_events_.erase(id); } ",0 "static MagickBooleanType ConstructOrdering(const size_t count, const DDSVector4 *points, const DDSVector3 axis, DDSVector4 *pointsWeights, DDSVector4 *xSumwSum, unsigned char *order, size_t iteration) { float dps[16], f; register ssize_t i; size_t j; unsigned char c, *o, *p; o = order + (16*iteration); for (i=0; i < (ssize_t) count; i++) { dps[i] = Dot(points[i],axis); o[i] = (unsigned char)i; } for (i=0; i < (ssize_t) count; i++) { for (j=i; j > 0 && dps[j] < dps[j - 1]; j--) { f = dps[j]; dps[j] = dps[j - 1]; dps[j - 1] = f; c = o[j]; o[j] = o[j - 1]; o[j - 1] = c; } } for (i=0; i < (ssize_t) iteration; i++) { MagickBooleanType same; p = order + (16*i); same = MagickTrue; for (j=0; j < count; j++) { if (o[j] != p[j]) { same = MagickFalse; break; } } if (same != MagickFalse) return MagickFalse; } xSumwSum->x = 0; xSumwSum->y = 0; xSumwSum->z = 0; xSumwSum->w = 0; for (i=0; i < (ssize_t) count; i++) { DDSVector4 v; j = (size_t) o[i]; v.x = points[j].w * points[j].x; v.y = points[j].w * points[j].y; v.z = points[j].w * points[j].z; v.w = points[j].w * 1.0f; VectorCopy44(v,&pointsWeights[i]); VectorAdd(*xSumwSum,v,xSumwSum); } return MagickTrue; } ",0 "void Eval16nop1D(register const cmsUInt16Number Input[], register cmsUInt16Number Output[], register const struct _cms_interp_struc* p) { Output[0] = Input[0]; cmsUNUSED_PARAMETER(p); } ",0 "void DevToolsUIBindings::ZoomIn() { zoom::PageZoom::Zoom(web_contents(), content::PAGE_ZOOM_IN); } ",0 "GF_Err hvcc_Read(GF_Box *s, GF_BitStream *bs) { u64 pos; GF_HEVCConfigurationBox *ptr = (GF_HEVCConfigurationBox *)s; if (ptr->config) gf_odf_hevc_cfg_del(ptr->config); pos = gf_bs_get_position(bs); ptr->config = gf_odf_hevc_cfg_read_bs(bs, (s->type == GF_ISOM_BOX_TYPE_HVCC) ? GF_FALSE : GF_TRUE); pos = gf_bs_get_position(bs) - pos ; if (pos < ptr->size) ptr->size -= (u32) pos; return ptr->config ? GF_OK : GF_ISOM_INVALID_FILE; } ",0 "void HTMLFormControlElement::didMoveToNewDocument(Document& oldDocument) { FormAssociatedElement::didMoveToNewDocument(oldDocument); HTMLElement::didMoveToNewDocument(oldDocument); } ",0 "void ChromeContentBrowserClient::BrowserURLHandlerCreated( BrowserURLHandler* handler) { handler->AddHandlerPair(&ExtensionWebUI::HandleChromeURLOverride, BrowserURLHandler::null_handler()); handler->AddHandlerPair(BrowserURLHandler::null_handler(), &ExtensionWebUI::HandleChromeURLOverrideReverse); handler->AddHandlerPair(&WillHandleBrowserAboutURL, BrowserURLHandler::null_handler()); handler->AddHandlerPair(&HandleWebUI, &HandleWebUIReverse); } ",0 "void WebContentsImpl::ExecuteEditCommand( const std::string& command, const base::Optional& value) { RenderFrameHostImpl* focused_frame = GetFocusedFrame(); if (!focused_frame) return; focused_frame->GetFrameInputHandler()->ExecuteEditCommand(command, value); } ",0 "copy_opt_env(OptEnv* to, OptEnv* from) { *to = *from; } ",0 "struct sock *inet_csk_accept(struct sock *sk, int flags, int *err, bool kern) { struct inet_connection_sock *icsk = inet_csk(sk); struct request_sock_queue *queue = &icsk->icsk_accept_queue; struct request_sock *req; struct sock *newsk; int error; lock_sock(sk); /* We need to make sure that this socket is listening, * and that it has something pending. */ error = -EINVAL; if (sk->sk_state != TCP_LISTEN) goto out_err; /* Find already established connection */ if (reqsk_queue_empty(queue)) { long timeo = sock_rcvtimeo(sk, flags & O_NONBLOCK); /* If this is a non blocking socket don't sleep */ error = -EAGAIN; if (!timeo) goto out_err; error = inet_csk_wait_for_connect(sk, timeo); if (error) goto out_err; } req = reqsk_queue_remove(queue, sk); newsk = req->sk; if (sk->sk_protocol == IPPROTO_TCP && tcp_rsk(req)->tfo_listener) { spin_lock_bh(&queue->fastopenq.lock); if (tcp_rsk(req)->tfo_listener) { /* We are still waiting for the final ACK from 3WHS * so can't free req now. Instead, we set req->sk to * NULL to signify that the child socket is taken * so reqsk_fastopen_remove() will free the req * when 3WHS finishes (or is aborted). */ req->sk = NULL; req = NULL; } spin_unlock_bh(&queue->fastopenq.lock); } out: release_sock(sk); if (req) reqsk_put(req); return newsk; out_err: newsk = NULL; req = NULL; *err = error; goto out; } ",0 "void PrintPreviewHandler::OnPrintDialogShown() { ActivateInitiatorTabAndClosePreviewTab(); } ",0 "uint8_t clip_pixel(int x) { return x < 0 ? 0 : x > 255 ? 255 : x; } ",0 "WebPreferences TestRenderViewHost::TestComputeWebkitPrefs() { return ComputeWebkitPrefs(); } ",0 "MagickExport MagickBooleanType OrderedPosterizeImageChannel(Image *image, const ChannelType channel,const char *threshold_map,ExceptionInfo *exception) { #define DitherImageTag ""Dither/Image"" CacheView *image_view; LongPixelPacket levels; MagickBooleanType status; MagickOffsetType progress; ssize_t y; ThresholdMap *map; assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"",image->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); if (threshold_map == (const char *) NULL) return(MagickTrue); { char token[MaxTextExtent]; register const char *p; p=(char *)threshold_map; while (((isspace((int) ((unsigned char) *p)) != 0) || (*p == ',')) && (*p != '\0')) p++; threshold_map=p; while (((isspace((int) ((unsigned char) *p)) == 0) && (*p != ',')) && (*p != '\0')) { if ((p-threshold_map) >= (MaxTextExtent-1)) break; token[p-threshold_map] = *p; p++; } token[p-threshold_map] = '\0'; map = GetThresholdMap(token, exception); if ( map == (ThresholdMap *) NULL ) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, ""InvalidArgument"",""%s : '%s'"",""ordered-dither"",threshold_map); return(MagickFalse); } } /* Set channel levels from extra comma separated arguments Default to 2, the single value given, or individual channel values */ #if 1 { /* parse directly as a comma separated list of integers */ char *p; p = strchr((char *) threshold_map,','); if ( p != (char *) NULL && isdigit((int) ((unsigned char) *(++p))) ) levels.index = (unsigned int) strtoul(p, &p, 10); else levels.index = 2; levels.red = ((channel & RedChannel ) != 0) ? levels.index : 0; levels.green = ((channel & GreenChannel) != 0) ? levels.index : 0; levels.blue = ((channel & BlueChannel) != 0) ? levels.index : 0; levels.opacity = ((channel & OpacityChannel) != 0) ? levels.index : 0; levels.index = ((channel & IndexChannel) != 0 && (image->colorspace == CMYKColorspace)) ? levels.index : 0; /* if more than a single number, each channel has a separate value */ if ( p != (char *) NULL && *p == ',' ) { p=strchr((char *) threshold_map,','); p++; if ((channel & RedChannel) != 0) levels.red = (unsigned int) strtoul(p, &p, 10), (void)(*p == ',' && p++); if ((channel & GreenChannel) != 0) levels.green = (unsigned int) strtoul(p, &p, 10), (void)(*p == ',' && p++); if ((channel & BlueChannel) != 0) levels.blue = (unsigned int) strtoul(p, &p, 10), (void)(*p == ',' && p++); if ((channel & IndexChannel) != 0 && image->colorspace == CMYKColorspace) levels.index=(unsigned int) strtoul(p, &p, 10), (void)(*p == ',' && p++); if ((channel & OpacityChannel) != 0) levels.opacity = (unsigned int) strtoul(p, &p, 10), (void)(*p == ',' && p++); } } #else /* Parse level values as a geometry */ /* This difficult! * How to map GeometryInfo structure elements into * LongPixelPacket structure elements, but according to channel? * Note the channels list may skip elements!!!! * EG -channel BA -ordered-dither map,2,3 * will need to map g.rho -> l.blue, and g.sigma -> l.opacity * A simpler way is needed, probably converting geometry to a temporary * array, then using channel to advance the index into ssize_t pixel packet. */ #endif #if 0 printf(""DEBUG levels r=%u g=%u b=%u a=%u i=%u\n"", levels.red, levels.green, levels.blue, levels.opacity, levels.index); #endif { /* Do the posterized ordered dithering of the image */ ssize_t d; /* d = number of psuedo-level divisions added between color levels */ d = map->divisor-1; /* reduce levels to levels - 1 */ levels.red = levels.red ? levels.red-1 : 0; levels.green = levels.green ? levels.green-1 : 0; levels.blue = levels.blue ? levels.blue-1 : 0; levels.opacity = levels.opacity ? levels.opacity-1 : 0; levels.index = levels.index ? levels.index-1 : 0; if (SetImageStorageClass(image,DirectClass) == MagickFalse) { InheritException(exception,&image->exception); return(MagickFalse); } status=MagickTrue; progress=0; image_view=AcquireAuthenticCacheView(image,exception); #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static) shared(progress,status) \ magick_number_threads(image,image,image->rows,1) #endif for (y=0; y < (ssize_t) image->rows; y++) { register IndexPacket *magick_restrict indexes; register ssize_t x; register PixelPacket *magick_restrict q; if (status == MagickFalse) continue; q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception); if (q == (PixelPacket *) NULL) { status=MagickFalse; continue; } indexes=GetCacheViewAuthenticIndexQueue(image_view); for (x=0; x < (ssize_t) image->columns; x++) { register ssize_t threshold, t, l; /* Figure out the dither threshold for this pixel This must be a integer from 1 to map->divisor-1 */ threshold = map->levels[(x%map->width) +map->width*(y%map->height)]; /* Dither each channel in the image as appropriate Notes on the integer Math... total number of divisions = (levels-1)*(divisor-1)+1) t1 = this colors psuedo_level = q->red * total_divisions / (QuantumRange+1) l = posterization level 0..levels t = dither threshold level 0..divisor-1 NB: 0 only on last Each color_level is of size QuantumRange / (levels-1) NB: All input levels and divisor are already had 1 subtracted Opacity is inverted so 'off' represents transparent. */ if (levels.red) { t = (ssize_t) (QuantumScale*GetPixelRed(q)*(levels.red*d+1)); l = t/d; t = t-l*d; SetPixelRed(q,ClampToQuantum((MagickRealType) ((l+(t >= threshold))*(MagickRealType) QuantumRange/levels.red))); } if (levels.green) { t = (ssize_t) (QuantumScale*GetPixelGreen(q)* (levels.green*d+1)); l = t/d; t = t-l*d; SetPixelGreen(q,ClampToQuantum((MagickRealType) ((l+(t >= threshold))*(MagickRealType) QuantumRange/levels.green))); } if (levels.blue) { t = (ssize_t) (QuantumScale*GetPixelBlue(q)* (levels.blue*d+1)); l = t/d; t = t-l*d; SetPixelBlue(q,ClampToQuantum((MagickRealType) ((l+(t >= threshold))*(MagickRealType) QuantumRange/levels.blue))); } if (levels.opacity) { t = (ssize_t) ((1.0-QuantumScale*GetPixelOpacity(q))* (levels.opacity*d+1)); l = t/d; t = t-l*d; SetPixelOpacity(q,ClampToQuantum((MagickRealType) ((1.0-l-(t >= threshold))*(MagickRealType) QuantumRange/ levels.opacity))); } if (levels.index) { t = (ssize_t) (QuantumScale*GetPixelIndex(indexes+x)* (levels.index*d+1)); l = t/d; t = t-l*d; SetPixelIndex(indexes+x,ClampToQuantum((MagickRealType) ((l+ (t>=threshold))*(MagickRealType) QuantumRange/levels.index))); } q++; } if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse) status=MagickFalse; if (image->progress_monitor != (MagickProgressMonitor) NULL) { MagickBooleanType proceed; #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp atomic #endif progress++; proceed=SetImageProgress(image,DitherImageTag,progress,image->rows); if (proceed == MagickFalse) status=MagickFalse; } } image_view=DestroyCacheView(image_view); } map=DestroyThresholdMap(map); return(MagickTrue); } ",0 "static void reqsk_timer_handler(unsigned long data) { struct request_sock *req = (struct request_sock *)data; struct sock *sk_listener = req->rsk_listener; struct net *net = sock_net(sk_listener); struct inet_connection_sock *icsk = inet_csk(sk_listener); struct request_sock_queue *queue = &icsk->icsk_accept_queue; int qlen, expire = 0, resend = 0; int max_retries, thresh; u8 defer_accept; if (sk_state_load(sk_listener) != TCP_LISTEN) goto drop; max_retries = icsk->icsk_syn_retries ? : net->ipv4.sysctl_tcp_synack_retries; thresh = max_retries; /* Normally all the openreqs are young and become mature * (i.e. converted to established socket) for first timeout. * If synack was not acknowledged for 1 second, it means * one of the following things: synack was lost, ack was lost, * rtt is high or nobody planned to ack (i.e. synflood). * When server is a bit loaded, queue is populated with old * open requests, reducing effective size of queue. * When server is well loaded, queue size reduces to zero * after several minutes of work. It is not synflood, * it is normal operation. The solution is pruning * too old entries overriding normal timeout, when * situation becomes dangerous. * * Essentially, we reserve half of room for young * embrions; and abort old ones without pity, if old * ones are about to clog our table. */ qlen = reqsk_queue_len(queue); if ((qlen << 1) > max(8U, sk_listener->sk_max_ack_backlog)) { int young = reqsk_queue_len_young(queue) << 1; while (thresh > 2) { if (qlen < young) break; thresh--; young <<= 1; } } defer_accept = READ_ONCE(queue->rskq_defer_accept); if (defer_accept) max_retries = defer_accept; syn_ack_recalc(req, thresh, max_retries, defer_accept, &expire, &resend); req->rsk_ops->syn_ack_timeout(req); if (!expire && (!resend || !inet_rtx_syn_ack(sk_listener, req) || inet_rsk(req)->acked)) { unsigned long timeo; if (req->num_timeout++ == 0) atomic_dec(&queue->young); timeo = min(TCP_TIMEOUT_INIT << req->num_timeout, TCP_RTO_MAX); mod_timer(&req->rsk_timer, jiffies + timeo); return; } drop: inet_csk_reqsk_queue_drop_and_put(sk_listener, req); } ",0 "static void nullableStringAttributeAttributeGetterCallback(v8::Local, const v8::PropertyCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMGetter""); TestObjectPythonV8Internal::nullableStringAttributeAttributeGetter(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "void EVP_EncodeInit(EVP_ENCODE_CTX *ctx) { ctx->length = 48; ctx->num = 0; ctx->line_num = 0; } ",0 "ZEND_METHOD(CURLFile, setPostFilename) { curlfile_set_property(""postname"", INTERNAL_FUNCTION_PARAM_PASSTHRU); } ",0 "void RenderWidgetHostImpl::ForwardMouseEvent(const WebMouseEvent& mouse_event) { if (GetView()->IsInVR() && (is_in_gesture_scroll_[blink::kWebGestureDeviceTouchpad] || is_in_touchpad_gesture_fling_)) { return; } ForwardMouseEventWithLatencyInfo(mouse_event, ui::LatencyInfo(ui::SourceEventType::MOUSE)); if (owner_delegate_) owner_delegate_->RenderWidgetDidForwardMouseEvent(mouse_event); } ",0 "static void tcp_mark_head_lost(struct sock *sk, int packets, int mark_head) { struct tcp_sock *tp = tcp_sk(sk); struct sk_buff *skb; int cnt, oldcnt, lost; unsigned int mss; /* Use SACK to deduce losses of new sequences sent during recovery */ const u32 loss_high = tcp_is_sack(tp) ? tp->snd_nxt : tp->high_seq; WARN_ON(packets > tp->packets_out); if (tp->lost_skb_hint) { skb = tp->lost_skb_hint; cnt = tp->lost_cnt_hint; /* Head already handled? */ if (mark_head && skb != tcp_write_queue_head(sk)) return; } else { skb = tcp_write_queue_head(sk); cnt = 0; } tcp_for_write_queue_from(skb, sk) { if (skb == tcp_send_head(sk)) break; /* TODO: do this better */ /* this is not the most efficient way to do this... */ tp->lost_skb_hint = skb; tp->lost_cnt_hint = cnt; if (after(TCP_SKB_CB(skb)->end_seq, loss_high)) break; oldcnt = cnt; if (tcp_is_fack(tp) || tcp_is_reno(tp) || (TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED)) cnt += tcp_skb_pcount(skb); if (cnt > packets) { if ((tcp_is_sack(tp) && !tcp_is_fack(tp)) || (TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED) || (oldcnt >= packets)) break; mss = tcp_skb_mss(skb); /* If needed, chop off the prefix to mark as lost. */ lost = (packets - oldcnt) * mss; if (lost < skb->len && tcp_fragment(sk, skb, lost, mss, GFP_ATOMIC) < 0) break; cnt = packets; } tcp_skb_mark_lost(tp, skb); if (mark_head) break; } tcp_verify_left_out(tp); } ",0 "bool GetURLFromValue(const base::Value* in_value, std::string* out_value) { return in_value && out_value && in_value->GetAsString(out_value); } ",0 "build_model(XML_Parser parser) { DTD *const dtd = parser->m_dtd; /* save one level of indirection */ XML_Content *ret; XML_Content *cpos; XML_Char *str; int allocsize = (dtd->scaffCount * sizeof(XML_Content) + (dtd->contentStringLen * sizeof(XML_Char))); ret = (XML_Content *)MALLOC(parser, allocsize); if (! ret) return NULL; str = (XML_Char *)(&ret[dtd->scaffCount]); cpos = &ret[1]; build_node(parser, 0, ret, &cpos, &str); return ret; } ",0 "mrb_io_read_data_pending(mrb_state *mrb, mrb_value io) { mrb_value buf = mrb_iv_get(mrb, io, mrb_intern_cstr(mrb, ""@buf"")); if (mrb_type(buf) == MRB_TT_STRING && RSTRING_LEN(buf) > 0) { return 1; } return 0; } ",0 "void CameraService::onFirstRef() { LOG1(""CameraService::onFirstRef""); BnCameraService::onFirstRef(); if (hw_get_module(CAMERA_HARDWARE_MODULE_ID, (const hw_module_t **)&mModule) < 0) { ALOGE(""Could not load camera HAL module""); mNumberOfCameras = 0; } else { ALOGI(""Loaded \""%s\"" camera module"", mModule->common.name); mNumberOfCameras = mModule->get_number_of_cameras(); if (mNumberOfCameras > MAX_CAMERAS) { ALOGE(""Number of cameras(%d) > MAX_CAMERAS(%d)."", mNumberOfCameras, MAX_CAMERAS); mNumberOfCameras = MAX_CAMERAS; } for (int i = 0; i < mNumberOfCameras; i++) { setCameraFree(i); } if (mModule->common.module_api_version >= CAMERA_MODULE_API_VERSION_2_1) { mModule->set_callbacks(this); } CameraDeviceFactory::registerService(this); } } ",0 "bool OxideQQuickWebView::canGoBack() const { Q_D(const OxideQQuickWebView); if (!d->proxy_) { return false; } return d->proxy_->canGoBack(); } ",0 "ext4_ext_binsearch(struct inode *inode, struct ext4_ext_path *path, ext4_lblk_t block) { struct ext4_extent_header *eh = path->p_hdr; struct ext4_extent *r, *l, *m; if (eh->eh_entries == 0) { /* * this leaf is empty: * we get such a leaf in split/add case */ return; } ext_debug(""binsearch for %u: "", block); l = EXT_FIRST_EXTENT(eh) + 1; r = EXT_LAST_EXTENT(eh); while (l <= r) { m = l + (r - l) / 2; if (block < le32_to_cpu(m->ee_block)) r = m - 1; else l = m + 1; ext_debug(""%p(%u):%p(%u):%p(%u) "", l, le32_to_cpu(l->ee_block), m, le32_to_cpu(m->ee_block), r, le32_to_cpu(r->ee_block)); } path->p_ext = l - 1; ext_debug("" -> %d:%llu:[%d]%d "", le32_to_cpu(path->p_ext->ee_block), ext4_ext_pblock(path->p_ext), ext4_ext_is_uninitialized(path->p_ext), ext4_ext_get_actual_len(path->p_ext)); #ifdef CHECK_BINSEARCH { struct ext4_extent *chex, *ex; int k; chex = ex = EXT_FIRST_EXTENT(eh); for (k = 0; k < le16_to_cpu(eh->eh_entries); k++, ex++) { BUG_ON(k && le32_to_cpu(ex->ee_block) <= le32_to_cpu(ex[-1].ee_block)); if (block < le32_to_cpu(ex->ee_block)) break; chex = ex; } BUG_ON(chex != path->p_ext); } #endif } ",0 "inline void Element::updateId(TreeScope* scope, const AtomicString& oldId, const AtomicString& newId) { ASSERT(isInTreeScope()); ASSERT(oldId != newId); if (!oldId.isEmpty()) scope->removeElementById(oldId, this); if (!newId.isEmpty()) scope->addElementById(newId, this); if (shouldRegisterAsExtraNamedItem()) updateExtraNamedItemRegistration(oldId, newId); } ",0 "static int tg3_stop_block(struct tg3 *tp, unsigned long ofs, u32 enable_bit, int silent) { unsigned int i; u32 val; if (tg3_flag(tp, 5705_PLUS)) { switch (ofs) { case RCVLSC_MODE: case DMAC_MODE: case MBFREE_MODE: case BUFMGR_MODE: case MEMARB_MODE: /* We can't enable/disable these bits of the * 5705/5750, just say success. */ return 0; default: break; } } val = tr32(ofs); val &= ~enable_bit; tw32_f(ofs, val); for (i = 0; i < MAX_WAIT_CNT; i++) { udelay(100); val = tr32(ofs); if ((val & enable_bit) == 0) break; } if (i == MAX_WAIT_CNT && !silent) { dev_err(&tp->pdev->dev, ""tg3_stop_block timed out, ofs=%lx enable_bit=%x\n"", ofs, enable_bit); return -ENODEV; } return 0; } ",0 "void TestingAutomationProvider::GetNetworkInfo(DictionaryValue* args, IPC::Message* reply_message) { scoped_ptr return_value(new DictionaryValue); NetworkLibrary* network_library = CrosLibrary::Get()->GetNetworkLibrary(); return_value->SetBoolean(""offline_mode"", net::NetworkChangeNotifier::IsOffline()); return_value->SetString(""ip_address"", network_library->IPAddress()); if (network_library->ethernet_network()) return_value->SetString( ""connected_ethernet"", network_library->ethernet_network()->service_path()); if (network_library->wifi_network()) return_value->SetString(""connected_wifi"", network_library->wifi_network()->service_path()); if (network_library->cellular_network()) return_value->SetString( ""connected_cellular"", network_library->cellular_network()->service_path()); bool ethernet_available = network_library->ethernet_available(); bool ethernet_enabled = network_library->ethernet_enabled(); return_value->SetBoolean(""ethernet_available"", ethernet_available); return_value->SetBoolean(""ethernet_enabled"", ethernet_enabled); if (ethernet_available && ethernet_enabled) { const chromeos::EthernetNetwork* ethernet_network = network_library->ethernet_network(); if (ethernet_network) { DictionaryValue* items = new DictionaryValue; DictionaryValue* item = GetNetworkInfoDict(ethernet_network); items->Set(ethernet_network->service_path(), item); return_value->Set(""ethernet_networks"", items); } } bool wifi_available = network_library->wifi_available(); bool wifi_enabled = network_library->wifi_enabled(); return_value->SetBoolean(""wifi_available"", wifi_available); return_value->SetBoolean(""wifi_enabled"", wifi_enabled); if (wifi_available && wifi_enabled) { const chromeos::WifiNetworkVector& wifi_networks = network_library->wifi_networks(); DictionaryValue* items = new DictionaryValue; for (chromeos::WifiNetworkVector::const_iterator iter = wifi_networks.begin(); iter != wifi_networks.end(); ++iter) { const chromeos::WifiNetwork* wifi = *iter; DictionaryValue* item = GetNetworkInfoDict(wifi); item->SetInteger(""strength"", wifi->strength()); item->SetBoolean(""encrypted"", wifi->encrypted()); item->SetString(""encryption"", wifi->GetEncryptionString()); items->Set(wifi->service_path(), item); } return_value->Set(""wifi_networks"", items); } bool cellular_available = network_library->cellular_available(); bool cellular_enabled = network_library->cellular_enabled(); return_value->SetBoolean(""cellular_available"", cellular_available); return_value->SetBoolean(""cellular_enabled"", cellular_enabled); if (cellular_available && cellular_enabled) { const chromeos::CellularNetworkVector& cellular_networks = network_library->cellular_networks(); DictionaryValue* items = new DictionaryValue; for (size_t i = 0; i < cellular_networks.size(); ++i) { DictionaryValue* item = GetNetworkInfoDict(cellular_networks[i]); item->SetInteger(""strength"", cellular_networks[i]->strength()); item->SetString(""operator_name"", cellular_networks[i]->operator_name()); item->SetString(""operator_code"", cellular_networks[i]->operator_code()); item->SetString(""payment_url"", cellular_networks[i]->payment_url()); item->SetString(""usage_url"", cellular_networks[i]->usage_url()); item->SetString(""network_technology"", cellular_networks[i]->GetNetworkTechnologyString()); item->SetString(""activation_state"", cellular_networks[i]->GetActivationStateString()); item->SetString(""roaming_state"", cellular_networks[i]->GetRoamingStateString()); items->Set(cellular_networks[i]->service_path(), item); } return_value->Set(""cellular_networks"", items); } const chromeos::WifiNetworkVector& remembered_wifi = network_library->remembered_wifi_networks(); ListValue* items = new ListValue; for (chromeos::WifiNetworkVector::const_iterator iter = remembered_wifi.begin(); iter != remembered_wifi.end(); ++iter) { const chromeos::WifiNetwork* wifi = *iter; items->Append(base::Value::CreateStringValue(wifi->service_path())); } return_value->Set(""remembered_wifi"", items); AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); } ",0 "void HTMLMediaElement::AudioSourceProviderImpl::ProvideInput( AudioBus* bus, size_t frames_to_process) { DCHECK(bus); MutexTryLocker try_locker(provide_input_lock); if (!try_locker.Locked() || !web_audio_source_provider_ || !client_.Get()) { bus->Zero(); return; } size_t n = bus->NumberOfChannels(); WebVector web_audio_data(n); for (size_t i = 0; i < n; ++i) web_audio_data[i] = bus->Channel(i)->MutableData(); web_audio_source_provider_->ProvideInput(web_audio_data, frames_to_process); } ",0 "static int nfs4_run_open_task(struct nfs4_opendata *data, int isrecover) { struct inode *dir = d_inode(data->dir); struct nfs_server *server = NFS_SERVER(dir); struct nfs_openargs *o_arg = &data->o_arg; struct nfs_openres *o_res = &data->o_res; struct rpc_task *task; struct rpc_message msg = { .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN], .rpc_argp = o_arg, .rpc_resp = o_res, .rpc_cred = data->owner->so_cred, }; struct rpc_task_setup task_setup_data = { .rpc_client = server->client, .rpc_message = &msg, .callback_ops = &nfs4_open_ops, .callback_data = data, .workqueue = nfsiod_workqueue, .flags = RPC_TASK_ASYNC, }; int status; nfs4_init_sequence(&o_arg->seq_args, &o_res->seq_res, 1); kref_get(&data->kref); data->rpc_done = 0; data->rpc_status = 0; data->cancelled = 0; data->is_recover = 0; if (isrecover) { nfs4_set_sequence_privileged(&o_arg->seq_args); data->is_recover = 1; } task = rpc_run_task(&task_setup_data); if (IS_ERR(task)) return PTR_ERR(task); status = nfs4_wait_for_completion_rpc_task(task); if (status != 0) { data->cancelled = 1; smp_wmb(); } else status = data->rpc_status; rpc_put_task(task); return status; } ",0 "static int remote_socket_enqueue(asocket* s, apacket* p) { D(""entered remote_socket_enqueue RS(%d) WRITE fd=%d peer.fd=%d"", s->id, s->fd, s->peer->fd); p->msg.command = A_WRTE; p->msg.arg0 = s->peer->id; p->msg.arg1 = s->id; p->msg.data_length = p->len; send_packet(p, s->transport); return 1; } ",0 "bool ParseLegacyVp9CodecID(const std::string& codec_id, VideoCodecProfile* profile, uint8_t* level_idc) { if (codec_id == ""vp9"" || codec_id == ""vp9.0"") { *profile = VP9PROFILE_PROFILE0; *level_idc = 0; return true; } return false; } ",0 "static void plugin_instance_deallocate(PluginInstance *plugin) { NPW_MemFree(plugin); } ",0 "InputDispatcher::CommandEntry* InputDispatcher::postCommandLocked(Command command) { CommandEntry* commandEntry = new CommandEntry(command); mCommandQueue.enqueueAtTail(commandEntry); return commandEntry; } ",0 "void addReplyHumanLongDouble(client *c, long double d) { robj *o = createStringObjectFromLongDouble(d,1); addReplyBulk(c,o); decrRefCount(o); } ",0 "Node* Document::adoptNode(Node* source, ExceptionState& exceptionState) { EventQueueScope scope; switch (source->getNodeType()) { case DOCUMENT_NODE: exceptionState.throwDOMException(NotSupportedError, ""The node provided is of type '"" + source->nodeName() + ""', which may not be adopted.""); return nullptr; case ATTRIBUTE_NODE: { Attr* attr = toAttr(source); if (Element* ownerElement = attr->ownerElement()) ownerElement->removeAttributeNode(attr, exceptionState); break; } default: if (source->isShadowRoot()) { exceptionState.throwDOMException(HierarchyRequestError, ""The node provided is a shadow root, which may not be adopted.""); return nullptr; } if (source->isFrameOwnerElement()) { HTMLFrameOwnerElement* frameOwnerElement = toHTMLFrameOwnerElement(source); if (frame() && frame()->tree().isDescendantOf(frameOwnerElement->contentFrame())) { exceptionState.throwDOMException(HierarchyRequestError, ""The node provided is a frame which contains this document.""); return nullptr; } } if (source->parentNode()) { source->parentNode()->removeChild(source, exceptionState); if (exceptionState.hadException()) return nullptr; RELEASE_ASSERT(!source->parentNode()); } } this->adoptIfNeeded(*source); return source; } ",0 "static int cirrus_vga_read_gr(CirrusVGAState * s, unsigned reg_index) { switch (reg_index) { case 0x00: // Standard VGA, BGCOLOR 0x000000ff return s->cirrus_shadow_gr0; case 0x01: // Standard VGA, FGCOLOR 0x000000ff return s->cirrus_shadow_gr1; case 0x02: // Standard VGA case 0x03: // Standard VGA case 0x04: // Standard VGA case 0x06: // Standard VGA case 0x07: // Standard VGA case 0x08: // Standard VGA return s->vga.gr[s->vga.gr_index]; case 0x05: // Standard VGA, Cirrus extended mode default: break; } if (reg_index < 0x3a) { return s->vga.gr[reg_index]; } else { #ifdef DEBUG_CIRRUS printf(""cirrus: inport gr_index %02x\n"", reg_index); #endif return 0xff; } } ",0 "isofs_hash(const struct dentry *dentry, struct qstr *qstr) { return isofs_hash_common(qstr, 0); } ",0 "posix_state_to_acl(struct posix_acl_state *state, unsigned int flags) { struct posix_acl_entry *pace; struct posix_acl *pacl; int nace; int i; /* * ACLs with no ACEs are treated differently in the inheritable * and effective cases: when there are no inheritable ACEs, * calls ->set_acl with a NULL ACL structure. */ if (state->empty && (flags & NFS4_ACL_TYPE_DEFAULT)) return NULL; /* * When there are no effective ACEs, the following will end * up setting a 3-element effective posix ACL with all * permissions zero. */ if (!state->users->n && !state->groups->n) nace = 3; else /* Note we also include a MASK ACE in this case: */ nace = 4 + state->users->n + state->groups->n; pacl = posix_acl_alloc(nace, GFP_KERNEL); if (!pacl) return ERR_PTR(-ENOMEM); pace = pacl->a_entries; pace->e_tag = ACL_USER_OBJ; low_mode_from_nfs4(state->owner.allow, &pace->e_perm, flags); for (i=0; i < state->users->n; i++) { pace++; pace->e_tag = ACL_USER; low_mode_from_nfs4(state->users->aces[i].perms.allow, &pace->e_perm, flags); pace->e_uid = state->users->aces[i].uid; add_to_mask(state, &state->users->aces[i].perms); } pace++; pace->e_tag = ACL_GROUP_OBJ; low_mode_from_nfs4(state->group.allow, &pace->e_perm, flags); add_to_mask(state, &state->group); for (i=0; i < state->groups->n; i++) { pace++; pace->e_tag = ACL_GROUP; low_mode_from_nfs4(state->groups->aces[i].perms.allow, &pace->e_perm, flags); pace->e_gid = state->groups->aces[i].gid; add_to_mask(state, &state->groups->aces[i].perms); } if (state->users->n || state->groups->n) { pace++; pace->e_tag = ACL_MASK; low_mode_from_nfs4(state->mask.allow, &pace->e_perm, flags); } pace++; pace->e_tag = ACL_OTHER; low_mode_from_nfs4(state->other.allow, &pace->e_perm, flags); return pacl; } ",0 "GF_Err twrp_dump(GF_Box *a, FILE * trace) { GF_TextWrapBox*p = (GF_TextWrapBox*)a; gf_isom_box_dump_start(a, ""TextWrapBox"", trace); fprintf(trace, ""wrap_flag=\""%s\"">\n"", p->wrap_flag ? ( (p->wrap_flag>1) ? ""Reserved"" : ""Automatic"" ) : ""No Wrap""); gf_isom_box_dump_done(""TextWrapBox"", a, trace); return GF_OK; } ",0 "static inline u8 llc_ui_header_len(struct sock *sk, struct sockaddr_llc *addr) { u8 rc = LLC_PDU_LEN_U; if (addr->sllc_test || addr->sllc_xid) rc = LLC_PDU_LEN_U; else if (sk->sk_type == SOCK_STREAM) rc = LLC_PDU_LEN_I; return rc; } ",0 "static ssize_t uio_write(struct file *filep, const char __user *buf, size_t count, loff_t *ppos) { struct uio_listener *listener = filep->private_data; struct uio_device *idev = listener->dev; ssize_t retval; s32 irq_on; if (!idev->info->irq) return -EIO; if (count != sizeof(s32)) return -EINVAL; if (!idev->info->irqcontrol) return -ENOSYS; if (copy_from_user(&irq_on, buf, count)) return -EFAULT; retval = idev->info->irqcontrol(idev->info, irq_on); return retval ? retval : sizeof(s32); } ",0 "void WebPageProxy::getSelectionOrContentsAsString(PassRefPtr prpCallback) { RefPtr callback = prpCallback; if (!isValid()) { callback->invalidate(); return; } uint64_t callbackID = callback->callbackID(); m_stringCallbacks.set(callbackID, callback.get()); process()->send(Messages::WebPage::GetSelectionOrContentsAsString(callbackID), m_pageID); } ",0 "static void rtsp_reply_error(HTTPContext *c, enum RTSPStatusCode error_number) { rtsp_reply_header(c, error_number); avio_printf(c->pb, ""\r\n""); } ",0 "SoundTriggerHwService::~SoundTriggerHwService() { if (mCallbackThread != 0) { mCallbackThread->exit(); } for (size_t i = 0; i < mModules.size(); i++) { sound_trigger_hw_device_close(mModules.valueAt(i)->hwDevice()); } } ",0 "_tiffUnmapProc(thandle_t fd, void* base, toff_t size) { (void) fd; (void) base; (void) size; } ",0 "bool RenderWidgetHostViewAura::IsSurfaceAvailableForCopy() const { return CanCopyToBitmap() || !!host_->GetBackingStore(false); } ",0 "void V8TestObject::PassPermissiveDictionaryMethodMethodCallback(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_passPermissiveDictionaryMethod""); test_object_v8_internal::PassPermissiveDictionaryMethodMethod(info); } ",0 "bool TabsUpdateFunction::UpdateURLIfPresent(DictionaryValue* update_props, int tab_id, bool* is_async) { if (!update_props->HasKey(keys::kUrlKey)) return true; std::string url_string; EXTENSION_FUNCTION_VALIDATE(update_props->GetString( keys::kUrlKey, &url_string)); GURL url = ExtensionTabUtil::ResolvePossiblyRelativeURL( url_string, GetExtension()); if (!url.is_valid()) { error_ = ErrorUtils::FormatErrorMessage( keys::kInvalidUrlError, url_string); return false; } if (ExtensionTabUtil::IsCrashURL(url)) { error_ = keys::kNoCrashBrowserError; return false; } if (url.SchemeIs(chrome::kJavaScriptScheme)) { if (!GetExtension()->CanExecuteScriptOnPage( web_contents_->GetURL(), web_contents_->GetURL(), tab_id, NULL, &error_)) { return false; } extensions::TabHelper::FromWebContents(web_contents_)-> script_executor()->ExecuteScript( extension_id(), ScriptExecutor::JAVASCRIPT, url.path(), ScriptExecutor::TOP_FRAME, extensions::UserScript::DOCUMENT_IDLE, ScriptExecutor::MAIN_WORLD, false /* is_web_view */, base::Bind(&TabsUpdateFunction::OnExecuteCodeFinished, this)); *is_async = true; return true; } web_contents_->GetController().LoadURL( url, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string()); if (!url.SchemeIs(chrome::kJavaScriptScheme)) DCHECK_EQ(url.spec(), web_contents_->GetURL().spec()); return true; } ",0 "static int perf_event_task_match(struct perf_event *event) { return event->attr.comm || event->attr.mmap || event->attr.mmap2 || event->attr.mmap_data || event->attr.task; } ",0 "bool GetTransferSize(const T& input, size_t* output) { if (input.direction == usb::DIRECTION_IN) { const int* length = input.length.get(); if (length && *length >= 0 && static_cast(*length) < kMaxTransferLength) { *output = *length; return true; } } else if (input.direction == usb::DIRECTION_OUT) { if (input.data.get()) { *output = input.data->size(); return true; } } return false; } ",0 "void dm_internal_resume(struct mapped_device *md) { mutex_lock(&md->suspend_lock); __dm_internal_resume(md); mutex_unlock(&md->suspend_lock); } ",0 "void SyncBackendHost::Core::DoStartSyncing() { DCHECK(MessageLoop::current() == host_->sync_thread_.message_loop()); sync_manager_->StartSyncingNormally(); } ",0 "ksba_ocsp_get_sig_val (ksba_ocsp_t ocsp, ksba_isotime_t produced_at) { ksba_sexp_t p; if (produced_at) *produced_at = 0; if (!ocsp || !ocsp->sigval ) return NULL; if (produced_at) _ksba_copy_time (produced_at, ocsp->produced_at); p = ocsp->sigval; ocsp->sigval = NULL; return p; } ",0 "static bool __skb_splice_bits(struct sk_buff *skb, struct pipe_inode_info *pipe, unsigned int *offset, unsigned int *len, struct splice_pipe_desc *spd, struct sock *sk) { int seg; struct sk_buff *iter; /* map the linear part : * If skb->head_frag is set, this 'linear' part is backed by a * fragment, and if the head is not shared with any clones then * we can avoid a copy since we own the head portion of this page. */ if (__splice_segment(virt_to_page(skb->data), (unsigned long) skb->data & (PAGE_SIZE - 1), skb_headlen(skb), offset, len, spd, skb_head_is_locked(skb), sk, pipe)) return true; /* * then map the fragments */ for (seg = 0; seg < skb_shinfo(skb)->nr_frags; seg++) { const skb_frag_t *f = &skb_shinfo(skb)->frags[seg]; if (__splice_segment(skb_frag_page(f), f->page_offset, skb_frag_size(f), offset, len, spd, false, sk, pipe)) return true; } skb_walk_frags(skb, iter) { if (*offset >= iter->len) { *offset -= iter->len; continue; } /* __skb_splice_bits() only fails if the output has no room * left, so no point in going over the frag_list for the error * case. */ if (__skb_splice_bits(iter, pipe, offset, len, spd, sk)) return true; } return false; } ",0 "ChromePaymentRequestDelegate::GetPersonalDataManager() { return autofill::PersonalDataManagerFactory::GetForProfile( Profile::FromBrowserContext(web_contents_->GetBrowserContext()) ->GetOriginalProfile()); } ",0 "void ping_seq_stop(struct seq_file *seq, void *v) { read_unlock_bh(&ping_table.lock); } ",0 "static int proc_releaseinterface(struct usb_dev_state *ps, void __user *arg) { unsigned int ifnum; int ret; if (get_user(ifnum, (unsigned int __user *)arg)) return -EFAULT; ret = releaseintf(ps, ifnum); if (ret < 0) return ret; destroy_async_on_interface(ps, ifnum); return 0; } ",0 "int ssl3_get_cert_verify(SSL *s) { EVP_PKEY *pkey = NULL; unsigned char *p; int al, ok, ret = 0; long n; int type = 0, i, j; X509 *peer; const EVP_MD *md = NULL; EVP_MD_CTX mctx; EVP_MD_CTX_init(&mctx); /* * We should only process a CertificateVerify message if we have received * a Certificate from the client. If so then |s->session->peer| will be non * NULL. In some instances a CertificateVerify message is not required even * if the peer has sent a Certificate (e.g. such as in the case of static * DH). In that case the ClientKeyExchange processing will skip the * CertificateVerify state so we should not arrive here. */ if (s->session->peer == NULL) { ret = 1; goto end; } n = s->method->ssl_get_message(s, SSL3_ST_SR_CERT_VRFY_A, SSL3_ST_SR_CERT_VRFY_B, SSL3_MT_CERTIFICATE_VERIFY, SSL3_RT_MAX_PLAIN_LENGTH, &ok); if (!ok) return ((int)n); peer = s->session->peer; pkey = X509_get_pubkey(peer); type = X509_certificate_type(peer, pkey); if (!(type & EVP_PKT_SIGN)) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE); al = SSL_AD_ILLEGAL_PARAMETER; goto f_err; } /* we now have a signature that we need to verify */ p = (unsigned char *)s->init_msg; /* Check for broken implementations of GOST ciphersuites */ /* * If key is GOST and n is exactly 64, it is bare signature without * length field */ if (n == 64 && (pkey->type == NID_id_GostR3410_94 || pkey->type == NID_id_GostR3410_2001)) { i = 64; } else { if (TLS1_get_version(s) >= TLS1_2_VERSION) { int sigalg = tls12_get_sigid(pkey); /* Should never happen */ if (sigalg == -1) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_INTERNAL_ERROR); al = SSL_AD_INTERNAL_ERROR; goto f_err; } /* Check key type is consistent with signature */ if (sigalg != (int)p[1]) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_WRONG_SIGNATURE_TYPE); al = SSL_AD_DECODE_ERROR; goto f_err; } md = tls12_get_hash(p[0]); if (md == NULL) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_UNKNOWN_DIGEST); al = SSL_AD_DECODE_ERROR; goto f_err; } #ifdef SSL_DEBUG fprintf(stderr, ""USING TLSv1.2 HASH %s\n"", EVP_MD_name(md)); #endif p += 2; n -= 2; } n2s(p, i); n -= 2; if (i > n) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_LENGTH_MISMATCH); al = SSL_AD_DECODE_ERROR; goto f_err; } } j = EVP_PKEY_size(pkey); if ((i > j) || (n > j) || (n <= 0)) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_WRONG_SIGNATURE_SIZE); al = SSL_AD_DECODE_ERROR; goto f_err; } if (TLS1_get_version(s) >= TLS1_2_VERSION) { long hdatalen = 0; void *hdata; hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata); if (hdatalen <= 0) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_INTERNAL_ERROR); al = SSL_AD_INTERNAL_ERROR; goto f_err; } #ifdef SSL_DEBUG fprintf(stderr, ""Using TLS 1.2 with client verify alg %s\n"", EVP_MD_name(md)); #endif if (!EVP_VerifyInit_ex(&mctx, md, NULL) || !EVP_VerifyUpdate(&mctx, hdata, hdatalen)) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_EVP_LIB); al = SSL_AD_INTERNAL_ERROR; goto f_err; } if (EVP_VerifyFinal(&mctx, p, i, pkey) <= 0) { al = SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_SIGNATURE); goto f_err; } } else #ifndef OPENSSL_NO_RSA if (pkey->type == EVP_PKEY_RSA) { i = RSA_verify(NID_md5_sha1, s->s3->tmp.cert_verify_md, MD5_DIGEST_LENGTH + SHA_DIGEST_LENGTH, p, i, pkey->pkey.rsa); if (i < 0) { al = SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_RSA_DECRYPT); goto f_err; } if (i == 0) { al = SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_RSA_SIGNATURE); goto f_err; } } else #endif #ifndef OPENSSL_NO_DSA if (pkey->type == EVP_PKEY_DSA) { j = DSA_verify(pkey->save_type, &(s->s3->tmp.cert_verify_md[MD5_DIGEST_LENGTH]), SHA_DIGEST_LENGTH, p, i, pkey->pkey.dsa); if (j <= 0) { /* bad signature */ al = SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_DSA_SIGNATURE); goto f_err; } } else #endif #ifndef OPENSSL_NO_ECDSA if (pkey->type == EVP_PKEY_EC) { j = ECDSA_verify(pkey->save_type, &(s->s3->tmp.cert_verify_md[MD5_DIGEST_LENGTH]), SHA_DIGEST_LENGTH, p, i, pkey->pkey.ec); if (j <= 0) { /* bad signature */ al = SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_ECDSA_SIGNATURE); goto f_err; } } else #endif if (pkey->type == NID_id_GostR3410_94 || pkey->type == NID_id_GostR3410_2001) { unsigned char signature[64]; int idx; EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new(pkey, NULL); if (pctx == NULL) { al = SSL_AD_INTERNAL_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_MALLOC_FAILURE); goto f_err; } if (EVP_PKEY_verify_init(pctx) <= 0) { EVP_PKEY_CTX_free(pctx); al = SSL_AD_INTERNAL_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_INTERNAL_ERROR); goto f_err; } if (i != 64) { fprintf(stderr, ""GOST signature length is %d"", i); } for (idx = 0; idx < 64; idx++) { signature[63 - idx] = p[idx]; } j = EVP_PKEY_verify(pctx, signature, 64, s->s3->tmp.cert_verify_md, 32); EVP_PKEY_CTX_free(pctx); if (j <= 0) { al = SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_ECDSA_SIGNATURE); goto f_err; } } else { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_INTERNAL_ERROR); al = SSL_AD_UNSUPPORTED_CERTIFICATE; goto f_err; } ret = 1; if (0) { f_err: ssl3_send_alert(s, SSL3_AL_FATAL, al); s->state = SSL_ST_ERR; } end: if (s->s3->handshake_buffer) { BIO_free(s->s3->handshake_buffer); s->s3->handshake_buffer = NULL; s->s3->flags &= ~TLS1_FLAGS_KEEP_HANDSHAKE; } EVP_MD_CTX_cleanup(&mctx); EVP_PKEY_free(pkey); return (ret); } ",0 "long do_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig, siginfo_t *info) { /* This is only valid for single tasks */ if (pid <= 0 || tgid <= 0) return -EINVAL; /* Not even root can pretend to send signals from the kernel. Nor can they impersonate a kill(), which adds source info. */ if (info->si_code >= 0) return -EPERM; info->si_signo = sig; return do_send_specific(tgid, pid, sig, info); } ",1 "__xml_node_clean(xmlNode *xml) { xmlNode *cIter = NULL; xml_private_t *p = xml->_private; if(p) { p->flags = 0; } for (cIter = __xml_first_child(xml); cIter != NULL; cIter = __xml_next(cIter)) { __xml_node_clean(cIter); } } ",0 "static int ipgre_open(struct net_device *dev) { struct ip_tunnel *t = netdev_priv(dev); if (ipv4_is_multicast(t->parms.iph.daddr)) { struct flowi fl = { .oif = t->parms.link, .fl4_dst = t->parms.iph.daddr, .fl4_src = t->parms.iph.saddr, .fl4_tos = RT_TOS(t->parms.iph.tos), .proto = IPPROTO_GRE, .fl_gre_key = t->parms.o_key }; struct rtable *rt; if (ip_route_output_key(dev_net(dev), &rt, &fl)) return -EADDRNOTAVAIL; dev = rt->dst.dev; ip_rt_put(rt); if (__in_dev_get_rtnl(dev) == NULL) return -EADDRNOTAVAIL; t->mlink = dev->ifindex; ip_mc_inc_group(__in_dev_get_rtnl(dev), t->parms.iph.daddr); } return 0; } ",0 "void SaveCardBubbleControllerImpl::OnLearnMoreClicked() { OpenUrl(GURL(kHelpURL)); AutofillMetrics::LogSaveCardPromptMetric( AutofillMetrics::SAVE_CARD_PROMPT_DISMISS_CLICK_LEARN_MORE, is_uploading_, is_reshow_, pref_service_->GetInteger( prefs::kAutofillAcceptSaveCreditCardPromptState)); } ",0 " bool IsDraggingWindow() const { return drag_controller_ && drag_controller_->is_dragging_window(); } ",0 "static int megasas_enqueue_req(MegasasCmd *cmd, bool is_write) { int len; len = scsi_req_enqueue(cmd->req); if (len < 0) { len = -len; } if (len > 0) { if (len > cmd->iov_size) { if (is_write) { trace_megasas_iov_write_overflow(cmd->index, len, cmd->iov_size); } else { trace_megasas_iov_read_overflow(cmd->index, len, cmd->iov_size); } } if (len < cmd->iov_size) { if (is_write) { trace_megasas_iov_write_underflow(cmd->index, len, cmd->iov_size); } else { trace_megasas_iov_read_underflow(cmd->index, len, cmd->iov_size); } cmd->iov_size = len; } scsi_req_continue(cmd->req); } return len; } ",0 "void Scrollbar::autoscrollPressedPart(double delay) { if (m_pressedPart == ThumbPart || m_pressedPart == NoPart) return; if ((m_pressedPart == BackTrackPart || m_pressedPart == ForwardTrackPart) && thumbUnderMouse(this)) { theme()->invalidatePart(this, m_pressedPart); setHoveredPart(ThumbPart); return; } if (scrollableArea()->scroll(pressedPartScrollDirection(), pressedPartScrollGranularity())) startTimerIfNeeded(delay); } ",1 "ChildProcessSecurityPolicyImpl::ChildProcessSecurityPolicyImpl() { RegisterWebSafeScheme(url::kHttpScheme); RegisterWebSafeScheme(url::kHttpsScheme); RegisterWebSafeScheme(url::kFtpScheme); RegisterWebSafeScheme(url::kDataScheme); RegisterWebSafeScheme(""feed""); RegisterWebSafeScheme(url::kBlobScheme); RegisterWebSafeScheme(url::kFileSystemScheme); RegisterPseudoScheme(url::kAboutScheme); RegisterPseudoScheme(url::kJavaScriptScheme); RegisterPseudoScheme(kViewSourceScheme); } ",0 "void WebContentsImpl::InsertCSS(const std::string& css) { GetMainFrame()->Send(new FrameMsg_CSSInsertRequest( GetMainFrame()->GetRoutingID(), css)); } ",0 "_tiffReadProc(thandle_t fd, tdata_t buf, tsize_t size) { return (read((int) fd, buf, size)); } ",0 " void GLManager::SetSnapshotRequested() {} ",0 "static int llc_backlog_rcv(struct sock *sk, struct sk_buff *skb) { int rc = 0; struct llc_sock *llc = llc_sk(sk); if (likely(llc_backlog_type(skb) == LLC_PACKET)) { if (likely(llc->state > 1)) /* not closed */ rc = llc_conn_rcv(sk, skb); else goto out_kfree_skb; } else if (llc_backlog_type(skb) == LLC_EVENT) { /* timer expiration event */ if (likely(llc->state > 1)) /* not closed */ rc = llc_conn_state_process(sk, skb); else goto out_kfree_skb; } else { printk(KERN_ERR ""%s: invalid skb in backlog\n"", __func__); goto out_kfree_skb; } out: return rc; out_kfree_skb: kfree_skb(skb); goto out; } ",0 "lt_dlinit () { int errors = 0; LT_DLMUTEX_LOCK (); /* Initialize only at first call. */ if (++initialized == 1) { handles = 0; user_search_path = 0; /* empty search path */ #if HAVE_LIBDL errors += lt_dlloader_add (lt_dlloader_next (0), &sys_dl, ""dlopen""); #endif #if HAVE_SHL_LOAD errors += lt_dlloader_add (lt_dlloader_next (0), &sys_shl, ""dlopen""); #endif #ifdef __WINDOWS__ errors += lt_dlloader_add (lt_dlloader_next (0), &sys_wll, ""dlopen""); #endif #ifdef __BEOS__ errors += lt_dlloader_add (lt_dlloader_next (0), &sys_bedl, ""dlopen""); #endif #if HAVE_DLD errors += lt_dlloader_add (lt_dlloader_next (0), &sys_dld, ""dld""); #endif #if HAVE_DYLD errors += lt_dlloader_add (lt_dlloader_next (0), &sys_dyld, ""dyld""); errors += sys_dyld_init(); #endif errors += lt_dlloader_add (lt_dlloader_next (0), &presym, ""dlpreload""); if (presym_init (presym.dlloader_data)) { LT_DLMUTEX_SETERROR (LT_DLSTRERROR (INIT_LOADER)); ++errors; } else if (errors != 0) { LT_DLMUTEX_SETERROR (LT_DLSTRERROR (DLOPEN_NOT_SUPPORTED)); ++errors; } } LT_DLMUTEX_UNLOCK (); return errors; } ",0 "bool InlineTextBox::nodeAtPoint(const HitTestRequest&, HitTestResult& result, int x, int y, int tx, int ty) { if (isLineBreak()) return false; IntRect rect(tx + m_x, ty + m_y, width(), height()); if (m_truncation != cFullTruncation && visibleToHitTesting() && rect.intersects(result.rectForPoint(x, y))) { renderer()->updateHitTestResult(result, IntPoint(x - tx, y - ty)); if (!result.addNodeToRectBasedTestResult(renderer()->node(), x, y, rect)) return true; } return false; } ",0 "void StyleResolver::processScopedRules(const RuleSet& authorRules, const KURL& sheetBaseURL, ContainerNode* scope) { const Vector keyframesRules = authorRules.keyframesRules(); for (unsigned i = 0; i < keyframesRules.size(); ++i) ensureScopedStyleResolver(scope)->addKeyframeStyle(keyframesRules[i]); const Vector hostRules = authorRules.hostRules(); if (hostRules.size() && scope && scope->isInShadowTree()) { bool enabled = buildScopedStyleTreeInDocumentOrder(); setBuildScopedStyleTreeInDocumentOrder(false); bool hasDocumentSecurityOrigin = document().securityOrigin()->canRequest(sheetBaseURL); for (unsigned i = 0; i < hostRules.size(); ++i) ensureScopedStyleResolver(scope->shadowHost())->addHostRule(hostRules[i], hasDocumentSecurityOrigin, scope); setBuildScopedStyleTreeInDocumentOrder(enabled); } addTreeBoundaryCrossingRules(authorRules.treeBoundaryCrossingRules(), scope); if (!scope || scope->isDocumentNode()) { const Vector fontFaceRules = authorRules.fontFaceRules(); for (unsigned i = 0; i < fontFaceRules.size(); ++i) fontSelector()->addFontFaceRule(fontFaceRules[i]); if (fontFaceRules.size()) invalidateMatchedPropertiesCache(); } else { addTreeBoundaryCrossingRules(authorRules.shadowDistributedRules(), scope); } } ",0 " LayerInvalidateCausesDraw() : num_commits_(0), num_draws_(0) {} ",0 "static void vnc_mouse_set(DisplayChangeListener *dcl, int x, int y, int visible) { /* can we ask the client(s) to move the pointer ??? */ } ",0 "ring_buffer_free(struct ring_buffer *buffer) { int cpu; #ifdef CONFIG_HOTPLUG_CPU cpu_notifier_register_begin(); __unregister_cpu_notifier(&buffer->cpu_notify); #endif for_each_buffer_cpu(buffer, cpu) rb_free_cpu_buffer(buffer->buffers[cpu]); #ifdef CONFIG_HOTPLUG_CPU cpu_notifier_register_done(); #endif kfree(buffer->buffers); free_cpumask_var(buffer->cpumask); kfree(buffer); } ",0 "announcedata_size() { size_t size, i; PRINTER *printerinfo; DISK_DEVICE *diskinfo; size = 8; /* Header + DeviceCount */ for (i = 0; i < g_num_devices; i++) { size += 4; /* DeviceType */ size += 4; /* DeviceId */ size += 8; /* PreferredDosName */ size += 4; /* DeviceDataLength */ switch (g_rdpdr_device[i].device_type) { case DEVICE_TYPE_DISK: diskinfo = (DISK_DEVICE *) g_rdpdr_device[i].pdevice_data; size += 2 * strlen(diskinfo->name) + 2; break; case DEVICE_TYPE_PRINTER: printerinfo = (PRINTER *) g_rdpdr_device[i].pdevice_data; printerinfo->bloblen = printercache_load_blob(printerinfo->printer, &(printerinfo->blob)); size += 0x18; size += 2 * strlen(printerinfo->driver) + 2; size += 2 * strlen(printerinfo->printer) + 2; size += printerinfo->bloblen; break; default: break; } } return size; } ",0 "decode_NXAST_RAW_STACK_PUSH(const struct nx_action_stack *nasp, enum ofp_version ofp_version OVS_UNUSED, const struct vl_mff_map *vl_mff_map, uint64_t *tlv_bitmap, struct ofpbuf *ofpacts) { struct ofpact_stack *push = ofpact_put_STACK_PUSH(ofpacts); enum ofperr error = decode_stack_action(nasp, vl_mff_map, tlv_bitmap, push); return error ? error : nxm_stack_push_check(push, NULL); } ",0 "void InspectorPageAgent::canScreencast(ErrorString*, bool*) { } ",0 "lseg_intersect(PG_FUNCTION_ARGS) { LSEG *l1 = PG_GETARG_LSEG_P(0); LSEG *l2 = PG_GETARG_LSEG_P(1); PG_RETURN_BOOL(lseg_intersect_internal(l1, l2)); } ",0 "base::string16 OmniboxViewViews::GetText() const { return text(); } ",0 "static void mip6_addr_swap(struct sk_buff *skb) { struct ipv6hdr *iph = ipv6_hdr(skb); struct inet6_skb_parm *opt = IP6CB(skb); struct ipv6_destopt_hao *hao; struct in6_addr tmp; int off; if (opt->dsthao) { off = ipv6_find_tlv(skb, opt->dsthao, IPV6_TLV_HAO); if (likely(off >= 0)) { hao = (struct ipv6_destopt_hao *) (skb_network_header(skb) + off); tmp = iph->saddr; iph->saddr = hao->addr; hao->addr = tmp; } } } ",0 "void ChromeDownloadManagerDelegate::ChooseSavePath( WebContents* web_contents, const FilePath& suggested_path, const FilePath::StringType& default_extension, bool can_save_as_complete, const content::SavePackagePathPickedCallback& callback) { #if defined(OS_CHROMEOS) new SavePackageFilePickerChromeOS(web_contents, suggested_path, callback); #else new SavePackageFilePicker(web_contents, suggested_path, default_extension, can_save_as_complete, download_prefs_.get(), callback); #endif } ",0 "static int adf_chr_drv_create(void) { dev_t dev_id; struct device *drv_device; if (alloc_chrdev_region(&dev_id, 0, 1, DEVICE_NAME)) { pr_err(""QAT: unable to allocate chrdev region\n""); return -EFAULT; } adt_ctl_drv.drv_class = class_create(THIS_MODULE, DEVICE_NAME); if (IS_ERR(adt_ctl_drv.drv_class)) { pr_err(""QAT: class_create failed for adf_ctl\n""); goto err_chrdev_unreg; } adt_ctl_drv.major = MAJOR(dev_id); cdev_init(&adt_ctl_drv.drv_cdev, &adf_ctl_ops); if (cdev_add(&adt_ctl_drv.drv_cdev, dev_id, 1)) { pr_err(""QAT: cdev add failed\n""); goto err_class_destr; } drv_device = device_create(adt_ctl_drv.drv_class, NULL, MKDEV(adt_ctl_drv.major, 0), NULL, DEVICE_NAME); if (IS_ERR(drv_device)) { pr_err(""QAT: failed to create device\n""); goto err_cdev_del; } return 0; err_cdev_del: cdev_del(&adt_ctl_drv.drv_cdev); err_class_destr: class_destroy(adt_ctl_drv.drv_class); err_chrdev_unreg: unregister_chrdev_region(dev_id, 1); return -EFAULT; } ",0 "views::View* ShellWindowViews::GetContentsView() { return this; } ",0 "static GIOStatus irssi_ssl_seek(GIOChannel *handle, gint64 offset, GSeekType type, GError **gerr) { GIOSSLChannel *chan = (GIOSSLChannel *)handle; return chan->giochan->funcs->io_seek(handle, offset, type, gerr); } ",0 "void GLES2Implementation::VerifySyncTokensCHROMIUM(GLbyte** sync_tokens, GLsizei count) { ImplementationBase::VerifySyncTokens(sync_tokens, count); } ",0 "AppCacheUpdateJob::AppCacheUpdateJob(AppCacheServiceImpl* service, AppCacheGroup* group) : service_(service), manifest_url_(group->manifest_url()), group_(group), update_type_(UNKNOWN_TYPE), internal_state_(FETCH_MANIFEST), doing_full_update_check_(false), master_entries_completed_(0), url_fetches_completed_(0), manifest_fetcher_(nullptr), manifest_has_valid_mime_type_(false), stored_state_(UNSTORED), storage_(service->storage()), weak_factory_(this) { service_->AddObserver(this); } ",0 "static void remove_child_widget(GtkWidget *widget, gpointer unused) { /* Destroy will safely remove it and free the memory * if there are no refs left */ gtk_widget_destroy(widget); } ",0 "static MagickBooleanType SkipRGBMipmaps(Image *image,DDSInfo *dds_info, int pixel_size,ExceptionInfo *exception) { MagickOffsetType offset; register ssize_t i; size_t h, w; /* Only skip mipmaps for textures and cube maps */ if (EOFBlob(image) != MagickFalse) { ThrowFileException(exception,CorruptImageError,""UnexpectedEndOfFile"", image->filename); return(MagickFalse); } if (dds_info->ddscaps1 & DDSCAPS_MIPMAP && (dds_info->ddscaps1 & DDSCAPS_TEXTURE || dds_info->ddscaps2 & DDSCAPS2_CUBEMAP)) { w = DIV2(dds_info->width); h = DIV2(dds_info->height); /* Mipmapcount includes the main image, so start from one */ for (i=1; (i < (ssize_t) dds_info->mipmapcount) && w && h; i++) { offset = (MagickOffsetType) w * h * pixel_size; if (SeekBlob(image,offset,SEEK_CUR) < 0) break; w = DIV2(w); h = DIV2(h); } } return(MagickTrue); } ",0 "dissect_SYSTEM_TIME(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep, const char *name, gboolean add_subtree, char **data) { proto_item *item = NULL; proto_tree *subtree = tree; guint16 year, month, day, hour, minute, second, millisecond; char *str; if (add_subtree) { subtree = proto_tree_add_subtree(tree, tvb, offset, 16, ett_SYSTEM_TIME, &item, name); } offset = dissect_ndr_uint16( tvb, offset, pinfo, subtree, di, drep, hf_time_year, &year); offset = dissect_ndr_uint16( tvb, offset, pinfo, subtree, di, drep, hf_time_month, &month); offset = dissect_ndr_uint16( tvb, offset, pinfo, subtree, di, drep, hf_time_dow, NULL); offset = dissect_ndr_uint16( tvb, offset, pinfo, subtree, di, drep, hf_time_day, &day); offset = dissect_ndr_uint16( tvb, offset, pinfo, subtree, di, drep, hf_time_hour, &hour); offset = dissect_ndr_uint16( tvb, offset, pinfo, subtree, di, drep, hf_time_minute, &minute); offset = dissect_ndr_uint16( tvb, offset, pinfo, subtree, di, drep, hf_time_second, &second); offset = dissect_ndr_uint16( tvb, offset, pinfo, subtree, di, drep, hf_time_msec, &millisecond); str = wmem_strdup_printf(wmem_packet_scope(), ""%d/%02d/%02d %02d:%02d:%02d.%03d"", year, month, day, hour, minute, second, millisecond); if (add_subtree) proto_item_append_text(item, "": %s"", str); if (data) *data = str; return offset; } ",0 "static void red_channel_client_default_connect(RedChannel *channel, RedClient *client, RedsStream *stream, int migration, int num_common_caps, uint32_t *common_caps, int num_caps, uint32_t *caps) { spice_error(""not implemented""); } ",0 "s_aes_set_padding(stream_aes_state *state, int use_padding) { state->use_padding = use_padding; } ",0 "static long kvm_vcpu_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg) { struct kvm_vcpu *vcpu = filp->private_data; void __user *argp = (void __user *)arg; int r; struct kvm_fpu *fpu = NULL; struct kvm_sregs *kvm_sregs = NULL; if (vcpu->kvm->mm != current->mm) return -EIO; if (unlikely(_IOC_TYPE(ioctl) != KVMIO)) return -EINVAL; /* * Some architectures have vcpu ioctls that are asynchronous to vcpu * execution; mutex_lock() would break them. */ r = kvm_arch_vcpu_async_ioctl(filp, ioctl, arg); if (r != -ENOIOCTLCMD) return r; if (mutex_lock_killable(&vcpu->mutex)) return -EINTR; switch (ioctl) { case KVM_RUN: { struct pid *oldpid; r = -EINVAL; if (arg) goto out; oldpid = rcu_access_pointer(vcpu->pid); if (unlikely(oldpid != task_pid(current))) { /* The thread running this VCPU changed. */ struct pid *newpid; r = kvm_arch_vcpu_run_pid_change(vcpu); if (r) break; newpid = get_task_pid(current, PIDTYPE_PID); rcu_assign_pointer(vcpu->pid, newpid); if (oldpid) synchronize_rcu(); put_pid(oldpid); } r = kvm_arch_vcpu_ioctl_run(vcpu, vcpu->run); trace_kvm_userspace_exit(vcpu->run->exit_reason, r); break; } case KVM_GET_REGS: { struct kvm_regs *kvm_regs; r = -ENOMEM; kvm_regs = kzalloc(sizeof(struct kvm_regs), GFP_KERNEL); if (!kvm_regs) goto out; r = kvm_arch_vcpu_ioctl_get_regs(vcpu, kvm_regs); if (r) goto out_free1; r = -EFAULT; if (copy_to_user(argp, kvm_regs, sizeof(struct kvm_regs))) goto out_free1; r = 0; out_free1: kfree(kvm_regs); break; } case KVM_SET_REGS: { struct kvm_regs *kvm_regs; r = -ENOMEM; kvm_regs = memdup_user(argp, sizeof(*kvm_regs)); if (IS_ERR(kvm_regs)) { r = PTR_ERR(kvm_regs); goto out; } r = kvm_arch_vcpu_ioctl_set_regs(vcpu, kvm_regs); kfree(kvm_regs); break; } case KVM_GET_SREGS: { kvm_sregs = kzalloc(sizeof(struct kvm_sregs), GFP_KERNEL); r = -ENOMEM; if (!kvm_sregs) goto out; r = kvm_arch_vcpu_ioctl_get_sregs(vcpu, kvm_sregs); if (r) goto out; r = -EFAULT; if (copy_to_user(argp, kvm_sregs, sizeof(struct kvm_sregs))) goto out; r = 0; break; } case KVM_SET_SREGS: { kvm_sregs = memdup_user(argp, sizeof(*kvm_sregs)); if (IS_ERR(kvm_sregs)) { r = PTR_ERR(kvm_sregs); kvm_sregs = NULL; goto out; } r = kvm_arch_vcpu_ioctl_set_sregs(vcpu, kvm_sregs); break; } case KVM_GET_MP_STATE: { struct kvm_mp_state mp_state; r = kvm_arch_vcpu_ioctl_get_mpstate(vcpu, &mp_state); if (r) goto out; r = -EFAULT; if (copy_to_user(argp, &mp_state, sizeof(mp_state))) goto out; r = 0; break; } case KVM_SET_MP_STATE: { struct kvm_mp_state mp_state; r = -EFAULT; if (copy_from_user(&mp_state, argp, sizeof(mp_state))) goto out; r = kvm_arch_vcpu_ioctl_set_mpstate(vcpu, &mp_state); break; } case KVM_TRANSLATE: { struct kvm_translation tr; r = -EFAULT; if (copy_from_user(&tr, argp, sizeof(tr))) goto out; r = kvm_arch_vcpu_ioctl_translate(vcpu, &tr); if (r) goto out; r = -EFAULT; if (copy_to_user(argp, &tr, sizeof(tr))) goto out; r = 0; break; } case KVM_SET_GUEST_DEBUG: { struct kvm_guest_debug dbg; r = -EFAULT; if (copy_from_user(&dbg, argp, sizeof(dbg))) goto out; r = kvm_arch_vcpu_ioctl_set_guest_debug(vcpu, &dbg); break; } case KVM_SET_SIGNAL_MASK: { struct kvm_signal_mask __user *sigmask_arg = argp; struct kvm_signal_mask kvm_sigmask; sigset_t sigset, *p; p = NULL; if (argp) { r = -EFAULT; if (copy_from_user(&kvm_sigmask, argp, sizeof(kvm_sigmask))) goto out; r = -EINVAL; if (kvm_sigmask.len != sizeof(sigset)) goto out; r = -EFAULT; if (copy_from_user(&sigset, sigmask_arg->sigset, sizeof(sigset))) goto out; p = &sigset; } r = kvm_vcpu_ioctl_set_sigmask(vcpu, p); break; } case KVM_GET_FPU: { fpu = kzalloc(sizeof(struct kvm_fpu), GFP_KERNEL); r = -ENOMEM; if (!fpu) goto out; r = kvm_arch_vcpu_ioctl_get_fpu(vcpu, fpu); if (r) goto out; r = -EFAULT; if (copy_to_user(argp, fpu, sizeof(struct kvm_fpu))) goto out; r = 0; break; } case KVM_SET_FPU: { fpu = memdup_user(argp, sizeof(*fpu)); if (IS_ERR(fpu)) { r = PTR_ERR(fpu); fpu = NULL; goto out; } r = kvm_arch_vcpu_ioctl_set_fpu(vcpu, fpu); break; } default: r = kvm_arch_vcpu_ioctl(filp, ioctl, arg); } out: mutex_unlock(&vcpu->mutex); kfree(fpu); kfree(kvm_sregs); return r; } ",0 "void RenderFrameImpl::SendUpdateFaviconURL( blink::WebIconURL::Type icon_types_mask) { if (frame_->Parent()) return; WebVector icon_urls = frame_->IconURLs(icon_types_mask); if (icon_urls.empty()) return; std::vector urls; urls.reserve(icon_urls.size()); for (const blink::WebIconURL& icon_url : icon_urls) { urls.push_back(FaviconURL(icon_url.GetIconURL(), ToFaviconType(icon_url.IconType()), ConvertToFaviconSizes(icon_url.Sizes()))); } DCHECK_EQ(icon_urls.size(), urls.size()); Send(new FrameHostMsg_UpdateFaviconURL(GetRoutingID(), urls)); } ",0 "void http_init_txn(struct session *s) { struct http_txn *txn = &s->txn; struct proxy *fe = s->fe; txn->flags = 0; txn->status = -1; txn->cookie_first_date = 0; txn->cookie_last_date = 0; txn->req.flags = 0; txn->req.sol = txn->req.eol = txn->req.eoh = 0; /* relative to the buffer */ txn->req.next = 0; txn->rsp.flags = 0; txn->rsp.sol = txn->rsp.eol = txn->rsp.eoh = 0; /* relative to the buffer */ txn->rsp.next = 0; txn->req.chunk_len = 0LL; txn->req.body_len = 0LL; txn->rsp.chunk_len = 0LL; txn->rsp.body_len = 0LL; txn->req.msg_state = HTTP_MSG_RQBEFORE; /* at the very beginning of the request */ txn->rsp.msg_state = HTTP_MSG_RPBEFORE; /* at the very beginning of the response */ txn->req.chn = s->req; txn->rsp.chn = s->rep; txn->auth.method = HTTP_AUTH_UNKNOWN; txn->req.err_pos = txn->rsp.err_pos = -2; /* block buggy requests/responses */ if (fe->options2 & PR_O2_REQBUG_OK) txn->req.err_pos = -1; /* let buggy requests pass */ if (txn->req.cap) memset(txn->req.cap, 0, fe->nb_req_cap * sizeof(void *)); if (txn->rsp.cap) memset(txn->rsp.cap, 0, fe->nb_rsp_cap * sizeof(void *)); if (txn->hdr_idx.v) hdr_idx_init(&txn->hdr_idx); } ",0 "static void UnsignedShortMethodMethod(const v8::FunctionCallbackInfo& info) { TestObject* impl = V8TestObject::ToImpl(info.Holder()); V8SetReturnValueUnsigned(info, impl->unsignedShortMethod()); } ",0 "SPICE_GNUC_VISIBLE SpiceServer *spice_server_new(void) { /* we can't handle multiple instances (yet) */ spice_assert(reds == NULL); reds = spice_new0(RedsState, 1); return reds; } ",0 "static uint64_t megasas_fw_time(void) { struct tm curtime; uint64_t bcd_time; qemu_get_timedate(&curtime, 0); bcd_time = ((uint64_t)curtime.tm_sec & 0xff) << 48 | ((uint64_t)curtime.tm_min & 0xff) << 40 | ((uint64_t)curtime.tm_hour & 0xff) << 32 | ((uint64_t)curtime.tm_mday & 0xff) << 24 | ((uint64_t)curtime.tm_mon & 0xff) << 16 | ((uint64_t)(curtime.tm_year + 1900) & 0xffff); return bcd_time; } ",0 "static int put_cacheinfo(struct sk_buff *skb, unsigned long cstamp, unsigned long tstamp, u32 preferred, u32 valid) { struct ifa_cacheinfo ci; ci.cstamp = cstamp_delta(cstamp); ci.tstamp = cstamp_delta(tstamp); ci.ifa_prefered = preferred; ci.ifa_valid = valid; return nla_put(skb, IFA_CACHEINFO, sizeof(ci), &ci); } ",0 "static void mac80211_hwsim_monitor_ack(struct ieee80211_channel *chan, const u8 *addr) { struct sk_buff *skb; struct hwsim_radiotap_ack_hdr *hdr; u16 flags; struct ieee80211_hdr *hdr11; if (!netif_running(hwsim_mon)) return; skb = dev_alloc_skb(100); if (skb == NULL) return; hdr = skb_put(skb, sizeof(*hdr)); hdr->hdr.it_version = PKTHDR_RADIOTAP_VERSION; hdr->hdr.it_pad = 0; hdr->hdr.it_len = cpu_to_le16(sizeof(*hdr)); hdr->hdr.it_present = cpu_to_le32((1 << IEEE80211_RADIOTAP_FLAGS) | (1 << IEEE80211_RADIOTAP_CHANNEL)); hdr->rt_flags = 0; hdr->pad = 0; hdr->rt_channel = cpu_to_le16(chan->center_freq); flags = IEEE80211_CHAN_2GHZ; hdr->rt_chbitmask = cpu_to_le16(flags); hdr11 = skb_put(skb, 10); hdr11->frame_control = cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_ACK); hdr11->duration_id = cpu_to_le16(0); memcpy(hdr11->addr1, addr, ETH_ALEN); skb->dev = hwsim_mon; skb_reset_mac_header(skb); skb->ip_summed = CHECKSUM_UNNECESSARY; skb->pkt_type = PACKET_OTHERHOST; skb->protocol = htons(ETH_P_802_2); memset(skb->cb, 0, sizeof(skb->cb)); netif_rx(skb); } ",0 "void V8TestObject::HighEntropyMethodWithMeasureAsMethodCallback(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_highEntropyMethodWithMeasureAs""); ExecutionContext* execution_context_for_measurement = CurrentExecutionContext(info.GetIsolate()); UseCounter::Count(execution_context_for_measurement, WebFeature::kTestFeatureHighEntropy); Dactyloscoper::Record(execution_context_for_measurement, WebFeature::kTestFeatureHighEntropy); test_object_v8_internal::HighEntropyMethodWithMeasureAsMethod(info); } ",0 "bool GLES2DecoderImpl::SimulateFixedAttribs( const char* function_name, GLuint max_vertex_accessed, bool* simulated, GLsizei primcount) { DCHECK(simulated); *simulated = false; if (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2) return true; if (!state_.vertex_attrib_manager->HaveFixedAttribs()) { return true; } LOCAL_PERFORMANCE_WARNING( ""GL_FIXED attributes have a signficant performance penalty""); GLuint elements_needed = 0; const VertexAttribManager::VertexAttribList& enabled_attribs = state_.vertex_attrib_manager->GetEnabledVertexAttribs(); for (VertexAttribManager::VertexAttribList::const_iterator it = enabled_attribs.begin(); it != enabled_attribs.end(); ++it) { const VertexAttrib* attrib = *it; const Program::VertexAttrib* attrib_info = state_.current_program->GetAttribInfoByLocation(attrib->index()); GLuint max_accessed = attrib->MaxVertexAccessed(primcount, max_vertex_accessed); GLuint num_vertices = max_accessed + 1; if (num_vertices == 0) { LOCAL_SET_GL_ERROR( GL_OUT_OF_MEMORY, function_name, ""Simulating attrib 0""); return false; } if (attrib_info && attrib->CanAccess(max_accessed) && attrib->type() == GL_FIXED) { uint32 elements_used = 0; if (!SafeMultiplyUint32(num_vertices, attrib->size(), &elements_used) || !SafeAddUint32(elements_needed, elements_used, &elements_needed)) { LOCAL_SET_GL_ERROR( GL_OUT_OF_MEMORY, function_name, ""simulating GL_FIXED attribs""); return false; } } } const uint32 kSizeOfFloat = sizeof(float); // NOLINT uint32 size_needed = 0; if (!SafeMultiplyUint32(elements_needed, kSizeOfFloat, &size_needed) || size_needed > 0x7FFFFFFFU) { LOCAL_SET_GL_ERROR( GL_OUT_OF_MEMORY, function_name, ""simulating GL_FIXED attribs""); return false; } LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(function_name); glBindBuffer(GL_ARRAY_BUFFER, fixed_attrib_buffer_id_); if (static_cast(size_needed) > fixed_attrib_buffer_size_) { glBufferData(GL_ARRAY_BUFFER, size_needed, NULL, GL_DYNAMIC_DRAW); GLenum error = glGetError(); if (error != GL_NO_ERROR) { LOCAL_SET_GL_ERROR( GL_OUT_OF_MEMORY, function_name, ""simulating GL_FIXED attribs""); return false; } } GLintptr offset = 0; for (VertexAttribManager::VertexAttribList::const_iterator it = enabled_attribs.begin(); it != enabled_attribs.end(); ++it) { const VertexAttrib* attrib = *it; const Program::VertexAttrib* attrib_info = state_.current_program->GetAttribInfoByLocation(attrib->index()); GLuint max_accessed = attrib->MaxVertexAccessed(primcount, max_vertex_accessed); GLuint num_vertices = max_accessed + 1; if (num_vertices == 0) { LOCAL_SET_GL_ERROR( GL_OUT_OF_MEMORY, function_name, ""Simulating attrib 0""); return false; } if (attrib_info && attrib->CanAccess(max_accessed) && attrib->type() == GL_FIXED) { int num_elements = attrib->size() * kSizeOfFloat; int size = num_elements * num_vertices; scoped_ptr data(new float[size]); const int32* src = reinterpret_cast( attrib->buffer()->GetRange(attrib->offset(), size)); const int32* end = src + num_elements; float* dst = data.get(); while (src != end) { *dst++ = static_cast(*src++) / 65536.0f; } glBufferSubData(GL_ARRAY_BUFFER, offset, size, data.get()); glVertexAttribPointer( attrib->index(), attrib->size(), GL_FLOAT, false, 0, reinterpret_cast(offset)); offset += size; } } *simulated = true; return true; } ",0 "PHP_FUNCTION(checkdate) { long m, d, y; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""lll"", &m, &d, &y) == FAILURE) { RETURN_FALSE; } if (y < 1 || y > 32767 || !timelib_valid_date(y, m, d)) { RETURN_FALSE; } RETURN_TRUE; /* True : This month, day, year arguments are valid */ } ",0 "sp HeapCache::find_heap(const sp& binder) { Mutex::Autolock _l(mHeapCacheLock); ssize_t i = mHeapCache.indexOfKey(binder); if (i>=0) { heap_info_t& info = mHeapCache.editValueAt(i); ALOGD_IF(VERBOSE, ""found binder=%p, heap=%p, size=%zu, fd=%d, count=%d"", binder.get(), info.heap.get(), static_cast(info.heap.get())->mSize, static_cast(info.heap.get())->mHeapId, info.count); android_atomic_inc(&info.count); return info.heap; } else { heap_info_t info; info.heap = interface_cast(binder); info.count = 1; mHeapCache.add(binder, info); return info.heap; } } ",0 "static void set_rx_flow_on(struct caifsock *cf_sk) { set_bit(RX_FLOW_ON_BIT, (void *) &cf_sk->flow_state); } ",0 "BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2Ctx (gdIOCtxPtr in) { int sx, sy; int i; int ncx, ncy, nc, cs, cx, cy; int x, y, ylo, yhi, xlo, xhi; int vers, fmt; t_chunk_info *chunkIdx = NULL; /* So we can gdFree it with impunity. */ unsigned char *chunkBuf = NULL; /* So we can gdFree it with impunity. */ int chunkNum = 0; int chunkMax = 0; uLongf chunkLen; int chunkPos = 0; int compMax = 0; int bytesPerPixel; char *compBuf = NULL; /* So we can gdFree it with impunity. */ gdImagePtr im; /* Get the header */ im = _gd2CreateFromFile (in, &sx, &sy, &cs, &vers, &fmt, &ncx, &ncy, &chunkIdx); if (im == NULL) { /* No need to free chunkIdx as _gd2CreateFromFile does it for us. */ return 0; } bytesPerPixel = im->trueColor ? 4 : 1; nc = ncx * ncy; if (gd2_compressed (fmt)) { /* Find the maximum compressed chunk size. */ compMax = 0; for (i = 0; (i < nc); i++) { if (chunkIdx[i].size > compMax) { compMax = chunkIdx[i].size; }; }; compMax++; /* Allocate buffers */ chunkMax = cs * bytesPerPixel * cs; chunkBuf = gdCalloc (chunkMax, 1); if (!chunkBuf) { goto fail; } compBuf = gdCalloc (compMax, 1); if (!compBuf) { goto fail; } GD2_DBG (printf (""Largest compressed chunk is %d bytes\n"", compMax)); }; /* if ( (ncx != sx / cs) || (ncy != sy / cs)) { */ /* goto fail2; */ /* }; */ /* Read the data... */ for (cy = 0; (cy < ncy); cy++) { for (cx = 0; (cx < ncx); cx++) { ylo = cy * cs; yhi = ylo + cs; if (yhi > im->sy) { yhi = im->sy; }; GD2_DBG (printf (""Processing Chunk %d (%d, %d), y from %d to %d\n"", chunkNum, cx, cy, ylo, yhi)); if (gd2_compressed (fmt)) { chunkLen = chunkMax; if (!_gd2ReadChunk (chunkIdx[chunkNum].offset, compBuf, chunkIdx[chunkNum].size, (char *) chunkBuf, &chunkLen, in)) { GD2_DBG (printf (""Error reading comproessed chunk\n"")); goto fail; }; chunkPos = 0; }; for (y = ylo; (y < yhi); y++) { xlo = cx * cs; xhi = xlo + cs; if (xhi > im->sx) { xhi = im->sx; }; /*GD2_DBG(printf(""y=%d: "",y)); */ if (!gd2_compressed (fmt)) { for (x = xlo; x < xhi; x++) { if (im->trueColor) { if (!gdGetInt (&im->tpixels[y][x], in)) { /*printf(""EOF while reading\n""); */ /*gdImageDestroy(im); */ /*return 0; */ im->tpixels[y][x] = 0; } } else { int ch; if (!gdGetByte (&ch, in)) { /*printf(""EOF while reading\n""); */ /*gdImageDestroy(im); */ /*return 0; */ ch = 0; } im->pixels[y][x] = ch; } } } else { for (x = xlo; x < xhi; x++) { if (im->trueColor) { /* 2.0.1: work around a gcc bug by being verbose. TBB */ int a = chunkBuf[chunkPos++] << 24; int r = chunkBuf[chunkPos++] << 16; int g = chunkBuf[chunkPos++] << 8; int b = chunkBuf[chunkPos++]; /* 2.0.11: tpixels */ im->tpixels[y][x] = a + r + g + b; } else { im->pixels[y][x] = chunkBuf[chunkPos++]; } }; }; /*GD2_DBG(printf(""\n"")); */ }; chunkNum++; }; }; GD2_DBG (printf (""Freeing memory\n"")); gdFree (chunkBuf); gdFree (compBuf); gdFree (chunkIdx); GD2_DBG (printf (""Done\n"")); return im; fail: gdImageDestroy (im); if (chunkBuf) { gdFree (chunkBuf); } if (compBuf) { gdFree (compBuf); } if (chunkIdx) { gdFree (chunkIdx); } return 0; } ",1 "void SyncBackendHost::Core::set_processing_passphrase() { DCHECK(MessageLoop::current() == host_->frontend_loop_); processing_passphrase_ = true; } ",0 "void InlineFlowBox::setLayoutOverflow(const IntRect& rect) { IntRect frameBox = enclosingIntRect(FloatRect(x(), y(), width(), height())); if (frameBox == rect || rect.isEmpty()) return; if (!m_overflow) m_overflow.set(new RenderOverflow(frameBox, frameBox)); m_overflow->setLayoutOverflow(rect); } ",0 "static ssize_t tty_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { int i; struct inode *inode = file_inode(file); struct tty_struct *tty = file_tty(file); struct tty_ldisc *ld; if (tty_paranoia_check(tty, inode, ""tty_read"")) return -EIO; if (!tty || (test_bit(TTY_IO_ERROR, &tty->flags))) return -EIO; /* We want to wait for the line discipline to sort out in this situation */ ld = tty_ldisc_ref_wait(tty); if (ld->ops->read) i = ld->ops->read(tty, file, buf, count); else i = -EIO; tty_ldisc_deref(ld); if (i > 0) tty_update_time(&inode->i_atime); return i; } ",0 "bool SectionHasAutofilledField(const FormStructure& form_structure, const FormData& form, const std::string& section) { DCHECK_EQ(form_structure.field_count(), form.fields.size()); for (size_t i = 0; i < form_structure.field_count(); ++i) { if (form_structure.field(i)->section == section && form.fields[i].is_autofilled) { return true; } } return false; } ",1 "cntsize(QTNode *in, int *sumlen, int *nnode) { /* since this function recurses, it could be driven to stack overflow. */ check_stack_depth(); *nnode += 1; if (in->valnode->type == QI_OPR) { int i; for (i = 0; i < in->nchild; i++) cntsize(in->child[i], sumlen, nnode); } else { *sumlen += in->valnode->qoperand.length + 1; } } ",0 "status_t ESDS::parseDecoderConfigDescriptor(size_t offset, size_t size) { if (size < 13) { return ERROR_MALFORMED; } mObjectTypeIndication = mData[offset]; offset += 13; size -= 13; if (size == 0) { mDecoderSpecificOffset = 0; mDecoderSpecificLength = 0; return OK; } uint8_t tag; size_t sub_offset, sub_size; status_t err = skipDescriptorHeader( offset, size, &tag, &sub_offset, &sub_size); if (err != OK) { return err; } if (tag != kTag_DecoderSpecificInfo) { return ERROR_MALFORMED; } mDecoderSpecificOffset = sub_offset; mDecoderSpecificLength = sub_size; return OK; } ",0 "static void xeta_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) { u32 y, z, sum = 0; u32 limit = XTEA_DELTA * XTEA_ROUNDS; struct xtea_ctx *ctx = crypto_tfm_ctx(tfm); const __le32 *in = (const __le32 *)src; __le32 *out = (__le32 *)dst; y = le32_to_cpu(in[0]); z = le32_to_cpu(in[1]); while (sum != limit) { y += (z << 4 ^ z >> 5) + (z ^ sum) + ctx->KEY[sum&3]; sum += XTEA_DELTA; z += (y << 4 ^ y >> 5) + (y ^ sum) + ctx->KEY[sum>>11 &3]; } out[0] = cpu_to_le32(y); out[1] = cpu_to_le32(z); } ",0 " xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp, xmlNodePtr node, const xmlChar *mode, const xmlChar *modeURI) { int i; xsltStepOpPtr step, sel = NULL; xsltStepStates states = {0, 0, NULL}; /* // may require backtrack */ if ((comp == NULL) || (node == NULL) || (ctxt == NULL)) { xsltTransformError(ctxt, NULL, node, ""xsltTestCompMatch: null arg\n""); return(-1); } if (mode != NULL) { if (comp->mode == NULL) return(0); /* * both mode strings must be interned on the stylesheet dictionary */ if (comp->mode != mode) return(0); } else { if (comp->mode != NULL) return(0); } if (modeURI != NULL) { if (comp->modeURI == NULL) return(0); /* * both modeURI strings must be interned on the stylesheet dictionary */ if (comp->modeURI != modeURI) return(0); } else { if (comp->modeURI != NULL) return(0); } i = 0; restart: for (;i < comp->nbStep;i++) { step = &comp->steps[i]; if (step->op != XSLT_OP_PREDICATE) sel = step; switch (step->op) { case XSLT_OP_END: goto found; case XSLT_OP_ROOT: if ((node->type == XML_DOCUMENT_NODE) || #ifdef LIBXML_DOCB_ENABLED (node->type == XML_DOCB_DOCUMENT_NODE) || #endif (node->type == XML_HTML_DOCUMENT_NODE)) continue; if ((node->type == XML_ELEMENT_NODE) && (node->name[0] == ' ')) continue; goto rollback; case XSLT_OP_ELEM: if (node->type != XML_ELEMENT_NODE) goto rollback; if (step->value == NULL) continue; if (step->value[0] != node->name[0]) goto rollback; if (!xmlStrEqual(step->value, node->name)) goto rollback; /* Namespace test */ if (node->ns == NULL) { if (step->value2 != NULL) goto rollback; } else if (node->ns->href != NULL) { if (step->value2 == NULL) goto rollback; if (!xmlStrEqual(step->value2, node->ns->href)) goto rollback; } continue; case XSLT_OP_ATTR: if (node->type != XML_ATTRIBUTE_NODE) goto rollback; if (step->value != NULL) { if (step->value[0] != node->name[0]) goto rollback; if (!xmlStrEqual(step->value, node->name)) goto rollback; } /* Namespace test */ if (node->ns == NULL) { if (step->value2 != NULL) goto rollback; } else if (step->value2 != NULL) { if (!xmlStrEqual(step->value2, node->ns->href)) goto rollback; } continue; case XSLT_OP_PARENT: if ((node->type == XML_DOCUMENT_NODE) || (node->type == XML_HTML_DOCUMENT_NODE) || #ifdef LIBXML_DOCB_ENABLED (node->type == XML_DOCB_DOCUMENT_NODE) || #endif (node->type == XML_NAMESPACE_DECL)) goto rollback; node = node->parent; if (node == NULL) goto rollback; if (step->value == NULL) continue; if (step->value[0] != node->name[0]) goto rollback; if (!xmlStrEqual(step->value, node->name)) goto rollback; /* Namespace test */ if (node->ns == NULL) { if (step->value2 != NULL) goto rollback; } else if (node->ns->href != NULL) { if (step->value2 == NULL) goto rollback; if (!xmlStrEqual(step->value2, node->ns->href)) goto rollback; } continue; case XSLT_OP_ANCESTOR: /* TODO: implement coalescing of ANCESTOR/NODE ops */ if (step->value == NULL) { step = &comp->steps[i+1]; if (step->op == XSLT_OP_ROOT) goto found; /* added NS, ID and KEY as a result of bug 168208 */ if ((step->op != XSLT_OP_ELEM) && (step->op != XSLT_OP_ALL) && (step->op != XSLT_OP_NS) && (step->op != XSLT_OP_ID) && (step->op != XSLT_OP_KEY)) goto rollback; } if (node == NULL) goto rollback; if ((node->type == XML_DOCUMENT_NODE) || (node->type == XML_HTML_DOCUMENT_NODE) || #ifdef LIBXML_DOCB_ENABLED (node->type == XML_DOCB_DOCUMENT_NODE) || #endif (node->type == XML_NAMESPACE_DECL)) goto rollback; node = node->parent; if ((step->op != XSLT_OP_ELEM) && step->op != XSLT_OP_ALL) { xsltPatPushState(ctxt, &states, i, node); continue; } i++; if (step->value == NULL) { xsltPatPushState(ctxt, &states, i - 1, node); continue; } while (node != NULL) { if ((node->type == XML_ELEMENT_NODE) && (step->value[0] == node->name[0]) && (xmlStrEqual(step->value, node->name))) { /* Namespace test */ if (node->ns == NULL) { if (step->value2 == NULL) break; } else if (node->ns->href != NULL) { if ((step->value2 != NULL) && (xmlStrEqual(step->value2, node->ns->href))) break; } } node = node->parent; } if (node == NULL) goto rollback; xsltPatPushState(ctxt, &states, i - 1, node); continue; case XSLT_OP_ID: { /* TODO Handle IDs decently, must be done differently */ xmlAttrPtr id; if (node->type != XML_ELEMENT_NODE) goto rollback; id = xmlGetID(node->doc, step->value); if ((id == NULL) || (id->parent != node)) goto rollback; break; } case XSLT_OP_KEY: { xmlNodeSetPtr list; int indx; list = xsltGetKey(ctxt, step->value, step->value3, step->value2); if (list == NULL) goto rollback; for (indx = 0;indx < list->nodeNr;indx++) if (list->nodeTab[indx] == node) break; if (indx >= list->nodeNr) goto rollback; break; } case XSLT_OP_NS: if (node->type != XML_ELEMENT_NODE) goto rollback; if (node->ns == NULL) { if (step->value != NULL) goto rollback; } else if (node->ns->href != NULL) { if (step->value == NULL) goto rollback; if (!xmlStrEqual(step->value, node->ns->href)) goto rollback; } break; case XSLT_OP_ALL: if (node->type != XML_ELEMENT_NODE) goto rollback; break; case XSLT_OP_PREDICATE: { xmlNodePtr oldNode; xmlDocPtr doc; int oldCS, oldCP; int pos = 0, len = 0; int isRVT; /* * when there is cascading XSLT_OP_PREDICATE, then use a * direct computation approach. It's not done directly * at the beginning of the routine to filter out as much * as possible this costly computation. */ if (comp->direct) { if (states.states != NULL) { /* Free the rollback states */ xmlFree(states.states); } return(xsltTestCompMatchDirect(ctxt, comp, node, comp->nsList, comp->nsNr)); } doc = node->doc; if (XSLT_IS_RES_TREE_FRAG(doc)) isRVT = 1; else isRVT = 0; /* * Depending on the last selection, one may need to * recompute contextSize and proximityPosition. */ oldCS = ctxt->xpathCtxt->contextSize; oldCP = ctxt->xpathCtxt->proximityPosition; if ((sel != NULL) && (sel->op == XSLT_OP_ELEM) && (sel->value != NULL) && (node->type == XML_ELEMENT_NODE) && (node->parent != NULL)) { xmlNodePtr previous; int nocache = 0; previous = (xmlNodePtr) XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra, ptr); if ((previous != NULL) && (previous->parent == node->parent)) { /* * just walk back to adjust the index */ int indx = 0; xmlNodePtr sibling = node; while (sibling != NULL) { if (sibling == previous) break; if ((sibling->type == XML_ELEMENT_NODE) && (previous->name != NULL) && (sibling->name != NULL) && (previous->name[0] == sibling->name[0]) && (xmlStrEqual(previous->name, sibling->name))) { if ((sel->value2 == NULL) || ((sibling->ns != NULL) && (xmlStrEqual(sel->value2, sibling->ns->href)))) indx++; } sibling = sibling->prev; } if (sibling == NULL) { /* hum going backward in document order ... */ indx = 0; sibling = node; while (sibling != NULL) { if (sibling == previous) break; if ((sibling->type == XML_ELEMENT_NODE) && (previous->name != NULL) && (sibling->name != NULL) && (previous->name[0] == sibling->name[0]) && (xmlStrEqual(previous->name, sibling->name))) { if ((sel->value2 == NULL) || ((sibling->ns != NULL) && (xmlStrEqual(sel->value2, sibling->ns->href)))) { indx--; } } sibling = sibling->next; } } if (sibling != NULL) { pos = XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra, ival) + indx; /* * If the node is in a Value Tree we need to * save len, but cannot cache the node! * (bugs 153137 and 158840) */ if (node->doc != NULL) { len = XSLT_RUNTIME_EXTRA(ctxt, sel->lenExtra, ival); if (!isRVT) { XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra, ptr) = node; XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra, ival) = pos; } } } else pos = 0; } else { /* * recompute the index */ xmlNodePtr parent = node->parent; xmlNodePtr siblings = NULL; if (parent) siblings = parent->children; while (siblings != NULL) { if (siblings->type == XML_ELEMENT_NODE) { if (siblings == node) { len++; pos = len; } else if ((node->name != NULL) && (siblings->name != NULL) && (node->name[0] == siblings->name[0]) && (xmlStrEqual(node->name, siblings->name))) { if ((sel->value2 == NULL) || ((siblings->ns != NULL) && (xmlStrEqual(sel->value2, siblings->ns->href)))) len++; } } siblings = siblings->next; } if ((parent == NULL) || (node->doc == NULL)) nocache = 1; else { while (parent->parent != NULL) parent = parent->parent; if (((parent->type != XML_DOCUMENT_NODE) && (parent->type != XML_HTML_DOCUMENT_NODE)) || (parent != (xmlNodePtr) node->doc)) nocache = 1; } } if (pos != 0) { ctxt->xpathCtxt->contextSize = len; ctxt->xpathCtxt->proximityPosition = pos; /* * If the node is in a Value Tree we cannot * cache it ! */ if ((!isRVT) && (node->doc != NULL) && (nocache == 0)) { XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra, ptr) = node; XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra, ival) = pos; XSLT_RUNTIME_EXTRA(ctxt, sel->lenExtra, ival) = len; } } } else if ((sel != NULL) && (sel->op == XSLT_OP_ALL) && (node->type == XML_ELEMENT_NODE)) { xmlNodePtr previous; int nocache = 0; previous = (xmlNodePtr) XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra, ptr); if ((previous != NULL) && (previous->parent == node->parent)) { /* * just walk back to adjust the index */ int indx = 0; xmlNodePtr sibling = node; while (sibling != NULL) { if (sibling == previous) break; if (sibling->type == XML_ELEMENT_NODE) indx++; sibling = sibling->prev; } if (sibling == NULL) { /* hum going backward in document order ... */ indx = 0; sibling = node; while (sibling != NULL) { if (sibling == previous) break; if (sibling->type == XML_ELEMENT_NODE) indx--; sibling = sibling->next; } } if (sibling != NULL) { pos = XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra, ival) + indx; /* * If the node is in a Value Tree we cannot * cache it ! */ if ((node->doc != NULL) && !isRVT) { len = XSLT_RUNTIME_EXTRA(ctxt, sel->lenExtra, ival); XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra, ptr) = node; XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra, ival) = pos; } } else pos = 0; } else { /* * recompute the index */ xmlNodePtr parent = node->parent; xmlNodePtr siblings = NULL; if (parent) siblings = parent->children; while (siblings != NULL) { if (siblings->type == XML_ELEMENT_NODE) { len++; if (siblings == node) { pos = len; } } siblings = siblings->next; } if ((parent == NULL) || (node->doc == NULL)) nocache = 1; else { while (parent->parent != NULL) parent = parent->parent; if (((parent->type != XML_DOCUMENT_NODE) && (parent->type != XML_HTML_DOCUMENT_NODE)) || (parent != (xmlNodePtr) node->doc)) nocache = 1; } } if (pos != 0) { ctxt->xpathCtxt->contextSize = len; ctxt->xpathCtxt->proximityPosition = pos; /* * If the node is in a Value Tree we cannot * cache it ! */ if ((node->doc != NULL) && (nocache == 0) && !isRVT) { XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra, ptr) = node; XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra, ival) = pos; XSLT_RUNTIME_EXTRA(ctxt, sel->lenExtra, ival) = len; } } } oldNode = ctxt->node; ctxt->node = node; if (step->value == NULL) goto wrong_index; if (step->comp == NULL) goto wrong_index; if (!xsltEvalXPathPredicate(ctxt, step->comp, comp->nsList, comp->nsNr)) goto wrong_index; if (pos != 0) { ctxt->xpathCtxt->contextSize = oldCS; ctxt->xpathCtxt->proximityPosition = oldCP; } ctxt->node = oldNode; break; wrong_index: if (pos != 0) { ctxt->xpathCtxt->contextSize = oldCS; ctxt->xpathCtxt->proximityPosition = oldCP; } ctxt->node = oldNode; goto rollback; } case XSLT_OP_PI: if (node->type != XML_PI_NODE) goto rollback; if (step->value != NULL) { if (!xmlStrEqual(step->value, node->name)) goto rollback; } break; case XSLT_OP_COMMENT: if (node->type != XML_COMMENT_NODE) goto rollback; break; case XSLT_OP_TEXT: if ((node->type != XML_TEXT_NODE) && (node->type != XML_CDATA_SECTION_NODE)) goto rollback; break; case XSLT_OP_NODE: switch (node->type) { case XML_ELEMENT_NODE: case XML_CDATA_SECTION_NODE: case XML_PI_NODE: case XML_COMMENT_NODE: case XML_TEXT_NODE: break; default: goto rollback; } break; } } found: if (states.states != NULL) { /* Free the rollback states */ xmlFree(states.states); } return(1); rollback: /* got an error try to rollback */ if (states.states == NULL) return(0); if (states.nbstates <= 0) { xmlFree(states.states); return(0); } states.nbstates--; i = states.states[states.nbstates].step; node = states.states[states.nbstates].node; #if 0 fprintf(stderr, ""Pop: %d, %s\n"", i, node->name); #endif goto restart; } ",1 "void usb_queue_reset_device(struct usb_interface *iface) { if (schedule_work(&iface->reset_ws)) usb_get_intf(iface); } ",0 "ofputil_put_ofp13_table_stats(const struct ofputil_table_stats *stats, struct ofpbuf *buf) { struct ofp13_table_stats *out; out = ofpbuf_put_zeros(buf, sizeof *out); out->table_id = stats->table_id; out->active_count = htonl(stats->active_count); out->lookup_count = htonll(stats->lookup_count); out->matched_count = htonll(stats->matched_count); } ",0 "void HTMLDocumentParser::prepareToStopParsing() { ASSERT(!hasInsertionPoint()); RefPtr protect(this); pumpTokenizerIfPossible(ForceSynchronous); if (isStopped()) return; DocumentParser::prepareToStopParsing(); if (m_scriptRunner) document()->setReadyState(Document::Interactive); if (isDetached()) return; attemptToRunDeferredScriptsAndEnd(); } ",0 " bool OnRequest(content::URLLoaderInterceptor::RequestParams* params) { if (callback_ && callback_.Run(params)) return true; if (params->url_request.url.host() == ""clients2.google.com"" && params->url_request.url.path() == ""/service/update2/crx"") { content::URLLoaderInterceptor::WriteResponse( ""chrome/test/data/extensions/good2_update_manifest.xml"", params->client.get()); return true; } if (params->url_request.url.path() == ""/good_update_manifest.xml"") { content::URLLoaderInterceptor::WriteResponse( ""chrome/test/data/extensions/good2_update_manifest.xml"", params->client.get()); return true; } if (params->url_request.url.path() == ""/extensions/good_v1.crx"") { content::URLLoaderInterceptor::WriteResponse( ""chrome/test/data/extensions/good_v1.crx"", params->client.get()); return true; } if (params->url_request.url.path() == ""/extensions/good2.crx"") { content::URLLoaderInterceptor::WriteResponse( ""chrome/test/data/extensions/good2.crx"", params->client.get()); return true; } return false; } ",0 "LayoutObject* HTMLIFrameElement::CreateLayoutObject(const ComputedStyle&) { return new LayoutIFrame(this); } ",0 "void HTMLTextAreaElement::setNonDirtyValue(const String& value) { setValueCommon(value); m_isDirty = false; setNeedsValidityCheck(); } ",0 "long join_session_keyring(const char *name) { const struct cred *old; struct cred *new; struct key *keyring; long ret, serial; new = prepare_creds(); if (!new) return -ENOMEM; old = current_cred(); /* if no name is provided, install an anonymous keyring */ if (!name) { ret = install_session_keyring_to_cred(new, NULL); if (ret < 0) goto error; serial = new->session_keyring->serial; ret = commit_creds(new); if (ret == 0) ret = serial; goto okay; } /* allow the user to join or create a named keyring */ mutex_lock(&key_session_mutex); /* look for an existing keyring of this name */ keyring = find_keyring_by_name(name, false); if (PTR_ERR(keyring) == -ENOKEY) { /* not found - try and create a new one */ keyring = keyring_alloc( name, old->uid, old->gid, old, KEY_POS_ALL | KEY_USR_VIEW | KEY_USR_READ | KEY_USR_LINK, KEY_ALLOC_IN_QUOTA, NULL); if (IS_ERR(keyring)) { ret = PTR_ERR(keyring); goto error2; } } else if (IS_ERR(keyring)) { ret = PTR_ERR(keyring); goto error2; } else if (keyring == new->session_keyring) { ret = 0; goto error2; } /* we've got a keyring - now to install it */ ret = install_session_keyring_to_cred(new, keyring); if (ret < 0) goto error2; commit_creds(new); mutex_unlock(&key_session_mutex); ret = keyring->serial; key_put(keyring); okay: return ret; error2: mutex_unlock(&key_session_mutex); error: abort_creds(new); return ret; } ",0 "static int tipc_getsockopt(struct socket *sock, int lvl, int opt, char __user *ov, int __user *ol) { struct sock *sk = sock->sk; struct tipc_sock *tsk = tipc_sk(sk); int len; u32 value; int res; if ((lvl == IPPROTO_TCP) && (sock->type == SOCK_STREAM)) return put_user(0, ol); if (lvl != SOL_TIPC) return -ENOPROTOOPT; res = get_user(len, ol); if (res) return res; lock_sock(sk); switch (opt) { case TIPC_IMPORTANCE: value = tsk_importance(tsk); break; case TIPC_SRC_DROPPABLE: value = tsk_unreliable(tsk); break; case TIPC_DEST_DROPPABLE: value = tsk_unreturnable(tsk); break; case TIPC_CONN_TIMEOUT: value = tsk->conn_timeout; /* no need to set ""res"", since already 0 at this point */ break; case TIPC_NODE_RECVQ_DEPTH: value = 0; /* was tipc_queue_size, now obsolete */ break; case TIPC_SOCK_RECVQ_DEPTH: value = skb_queue_len(&sk->sk_receive_queue); break; default: res = -EINVAL; } release_sock(sk); if (res) return res; /* ""get"" failed */ if (len < sizeof(value)) return -EINVAL; if (copy_to_user(ov, &value, sizeof(value))) return -EFAULT; return put_user(sizeof(value), ol); } ",0 "void IndexedDBDatabase::ReportError(Status status) { DCHECK(!status.ok()); if (status.IsCorruption()) { IndexedDBDatabaseError error(blink::kWebIDBDatabaseExceptionUnknownError, base::ASCIIToUTF16(status.ToString())); factory_->HandleBackingStoreCorruption(backing_store_->origin(), error); } else { factory_->HandleBackingStoreFailure(backing_store_->origin()); } } ",0 "pgp_put_data_plain(sc_card_t *card, unsigned int tag, const u8 *buf, size_t buf_len) { struct pgp_priv_data *priv = DRVDATA(card); sc_apdu_t apdu; u8 ins = 0xDA; u8 p1 = tag >> 8; u8 p2 = tag & 0xFF; u8 apdu_case = (card->type == SC_CARD_TYPE_OPENPGP_GNUK) ? SC_APDU_CASE_3_SHORT : SC_APDU_CASE_3; int r; LOG_FUNC_CALLED(card->ctx); /* Extended Header list (DO 004D) needs a variant of PUT DATA command */ if (tag == 0x004D) { ins = 0xDB; p1 = 0x3F; p2 = 0xFF; } /* build APDU */ if (buf != NULL && buf_len > 0) { sc_format_apdu(card, &apdu, apdu_case, ins, p1, p2); /* if card/reader does not support extended APDUs, but chaining, then set it */ if (((card->caps & SC_CARD_CAP_APDU_EXT) == 0) && (priv->ext_caps & EXT_CAP_CHAINING)) apdu.flags |= SC_APDU_FLAGS_CHAINING; apdu.data = (u8 *)buf; apdu.datalen = buf_len; apdu.lc = buf_len; } else { /* This case is to empty DO */ sc_format_apdu(card, &apdu, SC_APDU_CASE_1, ins, p1, p2); } /* send APDU to card */ r = sc_transmit_apdu(card, &apdu); LOG_TEST_RET(card->ctx, r, ""APDU transmit failed""); /* check response */ r = sc_check_sw(card, apdu.sw1, apdu.sw2); if (r < 0) LOG_FUNC_RETURN(card->ctx, r); LOG_FUNC_RETURN(card->ctx, (int)buf_len); } ",0 "bool EventConverterEvdevImpl::HasCapsLockLed() const { return has_caps_lock_led_; } ",0 "static void *get_delta(struct object_entry *entry) { unsigned long size, base_size, delta_size; void *buf, *base_buf, *delta_buf; enum object_type type; buf = read_sha1_file(entry->idx.sha1, &type, &size); if (!buf) die(""unable to read %s"", sha1_to_hex(entry->idx.sha1)); base_buf = read_sha1_file(entry->delta->idx.sha1, &type, &base_size); if (!base_buf) die(""unable to read %s"", sha1_to_hex(entry->delta->idx.sha1)); delta_buf = diff_delta(base_buf, base_size, buf, size, &delta_size, 0); if (!delta_buf || delta_size != entry->delta_size) die(""delta size changed""); free(buf); free(base_buf); return delta_buf; } ",0 "MockNetworkLayer::~MockNetworkLayer() {} ",0 "static SQLITE_NOINLINE void *dbMallocRawFinish(sqlite3 *db, u64 n){ void *p; assert( db!=0 ); p = sqlite3Malloc(n); if( !p ) sqlite3OomFault(db); sqlite3MemdebugSetType(p, (db->lookaside.bDisable==0) ? MEMTYPE_LOOKASIDE : MEMTYPE_HEAP); return p; } ",0 " bool scroll_end() const { return scroll_end_; } ",0 "pushEvent(int cmd, void *data) { Event *event; event = New(Event); event->cmd = cmd; event->data = data; event->next = NULL; if (CurrentEvent) LastEvent->next = event; else CurrentEvent = event; LastEvent = event; } ",0 "bool DrawingBuffer::WantDepthOrStencil() { return want_depth_ || want_stencil_; } ",0 "static void usb_api_blocking_completion(struct urb *urb) { struct api_context *ctx = urb->context; ctx->status = urb->status; complete(&ctx->done); } ",0 "bool IsTraceEventArgsWhitelisted(const char* category_group_name, const char* event_name) { if (base::MatchPattern(category_group_name, ""benchmark"") && base::MatchPattern(event_name, ""whitelisted"")) { return true; } return false; } ",1 "ProcRenderAddTraps (ClientPtr client) { int ntraps; PicturePtr pPicture; REQUEST(xRenderAddTrapsReq); REQUEST_AT_LEAST_SIZE(xRenderAddTrapsReq); VERIFY_PICTURE (pPicture, stuff->picture, client, DixWriteAccess); if (!pPicture->pDrawable) return BadDrawable; ntraps = (client->req_len << 2) - sizeof (xRenderAddTrapsReq); if (ntraps % sizeof (xTrap)) return BadLength; ntraps /= sizeof (xTrap); if (ntraps) AddTraps (pPicture, stuff->xOff, stuff->yOff, ntraps, (xTrap *) &stuff[1]); return Success; } ",0 "static int snd_timer_stop1(struct snd_timer_instance *timeri, bool stop) { struct snd_timer *timer; int result = 0; unsigned long flags; timer = timeri->timer; if (!timer) return -EINVAL; spin_lock_irqsave(&timer->lock, flags); if (!(timeri->flags & (SNDRV_TIMER_IFLG_RUNNING | SNDRV_TIMER_IFLG_START))) { result = -EBUSY; goto unlock; } list_del_init(&timeri->ack_list); list_del_init(&timeri->active_list); if (timer->card && timer->card->shutdown) goto unlock; if (stop) { timeri->cticks = timeri->ticks; timeri->pticks = 0; } if ((timeri->flags & SNDRV_TIMER_IFLG_RUNNING) && !(--timer->running)) { timer->hw.stop(timer); if (timer->flags & SNDRV_TIMER_FLG_RESCHED) { timer->flags &= ~SNDRV_TIMER_FLG_RESCHED; snd_timer_reschedule(timer, 0); if (timer->flags & SNDRV_TIMER_FLG_CHANGE) { timer->flags &= ~SNDRV_TIMER_FLG_CHANGE; timer->hw.start(timer); } } } timeri->flags &= ~(SNDRV_TIMER_IFLG_RUNNING | SNDRV_TIMER_IFLG_START); if (stop) timeri->flags &= ~SNDRV_TIMER_IFLG_PAUSED; else timeri->flags |= SNDRV_TIMER_IFLG_PAUSED; snd_timer_notify1(timeri, stop ? SNDRV_TIMER_EVENT_STOP : SNDRV_TIMER_EVENT_CONTINUE); unlock: spin_unlock_irqrestore(&timer->lock, flags); return result; } ",0 "static void net_rx_action(struct softirq_action *h) { struct softnet_data *sd = this_cpu_ptr(&softnet_data); unsigned long time_limit = jiffies + 2; int budget = netdev_budget; LIST_HEAD(list); LIST_HEAD(repoll); local_irq_disable(); list_splice_init(&sd->poll_list, &list); local_irq_enable(); for (;;) { struct napi_struct *n; if (list_empty(&list)) { if (!sd_has_rps_ipi_waiting(sd) && list_empty(&repoll)) return; break; } n = list_first_entry(&list, struct napi_struct, poll_list); budget -= napi_poll(n, &repoll); /* If softirq window is exhausted then punt. * Allow this to run for 2 jiffies since which will allow * an average latency of 1.5/HZ. */ if (unlikely(budget <= 0 || time_after_eq(jiffies, time_limit))) { sd->time_squeeze++; break; } } __kfree_skb_flush(); local_irq_disable(); list_splice_tail_init(&sd->poll_list, &list); list_splice_tail(&repoll, &list); list_splice(&list, &sd->poll_list); if (!list_empty(&sd->poll_list)) __raise_softirq_irqoff(NET_RX_SOFTIRQ); net_rps_action_and_irq_enable(sd); } ",0 "static void CallWithExecutionContextVoidMethodMethod(const v8::FunctionCallbackInfo& info) { TestObject* impl = V8TestObject::ToImpl(info.Holder()); ExecutionContext* execution_context = ExecutionContext::ForRelevantRealm(info); impl->callWithExecutionContextVoidMethod(execution_context); } ",0 "search_try_next(struct evdns_request *const handle) { struct request *req = handle->current_req; struct evdns_base *base = req->base; struct request *newreq; ASSERT_LOCKED(base); if (handle->search_state) { /* it is part of a search */ char *new_name; handle->search_index++; if (handle->search_index >= handle->search_state->num_domains) { /* no more postfixes to try, however we may need to try */ /* this name without a postfix */ if (string_num_dots(handle->search_origname) < handle->search_state->ndots) { /* yep, we need to try it raw */ newreq = request_new(base, NULL, req->request_type, handle->search_origname, handle->search_flags, req->user_callback, req->user_pointer); log(EVDNS_LOG_DEBUG, ""Search: trying raw query %s"", handle->search_origname); if (newreq) { search_request_finished(handle); goto submit_next; } } return 1; } new_name = search_make_new(handle->search_state, handle->search_index, handle->search_origname); if (!new_name) return 1; log(EVDNS_LOG_DEBUG, ""Search: now trying %s (%d)"", new_name, handle->search_index); newreq = request_new(base, NULL, req->request_type, new_name, handle->search_flags, req->user_callback, req->user_pointer); mm_free(new_name); if (!newreq) return 1; goto submit_next; } return 1; submit_next: request_finished(req, &REQ_HEAD(req->base, req->trans_id), 0); handle->current_req = newreq; newreq->handle = handle; request_submit(newreq); return 0; } ",0 "static bool assoc_array_insert_into_terminal_node(struct assoc_array_edit *edit, const struct assoc_array_ops *ops, const void *index_key, struct assoc_array_walk_result *result) { struct assoc_array_shortcut *shortcut, *new_s0; struct assoc_array_node *node, *new_n0, *new_n1, *side; struct assoc_array_ptr *ptr; unsigned long dissimilarity, base_seg, blank; size_t keylen; bool have_meta; int level, diff; int slot, next_slot, free_slot, i, j; node = result->terminal_node.node; level = result->terminal_node.level; edit->segment_cache[ASSOC_ARRAY_FAN_OUT] = result->terminal_node.slot; pr_devel(""-->%s()\n"", __func__); /* We arrived at a node which doesn't have an onward node or shortcut * pointer that we have to follow. This means that (a) the leaf we * want must go here (either by insertion or replacement) or (b) we * need to split this node and insert in one of the fragments. */ free_slot = -1; /* Firstly, we have to check the leaves in this node to see if there's * a matching one we should replace in place. */ for (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) { ptr = node->slots[i]; if (!ptr) { free_slot = i; continue; } if (assoc_array_ptr_is_leaf(ptr) && ops->compare_object(assoc_array_ptr_to_leaf(ptr), index_key)) { pr_devel(""replace in slot %d\n"", i); edit->leaf_p = &node->slots[i]; edit->dead_leaf = node->slots[i]; pr_devel(""<--%s() = ok [replace]\n"", __func__); return true; } } /* If there is a free slot in this node then we can just insert the * leaf here. */ if (free_slot >= 0) { pr_devel(""insert in free slot %d\n"", free_slot); edit->leaf_p = &node->slots[free_slot]; edit->adjust_count_on = node; pr_devel(""<--%s() = ok [insert]\n"", __func__); return true; } /* The node has no spare slots - so we're either going to have to split * it or insert another node before it. * * Whatever, we're going to need at least two new nodes - so allocate * those now. We may also need a new shortcut, but we deal with that * when we need it. */ new_n0 = kzalloc(sizeof(struct assoc_array_node), GFP_KERNEL); if (!new_n0) return false; edit->new_meta[0] = assoc_array_node_to_ptr(new_n0); new_n1 = kzalloc(sizeof(struct assoc_array_node), GFP_KERNEL); if (!new_n1) return false; edit->new_meta[1] = assoc_array_node_to_ptr(new_n1); /* We need to find out how similar the leaves are. */ pr_devel(""no spare slots\n""); have_meta = false; for (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) { ptr = node->slots[i]; if (assoc_array_ptr_is_meta(ptr)) { edit->segment_cache[i] = 0xff; have_meta = true; continue; } base_seg = ops->get_object_key_chunk( assoc_array_ptr_to_leaf(ptr), level); base_seg >>= level & ASSOC_ARRAY_KEY_CHUNK_MASK; edit->segment_cache[i] = base_seg & ASSOC_ARRAY_FAN_MASK; } if (have_meta) { pr_devel(""have meta\n""); goto split_node; } /* The node contains only leaves */ dissimilarity = 0; base_seg = edit->segment_cache[0]; for (i = 1; i < ASSOC_ARRAY_FAN_OUT; i++) dissimilarity |= edit->segment_cache[i] ^ base_seg; pr_devel(""only leaves; dissimilarity=%lx\n"", dissimilarity); if ((dissimilarity & ASSOC_ARRAY_FAN_MASK) == 0) { /* The old leaves all cluster in the same slot. We will need * to insert a shortcut if the new node wants to cluster with them. */ if ((edit->segment_cache[ASSOC_ARRAY_FAN_OUT] ^ base_seg) == 0) goto all_leaves_cluster_together; /* Otherwise we can just insert a new node ahead of the old * one. */ goto present_leaves_cluster_but_not_new_leaf; } split_node: pr_devel(""split node\n""); /* We need to split the current node; we know that the node doesn't * simply contain a full set of leaves that cluster together (it * contains meta pointers and/or non-clustering leaves). * * We need to expel at least two leaves out of a set consisting of the * leaves in the node and the new leaf. * * We need a new node (n0) to replace the current one and a new node to * take the expelled nodes (n1). */ edit->set[0].to = assoc_array_node_to_ptr(new_n0); new_n0->back_pointer = node->back_pointer; new_n0->parent_slot = node->parent_slot; new_n1->back_pointer = assoc_array_node_to_ptr(new_n0); new_n1->parent_slot = -1; /* Need to calculate this */ do_split_node: pr_devel(""do_split_node\n""); new_n0->nr_leaves_on_branch = node->nr_leaves_on_branch; new_n1->nr_leaves_on_branch = 0; /* Begin by finding two matching leaves. There have to be at least two * that match - even if there are meta pointers - because any leaf that * would match a slot with a meta pointer in it must be somewhere * behind that meta pointer and cannot be here. Further, given N * remaining leaf slots, we now have N+1 leaves to go in them. */ for (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) { slot = edit->segment_cache[i]; if (slot != 0xff) for (j = i + 1; j < ASSOC_ARRAY_FAN_OUT + 1; j++) if (edit->segment_cache[j] == slot) goto found_slot_for_multiple_occupancy; } found_slot_for_multiple_occupancy: pr_devel(""same slot: %x %x [%02x]\n"", i, j, slot); BUG_ON(i >= ASSOC_ARRAY_FAN_OUT); BUG_ON(j >= ASSOC_ARRAY_FAN_OUT + 1); BUG_ON(slot >= ASSOC_ARRAY_FAN_OUT); new_n1->parent_slot = slot; /* Metadata pointers cannot change slot */ for (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) if (assoc_array_ptr_is_meta(node->slots[i])) new_n0->slots[i] = node->slots[i]; else new_n0->slots[i] = NULL; BUG_ON(new_n0->slots[slot] != NULL); new_n0->slots[slot] = assoc_array_node_to_ptr(new_n1); /* Filter the leaf pointers between the new nodes */ free_slot = -1; next_slot = 0; for (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) { if (assoc_array_ptr_is_meta(node->slots[i])) continue; if (edit->segment_cache[i] == slot) { new_n1->slots[next_slot++] = node->slots[i]; new_n1->nr_leaves_on_branch++; } else { do { free_slot++; } while (new_n0->slots[free_slot] != NULL); new_n0->slots[free_slot] = node->slots[i]; } } pr_devel(""filtered: f=%x n=%x\n"", free_slot, next_slot); if (edit->segment_cache[ASSOC_ARRAY_FAN_OUT] != slot) { do { free_slot++; } while (new_n0->slots[free_slot] != NULL); edit->leaf_p = &new_n0->slots[free_slot]; edit->adjust_count_on = new_n0; } else { edit->leaf_p = &new_n1->slots[next_slot++]; edit->adjust_count_on = new_n1; } BUG_ON(next_slot <= 1); edit->set_backpointers_to = assoc_array_node_to_ptr(new_n0); for (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) { if (edit->segment_cache[i] == 0xff) { ptr = node->slots[i]; BUG_ON(assoc_array_ptr_is_leaf(ptr)); if (assoc_array_ptr_is_node(ptr)) { side = assoc_array_ptr_to_node(ptr); edit->set_backpointers[i] = &side->back_pointer; } else { shortcut = assoc_array_ptr_to_shortcut(ptr); edit->set_backpointers[i] = &shortcut->back_pointer; } } } ptr = node->back_pointer; if (!ptr) edit->set[0].ptr = &edit->array->root; else if (assoc_array_ptr_is_node(ptr)) edit->set[0].ptr = &assoc_array_ptr_to_node(ptr)->slots[node->parent_slot]; else edit->set[0].ptr = &assoc_array_ptr_to_shortcut(ptr)->next_node; edit->excised_meta[0] = assoc_array_node_to_ptr(node); pr_devel(""<--%s() = ok [split node]\n"", __func__); return true; present_leaves_cluster_but_not_new_leaf: /* All the old leaves cluster in the same slot, but the new leaf wants * to go into a different slot, so we create a new node to hold the new * leaf and a pointer to a new node holding all the old leaves. */ pr_devel(""present leaves cluster but not new leaf\n""); new_n0->back_pointer = node->back_pointer; new_n0->parent_slot = node->parent_slot; new_n0->nr_leaves_on_branch = node->nr_leaves_on_branch; new_n1->back_pointer = assoc_array_node_to_ptr(new_n0); new_n1->parent_slot = edit->segment_cache[0]; new_n1->nr_leaves_on_branch = node->nr_leaves_on_branch; edit->adjust_count_on = new_n0; for (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) new_n1->slots[i] = node->slots[i]; new_n0->slots[edit->segment_cache[0]] = assoc_array_node_to_ptr(new_n0); edit->leaf_p = &new_n0->slots[edit->segment_cache[ASSOC_ARRAY_FAN_OUT]]; edit->set[0].ptr = &assoc_array_ptr_to_node(node->back_pointer)->slots[node->parent_slot]; edit->set[0].to = assoc_array_node_to_ptr(new_n0); edit->excised_meta[0] = assoc_array_node_to_ptr(node); pr_devel(""<--%s() = ok [insert node before]\n"", __func__); return true; all_leaves_cluster_together: /* All the leaves, new and old, want to cluster together in this node * in the same slot, so we have to replace this node with a shortcut to * skip over the identical parts of the key and then place a pair of * nodes, one inside the other, at the end of the shortcut and * distribute the keys between them. * * Firstly we need to work out where the leaves start diverging as a * bit position into their keys so that we know how big the shortcut * needs to be. * * We only need to make a single pass of N of the N+1 leaves because if * any keys differ between themselves at bit X then at least one of * them must also differ with the base key at bit X or before. */ pr_devel(""all leaves cluster together\n""); diff = INT_MAX; for (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) { int x = ops->diff_objects(assoc_array_ptr_to_leaf(node->slots[i]), index_key); if (x < diff) { BUG_ON(x < 0); diff = x; } } BUG_ON(diff == INT_MAX); BUG_ON(diff < level + ASSOC_ARRAY_LEVEL_STEP); keylen = round_up(diff, ASSOC_ARRAY_KEY_CHUNK_SIZE); keylen >>= ASSOC_ARRAY_KEY_CHUNK_SHIFT; new_s0 = kzalloc(sizeof(struct assoc_array_shortcut) + keylen * sizeof(unsigned long), GFP_KERNEL); if (!new_s0) return false; edit->new_meta[2] = assoc_array_shortcut_to_ptr(new_s0); edit->set[0].to = assoc_array_shortcut_to_ptr(new_s0); new_s0->back_pointer = node->back_pointer; new_s0->parent_slot = node->parent_slot; new_s0->next_node = assoc_array_node_to_ptr(new_n0); new_n0->back_pointer = assoc_array_shortcut_to_ptr(new_s0); new_n0->parent_slot = 0; new_n1->back_pointer = assoc_array_node_to_ptr(new_n0); new_n1->parent_slot = -1; /* Need to calculate this */ new_s0->skip_to_level = level = diff & ~ASSOC_ARRAY_LEVEL_STEP_MASK; pr_devel(""skip_to_level = %d [diff %d]\n"", level, diff); BUG_ON(level <= 0); for (i = 0; i < keylen; i++) new_s0->index_key[i] = ops->get_key_chunk(index_key, i * ASSOC_ARRAY_KEY_CHUNK_SIZE); blank = ULONG_MAX << (level & ASSOC_ARRAY_KEY_CHUNK_MASK); pr_devel(""blank off [%zu] %d: %lx\n"", keylen - 1, level, blank); new_s0->index_key[keylen - 1] &= ~blank; /* This now reduces to a node splitting exercise for which we'll need * to regenerate the disparity table. */ for (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) { ptr = node->slots[i]; base_seg = ops->get_object_key_chunk(assoc_array_ptr_to_leaf(ptr), level); base_seg >>= level & ASSOC_ARRAY_KEY_CHUNK_MASK; edit->segment_cache[i] = base_seg & ASSOC_ARRAY_FAN_MASK; } base_seg = ops->get_key_chunk(index_key, level); base_seg >>= level & ASSOC_ARRAY_KEY_CHUNK_MASK; edit->segment_cache[ASSOC_ARRAY_FAN_OUT] = base_seg & ASSOC_ARRAY_FAN_MASK; goto do_split_node; } ",1 "void PushMessagingServiceImpl::DidDeleteID(const std::string& app_id, bool was_subscribed, InstanceID::Result result) { RecordUnsubscribeIIDResult(result); base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&PushMessagingServiceImpl::DidUnsubscribe, weak_factory_.GetWeakPtr(), app_id, was_subscribed)); } ",0 "void HTMLMediaElement::setWebLayer(WebLayer* webLayer) { if (webLayer == m_webLayer) return; if (!m_webLayer || !webLayer) setNeedsCompositingUpdate(); if (m_webLayer) GraphicsLayer::unregisterContentsLayer(m_webLayer); m_webLayer = webLayer; if (m_webLayer) GraphicsLayer::registerContentsLayer(m_webLayer); } ",0 "BGD_DECLARE(gdImagePtr) gdImageScale(const gdImagePtr src, const unsigned int new_width, const unsigned int new_height) { gdImagePtr im_scaled = NULL; if (src == NULL || src->interpolation_id < 0 || src->interpolation_id > GD_METHOD_COUNT) { return 0; } switch (src->interpolation_id) { /*Special cases, optimized implementations */ case GD_NEAREST_NEIGHBOUR: im_scaled = gdImageScaleNearestNeighbour(src, new_width, new_height); break; case GD_BILINEAR_FIXED: im_scaled = gdImageScaleBilinear(src, new_width, new_height); break; case GD_BICUBIC_FIXED: im_scaled = gdImageScaleBicubicFixed(src, new_width, new_height); break; /* generic */ default: if (src->interpolation == NULL) { return NULL; } im_scaled = gdImageScaleTwoPass(src, src->sx, src->sy, new_width, new_height); break; } return im_scaled; } ",0 "void ContentSecurityPolicy::setupSelf(const SecurityOrigin& securityOrigin) { m_selfProtocol = securityOrigin.protocol(); m_selfSource = new CSPSource(this, m_selfProtocol, securityOrigin.host(), securityOrigin.port(), String(), CSPSource::NoWildcard, CSPSource::NoWildcard); } ",0 "gsm_xsmp_client_disconnect (GsmXSMPClient *client) { if (client->priv->watch_id > 0) { g_source_remove (client->priv->watch_id); } if (client->priv->conn != NULL) { SmsCleanUp (client->priv->conn); } if (client->priv->ice_connection != NULL) { IceSetShutdownNegotiation (client->priv->ice_connection, FALSE); IceCloseConnection (client->priv->ice_connection); } if (client->priv->protocol_timeout > 0) { g_source_remove (client->priv->protocol_timeout); } } ",1 "void RenderView::didStartLoading() { if (is_loading_) { DLOG(WARNING) << ""didStartLoading called while loading""; return; } is_loading_ = true; first_default_plugin_.reset(); Send(new ViewHostMsg_DidStartLoading(routing_id_)); FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidStartLoading()); } ",0 " bool TabCloseableStateWatcher::CanCloseBrowser(Browser* browser) { BrowserActionType action_type; bool can_close = CanCloseBrowserImpl(browser, &action_type); if (action_type == OPEN_WINDOW) { browser->NewWindow(); } else if (action_type == OPEN_NTP) { browser->CloseAllTabs(); } return can_close; } ",0 "static uint8_t* sdpu_build_uuid_seq(uint8_t* p_out, uint16_t num_uuids, Uuid* p_uuid_list) { uint16_t xx; uint8_t* p_len; /* First thing is the data element header */ UINT8_TO_BE_STREAM(p_out, (DATA_ELE_SEQ_DESC_TYPE << 3) | SIZE_IN_NEXT_BYTE); /* Remember where the length goes. Leave space for it. */ p_len = p_out; p_out += 1; /* Now, loop through and put in all the UUID(s) */ for (xx = 0; xx < num_uuids; xx++, p_uuid_list++) { int len = p_uuid_list->GetShortestRepresentationSize(); if (len == Uuid::kNumBytes16) { UINT8_TO_BE_STREAM(p_out, (UUID_DESC_TYPE << 3) | SIZE_TWO_BYTES); UINT16_TO_BE_STREAM(p_out, p_uuid_list->As16Bit()); } else if (len == Uuid::kNumBytes32) { UINT8_TO_BE_STREAM(p_out, (UUID_DESC_TYPE << 3) | SIZE_FOUR_BYTES); UINT32_TO_BE_STREAM(p_out, p_uuid_list->As32Bit()); } else if (len == Uuid::kNumBytes128) { UINT8_TO_BE_STREAM(p_out, (UUID_DESC_TYPE << 3) | SIZE_SIXTEEN_BYTES); ARRAY_TO_BE_STREAM(p_out, p_uuid_list->To128BitBE(), (int)Uuid::kNumBytes128); } else { DCHECK(0) << ""SDP: Passed UUID has invalid length "" << len; } } /* Now, put in the length */ xx = (uint16_t)(p_out - p_len - 1); UINT8_TO_BE_STREAM(p_len, xx); return (p_out); } ",0 "WhoIsThisWithName(struct rx_call *acall, struct ubik_trans *at, afs_int32 *aid, char *aname) { /* aid is set to the identity of the caller, if known, else ANONYMOUSID */ /* returns -1 and sets aid to ANONYMOUSID on any failure */ struct rx_connection *tconn; afs_int32 code; char tcell[MAXKTCREALMLEN]; char name[MAXKTCNAMELEN]; char inst[MAXKTCNAMELEN]; int ilen; char vname[256]; *aid = ANONYMOUSID; tconn = rx_ConnectionOf(acall); code = rx_SecurityClassOf(tconn); if (code == 0) return 0; else if (code == 1) { /* vab class */ goto done; /* no longer supported */ } else if (code == 2) { /* kad class */ int clen; if ((code = rxkad_GetServerInfo(acall->conn, NULL, 0 /*was &exp */ , name, inst, tcell, NULL))) goto done; strncpy(vname, name, sizeof(vname)); if ((ilen = strlen(inst))) { if (strlen(vname) + 1 + ilen >= sizeof(vname)) goto done; strcat(vname, "".""); strcat(vname, inst); } if ((clen = strlen(tcell))) { int foreign = afs_is_foreign_ticket_name(name,inst,tcell,pr_realmName); if (foreign) { if (strlen(vname) + 1 + clen >= sizeof(vname)) goto done; strcat(vname, ""@""); strcat(vname, tcell); lcstring(vname, vname, sizeof(vname)); code = NameToID(at, vname, aid); strcpy(aname, vname); return 2; } } if (strcmp(AUTH_SUPERUSER, vname) == 0) *aid = SYSADMINID; /* special case for the fileserver */ else { lcstring(vname, vname, sizeof(vname)); code = NameToID(at, vname, aid); } } done: if (code && !pr_noAuth) return -1; return 0; } ",0 "MouseEventWithHitTestResults Document::PerformMouseEventHitTest( const HitTestRequest& request, const LayoutPoint& document_point, const WebMouseEvent& event) { DCHECK(GetLayoutViewItem().IsNull() || GetLayoutViewItem().IsLayoutView()); if (GetLayoutViewItem().IsNull() || !View() || !View()->DidFirstLayout()) return MouseEventWithHitTestResults(event, HitTestResult(request, LayoutPoint())); HitTestResult result(request, document_point); GetLayoutViewItem().HitTest(result); if (!request.ReadOnly()) UpdateHoverActiveState(request, result.InnerElement()); if (isHTMLCanvasElement(result.InnerNode())) { HitTestCanvasResult* hit_test_canvas_result = toHTMLCanvasElement(result.InnerNode()) ->GetControlAndIdIfHitRegionExists(result.PointInInnerNodeFrame()); if (hit_test_canvas_result->GetControl()) { result.SetInnerNode(hit_test_canvas_result->GetControl()); } result.SetCanvasRegionId(hit_test_canvas_result->GetId()); } return MouseEventWithHitTestResults(event, result); } ",0 "void BrowserView::ShowOneClickSigninBubble( const StartSyncCallback& start_sync_callback) { OneClickSigninBubbleView::ShowBubble(toolbar_->app_menu(), start_sync_callback); } ",0 "static int vmci_transport_recv_dgram_cb(void *data, struct vmci_datagram *dg) { struct sock *sk; size_t size; struct sk_buff *skb; struct vsock_sock *vsk; sk = (struct sock *)data; /* This handler is privileged when this module is running on the host. * We will get datagrams from all endpoints (even VMs that are in a * restricted context). If we get one from a restricted context then * the destination socket must be trusted. * * NOTE: We access the socket struct without holding the lock here. * This is ok because the field we are interested is never modified * outside of the create and destruct socket functions. */ vsk = vsock_sk(sk); if (!vmci_transport_allow_dgram(vsk, dg->src.context)) return VMCI_ERROR_NO_ACCESS; size = VMCI_DG_SIZE(dg); /* Attach the packet to the socket's receive queue as an sk_buff. */ skb = alloc_skb(size, GFP_ATOMIC); if (skb) { /* sk_receive_skb() will do a sock_put(), so hold here. */ sock_hold(sk); skb_put(skb, size); memcpy(skb->data, dg, size); sk_receive_skb(sk, skb, 0); } return VMCI_SUCCESS; } ",0 "int ldb_dn_set_extended_component(struct ldb_dn *dn, const char *name, const struct ldb_val *val) { struct ldb_dn_ext_component *p; unsigned int i; struct ldb_val v2; if ( ! ldb_dn_validate(dn)) { return LDB_ERR_OTHER; } if (!ldb_dn_extended_syntax_by_name(dn->ldb, name)) { /* We don't know how to handle this type of thing */ return LDB_ERR_INVALID_DN_SYNTAX; } for (i=0; i < dn->ext_comp_num; i++) { if (ldb_attr_cmp(dn->ext_components[i].name, name) == 0) { if (val) { dn->ext_components[i].value = ldb_val_dup(dn->ext_components, val); dn->ext_components[i].name = talloc_strdup(dn->ext_components, name); if (!dn->ext_components[i].name || !dn->ext_components[i].value.data) { ldb_dn_mark_invalid(dn); return LDB_ERR_OPERATIONS_ERROR; } } else { if (i != (dn->ext_comp_num - 1)) { memmove(&dn->ext_components[i], &dn->ext_components[i+1], ((dn->ext_comp_num-1) - i) * sizeof(*dn->ext_components)); } dn->ext_comp_num--; dn->ext_components = talloc_realloc(dn, dn->ext_components, struct ldb_dn_ext_component, dn->ext_comp_num); if (!dn->ext_components) { ldb_dn_mark_invalid(dn); return LDB_ERR_OPERATIONS_ERROR; } } LDB_FREE(dn->ext_linearized); return LDB_SUCCESS; } } if (val == NULL) { /* removing a value that doesn't exist is not an error */ return LDB_SUCCESS; } v2 = *val; p = dn->ext_components = talloc_realloc(dn, dn->ext_components, struct ldb_dn_ext_component, dn->ext_comp_num + 1); if (!dn->ext_components) { ldb_dn_mark_invalid(dn); return LDB_ERR_OPERATIONS_ERROR; } p[dn->ext_comp_num].value = ldb_val_dup(dn->ext_components, &v2); p[dn->ext_comp_num].name = talloc_strdup(p, name); if (!dn->ext_components[i].name || !dn->ext_components[i].value.data) { ldb_dn_mark_invalid(dn); return LDB_ERR_OPERATIONS_ERROR; } dn->ext_components = p; dn->ext_comp_num++; LDB_FREE(dn->ext_linearized); return LDB_SUCCESS; } ",0 "void Gfx::opSetStrokeGray(Object args[], int numArgs) { GfxColor color; state->setStrokePattern(NULL); state->setStrokeColorSpace(new GfxDeviceGrayColorSpace()); out->updateStrokeColorSpace(state); color.c[0] = dblToCol(args[0].getNum()); state->setStrokeColor(&color); out->updateStrokeColor(state); } ",0 "static int mmu_need_write_protect(struct kvm_vcpu *vcpu, gfn_t gfn, bool can_unsync) { struct kvm_mmu_page *s; bool need_unsync = false; for_each_gfn_indirect_valid_sp(vcpu->kvm, s, gfn) { if (!can_unsync) return 1; if (s->role.level != PT_PAGE_TABLE_LEVEL) return 1; if (!s->unsync) need_unsync = true; } if (need_unsync) kvm_unsync_pages(vcpu, gfn); return 0; } ",0 "sighup_handler(int sig) { int save_errno = errno; received_sighup = 1; signal(SIGHUP, sighup_handler); errno = save_errno; } ",0 "void MetricsWebContentsObserver::NotifyPageEndAllLoads( PageEndReason page_end_reason, UserInitiatedInfo user_initiated_info) { NotifyPageEndAllLoadsWithTimestamp(page_end_reason, user_initiated_info, base::TimeTicks::Now(), true); } ",0 "static int kvm_vm_ioctl_set_identity_map_addr(struct kvm *kvm, u64 ident_addr) { kvm->arch.ept_identity_map_addr = ident_addr; return 0; } ",0 "ImportSingleTIFF_SRational ( const TIFF_Manager::TagInfo & tagInfo, const bool nativeEndian, SXMPMeta * xmp, const char * xmpNS, const char * xmpProp ) { try { // Don't let errors with one stop the others. #if SUNOS_SPARC || XMP_IOS_ARM XMP_Uns32 binPtr[2]; memcpy(&binPtr, tagInfo.dataPtr, sizeof(XMP_Uns32)*2); #else XMP_Uns32 * binPtr = (XMP_Uns32*)tagInfo.dataPtr; #endif //#if SUNOS_SPARC || XMP_IOS_ARM XMP_Int32 binNum = GetUns32AsIs ( &binPtr[0] ); XMP_Int32 binDenom = GetUns32AsIs ( &binPtr[1] ); if ( ! nativeEndian ) { Flip4 ( &binNum ); Flip4 ( &binDenom ); } char strValue[40]; snprintf ( strValue, sizeof(strValue), ""%ld/%ld"", (unsigned long)binNum, (unsigned long)binDenom ); // AUDIT: Using sizeof(strValue) is safe. xmp->SetProperty ( xmpNS, xmpProp, strValue ); } catch ( ... ) { } } // ImportSingleTIFF_SRational ",0 "static void check_no_speaker_on_headset(struct snd_kcontrol *kctl, struct snd_card *card) { const char *names_to_check[] = { ""Headset"", ""headset"", ""Headphone"", ""headphone"", NULL}; const char **s; bool found = false; if (strcmp(""Speaker"", kctl->id.name)) return; for (s = names_to_check; *s; s++) if (strstr(card->shortname, *s)) { found = true; break; } if (!found) return; strlcpy(kctl->id.name, ""Headphone"", sizeof(kctl->id.name)); } ",0 "LPWSTR TCTranslateCode (ULONG ulCode) { switch (ulCode) { #define TC_CASE_RET_NAME(CODE) case CODE : return L###CODE TC_CASE_RET_NAME (TC_IOCTL_ABORT_BOOT_ENCRYPTION_SETUP); TC_CASE_RET_NAME (TC_IOCTL_ABORT_DECOY_SYSTEM_WIPE); TC_CASE_RET_NAME (TC_IOCTL_BOOT_ENCRYPTION_SETUP); TC_CASE_RET_NAME (TC_IOCTL_DISMOUNT_ALL_VOLUMES); TC_CASE_RET_NAME (TC_IOCTL_DISMOUNT_VOLUME); TC_CASE_RET_NAME (TC_IOCTL_GET_BOOT_DRIVE_VOLUME_PROPERTIES); TC_CASE_RET_NAME (TC_IOCTL_GET_BOOT_ENCRYPTION_ALGORITHM_NAME); TC_CASE_RET_NAME (TC_IOCTL_GET_BOOT_ENCRYPTION_SETUP_RESULT); TC_CASE_RET_NAME (TC_IOCTL_GET_BOOT_ENCRYPTION_STATUS); TC_CASE_RET_NAME (TC_IOCTL_GET_BOOT_LOADER_VERSION); TC_CASE_RET_NAME (TC_IOCTL_GET_DECOY_SYSTEM_WIPE_RESULT); TC_CASE_RET_NAME (TC_IOCTL_GET_DECOY_SYSTEM_WIPE_STATUS); TC_CASE_RET_NAME (TC_IOCTL_GET_DEVICE_REFCOUNT); TC_CASE_RET_NAME (TC_IOCTL_GET_DRIVE_GEOMETRY); TC_CASE_RET_NAME (TC_IOCTL_GET_DRIVE_PARTITION_INFO); TC_CASE_RET_NAME (TC_IOCTL_GET_DRIVER_VERSION); TC_CASE_RET_NAME (TC_IOCTL_GET_MOUNTED_VOLUMES); TC_CASE_RET_NAME (TC_IOCTL_GET_PASSWORD_CACHE_STATUS); TC_CASE_RET_NAME (TC_IOCTL_GET_SYSTEM_DRIVE_CONFIG); TC_CASE_RET_NAME (TC_IOCTL_GET_PORTABLE_MODE_STATUS); TC_CASE_RET_NAME (TC_IOCTL_SET_PORTABLE_MODE_STATUS); TC_CASE_RET_NAME (TC_IOCTL_GET_RESOLVED_SYMLINK); TC_CASE_RET_NAME (TC_IOCTL_GET_SYSTEM_DRIVE_DUMP_CONFIG); TC_CASE_RET_NAME (TC_IOCTL_GET_VOLUME_PROPERTIES); TC_CASE_RET_NAME (TC_IOCTL_GET_WARNING_FLAGS); TC_CASE_RET_NAME (TC_IOCTL_DISK_IS_WRITABLE); TC_CASE_RET_NAME (TC_IOCTL_IS_ANY_VOLUME_MOUNTED); TC_CASE_RET_NAME (TC_IOCTL_IS_DRIVER_UNLOAD_DISABLED); TC_CASE_RET_NAME (TC_IOCTL_IS_HIDDEN_SYSTEM_RUNNING); TC_CASE_RET_NAME (TC_IOCTL_MOUNT_VOLUME); TC_CASE_RET_NAME (TC_IOCTL_OPEN_TEST); TC_CASE_RET_NAME (TC_IOCTL_PROBE_REAL_DRIVE_SIZE); TC_CASE_RET_NAME (TC_IOCTL_REOPEN_BOOT_VOLUME_HEADER); TC_CASE_RET_NAME (TC_IOCTL_REREAD_DRIVER_CONFIG); TC_CASE_RET_NAME (TC_IOCTL_SET_SYSTEM_FAVORITE_VOLUME_DIRTY); TC_CASE_RET_NAME (TC_IOCTL_START_DECOY_SYSTEM_WIPE); TC_CASE_RET_NAME (TC_IOCTL_WIPE_PASSWORD_CACHE); TC_CASE_RET_NAME (TC_IOCTL_WRITE_BOOT_DRIVE_SECTOR); TC_CASE_RET_NAME (VC_IOCTL_GET_DRIVE_GEOMETRY_EX); TC_CASE_RET_NAME (IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS); #undef TC_CASE_RET_NAME } if (ulCode == IOCTL_DISK_GET_DRIVE_GEOMETRY) return (LPWSTR) _T (""IOCTL_DISK_GET_DRIVE_GEOMETRY""); else if (ulCode == IOCTL_DISK_GET_DRIVE_GEOMETRY_EX) return (LPWSTR) _T (""IOCTL_DISK_GET_DRIVE_GEOMETRY_EX""); else if (ulCode == IOCTL_MOUNTDEV_QUERY_DEVICE_NAME) return (LPWSTR) _T (""IOCTL_MOUNTDEV_QUERY_DEVICE_NAME""); else if (ulCode == IOCTL_MOUNTDEV_QUERY_SUGGESTED_LINK_NAME) return (LPWSTR) _T (""IOCTL_MOUNTDEV_QUERY_SUGGESTED_LINK_NAME""); else if (ulCode == IOCTL_MOUNTDEV_QUERY_UNIQUE_ID) return (LPWSTR) _T (""IOCTL_MOUNTDEV_QUERY_UNIQUE_ID""); else if (ulCode == IOCTL_VOLUME_ONLINE) return (LPWSTR) _T (""IOCTL_VOLUME_ONLINE""); else if (ulCode == IOCTL_MOUNTDEV_LINK_CREATED) return (LPWSTR) _T (""IOCTL_MOUNTDEV_LINK_CREATED""); else if (ulCode == IOCTL_MOUNTDEV_LINK_DELETED) return (LPWSTR) _T (""IOCTL_MOUNTDEV_LINK_DELETED""); else if (ulCode == IOCTL_MOUNTMGR_QUERY_POINTS) return (LPWSTR) _T (""IOCTL_MOUNTMGR_QUERY_POINTS""); else if (ulCode == IOCTL_MOUNTMGR_VOLUME_MOUNT_POINT_CREATED) return (LPWSTR) _T (""IOCTL_MOUNTMGR_VOLUME_MOUNT_POINT_CREATED""); else if (ulCode == IOCTL_MOUNTMGR_VOLUME_MOUNT_POINT_DELETED) return (LPWSTR) _T (""IOCTL_MOUNTMGR_VOLUME_MOUNT_POINT_DELETED""); else if (ulCode == IOCTL_DISK_GET_LENGTH_INFO) return (LPWSTR) _T (""IOCTL_DISK_GET_LENGTH_INFO""); else if (ulCode == IOCTL_STORAGE_GET_DEVICE_NUMBER) return (LPWSTR) _T (""IOCTL_STORAGE_GET_DEVICE_NUMBER""); else if (ulCode == IOCTL_DISK_GET_PARTITION_INFO) return (LPWSTR) _T (""IOCTL_DISK_GET_PARTITION_INFO""); else if (ulCode == IOCTL_DISK_GET_PARTITION_INFO_EX) return (LPWSTR) _T (""IOCTL_DISK_GET_PARTITION_INFO_EX""); else if (ulCode == IOCTL_DISK_SET_PARTITION_INFO) return (LPWSTR) _T (""IOCTL_DISK_SET_PARTITION_INFO""); else if (ulCode == IOCTL_DISK_GET_DRIVE_LAYOUT) return (LPWSTR) _T (""IOCTL_DISK_GET_DRIVE_LAYOUT""); else if (ulCode == IOCTL_DISK_GET_DRIVE_LAYOUT_EX) return (LPWSTR) _T (""IOCTL_DISK_GET_DRIVE_LAYOUT_EX""); else if (ulCode == IOCTL_DISK_SET_DRIVE_LAYOUT_EX) return (LPWSTR) _T (""IOCTL_DISK_SET_DRIVE_LAYOUT_EX""); else if (ulCode == IOCTL_DISK_VERIFY) return (LPWSTR) _T (""IOCTL_DISK_VERIFY""); else if (ulCode == IOCTL_DISK_FORMAT_TRACKS) return (LPWSTR) _T (""IOCTL_DISK_FORMAT_TRACKS""); else if (ulCode == IOCTL_DISK_REASSIGN_BLOCKS) return (LPWSTR) _T (""IOCTL_DISK_REASSIGN_BLOCKS""); else if (ulCode == IOCTL_DISK_PERFORMANCE) return (LPWSTR) _T (""IOCTL_DISK_PERFORMANCE""); else if (ulCode == IOCTL_DISK_IS_WRITABLE) return (LPWSTR) _T (""IOCTL_DISK_IS_WRITABLE""); else if (ulCode == IOCTL_DISK_LOGGING) return (LPWSTR) _T (""IOCTL_DISK_LOGGING""); else if (ulCode == IOCTL_DISK_FORMAT_TRACKS_EX) return (LPWSTR) _T (""IOCTL_DISK_FORMAT_TRACKS_EX""); else if (ulCode == IOCTL_DISK_HISTOGRAM_STRUCTURE) return (LPWSTR) _T (""IOCTL_DISK_HISTOGRAM_STRUCTURE""); else if (ulCode == IOCTL_DISK_HISTOGRAM_DATA) return (LPWSTR) _T (""IOCTL_DISK_HISTOGRAM_DATA""); else if (ulCode == IOCTL_DISK_HISTOGRAM_RESET) return (LPWSTR) _T (""IOCTL_DISK_HISTOGRAM_RESET""); else if (ulCode == IOCTL_DISK_REQUEST_STRUCTURE) return (LPWSTR) _T (""IOCTL_DISK_REQUEST_STRUCTURE""); else if (ulCode == IOCTL_DISK_REQUEST_DATA) return (LPWSTR) _T (""IOCTL_DISK_REQUEST_DATA""); else if (ulCode == IOCTL_DISK_CONTROLLER_NUMBER) return (LPWSTR) _T (""IOCTL_DISK_CONTROLLER_NUMBER""); else if (ulCode == SMART_GET_VERSION) return (LPWSTR) _T (""SMART_GET_VERSION""); else if (ulCode == SMART_SEND_DRIVE_COMMAND) return (LPWSTR) _T (""SMART_SEND_DRIVE_COMMAND""); else if (ulCode == SMART_RCV_DRIVE_DATA) return (LPWSTR) _T (""SMART_RCV_DRIVE_DATA""); else if (ulCode == IOCTL_DISK_INTERNAL_SET_VERIFY) return (LPWSTR) _T (""IOCTL_DISK_INTERNAL_SET_VERIFY""); else if (ulCode == IOCTL_DISK_INTERNAL_CLEAR_VERIFY) return (LPWSTR) _T (""IOCTL_DISK_INTERNAL_CLEAR_VERIFY""); else if (ulCode == IOCTL_DISK_CHECK_VERIFY) return (LPWSTR) _T (""IOCTL_DISK_CHECK_VERIFY""); else if (ulCode == IOCTL_DISK_MEDIA_REMOVAL) return (LPWSTR) _T (""IOCTL_DISK_MEDIA_REMOVAL""); else if (ulCode == IOCTL_DISK_EJECT_MEDIA) return (LPWSTR) _T (""IOCTL_DISK_EJECT_MEDIA""); else if (ulCode == IOCTL_DISK_LOAD_MEDIA) return (LPWSTR) _T (""IOCTL_DISK_LOAD_MEDIA""); else if (ulCode == IOCTL_DISK_RESERVE) return (LPWSTR) _T (""IOCTL_DISK_RESERVE""); else if (ulCode == IOCTL_DISK_RELEASE) return (LPWSTR) _T (""IOCTL_DISK_RELEASE""); else if (ulCode == IOCTL_DISK_FIND_NEW_DEVICES) return (LPWSTR) _T (""IOCTL_DISK_FIND_NEW_DEVICES""); else if (ulCode == IOCTL_DISK_GET_MEDIA_TYPES) return (LPWSTR) _T (""IOCTL_DISK_GET_MEDIA_TYPES""); else if (ulCode == IOCTL_DISK_IS_CLUSTERED) return (LPWSTR) _T (""IOCTL_DISK_IS_CLUSTERED""); else if (ulCode == IOCTL_DISK_UPDATE_DRIVE_SIZE) return (LPWSTR) _T (""IOCTL_DISK_UPDATE_DRIVE_SIZE""); else if (ulCode == IOCTL_STORAGE_GET_MEDIA_TYPES) return (LPWSTR) _T (""IOCTL_STORAGE_GET_MEDIA_TYPES""); else if (ulCode == IOCTL_STORAGE_GET_HOTPLUG_INFO) return (LPWSTR) _T (""IOCTL_STORAGE_GET_HOTPLUG_INFO""); else if (ulCode == IOCTL_STORAGE_SET_HOTPLUG_INFO) return (LPWSTR) _T (""IOCTL_STORAGE_SET_HOTPLUG_INFO""); else if (ulCode == IOCTL_STORAGE_QUERY_PROPERTY) return (LPWSTR) _T (""IOCTL_STORAGE_QUERY_PROPERTY""); else if (ulCode == IOCTL_VOLUME_GET_GPT_ATTRIBUTES) return (LPWSTR) _T (""IOCTL_VOLUME_GET_GPT_ATTRIBUTES""); else if (ulCode == FT_BALANCED_READ_MODE) return (LPWSTR) _T (""FT_BALANCED_READ_MODE""); else if (ulCode == IOCTL_VOLUME_QUERY_ALLOCATION_HINT) return (LPWSTR) _T (""IOCTL_VOLUME_QUERY_ALLOCATION_HINT""); else if (ulCode == IOCTL_DISK_GET_CLUSTER_INFO) return (LPWSTR) _T (""IOCTL_DISK_GET_CLUSTER_INFO""); else if (ulCode == IOCTL_DISK_ARE_VOLUMES_READY) return (LPWSTR) _T (""IOCTL_DISK_ARE_VOLUMES_READY""); else if (ulCode == IOCTL_VOLUME_IS_DYNAMIC) return (LPWSTR) _T (""IOCTL_VOLUME_IS_DYNAMIC""); else if (ulCode == IOCTL_MOUNTDEV_QUERY_STABLE_GUID) return (LPWSTR) _T (""IOCTL_MOUNTDEV_QUERY_STABLE_GUID""); else if (ulCode == IOCTL_VOLUME_POST_ONLINE) return (LPWSTR) _T (""IOCTL_VOLUME_POST_ONLINE""); else if (ulCode == IOCTL_STORAGE_CHECK_PRIORITY_HINT_SUPPORT) return (LPWSTR) _T (""IOCTL_STORAGE_CHECK_PRIORITY_HINT_SUPPORT""); else if (ulCode == IOCTL_STORAGE_MANAGE_DATA_SET_ATTRIBUTES) return (LPWSTR) _T (""IOCTL_STORAGE_MANAGE_DATA_SET_ATTRIBUTES""); else if (ulCode == IRP_MJ_READ) return (LPWSTR) _T (""IRP_MJ_READ""); else if (ulCode == IRP_MJ_WRITE) return (LPWSTR) _T (""IRP_MJ_WRITE""); else if (ulCode == IRP_MJ_CREATE) return (LPWSTR) _T (""IRP_MJ_CREATE""); else if (ulCode == IRP_MJ_CLOSE) return (LPWSTR) _T (""IRP_MJ_CLOSE""); else if (ulCode == IRP_MJ_CLEANUP) return (LPWSTR) _T (""IRP_MJ_CLEANUP""); else if (ulCode == IRP_MJ_FLUSH_BUFFERS) return (LPWSTR) _T (""IRP_MJ_FLUSH_BUFFERS""); else if (ulCode == IRP_MJ_SHUTDOWN) return (LPWSTR) _T (""IRP_MJ_SHUTDOWN""); else if (ulCode == IRP_MJ_DEVICE_CONTROL) return (LPWSTR) _T (""IRP_MJ_DEVICE_CONTROL""); else { return (LPWSTR) _T (""IOCTL""); } } ",0 "static bool ExecuteDelete(LocalFrame& frame, Event*, EditorCommandSource source, const String&) { switch (source) { case kCommandFromMenuOrKeyBinding: { frame.GetEditor().PerformDelete(); return true; } case kCommandFromDOM: DCHECK(frame.GetDocument()); TypingCommand::DeleteKeyPressed( *frame.GetDocument(), frame.Selection().Granularity() == TextGranularity::kWord ? TypingCommand::kSmartDelete : 0); return true; } NOTREACHED(); return false; } ",0 "static int __f2fs_commit_super(struct buffer_head *bh, struct f2fs_super_block *super) { lock_buffer(bh); if (super) memcpy(bh->b_data + F2FS_SUPER_OFFSET, super, sizeof(*super)); set_buffer_uptodate(bh); set_buffer_dirty(bh); unlock_buffer(bh); /* it's rare case, we can do fua all the time */ return __sync_dirty_buffer(bh, REQ_SYNC | REQ_PREFLUSH | REQ_FUA); } ",0 "static int ftrace_cmp_recs(const void *a, const void *b) { const struct dyn_ftrace *key = a; const struct dyn_ftrace *rec = b; if (key->flags < rec->ip) return -1; if (key->ip >= rec->ip + MCOUNT_INSN_SIZE) return 1; return 0; } ",0 "static void mlx5_fill_inl_bsf(struct ib_sig_domain *domain, struct mlx5_bsf_inl *inl) { /* Valid inline section and allow BSF refresh */ inl->vld_refresh = cpu_to_be16(MLX5_BSF_INL_VALID | MLX5_BSF_REFRESH_DIF); inl->dif_apptag = cpu_to_be16(domain->sig.dif.app_tag); inl->dif_reftag = cpu_to_be32(domain->sig.dif.ref_tag); /* repeating block */ inl->rp_inv_seed = MLX5_BSF_REPEAT_BLOCK; inl->sig_type = domain->sig.dif.bg_type == IB_T10DIF_CRC ? MLX5_DIF_CRC : MLX5_DIF_IPCS; if (domain->sig.dif.ref_remap) inl->dif_inc_ref_guard_check |= MLX5_BSF_INC_REFTAG; if (domain->sig.dif.app_escape) { if (domain->sig.dif.ref_escape) inl->dif_inc_ref_guard_check |= MLX5_BSF_APPREF_ESCAPE; else inl->dif_inc_ref_guard_check |= MLX5_BSF_APPTAG_ESCAPE; } inl->dif_app_bitmask_check = cpu_to_be16(domain->sig.dif.apptag_check_mask); } ",0 "void LockContentsView::OnEasyUnlockIconTapped() { UserState* state = FindStateForUser( CurrentBigUserView()->GetCurrentUser()->basic_user_info->account_id); DCHECK(state); mojom::EasyUnlockIconOptionsPtr& easy_unlock_state = state->easy_unlock_state; DCHECK(easy_unlock_state); if (easy_unlock_state->hardlock_on_click) { AccountId user = CurrentBigUserView()->GetCurrentUser()->basic_user_info->account_id; Shell::Get()->login_screen_controller()->HardlockPod(user); OnClickToUnlockEnabledForUserChanged(user, false /*enabled*/); } } ",0 "static int acm_tty_write(struct tty_struct *tty, const unsigned char *buf, int count) { struct acm *acm = tty->driver_data; int stat; unsigned long flags; int wbn; struct acm_wb *wb; if (!count) return 0; dev_vdbg(&acm->data->dev, ""%s - count %d\n"", __func__, count); spin_lock_irqsave(&acm->write_lock, flags); wbn = acm_wb_alloc(acm); if (wbn < 0) { spin_unlock_irqrestore(&acm->write_lock, flags); return 0; } wb = &acm->wb[wbn]; if (!acm->dev) { wb->use = 0; spin_unlock_irqrestore(&acm->write_lock, flags); return -ENODEV; } count = (count > acm->writesize) ? acm->writesize : count; dev_vdbg(&acm->data->dev, ""%s - write %d\n"", __func__, count); memcpy(wb->buf, buf, count); wb->len = count; stat = usb_autopm_get_interface_async(acm->control); if (stat) { wb->use = 0; spin_unlock_irqrestore(&acm->write_lock, flags); return stat; } if (acm->susp_count) { if (acm->putbuffer) { /* now to preserve order */ usb_anchor_urb(acm->putbuffer->urb, &acm->delayed); acm->putbuffer = NULL; } usb_anchor_urb(wb->urb, &acm->delayed); spin_unlock_irqrestore(&acm->write_lock, flags); return count; } else { if (acm->putbuffer) { /* at this point there is no good way to handle errors */ acm_start_wb(acm, acm->putbuffer); acm->putbuffer = NULL; } } stat = acm_start_wb(acm, wb); spin_unlock_irqrestore(&acm->write_lock, flags); if (stat < 0) return stat; return count; } ",0 "static void udf_clear_extent_cache(struct inode *inode) { struct udf_inode_info *iinfo = UDF_I(inode); spin_lock(&iinfo->i_extent_cache_lock); __udf_clear_extent_cache(inode); spin_unlock(&iinfo->i_extent_cache_lock); } ",0 "xsmp_get_unix_process_id (GsmClient *client) { SmProp *prop; guint pid; gboolean res; g_debug (""GsmXSMPClient: getting pid""); prop = find_property (GSM_XSMP_CLIENT (client), SmProcessID, NULL); if (!prop || strcmp (prop->type, SmARRAY8) != 0) { return 0; } pid = 0; res = _parse_value_as_uint ((char *)prop->vals[0].value, &pid); if (! res) { pid = 0; } return pid; } ",0 " media::VideoPixelFormat>::ToMojom(media::VideoPixelFormat input) { switch (input) { case media::VideoPixelFormat::PIXEL_FORMAT_UNKNOWN: return media::mojom::VideoCapturePixelFormat::UNKNOWN; case media::VideoPixelFormat::PIXEL_FORMAT_I420: return media::mojom::VideoCapturePixelFormat::I420; case media::VideoPixelFormat::PIXEL_FORMAT_YV12: return media::mojom::VideoCapturePixelFormat::YV12; case media::VideoPixelFormat::PIXEL_FORMAT_I422: return media::mojom::VideoCapturePixelFormat::I422; case media::VideoPixelFormat::PIXEL_FORMAT_I420A: return media::mojom::VideoCapturePixelFormat::I420A; case media::VideoPixelFormat::PIXEL_FORMAT_I444: return media::mojom::VideoCapturePixelFormat::I444; case media::VideoPixelFormat::PIXEL_FORMAT_NV12: return media::mojom::VideoCapturePixelFormat::NV12; case media::VideoPixelFormat::PIXEL_FORMAT_NV21: return media::mojom::VideoCapturePixelFormat::NV21; case media::VideoPixelFormat::PIXEL_FORMAT_UYVY: return media::mojom::VideoCapturePixelFormat::UYVY; case media::VideoPixelFormat::PIXEL_FORMAT_YUY2: return media::mojom::VideoCapturePixelFormat::YUY2; case media::VideoPixelFormat::PIXEL_FORMAT_ARGB: return media::mojom::VideoCapturePixelFormat::ARGB; case media::VideoPixelFormat::PIXEL_FORMAT_XRGB: return media::mojom::VideoCapturePixelFormat::XRGB; case media::VideoPixelFormat::PIXEL_FORMAT_RGB24: return media::mojom::VideoCapturePixelFormat::RGB24; case media::VideoPixelFormat::PIXEL_FORMAT_RGB32: return media::mojom::VideoCapturePixelFormat::RGB32; case media::VideoPixelFormat::PIXEL_FORMAT_MJPEG: return media::mojom::VideoCapturePixelFormat::MJPEG; case media::VideoPixelFormat::PIXEL_FORMAT_MT21: return media::mojom::VideoCapturePixelFormat::MT21; case media::VideoPixelFormat::PIXEL_FORMAT_YUV420P9: return media::mojom::VideoCapturePixelFormat::YUV420P9; case media::VideoPixelFormat::PIXEL_FORMAT_YUV420P10: return media::mojom::VideoCapturePixelFormat::YUV420P10; case media::VideoPixelFormat::PIXEL_FORMAT_YUV422P9: return media::mojom::VideoCapturePixelFormat::YUV422P9; case media::VideoPixelFormat::PIXEL_FORMAT_YUV422P10: return media::mojom::VideoCapturePixelFormat::YUV422P10; case media::VideoPixelFormat::PIXEL_FORMAT_YUV444P9: return media::mojom::VideoCapturePixelFormat::YUV444P9; case media::VideoPixelFormat::PIXEL_FORMAT_YUV444P10: return media::mojom::VideoCapturePixelFormat::YUV444P10; case media::VideoPixelFormat::PIXEL_FORMAT_YUV420P12: return media::mojom::VideoCapturePixelFormat::YUV420P12; case media::VideoPixelFormat::PIXEL_FORMAT_YUV422P12: return media::mojom::VideoCapturePixelFormat::YUV422P12; case media::VideoPixelFormat::PIXEL_FORMAT_YUV444P12: return media::mojom::VideoCapturePixelFormat::YUV444P12; case media::VideoPixelFormat::PIXEL_FORMAT_Y16: return media::mojom::VideoCapturePixelFormat::Y16; } NOTREACHED(); return media::mojom::VideoCapturePixelFormat::I420; } ",0 " bool SingleStep() { CHECK(thread_state_->IsIncrementalMarking()); if (thread_state_->GcState() == ThreadState::kIncrementalMarkingStepScheduled) { thread_state_->RunScheduledGC(BlinkGC::kNoHeapPointersOnStack); return true; } return false; } ",0 "server_connect_success (server *serv) { #ifdef USE_OPENSSL #define SSLDOCONNTMOUT 300 if (serv->use_ssl) { char *err; /* it'll be a memory leak, if connection isn't terminated by server_cleanup() */ serv->ssl = _SSL_socket (serv->ctx, serv->sok); if ((err = _SSL_set_verify (serv->ctx, ssl_cb_verify, NULL))) { EMIT_SIGNAL (XP_TE_CONNFAIL, serv->server_session, err, NULL, NULL, NULL, 0); server_cleanup (serv); /* ->connecting = FALSE */ return; } /* FIXME: it'll be needed by new servers */ /* send(serv->sok, ""STLS\r\n"", 6, 0); sleep(1); */ set_nonblocking (serv->sok); serv->ssl_do_connect_tag = fe_timeout_add (SSLDOCONNTMOUT, ssl_do_connect, serv); return; } serv->ssl = NULL; #endif server_stopconnecting (serv); /* ->connecting = FALSE */ /* activate glib poll */ server_connected (serv); } ",0 "monitor_reinit(struct monitor *mon) { monitor_openfds(mon, 0); } ",0 "bool GLES2Implementation::ValidateSize(const char* func, GLsizeiptr size) { if (size < 0) { SetGLError(GL_INVALID_VALUE, func, ""size < 0""); return false; } if (!base::IsValueInRangeForNumericType(size)) { SetGLError(GL_INVALID_OPERATION, func, ""size more than 32-bit""); return false; } return true; } ",0 " bool Send(IPC::Message* message) { return channel_->Send(message); } ",0 "int EC_METHOD_get_field_type(const EC_METHOD *meth) { return meth->field_type; } ",0 "static int set_haschildren(const mbentry_t *mbentry __attribute__((unused)), void *rock) { uint32_t *attributes = (uint32_t *)rock; list_callback_calls++; *attributes |= MBOX_ATTRIBUTE_HASCHILDREN; return CYRUSDB_DONE; } ",0 "double LocalFrame::DevicePixelRatio() const { if (!page_) return 0; double ratio = page_->DeviceScaleFactorDeprecated(); ratio *= PageZoomFactor(); return ratio; } ",0 "static bool check_selective_cr0_intercepted(struct vcpu_svm *svm, unsigned long val) { unsigned long cr0 = svm->vcpu.arch.cr0; bool ret = false; u64 intercept; intercept = svm->nested.intercept; if (!is_guest_mode(&svm->vcpu) || (!(intercept & (1ULL << INTERCEPT_SELECTIVE_CR0)))) return false; cr0 &= ~SVM_CR0_SELECTIVE_MASK; val &= ~SVM_CR0_SELECTIVE_MASK; if (cr0 ^ val) { svm->vmcb->control.exit_code = SVM_EXIT_CR0_SEL_WRITE; ret = (nested_svm_exit_handled(svm) == NESTED_EXIT_DONE); } return ret; } ",0 "ProcXvQueryImageAttributes(ClientPtr client) { xvQueryImageAttributesReply rep; int size, num_planes, i; CARD16 width, height; XvImagePtr pImage = NULL; XvPortPtr pPort; int *offsets; int *pitches; int planeLength; REQUEST(xvQueryImageAttributesReq); REQUEST_SIZE_MATCH(xvQueryImageAttributesReq); VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess); for (i = 0; i < pPort->pAdaptor->nImages; i++) { if (pPort->pAdaptor->pImages[i].id == stuff->id) { pImage = &(pPort->pAdaptor->pImages[i]); break; } } #ifdef XvMCExtension if (!pImage) pImage = XvMCFindXvImage(pPort, stuff->id); #endif if (!pImage) return BadMatch; num_planes = pImage->num_planes; if (!(offsets = malloc(num_planes << 3))) return BadAlloc; pitches = offsets + num_planes; width = stuff->width; height = stuff->height; size = (*pPort->pAdaptor->ddQueryImageAttributes) (pPort, pImage, &width, &height, offsets, pitches); rep = (xvQueryImageAttributesReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = planeLength = num_planes << 1, .num_planes = num_planes, .width = width, .height = height, .data_size = size }; _WriteQueryImageAttributesReply(client, &rep); if (client->swapped) SwapLongs((CARD32 *) offsets, planeLength); WriteToClient(client, planeLength << 2, offsets); free(offsets); return Success; } ",0 "void DataReductionProxySettings::RegisterDataReductionProxyFieldTrial() { register_synthetic_field_trial_.Run( ""SyntheticDataReductionProxySetting"", IsDataReductionProxyEnabled() ? ""Enabled"" : ""Disabled""); } ",0 "PHP_MINIT_FUNCTION(openssl) { char * config_filename; le_key = zend_register_list_destructors_ex(php_pkey_free, NULL, ""OpenSSL key"", module_number); le_x509 = zend_register_list_destructors_ex(php_x509_free, NULL, ""OpenSSL X.509"", module_number); le_csr = zend_register_list_destructors_ex(php_csr_free, NULL, ""OpenSSL X.509 CSR"", module_number); SSL_library_init(); OpenSSL_add_all_ciphers(); OpenSSL_add_all_digests(); OpenSSL_add_all_algorithms(); SSL_load_error_strings(); /* register a resource id number with OpenSSL so that we can map SSL -> stream structures in * OpenSSL callbacks */ ssl_stream_data_index = SSL_get_ex_new_index(0, ""PHP stream index"", NULL, NULL, NULL); REGISTER_STRING_CONSTANT(""OPENSSL_VERSION_TEXT"", OPENSSL_VERSION_TEXT, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""OPENSSL_VERSION_NUMBER"", OPENSSL_VERSION_NUMBER, CONST_CS|CONST_PERSISTENT); /* purposes for cert purpose checking */ REGISTER_LONG_CONSTANT(""X509_PURPOSE_SSL_CLIENT"", X509_PURPOSE_SSL_CLIENT, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""X509_PURPOSE_SSL_SERVER"", X509_PURPOSE_SSL_SERVER, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""X509_PURPOSE_NS_SSL_SERVER"", X509_PURPOSE_NS_SSL_SERVER, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""X509_PURPOSE_SMIME_SIGN"", X509_PURPOSE_SMIME_SIGN, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""X509_PURPOSE_SMIME_ENCRYPT"", X509_PURPOSE_SMIME_ENCRYPT, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""X509_PURPOSE_CRL_SIGN"", X509_PURPOSE_CRL_SIGN, CONST_CS|CONST_PERSISTENT); #ifdef X509_PURPOSE_ANY REGISTER_LONG_CONSTANT(""X509_PURPOSE_ANY"", X509_PURPOSE_ANY, CONST_CS|CONST_PERSISTENT); #endif /* signature algorithm constants */ REGISTER_LONG_CONSTANT(""OPENSSL_ALGO_SHA1"", OPENSSL_ALGO_SHA1, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""OPENSSL_ALGO_MD5"", OPENSSL_ALGO_MD5, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""OPENSSL_ALGO_MD4"", OPENSSL_ALGO_MD4, CONST_CS|CONST_PERSISTENT); #ifdef HAVE_OPENSSL_MD2_H REGISTER_LONG_CONSTANT(""OPENSSL_ALGO_MD2"", OPENSSL_ALGO_MD2, CONST_CS|CONST_PERSISTENT); #endif REGISTER_LONG_CONSTANT(""OPENSSL_ALGO_DSS1"", OPENSSL_ALGO_DSS1, CONST_CS|CONST_PERSISTENT); #if OPENSSL_VERSION_NUMBER >= 0x0090708fL REGISTER_LONG_CONSTANT(""OPENSSL_ALGO_SHA224"", OPENSSL_ALGO_SHA224, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""OPENSSL_ALGO_SHA256"", OPENSSL_ALGO_SHA256, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""OPENSSL_ALGO_SHA384"", OPENSSL_ALGO_SHA384, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""OPENSSL_ALGO_SHA512"", OPENSSL_ALGO_SHA512, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""OPENSSL_ALGO_RMD160"", OPENSSL_ALGO_RMD160, CONST_CS|CONST_PERSISTENT); #endif /* flags for S/MIME */ REGISTER_LONG_CONSTANT(""PKCS7_DETACHED"", PKCS7_DETACHED, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""PKCS7_TEXT"", PKCS7_TEXT, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""PKCS7_NOINTERN"", PKCS7_NOINTERN, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""PKCS7_NOVERIFY"", PKCS7_NOVERIFY, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""PKCS7_NOCHAIN"", PKCS7_NOCHAIN, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""PKCS7_NOCERTS"", PKCS7_NOCERTS, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""PKCS7_NOATTR"", PKCS7_NOATTR, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""PKCS7_BINARY"", PKCS7_BINARY, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""PKCS7_NOSIGS"", PKCS7_NOSIGS, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""OPENSSL_PKCS1_PADDING"", RSA_PKCS1_PADDING, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""OPENSSL_SSLV23_PADDING"", RSA_SSLV23_PADDING, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""OPENSSL_NO_PADDING"", RSA_NO_PADDING, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""OPENSSL_PKCS1_OAEP_PADDING"", RSA_PKCS1_OAEP_PADDING, CONST_CS|CONST_PERSISTENT); /* Ciphers */ #ifndef OPENSSL_NO_RC2 REGISTER_LONG_CONSTANT(""OPENSSL_CIPHER_RC2_40"", PHP_OPENSSL_CIPHER_RC2_40, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""OPENSSL_CIPHER_RC2_128"", PHP_OPENSSL_CIPHER_RC2_128, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""OPENSSL_CIPHER_RC2_64"", PHP_OPENSSL_CIPHER_RC2_64, CONST_CS|CONST_PERSISTENT); #endif #ifndef OPENSSL_NO_DES REGISTER_LONG_CONSTANT(""OPENSSL_CIPHER_DES"", PHP_OPENSSL_CIPHER_DES, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""OPENSSL_CIPHER_3DES"", PHP_OPENSSL_CIPHER_3DES, CONST_CS|CONST_PERSISTENT); #endif #ifndef OPENSSL_NO_AES REGISTER_LONG_CONSTANT(""OPENSSL_CIPHER_AES_128_CBC"", PHP_OPENSSL_CIPHER_AES_128_CBC, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""OPENSSL_CIPHER_AES_192_CBC"", PHP_OPENSSL_CIPHER_AES_192_CBC, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""OPENSSL_CIPHER_AES_256_CBC"", PHP_OPENSSL_CIPHER_AES_256_CBC, CONST_CS|CONST_PERSISTENT); #endif /* Values for key types */ REGISTER_LONG_CONSTANT(""OPENSSL_KEYTYPE_RSA"", OPENSSL_KEYTYPE_RSA, CONST_CS|CONST_PERSISTENT); #ifndef NO_DSA REGISTER_LONG_CONSTANT(""OPENSSL_KEYTYPE_DSA"", OPENSSL_KEYTYPE_DSA, CONST_CS|CONST_PERSISTENT); #endif REGISTER_LONG_CONSTANT(""OPENSSL_KEYTYPE_DH"", OPENSSL_KEYTYPE_DH, CONST_CS|CONST_PERSISTENT); #ifdef HAVE_EVP_PKEY_EC REGISTER_LONG_CONSTANT(""OPENSSL_KEYTYPE_EC"", OPENSSL_KEYTYPE_EC, CONST_CS|CONST_PERSISTENT); #endif REGISTER_LONG_CONSTANT(""OPENSSL_RAW_DATA"", OPENSSL_RAW_DATA, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""OPENSSL_ZERO_PADDING"", OPENSSL_ZERO_PADDING, CONST_CS|CONST_PERSISTENT); #if OPENSSL_VERSION_NUMBER >= 0x0090806fL && !defined(OPENSSL_NO_TLSEXT) /* SNI support included in OpenSSL >= 0.9.8j */ REGISTER_LONG_CONSTANT(""OPENSSL_TLSEXT_SERVER_NAME"", 1, CONST_CS|CONST_PERSISTENT); #endif /* Determine default SSL configuration file */ config_filename = getenv(""OPENSSL_CONF""); if (config_filename == NULL) { config_filename = getenv(""SSLEAY_CONF""); } /* default to 'openssl.cnf' if no environment variable is set */ if (config_filename == NULL) { snprintf(default_ssl_conf_filename, sizeof(default_ssl_conf_filename), ""%s/%s"", X509_get_default_cert_area(), ""openssl.cnf""); } else { strlcpy(default_ssl_conf_filename, config_filename, sizeof(default_ssl_conf_filename)); } php_stream_xport_register(""ssl"", php_openssl_ssl_socket_factory TSRMLS_CC); php_stream_xport_register(""sslv3"", php_openssl_ssl_socket_factory TSRMLS_CC); #ifndef OPENSSL_NO_SSL2 php_stream_xport_register(""sslv2"", php_openssl_ssl_socket_factory TSRMLS_CC); #endif php_stream_xport_register(""tls"", php_openssl_ssl_socket_factory TSRMLS_CC); /* override the default tcp socket provider */ php_stream_xport_register(""tcp"", php_openssl_ssl_socket_factory TSRMLS_CC); php_register_url_stream_wrapper(""https"", &php_stream_http_wrapper TSRMLS_CC); php_register_url_stream_wrapper(""ftps"", &php_stream_ftp_wrapper TSRMLS_CC); return SUCCESS; } ",0 "size_t TemplateURLRef::GetSearchTermPositionInPath( const SearchTermsData& search_terms_data) const { ParseIfNecessary(search_terms_data); return search_term_position_in_path_; } ",0 " net::EmbeddedTestServer* https_server() { return &https_server_; } ",0 "void OmniboxViewViews::ExecuteTextEditCommand(ui::TextEditCommand command) { DestroyTouchSelection(); if (!IsTextEditCommandEnabled(command)) return; switch (command) { case ui::TextEditCommand::MOVE_UP: model()->OnUpOrDownKeyPressed(-1); break; case ui::TextEditCommand::MOVE_DOWN: model()->OnUpOrDownKeyPressed(1); break; case ui::TextEditCommand::PASTE: OnPaste(); break; default: Textfield::ExecuteTextEditCommand(command); break; } } ",0 "void PasswordAutofillAgent::OnFindFocusedPasswordForm() { std::unique_ptr password_form; blink::WebElement element = render_frame()->GetFocusedElement(); if (!element.isNull() && element.hasHTMLTagName(""input"")) { blink::WebInputElement input = element.to(); if (input.isPasswordField() && !input.form().isNull()) { if (!input.form().isNull()) { password_form = CreatePasswordFormFromWebForm( input.form(), &nonscript_modified_values_, &form_predictions_); } else { password_form = CreatePasswordFormFromUnownedInputElements( *render_frame()->GetWebFrame(), &nonscript_modified_values_, &form_predictions_); if (password_form->password_element != input.nameForAutofill() && password_form->new_password_element != input.nameForAutofill()) password_form.reset(); } } } if (!password_form) password_form.reset(new PasswordForm()); Send(new AutofillHostMsg_FocusedPasswordFormFound( routing_id(), *password_form)); } ",0 "static inline LayerInfo *DestroyLayerInfo(LayerInfo *layer_info, const ssize_t number_layers) { ssize_t i; for (i=0; iSetAttribEnable(index, false); helper_->DisableVertexAttribArray(index); CheckGLError(); } ",0 "mrb_write_barrier(mrb_state *mrb, struct RBasic *obj) { mrb_gc *gc = &mrb->gc; if (!is_black(obj)) return; mrb_assert(!is_dead(gc, obj)); mrb_assert(is_generational(gc) || gc->state != MRB_GC_STATE_ROOT); paint_gray(obj); obj->gcnext = gc->atomic_gray_list; gc->atomic_gray_list = obj; } ",0 "MediaDevicesManager* MediaStreamManager::media_devices_manager() { DCHECK_CURRENTLY_ON(BrowserThread::IO); return media_devices_manager_.get(); } ",0 "void SyncManager::SyncInternal::UpdateCredentials( const SyncCredentials& credentials) { DCHECK(thread_checker_.CalledOnValidThread()); DCHECK_EQ(credentials.email, share_.name); DCHECK(!credentials.email.empty()); DCHECK(!credentials.sync_token.empty()); observing_ip_address_changes_ = true; if (connection_manager()->set_auth_token(credentials.sync_token)) { sync_notifier_->UpdateCredentials( credentials.email, credentials.sync_token); if (testing_mode_ == NON_TEST && initialized_) { if (scheduler()) scheduler()->OnCredentialsUpdated(); } } } ",0 "void NetworkChangeNotifier::AddIPAddressObserver(IPAddressObserver* observer) { if (g_network_change_notifier) g_network_change_notifier->ip_address_observer_list_->AddObserver(observer); } ",0 "static void TestEnumAttributeAttributeGetter(const v8::FunctionCallbackInfo& info) { v8::Local holder = info.Holder(); TestObject* impl = V8TestObject::ToImpl(holder); V8SetReturnValueString(info, impl->testEnumAttribute(), info.GetIsolate()); } ",0 "stack_trace_sysctl(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos) { int ret; mutex_lock(&stack_sysctl_mutex); ret = proc_dointvec(table, write, buffer, lenp, ppos); if (ret || !write || (last_stack_tracer_enabled == !!stack_tracer_enabled)) goto out; last_stack_tracer_enabled = !!stack_tracer_enabled; if (stack_tracer_enabled) register_ftrace_function(&trace_ops); else unregister_ftrace_function(&trace_ops); out: mutex_unlock(&stack_sysctl_mutex); return ret; } ",0 "OMX_ERRORTYPE omx_vdec::update_picture_resolution() { OMX_ERRORTYPE eRet = OMX_ErrorNone; return eRet; } ",0 "MagickExport MagickBooleanType BlackThresholdImage(Image *image, const char *threshold) { MagickBooleanType status; status=BlackThresholdImageChannel(image,DefaultChannels,threshold, &image->exception); return(status); } ",0 "static void irda_flow_indication(void *instance, void *sap, LOCAL_FLOW flow) { struct irda_sock *self; struct sock *sk; self = instance; sk = instance; BUG_ON(sk == NULL); switch (flow) { case FLOW_STOP: pr_debug(""%s(), IrTTP wants us to slow down\n"", __func__); self->tx_flow = flow; break; case FLOW_START: self->tx_flow = flow; pr_debug(""%s(), IrTTP wants us to start again\n"", __func__); wake_up_interruptible(sk_sleep(sk)); break; default: pr_debug(""%s(), Unknown flow command!\n"", __func__); /* Unknown flow command, better stop */ self->tx_flow = flow; break; } } ",0 "static int setkey_unaligned(struct crypto_aead *tfm, const u8 *key, unsigned int keylen) { struct aead_alg *aead = crypto_aead_alg(tfm); unsigned long alignmask = crypto_aead_alignmask(tfm); int ret; u8 *buffer, *alignbuffer; unsigned long absize; absize = keylen + alignmask; buffer = kmalloc(absize, GFP_ATOMIC); if (!buffer) return -ENOMEM; alignbuffer = (u8 *)ALIGN((unsigned long)buffer, alignmask + 1); memcpy(alignbuffer, key, keylen); ret = aead->setkey(tfm, alignbuffer, keylen); memset(alignbuffer, 0, keylen); kfree(buffer); return ret; } ",0 "ValidityMessage::~ValidityMessage() {} ",0 "process_runtime_configs() { int i, rval, fd; bool processed = false; for (i=0; i <= rArray.getlast(); i++) { processed = true; char* tmp_dir = temp_dir_path(); ASSERT(tmp_dir); MyString tmp_file_tmpl = tmp_dir; free(tmp_dir); tmp_file_tmpl += ""/cndrtmpXXXXXX""; char* tmp_file = strdup(tmp_file_tmpl.Value()); fd = condor_mkstemp( tmp_file ); if (fd < 0) { dprintf( D_ALWAYS, ""condor_mkstemp(%s) returned %d, '%s' (errno %d) in "" ""process_dynamic_configs()\n"", tmp_file, fd, strerror(errno), errno ); exit(1); } if (write(fd, rArray[i].config, strlen(rArray[i].config)) != (ssize_t)strlen(rArray[i].config)) { dprintf( D_ALWAYS, ""write failed with errno %d in "" ""process_dynamic_configs\n"", errno ); exit(1); } if (close(fd) < 0) { dprintf( D_ALWAYS, ""close failed with errno %d in "" ""process_dynamic_configs\n"", errno ); exit(1); } rval = Read_config( tmp_file, ConfigTab, TABLESIZE, EXPAND_LAZY, false, extra_info ); if (rval < 0) { dprintf( D_ALWAYS, ""Configuration Error Line %d "" ""while reading %s, runtime config: %s\n"", ConfigLineNo, tmp_file, rArray[i].admin ); exit(1); } unlink(tmp_file); free(tmp_file); } return (int)processed; } ",0 "static ssize_t proc_fault_inject_read(struct file * file, char __user * buf, size_t count, loff_t *ppos) { struct task_struct *task = get_proc_task(file_inode(file)); char buffer[PROC_NUMBUF]; size_t len; int make_it_fail; if (!task) return -ESRCH; make_it_fail = task->make_it_fail; put_task_struct(task); len = snprintf(buffer, sizeof(buffer), ""%i\n"", make_it_fail); return simple_read_from_buffer(buf, count, ppos, buffer, len); } ",0 "static int apparmor_file_mprotect(struct vm_area_struct *vma, unsigned long reqprot, unsigned long prot) { return common_mmap(OP_FMPROT, vma->vm_file, prot, !(vma->vm_flags & VM_SHARED) ? MAP_PRIVATE : 0); } ",0 "zend_object_iterator *spl_array_get_iterator(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC) /* {{{ */ { spl_array_it *iterator; spl_array_object *array_object = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); if (by_ref && (array_object->ar_flags & SPL_ARRAY_OVERLOADED_CURRENT)) { zend_error(E_ERROR, ""An iterator cannot be used with foreach by reference""); } iterator = emalloc(sizeof(spl_array_it)); Z_ADDREF_P(object); iterator->intern.it.data = (void*)object; iterator->intern.it.funcs = &spl_array_it_funcs; iterator->intern.ce = ce; iterator->intern.value = NULL; iterator->object = array_object; return (zend_object_iterator*)iterator; } /* }}} */ ",0 " void RunTest(Browser* browser, const GURL& url, int modifiers, WebKit::WebMouseEvent::Button button, WindowOpenDisposition disposition) { ui_test_utils::NavigateToURL(browser, url); EXPECT_EQ(1u, chrome::GetBrowserCount(browser->profile(), browser->host_desktop_type())); EXPECT_EQ(1, browser->tab_strip_model()->count()); content::WebContents* web_contents = browser->tab_strip_model()->GetActiveWebContents(); EXPECT_EQ(url, web_contents->GetURL()); if (disposition == CURRENT_TAB) { content::WebContents* web_contents = browser->tab_strip_model()->GetActiveWebContents(); content::TestNavigationObserver same_tab_observer(web_contents); SimulateMouseClick(web_contents, modifiers, button); base::RunLoop run_loop; same_tab_observer.WaitForObservation( base::Bind(&content::RunThisRunLoop, base::Unretained(&run_loop)), content::GetQuitTaskForRunLoop(&run_loop)); EXPECT_EQ(1u, chrome::GetBrowserCount(browser->profile(), browser->host_desktop_type())); EXPECT_EQ(1, browser->tab_strip_model()->count()); EXPECT_EQ(getSecondPageTitle(), web_contents->GetTitle()); return; } content::WindowedNotificationObserver observer( chrome::NOTIFICATION_TAB_ADDED, content::NotificationService::AllSources()); SimulateMouseClick(web_contents, modifiers, button); observer.Wait(); if (disposition == NEW_WINDOW) { EXPECT_EQ(2u, chrome::GetBrowserCount(browser->profile(), browser->host_desktop_type())); return; } EXPECT_EQ(1u, chrome::GetBrowserCount(browser->profile(), browser->host_desktop_type())); EXPECT_EQ(2, browser->tab_strip_model()->count()); web_contents = browser->tab_strip_model()->GetActiveWebContents(); WaitForLoadStop(web_contents); if (disposition == NEW_FOREGROUND_TAB) { EXPECT_EQ(getSecondPageTitle(), web_contents->GetTitle()); } else { ASSERT_EQ(NEW_BACKGROUND_TAB, disposition); EXPECT_EQ(getFirstPageTitle(), web_contents->GetTitle()); } } ",0 "WebMediaPlayer::Preload HTMLMediaElement::PreloadType() const { const AtomicString& preload = FastGetAttribute(preloadAttr); if (DeprecatedEqualIgnoringCase(preload, ""none"")) { UseCounter::Count(GetDocument(), WebFeature::kHTMLMediaElementPreloadNone); return WebMediaPlayer::kPreloadNone; } if (GetDocument().GetSettings() && ((GetNetworkStateNotifier().SaveDataEnabled() && !GetDocument().GetSettings()->GetDataSaverHoldbackMediaApi()) || GetDocument().GetSettings()->GetForcePreloadNoneForMediaElements()) && (current_src_.Protocol() != ""blob"" && current_src_.Protocol() != ""data"" && current_src_.Protocol() != ""file"")) { UseCounter::Count(GetDocument(), WebFeature::kHTMLMediaElementPreloadForcedNone); return WebMediaPlayer::kPreloadNone; } if (DeprecatedEqualIgnoringCase(preload, ""metadata"")) { UseCounter::Count(GetDocument(), WebFeature::kHTMLMediaElementPreloadMetadata); return WebMediaPlayer::kPreloadMetaData; } if (GetNetworkStateNotifier().IsCellularConnectionType()) { UseCounter::Count(GetDocument(), WebFeature::kHTMLMediaElementPreloadForcedMetadata); return WebMediaPlayer::kPreloadMetaData; } if (DeprecatedEqualIgnoringCase(preload, ""auto"") || DeprecatedEqualIgnoringCase(preload, """")) { UseCounter::Count(GetDocument(), WebFeature::kHTMLMediaElementPreloadAuto); return WebMediaPlayer::kPreloadAuto; } UseCounter::Count(GetDocument(), WebFeature::kHTMLMediaElementPreloadDefault); return RuntimeEnabledFeatures::PreloadDefaultIsMetadataEnabled() ? WebMediaPlayer::kPreloadMetaData : WebMediaPlayer::kPreloadAuto; } ",0 "void HttpUtil::AppendHeaderIfMissing(const char* header_name, const std::string& header_value, std::string* headers) { if (header_value.empty()) return; if (net::HttpUtil::HasHeader(*headers, header_name)) return; *headers += std::string(header_name) + "": "" + header_value + ""\r\n""; } ",0 " void HostCache::AddEntry(const Key& key, const Entry& entry) { DCHECK_GT(max_entries_, size()); DCHECK_EQ(0u, entries_.count(key)); entries_.insert(std::make_pair(key, entry)); DCHECK_GE(max_entries_, size()); } ",0 "static void cm_free_msg(struct ib_mad_send_buf *msg) { ib_destroy_ah(msg->ah); if (msg->context[0]) cm_deref_id(msg->context[0]); ib_free_send_mad(msg); } ",0 "int dcbnl_cee_notify(struct net_device *dev, int event, int cmd, u32 seq, u32 portid) { return dcbnl_notify(dev, event, cmd, seq, portid, DCB_CAP_DCBX_VER_CEE); } ",0 "bool ikev1_ship_chain(chunk_t *chain, int n, pb_stream *outs, u_int8_t type, u_int8_t setnp) { int i; u_int8_t np; for (i = 0; i < n; i++) { /* set np for last cert, or another */ np = i == n - 1 ? setnp : ISAKMP_NEXT_CERT; if (!ikev1_ship_CERT(type, chain[i], outs, np)) return FALSE; } return TRUE; } ",0 "int qcow2_refcount_init(BlockDriverState *bs) { BDRVQcowState *s = bs->opaque; unsigned int refcount_table_size2, i; int ret; assert(s->refcount_table_size <= INT_MAX / sizeof(uint64_t)); refcount_table_size2 = s->refcount_table_size * sizeof(uint64_t); s->refcount_table = g_malloc(refcount_table_size2); if (s->refcount_table_size > 0) { BLKDBG_EVENT(bs->file, BLKDBG_REFTABLE_LOAD); ret = bdrv_pread(bs->file, s->refcount_table_offset, s->refcount_table, refcount_table_size2); if (ret != refcount_table_size2) goto fail; for(i = 0; i < s->refcount_table_size; i++) be64_to_cpus(&s->refcount_table[i]); } return 0; fail: return -ENOMEM; } ",0 "gfx::Size PageInfoWindowView::GetPreferredSize() { return gfx::Size(views::Window::GetLocalizedContentsSize( IDS_PAGEINFO_DIALOG_WIDTH_CHARS, IDS_PAGEINFO_DIALOG_HEIGHT_LINES)); } ",0 "v8::Local V8Console::createCommandLineAPI(InspectedContext* inspectedContext) { v8::Local context = inspectedContext->context(); v8::Isolate* isolate = context->GetIsolate(); v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kDoNotRunMicrotasks); v8::Local commandLineAPI = v8::Object::New(isolate); createBoundFunctionProperty(context, commandLineAPI, ""dir"", V8Console::dirCallback, ""function dir(value) { [Command Line API] }""); createBoundFunctionProperty(context, commandLineAPI, ""dirxml"", V8Console::dirxmlCallback, ""function dirxml(value) { [Command Line API] }""); createBoundFunctionProperty(context, commandLineAPI, ""profile"", V8Console::profileCallback, ""function profile(title) { [Command Line API] }""); createBoundFunctionProperty(context, commandLineAPI, ""profileEnd"", V8Console::profileEndCallback, ""function profileEnd(title) { [Command Line API] }""); createBoundFunctionProperty(context, commandLineAPI, ""clear"", V8Console::clearCallback, ""function clear() { [Command Line API] }""); createBoundFunctionProperty(context, commandLineAPI, ""table"", V8Console::tableCallback, ""function table(data, [columns]) { [Command Line API] }""); createBoundFunctionProperty(context, commandLineAPI, ""keys"", V8Console::keysCallback, ""function keys(object) { [Command Line API] }""); createBoundFunctionProperty(context, commandLineAPI, ""values"", V8Console::valuesCallback, ""function values(object) { [Command Line API] }""); createBoundFunctionProperty(context, commandLineAPI, ""debug"", V8Console::debugFunctionCallback, ""function debug(function) { [Command Line API] }""); createBoundFunctionProperty(context, commandLineAPI, ""undebug"", V8Console::undebugFunctionCallback, ""function undebug(function) { [Command Line API] }""); createBoundFunctionProperty(context, commandLineAPI, ""monitor"", V8Console::monitorFunctionCallback, ""function monitor(function) { [Command Line API] }""); createBoundFunctionProperty(context, commandLineAPI, ""unmonitor"", V8Console::unmonitorFunctionCallback, ""function unmonitor(function) { [Command Line API] }""); createBoundFunctionProperty(context, commandLineAPI, ""inspect"", V8Console::inspectCallback, ""function inspect(object) { [Command Line API] }""); createBoundFunctionProperty(context, commandLineAPI, ""copy"", V8Console::copyCallback, ""function copy(value) { [Command Line API] }""); createBoundFunctionProperty(context, commandLineAPI, ""$_"", V8Console::lastEvaluationResultCallback); createBoundFunctionProperty(context, commandLineAPI, ""$0"", V8Console::inspectedObject0); createBoundFunctionProperty(context, commandLineAPI, ""$1"", V8Console::inspectedObject1); createBoundFunctionProperty(context, commandLineAPI, ""$2"", V8Console::inspectedObject2); createBoundFunctionProperty(context, commandLineAPI, ""$3"", V8Console::inspectedObject3); createBoundFunctionProperty(context, commandLineAPI, ""$4"", V8Console::inspectedObject4); inspectedContext->inspector()->client()->installAdditionalCommandLineAPI(context, commandLineAPI); commandLineAPI->SetPrivate(context, inspectedContextPrivateKey(isolate), v8::External::New(isolate, inspectedContext)); return commandLineAPI; } ",1 "isdn_net_force_hangup(char *name) { isdn_net_dev *p = isdn_net_findif(name); struct net_device *q; if (p) { if (p->local->isdn_device < 0) return 1; q = p->local->slave; /* If this interface has slaves, do a hangup for them also. */ while (q) { isdn_net_hangup(q); q = MASTER_TO_SLAVE(q); } isdn_net_hangup(p->dev); return 0; } return -ENODEV; } ",0 "std::unique_ptr InspectorTracingSessionIdForWorkerEvent::Data( const String& session_id, const String& worker_id, WorkerThread* worker_thread) { std::unique_ptr value = TracedValue::Create(); value->SetString(""sessionId"", session_id); value->SetString(""workerId"", worker_id); value->SetDouble(""workerThreadId"", worker_thread->GetPlatformThreadId()); return value; } ",0 "RenderFrameImpl::GetRemoteNavigationAssociatedInterfaces() { return GetRemoteAssociatedInterfaces(); } ",0 "zlib_run(struct zlib *zlib) /* Like zlib_advance but also handles a stream of IDAT chunks. */ { /* The 'extra_bytes' field is set by zlib_advance if there is extra * compressed data in the chunk it handles (if it sees Z_STREAM_END before * all the input data has been used.) This function uses the value to update * the correct chunk length, so the problem should only ever be detected once * for each chunk. zlib_advance outputs the error message, though see the * IDAT specific check below. */ zlib->extra_bytes = 0; if (zlib->idat != NULL) { struct IDAT_list *list = zlib->idat->idat_list_head; struct IDAT_list *last = zlib->idat->idat_list_tail; int skip = 0; /* 'rewrite_offset' is the offset of the LZ data within the chunk, for * IDAT it should be 0: */ assert(zlib->rewrite_offset == 0); /* Process each IDAT_list in turn; the caller has left the stream * positioned at the start of the first IDAT chunk data. */ for (;;) { const unsigned int count = list->count; unsigned int i; for (i = 0; i 0) /* Skip CRC and next IDAT header */ skip_12(zlib->file); skip = 12; /* for the next time */ rc = zlib_advance(zlib, list->lengths[i]); switch (rc) { case ZLIB_OK: /* keep going */ break; case ZLIB_STREAM_END: /* stop */ /* There may be extra chunks; if there are and one of them is * not zero length output the 'extra data' message. Only do * this check if errors are being output. */ if (zlib->global->errors && zlib->extra_bytes == 0) { struct IDAT_list *check = list; int j = i+1, jcount = count; for (;;) { for (; jlengths[j] > 0) { chunk_message(zlib->chunk, ""extra compressed data""); goto end_check; } if (check == last) break; check = check->next; jcount = check->count; j = 0; } } end_check: /* Terminate the list at the current position, reducing the * length of the last IDAT too if required. */ list->lengths[i] -= zlib->extra_bytes; list->count = i+1; zlib->idat->idat_list_tail = list; /* FALL THROUGH */ default: return rc; } } /* At the end of the compressed data and Z_STREAM_END was not seen. */ if (list == last) return ZLIB_OK; list = list->next; } } else { struct chunk *chunk = zlib->chunk; int rc; assert(zlib->rewrite_offset < chunk->chunk_length); rc = zlib_advance(zlib, chunk->chunk_length - zlib->rewrite_offset); /* The extra bytes in the chunk are handled now by adjusting the chunk * length to exclude them; the zlib data is always stored at the end of * the PNG chunk (although clearly this is not necessary.) zlib_advance * has already output a warning message. */ chunk->chunk_length -= zlib->extra_bytes; return rc; } } ",1 "void ImageLoader::updateFromElement() { Document* document = m_element->document(); if (!document->renderer()) return; AtomicString attr = m_element->imageSourceURL(); if (attr == m_failedLoadURL) return; CachedResourceHandle newImage = 0; if (!attr.isNull() && !stripLeadingAndTrailingHTMLSpaces(attr).isEmpty()) { CachedResourceRequest request(ResourceRequest(document->completeURL(sourceURI(attr)))); request.setInitiator(element()); String crossOriginMode = m_element->fastGetAttribute(HTMLNames::crossoriginAttr); if (!crossOriginMode.isNull()) { StoredCredentials allowCredentials = equalIgnoringCase(crossOriginMode, ""use-credentials"") ? AllowStoredCredentials : DoNotAllowStoredCredentials; updateRequestForAccessControl(request.mutableResourceRequest(), document->securityOrigin(), allowCredentials); } if (m_loadManually) { bool autoLoadOtherImages = document->cachedResourceLoader()->autoLoadImages(); document->cachedResourceLoader()->setAutoLoadImages(false); newImage = new CachedImage(request.resourceRequest()); newImage->setLoading(true); newImage->setOwningCachedResourceLoader(document->cachedResourceLoader()); document->cachedResourceLoader()->m_documentResources.set(newImage->url(), newImage.get()); document->cachedResourceLoader()->setAutoLoadImages(autoLoadOtherImages); } else newImage = document->cachedResourceLoader()->requestImage(request); if (!newImage && !pageIsBeingDismissed(document)) { m_failedLoadURL = attr; m_hasPendingErrorEvent = true; errorEventSender().dispatchEventSoon(this); } else clearFailedLoadURL(); } else if (!attr.isNull()) { m_element->dispatchEvent(Event::create(eventNames().errorEvent, false, false)); } CachedImage* oldImage = m_image.get(); if (newImage != oldImage) { if (m_hasPendingBeforeLoadEvent) { beforeLoadEventSender().cancelEvent(this); m_hasPendingBeforeLoadEvent = false; } if (m_hasPendingLoadEvent) { loadEventSender().cancelEvent(this); m_hasPendingLoadEvent = false; } if (m_hasPendingErrorEvent && newImage) { errorEventSender().cancelEvent(this); m_hasPendingErrorEvent = false; } m_image = newImage; m_hasPendingBeforeLoadEvent = !m_element->document()->isImageDocument() && newImage; m_hasPendingLoadEvent = newImage; m_imageComplete = !newImage; if (newImage) { if (!m_element->document()->isImageDocument()) { if (!m_element->document()->hasListenerType(Document::BEFORELOAD_LISTENER)) dispatchPendingBeforeLoadEvent(); else beforeLoadEventSender().dispatchEventSoon(this); } else updateRenderer(); newImage->addClient(this); } if (oldImage) oldImage->removeClient(this); } if (RenderImageResource* imageResource = renderImageResource()) imageResource->resetAnimation(); updatedHasPendingEvent(); } ",1 "PHP_MSHUTDOWN_FUNCTION(basic) /* {{{ */ { #ifdef HAVE_SYSLOG_H PHP_MSHUTDOWN(syslog)(SHUTDOWN_FUNC_ARGS_PASSTHRU); #endif #ifdef ZTS ts_free_id(basic_globals_id); #ifdef PHP_WIN32 ts_free_id(php_win32_core_globals_id); #endif #else basic_globals_dtor(&basic_globals TSRMLS_CC); #ifdef PHP_WIN32 php_win32_core_globals_dtor(&the_php_win32_core_globals TSRMLS_CC); #endif #endif php_unregister_url_stream_wrapper(""php"" TSRMLS_CC); #ifndef PHP_CURL_URL_WRAPPERS php_unregister_url_stream_wrapper(""http"" TSRMLS_CC); php_unregister_url_stream_wrapper(""ftp"" TSRMLS_CC); #endif PHP_MSHUTDOWN(browscap)(SHUTDOWN_FUNC_ARGS_PASSTHRU); PHP_MSHUTDOWN(array)(SHUTDOWN_FUNC_ARGS_PASSTHRU); PHP_MSHUTDOWN(assert)(SHUTDOWN_FUNC_ARGS_PASSTHRU); PHP_MSHUTDOWN(url_scanner_ex)(SHUTDOWN_FUNC_ARGS_PASSTHRU); PHP_MSHUTDOWN(file)(SHUTDOWN_FUNC_ARGS_PASSTHRU); PHP_MSHUTDOWN(standard_filters)(SHUTDOWN_FUNC_ARGS_PASSTHRU); #if defined(HAVE_LOCALECONV) && defined(ZTS) PHP_MSHUTDOWN(localeconv)(SHUTDOWN_FUNC_ARGS_PASSTHRU); #endif #if HAVE_CRYPT PHP_MSHUTDOWN(crypt)(SHUTDOWN_FUNC_ARGS_PASSTHRU); #endif return SUCCESS; } /* }}} */ ",0 "static void limitedToOnlyOneAttributeAttributeGetterCallback(v8::Local, const v8::PropertyCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMGetter""); TestObjectPythonV8Internal::limitedToOnlyOneAttributeAttributeGetter(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "circle_div_pt(PG_FUNCTION_ARGS) { CIRCLE *circle = PG_GETARG_CIRCLE_P(0); Point *point = PG_GETARG_POINT_P(1); CIRCLE *result; Point *p; result = circle_copy(circle); p = DatumGetPointP(DirectFunctionCall2(point_div, PointPGetDatum(&circle->center), PointPGetDatum(point))); result->center.x = p->x; result->center.y = p->y; result->radius /= HYPOT(point->x, point->y); PG_RETURN_CIRCLE_P(result); } ",0 "static inline unsigned xfrm6_tunnel_spi_hash_byspi(u32 spi) { return spi % XFRM6_TUNNEL_SPI_BYSPI_HSIZE; } ",0 "void MainResourceLoader::didReceiveData(const char* data, int length, long long lengthReceived, bool allAtOnce) { ASSERT(data); ASSERT(length != 0); ASSERT(!m_response.isNull()); #if USE(CFNETWORK) || (PLATFORM(MAC) && !defined(BUILDING_ON_TIGER)) if (m_response.isNull()) { m_response = ResourceResponse(KURL(), ""text/html"", 0, String(), String()); if (DocumentLoader* documentLoader = frameLoader()->activeDocumentLoader()) documentLoader->setResponse(m_response); } #endif #if !PLATFORM(CF) ASSERT(!defersLoading()); #endif #if ENABLE(OFFLINE_WEB_APPLICATIONS) documentLoader()->applicationCacheHost()->mainResourceDataReceived(data, length, lengthReceived, allAtOnce); #endif RefPtr protect(this); m_timeOfLastDataReceived = currentTime(); ResourceLoader::didReceiveData(data, length, lengthReceived, allAtOnce); } ",0 "SProcRenderCreateConicalGradient(ClientPtr client) { int len; REQUEST(xRenderCreateConicalGradientReq); REQUEST_AT_LEAST_SIZE(xRenderCreateConicalGradientReq); swaps(&stuff->length); swapl(&stuff->pid); swapl(&stuff->center.x); swapl(&stuff->center.y); swapl(&stuff->angle); swapl(&stuff->nStops); len = (client->req_len << 2) - sizeof(xRenderCreateConicalGradientReq); if (stuff->nStops > UINT32_MAX / (sizeof(xFixed) + sizeof(xRenderColor))) return BadLength; if (len != stuff->nStops * (sizeof(xFixed) + sizeof(xRenderColor))) return BadLength; swapStops(stuff + 1, stuff->nStops); return (*ProcRenderVector[stuff->renderReqType]) (client); } ",0 "void md_kick_rdev_from_array(struct md_rdev *rdev) { unbind_rdev_from_array(rdev); export_rdev(rdev); } ",0 "void RenderViewImpl::queryStorageUsageAndQuota( WebFrame* frame, WebStorageQuotaType type, WebStorageQuotaCallbacks* callbacks) { DCHECK(frame); WebSecurityOrigin origin = frame->document().securityOrigin(); if (origin.isUnique()) { callbacks->didFail(WebKit::WebStorageQuotaErrorAbort); return; } ChildThread::current()->quota_dispatcher()->QueryStorageUsageAndQuota( GURL(origin.toString()), static_cast(type), QuotaDispatcher::CreateWebStorageQuotaCallbacksWrapper(callbacks)); } ",0 "static int dma_tx_fragment(struct b43_dmaring *ring, struct sk_buff *skb) { const struct b43_dma_ops *ops = ring->ops; struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); struct b43_private_tx_info *priv_info = b43_get_priv_tx_info(info); u8 *header; int slot, old_top_slot, old_used_slots; int err; struct b43_dmadesc_generic *desc; struct b43_dmadesc_meta *meta; struct b43_dmadesc_meta *meta_hdr; u16 cookie; size_t hdrsize = b43_txhdr_size(ring->dev); /* Important note: If the number of used DMA slots per TX frame * is changed here, the TX_SLOTS_PER_FRAME definition at the top of * the file has to be updated, too! */ old_top_slot = ring->current_slot; old_used_slots = ring->used_slots; /* Get a slot for the header. */ slot = request_slot(ring); desc = ops->idx2desc(ring, slot, &meta_hdr); memset(meta_hdr, 0, sizeof(*meta_hdr)); header = &(ring->txhdr_cache[(slot / TX_SLOTS_PER_FRAME) * hdrsize]); cookie = generate_cookie(ring, slot); err = b43_generate_txhdr(ring->dev, header, skb, info, cookie); if (unlikely(err)) { ring->current_slot = old_top_slot; ring->used_slots = old_used_slots; return err; } meta_hdr->dmaaddr = map_descbuffer(ring, (unsigned char *)header, hdrsize, 1); if (b43_dma_mapping_error(ring, meta_hdr->dmaaddr, hdrsize, 1)) { ring->current_slot = old_top_slot; ring->used_slots = old_used_slots; return -EIO; } ops->fill_descriptor(ring, desc, meta_hdr->dmaaddr, hdrsize, 1, 0, 0); /* Get a slot for the payload. */ slot = request_slot(ring); desc = ops->idx2desc(ring, slot, &meta); memset(meta, 0, sizeof(*meta)); meta->skb = skb; meta->is_last_fragment = 1; priv_info->bouncebuffer = NULL; meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1); /* create a bounce buffer in zone_dma on mapping failure. */ if (b43_dma_mapping_error(ring, meta->dmaaddr, skb->len, 1)) { priv_info->bouncebuffer = kmemdup(skb->data, skb->len, GFP_ATOMIC | GFP_DMA); if (!priv_info->bouncebuffer) { ring->current_slot = old_top_slot; ring->used_slots = old_used_slots; err = -ENOMEM; goto out_unmap_hdr; } meta->dmaaddr = map_descbuffer(ring, priv_info->bouncebuffer, skb->len, 1); if (b43_dma_mapping_error(ring, meta->dmaaddr, skb->len, 1)) { kfree(priv_info->bouncebuffer); priv_info->bouncebuffer = NULL; ring->current_slot = old_top_slot; ring->used_slots = old_used_slots; err = -EIO; goto out_unmap_hdr; } } ops->fill_descriptor(ring, desc, meta->dmaaddr, skb->len, 0, 1, 1); if (info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) { /* Tell the firmware about the cookie of the last * mcast frame, so it can clear the more-data bit in it. */ b43_shm_write16(ring->dev, B43_SHM_SHARED, B43_SHM_SH_MCASTCOOKIE, cookie); } /* Now transfer the whole frame. */ wmb(); ops->poke_tx(ring, next_slot(ring, slot)); return 0; out_unmap_hdr: unmap_descbuffer(ring, meta_hdr->dmaaddr, hdrsize, 1); return err; } ",0 "void GLES2Implementation::VertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void* ptr) { GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG(""["" << GetLogPrefix() << ""] glVertexAttribIPointer("" << index << "", "" << size << "", "" << GLES2Util::GetStringVertexAttribIType(type) << "", "" << stride << "", "" << ptr << "")""); if (!vertex_array_object_manager_->SetAttribPointer( bound_array_buffer_, index, size, type, GL_FALSE, stride, ptr, GL_TRUE)) { SetGLError(GL_INVALID_OPERATION, ""glVertexAttribIPointer"", ""client side arrays are not allowed in vertex array objects.""); return; } if (!support_client_side_arrays_ || bound_array_buffer_ != 0) { if (!ValidateOffset(""glVertexAttribIPointer"", reinterpret_cast(ptr))) { return; } helper_->VertexAttribIPointer(index, size, type, stride, ToGLuint(ptr)); } CheckGLError(); } ",0 "NTSTATUS TCCompleteDiskIrp (PIRP irp, NTSTATUS status, ULONG_PTR information) { irp->IoStatus.Status = status; irp->IoStatus.Information = information; IoCompleteRequest (irp, NT_SUCCESS (status) ? IO_DISK_INCREMENT : IO_NO_INCREMENT); return status; } ",0 "static __printf(1, 2) void verbose(const char *fmt, ...) { va_list args; if (log_level == 0 || log_len >= log_size - 1) return; va_start(args, fmt); log_len += vscnprintf(log_buf + log_len, log_size - log_len, fmt, args); va_end(args); } ",0 "void ip_rt_multicast_event(struct in_device *in_dev) { rt_cache_flush(dev_net(in_dev->dev), 0); } ",0 "static int ath_max_framelen(int usec, int mcs, bool ht40, bool sgi) { int streams = HT_RC_2_STREAMS(mcs); int symbols, bits; int bytes = 0; symbols = sgi ? TIME_SYMBOLS_HALFGI(usec) : TIME_SYMBOLS(usec); bits = symbols * bits_per_symbol[mcs % 8][ht40] * streams; bits -= OFDM_PLCP_BITS; bytes = bits / 8; bytes -= L_STF + L_LTF + L_SIG + HT_SIG + HT_STF + HT_LTF(streams); if (bytes > 65532) bytes = 65532; return bytes; } ",0 "static int kvm_ioctl_create_device(struct kvm *kvm, struct kvm_create_device *cd) { struct kvm_device_ops *ops = NULL; struct kvm_device *dev; bool test = cd->flags & KVM_CREATE_DEVICE_TEST; int ret; if (cd->type >= ARRAY_SIZE(kvm_device_ops_table)) return -ENODEV; ops = kvm_device_ops_table[cd->type]; if (ops == NULL) return -ENODEV; if (test) return 0; dev = kzalloc(sizeof(*dev), GFP_KERNEL); if (!dev) return -ENOMEM; dev->ops = ops; dev->kvm = kvm; mutex_lock(&kvm->lock); ret = ops->create(dev, cd->type); if (ret < 0) { mutex_unlock(&kvm->lock); kfree(dev); return ret; } list_add(&dev->vm_node, &kvm->devices); mutex_unlock(&kvm->lock); if (ops->init) ops->init(dev); ret = anon_inode_getfd(ops->name, &kvm_device_fops, dev, O_RDWR | O_CLOEXEC); if (ret < 0) { ops->destroy(dev); mutex_lock(&kvm->lock); list_del(&dev->vm_node); mutex_unlock(&kvm->lock); return ret; } kvm_get_kvm(kvm); cd->fd = ret; return 0; } ",1 "static void row_dim_delete(zval *object, zval *offset TSRMLS_DC) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Cannot delete properties from a PDORow""); } ",0 "static void update_cfs_rq_h_load(struct cfs_rq *cfs_rq) { struct rq *rq = rq_of(cfs_rq); struct sched_entity *se = cfs_rq->tg->se[cpu_of(rq)]; unsigned long now = jiffies; unsigned long load; if (cfs_rq->last_h_load_update == now) return; cfs_rq->h_load_next = NULL; for_each_sched_entity(se) { cfs_rq = cfs_rq_of(se); cfs_rq->h_load_next = se; if (cfs_rq->last_h_load_update == now) break; } if (!se) { cfs_rq->h_load = cfs_rq_load_avg(cfs_rq); cfs_rq->last_h_load_update = now; } while ((se = cfs_rq->h_load_next) != NULL) { load = cfs_rq->h_load; load = div64_ul(load * se->avg.load_avg, cfs_rq_load_avg(cfs_rq) + 1); cfs_rq = group_cfs_rq(se); cfs_rq->h_load = load; cfs_rq->last_h_load_update = now; } } ",0 "CanvasFontCache* Document::canvasFontCache() { if (!m_canvasFontCache) m_canvasFontCache = CanvasFontCache::create(*this); return m_canvasFontCache.get(); } ",0 "error::Error GLES2DecoderPassthroughImpl::DoMemoryBarrierEXT( GLbitfield barriers) { api()->glMemoryBarrierEXTFn(barriers); return error::kNoError; } ",0 "gpc_nop6(Pixel *out, const Pixel *in, const Background *back) { (void)back; if (in->a == 0) out->r = out->g = out->b = 65535; else { out->r = in->r; out->g = in->g; out->b = in->b; } out->a = in->a; } ",0 "void InputType::SetFilesFromPaths(const Vector& paths) {} ",0 "static int em_ret_far(struct x86_emulate_ctxt *ctxt) { int rc; unsigned long cs; rc = emulate_pop(ctxt, &ctxt->_eip, ctxt->op_bytes); if (rc != X86EMUL_CONTINUE) return rc; if (ctxt->op_bytes == 4) ctxt->_eip = (u32)ctxt->_eip; rc = emulate_pop(ctxt, &cs, ctxt->op_bytes); if (rc != X86EMUL_CONTINUE) return rc; rc = load_segment_descriptor(ctxt, (u16)cs, VCPU_SREG_CS); return rc; } ",0 " GDataEntry* FindEntry(const FilePath& file_path) { GDataEntry* entry = NULL; file_system_->root_->FindEntryByPath( file_path, base::Bind(&ReadOnlyFindEntryCallback, &entry)); return entry; } ",0 "zgetbitsrect(i_ctx_t *i_ctx_p) { /* * alpha? is 0 for no alpha, -1 for alpha first, 1 for alpha last. * std_depth is null for native pixels, depth/component for * standard color space. */ os_ptr op = osp; gx_device *dev; gs_int_rect rect; gs_get_bits_params_t params; int w, h; gs_get_bits_options_t options = GB_ALIGN_ANY | GB_RETURN_COPY | GB_OFFSET_0 | GB_RASTER_STANDARD | GB_PACKING_CHUNKY; int depth; uint raster; int num_rows; int code; check_read_type(op[-7], t_device); dev = op[-7].value.pdevice; if (dev == NULL) /* This can happen if we invalidated devices on the stack by calling nulldevice after they were pushed */ return_error(gs_error_undefined); check_int_leu(op[-6], dev->width); rect.p.x = op[-6].value.intval; check_int_leu(op[-5], dev->height); rect.p.y = op[-5].value.intval; check_int_leu(op[-4], dev->width); w = op[-4].value.intval; check_int_leu(op[-3], dev->height); h = op[-3].value.intval; check_type(op[-2], t_integer); /* * We use if/else rather than switch because the value is long, * which is not supported as a switch value in pre-ANSI C. */ if (op[-2].value.intval == -1) options |= GB_ALPHA_FIRST; else if (op[-2].value.intval == 0) options |= GB_ALPHA_NONE; else if (op[-2].value.intval == 1) options |= GB_ALPHA_LAST; else return_error(gs_error_rangecheck); if (r_has_type(op - 1, t_null)) { options |= GB_COLORS_NATIVE; depth = dev->color_info.depth; } else { static const gs_get_bits_options_t depths[17] = { 0, GB_DEPTH_1, GB_DEPTH_2, 0, GB_DEPTH_4, 0, 0, 0, GB_DEPTH_8, 0, 0, 0, GB_DEPTH_12, 0, 0, 0, GB_DEPTH_16 }; gs_get_bits_options_t depth_option; int std_depth; check_int_leu(op[-1], 16); std_depth = (int)op[-1].value.intval; depth_option = depths[std_depth]; if (depth_option == 0) return_error(gs_error_rangecheck); options |= depth_option | GB_COLORS_NATIVE; depth = (dev->color_info.num_components + (options & GB_ALPHA_NONE ? 0 : 1)) * std_depth; } if (w == 0) return_error(gs_error_rangecheck); raster = (w * depth + 7) >> 3; check_write_type(*op, t_string); num_rows = r_size(op) / raster; h = min(h, num_rows); if (h == 0) return_error(gs_error_rangecheck); rect.q.x = rect.p.x + w; rect.q.y = rect.p.y + h; params.options = options; params.data[0] = op->value.bytes; code = (*dev_proc(dev, get_bits_rectangle))(dev, &rect, ¶ms, NULL); if (code < 0) return code; make_int(op - 7, h); op[-6] = *op; r_set_size(op - 6, h * raster); pop(6); return 0; } ",0 "LRESULT CALLBACK TreeView::TreeWndProc(HWND window, UINT message, WPARAM w_param, LPARAM l_param) { TreeViewWrapper* wrapper = reinterpret_cast( GetWindowLongPtr(window, GWLP_USERDATA)); DCHECK(wrapper); TreeView* tree = wrapper->tree_view; switch (message) { case WM_ERASEBKGND: return 1; case WM_PAINT: { gfx::CanvasSkiaPaint canvas(window); if (canvas.isEmpty()) return 0; HDC dc = skia::BeginPlatformPaint(&canvas); if (base::i18n::IsRTL()) { XFORM xform = {0}; xform.eM11 = xform.eM22 = 1; SetWorldTransform(dc, &xform); SetGraphicsMode(dc, GM_COMPATIBLE); SetLayout(dc, LAYOUT_RTL); SetViewportOrgEx(dc, -canvas.paintStruct().rcPaint.left, -canvas.paintStruct().rcPaint.top, NULL); } SendMessage(window, WM_PRINTCLIENT, reinterpret_cast(dc), 0); if (base::i18n::IsRTL()) { SetViewportOrgEx(dc, 0, 0, NULL); } skia::EndPlatformPaint(&canvas); return 0; } case WM_RBUTTONDOWN: if (tree->select_on_right_mouse_down_) { TVHITTESTINFO hit_info; hit_info.pt = gfx::Point(l_param).ToPOINT(); HTREEITEM hit_item = TreeView_HitTest(window, &hit_info); if (hit_item && (hit_info.flags & (TVHT_ONITEM | TVHT_ONITEMRIGHT | TVHT_ONITEMINDENT)) != 0) TreeView_SelectItem(tree->tree_view_, hit_item); } break; } WNDPROC handler = tree->original_handler_; DCHECK(handler); return CallWindowProc(handler, window, message, w_param, l_param); } ",0 "AirPDcapGetStaAddress( const AIRPDCAP_MAC_FRAME_ADDR4 *frame) { switch(AIRPDCAP_DS_BITS(frame->fc[1])) { /* Bit 1 = FromDS, bit 0 = ToDS */ case 0: if (memcmp(frame->addr2, frame->addr3, AIRPDCAP_MAC_LEN) == 0) return frame->addr1; else return frame->addr2; case 1: return frame->addr2; case 2: return frame->addr1; case 3: if (memcmp(frame->addr1, frame->addr2, AIRPDCAP_MAC_LEN) < 0) return frame->addr1; else return frame->addr2; default: return NULL; } } ",0 "static inline void CompositeCanvas(Image *destination, const CompositeOperator compose,Image *source,ssize_t x_offset, ssize_t y_offset,ExceptionInfo *exception) { const char *value; x_offset+=source->page.x-destination->page.x; y_offset+=source->page.y-destination->page.y; value=GetImageArtifact(source,""compose:outside-overlay""); (void) CompositeImage(destination,source,compose, (value != (const char *) NULL) && (IsStringTrue(value) != MagickFalse) ? MagickFalse : MagickTrue,x_offset,y_offset,exception); } ",0 "size_t rand_drbg_get_additional_data(RAND_POOL *pool, unsigned char **pout) { size_t ret = 0; if (rand_pool_add_additional_data(pool) == 0) goto err; ret = rand_pool_length(pool); *pout = rand_pool_detach(pool); err: return ret; } ",0 "void Document::setDir(const AtomicString& value) { Element* rootElement = documentElement(); if (isHTMLHtmlElement(rootElement)) toHTMLHtmlElement(rootElement)->setDir(value); } ",0 "void RenderFrameImpl::RegisterMojoInterfaces() { GetAssociatedInterfaceRegistry()->AddInterface( base::Bind(&RenderFrameImpl::BindEngagement, weak_factory_.GetWeakPtr())); GetAssociatedInterfaceRegistry()->AddInterface(base::Bind( &RenderFrameImpl::BindMediaEngagement, weak_factory_.GetWeakPtr())); GetAssociatedInterfaceRegistry()->AddInterface(base::Bind( &RenderFrameImpl::BindFrameBindingsControl, weak_factory_.GetWeakPtr())); GetAssociatedInterfaceRegistry()->AddInterface( base::Bind(&RenderFrameImpl::BindFrameNavigationControl, weak_factory_.GetWeakPtr())); GetAssociatedInterfaceRegistry()->AddInterface(base::BindRepeating( &RenderFrameImpl::BindFullscreen, weak_factory_.GetWeakPtr())); registry_.AddInterface(base::Bind(&FrameInputHandlerImpl::CreateMojoService, weak_factory_.GetWeakPtr())); registry_.AddInterface( base::Bind(&InputTargetClientImpl::BindToRequest, base::Unretained(&input_target_client_impl_))); registry_.AddInterface( base::Bind(&RenderFrameImpl::BindWidget, weak_factory_.GetWeakPtr())); if (!frame_->Parent()) { registry_.AddInterface(base::Bind(&ImageDownloaderImpl::CreateMojoService, base::Unretained(this))); GetAssociatedInterfaceRegistry()->AddInterface(base::Bind( &RenderFrameImpl::OnHostZoomClientRequest, weak_factory_.GetWeakPtr())); registry_.AddInterface( base::Bind(&ManifestManager::BindToRequest, base::Unretained(manifest_manager_.get()))); } } ",0 "static int ext4_xattr_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo) { __u64 physical = 0; __u64 length; __u32 flags = FIEMAP_EXTENT_LAST; int blockbits = inode->i_sb->s_blocksize_bits; int error = 0; /* in-inode? */ if (ext4_test_inode_state(inode, EXT4_STATE_XATTR)) { struct ext4_iloc iloc; int offset; /* offset of xattr in inode */ error = ext4_get_inode_loc(inode, &iloc); if (error) return error; physical = iloc.bh->b_blocknr << blockbits; offset = EXT4_GOOD_OLD_INODE_SIZE + EXT4_I(inode)->i_extra_isize; physical += offset; length = EXT4_SB(inode->i_sb)->s_inode_size - offset; flags |= FIEMAP_EXTENT_DATA_INLINE; brelse(iloc.bh); } else { /* external block */ physical = EXT4_I(inode)->i_file_acl << blockbits; length = inode->i_sb->s_blocksize; } if (physical) error = fiemap_fill_next_extent(fieinfo, 0, physical, length, flags); return (error < 0 ? error : 0); } ",0 "ExprCreateIdent(xkb_atom_t ident) { EXPR_CREATE(ExprIdent, expr, EXPR_IDENT, EXPR_TYPE_UNKNOWN); expr->ident.ident = ident; return expr; } ",0 "static inline void ide_abort_command(IDEState *s) { ide_transfer_stop(s); s->status = READY_STAT | ERR_STAT; s->error = ABRT_ERR; } ",0 "void GamepadBuilder::AddPlaceholderButton() { AddButton(GamepadButton()); } ",0 " InitializeTask( QuotaManager* manager, const FilePath& profile_path, bool is_incognito) : DatabaseTaskBase(manager), profile_path_(profile_path), is_incognito_(is_incognito), need_initialize_origins_(false), temporary_storage_quota_(-1) { } ",0 "const Extension* ExtensionService::GetInstalledAppForRenderer( int renderer_child_id) { InstalledAppMap::iterator i = installed_app_hosts_.find(renderer_child_id); if (i == installed_app_hosts_.end()) return NULL; return i->second; } ",0 "unsigned long DocumentLoader::MainResourceIdentifier() const { return main_resource_ ? main_resource_->Identifier() : 0; } ",0 "static PHP_NAMED_FUNCTION(zif_zip_entry_open) { zval * zip; zval * zip_entry; char *mode = NULL; int mode_len = 0; zip_read_rsrc * zr_rsrc; zip_rsrc *z_rsrc; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""rr|s"", &zip, &zip_entry, &mode, &mode_len) == FAILURE) { return; } ZEND_FETCH_RESOURCE(zr_rsrc, zip_read_rsrc *, &zip_entry, -1, le_zip_entry_name, le_zip_entry); ZEND_FETCH_RESOURCE(z_rsrc, zip_rsrc *, &zip, -1, le_zip_dir_name, le_zip_dir); if (zr_rsrc->zf != NULL) { RETURN_TRUE; } else { RETURN_FALSE; } } ",0 "int UDPSocketLibevent::SetMulticastTimeToLive(int time_to_live) { DCHECK(CalledOnValidThread()); if (is_connected()) return ERR_SOCKET_IS_CONNECTED; if (time_to_live < 0 || time_to_live > 255) return ERR_INVALID_ARGUMENT; multicast_time_to_live_ = time_to_live; return OK; } ",0 "void GpuCommandBufferStub::OnRescheduled() { gpu::CommandBuffer::State pre_state = command_buffer_->GetLastState(); command_buffer_->Flush(pre_state.put_offset); gpu::CommandBuffer::State post_state = command_buffer_->GetLastState(); if (pre_state.get_offset != post_state.get_offset) ReportState(); } ",0 "PassRefPtr Document::styleForElementIgnoringPendingStylesheets(Element* element) { ASSERT_ARG(element, element->document() == this); bool oldIgnore = m_ignorePendingStylesheets; m_ignorePendingStylesheets = true; RefPtr style = styleResolver()->styleForElement(element, element->parentNode() ? element->parentNode()->computedStyle() : 0); m_ignorePendingStylesheets = oldIgnore; return style.release(); } ",0 "JNI_SendTabToSelfAndroidBridge_GetEntryByGUID( JNIEnv* env, const JavaParamRef& j_profile, const JavaParamRef& j_guid) { SendTabToSelfModel* model = GetModel(j_profile); if (!model->IsReady()) { return nullptr; } const std::string guid = ConvertJavaStringToUTF8(env, j_guid); const SendTabToSelfEntry* found_entry = model->GetEntryByGUID(guid); if (found_entry == nullptr) { return nullptr; } return CreateJavaSendTabToSelfEntry(env, found_entry); } ",0 "void megasas_add_remove_devices(struct megasas_instance *instance, int scan_type) { int i, j; u16 pd_index = 0; u16 ld_index = 0; u16 channel = 0, id = 0; struct Scsi_Host *host; struct scsi_device *sdev1; struct MR_HOST_DEVICE_LIST *targetid_list = NULL; struct MR_HOST_DEVICE_LIST_ENTRY *targetid_entry = NULL; host = instance->host; if (instance->enable_fw_dev_list) { targetid_list = instance->host_device_list_buf; for (i = 0; i < targetid_list->count; i++) { targetid_entry = &targetid_list->host_device_list[i]; if (targetid_entry->flags.u.bits.is_sys_pd) { channel = le16_to_cpu(targetid_entry->target_id) / MEGASAS_MAX_DEV_PER_CHANNEL; id = le16_to_cpu(targetid_entry->target_id) % MEGASAS_MAX_DEV_PER_CHANNEL; } else { channel = MEGASAS_MAX_PD_CHANNELS + (le16_to_cpu(targetid_entry->target_id) / MEGASAS_MAX_DEV_PER_CHANNEL); id = le16_to_cpu(targetid_entry->target_id) % MEGASAS_MAX_DEV_PER_CHANNEL; } sdev1 = scsi_device_lookup(host, channel, id, 0); if (!sdev1) { scsi_add_device(host, channel, id, 0); } else { scsi_device_put(sdev1); } } } if (scan_type & SCAN_PD_CHANNEL) { for (i = 0; i < MEGASAS_MAX_PD_CHANNELS; i++) { for (j = 0; j < MEGASAS_MAX_DEV_PER_CHANNEL; j++) { pd_index = i * MEGASAS_MAX_DEV_PER_CHANNEL + j; sdev1 = scsi_device_lookup(host, i, j, 0); if (instance->pd_list[pd_index].driveState == MR_PD_STATE_SYSTEM) { if (!sdev1) scsi_add_device(host, i, j, 0); else scsi_device_put(sdev1); } else { if (sdev1) megasas_remove_scsi_device(sdev1); } } } } if (scan_type & SCAN_VD_CHANNEL) { for (i = 0; i < MEGASAS_MAX_LD_CHANNELS; i++) { for (j = 0; j < MEGASAS_MAX_DEV_PER_CHANNEL; j++) { ld_index = (i * MEGASAS_MAX_DEV_PER_CHANNEL) + j; sdev1 = scsi_device_lookup(host, MEGASAS_MAX_PD_CHANNELS + i, j, 0); if (instance->ld_ids[ld_index] != 0xff) { if (!sdev1) scsi_add_device(host, MEGASAS_MAX_PD_CHANNELS + i, j, 0); else scsi_device_put(sdev1); } else { if (sdev1) megasas_remove_scsi_device(sdev1); } } } } } ",0 "void PaintLayerScrollableArea::SetVerticalScrollbarVisualRect( const LayoutRect& rect) { vertical_scrollbar_visual_rect_ = rect; if (Scrollbar* scrollbar = VerticalScrollbar()) scrollbar->SetVisualRect(rect); } ",0 "void QuicStreamSequencerBuffer::Clear() { if (blocks_ != nullptr) { for (size_t i = 0; i < blocks_count_; ++i) { if (blocks_[i] != nullptr) { RetireBlock(i); } } } num_bytes_buffered_ = 0; gaps_ = std::list( 1, Gap(total_bytes_read_, std::numeric_limits::max())); frame_arrival_time_map_.clear(); } ",0 "void SkiaOutputSurfaceImplTest::TearDown() { output_surface_.reset(); scoped_feature_list_.reset(); } ",0 "bool BrowserWindowGtk::IsDownloadShelfVisible() const { return download_shelf_.get() && download_shelf_->IsShowing(); } ",0 "void hostap_dump_rx_header(const char *name, const struct hfa384x_rx_frame *rx) { u16 status, fc; status = __le16_to_cpu(rx->status); printk(KERN_DEBUG ""%s: RX status=0x%04x (port=%d, type=%d, "" ""fcserr=%d) silence=%d signal=%d rate=%d rxflow=%d; "" ""jiffies=%ld\n"", name, status, (status >> 8) & 0x07, status >> 13, status & 1, rx->silence, rx->signal, rx->rate, rx->rxflow, jiffies); fc = __le16_to_cpu(rx->frame_control); printk(KERN_DEBUG "" FC=0x%04x (type=%d:%d) dur=0x%04x seq=0x%04x "" ""data_len=%d%s%s\n"", fc, (fc & IEEE80211_FCTL_FTYPE) >> 2, (fc & IEEE80211_FCTL_STYPE) >> 4, __le16_to_cpu(rx->duration_id), __le16_to_cpu(rx->seq_ctrl), __le16_to_cpu(rx->data_len), fc & IEEE80211_FCTL_TODS ? "" [ToDS]"" : """", fc & IEEE80211_FCTL_FROMDS ? "" [FromDS]"" : """"); printk(KERN_DEBUG "" A1=%pM A2=%pM A3=%pM A4=%pM\n"", rx->addr1, rx->addr2, rx->addr3, rx->addr4); printk(KERN_DEBUG "" dst=%pM src=%pM len=%d\n"", rx->dst_addr, rx->src_addr, __be16_to_cpu(rx->len)); } ",0 "bool nfsd4_spo_must_allow(struct svc_rqst *rqstp) { struct nfsd4_compoundres *resp = rqstp->rq_resp; struct nfsd4_compoundargs *argp = rqstp->rq_argp; struct nfsd4_op *this = &argp->ops[resp->opcnt - 1]; struct nfsd4_compound_state *cstate = &resp->cstate; struct nfs4_op_map *allow = &cstate->clp->cl_spo_must_allow; u32 opiter; if (!cstate->minorversion) return false; if (cstate->spo_must_allowed == true) return true; opiter = resp->opcnt; while (opiter < argp->opcnt) { this = &argp->ops[opiter++]; if (test_bit(this->opnum, allow->u.longs) && cstate->clp->cl_mach_cred && nfsd4_mach_creds_match(cstate->clp, rqstp)) { cstate->spo_must_allowed = true; return true; } } cstate->spo_must_allowed = false; return false; } ",0 "xfs_setfilesize_ioend( struct xfs_ioend *ioend, int error) { struct xfs_inode *ip = XFS_I(ioend->io_inode); struct xfs_trans *tp = ioend->io_append_trans; /* * The transaction may have been allocated in the I/O submission thread, * thus we need to mark ourselves as being in a transaction manually. * Similarly for freeze protection. */ current_set_flags_nested(&tp->t_pflags, PF_FSTRANS); __sb_writers_acquired(VFS_I(ip)->i_sb, SB_FREEZE_FS); /* we abort the update if there was an IO error */ if (error) { xfs_trans_cancel(tp); return error; } return __xfs_setfilesize(ip, tp, ioend->io_offset, ioend->io_size); } ",0 "void RenderViewImpl::ConvertViewportToWindow(blink::WebRect* rect) { RenderWidget::ConvertViewportToWindow(rect); } ",0 "void V8TestObject::VoidMethodDoubleOrDOMStringArgMethodCallback(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_voidMethodDoubleOrDOMStringArg""); test_object_v8_internal::VoidMethodDoubleOrDOMStringArgMethod(info); } ",0 "error::Error GLES2DecoderPassthroughImpl::DoInvalidateSubFramebuffer( GLenum target, GLsizei count, const volatile GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height) { if (count < 0) { InsertError(GL_INVALID_VALUE, ""count cannot be negative.""); return error::kNoError; } std::vector attachments_copy(attachments, attachments + count); if (IsEmulatedFramebufferBound(target)) { if (!ModifyAttachmentsForEmulatedFramebuffer(&attachments_copy)) { InsertError(GL_INVALID_OPERATION, ""Invalid attachment.""); return error::kNoError; } } api()->glInvalidateSubFramebufferFn(target, count, attachments_copy.data(), x, y, width, height); return error::kNoError; } ",0 "static av_noinline int get_symbol(RangeCoder *c, uint8_t *state, int is_signed) { return get_symbol_inline(c, state, is_signed); } ",0 "error::Error GLES2DecoderPassthroughImpl::DoGetIntegerv(GLenum pname, GLsizei bufsize, GLsizei* length, GLint* params) { return GetNumericHelper( pname, bufsize, length, params, [this](GLenum pname, GLsizei bufsize, GLsizei* length, GLint* params) { api()->glGetIntegervRobustANGLEFn(pname, bufsize, length, params); }); } ",0 "rd_contents(struct archive_read *a, const void **buff, size_t *size, size_t *used, uint64_t remaining) { const unsigned char *b; ssize_t bytes; /* Get whatever bytes are immediately available. */ b = __archive_read_ahead(a, 1, &bytes); if (bytes < 0) return ((int)bytes); if (bytes == 0) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, ""Truncated archive file""); return (ARCHIVE_FATAL); } if ((uint64_t)bytes > remaining) bytes = (ssize_t)remaining; /* * Decompress contents of file. */ *used = bytes; if (decompress(a, buff, size, b, used) != ARCHIVE_OK) return (ARCHIVE_FATAL); /* * Update checksum of a compressed data and a extracted data. */ checksum_update(a, b, *used, *buff, *size); return (ARCHIVE_OK); } ",0 " void WaitForLoadStop() { if (load_stop_observed_) return; message_loop_runner_ = new content::MessageLoopRunner; message_loop_runner_->Run(); } ",0 "bool ExtensionContextMenuModel::GetAcceleratorForCommandId( int command_id, ui::Accelerator* accelerator) { return false; } ",0 " base::FilePath metrics_file() { return temp_dir_.GetPath().AppendASCII(kMetricsFilename); } ",0 "void BlinkTestRunner::SetPermission(const std::string& name, const std::string& value, const GURL& origin, const GURL& embedding_origin) { content::PermissionStatus status; if (value == ""granted"") status = PERMISSION_STATUS_GRANTED; else if (value == ""prompt"") status = PERMISSION_STATUS_ASK; else if (value == ""denied"") status = PERMISSION_STATUS_DENIED; else { NOTREACHED(); status = PERMISSION_STATUS_DENIED; } Send(new LayoutTestHostMsg_SetPermission( routing_id(), name, status, origin, embedding_origin)); } ",0 "static int mov_write_trun_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *track, int moof_size, int first, int end) { int64_t pos = avio_tell(pb); uint32_t flags = MOV_TRUN_DATA_OFFSET; int i; for (i = first; i < end; i++) { if (get_cluster_duration(track, i) != track->default_duration) flags |= MOV_TRUN_SAMPLE_DURATION; if (track->cluster[i].size != track->default_size) flags |= MOV_TRUN_SAMPLE_SIZE; if (i > first && get_sample_flags(track, &track->cluster[i]) != track->default_sample_flags) flags |= MOV_TRUN_SAMPLE_FLAGS; } if (!(flags & MOV_TRUN_SAMPLE_FLAGS) && track->entry > 0 && get_sample_flags(track, &track->cluster[0]) != track->default_sample_flags) flags |= MOV_TRUN_FIRST_SAMPLE_FLAGS; if (track->flags & MOV_TRACK_CTTS) flags |= MOV_TRUN_SAMPLE_CTS; avio_wb32(pb, 0); /* size placeholder */ ffio_wfourcc(pb, ""trun""); if (mov->flags & FF_MOV_FLAG_NEGATIVE_CTS_OFFSETS) avio_w8(pb, 1); /* version */ else avio_w8(pb, 0); /* version */ avio_wb24(pb, flags); avio_wb32(pb, end - first); /* sample count */ if (mov->flags & FF_MOV_FLAG_OMIT_TFHD_OFFSET && !(mov->flags & FF_MOV_FLAG_DEFAULT_BASE_MOOF) && !mov->first_trun) avio_wb32(pb, 0); /* Later tracks follow immediately after the previous one */ else avio_wb32(pb, moof_size + 8 + track->data_offset + track->cluster[first].pos); /* data offset */ if (flags & MOV_TRUN_FIRST_SAMPLE_FLAGS) avio_wb32(pb, get_sample_flags(track, &track->cluster[first])); for (i = first; i < end; i++) { if (flags & MOV_TRUN_SAMPLE_DURATION) avio_wb32(pb, get_cluster_duration(track, i)); if (flags & MOV_TRUN_SAMPLE_SIZE) avio_wb32(pb, track->cluster[i].size); if (flags & MOV_TRUN_SAMPLE_FLAGS) avio_wb32(pb, get_sample_flags(track, &track->cluster[i])); if (flags & MOV_TRUN_SAMPLE_CTS) avio_wb32(pb, track->cluster[i].cts); } mov->first_trun = 0; return update_size(pb, pos); } ",0 "void fs_private(void) { char *homedir = cfg.homedir; assert(homedir); uid_t u = getuid(); gid_t g = getgid(); int xflag = store_xauthority(); int aflag = store_asoundrc(); if (arg_debug) printf(""Mounting a new /home directory\n""); if (mount(""tmpfs"", ""/home"", ""tmpfs"", MS_NOSUID | MS_NODEV | MS_STRICTATIME | MS_REC, ""mode=755,gid=0"") < 0) errExit(""mounting home directory""); fs_logger(""mount tmpfs on /home""); if (arg_debug) printf(""Mounting a new /root directory\n""); if (mount(""tmpfs"", ""/root"", ""tmpfs"", MS_NOSUID | MS_NODEV | MS_STRICTATIME | MS_REC, ""mode=700,gid=0"") < 0) errExit(""mounting root directory""); fs_logger(""mount tmpfs on /root""); if (u != 0) { if (arg_debug) printf(""Create a new user directory\n""); if (mkdir(homedir, S_IRWXU) == -1) { if (mkpath_as_root(homedir) == -1) errExit(""mkpath""); if (mkdir(homedir, S_IRWXU) == -1) errExit(""mkdir""); } if (chown(homedir, u, g) < 0) errExit(""chown""); fs_logger2(""mkdir"", homedir); } skel(homedir, u, g); if (xflag) copy_xauthority(); if (aflag) copy_asoundrc(); } ",0 "inline void comps_mrtree_data_destroy_v(void * rtd) { comps_mrtree_data_destroy((COMPS_MRTreeData*)rtd); } ",0 "void udp_destroy_sock(struct sock *sk) { bool slow = lock_sock_fast(sk); udp_flush_pending_frames(sk); unlock_sock_fast(sk, slow); } ",0 "bool RenderBox::getBackgroundPaintedExtent(LayoutRect& paintedExtent) const { ASSERT(hasBackground()); LayoutRect backgroundRect = pixelSnappedIntRect(borderBoxRect()); Color backgroundColor = resolveColor(CSSPropertyBackgroundColor); if (backgroundColor.alpha()) { paintedExtent = backgroundRect; return true; } if (!style()->backgroundLayers()->image() || style()->backgroundLayers()->next()) { paintedExtent = backgroundRect; return true; } BackgroundImageGeometry geometry; calculateBackgroundImageGeometry(0, style()->backgroundLayers(), backgroundRect, geometry); if (geometry.hasNonLocalGeometry()) return false; paintedExtent = geometry.destRect(); return true; } ",0 "static int handle_dr(struct kvm_vcpu *vcpu) { unsigned long exit_qualification; int dr, dr7, reg; exit_qualification = vmcs_readl(EXIT_QUALIFICATION); dr = exit_qualification & DEBUG_REG_ACCESS_NUM; /* First, if DR does not exist, trigger UD */ if (!kvm_require_dr(vcpu, dr)) return 1; /* Do not handle if the CPL > 0, will trigger GP on re-entry */ if (!kvm_require_cpl(vcpu, 0)) return 1; dr7 = vmcs_readl(GUEST_DR7); if (dr7 & DR7_GD) { /* * As the vm-exit takes precedence over the debug trap, we * need to emulate the latter, either for the host or the * guest debugging itself. */ if (vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP) { vcpu->run->debug.arch.dr6 = vcpu->arch.dr6; vcpu->run->debug.arch.dr7 = dr7; vcpu->run->debug.arch.pc = kvm_get_linear_rip(vcpu); vcpu->run->debug.arch.exception = DB_VECTOR; vcpu->run->exit_reason = KVM_EXIT_DEBUG; return 0; } else { vcpu->arch.dr6 &= ~15; vcpu->arch.dr6 |= DR6_BD | DR6_RTM; kvm_queue_exception(vcpu, DB_VECTOR); return 1; } } if (vcpu->guest_debug == 0) { vmcs_clear_bits(CPU_BASED_VM_EXEC_CONTROL, CPU_BASED_MOV_DR_EXITING); /* * No more DR vmexits; force a reload of the debug registers * and reenter on this instruction. The next vmexit will * retrieve the full state of the debug registers. */ vcpu->arch.switch_db_regs |= KVM_DEBUGREG_WONT_EXIT; return 1; } reg = DEBUG_REG_ACCESS_REG(exit_qualification); if (exit_qualification & TYPE_MOV_FROM_DR) { unsigned long val; if (kvm_get_dr(vcpu, dr, &val)) return 1; kvm_register_write(vcpu, reg, val); } else if (kvm_set_dr(vcpu, dr, kvm_register_readl(vcpu, reg))) return 1; return kvm_skip_emulated_instruction(vcpu); } ",0 "iasecc_pin_get_policy (struct sc_card *card, struct sc_pin_cmd_data *data) { struct sc_context *ctx = card->ctx; struct sc_file *save_current_df = NULL, *save_current_ef = NULL; struct iasecc_sdo sdo; struct sc_path path; unsigned ii; int rv; LOG_FUNC_CALLED(ctx); sc_log(ctx, ""iasecc_pin_get_policy(card:%p)"", card); if (data->pin_type != SC_AC_CHV) { sc_log(ctx, ""To unblock PIN it's CHV reference should be presented""); LOG_FUNC_RETURN(ctx, SC_ERROR_INVALID_ARGUMENTS); } if (card->cache.valid && card->cache.current_df) { sc_file_dup(&save_current_df, card->cache.current_df); if (save_current_df == NULL) { rv = SC_ERROR_OUT_OF_MEMORY; sc_log(ctx, ""Cannot duplicate current DF file""); goto err; } } if (card->cache.valid && card->cache.current_ef) { sc_file_dup(&save_current_ef, card->cache.current_ef); if (save_current_ef == NULL) { rv = SC_ERROR_OUT_OF_MEMORY; sc_log(ctx, ""Cannot duplicate current EF file""); goto err; } } if (!(data->pin_reference & IASECC_OBJECT_REF_LOCAL) && card->cache.valid && card->cache.current_df) { sc_format_path(""3F00"", &path); path.type = SC_PATH_TYPE_FILE_ID; rv = iasecc_select_file(card, &path, NULL); LOG_TEST_GOTO_ERR(ctx, rv, ""Unable to select MF""); } memset(&sdo, 0, sizeof(sdo)); sdo.sdo_class = IASECC_SDO_CLASS_CHV; sdo.sdo_ref = data->pin_reference & ~IASECC_OBJECT_REF_LOCAL; sc_log(ctx, ""iasecc_pin_get_policy() reference %i"", sdo.sdo_ref); rv = iasecc_sdo_get_data(card, &sdo); LOG_TEST_GOTO_ERR(ctx, rv, ""Cannot get SDO PIN data""); if (sdo.docp.acls_contact.size == 0) { rv = SC_ERROR_INVALID_DATA; sc_log(ctx, ""Extremely strange ... there is no ACLs""); goto err; } sc_log(ctx, ""iasecc_pin_get_policy() sdo.docp.size.size %""SC_FORMAT_LEN_SIZE_T""u"", sdo.docp.size.size); for (ii=0; iipin1.acls[ii]; int crt_num = 0; memset(&se, 0, sizeof(se)); memset(&acl->crts, 0, sizeof(acl->crts)); sc_log(ctx, ""iasecc_pin_get_policy() set info acls: SCB 0x%X"", scb); /* acl->raw_value = scb; */ acl->method = scb & IASECC_SCB_METHOD_MASK; acl->key_ref = scb & IASECC_SCB_METHOD_MASK_REF; if (scb==0 || scb==0xFF) continue; if (se.reference != (int)acl->key_ref) { memset(&se, 0, sizeof(se)); se.reference = acl->key_ref; rv = iasecc_se_get_info(card, &se); LOG_TEST_GOTO_ERR(ctx, rv, ""SDO get data error""); } if (scb & IASECC_SCB_METHOD_USER_AUTH) { rv = iasecc_se_get_crt_by_usage(card, &se, IASECC_CRT_TAG_AT, IASECC_UQB_AT_USER_PASSWORD, &acl->crts[crt_num]); LOG_TEST_GOTO_ERR(ctx, rv, ""no authentication template for 'USER PASSWORD'""); sc_log(ctx, ""iasecc_pin_get_policy() scb:0x%X; sdo_ref:[%i,%i,...]"", scb, acl->crts[crt_num].refs[0], acl->crts[crt_num].refs[1]); crt_num++; } if (scb & (IASECC_SCB_METHOD_SM | IASECC_SCB_METHOD_EXT_AUTH)) { sc_log(ctx, ""'SM' and 'EXTERNAL AUTHENTICATION' protection methods are not supported: SCB:0x%X"", scb); /* Set to 'NEVER' if all conditions are needed or * there is no user authentication method allowed */ if (!crt_num || (scb & IASECC_SCB_METHOD_NEED_ALL)) acl->method = SC_AC_NEVER; continue; } sc_file_free(se.df); } if (sdo.data.chv.size_max.value) data->pin1.max_length = *sdo.data.chv.size_max.value; if (sdo.data.chv.size_min.value) data->pin1.min_length = *sdo.data.chv.size_min.value; if (sdo.docp.tries_maximum.value) data->pin1.max_tries = *sdo.docp.tries_maximum.value; if (sdo.docp.tries_remaining.value) data->pin1.tries_left = *sdo.docp.tries_remaining.value; if (sdo.docp.size.value) { for (ii=0; iipin1.stored_length = ((data->pin1.stored_length) << 8) + *(sdo.docp.size.value + ii); } data->pin1.encoding = SC_PIN_ENCODING_ASCII; data->pin1.offset = 5; data->pin1.logged_in = SC_PIN_STATE_UNKNOWN; sc_log(ctx, ""PIN policy: size max/min %""SC_FORMAT_LEN_SIZE_T""u/%""SC_FORMAT_LEN_SIZE_T""u, tries max/left %i/%i"", data->pin1.max_length, data->pin1.min_length, data->pin1.max_tries, data->pin1.tries_left); iasecc_sdo_free_fields(card, &sdo); if (save_current_df) { sc_log(ctx, ""iasecc_pin_get_policy() restore current DF""); rv = iasecc_select_file(card, &save_current_df->path, NULL); LOG_TEST_GOTO_ERR(ctx, rv, ""Cannot return to saved DF""); } if (save_current_ef) { sc_log(ctx, ""iasecc_pin_get_policy() restore current EF""); rv = iasecc_select_file(card, &save_current_ef->path, NULL); LOG_TEST_GOTO_ERR(ctx, rv, ""Cannot return to saved EF""); } err: sc_file_free(save_current_df); sc_file_free(save_current_ef); LOG_FUNC_RETURN(ctx, rv); } ",0 "static char *legousbtower_devnode(struct device *dev, umode_t *mode) { return kasprintf(GFP_KERNEL, ""usb/%s"", dev_name(dev)); } ",0 "static int xmit_one(struct sk_buff *skb, struct net_device *dev, struct netdev_queue *txq, bool more) { unsigned int len; int rc; if (!list_empty(&ptype_all) || !list_empty(&dev->ptype_all)) dev_queue_xmit_nit(skb, dev); len = skb->len; trace_net_dev_start_xmit(skb, dev); rc = netdev_start_xmit(skb, dev, txq, more); trace_net_dev_xmit(skb, rc, dev, len); return rc; } ",0 "static struct cipso_v4_doi *cipso_v4_doi_search(u32 doi) { struct cipso_v4_doi *iter; list_for_each_entry_rcu(iter, &cipso_v4_doi_list, list) if (iter->doi == doi && atomic_read(&iter->refcount)) return iter; return NULL; } ",0 "static __init int adjust_vmx_controls(u32 ctl_min, u32 ctl_opt, u32 msr, u32 *result) { u32 vmx_msr_low, vmx_msr_high; u32 ctl = ctl_min | ctl_opt; rdmsr(msr, vmx_msr_low, vmx_msr_high); ctl &= vmx_msr_high; /* bit == 0 in high word ==> must be zero */ ctl |= vmx_msr_low; /* bit == 1 in low word ==> must be one */ /* Ensure minimum (required) set of control bits are supported. */ if (ctl_min & ~ctl) return -EIO; *result = ctl; return 0; } ",0 "error::Error GLES2DecoderImpl::HandleRequestExtensionCHROMIUM( uint32_t immediate_data_size, const volatile void* cmd_data) { const volatile gles2::cmds::RequestExtensionCHROMIUM& c = *static_cast( cmd_data); Bucket* bucket = GetBucket(c.bucket_id); if (!bucket || bucket->size() == 0) { return error::kInvalidArguments; } std::string feature_str; if (!bucket->GetAsString(&feature_str)) { return error::kInvalidArguments; } feature_str = feature_str + "" ""; bool desire_standard_derivatives = false; bool desire_frag_depth = false; bool desire_draw_buffers = false; bool desire_shader_texture_lod = false; if (feature_info_->context_type() == CONTEXT_TYPE_WEBGL1) { desire_standard_derivatives = feature_str.find(""GL_OES_standard_derivatives "") != std::string::npos; desire_frag_depth = feature_str.find(""GL_EXT_frag_depth "") != std::string::npos; desire_draw_buffers = feature_str.find(""GL_EXT_draw_buffers "") != std::string::npos; desire_shader_texture_lod = feature_str.find(""GL_EXT_shader_texture_lod "") != std::string::npos; } if (desire_standard_derivatives != derivatives_explicitly_enabled_ || desire_frag_depth != frag_depth_explicitly_enabled_ || desire_draw_buffers != draw_buffers_explicitly_enabled_ || desire_shader_texture_lod != shader_texture_lod_explicitly_enabled_) { derivatives_explicitly_enabled_ |= desire_standard_derivatives; frag_depth_explicitly_enabled_ |= desire_frag_depth; draw_buffers_explicitly_enabled_ |= desire_draw_buffers; shader_texture_lod_explicitly_enabled_ |= desire_shader_texture_lod; DestroyShaderTranslator(); } if (feature_str.find(""GL_CHROMIUM_color_buffer_float_rgba "") != std::string::npos) { feature_info_->EnableCHROMIUMColorBufferFloatRGBA(); } if (feature_str.find(""GL_CHROMIUM_color_buffer_float_rgb "") != std::string::npos) { feature_info_->EnableCHROMIUMColorBufferFloatRGB(); } if (feature_str.find(""GL_EXT_color_buffer_float "") != std::string::npos) { feature_info_->EnableEXTColorBufferFloat(); } if (feature_str.find(""GL_EXT_color_buffer_half_float "") != std::string::npos) { feature_info_->EnableEXTColorBufferHalfFloat(); } if (feature_str.find(""GL_OES_texture_float_linear "") != std::string::npos) { feature_info_->EnableOESTextureFloatLinear(); } if (feature_str.find(""GL_OES_texture_half_float_linear "") != std::string::npos) { feature_info_->EnableOESTextureHalfFloatLinear(); } UpdateCapabilities(); return error::kNoError; } ",0 "void V8Console::groupEndCallback(const v8::FunctionCallbackInfo& info) { ConsoleHelper(info).reportCallWithDefaultArgument(ConsoleAPIType::kEndGroup, String16(""console.groupEnd"")); } ",0 "qtdemux_inflate (void *z_buffer, int z_length, int length) { guint8 *buffer; z_stream *z; int ret; z = g_new0 (z_stream, 1); z->zalloc = qtdemux_zalloc; z->zfree = qtdemux_zfree; z->opaque = NULL; z->next_in = z_buffer; z->avail_in = z_length; buffer = (guint8 *) g_malloc (length); ret = inflateInit (z); while (z->avail_in > 0) { if (z->avail_out == 0) { length += 1024; buffer = (guint8 *) g_realloc (buffer, length); z->next_out = buffer + z->total_out; z->avail_out = 1024; } ret = inflate (z, Z_SYNC_FLUSH); if (ret != Z_OK) break; } if (ret != Z_STREAM_END) { g_warning (""inflate() returned %d"", ret); } g_free (z); return buffer; } ",0 "static int mem_cgroup_can_attach(struct cgroup_subsys *ss, struct cgroup *cgroup, struct cgroup_taskset *tset) { return 0; } ",0 "static int pegasus_probe(struct usb_interface *intf, const struct usb_device_id *id) { struct usb_device *dev = interface_to_usbdev(intf); struct net_device *net; pegasus_t *pegasus; int dev_index = id - pegasus_ids; int res = -ENOMEM; if (pegasus_blacklisted(dev)) return -ENODEV; if (pegasus_count == 0) { pegasus_workqueue = alloc_workqueue(""pegasus"", WQ_MEM_RECLAIM, 0); if (!pegasus_workqueue) return -ENOMEM; } pegasus_count++; net = alloc_etherdev(sizeof(struct pegasus)); if (!net) goto out; pegasus = netdev_priv(net); pegasus->dev_index = dev_index; res = alloc_urbs(pegasus); if (res < 0) { dev_err(&intf->dev, ""can't allocate %s\n"", ""urbs""); goto out1; } tasklet_init(&pegasus->rx_tl, rx_fixup, (unsigned long) pegasus); INIT_DELAYED_WORK(&pegasus->carrier_check, check_carrier); pegasus->intf = intf; pegasus->usb = dev; pegasus->net = net; net->watchdog_timeo = PEGASUS_TX_TIMEOUT; net->netdev_ops = &pegasus_netdev_ops; net->ethtool_ops = &ops; pegasus->mii.dev = net; pegasus->mii.mdio_read = mdio_read; pegasus->mii.mdio_write = mdio_write; pegasus->mii.phy_id_mask = 0x1f; pegasus->mii.reg_num_mask = 0x1f; pegasus->msg_enable = netif_msg_init(msg_level, NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK); pegasus->features = usb_dev_id[dev_index].private; get_interrupt_interval(pegasus); if (reset_mac(pegasus)) { dev_err(&intf->dev, ""can't reset MAC\n""); res = -EIO; goto out2; } set_ethernet_addr(pegasus); if (pegasus->features & PEGASUS_II) { dev_info(&intf->dev, ""setup Pegasus II specific registers\n""); setup_pegasus_II(pegasus); } pegasus->phy = mii_phy_probe(pegasus); if (pegasus->phy == 0xff) { dev_warn(&intf->dev, ""can't locate MII phy, using default\n""); pegasus->phy = 1; } pegasus->mii.phy_id = pegasus->phy; usb_set_intfdata(intf, pegasus); SET_NETDEV_DEV(net, &intf->dev); pegasus_reset_wol(net); res = register_netdev(net); if (res) goto out3; queue_delayed_work(pegasus_workqueue, &pegasus->carrier_check, CARRIER_CHECK_DELAY); dev_info(&intf->dev, ""%s, %s, %pM\n"", net->name, usb_dev_id[dev_index].name, net->dev_addr); return 0; out3: usb_set_intfdata(intf, NULL); out2: free_all_urbs(pegasus); out1: free_netdev(net); out: pegasus_dec_workqueue(); return res; } ",0 " StrongWeakPair(WTF::HashTableDeletedValueType) : Base(WTF::kHashTableDeletedValue, nullptr) {} ",0 "int vp8_create_decoder_instances(struct frame_buffers *fb, VP8D_CONFIG *oxcf) { if(!fb->use_frame_threads) { /* decoder instance for single thread mode */ fb->pbi[0] = create_decompressor(oxcf); if(!fb->pbi[0]) return VPX_CODEC_ERROR; #if CONFIG_MULTITHREAD /* enable row-based threading only when use_frame_threads * is disabled */ fb->pbi[0]->max_threads = oxcf->max_threads; vp8_decoder_create_threads(fb->pbi[0]); #endif } else { /* TODO : create frame threads and decoder instances for each * thread here */ } return VPX_CODEC_OK; } ",0 "static struct fuse_req *get_reserved_req(struct fuse_conn *fc, struct file *file) { struct fuse_req *req = NULL; struct fuse_file *ff = file->private_data; do { wait_event(fc->reserved_req_waitq, ff->reserved_req); spin_lock(&fc->lock); if (ff->reserved_req) { req = ff->reserved_req; ff->reserved_req = NULL; get_file(file); req->stolen_file = file; } spin_unlock(&fc->lock); } while (!req); return req; } ",0 "static char *xmlrpc_method(char *buffer) { char *data, *p, *name; int namelen; data = strstr(buffer, """"); if (data) { data += 12; p = strchr(data, '<'); if (p == NULL) return NULL; namelen = p - data; name = smalloc(namelen + 1); memcpy(name, data, namelen); name[namelen] = '\0'; return name; } return NULL; } ",0 "MagickExport MagickBooleanType SetQuantumDepth(const Image *image, QuantumInfo *quantum_info,const size_t depth) { size_t extent, quantum; /* Allocate the quantum pixel buffer. */ assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"",image->filename); assert(quantum_info != (QuantumInfo *) NULL); assert(quantum_info->signature == MagickCoreSignature); quantum_info->depth=depth; if (quantum_info->format == FloatingPointQuantumFormat) { if (quantum_info->depth > 32) quantum_info->depth=64; else if (quantum_info->depth > 16) quantum_info->depth=32; else quantum_info->depth=16; } if (quantum_info->pixels != (unsigned char **) NULL) DestroyQuantumPixels(quantum_info); quantum=(quantum_info->pad+6)*(quantum_info->depth+7)/8; extent=MagickMax(image->columns,image->rows)*quantum; if ((MagickMax(image->columns,image->rows) != 0) && (quantum != (extent/MagickMax(image->columns,image->rows)))) return(MagickFalse); return(AcquireQuantumPixels(quantum_info,extent)); } ",0 " explicit TitleView(PaletteTray* palette_tray) : palette_tray_(palette_tray) { auto& rb = ui::ResourceBundle::GetSharedInstance(); auto* box_layout = new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0); SetLayoutManager(box_layout); SetBorder(views::Border::CreateEmptyBorder( 0, ash::kTrayPopupPaddingHorizontal, 0, 0)); views::Label* text_label = new views::Label(l10n_util::GetStringUTF16(IDS_ASH_PALETTE_TITLE)); text_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); text_label->SetFontList(rb.GetFontList(ui::ResourceBundle::BoldFont)); AddChildView(text_label); box_layout->SetFlexForView(text_label, 1); help_button_ = new ash::TrayPopupHeaderButton(this, IDR_AURA_UBER_TRAY_HELP, IDS_ASH_STATUS_TRAY_HELP); help_button_->SetTooltipText( l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_SHUTDOWN)); AddChildView(help_button_); AddChildView(CreateSeparator(views::Separator::VERTICAL)); settings_button_ = new ash::TrayPopupHeaderButton( this, IDR_AURA_UBER_TRAY_SETTINGS, IDS_ASH_STATUS_TRAY_SETTINGS); settings_button_->SetTooltipText( l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_SETTINGS)); AddChildView(settings_button_); } ",0 "void DataReductionProxyIOData::SetCustomProxyConfigClient( network::mojom::CustomProxyConfigClientPtrInfo config_client_info) { proxy_config_client_.Bind(std::move(config_client_info)); UpdateCustomProxyConfig(); } ",0 "int ocfs2_update_inode_atime(struct inode *inode, struct buffer_head *bh) { int ret; struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); handle_t *handle; struct ocfs2_dinode *di = (struct ocfs2_dinode *) bh->b_data; handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); if (IS_ERR(handle)) { ret = PTR_ERR(handle); mlog_errno(ret); goto out; } ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode), bh, OCFS2_JOURNAL_ACCESS_WRITE); if (ret) { mlog_errno(ret); goto out_commit; } /* * Don't use ocfs2_mark_inode_dirty() here as we don't always * have i_mutex to guard against concurrent changes to other * inode fields. */ inode->i_atime = current_time(inode); di->i_atime = cpu_to_le64(inode->i_atime.tv_sec); di->i_atime_nsec = cpu_to_le32(inode->i_atime.tv_nsec); ocfs2_update_inode_fsync_trans(handle, inode, 0); ocfs2_journal_dirty(handle, bh); out_commit: ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle); out: return ret; } ",0 " void ExpectUpgrade(const char* input, WebURLRequest::RequestContext request_context, WebURLRequest::FrameType frame_type, const char* expected) { KURL input_url(kParsedURLString, input); KURL expected_url(kParsedURLString, expected); ResourceRequest resource_request(input_url); resource_request.SetRequestContext(request_context); resource_request.SetFrameType(frame_type); fetch_context->ModifyRequestForCSP(resource_request); EXPECT_EQ(expected_url.GetString(), resource_request.Url().GetString()); EXPECT_EQ(expected_url.Protocol(), resource_request.Url().Protocol()); EXPECT_EQ(expected_url.Host(), resource_request.Url().Host()); EXPECT_EQ(expected_url.Port(), resource_request.Url().Port()); EXPECT_EQ(expected_url.HasPort(), resource_request.Url().HasPort()); EXPECT_EQ(expected_url.GetPath(), resource_request.Url().GetPath()); } ",0 "static void arrayBufferViewMethodMethodCallback(const v8::FunctionCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMMethod""); TestObjectPythonV8Internal::arrayBufferViewMethodMethod(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "RenderProcessHost* WebBluetoothServiceImpl::GetRenderProcessHost() { return render_frame_host_->GetProcess(); } ",0 "netlink_previous_frame(const struct netlink_ring *ring, enum nl_mmap_status status) { unsigned int prev; prev = ring->head ? ring->head - 1 : ring->frame_max; return netlink_lookup_frame(ring, prev, status); } ",0 "smb_ofile_seek( smb_ofile_t *of, ushort_t mode, int32_t off, uint32_t *retoff) { u_offset_t newoff = 0; int rc = 0; smb_attr_t attr; ASSERT(of); ASSERT(of->f_magic == SMB_OFILE_MAGIC); ASSERT(of->f_refcnt); mutex_enter(&of->f_mutex); switch (mode) { case SMB_SEEK_SET: if (off < 0) newoff = 0; else newoff = (u_offset_t)off; break; case SMB_SEEK_CUR: if (off < 0 && (-off) > of->f_seek_pos) newoff = 0; else newoff = of->f_seek_pos + (u_offset_t)off; break; case SMB_SEEK_END: bzero(&attr, sizeof (smb_attr_t)); attr.sa_mask |= SMB_AT_SIZE; rc = smb_fsop_getattr(NULL, zone_kcred(), of->f_node, &attr); if (rc != 0) { mutex_exit(&of->f_mutex); return (rc); } if (off < 0 && (-off) > attr.sa_vattr.va_size) newoff = 0; else newoff = attr.sa_vattr.va_size + (u_offset_t)off; break; default: mutex_exit(&of->f_mutex); return (EINVAL); } /* * See comments at the beginning of smb_seek.c. * If the offset is greater than UINT_MAX, we will return an error. */ if (newoff > UINT_MAX) { rc = EOVERFLOW; } else { of->f_seek_pos = newoff; *retoff = (uint32_t)newoff; } mutex_exit(&of->f_mutex); return (rc); } ",0 "static unsigned swaps_poll(struct file *file, poll_table *wait) { struct seq_file *seq = file->private_data; poll_wait(file, &proc_poll_wait, wait); if (seq->poll_event != atomic_read(&proc_poll_event)) { seq->poll_event = atomic_read(&proc_poll_event); return POLLIN | POLLRDNORM | POLLERR | POLLPRI; } return POLLIN | POLLRDNORM; } ",0 "static size_t phar_dir_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC) /* {{{ */ { return 0; } /* }}} */ ",0 "GF_Err clap_dump(GF_Box *a, FILE * trace) { GF_CleanAppertureBox *ptr = (GF_CleanAppertureBox*)a; gf_isom_box_dump_start(a, ""CleanAppertureBox"", trace); fprintf(trace, ""cleanApertureWidthN=\""%d\"" cleanApertureWidthD=\""%d\"" "", ptr->cleanApertureWidthN, ptr->cleanApertureWidthD); fprintf(trace, ""cleanApertureHeightN=\""%d\"" cleanApertureHeightD=\""%d\"" "", ptr->cleanApertureHeightN, ptr->cleanApertureHeightD); fprintf(trace, ""horizOffN=\""%d\"" horizOffD=\""%d\"" "", ptr->horizOffN, ptr->horizOffD); fprintf(trace, ""vertOffN=\""%d\"" vertOffD=\""%d\"""", ptr->vertOffN, ptr->vertOffD); fprintf(trace, "">\n""); gf_isom_box_dump_done(""CleanAppertureBox"", a, trace); return GF_OK; } ",0 "ikev1_attrmap_print(netdissect_options *ndo, const u_char *p, const u_char *ep, const struct attrmap *map, size_t nmap) { int totlen; uint32_t t, v; if (p[0] & 0x80) totlen = 4; else totlen = 4 + EXTRACT_16BITS(&p[2]); if (ep < p + totlen) { ND_PRINT((ndo,""[|attr]"")); return ep + 1; } ND_PRINT((ndo,""("")); t = EXTRACT_16BITS(&p[0]) & 0x7fff; if (map && t < nmap && map[t].type) ND_PRINT((ndo,""type=%s "", map[t].type)); else ND_PRINT((ndo,""type=#%d "", t)); if (p[0] & 0x80) { ND_PRINT((ndo,""value="")); v = EXTRACT_16BITS(&p[2]); if (map && t < nmap && v < map[t].nvalue && map[t].value[v]) ND_PRINT((ndo,""%s"", map[t].value[v])); else rawprint(ndo, (const uint8_t *)&p[2], 2); } else { ND_PRINT((ndo,""len=%d value="", EXTRACT_16BITS(&p[2]))); rawprint(ndo, (const uint8_t *)&p[4], EXTRACT_16BITS(&p[2])); } ND_PRINT((ndo,"")"")); return p + totlen; } ",0 "ShellSurface::ScopedAnimationsDisabled::~ScopedAnimationsDisabled() { if (shell_surface_->widget_) { aura::Window* window = shell_surface_->widget_->GetNativeWindow(); DCHECK_EQ(window->GetProperty(aura::client::kAnimationsDisabledKey), true); window->SetProperty(aura::client::kAnimationsDisabledKey, saved_animations_disabled_); } } ",0 "void InterstitialPageImpl::UnderlyingContentObserver::WebContentsDestroyed() { interstitial_->OnNavigatingAwayOrTabClosing(); } ",0 "bool LayerWebKitThread::startAnimations(double time) { bool didStartAnimations = false; for (size_t i = 0; i < m_runningAnimations.size(); ++i) { if (!m_runningAnimations[i]->startTime()) { m_runningAnimations[i]->setStartTime(time); m_didStartAnimations = didStartAnimations = true; } } size_t listSize = m_sublayers.size(); for (size_t i = 0; i < listSize; ++i) didStartAnimations |= m_sublayers[i]->startAnimations(time); listSize = m_overlays.size(); for (size_t i = 0; i < listSize; ++i) didStartAnimations |= m_overlays[i]->startAnimations(time); return didStartAnimations; } ",0 "static void _6502_anal_esil_get_addr_pattern3(RAnalOp *op, const ut8* data, char* addrbuf, int addrsize, char reg) { switch (data[0] & 0x1f) { // 0x1f = b00111111 case 0x00: // op #$ff op->cycles = 2; snprintf (addrbuf, addrsize, ""0x%02x"", data[1]); break; case 0x08: //op a op->cycles = 2; snprintf (addrbuf, addrsize, ""a""); break; case 0x04: // op $ff op->cycles = 5; snprintf (addrbuf, addrsize, ""0x%02x"", data[1]); break; case 0x14: // op $ff,x op->cycles = 6; snprintf (addrbuf, addrsize, ""%c,0x%02x,+"", reg, data[1]); break; case 0x0c: // op $ffff op->cycles = 6; snprintf (addrbuf, addrsize, ""0x%04x"", data[1] | data[2] << 8); break; case 0x1c: // op $ffff,x op->cycles = 7; snprintf (addrbuf, addrsize, ""%c,0x%04x,+"", reg, data[1] | data[2] << 8); break; } } ",0 "_cancel_step_mem_limit(uint32_t job_id, uint32_t step_id) { slurm_msg_t msg; job_notify_msg_t notify_req; job_step_kill_msg_t kill_req; /* NOTE: Batch jobs may have no srun to get this message */ slurm_msg_t_init(&msg); notify_req.job_id = job_id; notify_req.job_step_id = step_id; notify_req.message = ""Exceeded job memory limit""; msg.msg_type = REQUEST_JOB_NOTIFY; msg.data = ¬ify_req; slurm_send_only_controller_msg(&msg); memset(&kill_req, 0, sizeof(job_step_kill_msg_t)); kill_req.job_id = job_id; kill_req.job_step_id = step_id; kill_req.signal = SIGKILL; kill_req.flags = (uint16_t) 0; msg.msg_type = REQUEST_CANCEL_JOB_STEP; msg.data = &kill_req; slurm_send_only_controller_msg(&msg); } ",0 "static int decode_opaque_fixed(struct xdr_stream *xdr, void *buf, size_t len) { __be32 *p; p = xdr_inline_decode(xdr, len); if (likely(p)) { memcpy(buf, p, len); return 0; } print_overflow_msg(__func__, xdr); return -EIO; } ",0 "static int __ap_poll_device(struct ap_device *ap_dev, unsigned long *flags) { if (!ap_dev->unregistered) { if (ap_poll_queue(ap_dev, flags)) ap_dev->unregistered = 1; if (ap_dev->reset == AP_RESET_DO) ap_reset(ap_dev); } return 0; } ",0 "iasecc_decipher(struct sc_card *card, const unsigned char *in, size_t in_len, unsigned char *out, size_t out_len) { struct sc_context *ctx = card->ctx; struct sc_apdu apdu; unsigned char sbuf[0x200]; unsigned char resp[SC_MAX_APDU_BUFFER_SIZE]; size_t offs; int rv; LOG_FUNC_CALLED(ctx); sc_log(card->ctx, ""crgram_len %""SC_FORMAT_LEN_SIZE_T""u; outlen %""SC_FORMAT_LEN_SIZE_T""u"", in_len, out_len); if (!out || !out_len || in_len > SC_MAX_APDU_BUFFER_SIZE) LOG_FUNC_RETURN(ctx, SC_ERROR_INVALID_ARGUMENTS); offs = 0; sbuf[offs++] = 0x81; memcpy(sbuf + offs, in, in_len); offs += in_len; sc_format_apdu(card, &apdu, SC_APDU_CASE_4_SHORT, 0x2A, 0x80, 0x86); apdu.flags |= SC_APDU_FLAGS_CHAINING; apdu.data = sbuf; apdu.datalen = offs; apdu.lc = offs; apdu.resp = resp; apdu.resplen = sizeof(resp); apdu.le = 256; rv = sc_transmit_apdu(card, &apdu); LOG_TEST_RET(ctx, rv, ""APDU transmit failed""); rv = sc_check_sw(card, apdu.sw1, apdu.sw2); LOG_TEST_RET(ctx, rv, ""Card returned error""); if (out_len > apdu.resplen) out_len = apdu.resplen; memcpy(out, apdu.resp, out_len); rv = out_len; LOG_FUNC_RETURN(ctx, rv); } ",0 "int vrend_create_vertex_elements_state(struct vrend_context *ctx, uint32_t handle, unsigned num_elements, const struct pipe_vertex_element *elements) { struct vrend_vertex_element_array *v = CALLOC_STRUCT(vrend_vertex_element_array); const struct util_format_description *desc; GLenum type; int i; uint32_t ret_handle; if (!v) return ENOMEM; if (num_elements > PIPE_MAX_ATTRIBS) return EINVAL; v->count = num_elements; for (i = 0; i < num_elements; i++) { memcpy(&v->elements[i].base, &elements[i], sizeof(struct pipe_vertex_element)); desc = util_format_description(elements[i].src_format); if (!desc) { FREE(v); return EINVAL; } type = GL_FALSE; if (desc->channel[0].type == UTIL_FORMAT_TYPE_FLOAT) { if (desc->channel[0].size == 32) type = GL_FLOAT; else if (desc->channel[0].size == 64) type = GL_DOUBLE; else if (desc->channel[0].size == 16) type = GL_HALF_FLOAT; } else if (desc->channel[0].type == UTIL_FORMAT_TYPE_UNSIGNED && desc->channel[0].size == 8) type = GL_UNSIGNED_BYTE; else if (desc->channel[0].type == UTIL_FORMAT_TYPE_SIGNED && desc->channel[0].size == 8) type = GL_BYTE; else if (desc->channel[0].type == UTIL_FORMAT_TYPE_UNSIGNED && desc->channel[0].size == 16) type = GL_UNSIGNED_SHORT; else if (desc->channel[0].type == UTIL_FORMAT_TYPE_SIGNED && desc->channel[0].size == 16) type = GL_SHORT; else if (desc->channel[0].type == UTIL_FORMAT_TYPE_UNSIGNED && desc->channel[0].size == 32) type = GL_UNSIGNED_INT; else if (desc->channel[0].type == UTIL_FORMAT_TYPE_SIGNED && desc->channel[0].size == 32) type = GL_INT; else if (elements[i].src_format == PIPE_FORMAT_R10G10B10A2_SSCALED || elements[i].src_format == PIPE_FORMAT_R10G10B10A2_SNORM || elements[i].src_format == PIPE_FORMAT_B10G10R10A2_SNORM) type = GL_INT_2_10_10_10_REV; else if (elements[i].src_format == PIPE_FORMAT_R10G10B10A2_USCALED || elements[i].src_format == PIPE_FORMAT_R10G10B10A2_UNORM || elements[i].src_format == PIPE_FORMAT_B10G10R10A2_UNORM) type = GL_UNSIGNED_INT_2_10_10_10_REV; else if (elements[i].src_format == PIPE_FORMAT_R11G11B10_FLOAT) type = GL_UNSIGNED_INT_10F_11F_11F_REV; if (type == GL_FALSE) { report_context_error(ctx, VIRGL_ERROR_CTX_ILLEGAL_VERTEX_FORMAT, elements[i].src_format); FREE(v); return EINVAL; } v->elements[i].type = type; if (desc->channel[0].normalized) v->elements[i].norm = GL_TRUE; if (desc->nr_channels == 4 && desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_Z) v->elements[i].nr_chan = GL_BGRA; else if (elements[i].src_format == PIPE_FORMAT_R11G11B10_FLOAT) v->elements[i].nr_chan = 3; else v->elements[i].nr_chan = desc->nr_channels; } if (vrend_state.have_vertex_attrib_binding) { glGenVertexArrays(1, &v->id); glBindVertexArray(v->id); for (i = 0; i < num_elements; i++) { struct vrend_vertex_element *ve = &v->elements[i]; if (util_format_is_pure_integer(ve->base.src_format)) glVertexAttribIFormat(i, ve->nr_chan, ve->type, ve->base.src_offset); else glVertexAttribFormat(i, ve->nr_chan, ve->type, ve->norm, ve->base.src_offset); glVertexAttribBinding(i, ve->base.vertex_buffer_index); glVertexBindingDivisor(i, ve->base.instance_divisor); glEnableVertexAttribArray(i); } } ret_handle = vrend_renderer_object_insert(ctx, v, sizeof(struct vrend_vertex_element), handle, VIRGL_OBJECT_VERTEX_ELEMENTS); if (!ret_handle) { FREE(v); return ENOMEM; } return 0; } ",0 "int crypto_aes_set_key(struct crypto_tfm *tfm, const u8 *in_key, unsigned int key_len) { struct crypto_aes_ctx *ctx = crypto_tfm_ctx(tfm); u32 *flags = &tfm->crt_flags; int ret; ret = crypto_aes_expand_key(ctx, in_key, key_len); if (!ret) return 0; *flags |= CRYPTO_TFM_RES_BAD_KEY_LEN; return -EINVAL; } ",0 "void MSG_ReadDeltaUsercmdKey( msg_t *msg, int key, usercmd_t *from, usercmd_t *to ) { if ( MSG_ReadBits( msg, 1 ) ) { to->serverTime = from->serverTime + MSG_ReadBits( msg, 8 ); } else { to->serverTime = MSG_ReadBits( msg, 32 ); } if ( MSG_ReadBits( msg, 1 ) ) { key ^= to->serverTime; to->angles[0] = MSG_ReadDeltaKey( msg, key, from->angles[0], 16); to->angles[1] = MSG_ReadDeltaKey( msg, key, from->angles[1], 16); to->angles[2] = MSG_ReadDeltaKey( msg, key, from->angles[2], 16); to->forwardmove = MSG_ReadDeltaKey( msg, key, from->forwardmove, 8); if( to->forwardmove == -128 ) to->forwardmove = -127; to->rightmove = MSG_ReadDeltaKey( msg, key, from->rightmove, 8); if( to->rightmove == -128 ) to->rightmove = -127; to->upmove = MSG_ReadDeltaKey( msg, key, from->upmove, 8); if( to->upmove == -128 ) to->upmove = -127; to->buttons = MSG_ReadDeltaKey( msg, key, from->buttons, 16); to->weapon = MSG_ReadDeltaKey( msg, key, from->weapon, 8); } else { to->angles[0] = from->angles[0]; to->angles[1] = from->angles[1]; to->angles[2] = from->angles[2]; to->forwardmove = from->forwardmove; to->rightmove = from->rightmove; to->upmove = from->upmove; to->buttons = from->buttons; to->weapon = from->weapon; } } ",0 "void WebGL2RenderingContextBase::DestroyContext() { WebGLRenderingContextBase::DestroyContext(); } ",0 "void RenderWidgetHostViewAura::OnCompositingEnded( ui::Compositor* compositor) { if (paint_observer_) paint_observer_->OnCompositingComplete(); } ",0 "static int migrate_degrades_locality(struct task_struct *p, struct lb_env *env) { struct numa_group *numa_group = rcu_dereference(p->numa_group); unsigned long src_weight, dst_weight; int src_nid, dst_nid, dist; if (!static_branch_likely(&sched_numa_balancing)) return -1; if (!p->numa_faults || !(env->sd->flags & SD_NUMA)) return -1; src_nid = cpu_to_node(env->src_cpu); dst_nid = cpu_to_node(env->dst_cpu); if (src_nid == dst_nid) return -1; /* Migrating away from the preferred node is always bad. */ if (src_nid == p->numa_preferred_nid) { if (env->src_rq->nr_running > env->src_rq->nr_preferred_running) return 1; else return -1; } /* Encourage migration to the preferred node. */ if (dst_nid == p->numa_preferred_nid) return 0; /* Leaving a core idle is often worse than degrading locality. */ if (env->idle == CPU_IDLE) return -1; dist = node_distance(src_nid, dst_nid); if (numa_group) { src_weight = group_weight(p, src_nid, dist); dst_weight = group_weight(p, dst_nid, dist); } else { src_weight = task_weight(p, src_nid, dist); dst_weight = task_weight(p, dst_nid, dist); } return dst_weight < src_weight; } ",0 "std::unique_ptr ResourceCoordinatorService::Create() { auto resource_coordinator_service = std::make_unique(); return resource_coordinator_service; } ",0 "run_selftests (int algo, int extended, selftest_report_func_t report) { gpg_err_code_t ec; (void)extended; switch (algo) { case GCRY_PK_RSA: ec = selftests_rsa (report); break; default: ec = GPG_ERR_PUBKEY_ALGO; break; } return ec; } ",0 "void PrintPreviewDataSource::Init() { AddLocalizedString(""title"", IDS_PRINT_PREVIEW_TITLE); AddLocalizedString(""loading"", IDS_PRINT_PREVIEW_LOADING); AddLocalizedString(""noPlugin"", IDS_PRINT_PREVIEW_NO_PLUGIN); AddLocalizedString(""launchNativeDialog"", IDS_PRINT_PREVIEW_NATIVE_DIALOG); AddLocalizedString(""previewFailed"", IDS_PRINT_PREVIEW_FAILED); AddLocalizedString(""invalidPrinterSettings"", IDS_PRINT_PREVIEW_INVALID_PRINTER_SETTINGS); AddLocalizedString(""printButton"", IDS_PRINT_PREVIEW_PRINT_BUTTON); AddLocalizedString(""saveButton"", IDS_PRINT_PREVIEW_SAVE_BUTTON); AddLocalizedString(""cancelButton"", IDS_PRINT_PREVIEW_CANCEL_BUTTON); AddLocalizedString(""printing"", IDS_PRINT_PREVIEW_PRINTING); AddLocalizedString(""printingToPDFInProgress"", IDS_PRINT_PREVIEW_PRINTING_TO_PDF_IN_PROGRESS); #if defined(OS_MACOSX) AddLocalizedString(""openingPDFInPreview"", IDS_PRINT_PREVIEW_OPENING_PDF_IN_PREVIEW); #endif AddLocalizedString(""destinationLabel"", IDS_PRINT_PREVIEW_DESTINATION_LABEL); AddLocalizedString(""copiesLabel"", IDS_PRINT_PREVIEW_COPIES_LABEL); AddLocalizedString(""examplePageRangeText"", IDS_PRINT_PREVIEW_EXAMPLE_PAGE_RANGE_TEXT); AddLocalizedString(""layoutLabel"", IDS_PRINT_PREVIEW_LAYOUT_LABEL); AddLocalizedString(""optionAllPages"", IDS_PRINT_PREVIEW_OPTION_ALL_PAGES); AddLocalizedString(""optionBw"", IDS_PRINT_PREVIEW_OPTION_BW); AddLocalizedString(""optionCollate"", IDS_PRINT_PREVIEW_OPTION_COLLATE); AddLocalizedString(""optionColor"", IDS_PRINT_PREVIEW_OPTION_COLOR); AddLocalizedString(""optionLandscape"", IDS_PRINT_PREVIEW_OPTION_LANDSCAPE); AddLocalizedString(""optionPortrait"", IDS_PRINT_PREVIEW_OPTION_PORTRAIT); AddLocalizedString(""optionTwoSided"", IDS_PRINT_PREVIEW_OPTION_TWO_SIDED); AddLocalizedString(""pagesLabel"", IDS_PRINT_PREVIEW_PAGES_LABEL); AddLocalizedString(""pageRangeTextBox"", IDS_PRINT_PREVIEW_PAGE_RANGE_TEXT); AddLocalizedString(""pageRangeRadio"", IDS_PRINT_PREVIEW_PAGE_RANGE_RADIO); AddLocalizedString(""printToPDF"", IDS_PRINT_PREVIEW_PRINT_TO_PDF); AddLocalizedString(""printPreviewTitleFormat"", IDS_PRINT_PREVIEW_TITLE_FORMAT); AddLocalizedString(""printPreviewSummaryFormatShort"", IDS_PRINT_PREVIEW_SUMMARY_FORMAT_SHORT); AddLocalizedString(""printPreviewSummaryFormatLong"", IDS_PRINT_PREVIEW_SUMMARY_FORMAT_LONG); AddLocalizedString(""printPreviewSheetsLabelSingular"", IDS_PRINT_PREVIEW_SHEETS_LABEL_SINGULAR); AddLocalizedString(""printPreviewSheetsLabelPlural"", IDS_PRINT_PREVIEW_SHEETS_LABEL_PLURAL); AddLocalizedString(""printPreviewPageLabelSingular"", IDS_PRINT_PREVIEW_PAGE_LABEL_SINGULAR); AddLocalizedString(""printPreviewPageLabelPlural"", IDS_PRINT_PREVIEW_PAGE_LABEL_PLURAL); const string16 shortcut_text(UTF8ToUTF16(kAdvancedPrintShortcut)); #if defined(OS_CHROMEOS) AddString(""cloudPrintDialogOption"", l10n_util::GetStringFUTF16( IDS_PRINT_PREVIEW_CLOUD_DIALOG_OPTION, l10n_util::GetStringUTF16(IDS_GOOGLE_CLOUD_PRINT), shortcut_text)); AddLocalizedString(""printWithCloudPrint"", IDS_PRINT_PREVIEW_MORE_PRINTERS); #else AddString(""systemDialogOption"", l10n_util::GetStringFUTF16( IDS_PRINT_PREVIEW_SYSTEM_DIALOG_OPTION, shortcut_text)); AddString(""printWithCloudPrint"", l10n_util::GetStringFUTF16( IDS_PRINT_PREVIEW_PRINT_WITH_CLOUD_PRINT, l10n_util::GetStringUTF16(IDS_GOOGLE_CLOUD_PRINT))); #endif #if defined(OS_MACOSX) AddLocalizedString(""openPdfInPreviewOption"", IDS_PRINT_PREVIEW_OPEN_PDF_IN_PREVIEW_APP); #endif AddString(""printWithCloudPrintWait"", l10n_util::GetStringFUTF16( IDS_PRINT_PREVIEW_PRINT_WITH_CLOUD_PRINT_WAIT, l10n_util::GetStringUTF16(IDS_GOOGLE_CLOUD_PRINT))); AddLocalizedString(""pageRangeInstruction"", IDS_PRINT_PREVIEW_PAGE_RANGE_INSTRUCTION); AddLocalizedString(""copiesInstruction"", IDS_PRINT_PREVIEW_COPIES_INSTRUCTION); AddLocalizedString(""signIn"", IDS_PRINT_PREVIEW_SIGN_IN); AddLocalizedString(""managePrinters"", IDS_PRINT_PREVIEW_MANAGE_PRINTERS); AddLocalizedString(""incrementTitle"", IDS_PRINT_PREVIEW_INCREMENT_TITLE); AddLocalizedString(""decrementTitle"", IDS_PRINT_PREVIEW_DECREMENT_TITLE); AddLocalizedString(""printPagesLabel"", IDS_PRINT_PREVIEW_PRINT_PAGES_LABEL); AddLocalizedString(""optionsLabel"", IDS_PRINT_PREVIEW_OPTIONS_LABEL); AddLocalizedString(""optionHeaderFooter"", IDS_PRINT_PREVIEW_OPTION_HEADER_FOOTER); AddLocalizedString(""marginsLabel"", IDS_PRINT_PREVIEW_MARGINS_LABEL); AddLocalizedString(""defaultMargins"", IDS_PRINT_PREVIEW_DEFAULT_MARGINS); AddLocalizedString(""noMargins"", IDS_PRINT_PREVIEW_NO_MARGINS); AddLocalizedString(""customMargins"", IDS_PRINT_PREVIEW_CUSTOM_MARGINS); AddLocalizedString(""minimumMargins"", IDS_PRINT_PREVIEW_MINIMUM_MARGINS); AddLocalizedString(""top"", IDS_PRINT_PREVIEW_TOP_MARGIN_LABEL); AddLocalizedString(""bottom"", IDS_PRINT_PREVIEW_BOTTOM_MARGIN_LABEL); AddLocalizedString(""left"", IDS_PRINT_PREVIEW_LEFT_MARGIN_LABEL); AddLocalizedString(""right"", IDS_PRINT_PREVIEW_RIGHT_MARGIN_LABEL); set_json_path(""strings.js""); add_resource_path(""print_preview.js"", IDR_PRINT_PREVIEW_JS); set_default_resource(IDR_PRINT_PREVIEW_HTML); } ",1 "void RenderFrameDevToolsAgentHost::OnNavigationResponseReceived( const NavigationRequest& nav_request, const network::ResourceResponse& response) { FrameTreeNode* ftn = nav_request.frame_tree_node(); std::string id = nav_request.devtools_navigation_token().ToString(); std::string frame_id = ftn->devtools_frame_token().ToString(); GURL url = nav_request.common_params().url; DispatchToAgents(ftn, &protocol::NetworkHandler::ResponseReceived, id, id, url, protocol::Network::ResourceTypeEnum::Document, response.head, frame_id); } ",0 "static void computeInlineStaticDistance(Length& logicalLeft, Length& logicalRight, const RenderBox* child, const RenderBoxModelObject* containerBlock, LayoutUnit containerLogicalWidth) { if (!logicalLeft.isAuto() || !logicalRight.isAuto()) return; if (child->parent()->style()->direction() == LTR) { LayoutUnit staticPosition = child->layer()->staticInlinePosition() - containerBlock->borderLogicalLeft(); for (RenderObject* curr = child->parent(); curr && curr != containerBlock; curr = curr->container()) { if (curr->isBox()) { staticPosition += toRenderBox(curr)->logicalLeft(); if (toRenderBox(curr)->isRelPositioned()) staticPosition += toRenderBox(curr)->relativePositionOffset().width(); } else if (curr->isInline()) { if (curr->isRelPositioned()) { if (!curr->style()->logicalLeft().isAuto()) staticPosition += curr->style()->logicalLeft().value(); else staticPosition -= curr->style()->logicalRight().value(); } } } logicalLeft.setValue(Fixed, staticPosition); } else { RenderBox* enclosingBox = child->parent()->enclosingBox(); LayoutUnit staticPosition = child->layer()->staticInlinePosition() + containerLogicalWidth + containerBlock->borderLogicalLeft(); for (RenderObject* curr = child->parent(); curr; curr = curr->container()) { if (curr->isBox()) { if (curr != containerBlock) { staticPosition -= toRenderBox(curr)->logicalLeft(); if (toRenderBox(curr)->isRelPositioned()) staticPosition -= toRenderBox(curr)->relativePositionOffset().width(); } if (curr == enclosingBox) staticPosition -= enclosingBox->logicalWidth(); } else if (curr->isInline()) { if (curr->isRelPositioned()) { if (!curr->style()->logicalLeft().isAuto()) staticPosition -= curr->style()->logicalLeft().value(); else staticPosition += curr->style()->logicalRight().value(); } } if (curr == containerBlock) break; } logicalRight.setValue(Fixed, staticPosition); } } ",0 "ExtensionApiTest::~ExtensionApiTest() {} ",0 "static struct mm_struct *__check_mem_permission(struct task_struct *task) { struct mm_struct *mm; mm = get_task_mm(task); if (!mm) return ERR_PTR(-EINVAL); /* * A task can always look at itself, in case it chooses * to use system calls instead of load instructions. */ if (task == current) return mm; /* * If current is actively ptrace'ing, and would also be * permitted to freshly attach with ptrace now, permit it. */ if (task_is_stopped_or_traced(task)) { int match; rcu_read_lock(); match = (tracehook_tracer_task(task) == current); rcu_read_unlock(); if (match && ptrace_may_access(task, PTRACE_MODE_ATTACH)) return mm; } /* * No one else is allowed. */ mmput(mm); return ERR_PTR(-EPERM); } ",0 "void V8DOMWrapper::setJSWrapperForActiveDOMObject(void* object, v8::Persistent wrapper) { ASSERT(V8DOMWrapper::maybeDOMWrapper(wrapper)); #ifndef NDEBUG V8ClassIndex::V8WrapperType type = V8DOMWrapper::domWrapperType(wrapper); switch (type) { #define MAKE_CASE(TYPE, NAME) case V8ClassIndex::TYPE: break; ACTIVE_DOM_OBJECT_TYPES(MAKE_CASE) default: ASSERT_NOT_REACHED(); #undef MAKE_CASE } #endif getActiveDOMObjectMap().set(object, wrapper); } ",0 "void BaseRenderingContext2D::setStrokeStyle( const StringOrCanvasGradientOrCanvasPattern& style) { DCHECK(!style.IsNull()); String color_string; CanvasStyle* canvas_style = nullptr; if (style.IsString()) { color_string = style.GetAsString(); if (color_string == GetState().UnparsedStrokeColor()) return; Color parsed_color = 0; if (!ParseColorOrCurrentColor(parsed_color, color_string)) return; if (GetState().StrokeStyle()->IsEquivalentRGBA(parsed_color.Rgb())) { ModifiableState().SetUnparsedStrokeColor(color_string); return; } canvas_style = CanvasStyle::CreateFromRGBA(parsed_color.Rgb()); } else if (style.IsCanvasGradient()) { canvas_style = CanvasStyle::CreateFromGradient(style.GetAsCanvasGradient()); } else if (style.IsCanvasPattern()) { CanvasPattern* canvas_pattern = style.GetAsCanvasPattern(); if (OriginClean() && !canvas_pattern->OriginClean()) { SetOriginTainted(); ClearResolvedFilters(); } canvas_style = CanvasStyle::CreateFromPattern(canvas_pattern); } DCHECK(canvas_style); ModifiableState().SetStrokeStyle(canvas_style); ModifiableState().SetUnparsedStrokeColor(color_string); ModifiableState().ClearResolvedFilter(); } ",1 "FormControlState BaseMultipleFieldsDateAndTimeInputType::saveFormControlState() const { if (DateTimeEditElement* edit = dateTimeEditElement()) return edit->valueAsDateTimeFieldsState().saveFormControlState(); return FormControlState(); } ",0 "static inline void ModulateHWB(const double percent_hue, const double percent_whiteness,const double percent_blackness,double *red, double *green,double *blue) { double blackness, hue, whiteness; /* Increase or decrease color blackness, whiteness, or hue. */ ConvertRGBToHWB(*red,*green,*blue,&hue,&whiteness,&blackness); hue+=0.5*(0.01*percent_hue-1.0); while (hue < 0.0) hue+=1.0; while (hue >= 1.0) hue-=1.0; blackness*=0.01*percent_blackness; whiteness*=0.01*percent_whiteness; ConvertHWBToRGB(hue,whiteness,blackness,red,green,blue); } ",0 "static void removeEventListenerMethodCallback(const v8::FunctionCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMMethod""); TestObjectPythonV8Internal::removeEventListenerMethod(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "bool WebContext::isInitialized() const { return IsInitialized(); } ",0 "perform_one_test(FILE *fp, int argc, const char **argv, png_uint_32 *default_flags, display *d, int set_callback) { int def; png_uint_32 flags[2][4]; rewind(fp); clear_keep(); memcpy(flags[0], default_flags, sizeof flags[0]); def = check(fp, argc, argv, flags[1], d, set_callback); /* Chunks should either be known or unknown, never both and this should apply * whether the chunk is before or after the IDAT (actually, the app can * probably change this by swapping the handling after the image, but this * test does not do that.) */ check_error(d, (flags[0][0]|flags[0][2]) & (flags[0][1]|flags[0][3]), ""chunk handled inconsistently in count tests""); check_error(d, (flags[1][0]|flags[1][2]) & (flags[1][1]|flags[1][3]), ""chunk handled inconsistently in option tests""); /* Now find out what happened to each chunk before and after the IDAT and * determine if the behavior was correct. First some basic sanity checks, * any known chunk should be known in the original count, any unknown chunk * should be either known or unknown in the original. */ { png_uint_32 test; test = flags[1][0] & ~flags[0][0]; check_error(d, test, ""new known chunk before IDAT""); test = flags[1][1] & ~(flags[0][0] | flags[0][1]); check_error(d, test, ""new unknown chunk before IDAT""); test = flags[1][2] & ~flags[0][2]; check_error(d, test, ""new known chunk after IDAT""); test = flags[1][3] & ~(flags[0][2] | flags[0][3]); check_error(d, test, ""new unknown chunk after IDAT""); } /* Now each chunk in the original list should have been handled according to * the options set for that chunk, regardless of whether libpng knows about * it or not. */ check_handling(d, def, flags[0][0] | flags[0][1], flags[1][0], flags[1][1], ""before IDAT"", set_callback); check_handling(d, def, flags[0][2] | flags[0][3], flags[1][2], flags[1][3], ""after IDAT"", set_callback); } ",0 "bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm, u8 *sense) { struct request_queue *q = bd->queue; struct request *rq, *next_rq = NULL; int ret, rw; unsigned int dxfer_len; void __user *dxferp = NULL; struct bsg_class_device *bcd = &q->bsg_dev; /* if the LLD has been removed then the bsg_unregister_queue will * eventually be called and the class_dev was freed, so we can no * longer use this request_queue. Return no such address. */ if (!bcd->class_dev) return ERR_PTR(-ENXIO); dprintk(""map hdr %llx/%u %llx/%u\n"", (unsigned long long) hdr->dout_xferp, hdr->dout_xfer_len, (unsigned long long) hdr->din_xferp, hdr->din_xfer_len); ret = bsg_validate_sgv4_hdr(hdr, &rw); if (ret) return ERR_PTR(ret); /* * map scatter-gather elements separately and string them to request */ rq = blk_get_request(q, rw, GFP_KERNEL); if (IS_ERR(rq)) return rq; blk_rq_set_block_pc(rq); ret = blk_fill_sgv4_hdr_rq(q, rq, hdr, bd, has_write_perm); if (ret) goto out; if (rw == WRITE && hdr->din_xfer_len) { if (!test_bit(QUEUE_FLAG_BIDI, &q->queue_flags)) { ret = -EOPNOTSUPP; goto out; } next_rq = blk_get_request(q, READ, GFP_KERNEL); if (IS_ERR(next_rq)) { ret = PTR_ERR(next_rq); next_rq = NULL; goto out; } rq->next_rq = next_rq; next_rq->cmd_type = rq->cmd_type; dxferp = (void __user *)(unsigned long)hdr->din_xferp; ret = blk_rq_map_user(q, next_rq, NULL, dxferp, hdr->din_xfer_len, GFP_KERNEL); if (ret) goto out; } if (hdr->dout_xfer_len) { dxfer_len = hdr->dout_xfer_len; dxferp = (void __user *)(unsigned long)hdr->dout_xferp; } else if (hdr->din_xfer_len) { dxfer_len = hdr->din_xfer_len; dxferp = (void __user *)(unsigned long)hdr->din_xferp; } else dxfer_len = 0; if (dxfer_len) { ret = blk_rq_map_user(q, rq, NULL, dxferp, dxfer_len, GFP_KERNEL); if (ret) goto out; } rq->sense = sense; rq->sense_len = 0; return rq; out: if (rq->cmd != rq->__cmd) kfree(rq->cmd); blk_put_request(rq); if (next_rq) { blk_rq_unmap_user(next_rq->bio); blk_put_request(next_rq); } return ERR_PTR(ret); } ",0 "GURL SanitizeFrontendURL(const GURL& url, const std::string& scheme, const std::string& host, const std::string& path, bool allow_query_and_fragment) { std::vector query_parts; std::string fragment; if (allow_query_and_fragment) { for (net::QueryIterator it(url); !it.IsAtEnd(); it.Advance()) { std::string value = SanitizeFrontendQueryParam(it.GetKey(), it.GetValue()); if (!value.empty()) { query_parts.push_back( base::StringPrintf(""%s=%s"", it.GetKey().c_str(), value.c_str())); } } if (url.has_ref()) fragment = '#' + url.ref(); } std::string query = query_parts.empty() ? """" : ""?"" + base::JoinString(query_parts, ""&""); std::string constructed = base::StringPrintf(""%s://%s%s%s%s"", scheme.c_str(), host.c_str(), path.c_str(), query.c_str(), fragment.c_str()); GURL result = GURL(constructed); if (!result.is_valid()) return GURL(); return result; } ",1 "void GLES2DecoderImpl::DoGenSharedIds( GLuint namespace_id, GLuint id_offset, GLsizei n, GLuint* ids) { IdAllocator* id_allocator = group_->GetIdAllocator(namespace_id); if (id_offset == 0) { for (GLsizei ii = 0; ii < n; ++ii) { ids[ii] = id_allocator->AllocateID(); } } else { for (GLsizei ii = 0; ii < n; ++ii) { ids[ii] = id_allocator->AllocateIDAtOrAbove(id_offset); id_offset = ids[ii] + 1; } } } ",0 "static ssize_t ocfs2_direct_IO(struct kiocb *iocb, struct iov_iter *iter) { struct file *file = iocb->ki_filp; struct inode *inode = file->f_mapping->host; struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); get_block_t *get_block; /* * Fallback to buffered I/O if we see an inode without * extents. */ if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) return 0; /* Fallback to buffered I/O if we do not support append dio. */ if (iocb->ki_pos + iter->count > i_size_read(inode) && !ocfs2_supports_append_dio(osb)) return 0; if (iov_iter_rw(iter) == READ) get_block = ocfs2_get_block; else get_block = ocfs2_dio_get_block; return __blockdev_direct_IO(iocb, inode, inode->i_sb->s_bdev, iter, get_block, ocfs2_dio_end_io, NULL, 0); } ",1 "BluetoothAdapter::StartOrStopDiscoveryCallback::StartOrStopDiscoveryCallback( base::Closure stop_callback, DiscoverySessionErrorCallback stop_error_callback) { this->stop_callback = stop_callback; this->stop_error_callback = std::move(stop_error_callback); } ",0 "svcxdr_dupstr(struct nfsd4_compoundargs *argp, void *buf, u32 len) { char *p = svcxdr_tmpalloc(argp, len + 1); if (!p) return NULL; memcpy(p, buf, len); p[len] = '\0'; return p; } ",0 "static void set_default_header_data(struct ecryptfs_crypt_stat *crypt_stat) { crypt_stat->metadata_size = ECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE; } ",0 "fmul(struct sh_fpu_soft_struct *fregs, struct pt_regs *regs, int m, int n) { BOTH_PRmn(ARITH_X, MUL); return 0; } ",0 "bool GLES2Implementation::ThreadSafeShallowLockDiscardableTexture( uint32_t texture_id) { ClientDiscardableTextureManager* manager = share_group()->discardable_texture_manager(); return manager->TextureIsValid(texture_id) && manager->LockTexture(texture_id); } ",0 "request_permitted(struct sftp_handler *h) { char *result; if (readonly && h->does_write) { verbose(""Refusing %s request in read-only mode"", h->name); return 0; } if (request_blacklist != NULL && ((result = match_list(h->name, request_blacklist, NULL))) != NULL) { free(result); verbose(""Refusing blacklisted %s request"", h->name); return 0; } if (request_whitelist != NULL && ((result = match_list(h->name, request_whitelist, NULL))) != NULL) { free(result); debug2(""Permitting whitelisted %s request"", h->name); return 1; } if (request_whitelist != NULL) { verbose(""Refusing non-whitelisted %s request"", h->name); return 0; } return 1; } ",0 "static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod5(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) return throwVMTypeError(exec); JSTestObj* castedThis = jsCast(asObject(thisValue)); ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info); TestObj* impl = static_cast(castedThis->impl()); if (exec->argumentCount() < 1) return throwVMError(exec, createTypeError(exec, ""Not enough arguments"")); if (exec->argumentCount() <= 0 || !exec->argument(0).isFunction()) { setDOMException(exec, TYPE_MISMATCH_ERR); return JSValue::encode(jsUndefined()); } RefPtr callback = JSTestCallback::create(asObject(exec->argument(0)), castedThis->globalObject()); impl->overloadedMethod(callback); return JSValue::encode(jsUndefined()); } ",1 "int drm_mode_getresources(struct drm_device *dev, void *data, struct drm_file *file_priv) { struct drm_mode_card_res *card_res = data; struct list_head *lh; struct drm_framebuffer *fb; struct drm_connector *connector; struct drm_crtc *crtc; struct drm_encoder *encoder; int ret = 0; int connector_count = 0; int crtc_count = 0; int fb_count = 0; int encoder_count = 0; int copied = 0, i; uint32_t __user *fb_id; uint32_t __user *crtc_id; uint32_t __user *connector_id; uint32_t __user *encoder_id; struct drm_mode_group *mode_group; if (!drm_core_check_feature(dev, DRIVER_MODESET)) return -EINVAL; mutex_lock(&dev->mode_config.mutex); /* * For the non-control nodes we need to limit the list of resources * by IDs in the group list for this node */ list_for_each(lh, &file_priv->fbs) fb_count++; mode_group = &file_priv->master->minor->mode_group; if (file_priv->master->minor->type == DRM_MINOR_CONTROL) { list_for_each(lh, &dev->mode_config.crtc_list) crtc_count++; list_for_each(lh, &dev->mode_config.connector_list) connector_count++; list_for_each(lh, &dev->mode_config.encoder_list) encoder_count++; } else { crtc_count = mode_group->num_crtcs; connector_count = mode_group->num_connectors; encoder_count = mode_group->num_encoders; } card_res->max_height = dev->mode_config.max_height; card_res->min_height = dev->mode_config.min_height; card_res->max_width = dev->mode_config.max_width; card_res->min_width = dev->mode_config.min_width; /* handle this in 4 parts */ /* FBs */ if (card_res->count_fbs >= fb_count) { copied = 0; fb_id = (uint32_t __user *)(unsigned long)card_res->fb_id_ptr; list_for_each_entry(fb, &file_priv->fbs, filp_head) { if (put_user(fb->base.id, fb_id + copied)) { ret = -EFAULT; goto out; } copied++; } } card_res->count_fbs = fb_count; /* CRTCs */ if (card_res->count_crtcs >= crtc_count) { copied = 0; crtc_id = (uint32_t __user *)(unsigned long)card_res->crtc_id_ptr; if (file_priv->master->minor->type == DRM_MINOR_CONTROL) { list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { DRM_DEBUG_KMS(""[CRTC:%d]\n"", crtc->base.id); if (put_user(crtc->base.id, crtc_id + copied)) { ret = -EFAULT; goto out; } copied++; } } else { for (i = 0; i < mode_group->num_crtcs; i++) { if (put_user(mode_group->id_list[i], crtc_id + copied)) { ret = -EFAULT; goto out; } copied++; } } } card_res->count_crtcs = crtc_count; /* Encoders */ if (card_res->count_encoders >= encoder_count) { copied = 0; encoder_id = (uint32_t __user *)(unsigned long)card_res->encoder_id_ptr; if (file_priv->master->minor->type == DRM_MINOR_CONTROL) { list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { DRM_DEBUG_KMS(""[ENCODER:%d:%s]\n"", encoder->base.id, drm_get_encoder_name(encoder)); if (put_user(encoder->base.id, encoder_id + copied)) { ret = -EFAULT; goto out; } copied++; } } else { for (i = mode_group->num_crtcs; i < mode_group->num_crtcs + mode_group->num_encoders; i++) { if (put_user(mode_group->id_list[i], encoder_id + copied)) { ret = -EFAULT; goto out; } copied++; } } } card_res->count_encoders = encoder_count; /* Connectors */ if (card_res->count_connectors >= connector_count) { copied = 0; connector_id = (uint32_t __user *)(unsigned long)card_res->connector_id_ptr; if (file_priv->master->minor->type == DRM_MINOR_CONTROL) { list_for_each_entry(connector, &dev->mode_config.connector_list, head) { DRM_DEBUG_KMS(""[CONNECTOR:%d:%s]\n"", connector->base.id, drm_get_connector_name(connector)); if (put_user(connector->base.id, connector_id + copied)) { ret = -EFAULT; goto out; } copied++; } } else { int start = mode_group->num_crtcs + mode_group->num_encoders; for (i = start; i < start + mode_group->num_connectors; i++) { if (put_user(mode_group->id_list[i], connector_id + copied)) { ret = -EFAULT; goto out; } copied++; } } } card_res->count_connectors = connector_count; DRM_DEBUG_KMS(""CRTC[%d] CONNECTORS[%d] ENCODERS[%d]\n"", card_res->count_crtcs, card_res->count_connectors, card_res->count_encoders); out: mutex_unlock(&dev->mode_config.mutex); return ret; } ",0 "uint32_t OutOfProcessInstance::QuerySupportedPrintOutputFormats() { return engine_->QuerySupportedPrintOutputFormats(); } ",0 "static __be32 *__xdr_inline_decode(struct xdr_stream *xdr, size_t nbytes) { __be32 *p = xdr->p; __be32 *q = p + XDR_QUADLEN(nbytes); if (q > xdr->end || q < p) return NULL; xdr->p = q; return p; } ",0 "void WebMediaPlayerImpl::SetMediaPlayerManager( RendererMediaPlayerManagerInterface* media_player_manager) { cast_impl_.SetMediaPlayerManager(media_player_manager); } ",0 "void batadv_frag_purge_orig(struct batadv_orig_node *orig_node, bool (*check_cb)(struct batadv_frag_table_entry *)) { struct batadv_frag_table_entry *chain; uint8_t i; for (i = 0; i < BATADV_FRAG_BUFFER_COUNT; i++) { chain = &orig_node->fragments[i]; spin_lock_bh(&orig_node->fragments[i].lock); if (!check_cb || check_cb(chain)) { batadv_frag_clear_chain(&orig_node->fragments[i].head); orig_node->fragments[i].size = 0; } spin_unlock_bh(&orig_node->fragments[i].lock); } } ",0 "int git_index_entry_stage(const git_index_entry *entry) { return GIT_IDXENTRY_STAGE(entry); } ",0 "bool RenderLayerCompositor::requiresCompositingForTransition(RenderObject* renderer) const { if (!(m_compositingTriggers & ChromeClient::AnimationTrigger)) return false; if (Settings* settings = m_renderView->document().settings()) { if (!settings->acceleratedCompositingForTransitionEnabled()) return false; } return renderer->style()->transitionForProperty(CSSPropertyOpacity) || renderer->style()->transitionForProperty(CSSPropertyWebkitFilter) || renderer->style()->transitionForProperty(CSSPropertyWebkitTransform); } ",0 "local int updatewindow(strm, end, copy) z_streamp strm; const Bytef *end; unsigned copy; { struct inflate_state FAR *state; unsigned dist; state = (struct inflate_state FAR *)strm->state; /* if it hasn't been done already, allocate space for the window */ if (state->window == Z_NULL) { state->window = (unsigned char FAR *) ZALLOC(strm, 1U << state->wbits, sizeof(unsigned char)); if (state->window == Z_NULL) return 1; } /* if window not in use yet, initialize */ if (state->wsize == 0) { state->wsize = 1U << state->wbits; state->wnext = 0; state->whave = 0; } /* copy state->wsize or less output bytes into the circular window */ if (copy >= state->wsize) { zmemcpy(state->window, end - state->wsize, state->wsize); state->wnext = 0; state->whave = state->wsize; } else { dist = state->wsize - state->wnext; if (dist > copy) dist = copy; zmemcpy(state->window + state->wnext, end - copy, dist); copy -= dist; if (copy) { zmemcpy(state->window, end - copy, copy); state->wnext = copy; state->whave = state->wsize; } else { state->wnext += dist; if (state->wnext == state->wsize) state->wnext = 0; if (state->whave < state->wsize) state->whave += dist; } } return 0; } ",0 "static void set_changed_flag(struct Context *ctx, struct Header *h, int local_changes, int *server_changes, int flag_name, int old_hd_flag, int new_hd_flag, int h_flag) { /* If there are local_changes, we only want to note if the server * flags have changed, so we can set a reopen flag in * cmd_parse_fetch(). We don't want to count a local modification * to the header flag as a ""change"". */ if ((old_hd_flag == new_hd_flag) && local_changes) return; if (new_hd_flag == h_flag) return; if (server_changes) *server_changes = 1; /* Local changes have priority */ if (!local_changes) mutt_set_flag(ctx, h, flag_name, new_hd_flag); } ",0 "int rtnl_is_locked(void) { return mutex_is_locked(&rtnl_mutex); } ",0 "bool findMetadata(const Metadata::Filter& filter, const int32_t val) { if (filter.isEmpty()) return false; if (filter[0] == Metadata::kAny) return true; return filter.indexOf(val) >= 0; } ",0 " bool MaybeCreateLoaderForResponse( const network::ResourceResponseHead& response) { if (!IsLoaderInterceptionEnabled()) return false; if (!default_loader_used_) return false; for (auto& interceptor : interceptors_) { network::mojom::URLLoaderClientRequest response_client_request; if (interceptor->MaybeCreateLoaderForResponse( response, &response_url_loader_, &response_client_request, url_loader_.get())) { if (response_loader_binding_.is_bound()) response_loader_binding_.Close(); response_loader_binding_.Bind(std::move(response_client_request)); default_loader_used_ = false; url_loader_.reset(); return true; } } return false; } ",0 " ~PluginNetworkObserver() { net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this); net::NetworkChangeNotifier::RemoveIPAddressObserver(this); } ",0 "void CrosMock::InitStatusAreaMocks() { InitMockNetworkLibrary(); InitMockPowerLibrary(); InitMockTouchpadLibrary(); } ",0 "static void methodWithEnforceRangeInt16MethodCallback(const v8::FunctionCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMMethod""); TestObjectV8Internal::methodWithEnforceRangeInt16Method(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "set_str_a_characters_bp(struct archive_write *a, unsigned char *bp, int from, int to, const char *s, enum vdc vdc) { int r; switch (vdc) { case VDC_STD: set_str(bp+from, s, to - from + 1, 0x20, a_characters_map); r = ARCHIVE_OK; break; case VDC_LOWERCASE: set_str(bp+from, s, to - from + 1, 0x20, a1_characters_map); r = ARCHIVE_OK; break; case VDC_UCS2: case VDC_UCS2_DIRECT: r = set_str_utf16be(a, bp+from, s, to - from + 1, 0x0020, vdc); break; default: r = ARCHIVE_FATAL; } return (r); } ",0