unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
148,591 | 0 | void WebContentsImpl::UpdateZoomIfNecessary(const std::string& scheme,
const std::string& host,
double level) {
NavigationEntry* entry = GetController().GetLastCommittedEntry();
if (!entry)
return;
GURL url = HostZoomMap::GetURLFromEntry(entry);
if (host != net::GetHostOrSpecFromURL(url) ||
(!scheme.empty() && !url.SchemeIs(scheme))) {
return;
}
UpdateZoom(level);
}
| 1,300 |
129,662 | 0 | void AffineTransform::recompose(const DecomposedType& decomp)
{
this->setA(decomp.remainderA);
this->setB(decomp.remainderB);
this->setC(decomp.remainderC);
this->setD(decomp.remainderD);
this->setE(decomp.translateX);
this->setF(decomp.translateY);
this->rotateRadians(decomp.angle);
this->scale(decomp.scaleX, decomp.scaleY);
}
| 1,301 |
142,056 | 0 | HRESULT CGaiaCredentialBase::GetBitmapValueImpl(DWORD field_id,
HBITMAP* phbmp) {
HRESULT hr = E_INVALIDARG;
switch (field_id) {
case FID_PROVIDER_LOGO:
*phbmp = ::LoadBitmap(CURRENT_MODULE(),
MAKEINTRESOURCE(IDB_GOOGLE_LOGO_SMALL));
if (*phbmp)
hr = S_OK;
break;
default:
break;
}
return hr;
}
| 1,302 |
112,361 | 0 | void ResourceDispatcherHostImpl::RegisterDownloadedTempFile(
int child_id, int request_id, ShareableFileReference* reference) {
registered_temp_files_[child_id][request_id] = reference;
ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile(
child_id, reference->path());
reference->AddFinalReleaseCallback(
base::Bind(&RemoveDownloadFileFromChildSecurityPolicy,
child_id));
}
| 1,303 |
175,711 | 0 | FLACSource::~FLACSource()
{
ALOGV("~FLACSource::FLACSource");
if (mStarted) {
stop();
}
}
| 1,304 |
30,738 | 0 | static int rfcomm_sock_getsockopt(struct socket *sock, int level, int optname, char __user *optval, int __user *optlen)
{
struct sock *sk = sock->sk;
struct bt_security sec;
int len, err = 0;
BT_DBG("sk %p", sk);
if (level == SOL_RFCOMM)
return rfcomm_sock_getsockopt_old(sock, optname, optval, optlen);
if (level != SOL_BLUETOOTH)
return -ENOPROTOOPT;
if (get_user(len, optlen))
return -EFAULT;
lock_sock(sk);
switch (optname) {
case BT_SECURITY:
if (sk->sk_type != SOCK_STREAM) {
err = -EINVAL;
break;
}
sec.level = rfcomm_pi(sk)->sec_level;
sec.key_size = 0;
len = min_t(unsigned int, len, sizeof(sec));
if (copy_to_user(optval, (char *) &sec, len))
err = -EFAULT;
break;
case BT_DEFER_SETUP:
if (sk->sk_state != BT_BOUND && sk->sk_state != BT_LISTEN) {
err = -EINVAL;
break;
}
if (put_user(test_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags),
(u32 __user *) optval))
err = -EFAULT;
break;
default:
err = -ENOPROTOOPT;
break;
}
release_sock(sk);
return err;
}
| 1,305 |
162,928 | 0 | void InitializeClientProcess(mojom::ProcessType process_type) {
mdm_ = MemoryDumpManager::CreateInstanceForTesting();
mdm_->set_dumper_registrations_ignored_for_testing(true);
const char* kServiceName = "TestServiceName";
ClientProcessImpl::Config config(nullptr, kServiceName, process_type);
config.coordinator_for_testing = coordinator_.get();
client_process_.reset(new ClientProcessImpl(config));
}
| 1,306 |
66,684 | 0 | static int dvb_usbv2_adapter_frontend_init(struct dvb_usb_adapter *adap)
{
int ret, i, count_registered = 0;
struct dvb_usb_device *d = adap_to_d(adap);
dev_dbg(&d->udev->dev, "%s: adap=%d\n", __func__, adap->id);
memset(adap->fe, 0, sizeof(adap->fe));
adap->active_fe = -1;
if (d->props->frontend_attach) {
ret = d->props->frontend_attach(adap);
if (ret < 0) {
dev_dbg(&d->udev->dev,
"%s: frontend_attach() failed=%d\n",
__func__, ret);
goto err_dvb_frontend_detach;
}
} else {
dev_dbg(&d->udev->dev, "%s: frontend_attach() do not exists\n",
__func__);
ret = 0;
goto err;
}
for (i = 0; i < MAX_NO_OF_FE_PER_ADAP && adap->fe[i]; i++) {
adap->fe[i]->id = i;
/* re-assign sleep and wakeup functions */
adap->fe_init[i] = adap->fe[i]->ops.init;
adap->fe[i]->ops.init = dvb_usb_fe_init;
adap->fe_sleep[i] = adap->fe[i]->ops.sleep;
adap->fe[i]->ops.sleep = dvb_usb_fe_sleep;
ret = dvb_register_frontend(&adap->dvb_adap, adap->fe[i]);
if (ret < 0) {
dev_err(&d->udev->dev,
"%s: frontend%d registration failed\n",
KBUILD_MODNAME, i);
goto err_dvb_unregister_frontend;
}
count_registered++;
}
if (d->props->tuner_attach) {
ret = d->props->tuner_attach(adap);
if (ret < 0) {
dev_dbg(&d->udev->dev, "%s: tuner_attach() failed=%d\n",
__func__, ret);
goto err_dvb_unregister_frontend;
}
}
ret = dvb_create_media_graph(&adap->dvb_adap, true);
if (ret < 0)
goto err_dvb_unregister_frontend;
ret = dvb_usbv2_media_device_register(adap);
return ret;
err_dvb_unregister_frontend:
for (i = count_registered - 1; i >= 0; i--)
dvb_unregister_frontend(adap->fe[i]);
err_dvb_frontend_detach:
for (i = MAX_NO_OF_FE_PER_ADAP - 1; i >= 0; i--) {
if (adap->fe[i]) {
dvb_frontend_detach(adap->fe[i]);
adap->fe[i] = NULL;
}
}
err:
dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
| 1,307 |
84,378 | 0 | flatpak_proxy_client_update_unique_id_policy (FlatpakProxyClient *client,
const char *unique_id,
FlatpakPolicy policy)
{
if (policy > FLATPAK_POLICY_NONE)
{
FlatpakPolicy old_policy;
old_policy = GPOINTER_TO_UINT (g_hash_table_lookup (client->unique_id_policy, unique_id));
if (policy > old_policy)
g_hash_table_replace (client->unique_id_policy, g_strdup (unique_id), GINT_TO_POINTER (policy));
}
}
| 1,308 |
106,929 | 0 | void RenderBox::setMarginAfter(LayoutUnit margin)
{
switch (style()->writingMode()) {
case TopToBottomWritingMode:
m_marginBottom = margin;
break;
case BottomToTopWritingMode:
m_marginTop = margin;
break;
case LeftToRightWritingMode:
m_marginRight = margin;
break;
case RightToLeftWritingMode:
m_marginLeft = margin;
break;
}
}
| 1,309 |
48,901 | 0 | void netdev_upper_dev_unlink(struct net_device *dev,
struct net_device *upper_dev)
{
struct netdev_notifier_changeupper_info changeupper_info;
struct netdev_adjacent *i, *j;
ASSERT_RTNL();
changeupper_info.upper_dev = upper_dev;
changeupper_info.master = netdev_master_upper_dev_get(dev) == upper_dev;
changeupper_info.linking = false;
call_netdevice_notifiers_info(NETDEV_PRECHANGEUPPER, dev,
&changeupper_info.info);
__netdev_adjacent_dev_unlink_neighbour(dev, upper_dev);
/* Here is the tricky part. We must remove all dev's lower
* devices from all upper_dev's upper devices and vice
* versa, to maintain the graph relationship.
*/
list_for_each_entry(i, &dev->all_adj_list.lower, list)
list_for_each_entry(j, &upper_dev->all_adj_list.upper, list)
__netdev_adjacent_dev_unlink(i->dev, j->dev);
/* remove also the devices itself from lower/upper device
* list
*/
list_for_each_entry(i, &dev->all_adj_list.lower, list)
__netdev_adjacent_dev_unlink(i->dev, upper_dev);
list_for_each_entry(i, &upper_dev->all_adj_list.upper, list)
__netdev_adjacent_dev_unlink(dev, i->dev);
call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, dev,
&changeupper_info.info);
}
| 1,310 |
99,847 | 0 | WebPluginProxy::WebPluginProxy(
PluginChannel* channel,
int route_id,
const GURL& page_url,
gfx::NativeViewId containing_window,
int host_render_view_routing_id)
: channel_(channel),
route_id_(route_id),
cp_browsing_context_(0),
window_npobject_(NULL),
plugin_element_(NULL),
delegate_(NULL),
waiting_for_paint_(false),
containing_window_(containing_window),
page_url_(page_url),
host_render_view_routing_id_(host_render_view_routing_id),
ALLOW_THIS_IN_INITIALIZER_LIST(runnable_method_factory_(this)) {
}
| 1,311 |
158,309 | 0 | void RenderWidgetHostImpl::OnAutoscrollFling(const gfx::Vector2dF& velocity) {
WebGestureEvent event = SyntheticWebGestureEventBuilder::Build(
WebInputEvent::kGestureFlingStart,
blink::kWebGestureDeviceSyntheticAutoscroll);
event.data.fling_start.velocity_x = velocity.x();
event.data.fling_start.velocity_y = velocity.y();
ForwardGestureEventWithLatencyInfo(
event, ui::LatencyInfo(ui::SourceEventType::OTHER));
}
| 1,312 |
86,543 | 0 | void jpc_ft_invlift_col(jpc_fix_t *a, int numrows, int stride, int parity)
{
jpc_fix_t *lptr;
jpc_fix_t *hptr;
#if 0
register jpc_fix_t *lptr2;
register jpc_fix_t *hptr2;
register int i;
#endif
register int n;
int llen;
llen = (numrows + 1 - parity) >> 1;
if (numrows > 1) {
/* Apply the first lifting step. */
lptr = &a[0];
hptr = &a[llen * stride];
if (!parity) {
lptr[0] -= jpc_fix_asr(hptr[0] + 1, 1);
lptr += stride;
}
n = llen - (!parity) - (parity != (numrows & 1));
while (n-- > 0) {
lptr[0] -= jpc_fix_asr(hptr[0] + hptr[stride] + 2, 2);
lptr += stride;
hptr += stride;
}
if (parity != (numrows & 1)) {
lptr[0] -= jpc_fix_asr(hptr[0] + 1, 1);
}
/* Apply the second lifting step. */
lptr = &a[0];
hptr = &a[llen * stride];
if (parity) {
hptr[0] += lptr[0];
hptr += stride;
}
n = numrows - llen - parity - (parity == (numrows & 1));
while (n-- > 0) {
hptr[0] += jpc_fix_asr(lptr[0] + lptr[stride], 1);
hptr += stride;
lptr += stride;
}
if (parity == (numrows & 1)) {
hptr[0] += lptr[0];
}
} else {
if (parity) {
lptr = &a[0];
lptr[0] = jpc_fix_asr(lptr[0], 1);
}
}
}
| 1,313 |
146,264 | 0 | CreateContextProviderOnWorkerThread(
Platform::ContextAttributes context_attributes,
Platform::GraphicsInfo* gl_info,
const KURL& url) {
WaitableEvent waitable_event;
ContextProviderCreationInfo creation_info;
creation_info.context_attributes = context_attributes;
creation_info.gl_info = gl_info;
creation_info.url = url.Copy();
RefPtr<WebTaskRunner> task_runner =
Platform::Current()->MainThread()->GetWebTaskRunner();
task_runner->PostTask(
BLINK_FROM_HERE, CrossThreadBind(&CreateContextProviderOnMainThread,
CrossThreadUnretained(&creation_info),
CrossThreadUnretained(&waitable_event)));
waitable_event.Wait();
return std::move(creation_info.created_context_provider);
}
| 1,314 |
3,740 | 0 | _dbus_get_is_errno_eagain_or_ewouldblock (void)
{
return errno == EAGAIN || errno == EWOULDBLOCK;
}
| 1,315 |
166,892 | 0 | bool Performance::IsResourceTimingBufferFull() {
return resource_timing_buffer_.size() >= resource_timing_buffer_size_;
}
| 1,316 |
33,038 | 0 | static int sctp_setsockopt_associnfo(struct sock *sk, char __user *optval, unsigned int optlen)
{
struct sctp_assocparams assocparams;
struct sctp_association *asoc;
if (optlen != sizeof(struct sctp_assocparams))
return -EINVAL;
if (copy_from_user(&assocparams, optval, optlen))
return -EFAULT;
asoc = sctp_id2assoc(sk, assocparams.sasoc_assoc_id);
if (!asoc && assocparams.sasoc_assoc_id && sctp_style(sk, UDP))
return -EINVAL;
/* Set the values to the specific association */
if (asoc) {
if (assocparams.sasoc_asocmaxrxt != 0) {
__u32 path_sum = 0;
int paths = 0;
struct sctp_transport *peer_addr;
list_for_each_entry(peer_addr, &asoc->peer.transport_addr_list,
transports) {
path_sum += peer_addr->pathmaxrxt;
paths++;
}
/* Only validate asocmaxrxt if we have more than
* one path/transport. We do this because path
* retransmissions are only counted when we have more
* then one path.
*/
if (paths > 1 &&
assocparams.sasoc_asocmaxrxt > path_sum)
return -EINVAL;
asoc->max_retrans = assocparams.sasoc_asocmaxrxt;
}
if (assocparams.sasoc_cookie_life != 0) {
asoc->cookie_life.tv_sec =
assocparams.sasoc_cookie_life / 1000;
asoc->cookie_life.tv_usec =
(assocparams.sasoc_cookie_life % 1000)
* 1000;
}
} else {
/* Set the values to the endpoint */
struct sctp_sock *sp = sctp_sk(sk);
if (assocparams.sasoc_asocmaxrxt != 0)
sp->assocparams.sasoc_asocmaxrxt =
assocparams.sasoc_asocmaxrxt;
if (assocparams.sasoc_cookie_life != 0)
sp->assocparams.sasoc_cookie_life =
assocparams.sasoc_cookie_life;
}
return 0;
}
| 1,317 |
167,875 | 0 | void Document::CheckCompleted() {
if (!ShouldComplete())
return;
if (frame_) {
frame_->Client()->RunScriptsAtDocumentIdle();
if (!frame_)
return;
if (!ShouldComplete())
return;
}
SetReadyState(kComplete);
if (LoadEventStillNeeded())
ImplicitClose();
if (!frame_ || !frame_->IsAttached())
return;
if (frame_->GetSettings()->GetSavePreviousDocumentResources() ==
SavePreviousDocumentResources::kUntilOnLoad) {
fetcher_->ClearResourcesFromPreviousFetcher();
}
frame_->GetNavigationScheduler().StartTimer();
View()->HandleLoadCompleted();
if (!AllDescendantsAreComplete(frame_))
return;
if (!Loader()->SentDidFinishLoad()) {
if (frame_->IsMainFrame())
GetViewportDescription().ReportMobilePageStats(frame_);
Loader()->SetSentDidFinishLoad();
frame_->Client()->DispatchDidFinishLoad();
if (!frame_)
return;
if (frame_->Client()->GetRemoteNavigationAssociatedInterfaces()) {
mojom::blink::UkmSourceIdFrameHostAssociatedPtr ukm_binding;
frame_->Client()->GetRemoteNavigationAssociatedInterfaces()->GetInterface(
&ukm_binding);
DCHECK(ukm_binding.is_bound());
ukm_binding->SetDocumentSourceId(ukm_source_id_);
}
}
frame_->Loader().DidFinishNavigation();
}
| 1,318 |
54,417 | 0 | static ZIPARCHIVE_METHOD(getStream)
{
struct zip *intern;
zval *self = getThis();
struct zip_stat sb;
char *mode = "rb";
zend_string *filename;
php_stream *stream;
ze_zip_object *obj;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "P", &filename) == FAILURE) {
return;
}
if (zip_stat(intern, ZSTR_VAL(filename), 0, &sb) != 0) {
RETURN_FALSE;
}
obj = Z_ZIP_P(self);
stream = php_stream_zip_open(obj->filename, ZSTR_VAL(filename), mode STREAMS_CC);
if (stream) {
php_stream_to_zval(stream, return_value);
} else {
RETURN_FALSE;
}
}
| 1,319 |
71,340 | 0 | static int parse_authenticate_response(
git_vector *www_authenticate,
http_subtransport *t,
int *allowed_types)
{
git_http_auth_context *context;
char *challenge;
size_t i;
git_vector_foreach(www_authenticate, i, challenge) {
if (auth_context_match(&context, t, challenge_match, challenge) < 0)
return -1;
else if (!context)
continue;
if (context->set_challenge &&
context->set_challenge(context, challenge) < 0)
return -1;
*allowed_types |= context->credtypes;
}
return 0;
}
| 1,320 |
33,762 | 0 | static int evm_calc_hmac_or_hash(struct dentry *dentry,
const char *req_xattr_name,
const char *req_xattr_value,
size_t req_xattr_value_len,
char type, char *digest)
{
struct inode *inode = dentry->d_inode;
struct shash_desc *desc;
char **xattrname;
size_t xattr_size = 0;
char *xattr_value = NULL;
int error;
int size;
if (!inode->i_op || !inode->i_op->getxattr)
return -EOPNOTSUPP;
desc = init_desc(type);
if (IS_ERR(desc))
return PTR_ERR(desc);
error = -ENODATA;
for (xattrname = evm_config_xattrnames; *xattrname != NULL; xattrname++) {
if ((req_xattr_name && req_xattr_value)
&& !strcmp(*xattrname, req_xattr_name)) {
error = 0;
crypto_shash_update(desc, (const u8 *)req_xattr_value,
req_xattr_value_len);
continue;
}
size = vfs_getxattr_alloc(dentry, *xattrname,
&xattr_value, xattr_size, GFP_NOFS);
if (size == -ENOMEM) {
error = -ENOMEM;
goto out;
}
if (size < 0)
continue;
error = 0;
xattr_size = size;
crypto_shash_update(desc, (const u8 *)xattr_value, xattr_size);
}
hmac_add_misc(desc, inode, digest);
out:
kfree(xattr_value);
kfree(desc);
return error;
}
| 1,321 |
113,649 | 0 | double AccessibilityUIElement::x()
{
if (!m_element || !ATK_IS_OBJECT(m_element))
return 0.0f;
int x, y;
atk_component_get_position(ATK_COMPONENT(m_element), &x, &y, ATK_XY_SCREEN);
return x;
}
| 1,322 |
46,580 | 0 | ssize_t rawexpread(off_t a, char *buf, size_t len, CLIENT *client) {
int fhandle;
off_t foffset;
size_t maxbytes;
if(get_filepos(client->export, a, &fhandle, &foffset, &maxbytes))
return -1;
if(maxbytes && len > maxbytes)
len = maxbytes;
DEBUG("(READ from fd %d offset %llu len %u), ", fhandle, (long long unsigned int)foffset, (unsigned int)len);
myseek(fhandle, foffset);
return read(fhandle, buf, len);
}
| 1,323 |
82,677 | 0 | static int archinfo(RAnal *anal, int q) {
return 2; /* :) */
}
| 1,324 |
21,036 | 0 | int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm,
gfp_t gfp_mask)
{
struct mem_cgroup *memcg = NULL;
enum charge_type type = MEM_CGROUP_CHARGE_TYPE_CACHE;
int ret;
if (mem_cgroup_disabled())
return 0;
if (PageCompound(page))
return 0;
if (unlikely(!mm))
mm = &init_mm;
if (!page_is_file_cache(page))
type = MEM_CGROUP_CHARGE_TYPE_SHMEM;
if (!PageSwapCache(page))
ret = mem_cgroup_charge_common(page, mm, gfp_mask, type);
else { /* page is swapcache/shmem */
ret = mem_cgroup_try_charge_swapin(mm, page, gfp_mask, &memcg);
if (!ret)
__mem_cgroup_commit_charge_swapin(page, memcg, type);
}
return ret;
}
| 1,325 |
4,830 | 0 | FilterRawEvents(const ClientPtr client, const GrabPtr grab, WindowPtr root)
{
XIClientPtr client_xi_version;
int cmp;
/* device not grabbed -> don't filter */
if (!grab)
return FALSE;
client_xi_version =
dixLookupPrivate(&client->devPrivates, XIClientPrivateKey);
cmp = version_compare(client_xi_version->major_version,
client_xi_version->minor_version, 2, 0);
/* XI 2.0: if device is grabbed, skip
XI 2.1: if device is grabbed by us, skip, we've already delivered */
if (cmp == 0)
return TRUE;
return (grab->window != root) ? FALSE : SameClient(grab, client);
}
| 1,326 |
47,373 | 0 | sha384_init(struct shash_desc *desc)
{
struct sha512_state *sctx = shash_desc_ctx(desc);
sctx->state[0] = SHA384_H0;
sctx->state[1] = SHA384_H1;
sctx->state[2] = SHA384_H2;
sctx->state[3] = SHA384_H3;
sctx->state[4] = SHA384_H4;
sctx->state[5] = SHA384_H5;
sctx->state[6] = SHA384_H6;
sctx->state[7] = SHA384_H7;
sctx->count[0] = sctx->count[1] = 0;
return 0;
}
| 1,327 |
179,221 | 1 | static int __ptrace_may_access(struct task_struct *task, unsigned int mode)
{
const struct cred *cred = current_cred(), *tcred;
/* May we inspect the given task?
* This check is used both for attaching with ptrace
* and for allowing access to sensitive information in /proc.
*
* ptrace_attach denies several cases that /proc allows
* because setting up the necessary parent/child relationship
* or halting the specified task is impossible.
*/
int dumpable = 0;
/* Don't let security modules deny introspection */
if (same_thread_group(task, current))
return 0;
rcu_read_lock();
tcred = __task_cred(task);
if (uid_eq(cred->uid, tcred->euid) &&
uid_eq(cred->uid, tcred->suid) &&
uid_eq(cred->uid, tcred->uid) &&
gid_eq(cred->gid, tcred->egid) &&
gid_eq(cred->gid, tcred->sgid) &&
gid_eq(cred->gid, tcred->gid))
goto ok;
if (ptrace_has_cap(tcred->user_ns, mode))
goto ok;
rcu_read_unlock();
return -EPERM;
ok:
rcu_read_unlock();
smp_rmb();
if (task->mm)
dumpable = get_dumpable(task->mm);
rcu_read_lock();
if (!dumpable && !ptrace_has_cap(__task_cred(task)->user_ns, mode)) {
rcu_read_unlock();
return -EPERM;
}
rcu_read_unlock();
return security_ptrace_access_check(task, mode);
}
| 1,328 |
80,278 | 0 | GF_Err mvhd_Read(GF_Box *s, GF_BitStream *bs)
{
GF_MovieHeaderBox *ptr = (GF_MovieHeaderBox *)s;
if (ptr == NULL) return GF_BAD_PARAM;
if (ptr->version == 1) {
ptr->creationTime = gf_bs_read_u64(bs);
ptr->modificationTime = gf_bs_read_u64(bs);
ptr->timeScale = gf_bs_read_u32(bs);
ptr->duration = gf_bs_read_u64(bs);
} else {
ptr->creationTime = gf_bs_read_u32(bs);
ptr->modificationTime = gf_bs_read_u32(bs);
ptr->timeScale = gf_bs_read_u32(bs);
ptr->duration = gf_bs_read_u32(bs);
}
if (!ptr->timeScale) {
GF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, ("[iso file] Movie header timescale is invalid (0) - defaulting to 600\n" ));
ptr->timeScale = 600;
}
ptr->preferredRate = gf_bs_read_u32(bs);
ptr->preferredVolume = gf_bs_read_u16(bs);
gf_bs_read_data(bs, ptr->reserved, 10);
ptr->matrixA = gf_bs_read_u32(bs);
ptr->matrixB = gf_bs_read_u32(bs);
ptr->matrixU = gf_bs_read_u32(bs);
ptr->matrixC = gf_bs_read_u32(bs);
ptr->matrixD = gf_bs_read_u32(bs);
ptr->matrixV = gf_bs_read_u32(bs);
ptr->matrixX = gf_bs_read_u32(bs);
ptr->matrixY = gf_bs_read_u32(bs);
ptr->matrixW = gf_bs_read_u32(bs);
ptr->previewTime = gf_bs_read_u32(bs);
ptr->previewDuration = gf_bs_read_u32(bs);
ptr->posterTime = gf_bs_read_u32(bs);
ptr->selectionTime = gf_bs_read_u32(bs);
ptr->selectionDuration = gf_bs_read_u32(bs);
ptr->currentTime = gf_bs_read_u32(bs);
ptr->nextTrackID = gf_bs_read_u32(bs);
ptr->original_duration = ptr->duration;
return GF_OK;
}
| 1,329 |
7,673 | 0 | static int handle_link(FsContext *ctx, V9fsPath *oldpath,
V9fsPath *dirpath, const char *name)
{
int oldfd, newdirfd, ret;
struct handle_data *data = (struct handle_data *)ctx->private;
oldfd = open_by_handle(data->mountfd, oldpath->data, O_PATH);
if (oldfd < 0) {
return oldfd;
}
newdirfd = open_by_handle(data->mountfd, dirpath->data, O_PATH);
if (newdirfd < 0) {
close(oldfd);
return newdirfd;
}
ret = linkat(oldfd, "", newdirfd, name, AT_EMPTY_PATH);
close(newdirfd);
close(oldfd);
return ret;
}
| 1,330 |
173,241 | 0 | store_read_buffer_size(png_store *ps)
{
/* Return the bytes available for read in the current buffer. */
if (ps->next != &ps->current->data)
return STORE_BUFFER_SIZE;
return ps->current->datacount;
}
| 1,331 |
8,163 | 0 | void Gfx::opSetTextMatrix(Object args[], int numArgs) {
state->setTextMat(args[0].getNum(), args[1].getNum(),
args[2].getNum(), args[3].getNum(),
args[4].getNum(), args[5].getNum());
state->textMoveTo(0, 0);
out->updateTextMat(state);
out->updateTextPos(state);
fontChanged = gTrue;
}
| 1,332 |
49,742 | 0 | void arcmsr_clear_iop2drv_rqueue_buffer(struct AdapterControlBlock *acb)
{
uint32_t i;
if (acb->acb_flags & ACB_F_IOPDATA_OVERFLOW) {
for (i = 0; i < 15; i++) {
if (acb->acb_flags & ACB_F_IOPDATA_OVERFLOW) {
acb->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW;
acb->rqbuf_getIndex = 0;
acb->rqbuf_putIndex = 0;
arcmsr_iop_message_read(acb);
mdelay(30);
} else if (acb->rqbuf_getIndex !=
acb->rqbuf_putIndex) {
acb->rqbuf_getIndex = 0;
acb->rqbuf_putIndex = 0;
mdelay(30);
} else
break;
}
}
}
| 1,333 |
28,829 | 0 | void kvm_arch_async_page_ready(struct kvm_vcpu *vcpu, struct kvm_async_pf *work)
{
int r;
if ((vcpu->arch.mmu.direct_map != work->arch.direct_map) ||
work->wakeup_all)
return;
r = kvm_mmu_reload(vcpu);
if (unlikely(r))
return;
if (!vcpu->arch.mmu.direct_map &&
work->arch.cr3 != vcpu->arch.mmu.get_cr3(vcpu))
return;
vcpu->arch.mmu.page_fault(vcpu, work->gva, 0, true);
}
| 1,334 |
80,282 | 0 | GF_Box *name_New()
{
ISOM_DECL_BOX_ALLOC(GF_NameBox, GF_ISOM_BOX_TYPE_NAME);
return (GF_Box *)tmp;
}
| 1,335 |
88,876 | 0 | static MagickBooleanType RenderPostscript(Image *image,
const DrawInfo *draw_info,const PointInfo *offset,TypeMetric *metrics)
{
char
filename[MaxTextExtent],
geometry[MaxTextExtent],
*text;
FILE
*file;
Image
*annotate_image;
ImageInfo
*annotate_info;
int
unique_file;
MagickBooleanType
identity;
PointInfo
extent,
point,
resolution;
register ssize_t
i;
size_t
length;
ssize_t
y;
/*
Render label with a Postscript font.
*/
if (image->debug != MagickFalse)
(void) LogMagickEvent(AnnotateEvent,GetMagickModule(),
"Font %s; pointsize %g",draw_info->font != (char *) NULL ?
draw_info->font : "none",draw_info->pointsize);
file=(FILE *) NULL;
unique_file=AcquireUniqueFileResource(filename);
if (unique_file != -1)
file=fdopen(unique_file,"wb");
if ((unique_file == -1) || (file == (FILE *) NULL))
{
ThrowFileException(&image->exception,FileOpenError,"UnableToOpenFile",
filename);
return(MagickFalse);
}
(void) FormatLocaleFile(file,"%%!PS-Adobe-3.0\n");
(void) FormatLocaleFile(file,"/ReencodeType\n");
(void) FormatLocaleFile(file,"{\n");
(void) FormatLocaleFile(file," findfont dup length\n");
(void) FormatLocaleFile(file,
" dict begin { 1 index /FID ne {def} {pop pop} ifelse } forall\n");
(void) FormatLocaleFile(file,
" /Encoding ISOLatin1Encoding def currentdict end definefont pop\n");
(void) FormatLocaleFile(file,"} bind def\n");
/*
Sample to compute bounding box.
*/
identity=(fabs(draw_info->affine.sx-draw_info->affine.sy) < MagickEpsilon) &&
(fabs(draw_info->affine.rx) < MagickEpsilon) &&
(fabs(draw_info->affine.ry) < MagickEpsilon) ? MagickTrue : MagickFalse;
extent.x=0.0;
extent.y=0.0;
length=strlen(draw_info->text);
for (i=0; i <= (ssize_t) (length+2); i++)
{
point.x=fabs(draw_info->affine.sx*i*draw_info->pointsize+
draw_info->affine.ry*2.0*draw_info->pointsize);
point.y=fabs(draw_info->affine.rx*i*draw_info->pointsize+
draw_info->affine.sy*2.0*draw_info->pointsize);
if (point.x > extent.x)
extent.x=point.x;
if (point.y > extent.y)
extent.y=point.y;
}
(void) FormatLocaleFile(file,"%g %g moveto\n",identity != MagickFalse ? 0.0 :
extent.x/2.0,extent.y/2.0);
(void) FormatLocaleFile(file,"%g %g scale\n",draw_info->pointsize,
draw_info->pointsize);
if ((draw_info->font == (char *) NULL) || (*draw_info->font == '\0') ||
(strchr(draw_info->font,'/') != (char *) NULL))
(void) FormatLocaleFile(file,
"/Times-Roman-ISO dup /Times-Roman ReencodeType findfont setfont\n");
else
(void) FormatLocaleFile(file,
"/%s-ISO dup /%s ReencodeType findfont setfont\n",draw_info->font,
draw_info->font);
(void) FormatLocaleFile(file,"[%g %g %g %g 0 0] concat\n",
draw_info->affine.sx,-draw_info->affine.rx,-draw_info->affine.ry,
draw_info->affine.sy);
text=EscapeParenthesis(draw_info->text);
if (identity == MagickFalse)
(void) FormatLocaleFile(file,"(%s) stringwidth pop -0.5 mul -0.5 rmoveto\n",
text);
(void) FormatLocaleFile(file,"(%s) show\n",text);
text=DestroyString(text);
(void) FormatLocaleFile(file,"showpage\n");
(void) fclose(file);
(void) FormatLocaleString(geometry,MaxTextExtent,"%.20gx%.20g+0+0!",
floor(extent.x+0.5),floor(extent.y+0.5));
annotate_info=AcquireImageInfo();
(void) FormatLocaleString(annotate_info->filename,MaxTextExtent,"ps:%s",
filename);
(void) CloneString(&annotate_info->page,geometry);
if (draw_info->density != (char *) NULL)
(void) CloneString(&annotate_info->density,draw_info->density);
annotate_info->antialias=draw_info->text_antialias;
annotate_image=ReadImage(annotate_info,&image->exception);
CatchException(&image->exception);
annotate_info=DestroyImageInfo(annotate_info);
(void) RelinquishUniqueFileResource(filename);
if (annotate_image == (Image *) NULL)
return(MagickFalse);
resolution.x=DefaultResolution;
resolution.y=DefaultResolution;
if (draw_info->density != (char *) NULL)
{
GeometryInfo
geometry_info;
MagickStatusType
flags;
flags=ParseGeometry(draw_info->density,&geometry_info);
resolution.x=geometry_info.rho;
resolution.y=geometry_info.sigma;
if ((flags & SigmaValue) == 0)
resolution.y=resolution.x;
}
if (identity == MagickFalse)
(void) TransformImage(&annotate_image,"0x0",(char *) NULL);
else
{
RectangleInfo
crop_info;
crop_info=GetImageBoundingBox(annotate_image,&annotate_image->exception);
crop_info.height=(size_t) ((resolution.y/DefaultResolution)*
ExpandAffine(&draw_info->affine)*draw_info->pointsize+0.5);
crop_info.y=(ssize_t) ceil((resolution.y/DefaultResolution)*extent.y/8.0-
0.5);
(void) FormatLocaleString(geometry,MaxTextExtent,
"%.20gx%.20g%+.20g%+.20g",(double) crop_info.width,(double)
crop_info.height,(double) crop_info.x,(double) crop_info.y);
(void) TransformImage(&annotate_image,geometry,(char *) NULL);
}
metrics->pixels_per_em.x=(resolution.y/DefaultResolution)*
ExpandAffine(&draw_info->affine)*draw_info->pointsize;
metrics->pixels_per_em.y=metrics->pixels_per_em.x;
metrics->ascent=metrics->pixels_per_em.x;
metrics->descent=metrics->pixels_per_em.y/-5.0;
metrics->width=(double) annotate_image->columns/
ExpandAffine(&draw_info->affine);
metrics->height=1.152*metrics->pixels_per_em.x;
metrics->max_advance=metrics->pixels_per_em.x;
metrics->bounds.x1=0.0;
metrics->bounds.y1=metrics->descent;
metrics->bounds.x2=metrics->ascent+metrics->descent;
metrics->bounds.y2=metrics->ascent+metrics->descent;
metrics->underline_position=(-2.0);
metrics->underline_thickness=1.0;
if (draw_info->render == MagickFalse)
{
annotate_image=DestroyImage(annotate_image);
return(MagickTrue);
}
if (draw_info->fill.opacity != TransparentOpacity)
{
ExceptionInfo
*exception;
MagickBooleanType
sync;
PixelPacket
fill_color;
CacheView
*annotate_view;
/*
Render fill color.
*/
if (image->matte == MagickFalse)
(void) SetImageAlphaChannel(image,OpaqueAlphaChannel);
if (annotate_image->matte == MagickFalse)
(void) SetImageAlphaChannel(annotate_image,OpaqueAlphaChannel);
fill_color=draw_info->fill;
exception=(&image->exception);
annotate_view=AcquireAuthenticCacheView(annotate_image,exception);
for (y=0; y < (ssize_t) annotate_image->rows; y++)
{
register ssize_t
x;
register PixelPacket
*magick_restrict q;
q=GetCacheViewAuthenticPixels(annotate_view,0,y,annotate_image->columns,
1,exception);
if (q == (PixelPacket *) NULL)
break;
for (x=0; x < (ssize_t) annotate_image->columns; x++)
{
(void) GetFillColor(draw_info,x,y,&fill_color);
SetPixelAlpha(q,ClampToQuantum((((QuantumRange-GetPixelIntensity(
annotate_image,q))*(QuantumRange-fill_color.opacity))/
QuantumRange)));
SetPixelRed(q,fill_color.red);
SetPixelGreen(q,fill_color.green);
SetPixelBlue(q,fill_color.blue);
q++;
}
sync=SyncCacheViewAuthenticPixels(annotate_view,exception);
if (sync == MagickFalse)
break;
}
annotate_view=DestroyCacheView(annotate_view);
(void) CompositeImage(image,OverCompositeOp,annotate_image,
(ssize_t) ceil(offset->x-0.5),(ssize_t) ceil(offset->y-(metrics->ascent+
metrics->descent)-0.5));
}
annotate_image=DestroyImage(annotate_image);
return(MagickTrue);
}
| 1,336 |
163,961 | 0 | void PaymentRequestState::AreRequestedMethodsSupported(
StatusCallback callback) {
if (!get_all_instruments_finished_) {
are_requested_methods_supported_callback_ = std::move(callback);
return;
}
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::BindOnce(&PaymentRequestState::CheckRequestedMethodsSupported,
weak_ptr_factory_.GetWeakPtr(), std::move(callback)));
}
| 1,337 |
548 | 0 | static void pdf_run_v(fz_context *ctx, pdf_processor *proc, float x2, float y2, float x3, float y3)
{
pdf_run_processor *pr = (pdf_run_processor *)proc;
fz_curvetov(ctx, pr->path, x2, y2, x3, y3);
}
| 1,338 |
43,610 | 0 | AP_DECLARE(request_rec *) ap_sub_req_lookup_file(const char *new_file,
const request_rec *r,
ap_filter_t *next_filter)
{
request_rec *rnew;
int res;
char *fdir;
apr_size_t fdirlen;
rnew = make_sub_request(r, next_filter);
fdir = ap_make_dirstr_parent(rnew->pool, r->filename);
fdirlen = strlen(fdir);
/* Translate r->filename, if it was canonical, it stays canonical
*/
if (r->canonical_filename == r->filename) {
rnew->canonical_filename = (char*)(1);
}
if (apr_filepath_merge(&rnew->filename, fdir, new_file,
APR_FILEPATH_TRUENAME, rnew->pool) != APR_SUCCESS) {
rnew->status = HTTP_FORBIDDEN;
return rnew;
}
if (rnew->canonical_filename) {
rnew->canonical_filename = rnew->filename;
}
/*
* Check for a special case... if there are no '/' characters in new_file
* at all, and the path was the same, then we are looking at a relative
* lookup in the same directory. Fixup the URI to match.
*/
if (strncmp(rnew->filename, fdir, fdirlen) == 0
&& rnew->filename[fdirlen]
&& ap_strchr_c(rnew->filename + fdirlen, '/') == NULL) {
apr_status_t rv;
if (ap_allow_options(rnew) & OPT_SYM_LINKS) {
if (((rv = apr_stat(&rnew->finfo, rnew->filename,
APR_FINFO_MIN, rnew->pool)) != APR_SUCCESS)
&& (rv != APR_INCOMPLETE)) {
rnew->finfo.filetype = APR_NOFILE;
}
}
else {
if (((rv = apr_stat(&rnew->finfo, rnew->filename,
APR_FINFO_LINK | APR_FINFO_MIN,
rnew->pool)) != APR_SUCCESS)
&& (rv != APR_INCOMPLETE)) {
rnew->finfo.filetype = APR_NOFILE;
}
}
if (r->uri && *r->uri) {
char *udir = ap_make_dirstr_parent(rnew->pool, r->uri);
rnew->uri = ap_make_full_path(rnew->pool, udir,
rnew->filename + fdirlen);
ap_parse_uri(rnew, rnew->uri); /* fill in parsed_uri values */
}
else {
ap_parse_uri(rnew, new_file); /* fill in parsed_uri values */
rnew->uri = apr_pstrdup(rnew->pool, "");
}
}
else {
/* XXX: @@@: What should be done with the parsed_uri values?
* We would be better off stripping down to the 'common' elements
* of the path, then reassembling the URI as best as we can.
*/
ap_parse_uri(rnew, new_file); /* fill in parsed_uri values */
/*
* XXX: this should be set properly like it is in the same-dir case
* but it's actually sometimes to impossible to do it... because the
* file may not have a uri associated with it -djg
*/
rnew->uri = apr_pstrdup(rnew->pool, "");
}
/* We cannot return NULL without violating the API. So just turn this
* subrequest into a 500. */
if (ap_is_recursion_limit_exceeded(r)) {
rnew->status = HTTP_INTERNAL_SERVER_ERROR;
return rnew;
}
if ((res = ap_process_request_internal(rnew))) {
rnew->status = res;
}
return rnew;
}
| 1,339 |
103,708 | 0 | void DevToolsAgent::runtimeFeatureStateChanged(
const WebKit::WebString& feature,
bool enabled) {
Send(new DevToolsHostMsg_RuntimePropertyChanged(
routing_id(),
feature.utf8(),
enabled ? "true" : "false"));
}
| 1,340 |
151,209 | 0 | Response InspectorNetworkAgent::canClearBrowserCache(bool* result) {
*result = true;
return Response::OK();
}
| 1,341 |
149,255 | 0 | void HTMLFormControlElement::formAction(USVStringOrTrustedURL& result) const {
const AtomicString& action = FastGetAttribute(kFormactionAttr);
if (action.IsEmpty()) {
result.SetUSVString(GetDocument().Url());
return;
}
result.SetUSVString(
GetDocument().CompleteURL(StripLeadingAndTrailingHTMLSpaces(action)));
}
| 1,342 |
124,056 | 0 | bool BookmarksImportFunction::RunImpl() {
if (!EditBookmarksEnabled())
return false;
SelectFile(ui::SelectFileDialog::SELECT_OPEN_FILE);
return true;
}
| 1,343 |
110,391 | 0 | bool PluginModule::ReserveInstanceID(PP_Instance instance) {
if (reserve_instance_id_)
return PPBoolToBool(reserve_instance_id_(pp_module_, instance));
return true; // Instance ID is usable.
}
| 1,344 |
104,251 | 0 | MediaStreamList* RTCPeerConnection::remoteStreams() const
{
return m_remoteStreams.get();
}
| 1,345 |
116,949 | 0 | void IndexedDBDispatcher::OnWorkerRunLoopStopped() {
delete this;
}
| 1,346 |
154,773 | 0 | error::Error GLES2DecoderPassthroughImpl::DoReleaseTexImage2DCHROMIUM(
GLenum target,
GLint imageId) {
if (target != GL_TEXTURE_2D) {
InsertError(GL_INVALID_ENUM, "Invalid target");
return error::kNoError;
}
const BoundTexture& bound_texture =
bound_textures_[static_cast<size_t>(TextureTarget::k2D)]
[active_texture_unit_];
if (bound_texture.texture == nullptr) {
InsertError(GL_INVALID_OPERATION, "No texture bound");
return error::kNoError;
}
gl::GLImage* image = group_->image_manager()->LookupImage(imageId);
if (image == nullptr) {
InsertError(GL_INVALID_OPERATION, "No image found with the given ID");
return error::kNoError;
}
if (bound_texture.texture->GetLevelImage(target, 0) == image) {
image->ReleaseTexImage(target);
bound_texture.texture->SetLevelImage(target, 0, nullptr);
}
UpdateTextureSizeFromTarget(target);
return error::kNoError;
}
| 1,347 |
49,364 | 0 | bool lockdep_nfnl_is_held(u8 subsys_id)
{
return lockdep_is_held(&table[subsys_id].mutex);
}
| 1,348 |
93,198 | 0 | set_dumper_capsicum_rights(pcap_dumper_t *p)
{
int fd = fileno(pcap_dump_file(p));
cap_rights_t rights;
cap_rights_init(&rights, CAP_SEEK, CAP_WRITE, CAP_FCNTL);
if (cap_rights_limit(fd, &rights) < 0 && errno != ENOSYS) {
error("unable to limit dump descriptor");
}
if (cap_fcntls_limit(fd, CAP_FCNTL_GETFL) < 0 && errno != ENOSYS) {
error("unable to limit dump descriptor fcntls");
}
}
| 1,349 |
85,129 | 0 | SYSCALL_DEFINE2(clock_gettime, const clockid_t, which_clock,
struct timespec __user *,tp)
{
const struct k_clock *kc = clockid_to_kclock(which_clock);
struct timespec64 kernel_tp;
int error;
if (!kc)
return -EINVAL;
error = kc->clock_get(which_clock, &kernel_tp);
if (!error && put_timespec64(&kernel_tp, tp))
error = -EFAULT;
return error;
}
| 1,350 |
84,811 | 0 | static int tm_cfpr_active(struct task_struct *target,
const struct user_regset *regset)
{
if (!cpu_has_feature(CPU_FTR_TM))
return -ENODEV;
if (!MSR_TM_ACTIVE(target->thread.regs->msr))
return 0;
return regset->n;
}
| 1,351 |
66,888 | 0 | static inline int private_mapping_ok(struct vm_area_struct *vma)
{
return 1;
}
| 1,352 |
15,574 | 0 | tilde_expand_paths(char **paths, u_int num_paths)
{
u_int i;
char *cp;
for (i = 0; i < num_paths; i++) {
cp = tilde_expand_filename(paths[i], original_real_uid);
free(paths[i]);
paths[i] = cp;
}
}
| 1,353 |
115,339 | 0 | static void didReceiveServerRedirectForProvisionalLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void* clientInfo)
{
if (!WKFrameIsMainFrame(frame))
return;
webkitWebViewLoadChanged(WEBKIT_WEB_VIEW(clientInfo), WEBKIT_LOAD_REDIRECTED);
}
| 1,354 |
165,160 | 0 | void HTMLFormElement::Submit(Event* event,
HTMLFormControlElement* submit_button) {
LocalFrameView* view = GetDocument().View();
LocalFrame* frame = GetDocument().GetFrame();
if (!view || !frame || !frame->GetPage())
return;
if (!isConnected()) {
GetDocument().AddConsoleMessage(ConsoleMessage::Create(
kJSMessageSource, kWarningMessageLevel,
"Form submission canceled because the form is not connected"));
return;
}
if (is_submitting_)
return;
EventQueueScope scope_for_dialog_close;
AutoReset<bool> submit_scope(&is_submitting_, true);
if (event && !submit_button) {
for (const auto& listed_element : ListedElements()) {
if (!listed_element->IsFormControlElement())
continue;
HTMLFormControlElement* control =
ToHTMLFormControlElement(listed_element);
DCHECK(!control->IsActivatedSubmit());
if (control->IsSuccessfulSubmitButton()) {
submit_button = control;
break;
}
}
}
FormSubmission* form_submission =
FormSubmission::Create(this, attributes_, event, submit_button);
if (form_submission->Method() == FormSubmission::kDialogMethod) {
SubmitDialog(form_submission);
} else if (in_user_js_submit_event_) {
planned_navigation_ = form_submission;
} else {
ScheduleFormSubmission(form_submission);
}
}
| 1,355 |
43,317 | 0 | ushort * CLASS make_decoder_ref (const uchar **source)
{
int max, len, h, i, j;
const uchar *count;
ushort *huff;
count = (*source += 16) - 17;
for (max=16; max && !count[max]; max--);
huff = (ushort *) calloc (1 + (1 << max), sizeof *huff);
merror (huff, "make_decoder()");
huff[0] = max;
for (h=len=1; len <= max; len++)
for (i=0; i < count[len]; i++, ++*source)
for (j=0; j < 1 << (max-len); j++)
if (h <= 1 << max)
huff[h++] = len << 8 | **source;
return huff;
}
| 1,356 |
181,419 | 1 | static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s,
AVFrame *p, AVPacket *avpkt)
{
AVDictionary *metadata = NULL;
uint32_t tag, length;
int decode_next_dat = 0;
int ret;
for (;;) {
length = bytestream2_get_bytes_left(&s->gb);
if (length <= 0) {
if (avctx->codec_id == AV_CODEC_ID_PNG &&
avctx->skip_frame == AVDISCARD_ALL) {
av_frame_set_metadata(p, metadata);
return 0;
}
if (CONFIG_APNG_DECODER && avctx->codec_id == AV_CODEC_ID_APNG && length == 0) {
if (!(s->state & PNG_IDAT))
return 0;
else
goto exit_loop;
}
av_log(avctx, AV_LOG_ERROR, "%d bytes left\n", length);
if ( s->state & PNG_ALLIMAGE
&& avctx->strict_std_compliance <= FF_COMPLIANCE_NORMAL)
goto exit_loop;
ret = AVERROR_INVALIDDATA;
goto fail;
}
length = bytestream2_get_be32(&s->gb);
if (length > 0x7fffffff || length > bytestream2_get_bytes_left(&s->gb)) {
av_log(avctx, AV_LOG_ERROR, "chunk too big\n");
ret = AVERROR_INVALIDDATA;
goto fail;
}
tag = bytestream2_get_le32(&s->gb);
if (avctx->debug & FF_DEBUG_STARTCODE)
av_log(avctx, AV_LOG_DEBUG, "png: tag=%c%c%c%c length=%u\n",
(tag & 0xff),
((tag >> 8) & 0xff),
((tag >> 16) & 0xff),
((tag >> 24) & 0xff), length);
if (avctx->codec_id == AV_CODEC_ID_PNG &&
avctx->skip_frame == AVDISCARD_ALL) {
switch(tag) {
case MKTAG('I', 'H', 'D', 'R'):
case MKTAG('p', 'H', 'Y', 's'):
case MKTAG('t', 'E', 'X', 't'):
case MKTAG('I', 'D', 'A', 'T'):
case MKTAG('t', 'R', 'N', 'S'):
break;
default:
goto skip_tag;
}
}
switch (tag) {
case MKTAG('I', 'H', 'D', 'R'):
if ((ret = decode_ihdr_chunk(avctx, s, length)) < 0)
goto fail;
break;
case MKTAG('p', 'H', 'Y', 's'):
if ((ret = decode_phys_chunk(avctx, s)) < 0)
goto fail;
break;
case MKTAG('f', 'c', 'T', 'L'):
if (!CONFIG_APNG_DECODER || avctx->codec_id != AV_CODEC_ID_APNG)
goto skip_tag;
if ((ret = decode_fctl_chunk(avctx, s, length)) < 0)
goto fail;
decode_next_dat = 1;
break;
case MKTAG('f', 'd', 'A', 'T'):
if (!CONFIG_APNG_DECODER || avctx->codec_id != AV_CODEC_ID_APNG)
goto skip_tag;
if (!decode_next_dat) {
ret = AVERROR_INVALIDDATA;
goto fail;
}
bytestream2_get_be32(&s->gb);
length -= 4;
/* fallthrough */
case MKTAG('I', 'D', 'A', 'T'):
if (CONFIG_APNG_DECODER && avctx->codec_id == AV_CODEC_ID_APNG && !decode_next_dat)
goto skip_tag;
if ((ret = decode_idat_chunk(avctx, s, length, p)) < 0)
goto fail;
break;
case MKTAG('P', 'L', 'T', 'E'):
if (decode_plte_chunk(avctx, s, length) < 0)
goto skip_tag;
break;
case MKTAG('t', 'R', 'N', 'S'):
if (decode_trns_chunk(avctx, s, length) < 0)
goto skip_tag;
break;
case MKTAG('t', 'E', 'X', 't'):
if (decode_text_chunk(s, length, 0, &metadata) < 0)
av_log(avctx, AV_LOG_WARNING, "Broken tEXt chunk\n");
bytestream2_skip(&s->gb, length + 4);
break;
case MKTAG('z', 'T', 'X', 't'):
if (decode_text_chunk(s, length, 1, &metadata) < 0)
av_log(avctx, AV_LOG_WARNING, "Broken zTXt chunk\n");
bytestream2_skip(&s->gb, length + 4);
break;
case MKTAG('s', 'T', 'E', 'R'): {
int mode = bytestream2_get_byte(&s->gb);
AVStereo3D *stereo3d = av_stereo3d_create_side_data(p);
if (!stereo3d)
goto fail;
if (mode == 0 || mode == 1) {
stereo3d->type = AV_STEREO3D_SIDEBYSIDE;
stereo3d->flags = mode ? 0 : AV_STEREO3D_FLAG_INVERT;
} else {
av_log(avctx, AV_LOG_WARNING,
"Unknown value in sTER chunk (%d)\n", mode);
}
bytestream2_skip(&s->gb, 4); /* crc */
break;
}
case MKTAG('I', 'E', 'N', 'D'):
if (!(s->state & PNG_ALLIMAGE))
av_log(avctx, AV_LOG_ERROR, "IEND without all image\n");
if (!(s->state & (PNG_ALLIMAGE|PNG_IDAT))) {
ret = AVERROR_INVALIDDATA;
goto fail;
}
bytestream2_skip(&s->gb, 4); /* crc */
goto exit_loop;
default:
/* skip tag */
skip_tag:
bytestream2_skip(&s->gb, length + 4);
break;
}
}
exit_loop:
if (avctx->codec_id == AV_CODEC_ID_PNG &&
avctx->skip_frame == AVDISCARD_ALL) {
av_frame_set_metadata(p, metadata);
return 0;
}
if (s->bits_per_pixel <= 4)
handle_small_bpp(s, p);
/* apply transparency if needed */
if (s->has_trns && s->color_type != PNG_COLOR_TYPE_PALETTE) {
size_t byte_depth = s->bit_depth > 8 ? 2 : 1;
size_t raw_bpp = s->bpp - byte_depth;
unsigned x, y;
for (y = 0; y < s->height; ++y) {
uint8_t *row = &s->image_buf[s->image_linesize * y];
/* since we're updating in-place, we have to go from right to left */
for (x = s->width; x > 0; --x) {
uint8_t *pixel = &row[s->bpp * (x - 1)];
memmove(pixel, &row[raw_bpp * (x - 1)], raw_bpp);
if (!memcmp(pixel, s->transparent_color_be, raw_bpp)) {
memset(&pixel[raw_bpp], 0, byte_depth);
} else {
memset(&pixel[raw_bpp], 0xff, byte_depth);
}
}
}
}
/* handle P-frames only if a predecessor frame is available */
if (s->last_picture.f->data[0]) {
if ( !(avpkt->flags & AV_PKT_FLAG_KEY) && avctx->codec_tag != AV_RL32("MPNG")
&& s->last_picture.f->width == p->width
&& s->last_picture.f->height== p->height
&& s->last_picture.f->format== p->format
) {
if (CONFIG_PNG_DECODER && avctx->codec_id != AV_CODEC_ID_APNG)
handle_p_frame_png(s, p);
else if (CONFIG_APNG_DECODER &&
avctx->codec_id == AV_CODEC_ID_APNG &&
(ret = handle_p_frame_apng(avctx, s, p)) < 0)
goto fail;
}
}
ff_thread_report_progress(&s->picture, INT_MAX, 0);
ff_thread_report_progress(&s->previous_picture, INT_MAX, 0);
av_frame_set_metadata(p, metadata);
metadata = NULL;
return 0;
fail:
av_dict_free(&metadata);
ff_thread_report_progress(&s->picture, INT_MAX, 0);
ff_thread_report_progress(&s->previous_picture, INT_MAX, 0);
return ret;
}
| 1,357 |
166,106 | 0 | void PaymentRequest::OnShippingOptionIdSelected(
std::string shipping_option_id) {
client_->OnShippingOptionChange(shipping_option_id);
}
| 1,358 |
125,398 | 0 | void GDataFileSystem::OnFileDownloaded(
const GetFileFromCacheParams& params,
GDataErrorCode status,
const GURL& content_url,
const FilePath& downloaded_file_path) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (status == GDATA_CANCELLED) {
cache_->GetCacheEntryOnUIThread(
params.resource_id,
params.md5,
base::Bind(&GDataFileSystem::UnpinIfPinned,
ui_weak_ptr_,
params.resource_id,
params.md5));
}
bool* has_enough_space = new bool(false);
util::PostBlockingPoolSequencedTaskAndReply(
FROM_HERE,
blocking_task_runner_,
base::Bind(&GDataCache::FreeDiskSpaceIfNeededFor,
base::Unretained(cache_),
0,
has_enough_space),
base::Bind(&GDataFileSystem::OnFileDownloadedAndSpaceChecked,
ui_weak_ptr_,
params,
status,
content_url,
downloaded_file_path,
base::Owned(has_enough_space)));
}
| 1,359 |
76,122 | 0 | fifo_close(notify_fifo_t* fifo)
{
if (fifo->fd != -1) {
close(fifo->fd);
fifo->fd = -1;
}
if (fifo->created_fifo)
unlink(fifo->name);
}
| 1,360 |
86,395 | 0 | long hugetlb_unreserve_pages(struct inode *inode, long start, long end,
long freed)
{
struct hstate *h = hstate_inode(inode);
struct resv_map *resv_map = inode_resv_map(inode);
long chg = 0;
struct hugepage_subpool *spool = subpool_inode(inode);
long gbl_reserve;
if (resv_map) {
chg = region_del(resv_map, start, end);
/*
* region_del() can fail in the rare case where a region
* must be split and another region descriptor can not be
* allocated. If end == LONG_MAX, it will not fail.
*/
if (chg < 0)
return chg;
}
spin_lock(&inode->i_lock);
inode->i_blocks -= (blocks_per_huge_page(h) * freed);
spin_unlock(&inode->i_lock);
/*
* If the subpool has a minimum size, the number of global
* reservations to be released may be adjusted.
*/
gbl_reserve = hugepage_subpool_put_pages(spool, (chg - freed));
hugetlb_acct_memory(h, -gbl_reserve);
return 0;
}
| 1,361 |
184,006 | 1 | bool StopInputMethodProcess() {
if (!IBusConnectionsAreAlive()) {
LOG(ERROR) << "StopInputMethodProcess: IBus connection is not alive";
return false;
}
ibus_bus_exit_async(ibus_,
FALSE /* do not restart */,
-1 /* timeout */,
NULL /* cancellable */,
NULL /* callback */,
NULL /* user_data */);
if (ibus_config_) {
g_object_unref(ibus_config_);
ibus_config_ = NULL;
}
return true;
}
| 1,362 |
106,589 | 0 | void WebPageProxy::printFrame(uint64_t frameID)
{
ASSERT(!m_isPerformingDOMPrintOperation);
m_isPerformingDOMPrintOperation = true;
WebFrameProxy* frame = process()->webFrame(frameID);
MESSAGE_CHECK(frame);
m_uiClient.printFrame(this, frame);
m_isPerformingDOMPrintOperation = false;
}
| 1,363 |
33,333 | 0 | static int edge_open(struct tty_struct *tty, struct usb_serial_port *port)
{
struct edgeport_port *edge_port = usb_get_serial_port_data(port);
struct edgeport_serial *edge_serial;
struct usb_device *dev;
struct urb *urb;
int port_number;
int status;
u16 open_settings;
u8 transaction_timeout;
if (edge_port == NULL)
return -ENODEV;
port_number = port->number - port->serial->minor;
switch (port_number) {
case 0:
edge_port->uart_base = UMPMEM_BASE_UART1;
edge_port->dma_address = UMPD_OEDB1_ADDRESS;
break;
case 1:
edge_port->uart_base = UMPMEM_BASE_UART2;
edge_port->dma_address = UMPD_OEDB2_ADDRESS;
break;
default:
dev_err(&port->dev, "Unknown port number!!!\n");
return -ENODEV;
}
dev_dbg(&port->dev, "%s - port_number = %d, uart_base = %04x, dma_address = %04x\n",
__func__, port_number, edge_port->uart_base, edge_port->dma_address);
dev = port->serial->dev;
memset(&(edge_port->icount), 0x00, sizeof(edge_port->icount));
init_waitqueue_head(&edge_port->delta_msr_wait);
/* turn off loopback */
status = ti_do_config(edge_port, UMPC_SET_CLR_LOOPBACK, 0);
if (status) {
dev_err(&port->dev,
"%s - cannot send clear loopback command, %d\n",
__func__, status);
return status;
}
/* set up the port settings */
if (tty)
edge_set_termios(tty, port, &tty->termios);
/* open up the port */
/* milliseconds to timeout for DMA transfer */
transaction_timeout = 2;
edge_port->ump_read_timeout =
max(20, ((transaction_timeout * 3) / 2));
/* milliseconds to timeout for DMA transfer */
open_settings = (u8)(UMP_DMA_MODE_CONTINOUS |
UMP_PIPE_TRANS_TIMEOUT_ENA |
(transaction_timeout << 2));
dev_dbg(&port->dev, "%s - Sending UMPC_OPEN_PORT\n", __func__);
/* Tell TI to open and start the port */
status = send_cmd(dev, UMPC_OPEN_PORT,
(u8)(UMPM_UART1_PORT + port_number), open_settings, NULL, 0);
if (status) {
dev_err(&port->dev, "%s - cannot send open command, %d\n",
__func__, status);
return status;
}
/* Start the DMA? */
status = send_cmd(dev, UMPC_START_PORT,
(u8)(UMPM_UART1_PORT + port_number), 0, NULL, 0);
if (status) {
dev_err(&port->dev, "%s - cannot send start DMA command, %d\n",
__func__, status);
return status;
}
/* Clear TX and RX buffers in UMP */
status = purge_port(port, UMP_PORT_DIR_OUT | UMP_PORT_DIR_IN);
if (status) {
dev_err(&port->dev,
"%s - cannot send clear buffers command, %d\n",
__func__, status);
return status;
}
/* Read Initial MSR */
status = ti_vread_sync(dev, UMPC_READ_MSR, 0,
(__u16)(UMPM_UART1_PORT + port_number),
&edge_port->shadow_msr, 1);
if (status) {
dev_err(&port->dev, "%s - cannot send read MSR command, %d\n",
__func__, status);
return status;
}
dev_dbg(&port->dev, "ShadowMSR 0x%X\n", edge_port->shadow_msr);
/* Set Initial MCR */
edge_port->shadow_mcr = MCR_RTS | MCR_DTR;
dev_dbg(&port->dev, "ShadowMCR 0x%X\n", edge_port->shadow_mcr);
edge_serial = edge_port->edge_serial;
if (mutex_lock_interruptible(&edge_serial->es_lock))
return -ERESTARTSYS;
if (edge_serial->num_ports_open == 0) {
/* we are the first port to open, post the interrupt urb */
urb = edge_serial->serial->port[0]->interrupt_in_urb;
if (!urb) {
dev_err(&port->dev,
"%s - no interrupt urb present, exiting\n",
__func__);
status = -EINVAL;
goto release_es_lock;
}
urb->context = edge_serial;
status = usb_submit_urb(urb, GFP_KERNEL);
if (status) {
dev_err(&port->dev,
"%s - usb_submit_urb failed with value %d\n",
__func__, status);
goto release_es_lock;
}
}
/*
* reset the data toggle on the bulk endpoints to work around bug in
* host controllers where things get out of sync some times
*/
usb_clear_halt(dev, port->write_urb->pipe);
usb_clear_halt(dev, port->read_urb->pipe);
/* start up our bulk read urb */
urb = port->read_urb;
if (!urb) {
dev_err(&port->dev, "%s - no read urb present, exiting\n",
__func__);
status = -EINVAL;
goto unlink_int_urb;
}
edge_port->ep_read_urb_state = EDGE_READ_URB_RUNNING;
urb->context = edge_port;
status = usb_submit_urb(urb, GFP_KERNEL);
if (status) {
dev_err(&port->dev,
"%s - read bulk usb_submit_urb failed with value %d\n",
__func__, status);
goto unlink_int_urb;
}
++edge_serial->num_ports_open;
goto release_es_lock;
unlink_int_urb:
if (edge_port->edge_serial->num_ports_open == 0)
usb_kill_urb(port->serial->port[0]->interrupt_in_urb);
release_es_lock:
mutex_unlock(&edge_serial->es_lock);
return status;
}
| 1,364 |
98,857 | 0 | int WebSocketExperimentTask::DoWebSocketSendHello() {
DCHECK(websocket_);
next_state_ = STATE_WEBSOCKET_RECV_HELLO;
websocket_echo_start_time_ = base::TimeTicks::Now();
websocket_->Send(config_.websocket_hello_message);
SetTimeout(config_.websocket_hello_echoback_deadline_ms);
return net::ERR_IO_PENDING;
}
| 1,365 |
132,223 | 0 | RenderFrameImpl::JavaScriptIsolatedWorldRequest::JavaScriptIsolatedWorldRequest(
int id,
bool notify_result,
int routing_id,
base::WeakPtr<RenderFrameImpl> render_frame_impl)
: id_(id),
notify_result_(notify_result),
routing_id_(routing_id),
render_frame_impl_(render_frame_impl) {
}
| 1,366 |
84,957 | 0 | static int __init arp_tables_init(void)
{
int ret;
ret = register_pernet_subsys(&arp_tables_net_ops);
if (ret < 0)
goto err1;
/* No one else will be downing sem now, so we won't sleep */
ret = xt_register_targets(arpt_builtin_tg, ARRAY_SIZE(arpt_builtin_tg));
if (ret < 0)
goto err2;
/* Register setsockopt */
ret = nf_register_sockopt(&arpt_sockopts);
if (ret < 0)
goto err4;
return 0;
err4:
xt_unregister_targets(arpt_builtin_tg, ARRAY_SIZE(arpt_builtin_tg));
err2:
unregister_pernet_subsys(&arp_tables_net_ops);
err1:
return ret;
}
| 1,367 |
61,425 | 0 | static int mov_read_dec3(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
AVStream *st;
enum AVAudioServiceType *ast;
int eac3info, acmod, lfeon, bsmod;
if (c->fc->nb_streams < 1)
return 0;
st = c->fc->streams[c->fc->nb_streams-1];
ast = (enum AVAudioServiceType*)av_stream_new_side_data(st, AV_PKT_DATA_AUDIO_SERVICE_TYPE,
sizeof(*ast));
if (!ast)
return AVERROR(ENOMEM);
/* No need to parse fields for additional independent substreams and its
* associated dependent substreams since libavcodec's E-AC-3 decoder
* does not support them yet. */
avio_rb16(pb); /* data_rate and num_ind_sub */
eac3info = avio_rb24(pb);
bsmod = (eac3info >> 12) & 0x1f;
acmod = (eac3info >> 9) & 0x7;
lfeon = (eac3info >> 8) & 0x1;
st->codecpar->channel_layout = avpriv_ac3_channel_layout_tab[acmod];
if (lfeon)
st->codecpar->channel_layout |= AV_CH_LOW_FREQUENCY;
st->codecpar->channels = av_get_channel_layout_nb_channels(st->codecpar->channel_layout);
*ast = bsmod;
if (st->codecpar->channels > 1 && bsmod == 0x7)
*ast = AV_AUDIO_SERVICE_TYPE_KARAOKE;
#if FF_API_LAVF_AVCTX
FF_DISABLE_DEPRECATION_WARNINGS
st->codec->audio_service_type = *ast;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
return 0;
}
| 1,368 |
182,397 | 1 | struct import_t* MACH0_(get_imports)(struct MACH0_(obj_t)* bin) {
struct import_t *imports;
int i, j, idx, stridx;
const char *symstr;
if (!bin->symtab || !bin->symstr || !bin->sects || !bin->indirectsyms)
return NULL;
if (bin->dysymtab.nundefsym < 1 || bin->dysymtab.nundefsym > 0xfffff) {
return NULL;
}
if (!(imports = malloc ((bin->dysymtab.nundefsym + 1) * sizeof (struct import_t)))) {
return NULL;
}
for (i = j = 0; i < bin->dysymtab.nundefsym; i++) {
idx = bin->dysymtab.iundefsym + i;
if (idx < 0 || idx >= bin->nsymtab) {
bprintf ("WARNING: Imports index out of bounds. Ignoring relocs\n");
free (imports);
return NULL;
}
stridx = bin->symtab[idx].n_strx;
if (stridx >= 0 && stridx < bin->symstrlen) {
symstr = (char *)bin->symstr + stridx;
} else {
symstr = "";
}
if (!*symstr) {
continue;
}
{
int i = 0;
int len = 0;
char *symstr_dup = NULL;
len = bin->symstrlen - stridx;
imports[j].name[0] = 0;
if (len > 0) {
for (i = 0; i < len; i++) {
if ((unsigned char)symstr[i] == 0xff || !symstr[i]) {
len = i;
break;
}
}
symstr_dup = r_str_ndup (symstr, len);
if (symstr_dup) {
r_str_ncpy (imports[j].name, symstr_dup, R_BIN_MACH0_STRING_LENGTH);
r_str_filter (imports[j].name, - 1);
imports[j].name[R_BIN_MACH0_STRING_LENGTH - 2] = 0;
free (symstr_dup);
}
}
}
imports[j].ord = i;
imports[j++].last = 0;
}
imports[j].last = 1;
if (!bin->imports_by_ord_size) {
if (j > 0) {
bin->imports_by_ord_size = j;
bin->imports_by_ord = (RBinImport**)calloc (j, sizeof (RBinImport*));
} else {
bin->imports_by_ord_size = 0;
bin->imports_by_ord = NULL;
}
}
return imports;
}
| 1,369 |
176,620 | 0 | xmlParseContent(xmlParserCtxtPtr ctxt) {
GROW;
while ((RAW != 0) &&
((RAW != '<') || (NXT(1) != '/')) &&
(ctxt->instate != XML_PARSER_EOF)) {
const xmlChar *test = CUR_PTR;
unsigned int cons = ctxt->input->consumed;
const xmlChar *cur = ctxt->input->cur;
/*
* First case : a Processing Instruction.
*/
if ((*cur == '<') && (cur[1] == '?')) {
xmlParsePI(ctxt);
}
/*
* Second case : a CDSection
*/
/* 2.6.0 test was *cur not RAW */
else if (CMP9(CUR_PTR, '<', '!', '[', 'C', 'D', 'A', 'T', 'A', '[')) {
xmlParseCDSect(ctxt);
}
/*
* Third case : a comment
*/
else if ((*cur == '<') && (NXT(1) == '!') &&
(NXT(2) == '-') && (NXT(3) == '-')) {
xmlParseComment(ctxt);
ctxt->instate = XML_PARSER_CONTENT;
}
/*
* Fourth case : a sub-element.
*/
else if (*cur == '<') {
xmlParseElement(ctxt);
}
/*
* Fifth case : a reference. If if has not been resolved,
* parsing returns it's Name, create the node
*/
else if (*cur == '&') {
xmlParseReference(ctxt);
}
/*
* Last case, text. Note that References are handled directly.
*/
else {
xmlParseCharData(ctxt, 0);
}
GROW;
/*
* Pop-up of finished entities.
*/
while ((RAW == 0) && (ctxt->inputNr > 1))
xmlPopInput(ctxt);
SHRINK;
if ((cons == ctxt->input->consumed) && (test == CUR_PTR)) {
xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR,
"detected an error in element content\n");
xmlHaltParser(ctxt);
break;
}
}
}
| 1,370 |
49,474 | 0 | static void __implement(u8 *report, unsigned offset, int n, u32 value)
{
unsigned int idx = offset / 8;
unsigned int size = offset + n;
unsigned int bit_shift = offset % 8;
int bits_to_set = 8 - bit_shift;
u8 bit_mask = 0xff << bit_shift;
while (n - bits_to_set >= 0) {
report[idx] &= ~bit_mask;
report[idx] |= value << bit_shift;
value >>= bits_to_set;
n -= bits_to_set;
bits_to_set = 8;
bit_mask = 0xff;
bit_shift = 0;
idx++;
}
/* last nibble */
if (n) {
if (size % 8)
bit_mask &= (1U << (size % 8)) - 1;
report[idx] &= ~bit_mask;
report[idx] |= (value << bit_shift) & bit_mask;
}
}
| 1,371 |
5,552 | 0 | g_proxy_list_new (DBusGProxy *first_proxy)
{
DBusGProxyList *list;
DBusGProxyPrivate *priv = DBUS_G_PROXY_GET_PRIVATE(first_proxy);
list = (void*) tristring_alloc_from_strings (G_STRUCT_OFFSET (DBusGProxyList, name),
priv->name,
priv->path,
priv->interface);
list->proxies = NULL;
return list;
}
| 1,372 |
170,309 | 0 | bool UsbChooserContext::HasDevicePermission(
const GURL& requesting_origin,
const GURL& embedding_origin,
scoped_refptr<const device::UsbDevice> device) {
if (!device)
return false;
device::mojom::UsbDeviceInfoPtr device_info =
device::mojom::UsbDeviceInfo::From(*device);
DCHECK(device_info);
return HasDevicePermission(requesting_origin, embedding_origin, *device_info);
}
| 1,373 |
187,288 | 1 | NetworkThrottleManagerImpl::NetworkThrottleManagerImpl()
: lifetime_median_estimate_(PercentileEstimator::kMedianPercentile,
kInitialMedianInMs),
outstanding_recomputation_timer_(
base::MakeUnique<base::Timer>(false /* retain_user_task */,
false /* is_repeating */)),
tick_clock_(new base::DefaultTickClock()),
weak_ptr_factory_(this) {}
| 1,374 |
170,204 | 0 | void DownloadAndVerifyFile(Browser* browser,
const base::FilePath& dir,
const base::FilePath& file) {
net::EmbeddedTestServer embedded_test_server;
base::FilePath test_data_directory;
GetTestDataDirectory(&test_data_directory);
embedded_test_server.ServeFilesFromDirectory(test_data_directory);
ASSERT_TRUE(embedded_test_server.Start());
content::DownloadManager* download_manager =
content::BrowserContext::GetDownloadManager(browser->profile());
content::DownloadTestObserverTerminal observer(
download_manager, 1,
content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL);
GURL url(embedded_test_server.GetURL("/" + file.MaybeAsASCII()));
base::FilePath downloaded = dir.Append(file);
EXPECT_FALSE(base::PathExists(downloaded));
ui_test_utils::NavigateToURL(browser, url);
observer.WaitForFinished();
EXPECT_EQ(1u,
observer.NumDownloadsSeenInState(download::DownloadItem::COMPLETE));
EXPECT_TRUE(base::PathExists(downloaded));
base::FileEnumerator enumerator(dir, false, base::FileEnumerator::FILES);
EXPECT_EQ(file, enumerator.Next().BaseName());
EXPECT_EQ(base::FilePath(), enumerator.Next());
}
| 1,375 |
55,434 | 0 | PHP_FUNCTION(escapeshellarg)
{
char *argument;
size_t argument_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &argument, &argument_len) == FAILURE) {
return;
}
if (argument) {
RETVAL_STR(php_escape_shell_arg(argument));
}
}
| 1,376 |
167,791 | 0 | void WebRuntimeFeatures::EnableWebGPU(bool enable) {
RuntimeEnabledFeatures::SetWebGPUEnabled(enable);
}
| 1,377 |
4,260 | 0 | PHP_FUNCTION(time_nanosleep)
{
long tv_sec, tv_nsec;
struct timespec php_req, php_rem;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &tv_sec, &tv_nsec) == FAILURE) {
return;
}
if (tv_sec < 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The seconds value must be greater than 0");
RETURN_FALSE;
}
if (tv_nsec < 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The nanoseconds value must be greater than 0");
RETURN_FALSE;
}
php_req.tv_sec = (time_t) tv_sec;
php_req.tv_nsec = tv_nsec;
if (!nanosleep(&php_req, &php_rem)) {
RETURN_TRUE;
} else if (errno == EINTR) {
array_init(return_value);
add_assoc_long_ex(return_value, "seconds", sizeof("seconds"), php_rem.tv_sec);
add_assoc_long_ex(return_value, "nanoseconds", sizeof("nanoseconds"), php_rem.tv_nsec);
return;
} else if (errno == EINVAL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "nanoseconds was not in the range 0 to 999 999 999 or seconds was negative");
}
RETURN_FALSE;
}
| 1,378 |
61,451 | 0 | static int mov_read_pasp(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
const int num = avio_rb32(pb);
const int den = avio_rb32(pb);
AVStream *st;
if (c->fc->nb_streams < 1)
return 0;
st = c->fc->streams[c->fc->nb_streams-1];
if ((st->sample_aspect_ratio.den != 1 || st->sample_aspect_ratio.num) && // default
(den != st->sample_aspect_ratio.den || num != st->sample_aspect_ratio.num)) {
av_log(c->fc, AV_LOG_WARNING,
"sample aspect ratio already set to %d:%d, ignoring 'pasp' atom (%d:%d)\n",
st->sample_aspect_ratio.num, st->sample_aspect_ratio.den,
num, den);
} else if (den != 0) {
av_reduce(&st->sample_aspect_ratio.num, &st->sample_aspect_ratio.den,
num, den, 32767);
}
return 0;
}
| 1,379 |
112,316 | 0 | net::Error CallbackAndReturn(
const DownloadResourceHandler::OnStartedCallback& started_cb,
net::Error net_error) {
if (started_cb.is_null())
return net_error;
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
base::Bind(started_cb, DownloadId::Invalid(), net_error));
return net_error;
}
| 1,380 |
154,718 | 0 | error::Error GLES2DecoderPassthroughImpl::DoGetUniformLocation(
GLuint program,
const char* name,
GLint* location) {
*location = api()->glGetUniformLocationFn(
GetProgramServiceID(program, resources_), name);
return error::kNoError;
}
| 1,381 |
72,088 | 0 | _kill_all_active_steps(uint32_t jobid, int sig, bool batch)
{
List steps;
ListIterator i;
step_loc_t *stepd;
int step_cnt = 0;
int fd;
steps = stepd_available(conf->spooldir, conf->node_name);
i = list_iterator_create(steps);
while ((stepd = list_next(i))) {
if (stepd->jobid != jobid) {
/* multiple jobs expected on shared nodes */
debug3("Step from other job: jobid=%u (this jobid=%u)",
stepd->jobid, jobid);
continue;
}
if ((stepd->stepid == SLURM_BATCH_SCRIPT) && (!batch))
continue;
step_cnt++;
fd = stepd_connect(stepd->directory, stepd->nodename,
stepd->jobid, stepd->stepid,
&stepd->protocol_version);
if (fd == -1) {
debug3("Unable to connect to step %u.%u",
stepd->jobid, stepd->stepid);
continue;
}
debug2("container signal %d to job %u.%u",
sig, jobid, stepd->stepid);
if (stepd_signal_container(
fd, stepd->protocol_version, sig) < 0)
debug("kill jobid=%u failed: %m", jobid);
close(fd);
}
list_iterator_destroy(i);
FREE_NULL_LIST(steps);
if (step_cnt == 0)
debug2("No steps in jobid %u to send signal %d", jobid, sig);
return step_cnt;
}
| 1,382 |
49,464 | 0 | static int show_timer(struct seq_file *m, void *v)
{
struct k_itimer *timer;
struct timers_private *tp = m->private;
int notify;
static const char * const nstr[] = {
[SIGEV_SIGNAL] = "signal",
[SIGEV_NONE] = "none",
[SIGEV_THREAD] = "thread",
};
timer = list_entry((struct list_head *)v, struct k_itimer, list);
notify = timer->it_sigev_notify;
seq_printf(m, "ID: %d\n", timer->it_id);
seq_printf(m, "signal: %d/%p\n",
timer->sigq->info.si_signo,
timer->sigq->info.si_value.sival_ptr);
seq_printf(m, "notify: %s/%s.%d\n",
nstr[notify & ~SIGEV_THREAD_ID],
(notify & SIGEV_THREAD_ID) ? "tid" : "pid",
pid_nr_ns(timer->it_pid, tp->ns));
seq_printf(m, "ClockID: %d\n", timer->it_clock);
return 0;
}
| 1,383 |
145,027 | 0 | bool CustomButton::ShouldEnterPushedState(const ui::Event& event) {
return IsTriggerableEvent(event);
}
| 1,384 |
53,430 | 0 | iperf_set_test_reverse(struct iperf_test *ipt, int reverse)
{
ipt->reverse = reverse;
if (ipt->reverse)
ipt->sender = ! ipt->sender;
check_sender_has_retransmits(ipt);
}
| 1,385 |
187,874 | 1 | long Segment::ParseCues(long long off, long long& pos, long& len) {
if (m_pCues)
return 0; // success
if (off < 0)
return -1;
long long total, avail;
const int status = m_pReader->Length(&total, &avail);
if (status < 0) // error
return status;
assert((total < 0) || (avail <= total));
pos = m_start + off;
if ((total < 0) || (pos >= total))
return 1; // don't bother parsing cues
const long long element_start = pos;
const long long segment_stop = (m_size < 0) ? -1 : m_start + m_size;
if ((pos + 1) > avail) {
len = 1;
return E_BUFFER_NOT_FULL;
}
long long result = GetUIntLength(m_pReader, pos, len);
if (result < 0) // error
return static_cast<long>(result);
if (result > 0) // underflow (weird)
{
len = 1;
return E_BUFFER_NOT_FULL;
}
if ((segment_stop >= 0) && ((pos + len) > segment_stop))
return E_FILE_FORMAT_INVALID;
if ((pos + len) > avail)
return E_BUFFER_NOT_FULL;
const long long idpos = pos;
const long long id = ReadUInt(m_pReader, idpos, len);
if (id != 0x0C53BB6B) // Cues ID
return E_FILE_FORMAT_INVALID;
pos += len; // consume ID
assert((segment_stop < 0) || (pos <= segment_stop));
// Read Size
if ((pos + 1) > avail) {
len = 1;
return E_BUFFER_NOT_FULL;
}
result = GetUIntLength(m_pReader, pos, len);
if (result < 0) // error
return static_cast<long>(result);
if (result > 0) // underflow (weird)
{
len = 1;
return E_BUFFER_NOT_FULL;
}
if ((segment_stop >= 0) && ((pos + len) > segment_stop))
return E_FILE_FORMAT_INVALID;
if ((pos + len) > avail)
return E_BUFFER_NOT_FULL;
const long long size = ReadUInt(m_pReader, pos, len);
if (size < 0) // error
return static_cast<long>(size);
if (size == 0) // weird, although technically not illegal
return 1; // done
pos += len; // consume length of size of element
assert((segment_stop < 0) || (pos <= segment_stop));
// Pos now points to start of payload
const long long element_stop = pos + size;
if ((segment_stop >= 0) && (element_stop > segment_stop))
return E_FILE_FORMAT_INVALID;
if ((total >= 0) && (element_stop > total))
return 1; // don't bother parsing anymore
len = static_cast<long>(size);
if (element_stop > avail)
return E_BUFFER_NOT_FULL;
const long long element_size = element_stop - element_start;
m_pCues =
new (std::nothrow) Cues(this, pos, size, element_start, element_size);
assert(m_pCues); // TODO
return 0; // success
}
| 1,386 |
8,450 | 0 | pvscsi_ring_init_data(PVSCSIRingInfo *m, PVSCSICmdDescSetupRings *ri)
{
int i;
uint32_t txr_len_log2, rxr_len_log2;
uint32_t req_ring_size, cmp_ring_size;
m->rs_pa = ri->ringsStatePPN << VMW_PAGE_SHIFT;
req_ring_size = ri->reqRingNumPages * PVSCSI_MAX_NUM_REQ_ENTRIES_PER_PAGE;
cmp_ring_size = ri->cmpRingNumPages * PVSCSI_MAX_NUM_CMP_ENTRIES_PER_PAGE;
txr_len_log2 = pvscsi_log2(req_ring_size - 1);
rxr_len_log2 = pvscsi_log2(cmp_ring_size - 1);
m->txr_len_mask = MASK(txr_len_log2);
m->rxr_len_mask = MASK(rxr_len_log2);
m->consumed_ptr = 0;
m->filled_cmp_ptr = 0;
for (i = 0; i < ri->reqRingNumPages; i++) {
m->req_ring_pages_pa[i] = ri->reqRingPPNs[i] << VMW_PAGE_SHIFT;
}
for (i = 0; i < ri->cmpRingNumPages; i++) {
m->cmp_ring_pages_pa[i] = ri->cmpRingPPNs[i] << VMW_PAGE_SHIFT;
}
RS_SET_FIELD(m, reqProdIdx, 0);
RS_SET_FIELD(m, reqConsIdx, 0);
RS_SET_FIELD(m, reqNumEntriesLog2, txr_len_log2);
RS_SET_FIELD(m, cmpProdIdx, 0);
RS_SET_FIELD(m, cmpConsIdx, 0);
RS_SET_FIELD(m, cmpNumEntriesLog2, rxr_len_log2);
trace_pvscsi_ring_init_data(txr_len_log2, rxr_len_log2);
/* Flush ring state page changes */
smp_wmb();
}
| 1,387 |
97,315 | 0 | static void startElementNsHandler(void* closure, const xmlChar* localname, const xmlChar* prefix, const xmlChar* uri, int nb_namespaces, const xmlChar** namespaces, int nb_attributes, int nb_defaulted, const xmlChar** libxmlAttributes)
{
if (hackAroundLibXMLEntityBug(closure))
return;
getTokenizer(closure)->startElementNs(localname, prefix, uri, nb_namespaces, namespaces, nb_attributes, nb_defaulted, libxmlAttributes);
}
| 1,388 |
95,632 | 0 | static void S_AL_BufferUseDefault(sfxHandle_t sfx)
{
if(sfx == default_sfx)
Com_Error(ERR_FATAL, "Can't load default sound effect %s", knownSfx[sfx].filename);
knownSfx[sfx].isDefault = qtrue;
knownSfx[sfx].buffer = knownSfx[default_sfx].buffer;
}
| 1,389 |
50,557 | 0 | static inline void ModulateHCL(const double percent_hue,
const double percent_chroma,const double percent_luma,double *red,
double *green,double *blue)
{
double
hue,
luma,
chroma;
/*
Increase or decrease color luma, chroma, or hue.
*/
ConvertRGBToHCL(*red,*green,*blue,&hue,&chroma,&luma);
hue+=0.5*(0.01*percent_hue-1.0);
while (hue < 0.0)
hue+=1.0;
while (hue > 1.0)
hue-=1.0;
chroma*=0.01*percent_chroma;
luma*=0.01*percent_luma;
ConvertHCLToRGB(hue,chroma,luma,red,green,blue);
}
| 1,390 |
108,387 | 0 | static int AddChannel(int val,
int adder) {
Fixed sum = static_cast<Fixed>(val) + static_cast<Fixed>(adder);
if (sum > max_value)
return max_value;
if (sum < min_value)
return min_value;
return static_cast<int>(sum);
}
| 1,391 |
101,398 | 0 | int64 MakeServerNodeForType(UserShare* share,
ModelType model_type) {
sync_pb::EntitySpecifics specifics;
syncable::AddDefaultExtensionValue(model_type, &specifics);
syncable::ScopedDirLookup dir(share->dir_manager.get(), share->name);
EXPECT_TRUE(dir.good());
syncable::WriteTransaction trans(FROM_HERE, syncable::UNITTEST, dir);
std::string type_tag = syncable::ModelTypeToRootTag(model_type);
syncable::Id node_id = syncable::Id::CreateFromServerId(type_tag);
syncable::MutableEntry entry(&trans, syncable::CREATE_NEW_UPDATE_ITEM,
node_id);
EXPECT_TRUE(entry.good());
entry.Put(syncable::BASE_VERSION, 1);
entry.Put(syncable::SERVER_VERSION, 1);
entry.Put(syncable::IS_UNAPPLIED_UPDATE, false);
entry.Put(syncable::SERVER_PARENT_ID, syncable::GetNullId());
entry.Put(syncable::SERVER_IS_DIR, true);
entry.Put(syncable::IS_DIR, true);
entry.Put(syncable::SERVER_SPECIFICS, specifics);
entry.Put(syncable::UNIQUE_SERVER_TAG, type_tag);
entry.Put(syncable::NON_UNIQUE_NAME, type_tag);
entry.Put(syncable::IS_DEL, false);
entry.Put(syncable::SPECIFICS, specifics);
return entry.Get(syncable::META_HANDLE);
}
| 1,392 |
188,265 | 1 | Chapters::Chapters(
Segment* pSegment,
long long payload_start,
long long payload_size,
long long element_start,
long long element_size) :
m_pSegment(pSegment),
m_start(payload_start),
m_size(payload_size),
m_element_start(element_start),
m_element_size(element_size),
m_editions(NULL),
m_editions_size(0),
m_editions_count(0)
{
}
| 1,393 |
187,820 | 1 | status_t BnOMX::onTransact(
uint32_t code, const Parcel &data, Parcel *reply, uint32_t flags) {
switch (code) {
case LIVES_LOCALLY:
{
CHECK_OMX_INTERFACE(IOMX, data, reply);
node_id node = (node_id)data.readInt32();
pid_t pid = (pid_t)data.readInt32();
reply->writeInt32(livesLocally(node, pid));
return OK;
}
case LIST_NODES:
{
CHECK_OMX_INTERFACE(IOMX, data, reply);
List<ComponentInfo> list;
listNodes(&list);
reply->writeInt32(list.size());
for (List<ComponentInfo>::iterator it = list.begin();
it != list.end(); ++it) {
ComponentInfo &cur = *it;
reply->writeString8(cur.mName);
reply->writeInt32(cur.mRoles.size());
for (List<String8>::iterator role_it = cur.mRoles.begin();
role_it != cur.mRoles.end(); ++role_it) {
reply->writeString8(*role_it);
}
}
return NO_ERROR;
}
case ALLOCATE_NODE:
{
CHECK_OMX_INTERFACE(IOMX, data, reply);
const char *name = data.readCString();
sp<IOMXObserver> observer =
interface_cast<IOMXObserver>(data.readStrongBinder());
node_id node;
status_t err = allocateNode(name, observer, &node);
reply->writeInt32(err);
if (err == OK) {
reply->writeInt32((int32_t)node);
}
return NO_ERROR;
}
case FREE_NODE:
{
CHECK_OMX_INTERFACE(IOMX, data, reply);
node_id node = (node_id)data.readInt32();
reply->writeInt32(freeNode(node));
return NO_ERROR;
}
case SEND_COMMAND:
{
CHECK_OMX_INTERFACE(IOMX, data, reply);
node_id node = (node_id)data.readInt32();
OMX_COMMANDTYPE cmd =
static_cast<OMX_COMMANDTYPE>(data.readInt32());
OMX_S32 param = data.readInt32();
reply->writeInt32(sendCommand(node, cmd, param));
return NO_ERROR;
}
case GET_PARAMETER:
case SET_PARAMETER:
case GET_CONFIG:
case SET_CONFIG:
case SET_INTERNAL_OPTION:
{
CHECK_OMX_INTERFACE(IOMX, data, reply);
node_id node = (node_id)data.readInt32();
OMX_INDEXTYPE index = static_cast<OMX_INDEXTYPE>(data.readInt32());
size_t size = data.readInt64();
status_t err = NOT_ENOUGH_DATA;
void *params = NULL;
size_t pageSize = 0;
size_t allocSize = 0;
if (code != SET_INTERNAL_OPTION && size < 8) {
// we expect the structure to contain at least the size and
// version, 8 bytes total
ALOGE("b/27207275 (%zu)", size);
android_errorWriteLog(0x534e4554, "27207275");
} else {
err = NO_MEMORY;
pageSize = (size_t) sysconf(_SC_PAGE_SIZE);
if (size > SIZE_MAX - (pageSize * 2)) {
ALOGE("requested param size too big");
} else {
allocSize = (size + pageSize * 2) & ~(pageSize - 1);
params = mmap(NULL, allocSize, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, -1 /* fd */, 0 /* offset */);
}
if (params != MAP_FAILED) {
err = data.read(params, size);
if (err != OK) {
android_errorWriteLog(0x534e4554, "26914474");
} else {
err = NOT_ENOUGH_DATA;
OMX_U32 declaredSize = *(OMX_U32*)params;
if (code != SET_INTERNAL_OPTION && declaredSize > size) {
// the buffer says it's bigger than it actually is
ALOGE("b/27207275 (%u/%zu)", declaredSize, size);
android_errorWriteLog(0x534e4554, "27207275");
} else {
// mark the last page as inaccessible, to avoid exploitation
// of codecs that access past the end of the allocation because
// they didn't check the size
mprotect((char*)params + allocSize - pageSize, pageSize, PROT_NONE);
switch (code) {
case GET_PARAMETER:
err = getParameter(node, index, params, size);
break;
case SET_PARAMETER:
err = setParameter(node, index, params, size);
break;
case GET_CONFIG:
err = getConfig(node, index, params, size);
break;
case SET_CONFIG:
err = setConfig(node, index, params, size);
break;
case SET_INTERNAL_OPTION:
{
InternalOptionType type =
(InternalOptionType)data.readInt32();
err = setInternalOption(node, index, type, params, size);
break;
}
default:
TRESPASS();
}
}
}
} else {
ALOGE("couldn't map: %s", strerror(errno));
}
}
reply->writeInt32(err);
if ((code == GET_PARAMETER || code == GET_CONFIG) && err == OK) {
reply->write(params, size);
}
if (params) {
munmap(params, allocSize);
}
params = NULL;
return NO_ERROR;
}
case GET_STATE:
{
CHECK_OMX_INTERFACE(IOMX, data, reply);
node_id node = (node_id)data.readInt32();
OMX_STATETYPE state = OMX_StateInvalid;
status_t err = getState(node, &state);
reply->writeInt32(state);
reply->writeInt32(err);
return NO_ERROR;
}
case ENABLE_GRAPHIC_BUFFERS:
{
CHECK_OMX_INTERFACE(IOMX, data, reply);
node_id node = (node_id)data.readInt32();
OMX_U32 port_index = data.readInt32();
OMX_BOOL enable = (OMX_BOOL)data.readInt32();
status_t err = enableGraphicBuffers(node, port_index, enable);
reply->writeInt32(err);
return NO_ERROR;
}
case GET_GRAPHIC_BUFFER_USAGE:
{
CHECK_OMX_INTERFACE(IOMX, data, reply);
node_id node = (node_id)data.readInt32();
OMX_U32 port_index = data.readInt32();
OMX_U32 usage = 0;
status_t err = getGraphicBufferUsage(node, port_index, &usage);
reply->writeInt32(err);
reply->writeInt32(usage);
return NO_ERROR;
}
case USE_BUFFER:
{
CHECK_OMX_INTERFACE(IOMX, data, reply);
node_id node = (node_id)data.readInt32();
OMX_U32 port_index = data.readInt32();
sp<IMemory> params =
interface_cast<IMemory>(data.readStrongBinder());
OMX_U32 allottedSize = data.readInt32();
buffer_id buffer;
status_t err = useBuffer(node, port_index, params, &buffer, allottedSize);
reply->writeInt32(err);
if (err == OK) {
reply->writeInt32((int32_t)buffer);
}
return NO_ERROR;
}
case USE_GRAPHIC_BUFFER:
{
CHECK_OMX_INTERFACE(IOMX, data, reply);
node_id node = (node_id)data.readInt32();
OMX_U32 port_index = data.readInt32();
sp<GraphicBuffer> graphicBuffer = new GraphicBuffer();
data.read(*graphicBuffer);
buffer_id buffer;
status_t err = useGraphicBuffer(
node, port_index, graphicBuffer, &buffer);
reply->writeInt32(err);
if (err == OK) {
reply->writeInt32((int32_t)buffer);
}
return NO_ERROR;
}
case UPDATE_GRAPHIC_BUFFER_IN_META:
{
CHECK_OMX_INTERFACE(IOMX, data, reply);
node_id node = (node_id)data.readInt32();
OMX_U32 port_index = data.readInt32();
sp<GraphicBuffer> graphicBuffer = new GraphicBuffer();
data.read(*graphicBuffer);
buffer_id buffer = (buffer_id)data.readInt32();
status_t err = updateGraphicBufferInMeta(
node, port_index, graphicBuffer, buffer);
reply->writeInt32(err);
return NO_ERROR;
}
case CREATE_INPUT_SURFACE:
{
CHECK_OMX_INTERFACE(IOMX, data, reply);
node_id node = (node_id)data.readInt32();
OMX_U32 port_index = data.readInt32();
sp<IGraphicBufferProducer> bufferProducer;
MetadataBufferType type = kMetadataBufferTypeInvalid;
status_t err = createInputSurface(node, port_index, &bufferProducer, &type);
if ((err != OK) && (type == kMetadataBufferTypeInvalid)) {
android_errorWriteLog(0x534e4554, "26324358");
}
reply->writeInt32(type);
reply->writeInt32(err);
if (err == OK) {
reply->writeStrongBinder(IInterface::asBinder(bufferProducer));
}
return NO_ERROR;
}
case CREATE_PERSISTENT_INPUT_SURFACE:
{
CHECK_OMX_INTERFACE(IOMX, data, reply);
sp<IGraphicBufferProducer> bufferProducer;
sp<IGraphicBufferConsumer> bufferConsumer;
status_t err = createPersistentInputSurface(
&bufferProducer, &bufferConsumer);
reply->writeInt32(err);
if (err == OK) {
reply->writeStrongBinder(IInterface::asBinder(bufferProducer));
reply->writeStrongBinder(IInterface::asBinder(bufferConsumer));
}
return NO_ERROR;
}
case SET_INPUT_SURFACE:
{
CHECK_OMX_INTERFACE(IOMX, data, reply);
node_id node = (node_id)data.readInt32();
OMX_U32 port_index = data.readInt32();
sp<IGraphicBufferConsumer> bufferConsumer =
interface_cast<IGraphicBufferConsumer>(data.readStrongBinder());
MetadataBufferType type = kMetadataBufferTypeInvalid;
status_t err = setInputSurface(node, port_index, bufferConsumer, &type);
if ((err != OK) && (type == kMetadataBufferTypeInvalid)) {
android_errorWriteLog(0x534e4554, "26324358");
}
reply->writeInt32(type);
reply->writeInt32(err);
return NO_ERROR;
}
case SIGNAL_END_OF_INPUT_STREAM:
{
CHECK_OMX_INTERFACE(IOMX, data, reply);
node_id node = (node_id)data.readInt32();
status_t err = signalEndOfInputStream(node);
reply->writeInt32(err);
return NO_ERROR;
}
case STORE_META_DATA_IN_BUFFERS:
{
CHECK_OMX_INTERFACE(IOMX, data, reply);
node_id node = (node_id)data.readInt32();
OMX_U32 port_index = data.readInt32();
OMX_BOOL enable = (OMX_BOOL)data.readInt32();
MetadataBufferType type = kMetadataBufferTypeInvalid;
status_t err = storeMetaDataInBuffers(node, port_index, enable, &type);
reply->writeInt32(type);
reply->writeInt32(err);
return NO_ERROR;
}
case PREPARE_FOR_ADAPTIVE_PLAYBACK:
{
CHECK_OMX_INTERFACE(IOMX, data, reply);
node_id node = (node_id)data.readInt32();
OMX_U32 port_index = data.readInt32();
OMX_BOOL enable = (OMX_BOOL)data.readInt32();
OMX_U32 max_width = data.readInt32();
OMX_U32 max_height = data.readInt32();
status_t err = prepareForAdaptivePlayback(
node, port_index, enable, max_width, max_height);
reply->writeInt32(err);
return NO_ERROR;
}
case CONFIGURE_VIDEO_TUNNEL_MODE:
{
CHECK_OMX_INTERFACE(IOMX, data, reply);
node_id node = (node_id)data.readInt32();
OMX_U32 port_index = data.readInt32();
OMX_BOOL tunneled = (OMX_BOOL)data.readInt32();
OMX_U32 audio_hw_sync = data.readInt32();
native_handle_t *sideband_handle = NULL;
status_t err = configureVideoTunnelMode(
node, port_index, tunneled, audio_hw_sync, &sideband_handle);
reply->writeInt32(err);
if(err == OK){
reply->writeNativeHandle(sideband_handle);
}
return NO_ERROR;
}
case ALLOC_BUFFER:
{
CHECK_OMX_INTERFACE(IOMX, data, reply);
node_id node = (node_id)data.readInt32();
OMX_U32 port_index = data.readInt32();
if (!isSecure(node) || port_index != 0 /* kPortIndexInput */) {
ALOGE("b/24310423");
reply->writeInt32(INVALID_OPERATION);
return NO_ERROR;
}
size_t size = data.readInt64();
buffer_id buffer;
void *buffer_data;
status_t err = allocateBuffer(
node, port_index, size, &buffer, &buffer_data);
reply->writeInt32(err);
if (err == OK) {
reply->writeInt32((int32_t)buffer);
reply->writeInt64((uintptr_t)buffer_data);
}
return NO_ERROR;
}
case ALLOC_BUFFER_WITH_BACKUP:
{
CHECK_OMX_INTERFACE(IOMX, data, reply);
node_id node = (node_id)data.readInt32();
OMX_U32 port_index = data.readInt32();
sp<IMemory> params =
interface_cast<IMemory>(data.readStrongBinder());
OMX_U32 allottedSize = data.readInt32();
buffer_id buffer;
status_t err = allocateBufferWithBackup(
node, port_index, params, &buffer, allottedSize);
reply->writeInt32(err);
if (err == OK) {
reply->writeInt32((int32_t)buffer);
}
return NO_ERROR;
}
case FREE_BUFFER:
{
CHECK_OMX_INTERFACE(IOMX, data, reply);
node_id node = (node_id)data.readInt32();
OMX_U32 port_index = data.readInt32();
buffer_id buffer = (buffer_id)data.readInt32();
reply->writeInt32(freeBuffer(node, port_index, buffer));
return NO_ERROR;
}
case FILL_BUFFER:
{
CHECK_OMX_INTERFACE(IOMX, data, reply);
node_id node = (node_id)data.readInt32();
buffer_id buffer = (buffer_id)data.readInt32();
bool haveFence = data.readInt32();
int fenceFd = haveFence ? ::dup(data.readFileDescriptor()) : -1;
reply->writeInt32(fillBuffer(node, buffer, fenceFd));
return NO_ERROR;
}
case EMPTY_BUFFER:
{
CHECK_OMX_INTERFACE(IOMX, data, reply);
node_id node = (node_id)data.readInt32();
buffer_id buffer = (buffer_id)data.readInt32();
OMX_U32 range_offset = data.readInt32();
OMX_U32 range_length = data.readInt32();
OMX_U32 flags = data.readInt32();
OMX_TICKS timestamp = data.readInt64();
bool haveFence = data.readInt32();
int fenceFd = haveFence ? ::dup(data.readFileDescriptor()) : -1;
reply->writeInt32(emptyBuffer(
node, buffer, range_offset, range_length, flags, timestamp, fenceFd));
return NO_ERROR;
}
case GET_EXTENSION_INDEX:
{
CHECK_OMX_INTERFACE(IOMX, data, reply);
node_id node = (node_id)data.readInt32();
const char *parameter_name = data.readCString();
OMX_INDEXTYPE index;
status_t err = getExtensionIndex(node, parameter_name, &index);
reply->writeInt32(err);
if (err == OK) {
reply->writeInt32(index);
}
return OK;
}
default:
return BBinder::onTransact(code, data, reply, flags);
}
}
| 1,394 |
4,676 | 0 | static void add_assoc_name_entry(zval * val, char * key, X509_NAME * name, int shortname TSRMLS_DC) /* {{{ */
{
zval **data;
zval *subitem, *subentries;
int i;
char *sname;
int nid;
X509_NAME_ENTRY * ne;
ASN1_STRING * str = NULL;
ASN1_OBJECT * obj;
if (key != NULL) {
MAKE_STD_ZVAL(subitem);
array_init(subitem);
} else {
subitem = val;
}
for (i = 0; i < X509_NAME_entry_count(name); i++) {
unsigned char *to_add;
int to_add_len = 0;
ne = X509_NAME_get_entry(name, i);
obj = X509_NAME_ENTRY_get_object(ne);
nid = OBJ_obj2nid(obj);
if (shortname) {
sname = (char *) OBJ_nid2sn(nid);
} else {
sname = (char *) OBJ_nid2ln(nid);
}
str = X509_NAME_ENTRY_get_data(ne);
if (ASN1_STRING_type(str) != V_ASN1_UTF8STRING) {
to_add_len = ASN1_STRING_to_UTF8(&to_add, str);
} else {
to_add = ASN1_STRING_data(str);
to_add_len = ASN1_STRING_length(str);
}
if (to_add_len != -1) {
if (zend_hash_find(Z_ARRVAL_P(subitem), sname, strlen(sname)+1, (void**)&data) == SUCCESS) {
if (Z_TYPE_PP(data) == IS_ARRAY) {
subentries = *data;
add_next_index_stringl(subentries, (char *)to_add, to_add_len, 1);
} else if (Z_TYPE_PP(data) == IS_STRING) {
MAKE_STD_ZVAL(subentries);
array_init(subentries);
add_next_index_stringl(subentries, Z_STRVAL_PP(data), Z_STRLEN_PP(data), 1);
add_next_index_stringl(subentries, (char *)to_add, to_add_len, 1);
zend_hash_update(Z_ARRVAL_P(subitem), sname, strlen(sname)+1, &subentries, sizeof(zval*), NULL);
}
} else {
add_assoc_stringl(subitem, sname, (char *)to_add, to_add_len, 1);
}
}
}
if (key != NULL) {
zend_hash_update(HASH_OF(val), key, strlen(key) + 1, (void *)&subitem, sizeof(subitem), NULL);
}
}
/* }}} */
| 1,395 |
39,408 | 0 | static void process_fd_request(void)
{
cont = &rw_cont;
schedule_bh(redo_fd_request);
}
| 1,396 |
35,652 | 0 | file_strncmp(const char *s1, const char *s2, size_t len, uint32_t flags)
{
/*
* Convert the source args to unsigned here so that (1) the
* compare will be unsigned as it is in strncmp() and (2) so
* the ctype functions will work correctly without extra
* casting.
*/
const unsigned char *a = (const unsigned char *)s1;
const unsigned char *b = (const unsigned char *)s2;
uint64_t v;
/*
* What we want here is v = strncmp(s1, s2, len),
* but ignoring any nulls.
*/
v = 0;
if (0L == flags) { /* normal string: do it fast */
while (len-- > 0)
if ((v = *b++ - *a++) != '\0')
break;
}
else { /* combine the others */
while (len-- > 0) {
if ((flags & STRING_IGNORE_LOWERCASE) &&
islower(*a)) {
if ((v = tolower(*b++) - *a++) != '\0')
break;
}
else if ((flags & STRING_IGNORE_UPPERCASE) &&
isupper(*a)) {
if ((v = toupper(*b++) - *a++) != '\0')
break;
}
else if ((flags & STRING_COMPACT_WHITESPACE) &&
isspace(*a)) {
a++;
if (isspace(*b++)) {
if (!isspace(*a))
while (isspace(*b))
b++;
}
else {
v = 1;
break;
}
}
else if ((flags & STRING_COMPACT_OPTIONAL_WHITESPACE) &&
isspace(*a)) {
a++;
while (isspace(*b))
b++;
}
else {
if ((v = *b++ - *a++) != '\0')
break;
}
}
}
return v;
}
| 1,397 |
58,236 | 0 | static int tg_cfs_schedulable_down(struct task_group *tg, void *data)
{
struct cfs_schedulable_data *d = data;
struct cfs_bandwidth *cfs_b = &tg->cfs_bandwidth;
s64 quota = 0, parent_quota = -1;
if (!tg->parent) {
quota = RUNTIME_INF;
} else {
struct cfs_bandwidth *parent_b = &tg->parent->cfs_bandwidth;
quota = normalize_cfs_quota(tg, d);
parent_quota = parent_b->hierarchal_quota;
/*
* ensure max(child_quota) <= parent_quota, inherit when no
* limit is set
*/
if (quota == RUNTIME_INF)
quota = parent_quota;
else if (parent_quota != RUNTIME_INF && quota > parent_quota)
return -EINVAL;
}
cfs_b->hierarchal_quota = quota;
return 0;
}
| 1,398 |
19,687 | 0 | static int hstate_next_node_to_alloc(struct hstate *h,
nodemask_t *nodes_allowed)
{
int nid;
VM_BUG_ON(!nodes_allowed);
nid = get_valid_node_allowed(h->next_nid_to_alloc, nodes_allowed);
h->next_nid_to_alloc = next_node_allowed(nid, nodes_allowed);
return nid;
}
| 1,399 |
Subsets and Splits