unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
147,400 | 0 | void V8TestObject::FloatAttributeAttributeSetterCallback(
const v8::FunctionCallbackInfo<v8::Value>& info) {
RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestObject_floatAttribute_Setter");
v8::Local<v8::Value> v8_value = info[0];
test_object_v8_internal::FloatAttributeAttributeSetter(v8_value, info);
}
| 4,100 |
82,848 | 0 | static int parse_segments(struct MACH0_(obj_t)* bin, ut64 off) {
int i, j, k, sect, len;
ut32 size_sects;
ut8 segcom[sizeof (struct MACH0_(segment_command))] = {0};
ut8 sec[sizeof (struct MACH0_(section))] = {0};
if (!UT32_MUL (&size_sects, bin->nsegs, sizeof (struct MACH0_(segment_command)))) {
return false;
}
if (!size_sects || size_sects > bin->size) {
return false;
}
if (off > bin->size || off + sizeof (struct MACH0_(segment_command)) > bin->size) {
return false;
}
if (!(bin->segs = realloc (bin->segs, bin->nsegs * sizeof(struct MACH0_(segment_command))))) {
perror ("realloc (seg)");
return false;
}
j = bin->nsegs - 1;
len = r_buf_read_at (bin->b, off, segcom, sizeof (struct MACH0_(segment_command)));
if (len != sizeof (struct MACH0_(segment_command))) {
bprintf ("Error: read (seg)\n");
return false;
}
i = 0;
bin->segs[j].cmd = r_read_ble32 (&segcom[i], bin->big_endian);
i += sizeof (ut32);
bin->segs[j].cmdsize = r_read_ble32 (&segcom[i], bin->big_endian);
i += sizeof (ut32);
memcpy (&bin->segs[j].segname, &segcom[i], 16);
i += 16;
#if R_BIN_MACH064
bin->segs[j].vmaddr = r_read_ble64 (&segcom[i], bin->big_endian);
i += sizeof (ut64);
bin->segs[j].vmsize = r_read_ble64 (&segcom[i], bin->big_endian);
i += sizeof (ut64);
bin->segs[j].fileoff = r_read_ble64 (&segcom[i], bin->big_endian);
i += sizeof (ut64);
bin->segs[j].filesize = r_read_ble64 (&segcom[i], bin->big_endian);
i += sizeof (ut64);
#else
bin->segs[j].vmaddr = r_read_ble32 (&segcom[i], bin->big_endian);
i += sizeof (ut32);
bin->segs[j].vmsize = r_read_ble32 (&segcom[i], bin->big_endian);
i += sizeof (ut32);
bin->segs[j].fileoff = r_read_ble32 (&segcom[i], bin->big_endian);
i += sizeof (ut32);
bin->segs[j].filesize = r_read_ble32 (&segcom[i], bin->big_endian);
i += sizeof (ut32);
#endif
bin->segs[j].maxprot = r_read_ble32 (&segcom[i], bin->big_endian);
i += sizeof (ut32);
bin->segs[j].initprot = r_read_ble32 (&segcom[i], bin->big_endian);
i += sizeof (ut32);
bin->segs[j].nsects = r_read_ble32 (&segcom[i], bin->big_endian);
i += sizeof (ut32);
bin->segs[j].flags = r_read_ble32 (&segcom[i], bin->big_endian);
sdb_num_set (bin->kv, sdb_fmt ("mach0_segment_%d.offset", j), off, 0);
sdb_num_set (bin->kv, "mach0_segments.count", 0, 0);
sdb_set (bin->kv, "mach0_segment.format",
"xd[16]zxxxxoodx "
"cmd cmdsize segname vmaddr vmsize "
"fileoff filesize maxprot initprot nsects flags", 0);
if (bin->segs[j].nsects > 0) {
sect = bin->nsects;
bin->nsects += bin->segs[j].nsects;
if (bin->nsects > 128) {
int new_nsects = bin->nsects & 0xf;
bprintf ("WARNING: mach0 header contains too many sections (%d). Wrapping to %d\n",
bin->nsects, new_nsects);
bin->nsects = new_nsects;
}
if ((int)bin->nsects < 1) {
bprintf ("Warning: Invalid number of sections\n");
bin->nsects = sect;
return false;
}
if (!UT32_MUL (&size_sects, bin->nsects-sect, sizeof (struct MACH0_(section)))){
bin->nsects = sect;
return false;
}
if (!size_sects || size_sects > bin->size){
bin->nsects = sect;
return false;
}
if (bin->segs[j].cmdsize != sizeof (struct MACH0_(segment_command)) \
+ (sizeof (struct MACH0_(section))*bin->segs[j].nsects)){
bin->nsects = sect;
return false;
}
if (off + sizeof (struct MACH0_(segment_command)) > bin->size ||\
off + sizeof (struct MACH0_(segment_command)) + size_sects > bin->size){
bin->nsects = sect;
return false;
}
if (!(bin->sects = realloc (bin->sects, bin->nsects * sizeof (struct MACH0_(section))))) {
perror ("realloc (sects)");
bin->nsects = sect;
return false;
}
for (k = sect, j = 0; k < bin->nsects; k++, j++) {
ut64 offset = off + sizeof (struct MACH0_(segment_command)) + j * sizeof (struct MACH0_(section));
len = r_buf_read_at (bin->b, offset, sec, sizeof (struct MACH0_(section)));
if (len != sizeof (struct MACH0_(section))) {
bprintf ("Error: read (sects)\n");
bin->nsects = sect;
return false;
}
i = 0;
memcpy (&bin->sects[k].sectname, &sec[i], 16);
i += 16;
memcpy (&bin->sects[k].segname, &sec[i], 16);
bin->sects[k].segname[15] = 0;
i += 16;
#if R_BIN_MACH064
bin->sects[k].addr = r_read_ble64 (&sec[i], bin->big_endian);
i += sizeof (ut64);
bin->sects[k].size = r_read_ble64 (&sec[i], bin->big_endian);
i += sizeof (ut64);
#else
bin->sects[k].addr = r_read_ble32 (&sec[i], bin->big_endian);
i += sizeof (ut32);
bin->sects[k].size = r_read_ble32 (&sec[i], bin->big_endian);
i += sizeof (ut32);
#endif
bin->sects[k].offset = r_read_ble32 (&sec[i], bin->big_endian);
i += sizeof (ut32);
bin->sects[k].align = r_read_ble32 (&sec[i], bin->big_endian);
i += sizeof (ut32);
bin->sects[k].reloff = r_read_ble32 (&sec[i], bin->big_endian);
i += sizeof (ut32);
bin->sects[k].nreloc = r_read_ble32 (&sec[i], bin->big_endian);
i += sizeof (ut32);
bin->sects[k].flags = r_read_ble32 (&sec[i], bin->big_endian);
i += sizeof (ut32);
bin->sects[k].reserved1 = r_read_ble32 (&sec[i], bin->big_endian);
i += sizeof (ut32);
bin->sects[k].reserved2 = r_read_ble32 (&sec[i], bin->big_endian);
#if R_BIN_MACH064
i += sizeof (ut32);
bin->sects[k].reserved3 = r_read_ble32 (&sec[i], bin->big_endian);
#endif
}
}
return true;
}
| 4,101 |
85,001 | 0 | static int get_info(struct net *net, void __user *user,
const int *len, int compat)
{
char name[XT_TABLE_MAXNAMELEN];
struct xt_table *t;
int ret;
if (*len != sizeof(struct ipt_getinfo))
return -EINVAL;
if (copy_from_user(name, user, sizeof(name)) != 0)
return -EFAULT;
name[XT_TABLE_MAXNAMELEN-1] = '\0';
#ifdef CONFIG_COMPAT
if (compat)
xt_compat_lock(AF_INET);
#endif
t = xt_request_find_table_lock(net, AF_INET, name);
if (!IS_ERR(t)) {
struct ipt_getinfo info;
const struct xt_table_info *private = t->private;
#ifdef CONFIG_COMPAT
struct xt_table_info tmp;
if (compat) {
ret = compat_table_info(private, &tmp);
xt_compat_flush_offsets(AF_INET);
private = &tmp;
}
#endif
memset(&info, 0, sizeof(info));
info.valid_hooks = t->valid_hooks;
memcpy(info.hook_entry, private->hook_entry,
sizeof(info.hook_entry));
memcpy(info.underflow, private->underflow,
sizeof(info.underflow));
info.num_entries = private->number;
info.size = private->size;
strcpy(info.name, name);
if (copy_to_user(user, &info, *len) != 0)
ret = -EFAULT;
else
ret = 0;
xt_table_unlock(t);
module_put(t->me);
} else
ret = PTR_ERR(t);
#ifdef CONFIG_COMPAT
if (compat)
xt_compat_unlock(AF_INET);
#endif
return ret;
}
| 4,102 |
134,185 | 0 | void ClearTouchIdIfReleased(const base::NativeEvent& xev) {
NOTIMPLEMENTED();
}
| 4,103 |
113,477 | 0 | bool WebPagePrivate::commitRootLayerIfNeeded()
{
#if DEBUG_AC_COMMIT
Platform::logAlways(Platform::LogLevelCritical,
"%s: m_suspendRootLayerCommit = %d, m_needsCommit = %d, m_frameLayers = 0x%p, m_frameLayers->hasLayer() = %d, needsLayoutRecursive() = %d",
WTF_PRETTY_FUNCTION,
m_suspendRootLayerCommit,
m_needsCommit,
m_frameLayers.get(),
m_frameLayers && m_frameLayers->hasLayer(),
m_mainFrame && m_mainFrame->view() && needsLayoutRecursive(m_mainFrame->view()));
#endif
if (m_suspendRootLayerCommit)
return false;
if (!m_needsCommit)
return false;
if (!(m_frameLayers && m_frameLayers->hasLayer()) && !m_overlayLayer
&& !m_needsOneShotDrawingSynchronization)
return false;
FrameView* view = m_mainFrame->view();
if (!view)
return false;
updateDelegatedOverlays();
if (needsLayoutRecursive(view)) {
ASSERT(!needsOneShotDrawingSynchronization());
return false;
}
willComposite();
m_needsCommit = false;
m_needsOneShotDrawingSynchronization = false;
if (m_rootLayerCommitTimer->isActive())
m_rootLayerCommitTimer->stop();
double scale = currentScale();
if (m_frameLayers && m_frameLayers->hasLayer())
m_frameLayers->commitOnWebKitThread(scale);
if (m_overlayLayer)
m_overlayLayer->platformLayer()->commitOnWebKitThread(scale);
IntRect layoutRect(scrollPosition(), actualVisibleSize());
IntRect documentRect(view->minimumScrollPosition(), view->contentsSize());
bool drawsRootLayer = compositorDrawsRootLayer();
Platform::userInterfaceThreadMessageClient()->dispatchSyncMessage(
Platform::createMethodCallMessage(
&WebPagePrivate::commitRootLayer,
this,
layoutRect,
documentRect,
drawsRootLayer));
didComposite();
return true;
}
| 4,104 |
14,591 | 0 | polkit_backend_session_monitor_new (void)
{
PolkitBackendSessionMonitor *monitor;
monitor = POLKIT_BACKEND_SESSION_MONITOR (g_object_new (POLKIT_BACKEND_TYPE_SESSION_MONITOR, NULL));
return monitor;
}
| 4,105 |
96,411 | 0 | int main(int argc, char **argv)
{
/* I18n */
setlocale(LC_ALL, "");
#if ENABLE_NLS
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
#endif
abrt_init(argv);
/* Can't keep these strings/structs static: _() doesn't support that */
const char *program_usage_string = _(
"& [-vsoxm] [-d DIR]/[-D] [FILE]\n"
"\n"
"Extract Xorg crash from FILE (or standard input)"
);
/* Keep OPT_z enums and order of options below in sync! */
struct options program_options[] = {
OPT__VERBOSE(&g_verbose),
OPT_BOOL( 's', NULL, NULL, _("Log to syslog")),
OPT_BOOL( 'o', NULL, NULL, _("Print found crash data on standard output")),
OPT_STRING('d', NULL, &debug_dumps_dir, "DIR", _("Create problem directory in DIR for every crash found")),
OPT_BOOL( 'D', NULL, NULL, _("Same as -d DumpLocation, DumpLocation is specified in abrt.conf")),
OPT_BOOL( 'x', NULL, NULL, _("Make the problem directory world readable")),
OPT_BOOL( 'm', NULL, NULL, _("Print search string(s) to stdout and exit")),
OPT_END()
};
unsigned opts = g_opts = parse_opts(argc, argv, program_options, program_usage_string);
export_abrt_envvars(0);
msg_prefix = g_progname;
if ((opts & OPT_s) || getenv("ABRT_SYSLOG"))
{
logmode = LOGMODE_JOURNAL;
}
if (opts & OPT_m)
{
puts("Backtrace");
return 0;
}
if (opts & OPT_D)
{
if (opts & OPT_d)
show_usage_and_die(program_usage_string, program_options);
load_abrt_conf();
debug_dumps_dir = g_settings_dump_location;
g_settings_dump_location = NULL;
free_abrt_conf_data();
}
argv += optind;
if (argv[0])
xmove_fd(xopen(argv[0], O_RDONLY), STDIN_FILENO);
char *line;
while ((line = xmalloc_fgetline(stdin)) != NULL)
{
char *p = skip_pfx(line);
if (strcmp(p, "Backtrace:") == 0)
{
free(line);
g_bt_count++;
process_xorg_bt();
continue;
}
free(line);
}
/* If we are run by a log watcher, this delays log rescan
* (because log watcher waits to us to terminate)
* and possibly prevents dreaded "abrt storm".
*/
if (opts & (OPT_d|OPT_D))
{
if (g_bt_count > MAX_DUMPED_DD_COUNT)
sleep(g_bt_count - MAX_DUMPED_DD_COUNT);
}
return 0;
}
| 4,106 |
134,485 | 0 | int ConvertFromWeb(blink::WebDragOperationsMask ops) {
int drag_op = ui::DragDropTypes::DRAG_NONE;
if (ops & blink::WebDragOperationCopy)
drag_op |= ui::DragDropTypes::DRAG_COPY;
if (ops & blink::WebDragOperationMove)
drag_op |= ui::DragDropTypes::DRAG_MOVE;
if (ops & blink::WebDragOperationLink)
drag_op |= ui::DragDropTypes::DRAG_LINK;
return drag_op;
}
| 4,107 |
169,620 | 0 | std::string TestURLLoader::TestBasicFilePOST() {
std::string message;
pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
int32_t rv = OpenFileSystem(&file_system, &message);
if (rv != PP_OK)
return ReportError(message.c_str(), rv);
pp::FileRef file_ref(file_system, "/file_post_test");
std::string postdata("postdata");
rv = PrepareFileForPost(file_ref, postdata, &message);
if (rv != PP_OK)
return ReportError(message.c_str(), rv);
pp::URLRequestInfo request(instance_);
request.SetURL("/echo");
request.SetMethod("POST");
request.AppendFileToBody(file_ref, 0);
return LoadAndCompareBody(request, postdata);
}
| 4,108 |
25,654 | 0 | void perf_event_grab_pmc(void)
{
if (atomic_inc_not_zero(&active_events))
return;
mutex_lock(&pmc_grab_mutex);
if (atomic_read(&active_events) == 0) {
if (atomic_read(&nmi_active) > 0) {
on_each_cpu(perf_stop_nmi_watchdog, NULL, 1);
BUG_ON(atomic_read(&nmi_active) != 0);
}
atomic_inc(&active_events);
}
mutex_unlock(&pmc_grab_mutex);
}
| 4,109 |
97,442 | 0 | unsigned long FrameLoader::loadResourceSynchronously(const ResourceRequest& request, StoredCredentials storedCredentials, ResourceError& error, ResourceResponse& response, Vector<char>& data)
{
String referrer = m_outgoingReferrer;
if (SecurityOrigin::shouldHideReferrer(request.url(), referrer))
referrer = String();
ResourceRequest initialRequest = request;
initialRequest.setTimeoutInterval(10);
if (initialRequest.isConditional())
initialRequest.setCachePolicy(ReloadIgnoringCacheData);
else
initialRequest.setCachePolicy(documentLoader()->request().cachePolicy());
if (!referrer.isEmpty())
initialRequest.setHTTPReferrer(referrer);
addHTTPOriginIfNeeded(initialRequest, outgoingOrigin());
if (Page* page = m_frame->page())
initialRequest.setFirstPartyForCookies(page->mainFrame()->loader()->documentLoader()->request().url());
initialRequest.setHTTPUserAgent(client()->userAgent(request.url()));
unsigned long identifier = 0;
ResourceRequest newRequest(initialRequest);
requestFromDelegate(newRequest, identifier, error);
if (error.isNull()) {
ASSERT(!newRequest.isNull());
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
if (!documentLoader()->applicationCacheHost()->maybeLoadSynchronously(newRequest, error, response, data)) {
#endif
ResourceHandle::loadResourceSynchronously(newRequest, storedCredentials, error, response, data, m_frame);
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
documentLoader()->applicationCacheHost()->maybeLoadFallbackSynchronously(newRequest, error, response, data);
}
#endif
}
notifier()->sendRemainingDelegateMessages(m_documentLoader.get(), identifier, response, data.size(), error);
return identifier;
}
| 4,110 |
177,465 | 0 | long Tags::Tag::ParseSimpleTag(IMkvReader* pReader, long long pos,
long long size) {
if (!ExpandSimpleTagsArray())
return -1;
SimpleTag& st = m_simple_tags[m_simple_tags_count++];
st.Init();
return st.Parse(pReader, pos, size);
}
| 4,111 |
15,255 | 0 | PHP_FUNCTION(stream_socket_sendto)
{
php_stream *stream;
zval *zstream;
long flags = 0;
char *data, *target_addr = NULL;
int datalen, target_addr_len = 0;
php_sockaddr_storage sa;
socklen_t sl = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|ls", &zstream, &data, &datalen, &flags, &target_addr, &target_addr_len) == FAILURE) {
RETURN_FALSE;
}
php_stream_from_zval(stream, &zstream);
if (target_addr_len) {
/* parse the address */
if (FAILURE == php_network_parse_network_address_with_port(target_addr, target_addr_len, (struct sockaddr*)&sa, &sl TSRMLS_CC)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to parse `%s' into a valid network address", target_addr);
RETURN_FALSE;
}
}
RETURN_LONG(php_stream_xport_sendto(stream, data, datalen, flags, target_addr ? &sa : NULL, sl TSRMLS_CC));
}
| 4,112 |
79,294 | 0 | static int get_samples_per_packet(MOVTrack *track)
{
int i, first_duration;
/* use 1 for raw PCM */
if (!track->audio_vbr)
return 1;
/* check to see if duration is constant for all clusters */
if (!track->entry)
return 0;
first_duration = get_cluster_duration(track, 0);
for (i = 1; i < track->entry; i++) {
if (get_cluster_duration(track, i) != first_duration)
return 0;
}
return first_duration;
}
| 4,113 |
87,663 | 0 | static int hsr_dev_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct hsr_priv *hsr = netdev_priv(dev);
struct hsr_port *master;
master = hsr_port_get_hsr(hsr, HSR_PT_MASTER);
skb->dev = master->dev;
hsr_forward_skb(skb, master);
return NETDEV_TX_OK;
}
| 4,114 |
157,437 | 0 | MediaElementAudioSourceNode* MediaElementAudioSourceNode::Create(
AudioContext& context,
HTMLMediaElement& media_element,
ExceptionState& exception_state) {
DCHECK(IsMainThread());
if (context.IsContextClosed()) {
context.ThrowExceptionForClosedState(exception_state);
return nullptr;
}
if (media_element.AudioSourceNode()) {
exception_state.ThrowDOMException(DOMExceptionCode::kInvalidStateError,
"HTMLMediaElement already connected "
"previously to a different "
"MediaElementSourceNode.");
return nullptr;
}
MediaElementAudioSourceNode* node =
new MediaElementAudioSourceNode(context, media_element);
if (node) {
media_element.SetAudioSourceNode(node);
context.NotifySourceNodeStartedProcessing(node);
if (!context.HasRealtimeConstraint()) {
Deprecation::CountDeprecation(
node->GetExecutionContext(),
WebFeature::kMediaElementSourceOnOfflineContext);
}
}
return node;
}
| 4,115 |
181,455 | 1 | static void put_crypt_info(struct fscrypt_info *ci)
{
if (!ci)
return;
key_put(ci->ci_keyring_key);
crypto_free_skcipher(ci->ci_ctfm);
kmem_cache_free(fscrypt_info_cachep, ci);
}
| 4,116 |
79,803 | 0 | static int uvesafb_vbe_getmodes(struct uvesafb_ktask *task,
struct uvesafb_par *par)
{
int off = 0, err;
u16 *mode;
par->vbe_modes_cnt = 0;
/* Count available modes. */
mode = (u16 *) (((u8 *)&par->vbe_ib) + par->vbe_ib.mode_list_ptr);
while (*mode != 0xffff) {
par->vbe_modes_cnt++;
mode++;
}
par->vbe_modes = kzalloc(sizeof(struct vbe_mode_ib) *
par->vbe_modes_cnt, GFP_KERNEL);
if (!par->vbe_modes)
return -ENOMEM;
/* Get info about all available modes. */
mode = (u16 *) (((u8 *)&par->vbe_ib) + par->vbe_ib.mode_list_ptr);
while (*mode != 0xffff) {
struct vbe_mode_ib *mib;
uvesafb_reset(task);
task->t.regs.eax = 0x4f01;
task->t.regs.ecx = (u32) *mode;
task->t.flags = TF_BUF_RET | TF_BUF_ESDI;
task->t.buf_len = sizeof(struct vbe_mode_ib);
task->buf = par->vbe_modes + off;
err = uvesafb_exec(task);
if (err || (task->t.regs.eax & 0xffff) != 0x004f) {
pr_warn("Getting mode info block for mode 0x%x failed (eax=0x%x, err=%d)\n",
*mode, (u32)task->t.regs.eax, err);
mode++;
par->vbe_modes_cnt--;
continue;
}
mib = task->buf;
mib->mode_id = *mode;
/*
* We only want modes that are supported with the current
* hardware configuration, color, graphics and that have
* support for the LFB.
*/
if ((mib->mode_attr & VBE_MODE_MASK) == VBE_MODE_MASK &&
mib->bits_per_pixel >= 8)
off++;
else
par->vbe_modes_cnt--;
mode++;
mib->depth = mib->red_len + mib->green_len + mib->blue_len;
/*
* Handle 8bpp modes and modes with broken color component
* lengths.
*/
if (mib->depth == 0 || (mib->depth == 24 &&
mib->bits_per_pixel == 32))
mib->depth = mib->bits_per_pixel;
}
if (par->vbe_modes_cnt > 0)
return 0;
else
return -EINVAL;
}
| 4,117 |
149,660 | 0 | bool ScrollAnchor::FindAnchorRecursive(LayoutObject* candidate) {
ExamineResult result = Examine(candidate);
if (result.viable) {
anchor_object_ = candidate;
corner_ = result.corner;
}
if (result.status == kReturn)
return true;
if (result.status == kSkip)
return false;
for (LayoutObject* child = candidate->SlowFirstChild(); child;
child = child->NextSibling()) {
if (FindAnchorRecursive(child))
return true;
}
if (auto* layouy_block = DynamicTo<LayoutBlock>(candidate)) {
if (TrackedLayoutBoxListHashSet* positioned_descendants =
layouy_block->PositionedObjects()) {
for (LayoutBox* descendant : *positioned_descendants) {
if (descendant->Parent() != candidate) {
if (FindAnchorRecursive(descendant))
return true;
}
}
}
}
if (result.status == kConstrain)
return true;
DCHECK_EQ(result.status, kContinue);
return false;
}
| 4,118 |
36,406 | 0 | static void pppol2tp_next_session(struct net *net, struct pppol2tp_seq_data *pd)
{
pd->session = l2tp_session_find_nth(pd->tunnel, pd->session_idx);
pd->session_idx++;
if (pd->session == NULL) {
pd->session_idx = 0;
pppol2tp_next_tunnel(net, pd);
}
}
| 4,119 |
9,879 | 0 | static void stream_int_chk_rcv_conn(struct stream_interface *si)
{
struct channel *ib = si->ib;
struct connection *conn = __objt_conn(si->end);
if (unlikely(si->state > SI_ST_EST || (ib->flags & CF_SHUTR)))
return;
conn_refresh_polling_flags(conn);
if ((ib->flags & CF_DONT_READ) || channel_full(ib)) {
/* stop reading */
if (!(ib->flags & CF_DONT_READ)) /* full */
si->flags |= SI_FL_WAIT_ROOM;
__conn_data_stop_recv(conn);
}
else {
/* (re)start reading */
si->flags &= ~SI_FL_WAIT_ROOM;
__conn_data_want_recv(conn);
}
conn_cond_update_data_polling(conn);
}
| 4,120 |
66,389 | 0 | static CCPrepare gen_prepare_cc(DisasContext *s, int b, TCGv reg)
{
int inv, jcc_op, cond;
TCGMemOp size;
CCPrepare cc;
TCGv t0;
inv = b & 1;
jcc_op = (b >> 1) & 7;
switch (s->cc_op) {
case CC_OP_SUBB ... CC_OP_SUBQ:
/* We optimize relational operators for the cmp/jcc case. */
size = s->cc_op - CC_OP_SUBB;
switch (jcc_op) {
case JCC_BE:
tcg_gen_mov_tl(cpu_tmp4, cpu_cc_srcT);
gen_extu(size, cpu_tmp4);
t0 = gen_ext_tl(cpu_tmp0, cpu_cc_src, size, false);
cc = (CCPrepare) { .cond = TCG_COND_LEU, .reg = cpu_tmp4,
.reg2 = t0, .mask = -1, .use_reg2 = true };
break;
case JCC_L:
cond = TCG_COND_LT;
goto fast_jcc_l;
case JCC_LE:
cond = TCG_COND_LE;
fast_jcc_l:
tcg_gen_mov_tl(cpu_tmp4, cpu_cc_srcT);
gen_exts(size, cpu_tmp4);
t0 = gen_ext_tl(cpu_tmp0, cpu_cc_src, size, true);
cc = (CCPrepare) { .cond = cond, .reg = cpu_tmp4,
.reg2 = t0, .mask = -1, .use_reg2 = true };
break;
default:
goto slow_jcc;
}
break;
default:
slow_jcc:
/* This actually generates good code for JC, JZ and JS. */
switch (jcc_op) {
case JCC_O:
cc = gen_prepare_eflags_o(s, reg);
break;
case JCC_B:
cc = gen_prepare_eflags_c(s, reg);
break;
case JCC_Z:
cc = gen_prepare_eflags_z(s, reg);
break;
case JCC_BE:
gen_compute_eflags(s);
cc = (CCPrepare) { .cond = TCG_COND_NE, .reg = cpu_cc_src,
.mask = CC_Z | CC_C };
break;
case JCC_S:
cc = gen_prepare_eflags_s(s, reg);
break;
case JCC_P:
cc = gen_prepare_eflags_p(s, reg);
break;
case JCC_L:
gen_compute_eflags(s);
if (TCGV_EQUAL(reg, cpu_cc_src)) {
reg = cpu_tmp0;
}
tcg_gen_shri_tl(reg, cpu_cc_src, 4); /* CC_O -> CC_S */
tcg_gen_xor_tl(reg, reg, cpu_cc_src);
cc = (CCPrepare) { .cond = TCG_COND_NE, .reg = reg,
.mask = CC_S };
break;
default:
case JCC_LE:
gen_compute_eflags(s);
if (TCGV_EQUAL(reg, cpu_cc_src)) {
reg = cpu_tmp0;
}
tcg_gen_shri_tl(reg, cpu_cc_src, 4); /* CC_O -> CC_S */
tcg_gen_xor_tl(reg, reg, cpu_cc_src);
cc = (CCPrepare) { .cond = TCG_COND_NE, .reg = reg,
.mask = CC_S | CC_Z };
break;
}
break;
}
if (inv) {
cc.cond = tcg_invert_cond(cc.cond);
}
return cc;
}
| 4,121 |
185,627 | 1 | void SetManualFallbacksForFilling(bool enabled) {
if (enabled) {
scoped_feature_list_.InitAndEnableFeature(
password_manager::features::kEnableManualFallbacksFilling);
} else {
scoped_feature_list_.InitAndDisableFeature(
password_manager::features::kEnableManualFallbacksFilling);
}
}
| 4,122 |
131,546 | 0 | static void overloadedMethodFMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
TestObjectPythonV8Internal::overloadedMethodFMethod(info);
TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
}
| 4,123 |
52,604 | 0 | record_hardlink(struct archive_read *a,
struct cpio *cpio, struct archive_entry *entry)
{
struct links_entry *le;
dev_t dev;
int64_t ino;
if (archive_entry_nlink(entry) <= 1)
return (ARCHIVE_OK);
dev = archive_entry_dev(entry);
ino = archive_entry_ino64(entry);
/*
* First look in the list of multiply-linked files. If we've
* already dumped it, convert this entry to a hard link entry.
*/
for (le = cpio->links_head; le; le = le->next) {
if (le->dev == dev && le->ino == ino) {
archive_entry_copy_hardlink(entry, le->name);
if (--le->links <= 0) {
if (le->previous != NULL)
le->previous->next = le->next;
if (le->next != NULL)
le->next->previous = le->previous;
if (cpio->links_head == le)
cpio->links_head = le->next;
free(le->name);
free(le);
}
return (ARCHIVE_OK);
}
}
le = (struct links_entry *)malloc(sizeof(struct links_entry));
if (le == NULL) {
archive_set_error(&a->archive,
ENOMEM, "Out of memory adding file to list");
return (ARCHIVE_FATAL);
}
if (cpio->links_head != NULL)
cpio->links_head->previous = le;
le->next = cpio->links_head;
le->previous = NULL;
cpio->links_head = le;
le->dev = dev;
le->ino = ino;
le->links = archive_entry_nlink(entry) - 1;
le->name = strdup(archive_entry_pathname(entry));
if (le->name == NULL) {
archive_set_error(&a->archive,
ENOMEM, "Out of memory adding file to list");
return (ARCHIVE_FATAL);
}
return (ARCHIVE_OK);
}
| 4,124 |
80,099 | 0 | GF_Box *extr_New()
{
ISOM_DECL_BOX_ALLOC(GF_ExtraDataBox, GF_ISOM_BOX_TYPE_EXTR);
return (GF_Box *)tmp;
}
| 4,125 |
10,944 | 0 | static void exif_iif_add_tag(image_info_type *image_info, int section_index, char *name, int tag, int format, size_t length, void* value TSRMLS_DC)
{
exif_iif_add_value(image_info, section_index, name, tag, format, (int)length, value, image_info->motorola_intel TSRMLS_CC);
}
| 4,126 |
116,695 | 0 | void RenderViewImpl::registerProtocolHandler(const WebString& scheme,
const WebString& base_url,
const WebString& url,
const WebString& title) {
GURL base(base_url);
GURL absolute_url = base.Resolve(UTF16ToUTF8(url));
if (base.GetOrigin() != absolute_url.GetOrigin()) {
return;
}
Send(new ViewHostMsg_RegisterProtocolHandler(routing_id_,
UTF16ToUTF8(scheme),
absolute_url,
title));
}
| 4,127 |
30,170 | 0 | int ftrace_is_dead(void)
{
return ftrace_disabled;
}
| 4,128 |
183,238 | 1 | psf_close (SF_PRIVATE *psf)
{ uint32_t k ;
int error = 0 ;
if (psf->codec_close)
{ error = psf->codec_close (psf) ;
/* To prevent it being called in psf->container_close(). */
psf->codec_close = NULL ;
} ;
if (psf->container_close)
error = psf->container_close (psf) ;
error = psf_fclose (psf) ;
psf_close_rsrc (psf) ;
/* For an ISO C compliant implementation it is ok to free a NULL pointer. */
free (psf->container_data) ;
free (psf->codec_data) ;
free (psf->interleave) ;
free (psf->dither) ;
free (psf->peak_info) ;
free (psf->broadcast_16k) ;
free (psf->loop_info) ;
free (psf->instrument) ;
free (psf->cues) ;
free (psf->channel_map) ;
free (psf->format_desc) ;
free (psf->strings.storage) ;
if (psf->wchunks.chunks)
for (k = 0 ; k < psf->wchunks.used ; k++)
free (psf->wchunks.chunks [k].data) ;
free (psf->rchunks.chunks) ;
free (psf->wchunks.chunks) ;
free (psf->iterator) ;
free (psf->cart_16k) ;
memset (psf, 0, sizeof (SF_PRIVATE)) ;
free (psf) ;
return error ;
} /* psf_close */
| 4,129 |
29,260 | 0 | static int ip_vs_genl_fill_dest(struct sk_buff *skb, struct ip_vs_dest *dest)
{
struct nlattr *nl_dest;
nl_dest = nla_nest_start(skb, IPVS_CMD_ATTR_DEST);
if (!nl_dest)
return -EMSGSIZE;
NLA_PUT(skb, IPVS_DEST_ATTR_ADDR, sizeof(dest->addr), &dest->addr);
NLA_PUT_U16(skb, IPVS_DEST_ATTR_PORT, dest->port);
NLA_PUT_U32(skb, IPVS_DEST_ATTR_FWD_METHOD,
atomic_read(&dest->conn_flags) & IP_VS_CONN_F_FWD_MASK);
NLA_PUT_U32(skb, IPVS_DEST_ATTR_WEIGHT, atomic_read(&dest->weight));
NLA_PUT_U32(skb, IPVS_DEST_ATTR_U_THRESH, dest->u_threshold);
NLA_PUT_U32(skb, IPVS_DEST_ATTR_L_THRESH, dest->l_threshold);
NLA_PUT_U32(skb, IPVS_DEST_ATTR_ACTIVE_CONNS,
atomic_read(&dest->activeconns));
NLA_PUT_U32(skb, IPVS_DEST_ATTR_INACT_CONNS,
atomic_read(&dest->inactconns));
NLA_PUT_U32(skb, IPVS_DEST_ATTR_PERSIST_CONNS,
atomic_read(&dest->persistconns));
if (ip_vs_genl_fill_stats(skb, IPVS_DEST_ATTR_STATS, &dest->stats))
goto nla_put_failure;
nla_nest_end(skb, nl_dest);
return 0;
nla_put_failure:
nla_nest_cancel(skb, nl_dest);
return -EMSGSIZE;
}
| 4,130 |
32 | 0 | void help(void)
{
printf(_("%s %s -- get file access control lists\n"),
progname, VERSION);
printf(_("Usage: %s [-%s] file ...\n"),
progname, cmd_line_options);
#if !POSIXLY_CORRECT
if (posixly_correct) {
#endif
printf(_(
" -d, --default display the default access control list\n"));
#if !POSIXLY_CORRECT
} else {
printf(_(
" -a, --access display the file access control list only\n"
" -d, --default display the default access control list only\n"
" -c, --omit-header do not display the comment header\n"
" -e, --all-effective print all effective rights\n"
" -E, --no-effective print no effective rights\n"
" -s, --skip-base skip files that only have the base entries\n"
" -R, --recursive recurse into subdirectories\n"
" -L, --logical logical walk, follow symbolic links\n"
" -P, --physical physical walk, do not follow symbolic links\n"
" -t, --tabular use tabular output format\n"
" -n, --numeric print numeric user/group identifiers\n"
" -p, --absolute-names don't strip leading '/' in pathnames\n"));
}
#endif
printf(_(
" -v, --version print version and exit\n"
" -h, --help this help text\n"));
}
| 4,131 |
75,654 | 0 | static char *write_metadata (WavpackMetadata *wpmd, char *outdata)
{
unsigned char id = wpmd->id, wordlen [3];
wordlen [0] = (wpmd->byte_length + 1) >> 1;
wordlen [1] = (wpmd->byte_length + 1) >> 9;
wordlen [2] = (wpmd->byte_length + 1) >> 17;
if (wpmd->byte_length & 1)
id |= ID_ODD_SIZE;
if (wordlen [1] || wordlen [2])
id |= ID_LARGE;
*outdata++ = id;
*outdata++ = wordlen [0];
if (id & ID_LARGE) {
*outdata++ = wordlen [1];
*outdata++ = wordlen [2];
}
if (wpmd->data && wpmd->byte_length) {
memcpy (outdata, wpmd->data, wpmd->byte_length);
outdata += wpmd->byte_length;
if (wpmd->byte_length & 1)
*outdata++ = 0;
}
return outdata;
}
| 4,132 |
182,001 | 1 | void test_parser(void) {
int i, retval;
bzrtpPacket_t *zrtpPacket;
/* Create zrtp Context to use H0-H3 chains and others */
bzrtpContext_t *context87654321 = bzrtp_createBzrtpContext(0x87654321);
bzrtpContext_t *context12345678 = bzrtp_createBzrtpContext(0x12345678);
/* replace created H by the patterns one to be able to generate the correct packet */
memcpy (context12345678->channelContext[0]->selfH[0], H12345678[0], 32);
memcpy (context12345678->channelContext[0]->selfH[1], H12345678[1], 32);
memcpy (context12345678->channelContext[0]->selfH[2], H12345678[2], 32);
memcpy (context12345678->channelContext[0]->selfH[3], H12345678[3], 32);
memcpy (context87654321->channelContext[0]->selfH[0], H87654321[0], 32);
memcpy (context87654321->channelContext[0]->selfH[1], H87654321[1], 32);
memcpy (context87654321->channelContext[0]->selfH[2], H87654321[2], 32);
memcpy (context87654321->channelContext[0]->selfH[3], H87654321[3], 32);
/* preset the key agreement algo in the contexts */
context87654321->channelContext[0]->keyAgreementAlgo = ZRTP_KEYAGREEMENT_DH3k;
context12345678->channelContext[0]->keyAgreementAlgo = ZRTP_KEYAGREEMENT_DH3k;
context87654321->channelContext[0]->cipherAlgo = ZRTP_CIPHER_AES1;
context12345678->channelContext[0]->cipherAlgo = ZRTP_CIPHER_AES1;
context87654321->channelContext[0]->hashAlgo = ZRTP_HASH_S256;
context12345678->channelContext[0]->hashAlgo = ZRTP_HASH_S256;
updateCryptoFunctionPointers(context87654321->channelContext[0]);
updateCryptoFunctionPointers(context12345678->channelContext[0]);
/* set the zrtp and mac keys */
context87654321->channelContext[0]->mackeyi = (uint8_t *)malloc(32);
context12345678->channelContext[0]->mackeyi = (uint8_t *)malloc(32);
context87654321->channelContext[0]->mackeyr = (uint8_t *)malloc(32);
context12345678->channelContext[0]->mackeyr = (uint8_t *)malloc(32);
context87654321->channelContext[0]->zrtpkeyi = (uint8_t *)malloc(16);
context12345678->channelContext[0]->zrtpkeyi = (uint8_t *)malloc(16);
context87654321->channelContext[0]->zrtpkeyr = (uint8_t *)malloc(16);
context12345678->channelContext[0]->zrtpkeyr = (uint8_t *)malloc(16);
memcpy(context12345678->channelContext[0]->mackeyi, mackeyi, 32);
memcpy(context12345678->channelContext[0]->mackeyr, mackeyr, 32);
memcpy(context12345678->channelContext[0]->zrtpkeyi, zrtpkeyi, 16);
memcpy(context12345678->channelContext[0]->zrtpkeyr, zrtpkeyr, 16);
memcpy(context87654321->channelContext[0]->mackeyi, mackeyi, 32);
memcpy(context87654321->channelContext[0]->mackeyr, mackeyr, 32);
memcpy(context87654321->channelContext[0]->zrtpkeyi, zrtpkeyi, 16);
memcpy(context87654321->channelContext[0]->zrtpkeyr, zrtpkeyr, 16);
/* set the role: 87654321 is initiator in our exchange pattern */
context12345678->channelContext[0]->role = RESPONDER;
for (i=0; i<TEST_PACKET_NUMBER; i++) {
uint8_t freePacketFlag = 1;
/* parse a packet string from patterns */
zrtpPacket = bzrtp_packetCheck(patternZRTPPackets[i], patternZRTPMetaData[i][0], (patternZRTPMetaData[i][1])-1, &retval);
retval += bzrtp_packetParser((patternZRTPMetaData[i][2]==0x87654321)?context12345678:context87654321, (patternZRTPMetaData[i][2]==0x87654321)?context12345678->channelContext[0]:context87654321->channelContext[0], patternZRTPPackets[i], patternZRTPMetaData[i][0], zrtpPacket);
/*printf("parsing Ret val is %x index is %d\n", retval, i);*
/* We must store some packets in the context if we want to be able to parse further packets */
if (zrtpPacket->messageType==MSGTYPE_HELLO) {
if (patternZRTPMetaData[i][2]==0x87654321) {
context12345678->channelContext[0]->peerPackets[HELLO_MESSAGE_STORE_ID] = zrtpPacket;
} else {
context87654321->channelContext[0]->peerPackets[HELLO_MESSAGE_STORE_ID] = zrtpPacket;
}
freePacketFlag = 0;
}
if (zrtpPacket->messageType==MSGTYPE_COMMIT) {
if (patternZRTPMetaData[i][2]==0x87654321) {
context12345678->channelContext[0]->peerPackets[COMMIT_MESSAGE_STORE_ID] = zrtpPacket;
} else {
context87654321->channelContext[0]->peerPackets[COMMIT_MESSAGE_STORE_ID] = zrtpPacket;
}
freePacketFlag = 0;
}
if (zrtpPacket->messageType==MSGTYPE_DHPART1 || zrtpPacket->messageType==MSGTYPE_DHPART2) {
if (patternZRTPMetaData[i][2]==0x87654321) {
context12345678->channelContext[0]->peerPackets[DHPART_MESSAGE_STORE_ID] = zrtpPacket;
} else {
context87654321->channelContext[0]->peerPackets[DHPART_MESSAGE_STORE_ID] = zrtpPacket;
}
freePacketFlag = 0;
}
/* free the packet string as will be created again by the packetBuild function and might have been copied by packetParser */
free(zrtpPacket->packetString);
/* build a packet string from the parser packet*/
retval = bzrtp_packetBuild((patternZRTPMetaData[i][2]==0x12345678)?context12345678:context87654321, (patternZRTPMetaData[i][2]==0x12345678)?context12345678->channelContext[0]:context87654321->channelContext[0], zrtpPacket, patternZRTPMetaData[i][1]);
/* if (retval ==0) {
packetDump(zrtpPacket, 1);
} else {
bzrtp_message("Ret val is %x index is %d\n", retval, i);
}*/
/* check they are the same */
if (zrtpPacket->packetString != NULL) {
CU_ASSERT_TRUE(memcmp(zrtpPacket->packetString, patternZRTPPackets[i], patternZRTPMetaData[i][0]) == 0);
} else {
CU_FAIL("Unable to build packet");
}
if (freePacketFlag == 1) {
bzrtp_freeZrtpPacket(zrtpPacket);
}
}
bzrtp_destroyBzrtpContext(context87654321, 0x87654321);
bzrtp_destroyBzrtpContext(context12345678, 0x12345678);
}
| 4,133 |
27,270 | 0 | static int ksm_memory_callback(struct notifier_block *self,
unsigned long action, void *arg)
{
struct memory_notify *mn = arg;
struct stable_node *stable_node;
switch (action) {
case MEM_GOING_OFFLINE:
/*
* Keep it very simple for now: just lock out ksmd and
* MADV_UNMERGEABLE while any memory is going offline.
* mutex_lock_nested() is necessary because lockdep was alarmed
* that here we take ksm_thread_mutex inside notifier chain
* mutex, and later take notifier chain mutex inside
* ksm_thread_mutex to unlock it. But that's safe because both
* are inside mem_hotplug_mutex.
*/
mutex_lock_nested(&ksm_thread_mutex, SINGLE_DEPTH_NESTING);
break;
case MEM_OFFLINE:
/*
* Most of the work is done by page migration; but there might
* be a few stable_nodes left over, still pointing to struct
* pages which have been offlined: prune those from the tree.
*/
while ((stable_node = ksm_check_stable_tree(mn->start_pfn,
mn->start_pfn + mn->nr_pages)) != NULL)
remove_node_from_stable_tree(stable_node);
/* fallthrough */
case MEM_CANCEL_OFFLINE:
mutex_unlock(&ksm_thread_mutex);
break;
}
return NOTIFY_OK;
}
| 4,134 |
4,711 | 0 | account_type_from_pwent (struct passwd *pwent)
{
struct group *grp;
gint i;
if (pwent->pw_uid == 0) {
g_debug ("user is root so account type is administrator");
return ACCOUNT_TYPE_ADMINISTRATOR;
}
grp = getgrnam (ADMIN_GROUP);
if (grp == NULL) {
g_debug (ADMIN_GROUP " group not found");
return ACCOUNT_TYPE_STANDARD;
}
for (i = 0; grp->gr_mem[i] != NULL; i++) {
if (g_strcmp0 (grp->gr_mem[i], pwent->pw_name) == 0) {
return ACCOUNT_TYPE_ADMINISTRATOR;
}
}
return ACCOUNT_TYPE_STANDARD;
}
| 4,135 |
69,185 | 0 | ZEND_API int ZEND_FASTCALL zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos)
{
uint32_t idx = *pos;
Bucket *p;
IS_CONSISTENT(ht);
if (idx != HT_INVALID_IDX) {
p = ht->arData + idx;
if (p->key) {
return HASH_KEY_IS_STRING;
} else {
return HASH_KEY_IS_LONG;
}
}
return HASH_KEY_NON_EXISTENT;
}
| 4,136 |
35,137 | 0 | static int start_khugepaged(void)
{
int err = 0;
if (khugepaged_enabled()) {
int wakeup;
if (unlikely(!mm_slot_cache || !mm_slots_hash)) {
err = -ENOMEM;
goto out;
}
mutex_lock(&khugepaged_mutex);
if (!khugepaged_thread)
khugepaged_thread = kthread_run(khugepaged, NULL,
"khugepaged");
if (unlikely(IS_ERR(khugepaged_thread))) {
printk(KERN_ERR
"khugepaged: kthread_run(khugepaged) failed\n");
err = PTR_ERR(khugepaged_thread);
khugepaged_thread = NULL;
}
wakeup = !list_empty(&khugepaged_scan.mm_head);
mutex_unlock(&khugepaged_mutex);
if (wakeup)
wake_up_interruptible(&khugepaged_wait);
set_recommended_min_free_kbytes();
} else
/* wakeup to exit */
wake_up_interruptible(&khugepaged_wait);
out:
return err;
}
| 4,137 |
108,772 | 0 | bool ChildProcessSecurityPolicyImpl::CanReadFileSystem(
int child_id, const std::string& filesystem_id) {
return HasPermissionsForFileSystem(child_id,
filesystem_id,
kReadFilePermissions);
}
| 4,138 |
98,917 | 0 | void HTMLConstructionSite::generateImpliedEndTags()
{
while (hasImpliedEndTag(currentElement()))
m_openElements.pop();
}
| 4,139 |
56,972 | 0 | void fuse_sync_release(struct fuse_file *ff, int flags)
{
WARN_ON(atomic_read(&ff->count) > 1);
fuse_prepare_release(ff, flags, FUSE_RELEASE);
__set_bit(FR_FORCE, &ff->reserved_req->flags);
__clear_bit(FR_BACKGROUND, &ff->reserved_req->flags);
fuse_request_send(ff->fc, ff->reserved_req);
fuse_put_request(ff->fc, ff->reserved_req);
kfree(ff);
}
| 4,140 |
2,478 | 0 | NTSTATUS smbXcli_negprot(struct smbXcli_conn *conn,
uint32_t timeout_msec,
enum protocol_types min_protocol,
enum protocol_types max_protocol)
{
TALLOC_CTX *frame = talloc_stackframe();
struct tevent_context *ev;
struct tevent_req *req;
NTSTATUS status = NT_STATUS_NO_MEMORY;
bool ok;
if (smbXcli_conn_has_async_calls(conn)) {
/*
* Can't use sync call while an async call is in flight
*/
status = NT_STATUS_INVALID_PARAMETER_MIX;
goto fail;
}
ev = samba_tevent_context_init(frame);
if (ev == NULL) {
goto fail;
}
req = smbXcli_negprot_send(frame, ev, conn, timeout_msec,
min_protocol, max_protocol);
if (req == NULL) {
goto fail;
}
ok = tevent_req_poll_ntstatus(req, ev, &status);
if (!ok) {
goto fail;
}
status = smbXcli_negprot_recv(req);
fail:
TALLOC_FREE(frame);
return status;
}
| 4,141 |
7,778 | 0 | static void h2_send(struct connection *conn)
{
struct h2c *h2c = conn->mux_ctx;
int done;
if (conn->flags & CO_FL_ERROR)
return;
if (conn->flags & (CO_FL_HANDSHAKE|CO_FL_WAIT_L4_CONN|CO_FL_WAIT_L6_CONN)) {
/* a handshake was requested */
return;
}
/* This loop is quite simple : it tries to fill as much as it can from
* pending streams into the existing buffer until it's reportedly full
* or the end of send requests is reached. Then it tries to send this
* buffer's contents out, marks it not full if at least one byte could
* be sent, and tries again.
*
* The snd_buf() function normally takes a "flags" argument which may
* be made of a combination of CO_SFL_MSG_MORE to indicate that more
* data immediately comes and CO_SFL_STREAMER to indicate that the
* connection is streaming lots of data (used to increase TLS record
* size at the expense of latency). The former can be sent any time
* there's a buffer full flag, as it indicates at least one stream
* attempted to send and failed so there are pending data. An
* alternative would be to set it as long as there's an active stream
* but that would be problematic for ACKs until we have an absolute
* guarantee that all waiters have at least one byte to send. The
* latter should possibly not be set for now.
*/
done = 0;
while (!done) {
unsigned int flags = 0;
/* fill as much as we can into the current buffer */
while (((h2c->flags & (H2_CF_MUX_MFULL|H2_CF_MUX_MALLOC)) == 0) && !done)
done = h2_process_mux(h2c);
if (conn->flags & CO_FL_ERROR)
break;
if (h2c->flags & (H2_CF_MUX_MFULL | H2_CF_DEM_MBUSY | H2_CF_DEM_MROOM))
flags |= CO_SFL_MSG_MORE;
if (h2c->mbuf->o && conn->xprt->snd_buf(conn, h2c->mbuf, flags) <= 0)
break;
/* wrote at least one byte, the buffer is not full anymore */
h2c->flags &= ~(H2_CF_MUX_MFULL | H2_CF_DEM_MROOM);
}
if (conn->flags & CO_FL_SOCK_WR_SH) {
/* output closed, nothing to send, clear the buffer to release it */
h2c->mbuf->o = 0;
}
}
| 4,142 |
67,144 | 0 | int nfsd_nrthreads(struct net *net)
{
int rv = 0;
struct nfsd_net *nn = net_generic(net, nfsd_net_id);
mutex_lock(&nfsd_mutex);
if (nn->nfsd_serv)
rv = nn->nfsd_serv->sv_nrthreads;
mutex_unlock(&nfsd_mutex);
return rv;
}
| 4,143 |
43,695 | 0 | static int walk_component(struct nameidata *nd, int flags)
{
struct path path;
struct inode *inode;
unsigned seq;
int err;
/*
* "." and ".." are special - ".." especially so because it has
* to be able to know about the current root directory and
* parent relationships.
*/
if (unlikely(nd->last_type != LAST_NORM)) {
err = handle_dots(nd, nd->last_type);
if (flags & WALK_PUT)
put_link(nd);
return err;
}
err = lookup_fast(nd, &path, &inode, &seq);
if (unlikely(err)) {
if (err < 0)
return err;
err = lookup_slow(nd, &path);
if (err < 0)
return err;
inode = d_backing_inode(path.dentry);
seq = 0; /* we are already out of RCU mode */
err = -ENOENT;
if (d_is_negative(path.dentry))
goto out_path_put;
}
if (flags & WALK_PUT)
put_link(nd);
err = should_follow_link(nd, &path, flags & WALK_GET, inode, seq);
if (unlikely(err))
return err;
path_to_nameidata(&path, nd);
nd->inode = inode;
nd->seq = seq;
return 0;
out_path_put:
path_to_nameidata(&path, nd);
return err;
}
| 4,144 |
100,595 | 0 | void MenuGtk::PopupAsContext(guint32 event_time) {
gtk_menu_popup(GTK_MENU(menu_.get()), NULL, NULL, NULL, NULL, 3, event_time);
}
| 4,145 |
135,271 | 0 | PassRefPtrWillBeRawPtr<DocumentParser> Document::implicitOpen(ParserSynchronizationPolicy parserSyncPolicy)
{
detachParser();
removeChildren();
ASSERT(!m_focusedElement);
setCompatibilityMode(NoQuirksMode);
if (!threadedParsingEnabledForTesting())
parserSyncPolicy = ForceSynchronousParsing;
m_parserSyncPolicy = parserSyncPolicy;
m_parser = createParser();
setParsingState(Parsing);
setReadyState(Loading);
return m_parser;
}
| 4,146 |
43,679 | 0 | static int path_parentat(struct nameidata *nd, unsigned flags,
struct path *parent)
{
const char *s = path_init(nd, flags);
int err;
if (IS_ERR(s))
return PTR_ERR(s);
err = link_path_walk(s, nd);
if (!err)
err = complete_walk(nd);
if (!err) {
*parent = nd->path;
nd->path.mnt = NULL;
nd->path.dentry = NULL;
}
terminate_walk(nd);
return err;
}
| 4,147 |
73,787 | 0 | static void freeBuf(void* p){
free(p);
}
| 4,148 |
131,740 | 0 | static void strictTypeCheckingFloatAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
TestObjectPythonV8Internal::strictTypeCheckingFloatAttributeAttributeGetter(info);
TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
}
| 4,149 |
160,313 | 0 | void ImageLoader::DecodeRequest::Reject() {
resolver_->Reject(DOMException::Create(
kEncodingError, "The source image cannot be decoded."));
loader_ = nullptr;
}
| 4,150 |
18,153 | 0 | kick_jobs(tube t, unsigned int n)
{
if (buried_job_p(t)) return kick_buried_jobs(t, n);
return kick_delayed_jobs(t, n);
}
| 4,151 |
83,747 | 0 | static int index_remove_entry(git_index *index, size_t pos)
{
int error = 0;
git_index_entry *entry = git_vector_get(&index->entries, pos);
if (entry != NULL) {
git_tree_cache_invalidate_path(index->tree, entry->path);
DELETE_IN_MAP(index, entry);
}
error = git_vector_remove(&index->entries, pos);
if (!error) {
if (git_atomic_get(&index->readers) > 0) {
error = git_vector_insert(&index->deleted, entry);
} else {
index_entry_free(entry);
}
}
return error;
}
| 4,152 |
167,776 | 0 | void WebRuntimeFeatures::EnableTimerThrottlingForBackgroundTabs(bool enable) {
RuntimeEnabledFeatures::SetTimerThrottlingForBackgroundTabsEnabled(enable);
}
| 4,153 |
168,201 | 0 | bool WebBluetoothServiceImpl::IsDevicePaired(
const std::string& device_address) {
return allowed_devices().GetDeviceId(device_address) != nullptr;
}
| 4,154 |
20,516 | 0 | static ssize_t ext4_quota_read(struct super_block *sb, int type, char *data,
size_t len, loff_t off)
{
struct inode *inode = sb_dqopt(sb)->files[type];
ext4_lblk_t blk = off >> EXT4_BLOCK_SIZE_BITS(sb);
int err = 0;
int offset = off & (sb->s_blocksize - 1);
int tocopy;
size_t toread;
struct buffer_head *bh;
loff_t i_size = i_size_read(inode);
if (off > i_size)
return 0;
if (off+len > i_size)
len = i_size-off;
toread = len;
while (toread > 0) {
tocopy = sb->s_blocksize - offset < toread ?
sb->s_blocksize - offset : toread;
bh = ext4_bread(NULL, inode, blk, 0, &err);
if (err)
return err;
if (!bh) /* A hole? */
memset(data, 0, tocopy);
else
memcpy(data, bh->b_data+offset, tocopy);
brelse(bh);
offset = 0;
toread -= tocopy;
data += tocopy;
blk++;
}
return len;
}
| 4,155 |
122,997 | 0 | bool RenderWidgetHostImpl::OnMessageReceived(const IPC::Message &msg) {
bool handled = true;
bool msg_is_ok = true;
IPC_BEGIN_MESSAGE_MAP_EX(RenderWidgetHostImpl, msg, msg_is_ok)
IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnMsgRenderViewReady)
IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewGone, OnMsgRenderViewGone)
IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnMsgClose)
IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateScreenRects_ACK,
OnMsgUpdateScreenRectsAck)
IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnMsgRequestMove)
IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnMsgSetTooltipText)
IPC_MESSAGE_HANDLER(ViewHostMsg_PaintAtSize_ACK, OnMsgPaintAtSizeAck)
IPC_MESSAGE_HANDLER(ViewHostMsg_CompositorSurfaceBuffersSwapped,
OnCompositorSurfaceBuffersSwapped)
IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnMsgUpdateRect)
IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateIsDelayed, OnMsgUpdateIsDelayed)
IPC_MESSAGE_HANDLER(ViewHostMsg_HandleInputEvent_ACK, OnMsgInputEventAck)
IPC_MESSAGE_HANDLER(ViewHostMsg_BeginSmoothScroll, OnMsgBeginSmoothScroll)
IPC_MESSAGE_HANDLER(ViewHostMsg_SelectRange_ACK, OnMsgSelectRangeAck)
IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnMsgFocus)
IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnMsgBlur)
IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers,
OnMsgHasTouchEventHandlers)
IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnMsgSetCursor)
IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged,
OnMsgTextInputStateChanged)
IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCompositionRangeChanged,
OnMsgImeCompositionRangeChanged)
IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCancelComposition,
OnMsgImeCancelComposition)
IPC_MESSAGE_HANDLER(ViewHostMsg_DidActivateAcceleratedCompositing,
OnMsgDidActivateAcceleratedCompositing)
IPC_MESSAGE_HANDLER(ViewHostMsg_LockMouse, OnMsgLockMouse)
IPC_MESSAGE_HANDLER(ViewHostMsg_UnlockMouse, OnMsgUnlockMouse)
IPC_MESSAGE_HANDLER(ViewHostMsg_ShowDisambiguationPopup,
OnMsgShowDisambiguationPopup)
#if defined(OS_MACOSX)
IPC_MESSAGE_HANDLER(ViewHostMsg_PluginFocusChanged,
OnMsgPluginFocusChanged)
IPC_MESSAGE_HANDLER(ViewHostMsg_StartPluginIme,
OnMsgStartPluginIme)
IPC_MESSAGE_HANDLER(ViewHostMsg_AllocateFakePluginWindowHandle,
OnAllocateFakePluginWindowHandle)
IPC_MESSAGE_HANDLER(ViewHostMsg_DestroyFakePluginWindowHandle,
OnDestroyFakePluginWindowHandle)
IPC_MESSAGE_HANDLER(ViewHostMsg_AcceleratedSurfaceSetIOSurface,
OnAcceleratedSurfaceSetIOSurface)
IPC_MESSAGE_HANDLER(ViewHostMsg_AcceleratedSurfaceSetTransportDIB,
OnAcceleratedSurfaceSetTransportDIB)
IPC_MESSAGE_HANDLER(ViewHostMsg_AcceleratedSurfaceBuffersSwapped,
OnAcceleratedSurfaceBuffersSwapped)
#endif
#if defined(OS_ANDROID)
IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateFrameInfo,
OnMsgUpdateFrameInfo)
#endif
#if defined(TOOLKIT_GTK)
IPC_MESSAGE_HANDLER(ViewHostMsg_CreatePluginContainer,
OnMsgCreatePluginContainer)
IPC_MESSAGE_HANDLER(ViewHostMsg_DestroyPluginContainer,
OnMsgDestroyPluginContainer)
#endif
#if defined(OS_WIN)
IPC_MESSAGE_HANDLER(ViewHostMsg_WindowlessPluginDummyWindowCreated,
OnWindowlessPluginDummyWindowCreated)
IPC_MESSAGE_HANDLER(ViewHostMsg_WindowlessPluginDummyWindowDestroyed,
OnWindowlessPluginDummyWindowDestroyed)
#endif
#if defined(OS_CHROMEOS) // http://crbug.com/162981
IPC_MESSAGE_HANDLER(ViewHostMsg_GetWindowRect, OnMsgGetWindowRect)
IPC_MESSAGE_HANDLER(ViewHostMsg_GetRootWindowRect, OnMsgGetRootWindowRect)
#endif
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP_EX()
if (!msg_is_ok) {
RecordAction(UserMetricsAction("BadMessageTerminate_RWH"));
GetProcess()->ReceivedBadMessage();
}
return handled;
}
| 4,156 |
163,171 | 0 | BrowserSideNavigationBrowserDisableWebSecurityTest() {}
| 4,157 |
118,548 | 0 | void RenderFrameImpl::willSubmitForm(blink::WebLocalFrame* frame,
const blink::WebFormElement& form) {
DCHECK(!frame_ || frame_ == frame);
DocumentState* document_state =
DocumentState::FromDataSource(frame->provisionalDataSource());
NavigationState* navigation_state = document_state->navigation_state();
InternalDocumentStateData* internal_data =
InternalDocumentStateData::FromDocumentState(document_state);
if (PageTransitionCoreTypeIs(navigation_state->transition_type(),
PAGE_TRANSITION_LINK)) {
navigation_state->set_transition_type(PAGE_TRANSITION_FORM_SUBMIT);
}
WebSearchableFormData web_searchable_form_data(form);
internal_data->set_searchable_form_url(web_searchable_form_data.url());
internal_data->set_searchable_form_encoding(
web_searchable_form_data.encoding().utf8());
FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(),
WillSubmitForm(frame, form));
}
| 4,158 |
140,336 | 0 | static PassRefPtr<Image> imageFromNode(const Node& node) {
DCHECK(!node.document().needsLayoutTreeUpdate());
DocumentLifecycle::DisallowTransitionScope disallowTransition(
node.document().lifecycle());
LayoutObject* layoutObject = node.layoutObject();
if (!layoutObject)
return nullptr;
if (layoutObject->isCanvas()) {
return toHTMLCanvasElement(node).copiedImage(
FrontBuffer, PreferNoAcceleration, SnapshotReasonCopyToClipboard);
}
if (layoutObject->isImage()) {
LayoutImage* layoutImage = toLayoutImage(layoutObject);
if (!layoutImage)
return nullptr;
ImageResourceContent* cachedImage = layoutImage->cachedImage();
if (!cachedImage || cachedImage->errorOccurred())
return nullptr;
return cachedImage->getImage();
}
return nullptr;
}
| 4,159 |
50,990 | 0 | static int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp,
int *valp,
int write, void *data)
{
if (write) {
if (*negp) {
if (*lvalp > (unsigned long) INT_MAX + 1)
return -EINVAL;
*valp = -*lvalp;
} else {
if (*lvalp > (unsigned long) INT_MAX)
return -EINVAL;
*valp = *lvalp;
}
} else {
int val = *valp;
if (val < 0) {
*negp = true;
*lvalp = -(unsigned long)val;
} else {
*negp = false;
*lvalp = (unsigned long)val;
}
}
return 0;
}
| 4,160 |
169,174 | 0 | void RenderFrameHostImpl::RequestAXTreeSnapshot(AXTreeSnapshotCallback callback,
ui::AXMode ax_mode) {
static int next_id = 1;
int callback_id = next_id++;
Send(new AccessibilityMsg_SnapshotTree(routing_id_, callback_id,
ax_mode.mode()));
ax_tree_snapshot_callbacks_.insert(
std::make_pair(callback_id, std::move(callback)));
}
| 4,161 |
170,651 | 0 | int PreProc_Init() {
size_t i;
int status = 0;
if (sInitStatus <= 0) {
return sInitStatus;
}
for (i = 0; i < PREPROC_NUM_SESSIONS && status == 0; i++) {
status = Session_Init(&sSessions[i]);
}
sInitStatus = status;
return sInitStatus;
}
| 4,162 |
83,392 | 0 | CmpRoute(LPVOID item, LPVOID route)
{
return memcmp(item, route, sizeof(MIB_IPFORWARD_ROW2)) == 0 ? TRUE : FALSE;
}
| 4,163 |
157,869 | 0 | bool WebContentsImpl::ShouldIgnoreInputEvents() {
WebContentsImpl* web_contents = this;
while (web_contents) {
if (web_contents->ignore_input_events_)
return true;
web_contents = web_contents->GetOuterWebContents();
}
return false;
}
| 4,164 |
118,195 | 0 | AutofillDialogViews::AutofillDialogViews(AutofillDialogViewDelegate* delegate)
: delegate_(delegate),
updates_scope_(0),
needs_update_(false),
window_(NULL),
notification_area_(NULL),
account_chooser_(NULL),
sign_in_web_view_(NULL),
scrollable_area_(NULL),
details_container_(NULL),
loading_shield_(NULL),
loading_shield_height_(0),
overlay_view_(NULL),
button_strip_extra_view_(NULL),
save_in_chrome_checkbox_(NULL),
save_in_chrome_checkbox_container_(NULL),
button_strip_image_(NULL),
footnote_view_(NULL),
legal_document_view_(NULL),
focus_manager_(NULL),
error_bubble_(NULL),
observer_(this) {
DCHECK(delegate);
detail_groups_.insert(std::make_pair(SECTION_CC,
DetailsGroup(SECTION_CC)));
detail_groups_.insert(std::make_pair(SECTION_BILLING,
DetailsGroup(SECTION_BILLING)));
detail_groups_.insert(std::make_pair(SECTION_CC_BILLING,
DetailsGroup(SECTION_CC_BILLING)));
detail_groups_.insert(std::make_pair(SECTION_SHIPPING,
DetailsGroup(SECTION_SHIPPING)));
}
| 4,165 |
28,398 | 0 | static struct fib6_table *fib6_alloc_table(struct net *net, u32 id)
{
struct fib6_table *table;
table = kzalloc(sizeof(*table), GFP_ATOMIC);
if (table) {
table->tb6_id = id;
table->tb6_root.leaf = net->ipv6.ip6_null_entry;
table->tb6_root.fn_flags = RTN_ROOT | RTN_TL_ROOT | RTN_RTINFO;
inet_peer_base_init(&table->tb6_peers);
}
return table;
}
| 4,166 |
67,192 | 0 | mpol_shared_policy_lookup(struct shared_policy *sp, unsigned long idx)
{
struct mempolicy *pol = NULL;
struct sp_node *sn;
if (!sp->root.rb_node)
return NULL;
read_lock(&sp->lock);
sn = sp_lookup(sp, idx, idx+1);
if (sn) {
mpol_get(sn->policy);
pol = sn->policy;
}
read_unlock(&sp->lock);
return pol;
}
| 4,167 |
91,201 | 0 | static int __find_bmc_guid(struct device *dev, void *data)
{
guid_t *guid = data;
struct bmc_device *bmc;
int rv;
if (dev->type != &bmc_device_type)
return 0;
bmc = to_bmc_device(dev);
rv = bmc->dyn_guid_set && guid_equal(&bmc->guid, guid);
if (rv)
rv = kref_get_unless_zero(&bmc->usecount);
return rv;
}
| 4,168 |
5,551 | 0 | g_proxy_list_free (DBusGProxyList *list)
{
/* we don't hold a reference to the proxies in the list,
* as they ref the GProxyManager
*/
g_slist_free (list->proxies);
g_free (list);
}
| 4,169 |
42,860 | 0 | static int run_event_gtk_ask_yes_no_save_result(const char *key, const char *msg, void *args)
{
const int ret = run_ask_yes_no_save_result_dialog(key, msg, GTK_WINDOW(g_wnd_assistant));
log_request_response_communication(msg, ret ? "YES" : "NO", (struct analyze_event_data *)args);
return ret;
}
| 4,170 |
173,737 | 0 | static int handle_fsync(struct fuse* fuse, struct fuse_handler* handler,
const struct fuse_in_header* hdr, const struct fuse_fsync_in* req)
{
bool is_dir = (hdr->opcode == FUSE_FSYNCDIR);
bool is_data_sync = req->fsync_flags & 1;
int fd = -1;
if (is_dir) {
struct dirhandle *dh = id_to_ptr(req->fh);
fd = dirfd(dh->d);
} else {
struct handle *h = id_to_ptr(req->fh);
fd = h->fd;
}
TRACE("[%d] %s %p(%d) is_data_sync=%d\n", handler->token,
is_dir ? "FSYNCDIR" : "FSYNC",
id_to_ptr(req->fh), fd, is_data_sync);
int res = is_data_sync ? fdatasync(fd) : fsync(fd);
if (res == -1) {
return -errno;
}
return 0;
}
| 4,171 |
136,807 | 0 | History* LocalDOMWindow::history() const {
if (!history_)
history_ = History::Create(GetFrame());
return history_.Get();
}
| 4,172 |
21,472 | 0 | static int write_note_info(struct elf_note_info *info,
struct file *file, loff_t *foffset)
{
bool first = 1;
struct elf_thread_core_info *t = info->thread;
do {
int i;
if (!writenote(&t->notes[0], file, foffset))
return 0;
if (first && !writenote(&info->psinfo, file, foffset))
return 0;
if (first && !writenote(&info->auxv, file, foffset))
return 0;
for (i = 1; i < info->thread_notes; ++i)
if (t->notes[i].data &&
!writenote(&t->notes[i], file, foffset))
return 0;
first = 0;
t = t->next;
} while (t);
return 1;
}
| 4,173 |
73,365 | 0 | static void get_base_point(DBBox *bbox, int alignment, double *bx, double *by)
{
const int halign = alignment & 3;
const int valign = alignment & 12;
if (bx)
switch (halign) {
case HALIGN_LEFT:
*bx = bbox->xMin;
break;
case HALIGN_CENTER:
*bx = (bbox->xMax + bbox->xMin) / 2.0;
break;
case HALIGN_RIGHT:
*bx = bbox->xMax;
break;
}
if (by)
switch (valign) {
case VALIGN_TOP:
*by = bbox->yMin;
break;
case VALIGN_CENTER:
*by = (bbox->yMax + bbox->yMin) / 2.0;
break;
case VALIGN_SUB:
*by = bbox->yMax;
break;
}
}
| 4,174 |
107,598 | 0 | bool ewk_view_run_javascript_confirm(Evas_Object* ewkView, Evas_Object* frame, const char* message)
{
DBG("ewkView=%p frame=%p message=%s", ewkView, frame, message);
EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, false);
if (!smartData->api->run_javascript_confirm)
return false;
return smartData->api->run_javascript_confirm(smartData, frame, message);
}
| 4,175 |
26,619 | 0 | int ip6_forward(struct sk_buff *skb)
{
struct dst_entry *dst = skb_dst(skb);
struct ipv6hdr *hdr = ipv6_hdr(skb);
struct inet6_skb_parm *opt = IP6CB(skb);
struct net *net = dev_net(dst->dev);
struct neighbour *n;
u32 mtu;
if (net->ipv6.devconf_all->forwarding == 0)
goto error;
if (skb_warn_if_lro(skb))
goto drop;
if (!xfrm6_policy_check(NULL, XFRM_POLICY_FWD, skb)) {
IP6_INC_STATS(net, ip6_dst_idev(dst), IPSTATS_MIB_INDISCARDS);
goto drop;
}
if (skb->pkt_type != PACKET_HOST)
goto drop;
skb_forward_csum(skb);
/*
* We DO NOT make any processing on
* RA packets, pushing them to user level AS IS
* without ane WARRANTY that application will be able
* to interpret them. The reason is that we
* cannot make anything clever here.
*
* We are not end-node, so that if packet contains
* AH/ESP, we cannot make anything.
* Defragmentation also would be mistake, RA packets
* cannot be fragmented, because there is no warranty
* that different fragments will go along one path. --ANK
*/
if (opt->ra) {
u8 *ptr = skb_network_header(skb) + opt->ra;
if (ip6_call_ra_chain(skb, (ptr[2]<<8) + ptr[3]))
return 0;
}
/*
* check and decrement ttl
*/
if (hdr->hop_limit <= 1) {
/* Force OUTPUT device used as source address */
skb->dev = dst->dev;
icmpv6_send(skb, ICMPV6_TIME_EXCEED, ICMPV6_EXC_HOPLIMIT, 0);
IP6_INC_STATS_BH(net,
ip6_dst_idev(dst), IPSTATS_MIB_INHDRERRORS);
kfree_skb(skb);
return -ETIMEDOUT;
}
/* XXX: idev->cnf.proxy_ndp? */
if (net->ipv6.devconf_all->proxy_ndp &&
pneigh_lookup(&nd_tbl, net, &hdr->daddr, skb->dev, 0)) {
int proxied = ip6_forward_proxy_check(skb);
if (proxied > 0)
return ip6_input(skb);
else if (proxied < 0) {
IP6_INC_STATS(net, ip6_dst_idev(dst),
IPSTATS_MIB_INDISCARDS);
goto drop;
}
}
if (!xfrm6_route_forward(skb)) {
IP6_INC_STATS(net, ip6_dst_idev(dst), IPSTATS_MIB_INDISCARDS);
goto drop;
}
dst = skb_dst(skb);
/* IPv6 specs say nothing about it, but it is clear that we cannot
send redirects to source routed frames.
We don't send redirects to frames decapsulated from IPsec.
*/
n = dst_get_neighbour(dst);
if (skb->dev == dst->dev && n && opt->srcrt == 0 && !skb_sec_path(skb)) {
struct in6_addr *target = NULL;
struct rt6_info *rt;
/*
* incoming and outgoing devices are the same
* send a redirect.
*/
rt = (struct rt6_info *) dst;
if ((rt->rt6i_flags & RTF_GATEWAY))
target = (struct in6_addr*)&n->primary_key;
else
target = &hdr->daddr;
if (!rt->rt6i_peer)
rt6_bind_peer(rt, 1);
/* Limit redirects both by destination (here)
and by source (inside ndisc_send_redirect)
*/
if (inet_peer_xrlim_allow(rt->rt6i_peer, 1*HZ))
ndisc_send_redirect(skb, n, target);
} else {
int addrtype = ipv6_addr_type(&hdr->saddr);
/* This check is security critical. */
if (addrtype == IPV6_ADDR_ANY ||
addrtype & (IPV6_ADDR_MULTICAST | IPV6_ADDR_LOOPBACK))
goto error;
if (addrtype & IPV6_ADDR_LINKLOCAL) {
icmpv6_send(skb, ICMPV6_DEST_UNREACH,
ICMPV6_NOT_NEIGHBOUR, 0);
goto error;
}
}
mtu = dst_mtu(dst);
if (mtu < IPV6_MIN_MTU)
mtu = IPV6_MIN_MTU;
if (skb->len > mtu && !skb_is_gso(skb)) {
/* Again, force OUTPUT device used as source address */
skb->dev = dst->dev;
icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
IP6_INC_STATS_BH(net,
ip6_dst_idev(dst), IPSTATS_MIB_INTOOBIGERRORS);
IP6_INC_STATS_BH(net,
ip6_dst_idev(dst), IPSTATS_MIB_FRAGFAILS);
kfree_skb(skb);
return -EMSGSIZE;
}
if (skb_cow(skb, dst->dev->hard_header_len)) {
IP6_INC_STATS(net, ip6_dst_idev(dst), IPSTATS_MIB_OUTDISCARDS);
goto drop;
}
hdr = ipv6_hdr(skb);
/* Mangling hops number delayed to point after skb COW */
hdr->hop_limit--;
IP6_INC_STATS_BH(net, ip6_dst_idev(dst), IPSTATS_MIB_OUTFORWDATAGRAMS);
return NF_HOOK(NFPROTO_IPV6, NF_INET_FORWARD, skb, skb->dev, dst->dev,
ip6_forward_finish);
error:
IP6_INC_STATS_BH(net, ip6_dst_idev(dst), IPSTATS_MIB_INADDRERRORS);
drop:
kfree_skb(skb);
return -EINVAL;
}
| 4,176 |
150,323 | 0 | void PasswordAutofillAgent::OnProvisionallySaveForm(
const WebFormElement& form,
const WebFormControlElement& element,
ElementChangeSource source) {
if (source == ElementChangeSource::SELECT_CHANGED)
return;
WebInputElement input_element;
if (!element.IsNull() && element.HasHTMLTagName("input"))
input_element = *ToWebInputElement(&element);
if (source == ElementChangeSource::TEXTFIELD_CHANGED) {
DCHECK(!input_element.IsNull());
UpdateStateForTextChange(input_element);
return;
}
DCHECK_EQ(ElementChangeSource::WILL_SEND_SUBMIT_EVENT, source);
ProvisionallySavePassword(form, input_element,
RESTRICTION_NON_EMPTY_PASSWORD);
}
| 4,177 |
16,930 | 0 | static int l2_allocate(BlockDriverState *bs, int l1_index, uint64_t **table)
{
BDRVQcowState *s = bs->opaque;
uint64_t old_l2_offset;
uint64_t *l2_table = NULL;
int64_t l2_offset;
int ret;
old_l2_offset = s->l1_table[l1_index];
trace_qcow2_l2_allocate(bs, l1_index);
/* allocate a new l2 entry */
l2_offset = qcow2_alloc_clusters(bs, s->l2_size * sizeof(uint64_t));
if (l2_offset < 0) {
ret = l2_offset;
goto fail;
}
ret = qcow2_cache_flush(bs, s->refcount_block_cache);
if (ret < 0) {
goto fail;
}
/* allocate a new entry in the l2 cache */
trace_qcow2_l2_allocate_get_empty(bs, l1_index);
ret = qcow2_cache_get_empty(bs, s->l2_table_cache, l2_offset, (void**) table);
if (ret < 0) {
goto fail;
}
l2_table = *table;
if ((old_l2_offset & L1E_OFFSET_MASK) == 0) {
/* if there was no old l2 table, clear the new table */
memset(l2_table, 0, s->l2_size * sizeof(uint64_t));
} else {
uint64_t* old_table;
/* if there was an old l2 table, read it from the disk */
BLKDBG_EVENT(bs->file, BLKDBG_L2_ALLOC_COW_READ);
ret = qcow2_cache_get(bs, s->l2_table_cache,
old_l2_offset & L1E_OFFSET_MASK,
(void**) &old_table);
if (ret < 0) {
goto fail;
}
memcpy(l2_table, old_table, s->cluster_size);
ret = qcow2_cache_put(bs, s->l2_table_cache, (void**) &old_table);
if (ret < 0) {
goto fail;
}
}
/* write the l2 table to the file */
BLKDBG_EVENT(bs->file, BLKDBG_L2_ALLOC_WRITE);
trace_qcow2_l2_allocate_write_l2(bs, l1_index);
qcow2_cache_entry_mark_dirty(s->l2_table_cache, l2_table);
ret = qcow2_cache_flush(bs, s->l2_table_cache);
if (ret < 0) {
goto fail;
}
/* update the L1 entry */
trace_qcow2_l2_allocate_write_l1(bs, l1_index);
s->l1_table[l1_index] = l2_offset | QCOW_OFLAG_COPIED;
ret = qcow2_write_l1_entry(bs, l1_index);
if (ret < 0) {
goto fail;
}
*table = l2_table;
trace_qcow2_l2_allocate_done(bs, l1_index, 0);
return 0;
fail:
trace_qcow2_l2_allocate_done(bs, l1_index, ret);
if (l2_table != NULL) {
qcow2_cache_put(bs, s->l2_table_cache, (void**) table);
}
s->l1_table[l1_index] = old_l2_offset;
if (l2_offset > 0) {
qcow2_free_clusters(bs, l2_offset, s->l2_size * sizeof(uint64_t),
QCOW2_DISCARD_ALWAYS);
}
return ret;
}
| 4,178 |
105,328 | 0 | void AutofillManager::FillCreditCardFormField(const CreditCard* credit_card,
AutofillFieldType type,
webkit_glue::FormField* field) {
DCHECK(credit_card);
DCHECK_EQ(AutofillType::CREDIT_CARD, AutofillType(type).group());
DCHECK(field);
if (field->form_control_type == ASCIIToUTF16("select-one")) {
autofill::FillSelectControl(*credit_card, type, field);
} else if (field->form_control_type == ASCIIToUTF16("month")) {
string16 year = credit_card->GetInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR);
string16 month = credit_card->GetInfo(CREDIT_CARD_EXP_MONTH);
if (!year.empty() && !month.empty()) {
field->value = year + ASCIIToUTF16("-") + month;
}
} else {
string16 value = credit_card->GetInfo(type);
if (type == CREDIT_CARD_NUMBER)
value = CreditCard::StripSeparators(value);
field->value = value;
}
}
| 4,179 |
80,176 | 0 | GF_Err hnti_Read(GF_Box *s, GF_BitStream *bs)
{
return gf_isom_box_array_read_ex(s, bs, hnti_AddBox, s->type);
}
| 4,180 |
174,654 | 0 | static inline void free_heap(const sp<IBinder>& binder) {
gHeapCache->free_heap(binder);
}
| 4,181 |
75,292 | 0 | static int set_file_offset(stb_vorbis *f, unsigned int loc)
{
#ifndef STB_VORBIS_NO_PUSHDATA_API
if (f->push_mode) return 0;
#endif
f->eof = 0;
if (USE_MEMORY(f)) {
if (f->stream_start + loc >= f->stream_end || f->stream_start + loc < f->stream_start) {
f->stream = f->stream_end;
f->eof = 1;
return 0;
} else {
f->stream = f->stream_start + loc;
return 1;
}
}
#ifndef STB_VORBIS_NO_STDIO
if (loc + f->f_start < loc || loc >= 0x80000000) {
loc = 0x7fffffff;
f->eof = 1;
} else {
loc += f->f_start;
}
if (!fseek(f->f, loc, SEEK_SET))
return 1;
f->eof = 1;
fseek(f->f, f->f_start, SEEK_END);
return 0;
#endif
}
| 4,182 |
28,923 | 0 | static int set_msr_hyperv(struct kvm_vcpu *vcpu, u32 msr, u64 data)
{
switch (msr) {
case HV_X64_MSR_APIC_ASSIST_PAGE: {
unsigned long addr;
if (!(data & HV_X64_MSR_APIC_ASSIST_PAGE_ENABLE)) {
vcpu->arch.hv_vapic = data;
break;
}
addr = gfn_to_hva(vcpu->kvm, data >>
HV_X64_MSR_APIC_ASSIST_PAGE_ADDRESS_SHIFT);
if (kvm_is_error_hva(addr))
return 1;
if (__clear_user((void __user *)addr, PAGE_SIZE))
return 1;
vcpu->arch.hv_vapic = data;
break;
}
case HV_X64_MSR_EOI:
return kvm_hv_vapic_msr_write(vcpu, APIC_EOI, data);
case HV_X64_MSR_ICR:
return kvm_hv_vapic_msr_write(vcpu, APIC_ICR, data);
case HV_X64_MSR_TPR:
return kvm_hv_vapic_msr_write(vcpu, APIC_TASKPRI, data);
default:
vcpu_unimpl(vcpu, "HYPER-V unimplemented wrmsr: 0x%x "
"data 0x%llx\n", msr, data);
return 1;
}
return 0;
}
| 4,183 |
4,290 | 0 | PHP_FUNCTION(getservbyname)
{
char *name, *proto;
int name_len, proto_len;
struct servent *serv;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &name, &name_len, &proto, &proto_len) == FAILURE) {
return;
}
/* empty string behaves like NULL on windows implementation of
getservbyname. Let be portable instead. */
#ifdef PHP_WIN32
if (proto_len == 0) {
RETURN_FALSE;
}
#endif
serv = getservbyname(name, proto);
if (serv == NULL) {
RETURN_FALSE;
}
RETURN_LONG(ntohs(serv->s_port));
}
| 4,184 |
125,113 | 0 | void PluginServiceImpl::CancelOpenChannelToNpapiPlugin(
PluginProcessHost::Client* client) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DCHECK(ContainsKey(pending_plugin_clients_, client));
pending_plugin_clients_.erase(client);
}
| 4,185 |
94,897 | 0 | int usbnet_get_endpoints(struct usbnet *dev, struct usb_interface *intf)
{
int tmp;
struct usb_host_interface *alt = NULL;
struct usb_host_endpoint *in = NULL, *out = NULL;
struct usb_host_endpoint *status = NULL;
for (tmp = 0; tmp < intf->num_altsetting; tmp++) {
unsigned ep;
in = out = status = NULL;
alt = intf->altsetting + tmp;
/* take the first altsetting with in-bulk + out-bulk;
* remember any status endpoint, just in case;
* ignore other endpoints and altsettings.
*/
for (ep = 0; ep < alt->desc.bNumEndpoints; ep++) {
struct usb_host_endpoint *e;
int intr = 0;
e = alt->endpoint + ep;
switch (e->desc.bmAttributes) {
case USB_ENDPOINT_XFER_INT:
if (!usb_endpoint_dir_in(&e->desc))
continue;
intr = 1;
/* FALLTHROUGH */
case USB_ENDPOINT_XFER_BULK:
break;
default:
continue;
}
if (usb_endpoint_dir_in(&e->desc)) {
if (!intr && !in)
in = e;
else if (intr && !status)
status = e;
} else {
if (!out)
out = e;
}
}
if (in && out)
break;
}
if (!alt || !in || !out)
return -EINVAL;
if (alt->desc.bAlternateSetting != 0 ||
!(dev->driver_info->flags & FLAG_NO_SETINT)) {
tmp = usb_set_interface (dev->udev, alt->desc.bInterfaceNumber,
alt->desc.bAlternateSetting);
if (tmp < 0)
return tmp;
}
dev->in = usb_rcvbulkpipe (dev->udev,
in->desc.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
dev->out = usb_sndbulkpipe (dev->udev,
out->desc.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
dev->status = status;
return 0;
}
| 4,186 |
52,534 | 0 | static void tsk_set_unreturnable(struct tipc_sock *tsk, bool unreturnable)
{
msg_set_dest_droppable(&tsk->phdr, unreturnable ? 1 : 0);
}
| 4,187 |
180,824 | 1 | static int encrypt(struct blkcipher_desc *desc,
struct scatterlist *dst, struct scatterlist *src,
unsigned int nbytes)
{
struct blkcipher_walk walk;
struct crypto_blkcipher *tfm = desc->tfm;
struct salsa20_ctx *ctx = crypto_blkcipher_ctx(tfm);
int err;
blkcipher_walk_init(&walk, dst, src, nbytes);
err = blkcipher_walk_virt_block(desc, &walk, 64);
salsa20_ivsetup(ctx, walk.iv);
if (likely(walk.nbytes == nbytes))
{
salsa20_encrypt_bytes(ctx, walk.dst.virt.addr,
walk.src.virt.addr, nbytes);
return blkcipher_walk_done(desc, &walk, 0);
}
while (walk.nbytes >= 64) {
salsa20_encrypt_bytes(ctx, walk.dst.virt.addr,
walk.src.virt.addr,
walk.nbytes - (walk.nbytes % 64));
err = blkcipher_walk_done(desc, &walk, walk.nbytes % 64);
}
if (walk.nbytes) {
salsa20_encrypt_bytes(ctx, walk.dst.virt.addr,
walk.src.virt.addr, walk.nbytes);
err = blkcipher_walk_done(desc, &walk, 0);
}
return err;
}
| 4,188 |
169,269 | 0 | bool ListenToGuestWebContents(
AccessibilityNotificationWaiter* accessibility_waiter,
WebContents* web_contents) {
accessibility_waiter->ListenToAdditionalFrame(
static_cast<RenderFrameHostImpl*>(web_contents->GetMainFrame()));
return true;
}
| 4,189 |
31,008 | 0 | static int do_setlink(struct net_device *dev, struct ifinfomsg *ifm,
struct nlattr **tb, char *ifname, int modified)
{
const struct net_device_ops *ops = dev->netdev_ops;
int err;
if (tb[IFLA_NET_NS_PID] || tb[IFLA_NET_NS_FD]) {
struct net *net = rtnl_link_get_net(dev_net(dev), tb);
if (IS_ERR(net)) {
err = PTR_ERR(net);
goto errout;
}
if (!ns_capable(net->user_ns, CAP_NET_ADMIN)) {
err = -EPERM;
goto errout;
}
err = dev_change_net_namespace(dev, net, ifname);
put_net(net);
if (err)
goto errout;
modified = 1;
}
if (tb[IFLA_MAP]) {
struct rtnl_link_ifmap *u_map;
struct ifmap k_map;
if (!ops->ndo_set_config) {
err = -EOPNOTSUPP;
goto errout;
}
if (!netif_device_present(dev)) {
err = -ENODEV;
goto errout;
}
u_map = nla_data(tb[IFLA_MAP]);
k_map.mem_start = (unsigned long) u_map->mem_start;
k_map.mem_end = (unsigned long) u_map->mem_end;
k_map.base_addr = (unsigned short) u_map->base_addr;
k_map.irq = (unsigned char) u_map->irq;
k_map.dma = (unsigned char) u_map->dma;
k_map.port = (unsigned char) u_map->port;
err = ops->ndo_set_config(dev, &k_map);
if (err < 0)
goto errout;
modified = 1;
}
if (tb[IFLA_ADDRESS]) {
struct sockaddr *sa;
int len;
len = sizeof(sa_family_t) + dev->addr_len;
sa = kmalloc(len, GFP_KERNEL);
if (!sa) {
err = -ENOMEM;
goto errout;
}
sa->sa_family = dev->type;
memcpy(sa->sa_data, nla_data(tb[IFLA_ADDRESS]),
dev->addr_len);
err = dev_set_mac_address(dev, sa);
kfree(sa);
if (err)
goto errout;
modified = 1;
}
if (tb[IFLA_MTU]) {
err = dev_set_mtu(dev, nla_get_u32(tb[IFLA_MTU]));
if (err < 0)
goto errout;
modified = 1;
}
if (tb[IFLA_GROUP]) {
dev_set_group(dev, nla_get_u32(tb[IFLA_GROUP]));
modified = 1;
}
/*
* Interface selected by interface index but interface
* name provided implies that a name change has been
* requested.
*/
if (ifm->ifi_index > 0 && ifname[0]) {
err = dev_change_name(dev, ifname);
if (err < 0)
goto errout;
modified = 1;
}
if (tb[IFLA_IFALIAS]) {
err = dev_set_alias(dev, nla_data(tb[IFLA_IFALIAS]),
nla_len(tb[IFLA_IFALIAS]));
if (err < 0)
goto errout;
modified = 1;
}
if (tb[IFLA_BROADCAST]) {
nla_memcpy(dev->broadcast, tb[IFLA_BROADCAST], dev->addr_len);
call_netdevice_notifiers(NETDEV_CHANGEADDR, dev);
}
if (ifm->ifi_flags || ifm->ifi_change) {
err = dev_change_flags(dev, rtnl_dev_combine_flags(dev, ifm));
if (err < 0)
goto errout;
}
if (tb[IFLA_MASTER]) {
err = do_set_master(dev, nla_get_u32(tb[IFLA_MASTER]));
if (err)
goto errout;
modified = 1;
}
if (tb[IFLA_CARRIER]) {
err = dev_change_carrier(dev, nla_get_u8(tb[IFLA_CARRIER]));
if (err)
goto errout;
modified = 1;
}
if (tb[IFLA_TXQLEN])
dev->tx_queue_len = nla_get_u32(tb[IFLA_TXQLEN]);
if (tb[IFLA_OPERSTATE])
set_operstate(dev, nla_get_u8(tb[IFLA_OPERSTATE]));
if (tb[IFLA_LINKMODE]) {
write_lock_bh(&dev_base_lock);
dev->link_mode = nla_get_u8(tb[IFLA_LINKMODE]);
write_unlock_bh(&dev_base_lock);
}
if (tb[IFLA_VFINFO_LIST]) {
struct nlattr *attr;
int rem;
nla_for_each_nested(attr, tb[IFLA_VFINFO_LIST], rem) {
if (nla_type(attr) != IFLA_VF_INFO) {
err = -EINVAL;
goto errout;
}
err = do_setvfinfo(dev, attr);
if (err < 0)
goto errout;
modified = 1;
}
}
err = 0;
if (tb[IFLA_VF_PORTS]) {
struct nlattr *port[IFLA_PORT_MAX+1];
struct nlattr *attr;
int vf;
int rem;
err = -EOPNOTSUPP;
if (!ops->ndo_set_vf_port)
goto errout;
nla_for_each_nested(attr, tb[IFLA_VF_PORTS], rem) {
if (nla_type(attr) != IFLA_VF_PORT)
continue;
err = nla_parse_nested(port, IFLA_PORT_MAX,
attr, ifla_port_policy);
if (err < 0)
goto errout;
if (!port[IFLA_PORT_VF]) {
err = -EOPNOTSUPP;
goto errout;
}
vf = nla_get_u32(port[IFLA_PORT_VF]);
err = ops->ndo_set_vf_port(dev, vf, port);
if (err < 0)
goto errout;
modified = 1;
}
}
err = 0;
if (tb[IFLA_PORT_SELF]) {
struct nlattr *port[IFLA_PORT_MAX+1];
err = nla_parse_nested(port, IFLA_PORT_MAX,
tb[IFLA_PORT_SELF], ifla_port_policy);
if (err < 0)
goto errout;
err = -EOPNOTSUPP;
if (ops->ndo_set_vf_port)
err = ops->ndo_set_vf_port(dev, PORT_SELF_VF, port);
if (err < 0)
goto errout;
modified = 1;
}
if (tb[IFLA_AF_SPEC]) {
struct nlattr *af;
int rem;
nla_for_each_nested(af, tb[IFLA_AF_SPEC], rem) {
const struct rtnl_af_ops *af_ops;
if (!(af_ops = rtnl_af_lookup(nla_type(af))))
BUG();
err = af_ops->set_link_af(dev, af);
if (err < 0)
goto errout;
modified = 1;
}
}
err = 0;
errout:
if (err < 0 && modified)
net_warn_ratelimited("A link change request failed with some changes committed already. Interface %s may have been left with an inconsistent configuration, please check.\n",
dev->name);
return err;
}
| 4,190 |
1,201 | 0 | GBool JBIG2Stream::readByte(int *x) {
int c0;
if ((c0 = curStr->getChar()) == EOF) {
return gFalse;
}
*x = c0;
if (c0 & 0x80) {
*x |= -1 - 0xff;
}
return gTrue;
}
| 4,191 |
126,372 | 0 | bool BrowserWindowGtk::IsActive() const {
if (ui::ActiveWindowWatcherX::WMSupportsActivation())
return is_active_;
return gtk_window_is_active(window_);
}
| 4,192 |
67,063 | 0 | static int video_get_buffer(AVCodecContext *s, AVFrame *pic)
{
FramePool *pool = s->internal->pool;
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pic->format);
int i;
if (pic->data[0] || pic->data[1] || pic->data[2] || pic->data[3]) {
av_log(s, AV_LOG_ERROR, "pic->data[*]!=NULL in avcodec_default_get_buffer\n");
return -1;
}
if (!desc) {
av_log(s, AV_LOG_ERROR,
"Unable to get pixel format descriptor for format %s\n",
av_get_pix_fmt_name(pic->format));
return AVERROR(EINVAL);
}
memset(pic->data, 0, sizeof(pic->data));
pic->extended_data = pic->data;
for (i = 0; i < 4 && pool->pools[i]; i++) {
pic->linesize[i] = pool->linesize[i];
pic->buf[i] = av_buffer_pool_get(pool->pools[i]);
if (!pic->buf[i])
goto fail;
pic->data[i] = pic->buf[i]->data;
}
for (; i < AV_NUM_DATA_POINTERS; i++) {
pic->data[i] = NULL;
pic->linesize[i] = 0;
}
if (desc->flags & AV_PIX_FMT_FLAG_PAL ||
desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)
avpriv_set_systematic_pal2((uint32_t *)pic->data[1], pic->format);
if (s->debug & FF_DEBUG_BUFFERS)
av_log(s, AV_LOG_DEBUG, "default_get_buffer called on pic %p\n", pic);
return 0;
fail:
av_frame_unref(pic);
return AVERROR(ENOMEM);
}
| 4,193 |
174,650 | 0 | void HeapCache::dump_heaps()
{
Mutex::Autolock _l(mHeapCacheLock);
int c = mHeapCache.size();
for (int i=0 ; i<c ; i++) {
const heap_info_t& info = mHeapCache.valueAt(i);
BpMemoryHeap const* h(static_cast<BpMemoryHeap const *>(info.heap.get()));
ALOGD("hey=%p, heap=%p, count=%d, (fd=%d, base=%p, size=%zu)",
mHeapCache.keyAt(i).unsafe_get(),
info.heap.get(), info.count,
h->mHeapId, h->mBase, h->mSize);
}
}
| 4,194 |
2,744 | 0 | _dbus_header_delete_field (DBusHeader *header,
int field)
{
DBusTypeReader reader;
DBusTypeReader realign_root;
if (_dbus_header_cache_known_nonexistent (header, field))
return TRUE; /* nothing to do */
/* Scan to the field we want, delete and realign, reappend
* padding. Field may turn out not to exist.
*/
if (!find_field_for_modification (header, field,
&reader, &realign_root))
return TRUE; /* nothing to do */
if (!reserve_header_padding (header))
return FALSE;
if (!_dbus_type_reader_delete (&reader,
&realign_root))
return FALSE;
correct_header_padding (header);
_dbus_header_cache_invalidate_all (header);
_dbus_assert (!_dbus_header_cache_check (header, field)); /* Expensive assertion ... */
return TRUE;
}
| 4,195 |
96,897 | 0 | static int write_pipe_buf(struct pipe_inode_info *pipe, struct pipe_buffer *buf,
struct splice_desc *sd)
{
int ret;
void *data;
loff_t tmp = sd->pos;
data = kmap(buf->page);
ret = __kernel_write(sd->u.file, data + buf->offset, sd->len, &tmp);
kunmap(buf->page);
return ret;
}
| 4,196 |
129,208 | 0 | explicit AsyncUploadTokenCompletionObserver(uint32 async_upload_token)
: async_upload_token_(async_upload_token) {
}
| 4,197 |
48,546 | 0 | static void ion_dma_buf_release(struct dma_buf *dmabuf)
{
struct ion_buffer *buffer = dmabuf->priv;
ion_buffer_put(buffer);
}
| 4,198 |
183,902 | 1 | PassRefPtr<DocumentFragment> XSLTProcessor::transformToFragment(Node* sourceNode, Document* outputDoc)
{
String resultMIMEType;
String resultString;
String resultEncoding;
// If the output document is HTML, default to HTML method.
if (outputDoc->isHTMLDocument())
resultMIMEType = "text/html";
if (!transformToString(sourceNode, resultMIMEType, resultString, resultEncoding))
return 0;
return createFragmentFromSource(resultString, resultMIMEType, outputDoc);
}
| 4,199 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.