unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
184,182 | 1 | void PrintWebViewHelper::UpdatePrintableSizeInPrintParameters(
WebFrame* frame,
WebNode* node,
ViewMsg_Print_Params* params) {
double content_width_in_points;
double content_height_in_points;
double margin_top_in_points;
double margin_right_in_points;
double margin_bottom_in_points;
double margin_left_in_points;
PrepareFrameAndViewForPrint prepare(*params, frame, node, frame->view());
PrintWebViewHelper::GetPageSizeAndMarginsInPoints(frame, 0, *params,
&content_width_in_points, &content_height_in_points,
&margin_top_in_points, &margin_right_in_points,
&margin_bottom_in_points, &margin_left_in_points);
#if defined(OS_MACOSX)
// On the Mac, the printable area is in points, don't do any scaling based
// on dpi.
int dpi = printing::kPointsPerInch;
#else
int dpi = static_cast<int>(params->dpi);
#endif // defined(OS_MACOSX)
params->printable_size = gfx::Size(
static_cast<int>(ConvertUnitDouble(content_width_in_points,
printing::kPointsPerInch, dpi)),
static_cast<int>(ConvertUnitDouble(content_height_in_points,
printing::kPointsPerInch, dpi)));
params->page_size = gfx::Size(
static_cast<int>(ConvertUnitDouble(content_width_in_points +
margin_left_in_points + margin_right_in_points,
printing::kPointsPerInch, dpi)),
static_cast<int>(ConvertUnitDouble(content_height_in_points +
margin_top_in_points + margin_bottom_in_points,
printing::kPointsPerInch, dpi)));
params->margin_top = static_cast<int>(ConvertUnitDouble(
margin_top_in_points, printing::kPointsPerInch, dpi));
params->margin_left = static_cast<int>(ConvertUnitDouble(
margin_left_in_points, printing::kPointsPerInch, dpi));
}
| 17,500 |
132,807 | 0 | void PictureLayer::SetNeedsDisplayRect(const gfx::Rect& layer_rect) {
if (!layer_rect.IsEmpty()) {
pending_invalidation_.Union(
gfx::IntersectRects(layer_rect, gfx::Rect(bounds())));
}
Layer::SetNeedsDisplayRect(layer_rect);
}
| 17,501 |
87,803 | 0 | static int foreach_comment(void *user, const char *k, const char *v) {
RAnalMetaUserItem *ui = user;
RCore *core = ui->anal->user;
const char *cmd = ui->user;
if (!strncmp (k, "meta.C.", 7)) {
char *cmt = (char *)sdb_decode (v, 0);
if (cmt) {
r_core_cmdf (core, "s %s", k + 7);
r_core_cmd0 (core, cmd);
free (cmt);
}
}
return 1;
}
| 17,502 |
30,770 | 0 | int bt_sock_unregister(int proto)
{
int err = 0;
if (proto < 0 || proto >= BT_MAX_PROTO)
return -EINVAL;
write_lock(&bt_proto_lock);
if (!bt_proto[proto])
err = -ENOENT;
else
bt_proto[proto] = NULL;
write_unlock(&bt_proto_lock);
return err;
}
| 17,503 |
127,054 | 0 | void ChromeClientImpl::resetPagePopupDriver()
{
m_pagePopupDriver = m_webView;
}
| 17,504 |
114,587 | 0 | void RenderThreadImpl::IdleHandlerInForegroundTab() {
int64 new_delay_ms = idle_notification_delay_in_ms_ +
1000000 / (idle_notification_delay_in_ms_ + 2000);
if (new_delay_ms >= kLongIdleHandlerDelayMs)
new_delay_ms = kShortIdleHandlerDelayMs;
if (idle_notifications_to_skip_ > 0) {
idle_notifications_to_skip_--;
} else {
int cpu_usage = 0;
Send(new ViewHostMsg_GetCPUUsage(&cpu_usage));
int idle_hint = static_cast<int>(new_delay_ms / 10);
if (cpu_usage < kIdleCPUUsageThresholdInPercents) {
#if !defined(OS_MACOSX) && defined(USE_TCMALLOC)
MallocExtension::instance()->ReleaseFreeMemory();
#endif
if (v8::V8::IdleNotification(idle_hint)) {
new_delay_ms = kLongIdleHandlerDelayMs;
}
}
}
ScheduleIdleHandler(new_delay_ms);
}
| 17,505 |
34,910 | 0 | static const char *rpc_proc_name(const struct rpc_task *task)
{
const struct rpc_procinfo *proc = task->tk_msg.rpc_proc;
if (proc) {
if (proc->p_name)
return proc->p_name;
else
return "NULL";
} else
return "no proc";
}
| 17,506 |
78,095 | 0 | cmsBool ismiddle(int c)
{
return (!isseparator(c) && (c != '#') && (c !='\"') && (c != '\'') && (c > 32) && (c < 127));
}
| 17,507 |
152,356 | 0 | blink::WebRelatedAppsFetcher* RenderFrameImpl::GetRelatedAppsFetcher() {
if (!related_apps_fetcher_)
related_apps_fetcher_.reset(new RelatedAppsFetcher(&GetManifestManager()));
return related_apps_fetcher_.get();
}
| 17,508 |
8,186 | 0 | int v9fs_device_realize_common(V9fsState *s, Error **errp)
{
V9fsVirtioState *v = container_of(s, V9fsVirtioState, state);
int i, len;
struct stat stat;
FsDriverEntry *fse;
V9fsPath path;
int rc = 1;
/* initialize pdu allocator */
QLIST_INIT(&s->free_list);
QLIST_INIT(&s->active_list);
for (i = 0; i < (MAX_REQ - 1); i++) {
QLIST_INSERT_HEAD(&s->free_list, &v->pdus[i], next);
v->pdus[i].s = s;
v->pdus[i].idx = i;
}
v9fs_path_init(&path);
fse = get_fsdev_fsentry(s->fsconf.fsdev_id);
if (!fse) {
/* We don't have a fsdev identified by fsdev_id */
error_setg(errp, "9pfs device couldn't find fsdev with the "
"id = %s",
s->fsconf.fsdev_id ? s->fsconf.fsdev_id : "NULL");
goto out;
}
if (!s->fsconf.tag) {
/* we haven't specified a mount_tag */
error_setg(errp, "fsdev with id %s needs mount_tag arguments",
s->fsconf.fsdev_id);
goto out;
}
s->ctx.export_flags = fse->export_flags;
s->ctx.fs_root = g_strdup(fse->path);
s->ctx.exops.get_st_gen = NULL;
len = strlen(s->fsconf.tag);
if (len > MAX_TAG_LEN - 1) {
error_setg(errp, "mount tag '%s' (%d bytes) is longer than "
"maximum (%d bytes)", s->fsconf.tag, len, MAX_TAG_LEN - 1);
goto out;
}
s->tag = g_strdup(s->fsconf.tag);
s->ctx.uid = -1;
s->ops = fse->ops;
s->fid_list = NULL;
qemu_co_rwlock_init(&s->rename_lock);
if (s->ops->init(&s->ctx) < 0) {
error_setg(errp, "9pfs Failed to initialize fs-driver with id:%s"
" and export path:%s", s->fsconf.fsdev_id, s->ctx.fs_root);
goto out;
}
/*
* Check details of export path, We need to use fs driver
* call back to do that. Since we are in the init path, we don't
* use co-routines here.
*/
if (s->ops->name_to_path(&s->ctx, NULL, "/", &path) < 0) {
error_setg(errp,
"error in converting name to path %s", strerror(errno));
goto out;
}
if (s->ops->lstat(&s->ctx, &path, &stat)) {
error_setg(errp, "share path %s does not exist", fse->path);
goto out;
} else if (!S_ISDIR(stat.st_mode)) {
error_setg(errp, "share path %s is not a directory", fse->path);
goto out;
}
v9fs_path_free(&path);
rc = 0;
out:
if (rc) {
g_free(s->ctx.fs_root);
g_free(s->tag);
v9fs_path_free(&path);
}
return rc;
}
| 17,509 |
90,149 | 0 | static int hidp_sock_create(struct net *net, struct socket *sock, int protocol,
int kern)
{
struct sock *sk;
BT_DBG("sock %p", sock);
if (sock->type != SOCK_RAW)
return -ESOCKTNOSUPPORT;
sk = sk_alloc(net, PF_BLUETOOTH, GFP_ATOMIC, &hidp_proto, kern);
if (!sk)
return -ENOMEM;
sock_init_data(sock, sk);
sock->ops = &hidp_sock_ops;
sock->state = SS_UNCONNECTED;
sock_reset_flag(sk, SOCK_ZAPPED);
sk->sk_protocol = protocol;
sk->sk_state = BT_OPEN;
bt_sock_link(&hidp_sk_list, sk);
return 0;
}
| 17,510 |
68,023 | 0 | static plist_t parse_array_node(struct bplist_data *bplist, const char** bnode, uint64_t size)
{
uint64_t j;
uint64_t str_j = 0;
uint64_t index1;
plist_data_t data = plist_new_plist_data();
const char *index1_ptr = NULL;
data->type = PLIST_ARRAY;
data->length = size;
plist_t node = node_create(NULL, data);
for (j = 0; j < data->length; j++) {
str_j = j * bplist->ref_size;
index1_ptr = (*bnode) + str_j;
if (index1_ptr < bplist->data || index1_ptr + bplist->ref_size > bplist->offset_table) {
plist_free(node);
PLIST_BIN_ERR("%s: array item %" PRIu64 " is outside of valid range\n", __func__, j);
return NULL;
}
index1 = UINT_TO_HOST(index1_ptr, bplist->ref_size);
if (index1 >= bplist->num_objects) {
plist_free(node);
PLIST_BIN_ERR("%s: array item %" PRIu64 " object index (%" PRIu64 ") must be smaller than the number of objects (%" PRIu64 ")\n", __func__, j, index1, bplist->num_objects);
return NULL;
}
/* process value node */
plist_t val = parse_bin_node_at_index(bplist, index1);
if (!val) {
plist_free(node);
return NULL;
}
node_attach(node, val);
}
return node;
}
| 17,511 |
105,845 | 0 | void UrlmonUrlRequestManager::SetInfoForUrl(const std::wstring& url,
IMoniker* moniker, LPBC bind_ctx) {
CComObject<UrlmonUrlRequest>* new_request = NULL;
CComObject<UrlmonUrlRequest>::CreateInstance(&new_request);
if (new_request) {
GURL start_url(url);
DCHECK(start_url.is_valid());
DCHECK(pending_request_ == NULL);
base::win::ScopedComPtr<BindContextInfo> info;
BindContextInfo::FromBindContext(bind_ctx, info.Receive());
DCHECK(info);
IStream* cache = info ? info->cache() : NULL;
pending_request_ = new_request;
pending_request_->InitPending(start_url, moniker, bind_ctx,
enable_frame_busting_, privileged_mode_,
notification_window_, cache);
bool is_started = pending_request_->Start();
DCHECK(is_started);
}
}
| 17,512 |
125,611 | 0 | void RenderViewHostImpl::ForwardKeyboardEvent(
const NativeWebKeyboardEvent& key_event) {
if (ignore_input_events()) {
if (key_event.type == WebInputEvent::RawKeyDown)
delegate_->OnIgnoredUIEvent();
return;
}
RenderWidgetHostImpl::ForwardKeyboardEvent(key_event);
}
| 17,513 |
46,990 | 0 | static void decrypt_callback(void *priv, u8 *srcdst, unsigned int nbytes)
{
const unsigned int bsize = SERPENT_BLOCK_SIZE;
struct crypt_priv *ctx = priv;
int i;
ctx->fpu_enabled = serpent_fpu_begin(ctx->fpu_enabled, nbytes);
if (nbytes >= SERPENT_AVX2_PARALLEL_BLOCKS * bsize) {
serpent_ecb_dec_16way(ctx->ctx, srcdst, srcdst);
srcdst += bsize * SERPENT_AVX2_PARALLEL_BLOCKS;
nbytes -= bsize * SERPENT_AVX2_PARALLEL_BLOCKS;
}
while (nbytes >= SERPENT_PARALLEL_BLOCKS * bsize) {
serpent_ecb_dec_8way_avx(ctx->ctx, srcdst, srcdst);
srcdst += bsize * SERPENT_PARALLEL_BLOCKS;
nbytes -= bsize * SERPENT_PARALLEL_BLOCKS;
}
for (i = 0; i < nbytes / bsize; i++, srcdst += bsize)
__serpent_decrypt(ctx->ctx, srcdst, srcdst);
}
| 17,514 |
48,646 | 0 | static void h2_session_ev_no_io(h2_session *session, int arg, const char *msg)
{
switch (session->state) {
case H2_SESSION_ST_BUSY:
/* Nothing to READ, nothing to WRITE on the master connection.
* Possible causes:
* - we wait for the client to send us sth
* - we wait for started tasks to produce output
* - we have finished all streams and the client has sent GO_AWAY
*/
ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, session->c,
"h2_session(%ld): NO_IO event, %d streams open",
session->id, session->open_streams);
h2_conn_io_flush(&session->io);
if (session->open_streams > 0) {
if (h2_mplx_awaits_data(session->mplx)) {
/* waiting for at least one stream to produce data */
transit(session, "no io", H2_SESSION_ST_WAIT);
}
else {
/* we have streams open, and all are submitted and none
* is suspended. The only thing keeping us from WRITEing
* more must be the flow control.
* This means we only wait for WINDOW_UPDATE from the
* client and can block on READ. */
transit(session, "no io (flow wait)", H2_SESSION_ST_IDLE);
session->idle_until = apr_time_now() + session->s->timeout;
session->keep_sync_until = session->idle_until;
/* Make sure we have flushed all previously written output
* so that the client will react. */
if (h2_conn_io_flush(&session->io) != APR_SUCCESS) {
dispatch_event(session, H2_SESSION_EV_CONN_ERROR, 0, NULL);
return;
}
}
}
else if (session->local.accepting) {
/* When we have no streams, but accept new, switch to idle */
apr_time_t now = apr_time_now();
transit(session, "no io (keepalive)", H2_SESSION_ST_IDLE);
session->idle_until = (session->remote.emitted_count?
session->s->keep_alive_timeout :
session->s->timeout) + now;
session->keep_sync_until = now + apr_time_from_sec(1);
}
else {
/* We are no longer accepting new streams and there are
* none left. Time to leave. */
h2_session_shutdown(session, arg, msg, 0);
transit(session, "no io", H2_SESSION_ST_DONE);
}
break;
default:
/* nop */
break;
}
}
| 17,515 |
108,906 | 0 | void RenderViewImpl::LoadNavigationErrorPage(
WebFrame* frame,
const WebURLRequest& failed_request,
const WebURLError& error,
const std::string& html,
bool replace) {
std::string alt_html;
const std::string* error_html;
if (!html.empty()) {
error_html = &html;
} else {
content::GetContentClient()->renderer()->GetNavigationErrorStrings(
failed_request, error, &alt_html, NULL);
error_html = &alt_html;
}
frame->loadHTMLString(*error_html,
GURL(content::kUnreachableWebDataURL),
error.unreachableURL,
replace);
}
| 17,516 |
125,666 | 0 | void RenderViewHostImpl::OnOpenURL(
const ViewHostMsg_OpenURL_Params& params) {
GURL validated_url(params.url);
FilterURL(ChildProcessSecurityPolicyImpl::GetInstance(),
GetProcess(), false, &validated_url);
delegate_->RequestOpenURL(
this, validated_url, params.referrer, params.disposition, params.frame_id,
params.is_cross_site_redirect);
}
| 17,517 |
30,345 | 0 | static __init void vsock_init_tables(void)
{
int i;
for (i = 0; i < ARRAY_SIZE(vsock_bind_table); i++)
INIT_LIST_HEAD(&vsock_bind_table[i]);
for (i = 0; i < ARRAY_SIZE(vsock_connected_table); i++)
INIT_LIST_HEAD(&vsock_connected_table[i]);
}
| 17,518 |
82,519 | 0 | void jslFunctionCharAsString(unsigned char ch, char *str, size_t len) {
if (ch >= LEX_TOKEN_START) {
jslTokenAsString(ch, str, len);
} else {
str[0] = (char)ch;
str[1] = 0;
}
}
| 17,519 |
47,789 | 0 | static int pcm_chmap_ctl_tlv(struct snd_kcontrol *kcontrol, int op_flag,
unsigned int size, unsigned int __user *tlv)
{
struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol);
const struct snd_pcm_chmap_elem *map;
unsigned int __user *dst;
int c, count = 0;
if (snd_BUG_ON(!info->chmap))
return -EINVAL;
if (size < 8)
return -ENOMEM;
if (put_user(SNDRV_CTL_TLVT_CONTAINER, tlv))
return -EFAULT;
size -= 8;
dst = tlv + 2;
for (map = info->chmap; map->channels; map++) {
int chs_bytes = map->channels * 4;
if (!valid_chmap_channels(info, map->channels))
continue;
if (size < 8)
return -ENOMEM;
if (put_user(SNDRV_CTL_TLVT_CHMAP_FIXED, dst) ||
put_user(chs_bytes, dst + 1))
return -EFAULT;
dst += 2;
size -= 8;
count += 8;
if (size < chs_bytes)
return -ENOMEM;
size -= chs_bytes;
count += chs_bytes;
for (c = 0; c < map->channels; c++) {
if (put_user(map->map[c], dst))
return -EFAULT;
dst++;
}
}
if (put_user(count, tlv + 1))
return -EFAULT;
return 0;
}
| 17,520 |
154,216 | 0 | error::Error GLES2DecoderImpl::HandleDrawArrays(uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile cmds::DrawArrays& c =
*static_cast<const volatile cmds::DrawArrays*>(cmd_data);
GLint first = static_cast<GLint>(c.first);
GLsizei count = static_cast<GLsizei>(c.count);
return DoMultiDrawArrays("glDrawArrays", false, static_cast<GLenum>(c.mode),
&first, &count, nullptr, 1);
}
| 17,521 |
10,910 | 0 | ksba_ocsp_set_nonce (ksba_ocsp_t ocsp, unsigned char *nonce, size_t noncelen)
{
if (!ocsp)
return 0;
if (!nonce)
return sizeof ocsp->nonce;
if (noncelen > sizeof ocsp->nonce)
noncelen = sizeof ocsp->nonce;
if (noncelen)
{
memcpy (ocsp->nonce, nonce, noncelen);
/* Reset the high bit. We do this to make sure that we have a
positive integer and thus we don't need to prepend a leading
zero which would be needed then. */
ocsp->nonce[0] &= 0x7f;
}
ocsp->noncelen = noncelen;
return noncelen;
}
| 17,522 |
55,381 | 0 | static int tcp_clean_rtx_queue(struct sock *sk, int prior_fackets,
u32 prior_snd_una,
struct tcp_sacktag_state *sack)
{
const struct inet_connection_sock *icsk = inet_csk(sk);
struct skb_mstamp first_ackt, last_ackt, now;
struct tcp_sock *tp = tcp_sk(sk);
u32 prior_sacked = tp->sacked_out;
u32 reord = tp->packets_out;
bool fully_acked = true;
long sack_rtt_us = -1L;
long seq_rtt_us = -1L;
long ca_rtt_us = -1L;
struct sk_buff *skb;
u32 pkts_acked = 0;
bool rtt_update;
int flag = 0;
first_ackt.v64 = 0;
while ((skb = tcp_write_queue_head(sk)) && skb != tcp_send_head(sk)) {
struct tcp_skb_cb *scb = TCP_SKB_CB(skb);
u8 sacked = scb->sacked;
u32 acked_pcount;
tcp_ack_tstamp(sk, skb, prior_snd_una);
/* Determine how many packets and what bytes were acked, tso and else */
if (after(scb->end_seq, tp->snd_una)) {
if (tcp_skb_pcount(skb) == 1 ||
!after(tp->snd_una, scb->seq))
break;
acked_pcount = tcp_tso_acked(sk, skb);
if (!acked_pcount)
break;
fully_acked = false;
} else {
/* Speedup tcp_unlink_write_queue() and next loop */
prefetchw(skb->next);
acked_pcount = tcp_skb_pcount(skb);
}
if (unlikely(sacked & TCPCB_RETRANS)) {
if (sacked & TCPCB_SACKED_RETRANS)
tp->retrans_out -= acked_pcount;
flag |= FLAG_RETRANS_DATA_ACKED;
} else if (!(sacked & TCPCB_SACKED_ACKED)) {
last_ackt = skb->skb_mstamp;
WARN_ON_ONCE(last_ackt.v64 == 0);
if (!first_ackt.v64)
first_ackt = last_ackt;
reord = min(pkts_acked, reord);
if (!after(scb->end_seq, tp->high_seq))
flag |= FLAG_ORIG_SACK_ACKED;
}
if (sacked & TCPCB_SACKED_ACKED)
tp->sacked_out -= acked_pcount;
else if (tcp_is_sack(tp) && !tcp_skb_spurious_retrans(tp, skb))
tcp_rack_advance(tp, &skb->skb_mstamp, sacked);
if (sacked & TCPCB_LOST)
tp->lost_out -= acked_pcount;
tp->packets_out -= acked_pcount;
pkts_acked += acked_pcount;
/* Initial outgoing SYN's get put onto the write_queue
* just like anything else we transmit. It is not
* true data, and if we misinform our callers that
* this ACK acks real data, we will erroneously exit
* connection startup slow start one packet too
* quickly. This is severely frowned upon behavior.
*/
if (likely(!(scb->tcp_flags & TCPHDR_SYN))) {
flag |= FLAG_DATA_ACKED;
} else {
flag |= FLAG_SYN_ACKED;
tp->retrans_stamp = 0;
}
if (!fully_acked)
break;
tcp_unlink_write_queue(skb, sk);
sk_wmem_free_skb(sk, skb);
if (unlikely(skb == tp->retransmit_skb_hint))
tp->retransmit_skb_hint = NULL;
if (unlikely(skb == tp->lost_skb_hint))
tp->lost_skb_hint = NULL;
}
if (likely(between(tp->snd_up, prior_snd_una, tp->snd_una)))
tp->snd_up = tp->snd_una;
if (skb && (TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED))
flag |= FLAG_SACK_RENEGING;
skb_mstamp_get(&now);
if (likely(first_ackt.v64) && !(flag & FLAG_RETRANS_DATA_ACKED)) {
seq_rtt_us = skb_mstamp_us_delta(&now, &first_ackt);
ca_rtt_us = skb_mstamp_us_delta(&now, &last_ackt);
}
if (sack->first_sackt.v64) {
sack_rtt_us = skb_mstamp_us_delta(&now, &sack->first_sackt);
ca_rtt_us = skb_mstamp_us_delta(&now, &sack->last_sackt);
}
rtt_update = tcp_ack_update_rtt(sk, flag, seq_rtt_us, sack_rtt_us,
ca_rtt_us);
if (flag & FLAG_ACKED) {
tcp_rearm_rto(sk);
if (unlikely(icsk->icsk_mtup.probe_size &&
!after(tp->mtu_probe.probe_seq_end, tp->snd_una))) {
tcp_mtup_probe_success(sk);
}
if (tcp_is_reno(tp)) {
tcp_remove_reno_sacks(sk, pkts_acked);
} else {
int delta;
/* Non-retransmitted hole got filled? That's reordering */
if (reord < prior_fackets)
tcp_update_reordering(sk, tp->fackets_out - reord, 0);
delta = tcp_is_fack(tp) ? pkts_acked :
prior_sacked - tp->sacked_out;
tp->lost_cnt_hint -= min(tp->lost_cnt_hint, delta);
}
tp->fackets_out -= min(pkts_acked, tp->fackets_out);
} else if (skb && rtt_update && sack_rtt_us >= 0 &&
sack_rtt_us > skb_mstamp_us_delta(&now, &skb->skb_mstamp)) {
/* Do not re-arm RTO if the sack RTT is measured from data sent
* after when the head was last (re)transmitted. Otherwise the
* timeout may continue to extend in loss recovery.
*/
tcp_rearm_rto(sk);
}
if (icsk->icsk_ca_ops->pkts_acked)
icsk->icsk_ca_ops->pkts_acked(sk, pkts_acked, ca_rtt_us);
#if FASTRETRANS_DEBUG > 0
WARN_ON((int)tp->sacked_out < 0);
WARN_ON((int)tp->lost_out < 0);
WARN_ON((int)tp->retrans_out < 0);
if (!tp->packets_out && tcp_is_sack(tp)) {
icsk = inet_csk(sk);
if (tp->lost_out) {
pr_debug("Leak l=%u %d\n",
tp->lost_out, icsk->icsk_ca_state);
tp->lost_out = 0;
}
if (tp->sacked_out) {
pr_debug("Leak s=%u %d\n",
tp->sacked_out, icsk->icsk_ca_state);
tp->sacked_out = 0;
}
if (tp->retrans_out) {
pr_debug("Leak r=%u %d\n",
tp->retrans_out, icsk->icsk_ca_state);
tp->retrans_out = 0;
}
}
#endif
return flag;
}
| 17,523 |
173,521 | 0 | bool effect_exists(effect_context_t *context)
{
struct listnode *node;
list_for_each(node, &created_effects_list) {
effect_context_t *fx_ctxt = node_to_item(node,
effect_context_t,
effects_list_node);
if (fx_ctxt == context) {
return true;
}
}
return false;
}
| 17,524 |
168,347 | 0 | void BrowserView::SetAlwaysOnTop(bool always_on_top) {
NOTIMPLEMENTED();
}
| 17,525 |
83,019 | 0 | int pdf_set_font(struct pdf_doc *pdf, const char *font)
{
struct pdf_object *obj;
int last_index = 0;
/* See if we've used this font before */
for (obj = pdf_find_first_object(pdf, OBJ_font); obj; obj = obj->next) {
if (strcmp(obj->font.name, font) == 0)
break;
last_index = obj->font.index;
}
/* Create a new font object if we need it */
if (!obj) {
obj = pdf_add_object(pdf, OBJ_font);
if (!obj)
return pdf->errval;
strncpy(obj->font.name, font, sizeof(obj->font.name));
obj->font.name[sizeof(obj->font.name) - 1] = '\0';
obj->font.index = last_index + 1;
}
pdf->current_font = obj;
return 0;
}
| 17,526 |
70,853 | 0 | static int http_buf_read_compressed(URLContext *h, uint8_t *buf, int size)
{
HTTPContext *s = h->priv_data;
int ret;
if (!s->inflate_buffer) {
s->inflate_buffer = av_malloc(DECOMPRESS_BUF_SIZE);
if (!s->inflate_buffer)
return AVERROR(ENOMEM);
}
if (s->inflate_stream.avail_in == 0) {
int read = http_buf_read(h, s->inflate_buffer, DECOMPRESS_BUF_SIZE);
if (read <= 0)
return read;
s->inflate_stream.next_in = s->inflate_buffer;
s->inflate_stream.avail_in = read;
}
s->inflate_stream.avail_out = size;
s->inflate_stream.next_out = buf;
ret = inflate(&s->inflate_stream, Z_SYNC_FLUSH);
if (ret != Z_OK && ret != Z_STREAM_END)
av_log(h, AV_LOG_WARNING, "inflate return value: %d, %s\n",
ret, s->inflate_stream.msg);
return size - s->inflate_stream.avail_out;
}
| 17,527 |
72,981 | 0 | HTMLlineproc0(char *line, struct html_feed_environ *h_env, int internal)
{
Lineprop mode;
int cmd;
struct readbuffer *obuf = h_env->obuf;
int indent, delta;
struct parsed_tag *tag;
Str tokbuf;
struct table *tbl = NULL;
struct table_mode *tbl_mode = NULL;
int tbl_width = 0;
#ifdef USE_M17N
int is_hangul, prev_is_hangul = 0;
#endif
#ifdef DEBUG
if (w3m_debug) {
FILE *f = fopen("zzzproc1", "a");
fprintf(f, "%c%c%c%c",
(obuf->flag & RB_PREMODE) ? 'P' : ' ',
(obuf->table_level >= 0) ? 'T' : ' ',
(obuf->flag & RB_INTXTA) ? 'X' : ' ',
(obuf->flag & (RB_SCRIPT | RB_STYLE)) ? 'S' : ' ');
fprintf(f, "HTMLlineproc1(\"%s\",%d,%lx)\n", line, h_env->limit,
(unsigned long)h_env);
fclose(f);
}
#endif
tokbuf = Strnew();
table_start:
if (obuf->table_level >= 0) {
int level = min(obuf->table_level, MAX_TABLE - 1);
tbl = tables[level];
tbl_mode = &table_mode[level];
tbl_width = table_width(h_env, level);
}
while (*line != '\0') {
char *str, *p;
int is_tag = FALSE;
int pre_mode = (obuf->table_level >= 0) ? tbl_mode->pre_mode :
obuf->flag;
int end_tag = (obuf->table_level >= 0) ? tbl_mode->end_tag :
obuf->end_tag;
if (*line == '<' || obuf->status != R_ST_NORMAL) {
/*
* Tag processing
*/
if (obuf->status == R_ST_EOL)
obuf->status = R_ST_NORMAL;
else {
read_token(h_env->tagbuf, &line, &obuf->status,
pre_mode & RB_PREMODE, obuf->status != R_ST_NORMAL);
if (obuf->status != R_ST_NORMAL)
return;
}
if (h_env->tagbuf->length == 0)
continue;
str = h_env->tagbuf->ptr;
if (*str == '<') {
if (str[1] && REALLY_THE_BEGINNING_OF_A_TAG(str))
is_tag = TRUE;
else if (!(pre_mode & (RB_PLAIN | RB_INTXTA | RB_INSELECT |
RB_SCRIPT | RB_STYLE | RB_TITLE))) {
line = Strnew_m_charp(str + 1, line, NULL)->ptr;
str = "<";
}
}
}
else {
read_token(tokbuf, &line, &obuf->status, pre_mode & RB_PREMODE, 0);
if (obuf->status != R_ST_NORMAL) /* R_ST_AMP ? */
obuf->status = R_ST_NORMAL;
str = tokbuf->ptr;
}
if (pre_mode & (RB_PLAIN | RB_INTXTA | RB_INSELECT | RB_SCRIPT |
RB_STYLE | RB_TITLE)) {
if (is_tag) {
p = str;
if ((tag = parse_tag(&p, internal))) {
if (tag->tagid == end_tag ||
(pre_mode & RB_INSELECT && tag->tagid == HTML_N_FORM)
|| (pre_mode & RB_TITLE
&& (tag->tagid == HTML_N_HEAD
|| tag->tagid == HTML_BODY)))
goto proc_normal;
}
}
/* title */
if (pre_mode & RB_TITLE) {
feed_title(str);
continue;
}
/* select */
if (pre_mode & RB_INSELECT) {
if (obuf->table_level >= 0)
goto proc_normal;
feed_select(str);
continue;
}
if (is_tag) {
if (strncmp(str, "<!--", 4) && (p = strchr(str + 1, '<'))) {
str = Strnew_charp_n(str, p - str)->ptr;
line = Strnew_m_charp(p, line, NULL)->ptr;
}
is_tag = FALSE;
}
if (obuf->table_level >= 0)
goto proc_normal;
/* textarea */
if (pre_mode & RB_INTXTA) {
feed_textarea(str);
continue;
}
/* script */
if (pre_mode & RB_SCRIPT)
continue;
/* style */
if (pre_mode & RB_STYLE)
continue;
}
proc_normal:
if (obuf->table_level >= 0) {
/*
* within table: in <table>..</table>, all input tokens
* are fed to the table renderer, and then the renderer
* makes HTML output.
*/
switch (feed_table(tbl, str, tbl_mode, tbl_width, internal)) {
case 0:
/* </table> tag */
obuf->table_level--;
if (obuf->table_level >= MAX_TABLE - 1)
continue;
end_table(tbl);
if (obuf->table_level >= 0) {
struct table *tbl0 = tables[obuf->table_level];
str = Sprintf("<table_alt tid=%d>", tbl0->ntable)->ptr;
pushTable(tbl0, tbl);
tbl = tbl0;
tbl_mode = &table_mode[obuf->table_level];
tbl_width = table_width(h_env, obuf->table_level);
feed_table(tbl, str, tbl_mode, tbl_width, TRUE);
continue;
/* continue to the next */
}
if (obuf->flag & RB_DEL)
continue;
/* all tables have been read */
if (tbl->vspace > 0 && !(obuf->flag & RB_IGNORE_P)) {
int indent = h_env->envs[h_env->envc].indent;
flushline(h_env, obuf, indent, 0, h_env->limit);
do_blankline(h_env, obuf, indent, 0, h_env->limit);
}
save_fonteffect(h_env, obuf);
renderTable(tbl, tbl_width, h_env);
restore_fonteffect(h_env, obuf);
obuf->flag &= ~RB_IGNORE_P;
if (tbl->vspace > 0) {
int indent = h_env->envs[h_env->envc].indent;
do_blankline(h_env, obuf, indent, 0, h_env->limit);
obuf->flag |= RB_IGNORE_P;
}
set_space_to_prevchar(obuf->prevchar);
continue;
case 1:
/* <table> tag */
break;
default:
continue;
}
}
if (is_tag) {
/*** Beginning of a new tag ***/
if ((tag = parse_tag(&str, internal)))
cmd = tag->tagid;
else
continue;
/* process tags */
if (HTMLtagproc1(tag, h_env) == 0) {
/* preserve the tag for second-stage processing */
if (parsedtag_need_reconstruct(tag))
h_env->tagbuf = parsedtag2str(tag);
push_tag(obuf, h_env->tagbuf->ptr, cmd);
}
#ifdef ID_EXT
else {
process_idattr(obuf, cmd, tag);
}
#endif /* ID_EXT */
obuf->bp.init_flag = 1;
clear_ignore_p_flag(cmd, obuf);
if (cmd == HTML_TABLE)
goto table_start;
else
continue;
}
if (obuf->flag & (RB_DEL | RB_S))
continue;
while (*str) {
mode = get_mctype(str);
delta = get_mcwidth(str);
if (obuf->flag & (RB_SPECIAL & ~RB_NOBR)) {
char ch = *str;
if (!(obuf->flag & RB_PLAIN) && (*str == '&')) {
char *p = str;
int ech = getescapechar(&p);
if (ech == '\n' || ech == '\r') {
ch = '\n';
str = p - 1;
}
else if (ech == '\t') {
ch = '\t';
str = p - 1;
}
}
if (ch != '\n')
obuf->flag &= ~RB_IGNORE_P;
if (ch == '\n') {
str++;
if (obuf->flag & RB_IGNORE_P) {
obuf->flag &= ~RB_IGNORE_P;
continue;
}
if (obuf->flag & RB_PRE_INT)
PUSH(' ');
else
flushline(h_env, obuf, h_env->envs[h_env->envc].indent,
1, h_env->limit);
}
else if (ch == '\t') {
do {
PUSH(' ');
} while ((h_env->envs[h_env->envc].indent + obuf->pos)
% Tabstop != 0);
str++;
}
else if (obuf->flag & RB_PLAIN) {
char *p = html_quote_char(*str);
if (p) {
push_charp(obuf, 1, p, PC_ASCII);
str++;
}
else {
proc_mchar(obuf, 1, delta, &str, mode);
}
}
else {
if (*str == '&')
proc_escape(obuf, &str);
else
proc_mchar(obuf, 1, delta, &str, mode);
}
if (obuf->flag & (RB_SPECIAL & ~RB_PRE_INT))
continue;
}
else {
if (!IS_SPACE(*str))
obuf->flag &= ~RB_IGNORE_P;
if ((mode == PC_ASCII || mode == PC_CTRL) && IS_SPACE(*str)) {
if (*obuf->prevchar->ptr != ' ') {
PUSH(' ');
}
str++;
}
else {
#ifdef USE_M17N
if (mode == PC_KANJI1)
is_hangul = wtf_is_hangul((wc_uchar *) str);
else
is_hangul = 0;
if (!SimplePreserveSpace && mode == PC_KANJI1 &&
!is_hangul && !prev_is_hangul &&
obuf->pos > h_env->envs[h_env->envc].indent &&
Strlastchar(obuf->line) == ' ') {
while (obuf->line->length >= 2 &&
!strncmp(obuf->line->ptr + obuf->line->length -
2, " ", 2)
&& obuf->pos >= h_env->envs[h_env->envc].indent) {
Strshrink(obuf->line, 1);
obuf->pos--;
}
if (obuf->line->length >= 3 &&
obuf->prev_ctype == PC_KANJI1 &&
Strlastchar(obuf->line) == ' ' &&
obuf->pos >= h_env->envs[h_env->envc].indent) {
Strshrink(obuf->line, 1);
obuf->pos--;
}
}
prev_is_hangul = is_hangul;
#endif
if (*str == '&')
proc_escape(obuf, &str);
else
proc_mchar(obuf, obuf->flag & RB_SPECIAL, delta, &str,
mode);
}
}
if (need_flushline(h_env, obuf, mode)) {
char *bp = obuf->line->ptr + obuf->bp.len;
char *tp = bp - obuf->bp.tlen;
int i = 0;
if (tp > obuf->line->ptr && tp[-1] == ' ')
i = 1;
indent = h_env->envs[h_env->envc].indent;
if (obuf->bp.pos - i > indent) {
Str line;
append_tags(obuf);
line = Strnew_charp(bp);
Strshrink(obuf->line, obuf->line->length - obuf->bp.len);
#ifdef FORMAT_NICE
if (obuf->pos - i > h_env->limit)
obuf->flag |= RB_FILL;
#endif /* FORMAT_NICE */
back_to_breakpoint(obuf);
flushline(h_env, obuf, indent, 0, h_env->limit);
#ifdef FORMAT_NICE
obuf->flag &= ~RB_FILL;
#endif /* FORMAT_NICE */
HTMLlineproc1(line->ptr, h_env);
}
}
}
}
if (!(obuf->flag & (RB_SPECIAL | RB_INTXTA | RB_INSELECT))) {
char *tp;
int i = 0;
if (obuf->bp.pos == obuf->pos) {
tp = &obuf->line->ptr[obuf->bp.len - obuf->bp.tlen];
}
else {
tp = &obuf->line->ptr[obuf->line->length];
}
if (tp > obuf->line->ptr && tp[-1] == ' ')
i = 1;
indent = h_env->envs[h_env->envc].indent;
if (obuf->pos - i > h_env->limit) {
#ifdef FORMAT_NICE
obuf->flag |= RB_FILL;
#endif /* FORMAT_NICE */
flushline(h_env, obuf, indent, 0, h_env->limit);
#ifdef FORMAT_NICE
obuf->flag &= ~RB_FILL;
#endif /* FORMAT_NICE */
}
}
}
| 17,528 |
1,097 | 0 | GfxColorSpace *GfxDeviceNColorSpace::parse(Array *arr) {
GfxDeviceNColorSpace *cs;
int nCompsA;
GooString *namesA[gfxColorMaxComps];
GfxColorSpace *altA;
Function *funcA;
Object obj1, obj2;
int i;
if (arr->getLength() != 4 && arr->getLength() != 5) {
error(-1, "Bad DeviceN color space");
goto err1;
}
if (!arr->get(1, &obj1)->isArray()) {
error(-1, "Bad DeviceN color space (names)");
goto err2;
}
nCompsA = obj1.arrayGetLength();
if (nCompsA > gfxColorMaxComps) {
error(-1, "DeviceN color space with too many (%d > %d) components",
nCompsA, gfxColorMaxComps);
nCompsA = gfxColorMaxComps;
}
for (i = 0; i < nCompsA; ++i) {
if (!obj1.arrayGet(i, &obj2)->isName()) {
error(-1, "Bad DeviceN color space (names)");
obj2.free();
goto err2;
}
namesA[i] = new GooString(obj2.getName());
obj2.free();
}
obj1.free();
arr->get(2, &obj1);
if (!(altA = GfxColorSpace::parse(&obj1))) {
error(-1, "Bad DeviceN color space (alternate color space)");
goto err3;
}
obj1.free();
arr->get(3, &obj1);
if (!(funcA = Function::parse(&obj1))) {
goto err4;
}
obj1.free();
cs = new GfxDeviceNColorSpace(nCompsA, altA, funcA);
cs->nonMarking = gTrue;
for (i = 0; i < nCompsA; ++i) {
cs->names[i] = namesA[i];
if (namesA[i]->cmp("None")) {
cs->nonMarking = gFalse;
}
}
return cs;
err4:
delete altA;
err3:
for (i = 0; i < nCompsA; ++i) {
delete namesA[i];
}
err2:
obj1.free();
err1:
return NULL;
}
| 17,529 |
122,420 | 0 | bool HTMLTextAreaElement::appendFormData(FormDataList& encoding, bool)
{
if (name().isEmpty())
return false;
document().updateLayout();
const String& text = (m_wrap == HardWrap) ? valueWithHardLineBreaks() : value();
encoding.appendData(name(), text);
const AtomicString& dirnameAttrValue = fastGetAttribute(dirnameAttr);
if (!dirnameAttrValue.isNull())
encoding.appendData(dirnameAttrValue, directionForFormData());
return true;
}
| 17,530 |
186,651 | 1 | void WebGL2RenderingContextBase::texImage2D(GLenum target,
GLint level,
GLint internalformat,
GLsizei width,
GLsizei height,
GLint border,
GLenum format,
GLenum type,
GLintptr offset) {
if (isContextLost())
return;
if (!ValidateTexture2DBinding("texImage2D", target))
return;
if (!bound_pixel_unpack_buffer_) {
SynthesizeGLError(GL_INVALID_OPERATION, "texImage2D",
"no bound PIXEL_UNPACK_BUFFER");
return;
}
if (!ValidateTexFunc("texImage2D", kTexImage, kSourceUnpackBuffer, target,
level, internalformat, width, height, 1, border, format,
type, 0, 0, 0))
return;
if (!ValidateValueFitNonNegInt32("texImage2D", "offset", offset))
return;
ContextGL()->TexImage2D(
target, level, ConvertTexInternalFormat(internalformat, type), width,
height, border, format, type, reinterpret_cast<const void*>(offset));
}
| 17,531 |
107,087 | 0 | QWebViewportInfo* QQuickWebViewExperimental::viewportInfo()
{
return m_viewportInfo;
}
| 17,532 |
144,308 | 0 | void LoginDisplayHostDestroyed() { login_display_host_ = nullptr; }
| 17,533 |
169,857 | 0 | xsltFreeCtxtExts(xsltTransformContextPtr ctxt)
{
if (ctxt->extElements != NULL)
xmlHashFree(ctxt->extElements, NULL);
if (ctxt->extFunctions != NULL)
xmlHashFree(ctxt->extFunctions, NULL);
}
| 17,534 |
13,284 | 0 | pdf14_clist_create_compositor(gx_device * dev, gx_device ** pcdev,
const gs_composite_t * pct, gs_gstate * pgs, gs_memory_t * mem,
gx_device *cdev)
{
pdf14_clist_device * pdev = (pdf14_clist_device *)dev;
int code, is_pdf14_compositor;
const gs_pdf14trans_t * pdf14pct = (const gs_pdf14trans_t *) pct;
/* We only handle a few PDF 1.4 transparency operations */
if ((is_pdf14_compositor = gs_is_pdf14trans_compositor(pct)) != 0) {
switch (pdf14pct->params.pdf14_op) {
case PDF14_PUSH_DEVICE:
/* Re-activate the PDF 1.4 compositor */
pdev->saved_target_color_info = pdev->target->color_info;
pdev->target->color_info = pdev->color_info;
pdev->saved_target_encode_color = pdev->target->procs.encode_color;
pdev->saved_target_decode_color = pdev->target->procs.decode_color;
pdev->target->procs.encode_color = pdev->procs.encode_color =
pdev->my_encode_color;
pdev->target->procs.decode_color = pdev->procs.decode_color =
pdev->my_decode_color;
pdev->saved_target_get_color_mapping_procs =
pdev->target->procs.get_color_mapping_procs;
pdev->saved_target_get_color_comp_index =
pdev->target->procs.get_color_comp_index;
pdev->target->procs.get_color_mapping_procs =
pdev->procs.get_color_mapping_procs =
pdev->my_get_color_mapping_procs;
pdev->target->procs.get_color_comp_index =
pdev->procs.get_color_comp_index =
pdev->my_get_color_comp_index;
pdev->save_get_cmap_procs = pgs->get_cmap_procs;
pgs->get_cmap_procs = pdf14_get_cmap_procs;
gx_set_cmap_procs(pgs, dev);
code = pdf14_recreate_clist_device(mem, pgs, dev, pdf14pct);
pdev->blend_mode = pdev->text_knockout = 0;
pdev->opacity = pdev->shape = 0.0;
if (code < 0)
return code;
/*
* This routine is part of the PDF 1.4 clist write device.
* Change the compositor procs to not create another since we
* do not need to create a chain of identical devices.
*/
{
gs_composite_t pctemp = *pct;
pctemp.type = &gs_composite_pdf14trans_no_clist_writer_type;
code = dev_proc(pdev->target, create_compositor)
(pdev->target, pcdev, &pctemp, pgs, mem, cdev);
*pcdev = dev;
return code;
}
case PDF14_POP_DEVICE:
/* Restore the color_info for the clist device */
pdev->target->color_info = pdev->saved_target_color_info;
pdev->target->procs.encode_color =
pdev->saved_target_encode_color;
pdev->target->procs.decode_color =
pdev->saved_target_decode_color;
pdev->target->procs.get_color_mapping_procs =
pdev->saved_target_get_color_mapping_procs;
pdev->target->procs.get_color_comp_index =
pdev->saved_target_get_color_comp_index;
pgs->get_cmap_procs = pdev->save_get_cmap_procs;
gx_set_cmap_procs(pgs, pdev->target);
gx_device_decache_colors(pdev->target);
/* Disable the PDF 1.4 compositor */
pdf14_disable_clist_device(mem, pgs, dev);
/*
* Make sure that the transfer funtions, etc. are current.
*/
code = cmd_put_color_mapping(
(gx_device_clist_writer *)(pdev->target), pgs);
if (code < 0)
return code;
break;
case PDF14_BEGIN_TRANS_GROUP:
/*
* Keep track of any changes made in the blending parameters.
These need to be written out in the same bands as the group
information is written. Hence the passing of the dimensions
for the group. */
code = pdf14_clist_update_params(pdev, pgs, true,
(gs_pdf14trans_params_t *)&(pdf14pct->params));
if (code < 0)
return code;
if (pdf14pct->params.Background_components != 0 &&
pdf14pct->params.Background_components !=
pdev->color_info.num_components)
return_error(gs_error_rangecheck);
/* We need to update the clist writer device procs based upon the
the group color space. For simplicity, the list item is
created even if the color space did not change */
/* First store the current ones */
pdf14_push_parent_color(dev, pgs);
code = pdf14_update_device_color_procs_push_c(dev,
pdf14pct->params.group_color,
pdf14pct->params.icc_hash, pgs,
pdf14pct->params.iccprofile, false);
if (code < 0)
return code;
break;
case PDF14_BEGIN_TRANS_MASK:
/* We need to update the clist writer device procs based upon the
the group color space. For simplicity, the list item is created
even if the color space did not change */
/* First store the current ones */
if (pdf14pct->params.subtype == TRANSPARENCY_MASK_None)
break;
pdf14_push_parent_color(dev, pgs);
/* If we are playing back from a clist, the iccprofile may need to be loaded */
if (pdf14pct->params.iccprofile == NULL) {
gs_pdf14trans_params_t *pparams_noconst = (gs_pdf14trans_params_t *)&(pdf14pct->params);
pparams_noconst->iccprofile = gsicc_read_serial_icc((gx_device *) cdev,
pdf14pct->params.icc_hash);
if (pparams_noconst->iccprofile == NULL)
return gs_throw(-1, "ICC data not found in clist");
/* Keep a pointer to the clist device */
pparams_noconst->iccprofile->dev = (gx_device *)cdev;
/* Now we need to load the rest of the profile buffer */
if (pparams_noconst->iccprofile->buffer == NULL) {
gcmmhprofile_t dummy = gsicc_get_profile_handle_clist(pparams_noconst->iccprofile, mem);
if (dummy == NULL)
return_error(gs_error_VMerror);
}
}
/* Now update the device procs */
code = pdf14_update_device_color_procs_push_c(dev,
pdf14pct->params.group_color,
pdf14pct->params.icc_hash, pgs,
pdf14pct->params.iccprofile, true);
if (code < 0)
return code;
/* Also, if the BC is a value that may end up as something other
than transparent. We must use the parent colors bounding box in
determining the range of bands in which this mask can affect.
So, if needed change the masks bounding box at this time */
break;
case PDF14_END_TRANS_GROUP:
case PDF14_END_TRANS_MASK:
/* We need to update the clist writer device procs based upon the
the group color space. */
code = pdf14_update_device_color_procs_pop_c(dev,pgs);
if (code < 0)
return code;
break;
case PDF14_PUSH_TRANS_STATE:
break;
case PDF14_POP_TRANS_STATE:
break;
case PDF14_PUSH_SMASK_COLOR:
code = pdf14_increment_smask_color(pgs,dev);
*pcdev = dev;
return code; /* Note, this are NOT put in the clist */
break;
case PDF14_POP_SMASK_COLOR:
code = pdf14_decrement_smask_color(pgs,dev);
*pcdev = dev;
return code; /* Note, this are NOT put in the clist */
break;
case PDF14_SET_BLEND_PARAMS:
/* If there is a change we go ahead and apply it to the target */
code = pdf14_clist_update_params(pdev, pgs, false,
(gs_pdf14trans_params_t *)&(pdf14pct->params));
*pcdev = dev;
return code;
break;
case PDF14_ABORT_DEVICE:
break;
default:
break; /* Pass remaining ops to target */
}
}
code = dev_proc(pdev->target, create_compositor)
(pdev->target, pcdev, pct, pgs, mem, cdev);
/* If we were accumulating into a pdf14-clist-accum device, */
/* we now have to render the page into it's target device */
if (is_pdf14_compositor && pdf14pct->params.pdf14_op == PDF14_POP_DEVICE &&
pdev->target->stype == &st_pdf14_accum) {
int y, rows_used;
byte *linebuf = gs_alloc_bytes(mem, gx_device_raster((gx_device *)pdev, true), "pdf14-clist_accum pop dev");
byte *actual_data;
gx_device *tdev = pdev->target; /* the printer class clist device used to accumulate */
/* get the target device we want to send the image to */
gx_device *target = ((pdf14_device *)((gx_device_pdf14_accum *)(tdev))->save_p14dev)->target;
gs_image1_t image;
gs_color_space *pcs;
gx_image_enum_common_t *info;
gx_image_plane_t planes;
gsicc_rendering_param_t render_cond;
cmm_dev_profile_t *dev_profile;
/*
* Set color space in preparation for sending an image.
*/
code = gs_cspace_build_ICC(&pcs, NULL, pgs->memory);
if (linebuf == NULL || pcs == NULL)
goto put_accum_error;
/* Need to set this to avoid color management during the
image color render operation. Exception is for the special case
when the destination was CIELAB. Then we need to convert from
default RGB to CIELAB in the put image operation. That will happen
here as we should have set the profile for the pdf14 device to RGB
and the target will be CIELAB */
code = dev_proc(dev, get_profile)(dev, &dev_profile);
if (code < 0) {
rc_decrement_only_cs(pcs, "pdf14_put_image");
return code;
}
gsicc_extract_profile(GS_UNKNOWN_TAG, dev_profile,
&(pcs->cmm_icc_profile_data), &render_cond);
/* pcs takes a reference to the profile data it just retrieved. */
rc_increment(pcs->cmm_icc_profile_data);
gscms_set_icc_range(&(pcs->cmm_icc_profile_data));
gs_image_t_init_adjust(&image, pcs, false);
image.ImageMatrix.xx = (float)pdev->width;
image.ImageMatrix.yy = (float)pdev->height;
image.Width = pdev->width;
image.Height = pdev->height;
image.BitsPerComponent = 8;
ctm_only_writable(pgs).xx = (float)pdev->width;
ctm_only_writable(pgs).xy = 0;
ctm_only_writable(pgs).yx = 0;
ctm_only_writable(pgs).yy = (float)pdev->height;
ctm_only_writable(pgs).tx = 0.0;
ctm_only_writable(pgs).ty = 0.0;
code = dev_proc(target, begin_typed_image) (target,
pgs, NULL,
(gs_image_common_t *)&image,
NULL, NULL, NULL,
pgs->memory, &info);
if (code < 0)
goto put_accum_error;
for (y=0; y < tdev->height; y++) {
code = dev_proc(tdev, get_bits)(tdev, y, linebuf, &actual_data);
planes.data = actual_data;
planes.data_x = 0;
planes.raster = tdev->width * tdev->color_info.num_components;
if ((code = info->procs->plane_data(info, &planes, 1, &rows_used)) < 0)
goto put_accum_error;
}
info->procs->end_image(info, true);
put_accum_error:
gs_free_object(pdev->memory, linebuf, "pdf14_put_image");
/* This will also decrement the device profile */
rc_decrement_only_cs(pcs, "pdf14_put_image");
dev_proc(tdev, close_device)(tdev); /* frees the prn_device memory */
/* Now unhook the clist device and hook to the original so we can clean up */
gx_device_set_target((gx_device_forward *)pdev,
((gx_device_pdf14_accum *)(pdev->target))->save_p14dev);
pdev->pclist_device = pdev->target; /* FIXME: is this kosher ? */
*pcdev = pdev->target; /* pass upwards to switch devices */
pdev->color_info = target->color_info; /* same as in pdf14_disable_clist */
gs_free_object(tdev->memory, tdev, "popdevice pdf14-accum");
return 0; /* DON'T perform set_target */
}
if (*pcdev != pdev->target)
gx_device_set_target((gx_device_forward *)pdev, *pcdev);
*pcdev = dev;
return code;
}
| 17,535 |
75,298 | 0 | static float square(float x)
{
return x*x;
}
| 17,536 |
129,383 | 0 | uint32 GLES2DecoderImpl::GetTextureUploadCount() {
return texture_state_.texture_upload_count +
async_pixel_transfer_manager_->GetTextureUploadCount();
}
| 17,537 |
158,501 | 0 | void WebLocalFrameImpl::BindDevToolsAgentRequest(
mojom::blink::DevToolsAgentAssociatedRequest request) {
if (!dev_tools_agent_)
dev_tools_agent_ = WebDevToolsAgentImpl::CreateForFrame(this);
dev_tools_agent_->BindRequest(std::move(request));
}
| 17,538 |
100,387 | 0 | void BrowserRenderProcessHost::OnUpdatedCacheStats(
const WebCache::UsageStats& stats) {
WebCacheManager::GetInstance()->ObserveStats(id(), stats);
}
| 17,539 |
75,529 | 0 | static void usb_set_lpm_parameters(struct usb_device *udev)
{
struct usb_hub *hub;
unsigned int port_to_port_delay;
unsigned int udev_u1_del;
unsigned int udev_u2_del;
unsigned int hub_u1_del;
unsigned int hub_u2_del;
if (!udev->lpm_capable || udev->speed < USB_SPEED_SUPER)
return;
hub = usb_hub_to_struct_hub(udev->parent);
/* It doesn't take time to transition the roothub into U0, since it
* doesn't have an upstream link.
*/
if (!hub)
return;
udev_u1_del = udev->bos->ss_cap->bU1devExitLat;
udev_u2_del = le16_to_cpu(udev->bos->ss_cap->bU2DevExitLat);
hub_u1_del = udev->parent->bos->ss_cap->bU1devExitLat;
hub_u2_del = le16_to_cpu(udev->parent->bos->ss_cap->bU2DevExitLat);
usb_set_lpm_mel(udev, &udev->u1_params, udev_u1_del,
hub, &udev->parent->u1_params, hub_u1_del);
usb_set_lpm_mel(udev, &udev->u2_params, udev_u2_del,
hub, &udev->parent->u2_params, hub_u2_del);
/*
* Appendix C, section C.2.2.2, says that there is a slight delay from
* when the parent hub notices the downstream port is trying to
* transition to U0 to when the hub initiates a U0 transition on its
* upstream port. The section says the delays are tPort2PortU1EL and
* tPort2PortU2EL, but it doesn't define what they are.
*
* The hub chapter, sections 10.4.2.4 and 10.4.2.5 seem to be talking
* about the same delays. Use the maximum delay calculations from those
* sections. For U1, it's tHubPort2PortExitLat, which is 1us max. For
* U2, it's tHubPort2PortExitLat + U2DevExitLat - U1DevExitLat. I
* assume the device exit latencies they are talking about are the hub
* exit latencies.
*
* What do we do if the U2 exit latency is less than the U1 exit
* latency? It's possible, although not likely...
*/
port_to_port_delay = 1;
usb_set_lpm_pel(udev, &udev->u1_params, udev_u1_del,
hub, &udev->parent->u1_params, hub_u1_del,
port_to_port_delay);
if (hub_u2_del > hub_u1_del)
port_to_port_delay = 1 + hub_u2_del - hub_u1_del;
else
port_to_port_delay = 1 + hub_u1_del;
usb_set_lpm_pel(udev, &udev->u2_params, udev_u2_del,
hub, &udev->parent->u2_params, hub_u2_del,
port_to_port_delay);
/* Now that we've got PEL, calculate SEL. */
usb_set_lpm_sel(udev, &udev->u1_params);
usb_set_lpm_sel(udev, &udev->u2_params);
}
| 17,540 |
59,912 | 0 | static int uas_slave_alloc(struct scsi_device *sdev)
{
struct uas_dev_info *devinfo =
(struct uas_dev_info *)sdev->host->hostdata;
sdev->hostdata = devinfo;
/*
* USB has unusual DMA-alignment requirements: Although the
* starting address of each scatter-gather element doesn't matter,
* the length of each element except the last must be divisible
* by the Bulk maxpacket value. There's currently no way to
* express this by block-layer constraints, so we'll cop out
* and simply require addresses to be aligned at 512-byte
* boundaries. This is okay since most block I/O involves
* hardware sectors that are multiples of 512 bytes in length,
* and since host controllers up through USB 2.0 have maxpacket
* values no larger than 512.
*
* But it doesn't suffice for Wireless USB, where Bulk maxpacket
* values can be as large as 2048. To make that work properly
* will require changes to the block layer.
*/
blk_queue_update_dma_alignment(sdev->request_queue, (512 - 1));
if (devinfo->flags & US_FL_MAX_SECTORS_64)
blk_queue_max_hw_sectors(sdev->request_queue, 64);
else if (devinfo->flags & US_FL_MAX_SECTORS_240)
blk_queue_max_hw_sectors(sdev->request_queue, 240);
return 0;
}
| 17,541 |
164,235 | 0 | bool CanUseExistingResource(const net::HttpResponseInfo* http_info) {
if (!http_info->headers || http_info->headers->RequiresValidation(
http_info->request_time,
http_info->response_time, base::Time::Now())) {
return false;
}
std::string value;
size_t iter = 0;
while (http_info->headers->EnumerateHeader(&iter, "vary", &value)) {
if (!base::EqualsCaseInsensitiveASCII(value, "Accept-Encoding") &&
!base::EqualsCaseInsensitiveASCII(value, "Origin")) {
return false;
}
}
return true;
}
| 17,542 |
110,976 | 0 | LRESULT RootWindowHostWin::OnKeyEvent(UINT message,
WPARAM w_param,
LPARAM l_param) {
MSG msg = { hwnd(), message, w_param, l_param };
KeyEvent keyev(msg, message == WM_CHAR);
SetMsgHandled(root_window_->DispatchKeyEvent(&keyev));
return 0;
}
| 17,543 |
168,480 | 0 | void CoordinatorImpl::RequestPrivateMemoryFootprint(
base::ProcessId pid,
RequestPrivateMemoryFootprintCallback callback) {
auto adapter = [](RequestPrivateMemoryFootprintCallback callback,
bool success, uint64_t,
mojom::GlobalMemoryDumpPtr global_memory_dump) {
std::move(callback).Run(success, std::move(global_memory_dump));
};
QueuedRequest::Args args(
base::trace_event::MemoryDumpType::SUMMARY_ONLY,
base::trace_event::MemoryDumpLevelOfDetail::BACKGROUND, {},
false /* add_to_trace */, pid, /*memory_footprint_only=*/true);
RequestGlobalMemoryDumpInternal(args,
base::BindOnce(adapter, std::move(callback)));
}
| 17,544 |
145,621 | 0 | mojom::NavigationClient* NavigationRequest::GetCommitNavigationClient() {
if (commit_navigation_client_ && commit_navigation_client_.is_bound())
return commit_navigation_client_.get();
return nullptr;
}
| 17,545 |
34,970 | 0 | static void rpc_release_resources_task(struct rpc_task *task)
{
if (task->tk_rqstp)
xprt_release(task);
if (task->tk_msg.rpc_cred) {
put_rpccred(task->tk_msg.rpc_cred);
task->tk_msg.rpc_cred = NULL;
}
rpc_task_release_client(task);
}
| 17,546 |
106,502 | 0 | void WebPageProxy::didReceiveTitleForFrame(uint64_t frameID, const String& title, CoreIPC::ArgumentDecoder* arguments)
{
RefPtr<APIObject> userData;
WebContextUserMessageDecoder messageDecoder(userData, context());
if (!arguments->decode(messageDecoder))
return;
WebFrameProxy* frame = process()->webFrame(frameID);
MESSAGE_CHECK(frame);
frame->didChangeTitle(title);
m_loaderClient.didReceiveTitleForFrame(this, title, frame, userData.get());
}
| 17,547 |
103,530 | 0 | bool ExtensionService::UninstallExtensionHelper(
ExtensionService* extensions_service,
const std::string& extension_id) {
const Extension* extension =
extensions_service->GetInstalledExtension(extension_id);
if (!extension) {
LOG(WARNING) << "Attempted uninstallation of non-existent extension with "
<< "id: " << extension_id;
return false;
}
std::string error;
if (!extensions_service->UninstallExtension(extension_id, false, &error)) {
LOG(WARNING) << "Cannot uninstall extension with id " << extension_id
<< ": " << error;
return false;
}
return true;
}
| 17,548 |
57,893 | 0 | static inline void unmap_mapping_range_tree(struct rb_root *root,
struct zap_details *details)
{
struct vm_area_struct *vma;
pgoff_t vba, vea, zba, zea;
vma_interval_tree_foreach(vma, root,
details->first_index, details->last_index) {
vba = vma->vm_pgoff;
vea = vba + vma_pages(vma) - 1;
/* Assume for now that PAGE_CACHE_SHIFT == PAGE_SHIFT */
zba = details->first_index;
if (zba < vba)
zba = vba;
zea = details->last_index;
if (zea > vea)
zea = vea;
unmap_mapping_range_vma(vma,
((zba - vba) << PAGE_SHIFT) + vma->vm_start,
((zea - vba + 1) << PAGE_SHIFT) + vma->vm_start,
details);
}
}
| 17,549 |
163,988 | 0 | void PaymentRequestState::SetSelectedInstrument(PaymentInstrument* instrument) {
selected_instrument_ = instrument;
UpdateIsReadyToPayAndNotifyObservers();
}
| 17,550 |
93,700 | 0 | cJSON *cJSON_CreateIntArray(const int *numbers,int count) {int i;cJSON *n=0,*p=0,*a=cJSON_CreateArray();for(i=0;a && i<count;i++){n=cJSON_CreateNumber(numbers[i]);if(!n){cJSON_Delete(a);return 0;}if(!i)a->child=n;else suffix_object(p,n);p=n;}return a;}
| 17,551 |
39,852 | 0 | struct sk_buff *__pskb_copy(struct sk_buff *skb, int headroom, gfp_t gfp_mask)
{
unsigned int size = skb_headlen(skb) + headroom;
struct sk_buff *n = __alloc_skb(size, gfp_mask,
skb_alloc_rx_flag(skb), NUMA_NO_NODE);
if (!n)
goto out;
/* Set the data pointer */
skb_reserve(n, headroom);
/* Set the tail pointer and length */
skb_put(n, skb_headlen(skb));
/* Copy the bytes */
skb_copy_from_linear_data(skb, n->data, n->len);
n->truesize += skb->data_len;
n->data_len = skb->data_len;
n->len = skb->len;
if (skb_shinfo(skb)->nr_frags) {
int i;
if (skb_orphan_frags(skb, gfp_mask)) {
kfree_skb(n);
n = NULL;
goto out;
}
for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
skb_shinfo(n)->frags[i] = skb_shinfo(skb)->frags[i];
skb_frag_ref(skb, i);
}
skb_shinfo(n)->nr_frags = i;
}
if (skb_has_frag_list(skb)) {
skb_shinfo(n)->frag_list = skb_shinfo(skb)->frag_list;
skb_clone_fraglist(n);
}
copy_skb_header(n, skb);
out:
return n;
}
| 17,552 |
29,149 | 0 | static int nfs4_do_create(struct inode *dir, struct dentry *dentry, struct nfs4_createdata *data)
{
int status = nfs4_call_sync(NFS_SERVER(dir)->client, NFS_SERVER(dir), &data->msg,
&data->arg.seq_args, &data->res.seq_res, 1);
if (status == 0) {
update_changeattr(dir, &data->res.dir_cinfo);
status = nfs_instantiate(dentry, data->res.fh, data->res.fattr);
}
return status;
}
| 17,553 |
132,163 | 0 | void RenderViewTest::SendWebMouseEvent(
const blink::WebMouseEvent& mouse_event) {
RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_);
impl->OnMessageReceived(
InputMsg_HandleInputEvent(0, &mouse_event, ui::LatencyInfo(), false));
}
| 17,554 |
152,780 | 0 | void SparseHistogram::WriteAscii(std::string* output) const {
WriteAsciiImpl(true, "\n", output);
}
| 17,555 |
112,387 | 0 | void Document::addMessage(MessageSource source, MessageLevel level, const String& message, const String& sourceURL, unsigned lineNumber, PassRefPtr<ScriptCallStack> callStack, ScriptState* state, unsigned long requestIdentifier)
{
if (!isContextThread()) {
postTask(AddConsoleMessageTask::create(source, level, message));
return;
}
if (Page* page = this->page())
page->console()->addMessage(source, level, message, sourceURL, lineNumber, callStack, state, requestIdentifier);
}
| 17,556 |
87,411 | 0 | static RECTANGLE_16* region16_extents_noconst(REGION16* region)
{
if (!region)
return NULL;
return ®ion->extents;
}
| 17,557 |
110,686 | 0 | bool TextureManager::TextureInfo::SetParameter(
const FeatureInfo* feature_info, GLenum pname, GLint param) {
DCHECK(feature_info);
if (target_ == GL_TEXTURE_EXTERNAL_OES ||
target_ == GL_TEXTURE_RECTANGLE_ARB) {
if (pname == GL_TEXTURE_MIN_FILTER &&
(param != GL_NEAREST && param != GL_LINEAR))
return false;
if ((pname == GL_TEXTURE_WRAP_S || pname == GL_TEXTURE_WRAP_T) &&
param != GL_CLAMP_TO_EDGE)
return false;
}
switch (pname) {
case GL_TEXTURE_MIN_FILTER:
if (!feature_info->validators()->texture_min_filter_mode.IsValid(param)) {
return false;
}
min_filter_ = param;
break;
case GL_TEXTURE_MAG_FILTER:
if (!feature_info->validators()->texture_mag_filter_mode.IsValid(param)) {
return false;
}
mag_filter_ = param;
break;
case GL_TEXTURE_WRAP_S:
if (!feature_info->validators()->texture_wrap_mode.IsValid(param)) {
return false;
}
wrap_s_ = param;
break;
case GL_TEXTURE_WRAP_T:
if (!feature_info->validators()->texture_wrap_mode.IsValid(param)) {
return false;
}
wrap_t_ = param;
break;
case GL_TEXTURE_MAX_ANISOTROPY_EXT:
break;
case GL_TEXTURE_USAGE_ANGLE:
if (!feature_info->validators()->texture_usage.IsValid(param)) {
return false;
}
usage_ = param;
break;
default:
NOTREACHED();
return false;
}
Update(feature_info);
UpdateCleared();
return true;
}
| 17,558 |
36,256 | 0 | void sctp_assoc_rwnd_decrease(struct sctp_association *asoc, unsigned int len)
{
int rx_count;
int over = 0;
if (unlikely(!asoc->rwnd || asoc->rwnd_over))
pr_debug("%s: association:%p has asoc->rwnd:%u, "
"asoc->rwnd_over:%u!\n", __func__, asoc,
asoc->rwnd, asoc->rwnd_over);
if (asoc->ep->rcvbuf_policy)
rx_count = atomic_read(&asoc->rmem_alloc);
else
rx_count = atomic_read(&asoc->base.sk->sk_rmem_alloc);
/* If we've reached or overflowed our receive buffer, announce
* a 0 rwnd if rwnd would still be positive. Store the
* the potential pressure overflow so that the window can be restored
* back to original value.
*/
if (rx_count >= asoc->base.sk->sk_rcvbuf)
over = 1;
if (asoc->rwnd >= len) {
asoc->rwnd -= len;
if (over) {
asoc->rwnd_press += asoc->rwnd;
asoc->rwnd = 0;
}
} else {
asoc->rwnd_over = len - asoc->rwnd;
asoc->rwnd = 0;
}
pr_debug("%s: asoc:%p rwnd decreased by %d to (%u, %u, %u)\n",
__func__, asoc, len, asoc->rwnd, asoc->rwnd_over,
asoc->rwnd_press);
}
| 17,559 |
187,425 | 1 | static int svc_can_register(const uint16_t *name, size_t name_len, pid_t spid, uid_t uid)
{
const char *perm = "add";
if (uid >= AID_APP) {
return 0; /* Don't allow apps to register services */
}
return check_mac_perms_from_lookup(spid, uid, perm, str8(name, name_len)) ? 1 : 0;
}
| 17,560 |
64,587 | 0 | void _yr_scan_remove_match_from_list(
YR_MATCH* match,
YR_MATCHES* matches_list)
{
if (match->prev != NULL)
match->prev->next = match->next;
if (match->next != NULL)
match->next->prev = match->prev;
if (matches_list->head == match)
matches_list->head = match->next;
if (matches_list->tail == match)
matches_list->tail = match->prev;
matches_list->count--;
match->next = NULL;
match->prev = NULL;
}
| 17,561 |
108,015 | 0 | bool InlineTextBox::isSelected(int startPos, int endPos) const
{
int sPos = max(startPos - m_start, 0);
int ePos = min(endPos - m_start, (int)m_len);
return (sPos < ePos);
}
| 17,562 |
19,185 | 0 | void _out_dns_mark_bad(conn_t out) {
if (out->s2s->dns_bad_timeout > 0) {
dnsres_t bad;
char *ipport;
/* mark this host as bad */
ipport = dns_make_ipport(out->ip, out->port);
bad = xhash_get(out->s2s->dns_bad, ipport);
if (bad == NULL) {
bad = (dnsres_t) calloc(1, sizeof(struct dnsres_st));
bad->key = ipport;
xhash_put(out->s2s->dns_bad, ipport, bad);
}
bad->expiry = time(NULL) + out->s2s->dns_bad_timeout;
}
}
| 17,563 |
176,370 | 0 | explicit StringWrapperElementsAccessor(const char* name)
: ElementsAccessorBase<Subclass, KindTraits>(name) {
USE(KindTraits::Kind);
}
| 17,564 |
181,475 | 1 | DefragTimeoutTest(void)
{
int i;
int ret = 0;
/* Setup a small numberr of trackers. */
if (ConfSet("defrag.trackers", "16") != 1) {
printf("ConfSet failed: ");
goto end;
}
DefragInit();
/* Load in 16 packets. */
for (i = 0; i < 16; i++) {
Packet *p = BuildTestPacket(i, 0, 1, 'A' + i, 16);
if (p == NULL)
goto end;
Packet *tp = Defrag(NULL, NULL, p, NULL);
SCFree(p);
if (tp != NULL) {
SCFree(tp);
goto end;
}
}
/* Build a new packet but push the timestamp out by our timeout.
* This should force our previous fragments to be timed out. */
Packet *p = BuildTestPacket(99, 0, 1, 'A' + i, 16);
if (p == NULL)
goto end;
p->ts.tv_sec += (defrag_context->timeout + 1);
Packet *tp = Defrag(NULL, NULL, p, NULL);
if (tp != NULL) {
SCFree(tp);
goto end;
}
DefragTracker *tracker = DefragLookupTrackerFromHash(p);
if (tracker == NULL)
goto end;
if (tracker->id != 99)
goto end;
SCFree(p);
ret = 1;
end:
DefragDestroy();
return ret;
}
| 17,565 |
142,297 | 0 | void ChromePasswordManagerClient::HidePasswordGenerationPopup() {
if (popup_controller_)
popup_controller_->HideAndDestroy();
}
| 17,566 |
153,213 | 0 | uint32_t DesktopWindowTreeHostX11::DispatchEvent(
const ui::PlatformEvent& event) {
XEvent* xev = event;
TRACE_EVENT1("views", "DesktopWindowTreeHostX11::Dispatch",
"event->type", event->type);
UpdateWMUserTime(event);
switch (xev->type) {
case EnterNotify:
case LeaveNotify: {
OnCrossingEvent(xev->type == EnterNotify, xev->xcrossing.focus,
xev->xcrossing.mode, xev->xcrossing.detail);
if (xev->xcrossing.detail != NotifyInferior) {
ui::MouseEvent mouse_event(xev);
DispatchMouseEvent(&mouse_event);
}
break;
}
case Expose: {
gfx::Rect damage_rect_in_pixels(xev->xexpose.x, xev->xexpose.y,
xev->xexpose.width, xev->xexpose.height);
compositor()->ScheduleRedrawRect(damage_rect_in_pixels);
break;
}
case KeyPress: {
if (ui::AtkUtilAuraLinux::HandleKeyEvent(xev) !=
ui::DiscardAtkKeyEvent::Discard) {
ui::KeyEvent keydown_event(xev);
DispatchKeyEvent(&keydown_event);
}
break;
}
case KeyRelease: {
if (!IsActive() && !HasCapture())
break;
if (ui::AtkUtilAuraLinux::HandleKeyEvent(xev) !=
ui::DiscardAtkKeyEvent::Discard) {
ui::KeyEvent key_event(xev);
DispatchKeyEvent(&key_event);
}
break;
}
case ButtonPress:
case ButtonRelease: {
ui::EventType event_type = ui::EventTypeFromNative(xev);
switch (event_type) {
case ui::ET_MOUSEWHEEL: {
ui::MouseWheelEvent mouseev(xev);
DispatchMouseEvent(&mouseev);
break;
}
case ui::ET_MOUSE_PRESSED:
case ui::ET_MOUSE_RELEASED: {
ui::MouseEvent mouseev(xev);
DispatchMouseEvent(&mouseev);
break;
}
case ui::ET_UNKNOWN:
break;
default:
NOTREACHED() << event_type;
}
break;
}
case x11::FocusIn:
case x11::FocusOut:
OnFocusEvent(xev->type == x11::FocusIn, event->xfocus.mode,
event->xfocus.detail);
break;
case ConfigureNotify: {
DCHECK_EQ(xwindow_, xev->xconfigure.window);
DCHECK_EQ(xwindow_, xev->xconfigure.event);
int translated_x_in_pixels = xev->xconfigure.x;
int translated_y_in_pixels = xev->xconfigure.y;
if (!xev->xconfigure.send_event && !xev->xconfigure.override_redirect) {
Window unused;
XTranslateCoordinates(xdisplay_, xwindow_, x_root_window_, 0, 0,
&translated_x_in_pixels, &translated_y_in_pixels,
&unused);
}
gfx::Rect bounds_in_pixels(translated_x_in_pixels, translated_y_in_pixels,
xev->xconfigure.width, xev->xconfigure.height);
bool size_changed = bounds_in_pixels_.size() != bounds_in_pixels.size();
bool origin_changed =
bounds_in_pixels_.origin() != bounds_in_pixels.origin();
previous_bounds_in_pixels_ = bounds_in_pixels_;
bounds_in_pixels_ = bounds_in_pixels;
if (origin_changed)
OnHostMovedInPixels(bounds_in_pixels_.origin());
if (size_changed)
RestartDelayedResizeTask();
break;
}
case GenericEvent: {
ui::TouchFactory* factory = ui::TouchFactory::GetInstance();
if (!factory->ShouldProcessXI2Event(xev))
break;
XIEnterEvent* enter_event = static_cast<XIEnterEvent*>(xev->xcookie.data);
switch (static_cast<XIEvent*>(xev->xcookie.data)->evtype) {
case XI_Enter:
case XI_Leave:
OnCrossingEvent(enter_event->evtype == XI_Enter, enter_event->focus,
XI2ModeToXMode(enter_event->mode),
enter_event->detail);
return ui::POST_DISPATCH_STOP_PROPAGATION;
case XI_FocusIn:
case XI_FocusOut:
OnFocusEvent(enter_event->evtype == XI_FocusIn,
XI2ModeToXMode(enter_event->mode), enter_event->detail);
return ui::POST_DISPATCH_STOP_PROPAGATION;
default:
break;
}
ui::EventType type = ui::EventTypeFromNative(xev);
XEvent last_event;
int num_coalesced = 0;
switch (type) {
case ui::ET_TOUCH_MOVED:
num_coalesced = ui::CoalescePendingMotionEvents(xev, &last_event);
if (num_coalesced > 0)
xev = &last_event;
FALLTHROUGH;
case ui::ET_TOUCH_PRESSED:
case ui::ET_TOUCH_RELEASED: {
ui::TouchEvent touchev(xev);
DispatchTouchEvent(&touchev);
break;
}
case ui::ET_MOUSE_MOVED:
case ui::ET_MOUSE_DRAGGED:
case ui::ET_MOUSE_PRESSED:
case ui::ET_MOUSE_RELEASED:
case ui::ET_MOUSE_ENTERED:
case ui::ET_MOUSE_EXITED: {
if (type == ui::ET_MOUSE_MOVED || type == ui::ET_MOUSE_DRAGGED) {
num_coalesced = ui::CoalescePendingMotionEvents(xev, &last_event);
if (num_coalesced > 0)
xev = &last_event;
}
ui::MouseEvent mouseev(xev);
if (mouseev.type() != ui::ET_UNKNOWN)
DispatchMouseEvent(&mouseev);
break;
}
case ui::ET_MOUSEWHEEL: {
ui::MouseWheelEvent mouseev(xev);
DispatchMouseEvent(&mouseev);
break;
}
case ui::ET_SCROLL_FLING_START:
case ui::ET_SCROLL_FLING_CANCEL:
case ui::ET_SCROLL: {
ui::ScrollEvent scrollev(xev);
if (scrollev.x_offset() != 0.0 || scrollev.y_offset() != 0.0)
SendEventToSink(&scrollev);
break;
}
case ui::ET_KEY_PRESSED:
case ui::ET_KEY_RELEASED: {
ui::KeyEvent key_event(xev);
DispatchKeyEvent(&key_event);
break;
}
case ui::ET_UNKNOWN:
break;
default:
NOTREACHED();
}
if (num_coalesced > 0)
XFreeEventData(xev->xgeneric.display, &last_event.xcookie);
break;
}
case MapNotify: {
window_mapped_in_server_ = true;
for (DesktopWindowTreeHostObserverX11& observer : observer_list_)
observer.OnWindowMapped(xwindow_);
if (should_maximize_after_map_) {
Maximize();
should_maximize_after_map_ = false;
}
break;
}
case UnmapNotify: {
window_mapped_in_server_ = false;
has_pointer_ = false;
has_pointer_grab_ = false;
has_pointer_focus_ = false;
has_window_focus_ = false;
for (DesktopWindowTreeHostObserverX11& observer : observer_list_)
observer.OnWindowUnmapped(xwindow_);
break;
}
case ClientMessage: {
Atom message_type = xev->xclient.message_type;
if (message_type == gfx::GetAtom("WM_PROTOCOLS")) {
Atom protocol = static_cast<Atom>(xev->xclient.data.l[0]);
if (protocol == gfx::GetAtom("WM_DELETE_WINDOW")) {
OnHostCloseRequested();
} else if (protocol == gfx::GetAtom("_NET_WM_PING")) {
XEvent reply_event = *xev;
reply_event.xclient.window = x_root_window_;
XSendEvent(xdisplay_, reply_event.xclient.window, x11::False,
SubstructureRedirectMask | SubstructureNotifyMask,
&reply_event);
}
} else if (message_type == gfx::GetAtom("XdndEnter")) {
drag_drop_client_->OnXdndEnter(xev->xclient);
} else if (message_type == gfx::GetAtom("XdndLeave")) {
drag_drop_client_->OnXdndLeave(xev->xclient);
} else if (message_type == gfx::GetAtom("XdndPosition")) {
drag_drop_client_->OnXdndPosition(xev->xclient);
} else if (message_type == gfx::GetAtom("XdndStatus")) {
drag_drop_client_->OnXdndStatus(xev->xclient);
} else if (message_type == gfx::GetAtom("XdndFinished")) {
drag_drop_client_->OnXdndFinished(xev->xclient);
} else if (message_type == gfx::GetAtom("XdndDrop")) {
drag_drop_client_->OnXdndDrop(xev->xclient);
}
break;
}
case MappingNotify: {
switch (xev->xmapping.request) {
case MappingModifier:
case MappingKeyboard:
XRefreshKeyboardMapping(&xev->xmapping);
break;
case MappingPointer:
ui::DeviceDataManagerX11::GetInstance()->UpdateButtonMap();
break;
default:
NOTIMPLEMENTED() << " Unknown request: " << xev->xmapping.request;
break;
}
break;
}
case MotionNotify: {
XEvent last_event;
while (XPending(xev->xany.display)) {
XEvent next_event;
XPeekEvent(xev->xany.display, &next_event);
if (next_event.type == MotionNotify &&
next_event.xmotion.window == xev->xmotion.window &&
next_event.xmotion.subwindow == xev->xmotion.subwindow &&
next_event.xmotion.state == xev->xmotion.state) {
XNextEvent(xev->xany.display, &last_event);
xev = &last_event;
} else {
break;
}
}
ui::MouseEvent mouseev(xev);
DispatchMouseEvent(&mouseev);
break;
}
case PropertyNotify: {
XAtom changed_atom = xev->xproperty.atom;
if (changed_atom == gfx::GetAtom("_NET_WM_STATE")) {
OnWMStateUpdated();
} else if (changed_atom == gfx::GetAtom("_NET_FRAME_EXTENTS")) {
OnFrameExtentsUpdated();
} else if (changed_atom == gfx::GetAtom("_NET_WM_DESKTOP")) {
base::Optional<int> old_workspace = workspace_;
UpdateWorkspace();
if (workspace_ != old_workspace)
OnHostWorkspaceChanged();
}
break;
}
case SelectionNotify: {
drag_drop_client_->OnSelectionNotify(xev->xselection);
break;
}
}
return ui::POST_DISPATCH_STOP_PROPAGATION;
}
| 17,567 |
58,804 | 0 | struct page * find_get_page(struct address_space *mapping, pgoff_t offset)
{
struct page *page;
read_lock_irq(&mapping->tree_lock);
page = radix_tree_lookup(&mapping->page_tree, offset);
if (page)
page_cache_get(page);
read_unlock_irq(&mapping->tree_lock);
return page;
}
| 17,568 |
29,694 | 0 | static void __net_exit sysctl_net_exit(struct net *net)
{
retire_sysctl_set(&net->sysctls);
}
| 17,569 |
80,863 | 0 | GF_Err tbox_dump(GF_Box *a, FILE * trace)
{
GF_TextBoxBox*p = (GF_TextBoxBox*)a;
gf_isom_box_dump_start(a, "TextBoxBox", trace);
fprintf(trace, ">\n");
tx3g_dump_box(trace, &p->box);
gf_isom_box_dump_done("TextBoxBox", a, trace);
return GF_OK;
}
| 17,570 |
112,864 | 0 | void GDataCache::CommitDirty(const std::string& resource_id,
const std::string& md5,
FileOperationType file_operation_type,
base::PlatformFileError* error) {
AssertOnSequencedWorkerPool();
DCHECK(error);
scoped_ptr<CacheEntry> cache_entry =
GetCacheEntry(resource_id, std::string());
if (!cache_entry.get() ||
cache_entry->sub_dir_type == CACHE_TYPE_PINNED) {
LOG(WARNING) << "Can't commit dirty a file that wasn't cached: res_id="
<< resource_id
<< ", md5=" << md5;
*error = base::PLATFORM_FILE_ERROR_NOT_FOUND;
return;
}
if (!cache_entry->IsDirty()) {
LOG(WARNING) << "Can't commit a non-dirty file: res_id="
<< resource_id
<< ", md5=" << md5;
*error = base::PLATFORM_FILE_ERROR_INVALID_OPERATION;
return;
}
DCHECK_EQ(CACHE_TYPE_PERSISTENT, cache_entry->sub_dir_type);
FilePath symlink_path = GetCacheFilePath(resource_id,
std::string(),
CACHE_TYPE_OUTGOING,
CACHED_FILE_FROM_SERVER);
FilePath target_path = GetCacheFilePath(resource_id,
md5,
cache_entry->sub_dir_type,
CACHED_FILE_LOCALLY_MODIFIED);
*error = ModifyCacheState(target_path, // source
target_path, // destination
file_operation_type,
symlink_path,
true /* create symlink */);
}
| 17,571 |
151,638 | 0 | bool ChromePaymentRequestDelegate::IsIncognito() const {
Profile* profile =
Profile::FromBrowserContext(web_contents_->GetBrowserContext());
return profile && profile->GetProfileType() == Profile::INCOGNITO_PROFILE;
}
| 17,572 |
37,734 | 0 | static void add_msr_offset(u32 offset)
{
int i;
for (i = 0; i < MSRPM_OFFSETS; ++i) {
/* Offset already in list? */
if (msrpm_offsets[i] == offset)
return;
/* Slot used by another offset? */
if (msrpm_offsets[i] != MSR_INVALID)
continue;
/* Add offset to list */
msrpm_offsets[i] = offset;
return;
}
/*
* If this BUG triggers the msrpm_offsets table has an overflow. Just
* increase MSRPM_OFFSETS in this case.
*/
BUG();
}
| 17,573 |
94,493 | 0 | static void rfcomm_tty_close(struct tty_struct *tty, struct file *filp)
{
struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data;
unsigned long flags;
if (!dev)
return;
BT_DBG("tty %p dev %p dlc %p opened %d", tty, dev, dev->dlc,
dev->port.count);
spin_lock_irqsave(&dev->port.lock, flags);
if (!--dev->port.count) {
spin_unlock_irqrestore(&dev->port.lock, flags);
if (dev->tty_dev->parent)
device_move(dev->tty_dev, NULL, DPM_ORDER_DEV_LAST);
/* Close DLC and dettach TTY */
rfcomm_dlc_close(dev->dlc, 0);
clear_bit(RFCOMM_TTY_ATTACHED, &dev->flags);
rfcomm_dlc_lock(dev->dlc);
tty->driver_data = NULL;
dev->port.tty = NULL;
rfcomm_dlc_unlock(dev->dlc);
if (test_bit(RFCOMM_TTY_RELEASED, &dev->flags)) {
spin_lock(&rfcomm_dev_lock);
list_del_init(&dev->list);
spin_unlock(&rfcomm_dev_lock);
tty_port_put(&dev->port);
}
} else
spin_unlock_irqrestore(&dev->port.lock, flags);
tty_port_put(&dev->port);
}
| 17,574 |
135,797 | 0 | void SelectionController::SelectClosestMisspellingFromHitTestResult(
const HitTestResult& result,
AppendTrailingWhitespace append_trailing_whitespace) {
Node* inner_node = result.InnerNode();
if (!inner_node || !inner_node->GetLayoutObject())
return;
const VisiblePositionInFlatTree& pos = VisiblePositionOfHitTestResult(result);
if (pos.IsNull()) {
UpdateSelectionForMouseDownDispatchingSelectStart(
inner_node, SelectionInFlatTree(), TextGranularity::kWord,
HandleVisibility::kNotVisible);
return;
}
const PositionInFlatTree& marker_position =
pos.DeepEquivalent().ParentAnchoredEquivalent();
const DocumentMarker* const marker =
inner_node->GetDocument().Markers().MarkerAtPosition(
ToPositionInDOMTree(marker_position),
DocumentMarker::MisspellingMarkers());
if (!marker) {
UpdateSelectionForMouseDownDispatchingSelectStart(
inner_node, SelectionInFlatTree(), TextGranularity::kWord,
HandleVisibility::kNotVisible);
return;
}
Node* const container_node = marker_position.ComputeContainerNode();
const PositionInFlatTree start(container_node, marker->StartOffset());
const PositionInFlatTree end(container_node, marker->EndOffset());
const VisibleSelectionInFlatTree& new_selection = CreateVisibleSelection(
SelectionInFlatTree::Builder().Collapse(start).Extend(end).Build());
const SelectionInFlatTree& adjusted_selection =
append_trailing_whitespace == AppendTrailingWhitespace::kShouldAppend
? AdjustSelectionWithTrailingWhitespace(new_selection.AsSelection())
: new_selection.AsSelection();
UpdateSelectionForMouseDownDispatchingSelectStart(
inner_node,
ExpandSelectionToRespectUserSelectAll(inner_node, adjusted_selection),
TextGranularity::kWord, HandleVisibility::kNotVisible);
}
| 17,575 |
82,069 | 0 | mrb_class_get_under(mrb_state *mrb, struct RClass *outer, const char *name)
{
return class_from_sym(mrb, outer, mrb_intern_cstr(mrb, name));
}
| 17,576 |
145,777 | 0 | static BROTLI_INLINE int DecodeBlockTypeAndLength(int safe,
BrotliState* s, int tree_type) {
uint32_t max_block_type = s->num_block_types[tree_type];
int tree_offset = tree_type * BROTLI_HUFFMAN_MAX_TABLE_SIZE;
const HuffmanCode* type_tree = &s->block_type_trees[tree_offset];
const HuffmanCode* len_tree = &s->block_len_trees[tree_offset];
BrotliBitReader* br = &s->br;
uint32_t* ringbuffer = &s->block_type_rb[tree_type * 2];
uint32_t block_type;
/* Read 0..15 + 3..39 bits */
if (!safe) {
block_type = ReadSymbol(type_tree, br);
s->block_length[tree_type] = ReadBlockLength(len_tree, br);
} else {
BrotliBitReaderState memento;
BrotliBitReaderSaveState(br, &memento);
if (!SafeReadSymbol(type_tree, br, &block_type)) return 0;
if (!SafeReadBlockLength(s, &s->block_length[tree_type], len_tree, br)) {
s->substate_read_block_length = BROTLI_STATE_READ_BLOCK_LENGTH_NONE;
BrotliBitReaderRestoreState(br, &memento);
return 0;
}
}
if (block_type == 1) {
block_type = ringbuffer[1] + 1;
} else if (block_type == 0) {
block_type = ringbuffer[0];
} else {
block_type -= 2;
}
if (block_type >= max_block_type) {
block_type -= max_block_type;
}
ringbuffer[0] = ringbuffer[1];
ringbuffer[1] = block_type;
return 1;
}
| 17,577 |
95,633 | 0 | static void S_AL_ClearError( qboolean quiet )
{
int error = qalGetError();
if( quiet )
return;
if(error != AL_NO_ERROR)
{
Com_DPrintf(S_COLOR_YELLOW "WARNING: unhandled AL error: %s\n",
S_AL_ErrorMsg(error));
}
}
| 17,578 |
49,781 | 0 | static uint8_t arcmsr_hbaB_wait_msgint_ready(struct AdapterControlBlock *acb)
{
struct MessageUnit_B *reg = acb->pmuB;
int i;
for (i = 0; i < 2000; i++) {
if (readl(reg->iop2drv_doorbell)
& ARCMSR_IOP2DRV_MESSAGE_CMD_DONE) {
writel(ARCMSR_MESSAGE_INT_CLEAR_PATTERN,
reg->iop2drv_doorbell);
writel(ARCMSR_DRV2IOP_END_OF_INTERRUPT,
reg->drv2iop_doorbell);
return true;
}
msleep(10);
} /* max 20 seconds */
return false;
}
| 17,579 |
175,480 | 0 | static size_t out_get_buffer_size(const struct audio_stream *stream)
{
struct stream_out *out = (struct stream_out *)stream;
return out->config.period_size *
audio_stream_out_frame_size((const struct audio_stream_out *)stream);
}
| 17,580 |
115,878 | 0 | static WebCore::FrameLoaderClientEfl* _ewk_frame_loader_efl_get(const WebCore::Frame* frame)
{
return static_cast<WebCore::FrameLoaderClientEfl*>(frame->loader()->client());
}
| 17,581 |
35,283 | 0 | void netdev_rx_handler_unregister(struct net_device *dev)
{
ASSERT_RTNL();
rcu_assign_pointer(dev->rx_handler, NULL);
rcu_assign_pointer(dev->rx_handler_data, NULL);
}
| 17,582 |
162,649 | 0 | std::string HeadlessPrintManager::PrintResultToString(PrintResult result) {
switch (result) {
case PRINT_SUCCESS:
return std::string(); // no error message
case PRINTING_FAILED:
return "Printing failed";
case INVALID_PRINTER_SETTINGS:
return "Show invalid printer settings error";
case INVALID_MEMORY_HANDLE:
return "Invalid memory handle";
case METAFILE_MAP_ERROR:
return "Map to shared memory error";
case METAFILE_INVALID_HEADER:
return "Invalid metafile header";
case METAFILE_GET_DATA_ERROR:
return "Get data from metafile error";
case SIMULTANEOUS_PRINT_ACTIVE:
return "The previous printing job hasn't finished";
case PAGE_RANGE_SYNTAX_ERROR:
return "Page range syntax error";
case PAGE_COUNT_EXCEEDED:
return "Page range exceeds page count";
default:
NOTREACHED();
return "Unknown PrintResult";
}
}
| 17,583 |
103,527 | 0 | void ExtensionService::SyncExtensionChangeIfNeeded(const Extension& extension) {
SyncBundle* sync_bundle = GetSyncBundleForExtension(extension);
if (sync_bundle) {
ExtensionSyncData extension_sync_data(extension,
IsExtensionEnabled(extension.id()),
IsIncognitoEnabled(extension.id()));
SyncChangeList sync_change_list(1, extension_sync_data.GetSyncChange(
sync_bundle->HasExtensionId(extension.id()) ?
SyncChange::ACTION_UPDATE : SyncChange::ACTION_ADD));
sync_bundle->sync_processor->ProcessSyncChanges(
FROM_HERE, sync_change_list);
sync_bundle->synced_extensions.insert(extension.id());
sync_bundle->pending_sync_data.erase(extension.id());
}
}
| 17,584 |
131,135 | 0 | static void withExecutionContextAttributeAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
{
TestObject* imp = V8TestObject::toNative(info.Holder());
V8TRYCATCH_VOID(TestObject*, cppValue, V8TestObject::toNativeWithTypeCheck(info.GetIsolate(), jsValue));
ExecutionContext* scriptContext = currentExecutionContext(info.GetIsolate());
imp->setWithExecutionContextAttribute(scriptContext, WTF::getPtr(cppValue));
}
| 17,585 |
178,033 | 1 | T42_Open_Face( T42_Face face )
{
T42_LoaderRec loader;
T42_Parser parser;
T1_Font type1 = &face->type1;
FT_Memory memory = face->root.memory;
FT_Error error;
PSAux_Service psaux = (PSAux_Service)face->psaux;
t42_loader_init( &loader, face );
parser = &loader.parser;
if ( FT_ALLOC( face->ttf_data, 12 ) )
goto Exit;
error = t42_parser_init( parser,
face->root.stream,
memory,
if ( error )
goto Exit;
if ( type1->font_type != 42 )
{
FT_ERROR(( "T42_Open_Face: cannot handle FontType %d\n",
type1->font_type ));
error = FT_THROW( Unknown_File_Format );
goto Exit;
}
/* now, propagate the charstrings and glyphnames tables */
/* to the Type1 data */
type1->num_glyphs = loader.num_glyphs;
if ( !loader.charstrings.init )
{
FT_ERROR(( "T42_Open_Face: no charstrings array in face\n" ));
error = FT_THROW( Invalid_File_Format );
}
loader.charstrings.init = 0;
type1->charstrings_block = loader.charstrings.block;
type1->charstrings = loader.charstrings.elements;
type1->charstrings_len = loader.charstrings.lengths;
/* we copy the glyph names `block' and `elements' fields; */
/* the `lengths' field must be released later */
type1->glyph_names_block = loader.glyph_names.block;
type1->glyph_names = (FT_String**)loader.glyph_names.elements;
loader.glyph_names.block = 0;
loader.glyph_names.elements = 0;
/* we must now build type1.encoding when we have a custom array */
if ( type1->encoding_type == T1_ENCODING_TYPE_ARRAY )
{
FT_Int charcode, idx, min_char, max_char;
FT_Byte* glyph_name;
/* OK, we do the following: for each element in the encoding */
/* table, look up the index of the glyph having the same name */
/* as defined in the CharStrings array. */
/* The index is then stored in type1.encoding.char_index, and */
/* the name in type1.encoding.char_name */
min_char = 0;
max_char = 0;
charcode = 0;
for ( ; charcode < loader.encoding_table.max_elems; charcode++ )
{
FT_Byte* char_name;
type1->encoding.char_index[charcode] = 0;
type1->encoding.char_name [charcode] = (char *)".notdef";
char_name = loader.encoding_table.elements[charcode];
if ( char_name )
for ( idx = 0; idx < type1->num_glyphs; idx++ )
{
glyph_name = (FT_Byte*)type1->glyph_names[idx];
if ( ft_strcmp( (const char*)char_name,
(const char*)glyph_name ) == 0 )
{
type1->encoding.char_index[charcode] = (FT_UShort)idx;
type1->encoding.char_name [charcode] = (char*)glyph_name;
/* Change min/max encoded char only if glyph name is */
/* not /.notdef */
if ( ft_strcmp( (const char*)".notdef",
(const char*)glyph_name ) != 0 )
{
if ( charcode < min_char )
min_char = charcode;
if ( charcode >= max_char )
max_char = charcode + 1;
}
break;
}
}
}
type1->encoding.code_first = min_char;
type1->encoding.code_last = max_char;
type1->encoding.num_chars = loader.num_chars;
}
Exit:
t42_loader_done( &loader );
return error;
}
| 17,586 |
100,515 | 0 | CachedResource* Cache::resourceForURL(const String& url)
{
return m_resources.get(url);
}
| 17,587 |
39,909 | 0 | unsigned char *skb_pull(struct sk_buff *skb, unsigned int len)
{
return skb_pull_inline(skb, len);
}
| 17,588 |
19,825 | 0 | static int _nfs4_proc_lookup(struct rpc_clnt *clnt, struct inode *dir,
const struct qstr *name, struct nfs_fh *fhandle,
struct nfs_fattr *fattr)
{
struct nfs_server *server = NFS_SERVER(dir);
int status;
struct nfs4_lookup_arg args = {
.bitmask = server->attr_bitmask,
.dir_fh = NFS_FH(dir),
.name = name,
};
struct nfs4_lookup_res res = {
.server = server,
.fattr = fattr,
.fh = fhandle,
};
struct rpc_message msg = {
.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_LOOKUP],
.rpc_argp = &args,
.rpc_resp = &res,
};
nfs_fattr_init(fattr);
dprintk("NFS call lookup %s\n", name->name);
status = nfs4_call_sync(clnt, server, &msg, &args.seq_args, &res.seq_res, 0);
dprintk("NFS reply lookup: %d\n", status);
return status;
}
| 17,589 |
525 | 0 | static void pdf_run_gs_OPM(fz_context *ctx, pdf_processor *proc, int i)
{
pdf_run_processor *pr = (pdf_run_processor *)proc;
pdf_gstate *gstate = pdf_flush_text(ctx, pr);
gstate->stroke.color_params.opm = i;
gstate->fill.color_params.opm = i;
}
| 17,590 |
128,005 | 0 | AwContents::GetMessagePortMessageFilter() {
if (message_port_message_filter_.get() == nullptr) {
message_port_message_filter_ =
new AwMessagePortMessageFilter(
web_contents_->GetMainFrame()->GetRoutingID());
web_contents_->GetRenderProcessHost()->AddFilter(
message_port_message_filter_.get());
}
return message_port_message_filter_;
}
| 17,591 |
180,574 | 1 | int snd_timer_close(struct snd_timer_instance *timeri)
{
struct snd_timer *timer = NULL;
struct snd_timer_instance *slave, *tmp;
if (snd_BUG_ON(!timeri))
return -ENXIO;
/* force to stop the timer */
snd_timer_stop(timeri);
if (timeri->flags & SNDRV_TIMER_IFLG_SLAVE) {
/* wait, until the active callback is finished */
spin_lock_irq(&slave_active_lock);
while (timeri->flags & SNDRV_TIMER_IFLG_CALLBACK) {
spin_unlock_irq(&slave_active_lock);
udelay(10);
spin_lock_irq(&slave_active_lock);
}
spin_unlock_irq(&slave_active_lock);
mutex_lock(®ister_mutex);
list_del(&timeri->open_list);
mutex_unlock(®ister_mutex);
} else {
timer = timeri->timer;
if (snd_BUG_ON(!timer))
goto out;
/* wait, until the active callback is finished */
spin_lock_irq(&timer->lock);
while (timeri->flags & SNDRV_TIMER_IFLG_CALLBACK) {
spin_unlock_irq(&timer->lock);
udelay(10);
spin_lock_irq(&timer->lock);
}
spin_unlock_irq(&timer->lock);
mutex_lock(®ister_mutex);
list_del(&timeri->open_list);
if (timer && list_empty(&timer->open_list_head) &&
timer->hw.close)
timer->hw.close(timer);
/* remove slave links */
list_for_each_entry_safe(slave, tmp, &timeri->slave_list_head,
open_list) {
spin_lock_irq(&slave_active_lock);
_snd_timer_stop(slave, 1, SNDRV_TIMER_EVENT_RESOLUTION);
list_move_tail(&slave->open_list, &snd_timer_slave_list);
slave->master = NULL;
slave->timer = NULL;
spin_unlock_irq(&slave_active_lock);
}
mutex_unlock(®ister_mutex);
}
out:
if (timeri->private_free)
timeri->private_free(timeri);
kfree(timeri->owner);
kfree(timeri);
if (timer)
module_put(timer->module);
return 0;
}
| 17,592 |
45,130 | 0 | static int req_emerg(lua_State *L)
{
return req_log_at(L, APLOG_EMERG);
}
| 17,593 |
3,494 | 0 | irc_server_login (struct t_irc_server *server)
{
const char *password, *username, *realname;
password = IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_PASSWORD);
username = IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_USERNAME);
realname = IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_REALNAME);
if (password && password[0])
irc_server_sendf (server, 0, NULL, "PASS %s", password);
if (!server->nick)
{
irc_server_set_nick (server,
(server->nicks_array) ?
server->nicks_array[0] : "weechat");
server->nick_first_tried = 0;
}
else
server->nick_first_tried = irc_server_get_nick_index (server);
if (irc_server_sasl_enabled (server))
{
irc_server_sendf (server, 0, NULL, "CAP LS");
}
irc_server_sendf (server, 0, NULL,
"NICK %s\n"
"USER %s %s %s :%s",
server->nick,
(username && username[0]) ? username : "weechat",
(username && username[0]) ? username : "weechat",
server->current_address,
(realname && realname[0]) ? realname : ((username && username[0]) ? username : "weechat"));
if (server->hook_timer_connection)
weechat_unhook (server->hook_timer_connection);
server->hook_timer_connection = weechat_hook_timer (
IRC_SERVER_OPTION_INTEGER (server, IRC_SERVER_OPTION_CONNECTION_TIMEOUT) * 1000,
0, 1,
&irc_server_timer_connection_cb,
server);
}
| 17,594 |
128,611 | 0 | base::HistogramBase::Sample GetSwitchUMAId(const std::string& switch_name) {
return static_cast<base::HistogramBase::Sample>(
base::HashMetricName(switch_name));
}
| 17,595 |
45,769 | 0 | static void gcm_enc_copy_hash(struct aead_request *req,
struct crypto_gcm_req_priv_ctx *pctx)
{
struct crypto_aead *aead = crypto_aead_reqtfm(req);
u8 *auth_tag = pctx->auth_tag;
scatterwalk_map_and_copy(auth_tag, req->dst, req->cryptlen,
crypto_aead_authsize(aead), 1);
}
| 17,596 |
60,910 | 0 | got_filesystem_info (FilesystemInfoState *state,
GFileInfo *info)
{
NautilusDirectory *directory;
NautilusFile *file;
const char *filesystem_type;
/* careful here, info may be NULL */
directory = nautilus_directory_ref (state->directory);
state->directory->details->filesystem_info_state = NULL;
async_job_end (state->directory, "filesystem info");
file = nautilus_file_ref (state->file);
file->details->filesystem_info_is_up_to_date = TRUE;
if (info != NULL)
{
file->details->filesystem_use_preview =
g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW);
file->details->filesystem_readonly =
g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_FILESYSTEM_READONLY);
filesystem_type = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_FILESYSTEM_TYPE);
if (g_strcmp0 (eel_ref_str_peek (file->details->filesystem_type), filesystem_type) != 0)
{
eel_ref_str_unref (file->details->filesystem_type);
file->details->filesystem_type = eel_ref_str_get_unique (filesystem_type);
}
}
nautilus_directory_async_state_changed (directory);
nautilus_file_changed (file);
nautilus_file_unref (file);
nautilus_directory_unref (directory);
filesystem_info_state_free (state);
}
| 17,597 |
104,139 | 0 | error::Error GLES2DecoderImpl::HandleGetUniformLocation(
uint32 immediate_data_size, const gles2::GetUniformLocation& c) {
uint32 name_size = c.data_size;
const char* name = GetSharedMemoryAs<const char*>(
c.name_shm_id, c.name_shm_offset, name_size);
if (!name) {
return error::kOutOfBounds;
}
String name_str(name, name_size);
return GetUniformLocationHelper(
c.program, c.location_shm_id, c.location_shm_offset, name_str);
}
| 17,598 |
61,498 | 0 | static const char *CompositeOperatorToPSDBlendMode(CompositeOperator op)
{
const char
*blend_mode;
switch (op)
{
case ColorBurnCompositeOp: blend_mode = "idiv"; break;
case ColorDodgeCompositeOp: blend_mode = "div "; break;
case ColorizeCompositeOp: blend_mode = "colr"; break;
case DarkenCompositeOp: blend_mode = "dark"; break;
case DifferenceCompositeOp: blend_mode = "diff"; break;
case DissolveCompositeOp: blend_mode = "diss"; break;
case ExclusionCompositeOp: blend_mode = "smud"; break;
case HardLightCompositeOp: blend_mode = "hLit"; break;
case HardMixCompositeOp: blend_mode = "hMix"; break;
case HueCompositeOp: blend_mode = "hue "; break;
case LightenCompositeOp: blend_mode = "lite"; break;
case LinearBurnCompositeOp: blend_mode = "lbrn"; break;
case LinearDodgeCompositeOp:blend_mode = "lddg"; break;
case LinearLightCompositeOp:blend_mode = "lLit"; break;
case LuminizeCompositeOp: blend_mode = "lum "; break;
case MultiplyCompositeOp: blend_mode = "mul "; break;
case OverCompositeOp: blend_mode = "norm"; break;
case OverlayCompositeOp: blend_mode = "over"; break;
case PinLightCompositeOp: blend_mode = "pLit"; break;
case SaturateCompositeOp: blend_mode = "sat "; break;
case ScreenCompositeOp: blend_mode = "scrn"; break;
case SoftLightCompositeOp: blend_mode = "sLit"; break;
case VividLightCompositeOp: blend_mode = "vLit"; break;
default: blend_mode = "norm"; break;
}
return(blend_mode);
}
| 17,599 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.