unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
121,634 | 0 | PassRefPtr<Range> BackwardsCharacterIterator::range() const
{
RefPtr<Range> r = m_textIterator.range();
if (!m_textIterator.atEnd()) {
if (m_textIterator.length() <= 1)
ASSERT(m_runOffset == 0);
else {
Node* n = r->startContainer();
ASSERT(n == r->endContainer());
int offset = r->endOffset() - m_runOffset;
r->setStart(n, offset - 1, ASSERT_NO_EXCEPTION);
r->setEnd(n, offset, ASSERT_NO_EXCEPTION);
}
}
return r.release();
}
| 15,800 |
15,045 | 0 | PHP_FUNCTION(dom_document_get_elements_by_tag_name)
{
zval *id;
xmlDocPtr docp;
int name_len;
dom_object *intern, *namednode;
char *name;
xmlChar *local;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &name, &name_len) == FAILURE) {
return;
}
DOM_GET_OBJ(docp, id, xmlDocPtr, intern);
php_dom_create_interator(return_value, DOM_NODELIST TSRMLS_CC);
namednode = (dom_object *)zend_objects_get_address(return_value TSRMLS_CC);
local = xmlCharStrndup(name, name_len);
dom_namednode_iter(intern, 0, namednode, NULL, local, NULL TSRMLS_CC);
}
| 15,801 |
92,915 | 0 | bitmap_decompress1(uint8 * output, int width, int height, uint8 * input, int size)
{
uint8 *end = input + size;
uint8 *prevline = NULL, *line = NULL;
int opcode, count, offset, isfillormix, x = width;
int lastopcode = -1, insertmix = False, bicolour = False;
uint8 code;
uint8 colour1 = 0, colour2 = 0;
uint8 mixmask, mask = 0;
uint8 mix = 0xff;
int fom_mask = 0;
while (input < end)
{
fom_mask = 0;
code = CVAL(input);
opcode = code >> 4;
/* Handle different opcode forms */
switch (opcode)
{
case 0xc:
case 0xd:
case 0xe:
opcode -= 6;
count = code & 0xf;
offset = 16;
break;
case 0xf:
opcode = code & 0xf;
if (opcode < 9)
{
count = CVAL(input);
count |= CVAL(input) << 8;
}
else
{
count = (opcode < 0xb) ? 8 : 1;
}
offset = 0;
break;
default:
opcode >>= 1;
count = code & 0x1f;
offset = 32;
break;
}
/* Handle strange cases for counts */
if (offset != 0)
{
isfillormix = ((opcode == 2) || (opcode == 7));
if (count == 0)
{
if (isfillormix)
count = CVAL(input) + 1;
else
count = CVAL(input) + offset;
}
else if (isfillormix)
{
count <<= 3;
}
}
/* Read preliminary data */
switch (opcode)
{
case 0: /* Fill */
if ((lastopcode == opcode) && !((x == width) && (prevline == NULL)))
insertmix = True;
break;
case 8: /* Bicolour */
colour1 = CVAL(input);
colour2 = CVAL(input);
break;
case 3: /* Colour */
colour2 = CVAL(input);
break;
case 6: /* SetMix/Mix */
case 7: /* SetMix/FillOrMix */
mix = CVAL(input);
opcode -= 5;
break;
case 9: /* FillOrMix_1 */
mask = 0x03;
opcode = 0x02;
fom_mask = 3;
break;
case 0x0a: /* FillOrMix_2 */
mask = 0x05;
opcode = 0x02;
fom_mask = 5;
break;
}
lastopcode = opcode;
mixmask = 0;
/* Output body */
while (count > 0)
{
if (x >= width)
{
if (height <= 0)
return False;
x = 0;
height--;
prevline = line;
line = output + height * width;
}
switch (opcode)
{
case 0: /* Fill */
if (insertmix)
{
if (prevline == NULL)
line[x] = mix;
else
line[x] = prevline[x] ^ mix;
insertmix = False;
count--;
x++;
}
if (prevline == NULL)
{
REPEAT(line[x] = 0)
}
else
{
REPEAT(line[x] = prevline[x])
}
break;
case 1: /* Mix */
if (prevline == NULL)
{
REPEAT(line[x] = mix)
}
else
{
REPEAT(line[x] = prevline[x] ^ mix)
}
break;
case 2: /* Fill or Mix */
if (prevline == NULL)
{
REPEAT
(
MASK_UPDATE();
if (mask & mixmask)
line[x] = mix;
else
line[x] = 0;
)
}
else
{
REPEAT
(
MASK_UPDATE();
if (mask & mixmask)
line[x] = prevline[x] ^ mix;
else
line[x] = prevline[x];
)
}
break;
case 3: /* Colour */
REPEAT(line[x] = colour2)
break;
case 4: /* Copy */
REPEAT(line[x] = CVAL(input))
break;
case 8: /* Bicolour */
REPEAT
(
if (bicolour)
{
line[x] = colour2;
bicolour = False;
}
else
{
line[x] = colour1;
bicolour = True; count++;
}
)
break;
case 0xd: /* White */
REPEAT(line[x] = 0xff)
break;
case 0xe: /* Black */
REPEAT(line[x] = 0)
break;
default:
logger(Core, Warning, "bitmap_decompress(), unhandled bitmap opcode 0x%x", opcode);
return False;
}
}
}
return True;
}
| 15,802 |
157,292 | 0 | bool WebMediaPlayerImpl::Paused() const {
DCHECK(main_task_runner_->BelongsToCurrentThread());
#if defined(OS_ANDROID) // WMPI_CAST
if (IsRemote())
return cast_impl_.IsPaused();
#endif
return pipeline_controller_.GetPlaybackRate() == 0.0f;
}
| 15,803 |
1,073 | 0 | void GfxDeviceGrayColorSpace::getRGBLine(Guchar *in, unsigned int *out,
int length) {
int i;
for (i = 0; i < length; i++)
out[i] = (in[i] << 16) | (in[i] << 8) | (in[i] << 0);
}
| 15,804 |
160,463 | 0 | void RenderFrameHostImpl::OnDidStopLoading() {
TRACE_EVENT1("navigation", "RenderFrameHostImpl::OnDidStopLoading",
"frame_tree_node", frame_tree_node_->frame_tree_node_id());
if (!is_loading_) {
LOG(WARNING) << "OnDidStopLoading was called twice.";
return;
}
is_loading_ = false;
navigation_request_.reset();
if (is_active())
frame_tree_node_->DidStopLoading();
}
| 15,805 |
148,231 | 0 | BrowserPpapiHost* BrowserPpapiHost::CreateExternalPluginProcess(
IPC::Sender* sender,
ppapi::PpapiPermissions permissions,
base::ProcessHandle plugin_child_process,
IPC::ChannelProxy* channel,
int render_process_id,
int render_view_id,
const base::FilePath& profile_directory) {
BrowserPpapiHostImpl* browser_ppapi_host =
new BrowserPpapiHostImpl(sender,
permissions,
std::string(),
base::FilePath(),
profile_directory,
false /* in_process */,
true /* external_plugin */);
browser_ppapi_host->set_plugin_process(
base::Process::DeprecatedGetProcessFromHandle(plugin_child_process));
scoped_refptr<PepperMessageFilter> pepper_message_filter(
new PepperMessageFilter());
channel->AddFilter(pepper_message_filter->GetFilter());
channel->AddFilter(browser_ppapi_host->message_filter().get());
channel->AddFilter((new TraceMessageFilter(render_process_id))->GetFilter());
return browser_ppapi_host;
}
| 15,806 |
66,148 | 0 | static inline int is_digit(char ch)
{
return (ch >= '0') && (ch <= '9');
}
| 15,807 |
105,608 | 0 | WebDriverCommand::~WebDriverCommand() {}
| 15,808 |
3,207 | 0 | ztypenames(i_ctx_t *i_ctx_p)
{
os_ptr op = osp;
static const char *const tnames[] = { REF_TYPE_NAME_STRINGS };
int i;
check_ostack(t_next_index);
for (i = 0; i < t_next_index; i++) {
ref *const rtnp = op + 1 + i;
if (i >= countof(tnames) || tnames[i] == 0)
make_null(rtnp);
else {
int code = name_enter_string(imemory, tnames[i], rtnp);
if (code < 0)
return code;
r_set_attrs(rtnp, a_executable);
}
}
osp += t_next_index;
return 0;
}
| 15,809 |
118,964 | 0 | void WebContentsImpl::NotifyNavigationStateChanged(unsigned changed_flags) {
if (delegate_)
delegate_->NavigationStateChanged(this, changed_flags);
}
| 15,810 |
174,801 | 0 | virtual status_t setConsumerUsageBits(uint32_t usage) {
Parcel data, reply;
data.writeInterfaceToken(IGraphicBufferConsumer::getInterfaceDescriptor());
data.writeInt32(usage);
status_t result = remote()->transact(SET_CONSUMER_USAGE_BITS, data, &reply);
if (result != NO_ERROR) {
return result;
}
return reply.readInt32();
}
| 15,811 |
155,502 | 0 | int64_t DataReductionProxySettings::GetDataReductionLastUpdateTime() {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(data_reduction_proxy_service_->compression_stats());
return
data_reduction_proxy_service_->compression_stats()->GetLastUpdateTime();
}
| 15,812 |
67,124 | 0 | i2flac24_array (const int *src, int32_t *dest, int count)
{ while (--count >= 0)
dest [count] = src [count] >> 8 ;
} /* i2flac24_array */
| 15,813 |
169,405 | 0 | ~SynchronizeVisualPropertiesMessageFilter() {}
| 15,814 |
154,555 | 0 | error::Error GLES2DecoderPassthroughImpl::DoBeginRasterCHROMIUM(
GLuint texture_id,
GLuint sk_color,
GLuint msaa_sample_count,
GLboolean can_use_lcd_text,
GLint color_type) {
NOTIMPLEMENTED();
return error::kNoError;
}
| 15,815 |
38,213 | 0 | futex_wake_op(u32 __user *uaddr1, unsigned int flags, u32 __user *uaddr2,
int nr_wake, int nr_wake2, int op)
{
union futex_key key1 = FUTEX_KEY_INIT, key2 = FUTEX_KEY_INIT;
struct futex_hash_bucket *hb1, *hb2;
struct futex_q *this, *next;
int ret, op_ret;
retry:
ret = get_futex_key(uaddr1, flags & FLAGS_SHARED, &key1, VERIFY_READ);
if (unlikely(ret != 0))
goto out;
ret = get_futex_key(uaddr2, flags & FLAGS_SHARED, &key2, VERIFY_WRITE);
if (unlikely(ret != 0))
goto out_put_key1;
hb1 = hash_futex(&key1);
hb2 = hash_futex(&key2);
retry_private:
double_lock_hb(hb1, hb2);
op_ret = futex_atomic_op_inuser(op, uaddr2);
if (unlikely(op_ret < 0)) {
double_unlock_hb(hb1, hb2);
#ifndef CONFIG_MMU
/*
* we don't get EFAULT from MMU faults if we don't have an MMU,
* but we might get them from range checking
*/
ret = op_ret;
goto out_put_keys;
#endif
if (unlikely(op_ret != -EFAULT)) {
ret = op_ret;
goto out_put_keys;
}
ret = fault_in_user_writeable(uaddr2);
if (ret)
goto out_put_keys;
if (!(flags & FLAGS_SHARED))
goto retry_private;
put_futex_key(&key2);
put_futex_key(&key1);
goto retry;
}
plist_for_each_entry_safe(this, next, &hb1->chain, list) {
if (match_futex (&this->key, &key1)) {
if (this->pi_state || this->rt_waiter) {
ret = -EINVAL;
goto out_unlock;
}
wake_futex(this);
if (++ret >= nr_wake)
break;
}
}
if (op_ret > 0) {
op_ret = 0;
plist_for_each_entry_safe(this, next, &hb2->chain, list) {
if (match_futex (&this->key, &key2)) {
if (this->pi_state || this->rt_waiter) {
ret = -EINVAL;
goto out_unlock;
}
wake_futex(this);
if (++op_ret >= nr_wake2)
break;
}
}
ret += op_ret;
}
out_unlock:
double_unlock_hb(hb1, hb2);
out_put_keys:
put_futex_key(&key2);
out_put_key1:
put_futex_key(&key1);
out:
return ret;
}
| 15,816 |
125,057 | 0 | static int synthesizedBaselineFromContentBox(const RenderBox* box, LineDirectionMode direction)
{
return direction == HorizontalLine ? box->borderTop() + box->paddingTop() + box->contentHeight() : box->borderRight() + box->paddingRight() + box->contentWidth();
}
| 15,817 |
151,494 | 0 | void WorkerFetchContext::DispatchDidReceiveEncodedData(
unsigned long identifier,
int encoded_data_length) {
probe::didReceiveEncodedDataLength(global_scope_, identifier,
encoded_data_length);
}
| 15,818 |
116,562 | 0 | TestInterstitialPage(TabContents* tab,
bool new_navigation,
const GURL& url,
InterstitialState* state,
bool* deleted)
: InterstitialPageImpl(
tab, new_navigation, url,
new TestInterstitialPageDelegate(this)),
state_(state),
deleted_(deleted),
command_received_count_(0),
delegate_(NULL) {
*state_ = UNDECIDED;
*deleted_ = false;
}
| 15,819 |
108,391 | 0 | static int ScaleChannel(int channel, int volume) {
return static_cast<int>((static_cast<Fixed>(channel) * volume) >> 16);
}
| 15,820 |
125,555 | 0 | FeedToFileResourceMapUmaStats::~FeedToFileResourceMapUmaStats() {
}
| 15,821 |
19,241 | 0 | netlink_lock_table(void)
{
/* read_lock() synchronizes us to netlink_table_grab */
read_lock(&nl_table_lock);
atomic_inc(&nl_table_users);
read_unlock(&nl_table_lock);
}
| 15,822 |
172,569 | 0 | int32_t SoftAAC2::outputDelayRingBufferSamplesAvailable() {
return mOutputDelayRingBufferFilled;
}
| 15,823 |
126,321 | 0 | FindBar* BrowserWindowGtk::CreateFindBar() {
return new FindBarGtk(this);
}
| 15,824 |
52,388 | 0 | static inline bool unconditional(const struct ipt_entry *e)
{
static const struct ipt_ip uncond;
return e->target_offset == sizeof(struct ipt_entry) &&
memcmp(&e->ip, &uncond, sizeof(uncond)) == 0;
#undef FWINV
}
| 15,825 |
71,193 | 0 | static struct kvm_memslots *kvm_alloc_memslots(void)
{
int i;
struct kvm_memslots *slots;
slots = kvm_kvzalloc(sizeof(struct kvm_memslots));
if (!slots)
return NULL;
/*
* Init kvm generation close to the maximum to easily test the
* code of handling generation number wrap-around.
*/
slots->generation = -150;
for (i = 0; i < KVM_MEM_SLOTS_NUM; i++)
slots->id_to_index[i] = slots->memslots[i].id = i;
return slots;
}
| 15,826 |
29,604 | 0 | void ip_send_check(struct iphdr *iph)
{
iph->check = 0;
iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl);
}
| 15,827 |
31,125 | 0 | void fb_append_extra_logo(const struct linux_logo *logo, unsigned int n)
{
if (!n || fb_logo_ex_num == FB_LOGO_EX_NUM_MAX)
return;
fb_logo_ex[fb_logo_ex_num].logo = logo;
fb_logo_ex[fb_logo_ex_num].n = n;
fb_logo_ex_num++;
}
| 15,828 |
49,794 | 0 | static uint8_t arcmsr_hbaD_abort_allcmd(struct AdapterControlBlock *pACB)
{
struct MessageUnit_D *reg = pACB->pmuD;
writel(ARCMSR_INBOUND_MESG0_ABORT_CMD, reg->inbound_msgaddr0);
if (!arcmsr_hbaD_wait_msgint_ready(pACB)) {
pr_notice("arcmsr%d: wait 'abort all outstanding "
"command' timeout\n", pACB->host->host_no);
return false;
}
return true;
}
| 15,829 |
59,483 | 0 | xmlParseEndTag2(xmlParserCtxtPtr ctxt, const xmlChar *prefix,
const xmlChar *URI, int line, int nsNr, int tlen) {
const xmlChar *name;
size_t curLength;
GROW;
if ((RAW != '<') || (NXT(1) != '/')) {
xmlFatalErr(ctxt, XML_ERR_LTSLASH_REQUIRED, NULL);
return;
}
SKIP(2);
curLength = ctxt->input->end - ctxt->input->cur;
if ((tlen > 0) && (curLength >= (size_t)tlen) &&
(xmlStrncmp(ctxt->input->cur, ctxt->name, tlen) == 0)) {
if ((curLength >= (size_t)(tlen + 1)) &&
(ctxt->input->cur[tlen] == '>')) {
ctxt->input->cur += tlen + 1;
ctxt->input->col += tlen + 1;
goto done;
}
ctxt->input->cur += tlen;
ctxt->input->col += tlen;
name = (xmlChar*)1;
} else {
if (prefix == NULL)
name = xmlParseNameAndCompare(ctxt, ctxt->name);
else
name = xmlParseQNameAndCompare(ctxt, ctxt->name, prefix);
}
/*
* We should definitely be at the ending "S? '>'" part
*/
GROW;
if (ctxt->instate == XML_PARSER_EOF)
return;
SKIP_BLANKS;
if ((!IS_BYTE_CHAR(RAW)) || (RAW != '>')) {
xmlFatalErr(ctxt, XML_ERR_GT_REQUIRED, NULL);
} else
NEXT1;
/*
* [ WFC: Element Type Match ]
* The Name in an element's end-tag must match the element type in the
* start-tag.
*
*/
if (name != (xmlChar*)1) {
if (name == NULL) name = BAD_CAST "unparseable";
if ((line == 0) && (ctxt->node != NULL))
line = ctxt->node->line;
xmlFatalErrMsgStrIntStr(ctxt, XML_ERR_TAG_NAME_MISMATCH,
"Opening and ending tag mismatch: %s line %d and %s\n",
ctxt->name, line, name);
}
/*
* SAX: End of Tag
*/
done:
if ((ctxt->sax != NULL) && (ctxt->sax->endElementNs != NULL) &&
(!ctxt->disableSAX))
ctxt->sax->endElementNs(ctxt->userData, ctxt->name, prefix, URI);
spacePop(ctxt);
if (nsNr != 0)
nsPop(ctxt, nsNr);
return;
}
| 15,830 |
85,251 | 0 | void alloc_nid_failed(struct f2fs_sb_info *sbi, nid_t nid)
{
struct f2fs_nm_info *nm_i = NM_I(sbi);
struct free_nid *i;
bool need_free = false;
if (!nid)
return;
spin_lock(&nm_i->nid_list_lock);
i = __lookup_free_nid_list(nm_i, nid);
f2fs_bug_on(sbi, !i);
if (!available_free_memory(sbi, FREE_NIDS)) {
__remove_nid_from_list(sbi, i, ALLOC_NID_LIST, false);
need_free = true;
} else {
__remove_nid_from_list(sbi, i, ALLOC_NID_LIST, true);
i->state = NID_NEW;
__insert_nid_to_list(sbi, i, FREE_NID_LIST, false);
}
nm_i->available_nids++;
update_free_nid_bitmap(sbi, nid, true, false);
spin_unlock(&nm_i->nid_list_lock);
if (need_free)
kmem_cache_free(free_nid_slab, i);
}
| 15,831 |
97,200 | 0 | void WebFrameLoaderClient::dispatchDidReceiveTitle(const String& title) {
if (webframe_->client()) {
webframe_->client()->didReceiveTitle(
webframe_, webkit_glue::StringToWebString(title));
}
}
| 15,832 |
48,787 | 0 | int dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
{
return __dev_forward_skb(dev, skb) ?: netif_rx_internal(skb);
}
| 15,833 |
164,860 | 0 | void SetFilterCallback(const FilterCallback& callback) {
callback_ = callback;
}
| 15,834 |
70 | 0 | static timelib_sll timelib_get_nr(char **ptr, int max_length)
{
char *begin, *end, *str;
timelib_sll tmp_nr = TIMELIB_UNSET;
int len = 0;
while ((**ptr < '0') || (**ptr > '9')) {
if (**ptr == '\0') {
return TIMELIB_UNSET;
}
++*ptr;
}
begin = *ptr;
while ((**ptr >= '0') && (**ptr <= '9') && len < max_length) {
++*ptr;
++len;
}
end = *ptr;
str = calloc(1, end - begin + 1);
memcpy(str, begin, end - begin);
tmp_nr = strtoll(str, NULL, 10);
free(str);
return tmp_nr;
}
| 15,835 |
82,597 | 0 | int espruino_snprintf( char * s, size_t n, const char * fmt, ... ) {
espruino_snprintf_data d;
d.outPtr = s;
d.idx = 0;
d.len = n;
va_list argp;
va_start(argp, fmt);
vcbprintf(espruino_snprintf_cb,&d, fmt, argp);
va_end(argp);
if (d.idx < d.len) d.outPtr[d.idx] = 0;
else d.outPtr[d.len-1] = 0;
return (int)d.idx;
}
| 15,836 |
19,807 | 0 | int _nfs4_call_sync_session(struct rpc_clnt *clnt,
struct nfs_server *server,
struct rpc_message *msg,
struct nfs4_sequence_args *args,
struct nfs4_sequence_res *res,
int cache_reply)
{
nfs41_init_sequence(args, res, cache_reply);
return nfs4_call_sync_sequence(clnt, server, msg, args, res, 0);
}
| 15,837 |
58,135 | 0 | static inline void check_class_changed(struct rq *rq, struct task_struct *p,
const struct sched_class *prev_class,
int oldprio)
{
if (prev_class != p->sched_class) {
if (prev_class->switched_from)
prev_class->switched_from(rq, p);
p->sched_class->switched_to(rq, p);
} else if (oldprio != p->prio || dl_task(p))
p->sched_class->prio_changed(rq, p, oldprio);
}
| 15,838 |
170,028 | 0 | xsltFreeGlobalVariables(xsltTransformContextPtr ctxt) {
xmlHashFree(ctxt->globalVars, (xmlHashDeallocator) xsltFreeStackElem);
}
| 15,839 |
154,455 | 0 | GLES2DecoderPassthroughImpl::GetFramebufferManager() {
return nullptr;
}
| 15,840 |
143,712 | 0 | void RenderWidgetHostImpl::SetTouchEventEmulationEnabled(
bool enabled, ui::GestureProviderConfigType config_type) {
if (enabled) {
if (!touch_emulator_) {
touch_emulator_.reset(new TouchEmulator(
this,
view_.get() ? content::GetScaleFactorForView(view_.get()) : 1.0f));
}
touch_emulator_->Enable(config_type);
} else {
if (touch_emulator_)
touch_emulator_->Disable();
}
}
| 15,841 |
25,957 | 0 | __find_swevent_head(struct swevent_hlist *hlist, u64 type, u32 event_id)
{
u64 hash = swevent_hash(type, event_id);
return &hlist->heads[hash];
}
| 15,842 |
113,432 | 0 | IBusBus* InputMethodIBus::GetBus() {
static IBusBus* ibus = NULL;
if (!ibus) {
ibus = ibus_client_->GetConnection();
DCHECK(ibus);
}
return ibus;
}
| 15,843 |
129,312 | 0 | void GLES2DecoderImpl::DoSampleCoverage(GLclampf value, GLboolean invert) {
state_.sample_coverage_value = std::min(1.0f, std::max(0.0f, value));
state_.sample_coverage_invert = (invert != 0);
glSampleCoverage(state_.sample_coverage_value, invert);
}
| 15,844 |
26,369 | 0 | static void update_rq_clock_task(struct rq *rq, s64 delta)
{
s64 irq_delta;
irq_delta = irq_time_read(cpu_of(rq)) - rq->prev_irq_time;
/*
* Since irq_time is only updated on {soft,}irq_exit, we might run into
* this case when a previous update_rq_clock() happened inside a
* {soft,}irq region.
*
* When this happens, we stop ->clock_task and only update the
* prev_irq_time stamp to account for the part that fit, so that a next
* update will consume the rest. This ensures ->clock_task is
* monotonic.
*
* It does however cause some slight miss-attribution of {soft,}irq
* time, a more accurate solution would be to update the irq_time using
* the current rq->clock timestamp, except that would require using
* atomic ops.
*/
if (irq_delta > delta)
irq_delta = delta;
rq->prev_irq_time += irq_delta;
delta -= irq_delta;
rq->clock_task += delta;
if (irq_delta && sched_feat(NONIRQ_POWER))
sched_rt_avg_update(rq, irq_delta);
}
| 15,845 |
6,097 | 0 | e1000e_vm_state_change(void *opaque, int running, RunState state)
{
E1000ECore *core = opaque;
if (running) {
trace_e1000e_vm_state_running();
e1000e_intrmgr_resume(core);
e1000e_autoneg_resume(core);
} else {
trace_e1000e_vm_state_stopped();
e1000e_autoneg_pause(core);
e1000e_intrmgr_pause(core);
}
}
| 15,846 |
150,033 | 0 | void LayerTreeHostImpl::SetDebugState(
const LayerTreeDebugState& new_debug_state) {
if (LayerTreeDebugState::Equal(debug_state_, new_debug_state))
return;
debug_state_ = new_debug_state;
UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy());
SetFullViewportDamage();
}
| 15,847 |
48,644 | 0 | static void h2_session_ev_mpm_stopping(h2_session *session, int arg, const char *msg)
{
switch (session->state) {
case H2_SESSION_ST_DONE:
/* nop */
break;
default:
h2_session_shutdown_notice(session);
break;
}
}
| 15,848 |
3,734 | 0 | _dbus_exit (int code)
{
_exit (code);
}
| 15,849 |
121,331 | 0 | void WebURLLoaderImpl::didChangePriority(WebURLRequest::Priority new_priority) {
context_->DidChangePriority(new_priority);
}
| 15,850 |
21,547 | 0 | void emergency_restart(void)
{
kmsg_dump(KMSG_DUMP_EMERG);
machine_emergency_restart();
}
| 15,851 |
130,545 | 0 | void DisplayItemList::replay(GraphicsContext& context)
{
TRACE_EVENT0("blink,benchmark", "DisplayItemList::replay");
ASSERT(m_newDisplayItems.isEmpty());
for (DisplayItem& displayItem : m_currentDisplayItems)
displayItem.replay(context);
}
| 15,852 |
128,062 | 0 | void AwContents::ShowGeolocationPrompt(const GURL& requesting_frame,
base::Callback<void(bool)> callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
GURL origin = requesting_frame.GetOrigin();
bool show_prompt = pending_geolocation_prompts_.empty();
pending_geolocation_prompts_.push_back(OriginCallback(origin, callback));
if (show_prompt) {
ShowGeolocationPromptHelper(java_ref_, origin);
}
}
| 15,853 |
80,702 | 0 | GF_Err ctts_dump(GF_Box *a, FILE * trace)
{
GF_CompositionOffsetBox *p;
u32 i, nb_samples;
p = (GF_CompositionOffsetBox *)a;
gf_isom_box_dump_start(a, "CompositionOffsetBox", trace);
fprintf(trace, "EntryCount=\"%d\">\n", p->nb_entries);
nb_samples = 0;
for (i=0; i<p->nb_entries; i++) {
fprintf(trace, "<CompositionOffsetEntry CompositionOffset=\"%d\" SampleCount=\"%d\"/>\n", p->entries[i].decodingOffset, p->entries[i].sampleCount);
nb_samples += p->entries[i].sampleCount;
}
if (p->size)
fprintf(trace, "<!-- counted %d samples in CTTS entries -->\n", nb_samples);
else
fprintf(trace, "<CompositionOffsetEntry CompositionOffset=\"\" SampleCount=\"\"/>\n");
gf_isom_box_dump_done("CompositionOffsetBox", a, trace);
return GF_OK;
}
| 15,854 |
163,876 | 0 | void DevToolsWindow::OnLoadCompleted() {
WebContents* inspected_web_contents = GetInspectedWebContents();
if (inspected_web_contents) {
SessionTabHelper* session_tab_helper =
SessionTabHelper::FromWebContents(inspected_web_contents);
if (session_tab_helper) {
base::Value tabId(session_tab_helper->session_id().id());
bindings_->CallClientFunction("DevToolsAPI.setInspectedTabId",
&tabId, NULL, NULL);
}
}
if (life_stage_ == kClosing)
return;
if (life_stage_ != kLoadCompleted) {
life_stage_ = life_stage_ == kIsDockedSet ? kLoadCompleted : kOnLoadFired;
}
if (life_stage_ == kLoadCompleted)
LoadCompleted();
}
| 15,855 |
36,797 | 0 | krb5_gss_verify_mic_iov(OM_uint32 *minor_status,
gss_ctx_id_t context_handle,
gss_qop_t *qop_state,
gss_iov_buffer_desc *iov,
int iov_count)
{
OM_uint32 major_status;
major_status = kg_unseal_iov(minor_status, context_handle,
NULL, qop_state,
iov, iov_count, KG_TOK_MIC_MSG);
return major_status;
}
| 15,856 |
182,486 | 1 | SQLWCHAR* _multi_string_alloc_and_expand( LPCSTR in )
{
SQLWCHAR *chr;
int len = 0;
if ( !in )
{
return in;
}
while ( in[ len ] != 0 || in[ len + 1 ] != 0 )
{
len ++;
}
chr = malloc(sizeof( SQLWCHAR ) * ( len + 2 ));
len = 0;
while ( in[ len ] != 0 || in[ len + 1 ] != 0 )
{
chr[ len ] = in[ len ];
len ++;
}
chr[ len ++ ] = 0;
chr[ len ++ ] = 0;
return chr;
}
| 15,857 |
1,335 | 0 | static int nfs_close(struct device_d *dev, FILE *file)
{
struct file_priv *priv = file->priv;
nfs_do_close(priv);
return 0;
}
| 15,858 |
57,700 | 0 | int kvm_arch_prepare_memory_region(struct kvm *kvm,
struct kvm_memory_slot *memslot,
const struct kvm_userspace_memory_region *mem,
enum kvm_mr_change change)
{
return 0;
}
| 15,859 |
138,446 | 0 | void Document::setEncodingData(const DocumentEncodingData& newData)
{
if (m_titleElement
&& encoding() != newData.encoding()
&& !ElementTraversal::firstWithin(*m_titleElement)
&& encoding() == Latin1Encoding()
&& m_titleElement->textContent().containsOnlyLatin1()) {
CString originalBytes = m_titleElement->textContent().latin1();
OwnPtr<TextCodec> codec = newTextCodec(newData.encoding());
String correctlyDecodedTitle = codec->decode(originalBytes.data(), originalBytes.length(), DataEOF);
m_titleElement->setTextContent(correctlyDecodedTitle);
}
m_encodingData = newData;
bool shouldUseVisualOrdering = m_encodingData.encoding().usesVisualOrdering();
if (shouldUseVisualOrdering != m_visuallyOrdered) {
m_visuallyOrdered = shouldUseVisualOrdering;
if (layoutView())
layoutView()->mutableStyleRef().setRTLOrdering(m_visuallyOrdered ? VisualOrder : LogicalOrder);
setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::VisuallyOrdered));
}
}
| 15,860 |
149,273 | 0 | void CrostiniUpgrader::OnCancel(CrostiniResult result) {
for (auto& observer : upgrader_observers_) {
observer.OnCanceled();
}
}
| 15,861 |
44,941 | 0 | xfs_attr3_leaf_to_shortform(
struct xfs_buf *bp,
struct xfs_da_args *args,
int forkoff)
{
struct xfs_attr_leafblock *leaf;
struct xfs_attr3_icleaf_hdr ichdr;
struct xfs_attr_leaf_entry *entry;
struct xfs_attr_leaf_name_local *name_loc;
struct xfs_da_args nargs;
struct xfs_inode *dp = args->dp;
char *tmpbuffer;
int error;
int i;
trace_xfs_attr_leaf_to_sf(args);
tmpbuffer = kmem_alloc(XFS_LBSIZE(dp->i_mount), KM_SLEEP);
if (!tmpbuffer)
return ENOMEM;
memcpy(tmpbuffer, bp->b_addr, XFS_LBSIZE(dp->i_mount));
leaf = (xfs_attr_leafblock_t *)tmpbuffer;
xfs_attr3_leaf_hdr_from_disk(&ichdr, leaf);
entry = xfs_attr3_leaf_entryp(leaf);
/* XXX (dgc): buffer is about to be marked stale - why zero it? */
memset(bp->b_addr, 0, XFS_LBSIZE(dp->i_mount));
/*
* Clean out the prior contents of the attribute list.
*/
error = xfs_da_shrink_inode(args, 0, bp);
if (error)
goto out;
if (forkoff == -1) {
ASSERT(dp->i_mount->m_flags & XFS_MOUNT_ATTR2);
ASSERT(dp->i_d.di_format != XFS_DINODE_FMT_BTREE);
xfs_attr_fork_reset(dp, args->trans);
goto out;
}
xfs_attr_shortform_create(args);
/*
* Copy the attributes
*/
memset((char *)&nargs, 0, sizeof(nargs));
nargs.dp = dp;
nargs.firstblock = args->firstblock;
nargs.flist = args->flist;
nargs.total = args->total;
nargs.whichfork = XFS_ATTR_FORK;
nargs.trans = args->trans;
nargs.op_flags = XFS_DA_OP_OKNOENT;
for (i = 0; i < ichdr.count; entry++, i++) {
if (entry->flags & XFS_ATTR_INCOMPLETE)
continue; /* don't copy partial entries */
if (!entry->nameidx)
continue;
ASSERT(entry->flags & XFS_ATTR_LOCAL);
name_loc = xfs_attr3_leaf_name_local(leaf, i);
nargs.name = name_loc->nameval;
nargs.namelen = name_loc->namelen;
nargs.value = &name_loc->nameval[nargs.namelen];
nargs.valuelen = be16_to_cpu(name_loc->valuelen);
nargs.hashval = be32_to_cpu(entry->hashval);
nargs.flags = XFS_ATTR_NSP_ONDISK_TO_ARGS(entry->flags);
xfs_attr_shortform_add(&nargs, forkoff);
}
error = 0;
out:
kmem_free(tmpbuffer);
return error;
}
| 15,862 |
160,244 | 0 | std::string RequestString(const std::string& url,
const std::string& mode,
const std::string& credentials) const {
return base::StringPrintf("url:%s, mode:%s, credentials:%s\n", url.c_str(),
mode.c_str(), credentials.c_str());
}
| 15,863 |
104,325 | 0 | void UTF8PartsToUTF16Parts(const std::string& text_utf8,
const url_parse::Parsed& parts_utf8,
url_parse::Parsed* parts) {
if (IsStringASCII(text_utf8)) {
*parts = parts_utf8;
return;
}
parts->scheme =
UTF8ComponentToUTF16Component(text_utf8, parts_utf8.scheme);
parts ->username =
UTF8ComponentToUTF16Component(text_utf8, parts_utf8.username);
parts->password =
UTF8ComponentToUTF16Component(text_utf8, parts_utf8.password);
parts->host =
UTF8ComponentToUTF16Component(text_utf8, parts_utf8.host);
parts->port =
UTF8ComponentToUTF16Component(text_utf8, parts_utf8.port);
parts->path =
UTF8ComponentToUTF16Component(text_utf8, parts_utf8.path);
parts->query =
UTF8ComponentToUTF16Component(text_utf8, parts_utf8.query);
parts->ref =
UTF8ComponentToUTF16Component(text_utf8, parts_utf8.ref);
}
| 15,864 |
168,508 | 0 | BytesConsumer::Result ReadableStreamBytesConsumer::EndRead(size_t read_size) {
DCHECK(pending_buffer_);
DCHECK_LE(pending_offset_ + read_size, pending_buffer_->length());
pending_offset_ += read_size;
if (pending_offset_ >= pending_buffer_->length()) {
pending_buffer_ = nullptr;
pending_offset_ = 0;
}
return Result::kOk;
}
| 15,865 |
103,055 | 0 | virtual void TabMoved(
TabContentsWrapper* contents, int from_index, int to_index) {
State* s = new State(contents, to_index, MOVE);
s->src_index = from_index;
states_.push_back(s);
}
| 15,866 |
115,524 | 0 | bool CommandTokenizer::hasNext() const
{
return !m_next.empty();
}
| 15,867 |
154,831 | 0 | error::Error GLES2DecoderPassthroughImpl::DoUniform1i(GLint location, GLint x) {
api()->glUniform1iFn(location, x);
return error::kNoError;
}
| 15,868 |
149,879 | 0 | LayerTreeHost::~LayerTreeHost() {
CHECK(!inside_main_frame_);
TRACE_EVENT0("cc", "LayerTreeHostInProcess::~LayerTreeHostInProcess");
mutator_host_->SetMutatorHostClient(nullptr);
RegisterViewportLayers(nullptr, nullptr, nullptr, nullptr);
if (root_layer_) {
root_layer_->SetLayerTreeHost(nullptr);
root_layer_ = nullptr;
}
if (proxy_) {
DCHECK(task_runner_provider_->IsMainThread());
proxy_->Stop();
proxy_ = nullptr;
}
}
| 15,869 |
161,925 | 0 | bool PrintRenderFrameHelper::PrintPreviewContext::IsRendering() const {
return state_ == RENDERING || state_ == DONE;
}
| 15,870 |
8,670 | 0 | static const MPTSASConfigPage *mptsas_find_config_page(int type, int number)
{
const MPTSASConfigPage *page;
int i;
for (i = 0; i < ARRAY_SIZE(mptsas_config_pages); i++) {
page = &mptsas_config_pages[i];
if (page->type == type && page->number == number) {
return page;
}
}
return NULL;
}
| 15,871 |
161,716 | 0 | FakePlatformSensorProvider::FakePlatformSensorProvider() {
ON_CALL(*this, DoCreateSensorInternal(_, _, _))
.WillByDefault(Invoke(
[](mojom::SensorType, scoped_refptr<PlatformSensor> sensor,
const PlatformSensorProvider::CreateSensorCallback& callback) {
callback.Run(std::move(sensor));
}));
}
| 15,872 |
108,487 | 0 | void DidGetModifiedSince(QuotaManager* manager,
const GetOriginsCallback& callback,
StorageType type,
bool success) {
if (!manager) {
callback.Run(std::set<GURL>(), type);
return;
}
manager->DidDatabaseWork(success);
callback.Run(origins_, type);
}
| 15,873 |
94,320 | 0 | static void __exit_signal(struct task_struct *tsk)
{
struct signal_struct *sig = tsk->signal;
struct sighand_struct *sighand;
BUG_ON(!sig);
BUG_ON(!atomic_read(&sig->count));
sighand = rcu_dereference(tsk->sighand);
spin_lock(&sighand->siglock);
posix_cpu_timers_exit(tsk);
if (atomic_dec_and_test(&sig->count))
posix_cpu_timers_exit_group(tsk);
else {
/*
* If there is any task waiting for the group exit
* then notify it:
*/
if (sig->group_exit_task && atomic_read(&sig->count) == sig->notify_count)
wake_up_process(sig->group_exit_task);
if (tsk == sig->curr_target)
sig->curr_target = next_thread(tsk);
/*
* Accumulate here the counters for all threads but the
* group leader as they die, so they can be added into
* the process-wide totals when those are taken.
* The group leader stays around as a zombie as long
* as there are other threads. When it gets reaped,
* the exit.c code will add its counts into these totals.
* We won't ever get here for the group leader, since it
* will have been the last reference on the signal_struct.
*/
sig->utime = cputime_add(sig->utime, task_utime(tsk));
sig->stime = cputime_add(sig->stime, task_stime(tsk));
sig->gtime = cputime_add(sig->gtime, task_gtime(tsk));
sig->min_flt += tsk->min_flt;
sig->maj_flt += tsk->maj_flt;
sig->nvcsw += tsk->nvcsw;
sig->nivcsw += tsk->nivcsw;
sig->inblock += task_io_get_inblock(tsk);
sig->oublock += task_io_get_oublock(tsk);
task_io_accounting_add(&sig->ioac, &tsk->ioac);
sig->sum_sched_runtime += tsk->se.sum_exec_runtime;
sig = NULL; /* Marker for below. */
}
__unhash_process(tsk);
/*
* Do this under ->siglock, we can race with another thread
* doing sigqueue_free() if we have SIGQUEUE_PREALLOC signals.
*/
flush_sigqueue(&tsk->pending);
tsk->signal = NULL;
tsk->sighand = NULL;
spin_unlock(&sighand->siglock);
__cleanup_sighand(sighand);
clear_tsk_thread_flag(tsk,TIF_SIGPENDING);
if (sig) {
flush_sigqueue(&sig->shared_pending);
taskstats_tgid_free(sig);
/*
* Make sure ->signal can't go away under rq->lock,
* see account_group_exec_runtime().
*/
task_rq_unlock_wait(tsk);
__cleanup_signal(sig);
}
}
| 15,874 |
69,999 | 0 | void bytesToHuman(char *s, unsigned long long n) {
double d;
if (n < 1024) {
/* Bytes */
sprintf(s,"%lluB",n);
return;
} else if (n < (1024*1024)) {
d = (double)n/(1024);
sprintf(s,"%.2fK",d);
} else if (n < (1024LL*1024*1024)) {
d = (double)n/(1024*1024);
sprintf(s,"%.2fM",d);
} else if (n < (1024LL*1024*1024*1024)) {
d = (double)n/(1024LL*1024*1024);
sprintf(s,"%.2fG",d);
} else if (n < (1024LL*1024*1024*1024*1024)) {
d = (double)n/(1024LL*1024*1024*1024);
sprintf(s,"%.2fT",d);
} else if (n < (1024LL*1024*1024*1024*1024*1024)) {
d = (double)n/(1024LL*1024*1024*1024*1024);
sprintf(s,"%.2fP",d);
} else {
/* Let's hope we never need this */
sprintf(s,"%lluB",n);
}
}
| 15,875 |
17,775 | 0 | ProcDbeGetVersion(ClientPtr client)
{
/* REQUEST(xDbeGetVersionReq); */
xDbeGetVersionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.majorVersion = DBE_MAJOR_VERSION,
.minorVersion = DBE_MINOR_VERSION
};
REQUEST_SIZE_MATCH(xDbeGetVersionReq);
if (client->swapped) {
swaps(&rep.sequenceNumber);
}
WriteToClient(client, sizeof(xDbeGetVersionReply), &rep);
return Success;
} /* ProcDbeGetVersion() */
| 15,876 |
37,529 | 0 | static void mmu_page_remove_parent_pte(struct kvm_mmu_page *sp,
u64 *parent_pte)
{
pte_list_remove(parent_pte, &sp->parent_ptes);
}
| 15,877 |
169,643 | 0 | int32_t WriteEntireBuffer(PP_Instance instance,
pp::FileIO* file_io,
int32_t offset,
const std::string& data,
CallbackType callback_type) {
TestCompletionCallback callback(instance, callback_type);
int32_t write_offset = offset;
const char* buf = data.c_str();
int32_t size = static_cast<int32_t>(data.size());
while (write_offset < offset + size) {
callback.WaitForResult(file_io->Write(write_offset,
&buf[write_offset - offset],
size - write_offset + offset,
callback.GetCallback()));
if (callback.result() < 0)
return callback.result();
if (callback.result() == 0)
return PP_ERROR_FAILED;
write_offset += callback.result();
}
return PP_OK;
}
| 15,878 |
106,497 | 0 | void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
{
WebEvent::Type type = static_cast<WebEvent::Type>(opaqueType);
switch (type) {
case WebEvent::NoType:
case WebEvent::MouseMove:
break;
case WebEvent::MouseDown:
case WebEvent::MouseUp:
case WebEvent::Wheel:
case WebEvent::KeyDown:
case WebEvent::KeyUp:
case WebEvent::RawKeyDown:
case WebEvent::Char:
#if ENABLE(GESTURE_EVENTS)
case WebEvent::GestureScrollBegin:
case WebEvent::GestureScrollEnd:
#endif
process()->responsivenessTimer()->stop();
break;
}
switch (type) {
case WebEvent::NoType:
break;
case WebEvent::MouseMove:
m_processingMouseMoveEvent = false;
if (m_nextMouseMoveEvent) {
handleMouseEvent(*m_nextMouseMoveEvent);
m_nextMouseMoveEvent = nullptr;
}
break;
case WebEvent::MouseDown:
case WebEvent::MouseUp:
#if ENABLE(GESTURE_EVENTS)
case WebEvent::GestureScrollBegin:
case WebEvent::GestureScrollEnd:
#endif
break;
case WebEvent::Wheel: {
m_processingWheelEvent = false;
if (m_nextWheelEvent) {
handleWheelEvent(*m_nextWheelEvent);
m_nextWheelEvent = nullptr;
}
break;
}
case WebEvent::KeyDown:
case WebEvent::KeyUp:
case WebEvent::RawKeyDown:
case WebEvent::Char: {
NativeWebKeyboardEvent event = m_keyEventQueue.first();
MESSAGE_CHECK(type == event.type());
m_keyEventQueue.removeFirst();
m_pageClient->doneWithKeyEvent(event, handled);
if (handled)
break;
m_uiClient.didNotHandleKeyEvent(this, event);
break;
}
}
}
| 15,879 |
81,318 | 0 | rb_simple_write(struct file *filp, const char __user *ubuf,
size_t cnt, loff_t *ppos)
{
struct trace_array *tr = filp->private_data;
struct ring_buffer *buffer = tr->trace_buffer.buffer;
unsigned long val;
int ret;
ret = kstrtoul_from_user(ubuf, cnt, 10, &val);
if (ret)
return ret;
if (buffer) {
mutex_lock(&trace_types_lock);
if (val) {
tracer_tracing_on(tr);
if (tr->current_trace->start)
tr->current_trace->start(tr);
} else {
tracer_tracing_off(tr);
if (tr->current_trace->stop)
tr->current_trace->stop(tr);
}
mutex_unlock(&trace_types_lock);
}
(*ppos)++;
return cnt;
}
| 15,880 |
4,400 | 0 | PHP_METHOD(Phar, getStub)
{
size_t len;
char *buf;
php_stream *fp;
php_stream_filter *filter = NULL;
phar_entry_info *stub;
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters_none() == FAILURE) {
return;
}
if (phar_obj->arc.archive->is_tar || phar_obj->arc.archive->is_zip) {
if (SUCCESS == zend_hash_find(&(phar_obj->arc.archive->manifest), ".phar/stub.php", sizeof(".phar/stub.php")-1, (void **)&stub)) {
if (phar_obj->arc.archive->fp && !phar_obj->arc.archive->is_brandnew && !(stub->flags & PHAR_ENT_COMPRESSION_MASK)) {
fp = phar_obj->arc.archive->fp;
} else {
if (!(fp = php_stream_open_wrapper(phar_obj->arc.archive->fname, "rb", 0, NULL))) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "phar error: unable to open phar \"%s\"", phar_obj->arc.archive->fname);
return;
}
if (stub->flags & PHAR_ENT_COMPRESSION_MASK) {
char *filter_name;
if ((filter_name = phar_decompress_filter(stub, 0)) != NULL) {
filter = php_stream_filter_create(filter_name, NULL, php_stream_is_persistent(fp) TSRMLS_CC);
} else {
filter = NULL;
}
if (!filter) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "phar error: unable to read stub of phar \"%s\" (cannot create %s filter)", phar_obj->arc.archive->fname, phar_decompress_filter(stub, 1));
return;
}
php_stream_filter_append(&fp->readfilters, filter);
}
}
if (!fp) {
zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC,
"Unable to read stub");
return;
}
php_stream_seek(fp, stub->offset_abs, SEEK_SET);
len = stub->uncompressed_filesize;
goto carry_on;
} else {
RETURN_STRINGL("", 0, 1);
}
}
len = phar_obj->arc.archive->halt_offset;
if (phar_obj->arc.archive->fp && !phar_obj->arc.archive->is_brandnew) {
fp = phar_obj->arc.archive->fp;
} else {
fp = php_stream_open_wrapper(phar_obj->arc.archive->fname, "rb", 0, NULL);
}
if (!fp) {
zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC,
"Unable to read stub");
return;
}
php_stream_rewind(fp);
carry_on:
buf = safe_emalloc(len, 1, 1);
if (len != php_stream_read(fp, buf, len)) {
if (fp != phar_obj->arc.archive->fp) {
php_stream_close(fp);
}
zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC,
"Unable to read stub");
efree(buf);
return;
}
if (filter) {
php_stream_filter_flush(filter, 1);
php_stream_filter_remove(filter, 1 TSRMLS_CC);
}
if (fp != phar_obj->arc.archive->fp) {
php_stream_close(fp);
}
buf[len] = '\0';
RETURN_STRINGL(buf, len, 0);
}
| 15,881 |
111,986 | 0 | void SyncTest::EnableNotificationsImpl() {
ASSERT_TRUE(ServerSupportsNotificationControl());
std::string path = "chromiumsync/enablenotifications";
ui_test_utils::NavigateToURL(browser(), sync_server_.GetURL(path));
ASSERT_EQ("Notifications enabled",
UTF16ToASCII(browser()->GetSelectedWebContents()->GetTitle()));
}
| 15,882 |
77,440 | 0 | decode_legacy_async_masks(const ovs_be32 masks[2],
enum ofputil_async_msg_type oam,
enum ofp_version version,
struct ofputil_async_cfg *dst)
{
for (int i = 0; i < 2; i++) {
bool master = i == 0;
const struct ofp14_async_prop *ap
= get_ofp14_async_config_prop_by_oam(oam, master);
decode_async_mask(masks[i], ap, version, true, dst);
}
}
| 15,883 |
75,122 | 0 | reset_persons(bool keep_existing)
{
unsigned int id;
point3_t origin;
person_t* person;
int i, j;
origin = map_origin();
for (i = 0; i < s_num_persons; ++i) {
person = s_persons[i];
id = person->id;
if (!keep_existing)
person->num_commands = 0;
if (person->is_persistent || keep_existing) {
person->x = origin.x;
person->y = origin.y;
person->layer = origin.z;
}
else {
person_activate(person, PERSON_SCRIPT_ON_DESTROY, NULL, true);
free_person(person);
--s_num_persons;
for (j = i; j < s_num_persons; ++j)
s_persons[j] = s_persons[j + 1];
--i;
}
}
sort_persons();
}
| 15,884 |
134,258 | 0 | base::string16 OmniboxViewViews::GetSelectedText() const {
return views::Textfield::GetSelectedText();
}
| 15,885 |
45,587 | 0 | static struct crypto_instance *crypto_rfc4309_alloc(struct rtattr **tb)
{
struct crypto_attr_type *algt;
struct crypto_instance *inst;
struct crypto_aead_spawn *spawn;
struct crypto_alg *alg;
const char *ccm_name;
int err;
algt = crypto_get_attr_type(tb);
if (IS_ERR(algt))
return ERR_CAST(algt);
if ((algt->type ^ CRYPTO_ALG_TYPE_AEAD) & algt->mask)
return ERR_PTR(-EINVAL);
ccm_name = crypto_attr_alg_name(tb[1]);
if (IS_ERR(ccm_name))
return ERR_CAST(ccm_name);
inst = kzalloc(sizeof(*inst) + sizeof(*spawn), GFP_KERNEL);
if (!inst)
return ERR_PTR(-ENOMEM);
spawn = crypto_instance_ctx(inst);
crypto_set_aead_spawn(spawn, inst);
err = crypto_grab_aead(spawn, ccm_name, 0,
crypto_requires_sync(algt->type, algt->mask));
if (err)
goto out_free_inst;
alg = crypto_aead_spawn_alg(spawn);
err = -EINVAL;
/* We only support 16-byte blocks. */
if (alg->cra_aead.ivsize != 16)
goto out_drop_alg;
/* Not a stream cipher? */
if (alg->cra_blocksize != 1)
goto out_drop_alg;
err = -ENAMETOOLONG;
if (snprintf(inst->alg.cra_name, CRYPTO_MAX_ALG_NAME,
"rfc4309(%s)", alg->cra_name) >= CRYPTO_MAX_ALG_NAME ||
snprintf(inst->alg.cra_driver_name, CRYPTO_MAX_ALG_NAME,
"rfc4309(%s)", alg->cra_driver_name) >=
CRYPTO_MAX_ALG_NAME)
goto out_drop_alg;
inst->alg.cra_flags = CRYPTO_ALG_TYPE_AEAD;
inst->alg.cra_flags |= alg->cra_flags & CRYPTO_ALG_ASYNC;
inst->alg.cra_priority = alg->cra_priority;
inst->alg.cra_blocksize = 1;
inst->alg.cra_alignmask = alg->cra_alignmask;
inst->alg.cra_type = &crypto_nivaead_type;
inst->alg.cra_aead.ivsize = 8;
inst->alg.cra_aead.maxauthsize = 16;
inst->alg.cra_ctxsize = sizeof(struct crypto_rfc4309_ctx);
inst->alg.cra_init = crypto_rfc4309_init_tfm;
inst->alg.cra_exit = crypto_rfc4309_exit_tfm;
inst->alg.cra_aead.setkey = crypto_rfc4309_setkey;
inst->alg.cra_aead.setauthsize = crypto_rfc4309_setauthsize;
inst->alg.cra_aead.encrypt = crypto_rfc4309_encrypt;
inst->alg.cra_aead.decrypt = crypto_rfc4309_decrypt;
inst->alg.cra_aead.geniv = "seqiv";
out:
return inst;
out_drop_alg:
crypto_drop_aead(spawn);
out_free_inst:
kfree(inst);
inst = ERR_PTR(err);
goto out;
}
| 15,886 |
12,081 | 0 | int EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *point)
{
if (group->meth->is_at_infinity == 0) {
ECerr(EC_F_EC_POINT_IS_AT_INFINITY,
ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
return 0;
}
if (group->meth != point->meth) {
ECerr(EC_F_EC_POINT_IS_AT_INFINITY, EC_R_INCOMPATIBLE_OBJECTS);
return 0;
}
return group->meth->is_at_infinity(group, point);
}
| 15,887 |
160,255 | 0 | std::string NavigateAndExtractInnerText(const GURL& url) {
return ExtractInnerText(Navigate(url));
}
| 15,888 |
4,045 | 0 | void CMYKGrayEncoder::reset() {
str->reset();
bufPtr = bufEnd = buf;
eof = gFalse;
}
| 15,889 |
101,770 | 0 | void Browser::Print() {
if (switches::IsPrintPreviewEnabled())
GetSelectedTabContentsWrapper()->print_view_manager()->PrintPreviewNow();
else
GetSelectedTabContentsWrapper()->print_view_manager()->PrintNow();
}
| 15,890 |
106,186 | 0 | JSValue jsTestObjWithScriptExecutionContextAndScriptStateWithSpacesAttribute(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(slotBase));
ScriptExecutionContext* scriptContext = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext();
if (!scriptContext)
return jsUndefined();
TestObj* impl = static_cast<TestObj*>(castedThis->impl());
JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl->withScriptExecutionContextAndScriptStateWithSpacesAttribute(exec, scriptContext)));
return result;
}
| 15,891 |
77,585 | 0 | ofputil_encode_packet_in_private(const struct ofputil_packet_in_private *pin,
enum ofputil_protocol protocol,
enum nx_packet_in_format packet_in_format)
{
enum ofp_version version = ofputil_protocol_to_ofp_version(protocol);
struct ofpbuf *msg;
switch (packet_in_format) {
case NXPIF_STANDARD:
switch (protocol) {
case OFPUTIL_P_OF10_STD:
case OFPUTIL_P_OF10_STD_TID:
case OFPUTIL_P_OF10_NXM:
case OFPUTIL_P_OF10_NXM_TID:
msg = ofputil_encode_ofp10_packet_in(&pin->public);
break;
case OFPUTIL_P_OF11_STD:
msg = ofputil_encode_ofp11_packet_in(&pin->public);
break;
case OFPUTIL_P_OF12_OXM:
case OFPUTIL_P_OF13_OXM:
case OFPUTIL_P_OF14_OXM:
case OFPUTIL_P_OF15_OXM:
case OFPUTIL_P_OF16_OXM:
msg = ofputil_encode_ofp12_packet_in(&pin->public, version);
break;
default:
OVS_NOT_REACHED();
}
break;
case NXPIF_NXT_PACKET_IN:
msg = ofputil_encode_nx_packet_in(&pin->public, version);
break;
case NXPIF_NXT_PACKET_IN2:
return ofputil_encode_nx_packet_in2(pin, version,
pin->public.packet_len);
default:
OVS_NOT_REACHED();
}
ofpbuf_put(msg, pin->public.packet, pin->public.packet_len);
ofpmsg_update_length(msg);
return msg;
}
| 15,892 |
20,848 | 0 | static int kvm_vm_ioctl_reinject(struct kvm *kvm,
struct kvm_reinject_control *control)
{
if (!kvm->arch.vpit)
return -ENXIO;
mutex_lock(&kvm->arch.vpit->pit_state.lock);
kvm->arch.vpit->pit_state.pit_timer.reinject = control->pit_reinject;
mutex_unlock(&kvm->arch.vpit->pit_state.lock);
return 0;
}
| 15,893 |
84,064 | 0 | void error_callback(const char *msg, void *client_data)
{
FILE *stream = (FILE*)client_data;
fprintf(stream, "[ERROR] %s", msg);
}
| 15,894 |
89,753 | 0 | void preproc_build_firejail_dir(void) {
struct stat s;
if (stat(RUN_FIREJAIL_BASEDIR, &s)) {
create_empty_dir_as_root(RUN_FIREJAIL_BASEDIR, 0755);
}
if (stat(RUN_FIREJAIL_DIR, &s)) {
create_empty_dir_as_root(RUN_FIREJAIL_DIR, 0755);
}
if (stat(RUN_FIREJAIL_NETWORK_DIR, &s)) {
create_empty_dir_as_root(RUN_FIREJAIL_NETWORK_DIR, 0755);
}
if (stat(RUN_FIREJAIL_BANDWIDTH_DIR, &s)) {
create_empty_dir_as_root(RUN_FIREJAIL_BANDWIDTH_DIR, 0755);
}
if (stat(RUN_FIREJAIL_NAME_DIR, &s)) {
create_empty_dir_as_root(RUN_FIREJAIL_NAME_DIR, 0755);
}
if (stat(RUN_FIREJAIL_PROFILE_DIR, &s)) {
create_empty_dir_as_root(RUN_FIREJAIL_PROFILE_DIR, 0755);
}
if (stat(RUN_FIREJAIL_X11_DIR, &s)) {
create_empty_dir_as_root(RUN_FIREJAIL_X11_DIR, 0755);
}
if (stat(RUN_FIREJAIL_APPIMAGE_DIR, &s)) {
create_empty_dir_as_root(RUN_FIREJAIL_APPIMAGE_DIR, 0755);
}
if (stat(RUN_FIREJAIL_LIB_DIR, &s)) {
create_empty_dir_as_root(RUN_FIREJAIL_LIB_DIR, 0755);
}
if (stat(RUN_MNT_DIR, &s)) {
create_empty_dir_as_root(RUN_MNT_DIR, 0755);
}
create_empty_file_as_root(RUN_RO_FILE, S_IRUSR);
create_empty_dir_as_root(RUN_RO_DIR, S_IRUSR);
}
| 15,895 |
58,960 | 0 | static int l2cap_sock_accept(struct socket *sock, struct socket *newsock, int flags)
{
DECLARE_WAITQUEUE(wait, current);
struct sock *sk = sock->sk, *nsk;
long timeo;
int err = 0;
lock_sock_nested(sk, SINGLE_DEPTH_NESTING);
if (sk->sk_state != BT_LISTEN) {
err = -EBADFD;
goto done;
}
timeo = sock_rcvtimeo(sk, flags & O_NONBLOCK);
BT_DBG("sk %p timeo %ld", sk, timeo);
/* Wait for an incoming connection. (wake-one). */
add_wait_queue_exclusive(sk->sk_sleep, &wait);
while (!(nsk = bt_accept_dequeue(sk, newsock))) {
set_current_state(TASK_INTERRUPTIBLE);
if (!timeo) {
err = -EAGAIN;
break;
}
release_sock(sk);
timeo = schedule_timeout(timeo);
lock_sock_nested(sk, SINGLE_DEPTH_NESTING);
if (sk->sk_state != BT_LISTEN) {
err = -EBADFD;
break;
}
if (signal_pending(current)) {
err = sock_intr_errno(timeo);
break;
}
}
set_current_state(TASK_RUNNING);
remove_wait_queue(sk->sk_sleep, &wait);
if (err)
goto done;
newsock->state = SS_CONNECTED;
BT_DBG("new socket %p", nsk);
done:
release_sock(sk);
return err;
}
| 15,896 |
165,551 | 0 | void ContentSecurityPolicy::ReportValueForEmptyDirective(const String& name,
const String& value) {
LogToConsole("The Content Security Policy directive '" + name +
"' should be empty, but was delivered with a value of '" +
value +
"'. The directive has been applied, and the value ignored.");
}
| 15,897 |
174,229 | 0 | status_t Camera3Device::getStreamInfo(int id,
uint32_t *width, uint32_t *height,
uint32_t *format, android_dataspace *dataSpace) {
ATRACE_CALL();
Mutex::Autolock il(mInterfaceLock);
Mutex::Autolock l(mLock);
switch (mStatus) {
case STATUS_ERROR:
CLOGE("Device has encountered a serious error");
return INVALID_OPERATION;
case STATUS_UNINITIALIZED:
CLOGE("Device not initialized!");
return INVALID_OPERATION;
case STATUS_UNCONFIGURED:
case STATUS_CONFIGURED:
case STATUS_ACTIVE:
break;
default:
SET_ERR_L("Unexpected status: %d", mStatus);
return INVALID_OPERATION;
}
ssize_t idx = mOutputStreams.indexOfKey(id);
if (idx == NAME_NOT_FOUND) {
CLOGE("Stream %d is unknown", id);
return idx;
}
if (width) *width = mOutputStreams[idx]->getWidth();
if (height) *height = mOutputStreams[idx]->getHeight();
if (format) *format = mOutputStreams[idx]->getFormat();
if (dataSpace) *dataSpace = mOutputStreams[idx]->getDataSpace();
return OK;
}
| 15,898 |
126,180 | 0 | void Browser::DidNavigateMainFramePostCommit(WebContents* web_contents) {
if (web_contents == chrome::GetActiveWebContents(this))
UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TAB_STATE);
}
| 15,899 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.