unique_id
int64
13
189k
target
int64
0
1
code
stringlengths
20
241k
__index_level_0__
int64
0
18.9k
26,717
0
static int nl80211_pre_doit(struct genl_ops *ops, struct sk_buff *skb, struct genl_info *info) { struct cfg80211_registered_device *rdev; struct net_device *dev; int err; bool rtnl = ops->internal_flags & NL80211_FLAG_NEED_RTNL; if (rtnl) rtnl_lock(); if (ops->internal_flags & NL80211_FLAG_NEED_WIPHY) { rdev = cfg80211_get_dev_from_info(info); if (IS_ERR(rdev)) { if (rtnl) rtnl_unlock(); return PTR_ERR(rdev); } info->user_ptr[0] = rdev; } else if (ops->internal_flags & NL80211_FLAG_NEED_NETDEV) { err = get_rdev_dev_by_info_ifindex(info, &rdev, &dev); if (err) { if (rtnl) rtnl_unlock(); return err; } if (ops->internal_flags & NL80211_FLAG_CHECK_NETDEV_UP && !netif_running(dev)) { cfg80211_unlock_rdev(rdev); dev_put(dev); if (rtnl) rtnl_unlock(); return -ENETDOWN; } info->user_ptr[0] = rdev; info->user_ptr[1] = dev; } return 0; }
1,600
32,484
0
static inline u32 calc_crc(unsigned char *buf, int len) { u32 reg; u32 tmp; int j, k; reg = 0xffffffff; for (j = 0; j < len; j++) { reg ^= buf[j]; for (k = 0; k < 8; k++) { tmp = reg & 0x01; reg >>= 1; if (tmp) reg ^= 0xedb88320; } } return ~reg; }
1,601
54,288
0
SPL_METHOD(SplDoublyLinkedList, offsetUnset) { zval *zindex; zend_long index; spl_dllist_object *intern; spl_ptr_llist_element *element; spl_ptr_llist *llist; if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &zindex) == FAILURE) { return; } intern = Z_SPLDLLIST_P(getThis()); index = spl_offset_convert_to_long(zindex); llist = intern->llist; if (index < 0 || index >= intern->llist->count) { zend_throw_exception(spl_ce_OutOfRangeException, "Offset out of range", 0); return; } element = spl_ptr_llist_offset(intern->llist, index, intern->flags & SPL_DLLIST_IT_LIFO); if (element != NULL) { /* connect the neightbors */ if (element->prev) { element->prev->next = element->next; } if (element->next) { element->next->prev = element->prev; } /* take care of head/tail */ if (element == llist->head) { llist->head = element->next; } if (element == llist->tail) { llist->tail = element->prev; } /* finally, delete the element */ llist->count--; if(llist->dtor) { llist->dtor(element); } if (intern->traverse_pointer == element) { SPL_LLIST_DELREF(element); intern->traverse_pointer = NULL; } zval_ptr_dtor(&element->data); ZVAL_UNDEF(&element->data); SPL_LLIST_DELREF(element); } else { zend_throw_exception(spl_ce_OutOfRangeException, "Offset invalid", 0); return; } } /* }}} */ static void spl_dllist_it_dtor(zend_object_iterator *iter) /* {{{ */
1,602
96,076
0
void flush_stdin(void) { if (isatty(STDIN_FILENO)) { int cnt = 0; ioctl(STDIN_FILENO, FIONREAD, &cnt); if (cnt) { if (!arg_quiet) printf("Warning: removing %d bytes from stdin\n", cnt); ioctl(STDIN_FILENO, TCFLSH, TCIFLUSH); } } }
1,603
61,256
0
EXPORTED int mboxlist_createmailboxcheck(const char *name, int mbtype __attribute__((unused)), const char *partition, int isadmin, const char *userid, const struct auth_state *auth_state, char **newacl, char **newpartition, int forceuser) { char *part = NULL; char *acl = NULL; int r = 0; r = mboxlist_create_namecheck(name, userid, auth_state, isadmin, forceuser); if (r) goto done; if (newacl) { r = mboxlist_create_acl(name, &acl); if (r) goto done; } if (newpartition) { r = mboxlist_create_partition(name, partition, &part); if (r) goto done; } done: if (r || !newacl) free(acl); else *newacl = acl; if (r || !newpartition) free(part); else *newpartition = part; return r; }
1,604
94,721
0
void gdImageWebpEx (gdImagePtr im, FILE * outFile, int quantization) { gdIOCtx *out = gdNewFileCtx(outFile); gdImageWebpCtx(im, out, quantization); out->gd_free(out); }
1,605
7,298
0
hook_get_priority_and_name (const char *name, int *priority, const char **ptr_name) { char *pos, *str_priority, *error; long number; if (priority) *priority = HOOK_PRIORITY_DEFAULT; if (ptr_name) *ptr_name = name; pos = strchr (name, '|'); if (pos) { str_priority = string_strndup (name, pos - name); if (str_priority) { error = NULL; number = strtol (str_priority, &error, 10); if (error && !error[0]) { if (priority) *priority = number; if (ptr_name) *ptr_name = pos + 1; } free (str_priority); } } }
1,606
101,215
0
bool Syncer::ExitRequested() { base::AutoLock lock(early_exit_requested_lock_); return early_exit_requested_; }
1,607
72,967
0
static int pnm_getsintstr(jas_stream_t *in, int_fast32_t *val) { int c; int s; int_fast32_t v; /* Discard any leading whitespace. */ do { if ((c = pnm_getc(in)) == EOF) { return -1; } } while (isspace(c)); /* Get the number, allowing for a negative sign. */ s = 1; if (c == '-') { s = -1; if ((c = pnm_getc(in)) == EOF) { return -1; } } else if (c == '+') { if ((c = pnm_getc(in)) == EOF) { return -1; } } v = 0; while (isdigit(c)) { v = 10 * v + c - '0'; if ((c = pnm_getc(in)) < 0) { return -1; } } /* The number must be followed by whitespace. */ if (!isspace(c)) { return -1; } if (val) { *val = (s >= 0) ? v : (-v); } return 0; }
1,608
1,621
0
assegment_normalise (struct assegment *head) { struct assegment *seg = head, *pin; struct assegment *tmp; if (!head) return head; while (seg) { pin = seg; /* Sort values SET segments, for determinism in paths to aid * creation of hash values / path comparisons * and because it helps other lesser implementations ;) */ if (seg->type == AS_SET || seg->type == AS_CONFED_SET) { int tail = 0; int i; qsort (seg->as, seg->length, sizeof(as_t), int_cmp); /* weed out dupes */ for (i=1; i < seg->length; i++) { if (seg->as[tail] == seg->as[i]) continue; tail++; if (tail < i) seg->as[tail] = seg->as[i]; } /* seg->length can be 0.. */ if (seg->length) seg->length = tail + 1; } /* read ahead from the current, pinned segment while the segments * are packable/mergeable. Append all following packable segments * to the segment we have pinned and remove these appended * segments. */ while (pin->next && ASSEGMENT_TYPES_PACKABLE(pin, pin->next)) { tmp = pin->next; seg = pin->next; /* append the next sequence to the pinned sequence */ pin = assegment_append_asns (pin, seg->as, seg->length); /* bypass the next sequence */ pin->next = seg->next; /* get rid of the now referenceless segment */ assegment_free (tmp); } seg = pin->next; } return head; }
1,609
4,022
0
GBool DCTStream::readProgressiveDataUnit(DCTHuffTable *dcHuffTable, DCTHuffTable *acHuffTable, int *prevDC, int data[64]) { int run, size, amp, bit, c; int i, j, k; i = scanInfo.firstCoeff; if (i == 0) { if (scanInfo.ah == 0) { if ((size = readHuffSym(dcHuffTable)) == 9999) { return gFalse; } if (size > 0) { if ((amp = readAmp(size)) == 9999) { return gFalse; } } else { amp = 0; } data[0] += (*prevDC += amp) << scanInfo.al; } else { if ((bit = readBit()) == 9999) { return gFalse; } data[0] += bit << scanInfo.al; } ++i; } if (scanInfo.lastCoeff == 0) { return gTrue; } if (eobRun > 0) { while (i <= scanInfo.lastCoeff) { j = dctZigZag[i++]; if (data[j] != 0) { if ((bit = readBit()) == EOF) { return gFalse; } if (bit) { data[j] += 1 << scanInfo.al; } } } --eobRun; return gTrue; } while (i <= scanInfo.lastCoeff) { if ((c = readHuffSym(acHuffTable)) == 9999) { return gFalse; } if (c == 0xf0) { k = 0; while (k < 16 && i <= scanInfo.lastCoeff) { j = dctZigZag[i++]; if (data[j] == 0) { ++k; } else { if ((bit = readBit()) == EOF) { return gFalse; } if (bit) { data[j] += 1 << scanInfo.al; } } } } else if ((c & 0x0f) == 0x00) { j = c >> 4; eobRun = 0; for (k = 0; k < j; ++k) { if ((bit = readBit()) == EOF) { return gFalse; } eobRun = (eobRun << 1) | bit; } eobRun += 1 << j; while (i <= scanInfo.lastCoeff) { j = dctZigZag[i++]; if (data[j] != 0) { if ((bit = readBit()) == EOF) { return gFalse; } if (bit) { data[j] += 1 << scanInfo.al; } } } --eobRun; break; } else { run = (c >> 4) & 0x0f; size = c & 0x0f; if ((amp = readAmp(size)) == 9999) { return gFalse; } j = 0; // make gcc happy for (k = 0; k <= run && i <= scanInfo.lastCoeff; ++k) { j = dctZigZag[i++]; while (data[j] != 0 && i <= scanInfo.lastCoeff) { if ((bit = readBit()) == EOF) { return gFalse; } if (bit) { data[j] += 1 << scanInfo.al; } j = dctZigZag[i++]; } } data[j] = amp << scanInfo.al; } } return gTrue; }
1,610
29,685
0
static int read_header(struct pstore *ps, int *new_snapshot) { int r; struct disk_header *dh; unsigned chunk_size; int chunk_size_supplied = 1; char *chunk_err; /* * Use default chunk size (or logical_block_size, if larger) * if none supplied */ if (!ps->store->chunk_size) { ps->store->chunk_size = max(DM_CHUNK_SIZE_DEFAULT_SECTORS, bdev_logical_block_size(dm_snap_cow(ps->store->snap)-> bdev) >> 9); ps->store->chunk_mask = ps->store->chunk_size - 1; ps->store->chunk_shift = ffs(ps->store->chunk_size) - 1; chunk_size_supplied = 0; } ps->io_client = dm_io_client_create(); if (IS_ERR(ps->io_client)) return PTR_ERR(ps->io_client); r = alloc_area(ps); if (r) return r; r = chunk_io(ps, ps->header_area, 0, READ, 1); if (r) goto bad; dh = ps->header_area; if (le32_to_cpu(dh->magic) == 0) { *new_snapshot = 1; return 0; } if (le32_to_cpu(dh->magic) != SNAP_MAGIC) { DMWARN("Invalid or corrupt snapshot"); r = -ENXIO; goto bad; } *new_snapshot = 0; ps->valid = le32_to_cpu(dh->valid); ps->version = le32_to_cpu(dh->version); chunk_size = le32_to_cpu(dh->chunk_size); if (ps->store->chunk_size == chunk_size) return 0; if (chunk_size_supplied) DMWARN("chunk size %u in device metadata overrides " "table chunk size of %u.", chunk_size, ps->store->chunk_size); /* We had a bogus chunk_size. Fix stuff up. */ free_area(ps); r = dm_exception_store_set_chunk_size(ps->store, chunk_size, &chunk_err); if (r) { DMERR("invalid on-disk chunk size %u: %s.", chunk_size, chunk_err); return r; } r = alloc_area(ps); return r; bad: free_area(ps); return r; }
1,611
84,478
0
convert_size3(clen_t size) { Str tmp = Strnew(); int n; do { n = size % 1000; size /= 1000; tmp = Sprintf(size ? ",%.3d%s" : "%d%s", n, tmp->ptr); } while (size); return tmp->ptr; }
1,612
53,475
0
lzss_current_pointer(struct lzss *lzss) { return lzss_pointer_for_position(lzss, lzss->position); }
1,613
20,136
0
struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority) { struct sock *newsk; newsk = sk_prot_alloc(sk->sk_prot, priority, sk->sk_family); if (newsk != NULL) { struct sk_filter *filter; sock_copy(newsk, sk); /* SANITY */ get_net(sock_net(newsk)); sk_node_init(&newsk->sk_node); sock_lock_init(newsk); bh_lock_sock(newsk); newsk->sk_backlog.head = newsk->sk_backlog.tail = NULL; newsk->sk_backlog.len = 0; atomic_set(&newsk->sk_rmem_alloc, 0); /* * sk_wmem_alloc set to one (see sk_free() and sock_wfree()) */ atomic_set(&newsk->sk_wmem_alloc, 1); atomic_set(&newsk->sk_omem_alloc, 0); skb_queue_head_init(&newsk->sk_receive_queue); skb_queue_head_init(&newsk->sk_write_queue); #ifdef CONFIG_NET_DMA skb_queue_head_init(&newsk->sk_async_wait_queue); #endif spin_lock_init(&newsk->sk_dst_lock); rwlock_init(&newsk->sk_callback_lock); lockdep_set_class_and_name(&newsk->sk_callback_lock, af_callback_keys + newsk->sk_family, af_family_clock_key_strings[newsk->sk_family]); newsk->sk_dst_cache = NULL; newsk->sk_wmem_queued = 0; newsk->sk_forward_alloc = 0; newsk->sk_send_head = NULL; newsk->sk_userlocks = sk->sk_userlocks & ~SOCK_BINDPORT_LOCK; sock_reset_flag(newsk, SOCK_DONE); skb_queue_head_init(&newsk->sk_error_queue); filter = rcu_dereference_protected(newsk->sk_filter, 1); if (filter != NULL) sk_filter_charge(newsk, filter); if (unlikely(xfrm_sk_clone_policy(newsk))) { /* It is still raw copy of parent, so invalidate * destructor and make plain sk_free() */ newsk->sk_destruct = NULL; bh_unlock_sock(newsk); sk_free(newsk); newsk = NULL; goto out; } newsk->sk_err = 0; newsk->sk_priority = 0; /* * Before updating sk_refcnt, we must commit prior changes to memory * (Documentation/RCU/rculist_nulls.txt for details) */ smp_wmb(); atomic_set(&newsk->sk_refcnt, 2); /* * Increment the counter in the same struct proto as the master * sock (sk_refcnt_debug_inc uses newsk->sk_prot->socks, that * is the same as sk->sk_prot->socks, as this field was copied * with memcpy). * * This _changes_ the previous behaviour, where * tcp_create_openreq_child always was incrementing the * equivalent to tcp_prot->socks (inet_sock_nr), so this have * to be taken into account in all callers. -acme */ sk_refcnt_debug_inc(newsk); sk_set_socket(newsk, NULL); newsk->sk_wq = NULL; sk_update_clone(sk, newsk); if (newsk->sk_prot->sockets_allocated) sk_sockets_allocated_inc(newsk); if (newsk->sk_flags & SK_FLAGS_TIMESTAMP) net_enable_timestamp(); } out: return newsk; }
1,614
112,694
0
const KURL& DocumentLoader::responseURL() const { return m_response.url(); }
1,615
84,528
0
process_mouse(int btn, int x, int y) { int delta_x, delta_y, i; static int press_btn = MOUSE_BTN_RESET, press_x, press_y; TabBuffer *t; int ny = -1; if (nTab > 1 || mouse_action.menu_str) ny = LastTab->y + 1; if (btn == MOUSE_BTN_UP) { switch (press_btn) { case MOUSE_BTN1_DOWN: if (press_y == y && press_x == x) do_mouse_action(press_btn, x, y); else if (ny > 0 && y < ny) { if (press_y < ny) { moveTab(posTab(press_x, press_y), posTab(x, y), (press_y == y) ? (press_x < x) : (press_y < y)); return; } else if (press_x >= Currentbuf->rootX) { Buffer *buf = Currentbuf; int cx = Currentbuf->cursorX, cy = Currentbuf->cursorY; t = posTab(x, y); if (t == NULL) return; if (t == NO_TABBUFFER) t = NULL; /* open new tab */ cursorXY(Currentbuf, press_x - Currentbuf->rootX, press_y - Currentbuf->rootY); if (Currentbuf->cursorY == press_y - Currentbuf->rootY && (Currentbuf->cursorX == press_x - Currentbuf->rootX #ifdef USE_M17N || (WcOption.use_wide && Currentbuf->currentLine != NULL && (CharType(Currentbuf->currentLine-> propBuf[Currentbuf->pos]) == PC_KANJI1) && Currentbuf->cursorX == press_x - Currentbuf->rootX - 1) #endif )) { displayBuffer(Currentbuf, B_NORMAL); followTab(t); } if (buf == Currentbuf) cursorXY(Currentbuf, cx, cy); } return; } else { delta_x = x - press_x; delta_y = y - press_y; if (abs(delta_x) < abs(delta_y) / 3) delta_x = 0; if (abs(delta_y) < abs(delta_x) / 3) delta_y = 0; if (reverse_mouse) { delta_y = -delta_y; delta_x = -delta_x; } if (delta_y > 0) { prec_num = delta_y; ldown1(); } else if (delta_y < 0) { prec_num = -delta_y; lup1(); } if (delta_x > 0) { prec_num = delta_x; col1L(); } else if (delta_x < 0) { prec_num = -delta_x; col1R(); } } break; case MOUSE_BTN2_DOWN: case MOUSE_BTN3_DOWN: if (press_y == y && press_x == x) do_mouse_action(press_btn, x, y); break; case MOUSE_BTN4_DOWN_RXVT: for (i = 0; i < mouse_scroll_line(); i++) ldown1(); break; case MOUSE_BTN5_DOWN_RXVT: for (i = 0; i < mouse_scroll_line(); i++) lup1(); break; } } else if (btn == MOUSE_BTN4_DOWN_XTERM) { for (i = 0; i < mouse_scroll_line(); i++) ldown1(); } else if (btn == MOUSE_BTN5_DOWN_XTERM) { for (i = 0; i < mouse_scroll_line(); i++) lup1(); } if (btn != MOUSE_BTN4_DOWN_RXVT || press_btn == MOUSE_BTN_RESET) { press_btn = btn; press_x = x; press_y = y; } else { press_btn = MOUSE_BTN_RESET; } }
1,616
156,789
0
Element* Document::CreateElement(const QualifiedName& q_name, const CreateElementFlags flags, const AtomicString& is) { CustomElementDefinition* definition = nullptr; if (flags.IsCustomElementsV1() && q_name.NamespaceURI() == HTMLNames::xhtmlNamespaceURI) { const CustomElementDescriptor desc(is.IsNull() ? q_name.LocalName() : is, q_name.LocalName()); if (CustomElementRegistry* registry = CustomElement::Registry(*this)) definition = registry->DefinitionFor(desc); } if (definition) return definition->CreateElement(*this, q_name, flags); return CustomElement::CreateUncustomizedOrUndefinedElement(*this, q_name, flags, is); }
1,617
95,509
0
static qboolean S_AL_BufferEvict( void ) { int i, oldestBuffer = -1; int oldestTime = Sys_Milliseconds( ); for( i = 0; i < numSfx; i++ ) { if( !knownSfx[ i ].filename[ 0 ] ) continue; if( !knownSfx[ i ].inMemory ) continue; if( knownSfx[ i ].lastUsedTime < oldestTime ) { oldestTime = knownSfx[ i ].lastUsedTime; oldestBuffer = i; } } if( oldestBuffer >= 0 ) { S_AL_BufferUnload( oldestBuffer ); return qtrue; } else return qfalse; }
1,618
142,781
0
WebMediaPlayer::DisplayType HTMLMediaElement::DisplayType() const { return IsFullscreen() ? WebMediaPlayer::DisplayType::kFullscreen : WebMediaPlayer::DisplayType::kInline; }
1,619
164,656
0
void IndexedDBDatabase::ReportErrorWithDetails(Status status, const char* message) { DCHECK(!status.ok()); if (status.IsCorruption()) { IndexedDBDatabaseError error(blink::kWebIDBDatabaseExceptionUnknownError, message); factory_->HandleBackingStoreCorruption(backing_store_->origin(), error); } else { factory_->HandleBackingStoreFailure(backing_store_->origin()); } }
1,620
64,269
0
static const char *set_async_filter(cmd_parms *cmd, void *dummy, const char *arg) { core_server_config *conf = ap_get_core_module_config(cmd->server->module_config); const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE); if (err) { return err; } if (ap_cstr_casecmp(arg, "network") == 0) { conf->async_filter = AP_FTYPE_NETWORK; } else if (ap_cstr_casecmp(arg, "connection") == 0) { conf->async_filter = AP_FTYPE_CONNECTION; } else if (ap_cstr_casecmp(arg, "request") == 0) { conf->async_filter = 0; } else { return "AsyncFilter must be 'network', 'connection' or 'request'"; } conf->async_filter_set = 1; return NULL; }
1,621
154,040
0
void GLES2DecoderImpl::DoMatrixLoadfCHROMIUM(GLenum matrix_mode, const volatile GLfloat* matrix) { DCHECK(matrix_mode == GL_PATH_PROJECTION_CHROMIUM || matrix_mode == GL_PATH_MODELVIEW_CHROMIUM); GLfloat* target_matrix = matrix_mode == GL_PATH_PROJECTION_CHROMIUM ? state_.projection_matrix : state_.modelview_matrix; memcpy(target_matrix, const_cast<const GLfloat*>(matrix), sizeof(GLfloat) * 16); api()->glMatrixLoadfEXTFn(matrix_mode, target_matrix); }
1,622
20,154
0
struct sk_buff *sock_alloc_send_skb(struct sock *sk, unsigned long size, int noblock, int *errcode) { return sock_alloc_send_pskb(sk, size, 0, noblock, errcode); }
1,623
105,021
0
virtual void TearDown() { ui_loop_.RunAllPending(); io_thread_.Stop(); ui_loop_.RunAllPending(); }
1,624
188,033
1
SoftMPEG4Encoder::~SoftMPEG4Encoder() { ALOGV("Destruct SoftMPEG4Encoder"); releaseEncoder(); List<BufferInfo *> &outQueue = getPortQueue(1); List<BufferInfo *> &inQueue = getPortQueue(0); CHECK(outQueue.empty()); CHECK(inQueue.empty()); }
1,625
147,582
0
void V8TestObject::NodeAttributeAttributeSetterCallback( const v8::FunctionCallbackInfo<v8::Value>& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestObject_nodeAttribute_Setter"); v8::Local<v8::Value> v8_value = info[0]; test_object_v8_internal::NodeAttributeAttributeSetter(v8_value, info); }
1,626
121,969
0
void AppListController::FreeAnyKeepAliveForView() { if (keep_alive_) keep_alive_.reset(NULL); }
1,627
42,093
0
mm_answer_keyallowed(int sock, Buffer *m) { Key *key; char *cuser, *chost; u_char *blob; u_int bloblen, pubkey_auth_attempt; enum mm_keytype type = 0; int allowed = 0; debug3("%s entering", __func__); type = buffer_get_int(m); cuser = buffer_get_string(m, NULL); chost = buffer_get_string(m, NULL); blob = buffer_get_string(m, &bloblen); pubkey_auth_attempt = buffer_get_int(m); key = key_from_blob(blob, bloblen); if ((compat20 && type == MM_RSAHOSTKEY) || (!compat20 && type != MM_RSAHOSTKEY)) fatal("%s: key type and protocol mismatch", __func__); debug3("%s: key_from_blob: %p", __func__, key); if (key != NULL && authctxt->valid) { /* These should not make it past the privsep child */ if (key_type_plain(key->type) == KEY_RSA && (datafellows & SSH_BUG_RSASIGMD5) != 0) fatal("%s: passed a SSH_BUG_RSASIGMD5 key", __func__); switch (type) { case MM_USERKEY: allowed = options.pubkey_authentication && !auth2_userkey_already_used(authctxt, key) && match_pattern_list(sshkey_ssh_name(key), options.pubkey_key_types, 0) == 1 && user_key_allowed(authctxt->pw, key, pubkey_auth_attempt); pubkey_auth_info(authctxt, key, NULL); auth_method = "publickey"; if (options.pubkey_authentication && (!pubkey_auth_attempt || allowed != 1)) auth_clear_options(); break; case MM_HOSTKEY: allowed = options.hostbased_authentication && match_pattern_list(sshkey_ssh_name(key), options.hostbased_key_types, 0) == 1 && hostbased_key_allowed(authctxt->pw, cuser, chost, key); pubkey_auth_info(authctxt, key, "client user \"%.100s\", client host \"%.100s\"", cuser, chost); auth_method = "hostbased"; break; #ifdef WITH_SSH1 case MM_RSAHOSTKEY: key->type = KEY_RSA1; /* XXX */ allowed = options.rhosts_rsa_authentication && auth_rhosts_rsa_key_allowed(authctxt->pw, cuser, chost, key); if (options.rhosts_rsa_authentication && allowed != 1) auth_clear_options(); auth_method = "rsa"; break; #endif default: fatal("%s: unknown key type %d", __func__, type); break; } } if (key != NULL) key_free(key); /* clear temporarily storage (used by verify) */ monitor_reset_key_state(); if (allowed) { /* Save temporarily for comparison in verify */ key_blob = blob; key_bloblen = bloblen; key_blobtype = type; hostbased_cuser = cuser; hostbased_chost = chost; } else { /* Log failed attempt */ auth_log(authctxt, 0, 0, auth_method, NULL); free(blob); free(cuser); free(chost); } debug3("%s: key %p is %s", __func__, key, allowed ? "allowed" : "not allowed"); buffer_clear(m); buffer_put_int(m, allowed); buffer_put_int(m, forced_command != NULL); mm_request_send(sock, MONITOR_ANS_KEYALLOWED, m); if (type == MM_RSAHOSTKEY) monitor_permit(mon_dispatch, MONITOR_REQ_RSACHALLENGE, allowed); return (0); }
1,628
53,940
0
size_t ndp_msg_opt_slladdr_len(struct ndp_msg *msg, int offset) { return ETH_ALEN; }
1,629
35,037
0
SCTP_STATIC int sctp_setsockopt(struct sock *sk, int level, int optname, char __user *optval, int optlen) { int retval = 0; SCTP_DEBUG_PRINTK("sctp_setsockopt(sk: %p... optname: %d)\n", sk, optname); /* I can hardly begin to describe how wrong this is. This is * so broken as to be worse than useless. The API draft * REALLY is NOT helpful here... I am not convinced that the * semantics of setsockopt() with a level OTHER THAN SOL_SCTP * are at all well-founded. */ if (level != SOL_SCTP) { struct sctp_af *af = sctp_sk(sk)->pf->af; retval = af->setsockopt(sk, level, optname, optval, optlen); goto out_nounlock; } sctp_lock_sock(sk); switch (optname) { case SCTP_SOCKOPT_BINDX_ADD: /* 'optlen' is the size of the addresses buffer. */ retval = sctp_setsockopt_bindx(sk, (struct sockaddr __user *)optval, optlen, SCTP_BINDX_ADD_ADDR); break; case SCTP_SOCKOPT_BINDX_REM: /* 'optlen' is the size of the addresses buffer. */ retval = sctp_setsockopt_bindx(sk, (struct sockaddr __user *)optval, optlen, SCTP_BINDX_REM_ADDR); break; case SCTP_SOCKOPT_CONNECTX: /* 'optlen' is the size of the addresses buffer. */ retval = sctp_setsockopt_connectx(sk, (struct sockaddr __user *)optval, optlen); break; case SCTP_DISABLE_FRAGMENTS: retval = sctp_setsockopt_disable_fragments(sk, optval, optlen); break; case SCTP_EVENTS: retval = sctp_setsockopt_events(sk, optval, optlen); break; case SCTP_AUTOCLOSE: retval = sctp_setsockopt_autoclose(sk, optval, optlen); break; case SCTP_PEER_ADDR_PARAMS: retval = sctp_setsockopt_peer_addr_params(sk, optval, optlen); break; case SCTP_DELAYED_ACK_TIME: retval = sctp_setsockopt_delayed_ack_time(sk, optval, optlen); break; case SCTP_INITMSG: retval = sctp_setsockopt_initmsg(sk, optval, optlen); break; case SCTP_DEFAULT_SEND_PARAM: retval = sctp_setsockopt_default_send_param(sk, optval, optlen); break; case SCTP_PRIMARY_ADDR: retval = sctp_setsockopt_primary_addr(sk, optval, optlen); break; case SCTP_SET_PEER_PRIMARY_ADDR: retval = sctp_setsockopt_peer_primary_addr(sk, optval, optlen); break; case SCTP_NODELAY: retval = sctp_setsockopt_nodelay(sk, optval, optlen); break; case SCTP_RTOINFO: retval = sctp_setsockopt_rtoinfo(sk, optval, optlen); break; case SCTP_ASSOCINFO: retval = sctp_setsockopt_associnfo(sk, optval, optlen); break; case SCTP_I_WANT_MAPPED_V4_ADDR: retval = sctp_setsockopt_mappedv4(sk, optval, optlen); break; case SCTP_MAXSEG: retval = sctp_setsockopt_maxseg(sk, optval, optlen); break; case SCTP_ADAPTATION_LAYER: retval = sctp_setsockopt_adaptation_layer(sk, optval, optlen); break; case SCTP_CONTEXT: retval = sctp_setsockopt_context(sk, optval, optlen); break; default: retval = -ENOPROTOOPT; break; }; sctp_release_sock(sk); out_nounlock: return retval; }
1,630
19,967
0
int nfs4_proc_get_lease_time(struct nfs_client *clp, struct nfs_fsinfo *fsinfo) { struct rpc_task *task; struct nfs4_get_lease_time_args args; struct nfs4_get_lease_time_res res = { .lr_fsinfo = fsinfo, }; struct nfs4_get_lease_time_data data = { .args = &args, .res = &res, .clp = clp, }; struct rpc_message msg = { .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_GET_LEASE_TIME], .rpc_argp = &args, .rpc_resp = &res, }; struct rpc_task_setup task_setup = { .rpc_client = clp->cl_rpcclient, .rpc_message = &msg, .callback_ops = &nfs4_get_lease_time_ops, .callback_data = &data, .flags = RPC_TASK_TIMEOUT, }; int status; nfs41_init_sequence(&args.la_seq_args, &res.lr_seq_res, 0); dprintk("--> %s\n", __func__); task = rpc_run_task(&task_setup); if (IS_ERR(task)) status = PTR_ERR(task); else { status = task->tk_status; rpc_put_task(task); } dprintk("<-- %s return %d\n", __func__, status); return status; }
1,631
108,726
0
void ChromotingInstance::SetCursorShape( const protocol::CursorShapeInfo& cursor_shape) { if (!cursor_shape.has_data() || !cursor_shape.has_width() || !cursor_shape.has_height() || !cursor_shape.has_hotspot_x() || !cursor_shape.has_hotspot_y()) { return; } int width = cursor_shape.width(); int height = cursor_shape.height(); if (width < 0 || height < 0) { return; } if (width > 32 || height > 32) { VLOG(2) << "Cursor too large for SetCursor: " << width << "x" << height << " > 32x32"; return; } if (pp::ImageData::GetNativeImageDataFormat() != PP_IMAGEDATAFORMAT_BGRA_PREMUL) { VLOG(2) << "Unable to set cursor shape - non-native image format"; return; } int hotspot_x = cursor_shape.hotspot_x(); int hotspot_y = cursor_shape.hotspot_y(); pp::ImageData cursor_image(this, PP_IMAGEDATAFORMAT_BGRA_PREMUL, pp::Size(width, height), false); int bytes_per_row = width * kBytesPerPixel; const uint8* src_row_data = reinterpret_cast<const uint8*>( cursor_shape.data().data()); uint8* dst_row_data = reinterpret_cast<uint8*>(cursor_image.data()); for (int row = 0; row < height; row++) { memcpy(dst_row_data, src_row_data, bytes_per_row); src_row_data += bytes_per_row; dst_row_data += cursor_image.stride(); } pp::MouseCursor::SetCursor(this, PP_MOUSECURSOR_TYPE_CUSTOM, cursor_image, pp::Point(hotspot_x, hotspot_y)); }
1,632
65,659
0
nfsd_inject_forget_client_openowners(struct sockaddr_storage *addr, size_t addr_size) { unsigned int count = 0; struct nfs4_client *clp; struct nfsd_net *nn = net_generic(current->nsproxy->net_ns, nfsd_net_id); LIST_HEAD(reaplist); if (!nfsd_netns_ready(nn)) return count; spin_lock(&nn->client_lock); clp = nfsd_find_client(addr, addr_size); if (clp) count = nfsd_collect_client_openowners(clp, &reaplist, 0); spin_unlock(&nn->client_lock); nfsd_reap_openowners(&reaplist); return count; }
1,633
173,646
0
bool ATSParser::PTSTimeDeltaEstablished() { if (mPrograms.isEmpty()) { return false; } return mPrograms.editItemAt(0)->PTSTimeDeltaEstablished(); }
1,634
5,470
0
static void Ins_SZP2( INS_ARG ) { switch ( args[0] ) { case 0: CUR.zp2 = CUR.twilight; break; case 1: CUR.zp2 = CUR.pts; break; default: CUR.error = TT_Err_Invalid_Reference; return; } CUR.GS.gep2 = (Int)(args[0]); }
1,635
144,755
0
void LocalSiteCharacteristicsWebContentsObserver::DidUpdateFaviconURL( const std::vector<content::FaviconURL>& candidates) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (!first_time_favicon_set_) { first_time_favicon_set_ = true; return; } MaybeNotifyBackgroundFeatureUsage( &SiteCharacteristicsDataWriter::NotifyUpdatesFaviconInBackground); }
1,636
116,332
0
QUrl QQuickWebView::url() const { Q_D(const QQuickWebView); return QUrl(d->m_currentUrl); }
1,637
77,284
0
ofport_install(struct ofproto *p, struct netdev *netdev, const struct ofputil_phy_port *pp) { const char *netdev_name = netdev_get_name(netdev); struct ofport *ofport; int error; /* Create ofport. */ ofport = p->ofproto_class->port_alloc(); if (!ofport) { error = ENOMEM; goto error; } ofport->ofproto = p; ofport->netdev = netdev; ofport->change_seq = netdev_get_change_seq(netdev); ofport->pp = *pp; ofport->ofp_port = pp->port_no; ofport->created = time_msec(); /* Add port to 'p'. */ hmap_insert(&p->ports, &ofport->hmap_node, hash_ofp_port(ofport->ofp_port)); shash_add(&p->port_by_name, netdev_name, ofport); update_mtu(p, ofport); /* Let the ofproto_class initialize its private data. */ error = p->ofproto_class->port_construct(ofport); if (error) { goto error; } connmgr_send_port_status(p->connmgr, NULL, pp, OFPPR_ADD); return 0; error: VLOG_WARN_RL(&rl, "%s: could not add port %s (%s)", p->name, netdev_name, ovs_strerror(error)); if (ofport) { ofport_destroy__(ofport); } else { netdev_close(netdev); } return error; }
1,638
172,234
0
int uipc_start_main_server_thread(void) { uipc_main.running = 1; if (pthread_create(&uipc_main.tid, (const pthread_attr_t *) NULL, (void*)uipc_read_task, NULL) < 0) { BTIF_TRACE_ERROR("uipc_thread_create pthread_create failed:%d", errno); return -1; } return 0; }
1,639
93,481
0
static int l_channel_exec (lua_State *L) { return channel_exec(L, 0, 0); }
1,640
146,622
0
bool DrawingBuffer::FinishPrepareTextureMailboxSoftware( viz::TextureMailbox* out_mailbox, std::unique_ptr<cc::SingleReleaseCallback>* out_release_callback) { DCHECK(state_restorer_); std::unique_ptr<viz::SharedBitmap> bitmap = CreateOrRecycleBitmap(); if (!bitmap) return false; { unsigned char* pixels = bitmap->pixels(); DCHECK(pixels); bool need_premultiply = want_alpha_channel_ && !premultiplied_alpha_; WebGLImageConversion::AlphaOp op = need_premultiply ? WebGLImageConversion::kAlphaDoPremultiply : WebGLImageConversion::kAlphaDoNothing; state_restorer_->SetFramebufferBindingDirty(); gl_->BindFramebuffer(GL_FRAMEBUFFER, fbo_); ReadBackFramebuffer(pixels, Size().Width(), Size().Height(), kReadbackSkia, op); } *out_mailbox = viz::TextureMailbox(bitmap.get(), size_); out_mailbox->set_color_space(color_space_); auto func = WTF::Bind(&DrawingBuffer::MailboxReleasedSoftware, RefPtr<DrawingBuffer>(this), WTF::Passed(std::move(bitmap)), size_); *out_release_callback = cc::SingleReleaseCallback::Create(ConvertToBaseCallback(std::move(func))); if (preserve_drawing_buffer_ == kDiscard) { SetBufferClearNeeded(true); } return true; }
1,641
27,870
0
static void fuse_file_put(struct fuse_file *ff) { if (atomic_dec_and_test(&ff->count)) { struct fuse_req *req = ff->reserved_req; req->end = fuse_release_end; fuse_request_send_background(ff->fc, req); kfree(ff); } }
1,642
33,337
0
static int edge_remove_sysfs_attrs(struct usb_serial_port *port) { device_remove_file(&port->dev, &dev_attr_uart_mode); return 0; }
1,643
71,285
0
int ahash_mcryptd_digest(struct ahash_request *desc) { return crypto_ahash_init(desc) ?: ahash_mcryptd_finup(desc); }
1,644
12,410
0
SPL_METHOD(SplObjectStorage, current) { spl_SplObjectStorageElement *element; spl_SplObjectStorage *intern = (spl_SplObjectStorage*)zend_object_store_get_object(getThis() TSRMLS_CC); if (zend_parse_parameters_none() == FAILURE) { return; } if (zend_hash_get_current_data_ex(&intern->storage, (void**)&element, &intern->pos) == FAILURE) { return; } RETVAL_ZVAL(element->obj, 1, 0); } /* }}} */ /* {{{ proto mixed SplObjectStorage::getInfo()
1,645
65,842
0
static __be32 *read_buf(struct nfsd4_compoundargs *argp, u32 nbytes) { /* We want more bytes than seem to be available. * Maybe we need a new page, maybe we have just run out */ unsigned int avail = (char *)argp->end - (char *)argp->p; __be32 *p; if (avail + argp->pagelen < nbytes) return NULL; if (avail + PAGE_SIZE < nbytes) /* need more than a page !! */ return NULL; /* ok, we can do it with the current plus the next page */ if (nbytes <= sizeof(argp->tmp)) p = argp->tmp; else { kfree(argp->tmpp); p = argp->tmpp = kmalloc(nbytes, GFP_KERNEL); if (!p) return NULL; } /* * The following memcpy is safe because read_buf is always * called with nbytes > avail, and the two cases above both * guarantee p points to at least nbytes bytes. */ memcpy(p, argp->p, avail); next_decode_page(argp); memcpy(((char*)p)+avail, argp->p, (nbytes - avail)); argp->p += XDR_QUADLEN(nbytes - avail); return p; }
1,646
30,955
0
static int ptrace_setsiginfo(struct task_struct *child, const siginfo_t *info) { unsigned long flags; int error = -ESRCH; if (lock_task_sighand(child, &flags)) { error = -EINVAL; if (likely(child->last_siginfo != NULL)) { *child->last_siginfo = *info; error = 0; } unlock_task_sighand(child, &flags); } return error; }
1,647
128,491
0
bool ShellSurface::IsSurfaceSynchronized() const { return false; }
1,648
36,881
0
void iput(struct inode *inode) { if (inode) { BUG_ON(inode->i_state & I_CLEAR); if (atomic_dec_and_lock(&inode->i_count, &inode->i_lock)) iput_final(inode); } }
1,649
18,540
0
static int check_eofblocks_fl(handle_t *handle, struct inode *inode, ext4_lblk_t lblk, struct ext4_ext_path *path, unsigned int len) { int i, depth; struct ext4_extent_header *eh; struct ext4_extent *last_ex; if (!ext4_test_inode_flag(inode, EXT4_INODE_EOFBLOCKS)) return 0; depth = ext_depth(inode); eh = path[depth].p_hdr; /* * We're going to remove EOFBLOCKS_FL entirely in future so we * do not care for this case anymore. Simply remove the flag * if there are no extents. */ if (unlikely(!eh->eh_entries)) goto out; last_ex = EXT_LAST_EXTENT(eh); /* * We should clear the EOFBLOCKS_FL flag if we are writing the * last block in the last extent in the file. We test this by * first checking to see if the caller to * ext4_ext_get_blocks() was interested in the last block (or * a block beyond the last block) in the current extent. If * this turns out to be false, we can bail out from this * function immediately. */ if (lblk + len < le32_to_cpu(last_ex->ee_block) + ext4_ext_get_actual_len(last_ex)) return 0; /* * If the caller does appear to be planning to write at or * beyond the end of the current extent, we then test to see * if the current extent is the last extent in the file, by * checking to make sure it was reached via the rightmost node * at each level of the tree. */ for (i = depth-1; i >= 0; i--) if (path[i].p_idx != EXT_LAST_INDEX(path[i].p_hdr)) return 0; out: ext4_clear_inode_flag(inode, EXT4_INODE_EOFBLOCKS); return ext4_mark_inode_dirty(handle, inode); }
1,650
41,917
0
static void svm_set_segment(struct kvm_vcpu *vcpu, struct kvm_segment *var, int seg) { struct vcpu_svm *svm = to_svm(vcpu); struct vmcb_seg *s = svm_seg(vcpu, seg); s->base = var->base; s->limit = var->limit; s->selector = var->selector; if (var->unusable) s->attrib = 0; else { s->attrib = (var->type & SVM_SELECTOR_TYPE_MASK); s->attrib |= (var->s & 1) << SVM_SELECTOR_S_SHIFT; s->attrib |= (var->dpl & 3) << SVM_SELECTOR_DPL_SHIFT; s->attrib |= (var->present & 1) << SVM_SELECTOR_P_SHIFT; s->attrib |= (var->avl & 1) << SVM_SELECTOR_AVL_SHIFT; s->attrib |= (var->l & 1) << SVM_SELECTOR_L_SHIFT; s->attrib |= (var->db & 1) << SVM_SELECTOR_DB_SHIFT; s->attrib |= (var->g & 1) << SVM_SELECTOR_G_SHIFT; } /* * This is always accurate, except if SYSRET returned to a segment * with SS.DPL != 3. Intel does not have this quirk, and always * forces SS.DPL to 3 on sysret, so we ignore that case; fixing it * would entail passing the CPL to userspace and back. */ if (seg == VCPU_SREG_SS) svm->vmcb->save.cpl = (s->attrib >> SVM_SELECTOR_DPL_SHIFT) & 3; mark_dirty(svm->vmcb, VMCB_SEG); }
1,651
85,123
0
static int wm_strcasecmp(const char *s1, const char * s2) { const char * p1 = s1; const char * p2 = s2; char c1, c2; if (p1 == p2) return 0; do { c1 = wm_tolower (*p1++); c2 = wm_tolower (*p2++); if (c1 == '\0') break; } while (c1 == c2); return (int)(c1 - c2); }
1,652
171,157
0
sp<IMediaCodecList> MediaPlayerService::getCodecList() const { return MediaCodecList::getLocalInstance(); }
1,653
180,338
1
int socket_create(uint16_t port) { int sfd = -1; int yes = 1; #ifdef WIN32 WSADATA wsa_data; if (!wsa_init) { if (WSAStartup(MAKEWORD(2,2), &wsa_data) != ERROR_SUCCESS) { fprintf(stderr, "WSAStartup failed!\n"); ExitProcess(-1); } wsa_init = 1; } #endif struct sockaddr_in saddr; if (0 > (sfd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP))) { perror("socket()"); return -1; } if (setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, (void*)&yes, sizeof(int)) == -1) { perror("setsockopt()"); socket_close(sfd); return -1; } memset((void *) &saddr, 0, sizeof(saddr)); saddr.sin_family = AF_INET; saddr.sin_addr.s_addr = htonl(INADDR_ANY); saddr.sin_port = htons(port); if (0 > bind(sfd, (struct sockaddr *) &saddr, sizeof(saddr))) { perror("bind()"); socket_close(sfd); return -1; } if (listen(sfd, 1) == -1) { perror("listen()"); socket_close(sfd); return -1; } return sfd; }
1,654
40,615
0
static void init_prb_bdqc(struct packet_sock *po, struct packet_ring_buffer *rb, struct pgv *pg_vec, union tpacket_req_u *req_u, int tx_ring) { struct tpacket_kbdq_core *p1 = &rb->prb_bdqc; struct tpacket_block_desc *pbd; memset(p1, 0x0, sizeof(*p1)); p1->knxt_seq_num = 1; p1->pkbdq = pg_vec; pbd = (struct tpacket_block_desc *)pg_vec[0].buffer; p1->pkblk_start = pg_vec[0].buffer; p1->kblk_size = req_u->req3.tp_block_size; p1->knum_blocks = req_u->req3.tp_block_nr; p1->hdrlen = po->tp_hdrlen; p1->version = po->tp_version; p1->last_kactive_blk_num = 0; po->stats.stats3.tp_freeze_q_cnt = 0; if (req_u->req3.tp_retire_blk_tov) p1->retire_blk_tov = req_u->req3.tp_retire_blk_tov; else p1->retire_blk_tov = prb_calc_retire_blk_tmo(po, req_u->req3.tp_block_size); p1->tov_in_jiffies = msecs_to_jiffies(p1->retire_blk_tov); p1->blk_sizeof_priv = req_u->req3.tp_sizeof_priv; prb_init_ft_ops(p1, req_u); prb_setup_retire_blk_timer(po, tx_ring); prb_open_block(p1, pbd); }
1,655
96,811
0
struct fuse_req *fuse_get_req_for_background(struct fuse_conn *fc, unsigned npages) { return __fuse_get_req(fc, npages, true); }
1,656
181,267
1
R_API RConfigNode* r_config_set(RConfig *cfg, const char *name, const char *value) { RConfigNode *node = NULL; char *ov = NULL; ut64 oi; if (!cfg || STRNULL (name)) { return NULL; } node = r_config_node_get (cfg, name); if (node) { if (node->flags & CN_RO) { eprintf ("(error: '%s' config key is read only)\n", name); return node; } oi = node->i_value; if (node->value) { ov = strdup (node->value); if (!ov) { goto beach; } } else { free (node->value); node->value = strdup (""); } if (node->flags & CN_BOOL) { bool b = is_true (value); node->i_value = (ut64) b? 1: 0; char *value = strdup (r_str_bool (b)); if (value) { free (node->value); node->value = value; } } else { if (!value) { free (node->value); node->value = strdup (""); node->i_value = 0; } else { if (node->value == value) { goto beach; } free (node->value); node->value = strdup (value); if (IS_DIGIT (*value)) { if (strchr (value, '/')) { node->i_value = r_num_get (cfg->num, value); } else { node->i_value = r_num_math (cfg->num, value); } } else { node->i_value = 0; } node->flags |= CN_INT; } } } else { // Create a new RConfigNode oi = UT64_MAX; if (!cfg->lock) { node = r_config_node_new (name, value); if (node) { if (value && is_bool (value)) { node->flags |= CN_BOOL; node->i_value = is_true (value)? 1: 0; } if (cfg->ht) { ht_insert (cfg->ht, node->name, node); r_list_append (cfg->nodes, node); cfg->n_nodes++; } } else { eprintf ("r_config_set: unable to create a new RConfigNode\n"); } } else { eprintf ("r_config_set: variable '%s' not found\n", name); } } if (node && node->setter) { int ret = node->setter (cfg->user, node); if (ret == false) { if (oi != UT64_MAX) { node->i_value = oi; } free (node->value); node->value = strdup (ov? ov: ""); } } beach: free (ov); return node; }
1,657
46,696
0
static void des_decrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) { struct s390_des_ctx *ctx = crypto_tfm_ctx(tfm); crypt_s390_km(KM_DEA_DECRYPT, ctx->key, out, in, DES_BLOCK_SIZE); }
1,658
85,625
0
void hns_rcbv2_int_ctrl_hw(struct hnae_queue *q, u32 flag, u32 mask) { u32 int_mask_en = !!mask; if (flag & RCB_INT_FLAG_TX) dsaf_write_dev(q, RCB_RING_INTMSK_TXWL_REG, int_mask_en); if (flag & RCB_INT_FLAG_RX) dsaf_write_dev(q, RCB_RING_INTMSK_RXWL_REG, int_mask_en); }
1,659
167,123
0
const std::string& BluetoothSocketListenUsingRfcommFunction::uuid() const { return params_->uuid; }
1,660
22,496
0
unsigned long nr_running(void) { unsigned long i, sum = 0; for_each_online_cpu(i) sum += cpu_rq(i)->nr_running; return sum; }
1,661
127,596
0
bool GetStringProperty( XID window, const std::string& property_name, std::string* value) { Atom type = None; int format = 0; // size in bits of each item in 'property' unsigned long num_items = 0; unsigned char* property = NULL; int result = GetProperty(window, property_name, 1024, &type, &format, &num_items, &property); if (result != Success) return false; if (format != 8) { XFree(property); return false; } value->assign(reinterpret_cast<char*>(property), num_items); XFree(property); return true; }
1,662
163,354
0
bool RenderThreadImpl::IsGpuMemoryBufferCompositorResourcesEnabled() { return is_gpu_memory_buffer_compositor_resources_enabled_; }
1,663
113,036
0
FilePath DownloadItemImpl::GetFileNameToReportUser() const { if (!display_name_.empty()) return display_name_; return target_path_.BaseName(); }
1,664
88,505
0
MagickExport MagickBooleanType BlobToFile(char *filename,const void *blob, const size_t length,ExceptionInfo *exception) { int file; register size_t i; ssize_t count; assert(filename != (const char *) NULL); (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",filename); assert(blob != (const void *) NULL); if (*filename == '\0') file=AcquireUniqueFileResource(filename); else file=open_utf8(filename,O_RDWR | O_CREAT | O_EXCL | O_BINARY,S_MODE); if (file == -1) { ThrowFileException(exception,BlobError,"UnableToWriteBlob",filename); return(MagickFalse); } for (i=0; i < length; i+=count) { count=write(file,(const char *) blob+i,MagickMin(length-i,(size_t) SSIZE_MAX)); if (count <= 0) { count=0; if (errno != EINTR) break; } } file=close(file); if ((file == -1) || (i < length)) { ThrowFileException(exception,BlobError,"UnableToWriteBlob",filename); return(MagickFalse); } return(MagickTrue); }
1,665
42,930
0
static int sctp_v4_cmp_addr(const union sctp_addr *addr1, const union sctp_addr *addr2) { if (addr1->sa.sa_family != addr2->sa.sa_family) return 0; if (addr1->v4.sin_port != addr2->v4.sin_port) return 0; if (addr1->v4.sin_addr.s_addr != addr2->v4.sin_addr.s_addr) return 0; return 1; }
1,666
160,803
0
void RenderViewImpl::OnGetRenderedText() { if (!webview()) return; if (!webview()->MainFrame()->IsWebLocalFrame()) return; static const size_t kMaximumMessageSize = 8 * 1024 * 1024; std::string text = WebFrameContentDumper::DumpWebViewAsText(webview(), kMaximumMessageSize) .Utf8(); Send(new ViewMsg_GetRenderedTextCompleted(GetRoutingID(), text)); }
1,667
28,683
0
static ssize_t lbs_highrssi_write(struct file *file, const char __user *userbuf, size_t count, loff_t *ppos) { return lbs_threshold_write(TLV_TYPE_RSSI_HIGH, CMD_SUBSCRIBE_RSSI_HIGH, file, userbuf, count, ppos); }
1,668
63,830
0
make_log_entry( httpd_conn* hc, struct timeval* nowP ) { char* ru; char url[305]; char bytes[40]; if ( hc->hs->no_log ) return; /* This is straight CERN Combined Log Format - the only tweak ** being that if we're using syslog() we leave out the date, because ** syslogd puts it in. The included syslogtocern script turns the ** results into true CERN format. */ /* Format remote user. */ if ( hc->remoteuser[0] != '\0' ) ru = hc->remoteuser; else ru = "-"; /* If we're vhosting, prepend the hostname to the url. This is ** a little weird, perhaps writing separate log files for ** each vhost would make more sense. */ if ( hc->hs->vhost && ! hc->tildemapped ) (void) my_snprintf( url, sizeof(url), "/%.100s%.200s", hc->hostname == (char*) 0 ? hc->hs->server_hostname : hc->hostname, hc->encodedurl ); else (void) my_snprintf( url, sizeof(url), "%.200s", hc->encodedurl ); /* Format the bytes. */ if ( hc->bytes_sent >= 0 ) (void) my_snprintf( bytes, sizeof(bytes), "%lld", (int64_t) hc->bytes_sent ); else (void) strcpy( bytes, "-" ); /* Logfile or syslog? */ if ( hc->hs->logfp != (FILE*) 0 ) { time_t now; struct tm* t; const char* cernfmt_nozone = "%d/%b/%Y:%H:%M:%S"; char date_nozone[100]; int zone; char sign; char date[100]; /* Get the current time, if necessary. */ if ( nowP != (struct timeval*) 0 ) now = nowP->tv_sec; else now = time( (time_t*) 0 ); /* Format the time, forcing a numeric timezone (some log analyzers ** are stoooopid about this). */ t = localtime( &now ); (void) strftime( date_nozone, sizeof(date_nozone), cernfmt_nozone, t ); zone = t->tm_gmtoff / 60L; if ( zone >= 0 ) sign = '+'; else { sign = '-'; zone = -zone; } zone = ( zone / 60 ) * 100 + zone % 60; (void) my_snprintf( date, sizeof(date), "%s %c%04d", date_nozone, sign, zone ); /* And write the log entry. */ (void) fprintf( hc->hs->logfp, "%.80s - %.80s [%s] \"%.80s %.300s %.80s\" %d %s \"%.200s\" \"%.200s\"\n", httpd_ntoa( &hc->client_addr ), ru, date, httpd_method_str( hc->method ), url, hc->protocol, hc->status, bytes, hc->referer, hc->useragent ); #ifdef FLUSH_LOG_EVERY_TIME (void) fflush( hc->hs->logfp ); #endif } else syslog( LOG_INFO, "%.80s - %.80s \"%.80s %.200s %.80s\" %d %s \"%.200s\" \"%.200s\"", httpd_ntoa( &hc->client_addr ), ru, httpd_method_str( hc->method ), url, hc->protocol, hc->status, bytes, hc->referer, hc->useragent ); }
1,669
142,812
0
bool HTMLMediaElement::HasVideo() const { return GetWebMediaPlayer() && GetWebMediaPlayer()->HasVideo(); }
1,670
10,564
0
Current_Ppem( TT_ExecContext exc ) { return exc->tt_metrics.ppem; }
1,671
13,173
0
xps_draw_linear_gradient(xps_document *doc, const fz_matrix *ctm, const fz_rect *area, struct stop *stops, int count, fz_xml *root, int spread) { float x0, y0, x1, y1; int i, mi, ma; float dx, dy, x, y, k; fz_point p1, p2; fz_matrix inv; fz_rect local_area = *area; char *start_point_att = fz_xml_att(root, "StartPoint"); char *end_point_att = fz_xml_att(root, "EndPoint"); x0 = y0 = 0; x1 = y1 = 1; if (start_point_att) xps_parse_point(start_point_att, &x0, &y0); if (end_point_att) xps_parse_point(end_point_att, &x1, &y1); p1.x = x0; p1.y = y0; p2.x = x1; p2.y = y1; fz_transform_rect(&local_area, fz_invert_matrix(&inv, ctm)); x = p2.x - p1.x; y = p2.y - p1.y; k = ((local_area.x0 - p1.x) * x + (local_area.y0 - p1.y) * y) / (x * x + y * y); mi = floorf(k); ma = ceilf(k); k = ((local_area.x1 - p1.x) * x + (local_area.y0 - p1.y) * y) / (x * x + y * y); mi = fz_mini(mi, floorf(k)); ma = fz_maxi(ma, ceilf(k)); k = ((local_area.x0 - p1.x) * x + (local_area.y1 - p1.y) * y) / (x * x + y * y); mi = fz_mini(mi, floorf(k)); ma = fz_maxi(ma, ceilf(k)); k = ((local_area.x1 - p1.x) * x + (local_area.y1 - p1.y) * y) / (x * x + y * y); mi = fz_mini(mi, floorf(k)); ma = fz_maxi(ma, ceilf(k)); dx = x1 - x0; dy = y1 - y0; if (spread == SPREAD_REPEAT) { for (i = mi; i < ma; i++) xps_draw_one_linear_gradient(doc, ctm, stops, count, 0, x0 + i * dx, y0 + i * dy, x1 + i * dx, y1 + i * dy); } else if (spread == SPREAD_REFLECT) { if ((mi % 2) != 0) mi--; for (i = mi; i < ma; i += 2) { xps_draw_one_linear_gradient(doc, ctm, stops, count, 0, x0 + i * dx, y0 + i * dy, x1 + i * dx, y1 + i * dy); xps_draw_one_linear_gradient(doc, ctm, stops, count, 0, x0 + (i + 2) * dx, y0 + (i + 2) * dy, x1 + i * dx, y1 + i * dy); } } else { xps_draw_one_linear_gradient(doc, ctm, stops, count, 1, x0, y0, x1, y1); } }
1,672
5,681
0
static XHCIStreamContext *xhci_alloc_stream_contexts(unsigned count, dma_addr_t base) { XHCIStreamContext *stctx; unsigned int i; stctx = g_new0(XHCIStreamContext, count); for (i = 0; i < count; i++) { stctx[i].pctx = base + i * 16; stctx[i].sct = -1; } return stctx; }
1,673
100,749
0
xmlParseReference(xmlParserCtxtPtr ctxt) { xmlEntityPtr ent; xmlChar *val; int was_checked; xmlNodePtr list = NULL; xmlParserErrors ret = XML_ERR_OK; if (RAW != '&') return; /* * Simple case of a CharRef */ if (NXT(1) == '#') { int i = 0; xmlChar out[10]; int hex = NXT(2); int value = xmlParseCharRef(ctxt); if (value == 0) return; if (ctxt->charset != XML_CHAR_ENCODING_UTF8) { /* * So we are using non-UTF-8 buffers * Check that the char fit on 8bits, if not * generate a CharRef. */ if (value <= 0xFF) { out[0] = value; out[1] = 0; if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL) && (!ctxt->disableSAX)) ctxt->sax->characters(ctxt->userData, out, 1); } else { if ((hex == 'x') || (hex == 'X')) snprintf((char *)out, sizeof(out), "#x%X", value); else snprintf((char *)out, sizeof(out), "#%d", value); if ((ctxt->sax != NULL) && (ctxt->sax->reference != NULL) && (!ctxt->disableSAX)) ctxt->sax->reference(ctxt->userData, out); } } else { /* * Just encode the value in UTF-8 */ COPY_BUF(0 ,out, i, value); out[i] = 0; if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL) && (!ctxt->disableSAX)) ctxt->sax->characters(ctxt->userData, out, i); } return; } /* * We are seeing an entity reference */ ent = xmlParseEntityRef(ctxt); if (ent == NULL) return; if (!ctxt->wellFormed) return; was_checked = ent->checked; /* special case of predefined entities */ if ((ent->name == NULL) || (ent->etype == XML_INTERNAL_PREDEFINED_ENTITY)) { val = ent->content; if (val == NULL) return; /* * inline the entity. */ if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL) && (!ctxt->disableSAX)) ctxt->sax->characters(ctxt->userData, val, xmlStrlen(val)); return; } /* * The first reference to the entity trigger a parsing phase * where the ent->children is filled with the result from * the parsing. */ if (ent->checked == 0) { unsigned long oldnbent = ctxt->nbentities; /* * This is a bit hackish but this seems the best * way to make sure both SAX and DOM entity support * behaves okay. */ void *user_data; if (ctxt->userData == ctxt) user_data = NULL; else user_data = ctxt->userData; /* * Check that this entity is well formed * 4.3.2: An internal general parsed entity is well-formed * if its replacement text matches the production labeled * content. */ if (ent->etype == XML_INTERNAL_GENERAL_ENTITY) { ctxt->depth++; ret = xmlParseBalancedChunkMemoryInternal(ctxt, ent->content, user_data, &list); ctxt->depth--; } else if (ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY) { ctxt->depth++; ret = xmlParseExternalEntityPrivate(ctxt->myDoc, ctxt, ctxt->sax, user_data, ctxt->depth, ent->URI, ent->ExternalID, &list); ctxt->depth--; } else { ret = XML_ERR_ENTITY_PE_INTERNAL; xmlErrMsgStr(ctxt, XML_ERR_INTERNAL_ERROR, "invalid entity type found\n", NULL); } /* * Store the number of entities needing parsing for this entity * content and do checkings */ ent->checked = ctxt->nbentities - oldnbent; if (ret == XML_ERR_ENTITY_LOOP) { xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL); xmlFreeNodeList(list); return; } if (xmlParserEntityCheck(ctxt, 0, ent)) { xmlFreeNodeList(list); return; } if ((ret == XML_ERR_OK) && (list != NULL)) { if (((ent->etype == XML_INTERNAL_GENERAL_ENTITY) || (ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY))&& (ent->children == NULL)) { ent->children = list; if (ctxt->replaceEntities) { /* * Prune it directly in the generated document * except for single text nodes. */ if (((list->type == XML_TEXT_NODE) && (list->next == NULL)) || (ctxt->parseMode == XML_PARSE_READER)) { list->parent = (xmlNodePtr) ent; list = NULL; ent->owner = 1; } else { ent->owner = 0; while (list != NULL) { list->parent = (xmlNodePtr) ctxt->node; list->doc = ctxt->myDoc; if (list->next == NULL) ent->last = list; list = list->next; } list = ent->children; #ifdef LIBXML_LEGACY_ENABLED if (ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY) xmlAddEntityReference(ent, list, NULL); #endif /* LIBXML_LEGACY_ENABLED */ } } else { ent->owner = 1; while (list != NULL) { list->parent = (xmlNodePtr) ent; if (list->next == NULL) ent->last = list; list = list->next; } } } else { xmlFreeNodeList(list); list = NULL; } } else if ((ret != XML_ERR_OK) && (ret != XML_WAR_UNDECLARED_ENTITY)) { xmlFatalErrMsgStr(ctxt, XML_ERR_UNDECLARED_ENTITY, "Entity '%s' failed to parse\n", ent->name); } else if (list != NULL) { xmlFreeNodeList(list); list = NULL; } if (ent->checked == 0) ent->checked = 1; } else if (ent->checked != 1) { ctxt->nbentities += ent->checked; } /* * Now that the entity content has been gathered * provide it to the application, this can take different forms based * on the parsing modes. */ if (ent->children == NULL) { /* * Probably running in SAX mode and the callbacks don't * build the entity content. So unless we already went * though parsing for first checking go though the entity * content to generate callbacks associated to the entity */ if (was_checked != 0) { void *user_data; /* * This is a bit hackish but this seems the best * way to make sure both SAX and DOM entity support * behaves okay. */ if (ctxt->userData == ctxt) user_data = NULL; else user_data = ctxt->userData; if (ent->etype == XML_INTERNAL_GENERAL_ENTITY) { ctxt->depth++; ret = xmlParseBalancedChunkMemoryInternal(ctxt, ent->content, user_data, NULL); ctxt->depth--; } else if (ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY) { ctxt->depth++; ret = xmlParseExternalEntityPrivate(ctxt->myDoc, ctxt, ctxt->sax, user_data, ctxt->depth, ent->URI, ent->ExternalID, NULL); ctxt->depth--; } else { ret = XML_ERR_ENTITY_PE_INTERNAL; xmlErrMsgStr(ctxt, XML_ERR_INTERNAL_ERROR, "invalid entity type found\n", NULL); } if (ret == XML_ERR_ENTITY_LOOP) { xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL); return; } } if ((ctxt->sax != NULL) && (ctxt->sax->reference != NULL) && (ctxt->replaceEntities == 0) && (!ctxt->disableSAX)) { /* * Entity reference callback comes second, it's somewhat * superfluous but a compatibility to historical behaviour */ ctxt->sax->reference(ctxt->userData, ent->name); } return; } /* * If we didn't get any children for the entity being built */ if ((ctxt->sax != NULL) && (ctxt->sax->reference != NULL) && (ctxt->replaceEntities == 0) && (!ctxt->disableSAX)) { /* * Create a node. */ ctxt->sax->reference(ctxt->userData, ent->name); return; } if ((ctxt->replaceEntities) || (ent->children == NULL)) { /* * There is a problem on the handling of _private for entities * (bug 155816): Should we copy the content of the field from * the entity (possibly overwriting some value set by the user * when a copy is created), should we leave it alone, or should * we try to take care of different situations? The problem * is exacerbated by the usage of this field by the xmlReader. * To fix this bug, we look at _private on the created node * and, if it's NULL, we copy in whatever was in the entity. * If it's not NULL we leave it alone. This is somewhat of a * hack - maybe we should have further tests to determine * what to do. */ if ((ctxt->node != NULL) && (ent->children != NULL)) { /* * Seems we are generating the DOM content, do * a simple tree copy for all references except the first * In the first occurrence list contains the replacement. * progressive == 2 means we are operating on the Reader * and since nodes are discarded we must copy all the time. */ if (((list == NULL) && (ent->owner == 0)) || (ctxt->parseMode == XML_PARSE_READER)) { xmlNodePtr nw = NULL, cur, firstChild = NULL; /* * when operating on a reader, the entities definitions * are always owning the entities subtree. if (ctxt->parseMode == XML_PARSE_READER) ent->owner = 1; */ cur = ent->children; while (cur != NULL) { nw = xmlDocCopyNode(cur, ctxt->myDoc, 1); if (nw != NULL) { if (nw->_private == NULL) nw->_private = cur->_private; if (firstChild == NULL){ firstChild = nw; } nw = xmlAddChild(ctxt->node, nw); } if (cur == ent->last) { /* * needed to detect some strange empty * node cases in the reader tests */ if ((ctxt->parseMode == XML_PARSE_READER) && (nw != NULL) && (nw->type == XML_ELEMENT_NODE) && (nw->children == NULL)) nw->extra = 1; break; } cur = cur->next; } #ifdef LIBXML_LEGACY_ENABLED if (ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY) xmlAddEntityReference(ent, firstChild, nw); #endif /* LIBXML_LEGACY_ENABLED */ } else if (list == NULL) { xmlNodePtr nw = NULL, cur, next, last, firstChild = NULL; /* * Copy the entity child list and make it the new * entity child list. The goal is to make sure any * ID or REF referenced will be the one from the * document content and not the entity copy. */ cur = ent->children; ent->children = NULL; last = ent->last; ent->last = NULL; while (cur != NULL) { next = cur->next; cur->next = NULL; cur->parent = NULL; nw = xmlDocCopyNode(cur, ctxt->myDoc, 1); if (nw != NULL) { if (nw->_private == NULL) nw->_private = cur->_private; if (firstChild == NULL){ firstChild = cur; } xmlAddChild((xmlNodePtr) ent, nw); xmlAddChild(ctxt->node, cur); } if (cur == last) break; cur = next; } if (ent->owner == 0) ent->owner = 1; #ifdef LIBXML_LEGACY_ENABLED if (ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY) xmlAddEntityReference(ent, firstChild, nw); #endif /* LIBXML_LEGACY_ENABLED */ } else { const xmlChar *nbktext; /* * the name change is to avoid coalescing of the * node with a possible previous text one which * would make ent->children a dangling pointer */ nbktext = xmlDictLookup(ctxt->dict, BAD_CAST "nbktext", -1); if (ent->children->type == XML_TEXT_NODE) ent->children->name = nbktext; if ((ent->last != ent->children) && (ent->last->type == XML_TEXT_NODE)) ent->last->name = nbktext; xmlAddChildList(ctxt->node, ent->children); } /* * This is to avoid a nasty side effect, see * characters() in SAX.c */ ctxt->nodemem = 0; ctxt->nodelen = 0; return; } } }
1,674
101,598
0
void Browser::CloseTabContents(TabContents* contents) { CloseContents(contents); }
1,675
15,249
0
PHP_FUNCTION(link) { char *topath, *frompath; int topath_len, frompath_len; int ret; char source_p[MAXPATHLEN]; char dest_p[MAXPATHLEN]; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pp", &topath, &topath_len, &frompath, &frompath_len) == FAILURE) { return; } if (!expand_filepath(frompath, source_p TSRMLS_CC) || !expand_filepath(topath, dest_p TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "No such file or directory"); RETURN_FALSE; } if (php_stream_locate_url_wrapper(source_p, NULL, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC) || php_stream_locate_url_wrapper(dest_p, NULL, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC) ) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to link to a URL"); RETURN_FALSE; } if (php_check_open_basedir(dest_p TSRMLS_CC)) { RETURN_FALSE; } if (php_check_open_basedir(source_p TSRMLS_CC)) { RETURN_FALSE; } #ifndef ZTS ret = link(topath, frompath); #else ret = link(dest_p, source_p); #endif if (ret == -1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno)); RETURN_FALSE; } RETURN_TRUE; }
1,676
170,576
0
int LvmBundle_process(LVM_INT16 *pIn, LVM_INT16 *pOut, int frameCount, EffectContext *pContext){ LVM_ControlParams_t ActiveParams; /* Current control Parameters */ LVM_ReturnStatus_en LvmStatus = LVM_SUCCESS; /* Function call status */ LVM_INT16 *pOutTmp; if (pContext->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_WRITE){ pOutTmp = pOut; }else if (pContext->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE){ if (pContext->pBundledContext->frameCount != frameCount) { if (pContext->pBundledContext->workBuffer != NULL) { free(pContext->pBundledContext->workBuffer); } pContext->pBundledContext->workBuffer = (LVM_INT16 *)malloc(frameCount * sizeof(LVM_INT16) * 2); pContext->pBundledContext->frameCount = frameCount; } pOutTmp = pContext->pBundledContext->workBuffer; }else{ ALOGV("LVM_ERROR : LvmBundle_process invalid access mode"); return -EINVAL; } #ifdef LVM_PCM fwrite(pIn, frameCount*sizeof(LVM_INT16)*2, 1, pContext->pBundledContext->PcmInPtr); fflush(pContext->pBundledContext->PcmInPtr); #endif /* Process the samples */ LvmStatus = LVM_Process(pContext->pBundledContext->hInstance, /* Instance handle */ pIn, /* Input buffer */ pOutTmp, /* Output buffer */ (LVM_UINT16)frameCount, /* Number of samples to read */ 0); /* Audo Time */ LVM_ERROR_CHECK(LvmStatus, "LVM_Process", "LvmBundle_process") if(LvmStatus != LVM_SUCCESS) return -EINVAL; #ifdef LVM_PCM fwrite(pOutTmp, frameCount*sizeof(LVM_INT16)*2, 1, pContext->pBundledContext->PcmOutPtr); fflush(pContext->pBundledContext->PcmOutPtr); #endif if (pContext->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE){ for (int i=0; i<frameCount*2; i++){ pOut[i] = clamp16((LVM_INT32)pOut[i] + (LVM_INT32)pOutTmp[i]); } } return 0; } /* end LvmBundle_process */
1,677
98,472
0
AeroPeekWindow* AeroPeekManager::GetAeroPeekWindow(int tab_id) const { size_t size = tab_list_.size(); for (std::list<AeroPeekWindow*>::const_iterator i = tab_list_.begin(); i != tab_list_.end(); ++i) { AeroPeekWindow* window = *i; if (window->tab_id() == tab_id) return window; } return NULL; }
1,678
174,060
0
void WriteOutput(FILE *fid, u8 *data, u32 picSize) { if (fid) fwrite(data, 1, picSize, fid); }
1,679
54,647
0
int snd_seq_queue_alloc(int client, int locked, unsigned int info_flags) { struct snd_seq_queue *q; q = queue_new(client, locked); if (q == NULL) return -ENOMEM; q->info_flags = info_flags; if (queue_list_add(q) < 0) { queue_delete(q); return -ENOMEM; } snd_seq_queue_use(q->queue, client, 1); /* use this queue */ return q->queue; }
1,680
184,855
1
size_t CancelableFileOperation(Function operation, HANDLE file, BufferType* buffer, size_t length, WaitableEvent* io_event, WaitableEvent* cancel_event, CancelableSyncSocket* socket, DWORD timeout_in_ms) { ThreadRestrictions::AssertIOAllowed(); // The buffer must be byte size or the length check won't make much sense. COMPILE_ASSERT(sizeof(buffer[0]) == sizeof(char), incorrect_buffer_type); DCHECK_GT(length, 0u); DCHECK_LE(length, kMaxMessageLength); DCHECK_NE(file, SyncSocket::kInvalidHandle); // Track the finish time so we can calculate the timeout as data is read. TimeTicks current_time, finish_time; if (timeout_in_ms != INFINITE) { current_time = TimeTicks::Now(); finish_time = current_time + base::TimeDelta::FromMilliseconds(timeout_in_ms); } size_t count = 0; do { // The OVERLAPPED structure will be modified by ReadFile or WriteFile. OVERLAPPED ol = { 0 }; ol.hEvent = io_event->handle(); const DWORD chunk = GetNextChunkSize(count, length); // This is either the ReadFile or WriteFile call depending on whether // we're receiving or sending data. DWORD len = 0; const BOOL operation_ok = operation( file, static_cast<BufferType*>(buffer) + count, chunk, &len, &ol); if (!operation_ok) { if (::GetLastError() == ERROR_IO_PENDING) { HANDLE events[] = { io_event->handle(), cancel_event->handle() }; const int wait_result = WaitForMultipleObjects( ARRAYSIZE_UNSAFE(events), events, FALSE, timeout_in_ms == INFINITE ? timeout_in_ms : static_cast<DWORD>( (finish_time - current_time).InMilliseconds())); if (wait_result != WAIT_OBJECT_0 + 0) { // CancelIo() doesn't synchronously cancel outstanding IO, only marks // outstanding IO for cancellation. We must call GetOverlappedResult() // below to ensure in flight writes complete before returning. CancelIo(file); } // We set the |bWait| parameter to TRUE for GetOverlappedResult() to // ensure writes are complete before returning. if (!GetOverlappedResult(file, &ol, &len, TRUE)) len = 0; if (wait_result == WAIT_OBJECT_0 + 1) { DVLOG(1) << "Shutdown was signaled. Closing socket."; socket->Close(); return count; } // Timeouts will be handled by the while() condition below since // GetOverlappedResult() may complete successfully after CancelIo(). DCHECK(wait_result == WAIT_OBJECT_0 + 0 || wait_result == WAIT_TIMEOUT); } else { break; } } count += len; // Quit the operation if we can't write/read anymore. if (len != chunk) break; // Since TimeTicks::Now() is expensive, only bother updating the time if we // have more work to do. if (timeout_in_ms != INFINITE && count < length) current_time = base::TimeTicks::Now(); } while (count < length && (timeout_in_ms == INFINITE || current_time < finish_time)); return count; }
1,681
158,065
0
void LocalFrameClientImpl::DispatchDidChangeIcons(IconType type) { if (web_frame_->Client()) { web_frame_->Client()->DidChangeIcon(static_cast<WebIconURL::Type>(type)); } }
1,682
26,166
0
static void perf_swevent_del(struct perf_event *event, int flags) { hlist_del_rcu(&event->hlist_entry); }
1,683
42,685
0
static void load_vmcs12_host_state(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12) { struct kvm_segment seg; if (vmcs12->vm_exit_controls & VM_EXIT_LOAD_IA32_EFER) vcpu->arch.efer = vmcs12->host_ia32_efer; else if (vmcs12->vm_exit_controls & VM_EXIT_HOST_ADDR_SPACE_SIZE) vcpu->arch.efer |= (EFER_LMA | EFER_LME); else vcpu->arch.efer &= ~(EFER_LMA | EFER_LME); vmx_set_efer(vcpu, vcpu->arch.efer); kvm_register_write(vcpu, VCPU_REGS_RSP, vmcs12->host_rsp); kvm_register_write(vcpu, VCPU_REGS_RIP, vmcs12->host_rip); vmx_set_rflags(vcpu, X86_EFLAGS_FIXED); /* * Note that calling vmx_set_cr0 is important, even if cr0 hasn't * actually changed, because it depends on the current state of * fpu_active (which may have changed). * Note that vmx_set_cr0 refers to efer set above. */ vmx_set_cr0(vcpu, vmcs12->host_cr0); /* * If we did fpu_activate()/fpu_deactivate() during L2's run, we need * to apply the same changes to L1's vmcs. We just set cr0 correctly, * but we also need to update cr0_guest_host_mask and exception_bitmap. */ update_exception_bitmap(vcpu); vcpu->arch.cr0_guest_owned_bits = (vcpu->fpu_active ? X86_CR0_TS : 0); vmcs_writel(CR0_GUEST_HOST_MASK, ~vcpu->arch.cr0_guest_owned_bits); /* * Note that CR4_GUEST_HOST_MASK is already set in the original vmcs01 * (KVM doesn't change it)- no reason to call set_cr4_guest_host_mask(); */ vcpu->arch.cr4_guest_owned_bits = ~vmcs_readl(CR4_GUEST_HOST_MASK); kvm_set_cr4(vcpu, vmcs12->host_cr4); nested_ept_uninit_mmu_context(vcpu); kvm_set_cr3(vcpu, vmcs12->host_cr3); kvm_mmu_reset_context(vcpu); if (!enable_ept) vcpu->arch.walk_mmu->inject_page_fault = kvm_inject_page_fault; if (enable_vpid) { /* * Trivially support vpid by letting L2s share their parent * L1's vpid. TODO: move to a more elaborate solution, giving * each L2 its own vpid and exposing the vpid feature to L1. */ vmx_flush_tlb(vcpu); } vmcs_write32(GUEST_SYSENTER_CS, vmcs12->host_ia32_sysenter_cs); vmcs_writel(GUEST_SYSENTER_ESP, vmcs12->host_ia32_sysenter_esp); vmcs_writel(GUEST_SYSENTER_EIP, vmcs12->host_ia32_sysenter_eip); vmcs_writel(GUEST_IDTR_BASE, vmcs12->host_idtr_base); vmcs_writel(GUEST_GDTR_BASE, vmcs12->host_gdtr_base); /* If not VM_EXIT_CLEAR_BNDCFGS, the L2 value propagates to L1. */ if (vmcs12->vm_exit_controls & VM_EXIT_CLEAR_BNDCFGS) vmcs_write64(GUEST_BNDCFGS, 0); if (vmcs12->vm_exit_controls & VM_EXIT_LOAD_IA32_PAT) { vmcs_write64(GUEST_IA32_PAT, vmcs12->host_ia32_pat); vcpu->arch.pat = vmcs12->host_ia32_pat; } if (vmcs12->vm_exit_controls & VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL) vmcs_write64(GUEST_IA32_PERF_GLOBAL_CTRL, vmcs12->host_ia32_perf_global_ctrl); /* Set L1 segment info according to Intel SDM 27.5.2 Loading Host Segment and Descriptor-Table Registers */ seg = (struct kvm_segment) { .base = 0, .limit = 0xFFFFFFFF, .selector = vmcs12->host_cs_selector, .type = 11, .present = 1, .s = 1, .g = 1 }; if (vmcs12->vm_exit_controls & VM_EXIT_HOST_ADDR_SPACE_SIZE) seg.l = 1; else seg.db = 1; vmx_set_segment(vcpu, &seg, VCPU_SREG_CS); seg = (struct kvm_segment) { .base = 0, .limit = 0xFFFFFFFF, .type = 3, .present = 1, .s = 1, .db = 1, .g = 1 }; seg.selector = vmcs12->host_ds_selector; vmx_set_segment(vcpu, &seg, VCPU_SREG_DS); seg.selector = vmcs12->host_es_selector; vmx_set_segment(vcpu, &seg, VCPU_SREG_ES); seg.selector = vmcs12->host_ss_selector; vmx_set_segment(vcpu, &seg, VCPU_SREG_SS); seg.selector = vmcs12->host_fs_selector; seg.base = vmcs12->host_fs_base; vmx_set_segment(vcpu, &seg, VCPU_SREG_FS); seg.selector = vmcs12->host_gs_selector; seg.base = vmcs12->host_gs_base; vmx_set_segment(vcpu, &seg, VCPU_SREG_GS); seg = (struct kvm_segment) { .base = vmcs12->host_tr_base, .limit = 0x67, .selector = vmcs12->host_tr_selector, .type = 11, .present = 1 }; vmx_set_segment(vcpu, &seg, VCPU_SREG_TR); kvm_set_dr(vcpu, 7, 0x400); vmcs_write64(GUEST_IA32_DEBUGCTL, 0); if (cpu_has_vmx_msr_bitmap()) vmx_set_msr_bitmap(vcpu); if (nested_vmx_load_msr(vcpu, vmcs12->vm_exit_msr_load_addr, vmcs12->vm_exit_msr_load_count)) nested_vmx_abort(vcpu, VMX_ABORT_LOAD_HOST_MSR_FAIL); }
1,684
751
0
image_draw_decide_cb (int image_id, void *data) { return (image_id == GPOINTER_TO_INT (data)); }
1,685
103,019
0
virtual bool CanCloseTab() const { return true; }
1,686
113,403
0
void WebProcessProxy::getSharedWorkerProcessConnection(const String& /* url */, const String& /* name */, PassRefPtr<Messages::WebProcessProxy::GetSharedWorkerProcessConnection::DelayedReply>) { }
1,687
170,397
0
static void Region_destructor(JNIEnv* env, jobject, jlong regionHandle) { SkRegion* region = reinterpret_cast<SkRegion*>(regionHandle); SkASSERT(region); delete region; }
1,688
177,025
0
status_t InputDispatcher::unregisterInputChannel(const sp<InputChannel>& inputChannel) { #if DEBUG_REGISTRATION ALOGD("channel '%s' ~ unregisterInputChannel", inputChannel->getName().string()); #endif { // acquire lock AutoMutex _l(mLock); status_t status = unregisterInputChannelLocked(inputChannel, false /*notify*/); if (status) { return status; } } // release lock mLooper->wake(); return OK; }
1,689
107,881
0
bool WebViewPlugin::initialize(WebPluginContainer* container) { container_ = container; if (container_) old_title_ = container_->element().getAttribute("title"); return true; }
1,690
22,276
0
void mmput(struct mm_struct *mm) { might_sleep(); if (atomic_dec_and_test(&mm->mm_users)) { exit_aio(mm); ksm_exit(mm); exit_mmap(mm); set_mm_exe_file(mm, NULL); if (!list_empty(&mm->mmlist)) { spin_lock(&mmlist_lock); list_del(&mm->mmlist); spin_unlock(&mmlist_lock); } put_swap_token(mm); if (mm->binfmt) module_put(mm->binfmt->module); mmdrop(mm); } }
1,691
108,943
0
void RenderViewImpl::OnImeConfirmComposition( const string16& text, const ui::Range& replacement_range) { if (pepper_delegate_.IsPluginFocused()) { pepper_delegate_.OnImeConfirmComposition(text); } else { #if defined(OS_WIN) if (focused_plugin_id_ >= 0) { std::set<WebPluginDelegateProxy*>::iterator it; for (it = plugin_delegates_.begin(); it != plugin_delegates_.end(); ++it) { (*it)->ImeCompositionCompleted(text, focused_plugin_id_); } return; } #endif if (replacement_range.IsValid() && webview()) { if (WebFrame* frame = webview()->focusedFrame()) { WebRange webrange = WebRange::fromDocumentRange( frame, replacement_range.start(), replacement_range.length()); if (!webrange.isNull()) frame->selectRange(webrange); } } RenderWidget::OnImeConfirmComposition(text, replacement_range); } }
1,692
88,086
0
SMB2_query_info_free(struct smb_rqst *rqst) { if (rqst && rqst->rq_iov) cifs_small_buf_release(rqst->rq_iov[0].iov_base); /* request */ }
1,693
39,913
0
void skb_queue_purge(struct sk_buff_head *list) { struct sk_buff *skb; while ((skb = skb_dequeue(list)) != NULL) kfree_skb(skb); }
1,694
78,051
0
void WriteData(SAVESTREAM* fp, cmsIT8* it8) { int i, j; TABLE* t = GetTable(it8); if (!t->Data) return; WriteStr (fp, "BEGIN_DATA\n"); t->nPatches = atoi(cmsIT8GetProperty(it8, "NUMBER_OF_SETS")); for (i = 0; i < t-> nPatches; i++) { WriteStr(fp, " "); for (j = 0; j < t->nSamples; j++) { char *ptr = t->Data[i*t->nSamples+j]; if (ptr == NULL) WriteStr(fp, "\"\""); else { if (strchr(ptr, ' ') != NULL) { WriteStr(fp, "\""); WriteStr(fp, ptr); WriteStr(fp, "\""); } else WriteStr(fp, ptr); } WriteStr(fp, ((j == (t->nSamples-1)) ? "\n" : "\t")); } } WriteStr (fp, "END_DATA\n"); }
1,695
153,944
0
void GLES2DecoderImpl::DoApplyScreenSpaceAntialiasingCHROMIUM() { Framebuffer* bound_framebuffer = GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER); if (!bound_framebuffer) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glApplyScreenSpaceAntialiasingCHROMIUM", "no bound framebuffer object"); return; } if (!feature_info_->feature_flags() .use_chromium_screen_space_antialiasing_via_shaders) { api()->glApplyFramebufferAttachmentCMAAINTELFn(); } else { if (!apply_framebuffer_attachment_cmaa_intel_.get()) { LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER( "glApplyFramebufferAttachmentCMAAINTEL"); apply_framebuffer_attachment_cmaa_intel_.reset( new ApplyFramebufferAttachmentCMAAINTELResourceManager()); apply_framebuffer_attachment_cmaa_intel_->Initialize(this); if (LOCAL_PEEK_GL_ERROR("glApplyFramebufferAttachmentCMAAINTEL") != GL_NO_ERROR) return; } static const char kFunctionName[] = "glApplyScreenSpaceAntialiasingCHROMIUM"; if (!InitializeCopyTextureCHROMIUM(kFunctionName)) return; for (uint32_t i = 0; i < group_->max_draw_buffers(); ++i) { const Framebuffer::Attachment* attachment = bound_framebuffer->GetAttachment(GL_COLOR_ATTACHMENT0 + i); if (attachment && attachment->IsTextureAttachment()) { GLenum internal_format = attachment->internal_format(); if (!CanUseCopyTextureCHROMIUMInternalFormat(internal_format)) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, "Apply CMAA on framebuffer with attachment in " "invalid internalformat."); return; } } } apply_framebuffer_attachment_cmaa_intel_ ->ApplyFramebufferAttachmentCMAAINTEL(this, bound_framebuffer, copy_texture_chromium_.get(), texture_manager()); } }
1,696
28,875
0
int kvm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) { unsigned long old_cr0 = kvm_read_cr0(vcpu); unsigned long update_bits = X86_CR0_PG | X86_CR0_WP | X86_CR0_CD | X86_CR0_NW; cr0 |= X86_CR0_ET; #ifdef CONFIG_X86_64 if (cr0 & 0xffffffff00000000UL) return 1; #endif cr0 &= ~CR0_RESERVED_BITS; if ((cr0 & X86_CR0_NW) && !(cr0 & X86_CR0_CD)) return 1; if ((cr0 & X86_CR0_PG) && !(cr0 & X86_CR0_PE)) return 1; if (!is_paging(vcpu) && (cr0 & X86_CR0_PG)) { #ifdef CONFIG_X86_64 if ((vcpu->arch.efer & EFER_LME)) { int cs_db, cs_l; if (!is_pae(vcpu)) return 1; kvm_x86_ops->get_cs_db_l_bits(vcpu, &cs_db, &cs_l); if (cs_l) return 1; } else #endif if (is_pae(vcpu) && !load_pdptrs(vcpu, vcpu->arch.walk_mmu, kvm_read_cr3(vcpu))) return 1; } if (!(cr0 & X86_CR0_PG) && kvm_read_cr4_bits(vcpu, X86_CR4_PCIDE)) return 1; kvm_x86_ops->set_cr0(vcpu, cr0); if ((cr0 ^ old_cr0) & X86_CR0_PG) { kvm_clear_async_pf_completion_queue(vcpu); kvm_async_pf_hash_reset(vcpu); } if ((cr0 ^ old_cr0) & update_bits) kvm_mmu_reset_context(vcpu); return 0; }
1,697
132,732
0
void ChromotingInstance::HandleSendMouseInputWhenUnfocused() { input_handler_.set_send_mouse_input_when_unfocused(true); }
1,698
139,566
0
static String ValueBackColor(const EditorInternalCommand&, LocalFrame& frame, Event*) { return ValueStyle(frame, CSSPropertyBackgroundColor); }
1,699