unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
128,832 | 0 | void GLSurfaceOzoneSurfaceless::SwapCompleted(
const SwapCompletionCallback& callback,
gfx::SwapResult result) {
callback.Run(result);
swap_buffers_pending_ = false;
if (result == gfx::SwapResult::SWAP_FAILED) {
last_swap_buffers_result_ = false;
return;
}
SubmitFrame();
}
| 500 |
137,095 | 0 | String InputType::ResultForDialogSubmit() const {
return GetElement().FastGetAttribute(valueAttr);
}
| 501 |
92,927 | 0 | cssp_connect(char *server, char *user, char *domain, char *password, STREAM s)
{
UNUSED(s);
OM_uint32 actual_time;
gss_cred_id_t cred;
gss_buffer_desc input_tok, output_tok;
gss_name_t target_name;
OM_uint32 major_status, minor_status;
int context_established = 0;
gss_ctx_id_t gss_ctx;
gss_OID desired_mech = &_gss_spnego_krb5_mechanism_oid_desc;
STREAM ts_creds;
struct stream token = { 0 };
struct stream pubkey = { 0 };
struct stream pubkey_cmp = { 0 };
if (!cssp_gss_mech_available(desired_mech))
{
logger(Core, Debug,
"cssp_connect(), system doesn't have support for desired authentication mechanism");
return False;
}
if (!cssp_gss_get_service_name(server, &target_name))
{
logger(Core, Debug, "cssp_connect(), failed to get target service name");
return False;
}
if (!tcp_tls_connect())
{
logger(Core, Debug, "cssp_connect(), failed to establish TLS connection");
return False;
}
tcp_tls_get_server_pubkey(&pubkey);
OM_uint32 actual_services;
gss_OID actual_mech;
struct stream blob = { 0 };
gss_ctx = GSS_C_NO_CONTEXT;
cred = GSS_C_NO_CREDENTIAL;
input_tok.length = 0;
output_tok.length = 0;
minor_status = 0;
int i = 0;
do
{
major_status = gss_init_sec_context(&minor_status,
cred,
&gss_ctx,
target_name,
desired_mech,
GSS_C_MUTUAL_FLAG | GSS_C_DELEG_FLAG,
GSS_C_INDEFINITE,
GSS_C_NO_CHANNEL_BINDINGS,
&input_tok,
&actual_mech,
&output_tok, &actual_services, &actual_time);
if (GSS_ERROR(major_status))
{
if (i == 0)
logger(Core, Notice,
"Failed to initialize NLA, do you have correct Kerberos TGT initialized ?");
else
logger(Core, Error, "cssp_connect(), negotiation failed");
cssp_gss_report_error(GSS_C_GSS_CODE, "cssp_connect(), negotiation failed.",
major_status, minor_status);
goto bail_out;
}
if (!(actual_services & GSS_C_CONF_FLAG))
{
logger(Core, Error,
"cssp_connect(), confidentiality service required but is not available");
goto bail_out;
}
if (output_tok.length != 0)
{
if (output_tok.length > token.size)
s_realloc(&token, output_tok.length);
s_reset(&token);
out_uint8p(&token, output_tok.value, output_tok.length);
s_mark_end(&token);
if (!cssp_send_tsrequest(&token, NULL, NULL))
goto bail_out;
(void) gss_release_buffer(&minor_status, &output_tok);
}
if (major_status & GSS_S_CONTINUE_NEEDED)
{
(void) gss_release_buffer(&minor_status, &input_tok);
if (!cssp_read_tsrequest(&token, NULL))
goto bail_out;
input_tok.value = token.data;
input_tok.length = s_length(&token);
}
else
{
context_established = 1;
if (!cssp_gss_wrap(gss_ctx, &pubkey, &blob))
goto bail_out;
if (!cssp_send_tsrequest(NULL, NULL, &blob))
goto bail_out;
context_established = 1;
}
i++;
}
while (!context_established);
if (!cssp_read_tsrequest(NULL, &blob))
goto bail_out;
if (!cssp_gss_unwrap(gss_ctx, &blob, &pubkey_cmp))
goto bail_out;
pubkey_cmp.data[0] -= 1;
if (memcmp(pubkey.data, pubkey_cmp.data, s_length(&pubkey)) != 0)
{
logger(Core, Error,
"cssp_connect(), public key mismatch, cannot guarantee integrity of server connection");
goto bail_out;
}
ts_creds = cssp_encode_tscredentials(user, password, domain);
if (!cssp_gss_wrap(gss_ctx, ts_creds, &blob))
goto bail_out;
s_free(ts_creds);
if (!cssp_send_tsrequest(NULL, &blob, NULL))
goto bail_out;
return True;
bail_out:
xfree(token.data);
return False;
}
| 502 |
135,471 | 0 | bool PasswordAutofillManager::IsCreditCardPopup() {
return false;
}
| 503 |
89,172 | 0 | is_exclusive(Node* x, Node* y, regex_t* reg)
{
int i, len;
OnigCodePoint code;
UChar *p;
NodeType ytype;
retry:
ytype = NODE_TYPE(y);
switch (NODE_TYPE(x)) {
case NODE_CTYPE:
{
if (CTYPE_(x)->ctype == CTYPE_ANYCHAR ||
CTYPE_(y)->ctype == CTYPE_ANYCHAR)
break;
switch (ytype) {
case NODE_CTYPE:
if (CTYPE_(y)->ctype == CTYPE_(x)->ctype &&
CTYPE_(y)->not != CTYPE_(x)->not &&
CTYPE_(y)->ascii_mode == CTYPE_(x)->ascii_mode)
return 1;
else
return 0;
break;
case NODE_CCLASS:
swap:
{
Node* tmp;
tmp = x; x = y; y = tmp;
goto retry;
}
break;
case NODE_STRING:
goto swap;
break;
default:
break;
}
}
break;
case NODE_CCLASS:
{
int range;
CClassNode* xc = CCLASS_(x);
switch (ytype) {
case NODE_CTYPE:
switch (CTYPE_(y)->ctype) {
case CTYPE_ANYCHAR:
return 0;
break;
case ONIGENC_CTYPE_WORD:
if (CTYPE_(y)->not == 0) {
if (IS_NULL(xc->mbuf) && !IS_NCCLASS_NOT(xc)) {
range = CTYPE_(y)->ascii_mode != 0 ? 128 : SINGLE_BYTE_SIZE;
for (i = 0; i < range; i++) {
if (BITSET_AT(xc->bs, i)) {
if (ONIGENC_IS_CODE_WORD(reg->enc, i)) return 0;
}
}
return 1;
}
return 0;
}
else {
if (IS_NOT_NULL(xc->mbuf)) return 0;
if (IS_NCCLASS_NOT(xc)) return 0;
range = CTYPE_(y)->ascii_mode != 0 ? 128 : SINGLE_BYTE_SIZE;
for (i = 0; i < range; i++) {
if (! ONIGENC_IS_CODE_WORD(reg->enc, i)) {
if (BITSET_AT(xc->bs, i))
return 0;
}
}
for (i = range; i < SINGLE_BYTE_SIZE; i++) {
if (BITSET_AT(xc->bs, i)) return 0;
}
return 1;
}
break;
default:
break;
}
break;
case NODE_CCLASS:
{
int v;
CClassNode* yc = CCLASS_(y);
for (i = 0; i < SINGLE_BYTE_SIZE; i++) {
v = BITSET_AT(xc->bs, i);
if ((v != 0 && !IS_NCCLASS_NOT(xc)) || (v == 0 && IS_NCCLASS_NOT(xc))) {
v = BITSET_AT(yc->bs, i);
if ((v != 0 && !IS_NCCLASS_NOT(yc)) ||
(v == 0 && IS_NCCLASS_NOT(yc)))
return 0;
}
}
if ((IS_NULL(xc->mbuf) && !IS_NCCLASS_NOT(xc)) ||
(IS_NULL(yc->mbuf) && !IS_NCCLASS_NOT(yc)))
return 1;
return 0;
}
break;
case NODE_STRING:
goto swap;
break;
default:
break;
}
}
break;
case NODE_STRING:
{
StrNode* xs = STR_(x);
if (NODE_STRING_LEN(x) == 0)
break;
switch (ytype) {
case NODE_CTYPE:
switch (CTYPE_(y)->ctype) {
case CTYPE_ANYCHAR:
break;
case ONIGENC_CTYPE_WORD:
if (CTYPE_(y)->ascii_mode == 0) {
if (ONIGENC_IS_MBC_WORD(reg->enc, xs->s, xs->end))
return CTYPE_(y)->not;
else
return !(CTYPE_(y)->not);
}
else {
if (ONIGENC_IS_MBC_WORD_ASCII(reg->enc, xs->s, xs->end))
return CTYPE_(y)->not;
else
return !(CTYPE_(y)->not);
}
break;
default:
break;
}
break;
case NODE_CCLASS:
{
CClassNode* cc = CCLASS_(y);
code = ONIGENC_MBC_TO_CODE(reg->enc, xs->s,
xs->s + ONIGENC_MBC_MAXLEN(reg->enc));
return onig_is_code_in_cc(reg->enc, code, cc) == 0;
}
break;
case NODE_STRING:
{
UChar *q;
StrNode* ys = STR_(y);
len = NODE_STRING_LEN(x);
if (len > NODE_STRING_LEN(y)) len = NODE_STRING_LEN(y);
if (NODE_STRING_IS_AMBIG(x) || NODE_STRING_IS_AMBIG(y)) {
/* tiny version */
return 0;
}
else {
for (i = 0, p = ys->s, q = xs->s; i < len; i++, p++, q++) {
if (*p != *q) return 1;
}
}
}
break;
default:
break;
}
}
break;
default:
break;
}
return 0;
}
| 504 |
127,503 | 0 | bool JPEGImageDecoder::setFailed()
{
m_reader.clear();
return ImageDecoder::setFailed();
}
| 505 |
24,119 | 0 | int hostap_tx_callback_unregister(local_info_t *local, u16 idx)
{
unsigned long flags;
struct hostap_tx_callback_info *cb, *prev = NULL;
spin_lock_irqsave(&local->lock, flags);
cb = local->tx_callback;
while (cb != NULL && cb->idx != idx) {
prev = cb;
cb = cb->next;
}
if (cb) {
if (prev == NULL)
local->tx_callback = cb->next;
else
prev->next = cb->next;
kfree(cb);
}
spin_unlock_irqrestore(&local->lock, flags);
return cb ? 0 : -1;
}
| 506 |
17,418 | 0 | ScreenSaverFreeEvents(void *value, XID id)
{
ScreenSaverEventPtr pOld = (ScreenSaverEventPtr) value;
ScreenPtr pScreen = pOld->screen;
SetupScreen(pScreen);
ScreenSaverEventPtr pEv, *pPrev;
if (!pPriv)
return TRUE;
for (pPrev = &pPriv->events; (pEv = *pPrev) != 0; pPrev = &pEv->next)
if (pEv == pOld)
break;
if (!pEv)
return TRUE;
*pPrev = pEv->next;
free(pEv);
CheckScreenPrivate(pScreen);
return TRUE;
}
| 507 |
154,528 | 0 | void GLES2DecoderPassthroughImpl::SetQueryCallback(unsigned int query_client_id,
base::OnceClosure callback) {
GLuint service_id = query_id_map_.GetServiceIDOrInvalid(query_client_id);
for (auto& pending_query : pending_queries_) {
if (pending_query.service_id == service_id) {
pending_query.callbacks.push_back(std::move(callback));
return;
}
}
VLOG(1) << "GLES2DecoderPassthroughImpl::SetQueryCallback: No pending query "
"with ID "
<< query_client_id << ". Running the callback immediately.";
std::move(callback).Run();
}
| 508 |
159,726 | 0 | scoped_refptr<StaticBitmapImage> WebGLRenderingContextBase::GetImage(
AccelerationHint hint) const {
if (!GetDrawingBuffer())
return nullptr;
if (IsMainThread()) {
GetDrawingBuffer()->ResolveAndBindForReadAndDraw();
IntSize size = ClampedCanvasSize();
std::unique_ptr<AcceleratedImageBufferSurface> surface =
std::make_unique<AcceleratedImageBufferSurface>(size, ColorParams());
if (!surface->IsValid())
return nullptr;
if (!CopyRenderingResultsFromDrawingBuffer(surface.get(), kBackBuffer)) {
NOTREACHED();
return nullptr;
}
return surface->NewImageSnapshot(hint);
}
int width = GetDrawingBuffer()->Size().Width();
int height = GetDrawingBuffer()->Size().Height();
SkImageInfo image_info = SkImageInfo::Make(
width, height, kRGBA_8888_SkColorType,
CreationAttributes().alpha() ? kPremul_SkAlphaType : kOpaque_SkAlphaType);
return this->MakeImageSnapshot(image_info);
}
| 509 |
54,053 | 0 | static void check_lifetime(struct work_struct *work)
{
unsigned long now, next, next_sec, next_sched;
struct in_ifaddr *ifa;
struct hlist_node *n;
int i;
now = jiffies;
next = round_jiffies_up(now + ADDR_CHECK_FREQUENCY);
for (i = 0; i < IN4_ADDR_HSIZE; i++) {
bool change_needed = false;
rcu_read_lock();
hlist_for_each_entry_rcu(ifa, &inet_addr_lst[i], hash) {
unsigned long age;
if (ifa->ifa_flags & IFA_F_PERMANENT)
continue;
/* We try to batch several events at once. */
age = (now - ifa->ifa_tstamp +
ADDRCONF_TIMER_FUZZ_MINUS) / HZ;
if (ifa->ifa_valid_lft != INFINITY_LIFE_TIME &&
age >= ifa->ifa_valid_lft) {
change_needed = true;
} else if (ifa->ifa_preferred_lft ==
INFINITY_LIFE_TIME) {
continue;
} else if (age >= ifa->ifa_preferred_lft) {
if (time_before(ifa->ifa_tstamp +
ifa->ifa_valid_lft * HZ, next))
next = ifa->ifa_tstamp +
ifa->ifa_valid_lft * HZ;
if (!(ifa->ifa_flags & IFA_F_DEPRECATED))
change_needed = true;
} else if (time_before(ifa->ifa_tstamp +
ifa->ifa_preferred_lft * HZ,
next)) {
next = ifa->ifa_tstamp +
ifa->ifa_preferred_lft * HZ;
}
}
rcu_read_unlock();
if (!change_needed)
continue;
rtnl_lock();
hlist_for_each_entry_safe(ifa, n, &inet_addr_lst[i], hash) {
unsigned long age;
if (ifa->ifa_flags & IFA_F_PERMANENT)
continue;
/* We try to batch several events at once. */
age = (now - ifa->ifa_tstamp +
ADDRCONF_TIMER_FUZZ_MINUS) / HZ;
if (ifa->ifa_valid_lft != INFINITY_LIFE_TIME &&
age >= ifa->ifa_valid_lft) {
struct in_ifaddr **ifap;
for (ifap = &ifa->ifa_dev->ifa_list;
*ifap != NULL; ifap = &(*ifap)->ifa_next) {
if (*ifap == ifa) {
inet_del_ifa(ifa->ifa_dev,
ifap, 1);
break;
}
}
} else if (ifa->ifa_preferred_lft !=
INFINITY_LIFE_TIME &&
age >= ifa->ifa_preferred_lft &&
!(ifa->ifa_flags & IFA_F_DEPRECATED)) {
ifa->ifa_flags |= IFA_F_DEPRECATED;
rtmsg_ifa(RTM_NEWADDR, ifa, NULL, 0);
}
}
rtnl_unlock();
}
next_sec = round_jiffies_up(next);
next_sched = next;
/* If rounded timeout is accurate enough, accept it. */
if (time_before(next_sec, next + ADDRCONF_TIMER_FUZZ))
next_sched = next_sec;
now = jiffies;
/* And minimum interval is ADDRCONF_TIMER_FUZZ_MAX. */
if (time_before(next_sched, now + ADDRCONF_TIMER_FUZZ_MAX))
next_sched = now + ADDRCONF_TIMER_FUZZ_MAX;
queue_delayed_work(system_power_efficient_wq, &check_lifetime_work,
next_sched - now);
}
| 510 |
38,373 | 0 | static void cm_format_mra(struct cm_mra_msg *mra_msg,
struct cm_id_private *cm_id_priv,
enum cm_msg_response msg_mraed, u8 service_timeout,
const void *private_data, u8 private_data_len)
{
cm_format_mad_hdr(&mra_msg->hdr, CM_MRA_ATTR_ID, cm_id_priv->tid);
cm_mra_set_msg_mraed(mra_msg, msg_mraed);
mra_msg->local_comm_id = cm_id_priv->id.local_id;
mra_msg->remote_comm_id = cm_id_priv->id.remote_id;
cm_mra_set_service_timeout(mra_msg, service_timeout);
if (private_data && private_data_len)
memcpy(mra_msg->private_data, private_data, private_data_len);
}
| 511 |
164,473 | 0 | static void applyAffinity(
Mem *pRec, /* The value to apply affinity to */
char affinity, /* The affinity to be applied */
u8 enc /* Use this text encoding */
){
if( affinity>=SQLITE_AFF_NUMERIC ){
assert( affinity==SQLITE_AFF_INTEGER || affinity==SQLITE_AFF_REAL
|| affinity==SQLITE_AFF_NUMERIC );
if( (pRec->flags & MEM_Int)==0 ){ /*OPTIMIZATION-IF-FALSE*/
if( (pRec->flags & MEM_Real)==0 ){
if( pRec->flags & MEM_Str ) applyNumericAffinity(pRec,1);
}else{
sqlite3VdbeIntegerAffinity(pRec);
}
}
}else if( affinity==SQLITE_AFF_TEXT ){
/* Only attempt the conversion to TEXT if there is an integer or real
** representation (blob and NULL do not get converted) but no string
** representation. It would be harmless to repeat the conversion if
** there is already a string rep, but it is pointless to waste those
** CPU cycles. */
if( 0==(pRec->flags&MEM_Str) ){ /*OPTIMIZATION-IF-FALSE*/
if( (pRec->flags&(MEM_Real|MEM_Int)) ){
sqlite3VdbeMemStringify(pRec, enc, 1);
}
}
pRec->flags &= ~(MEM_Real|MEM_Int);
}
}
| 512 |
58,448 | 0 | server_disconnect (session * sess, int sendquit, int err)
{
server *serv = sess->server;
GSList *list;
char tbuf[64];
gboolean shutup = FALSE;
/* send our QUIT reason */
if (sendquit && serv->connected)
{
server_sendquit (sess);
}
fe_server_event (serv, FE_SE_DISCONNECT, 0);
/* close all sockets & io tags */
switch (server_cleanup (serv))
{
case 0: /* it wasn't even connected! */
notc_msg (sess);
return;
case 1: /* it was in the process of connecting */
sprintf (tbuf, "%d", sess->server->childpid);
EMIT_SIGNAL (XP_TE_STOPCONNECT, sess, tbuf, NULL, NULL, NULL, 0);
return;
case 3:
shutup = TRUE; /* won't print "disconnected" in channels */
}
server_flush_queue (serv);
list = sess_list;
while (list)
{
sess = (struct session *) list->data;
if (sess->server == serv)
{
if (!shutup || sess->type == SESS_SERVER)
/* print "Disconnected" to each window using this server */
EMIT_SIGNAL (XP_TE_DISCON, sess, errorstring (err), NULL, NULL, NULL, 0);
if (!sess->channel[0] || sess->type == SESS_CHANNEL)
clear_channel (sess);
}
list = list->next;
}
serv->pos = 0;
serv->motd_skipped = FALSE;
serv->no_login = FALSE;
serv->servername[0] = 0;
serv->lag_sent = 0;
notify_cleanup ();
}
| 513 |
109,821 | 0 | void Document::setSelectedStylesheetSet(const String& aString)
{
m_styleEngine->setSelectedStylesheetSetName(aString);
styleResolverChanged(RecalcStyleDeferred);
}
| 514 |
86,341 | 0 | static inline void destroy_compound_gigantic_page(struct page *page,
unsigned int order) { }
| 515 |
94,049 | 0 | static int cx24116_diseqc_send_burst(struct dvb_frontend *fe,
fe_sec_mini_cmd_t burst)
{
struct cx24116_state *state = fe->demodulator_priv;
int ret;
dprintk("%s(%d) toneburst=%d\n", __func__, burst, toneburst);
/* DiSEqC burst */
if (burst == SEC_MINI_A)
state->dsec_cmd.args[CX24116_DISEQC_BURST] =
CX24116_DISEQC_MINI_A;
else if (burst == SEC_MINI_B)
state->dsec_cmd.args[CX24116_DISEQC_BURST] =
CX24116_DISEQC_MINI_B;
else
return -EINVAL;
/* DiSEqC toneburst */
if (toneburst != CX24116_DISEQC_MESGCACHE)
/* Burst is cached */
return 0;
/* Burst is to be sent with cached message */
/* Wait for LNB ready */
ret = cx24116_wait_for_lnb(fe);
if (ret != 0)
return ret;
/* Wait for voltage/min repeat delay */
msleep(100);
/* Command */
ret = cx24116_cmd_execute(fe, &state->dsec_cmd);
if (ret != 0)
return ret;
/*
* Wait for send
*
* Eutelsat spec:
* >15ms delay + (XXX determine if FW does this, see set_tone)
* 13.5ms per byte +
* >15ms delay +
* 12.5ms burst +
* >15ms delay (XXX determine if FW does this, see set_tone)
*/
msleep((state->dsec_cmd.args[CX24116_DISEQC_MSGLEN] << 4) + 60);
return 0;
}
| 516 |
130,093 | 0 | const MasterPreferences& MasterPreferences::ForCurrentProcess() {
return g_master_preferences.Get();
}
| 517 |
90,300 | 0 | megasas_build_dcdb(struct megasas_instance *instance, struct scsi_cmnd *scp,
struct megasas_cmd *cmd)
{
u32 is_logical;
u32 device_id;
u16 flags = 0;
struct megasas_pthru_frame *pthru;
is_logical = MEGASAS_IS_LOGICAL(scp->device);
device_id = MEGASAS_DEV_INDEX(scp);
pthru = (struct megasas_pthru_frame *)cmd->frame;
if (scp->sc_data_direction == DMA_TO_DEVICE)
flags = MFI_FRAME_DIR_WRITE;
else if (scp->sc_data_direction == DMA_FROM_DEVICE)
flags = MFI_FRAME_DIR_READ;
else if (scp->sc_data_direction == DMA_NONE)
flags = MFI_FRAME_DIR_NONE;
if (instance->flag_ieee == 1) {
flags |= MFI_FRAME_IEEE;
}
/*
* Prepare the DCDB frame
*/
pthru->cmd = (is_logical) ? MFI_CMD_LD_SCSI_IO : MFI_CMD_PD_SCSI_IO;
pthru->cmd_status = 0x0;
pthru->scsi_status = 0x0;
pthru->target_id = device_id;
pthru->lun = scp->device->lun;
pthru->cdb_len = scp->cmd_len;
pthru->timeout = 0;
pthru->pad_0 = 0;
pthru->flags = cpu_to_le16(flags);
pthru->data_xfer_len = cpu_to_le32(scsi_bufflen(scp));
memcpy(pthru->cdb, scp->cmnd, scp->cmd_len);
/*
* If the command is for the tape device, set the
* pthru timeout to the os layer timeout value.
*/
if (scp->device->type == TYPE_TAPE) {
if ((scp->request->timeout / HZ) > 0xFFFF)
pthru->timeout = cpu_to_le16(0xFFFF);
else
pthru->timeout = cpu_to_le16(scp->request->timeout / HZ);
}
/*
* Construct SGL
*/
if (instance->flag_ieee == 1) {
pthru->flags |= cpu_to_le16(MFI_FRAME_SGL64);
pthru->sge_count = megasas_make_sgl_skinny(instance, scp,
&pthru->sgl);
} else if (IS_DMA64) {
pthru->flags |= cpu_to_le16(MFI_FRAME_SGL64);
pthru->sge_count = megasas_make_sgl64(instance, scp,
&pthru->sgl);
} else
pthru->sge_count = megasas_make_sgl32(instance, scp,
&pthru->sgl);
if (pthru->sge_count > instance->max_num_sge) {
dev_err(&instance->pdev->dev, "DCDB too many SGE NUM=%x\n",
pthru->sge_count);
return 0;
}
/*
* Sense info specific
*/
pthru->sense_len = SCSI_SENSE_BUFFERSIZE;
pthru->sense_buf_phys_addr_hi =
cpu_to_le32(upper_32_bits(cmd->sense_phys_addr));
pthru->sense_buf_phys_addr_lo =
cpu_to_le32(lower_32_bits(cmd->sense_phys_addr));
/*
* Compute the total number of frames this command consumes. FW uses
* this number to pull sufficient number of frames from host memory.
*/
cmd->frame_count = megasas_get_frame_count(instance, pthru->sge_count,
PTHRU_FRAME);
return cmd->frame_count;
}
| 518 |
112,478 | 0 | HTMLHeadElement* Document::head()
{
Node* de = documentElement();
if (!de)
return 0;
for (Node* e = de->firstChild(); e; e = e->nextSibling())
if (e->hasTagName(headTag))
return static_cast<HTMLHeadElement*>(e);
return 0;
}
| 519 |
35,282 | 0 | int netdev_rx_handler_register(struct net_device *dev,
rx_handler_func_t *rx_handler,
void *rx_handler_data)
{
ASSERT_RTNL();
if (dev->rx_handler)
return -EBUSY;
rcu_assign_pointer(dev->rx_handler_data, rx_handler_data);
rcu_assign_pointer(dev->rx_handler, rx_handler);
return 0;
}
| 520 |
105,985 | 0 | static inline bool isObservable(JSTestEventTarget* jsTestEventTarget)
{
if (jsTestEventTarget->hasCustomProperties())
return true;
if (jsTestEventTarget->impl()->hasEventListeners())
return true;
return false;
}
| 521 |
22,983 | 0 | static int decode_attr_files_total(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res)
{
__be32 *p;
int status = 0;
*res = 0;
if (unlikely(bitmap[0] & (FATTR4_WORD0_FILES_TOTAL - 1U)))
return -EIO;
if (likely(bitmap[0] & FATTR4_WORD0_FILES_TOTAL)) {
READ_BUF(8);
READ64(*res);
bitmap[0] &= ~FATTR4_WORD0_FILES_TOTAL;
}
dprintk("%s: files total=%Lu\n", __func__, (unsigned long long)*res);
return status;
}
| 522 |
160,652 | 0 | void RenderFrameImpl::OnDelete() {
frame_->ExecuteCommand(WebString::FromUTF8("Delete"));
}
| 523 |
30,984 | 0 | int iscsi_login_tx_data(
struct iscsi_conn *conn,
char *pdu_buf,
char *text_buf,
int text_length)
{
int length, tx_sent, iov_cnt = 1;
struct kvec iov[2];
length = (ISCSI_HDR_LEN + text_length);
memset(&iov[0], 0, 2 * sizeof(struct kvec));
iov[0].iov_len = ISCSI_HDR_LEN;
iov[0].iov_base = pdu_buf;
if (text_buf && text_length) {
iov[1].iov_len = text_length;
iov[1].iov_base = text_buf;
iov_cnt++;
}
/*
* Initial Marker-less Interval.
* Add the values regardless of IFMarker/OFMarker, considering
* it may not be negoitated yet.
*/
conn->if_marker += length;
tx_sent = tx_data(conn, &iov[0], iov_cnt, length);
if (tx_sent != length) {
pr_err("tx_data returned %d, expecting %d.\n",
tx_sent, length);
return -1;
}
return 0;
}
| 524 |
67,221 | 0 | brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,
struct cfg80211_connect_params *sme)
{
struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
struct brcmf_if *ifp = netdev_priv(ndev);
struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
struct ieee80211_channel *chan = sme->channel;
struct brcmf_join_params join_params;
size_t join_params_size;
const struct brcmf_tlv *rsn_ie;
const struct brcmf_vs_tlv *wpa_ie;
const void *ie;
u32 ie_len;
struct brcmf_ext_join_params_le *ext_join_params;
u16 chanspec;
s32 err = 0;
u32 ssid_len;
brcmf_dbg(TRACE, "Enter\n");
if (!check_vif_up(ifp->vif))
return -EIO;
if (!sme->ssid) {
brcmf_err("Invalid ssid\n");
return -EOPNOTSUPP;
}
if (ifp->vif == cfg->p2p.bss_idx[P2PAPI_BSSCFG_PRIMARY].vif) {
/* A normal (non P2P) connection request setup. */
ie = NULL;
ie_len = 0;
/* find the WPA_IE */
wpa_ie = brcmf_find_wpaie((u8 *)sme->ie, sme->ie_len);
if (wpa_ie) {
ie = wpa_ie;
ie_len = wpa_ie->len + TLV_HDR_LEN;
} else {
/* find the RSN_IE */
rsn_ie = brcmf_parse_tlvs((const u8 *)sme->ie,
sme->ie_len,
WLAN_EID_RSN);
if (rsn_ie) {
ie = rsn_ie;
ie_len = rsn_ie->len + TLV_HDR_LEN;
}
}
brcmf_fil_iovar_data_set(ifp, "wpaie", ie, ie_len);
}
err = brcmf_vif_set_mgmt_ie(ifp->vif, BRCMF_VNDR_IE_ASSOCREQ_FLAG,
sme->ie, sme->ie_len);
if (err)
brcmf_err("Set Assoc REQ IE Failed\n");
else
brcmf_dbg(TRACE, "Applied Vndr IEs for Assoc request\n");
set_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state);
if (chan) {
cfg->channel =
ieee80211_frequency_to_channel(chan->center_freq);
chanspec = channel_to_chanspec(&cfg->d11inf, chan);
brcmf_dbg(CONN, "channel=%d, center_req=%d, chanspec=0x%04x\n",
cfg->channel, chan->center_freq, chanspec);
} else {
cfg->channel = 0;
chanspec = 0;
}
brcmf_dbg(INFO, "ie (%p), ie_len (%zd)\n", sme->ie, sme->ie_len);
err = brcmf_set_wpa_version(ndev, sme);
if (err) {
brcmf_err("wl_set_wpa_version failed (%d)\n", err);
goto done;
}
sme->auth_type = brcmf_war_auth_type(ifp, sme->auth_type);
err = brcmf_set_auth_type(ndev, sme);
if (err) {
brcmf_err("wl_set_auth_type failed (%d)\n", err);
goto done;
}
err = brcmf_set_wsec_mode(ndev, sme);
if (err) {
brcmf_err("wl_set_set_cipher failed (%d)\n", err);
goto done;
}
err = brcmf_set_key_mgmt(ndev, sme);
if (err) {
brcmf_err("wl_set_key_mgmt failed (%d)\n", err);
goto done;
}
err = brcmf_set_sharedkey(ndev, sme);
if (err) {
brcmf_err("brcmf_set_sharedkey failed (%d)\n", err);
goto done;
}
if (sme->crypto.psk) {
if (WARN_ON(profile->use_fwsup != BRCMF_PROFILE_FWSUP_NONE)) {
err = -EINVAL;
goto done;
}
brcmf_dbg(INFO, "using PSK offload\n");
profile->use_fwsup = BRCMF_PROFILE_FWSUP_PSK;
}
if (profile->use_fwsup != BRCMF_PROFILE_FWSUP_NONE) {
/* enable firmware supplicant for this interface */
err = brcmf_fil_iovar_int_set(ifp, "sup_wpa", 1);
if (err < 0) {
brcmf_err("failed to enable fw supplicant\n");
goto done;
}
}
if (profile->use_fwsup == BRCMF_PROFILE_FWSUP_PSK) {
err = brcmf_set_pmk(ifp, sme->crypto.psk,
BRCMF_WSEC_MAX_PSK_LEN);
if (err)
goto done;
}
/* Join with specific BSSID and cached SSID
* If SSID is zero join based on BSSID only
*/
join_params_size = offsetof(struct brcmf_ext_join_params_le, assoc_le) +
offsetof(struct brcmf_assoc_params_le, chanspec_list);
if (cfg->channel)
join_params_size += sizeof(u16);
ext_join_params = kzalloc(join_params_size, GFP_KERNEL);
if (ext_join_params == NULL) {
err = -ENOMEM;
goto done;
}
ssid_len = min_t(u32, sme->ssid_len, IEEE80211_MAX_SSID_LEN);
ext_join_params->ssid_le.SSID_len = cpu_to_le32(ssid_len);
memcpy(&ext_join_params->ssid_le.SSID, sme->ssid, ssid_len);
if (ssid_len < IEEE80211_MAX_SSID_LEN)
brcmf_dbg(CONN, "SSID \"%s\", len (%d)\n",
ext_join_params->ssid_le.SSID, ssid_len);
/* Set up join scan parameters */
ext_join_params->scan_le.scan_type = -1;
ext_join_params->scan_le.home_time = cpu_to_le32(-1);
if (sme->bssid)
memcpy(&ext_join_params->assoc_le.bssid, sme->bssid, ETH_ALEN);
else
eth_broadcast_addr(ext_join_params->assoc_le.bssid);
if (cfg->channel) {
ext_join_params->assoc_le.chanspec_num = cpu_to_le32(1);
ext_join_params->assoc_le.chanspec_list[0] =
cpu_to_le16(chanspec);
/* Increase dwell time to receive probe response or detect
* beacon from target AP at a noisy air only during connect
* command.
*/
ext_join_params->scan_le.active_time =
cpu_to_le32(BRCMF_SCAN_JOIN_ACTIVE_DWELL_TIME_MS);
ext_join_params->scan_le.passive_time =
cpu_to_le32(BRCMF_SCAN_JOIN_PASSIVE_DWELL_TIME_MS);
/* To sync with presence period of VSDB GO send probe request
* more frequently. Probe request will be stopped when it gets
* probe response from target AP/GO.
*/
ext_join_params->scan_le.nprobes =
cpu_to_le32(BRCMF_SCAN_JOIN_ACTIVE_DWELL_TIME_MS /
BRCMF_SCAN_JOIN_PROBE_INTERVAL_MS);
} else {
ext_join_params->scan_le.active_time = cpu_to_le32(-1);
ext_join_params->scan_le.passive_time = cpu_to_le32(-1);
ext_join_params->scan_le.nprobes = cpu_to_le32(-1);
}
brcmf_set_join_pref(ifp, &sme->bss_select);
err = brcmf_fil_bsscfg_data_set(ifp, "join", ext_join_params,
join_params_size);
kfree(ext_join_params);
if (!err)
/* This is it. join command worked, we are done */
goto done;
/* join command failed, fallback to set ssid */
memset(&join_params, 0, sizeof(join_params));
join_params_size = sizeof(join_params.ssid_le);
memcpy(&join_params.ssid_le.SSID, sme->ssid, ssid_len);
join_params.ssid_le.SSID_len = cpu_to_le32(ssid_len);
if (sme->bssid)
memcpy(join_params.params_le.bssid, sme->bssid, ETH_ALEN);
else
eth_broadcast_addr(join_params.params_le.bssid);
if (cfg->channel) {
join_params.params_le.chanspec_list[0] = cpu_to_le16(chanspec);
join_params.params_le.chanspec_num = cpu_to_le32(1);
join_params_size += sizeof(join_params.params_le);
}
err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
&join_params, join_params_size);
if (err)
brcmf_err("BRCMF_C_SET_SSID failed (%d)\n", err);
done:
if (err)
clear_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state);
brcmf_dbg(TRACE, "Exit\n");
return err;
}
| 525 |
64,383 | 0 | static int vmw_legacy_srf_destroy(struct vmw_resource *res)
{
struct vmw_private *dev_priv = res->dev_priv;
uint32_t submit_size;
uint8_t *cmd;
BUG_ON(res->id == -1);
/*
* Encode the dma- and surface destroy commands.
*/
submit_size = vmw_surface_destroy_size();
cmd = vmw_fifo_reserve(dev_priv, submit_size);
if (unlikely(!cmd)) {
DRM_ERROR("Failed reserving FIFO space for surface "
"eviction.\n");
return -ENOMEM;
}
vmw_surface_destroy_encode(res->id, cmd);
vmw_fifo_commit(dev_priv, submit_size);
/*
* Surface memory usage accounting.
*/
dev_priv->used_memory_size -= res->backup_size;
/*
* Release the surface ID.
*/
vmw_resource_release_id(res);
return 0;
}
| 526 |
135,659 | 0 | void FrameSelection::PageActivationChanged() {
FocusedOrActiveStateChanged();
}
| 527 |
65,488 | 0 | init_open_stateid(struct nfs4_file *fp, struct nfsd4_open *open)
{
struct nfs4_openowner *oo = open->op_openowner;
struct nfs4_ol_stateid *retstp = NULL;
struct nfs4_ol_stateid *stp;
stp = open->op_stp;
/* We are moving these outside of the spinlocks to avoid the warnings */
mutex_init(&stp->st_mutex);
mutex_lock(&stp->st_mutex);
spin_lock(&oo->oo_owner.so_client->cl_lock);
spin_lock(&fp->fi_lock);
retstp = nfsd4_find_existing_open(fp, open);
if (retstp)
goto out_unlock;
open->op_stp = NULL;
atomic_inc(&stp->st_stid.sc_count);
stp->st_stid.sc_type = NFS4_OPEN_STID;
INIT_LIST_HEAD(&stp->st_locks);
stp->st_stateowner = nfs4_get_stateowner(&oo->oo_owner);
get_nfs4_file(fp);
stp->st_stid.sc_file = fp;
stp->st_access_bmap = 0;
stp->st_deny_bmap = 0;
stp->st_openstp = NULL;
list_add(&stp->st_perstateowner, &oo->oo_owner.so_stateids);
list_add(&stp->st_perfile, &fp->fi_stateids);
out_unlock:
spin_unlock(&fp->fi_lock);
spin_unlock(&oo->oo_owner.so_client->cl_lock);
if (retstp) {
mutex_lock(&retstp->st_mutex);
/* To keep mutex tracking happy */
mutex_unlock(&stp->st_mutex);
stp = retstp;
}
return stp;
}
| 528 |
66,917 | 0 | static void feh_wm_set_bg_centered(Pixmap pmap, Imlib_Image im, int use_filelist,
int x, int y, int w, int h)
{
int offset_x, offset_y;
if (use_filelist)
feh_wm_load_next(&im);
if(opt.geom_flags & XValue)
if(opt.geom_flags & XNegative)
offset_x = (w - gib_imlib_image_get_width(im)) + opt.geom_x;
else
offset_x = opt.geom_x;
else
offset_x = (w - gib_imlib_image_get_width(im)) >> 1;
if(opt.geom_flags & YValue)
if(opt.geom_flags & YNegative)
offset_y = (h - gib_imlib_image_get_height(im)) + opt.geom_y;
else
offset_y = opt.geom_y;
else
offset_y = (h - gib_imlib_image_get_height(im)) >> 1;
gib_imlib_render_image_part_on_drawable_at_size(pmap, im,
((offset_x < 0) ? -offset_x : 0),
((offset_y < 0) ? -offset_y : 0),
w,
h,
x + ((offset_x > 0) ? offset_x : 0),
y + ((offset_y > 0) ? offset_y : 0),
w,
h,
1, 0, 0);
if (use_filelist)
gib_imlib_free_image_and_decache(im);
return;
}
| 529 |
137,125 | 0 | bool InputType::TypeMismatch() const {
return false;
}
| 530 |
50,126 | 0 | PHP_FUNCTION(curl_errno)
{
zval *zid;
php_curl *ch;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zid) == FAILURE) {
return;
}
if ((ch = (php_curl*)zend_fetch_resource(Z_RES_P(zid), le_curl_name, le_curl)) == NULL) {
RETURN_FALSE;
}
RETURN_LONG(ch->err.no);
}
| 531 |
70,913 | 0 | _gdScalePass(const gdImagePtr pSrc, const unsigned int src_len,
const gdImagePtr pDst, const unsigned int dst_len,
const unsigned int num_lines,
const gdAxis axis)
{
unsigned int line_ndx;
LineContribType * contrib;
/* Same dim, just copy it. */
assert(dst_len != src_len); // TODO: caller should handle this.
contrib = _gdContributionsCalc(dst_len, src_len,
(double)dst_len / (double)src_len,
pSrc->interpolation);
if (contrib == NULL) {
return 0;
}
/* Scale each line */
for (line_ndx = 0; line_ndx < num_lines; line_ndx++) {
_gdScaleOneAxis(pSrc, pDst, dst_len, line_ndx, contrib, axis);
}
_gdContributionsFree (contrib);
return 1;
}/* _gdScalePass*/
| 532 |
11,509 | 0 | void close_nointr_nofail(int fd) {
int saved_errno = errno;
/* like close_nointr() but cannot fail, and guarantees errno
* is unchanged */
assert_se(close_nointr(fd) == 0);
errno = saved_errno;
}
| 533 |
106,912 | 0 | void RenderBox::panScroll(const IntPoint& source)
{
if (layer())
layer()->panScrollFromPoint(source);
}
| 534 |
64,378 | 0 | int vmw_gb_surface_reference_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{
struct vmw_private *dev_priv = vmw_priv(dev);
union drm_vmw_gb_surface_reference_arg *arg =
(union drm_vmw_gb_surface_reference_arg *)data;
struct drm_vmw_surface_arg *req = &arg->req;
struct drm_vmw_gb_surface_ref_rep *rep = &arg->rep;
struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile;
struct vmw_surface *srf;
struct vmw_user_surface *user_srf;
struct ttm_base_object *base;
uint32_t backup_handle;
int ret = -EINVAL;
ret = vmw_surface_handle_reference(dev_priv, file_priv, req->sid,
req->handle_type, &base);
if (unlikely(ret != 0))
return ret;
user_srf = container_of(base, struct vmw_user_surface, prime.base);
srf = &user_srf->srf;
if (!srf->res.backup) {
DRM_ERROR("Shared GB surface is missing a backup buffer.\n");
goto out_bad_resource;
}
mutex_lock(&dev_priv->cmdbuf_mutex); /* Protect res->backup */
ret = vmw_user_dmabuf_reference(tfile, srf->res.backup,
&backup_handle);
mutex_unlock(&dev_priv->cmdbuf_mutex);
if (unlikely(ret != 0)) {
DRM_ERROR("Could not add a reference to a GB surface "
"backup buffer.\n");
(void) ttm_ref_object_base_unref(tfile, base->hash.key,
TTM_REF_USAGE);
goto out_bad_resource;
}
rep->creq.svga3d_flags = srf->flags;
rep->creq.format = srf->format;
rep->creq.mip_levels = srf->mip_levels[0];
rep->creq.drm_surface_flags = 0;
rep->creq.multisample_count = srf->multisample_count;
rep->creq.autogen_filter = srf->autogen_filter;
rep->creq.array_size = srf->array_size;
rep->creq.buffer_handle = backup_handle;
rep->creq.base_size = srf->base_size;
rep->crep.handle = user_srf->prime.base.hash.key;
rep->crep.backup_size = srf->res.backup_size;
rep->crep.buffer_handle = backup_handle;
rep->crep.buffer_map_handle =
drm_vma_node_offset_addr(&srf->res.backup->base.vma_node);
rep->crep.buffer_size = srf->res.backup->base.num_pages * PAGE_SIZE;
out_bad_resource:
ttm_base_object_unref(&base);
return ret;
}
| 535 |
103,543 | 0 | ExtensionPrefs* ExtensionService::extension_prefs() {
return extension_prefs_;
}
| 536 |
179,306 | 1 | flush_signal_handlers(struct task_struct *t, int force_default)
{
int i;
struct k_sigaction *ka = &t->sighand->action[0];
for (i = _NSIG ; i != 0 ; i--) {
if (force_default || ka->sa.sa_handler != SIG_IGN)
ka->sa.sa_handler = SIG_DFL;
ka->sa.sa_flags = 0;
sigemptyset(&ka->sa.sa_mask);
ka++;
}
}
| 537 |
128,018 | 0 | void AwContents::OnComputeScroll(JNIEnv* env,
jobject obj,
jlong animation_time_millis) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
browser_view_renderer_.OnComputeScroll(
base::TimeTicks() +
base::TimeDelta::FromMilliseconds(animation_time_millis));
}
| 538 |
79,648 | 0 | char *M_fs_path_join_resolved(const char *path, const char *part, const char *resolved_name, M_fs_system_t sys_type)
{
char *full_path;
char *dir;
char *rpath;
if ((path == NULL || *path == '\0') && (part == NULL || *part == '\0') && (resolved_name == NULL || *resolved_name == '\0'))
return NULL;
sys_type = M_fs_path_get_system_type(sys_type);
/* If the resolved path is absolute we don't need to modify it. */
if (M_fs_path_isabs(resolved_name, sys_type))
return M_strdup(resolved_name);
full_path = M_fs_path_join(path, part, sys_type);
M_fs_path_split(full_path, &dir, NULL, sys_type);
M_free(full_path);
rpath = M_fs_path_join(dir, resolved_name, sys_type);
M_free(dir);
return rpath;
}
| 539 |
107,778 | 0 | inline void FrameLoader::TakeObjectSnapshot() const {
if (detached_) {
return;
}
TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this,
ToTracedValue());
}
| 540 |
162,646 | 0 | void HeadlessPrintManager::OnShowInvalidPrinterSettingsError() {
ReleaseJob(INVALID_PRINTER_SETTINGS);
}
| 541 |
41,354 | 0 | int kvm_arch_init(void *opaque)
{
int r;
struct kvm_x86_ops *ops = (struct kvm_x86_ops *)opaque;
if (kvm_x86_ops) {
printk(KERN_ERR "kvm: already loaded the other module\n");
r = -EEXIST;
goto out;
}
if (!ops->cpu_has_kvm_support()) {
printk(KERN_ERR "kvm: no hardware support\n");
r = -EOPNOTSUPP;
goto out;
}
if (ops->disabled_by_bios()) {
printk(KERN_ERR "kvm: disabled by bios\n");
r = -EOPNOTSUPP;
goto out;
}
r = kvm_mmu_module_init();
if (r)
goto out;
kvm_init_msr_list();
kvm_x86_ops = ops;
kvm_mmu_set_nonpresent_ptes(0ull, 0ull);
kvm_mmu_set_mask_ptes(PT_USER_MASK, PT_ACCESSED_MASK,
PT_DIRTY_MASK, PT64_NX_MASK, 0);
kvm_timer_init();
perf_register_guest_info_callbacks(&kvm_guest_cbs);
if (cpu_has_xsave)
host_xcr0 = xgetbv(XCR_XFEATURE_ENABLED_MASK);
return 0;
out:
return r;
}
| 542 |
989 | 0 | GfxColorSpace *GfxCalGrayColorSpace::copy() {
GfxCalGrayColorSpace *cs;
cs = new GfxCalGrayColorSpace();
cs->whiteX = whiteX;
cs->whiteY = whiteY;
cs->whiteZ = whiteZ;
cs->blackX = blackX;
cs->blackY = blackY;
cs->blackZ = blackZ;
cs->gamma = gamma;
return cs;
}
| 543 |
158,061 | 0 | void LocalFrameClientImpl::DidSetFramePolicyHeaders(
SandboxFlags sandbox_flags,
const ParsedFeaturePolicy& parsed_header) {
if (web_frame_->Client()) {
web_frame_->Client()->DidSetFramePolicyHeaders(
static_cast<WebSandboxFlags>(sandbox_flags), parsed_header);
}
}
| 544 |
151,292 | 0 | InspectorStyleRecalcInvalidationTrackingEvent::Data(
Node* node,
const StyleChangeReasonForTracing& reason) {
DCHECK(node);
std::unique_ptr<TracedValue> value = TracedValue::Create();
value->SetString("frame", ToHexString(node->GetDocument().GetFrame()));
SetNodeInfo(value.get(), node, "nodeId", "nodeName");
value->SetString("reason", reason.ReasonString());
value->SetString("extraData", reason.GetExtraData());
SourceLocation::Capture()->ToTracedValue(value.get(), "stackTrace");
return value;
}
| 545 |
56,116 | 0 | void perf_log_lost_samples(struct perf_event *event, u64 lost)
{
struct perf_output_handle handle;
struct perf_sample_data sample;
int ret;
struct {
struct perf_event_header header;
u64 lost;
} lost_samples_event = {
.header = {
.type = PERF_RECORD_LOST_SAMPLES,
.misc = 0,
.size = sizeof(lost_samples_event),
},
.lost = lost,
};
perf_event_header__init_id(&lost_samples_event.header, &sample, event);
ret = perf_output_begin(&handle, event,
lost_samples_event.header.size);
if (ret)
return;
perf_output_put(&handle, lost_samples_event);
perf_event__output_id_sample(event, &handle, &sample);
perf_output_end(&handle);
}
| 546 |
16,752 | 0 | intuit_diff_type (bool need_header, mode_t *p_file_type)
{
file_offset this_line = 0;
file_offset first_command_line = -1;
char first_ed_command_letter = 0;
lin fcl_line = 0; /* Pacify 'gcc -W'. */
bool this_is_a_command = false;
bool stars_this_line = false;
bool extended_headers = false;
enum nametype i;
struct stat st[3];
int stat_errno[3];
int version_controlled[3];
enum diff retval;
mode_t file_type;
for (i = OLD; i <= INDEX; i++)
if (p_name[i]) {
free (p_name[i]);
p_name[i] = 0;
}
for (i = 0; i < ARRAY_SIZE (invalid_names); i++)
invalid_names[i] = NULL;
for (i = OLD; i <= NEW; i++)
if (p_timestr[i])
{
free(p_timestr[i]);
p_timestr[i] = 0;
}
for (i = OLD; i <= NEW; i++)
if (p_sha1[i])
{
free (p_sha1[i]);
p_sha1[i] = 0;
}
p_git_diff = false;
for (i = OLD; i <= NEW; i++)
{
p_mode[i] = 0;
p_copy[i] = false;
p_rename[i] = false;
}
/* Ed and normal format patches don't have filename headers. */
if (diff_type == ED_DIFF || diff_type == NORMAL_DIFF)
need_header = false;
version_controlled[OLD] = -1;
version_controlled[NEW] = -1;
version_controlled[INDEX] = -1;
p_rfc934_nesting = 0;
p_timestamp[OLD].tv_sec = p_timestamp[NEW].tv_sec = -1;
p_says_nonexistent[OLD] = p_says_nonexistent[NEW] = 0;
Fseek (pfp, p_base, SEEK_SET);
p_input_line = p_bline - 1;
for (;;) {
char *s;
char *t;
file_offset previous_line = this_line;
bool last_line_was_command = this_is_a_command;
bool stars_last_line = stars_this_line;
size_t indent = 0;
char ed_command_letter;
bool strip_trailing_cr;
size_t chars_read;
this_line = file_tell (pfp);
chars_read = pget_line (0, 0, false, false);
if (chars_read == (size_t) -1)
xalloc_die ();
if (! chars_read) {
if (first_ed_command_letter) {
/* nothing but deletes!? */
p_start = first_command_line;
p_sline = fcl_line;
retval = ED_DIFF;
goto scan_exit;
}
else {
p_start = this_line;
p_sline = p_input_line;
if (extended_headers)
{
/* Patch contains no hunks; any diff type will do. */
retval = UNI_DIFF;
goto scan_exit;
}
return NO_DIFF;
}
}
strip_trailing_cr = 2 <= chars_read && buf[chars_read - 2] == '\r';
for (s = buf; *s == ' ' || *s == '\t' || *s == 'X'; s++) {
if (*s == '\t')
indent = (indent + 8) & ~7;
else
indent++;
}
if (ISDIGIT (*s))
{
for (t = s + 1; ISDIGIT (*t) || *t == ','; t++)
/* do nothing */ ;
if (*t == 'd' || *t == 'c' || *t == 'a')
{
for (t++; ISDIGIT (*t) || *t == ','; t++)
/* do nothing */ ;
for (; *t == ' ' || *t == '\t'; t++)
/* do nothing */ ;
if (*t == '\r')
t++;
this_is_a_command = (*t == '\n');
}
}
if (! need_header
&& first_command_line < 0
&& ((ed_command_letter = get_ed_command_letter (s))
|| this_is_a_command)) {
first_command_line = this_line;
first_ed_command_letter = ed_command_letter;
fcl_line = p_input_line;
p_indent = indent; /* assume this for now */
p_strip_trailing_cr = strip_trailing_cr;
}
if (!stars_last_line && strnEQ(s, "*** ", 4))
{
fetchname (s+4, strippath, &p_name[OLD], &p_timestr[OLD],
&p_timestamp[OLD]);
need_header = false;
}
else if (strnEQ(s, "+++ ", 4))
{
/* Swap with NEW below. */
fetchname (s+4, strippath, &p_name[OLD], &p_timestr[OLD],
&p_timestamp[OLD]);
need_header = false;
p_strip_trailing_cr = strip_trailing_cr;
}
else if (strnEQ(s, "Index:", 6))
{
fetchname (s+6, strippath, &p_name[INDEX], (char **) 0, NULL);
need_header = false;
p_strip_trailing_cr = strip_trailing_cr;
}
else if (strnEQ(s, "Prereq:", 7))
{
for (t = s + 7; ISSPACE ((unsigned char) *t); t++)
/* do nothing */ ;
revision = t;
for (t = revision; *t; t++)
if (ISSPACE ((unsigned char) *t))
{
char const *u;
for (u = t + 1; ISSPACE ((unsigned char) *u); u++)
/* do nothing */ ;
if (*u)
{
char numbuf[LINENUM_LENGTH_BOUND + 1];
say ("Prereq: with multiple words at line %s of patch\n",
format_linenum (numbuf, this_line));
}
break;
}
if (t == revision)
revision = 0;
else {
char oldc = *t;
*t = '\0';
revision = xstrdup (revision);
*t = oldc;
}
}
else if (strnEQ (s, "diff --git ", 11))
{
char const *u;
if (extended_headers)
{
p_start = this_line;
p_sline = p_input_line;
/* Patch contains no hunks; any diff type will do. */
retval = UNI_DIFF;
goto scan_exit;
}
for (i = OLD; i <= NEW; i++)
{
free (p_name[i]);
p_name[i] = 0;
}
if (! ((p_name[OLD] = parse_name (s + 11, strippath, &u))
&& ISSPACE ((unsigned char) *u)
&& (p_name[NEW] = parse_name (u, strippath, &u))
&& (u = skip_spaces (u), ! *u)))
for (i = OLD; i <= NEW; i++)
{
free (p_name[i]);
p_name[i] = 0;
}
p_git_diff = true;
}
else if (p_git_diff && strnEQ (s, "index ", 6))
{
char const *u, *v;
if ((u = skip_hex_digits (s + 6))
&& u[0] == '.' && u[1] == '.'
&& (v = skip_hex_digits (u + 2))
&& (! *v || ISSPACE ((unsigned char) *v)))
{
get_sha1(&p_sha1[OLD], s + 6, u);
get_sha1(&p_sha1[NEW], u + 2, v);
p_says_nonexistent[OLD] = sha1_says_nonexistent (p_sha1[OLD]);
p_says_nonexistent[NEW] = sha1_says_nonexistent (p_sha1[NEW]);
if (*(v = skip_spaces (v)))
p_mode[OLD] = p_mode[NEW] = fetchmode (v);
extended_headers = true;
}
}
else if (p_git_diff && strnEQ (s, "old mode ", 9))
{
p_mode[OLD] = fetchmode (s + 9);
extended_headers = true;
}
else if (p_git_diff && strnEQ (s, "new mode ", 9))
{
p_mode[NEW] = fetchmode (s + 9);
extended_headers = true;
}
else if (p_git_diff && strnEQ (s, "deleted file mode ", 18))
{
p_mode[OLD] = fetchmode (s + 18);
p_says_nonexistent[NEW] = 2;
extended_headers = true;
}
else if (p_git_diff && strnEQ (s, "new file mode ", 14))
{
p_mode[NEW] = fetchmode (s + 14);
p_says_nonexistent[OLD] = 2;
extended_headers = true;
}
else if (p_git_diff && strnEQ (s, "rename from ", 12))
{
/* Git leaves out the prefix in the file name in this header,
so we can only ignore the file name. */
p_rename[OLD] = true;
extended_headers = true;
}
else if (p_git_diff && strnEQ (s, "rename to ", 10))
{
/* Git leaves out the prefix in the file name in this header,
so we can only ignore the file name. */
p_rename[NEW] = true;
extended_headers = true;
}
else if (p_git_diff && strnEQ (s, "copy from ", 10))
{
/* Git leaves out the prefix in the file name in this header,
so we can only ignore the file name. */
p_copy[OLD] = true;
extended_headers = true;
}
else if (p_git_diff && strnEQ (s, "copy to ", 8))
{
/* Git leaves out the prefix in the file name in this header,
so we can only ignore the file name. */
p_copy[NEW] = true;
extended_headers = true;
}
else if (p_git_diff && strnEQ (s, "GIT binary patch", 16))
{
p_start = this_line;
p_sline = p_input_line;
retval = GIT_BINARY_DIFF;
goto scan_exit;
}
else
{
for (t = s; t[0] == '-' && t[1] == ' '; t += 2)
/* do nothing */ ;
if (strnEQ(t, "--- ", 4))
{
struct timespec timestamp;
timestamp.tv_sec = -1;
fetchname (t+4, strippath, &p_name[NEW], &p_timestr[NEW],
×tamp);
need_header = false;
if (timestamp.tv_sec != -1)
{
p_timestamp[NEW] = timestamp;
p_rfc934_nesting = (t - s) >> 1;
}
p_strip_trailing_cr = strip_trailing_cr;
}
}
if (need_header)
continue;
if ((diff_type == NO_DIFF || diff_type == ED_DIFF) &&
first_command_line >= 0 &&
strEQ(s, ".\n") ) {
p_start = first_command_line;
p_sline = fcl_line;
retval = ED_DIFF;
goto scan_exit;
}
if ((diff_type == NO_DIFF || diff_type == UNI_DIFF)
&& strnEQ(s, "@@ -", 4)) {
/* 'p_name', 'p_timestr', and 'p_timestamp' are backwards;
swap them. */
struct timespec ti = p_timestamp[OLD];
p_timestamp[OLD] = p_timestamp[NEW];
p_timestamp[NEW] = ti;
t = p_name[OLD];
p_name[OLD] = p_name[NEW];
p_name[NEW] = t;
t = p_timestr[OLD];
p_timestr[OLD] = p_timestr[NEW];
p_timestr[NEW] = t;
s += 4;
if (s[0] == '0' && !ISDIGIT (s[1]))
p_says_nonexistent[OLD] = 1 + ! p_timestamp[OLD].tv_sec;
while (*s != ' ' && *s != '\n')
s++;
while (*s == ' ')
s++;
if (s[0] == '+' && s[1] == '0' && !ISDIGIT (s[2]))
p_says_nonexistent[NEW] = 1 + ! p_timestamp[NEW].tv_sec;
p_indent = indent;
p_start = this_line;
p_sline = p_input_line;
retval = UNI_DIFF;
if (! ((p_name[OLD] || ! p_timestamp[OLD].tv_sec)
&& (p_name[NEW] || ! p_timestamp[NEW].tv_sec))
&& ! p_name[INDEX] && need_header)
{
char numbuf[LINENUM_LENGTH_BOUND + 1];
say ("missing header for unified diff at line %s of patch\n",
format_linenum (numbuf, p_sline));
}
goto scan_exit;
}
stars_this_line = strnEQ(s, "********", 8);
if ((diff_type == NO_DIFF
|| diff_type == CONTEXT_DIFF
|| diff_type == NEW_CONTEXT_DIFF)
&& stars_last_line && strnEQ (s, "*** ", 4)) {
s += 4;
if (s[0] == '0' && !ISDIGIT (s[1]))
p_says_nonexistent[OLD] = 1 + ! p_timestamp[OLD].tv_sec;
/* if this is a new context diff the character just before */
/* the newline is a '*'. */
while (*s != '\n')
s++;
p_indent = indent;
p_strip_trailing_cr = strip_trailing_cr;
p_start = previous_line;
p_sline = p_input_line - 1;
retval = (*(s-1) == '*' ? NEW_CONTEXT_DIFF : CONTEXT_DIFF);
{
/* Scan the first hunk to see whether the file contents
appear to have been deleted. */
file_offset saved_p_base = p_base;
lin saved_p_bline = p_bline;
Fseek (pfp, previous_line, SEEK_SET);
p_input_line -= 2;
if (another_hunk (retval, false)
&& ! p_repl_lines && p_newfirst == 1)
p_says_nonexistent[NEW] = 1 + ! p_timestamp[NEW].tv_sec;
next_intuit_at (saved_p_base, saved_p_bline);
}
if (! ((p_name[OLD] || ! p_timestamp[OLD].tv_sec)
&& (p_name[NEW] || ! p_timestamp[NEW].tv_sec))
&& ! p_name[INDEX] && need_header)
{
char numbuf[LINENUM_LENGTH_BOUND + 1];
say ("missing header for context diff at line %s of patch\n",
format_linenum (numbuf, p_sline));
}
goto scan_exit;
}
if ((diff_type == NO_DIFF || diff_type == NORMAL_DIFF) &&
last_line_was_command &&
(strnEQ(s, "< ", 2) || strnEQ(s, "> ", 2)) ) {
p_start = previous_line;
p_sline = p_input_line - 1;
p_indent = indent;
retval = NORMAL_DIFF;
goto scan_exit;
}
}
scan_exit:
/* The old, new, or old and new file types may be defined. When both
file types are defined, make sure they are the same, or else assume
we do not know the file type. */
file_type = p_mode[OLD] & S_IFMT;
if (file_type)
{
mode_t new_file_type = p_mode[NEW] & S_IFMT;
if (new_file_type && file_type != new_file_type)
file_type = 0;
}
else
{
file_type = p_mode[NEW] & S_IFMT;
if (! file_type)
file_type = S_IFREG;
}
*p_file_type = file_type;
/* To intuit 'inname', the name of the file to patch,
use the algorithm specified by POSIX 1003.1-2001 XCU lines 25680-26599
(with some modifications if posixly_correct is zero):
- Take the old and new names from the context header if present,
and take the index name from the 'Index:' line if present and
if either the old and new names are both absent
or posixly_correct is nonzero.
Consider the file names to be in the order (old, new, index).
- If some named files exist, use the first one if posixly_correct
is nonzero, the best one otherwise.
- If patch_get is nonzero, and no named files exist,
but an RCS or SCCS master file exists,
use the first named file with an RCS or SCCS master.
- If no named files exist, no RCS or SCCS master was found,
some names are given, posixly_correct is zero,
and the patch appears to create a file, then use the best name
requiring the creation of the fewest directories.
- Otherwise, report failure by setting 'inname' to 0;
this causes our invoker to ask the user for a file name. */
i = NONE;
if (!inname)
{
enum nametype i0 = NONE;
if (! posixly_correct && (p_name[OLD] || p_name[NEW]) && p_name[INDEX])
{
free (p_name[INDEX]);
p_name[INDEX] = 0;
}
for (i = OLD; i <= INDEX; i++)
if (p_name[i])
{
if (i0 != NONE && strcmp (p_name[i0], p_name[i]) == 0)
{
/* It's the same name as before; reuse stat results. */
stat_errno[i] = stat_errno[i0];
if (! stat_errno[i])
st[i] = st[i0];
}
else
{
stat_errno[i] = stat_file (p_name[i], &st[i]);
if (! stat_errno[i])
{
if (lookup_file_id (&st[i]) == DELETE_LATER)
stat_errno[i] = ENOENT;
else if (posixly_correct && name_is_valid (p_name[i]))
break;
}
}
i0 = i;
}
if (! posixly_correct)
{
/* The best of all existing files. */
i = best_name (p_name, stat_errno);
if (i == NONE && patch_get)
{
enum nametype nope = NONE;
for (i = OLD; i <= INDEX; i++)
if (p_name[i])
{
char const *cs;
char *getbuf;
char *diffbuf;
bool readonly = (outfile
&& strcmp (outfile, p_name[i]) != 0);
if (nope == NONE || strcmp (p_name[nope], p_name[i]) != 0)
{
cs = (version_controller
(p_name[i], readonly, (struct stat *) 0,
&getbuf, &diffbuf));
version_controlled[i] = !! cs;
if (cs)
{
if (version_get (p_name[i], cs, false, readonly,
getbuf, &st[i]))
stat_errno[i] = 0;
else
version_controlled[i] = 0;
free (getbuf);
free (diffbuf);
if (! stat_errno[i])
break;
}
}
nope = i;
}
}
if (i0 != NONE
&& (i == NONE || (st[i].st_mode & S_IFMT) == file_type)
&& maybe_reverse (p_name[i == NONE ? i0 : i], i == NONE,
i == NONE || st[i].st_size == 0)
&& i == NONE)
i = i0;
if (i == NONE && p_says_nonexistent[reverse])
{
int newdirs[3];
int newdirs_min = INT_MAX;
int distance_from_minimum[3];
for (i = OLD; i <= INDEX; i++)
if (p_name[i])
{
newdirs[i] = (prefix_components (p_name[i], false)
- prefix_components (p_name[i], true));
if (newdirs[i] < newdirs_min)
newdirs_min = newdirs[i];
}
for (i = OLD; i <= INDEX; i++)
if (p_name[i])
distance_from_minimum[i] = newdirs[i] - newdirs_min;
/* The best of the filenames which create the fewest directories. */
i = best_name (p_name, distance_from_minimum);
}
}
}
if (i == NONE)
{
if (inname)
{
inerrno = stat_file (inname, &instat);
if (inerrno || (instat.st_mode & S_IFMT) == file_type)
maybe_reverse (inname, inerrno, inerrno || instat.st_size == 0);
}
else
inerrno = -1;
}
else
{
inname = xstrdup (p_name[i]);
inerrno = stat_errno[i];
invc = version_controlled[i];
instat = st[i];
}
return retval;
}
| 547 |
161,627 | 0 | void AudioHandler::MakeConnection() {
AtomicIncrement(&connection_ref_count_);
#if DEBUG_AUDIONODE_REFERENCES
fprintf(stderr, "[%16p]: %16p: %2d: AudioHandler::ref %3d [%3d]\n",
Context(), this, GetNodeType(), connection_ref_count_,
node_count_[GetNodeType()]);
#endif
EnableOutputsIfNecessary();
}
| 548 |
21,085 | 0 | static int mem_cgroup_move_account(struct page *page,
unsigned int nr_pages,
struct page_cgroup *pc,
struct mem_cgroup *from,
struct mem_cgroup *to,
bool uncharge)
{
unsigned long flags;
int ret;
VM_BUG_ON(from == to);
VM_BUG_ON(PageLRU(page));
/*
* The page is isolated from LRU. So, collapse function
* will not handle this page. But page splitting can happen.
* Do this check under compound_page_lock(). The caller should
* hold it.
*/
ret = -EBUSY;
if (nr_pages > 1 && !PageTransHuge(page))
goto out;
lock_page_cgroup(pc);
ret = -EINVAL;
if (!PageCgroupUsed(pc) || pc->mem_cgroup != from)
goto unlock;
move_lock_page_cgroup(pc, &flags);
if (PageCgroupFileMapped(pc)) {
/* Update mapped_file data for mem_cgroup */
preempt_disable();
__this_cpu_dec(from->stat->count[MEM_CGROUP_STAT_FILE_MAPPED]);
__this_cpu_inc(to->stat->count[MEM_CGROUP_STAT_FILE_MAPPED]);
preempt_enable();
}
mem_cgroup_charge_statistics(from, PageCgroupCache(pc), -nr_pages);
if (uncharge)
/* This is not "cancel", but cancel_charge does all we need. */
__mem_cgroup_cancel_charge(from, nr_pages);
/* caller should have done css_get */
pc->mem_cgroup = to;
mem_cgroup_charge_statistics(to, PageCgroupCache(pc), nr_pages);
/*
* We charges against "to" which may not have any tasks. Then, "to"
* can be under rmdir(). But in current implementation, caller of
* this function is just force_empty() and move charge, so it's
* guaranteed that "to" is never removed. So, we don't check rmdir
* status here.
*/
move_unlock_page_cgroup(pc, &flags);
ret = 0;
unlock:
unlock_page_cgroup(pc);
/*
* check events
*/
memcg_check_events(to, page);
memcg_check_events(from, page);
out:
return ret;
}
| 549 |
71,823 | 0 | static void ipa_draw_ellipse(wmfAPI * API, wmfDrawArc_t * draw_arc)
{
util_draw_arc(API, draw_arc, magick_arc_ellipse);
}
| 550 |
8,528 | 0 | static void ssh1_log_outgoing_packet(Ssh ssh, struct Packet *pkt)
{
int nblanks = 0;
struct logblank_t blanks[4];
char *str;
int slen;
/*
* For outgoing packets, pkt->length represents the length of the
* whole packet starting at pkt->data (including some header), and
* pkt->body refers to the point within that where the log-worthy
* payload begins. However, incoming packets expect pkt->length to
* represent only the payload length (that is, it's measured from
* pkt->body not from pkt->data). Temporarily adjust our outgoing
* packet to conform to the incoming-packet semantics, so that we
* can analyse it with the ssh_pkt_get functions.
*/
pkt->length -= (pkt->body - pkt->data);
pkt->savedpos = 0;
if (ssh->logomitdata &&
(pkt->type == SSH1_CMSG_STDIN_DATA ||
pkt->type == SSH1_MSG_CHANNEL_DATA)) {
/* "Session data" packets - omit the data string. */
if (pkt->type == SSH1_MSG_CHANNEL_DATA)
ssh_pkt_getuint32(pkt); /* skip channel id */
blanks[nblanks].offset = pkt->savedpos + 4;
blanks[nblanks].type = PKTLOG_OMIT;
ssh_pkt_getstring(pkt, &str, &slen);
if (str) {
blanks[nblanks].len = slen;
nblanks++;
}
}
if ((pkt->type == SSH1_CMSG_AUTH_PASSWORD ||
pkt->type == SSH1_CMSG_AUTH_TIS_RESPONSE ||
pkt->type == SSH1_CMSG_AUTH_CCARD_RESPONSE) &&
conf_get_int(ssh->conf, CONF_logomitpass)) {
/* If this is a password or similar packet, blank the password(s). */
blanks[nblanks].offset = 0;
blanks[nblanks].len = pkt->length;
blanks[nblanks].type = PKTLOG_BLANK;
nblanks++;
} else if (pkt->type == SSH1_CMSG_X11_REQUEST_FORWARDING &&
conf_get_int(ssh->conf, CONF_logomitpass)) {
/*
* If this is an X forwarding request packet, blank the fake
* auth data.
*
* Note that while we blank the X authentication data here, we
* don't take any special action to blank the start of an X11
* channel, so using MIT-MAGIC-COOKIE-1 and actually opening
* an X connection without having session blanking enabled is
* likely to leak your cookie into the log.
*/
pkt->savedpos = 0;
ssh_pkt_getstring(pkt, &str, &slen);
blanks[nblanks].offset = pkt->savedpos;
blanks[nblanks].type = PKTLOG_BLANK;
ssh_pkt_getstring(pkt, &str, &slen);
if (str) {
blanks[nblanks].len = pkt->savedpos - blanks[nblanks].offset;
nblanks++;
}
}
log_packet(ssh->logctx, PKT_OUTGOING, pkt->data[12],
ssh1_pkt_type(pkt->data[12]),
pkt->body, pkt->length,
nblanks, blanks, NULL, 0, NULL);
/*
* Undo the above adjustment of pkt->length, to put the packet
* back in the state we found it.
*/
pkt->length += (pkt->body - pkt->data);
}
| 551 |
24,653 | 0 | static int mmtimer_mmap(struct file *file, struct vm_area_struct *vma)
{
unsigned long mmtimer_addr;
if (vma->vm_end - vma->vm_start != PAGE_SIZE)
return -EINVAL;
if (vma->vm_flags & VM_WRITE)
return -EPERM;
if (PAGE_SIZE > (1 << 16))
return -ENOSYS;
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
mmtimer_addr = __pa(RTC_COUNTER_ADDR);
mmtimer_addr &= ~(PAGE_SIZE - 1);
mmtimer_addr &= 0xfffffffffffffffUL;
if (remap_pfn_range(vma, vma->vm_start, mmtimer_addr >> PAGE_SHIFT,
PAGE_SIZE, vma->vm_page_prot)) {
printk(KERN_ERR "remap_pfn_range failed in mmtimer.c\n");
return -EAGAIN;
}
return 0;
}
| 552 |
148,777 | 0 | InterstitialPage* InterstitialPage::GetInterstitialPage(
WebContents* web_contents) {
InitInterstitialPageMap();
InterstitialPageMap::const_iterator iter =
g_web_contents_to_interstitial_page->find(web_contents);
if (iter == g_web_contents_to_interstitial_page->end())
return NULL;
return iter->second;
}
| 553 |
113,995 | 0 | bool ShouldShowNetworkIconInTray(const Network* network) {
if (!network)
return true;
return !network->connected() || network->type() != TYPE_ETHERNET;
}
| 554 |
90,448 | 0 | static int ib_uverbs_comp_event_fasync(int fd, struct file *filp, int on)
{
struct ib_uverbs_completion_event_file *comp_ev_file =
filp->private_data;
return fasync_helper(fd, filp, on, &comp_ev_file->ev_queue.async_queue);
}
| 555 |
169,171 | 0 | void RenderFrameHostImpl::RegisterMojoInterfaces() {
#if !defined(OS_ANDROID)
registry_->AddInterface(base::Bind(&InstalledAppProviderImplDefault::Create));
#endif // !defined(OS_ANDROID)
PermissionManager* permission_manager =
GetProcess()->GetBrowserContext()->GetPermissionManager();
if (delegate_) {
auto* geolocation_context = delegate_->GetGeolocationContext();
if (geolocation_context && permission_manager) {
geolocation_service_.reset(new GeolocationServiceImpl(
geolocation_context, permission_manager, this));
registry_->AddInterface(
base::Bind(&GeolocationServiceImpl::Bind,
base::Unretained(geolocation_service_.get())));
}
}
registry_->AddInterface<device::mojom::WakeLock>(base::Bind(
&RenderFrameHostImpl::BindWakeLockRequest, base::Unretained(this)));
#if defined(OS_ANDROID)
if (base::FeatureList::IsEnabled(features::kWebNfc)) {
registry_->AddInterface<device::mojom::NFC>(base::Bind(
&RenderFrameHostImpl::BindNFCRequest, base::Unretained(this)));
}
#endif
if (!permission_service_context_)
permission_service_context_.reset(new PermissionServiceContext(this));
registry_->AddInterface(
base::Bind(&PermissionServiceContext::CreateService,
base::Unretained(permission_service_context_.get())));
registry_->AddInterface(
base::Bind(&RenderFrameHostImpl::BindPresentationServiceRequest,
base::Unretained(this)));
registry_->AddInterface(
base::Bind(&MediaSessionServiceImpl::Create, base::Unretained(this)));
registry_->AddInterface(base::Bind(
base::IgnoreResult(&RenderFrameHostImpl::CreateWebBluetoothService),
base::Unretained(this)));
registry_->AddInterface(base::BindRepeating(
&RenderFrameHostImpl::CreateUsbDeviceManager, base::Unretained(this)));
registry_->AddInterface(base::BindRepeating(
&RenderFrameHostImpl::CreateUsbChooserService, base::Unretained(this)));
registry_->AddInterface<media::mojom::InterfaceFactory>(
base::Bind(&RenderFrameHostImpl::BindMediaInterfaceFactoryRequest,
base::Unretained(this)));
registry_->AddInterface(base::BindRepeating(
&RenderFrameHostImpl::CreateWebSocket, base::Unretained(this)));
registry_->AddInterface(base::Bind(&SharedWorkerConnectorImpl::Create,
process_->GetID(), routing_id_));
registry_->AddInterface<device::mojom::VRService>(base::Bind(
&WebvrServiceProvider::BindWebvrService, base::Unretained(this)));
registry_->AddInterface(
base::BindRepeating(&RenderFrameHostImpl::CreateAudioInputStreamFactory,
base::Unretained(this)));
registry_->AddInterface(
base::BindRepeating(&RenderFrameHostImpl::CreateAudioOutputStreamFactory,
base::Unretained(this)));
if (resource_coordinator::IsResourceCoordinatorEnabled()) {
registry_->AddInterface(
base::Bind(&CreateFrameResourceCoordinator, base::Unretained(this)));
}
#if BUILDFLAG(ENABLE_WEBRTC)
if (BrowserMainLoop::GetInstance()) {
MediaStreamManager* media_stream_manager =
BrowserMainLoop::GetInstance()->media_stream_manager();
registry_->AddInterface(
base::Bind(&MediaDevicesDispatcherHost::Create, GetProcess()->GetID(),
GetRoutingID(),
base::Unretained(media_stream_manager)),
BrowserThread::GetTaskRunnerForThread(BrowserThread::IO));
registry_->AddInterface(
base::BindRepeating(
&RenderFrameHostImpl::CreateMediaStreamDispatcherHost,
base::Unretained(this), base::Unretained(media_stream_manager)),
BrowserThread::GetTaskRunnerForThread(BrowserThread::IO));
}
#endif
#if BUILDFLAG(ENABLE_MEDIA_REMOTING)
registry_->AddInterface(base::Bind(&RemoterFactoryImpl::Bind,
GetProcess()->GetID(), GetRoutingID()));
#endif // BUILDFLAG(ENABLE_MEDIA_REMOTING)
registry_->AddInterface(base::BindRepeating(
&KeyboardLockServiceImpl::CreateMojoService, base::Unretained(this)));
registry_->AddInterface(base::Bind(&ImageCaptureImpl::Create));
#if !defined(OS_ANDROID)
if (base::FeatureList::IsEnabled(features::kWebAuth)) {
registry_->AddInterface(
base::Bind(&RenderFrameHostImpl::BindAuthenticatorRequest,
base::Unretained(this)));
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableWebAuthTestingAPI)) {
auto* environment_singleton =
ScopedVirtualAuthenticatorEnvironment::GetInstance();
registry_->AddInterface(base::BindRepeating(
&ScopedVirtualAuthenticatorEnvironment::AddBinding,
base::Unretained(environment_singleton)));
}
}
#endif // !defined(OS_ANDROID)
if (permission_manager) {
sensor_provider_proxy_.reset(
new SensorProviderProxyImpl(permission_manager, this));
registry_->AddInterface(
base::Bind(&SensorProviderProxyImpl::Bind,
base::Unretained(sensor_provider_proxy_.get())));
}
registry_->AddInterface(base::BindRepeating(
&media::MediaMetricsProvider::Create,
GetSiteInstance()->GetBrowserContext()->IsOffTheRecord()
? nullptr
: GetSiteInstance()
->GetBrowserContext()
->GetVideoDecodePerfHistory()));
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
cc::switches::kEnableGpuBenchmarking)) {
registry_->AddInterface(
base::Bind(&InputInjectorImpl::Create, weak_ptr_factory_.GetWeakPtr()));
}
registry_->AddInterface(
base::BindRepeating(GetRestrictedCookieManager, base::Unretained(this)));
registry_->AddInterface(base::BindRepeating(
&QuotaDispatcherHost::CreateForFrame, GetProcess(), routing_id_));
if (base::FeatureList::IsEnabled(network::features::kNetworkService)) {
StoragePartitionImpl* storage_partition =
static_cast<StoragePartitionImpl*>(BrowserContext::GetStoragePartition(
GetSiteInstance()->GetBrowserContext(), GetSiteInstance()));
registry_->AddInterface(
base::BindRepeating(
&PrefetchURLLoaderService::ConnectToService,
base::RetainedRef(storage_partition->GetPrefetchURLLoaderService()),
frame_tree_node_->frame_tree_node_id()),
BrowserThread::GetTaskRunnerForThread(BrowserThread::IO));
}
}
| 556 |
77,879 | 0 | test_bson_append_deep (void)
{
bson_t *a;
bson_t *tmp;
int i;
a = bson_new ();
for (i = 0; i < 100; i++) {
tmp = a;
a = bson_new ();
BSON_ASSERT (bson_append_document (a, "a", -1, tmp));
bson_destroy (tmp);
}
BSON_ASSERT_BSON_EQUAL_FILE (a, "test38.bson");
bson_destroy (a);
}
| 557 |
63,410 | 0 | static void entropy_decode_stereo_3930(APEContext *ctx, int blockstodecode)
{
int32_t *decoded0 = ctx->decoded[0];
int32_t *decoded1 = ctx->decoded[1];
while (blockstodecode--) {
*decoded0++ = ape_decode_value_3900(ctx, &ctx->riceY);
*decoded1++ = ape_decode_value_3900(ctx, &ctx->riceX);
}
}
| 558 |
105,277 | 0 | String HTMLElement::title() const
{
return getAttribute(titleAttr);
}
| 559 |
38,525 | 0 | static void cma_set_compare_data(enum rdma_port_space ps, struct sockaddr *addr,
struct ib_cm_compare_data *compare)
{
struct cma_hdr *cma_data, *cma_mask;
__be32 ip4_addr;
struct in6_addr ip6_addr;
memset(compare, 0, sizeof *compare);
cma_data = (void *) compare->data;
cma_mask = (void *) compare->mask;
switch (addr->sa_family) {
case AF_INET:
ip4_addr = ((struct sockaddr_in *) addr)->sin_addr.s_addr;
cma_set_ip_ver(cma_data, 4);
cma_set_ip_ver(cma_mask, 0xF);
if (!cma_any_addr(addr)) {
cma_data->dst_addr.ip4.addr = ip4_addr;
cma_mask->dst_addr.ip4.addr = htonl(~0);
}
break;
case AF_INET6:
ip6_addr = ((struct sockaddr_in6 *) addr)->sin6_addr;
cma_set_ip_ver(cma_data, 6);
cma_set_ip_ver(cma_mask, 0xF);
if (!cma_any_addr(addr)) {
cma_data->dst_addr.ip6 = ip6_addr;
memset(&cma_mask->dst_addr.ip6, 0xFF,
sizeof cma_mask->dst_addr.ip6);
}
break;
default:
break;
}
}
| 560 |
14,247 | 0 | static void _php_list_set_error_structure(xmlErrorPtr error, const char *msg)
{
xmlError error_copy;
int ret;
TSRMLS_FETCH();
memset(&error_copy, 0, sizeof(xmlError));
if (error) {
ret = xmlCopyError(error, &error_copy);
} else {
error_copy.domain = 0;
error_copy.code = XML_ERR_INTERNAL_ERROR;
error_copy.level = XML_ERR_ERROR;
error_copy.line = 0;
error_copy.node = NULL;
error_copy.int1 = 0;
error_copy.int2 = 0;
error_copy.ctxt = NULL;
error_copy.message = xmlStrdup(msg);
error_copy.file = NULL;
error_copy.str1 = NULL;
error_copy.str2 = NULL;
error_copy.str3 = NULL;
ret = 0;
}
if (ret == 0) {
zend_llist_add_element(LIBXML(error_list), &error_copy);
}
}
| 561 |
180,707 | 1 | int user_update(struct key *key, struct key_preparsed_payload *prep)
{
struct user_key_payload *upayload, *zap;
size_t datalen = prep->datalen;
int ret;
ret = -EINVAL;
if (datalen <= 0 || datalen > 32767 || !prep->data)
goto error;
/* construct a replacement payload */
ret = -ENOMEM;
upayload = kmalloc(sizeof(*upayload) + datalen, GFP_KERNEL);
if (!upayload)
goto error;
upayload->datalen = datalen;
memcpy(upayload->data, prep->data, datalen);
/* check the quota and attach the new data */
zap = upayload;
ret = key_payload_reserve(key, datalen);
if (ret == 0) {
/* attach the new data, displacing the old */
zap = key->payload.data[0];
rcu_assign_keypointer(key, upayload);
key->expiry = 0;
}
if (zap)
kfree_rcu(zap, rcu);
error:
return ret;
}
| 562 |
71,744 | 0 | static MagickBooleanType TraceSVGImage(Image *image,ExceptionInfo *exception)
{
#if defined(MAGICKCORE_AUTOTRACE_DELEGATE)
{
at_bitmap_type
*trace;
at_fitting_opts_type
*fitting_options;
at_output_opts_type
*output_options;
at_splines_type
*splines;
ImageType
type;
register const PixelPacket
*p;
register ssize_t
i,
x;
size_t
number_planes;
ssize_t
y;
/*
Trace image and write as SVG.
*/
fitting_options=at_fitting_opts_new();
output_options=at_output_opts_new();
type=GetImageType(image,exception);
number_planes=3;
if ((type == BilevelType) || (type == GrayscaleType))
number_planes=1;
trace=at_bitmap_new(image->columns,image->rows,number_planes);
i=0;
for (y=0; y < (ssize_t) image->rows; y++)
{
p=GetVirtualPixels(image,0,y,image->columns,1,exception);
if (p == (const PixelPacket *) NULL)
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
trace->bitmap[i++]=GetPixelRed(p);
if (number_planes == 3)
{
trace->bitmap[i++]=GetPixelGreen(p);
trace->bitmap[i++]=GetPixelBlue(p);
}
p++;
}
}
splines=at_splines_new_full(trace,fitting_options,NULL,NULL,NULL,NULL,NULL,
NULL);
at_splines_write(at_output_get_handler_by_suffix((char *) "svg"),
GetBlobFileHandle(image),image->filename,output_options,splines,NULL,
NULL);
/*
Free resources.
*/
at_splines_free(splines);
at_bitmap_free(trace);
at_output_opts_free(output_options);
at_fitting_opts_free(fitting_options);
}
#else
{
char
*base64,
message[MaxTextExtent];
Image
*clone_image;
ImageInfo
*image_info;
register char
*p;
size_t
blob_length,
encode_length;
ssize_t
i;
unsigned char
*blob;
(void) WriteBlobString(image,
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n");
(void) WriteBlobString(image,
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 20010904//EN\"\n");
(void) WriteBlobString(image,
" \"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd\">\n");
(void) FormatLocaleString(message,MaxTextExtent,
"<svg width=\"%.20g\" height=\"%.20g\">\n",(double) image->columns,
(double) image->rows);
(void) WriteBlobString(image,message);
clone_image=CloneImage(image,0,0,MagickTrue,exception);
if (clone_image == (Image *) NULL)
return(MagickFalse);
image_info=AcquireImageInfo();
(void) CopyMagickString(image_info->magick,"PNG",MaxTextExtent);
blob_length=2048;
blob=(unsigned char *) ImageToBlob(image_info,clone_image,&blob_length,
exception);
encode_length=0;
base64=Base64Encode(blob,blob_length,&encode_length);
blob=(unsigned char *) RelinquishMagickMemory(blob);
(void) FormatLocaleString(message,MaxTextExtent,
" <image id=\"image%.20g\" width=\"%.20g\" height=\"%.20g\" "
"x=\"%.20g\" y=\"%.20g\"\n xlink:href=\"data:image/png;base64,",
(double) image->scene,(double) image->columns,(double) image->rows,
(double) image->page.x,(double) image->page.y);
(void) WriteBlobString(image,message);
p=base64;
for (i=(ssize_t) encode_length; i > 0; i-=76)
{
(void) FormatLocaleString(message,MaxTextExtent,"%.76s",p);
(void) WriteBlobString(image,message);
p+=76;
if (i > 76)
(void) WriteBlobString(image,"\n");
}
(void) WriteBlobString(image,"\" />\n");
(void) WriteBlobString(image,"</svg>\n");
}
#endif
return(MagickTrue);
}
| 563 |
170,279 | 0 | void ComponentUpdaterPolicyTest::VerifyExpectations(bool update_disabled) {
EXPECT_EQ(1, post_interceptor_->GetHitCount())
<< post_interceptor_->GetRequestsAsString();
ASSERT_EQ(1, post_interceptor_->GetCount())
<< post_interceptor_->GetRequestsAsString();
EXPECT_NE(std::string::npos,
post_interceptor_->GetRequestBody(0).find(base::StringPrintf(
"<updatecheck%s/>",
update_disabled ? " updatedisabled=\"true\"" : "")));
}
| 564 |
145,514 | 0 | void ResourceDispatcherHostImpl::OnRenderViewHostCreated(int child_id,
int route_id) {
scheduler_->OnClientCreated(child_id, route_id);
}
| 565 |
162,425 | 0 | void Core::SetDefaultProcessErrorCallback(
const ProcessErrorCallback& callback) {
default_process_error_callback_ = callback;
}
| 566 |
52,628 | 0 | ppp_find_unit(struct ppp_net *pn, int unit)
{
return unit_find(&pn->units_idr, unit);
}
| 567 |
46,133 | 0 | SYSCALL_DEFINE0(vhangup)
{
if (capable(CAP_SYS_TTY_CONFIG)) {
tty_vhangup_self();
return 0;
}
return -EPERM;
}
| 568 |
12,572 | 0 | static void ne2000_ioport_write(void *opaque, uint32_t addr, uint32_t val)
{
NE2000State *s = opaque;
int offset, page, index;
addr &= 0xf;
#ifdef DEBUG_NE2000
printf("NE2000: write addr=0x%x val=0x%02x\n", addr, val);
#endif
if (addr == E8390_CMD) {
/* control register */
s->cmd = val;
if (!(val & E8390_STOP)) { /* START bit makes no sense on RTL8029... */
s->isr &= ~ENISR_RESET;
/* test specific case: zero length transfer */
if ((val & (E8390_RREAD | E8390_RWRITE)) &&
s->rcnt == 0) {
s->isr |= ENISR_RDC;
ne2000_update_irq(s);
}
if (val & E8390_TRANS) {
index = (s->tpsr << 8);
/* XXX: next 2 lines are a hack to make netware 3.11 work */
if (index >= NE2000_PMEM_END)
index -= NE2000_PMEM_SIZE;
/* fail safe: check range on the transmitted length */
if (index + s->tcnt <= NE2000_PMEM_END) {
qemu_send_packet(qemu_get_queue(s->nic), s->mem + index,
s->tcnt);
}
/* signal end of transfer */
s->tsr = ENTSR_PTX;
s->isr |= ENISR_TX;
s->cmd &= ~E8390_TRANS;
ne2000_update_irq(s);
}
}
} else {
page = s->cmd >> 6;
offset = addr | (page << 4);
switch(offset) {
case EN0_STARTPG:
if (val << 8 <= NE2000_PMEM_END) {
s->start = val << 8;
}
break;
case EN0_STOPPG:
if (val << 8 <= NE2000_PMEM_END) {
s->stop = val << 8;
}
break;
case EN0_BOUNDARY:
if (val << 8 < NE2000_PMEM_END) {
s->boundary = val;
}
break;
case EN0_IMR:
s->imr = val;
ne2000_update_irq(s);
break;
case EN0_TPSR:
s->tpsr = val;
break;
case EN0_TCNTLO:
s->tcnt = (s->tcnt & 0xff00) | val;
break;
case EN0_TCNTHI:
s->tcnt = (s->tcnt & 0x00ff) | (val << 8);
break;
case EN0_RSARLO:
s->rsar = (s->rsar & 0xff00) | val;
break;
case EN0_RSARHI:
s->rsar = (s->rsar & 0x00ff) | (val << 8);
break;
case EN0_RCNTLO:
s->rcnt = (s->rcnt & 0xff00) | val;
break;
case EN0_RCNTHI:
s->rcnt = (s->rcnt & 0x00ff) | (val << 8);
break;
case EN0_RXCR:
s->rxcr = val;
break;
case EN0_DCFG:
s->dcfg = val;
break;
case EN0_ISR:
s->isr &= ~(val & 0x7f);
ne2000_update_irq(s);
break;
case EN1_PHYS ... EN1_PHYS + 5:
s->phys[offset - EN1_PHYS] = val;
break;
case EN1_CURPAG:
if (val << 8 < NE2000_PMEM_END) {
s->curpag = val;
}
break;
case EN1_MULT ... EN1_MULT + 7:
s->mult[offset - EN1_MULT] = val;
break;
}
}
}
| 569 |
133,313 | 0 | PaletteTool::~PaletteTool() {}
| 570 |
83,089 | 0 | static u16 GetGifWord(struct ngiflib_img * i, struct ngiflib_decode_context * context) {
u16 r;
int bits_todo;
u16 newbyte;
bits_todo = (int)context->nbbit - (int)context->restbits;
if( bits_todo <= 0) { /* nbbit <= restbits */
r = context->lbyte;
context->restbits -= context->nbbit;
context->lbyte >>= context->nbbit;
} else if( bits_todo > 8 ) { /* nbbit > restbits + 8 */
if(context->restbyte >= 2) {
context->restbyte -= 2;
r = *context->srcbyte++;
} else {
if(context->restbyte == 0) {
context->restbyte = GetByte(i->parent);
#if defined(DEBUG) && !defined(NGIFLIB_NO_FILE)
if(i->parent->log) fprintf(i->parent->log, "restbyte = %02X\n", context->restbyte);
#endif /* defined(DEBUG) && !defined(NGIFLIB_NO_FILE) */
GetByteStr(i->parent, context->byte_buffer, context->restbyte);
context->srcbyte = context->byte_buffer;
}
r = *context->srcbyte++;
if(--context->restbyte == 0) {
context->restbyte = GetByte(i->parent);
#if defined(DEBUG) && !defined(NGIFLIB_NO_FILE)
if(i->parent->log) fprintf(i->parent->log, "restbyte = %02X\n", context->restbyte);
#endif /* defined(DEBUG) && !defined(NGIFLIB_NO_FILE) */
GetByteStr(i->parent, context->byte_buffer, context->restbyte);
context->srcbyte = context->byte_buffer;
}
context->restbyte--;
}
newbyte = *context->srcbyte++;
r |= newbyte << 8;
r = (r << context->restbits) | context->lbyte;
context->restbits = 16 - bits_todo;
context->lbyte = newbyte >> (bits_todo - 8);
} else /*if( bits_todo > 0 )*/ { /* nbbit > restbits */
if(context->restbyte == 0) {
context->restbyte = GetByte(i->parent);
#if defined(DEBUG) && !defined(NGIFLIB_NO_FILE)
if(i->parent->log) fprintf(i->parent->log, "restbyte = %02X\n", context->restbyte);
#endif /* defined(DEBUG) && !defined(NGIFLIB_NO_FILE) */
GetByteStr(i->parent, context->byte_buffer, context->restbyte);
context->srcbyte = context->byte_buffer;
}
newbyte = *context->srcbyte++;
context->restbyte--;
r = (newbyte << context->restbits) | context->lbyte;
context->restbits = 8 - bits_todo;
context->lbyte = newbyte >> bits_todo;
}
return (r & context->max); /* applique le bon masque pour eliminer les bits en trop */
}
| 571 |
79,274 | 0 | int TcpSessionPacketSsnReuse(const Packet *p, const Flow *f, const void *tcp_ssn)
{
if (p->proto == IPPROTO_TCP && p->tcph != NULL) {
if (TcpSessionPacketIsStreamStarter(p) == 1) {
if (TcpSessionReuseDoneEnough(p, f, tcp_ssn) == 1) {
return 1;
}
}
}
return 0;
}
| 572 |
33,874 | 0 | send_peer_reply(xmlNode * msg, xmlNode * result_diff, const char *originator, gboolean broadcast)
{
CRM_ASSERT(msg != NULL);
if (broadcast) {
/* this (successful) call modified the CIB _and_ the
* change needs to be broadcast...
* send via HA to other nodes
*/
int diff_add_updates = 0;
int diff_add_epoch = 0;
int diff_add_admin_epoch = 0;
int diff_del_updates = 0;
int diff_del_epoch = 0;
int diff_del_admin_epoch = 0;
const char *digest = NULL;
digest = crm_element_value(result_diff, XML_ATTR_DIGEST);
cib_diff_version_details(result_diff,
&diff_add_admin_epoch, &diff_add_epoch, &diff_add_updates,
&diff_del_admin_epoch, &diff_del_epoch, &diff_del_updates);
crm_trace("Sending update diff %d.%d.%d -> %d.%d.%d %s",
diff_del_admin_epoch, diff_del_epoch, diff_del_updates,
diff_add_admin_epoch, diff_add_epoch, diff_add_updates, digest);
crm_xml_add(msg, F_CIB_ISREPLY, originator);
crm_xml_add(msg, F_CIB_GLOBAL_UPDATE, XML_BOOLEAN_TRUE);
crm_xml_add(msg, F_CIB_OPERATION, CIB_OP_APPLY_DIFF);
CRM_ASSERT(digest != NULL);
add_message_xml(msg, F_CIB_UPDATE_DIFF, result_diff);
crm_log_xml_trace(msg, "copy");
return send_cluster_message(NULL, crm_msg_cib, msg, TRUE);
} else if (originator != NULL) {
/* send reply via HA to originating node */
crm_trace("Sending request result to originator only");
crm_xml_add(msg, F_CIB_ISREPLY, originator);
return send_cluster_message(crm_get_peer(0, originator), crm_msg_cib, msg, FALSE);
}
return FALSE;
}
| 573 |
60,108 | 0 | R_API RList *r_bin_classes_from_symbols (RBinFile *bf, RBinObject *o) {
RBinSymbol *sym;
RListIter *iter;
RList *symbols = o->symbols;
RList *classes = o->classes;
if (!classes) {
classes = r_list_newf ((RListFree)r_bin_class_free);
}
r_list_foreach (symbols, iter, sym) {
if (sym->name[0] != '_') {
continue;
}
const char *cn = sym->classname;
if (cn) {
RBinClass *c = r_bin_class_new (bf, sym->classname, NULL, 0);
if (!c) {
continue;
}
char *dn = sym->dname;
char *fn = swiftField (dn, cn);
if (fn) {
RBinField *f = r_bin_field_new (sym->paddr, sym->vaddr, sym->size, fn, NULL, NULL);
r_list_append (c->fields, f);
free (fn);
} else {
char *mn = strstr (dn, "..");
if (mn) {
} else {
char *mn = strstr (dn, cn);
if (mn && mn[strlen(cn)] == '.') {
mn += strlen (cn) + 1;
r_list_append (c->methods, sym);
}
}
}
}
}
if (r_list_empty (classes)) {
r_list_free (classes);
return NULL;
}
return classes;
}
| 574 |
90,084 | 0 | size_t ZSTD_initCStream_usingCDict(ZSTD_CStream* zcs, const ZSTD_CDict* cdict)
{
ZSTD_frameParameters const fParams = { 0 /* contentSizeFlag */, 0 /* checksum */, 0 /* hideDictID */ };
DEBUGLOG(4, "ZSTD_initCStream_usingCDict");
return ZSTD_initCStream_usingCDict_advanced(zcs, cdict, fParams, ZSTD_CONTENTSIZE_UNKNOWN); /* note : will check that cdict != NULL */
}
| 575 |
110,316 | 0 | NaClSubprocess* Plugin::LoadHelperNaClModule(nacl::DescWrapper* wrapper,
const Manifest* manifest,
ErrorInfo* error_info) {
nacl::scoped_ptr<NaClSubprocess> nacl_subprocess(
new NaClSubprocess("helper module", NULL, NULL));
if (NULL == nacl_subprocess.get()) {
error_info->SetReport(ERROR_SEL_LDR_INIT,
"unable to allocate helper subprocess.");
return NULL;
}
if (!LoadNaClModuleCommon(wrapper, nacl_subprocess.get(), manifest,
false, error_info,
pp::BlockUntilComplete(),
pp::BlockUntilComplete())) {
return NULL;
}
if (!nacl_subprocess->StartSrpcServices()) {
error_info->SetReport(ERROR_SRPC_CONNECTION_FAIL,
"SRPC connection failure for " +
nacl_subprocess->description());
return NULL;
}
PLUGIN_PRINTF(("Plugin::LoadHelperNaClModule (%s)\n",
nacl_subprocess.get()->detailed_description().c_str()));
return nacl_subprocess.release();
}
| 576 |
26,959 | 0 | static int do_recv_NPByteRange(rpc_message_t *message, void *p_value)
{
NPByteRange **rangeListPtr = (NPByteRange **)p_value;
if (rangeListPtr == NULL)
return RPC_ERROR_MESSAGE_ARGUMENT_INVALID;
*rangeListPtr = NULL;
for (;;) {
int error;
uint32_t cont;
if ((error = rpc_message_recv_uint32(message, &cont)) < 0)
return error;
if (!cont)
break;
NPByteRange *range = malloc(sizeof(*range));
if (range == NULL)
return RPC_ERROR_NO_MEMORY;
range->next = NULL;
if ((error = rpc_message_recv_int32(message, &range->offset)) < 0)
return error;
if ((error = rpc_message_recv_uint32(message, &range->length)) < 0)
return error;
*rangeListPtr = range;
rangeListPtr = &range->next;
}
return RPC_ERROR_NO_ERROR;
}
| 577 |
47,780 | 0 | void _snd_pcm_hw_param_setempty(struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var)
{
if (hw_is_mask(var)) {
snd_mask_none(hw_param_mask(params, var));
params->cmask |= 1 << var;
params->rmask |= 1 << var;
} else if (hw_is_interval(var)) {
snd_interval_none(hw_param_interval(params, var));
params->cmask |= 1 << var;
params->rmask |= 1 << var;
} else {
snd_BUG();
}
}
| 578 |
121,527 | 0 | void TabsCaptureVisibleTabFunction::SendResultFromBitmap(
const SkBitmap& screen_capture) {
std::vector<unsigned char> data;
SkAutoLockPixels screen_capture_lock(screen_capture);
bool encoded = false;
std::string mime_type;
switch (image_format_) {
case FORMAT_JPEG:
encoded = gfx::JPEGCodec::Encode(
reinterpret_cast<unsigned char*>(screen_capture.getAddr32(0, 0)),
gfx::JPEGCodec::FORMAT_SkBitmap,
screen_capture.width(),
screen_capture.height(),
static_cast<int>(screen_capture.rowBytes()),
image_quality_,
&data);
mime_type = keys::kMimeTypeJpeg;
break;
case FORMAT_PNG:
encoded = gfx::PNGCodec::EncodeBGRASkBitmap(
screen_capture,
true, // Discard transparency.
&data);
mime_type = keys::kMimeTypePng;
break;
default:
NOTREACHED() << "Invalid image format.";
}
if (!encoded) {
error_ = keys::kInternalVisibleTabCaptureError;
SendResponse(false);
return;
}
std::string base64_result;
base::StringPiece stream_as_string(
reinterpret_cast<const char*>(vector_as_array(&data)), data.size());
base::Base64Encode(stream_as_string, &base64_result);
base64_result.insert(0, base::StringPrintf("data:%s;base64,",
mime_type.c_str()));
SetResult(new StringValue(base64_result));
SendResponse(true);
}
| 579 |
49,322 | 0 | static void fwnet_fifo_stop(struct fwnet_device *dev)
{
if (dev->local_fifo == FWNET_NO_FIFO_ADDR)
return;
fw_core_remove_address_handler(&dev->handler);
dev->local_fifo = FWNET_NO_FIFO_ADDR;
}
| 580 |
3,702 | 0 | static void lsi_soft_reset(LSIState *s)
{
trace_lsi_reset();
s->carry = 0;
s->msg_action = LSI_MSG_ACTION_COMMAND;
s->msg_len = 0;
s->waiting = LSI_NOWAIT;
s->dsa = 0;
s->dnad = 0;
s->dbc = 0;
s->temp = 0;
memset(s->scratch, 0, sizeof(s->scratch));
s->istat0 = 0;
s->istat1 = 0;
s->dcmd = 0x40;
s->dstat = 0;
s->dien = 0;
s->sist0 = 0;
s->sist1 = 0;
s->sien0 = 0;
s->sien1 = 0;
s->mbox0 = 0;
s->mbox1 = 0;
s->dfifo = 0;
s->ctest2 = LSI_CTEST2_DACK;
s->ctest3 = 0;
s->ctest4 = 0;
s->ctest5 = 0;
s->ccntl0 = 0;
s->ccntl1 = 0;
s->dsp = 0;
s->dsps = 0;
s->dmode = 0;
s->dcntl = 0;
s->scntl0 = 0xc0;
s->scntl1 = 0;
s->scntl2 = 0;
s->scntl3 = 0;
s->sstat0 = 0;
s->sstat1 = 0;
s->scid = 7;
s->sxfer = 0;
s->socl = 0;
s->sdid = 0;
s->ssid = 0;
s->sbcl = 0;
s->stest1 = 0;
s->stest2 = 0;
s->stest3 = 0;
s->sidl = 0;
s->stime0 = 0;
s->respid0 = 0x80;
s->respid1 = 0;
s->mmrs = 0;
s->mmws = 0;
s->sfs = 0;
s->drs = 0;
s->sbms = 0;
s->dbms = 0;
s->dnad64 = 0;
s->pmjad1 = 0;
s->pmjad2 = 0;
s->rbc = 0;
s->ua = 0;
s->ia = 0;
s->sbc = 0;
s->csbc = 0;
s->sbr = 0;
assert(QTAILQ_EMPTY(&s->queue));
assert(!s->current);
}
| 581 |
28,536 | 0 | static void qeth_create_qib_param_field_blkt(struct qeth_card *card,
char *param_field)
{
param_field[16] = _ascebc['B'];
param_field[17] = _ascebc['L'];
param_field[18] = _ascebc['K'];
param_field[19] = _ascebc['T'];
*((unsigned int *) (¶m_field[20])) = card->info.blkt.time_total;
*((unsigned int *) (¶m_field[24])) = card->info.blkt.inter_packet;
*((unsigned int *) (¶m_field[28])) =
card->info.blkt.inter_packet_jumbo;
}
| 582 |
44,820 | 0 | local void outb_check(void *dummy)
{
size_t len;
(void)dummy;
Trace(("-- launched decompress check thread"));
do {
possess(outb_check_more);
wait_for(outb_check_more, TO_BE, 1);
len = out_len;
g.out_check = CHECK(g.out_check, out_copy, len);
Trace(("-- decompress checked %lu bytes", len));
twist(outb_check_more, TO, 0);
} while (len);
Trace(("-- exited decompress check thread"));
}
| 583 |
78,244 | 0 | static int cac_match_card(sc_card_t *card)
{
int r;
SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE);
/* Since we send an APDU, the card's logout function may be called...
* however it may be in dirty memory */
card->ops->logout = NULL;
r = cac_find_and_initialize(card, 0);
return (r == SC_SUCCESS); /* never match */
}
| 584 |
68,681 | 0 | send_disable_carbons(void **state)
{
prof_input("/carbons on");
prof_connect();
prof_input("/carbons off");
assert_true(stbbr_received(
"<iq id='*' type='set'><disable xmlns='urn:xmpp:carbons:2'/></iq>"
));
}
| 585 |
139,644 | 0 | ScriptProcessorNode* AudioContext::createScriptProcessor(ExceptionState& exceptionState)
{
return createScriptProcessor(0, 2, 2, exceptionState);
}
| 586 |
141,373 | 0 | const AtomicString& Document::vlinkColor() const {
return BodyAttributeValue(kVlinkAttr);
}
| 587 |
169,021 | 0 | void OfflinePageModelTaskified::OnTaskQueueIsIdle() {}
| 588 |
108,975 | 0 | void RenderViewImpl::OnSetEditableSelectionOffsets(int start, int end) {
webview()->setEditableSelectionOffsets(start, end);
}
| 589 |
172,054 | 0 | static rfc_slot_t *find_rfc_slot_by_pending_sdp(void) {
uint32_t min_id = UINT32_MAX;
int slot = -1;
for (size_t i = 0; i < ARRAY_SIZE(rfc_slots); ++i)
if (rfc_slots[i].id && rfc_slots[i].f.pending_sdp_request && rfc_slots[i].id < min_id) {
min_id = rfc_slots[i].id;
slot = i;
}
return (slot == -1) ? NULL : &rfc_slots[slot];
}
| 590 |
34,078 | 0 | static struct dentry *udf_fh_to_dentry(struct super_block *sb,
struct fid *fid, int fh_len, int fh_type)
{
if ((fh_len != 3 && fh_len != 5) ||
(fh_type != FILEID_UDF_WITH_PARENT &&
fh_type != FILEID_UDF_WITHOUT_PARENT))
return NULL;
return udf_nfs_get_inode(sb, fid->udf.block, fid->udf.partref,
fid->udf.generation);
}
| 591 |
171,615 | 0 | ssize_t utf8_to_utf16_length(const uint8_t* u8str, size_t u8len)
{
const uint8_t* const u8end = u8str + u8len;
const uint8_t* u8cur = u8str;
/* Validate that the UTF-8 is the correct len */
size_t u16measuredLen = 0;
while (u8cur < u8end) {
u16measuredLen++;
int u8charLen = utf8_codepoint_len(*u8cur);
uint32_t codepoint = utf8_to_utf32_codepoint(u8cur, u8charLen);
if (codepoint > 0xFFFF) u16measuredLen++; // this will be a surrogate pair in utf16
u8cur += u8charLen;
}
/**
* Make sure that we ended where we thought we would and the output UTF-16
* will be exactly how long we were told it would be.
*/
if (u8cur != u8end) {
return -1;
}
return u16measuredLen;
}
| 592 |
46,400 | 0 | static void wakeup_pipe_readers(struct pipe_inode_info *pipe)
{
smp_mb();
if (waitqueue_active(&pipe->wait))
wake_up_interruptible(&pipe->wait);
kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
}
| 593 |
97,424 | 0 | bool FrameLoader::isHostedByObjectElement() const
{
HTMLFrameOwnerElement* owner = m_frame->ownerElement();
return owner && owner->hasTagName(objectTag);
}
| 594 |
47,812 | 0 | int snd_pcm_hw_constraint_ranges(struct snd_pcm_runtime *runtime,
unsigned int cond,
snd_pcm_hw_param_t var,
const struct snd_pcm_hw_constraint_ranges *r)
{
return snd_pcm_hw_rule_add(runtime, cond, var,
snd_pcm_hw_rule_ranges, (void *)r,
var, -1);
}
| 595 |
45,186 | 0 | int ssl3_send_server_hello(SSL *s)
{
unsigned char *buf;
unsigned char *p,*d;
int i,sl;
int al = 0;
unsigned long l;
if (s->state == SSL3_ST_SW_SRVR_HELLO_A)
{
buf=(unsigned char *)s->init_buf->data;
#ifdef OPENSSL_NO_TLSEXT
p=s->s3->server_random;
if (ssl_fill_hello_random(s, 1, p, SSL3_RANDOM_SIZE) <= 0)
return -1;
#endif
/* Do the message type and length last */
d=p= ssl_handshake_start(s);
*(p++)=s->version>>8;
*(p++)=s->version&0xff;
/* Random stuff */
memcpy(p,s->s3->server_random,SSL3_RANDOM_SIZE);
p+=SSL3_RANDOM_SIZE;
/*-
* There are several cases for the session ID to send
* back in the server hello:
* - For session reuse from the session cache,
* we send back the old session ID.
* - If stateless session reuse (using a session ticket)
* is successful, we send back the client's "session ID"
* (which doesn't actually identify the session).
* - If it is a new session, we send back the new
* session ID.
* - However, if we want the new session to be single-use,
* we send back a 0-length session ID.
* s->hit is non-zero in either case of session reuse,
* so the following won't overwrite an ID that we're supposed
* to send back.
*/
if (s->session->not_resumable ||
(!(s->ctx->session_cache_mode & SSL_SESS_CACHE_SERVER)
&& !s->hit))
s->session->session_id_length=0;
sl=s->session->session_id_length;
if (sl > (int)sizeof(s->session->session_id))
{
SSLerr(SSL_F_SSL3_SEND_SERVER_HELLO, ERR_R_INTERNAL_ERROR);
return -1;
}
*(p++)=sl;
memcpy(p,s->session->session_id,sl);
p+=sl;
/* put the cipher */
i=ssl3_put_cipher_by_char(s->s3->tmp.new_cipher,p);
p+=i;
/* put the compression method */
#ifdef OPENSSL_NO_COMP
*(p++)=0;
#else
if (s->s3->tmp.new_compression == NULL)
*(p++)=0;
else
*(p++)=s->s3->tmp.new_compression->id;
#endif
#ifndef OPENSSL_NO_TLSEXT
if (ssl_prepare_serverhello_tlsext(s) <= 0)
{
SSLerr(SSL_F_SSL3_SEND_SERVER_HELLO,SSL_R_SERVERHELLO_TLSEXT);
return -1;
}
if ((p = ssl_add_serverhello_tlsext(s, p, buf+SSL3_RT_MAX_PLAIN_LENGTH, &al)) == NULL)
{
ssl3_send_alert(s, SSL3_AL_FATAL, al);
SSLerr(SSL_F_SSL3_SEND_SERVER_HELLO,ERR_R_INTERNAL_ERROR);
return -1;
}
#endif
/* do the header */
l=(p-d);
ssl_set_handshake_header(s, SSL3_MT_SERVER_HELLO, l);
s->state=SSL3_ST_SW_SRVR_HELLO_B;
}
/* SSL3_ST_SW_SRVR_HELLO_B */
return ssl_do_write(s);
}
| 596 |
74,451 | 0 | static int _regulator_do_disable(struct regulator_dev *rdev)
{
int ret;
trace_regulator_disable(rdev_get_name(rdev));
if (rdev->ena_pin) {
ret = regulator_ena_gpio_ctrl(rdev, false);
if (ret < 0)
return ret;
rdev->ena_gpio_state = 0;
} else if (rdev->desc->ops->disable) {
ret = rdev->desc->ops->disable(rdev);
if (ret != 0)
return ret;
}
/* cares about last_off_jiffy only if off_on_delay is required by
* device.
*/
if (rdev->desc->off_on_delay)
rdev->last_off_jiffy = jiffies;
trace_regulator_disable_complete(rdev_get_name(rdev));
return 0;
}
| 597 |
66,847 | 0 | nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p,
struct nfsd3_readdirargs *args)
{
p = decode_fh(p, &args->fh);
if (!p)
return 0;
p = xdr_decode_hyper(p, &args->cookie);
args->verf = p; p += 2;
args->dircount = ~0;
args->count = ntohl(*p++);
args->count = min_t(u32, args->count, PAGE_SIZE);
args->buffer = page_address(*(rqstp->rq_next_page++));
return xdr_argsize_check(rqstp, p);
}
| 598 |
20,570 | 0 | long ia64_pal_vp_create(u64 *vpd, u64 *host_iva, u64 *opt_handler)
{
struct ia64_pal_retval iprv;
PAL_CALL_STK(iprv, PAL_VP_CREATE, (u64)vpd, (u64)host_iva,
(u64)opt_handler);
return iprv.status;
}
| 599 |
Subsets and Splits