unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
|---|---|---|---|
167,186
| 0
|
void HTMLMediaElement::WaitForSourceChange() {
BLINK_MEDIA_LOG << "waitForSourceChange(" << (void*)this << ")";
StopPeriodicTimers();
load_state_ = kWaitingForSource;
SetNetworkState(kNetworkNoSource);
SetShouldDelayLoadEvent(false);
UpdateDisplayState();
if (GetLayoutObject())
GetLayoutObject()->UpdateFromElement();
}
| 8,800
|
46,214
| 0
|
static struct nf_proto_net *generic_get_net_proto(struct net *net)
{
return &net->ct.nf_ct_proto.generic.pn;
}
| 8,801
|
180,123
| 1
|
static void php_wddx_process_data(void *user_data, const XML_Char *s, int len)
{
st_entry *ent;
wddx_stack *stack = (wddx_stack *)user_data;
TSRMLS_FETCH();
if (!wddx_stack_is_empty(stack) && !stack->done) {
wddx_stack_top(stack, (void**)&ent);
switch (ent->type) {
case ST_STRING:
if (Z_STRLEN_P(ent->data) == 0) {
STR_FREE(Z_STRVAL_P(ent->data));
Z_STRVAL_P(ent->data) = estrndup(s, len);
Z_STRLEN_P(ent->data) = len;
} else {
Z_STRVAL_P(ent->data) = erealloc(Z_STRVAL_P(ent->data), Z_STRLEN_P(ent->data) + len + 1);
memcpy(Z_STRVAL_P(ent->data) + Z_STRLEN_P(ent->data), s, len);
Z_STRLEN_P(ent->data) += len;
Z_STRVAL_P(ent->data)[Z_STRLEN_P(ent->data)] = '\0';
}
break;
case ST_BINARY:
if (Z_STRLEN_P(ent->data) == 0) {
STR_FREE(Z_STRVAL_P(ent->data));
Z_STRVAL_P(ent->data) = estrndup(s, len + 1);
} else {
Z_STRVAL_P(ent->data) = erealloc(Z_STRVAL_P(ent->data), Z_STRLEN_P(ent->data) + len + 1);
memcpy(Z_STRVAL_P(ent->data) + Z_STRLEN_P(ent->data), s, len);
}
Z_STRLEN_P(ent->data) += len;
Z_STRVAL_P(ent->data)[Z_STRLEN_P(ent->data)] = '\0';
break;
case ST_NUMBER:
Z_TYPE_P(ent->data) = IS_STRING;
Z_STRLEN_P(ent->data) = len;
Z_STRVAL_P(ent->data) = estrndup(s, len);
convert_scalar_to_number(ent->data TSRMLS_CC);
break;
case ST_BOOLEAN:
if(!ent->data) {
break;
}
if (!strcmp(s, "true")) {
Z_LVAL_P(ent->data) = 1;
} else if (!strcmp(s, "false")) {
Z_LVAL_P(ent->data) = 0;
} else {
zval_ptr_dtor(&ent->data);
if (ent->varname) {
efree(ent->varname);
ent->varname = NULL;
}
ent->data = NULL;
}
break;
case ST_DATETIME: {
char *tmp;
tmp = emalloc(len + 1);
memcpy(tmp, s, len);
tmp[len] = '\0';
Z_LVAL_P(ent->data) = php_parse_date(tmp, NULL);
/* date out of range < 1969 or > 2038 */
if (Z_LVAL_P(ent->data) == -1) {
Z_TYPE_P(ent->data) = IS_STRING;
Z_STRLEN_P(ent->data) = len;
Z_STRVAL_P(ent->data) = estrndup(s, len);
}
efree(tmp);
}
break;
default:
break;
}
}
}
| 8,802
|
3,474
| 0
|
irc_server_copy (struct t_irc_server *server, const char *new_name)
{
struct t_irc_server *new_server;
struct t_infolist *infolist;
char *mask, *pos;
const char *option_name;
int length, index_option;
/* check if another server exists with this name */
if (irc_server_search (new_name))
return NULL;
new_server = irc_server_alloc (new_name);
if (new_server)
{
/* duplicate options */
length = 32 + strlen (server->name) + 1;
mask = malloc (length);
if (!mask)
return 0;
snprintf (mask, length, "irc.server.%s.*", server->name);
infolist = weechat_infolist_get ("option", NULL, mask);
free (mask);
while (weechat_infolist_next (infolist))
{
if (!weechat_infolist_integer (infolist, "value_is_null"))
{
option_name = weechat_infolist_string (infolist, "option_name");
pos = strrchr (option_name, '.');
if (pos)
{
index_option = irc_server_search_option (pos + 1);
if (index_option >= 0)
{
weechat_config_option_set (new_server->options[index_option],
weechat_infolist_string (infolist, "value"),
1);
}
}
}
}
}
return new_server;
}
| 8,803
|
29,125
| 0
|
static int _nfs4_proc_rename(struct inode *old_dir, struct qstr *old_name,
struct inode *new_dir, struct qstr *new_name)
{
struct nfs_server *server = NFS_SERVER(old_dir);
struct nfs_renameargs arg = {
.old_dir = NFS_FH(old_dir),
.new_dir = NFS_FH(new_dir),
.old_name = old_name,
.new_name = new_name,
};
struct nfs_renameres res = {
.server = server,
};
struct rpc_message msg = {
.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_RENAME],
.rpc_argp = &arg,
.rpc_resp = &res,
};
int status = -ENOMEM;
status = nfs4_call_sync(server->client, server, &msg, &arg.seq_args, &res.seq_res, 1);
if (!status) {
update_changeattr(old_dir, &res.old_cinfo);
update_changeattr(new_dir, &res.new_cinfo);
}
return status;
}
| 8,804
|
15,953
| 0
|
bool PhotoDataUtils::GetNativeInfo ( const TIFF_Manager & exif, XMP_Uns8 ifd, XMP_Uns16 id, TIFF_Manager::TagInfo * info )
{
bool haveExif = exif.GetTag ( ifd, id, info );
if ( haveExif ) {
XMP_Uns32 i;
char * chPtr;
XMP_Assert ( (info->dataPtr != 0) || (info->dataLen == 0) ); // Null pointer requires zero length.
bool isDate = ((id == kTIFF_DateTime) || (id == kTIFF_DateTimeOriginal) || (id == kTIFF_DateTimeOriginal));
for ( i = 0, chPtr = (char*)info->dataPtr; i < info->dataLen; ++i, ++chPtr ) {
if ( isDate && (*chPtr == ':') ) continue; // Ignore colons, empty dates have spaces and colons.
if ( (*chPtr != ' ') && (*chPtr != 0) ) break; // Break if the Exif value is non-empty.
}
if ( i == info->dataLen ) {
haveExif = false; // Ignore empty Exif.
} else {
TrimTrailingSpaces ( info );
if ( info->dataLen == 0 ) haveExif = false;
}
}
return haveExif;
} // PhotoDataUtils::GetNativeInfo
| 8,805
|
49,264
| 0
|
static void tcp_v4_init_req(struct request_sock *req,
const struct sock *sk_listener,
struct sk_buff *skb)
{
struct inet_request_sock *ireq = inet_rsk(req);
sk_rcv_saddr_set(req_to_sk(req), ip_hdr(skb)->daddr);
sk_daddr_set(req_to_sk(req), ip_hdr(skb)->saddr);
ireq->opt = tcp_v4_save_options(skb);
}
| 8,806
|
107,478
| 0
|
static Eina_Bool _ewk_view_smart_contents_resize(Ewk_View_Smart_Data* smartData, int width, int height)
{
return true;
}
| 8,807
|
140,856
| 0
|
void GLES2DecoderImpl::RestoreState(const ContextState* prev_state) {
TRACE_EVENT1("gpu", "GLES2DecoderImpl::RestoreState",
"context", logger_.GetLogPrefix());
RestoreFramebufferBindings();
state_.RestoreState(prev_state);
}
| 8,808
|
9,691
| 0
|
ft_glyphslot_set_bitmap( FT_GlyphSlot slot,
FT_Byte* buffer )
{
ft_glyphslot_free_bitmap( slot );
slot->bitmap.buffer = buffer;
FT_ASSERT( (slot->internal->flags & FT_GLYPH_OWN_BITMAP) == 0 );
}
| 8,809
|
34,885
| 0
|
call_refreshresult(struct rpc_task *task)
{
int status = task->tk_status;
dprint_status(task);
task->tk_status = 0;
task->tk_action = call_refresh;
switch (status) {
case 0:
if (rpcauth_uptodatecred(task))
task->tk_action = call_allocate;
return;
case -ETIMEDOUT:
rpc_delay(task, 3*HZ);
case -EAGAIN:
status = -EACCES;
if (!task->tk_cred_retry)
break;
task->tk_cred_retry--;
dprintk("RPC: %5u %s: retry refresh creds\n",
task->tk_pid, __func__);
return;
}
dprintk("RPC: %5u %s: refresh creds failed with error %d\n",
task->tk_pid, __func__, status);
rpc_exit(task, status);
}
| 8,810
|
48,978
| 0
|
int __init udpv4_offload_init(void)
{
return inet_add_offload(&udpv4_offload, IPPROTO_UDP);
}
| 8,811
|
84,946
| 0
|
smb2_hdr_assemble(struct smb2_sync_hdr *shdr, __le16 smb2_cmd,
const struct cifs_tcon *tcon)
{
shdr->ProtocolId = SMB2_PROTO_NUMBER;
shdr->StructureSize = cpu_to_le16(64);
shdr->Command = smb2_cmd;
if (tcon && tcon->ses && tcon->ses->server) {
struct TCP_Server_Info *server = tcon->ses->server;
spin_lock(&server->req_lock);
/* Request up to 2 credits but don't go over the limit. */
if (server->credits >= server->max_credits)
shdr->CreditRequest = cpu_to_le16(0);
else
shdr->CreditRequest = cpu_to_le16(
min_t(int, server->max_credits -
server->credits, 2));
spin_unlock(&server->req_lock);
} else {
shdr->CreditRequest = cpu_to_le16(2);
}
shdr->ProcessId = cpu_to_le32((__u16)current->tgid);
if (!tcon)
goto out;
/* GLOBAL_CAP_LARGE_MTU will only be set if dialect > SMB2.02 */
/* See sections 2.2.4 and 3.2.4.1.5 of MS-SMB2 */
if ((tcon->ses) && (tcon->ses->server) &&
(tcon->ses->server->capabilities & SMB2_GLOBAL_CAP_LARGE_MTU))
shdr->CreditCharge = cpu_to_le16(1);
/* else CreditCharge MBZ */
shdr->TreeId = tcon->tid;
/* Uid is not converted */
if (tcon->ses)
shdr->SessionId = tcon->ses->Suid;
/*
* If we would set SMB2_FLAGS_DFS_OPERATIONS on open we also would have
* to pass the path on the Open SMB prefixed by \\server\share.
* Not sure when we would need to do the augmented path (if ever) and
* setting this flag breaks the SMB2 open operation since it is
* illegal to send an empty path name (without \\server\share prefix)
* when the DFS flag is set in the SMB open header. We could
* consider setting the flag on all operations other than open
* but it is safer to net set it for now.
*/
/* if (tcon->share_flags & SHI1005_FLAGS_DFS)
shdr->Flags |= SMB2_FLAGS_DFS_OPERATIONS; */
if (tcon->ses && tcon->ses->server && tcon->ses->server->sign &&
!encryption_required(tcon))
shdr->Flags |= SMB2_FLAGS_SIGNED;
out:
return;
}
| 8,812
|
76,731
| 0
|
convertToPassage(const int pass_start, const int pass_end, const int word_start,
EmphasisInfo *buffer, const EmphRuleNumber emphRule, const EmphasisClass class,
const TranslationTableHeader *table, unsigned int *wordBuffer) {
int i;
const TranslationTableRule *indicRule;
for (i = pass_start; i <= pass_end; i++)
if (wordBuffer[i] & WORD_WHOLE) {
buffer[i].symbol &= ~class;
buffer[i].word &= ~class;
wordBuffer[i] &= ~WORD_WHOLE;
}
buffer[pass_start].begin |= class;
if (brailleIndicatorDefined(
table->emphRules[emphRule][endOffset], table, &indicRule) ||
brailleIndicatorDefined(
table->emphRules[emphRule][endPhraseAfterOffset], table, &indicRule))
buffer[pass_end].end |= class;
else if (brailleIndicatorDefined(table->emphRules[emphRule][endPhraseBeforeOffset],
table, &indicRule))
buffer[word_start].end |= class;
}
| 8,813
|
81,000
| 0
|
static void update_exception_bitmap(struct kvm_vcpu *vcpu)
{
u32 eb;
eb = (1u << PF_VECTOR) | (1u << UD_VECTOR) | (1u << MC_VECTOR) |
(1u << DB_VECTOR) | (1u << AC_VECTOR);
/*
* Guest access to VMware backdoor ports could legitimately
* trigger #GP because of TSS I/O permission bitmap.
* We intercept those #GP and allow access to them anyway
* as VMware does.
*/
if (enable_vmware_backdoor)
eb |= (1u << GP_VECTOR);
if ((vcpu->guest_debug &
(KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_SW_BP)) ==
(KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_SW_BP))
eb |= 1u << BP_VECTOR;
if (to_vmx(vcpu)->rmode.vm86_active)
eb = ~0;
if (enable_ept)
eb &= ~(1u << PF_VECTOR); /* bypass_guest_pf = 0 */
/* When we are running a nested L2 guest and L1 specified for it a
* certain exception bitmap, we must trap the same exceptions and pass
* them to L1. When running L2, we will only handle the exceptions
* specified above if L1 did not want them.
*/
if (is_guest_mode(vcpu))
eb |= get_vmcs12(vcpu)->exception_bitmap;
vmcs_write32(EXCEPTION_BITMAP, eb);
}
| 8,814
|
2,081
| 0
|
int red_channel_client_blocked(RedChannelClient *rcc)
{
return rcc && rcc->send_data.blocked;
}
| 8,815
|
10,913
| 0
|
parse_context_tag (unsigned char const **buf, size_t *len, struct tag_info *ti,
int tag)
{
gpg_error_t err;
err = _ksba_ber_parse_tl (buf, len, ti);
if (err)
;
else if (!(ti->class == CLASS_CONTEXT && ti->tag == tag
&& ti->is_constructed) )
err = gpg_error (GPG_ERR_INV_OBJ);
else if (ti->length > *len)
err = gpg_error (GPG_ERR_BAD_BER);
return err;
}
| 8,816
|
20,677
| 0
|
static int emulator_pio_in_emulated(struct x86_emulate_ctxt *ctxt,
int size, unsigned short port, void *val,
unsigned int count)
{
struct kvm_vcpu *vcpu = emul_to_vcpu(ctxt);
int ret;
if (vcpu->arch.pio.count)
goto data_avail;
ret = emulator_pio_in_out(vcpu, size, port, val, count, true);
if (ret) {
data_avail:
memcpy(val, vcpu->arch.pio_data, size * count);
vcpu->arch.pio.count = 0;
return 1;
}
return 0;
}
| 8,817
|
85,210
| 0
|
static void ctx_resched(struct perf_cpu_context *cpuctx,
struct perf_event_context *task_ctx,
enum event_type_t event_type)
{
enum event_type_t ctx_event_type = event_type & EVENT_ALL;
bool cpu_event = !!(event_type & EVENT_CPU);
/*
* If pinned groups are involved, flexible groups also need to be
* scheduled out.
*/
if (event_type & EVENT_PINNED)
event_type |= EVENT_FLEXIBLE;
perf_pmu_disable(cpuctx->ctx.pmu);
if (task_ctx)
task_ctx_sched_out(cpuctx, task_ctx, event_type);
/*
* Decide which cpu ctx groups to schedule out based on the types
* of events that caused rescheduling:
* - EVENT_CPU: schedule out corresponding groups;
* - EVENT_PINNED task events: schedule out EVENT_FLEXIBLE groups;
* - otherwise, do nothing more.
*/
if (cpu_event)
cpu_ctx_sched_out(cpuctx, ctx_event_type);
else if (ctx_event_type & EVENT_PINNED)
cpu_ctx_sched_out(cpuctx, EVENT_FLEXIBLE);
perf_event_sched_in(cpuctx, task_ctx, current);
perf_pmu_enable(cpuctx->ctx.pmu);
}
| 8,818
|
119,243
| 0
|
unsigned HTMLFormElement::formElementIndex(FormAssociatedElement* associatedElement)
{
HTMLElement* associatedHTMLElement = toHTMLElement(associatedElement);
if (associatedHTMLElement->fastHasAttribute(formAttr)) {
unsigned short position = compareDocumentPosition(associatedHTMLElement);
if (position & DOCUMENT_POSITION_PRECEDING) {
++m_associatedElementsBeforeIndex;
++m_associatedElementsAfterIndex;
return HTMLFormElement::formElementIndexWithFormAttribute(associatedHTMLElement, 0, m_associatedElementsBeforeIndex - 1);
}
if (position & DOCUMENT_POSITION_FOLLOWING && !(position & DOCUMENT_POSITION_CONTAINED_BY))
return HTMLFormElement::formElementIndexWithFormAttribute(associatedHTMLElement, m_associatedElementsAfterIndex, m_associatedElements.size());
}
if (ElementTraversal::next(associatedHTMLElement, this)) {
unsigned i = m_associatedElementsBeforeIndex;
for (Element* element = this; element; element = ElementTraversal::next(element, this)) {
if (element == associatedHTMLElement) {
++m_associatedElementsAfterIndex;
return i;
}
if (!element->isFormControlElement() && !element->hasTagName(objectTag))
continue;
if (!element->isHTMLElement() || toHTMLElement(element)->form() != this)
continue;
++i;
}
}
return m_associatedElementsAfterIndex++;
}
| 8,819
|
105,766
| 0
|
bool SplitStringIntoKeyValuePairs(
const std::string& line,
char key_value_delimiter,
char key_value_pair_delimiter,
std::vector<std::pair<std::string, std::string> >* kv_pairs) {
kv_pairs->clear();
std::vector<std::string> pairs;
SplitString(line, key_value_pair_delimiter, &pairs);
bool success = true;
for (size_t i = 0; i < pairs.size(); ++i) {
if (pairs[i].empty())
continue;
std::string key;
std::vector<std::string> value;
if (!SplitStringIntoKeyValues(pairs[i],
key_value_delimiter,
&key, &value)) {
success = false;
}
DCHECK_LE(value.size(), 1U);
kv_pairs->push_back(make_pair(key, value.empty()? "" : value[0]));
}
return success;
}
| 8,820
|
165,031
| 0
|
HTMLCanvasElement::RenderingContextFactories() {
DCHECK(IsMainThread());
DEFINE_STATIC_LOCAL(ContextFactoryVector, context_factories,
(CanvasRenderingContext::kMaxValue));
return context_factories;
}
| 8,821
|
87,662
| 0
|
void hsr_dev_setup(struct net_device *dev)
{
eth_hw_addr_random(dev);
ether_setup(dev);
dev->min_mtu = 0;
dev->header_ops = &hsr_header_ops;
dev->netdev_ops = &hsr_device_ops;
SET_NETDEV_DEVTYPE(dev, &hsr_type);
dev->priv_flags |= IFF_NO_QUEUE;
dev->needs_free_netdev = true;
dev->priv_destructor = hsr_dev_destroy;
dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA |
NETIF_F_GSO_MASK | NETIF_F_HW_CSUM |
NETIF_F_HW_VLAN_CTAG_TX;
dev->features = dev->hw_features;
/* Prevent recursive tx locking */
dev->features |= NETIF_F_LLTX;
/* VLAN on top of HSR needs testing and probably some work on
* hsr_header_create() etc.
*/
dev->features |= NETIF_F_VLAN_CHALLENGED;
/* Not sure about this. Taken from bridge code. netdev_features.h says
* it means "Does not change network namespaces".
*/
dev->features |= NETIF_F_NETNS_LOCAL;
}
| 8,822
|
176,755
| 0
|
native_handle* Parcel::readNativeHandle() const
{
int numFds, numInts;
status_t err;
err = readInt32(&numFds);
if (err != NO_ERROR) return 0;
err = readInt32(&numInts);
if (err != NO_ERROR) return 0;
native_handle* h = native_handle_create(numFds, numInts);
if (!h) {
return 0;
}
for (int i=0 ; err==NO_ERROR && i<numFds ; i++) {
h->data[i] = dup(readFileDescriptor());
if (h->data[i] < 0) {
for (int j = 0; j < i; j++) {
close(h->data[j]);
}
native_handle_delete(h);
return 0;
}
}
err = read(h->data + numFds, sizeof(int)*numInts);
if (err != NO_ERROR) {
native_handle_close(h);
native_handle_delete(h);
h = 0;
}
return h;
}
| 8,823
|
118,185
| 0
|
ValidityMessage::ValidityMessage(const base::string16& text, bool sure)
: text(text), sure(sure) {}
| 8,824
|
60,383
| 0
|
sftp_server_main(int argc, char **argv, struct passwd *user_pw)
{
fd_set *rset, *wset;
int i, r, in, out, max, ch, skipargs = 0, log_stderr = 0;
ssize_t len, olen, set_size;
SyslogFacility log_facility = SYSLOG_FACILITY_AUTH;
char *cp, *homedir = NULL, buf[4*4096];
long mask;
extern char *optarg;
extern char *__progname;
ssh_malloc_init(); /* must be called before any mallocs */
log_init(__progname, log_level, log_facility, log_stderr);
pw = pwcopy(user_pw);
while (!skipargs && (ch = getopt(argc, argv,
"d:f:l:P:p:Q:u:cehR")) != -1) {
switch (ch) {
case 'Q':
if (strcasecmp(optarg, "requests") != 0) {
fprintf(stderr, "Invalid query type\n");
exit(1);
}
for (i = 0; handlers[i].handler != NULL; i++)
printf("%s\n", handlers[i].name);
for (i = 0; extended_handlers[i].handler != NULL; i++)
printf("%s\n", extended_handlers[i].name);
exit(0);
break;
case 'R':
readonly = 1;
break;
case 'c':
/*
* Ignore all arguments if we are invoked as a
* shell using "sftp-server -c command"
*/
skipargs = 1;
break;
case 'e':
log_stderr = 1;
break;
case 'l':
log_level = log_level_number(optarg);
if (log_level == SYSLOG_LEVEL_NOT_SET)
error("Invalid log level \"%s\"", optarg);
break;
case 'f':
log_facility = log_facility_number(optarg);
if (log_facility == SYSLOG_FACILITY_NOT_SET)
error("Invalid log facility \"%s\"", optarg);
break;
case 'd':
cp = tilde_expand_filename(optarg, user_pw->pw_uid);
homedir = percent_expand(cp, "d", user_pw->pw_dir,
"u", user_pw->pw_name, (char *)NULL);
free(cp);
break;
case 'p':
if (request_whitelist != NULL)
fatal("Permitted requests already set");
request_whitelist = xstrdup(optarg);
break;
case 'P':
if (request_blacklist != NULL)
fatal("Refused requests already set");
request_blacklist = xstrdup(optarg);
break;
case 'u':
errno = 0;
mask = strtol(optarg, &cp, 8);
if (mask < 0 || mask > 0777 || *cp != '\0' ||
cp == optarg || (mask == 0 && errno != 0))
fatal("Invalid umask \"%s\"", optarg);
(void)umask((mode_t)mask);
break;
case 'h':
default:
sftp_server_usage();
}
}
log_init(__progname, log_level, log_facility, log_stderr);
if ((cp = getenv("SSH_CONNECTION")) != NULL) {
client_addr = xstrdup(cp);
if ((cp = strchr(client_addr, ' ')) == NULL) {
error("Malformed SSH_CONNECTION variable: \"%s\"",
getenv("SSH_CONNECTION"));
sftp_server_cleanup_exit(255);
}
*cp = '\0';
} else
client_addr = xstrdup("UNKNOWN");
logit("session opened for local user %s from [%s]",
pw->pw_name, client_addr);
in = STDIN_FILENO;
out = STDOUT_FILENO;
max = 0;
if (in > max)
max = in;
if (out > max)
max = out;
if ((iqueue = sshbuf_new()) == NULL)
fatal("%s: sshbuf_new failed", __func__);
if ((oqueue = sshbuf_new()) == NULL)
fatal("%s: sshbuf_new failed", __func__);
rset = xcalloc(howmany(max + 1, NFDBITS), sizeof(fd_mask));
wset = xcalloc(howmany(max + 1, NFDBITS), sizeof(fd_mask));
if (homedir != NULL) {
if (chdir(homedir) != 0) {
error("chdir to \"%s\" failed: %s", homedir,
strerror(errno));
}
}
set_size = howmany(max + 1, NFDBITS) * sizeof(fd_mask);
for (;;) {
memset(rset, 0, set_size);
memset(wset, 0, set_size);
/*
* Ensure that we can read a full buffer and handle
* the worst-case length packet it can generate,
* otherwise apply backpressure by stopping reads.
*/
if ((r = sshbuf_check_reserve(iqueue, sizeof(buf))) == 0 &&
(r = sshbuf_check_reserve(oqueue,
SFTP_MAX_MSG_LENGTH)) == 0)
FD_SET(in, rset);
else if (r != SSH_ERR_NO_BUFFER_SPACE)
fatal("%s: sshbuf_check_reserve failed: %s",
__func__, ssh_err(r));
olen = sshbuf_len(oqueue);
if (olen > 0)
FD_SET(out, wset);
if (select(max+1, rset, wset, NULL, NULL) < 0) {
if (errno == EINTR)
continue;
error("select: %s", strerror(errno));
sftp_server_cleanup_exit(2);
}
/* copy stdin to iqueue */
if (FD_ISSET(in, rset)) {
len = read(in, buf, sizeof buf);
if (len == 0) {
debug("read eof");
sftp_server_cleanup_exit(0);
} else if (len < 0) {
error("read: %s", strerror(errno));
sftp_server_cleanup_exit(1);
} else if ((r = sshbuf_put(iqueue, buf, len)) != 0) {
fatal("%s: buffer error: %s",
__func__, ssh_err(r));
}
}
/* send oqueue to stdout */
if (FD_ISSET(out, wset)) {
len = write(out, sshbuf_ptr(oqueue), olen);
if (len < 0) {
error("write: %s", strerror(errno));
sftp_server_cleanup_exit(1);
} else if ((r = sshbuf_consume(oqueue, len)) != 0) {
fatal("%s: buffer error: %s",
__func__, ssh_err(r));
}
}
/*
* Process requests from client if we can fit the results
* into the output buffer, otherwise stop processing input
* and let the output queue drain.
*/
r = sshbuf_check_reserve(oqueue, SFTP_MAX_MSG_LENGTH);
if (r == 0)
process();
else if (r != SSH_ERR_NO_BUFFER_SPACE)
fatal("%s: sshbuf_check_reserve: %s",
__func__, ssh_err(r));
}
}
| 8,825
|
104,036
| 0
|
bool GLES2DecoderImpl::DoIsShader(GLuint client_id) {
return GetShaderInfo(client_id) != NULL;
}
| 8,826
|
57,331
| 0
|
ZEND_API zend_object *zend_get_this_object(zend_execute_data *ex) /* {{{ */
{
while (ex) {
if (Z_OBJ(ex->This)) {
return Z_OBJ(ex->This);
} else if (ex->func) {
if (ex->func->type != ZEND_INTERNAL_FUNCTION || ex->func->common.scope) {
return Z_OBJ(ex->This);
}
}
ex = ex->prev_execute_data;
}
return NULL;
}
/* }}} */
| 8,827
|
68,250
| 0
|
static ssize_t do_tcp_sendpages(struct sock *sk, struct page *page, int offset,
size_t size, int flags)
{
struct tcp_sock *tp = tcp_sk(sk);
int mss_now, size_goal;
int err;
ssize_t copied;
long timeo = sock_sndtimeo(sk, flags & MSG_DONTWAIT);
/* Wait for a connection to finish. One exception is TCP Fast Open
* (passive side) where data is allowed to be sent before a connection
* is fully established.
*/
if (((1 << sk->sk_state) & ~(TCPF_ESTABLISHED | TCPF_CLOSE_WAIT)) &&
!tcp_passive_fastopen(sk)) {
err = sk_stream_wait_connect(sk, &timeo);
if (err != 0)
goto out_err;
}
sk_clear_bit(SOCKWQ_ASYNC_NOSPACE, sk);
mss_now = tcp_send_mss(sk, &size_goal, flags);
copied = 0;
err = -EPIPE;
if (sk->sk_err || (sk->sk_shutdown & SEND_SHUTDOWN))
goto out_err;
while (size > 0) {
struct sk_buff *skb = tcp_write_queue_tail(sk);
int copy, i;
bool can_coalesce;
if (!tcp_send_head(sk) || (copy = size_goal - skb->len) <= 0 ||
!tcp_skb_can_collapse_to(skb)) {
new_segment:
if (!sk_stream_memory_free(sk))
goto wait_for_sndbuf;
skb = sk_stream_alloc_skb(sk, 0, sk->sk_allocation,
skb_queue_empty(&sk->sk_write_queue));
if (!skb)
goto wait_for_memory;
skb_entail(sk, skb);
copy = size_goal;
}
if (copy > size)
copy = size;
i = skb_shinfo(skb)->nr_frags;
can_coalesce = skb_can_coalesce(skb, i, page, offset);
if (!can_coalesce && i >= sysctl_max_skb_frags) {
tcp_mark_push(tp, skb);
goto new_segment;
}
if (!sk_wmem_schedule(sk, copy))
goto wait_for_memory;
if (can_coalesce) {
skb_frag_size_add(&skb_shinfo(skb)->frags[i - 1], copy);
} else {
get_page(page);
skb_fill_page_desc(skb, i, page, offset, copy);
}
skb_shinfo(skb)->tx_flags |= SKBTX_SHARED_FRAG;
skb->len += copy;
skb->data_len += copy;
skb->truesize += copy;
sk->sk_wmem_queued += copy;
sk_mem_charge(sk, copy);
skb->ip_summed = CHECKSUM_PARTIAL;
tp->write_seq += copy;
TCP_SKB_CB(skb)->end_seq += copy;
tcp_skb_pcount_set(skb, 0);
if (!copied)
TCP_SKB_CB(skb)->tcp_flags &= ~TCPHDR_PSH;
copied += copy;
offset += copy;
size -= copy;
if (!size) {
tcp_tx_timestamp(sk, sk->sk_tsflags, skb);
goto out;
}
if (skb->len < size_goal || (flags & MSG_OOB))
continue;
if (forced_push(tp)) {
tcp_mark_push(tp, skb);
__tcp_push_pending_frames(sk, mss_now, TCP_NAGLE_PUSH);
} else if (skb == tcp_send_head(sk))
tcp_push_one(sk, mss_now);
continue;
wait_for_sndbuf:
set_bit(SOCK_NOSPACE, &sk->sk_socket->flags);
wait_for_memory:
tcp_push(sk, flags & ~MSG_MORE, mss_now,
TCP_NAGLE_PUSH, size_goal);
err = sk_stream_wait_memory(sk, &timeo);
if (err != 0)
goto do_error;
mss_now = tcp_send_mss(sk, &size_goal, flags);
}
out:
if (copied && !(flags & MSG_SENDPAGE_NOTLAST))
tcp_push(sk, flags, mss_now, tp->nonagle, size_goal);
return copied;
do_error:
if (copied)
goto out;
out_err:
/* make sure we wake any epoll edge trigger waiter */
if (unlikely(skb_queue_len(&sk->sk_write_queue) == 0 &&
err == -EAGAIN)) {
sk->sk_write_space(sk);
tcp_chrono_stop(sk, TCP_CHRONO_SNDBUF_LIMITED);
}
return sk_stream_error(sk, flags, err);
}
| 8,828
|
7,564
| 0
|
static void cirrus_bitblt_cputovideo_next(CirrusVGAState * s)
{
int copy_count;
uint8_t *end_ptr;
if (s->cirrus_srccounter > 0) {
if (s->cirrus_blt_mode & CIRRUS_BLTMODE_PATTERNCOPY) {
cirrus_bitblt_common_patterncopy(s, s->cirrus_bltbuf);
the_end:
s->cirrus_srccounter = 0;
cirrus_bitblt_reset(s);
} else {
/* at least one scan line */
do {
(*s->cirrus_rop)(s, s->vga.vram_ptr +
(s->cirrus_blt_dstaddr & s->cirrus_addr_mask),
s->cirrus_bltbuf, 0, 0, s->cirrus_blt_width, 1);
cirrus_invalidate_region(s, s->cirrus_blt_dstaddr, 0,
s->cirrus_blt_width, 1);
s->cirrus_blt_dstaddr += s->cirrus_blt_dstpitch;
s->cirrus_srccounter -= s->cirrus_blt_srcpitch;
if (s->cirrus_srccounter <= 0)
goto the_end;
/* more bytes than needed can be transferred because of
word alignment, so we keep them for the next line */
/* XXX: keep alignment to speed up transfer */
end_ptr = s->cirrus_bltbuf + s->cirrus_blt_srcpitch;
copy_count = s->cirrus_srcptr_end - end_ptr;
memmove(s->cirrus_bltbuf, end_ptr, copy_count);
s->cirrus_srcptr = s->cirrus_bltbuf + copy_count;
s->cirrus_srcptr_end = s->cirrus_bltbuf + s->cirrus_blt_srcpitch;
} while (s->cirrus_srcptr >= s->cirrus_srcptr_end);
}
}
}
| 8,829
|
57,176
| 0
|
static int nfs4_opendata_access(struct rpc_cred *cred,
struct nfs4_opendata *opendata,
struct nfs4_state *state, fmode_t fmode,
int openflags)
{
struct nfs_access_entry cache;
u32 mask;
/* access call failed or for some reason the server doesn't
* support any access modes -- defer access call until later */
if (opendata->o_res.access_supported == 0)
return 0;
mask = 0;
/*
* Use openflags to check for exec, because fmode won't
* always have FMODE_EXEC set when file open for exec.
*/
if (openflags & __FMODE_EXEC) {
/* ONLY check for exec rights */
mask = MAY_EXEC;
} else if ((fmode & FMODE_READ) && !opendata->file_created)
mask = MAY_READ;
cache.cred = cred;
cache.jiffies = jiffies;
nfs_access_set_mask(&cache, opendata->o_res.access_result);
nfs_access_add_cache(state->inode, &cache);
if ((mask & ~cache.mask & (MAY_READ | MAY_EXEC)) == 0)
return 0;
/* even though OPEN succeeded, access is denied. Close the file */
nfs4_close_state(state, fmode);
return -EACCES;
}
| 8,830
|
101,529
| 0
|
bool PrintWebViewHelper::PrintPages(const PrintMsg_PrintPages_Params& params,
WebFrame* frame,
const WebNode& node,
PrepareFrameAndViewForPrint* prepare) {
PrintMsg_Print_Params print_params = params.params;
scoped_ptr<PrepareFrameAndViewForPrint> prep_frame_view;
if (!prepare) {
prep_frame_view.reset(new PrepareFrameAndViewForPrint(print_params, frame,
node));
prepare = prep_frame_view.get();
}
UpdatePrintableSizeInPrintParameters(frame, node, prepare, &print_params);
int page_count = prepare->GetExpectedPageCount();
if (!page_count)
return false;
Send(new PrintHostMsg_DidGetPrintedPagesCount(routing_id(),
print_params.document_cookie,
page_count));
const gfx::Size& canvas_size = prepare->GetPrintCanvasSize();
PrintMsg_PrintPage_Params page_params;
page_params.params = print_params;
if (params.pages.empty()) {
for (int i = 0; i < page_count; ++i) {
page_params.page_number = i;
PrintPageInternal(page_params, canvas_size, frame);
}
} else {
for (size_t i = 0; i < params.pages.size(); ++i) {
if (params.pages[i] >= page_count)
break;
page_params.page_number = params.pages[i];
PrintPageInternal(page_params, canvas_size, frame);
}
}
return true;
}
| 8,831
|
93,783
| 0
|
virDomainDelIOThread(virDomainPtr domain,
unsigned int iothread_id,
unsigned int flags)
{
virConnectPtr conn;
VIR_DOMAIN_DEBUG(domain, "iothread_id=%u, flags=%x", iothread_id, flags);
virResetLastError();
virCheckDomainReturn(domain, -1);
virCheckReadOnlyGoto(domain->conn->flags, error);
virCheckNonZeroArgGoto(iothread_id, error);
conn = domain->conn;
if (conn->driver->domainDelIOThread) {
int ret;
ret = conn->driver->domainDelIOThread(domain, iothread_id, flags);
if (ret < 0)
goto error;
return ret;
}
virReportUnsupportedError();
error:
virDispatchError(domain->conn);
return -1;
}
| 8,832
|
32,708
| 0
|
static u32 tg3_read_indirect_reg32(struct tg3 *tp, u32 off)
{
unsigned long flags;
u32 val;
spin_lock_irqsave(&tp->indirect_lock, flags);
pci_write_config_dword(tp->pdev, TG3PCI_REG_BASE_ADDR, off);
pci_read_config_dword(tp->pdev, TG3PCI_REG_DATA, &val);
spin_unlock_irqrestore(&tp->indirect_lock, flags);
return val;
}
| 8,833
|
116,830
| 0
|
void PopupContainer::hide()
{
m_listBox->abandon();
}
| 8,834
|
173,005
| 0
|
set_text(png_structp png_ptr, png_infop info_ptr, png_textp text,
png_charp param)
{
switch (param[0])
{
case '<':
{
png_bytep file = NULL;
text->text_length = load_file(param+1, &file);
text->text = (png_charp)file;
}
break;
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
{
png_bytep data = NULL;
png_size_t fake_len = load_fake(param, &data);
if (fake_len > 0) /* else a simple parameter */
{
text->text_length = fake_len;
text->text = (png_charp)data;
break;
}
}
default:
text->text = param;
break;
}
png_set_text(png_ptr, info_ptr, text, 1);
if (text->text != param)
free(text->text);
}
| 8,835
|
115,843
| 0
|
void NavigationController::GoToOffset(int offset) {
int index = (transient_entry_index_ != -1) ?
transient_entry_index_ + offset :
last_committed_entry_index_ + offset;
if (index < 0 || index >= entry_count())
return;
GoToIndex(index);
}
| 8,836
|
99,233
| 0
|
void ResourceMessageFilter::OnGetWindowRect(gfx::NativeViewId view,
IPC::Message* reply_msg) {
ChromeThread::PostTask(
ChromeThread::BACKGROUND_X11, FROM_HERE,
NewRunnableMethod(
this, &ResourceMessageFilter::DoOnGetWindowRect, view, reply_msg));
}
| 8,837
|
172,558
| 0
|
void SoftAAC2::drainDecoder() {
while (mOutputDelayCompensated > 0) {
INT_PCM tmpOutBuffer[2048 * MAX_CHANNEL_COUNT];
mDrcWrap.submitStreamData(mStreamInfo);
mDrcWrap.update();
AAC_DECODER_ERROR decoderErr =
aacDecoder_DecodeFrame(mAACDecoder,
tmpOutBuffer,
2048 * MAX_CHANNEL_COUNT,
AACDEC_FLUSH);
if (decoderErr != AAC_DEC_OK) {
ALOGW("aacDecoder_DecodeFrame decoderErr = 0x%4.4x", decoderErr);
}
int32_t tmpOutBufferSamples = mStreamInfo->frameSize * mStreamInfo->numChannels;
if (tmpOutBufferSamples > mOutputDelayCompensated) {
tmpOutBufferSamples = mOutputDelayCompensated;
}
outputDelayRingBufferPutSamples(tmpOutBuffer, tmpOutBufferSamples);
mOutputDelayCompensated -= tmpOutBufferSamples;
}
}
| 8,838
|
15,550
| 0
|
muxserver_listen(void)
{
mode_t old_umask;
char *orig_control_path = options.control_path;
char rbuf[16+1];
u_int i, r;
int oerrno;
if (options.control_path == NULL ||
options.control_master == SSHCTL_MASTER_NO)
return;
debug("setting up multiplex master socket");
/*
* Use a temporary path before listen so we can pseudo-atomically
* establish the listening socket in its final location to avoid
* other processes racing in between bind() and listen() and hitting
* an unready socket.
*/
for (i = 0; i < sizeof(rbuf) - 1; i++) {
r = arc4random_uniform(26+26+10);
rbuf[i] = (r < 26) ? 'a' + r :
(r < 26*2) ? 'A' + r - 26 :
'0' + r - 26 - 26;
}
rbuf[sizeof(rbuf) - 1] = '\0';
options.control_path = NULL;
xasprintf(&options.control_path, "%s.%s", orig_control_path, rbuf);
debug3("%s: temporary control path %s", __func__, options.control_path);
old_umask = umask(0177);
muxserver_sock = unix_listener(options.control_path, 64, 0);
oerrno = errno;
umask(old_umask);
if (muxserver_sock < 0) {
if (oerrno == EINVAL || oerrno == EADDRINUSE) {
error("ControlSocket %s already exists, "
"disabling multiplexing", options.control_path);
disable_mux_master:
if (muxserver_sock != -1) {
close(muxserver_sock);
muxserver_sock = -1;
}
free(orig_control_path);
free(options.control_path);
options.control_path = NULL;
options.control_master = SSHCTL_MASTER_NO;
return;
} else {
/* unix_listener() logs the error */
cleanup_exit(255);
}
}
/* Now atomically "move" the mux socket into position */
if (link(options.control_path, orig_control_path) != 0) {
if (errno != EEXIST) {
fatal("%s: link mux listener %s => %s: %s", __func__,
options.control_path, orig_control_path,
strerror(errno));
}
error("ControlSocket %s already exists, disabling multiplexing",
orig_control_path);
unlink(options.control_path);
goto disable_mux_master;
}
unlink(options.control_path);
free(options.control_path);
options.control_path = orig_control_path;
set_nonblock(muxserver_sock);
mux_listener_channel = channel_new("mux listener",
SSH_CHANNEL_MUX_LISTENER, muxserver_sock, muxserver_sock, -1,
CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT,
0, options.control_path, 1);
mux_listener_channel->mux_rcb = mux_master_read_cb;
debug3("%s: mux listener channel %d fd %d", __func__,
mux_listener_channel->self, mux_listener_channel->sock);
}
| 8,839
|
64,285
| 0
|
static const char *set_gprof_dir(cmd_parms *cmd, void *dummy, const char *arg)
{
void *sconf = cmd->server->module_config;
core_server_config *conf = ap_get_core_module_config(sconf);
const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE);
if (err != NULL) {
return err;
}
conf->gprof_dir = arg;
return NULL;
}
| 8,840
|
42,043
| 0
|
void ipc_rcu_free(struct rcu_head *head)
{
struct ipc_rcu *p = container_of(head, struct ipc_rcu, rcu);
kvfree(p);
}
| 8,841
|
108,076
| 0
|
void GLES2DecoderImpl::DoFramebufferTexture2D(
GLenum target, GLenum attachment, GLenum textarget,
GLuint client_texture_id, GLint level) {
if (!bound_framebuffer_) {
SetGLError(GL_INVALID_OPERATION,
"glFramebufferTexture2D: no framebuffer bound.");
return;
}
GLuint service_id = 0;
TextureManager::TextureInfo* info = NULL;
if (client_texture_id) {
info = GetTextureInfo(client_texture_id);
if (!info) {
SetGLError(GL_INVALID_OPERATION,
"glFramebufferTexture2D: unknown texture");
return;
}
service_id = info->service_id();
}
glFramebufferTexture2DEXT(target, attachment, textarget, service_id, level);
if (service_id != 0 &&
glCheckFramebufferStatusEXT(target) == GL_FRAMEBUFFER_COMPLETE) {
ClearUnclearedRenderbuffers(bound_framebuffer_);
}
}
| 8,842
|
155,523
| 0
|
AttestationPermissionRequestSheetModel::AttestationPermissionRequestSheetModel(
AuthenticatorRequestDialogModel* dialog_model)
: AuthenticatorSheetModelBase(dialog_model) {}
| 8,843
|
145,690
| 0
|
unsigned ImageInputType::height() const
{
RefPtrWillBeRawPtr<HTMLInputElement> element(this->element());
if (!element->layoutObject()) {
unsigned height;
if (parseHTMLNonNegativeInteger(element->fastGetAttribute(heightAttr), height))
return height;
HTMLImageLoader* imageLoader = element->imageLoader();
if (imageLoader && imageLoader->image())
return imageLoader->image()->imageSize(LayoutObject::shouldRespectImageOrientation(nullptr), 1).height();
}
element->document().updateLayout();
LayoutBox* box = element->layoutBox();
return box ? adjustForAbsoluteZoom(box->contentHeight(), box) : 0;
}
| 8,844
|
163,791
| 0
|
viz::SurfaceId DelegatedFrameHost::SurfaceIdAtPoint(
viz::SurfaceHittestDelegate* delegate,
const gfx::Point& point,
gfx::Point* transformed_point) {
viz::SurfaceId surface_id(frame_sink_id_, local_surface_id_);
if (!surface_id.is_valid())
return surface_id;
viz::SurfaceHittest hittest(delegate,
GetFrameSinkManager()->surface_manager());
gfx::Transform target_transform;
viz::SurfaceId target_local_surface_id =
hittest.GetTargetSurfaceAtPoint(surface_id, point, &target_transform);
*transformed_point = point;
if (target_local_surface_id.is_valid())
target_transform.TransformPoint(transformed_point);
return target_local_surface_id;
}
| 8,845
|
140,035
| 0
|
bool HTMLMediaElement::mediaTracksEnabledInternally() {
return RuntimeEnabledFeatures::audioVideoTracksEnabled() ||
RuntimeEnabledFeatures::backgroundVideoTrackOptimizationEnabled();
}
| 8,846
|
143,219
| 0
|
LayoutViewItem Document::layoutViewItem() const
{
return LayoutViewItem(m_layoutView);
}
| 8,847
|
132,688
| 0
|
explicit UseSynchronousResizeModeVisitor(bool enable) : enable_(enable) {}
| 8,848
|
88,508
| 0
|
MagickExport MagickBooleanType CloseBlob(Image *image)
{
BlobInfo
*magick_restrict blob_info;
int
status;
/*
Close image file.
*/
assert(image != (Image *) NULL);
assert(image->signature == MagickCoreSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
blob_info=image->blob;
if ((blob_info == (BlobInfo *) NULL) || (blob_info->type == UndefinedStream))
return(MagickTrue);
status=SyncBlob(image);
switch (blob_info->type)
{
case UndefinedStream:
case StandardStream:
break;
case FileStream:
case PipeStream:
{
if (blob_info->synchronize != MagickFalse)
status=fsync(fileno(blob_info->file_info.file));
status=ferror(blob_info->file_info.file);
break;
}
case ZipStream:
{
#if defined(MAGICKCORE_ZLIB_DELEGATE)
(void) gzerror(blob_info->file_info.gzfile,&status);
#endif
break;
}
case BZipStream:
{
#if defined(MAGICKCORE_BZLIB_DELEGATE)
(void) BZ2_bzerror(blob_info->file_info.bzfile,&status);
#endif
break;
}
case FifoStream:
break;
case BlobStream:
{
if (blob_info->file_info.file != (FILE *) NULL)
{
if (blob_info->synchronize != MagickFalse)
status=fsync(fileno(blob_info->file_info.file));
status=ferror(blob_info->file_info.file);
}
break;
}
}
blob_info->status=status < 0 ? MagickTrue : MagickFalse;
blob_info->size=GetBlobSize(image);
image->extent=blob_info->size;
blob_info->eof=MagickFalse;
blob_info->error=0;
if (blob_info->exempt != MagickFalse)
{
blob_info->type=UndefinedStream;
return(blob_info->status);
}
switch (blob_info->type)
{
case UndefinedStream:
case StandardStream:
break;
case FileStream:
{
if (fileno(blob_info->file_info.file) != -1)
status=fclose(blob_info->file_info.file);
break;
}
case PipeStream:
{
#if defined(MAGICKCORE_HAVE_PCLOSE)
status=pclose(blob_info->file_info.file);
#endif
break;
}
case ZipStream:
{
#if defined(MAGICKCORE_ZLIB_DELEGATE)
status=gzclose(blob_info->file_info.gzfile);
#endif
break;
}
case BZipStream:
{
#if defined(MAGICKCORE_BZLIB_DELEGATE)
BZ2_bzclose(blob_info->file_info.bzfile);
#endif
break;
}
case FifoStream:
break;
case BlobStream:
{
if (blob_info->file_info.file != (FILE *) NULL)
status=fclose(blob_info->file_info.file);
break;
}
}
(void) DetachBlob(blob_info);
blob_info->status=status < 0 ? MagickTrue : MagickFalse;
return(blob_info->status);
}
| 8,849
|
47,272
| 0
|
static void lzo_exit(struct crypto_tfm *tfm)
{
struct lzo_ctx *ctx = crypto_tfm_ctx(tfm);
kvfree(ctx->lzo_comp_mem);
}
| 8,850
|
42,009
| 0
|
static void ss_wakeup(struct list_head *h, int kill)
{
struct msg_sender *mss, *t;
list_for_each_entry_safe(mss, t, h, list) {
if (kill)
mss->list.next = NULL;
wake_up_process(mss->tsk);
}
}
| 8,851
|
156,878
| 0
|
LocalFrame* DocumentInit::GetFrame() const {
return document_loader_ ? document_loader_->GetFrame() : nullptr;
}
| 8,852
|
109,301
| 0
|
void InspectorPageAgent::getNavigationHistory(ErrorString*, int*, RefPtr<TypeBuilder::Array<TypeBuilder::Page::NavigationEntry> >&)
{ }
| 8,853
|
9,684
| 0
|
find_unicode_charmap( FT_Face face )
{
FT_CharMap* first;
FT_CharMap* cur;
/* caller should have already checked that `face' is valid */
FT_ASSERT( face );
first = face->charmaps;
if ( !first )
return FT_Err_Invalid_CharMap_Handle;
/*
* The original TrueType specification(s) only specified charmap
* formats that are capable of mapping 8 or 16 bit character codes to
* glyph indices.
*
* However, recent updates to the Apple and OpenType specifications
* introduced new formats that are capable of mapping 32-bit character
* codes as well. And these are already used on some fonts, mainly to
* map non-BMP Asian ideographs as defined in Unicode.
*
* For compatibility purposes, these fonts generally come with
* *several* Unicode charmaps:
*
* - One of them in the "old" 16-bit format, that cannot access
* all glyphs in the font.
*
* - Another one in the "new" 32-bit format, that can access all
* the glyphs.
*
* This function has been written to always favor a 32-bit charmap
* when found. Otherwise, a 16-bit one is returned when found.
*/
/* Since the `interesting' table, with IDs (3,10), is normally the */
/* last one, we loop backwards. This loses with type1 fonts with */
/* non-BMP characters (<.0001%), this wins with .ttf with non-BMP */
/* chars (.01% ?), and this is the same about 99.99% of the time! */
cur = first + face->num_charmaps; /* points after the last one */
for ( ; --cur >= first; )
{
if ( cur[0]->encoding == FT_ENCODING_UNICODE )
{
/* XXX If some new encodings to represent UCS-4 are added, */
/* they should be added here. */
if ( ( cur[0]->platform_id == TT_PLATFORM_MICROSOFT &&
cur[0]->encoding_id == TT_MS_ID_UCS_4 ) ||
( cur[0]->platform_id == TT_PLATFORM_APPLE_UNICODE &&
cur[0]->encoding_id == TT_APPLE_ID_UNICODE_32 ) )
{
#ifdef FT_MAX_CHARMAP_CACHEABLE
if ( cur - first > FT_MAX_CHARMAP_CACHEABLE )
{
FT_ERROR(( "find_unicode_charmap: UCS-4 cmap is found "
"at too late position (%d)\n", cur - first ));
continue;
}
#endif
face->charmap = cur[0];
return FT_Err_Ok;
}
}
}
/* We do not have any UCS-4 charmap. */
/* Do the loop again and search for UCS-2 charmaps. */
cur = first + face->num_charmaps;
for ( ; --cur >= first; )
{
if ( cur[0]->encoding == FT_ENCODING_UNICODE )
{
#ifdef FT_MAX_CHARMAP_CACHEABLE
if ( cur - first > FT_MAX_CHARMAP_CACHEABLE )
{
FT_ERROR(( "find_unicode_charmap: UCS-2 cmap is found "
"at too late position (%d)\n", cur - first ));
continue;
}
#endif
face->charmap = cur[0];
return FT_Err_Ok;
}
}
return FT_Err_Invalid_CharMap_Handle;
}
| 8,854
|
69,428
| 0
|
struct cifs_ntsd *get_cifs_acl(struct cifs_sb_info *cifs_sb,
struct inode *inode, const char *path,
u32 *pacllen)
{
struct cifs_ntsd *pntsd = NULL;
struct cifsFileInfo *open_file = NULL;
if (inode)
open_file = find_readable_file(CIFS_I(inode), true);
if (!open_file)
return get_cifs_acl_by_path(cifs_sb, path, pacllen);
pntsd = get_cifs_acl_by_fid(cifs_sb, &open_file->fid, pacllen);
cifsFileInfo_put(open_file);
return pntsd;
}
| 8,855
|
159,638
| 0
|
void RenderFrameHostManager::EnsureRenderFrameHostPageFocusConsistent() {
frame_tree_node_->frame_tree()->SetPageFocus(
render_frame_host_->GetSiteInstance(), frame_tree_node_->frame_tree()
->root()
->current_frame_host()
->GetRenderWidgetHost()
->is_focused());
}
| 8,856
|
175,977
| 0
|
void smp_check_auth_req(tSMP_CB* p_cb, tSMP_INT_DATA* p_data) {
uint8_t enc_enable = *(uint8_t*)p_data;
uint8_t reason = enc_enable ? SMP_SUCCESS : SMP_ENC_FAIL;
SMP_TRACE_DEBUG(
"%s rcvs enc_enable=%d i_keys=0x%x r_keys=0x%x (i-initiator r-responder)",
__func__, enc_enable, p_cb->local_i_key, p_cb->local_r_key);
if (enc_enable == 1) {
if (p_cb->le_secure_connections_mode_is_used) {
/* In LE SC mode LTK is used instead of STK and has to be always saved */
p_cb->local_i_key |= SMP_SEC_KEY_TYPE_ENC;
p_cb->local_r_key |= SMP_SEC_KEY_TYPE_ENC;
/* In LE SC mode LK is derived from LTK only if both sides request it */
if (!(p_cb->local_i_key & SMP_SEC_KEY_TYPE_LK) ||
!(p_cb->local_r_key & SMP_SEC_KEY_TYPE_LK)) {
p_cb->local_i_key &= ~SMP_SEC_KEY_TYPE_LK;
p_cb->local_r_key &= ~SMP_SEC_KEY_TYPE_LK;
}
/* In LE SC mode only IRK, IAI, CSRK are exchanged with the peer.
** Set local_r_key on master to expect only these keys.
*/
if (p_cb->role == HCI_ROLE_MASTER) {
p_cb->local_r_key &= (SMP_SEC_KEY_TYPE_ID | SMP_SEC_KEY_TYPE_CSRK);
}
} else {
/* in legacy mode derivation of BR/EDR LK is not supported */
p_cb->local_i_key &= ~SMP_SEC_KEY_TYPE_LK;
p_cb->local_r_key &= ~SMP_SEC_KEY_TYPE_LK;
}
SMP_TRACE_DEBUG(
"%s rcvs upgrades: i_keys=0x%x r_keys=0x%x (i-initiator r-responder)",
__func__, p_cb->local_i_key, p_cb->local_r_key);
if (/*((p_cb->peer_auth_req & SMP_AUTH_BOND) ||
(p_cb->loc_auth_req & SMP_AUTH_BOND)) &&*/
(p_cb->local_i_key || p_cb->local_r_key)) {
smp_sm_event(p_cb, SMP_BOND_REQ_EVT, NULL);
} else
smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason);
} else if (enc_enable == 0) {
/* if failed for encryption after pairing, send callback */
if (p_cb->flags & SMP_PAIR_FLAG_ENC_AFTER_PAIR)
smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason);
/* if enc failed for old security information */
/* if master device, clean up and abck to idle; slave device do nothing */
else if (p_cb->role == HCI_ROLE_MASTER) {
smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason);
}
}
}
| 8,857
|
62,950
| 0
|
static inline bool cpu_has_vmx_vmfunc(void)
{
return vmcs_config.cpu_based_2nd_exec_ctrl &
SECONDARY_EXEC_ENABLE_VMFUNC;
}
| 8,858
|
126,016
| 0
|
void AllDownloadsCompleteObserver::OnDownloadCreated(
DownloadManager* manager, DownloadItem* item) {
if (pre_download_ids_.find(item->GetId()) == pre_download_ids_.end() &&
item->GetState() == DownloadItem::IN_PROGRESS) {
item->AddObserver(this);
pending_downloads_.insert(item);
}
}
| 8,859
|
65,949
| 0
|
svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv)
{
struct svc_program *progp;
struct svc_version *versp = NULL; /* compiler food */
struct svc_procedure *procp = NULL;
struct svc_serv *serv = rqstp->rq_server;
kxdrproc_t xdr;
__be32 *statp;
u32 prog, vers, proc;
__be32 auth_stat, rpc_stat;
int auth_res;
__be32 *reply_statp;
rpc_stat = rpc_success;
if (argv->iov_len < 6*4)
goto err_short_len;
/* Will be turned off only in gss privacy case: */
set_bit(RQ_SPLICE_OK, &rqstp->rq_flags);
/* Will be turned off only when NFSv4 Sessions are used */
set_bit(RQ_USEDEFERRAL, &rqstp->rq_flags);
clear_bit(RQ_DROPME, &rqstp->rq_flags);
/* Setup reply header */
rqstp->rq_xprt->xpt_ops->xpo_prep_reply_hdr(rqstp);
svc_putu32(resv, rqstp->rq_xid);
vers = svc_getnl(argv);
/* First words of reply: */
svc_putnl(resv, 1); /* REPLY */
if (vers != 2) /* RPC version number */
goto err_bad_rpc;
/* Save position in case we later decide to reject: */
reply_statp = resv->iov_base + resv->iov_len;
svc_putnl(resv, 0); /* ACCEPT */
rqstp->rq_prog = prog = svc_getnl(argv); /* program number */
rqstp->rq_vers = vers = svc_getnl(argv); /* version number */
rqstp->rq_proc = proc = svc_getnl(argv); /* procedure number */
for (progp = serv->sv_program; progp; progp = progp->pg_next)
if (prog == progp->pg_prog)
break;
/*
* Decode auth data, and add verifier to reply buffer.
* We do this before anything else in order to get a decent
* auth verifier.
*/
auth_res = svc_authenticate(rqstp, &auth_stat);
/* Also give the program a chance to reject this call: */
if (auth_res == SVC_OK && progp) {
auth_stat = rpc_autherr_badcred;
auth_res = progp->pg_authenticate(rqstp);
}
switch (auth_res) {
case SVC_OK:
break;
case SVC_GARBAGE:
goto err_garbage;
case SVC_SYSERR:
rpc_stat = rpc_system_err;
goto err_bad;
case SVC_DENIED:
goto err_bad_auth;
case SVC_CLOSE:
goto close;
case SVC_DROP:
goto dropit;
case SVC_COMPLETE:
goto sendit;
}
if (progp == NULL)
goto err_bad_prog;
if (vers >= progp->pg_nvers ||
!(versp = progp->pg_vers[vers]))
goto err_bad_vers;
/*
* Some protocol versions (namely NFSv4) require some form of
* congestion control. (See RFC 7530 section 3.1 paragraph 2)
* In other words, UDP is not allowed. We mark those when setting
* up the svc_xprt, and verify that here.
*
* The spec is not very clear about what error should be returned
* when someone tries to access a server that is listening on UDP
* for lower versions. RPC_PROG_MISMATCH seems to be the closest
* fit.
*/
if (versp->vs_need_cong_ctrl &&
!test_bit(XPT_CONG_CTRL, &rqstp->rq_xprt->xpt_flags))
goto err_bad_vers;
procp = versp->vs_proc + proc;
if (proc >= versp->vs_nproc || !procp->pc_func)
goto err_bad_proc;
rqstp->rq_procinfo = procp;
/* Syntactic check complete */
serv->sv_stats->rpccnt++;
/* Build the reply header. */
statp = resv->iov_base +resv->iov_len;
svc_putnl(resv, RPC_SUCCESS);
/* Bump per-procedure stats counter */
procp->pc_count++;
/* Initialize storage for argp and resp */
memset(rqstp->rq_argp, 0, procp->pc_argsize);
memset(rqstp->rq_resp, 0, procp->pc_ressize);
/* un-reserve some of the out-queue now that we have a
* better idea of reply size
*/
if (procp->pc_xdrressize)
svc_reserve_auth(rqstp, procp->pc_xdrressize<<2);
/* Call the function that processes the request. */
if (!versp->vs_dispatch) {
/* Decode arguments */
xdr = procp->pc_decode;
if (xdr && !xdr(rqstp, argv->iov_base, rqstp->rq_argp))
goto err_garbage;
*statp = procp->pc_func(rqstp, rqstp->rq_argp, rqstp->rq_resp);
/* Encode reply */
if (*statp == rpc_drop_reply ||
test_bit(RQ_DROPME, &rqstp->rq_flags)) {
if (procp->pc_release)
procp->pc_release(rqstp, NULL, rqstp->rq_resp);
goto dropit;
}
if (*statp == rpc_autherr_badcred) {
if (procp->pc_release)
procp->pc_release(rqstp, NULL, rqstp->rq_resp);
goto err_bad_auth;
}
if (*statp == rpc_success &&
(xdr = procp->pc_encode) &&
!xdr(rqstp, resv->iov_base+resv->iov_len, rqstp->rq_resp)) {
dprintk("svc: failed to encode reply\n");
/* serv->sv_stats->rpcsystemerr++; */
*statp = rpc_system_err;
}
} else {
dprintk("svc: calling dispatcher\n");
if (!versp->vs_dispatch(rqstp, statp)) {
/* Release reply info */
if (procp->pc_release)
procp->pc_release(rqstp, NULL, rqstp->rq_resp);
goto dropit;
}
}
/* Check RPC status result */
if (*statp != rpc_success)
resv->iov_len = ((void*)statp) - resv->iov_base + 4;
/* Release reply info */
if (procp->pc_release)
procp->pc_release(rqstp, NULL, rqstp->rq_resp);
if (procp->pc_encode == NULL)
goto dropit;
sendit:
if (svc_authorise(rqstp))
goto close;
return 1; /* Caller can now send it */
dropit:
svc_authorise(rqstp); /* doesn't hurt to call this twice */
dprintk("svc: svc_process dropit\n");
return 0;
close:
if (test_bit(XPT_TEMP, &rqstp->rq_xprt->xpt_flags))
svc_close_xprt(rqstp->rq_xprt);
dprintk("svc: svc_process close\n");
return 0;
err_short_len:
svc_printk(rqstp, "short len %zd, dropping request\n",
argv->iov_len);
goto close;
err_bad_rpc:
serv->sv_stats->rpcbadfmt++;
svc_putnl(resv, 1); /* REJECT */
svc_putnl(resv, 0); /* RPC_MISMATCH */
svc_putnl(resv, 2); /* Only RPCv2 supported */
svc_putnl(resv, 2);
goto sendit;
err_bad_auth:
dprintk("svc: authentication failed (%d)\n", ntohl(auth_stat));
serv->sv_stats->rpcbadauth++;
/* Restore write pointer to location of accept status: */
xdr_ressize_check(rqstp, reply_statp);
svc_putnl(resv, 1); /* REJECT */
svc_putnl(resv, 1); /* AUTH_ERROR */
svc_putnl(resv, ntohl(auth_stat)); /* status */
goto sendit;
err_bad_prog:
dprintk("svc: unknown program %d\n", prog);
serv->sv_stats->rpcbadfmt++;
svc_putnl(resv, RPC_PROG_UNAVAIL);
goto sendit;
err_bad_vers:
svc_printk(rqstp, "unknown version (%d for prog %d, %s)\n",
vers, prog, progp->pg_name);
serv->sv_stats->rpcbadfmt++;
svc_putnl(resv, RPC_PROG_MISMATCH);
svc_putnl(resv, progp->pg_lovers);
svc_putnl(resv, progp->pg_hivers);
goto sendit;
err_bad_proc:
svc_printk(rqstp, "unknown procedure (%d)\n", proc);
serv->sv_stats->rpcbadfmt++;
svc_putnl(resv, RPC_PROC_UNAVAIL);
goto sendit;
err_garbage:
svc_printk(rqstp, "failed to decode args\n");
rpc_stat = rpc_garbage_args;
err_bad:
serv->sv_stats->rpcbadfmt++;
svc_putnl(resv, ntohl(rpc_stat));
goto sendit;
}
| 8,860
|
158,234
| 0
|
void RenderWidgetHostImpl::CancelKeyboardLock() {
if (delegate_)
delegate_->CancelKeyboardLock(this);
UnlockKeyboard();
keyboard_lock_allowed_ = false;
keyboard_lock_requested_ = false;
keyboard_keys_to_lock_.reset();
}
| 8,861
|
63,001
| 0
|
static int nested_vmx_check_permission(struct kvm_vcpu *vcpu)
{
if (!to_vmx(vcpu)->nested.vmxon) {
kvm_queue_exception(vcpu, UD_VECTOR);
return 0;
}
return 1;
}
| 8,862
|
88,434
| 0
|
uint32_t GPMF_ExpandComplexTYPE(char *src, uint32_t srcsize, char *dst, uint32_t *dstsize)
{
uint32_t i = 0, k = 0, count = 0;
while (i<srcsize && k<*dstsize)
{
if (src[i] == '[' && i>0)
{
int j = 1;
count = 0;
while (src[i + j] >= '0' && src[i + j] <= '9')
{
count *= 10;
count += src[i + j] - '0';
j++;
}
if (count > 1)
{
uint32_t l;
for (l = 1; l<count; l++)
{
dst[k] = src[i - 1];
k++;
}
}
i += j;
if (src[i] == ']') i++;
}
else
{
dst[k] = src[i];
if (dst[k] == 0) break;
i++, k++;
}
}
if (k >= *dstsize)
return GPMF_ERROR_MEMORY; // bad structure formed
dst[k] = 0;
*dstsize = k;
return GPMF_OK;
}
| 8,863
|
93,072
| 0
|
rdpsnd_queue_next_completion(void)
{
struct audio_packet *packet;
long remaining;
struct timeval now;
if (queue_pending == queue_lo)
return -1;
gettimeofday(&now, NULL);
packet = &packet_queue[queue_pending];
remaining = (packet->completion_tv.tv_sec - now.tv_sec) * 1000000 +
(packet->completion_tv.tv_usec - now.tv_usec);
if (remaining < 0)
return 0;
return remaining;
}
| 8,864
|
4,947
| 0
|
gst_qtdemux_handle_src_query (GstPad * pad, GstQuery * query)
{
gboolean res = FALSE;
GstQTDemux *qtdemux = GST_QTDEMUX (gst_pad_get_parent (pad));
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_POSITION:
if (GST_CLOCK_TIME_IS_VALID (qtdemux->segment.last_stop)) {
gst_query_set_position (query, GST_FORMAT_TIME,
qtdemux->segment.last_stop);
res = TRUE;
}
break;
case GST_QUERY_DURATION:{
GstFormat fmt;
gst_query_parse_duration (query, &fmt, NULL);
if (fmt == GST_FORMAT_TIME) {
gint64 duration = -1;
gst_qtdemux_get_duration (qtdemux, &duration);
if (duration > 0) {
gst_query_set_duration (query, GST_FORMAT_TIME, duration);
res = TRUE;
}
}
break;
}
case GST_QUERY_SEEKING:{
GstFormat fmt;
gst_query_parse_seeking (query, &fmt, NULL, NULL, NULL);
if (fmt == GST_FORMAT_TIME) {
gint64 duration = -1;
gst_qtdemux_get_duration (qtdemux, &duration);
gst_query_set_seeking (query, GST_FORMAT_TIME, qtdemux->pullbased,
0, duration);
res = TRUE;
}
break;
}
default:
res = gst_pad_query_default (pad, query);
break;
}
gst_object_unref (qtdemux);
return res;
}
| 8,865
|
71,659
| 0
|
static MagickStatusType ReadPSDMergedImage(Image* image,
const PSDInfo* psd_info,ExceptionInfo *exception)
{
MagickOffsetType
*offsets;
MagickStatusType
status;
PSDCompressionType
compression;
register ssize_t
i;
compression=(PSDCompressionType) ReadBlobMSBShort(image);
image->compression=ConvertPSDCompression(compression);
if (compression != Raw && compression != RLE)
{
(void) ThrowMagickException(exception,GetMagickModule(),
TypeWarning,"CompressionNotSupported","'%.20g'",(double) compression);
return(MagickFalse);
}
offsets=(MagickOffsetType *) NULL;
if (compression == RLE)
{
offsets=ReadPSDRLEOffsets(image,psd_info,image->rows*psd_info->channels);
if (offsets == (MagickOffsetType *) NULL)
ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
image->filename);
}
status=MagickTrue;
for (i=0; i < (ssize_t) psd_info->channels; i++)
{
if (compression == RLE)
status=ReadPSDChannelRLE(image,psd_info,i,offsets+(i*image->rows),
exception);
else
status=ReadPSDChannelRaw(image,psd_info->channels,i,exception);
if (status == MagickFalse)
break;
status=SetImageProgress(image,LoadImagesTag,i,psd_info->channels);
if (status == MagickFalse)
break;
}
if (image->colorspace == CMYKColorspace)
(void) NegateImage(image,MagickFalse);
if (offsets != (MagickOffsetType *) NULL)
offsets=(MagickOffsetType *) RelinquishMagickMemory(offsets);
return(status);
}
| 8,866
|
51,847
| 0
|
dissect_common_timing_advance(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
{
guint8 cfn;
guint16 timing_advance;
/* CFN control */
cfn = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_fp_cfn_control, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
/* Timing Advance */
timing_advance = (tvb_get_guint8(tvb, offset) & 0x3f) * 4;
proto_tree_add_uint(tree, hf_fp_timing_advance, tvb, offset, 1, timing_advance);
offset++;
col_append_fstr(pinfo->cinfo, COL_INFO, " CFN = %u, TA = %u",
cfn, timing_advance);
return offset;
}
| 8,867
|
123,179
| 0
|
int RenderWidgetHostViewAura::GetNonClientComponent(
const gfx::Point& point) const {
return HTCLIENT;
}
| 8,868
|
186,640
| 1
|
void HTMLImportsController::Dispose() {
for (const auto& loader : loaders_)
loader->Dispose();
loaders_.clear();
if (root_) {
root_->Dispose();
root_.Clear();
}
}
| 8,869
|
95,395
| 0
|
static int auth_count_scoreboard(cmd_rec *cmd, char *user) {
char *key;
void *v;
pr_scoreboard_entry_t *score = NULL;
long cur = 0, hcur = 0, ccur = 0, hostsperuser = 1, usersessions = 0;
config_rec *c = NULL, *maxc = NULL;
/* First, check to see which Max* directives are configured. If none
* are configured, then there is no need for us to needlessly scan the
* ScoreboardFile.
*/
if (have_client_limits(cmd) == FALSE) {
return 0;
}
/* Determine how many users are currently connected. */
/* We use this call to get the possibly-changed user name. */
(void) pr_auth_get_anon_config(cmd->tmp_pool, &user, NULL, NULL);
/* Gather our statistics. */
if (user) {
char curr_server_addr[80] = {'\0'};
snprintf(curr_server_addr, sizeof(curr_server_addr), "%s:%d",
pr_netaddr_get_ipstr(session.c->local_addr), main_server->ServerPort);
curr_server_addr[sizeof(curr_server_addr)-1] = '\0';
if (pr_rewind_scoreboard() < 0) {
pr_log_pri(PR_LOG_NOTICE, "error rewinding scoreboard: %s",
strerror(errno));
}
while ((score = pr_scoreboard_entry_read()) != NULL) {
unsigned char same_host = FALSE;
pr_signals_handle();
/* Make sure it matches our current server. */
if (strcmp(score->sce_server_addr, curr_server_addr) == 0) {
if ((c && c->config_type == CONF_ANON &&
!strcmp(score->sce_user, user)) || !c) {
/* This small hack makes sure that cur is incremented properly
* when dealing with anonymous logins (the timing of anonymous
* login updates to the scoreboard makes this...odd).
*/
if (c && c->config_type == CONF_ANON && cur == 0)
cur = 1;
/* Only count authenticated clients, as per the documentation. */
if (strncmp(score->sce_user, "(none)", 7) == 0)
continue;
cur++;
/* Count up sessions on a per-host basis. */
if (!strcmp(score->sce_client_addr,
pr_netaddr_get_ipstr(session.c->remote_addr))) {
same_host = TRUE;
/* This small hack makes sure that hcur is incremented properly
* when dealing with anonymous logins (the timing of anonymous
* login updates to the scoreboard makes this...odd).
*/
if (c && c->config_type == CONF_ANON && hcur == 0)
hcur = 1;
hcur++;
}
/* Take a per-user count of connections. */
if (strcmp(score->sce_user, user) == 0) {
usersessions++;
/* Count up unique hosts. */
if (!same_host)
hostsperuser++;
}
}
if (session.conn_class != NULL &&
strcasecmp(score->sce_class, session.conn_class->cls_name) == 0) {
ccur++;
}
}
}
pr_restore_scoreboard();
PRIVS_RELINQUISH
}
key = "client-count";
(void) pr_table_remove(session.notes, key, NULL);
v = palloc(session.pool, sizeof(unsigned int));
*((unsigned int *) v) = cur;
if (pr_table_add(session.notes, key, v, sizeof(unsigned int)) < 0) {
if (errno != EEXIST) {
pr_log_pri(PR_LOG_WARNING,
"warning: error stashing '%s': %s", key, strerror(errno));
}
}
if (session.conn_class != NULL) {
key = "class-client-count";
(void) pr_table_remove(session.notes, key, NULL);
v = palloc(session.pool, sizeof(unsigned int));
*((unsigned int *) v) = ccur;
if (pr_table_add(session.notes, key, v, sizeof(unsigned int)) < 0) {
if (errno != EEXIST) {
pr_log_pri(PR_LOG_WARNING,
"warning: error stashing '%s': %s", key, strerror(errno));
}
}
}
/* Try to determine what MaxClients/MaxHosts limits apply to this session
* (if any) and count through the runtime file to see if this limit would
* be exceeded.
*/
maxc = find_config(cmd->server->conf, CONF_PARAM, "MaxClientsPerClass",
FALSE);
while (session.conn_class != NULL && maxc) {
char *maxstr = "Sorry, the maximum number of clients (%m) from your class "
"are already connected.";
unsigned int *max = maxc->argv[1];
if (strcmp(maxc->argv[0], session.conn_class->cls_name) != 0) {
maxc = find_config_next(maxc, maxc->next, CONF_PARAM,
"MaxClientsPerClass", FALSE);
continue;
}
if (maxc->argc > 2)
maxstr = maxc->argv[2];
if (*max &&
ccur > *max) {
char maxn[20] = {'\0'};
pr_event_generate("mod_auth.max-clients-per-class",
session.conn_class->cls_name);
snprintf(maxn, sizeof(maxn), "%u", *max);
pr_response_send(R_530, "%s", sreplace(cmd->tmp_pool, maxstr, "%m", maxn,
NULL));
(void) pr_cmd_dispatch_phase(cmd, LOG_CMD_ERR, 0);
pr_log_auth(PR_LOG_NOTICE,
"Connection refused (MaxClientsPerClass %s %u)",
session.conn_class->cls_name, *max);
pr_session_disconnect(&auth_module, PR_SESS_DISCONNECT_CONFIG_ACL,
"Denied by MaxClientsPerClass");
}
break;
}
maxc = find_config(TOPLEVEL_CONF, CONF_PARAM, "MaxClientsPerHost", FALSE);
if (maxc) {
char *maxstr = "Sorry, the maximum number of clients (%m) from your host "
"are already connected.";
unsigned int *max = maxc->argv[0];
if (maxc->argc > 1)
maxstr = maxc->argv[1];
if (*max && hcur > *max) {
char maxn[20] = {'\0'};
pr_event_generate("mod_auth.max-clients-per-host", session.c);
snprintf(maxn, sizeof(maxn), "%u", *max);
pr_response_send(R_530, "%s", sreplace(cmd->tmp_pool, maxstr, "%m", maxn,
NULL));
(void) pr_cmd_dispatch_phase(cmd, LOG_CMD_ERR, 0);
pr_log_auth(PR_LOG_NOTICE,
"Connection refused (MaxClientsPerHost %u)", *max);
pr_session_disconnect(&auth_module, PR_SESS_DISCONNECT_CONFIG_ACL,
"Denied by MaxClientsPerHost");
}
}
/* Check for any configured MaxClientsPerUser. */
maxc = find_config(TOPLEVEL_CONF, CONF_PARAM, "MaxClientsPerUser", FALSE);
if (maxc) {
char *maxstr = "Sorry, the maximum number of clients (%m) for this user "
"are already connected.";
unsigned int *max = maxc->argv[0];
if (maxc->argc > 1)
maxstr = maxc->argv[1];
if (*max && usersessions > *max) {
char maxn[20] = {'\0'};
pr_event_generate("mod_auth.max-clients-per-user", user);
snprintf(maxn, sizeof(maxn), "%u", *max);
pr_response_send(R_530, "%s", sreplace(cmd->tmp_pool, maxstr, "%m", maxn,
NULL));
(void) pr_cmd_dispatch_phase(cmd, LOG_CMD_ERR, 0);
pr_log_auth(PR_LOG_NOTICE,
"Connection refused (MaxClientsPerUser %u)", *max);
pr_session_disconnect(&auth_module, PR_SESS_DISCONNECT_CONFIG_ACL,
"Denied by MaxClientsPerUser");
}
}
maxc = find_config(TOPLEVEL_CONF, CONF_PARAM, "MaxClients", FALSE);
if (maxc) {
char *maxstr = "Sorry, the maximum number of allowed clients (%m) are "
"already connected.";
unsigned int *max = maxc->argv[0];
if (maxc->argc > 1)
maxstr = maxc->argv[1];
if (*max && cur > *max) {
char maxn[20] = {'\0'};
pr_event_generate("mod_auth.max-clients", NULL);
snprintf(maxn, sizeof(maxn), "%u", *max);
pr_response_send(R_530, "%s", sreplace(cmd->tmp_pool, maxstr, "%m", maxn,
NULL));
(void) pr_cmd_dispatch_phase(cmd, LOG_CMD_ERR, 0);
pr_log_auth(PR_LOG_NOTICE, "Connection refused (MaxClients %u)", *max);
pr_session_disconnect(&auth_module, PR_SESS_DISCONNECT_CONFIG_ACL,
"Denied by MaxClients");
}
}
maxc = find_config(TOPLEVEL_CONF, CONF_PARAM, "MaxHostsPerUser", FALSE);
if (maxc) {
char *maxstr = "Sorry, the maximum number of hosts (%m) for this user are "
"already connected.";
unsigned int *max = maxc->argv[0];
if (maxc->argc > 1)
maxstr = maxc->argv[1];
if (*max && hostsperuser > *max) {
char maxn[20] = {'\0'};
pr_event_generate("mod_auth.max-hosts-per-user", user);
snprintf(maxn, sizeof(maxn), "%u", *max);
pr_response_send(R_530, "%s", sreplace(cmd->tmp_pool, maxstr, "%m", maxn,
NULL));
(void) pr_cmd_dispatch_phase(cmd, LOG_CMD_ERR, 0);
pr_log_auth(PR_LOG_NOTICE, "Connection refused (MaxHostsPerHost %u)",
*max);
pr_session_disconnect(&auth_module, PR_SESS_DISCONNECT_CONFIG_ACL,
"Denied by MaxHostsPerUser");
}
}
return 0;
}
| 8,870
|
39,153
| 0
|
static int nfs_do_write(struct nfs_write_data *data,
const struct rpc_call_ops *call_ops,
int how)
{
struct inode *inode = data->header->inode;
return nfs_initiate_write(NFS_CLIENT(inode), data, call_ops, how, 0);
}
| 8,871
|
177,337
| 0
|
void ACodec::ExecutingState::stateEntered() {
ALOGV("[%s] Now Executing", mCodec->mComponentName.c_str());
mCodec->mRenderTracker.clear(systemTime(CLOCK_MONOTONIC));
mCodec->processDeferredMessages();
}
| 8,872
|
523
| 0
|
static void pdf_run_gs_CA(fz_context *ctx, pdf_processor *proc, float alpha)
{
pdf_run_processor *pr = (pdf_run_processor *)proc;
pdf_gstate *gstate = pdf_flush_text(ctx, pr);
gstate->stroke.alpha = fz_clamp(alpha, 0, 1);
}
| 8,873
|
97,704
| 0
|
xmlXPathNameFunction(xmlXPathParserContextPtr ctxt, int nargs)
{
xmlXPathObjectPtr cur;
if (nargs == 0) {
valuePush(ctxt, xmlXPathCacheNewNodeSet(ctxt->context,
ctxt->context->node));
nargs = 1;
}
CHECK_ARITY(1);
if ((ctxt->value == NULL) ||
((ctxt->value->type != XPATH_NODESET) &&
(ctxt->value->type != XPATH_XSLT_TREE)))
XP_ERROR(XPATH_INVALID_TYPE);
cur = valuePop(ctxt);
if ((cur->nodesetval == NULL) || (cur->nodesetval->nodeNr == 0)) {
valuePush(ctxt, xmlXPathCacheNewCString(ctxt->context, ""));
} else {
int i = 0; /* Should be first in document order !!!!! */
switch (cur->nodesetval->nodeTab[i]->type) {
case XML_ELEMENT_NODE:
case XML_ATTRIBUTE_NODE:
if (cur->nodesetval->nodeTab[i]->name[0] == ' ')
valuePush(ctxt,
xmlXPathCacheNewCString(ctxt->context, ""));
else if ((cur->nodesetval->nodeTab[i]->ns == NULL) ||
(cur->nodesetval->nodeTab[i]->ns->prefix == NULL)) {
valuePush(ctxt,
xmlXPathCacheNewString(ctxt->context,
cur->nodesetval->nodeTab[i]->name));
} else {
xmlChar *fullname;
fullname = xmlBuildQName(cur->nodesetval->nodeTab[i]->name,
cur->nodesetval->nodeTab[i]->ns->prefix,
NULL, 0);
if (fullname == cur->nodesetval->nodeTab[i]->name)
fullname = xmlStrdup(cur->nodesetval->nodeTab[i]->name);
if (fullname == NULL) {
XP_ERROR(XPATH_MEMORY_ERROR);
}
valuePush(ctxt, xmlXPathCacheWrapString(
ctxt->context, fullname));
}
break;
default:
valuePush(ctxt, xmlXPathCacheNewNodeSet(ctxt->context,
cur->nodesetval->nodeTab[i]));
xmlXPathLocalNameFunction(ctxt, 1);
}
}
xmlXPathReleaseObject(ctxt->context, cur);
}
| 8,874
|
181,051
| 1
|
wb_print(netdissect_options *ndo,
register const void *hdr, register u_int len)
{
register const struct pkt_hdr *ph;
ph = (const struct pkt_hdr *)hdr;
if (len < sizeof(*ph) || !ND_TTEST(*ph)) {
ND_PRINT((ndo, "%s", tstr));
return;
}
len -= sizeof(*ph);
if (ph->ph_flags)
ND_PRINT((ndo, "*"));
switch (ph->ph_type) {
case PT_KILL:
ND_PRINT((ndo, " wb-kill"));
return;
case PT_ID:
if (wb_id(ndo, (const struct pkt_id *)(ph + 1), len) >= 0)
return;
break;
case PT_RREQ:
if (wb_rreq(ndo, (const struct pkt_rreq *)(ph + 1), len) >= 0)
return;
break;
case PT_RREP:
if (wb_rrep(ndo, (const struct pkt_rrep *)(ph + 1), len) >= 0)
return;
break;
case PT_DRAWOP:
if (wb_drawop(ndo, (const struct pkt_dop *)(ph + 1), len) >= 0)
return;
break;
case PT_PREQ:
if (wb_preq(ndo, (const struct pkt_preq *)(ph + 1), len) >= 0)
return;
break;
case PT_PREP:
if (wb_prep(ndo, (const struct pkt_prep *)(ph + 1), len) >= 0)
return;
break;
default:
ND_PRINT((ndo, " wb-%d!", ph->ph_type));
return;
}
}
| 8,875
|
31,255
| 0
|
static int crypto_ahash_report(struct sk_buff *skb, struct crypto_alg *alg)
{
return -ENOSYS;
}
| 8,876
|
148,892
| 0
|
bool RenderFrameHostManager::IsCurrentlySameSite(RenderFrameHostImpl* candidate,
const GURL& dest_url) {
BrowserContext* browser_context =
delegate_->GetControllerForRenderManager().GetBrowserContext();
if (candidate->GetSiteInstance()->HasWrongProcessForURL(dest_url))
return false;
if (candidate->last_successful_url().is_empty()) {
return SiteInstance::IsSameWebSite(
browser_context, candidate->GetSiteInstance()->GetSiteURL(), dest_url);
}
if (SiteInstance::IsSameWebSite(browser_context,
candidate->last_successful_url(), dest_url)) {
return true;
}
if (!candidate->GetLastCommittedOrigin().unique() &&
SiteInstance::IsSameWebSite(
browser_context,
GURL(candidate->GetLastCommittedOrigin().Serialize()), dest_url)) {
return true;
}
return false;
}
| 8,877
|
149,030
| 0
|
static SQLITE_NOINLINE void btreeParseCellAdjustSizeForOverflow(
MemPage *pPage, /* Page containing the cell */
u8 *pCell, /* Pointer to the cell text. */
CellInfo *pInfo /* Fill in this structure */
){
/* If the payload will not fit completely on the local page, we have
** to decide how much to store locally and how much to spill onto
** overflow pages. The strategy is to minimize the amount of unused
** space on overflow pages while keeping the amount of local storage
** in between minLocal and maxLocal.
**
** Warning: changing the way overflow payload is distributed in any
** way will result in an incompatible file format.
*/
int minLocal; /* Minimum amount of payload held locally */
int maxLocal; /* Maximum amount of payload held locally */
int surplus; /* Overflow payload available for local storage */
minLocal = pPage->minLocal;
maxLocal = pPage->maxLocal;
surplus = minLocal + (pInfo->nPayload - minLocal)%(pPage->pBt->usableSize-4);
testcase( surplus==maxLocal );
testcase( surplus==maxLocal+1 );
if( surplus <= maxLocal ){
pInfo->nLocal = (u16)surplus;
}else{
pInfo->nLocal = (u16)minLocal;
}
pInfo->nSize = (u16)(&pInfo->pPayload[pInfo->nLocal] - pCell) + 4;
}
| 8,878
|
157,055
| 0
|
uint8_t* data() { return data_; }
| 8,879
|
51,621
| 0
|
void tcp_synack_rtt_meas(struct sock *sk, struct request_sock *req)
{
long rtt_us = -1L;
if (req && !req->num_retrans && tcp_rsk(req)->snt_synack.v64) {
struct skb_mstamp now;
skb_mstamp_get(&now);
rtt_us = skb_mstamp_us_delta(&now, &tcp_rsk(req)->snt_synack);
}
tcp_ack_update_rtt(sk, FLAG_SYN_ACKED, rtt_us, -1L, rtt_us);
}
| 8,880
|
105,557
| 0
|
bool SendNativeKeyEventJSONRequest(
AutomationMessageSender* sender,
int browser_index,
int tab_index,
ui::KeyboardCode key_code,
int modifiers,
std::string* error_msg) {
DictionaryValue dict;
dict.SetString("command", "SendOSLevelKeyEventToTab");
dict.SetInteger("windex", browser_index);
dict.SetInteger("tab_index", tab_index);
dict.SetInteger("keyCode", key_code);
dict.SetInteger("modifiers", modifiers);
DictionaryValue reply_dict;
return SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg);
}
| 8,881
|
43,980
| 0
|
__xml_acl_apply(xmlNode *xml)
{
GListPtr aIter = NULL;
xml_private_t *p = NULL;
xmlXPathObjectPtr xpathObj = NULL;
if(xml_acl_enabled(xml) == FALSE) {
p = xml->doc->_private;
crm_trace("Not applying ACLs for %s", p->user);
return;
}
p = xml->doc->_private;
for(aIter = p->acls; aIter != NULL; aIter = aIter->next) {
int max = 0, lpc = 0;
xml_acl_t *acl = aIter->data;
xpathObj = xpath_search(xml, acl->xpath);
max = numXpathResults(xpathObj);
for(lpc = 0; lpc < max; lpc++) {
xmlNode *match = getXpathResult(xpathObj, lpc);
char *path = xml_get_path(match);
p = match->_private;
crm_trace("Applying %x to %s for %s", acl->mode, path, acl->xpath);
#ifdef SUSE_ACL_COMPAT
if(is_not_set(p->flags, acl->mode)) {
if(is_set(p->flags, xpf_acl_read)
|| is_set(p->flags, xpf_acl_write)
|| is_set(p->flags, xpf_acl_deny)) {
crm_config_warn("Configuration element %s is matched by multiple ACL rules, only the first applies ('%s' wins over '%s')",
path, __xml_acl_to_text(p->flags), __xml_acl_to_text(acl->mode));
free(path);
continue;
}
}
#endif
p->flags |= acl->mode;
free(path);
}
crm_trace("Now enforcing ACL: %s (%d matches)", acl->xpath, max);
freeXpathObject(xpathObj);
}
p = xml->_private;
if(is_not_set(p->flags, xpf_acl_read) && is_not_set(p->flags, xpf_acl_write)) {
p->flags |= xpf_acl_deny;
p = xml->doc->_private;
crm_info("Enforcing default ACL for %s to %s", p->user, crm_element_name(xml));
}
}
| 8,882
|
108,383
| 0
|
static uint32 SelectSamplesPerPacket(AudioParameters params) {
int samples = kMinSamplesPerHardwarePacket;
while (samples <= kMaxSamplesPerHardwarePacket &&
samples * base::Time::kMillisecondsPerSecond <
params.sample_rate * kMillisecondsPerHardwarePacket) {
samples *= 2;
}
return samples;
}
| 8,883
|
19,168
| 0
|
static inline struct sock *l2tp_ip_bind_lookup(struct net *net, __be32 laddr, int dif, u32 tunnel_id)
{
struct sock *sk = __l2tp_ip_bind_lookup(net, laddr, dif, tunnel_id);
if (sk)
sock_hold(sk);
return sk;
}
| 8,884
|
102,245
| 0
|
bool ExtensionPrefs::GetActiveBit(const std::string& extension_id) {
const DictionaryValue* dictionary = GetExtensionPref(extension_id);
bool result = false;
if (dictionary && dictionary->GetBoolean(kActiveBit, &result))
return result;
return false;
}
| 8,885
|
71,155
| 0
|
static int ceph_aes_decrypt2(const void *key, int key_len,
void *dst1, size_t *dst1_len,
void *dst2, size_t *dst2_len,
const void *src, size_t src_len)
{
struct sg_table sg_in;
struct scatterlist sg_out[3], prealloc_sg;
struct crypto_skcipher *tfm = ceph_crypto_alloc_cipher();
SKCIPHER_REQUEST_ON_STACK(req, tfm);
char pad[16];
char iv[AES_BLOCK_SIZE];
int ret;
int last_byte;
if (IS_ERR(tfm))
return PTR_ERR(tfm);
sg_init_table(sg_out, 3);
sg_set_buf(&sg_out[0], dst1, *dst1_len);
sg_set_buf(&sg_out[1], dst2, *dst2_len);
sg_set_buf(&sg_out[2], pad, sizeof(pad));
ret = setup_sgtable(&sg_in, &prealloc_sg, src, src_len);
if (ret)
goto out_tfm;
crypto_skcipher_setkey((void *)tfm, key, key_len);
memcpy(iv, aes_iv, AES_BLOCK_SIZE);
skcipher_request_set_tfm(req, tfm);
skcipher_request_set_callback(req, 0, NULL, NULL);
skcipher_request_set_crypt(req, sg_in.sgl, sg_out,
src_len, iv);
/*
print_hex_dump(KERN_ERR, "dec key: ", DUMP_PREFIX_NONE, 16, 1,
key, key_len, 1);
print_hex_dump(KERN_ERR, "dec in: ", DUMP_PREFIX_NONE, 16, 1,
src, src_len, 1);
*/
ret = crypto_skcipher_decrypt(req);
skcipher_request_zero(req);
if (ret < 0) {
pr_err("ceph_aes_decrypt failed %d\n", ret);
goto out_sg;
}
if (src_len <= *dst1_len)
last_byte = ((char *)dst1)[src_len - 1];
else if (src_len <= *dst1_len + *dst2_len)
last_byte = ((char *)dst2)[src_len - *dst1_len - 1];
else
last_byte = pad[src_len - *dst1_len - *dst2_len - 1];
if (last_byte <= 16 && src_len >= last_byte) {
src_len -= last_byte;
} else {
pr_err("ceph_aes_decrypt got bad padding %d on src len %d\n",
last_byte, (int)src_len);
return -EPERM; /* bad padding */
}
if (src_len < *dst1_len) {
*dst1_len = src_len;
*dst2_len = 0;
} else {
*dst2_len = src_len - *dst1_len;
}
/*
print_hex_dump(KERN_ERR, "dec out1: ", DUMP_PREFIX_NONE, 16, 1,
dst1, *dst1_len, 1);
print_hex_dump(KERN_ERR, "dec out2: ", DUMP_PREFIX_NONE, 16, 1,
dst2, *dst2_len, 1);
*/
out_sg:
teardown_sgtable(&sg_in);
out_tfm:
crypto_free_skcipher(tfm);
return ret;
}
| 8,886
|
141,060
| 0
|
ScriptedIdleTaskController& Document::EnsureScriptedIdleTaskController() {
if (!scripted_idle_task_controller_) {
scripted_idle_task_controller_ = ScriptedIdleTaskController::Create(this);
if (!frame_ || !frame_->IsAttached() ||
ExecutionContext::IsContextDestroyed()) {
scripted_idle_task_controller_->ContextLifecycleStateChanged(
mojom::FrameLifecycleState::kFrozen);
}
}
return *scripted_idle_task_controller_;
}
| 8,887
|
9,806
| 0
|
static int http_replace_header(struct my_regex *re, char *dst, uint dst_size, char *val, int len,
const char *rep_str)
{
if (!regex_exec_match2(re, val, len, MAX_MATCH, pmatch))
return -2;
return exp_replace(dst, dst_size, val, rep_str, pmatch);
}
| 8,888
|
61,528
| 0
|
static inline size_t WriteChannelSize(const PSDInfo *psd_info,Image *image,
const signed short channel)
{
size_t
count;
count=WriteBlobMSBSignedShort(image,channel);
count+=SetPSDSize(psd_info,image,0);
return(count);
}
| 8,889
|
175,526
| 0
|
IHEVCD_ERROR_T ihevcd_parse_user_data_registered_itu_t_t35(codec_t *ps_codec,
UWORD32 u4_payload_size)
{
parse_ctxt_t *ps_parse = &ps_codec->s_parse;
bitstrm_t *ps_bitstrm = &ps_parse->s_bitstrm;
UWORD32 value;
user_data_registered_itu_t_t35_t *ps_user_data_registered_itu_t_t35;
UWORD32 i;
UWORD32 j = 0;
ps_parse->s_sei_params.i1_user_data_registered_present_flag = 1;
ps_user_data_registered_itu_t_t35 =
&ps_parse->s_sei_params.as_user_data_registered_itu_t_t35[ps_parse->s_sei_params.i4_sei_user_data_cnt];
ps_parse->s_sei_params.i4_sei_user_data_cnt++;
ps_user_data_registered_itu_t_t35->i4_payload_size = u4_payload_size;
if(u4_payload_size > MAX_USERDATA_PAYLOAD)
{
u4_payload_size = MAX_USERDATA_PAYLOAD;
}
ps_user_data_registered_itu_t_t35->i4_valid_payload_size = u4_payload_size;
BITS_PARSE("itu_t_t35_country_code", value, ps_bitstrm, 8);
ps_user_data_registered_itu_t_t35->u1_itu_t_t35_country_code = value;
if(0xFF != ps_user_data_registered_itu_t_t35->u1_itu_t_t35_country_code)
{
i = 1;
}
else
{
BITS_PARSE("itu_t_t35_country_code_extension_byte", value, ps_bitstrm,
8);
ps_user_data_registered_itu_t_t35->u1_itu_t_t35_country_code_extension_byte =
value;
i = 2;
}
do
{
BITS_PARSE("itu_t_t35_payload_byte", value, ps_bitstrm, 8);
ps_user_data_registered_itu_t_t35->u1_itu_t_t35_payload_byte[j++] =
value;
i++;
}while(i < u4_payload_size);
return (IHEVCD_ERROR_T)IHEVCD_SUCCESS;
}
| 8,890
|
156,783
| 0
|
void Document::ApplyFeaturePolicy(const ParsedFeaturePolicy& declared_policy) {
FeaturePolicy* parent_feature_policy = nullptr;
ParsedFeaturePolicy container_policy;
if (frame_) {
if (!frame_->IsMainFrame()) {
parent_feature_policy =
frame_->Tree().Parent()->GetSecurityContext()->GetFeaturePolicy();
}
if (frame_->Owner())
container_policy = frame_->Owner()->ContainerPolicy();
}
InitializeFeaturePolicy(declared_policy, container_policy,
parent_feature_policy);
is_vertical_scroll_enforced_ =
RuntimeEnabledFeatures::ExperimentalProductivityFeaturesEnabled() &&
!GetFeaturePolicy()->IsFeatureEnabled(
mojom::FeaturePolicyFeature::kVerticalScroll);
}
| 8,891
|
82,236
| 0
|
int __sys_bind(int fd, struct sockaddr __user *umyaddr, int addrlen)
{
struct socket *sock;
struct sockaddr_storage address;
int err, fput_needed;
sock = sockfd_lookup_light(fd, &err, &fput_needed);
if (sock) {
err = move_addr_to_kernel(umyaddr, addrlen, &address);
if (err >= 0) {
err = security_socket_bind(sock,
(struct sockaddr *)&address,
addrlen);
if (!err)
err = sock->ops->bind(sock,
(struct sockaddr *)
&address, addrlen);
}
fput_light(sock->file, fput_needed);
}
return err;
}
| 8,892
|
73,545
| 0
|
static MagickBooleanType SyncExifProfile(Image *image, StringInfo *profile)
{
#define MaxDirectoryStack 16
#define EXIF_DELIMITER "\n"
#define EXIF_NUM_FORMATS 12
#define TAG_EXIF_OFFSET 0x8769
#define TAG_INTEROP_OFFSET 0xa005
typedef struct _DirectoryInfo
{
unsigned char
*directory;
size_t
entry;
} DirectoryInfo;
DirectoryInfo
directory_stack[MaxDirectoryStack];
EndianType
endian;
size_t
entry,
length,
number_entries;
SplayTreeInfo
*exif_resources;
ssize_t
id,
level,
offset;
static int
format_bytes[] = {0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8};
unsigned char
*directory,
*exif;
/*
Set EXIF resolution tag.
*/
length=GetStringInfoLength(profile);
exif=GetStringInfoDatum(profile);
if (length < 16)
return(MagickFalse);
id=(ssize_t) ReadProfileShort(LSBEndian,exif);
if ((id != 0x4949) && (id != 0x4D4D))
{
while (length != 0)
{
if (ReadProfileByte(&exif,&length) != 0x45)
continue;
if (ReadProfileByte(&exif,&length) != 0x78)
continue;
if (ReadProfileByte(&exif,&length) != 0x69)
continue;
if (ReadProfileByte(&exif,&length) != 0x66)
continue;
if (ReadProfileByte(&exif,&length) != 0x00)
continue;
if (ReadProfileByte(&exif,&length) != 0x00)
continue;
break;
}
if (length < 16)
return(MagickFalse);
id=(ssize_t) ReadProfileShort(LSBEndian,exif);
}
endian=LSBEndian;
if (id == 0x4949)
endian=LSBEndian;
else
if (id == 0x4D4D)
endian=MSBEndian;
else
return(MagickFalse);
if (ReadProfileShort(endian,exif+2) != 0x002a)
return(MagickFalse);
/*
This the offset to the first IFD.
*/
offset=(ssize_t) ((int) ReadProfileLong(endian,exif+4));
if ((offset < 0) || ((size_t) offset >= length))
return(MagickFalse);
directory=exif+offset;
level=0;
entry=0;
exif_resources=NewSplayTree((int (*)(const void *,const void *)) NULL,
(void *(*)(void *)) NULL,(void *(*)(void *)) NULL);
do
{
if (level > 0)
{
level--;
directory=directory_stack[level].directory;
entry=directory_stack[level].entry;
}
if ((directory < exif) || (directory > (exif+length-2)))
break;
/*
Determine how many entries there are in the current IFD.
*/
number_entries=ReadProfileShort(endian,directory);
for ( ; entry < number_entries; entry++)
{
register unsigned char
*p,
*q;
size_t
number_bytes;
ssize_t
components,
format,
tag_value;
q=(unsigned char *) (directory+2+(12*entry));
if (GetValueFromSplayTree(exif_resources,q) == q)
break;
(void) AddValueToSplayTree(exif_resources,q,q);
tag_value=(ssize_t) ReadProfileShort(endian,q);
format=(ssize_t) ReadProfileShort(endian,q+2);
if ((format-1) >= EXIF_NUM_FORMATS)
break;
components=(ssize_t) ((int) ReadProfileLong(endian,q+4));
number_bytes=(size_t) components*format_bytes[format];
if ((ssize_t) number_bytes < components)
break; /* prevent overflow */
if (number_bytes <= 4)
p=q+8;
else
{
ssize_t
offset;
/*
The directory entry contains an offset.
*/
offset=(ssize_t) ((int) ReadProfileLong(endian,q+8));
if ((ssize_t) (offset+number_bytes) < offset)
continue; /* prevent overflow */
if ((size_t) (offset+number_bytes) > length)
continue;
p=(unsigned char *) (exif+offset);
}
switch (tag_value)
{
case 0x011a:
{
(void) WriteProfileLong(endian,(size_t) (image->x_resolution+0.5),p);
(void) WriteProfileLong(endian,1UL,p+4);
break;
}
case 0x011b:
{
(void) WriteProfileLong(endian,(size_t) (image->y_resolution+0.5),p);
(void) WriteProfileLong(endian,1UL,p+4);
break;
}
case 0x0112:
{
if (number_bytes == 4)
{
(void) WriteProfileLong(endian,(size_t) image->orientation,p);
break;
}
(void) WriteProfileShort(endian,(unsigned short) image->orientation,
p);
break;
}
case 0x0128:
{
if (number_bytes == 4)
{
(void) WriteProfileLong(endian,(size_t) (image->units+1),p);
break;
}
(void) WriteProfileShort(endian,(unsigned short) (image->units+1),p);
break;
}
default:
break;
}
if ((tag_value == TAG_EXIF_OFFSET) || (tag_value == TAG_INTEROP_OFFSET))
{
ssize_t
offset;
offset=(ssize_t) ((int) ReadProfileLong(endian,p));
if (((size_t) offset < length) && (level < (MaxDirectoryStack-2)))
{
directory_stack[level].directory=directory;
entry++;
directory_stack[level].entry=entry;
level++;
directory_stack[level].directory=exif+offset;
directory_stack[level].entry=0;
level++;
if ((directory+2+(12*number_entries)) > (exif+length))
break;
offset=(ssize_t) ((int) ReadProfileLong(endian,directory+2+(12*
number_entries)));
if ((offset != 0) && ((size_t) offset < length) &&
(level < (MaxDirectoryStack-2)))
{
directory_stack[level].directory=exif+offset;
directory_stack[level].entry=0;
level++;
}
}
break;
}
}
} while (level > 0);
exif_resources=DestroySplayTree(exif_resources);
return(MagickTrue);
}
| 8,893
|
109,753
| 0
|
PassRefPtr<HTMLCollection> Document::plugins()
{
return ensureCachedCollection(DocEmbeds);
}
| 8,894
|
96,050
| 0
|
long FS_ReadFileDir(const char *qpath, void *searchPath, qboolean unpure, void **buffer)
{
fileHandle_t h;
searchpath_t *search;
byte* buf;
qboolean isConfig;
long len;
if ( !fs_searchpaths ) {
Com_Error( ERR_FATAL, "Filesystem call made without initialization" );
}
if ( !qpath || !qpath[0] ) {
Com_Error( ERR_FATAL, "FS_ReadFile with empty name" );
}
buf = NULL; // quiet compiler warning
if ( strstr( qpath, ".cfg" ) ) {
isConfig = qtrue;
if ( com_journal && com_journal->integer == 2 ) {
int r;
Com_DPrintf( "Loading %s from journal file.\n", qpath );
r = FS_Read( &len, sizeof( len ), com_journalDataFile );
if ( r != sizeof( len ) ) {
if (buffer != NULL) *buffer = NULL;
return -1;
}
if (!len) {
if (buffer == NULL) {
return 1; // hack for old journal files
}
*buffer = NULL;
return -1;
}
if (buffer == NULL) {
return len;
}
buf = Hunk_AllocateTempMemory(len+1);
*buffer = buf;
r = FS_Read( buf, len, com_journalDataFile );
if ( r != len ) {
Com_Error( ERR_FATAL, "Read from journalDataFile failed" );
}
fs_loadCount++;
fs_loadStack++;
buf[len] = 0;
return len;
}
} else {
isConfig = qfalse;
}
search = searchPath;
if(search == NULL)
{
len = FS_FOpenFileRead(qpath, &h, qfalse);
}
else
{
len = FS_FOpenFileReadDir(qpath, search, &h, qfalse, unpure);
}
if ( h == 0 ) {
if ( buffer ) {
*buffer = NULL;
}
if ( isConfig && com_journal && com_journal->integer == 1 ) {
Com_DPrintf( "Writing zero for %s to journal file.\n", qpath );
len = 0;
FS_Write( &len, sizeof( len ), com_journalDataFile );
FS_Flush( com_journalDataFile );
}
return -1;
}
if ( !buffer ) {
if ( isConfig && com_journal && com_journal->integer == 1 ) {
Com_DPrintf( "Writing len for %s to journal file.\n", qpath );
FS_Write( &len, sizeof( len ), com_journalDataFile );
FS_Flush( com_journalDataFile );
}
FS_FCloseFile( h);
return len;
}
fs_loadCount++;
fs_loadStack++;
buf = Hunk_AllocateTempMemory(len+1);
*buffer = buf;
FS_Read (buf, len, h);
buf[len] = 0;
FS_FCloseFile( h );
if ( isConfig && com_journal && com_journal->integer == 1 ) {
Com_DPrintf( "Writing %s to journal file.\n", qpath );
FS_Write( &len, sizeof( len ), com_journalDataFile );
FS_Write( buf, len, com_journalDataFile );
FS_Flush( com_journalDataFile );
}
return len;
}
| 8,895
|
184,782
| 1
|
static v8::Handle<v8::Value> methodWithNonOptionalArgAndOptionalArgCallback(const v8::Arguments& args)
{
INC_STATS("DOM.TestObj.methodWithNonOptionalArgAndOptionalArg");
if (args.Length() < 1)
return V8Proxy::throwNotEnoughArgumentsError();
TestObj* imp = V8TestObj::toNative(args.Holder());
EXCEPTION_BLOCK(int, nonOpt, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
if (args.Length() <= 1) {
imp->methodWithNonOptionalArgAndOptionalArg(nonOpt);
return v8::Handle<v8::Value>();
}
EXCEPTION_BLOCK(int, opt, toInt32(MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined)));
imp->methodWithNonOptionalArgAndOptionalArg(nonOpt, opt);
return v8::Handle<v8::Value>();
}
| 8,896
|
141,034
| 0
|
void Document::DispatchUnloadEvents(DocumentLoadTiming* timing) {
PluginScriptForbiddenScope forbid_plugin_destructor_scripting;
if (parser_)
parser_->StopParsing();
if (load_event_progress_ == kLoadEventNotRun)
return;
if (load_event_progress_ <= kUnloadEventInProgress) {
Element* current_focused_element = FocusedElement();
if (auto* input = ToHTMLInputElementOrNull(current_focused_element))
input->EndEditing();
if (load_event_progress_ < kPageHideInProgress) {
load_event_progress_ = kPageHideInProgress;
if (LocalDOMWindow* window = domWindow()) {
const TimeTicks pagehide_event_start = CurrentTimeTicks();
window->DispatchEvent(
*PageTransitionEvent::Create(event_type_names::kPagehide, false),
this);
const TimeTicks pagehide_event_end = CurrentTimeTicks();
DEFINE_STATIC_LOCAL(
CustomCountHistogram, pagehide_histogram,
("DocumentEventTiming.PageHideDuration", 0, 10000000, 50));
pagehide_histogram.CountMicroseconds(pagehide_event_end -
pagehide_event_start);
}
if (!frame_)
return;
bool page_visible = IsPageVisible();
load_event_progress_ = kUnloadVisibilityChangeInProgress;
if (page_visible) {
const TimeTicks pagevisibility_hidden_event_start = CurrentTimeTicks();
DispatchEvent(
*Event::CreateBubble(event_type_names::kVisibilitychange));
const TimeTicks pagevisibility_hidden_event_end = CurrentTimeTicks();
DEFINE_STATIC_LOCAL(CustomCountHistogram, pagevisibility_histogram,
("DocumentEventTiming.PageVibilityHiddenDuration",
0, 10000000, 50));
pagevisibility_histogram.CountMicroseconds(
pagevisibility_hidden_event_end -
pagevisibility_hidden_event_start);
DispatchEvent(
*Event::CreateBubble(event_type_names::kWebkitvisibilitychange));
}
if (!frame_)
return;
frame_->Loader().SaveScrollAnchor();
load_event_progress_ = kUnloadEventInProgress;
Event& unload_event = *Event::Create(event_type_names::kUnload);
if (timing && timing->UnloadEventStart().is_null() &&
timing->UnloadEventEnd().is_null()) {
DCHECK(!timing->NavigationStart().is_null());
const TimeTicks unload_event_start = CurrentTimeTicks();
timing->MarkUnloadEventStart(unload_event_start);
frame_->DomWindow()->DispatchEvent(unload_event, this);
const TimeTicks unload_event_end = CurrentTimeTicks();
DEFINE_STATIC_LOCAL(
CustomCountHistogram, unload_histogram,
("DocumentEventTiming.UnloadDuration", 0, 10000000, 50));
unload_histogram.CountMicroseconds(unload_event_end -
unload_event_start);
timing->MarkUnloadEventEnd(unload_event_end);
} else {
frame_->DomWindow()->DispatchEvent(unload_event, frame_->GetDocument());
}
}
load_event_progress_ = kUnloadEventHandled;
}
}
| 8,897
|
152,601
| 0
|
mojom::FrameInputHandler* TestRenderFrame::GetFrameInputHandler() {
if (!frame_input_handler_) {
mojom::FrameInputHandlerRequest frame_input_handler_request =
mojo::MakeRequest(&frame_input_handler_);
FrameInputHandlerImpl::CreateMojoService(
weak_factory_.GetWeakPtr(), std::move(frame_input_handler_request));
}
return frame_input_handler_.get();
}
| 8,898
|
7,363
| 0
|
skip_literal_string( FT_Byte* *acur,
FT_Byte* limit )
{
FT_Byte* cur = *acur;
FT_Int embed = 0;
FT_Error error = FT_ERR( Invalid_File_Format );
unsigned int i;
while ( cur < limit )
{
FT_Byte c = *cur;
cur++;
if ( c == '\\' )
{
/* Red Book 3rd ed., section `Literal Text Strings', p. 29: */
/* A backslash can introduce three different types */
/* of escape sequences: */
/* - a special escaped char like \r, \n, etc. */
/* - a one-, two-, or three-digit octal number */
/* - none of the above in which case the backslash is ignored */
if ( cur == limit )
/* error (or to be ignored?) */
break;
switch ( *cur )
{
/* skip `special' escape */
case 'n':
case 'r':
case 't':
case 'b':
case 'f':
case '\\':
case '(':
case ')':
cur++;
break;
default:
/* skip octal escape or ignore backslash */
for ( i = 0; i < 3 && cur < limit; i++ )
{
if ( !IS_OCTAL_DIGIT( *cur ) )
break;
cur++;
}
}
}
else if ( c == '(' )
embed++;
else if ( c == ')' )
{
embed--;
if ( embed == 0 )
{
error = FT_Err_Ok;
break;
}
}
}
*acur = cur;
return error;
}
| 8,899
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.