unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
117,575 | 0 | gfx::Rect SettingLevelBubbleDelegateView::GetAnchorRect() {
gfx::Size view_size = GetPreferredSize();
gfx::Rect monitor_area = gfx::Screen::GetMonitorAreaNearestWindow(NULL);
return (gfx::Rect(
monitor_area.x() + kBubbleXRatio * monitor_area.width(),
monitor_area.bottom() - view_size.height() / 2 - kBubbleBottomGap, 0, 0));
}
| 5,500 |
104,320 | 0 | static void PrepareStringForFileOps(const FilePath& text,
FilePath::StringType* output) {
#if defined(OS_WIN)
TrimWhitespace(text.value(), TRIM_ALL, output);
replace(output->begin(), output->end(), '/', '\\');
#else
TrimWhitespaceUTF8(text.value(), TRIM_ALL, output);
#endif
}
| 5,501 |
86,526 | 0 | static int test_signed_short_formatting(void)
{
int i, j;
int num_sshort_tests;
int failed = 0;
#if (SIZEOF_SHORT == 1)
i=1; ss_test[i].num = 0x7F; ss_test[i].expected = "127";
i++; ss_test[i].num = 0x70; ss_test[i].expected = "112";
i++; ss_test[i].num = 0x07; ss_test[i].expected = "7";
i++; ss_test[i].num = 0x50; ss_test[i].expected = "80";
i++; ss_test[i].num = 0x05; ss_test[i].expected = "5";
i++; ss_test[i].num = 0x01; ss_test[i].expected = "1";
i++; ss_test[i].num = 0x00; ss_test[i].expected = "0";
i++; ss_test[i].num = -0x7F -1; ss_test[i].expected = "-128";
i++; ss_test[i].num = -0x70 -1; ss_test[i].expected = "-113";
i++; ss_test[i].num = -0x07 -1; ss_test[i].expected = "-8";
i++; ss_test[i].num = -0x50 -1; ss_test[i].expected = "-81";
i++; ss_test[i].num = -0x05 -1; ss_test[i].expected = "-6";
i++; ss_test[i].num = 0x00 -1; ss_test[i].expected = "-1";
num_sshort_tests = i;
#elif (SIZEOF_SHORT == 2)
i=1; ss_test[i].num = 0x7FFF; ss_test[i].expected = "32767";
i++; ss_test[i].num = 0x7FFE; ss_test[i].expected = "32766";
i++; ss_test[i].num = 0x7FFD; ss_test[i].expected = "32765";
i++; ss_test[i].num = 0x7F00; ss_test[i].expected = "32512";
i++; ss_test[i].num = 0x07F0; ss_test[i].expected = "2032";
i++; ss_test[i].num = 0x007F; ss_test[i].expected = "127";
i++; ss_test[i].num = 0x7000; ss_test[i].expected = "28672";
i++; ss_test[i].num = 0x0700; ss_test[i].expected = "1792";
i++; ss_test[i].num = 0x0070; ss_test[i].expected = "112";
i++; ss_test[i].num = 0x0007; ss_test[i].expected = "7";
i++; ss_test[i].num = 0x5000; ss_test[i].expected = "20480";
i++; ss_test[i].num = 0x0500; ss_test[i].expected = "1280";
i++; ss_test[i].num = 0x0050; ss_test[i].expected = "80";
i++; ss_test[i].num = 0x0005; ss_test[i].expected = "5";
i++; ss_test[i].num = 0x0001; ss_test[i].expected = "1";
i++; ss_test[i].num = 0x0000; ss_test[i].expected = "0";
i++; ss_test[i].num = -0x7FFF -1; ss_test[i].expected = "-32768";
i++; ss_test[i].num = -0x7FFE -1; ss_test[i].expected = "-32767";
i++; ss_test[i].num = -0x7FFD -1; ss_test[i].expected = "-32766";
i++; ss_test[i].num = -0x7F00 -1; ss_test[i].expected = "-32513";
i++; ss_test[i].num = -0x07F0 -1; ss_test[i].expected = "-2033";
i++; ss_test[i].num = -0x007F -1; ss_test[i].expected = "-128";
i++; ss_test[i].num = -0x7000 -1; ss_test[i].expected = "-28673";
i++; ss_test[i].num = -0x0700 -1; ss_test[i].expected = "-1793";
i++; ss_test[i].num = -0x0070 -1; ss_test[i].expected = "-113";
i++; ss_test[i].num = -0x0007 -1; ss_test[i].expected = "-8";
i++; ss_test[i].num = -0x5000 -1; ss_test[i].expected = "-20481";
i++; ss_test[i].num = -0x0500 -1; ss_test[i].expected = "-1281";
i++; ss_test[i].num = -0x0050 -1; ss_test[i].expected = "-81";
i++; ss_test[i].num = -0x0005 -1; ss_test[i].expected = "-6";
i++; ss_test[i].num = 0x0000 -1; ss_test[i].expected = "-1";
num_sshort_tests = i;
#elif (SIZEOF_SHORT == 4)
i=1; ss_test[i].num = 0x7FFFFFFF; ss_test[i].expected = "2147483647";
i++; ss_test[i].num = 0x7FFFFFFE; ss_test[i].expected = "2147483646";
i++; ss_test[i].num = 0x7FFFFFFD; ss_test[i].expected = "2147483645";
i++; ss_test[i].num = 0x7FFF0000; ss_test[i].expected = "2147418112";
i++; ss_test[i].num = 0x00007FFF; ss_test[i].expected = "32767";
i++; ss_test[i].num = 0x7F000000; ss_test[i].expected = "2130706432";
i++; ss_test[i].num = 0x007F0000; ss_test[i].expected = "8323072";
i++; ss_test[i].num = 0x00007F00; ss_test[i].expected = "32512";
i++; ss_test[i].num = 0x0000007F; ss_test[i].expected = "127";
i++; ss_test[i].num = 0x70000000; ss_test[i].expected = "1879048192";
i++; ss_test[i].num = 0x07000000; ss_test[i].expected = "117440512";
i++; ss_test[i].num = 0x00700000; ss_test[i].expected = "7340032";
i++; ss_test[i].num = 0x00070000; ss_test[i].expected = "458752";
i++; ss_test[i].num = 0x00007000; ss_test[i].expected = "28672";
i++; ss_test[i].num = 0x00000700; ss_test[i].expected = "1792";
i++; ss_test[i].num = 0x00000070; ss_test[i].expected = "112";
i++; ss_test[i].num = 0x00000007; ss_test[i].expected = "7";
i++; ss_test[i].num = 0x50000000; ss_test[i].expected = "1342177280";
i++; ss_test[i].num = 0x05000000; ss_test[i].expected = "83886080";
i++; ss_test[i].num = 0x00500000; ss_test[i].expected = "5242880";
i++; ss_test[i].num = 0x00050000; ss_test[i].expected = "327680";
i++; ss_test[i].num = 0x00005000; ss_test[i].expected = "20480";
i++; ss_test[i].num = 0x00000500; ss_test[i].expected = "1280";
i++; ss_test[i].num = 0x00000050; ss_test[i].expected = "80";
i++; ss_test[i].num = 0x00000005; ss_test[i].expected = "5";
i++; ss_test[i].num = 0x00000001; ss_test[i].expected = "1";
i++; ss_test[i].num = 0x00000000; ss_test[i].expected = "0";
i++; ss_test[i].num = -0x7FFFFFFF -1; ss_test[i].expected = "-2147483648";
i++; ss_test[i].num = -0x7FFFFFFE -1; ss_test[i].expected = "-2147483647";
i++; ss_test[i].num = -0x7FFFFFFD -1; ss_test[i].expected = "-2147483646";
i++; ss_test[i].num = -0x7FFF0000 -1; ss_test[i].expected = "-2147418113";
i++; ss_test[i].num = -0x00007FFF -1; ss_test[i].expected = "-32768";
i++; ss_test[i].num = -0x7F000000 -1; ss_test[i].expected = "-2130706433";
i++; ss_test[i].num = -0x007F0000 -1; ss_test[i].expected = "-8323073";
i++; ss_test[i].num = -0x00007F00 -1; ss_test[i].expected = "-32513";
i++; ss_test[i].num = -0x0000007F -1; ss_test[i].expected = "-128";
i++; ss_test[i].num = -0x70000000 -1; ss_test[i].expected = "-1879048193";
i++; ss_test[i].num = -0x07000000 -1; ss_test[i].expected = "-117440513";
i++; ss_test[i].num = -0x00700000 -1; ss_test[i].expected = "-7340033";
i++; ss_test[i].num = -0x00070000 -1; ss_test[i].expected = "-458753";
i++; ss_test[i].num = -0x00007000 -1; ss_test[i].expected = "-28673";
i++; ss_test[i].num = -0x00000700 -1; ss_test[i].expected = "-1793";
i++; ss_test[i].num = -0x00000070 -1; ss_test[i].expected = "-113";
i++; ss_test[i].num = -0x00000007 -1; ss_test[i].expected = "-8";
i++; ss_test[i].num = -0x50000000 -1; ss_test[i].expected = "-1342177281";
i++; ss_test[i].num = -0x05000000 -1; ss_test[i].expected = "-83886081";
i++; ss_test[i].num = -0x00500000 -1; ss_test[i].expected = "-5242881";
i++; ss_test[i].num = -0x00050000 -1; ss_test[i].expected = "-327681";
i++; ss_test[i].num = -0x00005000 -1; ss_test[i].expected = "-20481";
i++; ss_test[i].num = -0x00000500 -1; ss_test[i].expected = "-1281";
i++; ss_test[i].num = -0x00000050 -1; ss_test[i].expected = "-81";
i++; ss_test[i].num = -0x00000005 -1; ss_test[i].expected = "-6";
i++; ss_test[i].num = 0x00000000 -1; ss_test[i].expected = "-1";
num_sshort_tests = i;
#endif
for(i=1; i<=num_sshort_tests; i++) {
for(j=0; j<BUFSZ; j++)
ss_test[i].result[j] = 'X';
ss_test[i].result[BUFSZ-1] = '\0';
(void)curl_msprintf(ss_test[i].result, "%hd", ss_test[i].num);
if(memcmp(ss_test[i].result,
ss_test[i].expected,
strlen(ss_test[i].expected))) {
printf("signed short test #%.2d: Failed (Expected: %s Got: %s)\n",
i, ss_test[i].expected, ss_test[i].result);
failed++;
}
}
if(!failed)
printf("All curl_mprintf() signed short tests OK!\n");
else
printf("Some curl_mprintf() signed short tests Failed!\n");
return failed;
}
| 5,502 |
21,056 | 0 | static void mem_cgroup_end_move(struct mem_cgroup *memcg)
{
int cpu;
if (!memcg)
return;
get_online_cpus();
spin_lock(&memcg->pcp_counter_lock);
for_each_online_cpu(cpu)
per_cpu(memcg->stat->count[MEM_CGROUP_ON_MOVE], cpu) -= 1;
memcg->nocpu_base.count[MEM_CGROUP_ON_MOVE] -= 1;
spin_unlock(&memcg->pcp_counter_lock);
put_online_cpus();
}
| 5,503 |
83,994 | 0 | GF_Err btrt_Read(GF_Box *s, GF_BitStream *bs)
{
GF_BitRateBox *ptr = (GF_BitRateBox *)s;
ptr->bufferSizeDB = gf_bs_read_u32(bs);
ptr->maxBitrate = gf_bs_read_u32(bs);
ptr->avgBitrate = gf_bs_read_u32(bs);
return GF_OK;
}
| 5,504 |
5,443 | 0 | static void Ins_SCVTCI( INS_ARG )
{
CUR.GS.control_value_cutin = (TT_F26Dot6)args[0];
}
| 5,505 |
172,410 | 0 | void *get_omx_component_factory_fn(void)
{
return(new omx_venc);
}
| 5,506 |
26,376 | 0 | cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
{
int hotcpu = (unsigned long)hcpu;
switch (action) {
case CPU_UP_PREPARE:
case CPU_UP_PREPARE_FROZEN:
watchdog_prepare_cpu(hotcpu);
break;
case CPU_ONLINE:
case CPU_ONLINE_FROZEN:
if (watchdog_enabled)
watchdog_enable(hotcpu);
break;
#ifdef CONFIG_HOTPLUG_CPU
case CPU_UP_CANCELED:
case CPU_UP_CANCELED_FROZEN:
watchdog_disable(hotcpu);
break;
case CPU_DEAD:
case CPU_DEAD_FROZEN:
watchdog_disable(hotcpu);
break;
#endif /* CONFIG_HOTPLUG_CPU */
}
/*
* hardlockup and softlockup are not important enough
* to block cpu bring up. Just always succeed and
* rely on printk output to flag problems.
*/
return NOTIFY_OK;
}
| 5,507 |
68,073 | 0 | void ef_globals_free(void)
{
SAFE_FREE(ef_gbls->source_file);
SAFE_FREE(ef_gbls->output_file);
SAFE_FREE(ef_gbls);
return;
}
| 5,508 |
74,299 | 0 | int read_super(char *source)
{
squashfs_super_block_3 sBlk_3;
struct squashfs_super_block sBlk_4;
/*
* Try to read a Squashfs 4 superblock
*/
read_fs_bytes(fd, SQUASHFS_START, sizeof(struct squashfs_super_block),
&sBlk_4);
swap = sBlk_4.s_magic != SQUASHFS_MAGIC;
SQUASHFS_INSWAP_SUPER_BLOCK(&sBlk_4);
if(sBlk_4.s_magic == SQUASHFS_MAGIC && sBlk_4.s_major == 4 &&
sBlk_4.s_minor == 0) {
s_ops.read_filesystem_tables = read_filesystem_tables_4;
s_ops.squashfs_opendir = squashfs_opendir_4;
s_ops.read_fragment = read_fragment_4;
s_ops.read_block_list = read_block_list_2;
s_ops.read_inode = read_inode_4;
memcpy(&sBlk, &sBlk_4, sizeof(sBlk_4));
/*
* Check the compression type
*/
comp = lookup_compressor_id(sBlk.s.compression);
return TRUE;
}
/*
* Not a Squashfs 4 superblock, try to read a squashfs 3 superblock
* (compatible with 1 and 2 filesystems)
*/
read_fs_bytes(fd, SQUASHFS_START, sizeof(squashfs_super_block_3),
&sBlk_3);
/*
* Check it is a SQUASHFS superblock
*/
swap = 0;
if(sBlk_3.s_magic != SQUASHFS_MAGIC) {
if(sBlk_3.s_magic == SQUASHFS_MAGIC_SWAP) {
squashfs_super_block_3 sblk;
ERROR("Reading a different endian SQUASHFS filesystem "
"on %s\n", source);
SQUASHFS_SWAP_SUPER_BLOCK_3(&sblk, &sBlk_3);
memcpy(&sBlk_3, &sblk, sizeof(squashfs_super_block_3));
swap = 1;
} else {
ERROR("Can't find a SQUASHFS superblock on %s\n",
source);
goto failed_mount;
}
}
sBlk.s.s_magic = sBlk_3.s_magic;
sBlk.s.inodes = sBlk_3.inodes;
sBlk.s.mkfs_time = sBlk_3.mkfs_time;
sBlk.s.block_size = sBlk_3.block_size;
sBlk.s.fragments = sBlk_3.fragments;
sBlk.s.block_log = sBlk_3.block_log;
sBlk.s.flags = sBlk_3.flags;
sBlk.s.s_major = sBlk_3.s_major;
sBlk.s.s_minor = sBlk_3.s_minor;
sBlk.s.root_inode = sBlk_3.root_inode;
sBlk.s.bytes_used = sBlk_3.bytes_used;
sBlk.s.inode_table_start = sBlk_3.inode_table_start;
sBlk.s.directory_table_start = sBlk_3.directory_table_start;
sBlk.s.fragment_table_start = sBlk_3.fragment_table_start;
sBlk.s.lookup_table_start = sBlk_3.lookup_table_start;
sBlk.no_uids = sBlk_3.no_uids;
sBlk.no_guids = sBlk_3.no_guids;
sBlk.uid_start = sBlk_3.uid_start;
sBlk.guid_start = sBlk_3.guid_start;
sBlk.s.xattr_id_table_start = SQUASHFS_INVALID_BLK;
/* Check the MAJOR & MINOR versions */
if(sBlk.s.s_major == 1 || sBlk.s.s_major == 2) {
sBlk.s.bytes_used = sBlk_3.bytes_used_2;
sBlk.uid_start = sBlk_3.uid_start_2;
sBlk.guid_start = sBlk_3.guid_start_2;
sBlk.s.inode_table_start = sBlk_3.inode_table_start_2;
sBlk.s.directory_table_start = sBlk_3.directory_table_start_2;
if(sBlk.s.s_major == 1) {
sBlk.s.block_size = sBlk_3.block_size_1;
sBlk.s.fragment_table_start = sBlk.uid_start;
s_ops.read_filesystem_tables = read_filesystem_tables_1;
s_ops.squashfs_opendir = squashfs_opendir_1;
s_ops.read_block_list = read_block_list_1;
s_ops.read_inode = read_inode_1;
} else {
sBlk.s.fragment_table_start =
sBlk_3.fragment_table_start_2;
s_ops.read_filesystem_tables = read_filesystem_tables_2;
s_ops.squashfs_opendir = squashfs_opendir_1;
s_ops.read_fragment = read_fragment_2;
s_ops.read_block_list = read_block_list_2;
s_ops.read_inode = read_inode_2;
}
} else if(sBlk.s.s_major == 3) {
s_ops.read_filesystem_tables = read_filesystem_tables_3;
s_ops.squashfs_opendir = squashfs_opendir_3;
s_ops.read_fragment = read_fragment_3;
s_ops.read_block_list = read_block_list_2;
s_ops.read_inode = read_inode_3;
} else {
ERROR("Filesystem on %s is (%d:%d), ", source, sBlk.s.s_major,
sBlk.s.s_minor);
ERROR("which is a later filesystem version than I support!\n");
goto failed_mount;
}
/*
* 1.x, 2.x and 3.x filesystems use gzip compression.
*/
comp = lookup_compressor("gzip");
return TRUE;
failed_mount:
return FALSE;
}
| 5,509 |
120,640 | 0 | void Element::setContainsFullScreenElement(bool flag)
{
ensureElementRareData()->setContainsFullScreenElement(flag);
setNeedsStyleRecalc(SyntheticStyleChange);
}
| 5,510 |
90,690 | 0 | static int dec(struct cstate *g, int c)
{
if (c >= '0' && c <= '9') return c - '0';
die(g, "invalid quantifier");
return 0;
}
| 5,511 |
134,228 | 0 | bool BrowserRootView::AreDropTypesRequired() {
return true;
}
| 5,512 |
136,836 | 0 | void LocalDOMWindow::scrollBy(const ScrollToOptions& scroll_to_options) const {
if (!IsCurrentlyDisplayedInFrame())
return;
document()->UpdateStyleAndLayoutIgnorePendingStylesheets();
LocalFrameView* view = GetFrame()->View();
if (!view)
return;
Page* page = GetFrame()->GetPage();
if (!page)
return;
if (GetFrame()->Loader().GetDocumentLoader()) {
GetFrame()
->Loader()
.GetDocumentLoader()
->GetInitialScrollState()
.was_scrolled_by_js = true;
}
double x = 0.0;
double y = 0.0;
if (scroll_to_options.hasLeft())
x = ScrollableArea::NormalizeNonFiniteScroll(scroll_to_options.left());
if (scroll_to_options.hasTop())
y = ScrollableArea::NormalizeNonFiniteScroll(scroll_to_options.top());
ScrollableArea* viewport = view->LayoutViewportScrollableArea();
ScrollOffset current_offset = viewport->GetScrollOffset();
ScrollOffset scaled_delta(x * GetFrame()->PageZoomFactor(),
y * GetFrame()->PageZoomFactor());
FloatPoint new_scaled_position = ScrollOffsetToPosition(
scaled_delta + current_offset, viewport->ScrollOrigin());
if (SnapCoordinator* coordinator = document()->GetSnapCoordinator()) {
new_scaled_position = coordinator->GetSnapPositionForPoint(
*document()->GetLayoutView(), new_scaled_position,
scroll_to_options.hasLeft(), scroll_to_options.hasTop());
}
ScrollBehavior scroll_behavior = kScrollBehaviorAuto;
ScrollableArea::ScrollBehaviorFromString(scroll_to_options.behavior(),
scroll_behavior);
viewport->SetScrollOffset(
ScrollPositionToOffset(new_scaled_position, viewport->ScrollOrigin()),
kProgrammaticScroll, scroll_behavior);
}
| 5,513 |
14,284 | 0 | mysqlnd_old_escape_string(char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC)
{
DBG_ENTER("mysqlnd_old_escape_string");
DBG_RETURN(mysqlnd_cset_escape_slashes(mysqlnd_find_charset_name("latin1"), newstr, escapestr, escapestr_len TSRMLS_CC));
}
| 5,514 |
3,072 | 0 | static int devicepbasecolor(i_ctx_t * i_ctx_p, ref *space, int base, int *stage, int *cont, int *stack_depth)
{
os_ptr op = osp;
*stage = 0;
*cont = 0;
make_int(op, 0);
return 0;
}
| 5,515 |
77,358 | 0 | ofproto_port_is_lacp_current(struct ofproto *ofproto, ofp_port_t ofp_port)
{
struct ofport *ofport = ofproto_get_port(ofproto, ofp_port);
return (ofport && ofproto->ofproto_class->port_is_lacp_current
? ofproto->ofproto_class->port_is_lacp_current(ofport)
: -1);
}
| 5,516 |
27,583 | 0 | midi_synth_hw_control(int dev, unsigned char *event)
{
}
| 5,517 |
84,171 | 0 | ptaExtendArrays(PTA *pta)
{
PROCNAME("ptaExtendArrays");
if (!pta)
return ERROR_INT("pta not defined", procName, 1);
if ((pta->x = (l_float32 *)reallocNew((void **)&pta->x,
sizeof(l_float32) * pta->nalloc,
2 * sizeof(l_float32) * pta->nalloc)) == NULL)
return ERROR_INT("new x array not returned", procName, 1);
if ((pta->y = (l_float32 *)reallocNew((void **)&pta->y,
sizeof(l_float32) * pta->nalloc,
2 * sizeof(l_float32) * pta->nalloc)) == NULL)
return ERROR_INT("new y array not returned", procName, 1);
pta->nalloc = 2 * pta->nalloc;
return 0;
}
| 5,518 |
155,001 | 0 | bool WebGLRenderingContextBase::ValidateShaderType(const char* function_name,
GLenum shader_type) {
switch (shader_type) {
case GL_VERTEX_SHADER:
case GL_FRAGMENT_SHADER:
return true;
case GL_COMPUTE_SHADER:
if (context_type_ != Platform::kWebGL2ComputeContextType) {
SynthesizeGLError(GL_INVALID_ENUM, function_name,
"invalid shader type");
return false;
}
return true;
default:
SynthesizeGLError(GL_INVALID_ENUM, function_name, "invalid shader type");
return false;
}
}
| 5,519 |
58,570 | 0 | SECURITY_STATUS SEC_ENTRY AcceptSecurityContext(PCredHandle phCredential, PCtxtHandle phContext,
PSecBufferDesc pInput, ULONG fContextReq, ULONG TargetDataRep, PCtxtHandle phNewContext,
PSecBufferDesc pOutput, PULONG pfContextAttr, PTimeStamp ptsTimeStamp)
{
char* Name;
SECURITY_STATUS status;
SecurityFunctionTableA* table;
Name = (char*) sspi_SecureHandleGetUpperPointer(phCredential);
if (!Name)
return SEC_E_SECPKG_NOT_FOUND;
table = sspi_GetSecurityFunctionTableAByNameA(Name);
if (!table)
return SEC_E_SECPKG_NOT_FOUND;
if (table->AcceptSecurityContext == NULL)
return SEC_E_UNSUPPORTED_FUNCTION;
status = table->AcceptSecurityContext(phCredential, phContext, pInput, fContextReq,
TargetDataRep, phNewContext, pOutput, pfContextAttr, ptsTimeStamp);
return status;
}
| 5,520 |
146,940 | 0 | LocalFrame* WebLocalFrameImpl::CreateChildFrame(
const AtomicString& name,
HTMLFrameOwnerElement* owner_element) {
DCHECK(client_);
TRACE_EVENT0("blink", "WebLocalFrameImpl::createChildframe");
WebTreeScopeType scope =
GetFrame()->GetDocument() == owner_element->GetTreeScope()
? WebTreeScopeType::kDocument
: WebTreeScopeType::kShadow;
WebFrameOwnerProperties owner_properties(
owner_element->BrowsingContextContainerName(),
owner_element->ScrollingMode(), owner_element->MarginWidth(),
owner_element->MarginHeight(), owner_element->AllowFullscreen(),
owner_element->AllowPaymentRequest(), owner_element->IsDisplayNone(),
owner_element->Csp(), owner_element->AllowedFeatures());
WebLocalFrameImpl* webframe_child =
ToWebLocalFrameImpl(client_->CreateChildFrame(
this, scope, name,
owner_element->getAttribute(
owner_element->SubResourceAttributeName()),
static_cast<WebSandboxFlags>(owner_element->GetSandboxFlags()),
owner_element->ContainerPolicy(), owner_properties));
if (!webframe_child)
return nullptr;
webframe_child->InitializeCoreFrame(*GetFrame()->GetPage(), owner_element,
name);
DCHECK(webframe_child->Parent());
return webframe_child->GetFrame();
}
| 5,521 |
102,496 | 0 | void LayerTreeCoordinator::syncLayerState(WebLayerID id, const WebLayerInfo& info)
{
if (m_shouldSendScrollPositionUpdate) {
m_webPage->send(Messages::LayerTreeCoordinatorProxy::DidChangeScrollPosition(m_visibleContentsRect.location()));
m_shouldSendScrollPositionUpdate = false;
}
m_shouldSyncFrame = true;
m_webPage->send(Messages::LayerTreeCoordinatorProxy::SetCompositingLayerState(id, info));
}
| 5,522 |
10,774 | 0 | static unsigned long ssl_session_hash(const SSL_SESSION *a)
{
unsigned long l;
l=(unsigned long)
((unsigned int) a->session_id[0] )|
((unsigned int) a->session_id[1]<< 8L)|
((unsigned long)a->session_id[2]<<16L)|
((unsigned long)a->session_id[3]<<24L);
return(l);
}
| 5,523 |
45,235 | 0 | psf_get_filelen (SF_PRIVATE *psf)
{ sf_count_t filelen ;
if (psf->virtual_io)
return psf->vio.get_filelen (psf->vio_user_data) ;
filelen = psf_get_filelen_handle (psf->file.handle) ;
if (filelen == -1)
{ psf_log_syserr (psf, errno) ;
return (sf_count_t) -1 ;
} ;
if (filelen == -SFE_BAD_STAT_SIZE)
{ psf->error = SFE_BAD_STAT_SIZE ;
return (sf_count_t) -1 ;
} ;
switch (psf->file.mode)
{ case SFM_WRITE :
filelen = filelen - psf->fileoffset ;
break ;
case SFM_READ :
if (psf->fileoffset > 0 && psf->filelength > 0)
filelen = psf->filelength ;
break ;
case SFM_RDWR :
/*
** Cannot open embedded files SFM_RDWR so we don't need to
** subtract psf->fileoffset. We already have the answer we
** need.
*/
break ;
default :
/* Shouldn't be here, so return error. */
filelen = -1 ;
} ;
return filelen ;
} /* psf_get_filelen */
| 5,524 |
12,830 | 0 | ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp,
long length)
{
ASN1_INTEGER *ret = NULL;
const unsigned char *p;
unsigned char *s;
long len;
int inf, tag, xclass;
int i;
if ((a == NULL) || ((*a) == NULL)) {
if ((ret = M_ASN1_INTEGER_new()) == NULL)
return (NULL);
ret->type = V_ASN1_INTEGER;
} else
ret = (*a);
p = *pp;
inf = ASN1_get_object(&p, &len, &tag, &xclass, length);
if (inf & 0x80) {
i = ASN1_R_BAD_OBJECT_HEADER;
goto err;
}
if (tag != V_ASN1_INTEGER) {
i = ASN1_R_EXPECTING_AN_INTEGER;
goto err;
}
/*
* We must OPENSSL_malloc stuff, even for 0 bytes otherwise it signifies
* a missing NULL parameter.
*/
s = (unsigned char *)OPENSSL_malloc((int)len + 1);
if (s == NULL) {
i = ERR_R_MALLOC_FAILURE;
goto err;
}
ret->type = V_ASN1_INTEGER;
if (len) {
if ((*p == 0) && (len != 1)) {
p++;
len--;
}
memcpy(s, p, (int)len);
p += len;
}
if (ret->data != NULL)
OPENSSL_free(ret->data);
ret->data = s;
ret->length = (int)len;
if (a != NULL)
(*a) = ret;
*pp = p;
return (ret);
err:
ASN1err(ASN1_F_D2I_ASN1_UINTEGER, i);
if ((ret != NULL) && ((a == NULL) || (*a != ret)))
M_ASN1_INTEGER_free(ret);
return (NULL);
}
| 5,525 |
23,851 | 0 | static void tun_cleanup(void)
{
misc_deregister(&tun_miscdev);
rtnl_link_unregister(&tun_link_ops);
}
| 5,526 |
82,095 | 0 | mrb_include_module(mrb_state *mrb, struct RClass *c, struct RClass *m)
{
int changed = include_module_at(mrb, c, find_origin(c), m, 1);
if (changed < 0) {
mrb_raise(mrb, E_ARGUMENT_ERROR, "cyclic include detected");
}
}
| 5,527 |
179,594 | 1 | static int dccp_packet(struct nf_conn *ct, const struct sk_buff *skb,
unsigned int dataoff, enum ip_conntrack_info ctinfo,
u_int8_t pf, unsigned int hooknum,
unsigned int *timeouts)
{
struct net *net = nf_ct_net(ct);
enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo);
struct dccp_hdr _dh, *dh;
u_int8_t type, old_state, new_state;
enum ct_dccp_roles role;
dh = skb_header_pointer(skb, dataoff, sizeof(_dh), &dh);
BUG_ON(dh == NULL);
type = dh->dccph_type;
if (type == DCCP_PKT_RESET &&
!test_bit(IPS_SEEN_REPLY_BIT, &ct->status)) {
/* Tear down connection immediately if only reply is a RESET */
nf_ct_kill_acct(ct, ctinfo, skb);
return NF_ACCEPT;
}
spin_lock_bh(&ct->lock);
role = ct->proto.dccp.role[dir];
old_state = ct->proto.dccp.state;
new_state = dccp_state_table[role][type][old_state];
switch (new_state) {
case CT_DCCP_REQUEST:
if (old_state == CT_DCCP_TIMEWAIT &&
role == CT_DCCP_ROLE_SERVER) {
/* Reincarnation in the reverse direction: reopen and
* reverse client/server roles. */
ct->proto.dccp.role[dir] = CT_DCCP_ROLE_CLIENT;
ct->proto.dccp.role[!dir] = CT_DCCP_ROLE_SERVER;
}
break;
case CT_DCCP_RESPOND:
if (old_state == CT_DCCP_REQUEST)
ct->proto.dccp.handshake_seq = dccp_hdr_seq(dh);
break;
case CT_DCCP_PARTOPEN:
if (old_state == CT_DCCP_RESPOND &&
type == DCCP_PKT_ACK &&
dccp_ack_seq(dh) == ct->proto.dccp.handshake_seq)
set_bit(IPS_ASSURED_BIT, &ct->status);
break;
case CT_DCCP_IGNORE:
/*
* Connection tracking might be out of sync, so we ignore
* packets that might establish a new connection and resync
* if the server responds with a valid Response.
*/
if (ct->proto.dccp.last_dir == !dir &&
ct->proto.dccp.last_pkt == DCCP_PKT_REQUEST &&
type == DCCP_PKT_RESPONSE) {
ct->proto.dccp.role[!dir] = CT_DCCP_ROLE_CLIENT;
ct->proto.dccp.role[dir] = CT_DCCP_ROLE_SERVER;
ct->proto.dccp.handshake_seq = dccp_hdr_seq(dh);
new_state = CT_DCCP_RESPOND;
break;
}
ct->proto.dccp.last_dir = dir;
ct->proto.dccp.last_pkt = type;
spin_unlock_bh(&ct->lock);
if (LOG_INVALID(net, IPPROTO_DCCP))
nf_log_packet(net, pf, 0, skb, NULL, NULL, NULL,
"nf_ct_dccp: invalid packet ignored ");
return NF_ACCEPT;
case CT_DCCP_INVALID:
spin_unlock_bh(&ct->lock);
if (LOG_INVALID(net, IPPROTO_DCCP))
nf_log_packet(net, pf, 0, skb, NULL, NULL, NULL,
"nf_ct_dccp: invalid state transition ");
return -NF_ACCEPT;
}
ct->proto.dccp.last_dir = dir;
ct->proto.dccp.last_pkt = type;
ct->proto.dccp.state = new_state;
spin_unlock_bh(&ct->lock);
if (new_state != old_state)
nf_conntrack_event_cache(IPCT_PROTOINFO, ct);
nf_ct_refresh_acct(ct, ctinfo, skb, timeouts[new_state]);
return NF_ACCEPT;
}
| 5,528 |
72,584 | 0 | static void rb_update_pages(struct ring_buffer_per_cpu *cpu_buffer)
{
int success;
if (cpu_buffer->nr_pages_to_update > 0)
success = rb_insert_pages(cpu_buffer);
else
success = rb_remove_pages(cpu_buffer,
-cpu_buffer->nr_pages_to_update);
if (success)
cpu_buffer->nr_pages += cpu_buffer->nr_pages_to_update;
}
| 5,529 |
43,646 | 0 | static int do_tmpfile(struct nameidata *nd, unsigned flags,
const struct open_flags *op,
struct file *file, int *opened)
{
static const struct qstr name = QSTR_INIT("/", 1);
struct dentry *child;
struct inode *dir;
struct path path;
int error = path_lookupat(nd, flags | LOOKUP_DIRECTORY, &path);
if (unlikely(error))
return error;
error = mnt_want_write(path.mnt);
if (unlikely(error))
goto out;
dir = path.dentry->d_inode;
/* we want directory to be writable */
error = inode_permission(dir, MAY_WRITE | MAY_EXEC);
if (error)
goto out2;
if (!dir->i_op->tmpfile) {
error = -EOPNOTSUPP;
goto out2;
}
child = d_alloc(path.dentry, &name);
if (unlikely(!child)) {
error = -ENOMEM;
goto out2;
}
dput(path.dentry);
path.dentry = child;
error = dir->i_op->tmpfile(dir, child, op->mode);
if (error)
goto out2;
audit_inode(nd->name, child, 0);
/* Don't check for other permissions, the inode was just created */
error = may_open(&path, MAY_OPEN, op->open_flag);
if (error)
goto out2;
file->f_path.mnt = path.mnt;
error = finish_open(file, child, NULL, opened);
if (error)
goto out2;
error = open_check_o_direct(file);
if (error) {
fput(file);
} else if (!(op->open_flag & O_EXCL)) {
struct inode *inode = file_inode(file);
spin_lock(&inode->i_lock);
inode->i_state |= I_LINKABLE;
spin_unlock(&inode->i_lock);
}
out2:
mnt_drop_write(path.mnt);
out:
path_put(&path);
return error;
}
| 5,530 |
7,334 | 0 | string_strncasecmp (const char *string1, const char *string2, int max)
{
int count, diff;
if (!string1 || !string2)
return (string1) ? 1 : ((string2) ? -1 : 0);
count = 0;
while ((count < max) && string1[0] && string2[0])
{
diff = utf8_charcasecmp (string1, string2);
if (diff != 0)
return diff;
string1 = utf8_next_char (string1);
string2 = utf8_next_char (string2);
count++;
}
if (count >= max)
return 0;
else
return (string1[0]) ? 1 : ((string2[0]) ? -1 : 0);
}
| 5,531 |
56,341 | 0 | gdImageRotateBicubicFixed(gdImagePtr src, const float degrees,const int bgColor)
{
const float _angle = (float)((- degrees / 180.0f) * M_PI);
const int src_w = gdImageSX(src);
const int src_h = gdImageSY(src);
const unsigned int new_width = abs((int)(src_w*cos(_angle))) + abs((int)(src_h*sin(_angle) + 0.5f));
const unsigned int new_height = abs((int)(src_w*sin(_angle))) + abs((int)(src_h*cos(_angle) + 0.5f));
const gdFixed f_0_5 = gd_ftofx(0.5f);
const gdFixed f_H = gd_itofx(src_h/2);
const gdFixed f_W = gd_itofx(src_w/2);
const gdFixed f_cos = gd_ftofx(cos(-_angle));
const gdFixed f_sin = gd_ftofx(sin(-_angle));
const gdFixed f_1 = gd_itofx(1);
const gdFixed f_2 = gd_itofx(2);
const gdFixed f_4 = gd_itofx(4);
const gdFixed f_6 = gd_itofx(6);
const gdFixed f_gama = gd_ftofx(1.04f);
unsigned int dst_offset_x;
unsigned int dst_offset_y = 0;
unsigned int i;
gdImagePtr dst;
/* impact perf a bit, but not that much. Implementation for palette
images can be done at a later point.
*/
if (src->trueColor == 0) {
gdImagePaletteToTrueColor(src);
}
dst = gdImageCreateTrueColor(new_width, new_height);
if (dst == NULL) {
return NULL;
}
dst->saveAlphaFlag = 1;
for (i=0; i < new_height; i++) {
unsigned int j;
dst_offset_x = 0;
for (j=0; j < new_width; j++) {
const gdFixed f_i = gd_itofx((int)i - (int)new_height / 2);
const gdFixed f_j = gd_itofx((int)j - (int)new_width / 2);
const gdFixed f_m = gd_mulfx(f_j,f_sin) + gd_mulfx(f_i,f_cos) + f_0_5 + f_H;
const gdFixed f_n = gd_mulfx(f_j,f_cos) - gd_mulfx(f_i,f_sin) + f_0_5 + f_W;
const int m = gd_fxtoi(f_m);
const int n = gd_fxtoi(f_n);
if ((m > 0) && (m < src_h - 1) && (n > 0) && (n < src_w-1)) {
const gdFixed f_f = f_m - gd_itofx(m);
const gdFixed f_g = f_n - gd_itofx(n);
unsigned int src_offset_x[16], src_offset_y[16];
unsigned char red, green, blue, alpha;
gdFixed f_red=0, f_green=0, f_blue=0, f_alpha=0;
int k;
if ((m < 1) || (n < 1)) {
src_offset_x[0] = n;
src_offset_y[0] = m;
} else {
src_offset_x[0] = n - 1;
src_offset_y[0] = m;
}
if (m < 1) {
src_offset_x[1] = n;
src_offset_y[1] = m;
} else {
src_offset_x[1] = n;
src_offset_y[1] = m ;
}
if ((m < 1) || (n >= src_w-1)) {
src_offset_x[2] = - 1;
src_offset_y[2] = - 1;
} else {
src_offset_x[2] = n + 1;
src_offset_y[2] = m ;
}
if ((m < 1) || (n >= src_w-2)) {
src_offset_x[3] = - 1;
src_offset_y[3] = - 1;
} else {
src_offset_x[3] = n + 1 + 1;
src_offset_y[3] = m ;
}
if (n < 1) {
src_offset_x[4] = - 1;
src_offset_y[4] = - 1;
} else {
src_offset_x[4] = n - 1;
src_offset_y[4] = m;
}
src_offset_x[5] = n;
src_offset_y[5] = m;
if (n >= src_w-1) {
src_offset_x[6] = - 1;
src_offset_y[6] = - 1;
} else {
src_offset_x[6] = n + 1;
src_offset_y[6] = m;
}
if (n >= src_w-2) {
src_offset_x[7] = - 1;
src_offset_y[7] = - 1;
} else {
src_offset_x[7] = n + 1 + 1;
src_offset_y[7] = m;
}
if ((m >= src_h-1) || (n < 1)) {
src_offset_x[8] = - 1;
src_offset_y[8] = - 1;
} else {
src_offset_x[8] = n - 1;
src_offset_y[8] = m;
}
if (m >= src_h-1) {
src_offset_x[8] = - 1;
src_offset_y[8] = - 1;
} else {
src_offset_x[9] = n;
src_offset_y[9] = m;
}
if ((m >= src_h-1) || (n >= src_w-1)) {
src_offset_x[10] = - 1;
src_offset_y[10] = - 1;
} else {
src_offset_x[10] = n + 1;
src_offset_y[10] = m;
}
if ((m >= src_h-1) || (n >= src_w-2)) {
src_offset_x[11] = - 1;
src_offset_y[11] = - 1;
} else {
src_offset_x[11] = n + 1 + 1;
src_offset_y[11] = m;
}
if ((m >= src_h-2) || (n < 1)) {
src_offset_x[12] = - 1;
src_offset_y[12] = - 1;
} else {
src_offset_x[12] = n - 1;
src_offset_y[12] = m;
}
if (m >= src_h-2) {
src_offset_x[13] = - 1;
src_offset_y[13] = - 1;
} else {
src_offset_x[13] = n;
src_offset_y[13] = m;
}
if ((m >= src_h-2) || (n >= src_w - 1)) {
src_offset_x[14] = - 1;
src_offset_y[14] = - 1;
} else {
src_offset_x[14] = n + 1;
src_offset_y[14] = m;
}
if ((m >= src_h-2) || (n >= src_w-2)) {
src_offset_x[15] = - 1;
src_offset_y[15] = - 1;
} else {
src_offset_x[15] = n + 1 + 1;
src_offset_y[15] = m;
}
for (k=-1; k<3; k++) {
const gdFixed f = gd_itofx(k)-f_f;
const gdFixed f_fm1 = f - f_1;
const gdFixed f_fp1 = f + f_1;
const gdFixed f_fp2 = f + f_2;
gdFixed f_a = 0, f_b = 0,f_c = 0, f_d = 0;
gdFixed f_RY;
int l;
if (f_fp2 > 0) {
f_a = gd_mulfx(f_fp2,gd_mulfx(f_fp2,f_fp2));
}
if (f_fp1 > 0) {
f_b = gd_mulfx(f_fp1,gd_mulfx(f_fp1,f_fp1));
}
if (f > 0) {
f_c = gd_mulfx(f,gd_mulfx(f,f));
}
if (f_fm1 > 0) {
f_d = gd_mulfx(f_fm1,gd_mulfx(f_fm1,f_fm1));
}
f_RY = gd_divfx((f_a-gd_mulfx(f_4,f_b)+gd_mulfx(f_6,f_c)-gd_mulfx(f_4,f_d)),f_6);
for (l=-1; l< 3; l++) {
const gdFixed f = gd_itofx(l) - f_g;
const gdFixed f_fm1 = f - f_1;
const gdFixed f_fp1 = f + f_1;
const gdFixed f_fp2 = f + f_2;
gdFixed f_a = 0, f_b = 0, f_c = 0, f_d = 0;
gdFixed f_RX, f_R;
const int _k = ((k + 1) * 4) + (l + 1);
register gdFixed f_rs, f_gs, f_bs, f_as;
register int c;
if (f_fp2 > 0) {
f_a = gd_mulfx(f_fp2,gd_mulfx(f_fp2,f_fp2));
}
if (f_fp1 > 0) {
f_b = gd_mulfx(f_fp1,gd_mulfx(f_fp1,f_fp1));
}
if (f > 0) {
f_c = gd_mulfx(f,gd_mulfx(f,f));
}
if (f_fm1 > 0) {
f_d = gd_mulfx(f_fm1,gd_mulfx(f_fm1,f_fm1));
}
f_RX = gd_divfx((f_a - gd_mulfx(f_4, f_b) + gd_mulfx(f_6, f_c) - gd_mulfx(f_4, f_d)), f_6);
f_R = gd_mulfx(f_RY, f_RX);
if ((src_offset_x[_k] <= 0) || (src_offset_y[_k] <= 0) || (src_offset_y[_k] >= src_h) || (src_offset_x[_k] >= src_w)) {
c = bgColor;
} else if ((src_offset_x[_k] <= 1) || (src_offset_y[_k] <= 1) || (src_offset_y[_k] >= (int)src_h - 1) || (src_offset_x[_k] >= (int)src_w - 1)) {
gdFixed f_127 = gd_itofx(127);
c = src->tpixels[src_offset_y[_k]][src_offset_x[_k]];
c = c | (( (int) (gd_fxtof(gd_mulfx(f_R, f_127)) + 50.5f)) << 24);
c = _color_blend(bgColor, c);
} else {
c = src->tpixels[src_offset_y[_k]][src_offset_x[_k]];
}
f_rs = gd_itofx(gdTrueColorGetRed(c));
f_gs = gd_itofx(gdTrueColorGetGreen(c));
f_bs = gd_itofx(gdTrueColorGetBlue(c));
f_as = gd_itofx(gdTrueColorGetAlpha(c));
f_red += gd_mulfx(f_rs, f_R);
f_green += gd_mulfx(f_gs, f_R);
f_blue += gd_mulfx(f_bs, f_R);
f_alpha += gd_mulfx(f_as, f_R);
}
}
red = (unsigned char) CLAMP(gd_fxtoi(gd_mulfx(f_red, f_gama)), 0, 255);
green = (unsigned char) CLAMP(gd_fxtoi(gd_mulfx(f_green, f_gama)), 0, 255);
blue = (unsigned char) CLAMP(gd_fxtoi(gd_mulfx(f_blue, f_gama)), 0, 255);
alpha = (unsigned char) CLAMP(gd_fxtoi(gd_mulfx(f_alpha, f_gama)), 0, 127);
dst->tpixels[dst_offset_y][dst_offset_x] = gdTrueColorAlpha(red, green, blue, alpha);
} else {
dst->tpixels[dst_offset_y][dst_offset_x] = bgColor;
}
dst_offset_x++;
}
dst_offset_y++;
}
return dst;
}
| 5,532 |
57,071 | 0 | static void nfs40_clear_delegation_stateid(struct nfs4_state *state)
{
if (rcu_access_pointer(NFS_I(state->inode)->delegation) != NULL)
nfs_finish_clear_delegation_stateid(state);
}
| 5,533 |
80,335 | 0 | GF_Err pmax_Write(GF_Box *s, GF_BitStream *bs)
{
GF_Err e;
GF_PMAXBox *ptr = (GF_PMAXBox *)s;
if (ptr == NULL) return GF_BAD_PARAM;
e = gf_isom_box_write_header(s, bs);
if (e) return e;
gf_bs_write_u32(bs, ptr->maxSize);
return GF_OK;
}
| 5,534 |
122,642 | 0 | const gfx::ImageSkia& Extension::GetDefaultIcon(bool is_app) {
int id = is_app ? IDR_APP_DEFAULT_ICON : IDR_EXTENSION_DEFAULT_ICON;
return *ResourceBundle::GetSharedInstance().GetImageSkiaNamed(id);
}
| 5,535 |
29,084 | 0 | bool kvm_is_mmio_pfn(pfn_t pfn)
{
if (pfn_valid(pfn)) {
int reserved;
struct page *tail = pfn_to_page(pfn);
struct page *head = compound_trans_head(tail);
reserved = PageReserved(head);
if (head != tail) {
/*
* "head" is not a dangling pointer
* (compound_trans_head takes care of that)
* but the hugepage may have been splitted
* from under us (and we may not hold a
* reference count on the head page so it can
* be reused before we run PageReferenced), so
* we've to check PageTail before returning
* what we just read.
*/
smp_rmb();
if (PageTail(tail))
return reserved;
}
return PageReserved(tail);
}
return true;
}
| 5,536 |
10,076 | 0 | Direct_Move_Orig( EXEC_OP_ TT_GlyphZone zone,
FT_UShort point,
FT_F26Dot6 distance )
{
FT_F26Dot6 v;
#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
FT_ASSERT( !CUR.face->unpatented_hinting );
#endif
v = CUR.GS.freeVector.x;
if ( v != 0 )
zone->org[point].x += TT_MULDIV( distance,
v * 0x10000L,
CUR.F_dot_P );
v = CUR.GS.freeVector.y;
if ( v != 0 )
zone->org[point].y += TT_MULDIV( distance,
v * 0x10000L,
CUR.F_dot_P );
}
| 5,537 |
185,645 | 1 | void TextTrack::addCue(TextTrackCue* cue) {
DCHECK(cue);
// TODO(93143): Add spec-compliant behavior for negative time values.
if (std::isnan(cue->startTime()) || std::isnan(cue->endTime()) ||
cue->startTime() < 0 || cue->endTime() < 0)
return;
// https://html.spec.whatwg.org/multipage/embedded-content.html#dom-texttrack-addcue
// The addCue(cue) method of TextTrack objects, when invoked, must run the
// following steps:
// (Steps 1 and 2 - pertaining to association of rendering rules - are not
// implemented.)
// 3. If the given cue is in a text track list of cues, then remove cue
// from that text track list of cues.
if (TextTrack* cue_track = cue->track())
cue_track->removeCue(cue, ASSERT_NO_EXCEPTION);
// 4. Add cue to the method's TextTrack object's text track's text track list
// of cues.
cue->SetTrack(this);
EnsureTextTrackCueList()->Add(cue);
if (GetCueTimeline() && mode_ != DisabledKeyword())
GetCueTimeline()->AddCue(this, cue);
}
| 5,538 |
143,966 | 0 | png_get_oFFs(png_structp png_ptr, png_infop info_ptr,
png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type)
{
png_debug1(1, "in %s retrieval function", "oFFs");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs)
&& offset_x != NULL && offset_y != NULL && unit_type != NULL)
{
*offset_x = info_ptr->x_offset;
*offset_y = info_ptr->y_offset;
*unit_type = (int)info_ptr->offset_unit_type;
return (PNG_INFO_oFFs);
}
return (0);
}
| 5,539 |
26,693 | 0 | static int nl80211_get_wiphy(struct sk_buff *skb, struct genl_info *info)
{
struct sk_buff *msg;
struct cfg80211_registered_device *dev = info->user_ptr[0];
msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
if (!msg)
return -ENOMEM;
if (nl80211_send_wiphy(msg, info->snd_pid, info->snd_seq, 0, dev) < 0) {
nlmsg_free(msg);
return -ENOBUFS;
}
return genlmsg_reply(msg, info);
}
| 5,540 |
3,910 | 0 | RGBGrayEncoder::RGBGrayEncoder(Stream *strA):
FilterStream(strA) {
bufPtr = bufEnd = buf;
eof = gFalse;
}
| 5,541 |
180,668 | 1 | static int iwch_l2t_send(struct t3cdev *tdev, struct sk_buff *skb, struct l2t_entry *l2e)
{
int error = 0;
struct cxio_rdev *rdev;
rdev = (struct cxio_rdev *)tdev->ulp;
if (cxio_fatal_error(rdev)) {
kfree_skb(skb);
return -EIO;
}
error = l2t_send(tdev, skb, l2e);
if (error < 0)
kfree_skb(skb);
return error;
}
| 5,542 |
181,922 | 1 | static int mem_resize(jas_stream_memobj_t *m, int bufsize)
{
unsigned char *buf;
//assert(m->buf_);
assert(bufsize >= 0);
JAS_DBGLOG(100, ("mem_resize(%p, %d)\n", m, bufsize));
if (!(buf = jas_realloc2(m->buf_, bufsize, sizeof(unsigned char))) &&
bufsize) {
JAS_DBGLOG(100, ("mem_resize realloc failed\n"));
return -1;
}
JAS_DBGLOG(100, ("mem_resize realloc succeeded\n"));
m->buf_ = buf;
m->bufsize_ = bufsize;
return 0;
}
| 5,543 |
95,185 | 0 | static void cmd_xfer(const char *tag, const char *name,
const char *toserver, const char *topart)
{
int r = 0, partial_success = 0, mbox_count = 0;
struct xfer_header *xfer = NULL;
struct xfer_list list = { &imapd_namespace, imapd_userid, NULL, 0, NULL };
struct xfer_item *item, *next;
char *intname = NULL;
/* administrators only please */
/* however, proxys can do this, if their authzid is an admin */
if (!imapd_userisadmin && !imapd_userisproxyadmin) {
r = IMAP_PERMISSION_DENIED;
goto done;
}
if (!strcmp(toserver, config_servername)) {
r = IMAP_BAD_SERVER;
goto done;
}
/* Build list of users/mailboxes to transfer */
if (config_partitiondir(name)) {
/* entire partition */
list.part = name;
mboxlist_findall(NULL, "*", 1, NULL, NULL, xfer_addmbox, &list);
} else {
/* mailbox pattern */
mbname_t *mbname;
intname = mboxname_from_external(name, &imapd_namespace, imapd_userid);
mbname = mbname_from_intname(intname);
if (mbname_localpart(mbname) &&
(mbname_isdeleted(mbname) || strarray_size(mbname_boxes(mbname)))) {
/* targeted a user submailbox */
list.allow_usersubs = 1;
}
mbname_free(&mbname);
mboxlist_findall(NULL, intname, 1, NULL, NULL, xfer_addmbox, &list);
free(intname);
}
r = xfer_init(toserver, &xfer);
if (r) goto done;
for (item = list.mboxes; item; item = next) {
mbentry_t *mbentry = item->mbentry;
/* NOTE: Since XFER can only be used by an admin, and we always connect
* to the destination backend as an admin, we take advantage of the fact
* that admins *always* use a consistent mailbox naming scheme.
* So, 'name' should be used in any command we send to a backend, and
* 'intname' is the internal name to be used for mupdate and findall.
*/
r = 0;
intname = mbentry->name;
xfer->topart = xstrdup(topart ? topart : mbentry->partition);
/* if we are not moving a user, just move the one mailbox */
if (item->state != XFER_MOVING_USER) {
syslog(LOG_INFO, "XFER: mailbox '%s' -> %s!%s",
mbentry->name, xfer->toserver, xfer->topart);
/* is the selected mailbox the one we're moving? */
if (!strcmpsafe(intname, index_mboxname(imapd_index))) {
r = IMAP_MAILBOX_LOCKED;
goto next;
}
/* we're moving this mailbox */
xfer_addusermbox(mbentry, xfer);
mbox_count++;
r = do_xfer(xfer);
} else {
xfer->userid = mboxname_to_userid(intname);
syslog(LOG_INFO, "XFER: user '%s' -> %s!%s",
xfer->userid, xfer->toserver, xfer->topart);
if (!config_getswitch(IMAPOPT_ALLOWUSERMOVES)) {
/* not configured to allow user moves */
r = IMAP_MAILBOX_NOTSUPPORTED;
} else if (!strcmp(xfer->userid, imapd_userid)) {
/* don't move your own inbox, that could be troublesome */
r = IMAP_MAILBOX_NOTSUPPORTED;
} else if (!strncmpsafe(intname, index_mboxname(imapd_index),
strlen(intname))) {
/* selected mailbox is in the namespace we're moving */
r = IMAP_MAILBOX_LOCKED;
}
if (r) goto next;
if (!xfer->use_replication) {
/* set the quotaroot if needed */
r = xfer_setquotaroot(xfer, intname);
if (r) goto next;
/* backport the seen file if needed */
if (xfer->remoteversion < 12) {
r = seen_open(xfer->userid, SEEN_CREATE, &xfer->seendb);
if (r) goto next;
}
}
r = mboxlist_usermboxtree(xfer->userid, xfer_addusermbox,
xfer, MBOXTREE_DELETED);
/* NOTE: mailboxes were added in reverse, so the inbox is
* done last */
r = do_xfer(xfer);
if (r) goto next;
/* this was a successful user move, and we need to delete
certain user meta-data (but not seen state!) */
syslog(LOG_INFO, "XFER: deleting user metadata");
user_deletedata(xfer->userid, 0);
}
next:
if (r) {
if (xfer->userid)
prot_printf(imapd_out, "* NO USER %s (%s)\r\n",
xfer->userid, error_message(r));
else
prot_printf(imapd_out, "* NO MAILBOX \"%s\" (%s)\r\n",
item->extname, error_message(r));
} else {
partial_success = 1;
if (xfer->userid)
prot_printf(imapd_out, "* OK USER %s\r\n", xfer->userid);
else
prot_printf(imapd_out, "* OK MAILBOX \"%s\"\r\n", item->extname);
}
prot_flush(imapd_out);
mboxlist_entry_free(&mbentry);
next = item->next;
free(item);
if (xfer->userid || mbox_count > 1000) {
/* RESTART after each user or after every 1000 mailboxes */
mbox_count = 0;
sync_send_restart(xfer->be->out);
r = sync_parse_response("RESTART", xfer->be->in, NULL);
if (r) goto done;
}
xfer_cleanup(xfer);
if (partial_success) r = 0;
}
done:
if (xfer) xfer_done(&xfer);
imapd_check(NULL, 0);
if (r) {
prot_printf(imapd_out, "%s NO %s\r\n", tag,
error_message(r));
} else {
prot_printf(imapd_out, "%s OK %s\r\n", tag,
error_message(IMAP_OK_COMPLETED));
}
return;
}
| 5,544 |
148,203 | 0 | static void XmlAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Local<v8::Object> holder = info.Holder();
TestObject* impl = V8TestObject::ToImpl(holder);
V8SetReturnValueInt(info, impl->xmlAttribute());
}
| 5,545 |
171,142 | 0 | void MediaPlayerService::AudioOutput::close()
{
ALOGV("close");
sp<AudioTrack> track;
{
Mutex::Autolock lock(mLock);
track = mTrack;
close_l(); // clears mTrack
}
}
| 5,546 |
9,376 | 0 | int statem_flush(SSL *s)
{
s->rwstate = SSL_WRITING;
if (BIO_flush(s->wbio) <= 0) {
return 0;
}
s->rwstate = SSL_NOTHING;
return 1;
}
| 5,547 |
128,929 | 0 | StateBase* doSerializeArrayBuffer(v8::Handle<v8::Value> arrayBuffer, StateBase* next)
{
return doSerialize(arrayBuffer, next);
}
| 5,548 |
15,810 | 0 | void ctdb_tcp_node_connect(struct event_context *ev, struct timed_event *te,
struct timeval t, void *private_data)
{
struct ctdb_node *node = talloc_get_type(private_data,
struct ctdb_node);
struct ctdb_tcp_node *tnode = talloc_get_type(node->private_data,
struct ctdb_tcp_node);
struct ctdb_context *ctdb = node->ctdb;
ctdb_sock_addr sock_in;
int sockin_size;
int sockout_size;
ctdb_sock_addr sock_out;
ctdb_tcp_stop_connection(node);
ZERO_STRUCT(sock_out);
#ifdef HAVE_SOCK_SIN_LEN
sock_out.ip.sin_len = sizeof(sock_out);
#endif
if (ctdb_tcp_get_address(ctdb, node->address.address, &sock_out) != 0) {
return;
}
switch (sock_out.sa.sa_family) {
case AF_INET:
sock_out.ip.sin_port = htons(node->address.port);
break;
case AF_INET6:
sock_out.ip6.sin6_port = htons(node->address.port);
break;
default:
DEBUG(DEBUG_ERR, (__location__ " unknown family %u\n",
sock_out.sa.sa_family));
return;
}
tnode->fd = socket(sock_out.sa.sa_family, SOCK_STREAM, IPPROTO_TCP);
if (tnode->fd == -1) {
DEBUG(DEBUG_ERR, (__location__ "Failed to create socket\n"));
return;
}
set_nonblocking(tnode->fd);
set_close_on_exec(tnode->fd);
DEBUG(DEBUG_DEBUG, (__location__ " Created TCP SOCKET FD:%d\n", tnode->fd));
/* Bind our side of the socketpair to the same address we use to listen
* on incoming CTDB traffic.
* We must specify this address to make sure that the address we expose to
* the remote side is actually routable in case CTDB traffic will run on
* a dedicated non-routeable network.
*/
ZERO_STRUCT(sock_in);
if (ctdb_tcp_get_address(ctdb, ctdb->address.address, &sock_in) != 0) {
DEBUG(DEBUG_ERR, (__location__ " Failed to find our address. Failing bind.\n"));
close(tnode->fd);
return;
}
/* AIX libs check to see if the socket address and length
arguments are consistent with each other on calls like
connect(). Can not get by with just sizeof(sock_in),
need sizeof(sock_in.ip).
*/
switch (sock_in.sa.sa_family) {
case AF_INET:
sockin_size = sizeof(sock_in.ip);
sockout_size = sizeof(sock_out.ip);
break;
case AF_INET6:
sockin_size = sizeof(sock_in.ip6);
sockout_size = sizeof(sock_out.ip6);
break;
default:
DEBUG(DEBUG_ERR, (__location__ " unknown family %u\n",
sock_in.sa.sa_family));
close(tnode->fd);
return;
}
#ifdef HAVE_SOCK_SIN_LEN
sock_in.ip.sin_len = sockin_size;
sock_out.ip.sin_len = sockout_size;
#endif
if (bind(tnode->fd, (struct sockaddr *)&sock_in, sockin_size) == -1) {
DEBUG(DEBUG_ERR, (__location__ "Failed to bind socket %s(%d)\n",
strerror(errno), errno));
close(tnode->fd);
return;
}
if (connect(tnode->fd, (struct sockaddr *)&sock_out, sockout_size) != 0 &&
errno != EINPROGRESS) {
ctdb_tcp_stop_connection(node);
tnode->connect_te = event_add_timed(ctdb->ev, tnode,
timeval_current_ofs(1, 0),
ctdb_tcp_node_connect, node);
return;
}
/* non-blocking connect - wait for write event */
tnode->connect_fde = event_add_fd(node->ctdb->ev, tnode, tnode->fd,
EVENT_FD_WRITE|EVENT_FD_READ,
ctdb_node_connect_write, node);
/* don't give it long to connect - retry in one second. This ensures
that we find a node is up quickly (tcp normally backs off a syn reply
delay by quite a lot) */
tnode->connect_te = event_add_timed(ctdb->ev, tnode, timeval_current_ofs(1, 0),
ctdb_tcp_node_connect, node);
}
| 5,549 |
11,082 | 0 | void smbd_setup_sig_hup_handler(void)
{
struct tevent_signal *se;
se = tevent_add_signal(smbd_event_context(),
smbd_event_context(),
SIGHUP, 0,
smbd_sig_hup_handler,
NULL);
if (!se) {
exit_server("failed to setup SIGHUP handler");
}
}
| 5,550 |
107,602 | 0 | void ewk_view_scroll(Evas_Object* ewkView, Evas_Coord deltaX, Evas_Coord deltaY, Evas_Coord scrollX, Evas_Coord scrollY, Evas_Coord scrollWidth, Evas_Coord scrollHeight, Evas_Coord centerX, Evas_Coord centerY, Evas_Coord centerWidth, Evas_Coord centerHeight, bool mainFrame)
{
DBG("ewkView=%p, delta: %d,%d, scroll: %d,%d+%dx%d, clip: %d,%d+%dx%d",
ewkView, deltaX, deltaY, scrollX, scrollY, scrollWidth, scrollHeight, centerX, centerY, centerWidth, centerHeight);
if ((scrollX != centerX) || (scrollY != centerY) || (scrollWidth != centerWidth) || (scrollHeight != centerHeight))
WRN("scroll region and clip are different! %d,%d+%dx%d and %d,%d+%dx%d",
scrollX, scrollY, scrollWidth, scrollHeight, centerX, centerY, centerWidth, centerHeight);
EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
EINA_SAFETY_ON_TRUE_RETURN(!deltaX && !deltaY);
_ewk_view_scroll_add(priv, deltaX, deltaY, scrollX, scrollY, scrollWidth, scrollHeight, mainFrame);
_ewk_view_smart_changed(smartData);
}
| 5,551 |
108,761 | 0 | void PPB_ImageData_Impl::Unmap() {
backend_->Unmap();
}
| 5,552 |
123,731 | 0 | static bool CreateTemporaryDirInDirImpl(const FilePath& base_dir,
const FilePath::StringType& name_tmpl,
FilePath* new_dir) {
base::ThreadRestrictions::AssertIOAllowed(); // For call to mkdtemp().
DCHECK(name_tmpl.find("XXXXXX") != FilePath::StringType::npos)
<< "Directory name template must contain \"XXXXXX\".";
FilePath sub_dir = base_dir.Append(name_tmpl);
std::string sub_dir_string = sub_dir.value();
char* buffer = const_cast<char*>(sub_dir_string.c_str());
char* dtemp = mkdtemp(buffer);
if (!dtemp) {
DPLOG(ERROR) << "mkdtemp";
return false;
}
*new_dir = FilePath(dtemp);
return true;
}
| 5,553 |
28,050 | 0 | static void decode_rgb_frame(FFV1Context *s, uint8_t *src[3], int w, int h, int stride[3])
{
int x, y, p;
int16_t *sample[4][2];
int lbd = s->avctx->bits_per_raw_sample <= 8;
int bits = s->avctx->bits_per_raw_sample > 0 ? s->avctx->bits_per_raw_sample : 8;
int offset = 1 << bits;
for (x = 0; x < 4; x++) {
sample[x][0] = s->sample_buffer + x * 2 * (w + 6) + 3;
sample[x][1] = s->sample_buffer + (x * 2 + 1) * (w + 6) + 3;
}
s->run_index = 0;
memset(s->sample_buffer, 0, 8 * (w + 6) * sizeof(*s->sample_buffer));
for (y = 0; y < h; y++) {
for (p = 0; p < 3 + s->transparency; p++) {
int16_t *temp = sample[p][0]; // FIXME: try a normal buffer
sample[p][0] = sample[p][1];
sample[p][1] = temp;
sample[p][1][-1]= sample[p][0][0 ];
sample[p][0][ w]= sample[p][0][w-1];
if (lbd)
decode_line(s, w, sample[p], (p + 1)/2, 9);
else
decode_line(s, w, sample[p], (p + 1)/2, bits + 1);
}
for (x = 0; x < w; x++) {
int g = sample[0][1][x];
int b = sample[1][1][x];
int r = sample[2][1][x];
int a = sample[3][1][x];
b -= offset;
r -= offset;
g -= (b + r) >> 2;
b += g;
r += g;
if (lbd)
*((uint32_t*)(src[0] + x*4 + stride[0]*y)) = b + (g<<8) + (r<<16) + (a<<24);
else {
*((uint16_t*)(src[0] + x*2 + stride[0]*y)) = b;
*((uint16_t*)(src[1] + x*2 + stride[1]*y)) = g;
*((uint16_t*)(src[2] + x*2 + stride[2]*y)) = r;
}
}
}
}
| 5,554 |
37,914 | 0 | static int svm_vm_has_apicv(struct kvm *kvm)
{
return 0;
}
| 5,555 |
85,593 | 0 | int hns_rcb_common_init_hw(struct rcb_common_cb *rcb_common)
{
u32 reg_val;
int i;
int port_num = hns_rcb_common_get_port_num(rcb_common);
hns_rcb_comm_exc_irq_en(rcb_common, 0);
reg_val = dsaf_read_dev(rcb_common, RCB_COM_CFG_INIT_FLAG_REG);
if (0x1 != (reg_val & 0x1)) {
dev_err(rcb_common->dsaf_dev->dev,
"RCB_COM_CFG_INIT_FLAG_REG reg = 0x%x\n", reg_val);
return -EBUSY;
}
for (i = 0; i < port_num; i++) {
hns_rcb_set_port_desc_cnt(rcb_common, i, rcb_common->desc_num);
hns_rcb_set_rx_coalesced_frames(
rcb_common, i, HNS_RCB_DEF_RX_COALESCED_FRAMES);
if (!AE_IS_VER1(rcb_common->dsaf_dev->dsaf_ver) &&
!HNS_DSAF_IS_DEBUG(rcb_common->dsaf_dev))
hns_rcb_set_tx_coalesced_frames(
rcb_common, i, HNS_RCB_DEF_TX_COALESCED_FRAMES);
hns_rcb_set_port_timeout(
rcb_common, i, HNS_RCB_DEF_COALESCED_USECS);
}
dsaf_write_dev(rcb_common, RCB_COM_CFG_ENDIAN_REG,
HNS_RCB_COMMON_ENDIAN);
if (AE_IS_VER1(rcb_common->dsaf_dev->dsaf_ver)) {
dsaf_write_dev(rcb_common, RCB_COM_CFG_FNA_REG, 0x0);
dsaf_write_dev(rcb_common, RCB_COM_CFG_FA_REG, 0x1);
} else {
dsaf_set_dev_bit(rcb_common, RCBV2_COM_CFG_USER_REG,
RCB_COM_CFG_FNA_B, false);
dsaf_set_dev_bit(rcb_common, RCBV2_COM_CFG_USER_REG,
RCB_COM_CFG_FA_B, true);
dsaf_set_dev_bit(rcb_common, RCBV2_COM_CFG_TSO_MODE_REG,
RCB_COM_TSO_MODE_B, HNS_TSO_MODE_8BD_32K);
}
return 0;
}
| 5,556 |
78,962 | 0 | CopyKeyNamesToKeymap(struct xkb_keymap *keymap, KeyNamesInfo *info)
{
struct xkb_key *keys;
xkb_keycode_t min_key_code, max_key_code, kc;
min_key_code = info->min_key_code;
max_key_code = info->max_key_code;
/* If the keymap has no keys, let's just use the safest pair we know. */
if (min_key_code == XKB_KEYCODE_INVALID) {
min_key_code = 8;
max_key_code = 255;
}
keys = calloc(max_key_code + 1, sizeof(*keys));
if (!keys)
return false;
for (kc = min_key_code; kc <= max_key_code; kc++)
keys[kc].keycode = kc;
for (kc = info->min_key_code; kc <= info->max_key_code; kc++)
keys[kc].name = darray_item(info->key_names, kc);
keymap->min_key_code = min_key_code;
keymap->max_key_code = max_key_code;
keymap->keys = keys;
return true;
}
| 5,557 |
164,947 | 0 | void ResourceDispatcherHostImpl::OnInit() {
scheduler_.reset(new network::ResourceScheduler(enable_resource_scheduler_));
}
| 5,558 |
126,898 | 0 | void BrowserTabStripController::CloseTab(int model_index,
CloseTabSource source) {
hover_tab_selector_.CancelTabTransition();
tabstrip_->PrepareForCloseAt(model_index, source);
model_->CloseTabContentsAt(model_index,
TabStripModel::CLOSE_USER_GESTURE |
TabStripModel::CLOSE_CREATE_HISTORICAL_TAB);
}
| 5,559 |
33,931 | 0 | blank_screen(void)
{
#if CURSES_ENABLED
int lpc = 0;
for (lpc = 0; lpc < LINES; lpc++) {
move(lpc, 0);
clrtoeol();
}
move(0, 0);
refresh();
#endif
}
| 5,560 |
136,648 | 0 | SubstituteData FrameLoader::DefaultSubstituteDataForURL(const KURL& url) {
if (!ShouldTreatURLAsSrcdocDocument(url))
return SubstituteData();
String srcdoc = frame_->DeprecatedLocalOwner()->FastGetAttribute(srcdocAttr);
DCHECK(!srcdoc.IsNull());
CString encoded_srcdoc = srcdoc.Utf8();
return SubstituteData(
SharedBuffer::Create(encoded_srcdoc.data(), encoded_srcdoc.length()),
"text/html", "UTF-8", NullURL());
}
| 5,561 |
123,250 | 0 | bool RenderWidgetHostViewAura::ShouldDescendIntoChildForEventHandling(
aura::Window* child,
const gfx::Point& location) {
return true;
}
| 5,562 |
57,686 | 0 | void kvm_arch_commit_memory_region(struct kvm *kvm,
const struct kvm_userspace_memory_region *mem,
const struct kvm_memory_slot *old,
const struct kvm_memory_slot *new,
enum kvm_mr_change change)
{
int nr_mmu_pages = 0;
if (!kvm->arch.n_requested_mmu_pages)
nr_mmu_pages = kvm_mmu_calculate_mmu_pages(kvm);
if (nr_mmu_pages)
kvm_mmu_change_mmu_pages(kvm, nr_mmu_pages);
/*
* Dirty logging tracks sptes in 4k granularity, meaning that large
* sptes have to be split. If live migration is successful, the guest
* in the source machine will be destroyed and large sptes will be
* created in the destination. However, if the guest continues to run
* in the source machine (for example if live migration fails), small
* sptes will remain around and cause bad performance.
*
* Scan sptes if dirty logging has been stopped, dropping those
* which can be collapsed into a single large-page spte. Later
* page faults will create the large-page sptes.
*/
if ((change != KVM_MR_DELETE) &&
(old->flags & KVM_MEM_LOG_DIRTY_PAGES) &&
!(new->flags & KVM_MEM_LOG_DIRTY_PAGES))
kvm_mmu_zap_collapsible_sptes(kvm, new);
/*
* Set up write protection and/or dirty logging for the new slot.
*
* For KVM_MR_DELETE and KVM_MR_MOVE, the shadow pages of old slot have
* been zapped so no dirty logging staff is needed for old slot. For
* KVM_MR_FLAGS_ONLY, the old slot is essentially the same one as the
* new and it's also covered when dealing with the new slot.
*
* FIXME: const-ify all uses of struct kvm_memory_slot.
*/
if (change != KVM_MR_DELETE)
kvm_mmu_slot_apply_flags(kvm, (struct kvm_memory_slot *) new);
}
| 5,563 |
116,515 | 0 | ChromeWebUIControllerFactory::ChromeWebUIControllerFactory() {
}
| 5,564 |
107,492 | 0 | static Eina_Bool _ewk_view_smart_pre_render_region(Ewk_View_Smart_Data* smartData, Evas_Coord x, Evas_Coord y, Evas_Coord width, Evas_Coord height, float zoom)
{
WRN("not supported by engine. smartDAta=%p area=%d,%d+%dx%d, zoom=%f",
smartData, x, y, width, height, zoom);
return false;
}
| 5,565 |
112,791 | 0 | void PrintPreviewUI::OnInitiatorTabClosed() {
TabContents* preview_tab =
TabContents::FromWebContents(web_ui()->GetWebContents());
printing::BackgroundPrintingManager* background_printing_manager =
g_browser_process->background_printing_manager();
if (background_printing_manager->HasPrintPreviewTab(preview_tab))
web_ui()->CallJavascriptFunction("cancelPendingPrintRequest");
else
OnClosePrintPreviewTab();
}
| 5,566 |
98,907 | 0 | PassRefPtr<Element> HTMLConstructionSite::attachToCurrent(PassRefPtr<Element> child)
{
return attach(currentElement(), child);
}
| 5,567 |
36,569 | 0 | static void cgsleep_spec(struct timespec *ts_diff, const struct timespec *ts_start)
{
struct timespec now;
timeraddspec(ts_diff, ts_start);
cgtimer_time(&now);
timersubspec(ts_diff, &now);
if (unlikely(ts_diff->tv_sec < 0))
return;
nanosleep(ts_diff, NULL);
}
| 5,568 |
127,416 | 0 | void StyleResolver::updateFont(StyleResolverState& state)
{
state.fontBuilder().createFont(m_fontSelector, state.parentStyle(), state.style());
}
| 5,569 |
17,871 | 0 | static struct dirent *local_readdir(FsContext *ctx, V9fsFidOpenState *fs)
{
struct dirent *entry;
again:
entry = readdir(fs->dir.stream);
if (!entry) {
return NULL;
}
if (ctx->export_flags & V9FS_SM_MAPPED) {
entry->d_type = DT_UNKNOWN;
} else if (ctx->export_flags & V9FS_SM_MAPPED_FILE) {
if (!strcmp(entry->d_name, VIRTFS_META_DIR)) {
/* skp the meta data directory */
goto again;
}
entry->d_type = DT_UNKNOWN;
}
return entry;
}
| 5,570 |
3,769 | 0 | _dbus_concat_dir_and_file (DBusString *dir,
const DBusString *next_component)
{
dbus_bool_t dir_ends_in_slash;
dbus_bool_t file_starts_with_slash;
if (_dbus_string_get_length (dir) == 0 ||
_dbus_string_get_length (next_component) == 0)
return TRUE;
dir_ends_in_slash =
('/' == _dbus_string_get_byte (dir, _dbus_string_get_length (dir) - 1) ||
'\\' == _dbus_string_get_byte (dir, _dbus_string_get_length (dir) - 1));
file_starts_with_slash =
('/' == _dbus_string_get_byte (next_component, 0) ||
'\\' == _dbus_string_get_byte (next_component, 0));
if (dir_ends_in_slash && file_starts_with_slash)
{
_dbus_string_shorten (dir, 1);
}
else if (!(dir_ends_in_slash || file_starts_with_slash))
{
if (!_dbus_string_append_byte (dir, '\\'))
return FALSE;
}
return _dbus_string_copy (next_component, 0, dir,
_dbus_string_get_length (dir));
}
| 5,571 |
171,051 | 0 | void RilSapSocket::onCommandsSocketClosed() {
sendDisconnect();
RLOGE("Socket command closed");
}
| 5,572 |
152,634 | 0 | void HTMLFormControlElement::dispatchBlurEvent(
Element* newFocusedElement,
WebFocusType type,
InputDeviceCapabilities* sourceCapabilities) {
if (type != WebFocusTypePage)
m_wasFocusedByMouse = false;
HTMLElement::dispatchBlurEvent(newFocusedElement, type, sourceCapabilities);
hideVisibleValidationMessage();
}
| 5,573 |
88,477 | 0 | static MagickBooleanType WritePTIFImage(const ImageInfo *image_info,
Image *image)
{
ExceptionInfo
*exception;
Image
*images,
*next,
*pyramid_image;
ImageInfo
*write_info;
MagickBooleanType
status;
PointInfo
resolution;
size_t
columns,
rows;
/*
Create pyramid-encoded TIFF image.
*/
exception=(&image->exception);
images=NewImageList();
for (next=image; next != (Image *) NULL; next=GetNextImageInList(next))
{
Image
*clone_image;
clone_image=CloneImage(next,0,0,MagickFalse,exception);
if (clone_image == (Image *) NULL)
break;
clone_image->previous=NewImageList();
clone_image->next=NewImageList();
(void) SetImageProperty(clone_image,"tiff:subfiletype","none");
AppendImageToList(&images,clone_image);
columns=next->columns;
rows=next->rows;
resolution.x=next->x_resolution;
resolution.y=next->y_resolution;
while ((columns > 64) && (rows > 64))
{
columns/=2;
rows/=2;
resolution.x/=2.0;
resolution.y/=2.0;
pyramid_image=ResizeImage(next,columns,rows,image->filter,image->blur,
exception);
if (pyramid_image == (Image *) NULL)
break;
DestroyBlob(pyramid_image);
pyramid_image->blob=ReferenceBlob(next->blob);
pyramid_image->x_resolution=resolution.x;
pyramid_image->y_resolution=resolution.y;
(void) SetImageProperty(pyramid_image,"tiff:subfiletype","REDUCEDIMAGE");
AppendImageToList(&images,pyramid_image);
}
}
status=MagickFalse;
if (images != (Image *) NULL)
{
/*
Write pyramid-encoded TIFF image.
*/
images=GetFirstImageInList(images);
write_info=CloneImageInfo(image_info);
write_info->adjoin=MagickTrue;
status=WriteTIFFImage(write_info,images);
images=DestroyImageList(images);
write_info=DestroyImageInfo(write_info);
}
return(status);
}
| 5,574 |
151,246 | 0 | static bool HasTextContent(Resource* cached_resource) {
Resource::Type type = cached_resource->GetType();
return type == Resource::kCSSStyleSheet || type == Resource::kXSLStyleSheet ||
type == Resource::kScript || type == Resource::kRaw ||
type == Resource::kImportResource || type == Resource::kMainResource;
}
| 5,575 |
142,289 | 0 | ChromePasswordManagerClient::GetPasswordManager() const {
return &password_manager_;
}
| 5,576 |
15,073 | 0 | int dom_document_resolve_externals_read(dom_object *obj, zval **retval TSRMLS_DC)
{
dom_doc_propsptr doc_prop;
ALLOC_ZVAL(*retval);
if (obj->document) {
doc_prop = dom_get_doc_props(obj->document);
ZVAL_BOOL(*retval, doc_prop->resolveexternals);
} else {
ZVAL_FALSE(*retval);
}
return SUCCESS;
}
| 5,577 |
146,065 | 0 | void WebGL2RenderingContextBase::clearBufferuiv(GLenum buffer,
GLint drawbuffer,
const Vector<GLuint>& value,
GLuint src_offset) {
if (isContextLost() ||
!ValidateClearBuffer("clearBufferuiv", buffer, value.size(), src_offset))
return;
ContextGL()->ClearBufferuiv(buffer, drawbuffer, value.data() + src_offset);
}
| 5,578 |
88,679 | 0 | static int dwc3_gadget_set_ep_config(struct dwc3 *dwc, struct dwc3_ep *dep,
bool modify, bool restore)
{
const struct usb_ss_ep_comp_descriptor *comp_desc;
const struct usb_endpoint_descriptor *desc;
struct dwc3_gadget_ep_cmd_params params;
if (dev_WARN_ONCE(dwc->dev, modify && restore,
"Can't modify and restore\n"))
return -EINVAL;
comp_desc = dep->endpoint.comp_desc;
desc = dep->endpoint.desc;
memset(¶ms, 0x00, sizeof(params));
params.param0 = DWC3_DEPCFG_EP_TYPE(usb_endpoint_type(desc))
| DWC3_DEPCFG_MAX_PACKET_SIZE(usb_endpoint_maxp(desc));
/* Burst size is only needed in SuperSpeed mode */
if (dwc->gadget.speed >= USB_SPEED_SUPER) {
u32 burst = dep->endpoint.maxburst;
params.param0 |= DWC3_DEPCFG_BURST_SIZE(burst - 1);
}
if (modify) {
params.param0 |= DWC3_DEPCFG_ACTION_MODIFY;
} else if (restore) {
params.param0 |= DWC3_DEPCFG_ACTION_RESTORE;
params.param2 |= dep->saved_state;
} else {
params.param0 |= DWC3_DEPCFG_ACTION_INIT;
}
if (usb_endpoint_xfer_control(desc))
params.param1 = DWC3_DEPCFG_XFER_COMPLETE_EN;
if (dep->number <= 1 || usb_endpoint_xfer_isoc(desc))
params.param1 |= DWC3_DEPCFG_XFER_NOT_READY_EN;
if (usb_ss_max_streams(comp_desc) && usb_endpoint_xfer_bulk(desc)) {
params.param1 |= DWC3_DEPCFG_STREAM_CAPABLE
| DWC3_DEPCFG_STREAM_EVENT_EN;
dep->stream_capable = true;
}
if (!usb_endpoint_xfer_control(desc))
params.param1 |= DWC3_DEPCFG_XFER_IN_PROGRESS_EN;
/*
* We are doing 1:1 mapping for endpoints, meaning
* Physical Endpoints 2 maps to Logical Endpoint 2 and
* so on. We consider the direction bit as part of the physical
* endpoint number. So USB endpoint 0x81 is 0x03.
*/
params.param1 |= DWC3_DEPCFG_EP_NUMBER(dep->number);
/*
* We must use the lower 16 TX FIFOs even though
* HW might have more
*/
if (dep->direction)
params.param0 |= DWC3_DEPCFG_FIFO_NUMBER(dep->number >> 1);
if (desc->bInterval) {
params.param1 |= DWC3_DEPCFG_BINTERVAL_M1(desc->bInterval - 1);
dep->interval = 1 << (desc->bInterval - 1);
}
return dwc3_send_gadget_ep_cmd(dep, DWC3_DEPCMD_SETEPCONFIG, ¶ms);
}
| 5,579 |
19,666 | 0 | static struct page *alloc_fresh_huge_page_node(struct hstate *h, int nid)
{
struct page *page;
if (h->order >= MAX_ORDER)
return NULL;
page = alloc_pages_exact_node(nid,
htlb_alloc_mask|__GFP_COMP|__GFP_THISNODE|
__GFP_REPEAT|__GFP_NOWARN,
huge_page_order(h));
if (page) {
if (arch_prepare_hugepage(page)) {
__free_pages(page, huge_page_order(h));
return NULL;
}
prep_new_huge_page(h, page, nid);
}
return page;
}
| 5,580 |
109,066 | 0 | WebKit::WebColorChooser* RenderViewImpl::createColorChooser(
WebKit::WebColorChooserClient* client,
const WebKit::WebColor& initial_color) {
RendererWebColorChooserImpl* color_chooser =
new RendererWebColorChooserImpl(this, client);
color_chooser->Open(static_cast<SkColor>(initial_color));
return color_chooser;
}
| 5,581 |
121,333 | 0 | void WebURLLoaderImpl::loadSynchronously(const WebURLRequest& request,
WebURLResponse& response,
WebURLError& error,
WebData& data) {
ResourceLoaderBridge::SyncLoadResponse sync_load_response;
context_->Start(request, &sync_load_response, platform_);
const GURL& final_url = sync_load_response.url;
int error_code = sync_load_response.error_code;
if (error_code != net::OK) {
response.setURL(final_url);
error.domain = WebString::fromUTF8(net::kErrorDomain);
error.reason = error_code;
error.unreachableURL = final_url;
return;
}
PopulateURLResponse(final_url, sync_load_response, &response);
data.assign(sync_load_response.data.data(),
sync_load_response.data.size());
}
| 5,582 |
164,977 | 0 | void HTMLCanvasElement::AddListener(CanvasDrawListener* listener) {
listeners_.insert(listener);
}
| 5,583 |
186,588 | 1 | bool ChildProcessSecurityPolicyImpl::CanSetAsOriginHeader(int child_id,
const GURL& url) {
if (!url.is_valid())
return false; // Can't set invalid URLs as origin headers.
// about:srcdoc cannot be used as an origin
if (url == kAboutSrcDocURL)
return false;
// If this process can commit |url|, it can use |url| as an origin for
// outbound requests.
if (CanCommitURL(child_id, url))
return true;
// Allow schemes which may come from scripts executing in isolated worlds;
// XHRs issued by such scripts reflect the script origin rather than the
// document origin.
{
base::AutoLock lock(lock_);
if (base::ContainsKey(schemes_okay_to_appear_as_origin_headers_,
url.scheme())) {
return true;
}
}
return false;
}
| 5,584 |
174,342 | 0 | status_t IPCThreadState::waitForResponse(Parcel *reply, status_t *acquireResult)
{
uint32_t cmd;
int32_t err;
while (1) {
if ((err=talkWithDriver()) < NO_ERROR) break;
err = mIn.errorCheck();
if (err < NO_ERROR) break;
if (mIn.dataAvail() == 0) continue;
cmd = (uint32_t)mIn.readInt32();
IF_LOG_COMMANDS() {
alog << "Processing waitForResponse Command: "
<< getReturnString(cmd) << endl;
}
switch (cmd) {
case BR_TRANSACTION_COMPLETE:
if (!reply && !acquireResult) goto finish;
break;
case BR_DEAD_REPLY:
err = DEAD_OBJECT;
goto finish;
case BR_FAILED_REPLY:
err = FAILED_TRANSACTION;
goto finish;
case BR_ACQUIRE_RESULT:
{
ALOG_ASSERT(acquireResult != NULL, "Unexpected brACQUIRE_RESULT");
const int32_t result = mIn.readInt32();
if (!acquireResult) continue;
*acquireResult = result ? NO_ERROR : INVALID_OPERATION;
}
goto finish;
case BR_REPLY:
{
binder_transaction_data tr;
err = mIn.read(&tr, sizeof(tr));
ALOG_ASSERT(err == NO_ERROR, "Not enough command data for brREPLY");
if (err != NO_ERROR) goto finish;
if (reply) {
if ((tr.flags & TF_STATUS_CODE) == 0) {
reply->ipcSetDataReference(
reinterpret_cast<const uint8_t*>(tr.data.ptr.buffer),
tr.data_size,
reinterpret_cast<const binder_size_t*>(tr.data.ptr.offsets),
tr.offsets_size/sizeof(binder_size_t),
freeBuffer, this);
} else {
err = *reinterpret_cast<const status_t*>(tr.data.ptr.buffer);
freeBuffer(NULL,
reinterpret_cast<const uint8_t*>(tr.data.ptr.buffer),
tr.data_size,
reinterpret_cast<const binder_size_t*>(tr.data.ptr.offsets),
tr.offsets_size/sizeof(binder_size_t), this);
}
} else {
freeBuffer(NULL,
reinterpret_cast<const uint8_t*>(tr.data.ptr.buffer),
tr.data_size,
reinterpret_cast<const binder_size_t*>(tr.data.ptr.offsets),
tr.offsets_size/sizeof(binder_size_t), this);
continue;
}
}
goto finish;
default:
err = executeCommand(cmd);
if (err != NO_ERROR) goto finish;
break;
}
}
finish:
if (err != NO_ERROR) {
if (acquireResult) *acquireResult = err;
if (reply) reply->setError(err);
mLastError = err;
}
return err;
}
| 5,585 |
4,130 | 0 | void Splash::pipeRunSimpleRGB8(SplashPipe *pipe) {
*pipe->destColorPtr++ = state->rgbTransferR[pipe->cSrc[0]];
*pipe->destColorPtr++ = state->rgbTransferG[pipe->cSrc[1]];
*pipe->destColorPtr++ = state->rgbTransferB[pipe->cSrc[2]];
*pipe->destAlphaPtr++ = 255;
++pipe->x;
}
| 5,586 |
86,866 | 0 | TEE_Result syscall_cipher_update(unsigned long state, const void *src,
size_t src_len, void *dst, uint64_t *dst_len)
{
return tee_svc_cipher_update_helper(state, false /* last_block */,
src, src_len, dst, dst_len);
}
| 5,587 |
92,041 | 0 | static bool blk_update_bidi_request(struct request *rq, blk_status_t error,
unsigned int nr_bytes,
unsigned int bidi_bytes)
{
if (blk_update_request(rq, error, nr_bytes))
return true;
/* Bidi request must be completed as a whole */
if (unlikely(blk_bidi_rq(rq)) &&
blk_update_request(rq->next_rq, error, bidi_bytes))
return true;
if (blk_queue_add_random(rq->q))
add_disk_randomness(rq->rq_disk);
return false;
}
| 5,588 |
162,474 | 0 | void ImageResource::MultipartDataReceived(const char* bytes, size_t size) {
DCHECK(multipart_parser_);
Resource::AppendData(bytes, size);
}
| 5,589 |
65,418 | 0 | check_lock_length(u64 offset, u64 length)
{
return ((length == 0) || ((length != NFS4_MAX_UINT64) &&
(length > ~offset)));
}
| 5,590 |
5,832 | 0 | static void ehci_trace_usbsts(uint32_t mask, int state)
{
/* interrupts */
if (mask & USBSTS_INT) {
trace_usb_ehci_usbsts("INT", state);
}
if (mask & USBSTS_ERRINT) {
trace_usb_ehci_usbsts("ERRINT", state);
}
if (mask & USBSTS_PCD) {
trace_usb_ehci_usbsts("PCD", state);
}
if (mask & USBSTS_FLR) {
trace_usb_ehci_usbsts("FLR", state);
}
if (mask & USBSTS_HSE) {
trace_usb_ehci_usbsts("HSE", state);
}
if (mask & USBSTS_IAA) {
trace_usb_ehci_usbsts("IAA", state);
}
/* status */
if (mask & USBSTS_HALT) {
trace_usb_ehci_usbsts("HALT", state);
}
if (mask & USBSTS_REC) {
trace_usb_ehci_usbsts("REC", state);
}
if (mask & USBSTS_PSS) {
trace_usb_ehci_usbsts("PSS", state);
}
if (mask & USBSTS_ASS) {
trace_usb_ehci_usbsts("ASS", state);
}
}
| 5,591 |
113,105 | 0 | bool DownloadItemImpl::ShouldOpenFileBasedOnExtension() {
return delegate_->ShouldOpenFileBasedOnExtension(GetUserVerifiedFilePath());
}
| 5,592 |
10,221 | 0 | ft_glyphslot_init( FT_GlyphSlot slot )
{
FT_Driver driver = slot->face->driver;
FT_Driver_Class clazz = driver->clazz;
FT_Memory memory = driver->root.memory;
FT_Error error = FT_Err_Ok;
FT_Slot_Internal internal;
slot->library = driver->root.library;
if ( FT_NEW( internal ) )
goto Exit;
slot->internal = internal;
if ( FT_DRIVER_USES_OUTLINES( driver ) )
error = FT_GlyphLoader_New( memory, &internal->loader );
if ( !error && clazz->init_slot )
error = clazz->init_slot( slot );
Exit:
return error;
}
| 5,593 |
161,144 | 0 | void MediaStreamManager::OnStreamStarted(const std::string& label) {
DeviceRequest* const request = FindRequest(label);
if (!request)
return;
if (request->ui_proxy) {
request->ui_proxy->OnStarted(
base::BindOnce(&MediaStreamManager::StopMediaStreamFromBrowser,
base::Unretained(this), label),
base::BindOnce(&MediaStreamManager::OnMediaStreamUIWindowId,
base::Unretained(this), request->video_type(),
request->devices));
}
}
| 5,594 |
47,471 | 0 | static int adf_ctl_ioctl_dev_config(struct file *fp, unsigned int cmd,
unsigned long arg)
{
int ret;
struct adf_user_cfg_ctl_data *ctl_data;
struct adf_accel_dev *accel_dev;
ret = adf_ctl_alloc_resources(&ctl_data, arg);
if (ret)
return ret;
accel_dev = adf_devmgr_get_dev_by_id(ctl_data->device_id);
if (!accel_dev) {
ret = -EFAULT;
goto out;
}
if (adf_dev_started(accel_dev)) {
ret = -EFAULT;
goto out;
}
if (adf_copy_key_value_data(accel_dev, ctl_data)) {
ret = -EFAULT;
goto out;
}
set_bit(ADF_STATUS_CONFIGURED, &accel_dev->status);
out:
kfree(ctl_data);
return ret;
}
| 5,595 |
72,347 | 0 | no_identities(SocketEntry *e, u_int type)
{
struct sshbuf *msg;
int r;
if ((msg = sshbuf_new()) == NULL)
fatal("%s: sshbuf_new failed", __func__);
if ((r = sshbuf_put_u8(msg,
(type == SSH_AGENTC_REQUEST_RSA_IDENTITIES) ?
SSH_AGENT_RSA_IDENTITIES_ANSWER :
SSH2_AGENT_IDENTITIES_ANSWER)) != 0 ||
(r = sshbuf_put_u32(msg, 0)) != 0 ||
(r = sshbuf_put_stringb(e->output, msg)) != 0)
fatal("%s: buffer error: %s", __func__, ssh_err(r));
sshbuf_free(msg);
}
| 5,596 |
165,531 | 0 | void ContentSecurityPolicy::LogToConsole(ConsoleMessage* console_message,
LocalFrame* frame) {
if (frame)
frame->GetDocument()->AddConsoleMessage(console_message);
else if (execution_context_)
execution_context_->AddConsoleMessage(console_message);
else
console_messages_.push_back(console_message);
}
| 5,597 |
167,861 | 0 | void FrameLoader::SetReferrerForFrameRequest(FrameLoadRequest& frame_request) {
ResourceRequest& request = frame_request.GetResourceRequest();
Document* origin_document = frame_request.OriginDocument();
if (!origin_document)
return;
if (request.DidSetHTTPReferrer())
return;
if (frame_request.GetShouldSendReferrer() == kNeverSendReferrer)
return;
Referrer referrer = SecurityPolicy::GenerateReferrer(
origin_document->GetReferrerPolicy(), request.Url(),
origin_document->OutgoingReferrer());
request.SetHTTPReferrer(referrer);
request.SetHTTPOriginToMatchReferrerIfNeeded();
}
| 5,598 |
7,827 | 0 | TT_Run_Context( TT_ExecContext exec,
FT_Bool debug )
{
FT_Error error;
if ( ( error = TT_Goto_CodeRange( exec, tt_coderange_glyph, 0 ) )
!= TT_Err_Ok )
return error;
exec->zp0 = exec->pts;
exec->zp1 = exec->pts;
exec->zp2 = exec->pts;
exec->GS.gep0 = 1;
exec->GS.gep1 = 1;
exec->GS.gep2 = 1;
exec->GS.projVector.x = 0x4000;
exec->GS.projVector.y = 0x0000;
exec->GS.freeVector = exec->GS.projVector;
exec->GS.dualVector = exec->GS.projVector;
#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
exec->GS.both_x_axis = TRUE;
#endif
exec->GS.round_state = 1;
exec->GS.loop = 1;
/* some glyphs leave something on the stack. so we clean it */
/* before a new execution. */
exec->top = 0;
exec->callTop = 0;
#if 1
FT_UNUSED( debug );
return exec->face->interpreter( exec );
#else
if ( !debug )
return TT_RunIns( exec );
else
return TT_Err_Ok;
#endif
}
| 5,599 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.