unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
|---|---|---|---|
91,093
| 0
|
int peernet2id_alloc(struct net *net, struct net *peer)
{
bool alloc = false, alive = false;
int id;
if (refcount_read(&net->count) == 0)
return NETNSA_NSID_NOT_ASSIGNED;
spin_lock_bh(&net->nsid_lock);
/*
* When peer is obtained from RCU lists, we may race with
* its cleanup. Check whether it's alive, and this guarantees
* we never hash a peer back to net->netns_ids, after it has
* just been idr_remove()'d from there in cleanup_net().
*/
if (maybe_get_net(peer))
alive = alloc = true;
id = __peernet2id_alloc(net, peer, &alloc);
spin_unlock_bh(&net->nsid_lock);
if (alloc && id >= 0)
rtnl_net_notifyid(net, RTM_NEWNSID, id);
if (alive)
put_net(peer);
return id;
}
| 10,900
|
144,896
| 0
|
void EmbedCallback(bool result) {
if (!result)
DVLOG(1) << "embed failed";
}
| 10,901
|
141,816
| 0
|
int64_t MetricsLog::GetCurrentTime() {
return (base::TimeTicks::Now() - base::TimeTicks()).InSeconds();
}
| 10,902
|
163,591
| 0
|
htmlDoRead(htmlParserCtxtPtr ctxt, const char *URL, const char *encoding,
int options, int reuse)
{
htmlDocPtr ret;
htmlCtxtUseOptions(ctxt, options);
ctxt->html = 1;
if (encoding != NULL) {
xmlCharEncodingHandlerPtr hdlr;
hdlr = xmlFindCharEncodingHandler(encoding);
if (hdlr != NULL) {
xmlSwitchToEncoding(ctxt, hdlr);
if (ctxt->input->encoding != NULL)
xmlFree((xmlChar *) ctxt->input->encoding);
ctxt->input->encoding = xmlStrdup((xmlChar *)encoding);
}
}
if ((URL != NULL) && (ctxt->input != NULL) &&
(ctxt->input->filename == NULL))
ctxt->input->filename = (char *) xmlStrdup((const xmlChar *) URL);
htmlParseDocument(ctxt);
ret = ctxt->myDoc;
ctxt->myDoc = NULL;
if (!reuse) {
if ((ctxt->dictNames) &&
(ret != NULL) &&
(ret->dict == ctxt->dict))
ctxt->dict = NULL;
xmlFreeParserCtxt(ctxt);
}
return (ret);
}
| 10,903
|
187,648
| 1
|
image_transform_png_set_expand_16_add(image_transform *this,
PNG_CONST image_transform **that, png_byte colour_type, png_byte bit_depth)
{
UNUSED(colour_type)
this->next = *that;
*that = this;
/* expand_16 does something unless the bit depth is already 16. */
return bit_depth < 16;
}
| 10,904
|
81,893
| 0
|
int wc_ecc_get_oid(word32 oidSum, const byte** oid, word32* oidSz)
{
int x;
if (oidSum == 0) {
return BAD_FUNC_ARG;
}
/* find matching OID sum (based on encoded value) */
for (x = 0; ecc_sets[x].size != 0; x++) {
if (ecc_sets[x].oidSum == oidSum) {
int ret = 0;
#ifdef HAVE_OID_ENCODING
/* check cache */
oid_cache_t* o = &ecc_oid_cache[x];
if (o->oidSz == 0) {
o->oidSz = sizeof(o->oid);
ret = EncodeObjectId(ecc_sets[x].oid, ecc_sets[x].oidSz,
o->oid, &o->oidSz);
}
if (oidSz) {
*oidSz = o->oidSz;
}
if (oid) {
*oid = o->oid;
}
#else
if (oidSz) {
*oidSz = ecc_sets[x].oidSz;
}
if (oid) {
*oid = ecc_sets[x].oid;
}
#endif
/* on success return curve id */
if (ret == 0) {
ret = ecc_sets[x].id;
}
return ret;
}
}
return NOT_COMPILED_IN;
}
| 10,905
|
134,962
| 0
|
bool mounted() const { return drivefs_has_mounted_ && !mount_path_.empty(); }
| 10,906
|
19,879
| 0
|
static int nfs4_call_sync_sequence(struct rpc_clnt *clnt,
struct nfs_server *server,
struct rpc_message *msg,
struct nfs4_sequence_args *args,
struct nfs4_sequence_res *res,
int privileged)
{
int ret;
struct rpc_task *task;
struct nfs41_call_sync_data data = {
.seq_server = server,
.seq_args = args,
.seq_res = res,
};
struct rpc_task_setup task_setup = {
.rpc_client = clnt,
.rpc_message = msg,
.callback_ops = &nfs41_call_sync_ops,
.callback_data = &data
};
if (privileged)
task_setup.callback_ops = &nfs41_call_priv_sync_ops;
task = rpc_run_task(&task_setup);
if (IS_ERR(task))
ret = PTR_ERR(task);
else {
ret = task->tk_status;
rpc_put_task(task);
}
return ret;
}
| 10,907
|
60,639
| 0
|
int crypto_register_rngs(struct rng_alg *algs, int count)
{
int i, ret;
for (i = 0; i < count; i++) {
ret = crypto_register_rng(algs + i);
if (ret)
goto err;
}
return 0;
err:
for (--i; i >= 0; --i)
crypto_unregister_rng(algs + i);
return ret;
}
| 10,908
|
154,702
| 0
|
error::Error GLES2DecoderPassthroughImpl::DoGetRequestableExtensionsCHROMIUM(
const char** extensions) {
*extensions = reinterpret_cast<const char*>(
api()->glGetStringFn(GL_REQUESTABLE_EXTENSIONS_ANGLE));
return error::kNoError;
}
| 10,909
|
104,191
| 0
|
bool GLES2DecoderImpl::SetCapabilityState(GLenum cap, bool enabled) {
switch (cap) {
case GL_SCISSOR_TEST:
enable_scissor_test_ = enabled;
return true;
case GL_DEPTH_TEST: {
if (enable_depth_test_ != enabled) {
enable_depth_test_ = enabled;
state_dirty_ = true;
}
return false;
}
case GL_STENCIL_TEST:
if (enable_stencil_test_ != enabled) {
enable_stencil_test_ = enabled;
state_dirty_ = true;
}
return false;
default:
return true;
}
}
| 10,910
|
130,204
| 0
|
String base64Encode(const char* data, unsigned length, Base64EncodePolicy policy)
{
Vector<char> result;
base64Encode(data, length, result, policy);
return String(result.data(), result.size());
}
| 10,911
|
31,282
| 0
|
static int blkcipher_walk_next(struct blkcipher_desc *desc,
struct blkcipher_walk *walk)
{
struct crypto_blkcipher *tfm = desc->tfm;
unsigned int alignmask = crypto_blkcipher_alignmask(tfm);
unsigned int bsize;
unsigned int n;
int err;
n = walk->total;
if (unlikely(n < crypto_blkcipher_blocksize(tfm))) {
desc->flags |= CRYPTO_TFM_RES_BAD_BLOCK_LEN;
return blkcipher_walk_done(desc, walk, -EINVAL);
}
walk->flags &= ~(BLKCIPHER_WALK_SLOW | BLKCIPHER_WALK_COPY |
BLKCIPHER_WALK_DIFF);
if (!scatterwalk_aligned(&walk->in, alignmask) ||
!scatterwalk_aligned(&walk->out, alignmask)) {
walk->flags |= BLKCIPHER_WALK_COPY;
if (!walk->page) {
walk->page = (void *)__get_free_page(GFP_ATOMIC);
if (!walk->page)
n = 0;
}
}
bsize = min(walk->blocksize, n);
n = scatterwalk_clamp(&walk->in, n);
n = scatterwalk_clamp(&walk->out, n);
if (unlikely(n < bsize)) {
err = blkcipher_next_slow(desc, walk, bsize, alignmask);
goto set_phys_lowmem;
}
walk->nbytes = n;
if (walk->flags & BLKCIPHER_WALK_COPY) {
err = blkcipher_next_copy(walk);
goto set_phys_lowmem;
}
return blkcipher_next_fast(desc, walk);
set_phys_lowmem:
if (walk->flags & BLKCIPHER_WALK_PHYS) {
walk->src.phys.page = virt_to_page(walk->src.virt.addr);
walk->dst.phys.page = virt_to_page(walk->dst.virt.addr);
walk->src.phys.offset &= PAGE_SIZE - 1;
walk->dst.phys.offset &= PAGE_SIZE - 1;
}
return err;
}
| 10,912
|
6,985
| 0
|
tt_face_get_name( TT_Face face,
FT_UShort nameid,
FT_String** name )
{
FT_Memory memory = face->root.memory;
FT_Error error = FT_Err_Ok;
FT_String* result = NULL;
FT_UShort n;
TT_NameEntryRec* rec;
FT_Int found_apple = -1;
FT_Int found_apple_roman = -1;
FT_Int found_apple_english = -1;
FT_Int found_win = -1;
FT_Int found_unicode = -1;
FT_Bool is_english = 0;
TT_NameEntry_ConvertFunc convert;
FT_ASSERT( name );
rec = face->name_table.names;
for ( n = 0; n < face->num_names; n++, rec++ )
{
/* According to the OpenType 1.3 specification, only Microsoft or */
/* Apple platform IDs might be used in the `name' table. The */
/* `Unicode' platform is reserved for the `cmap' table, and the */
/* `ISO' one is deprecated. */
/* */
/* However, the Apple TrueType specification doesn't say the same */
/* thing and goes to suggest that all Unicode `name' table entries */
/* should be coded in UTF-16 (in big-endian format I suppose). */
/* */
if ( rec->nameID == nameid && rec->stringLength > 0 )
{
switch ( rec->platformID )
{
case TT_PLATFORM_APPLE_UNICODE:
case TT_PLATFORM_ISO:
/* there is `languageID' to check there. We should use this */
/* field only as a last solution when nothing else is */
/* available. */
/* */
found_unicode = n;
break;
case TT_PLATFORM_MACINTOSH:
/* This is a bit special because some fonts will use either */
/* an English language id, or a Roman encoding id, to indicate */
/* the English version of its font name. */
/* */
if ( rec->languageID == TT_MAC_LANGID_ENGLISH )
found_apple_english = n;
else if ( rec->encodingID == TT_MAC_ID_ROMAN )
found_apple_roman = n;
break;
case TT_PLATFORM_MICROSOFT:
/* we only take a non-English name when there is nothing */
/* else available in the font */
/* */
if ( found_win == -1 || ( rec->languageID & 0x3FF ) == 0x009 )
{
switch ( rec->encodingID )
{
case TT_MS_ID_SYMBOL_CS:
case TT_MS_ID_UNICODE_CS:
case TT_MS_ID_UCS_4:
is_english = FT_BOOL( ( rec->languageID & 0x3FF ) == 0x009 );
found_win = n;
break;
default:
;
}
}
break;
default:
;
}
}
}
found_apple = found_apple_roman;
if ( found_apple_english >= 0 )
found_apple = found_apple_english;
/* some fonts contain invalid Unicode or Macintosh formatted entries; */
/* we will thus favor names encoded in Windows formats if available */
/* (provided it is an English name) */
/* */
convert = NULL;
if ( found_win >= 0 && !( found_apple >= 0 && !is_english ) )
{
rec = face->name_table.names + found_win;
switch ( rec->encodingID )
{
/* all Unicode strings are encoded using UTF-16BE */
case TT_MS_ID_UNICODE_CS:
case TT_MS_ID_SYMBOL_CS:
convert = tt_name_entry_ascii_from_utf16;
break;
case TT_MS_ID_UCS_4:
/* Apparently, if this value is found in a name table entry, it is */
/* documented as `full Unicode repertoire'. Experience with the */
/* MsGothic font shipped with Windows Vista shows that this really */
/* means UTF-16 encoded names (UCS-4 values are only used within */
/* charmaps). */
convert = tt_name_entry_ascii_from_utf16;
break;
default:
;
}
}
else if ( found_apple >= 0 )
{
rec = face->name_table.names + found_apple;
convert = tt_name_entry_ascii_from_other;
}
else if ( found_unicode >= 0 )
{
rec = face->name_table.names + found_unicode;
convert = tt_name_entry_ascii_from_utf16;
}
if ( rec && convert )
{
if ( rec->string == NULL )
{
FT_Stream stream = face->name_table.stream;
if ( FT_QNEW_ARRAY ( rec->string, rec->stringLength ) ||
FT_STREAM_SEEK( rec->stringOffset ) ||
FT_STREAM_READ( rec->string, rec->stringLength ) )
{
FT_FREE( rec->string );
rec->stringLength = 0;
result = NULL;
goto Exit;
}
}
result = convert( rec, memory );
}
Exit:
*name = result;
return error;
}
| 10,913
|
109,877
| 0
|
String Document::webkitVisibilityState() const
{
return pageVisibilityStateString(visibilityState());
}
| 10,914
|
68,417
| 0
|
static int perf_tp_filter_match(struct perf_event *event,
struct perf_sample_data *data)
{
void *record = data->raw->frag.data;
/* only top level events have filters set */
if (event->parent)
event = event->parent;
if (likely(!event->filter) || filter_match_preds(event->filter, record))
return 1;
return 0;
}
| 10,915
|
116,483
| 0
|
static Value* CreateDebuggeeId(int tab_id) {
DictionaryValue* debuggeeId = new DictionaryValue();
debuggeeId->SetInteger(keys::kTabIdKey, tab_id);
return debuggeeId;
}
| 10,916
|
38,061
| 0
|
cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,
uint32_t offs, cdf_property_info_t **info, size_t *count, size_t *maxcount)
{
const cdf_section_header_t *shp;
cdf_section_header_t sh;
const uint8_t *p, *q, *e;
int16_t s16;
int32_t s32;
uint32_t u32;
int64_t s64;
uint64_t u64;
cdf_timestamp_t tp;
size_t i, o, o4, nelements, j;
cdf_property_info_t *inp;
if (offs > UINT32_MAX / 4) {
errno = EFTYPE;
goto out;
}
shp = CAST(const cdf_section_header_t *, (const void *)
((const char *)sst->sst_tab + offs));
if (cdf_check_stream_offset(sst, h, shp, sizeof(*shp), __LINE__) == -1)
goto out;
sh.sh_len = CDF_TOLE4(shp->sh_len);
#define CDF_SHLEN_LIMIT (UINT32_MAX / 8)
if (sh.sh_len > CDF_SHLEN_LIMIT) {
errno = EFTYPE;
goto out;
}
sh.sh_properties = CDF_TOLE4(shp->sh_properties);
#define CDF_PROP_LIMIT (UINT32_MAX / (4 * sizeof(*inp)))
if (sh.sh_properties > CDF_PROP_LIMIT)
goto out;
DPRINTF(("section len: %u properties %u\n", sh.sh_len,
sh.sh_properties));
if (*maxcount) {
if (*maxcount > CDF_PROP_LIMIT)
goto out;
*maxcount += sh.sh_properties;
inp = CAST(cdf_property_info_t *,
realloc(*info, *maxcount * sizeof(*inp)));
} else {
*maxcount = sh.sh_properties;
inp = CAST(cdf_property_info_t *,
malloc(*maxcount * sizeof(*inp)));
}
if (inp == NULL)
goto out;
*info = inp;
inp += *count;
*count += sh.sh_properties;
p = CAST(const uint8_t *, (const void *)
((const char *)(const void *)sst->sst_tab +
offs + sizeof(sh)));
e = CAST(const uint8_t *, (const void *)
(((const char *)(const void *)shp) + sh.sh_len));
if (cdf_check_stream_offset(sst, h, e, 0, __LINE__) == -1)
goto out;
for (i = 0; i < sh.sh_properties; i++) {
size_t ofs = CDF_GETUINT32(p, (i << 1) + 1);
q = (const uint8_t *)(const void *)
((const char *)(const void *)p + ofs
- 2 * sizeof(uint32_t));
if (q > e) {
DPRINTF(("Ran of the end %p > %p\n", q, e));
goto out;
}
inp[i].pi_id = CDF_GETUINT32(p, i << 1);
inp[i].pi_type = CDF_GETUINT32(q, 0);
DPRINTF(("%" SIZE_T_FORMAT "u) id=%x type=%x offs=0x%tx,0x%x\n",
i, inp[i].pi_id, inp[i].pi_type, q - p, offs));
if (inp[i].pi_type & CDF_VECTOR) {
nelements = CDF_GETUINT32(q, 1);
if (nelements == 0) {
DPRINTF(("CDF_VECTOR with nelements == 0\n"));
goto out;
}
o = 2;
} else {
nelements = 1;
o = 1;
}
o4 = o * sizeof(uint32_t);
if (inp[i].pi_type & (CDF_ARRAY|CDF_BYREF|CDF_RESERVED))
goto unknown;
switch (inp[i].pi_type & CDF_TYPEMASK) {
case CDF_NULL:
case CDF_EMPTY:
break;
case CDF_SIGNED16:
if (inp[i].pi_type & CDF_VECTOR)
goto unknown;
(void)memcpy(&s16, &q[o4], sizeof(s16));
inp[i].pi_s16 = CDF_TOLE2(s16);
break;
case CDF_SIGNED32:
if (inp[i].pi_type & CDF_VECTOR)
goto unknown;
(void)memcpy(&s32, &q[o4], sizeof(s32));
inp[i].pi_s32 = CDF_TOLE4((uint32_t)s32);
break;
case CDF_BOOL:
case CDF_UNSIGNED32:
if (inp[i].pi_type & CDF_VECTOR)
goto unknown;
(void)memcpy(&u32, &q[o4], sizeof(u32));
inp[i].pi_u32 = CDF_TOLE4(u32);
break;
case CDF_SIGNED64:
if (inp[i].pi_type & CDF_VECTOR)
goto unknown;
(void)memcpy(&s64, &q[o4], sizeof(s64));
inp[i].pi_s64 = CDF_TOLE8((uint64_t)s64);
break;
case CDF_UNSIGNED64:
if (inp[i].pi_type & CDF_VECTOR)
goto unknown;
(void)memcpy(&u64, &q[o4], sizeof(u64));
inp[i].pi_u64 = CDF_TOLE8((uint64_t)u64);
break;
case CDF_FLOAT:
if (inp[i].pi_type & CDF_VECTOR)
goto unknown;
(void)memcpy(&u32, &q[o4], sizeof(u32));
u32 = CDF_TOLE4(u32);
memcpy(&inp[i].pi_f, &u32, sizeof(inp[i].pi_f));
break;
case CDF_DOUBLE:
if (inp[i].pi_type & CDF_VECTOR)
goto unknown;
(void)memcpy(&u64, &q[o4], sizeof(u64));
u64 = CDF_TOLE8((uint64_t)u64);
memcpy(&inp[i].pi_d, &u64, sizeof(inp[i].pi_d));
break;
case CDF_LENGTH32_STRING:
case CDF_LENGTH32_WSTRING:
if (nelements > 1) {
size_t nelem = inp - *info;
if (*maxcount > CDF_PROP_LIMIT
|| nelements > CDF_PROP_LIMIT)
goto out;
*maxcount += nelements;
inp = CAST(cdf_property_info_t *,
realloc(*info, *maxcount * sizeof(*inp)));
if (inp == NULL)
goto out;
*info = inp;
inp = *info + nelem;
}
DPRINTF(("nelements = %" SIZE_T_FORMAT "u\n",
nelements));
for (j = 0; j < nelements && i < sh.sh_properties;
j++, i++)
{
uint32_t l = CDF_GETUINT32(q, o);
inp[i].pi_str.s_len = l;
inp[i].pi_str.s_buf = (const char *)
(const void *)(&q[o4 + sizeof(l)]);
DPRINTF(("l = %d, r = %" SIZE_T_FORMAT
"u, s = %s\n", l,
CDF_ROUND(l, sizeof(l)),
inp[i].pi_str.s_buf));
if (l & 1)
l++;
o += l >> 1;
if (q + o >= e)
goto out;
o4 = o * sizeof(uint32_t);
}
i--;
break;
case CDF_FILETIME:
if (inp[i].pi_type & CDF_VECTOR)
goto unknown;
(void)memcpy(&tp, &q[o4], sizeof(tp));
inp[i].pi_tp = CDF_TOLE8((uint64_t)tp);
break;
case CDF_CLIPBOARD:
if (inp[i].pi_type & CDF_VECTOR)
goto unknown;
break;
default:
unknown:
DPRINTF(("Don't know how to deal with %x\n",
inp[i].pi_type));
break;
}
}
return 0;
out:
free(*info);
return -1;
}
| 10,917
|
154,488
| 0
|
error::Error GLES2DecoderPassthroughImpl::PatchGetNumericResults(GLenum pname,
GLsizei length,
T* params) {
if (length < 1) {
return error::kNoError;
}
switch (pname) {
case GL_NUM_EXTENSIONS:
params[0] = 0;
break;
case GL_TEXTURE_BINDING_2D:
case GL_TEXTURE_BINDING_CUBE_MAP:
case GL_TEXTURE_BINDING_2D_ARRAY:
case GL_TEXTURE_BINDING_3D:
if (*params != 0 &&
!GetClientID(&resources_->texture_id_map, *params, params)) {
return error::kInvalidArguments;
}
break;
case GL_ARRAY_BUFFER_BINDING:
case GL_ELEMENT_ARRAY_BUFFER_BINDING:
case GL_PIXEL_PACK_BUFFER_BINDING:
case GL_PIXEL_UNPACK_BUFFER_BINDING:
case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
case GL_COPY_READ_BUFFER_BINDING:
case GL_COPY_WRITE_BUFFER_BINDING:
case GL_UNIFORM_BUFFER_BINDING:
if (*params != 0 &&
!GetClientID(&resources_->buffer_id_map, *params, params)) {
return error::kInvalidArguments;
}
break;
case GL_RENDERBUFFER_BINDING:
if (*params != 0 &&
!GetClientID(&resources_->renderbuffer_id_map, *params, params)) {
return error::kInvalidArguments;
}
break;
case GL_SAMPLER_BINDING:
if (*params != 0 &&
!GetClientID(&resources_->sampler_id_map, *params, params)) {
return error::kInvalidArguments;
}
break;
case GL_ACTIVE_PROGRAM:
if (*params != 0 &&
!GetClientID(&resources_->program_id_map, *params, params)) {
return error::kInvalidArguments;
}
break;
case GL_FRAMEBUFFER_BINDING:
case GL_READ_FRAMEBUFFER_BINDING:
if (*params != 0 && !GetClientID(&framebuffer_id_map_, *params, params)) {
return error::kInvalidArguments;
}
break;
case GL_TRANSFORM_FEEDBACK_BINDING:
if (*params != 0 &&
!GetClientID(&transform_feedback_id_map_, *params, params)) {
return error::kInvalidArguments;
}
break;
case GL_VERTEX_ARRAY_BINDING:
if (*params != 0 &&
!GetClientID(&vertex_array_id_map_, *params, params)) {
return error::kInvalidArguments;
}
break;
case GL_VIEWPORT:
if (length < 4) {
return error::kInvalidArguments;
}
std::copy(std::begin(viewport_), std::end(viewport_), params);
break;
case GL_SCISSOR_BOX:
if (length < 4) {
return error::kInvalidArguments;
}
std::copy(std::begin(scissor_), std::end(scissor_), params);
break;
default:
break;
}
return error::kNoError;
}
| 10,918
|
179,720
| 1
|
static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags,
u32 val, ktime_t *abs_time, u32 bitset,
u32 __user *uaddr2)
{
struct hrtimer_sleeper timeout, *to = NULL;
struct rt_mutex_waiter rt_waiter;
struct rt_mutex *pi_mutex = NULL;
struct futex_hash_bucket *hb;
union futex_key key2 = FUTEX_KEY_INIT;
struct futex_q q = futex_q_init;
int res, ret;
if (!bitset)
return -EINVAL;
if (abs_time) {
to = &timeout;
hrtimer_init_on_stack(&to->timer, (flags & FLAGS_CLOCKRT) ?
CLOCK_REALTIME : CLOCK_MONOTONIC,
HRTIMER_MODE_ABS);
hrtimer_init_sleeper(to, current);
hrtimer_set_expires_range_ns(&to->timer, *abs_time,
current->timer_slack_ns);
}
/*
* The waiter is allocated on our stack, manipulated by the requeue
* code while we sleep on uaddr.
*/
debug_rt_mutex_init_waiter(&rt_waiter);
rt_waiter.task = NULL;
ret = get_futex_key(uaddr2, flags & FLAGS_SHARED, &key2, VERIFY_WRITE);
if (unlikely(ret != 0))
goto out;
q.bitset = bitset;
q.rt_waiter = &rt_waiter;
q.requeue_pi_key = &key2;
/*
* Prepare to wait on uaddr. On success, increments q.key (key1) ref
* count.
*/
ret = futex_wait_setup(uaddr, val, flags, &q, &hb);
if (ret)
goto out_key2;
/* Queue the futex_q, drop the hb lock, wait for wakeup. */
futex_wait_queue_me(hb, &q, to);
spin_lock(&hb->lock);
ret = handle_early_requeue_pi_wakeup(hb, &q, &key2, to);
spin_unlock(&hb->lock);
if (ret)
goto out_put_keys;
/*
* In order for us to be here, we know our q.key == key2, and since
* we took the hb->lock above, we also know that futex_requeue() has
* completed and we no longer have to concern ourselves with a wakeup
* race with the atomic proxy lock acquisition by the requeue code. The
* futex_requeue dropped our key1 reference and incremented our key2
* reference count.
*/
/* Check if the requeue code acquired the second futex for us. */
if (!q.rt_waiter) {
/*
* Got the lock. We might not be the anticipated owner if we
* did a lock-steal - fix up the PI-state in that case.
*/
if (q.pi_state && (q.pi_state->owner != current)) {
spin_lock(q.lock_ptr);
ret = fixup_pi_state_owner(uaddr2, &q, current);
spin_unlock(q.lock_ptr);
}
} else {
/*
* We have been woken up by futex_unlock_pi(), a timeout, or a
* signal. futex_unlock_pi() will not destroy the lock_ptr nor
* the pi_state.
*/
WARN_ON(!q.pi_state);
pi_mutex = &q.pi_state->pi_mutex;
ret = rt_mutex_finish_proxy_lock(pi_mutex, to, &rt_waiter, 1);
debug_rt_mutex_free_waiter(&rt_waiter);
spin_lock(q.lock_ptr);
/*
* Fixup the pi_state owner and possibly acquire the lock if we
* haven't already.
*/
res = fixup_owner(uaddr2, &q, !ret);
/*
* If fixup_owner() returned an error, proprogate that. If it
* acquired the lock, clear -ETIMEDOUT or -EINTR.
*/
if (res)
ret = (res < 0) ? res : 0;
/* Unqueue and drop the lock. */
unqueue_me_pi(&q);
}
/*
* If fixup_pi_state_owner() faulted and was unable to handle the
* fault, unlock the rt_mutex and return the fault to userspace.
*/
if (ret == -EFAULT) {
if (pi_mutex && rt_mutex_owner(pi_mutex) == current)
rt_mutex_unlock(pi_mutex);
} else if (ret == -EINTR) {
/*
* We've already been requeued, but cannot restart by calling
* futex_lock_pi() directly. We could restart this syscall, but
* it would detect that the user space "val" changed and return
* -EWOULDBLOCK. Save the overhead of the restart and return
* -EWOULDBLOCK directly.
*/
ret = -EWOULDBLOCK;
}
out_put_keys:
put_futex_key(&q.key);
out_key2:
put_futex_key(&key2);
out:
if (to) {
hrtimer_cancel(&to->timer);
destroy_hrtimer_on_stack(&to->timer);
}
return ret;
}
| 10,919
|
113,992
| 0
|
void RecheckGDataOperations() {
Profile* profile = ProfileManager::GetDefaultProfile();
if (!gdata::util::IsGDataAvailable(profile))
return;
GDataSystemService* system_service =
GDataSystemServiceFactory::FindForProfile(profile);
if (!system_service || !system_service->file_system())
return;
OnProgressUpdate(system_service->file_system()->GetOperationRegistry()->
GetProgressStatusList());
}
| 10,920
|
60,086
| 0
|
static Sdb *store_versioninfo_gnu_versym(ELFOBJ *bin, Elf_(Shdr) *shdr, int sz) {
int i;
const ut64 num_entries = sz / sizeof (Elf_(Versym));
const char *section_name = "";
const char *link_section_name = "";
Elf_(Shdr) *link_shdr = NULL;
Sdb *sdb = sdb_new0();
if (!sdb) {
return NULL;
}
if (!bin->version_info[DT_VERSIONTAGIDX (DT_VERSYM)]) {
sdb_free (sdb);
return NULL;
}
if (shdr->sh_link > bin->ehdr.e_shnum) {
sdb_free (sdb);
return NULL;
}
link_shdr = &bin->shdr[shdr->sh_link];
ut8 *edata = (ut8*) calloc (R_MAX (1, num_entries), sizeof (ut16));
if (!edata) {
sdb_free (sdb);
return NULL;
}
ut16 *data = (ut16*) calloc (R_MAX (1, num_entries), sizeof (ut16));
if (!data) {
free (edata);
sdb_free (sdb);
return NULL;
}
ut64 off = Elf_(r_bin_elf_v2p) (bin, bin->version_info[DT_VERSIONTAGIDX (DT_VERSYM)]);
if (bin->shstrtab && shdr->sh_name < bin->shstrtab_size) {
section_name = &bin->shstrtab[shdr->sh_name];
}
if (bin->shstrtab && link_shdr->sh_name < bin->shstrtab_size) {
link_section_name = &bin->shstrtab[link_shdr->sh_name];
}
r_buf_read_at (bin->b, off, edata, sizeof (ut16) * num_entries);
sdb_set (sdb, "section_name", section_name, 0);
sdb_num_set (sdb, "num_entries", num_entries, 0);
sdb_num_set (sdb, "addr", shdr->sh_addr, 0);
sdb_num_set (sdb, "offset", shdr->sh_offset, 0);
sdb_num_set (sdb, "link", shdr->sh_link, 0);
sdb_set (sdb, "link_section_name", link_section_name, 0);
for (i = num_entries; i--;) {
data[i] = r_read_ble16 (&edata[i * sizeof (ut16)], bin->endian);
}
R_FREE (edata);
for (i = 0; i < num_entries; i += 4) {
int j;
int check_def;
char key[32] = {0};
Sdb *sdb_entry = sdb_new0 ();
snprintf (key, sizeof (key), "entry%d", i / 4);
sdb_ns_set (sdb, key, sdb_entry);
sdb_num_set (sdb_entry, "idx", i, 0);
for (j = 0; (j < 4) && (i + j) < num_entries; ++j) {
int k;
char *tmp_val = NULL;
snprintf (key, sizeof (key), "value%d", j);
switch (data[i + j]) {
case 0:
sdb_set (sdb_entry, key, "0 (*local*)", 0);
break;
case 1:
sdb_set (sdb_entry, key, "1 (*global*)", 0);
break;
default:
tmp_val = sdb_fmt (0, "%x ", data[i+j] & 0x7FFF);
check_def = true;
if (bin->version_info[DT_VERSIONTAGIDX (DT_VERNEED)]) {
Elf_(Verneed) vn;
ut8 svn[sizeof (Elf_(Verneed))] = {0};
ut64 offset = Elf_(r_bin_elf_v2p) (bin, bin->version_info[DT_VERSIONTAGIDX (DT_VERNEED)]);
do {
Elf_(Vernaux) vna;
ut8 svna[sizeof (Elf_(Vernaux))] = {0};
ut64 a_off;
if (offset > bin->size || offset + sizeof (vn) > bin->size) {
goto beach;
}
if (r_buf_read_at (bin->b, offset, svn, sizeof (svn)) < 0) {
bprintf ("Warning: Cannot read Verneed for Versym\n");
goto beach;
}
k = 0;
vn.vn_version = READ16 (svn, k)
vn.vn_cnt = READ16 (svn, k)
vn.vn_file = READ32 (svn, k)
vn.vn_aux = READ32 (svn, k)
vn.vn_next = READ32 (svn, k)
a_off = offset + vn.vn_aux;
do {
if (a_off > bin->size || a_off + sizeof (vna) > bin->size) {
goto beach;
}
if (r_buf_read_at (bin->b, a_off, svna, sizeof (svna)) < 0) {
bprintf ("Warning: Cannot read Vernaux for Versym\n");
goto beach;
}
k = 0;
vna.vna_hash = READ32 (svna, k)
vna.vna_flags = READ16 (svna, k)
vna.vna_other = READ16 (svna, k)
vna.vna_name = READ32 (svna, k)
vna.vna_next = READ32 (svna, k)
a_off += vna.vna_next;
} while (vna.vna_other != data[i + j] && vna.vna_next != 0);
if (vna.vna_other == data[i + j]) {
if (vna.vna_name > bin->strtab_size) {
goto beach;
}
sdb_set (sdb_entry, key, sdb_fmt (0, "%s(%s)", tmp_val, bin->strtab + vna.vna_name), 0);
check_def = false;
break;
}
offset += vn.vn_next;
} while (vn.vn_next);
}
ut64 vinfoaddr = bin->version_info[DT_VERSIONTAGIDX (DT_VERDEF)];
if (check_def && data[i + j] != 0x8001 && vinfoaddr) {
Elf_(Verdef) vd;
ut8 svd[sizeof (Elf_(Verdef))] = {0};
ut64 offset = Elf_(r_bin_elf_v2p) (bin, vinfoaddr);
if (offset > bin->size || offset + sizeof (vd) > bin->size) {
goto beach;
}
do {
if (r_buf_read_at (bin->b, offset, svd, sizeof (svd)) < 0) {
bprintf ("Warning: Cannot read Verdef for Versym\n");
goto beach;
}
k = 0;
vd.vd_version = READ16 (svd, k)
vd.vd_flags = READ16 (svd, k)
vd.vd_ndx = READ16 (svd, k)
vd.vd_cnt = READ16 (svd, k)
vd.vd_hash = READ32 (svd, k)
vd.vd_aux = READ32 (svd, k)
vd.vd_next = READ32 (svd, k)
offset += vd.vd_next;
} while (vd.vd_ndx != (data[i + j] & 0x7FFF) && vd.vd_next != 0);
if (vd.vd_ndx == (data[i + j] & 0x7FFF)) {
Elf_(Verdaux) vda;
ut8 svda[sizeof (Elf_(Verdaux))] = {0};
ut64 off_vda = offset - vd.vd_next + vd.vd_aux;
if (off_vda > bin->size || off_vda + sizeof (vda) > bin->size) {
goto beach;
}
if (r_buf_read_at (bin->b, off_vda, svda, sizeof (svda)) < 0) {
bprintf ("Warning: Cannot read Verdaux for Versym\n");
goto beach;
}
k = 0;
vda.vda_name = READ32 (svda, k)
vda.vda_next = READ32 (svda, k)
if (vda.vda_name > bin->strtab_size) {
goto beach;
}
const char *name = bin->strtab + vda.vda_name;
sdb_set (sdb_entry, key, sdb_fmt (0,"%s(%s%-*s)", tmp_val, name, (int)(12 - strlen (name)),")") , 0);
}
}
}
}
}
beach:
free (data);
return sdb;
}
| 10,921
|
156,394
| 0
|
std::string EncodeImage(const gfx::Image& image,
const std::string& format,
int quality) {
DCHECK(!image.IsEmpty());
scoped_refptr<base::RefCountedMemory> data;
if (format == kPng) {
data = image.As1xPNGBytes();
} else if (format == kJpeg) {
scoped_refptr<base::RefCountedBytes> bytes(new base::RefCountedBytes());
if (gfx::JPEG1xEncodedDataFromImage(image, quality, &bytes->data()))
data = bytes;
}
if (!data || !data->front())
return std::string();
std::string base_64_data;
base::Base64Encode(
base::StringPiece(reinterpret_cast<const char*>(data->front()),
data->size()),
&base_64_data);
return base_64_data;
}
| 10,922
|
12,145
| 0
|
const char* XMLRPC_GetResponseFaultString (XMLRPC_REQUEST response) {
return XMLRPC_GetValueFaultString( XMLRPC_RequestGetData(response) );
}
| 10,923
|
47,808
| 0
|
int snd_pcm_hw_constraint_mask64(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var,
u_int64_t mask)
{
struct snd_pcm_hw_constraints *constrs = &runtime->hw_constraints;
struct snd_mask *maskp = constrs_mask(constrs, var);
maskp->bits[0] &= (u_int32_t)mask;
maskp->bits[1] &= (u_int32_t)(mask >> 32);
memset(maskp->bits + 2, 0, (SNDRV_MASK_MAX-64) / 8); /* clear rest */
if (! maskp->bits[0] && ! maskp->bits[1])
return -EINVAL;
return 0;
}
| 10,924
|
81,924
| 0
|
static int wc_ecc_shared_secret_gen_async(ecc_key* private_key,
ecc_point* point, byte* out, word32 *outlen,
ecc_curve_spec* curve)
{
int err;
#if defined(HAVE_CAVIUM_V) || defined(HAVE_INTEL_QA)
#ifdef HAVE_CAVIUM_V
/* verify the curve is supported by hardware */
if (NitroxEccIsCurveSupported(private_key))
#endif
{
word32 keySz = private_key->dp->size;
/* sync public key x/y */
err = wc_mp_to_bigint_sz(&private_key->k, &private_key->k.raw, keySz);
if (err == MP_OKAY)
err = wc_mp_to_bigint_sz(point->x, &point->x->raw, keySz);
if (err == MP_OKAY)
err = wc_mp_to_bigint_sz(point->y, &point->y->raw, keySz);
#ifdef HAVE_CAVIUM_V
/* allocate buffer for output */
if (err == MP_OKAY)
err = wc_ecc_alloc_mpint(private_key, &private_key->e);
if (err == MP_OKAY)
err = wc_bigint_alloc(&private_key->e->raw,
NitroxEccGetSize(private_key)*2);
if (err == MP_OKAY)
err = NitroxEcdh(private_key,
&private_key->k.raw, &point->x->raw, &point->y->raw,
private_key->e->raw.buf, &private_key->e->raw.len,
&curve->prime->raw);
#else
if (err == MP_OKAY)
err = wc_ecc_curve_load(private_key->dp, &curve, ECC_CURVE_FIELD_BF);
if (err == MP_OKAY)
err = IntelQaEcdh(&private_key->asyncDev,
&private_key->k.raw, &point->x->raw, &point->y->raw,
out, outlen,
&curve->Af->raw, &curve->Bf->raw, &curve->prime->raw,
private_key->dp->cofactor);
#endif
return err;
}
#elif defined(WOLFSSL_ASYNC_CRYPT_TEST)
if (wc_AsyncTestInit(&private_key->asyncDev, ASYNC_TEST_ECC_SHARED_SEC)) {
WC_ASYNC_TEST* testDev = &private_key->asyncDev.test;
testDev->eccSharedSec.private_key = private_key;
testDev->eccSharedSec.public_point = point;
testDev->eccSharedSec.out = out;
testDev->eccSharedSec.outLen = outlen;
return WC_PENDING_E;
}
#endif
/* use sync in other cases */
err = wc_ecc_shared_secret_gen_sync(private_key, point, out, outlen, curve);
return err;
}
| 10,925
|
180,887
| 1
|
process_open(u_int32_t id)
{
u_int32_t pflags;
Attrib a;
char *name;
int r, handle, fd, flags, mode, status = SSH2_FX_FAILURE;
if ((r = sshbuf_get_cstring(iqueue, &name, NULL)) != 0 ||
(r = sshbuf_get_u32(iqueue, &pflags)) != 0 || /* portable flags */
(r = decode_attrib(iqueue, &a)) != 0)
fatal("%s: buffer error: %s", __func__, ssh_err(r));
debug3("request %u: open flags %d", id, pflags);
flags = flags_from_portable(pflags);
mode = (a.flags & SSH2_FILEXFER_ATTR_PERMISSIONS) ? a.perm : 0666;
logit("open \"%s\" flags %s mode 0%o",
name, string_from_portable(pflags), mode);
if (readonly &&
((flags & O_ACCMODE) == O_WRONLY ||
(flags & O_ACCMODE) == O_RDWR)) {
verbose("Refusing open request in read-only mode");
status = SSH2_FX_PERMISSION_DENIED;
} else {
fd = open(name, flags, mode);
if (fd < 0) {
status = errno_to_portable(errno);
} else {
handle = handle_new(HANDLE_FILE, name, fd, flags, NULL);
if (handle < 0) {
close(fd);
} else {
send_handle(id, handle);
status = SSH2_FX_OK;
}
}
}
if (status != SSH2_FX_OK)
send_status(id, status);
free(name);
}
| 10,926
|
98,223
| 0
|
LayerTilerChromium::~LayerTilerChromium()
{
reset();
}
| 10,927
|
34,376
| 0
|
static struct extent_map *create_pinned_em(struct inode *inode, u64 start,
u64 len, u64 orig_start,
u64 block_start, u64 block_len,
u64 orig_block_len, int type)
{
struct extent_map_tree *em_tree;
struct extent_map *em;
struct btrfs_root *root = BTRFS_I(inode)->root;
int ret;
em_tree = &BTRFS_I(inode)->extent_tree;
em = alloc_extent_map();
if (!em)
return ERR_PTR(-ENOMEM);
em->start = start;
em->orig_start = orig_start;
em->len = len;
em->block_len = block_len;
em->block_start = block_start;
em->bdev = root->fs_info->fs_devices->latest_bdev;
em->orig_block_len = orig_block_len;
em->generation = -1;
set_bit(EXTENT_FLAG_PINNED, &em->flags);
if (type == BTRFS_ORDERED_PREALLOC)
set_bit(EXTENT_FLAG_FILLING, &em->flags);
do {
btrfs_drop_extent_cache(inode, em->start,
em->start + em->len - 1, 0);
write_lock(&em_tree->lock);
ret = add_extent_mapping(em_tree, em);
if (!ret)
list_move(&em->list,
&em_tree->modified_extents);
write_unlock(&em_tree->lock);
} while (ret == -EEXIST);
if (ret) {
free_extent_map(em);
return ERR_PTR(ret);
}
return em;
}
| 10,928
|
81,907
| 0
|
int wc_ecc_make_key(WC_RNG* rng, int keysize, ecc_key* key)
{
return wc_ecc_make_key_ex(rng, keysize, key, ECC_CURVE_DEF);
}
| 10,929
|
144,483
| 0
|
void WebContentsImpl::DidNavigateMainFramePreCommit(
bool navigation_is_within_page) {
if (navigation_is_within_page) {
return;
}
if (IsFullscreenForCurrentTab(GetRenderViewHost()->GetWidget()))
ExitFullscreen(false);
DCHECK(!IsFullscreenForCurrentTab(GetRenderViewHost()->GetWidget()));
}
| 10,930
|
26,019
| 0
|
static u64 perf_calculate_period(struct perf_event *event, u64 nsec, u64 count)
{
u64 frequency = event->attr.sample_freq;
u64 sec = NSEC_PER_SEC;
u64 divisor, dividend;
int count_fls, nsec_fls, frequency_fls, sec_fls;
count_fls = fls64(count);
nsec_fls = fls64(nsec);
frequency_fls = fls64(frequency);
sec_fls = 30;
/*
* We got @count in @nsec, with a target of sample_freq HZ
* the target period becomes:
*
* @count * 10^9
* period = -------------------
* @nsec * sample_freq
*
*/
/*
* Reduce accuracy by one bit such that @a and @b converge
* to a similar magnitude.
*/
#define REDUCE_FLS(a, b) \
do { \
if (a##_fls > b##_fls) { \
a >>= 1; \
a##_fls--; \
} else { \
b >>= 1; \
b##_fls--; \
} \
} while (0)
/*
* Reduce accuracy until either term fits in a u64, then proceed with
* the other, so that finally we can do a u64/u64 division.
*/
while (count_fls + sec_fls > 64 && nsec_fls + frequency_fls > 64) {
REDUCE_FLS(nsec, frequency);
REDUCE_FLS(sec, count);
}
if (count_fls + sec_fls > 64) {
divisor = nsec * frequency;
while (count_fls + sec_fls > 64) {
REDUCE_FLS(count, sec);
divisor >>= 1;
}
dividend = count * sec;
} else {
dividend = count * sec;
while (nsec_fls + frequency_fls > 64) {
REDUCE_FLS(nsec, frequency);
dividend >>= 1;
}
divisor = nsec * frequency;
}
if (!divisor)
return dividend;
return div64_u64(dividend, divisor);
}
| 10,931
|
126,797
| 0
|
void BrowserView::HideDevToolsContainer() {
devtools_focus_tracker_->FocusLastFocusedExternalView();
devtools_container_->SetVisible(false);
contents_split_->InvalidateLayout();
Layout();
}
| 10,932
|
170,689
| 0
|
static EAS_RESULT Parse_cdl (SDLS_SYNTHESIZER_DATA *pDLSData, EAS_I32 size, EAS_U32 *pValue)
{
EAS_RESULT result;
EAS_U32 stack[CDL_STACK_SIZE];
EAS_U16 opcode;
EAS_INT stackPtr;
EAS_U32 x, y;
DLSID dlsid;
stackPtr = -1;
*pValue = 0;
x = 0;
while (size)
{
/* read the opcode */
if ((result = EAS_HWGetWord(pDLSData->hwInstData, pDLSData->fileHandle, &opcode, EAS_FALSE)) != EAS_SUCCESS)
return result;
/* handle binary opcodes */
if (opcode <= DLS_CDL_EQ)
{
/* pop X and Y */
if ((result = PopcdlStack(stack, &stackPtr, &x)) != EAS_SUCCESS)
return result;
if ((result = PopcdlStack(stack, &stackPtr, &y)) != EAS_SUCCESS)
return result;
switch (opcode)
{
case DLS_CDL_AND:
x = x & y;
break;
case DLS_CDL_OR:
x = x | y;
break;
case DLS_CDL_XOR:
x = x ^ y;
break;
case DLS_CDL_ADD:
x = x + y;
break;
case DLS_CDL_SUBTRACT:
x = x - y;
break;
case DLS_CDL_MULTIPLY:
x = x * y;
break;
case DLS_CDL_DIVIDE:
if (!y)
return EAS_ERROR_FILE_FORMAT;
x = x / y;
break;
case DLS_CDL_LOGICAL_AND:
x = (x && y);
break;
case DLS_CDL_LOGICAL_OR:
x = (x || y);
break;
case DLS_CDL_LT:
x = (x < y);
break;
case DLS_CDL_LE:
x = (x <= y);
break;
case DLS_CDL_GT:
x = (x > y);
break;
case DLS_CDL_GE:
x = (x >= y);
break;
case DLS_CDL_EQ:
x = (x == y);
break;
default:
break;
}
}
else if (opcode == DLS_CDL_NOT)
{
if ((result = PopcdlStack(stack, &stackPtr, &x)) != EAS_SUCCESS)
return result;
x = !x;
}
else if (opcode == DLS_CDL_CONST)
{
if ((result = EAS_HWGetDWord(pDLSData->hwInstData, pDLSData->fileHandle, &x, EAS_FALSE)) != EAS_SUCCESS)
return result;
}
else if (opcode == DLS_CDL_QUERY)
{
if ((result = ReadDLSID(pDLSData, &dlsid)) != EAS_SUCCESS)
return result;
QueryGUID(&dlsid, &x);
}
else if (opcode == DLS_CDL_QUERYSUPPORTED)
{
if ((result = ReadDLSID(pDLSData, &dlsid)) != EAS_SUCCESS)
return result;
x = QueryGUID(&dlsid, &y);
}
else
{ /* dpp: EAS_ReportEx(_EAS_SEVERITY_WARNING, "Unsupported opcode %d in DLS file\n", opcode); */ }
/* push the result on the stack */
if ((result = PushcdlStack(stack, &stackPtr, x)) != EAS_SUCCESS)
return result;
}
/* pop the last result off the stack */
return PopcdlStack(stack, &stackPtr, pValue);
}
| 10,933
|
79,467
| 0
|
void nntp_delete_group_cache(struct NntpData *nntp_data)
{
if (!nntp_data || !nntp_data->nserv || !nntp_data->nserv->cacheable)
return;
#ifdef USE_HCACHE
char file[PATH_MAX];
nntp_hcache_namer(nntp_data->group, file, sizeof(file));
cache_expand(file, sizeof(file), &nntp_data->nserv->conn->account, file);
unlink(file);
nntp_data->last_cached = 0;
mutt_debug(2, "%s\n", file);
#endif
if (!nntp_data->bcache)
{
nntp_data->bcache =
mutt_bcache_open(&nntp_data->nserv->conn->account, nntp_data->group);
}
if (nntp_data->bcache)
{
mutt_debug(2, "%s/*\n", nntp_data->group);
mutt_bcache_list(nntp_data->bcache, nntp_bcache_delete, NULL);
mutt_bcache_close(&nntp_data->bcache);
}
}
| 10,934
|
65,819
| 0
|
nfsd4_encode_open_downgrade(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_open_downgrade *od)
{
struct xdr_stream *xdr = &resp->xdr;
if (!nfserr)
nfserr = nfsd4_encode_stateid(xdr, &od->od_stateid);
return nfserr;
}
| 10,935
|
6,275
| 0
|
PHP_FUNCTION(idate)
{
char *format;
int format_len;
long ts = 0;
int ret;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &format, &format_len, &ts) == FAILURE) {
RETURN_FALSE;
}
if (format_len != 1) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "idate format is one char");
RETURN_FALSE;
}
if (ZEND_NUM_ARGS() == 1) {
ts = time(NULL);
}
ret = php_idate(format[0], ts, 0 TSRMLS_CC);
if (ret == -1) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unrecognized date format token.");
RETURN_FALSE;
}
RETURN_LONG(ret);
}
| 10,936
|
104,308
| 0
|
static void FixupHost(const std::string& text,
const url_parse::Component& part,
bool has_scheme,
const std::string& desired_tld,
std::string* url) {
if (!part.is_valid())
return;
std::string domain(text, part.begin, part.len);
const size_t first_nondot(domain.find_first_not_of('.'));
if (first_nondot != std::string::npos) {
domain.erase(0, first_nondot);
size_t last_nondot(domain.find_last_not_of('.'));
DCHECK(last_nondot != std::string::npos);
last_nondot += 2; // Point at second period in ending string
if (last_nondot < domain.length())
domain.erase(last_nondot);
}
AddDesiredTLD(desired_tld, &domain);
url->append(domain);
}
| 10,937
|
91,838
| 0
|
int index_directory(char *dir, char *title)
{
struct dirent *dirbuf;
int numdir;
struct dirent **array;
struct stat statbuf;
char http_filename[MAX_FILE_LENGTH * 3];
char html_filename[MAX_FILE_LENGTH * 6];
char escaped_filename[MAX_FILE_LENGTH * 18]; /* *both* http and html escape */
int i;
if (chdir(dir) == -1) {
send_error(3);
return -1;
}
numdir = scandir(".", &array, select_files, alphasort);
if (numdir == -1) {
send_error(2);
return -1;
} else if (numdir == -2) {
send_error(6);
return -1;
}
if (html_escape_string(title, html_filename, strlen(title)) == NULL) {
send_error(4);
return -1;
}
printf("<html>\n"
"<head>\n<title>Index of %s</title>\n</head>\n\n"
"<body bgcolor=\"#ffffff\">\n"
"<H2>Index of %s</H2>\n"
"<table>\n%s",
html_filename, html_filename,
(strcmp(title, "/") == 0 ? "" :
"<tr><td colspan=3><h3>Directories</h3></td></tr>"
"<tr><td colspan=3><a href=\"../\">Parent Directory</a></td></tr>\n"));
for (i = 0; i < numdir; ++i) {
dirbuf = array[i];
if (stat(dirbuf->d_name, &statbuf) == -1)
continue;
if (!S_ISDIR(statbuf.st_mode))
continue;
if (html_escape_string(dirbuf->d_name, html_filename,
NAMLEN(dirbuf)) == NULL) {
send_error(4);
return -1;
}
if (http_escape_string(dirbuf->d_name, http_filename,
NAMLEN(dirbuf)) == NULL) {
send_error(4);
return -1;
}
if (html_escape_string(http_filename, escaped_filename,
strlen(http_filename)) == NULL) {
send_error(4);
return -1;
}
printf("<tr>"
"<td width=\"40%%\"><a href=\"%s/\">%s/</a></td>"
"<td align=right>%s</td>"
"<td align=right>"
PRINTF_OFF_T_ARG
" bytes</td>"
"</tr>\n",
escaped_filename, html_filename,
ctime(&statbuf.st_mtime), (off_t) statbuf.st_size);
}
printf
("<tr><td colspan=3> </td></tr>\n<tr><td colspan=3><h3>Files</h3></td></tr>\n");
for (i = 0; i < numdir; ++i) {
int len;
dirbuf = array[i];
if (stat(dirbuf->d_name, &statbuf) == -1)
continue;
if (S_ISDIR(statbuf.st_mode))
continue;
if (html_escape_string(dirbuf->d_name, html_filename,
NAMLEN(dirbuf)) == NULL) {
send_error(4);
return -1;
}
if (http_escape_string(dirbuf->d_name, http_filename,
NAMLEN(dirbuf)) == NULL) {
send_error(4);
return -1;
}
len = strlen(http_filename);
#ifdef GUNZIP
if (len > 3 && !memcmp(http_filename + len - 3, ".gz", 3)) {
http_filename[len - 3] = '\0';
html_filename[strlen(html_filename) - 3] = '\0';
if (html_escape_string(http_filename, escaped_filename,
strlen(http_filename)) == NULL) {
send_error(4);
return -1;
}
printf("<tr>"
"<td width=\"40%%\"><a href=\"%s\">%s</a> "
"<a href=\"%s.gz\">(.gz)</a></td>"
"<td align=right>%s</td>"
"<td align=right>"
PRINTF_OFF_T_ARG
"bytes</td>"
"</tr>\n",
escaped_filename, html_filename, http_filename,
ctime(&statbuf.st_mtime), (off_t) statbuf.st_size);
} else {
#endif
if (html_escape_string(http_filename, escaped_filename,
strlen(http_filename)) == NULL) {
send_error(4);
return -1;
}
printf("<tr>"
"<td width=\"40%%\"><a href=\"%s\">%s</a></td>"
"<td align=right>%s</td>"
"<td align=right>"
PRINTF_OFF_T_ARG
"bytes</td>"
"</tr>\n",
escaped_filename, html_filename,
ctime(&statbuf.st_mtime), (off_t) statbuf.st_size);
#ifdef GUNZIP
}
#endif
}
/* hey -- even though this is a one-shot deal, we should
* still free memory we ought to free
* You never know -- this code might get used elsewhere!
*/
for (i = 0; i < numdir; ++i) {
free(array[i]);
array[i] = NULL;
}
free(array);
array = NULL;
return 0; /* success */
}
| 10,938
|
144,234
| 0
|
LoginBigUserView* LockContentsView::TestApi::opt_secondary_big_view() const {
return view_->opt_secondary_big_view_;
}
| 10,939
|
102,716
| 0
|
void CCThreadProxy::initializeLayerRendererOnCCThread(GraphicsContext3D* contextPtr, CCCompletionEvent* completion, bool* initializeSucceeded, LayerRendererCapabilities* capabilities, int* compositorIdentifier)
{
TRACE_EVENT("CCThreadProxy::initializeLayerRendererOnCCThread", this, 0);
ASSERT(isImplThread());
RefPtr<GraphicsContext3D> context(adoptRef(contextPtr));
*initializeSucceeded = m_layerTreeHostImpl->initializeLayerRenderer(context);
if (*initializeSucceeded)
*capabilities = m_layerTreeHostImpl->layerRendererCapabilities();
m_scrollControllerAdapterOnCCThread = CCThreadProxyScrollControllerAdapter::create(this);
m_inputHandlerOnCCThread = CCInputHandler::create(m_scrollControllerAdapterOnCCThread.get());
*compositorIdentifier = m_inputHandlerOnCCThread->identifier();
completion->signal();
}
| 10,940
|
128,228
| 0
|
bool FrameView::contentsInCompositedLayer() const
{
RenderView* renderView = this->renderView();
if (renderView && renderView->compositingState() == PaintsIntoOwnBacking) {
GraphicsLayer* layer = renderView->layer()->compositedLayerMapping()->mainGraphicsLayer();
if (layer && layer->drawsContent())
return true;
}
return false;
}
| 10,941
|
94,440
| 0
|
__releases(ptl)
{
struct page *old_page, *new_page = NULL;
pte_t entry;
int ret = 0;
int page_mkwrite = 0;
struct page *dirty_page = NULL;
unsigned long mmun_start = 0; /* For mmu_notifiers */
unsigned long mmun_end = 0; /* For mmu_notifiers */
old_page = vm_normal_page(vma, address, orig_pte);
if (!old_page) {
/*
* VM_MIXEDMAP !pfn_valid() case
*
* We should not cow pages in a shared writeable mapping.
* Just mark the pages writable as we can't do any dirty
* accounting on raw pfn maps.
*/
if ((vma->vm_flags & (VM_WRITE|VM_SHARED)) ==
(VM_WRITE|VM_SHARED))
goto reuse;
goto gotten;
}
/*
* Take out anonymous pages first, anonymous shared vmas are
* not dirty accountable.
*/
if (PageAnon(old_page) && !PageKsm(old_page)) {
if (!trylock_page(old_page)) {
page_cache_get(old_page);
pte_unmap_unlock(page_table, ptl);
lock_page(old_page);
page_table = pte_offset_map_lock(mm, pmd, address,
&ptl);
if (!pte_same(*page_table, orig_pte)) {
unlock_page(old_page);
goto unlock;
}
page_cache_release(old_page);
}
if (reuse_swap_page(old_page)) {
/*
* The page is all ours. Move it to our anon_vma so
* the rmap code will not search our parent or siblings.
* Protected against the rmap code by the page lock.
*/
page_move_anon_rmap(old_page, vma, address);
unlock_page(old_page);
goto reuse;
}
unlock_page(old_page);
} else if (unlikely((vma->vm_flags & (VM_WRITE|VM_SHARED)) ==
(VM_WRITE|VM_SHARED))) {
/*
* Only catch write-faults on shared writable pages,
* read-only shared pages can get COWed by
* get_user_pages(.write=1, .force=1).
*/
if (vma->vm_ops && vma->vm_ops->page_mkwrite) {
struct vm_fault vmf;
int tmp;
vmf.virtual_address = (void __user *)(address &
PAGE_MASK);
vmf.pgoff = old_page->index;
vmf.flags = FAULT_FLAG_WRITE|FAULT_FLAG_MKWRITE;
vmf.page = old_page;
/*
* Notify the address space that the page is about to
* become writable so that it can prohibit this or wait
* for the page to get into an appropriate state.
*
* We do this without the lock held, so that it can
* sleep if it needs to.
*/
page_cache_get(old_page);
pte_unmap_unlock(page_table, ptl);
tmp = vma->vm_ops->page_mkwrite(vma, &vmf);
if (unlikely(tmp &
(VM_FAULT_ERROR | VM_FAULT_NOPAGE))) {
ret = tmp;
goto unwritable_page;
}
if (unlikely(!(tmp & VM_FAULT_LOCKED))) {
lock_page(old_page);
if (!old_page->mapping) {
ret = 0; /* retry the fault */
unlock_page(old_page);
goto unwritable_page;
}
} else
VM_BUG_ON(!PageLocked(old_page));
/*
* Since we dropped the lock we need to revalidate
* the PTE as someone else may have changed it. If
* they did, we just return, as we can count on the
* MMU to tell us if they didn't also make it writable.
*/
page_table = pte_offset_map_lock(mm, pmd, address,
&ptl);
if (!pte_same(*page_table, orig_pte)) {
unlock_page(old_page);
goto unlock;
}
page_mkwrite = 1;
}
dirty_page = old_page;
get_page(dirty_page);
reuse:
flush_cache_page(vma, address, pte_pfn(orig_pte));
entry = pte_mkyoung(orig_pte);
entry = maybe_mkwrite(pte_mkdirty(entry), vma);
if (ptep_set_access_flags(vma, address, page_table, entry,1))
update_mmu_cache(vma, address, page_table);
pte_unmap_unlock(page_table, ptl);
ret |= VM_FAULT_WRITE;
if (!dirty_page)
return ret;
/*
* Yes, Virginia, this is actually required to prevent a race
* with clear_page_dirty_for_io() from clearing the page dirty
* bit after it clear all dirty ptes, but before a racing
* do_wp_page installs a dirty pte.
*
* __do_fault is protected similarly.
*/
if (!page_mkwrite) {
wait_on_page_locked(dirty_page);
set_page_dirty_balance(dirty_page, page_mkwrite);
/* file_update_time outside page_lock */
if (vma->vm_file)
file_update_time(vma->vm_file);
}
put_page(dirty_page);
if (page_mkwrite) {
struct address_space *mapping = dirty_page->mapping;
set_page_dirty(dirty_page);
unlock_page(dirty_page);
page_cache_release(dirty_page);
if (mapping) {
/*
* Some device drivers do not set page.mapping
* but still dirty their pages
*/
balance_dirty_pages_ratelimited(mapping);
}
}
return ret;
}
/*
* Ok, we need to copy. Oh, well..
*/
page_cache_get(old_page);
gotten:
pte_unmap_unlock(page_table, ptl);
if (unlikely(anon_vma_prepare(vma)))
goto oom;
if (is_zero_pfn(pte_pfn(orig_pte))) {
new_page = alloc_zeroed_user_highpage_movable(vma, address);
if (!new_page)
goto oom;
} else {
new_page = alloc_page_vma(GFP_HIGHUSER_MOVABLE, vma, address);
if (!new_page)
goto oom;
cow_user_page(new_page, old_page, address, vma);
}
__SetPageUptodate(new_page);
if (mem_cgroup_newpage_charge(new_page, mm, GFP_KERNEL))
goto oom_free_new;
mmun_start = address & PAGE_MASK;
mmun_end = mmun_start + PAGE_SIZE;
mmu_notifier_invalidate_range_start(mm, mmun_start, mmun_end);
/*
* Re-check the pte - we dropped the lock
*/
page_table = pte_offset_map_lock(mm, pmd, address, &ptl);
if (likely(pte_same(*page_table, orig_pte))) {
if (old_page) {
if (!PageAnon(old_page)) {
dec_mm_counter_fast(mm, MM_FILEPAGES);
inc_mm_counter_fast(mm, MM_ANONPAGES);
}
} else
inc_mm_counter_fast(mm, MM_ANONPAGES);
flush_cache_page(vma, address, pte_pfn(orig_pte));
entry = mk_pte(new_page, vma->vm_page_prot);
entry = maybe_mkwrite(pte_mkdirty(entry), vma);
/*
* Clear the pte entry and flush it first, before updating the
* pte with the new entry. This will avoid a race condition
* seen in the presence of one thread doing SMC and another
* thread doing COW.
*/
ptep_clear_flush(vma, address, page_table);
page_add_new_anon_rmap(new_page, vma, address);
/*
* We call the notify macro here because, when using secondary
* mmu page tables (such as kvm shadow page tables), we want the
* new page to be mapped directly into the secondary page table.
*/
set_pte_at_notify(mm, address, page_table, entry);
update_mmu_cache(vma, address, page_table);
if (old_page) {
/*
* Only after switching the pte to the new page may
* we remove the mapcount here. Otherwise another
* process may come and find the rmap count decremented
* before the pte is switched to the new page, and
* "reuse" the old page writing into it while our pte
* here still points into it and can be read by other
* threads.
*
* The critical issue is to order this
* page_remove_rmap with the ptp_clear_flush above.
* Those stores are ordered by (if nothing else,)
* the barrier present in the atomic_add_negative
* in page_remove_rmap.
*
* Then the TLB flush in ptep_clear_flush ensures that
* no process can access the old page before the
* decremented mapcount is visible. And the old page
* cannot be reused until after the decremented
* mapcount is visible. So transitively, TLBs to
* old page will be flushed before it can be reused.
*/
page_remove_rmap(old_page);
}
/* Free the old page.. */
new_page = old_page;
ret |= VM_FAULT_WRITE;
} else
mem_cgroup_uncharge_page(new_page);
if (new_page)
page_cache_release(new_page);
unlock:
pte_unmap_unlock(page_table, ptl);
if (mmun_end > mmun_start)
mmu_notifier_invalidate_range_end(mm, mmun_start, mmun_end);
if (old_page) {
/*
* Don't let another task, with possibly unlocked vma,
* keep the mlocked page.
*/
if ((ret & VM_FAULT_WRITE) && (vma->vm_flags & VM_LOCKED)) {
lock_page(old_page); /* LRU manipulation */
munlock_vma_page(old_page);
unlock_page(old_page);
}
page_cache_release(old_page);
}
return ret;
oom_free_new:
page_cache_release(new_page);
oom:
if (old_page)
page_cache_release(old_page);
return VM_FAULT_OOM;
unwritable_page:
page_cache_release(old_page);
return ret;
}
| 10,942
|
30,578
| 0
|
static int afiucv_hs_callback_synfin(struct sock *sk, struct sk_buff *skb)
{
struct iucv_sock *iucv = iucv_sk(sk);
if (!iucv)
goto out;
if (sk->sk_state != IUCV_BOUND)
goto out;
bh_lock_sock(sk);
sk->sk_state = IUCV_DISCONN;
sk->sk_state_change(sk);
bh_unlock_sock(sk);
out:
kfree_skb(skb);
return NET_RX_SUCCESS;
}
| 10,943
|
126,925
| 0
|
void BrowserTabStripController::StartHighlightTabsForCommand(
TabStripModel::ContextMenuCommand command_id,
BaseTab* tab) {
if (command_id == TabStripModel::CommandCloseOtherTabs ||
command_id == TabStripModel::CommandCloseTabsToRight) {
int model_index = tabstrip_->GetModelIndexOfBaseTab(tab);
if (IsValidIndex(model_index)) {
std::vector<int> indices =
model_->GetIndicesClosedByCommand(model_index, command_id);
for (std::vector<int>::const_iterator i(indices.begin());
i != indices.end(); ++i) {
tabstrip_->StartHighlight(*i);
}
}
}
}
| 10,944
|
78,209
| 0
|
authentic_select_aid(struct sc_card *card, unsigned char *aid, size_t aid_len,
unsigned char *out, size_t *out_len)
{
struct sc_apdu apdu;
unsigned char apdu_resp[SC_MAX_APDU_BUFFER_SIZE];
int rv;
/* Select Card Manager (to deselect previously selected application) */
sc_format_apdu(card, &apdu, SC_APDU_CASE_3_SHORT, 0xA4, 0x04, 0x00);
apdu.lc = aid_len;
apdu.data = aid;
apdu.datalen = aid_len;
apdu.resplen = sizeof(apdu_resp);
apdu.resp = apdu_resp;
rv = sc_transmit_apdu(card, &apdu);
LOG_TEST_RET(card->ctx, rv, "APDU transmit failed");
rv = sc_check_sw(card, apdu.sw1, apdu.sw2);
LOG_TEST_RET(card->ctx, rv, "Cannot select AID");
if (out && out_len) {
if (*out_len < apdu.resplen)
LOG_TEST_RET(card->ctx, SC_ERROR_BUFFER_TOO_SMALL, "Cannot select AID");
memcpy(out, apdu.resp, apdu.resplen);
}
return SC_SUCCESS;
}
| 10,945
|
90,696
| 0
|
static int empty(Renode *node)
{
if (!node) return 1;
switch (node->type) {
default: return 1;
case P_CAT: return empty(node->x) && empty(node->y);
case P_ALT: return empty(node->x) || empty(node->y);
case P_REP: return empty(node->x) || node->m == 0;
case P_PAR: return empty(node->x);
case P_REF: return empty(node->x);
case P_ANY: case P_CHAR: case P_CCLASS: case P_NCCLASS: return 0;
}
}
| 10,946
|
59,957
| 0
|
static int build_audio_procunit(struct mixer_build *state, int unitid,
void *raw_desc, struct procunit_info *list,
char *name)
{
struct uac_processing_unit_descriptor *desc = raw_desc;
int num_ins = desc->bNrInPins;
struct usb_mixer_elem_info *cval;
struct snd_kcontrol *kctl;
int i, err, nameid, type, len;
struct procunit_info *info;
struct procunit_value_info *valinfo;
const struct usbmix_name_map *map;
static struct procunit_value_info default_value_info[] = {
{ 0x01, "Switch", USB_MIXER_BOOLEAN },
{ 0 }
};
static struct procunit_info default_info = {
0, NULL, default_value_info
};
if (desc->bLength < 13 || desc->bLength < 13 + num_ins ||
desc->bLength < num_ins + uac_processing_unit_bControlSize(desc, state->mixer->protocol)) {
usb_audio_err(state->chip, "invalid %s descriptor (id %d)\n", name, unitid);
return -EINVAL;
}
for (i = 0; i < num_ins; i++) {
if ((err = parse_audio_unit(state, desc->baSourceID[i])) < 0)
return err;
}
type = le16_to_cpu(desc->wProcessType);
for (info = list; info && info->type; info++)
if (info->type == type)
break;
if (!info || !info->type)
info = &default_info;
for (valinfo = info->values; valinfo->control; valinfo++) {
__u8 *controls = uac_processing_unit_bmControls(desc, state->mixer->protocol);
if (!(controls[valinfo->control / 8] & (1 << ((valinfo->control % 8) - 1))))
continue;
map = find_map(state, unitid, valinfo->control);
if (check_ignored_ctl(map))
continue;
cval = kzalloc(sizeof(*cval), GFP_KERNEL);
if (!cval)
return -ENOMEM;
snd_usb_mixer_elem_init_std(&cval->head, state->mixer, unitid);
cval->control = valinfo->control;
cval->val_type = valinfo->val_type;
cval->channels = 1;
/* get min/max values */
if (type == UAC_PROCESS_UP_DOWNMIX && cval->control == UAC_UD_MODE_SELECT) {
__u8 *control_spec = uac_processing_unit_specific(desc, state->mixer->protocol);
/* FIXME: hard-coded */
cval->min = 1;
cval->max = control_spec[0];
cval->res = 1;
cval->initialized = 1;
} else {
if (type == USB_XU_CLOCK_RATE) {
/*
* E-Mu USB 0404/0202/TrackerPre/0204
* samplerate control quirk
*/
cval->min = 0;
cval->max = 5;
cval->res = 1;
cval->initialized = 1;
} else
get_min_max(cval, valinfo->min_value);
}
kctl = snd_ctl_new1(&mixer_procunit_ctl, cval);
if (!kctl) {
kfree(cval);
return -ENOMEM;
}
kctl->private_free = snd_usb_mixer_elem_free;
if (check_mapped_name(map, kctl->id.name, sizeof(kctl->id.name))) {
/* nothing */ ;
} else if (info->name) {
strlcpy(kctl->id.name, info->name, sizeof(kctl->id.name));
} else {
nameid = uac_processing_unit_iProcessing(desc, state->mixer->protocol);
len = 0;
if (nameid)
len = snd_usb_copy_string_desc(state, nameid,
kctl->id.name,
sizeof(kctl->id.name));
if (!len)
strlcpy(kctl->id.name, name, sizeof(kctl->id.name));
}
append_ctl_name(kctl, " ");
append_ctl_name(kctl, valinfo->suffix);
usb_audio_dbg(state->chip,
"[%d] PU [%s] ch = %d, val = %d/%d\n",
cval->head.id, kctl->id.name, cval->channels,
cval->min, cval->max);
err = snd_usb_mixer_add_control(&cval->head, kctl);
if (err < 0)
return err;
}
return 0;
}
| 10,947
|
69,806
| 0
|
node_ipv6_dir_preferred(const node_t *node)
{
const or_options_t *options = get_options();
tor_addr_port_t ipv4_addr;
node_assert_ok(node);
/* node->ipv6_preferred is set from fascist_firewall_prefer_ipv6_orport(),
* so we can't use it to determine DirPort IPv6 preference.
* This means that bridge clients will use IPv4 DirPorts by default.
*/
if (!fascist_firewall_use_ipv6(options)) {
return 0;
} else if (node_get_prim_dirport(node, &ipv4_addr)
|| fascist_firewall_prefer_ipv6_dirport(get_options())) {
return node_has_ipv6_dirport(node);
}
return 0;
}
| 10,948
|
127,534
| 0
|
void LayerWebKitThread::setFrame(const FloatRect& rect)
{
if (rect == m_frame)
return;
m_frame = rect;
setNeedsDisplay();
}
| 10,949
|
154,675
| 0
|
error::Error GLES2DecoderPassthroughImpl::DoGetActiveUniformBlockiv(
GLuint program,
GLuint index,
GLenum pname,
GLsizei bufSize,
GLsizei* length,
GLint* params) {
api()->glGetActiveUniformBlockivRobustANGLEFn(
GetProgramServiceID(program, resources_), index, pname, bufSize, length,
params);
return error::kNoError;
}
| 10,950
|
172,122
| 0
|
static uint16_t transmit_data(serial_data_type_t type, uint8_t *data, uint16_t length) {
if (type == DATA_TYPE_ACL) {
return transmit_data_on(uart_fds[CH_ACL_OUT], data, length);
} else if (type == DATA_TYPE_COMMAND) {
return transmit_data_on(uart_fds[CH_CMD], data, length);
}
LOG_ERROR("%s invalid data type: %d", __func__, type);
return 0;
}
| 10,951
|
83,477
| 0
|
void __init idt_setup_early_traps(void)
{
idt_setup_from_table(idt_table, early_idts, ARRAY_SIZE(early_idts),
true);
load_idt(&idt_descr);
}
| 10,952
|
174,950
| 0
|
void CameraClient::handleGenericData(int32_t msgType,
const sp<IMemory>& dataPtr, camera_frame_metadata_t *metadata) {
sp<ICameraClient> c = mRemoteCallback;
mLock.unlock();
if (c != 0) {
c->dataCallback(msgType, dataPtr, metadata);
}
}
| 10,953
|
31,047
| 0
|
static int rtnl_getlink(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
{
struct net *net = sock_net(skb->sk);
struct ifinfomsg *ifm;
char ifname[IFNAMSIZ];
struct nlattr *tb[IFLA_MAX+1];
struct net_device *dev = NULL;
struct sk_buff *nskb;
int err;
u32 ext_filter_mask = 0;
err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy);
if (err < 0)
return err;
if (tb[IFLA_IFNAME])
nla_strlcpy(ifname, tb[IFLA_IFNAME], IFNAMSIZ);
if (tb[IFLA_EXT_MASK])
ext_filter_mask = nla_get_u32(tb[IFLA_EXT_MASK]);
ifm = nlmsg_data(nlh);
if (ifm->ifi_index > 0)
dev = __dev_get_by_index(net, ifm->ifi_index);
else if (tb[IFLA_IFNAME])
dev = __dev_get_by_name(net, ifname);
else
return -EINVAL;
if (dev == NULL)
return -ENODEV;
nskb = nlmsg_new(if_nlmsg_size(dev, ext_filter_mask), GFP_KERNEL);
if (nskb == NULL)
return -ENOBUFS;
err = rtnl_fill_ifinfo(nskb, dev, RTM_NEWLINK, NETLINK_CB(skb).portid,
nlh->nlmsg_seq, 0, 0, ext_filter_mask);
if (err < 0) {
/* -EMSGSIZE implies BUG in if_nlmsg_size */
WARN_ON(err == -EMSGSIZE);
kfree_skb(nskb);
} else
err = rtnl_unicast(nskb, net, NETLINK_CB(skb).portid);
return err;
}
| 10,954
|
79,507
| 0
|
static int nntp_mbox_sync(struct Context *ctx, int *index_hint)
{
struct NntpData *nntp_data = ctx->data;
int rc;
#ifdef USE_HCACHE
header_cache_t *hc = NULL;
#endif
/* check for new articles */
nntp_data->nserv->check_time = 0;
rc = check_mailbox(ctx);
if (rc)
return rc;
#ifdef USE_HCACHE
nntp_data->last_cached = 0;
hc = nntp_hcache_open(nntp_data);
#endif
for (int i = 0; i < ctx->msgcount; i++)
{
struct Header *hdr = ctx->hdrs[i];
char buf[16];
snprintf(buf, sizeof(buf), "%d", NHDR(hdr)->article_num);
if (nntp_data->bcache && hdr->deleted)
{
mutt_debug(2, "mutt_bcache_del %s\n", buf);
mutt_bcache_del(nntp_data->bcache, buf);
}
#ifdef USE_HCACHE
if (hc && (hdr->changed || hdr->deleted))
{
if (hdr->deleted && !hdr->read)
nntp_data->unread--;
mutt_debug(2, "mutt_hcache_store %s\n", buf);
mutt_hcache_store(hc, buf, strlen(buf), hdr, 0);
}
#endif
}
#ifdef USE_HCACHE
if (hc)
{
mutt_hcache_close(hc);
nntp_data->last_cached = nntp_data->last_loaded;
}
#endif
/* save .newsrc entries */
nntp_newsrc_gen_entries(ctx);
nntp_newsrc_update(nntp_data->nserv);
nntp_newsrc_close(nntp_data->nserv);
return 0;
}
| 10,955
|
38,110
| 0
|
static int kye_probe(struct hid_device *hdev, const struct hid_device_id *id)
{
int ret;
ret = hid_parse(hdev);
if (ret) {
hid_err(hdev, "parse failed\n");
goto err;
}
ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
if (ret) {
hid_err(hdev, "hw start failed\n");
goto err;
}
switch (id->product) {
case USB_DEVICE_ID_KYE_EASYPEN_I405X:
case USB_DEVICE_ID_KYE_MOUSEPEN_I608X:
case USB_DEVICE_ID_KYE_EASYPEN_M610X:
ret = kye_tablet_enable(hdev);
if (ret) {
hid_err(hdev, "tablet enabling failed\n");
goto enabling_err;
}
break;
case USB_DEVICE_ID_GENIUS_MANTICORE:
/*
* The manticore keyboard needs to have all the interfaces
* opened at least once to be fully functional.
*/
if (hid_hw_open(hdev))
hid_hw_close(hdev);
break;
}
return 0;
enabling_err:
hid_hw_stop(hdev);
err:
return ret;
}
| 10,956
|
175,959
| 0
|
void smp_send_pair_rsp(tSMP_CB* p_cb, tSMP_INT_DATA* p_data) {
SMP_TRACE_DEBUG("%s", __func__);
p_cb->local_i_key &= p_cb->peer_i_key;
p_cb->local_r_key &= p_cb->peer_r_key;
if (smp_send_cmd(SMP_OPCODE_PAIRING_RSP, p_cb)) {
if (p_cb->selected_association_model == SMP_MODEL_SEC_CONN_OOB)
smp_use_oob_private_key(p_cb, NULL);
else
smp_decide_association_model(p_cb, NULL);
}
}
| 10,957
|
75,389
| 0
|
static int opfcmov(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
char* fcmov = op->mnemonic + strlen("fcmov");
switch (op->operands_count) {
case 2:
if ( op->operands[0].type & OT_FPUREG & ~OT_REGALL && op->operands[0].reg == 0 &&
op->operands[1].type & OT_FPUREG & ~OT_REGALL ) {
if ( !strcmp( fcmov, "b" ) ) {
data[l++] = 0xda;
data[l++] = 0xc0 | op->operands[1].reg;
} else if ( !strcmp( fcmov, "e" ) ) {
data[l++] = 0xda;
data[l++] = 0xc8 | op->operands[1].reg;
} else if ( !strcmp( fcmov, "be" ) ) {
data[l++] = 0xda;
data[l++] = 0xd0 | op->operands[1].reg;
} else if ( !strcmp( fcmov, "u" ) ) {
data[l++] = 0xda;
data[l++] = 0xd8 | op->operands[1].reg;
} else if ( !strcmp( fcmov, "nb" ) ) {
data[l++] = 0xdb;
data[l++] = 0xc0 | op->operands[1].reg;
} else if ( !strcmp( fcmov, "ne" ) ) {
data[l++] = 0xdb;
data[l++] = 0xc8 | op->operands[1].reg;
} else if ( !strcmp( fcmov, "nbe" ) ) {
data[l++] = 0xdb;
data[l++] = 0xd0 | op->operands[1].reg;
} else if ( !strcmp( fcmov, "nu" ) ) {
data[l++] = 0xdb;
data[l++] = 0xd8 | op->operands[1].reg;
} else {
return -1;
}
} else {
return -1;
}
break;
default:
return -1;
}
return l;
}
| 10,958
|
22,042
| 0
|
raptor_rss_parse_chunk(raptor_parser* rdf_parser,
const unsigned char *s, size_t len,
int is_end)
{
raptor_rss_parser* rss_parser = (raptor_rss_parser*)rdf_parser->context;
if(rdf_parser->failed)
return 1;
raptor_sax2_parse_chunk(rss_parser->sax2, s, len, is_end);
if(!is_end)
return 0;
if(rdf_parser->failed)
return 1;
/* turn strings into URIs, move things around if needed */
if(raptor_rss_insert_identifiers(rdf_parser)) {
rdf_parser->failed = 1;
return 1;
}
/* add some new fields */
raptor_rss_uplift_items(rdf_parser);
/* find out what namespaces to declare and start them */
raptor_rss_start_namespaces(rdf_parser);
/* generate the triples */
raptor_rss_emit(rdf_parser);
return 0;
}
| 10,959
|
67,465
| 0
|
const char *vfs_get_link(struct dentry *dentry, struct delayed_call *done)
{
const char *res = ERR_PTR(-EINVAL);
struct inode *inode = d_inode(dentry);
if (d_is_symlink(dentry)) {
res = ERR_PTR(security_inode_readlink(dentry));
if (!res)
res = inode->i_op->get_link(dentry, inode, done);
}
return res;
}
| 10,960
|
50,820
| 0
|
isoent_clone_tree(struct archive_write *a, struct isoent **nroot,
struct isoent *root)
{
struct isoent *np, *xroot, *newent;
np = root;
xroot = NULL;
do {
newent = isoent_clone(np);
if (newent == NULL) {
archive_set_error(&a->archive, ENOMEM,
"Can't allocate memory");
return (ARCHIVE_FATAL);
}
if (xroot == NULL) {
*nroot = xroot = newent;
newent->parent = xroot;
} else
isoent_add_child_tail(xroot, newent);
if (np->dir && np->children.first != NULL) {
/* Enter to sub directories. */
np = np->children.first;
xroot = newent;
continue;
}
while (np != np->parent) {
if (np->chnext == NULL) {
/* Return to the parent directory. */
np = np->parent;
xroot = xroot->parent;
} else {
np = np->chnext;
break;
}
}
} while (np != np->parent);
return (ARCHIVE_OK);
}
| 10,961
|
159,534
| 0
|
bool WebGLImageConversion::PackImageData(
Image* image,
const void* pixels,
GLenum format,
GLenum type,
bool flip_y,
AlphaOp alpha_op,
DataFormat source_format,
unsigned source_image_width,
unsigned source_image_height,
const IntRect& source_image_sub_rectangle,
int depth,
unsigned source_unpack_alignment,
int unpack_image_height,
Vector<uint8_t>& data) {
if (!pixels)
return false;
unsigned packed_size;
PixelStoreParams params;
params.alignment = 1;
if (ComputeImageSizeInBytes(format, type, source_image_sub_rectangle.Width(),
source_image_sub_rectangle.Height(), depth,
params, &packed_size, nullptr,
nullptr) != GL_NO_ERROR)
return false;
data.resize(packed_size);
return PackPixels(reinterpret_cast<const uint8_t*>(pixels), source_format,
source_image_width, source_image_height,
source_image_sub_rectangle, depth, source_unpack_alignment,
unpack_image_height, format, type, alpha_op, data.data(),
flip_y);
}
| 10,962
|
52,572
| 0
|
static int is_idle_stream_id(h2o_http2_conn_t *conn, uint32_t stream_id)
{
return (h2o_http2_stream_is_push(stream_id) ? conn->push_stream_ids.max_open : conn->pull_stream_ids.max_open) < stream_id;
}
| 10,963
|
105,325
| 0
|
AutofillManager::AutofillManager(TabContentsWrapper* tab_contents,
PersonalDataManager* personal_data)
: TabContentsObserver(tab_contents->tab_contents()),
tab_contents_wrapper_(tab_contents),
personal_data_(personal_data),
download_manager_(NULL),
disable_download_manager_requests_(true),
metric_logger_(new AutofillMetrics),
has_logged_autofill_enabled_(false),
has_logged_address_suggestions_count_(false) {
DCHECK(tab_contents);
}
| 10,964
|
163,970
| 0
|
std::string PaymentRequestState::GetAuthenticatedEmail() const {
return payment_request_delegate_->GetAuthenticatedEmail();
}
| 10,965
|
93,271
| 0
|
static ssize_t tun_chr_write_iter(struct kiocb *iocb, struct iov_iter *from)
{
struct file *file = iocb->ki_filp;
struct tun_struct *tun = tun_get(file);
struct tun_file *tfile = file->private_data;
ssize_t result;
if (!tun)
return -EBADFD;
result = tun_get_user(tun, tfile, NULL, from,
file->f_flags & O_NONBLOCK, false);
tun_put(tun);
return result;
}
| 10,966
|
157,524
| 0
|
TestDataReductionProxyConfig::GetInFlightWarmupProxyDetails() const {
if (in_flight_warmup_proxy_details_)
return in_flight_warmup_proxy_details_;
return DataReductionProxyConfig::GetInFlightWarmupProxyDetails();
}
| 10,967
|
119,695
| 0
|
void RenderBlock::updateShapeAndSegmentsForCurrentLineInFlowThread(ShapeInsideInfo*& shapeInsideInfo, LineLayoutState& layoutState)
{
ASSERT(layoutState.flowThread());
LayoutUnit lineHeight = this->lineHeight(layoutState.lineInfo().isFirstLine(), isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes);
RenderRegion* currentRegion = regionAtBlockOffset(logicalHeight());
if (!currentRegion)
return;
shapeInsideInfo = currentRegion->shapeInsideInfo();
LayoutUnit logicalLineTopInFlowThread = logicalHeight() + offsetFromLogicalTopOfFirstPage();
LayoutUnit logicalLineBottomInFlowThread = logicalLineTopInFlowThread + lineHeight;
LayoutUnit logicalRegionTopInFlowThread = currentRegion->logicalTopForFlowThreadContent();
LayoutUnit logicalRegionBottomInFlowThread = logicalRegionTopInFlowThread + currentRegion->logicalHeight() - currentRegion->borderAndPaddingBefore() - currentRegion->borderAndPaddingAfter();
if (!shapeInsideInfo && !currentRegion->isLastRegion()) {
LayoutUnit deltaToNextRegion = logicalHeight() + logicalRegionBottomInFlowThread - logicalLineTopInFlowThread;
RenderRegion* lookupForNextRegion = regionAtBlockOffset(logicalHeight() + deltaToNextRegion);
if (!lookupForNextRegion->shapeInsideInfo())
return;
}
LayoutUnit shapeBottomInFlowThread = LayoutUnit::max();
if (shapeInsideInfo)
shapeBottomInFlowThread = shapeInsideInfo->shapeLogicalBottom() + currentRegion->logicalTopForFlowThreadContent();
RenderRegion* nextRegion = regionAtBlockOffset(logicalHeight() + lineHeight);
if ((currentRegion != nextRegion && (logicalLineBottomInFlowThread > logicalRegionBottomInFlowThread)) || (!currentRegion->isLastRegion() && shapeBottomInFlowThread < logicalLineBottomInFlowThread)) {
LayoutUnit deltaToNextRegion = logicalRegionBottomInFlowThread - logicalLineTopInFlowThread;
nextRegion = regionAtBlockOffset(logicalHeight() + deltaToNextRegion);
ASSERT(currentRegion != nextRegion);
shapeInsideInfo = nextRegion->shapeInsideInfo();
setLogicalHeight(logicalHeight() + deltaToNextRegion);
currentRegion = nextRegion;
logicalLineTopInFlowThread = logicalHeight() + offsetFromLogicalTopOfFirstPage();
logicalLineBottomInFlowThread = logicalLineTopInFlowThread + lineHeight;
logicalRegionTopInFlowThread = currentRegion->logicalTopForFlowThreadContent();
logicalRegionBottomInFlowThread = logicalRegionTopInFlowThread + currentRegion->logicalHeight() - currentRegion->borderAndPaddingBefore() - currentRegion->borderAndPaddingAfter();
}
if (!shapeInsideInfo)
return;
if (logicalLineBottomInFlowThread <= (logicalRegionTopInFlowThread + lineHeight) || (logicalLineTopInFlowThread - logicalRegionTopInFlowThread) < (layoutState.adjustedLogicalLineTop() - currentRegion->borderAndPaddingBefore())) {
LayoutUnit shapeTopOffset = layoutState.adjustedLogicalLineTop();
if (!shapeTopOffset)
shapeTopOffset = shapeInsideInfo->shapeLogicalTop();
LayoutUnit shapePositionInFlowThread = currentRegion->logicalTopForFlowThreadContent() + shapeTopOffset;
LayoutUnit shapeTopLineTopDelta = shapePositionInFlowThread - logicalLineTopInFlowThread - currentRegion->borderAndPaddingBefore();
setLogicalHeight(logicalHeight() + shapeTopLineTopDelta);
logicalLineTopInFlowThread += shapeTopLineTopDelta;
layoutState.setAdjustedLogicalLineTop(0);
}
LayoutUnit lineTop = logicalLineTopInFlowThread - currentRegion->logicalTopForFlowThreadContent() + currentRegion->borderAndPaddingBefore();
shapeInsideInfo->computeSegmentsForLine(lineTop, lineHeight);
if (currentRegion->isLastRegion())
pushShapeContentOverflowBelowTheContentBox(this, shapeInsideInfo, lineTop, lineHeight);
}
| 10,968
|
141,140
| 0
|
static bool IsValidElementName(Document* document, const String& name) {
bool is_valid_dom_name = Document::IsValidName(name);
bool is_valid_html_name = IsValidElementNamePerHTMLParser(name);
if (UNLIKELY(is_valid_html_name != is_valid_dom_name)) {
UseCounter::Count(document,
is_valid_dom_name
? WebFeature::kElementNameDOMValidHTMLParserInvalid
: WebFeature::kElementNameDOMInvalidHTMLParserValid);
}
return is_valid_dom_name;
}
| 10,969
|
138,523
| 0
|
void WorkerThread::terminateAndWait()
{
stop();
m_terminationEvent->wait();
}
| 10,970
|
151,244
| 0
|
void InspectorPageAgent::FrameStoppedLoading(LocalFrame* frame) {
GetFrontend()->frameStoppedLoading(IdentifiersFactory::FrameId(frame));
}
| 10,971
|
40,558
| 0
|
static struct sock *netlink_seq_socket_idx(struct seq_file *seq, loff_t pos)
{
struct nl_seq_iter *iter = seq->private;
int i, j;
struct sock *s;
loff_t off = 0;
for (i = 0; i < MAX_LINKS; i++) {
struct nl_portid_hash *hash = &nl_table[i].hash;
for (j = 0; j <= hash->mask; j++) {
sk_for_each(s, &hash->table[j]) {
if (sock_net(s) != seq_file_net(seq))
continue;
if (off == pos) {
iter->link = i;
iter->hash_idx = j;
return s;
}
++off;
}
}
}
return NULL;
}
| 10,972
|
91,368
| 0
|
static MagickBooleanType ReadPSDChannelPixels(Image *image,
const size_t channels,const ssize_t row,const ssize_t type,
const unsigned char *pixels,ExceptionInfo *exception)
{
Quantum
pixel;
register const unsigned char
*p;
register Quantum
*q;
register ssize_t
x;
size_t
packet_size;
p=pixels;
q=GetAuthenticPixels(image,0,row,image->columns,1,exception);
if (q == (Quantum *) NULL)
return MagickFalse;
packet_size=GetPSDPacketSize(image);
for (x=0; x < (ssize_t) image->columns; x++)
{
if (packet_size == 1)
pixel=ScaleCharToQuantum(*p++);
else if (packet_size == 2)
{
unsigned short
nibble;
p=PushShortPixel(MSBEndian,p,&nibble);
pixel=ScaleShortToQuantum(nibble);
}
else
{
MagickFloatType
nibble;
p=PushFloatPixel(MSBEndian,p,&nibble);
pixel=ClampToQuantum((MagickRealType)QuantumRange*nibble);
}
if (image->depth > 1)
{
SetPSDPixel(image,channels,type,packet_size,pixel,q,exception);
q+=GetPixelChannels(image);
}
else
{
ssize_t
bit,
number_bits;
number_bits=(ssize_t) image->columns-x;
if (number_bits > 8)
number_bits=8;
for (bit = 0; bit < (ssize_t) number_bits; bit++)
{
SetPSDPixel(image,channels,type,packet_size,(((unsigned char) pixel)
& (0x01 << (7-bit))) != 0 ? 0 : QuantumRange,q,exception);
q+=GetPixelChannels(image);
x++;
}
if (x != (ssize_t) image->columns)
x--;
continue;
}
}
return(SyncAuthenticPixels(image,exception));
}
| 10,973
|
138,520
| 0
|
void WorkerThread::stop()
{
SafePointScope safePointScope(ThreadState::HeapPointersOnStack);
stopInternal();
}
| 10,974
|
127,382
| 0
|
void StyleResolver::initWatchedSelectorRules(const Vector<RefPtr<StyleRule> >& watchedSelectors)
{
if (!watchedSelectors.size())
return;
m_watchedSelectorsRules = RuleSet::create();
for (unsigned i = 0; i < watchedSelectors.size(); ++i)
m_watchedSelectorsRules->addStyleRule(watchedSelectors[i].get(), RuleHasNoSpecialState);
}
| 10,975
|
8,860
| 0
|
static inline void vrend_fill_shader_key(struct vrend_context *ctx,
struct vrend_shader_key *key)
{
if (vrend_state.use_core_profile == true) {
int i;
bool add_alpha_test = true;
key->cbufs_are_a8_bitmask = 0;
for (i = 0; i < ctx->sub->nr_cbufs; i++) {
if (!ctx->sub->surf[i])
continue;
if (vrend_format_is_emulated_alpha(ctx->sub->surf[i]->format))
key->cbufs_are_a8_bitmask |= (1 << i);
if (util_format_is_pure_integer(ctx->sub->surf[i]->format))
add_alpha_test = false;
}
if (add_alpha_test) {
key->add_alpha_test = ctx->sub->dsa_state.alpha.enabled;
key->alpha_test = ctx->sub->dsa_state.alpha.func;
key->alpha_ref_val = ctx->sub->dsa_state.alpha.ref_value;
}
key->pstipple_tex = ctx->sub->rs_state.poly_stipple_enable;
key->color_two_side = ctx->sub->rs_state.light_twoside;
key->clip_plane_enable = ctx->sub->rs_state.clip_plane_enable;
key->flatshade = ctx->sub->rs_state.flatshade ? true : false;
} else {
key->add_alpha_test = 0;
key->pstipple_tex = 0;
}
key->invert_fs_origin = !ctx->sub->inverted_fbo_content;
key->coord_replace = ctx->sub->rs_state.point_quad_rasterization ? ctx->sub->rs_state.sprite_coord_enable : 0;
if (ctx->sub->shaders[PIPE_SHADER_GEOMETRY])
key->gs_present = true;
}
| 10,976
|
137,691
| 0
|
void PrintPreviewMessageHandler::OnInvalidPrinterSettings(int document_cookie) {
StopWorker(document_cookie);
PrintPreviewUI* print_preview_ui = GetPrintPreviewUI();
if (!print_preview_ui)
return;
print_preview_ui->OnInvalidPrinterSettings();
}
| 10,977
|
80,164
| 0
|
void hdlr_del(GF_Box *s)
{
GF_HandlerBox *ptr = (GF_HandlerBox *)s;
if (ptr == NULL) return;
if (ptr->nameUTF8) gf_free(ptr->nameUTF8);
gf_free(ptr);
}
| 10,978
|
95,949
| 0
|
void CL_Clientinfo_f( void ) {
Com_Printf( "--------- Client Information ---------\n" );
Com_Printf( "state: %i\n", clc.state );
Com_Printf( "Server: %s\n", clc.servername );
Com_Printf ("User info settings:\n");
Info_Print( Cvar_InfoString( CVAR_USERINFO ) );
Com_Printf( "--------------------------------------\n" );
}
| 10,979
|
98,613
| 0
|
void ThumbnailGenerator::EraseHostFromShownList(RenderWidgetHost* widget) {
std::vector<RenderWidgetHost*>::iterator found =
std::find(shown_hosts_.begin(), shown_hosts_.end(), widget);
if (found != shown_hosts_.end())
shown_hosts_.erase(found);
}
| 10,980
|
127,960
| 0
|
void BrowserViewRenderer::SetDipScale(float dip_scale) {
dip_scale_ = dip_scale;
CHECK_GT(dip_scale_, 0.f);
}
| 10,981
|
148,622
| 0
|
void SkiaOutputSurfaceImpl::AddContextLostObserver(
ContextLostObserver* observer) {
observers_.AddObserver(observer);
}
| 10,982
|
21,538
| 0
|
SYSCALL_DEFINE4(prlimit64, pid_t, pid, unsigned int, resource,
const struct rlimit64 __user *, new_rlim,
struct rlimit64 __user *, old_rlim)
{
struct rlimit64 old64, new64;
struct rlimit old, new;
struct task_struct *tsk;
int ret;
if (new_rlim) {
if (copy_from_user(&new64, new_rlim, sizeof(new64)))
return -EFAULT;
rlim64_to_rlim(&new64, &new);
}
rcu_read_lock();
tsk = pid ? find_task_by_vpid(pid) : current;
if (!tsk) {
rcu_read_unlock();
return -ESRCH;
}
ret = check_prlimit_permission(tsk);
if (ret) {
rcu_read_unlock();
return ret;
}
get_task_struct(tsk);
rcu_read_unlock();
ret = do_prlimit(tsk, resource, new_rlim ? &new : NULL,
old_rlim ? &old : NULL);
if (!ret && old_rlim) {
rlim_to_rlim64(&old, &old64);
if (copy_to_user(old_rlim, &old64, sizeof(old64)))
ret = -EFAULT;
}
put_task_struct(tsk);
return ret;
}
| 10,983
|
134,129
| 0
|
void InputMethodIMM32::OnDidChangeFocusedClient(TextInputClient* focused_before,
TextInputClient* focused) {
if (IsWindowFocused(focused)) {
OnTextInputTypeChanged(focused);
UpdateIMEState();
OnCaretBoundsChanged(focused);
}
}
| 10,984
|
157,337
| 0
|
void WebMediaPlayerImpl::SuspendForRemote() {
video_decode_stats_reporter_.reset();
if (pipeline_controller_.IsPipelineSuspended() &&
!IsNewRemotePlaybackPipelineEnabled()) {
scoped_refptr<VideoFrame> frame = cast_impl_.GetCastingBanner();
if (frame)
compositor_->PaintSingleFrame(frame);
}
UpdatePlayState();
}
| 10,985
|
75,828
| 0
|
lvs_flush_handler(__attribute__((unused)) vector_t *strvec)
{
global_data->lvs_flush = true;
}
| 10,986
|
89,398
| 0
|
int trace_list_calls(void *buff, size_t buff_size, size_t *needed)
{
struct trace_output_hdr *output_hdr = NULL;
void *end, *ptr = buff;
size_t rec, upto;
size_t count;
end = buff ? buff + buff_size : NULL;
/* Place some header information */
if (ptr + sizeof(struct trace_output_hdr) < end)
output_hdr = ptr;
ptr += sizeof(struct trace_output_hdr);
/* Add information about each call */
count = hdr->ftrace_count;
if (count > hdr->ftrace_size)
count = hdr->ftrace_size;
for (rec = upto = 0; rec < count; rec++) {
if (ptr + sizeof(struct trace_call) < end) {
struct trace_call *call = &hdr->ftrace[rec];
struct trace_call *out = ptr;
out->func = call->func * FUNC_SITE_SIZE;
out->caller = call->caller * FUNC_SITE_SIZE;
out->flags = call->flags;
upto++;
}
ptr += sizeof(struct trace_call);
}
/* Update the header */
if (output_hdr) {
output_hdr->rec_count = upto;
output_hdr->type = TRACE_CHUNK_CALLS;
}
/* Work out how must of the buffer we used */
*needed = ptr - buff;
if (ptr > end)
return -ENOSPC;
return 0;
}
| 10,987
|
38,354
| 0
|
static struct cm_timewait_info * cm_create_timewait_info(__be32 local_id)
{
struct cm_timewait_info *timewait_info;
timewait_info = kzalloc(sizeof *timewait_info, GFP_KERNEL);
if (!timewait_info)
return ERR_PTR(-ENOMEM);
timewait_info->work.local_id = local_id;
INIT_DELAYED_WORK(&timewait_info->work.work, cm_work_handler);
timewait_info->work.cm_event.event = IB_CM_TIMEWAIT_EXIT;
return timewait_info;
}
| 10,988
|
103,220
| 0
|
void Browser::UpdateCommandsForTabState() {
TabContents* current_tab = GetSelectedTabContents();
TabContentsWrapper* current_tab_wrapper = GetSelectedTabContentsWrapper();
if (!current_tab || !current_tab_wrapper) // May be NULL during tab restore.
return;
NavigationController& nc = current_tab->controller();
command_updater_.UpdateCommandEnabled(IDC_BACK, nc.CanGoBack());
command_updater_.UpdateCommandEnabled(IDC_FORWARD, nc.CanGoForward());
command_updater_.UpdateCommandEnabled(IDC_RELOAD,
CanReloadContents(current_tab));
command_updater_.UpdateCommandEnabled(IDC_RELOAD_IGNORING_CACHE,
CanReloadContents(current_tab));
bool non_app_window = !(type() & TYPE_APP);
command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB,
non_app_window && CanDuplicateContentsAt(active_index()));
window_->SetStarredState(current_tab_wrapper->is_starred());
command_updater_.UpdateCommandEnabled(IDC_VIEW_SOURCE,
current_tab->controller().CanViewSource());
command_updater_.UpdateCommandEnabled(IDC_EMAIL_PAGE_LOCATION,
current_tab->ShouldDisplayURL() && current_tab->GetURL().is_valid());
NavigationEntry* active_entry = nc.GetActiveEntry();
bool is_chrome_internal = (active_entry ?
active_entry->url().SchemeIs(chrome::kChromeUIScheme) : false);
command_updater_.UpdateCommandEnabled(IDC_ENCODING_MENU,
!is_chrome_internal && SavePackage::IsSavableContents(
current_tab->contents_mime_type()));
#if !defined(OS_MACOSX)
command_updater_.UpdateCommandEnabled(IDC_CREATE_SHORTCUTS,
web_app::IsValidUrl(current_tab->GetURL()));
#endif
UpdateCommandsForContentRestrictionState();
UpdateCommandsForBookmarkEditing();
}
| 10,989
|
123,612
| 0
|
void InspectorPageAgent::domContentLoadedEventFired(Frame* frame)
{
if (!frame->isMainFrame())
return;
m_frontend->domContentEventFired(currentTime());
}
| 10,990
|
17,703
| 0
|
DGACreateColormap(int index, ClientPtr client, int id, int mode, int alloc)
{
ScreenPtr pScreen = screenInfo.screens[index];
DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
FakedVisualList *fvlp;
VisualPtr pVisual;
DGAModePtr pMode;
ColormapPtr pmap;
if (!mode || (mode > pScreenPriv->numModes))
return BadValue;
if ((alloc != AllocNone) && (alloc != AllocAll))
return BadValue;
pMode = &(pScreenPriv->modes[mode - 1]);
if (!(pVisual = malloc(sizeof(VisualRec))))
return BadAlloc;
pVisual->vid = FakeClientID(0);
pVisual->class = pMode->visualClass;
pVisual->nplanes = pMode->depth;
pVisual->ColormapEntries = 1 << pMode->depth;
pVisual->bitsPerRGBValue = (pMode->depth + 2) / 3;
switch (pVisual->class) {
case PseudoColor:
case GrayScale:
case StaticGray:
pVisual->bitsPerRGBValue = 8; /* not quite */
pVisual->redMask = 0;
pVisual->greenMask = 0;
pVisual->blueMask = 0;
pVisual->offsetRed = 0;
pVisual->offsetGreen = 0;
pVisual->offsetBlue = 0;
break;
case DirectColor:
case TrueColor:
pVisual->ColormapEntries = 1 << pVisual->bitsPerRGBValue;
/* fall through */
case StaticColor:
pVisual->redMask = pMode->red_mask;
pVisual->greenMask = pMode->green_mask;
pVisual->blueMask = pMode->blue_mask;
pVisual->offsetRed = BitsClear(pVisual->redMask);
pVisual->offsetGreen = BitsClear(pVisual->greenMask);
pVisual->offsetBlue = BitsClear(pVisual->blueMask);
}
if (!(fvlp = malloc(sizeof(FakedVisualList)))) {
free(pVisual);
return BadAlloc;
}
fvlp->free = FALSE;
fvlp->pVisual = pVisual;
fvlp->next = pScreenPriv->fakedVisuals;
pScreenPriv->fakedVisuals = fvlp;
LEGAL_NEW_RESOURCE(id, client);
return CreateColormap(id, pScreen, pVisual, &pmap, alloc, client->index);
}
| 10,991
|
60,423
| 0
|
static int packet_seq_show(struct seq_file *seq, void *v)
{
if (v == SEQ_START_TOKEN)
seq_puts(seq, "sk RefCnt Type Proto Iface R Rmem User Inode\n");
else {
struct sock *s = sk_entry(v);
const struct packet_sock *po = pkt_sk(s);
seq_printf(seq,
"%pK %-6d %-4d %04x %-5d %1d %-6u %-6u %-6lu\n",
s,
refcount_read(&s->sk_refcnt),
s->sk_type,
ntohs(po->num),
po->ifindex,
po->running,
atomic_read(&s->sk_rmem_alloc),
from_kuid_munged(seq_user_ns(seq), sock_i_uid(s)),
sock_i_ino(s));
}
return 0;
}
| 10,992
|
141,006
| 0
|
V0CustomElementMicrotaskRunQueue* Document::CustomElementMicrotaskRunQueue() {
if (!custom_element_microtask_run_queue_)
custom_element_microtask_run_queue_ =
V0CustomElementMicrotaskRunQueue::Create();
return custom_element_microtask_run_queue_.Get();
}
| 10,993
|
69,043
| 0
|
static const StringInfo *GetAdditionalInformation(const ImageInfo *image_info,
Image *image,ExceptionInfo *exception)
{
#define PSDKeySize 5
#define PSDAllowedLength 36
char
key[PSDKeySize];
/* Whitelist of keys from: https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/ */
const char
allowed[PSDAllowedLength][PSDKeySize] = {
"blnc", "blwh", "brit", "brst", "clbl", "clrL", "curv", "expA", "FMsk",
"GdFl", "grdm", "hue ", "hue2", "infx", "knko", "lclr", "levl", "lnsr",
"lfx2", "luni", "lrFX", "lspf", "lyid", "lyvr", "mixr", "nvrt", "phfl",
"post", "PtFl", "selc", "shpa", "sn2P", "SoCo", "thrs", "tsly", "vibA"
},
*option;
const StringInfo
*info;
MagickBooleanType
found;
register size_t
i;
size_t
remaining_length,
length;
StringInfo
*profile;
unsigned char
*p;
unsigned int
size;
info=GetImageProfile(image,"psd:additional-info");
if (info == (const StringInfo *) NULL)
return((const StringInfo *) NULL);
option=GetImageOption(image_info,"psd:additional-info");
if (LocaleCompare(option,"all") == 0)
return(info);
if (LocaleCompare(option,"selective") != 0)
{
profile=RemoveImageProfile(image,"psd:additional-info");
return(DestroyStringInfo(profile));
}
length=GetStringInfoLength(info);
p=GetStringInfoDatum(info);
remaining_length=length;
length=0;
while (remaining_length >= 12)
{
/* skip over signature */
p+=4;
key[0]=(*p++);
key[1]=(*p++);
key[2]=(*p++);
key[3]=(*p++);
key[4]='\0';
size=(unsigned int) (*p++) << 24;
size|=(unsigned int) (*p++) << 16;
size|=(unsigned int) (*p++) << 8;
size|=(unsigned int) (*p++);
size=size & 0xffffffff;
remaining_length-=12;
if ((size_t) size > remaining_length)
return((const StringInfo *) NULL);
found=MagickFalse;
for (i=0; i < PSDAllowedLength; i++)
{
if (LocaleNCompare(key,allowed[i],PSDKeySize) != 0)
continue;
found=MagickTrue;
break;
}
remaining_length-=(size_t) size;
if (found == MagickFalse)
{
if (remaining_length > 0)
p=(unsigned char *) CopyMagickMemory(p-12,p+size,remaining_length);
continue;
}
length+=(size_t) size+12;
p+=size;
}
profile=RemoveImageProfile(image,"psd:additional-info");
if (length == 0)
return(DestroyStringInfo(profile));
SetStringInfoLength(profile,(const size_t) length);
SetImageProfile(image,"psd:additional-info",info,exception);
return(profile);
}
| 10,994
|
115,251
| 0
|
void OmniboxViewWin::OnMButtonDblClk(UINT /*keys*/, const CPoint& /*point*/) {
gaining_focus_.reset(); // See NOTE in OnMouseActivate().
}
| 10,995
|
95,220
| 0
|
static void imapd_refer(const char *tag,
const char *server,
const char *mailbox)
{
struct imapurl imapurl;
char url[MAX_MAILBOX_PATH+1];
memset(&imapurl, 0, sizeof(struct imapurl));
imapurl.server = server;
imapurl.mailbox = mailbox;
imapurl.auth = !strcmp(imapd_userid, "anonymous") ? "anonymous" : "*";
imapurl_toURL(url, &imapurl);
prot_printf(imapd_out, "%s NO [REFERRAL %s] Remote mailbox.\r\n",
tag, url);
free(imapurl.freeme);
}
| 10,996
|
74,725
| 0
|
static int check_bug_trap(struct pt_regs *regs)
{
struct bug_entry *bug;
unsigned long addr;
if (regs->msr & MSR_PR)
return 0; /* not in kernel */
addr = regs->nip; /* address of trap instruction */
if (addr < PAGE_OFFSET)
return 0;
bug = find_bug(regs->nip);
if (bug == NULL)
return 0;
if (bug->line & BUG_WARNING_TRAP) {
/* this is a WARN_ON rather than BUG/BUG_ON */
printk(KERN_ERR "Badness in %s at %s:%ld\n",
bug->function, bug->file,
bug->line & ~BUG_WARNING_TRAP);
dump_stack();
return 1;
}
printk(KERN_CRIT "kernel BUG in %s at %s:%ld!\n",
bug->function, bug->file, bug->line);
return 0;
}
| 10,997
|
175,828
| 0
|
static void ref_cnt_fb (int *buf, int *idx, int new_idx)
{
if (buf[*idx] > 0)
buf[*idx]--;
*idx = new_idx;
buf[new_idx]++;
}
| 10,998
|
70,872
| 0
|
static int parse_icy(HTTPContext *s, const char *tag, const char *p)
{
int len = 4 + strlen(p) + strlen(tag);
int is_first = !s->icy_metadata_headers;
int ret;
av_dict_set(&s->metadata, tag, p, 0);
if (s->icy_metadata_headers)
len += strlen(s->icy_metadata_headers);
if ((ret = av_reallocp(&s->icy_metadata_headers, len)) < 0)
return ret;
if (is_first)
*s->icy_metadata_headers = '\0';
av_strlcatf(s->icy_metadata_headers, len, "%s: %s\n", tag, p);
return 0;
}
| 10,999
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.