unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
|---|---|---|---|
131,289
| 0
|
static void conditionalLongAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
{
TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder());
v8SetReturnValueInt(info, imp->conditionalLongAttribute());
}
| 12,100
|
39,554
| 0
|
void license_generate_randoms(rdpLicense* license)
{
ZeroMemory(license->ClientRandom, CLIENT_RANDOM_LENGTH); /* ClientRandom */
ZeroMemory(license->PremasterSecret, PREMASTER_SECRET_LENGTH); /* PremasterSecret */
#ifndef LICENSE_NULL_CLIENT_RANDOM
crypto_nonce(license->ClientRandom, CLIENT_RANDOM_LENGTH); /* ClientRandom */
#endif
#ifndef LICENSE_NULL_PREMASTER_SECRET
crypto_nonce(license->PremasterSecret, PREMASTER_SECRET_LENGTH); /* PremasterSecret */
#endif
}
| 12,101
|
11,018
| 0
|
put_stringbuf_mem_skip (struct stringbuf *sb, const char *text, size_t n,
int skip)
{
char *p;
if (!skip)
{
put_stringbuf_mem (sb, text, n);
return;
}
if (sb->out_of_core)
return;
if (sb->len + n >= sb->size)
{
/* Note: we allocate too much here, but we don't care. */
sb->size += n + 100;
p = xtryrealloc (sb->buf, sb->size);
if ( !p)
{
sb->out_of_core = 1;
return;
}
sb->buf = p;
}
p = sb->buf+sb->len;
while (n > skip)
{
text += skip;
n -= skip;
*p++ = *text++;
n--;
sb->len++;
}
}
| 12,102
|
156,323
| 0
|
void MediaRecorder::ScheduleDispatchEvent(Event* event) {
scheduled_events_.push_back(event);
dispatch_scheduled_event_runner_->RunAsync();
}
| 12,103
|
121,512
| 0
|
bool WindowsRemoveFunction::RunImpl() {
int window_id = -1;
EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &window_id));
WindowController* controller;
if (!GetWindowFromWindowID(this, window_id, &controller))
return false;
#if defined(OS_WIN)
if (win8::IsSingleWindowMetroMode())
return false;
#endif
WindowController::Reason reason;
if (!controller->CanClose(&reason)) {
if (reason == WindowController::REASON_NOT_EDITABLE)
error_ = keys::kTabStripNotEditableError;
return false;
}
controller->window()->Close();
return true;
}
| 12,104
|
173,306
| 0
|
process_chunk(struct file *file, png_uint_32 file_crc, png_uint_32 next_length,
png_uint_32 next_type)
/* Called when the chunk data has been read, next_length and next_type
* will be set for the next chunk (or 0 if this is IEND).
*
* When this routine returns, chunk_length and chunk_type will be set for the
* next chunk to write because if a chunk is skipped this return calls back
* to read_chunk.
*/
{
const png_uint_32 type = file->type;
if (file->global->verbose > 1)
{
fputs(" ", stderr);
type_name(file->type, stderr);
fprintf(stderr, " %lu 0x%.8x 0x%.8x\n", (unsigned long)file->length,
file->crc ^ 0xffffffff, file_crc);
}
/* The basic structure seems correct but the CRC may not match, in this
* case assume that it is simply a bad CRC, either wrongly calculated or
* because of damaged stream data.
*/
if ((file->crc ^ 0xffffffff) != file_crc)
{
/* The behavior is set by the 'skip' setting; if it is anything other
* than SKIP_BAD_CRC ignore the bad CRC and return the chunk, with a
* corrected CRC and possibly processed, to libpng. Otherwise skip the
* chunk, which will result in a fatal error if the chunk is critical.
*/
file->status_code |= CRC_ERROR;
/* Ignore the bad CRC */
if (file->global->skip != SKIP_BAD_CRC)
type_message(file, type, "bad CRC");
/* This will cause an IEND with a bad CRC to stop */
else if (CRITICAL(type))
stop(file, READ_ERROR_CODE, "bad CRC in critical chunk");
else
{
type_message(file, type, "skipped: bad CRC");
/* NOTE: this cannot be reached for IEND because it is critical. */
goto skip_chunk;
}
}
/* Check for other 'skip' cases and handle these; these only apply to
* ancillary chunks (and not tRNS, which should probably have been a critical
* chunk.)
*/
if (skip_chunk_type(file->global, type))
goto skip_chunk;
/* The chunk may still be skipped if problems are detected in the LZ data,
* however the LZ data check requires a chunk. Handle this by instantiating
* a chunk unless an IDAT is already instantiated (IDAT control structures
* instantiate their own chunk.)
*/
if (type != png_IDAT)
file->alloc(file, 0/*chunk*/);
else if (file->idat == NULL)
file->alloc(file, 1/*IDAT*/);
else
{
/* The chunk length must be updated for process_IDAT */
assert(file->chunk != NULL);
assert(file->chunk->chunk_type == png_IDAT);
file->chunk->chunk_length = file->length;
}
/* Record the 'next' information too, now that the original values for
* this chunk have been copied. Notice that the IDAT chunks only make a
* copy of the position of the first chunk, this is fine - process_IDAT does
* not need the position of this chunk.
*/
file->length = next_length;
file->type = next_type;
getpos(file);
/* Do per-type processing, note that if this code does not return from the
* function the chunk will be skipped. The rewrite is cancelled here so that
* it can be set in the per-chunk processing.
*/
file->chunk->rewrite_length = 0;
file->chunk->rewrite_offset = 0;
switch (type)
{
default:
return;
case png_IHDR:
/* Read this now and update the control structure with the information
* it contains. The header is validated completely to ensure this is a
* PNG.
*/
{
struct chunk *chunk = file->chunk;
if (chunk->chunk_length != 13)
stop_invalid(file, "IHDR length");
/* Read all the IHDR information and validate it. */
setpos(chunk);
file->width = reread_4(file);
file->height = reread_4(file);
file->bit_depth = reread_byte(file);
file->color_type = reread_byte(file);
file->compression_method = reread_byte(file);
file->filter_method = reread_byte(file);
file->interlace_method = reread_byte(file);
/* This validates all the fields, and calls stop_invalid if
* there is a problem.
*/
calc_image_size(file);
}
return;
/* Ancillary chunks that require further processing: */
case png_zTXt: case png_iCCP:
if (process_zTXt_iCCP(file))
return;
chunk_end(&file->chunk);
file_setpos(file, &file->data_pos);
break;
case png_iTXt:
if (process_iTXt(file))
return;
chunk_end(&file->chunk);
file_setpos(file, &file->data_pos);
break;
case png_IDAT:
if (process_IDAT(file))
return;
/* First pass: */
assert(next_type == png_IDAT);
break;
}
/* Control reaches this point if the chunk must be skipped. For chunks other
* than IDAT this means that the zlib compressed data is fatally damanged and
* the chunk will not be passed to libpng. For IDAT it means that the end of
* the IDAT stream has not yet been reached and we must handle the next
* (IDAT) chunk. If the LZ data in an IDAT stream cannot be read 'stop' must
* be used to halt parsing of the PNG.
*/
read_chunk(file);
return;
/* This is the generic code to skip the current chunk; simply jump to the
* next one.
*/
skip_chunk:
file->length = next_length;
file->type = next_type;
getpos(file);
read_chunk(file);
}
| 12,105
|
96,873
| 0
|
SYSCALL_DEFINE4(tee, int, fdin, int, fdout, size_t, len, unsigned int, flags)
{
struct fd in;
int error;
if (unlikely(flags & ~SPLICE_F_ALL))
return -EINVAL;
if (unlikely(!len))
return 0;
error = -EBADF;
in = fdget(fdin);
if (in.file) {
if (in.file->f_mode & FMODE_READ) {
struct fd out = fdget(fdout);
if (out.file) {
if (out.file->f_mode & FMODE_WRITE)
error = do_tee(in.file, out.file,
len, flags);
fdput(out);
}
}
fdput(in);
}
return error;
}
| 12,106
|
39,813
| 0
|
n_tty_receive_buf_closing(struct tty_struct *tty, const unsigned char *cp,
char *fp, int count)
{
char flag = TTY_NORMAL;
while (count--) {
if (fp)
flag = *fp++;
if (likely(flag == TTY_NORMAL))
n_tty_receive_char_closing(tty, *cp++);
else
n_tty_receive_char_flagged(tty, *cp++, flag);
}
}
| 12,107
|
171,301
| 0
|
static int CompareSoftwareCodecsFirst(
const OMXCodec::CodecNameAndQuirks *elem1,
const OMXCodec::CodecNameAndQuirks *elem2) {
bool isOMX1 = !strncmp(elem1->mName.string(), "OMX.", 4);
bool isOMX2 = !strncmp(elem2->mName.string(), "OMX.", 4);
bool isSoftwareCodec1 = IsSoftwareCodec(elem1->mName.string());
bool isSoftwareCodec2 = IsSoftwareCodec(elem2->mName.string());
if (isSoftwareCodec1) {
if (!isSoftwareCodec2) { return -1; }
if (isOMX1) {
if (isOMX2) { return 0; }
return -1;
} else {
if (isOMX2) { return 0; }
return 1;
}
return -1;
}
if (isSoftwareCodec2) {
return 1;
}
return 0;
}
| 12,108
|
84,740
| 0
|
static void loop_queue_work(struct kthread_work *work)
{
struct loop_cmd *cmd =
container_of(work, struct loop_cmd, work);
loop_handle_cmd(cmd);
}
| 12,109
|
52,163
| 0
|
PHPAPI PHP_FUNCTION(fseek)
{
zval *arg1;
long arg2, whence = SEEK_SET;
php_stream *stream;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|l", &arg1, &arg2, &whence) == FAILURE) {
RETURN_FALSE;
}
PHP_STREAM_TO_ZVAL(stream, &arg1);
RETURN_LONG(php_stream_seek(stream, arg2, whence));
}
| 12,110
|
91,718
| 0
|
bool am_parse_paos_header(request_rec *r, const char *header,
ECPServiceOptions *options_return)
{
bool result = false;
ECPServiceOptions options = 0;
apr_array_header_t *tokens;
apr_size_t i;
char *error;
AM_LOG_RERROR(APLOG_MARK, APLOG_DEBUG, 0, r,
"PAOS header: \"%s\"", header);
tokens = tokenize(r->pool, header, true, &error);
#ifdef DEBUG
dump_tokens(r, tokens);
#endif
if (error) {
AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, "%s", error);
goto cleanup;
}
/* Header must begin with "ver=xxx" where xxx is paos version */
if (!is_token(tokens, 0, TOKEN_IDENTIFIER, "ver") ||
!is_token(tokens, 1, TOKEN_EQUAL, NULL) ||
!is_token(tokens, 2, TOKEN_DBL_QUOTE_STRING, LASSO_PAOS_HREF)) {
AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r,
"invalid PAOS header, "
"expected header to begin with ver=\"%s\", "
"actual header=\"%s\"",
LASSO_PAOS_HREF, header);
goto cleanup;
}
/* Next is the service value, separated from the version by a semicolon */
if (!is_token(tokens, 3, TOKEN_SEMICOLON, NULL)) {
AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r,
"invalid PAOS header, "
"expected semicolon after PAOS version "
"but found %s in header=\"%s\"",
parse_error_msg(tokens, 3),
header);
goto cleanup;
}
if (!is_token(tokens, 4, TOKEN_DBL_QUOTE_STRING, LASSO_ECP_HREF)) {
AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r,
"invalid PAOS header, "
"expected service token to be \"%s\", "
"but found %s in header=\"%s\"",
LASSO_ECP_HREF,
parse_error_msg(tokens, 4),
header);
goto cleanup;
}
/* After the service value there may be optional flags separated by commas */
if (tokens->nelts == 5) { /* no options */
result = true;
goto cleanup;
}
/* More tokens after the service value, must be options, iterate over them */
for (i = 5; i < tokens->nelts; i++) {
if (!is_token(tokens, i, TOKEN_COMMA, NULL)) {
AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r,
"invalid PAOS header, "
"expected comma after PAOS service "
"but found %s in header=\"%s\"",
parse_error_msg(tokens, i),
header);
goto cleanup;
}
if (++i > tokens->nelts) {
AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r,
"invalid PAOS header, "
"expected option after comma "
"in header=\"%s\"",
header);
goto cleanup;
}
Token token = APR_ARRAY_IDX(tokens, i, Token);
if (token.type != TOKEN_DBL_QUOTE_STRING) {
AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r,
"invalid PAOS header, "
"expected quoted string after comma "
"but found %s in header=\"%s\"",
parse_error_msg(tokens, i),
header);
goto cleanup;
}
/* Have an option string, convert it to a bit flag */
const char *value = token.str;
if (g_str_equal(value, LASSO_SAML_EXT_CHANNEL_BINDING)) {
options |= ECP_SERVICE_OPTION_CHANNEL_BINDING;
} else if (g_str_equal(value, LASSO_SAML2_CONFIRMATION_METHOD_HOLDER_OF_KEY)) {
options |= ECP_SERVICE_OPTION_HOLDER_OF_KEY;
} else if (g_str_equal(value, LASSO_SAML2_ECP_PROFILE_WANT_AUTHN_SIGNED)) {
options |= ECP_SERVICE_OPTION_WANT_AUTHN_SIGNED;
} else if (g_str_equal(value, LASSO_SAML2_CONDITIONS_DELEGATION)) {
options |= ECP_SERVICE_OPTION_DELEGATION;
} else {
AM_LOG_RERROR(APLOG_MARK, APLOG_WARNING, 0, r,
"Unknown PAOS service option = \"%s\"",
value);
goto cleanup;
}
}
result = true;
cleanup:
if (options_return) {
*options_return = options;
}
return result;
}
| 12,111
|
18,275
| 0
|
static void process_stat_settings(ADD_STAT add_stats, void *c) {
assert(add_stats);
APPEND_STAT("maxbytes", "%u", (unsigned int)settings.maxbytes);
APPEND_STAT("maxconns", "%d", settings.maxconns);
APPEND_STAT("tcpport", "%d", settings.port);
APPEND_STAT("udpport", "%d", settings.udpport);
APPEND_STAT("inter", "%s", settings.inter ? settings.inter : "NULL");
APPEND_STAT("verbosity", "%d", settings.verbose);
APPEND_STAT("oldest", "%lu", (unsigned long)settings.oldest_live);
APPEND_STAT("evictions", "%s", settings.evict_to_free ? "on" : "off");
APPEND_STAT("domain_socket", "%s",
settings.socketpath ? settings.socketpath : "NULL");
APPEND_STAT("umask", "%o", settings.access);
APPEND_STAT("growth_factor", "%.2f", settings.factor);
APPEND_STAT("chunk_size", "%d", settings.chunk_size);
APPEND_STAT("num_threads", "%d", settings.num_threads);
APPEND_STAT("stat_key_prefix", "%c", settings.prefix_delimiter);
APPEND_STAT("detail_enabled", "%s",
settings.detail_enabled ? "yes" : "no");
APPEND_STAT("reqs_per_event", "%d", settings.reqs_per_event);
APPEND_STAT("cas_enabled", "%s", settings.use_cas ? "yes" : "no");
APPEND_STAT("tcp_backlog", "%d", settings.backlog);
APPEND_STAT("binding_protocol", "%s",
prot_text(settings.binding_protocol));
APPEND_STAT("item_size_max", "%d", settings.item_size_max);
}
| 12,112
|
44,490
| 0
|
static char *lxc_cgroup_get_hierarchy_abs_path(const char *subsystem, const char *name, const char *lxcpath)
{
struct cgroup_meta_data *meta;
struct cgroup_process_info *base_info, *info;
struct cgroup_mount_point *mp;
char *result = NULL;
meta = lxc_cgroup_load_meta();
if (!meta)
return NULL;
base_info = lxc_cgroup_get_container_info(name, lxcpath, meta);
if (!base_info)
goto out1;
info = find_info_for_subsystem(base_info, subsystem);
if (!info)
goto out2;
if (info->designated_mount_point) {
mp = info->designated_mount_point;
} else {
mp = lxc_cgroup_find_mount_point(info->hierarchy, info->cgroup_path, true);
if (!mp)
goto out3;
}
result = cgroup_to_absolute_path(mp, info->cgroup_path, NULL);
out3:
out2:
lxc_cgroup_process_info_free(base_info);
out1:
lxc_cgroup_put_meta(meta);
return result;
}
| 12,113
|
38,441
| 0
|
int ib_send_cm_rep(struct ib_cm_id *cm_id,
struct ib_cm_rep_param *param)
{
struct cm_id_private *cm_id_priv;
struct ib_mad_send_buf *msg;
struct cm_rep_msg *rep_msg;
unsigned long flags;
int ret;
if (param->private_data &&
param->private_data_len > IB_CM_REP_PRIVATE_DATA_SIZE)
return -EINVAL;
cm_id_priv = container_of(cm_id, struct cm_id_private, id);
spin_lock_irqsave(&cm_id_priv->lock, flags);
if (cm_id->state != IB_CM_REQ_RCVD &&
cm_id->state != IB_CM_MRA_REQ_SENT) {
ret = -EINVAL;
goto out;
}
ret = cm_alloc_msg(cm_id_priv, &msg);
if (ret)
goto out;
rep_msg = (struct cm_rep_msg *) msg->mad;
cm_format_rep(rep_msg, cm_id_priv, param);
msg->timeout_ms = cm_id_priv->timeout_ms;
msg->context[1] = (void *) (unsigned long) IB_CM_REP_SENT;
ret = ib_post_send_mad(msg, NULL);
if (ret) {
spin_unlock_irqrestore(&cm_id_priv->lock, flags);
cm_free_msg(msg);
return ret;
}
cm_id->state = IB_CM_REP_SENT;
cm_id_priv->msg = msg;
cm_id_priv->initiator_depth = param->initiator_depth;
cm_id_priv->responder_resources = param->responder_resources;
cm_id_priv->rq_psn = cm_rep_get_starting_psn(rep_msg);
cm_id_priv->local_qpn = cpu_to_be32(param->qp_num & 0xFFFFFF);
out: spin_unlock_irqrestore(&cm_id_priv->lock, flags);
return ret;
}
| 12,114
|
164,484
| 0
|
static int balance_deeper(MemPage *pRoot, MemPage **ppChild){
int rc; /* Return value from subprocedures */
MemPage *pChild = 0; /* Pointer to a new child page */
Pgno pgnoChild = 0; /* Page number of the new child page */
BtShared *pBt = pRoot->pBt; /* The BTree */
assert( pRoot->nOverflow>0 );
assert( sqlite3_mutex_held(pBt->mutex) );
/* Make pRoot, the root page of the b-tree, writable. Allocate a new
** page that will become the new right-child of pPage. Copy the contents
** of the node stored on pRoot into the new child page.
*/
rc = sqlite3PagerWrite(pRoot->pDbPage);
if( rc==SQLITE_OK ){
rc = allocateBtreePage(pBt,&pChild,&pgnoChild,pRoot->pgno,0);
copyNodeContent(pRoot, pChild, &rc);
if( ISAUTOVACUUM ){
ptrmapPut(pBt, pgnoChild, PTRMAP_BTREE, pRoot->pgno, &rc);
}
}
if( rc ){
*ppChild = 0;
releasePage(pChild);
return rc;
}
assert( sqlite3PagerIswriteable(pChild->pDbPage) );
assert( sqlite3PagerIswriteable(pRoot->pDbPage) );
assert( pChild->nCell==pRoot->nCell );
TRACE(("BALANCE: copy root %d into %d\n", pRoot->pgno, pChild->pgno));
/* Copy the overflow cells from pRoot to pChild */
memcpy(pChild->aiOvfl, pRoot->aiOvfl,
pRoot->nOverflow*sizeof(pRoot->aiOvfl[0]));
memcpy(pChild->apOvfl, pRoot->apOvfl,
pRoot->nOverflow*sizeof(pRoot->apOvfl[0]));
pChild->nOverflow = pRoot->nOverflow;
/* Zero the contents of pRoot. Then install pChild as the right-child. */
zeroPage(pRoot, pChild->aData[0] & ~PTF_LEAF);
put4byte(&pRoot->aData[pRoot->hdrOffset+8], pgnoChild);
*ppChild = pChild;
return SQLITE_OK;
}
| 12,115
|
163,606
| 0
|
htmlNewDocNoDtD(const xmlChar *URI, const xmlChar *ExternalID) {
xmlDocPtr cur;
/*
* Allocate a new document and fill the fields.
*/
cur = (xmlDocPtr) xmlMalloc(sizeof(xmlDoc));
if (cur == NULL) {
htmlErrMemory(NULL, "HTML document creation failed\n");
return(NULL);
}
memset(cur, 0, sizeof(xmlDoc));
cur->type = XML_HTML_DOCUMENT_NODE;
cur->version = NULL;
cur->intSubset = NULL;
cur->doc = cur;
cur->name = NULL;
cur->children = NULL;
cur->extSubset = NULL;
cur->oldNs = NULL;
cur->encoding = NULL;
cur->standalone = 1;
cur->compression = 0;
cur->ids = NULL;
cur->refs = NULL;
cur->_private = NULL;
cur->charset = XML_CHAR_ENCODING_UTF8;
cur->properties = XML_DOC_HTML | XML_DOC_USERBUILT;
if ((ExternalID != NULL) ||
(URI != NULL))
xmlCreateIntSubset(cur, BAD_CAST "html", ExternalID, URI);
return(cur);
}
| 12,116
|
65,753
| 0
|
nfsd4_decode_layoutreturn(struct nfsd4_compoundargs *argp,
struct nfsd4_layoutreturn *lrp)
{
DECODE_HEAD;
READ_BUF(16);
lrp->lr_reclaim = be32_to_cpup(p++);
lrp->lr_layout_type = be32_to_cpup(p++);
lrp->lr_seg.iomode = be32_to_cpup(p++);
lrp->lr_return_type = be32_to_cpup(p++);
if (lrp->lr_return_type == RETURN_FILE) {
READ_BUF(16);
p = xdr_decode_hyper(p, &lrp->lr_seg.offset);
p = xdr_decode_hyper(p, &lrp->lr_seg.length);
status = nfsd4_decode_stateid(argp, &lrp->lr_sid);
if (status)
return status;
READ_BUF(4);
lrp->lrf_body_len = be32_to_cpup(p++);
if (lrp->lrf_body_len > 0) {
READ_BUF(lrp->lrf_body_len);
READMEM(lrp->lrf_body, lrp->lrf_body_len);
}
} else {
lrp->lr_seg.offset = 0;
lrp->lr_seg.length = NFS4_MAX_UINT64;
}
DECODE_TAIL;
}
| 12,117
|
85,433
| 0
|
void write_node_page(unsigned int nid, struct f2fs_io_info *fio)
{
struct f2fs_summary sum;
set_summary(&sum, nid, 0, 0);
do_write_page(&sum, fio);
}
| 12,118
|
17,145
| 0
|
OxideQWebPreferences* OxideQQuickWebView::preferences() {
Q_D(OxideQQuickWebView);
if (!d->proxy_) {
if (!d->construct_props_->preferences) {
d->construct_props_->preferences = new OxideQWebPreferences(this);
}
return d->construct_props_->preferences;
}
return d->proxy_->preferences();
}
| 12,119
|
99,833
| 0
|
void WebPluginProxy::OnMissingPluginStatus(int status) {
Send(new PluginHostMsg_MissingPluginStatus(route_id_, status));
}
| 12,120
|
6,161
| 0
|
int tls1_check_curve(SSL *s, const unsigned char *p, size_t len)
{
const unsigned char *curves;
size_t num_curves, i;
unsigned int suiteb_flags = tls1_suiteb(s);
if (len != 3 || p[0] != NAMED_CURVE_TYPE)
return 0;
/* Check curve matches Suite B preferences */
if (suiteb_flags) {
unsigned long cid = s->s3->tmp.new_cipher->id;
if (p[1])
return 0;
if (cid == TLS1_CK_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256) {
if (p[2] != TLSEXT_curve_P_256)
return 0;
} else if (cid == TLS1_CK_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384) {
if (p[2] != TLSEXT_curve_P_384)
return 0;
} else /* Should never happen */
return 0;
}
if (!tls1_get_curvelist(s, 0, &curves, &num_curves))
return 0;
for (i = 0; i < num_curves; i++, curves += 2) {
if (p[1] == curves[0] && p[2] == curves[1])
return 1;
}
return 0;
}
| 12,121
|
108,399
| 0
|
void AudioOutputController::DoPause() {
DCHECK_EQ(message_loop_, MessageLoop::current());
if (state_ != kPlaying)
return;
state_ = kPaused;
stream_->Stop();
if (LowLatencyMode()) {
sync_reader_->UpdatePendingBytes(kPauseMark);
}
handler_->OnPaused(this);
}
| 12,122
|
47,750
| 0
|
static inline u32 netlink_hash(const void *data, u32 len, u32 seed)
{
const struct netlink_sock *nlk = data;
struct netlink_compare_arg arg;
netlink_compare_arg_init(&arg, sock_net(&nlk->sk), nlk->portid);
return jhash2((u32 *)&arg, netlink_compare_arg_len / sizeof(u32), seed);
}
| 12,123
|
156,315
| 0
|
MediaRecorder* MediaRecorder::Create(ExecutionContext* context,
MediaStream* stream,
ExceptionState& exception_state) {
MediaRecorder* recorder = new MediaRecorder(
context, stream, MediaRecorderOptions::Create(), exception_state);
recorder->PauseIfNeeded();
return recorder;
}
| 12,124
|
88,195
| 0
|
XML_GetSpecifiedAttributeCount(XML_Parser parser) {
if (parser == NULL)
return -1;
return parser->m_nSpecifiedAtts;
}
| 12,125
|
63,478
| 0
|
YR_API void yr_object_print_data(
YR_OBJECT* object,
int indent,
int print_identifier)
{
YR_DICTIONARY_ITEMS* dict_items;
YR_ARRAY_ITEMS* array_items;
YR_STRUCTURE_MEMBER* member;
char indent_spaces[32];
int i;
indent = yr_min(indent, sizeof(indent_spaces) - 1);
memset(indent_spaces, '\t', indent);
indent_spaces[indent] = '\0';
if (print_identifier && object->type != OBJECT_TYPE_FUNCTION)
printf("%s%s", indent_spaces, object->identifier);
switch(object->type)
{
case OBJECT_TYPE_INTEGER:
if (object->value.i != UNDEFINED)
printf(" = %" PRIu64, object->value.i);
else
printf(" = UNDEFINED");
break;
case OBJECT_TYPE_STRING:
if (object->value.ss != NULL)
{
size_t l;
printf(" = \"");
for (l = 0; l < object->value.ss->length; l++)
{
char c = object->value.ss->c_string[l];
if (isprint((unsigned char) c))
printf("%c", c);
else
printf("\\x%02x", (unsigned char) c);
}
printf("\"");
}
else
{
printf(" = UNDEFINED");
}
break;
case OBJECT_TYPE_STRUCTURE:
member = object_as_structure(object)->members;
while (member != NULL)
{
if (member->object->type != OBJECT_TYPE_FUNCTION)
{
printf("\n");
yr_object_print_data(member->object, indent + 1, 1);
}
member = member->next;
}
break;
case OBJECT_TYPE_ARRAY:
array_items = object_as_array(object)->items;
if (array_items != NULL)
{
for (i = 0; i < array_items->count; i++)
{
if (array_items->objects[i] != NULL)
{
printf("\n%s\t[%d]", indent_spaces, i);
yr_object_print_data(array_items->objects[i], indent + 1, 0);
}
}
}
break;
case OBJECT_TYPE_DICTIONARY:
dict_items = object_as_dictionary(object)->items;
if (dict_items != NULL)
{
for (i = 0; i < dict_items->used; i++)
{
printf("\n%s\t%s", indent_spaces, dict_items->objects[i].key);
yr_object_print_data(dict_items->objects[i].obj, indent + 1, 0);
}
}
break;
}
}
| 12,126
|
4,652
| 0
|
PHP_FUNCTION(openssl_pkcs12_export_to_file)
{
X509 * cert = NULL;
BIO * bio_out = NULL;
PKCS12 * p12 = NULL;
char * filename;
char * friendly_name = NULL;
int filename_len;
char * pass;
int pass_len;
zval **zcert = NULL, *zpkey = NULL, *args = NULL;
EVP_PKEY *priv_key = NULL;
long certresource, keyresource;
zval ** item;
STACK_OF(X509) *ca = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Zpzs|a", &zcert, &filename, &filename_len, &zpkey, &pass, &pass_len, &args) == FAILURE)
return;
RETVAL_FALSE;
cert = php_openssl_x509_from_zval(zcert, 0, &certresource TSRMLS_CC);
if (cert == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot get cert from parameter 1");
return;
}
priv_key = php_openssl_evp_from_zval(&zpkey, 0, "", 1, &keyresource TSRMLS_CC);
if (priv_key == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot get private key from parameter 3");
goto cleanup;
}
if (cert && !X509_check_private_key(cert, priv_key)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "private key does not correspond to cert");
goto cleanup;
}
if (php_openssl_open_base_dir_chk(filename TSRMLS_CC)) {
goto cleanup;
}
/* parse extra config from args array, promote this to an extra function */
if (args && zend_hash_find(Z_ARRVAL_P(args), "friendly_name", sizeof("friendly_name"), (void**)&item) == SUCCESS && Z_TYPE_PP(item) == IS_STRING)
friendly_name = Z_STRVAL_PP(item);
/* certpbe (default RC2-40)
keypbe (default 3DES)
friendly_caname
*/
if (args && zend_hash_find(Z_ARRVAL_P(args), "extracerts", sizeof("extracerts"), (void**)&item) == SUCCESS)
ca = php_array_to_X509_sk(item TSRMLS_CC);
/* end parse extra config */
/*PKCS12 *PKCS12_create(char *pass, char *name, EVP_PKEY *pkey, X509 *cert, STACK_OF(X509) *ca,
int nid_key, int nid_cert, int iter, int mac_iter, int keytype);*/
p12 = PKCS12_create(pass, friendly_name, priv_key, cert, ca, 0, 0, 0, 0, 0);
bio_out = BIO_new_file(filename, "w");
if (bio_out) {
i2d_PKCS12_bio(bio_out, p12);
RETVAL_TRUE;
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "error opening file %s", filename);
}
BIO_free(bio_out);
PKCS12_free(p12);
php_sk_X509_free(ca);
cleanup:
if (keyresource == -1 && priv_key) {
EVP_PKEY_free(priv_key);
}
if (certresource == -1 && cert) {
X509_free(cert);
}
}
| 12,127
|
66,422
| 0
|
static inline uint32_t insn_get(CPUX86State *env, DisasContext *s, TCGMemOp ot)
{
uint32_t ret;
switch (ot) {
case MO_8:
ret = cpu_ldub_code(env, s->pc);
s->pc++;
break;
case MO_16:
ret = cpu_lduw_code(env, s->pc);
s->pc += 2;
break;
case MO_32:
#ifdef TARGET_X86_64
case MO_64:
#endif
ret = cpu_ldl_code(env, s->pc);
s->pc += 4;
break;
default:
tcg_abort();
}
return ret;
}
| 12,128
|
71,081
| 0
|
void Type_vcgt_Free(struct _cms_typehandler_struct* self, void* Ptr)
{
cmsFreeToneCurveTriple((cmsToneCurve**) Ptr);
_cmsFree(self ->ContextID, Ptr);
}
| 12,129
|
23,621
| 0
|
isdn_net_bind_channel(isdn_net_local * lp, int idx)
{
lp->flags |= ISDN_NET_CONNECTED;
lp->isdn_device = dev->drvmap[idx];
lp->isdn_channel = dev->chanmap[idx];
dev->rx_netdev[idx] = lp->netdev;
dev->st_netdev[idx] = lp->netdev;
}
| 12,130
|
2,305
| 0
|
_PUBLIC_ int strcasecmp_m(const char *s1, const char *s2)
{
struct smb_iconv_handle *iconv_handle = get_iconv_handle();
return strcasecmp_m_handle(iconv_handle, s1, s2);
}
| 12,131
|
158,199
| 0
|
void Restart() {
DCHECK(IsLoaderInterceptionEnabled());
if (!default_loader_used_ ||
(base::FeatureList::IsEnabled(network::features::kNetworkService) &&
!IsURLHandledByDefaultLoader(resource_request_->url))) {
url_loader_.reset();
}
interceptor_index_ = 0;
received_response_ = false;
MaybeStartLoader(nullptr /* interceptor */,
{} /* single_request_handler */);
}
| 12,132
|
140,550
| 0
|
NextProto SpdyProxyClientSocket::GetNegotiatedProtocol() const {
return kProtoUnknown;
}
| 12,133
|
40,807
| 0
|
char *msPostGISBuildSQLBox(layerObj *layer, rectObj *rect, char *strSRID)
{
char *strBox = NULL;
size_t sz;
if (layer->debug) {
msDebug("msPostGISBuildSQLBox called.\n");
}
if ( strSRID ) {
static char *strBoxTemplate = "ST_GeomFromText('POLYGON((%.15g %.15g,%.15g %.15g,%.15g %.15g,%.15g %.15g,%.15g %.15g))',%s)";
/* 10 doubles + 1 integer + template characters */
sz = 10 * 22 + strlen(strSRID) + strlen(strBoxTemplate);
strBox = (char*)msSmallMalloc(sz+1); /* add space for terminating NULL */
if ( sz <= snprintf(strBox, sz, strBoxTemplate,
rect->minx, rect->miny,
rect->minx, rect->maxy,
rect->maxx, rect->maxy,
rect->maxx, rect->miny,
rect->minx, rect->miny,
strSRID)) {
msSetError(MS_MISCERR,"Bounding box digits truncated.","msPostGISBuildSQLBox");
return NULL;
}
} else {
static char *strBoxTemplate = "ST_GeomFromText('POLYGON((%.15g %.15g,%.15g %.15g,%.15g %.15g,%.15g %.15g,%.15g %.15g))')";
/* 10 doubles + template characters */
sz = 10 * 22 + strlen(strBoxTemplate);
strBox = (char*)msSmallMalloc(sz+1); /* add space for terminating NULL */
if ( sz <= snprintf(strBox, sz, strBoxTemplate,
rect->minx, rect->miny,
rect->minx, rect->maxy,
rect->maxx, rect->maxy,
rect->maxx, rect->miny,
rect->minx, rect->miny) ) {
msSetError(MS_MISCERR,"Bounding box digits truncated.","msPostGISBuildSQLBox");
return NULL;
}
}
return strBox;
}
| 12,134
|
150,275
| 0
|
void PasswordAutofillAgent::BindPendingReceiver(
mojo::PendingAssociatedReceiver<mojom::PasswordAutofillAgent>
pending_receiver) {
receiver_.Bind(std::move(pending_receiver));
}
| 12,135
|
185,997
| 1
|
void AppControllerImpl::LaunchApp(const std::string& app_id) {
app_service_proxy_->Launch(app_id, ui::EventFlags::EF_NONE,
apps::mojom::LaunchSource::kFromAppListGrid,
display::kDefaultDisplayId);
}
| 12,136
|
45,099
| 0
|
static int lua_apr_touch(lua_State *L)
{
request_rec *r;
const char *path;
apr_status_t status;
apr_time_t mtime;
r = ap_lua_check_request_rec(L, 1);
luaL_checktype(L, 2, LUA_TSTRING);
path = lua_tostring(L, 2);
mtime = (apr_time_t)luaL_optnumber(L, 3, (lua_Number)apr_time_now());
status = apr_file_mtime_set(path, mtime, r->pool);
lua_pushboolean(L, (status == 0));
return 1;
}
| 12,137
|
73,861
| 0
|
pngquant_error rwpng_write_image8(FILE *outfile, const png8_image *mainprog_ptr)
{
png_structp png_ptr;
png_infop info_ptr;
if (mainprog_ptr->num_palette > 256) return INVALID_ARGUMENT;
pngquant_error retval = rwpng_write_image_init((rwpng_png_image*)mainprog_ptr, &png_ptr, &info_ptr, mainprog_ptr->fast_compression);
if (retval) return retval;
struct rwpng_write_state write_state;
write_state = (struct rwpng_write_state){
.outfile = outfile,
.maximum_file_size = mainprog_ptr->maximum_file_size,
.retval = SUCCESS,
};
png_set_write_fn(png_ptr, &write_state, user_write_data, user_flush_data);
png_set_filter(png_ptr, PNG_FILTER_TYPE_BASE, PNG_FILTER_VALUE_NONE);
rwpng_set_gamma(info_ptr, png_ptr, mainprog_ptr->gamma, mainprog_ptr->output_color);
/* set the image parameters appropriately */
int sample_depth;
#if PNG_LIBPNG_VER > 10400 /* old libpng corrupts files with low depth */
if (mainprog_ptr->num_palette <= 2)
sample_depth = 1;
else if (mainprog_ptr->num_palette <= 4)
sample_depth = 2;
else if (mainprog_ptr->num_palette <= 16)
sample_depth = 4;
else
#endif
sample_depth = 8;
struct rwpng_chunk *chunk = mainprog_ptr->chunks;
int chunk_num=0;
while(chunk) {
png_unknown_chunk pngchunk = {
.size = chunk->size,
.data = chunk->data,
.location = chunk->location,
};
memcpy(pngchunk.name, chunk->name, 5);
png_set_unknown_chunks(png_ptr, info_ptr, &pngchunk, 1);
#if defined(PNG_HAVE_IHDR) && PNG_LIBPNG_VER < 10600
png_set_unknown_chunk_location(png_ptr, info_ptr, chunk_num, pngchunk.location ? pngchunk.location : PNG_HAVE_IHDR);
#endif
chunk = chunk->next;
chunk_num++;
}
png_set_IHDR(png_ptr, info_ptr, mainprog_ptr->width, mainprog_ptr->height,
sample_depth, PNG_COLOR_TYPE_PALETTE,
0, PNG_COMPRESSION_TYPE_DEFAULT,
PNG_FILTER_TYPE_BASE);
png_color palette[256];
png_byte trans[256];
unsigned int num_trans = 0;
for(unsigned int i = 0; i < mainprog_ptr->num_palette; i++) {
palette[i] = (png_color){
.red = mainprog_ptr->palette[i].r,
.green = mainprog_ptr->palette[i].g,
.blue = mainprog_ptr->palette[i].b,
};
trans[i] = mainprog_ptr->palette[i].a;
if (mainprog_ptr->palette[i].a < 255) {
num_trans = i+1;
}
}
png_set_PLTE(png_ptr, info_ptr, palette, mainprog_ptr->num_palette);
if (num_trans > 0) {
png_set_tRNS(png_ptr, info_ptr, trans, num_trans, NULL);
}
rwpng_write_end(&info_ptr, &png_ptr, mainprog_ptr->row_pointers);
if (SUCCESS == write_state.retval && write_state.maximum_file_size && write_state.bytes_written > write_state.maximum_file_size) {
return TOO_LARGE_FILE;
}
return write_state.retval;
}
| 12,138
|
130,869
| 0
|
static void methodWithEnumArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
TestObjectV8Internal::methodWithEnumArgMethod(info);
TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
}
| 12,139
|
144,107
| 0
|
png_set_compression_window_bits(png_structp png_ptr, int window_bits)
{
if (png_ptr == NULL)
return;
if (window_bits > 15)
png_warning(png_ptr, "Only compression windows <= 32k supported by PNG");
else if (window_bits < 8)
png_warning(png_ptr, "Only compression windows >= 256 supported by PNG");
#ifndef WBITS_8_OK
/* Avoid libpng bug with 256-byte windows */
if (window_bits == 8)
{
png_warning(png_ptr, "Compression window is being reset to 512");
window_bits = 9;
}
#endif
png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS;
png_ptr->zlib_window_bits = window_bits;
}
| 12,140
|
12,477
| 0
|
ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name)
{
int nid = NID_undef;
ASN1_OBJECT *op=NULL;
unsigned char *buf;
unsigned char *p;
const unsigned char *cp;
int i, j;
if(!no_name) {
if( ((nid = OBJ_sn2nid(s)) != NID_undef) ||
((nid = OBJ_ln2nid(s)) != NID_undef) )
return OBJ_nid2obj(nid);
}
/* Work out size of content octets */
i=a2d_ASN1_OBJECT(NULL,0,s,-1);
if (i <= 0) {
/* Don't clear the error */
/*ERR_clear_error();*/
return NULL;
}
/* Work out total size */
j = ASN1_object_size(0,i,V_ASN1_OBJECT);
if((buf=(unsigned char *)OPENSSL_malloc(j)) == NULL) return NULL;
p = buf;
/* Write out tag+length */
ASN1_put_object(&p,0,i,V_ASN1_OBJECT,V_ASN1_UNIVERSAL);
/* Write out contents */
a2d_ASN1_OBJECT(p,i,s,-1);
cp=buf;
op=d2i_ASN1_OBJECT(NULL,&cp,j);
OPENSSL_free(buf);
return op;
}
| 12,141
|
137,913
| 0
|
AXObject* AXLayoutObject::ancestorForWhichThisIsAPresentationalChild() const {
AXObject* parent = parentObjectIfExists();
while (parent) {
if (parent->ariaRoleHasPresentationalChildren())
break;
if (parent->isMenuList())
break;
parent = parent->parentObjectIfExists();
}
return parent;
}
| 12,142
|
151,165
| 0
|
void InspectorNetworkAgent::DidFinishXHRInternal(ExecutionContext* context,
XMLHttpRequest* xhr,
ThreadableLoaderClient* client,
const AtomicString& method,
const String& url,
bool success) {
ClearPendingRequestData();
DelayedRemoveReplayXHR(xhr);
ThreadableLoaderClientRequestIdMap::iterator it =
known_request_id_map_.find(client);
if (it == known_request_id_map_.end())
return;
known_request_id_map_.erase(client);
}
| 12,143
|
157,956
| 0
|
void RenderViewImpl::OnPluginActionAt(const gfx::Point& location,
const WebPluginAction& action) {
if (webview())
webview()->PerformPluginAction(action, location);
}
| 12,144
|
121,276
| 0
|
int HTMLInputElement::size() const
{
return m_size;
}
| 12,145
|
159,624
| 0
|
void RenderFrameHostManager::ClearWebUIInstances() {
current_frame_host()->ClearAllWebUI();
if (speculative_render_frame_host_)
speculative_render_frame_host_->ClearAllWebUI();
}
| 12,146
|
120,379
| 0
|
float scroll_y_hint() const { return scroll_y_hint_; }
| 12,147
|
96,425
| 0
|
uri_decoded_copy (const char *part,
gsize length)
{
unsigned char *s, *d;
char *decoded = g_strndup (part, length);
s = d = (unsigned char *)decoded;
do {
if (*s == '%') {
if (!g_ascii_isxdigit (s[1]) ||
!g_ascii_isxdigit (s[2])) {
*d++ = *s;
continue;
}
*d++ = HEXCHAR (s);
s += 2;
} else {
*d++ = *s;
}
} while (*s++);
return decoded;
}
| 12,148
|
177,195
| 0
|
ACodec::UninitializedState::UninitializedState(ACodec *codec)
: BaseState(codec) {
}
| 12,149
|
148,877
| 0
|
void RenderFrameHostManager::EnsureRenderViewInitialized(
RenderViewHostImpl* render_view_host,
SiteInstance* instance) {
DCHECK(frame_tree_node_->IsMainFrame());
if (render_view_host->IsRenderViewLive())
return;
RenderFrameProxyHost* proxy = GetRenderFrameProxyHost(instance);
if (!proxy)
return;
InitRenderView(render_view_host, proxy);
}
| 12,150
|
97,355
| 0
|
static inline bool canReferToParentFrameEncoding(const Frame* frame, const Frame* parentFrame)
{
return parentFrame && parentFrame->document()->securityOrigin()->canAccess(frame->document()->securityOrigin());
}
| 12,151
|
108,451
| 0
|
void ChromeRenderProcessObserver::OnClearCache(bool on_navigation) {
if (on_navigation) {
clear_cache_pending_ = true;
} else {
WebCache::clear();
}
}
| 12,152
|
12,497
| 0
|
bus_activation_reload (BusActivation *activation,
const DBusString *address,
DBusList **directories,
DBusError *error)
{
DBusList *link;
char *dir;
if (activation->server_address != NULL)
dbus_free (activation->server_address);
if (!_dbus_string_copy_data (address, &activation->server_address))
{
BUS_SET_OOM (error);
goto failed;
}
if (activation->entries != NULL)
_dbus_hash_table_unref (activation->entries);
activation->entries = _dbus_hash_table_new (DBUS_HASH_STRING, NULL,
(DBusFreeFunction)bus_activation_entry_unref);
if (activation->entries == NULL)
{
BUS_SET_OOM (error);
goto failed;
}
if (activation->directories != NULL)
_dbus_hash_table_unref (activation->directories);
activation->directories = _dbus_hash_table_new (DBUS_HASH_STRING, NULL,
(DBusFreeFunction)bus_service_directory_unref);
if (activation->directories == NULL)
{
BUS_SET_OOM (error);
goto failed;
}
link = _dbus_list_get_first_link (directories);
while (link != NULL)
{
BusServiceDirectory *s_dir;
dir = _dbus_strdup ((const char *) link->data);
if (!dir)
{
BUS_SET_OOM (error);
goto failed;
}
s_dir = dbus_new0 (BusServiceDirectory, 1);
if (!s_dir)
{
dbus_free (dir);
BUS_SET_OOM (error);
goto failed;
}
s_dir->refcount = 1;
s_dir->dir_c = dir;
s_dir->entries = _dbus_hash_table_new (DBUS_HASH_STRING, NULL,
(DBusFreeFunction)bus_activation_entry_unref);
if (!s_dir->entries)
{
bus_service_directory_unref (s_dir);
BUS_SET_OOM (error);
goto failed;
}
if (!_dbus_hash_table_insert_string (activation->directories, s_dir->dir_c, s_dir))
{
bus_service_directory_unref (s_dir);
BUS_SET_OOM (error);
goto failed;
}
/* only fail on OOM, it is ok if we can't read the directory */
if (!update_directory (activation, s_dir, error))
{
if (dbus_error_has_name (error, DBUS_ERROR_NO_MEMORY))
goto failed;
else
dbus_error_free (error);
}
link = _dbus_list_get_next_link (directories, link);
}
return TRUE;
failed:
return FALSE;
}
| 12,153
|
122,967
| 0
|
BackingStore* RenderWidgetHostImpl::GetBackingStore(bool force_create) {
if (!view_)
return NULL;
gfx::Size view_size = current_size_;
if (!should_auto_resize_) {
gfx::Rect view_rect = view_->GetViewBounds();
if (view_rect.IsEmpty())
return NULL;
view_size = view_rect.size();
}
TRACE_EVENT2("renderer_host", "RenderWidgetHostImpl::GetBackingStore",
"width", base::IntToString(view_size.width()),
"height", base::IntToString(view_size.height()));
DCHECK(!is_hidden_ || !force_create) <<
"GetBackingStore called while hidden!";
DCHECK(!in_get_backing_store_) << "GetBackingStore called recursively!";
base::AutoReset<bool> auto_reset_in_get_backing_store(
&in_get_backing_store_, true);
BackingStore* backing_store = NULL;
if (TryGetBackingStore(view_size, &backing_store) || !force_create)
return backing_store;
if (!repaint_ack_pending_ && !resize_ack_pending_ && !view_being_painted_) {
repaint_start_time_ = TimeTicks::Now();
repaint_ack_pending_ = true;
Send(new ViewMsg_Repaint(routing_id_, view_size));
}
TimeDelta max_delay = TimeDelta::FromMilliseconds(kPaintMsgTimeoutMS);
TimeTicks end_time = TimeTicks::Now() + max_delay;
do {
TRACE_EVENT0("renderer_host", "GetBackingStore::WaitForUpdate");
#if defined(OS_MACOSX)
view_->AboutToWaitForBackingStoreMsg();
#endif
IPC::Message msg;
if (process_->WaitForBackingStoreMsg(routing_id_, max_delay, &msg)) {
OnMessageReceived(msg);
if (should_auto_resize_)
view_size = current_size_;
if (TryGetBackingStore(view_size, &backing_store) ||
abort_get_backing_store_) {
abort_get_backing_store_ = false;
return backing_store;
}
} else {
TRACE_EVENT0("renderer_host", "GetBackingStore::Timeout");
break;
}
max_delay = end_time - TimeTicks::Now();
} while (max_delay > TimeDelta::FromSeconds(0));
if (view_size != current_size_)
TryGetBackingStore(current_size_, &backing_store);
return backing_store;
}
| 12,154
|
26,409
| 0
|
static struct pmcraid_sglist *pmcraid_alloc_sglist(int buflen)
{
struct pmcraid_sglist *sglist;
struct scatterlist *scatterlist;
struct page *page;
int num_elem, i, j;
int sg_size;
int order;
int bsize_elem;
sg_size = buflen / (PMCRAID_MAX_IOADLS - 1);
order = (sg_size > 0) ? get_order(sg_size) : 0;
bsize_elem = PAGE_SIZE * (1 << order);
/* Determine the actual number of sg entries needed */
if (buflen % bsize_elem)
num_elem = (buflen / bsize_elem) + 1;
else
num_elem = buflen / bsize_elem;
/* Allocate a scatter/gather list for the DMA */
sglist = kzalloc(sizeof(struct pmcraid_sglist) +
(sizeof(struct scatterlist) * (num_elem - 1)),
GFP_KERNEL);
if (sglist == NULL)
return NULL;
scatterlist = sglist->scatterlist;
sg_init_table(scatterlist, num_elem);
sglist->order = order;
sglist->num_sg = num_elem;
sg_size = buflen;
for (i = 0; i < num_elem; i++) {
page = alloc_pages(GFP_KERNEL|GFP_DMA|__GFP_ZERO, order);
if (!page) {
for (j = i - 1; j >= 0; j--)
__free_pages(sg_page(&scatterlist[j]), order);
kfree(sglist);
return NULL;
}
sg_set_page(&scatterlist[i], page,
sg_size < bsize_elem ? sg_size : bsize_elem, 0);
sg_size -= bsize_elem;
}
return sglist;
}
| 12,155
|
84,107
| 0
|
BOOL INSTAPI SQLCreateDataSourceW( HWND hwndParent, LPCWSTR lpszDSN )
{
BOOL ret;
char *ms = _multi_string_alloc_and_copy( lpszDSN );
inst_logClear();
ret = SQLCreateDataSource( hwndParent, ms );
free( ms );
return ret;
}
| 12,156
|
7,204
| 0
|
Action::AuthStatus Polkit1Backend::authorizeAction(const QString &action)
{
Q_UNUSED(action)
return Action::AuthorizedStatus;
}
| 12,157
|
125,372
| 0
|
GDataFileSystem::GetFileCompleteForOpenParams::GetFileCompleteForOpenParams(
const std::string& resource_id,
const std::string& md5)
: resource_id(resource_id),
md5(md5) {
}
| 12,158
|
187,793
| 1
|
SampleTable::SampleTable(const sp<DataSource> &source)
: mDataSource(source),
mChunkOffsetOffset(-1),
mChunkOffsetType(0),
mNumChunkOffsets(0),
mSampleToChunkOffset(-1),
mNumSampleToChunkOffsets(0),
mSampleSizeOffset(-1),
mSampleSizeFieldSize(0),
mDefaultSampleSize(0),
mNumSampleSizes(0),
mTimeToSampleCount(0),
mTimeToSample(),
mSampleTimeEntries(NULL),
mCompositionTimeDeltaEntries(NULL),
mNumCompositionTimeDeltaEntries(0),
mCompositionDeltaLookup(new CompositionDeltaLookup),
mSyncSampleOffset(-1),
mNumSyncSamples(0),
mSyncSamples(NULL),
mLastSyncSampleIndex(0),
mSampleToChunkEntries(NULL) {
mSampleIterator = new SampleIterator(this);
}
| 12,159
|
18,807
| 0
|
void snmp_mib_free(void __percpu *ptr[2])
{
BUG_ON(ptr == NULL);
free_percpu(ptr[0]);
free_percpu(ptr[1]);
ptr[0] = ptr[1] = NULL;
}
| 12,160
|
138,327
| 0
|
void fillWidgetProperties(AXObject& axObject,
protocol::Array<AXProperty>& properties) {
AccessibilityRole role = axObject.roleValue();
String autocomplete = axObject.ariaAutoComplete();
if (!autocomplete.isEmpty())
properties.addItem(
createProperty(AXWidgetAttributesEnum::Autocomplete,
createValue(autocomplete, AXValueTypeEnum::Token)));
if (axObject.hasAttribute(HTMLNames::aria_haspopupAttr)) {
bool hasPopup = axObject.ariaHasPopup();
properties.addItem(createProperty(AXWidgetAttributesEnum::Haspopup,
createBooleanValue(hasPopup)));
}
int headingLevel = axObject.headingLevel();
if (headingLevel > 0) {
properties.addItem(createProperty(AXWidgetAttributesEnum::Level,
createValue(headingLevel)));
}
int hierarchicalLevel = axObject.hierarchicalLevel();
if (hierarchicalLevel > 0 ||
axObject.hasAttribute(HTMLNames::aria_levelAttr)) {
properties.addItem(createProperty(AXWidgetAttributesEnum::Level,
createValue(hierarchicalLevel)));
}
if (roleAllowsMultiselectable(role)) {
bool multiselectable = axObject.isMultiSelectable();
properties.addItem(createProperty(AXWidgetAttributesEnum::Multiselectable,
createBooleanValue(multiselectable)));
}
if (roleAllowsOrientation(role)) {
AccessibilityOrientation orientation = axObject.orientation();
switch (orientation) {
case AccessibilityOrientationVertical:
properties.addItem(
createProperty(AXWidgetAttributesEnum::Orientation,
createValue("vertical", AXValueTypeEnum::Token)));
break;
case AccessibilityOrientationHorizontal:
properties.addItem(
createProperty(AXWidgetAttributesEnum::Orientation,
createValue("horizontal", AXValueTypeEnum::Token)));
break;
case AccessibilityOrientationUndefined:
break;
}
}
if (role == TextFieldRole) {
properties.addItem(
createProperty(AXWidgetAttributesEnum::Multiline,
createBooleanValue(axObject.isMultiline())));
}
if (roleAllowsReadonly(role)) {
properties.addItem(
createProperty(AXWidgetAttributesEnum::Readonly,
createBooleanValue(axObject.isReadOnly())));
}
if (roleAllowsRequired(role)) {
properties.addItem(
createProperty(AXWidgetAttributesEnum::Required,
createBooleanValue(axObject.isRequired())));
}
if (roleAllowsSort(role)) {
}
if (axObject.isRange()) {
properties.addItem(
createProperty(AXWidgetAttributesEnum::Valuemin,
createValue(axObject.minValueForRange())));
properties.addItem(
createProperty(AXWidgetAttributesEnum::Valuemax,
createValue(axObject.maxValueForRange())));
properties.addItem(
createProperty(AXWidgetAttributesEnum::Valuetext,
createValue(axObject.valueDescription())));
}
}
| 12,161
|
38,753
| 0
|
hstore_fetchval(PG_FUNCTION_ARGS)
{
HStore *hs = PG_GETARG_HS(0);
text *key = PG_GETARG_TEXT_PP(1);
HEntry *entries = ARRPTR(hs);
text *out;
int idx = hstoreFindKey(hs, NULL,
VARDATA_ANY(key), VARSIZE_ANY_EXHDR(key));
if (idx < 0 || HS_VALISNULL(entries, idx))
PG_RETURN_NULL();
out = cstring_to_text_with_len(HS_VAL(entries, STRPTR(hs), idx),
HS_VALLEN(entries, idx));
PG_RETURN_TEXT_P(out);
}
| 12,162
|
147,250
| 0
|
static void CachedStringOrNoneAttributeAttributeSetter(
v8::Local<v8::Value> v8_value, const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Isolate* isolate = info.GetIsolate();
ALLOW_UNUSED_LOCAL(isolate);
v8::Local<v8::Object> holder = info.Holder();
ALLOW_UNUSED_LOCAL(holder);
TestObject* impl = V8TestObject::ToImpl(holder);
V8StringResource<kTreatNullAndUndefinedAsNullString> cpp_value = v8_value;
if (!cpp_value.Prepare())
return;
impl->setCachedStringOrNoneAttribute(cpp_value);
V8PrivateProperty::GetSymbol(
isolate,
kPrivatePropertyCachedStringOrNoneAttribute)
.DeleteProperty(holder);
}
| 12,163
|
21,932
| 0
|
xfs_set_acl(struct inode *inode, int type, struct posix_acl *acl)
{
struct xfs_inode *ip = XFS_I(inode);
unsigned char *ea_name;
int error;
if (S_ISLNK(inode->i_mode))
return -EOPNOTSUPP;
switch (type) {
case ACL_TYPE_ACCESS:
ea_name = SGI_ACL_FILE;
break;
case ACL_TYPE_DEFAULT:
if (!S_ISDIR(inode->i_mode))
return acl ? -EACCES : 0;
ea_name = SGI_ACL_DEFAULT;
break;
default:
return -EINVAL;
}
if (acl) {
struct xfs_acl *xfs_acl;
int len;
xfs_acl = kzalloc(sizeof(struct xfs_acl), GFP_KERNEL);
if (!xfs_acl)
return -ENOMEM;
xfs_acl_to_disk(xfs_acl, acl);
len = sizeof(struct xfs_acl) -
(sizeof(struct xfs_acl_entry) *
(XFS_ACL_MAX_ENTRIES - acl->a_count));
error = -xfs_attr_set(ip, ea_name, (unsigned char *)xfs_acl,
len, ATTR_ROOT);
kfree(xfs_acl);
} else {
/*
* A NULL ACL argument means we want to remove the ACL.
*/
error = -xfs_attr_remove(ip, ea_name, ATTR_ROOT);
/*
* If the attribute didn't exist to start with that's fine.
*/
if (error == -ENOATTR)
error = 0;
}
if (!error)
set_cached_acl(inode, type, acl);
return error;
}
| 12,164
|
66,035
| 0
|
int yr_arena_write_data(
YR_ARENA* arena,
void* data,
size_t size,
void** written_data)
{
void* output;
int result;
if (size > free_space(arena->current_page))
{
result = yr_arena_allocate_memory(arena, size, &output);
if (result != ERROR_SUCCESS)
return result;
}
else
{
output = arena->current_page->address + arena->current_page->used;
arena->current_page->used += size;
}
memcpy(output, data, size);
if (written_data != NULL)
*written_data = output;
return ERROR_SUCCESS;
}
| 12,165
|
172,742
| 0
|
dpbPicture_t* FindSmallestPicOrderCnt(dpbStorage_t *dpb)
{
/* Variables */
u32 i;
i32 picOrderCnt;
dpbPicture_t *tmp;
/* Code */
ASSERT(dpb);
picOrderCnt = 0x7FFFFFFF;
tmp = NULL;
for (i = 0; i <= dpb->dpbSize; i++)
{
if (dpb->buffer[i].toBeDisplayed &&
(dpb->buffer[i].picOrderCnt < picOrderCnt))
{
tmp = dpb->buffer + i;
picOrderCnt = dpb->buffer[i].picOrderCnt;
}
}
return(tmp);
}
| 12,166
|
6,683
| 0
|
static int prdt_tbl_entry_size(const AHCI_SG *tbl)
{
return (le32_to_cpu(tbl->flags_size) & AHCI_PRDT_SIZE_MASK) + 1;
}
| 12,167
|
102,729
| 0
|
void CCThreadProxy::setThread(CCThread* ccThread)
{
s_ccThread = ccThread;
#ifndef NDEBUG
CCProxy::setImplThread(s_ccThread->threadID());
#endif
}
| 12,168
|
75,319
| 0
|
stb_vorbis * stb_vorbis_open_file_section(FILE *file, int close_on_free, int *error, const stb_vorbis_alloc *alloc, unsigned int length)
{
stb_vorbis *f, p;
vorbis_init(&p, alloc);
p.f = file;
p.f_start = (uint32) ftell(file);
p.stream_len = length;
p.close_on_free = close_on_free;
if (start_decoder(&p)) {
f = vorbis_alloc(&p);
if (f) {
*f = p;
vorbis_pump_first_frame(f);
return f;
}
}
if (error) *error = p.error;
vorbis_deinit(&p);
return NULL;
}
| 12,169
|
22,180
| 0
|
static void sighand_ctor(void *data)
{
struct sighand_struct *sighand = data;
spin_lock_init(&sighand->siglock);
init_waitqueue_head(&sighand->signalfd_wqh);
}
| 12,170
|
169,179
| 0
|
void RenderFrameHostImpl::SetNavigationRequest(
std::unique_ptr<NavigationRequest> navigation_request) {
DCHECK(navigation_request);
if (FrameMsg_Navigate_Type::IsSameDocument(
navigation_request->common_params().navigation_type)) {
same_document_navigation_request_ = std::move(navigation_request);
return;
}
navigation_request_ = std::move(navigation_request);
}
| 12,171
|
93,602
| 0
|
nvmet_fc_fcp_nvme_cmd_done(struct nvmet_req *nvme_req)
{
struct nvmet_fc_fcp_iod *fod = nvmet_req_to_fod(nvme_req);
struct nvmet_fc_tgtport *tgtport = fod->tgtport;
__nvmet_fc_fcp_nvme_cmd_done(tgtport, fod, 0);
}
| 12,172
|
36,867
| 0
|
int inode_init_always(struct super_block *sb, struct inode *inode)
{
static const struct inode_operations empty_iops;
static const struct file_operations empty_fops;
struct address_space *const mapping = &inode->i_data;
inode->i_sb = sb;
inode->i_blkbits = sb->s_blocksize_bits;
inode->i_flags = 0;
atomic_set(&inode->i_count, 1);
inode->i_op = &empty_iops;
inode->i_fop = &empty_fops;
inode->__i_nlink = 1;
inode->i_opflags = 0;
i_uid_write(inode, 0);
i_gid_write(inode, 0);
atomic_set(&inode->i_writecount, 0);
inode->i_size = 0;
inode->i_blocks = 0;
inode->i_bytes = 0;
inode->i_generation = 0;
#ifdef CONFIG_QUOTA
memset(&inode->i_dquot, 0, sizeof(inode->i_dquot));
#endif
inode->i_pipe = NULL;
inode->i_bdev = NULL;
inode->i_cdev = NULL;
inode->i_rdev = 0;
inode->dirtied_when = 0;
if (security_inode_alloc(inode))
goto out;
spin_lock_init(&inode->i_lock);
lockdep_set_class(&inode->i_lock, &sb->s_type->i_lock_key);
mutex_init(&inode->i_mutex);
lockdep_set_class(&inode->i_mutex, &sb->s_type->i_mutex_key);
atomic_set(&inode->i_dio_count, 0);
mapping->a_ops = &empty_aops;
mapping->host = inode;
mapping->flags = 0;
mapping_set_gfp_mask(mapping, GFP_HIGHUSER_MOVABLE);
mapping->private_data = NULL;
mapping->backing_dev_info = &default_backing_dev_info;
mapping->writeback_index = 0;
/*
* If the block_device provides a backing_dev_info for client
* inodes then use that. Otherwise the inode share the bdev's
* backing_dev_info.
*/
if (sb->s_bdev) {
struct backing_dev_info *bdi;
bdi = sb->s_bdev->bd_inode->i_mapping->backing_dev_info;
mapping->backing_dev_info = bdi;
}
inode->i_private = NULL;
inode->i_mapping = mapping;
INIT_HLIST_HEAD(&inode->i_dentry); /* buggered by rcu freeing */
#ifdef CONFIG_FS_POSIX_ACL
inode->i_acl = inode->i_default_acl = ACL_NOT_CACHED;
#endif
#ifdef CONFIG_FSNOTIFY
inode->i_fsnotify_mask = 0;
#endif
this_cpu_inc(nr_inodes);
return 0;
out:
return -ENOMEM;
}
| 12,173
|
110,869
| 0
|
bool RootWindow::DispatchScrollEvent(ScrollEvent* event) {
DispatchHeldMouseMove();
if (ui::IsDIPEnabled()) {
float scale = ui::GetDeviceScaleFactor(layer());
ui::Transform transform = layer()->transform();
transform.ConcatScale(scale, scale);
event->UpdateForRootTransform(transform);
} else {
event->UpdateForRootTransform(layer()->transform());
}
last_mouse_location_ = event->location();
synthesize_mouse_move_ = false;
Window* target =
mouse_pressed_handler_ ? mouse_pressed_handler_ : capture_window_;
if (!target)
target = GetEventHandlerForPoint(event->location());
if (target && target->delegate()) {
int flags = event->flags();
gfx::Point location_in_window = event->location();
Window::ConvertPointToWindow(this, target, &location_in_window);
if (IsNonClientLocation(target, location_in_window))
flags |= ui::EF_IS_NON_CLIENT;
ScrollEvent translated_event(*event, this, target, event->type(), flags);
return ProcessMouseEvent(target, &translated_event);
}
return false;
}
| 12,174
|
148,350
| 0
|
void WebContentsImpl::DidNavigateMainFramePostCommit(
RenderFrameHostImpl* render_frame_host,
const LoadCommittedDetails& details,
const FrameHostMsg_DidCommitProvisionalLoad_Params& params) {
if (details.is_navigation_to_different_page()) {
UpdateTargetURL(render_frame_host->GetRenderViewHost(), GURL());
RenderWidgetHostViewBase* rwhvb =
static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView());
if (rwhvb)
rwhvb->OnDidNavigateMainFrameToNewPage();
did_first_visually_non_empty_paint_ = false;
theme_color_ = SK_ColorTRANSPARENT;
}
if (delegate_)
delegate_->DidNavigateMainFramePostCommit(this);
view_->SetOverscrollControllerEnabled(CanOverscrollContent());
}
| 12,175
|
32,491
| 0
|
static int tg3_abort_hw(struct tg3 *tp, int silent)
{
int i, err;
tg3_disable_ints(tp);
tp->rx_mode &= ~RX_MODE_ENABLE;
tw32_f(MAC_RX_MODE, tp->rx_mode);
udelay(10);
err = tg3_stop_block(tp, RCVBDI_MODE, RCVBDI_MODE_ENABLE, silent);
err |= tg3_stop_block(tp, RCVLPC_MODE, RCVLPC_MODE_ENABLE, silent);
err |= tg3_stop_block(tp, RCVLSC_MODE, RCVLSC_MODE_ENABLE, silent);
err |= tg3_stop_block(tp, RCVDBDI_MODE, RCVDBDI_MODE_ENABLE, silent);
err |= tg3_stop_block(tp, RCVDCC_MODE, RCVDCC_MODE_ENABLE, silent);
err |= tg3_stop_block(tp, RCVCC_MODE, RCVCC_MODE_ENABLE, silent);
err |= tg3_stop_block(tp, SNDBDS_MODE, SNDBDS_MODE_ENABLE, silent);
err |= tg3_stop_block(tp, SNDBDI_MODE, SNDBDI_MODE_ENABLE, silent);
err |= tg3_stop_block(tp, SNDDATAI_MODE, SNDDATAI_MODE_ENABLE, silent);
err |= tg3_stop_block(tp, RDMAC_MODE, RDMAC_MODE_ENABLE, silent);
err |= tg3_stop_block(tp, SNDDATAC_MODE, SNDDATAC_MODE_ENABLE, silent);
err |= tg3_stop_block(tp, DMAC_MODE, DMAC_MODE_ENABLE, silent);
err |= tg3_stop_block(tp, SNDBDC_MODE, SNDBDC_MODE_ENABLE, silent);
tp->mac_mode &= ~MAC_MODE_TDE_ENABLE;
tw32_f(MAC_MODE, tp->mac_mode);
udelay(40);
tp->tx_mode &= ~TX_MODE_ENABLE;
tw32_f(MAC_TX_MODE, tp->tx_mode);
for (i = 0; i < MAX_WAIT_CNT; i++) {
udelay(100);
if (!(tr32(MAC_TX_MODE) & TX_MODE_ENABLE))
break;
}
if (i >= MAX_WAIT_CNT) {
dev_err(&tp->pdev->dev,
"%s timed out, TX_MODE_ENABLE will not clear "
"MAC_TX_MODE=%08x\n", __func__, tr32(MAC_TX_MODE));
err |= -ENODEV;
}
err |= tg3_stop_block(tp, HOSTCC_MODE, HOSTCC_MODE_ENABLE, silent);
err |= tg3_stop_block(tp, WDMAC_MODE, WDMAC_MODE_ENABLE, silent);
err |= tg3_stop_block(tp, MBFREE_MODE, MBFREE_MODE_ENABLE, silent);
tw32(FTQ_RESET, 0xffffffff);
tw32(FTQ_RESET, 0x00000000);
err |= tg3_stop_block(tp, BUFMGR_MODE, BUFMGR_MODE_ENABLE, silent);
err |= tg3_stop_block(tp, MEMARB_MODE, MEMARB_MODE_ENABLE, silent);
for (i = 0; i < tp->irq_cnt; i++) {
struct tg3_napi *tnapi = &tp->napi[i];
if (tnapi->hw_status)
memset(tnapi->hw_status, 0, TG3_HW_STATUS_SIZE);
}
return err;
}
| 12,176
|
25,492
| 0
|
static long set_intruction_bp(struct task_struct *child,
struct ppc_hw_breakpoint *bp_info)
{
int slot;
int slot1_in_use = ((child->thread.dbcr0 & DBCR0_IAC1) != 0);
int slot2_in_use = ((child->thread.dbcr0 & DBCR0_IAC2) != 0);
int slot3_in_use = ((child->thread.dbcr0 & DBCR0_IAC3) != 0);
int slot4_in_use = ((child->thread.dbcr0 & DBCR0_IAC4) != 0);
if (dbcr_iac_range(child) & DBCR_IAC12MODE)
slot2_in_use = 1;
if (dbcr_iac_range(child) & DBCR_IAC34MODE)
slot4_in_use = 1;
if (bp_info->addr >= TASK_SIZE)
return -EIO;
if (bp_info->addr_mode != PPC_BREAKPOINT_MODE_EXACT) {
/* Make sure range is valid. */
if (bp_info->addr2 >= TASK_SIZE)
return -EIO;
/* We need a pair of IAC regsisters */
if ((!slot1_in_use) && (!slot2_in_use)) {
slot = 1;
child->thread.iac1 = bp_info->addr;
child->thread.iac2 = bp_info->addr2;
child->thread.dbcr0 |= DBCR0_IAC1;
if (bp_info->addr_mode ==
PPC_BREAKPOINT_MODE_RANGE_EXCLUSIVE)
dbcr_iac_range(child) |= DBCR_IAC12X;
else
dbcr_iac_range(child) |= DBCR_IAC12I;
#if CONFIG_PPC_ADV_DEBUG_IACS > 2
} else if ((!slot3_in_use) && (!slot4_in_use)) {
slot = 3;
child->thread.iac3 = bp_info->addr;
child->thread.iac4 = bp_info->addr2;
child->thread.dbcr0 |= DBCR0_IAC3;
if (bp_info->addr_mode ==
PPC_BREAKPOINT_MODE_RANGE_EXCLUSIVE)
dbcr_iac_range(child) |= DBCR_IAC34X;
else
dbcr_iac_range(child) |= DBCR_IAC34I;
#endif
} else
return -ENOSPC;
} else {
/* We only need one. If possible leave a pair free in
* case a range is needed later
*/
if (!slot1_in_use) {
/*
* Don't use iac1 if iac1-iac2 are free and either
* iac3 or iac4 (but not both) are free
*/
if (slot2_in_use || (slot3_in_use == slot4_in_use)) {
slot = 1;
child->thread.iac1 = bp_info->addr;
child->thread.dbcr0 |= DBCR0_IAC1;
goto out;
}
}
if (!slot2_in_use) {
slot = 2;
child->thread.iac2 = bp_info->addr;
child->thread.dbcr0 |= DBCR0_IAC2;
#if CONFIG_PPC_ADV_DEBUG_IACS > 2
} else if (!slot3_in_use) {
slot = 3;
child->thread.iac3 = bp_info->addr;
child->thread.dbcr0 |= DBCR0_IAC3;
} else if (!slot4_in_use) {
slot = 4;
child->thread.iac4 = bp_info->addr;
child->thread.dbcr0 |= DBCR0_IAC4;
#endif
} else
return -ENOSPC;
}
out:
child->thread.dbcr0 |= DBCR0_IDM;
child->thread.regs->msr |= MSR_DE;
return slot;
}
| 12,177
|
34,333
| 0
|
static int btrfs_readpage_end_io_hook(struct page *page, u64 start, u64 end,
struct extent_state *state, int mirror)
{
size_t offset = start - ((u64)page->index << PAGE_CACHE_SHIFT);
struct inode *inode = page->mapping->host;
struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree;
char *kaddr;
u64 private = ~(u32)0;
int ret;
struct btrfs_root *root = BTRFS_I(inode)->root;
u32 csum = ~(u32)0;
if (PageChecked(page)) {
ClearPageChecked(page);
goto good;
}
if (BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM)
goto good;
if (root->root_key.objectid == BTRFS_DATA_RELOC_TREE_OBJECTID &&
test_range_bit(io_tree, start, end, EXTENT_NODATASUM, 1, NULL)) {
clear_extent_bits(io_tree, start, end, EXTENT_NODATASUM,
GFP_NOFS);
return 0;
}
if (state && state->start == start) {
private = state->private;
ret = 0;
} else {
ret = get_state_private(io_tree, start, &private);
}
kaddr = kmap_atomic(page);
if (ret)
goto zeroit;
csum = btrfs_csum_data(root, kaddr + offset, csum, end - start + 1);
btrfs_csum_final(csum, (char *)&csum);
if (csum != private)
goto zeroit;
kunmap_atomic(kaddr);
good:
return 0;
zeroit:
printk_ratelimited(KERN_INFO "btrfs csum failed ino %llu off %llu csum %u "
"private %llu\n",
(unsigned long long)btrfs_ino(page->mapping->host),
(unsigned long long)start, csum,
(unsigned long long)private);
memset(kaddr + offset, 1, end - start + 1);
flush_dcache_page(page);
kunmap_atomic(kaddr);
if (private == 0)
return 0;
return -EIO;
}
| 12,178
|
174,570
| 0
|
void BTM_SetPairableMode (BOOLEAN allow_pairing, BOOLEAN connect_only_paired)
{
BTM_TRACE_API ("BTM_SetPairableMode() allow_pairing: %u connect_only_paired: %u", allow_pairing, connect_only_paired);
btm_cb.pairing_disabled = !allow_pairing;
btm_cb.connect_only_paired = connect_only_paired;
}
| 12,179
|
151,732
| 0
|
void Browser::SetAsDelegate(WebContents* web_contents, bool set_delegate) {
Browser* delegate = set_delegate ? this : NULL;
web_contents->SetDelegate(delegate);
BookmarkTabHelper::FromWebContents(web_contents)->set_delegate(delegate);
WebContentsModalDialogManager::FromWebContents(web_contents)->
SetDelegate(delegate);
CoreTabHelper::FromWebContents(web_contents)->set_delegate(delegate);
SearchTabHelper::FromWebContents(web_contents)->set_delegate(delegate);
translate::ContentTranslateDriver& content_translate_driver =
ChromeTranslateClient::FromWebContents(web_contents)->translate_driver();
if (delegate) {
zoom::ZoomController::FromWebContents(web_contents)->AddObserver(this);
content_translate_driver.AddObserver(this);
} else {
zoom::ZoomController::FromWebContents(web_contents)->RemoveObserver(this);
content_translate_driver.RemoveObserver(this);
}
}
| 12,180
|
160,441
| 0
|
int RenderFrameHostImpl::GetProxyCount() {
if (!IsCurrent())
return 0;
return frame_tree_node_->render_manager()->GetProxyCount();
}
| 12,181
|
136,709
| 0
|
GranularityStrategy* FrameSelection::GetGranularityStrategy() {
SelectionStrategy strategy_type = SelectionStrategy::kCharacter;
Settings* settings = frame_ ? frame_->GetSettings() : nullptr;
if (settings &&
settings->GetSelectionStrategy() == SelectionStrategy::kDirection)
strategy_type = SelectionStrategy::kDirection;
if (granularity_strategy_ &&
granularity_strategy_->GetType() == strategy_type)
return granularity_strategy_.get();
if (strategy_type == SelectionStrategy::kDirection)
granularity_strategy_ = std::make_unique<DirectionGranularityStrategy>();
else
granularity_strategy_ = std::make_unique<CharacterGranularityStrategy>();
return granularity_strategy_.get();
}
| 12,182
|
165,349
| 0
|
DOMStorageContextWrapper::RecreateSessionStorage(
const std::string& namespace_id) {
return SessionStorageNamespaceImpl::Create(this, namespace_id);
}
| 12,183
|
128,425
| 0
|
int RenderLayerScrollableArea::pageStep(ScrollbarOrientation orientation) const
{
int length = (orientation == HorizontalScrollbar) ?
box().pixelSnappedClientWidth() : box().pixelSnappedClientHeight();
int minPageStep = static_cast<float>(length) * ScrollableArea::minFractionToStepWhenPaging();
int pageStep = max(minPageStep, length - ScrollableArea::maxOverlapBetweenPages());
return max(pageStep, 1);
}
| 12,184
|
67,174
| 0
|
struct zonelist *huge_zonelist(struct vm_area_struct *vma, unsigned long addr,
gfp_t gfp_flags, struct mempolicy **mpol,
nodemask_t **nodemask)
{
struct zonelist *zl;
*mpol = get_vma_policy(vma, addr);
*nodemask = NULL; /* assume !MPOL_BIND */
if (unlikely((*mpol)->mode == MPOL_INTERLEAVE)) {
zl = node_zonelist(interleave_nid(*mpol, vma, addr,
huge_page_shift(hstate_vma(vma))), gfp_flags);
} else {
zl = policy_zonelist(gfp_flags, *mpol, numa_node_id());
if ((*mpol)->mode == MPOL_BIND)
*nodemask = &(*mpol)->v.nodes;
}
return zl;
}
| 12,185
|
98,334
| 0
|
String FrameLoaderClient::generatedMIMETypeForURLScheme(const String&) const
{
notImplemented();
return String();
}
| 12,186
|
16,792
| 0
|
static int cloop_probe(const uint8_t *buf, int buf_size, const char *filename)
{
const char *magic_version_2_0 = "#!/bin/sh\n"
"#V2.0 Format\n"
"modprobe cloop file=$0 && mount -r -t iso9660 /dev/cloop $1\n";
int length = strlen(magic_version_2_0);
if (length > buf_size) {
length = buf_size;
}
if (!memcmp(magic_version_2_0, buf, length)) {
return 2;
}
return 0;
}
| 12,187
|
67,777
| 0
|
PHPAPI php_stream *php_stream_generic_socket_factory(const char *proto, size_t protolen,
const char *resourcename, size_t resourcenamelen,
const char *persistent_id, int options, int flags,
struct timeval *timeout,
php_stream_context *context STREAMS_DC)
{
php_stream *stream = NULL;
php_netstream_data_t *sock;
php_stream_ops *ops;
/* which type of socket ? */
if (strncmp(proto, "tcp", protolen) == 0) {
ops = &php_stream_socket_ops;
} else if (strncmp(proto, "udp", protolen) == 0) {
ops = &php_stream_udp_socket_ops;
}
#ifdef AF_UNIX
else if (strncmp(proto, "unix", protolen) == 0) {
ops = &php_stream_unix_socket_ops;
} else if (strncmp(proto, "udg", protolen) == 0) {
ops = &php_stream_unixdg_socket_ops;
}
#endif
else {
/* should never happen */
return NULL;
}
sock = pemalloc(sizeof(php_netstream_data_t), persistent_id ? 1 : 0);
memset(sock, 0, sizeof(php_netstream_data_t));
sock->is_blocked = 1;
sock->timeout.tv_sec = FG(default_socket_timeout);
sock->timeout.tv_usec = 0;
/* we don't know the socket until we have determined if we are binding or
* connecting */
sock->socket = -1;
stream = php_stream_alloc_rel(ops, sock, persistent_id, "r+");
if (stream == NULL) {
pefree(sock, persistent_id ? 1 : 0);
return NULL;
}
if (flags == 0) {
return stream;
}
return stream;
}
| 12,188
|
147,159
| 0
|
void V8TestObject::ActivityLoggingAccessPerWorldBindingsLongAttributeAttributeGetterCallbackForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& info) {
RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestObject_activityLoggingAccessPerWorldBindingsLongAttribute_Getter");
ScriptState* script_state = ScriptState::ForRelevantRealm(info);
V8PerContextData* context_data = script_state->PerContextData();
if (context_data && context_data->ActivityLogger()) {
context_data->ActivityLogger()->LogGetter("TestObject.activityLoggingAccessPerWorldBindingsLongAttribute");
}
test_object_v8_internal::ActivityLoggingAccessPerWorldBindingsLongAttributeAttributeGetterForMainWorld(info);
}
| 12,189
|
83,725
| 0
|
static void index_entry_cpy(
git_index_entry *tgt,
const git_index_entry *src)
{
const char *tgt_path = tgt->path;
memcpy(tgt, src, sizeof(*tgt));
tgt->path = tgt_path;
}
| 12,190
|
66,167
| 0
|
int mailimf_char_parse(const char * message, size_t length,
size_t * indx, char token)
{
size_t cur_token;
cur_token = * indx;
if (cur_token >= length)
return MAILIMF_ERROR_PARSE;
if (message[cur_token] == token) {
cur_token ++;
* indx = cur_token;
return MAILIMF_NO_ERROR;
}
else
return MAILIMF_ERROR_PARSE;
}
| 12,191
|
103,760
| 0
|
void RenderThread::RemoveObserver(RenderProcessObserver* observer) {
observers_.RemoveObserver(observer);
}
| 12,192
|
68,920
| 0
|
static bool set_off_slab_cache(struct kmem_cache *cachep,
size_t size, unsigned long flags)
{
size_t left;
cachep->num = 0;
/*
* Always use on-slab management when SLAB_NOLEAKTRACE
* to avoid recursive calls into kmemleak.
*/
if (flags & SLAB_NOLEAKTRACE)
return false;
/*
* Size is large, assume best to place the slab management obj
* off-slab (should allow better packing of objs).
*/
left = calculate_slab_order(cachep, size, flags | CFLGS_OFF_SLAB);
if (!cachep->num)
return false;
/*
* If the slab has been placed off-slab, and we have enough space then
* move it on-slab. This is at the expense of any extra colouring.
*/
if (left >= cachep->num * sizeof(freelist_idx_t))
return false;
cachep->colour = left / cachep->colour_off;
return true;
}
| 12,193
|
10,049
| 0
|
parse_cmdline( int* argc,
char*** argv )
{
char* execname;
int option;
execname = ft_basename( (*argv)[0] );
while ( 1 )
{
option = getopt( *argc, *argv, "e:m:r:" );
if ( option == -1 )
break;
switch ( option )
{
case 'e':
status.encoding = FTDemo_Make_Encoding_Tag( optarg );
break;
case 'r':
status.res = atoi( optarg );
if ( status.res < 1 )
usage( execname );
break;
case 'm':
if ( *argc < 3 )
usage( execname );
Text = optarg;
break;
default:
usage( execname );
break;
}
}
*argc -= optind;
*argv += optind;
if ( *argc <= 1 )
usage( execname );
status.ptsize = (int)(atof( *argv[0] ) * 64.0);
if ( status.ptsize == 0 )
status.ptsize = 64;
(*argc)--;
(*argv)++;
}
| 12,194
|
136,942
| 0
|
void HTMLInputElement::PostDispatchEventHandler(
Event* event,
EventDispatchHandlingState* state) {
if (!state)
return;
input_type_view_->DidDispatchClick(event,
*static_cast<ClickHandlingState*>(state));
}
| 12,195
|
37,481
| 0
|
static int kvm_mmu_prepare_zap_page(struct kvm *kvm, struct kvm_mmu_page *sp,
struct list_head *invalid_list)
{
int ret;
trace_kvm_mmu_prepare_zap_page(sp);
++kvm->stat.mmu_shadow_zapped;
ret = mmu_zap_unsync_children(kvm, sp, invalid_list);
kvm_mmu_page_unlink_children(kvm, sp);
kvm_mmu_unlink_parents(kvm, sp);
if (!sp->role.invalid && !sp->role.direct)
unaccount_shadowed(kvm, sp->gfn);
if (sp->unsync)
kvm_unlink_unsync_page(kvm, sp);
if (!sp->root_count) {
/* Count self */
ret++;
list_move(&sp->link, invalid_list);
kvm_mod_used_mmu_pages(kvm, -1);
} else {
list_move(&sp->link, &kvm->arch.active_mmu_pages);
/*
* The obsolete pages can not be used on any vcpus.
* See the comments in kvm_mmu_invalidate_zap_all_pages().
*/
if (!sp->role.invalid && !is_obsolete_sp(kvm, sp))
kvm_reload_remote_mmus(kvm);
}
sp->role.invalid = 1;
return ret;
}
| 12,196
|
50,448
| 0
|
static void perf_adjust_freq_unthr_context(struct perf_event_context *ctx,
int needs_unthr)
{
struct perf_event *event;
struct hw_perf_event *hwc;
u64 now, period = TICK_NSEC;
s64 delta;
/*
* only need to iterate over all events iff:
* - context have events in frequency mode (needs freq adjust)
* - there are events to unthrottle on this cpu
*/
if (!(ctx->nr_freq || needs_unthr))
return;
raw_spin_lock(&ctx->lock);
perf_pmu_disable(ctx->pmu);
list_for_each_entry_rcu(event, &ctx->event_list, event_entry) {
if (event->state != PERF_EVENT_STATE_ACTIVE)
continue;
if (!event_filter_match(event))
continue;
perf_pmu_disable(event->pmu);
hwc = &event->hw;
if (hwc->interrupts == MAX_INTERRUPTS) {
hwc->interrupts = 0;
perf_log_throttle(event, 1);
event->pmu->start(event, 0);
}
if (!event->attr.freq || !event->attr.sample_freq)
goto next;
/*
* stop the event and update event->count
*/
event->pmu->stop(event, PERF_EF_UPDATE);
now = local64_read(&event->count);
delta = now - hwc->freq_count_stamp;
hwc->freq_count_stamp = now;
/*
* restart the event
* reload only if value has changed
* we have stopped the event so tell that
* to perf_adjust_period() to avoid stopping it
* twice.
*/
if (delta > 0)
perf_adjust_period(event, period, delta, false);
event->pmu->start(event, delta > 0 ? PERF_EF_RELOAD : 0);
next:
perf_pmu_enable(event->pmu);
}
perf_pmu_enable(ctx->pmu);
raw_spin_unlock(&ctx->lock);
}
| 12,197
|
146,512
| 0
|
ScriptValue WebGLRenderingContextBase::getShaderParameter(
ScriptState* script_state,
WebGLShader* shader,
GLenum pname) {
if (isContextLost() || !ValidateWebGLObject("getShaderParameter", shader))
return ScriptValue::CreateNull(script_state);
GLint value = 0;
switch (pname) {
case GL_DELETE_STATUS:
return WebGLAny(script_state, shader->IsDeleted());
case GL_COMPILE_STATUS:
ContextGL()->GetShaderiv(ObjectOrZero(shader), pname, &value);
return WebGLAny(script_state, static_cast<bool>(value));
case GL_SHADER_TYPE:
ContextGL()->GetShaderiv(ObjectOrZero(shader), pname, &value);
return WebGLAny(script_state, static_cast<unsigned>(value));
default:
SynthesizeGLError(GL_INVALID_ENUM, "getShaderParameter",
"invalid parameter name");
return ScriptValue::CreateNull(script_state);
}
}
| 12,198
|
33,204
| 0
|
xfs_buf_cmp(
void *priv,
struct list_head *a,
struct list_head *b)
{
struct xfs_buf *ap = container_of(a, struct xfs_buf, b_list);
struct xfs_buf *bp = container_of(b, struct xfs_buf, b_list);
xfs_daddr_t diff;
diff = ap->b_maps[0].bm_bn - bp->b_maps[0].bm_bn;
if (diff < 0)
return -1;
if (diff > 0)
return 1;
return 0;
}
| 12,199
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.