unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
160,597 | 0 | void RenderFrameImpl::DidStopLoading() {
TRACE_EVENT1("navigation,rail", "RenderFrameImpl::didStopLoading",
"id", routing_id_);
history_subframe_unique_names_.clear();
blink::WebIconURL::Type icon_types_mask =
static_cast<blink::WebIconURL::Type>(
blink::WebIconURL::kTypeFavicon |
blink::WebIconURL::kTypeTouchPrecomposed |
blink::WebIconURL::kTypeTouch);
SendUpdateFaviconURL(icon_types_mask);
render_view_->FrameDidStopLoading(frame_);
Send(new FrameHostMsg_DidStopLoading(routing_id_));
}
| 8,300 |
30,985 | 0 | void iscsi_print_params(struct iscsi_param_list *param_list)
{
struct iscsi_param *param;
list_for_each_entry(param, ¶m_list->param_list, p_list)
pr_debug("%s: %s\n", param->name, param->value);
}
| 8,301 |
11,123 | 0 | static int phar_open_from_fp(php_stream* fp, char *fname, int fname_len, char *alias, int alias_len, int options, phar_archive_data** pphar, int is_data, char **error) /* {{{ */
{
const char token[] = "__HALT_COMPILER();";
const char zip_magic[] = "PK\x03\x04";
const char gz_magic[] = "\x1f\x8b\x08";
const char bz_magic[] = "BZh";
char *pos, test = '\0';
const int window_size = 1024;
char buffer[1024 + sizeof(token)]; /* a 1024 byte window + the size of the halt_compiler token (moving window) */
const zend_long readsize = sizeof(buffer) - sizeof(token);
const zend_long tokenlen = sizeof(token) - 1;
zend_long halt_offset;
size_t got;
php_uint32 compression = PHAR_FILE_COMPRESSED_NONE;
if (error) {
*error = NULL;
}
if (-1 == php_stream_rewind(fp)) {
MAPPHAR_ALLOC_FAIL("cannot rewind phar \"%s\"")
}
buffer[sizeof(buffer)-1] = '\0';
memset(buffer, 32, sizeof(token));
halt_offset = 0;
/* Maybe it's better to compile the file instead of just searching, */
/* but we only want the offset. So we want a .re scanner to find it. */
while(!php_stream_eof(fp)) {
if ((got = php_stream_read(fp, buffer+tokenlen, readsize)) < (size_t) tokenlen) {
MAPPHAR_ALLOC_FAIL("internal corruption of phar \"%s\" (truncated entry)")
}
if (!test) {
test = '\1';
pos = buffer+tokenlen;
if (!memcmp(pos, gz_magic, 3)) {
char err = 0;
php_stream_filter *filter;
php_stream *temp;
/* to properly decompress, we have to tell zlib to look for a zlib or gzip header */
zval filterparams;
if (!PHAR_G(has_zlib)) {
MAPPHAR_ALLOC_FAIL("unable to decompress gzipped phar archive \"%s\" to temporary file, enable zlib extension in php.ini")
}
array_init(&filterparams);
/* this is defined in zlib's zconf.h */
#ifndef MAX_WBITS
#define MAX_WBITS 15
#endif
add_assoc_long_ex(&filterparams, "window", sizeof("window") - 1, MAX_WBITS + 32);
/* entire file is gzip-compressed, uncompress to temporary file */
if (!(temp = php_stream_fopen_tmpfile())) {
MAPPHAR_ALLOC_FAIL("unable to create temporary file for decompression of gzipped phar archive \"%s\"")
}
php_stream_rewind(fp);
filter = php_stream_filter_create("zlib.inflate", &filterparams, php_stream_is_persistent(fp));
if (!filter) {
err = 1;
add_assoc_long_ex(&filterparams, "window", sizeof("window") - 1, MAX_WBITS);
filter = php_stream_filter_create("zlib.inflate", &filterparams, php_stream_is_persistent(fp));
zval_dtor(&filterparams);
if (!filter) {
php_stream_close(temp);
MAPPHAR_ALLOC_FAIL("unable to decompress gzipped phar archive \"%s\", ext/zlib is buggy in PHP versions older than 5.2.6")
}
} else {
zval_dtor(&filterparams);
}
php_stream_filter_append(&temp->writefilters, filter);
if (SUCCESS != php_stream_copy_to_stream_ex(fp, temp, PHP_STREAM_COPY_ALL, NULL)) {
if (err) {
php_stream_close(temp);
MAPPHAR_ALLOC_FAIL("unable to decompress gzipped phar archive \"%s\", ext/zlib is buggy in PHP versions older than 5.2.6")
}
php_stream_close(temp);
MAPPHAR_ALLOC_FAIL("unable to decompress gzipped phar archive \"%s\" to temporary file")
}
php_stream_filter_flush(filter, 1);
php_stream_filter_remove(filter, 1);
php_stream_close(fp);
fp = temp;
php_stream_rewind(fp);
compression = PHAR_FILE_COMPRESSED_GZ;
/* now, start over */
test = '\0';
continue;
} else if (!memcmp(pos, bz_magic, 3)) {
php_stream_filter *filter;
php_stream *temp;
if (!PHAR_G(has_bz2)) {
MAPPHAR_ALLOC_FAIL("unable to decompress bzipped phar archive \"%s\" to temporary file, enable bz2 extension in php.ini")
}
/* entire file is bzip-compressed, uncompress to temporary file */
if (!(temp = php_stream_fopen_tmpfile())) {
MAPPHAR_ALLOC_FAIL("unable to create temporary file for decompression of bzipped phar archive \"%s\"")
}
php_stream_rewind(fp);
filter = php_stream_filter_create("bzip2.decompress", NULL, php_stream_is_persistent(fp));
if (!filter) {
php_stream_close(temp);
MAPPHAR_ALLOC_FAIL("unable to decompress bzipped phar archive \"%s\", filter creation failed")
}
php_stream_filter_append(&temp->writefilters, filter);
if (SUCCESS != php_stream_copy_to_stream_ex(fp, temp, PHP_STREAM_COPY_ALL, NULL)) {
php_stream_close(temp);
MAPPHAR_ALLOC_FAIL("unable to decompress bzipped phar archive \"%s\" to temporary file")
}
php_stream_filter_flush(filter, 1);
php_stream_filter_remove(filter, 1);
php_stream_close(fp);
fp = temp;
php_stream_rewind(fp);
compression = PHAR_FILE_COMPRESSED_BZ2;
/* now, start over */
test = '\0';
continue;
}
if (!memcmp(pos, zip_magic, 4)) {
php_stream_seek(fp, 0, SEEK_END);
return phar_parse_zipfile(fp, fname, fname_len, alias, alias_len, pphar, error);
}
if (got > 512) {
if (phar_is_tar(pos, fname)) {
php_stream_rewind(fp);
return phar_parse_tarfile(fp, fname, fname_len, alias, alias_len, pphar, is_data, compression, error);
}
}
}
if (got > 0 && (pos = phar_strnstr(buffer, got + sizeof(token), token, sizeof(token)-1)) != NULL) {
halt_offset += (pos - buffer); /* no -tokenlen+tokenlen here */
return phar_parse_pharfile(fp, fname, fname_len, alias, alias_len, halt_offset, pphar, compression, error);
}
halt_offset += got;
memmove(buffer, buffer + window_size, tokenlen); /* move the memory buffer by the size of the window */
}
MAPPHAR_ALLOC_FAIL("internal corruption of phar \"%s\" (__HALT_COMPILER(); not found)")
}
/* }}} */
| 8,302 |
145,447 | 0 | MockP2PQuicStreamDelegate* stream_delegate() const {
return stream_delegate_.get();
}
| 8,303 |
52,672 | 0 | static char print_fat_dirty_state(void)
{
printf("Dirty bit is set. Fs was not properly unmounted and"
" some data may be corrupt.\n");
if (interactive) {
printf("1) Remove dirty bit\n" "2) No action\n");
return get_key("12", "?");
} else
printf(" Automatically removing dirty bit.\n");
return '1';
}
| 8,304 |
179,443 | 1 | parse_rock_ridge_inode_internal(struct iso_directory_record *de,
struct inode *inode, int regard_xa)
{
int symlink_len = 0;
int cnt, sig;
struct inode *reloc;
struct rock_ridge *rr;
int rootflag;
struct rock_state rs;
int ret = 0;
if (!ISOFS_SB(inode->i_sb)->s_rock)
return 0;
init_rock_state(&rs, inode);
setup_rock_ridge(de, inode, &rs);
if (regard_xa) {
rs.chr += 14;
rs.len -= 14;
if (rs.len < 0)
rs.len = 0;
}
repeat:
while (rs.len > 2) { /* There may be one byte for padding somewhere */
rr = (struct rock_ridge *)rs.chr;
/*
* Ignore rock ridge info if rr->len is out of range, but
* don't return -EIO because that would make the file
* invisible.
*/
if (rr->len < 3)
goto out; /* Something got screwed up here */
sig = isonum_721(rs.chr);
if (rock_check_overflow(&rs, sig))
goto eio;
rs.chr += rr->len;
rs.len -= rr->len;
/*
* As above, just ignore the rock ridge info if rr->len
* is bogus.
*/
if (rs.len < 0)
goto out; /* Something got screwed up here */
switch (sig) {
#ifndef CONFIG_ZISOFS /* No flag for SF or ZF */
case SIG('R', 'R'):
if ((rr->u.RR.flags[0] &
(RR_PX | RR_TF | RR_SL | RR_CL)) == 0)
goto out;
break;
#endif
case SIG('S', 'P'):
if (check_sp(rr, inode))
goto out;
break;
case SIG('C', 'E'):
rs.cont_extent = isonum_733(rr->u.CE.extent);
rs.cont_offset = isonum_733(rr->u.CE.offset);
rs.cont_size = isonum_733(rr->u.CE.size);
break;
case SIG('E', 'R'):
ISOFS_SB(inode->i_sb)->s_rock = 1;
printk(KERN_DEBUG "ISO 9660 Extensions: ");
{
int p;
for (p = 0; p < rr->u.ER.len_id; p++)
printk("%c", rr->u.ER.data[p]);
}
printk("\n");
break;
case SIG('P', 'X'):
inode->i_mode = isonum_733(rr->u.PX.mode);
set_nlink(inode, isonum_733(rr->u.PX.n_links));
i_uid_write(inode, isonum_733(rr->u.PX.uid));
i_gid_write(inode, isonum_733(rr->u.PX.gid));
break;
case SIG('P', 'N'):
{
int high, low;
high = isonum_733(rr->u.PN.dev_high);
low = isonum_733(rr->u.PN.dev_low);
/*
* The Rock Ridge standard specifies that if
* sizeof(dev_t) <= 4, then the high field is
* unused, and the device number is completely
* stored in the low field. Some writers may
* ignore this subtlety,
* and as a result we test to see if the entire
* device number is
* stored in the low field, and use that.
*/
if ((low & ~0xff) && high == 0) {
inode->i_rdev =
MKDEV(low >> 8, low & 0xff);
} else {
inode->i_rdev =
MKDEV(high, low);
}
}
break;
case SIG('T', 'F'):
/*
* Some RRIP writers incorrectly place ctime in the
* TF_CREATE field. Try to handle this correctly for
* either case.
*/
/* Rock ridge never appears on a High Sierra disk */
cnt = 0;
if (rr->u.TF.flags & TF_CREATE) {
inode->i_ctime.tv_sec =
iso_date(rr->u.TF.times[cnt++].time,
0);
inode->i_ctime.tv_nsec = 0;
}
if (rr->u.TF.flags & TF_MODIFY) {
inode->i_mtime.tv_sec =
iso_date(rr->u.TF.times[cnt++].time,
0);
inode->i_mtime.tv_nsec = 0;
}
if (rr->u.TF.flags & TF_ACCESS) {
inode->i_atime.tv_sec =
iso_date(rr->u.TF.times[cnt++].time,
0);
inode->i_atime.tv_nsec = 0;
}
if (rr->u.TF.flags & TF_ATTRIBUTES) {
inode->i_ctime.tv_sec =
iso_date(rr->u.TF.times[cnt++].time,
0);
inode->i_ctime.tv_nsec = 0;
}
break;
case SIG('S', 'L'):
{
int slen;
struct SL_component *slp;
struct SL_component *oldslp;
slen = rr->len - 5;
slp = &rr->u.SL.link;
inode->i_size = symlink_len;
while (slen > 1) {
rootflag = 0;
switch (slp->flags & ~1) {
case 0:
inode->i_size +=
slp->len;
break;
case 2:
inode->i_size += 1;
break;
case 4:
inode->i_size += 2;
break;
case 8:
rootflag = 1;
inode->i_size += 1;
break;
default:
printk("Symlink component flag "
"not implemented\n");
}
slen -= slp->len + 2;
oldslp = slp;
slp = (struct SL_component *)
(((char *)slp) + slp->len + 2);
if (slen < 2) {
if (((rr->u.SL.
flags & 1) != 0)
&&
((oldslp->
flags & 1) == 0))
inode->i_size +=
1;
break;
}
/*
* If this component record isn't
* continued, then append a '/'.
*/
if (!rootflag
&& (oldslp->flags & 1) == 0)
inode->i_size += 1;
}
}
symlink_len = inode->i_size;
break;
case SIG('R', 'E'):
printk(KERN_WARNING "Attempt to read inode for "
"relocated directory\n");
goto out;
case SIG('C', 'L'):
ISOFS_I(inode)->i_first_extent =
isonum_733(rr->u.CL.location);
reloc =
isofs_iget(inode->i_sb,
ISOFS_I(inode)->i_first_extent,
0);
if (IS_ERR(reloc)) {
ret = PTR_ERR(reloc);
goto out;
}
inode->i_mode = reloc->i_mode;
set_nlink(inode, reloc->i_nlink);
inode->i_uid = reloc->i_uid;
inode->i_gid = reloc->i_gid;
inode->i_rdev = reloc->i_rdev;
inode->i_size = reloc->i_size;
inode->i_blocks = reloc->i_blocks;
inode->i_atime = reloc->i_atime;
inode->i_ctime = reloc->i_ctime;
inode->i_mtime = reloc->i_mtime;
iput(reloc);
break;
#ifdef CONFIG_ZISOFS
case SIG('Z', 'F'): {
int algo;
if (ISOFS_SB(inode->i_sb)->s_nocompress)
break;
algo = isonum_721(rr->u.ZF.algorithm);
if (algo == SIG('p', 'z')) {
int block_shift =
isonum_711(&rr->u.ZF.parms[1]);
if (block_shift > 17) {
printk(KERN_WARNING "isofs: "
"Can't handle ZF block "
"size of 2^%d\n",
block_shift);
} else {
/*
* Note: we don't change
* i_blocks here
*/
ISOFS_I(inode)->i_file_format =
isofs_file_compressed;
/*
* Parameters to compression
* algorithm (header size,
* block size)
*/
ISOFS_I(inode)->i_format_parm[0] =
isonum_711(&rr->u.ZF.parms[0]);
ISOFS_I(inode)->i_format_parm[1] =
isonum_711(&rr->u.ZF.parms[1]);
inode->i_size =
isonum_733(rr->u.ZF.
real_size);
}
} else {
printk(KERN_WARNING
"isofs: Unknown ZF compression "
"algorithm: %c%c\n",
rr->u.ZF.algorithm[0],
rr->u.ZF.algorithm[1]);
}
break;
}
#endif
default:
break;
}
}
ret = rock_continue(&rs);
if (ret == 0)
goto repeat;
if (ret == 1)
ret = 0;
out:
kfree(rs.buffer);
return ret;
eio:
ret = -EIO;
goto out;
}
| 8,305 |
130,854 | 0 | static void methodWithEnforceRangeInt32Method(const v8::FunctionCallbackInfo<v8::Value>& info)
{
ExceptionState exceptionState(ExceptionState::ExecutionContext, "methodWithEnforceRangeInt32", "TestObject", info.Holder(), info.GetIsolate());
if (UNLIKELY(info.Length() < 1)) {
exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length()));
exceptionState.throwIfNeeded();
return;
}
TestObject* imp = V8TestObject::toNative(info.Holder());
V8TRYCATCH_EXCEPTION_VOID(int, value, toInt32(info[0], EnforceRange, exceptionState), exceptionState);
imp->methodWithEnforceRangeInt32(value);
}
| 8,306 |
101,045 | 0 | void QuotaManager::NotifyStorageAccessedInternal(
QuotaClient::ID client_id,
const GURL& origin, StorageType type,
base::Time accessed_time) {
LazyInitialize();
if (type == kStorageTypeTemporary && lru_origin_callback_.get()) {
access_notified_origins_.insert(origin);
}
if (db_disabled_)
return;
make_scoped_refptr(new UpdateAccessTimeTask(
this, origin, type, accessed_time))->Start();
}
| 8,307 |
139,935 | 0 | void HTMLMediaElement::automaticTrackSelectionForUpdatedUserPreference() {
if (!m_textTracks || !m_textTracks->length())
return;
markCaptionAndSubtitleTracksAsUnconfigured();
m_processingPreferenceChange = true;
m_textTracksVisible = false;
honorUserPreferencesForAutomaticTextTrackSelection();
m_processingPreferenceChange = false;
m_textTracksVisible = m_textTracks->hasShowingTracks();
updateTextTrackDisplay();
}
| 8,308 |
176,346 | 0 | static inline void SetImpl(FixedArrayBase* backing_store, uint32_t entry,
Object* value) {
FixedArray::cast(backing_store)->set(entry, value);
}
| 8,309 |
185,419 | 1 | std::string MasterPreferences::GetCompressedVariationsSeed() const {
return ExtractPrefString(prefs::kVariationsCompressedSeed);
}
| 8,310 |
144,840 | 0 | bool TestLifecycleUnit::CanDiscard(DiscardReason reason,
DecisionDetails* decision_details) const {
return can_discard_;
}
| 8,311 |
31,876 | 0 | struct sk_buff **tcp_gro_receive(struct sk_buff **head, struct sk_buff *skb)
{
struct sk_buff **pp = NULL;
struct sk_buff *p;
struct tcphdr *th;
struct tcphdr *th2;
unsigned int len;
unsigned int thlen;
unsigned int flags;
unsigned int mss = 1;
unsigned int hlen;
unsigned int off;
int flush = 1;
int i;
off = skb_gro_offset(skb);
hlen = off + sizeof(*th);
th = skb_gro_header_fast(skb, off);
if (skb_gro_header_hard(skb, hlen)) {
th = skb_gro_header_slow(skb, hlen, off);
if (unlikely(!th))
goto out;
}
thlen = th->doff * 4;
if (thlen < sizeof(*th))
goto out;
hlen = off + thlen;
if (skb_gro_header_hard(skb, hlen)) {
th = skb_gro_header_slow(skb, hlen, off);
if (unlikely(!th))
goto out;
}
skb_gro_pull(skb, thlen);
len = skb_gro_len(skb);
flags = tcp_flag_word(th);
for (; (p = *head); head = &p->next) {
if (!NAPI_GRO_CB(p)->same_flow)
continue;
th2 = tcp_hdr(p);
if (*(u32 *)&th->source ^ *(u32 *)&th2->source) {
NAPI_GRO_CB(p)->same_flow = 0;
continue;
}
goto found;
}
goto out_check_final;
found:
flush = NAPI_GRO_CB(p)->flush;
flush |= flags & TCP_FLAG_CWR;
flush |= (flags ^ tcp_flag_word(th2)) &
~(TCP_FLAG_CWR | TCP_FLAG_FIN | TCP_FLAG_PSH);
flush |= th->ack_seq ^ th2->ack_seq;
for (i = sizeof(*th); i < thlen; i += 4)
flush |= *(u32 *)((u8 *)th + i) ^
*(u32 *)((u8 *)th2 + i);
mss = skb_shinfo(p)->gso_size;
flush |= (len - 1) >= mss;
flush |= (ntohl(th2->seq) + skb_gro_len(p)) ^ ntohl(th->seq);
if (flush || skb_gro_receive(head, skb)) {
mss = 1;
goto out_check_final;
}
p = *head;
th2 = tcp_hdr(p);
tcp_flag_word(th2) |= flags & (TCP_FLAG_FIN | TCP_FLAG_PSH);
out_check_final:
flush = len < mss;
flush |= flags & (TCP_FLAG_URG | TCP_FLAG_PSH | TCP_FLAG_RST |
TCP_FLAG_SYN | TCP_FLAG_FIN);
if (p && (!NAPI_GRO_CB(skb)->same_flow || flush))
pp = head;
out:
NAPI_GRO_CB(skb)->flush |= flush;
return pp;
}
| 8,312 |
179,914 | 1 | static int em_sysenter(struct x86_emulate_ctxt *ctxt)
{
const struct x86_emulate_ops *ops = ctxt->ops;
struct desc_struct cs, ss;
u64 msr_data;
u16 cs_sel, ss_sel;
u64 efer = 0;
ops->get_msr(ctxt, MSR_EFER, &efer);
/* inject #GP if in real mode */
if (ctxt->mode == X86EMUL_MODE_REAL)
return emulate_gp(ctxt, 0);
/*
* Not recognized on AMD in compat mode (but is recognized in legacy
* mode).
*/
if ((ctxt->mode == X86EMUL_MODE_PROT32) && (efer & EFER_LMA)
&& !vendor_intel(ctxt))
return emulate_ud(ctxt);
/* sysenter/sysexit have not been tested in 64bit mode. */
if (ctxt->mode == X86EMUL_MODE_PROT64)
return X86EMUL_UNHANDLEABLE;
setup_syscalls_segments(ctxt, &cs, &ss);
ops->get_msr(ctxt, MSR_IA32_SYSENTER_CS, &msr_data);
switch (ctxt->mode) {
case X86EMUL_MODE_PROT32:
if ((msr_data & 0xfffc) == 0x0)
return emulate_gp(ctxt, 0);
break;
case X86EMUL_MODE_PROT64:
if (msr_data == 0x0)
return emulate_gp(ctxt, 0);
break;
default:
break;
}
ctxt->eflags &= ~(EFLG_VM | EFLG_IF);
cs_sel = (u16)msr_data;
cs_sel &= ~SELECTOR_RPL_MASK;
ss_sel = cs_sel + 8;
ss_sel &= ~SELECTOR_RPL_MASK;
if (ctxt->mode == X86EMUL_MODE_PROT64 || (efer & EFER_LMA)) {
cs.d = 0;
cs.l = 1;
}
ops->set_segment(ctxt, cs_sel, &cs, 0, VCPU_SREG_CS);
ops->set_segment(ctxt, ss_sel, &ss, 0, VCPU_SREG_SS);
ops->get_msr(ctxt, MSR_IA32_SYSENTER_EIP, &msr_data);
ctxt->_eip = msr_data;
ops->get_msr(ctxt, MSR_IA32_SYSENTER_ESP, &msr_data);
*reg_write(ctxt, VCPU_REGS_RSP) = msr_data;
return X86EMUL_CONTINUE;
}
| 8,313 |
38,834 | 0 | circle_above(PG_FUNCTION_ARGS)
{
CIRCLE *circle1 = PG_GETARG_CIRCLE_P(0);
CIRCLE *circle2 = PG_GETARG_CIRCLE_P(1);
PG_RETURN_BOOL(FPgt((circle1->center.y - circle1->radius),
(circle2->center.y + circle2->radius)));
}
| 8,314 |
74,354 | 0 | DumpMac(int dbg_level, const char* header_str, UCHAR* mac)
{
DPrintf(dbg_level,("%s: %02x-%02x-%02x-%02x-%02x-%02x\n",
header_str, mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]));
}
| 8,315 |
56,169 | 0 | static int rfcomm_sock_accept(struct socket *sock, struct socket *newsock, int flags)
{
DEFINE_WAIT_FUNC(wait, woken_wake_function);
struct sock *sk = sock->sk, *nsk;
long timeo;
int err = 0;
lock_sock_nested(sk, SINGLE_DEPTH_NESTING);
if (sk->sk_type != SOCK_STREAM) {
err = -EINVAL;
goto done;
}
timeo = sock_rcvtimeo(sk, flags & O_NONBLOCK);
BT_DBG("sk %p timeo %ld", sk, timeo);
/* Wait for an incoming connection. (wake-one). */
add_wait_queue_exclusive(sk_sleep(sk), &wait);
while (1) {
if (sk->sk_state != BT_LISTEN) {
err = -EBADFD;
break;
}
nsk = bt_accept_dequeue(sk, newsock);
if (nsk)
break;
if (!timeo) {
err = -EAGAIN;
break;
}
if (signal_pending(current)) {
err = sock_intr_errno(timeo);
break;
}
release_sock(sk);
timeo = wait_woken(&wait, TASK_INTERRUPTIBLE, timeo);
lock_sock_nested(sk, SINGLE_DEPTH_NESTING);
}
remove_wait_queue(sk_sleep(sk), &wait);
if (err)
goto done;
newsock->state = SS_CONNECTED;
BT_DBG("new socket %p", nsk);
done:
release_sock(sk);
return err;
}
| 8,316 |
95,620 | 0 | static void Com_WriteCDKey( const char *filename, const char *ikey ) {
fileHandle_t f;
char fbuffer[MAX_OSPATH];
char key[17];
#ifndef _WIN32
mode_t savedumask;
#endif
Com_sprintf(fbuffer, sizeof(fbuffer), "%s/rtcwkey", filename);
Q_strncpyz( key, ikey, 17 );
if ( !CL_CDKeyValidate( key, NULL ) ) {
return;
}
#ifndef _WIN32
savedumask = umask(0077);
#endif
f = FS_SV_FOpenFileWrite( fbuffer );
if ( !f ) {
Com_Printf ("Couldn't write CD key to %s.\n", fbuffer );
goto out;
}
FS_Write( key, 16, f );
FS_Printf( f, "\n// generated by RTCW, do not modify\r\n" );
FS_Printf( f, "// Do not give this file to ANYONE.\r\n" );
#ifdef __APPLE__
FS_Printf( f, "// Aspyr will NOT ask you to send this file to them.\r\n" );
#else
FS_Printf( f, "// id Software and Activision will NOT ask you to send this file to them.\r\n" );
#endif
FS_FCloseFile( f );
out:
#ifndef _WIN32
umask(savedumask);
#else
;
#endif
}
| 8,317 |
69,158 | 0 | static zend_always_inline uint32_t zend_array_dup_elements(HashTable *source, HashTable *target, int static_keys, int with_holes)
{
uint32_t idx = 0;
Bucket *p = source->arData;
Bucket *q = target->arData;
Bucket *end = p + source->nNumUsed;
do {
if (!zend_array_dup_element(source, target, idx, p, q, 0, static_keys, with_holes)) {
uint32_t target_idx = idx;
idx++; p++;
while (p != end) {
if (zend_array_dup_element(source, target, target_idx, p, q, 0, static_keys, with_holes)) {
if (source->nInternalPointer == idx) {
target->nInternalPointer = target_idx;
}
target_idx++; q++;
}
idx++; p++;
}
return target_idx;
}
idx++; p++; q++;
} while (p != end);
return idx;
}
| 8,318 |
165,109 | 0 | OperationID FileSystemOperationRunner::Remove(const FileSystemURL& url,
bool recursive,
StatusCallback callback) {
base::File::Error error = base::File::FILE_OK;
std::unique_ptr<FileSystemOperation> operation = base::WrapUnique(
file_system_context_->CreateFileSystemOperation(url, &error));
FileSystemOperation* operation_raw = operation.get();
OperationID id = BeginOperation(std::move(operation));
base::AutoReset<bool> beginning(&is_beginning_operation_, true);
if (!operation_raw) {
DidFinish(id, std::move(callback), error);
return id;
}
PrepareForWrite(id, url);
operation_raw->Remove(url, recursive,
base::BindOnce(&FileSystemOperationRunner::DidFinish,
weak_ptr_, id, std::move(callback)));
return id;
}
| 8,319 |
100,562 | 0 | bool BrowserTitlebar::IsItemChecked(int command_id) const {
if (command_id == kShowWindowDecorationsCommand) {
PrefService* prefs = browser_window_->browser()->profile()->GetPrefs();
return !prefs->GetBoolean(prefs::kUseCustomChromeFrame);
}
EncodingMenuController controller;
if (controller.DoesCommandBelongToEncodingMenu(command_id)) {
TabContents* tab_contents =
browser_window_->browser()->GetSelectedTabContents();
if (tab_contents) {
return controller.IsItemChecked(browser_window_->browser()->profile(),
tab_contents->encoding(),
command_id);
}
return false;
}
NOTREACHED();
return false;
}
| 8,320 |
90,989 | 0 | void CWebServer::Cmd_GetConfig(WebEmSession & session, const request& req, Json::Value &root)
{
if (session.rights == -1)
{
session.reply_status = reply::forbidden;
return;//Only auth user allowed
}
root["status"] = "OK";
root["title"] = "GetConfig";
bool bHaveUser = (session.username != "");
int urights = 3;
unsigned long UserID = 0;
if (bHaveUser)
{
int iUser = FindUser(session.username.c_str());
if (iUser != -1)
{
urights = static_cast<int>(m_users[iUser].userrights);
UserID = m_users[iUser].ID;
}
}
int nValue;
std::string sValue;
if (m_sql.GetPreferencesVar("Language", sValue))
{
root["language"] = sValue;
}
if (m_sql.GetPreferencesVar("DegreeDaysBaseTemperature", sValue))
{
root["DegreeDaysBaseTemperature"] = atof(sValue.c_str());
}
nValue = 0;
int iDashboardType = 0;
m_sql.GetPreferencesVar("DashboardType", iDashboardType);
root["DashboardType"] = iDashboardType;
m_sql.GetPreferencesVar("MobileType", nValue);
root["MobileType"] = nValue;
nValue = 1;
m_sql.GetPreferencesVar("5MinuteHistoryDays", nValue);
root["FiveMinuteHistoryDays"] = nValue;
nValue = 1;
m_sql.GetPreferencesVar("ShowUpdateEffect", nValue);
root["result"]["ShowUpdatedEffect"] = (nValue == 1);
root["AllowWidgetOrdering"] = m_sql.m_bAllowWidgetOrdering;
root["WindScale"] = m_sql.m_windscale*10.0f;
root["WindSign"] = m_sql.m_windsign;
root["TempScale"] = m_sql.m_tempscale;
root["TempSign"] = m_sql.m_tempsign;
std::string Latitude = "1";
std::string Longitude = "1";
if (m_sql.GetPreferencesVar("Location", nValue, sValue))
{
std::vector<std::string> strarray;
StringSplit(sValue, ";", strarray);
if (strarray.size() == 2)
{
Latitude = strarray[0];
Longitude = strarray[1];
}
}
root["Latitude"] = Latitude;
root["Longitude"] = Longitude;
#ifndef NOCLOUD
bool bEnableTabProxy = request::get_req_header(&req, "X-From-MyDomoticz") != NULL;
#else
bool bEnableTabProxy = false;
#endif
int bEnableTabDashboard = 1;
int bEnableTabFloorplans = 1;
int bEnableTabLight = 1;
int bEnableTabScenes = 1;
int bEnableTabTemp = 1;
int bEnableTabWeather = 1;
int bEnableTabUtility = 1;
int bEnableTabCustom = 1;
std::vector<std::vector<std::string> > result;
if ((UserID != 0) && (UserID != 10000))
{
result = m_sql.safe_query("SELECT TabsEnabled FROM Users WHERE (ID==%lu)",
UserID);
if (!result.empty())
{
int TabsEnabled = atoi(result[0][0].c_str());
bEnableTabLight = (TabsEnabled&(1 << 0));
bEnableTabScenes = (TabsEnabled&(1 << 1));
bEnableTabTemp = (TabsEnabled&(1 << 2));
bEnableTabWeather = (TabsEnabled&(1 << 3));
bEnableTabUtility = (TabsEnabled&(1 << 4));
bEnableTabCustom = (TabsEnabled&(1 << 5));
bEnableTabFloorplans = (TabsEnabled&(1 << 6));
}
}
else
{
m_sql.GetPreferencesVar("EnableTabFloorplans", bEnableTabFloorplans);
m_sql.GetPreferencesVar("EnableTabLights", bEnableTabLight);
m_sql.GetPreferencesVar("EnableTabScenes", bEnableTabScenes);
m_sql.GetPreferencesVar("EnableTabTemp", bEnableTabTemp);
m_sql.GetPreferencesVar("EnableTabWeather", bEnableTabWeather);
m_sql.GetPreferencesVar("EnableTabUtility", bEnableTabUtility);
m_sql.GetPreferencesVar("EnableTabCustom", bEnableTabCustom);
}
if (iDashboardType == 3)
{
bEnableTabFloorplans = 0;
}
root["result"]["EnableTabProxy"] = bEnableTabProxy;
root["result"]["EnableTabDashboard"] = bEnableTabDashboard != 0;
root["result"]["EnableTabFloorplans"] = bEnableTabFloorplans != 0;
root["result"]["EnableTabLights"] = bEnableTabLight != 0;
root["result"]["EnableTabScenes"] = bEnableTabScenes != 0;
root["result"]["EnableTabTemp"] = bEnableTabTemp != 0;
root["result"]["EnableTabWeather"] = bEnableTabWeather != 0;
root["result"]["EnableTabUtility"] = bEnableTabUtility != 0;
root["result"]["EnableTabCustom"] = bEnableTabCustom != 0;
if (bEnableTabCustom)
{
DIR *lDir;
struct dirent *ent;
std::string templatesFolder = szWWWFolder + "/templates";
int iFile = 0;
if ((lDir = opendir(templatesFolder.c_str())) != NULL)
{
while ((ent = readdir(lDir)) != NULL)
{
std::string filename = ent->d_name;
size_t pos = filename.find(".htm");
if (pos != std::string::npos)
{
std::string shortfile = filename.substr(0, pos);
root["result"]["templates"][iFile++] = shortfile;
}
}
closedir(lDir);
}
}
}
| 8,321 |
98,382 | 0 | WebKitWebFrame* webkit_web_frame_find_frame(WebKitWebFrame* frame, const gchar* name)
{
g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), NULL);
g_return_val_if_fail(name, NULL);
Frame* coreFrame = core(frame);
if (!coreFrame)
return NULL;
String nameString = String::fromUTF8(name);
return kit(coreFrame->tree()->find(AtomicString(nameString)));
}
| 8,322 |
72,169 | 0 | extern void record_launched_jobs(void)
{
List steps;
ListIterator i;
step_loc_t *stepd;
steps = stepd_available(conf->spooldir, conf->node_name);
i = list_iterator_create(steps);
while ((stepd = list_next(i))) {
_launch_complete_add(stepd->jobid);
}
list_iterator_destroy(i);
FREE_NULL_LIST(steps);
}
| 8,323 |
96,749 | 0 | ModuleExport size_t RegisterPSImage(void)
{
MagickInfo
*entry;
entry=AcquireMagickInfo("PS","EPI",
"Encapsulated PostScript Interchange format");
entry->decoder=(DecodeImageHandler *) ReadPSImage;
entry->encoder=(EncodeImageHandler *) WritePSImage;
entry->magick=(IsImageFormatHandler *) IsPS;
entry->flags|=CoderDecoderSeekableStreamFlag;
entry->flags^=CoderAdjoinFlag;
entry->flags^=CoderBlobSupportFlag;
entry->mime_type=ConstantString("application/postscript");
(void) RegisterMagickInfo(entry);
entry=AcquireMagickInfo("PS","EPS","Encapsulated PostScript");
entry->decoder=(DecodeImageHandler *) ReadPSImage;
entry->encoder=(EncodeImageHandler *) WritePSImage;
entry->magick=(IsImageFormatHandler *) IsPS;
entry->flags|=CoderDecoderSeekableStreamFlag;
entry->flags^=CoderAdjoinFlag;
entry->flags^=CoderBlobSupportFlag;
entry->mime_type=ConstantString("application/postscript");
(void) RegisterMagickInfo(entry);
entry=AcquireMagickInfo("PS","EPSF","Encapsulated PostScript");
entry->decoder=(DecodeImageHandler *) ReadPSImage;
entry->encoder=(EncodeImageHandler *) WritePSImage;
entry->magick=(IsImageFormatHandler *) IsPS;
entry->flags|=CoderDecoderSeekableStreamFlag;
entry->flags^=CoderAdjoinFlag;
entry->flags^=CoderBlobSupportFlag;
entry->mime_type=ConstantString("application/postscript");
(void) RegisterMagickInfo(entry);
entry=AcquireMagickInfo("PS","EPSI",
"Encapsulated PostScript Interchange format");
entry->decoder=(DecodeImageHandler *) ReadPSImage;
entry->encoder=(EncodeImageHandler *) WritePSImage;
entry->magick=(IsImageFormatHandler *) IsPS;
entry->flags|=CoderDecoderSeekableStreamFlag;
entry->flags^=CoderAdjoinFlag;
entry->flags^=CoderBlobSupportFlag;
entry->mime_type=ConstantString("application/postscript");
(void) RegisterMagickInfo(entry);
entry=AcquireMagickInfo("PS","PS","PostScript");
entry->decoder=(DecodeImageHandler *) ReadPSImage;
entry->encoder=(EncodeImageHandler *) WritePSImage;
entry->magick=(IsImageFormatHandler *) IsPS;
entry->mime_type=ConstantString("application/postscript");
entry->flags|=CoderDecoderSeekableStreamFlag;
entry->flags^=CoderBlobSupportFlag;
(void) RegisterMagickInfo(entry);
return(MagickImageCoderSignature);
}
| 8,324 |
70,584 | 0 | evdns_base_nameserver_ip_add(struct evdns_base *base, const char *ip_as_string) {
struct sockaddr_storage ss;
struct sockaddr *sa;
int len = sizeof(ss);
int res;
if (evutil_parse_sockaddr_port(ip_as_string, (struct sockaddr *)&ss,
&len)) {
log(EVDNS_LOG_WARN, "Unable to parse nameserver address %s",
ip_as_string);
return 4;
}
sa = (struct sockaddr *) &ss;
if (sockaddr_getport(sa) == 0)
sockaddr_setport(sa, 53);
EVDNS_LOCK(base);
res = evdns_nameserver_add_impl_(base, sa, len);
EVDNS_UNLOCK(base);
return res;
}
| 8,325 |
41,244 | 0 | setup_deviceinfo(struct Interface *iface)
{
struct ifreq ifr;
struct AdvPrefix *prefix;
char zero[sizeof(iface->if_addr)];
strncpy(ifr.ifr_name, iface->Name, IFNAMSIZ-1);
ifr.ifr_name[IFNAMSIZ-1] = '\0';
if (ioctl(sock, SIOCGIFMTU, &ifr) < 0) {
flog(LOG_ERR, "ioctl(SIOCGIFMTU) failed for %s: %s",
iface->Name, strerror(errno));
return (-1);
}
dlog(LOG_DEBUG, 3, "mtu for %s is %d", iface->Name, ifr.ifr_mtu);
iface->if_maxmtu = ifr.ifr_mtu;
if (ioctl(sock, SIOCGIFHWADDR, &ifr) < 0)
{
flog(LOG_ERR, "ioctl(SIOCGIFHWADDR) failed for %s: %s",
iface->Name, strerror(errno));
return (-1);
}
dlog(LOG_DEBUG, 3, "hardware type for %s is %d", iface->Name,
ifr.ifr_hwaddr.sa_family);
switch(ifr.ifr_hwaddr.sa_family)
{
case ARPHRD_ETHER:
iface->if_hwaddr_len = 48;
iface->if_prefix_len = 64;
break;
#ifdef ARPHRD_FDDI
case ARPHRD_FDDI:
iface->if_hwaddr_len = 48;
iface->if_prefix_len = 64;
break;
#endif /* ARPHDR_FDDI */
#ifdef ARPHRD_ARCNET
case ARPHRD_ARCNET:
iface->if_hwaddr_len = 8;
iface->if_prefix_len = -1;
iface->if_maxmtu = -1;
break;
#endif /* ARPHDR_ARCNET */
default:
iface->if_hwaddr_len = -1;
iface->if_prefix_len = -1;
iface->if_maxmtu = -1;
break;
}
dlog(LOG_DEBUG, 3, "link layer token length for %s is %d", iface->Name,
iface->if_hwaddr_len);
dlog(LOG_DEBUG, 3, "prefix length for %s is %d", iface->Name,
iface->if_prefix_len);
if (iface->if_hwaddr_len != -1) {
unsigned int if_hwaddr_len_bytes = (iface->if_hwaddr_len + 7) >> 3;
if (if_hwaddr_len_bytes > sizeof(iface->if_hwaddr)) {
flog(LOG_ERR, "address length %d too big for %s", if_hwaddr_len_bytes, iface->Name);
return(-2);
}
memcpy(iface->if_hwaddr, ifr.ifr_hwaddr.sa_data, if_hwaddr_len_bytes);
memset(zero, 0, sizeof(zero));
if (!memcmp(iface->if_hwaddr, zero, if_hwaddr_len_bytes))
flog(LOG_WARNING, "WARNING, MAC address on %s is all zero!",
iface->Name);
}
prefix = iface->AdvPrefixList;
while (prefix)
{
if ((iface->if_prefix_len != -1) &&
(iface->if_prefix_len != prefix->PrefixLen))
{
flog(LOG_WARNING, "prefix length should be %d for %s",
iface->if_prefix_len, iface->Name);
}
prefix = prefix->next;
}
return (0);
}
| 8,326 |
56,272 | 0 | SAPI_API char *sapi_get_default_content_type(TSRMLS_D)
{
uint len;
return get_default_content_type(0, &len TSRMLS_CC);
}
| 8,327 |
153,212 | 0 | base::OnceClosure DesktopWindowTreeHostX11::DisableEventListening() {
modal_dialog_counter_++;
if (modal_dialog_counter_ == 1) {
targeter_for_modal_ = std::make_unique<aura::ScopedWindowTargeter>(
window(), std::make_unique<aura::NullWindowTargeter>());
}
return base::BindOnce(&DesktopWindowTreeHostX11::EnableEventListening,
weak_factory_.GetWeakPtr());
}
| 8,328 |
35,923 | 0 | static void unreg_event_syscall_exit(struct ftrace_event_file *file,
struct ftrace_event_call *call)
{
struct trace_array *tr = file->tr;
int num;
num = ((struct syscall_metadata *)call->data)->syscall_nr;
if (WARN_ON_ONCE(num < 0 || num >= NR_syscalls))
return;
mutex_lock(&syscall_trace_lock);
tr->sys_refcount_exit--;
RCU_INIT_POINTER(tr->exit_syscall_files[num], NULL);
if (!tr->sys_refcount_exit)
unregister_trace_sys_exit(ftrace_syscall_exit, tr);
mutex_unlock(&syscall_trace_lock);
}
| 8,329 |
88,674 | 0 | void dwc3_gadget_process_pending_events(struct dwc3 *dwc)
{
if (dwc->pending_events) {
dwc3_interrupt(dwc->irq_gadget, dwc->ev_buf);
dwc->pending_events = false;
enable_irq(dwc->irq_gadget);
}
}
| 8,330 |
91,940 | 0 | static inline struct usb_request *midi_alloc_ep_req(struct usb_ep *ep,
unsigned length)
{
return alloc_ep_req(ep, length);
}
| 8,331 |
127,276 | 0 | void PageSerializer::serializeCSSStyleSheet(CSSStyleSheet* styleSheet, const KURL& url)
{
StringBuilder cssText;
for (unsigned i = 0; i < styleSheet->length(); ++i) {
CSSRule* rule = styleSheet->item(i);
String itemText = rule->cssText();
if (!itemText.isEmpty()) {
cssText.append(itemText);
if (i < styleSheet->length() - 1)
cssText.append("\n\n");
}
Document* document = styleSheet->ownerDocument();
if (rule->type() == CSSRule::IMPORT_RULE) {
CSSImportRule* importRule = toCSSImportRule(rule);
KURL importURL = document->completeURL(importRule->href());
if (m_resourceURLs.contains(importURL))
continue;
serializeCSSStyleSheet(importRule->styleSheet(), importURL);
} else if (rule->type() == CSSRule::FONT_FACE_RULE) {
retrieveResourcesForProperties(toCSSFontFaceRule(rule)->styleRule()->properties(), document);
} else if (rule->type() == CSSRule::STYLE_RULE) {
retrieveResourcesForProperties(toCSSStyleRule(rule)->styleRule()->properties(), document);
}
}
if (url.isValid() && !m_resourceURLs.contains(url)) {
WTF::TextEncoding textEncoding(styleSheet->contents()->charset());
ASSERT(textEncoding.isValid());
String textString = cssText.toString();
CString text = textEncoding.normalizeAndEncode(textString, WTF::EntitiesForUnencodables);
m_resources->append(SerializedResource(url, String("text/css"), SharedBuffer::create(text.data(), text.length())));
m_resourceURLs.add(url);
}
}
| 8,332 |
118,365 | 0 | void CardUnmaskPromptViews::InitIfNecessary() {
if (has_children())
return;
main_contents_ = new views::View();
main_contents_->SetLayoutManager(
new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 10));
AddChildView(main_contents_);
permanent_error_label_ = new views::Label();
permanent_error_label_->set_background(
views::Background::CreateSolidBackground(
SkColorSetRGB(0xdb, 0x44, 0x37)));
permanent_error_label_->SetBorder(
views::Border::CreateEmptyBorder(10, kEdgePadding, 10, kEdgePadding));
permanent_error_label_->SetEnabledColor(SK_ColorWHITE);
permanent_error_label_->SetAutoColorReadabilityEnabled(false);
permanent_error_label_->SetVisible(false);
permanent_error_label_->SetMultiLine(true);
permanent_error_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
main_contents_->AddChildView(permanent_error_label_);
views::View* controls_container = new views::View();
controls_container->SetLayoutManager(
new views::BoxLayout(views::BoxLayout::kVertical, kEdgePadding, 0, 0));
main_contents_->AddChildView(controls_container);
views::Label* instructions =
new views::Label(controller_->GetInstructionsMessage());
instructions->SetMultiLine(true);
instructions->SetHorizontalAlignment(gfx::ALIGN_LEFT);
instructions->SetBorder(views::Border::CreateEmptyBorder(0, 0, 15, 0));
controls_container->AddChildView(instructions);
input_row_ = new views::View();
input_row_->SetLayoutManager(
new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 5));
controls_container->AddChildView(input_row_);
if (controller_->ShouldRequestExpirationDate()) {
month_input_ = new views::Combobox(&month_combobox_model_);
month_input_->set_listener(this);
input_row_->AddChildView(month_input_);
input_row_->AddChildView(new views::Label(l10n_util::GetStringUTF16(
IDS_AUTOFILL_CARD_UNMASK_EXPIRATION_DATE_SEPARATOR)));
year_input_ = new views::Combobox(&year_combobox_model_);
year_input_->set_listener(this);
input_row_->AddChildView(year_input_);
input_row_->AddChildView(new views::Label(base::ASCIIToUTF16(" ")));
}
cvc_input_ = new DecoratedTextfield(
base::string16(),
l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_PLACEHOLDER_CVC), this);
cvc_input_->set_default_width_in_chars(8);
input_row_->AddChildView(cvc_input_);
views::ImageView* cvc_image = new views::ImageView();
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
cvc_image->SetImage(rb.GetImageSkiaNamed(controller_->GetCvcImageRid()));
input_row_->AddChildView(cvc_image);
error_label_ = new views::Label(base::ASCIIToUTF16(" "));
error_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
error_label_->SetEnabledColor(kWarningColor);
error_label_->SetBorder(views::Border::CreateEmptyBorder(3, 0, 5, 0));
controls_container->AddChildView(error_label_);
progress_overlay_ = new FadeOutView();
progress_overlay_->set_fade_everything(true);
views::BoxLayout* progress_layout =
new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 5);
progress_layout->set_cross_axis_alignment(
views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER);
progress_layout->set_main_axis_alignment(
views::BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER);
progress_overlay_->SetLayoutManager(progress_layout);
progress_overlay_->SetVisible(false);
AddChildView(progress_overlay_);
progress_throbber_ = new views::CheckmarkThrobber();
progress_overlay_->AddChildView(progress_throbber_);
progress_label_ = new views::Label(l10n_util::GetStringUTF16(
IDS_AUTOFILL_CARD_UNMASK_VERIFICATION_IN_PROGRESS));
progress_label_->SetEnabledColor(SkColorSetRGB(0x42, 0x85, 0xF4));
progress_overlay_->AddChildView(progress_label_);
}
| 8,333 |
43,910 | 0 | edit_deep_directories(struct archive_write_disk *a)
{
int ret;
char *tail = a->name;
/* If path is short, avoid the open() below. */
if (strlen(tail) <= PATH_MAX)
return;
/* Try to record our starting dir. */
a->restore_pwd = open(".", O_RDONLY | O_BINARY | O_CLOEXEC);
__archive_ensure_cloexec_flag(a->restore_pwd);
if (a->restore_pwd < 0)
return;
/* As long as the path is too long... */
while (strlen(tail) > PATH_MAX) {
/* Locate a dir prefix shorter than PATH_MAX. */
tail += PATH_MAX - 8;
while (tail > a->name && *tail != '/')
tail--;
/* Exit if we find a too-long path component. */
if (tail <= a->name)
return;
/* Create the intermediate dir and chdir to it. */
*tail = '\0'; /* Terminate dir portion */
ret = create_dir(a, a->name);
if (ret == ARCHIVE_OK && chdir(a->name) != 0)
ret = ARCHIVE_FAILED;
*tail = '/'; /* Restore the / we removed. */
if (ret != ARCHIVE_OK)
return;
tail++;
/* The chdir() succeeded; we've now shortened the path. */
a->name = tail;
}
return;
}
| 8,334 |
46,034 | 0 | svcauth_gss_set_svc_name(gss_name_t name)
{
OM_uint32 maj_stat, min_stat;
log_debug("in svcauth_gss_set_svc_name()");
if (svcauth_gss_name != NULL) {
maj_stat = gss_release_name(&min_stat, &svcauth_gss_name);
if (maj_stat != GSS_S_COMPLETE) {
log_status("gss_release_name", maj_stat, min_stat);
return (FALSE);
}
svcauth_gss_name = NULL;
}
if (svcauth_gss_name == GSS_C_NO_NAME)
return (TRUE);
maj_stat = gss_duplicate_name(&min_stat, name, &svcauth_gss_name);
if (maj_stat != GSS_S_COMPLETE) {
log_status("gss_duplicate_name", maj_stat, min_stat);
return (FALSE);
}
return (TRUE);
}
| 8,335 |
6,120 | 0 | static int server_finish(SSL *s)
{
unsigned char *p;
if (s->state == SSL2_ST_SEND_SERVER_FINISHED_A) {
p = (unsigned char *)s->init_buf->data;
*(p++) = SSL2_MT_SERVER_FINISHED;
if (s->session->session_id_length > sizeof s->session->session_id) {
SSLerr(SSL_F_SERVER_FINISH, ERR_R_INTERNAL_ERROR);
return -1;
}
memcpy(p, s->session->session_id,
(unsigned int)s->session->session_id_length);
/* p+=s->session->session_id_length; */
s->state = SSL2_ST_SEND_SERVER_FINISHED_B;
s->init_num = s->session->session_id_length + 1;
s->init_off = 0;
}
/* SSL2_ST_SEND_SERVER_FINISHED_B */
return (ssl2_do_write(s));
}
| 8,336 |
152,797 | 0 | String DumpFragmentTree(Element* element) {
auto fragment = RunBlockLayoutAlgorithm(element);
return DumpFragmentTree(fragment.get());
}
| 8,337 |
88,731 | 0 | int modbus_get_response_timeout(modbus_t *ctx, uint32_t *to_sec, uint32_t *to_usec)
{
if (ctx == NULL) {
errno = EINVAL;
return -1;
}
*to_sec = ctx->response_timeout.tv_sec;
*to_usec = ctx->response_timeout.tv_usec;
return 0;
}
| 8,338 |
82,650 | 0 | get_compat_sigset(sigset_t *set, const compat_sigset_t __user *compat)
{
#ifdef __BIG_ENDIAN
compat_sigset_t v;
if (copy_from_user(&v, compat, sizeof(compat_sigset_t)))
return -EFAULT;
switch (_NSIG_WORDS) {
case 4: set->sig[3] = v.sig[6] | (((long)v.sig[7]) << 32 );
case 3: set->sig[2] = v.sig[4] | (((long)v.sig[5]) << 32 );
case 2: set->sig[1] = v.sig[2] | (((long)v.sig[3]) << 32 );
case 1: set->sig[0] = v.sig[0] | (((long)v.sig[1]) << 32 );
}
#else
if (copy_from_user(set, compat, sizeof(compat_sigset_t)))
return -EFAULT;
#endif
return 0;
}
| 8,339 |
7,669 | 0 | static int handle_fsync(FsContext *ctx, int fid_type,
V9fsFidOpenState *fs, int datasync)
{
int fd;
if (fid_type == P9_FID_DIR) {
fd = dirfd(fs->dir.stream);
} else {
fd = fs->fd;
}
if (datasync) {
return qemu_fdatasync(fd);
} else {
return fsync(fd);
}
}
| 8,340 |
41,177 | 0 | static void tcp_mtup_probe_success(struct sock *sk)
{
struct tcp_sock *tp = tcp_sk(sk);
struct inet_connection_sock *icsk = inet_csk(sk);
/* FIXME: breaks with very large cwnd */
tp->prior_ssthresh = tcp_current_ssthresh(sk);
tp->snd_cwnd = tp->snd_cwnd *
tcp_mss_to_mtu(sk, tp->mss_cache) /
icsk->icsk_mtup.probe_size;
tp->snd_cwnd_cnt = 0;
tp->snd_cwnd_stamp = tcp_time_stamp;
tp->snd_ssthresh = tcp_current_ssthresh(sk);
icsk->icsk_mtup.search_low = icsk->icsk_mtup.probe_size;
icsk->icsk_mtup.probe_size = 0;
tcp_sync_mss(sk, icsk->icsk_pmtu_cookie);
}
| 8,341 |
146,783 | 0 | static inline bool IsValidNamePart(UChar32 c) {
if (IsValidNameStart(c))
return true;
if (c == 0x00B7 || c == 0x0387)
return true;
if (c == '-' || c == '.')
return true;
const uint32_t kOtherNamePartMask =
WTF::Unicode::kMark_NonSpacing | WTF::Unicode::kMark_Enclosing |
WTF::Unicode::kMark_SpacingCombining | WTF::Unicode::kLetter_Modifier |
WTF::Unicode::kNumber_DecimalDigit;
if (!(WTF::Unicode::Category(c) & kOtherNamePartMask))
return false;
if (c >= 0xF900 && c < 0xFFFE)
return false;
WTF::Unicode::CharDecompositionType decomp_type =
WTF::Unicode::DecompositionType(c);
if (decomp_type == WTF::Unicode::kDecompositionFont ||
decomp_type == WTF::Unicode::kDecompositionCompat)
return false;
return true;
}
| 8,342 |
87,390 | 0 | static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp)
{
enum bp_state state = BP_DONE;
unsigned long i;
struct page *page, *tmp;
int ret;
LIST_HEAD(pages);
if (nr_pages > ARRAY_SIZE(frame_list))
nr_pages = ARRAY_SIZE(frame_list);
for (i = 0; i < nr_pages; i++) {
page = alloc_page(gfp);
if (page == NULL) {
nr_pages = i;
state = BP_EAGAIN;
break;
}
__SetPageOffline(page);
adjust_managed_page_count(page, -1);
xenmem_reservation_scrub_page(page);
list_add(&page->lru, &pages);
}
/*
* Ensure that ballooned highmem pages don't have kmaps.
*
* Do this before changing the p2m as kmap_flush_unused()
* reads PTEs to obtain pages (and hence needs the original
* p2m entry).
*/
kmap_flush_unused();
/*
* Setup the frame, update direct mapping, invalidate P2M,
* and add to balloon.
*/
i = 0;
list_for_each_entry_safe(page, tmp, &pages, lru) {
frame_list[i++] = xen_page_to_gfn(page);
xenmem_reservation_va_mapping_reset(1, &page);
list_del(&page->lru);
balloon_append(page);
}
flush_tlb_all();
ret = xenmem_reservation_decrease(nr_pages, frame_list);
BUG_ON(ret != nr_pages);
balloon_stats.current_pages -= nr_pages;
return state;
}
| 8,343 |
107,723 | 0 | NavigationState::NavigationState(
const CommonNavigationParams& common_params,
const CommitNavigationParams& commit_params,
base::TimeTicks time_commit_requested,
bool is_content_initiated,
mojom::FrameNavigationControl::CommitNavigationCallback callback,
mojom::NavigationClient::CommitNavigationCallback
per_navigation_mojo_interface_commit_callback,
std::unique_ptr<NavigationClient> navigation_client,
bool was_initiated_in_this_frame)
: request_committed_(false),
was_within_same_document_(false),
was_initiated_in_this_frame_(was_initiated_in_this_frame),
is_content_initiated_(is_content_initiated),
common_params_(common_params),
commit_params_(commit_params),
time_commit_requested_(time_commit_requested),
navigation_client_(std::move(navigation_client)),
commit_callback_(std::move(callback)),
per_navigation_mojo_interface_commit_callback_(
std::move(per_navigation_mojo_interface_commit_callback)) {}
| 8,344 |
68,857 | 0 | static void check_spinlock_acquired(struct kmem_cache *cachep)
{
#ifdef CONFIG_SMP
check_irq_off();
assert_spin_locked(&get_node(cachep, numa_mem_id())->list_lock);
#endif
}
| 8,345 |
43,224 | 0 | static void eexec_start(char *string)
{
eexec_string("currentfile eexec\n");
if (pfb && w.blocktyp != PFB_BINARY) {
pfb_writer_output_block(&w);
w.blocktyp = PFB_BINARY;
}
in_eexec = 1;
er = 55665;
eexec_byte(0);
eexec_byte(0);
eexec_byte(0);
eexec_byte(0);
eexec_string(string);
}
| 8,346 |
66,557 | 0 | static int pegasus_suspend(struct usb_interface *intf, pm_message_t message)
{
struct pegasus *pegasus = usb_get_intfdata(intf);
netif_device_detach(pegasus->net);
cancel_delayed_work(&pegasus->carrier_check);
if (netif_running(pegasus->net)) {
usb_kill_urb(pegasus->rx_urb);
usb_kill_urb(pegasus->intr_urb);
}
return 0;
}
| 8,347 |
100,996 | 0 | void QuotaManager::DeleteOriginFromDatabase(
const GURL& origin, StorageType type) {
LazyInitialize();
if (db_disabled_)
return;
scoped_refptr<DeleteOriginInfo> task =
new DeleteOriginInfo(this, origin, type);
task->Start();
}
| 8,348 |
156,828 | 0 | void Document::SetShadowCascadeOrder(ShadowCascadeOrder order) {
DCHECK_NE(order, ShadowCascadeOrder::kShadowCascadeNone);
if (order == shadow_cascade_order_)
return;
if (order == ShadowCascadeOrder::kShadowCascadeV0) {
may_contain_v0_shadow_ = true;
if (shadow_cascade_order_ == ShadowCascadeOrder::kShadowCascadeV1) {
style_engine_->V0ShadowAddedOnV1Document();
UseCounter::Count(*this, WebFeature::kMixedShadowRootV0AndV1);
}
}
if (shadow_cascade_order_ == ShadowCascadeOrder::kShadowCascadeV0 &&
order == ShadowCascadeOrder::kShadowCascadeV1) {
SetNeedsStyleRecalc(
kSubtreeStyleChange,
StyleChangeReasonForTracing::Create(StyleChangeReason::kShadow));
UseCounter::Count(*this, WebFeature::kMixedShadowRootV0AndV1);
}
if (order > shadow_cascade_order_)
shadow_cascade_order_ = order;
}
| 8,349 |
178,922 | 1 | static int sgi_clock_set(clockid_t clockid, struct timespec *tp)
{
u64 nsec;
u64 rem;
nsec = rtc_time() * sgi_clock_period;
sgi_clock_offset.tv_sec = tp->tv_sec - div_long_long_rem(nsec, NSEC_PER_SEC, &rem);
if (rem <= tp->tv_nsec)
sgi_clock_offset.tv_nsec = tp->tv_sec - rem;
else {
sgi_clock_offset.tv_nsec = tp->tv_sec + NSEC_PER_SEC - rem;
sgi_clock_offset.tv_sec--;
}
return 0;
}
| 8,350 |
21,753 | 0 | static int em_in(struct x86_emulate_ctxt *ctxt)
{
if (!pio_in_emulated(ctxt, ctxt->dst.bytes, ctxt->src.val,
&ctxt->dst.val))
return X86EMUL_IO_NEEDED;
return X86EMUL_CONTINUE;
}
| 8,351 |
5,379 | 0 | static void Ins_EQ( INS_ARG )
{ (void)exc;
if ( args[0] == args[1] )
args[0] = 1;
else
args[0] = 0;
}
| 8,352 |
49,873 | 0 | static void spl_array_unset_dimension_ex(int check_inherited, zval *object, zval *offset TSRMLS_DC) /* {{{ */
{
spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
long index;
HashTable *ht;
if (check_inherited && intern->fptr_offset_del) {
SEPARATE_ARG_IF_REF(offset);
zend_call_method_with_1_params(&object, Z_OBJCE_P(object), &intern->fptr_offset_del, "offsetUnset", NULL, offset);
zval_ptr_dtor(&offset);
return;
}
switch(Z_TYPE_P(offset)) {
case IS_STRING:
ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
if (ht->nApplyCount > 0) {
zend_error(E_WARNING, "Modification of ArrayObject during sorting is prohibited");
return;
}
if (ht == &EG(symbol_table)) {
if (zend_delete_global_variable(Z_STRVAL_P(offset), Z_STRLEN_P(offset) TSRMLS_CC)) {
zend_error(E_NOTICE,"Undefined index: %s", Z_STRVAL_P(offset));
}
} else {
if (zend_symtable_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1) == FAILURE) {
zend_error(E_NOTICE,"Undefined index: %s", Z_STRVAL_P(offset));
} else {
spl_array_object *obj = intern;
while (1) {
if ((obj->ar_flags & SPL_ARRAY_IS_SELF) != 0) {
break;
} else if (Z_TYPE_P(obj->array) == IS_OBJECT) {
if ((obj->ar_flags & SPL_ARRAY_USE_OTHER) == 0) {
obj = (spl_array_object*)zend_object_store_get_object(obj->array TSRMLS_CC);
break;
} else {
obj = (spl_array_object*)zend_object_store_get_object(obj->array TSRMLS_CC);
}
} else {
obj = NULL;
break;
}
}
if (obj) {
zend_property_info *property_info = zend_get_property_info(obj->std.ce, offset, 1 TSRMLS_CC);
if (property_info &&
(property_info->flags & ZEND_ACC_STATIC) == 0 &&
property_info->offset >= 0) {
obj->std.properties_table[property_info->offset] = NULL;
}
}
}
}
break;
case IS_DOUBLE:
case IS_RESOURCE:
case IS_BOOL:
case IS_LONG:
if (offset->type == IS_DOUBLE) {
index = (long)Z_DVAL_P(offset);
} else {
index = Z_LVAL_P(offset);
}
ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
if (ht->nApplyCount > 0) {
zend_error(E_WARNING, "Modification of ArrayObject during sorting is prohibited");
return;
}
if (zend_hash_index_del(ht, index) == FAILURE) {
zend_error(E_NOTICE,"Undefined offset: %ld", Z_LVAL_P(offset));
}
break;
default:
zend_error(E_WARNING, "Illegal offset type");
return;
}
spl_hash_verify_pos(intern TSRMLS_CC); /* call rewind on FAILURE */
} /* }}} */
| 8,353 |
90,493 | 0 | static int pagemap_pmd_range(pmd_t *pmdp, unsigned long addr, unsigned long end,
struct mm_walk *walk)
{
struct vm_area_struct *vma = walk->vma;
struct pagemapread *pm = walk->private;
spinlock_t *ptl;
pte_t *pte, *orig_pte;
int err = 0;
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
ptl = pmd_trans_huge_lock(pmdp, vma);
if (ptl) {
u64 flags = 0, frame = 0;
pmd_t pmd = *pmdp;
struct page *page = NULL;
if (vma->vm_flags & VM_SOFTDIRTY)
flags |= PM_SOFT_DIRTY;
if (pmd_present(pmd)) {
page = pmd_page(pmd);
flags |= PM_PRESENT;
if (pmd_soft_dirty(pmd))
flags |= PM_SOFT_DIRTY;
if (pm->show_pfn)
frame = pmd_pfn(pmd) +
((addr & ~PMD_MASK) >> PAGE_SHIFT);
}
#ifdef CONFIG_ARCH_ENABLE_THP_MIGRATION
else if (is_swap_pmd(pmd)) {
swp_entry_t entry = pmd_to_swp_entry(pmd);
unsigned long offset;
if (pm->show_pfn) {
offset = swp_offset(entry) +
((addr & ~PMD_MASK) >> PAGE_SHIFT);
frame = swp_type(entry) |
(offset << MAX_SWAPFILES_SHIFT);
}
flags |= PM_SWAP;
if (pmd_swp_soft_dirty(pmd))
flags |= PM_SOFT_DIRTY;
VM_BUG_ON(!is_pmd_migration_entry(pmd));
page = migration_entry_to_page(entry);
}
#endif
if (page && page_mapcount(page) == 1)
flags |= PM_MMAP_EXCLUSIVE;
for (; addr != end; addr += PAGE_SIZE) {
pagemap_entry_t pme = make_pme(frame, flags);
err = add_to_pagemap(addr, &pme, pm);
if (err)
break;
if (pm->show_pfn) {
if (flags & PM_PRESENT)
frame++;
else if (flags & PM_SWAP)
frame += (1 << MAX_SWAPFILES_SHIFT);
}
}
spin_unlock(ptl);
return err;
}
if (pmd_trans_unstable(pmdp))
return 0;
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
/*
* We can assume that @vma always points to a valid one and @end never
* goes beyond vma->vm_end.
*/
orig_pte = pte = pte_offset_map_lock(walk->mm, pmdp, addr, &ptl);
for (; addr < end; pte++, addr += PAGE_SIZE) {
pagemap_entry_t pme;
pme = pte_to_pagemap_entry(pm, vma, addr, *pte);
err = add_to_pagemap(addr, &pme, pm);
if (err)
break;
}
pte_unmap_unlock(orig_pte, ptl);
cond_resched();
return err;
}
| 8,354 |
120,420 | 0 | void Reset() {
loop_runner_ = new content::MessageLoopRunner();
}
| 8,355 |
14,772 | 0 | static void _close_pgsql_plink(zend_rsrc_list_entry *rsrc TSRMLS_DC)
{
PGconn *link = (PGconn *)rsrc->ptr;
PGresult *res;
while ((res = PQgetResult(link))) {
PQclear(res);
}
PQfinish(link);
PGG(num_persistent)--;
PGG(num_links)--;
}
| 8,356 |
79,037 | 0 | static void put_amf_bool(AVIOContext *pb, int b)
{
avio_w8(pb, AMF_DATA_TYPE_BOOL);
avio_w8(pb, !!b);
}
| 8,357 |
81,353 | 0 | static int show_traces_open(struct inode *inode, struct file *file)
{
struct trace_array *tr = inode->i_private;
struct seq_file *m;
int ret;
if (tracing_disabled)
return -ENODEV;
ret = seq_open(file, &show_traces_seq_ops);
if (ret)
return ret;
m = file->private_data;
m->private = tr;
return 0;
}
| 8,358 |
133,683 | 0 | const std::map<string, string>& decoded_block() const {
return decoder_peer_.decoded_block();
}
| 8,359 |
24,394 | 0 | void jbd2_journal_unlock_updates (journal_t *journal)
{
J_ASSERT(journal->j_barrier_count != 0);
mutex_unlock(&journal->j_barrier);
write_lock(&journal->j_state_lock);
--journal->j_barrier_count;
write_unlock(&journal->j_state_lock);
wake_up(&journal->j_wait_transaction_locked);
}
| 8,360 |
68,332 | 0 | list_update_cgroup_event(struct perf_event *event,
struct perf_event_context *ctx, bool add)
{
struct perf_cpu_context *cpuctx;
if (!is_cgroup_event(event))
return;
if (add && ctx->nr_cgroups++)
return;
else if (!add && --ctx->nr_cgroups)
return;
/*
* Because cgroup events are always per-cpu events,
* this will always be called from the right CPU.
*/
cpuctx = __get_cpu_context(ctx);
/*
* cpuctx->cgrp is NULL until a cgroup event is sched in or
* ctx->nr_cgroup == 0 .
*/
if (add && perf_cgroup_from_task(current, ctx) == event->cgrp)
cpuctx->cgrp = event->cgrp;
else if (!add)
cpuctx->cgrp = NULL;
}
| 8,361 |
11,194 | 0 | static void pharobj_set_compression(HashTable *manifest, php_uint32 compress) /* {{{ */
{
zend_hash_apply_with_argument(manifest, phar_set_compression, &compress);
}
/* }}} */
| 8,362 |
95,588 | 0 | void QDECL Com_DPrintf( const char *fmt, ... ) {
va_list argptr;
char msg[MAXPRINTMSG];
if ( !com_developer || !com_developer->integer ) {
return; // don't confuse non-developers with techie stuff...
}
va_start( argptr,fmt );
Q_vsnprintf( msg, sizeof( msg ), fmt, argptr );
va_end( argptr );
Com_Printf( "%s", msg );
}
| 8,363 |
48,090 | 0 | static inline int u64_shl_div_u64(u64 a, unsigned int shift,
u64 divisor, u64 *result)
{
u64 low = a << shift, high = a >> (64 - shift);
/* To avoid the overflow on divq */
if (high >= divisor)
return 1;
/* Low hold the result, high hold rem which is discarded */
asm("divq %2\n\t" : "=a" (low), "=d" (high) :
"rm" (divisor), "0" (low), "1" (high));
*result = low;
return 0;
}
| 8,364 |
147,540 | 0 | static void MeasureAsOverloadedMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) {
scheduler::CooperativeSchedulingManager::Instance()->Safepoint();
bool is_arity_error = false;
switch (std::min(1, info.Length())) {
case 0:
if (true) {
ExecutionContext* execution_context_for_measurement = CurrentExecutionContext(info.GetIsolate());
UseCounter::Count(execution_context_for_measurement, WebFeature::kTestFeatureA);
MeasureAsOverloadedMethod1Method(info);
return;
}
break;
case 1:
if (true) {
ExecutionContext* execution_context_for_measurement = CurrentExecutionContext(info.GetIsolate());
UseCounter::Count(execution_context_for_measurement, WebFeature::kTestFeatureB);
MeasureAsOverloadedMethod2Method(info);
return;
}
break;
default:
is_arity_error = true;
}
ExceptionState exception_state(info.GetIsolate(), ExceptionState::kExecutionContext, "TestObject", "measureAsOverloadedMethod");
if (is_arity_error) {
}
exception_state.ThrowTypeError("No function was found that matched the signature provided.");
}
| 8,365 |
20,702 | 0 | static int handle_emulation_failure(struct kvm_vcpu *vcpu)
{
int r = EMULATE_DONE;
++vcpu->stat.insn_emulation_fail;
trace_kvm_emulate_insn_failed(vcpu);
if (!is_guest_mode(vcpu)) {
vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_EMULATION;
vcpu->run->internal.ndata = 0;
r = EMULATE_FAIL;
}
kvm_queue_exception(vcpu, UD_VECTOR);
return r;
}
| 8,366 |
15,998 | 0 | static bool _xmp_error_callback(void* context, XMP_ErrorSeverity severity,
XMP_Int32 cause, XMP_StringPtr message)
{
return false;
}
| 8,367 |
92,543 | 0 | enqueue_runnable_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *se) { }
| 8,368 |
111,719 | 0 | bool EditorClientBlackBerry::shouldMoveRangeAfterDelete(Range*, Range*)
{
notImplemented();
return true;
}
| 8,369 |
151,725 | 0 | bool Browser::RequestPpapiBrokerPermission(
WebContents* web_contents,
const GURL& url,
const base::FilePath& plugin_path,
const base::Callback<void(bool)>& callback) {
PepperBrokerInfoBarDelegate::Create(web_contents, url, plugin_path, callback);
return true;
}
| 8,370 |
57,035 | 0 | static int _nfs41_test_stateid(struct nfs_server *server,
nfs4_stateid *stateid,
struct rpc_cred *cred)
{
int status;
struct nfs41_test_stateid_args args = {
.stateid = stateid,
};
struct nfs41_test_stateid_res res;
struct rpc_message msg = {
.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_TEST_STATEID],
.rpc_argp = &args,
.rpc_resp = &res,
.rpc_cred = cred,
};
struct rpc_clnt *rpc_client = server->client;
nfs4_state_protect(server->nfs_client, NFS_SP4_MACH_CRED_STATEID,
&rpc_client, &msg);
dprintk("NFS call test_stateid %p\n", stateid);
nfs4_init_sequence(&args.seq_args, &res.seq_res, 0);
nfs4_set_sequence_privileged(&args.seq_args);
status = nfs4_call_sync_sequence(rpc_client, server, &msg,
&args.seq_args, &res.seq_res);
if (status != NFS_OK) {
dprintk("NFS reply test_stateid: failed, %d\n", status);
return status;
}
dprintk("NFS reply test_stateid: succeeded, %d\n", -res.status);
return -res.status;
}
| 8,371 |
122,668 | 0 | bool Extension::LoadAppFeatures(string16* error) {
if (!LoadExtent(keys::kWebURLs, &extent_,
errors::kInvalidWebURLs, errors::kInvalidWebURL, error) ||
!LoadLaunchURL(error) ||
!LoadLaunchContainer(error)) {
return false;
}
if (manifest_->HasKey(keys::kDisplayInLauncher) &&
!manifest_->GetBoolean(keys::kDisplayInLauncher, &display_in_launcher_)) {
*error = ASCIIToUTF16(errors::kInvalidDisplayInLauncher);
return false;
}
if (manifest_->HasKey(keys::kDisplayInNewTabPage)) {
if (!manifest_->GetBoolean(keys::kDisplayInNewTabPage,
&display_in_new_tab_page_)) {
*error = ASCIIToUTF16(errors::kInvalidDisplayInNewTabPage);
return false;
}
} else {
display_in_new_tab_page_ = display_in_launcher_;
}
return true;
}
| 8,372 |
59,205 | 0 | struct sock *__raw_v4_lookup(struct net *net, struct sock *sk,
unsigned short num, __be32 raddr, __be32 laddr,
int dif, int sdif)
{
sk_for_each_from(sk) {
struct inet_sock *inet = inet_sk(sk);
if (net_eq(sock_net(sk), net) && inet->inet_num == num &&
!(inet->inet_daddr && inet->inet_daddr != raddr) &&
!(inet->inet_rcv_saddr && inet->inet_rcv_saddr != laddr) &&
!(sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif &&
sk->sk_bound_dev_if != sdif))
goto found; /* gotcha */
}
sk = NULL;
found:
return sk;
}
| 8,373 |
48,706 | 0 | int h2_stream_is_ready(h2_stream *stream)
{
if (stream->has_response) {
return 1;
}
else if (stream->out_buffer && get_first_headers_bucket(stream->out_buffer)) {
return 1;
}
return 0;
}
| 8,374 |
166,525 | 0 | void AppendContentBrowserClientSwitches() {
client_.AppendExtraCommandLineSwitches(&command_line_, kFakeChildProcessId);
}
| 8,375 |
113,038 | 0 | const FilePath& DownloadItemImpl::GetFullPath() const {
return current_path_;
}
| 8,376 |
40,704 | 0 | static int sock_map_fd(struct socket *sock, int flags)
{
struct file *newfile;
int fd = get_unused_fd_flags(flags);
if (unlikely(fd < 0))
return fd;
newfile = sock_alloc_file(sock, flags, NULL);
if (likely(!IS_ERR(newfile))) {
fd_install(fd, newfile);
return fd;
}
put_unused_fd(fd);
return PTR_ERR(newfile);
}
| 8,377 |
176,638 | 0 | xmlParseEntityDecl(xmlParserCtxtPtr ctxt) {
const xmlChar *name = NULL;
xmlChar *value = NULL;
xmlChar *URI = NULL, *literal = NULL;
const xmlChar *ndata = NULL;
int isParameter = 0;
xmlChar *orig = NULL;
int skipped;
/* GROW; done in the caller */
if (CMP8(CUR_PTR, '<', '!', 'E', 'N', 'T', 'I', 'T', 'Y')) {
xmlParserInputPtr input = ctxt->input;
SHRINK;
SKIP(8);
skipped = SKIP_BLANKS;
if (skipped == 0) {
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
"Space required after '<!ENTITY'\n");
}
if (RAW == '%') {
NEXT;
skipped = SKIP_BLANKS;
if (skipped == 0) {
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
"Space required after '%%'\n");
}
isParameter = 1;
}
name = xmlParseName(ctxt);
if (name == NULL) {
xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED,
"xmlParseEntityDecl: no name\n");
return;
}
if (xmlStrchr(name, ':') != NULL) {
xmlNsErr(ctxt, XML_NS_ERR_COLON,
"colons are forbidden from entities names '%s'\n",
name, NULL, NULL);
}
skipped = SKIP_BLANKS;
if (skipped == 0) {
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
"Space required after the entity name\n");
}
ctxt->instate = XML_PARSER_ENTITY_DECL;
/*
* handle the various case of definitions...
*/
if (isParameter) {
if ((RAW == '"') || (RAW == '\'')) {
value = xmlParseEntityValue(ctxt, &orig);
if (value) {
if ((ctxt->sax != NULL) &&
(!ctxt->disableSAX) && (ctxt->sax->entityDecl != NULL))
ctxt->sax->entityDecl(ctxt->userData, name,
XML_INTERNAL_PARAMETER_ENTITY,
NULL, NULL, value);
}
} else {
URI = xmlParseExternalID(ctxt, &literal, 1);
if ((URI == NULL) && (literal == NULL)) {
xmlFatalErr(ctxt, XML_ERR_VALUE_REQUIRED, NULL);
}
if (URI) {
xmlURIPtr uri;
uri = xmlParseURI((const char *) URI);
if (uri == NULL) {
xmlErrMsgStr(ctxt, XML_ERR_INVALID_URI,
"Invalid URI: %s\n", URI);
/*
* This really ought to be a well formedness error
* but the XML Core WG decided otherwise c.f. issue
* E26 of the XML erratas.
*/
} else {
if (uri->fragment != NULL) {
/*
* Okay this is foolish to block those but not
* invalid URIs.
*/
xmlFatalErr(ctxt, XML_ERR_URI_FRAGMENT, NULL);
} else {
if ((ctxt->sax != NULL) &&
(!ctxt->disableSAX) &&
(ctxt->sax->entityDecl != NULL))
ctxt->sax->entityDecl(ctxt->userData, name,
XML_EXTERNAL_PARAMETER_ENTITY,
literal, URI, NULL);
}
xmlFreeURI(uri);
}
}
}
} else {
if ((RAW == '"') || (RAW == '\'')) {
value = xmlParseEntityValue(ctxt, &orig);
if ((ctxt->sax != NULL) &&
(!ctxt->disableSAX) && (ctxt->sax->entityDecl != NULL))
ctxt->sax->entityDecl(ctxt->userData, name,
XML_INTERNAL_GENERAL_ENTITY,
NULL, NULL, value);
/*
* For expat compatibility in SAX mode.
*/
if ((ctxt->myDoc == NULL) ||
(xmlStrEqual(ctxt->myDoc->version, SAX_COMPAT_MODE))) {
if (ctxt->myDoc == NULL) {
ctxt->myDoc = xmlNewDoc(SAX_COMPAT_MODE);
if (ctxt->myDoc == NULL) {
xmlErrMemory(ctxt, "New Doc failed");
return;
}
ctxt->myDoc->properties = XML_DOC_INTERNAL;
}
if (ctxt->myDoc->intSubset == NULL)
ctxt->myDoc->intSubset = xmlNewDtd(ctxt->myDoc,
BAD_CAST "fake", NULL, NULL);
xmlSAX2EntityDecl(ctxt, name, XML_INTERNAL_GENERAL_ENTITY,
NULL, NULL, value);
}
} else {
URI = xmlParseExternalID(ctxt, &literal, 1);
if ((URI == NULL) && (literal == NULL)) {
xmlFatalErr(ctxt, XML_ERR_VALUE_REQUIRED, NULL);
}
if (URI) {
xmlURIPtr uri;
uri = xmlParseURI((const char *)URI);
if (uri == NULL) {
xmlErrMsgStr(ctxt, XML_ERR_INVALID_URI,
"Invalid URI: %s\n", URI);
/*
* This really ought to be a well formedness error
* but the XML Core WG decided otherwise c.f. issue
* E26 of the XML erratas.
*/
} else {
if (uri->fragment != NULL) {
/*
* Okay this is foolish to block those but not
* invalid URIs.
*/
xmlFatalErr(ctxt, XML_ERR_URI_FRAGMENT, NULL);
}
xmlFreeURI(uri);
}
}
if ((RAW != '>') && (!IS_BLANK_CH(CUR))) {
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
"Space required before 'NDATA'\n");
}
SKIP_BLANKS;
if (CMP5(CUR_PTR, 'N', 'D', 'A', 'T', 'A')) {
SKIP(5);
if (!IS_BLANK_CH(CUR)) {
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
"Space required after 'NDATA'\n");
}
SKIP_BLANKS;
ndata = xmlParseName(ctxt);
if ((ctxt->sax != NULL) && (!ctxt->disableSAX) &&
(ctxt->sax->unparsedEntityDecl != NULL))
ctxt->sax->unparsedEntityDecl(ctxt->userData, name,
literal, URI, ndata);
} else {
if ((ctxt->sax != NULL) &&
(!ctxt->disableSAX) && (ctxt->sax->entityDecl != NULL))
ctxt->sax->entityDecl(ctxt->userData, name,
XML_EXTERNAL_GENERAL_PARSED_ENTITY,
literal, URI, NULL);
/*
* For expat compatibility in SAX mode.
* assuming the entity repalcement was asked for
*/
if ((ctxt->replaceEntities != 0) &&
((ctxt->myDoc == NULL) ||
(xmlStrEqual(ctxt->myDoc->version, SAX_COMPAT_MODE)))) {
if (ctxt->myDoc == NULL) {
ctxt->myDoc = xmlNewDoc(SAX_COMPAT_MODE);
if (ctxt->myDoc == NULL) {
xmlErrMemory(ctxt, "New Doc failed");
return;
}
ctxt->myDoc->properties = XML_DOC_INTERNAL;
}
if (ctxt->myDoc->intSubset == NULL)
ctxt->myDoc->intSubset = xmlNewDtd(ctxt->myDoc,
BAD_CAST "fake", NULL, NULL);
xmlSAX2EntityDecl(ctxt, name,
XML_EXTERNAL_GENERAL_PARSED_ENTITY,
literal, URI, NULL);
}
}
}
}
if (ctxt->instate == XML_PARSER_EOF)
return;
SKIP_BLANKS;
if (RAW != '>') {
xmlFatalErrMsgStr(ctxt, XML_ERR_ENTITY_NOT_FINISHED,
"xmlParseEntityDecl: entity %s not terminated\n", name);
xmlHaltParser(ctxt);
} else {
if (input != ctxt->input) {
xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY,
"Entity declaration doesn't start and stop in the same entity\n");
}
NEXT;
}
if (orig != NULL) {
/*
* Ugly mechanism to save the raw entity value.
*/
xmlEntityPtr cur = NULL;
if (isParameter) {
if ((ctxt->sax != NULL) &&
(ctxt->sax->getParameterEntity != NULL))
cur = ctxt->sax->getParameterEntity(ctxt->userData, name);
} else {
if ((ctxt->sax != NULL) &&
(ctxt->sax->getEntity != NULL))
cur = ctxt->sax->getEntity(ctxt->userData, name);
if ((cur == NULL) && (ctxt->userData==ctxt)) {
cur = xmlSAX2GetEntity(ctxt, name);
}
}
if (cur != NULL) {
if (cur->orig != NULL)
xmlFree(orig);
else
cur->orig = orig;
} else
xmlFree(orig);
}
if (value != NULL) xmlFree(value);
if (URI != NULL) xmlFree(URI);
if (literal != NULL) xmlFree(literal);
}
}
| 8,378 |
46,985 | 0 | static int __init init(void)
{
return crypto_register_alg(&alg);
}
| 8,379 |
87,709 | 0 | static void ipip6_tunnel_uninit(struct net_device *dev)
{
struct ip_tunnel *tunnel = netdev_priv(dev);
struct sit_net *sitn = net_generic(tunnel->net, sit_net_id);
if (dev == sitn->fb_tunnel_dev) {
RCU_INIT_POINTER(sitn->tunnels_wc[0], NULL);
} else {
ipip6_tunnel_unlink(sitn, tunnel);
ipip6_tunnel_del_prl(tunnel, NULL);
}
dst_cache_reset(&tunnel->dst_cache);
dev_put(dev);
}
| 8,380 |
85,006 | 0 | translate_compat_table(struct net *net,
struct xt_table_info **pinfo,
void **pentry0,
const struct compat_ipt_replace *compatr)
{
unsigned int i, j;
struct xt_table_info *newinfo, *info;
void *pos, *entry0, *entry1;
struct compat_ipt_entry *iter0;
struct ipt_replace repl;
unsigned int size;
int ret;
info = *pinfo;
entry0 = *pentry0;
size = compatr->size;
info->number = compatr->num_entries;
j = 0;
xt_compat_lock(AF_INET);
xt_compat_init_offsets(AF_INET, compatr->num_entries);
/* Walk through entries, checking offsets. */
xt_entry_foreach(iter0, entry0, compatr->size) {
ret = check_compat_entry_size_and_hooks(iter0, info, &size,
entry0,
entry0 + compatr->size);
if (ret != 0)
goto out_unlock;
++j;
}
ret = -EINVAL;
if (j != compatr->num_entries)
goto out_unlock;
ret = -ENOMEM;
newinfo = xt_alloc_table_info(size);
if (!newinfo)
goto out_unlock;
newinfo->number = compatr->num_entries;
for (i = 0; i < NF_INET_NUMHOOKS; i++) {
newinfo->hook_entry[i] = compatr->hook_entry[i];
newinfo->underflow[i] = compatr->underflow[i];
}
entry1 = newinfo->entries;
pos = entry1;
size = compatr->size;
xt_entry_foreach(iter0, entry0, compatr->size)
compat_copy_entry_from_user(iter0, &pos, &size,
newinfo, entry1);
/* all module references in entry0 are now gone.
* entry1/newinfo contains a 64bit ruleset that looks exactly as
* generated by 64bit userspace.
*
* Call standard translate_table() to validate all hook_entrys,
* underflows, check for loops, etc.
*/
xt_compat_flush_offsets(AF_INET);
xt_compat_unlock(AF_INET);
memcpy(&repl, compatr, sizeof(*compatr));
for (i = 0; i < NF_INET_NUMHOOKS; i++) {
repl.hook_entry[i] = newinfo->hook_entry[i];
repl.underflow[i] = newinfo->underflow[i];
}
repl.num_counters = 0;
repl.counters = NULL;
repl.size = newinfo->size;
ret = translate_table(net, newinfo, entry1, &repl);
if (ret)
goto free_newinfo;
*pinfo = newinfo;
*pentry0 = entry1;
xt_free_table_info(info);
return 0;
free_newinfo:
xt_free_table_info(newinfo);
return ret;
out_unlock:
xt_compat_flush_offsets(AF_INET);
xt_compat_unlock(AF_INET);
xt_entry_foreach(iter0, entry0, compatr->size) {
if (j-- == 0)
break;
compat_release_entry(iter0);
}
return ret;
}
| 8,381 |
156,771 | 0 | bool RemoteFrame::PrepareForCommit() {
DetachChildren();
return !!GetPage();
}
| 8,382 |
103,586 | 0 | void ContainerNode::setHovered(bool over)
{
if (over == hovered()) return;
Node::setHovered(over);
if (renderer()) {
if (renderer()->style()->affectedByHoverRules())
setNeedsStyleRecalc();
if (renderer() && renderer()->style()->hasAppearance())
renderer()->theme()->stateChanged(renderer(), HoverState);
}
}
| 8,383 |
36,461 | 0 | static int snd_ctl_elem_read_user(struct snd_card *card,
struct snd_ctl_elem_value __user *_control)
{
struct snd_ctl_elem_value *control;
int result;
control = memdup_user(_control, sizeof(*control));
if (IS_ERR(control))
return PTR_ERR(control);
snd_power_lock(card);
result = snd_power_wait(card, SNDRV_CTL_POWER_D0);
if (result >= 0)
result = snd_ctl_elem_read(card, control);
snd_power_unlock(card);
if (result >= 0)
if (copy_to_user(_control, control, sizeof(*control)))
result = -EFAULT;
kfree(control);
return result;
}
| 8,384 |
67,883 | 0 | void * CLASS foveon_camf_matrix (unsigned dim[3], const char *name)
{
unsigned i, idx, type, ndim, size, *mat;
char *pos, *cp, *dp;
double dsize;
for (idx=0; idx < meta_length; idx += sget4(pos+8)) {
pos = meta_data + idx;
if (strncmp (pos, "CMb", 3)) break;
if (pos[3] != 'M') continue;
if (strcmp (name, pos+sget4(pos+12))) continue;
dim[0] = dim[1] = dim[2] = 1;
cp = pos + sget4(pos+16);
type = sget4(cp);
if ((ndim = sget4(cp+4)) > 3) break;
dp = pos + sget4(cp+8);
for (i=ndim; i--; ) {
cp += 12;
dim[i] = sget4(cp);
}
if ((dsize = (double) dim[0]*dim[1]*dim[2]) > meta_length/4) break;
mat = (unsigned *) malloc ((size = dsize) * 4);
merror (mat, "foveon_camf_matrix()");
for (i=0; i < size; i++)
if (type && type != 6)
mat[i] = sget4(dp + i*4);
else
mat[i] = sget4(dp + i*2) & 0xffff;
return mat;
}
fprintf (stderr,_("%s: \"%s\" matrix not found!\n"), ifname, name);
return 0;
}
| 8,385 |
78,888 | 0 | static int initialize(int reader_id, int verbose,
sc_context_t **ctx, sc_reader_t **reader)
{
unsigned int i, reader_count;
int r;
if (!ctx || !reader)
return SC_ERROR_INVALID_ARGUMENTS;
r = sc_establish_context(ctx, "");
if (r < 0 || !*ctx) {
fprintf(stderr, "Failed to create initial context: %s", sc_strerror(r));
return r;
}
(*ctx)->debug = verbose;
(*ctx)->flags |= SC_CTX_FLAG_ENABLE_DEFAULT_DRIVER;
reader_count = sc_ctx_get_reader_count(*ctx);
if (reader_count == 0) {
sc_debug(*ctx, SC_LOG_DEBUG_NORMAL, "No reader not found.\n");
return SC_ERROR_NO_READERS_FOUND;
}
if (reader_id < 0) {
/* Automatically try to skip to a reader with a card if reader not specified */
for (i = 0; i < reader_count; i++) {
*reader = sc_ctx_get_reader(*ctx, i);
if (sc_detect_card_presence(*reader) & SC_READER_CARD_PRESENT) {
reader_id = i;
sc_debug(*ctx, SC_LOG_DEBUG_NORMAL, "Using the first reader"
" with a card: %s", (*reader)->name);
break;
}
}
if ((unsigned int) reader_id >= reader_count) {
sc_debug(*ctx, SC_LOG_DEBUG_NORMAL, "No card found, using the first reader.");
reader_id = 0;
}
}
if ((unsigned int) reader_id >= reader_count) {
sc_debug(*ctx, SC_LOG_DEBUG_NORMAL, "Invalid reader number "
"(%d), only %d available.\n", reader_id, reader_count);
return SC_ERROR_NO_READERS_FOUND;
}
*reader = sc_ctx_get_reader(*ctx, reader_id);
return SC_SUCCESS;
}
| 8,386 |
131,468 | 0 | static void longLongAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
TestObjectPythonV8Internal::longLongAttributeAttributeGetter(info);
TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
}
| 8,387 |
61,375 | 0 | enum AVCodecID ff_mov_get_lpcm_codec_id(int bps, int flags)
{
/* lpcm flags:
* 0x1 = float
* 0x2 = big-endian
* 0x4 = signed
*/
return ff_get_pcm_codec_id(bps, flags & 1, flags & 2, flags & 4 ? -1 : 0);
}
| 8,388 |
7,568 | 0 | static void cirrus_bitblt_rop_nop(CirrusVGAState *s,
uint8_t *dst,const uint8_t *src,
int dstpitch,int srcpitch,
int bltwidth,int bltheight)
{
}
| 8,389 |
28,147 | 0 | static inline int pix_abs16_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
{
int s, i;
s = 0;
for(i=0;i<h;i++) {
s += abs(pix1[0] - pix2[0]);
s += abs(pix1[1] - pix2[1]);
s += abs(pix1[2] - pix2[2]);
s += abs(pix1[3] - pix2[3]);
s += abs(pix1[4] - pix2[4]);
s += abs(pix1[5] - pix2[5]);
s += abs(pix1[6] - pix2[6]);
s += abs(pix1[7] - pix2[7]);
s += abs(pix1[8] - pix2[8]);
s += abs(pix1[9] - pix2[9]);
s += abs(pix1[10] - pix2[10]);
s += abs(pix1[11] - pix2[11]);
s += abs(pix1[12] - pix2[12]);
s += abs(pix1[13] - pix2[13]);
s += abs(pix1[14] - pix2[14]);
s += abs(pix1[15] - pix2[15]);
pix1 += line_size;
pix2 += line_size;
}
return s;
}
| 8,390 |
33,730 | 0 | static void __exit hidp_exit(void)
{
hidp_cleanup_sockets();
}
| 8,391 |
153,708 | 0 | void GLES2Implementation::GetProgramResourceiv(GLuint program,
GLenum program_interface,
GLuint index,
GLsizei prop_count,
const GLenum* props,
GLsizei bufsize,
GLsizei* length,
GLint* params) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetProgramResourceiv(" << program
<< ", " << program_interface << ", " << index << ", "
<< prop_count << ", " << static_cast<const void*>(props)
<< ", " << bufsize << ", " << static_cast<void*>(length)
<< ", " << static_cast<void*>(params) << ")");
if (prop_count < 0) {
SetGLError(GL_INVALID_VALUE, "glGetProgramResourceiv", "prop_count < 0");
return;
}
if (bufsize < 0) {
SetGLError(GL_INVALID_VALUE, "glGetProgramResourceiv", "bufsize < 0");
return;
}
TRACE_EVENT0("gpu", "GLES2::GetProgramResourceiv");
GLsizei param_count = 0;
bool success = share_group_->program_info_manager()->GetProgramResourceiv(
this, program, program_interface, index, prop_count, props, bufsize,
¶m_count, params);
if (length) {
*length = param_count;
}
if (success && params) {
GPU_CLIENT_LOG_CODE_BLOCK({
for (GLsizei ii = 0; ii < param_count; ++ii) {
GPU_CLIENT_LOG(" " << ii << ": " << params[ii]);
}
});
}
CheckGLError();
}
| 8,392 |
170,677 | 0 | static EAS_I16 ConvertLFOPhaseIncrement (EAS_I32 pitchCents)
{
/* check range */
if (pitchCents > MAX_LFO_FREQUENCY_IN_PITCHCENTS)
pitchCents = MAX_LFO_FREQUENCY_IN_PITCHCENTS;
if (pitchCents < MIN_LFO_FREQUENCY_IN_PITCHCENTS)
pitchCents = MIN_LFO_FREQUENCY_IN_PITCHCENTS;
/* double the rate and divide by frame rate by subtracting in log domain */
pitchCents = pitchCents - dlsLFOFrequencyConvert;
/* convert to phase increment */
return (EAS_I16) EAS_Calculate2toX(pitchCents);
}
| 8,393 |
9,923 | 0 | void Part::slotCopyFiles()
{
m_model->filesToCopy = ArchiveModel::entryMap(filesForIndexes(addChildren(m_view->selectionModel()->selectedRows())));
qCDebug(ARK) << "Entries marked to copy:" << m_model->filesToCopy.values();
foreach (const QModelIndex &row, m_cutIndexes) {
m_view->dataChanged(row, row);
}
m_cutIndexes.clear();
m_model->filesToMove.clear();
updateActions();
}
| 8,394 |
167,355 | 0 | bool HistoryContainsURL(const GURL& url) {
scoped_refptr<content::MessageLoopRunner> message_loop_runner =
new content::MessageLoopRunner;
quit_closure_ = message_loop_runner->QuitClosure();
history_service_->QueryURL(
url,
true,
base::Bind(&RemoveHistoryTester::SaveResultAndQuit,
base::Unretained(this)),
&tracker_);
message_loop_runner->Run();
return query_url_success_;
}
| 8,395 |
170,749 | 0 | status_t OMXNodeInstance::prepareForAdaptivePlayback(
OMX_U32 portIndex, OMX_BOOL enable, OMX_U32 maxFrameWidth,
OMX_U32 maxFrameHeight) {
Mutex::Autolock autolock(mLock);
CLOG_CONFIG(prepareForAdaptivePlayback, "%s:%u en=%d max=%ux%u",
portString(portIndex), portIndex, enable, maxFrameWidth, maxFrameHeight);
OMX_INDEXTYPE index;
OMX_STRING name = const_cast<OMX_STRING>(
"OMX.google.android.index.prepareForAdaptivePlayback");
OMX_ERRORTYPE err = OMX_GetExtensionIndex(mHandle, name, &index);
if (err != OMX_ErrorNone) {
CLOG_ERROR_IF(enable, getExtensionIndex, err, "%s", name);
return StatusFromOMXError(err);
}
PrepareForAdaptivePlaybackParams params;
InitOMXParams(¶ms);
params.nPortIndex = portIndex;
params.bEnable = enable;
params.nMaxFrameWidth = maxFrameWidth;
params.nMaxFrameHeight = maxFrameHeight;
err = OMX_SetParameter(mHandle, index, ¶ms);
CLOG_IF_ERROR(setParameter, err, "%s(%#x): %s:%u en=%d max=%ux%u", name, index,
portString(portIndex), portIndex, enable, maxFrameWidth, maxFrameHeight);
return StatusFromOMXError(err);
}
| 8,396 |
5,678 | 0 | static TRBCCode xhci_address_slot(XHCIState *xhci, unsigned int slotid,
uint64_t pictx, bool bsr)
{
XHCISlot *slot;
USBPort *uport;
USBDevice *dev;
dma_addr_t ictx, octx, dcbaap;
uint64_t poctx;
uint32_t ictl_ctx[2];
uint32_t slot_ctx[4];
uint32_t ep0_ctx[5];
int i;
TRBCCode res;
assert(slotid >= 1 && slotid <= xhci->numslots);
dcbaap = xhci_addr64(xhci->dcbaap_low, xhci->dcbaap_high);
poctx = ldq_le_pci_dma(PCI_DEVICE(xhci), dcbaap + 8 * slotid);
ictx = xhci_mask64(pictx);
octx = xhci_mask64(poctx);
DPRINTF("xhci: input context at "DMA_ADDR_FMT"\n", ictx);
DPRINTF("xhci: output context at "DMA_ADDR_FMT"\n", octx);
xhci_dma_read_u32s(xhci, ictx, ictl_ctx, sizeof(ictl_ctx));
if (ictl_ctx[0] != 0x0 || ictl_ctx[1] != 0x3) {
DPRINTF("xhci: invalid input context control %08x %08x\n",
ictl_ctx[0], ictl_ctx[1]);
return CC_TRB_ERROR;
}
xhci_dma_read_u32s(xhci, ictx+32, slot_ctx, sizeof(slot_ctx));
xhci_dma_read_u32s(xhci, ictx+64, ep0_ctx, sizeof(ep0_ctx));
DPRINTF("xhci: input slot context: %08x %08x %08x %08x\n",
slot_ctx[0], slot_ctx[1], slot_ctx[2], slot_ctx[3]);
DPRINTF("xhci: input ep0 context: %08x %08x %08x %08x %08x\n",
ep0_ctx[0], ep0_ctx[1], ep0_ctx[2], ep0_ctx[3], ep0_ctx[4]);
uport = xhci_lookup_uport(xhci, slot_ctx);
if (uport == NULL) {
DPRINTF("xhci: port not found\n");
return CC_TRB_ERROR;
}
trace_usb_xhci_slot_address(slotid, uport->path);
dev = uport->dev;
if (!dev || !dev->attached) {
DPRINTF("xhci: port %s not connected\n", uport->path);
return CC_USB_TRANSACTION_ERROR;
}
for (i = 0; i < xhci->numslots; i++) {
if (i == slotid-1) {
continue;
}
if (xhci->slots[i].uport == uport) {
DPRINTF("xhci: port %s already assigned to slot %d\n",
uport->path, i+1);
return CC_TRB_ERROR;
}
}
slot = &xhci->slots[slotid-1];
slot->uport = uport;
slot->ctx = octx;
/* Make sure device is in USB_STATE_DEFAULT state */
usb_device_reset(dev);
if (bsr) {
slot_ctx[3] = SLOT_DEFAULT << SLOT_STATE_SHIFT;
} else {
USBPacket p;
uint8_t buf[1];
slot_ctx[3] = (SLOT_ADDRESSED << SLOT_STATE_SHIFT) | slotid;
memset(&p, 0, sizeof(p));
usb_packet_addbuf(&p, buf, sizeof(buf));
usb_packet_setup(&p, USB_TOKEN_OUT,
usb_ep_get(dev, USB_TOKEN_OUT, 0), 0,
0, false, false);
usb_device_handle_control(dev, &p,
DeviceOutRequest | USB_REQ_SET_ADDRESS,
slotid, 0, 0, NULL);
assert(p.status != USB_RET_ASYNC);
}
res = xhci_enable_ep(xhci, slotid, 1, octx+32, ep0_ctx);
DPRINTF("xhci: output slot context: %08x %08x %08x %08x\n",
slot_ctx[0], slot_ctx[1], slot_ctx[2], slot_ctx[3]);
DPRINTF("xhci: output ep0 context: %08x %08x %08x %08x %08x\n",
ep0_ctx[0], ep0_ctx[1], ep0_ctx[2], ep0_ctx[3], ep0_ctx[4]);
xhci_dma_write_u32s(xhci, octx, slot_ctx, sizeof(slot_ctx));
xhci_dma_write_u32s(xhci, octx+32, ep0_ctx, sizeof(ep0_ctx));
xhci->slots[slotid-1].addressed = 1;
return res;
}
| 8,397 |
77,338 | 0 | ofproto_normalize_type(const char *type)
{
return type && type[0] ? type : "system";
}
| 8,398 |
143,630 | 0 | RenderWidgetHost* RenderWidgetHost::FromID(
int32_t process_id,
int32_t routing_id) {
return RenderWidgetHostImpl::FromID(process_id, routing_id);
}
| 8,399 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.