unique_id
int64
13
189k
target
int64
0
1
code
stringlengths
20
241k
__index_level_0__
int64
0
18.9k
164,760
0
void ChildProcessLauncherHelper::ForceNormalProcessTerminationSync( ChildProcessLauncherHelper::Process process) { DCHECK(CurrentlyOnProcessLauncherTaskRunner()); VLOG(1) << "ChromeProcess: Stopping process with handle " << process.process.Handle(); StopChildProcess(process.process.Handle()); }
3,000
158,404
0
explicit FakeDelegatedFrameHostClientAura( RenderWidgetHostViewAura* render_widget_host_view) : DelegatedFrameHostClientAura(render_widget_host_view) {}
3,001
82,013
0
static RList * get_java_bin_obj_list(RAnal *anal) { RBinJavaObj *bin_obj = (RBinJavaObj * )get_java_bin_obj(anal); return r_bin_java_get_bin_obj_list_thru_obj (bin_obj); }
3,002
22,638
0
bool try_wait_for_completion(struct completion *x) { unsigned long flags; int ret = 1; spin_lock_irqsave(&x->wait.lock, flags); if (!x->done) ret = 0; else x->done--; spin_unlock_irqrestore(&x->wait.lock, flags); return ret; }
3,003
90,245
0
static int set_global_enables(struct smi_info *smi_info, u8 enables) { unsigned char msg[3]; unsigned char *resp; unsigned long resp_len; int rv; resp = kmalloc(IPMI_MAX_MSG_LENGTH, GFP_KERNEL); if (!resp) return -ENOMEM; msg[0] = IPMI_NETFN_APP_REQUEST << 2; msg[1] = IPMI_SET_BMC_GLOBAL_ENABLES_CMD; msg[2] = enables; smi_info->handlers->start_transaction(smi_info->si_sm, msg, 3); rv = wait_for_msg_done(smi_info); if (rv) { dev_warn(smi_info->io.dev, "Error getting response from set global enables command: %d\n", rv); goto out; } resp_len = smi_info->handlers->get_result(smi_info->si_sm, resp, IPMI_MAX_MSG_LENGTH); if (resp_len < 3 || resp[0] != (IPMI_NETFN_APP_REQUEST | 1) << 2 || resp[1] != IPMI_SET_BMC_GLOBAL_ENABLES_CMD) { dev_warn(smi_info->io.dev, "Invalid return from set global enables command: %ld %x %x\n", resp_len, resp[0], resp[1]); rv = -EINVAL; goto out; } if (resp[2] != 0) rv = 1; out: kfree(resp); return rv; }
3,004
74,964
0
static UINT drdynvc_virtual_channel_event_disconnected(drdynvcPlugin* drdynvc) { UINT status; if (drdynvc->OpenHandle == 0) return CHANNEL_RC_OK; if (!drdynvc) return CHANNEL_RC_BAD_CHANNEL_HANDLE; if (!MessageQueue_PostQuit(drdynvc->queue, 0)) { status = GetLastError(); WLog_Print(drdynvc->log, WLOG_ERROR, "MessageQueue_PostQuit failed with error %"PRIu32"", status); return status; } if (WaitForSingleObject(drdynvc->thread, INFINITE) != WAIT_OBJECT_0) { status = GetLastError(); WLog_Print(drdynvc->log, WLOG_ERROR, "WaitForSingleObject failed with error %"PRIu32"", status); return status; } MessageQueue_Free(drdynvc->queue); CloseHandle(drdynvc->thread); drdynvc->queue = NULL; drdynvc->thread = NULL; status = drdynvc->channelEntryPoints.pVirtualChannelCloseEx(drdynvc->InitHandle, drdynvc->OpenHandle); if (status != CHANNEL_RC_OK) { WLog_Print(drdynvc->log, WLOG_ERROR, "pVirtualChannelClose failed with %s [%08"PRIX32"]", WTSErrorToString(status), status); } drdynvc->OpenHandle = 0; if (drdynvc->data_in) { Stream_Free(drdynvc->data_in, TRUE); drdynvc->data_in = NULL; } if (drdynvc->channel_mgr) { dvcman_free(drdynvc, drdynvc->channel_mgr); drdynvc->channel_mgr = NULL; } return status; }
3,005
2,277
0
_PUBLIC_ bool islower_m(codepoint_t val) { return (toupper_m(val) != val); }
3,006
138,316
0
void addObjectVectorAttribute(AXObjectVectorAttribute attribute, HeapVector<Member<AXObject>>& objects) { switch (attribute) { case AXObjectVectorAttribute::AriaControls: m_properties.addItem(createRelatedNodeListProperty( AXRelationshipAttributesEnum::Controls, objects, aria_controlsAttr, *m_axObject)); break; case AXObjectVectorAttribute::AriaDetails: m_properties.addItem(createRelatedNodeListProperty( AXRelationshipAttributesEnum::Details, objects, aria_controlsAttr, *m_axObject)); break; case AXObjectVectorAttribute::AriaFlowTo: m_properties.addItem(createRelatedNodeListProperty( AXRelationshipAttributesEnum::Flowto, objects, aria_flowtoAttr, *m_axObject)); break; } }
3,007
1,634
0
void auth_client(int fd, const char *user, const char *challenge) { const char *pass; char pass2[MAX_DIGEST_LEN*2]; if (!user || !*user) user = "nobody"; if (!(pass = getpassf(password_file)) && !(pass = getenv("RSYNC_PASSWORD"))) { /* XXX: cyeoh says that getpass is deprecated, because * it may return a truncated password on some systems, * and it is not in the LSB. * * Andrew Klein says that getpassphrase() is present * on Solaris and reads up to 256 characters. * * OpenBSD has a readpassphrase() that might be more suitable. */ pass = getpass("Password: "); } if (!pass) pass = ""; generate_hash(pass, challenge, pass2); io_printf(fd, "%s %s\n", user, pass2); }
3,008
62,480
0
xid_map_enter(netdissect_options *ndo, const struct sunrpc_msg *rp, const u_char *bp) { const struct ip *ip = NULL; const struct ip6_hdr *ip6 = NULL; struct xid_map_entry *xmep; if (!ND_TTEST(rp->rm_call.cb_vers)) return (0); switch (IP_V((const struct ip *)bp)) { case 4: ip = (const struct ip *)bp; break; case 6: ip6 = (const struct ip6_hdr *)bp; break; default: return (1); } xmep = &xid_map[xid_map_next]; if (++xid_map_next >= XIDMAPSIZE) xid_map_next = 0; UNALIGNED_MEMCPY(&xmep->xid, &rp->rm_xid, sizeof(xmep->xid)); if (ip) { xmep->ipver = 4; UNALIGNED_MEMCPY(&xmep->client, &ip->ip_src, sizeof(ip->ip_src)); UNALIGNED_MEMCPY(&xmep->server, &ip->ip_dst, sizeof(ip->ip_dst)); } else if (ip6) { xmep->ipver = 6; UNALIGNED_MEMCPY(&xmep->client, &ip6->ip6_src, sizeof(ip6->ip6_src)); UNALIGNED_MEMCPY(&xmep->server, &ip6->ip6_dst, sizeof(ip6->ip6_dst)); } xmep->proc = EXTRACT_32BITS(&rp->rm_call.cb_proc); xmep->vers = EXTRACT_32BITS(&rp->rm_call.cb_vers); return (1); }
3,009
22,661
0
int __sched wait_for_completion_killable(struct completion *x) { long t = wait_for_common(x, MAX_SCHEDULE_TIMEOUT, TASK_KILLABLE); if (t == -ERESTARTSYS) return t; return 0; }
3,010
73,813
0
int web_server_init() { int ret = 0; if (bWebServerState == WEB_SERVER_DISABLED) { /* decode media list */ media_list_init(); membuffer_init(&gDocumentRootDir); glob_alias_init(); pVirtualDirList = NULL; /* Initialize callbacks */ virtualDirCallback.get_info = NULL; virtualDirCallback.open = NULL; virtualDirCallback.read = NULL; virtualDirCallback.write = NULL; virtualDirCallback.seek = NULL; virtualDirCallback.close = NULL; if (ithread_mutex_init(&gWebMutex, NULL) == -1) ret = UPNP_E_OUTOF_MEMORY; else bWebServerState = WEB_SERVER_ENABLED; } return ret; }
3,011
103,917
0
bool RenderView::runModalConfirmDialog( WebFrame* frame, const WebString& message) { return RunJavaScriptMessage(ui::MessageBoxFlags::kIsJavascriptConfirm, message, string16(), frame->document().url(), NULL); }
3,012
12,371
0
static int spl_array_next_ex(spl_array_object *intern, HashTable *aht TSRMLS_DC) /* {{{ */ { if ((intern->ar_flags & SPL_ARRAY_IS_REF) && spl_hash_verify_pos_ex(intern, aht TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Array was modified outside object and internal position is no longer valid"); return FAILURE; } return spl_array_next_no_verify(intern, aht TSRMLS_CC); } /* }}} */
3,013
180,149
1
int orangefs_set_acl(struct inode *inode, struct posix_acl *acl, int type) { struct orangefs_inode_s *orangefs_inode = ORANGEFS_I(inode); int error = 0; void *value = NULL; size_t size = 0; const char *name = NULL; switch (type) { case ACL_TYPE_ACCESS: name = XATTR_NAME_POSIX_ACL_ACCESS; if (acl) { umode_t mode = inode->i_mode; /* * can we represent this with the traditional file * mode permission bits? * error = posix_acl_equiv_mode(acl, &mode); if (error < 0) { gossip_err("%s: posix_acl_equiv_mode err: %d\n", __func__, error); return error; } if (inode->i_mode != mode) SetModeFlag(orangefs_inode); inode->i_mode = mode; mark_inode_dirty_sync(inode); if (error == 0) acl = NULL; } break; case ACL_TYPE_DEFAULT: name = XATTR_NAME_POSIX_ACL_DEFAULT; break; default: gossip_err("%s: invalid type %d!\n", __func__, type); return -EINVAL; } gossip_debug(GOSSIP_ACL_DEBUG, "%s: inode %pU, key %s type %d\n", __func__, get_khandle_from_ino(inode), name, type); if (acl) { size = posix_acl_xattr_size(acl->a_count); value = kmalloc(size, GFP_KERNEL); if (!value) return -ENOMEM; error = posix_acl_to_xattr(&init_user_ns, acl, value, size); if (error < 0) goto out; } gossip_debug(GOSSIP_ACL_DEBUG, "%s: name %s, value %p, size %zd, acl %p\n", __func__, name, value, size, acl); /* * Go ahead and set the extended attribute now. NOTE: Suppose acl * was NULL, then value will be NULL and size will be 0 and that * will xlate to a removexattr. However, we don't want removexattr * complain if attributes does not exist. */ error = orangefs_inode_setxattr(inode, name, value, size, 0); out: kfree(value); if (!error) set_cached_acl(inode, type, acl); return error; }
3,014
171,911
0
static void btif_hl_proc_send_data_cfm(tBTA_HL_MDL_HANDLE mdl_handle, tBTA_HL_STATUS status){ UINT8 app_idx,mcl_idx, mdl_idx; btif_hl_mdl_cb_t *p_dcb; UNUSED(status); BTIF_TRACE_DEBUG("%s", __FUNCTION__); if (btif_hl_find_mdl_idx_using_handle(mdl_handle, &app_idx, &mcl_idx, &mdl_idx )) { p_dcb =BTIF_HL_GET_MDL_CB_PTR(app_idx, mcl_idx, mdl_idx); btif_hl_free_buf((void **) &p_dcb->p_tx_pkt); BTIF_TRACE_DEBUG("send success free p_tx_pkt tx_size=%d", p_dcb->tx_size); p_dcb->tx_size = 0; } }
3,015
65,464
0
find_unconfirmed_client(clientid_t *clid, bool sessions, struct nfsd_net *nn) { struct list_head *tbl = nn->unconf_id_hashtbl; lockdep_assert_held(&nn->client_lock); return find_client_in_id_table(tbl, clid, sessions); }
3,016
186,152
1
png_set_tIME(png_structp png_ptr, png_infop info_ptr, png_timep mod_time) { png_debug1(1, "in %s storage function", "tIME"); if (png_ptr == NULL || info_ptr == NULL || (png_ptr->mode & PNG_WROTE_tIME)) return; png_memcpy(&(info_ptr->mod_time), mod_time, png_sizeof(png_time)); info_ptr->valid |= PNG_INFO_tIME; }
3,017
73,137
0
CHUNK_WRITE_PTR(chunk_t *chunk) { return chunk->data + chunk->datalen; }
3,018
127,224
0
void WorkerProcessLauncher::Core::OnChannelError() { DCHECK(caller_task_runner_->BelongsToCurrentThread()); ipc_error_timer_->Start(FROM_HERE, base::TimeDelta::FromSeconds(5), this, &Core::StopWorker); }
3,019
174,966
0
void CameraClient::setPreviewCallbackFlag(int callback_flag) { LOG1("setPreviewCallbackFlag(%d) (pid %d)", callback_flag, getCallingPid()); Mutex::Autolock lock(mLock); if (checkPidAndHardware() != NO_ERROR) return; mPreviewCallbackFlag = callback_flag; if (mPreviewCallbackFlag & CAMERA_FRAME_CALLBACK_FLAG_ENABLE_MASK) { enableMsgType(CAMERA_MSG_PREVIEW_FRAME); } else { disableMsgType(CAMERA_MSG_PREVIEW_FRAME); } }
3,020
25,798
0
static void x86_pmu_start_txn(struct pmu *pmu) { perf_pmu_disable(pmu); __this_cpu_or(cpu_hw_events.group_flag, PERF_EVENT_TXN); __this_cpu_write(cpu_hw_events.n_txn, 0); }
3,021
12,378
0
static zend_object_value spl_array_object_new_ex(zend_class_entry *class_type, spl_array_object **obj, zval *orig, int clone_orig TSRMLS_DC) { zend_object_value retval = {0}; spl_array_object *intern; zval *tmp; zend_class_entry * parent = class_type; int inherited = 0; intern = emalloc(sizeof(spl_array_object)); memset(intern, 0, sizeof(spl_array_object)); *obj = intern; ALLOC_INIT_ZVAL(intern->retval); zend_object_std_init(&intern->std, class_type TSRMLS_CC); object_properties_init(&intern->std, class_type); intern->ar_flags = 0; intern->debug_info = NULL; intern->ce_get_iterator = spl_ce_ArrayIterator; if (orig) { spl_array_object *other = (spl_array_object*)zend_object_store_get_object(orig TSRMLS_CC); intern->ar_flags &= ~ SPL_ARRAY_CLONE_MASK; intern->ar_flags |= (other->ar_flags & SPL_ARRAY_CLONE_MASK); intern->ce_get_iterator = other->ce_get_iterator; if (clone_orig) { intern->array = other->array; if (Z_OBJ_HT_P(orig) == &spl_handler_ArrayObject) { MAKE_STD_ZVAL(intern->array); array_init(intern->array); zend_hash_copy(HASH_OF(intern->array), HASH_OF(other->array), (copy_ctor_func_t) zval_add_ref, &tmp, sizeof(zval*)); } if (Z_OBJ_HT_P(orig) == &spl_handler_ArrayIterator) { Z_ADDREF_P(other->array); } } else { intern->array = orig; Z_ADDREF_P(intern->array); intern->ar_flags |= SPL_ARRAY_IS_REF | SPL_ARRAY_USE_OTHER; } } else { MAKE_STD_ZVAL(intern->array); array_init(intern->array); intern->ar_flags &= ~SPL_ARRAY_IS_REF; } retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) spl_array_object_free_storage, NULL TSRMLS_CC); while (parent) { if (parent == spl_ce_ArrayIterator || parent == spl_ce_RecursiveArrayIterator) { retval.handlers = &spl_handler_ArrayIterator; class_type->get_iterator = spl_array_get_iterator; break; } else if (parent == spl_ce_ArrayObject) { retval.handlers = &spl_handler_ArrayObject; break; } parent = parent->parent; inherited = 1; } if (!parent) { /* this must never happen */ php_error_docref(NULL TSRMLS_CC, E_COMPILE_ERROR, "Internal compiler error, Class is not child of ArrayObject or ArrayIterator"); } if (inherited) { zend_hash_find(&class_type->function_table, "offsetget", sizeof("offsetget"), (void **) &intern->fptr_offset_get); if (intern->fptr_offset_get->common.scope == parent) { intern->fptr_offset_get = NULL; } zend_hash_find(&class_type->function_table, "offsetset", sizeof("offsetset"), (void **) &intern->fptr_offset_set); if (intern->fptr_offset_set->common.scope == parent) { intern->fptr_offset_set = NULL; } zend_hash_find(&class_type->function_table, "offsetexists", sizeof("offsetexists"), (void **) &intern->fptr_offset_has); if (intern->fptr_offset_has->common.scope == parent) { intern->fptr_offset_has = NULL; } zend_hash_find(&class_type->function_table, "offsetunset", sizeof("offsetunset"), (void **) &intern->fptr_offset_del); if (intern->fptr_offset_del->common.scope == parent) { intern->fptr_offset_del = NULL; } zend_hash_find(&class_type->function_table, "count", sizeof("count"), (void **) &intern->fptr_count); if (intern->fptr_count->common.scope == parent) { intern->fptr_count = NULL; } } /* Cache iterator functions if ArrayIterator or derived. Check current's */ /* cache since only current is always required */ if (retval.handlers == &spl_handler_ArrayIterator) { if (!class_type->iterator_funcs.zf_current) { zend_hash_find(&class_type->function_table, "rewind", sizeof("rewind"), (void **) &class_type->iterator_funcs.zf_rewind); zend_hash_find(&class_type->function_table, "valid", sizeof("valid"), (void **) &class_type->iterator_funcs.zf_valid); zend_hash_find(&class_type->function_table, "key", sizeof("key"), (void **) &class_type->iterator_funcs.zf_key); zend_hash_find(&class_type->function_table, "current", sizeof("current"), (void **) &class_type->iterator_funcs.zf_current); zend_hash_find(&class_type->function_table, "next", sizeof("next"), (void **) &class_type->iterator_funcs.zf_next); } if (inherited) { if (class_type->iterator_funcs.zf_rewind->common.scope != parent) intern->ar_flags |= SPL_ARRAY_OVERLOADED_REWIND; if (class_type->iterator_funcs.zf_valid->common.scope != parent) intern->ar_flags |= SPL_ARRAY_OVERLOADED_VALID; if (class_type->iterator_funcs.zf_key->common.scope != parent) intern->ar_flags |= SPL_ARRAY_OVERLOADED_KEY; if (class_type->iterator_funcs.zf_current->common.scope != parent) intern->ar_flags |= SPL_ARRAY_OVERLOADED_CURRENT; if (class_type->iterator_funcs.zf_next->common.scope != parent) intern->ar_flags |= SPL_ARRAY_OVERLOADED_NEXT; } } spl_array_rewind(intern TSRMLS_CC); return retval; }
3,022
154,848
0
error::Error GLES2DecoderPassthroughImpl::DoUniform4fv( GLint location, GLsizei count, const volatile GLfloat* v) { api()->glUniform4fvFn(location, count, const_cast<const GLfloat*>(v)); return error::kNoError; }
3,023
147,777
0
static void ReflectUnsignedShortAttributeAttributeSetter( v8::Local<v8::Value> v8_value, const v8::FunctionCallbackInfo<v8::Value>& info) { v8::Isolate* isolate = info.GetIsolate(); ALLOW_UNUSED_LOCAL(isolate); v8::Local<v8::Object> holder = info.Holder(); ALLOW_UNUSED_LOCAL(holder); TestObject* impl = V8TestObject::ToImpl(holder); V0CustomElementProcessingStack::CallbackDeliveryScope delivery_scope; ExceptionState exception_state(isolate, ExceptionState::kSetterContext, "TestObject", "reflectUnsignedShortAttribute"); uint16_t cpp_value = NativeValueTraits<IDLUnsignedShort>::NativeValue(info.GetIsolate(), v8_value, exception_state); if (exception_state.HadException()) return; impl->setAttribute(html_names::kReflectunsignedshortattributeAttr, cpp_value); }
3,024
107,220
0
double AutoFillUploadXmlParser::GetDoubleValue(buzz::XmlParseContext* context, const char* attribute) { char* attr_end = NULL; double value = strtod(attribute, &attr_end); if (attr_end != NULL && attr_end == attribute) { context->RaiseError(XML_ERROR_SYNTAX); return 0.0; } return value; }
3,025
185,655
1
WebsiteSettingsPopupAndroid::WebsiteSettingsPopupAndroid( JNIEnv* env, jobject java_website_settings_pop, content::WebContents* web_contents) { // Important to use GetVisibleEntry to match what's showing in the omnibox. content::NavigationEntry* nav_entry = web_contents->GetController().GetVisibleEntry(); if (nav_entry == NULL) return; url_ = nav_entry->GetURL(); popup_jobject_.Reset(env, java_website_settings_pop); presenter_.reset(new WebsiteSettings( this, Profile::FromBrowserContext(web_contents->GetBrowserContext()), TabSpecificContentSettings::FromWebContents(web_contents), InfoBarService::FromWebContents(web_contents), nav_entry->GetURL(), nav_entry->GetSSL(), content::CertStore::GetInstance())); }
3,026
143,048
0
ScriptProcessorNode* BaseAudioContext::createScriptProcessor( ExceptionState& exception_state) { DCHECK(IsMainThread()); return ScriptProcessorNode::Create(*this, exception_state); }
3,027
155,224
0
bool HTMLFormElement::hasLegalLinkAttribute(const QualifiedName& name) const { return name == actionAttr || HTMLElement::hasLegalLinkAttribute(name); }
3,028
181,947
1
static void calc_coeff(double mu[4], const int index[4], int prefilter, double r2, double mul) { double mul2 = mul * mul, mul3 = mul2 * mul; double kernel[] = { (5204 + 2520 * mul + 1092 * mul2 + 3280 * mul3) / 12096, (2943 - 210 * mul - 273 * mul2 - 2460 * mul3) / 12096, ( 486 - 924 * mul - 546 * mul2 + 984 * mul3) / 12096, ( 17 - 126 * mul + 273 * mul2 - 164 * mul3) / 12096, }; double mat_freq[13]; memcpy(mat_freq, kernel, sizeof(kernel)); memset(mat_freq + 4, 0, sizeof(mat_freq) - sizeof(kernel)); int n = 6; coeff_filter(mat_freq, n, kernel); for (int k = 0; k < 2 * prefilter; ++k) coeff_blur121(mat_freq, ++n); double vec_freq[13]; n = index[3] + prefilter + 3; calc_gauss(vec_freq, n, r2); memset(vec_freq + n + 1, 0, sizeof(vec_freq) - (n + 1) * sizeof(vec_freq[0])); n -= 3; coeff_filter(vec_freq, n, kernel); for (int k = 0; k < prefilter; ++k) coeff_blur121(vec_freq, --n); double mat[4][4]; calc_matrix(mat, mat_freq, index); double vec[4]; for (int i = 0; i < 4; ++i) vec[i] = mat_freq[0] - mat_freq[index[i]] - vec_freq[0] + vec_freq[index[i]]; for (int i = 0; i < 4; ++i) { double res = 0; for (int j = 0; j < 4; ++j) res += mat[i][j] * vec[j]; mu[i] = FFMAX(0, res); } }
3,029
89,689
0
static u8 nfc_llcp_dsap(struct sk_buff *pdu) { return (pdu->data[0] & 0xfc) >> 2; }
3,030
157,184
0
double WebMediaPlayerImpl::CurrentTime() const { DCHECK(main_task_runner_->BelongsToCurrentThread()); DCHECK_NE(ready_state_, WebMediaPlayer::kReadyStateHaveNothing); return (ended_ && !std::isinf(Duration())) ? Duration() : GetCurrentTimeInternal().InSecondsF(); }
3,031
41,373
0
static int kvm_dev_ioctl_get_supported_cpuid(struct kvm_cpuid2 *cpuid, struct kvm_cpuid_entry2 __user *entries) { struct kvm_cpuid_entry2 *cpuid_entries; int limit, nent = 0, r = -E2BIG; u32 func; if (cpuid->nent < 1) goto out; if (cpuid->nent > KVM_MAX_CPUID_ENTRIES) cpuid->nent = KVM_MAX_CPUID_ENTRIES; r = -ENOMEM; cpuid_entries = vmalloc(sizeof(struct kvm_cpuid_entry2) * cpuid->nent); if (!cpuid_entries) goto out; do_cpuid_ent(&cpuid_entries[0], 0, 0, &nent, cpuid->nent); limit = cpuid_entries[0].eax; for (func = 1; func <= limit && nent < cpuid->nent; ++func) do_cpuid_ent(&cpuid_entries[nent], func, 0, &nent, cpuid->nent); r = -E2BIG; if (nent >= cpuid->nent) goto out_free; do_cpuid_ent(&cpuid_entries[nent], 0x80000000, 0, &nent, cpuid->nent); limit = cpuid_entries[nent - 1].eax; for (func = 0x80000001; func <= limit && nent < cpuid->nent; ++func) do_cpuid_ent(&cpuid_entries[nent], func, 0, &nent, cpuid->nent); r = -E2BIG; if (nent >= cpuid->nent) goto out_free; do_cpuid_ent(&cpuid_entries[nent], KVM_CPUID_SIGNATURE, 0, &nent, cpuid->nent); r = -E2BIG; if (nent >= cpuid->nent) goto out_free; do_cpuid_ent(&cpuid_entries[nent], KVM_CPUID_FEATURES, 0, &nent, cpuid->nent); r = -E2BIG; if (nent >= cpuid->nent) goto out_free; r = -EFAULT; if (copy_to_user(entries, cpuid_entries, nent * sizeof(struct kvm_cpuid_entry2))) goto out_free; cpuid->nent = nent; r = 0; out_free: vfree(cpuid_entries); out: return r; }
3,032
20,287
0
static void warn_setuid_and_fcaps_mixed(const char *fname) { static int warned; if (!warned) { printk(KERN_INFO "warning: `%s' has both setuid-root and" " effective capabilities. Therefore not raising all" " capabilities.\n", fname); warned = 1; } }
3,033
50,444
0
static bool is_orphaned_event(struct perf_event *event) { return event && !is_kernel_event(event) && !event->owner; }
3,034
55,567
0
pick_next_task(struct rq *rq, struct task_struct *prev, struct pin_cookie cookie) { const struct sched_class *class = &fair_sched_class; struct task_struct *p; /* * Optimization: we know that if all tasks are in * the fair class we can call that function directly: */ if (likely(prev->sched_class == class && rq->nr_running == rq->cfs.h_nr_running)) { p = fair_sched_class.pick_next_task(rq, prev, cookie); if (unlikely(p == RETRY_TASK)) goto again; /* assumes fair_sched_class->next == idle_sched_class */ if (unlikely(!p)) p = idle_sched_class.pick_next_task(rq, prev, cookie); return p; } again: for_each_class(class) { p = class->pick_next_task(rq, prev, cookie); if (p) { if (unlikely(p == RETRY_TASK)) goto again; return p; } } BUG(); /* the idle class will always have a runnable task */ }
3,035
118,294
0
SectionRowView() { SetBorder(views::Border::CreateEmptyBorder(10, 0, 0, 0)); }
3,036
84,266
0
get_futex_key(u32 __user *uaddr, int fshared, union futex_key *key, int rw) { unsigned long address = (unsigned long)uaddr; struct mm_struct *mm = current->mm; struct page *page, *tail; struct address_space *mapping; int err, ro = 0; /* * The futex address must be "naturally" aligned. */ key->both.offset = address % PAGE_SIZE; if (unlikely((address % sizeof(u32)) != 0)) return -EINVAL; address -= key->both.offset; if (unlikely(!access_ok(rw, uaddr, sizeof(u32)))) return -EFAULT; if (unlikely(should_fail_futex(fshared))) return -EFAULT; /* * PROCESS_PRIVATE futexes are fast. * As the mm cannot disappear under us and the 'key' only needs * virtual address, we dont even have to find the underlying vma. * Note : We do have to check 'uaddr' is a valid user address, * but access_ok() should be faster than find_vma() */ if (!fshared) { key->private.mm = mm; key->private.address = address; get_futex_key_refs(key); /* implies smp_mb(); (B) */ return 0; } again: /* Ignore any VERIFY_READ mapping (futex common case) */ if (unlikely(should_fail_futex(fshared))) return -EFAULT; err = get_user_pages_fast(address, 1, 1, &page); /* * If write access is not required (eg. FUTEX_WAIT), try * and get read-only access. */ if (err == -EFAULT && rw == VERIFY_READ) { err = get_user_pages_fast(address, 1, 0, &page); ro = 1; } if (err < 0) return err; else err = 0; /* * The treatment of mapping from this point on is critical. The page * lock protects many things but in this context the page lock * stabilizes mapping, prevents inode freeing in the shared * file-backed region case and guards against movement to swap cache. * * Strictly speaking the page lock is not needed in all cases being * considered here and page lock forces unnecessarily serialization * From this point on, mapping will be re-verified if necessary and * page lock will be acquired only if it is unavoidable * * Mapping checks require the head page for any compound page so the * head page and mapping is looked up now. For anonymous pages, it * does not matter if the page splits in the future as the key is * based on the address. For filesystem-backed pages, the tail is * required as the index of the page determines the key. For * base pages, there is no tail page and tail == page. */ tail = page; page = compound_head(page); mapping = READ_ONCE(page->mapping); /* * If page->mapping is NULL, then it cannot be a PageAnon * page; but it might be the ZERO_PAGE or in the gate area or * in a special mapping (all cases which we are happy to fail); * or it may have been a good file page when get_user_pages_fast * found it, but truncated or holepunched or subjected to * invalidate_complete_page2 before we got the page lock (also * cases which we are happy to fail). And we hold a reference, * so refcount care in invalidate_complete_page's remove_mapping * prevents drop_caches from setting mapping to NULL beneath us. * * The case we do have to guard against is when memory pressure made * shmem_writepage move it from filecache to swapcache beneath us: * an unlikely race, but we do need to retry for page->mapping. */ if (unlikely(!mapping)) { int shmem_swizzled; /* * Page lock is required to identify which special case above * applies. If this is really a shmem page then the page lock * will prevent unexpected transitions. */ lock_page(page); shmem_swizzled = PageSwapCache(page) || page->mapping; unlock_page(page); put_page(page); if (shmem_swizzled) goto again; return -EFAULT; } /* * Private mappings are handled in a simple way. * * If the futex key is stored on an anonymous page, then the associated * object is the mm which is implicitly pinned by the calling process. * * NOTE: When userspace waits on a MAP_SHARED mapping, even if * it's a read-only handle, it's expected that futexes attach to * the object not the particular process. */ if (PageAnon(page)) { /* * A RO anonymous page will never change and thus doesn't make * sense for futex operations. */ if (unlikely(should_fail_futex(fshared)) || ro) { err = -EFAULT; goto out; } key->both.offset |= FUT_OFF_MMSHARED; /* ref taken on mm */ key->private.mm = mm; key->private.address = address; get_futex_key_refs(key); /* implies smp_mb(); (B) */ } else { struct inode *inode; /* * The associated futex object in this case is the inode and * the page->mapping must be traversed. Ordinarily this should * be stabilised under page lock but it's not strictly * necessary in this case as we just want to pin the inode, not * update the radix tree or anything like that. * * The RCU read lock is taken as the inode is finally freed * under RCU. If the mapping still matches expectations then the * mapping->host can be safely accessed as being a valid inode. */ rcu_read_lock(); if (READ_ONCE(page->mapping) != mapping) { rcu_read_unlock(); put_page(page); goto again; } inode = READ_ONCE(mapping->host); if (!inode) { rcu_read_unlock(); put_page(page); goto again; } /* * Take a reference unless it is about to be freed. Previously * this reference was taken by ihold under the page lock * pinning the inode in place so i_lock was unnecessary. The * only way for this check to fail is if the inode was * truncated in parallel which is almost certainly an * application bug. In such a case, just retry. * * We are not calling into get_futex_key_refs() in file-backed * cases, therefore a successful atomic_inc return below will * guarantee that get_futex_key() will still imply smp_mb(); (B). */ if (!atomic_inc_not_zero(&inode->i_count)) { rcu_read_unlock(); put_page(page); goto again; } /* Should be impossible but lets be paranoid for now */ if (WARN_ON_ONCE(inode->i_mapping != mapping)) { err = -EFAULT; rcu_read_unlock(); iput(inode); goto out; } key->both.offset |= FUT_OFF_INODE; /* inode-based key */ key->shared.inode = inode; key->shared.pgoff = basepage_index(tail); rcu_read_unlock(); } out: put_page(page); return err; }
3,037
13,544
0
static void Free_PairSet( HB_PairSet* ps, HB_UShort format1, HB_UShort format2 ) { HB_UShort n, count; HB_PairValueRecord* pvr; if ( ps->PairValueRecord ) { count = ps->PairValueCount; pvr = ps->PairValueRecord; for ( n = 0; n < count; n++ ) { if ( format1 ) Free_ValueRecord( &pvr[n].Value1, format1 ); if ( format2 ) Free_ValueRecord( &pvr[n].Value2, format2 ); } FREE( pvr ); } }
3,038
149,932
0
void LayerTreeHostImpl::DidDrawAllLayers(const FrameData& frame) { for (size_t i = 0; i < frame.will_draw_layers.size(); ++i) frame.will_draw_layers[i]->DidDraw(resource_provider_.get()); for (auto* it : video_frame_controllers_) it->DidDrawFrame(); }
3,039
138,001
0
AXLayoutObject::~AXLayoutObject() { ASSERT(isDetached()); }
3,040
96,476
0
static void AppLayerProtoDetectPEGetIpprotos(AppProto alproto, uint8_t *ipprotos) { if (expectation_proto[alproto] == IPPROTO_TCP) { ipprotos[IPPROTO_TCP / 8] |= 1 << (IPPROTO_TCP % 8); } if (expectation_proto[alproto] == IPPROTO_UDP) { ipprotos[IPPROTO_UDP / 8] |= 1 << (IPPROTO_UDP % 8); } }
3,041
161,553
0
base::string16 GoogleChromeDistribution::GetDistributionData(HKEY root_key) { base::string16 sub_key(google_update::kRegPathClientState); sub_key.append(L"\\"); sub_key.append(install_static::GetAppGuid()); base::win::RegKey client_state_key( root_key, sub_key.c_str(), KEY_READ | KEY_WOW64_32KEY); base::string16 result; base::string16 brand_value; if (client_state_key.ReadValue(google_update::kRegRLZBrandField, &brand_value) == ERROR_SUCCESS) { result = google_update::kRegRLZBrandField; result.append(L"="); result.append(brand_value); result.append(L"&"); } base::string16 client_value; if (client_state_key.ReadValue(google_update::kRegClientField, &client_value) == ERROR_SUCCESS) { result.append(google_update::kRegClientField); result.append(L"="); result.append(client_value); result.append(L"&"); } base::string16 ap_value; client_state_key.ReadValue(google_update::kRegApField, &ap_value); result.append(google_update::kRegApField); result.append(L"="); result.append(ap_value); base::FilePath crash_dir; if (chrome::GetDefaultUserDataDirectory(&crash_dir)) { crash_dir = crash_dir.Append(FILE_PATH_LITERAL("Crashpad")); crashpad::UUID client_id; std::unique_ptr<crashpad::CrashReportDatabase> database( crashpad::CrashReportDatabase::InitializeWithoutCreating(crash_dir)); if (database && database->GetSettings()->GetClientID(&client_id)) result.append(L"&crash_client_id=").append(client_id.ToString16()); } return result; }
3,042
5,285
0
hb_buffer_destroy (hb_buffer_t *buffer) { HB_OBJECT_DO_DESTROY (buffer); hb_unicode_funcs_destroy (buffer->unicode); free (buffer->info); free (buffer->pos); free (buffer); }
3,043
5,517
0
static void *gx_ttfMemory__alloc_struct(ttfMemory *self, const ttfMemoryDescriptor *d, const char *cname) { gs_memory_t *mem = ((gx_ttfMemory *)self)->memory; return mem->procs.alloc_struct(mem, (const gs_memory_struct_type_t *)d, cname); }
3,044
78,629
0
static int piv_find_aid(sc_card_t * card, sc_file_t *aid_file) { sc_apdu_t apdu; u8 rbuf[SC_MAX_APDU_BUFFER_SIZE]; int r,i; const u8 *tag; size_t taglen; const u8 *pix; size_t pixlen; size_t resplen = sizeof(rbuf); SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE); /* first see if the default application will return a template * that we know about. */ r = piv_select_aid(card, piv_aids[0].value, piv_aids[0].len_short, rbuf, &resplen); if (r >= 0 && resplen > 2 ) { tag = sc_asn1_find_tag(card->ctx, rbuf, resplen, 0x61, &taglen); if (tag != NULL) { pix = sc_asn1_find_tag(card->ctx, tag, taglen, 0x4F, &pixlen); if (pix != NULL ) { sc_log(card->ctx, "found PIX"); /* early cards returned full AID, rather then just the pix */ for (i = 0; piv_aids[i].len_long != 0; i++) { if ((pixlen >= 6 && memcmp(pix, piv_aids[i].value + 5, piv_aids[i].len_long - 5 ) == 0) || ((pixlen >= piv_aids[i].len_short && memcmp(pix, piv_aids[i].value, piv_aids[i].len_short) == 0))) { if (card->type > SC_CARD_TYPE_PIV_II_BASE && card->type < SC_CARD_TYPE_PIV_II_BASE+1000 && card->type == piv_aids[i].enumtag) { LOG_FUNC_RETURN(card->ctx, i); } else { LOG_FUNC_RETURN(card->ctx, i); } } } } } } /* for testing, we can force the use of a specific AID * by using the card= parameter in conf file */ for (i = 0; piv_aids[i].len_long != 0; i++) { if (card->type > SC_CARD_TYPE_PIV_II_BASE && card->type < SC_CARD_TYPE_PIV_II_BASE+1000 && card->type != piv_aids[i].enumtag) { continue; } sc_format_apdu(card, &apdu, SC_APDU_CASE_4_SHORT, 0xA4, 0x04, 0x00); apdu.lc = piv_aids[i].len_long; apdu.data = piv_aids[i].value; apdu.datalen = apdu.lc; apdu.resp = rbuf; apdu.resplen = sizeof(rbuf); apdu.le = 256; r = sc_transmit_apdu(card, &apdu); LOG_TEST_RET(card->ctx, r, "APDU transmit failed"); r = sc_check_sw(card, apdu.sw1, apdu.sw2); if (r) { if (card->type != 0 && card->type == piv_aids[i].enumtag) LOG_FUNC_RETURN(card->ctx, (r < 0)? r: i); continue; } if ( apdu.resplen == 0 && r == 0) { /* could be the MSU card */ continue; /* other cards will return a FCI */ } if (apdu.resp[0] != 0x6f || apdu.resp[1] > apdu.resplen - 2 ) SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, SC_ERROR_NO_CARD_SUPPORT); card->ops->process_fci(card, aid_file, apdu.resp+2, apdu.resp[1]); LOG_FUNC_RETURN(card->ctx, i); } LOG_FUNC_RETURN(card->ctx, SC_ERROR_NO_CARD_SUPPORT); }
3,045
120,980
0
virtual void DoCloseFlushPendingWriteTest(SocketStreamEvent* event) { for (size_t i = 0; i < messages_.size(); i++) { std::vector<char> frame; frame.push_back('\0'); frame.insert(frame.end(), messages_[i].begin(), messages_[i].end()); frame.push_back('\xff'); EXPECT_TRUE(event->socket->SendData(&frame[0], frame.size())); } event->socket->Close(); }
3,046
40,893
0
json_t *json_deep_copy(const json_t *json) { if(!json) return NULL; if(json_is_object(json)) return json_object_deep_copy(json); if(json_is_array(json)) return json_array_deep_copy(json); /* for the rest of the types, deep copying doesn't differ from shallow copying */ if(json_is_string(json)) return json_string_copy(json); if(json_is_integer(json)) return json_integer_copy(json); if(json_is_real(json)) return json_real_copy(json); if(json_is_true(json) || json_is_false(json) || json_is_null(json)) return (json_t *)json; return NULL; }
3,047
19,629
0
int nf_ct_frag6_init(void) { nf_frags.hashfn = nf_hashfn; nf_frags.constructor = ip6_frag_init; nf_frags.destructor = NULL; nf_frags.skb_free = nf_skb_free; nf_frags.qsize = sizeof(struct nf_ct_frag6_queue); nf_frags.match = ip6_frag_match; nf_frags.frag_expire = nf_ct_frag6_expire; nf_frags.secret_interval = 10 * 60 * HZ; nf_init_frags.timeout = IPV6_FRAG_TIMEOUT; nf_init_frags.high_thresh = IPV6_FRAG_HIGH_THRESH; nf_init_frags.low_thresh = IPV6_FRAG_LOW_THRESH; inet_frags_init_net(&nf_init_frags); inet_frags_init(&nf_frags); return 0; }
3,048
40,201
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; }
3,049
101,014
0
DumpQuotaTableTask( QuotaManager* manager, Callback* callback) : DatabaseTaskBase(manager), callback_(callback) { }
3,050
68,463
0
static int open_and_lock(char *path) { int fd; struct flock lk; fd = open(path, O_RDWR|O_CREAT, S_IWUSR | S_IRUSR); if (fd < 0) { fprintf(stderr, "Failed to open %s: %s\n", path, strerror(errno)); return(fd); } lk.l_type = F_WRLCK; lk.l_whence = SEEK_SET; lk.l_start = 0; lk.l_len = 0; if (fcntl(fd, F_SETLKW, &lk) < 0) { fprintf(stderr, "Failed to lock %s: %s\n", path, strerror(errno)); close(fd); return -1; } return fd; }
3,051
96,745
0
MagickExport Image *StatisticImage(const Image *image,const StatisticType type, const size_t width,const size_t height,ExceptionInfo *exception) { #define StatisticImageTag "Statistic/Image" CacheView *image_view, *statistic_view; Image *statistic_image; MagickBooleanType status; MagickOffsetType progress; PixelList **magick_restrict pixel_list; ssize_t center, y; /* Initialize statistics image attributes. */ 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); statistic_image=CloneImage(image,0,0,MagickTrue, exception); if (statistic_image == (Image *) NULL) return((Image *) NULL); status=SetImageStorageClass(statistic_image,DirectClass,exception); if (status == MagickFalse) { statistic_image=DestroyImage(statistic_image); return((Image *) NULL); } pixel_list=AcquirePixelListThreadSet(MagickMax(width,1),MagickMax(height,1)); if (pixel_list == (PixelList **) NULL) { statistic_image=DestroyImage(statistic_image); ThrowImageException(ResourceLimitError,"MemoryAllocationFailed"); } /* Make each pixel the min / max / median / mode / etc. of the neighborhood. */ center=(ssize_t) GetPixelChannels(image)*(image->columns+MagickMax(width,1))* (MagickMax(height,1)/2L)+GetPixelChannels(image)*(MagickMax(width,1)/2L); status=MagickTrue; progress=0; image_view=AcquireVirtualCacheView(image,exception); statistic_view=AcquireAuthenticCacheView(statistic_image,exception); #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static) shared(progress,status) \ magick_number_threads(image,statistic_image,statistic_image->rows,1) #endif for (y=0; y < (ssize_t) statistic_image->rows; y++) { const int id = GetOpenMPThreadId(); register const Quantum *magick_restrict p; register Quantum *magick_restrict q; register ssize_t x; if (status == MagickFalse) continue; p=GetCacheViewVirtualPixels(image_view,-((ssize_t) MagickMax(width,1)/2L),y- (ssize_t) (MagickMax(height,1)/2L),image->columns+MagickMax(width,1), MagickMax(height,1),exception); q=QueueCacheViewAuthenticPixels(statistic_view,0,y,statistic_image->columns, 1,exception); if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL)) { status=MagickFalse; continue; } for (x=0; x < (ssize_t) statistic_image->columns; x++) { register ssize_t i; for (i=0; i < (ssize_t) GetPixelChannels(image); i++) { Quantum pixel; register const Quantum *magick_restrict pixels; register ssize_t u; ssize_t v; PixelChannel channel = GetPixelChannelChannel(image,i); PixelTrait traits = GetPixelChannelTraits(image,channel); PixelTrait statistic_traits=GetPixelChannelTraits(statistic_image, channel); if ((traits == UndefinedPixelTrait) || (statistic_traits == UndefinedPixelTrait)) continue; if (((statistic_traits & CopyPixelTrait) != 0) || (GetPixelWriteMask(image,p) <= (QuantumRange/2))) { SetPixelChannel(statistic_image,channel,p[center+i],q); continue; } if ((statistic_traits & UpdatePixelTrait) == 0) continue; pixels=p; ResetPixelList(pixel_list[id]); for (v=0; v < (ssize_t) MagickMax(height,1); v++) { for (u=0; u < (ssize_t) MagickMax(width,1); u++) { InsertPixelList(pixels[i],pixel_list[id]); pixels+=GetPixelChannels(image); } pixels+=GetPixelChannels(image)*image->columns; } switch (type) { case GradientStatistic: { double maximum, minimum; GetMinimumPixelList(pixel_list[id],&pixel); minimum=(double) pixel; GetMaximumPixelList(pixel_list[id],&pixel); maximum=(double) pixel; pixel=ClampToQuantum(MagickAbsoluteValue(maximum-minimum)); break; } case MaximumStatistic: { GetMaximumPixelList(pixel_list[id],&pixel); break; } case MeanStatistic: { GetMeanPixelList(pixel_list[id],&pixel); break; } case MedianStatistic: default: { GetMedianPixelList(pixel_list[id],&pixel); break; } case MinimumStatistic: { GetMinimumPixelList(pixel_list[id],&pixel); break; } case ModeStatistic: { GetModePixelList(pixel_list[id],&pixel); break; } case NonpeakStatistic: { GetNonpeakPixelList(pixel_list[id],&pixel); break; } case RootMeanSquareStatistic: { GetRootMeanSquarePixelList(pixel_list[id],&pixel); break; } case StandardDeviationStatistic: { GetStandardDeviationPixelList(pixel_list[id],&pixel); break; } } SetPixelChannel(statistic_image,channel,pixel,q); } p+=GetPixelChannels(image); q+=GetPixelChannels(statistic_image); } if (SyncCacheViewAuthenticPixels(statistic_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,StatisticImageTag,progress,image->rows); if (proceed == MagickFalse) status=MagickFalse; } } statistic_view=DestroyCacheView(statistic_view); image_view=DestroyCacheView(image_view); pixel_list=DestroyPixelListThreadSet(pixel_list); if (status == MagickFalse) statistic_image=DestroyImage(statistic_image); return(statistic_image); }
3,052
74,756
0
ia64_patch_vtop (unsigned long start, unsigned long end) { s32 *offp = (s32 *) start; u64 ip; while (offp < (s32 *) end) { ip = (u64) offp + *offp; /* replace virtual address with corresponding physical address: */ ia64_patch_imm64(ip, ia64_tpa(get_imm64(ip))); ia64_fc((void *) ip); ++offp; } ia64_sync_i(); ia64_srlz_i(); }
3,053
105,861
0
WebPluginAcceleratedSurfaceProxy::WebPluginAcceleratedSurfaceProxy( WebPluginProxy* plugin_proxy) : plugin_proxy_(plugin_proxy), window_handle_(NULL) { surface_ = new AcceleratedSurface; if (!surface_->Initialize(NULL, true)) { delete surface_; surface_ = NULL; return; } surface_->SetTransportDIBAllocAndFree( NewCallback(plugin_proxy_, &WebPluginProxy::AllocSurfaceDIB), NewCallback(plugin_proxy_, &WebPluginProxy::FreeSurfaceDIB)); }
3,054
156,066
0
int GetTimesStandardThrottlesAddedForURL(const GURL& url) { int count; base::RunLoop run_loop; base::PostTaskWithTraitsAndReply( FROM_HERE, {content::BrowserThread::IO}, base::BindOnce( &TestDispatcherHostDelegate::GetTimesStandardThrottlesAddedForURL, base::Unretained(dispatcher_host_delegate_.get()), url, &count), run_loop.QuitClosure()); run_loop.Run(); return count; }
3,055
161,199
0
void OnRedirectQueryComplete(std::vector<GURL>* rv, const history::RedirectList* redirects) { rv->insert(rv->end(), redirects->begin(), redirects->end()); base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); }
3,056
87,104
0
CJSON_PUBLIC(cJSON *) cJSON_CreateFalse(void) { cJSON *item = cJSON_New_Item(&global_hooks); if(item) { item->type = cJSON_False; } return item; }
3,057
172,971
0
static void rpng2_win_init() { ulg i; ulg rowbytes = rpng2_info.rowbytes; Trace((stderr, "beginning rpng2_win_init()\n")) Trace((stderr, " rowbytes = %d\n", rpng2_info.rowbytes)) Trace((stderr, " width = %ld\n", rpng2_info.width)) Trace((stderr, " height = %ld\n", rpng2_info.height)) rpng2_info.image_data = (uch *)malloc(rowbytes * rpng2_info.height); if (!rpng2_info.image_data) { readpng2_cleanup(&rpng2_info); return; } rpng2_info.row_pointers = (uch **)malloc(rpng2_info.height * sizeof(uch *)); if (!rpng2_info.row_pointers) { free(rpng2_info.image_data); rpng2_info.image_data = NULL; readpng2_cleanup(&rpng2_info); return; } for (i = 0; i < rpng2_info.height; ++i) rpng2_info.row_pointers[i] = rpng2_info.image_data + i*rowbytes; /*--------------------------------------------------------------------------- Do the basic Windows initialization stuff, make the window, and fill it with the user-specified, file-specified or default background color. ---------------------------------------------------------------------------*/ if (rpng2_win_create_window()) { readpng2_cleanup(&rpng2_info); return; } rpng2_info.state = kWindowInit; }
3,058
168,707
0
DocumentLoadTiming* PerformanceNavigationTiming::GetDocumentLoadTiming() const { DocumentLoader* loader = GetDocumentLoader(); if (!loader) return nullptr; return &loader->GetTiming(); }
3,059
86,679
0
int blk_mq_alloc_tag_set(struct blk_mq_tag_set *set) { BUILD_BUG_ON(BLK_MQ_MAX_DEPTH > 1 << BLK_MQ_UNIQUE_TAG_BITS); if (!set->nr_hw_queues) return -EINVAL; if (!set->queue_depth) return -EINVAL; if (set->queue_depth < set->reserved_tags + BLK_MQ_TAG_MIN) return -EINVAL; if (!set->ops->queue_rq || !set->ops->map_queue) return -EINVAL; if (set->queue_depth > BLK_MQ_MAX_DEPTH) { pr_info("blk-mq: reduced tag depth to %u\n", BLK_MQ_MAX_DEPTH); set->queue_depth = BLK_MQ_MAX_DEPTH; } /* * If a crashdump is active, then we are potentially in a very * memory constrained environment. Limit us to 1 queue and * 64 tags to prevent using too much memory. */ if (is_kdump_kernel()) { set->nr_hw_queues = 1; set->queue_depth = min(64U, set->queue_depth); } set->tags = kmalloc_node(set->nr_hw_queues * sizeof(struct blk_mq_tags *), GFP_KERNEL, set->numa_node); if (!set->tags) return -ENOMEM; if (blk_mq_alloc_rq_maps(set)) goto enomem; mutex_init(&set->tag_list_lock); INIT_LIST_HEAD(&set->tag_list); return 0; enomem: kfree(set->tags); set->tags = NULL; return -ENOMEM; }
3,060
147,891
0
static void TestDictionaryMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) { TestObject* impl = V8TestObject::ToImpl(info.Holder()); TestDictionary* result = impl->testDictionaryMethod(); V8SetReturnValue(info, result); }
3,061
11,244
0
static int php_snmp_write_max_oids(php_snmp_object *snmp_object, zval *newval) { zval ztmp; int ret = SUCCESS; if (Z_TYPE_P(newval) == IS_NULL) { snmp_object->max_oids = 0; return ret; } if (Z_TYPE_P(newval) != IS_LONG) { ztmp = *newval; zval_copy_ctor(&ztmp); convert_to_long(&ztmp); newval = &ztmp; } if (Z_LVAL_P(newval) > 0) { snmp_object->max_oids = Z_LVAL_P(newval); } else { php_error_docref(NULL, E_WARNING, "max_oids should be positive integer or NULL, got %pd", Z_LVAL_P(newval)); } if (newval == &ztmp) { zval_dtor(newval); } return ret; }
3,062
3,343
0
static void fdctrl_stop_transfer(FDCtrl *fdctrl, uint8_t status0, uint8_t status1, uint8_t status2) { FDrive *cur_drv; cur_drv = get_cur_drv(fdctrl); fdctrl->status0 &= ~(FD_SR0_DS0 | FD_SR0_DS1 | FD_SR0_HEAD); fdctrl->status0 |= GET_CUR_DRV(fdctrl); if (cur_drv->head) { fdctrl->status0 |= FD_SR0_HEAD; } fdctrl->status0 |= status0; FLOPPY_DPRINTF("transfer status: %02x %02x %02x (%02x)\n", status0, status1, status2, fdctrl->status0); fdctrl->fifo[0] = fdctrl->status0; fdctrl->fifo[1] = status1; fdctrl->fifo[2] = status2; fdctrl->fifo[3] = cur_drv->track; fdctrl->fifo[4] = cur_drv->head; fdctrl->fifo[5] = cur_drv->sect; fdctrl->fifo[6] = FD_SECTOR_SC; fdctrl->data_dir = FD_DIR_READ; if (!(fdctrl->msr & FD_MSR_NONDMA)) { DMA_release_DREQ(fdctrl->dma_chann); } fdctrl->msr |= FD_MSR_RQM | FD_MSR_DIO; fdctrl->msr &= ~FD_MSR_NONDMA; fdctrl_set_fifo(fdctrl, 7); fdctrl_raise_irq(fdctrl); }
3,063
77,146
0
OVS_REQUIRES(ofproto_mutex) { uint32_t hash = hash_learned_cookie(learn->cookie, learn->table_id); struct learned_cookie *c; HMAP_FOR_EACH_WITH_HASH (c, u.hmap_node, hash, &ofproto->learned_cookies) { if (c->cookie == learn->cookie && c->table_id == learn->table_id) { c->n += delta; ovs_assert(c->n >= 0); if (!c->n) { hmap_remove(&ofproto->learned_cookies, &c->u.hmap_node); ovs_list_push_back(dead_cookies, &c->u.list_node); } return; } } ovs_assert(delta > 0); c = xmalloc(sizeof *c); hmap_insert(&ofproto->learned_cookies, &c->u.hmap_node, hash); c->cookie = learn->cookie; c->table_id = learn->table_id; c->n = delta; }
3,064
23,288
0
static int decode_attr_time_metadata(struct xdr_stream *xdr, uint32_t *bitmap, struct timespec *time) { int status = 0; time->tv_sec = 0; time->tv_nsec = 0; if (unlikely(bitmap[1] & (FATTR4_WORD1_TIME_METADATA - 1U))) return -EIO; if (likely(bitmap[1] & FATTR4_WORD1_TIME_METADATA)) { status = decode_attr_time(xdr, time); if (status == 0) status = NFS_ATTR_FATTR_CTIME; bitmap[1] &= ~FATTR4_WORD1_TIME_METADATA; } dprintk("%s: ctime=%ld\n", __func__, (long)time->tv_sec); return status; }
3,065
44,661
0
static int unpriv_assign_nic(struct lxc_netdev *netdev, pid_t pid) { pid_t child; int bytes, pipefd[2]; char *token, *saveptr = NULL; char buffer[MAX_BUFFER_SIZE]; char netdev_link[IFNAMSIZ+1]; if (netdev->type != LXC_NET_VETH) { ERROR("nic type %d not support for unprivileged use", netdev->type); return -1; } if(pipe(pipefd) < 0) { SYSERROR("pipe failed"); return -1; } if ((child = fork()) < 0) { SYSERROR("fork"); close(pipefd[0]); close(pipefd[1]); return -1; } if (child == 0) { // child /* close the read-end of the pipe */ close(pipefd[0]); /* redirect the stdout to write-end of the pipe */ dup2(pipefd[1], STDOUT_FILENO); /* close the write-end of the pipe */ close(pipefd[1]); char pidstr[20]; if (netdev->link) { strncpy(netdev_link, netdev->link, IFNAMSIZ); } else { strncpy(netdev_link, "none", IFNAMSIZ); } char *args[] = {LXC_USERNIC_PATH, pidstr, "veth", netdev_link, netdev->name, NULL }; snprintf(pidstr, 19, "%lu", (unsigned long) pid); pidstr[19] = '\0'; execvp(args[0], args); SYSERROR("execvp lxc-user-nic"); exit(1); } /* close the write-end of the pipe */ close(pipefd[1]); bytes = read(pipefd[0], &buffer, MAX_BUFFER_SIZE); if (bytes < 0) { SYSERROR("read failed"); } buffer[bytes - 1] = '\0'; if (wait_for_pid(child) != 0) { close(pipefd[0]); return -1; } /* close the read-end of the pipe */ close(pipefd[0]); /* fill netdev->name field */ token = strtok_r(buffer, ":", &saveptr); if (!token) return -1; netdev->name = malloc(IFNAMSIZ+1); if (!netdev->name) { ERROR("Out of memory"); return -1; } memset(netdev->name, 0, IFNAMSIZ+1); strncpy(netdev->name, token, IFNAMSIZ); /* fill netdev->veth_attr.pair field */ token = strtok_r(NULL, ":", &saveptr); if (!token) return -1; netdev->priv.veth_attr.pair = strdup(token); if (!netdev->priv.veth_attr.pair) { ERROR("Out of memory"); return -1; } return 0; }
3,066
42,186
0
static int sane_rt_signal_32_frame(unsigned int sp) { struct rt_signal_frame_32 __user *sf; unsigned int regs; sf = (struct rt_signal_frame_32 __user *) (unsigned long) sp; if (read_user_stack_32((unsigned int __user *) &sf->uc.uc_regs, &regs)) return 0; return regs == (unsigned long) &sf->uc.uc_mcontext; }
3,067
46,057
0
xdr_gprinc_arg(XDR *xdrs, gprinc_arg *objp) { if (!xdr_ui_4(xdrs, &objp->api_version)) { return (FALSE); } if (!xdr_krb5_principal(xdrs, &objp->princ)) { return (FALSE); } if (!xdr_long(xdrs, &objp->mask)) { return FALSE; } return (TRUE); }
3,068
46,207
0
static int set_bdev_super(struct super_block *s, void *data) { s->s_bdev = data; s->s_dev = s->s_bdev->bd_dev; /* * We set the bdi here to the queue backing, file systems can * overwrite this in ->fill_super() */ s->s_bdi = &bdev_get_queue(s->s_bdev)->backing_dev_info; return 0; }
3,069
69,697
0
entry_guards_update_confirmed(guard_selection_t *gs) { smartlist_clear(gs->confirmed_entry_guards); SMARTLIST_FOREACH_BEGIN(gs->sampled_entry_guards, entry_guard_t *, guard) { if (guard->confirmed_idx >= 0) smartlist_add(gs->confirmed_entry_guards, guard); } SMARTLIST_FOREACH_END(guard); smartlist_sort(gs->confirmed_entry_guards, compare_guards_by_confirmed_idx); int any_changed = 0; SMARTLIST_FOREACH_BEGIN(gs->confirmed_entry_guards, entry_guard_t *, guard) { if (guard->confirmed_idx != guard_sl_idx) { any_changed = 1; guard->confirmed_idx = guard_sl_idx; } } SMARTLIST_FOREACH_END(guard); gs->next_confirmed_idx = smartlist_len(gs->confirmed_entry_guards); if (any_changed) { entry_guards_changed_for_guard_selection(gs); } }
3,070
128,593
0
bool Instance::IsPrintScalingDisabled() { return !engine_->GetPrintScaling(); }
3,071
23,554
0
static void flakey_map_bio(struct dm_target *ti, struct bio *bio) { struct flakey_c *fc = ti->private; bio->bi_bdev = fc->dev->bdev; if (bio_sectors(bio)) bio->bi_sector = flakey_map_sector(ti, bio->bi_sector); }
3,072
52,180
0
PHP_NAMED_FUNCTION(php_if_fopen) { char *filename, *mode; int filename_len, mode_len; zend_bool use_include_path = 0; zval *zcontext = NULL; php_stream *stream; php_stream_context *context = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ps|br", &filename, &filename_len, &mode, &mode_len, &use_include_path, &zcontext) == FAILURE) { RETURN_FALSE; } context = php_stream_context_from_zval(zcontext, 0); stream = php_stream_open_wrapper_ex(filename, mode, (use_include_path ? USE_PATH : 0) | REPORT_ERRORS, NULL, context); if (stream == NULL) { RETURN_FALSE; } php_stream_to_zval(stream, return_value); }
3,073
175,857
0
StatusOr<uint16_t> convertStringAddress(std::string addr, uint8_t* buffer) { if (inet_pton(AF_INET, addr.c_str(), buffer) == 1) { return AF_INET; } else if (inet_pton(AF_INET6, addr.c_str(), buffer) == 1) { return AF_INET6; } else { return Status(EAFNOSUPPORT); } }
3,074
56,938
0
static int fuse_fsync(struct file *file, loff_t start, loff_t end, int datasync) { return fuse_fsync_common(file, start, end, datasync, 0); }
3,075
177,104
0
SoftAMRWBEncoder::~SoftAMRWBEncoder() { if (mEncoderHandle != NULL) { CHECK_EQ(VO_ERR_NONE, mApiHandle->Uninit(mEncoderHandle)); mEncoderHandle = NULL; } delete mApiHandle; mApiHandle = NULL; delete mMemOperator; mMemOperator = NULL; }
3,076
151,660
0
void Browser::CloseModalSigninWindow() { signin_view_controller_.CloseModalSignin(); }
3,077
89,222
0
set_mml(MinMax* l, OnigLen min, OnigLen max) { l->min = min; l->max = max; }
3,078
52,429
0
void xt_proto_fini(struct net *net, u_int8_t af) { #ifdef CONFIG_PROC_FS char buf[XT_FUNCTION_MAXNAMELEN]; strlcpy(buf, xt_prefix[af], sizeof(buf)); strlcat(buf, FORMAT_TABLES, sizeof(buf)); remove_proc_entry(buf, net->proc_net); strlcpy(buf, xt_prefix[af], sizeof(buf)); strlcat(buf, FORMAT_TARGETS, sizeof(buf)); remove_proc_entry(buf, net->proc_net); strlcpy(buf, xt_prefix[af], sizeof(buf)); strlcat(buf, FORMAT_MATCHES, sizeof(buf)); remove_proc_entry(buf, net->proc_net); #endif /*CONFIG_PROC_FS*/ }
3,079
43,770
0
no_ci_flags(OM_uint32 *minor_status, gss_cred_id_t *cred_handle, const gss_OID desired_oid, const gss_buffer_t value) { krb5_gss_cred_id_t cred; cred = (krb5_gss_cred_id_t) *cred_handle; cred->suppress_ci_flags = 1; *minor_status = 0; return GSS_S_COMPLETE; }
3,080
134,665
0
static STGMEDIUM* GetStorageForFileName(const base::FilePath& path) { const size_t kDropSize = sizeof(DROPFILES); const size_t kTotalBytes = kDropSize + (path.value().length() + 2) * sizeof(wchar_t); HANDLE hdata = GlobalAlloc(GMEM_MOVEABLE, kTotalBytes); base::win::ScopedHGlobal<DROPFILES> locked_mem(hdata); DROPFILES* drop_files = locked_mem.get(); drop_files->pFiles = sizeof(DROPFILES); drop_files->fWide = TRUE; wchar_t* data = reinterpret_cast<wchar_t*>( reinterpret_cast<BYTE*>(drop_files) + kDropSize); const size_t copy_size = (path.value().length() + 1) * sizeof(wchar_t); memcpy(data, path.value().c_str(), copy_size); data[path.value().length() + 1] = L'\0'; // Double NULL STGMEDIUM* storage = new STGMEDIUM; storage->tymed = TYMED_HGLOBAL; storage->hGlobal = hdata; storage->pUnkForRelease = NULL; return storage; }
3,081
92,259
0
XML_Parse(XML_Parser parser, const char *s, int len, int isFinal) { if ((parser == NULL) || (len < 0) || ((s == NULL) && (len != 0))) { if (parser != NULL) parser->m_errorCode = XML_ERROR_INVALID_ARGUMENT; return XML_STATUS_ERROR; } switch (parser->m_parsingStatus.parsing) { case XML_SUSPENDED: parser->m_errorCode = XML_ERROR_SUSPENDED; return XML_STATUS_ERROR; case XML_FINISHED: parser->m_errorCode = XML_ERROR_FINISHED; return XML_STATUS_ERROR; case XML_INITIALIZED: if (parser->m_parentParser == NULL && !startParsing(parser)) { parser->m_errorCode = XML_ERROR_NO_MEMORY; return XML_STATUS_ERROR; } /* fall through */ default: parser->m_parsingStatus.parsing = XML_PARSING; } if (len == 0) { parser->m_parsingStatus.finalBuffer = (XML_Bool)isFinal; if (!isFinal) return XML_STATUS_OK; parser->m_positionPtr = parser->m_bufferPtr; parser->m_parseEndPtr = parser->m_bufferEnd; /* If data are left over from last buffer, and we now know that these data are the final chunk of input, then we have to check them again to detect errors based on that fact. */ parser->m_errorCode = parser->m_processor(parser, parser->m_bufferPtr, parser->m_parseEndPtr, &parser->m_bufferPtr); if (parser->m_errorCode == XML_ERROR_NONE) { switch (parser->m_parsingStatus.parsing) { case XML_SUSPENDED: /* It is hard to be certain, but it seems that this case * cannot occur. This code is cleaning up a previous parse * with no new data (since len == 0). Changing the parsing * state requires getting to execute a handler function, and * there doesn't seem to be an opportunity for that while in * this circumstance. * * Given the uncertainty, we retain the code but exclude it * from coverage tests. * * LCOV_EXCL_START */ XmlUpdatePosition(parser->m_encoding, parser->m_positionPtr, parser->m_bufferPtr, &parser->m_position); parser->m_positionPtr = parser->m_bufferPtr; return XML_STATUS_SUSPENDED; /* LCOV_EXCL_STOP */ case XML_INITIALIZED: case XML_PARSING: parser->m_parsingStatus.parsing = XML_FINISHED; /* fall through */ default: return XML_STATUS_OK; } } parser->m_eventEndPtr = parser->m_eventPtr; parser->m_processor = errorProcessor; return XML_STATUS_ERROR; } #ifndef XML_CONTEXT_BYTES else if (parser->m_bufferPtr == parser->m_bufferEnd) { const char *end; int nLeftOver; enum XML_Status result; /* Detect overflow (a+b > MAX <==> b > MAX-a) */ if (len > ((XML_Size)-1) / 2 - parser->m_parseEndByteIndex) { parser->m_errorCode = XML_ERROR_NO_MEMORY; parser->m_eventPtr = parser->m_eventEndPtr = NULL; parser->m_processor = errorProcessor; return XML_STATUS_ERROR; } parser->m_parseEndByteIndex += len; parser->m_positionPtr = s; parser->m_parsingStatus.finalBuffer = (XML_Bool)isFinal; parser->m_errorCode = parser->m_processor(parser, s, parser->m_parseEndPtr = s + len, &end); if (parser->m_errorCode != XML_ERROR_NONE) { parser->m_eventEndPtr = parser->m_eventPtr; parser->m_processor = errorProcessor; return XML_STATUS_ERROR; } else { switch (parser->m_parsingStatus.parsing) { case XML_SUSPENDED: result = XML_STATUS_SUSPENDED; break; case XML_INITIALIZED: case XML_PARSING: if (isFinal) { parser->m_parsingStatus.parsing = XML_FINISHED; return XML_STATUS_OK; } /* fall through */ default: result = XML_STATUS_OK; } } XmlUpdatePosition(parser->m_encoding, parser->m_positionPtr, end, &parser->m_position); nLeftOver = s + len - end; if (nLeftOver) { if (parser->m_buffer == NULL || nLeftOver > parser->m_bufferLim - parser->m_buffer) { /* avoid _signed_ integer overflow */ char *temp = NULL; const int bytesToAllocate = (int)((unsigned)len * 2U); if (bytesToAllocate > 0) { temp = (char *)REALLOC(parser, parser->m_buffer, bytesToAllocate); } if (temp == NULL) { parser->m_errorCode = XML_ERROR_NO_MEMORY; parser->m_eventPtr = parser->m_eventEndPtr = NULL; parser->m_processor = errorProcessor; return XML_STATUS_ERROR; } parser->m_buffer = temp; parser->m_bufferLim = parser->m_buffer + bytesToAllocate; } memcpy(parser->m_buffer, end, nLeftOver); } parser->m_bufferPtr = parser->m_buffer; parser->m_bufferEnd = parser->m_buffer + nLeftOver; parser->m_positionPtr = parser->m_bufferPtr; parser->m_parseEndPtr = parser->m_bufferEnd; parser->m_eventPtr = parser->m_bufferPtr; parser->m_eventEndPtr = parser->m_bufferPtr; return result; } #endif /* not defined XML_CONTEXT_BYTES */ else { void *buff = XML_GetBuffer(parser, len); if (buff == NULL) return XML_STATUS_ERROR; else { memcpy(buff, s, len); return XML_ParseBuffer(parser, len, isFinal); } } }
3,082
98,191
0
void TranslateManager::ReportLanguageDetectionError(TabContents* tab_contents) { UMA_HISTOGRAM_COUNTS("Translate.ReportLanguageDetectionError", 1); GURL page_url = tab_contents->controller().GetActiveEntry()->url(); std::string report_error_url(kReportLanguageDetectionErrorURL); report_error_url += "?client=cr&action=langidc&u="; report_error_url += EscapeUrlEncodedData(page_url.spec()); report_error_url += "&sl="; report_error_url += tab_contents->language_state().original_language(); report_error_url += "&hl="; report_error_url += GetLanguageCode(g_browser_process->GetApplicationLocale()); Browser* browser = BrowserList::GetLastActive(); if (!browser) { NOTREACHED(); return; } browser->AddTabWithURL(GURL(report_error_url), GURL(), PageTransition::AUTO_BOOKMARK, -1, TabStripModel::ADD_SELECTED, NULL, std::string(), NULL); }
3,083
122,841
0
~CompositorSwapClient() { }
3,084
148,602
0
WebContentsImpl::~WebContentsImpl() { CHECK(!is_being_destroyed_); is_being_destroyed_ = true; CHECK(!is_notifying_observers_); rwh_input_event_router_.reset(); for (auto& entry : binding_sets_) entry.second->CloseAllBindings(); WebContentsImpl* outermost = GetOutermostWebContents(); if (this != outermost && ContainsOrIsFocusedWebContents()) { outermost->SetAsFocusedWebContentsIfNecessary(); } for (FrameTreeNode* node : frame_tree_.Nodes()) { node->render_manager()->ClearRFHsPendingShutdown(); node->render_manager()->ClearWebUIInstances(); } for (RenderWidgetHostImpl* widget : created_widgets_) widget->DetachDelegate(); created_widgets_.clear(); if (dialog_manager_) { dialog_manager_->CancelDialogs(this, /*reset_state=*/true); } if (color_chooser_info_.get()) color_chooser_info_->chooser->End(); NotifyDisconnected(); NotificationService::current()->Notify( NOTIFICATION_WEB_CONTENTS_DESTROYED, Source<WebContents>(this), NotificationService::NoDetails()); frame_tree_.root()->ResetForNewProcess(); GetRenderManager()->ResetProxyHosts(); RenderFrameHostManager* root = GetRenderManager(); if (root->pending_frame_host()) { root->pending_frame_host()->SetRenderFrameCreated(false); root->pending_frame_host()->SetNavigationHandle( std::unique_ptr<NavigationHandleImpl>()); } root->current_frame_host()->SetRenderFrameCreated(false); root->current_frame_host()->SetNavigationHandle( std::unique_ptr<NavigationHandleImpl>()); if (IsBrowserSideNavigationEnabled()) { frame_tree_.root()->ResetNavigationRequest(true, true); if (root->speculative_frame_host()) { root->speculative_frame_host()->SetRenderFrameCreated(false); root->speculative_frame_host()->SetNavigationHandle( std::unique_ptr<NavigationHandleImpl>()); } } #if BUILDFLAG(ENABLE_PLUGINS) pepper_playback_observer_.reset(); #endif // defined(ENABLED_PLUGINS) for (auto& observer : observers_) observer.FrameDeleted(root->current_frame_host()); if (root->pending_render_view_host()) { for (auto& observer : observers_) observer.RenderViewDeleted(root->pending_render_view_host()); } for (auto& observer : observers_) observer.RenderViewDeleted(root->current_host()); for (auto& observer : observers_) observer.WebContentsDestroyed(); for (auto& observer : observers_) observer.ResetWebContents(); SetDelegate(NULL); }
3,085
41,356
0
static void kvm_arch_set_tsc_khz(struct kvm *kvm, u32 this_tsc_khz) { /* Compute a scale to convert nanoseconds in TSC cycles */ kvm_get_time_scale(this_tsc_khz, NSEC_PER_SEC / 1000, &kvm->arch.virtual_tsc_shift, &kvm->arch.virtual_tsc_mult); kvm->arch.virtual_tsc_khz = this_tsc_khz; }
3,086
41,039
0
cmsBool _Remove1Op(cmsPipeline* Lut, cmsStageSignature UnaryOp) { cmsStage** pt = &Lut ->Elements; cmsBool AnyOpt = FALSE; while (*pt != NULL) { if ((*pt) ->Implements == UnaryOp) { _RemoveElement(pt); AnyOpt = TRUE; } else pt = &((*pt) -> Next); } return AnyOpt; }
3,087
82,183
0
mrb_method_missing(mrb_state *mrb, mrb_sym name, mrb_value self, mrb_value args) { mrb_no_method_error(mrb, name, args, "undefined method '%S'", mrb_sym2str(mrb, name)); }
3,088
24,803
0
static inline struct kmem_cache_cpu *get_cpu_slab(struct kmem_cache *s, int cpu) { #ifdef CONFIG_SMP return s->cpu_slab[cpu]; #else return &s->cpu_slab; #endif }
3,089
84,496
0
followForm(void) { _followForm(FALSE); }
3,090
139,648
0
StereoPannerNode* AudioContext::createStereoPanner() { ASSERT(isMainThread()); return StereoPannerNode::create(this, m_destinationNode->sampleRate()); }
3,091
141,381
0
Document::~Document() { DCHECK(!GetLayoutView()); DCHECK(!ParentTreeScope()); DCHECK(!ax_object_cache_); InstanceCounters::DecrementCounter(InstanceCounters::kDocumentCounter); }
3,092
116,640
0
bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) { WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL; if (main_frame) content::GetContentClient()->SetActiveURL(main_frame->document().url()); ObserverListBase<RenderViewObserver>::Iterator it(observers_); RenderViewObserver* observer; while ((observer = it.GetNext()) != NULL) if (observer->OnMessageReceived(message)) return true; bool handled = true; bool msg_is_ok = true; IPC_BEGIN_MESSAGE_MAP_EX(RenderViewImpl, message, msg_is_ok) IPC_MESSAGE_HANDLER(ViewMsg_Navigate, OnNavigate) IPC_MESSAGE_HANDLER(ViewMsg_Stop, OnStop) IPC_MESSAGE_HANDLER(ViewMsg_ReloadFrame, OnReloadFrame) IPC_MESSAGE_HANDLER(ViewMsg_Undo, OnUndo) IPC_MESSAGE_HANDLER(ViewMsg_Redo, OnRedo) IPC_MESSAGE_HANDLER(ViewMsg_Cut, OnCut) IPC_MESSAGE_HANDLER(ViewMsg_Copy, OnCopy) #if defined(OS_MACOSX) IPC_MESSAGE_HANDLER(ViewMsg_CopyToFindPboard, OnCopyToFindPboard) #endif IPC_MESSAGE_HANDLER(ViewMsg_Paste, OnPaste) IPC_MESSAGE_HANDLER(ViewMsg_PasteAndMatchStyle, OnPasteAndMatchStyle) IPC_MESSAGE_HANDLER(ViewMsg_Replace, OnReplace) IPC_MESSAGE_HANDLER(ViewMsg_Delete, OnDelete) IPC_MESSAGE_HANDLER(ViewMsg_SelectAll, OnSelectAll) IPC_MESSAGE_HANDLER(ViewMsg_SelectRange, OnSelectRange) IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) IPC_MESSAGE_HANDLER(ViewMsg_ExecuteEditCommand, OnExecuteEditCommand) IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind) IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding) IPC_MESSAGE_HANDLER(ViewMsg_FindReplyACK, OnFindReplyAck) IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevel, OnSetZoomLevel) IPC_MESSAGE_HANDLER(ViewMsg_ZoomFactor, OnZoomFactor) IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, OnSetZoomLevelForLoadingURL) IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, OnResetPageEncodingToDefault) IPC_MESSAGE_HANDLER(ViewMsg_ScriptEvalRequest, OnScriptEvalRequest) IPC_MESSAGE_HANDLER(ViewMsg_CSSInsertRequest, OnCSSInsertRequest) IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave) IPC_MESSAGE_HANDLER(DragMsg_TargetDrop, OnDragTargetDrop) IPC_MESSAGE_HANDLER(DragMsg_SourceEndedOrMoved, OnDragSourceEndedOrMoved) IPC_MESSAGE_HANDLER(DragMsg_SourceSystemDragEnded, OnDragSourceSystemDragEnded) IPC_MESSAGE_HANDLER(ViewMsg_AllowBindings, OnAllowBindings) IPC_MESSAGE_HANDLER(ViewMsg_SetWebUIProperty, OnSetWebUIProperty) IPC_MESSAGE_HANDLER(ViewMsg_SetInitialFocus, OnSetInitialFocus) IPC_MESSAGE_HANDLER(ViewMsg_ScrollFocusedEditableNodeIntoRect, OnScrollFocusedEditableNodeIntoRect) IPC_MESSAGE_HANDLER(ViewMsg_UpdateTargetURL_ACK, OnUpdateTargetURLAck) IPC_MESSAGE_HANDLER(ViewMsg_UpdateWebPreferences, OnUpdateWebPreferences) IPC_MESSAGE_HANDLER(ViewMsg_SetAltErrorPageURL, OnSetAltErrorPageURL) IPC_MESSAGE_HANDLER(ViewMsg_EnumerateDirectoryResponse, OnEnumerateDirectoryResponse) IPC_MESSAGE_HANDLER(ViewMsg_RunFileChooserResponse, OnFileChooserResponse) IPC_MESSAGE_HANDLER(ViewMsg_ShouldClose, OnShouldClose) IPC_MESSAGE_HANDLER(ViewMsg_SwapOut, OnSwapOut) IPC_MESSAGE_HANDLER(ViewMsg_ClosePage, OnClosePage) IPC_MESSAGE_HANDLER(ViewMsg_ThemeChanged, OnThemeChanged) IPC_MESSAGE_HANDLER(ViewMsg_DisassociateFromPopupCount, OnDisassociateFromPopupCount) IPC_MESSAGE_HANDLER(ViewMsg_MoveOrResizeStarted, OnMoveOrResizeStarted) IPC_MESSAGE_HANDLER(ViewMsg_ClearFocusedNode, OnClearFocusedNode) IPC_MESSAGE_HANDLER(ViewMsg_SetBackground, OnSetBackground) IPC_MESSAGE_HANDLER(ViewMsg_EnablePreferredSizeChangedMode, OnEnablePreferredSizeChangedMode) IPC_MESSAGE_HANDLER(ViewMsg_EnableAutoResize, OnEnableAutoResize) IPC_MESSAGE_HANDLER(ViewMsg_DisableAutoResize, OnDisableAutoResize) IPC_MESSAGE_HANDLER(ViewMsg_DisableScrollbarsForSmallWindows, OnDisableScrollbarsForSmallWindows) IPC_MESSAGE_HANDLER(ViewMsg_SetRendererPrefs, OnSetRendererPrefs) IPC_MESSAGE_HANDLER(ViewMsg_MediaPlayerActionAt, OnMediaPlayerActionAt) IPC_MESSAGE_HANDLER(ViewMsg_PluginActionAt, OnPluginActionAt) IPC_MESSAGE_HANDLER(ViewMsg_SetActive, OnSetActive) IPC_MESSAGE_HANDLER(ViewMsg_SetNavigationStartTime, OnSetNavigationStartTime) #if defined(OS_MACOSX) IPC_MESSAGE_HANDLER(ViewMsg_SetWindowVisibility, OnSetWindowVisibility) IPC_MESSAGE_HANDLER(ViewMsg_WindowFrameChanged, OnWindowFrameChanged) IPC_MESSAGE_HANDLER(ViewMsg_PluginImeCompositionCompleted, OnPluginImeCompositionCompleted) #endif IPC_MESSAGE_HANDLER(ViewMsg_SetEditCommandsForNextKeyEvent, OnSetEditCommandsForNextKeyEvent) IPC_MESSAGE_HANDLER(ViewMsg_CustomContextMenuAction, OnCustomContextMenuAction) IPC_MESSAGE_HANDLER(ViewMsg_AsyncOpenFile_ACK, OnAsyncFileOpened) IPC_MESSAGE_HANDLER(ViewMsg_PpapiBrokerChannelCreated, OnPpapiBrokerChannelCreated) IPC_MESSAGE_HANDLER(ViewMsg_GetAllSavableResourceLinksForCurrentPage, OnGetAllSavableResourceLinksForCurrentPage) IPC_MESSAGE_HANDLER( ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks, OnGetSerializedHtmlDataForCurrentPageWithLocalLinks) #if defined(OS_MACOSX) IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) #endif IPC_MESSAGE_HANDLER(ViewMsg_ContextMenuClosed, OnContextMenuClosed) #if defined(ENABLE_FLAPPER_HACKS) IPC_MESSAGE_HANDLER(PepperMsg_ConnectTcpACK, OnConnectTcpACK) #endif #if defined(OS_MACOSX) IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize) #endif IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune, OnSetHistoryLengthAndPrune) IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) IPC_MESSAGE_HANDLER(JavaBridgeMsg_Init, OnJavaBridgeInit) IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) IPC_END_MESSAGE_MAP() if (!msg_is_ok) { CHECK(false) << "Unable to deserialize message in RenderViewImpl."; } return handled; }
3,093
167,914
0
void LocalFrame::Detach(FrameDetachType type) { DCHECK_NE(lifecycle_.GetState(), FrameLifecycle::kDetached); lifecycle_.AdvanceTo(FrameLifecycle::kDetaching); if (IsLocalRoot()) { performance_monitor_->Shutdown(); ad_tracker_->Shutdown(); } idleness_detector_->Shutdown(); if (inspector_trace_events_) probe_sink_->removeInspectorTraceEvents(inspector_trace_events_); inspector_task_runner_->Dispose(); PluginScriptForbiddenScope forbid_plugin_destructor_scripting; loader_.StopAllLoaders(); SubframeLoadingDisabler disabler(*GetDocument()); loader_.DispatchUnloadEvent(); DetachChildren(); if (!Client()) return; loader_.StopAllLoaders(); loader_.Detach(); GetDocument()->Shutdown(); if (view_ && view_->IsAttached()) { CHECK(DeprecatedLocalOwner()); CHECK(DeprecatedLocalOwner()->OwnedEmbeddedContentView()); CHECK_EQ(view_, DeprecatedLocalOwner()->OwnedEmbeddedContentView()); } CHECK(!view_ || !view_->IsAttached()); ScriptForbiddenScope forbid_script; if (!Client()) return; DCHECK_NE(lifecycle_.GetState(), FrameLifecycle::kDetached); CHECK(!view_->IsAttached()); Client()->WillBeDetached(); GetScriptController().ClearForClose(); CHECK(!view_->IsAttached()); SetView(nullptr); GetEventHandlerRegistry().DidRemoveAllEventHandlers(*DomWindow()); DomWindow()->FrameDestroyed(); if (GetPage() && GetPage()->GetFocusController().FocusedFrame() == this) GetPage()->GetFocusController().SetFocusedFrame(nullptr); probe::frameDetachedFromParent(this); supplements_.clear(); frame_scheduler_.reset(); WeakIdentifierMap<LocalFrame>::NotifyObjectDestroyed(this); Frame::Detach(type); }
3,094
180,830
1
static int check_alu_op(struct bpf_verifier_env *env, struct bpf_insn *insn) { struct bpf_reg_state *regs = cur_regs(env); u8 opcode = BPF_OP(insn->code); int err; if (opcode == BPF_END || opcode == BPF_NEG) { if (opcode == BPF_NEG) { if (BPF_SRC(insn->code) != 0 || insn->src_reg != BPF_REG_0 || insn->off != 0 || insn->imm != 0) { verbose(env, "BPF_NEG uses reserved fields\n"); return -EINVAL; } } else { if (insn->src_reg != BPF_REG_0 || insn->off != 0 || (insn->imm != 16 && insn->imm != 32 && insn->imm != 64) || BPF_CLASS(insn->code) == BPF_ALU64) { verbose(env, "BPF_END uses reserved fields\n"); return -EINVAL; } } /* check src operand */ err = check_reg_arg(env, insn->dst_reg, SRC_OP); if (err) return err; if (is_pointer_value(env, insn->dst_reg)) { verbose(env, "R%d pointer arithmetic prohibited\n", insn->dst_reg); return -EACCES; } /* check dest operand */ err = check_reg_arg(env, insn->dst_reg, DST_OP); if (err) return err; } else if (opcode == BPF_MOV) { if (BPF_SRC(insn->code) == BPF_X) { if (insn->imm != 0 || insn->off != 0) { verbose(env, "BPF_MOV uses reserved fields\n"); return -EINVAL; } /* check src operand */ err = check_reg_arg(env, insn->src_reg, SRC_OP); if (err) return err; } else { if (insn->src_reg != BPF_REG_0 || insn->off != 0) { verbose(env, "BPF_MOV uses reserved fields\n"); return -EINVAL; } } /* check dest operand */ err = check_reg_arg(env, insn->dst_reg, DST_OP); if (err) return err; if (BPF_SRC(insn->code) == BPF_X) { if (BPF_CLASS(insn->code) == BPF_ALU64) { /* case: R1 = R2 * copy register state to dest reg */ regs[insn->dst_reg] = regs[insn->src_reg]; regs[insn->dst_reg].live |= REG_LIVE_WRITTEN; } else { /* R1 = (u32) R2 */ if (is_pointer_value(env, insn->src_reg)) { verbose(env, "R%d partial copy of pointer\n", insn->src_reg); return -EACCES; } mark_reg_unknown(env, regs, insn->dst_reg); /* high 32 bits are known zero. * regs[insn->dst_reg].var_off = tnum_cast( regs[insn->dst_reg].var_off, 4); __update_reg_bounds(&regs[insn->dst_reg]); } } else { /* case: R = imm * remember the value we stored into this reg */ regs[insn->dst_reg].type = SCALAR_VALUE; if (BPF_CLASS(insn->code) == BPF_ALU64) { __mark_reg_known(regs + insn->dst_reg, insn->imm); } else { __mark_reg_known(regs + insn->dst_reg, (u32)insn->imm); } } } else if (opcode > BPF_END) { verbose(env, "invalid BPF_ALU opcode %x\n", opcode); return -EINVAL; } else { /* all other ALU ops: and, sub, xor, add, ... */ if (BPF_SRC(insn->code) == BPF_X) { if (insn->imm != 0 || insn->off != 0) { verbose(env, "BPF_ALU uses reserved fields\n"); return -EINVAL; } /* check src1 operand */ err = check_reg_arg(env, insn->src_reg, SRC_OP); if (err) return err; } else { if (insn->src_reg != BPF_REG_0 || insn->off != 0) { verbose(env, "BPF_ALU uses reserved fields\n"); return -EINVAL; } } /* check src2 operand */ err = check_reg_arg(env, insn->dst_reg, SRC_OP); if (err) return err; if ((opcode == BPF_MOD || opcode == BPF_DIV) && BPF_SRC(insn->code) == BPF_K && insn->imm == 0) { verbose(env, "div by zero\n"); return -EINVAL; } if ((opcode == BPF_LSH || opcode == BPF_RSH || opcode == BPF_ARSH) && BPF_SRC(insn->code) == BPF_K) { int size = BPF_CLASS(insn->code) == BPF_ALU64 ? 64 : 32; if (insn->imm < 0 || insn->imm >= size) { verbose(env, "invalid shift %d\n", insn->imm); return -EINVAL; } } /* check dest operand */ err = check_reg_arg(env, insn->dst_reg, DST_OP_NO_MARK); if (err) return err; return adjust_reg_min_max_vals(env, insn); } return 0; }
3,095
17,865
0
static int local_open2(FsContext *fs_ctx, V9fsPath *dir_path, const char *name, int flags, FsCred *credp, V9fsFidOpenState *fs) { int fd = -1; int err = -1; int dirfd; /* * Mark all the open to not follow symlinks */ flags |= O_NOFOLLOW; dirfd = local_opendir_nofollow(fs_ctx, dir_path->data); if (dirfd == -1) { return -1; } /* Determine the security model */ if (fs_ctx->export_flags & V9FS_SM_MAPPED || fs_ctx->export_flags & V9FS_SM_MAPPED_FILE) { fd = openat_file(dirfd, name, flags, SM_LOCAL_MODE_BITS); if (fd == -1) { goto out; } credp->fc_mode = credp->fc_mode|S_IFREG; if (fs_ctx->export_flags & V9FS_SM_MAPPED) { /* Set cleint credentials in xattr */ err = local_set_xattrat(dirfd, name, credp); } else { err = local_set_mapped_file_attrat(dirfd, name, credp); } if (err == -1) { goto err_end; } } else if ((fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) || (fs_ctx->export_flags & V9FS_SM_NONE)) { fd = openat_file(dirfd, name, flags, credp->fc_mode); if (fd == -1) { goto out; } err = local_set_cred_passthrough(fs_ctx, dirfd, name, credp); if (err == -1) { goto err_end; } } err = fd; fs->fd = fd; goto out; err_end: unlinkat_preserve_errno(dirfd, name, flags & O_DIRECTORY ? AT_REMOVEDIR : 0); close_preserve_errno(fd); out: close_preserve_errno(dirfd); return err; }
3,096
91,658
0
size_t bgp_packet_mpattr_prefix_size(afi_t afi, safi_t safi, struct prefix *p) { int size = PSIZE(p->prefixlen); if (safi == SAFI_MPLS_VPN) size += 88; else if (afi == AFI_L2VPN && safi == SAFI_EVPN) size += 232; // TODO: Maximum possible for type-2, type-3 and return size; }
3,097
27,166
0
static void plugin_instance_deallocate(PluginInstance *plugin) { NPW_MemFree(plugin); }
3,098
84,490
0
dump_extra(Buffer *buf) { printf("W3m-current-url: %s\n", parsedURL2Str(&buf->currentURL)->ptr); if (buf->baseURL) printf("W3m-base-url: %s\n", parsedURL2Str(buf->baseURL)->ptr); #ifdef USE_M17N printf("W3m-document-charset: %s\n", wc_ces_to_charset(buf->document_charset)); #endif #ifdef USE_SSL if (buf->ssl_certificate) { Str tmp = Strnew(); char *p; for (p = buf->ssl_certificate; *p; p++) { Strcat_char(tmp, *p); if (*p == '\n') { for (; *(p + 1) == '\n'; p++) ; if (*(p + 1)) Strcat_char(tmp, '\t'); } } if (Strlastchar(tmp) != '\n') Strcat_char(tmp, '\n'); printf("W3m-ssl-certificate: %s", tmp->ptr); } #endif }
3,099