unique_id
int64
13
189k
target
int64
0
1
code
stringlengths
20
241k
__index_level_0__
int64
0
18.9k
101,606
0
void Browser::ConvertContentsToApplication(TabContents* contents) { const GURL& url = contents->controller().GetActiveEntry()->url(); std::string app_name = web_app::GenerateApplicationNameFromURL(url); DetachContents(contents); Browser* app_browser = Browser::CreateForApp( TYPE_POPUP, app_name, gfx::Rect(), profile_); TabContentsWrapper* wrapper = TabContentsWrapper::GetCurrentWrapperForContents(contents); if (!wrapper) wrapper = new TabContentsWrapper(contents); app_browser->tabstrip_model()->AppendTabContents(wrapper, true); contents->GetMutableRendererPrefs()->can_accept_load_drops = false; contents->render_view_host()->SyncRendererPrefs(); app_browser->window()->Show(); }
12,300
33,336
0
static void edge_release(struct usb_serial *serial) { kfree(usb_get_serial_data(serial)); }
12,301
12,067
0
EC_GROUP *EC_GROUP_dup(const EC_GROUP *a) { EC_GROUP *t = NULL; int ok = 0; if (a == NULL) return NULL; if ((t = EC_GROUP_new(a->meth)) == NULL) return (NULL); if (!EC_GROUP_copy(t, a)) goto err; ok = 1; err: if (!ok) { if (t) EC_GROUP_free(t); return NULL; } else return t; }
12,302
45,129
0
static const char *req_document_root(request_rec *r) { return ap_document_root(r); }
12,303
98,639
0
void RenderWidget::OnCreateVideoAck(int32 video_id) { }
12,304
45,424
0
int ecryptfs_init_crypt_ctx(struct ecryptfs_crypt_stat *crypt_stat) { char *full_alg_name; int rc = -EINVAL; ecryptfs_printk(KERN_DEBUG, "Initializing cipher [%s]; strlen = [%d]; " "key_size_bits = [%zd]\n", crypt_stat->cipher, (int)strlen(crypt_stat->cipher), crypt_stat->key_size << 3); mutex_lock(&crypt_stat->cs_tfm_mutex); if (crypt_stat->tfm) { rc = 0; goto out_unlock; } rc = ecryptfs_crypto_api_algify_cipher_name(&full_alg_name, crypt_stat->cipher, "cbc"); if (rc) goto out_unlock; crypt_stat->tfm = crypto_alloc_ablkcipher(full_alg_name, 0, 0); if (IS_ERR(crypt_stat->tfm)) { rc = PTR_ERR(crypt_stat->tfm); crypt_stat->tfm = NULL; ecryptfs_printk(KERN_ERR, "cryptfs: init_crypt_ctx(): " "Error initializing cipher [%s]\n", full_alg_name); goto out_free; } crypto_ablkcipher_set_flags(crypt_stat->tfm, CRYPTO_TFM_REQ_WEAK_KEY); rc = 0; out_free: kfree(full_alg_name); out_unlock: mutex_unlock(&crypt_stat->cs_tfm_mutex); return rc; }
12,305
156,674
0
void NavigateFrameAndWait(FrameTreeNode* node, const GURL& url) { NavigateFrameToURL(node, url); EXPECT_TRUE(WaitForLoadStop(shell()->web_contents())); EXPECT_EQ(url, node->current_url()); }
12,306
12,952
0
ssh_packet_connection_is_on_socket(struct ssh *ssh) { struct session_state *state = ssh->state; struct sockaddr_storage from, to; socklen_t fromlen, tolen; /* filedescriptors in and out are the same, so it's a socket */ if (state->connection_in == state->connection_out) return 1; fromlen = sizeof(from); memset(&from, 0, sizeof(from)); if (getpeername(state->connection_in, (struct sockaddr *)&from, &fromlen) < 0) return 0; tolen = sizeof(to); memset(&to, 0, sizeof(to)); if (getpeername(state->connection_out, (struct sockaddr *)&to, &tolen) < 0) return 0; if (fromlen != tolen || memcmp(&from, &to, fromlen) != 0) return 0; if (from.ss_family != AF_INET && from.ss_family != AF_INET6) return 0; return 1; }
12,307
154,452
0
size_t GLES2DecoderPassthroughImpl::GetCreatedBackTextureCountForTest() { return create_color_buffer_count_for_test_; }
12,308
24,500
0
cifs_sb_master_tlink(struct cifs_sb_info *cifs_sb) { return cifs_sb->master_tlink; }
12,309
97,585
0
xmlXPathCastNumberToBoolean (double val) { if (xmlXPathIsNaN(val) || (val == 0.0)) return(0); return(1); }
12,310
78,811
0
int sc_pkcs15emu_sc_hsm_get_curve_oid(sc_cvc_t *cvc, const struct sc_lv_data **oid) { int i; for (i = 0; curves[i].oid.value; i++) { if ((curves[i].prime.len == cvc->primeOrModuluslen) && !memcmp(curves[i].prime.value, cvc->primeOrModulus, cvc->primeOrModuluslen)) { *oid = &curves[i].oid; return SC_SUCCESS; } } return SC_ERROR_INVALID_DATA; }
12,311
155,766
0
PassRefPtr<SerializedScriptValue> SerializedScriptValue::nullValue() { SerializedScriptValueWriter writer; writer.writeNull(); String wireData = writer.takeWireString(); return adoptRef(new SerializedScriptValue(wireData)); }
12,312
24,079
0
static u16 setup_card(struct airo_info *ai, u8 *mac, int lock) { Cmd cmd; Resp rsp; int status; SsidRid mySsid; __le16 lastindex; WepKeyRid wkr; int rc; memset( &mySsid, 0, sizeof( mySsid ) ); kfree (ai->flash); ai->flash = NULL; /* The NOP is the first step in getting the card going */ cmd.cmd = NOP; cmd.parm0 = cmd.parm1 = cmd.parm2 = 0; if (lock && down_interruptible(&ai->sem)) return ERROR; if ( issuecommand( ai, &cmd, &rsp ) != SUCCESS ) { if (lock) up(&ai->sem); return ERROR; } disable_MAC( ai, 0); if (!test_bit(FLAG_MPI,&ai->flags)) { cmd.cmd = CMD_ENABLEAUX; if (issuecommand(ai, &cmd, &rsp) != SUCCESS) { if (lock) up(&ai->sem); airo_print_err(ai->dev->name, "Error checking for AUX port"); return ERROR; } if (!aux_bap || rsp.status & 0xff00) { ai->bap_read = fast_bap_read; airo_print_dbg(ai->dev->name, "Doing fast bap_reads"); } else { ai->bap_read = aux_bap_read; airo_print_dbg(ai->dev->name, "Doing AUX bap_reads"); } } if (lock) up(&ai->sem); if (ai->config.len == 0) { int i; tdsRssiRid rssi_rid; CapabilityRid cap_rid; kfree(ai->APList); ai->APList = NULL; kfree(ai->SSID); ai->SSID = NULL; status = readConfigRid(ai, lock); if ( status != SUCCESS ) return ERROR; status = readCapabilityRid(ai, &cap_rid, lock); if ( status != SUCCESS ) return ERROR; status = PC4500_readrid(ai,RID_RSSI,&rssi_rid,sizeof(rssi_rid),lock); if ( status == SUCCESS ) { if (ai->rssi || (ai->rssi = kmalloc(512, GFP_KERNEL)) != NULL) memcpy(ai->rssi, (u8*)&rssi_rid + 2, 512); /* Skip RID length member */ } else { kfree(ai->rssi); ai->rssi = NULL; if (cap_rid.softCap & cpu_to_le16(8)) ai->config.rmode |= RXMODE_NORMALIZED_RSSI; else airo_print_warn(ai->dev->name, "unknown received signal " "level scale"); } ai->config.opmode = adhoc ? MODE_STA_IBSS : MODE_STA_ESS; ai->config.authType = AUTH_OPEN; ai->config.modulation = MOD_CCK; if (le16_to_cpu(cap_rid.len) >= sizeof(cap_rid) && (cap_rid.extSoftCap & cpu_to_le16(1)) && micsetup(ai) == SUCCESS) { ai->config.opmode |= MODE_MIC; set_bit(FLAG_MIC_CAPABLE, &ai->flags); } /* Save off the MAC */ for( i = 0; i < ETH_ALEN; i++ ) { mac[i] = ai->config.macAddr[i]; } /* Check to see if there are any insmod configured rates to add */ if ( rates[0] ) { memset(ai->config.rates,0,sizeof(ai->config.rates)); for( i = 0; i < 8 && rates[i]; i++ ) { ai->config.rates[i] = rates[i]; } } set_bit (FLAG_COMMIT, &ai->flags); } /* Setup the SSIDs if present */ if ( ssids[0] ) { int i; for( i = 0; i < 3 && ssids[i]; i++ ) { size_t len = strlen(ssids[i]); if (len > 32) len = 32; mySsid.ssids[i].len = cpu_to_le16(len); memcpy(mySsid.ssids[i].ssid, ssids[i], len); } mySsid.len = cpu_to_le16(sizeof(mySsid)); } status = writeConfigRid(ai, lock); if ( status != SUCCESS ) return ERROR; /* Set up the SSID list */ if ( ssids[0] ) { status = writeSsidRid(ai, &mySsid, lock); if ( status != SUCCESS ) return ERROR; } status = enable_MAC(ai, lock); if (status != SUCCESS) return ERROR; /* Grab the initial wep key, we gotta save it for auto_wep */ rc = readWepKeyRid(ai, &wkr, 1, lock); if (rc == SUCCESS) do { lastindex = wkr.kindex; if (wkr.kindex == cpu_to_le16(0xffff)) { ai->defindex = wkr.mac[0]; } rc = readWepKeyRid(ai, &wkr, 0, lock); } while(lastindex != wkr.kindex); try_auto_wep(ai); return SUCCESS; }
12,313
134,865
0
int GetSystemMetricsInDIP(int metric) { return static_cast<int>(GetSystemMetrics(metric) / GetDeviceScaleFactor() + 0.5); }
12,314
66,114
0
static int inet_csk_bind_conflict(const struct sock *sk, const struct inet_bind_bucket *tb, bool relax, bool reuseport_ok) { struct sock *sk2; bool reuse = sk->sk_reuse; bool reuseport = !!sk->sk_reuseport && reuseport_ok; kuid_t uid = sock_i_uid((struct sock *)sk); /* * Unlike other sk lookup places we do not check * for sk_net here, since _all_ the socks listed * in tb->owners list belong to the same net - the * one this bucket belongs to. */ sk_for_each_bound(sk2, &tb->owners) { if (sk != sk2 && (!sk->sk_bound_dev_if || !sk2->sk_bound_dev_if || sk->sk_bound_dev_if == sk2->sk_bound_dev_if)) { if ((!reuse || !sk2->sk_reuse || sk2->sk_state == TCP_LISTEN) && (!reuseport || !sk2->sk_reuseport || rcu_access_pointer(sk->sk_reuseport_cb) || (sk2->sk_state != TCP_TIME_WAIT && !uid_eq(uid, sock_i_uid(sk2))))) { if (inet_rcv_saddr_equal(sk, sk2, true)) break; } if (!relax && reuse && sk2->sk_reuse && sk2->sk_state != TCP_LISTEN) { if (inet_rcv_saddr_equal(sk, sk2, true)) break; } } } return sk2 != NULL; }
12,315
81,949
0
void cliSetPreferences(char **argv, int argc, int interactive) { if (!strcasecmp(argv[0],":set") && argc >= 2) { if (!strcasecmp(argv[1],"hints")) pref.hints = 1; else if (!strcasecmp(argv[1],"nohints")) pref.hints = 0; else { printf("%sunknown redis-cli preference '%s'\n", interactive ? "" : ".redisclirc: ", argv[1]); } } else { printf("%sunknown redis-cli internal command '%s'\n", interactive ? "" : ".redisclirc: ", argv[0]); } }
12,316
182,645
1
TEE_Result tee_mmu_check_access_rights(const struct user_ta_ctx *utc, uint32_t flags, uaddr_t uaddr, size_t len) { uaddr_t a; size_t addr_incr = MIN(CORE_MMU_USER_CODE_SIZE, CORE_MMU_USER_PARAM_SIZE); if (ADD_OVERFLOW(uaddr, len, &a)) return TEE_ERROR_ACCESS_DENIED; if ((flags & TEE_MEMORY_ACCESS_NONSECURE) && (flags & TEE_MEMORY_ACCESS_SECURE)) return TEE_ERROR_ACCESS_DENIED; /* * Rely on TA private memory test to check if address range is private * to TA or not. */ if (!(flags & TEE_MEMORY_ACCESS_ANY_OWNER) && !tee_mmu_is_vbuf_inside_ta_private(utc, (void *)uaddr, len)) return TEE_ERROR_ACCESS_DENIED; for (a = uaddr; a < (uaddr + len); a += addr_incr) { uint32_t attr; TEE_Result res; res = tee_mmu_user_va2pa_attr(utc, (void *)a, NULL, &attr); if (res != TEE_SUCCESS) return res; if ((flags & TEE_MEMORY_ACCESS_NONSECURE) && (attr & TEE_MATTR_SECURE)) return TEE_ERROR_ACCESS_DENIED; if ((flags & TEE_MEMORY_ACCESS_SECURE) && !(attr & TEE_MATTR_SECURE)) return TEE_ERROR_ACCESS_DENIED; if ((flags & TEE_MEMORY_ACCESS_WRITE) && !(attr & TEE_MATTR_UW)) return TEE_ERROR_ACCESS_DENIED; if ((flags & TEE_MEMORY_ACCESS_READ) && !(attr & TEE_MATTR_UR)) return TEE_ERROR_ACCESS_DENIED; } return TEE_SUCCESS; }
12,317
87,241
0
archive_read_format_iso9660_read_header(struct archive_read *a, struct archive_entry *entry) { struct iso9660 *iso9660; struct file_info *file; int r, rd_r = ARCHIVE_OK; iso9660 = (struct iso9660 *)(a->format->data); if (!a->archive.archive_format) { a->archive.archive_format = ARCHIVE_FORMAT_ISO9660; a->archive.archive_format_name = "ISO9660"; } if (iso9660->current_position == 0) { r = choose_volume(a, iso9660); if (r != ARCHIVE_OK) return (r); } file = NULL;/* Eliminate a warning. */ /* Get the next entry that appears after the current offset. */ r = next_entry_seek(a, iso9660, &file); if (r != ARCHIVE_OK) return (r); if (iso9660->seenJoliet) { /* * Convert UTF-16BE of a filename to local locale MBS * and store the result into a filename field. */ if (iso9660->sconv_utf16be == NULL) { iso9660->sconv_utf16be = archive_string_conversion_from_charset( &(a->archive), "UTF-16BE", 1); if (iso9660->sconv_utf16be == NULL) /* Couldn't allocate memory */ return (ARCHIVE_FATAL); } if (iso9660->utf16be_path == NULL) { iso9660->utf16be_path = malloc(UTF16_NAME_MAX); if (iso9660->utf16be_path == NULL) { archive_set_error(&a->archive, ENOMEM, "No memory"); return (ARCHIVE_FATAL); } } if (iso9660->utf16be_previous_path == NULL) { iso9660->utf16be_previous_path = malloc(UTF16_NAME_MAX); if (iso9660->utf16be_previous_path == NULL) { archive_set_error(&a->archive, ENOMEM, "No memory"); return (ARCHIVE_FATAL); } } iso9660->utf16be_path_len = 0; if (build_pathname_utf16be(iso9660->utf16be_path, UTF16_NAME_MAX, &(iso9660->utf16be_path_len), file) != 0) { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Pathname is too long"); return (ARCHIVE_FATAL); } r = archive_entry_copy_pathname_l(entry, (const char *)iso9660->utf16be_path, iso9660->utf16be_path_len, iso9660->sconv_utf16be); if (r != 0) { if (errno == ENOMEM) { archive_set_error(&a->archive, ENOMEM, "No memory for Pathname"); return (ARCHIVE_FATAL); } archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Pathname cannot be converted " "from %s to current locale.", archive_string_conversion_charset_name( iso9660->sconv_utf16be)); rd_r = ARCHIVE_WARN; } } else { const char *path = build_pathname(&iso9660->pathname, file, 0); if (path == NULL) { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Pathname is too long"); return (ARCHIVE_FATAL); } else { archive_string_empty(&iso9660->pathname); archive_entry_set_pathname(entry, path); } } iso9660->entry_bytes_remaining = file->size; /* Offset for sparse-file-aware clients. */ iso9660->entry_sparse_offset = 0; if (file->offset + file->size > iso9660->volume_size) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "File is beyond end-of-media: %s", archive_entry_pathname(entry)); iso9660->entry_bytes_remaining = 0; return (ARCHIVE_WARN); } /* Set up the entry structure with information about this entry. */ archive_entry_set_mode(entry, file->mode); archive_entry_set_uid(entry, file->uid); archive_entry_set_gid(entry, file->gid); archive_entry_set_nlink(entry, file->nlinks); if (file->birthtime_is_set) archive_entry_set_birthtime(entry, file->birthtime, 0); else archive_entry_unset_birthtime(entry); archive_entry_set_mtime(entry, file->mtime, 0); archive_entry_set_ctime(entry, file->ctime, 0); archive_entry_set_atime(entry, file->atime, 0); /* N.B.: Rock Ridge supports 64-bit device numbers. */ archive_entry_set_rdev(entry, (dev_t)file->rdev); archive_entry_set_size(entry, iso9660->entry_bytes_remaining); if (file->symlink.s != NULL) archive_entry_copy_symlink(entry, file->symlink.s); /* Note: If the input isn't seekable, we can't rewind to * return the same body again, so if the next entry refers to * the same data, we have to return it as a hardlink to the * original entry. */ if (file->number != -1 && file->number == iso9660->previous_number) { if (iso9660->seenJoliet) { r = archive_entry_copy_hardlink_l(entry, (const char *)iso9660->utf16be_previous_path, iso9660->utf16be_previous_path_len, iso9660->sconv_utf16be); if (r != 0) { if (errno == ENOMEM) { archive_set_error(&a->archive, ENOMEM, "No memory for Linkname"); return (ARCHIVE_FATAL); } archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Linkname cannot be converted " "from %s to current locale.", archive_string_conversion_charset_name( iso9660->sconv_utf16be)); rd_r = ARCHIVE_WARN; } } else archive_entry_set_hardlink(entry, iso9660->previous_pathname.s); archive_entry_unset_size(entry); iso9660->entry_bytes_remaining = 0; return (rd_r); } if ((file->mode & AE_IFMT) != AE_IFDIR && file->offset < iso9660->current_position) { int64_t r64; r64 = __archive_read_seek(a, file->offset, SEEK_SET); if (r64 != (int64_t)file->offset) { /* We can't seek backwards to extract it, so issue * a warning. Note that this can only happen if * this entry was added to the heap after we passed * this offset, that is, only if the directory * mentioning this entry is later than the body of * the entry. Such layouts are very unusual; most * ISO9660 writers lay out and record all directory * information first, then store all file bodies. */ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Ignoring out-of-order file @%jx (%s) %jd < %jd", (intmax_t)file->number, iso9660->pathname.s, (intmax_t)file->offset, (intmax_t)iso9660->current_position); iso9660->entry_bytes_remaining = 0; return (ARCHIVE_WARN); } iso9660->current_position = (uint64_t)r64; } /* Initialize zisofs variables. */ iso9660->entry_zisofs.pz = file->pz; if (file->pz) { #ifdef HAVE_ZLIB_H struct zisofs *zisofs; zisofs = &iso9660->entry_zisofs; zisofs->initialized = 0; zisofs->pz_log2_bs = file->pz_log2_bs; zisofs->pz_uncompressed_size = file->pz_uncompressed_size; zisofs->pz_offset = 0; zisofs->header_avail = 0; zisofs->header_passed = 0; zisofs->block_pointers_avail = 0; #endif archive_entry_set_size(entry, file->pz_uncompressed_size); } iso9660->previous_number = file->number; if (iso9660->seenJoliet) { memcpy(iso9660->utf16be_previous_path, iso9660->utf16be_path, iso9660->utf16be_path_len); iso9660->utf16be_previous_path_len = iso9660->utf16be_path_len; } else archive_strcpy( &iso9660->previous_pathname, iso9660->pathname.s); /* Reset entry_bytes_remaining if the file is multi extent. */ iso9660->entry_content = file->contents.first; if (iso9660->entry_content != NULL) iso9660->entry_bytes_remaining = iso9660->entry_content->size; if (archive_entry_filetype(entry) == AE_IFDIR) { /* Overwrite nlinks by proper link number which is * calculated from number of sub directories. */ archive_entry_set_nlink(entry, 2 + file->subdirs); /* Directory data has been read completely. */ iso9660->entry_bytes_remaining = 0; } if (rd_r != ARCHIVE_OK) return (rd_r); return (ARCHIVE_OK); }
12,318
12,773
0
int (*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx)) (SSL *ssl, SSL_SESSION *sess) { return ctx->new_session_cb; }
12,319
14,917
0
static spl_ptr_heap *spl_ptr_heap_init(spl_ptr_heap_cmp_func cmp, spl_ptr_heap_ctor_func ctor, spl_ptr_heap_dtor_func dtor) /* {{{ */ { spl_ptr_heap *heap = emalloc(sizeof(spl_ptr_heap)); heap->dtor = dtor; heap->ctor = ctor; heap->cmp = cmp; heap->elements = safe_emalloc(sizeof(spl_ptr_heap_element), PTR_HEAP_BLOCK_SIZE, 0); heap->max_size = PTR_HEAP_BLOCK_SIZE; heap->count = 0; heap->flags = 0; return heap; } /* }}} */
12,320
9,120
0
static int vrend_decode_set_sample_mask(struct vrend_decode_ctx *ctx, int length) { unsigned mask; if (length != VIRGL_SET_SAMPLE_MASK_SIZE) return EINVAL; mask = get_buf_entry(ctx, VIRGL_SET_SAMPLE_MASK_MASK); vrend_set_sample_mask(ctx->grctx, mask); return 0; }
12,321
50,053
0
static OPJ_BOOL opj_pi_next_rlcp(opj_pi_iterator_t * pi) { opj_pi_comp_t *comp = NULL; opj_pi_resolution_t *res = NULL; OPJ_UINT32 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; }
12,322
129,199
0
virtual ~FramebufferInfoFloatTest() { }
12,323
31,800
0
static int sig_task_ignored(struct task_struct *t, int sig, bool force) { void __user *handler; handler = sig_handler(t, sig); if (unlikely(t->signal->flags & SIGNAL_UNKILLABLE) && handler == SIG_DFL && !force) return 1; return sig_handler_ignored(handler, sig); }
12,324
34,386
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; }
12,325
50,986
0
void propagate_mount_unlock(struct mount *mnt) { struct mount *parent = mnt->mnt_parent; struct mount *m, *child; BUG_ON(parent == mnt); for (m = propagation_next(parent, parent); m; m = propagation_next(m, parent)) { child = __lookup_mnt_last(&m->mnt, mnt->mnt_mountpoint); if (child) child->mnt.mnt_flags &= ~MNT_LOCKED; } }
12,326
8,076
0
void Gfx::doForm1(Object *str, Dict *resDict, double *matrix, double *bbox, GBool transpGroup, GBool softMask, GfxColorSpace *blendingColorSpace, GBool isolated, GBool knockout, GBool alpha, Function *transferFunc, GfxColor *backdropColor) { Parser *oldParser; double oldBaseMatrix[6]; int i; pushResources(resDict); saveState(); state->clearPath(); oldParser = parser; state->concatCTM(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]); out->updateCTM(state, matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]); state->moveTo(bbox[0], bbox[1]); state->lineTo(bbox[2], bbox[1]); state->lineTo(bbox[2], bbox[3]); state->lineTo(bbox[0], bbox[3]); state->closePath(); state->clip(); out->clip(state); state->clearPath(); if (softMask || transpGroup) { if (state->getBlendMode() != gfxBlendNormal) { state->setBlendMode(gfxBlendNormal); out->updateBlendMode(state); } if (state->getFillOpacity() != 1) { state->setFillOpacity(1); out->updateFillOpacity(state); } if (state->getStrokeOpacity() != 1) { state->setStrokeOpacity(1); out->updateStrokeOpacity(state); } out->clearSoftMask(state); out->beginTransparencyGroup(state, bbox, blendingColorSpace, isolated, knockout, softMask); } for (i = 0; i < 6; ++i) { oldBaseMatrix[i] = baseMatrix[i]; baseMatrix[i] = state->getCTM()[i]; } GfxState *stateBefore = state; display(str, gFalse); if (stateBefore != state) { if (state->isParentState(stateBefore)) { error(-1, "There's a form with more q than Q, trying to fix"); while (stateBefore != state) { restoreState(); } } else { error(-1, "There's a form with more Q than q"); } } if (softMask || transpGroup) { out->endTransparencyGroup(state); } for (i = 0; i < 6; ++i) { baseMatrix[i] = oldBaseMatrix[i]; } parser = oldParser; restoreState(); popResources(); if (softMask) { out->setSoftMask(state, bbox, alpha, transferFunc, backdropColor); } else if (transpGroup) { out->paintTransparencyGroup(state, bbox); } return; }
12,327
13,158
0
xps_encode_font_char(fz_font *font, int code) { FT_Face face = font->ft_face; int gid = FT_Get_Char_Index(face, code); if (gid == 0 && face->charmap && face->charmap->platform_id == 3 && face->charmap->encoding_id == 0) gid = FT_Get_Char_Index(face, 0xF000 | code); return gid; }
12,328
59,841
0
alloc_sglist(int nents, int max, int vary, struct usbtest_dev *dev, int pipe) { struct scatterlist *sg; unsigned int n_size = 0; unsigned i; unsigned size = max; unsigned maxpacket = get_maxpacket(interface_to_usbdev(dev->intf), pipe); if (max == 0) return NULL; sg = kmalloc_array(nents, sizeof(*sg), GFP_KERNEL); if (!sg) return NULL; sg_init_table(sg, nents); for (i = 0; i < nents; i++) { char *buf; unsigned j; buf = kzalloc(size, GFP_KERNEL); if (!buf) { free_sglist(sg, i); return NULL; } /* kmalloc pages are always physically contiguous! */ sg_set_buf(&sg[i], buf, size); switch (pattern) { case 0: /* already zeroed */ break; case 1: for (j = 0; j < size; j++) *buf++ = (u8) (((j + n_size) % maxpacket) % 63); n_size += size; break; } if (vary) { size += vary; size %= max; if (size == 0) size = (vary < max) ? vary : max; } } return sg; }
12,329
151,203
0
KURL UrlWithoutFragment(const KURL& url) { KURL result = url; result.RemoveFragmentIdentifier(); return result; }
12,330
140,904
0
const AtomicString& connectionStateToString( WebPresentationConnectionState state) { DEFINE_STATIC_LOCAL(const AtomicString, connectingValue, ("connecting")); DEFINE_STATIC_LOCAL(const AtomicString, connectedValue, ("connected")); DEFINE_STATIC_LOCAL(const AtomicString, closedValue, ("closed")); DEFINE_STATIC_LOCAL(const AtomicString, terminatedValue, ("terminated")); switch (state) { case WebPresentationConnectionState::Connecting: return connectingValue; case WebPresentationConnectionState::Connected: return connectedValue; case WebPresentationConnectionState::Closed: return closedValue; case WebPresentationConnectionState::Terminated: return terminatedValue; } ASSERT_NOT_REACHED(); return terminatedValue; }
12,331
2,743
0
_dbus_header_create (DBusHeader *header, int message_type, const char *destination, const char *path, const char *interface, const char *member, const char *error_name) { unsigned char v_BYTE; dbus_uint32_t v_UINT32; DBusTypeWriter writer; DBusTypeWriter array; _dbus_assert (((interface || message_type != DBUS_MESSAGE_TYPE_SIGNAL) && member) || (error_name) || !(interface || member || error_name)); _dbus_assert (_dbus_string_get_length (&header->data) == 0); if (!reserve_header_padding (header)) return FALSE; _dbus_type_writer_init_values_only (&writer, header->byte_order, &_dbus_header_signature_str, 0, &header->data, HEADER_END_BEFORE_PADDING (header)); v_BYTE = header->byte_order; if (!_dbus_type_writer_write_basic (&writer, DBUS_TYPE_BYTE, &v_BYTE)) goto oom; v_BYTE = message_type; if (!_dbus_type_writer_write_basic (&writer, DBUS_TYPE_BYTE, &v_BYTE)) goto oom; v_BYTE = 0; /* flags */ if (!_dbus_type_writer_write_basic (&writer, DBUS_TYPE_BYTE, &v_BYTE)) goto oom; v_BYTE = DBUS_MAJOR_PROTOCOL_VERSION; if (!_dbus_type_writer_write_basic (&writer, DBUS_TYPE_BYTE, &v_BYTE)) goto oom; v_UINT32 = 0; /* body length */ if (!_dbus_type_writer_write_basic (&writer, DBUS_TYPE_UINT32, &v_UINT32)) goto oom; v_UINT32 = 0; /* serial */ if (!_dbus_type_writer_write_basic (&writer, DBUS_TYPE_UINT32, &v_UINT32)) goto oom; if (!_dbus_type_writer_recurse (&writer, DBUS_TYPE_ARRAY, &_dbus_header_signature_str, FIELDS_ARRAY_SIGNATURE_OFFSET, &array)) goto oom; /* Marshal all the fields (Marshall Fields?) */ if (path != NULL) { if (!write_basic_field (&array, DBUS_HEADER_FIELD_PATH, DBUS_TYPE_OBJECT_PATH, &path)) goto oom; } if (destination != NULL) { if (!write_basic_field (&array, DBUS_HEADER_FIELD_DESTINATION, DBUS_TYPE_STRING, &destination)) goto oom; } if (interface != NULL) { if (!write_basic_field (&array, DBUS_HEADER_FIELD_INTERFACE, DBUS_TYPE_STRING, &interface)) goto oom; } if (member != NULL) { if (!write_basic_field (&array, DBUS_HEADER_FIELD_MEMBER, DBUS_TYPE_STRING, &member)) goto oom; } if (error_name != NULL) { if (!write_basic_field (&array, DBUS_HEADER_FIELD_ERROR_NAME, DBUS_TYPE_STRING, &error_name)) goto oom; } if (!_dbus_type_writer_unrecurse (&writer, &array)) goto oom; correct_header_padding (header); return TRUE; oom: _dbus_string_delete (&header->data, 0, _dbus_string_get_length (&header->data) - header->padding); correct_header_padding (header); return FALSE; }
12,332
34,542
0
static void nci_add_new_target(struct nci_dev *ndev, struct nci_rf_discover_ntf *ntf) { struct nfc_target *target; int i, rc; for (i = 0; i < ndev->n_targets; i++) { target = &ndev->targets[i]; if (target->logical_idx == ntf->rf_discovery_id) { /* This target already exists, add the new protocol */ nci_add_new_protocol(ndev, target, ntf->rf_protocol, ntf->rf_tech_and_mode, &ntf->rf_tech_specific_params); return; } } /* This is a new target, check if we've enough room */ if (ndev->n_targets == NCI_MAX_DISCOVERED_TARGETS) { pr_debug("not enough room, ignoring new target...\n"); return; } target = &ndev->targets[ndev->n_targets]; rc = nci_add_new_protocol(ndev, target, ntf->rf_protocol, ntf->rf_tech_and_mode, &ntf->rf_tech_specific_params); if (!rc) { target->logical_idx = ntf->rf_discovery_id; ndev->n_targets++; pr_debug("logical idx %d, n_targets %d\n", target->logical_idx, ndev->n_targets); } }
12,333
125,402
0
void GDataFileSystem::OnGetAvailableSpace( const GetAvailableSpaceCallback& callback, GDataErrorCode status, scoped_ptr<base::Value> data) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); GDataFileError error = util::GDataToGDataFileError(status); if (error != GDATA_FILE_OK) { callback.Run(error, -1, -1); return; } scoped_ptr<AccountMetadataFeed> feed; if (data.get()) feed = AccountMetadataFeed::CreateFrom(*data); if (!feed.get()) { callback.Run(GDATA_FILE_ERROR_FAILED, -1, -1); return; } callback.Run(GDATA_FILE_OK, feed->quota_bytes_total(), feed->quota_bytes_used()); }
12,334
179,622
1
static int futex_wait_requeue_pi(u32 __user *uaddr, int fshared, u32 val, ktime_t *abs_time, u32 bitset, int clockrt, u32 __user *uaddr2) { struct hrtimer_sleeper timeout, *to = NULL; struct rt_mutex_waiter rt_waiter; struct rt_mutex *pi_mutex = NULL; struct futex_hash_bucket *hb; union futex_key key2; struct futex_q q; int res, ret; if (!bitset) return -EINVAL; if (abs_time) { to = &timeout; hrtimer_init_on_stack(&to->timer, clockrt ? CLOCK_REALTIME : CLOCK_MONOTONIC, HRTIMER_MODE_ABS); hrtimer_init_sleeper(to, current); hrtimer_set_expires_range_ns(&to->timer, *abs_time, current->timer_slack_ns); } /* * The waiter is allocated on our stack, manipulated by the requeue * code while we sleep on uaddr. */ debug_rt_mutex_init_waiter(&rt_waiter); rt_waiter.task = NULL; key2 = FUTEX_KEY_INIT; ret = get_futex_key(uaddr2, fshared, &key2); if (unlikely(ret != 0)) goto out; q.pi_state = NULL; q.bitset = bitset; q.rt_waiter = &rt_waiter; q.requeue_pi_key = &key2; /* Prepare to wait on uaddr. * ret = futex_wait_setup(uaddr, val, fshared, &q, &hb); if (ret) goto out_key2; /* Queue the futex_q, drop the hb lock, wait for wakeup. */ futex_wait_queue_me(hb, &q, to); spin_lock(&hb->lock); ret = handle_early_requeue_pi_wakeup(hb, &q, &key2, to); spin_unlock(&hb->lock); if (ret) goto out_put_keys; /* * In order for us to be here, we know our q.key == key2, and since * we took the hb->lock above, we also know that futex_requeue() has * completed and we no longer have to concern ourselves with a wakeup * race with the atomic proxy lock acquition by the requeue code. */ /* Check if the requeue code acquired the second futex for us. */ if (!q.rt_waiter) { /* * Got the lock. We might not be the anticipated owner if we * did a lock-steal - fix up the PI-state in that case. */ if (q.pi_state && (q.pi_state->owner != current)) { spin_lock(q.lock_ptr); ret = fixup_pi_state_owner(uaddr2, &q, current, fshared); spin_unlock(q.lock_ptr); } } else { /* * We have been woken up by futex_unlock_pi(), a timeout, or a * signal. futex_unlock_pi() will not destroy the lock_ptr nor * the pi_state. */ WARN_ON(!&q.pi_state); pi_mutex = &q.pi_state->pi_mutex; ret = rt_mutex_finish_proxy_lock(pi_mutex, to, &rt_waiter, 1); debug_rt_mutex_free_waiter(&rt_waiter); spin_lock(q.lock_ptr); /* * Fixup the pi_state owner and possibly acquire the lock if we * haven't already. */ res = fixup_owner(uaddr2, fshared, &q, !ret); /* * If fixup_owner() returned an error, proprogate that. If it * acquired the lock, clear -ETIMEDOUT or -EINTR. */ if (res) ret = (res < 0) ? res : 0; /* Unqueue and drop the lock. */ unqueue_me_pi(&q); } /* * If fixup_pi_state_owner() faulted and was unable to handle the * fault, unlock the rt_mutex and return the fault to userspace. */ if (ret == -EFAULT) { if (rt_mutex_owner(pi_mutex) == current) rt_mutex_unlock(pi_mutex); } else if (ret == -EINTR) { /* * We've already been requeued, but cannot restart by calling * futex_lock_pi() directly. We could restart this syscall, but * it would detect that the user space "val" changed and return * -EWOULDBLOCK. Save the overhead of the restart and return * -EWOULDBLOCK directly. */ ret = -EWOULDBLOCK; } out_put_keys: put_futex_key(fshared, &q.key); out_key2: put_futex_key(fshared, &key2); out: if (to) { hrtimer_cancel(&to->timer); destroy_hrtimer_on_stack(&to->timer); } return ret; }
12,335
111,634
0
GDataEntry* GDataDirectory::FindChild( const FilePath::StringType& file_name) const { GDataFileCollection::const_iterator it = child_files_.find(file_name); if (it != child_files_.end()) return it->second; GDataDirectoryCollection::const_iterator itd = child_directories_.find(file_name); if (itd != child_directories_.end()) return itd->second; return NULL; }
12,336
103,676
0
void BrowserRenderProcessHost::OnProcessLaunched() { if (deleting_soon_) return; if (child_process_launcher_.get()) child_process_launcher_->SetProcessBackgrounded(backgrounded_); if (max_page_id_ != -1) Send(new ViewMsg_SetNextPageID(max_page_id_ + 1)); NotificationService::current()->Notify( content::NOTIFICATION_RENDERER_PROCESS_CREATED, Source<RenderProcessHost>(this), NotificationService::NoDetails()); while (!queued_messages_.empty()) { Send(queued_messages_.front()); queued_messages_.pop(); } }
12,337
55,877
0
void put_tty_driver(struct tty_driver *d) { tty_driver_kref_put(d); }
12,338
184,638
1
void RemoveClientSession() { context_.network_message_loop()->PostTask( FROM_HERE, base::Bind( &ClientSession::OnConnectionClosed, client_, connection_)); }
12,339
6,973
0
tt_cmap2_validate( FT_Byte* table, FT_Validator valid ) { FT_Byte* p; FT_UInt length; FT_UInt n, max_subs; FT_Byte* keys; /* keys table */ FT_Byte* subs; /* sub-headers */ FT_Byte* glyph_ids; /* glyph ID array */ if ( table + 2 + 2 > valid->limit ) FT_INVALID_TOO_SHORT; p = table + 2; /* skip format */ length = TT_NEXT_USHORT( p ); if ( table + length > valid->limit || length < 6 + 512 ) FT_INVALID_TOO_SHORT; keys = table + 6; /* parse keys to compute sub-headers count */ p = keys; max_subs = 0; for ( n = 0; n < 256; n++ ) { FT_UInt idx = TT_NEXT_USHORT( p ); /* value must be multiple of 8 */ if ( valid->level >= FT_VALIDATE_PARANOID && ( idx & 7 ) != 0 ) FT_INVALID_DATA; idx >>= 3; if ( idx > max_subs ) max_subs = idx; } FT_ASSERT( p == table + 518 ); subs = p; glyph_ids = subs + (max_subs + 1) * 8; if ( glyph_ids > valid->limit ) FT_INVALID_TOO_SHORT; /* parse sub-headers */ for ( n = 0; n <= max_subs; n++ ) { FT_UInt first_code, code_count, offset; FT_Int delta; first_code = TT_NEXT_USHORT( p ); code_count = TT_NEXT_USHORT( p ); delta = TT_NEXT_SHORT( p ); offset = TT_NEXT_USHORT( p ); /* many Dynalab fonts have empty sub-headers */ if ( code_count == 0 ) continue; /* check range within 0..255 */ if ( valid->level >= FT_VALIDATE_PARANOID ) { if ( first_code >= 256 || first_code + code_count > 256 ) FT_INVALID_DATA; } /* check offset */ if ( offset != 0 ) { FT_Byte* ids; ids = p - 2 + offset; if ( ids < glyph_ids || ids + code_count*2 > table + length ) FT_INVALID_OFFSET; /* check glyph IDs */ if ( valid->level >= FT_VALIDATE_TIGHT ) { FT_Byte* limit = p + code_count * 2; FT_UInt idx; for ( ; p < limit; ) { idx = TT_NEXT_USHORT( p ); if ( idx != 0 ) { idx = ( idx + delta ) & 0xFFFFU; if ( idx >= TT_VALID_GLYPH_COUNT( valid ) ) FT_INVALID_GLYPH_ID; } } } } } return FT_Err_Ok; }
12,340
174,348
0
void Backtrace::FillInMap(uintptr_t pc, backtrace_map_t* map) { if (map_ != nullptr) { map_->FillIn(pc, map); } }
12,341
176,164
0
media_status_t AMediaCodec_delete(AMediaCodec *mData) { if (mData != NULL) { if (mData->mCodec != NULL) { mData->mCodec->release(); mData->mCodec.clear(); } if (mData->mLooper != NULL) { if (mData->mHandler != NULL) { mData->mLooper->unregisterHandler(mData->mHandler->id()); } mData->mLooper->stop(); mData->mLooper.clear(); } delete mData; } return AMEDIA_OK; }
12,342
87,288
0
static MagickBooleanType TraceArcPath(MVGInfo *mvg_info,const PointInfo start, const PointInfo end,const PointInfo arc,const double angle, const MagickBooleanType large_arc,const MagickBooleanType sweep) { double alpha, beta, delta, factor, gamma, theta; MagickStatusType status; PointInfo center, points[3], radii; register double cosine, sine; PrimitiveInfo *primitive_info; register PrimitiveInfo *p; register ssize_t i; size_t arc_segments; ssize_t offset; offset=mvg_info->offset; primitive_info=(*mvg_info->primitive_info)+mvg_info->offset; primitive_info->coordinates=0; if ((fabs(start.x-end.x) < MagickEpsilon) && (fabs(start.y-end.y) < MagickEpsilon)) return(TracePoint(primitive_info,end)); radii.x=fabs(arc.x); radii.y=fabs(arc.y); if ((fabs(radii.x) < MagickEpsilon) || (fabs(radii.y) < MagickEpsilon)) return(TraceLine(primitive_info,start,end)); cosine=cos(DegreesToRadians(fmod((double) angle,360.0))); sine=sin(DegreesToRadians(fmod((double) angle,360.0))); center.x=(double) (cosine*(end.x-start.x)/2+sine*(end.y-start.y)/2); center.y=(double) (cosine*(end.y-start.y)/2-sine*(end.x-start.x)/2); delta=(center.x*center.x)/(radii.x*radii.x)+(center.y*center.y)/ (radii.y*radii.y); if (delta < MagickEpsilon) return(TraceLine(primitive_info,start,end)); if (delta > 1.0) { radii.x*=sqrt((double) delta); radii.y*=sqrt((double) delta); } points[0].x=(double) (cosine*start.x/radii.x+sine*start.y/radii.x); points[0].y=(double) (cosine*start.y/radii.y-sine*start.x/radii.y); points[1].x=(double) (cosine*end.x/radii.x+sine*end.y/radii.x); points[1].y=(double) (cosine*end.y/radii.y-sine*end.x/radii.y); alpha=points[1].x-points[0].x; beta=points[1].y-points[0].y; factor=PerceptibleReciprocal(alpha*alpha+beta*beta)-0.25; if (factor <= 0.0) factor=0.0; else { factor=sqrt((double) factor); if (sweep == large_arc) factor=(-factor); } center.x=(double) ((points[0].x+points[1].x)/2-factor*beta); center.y=(double) ((points[0].y+points[1].y)/2+factor*alpha); alpha=atan2(points[0].y-center.y,points[0].x-center.x); theta=atan2(points[1].y-center.y,points[1].x-center.x)-alpha; if ((theta < 0.0) && (sweep != MagickFalse)) theta+=2.0*MagickPI; else if ((theta > 0.0) && (sweep == MagickFalse)) theta-=2.0*MagickPI; arc_segments=(size_t) ceil(fabs((double) (theta/(0.5*MagickPI+ MagickEpsilon)))); status=MagickTrue; p=primitive_info; for (i=0; i < (ssize_t) arc_segments; i++) { beta=0.5*((alpha+(i+1)*theta/arc_segments)-(alpha+i*theta/arc_segments)); gamma=(8.0/3.0)*sin(fmod((double) (0.5*beta),DegreesToRadians(360.0)))* sin(fmod((double) (0.5*beta),DegreesToRadians(360.0)))/ sin(fmod((double) beta,DegreesToRadians(360.0))); points[0].x=(double) (center.x+cos(fmod((double) (alpha+(double) i*theta/ arc_segments),DegreesToRadians(360.0)))-gamma*sin(fmod((double) (alpha+ (double) i*theta/arc_segments),DegreesToRadians(360.0)))); points[0].y=(double) (center.y+sin(fmod((double) (alpha+(double) i*theta/ arc_segments),DegreesToRadians(360.0)))+gamma*cos(fmod((double) (alpha+ (double) i*theta/arc_segments),DegreesToRadians(360.0)))); points[2].x=(double) (center.x+cos(fmod((double) (alpha+(double) (i+1)* theta/arc_segments),DegreesToRadians(360.0)))); points[2].y=(double) (center.y+sin(fmod((double) (alpha+(double) (i+1)* theta/arc_segments),DegreesToRadians(360.0)))); points[1].x=(double) (points[2].x+gamma*sin(fmod((double) (alpha+(double) (i+1)*theta/arc_segments),DegreesToRadians(360.0)))); points[1].y=(double) (points[2].y-gamma*cos(fmod((double) (alpha+(double) (i+1)*theta/arc_segments),DegreesToRadians(360.0)))); p->point.x=(p == primitive_info) ? start.x : (p-1)->point.x; p->point.y=(p == primitive_info) ? start.y : (p-1)->point.y; (p+1)->point.x=(double) (cosine*radii.x*points[0].x-sine*radii.y* points[0].y); (p+1)->point.y=(double) (sine*radii.x*points[0].x+cosine*radii.y* points[0].y); (p+2)->point.x=(double) (cosine*radii.x*points[1].x-sine*radii.y* points[1].y); (p+2)->point.y=(double) (sine*radii.x*points[1].x+cosine*radii.y* points[1].y); (p+3)->point.x=(double) (cosine*radii.x*points[2].x-sine*radii.y* points[2].y); (p+3)->point.y=(double) (sine*radii.x*points[2].x+cosine*radii.y* points[2].y); if (i == (ssize_t) (arc_segments-1)) (p+3)->point=end; status&=TraceBezier(mvg_info,4); p=(*mvg_info->primitive_info)+mvg_info->offset; mvg_info->offset+=p->coordinates; p+=p->coordinates; } mvg_info->offset=offset; primitive_info=(*mvg_info->primitive_info)+mvg_info->offset; primitive_info->coordinates=(size_t) (p-primitive_info); primitive_info->closed_subpath=MagickFalse; for (i=0; i < (ssize_t) primitive_info->coordinates; i++) { p->primitive=primitive_info->primitive; p--; } return(status == 0 ? MagickFalse : MagickTrue); }
12,343
134,017
0
bool ExtensionAppItem::NeedsOverlay() const { #if defined(OS_CHROMEOS) return false; #endif extensions::LaunchType launch_type = GetExtension() ? extensions::GetLaunchType(extensions::ExtensionPrefs::Get(profile_), GetExtension()) : extensions::LAUNCH_TYPE_WINDOW; return !is_platform_app_ && extension_id_ != extension_misc::kChromeAppId && (!extensions::util::IsNewBookmarkAppsEnabled() || launch_type != extensions::LAUNCH_TYPE_WINDOW); }
12,344
173,944
0
double VideoTrack::GetFrameRate() const { return m_rate; }
12,345
166,485
0
PermissionsUpdaterTestDelegate() {}
12,346
31,127
0
static int fb_check_caps(struct fb_info *info, struct fb_var_screeninfo *var, u32 activate) { struct fb_event event; struct fb_blit_caps caps, fbcaps; int err = 0; memset(&caps, 0, sizeof(caps)); memset(&fbcaps, 0, sizeof(fbcaps)); caps.flags = (activate & FB_ACTIVATE_ALL) ? 1 : 0; event.info = info; event.data = &caps; fb_notifier_call_chain(FB_EVENT_GET_REQ, &event); info->fbops->fb_get_caps(info, &fbcaps, var); if (((fbcaps.x ^ caps.x) & caps.x) || ((fbcaps.y ^ caps.y) & caps.y) || (fbcaps.len < caps.len)) err = -EINVAL; return err; }
12,347
162,238
0
void GamepadProvider::RemoveSourceGamepadDataFetcher(GamepadSource source) { polling_thread_->task_runner()->PostTask( FROM_HERE, base::Bind(&GamepadProvider::DoRemoveSourceGamepadDataFetcher, base::Unretained(this), source)); }
12,348
149,567
0
void ReadFromSocketWithPort(uint16_t port) { EXPECT_TRUE(base::Contains(sockets_, port)); sockets_[port] = SocketStatus::kReadFrom; first_read_loop_.Quit(); }
12,349
33,731
0
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; }
12,350
185,386
1
void SpeechSynthesis::handleSpeakingCompleted(SpeechSynthesisUtterance* utterance, bool errorOccurred) { ASSERT(utterance); bool didJustFinishCurrentUtterance = false; if (utterance == currentSpeechUtterance()) { m_utteranceQueue.removeFirst(); didJustFinishCurrentUtterance = true; } fireEvent(errorOccurred ? EventTypeNames::error : EventTypeNames::end, utterance, 0, String()); if (didJustFinishCurrentUtterance && !m_utteranceQueue.isEmpty()) startSpeakingImmediately(); }
12,351
83,625
0
void zgfx_context_free(ZGFX_CONTEXT* zgfx) { free(zgfx); }
12,352
66,579
0
static void control_intr(struct virtqueue *vq) { struct ports_device *portdev; portdev = vq->vdev->priv; schedule_work(&portdev->control_work); }
12,353
170,302
0
void UsbChooserContext::EnsureConnectionWithDeviceManager() { if (device_manager_) return; device_manager_instance_ = std::make_unique<device::usb::DeviceManagerImpl>(); device_manager_instance_->AddBinding(mojo::MakeRequest(&device_manager_)); device_manager_.set_connection_error_handler( base::BindOnce(&UsbChooserContext::OnDeviceManagerConnectionError, base::Unretained(this))); DCHECK(!client_binding_); device::mojom::UsbDeviceManagerClientAssociatedPtrInfo client; client_binding_.Bind(mojo::MakeRequest(&client)); device_manager_->SetClient(std::move(client)); }
12,354
123,398
0
void RenderWidgetHostViewGuest::SetCachedPageScaleFactorLimits( float minimum_scale, float maximum_scale) { NOTIMPLEMENTED(); }
12,355
72,912
0
int dump_passes(jpc_enc_pass_t *passes, int numpasses, jpc_enc_cblk_t *cblk) { jpc_enc_pass_t *pass; int i; jas_stream_memobj_t *smo; smo = cblk->stream->obj_; pass = passes; for (i = 0; i < numpasses; ++i) { jas_eprintf("start=%d end=%d type=%d term=%d lyrno=%d firstchar=%02x size=%ld pos=%ld\n", (int)pass->start, (int)pass->end, (int)pass->type, (int)pass->term, (int)pass->lyrno, smo->buf_[pass->start], (long)smo->len_, (long)smo->pos_); #if 0 jas_memdump(stderr, &smo->buf_[pass->start], pass->end - pass->start); #endif ++pass; } return 0; }
12,356
73,935
0
static void process_level0_os9_area(LHAFileHeader *header, uint8_t *data, size_t data_len) { if (data_len < LEVEL_0_OS9_EXTENDED_LEN || data[9] != 0xcc || data[1] != data[17] || data[2] != data[18]) { return; } header->os_type = LHA_OS_TYPE_OS9; header->os9_perms = lha_decode_uint16(data + 1); header->extra_flags |= LHA_FILE_OS9_PERMS; }
12,357
16,370
0
pseudo_get_user_info(ClassAd *&ad) { static ClassAd* user_ad = NULL; if( ! user_ad ) { user_ad = new ClassAd; #ifndef WIN32 char buf[1024]; sprintf( buf, "%s = %d", ATTR_UID, (int)get_user_uid() ); user_ad->Insert( buf ); sprintf( buf, "%s = %d", ATTR_GID, (int)get_user_gid() ); user_ad->Insert( buf ); #endif } ad = user_ad; return 0; }
12,358
180,059
1
horDiff8(TIFF* tif, uint8* cp0, tmsize_t cc) { TIFFPredictorState* sp = PredictorState(tif); tmsize_t stride = sp->stride; unsigned char* cp = (unsigned char*) cp0; assert((cc%stride)==0); if (cc > stride) { cc -= stride; /* * Pipeline the most common cases. */ if (stride == 3) { unsigned int r1, g1, b1; unsigned int r2 = cp[0]; unsigned int g2 = cp[1]; unsigned int b2 = cp[2]; do { r1 = cp[3]; cp[3] = (unsigned char)((r1-r2)&0xff); r2 = r1; g1 = cp[4]; cp[4] = (unsigned char)((g1-g2)&0xff); g2 = g1; b1 = cp[5]; cp[5] = (unsigned char)((b1-b2)&0xff); b2 = b1; cp += 3; } while ((cc -= 3) > 0); } else if (stride == 4) { unsigned int r1, g1, b1, a1; unsigned int r2 = cp[0]; unsigned int g2 = cp[1]; unsigned int b2 = cp[2]; unsigned int a2 = cp[3]; do { r1 = cp[4]; cp[4] = (unsigned char)((r1-r2)&0xff); r2 = r1; g1 = cp[5]; cp[5] = (unsigned char)((g1-g2)&0xff); g2 = g1; b1 = cp[6]; cp[6] = (unsigned char)((b1-b2)&0xff); b2 = b1; a1 = cp[7]; cp[7] = (unsigned char)((a1-a2)&0xff); a2 = a1; cp += 4; } while ((cc -= 4) > 0); } else { cp += cc - 1; do { REPEAT4(stride, cp[stride] = (unsigned char)((cp[stride] - cp[0])&0xff); cp--) } while ((cc -= stride) > 0); } } }
12,359
159,216
0
void DownloadItemImplDelegate::OpenDownload(DownloadItemImpl* download) {}
12,360
118,977
0
void WebContentsImpl::OnDidProgrammaticallyScroll( const gfx::Vector2d& scroll_point) { if (delegate_) delegate_->DidProgrammaticallyScroll(this, scroll_point); }
12,361
90,269
0
static unsigned char intf_mem_inb(const struct si_sm_io *io, unsigned int offset) { return readb((io->addr)+(offset * io->regspacing)); }
12,362
179,482
1
acc_ctx_cont(OM_uint32 *minstat, gss_buffer_t buf, gss_ctx_id_t *ctx, gss_buffer_t *responseToken, gss_buffer_t *mechListMIC, OM_uint32 *negState, send_token_flag *return_token) { OM_uint32 ret, tmpmin; gss_OID supportedMech; spnego_gss_ctx_id_t sc; unsigned int len; unsigned char *ptr, *bufstart; sc = (spnego_gss_ctx_id_t)*ctx; ret = GSS_S_DEFECTIVE_TOKEN; *negState = REJECT; *minstat = 0; supportedMech = GSS_C_NO_OID; *return_token = ERROR_TOKEN_SEND; *responseToken = *mechListMIC = GSS_C_NO_BUFFER; ptr = bufstart = buf->value; #define REMAIN (buf->length - (ptr - bufstart)) if (REMAIN > INT_MAX) return GSS_S_DEFECTIVE_TOKEN; /* * Attempt to work with old Sun SPNEGO. */ if (*ptr == HEADER_ID) { ret = g_verify_token_header(gss_mech_spnego, &len, &ptr, 0, REMAIN); if (ret) { *minstat = ret; return GSS_S_DEFECTIVE_TOKEN; } } if (*ptr != (CONTEXT | 0x01)) { return GSS_S_DEFECTIVE_TOKEN; } ret = get_negTokenResp(minstat, ptr, REMAIN, negState, &supportedMech, responseToken, mechListMIC); if (ret != GSS_S_COMPLETE) goto cleanup; if (*responseToken == GSS_C_NO_BUFFER && *mechListMIC == GSS_C_NO_BUFFER) { ret = GSS_S_DEFECTIVE_TOKEN; goto cleanup; } if (supportedMech != GSS_C_NO_OID) { ret = GSS_S_DEFECTIVE_TOKEN; goto cleanup; } sc->firstpass = 0; *negState = ACCEPT_INCOMPLETE; *return_token = CONT_TOKEN_SEND; cleanup: if (supportedMech != GSS_C_NO_OID) { generic_gss_release_oid(&tmpmin, &supportedMech); } return ret; #undef REMAIN }
12,363
90,450
0
static ssize_t ib_uverbs_comp_event_read(struct file *filp, char __user *buf, size_t count, loff_t *pos) { struct ib_uverbs_completion_event_file *comp_ev_file = filp->private_data; return ib_uverbs_event_read(&comp_ev_file->ev_queue, comp_ev_file->uobj.ufile, filp, buf, count, pos, sizeof(struct ib_uverbs_comp_event_desc)); }
12,364
139,684
0
void AudioContext::resolvePromisesForSuspend() { ASSERT(isAudioThread()); ASSERT(isGraphOwner()); if (m_suspendResolvers.size() > 0) callOnMainThread(bind(&AudioContext::resolvePromisesForSuspendOnMainThread, this)); }
12,365
136,494
0
FloatClipRect GeometryMapper::LocalToAncestorClipRect( const PropertyTreeState& local_state, const PropertyTreeState& ancestor_state, OverlayScrollbarClipBehavior clip_behavior) { if (local_state.Clip() == ancestor_state.Clip()) return FloatClipRect(); bool success = false; auto result = LocalToAncestorClipRectInternal( local_state.Clip(), ancestor_state.Clip(), ancestor_state.Transform(), clip_behavior, kNonInclusiveIntersect, success); DCHECK(success); if (local_state.Effect() != ancestor_state.Effect()) result.ClearIsTight(); return result; }
12,366
158,971
0
void PDFiumEngine::LoadDocument() { if (!doc_ && !doc_loader_->IsDocumentComplete() && !FPDFAvail_IsDocAvail(fpdf_availability_, &download_hints_)) { return; } if (getting_password_) return; ScopedUnsupportedFeature scoped_unsupported_feature(this); ScopedSubstFont scoped_subst_font(this); bool needs_password = false; if (TryLoadingDoc(std::string(), &needs_password)) { ContinueLoadingDocument(std::string()); return; } if (needs_password) GetPasswordAndLoad(); else client_->DocumentLoadFailed(); }
12,367
52,609
0
init_ppp_file(struct ppp_file *pf, int kind) { pf->kind = kind; skb_queue_head_init(&pf->xq); skb_queue_head_init(&pf->rq); atomic_set(&pf->refcnt, 1); init_waitqueue_head(&pf->rwait); }
12,368
28,329
0
int au1100fb_fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *fbi) { struct au1100fb_device *fbdev; int dy; fbdev = to_au1100fb_device(fbi); print_dbg("fb_pan_display %p %p", var, fbi); if (!var || !fbdev) { return -EINVAL; } if (var->xoffset - fbi->var.xoffset) { /* No support for X panning for now! */ return -EINVAL; } print_dbg("fb_pan_display 2 %p %p", var, fbi); dy = var->yoffset - fbi->var.yoffset; if (dy) { u32 dmaaddr; print_dbg("Panning screen of %d lines", dy); dmaaddr = fbdev->regs->lcd_dmaaddr0; dmaaddr += (fbi->fix.line_length * dy); /* TODO: Wait for current frame to finished */ fbdev->regs->lcd_dmaaddr0 = LCD_DMA_SA_N(dmaaddr); if (panel_is_dual(fbdev->panel)) { dmaaddr = fbdev->regs->lcd_dmaaddr1; dmaaddr += (fbi->fix.line_length * dy); fbdev->regs->lcd_dmaaddr0 = LCD_DMA_SA_N(dmaaddr); } } print_dbg("fb_pan_display 3 %p %p", var, fbi); return 0; }
12,369
155,522
0
void CheckMaybeActivateDataReductionProxy(bool initially_enabled, bool request_succeeded, bool expected_enabled, bool expected_restricted, bool expected_fallback_restricted) { test_context_->SetDataReductionProxyEnabled(initially_enabled); test_context_->config()->UpdateConfigForTesting(initially_enabled, request_succeeded, true); ExpectSetProxyPrefs(expected_enabled, false); settings_->MaybeActivateDataReductionProxy(false); test_context_->RunUntilIdle(); }
12,370
52,423
0
static int xt_match_open(struct inode *inode, struct file *file) { struct nf_mttg_trav *trav; trav = __seq_open_private(file, &xt_match_seq_ops, sizeof(*trav)); if (!trav) return -ENOMEM; trav->nfproto = (unsigned long)PDE_DATA(inode); return 0; }
12,371
75,659
0
static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif) { struct usb_device *dev = chip->dev; struct usb_host_interface *host_iface; struct usb_interface_descriptor *altsd; int i, protocol; /* find audiocontrol interface */ host_iface = &usb_ifnum_to_if(dev, ctrlif)->altsetting[0]; altsd = get_iface_desc(host_iface); protocol = altsd->bInterfaceProtocol; switch (protocol) { default: dev_warn(&dev->dev, "unknown interface protocol %#02x, assuming v1\n", protocol); /* fall through */ case UAC_VERSION_1: { struct uac1_ac_header_descriptor *h1; int rest_bytes; h1 = snd_usb_find_csint_desc(host_iface->extra, host_iface->extralen, NULL, UAC_HEADER); if (!h1) { dev_err(&dev->dev, "cannot find UAC_HEADER\n"); return -EINVAL; } rest_bytes = (void *)(host_iface->extra + host_iface->extralen) - (void *)h1; /* just to be sure -- this shouldn't hit at all */ if (rest_bytes <= 0) { dev_err(&dev->dev, "invalid control header\n"); return -EINVAL; } if (rest_bytes < sizeof(*h1)) { dev_err(&dev->dev, "too short v1 buffer descriptor\n"); return -EINVAL; } if (!h1->bInCollection) { dev_info(&dev->dev, "skipping empty audio interface (v1)\n"); return -EINVAL; } if (rest_bytes < h1->bLength) { dev_err(&dev->dev, "invalid buffer length (v1)\n"); return -EINVAL; } if (h1->bLength < sizeof(*h1) + h1->bInCollection) { dev_err(&dev->dev, "invalid UAC_HEADER (v1)\n"); return -EINVAL; } for (i = 0; i < h1->bInCollection; i++) snd_usb_create_stream(chip, ctrlif, h1->baInterfaceNr[i]); break; } case UAC_VERSION_2: case UAC_VERSION_3: { struct usb_interface_assoc_descriptor *assoc = usb_ifnum_to_if(dev, ctrlif)->intf_assoc; if (!assoc) { /* * Firmware writers cannot count to three. So to find * the IAD on the NuForce UDH-100, also check the next * interface. */ struct usb_interface *iface = usb_ifnum_to_if(dev, ctrlif + 1); if (iface && iface->intf_assoc && iface->intf_assoc->bFunctionClass == USB_CLASS_AUDIO && iface->intf_assoc->bFunctionProtocol == UAC_VERSION_2) assoc = iface->intf_assoc; } if (!assoc) { dev_err(&dev->dev, "Audio class v2/v3 interfaces need an interface association\n"); return -EINVAL; } if (protocol == UAC_VERSION_3) { int badd = assoc->bFunctionSubClass; if (badd != UAC3_FUNCTION_SUBCLASS_FULL_ADC_3_0 && (badd < UAC3_FUNCTION_SUBCLASS_GENERIC_IO || badd > UAC3_FUNCTION_SUBCLASS_SPEAKERPHONE)) { dev_err(&dev->dev, "Unsupported UAC3 BADD profile\n"); return -EINVAL; } chip->badd_profile = badd; } for (i = 0; i < assoc->bInterfaceCount; i++) { int intf = assoc->bFirstInterface + i; if (intf != ctrlif) snd_usb_create_stream(chip, ctrlif, intf); } break; } } return 0; }
12,372
109,426
0
BlobRegistryContext(const KURL& url, PassOwnPtr<BlobData> blobData) : url(url.copy()) , blobData(blobData) { this->blobData->detachFromCurrentThread(); }
12,373
138,127
0
void AXObject::ariaLabelledbyElementVector( HeapVector<Member<Element>>& elements) const { elementsFromAttribute(elements, aria_labelledbyAttr); if (!elements.size()) elementsFromAttribute(elements, aria_labeledbyAttr); }
12,374
42,899
0
static int save_crashing_binary(pid_t pid, struct dump_dir *dd) { char buf[sizeof("/proc/%lu/exe") + sizeof(long)*3]; sprintf(buf, "/proc/%lu/exe", (long)pid); int src_fd_binary = open(buf, O_RDONLY); /* might fail and return -1, it's ok */ if (src_fd_binary < 0) { log_notice("Failed to open an image of crashing binary"); return 0; } int dst_fd = openat(dd->dd_fd, FILENAME_BINARY, O_WRONLY | O_CREAT | O_EXCL | O_TRUNC, DEFAULT_DUMP_DIR_MODE); if (dst_fd < 0) { log_notice("Failed to create file '"FILENAME_BINARY"' at '%s'", dd->dd_dirname); close(src_fd_binary); return -1; } IGNORE_RESULT(fchown(dst_fd, dd->dd_uid, dd->dd_gid)); off_t sz = copyfd_eof(src_fd_binary, dst_fd, COPYFD_SPARSE); close(src_fd_binary); return fsync(dst_fd) != 0 || close(dst_fd) != 0 || sz < 0; }
12,375
22,253
0
SYSCALL_DEFINE1(unshare, unsigned long, unshare_flags) { int err = 0; struct fs_struct *fs, *new_fs = NULL; struct sighand_struct *new_sigh = NULL; struct mm_struct *mm, *new_mm = NULL, *active_mm = NULL; struct files_struct *fd, *new_fd = NULL; struct nsproxy *new_nsproxy = NULL; int do_sysvsem = 0; check_unshare_flags(&unshare_flags); /* Return -EINVAL for all unsupported flags */ err = -EINVAL; if (unshare_flags & ~(CLONE_THREAD|CLONE_FS|CLONE_NEWNS|CLONE_SIGHAND| CLONE_VM|CLONE_FILES|CLONE_SYSVSEM| CLONE_NEWUTS|CLONE_NEWIPC|CLONE_NEWNET)) goto bad_unshare_out; /* * CLONE_NEWIPC must also detach from the undolist: after switching * to a new ipc namespace, the semaphore arrays from the old * namespace are unreachable. */ if (unshare_flags & (CLONE_NEWIPC|CLONE_SYSVSEM)) do_sysvsem = 1; if ((err = unshare_thread(unshare_flags))) goto bad_unshare_out; if ((err = unshare_fs(unshare_flags, &new_fs))) goto bad_unshare_cleanup_thread; if ((err = unshare_sighand(unshare_flags, &new_sigh))) goto bad_unshare_cleanup_fs; if ((err = unshare_vm(unshare_flags, &new_mm))) goto bad_unshare_cleanup_sigh; if ((err = unshare_fd(unshare_flags, &new_fd))) goto bad_unshare_cleanup_vm; if ((err = unshare_nsproxy_namespaces(unshare_flags, &new_nsproxy, new_fs))) goto bad_unshare_cleanup_fd; if (new_fs || new_mm || new_fd || do_sysvsem || new_nsproxy) { if (do_sysvsem) { /* * CLONE_SYSVSEM is equivalent to sys_exit(). */ exit_sem(current); } if (new_nsproxy) { switch_task_namespaces(current, new_nsproxy); new_nsproxy = NULL; } task_lock(current); if (new_fs) { fs = current->fs; spin_lock(&fs->lock); current->fs = new_fs; if (--fs->users) new_fs = NULL; else new_fs = fs; spin_unlock(&fs->lock); } if (new_mm) { mm = current->mm; active_mm = current->active_mm; current->mm = new_mm; current->active_mm = new_mm; if (current->signal->oom_score_adj == OOM_SCORE_ADJ_MIN) { atomic_dec(&mm->oom_disable_count); atomic_inc(&new_mm->oom_disable_count); } activate_mm(active_mm, new_mm); new_mm = mm; } if (new_fd) { fd = current->files; current->files = new_fd; new_fd = fd; } task_unlock(current); } if (new_nsproxy) put_nsproxy(new_nsproxy); bad_unshare_cleanup_fd: if (new_fd) put_files_struct(new_fd); bad_unshare_cleanup_vm: if (new_mm) mmput(new_mm); bad_unshare_cleanup_sigh: if (new_sigh) if (atomic_dec_and_test(&new_sigh->count)) kmem_cache_free(sighand_cachep, new_sigh); bad_unshare_cleanup_fs: if (new_fs) free_fs_struct(new_fs); bad_unshare_cleanup_thread: bad_unshare_out: return err; }
12,376
858
0
void ArthurOutputDev::saveState(GfxState *state) { m_painter->save(); }
12,377
90,060
0
size_t ZSTD_estimateCCtxSize_usingCParams(ZSTD_compressionParameters cParams) { ZSTD_CCtx_params const params = ZSTD_makeCCtxParamsFromCParams(cParams); return ZSTD_estimateCCtxSize_usingCCtxParams(&params); }
12,378
156,736
0
void WaitForElementVisible(FrameTreeNode* node, const std::string& sel) { RunCommandAndWaitForResponse( node, base::StringPrintf("notifyWhenVisible(document.querySelector('%s'));", sel.c_str()), "VISIBLE"); }
12,379
24,662
0
static void arm_timer(struct k_itimer *timer, union cpu_time_count now) { struct task_struct *p = timer->it.cpu.task; struct list_head *head, *listpos; struct cpu_timer_list *const nt = &timer->it.cpu; struct cpu_timer_list *next; unsigned long i; head = (CPUCLOCK_PERTHREAD(timer->it_clock) ? p->cpu_timers : p->signal->cpu_timers); head += CPUCLOCK_WHICH(timer->it_clock); BUG_ON(!irqs_disabled()); spin_lock(&p->sighand->siglock); listpos = head; if (CPUCLOCK_WHICH(timer->it_clock) == CPUCLOCK_SCHED) { list_for_each_entry(next, head, entry) { if (next->expires.sched > nt->expires.sched) break; listpos = &next->entry; } } else { list_for_each_entry(next, head, entry) { if (cputime_gt(next->expires.cpu, nt->expires.cpu)) break; listpos = &next->entry; } } list_add(&nt->entry, listpos); if (listpos == head) { /* * We are the new earliest-expiring timer. * If we are a thread timer, there can always * be a process timer telling us to stop earlier. */ if (CPUCLOCK_PERTHREAD(timer->it_clock)) { switch (CPUCLOCK_WHICH(timer->it_clock)) { default: BUG(); case CPUCLOCK_PROF: if (cputime_eq(p->it_prof_expires, cputime_zero) || cputime_gt(p->it_prof_expires, nt->expires.cpu)) p->it_prof_expires = nt->expires.cpu; break; case CPUCLOCK_VIRT: if (cputime_eq(p->it_virt_expires, cputime_zero) || cputime_gt(p->it_virt_expires, nt->expires.cpu)) p->it_virt_expires = nt->expires.cpu; break; case CPUCLOCK_SCHED: if (p->it_sched_expires == 0 || p->it_sched_expires > nt->expires.sched) p->it_sched_expires = nt->expires.sched; break; } } else { /* * For a process timer, we must balance * all the live threads' expirations. */ switch (CPUCLOCK_WHICH(timer->it_clock)) { default: BUG(); case CPUCLOCK_VIRT: if (!cputime_eq(p->signal->it_virt_expires, cputime_zero) && cputime_lt(p->signal->it_virt_expires, timer->it.cpu.expires.cpu)) break; goto rebalance; case CPUCLOCK_PROF: if (!cputime_eq(p->signal->it_prof_expires, cputime_zero) && cputime_lt(p->signal->it_prof_expires, timer->it.cpu.expires.cpu)) break; i = p->signal->rlim[RLIMIT_CPU].rlim_cur; if (i != RLIM_INFINITY && i <= cputime_to_secs(timer->it.cpu.expires.cpu)) break; goto rebalance; case CPUCLOCK_SCHED: rebalance: process_timer_rebalance( timer->it.cpu.task, CPUCLOCK_WHICH(timer->it_clock), timer->it.cpu.expires, now); break; } } } spin_unlock(&p->sighand->siglock); }
12,380
85,321
0
close_job(cupsd_client_t *con, /* I - Client connection */ ipp_attribute_t *uri) /* I - Printer URI */ { cupsd_job_t *job; /* Job */ ipp_attribute_t *attr; /* Attribute */ char job_uri[HTTP_MAX_URI], /* Job URI */ username[256]; /* User name */ cupsdLogMessage(CUPSD_LOG_DEBUG2, "close_job(%p[%d], %s)", con, con->number, uri->values[0].string.text); /* * See if we have a job URI or a printer URI... */ if (strcmp(uri->name, "printer-uri")) { /* * job-uri is not supported by Close-Job! */ send_ipp_status(con, IPP_BAD_REQUEST, _("Close-Job doesn't support the job-uri attribute.")); return; } /* * Got a printer URI; see if we also have a job-id attribute... */ if ((attr = ippFindAttribute(con->request, "job-id", IPP_TAG_INTEGER)) == NULL) { send_ipp_status(con, IPP_BAD_REQUEST, _("Got a printer-uri attribute but no job-id.")); return; } if ((job = cupsdFindJob(attr->values[0].integer)) == NULL) { /* * Nope - return a "not found" error... */ send_ipp_status(con, IPP_NOT_FOUND, _("Job #%d does not exist."), attr->values[0].integer); return; } /* * See if the job is owned by the requesting user... */ if (!validate_user(job, con, job->username, username, sizeof(username))) { send_http_error(con, con->username[0] ? HTTP_FORBIDDEN : HTTP_UNAUTHORIZED, cupsdFindDest(job->dest)); return; } /* * Add any ending sheet... */ if (cupsdTimeoutJob(job)) return; if (job->state_value == IPP_JOB_STOPPED) { job->state->values[0].integer = IPP_JOB_PENDING; job->state_value = IPP_JOB_PENDING; } else if (job->state_value == IPP_JOB_HELD) { if ((attr = ippFindAttribute(job->attrs, "job-hold-until", IPP_TAG_KEYWORD)) == NULL) attr = ippFindAttribute(job->attrs, "job-hold-until", IPP_TAG_NAME); if (!attr || !strcmp(attr->values[0].string.text, "no-hold")) { job->state->values[0].integer = IPP_JOB_PENDING; job->state_value = IPP_JOB_PENDING; } } job->dirty = 1; cupsdMarkDirty(CUPSD_DIRTY_JOBS); /* * Fill in the response info... */ httpAssembleURIf(HTTP_URI_CODING_ALL, job_uri, sizeof(job_uri), "ipp", NULL, con->clientname, con->clientport, "/jobs/%d", job->id); ippAddString(con->response, IPP_TAG_JOB, IPP_TAG_URI, "job-uri", NULL, job_uri); ippAddInteger(con->response, IPP_TAG_JOB, IPP_TAG_INTEGER, "job-id", job->id); ippAddInteger(con->response, IPP_TAG_JOB, IPP_TAG_ENUM, "job-state", job->state_value); con->response->request.status.status_code = IPP_OK; /* * Start the job if necessary... */ cupsdCheckJobs(); }
12,381
36,897
0
void unlock_two_nondirectories(struct inode *inode1, struct inode *inode2) { if (inode1 && !S_ISDIR(inode1->i_mode)) mutex_unlock(&inode1->i_mutex); if (inode2 && !S_ISDIR(inode2->i_mode) && inode2 != inode1) mutex_unlock(&inode2->i_mutex); }
12,382
83,923
0
static bool dev_type_flutter(enum sas_device_type new, enum sas_device_type old) { if (old == new) return true; /* treat device directed resets as flutter, if we went * SAS_END_DEVICE to SAS_SATA_PENDING the link needs recovery */ if ((old == SAS_SATA_PENDING && new == SAS_END_DEVICE) || (old == SAS_END_DEVICE && new == SAS_SATA_PENDING)) return true; return false; }
12,383
120,846
0
bool OneClickSigninHelper::OnFormSubmitted(const content::PasswordForm& form) { if (form.origin.is_valid() && gaia::IsGaiaSignonRealm(GURL(form.signon_realm))) { VLOG(1) << "OneClickSigninHelper::DidNavigateAnyFrame: got password"; password_ = UTF16ToUTF8(form.password_value); } return true; }
12,384
8,759
0
unsigned FAST_FUNC udhcp_option_idx(const char *name, const char *option_strings) { int n = index_in_strings(option_strings, name); if (n >= 0) return n; { char *buf, *d; const char *s; s = option_strings; while (*s) s += strlen(s) + 1; d = buf = xzalloc(s - option_strings); s = option_strings; while (!(*s == '\0' && s[1] == '\0')) { *d++ = (*s == '\0' ? ' ' : *s); s++; } bb_error_msg_and_die("unknown option '%s', known options: %s", name, buf); } }
12,385
86,791
0
_tiffReadProc(thandle_t fd, tdata_t buf, tsize_t size) { return (read((int) fd, buf, size)); }
12,386
133,105
0
void HWNDMessageHandler::NotifyOwnedWindowsParentClosing() { FindOwnedWindowsData data; data.window = hwnd(); EnumThreadWindows(GetCurrentThreadId(), FindOwnedWindowsCallback, reinterpret_cast<LPARAM>(&data)); for (size_t i = 0; i < data.owned_widgets.size(); ++i) data.owned_widgets[i]->OnOwnerClosing(); }
12,387
166,259
0
base::Optional<CameraCalibration> VideoCaptureManager::GetCameraCalibration( const std::string& device_id) { media::VideoCaptureDeviceInfo* info = GetDeviceInfoById(device_id); if (!info) return base::Optional<CameraCalibration>(); return info->descriptor.camera_calibration; }
12,388
77,357
0
ofproto_port_get_stp_status(struct ofproto *ofproto, ofp_port_t ofp_port, struct ofproto_port_stp_status *s) { struct ofport *ofport = ofproto_get_port(ofproto, ofp_port); if (!ofport) { VLOG_WARN_RL(&rl, "%s: cannot get STP status on nonexistent " "port %"PRIu32, ofproto->name, ofp_port); return ENODEV; } return (ofproto->ofproto_class->get_stp_port_status ? ofproto->ofproto_class->get_stp_port_status(ofport, s) : EOPNOTSUPP); }
12,389
131,673
0
static void reflectUnsignedShortAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) { TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; TestObjectPythonV8Internal::reflectUnsignedShortAttributeAttributeSetter(jsValue, info); TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); }
12,390
158,356
0
void RenderWidgetHostImpl::SendCursorVisibilityState(bool is_visible) { GetWidgetInputHandler()->CursorVisibilityChanged(is_visible); }
12,391
58,178
0
void resched_task(struct task_struct *p) { int cpu; lockdep_assert_held(&task_rq(p)->lock); if (test_tsk_need_resched(p)) return; set_tsk_need_resched(p); cpu = task_cpu(p); if (cpu == smp_processor_id()) { set_preempt_need_resched(); return; } /* NEED_RESCHED must be visible before we test polling */ smp_mb(); if (!tsk_is_polling(p)) smp_send_reschedule(cpu); }
12,392
171,367
0
void OMXCodec::setImageOutputFormat( OMX_COLOR_FORMATTYPE format, OMX_U32 width, OMX_U32 height) { CODEC_LOGV("setImageOutputFormat(%u, %u)", width, height); #if 0 OMX_INDEXTYPE index; status_t err = mOMX->get_extension_index( mNode, "OMX.TI.JPEG.decode.Config.OutputColorFormat", &index); CHECK_EQ(err, (status_t)OK); err = mOMX->set_config(mNode, index, &format, sizeof(format)); CHECK_EQ(err, (status_t)OK); #endif OMX_PARAM_PORTDEFINITIONTYPE def; InitOMXParams(&def); def.nPortIndex = kPortIndexOutput; 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_CodingUnused); imageDef->eColorFormat = format; imageDef->nFrameWidth = width; imageDef->nFrameHeight = height; switch (format) { case OMX_COLOR_FormatYUV420PackedPlanar: case OMX_COLOR_FormatYUV411Planar: { def.nBufferSize = (width * height * 3) / 2; break; } case OMX_COLOR_FormatCbYCrY: { def.nBufferSize = width * height * 2; break; } case OMX_COLOR_Format32bitARGB8888: { def.nBufferSize = width * height * 4; break; } case OMX_COLOR_Format16bitARGB4444: case OMX_COLOR_Format16bitARGB1555: case OMX_COLOR_Format16bitRGB565: case OMX_COLOR_Format16bitBGR565: { def.nBufferSize = width * height * 2; break; } default: CHECK(!"Should not be here. Unknown color format."); break; } def.nBufferCountActual = def.nBufferCountMin; err = mOMX->setParameter( mNode, OMX_IndexParamPortDefinition, &def, sizeof(def)); CHECK_EQ(err, (status_t)OK); }
12,393
143,137
0
void Document::cloneDataFromDocument(const Document& other) { setCompatibilityMode(other.getCompatibilityMode()); setEncodingData(other.m_encodingData); setContextFeatures(other.contextFeatures()); setSecurityOrigin(other.getSecurityOrigin()->isolatedCopy()); setMimeType(other.contentType()); }
12,394
167,499
0
HandleSignalsState DataPipeProducerDispatcher::GetHandleSignalsState() const { base::AutoLock lock(lock_); return GetHandleSignalsStateNoLock(); }
12,395
148,913
0
std::unique_ptr<RenderFrameHostImpl> RenderFrameHostManager::SetRenderFrameHost( std::unique_ptr<RenderFrameHostImpl> render_frame_host) { std::unique_ptr<RenderFrameHostImpl> old_render_frame_host = std::move(render_frame_host_); render_frame_host_ = std::move(render_frame_host); if (frame_tree_node_->IsMainFrame()) { if (render_frame_host_) { render_frame_host_->GetSiteInstance()-> IncrementRelatedActiveContentsCount(); } if (old_render_frame_host) { old_render_frame_host->GetSiteInstance()-> DecrementRelatedActiveContentsCount(); } } return old_render_frame_host; }
12,396
51
0
static char **make_subpats_table(int num_subpats, pcre_cache_entry *pce TSRMLS_DC) { pcre_extra *extra = pce->extra; int name_cnt = 0, name_size, ni = 0; int rc; char *name_table; unsigned short name_idx; char **subpat_names = (char **)ecalloc(num_subpats, sizeof(char *)); rc = pcre_fullinfo(pce->re, extra, PCRE_INFO_NAMECOUNT, &name_cnt); if (rc < 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Internal pcre_fullinfo() error %d", rc); efree(subpat_names); return NULL; } if (name_cnt > 0) { int rc1, rc2; rc1 = pcre_fullinfo(pce->re, extra, PCRE_INFO_NAMETABLE, &name_table); rc2 = pcre_fullinfo(pce->re, extra, PCRE_INFO_NAMEENTRYSIZE, &name_size); rc = rc2 ? rc2 : rc1; if (rc < 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Internal pcre_fullinfo() error %d", rc); efree(subpat_names); return NULL; } while (ni++ < name_cnt) { name_idx = 0xff * (unsigned char)name_table[0] + (unsigned char)name_table[1]; subpat_names[name_idx] = name_table + 2; if (is_numeric_string(subpat_names[name_idx], strlen(subpat_names[name_idx]), NULL, NULL, 0) > 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Numeric named subpatterns are not allowed"); efree(subpat_names); return NULL; } name_table += name_size; } } return subpat_names; }
12,397
106,721
0
bool WebView::isViewVisible() { return m_isVisible; }
12,398
119,518
0
virtual WebNavigationPolicy decidePolicyForNavigation( WebFrame*, const WebURLRequest&, WebNavigationType, WebNavigationPolicy defaultPolicy, bool isRedirect) { EXPECT_FALSE(isRedirect); return WebNavigationPolicyCurrentTab; }
12,399