unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
172,308 | 0 | static void onScanEvent(wifi_scan_event event, unsigned status) {
JNIHelper helper(mVM);
helper.reportEvent(mCls, "onScanStatus", "(I)V", event);
}
| 18,000 |
97,187 | 0 | void WebFrameLoaderClient::dispatchDidFinishLoad() {
OwnPtr<WebPluginLoadObserver> plugin_load_observer = GetPluginLoadObserver();
if (webframe_->client())
webframe_->client()->didFinishLoad(webframe_);
if (plugin_load_observer)
plugin_load_observer->didFinishLoading();
}
| 18,001 |
139,580 | 0 | RenderMediaClient* RenderMediaClient::GetInstance() {
static RenderMediaClient* client = new RenderMediaClient();
return client;
}
| 18,002 |
42,155 | 0 | mm_pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, size_t namebuflen)
{
Buffer m;
char *p, *msg;
int success = 0, tmp1 = -1, tmp2 = -1;
/* Kludge: ensure there are fds free to receive the pty/tty */
if ((tmp1 = dup(pmonitor->m_recvfd)) == -1 ||
(tmp2 = dup(pmonitor->m_recvfd)) == -1) {
error("%s: cannot allocate fds for pty", __func__);
if (tmp1 > 0)
close(tmp1);
if (tmp2 > 0)
close(tmp2);
return 0;
}
close(tmp1);
close(tmp2);
buffer_init(&m);
mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_PTY, &m);
debug3("%s: waiting for MONITOR_ANS_PTY", __func__);
mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_PTY, &m);
success = buffer_get_int(&m);
if (success == 0) {
debug3("%s: pty alloc failed", __func__);
buffer_free(&m);
return (0);
}
p = buffer_get_string(&m, NULL);
msg = buffer_get_string(&m, NULL);
buffer_free(&m);
strlcpy(namebuf, p, namebuflen); /* Possible truncation */
free(p);
buffer_append(&loginmsg, msg, strlen(msg));
free(msg);
if ((*ptyfd = mm_receive_fd(pmonitor->m_recvfd)) == -1 ||
(*ttyfd = mm_receive_fd(pmonitor->m_recvfd)) == -1)
fatal("%s: receive fds failed", __func__);
/* Success */
return (1);
}
| 18,003 |
88,143 | 0 | int smb311_posix_mkdir(const unsigned int xid, struct inode *inode,
umode_t mode, struct cifs_tcon *tcon,
const char *full_path,
struct cifs_sb_info *cifs_sb)
{
struct smb_rqst rqst;
struct smb2_create_req *req;
struct smb2_create_rsp *rsp = NULL;
struct cifs_ses *ses = tcon->ses;
struct kvec iov[3]; /* make sure at least one for each open context */
struct kvec rsp_iov = {NULL, 0};
int resp_buftype;
int uni_path_len;
__le16 *copy_path = NULL;
int copy_size;
int rc = 0;
unsigned int n_iov = 2;
__u32 file_attributes = 0;
char *pc_buf = NULL;
int flags = 0;
unsigned int total_len;
__le16 *utf16_path = NULL;
cifs_dbg(FYI, "mkdir\n");
/* resource #1: path allocation */
utf16_path = cifs_convert_path_to_utf16(full_path, cifs_sb);
if (!utf16_path)
return -ENOMEM;
if (!ses || !(ses->server)) {
rc = -EIO;
goto err_free_path;
}
/* resource #2: request */
rc = smb2_plain_req_init(SMB2_CREATE, tcon, (void **) &req, &total_len);
if (rc)
goto err_free_path;
if (smb3_encryption_required(tcon))
flags |= CIFS_TRANSFORM_REQ;
req->ImpersonationLevel = IL_IMPERSONATION;
req->DesiredAccess = cpu_to_le32(FILE_WRITE_ATTRIBUTES);
/* File attributes ignored on open (used in create though) */
req->FileAttributes = cpu_to_le32(file_attributes);
req->ShareAccess = FILE_SHARE_ALL_LE;
req->CreateDisposition = cpu_to_le32(FILE_CREATE);
req->CreateOptions = cpu_to_le32(CREATE_NOT_FILE);
iov[0].iov_base = (char *)req;
/* -1 since last byte is buf[0] which is sent below (path) */
iov[0].iov_len = total_len - 1;
req->NameOffset = cpu_to_le16(sizeof(struct smb2_create_req));
/* [MS-SMB2] 2.2.13 NameOffset:
* If SMB2_FLAGS_DFS_OPERATIONS is set in the Flags field of
* the SMB2 header, the file name includes a prefix that will
* be processed during DFS name normalization as specified in
* section 3.3.5.9. Otherwise, the file name is relative to
* the share that is identified by the TreeId in the SMB2
* header.
*/
if (tcon->share_flags & SHI1005_FLAGS_DFS) {
int name_len;
req->sync_hdr.Flags |= SMB2_FLAGS_DFS_OPERATIONS;
rc = alloc_path_with_tree_prefix(©_path, ©_size,
&name_len,
tcon->treeName, utf16_path);
if (rc)
goto err_free_req;
req->NameLength = cpu_to_le16(name_len * 2);
uni_path_len = copy_size;
/* free before overwriting resource */
kfree(utf16_path);
utf16_path = copy_path;
} else {
uni_path_len = (2 * UniStrnlen((wchar_t *)utf16_path, PATH_MAX)) + 2;
/* MUST set path len (NameLength) to 0 opening root of share */
req->NameLength = cpu_to_le16(uni_path_len - 2);
if (uni_path_len % 8 != 0) {
copy_size = roundup(uni_path_len, 8);
copy_path = kzalloc(copy_size, GFP_KERNEL);
if (!copy_path) {
rc = -ENOMEM;
goto err_free_req;
}
memcpy((char *)copy_path, (const char *)utf16_path,
uni_path_len);
uni_path_len = copy_size;
/* free before overwriting resource */
kfree(utf16_path);
utf16_path = copy_path;
}
}
iov[1].iov_len = uni_path_len;
iov[1].iov_base = utf16_path;
req->RequestedOplockLevel = SMB2_OPLOCK_LEVEL_NONE;
if (tcon->posix_extensions) {
/* resource #3: posix buf */
rc = add_posix_context(iov, &n_iov, mode);
if (rc)
goto err_free_req;
pc_buf = iov[n_iov-1].iov_base;
}
memset(&rqst, 0, sizeof(struct smb_rqst));
rqst.rq_iov = iov;
rqst.rq_nvec = n_iov;
trace_smb3_posix_mkdir_enter(xid, tcon->tid, ses->Suid, CREATE_NOT_FILE,
FILE_WRITE_ATTRIBUTES);
/* resource #4: response buffer */
rc = cifs_send_recv(xid, ses, &rqst, &resp_buftype, flags, &rsp_iov);
if (rc) {
cifs_stats_fail_inc(tcon, SMB2_CREATE_HE);
trace_smb3_posix_mkdir_err(xid, tcon->tid, ses->Suid,
CREATE_NOT_FILE,
FILE_WRITE_ATTRIBUTES, rc);
goto err_free_rsp_buf;
}
rsp = (struct smb2_create_rsp *)rsp_iov.iov_base;
trace_smb3_posix_mkdir_done(xid, rsp->PersistentFileId, tcon->tid,
ses->Suid, CREATE_NOT_FILE,
FILE_WRITE_ATTRIBUTES);
SMB2_close(xid, tcon, rsp->PersistentFileId, rsp->VolatileFileId);
/* Eventually save off posix specific response info and timestaps */
err_free_rsp_buf:
free_rsp_buf(resp_buftype, rsp);
kfree(pc_buf);
err_free_req:
cifs_small_buf_release(req);
err_free_path:
kfree(utf16_path);
return rc;
}
| 18,004 |
135,894 | 0 | void TextTrack::setMode(const AtomicString& mode) {
DCHECK(mode == DisabledKeyword() || mode == HiddenKeyword() ||
mode == ShowingKeyword());
if (mode_ == mode)
return;
if (cues_ && GetCueTimeline()) {
if (mode == DisabledKeyword())
GetCueTimeline()->RemoveCues(this, cues_.Get());
else if (mode != ShowingKeyword())
GetCueTimeline()->HideCues(this, cues_.Get());
}
mode_ = mode;
if (mode != DisabledKeyword() && GetReadinessState() == kLoaded) {
if (cues_ && GetCueTimeline())
GetCueTimeline()->AddCues(this, cues_.Get());
}
if (MediaElement())
MediaElement()->TextTrackModeChanged(this);
}
| 18,005 |
73,566 | 0 | static Image *ExtractPostscript(Image *image,const ImageInfo *image_info,
MagickOffsetType PS_Offset,ssize_t PS_Size,ExceptionInfo *exception)
{
char
postscript_file[MagickPathExtent];
const MagicInfo
*magic_info;
FILE
*ps_file;
ImageInfo
*clone_info;
Image
*image2;
unsigned char
magick[2*MagickPathExtent];
if ((clone_info=CloneImageInfo(image_info)) == NULL)
return(image);
clone_info->blob=(void *) NULL;
clone_info->length=0;
/* Obtain temporary file */
(void) AcquireUniqueFilename(postscript_file);
ps_file=fopen_utf8(postscript_file,"wb");
if (ps_file == (FILE *) NULL)
goto FINISH;
/* Copy postscript to temporary file */
(void) SeekBlob(image,PS_Offset,SEEK_SET);
(void) ReadBlob(image, 2*MagickPathExtent, magick);
(void) SeekBlob(image,PS_Offset,SEEK_SET);
while(PS_Size-- > 0)
{
(void) fputc(ReadBlobByte(image),ps_file);
}
(void) fclose(ps_file);
/* Detect file format - Check magic.mgk configuration file. */
magic_info=GetMagicInfo(magick,2*MagickPathExtent,exception);
if(magic_info == (const MagicInfo *) NULL) goto FINISH_UNL;
/* printf("Detected:%s \n",magic_info->name); */
if(exception->severity != UndefinedException) goto FINISH_UNL;
if(magic_info->name == (char *) NULL) goto FINISH_UNL;
(void) strncpy(clone_info->magick,magic_info->name,MagickPathExtent);
/* Read nested image */
/*FormatString(clone_info->filename,"%s:%s",magic_info->name,postscript_file);*/
FormatLocaleString(clone_info->filename,MagickPathExtent,"%s",postscript_file);
image2=ReadImage(clone_info,exception);
if (!image2)
goto FINISH_UNL;
/*
Replace current image with new image while copying base image
attributes.
*/
(void) CopyMagickMemory(image2->filename,image->filename,MagickPathExtent);
(void) CopyMagickMemory(image2->magick_filename,image->magick_filename,MagickPathExtent);
(void) CopyMagickMemory(image2->magick,image->magick,MagickPathExtent);
image2->depth=image->depth;
DestroyBlob(image2);
image2->blob=ReferenceBlob(image->blob);
if ((image->rows == 0) || (image->columns == 0))
DeleteImageFromList(&image);
AppendImageToList(&image,image2);
FINISH_UNL:
(void) RelinquishUniqueFileResource(postscript_file);
FINISH:
DestroyImageInfo(clone_info);
return(image);
}
| 18,006 |
146,298 | 0 | WebGLRenderingContextBaseMap& ForciblyEvictedContexts() {
DEFINE_THREAD_SAFE_STATIC_LOCAL(ThreadSpecific<WebGLRenderingContextBaseMap>,
forcibly_evicted_contexts, ());
if (!forcibly_evicted_contexts.IsSet())
forcibly_evicted_contexts->RegisterAsStaticReference();
return *forcibly_evicted_contexts;
}
| 18,007 |
90,333 | 0 | megasas_fire_cmd_gen2(struct megasas_instance *instance,
dma_addr_t frame_phys_addr,
u32 frame_count,
struct megasas_register_set __iomem *regs)
{
unsigned long flags;
spin_lock_irqsave(&instance->hba_lock, flags);
writel((frame_phys_addr | (frame_count<<1))|1,
&(regs)->inbound_queue_port);
spin_unlock_irqrestore(&instance->hba_lock, flags);
}
| 18,008 |
92,319 | 0 | epilogProcessor(XML_Parser parser,
const char *s,
const char *end,
const char **nextPtr)
{
parser->m_processor = epilogProcessor;
parser->m_eventPtr = s;
for (;;) {
const char *next = NULL;
int tok = XmlPrologTok(parser->m_encoding, s, end, &next);
parser->m_eventEndPtr = next;
switch (tok) {
/* report partial linebreak - it might be the last token */
case -XML_TOK_PROLOG_S:
if (parser->m_defaultHandler) {
reportDefault(parser, parser->m_encoding, s, next);
if (parser->m_parsingStatus.parsing == XML_FINISHED)
return XML_ERROR_ABORTED;
}
*nextPtr = next;
return XML_ERROR_NONE;
case XML_TOK_NONE:
*nextPtr = s;
return XML_ERROR_NONE;
case XML_TOK_PROLOG_S:
if (parser->m_defaultHandler)
reportDefault(parser, parser->m_encoding, s, next);
break;
case XML_TOK_PI:
if (!reportProcessingInstruction(parser, parser->m_encoding, s, next))
return XML_ERROR_NO_MEMORY;
break;
case XML_TOK_COMMENT:
if (!reportComment(parser, parser->m_encoding, s, next))
return XML_ERROR_NO_MEMORY;
break;
case XML_TOK_INVALID:
parser->m_eventPtr = next;
return XML_ERROR_INVALID_TOKEN;
case XML_TOK_PARTIAL:
if (!parser->m_parsingStatus.finalBuffer) {
*nextPtr = s;
return XML_ERROR_NONE;
}
return XML_ERROR_UNCLOSED_TOKEN;
case XML_TOK_PARTIAL_CHAR:
if (!parser->m_parsingStatus.finalBuffer) {
*nextPtr = s;
return XML_ERROR_NONE;
}
return XML_ERROR_PARTIAL_CHAR;
default:
return XML_ERROR_JUNK_AFTER_DOC_ELEMENT;
}
parser->m_eventPtr = s = next;
switch (parser->m_parsingStatus.parsing) {
case XML_SUSPENDED:
*nextPtr = next;
return XML_ERROR_NONE;
case XML_FINISHED:
return XML_ERROR_ABORTED;
default: ;
}
}
}
| 18,009 |
27,598 | 0 | static int alloc_voice(int dev, int chn, int note)
{
unsigned short key;
int voice;
key = (chn << 8) | (note + 1);
voice = synth_devs[dev]->alloc_voice(dev, chn, note,
&synth_devs[dev]->alloc);
synth_devs[dev]->alloc.map[voice] = key;
synth_devs[dev]->alloc.alloc_times[voice] =
synth_devs[dev]->alloc.timestamp++;
return voice;
}
| 18,010 |
81,775 | 0 | static void mpeg4_encode_vol_header(MpegEncContext *s,
int vo_number,
int vol_number)
{
int vo_ver_id;
if (!CONFIG_MPEG4_ENCODER)
return;
if (s->max_b_frames || s->quarter_sample) {
vo_ver_id = 5;
s->vo_type = ADV_SIMPLE_VO_TYPE;
} else {
vo_ver_id = 1;
s->vo_type = SIMPLE_VO_TYPE;
}
put_bits(&s->pb, 16, 0);
put_bits(&s->pb, 16, 0x100 + vo_number); /* video obj */
put_bits(&s->pb, 16, 0);
put_bits(&s->pb, 16, 0x120 + vol_number); /* video obj layer */
put_bits(&s->pb, 1, 0); /* random access vol */
put_bits(&s->pb, 8, s->vo_type); /* video obj type indication */
if (s->workaround_bugs & FF_BUG_MS) {
put_bits(&s->pb, 1, 0); /* is obj layer id= no */
} else {
put_bits(&s->pb, 1, 1); /* is obj layer id= yes */
put_bits(&s->pb, 4, vo_ver_id); /* is obj layer ver id */
put_bits(&s->pb, 3, 1); /* is obj layer priority */
}
s->aspect_ratio_info = ff_h263_aspect_to_info(s->avctx->sample_aspect_ratio);
put_bits(&s->pb, 4, s->aspect_ratio_info); /* aspect ratio info */
if (s->aspect_ratio_info == FF_ASPECT_EXTENDED) {
av_reduce(&s->avctx->sample_aspect_ratio.num, &s->avctx->sample_aspect_ratio.den,
s->avctx->sample_aspect_ratio.num, s->avctx->sample_aspect_ratio.den, 255);
put_bits(&s->pb, 8, s->avctx->sample_aspect_ratio.num);
put_bits(&s->pb, 8, s->avctx->sample_aspect_ratio.den);
}
if (s->workaround_bugs & FF_BUG_MS) {
put_bits(&s->pb, 1, 0); /* vol control parameters= no @@@ */
} else {
put_bits(&s->pb, 1, 1); /* vol control parameters= yes */
put_bits(&s->pb, 2, 1); /* chroma format YUV 420/YV12 */
put_bits(&s->pb, 1, s->low_delay);
put_bits(&s->pb, 1, 0); /* vbv parameters= no */
}
put_bits(&s->pb, 2, RECT_SHAPE); /* vol shape= rectangle */
put_bits(&s->pb, 1, 1); /* marker bit */
put_bits(&s->pb, 16, s->avctx->time_base.den);
if (s->time_increment_bits < 1)
s->time_increment_bits = 1;
put_bits(&s->pb, 1, 1); /* marker bit */
put_bits(&s->pb, 1, 0); /* fixed vop rate=no */
put_bits(&s->pb, 1, 1); /* marker bit */
put_bits(&s->pb, 13, s->width); /* vol width */
put_bits(&s->pb, 1, 1); /* marker bit */
put_bits(&s->pb, 13, s->height); /* vol height */
put_bits(&s->pb, 1, 1); /* marker bit */
put_bits(&s->pb, 1, s->progressive_sequence ? 0 : 1);
put_bits(&s->pb, 1, 1); /* obmc disable */
if (vo_ver_id == 1)
put_bits(&s->pb, 1, 0); /* sprite enable */
else
put_bits(&s->pb, 2, 0); /* sprite enable */
put_bits(&s->pb, 1, 0); /* not 8 bit == false */
put_bits(&s->pb, 1, s->mpeg_quant); /* quant type = (0 = H.263 style) */
if (s->mpeg_quant) {
ff_write_quant_matrix(&s->pb, s->avctx->intra_matrix);
ff_write_quant_matrix(&s->pb, s->avctx->inter_matrix);
}
if (vo_ver_id != 1)
put_bits(&s->pb, 1, s->quarter_sample);
put_bits(&s->pb, 1, 1); /* complexity estimation disable */
put_bits(&s->pb, 1, s->rtp_mode ? 0 : 1); /* resync marker disable */
put_bits(&s->pb, 1, s->data_partitioning ? 1 : 0);
if (s->data_partitioning)
put_bits(&s->pb, 1, 0); /* no rvlc */
if (vo_ver_id != 1) {
put_bits(&s->pb, 1, 0); /* newpred */
put_bits(&s->pb, 1, 0); /* reduced res vop */
}
put_bits(&s->pb, 1, 0); /* scalability */
ff_mpeg4_stuffing(&s->pb);
/* user data */
if (!(s->avctx->flags & AV_CODEC_FLAG_BITEXACT)) {
put_bits(&s->pb, 16, 0);
put_bits(&s->pb, 16, 0x1B2); /* user_data */
avpriv_put_string(&s->pb, LIBAVCODEC_IDENT, 0);
}
}
| 18,011 |
31,677 | 0 | static void intel_pmu_disable_fixed(struct hw_perf_event *hwc)
{
int idx = hwc->idx - INTEL_PMC_IDX_FIXED;
u64 ctrl_val, mask;
mask = 0xfULL << (idx * 4);
rdmsrl(hwc->config_base, ctrl_val);
ctrl_val &= ~mask;
wrmsrl(hwc->config_base, ctrl_val);
}
| 18,012 |
43,793 | 0 | iakerb_init_creds_ctx(iakerb_ctx_id_t ctx,
krb5_gss_cred_id_t cred,
OM_uint32 time_req)
{
krb5_error_code code;
if (cred->iakerb_mech == 0) {
code = EINVAL;
goto cleanup;
}
assert(cred->name != NULL);
assert(cred->name->princ != NULL);
code = krb5_get_init_creds_opt_alloc(ctx->k5c, &ctx->gic_opts);
if (code != 0)
goto cleanup;
if (time_req != 0 && time_req != GSS_C_INDEFINITE)
krb5_get_init_creds_opt_set_tkt_life(ctx->gic_opts, time_req);
code = krb5_get_init_creds_opt_set_out_ccache(ctx->k5c, ctx->gic_opts,
cred->ccache);
if (code != 0)
goto cleanup;
code = krb5_init_creds_init(ctx->k5c,
cred->name->princ,
NULL, /* prompter */
NULL, /* data */
0, /* start_time */
ctx->gic_opts,
&ctx->icc);
if (code != 0)
goto cleanup;
if (cred->password != NULL) {
code = krb5_init_creds_set_password(ctx->k5c, ctx->icc,
cred->password);
} else {
code = krb5_init_creds_set_keytab(ctx->k5c, ctx->icc,
cred->client_keytab);
}
if (code != 0)
goto cleanup;
cleanup:
return code;
}
| 18,013 |
68,830 | 0 | static struct array_cache *alloc_arraycache(int node, int entries,
int batchcount, gfp_t gfp)
{
size_t memsize = sizeof(void *) * entries + sizeof(struct array_cache);
struct array_cache *ac = NULL;
ac = kmalloc_node(memsize, gfp, node);
init_arraycache(ac, entries, batchcount);
return ac;
}
| 18,014 |
77,303 | 0 | ofproto_delete(const char *name, const char *type)
{
const struct ofproto_class *class = ofproto_class_find__(type);
return (!class ? EAFNOSUPPORT
: !class->del ? EACCES
: class->del(type, name));
}
| 18,015 |
135,570 | 0 | bool IsInPasswordFieldWithUnrevealedPassword(const Position& position) {
TextControlElement* text_control = EnclosingTextControl(position);
if (!isHTMLInputElement(text_control))
return false;
HTMLInputElement* input = toHTMLInputElement(text_control);
return (input->type() == InputTypeNames::password) &&
!input->ShouldRevealPassword();
}
| 18,016 |
115,170 | 0 | void BluetoothOptionsHandler::Initialize() {
DCHECK(web_ui_);
if (!CommandLine::ForCurrentProcess()
->HasSwitch(switches::kEnableBluetooth)) {
return;
}
web_ui_->CallJavascriptFunction(
"options.SystemOptions.showBluetoothSettings");
bool bluetooth_on = true;
base::FundamentalValue checked(bluetooth_on);
web_ui_->CallJavascriptFunction(
"options.SystemOptions.setBluetoothCheckboxState", checked);
chromeos::BluetoothManager* bluetooth_manager =
chromeos::BluetoothManager::GetInstance();
DCHECK(bluetooth_manager);
bluetooth_manager->AddObserver(this);
chromeos::BluetoothAdapter* default_adapter =
bluetooth_manager->DefaultAdapter();
DefaultAdapterChanged(default_adapter);
}
| 18,017 |
1,562 | 0 | aspath_add_seq (struct aspath *aspath, as_t asno)
{
return aspath_add_asns (aspath, asno, AS_SEQUENCE, 1);
}
| 18,018 |
62,027 | 0 | ikev2_gen_print(netdissect_options *ndo, u_char tpay,
const struct isakmp_gen *ext)
{
struct isakmp_gen e;
ND_TCHECK(*ext);
UNALIGNED_MEMCPY(&e, ext, sizeof(e));
ikev2_pay_print(ndo, NPSTR(tpay), e.critical);
ND_PRINT((ndo," len=%d", ntohs(e.len) - 4));
if (2 < ndo->ndo_vflag && 4 < ntohs(e.len)) {
ND_PRINT((ndo," "));
if (!rawprint(ndo, (const uint8_t *)(ext + 1), ntohs(e.len) - 4))
goto trunc;
}
return (const u_char *)ext + ntohs(e.len);
trunc:
ND_PRINT((ndo," [|%s]", NPSTR(tpay)));
return NULL;
}
| 18,019 |
75,902 | 0 | running_bfd(void)
{
return (__test_bit(DAEMON_BFD, &daemon_mode) &&
(global_data->have_bfd_config ||
__test_bit(RUN_ALL_CHILDREN, &daemon_mode)));
}
| 18,020 |
81,193 | 0 | void __local_bh_enable_ip(unsigned long ip, unsigned int cnt)
{
WARN_ON_ONCE(in_irq());
lockdep_assert_irqs_enabled();
#ifdef CONFIG_TRACE_IRQFLAGS
local_irq_disable();
#endif
/*
* Are softirqs going to be turned on now:
*/
if (softirq_count() == SOFTIRQ_DISABLE_OFFSET)
trace_softirqs_on(ip);
/*
* Keep preemption disabled until we are done with
* softirq processing:
*/
preempt_count_sub(cnt - 1);
if (unlikely(!in_interrupt() && local_softirq_pending())) {
/*
* Run softirq if any pending. And do it in its own stack
* as we may be calling this deep in a task call stack already.
*/
do_softirq();
}
preempt_count_dec();
#ifdef CONFIG_TRACE_IRQFLAGS
local_irq_enable();
#endif
preempt_check_resched();
}
| 18,021 |
184,012 | 1 | void SplitString(const std::wstring& str,
wchar_t c,
std::vector<std::wstring>* r) {
SplitStringT(str, c, true, r);
}
| 18,022 |
57,731 | 0 | int kvm_get_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
{
switch (msr_info->index) {
case MSR_IA32_PLATFORM_ID:
case MSR_IA32_EBL_CR_POWERON:
case MSR_IA32_DEBUGCTLMSR:
case MSR_IA32_LASTBRANCHFROMIP:
case MSR_IA32_LASTBRANCHTOIP:
case MSR_IA32_LASTINTFROMIP:
case MSR_IA32_LASTINTTOIP:
case MSR_K8_SYSCFG:
case MSR_K8_TSEG_ADDR:
case MSR_K8_TSEG_MASK:
case MSR_K7_HWCR:
case MSR_VM_HSAVE_PA:
case MSR_K8_INT_PENDING_MSG:
case MSR_AMD64_NB_CFG:
case MSR_FAM10H_MMIO_CONF_BASE:
case MSR_AMD64_BU_CFG2:
msr_info->data = 0;
break;
case MSR_K7_EVNTSEL0 ... MSR_K7_EVNTSEL3:
case MSR_K7_PERFCTR0 ... MSR_K7_PERFCTR3:
case MSR_P6_PERFCTR0 ... MSR_P6_PERFCTR1:
case MSR_P6_EVNTSEL0 ... MSR_P6_EVNTSEL1:
if (kvm_pmu_is_valid_msr(vcpu, msr_info->index))
return kvm_pmu_get_msr(vcpu, msr_info->index, &msr_info->data);
msr_info->data = 0;
break;
case MSR_IA32_UCODE_REV:
msr_info->data = 0x100000000ULL;
break;
case MSR_MTRRcap:
case 0x200 ... 0x2ff:
return kvm_mtrr_get_msr(vcpu, msr_info->index, &msr_info->data);
case 0xcd: /* fsb frequency */
msr_info->data = 3;
break;
/*
* MSR_EBC_FREQUENCY_ID
* Conservative value valid for even the basic CPU models.
* Models 0,1: 000 in bits 23:21 indicating a bus speed of
* 100MHz, model 2 000 in bits 18:16 indicating 100MHz,
* and 266MHz for model 3, or 4. Set Core Clock
* Frequency to System Bus Frequency Ratio to 1 (bits
* 31:24) even though these are only valid for CPU
* models > 2, however guests may end up dividing or
* multiplying by zero otherwise.
*/
case MSR_EBC_FREQUENCY_ID:
msr_info->data = 1 << 24;
break;
case MSR_IA32_APICBASE:
msr_info->data = kvm_get_apic_base(vcpu);
break;
case APIC_BASE_MSR ... APIC_BASE_MSR + 0x3ff:
return kvm_x2apic_msr_read(vcpu, msr_info->index, &msr_info->data);
break;
case MSR_IA32_TSCDEADLINE:
msr_info->data = kvm_get_lapic_tscdeadline_msr(vcpu);
break;
case MSR_IA32_TSC_ADJUST:
msr_info->data = (u64)vcpu->arch.ia32_tsc_adjust_msr;
break;
case MSR_IA32_MISC_ENABLE:
msr_info->data = vcpu->arch.ia32_misc_enable_msr;
break;
case MSR_IA32_SMBASE:
if (!msr_info->host_initiated)
return 1;
msr_info->data = vcpu->arch.smbase;
break;
case MSR_IA32_PERF_STATUS:
/* TSC increment by tick */
msr_info->data = 1000ULL;
/* CPU multiplier */
msr_info->data |= (((uint64_t)4ULL) << 40);
break;
case MSR_EFER:
msr_info->data = vcpu->arch.efer;
break;
case MSR_KVM_WALL_CLOCK:
case MSR_KVM_WALL_CLOCK_NEW:
msr_info->data = vcpu->kvm->arch.wall_clock;
break;
case MSR_KVM_SYSTEM_TIME:
case MSR_KVM_SYSTEM_TIME_NEW:
msr_info->data = vcpu->arch.time;
break;
case MSR_KVM_ASYNC_PF_EN:
msr_info->data = vcpu->arch.apf.msr_val;
break;
case MSR_KVM_STEAL_TIME:
msr_info->data = vcpu->arch.st.msr_val;
break;
case MSR_KVM_PV_EOI_EN:
msr_info->data = vcpu->arch.pv_eoi.msr_val;
break;
case MSR_IA32_P5_MC_ADDR:
case MSR_IA32_P5_MC_TYPE:
case MSR_IA32_MCG_CAP:
case MSR_IA32_MCG_CTL:
case MSR_IA32_MCG_STATUS:
case MSR_IA32_MC0_CTL ... MSR_IA32_MCx_CTL(KVM_MAX_MCE_BANKS) - 1:
return get_msr_mce(vcpu, msr_info->index, &msr_info->data);
case MSR_K7_CLK_CTL:
/*
* Provide expected ramp-up count for K7. All other
* are set to zero, indicating minimum divisors for
* every field.
*
* This prevents guest kernels on AMD host with CPU
* type 6, model 8 and higher from exploding due to
* the rdmsr failing.
*/
msr_info->data = 0x20000000;
break;
case HV_X64_MSR_GUEST_OS_ID ... HV_X64_MSR_SINT15:
case HV_X64_MSR_CRASH_P0 ... HV_X64_MSR_CRASH_P4:
case HV_X64_MSR_CRASH_CTL:
return kvm_hv_get_msr_common(vcpu,
msr_info->index, &msr_info->data);
break;
case MSR_IA32_BBL_CR_CTL3:
/* This legacy MSR exists but isn't fully documented in current
* silicon. It is however accessed by winxp in very narrow
* scenarios where it sets bit #19, itself documented as
* a "reserved" bit. Best effort attempt to source coherent
* read data here should the balance of the register be
* interpreted by the guest:
*
* L2 cache control register 3: 64GB range, 256KB size,
* enabled, latency 0x1, configured
*/
msr_info->data = 0xbe702111;
break;
case MSR_AMD64_OSVW_ID_LENGTH:
if (!guest_cpuid_has_osvw(vcpu))
return 1;
msr_info->data = vcpu->arch.osvw.length;
break;
case MSR_AMD64_OSVW_STATUS:
if (!guest_cpuid_has_osvw(vcpu))
return 1;
msr_info->data = vcpu->arch.osvw.status;
break;
default:
if (kvm_pmu_is_valid_msr(vcpu, msr_info->index))
return kvm_pmu_get_msr(vcpu, msr_info->index, &msr_info->data);
if (!ignore_msrs) {
vcpu_unimpl(vcpu, "unhandled rdmsr: 0x%x\n", msr_info->index);
return 1;
} else {
vcpu_unimpl(vcpu, "ignored rdmsr: 0x%x\n", msr_info->index);
msr_info->data = 0;
}
break;
}
return 0;
}
| 18,023 |
43,047 | 0 | int luaD_pcall (lua_State *L, Pfunc func, void *u,
ptrdiff_t old_top, ptrdiff_t ef) {
int status;
unsigned short oldnCcalls = L->nCcalls;
ptrdiff_t old_ci = saveci(L, L->ci);
lu_byte old_allowhooks = L->allowhook;
ptrdiff_t old_errfunc = L->errfunc;
L->errfunc = ef;
status = luaD_rawrunprotected(L, func, u);
if (status != 0) { /* an error occurred? */
StkId oldtop = restorestack(L, old_top);
luaF_close(L, oldtop); /* close eventual pending closures */
luaD_seterrorobj(L, status, oldtop);
L->nCcalls = oldnCcalls;
L->ci = restoreci(L, old_ci);
L->base = L->ci->base;
L->savedpc = L->ci->savedpc;
L->allowhook = old_allowhooks;
restore_stack_limit(L);
}
L->errfunc = old_errfunc;
return status;
}
| 18,024 |
181,067 | 1 | l2tp_framing_type_print(netdissect_options *ndo, const u_char *dat)
{
const uint32_t *ptr = (const uint32_t *)dat;
if (EXTRACT_32BITS(ptr) & L2TP_FRAMING_TYPE_ASYNC_MASK) {
ND_PRINT((ndo, "A"));
}
if (EXTRACT_32BITS(ptr) & L2TP_FRAMING_TYPE_SYNC_MASK) {
ND_PRINT((ndo, "S"));
}
}
| 18,025 |
91,348 | 0 | static MagickBooleanType WriteSIXELImage(const ImageInfo *image_info,
Image *image,ExceptionInfo *exception)
{
MagickBooleanType
status;
register const Quantum
*q;
register ssize_t
i,
x;
ssize_t
opacity,
y;
sixel_output_t
*output;
unsigned char
sixel_palette[256*3],
*sixel_pixels;
/*
Open output image file.
*/
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickCoreSignature);
assert(image != (Image *) NULL);
assert(image->signature == MagickCoreSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
if (status == MagickFalse)
return(status);
if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)
(void) TransformImageColorspace(image,sRGBColorspace,exception);
opacity=(-1);
if (image->alpha_trait == UndefinedPixelTrait)
{
if ((image->storage_class == DirectClass) || (image->colors > 256))
(void) SetImageType(image,PaletteType,exception);
}
else
{
MagickRealType
alpha,
beta;
/*
Identify transparent colormap index.
*/
if ((image->storage_class == DirectClass) || (image->colors > 256))
(void) SetImageType(image,PaletteBilevelAlphaType,exception);
for (i=0; i < (ssize_t) image->colors; i++)
if (image->colormap[i].alpha != OpaqueAlpha)
{
if (opacity < 0)
{
opacity=i;
continue;
}
alpha=image->colormap[i].alpha;
beta=image->colormap[opacity].alpha;
if (alpha < beta)
opacity=i;
}
if (opacity == -1)
{
(void) SetImageType(image,PaletteBilevelAlphaType,exception);
for (i=0; i < (ssize_t) image->colors; i++)
if (image->colormap[i].alpha != OpaqueAlpha)
{
if (opacity < 0)
{
opacity=i;
continue;
}
alpha=image->colormap[i].alpha;
beta=image->colormap[opacity].alpha;
if (alpha < beta)
opacity=i;
}
}
if (opacity >= 0)
{
image->colormap[opacity].red=image->transparent_color.red;
image->colormap[opacity].green=image->transparent_color.green;
image->colormap[opacity].blue=image->transparent_color.blue;
}
}
/*
SIXEL header.
*/
for (i=0; i < (ssize_t) image->colors; i++)
{
sixel_palette[3*i+0]=ScaleQuantumToChar(image->colormap[i].red);
sixel_palette[3*i+1]=ScaleQuantumToChar(image->colormap[i].green);
sixel_palette[3*i+2]=ScaleQuantumToChar(image->colormap[i].blue);
}
/*
Define SIXEL pixels.
*/
output = sixel_output_create(image);
if (output == (sixel_output_t *) NULL)
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
sixel_pixels=(unsigned char *) AcquireQuantumMemory(image->columns,
image->rows*sizeof(*sixel_pixels));
if (sixel_pixels == (unsigned char *) NULL)
{
output = (sixel_output_t *) RelinquishMagickMemory(output);
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
}
for (y=0; y < (ssize_t) image->rows; y++)
{
q=GetVirtualPixels(image,0,y,image->columns,1,exception);
if (q == (Quantum *) NULL)
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
sixel_pixels[y*image->columns+x]= ((ssize_t) GetPixelIndex(image,q));
q+=GetPixelChannels(image);
}
}
status = sixel_encode_impl(sixel_pixels,image->columns,image->rows,
sixel_palette,image->colors,-1,output);
sixel_pixels=(unsigned char *) RelinquishMagickMemory(sixel_pixels);
output=(sixel_output_t *) RelinquishMagickMemory(output);
(void) CloseBlob(image);
return(status);
}
| 18,026 |
104,517 | 0 | MockTouchpadLibrary* CrosMock::mock_touchpad_library() {
return mock_touchpad_library_;
}
| 18,027 |
98,793 | 0 | void WebPluginDelegateProxy::OnGetCookies(const GURL& url,
const GURL& first_party_for_cookies,
std::string* cookies) {
DCHECK(cookies);
if (plugin_)
*cookies = plugin_->GetCookies(url, first_party_for_cookies);
}
| 18,028 |
139,393 | 0 | static bool EnabledUndo(LocalFrame& frame, Event*, EditorCommandSource) {
return frame.GetEditor().CanUndo();
}
| 18,029 |
156,738 | 0 | void WaitForSelectedText(const std::string& expected_text) {
if (last_selected_text_ == expected_text)
return;
expected_text_ = expected_text;
loop_runner_ = new MessageLoopRunner();
loop_runner_->Run();
}
| 18,030 |
87,553 | 0 | unsigned lodepng_has_palette_alpha(const LodePNGColorMode* info)
{
size_t i;
for(i = 0; i < info->palettesize; i++)
{
if(info->palette[i * 4 + 3] < 255) return 1;
}
return 0;
}
| 18,031 |
145,231 | 0 | void Dispatcher::OnDeliverMessage(int target_port_id, const Message& message) {
scoped_ptr<RequestSender::ScopedTabID> scoped_tab_id;
std::map<int, int>::const_iterator it =
port_to_tab_id_map_.find(target_port_id);
if (it != port_to_tab_id_map_.end()) {
scoped_tab_id.reset(
new RequestSender::ScopedTabID(request_sender(), it->second));
}
MessagingBindings::DeliverMessage(*script_context_set_, target_port_id,
message,
NULL); // All render frames.
}
| 18,032 |
85,697 | 0 | void hns_nic_net_reinit(struct net_device *netdev)
{
struct hns_nic_priv *priv = netdev_priv(netdev);
netif_trans_update(priv->netdev);
while (test_and_set_bit(NIC_STATE_REINITING, &priv->state))
usleep_range(1000, 2000);
hns_nic_net_down(netdev);
hns_nic_net_reset(netdev);
(void)hns_nic_net_up(netdev);
clear_bit(NIC_STATE_REINITING, &priv->state);
}
| 18,033 |
161,770 | 0 | PlatformSensorFusion::~PlatformSensorFusion() {
for (const auto& pair : source_sensors_)
pair.second->RemoveClient(this);
}
| 18,034 |
11,172 | 0 | PHP_METHOD(PharFileInfo, getContent)
{
char *error;
php_stream *fp;
phar_entry_info *link;
zend_string *str;
PHAR_ENTRY_OBJECT();
if (zend_parse_parameters_none() == FAILURE) {
return;
}
if (entry_obj->entry->is_dir) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Phar error: Cannot retrieve contents, \"%s\" in phar \"%s\" is a directory", entry_obj->entry->filename, entry_obj->entry->phar->fname);
return;
}
link = phar_get_link_source(entry_obj->entry);
if (!link) {
link = entry_obj->entry;
}
if (SUCCESS != phar_open_entry_fp(link, &error, 0)) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Phar error: Cannot retrieve contents, \"%s\" in phar \"%s\": %s", entry_obj->entry->filename, entry_obj->entry->phar->fname, error);
efree(error);
return;
}
if (!(fp = phar_get_efp(link, 0))) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Phar error: Cannot retrieve contents of \"%s\" in phar \"%s\"", entry_obj->entry->filename, entry_obj->entry->phar->fname);
return;
}
phar_seek_efp(link, 0, SEEK_SET, 0, 0);
str = php_stream_copy_to_mem(fp, link->uncompressed_filesize, 0);
if (str) {
RETURN_STR(str);
} else {
RETURN_EMPTY_STRING();
}
}
| 18,035 |
155,172 | 0 | bool OmniboxViewViews::SkipDefaultKeyEventProcessing(
const ui::KeyEvent& event) {
if (views::FocusManager::IsTabTraversalKeyEvent(event) &&
((model()->is_keyword_hint() && !event.IsShiftDown()) ||
model()->popup_model()->IsOpen())) {
return true;
}
if (event.key_code() == ui::VKEY_ESCAPE)
return model()->WillHandleEscapeKey();
return Textfield::SkipDefaultKeyEventProcessing(event);
}
| 18,036 |
175,084 | 0 | void SoundPool::resume(int channelID)
{
ALOGV("resume(%d)", channelID);
Mutex::Autolock lock(&mLock);
SoundChannel* channel = findChannel(channelID);
if (channel) {
channel->resume();
}
}
| 18,037 |
6,422 | 0 | gboolean menu_cache_app_get_is_visible( MenuCacheApp* app, guint32 de_flags )
{
if(app->flags & FLAG_IS_NODISPLAY)
return FALSE;
return (!app->show_in_flags || (app->show_in_flags & de_flags)) &&
_can_be_exec(app);
}
| 18,038 |
3,246 | 0 | pdf_dsc_process(gx_device_pdf * pdev, const gs_param_string_array * pma)
{
/*
* The Adobe "Distiller Parameters" documentation says that Distiller
* looks at DSC comments, but it doesn't say which ones. We look at
* the ones that we see how to map directly to obvious PDF constructs.
*/
int code = 0;
uint i;
/*
* If ParseDSCComments is false, all DSC comments are ignored, even if
* ParseDSCComentsForDocInfo or PreserveEPSInfo is true.
*/
if (!pdev->ParseDSCComments)
return 0;
for (i = 0; i + 1 < pma->size && code >= 0; i += 2) {
const gs_param_string *pkey = &pma->data[i];
gs_param_string *pvalue = (gs_param_string *)&pma->data[i + 1];
const char *key;
int newsize;
/*
* %%For, %%Creator, and %%Title are recognized only if either
* ParseDSCCommentsForDocInfo or PreserveEPSInfo is true.
* The other DSC comments are always recognized.
*
* Acrobat Distiller sets CreationDate and ModDate to the current
* time, not the value of %%CreationDate. We think this is wrong,
* but we do the same -- we ignore %%CreationDate here.
*/
if (pdf_key_eq(pkey, "Creator") && pdev->CompatibilityLevel <= 1.7) {
key = "/Creator";
newsize = unescape_octals(pdev, (char *)pvalue->data, pvalue->size);
code = cos_dict_put_c_key_string(pdev->Info, key,
pvalue->data, newsize);
continue;
} else if (pdf_key_eq(pkey, "Title") && pdev->CompatibilityLevel <= 1.7) {
key = "/Title";
newsize = unescape_octals(pdev, (char *)pvalue->data, pvalue->size);
code = cos_dict_put_c_key_string(pdev->Info, key,
pvalue->data, newsize);
continue;
} else if (pdf_key_eq(pkey, "For") && pdev->CompatibilityLevel <= 1.7) {
key = "/Author";
newsize = unescape_octals(pdev, (char *)pvalue->data, pvalue->size);
code = cos_dict_put_c_key_string(pdev->Info, key,
pvalue->data, newsize);
continue;
} else {
pdf_page_dsc_info_t *ppdi;
char scan_buf[200]; /* arbitrary */
if ((ppdi = &pdev->doc_dsc_info,
pdf_key_eq(pkey, "Orientation")) ||
(ppdi = &pdev->page_dsc_info,
pdf_key_eq(pkey, "PageOrientation"))
) {
if (pvalue->size == 1 && pvalue->data[0] >= '0' &&
pvalue->data[0] <= '3'
)
ppdi->orientation = pvalue->data[0] - '0';
else
ppdi->orientation = -1;
} else if ((ppdi = &pdev->doc_dsc_info,
pdf_key_eq(pkey, "ViewingOrientation")) ||
(ppdi = &pdev->page_dsc_info,
pdf_key_eq(pkey, "PageViewingOrientation"))
) {
gs_matrix mat;
int orient;
if(pvalue->size >= sizeof(scan_buf) - 1)
continue; /* error */
memcpy(scan_buf, pvalue->data, pvalue->size);
scan_buf[pvalue->size] = 0;
if (sscanf(scan_buf, "[%g %g %g %g]",
&mat.xx, &mat.xy, &mat.yx, &mat.yy) != 4
)
continue; /* error */
for (orient = 0; orient < 4; ++orient) {
if (mat.xx == 1 && mat.xy == 0 && mat.yx == 0 && mat.yy == 1)
break;
gs_matrix_rotate(&mat, -90.0, &mat);
}
if (orient == 4) /* error */
orient = -1;
ppdi->viewing_orientation = orient;
} else {
gs_rect box;
if (pdf_key_eq(pkey, "EPSF")) {
pdev->is_EPS = (pvalue->size >= 1 && pvalue->data[0] != '0');
continue;
}
/*
* We only parse the BoundingBox for the sake of
* AutoPositionEPSFiles.
*/
if (pdf_key_eq(pkey, "BoundingBox"))
ppdi = &pdev->doc_dsc_info;
else if (pdf_key_eq(pkey, "PageBoundingBox"))
ppdi = &pdev->page_dsc_info;
else
continue;
if(pvalue->size >= sizeof(scan_buf) - 1)
continue; /* error */
memcpy(scan_buf, pvalue->data, pvalue->size);
scan_buf[pvalue->size] = 0;
if (sscanf(scan_buf, "[%lg %lg %lg %lg]",
&box.p.x, &box.p.y, &box.q.x, &box.q.y) != 4
)
continue; /* error */
ppdi->bounding_box = box;
}
continue;
}
}
return code;
}
| 18,039 |
136,723 | 0 | void FrameSelection::SelectFrameElementInParentIfFullySelected() {
Frame* parent = frame_->Tree().Parent();
if (!parent)
return;
Page* page = frame_->GetPage();
if (!page)
return;
if (GetSelectionInDOMTree().Type() != kRangeSelection) {
return;
}
GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets();
if (!IsStartOfDocument(ComputeVisibleSelectionInDOMTree().VisibleStart()))
return;
if (!IsEndOfDocument(ComputeVisibleSelectionInDOMTree().VisibleEnd()))
return;
if (!parent->IsLocalFrame())
return;
HTMLFrameOwnerElement* owner_element = frame_->DeprecatedLocalOwner();
if (!owner_element)
return;
ContainerNode* owner_element_parent = owner_element->parentNode();
if (!owner_element_parent)
return;
owner_element_parent->GetDocument()
.UpdateStyleAndLayoutIgnorePendingStylesheets();
if (!blink::HasEditableStyle(*owner_element_parent))
return;
unsigned owner_element_node_index = owner_element->NodeIndex();
VisiblePosition before_owner_element = CreateVisiblePosition(
Position(owner_element_parent, owner_element_node_index));
VisiblePosition after_owner_element = CreateVisiblePosition(
Position(owner_element_parent, owner_element_node_index + 1),
TextAffinity::kUpstreamIfPossible);
SelectionInDOMTree::Builder builder;
builder
.SetBaseAndExtentDeprecated(before_owner_element.DeepEquivalent(),
after_owner_element.DeepEquivalent())
.SetAffinity(before_owner_element.Affinity());
VisibleSelection new_selection = CreateVisibleSelection(builder.Build());
page->GetFocusController().SetFocusedFrame(parent);
if (!new_selection.IsNone() &&
new_selection.IsValidFor(*(ToLocalFrame(parent)->GetDocument()))) {
ToLocalFrame(parent)->Selection().SetSelectionAndEndTyping(
new_selection.AsSelection());
}
}
| 18,040 |
118,387 | 0 | MockAffiliationFetcherDelegate() {}
| 18,041 |
102,783 | 0 | virtual void drawLayersOnCCThread(CCLayerTreeHostImpl*)
{
if (m_numDraws == 1)
postSetNeedsCommitThenRedrawToMainThread();
m_numDraws++;
postSetNeedsRedrawToMainThread();
}
| 18,042 |
11,998 | 0 | DEFINE_RUN_ONCE_STATIC(ossl_init_engine_openssl)
{
# ifdef OPENSSL_INIT_DEBUG
fprintf(stderr, "OPENSSL_INIT: ossl_init_engine_openssl: "
"engine_load_openssl_int()\n");
# endif
engine_load_openssl_int();
return 1;
}
| 18,043 |
138,014 | 0 | AXNodeObject::AXNodeObject(Node* node, AXObjectCacheImpl& axObjectCache)
: AXObject(axObjectCache),
m_ariaRole(UnknownRole),
m_childrenDirty(false),
m_node(node) {
}
| 18,044 |
18,889 | 0 | static inline void syn_ack_recalc(struct request_sock *req, const int thresh,
const int max_retries,
const u8 rskq_defer_accept,
int *expire, int *resend)
{
if (!rskq_defer_accept) {
*expire = req->retrans >= thresh;
*resend = 1;
return;
}
*expire = req->retrans >= thresh &&
(!inet_rsk(req)->acked || req->retrans >= max_retries);
/*
* Do not resend while waiting for data after ACK,
* start to resend on end of deferring period to give
* last chance for data or ACK to create established socket.
*/
*resend = !inet_rsk(req)->acked ||
req->retrans >= rskq_defer_accept - 1;
}
| 18,045 |
27,905 | 0 | static void fuse_vma_close(struct vm_area_struct *vma)
{
filemap_write_and_wait(vma->vm_file->f_mapping);
}
| 18,046 |
49,432 | 0 | static int proc_pid_auxv(struct seq_file *m, struct pid_namespace *ns,
struct pid *pid, struct task_struct *task)
{
struct mm_struct *mm = mm_access(task, PTRACE_MODE_READ_FSCREDS);
if (mm && !IS_ERR(mm)) {
unsigned int nwords = 0;
do {
nwords += 2;
} while (mm->saved_auxv[nwords - 2] != 0); /* AT_NULL */
seq_write(m, mm->saved_auxv, nwords * sizeof(mm->saved_auxv[0]));
mmput(mm);
return 0;
} else
return PTR_ERR(mm);
}
| 18,047 |
61,262 | 0 | EXPORTED int mboxlist_deleteremote(const char *name, struct txn **in_tid)
{
int r;
struct txn **tid;
struct txn *lcl_tid = NULL;
mbentry_t *mbentry = NULL;
if(in_tid) {
tid = in_tid;
} else {
tid = &lcl_tid;
}
retry:
r = mboxlist_mylookup(name, &mbentry, tid, 1);
switch (r) {
case 0:
break;
case IMAP_MAILBOX_NONEXISTENT:
r = 0;
break;
case IMAP_AGAIN:
goto retry;
break;
default:
goto done;
}
if (mbentry && (mbentry->mbtype & MBTYPE_REMOTE) && !mbentry->server) {
syslog(LOG_ERR,
"mboxlist_deleteremote called on non-remote mailbox: %s",
name);
goto done;
}
r = mboxlist_update_entry(name, NULL, tid);
if (r) {
syslog(LOG_ERR, "DBERROR: error deleting %s: %s",
name, cyrusdb_strerror(r));
r = IMAP_IOERROR;
}
/* commit db operations, but only if we weren't passed a transaction */
if (!in_tid) {
r = cyrusdb_commit(mbdb, *tid);
if (r) {
syslog(LOG_ERR, "DBERROR: failed on commit: %s",
cyrusdb_strerror(r));
r = IMAP_IOERROR;
}
tid = NULL;
}
done:
if (r && !in_tid && tid) {
/* Abort the transaction if it is still in progress */
cyrusdb_abort(mbdb, *tid);
}
return r;
}
| 18,048 |
145,248 | 0 | void Dispatcher::OnUpdateTabSpecificPermissions(const GURL& visible_url,
const std::string& extension_id,
const URLPatternSet& new_hosts,
bool update_origin_whitelist,
int tab_id) {
const Extension* extension =
RendererExtensionRegistry::Get()->GetByID(extension_id);
if (!extension)
return;
URLPatternSet old_effective =
extension->permissions_data()->GetEffectiveHostPermissions();
extension->permissions_data()->UpdateTabSpecificPermissions(
tab_id,
extensions::PermissionSet(extensions::APIPermissionSet(),
extensions::ManifestPermissionSet(), new_hosts,
extensions::URLPatternSet()));
if (update_origin_whitelist) {
UpdateOriginPermissions(
extension->url(),
old_effective,
extension->permissions_data()->GetEffectiveHostPermissions());
}
}
| 18,049 |
128,772 | 0 | void ReadableStreamReader::releaseLock()
{
if (!isActive())
return;
ASSERT(!m_stream->hasPendingReads());
if (m_stream->stateInternal() != ReadableStream::Readable)
m_closed->reset();
m_closed->reject(DOMException::create(AbortError, "the reader is already released"));
m_stream->setReader(nullptr);
ASSERT(!isActive());
}
| 18,050 |
101,001 | 0 | void DidGetGlobalQuota(QuotaStatusCode status,
StorageType type,
int64 quota) {
DCHECK_EQ(type_, type);
quota_status_ = status;
quota_ = quota;
CheckCompleted();
}
| 18,051 |
177,752 | 1 | pdf_show_image(fz_context *ctx, pdf_run_processor *pr, fz_image *image)
{
pdf_gstate *gstate = pr->gstate + pr->gtop;
fz_matrix image_ctm;
fz_rect bbox;
softmask_save softmask = { NULL };
if (pr->super.hidden)
return;
break;
case PDF_MAT_SHADE:
if (gstate->fill.shade)
{
fz_clip_image_mask(ctx, pr->dev, image, &image_ctm, &bbox);
bbox = fz_unit_rect;
fz_transform_rect(&bbox, &image_ctm);
if (image->mask)
{
/* apply blend group even though we skip the soft mask */
if (gstate->blendmode)
fz_begin_group(ctx, pr->dev, &bbox, NULL, 0, 0, gstate->blendmode, 1);
fz_clip_image_mask(ctx, pr->dev, image->mask, &image_ctm, &bbox);
}
else
gstate = pdf_begin_group(ctx, pr, &bbox, &softmask);
if (!image->colorspace)
{
switch (gstate->fill.kind)
{
case PDF_MAT_NONE:
break;
case PDF_MAT_COLOR:
fz_fill_image_mask(ctx, pr->dev, image, &image_ctm,
gstate->fill.colorspace, gstate->fill.v, gstate->fill.alpha, &gstate->fill.color_params);
break;
case PDF_MAT_PATTERN:
if (gstate->fill.pattern)
{
fz_clip_image_mask(ctx, pr->dev, image, &image_ctm, &bbox);
pdf_show_pattern(ctx, pr, gstate->fill.pattern, &pr->gstate[gstate->fill.gstate_num], &bbox, PDF_FILL);
fz_pop_clip(ctx, pr->dev);
}
break;
case PDF_MAT_SHADE:
if (gstate->fill.shade)
{
fz_clip_image_mask(ctx, pr->dev, image, &image_ctm, &bbox);
fz_fill_shade(ctx, pr->dev, gstate->fill.shade, &pr->gstate[gstate->fill.gstate_num].ctm, gstate->fill.alpha, &gstate->fill.color_params);
fz_pop_clip(ctx, pr->dev);
}
break;
}
}
else
{
fz_fill_image(ctx, pr->dev, image, &image_ctm, gstate->fill.alpha, &gstate->fill.color_params);
}
if (image->mask)
{
fz_pop_clip(ctx, pr->dev);
if (gstate->blendmode)
fz_end_group(ctx, pr->dev);
}
else
pdf_end_group(ctx, pr, &softmask);
}
static void
if (pr->clip)
{
gstate->clip_depth++;
fz_clip_path(ctx, pr->dev, path, pr->clip_even_odd, &gstate->ctm, &bbox);
pr->clip = 0;
}
if (pr->super.hidden)
dostroke = dofill = 0;
if (dofill || dostroke)
gstate = pdf_begin_group(ctx, pr, &bbox, &softmask);
if (dofill && dostroke)
{
/* We may need to push a knockout group */
if (gstate->stroke.alpha == 0)
{
/* No need for group, as stroke won't do anything */
}
else if (gstate->stroke.alpha == 1.0f && gstate->blendmode == FZ_BLEND_NORMAL)
{
/* No need for group, as stroke won't show up */
}
else
{
knockout_group = 1;
fz_begin_group(ctx, pr->dev, &bbox, NULL, 0, 1, FZ_BLEND_NORMAL, 1);
}
}
if (dofill)
{
switch (gstate->fill.kind)
{
case PDF_MAT_NONE:
break;
case PDF_MAT_COLOR:
fz_fill_path(ctx, pr->dev, path, even_odd, &gstate->ctm,
gstate->fill.colorspace, gstate->fill.v, gstate->fill.alpha, &gstate->fill.color_params);
break;
case PDF_MAT_PATTERN:
if (gstate->fill.pattern)
{
fz_clip_path(ctx, pr->dev, path, even_odd, &gstate->ctm, &bbox);
pdf_show_pattern(ctx, pr, gstate->fill.pattern, &pr->gstate[gstate->fill.gstate_num], &bbox, PDF_FILL);
fz_pop_clip(ctx, pr->dev);
}
break;
case PDF_MAT_SHADE:
if (gstate->fill.shade)
{
fz_clip_path(ctx, pr->dev, path, even_odd, &gstate->ctm, &bbox);
/* The cluster and page 2 of patterns.pdf shows that fz_fill_shade should NOT be called with gstate->ctm. */
fz_fill_shade(ctx, pr->dev, gstate->fill.shade, &pr->gstate[gstate->fill.gstate_num].ctm, gstate->fill.alpha, &gstate->fill.color_params);
fz_pop_clip(ctx, pr->dev);
}
break;
}
}
if (dostroke)
{
switch (gstate->stroke.kind)
{
case PDF_MAT_NONE:
break;
case PDF_MAT_COLOR:
fz_stroke_path(ctx, pr->dev, path, gstate->stroke_state, &gstate->ctm,
gstate->stroke.colorspace, gstate->stroke.v, gstate->stroke.alpha, &gstate->stroke.color_params);
break;
case PDF_MAT_PATTERN:
if (gstate->stroke.pattern)
{
fz_clip_stroke_path(ctx, pr->dev, path, gstate->stroke_state, &gstate->ctm, &bbox);
pdf_show_pattern(ctx, pr, gstate->stroke.pattern, &pr->gstate[gstate->stroke.gstate_num], &bbox, PDF_STROKE);
fz_pop_clip(ctx, pr->dev);
}
break;
case PDF_MAT_SHADE:
if (gstate->stroke.shade)
{
fz_clip_stroke_path(ctx, pr->dev, path, gstate->stroke_state, &gstate->ctm, &bbox);
fz_fill_shade(ctx, pr->dev, gstate->stroke.shade, &pr->gstate[gstate->stroke.gstate_num].ctm, gstate->stroke.alpha, &gstate->stroke.color_params);
fz_pop_clip(ctx, pr->dev);
}
break;
}
}
if (knockout_group)
fz_end_group(ctx, pr->dev);
if (dofill || dostroke)
pdf_end_group(ctx, pr, &softmask);
}
| 18,052 |
173,756 | 0 | static int handle_write(struct fuse* fuse, struct fuse_handler* handler,
const struct fuse_in_header* hdr, const struct fuse_write_in* req,
const void* buffer)
{
struct fuse_write_out out;
struct handle *h = id_to_ptr(req->fh);
int res;
__u8 aligned_buffer[req->size] __attribute__((__aligned__(PAGESIZE)));
if (req->flags & O_DIRECT) {
memcpy(aligned_buffer, buffer, req->size);
buffer = (const __u8*) aligned_buffer;
}
TRACE("[%d] WRITE %p(%d) %u@%"PRIu64"\n", handler->token,
h, h->fd, req->size, req->offset);
res = pwrite64(h->fd, buffer, req->size, req->offset);
if (res < 0) {
return -errno;
}
out.size = res;
out.padding = 0;
fuse_reply(fuse, hdr->unique, &out, sizeof(out));
return NO_STATUS;
}
| 18,053 |
148,343 | 0 | void WebContentsImpl::DidChangeVisibleSecurityState() {
if (delegate_) {
delegate_->VisibleSecurityStateChanged(this);
for (auto& observer : observers_)
observer.DidChangeVisibleSecurityState();
}
}
| 18,054 |
162,685 | 0 | bool BaseRenderingContext2D::ComputeDirtyRect(const FloatRect& local_rect,
SkIRect* dirty_rect) {
SkIRect clip_bounds;
if (!DrawingCanvas()->getDeviceClipBounds(&clip_bounds))
return false;
return ComputeDirtyRect(local_rect, clip_bounds, dirty_rect);
}
| 18,055 |
1,425 | 0 | void cache_tmp_xattr(struct file_struct *file, stat_x *sxp)
{
int ndx;
if (!sxp->xattr)
return;
if (prior_xattr_count == (size_t)-1)
prior_xattr_count = rsync_xal_l.count;
ndx = find_matching_xattr(sxp->xattr);
if (ndx < 0)
rsync_xal_store(sxp->xattr); /* adds item to rsync_xal_l */
F_XATTR(file) = ndx;
}
| 18,056 |
28,204 | 0 | static void clone_tables(H264Context *dst, H264Context *src, int i)
{
dst->intra4x4_pred_mode = src->intra4x4_pred_mode + i * 8 * 2 * src->mb_stride;
dst->non_zero_count = src->non_zero_count;
dst->slice_table = src->slice_table;
dst->cbp_table = src->cbp_table;
dst->mb2b_xy = src->mb2b_xy;
dst->mb2br_xy = src->mb2br_xy;
dst->chroma_pred_mode_table = src->chroma_pred_mode_table;
dst->mvd_table[0] = src->mvd_table[0] + i * 8 * 2 * src->mb_stride;
dst->mvd_table[1] = src->mvd_table[1] + i * 8 * 2 * src->mb_stride;
dst->direct_table = src->direct_table;
dst->list_counts = src->list_counts;
dst->DPB = src->DPB;
dst->cur_pic_ptr = src->cur_pic_ptr;
dst->cur_pic = src->cur_pic;
dst->bipred_scratchpad = NULL;
dst->edge_emu_buffer = NULL;
dst->me.scratchpad = NULL;
ff_h264_pred_init(&dst->hpc, src->avctx->codec_id, src->sps.bit_depth_luma,
src->sps.chroma_format_idc);
}
| 18,057 |
152,269 | 0 | void RenderFrameImpl::DidDisplayContentWithCertificateErrors() {
Send(new FrameHostMsg_DidDisplayContentWithCertificateErrors(routing_id_));
}
| 18,058 |
124,282 | 0 | AlarmManager* ExtensionSystemImpl::alarm_manager() {
return alarm_manager_.get();
}
| 18,059 |
42,555 | 0 | static void super_written(struct bio *bio, int error)
{
struct md_rdev *rdev = bio->bi_private;
struct mddev *mddev = rdev->mddev;
if (error || !test_bit(BIO_UPTODATE, &bio->bi_flags)) {
printk("md: super_written gets error=%d, uptodate=%d\n",
error, test_bit(BIO_UPTODATE, &bio->bi_flags));
WARN_ON(test_bit(BIO_UPTODATE, &bio->bi_flags));
md_error(mddev, rdev);
}
if (atomic_dec_and_test(&mddev->pending_writes))
wake_up(&mddev->sb_wait);
bio_put(bio);
}
| 18,060 |
173,183 | 0 | pixel_cmp(png_const_bytep pa, png_const_bytep pb, png_uint_32 bit_width)
{
#if PNG_LIBPNG_VER < 10506
if (memcmp(pa, pb, bit_width>>3) == 0)
{
png_uint_32 p;
if ((bit_width & 7) == 0) return 0;
/* Ok, any differences? */
p = pa[bit_width >> 3];
p ^= pb[bit_width >> 3];
if (p == 0) return 0;
/* There are, but they may not be significant, remove the bits
* after the end (the low order bits in PNG.)
*/
bit_width &= 7;
p >>= 8-bit_width;
if (p == 0) return 0;
}
#else
/* From libpng-1.5.6 the overwrite should be fixed, so compare the trailing
* bits too:
*/
if (memcmp(pa, pb, (bit_width+7)>>3) == 0)
return 0;
#endif
/* Return the index of the changed byte. */
{
png_uint_32 where = 0;
while (pa[where] == pb[where]) ++where;
return 1+where;
}
}
| 18,061 |
77,852 | 0 | bson_iter_overwrite_int32 (bson_iter_t *iter, /* IN */
int32_t value) /* IN */
{
BSON_ASSERT (iter);
if (ITER_TYPE (iter) == BSON_TYPE_INT32) {
#if BSON_BYTE_ORDER != BSON_LITTLE_ENDIAN
value = BSON_UINT32_TO_LE (value);
#endif
memcpy ((void *) (iter->raw + iter->d1), &value, sizeof (value));
}
}
| 18,062 |
171,426 | 0 | static bool selinux_action_allowed(int s, debugger_request_t* request)
{
char *scon = NULL, *tcon = NULL;
const char *tclass = "debuggerd";
const char *perm;
bool allowed = false;
if (request->action <= 0 || request->action >= (sizeof(debuggerd_perms)/sizeof(debuggerd_perms[0]))) {
ALOGE("SELinux: No permission defined for debugger action %d", request->action);
return false;
}
perm = debuggerd_perms[request->action];
if (getpeercon(s, &scon) < 0) {
ALOGE("Cannot get peer context from socket\n");
goto out;
}
if (getpidcon(request->tid, &tcon) < 0) {
ALOGE("Cannot get context for tid %d\n", request->tid);
goto out;
}
allowed = (selinux_check_access(scon, tcon, tclass, perm, reinterpret_cast<void*>(request)) == 0);
out:
freecon(scon);
freecon(tcon);
return allowed;
}
| 18,063 |
174,228 | 0 | ssize_t Camera3Device::getPointCloudBufferSize() const {
const int FLOATS_PER_POINT=4;
camera_metadata_ro_entry maxPointCount = mDeviceInfo.find(ANDROID_DEPTH_MAX_DEPTH_SAMPLES);
if (maxPointCount.count == 0) {
ALOGE("%s: Camera %d: Can't find maximum depth point cloud size in static metadata!",
__FUNCTION__, mId);
return BAD_VALUE;
}
ssize_t maxBytesForPointCloud = sizeof(android_depth_points) +
maxPointCount.data.i32[0] * sizeof(float) * FLOATS_PER_POINT;
return maxBytesForPointCloud;
}
| 18,064 |
113,327 | 0 | media::VideoCapture::EventHandler* capture_client() {
return static_cast<media::VideoCapture::EventHandler*>(decoder_);
}
| 18,065 |
157,269 | 0 | void WebMediaPlayerImpl::OnOverlayRoutingToken(
const base::UnguessableToken& token) {
DCHECK(overlay_mode_ == OverlayMode::kUseAndroidOverlay);
overlay_routing_token_is_pending_ = false;
overlay_routing_token_ = OverlayInfo::RoutingToken(token);
MaybeSendOverlayInfoToDecoder();
}
| 18,066 |
127,077 | 0 | void ChromeClientImpl::setTouchAction(TouchAction touchAction)
{
if (WebViewClient* client = m_webView->client()) {
WebTouchAction webTouchAction = static_cast<WebTouchAction>(touchAction);
client->setTouchAction(webTouchAction);
}
}
| 18,067 |
163,757 | 0 | void DelegatedFrameHost::CopyFromCompositingSurface(
const gfx::Rect& src_subrect,
const gfx::Size& output_size,
const ReadbackRequestCallback& callback,
const SkColorType preferred_color_type) {
bool format_support = ((preferred_color_type == kAlpha_8_SkColorType) ||
(preferred_color_type == kRGB_565_SkColorType) ||
(preferred_color_type == kN32_SkColorType));
DCHECK(format_support);
if (!CanCopyFromCompositingSurface()) {
callback.Run(SkBitmap(), content::READBACK_SURFACE_UNAVAILABLE);
return;
}
std::unique_ptr<viz::CopyOutputRequest> request =
viz::CopyOutputRequest::CreateRequest(
base::BindOnce(&CopyFromCompositingSurfaceHasResult, output_size,
preferred_color_type, callback));
if (!src_subrect.IsEmpty())
request->set_area(src_subrect);
RequestCopyOfOutput(std::move(request));
}
| 18,068 |
65,706 | 0 | static bool svc_rqst_integrity_protected(struct svc_rqst *rqstp)
{
struct svc_cred *cr = &rqstp->rq_cred;
u32 service;
if (!cr->cr_gss_mech)
return false;
service = gss_pseudoflavor_to_service(cr->cr_gss_mech, cr->cr_flavor);
return service == RPC_GSS_SVC_INTEGRITY ||
service == RPC_GSS_SVC_PRIVACY;
}
| 18,069 |
59,980 | 0 | static int mixer_ctl_feature_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct usb_mixer_elem_info *cval = kcontrol->private_data;
int c, cnt, val, oval, err;
int changed = 0;
if (cval->cmask) {
cnt = 0;
for (c = 0; c < MAX_CHANNELS; c++) {
if (!(cval->cmask & (1 << c)))
continue;
err = snd_usb_get_cur_mix_value(cval, c + 1, cnt, &oval);
if (err < 0)
return filter_error(cval, err);
val = ucontrol->value.integer.value[cnt];
val = get_abs_value(cval, val);
if (oval != val) {
snd_usb_set_cur_mix_value(cval, c + 1, cnt, val);
changed = 1;
}
cnt++;
}
} else {
/* master channel */
err = snd_usb_get_cur_mix_value(cval, 0, 0, &oval);
if (err < 0)
return filter_error(cval, err);
val = ucontrol->value.integer.value[0];
val = get_abs_value(cval, val);
if (val != oval) {
snd_usb_set_cur_mix_value(cval, 0, 0, val);
changed = 1;
}
}
return changed;
}
| 18,070 |
18,968 | 0 | static int raw_send_hdrinc(struct sock *sk, void *from, size_t length,
struct rtable **rtp,
unsigned int flags)
{
struct inet_sock *inet = inet_sk(sk);
struct net *net = sock_net(sk);
struct iphdr *iph;
struct sk_buff *skb;
unsigned int iphlen;
int err;
struct rtable *rt = *rtp;
if (length > rt->dst.dev->mtu) {
ip_local_error(sk, EMSGSIZE, rt->rt_dst, inet->inet_dport,
rt->dst.dev->mtu);
return -EMSGSIZE;
}
if (flags&MSG_PROBE)
goto out;
skb = sock_alloc_send_skb(sk,
length + LL_ALLOCATED_SPACE(rt->dst.dev) + 15,
flags & MSG_DONTWAIT, &err);
if (skb == NULL)
goto error;
skb_reserve(skb, LL_RESERVED_SPACE(rt->dst.dev));
skb->priority = sk->sk_priority;
skb->mark = sk->sk_mark;
skb_dst_set(skb, &rt->dst);
*rtp = NULL;
skb_reset_network_header(skb);
iph = ip_hdr(skb);
skb_put(skb, length);
skb->ip_summed = CHECKSUM_NONE;
skb->transport_header = skb->network_header;
err = -EFAULT;
if (memcpy_fromiovecend((void *)iph, from, 0, length))
goto error_free;
iphlen = iph->ihl * 4;
/*
* We don't want to modify the ip header, but we do need to
* be sure that it won't cause problems later along the network
* stack. Specifically we want to make sure that iph->ihl is a
* sane value. If ihl points beyond the length of the buffer passed
* in, reject the frame as invalid
*/
err = -EINVAL;
if (iphlen > length)
goto error_free;
if (iphlen >= sizeof(*iph)) {
if (!iph->saddr)
iph->saddr = rt->rt_src;
iph->check = 0;
iph->tot_len = htons(length);
if (!iph->id)
ip_select_ident(iph, &rt->dst, NULL);
iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl);
}
if (iph->protocol == IPPROTO_ICMP)
icmp_out_count(net, ((struct icmphdr *)
skb_transport_header(skb))->type);
err = NF_HOOK(NFPROTO_IPV4, NF_INET_LOCAL_OUT, skb, NULL,
rt->dst.dev, dst_output);
if (err > 0)
err = net_xmit_errno(err);
if (err)
goto error;
out:
return 0;
error_free:
kfree_skb(skb);
error:
IP_INC_STATS(net, IPSTATS_MIB_OUTDISCARDS);
if (err == -ENOBUFS && !inet->recverr)
err = 0;
return err;
}
| 18,071 |
75,252 | 0 | static void crc32_init(void)
{
int i,j;
uint32 s;
for(i=0; i < 256; i++) {
for (s=(uint32) i << 24, j=0; j < 8; ++j)
s = (s << 1) ^ (s >= (1U<<31) ? CRC32_POLY : 0);
crc_table[i] = s;
}
}
| 18,072 |
70,497 | 0 | void *re_yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
(void)yyg;
/* The cast to (char *) in the following accommodates both
* implementations that use char* generic pointers, and those
* that use void* generic pointers. It works with the latter
* because both ANSI C and C++ allow castless assignment from
* any pointer type to void*, and deal with argument conversions
* as though doing an assignment.
*/
return (void *) realloc( (char *) ptr, size );
}
| 18,073 |
65,469 | 0 | free_client(struct nfs4_client *clp)
{
while (!list_empty(&clp->cl_sessions)) {
struct nfsd4_session *ses;
ses = list_entry(clp->cl_sessions.next, struct nfsd4_session,
se_perclnt);
list_del(&ses->se_perclnt);
WARN_ON_ONCE(atomic_read(&ses->se_ref));
free_session(ses);
}
rpc_destroy_wait_queue(&clp->cl_cb_waitq);
free_svc_cred(&clp->cl_cred);
kfree(clp->cl_ownerstr_hashtbl);
kfree(clp->cl_name.data);
idr_destroy(&clp->cl_stateids);
kfree(clp);
}
| 18,074 |
61,886 | 0 | static unsigned short get_tga_ushort(const unsigned char *data)
{
return (unsigned short)(data[0] | (data[1] << 8));
}
| 18,075 |
5,799 | 0 | static void ehci_opreg_write(void *ptr, hwaddr addr,
uint64_t val, unsigned size)
{
EHCIState *s = ptr;
uint32_t *mmio = s->opreg + (addr >> 2);
uint32_t old = *mmio;
int i;
trace_usb_ehci_opreg_write(addr + s->opregbase, addr2str(addr), val);
switch (addr) {
case USBCMD:
if (val & USBCMD_HCRESET) {
ehci_reset(s);
val = s->usbcmd;
break;
}
/* not supporting dynamic frame list size at the moment */
if ((val & USBCMD_FLS) && !(s->usbcmd & USBCMD_FLS)) {
fprintf(stderr, "attempt to set frame list size -- value %d\n",
(int)val & USBCMD_FLS);
val &= ~USBCMD_FLS;
}
if (val & USBCMD_IAAD) {
/*
* Process IAAD immediately, otherwise the Linux IAAD watchdog may
* trigger and re-use a qh without us seeing the unlink.
*/
s->async_stepdown = 0;
qemu_bh_schedule(s->async_bh);
trace_usb_ehci_doorbell_ring();
}
if (((USBCMD_RUNSTOP | USBCMD_PSE | USBCMD_ASE) & val) !=
((USBCMD_RUNSTOP | USBCMD_PSE | USBCMD_ASE) & s->usbcmd)) {
if (s->pstate == EST_INACTIVE) {
SET_LAST_RUN_CLOCK(s);
}
s->usbcmd = val; /* Set usbcmd for ehci_update_halt() */
ehci_update_halt(s);
s->async_stepdown = 0;
qemu_bh_schedule(s->async_bh);
}
break;
case USBSTS:
val &= USBSTS_RO_MASK; // bits 6 through 31 are RO
ehci_clear_usbsts(s, val); // bits 0 through 5 are R/WC
val = s->usbsts;
ehci_update_irq(s);
break;
case USBINTR:
val &= USBINTR_MASK;
if (ehci_enabled(s) && (USBSTS_FLR & val)) {
qemu_bh_schedule(s->async_bh);
}
break;
case FRINDEX:
val &= 0x00003fff; /* frindex is 14bits */
s->usbsts_frindex = val;
break;
case CONFIGFLAG:
val &= 0x1;
if (val) {
for(i = 0; i < NB_PORTS; i++)
handle_port_owner_write(s, i, 0);
}
break;
case PERIODICLISTBASE:
if (ehci_periodic_enabled(s)) {
fprintf(stderr,
"ehci: PERIODIC list base register set while periodic schedule\n"
" is enabled and HC is enabled\n");
}
break;
case ASYNCLISTADDR:
if (ehci_async_enabled(s)) {
fprintf(stderr,
"ehci: ASYNC list address register set while async schedule\n"
" is enabled and HC is enabled\n");
}
break;
}
*mmio = val;
trace_usb_ehci_opreg_change(addr + s->opregbase, addr2str(addr),
*mmio, old);
}
| 18,076 |
105,688 | 0 | int TypedUrlModelAssociator::MergeUrls(
const sync_pb::TypedUrlSpecifics& node,
const history::URLRow& url,
history::VisitVector* visits,
history::URLRow* new_url,
std::vector<history::VisitInfo>* new_visits) {
DCHECK(new_url);
DCHECK(!node.url().compare(url.url().spec()));
DCHECK(!node.url().compare(new_url->url().spec()));
DCHECK(visits->size());
DCHECK_EQ(node.visits_size(), node.visit_transitions_size());
if (node.visits_size() == 0)
return DIFF_UPDATE_NODE;
string16 node_title(UTF8ToUTF16(node.title()));
base::Time node_last_visit = base::Time::FromInternalValue(
node.visits(node.visits_size() - 1));
int different = DIFF_NONE;
if ((node_title.compare(url.title()) != 0) ||
(node.hidden() != url.hidden())) {
if (node_last_visit >= url.last_visit()) {
new_url->set_title(node_title);
new_url->set_hidden(node.hidden());
different |= DIFF_LOCAL_ROW_CHANGED;
if (new_url->title().compare(url.title()) != 0) {
different |= DIFF_LOCAL_TITLE_CHANGED;
}
} else {
new_url->set_title(url.title());
new_url->set_hidden(url.hidden());
different |= DIFF_UPDATE_NODE;
}
} else {
new_url->set_title(url.title());
new_url->set_hidden(url.hidden());
}
size_t node_num_visits = node.visits_size();
size_t history_num_visits = visits->size();
size_t node_visit_index = 0;
size_t history_visit_index = 0;
while (node_visit_index < node_num_visits ||
history_visit_index < history_num_visits) {
base::Time node_time, history_time;
if (node_visit_index < node_num_visits)
node_time = base::Time::FromInternalValue(node.visits(node_visit_index));
if (history_visit_index < history_num_visits)
history_time = (*visits)[history_visit_index].visit_time;
if (node_visit_index >= node_num_visits ||
(history_visit_index < history_num_visits &&
node_time > history_time)) {
different |= DIFF_UPDATE_NODE;
++history_visit_index;
} else if (history_visit_index >= history_num_visits ||
node_time < history_time) {
different |= DIFF_LOCAL_VISITS_ADDED;
new_visits->push_back(history::VisitInfo(
node_time, node.visit_transitions(node_visit_index)));
++node_visit_index;
} else {
++node_visit_index;
++history_visit_index;
}
}
if (different & DIFF_LOCAL_VISITS_ADDED) {
history::VisitVector::iterator visit_ix = visits->begin();
for (std::vector<history::VisitInfo>::iterator new_visit =
new_visits->begin();
new_visit != new_visits->end(); ++new_visit) {
while (visit_ix != visits->end() &&
new_visit->first > visit_ix->visit_time) {
++visit_ix;
}
visit_ix = visits->insert(visit_ix,
history::VisitRow(url.id(), new_visit->first,
0, new_visit->second, 0));
++visit_ix;
}
}
new_url->set_last_visit(visits->back().visit_time);
return different;
}
| 18,077 |
32,992 | 0 | static int sctp_getsockopt_associnfo(struct sock *sk, int len,
char __user *optval,
int __user *optlen)
{
struct sctp_assocparams assocparams;
struct sctp_association *asoc;
struct list_head *pos;
int cnt = 0;
if (len < sizeof (struct sctp_assocparams))
return -EINVAL;
len = sizeof(struct sctp_assocparams);
if (copy_from_user(&assocparams, optval, len))
return -EFAULT;
asoc = sctp_id2assoc(sk, assocparams.sasoc_assoc_id);
if (!asoc && assocparams.sasoc_assoc_id && sctp_style(sk, UDP))
return -EINVAL;
/* Values correspoinding to the specific association */
if (asoc) {
assocparams.sasoc_asocmaxrxt = asoc->max_retrans;
assocparams.sasoc_peer_rwnd = asoc->peer.rwnd;
assocparams.sasoc_local_rwnd = asoc->a_rwnd;
assocparams.sasoc_cookie_life = (asoc->cookie_life.tv_sec
* 1000) +
(asoc->cookie_life.tv_usec
/ 1000);
list_for_each(pos, &asoc->peer.transport_addr_list) {
cnt ++;
}
assocparams.sasoc_number_peer_destinations = cnt;
} else {
/* Values corresponding to the endpoint */
struct sctp_sock *sp = sctp_sk(sk);
assocparams.sasoc_asocmaxrxt = sp->assocparams.sasoc_asocmaxrxt;
assocparams.sasoc_peer_rwnd = sp->assocparams.sasoc_peer_rwnd;
assocparams.sasoc_local_rwnd = sp->assocparams.sasoc_local_rwnd;
assocparams.sasoc_cookie_life =
sp->assocparams.sasoc_cookie_life;
assocparams.sasoc_number_peer_destinations =
sp->assocparams.
sasoc_number_peer_destinations;
}
if (put_user(len, optlen))
return -EFAULT;
if (copy_to_user(optval, &assocparams, len))
return -EFAULT;
return 0;
}
| 18,078 |
40,452 | 0 | static int ipxitf_device_event(struct notifier_block *notifier,
unsigned long event, void *ptr)
{
struct net_device *dev = netdev_notifier_info_to_dev(ptr);
struct ipx_interface *i, *tmp;
if (!net_eq(dev_net(dev), &init_net))
return NOTIFY_DONE;
if (event != NETDEV_DOWN && event != NETDEV_UP)
goto out;
spin_lock_bh(&ipx_interfaces_lock);
list_for_each_entry_safe(i, tmp, &ipx_interfaces, node)
if (i->if_dev == dev) {
if (event == NETDEV_UP)
ipxitf_hold(i);
else
__ipxitf_put(i);
}
spin_unlock_bh(&ipx_interfaces_lock);
out:
return NOTIFY_DONE;
}
| 18,079 |
145,385 | 0 | RuntimeCustomBindings::RuntimeCustomBindings(ScriptContext* context)
: ObjectBackedNativeHandler(context) {
RouteFunction(
"GetManifest",
base::Bind(&RuntimeCustomBindings::GetManifest, base::Unretained(this)));
RouteFunction("OpenChannelToExtension", "runtime.connect",
base::Bind(&RuntimeCustomBindings::OpenChannelToExtension,
base::Unretained(this)));
RouteFunction("OpenChannelToNativeApp", "runtime.connectNative",
base::Bind(&RuntimeCustomBindings::OpenChannelToNativeApp,
base::Unretained(this)));
RouteFunction("GetExtensionViews",
base::Bind(&RuntimeCustomBindings::GetExtensionViews,
base::Unretained(this)));
}
| 18,080 |
176,511 | 0 | xmlCleanURI(xmlURIPtr uri) {
if (uri == NULL) return;
if (uri->scheme != NULL) xmlFree(uri->scheme);
uri->scheme = NULL;
if (uri->server != NULL) xmlFree(uri->server);
uri->server = NULL;
if (uri->user != NULL) xmlFree(uri->user);
uri->user = NULL;
if (uri->path != NULL) xmlFree(uri->path);
uri->path = NULL;
if (uri->fragment != NULL) xmlFree(uri->fragment);
uri->fragment = NULL;
if (uri->opaque != NULL) xmlFree(uri->opaque);
uri->opaque = NULL;
if (uri->authority != NULL) xmlFree(uri->authority);
uri->authority = NULL;
if (uri->query != NULL) xmlFree(uri->query);
uri->query = NULL;
if (uri->query_raw != NULL) xmlFree(uri->query_raw);
uri->query_raw = NULL;
}
| 18,081 |
168,495 | 0 | void FileReaderLoader::Failed(FileError::ErrorCode error_code) {
if (error_code_ != FileError::kOK)
return;
error_code_ = error_code;
Cleanup();
if (client_)
client_->DidFail(error_code_);
}
| 18,082 |
37,714 | 0 | void kvm_pit_load_count(struct kvm *kvm, int channel, u32 val, int hpet_legacy_start)
{
u8 saved_mode;
if (hpet_legacy_start) {
/* save existing mode for later reenablement */
saved_mode = kvm->arch.vpit->pit_state.channels[0].mode;
kvm->arch.vpit->pit_state.channels[0].mode = 0xff; /* disable timer */
pit_load_count(kvm, channel, val);
kvm->arch.vpit->pit_state.channels[0].mode = saved_mode;
} else {
pit_load_count(kvm, channel, val);
}
}
| 18,083 |
154,649 | 0 | error::Error GLES2DecoderPassthroughImpl::DoEndSharedImageAccessDirectCHROMIUM(
GLuint client_id) {
auto found = resources_->texture_shared_image_map.find(client_id);
if (found == resources_->texture_shared_image_map.end()) {
InsertError(GL_INVALID_OPERATION, "texture is not a shared image");
return error::kNoError;
}
SharedImageRepresentationGLTexturePassthrough* shared_image =
found->second.get();
shared_image->EndAccess();
return error::kNoError;
}
| 18,084 |
146,863 | 0 | void Document::UpdateStyleAndLayoutIgnorePendingStylesheets(
Document::RunPostLayoutTasks run_post_layout_tasks) {
UpdateStyleAndLayoutTreeIgnorePendingStylesheets();
UpdateStyleAndLayout();
if (run_post_layout_tasks == kRunPostLayoutTasksSynchronously && View())
View()->FlushAnyPendingPostLayoutTasks();
++force_layout_count_;
}
| 18,085 |
155,558 | 0 | AuthenticatorInsertAndActivateUsbSheetModel::GetOtherTransportsMenuModel() {
return other_transports_menu_model_.get();
}
| 18,086 |
47,198 | 0 | static int __chksum_finup(u32 *crcp, const u8 *data, unsigned int len, u8 *out)
{
*(__le32 *)out = ~cpu_to_le32(__crc32c_le(*crcp, data, len));
return 0;
}
| 18,087 |
63,946 | 0 | int check_intra_pred4x4_mode_emuedge(int mode, int mb_x, int mb_y,
int *copy_buf, int vp7)
{
switch (mode) {
case VERT_PRED:
if (!mb_x && mb_y) {
*copy_buf = 1;
return mode;
}
/* fall-through */
case DIAG_DOWN_LEFT_PRED:
case VERT_LEFT_PRED:
return !mb_y ? (vp7 ? DC_128_PRED : DC_127_PRED) : mode;
case HOR_PRED:
if (!mb_y) {
*copy_buf = 1;
return mode;
}
/* fall-through */
case HOR_UP_PRED:
return !mb_x ? (vp7 ? DC_128_PRED : DC_129_PRED) : mode;
case TM_VP8_PRED:
return check_tm_pred4x4_mode(mode, mb_x, mb_y, vp7);
case DC_PRED: /* 4x4 DC doesn't use the same "H.264-style" exceptions
* as 16x16/8x8 DC */
case DIAG_DOWN_RIGHT_PRED:
case VERT_RIGHT_PRED:
case HOR_DOWN_PRED:
if (!mb_y || !mb_x)
*copy_buf = 1;
return mode;
}
return mode;
}
| 18,088 |
3,386 | 0 | php_apache_sapi_read_post(char *buf, uint count_bytes TSRMLS_DC)
{
apr_size_t len, tlen=0;
php_struct *ctx = SG(server_context);
request_rec *r;
apr_bucket_brigade *brigade;
r = ctx->r;
brigade = ctx->brigade;
len = count_bytes;
/*
* This loop is needed because ap_get_brigade() can return us partial data
* which would cause premature termination of request read. Therefor we
* need to make sure that if data is available we fill the buffer completely.
*/
while (ap_get_brigade(r->input_filters, brigade, AP_MODE_READBYTES, APR_BLOCK_READ, len) == APR_SUCCESS) {
apr_brigade_flatten(brigade, buf, &len);
apr_brigade_cleanup(brigade);
tlen += len;
if (tlen == count_bytes || !len) {
break;
}
buf += len;
len = count_bytes - tlen;
}
return tlen;
}
| 18,089 |
51,470 | 0 | static void _gdImageGd2 (gdImagePtr im, gdIOCtx * out, int cs, int fmt)
{
int ncx, ncy, cx, cy;
int x, y, ylo, yhi, xlo, xhi;
int chunkLen;
int chunkNum = 0;
char *chunkData = NULL; /* So we can gdFree it with impunity. */
char *compData = NULL; /* So we can gdFree it with impunity. */
uLongf compLen;
int idxPos = 0;
int idxSize;
t_chunk_info *chunkIdx = NULL; /* So we can gdFree it with impunity. */
int posSave;
int bytesPerPixel = im->trueColor ? 4 : 1;
int compMax = 0;
/* Force fmt to a valid value since we don't return anything. */
if ((fmt != GD2_FMT_RAW) && (fmt != GD2_FMT_COMPRESSED)) {
fmt = im->trueColor ? GD2_FMT_TRUECOLOR_COMPRESSED : GD2_FMT_COMPRESSED;
}
if (im->trueColor) {
fmt += 2;
}
/* Make sure chunk size is valid. These are arbitrary values; 64 because it seems
* a little silly to expect performance improvements on a 64x64 bit scale, and
* 4096 because we buffer one chunk, and a 16MB buffer seems a little large - it may be
* OK for one user, but for another to read it, they require the buffer.
*/
if (cs == 0) {
cs = GD2_CHUNKSIZE;
} else if (cs < GD2_CHUNKSIZE_MIN) {
cs = GD2_CHUNKSIZE_MIN;
} else if (cs > GD2_CHUNKSIZE_MAX) {
cs = GD2_CHUNKSIZE_MAX;
}
/* Work out number of chunks. */
ncx = im->sx / cs + 1;
ncy = im->sy / cs + 1;
/* Write the standard header. */
_gd2PutHeader (im, out, cs, fmt, ncx, ncy);
if (gd2_compressed(fmt)) {
/* Work out size of buffer for compressed data, If CHUNKSIZE is large,
* then these will be large!
*/
/* The zlib notes say output buffer size should be (input size) * 1.01 * 12
* - we'll use 1.02 to be paranoid.
*/
compMax = (int)(cs * bytesPerPixel * cs * 1.02f) + 12;
/* Allocate the buffers. */
chunkData = safe_emalloc(cs * bytesPerPixel, cs, 0);
memset(chunkData, 0, cs * bytesPerPixel * cs);
if (compMax <= 0) {
goto fail;
}
compData = gdCalloc(compMax, 1);
/* Save the file position of chunk index, and allocate enough space for
* each chunk_info block .
*/
idxPos = gdTell(out);
idxSize = ncx * ncy * sizeof(t_chunk_info);
GD2_DBG(php_gd_error("Index size is %d", idxSize));
gdSeek(out, idxPos + idxSize);
chunkIdx = safe_emalloc(idxSize, sizeof(t_chunk_info), 0);
memset(chunkIdx, 0, idxSize * sizeof(t_chunk_info));
}
_gdPutColors (im, out);
GD2_DBG(php_gd_error("Size: %dx%d", im->sx, im->sy));
GD2_DBG(php_gd_error("Chunks: %dx%d", ncx, ncy));
for (cy = 0; (cy < ncy); cy++) {
for (cx = 0; (cx < ncx); cx++) {
ylo = cy * cs;
yhi = ylo + cs;
if (yhi > im->sy) {
yhi = im->sy;
}
GD2_DBG(php_gd_error("Processing Chunk (%dx%d), y from %d to %d", cx, cy, ylo, yhi));
chunkLen = 0;
for (y = ylo; (y < yhi); y++) {
GD2_DBG(php_gd_error("y=%d: ",y));
xlo = cx * cs;
xhi = xlo + cs;
if (xhi > im->sx) {
xhi = im->sx;
}
if (gd2_compressed(fmt)) {
for (x = xlo; x < xhi; x++) {
GD2_DBG(php_gd_error("%d...",x));
if (im->trueColor) {
int p = im->tpixels[y][x];
chunkData[chunkLen++] = gdTrueColorGetAlpha(p);
chunkData[chunkLen++] = gdTrueColorGetRed(p);
chunkData[chunkLen++] = gdTrueColorGetGreen(p);
chunkData[chunkLen++] = gdTrueColorGetBlue(p);
} else {
chunkData[chunkLen++] = im->pixels[y][x];
}
}
} else {
for (x = xlo; x < xhi; x++) {
GD2_DBG(php_gd_error("%d, ",x));
if (im->trueColor) {
gdPutInt(im->tpixels[y][x], out);
} else {
gdPutC((unsigned char) im->pixels[y][x], out);
}
}
}
GD2_DBG(php_gd_error("y=%d done.",y));
}
if (gd2_compressed(fmt)) {
compLen = compMax;
if (compress((unsigned char *) &compData[0], &compLen, (unsigned char *) &chunkData[0], chunkLen) != Z_OK) {
php_gd_error("Error from compressing");
} else {
chunkIdx[chunkNum].offset = gdTell(out);
chunkIdx[chunkNum++].size = compLen;
GD2_DBG(php_gd_error("Chunk %d size %d offset %d", chunkNum, chunkIdx[chunkNum - 1].size, chunkIdx[chunkNum - 1].offset));
if (gdPutBuf (compData, compLen, out) <= 0) {
/* Any alternate suggestions for handling this? */
php_gd_error_ex(E_WARNING, "Error %d on write", errno);
}
}
}
}
}
if (gd2_compressed(fmt)) {
/* Save the position, write the index, restore position (paranoia). */
GD2_DBG(php_gd_error("Seeking %d to write index", idxPos));
posSave = gdTell(out);
gdSeek(out, idxPos);
GD2_DBG(php_gd_error("Writing index"));
for (x = 0; x < chunkNum; x++) {
GD2_DBG(php_gd_error("Chunk %d size %d offset %d", x, chunkIdx[x].size, chunkIdx[x].offset));
gdPutInt(chunkIdx[x].offset, out);
gdPutInt(chunkIdx[x].size, out);
}
gdSeek(out, posSave);
}
fail:
GD2_DBG(php_gd_error("Freeing memory"));
if (chunkData) {
gdFree(chunkData);
}
if (compData) {
gdFree(compData);
}
if (chunkIdx) {
gdFree(chunkIdx);
}
GD2_DBG(php_gd_error("Done"));
}
| 18,090 |
112,147 | 0 | int64 MakeNode(UserShare* share,
ModelType model_type,
const std::string& client_tag) {
WriteTransaction trans(FROM_HERE, share);
ReadNode root_node(&trans);
root_node.InitByRootLookup();
WriteNode node(&trans);
sync_api::WriteNode::InitUniqueByCreationResult result =
node.InitUniqueByCreation(model_type, root_node, client_tag);
EXPECT_EQ(sync_api::WriteNode::INIT_SUCCESS, result);
node.SetIsFolder(false);
return node.GetId();
}
| 18,091 |
169,575 | 0 | void CastStreamingNativeHandler::DestroyCastUdpTransport(
const v8::FunctionCallbackInfo<v8::Value>& args) {
CHECK_EQ(1, args.Length());
CHECK(args[0]->IsInt32());
const int transport_id = args[0]->ToInt32(args.GetIsolate())->Value();
if (!GetUdpTransportOrThrow(transport_id))
return;
udp_transport_map_.erase(transport_id);
}
| 18,092 |
76,358 | 0 | static void bpf_map_ptr_store(struct bpf_insn_aux_data *aux,
const struct bpf_map *map, bool unpriv)
{
BUILD_BUG_ON((unsigned long)BPF_MAP_PTR_POISON & BPF_MAP_PTR_UNPRIV);
unpriv |= bpf_map_ptr_unpriv(aux);
aux->map_state = (unsigned long)map |
(unpriv ? BPF_MAP_PTR_UNPRIV : 0UL);
}
| 18,093 |
156,508 | 0 | void SQLiteDatabase::SetBusyTimeout(int ms) {
if (db_)
sqlite3_busy_timeout(db_, ms);
else
SQL_DVLOG(1) << "BusyTimeout set on non-open database";
}
| 18,094 |
58,933 | 0 | static int l2cap_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type)
{
int exact = 0, lm1 = 0, lm2 = 0;
register struct sock *sk;
struct hlist_node *node;
if (type != ACL_LINK)
return 0;
BT_DBG("hdev %s, bdaddr %s", hdev->name, batostr(bdaddr));
/* Find listening sockets and check their link_mode */
read_lock(&l2cap_sk_list.lock);
sk_for_each(sk, node, &l2cap_sk_list.head) {
if (sk->sk_state != BT_LISTEN)
continue;
if (!bacmp(&bt_sk(sk)->src, &hdev->bdaddr)) {
lm1 |= HCI_LM_ACCEPT;
if (l2cap_pi(sk)->role_switch)
lm1 |= HCI_LM_MASTER;
exact++;
} else if (!bacmp(&bt_sk(sk)->src, BDADDR_ANY)) {
lm2 |= HCI_LM_ACCEPT;
if (l2cap_pi(sk)->role_switch)
lm2 |= HCI_LM_MASTER;
}
}
read_unlock(&l2cap_sk_list.lock);
return exact ? lm1 : lm2;
}
| 18,095 |
92,206 | 0 | static inline enum ib_mig_state to_ib_mig_state(int mlx5_mig_state)
{
switch (mlx5_mig_state) {
case MLX5_QP_PM_ARMED: return IB_MIG_ARMED;
case MLX5_QP_PM_REARM: return IB_MIG_REARM;
case MLX5_QP_PM_MIGRATED: return IB_MIG_MIGRATED;
default: return -1;
}
}
| 18,096 |
79,497 | 0 | int nntp_check_children(struct Context *ctx, const char *msgid)
{
struct NntpData *nntp_data = ctx->data;
struct ChildCtx cc;
char buf[STRING];
int rc;
bool quiet;
void *hc = NULL;
if (!nntp_data || !nntp_data->nserv)
return -1;
if (nntp_data->first_message > nntp_data->last_loaded)
return 0;
/* init context */
cc.ctx = ctx;
cc.num = 0;
cc.max = 10;
cc.child = mutt_mem_malloc(sizeof(anum_t) * cc.max);
/* fetch numbers of child messages */
snprintf(buf, sizeof(buf), "XPAT References %u-%u *%s*\r\n",
nntp_data->first_message, nntp_data->last_loaded, msgid);
rc = nntp_fetch_lines(nntp_data, buf, sizeof(buf), NULL, fetch_children, &cc);
if (rc)
{
FREE(&cc.child);
if (rc > 0)
{
if (mutt_str_strncmp("500", buf, 3) != 0)
mutt_error("XPAT: %s", buf);
else
{
mutt_error(_("Unable to find child articles because server does not "
"support XPAT command."));
}
}
return -1;
}
/* fetch all found messages */
quiet = ctx->quiet;
ctx->quiet = true;
#ifdef USE_HCACHE
hc = nntp_hcache_open(nntp_data);
#endif
for (int i = 0; i < cc.num; i++)
{
rc = nntp_fetch_headers(ctx, hc, cc.child[i], cc.child[i], 1);
if (rc < 0)
break;
}
#ifdef USE_HCACHE
mutt_hcache_close(hc);
#endif
ctx->quiet = quiet;
FREE(&cc.child);
return (rc < 0) ? -1 : 0;
}
| 18,097 |
182,369 | 1 | static int _6502_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len) {
char addrbuf[64];
const int buffsize = sizeof (addrbuf) - 1;
memset (op, '\0', sizeof (RAnalOp));
op->size = snes_op_get_size (1, 1, &snes_op[data[0]]); //snes-arch is similiar to nes/6502
op->addr = addr;
op->type = R_ANAL_OP_TYPE_UNK;
op->id = data[0];
r_strbuf_init (&op->esil);
switch (data[0]) {
case 0x02:
case 0x03:
case 0x04:
case 0x07:
case 0x0b:
case 0x0c:
case 0x0f:
case 0x12:
case 0x13:
case 0x14:
case 0x17:
case 0x1a:
case 0x1b:
case 0x1c:
case 0x1f:
case 0x22:
case 0x23:
case 0x27:
case 0x2b:
case 0x2f:
case 0x32:
case 0x33:
case 0x34:
case 0x37:
case 0x3a:
case 0x3b:
case 0x3c:
case 0x3f:
case 0x42:
case 0x43:
case 0x44:
case 0x47:
case 0x4b:
case 0x4f:
case 0x52:
case 0x53:
case 0x54:
case 0x57:
case 0x5a:
case 0x5b:
case 0x5c:
case 0x5f:
case 0x62:
case 0x63:
case 0x64:
case 0x67:
case 0x6b:
case 0x6f:
case 0x72:
case 0x73:
case 0x74:
case 0x77:
case 0x7a:
case 0x7b:
case 0x7c:
case 0x7f:
case 0x80:
case 0x82:
case 0x83:
case 0x87:
case 0x89:
case 0x8b:
case 0x8f:
case 0x92:
case 0x93:
case 0x97:
case 0x9b:
case 0x9c:
case 0x9e:
case 0x9f:
case 0xa3:
case 0xa7:
case 0xab:
case 0xaf:
case 0xb2:
case 0xb3:
case 0xb7:
case 0xbb:
case 0xbf:
case 0xc2:
case 0xc3:
case 0xc7:
case 0xcb:
case 0xcf:
case 0xd2:
case 0xd3:
case 0xd4:
case 0xd7:
case 0xda:
case 0xdb:
case 0xdc:
case 0xdf:
case 0xe2:
case 0xe3:
case 0xe7:
case 0xeb:
case 0xef:
case 0xf2:
case 0xf3:
case 0xf4:
case 0xf7:
case 0xfa:
case 0xfb:
case 0xfc:
case 0xff:
// undocumented or not-implemented opcodes for 6502.
// some of them might be implemented in 65816
op->size = 1;
op->type = R_ANAL_OP_TYPE_ILL;
break;
// BRK
case 0x00: // brk
op->cycles = 7;
op->type = R_ANAL_OP_TYPE_SWI;
// override 65816 code which seems to be wrong: size is 1, but pc = pc + 2
op->size = 1;
// PC + 2 to Stack, P to Stack B=1 D=0 I=1. "B" is not a flag. Only its bit is pushed on the stack
// PC was already incremented by one at this point. Needs to incremented once more
// New PC is Interrupt Vector: $fffe. (FIXME: Confirm this is valid for all 6502)
r_strbuf_set (&op->esil, ",1,I,=,0,D,=,flags,0x10,|,0x100,sp,+,=[1],pc,1,+,0xfe,sp,+,=[2],3,sp,-=,0xfffe,[2],pc,=");
break;
// FLAGS
case 0x78: // sei
case 0x58: // cli
case 0x38: // sec
case 0x18: // clc
case 0xf8: // sed
case 0xd8: // cld
case 0xb8: // clv
op->cycles = 2;
// FIXME: what opcode for this?
op->type = R_ANAL_OP_TYPE_NOP;
_6502_anal_esil_flags (op, data[0]);
break;
// BIT
case 0x24: // bit $ff
case 0x2c: // bit $ffff
op->type = R_ANAL_OP_TYPE_MOV;
_6502_anal_esil_get_addr_pattern3 (op, data, addrbuf, buffsize, 0);
r_strbuf_setf (&op->esil, "a,%s,[1],&,0x80,&,!,!,N,=,a,%s,[1],&,0x40,&,!,!,V,=,a,%s,[1],&,0xff,&,!,Z,=",addrbuf, addrbuf, addrbuf);
break;
// ADC
case 0x69: // adc #$ff
case 0x65: // adc $ff
case 0x75: // adc $ff,x
case 0x6d: // adc $ffff
case 0x7d: // adc $ffff,x
case 0x79: // adc $ffff,y
case 0x61: // adc ($ff,x)
case 0x71: // adc ($ff,y)
// FIXME: update V
// FIXME: support BCD mode
op->type = R_ANAL_OP_TYPE_ADD;
_6502_anal_esil_get_addr_pattern1 (op, data, addrbuf, buffsize);
if (data[0] == 0x69) // immediate mode
r_strbuf_setf (&op->esil, "%s,a,+=,C,NUM,$c7,C,=,a,+=,$c7,C,|=", addrbuf);
else r_strbuf_setf (&op->esil, "%s,[1],a,+=,C,NUM,$c7,C,=,a,+=,$c7,C,|=", addrbuf);
_6502_anal_update_flags (op, _6502_FLAGS_NZ);
// fix Z
r_strbuf_append (&op->esil, ",a,a,=,$z,Z,=");
break;
// SBC
case 0xe9: // sbc #$ff
case 0xe5: // sbc $ff
case 0xf5: // sbc $ff,x
case 0xed: // sbc $ffff
case 0xfd: // sbc $ffff,x
case 0xf9: // sbc $ffff,y
case 0xe1: // sbc ($ff,x)
case 0xf1: // sbc ($ff,y)
// FIXME: update V
// FIXME: support BCD mode
op->type = R_ANAL_OP_TYPE_SUB;
_6502_anal_esil_get_addr_pattern1 (op, data, addrbuf, buffsize);
if (data[0] == 0xe9) // immediate mode
r_strbuf_setf (&op->esil, "C,!,%s,+,a,-=", addrbuf);
else r_strbuf_setf (&op->esil, "C,!,%s,[1],+,a,-=", addrbuf);
_6502_anal_update_flags (op, _6502_FLAGS_BNZ);
// fix Z and revert C
r_strbuf_append (&op->esil, ",a,a,=,$z,Z,=,C,!=");
break;
// ORA
case 0x09: // ora #$ff
case 0x05: // ora $ff
case 0x15: // ora $ff,x
case 0x0d: // ora $ffff
case 0x1d: // ora $ffff,x
case 0x19: // ora $ffff,y
case 0x01: // ora ($ff,x)
case 0x11: // ora ($ff),y
op->type = R_ANAL_OP_TYPE_OR;
_6502_anal_esil_get_addr_pattern1 (op, data, addrbuf, buffsize);
if (data[0] == 0x09) // immediate mode
r_strbuf_setf (&op->esil, "%s,a,|=", addrbuf);
else r_strbuf_setf (&op->esil, "%s,[1],a,|=", addrbuf);
_6502_anal_update_flags (op, _6502_FLAGS_NZ);
break;
// AND
case 0x29: // and #$ff
case 0x25: // and $ff
case 0x35: // and $ff,x
case 0x2d: // and $ffff
case 0x3d: // and $ffff,x
case 0x39: // and $ffff,y
case 0x21: // and ($ff,x)
case 0x31: // and ($ff),y
op->type = R_ANAL_OP_TYPE_AND;
_6502_anal_esil_get_addr_pattern1 (op, data, addrbuf, buffsize);
if (data[0] == 0x29) // immediate mode
r_strbuf_setf (&op->esil, "%s,a,&=", addrbuf);
else r_strbuf_setf (&op->esil, "%s,[1],a,&=", addrbuf);
_6502_anal_update_flags (op, _6502_FLAGS_NZ);
break;
// EOR
case 0x49: // eor #$ff
case 0x45: // eor $ff
case 0x55: // eor $ff,x
case 0x4d: // eor $ffff
case 0x5d: // eor $ffff,x
case 0x59: // eor $ffff,y
case 0x41: // eor ($ff,x)
case 0x51: // eor ($ff),y
op->type = R_ANAL_OP_TYPE_XOR;
_6502_anal_esil_get_addr_pattern1 (op, data, addrbuf, buffsize);
if (data[0] == 0x49) // immediate mode
r_strbuf_setf (&op->esil, "%s,a,^=", addrbuf);
else r_strbuf_setf (&op->esil, "%s,[1],a,^=", addrbuf);
_6502_anal_update_flags (op, _6502_FLAGS_NZ);
break;
// ASL
case 0x0a: // asl a
case 0x06: // asl $ff
case 0x16: // asl $ff,x
case 0x0e: // asl $ffff
case 0x1e: // asl $ffff,x
op->type = R_ANAL_OP_TYPE_SHL;
if (data[0] == 0x0a) {
r_strbuf_set (&op->esil, "1,a,<<=,$c7,C,=,a,a,=");
} else {
_6502_anal_esil_get_addr_pattern2 (op, data, addrbuf, buffsize, 'x');
r_strbuf_setf (&op->esil, "1,%s,[1],<<,%s,=[1],$c7,C,=", addrbuf, addrbuf);
}
_6502_anal_update_flags (op, _6502_FLAGS_NZ);
break;
// LSR
case 0x4a: // lsr a
case 0x46: // lsr $ff
case 0x56: // lsr $ff,x
case 0x4e: // lsr $ffff
case 0x5e: // lsr $ffff,x
op->type = R_ANAL_OP_TYPE_SHR;
if (data[0] == 0x4a) {
r_strbuf_set (&op->esil, "1,a,&,C,=,1,a,>>=");
} else {
_6502_anal_esil_get_addr_pattern2 (op, data, addrbuf, buffsize, 'x');
r_strbuf_setf (&op->esil, "1,%s,[1],&,C,=,1,%s,[1],>>,%s,=[1]", addrbuf, addrbuf, addrbuf);
}
_6502_anal_update_flags (op, _6502_FLAGS_NZ);
break;
// ROL
case 0x2a: // rol a
case 0x26: // rol $ff
case 0x36: // rol $ff,x
case 0x2e: // rol $ffff
case 0x3e: // rol $ffff,x
op->type = R_ANAL_OP_TYPE_ROL;
if (data[0] == 0x2a) {
r_strbuf_set (&op->esil, "1,a,<<,C,|,a,=,$c7,C,=,a,a,=");
} else {
_6502_anal_esil_get_addr_pattern2 (op, data, addrbuf, buffsize, 'x');
r_strbuf_setf (&op->esil, "1,%s,[1],<<,C,|,%s,=[1],$c7,C,=", addrbuf, addrbuf);
}
_6502_anal_update_flags (op, _6502_FLAGS_NZ);
break;
// ROR
case 0x6a: // ror a
case 0x66: // ror $ff
case 0x76: // ror $ff,x
case 0x6e: // ror $ffff
case 0x7e: // ror $ffff,x
// uses N as temporary to hold C value. but in fact,
// it is not temporary since in all ROR ops, N will have the value of C
op->type = R_ANAL_OP_TYPE_ROR;
if (data[0] == 0x6a) {
r_strbuf_set (&op->esil, "C,N,=,1,a,&,C,=,1,a,>>,7,N,<<,|,a,=");
} else {
_6502_anal_esil_get_addr_pattern2 (op, data, addrbuf, buffsize, 'x');
r_strbuf_setf (&op->esil, "C,N,=,1,%s,[1],&,C,=,1,%s,[1],>>,7,N,<<,|,%s,=[1]", addrbuf, addrbuf, addrbuf);
}
_6502_anal_update_flags (op, _6502_FLAGS_NZ);
break;
// INC
case 0xe6: // inc $ff
case 0xf6: // inc $ff,x
case 0xee: // inc $ffff
case 0xfe: // inc $ffff,x
op->type = R_ANAL_OP_TYPE_STORE;
_6502_anal_esil_get_addr_pattern2 (op, data, addrbuf, buffsize, 'x');
r_strbuf_setf (&op->esil, "%s,++=[1]", addrbuf);
_6502_anal_update_flags (op, _6502_FLAGS_NZ);
break;
// DEC
case 0xc6: // dec $ff
case 0xd6: // dec $ff,x
case 0xce: // dec $ffff
case 0xde: // dec $ffff,x
op->type = R_ANAL_OP_TYPE_STORE;
_6502_anal_esil_get_addr_pattern2 (op, data, addrbuf, buffsize, 'x');
r_strbuf_setf (&op->esil, "%s,--=[1]", addrbuf);
_6502_anal_update_flags (op, _6502_FLAGS_NZ);
break;
// INX, INY
case 0xe8: // inx
case 0xc8: // iny
op->cycles = 2;
op->type = R_ANAL_OP_TYPE_STORE;
_6502_anal_esil_inc_reg (op, data[0], "+");
break;
// DEX, DEY
case 0xca: // dex
case 0x88: // dey
op->cycles = 2;
op->type = R_ANAL_OP_TYPE_STORE;
_6502_anal_esil_inc_reg (op, data[0], "-");
break;
// CMP
case 0xc9: // cmp #$ff
case 0xc5: // cmp $ff
case 0xd5: // cmp $ff,x
case 0xcd: // cmp $ffff
case 0xdd: // cmp $ffff,x
case 0xd9: // cmp $ffff,y
case 0xc1: // cmp ($ff,x)
case 0xd1: // cmp ($ff),y
op->type = R_ANAL_OP_TYPE_CMP;
_6502_anal_esil_get_addr_pattern1 (op, data, addrbuf, buffsize);
if (data[0] == 0xc9) // immediate mode
r_strbuf_setf (&op->esil, "%s,a,==", addrbuf);
else r_strbuf_setf (&op->esil, "%s,[1],a,==", addrbuf);
_6502_anal_update_flags (op, _6502_FLAGS_BNZ);
// invert C, since C=1 when A-M >= 0
r_strbuf_append (&op->esil, ",C,!,C,=");
break;
// CPX
case 0xe0: // cpx #$ff
case 0xe4: // cpx $ff
case 0xec: // cpx $ffff
op->type = R_ANAL_OP_TYPE_CMP;
_6502_anal_esil_get_addr_pattern3 (op, data, addrbuf, buffsize, 0);
if (data[0] == 0xe0) // immediate mode
r_strbuf_setf (&op->esil, "%s,x,==", addrbuf);
else r_strbuf_setf (&op->esil, "%s,[1],x,==", addrbuf);
_6502_anal_update_flags (op, _6502_FLAGS_BNZ);
// invert C, since C=1 when A-M >= 0
r_strbuf_append (&op->esil, ",C,!,C,=");
break;
// CPY
case 0xc0: // cpy #$ff
case 0xc4: // cpy $ff
case 0xcc: // cpy $ffff
op->type = R_ANAL_OP_TYPE_CMP;
_6502_anal_esil_get_addr_pattern3 (op, data, addrbuf, buffsize, 0);
if (data[0] == 0xc0) // immediate mode
r_strbuf_setf (&op->esil, "%s,y,==", addrbuf);
else r_strbuf_setf (&op->esil, "%s,[1],y,==", addrbuf);
_6502_anal_update_flags (op, _6502_FLAGS_BNZ);
// invert C, since C=1 when A-M >= 0
r_strbuf_append (&op->esil, ",C,!,C,=");
break;
// BRANCHES
case 0x10: // bpl $ffff
case 0x30: // bmi $ffff
case 0x50: // bvc $ffff
case 0x70: // bvs $ffff
case 0x90: // bcc $ffff
case 0xb0: // bcs $ffff
case 0xd0: // bne $ffff
case 0xf0: // beq $ffff
// FIXME: Add 1 if branch occurs to same page.
// FIXME: Add 2 if branch occurs to different page
op->cycles = 2;
op->failcycles = 3;
op->type = R_ANAL_OP_TYPE_CJMP;
if (data[1] <= 127)
op->jump = addr + data[1] + op->size;
else op->jump = addr - (256 - data[1]) + op->size;
op->fail = addr + op->size;
// FIXME: add a type of conditional
// op->cond = R_ANAL_COND_LE;
_6502_anal_esil_ccall (op, data[0]);
break;
// JSR
case 0x20: // jsr $ffff
op->cycles = 6;
op->type = R_ANAL_OP_TYPE_CALL;
op->jump = data[1] | data[2] << 8;
op->stackop = R_ANAL_STACK_INC;
op->stackptr = 2;
// JSR pushes the address-1 of the next operation on to the stack before transferring program
// control to the following address
// stack is on page one and sp is an 8-bit reg: operations must be done like: sp + 0x100
r_strbuf_setf (&op->esil, "1,pc,-,0xff,sp,+,=[2],0x%04x,pc,=,2,sp,-=", op->jump);
break;
// JMP
case 0x4c: // jmp $ffff
op->cycles = 3;
op->type = R_ANAL_OP_TYPE_JMP;
op->jump = data[1] | data[2] << 8;
r_strbuf_setf (&op->esil, "0x%04x,pc,=", op->jump);
break;
case 0x6c: // jmp ($ffff)
op->cycles = 5;
op->type = R_ANAL_OP_TYPE_UJMP;
// FIXME: how to read memory?
// op->jump = data[1] | data[2] << 8;
r_strbuf_setf (&op->esil, "0x%04x,[2],pc,=", data[1] | data[2] << 8);
break;
// RTS
case 0x60: // rts
op->eob = true;
op->type = R_ANAL_OP_TYPE_RET;
op->cycles = 6;
op->stackop = R_ANAL_STACK_INC;
op->stackptr = -2;
// Operation: PC from Stack, PC + 1 -> PC
// stack is on page one and sp is an 8-bit reg: operations must be done like: sp + 0x100
r_strbuf_set (&op->esil, "0x101,sp,+,[2],pc,=,pc,++=,2,sp,+=");
break;
// RTI
case 0x40: // rti
op->eob = true;
op->type = R_ANAL_OP_TYPE_RET;
op->cycles = 6;
op->stackop = R_ANAL_STACK_INC;
op->stackptr = -3;
// Operation: P from Stack, PC from Stack
// stack is on page one and sp is an 8-bit reg: operations must be done like: sp + 0x100
r_strbuf_set (&op->esil, "0x101,sp,+,[1],flags,=,0x102,sp,+,[2],pc,=,3,sp,+=");
break;
// NOP
case 0xea: // nop
op->type = R_ANAL_OP_TYPE_NOP;
op->cycles = 2;
break;
// LDA
case 0xa9: // lda #$ff
case 0xa5: // lda $ff
case 0xb5: // lda $ff,x
case 0xad: // lda $ffff
case 0xbd: // lda $ffff,x
case 0xb9: // lda $ffff,y
case 0xa1: // lda ($ff,x)
case 0xb1: // lda ($ff),y
op->type = R_ANAL_OP_TYPE_LOAD;
_6502_anal_esil_get_addr_pattern1 (op, data, addrbuf, buffsize);
if (data[0] == 0xa9) // immediate mode
r_strbuf_setf (&op->esil, "%s,a,=", addrbuf);
else r_strbuf_setf (&op->esil, "%s,[1],a,=", addrbuf);
_6502_anal_update_flags (op, _6502_FLAGS_NZ);
break;
// LDX
case 0xa2: // ldx #$ff
case 0xa6: // ldx $ff
case 0xb6: // ldx $ff,y
case 0xae: // ldx $ffff
case 0xbe: // ldx $ffff,y
op->type = R_ANAL_OP_TYPE_LOAD;
_6502_anal_esil_get_addr_pattern2 (op, data, addrbuf, buffsize, 'y');
if (data[0] == 0xa2) // immediate mode
r_strbuf_setf (&op->esil, "%s,x,=", addrbuf);
else r_strbuf_setf (&op->esil, "%s,[1],x,=", addrbuf);
_6502_anal_update_flags (op, _6502_FLAGS_NZ);
break;
// LDY
case 0xa0: // ldy #$ff
case 0xa4: // ldy $ff
case 0xb4: // ldy $ff,x
case 0xac: // ldy $ffff
case 0xbc: // ldy $ffff,x
op->type = R_ANAL_OP_TYPE_LOAD;
_6502_anal_esil_get_addr_pattern3 (op, data, addrbuf, buffsize, 'x');
if (data[0] == 0xa0) // immediate mode
r_strbuf_setf (&op->esil, "%s,y,=", addrbuf);
else r_strbuf_setf (&op->esil, "%s,[1],y,=", addrbuf);
_6502_anal_update_flags (op, _6502_FLAGS_NZ);
break;
// STA
case 0x85: // sta $ff
case 0x95: // sta $ff,x
case 0x8d: // sta $ffff
case 0x9d: // sta $ffff,x
case 0x99: // sta $ffff,y
case 0x81: // sta ($ff,x)
case 0x91: // sta ($ff),y
op->type = R_ANAL_OP_TYPE_STORE;
_6502_anal_esil_get_addr_pattern1 (op, data, addrbuf, buffsize);
r_strbuf_setf (&op->esil, "a,%s,=[1]", addrbuf);
break;
// STX
case 0x86: // stx $ff
case 0x96: // stx $ff,y
case 0x8e: // stx $ffff
op->type = R_ANAL_OP_TYPE_STORE;
_6502_anal_esil_get_addr_pattern2 (op, data, addrbuf, buffsize, 'y');
r_strbuf_setf (&op->esil, "x,%s,=[1]", addrbuf);
break;
// STY
case 0x84: // sty $ff
case 0x94: // sty $ff,x
case 0x8c: // sty $ffff
op->type = R_ANAL_OP_TYPE_STORE;
_6502_anal_esil_get_addr_pattern3 (op, data, addrbuf, buffsize, 'x');
r_strbuf_setf (&op->esil, "y,%s,=[1]", addrbuf);
break;
// PHP/PHA
case 0x08: // php
case 0x48: // pha
op->type = R_ANAL_OP_TYPE_PUSH;
op->cycles = 3;
op->stackop = R_ANAL_STACK_INC;
op->stackptr = 1;
_6502_anal_esil_push (op, data[0]);
break;
// PLP,PLA
case 0x28: // plp
case 0x68: // plp
op->type = R_ANAL_OP_TYPE_POP;
op->cycles = 4;
op->stackop = R_ANAL_STACK_INC;
op->stackptr = -1;
_6502_anal_esil_pop (op, data[0]);
break;
// TAX,TYA,...
case 0xaa: // tax
case 0x8a: // txa
case 0xa8: // tay
case 0x98: // tya
op->type = R_ANAL_OP_TYPE_MOV;
op->cycles = 2;
_6502_anal_esil_mov (op, data[0]);
break;
case 0x9a: // txs
op->type = R_ANAL_OP_TYPE_MOV;
op->cycles = 2;
op->stackop = R_ANAL_STACK_SET;
// FIXME: should I get register X a place it here?
// op->stackptr = get_register_x();
_6502_anal_esil_mov (op, data[0]);
break;
case 0xba: // tsx
op->type = R_ANAL_OP_TYPE_MOV;
op->cycles = 2;
op->stackop = R_ANAL_STACK_GET;
_6502_anal_esil_mov (op, data[0]);
break;
}
return op->size;
}
| 18,098 |
26,485 | 0 | static u32 pmcraid_read_interrupts(struct pmcraid_instance *pinstance)
{
return (pinstance->interrupt_mode) ?
ioread32(pinstance->int_regs.ioa_host_msix_interrupt_reg) :
ioread32(pinstance->int_regs.ioa_host_interrupt_reg);
}
| 18,099 |
Subsets and Splits