unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
62,522 | 0 | telnet_print(netdissect_options *ndo, const u_char *sp, u_int length)
{
int first = 1;
const u_char *osp;
int l;
osp = sp;
ND_TCHECK(*sp);
while (length > 0 && *sp == IAC) {
/*
* Parse the Telnet command without printing it,
* to determine its length.
*/
l = telnet_parse(ndo, sp, length, 0);
if (l < 0)
break;
/*
* now print it
*/
if (ndo->ndo_Xflag && 2 < ndo->ndo_vflag) {
if (first)
ND_PRINT((ndo, "\nTelnet:"));
hex_print_with_offset(ndo, "\n", sp, l, sp - osp);
if (l > 8)
ND_PRINT((ndo, "\n\t\t\t\t"));
else
ND_PRINT((ndo, "%*s\t", (8 - l) * 3, ""));
} else
ND_PRINT((ndo, "%s", (first) ? " [telnet " : ", "));
(void)telnet_parse(ndo, sp, length, 1);
first = 0;
sp += l;
length -= l;
ND_TCHECK(*sp);
}
if (!first) {
if (ndo->ndo_Xflag && 2 < ndo->ndo_vflag)
ND_PRINT((ndo, "\n"));
else
ND_PRINT((ndo, "]"));
}
return;
trunc:
ND_PRINT((ndo, "%s", tstr));
}
| 16,500 |
135,161 | 0 | void Document::clearFocusedElementSoon()
{
if (!m_clearFocusedElementTimer.isActive())
m_clearFocusedElementTimer.startOneShot(0, BLINK_FROM_HERE);
}
| 16,501 |
83,039 | 0 | static void controloptions (lua_State *L, int opt, const char **fmt,
Header *h) {
switch (opt) {
case ' ': return; /* ignore white spaces */
case '>': h->endian = BIG; return;
case '<': h->endian = LITTLE; return;
case '!': {
int a = getnum(fmt, MAXALIGN);
if (!isp2(a))
luaL_error(L, "alignment %d is not a power of 2", a);
h->align = a;
return;
}
default: {
const char *msg = lua_pushfstring(L, "invalid format option '%c'", opt);
luaL_argerror(L, 1, msg);
}
}
}
| 16,502 |
66,565 | 0 | static void set_ethernet_addr(pegasus_t *pegasus)
{
__u8 node_id[6];
if (pegasus->features & PEGASUS_II) {
get_registers(pegasus, 0x10, sizeof(node_id), node_id);
} else {
get_node_id(pegasus, node_id);
set_registers(pegasus, EthID, sizeof(node_id), node_id);
}
memcpy(pegasus->net->dev_addr, node_id, sizeof(node_id));
}
| 16,503 |
72,095 | 0 | _load_job_limits(void)
{
List steps;
ListIterator step_iter;
step_loc_t *stepd;
int fd;
job_mem_limits_t *job_limits_ptr;
slurmstepd_mem_info_t stepd_mem_info;
if (!job_limits_list)
job_limits_list = list_create(_job_limits_free);
job_limits_loaded = true;
steps = stepd_available(conf->spooldir, conf->node_name);
step_iter = list_iterator_create(steps);
while ((stepd = list_next(step_iter))) {
job_limits_ptr = list_find_first(job_limits_list,
_step_limits_match, stepd);
if (job_limits_ptr) /* already processed */
continue;
fd = stepd_connect(stepd->directory, stepd->nodename,
stepd->jobid, stepd->stepid,
&stepd->protocol_version);
if (fd == -1)
continue; /* step completed */
if (stepd_get_mem_limits(fd, stepd->protocol_version,
&stepd_mem_info) != SLURM_SUCCESS) {
error("Error reading step %u.%u memory limits from "
"slurmstepd",
stepd->jobid, stepd->stepid);
close(fd);
continue;
}
if ((stepd_mem_info.job_mem_limit
|| stepd_mem_info.step_mem_limit)) {
/* create entry for this job */
job_limits_ptr = xmalloc(sizeof(job_mem_limits_t));
job_limits_ptr->job_id = stepd->jobid;
job_limits_ptr->step_id = stepd->stepid;
job_limits_ptr->job_mem =
stepd_mem_info.job_mem_limit;
job_limits_ptr->step_mem =
stepd_mem_info.step_mem_limit;
#if _LIMIT_INFO
info("RecLim step:%u.%u job_mem:%u step_mem:%u",
job_limits_ptr->job_id, job_limits_ptr->step_id,
job_limits_ptr->job_mem,
job_limits_ptr->step_mem);
#endif
list_append(job_limits_list, job_limits_ptr);
}
close(fd);
}
list_iterator_destroy(step_iter);
FREE_NULL_LIST(steps);
}
| 16,504 |
183,712 | 1 | void makeCurrent()
{
#if PLATFORM(QT)
m_detachedContext = QOpenGLContext::currentContext();
if (m_detachedContext)
m_detachedSurface = m_detachedContext->surface();
if (m_surface && m_glContext)
m_glContext->makeCurrent(m_surface.get());
#elif PLATFORM(EFL)
m_detachedContext = glXGetCurrentContext();
m_detachedSurface = glXGetCurrentDrawable();
if (m_surface && m_glContext)
glXMakeCurrent(m_display, m_surface, m_glContext);
#endif
}
| 16,505 |
110,566 | 0 | error::Error GLES2DecoderImpl::HandleBindAttribLocation(
uint32 immediate_data_size, const gles2::BindAttribLocation& c) {
GLuint program = static_cast<GLuint>(c.program);
GLuint index = static_cast<GLuint>(c.index);
uint32 name_size = c.data_size;
const char* name = GetSharedMemoryAs<const char*>(
c.name_shm_id, c.name_shm_offset, name_size);
if (name == NULL) {
return error::kOutOfBounds;
}
String name_str(name, name_size);
DoBindAttribLocation(program, index, name_str.c_str());
return error::kNoError;
}
| 16,506 |
102,233 | 0 | DictionaryValue* ExtensionPrefs::CopyCurrentExtensions() {
const DictionaryValue* extensions = prefs_->GetDictionary(kExtensionsPref);
if (extensions) {
DictionaryValue* copy = extensions->DeepCopy();
MakePathsAbsolute(copy);
return copy;
}
return new DictionaryValue;
}
| 16,507 |
134,792 | 0 | EventReaderLibevdevCros::Delegate::~Delegate() {}
| 16,508 |
30,613 | 0 | static void iucv_sock_cleanup_listen(struct sock *parent)
{
struct sock *sk;
/* Close non-accepted connections */
while ((sk = iucv_accept_dequeue(parent, NULL))) {
iucv_sock_close(sk);
iucv_sock_kill(sk);
}
parent->sk_state = IUCV_CLOSED;
}
| 16,509 |
89,650 | 0 | static void mdiobus_release(struct device *d)
{
struct mii_bus *bus = to_mii_bus(d);
BUG_ON(bus->state != MDIOBUS_RELEASED &&
/* for compatibility with error handling in drivers */
bus->state != MDIOBUS_ALLOCATED);
kfree(bus);
}
| 16,510 |
30,002 | 0 | struct net_bridge_mdb_entry *br_mdb_get(struct net_bridge *br,
struct sk_buff *skb, u16 vid)
{
struct net_bridge_mdb_htable *mdb = rcu_dereference(br->mdb);
struct br_ip ip;
if (br->multicast_disabled)
return NULL;
if (BR_INPUT_SKB_CB(skb)->igmp)
return NULL;
ip.proto = skb->protocol;
ip.vid = vid;
switch (skb->protocol) {
case htons(ETH_P_IP):
ip.u.ip4 = ip_hdr(skb)->daddr;
break;
#if IS_ENABLED(CONFIG_IPV6)
case htons(ETH_P_IPV6):
ip.u.ip6 = ipv6_hdr(skb)->daddr;
break;
#endif
default:
return NULL;
}
return br_mdb_ip_get(mdb, &ip);
}
| 16,511 |
67,838 | 0 | DefragContextDestroy(DefragContext *dc)
{
if (dc == NULL)
return;
PoolFree(dc->frag_pool);
SCFree(dc);
}
| 16,512 |
44,119 | 0 | bool xml_patch_versions(xmlNode *patchset, int add[3], int del[3])
{
int lpc = 0;
int format = 1;
xmlNode *tmp = NULL;
const char *vfields[] = {
XML_ATTR_GENERATION_ADMIN,
XML_ATTR_GENERATION,
XML_ATTR_NUMUPDATES,
};
crm_element_value_int(patchset, "format", &format);
switch(format) {
case 1:
tmp = find_xml_node(patchset, "diff-removed", FALSE);
tmp = find_xml_node(tmp, "cib", FALSE);
if(tmp == NULL) {
/* Revert to the diff-removed line */
tmp = find_xml_node(patchset, "diff-removed", FALSE);
}
break;
case 2:
tmp = find_xml_node(patchset, "version", FALSE);
tmp = find_xml_node(tmp, "source", FALSE);
break;
default:
crm_warn("Unknown patch format: %d", format);
return -EINVAL;
}
if (tmp) {
for(lpc = 0; lpc < DIMOF(vfields); lpc++) {
crm_element_value_int(tmp, vfields[lpc], &(del[lpc]));
crm_trace("Got %d for del[%s]", del[lpc], vfields[lpc]);
}
}
switch(format) {
case 1:
tmp = find_xml_node(patchset, "diff-added", FALSE);
tmp = find_xml_node(tmp, "cib", FALSE);
if(tmp == NULL) {
/* Revert to the diff-added line */
tmp = find_xml_node(patchset, "diff-added", FALSE);
}
break;
case 2:
tmp = find_xml_node(patchset, "version", FALSE);
tmp = find_xml_node(tmp, "target", FALSE);
break;
default:
crm_warn("Unknown patch format: %d", format);
return -EINVAL;
}
if (tmp) {
for(lpc = 0; lpc < DIMOF(vfields); lpc++) {
crm_element_value_int(tmp, vfields[lpc], &(add[lpc]));
crm_trace("Got %d for add[%s]", add[lpc], vfields[lpc]);
}
}
return pcmk_ok;
}
| 16,513 |
61,592 | 0 | static int mxf_read_close(AVFormatContext *s)
{
MXFContext *mxf = s->priv_data;
int i;
av_freep(&mxf->packages_refs);
for (i = 0; i < s->nb_streams; i++)
s->streams[i]->priv_data = NULL;
for (i = 0; i < mxf->metadata_sets_count; i++) {
mxf_free_metadataset(mxf->metadata_sets + i, 1);
}
av_freep(&mxf->partitions);
av_freep(&mxf->metadata_sets);
av_freep(&mxf->aesc);
av_freep(&mxf->local_tags);
if (mxf->index_tables) {
for (i = 0; i < mxf->nb_index_tables; i++) {
av_freep(&mxf->index_tables[i].segments);
av_freep(&mxf->index_tables[i].ptses);
av_freep(&mxf->index_tables[i].fake_index);
av_freep(&mxf->index_tables[i].offsets);
}
}
av_freep(&mxf->index_tables);
return 0;
}
| 16,514 |
166,737 | 0 | HeapObjectHeader* NormalPage::FindHeaderFromAddress(Address address) {
if (!ContainedInObjectPayload(address))
return nullptr;
if (ArenaForNormalPage()->IsInCurrentAllocationPointRegion(address))
return nullptr;
HeapObjectHeader* header = reinterpret_cast<HeapObjectHeader*>(
object_start_bit_map()->FindHeader(address));
if (header->IsFree())
return nullptr;
DCHECK_LT(0u, header->GcInfoIndex());
DCHECK_GT(header->PayloadEnd(), address);
return header;
}
| 16,515 |
150,713 | 0 | base::string16 GetDefaultSoundSettingString() {
return PageInfoUI::PermissionActionToUIString(
profile(), CONTENT_SETTINGS_TYPE_SOUND, CONTENT_SETTING_DEFAULT,
default_setting_, content_settings::SettingSource::SETTING_SOURCE_USER);
}
| 16,516 |
56,715 | 0 | void aio_complete(struct kiocb *iocb, long res, long res2)
{
struct kioctx *ctx = iocb->ki_ctx;
struct aio_ring *ring;
struct io_event *ev_page, *event;
unsigned tail, pos, head;
unsigned long flags;
/*
* Special case handling for sync iocbs:
* - events go directly into the iocb for fast handling
* - the sync task with the iocb in its stack holds the single iocb
* ref, no other paths have a way to get another ref
* - the sync task helpfully left a reference to itself in the iocb
*/
if (is_sync_kiocb(iocb)) {
iocb->ki_user_data = res;
smp_wmb();
iocb->ki_ctx = ERR_PTR(-EXDEV);
wake_up_process(iocb->ki_obj.tsk);
return;
}
if (iocb->ki_list.next) {
unsigned long flags;
spin_lock_irqsave(&ctx->ctx_lock, flags);
list_del(&iocb->ki_list);
spin_unlock_irqrestore(&ctx->ctx_lock, flags);
}
/*
* Add a completion event to the ring buffer. Must be done holding
* ctx->completion_lock to prevent other code from messing with the tail
* pointer since we might be called from irq context.
*/
spin_lock_irqsave(&ctx->completion_lock, flags);
tail = ctx->tail;
pos = tail + AIO_EVENTS_OFFSET;
if (++tail >= ctx->nr_events)
tail = 0;
ev_page = kmap_atomic(ctx->ring_pages[pos / AIO_EVENTS_PER_PAGE]);
event = ev_page + pos % AIO_EVENTS_PER_PAGE;
event->obj = (u64)(unsigned long)iocb->ki_obj.user;
event->data = iocb->ki_user_data;
event->res = res;
event->res2 = res2;
kunmap_atomic(ev_page);
flush_dcache_page(ctx->ring_pages[pos / AIO_EVENTS_PER_PAGE]);
pr_debug("%p[%u]: %p: %p %Lx %lx %lx\n",
ctx, tail, iocb, iocb->ki_obj.user, iocb->ki_user_data,
res, res2);
/* after flagging the request as done, we
* must never even look at it again
*/
smp_wmb(); /* make event visible before updating tail */
ctx->tail = tail;
ring = kmap_atomic(ctx->ring_pages[0]);
head = ring->head;
ring->tail = tail;
kunmap_atomic(ring);
flush_dcache_page(ctx->ring_pages[0]);
ctx->completed_events++;
if (ctx->completed_events > 1)
refill_reqs_available(ctx, head, tail);
spin_unlock_irqrestore(&ctx->completion_lock, flags);
pr_debug("added to ring %p at [%u]\n", iocb, tail);
/*
* Check if the user asked us to deliver the result through an
* eventfd. The eventfd_signal() function is safe to be called
* from IRQ context.
*/
if (iocb->ki_eventfd != NULL)
eventfd_signal(iocb->ki_eventfd, 1);
/* everything turned out well, dispose of the aiocb. */
kiocb_free(iocb);
/*
* We have to order our ring_info tail store above and test
* of the wait list below outside the wait lock. This is
* like in wake_up_bit() where clearing a bit has to be
* ordered with the unlocked test.
*/
smp_mb();
if (waitqueue_active(&ctx->wait))
wake_up(&ctx->wait);
percpu_ref_put(&ctx->reqs);
}
| 16,517 |
51,946 | 0 | SpoolssEnumPrinterData_q(tvbuff_t *tvb, int offset,
packet_info *pinfo, proto_tree *tree,
dcerpc_info *di, guint8 *drep _U_)
{
guint32 ndx;
proto_item *hidden_item;
hidden_item = proto_tree_add_uint(
tree, hf_printerdata, tvb, offset, 0, 1);
PROTO_ITEM_SET_HIDDEN(hidden_item);
/* Parse packet */
offset = dissect_nt_policy_hnd(
tvb, offset, pinfo, tree, di, drep, hf_hnd, NULL, NULL,
FALSE, FALSE);
offset = dissect_ndr_uint32(
tvb, offset, pinfo, tree, di, drep,
hf_enumprinterdata_enumindex, &ndx);
col_append_fstr(pinfo->cinfo, COL_INFO, ", index %d", ndx);
offset = dissect_ndr_uint32(
tvb, offset, pinfo, tree, di, drep,
hf_enumprinterdata_value_offered, NULL);
offset = dissect_ndr_uint32(
tvb, offset, pinfo, tree, di, drep,
hf_enumprinterdata_data_offered, NULL);
return offset;
}
| 16,518 |
44,294 | 0 | static int load_elf_binary(struct linux_binprm *bprm)
{
struct file *interpreter = NULL; /* to shut gcc up */
unsigned long load_addr = 0, load_bias = 0;
int load_addr_set = 0;
char * elf_interpreter = NULL;
unsigned long error;
struct elf_phdr *elf_ppnt, *elf_phdata, *interp_elf_phdata = NULL;
unsigned long elf_bss, elf_brk;
int retval, i;
unsigned long elf_entry;
unsigned long interp_load_addr = 0;
unsigned long start_code, end_code, start_data, end_data;
unsigned long reloc_func_desc __maybe_unused = 0;
int executable_stack = EXSTACK_DEFAULT;
struct pt_regs *regs = current_pt_regs();
struct {
struct elfhdr elf_ex;
struct elfhdr interp_elf_ex;
} *loc;
struct arch_elf_state arch_state = INIT_ARCH_ELF_STATE;
loc = kmalloc(sizeof(*loc), GFP_KERNEL);
if (!loc) {
retval = -ENOMEM;
goto out_ret;
}
/* Get the exec-header */
loc->elf_ex = *((struct elfhdr *)bprm->buf);
retval = -ENOEXEC;
/* First of all, some simple consistency checks */
if (memcmp(loc->elf_ex.e_ident, ELFMAG, SELFMAG) != 0)
goto out;
if (loc->elf_ex.e_type != ET_EXEC && loc->elf_ex.e_type != ET_DYN)
goto out;
if (!elf_check_arch(&loc->elf_ex))
goto out;
if (!bprm->file->f_op->mmap)
goto out;
elf_phdata = load_elf_phdrs(&loc->elf_ex, bprm->file);
if (!elf_phdata)
goto out;
elf_ppnt = elf_phdata;
elf_bss = 0;
elf_brk = 0;
start_code = ~0UL;
end_code = 0;
start_data = 0;
end_data = 0;
for (i = 0; i < loc->elf_ex.e_phnum; i++) {
if (elf_ppnt->p_type == PT_INTERP) {
/* This is the program interpreter used for
* shared libraries - for now assume that this
* is an a.out format binary
*/
retval = -ENOEXEC;
if (elf_ppnt->p_filesz > PATH_MAX ||
elf_ppnt->p_filesz < 2)
goto out_free_ph;
retval = -ENOMEM;
elf_interpreter = kmalloc(elf_ppnt->p_filesz,
GFP_KERNEL);
if (!elf_interpreter)
goto out_free_ph;
retval = kernel_read(bprm->file, elf_ppnt->p_offset,
elf_interpreter,
elf_ppnt->p_filesz);
if (retval != elf_ppnt->p_filesz) {
if (retval >= 0)
retval = -EIO;
goto out_free_interp;
}
/* make sure path is NULL terminated */
retval = -ENOEXEC;
if (elf_interpreter[elf_ppnt->p_filesz - 1] != '\0')
goto out_free_interp;
interpreter = open_exec(elf_interpreter);
retval = PTR_ERR(interpreter);
if (IS_ERR(interpreter))
goto out_free_interp;
/*
* If the binary is not readable then enforce
* mm->dumpable = 0 regardless of the interpreter's
* permissions.
*/
would_dump(bprm, interpreter);
retval = kernel_read(interpreter, 0, bprm->buf,
BINPRM_BUF_SIZE);
if (retval != BINPRM_BUF_SIZE) {
if (retval >= 0)
retval = -EIO;
goto out_free_dentry;
}
/* Get the exec headers */
loc->interp_elf_ex = *((struct elfhdr *)bprm->buf);
break;
}
elf_ppnt++;
}
elf_ppnt = elf_phdata;
for (i = 0; i < loc->elf_ex.e_phnum; i++, elf_ppnt++)
switch (elf_ppnt->p_type) {
case PT_GNU_STACK:
if (elf_ppnt->p_flags & PF_X)
executable_stack = EXSTACK_ENABLE_X;
else
executable_stack = EXSTACK_DISABLE_X;
break;
case PT_LOPROC ... PT_HIPROC:
retval = arch_elf_pt_proc(&loc->elf_ex, elf_ppnt,
bprm->file, false,
&arch_state);
if (retval)
goto out_free_dentry;
break;
}
/* Some simple consistency checks for the interpreter */
if (elf_interpreter) {
retval = -ELIBBAD;
/* Not an ELF interpreter */
if (memcmp(loc->interp_elf_ex.e_ident, ELFMAG, SELFMAG) != 0)
goto out_free_dentry;
/* Verify the interpreter has a valid arch */
if (!elf_check_arch(&loc->interp_elf_ex))
goto out_free_dentry;
/* Load the interpreter program headers */
interp_elf_phdata = load_elf_phdrs(&loc->interp_elf_ex,
interpreter);
if (!interp_elf_phdata)
goto out_free_dentry;
/* Pass PT_LOPROC..PT_HIPROC headers to arch code */
elf_ppnt = interp_elf_phdata;
for (i = 0; i < loc->interp_elf_ex.e_phnum; i++, elf_ppnt++)
switch (elf_ppnt->p_type) {
case PT_LOPROC ... PT_HIPROC:
retval = arch_elf_pt_proc(&loc->interp_elf_ex,
elf_ppnt, interpreter,
true, &arch_state);
if (retval)
goto out_free_dentry;
break;
}
}
/*
* Allow arch code to reject the ELF at this point, whilst it's
* still possible to return an error to the code that invoked
* the exec syscall.
*/
retval = arch_check_elf(&loc->elf_ex, !!interpreter, &arch_state);
if (retval)
goto out_free_dentry;
/* Flush all traces of the currently running executable */
retval = flush_old_exec(bprm);
if (retval)
goto out_free_dentry;
/* Do this immediately, since STACK_TOP as used in setup_arg_pages
may depend on the personality. */
SET_PERSONALITY2(loc->elf_ex, &arch_state);
if (elf_read_implies_exec(loc->elf_ex, executable_stack))
current->personality |= READ_IMPLIES_EXEC;
if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space)
current->flags |= PF_RANDOMIZE;
setup_new_exec(bprm);
/* Do this so that we can load the interpreter, if need be. We will
change some of these later */
retval = setup_arg_pages(bprm, randomize_stack_top(STACK_TOP),
executable_stack);
if (retval < 0)
goto out_free_dentry;
current->mm->start_stack = bprm->p;
/* Now we do a little grungy work by mmapping the ELF image into
the correct location in memory. */
for(i = 0, elf_ppnt = elf_phdata;
i < loc->elf_ex.e_phnum; i++, elf_ppnt++) {
int elf_prot = 0, elf_flags;
unsigned long k, vaddr;
if (elf_ppnt->p_type != PT_LOAD)
continue;
if (unlikely (elf_brk > elf_bss)) {
unsigned long nbyte;
/* There was a PT_LOAD segment with p_memsz > p_filesz
before this one. Map anonymous pages, if needed,
and clear the area. */
retval = set_brk(elf_bss + load_bias,
elf_brk + load_bias);
if (retval)
goto out_free_dentry;
nbyte = ELF_PAGEOFFSET(elf_bss);
if (nbyte) {
nbyte = ELF_MIN_ALIGN - nbyte;
if (nbyte > elf_brk - elf_bss)
nbyte = elf_brk - elf_bss;
if (clear_user((void __user *)elf_bss +
load_bias, nbyte)) {
/*
* This bss-zeroing can fail if the ELF
* file specifies odd protections. So
* we don't check the return value
*/
}
}
}
if (elf_ppnt->p_flags & PF_R)
elf_prot |= PROT_READ;
if (elf_ppnt->p_flags & PF_W)
elf_prot |= PROT_WRITE;
if (elf_ppnt->p_flags & PF_X)
elf_prot |= PROT_EXEC;
elf_flags = MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE;
vaddr = elf_ppnt->p_vaddr;
if (loc->elf_ex.e_type == ET_EXEC || load_addr_set) {
elf_flags |= MAP_FIXED;
} else if (loc->elf_ex.e_type == ET_DYN) {
/* Try and get dynamic programs out of the way of the
* default mmap base, as well as whatever program they
* might try to exec. This is because the brk will
* follow the loader, and is not movable. */
#ifdef CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE
/* Memory randomization might have been switched off
* in runtime via sysctl or explicit setting of
* personality flags.
* If that is the case, retain the original non-zero
* load_bias value in order to establish proper
* non-randomized mappings.
*/
if (current->flags & PF_RANDOMIZE)
load_bias = 0;
else
load_bias = ELF_PAGESTART(ELF_ET_DYN_BASE - vaddr);
#else
load_bias = ELF_PAGESTART(ELF_ET_DYN_BASE - vaddr);
#endif
}
error = elf_map(bprm->file, load_bias + vaddr, elf_ppnt,
elf_prot, elf_flags, 0);
if (BAD_ADDR(error)) {
retval = IS_ERR((void *)error) ?
PTR_ERR((void*)error) : -EINVAL;
goto out_free_dentry;
}
if (!load_addr_set) {
load_addr_set = 1;
load_addr = (elf_ppnt->p_vaddr - elf_ppnt->p_offset);
if (loc->elf_ex.e_type == ET_DYN) {
load_bias += error -
ELF_PAGESTART(load_bias + vaddr);
load_addr += load_bias;
reloc_func_desc = load_bias;
}
}
k = elf_ppnt->p_vaddr;
if (k < start_code)
start_code = k;
if (start_data < k)
start_data = k;
/*
* Check to see if the section's size will overflow the
* allowed task size. Note that p_filesz must always be
* <= p_memsz so it is only necessary to check p_memsz.
*/
if (BAD_ADDR(k) || elf_ppnt->p_filesz > elf_ppnt->p_memsz ||
elf_ppnt->p_memsz > TASK_SIZE ||
TASK_SIZE - elf_ppnt->p_memsz < k) {
/* set_brk can never work. Avoid overflows. */
retval = -EINVAL;
goto out_free_dentry;
}
k = elf_ppnt->p_vaddr + elf_ppnt->p_filesz;
if (k > elf_bss)
elf_bss = k;
if ((elf_ppnt->p_flags & PF_X) && end_code < k)
end_code = k;
if (end_data < k)
end_data = k;
k = elf_ppnt->p_vaddr + elf_ppnt->p_memsz;
if (k > elf_brk)
elf_brk = k;
}
loc->elf_ex.e_entry += load_bias;
elf_bss += load_bias;
elf_brk += load_bias;
start_code += load_bias;
end_code += load_bias;
start_data += load_bias;
end_data += load_bias;
/* Calling set_brk effectively mmaps the pages that we need
* for the bss and break sections. We must do this before
* mapping in the interpreter, to make sure it doesn't wind
* up getting placed where the bss needs to go.
*/
retval = set_brk(elf_bss, elf_brk);
if (retval)
goto out_free_dentry;
if (likely(elf_bss != elf_brk) && unlikely(padzero(elf_bss))) {
retval = -EFAULT; /* Nobody gets to see this, but.. */
goto out_free_dentry;
}
if (elf_interpreter) {
unsigned long interp_map_addr = 0;
elf_entry = load_elf_interp(&loc->interp_elf_ex,
interpreter,
&interp_map_addr,
load_bias, interp_elf_phdata);
if (!IS_ERR((void *)elf_entry)) {
/*
* load_elf_interp() returns relocation
* adjustment
*/
interp_load_addr = elf_entry;
elf_entry += loc->interp_elf_ex.e_entry;
}
if (BAD_ADDR(elf_entry)) {
retval = IS_ERR((void *)elf_entry) ?
(int)elf_entry : -EINVAL;
goto out_free_dentry;
}
reloc_func_desc = interp_load_addr;
allow_write_access(interpreter);
fput(interpreter);
kfree(elf_interpreter);
} else {
elf_entry = loc->elf_ex.e_entry;
if (BAD_ADDR(elf_entry)) {
retval = -EINVAL;
goto out_free_dentry;
}
}
kfree(interp_elf_phdata);
kfree(elf_phdata);
set_binfmt(&elf_format);
#ifdef ARCH_HAS_SETUP_ADDITIONAL_PAGES
retval = arch_setup_additional_pages(bprm, !!elf_interpreter);
if (retval < 0)
goto out;
#endif /* ARCH_HAS_SETUP_ADDITIONAL_PAGES */
install_exec_creds(bprm);
retval = create_elf_tables(bprm, &loc->elf_ex,
load_addr, interp_load_addr);
if (retval < 0)
goto out;
/* N.B. passed_fileno might not be initialized? */
current->mm->end_code = end_code;
current->mm->start_code = start_code;
current->mm->start_data = start_data;
current->mm->end_data = end_data;
current->mm->start_stack = bprm->p;
#ifdef arch_randomize_brk
if ((current->flags & PF_RANDOMIZE) && (randomize_va_space > 1)) {
current->mm->brk = current->mm->start_brk =
arch_randomize_brk(current->mm);
#ifdef CONFIG_COMPAT_BRK
current->brk_randomized = 1;
#endif
}
#endif
if (current->personality & MMAP_PAGE_ZERO) {
/* Why this, you ask??? Well SVr4 maps page 0 as read-only,
and some applications "depend" upon this behavior.
Since we do not have the power to recompile these, we
emulate the SVr4 behavior. Sigh. */
error = vm_mmap(NULL, 0, PAGE_SIZE, PROT_READ | PROT_EXEC,
MAP_FIXED | MAP_PRIVATE, 0);
}
#ifdef ELF_PLAT_INIT
/*
* The ABI may specify that certain registers be set up in special
* ways (on i386 %edx is the address of a DT_FINI function, for
* example. In addition, it may also specify (eg, PowerPC64 ELF)
* that the e_entry field is the address of the function descriptor
* for the startup routine, rather than the address of the startup
* routine itself. This macro performs whatever initialization to
* the regs structure is required as well as any relocations to the
* function descriptor entries when executing dynamically links apps.
*/
ELF_PLAT_INIT(regs, reloc_func_desc);
#endif
start_thread(regs, elf_entry, bprm->p);
retval = 0;
out:
kfree(loc);
out_ret:
return retval;
/* error cleanup */
out_free_dentry:
kfree(interp_elf_phdata);
allow_write_access(interpreter);
if (interpreter)
fput(interpreter);
out_free_interp:
kfree(elf_interpreter);
out_free_ph:
kfree(elf_phdata);
goto out;
}
| 16,519 |
169,726 | 0 | void ServiceWorkerContainer::dispatchMessageEvent(WebPassOwnPtr<WebServiceWorker::Handle> handle, const WebString& message, const WebMessagePortChannelArray& webChannels)
{
if (!getExecutionContext() || !getExecutionContext()->executingWindow())
return;
MessagePortArray* ports = MessagePort::toMessagePortArray(getExecutionContext(), webChannels);
RefPtr<SerializedScriptValue> value = SerializedScriptValueFactory::instance().createFromWire(message);
ServiceWorker* source = ServiceWorker::from(getExecutionContext(), handle.release());
dispatchEvent(ServiceWorkerMessageEvent::create(ports, value, source, getExecutionContext()->getSecurityOrigin()->toString()));
}
| 16,520 |
9,623 | 0 | static inline void php_rshutdown_session_globals(TSRMLS_D) /* {{{ */
{
if (PS(http_session_vars)) {
zval_ptr_dtor(&PS(http_session_vars));
PS(http_session_vars) = NULL;
}
/* Do NOT destroy PS(mod_user_names) here! */
if (PS(mod_data) || PS(mod_user_implemented)) {
zend_try {
PS(mod)->s_close(&PS(mod_data) TSRMLS_CC);
} zend_end_try();
}
if (PS(id)) {
efree(PS(id));
PS(id) = NULL;
}
}
/* }}} */
| 16,521 |
37,413 | 0 | static void drop_spte(struct kvm *kvm, u64 *sptep)
{
if (mmu_spte_clear_track_bits(sptep))
rmap_remove(kvm, sptep);
}
| 16,522 |
75,827 | 0 | instance_handler(vector_t *strvec)
{
if (!strvec)
return;
if (!reload) {
if (!global_data->instance_name) {
global_data->instance_name = set_value(strvec);
use_pid_dir = true;
}
else
report_config_error(CONFIG_GENERAL_ERROR, "Duplicate instance definition %s - ignoring", FMT_STR_VSLOT(strvec, 1));
}
}
| 16,523 |
52,916 | 0 | static int do_qib_user_sdma_queue_create(struct file *fp)
{
struct qib_filedata *fd = fp->private_data;
struct qib_ctxtdata *rcd = fd->rcd;
struct qib_devdata *dd = rcd->dd;
if (dd->flags & QIB_HAS_SEND_DMA) {
fd->pq = qib_user_sdma_queue_create(&dd->pcidev->dev,
dd->unit,
rcd->ctxt,
fd->subctxt);
if (!fd->pq)
return -ENOMEM;
}
return 0;
}
| 16,524 |
138,769 | 0 | void RenderFrameHostImpl::OnSmartClipDataExtracted(uint32_t id,
base::string16 text,
base::string16 html) {
auto it = smart_clip_callbacks_.find(id);
if (it != smart_clip_callbacks_.end()) {
it->second.Run(text, html);
smart_clip_callbacks_.erase(it);
} else {
NOTREACHED() << "Received smartclip data response for unknown request";
}
}
| 16,525 |
44,995 | 0 | AP_DECLARE_NONSTD(int) ap_rprintf(request_rec *r, const char *fmt, ...)
{
va_list va;
int n;
if (r->connection->aborted)
return -1;
va_start(va, fmt);
n = ap_vrprintf(r, fmt, va);
va_end(va);
return n;
}
| 16,526 |
74,994 | 0 | draw_persons(int layer, bool is_flipped, int cam_x, int cam_y)
{
person_t* person;
spriteset_t* sprite;
int w, h;
double x, y;
int i;
for (i = 0; i < s_num_persons; ++i) {
person = s_persons[i];
if (!person->is_visible || person->layer != layer)
continue;
sprite = person->sprite;
w = spriteset_width(sprite);
h = spriteset_height(sprite);
person_get_xy(person, &x, &y, true);
x -= cam_x - person->x_offset;
y -= cam_y - person->y_offset;
spriteset_draw(sprite, person->mask, is_flipped, person->theta, person->scale_x, person->scale_y,
person->direction, trunc(x), trunc(y), person->frame);
}
}
| 16,527 |
80,100 | 0 | GF_Err extr_Read(GF_Box *s, GF_BitStream *bs)
{
GF_Err e;
GF_ExtraDataBox *ptr = (GF_ExtraDataBox *)s;
e = gf_isom_box_parse((GF_Box**) &ptr->feci, bs);
if (e) return e;
if (ptr->feci->size>ptr->size) return GF_ISOM_INVALID_MEDIA;
ptr->data_length = (u32) (ptr->size - ptr->feci->size);
ptr->data = gf_malloc(sizeof(char)*ptr->data_length);
gf_bs_read_data(bs, ptr->data, ptr->data_length);
return GF_OK;
}
| 16,528 |
8,072 | 0 | void Gfx::display(Object *obj, GBool topLevel) {
Object obj2;
int i;
if (obj->isArray()) {
for (i = 0; i < obj->arrayGetLength(); ++i) {
obj->arrayGet(i, &obj2);
if (!obj2.isStream()) {
error(-1, "Weird page contents");
obj2.free();
return;
}
obj2.free();
}
} else if (!obj->isStream()) {
error(-1, "Weird page contents");
return;
}
parser = new Parser(xref, new Lexer(xref, obj), gFalse);
go(topLevel);
delete parser;
parser = NULL;
}
| 16,529 |
165,708 | 0 | void FileReaderLoader::Cleanup() {
handle_watcher_.Cancel();
consumer_handle_.reset();
if (error_code_ != FileErrorCode::kOK) {
raw_data_.reset();
string_result_ = "";
is_raw_data_converted_ = true;
decoder_.reset();
array_buffer_result_ = nullptr;
UnadjustReportedMemoryUsageToV8();
}
}
| 16,530 |
1,305 | 0 | GBool SplashFTFont::getGlyph(int c, int xFrac, int yFrac,
SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes) {
return SplashFont::getGlyph(c, xFrac, 0, bitmap, x0, y0, clip, clipRes);
}
| 16,531 |
101,663 | 0 | gfx::Rect Browser::GetInstantBounds() {
return window()->GetInstantBounds();
}
| 16,532 |
183,528 | 1 | bool GpuProcessPolicy::PreSandboxHook() {
// Warm up resources needed by the policy we're about to enable and
// eventually start a broker process.
const bool chromeos_arm_gpu = IsChromeOS() && IsArchitectureArm();
// This policy is for x86 or Desktop.
DCHECK(!chromeos_arm_gpu);
DCHECK(!broker_process());
// Create a new broker process.
InitGpuBrokerProcess(
GpuBrokerProcessPolicy::Create,
std::vector<BrokerFilePermission>()); // No extra files in whitelist.
if (IsArchitectureX86_64() || IsArchitectureI386()) {
// Accelerated video dlopen()'s some shared objects
// inside the sandbox, so preload them now.
if (IsAcceleratedVaapiVideoEncodeEnabled() ||
IsAcceleratedVideoDecodeEnabled()) {
const char* I965DrvVideoPath = NULL;
const char* I965HybridDrvVideoPath = NULL;
if (IsArchitectureX86_64()) {
I965DrvVideoPath = "/usr/lib64/va/drivers/i965_drv_video.so";
I965HybridDrvVideoPath = "/usr/lib64/va/drivers/hybrid_drv_video.so";
} else if (IsArchitectureI386()) {
I965DrvVideoPath = "/usr/lib/va/drivers/i965_drv_video.so";
}
dlopen(I965DrvVideoPath, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
if (I965HybridDrvVideoPath)
dlopen(I965HybridDrvVideoPath, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
dlopen("libva.so.1", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
#if defined(USE_OZONE)
dlopen("libva-drm.so.1", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
#elif defined(USE_X11)
dlopen("libva-x11.so.1", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
#endif
}
}
return true;
}
| 16,533 |
151,016 | 0 | void DevToolsUIBindings::PerformActionOnRemotePage(const std::string& page_id,
const std::string& action) {
if (!remote_targets_handler_)
return;
scoped_refptr<content::DevToolsAgentHost> host =
remote_targets_handler_->GetTarget(page_id);
if (!host)
return;
if (action == kRemotePageActionInspect)
delegate_->Inspect(host);
else if (action == kRemotePageActionReload)
host->Reload();
else if (action == kRemotePageActionActivate)
host->Activate();
else if (action == kRemotePageActionClose)
host->Close();
}
| 16,534 |
45,517 | 0 | static u8 *crypto_authenc_ahash(struct aead_request *req, unsigned int flags)
{
struct crypto_aead *authenc = crypto_aead_reqtfm(req);
struct crypto_authenc_ctx *ctx = crypto_aead_ctx(authenc);
struct crypto_ahash *auth = ctx->auth;
struct authenc_request_ctx *areq_ctx = aead_request_ctx(req);
struct ahash_request *ahreq = (void *)(areq_ctx->tail + ctx->reqoff);
u8 *hash = areq_ctx->tail;
int err;
hash = (u8 *)ALIGN((unsigned long)hash + crypto_ahash_alignmask(auth),
crypto_ahash_alignmask(auth) + 1);
ahash_request_set_tfm(ahreq, auth);
ahash_request_set_crypt(ahreq, areq_ctx->sg, hash,
areq_ctx->cryptlen);
ahash_request_set_callback(ahreq, aead_request_flags(req) & flags,
areq_ctx->complete, req);
err = crypto_ahash_digest(ahreq);
if (err)
return ERR_PTR(err);
return hash;
}
| 16,535 |
27,882 | 0 | static void fuse_lk_fill(struct fuse_req *req, struct file *file,
const struct file_lock *fl, int opcode, pid_t pid,
int flock)
{
struct inode *inode = file->f_path.dentry->d_inode;
struct fuse_conn *fc = get_fuse_conn(inode);
struct fuse_file *ff = file->private_data;
struct fuse_lk_in *arg = &req->misc.lk_in;
arg->fh = ff->fh;
arg->owner = fuse_lock_owner_id(fc, fl->fl_owner);
arg->lk.start = fl->fl_start;
arg->lk.end = fl->fl_end;
arg->lk.type = fl->fl_type;
arg->lk.pid = pid;
if (flock)
arg->lk_flags |= FUSE_LK_FLOCK;
req->in.h.opcode = opcode;
req->in.h.nodeid = get_node_id(inode);
req->in.numargs = 1;
req->in.args[0].size = sizeof(*arg);
req->in.args[0].value = arg;
}
| 16,536 |
164,944 | 0 | int ResourceDispatcherHostImpl::MakeRequestID() {
DCHECK(io_thread_task_runner_->BelongsToCurrentThread());
return --request_id_;
}
| 16,537 |
116,019 | 0 | void ExtensionInstalledBubbleGtk::Show(const Extension* extension,
Browser* browser,
const SkBitmap& icon) {
new ExtensionInstalledBubbleGtk(extension, browser, icon);
}
| 16,538 |
130,042 | 0 | variations::Study_Channel GetChannelForVariations() {
switch (chrome::GetChannel()) {
case version_info::Channel::CANARY:
return variations::Study_Channel_CANARY;
case version_info::Channel::DEV:
return variations::Study_Channel_DEV;
case version_info::Channel::BETA:
return variations::Study_Channel_BETA;
case version_info::Channel::STABLE:
return variations::Study_Channel_STABLE;
case version_info::Channel::UNKNOWN:
break;
}
const std::string forced_channel =
base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kFakeVariationsChannel);
if (forced_channel == "stable")
return variations::Study_Channel_STABLE;
if (forced_channel == "beta")
return variations::Study_Channel_BETA;
if (forced_channel == "dev")
return variations::Study_Channel_DEV;
if (forced_channel == "canary")
return variations::Study_Channel_CANARY;
DVLOG(1) << "Invalid channel provided: " << forced_channel;
return variations::Study_Channel_UNKNOWN;
}
| 16,539 |
138,260 | 0 | void AXObjectCacheImpl::handleValueChanged(Node* node) {
postNotification(node, AXObjectCache::AXValueChanged);
}
| 16,540 |
109,298 | 0 | void InspectorPageAgent::frameStartedLoading(Frame* frame)
{
m_frontend->frameStartedLoading(frameId(frame));
}
| 16,541 |
128,948 | 0 | void fillHole()
{
COMPILE_ASSERT(sizeof(BufferValueType) == 2, BufferValueTypeIsTwoBytes);
if (m_position % 2)
*byteAt(m_position) = static_cast<uint8_t>(PaddingTag);
}
| 16,542 |
179,524 | 1 | static void kvm_unpin_pages(struct kvm *kvm, pfn_t pfn, unsigned long npages)
{
unsigned long i;
for (i = 0; i < npages; ++i)
kvm_release_pfn_clean(pfn + i);
}
| 16,543 |
114,649 | 0 | void WebPluginDelegateProxy::PluginDestroyed() {
#if defined(OS_MACOSX) || defined(OS_WIN)
if (render_view_)
render_view_->PluginFocusChanged(false, instance_id_);
#endif
if (window_)
WillDestroyWindow();
if (render_view_)
render_view_->UnregisterPluginDelegate(this);
if (channel_host_) {
Send(new PluginMsg_DestroyInstance(instance_id_));
channel_host_->RemoveRoute(instance_id_);
channel_host_ = NULL;
}
if (window_script_object_) {
window_script_object_->DeleteSoon();
}
plugin_ = NULL;
MessageLoop::current()->DeleteSoon(FROM_HERE, this);
}
| 16,544 |
108,702 | 0 | protocol::CursorShapeStub* ChromotingInstance::GetCursorShapeStub() {
return this;
}
| 16,545 |
141,633 | 0 | bool IsChangedNode(const AXNode* node) {
return changed_node_ids.find(node->id()) != changed_node_ids.end();
}
| 16,546 |
108,973 | 0 | void RenderViewImpl::OnSetDeviceScaleFactor(float device_scale_factor) {
RenderWidget::OnSetDeviceScaleFactor(device_scale_factor);
if (webview())
webview()->setDeviceScaleFactor(device_scale_factor);
}
| 16,547 |
118,904 | 0 | RendererPreferences* WebContentsImpl::GetMutableRendererPrefs() {
return &renderer_preferences_;
}
| 16,548 |
13,460 | 0 | void js_pushiterator(js_State *J, int idx, int own)
{
js_pushobject(J, jsV_newiterator(J, js_toobject(J, idx), own));
}
| 16,549 |
82,178 | 0 | mrb_false(mrb_state *mrb, mrb_value self)
{
return mrb_false_value();
}
| 16,550 |
1,402 | 0 | load_all_cursors_from_dir(const char *path, int size,
void (*load_callback)(XcursorImages *, void *),
void *user_data)
{
FILE *f;
DIR *dir = opendir(path);
struct dirent *ent;
char *full;
XcursorImages *images;
if (!dir)
return;
for(ent = readdir(dir); ent; ent = readdir(dir)) {
#ifdef _DIRENT_HAVE_D_TYPE
if (ent->d_type != DT_UNKNOWN &&
(ent->d_type != DT_REG && ent->d_type != DT_LNK))
continue;
#endif
full = _XcursorBuildFullname(path, "", ent->d_name);
if (!full)
continue;
f = fopen(full, "r");
if (!f) {
free(full);
continue;
}
images = XcursorFileLoadImages(f, size);
if (images) {
XcursorImagesSetName(images, ent->d_name);
load_callback(images, user_data);
}
fclose (f);
free(full);
}
closedir(dir);
}
| 16,551 |
125,788 | 0 | void ParamTraits<base::FileDescriptor>::Log(const param_type& p,
std::string* l) {
if (p.auto_close) {
l->append(StringPrintf("FD(%d auto-close)", p.fd));
} else {
l->append(StringPrintf("FD(%d)", p.fd));
}
}
| 16,552 |
125,223 | 0 | void RenderMessageFilter::OnUpdateIsDelayed(const IPC::Message& msg) {
render_widget_helper_->DidReceiveBackingStoreMsg(msg);
}
| 16,553 |
52,521 | 0 | static void tipc_write_space(struct sock *sk)
{
struct socket_wq *wq;
rcu_read_lock();
wq = rcu_dereference(sk->sk_wq);
if (skwq_has_sleeper(wq))
wake_up_interruptible_sync_poll(&wq->wait, POLLOUT |
POLLWRNORM | POLLWRBAND);
rcu_read_unlock();
}
| 16,554 |
121,712 | 0 | void AssociateRendererProcessToWorker(EmbeddedWorkerInstance* worker) {
worker->AddProcessReference(
shell()->web_contents()->GetRenderProcessHost()->GetID());
}
| 16,555 |
7,813 | 0 | static inline __maybe_unused void h2s_error(struct h2s *h2s, enum h2_err err)
{
if (h2s->st > H2_SS_IDLE && h2s->st < H2_SS_ERROR) {
h2s->errcode = err;
h2s->st = H2_SS_ERROR;
if (h2s->cs)
h2s->cs->flags |= CS_FL_ERROR;
}
}
| 16,556 |
69,183 | 0 | ZEND_API zval* ZEND_FASTCALL zend_hash_get_current_data_ex(HashTable *ht, HashPosition *pos)
{
uint32_t idx = *pos;
Bucket *p;
IS_CONSISTENT(ht);
if (idx != HT_INVALID_IDX) {
p = ht->arData + idx;
return &p->val;
} else {
return NULL;
}
}
| 16,557 |
121,639 | 0 | void TextIterator::representNodeOffsetZero()
{
if (shouldEmitTabBeforeNode(m_node)) {
if (shouldRepresentNodeOffsetZero())
emitCharacter('\t', m_node->parentNode(), m_node, 0, 0);
} else if (shouldEmitNewlineBeforeNode(m_node)) {
if (shouldRepresentNodeOffsetZero())
emitCharacter('\n', m_node->parentNode(), m_node, 0, 0);
} else if (shouldEmitSpaceBeforeAndAfterNode(m_node)) {
if (shouldRepresentNodeOffsetZero())
emitCharacter(' ', m_node->parentNode(), m_node, 0, 0);
}
}
| 16,558 |
124,595 | 0 | LayoutUnit RenderBlock::minLineHeightForReplacedRenderer(bool isFirstLine, LayoutUnit replacedHeight) const
{
if (!document().inNoQuirksMode() && replacedHeight)
return replacedHeight;
if (!(style(isFirstLine)->lineBoxContain() & LineBoxContainBlock))
return 0;
return std::max<LayoutUnit>(replacedHeight, lineHeight(isFirstLine, isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes));
}
| 16,559 |
48,870 | 0 | static netdev_features_t netdev_fix_features(struct net_device *dev,
netdev_features_t features)
{
/* Fix illegal checksum combinations */
if ((features & NETIF_F_HW_CSUM) &&
(features & (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))) {
netdev_warn(dev, "mixed HW and IP checksum settings.\n");
features &= ~(NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM);
}
/* TSO requires that SG is present as well. */
if ((features & NETIF_F_ALL_TSO) && !(features & NETIF_F_SG)) {
netdev_dbg(dev, "Dropping TSO features since no SG feature.\n");
features &= ~NETIF_F_ALL_TSO;
}
if ((features & NETIF_F_TSO) && !(features & NETIF_F_HW_CSUM) &&
!(features & NETIF_F_IP_CSUM)) {
netdev_dbg(dev, "Dropping TSO features since no CSUM feature.\n");
features &= ~NETIF_F_TSO;
features &= ~NETIF_F_TSO_ECN;
}
if ((features & NETIF_F_TSO6) && !(features & NETIF_F_HW_CSUM) &&
!(features & NETIF_F_IPV6_CSUM)) {
netdev_dbg(dev, "Dropping TSO6 features since no CSUM feature.\n");
features &= ~NETIF_F_TSO6;
}
/* TSO ECN requires that TSO is present as well. */
if ((features & NETIF_F_ALL_TSO) == NETIF_F_TSO_ECN)
features &= ~NETIF_F_TSO_ECN;
/* Software GSO depends on SG. */
if ((features & NETIF_F_GSO) && !(features & NETIF_F_SG)) {
netdev_dbg(dev, "Dropping NETIF_F_GSO since no SG feature.\n");
features &= ~NETIF_F_GSO;
}
/* UFO needs SG and checksumming */
if (features & NETIF_F_UFO) {
/* maybe split UFO into V4 and V6? */
if (!(features & NETIF_F_HW_CSUM) &&
((features & (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM)) !=
(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM))) {
netdev_dbg(dev,
"Dropping NETIF_F_UFO since no checksum offload features.\n");
features &= ~NETIF_F_UFO;
}
if (!(features & NETIF_F_SG)) {
netdev_dbg(dev,
"Dropping NETIF_F_UFO since no NETIF_F_SG feature.\n");
features &= ~NETIF_F_UFO;
}
}
#ifdef CONFIG_NET_RX_BUSY_POLL
if (dev->netdev_ops->ndo_busy_poll)
features |= NETIF_F_BUSY_POLL;
else
#endif
features &= ~NETIF_F_BUSY_POLL;
return features;
}
| 16,560 |
147,152 | 0 | static void ActivityLoggingAccessForIsolatedWorldsPerWorldBindingsLongAttributeAttributeGetterForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Local<v8::Object> holder = info.Holder();
TestObject* impl = V8TestObject::ToImpl(holder);
V8SetReturnValueInt(info, impl->activityLoggingAccessForIsolatedWorldsPerWorldBindingsLongAttribute());
}
| 16,561 |
133,036 | 0 | bool ShouldSendPinchGesture() {
#if defined(OS_WIN)
if (base::win::GetVersion() >= base::win::VERSION_WIN8)
return true;
#endif
static bool pinch_allowed =
CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableViewport) ||
CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnablePinch);
return pinch_allowed;
}
| 16,562 |
151,423 | 0 | RefPtr<WebTaskRunner> FrameFetchContext::GetLoadingTaskRunner() {
if (IsDetached())
return FetchContext::GetLoadingTaskRunner();
return TaskRunnerHelper::Get(TaskType::kNetworking, GetFrame());
}
| 16,563 |
20,863 | 0 | static int msr_io(struct kvm_vcpu *vcpu, struct kvm_msrs __user *user_msrs,
int (*do_msr)(struct kvm_vcpu *vcpu,
unsigned index, u64 *data),
int writeback)
{
struct kvm_msrs msrs;
struct kvm_msr_entry *entries;
int r, n;
unsigned size;
r = -EFAULT;
if (copy_from_user(&msrs, user_msrs, sizeof msrs))
goto out;
r = -E2BIG;
if (msrs.nmsrs >= MAX_IO_MSRS)
goto out;
size = sizeof(struct kvm_msr_entry) * msrs.nmsrs;
entries = memdup_user(user_msrs->entries, size);
if (IS_ERR(entries)) {
r = PTR_ERR(entries);
goto out;
}
r = n = __msr_io(vcpu, &msrs, entries, do_msr);
if (r < 0)
goto out_free;
r = -EFAULT;
if (writeback && copy_to_user(user_msrs->entries, entries, size))
goto out_free;
r = n;
out_free:
kfree(entries);
out:
return r;
}
| 16,564 |
178,612 | 1 | SProcXFixesCreatePointerBarrier(ClientPtr client)
{
REQUEST(xXFixesCreatePointerBarrierReq);
int i;
int i;
CARD16 *in_devices = (CARD16 *) &stuff[1];
swaps(&stuff->length);
swaps(&stuff->num_devices);
REQUEST_FIXED_SIZE(xXFixesCreatePointerBarrierReq, pad_to_int32(stuff->num_devices));
swaps(&stuff->x1);
swaps(&stuff->y1);
swaps(&stuff->x2);
swaps(&stuff->y2);
swapl(&stuff->directions);
for (i = 0; i < stuff->num_devices; i++) {
swaps(in_devices + i);
}
return ProcXFixesVector[stuff->xfixesReqType] (client);
}
| 16,565 |
76,230 | 0 | static int cdrom_ioctl_drive_status(struct cdrom_device_info *cdi,
unsigned long arg)
{
cd_dbg(CD_DO_IOCTL, "entering CDROM_DRIVE_STATUS\n");
if (!(cdi->ops->capability & CDC_DRIVE_STATUS))
return -ENOSYS;
if (!CDROM_CAN(CDC_SELECT_DISC) ||
(arg == CDSL_CURRENT || arg == CDSL_NONE))
return cdi->ops->drive_status(cdi, CDSL_CURRENT);
if (arg >= cdi->capacity)
return -EINVAL;
return cdrom_slot_status(cdi, arg);
}
| 16,566 |
169,412 | 0 | ExtensionNavigationThrottle::WillStartRequest() {
return WillStartOrRedirectRequest();
}
| 16,567 |
80,208 | 0 | GF_Box *mdat_New()
{
ISOM_DECL_BOX_ALLOC(GF_MediaDataBox, GF_ISOM_BOX_TYPE_MDAT);
return (GF_Box *)tmp;
}
| 16,568 |
117,380 | 0 | void BookmarkManagerView::ShowExportBookmarksFileChooser() {
if (select_file_dialog_.get())
select_file_dialog_->ListenerDestroyed();
SelectFileDialog::FileTypeInfo file_type_info;
file_type_info.extensions.resize(1);
file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("html"));
file_type_info.include_all_files = true;
select_file_dialog_ = SelectFileDialog::Create(this);
select_file_dialog_->SelectFile(
SelectFileDialog::SELECT_SAVEAS_FILE, std::wstring(),
FilePath(FILE_PATH_LITERAL("bookmarks.html")), &file_type_info, 0,
L"html", GetWidget()->GetNativeView(),
reinterpret_cast<void*>(IDS_BOOKMARK_MANAGER_EXPORT_MENU));
}
| 16,569 |
11,441 | 0 | fbFetch_a2b2g2r2 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed)
{
const CARD8 *pixel = (const CARD8 *)bits + x;
const CARD8 *end = pixel + width;
while (pixel < end) {
CARD32 p = READ(pixel++);
CARD32 a,r,g,b;
a = ((p & 0xc0) * 0x55) << 18;
b = ((p & 0x30) * 0x55) >> 6;
g = ((p & 0x0c) * 0x55) << 6;
r = ((p & 0x03) * 0x55) << 16;
WRITE(buffer++, a|r|g|b);
}
}
| 16,570 |
98,761 | 0 | void WebPluginDelegateProxy::DestroyCommandBuffer(
CommandBufferProxy* command_buffer) {
DCHECK(command_buffer);
#if defined(ENABLE_GPU)
Send(new PluginMsg_DestroyCommandBuffer(instance_id_));
channel_host_->RemoveRoute(command_buffer->route_id());
delete command_buffer;
#endif
}
| 16,571 |
174,450 | 0 | static bool signal_has_si_addr(int sig) {
switch (sig) {
case SIGBUS:
case SIGFPE:
case SIGILL:
case SIGSEGV:
case SIGTRAP:
return true;
default:
return false;
}
}
| 16,572 |
152,964 | 0 | void PDFiumEngine::DeviceToPage(int page_index,
float device_x,
float device_y,
double* page_x,
double* page_y) {
*page_x = *page_y = 0;
int temp_x = static_cast<int>((device_x + position_.x()) / current_zoom_ -
pages_[page_index]->rect().x());
int temp_y = static_cast<int>((device_y + position_.y()) / current_zoom_ -
pages_[page_index]->rect().y());
FPDF_DeviceToPage(
pages_[page_index]->GetPage(), 0, 0,
pages_[page_index]->rect().width(), pages_[page_index]->rect().height(),
current_rotation_, temp_x, temp_y, page_x, page_y);
}
| 16,573 |
71,613 | 0 | ModuleExport size_t RegisterMVGImage(void)
{
MagickInfo
*entry;
entry=SetMagickInfo("MVG");
entry->decoder=(DecodeImageHandler *) ReadMVGImage;
entry->encoder=(EncodeImageHandler *) WriteMVGImage;
entry->magick=(IsImageFormatHandler *) IsMVG;
entry->adjoin=MagickFalse;
entry->seekable_stream=MagickTrue;
entry->description=ConstantString("Magick Vector Graphics");
entry->module=ConstantString("MVG");
(void) RegisterMagickInfo(entry);
return(MagickImageCoderSignature);
}
| 16,574 |
119,124 | 0 | const std::string& group_name() const { return group_name_; }
| 16,575 |
38,902 | 0 | line_in(PG_FUNCTION_ARGS)
{
char *str = PG_GETARG_CSTRING(0);
LINE *line;
LSEG lseg;
int isopen;
char *s;
line = (LINE *) palloc(sizeof(LINE));
if (path_decode(TRUE, 2, str, &isopen, &s, &(lseg.p[0])) && *s == '\0')
{
if (FPeq(lseg.p[0].x, lseg.p[1].x) && FPeq(lseg.p[0].y, lseg.p[1].y))
ereport(ERROR,
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("invalid line specification: must be two distinct points")));
line_construct_pts(line, &lseg.p[0], &lseg.p[1]);
}
else if (line_decode(str, line))
{
if (FPzero(line->A) && FPzero(line->B))
ereport(ERROR,
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("invalid line specification: A and B cannot both be zero")));
}
else
ereport(ERROR,
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("invalid input syntax for type line: \"%s\"", str)));
PG_RETURN_LINE_P(line);
}
| 16,576 |
29,123 | 0 | static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
u64 cookie, struct page **pages, unsigned int count, int plus)
{
struct inode *dir = dentry->d_inode;
struct nfs4_readdir_arg args = {
.fh = NFS_FH(dir),
.pages = pages,
.pgbase = 0,
.count = count,
.bitmask = NFS_SERVER(dentry->d_inode)->attr_bitmask,
.plus = plus,
};
struct nfs4_readdir_res res;
struct rpc_message msg = {
.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_READDIR],
.rpc_argp = &args,
.rpc_resp = &res,
.rpc_cred = cred,
};
int status;
dprintk("%s: dentry = %s/%s, cookie = %Lu\n", __func__,
dentry->d_parent->d_name.name,
dentry->d_name.name,
(unsigned long long)cookie);
nfs4_setup_readdir(cookie, NFS_I(dir)->cookieverf, dentry, &args);
res.pgbase = args.pgbase;
status = nfs4_call_sync(NFS_SERVER(dir)->client, NFS_SERVER(dir), &msg, &args.seq_args, &res.seq_res, 0);
if (status >= 0) {
memcpy(NFS_I(dir)->cookieverf, res.verifier.data, NFS4_VERIFIER_SIZE);
status += args.pgbase;
}
nfs_invalidate_atime(dir);
dprintk("%s: returns %d\n", __func__, status);
return status;
}
| 16,577 |
149,897 | 0 | void LayerTreeHostImpl::BeginCommit() {
TRACE_EVENT0("cc", "LayerTreeHostImpl::BeginCommit");
if (compositor_frame_sink_)
compositor_frame_sink_->ForceReclaimResources();
if (!CommitToActiveTree())
CreatePendingTree();
}
| 16,578 |
136,463 | 0 | PaintChunksToCcLayerTest() : ScopedSlimmingPaintV2ForTest(true) {}
| 16,579 |
121,991 | 0 | void AppListController::OnSigninStatusChanged() {
if (current_view_)
current_view_->OnSigninStatusChanged();
}
| 16,580 |
113,346 | 0 | virtual ~FFmpegVideoDecoderTest() {}
| 16,581 |
81,790 | 0 | int streamDeleteItem(stream *s, streamID *id) {
int deleted = 0;
streamIterator si;
streamIteratorStart(&si,s,id,id,0);
streamID myid;
int64_t numfields;
if (streamIteratorGetID(&si,&myid,&numfields)) {
streamIteratorRemoveEntry(&si,&myid);
deleted = 1;
}
return deleted;
}
| 16,582 |
83,650 | 0 | int git_index__changed_relative_to(
git_index *index, const git_oid *checksum)
{
/* attempt to update index (ignoring errors) */
if (git_index_read(index, false) < 0)
giterr_clear();
return !!git_oid_cmp(&index->checksum, checksum);
}
| 16,583 |
188,067 | 1 | WORD32 ih264d_parse_islice_data_cavlc(dec_struct_t * ps_dec,
dec_slice_params_t * ps_slice,
UWORD16 u2_first_mb_in_slice)
{
UWORD8 uc_more_data_flag;
UWORD8 u1_num_mbs, u1_mb_idx;
dec_mb_info_t *ps_cur_mb_info;
deblk_mb_t *ps_cur_deblk_mb;
dec_bit_stream_t * const ps_bitstrm = ps_dec->ps_bitstrm;
UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
UWORD16 i2_pic_wdin_mbs = ps_dec->u2_frm_wd_in_mbs;
WORD16 i2_cur_mb_addr;
UWORD8 u1_mbaff;
UWORD8 u1_num_mbs_next, u1_end_of_row, u1_tfr_n_mb;
WORD32 ret = OK;
ps_dec->u1_qp = ps_slice->u1_slice_qp;
ih264d_update_qp(ps_dec, 0);
u1_mbaff = ps_slice->u1_mbaff_frame_flag;
/* initializations */
u1_mb_idx = ps_dec->u1_mb_idx;
u1_num_mbs = u1_mb_idx;
uc_more_data_flag = 1;
i2_cur_mb_addr = u2_first_mb_in_slice << u1_mbaff;
do
{
UWORD8 u1_mb_type;
ps_dec->pv_prev_mb_parse_tu_coeff_data = ps_dec->pv_parse_tu_coeff_data;
if(i2_cur_mb_addr > ps_dec->ps_cur_sps->u2_max_mb_addr)
{
ret = ERROR_MB_ADDRESS_T;
break;
}
ps_cur_mb_info = ps_dec->ps_nmb_info + u1_num_mbs;
ps_dec->u4_num_mbs_cur_nmb = u1_num_mbs;
ps_dec->u4_num_pmbair = (u1_num_mbs >> u1_mbaff);
ps_cur_mb_info->u1_end_of_slice = 0;
/***************************************************************/
/* Get the required information for decoding of MB */
/* mb_x, mb_y , neighbour availablity, */
/***************************************************************/
ps_dec->pf_get_mb_info(ps_dec, i2_cur_mb_addr, ps_cur_mb_info, 0);
/***************************************************************/
/* Set the deblocking parameters for this MB */
/***************************************************************/
ps_cur_deblk_mb = ps_dec->ps_deblk_mbn + u1_num_mbs;
if(ps_dec->u4_app_disable_deblk_frm == 0)
ih264d_set_deblocking_parameters(ps_cur_deblk_mb, ps_slice,
ps_dec->u1_mb_ngbr_availablity,
ps_dec->u1_cur_mb_fld_dec_flag);
ps_cur_deblk_mb->u1_mb_type = ps_cur_deblk_mb->u1_mb_type | D_INTRA_MB;
/**************************************************************/
/* Macroblock Layer Begins, Decode the u1_mb_type */
/**************************************************************/
{
UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst;
UWORD32 u4_word, u4_ldz, u4_temp;
/***************************************************************/
/* Find leading zeros in next 32 bits */
/***************************************************************/
NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf);
u4_ldz = CLZ(u4_word);
/* Flush the ps_bitstrm */
u4_bitstream_offset += (u4_ldz + 1);
/* Read the suffix from the ps_bitstrm */
u4_word = 0;
if(u4_ldz)
GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf,
u4_ldz);
*pu4_bitstrm_ofst = u4_bitstream_offset;
u4_temp = ((1 << u4_ldz) + u4_word - 1);
if(u4_temp > 25)
return ERROR_MB_TYPE;
u1_mb_type = u4_temp;
}
ps_cur_mb_info->u1_mb_type = u1_mb_type;
COPYTHECONTEXT("u1_mb_type", u1_mb_type);
/**************************************************************/
/* Parse Macroblock data */
/**************************************************************/
if(25 == u1_mb_type)
{
/* I_PCM_MB */
ps_cur_mb_info->ps_curmb->u1_mb_type = I_PCM_MB;
ret = ih264d_parse_ipcm_mb(ps_dec, ps_cur_mb_info, u1_num_mbs);
if(ret != OK)
return ret;
ps_cur_deblk_mb->u1_mb_qp = 0;
}
else
{
ret = ih264d_parse_imb_cavlc(ps_dec, ps_cur_mb_info, u1_num_mbs, u1_mb_type);
if(ret != OK)
return ret;
ps_cur_deblk_mb->u1_mb_qp = ps_dec->u1_qp;
}
if(u1_mbaff)
{
ih264d_update_mbaff_left_nnz(ps_dec, ps_cur_mb_info);
}
/**************************************************************/
/* Get next Macroblock address */
/**************************************************************/
i2_cur_mb_addr++;
uc_more_data_flag = MORE_RBSP_DATA(ps_bitstrm);
/* Store the colocated information */
{
mv_pred_t *ps_mv_nmb_start = ps_dec->ps_mv_cur + (u1_num_mbs << 4);
mv_pred_t s_mvPred =
{
{ 0, 0, 0, 0 },
{ -1, -1 }, 0, 0};
ih264d_rep_mv_colz(ps_dec, &s_mvPred, ps_mv_nmb_start, 0,
(UWORD8)(ps_dec->u1_cur_mb_fld_dec_flag << 1), 4,
4);
}
/*if num _cores is set to 3,compute bs will be done in another thread*/
if(ps_dec->u4_num_cores < 3)
{
if(ps_dec->u4_app_disable_deblk_frm == 0)
ps_dec->pf_compute_bs(ps_dec, ps_cur_mb_info,
(UWORD16)(u1_num_mbs >> u1_mbaff));
}
u1_num_mbs++;
/****************************************************************/
/* Check for End Of Row */
/****************************************************************/
u1_num_mbs_next = i2_pic_wdin_mbs - ps_dec->u2_mbx - 1;
u1_end_of_row = (!u1_num_mbs_next) && (!(u1_mbaff && (u1_num_mbs & 0x01)));
u1_tfr_n_mb = (u1_num_mbs == ps_dec->u1_recon_mb_grp) || u1_end_of_row
|| (!uc_more_data_flag);
ps_cur_mb_info->u1_end_of_slice = (!uc_more_data_flag);
/*H264_DEC_DEBUG_PRINT("Pic: %d Mb_X=%d Mb_Y=%d",
ps_slice->i4_poc >> ps_slice->u1_field_pic_flag,
ps_dec->u2_mbx,ps_dec->u2_mby + (1 - ps_cur_mb_info->u1_topmb));
H264_DEC_DEBUG_PRINT("u1_tfr_n_mb || (!uc_more_data_flag): %d", u1_tfr_n_mb || (!uc_more_data_flag));*/
if(u1_tfr_n_mb || (!uc_more_data_flag))
{
if(ps_dec->u1_separate_parse)
{
ih264d_parse_tfr_nmb(ps_dec, u1_mb_idx, u1_num_mbs,
u1_num_mbs_next, u1_tfr_n_mb, u1_end_of_row);
ps_dec->ps_nmb_info += u1_num_mbs;
}
else
{
ih264d_decode_recon_tfr_nmb(ps_dec, u1_mb_idx, u1_num_mbs,
u1_num_mbs_next, u1_tfr_n_mb,
u1_end_of_row);
}
ps_dec->u2_total_mbs_coded += u1_num_mbs;
if(u1_tfr_n_mb)
u1_num_mbs = 0;
u1_mb_idx = u1_num_mbs;
ps_dec->u1_mb_idx = u1_num_mbs;
}
}
while(uc_more_data_flag);
ps_dec->u4_num_mbs_cur_nmb = 0;
ps_dec->ps_cur_slice->u4_mbs_in_slice = i2_cur_mb_addr
- (u2_first_mb_in_slice << u1_mbaff);
return ret;
}
| 16,584 |
12,527 | 0 | SPR_UpdateEntry(struct rx_call *call, afs_int32 aid, char *name,
struct PrUpdateEntry *uentry)
{
afs_int32 code;
afs_int32 cid = ANONYMOUSID;
code = UpdateEntry(call, aid, name, uentry, &cid);
osi_auditU(call, PTS_UpdEntEvent, code, AUD_ID, aid, AUD_STR, name, AUD_END);
ViceLog(5, ("PTS_UpdateEntry: code %d cid %d aid %d name %s\n", code, cid, aid, name));
return code;
}
| 16,585 |
71,965 | 0 | MagickExport MagickBooleanType GetXMLTreeAttributes(const XMLTreeInfo *xml_info,
SplayTreeInfo *attributes)
{
register ssize_t
i;
assert(xml_info != (XMLTreeInfo *) NULL);
assert((xml_info->signature == MagickSignature) ||
(((const XMLTreeRoot *) xml_info)->signature == MagickSignature));
if (xml_info->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
assert(attributes != (SplayTreeInfo *) NULL);
if (xml_info->attributes == (char **) NULL)
return(MagickTrue);
i=0;
while (xml_info->attributes[i] != (char *) NULL)
{
(void) AddValueToSplayTree(attributes,
ConstantString(xml_info->attributes[i]),
ConstantString(xml_info->attributes[i+1]));
i+=2;
}
return(MagickTrue);
}
| 16,586 |
143,517 | 0 | void CompositorImpl::OnFirstSurfaceActivation(const viz::SurfaceInfo& info) {
NOTREACHED();
}
| 16,587 |
54,012 | 0 | static int ims_pcu_identify_type(struct ims_pcu *pcu, u8 *device_id)
{
int error;
error = ims_pcu_execute_query(pcu, GET_DEVICE_ID);
if (error) {
dev_err(pcu->dev,
"GET_DEVICE_ID command failed, error: %d\n", error);
return error;
}
*device_id = pcu->cmd_buf[IMS_PCU_DATA_OFFSET];
dev_dbg(pcu->dev, "Detected device ID: %d\n", *device_id);
return 0;
}
| 16,588 |
64,386 | 0 | static void vmw_surface_define_encode(const struct vmw_surface *srf,
void *cmd_space)
{
struct vmw_surface_define *cmd = (struct vmw_surface_define *)
cmd_space;
struct drm_vmw_size *src_size;
SVGA3dSize *cmd_size;
uint32_t cmd_len;
int i;
cmd_len = sizeof(cmd->body) + srf->num_sizes * sizeof(SVGA3dSize);
cmd->header.id = SVGA_3D_CMD_SURFACE_DEFINE;
cmd->header.size = cmd_len;
cmd->body.sid = srf->res.id;
cmd->body.surfaceFlags = srf->flags;
cmd->body.format = srf->format;
for (i = 0; i < DRM_VMW_MAX_SURFACE_FACES; ++i)
cmd->body.face[i].numMipLevels = srf->mip_levels[i];
cmd += 1;
cmd_size = (SVGA3dSize *) cmd;
src_size = srf->sizes;
for (i = 0; i < srf->num_sizes; ++i, cmd_size++, src_size++) {
cmd_size->width = src_size->width;
cmd_size->height = src_size->height;
cmd_size->depth = src_size->depth;
}
}
| 16,589 |
104,813 | 0 | void ExtensionService::OnExternalExtensionUpdateUrlFound(
const std::string& id,
const GURL& update_url,
Extension::Location location) {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
CHECK(Extension::IdIsValid(id));
if (GetExtensionById(id, true)) {
return;
}
pending_extension_manager()->AddFromExternalUpdateUrl(
id, update_url, location);
external_extension_url_added_ |= true;
}
| 16,590 |
108,531 | 0 | QuotaManager::QuotaManager(bool is_incognito,
const FilePath& profile_path,
base::SingleThreadTaskRunner* io_thread,
base::SequencedTaskRunner* db_thread,
SpecialStoragePolicy* special_storage_policy)
: is_incognito_(is_incognito),
profile_path_(profile_path),
proxy_(new QuotaManagerProxy(
ALLOW_THIS_IN_INITIALIZER_LIST(this), io_thread)),
db_disabled_(false),
eviction_disabled_(false),
io_thread_(io_thread),
db_thread_(db_thread),
temporary_quota_initialized_(false),
temporary_quota_override_(-1),
desired_available_space_(-1),
special_storage_policy_(special_storage_policy),
weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
get_disk_space_fn_(&base::SysInfo::AmountOfFreeDiskSpace) {
}
| 16,591 |
31,594 | 0 | sctp_disposition_t sctp_sf_do_9_2_reshutack(struct net *net,
const struct sctp_endpoint *ep,
const struct sctp_association *asoc,
const sctp_subtype_t type,
void *arg,
sctp_cmd_seq_t *commands)
{
struct sctp_chunk *chunk = (struct sctp_chunk *) arg;
struct sctp_chunk *reply;
/* Make sure that the chunk has a valid length */
if (!sctp_chunk_length_valid(chunk, sizeof(sctp_chunkhdr_t)))
return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
commands);
/* Since we are not going to really process this INIT, there
* is no point in verifying chunk boundries. Just generate
* the SHUTDOWN ACK.
*/
reply = sctp_make_shutdown_ack(asoc, chunk);
if (NULL == reply)
goto nomem;
/* Set the transport for the SHUTDOWN ACK chunk and the timeout for
* the T2-SHUTDOWN timer.
*/
sctp_add_cmd_sf(commands, SCTP_CMD_SETUP_T2, SCTP_CHUNK(reply));
/* and restart the T2-shutdown timer. */
sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_RESTART,
SCTP_TO(SCTP_EVENT_TIMEOUT_T2_SHUTDOWN));
sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(reply));
return SCTP_DISPOSITION_CONSUME;
nomem:
return SCTP_DISPOSITION_NOMEM;
}
| 16,592 |
133,652 | 0 | bool SVGAnimateElement::calculateFromAndToValues(const String& fromString, const String& toString)
{
SVGElement* targetElement = this->targetElement();
if (!targetElement)
return false;
determinePropertyValueTypes(fromString, toString);
ensureAnimator()->calculateFromAndToValues(m_fromType, m_toType, fromString, toString);
ASSERT(m_animatedPropertyType == m_animator->type());
return true;
}
| 16,593 |
153,660 | 0 | bool GLES2Implementation::GetActiveAttribHelper(GLuint program,
GLuint index,
GLsizei bufsize,
GLsizei* length,
GLint* size,
GLenum* type,
char* name) {
helper_->SetBucketSize(kResultBucketId, 0);
typedef cmds::GetActiveAttrib::Result Result;
auto result = GetResultAs<Result>();
if (!result) {
return false;
}
result->success = false;
helper_->GetActiveAttrib(program, index, kResultBucketId, GetResultShmId(),
result.offset());
WaitForCmd();
bool success = !!result->success;
if (success) {
if (size) {
*size = result->size;
}
if (type) {
*type = result->type;
}
GetResultNameHelper(bufsize, length, name);
}
return success;
}
| 16,594 |
122,383 | 0 | const AtomicString& HTMLKeygenElement::formControlType() const
{
DEFINE_STATIC_LOCAL(const AtomicString, keygen, ("keygen", AtomicString::ConstructFromLiteral));
return keygen;
}
| 16,595 |
174,499 | 0 | status_t BufferQueueConsumer::disableAsyncBuffer() {
ATRACE_CALL();
Mutex::Autolock lock(mCore->mMutex);
if (mCore->mConsumerListener != NULL) {
BQ_LOGE("disableAsyncBuffer: consumer already connected");
return INVALID_OPERATION;
}
BQ_LOGV("disableAsyncBuffer");
mCore->mUseAsyncBuffer = false;
return NO_ERROR;
}
| 16,596 |
172,716 | 0 | status_t MediaRecorder::setPreviewSurface(const sp<IGraphicBufferProducer>& surface)
{
ALOGV("setPreviewSurface(%p)", surface.get());
if (mMediaRecorder == NULL) {
ALOGE("media recorder is not initialized yet");
return INVALID_OPERATION;
}
if (!(mCurrentState & MEDIA_RECORDER_DATASOURCE_CONFIGURED)) {
ALOGE("setPreviewSurface called in an invalid state(%d)", mCurrentState);
return INVALID_OPERATION;
}
if (!mIsVideoSourceSet) {
ALOGE("try to set preview surface without setting the video source first");
return INVALID_OPERATION;
}
status_t ret = mMediaRecorder->setPreviewSurface(surface);
if (OK != ret) {
ALOGV("setPreviewSurface failed: %d", ret);
mCurrentState = MEDIA_RECORDER_ERROR;
return ret;
}
return ret;
}
| 16,597 |
145,056 | 0 | BlinkMediaTestSuite::~BlinkMediaTestSuite() {}
| 16,598 |
11,049 | 0 | NTSTATUS allow_new_trans(struct trans_state *list, int mid)
{
int count = 0;
for (; list != NULL; list = list->next) {
if (list->mid == mid) {
return NT_STATUS_INVALID_PARAMETER;
}
count += 1;
}
if (count > 5) {
return NT_STATUS_INSUFFICIENT_RESOURCES;
}
return NT_STATUS_OK;
}
| 16,599 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.