unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
91,964 | 0 | bool blk_attempt_plug_merge(struct request_queue *q, struct bio *bio,
unsigned int *request_count,
struct request **same_queue_rq)
{
struct blk_plug *plug;
struct request *rq;
struct list_head *plug_list;
plug = current->plug;
if (!plug)
return false;
*request_count = 0;
if (q->mq_ops)
plug_list = &plug->mq_list;
else
plug_list = &plug->list;
list_for_each_entry_reverse(rq, plug_list, queuelist) {
bool merged = false;
if (rq->q == q) {
(*request_count)++;
/*
* Only blk-mq multiple hardware queues case checks the
* rq in the same queue, there should be only one such
* rq in a queue
**/
if (same_queue_rq)
*same_queue_rq = rq;
}
if (rq->q != q || !blk_rq_merge_ok(rq, bio))
continue;
switch (blk_try_merge(rq, bio)) {
case ELEVATOR_BACK_MERGE:
merged = bio_attempt_back_merge(q, rq, bio);
break;
case ELEVATOR_FRONT_MERGE:
merged = bio_attempt_front_merge(q, rq, bio);
break;
case ELEVATOR_DISCARD_MERGE:
merged = bio_attempt_discard_merge(q, rq, bio);
break;
default:
break;
}
if (merged)
return true;
}
return false;
}
| 18,200 |
156,602 | 0 | SessionStore::WriteBatch::WriteBatch(
std::unique_ptr<ModelTypeStore::WriteBatch> batch,
CommitCallback commit_cb,
syncer::OnceModelErrorHandler error_handler,
SyncedSessionTracker* session_tracker)
: batch_(std::move(batch)),
commit_cb_(std::move(commit_cb)),
error_handler_(std::move(error_handler)),
session_tracker_(session_tracker) {
DCHECK(batch_);
DCHECK(commit_cb_);
DCHECK(error_handler_);
DCHECK(session_tracker_);
}
| 18,201 |
73,925 | 0 | static int decode_level1_header(LHAFileHeader **header, LHAInputStream *stream)
{
unsigned int ext_header_start;
if (!decode_level0_header(header, stream)) {
return 0;
}
ext_header_start = RAW_DATA_LEN(header) - 2;
if (!read_l1_extended_headers(header, stream)
|| !decode_extended_headers(header, ext_header_start)) {
return 0;
}
return 1;
}
| 18,202 |
104,863 | 0 | bool Extension::HasHostPermission(const GURL& url) const {
for (URLPatternList::const_iterator host = host_permissions().begin();
host != host_permissions().end(); ++host) {
if (url.SchemeIs(chrome::kChromeUIScheme) &&
url.host() != chrome::kChromeUIFaviconHost &&
location() != Extension::COMPONENT)
return false;
if (host->MatchesURL(url))
return true;
}
return false;
}
| 18,203 |
101,727 | 0 | void Browser::OpenBookmarkManagerWindow(Profile* profile) {
Browser* browser = Browser::Create(profile);
browser->OpenBookmarkManager();
browser->window()->Show();
}
| 18,204 |
103,872 | 0 | void RenderView::didBlur() {
if (webview() && webview()->mainFrame() &&
webview()->mainFrame()->isProcessingUserGesture()) {
Send(new ViewHostMsg_Blur(routing_id_));
}
}
| 18,205 |
171,533 | 0 | void SimpleSoftOMXComponent::onMessageReceived(const sp<AMessage> &msg) {
Mutex::Autolock autoLock(mLock);
uint32_t msgType = msg->what();
ALOGV("msgType = %d", msgType);
switch (msgType) {
case kWhatSendCommand:
{
int32_t cmd, param;
CHECK(msg->findInt32("cmd", &cmd));
CHECK(msg->findInt32("param", ¶m));
onSendCommand((OMX_COMMANDTYPE)cmd, (OMX_U32)param);
break;
}
case kWhatEmptyThisBuffer:
case kWhatFillThisBuffer:
{
OMX_BUFFERHEADERTYPE *header;
CHECK(msg->findPointer("header", (void **)&header));
CHECK(mState == OMX_StateExecuting && mTargetState == mState);
bool found = false;
size_t portIndex = (kWhatEmptyThisBuffer == msgType)?
header->nInputPortIndex: header->nOutputPortIndex;
PortInfo *port = &mPorts.editItemAt(portIndex);
for (size_t j = 0; j < port->mBuffers.size(); ++j) {
BufferInfo *buffer = &port->mBuffers.editItemAt(j);
if (buffer->mHeader == header) {
CHECK(!buffer->mOwnedByUs);
buffer->mOwnedByUs = true;
CHECK((msgType == kWhatEmptyThisBuffer
&& port->mDef.eDir == OMX_DirInput)
|| (port->mDef.eDir == OMX_DirOutput));
port->mQueue.push_back(buffer);
onQueueFilled(portIndex);
found = true;
break;
}
}
CHECK(found);
break;
}
default:
TRESPASS();
break;
}
}
| 18,206 |
113,147 | 0 | void Launcher::AddIconObserver(LauncherIconObserver* observer) {
launcher_view_->AddIconObserver(observer);
}
| 18,207 |
96,420 | 0 | _rsvg_io_acquire_stream (const char *href,
const char *base_uri,
char **mime_type,
GCancellable *cancellable,
GError **error)
{
GInputStream *stream;
char *data;
gsize len;
if (!(href && *href)) {
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Invalid URI");
return NULL;
}
if (strncmp (href, "data:", 5) == 0) {
if (!(data = rsvg_acquire_data_data (href, NULL, mime_type, &len, error)))
return NULL;
return g_memory_input_stream_new_from_data (data, len, (GDestroyNotify) g_free);
}
if ((data = rsvg_acquire_file_data (href, base_uri, mime_type, &len, cancellable, NULL)))
return g_memory_input_stream_new_from_data (data, len, (GDestroyNotify) g_free);
if ((stream = rsvg_acquire_gvfs_stream (href, base_uri, mime_type, cancellable, error)))
return stream;
return NULL;
}
| 18,208 |
96,598 | 0 | static int bin_entry(RCore *r, int mode, ut64 laddr, int va, bool inifin) {
char str[R_FLAG_NAME_SIZE];
RList *entries = r_bin_get_entries (r->bin);
RListIter *iter;
RListIter *last_processed = NULL;
RBinAddr *entry = NULL;
int i = 0, init_i = 0, fini_i = 0, preinit_i = 0;
ut64 baddr = r_bin_get_baddr (r->bin);
if (IS_MODE_RAD (mode)) {
r_cons_printf ("fs symbols\n");
} else if (IS_MODE_JSON (mode)) {
r_cons_printf ("[");
} else if (IS_MODE_NORMAL (mode)) {
if (inifin) {
r_cons_printf ("[Constructors]\n");
} else {
r_cons_printf ("[Entrypoints]\n");
}
}
r_list_foreach (entries, iter, entry) {
ut64 paddr = entry->paddr;
ut64 hpaddr = UT64_MAX;
ut64 hvaddr = UT64_MAX;
if (mode != R_MODE_SET) {
if (inifin) {
if (entry->type == R_BIN_ENTRY_TYPE_PROGRAM) {
continue;
}
} else {
if (entry->type != R_BIN_ENTRY_TYPE_PROGRAM) {
continue;
}
}
}
if (entry->hpaddr) {
hpaddr = entry->hpaddr;
if (entry->hvaddr) {
hvaddr = rva (r->bin, hpaddr, entry->hvaddr, va);
}
}
ut64 at = rva (r->bin, paddr, entry->vaddr, va);
const char *type = r_bin_entry_type_string (entry->type);
if (!type) {
type = "unknown";
}
const char *hpaddr_key = (entry->type == R_BIN_ENTRY_TYPE_PROGRAM)
? "haddr" : "hpaddr";
if (IS_MODE_SET (mode)) {
r_flag_space_set (r->flags, R_FLAGS_FS_SYMBOLS);
if (entry->type == R_BIN_ENTRY_TYPE_INIT) {
snprintf (str, R_FLAG_NAME_SIZE, "entry.init%i", init_i);
} else if (entry->type == R_BIN_ENTRY_TYPE_FINI) {
snprintf (str, R_FLAG_NAME_SIZE, "entry.fini%i", fini_i);
} else if (entry->type == R_BIN_ENTRY_TYPE_PREINIT) {
snprintf (str, R_FLAG_NAME_SIZE, "entry.preinit%i", preinit_i);
} else {
snprintf (str, R_FLAG_NAME_SIZE, "entry%i", i);
}
r_flag_set (r->flags, str, at, 1);
if (is_initfini (entry) && hvaddr != UT64_MAX) {
r_meta_add (r->anal, R_META_TYPE_DATA, hvaddr,
hvaddr + entry->bits / 8, NULL);
}
} else if (IS_MODE_SIMPLE (mode)) {
r_cons_printf ("0x%08"PFMT64x"\n", at);
} else if (IS_MODE_JSON (mode)) {
r_cons_printf ("%s{\"vaddr\":%" PFMT64u ","
"\"paddr\":%" PFMT64u ","
"\"baddr\":%" PFMT64u ","
"\"laddr\":%" PFMT64u ",",
last_processed ? "," : "", at, paddr, baddr, laddr);
if (hvaddr != UT64_MAX) {
r_cons_printf ("\"hvaddr\":%" PFMT64u ",", hvaddr);
}
r_cons_printf ("\"%s\":%" PFMT64u ","
"\"type\":\"%s\"}",
hpaddr_key, hpaddr, type);
} else if (IS_MODE_RAD (mode)) {
char *name = NULL;
if (entry->type == R_BIN_ENTRY_TYPE_INIT) {
name = r_str_newf ("entry.init%i", init_i);
} else if (entry->type == R_BIN_ENTRY_TYPE_FINI) {
name = r_str_newf ("entry.fini%i", fini_i);
} else if (entry->type == R_BIN_ENTRY_TYPE_PREINIT) {
name = r_str_newf ("entry.preinit%i", preinit_i);
} else {
name = r_str_newf ("entry%i", i);
}
char *n = __filterQuotedShell (name);
r_cons_printf ("\"f %s 1 0x%08"PFMT64x"\"\n", n, at);
r_cons_printf ("\"f %s_%s 1 0x%08"PFMT64x"\"\n", n, hpaddr_key, hpaddr);
r_cons_printf ("\"s %s\"\n", n);
free (n);
free (name);
} else {
r_cons_printf ("vaddr=0x%08"PFMT64x" paddr=0x%08"PFMT64x, at, paddr);
if (is_initfini (entry) && hvaddr != UT64_MAX) {
r_cons_printf (" hvaddr=0x%08"PFMT64x, hvaddr);
}
r_cons_printf (" %s=", hpaddr_key);
if (hpaddr == UT64_MAX) {
r_cons_printf ("%"PFMT64d, hpaddr);
} else {
r_cons_printf ("0x%08"PFMT64x, hpaddr);
}
if (entry->type == R_BIN_ENTRY_TYPE_PROGRAM && hvaddr != UT64_MAX) {
r_cons_printf (" hvaddr=0x%08"PFMT64x, hvaddr);
}
r_cons_printf (" type=%s\n", type);
}
if (entry->type == R_BIN_ENTRY_TYPE_INIT) {
init_i++;
} else if (entry->type == R_BIN_ENTRY_TYPE_FINI) {
fini_i++;
} else if (entry->type == R_BIN_ENTRY_TYPE_PREINIT) {
preinit_i++;
} else {
i++;
}
last_processed = iter;
}
if (IS_MODE_SET (mode)) {
if (entry) {
ut64 at = rva (r->bin, entry->paddr, entry->vaddr, va);
r_core_seek (r, at, 0);
}
} else if (IS_MODE_JSON (mode)) {
r_cons_printf ("]");
r_cons_newline ();
} else if (IS_MODE_NORMAL (mode)) {
r_cons_printf ("\n%i entrypoints\n", init_i + fini_i + preinit_i + i);
}
return true;
}
| 18,209 |
16,497 | 0 | get_exclude_regex(Regex &excludeFilesRegex)
{
const char* _errstr;
int _erroffset;
char* excludeRegex = param("LOCAL_CONFIG_DIR_EXCLUDE_REGEXP");
if(excludeRegex) {
if (!excludeFilesRegex.compile(excludeRegex,
&_errstr, &_erroffset)) {
EXCEPT("LOCAL_CONFIG_DIR_EXCLUDE_REGEXP "
"config parameter is not a valid "
"regular expression. Value: %s, Error: %s",
excludeRegex, _errstr ? _errstr : "");
}
if(!excludeFilesRegex.isInitialized() ) {
EXCEPT("Could not init regex "
"to exclude files in %s\n", __FILE__);
}
}
free(excludeRegex);
}
| 18,210 |
110,717 | 0 | CompositeSettingsChange* BaseSettingChange::MergeWith(
BaseSettingChange* other) {
CompositeSettingsChange* composite_change = new CompositeSettingsChange();
CHECK(composite_change->Init(profile_));
composite_change->MergeWith(this);
composite_change->MergeWith(other);
return composite_change;
}
| 18,211 |
70,316 | 0 | OJPEGWriteStreamDri(TIFF* tif, void** mem, uint32* len)
{
OJPEGState* sp=(OJPEGState*)tif->tif_data;
assert(OJPEG_BUFFER>=6);
if (sp->restart_interval!=0)
{
sp->out_buffer[0]=255;
sp->out_buffer[1]=JPEG_MARKER_DRI;
sp->out_buffer[2]=0;
sp->out_buffer[3]=4;
sp->out_buffer[4]=(sp->restart_interval>>8);
sp->out_buffer[5]=(sp->restart_interval&255);
*len=6;
*mem=(void*)sp->out_buffer;
}
sp->out_state++;
}
| 18,212 |
35,031 | 0 | SCTP_STATIC int sctp_recvmsg(struct kiocb *iocb, struct sock *sk,
struct msghdr *msg, size_t len, int noblock,
int flags, int *addr_len)
{
struct sctp_ulpevent *event = NULL;
struct sctp_sock *sp = sctp_sk(sk);
struct sk_buff *skb;
int copied;
int err = 0;
int skb_len;
SCTP_DEBUG_PRINTK("sctp_recvmsg(%s: %p, %s: %p, %s: %zd, %s: %d, %s: "
"0x%x, %s: %p)\n", "sk", sk, "msghdr", msg,
"len", len, "knoblauch", noblock,
"flags", flags, "addr_len", addr_len);
sctp_lock_sock(sk);
if (sctp_style(sk, TCP) && !sctp_sstate(sk, ESTABLISHED)) {
err = -ENOTCONN;
goto out;
}
skb = sctp_skb_recv_datagram(sk, flags, noblock, &err);
if (!skb)
goto out;
/* Get the total length of the skb including any skb's in the
* frag_list.
*/
skb_len = skb->len;
copied = skb_len;
if (copied > len)
copied = len;
err = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied);
event = sctp_skb2event(skb);
if (err)
goto out_free;
sock_recv_timestamp(msg, sk, skb);
if (sctp_ulpevent_is_notification(event)) {
msg->msg_flags |= MSG_NOTIFICATION;
sp->pf->event_msgname(event, msg->msg_name, addr_len);
} else {
sp->pf->skb_msgname(skb, msg->msg_name, addr_len);
}
/* Check if we allow SCTP_SNDRCVINFO. */
if (sp->subscribe.sctp_data_io_event)
sctp_ulpevent_read_sndrcvinfo(event, msg);
#if 0
/* FIXME: we should be calling IP/IPv6 layers. */
if (sk->sk_protinfo.af_inet.cmsg_flags)
ip_cmsg_recv(msg, skb);
#endif
err = copied;
/* If skb's length exceeds the user's buffer, update the skb and
* push it back to the receive_queue so that the next call to
* recvmsg() will return the remaining data. Don't set MSG_EOR.
*/
if (skb_len > copied) {
msg->msg_flags &= ~MSG_EOR;
if (flags & MSG_PEEK)
goto out_free;
sctp_skb_pull(skb, copied);
skb_queue_head(&sk->sk_receive_queue, skb);
/* When only partial message is copied to the user, increase
* rwnd by that amount. If all the data in the skb is read,
* rwnd is updated when the event is freed.
*/
sctp_assoc_rwnd_increase(event->asoc, copied);
goto out;
} else if ((event->msg_flags & MSG_NOTIFICATION) ||
(event->msg_flags & MSG_EOR))
msg->msg_flags |= MSG_EOR;
else
msg->msg_flags &= ~MSG_EOR;
out_free:
if (flags & MSG_PEEK) {
/* Release the skb reference acquired after peeking the skb in
* sctp_skb_recv_datagram().
*/
kfree_skb(skb);
} else {
/* Free the event which includes releasing the reference to
* the owner of the skb, freeing the skb and updating the
* rwnd.
*/
sctp_ulpevent_free(event);
}
out:
sctp_release_sock(sk);
return err;
}
| 18,213 |
56,696 | 0 | static int ext4_setup_super(struct super_block *sb, struct ext4_super_block *es,
int read_only)
{
struct ext4_sb_info *sbi = EXT4_SB(sb);
int res = 0;
if (le32_to_cpu(es->s_rev_level) > EXT4_MAX_SUPP_REV) {
ext4_msg(sb, KERN_ERR, "revision level too high, "
"forcing read-only mode");
res = MS_RDONLY;
}
if (read_only)
goto done;
if (!(sbi->s_mount_state & EXT4_VALID_FS))
ext4_msg(sb, KERN_WARNING, "warning: mounting unchecked fs, "
"running e2fsck is recommended");
else if (sbi->s_mount_state & EXT4_ERROR_FS)
ext4_msg(sb, KERN_WARNING,
"warning: mounting fs with errors, "
"running e2fsck is recommended");
else if ((__s16) le16_to_cpu(es->s_max_mnt_count) > 0 &&
le16_to_cpu(es->s_mnt_count) >=
(unsigned short) (__s16) le16_to_cpu(es->s_max_mnt_count))
ext4_msg(sb, KERN_WARNING,
"warning: maximal mount count reached, "
"running e2fsck is recommended");
else if (le32_to_cpu(es->s_checkinterval) &&
(le32_to_cpu(es->s_lastcheck) +
le32_to_cpu(es->s_checkinterval) <= get_seconds()))
ext4_msg(sb, KERN_WARNING,
"warning: checktime reached, "
"running e2fsck is recommended");
if (!sbi->s_journal)
es->s_state &= cpu_to_le16(~EXT4_VALID_FS);
if (!(__s16) le16_to_cpu(es->s_max_mnt_count))
es->s_max_mnt_count = cpu_to_le16(EXT4_DFL_MAX_MNT_COUNT);
le16_add_cpu(&es->s_mnt_count, 1);
es->s_mtime = cpu_to_le32(get_seconds());
ext4_update_dynamic_rev(sb);
if (sbi->s_journal)
ext4_set_feature_journal_needs_recovery(sb);
ext4_commit_super(sb, 1);
done:
if (test_opt(sb, DEBUG))
printk(KERN_INFO "[EXT4 FS bs=%lu, gc=%u, "
"bpg=%lu, ipg=%lu, mo=%04x, mo2=%04x]\n",
sb->s_blocksize,
sbi->s_groups_count,
EXT4_BLOCKS_PER_GROUP(sb),
EXT4_INODES_PER_GROUP(sb),
sbi->s_mount_opt, sbi->s_mount_opt2);
cleancache_init_fs(sb);
return res;
}
| 18,214 |
106,309 | 0 | void SyncBackendHost::Core::DoShutdown(bool sync_disabled) {
DCHECK(MessageLoop::current() == host_->core_thread_.message_loop());
save_changes_timer_.Stop();
syncapi_->Shutdown(); // Stops the SyncerThread.
syncapi_->RemoveObserver(this);
DisconnectChildJsEventRouter();
host_->ui_worker()->OnSyncerShutdownComplete();
if (sync_disabled)
DeleteSyncDataFolder();
host_ = NULL;
}
| 18,215 |
85,527 | 0 | static int hns_gmac_adjust_link(void *mac_drv, enum mac_speed speed,
u32 full_duplex)
{
struct mac_driver *drv = (struct mac_driver *)mac_drv;
dsaf_set_dev_bit(drv, GMAC_DUPLEX_TYPE_REG,
GMAC_DUPLEX_TYPE_B, !!full_duplex);
switch (speed) {
case MAC_SPEED_10:
dsaf_set_dev_field(
drv, GMAC_PORT_MODE_REG,
GMAC_PORT_MODE_M, GMAC_PORT_MODE_S, 0x6);
break;
case MAC_SPEED_100:
dsaf_set_dev_field(
drv, GMAC_PORT_MODE_REG,
GMAC_PORT_MODE_M, GMAC_PORT_MODE_S, 0x7);
break;
case MAC_SPEED_1000:
dsaf_set_dev_field(
drv, GMAC_PORT_MODE_REG,
GMAC_PORT_MODE_M, GMAC_PORT_MODE_S, 0x8);
break;
default:
dev_err(drv->dev,
"hns_gmac_adjust_link fail, speed%d mac%d\n",
speed, drv->mac_id);
return -EINVAL;
}
return 0;
}
| 18,216 |
3,538 | 0 | gs_heap_alloc_struct(gs_memory_t * mem, gs_memory_type_ptr_t pstype,
client_name_t cname)
{
void *ptr =
gs_heap_alloc_bytes(mem, gs_struct_type_size(pstype), cname);
if (ptr == 0)
return 0;
((gs_malloc_block_t *) ptr)[-1].type = pstype;
return ptr;
}
| 18,217 |
181,054 | 1 | icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *bp2,
int fragmented)
{
char *cp;
const struct icmp *dp;
const struct icmp_ext_t *ext_dp;
const struct ip *ip;
const char *str, *fmt;
const struct ip *oip;
const struct udphdr *ouh;
const uint8_t *obj_tptr;
uint32_t raw_label;
const u_char *snapend_save;
const struct icmp_mpls_ext_object_header_t *icmp_mpls_ext_object_header;
u_int hlen, dport, mtu, obj_tlen, obj_class_num, obj_ctype;
char buf[MAXHOSTNAMELEN + 100];
struct cksum_vec vec[1];
dp = (const struct icmp *)bp;
ext_dp = (const struct icmp_ext_t *)bp;
ip = (const struct ip *)bp2;
str = buf;
ND_TCHECK(dp->icmp_code);
switch (dp->icmp_type) {
case ICMP_ECHO:
case ICMP_ECHOREPLY:
ND_TCHECK(dp->icmp_seq);
(void)snprintf(buf, sizeof(buf), "echo %s, id %u, seq %u",
dp->icmp_type == ICMP_ECHO ?
"request" : "reply",
EXTRACT_16BITS(&dp->icmp_id),
EXTRACT_16BITS(&dp->icmp_seq));
break;
case ICMP_UNREACH:
ND_TCHECK(dp->icmp_ip.ip_dst);
switch (dp->icmp_code) {
case ICMP_UNREACH_PROTOCOL:
ND_TCHECK(dp->icmp_ip.ip_p);
(void)snprintf(buf, sizeof(buf),
"%s protocol %d unreachable",
ipaddr_string(ndo, &dp->icmp_ip.ip_dst),
dp->icmp_ip.ip_p);
break;
case ICMP_UNREACH_PORT:
ND_TCHECK(dp->icmp_ip.ip_p);
oip = &dp->icmp_ip;
hlen = IP_HL(oip) * 4;
ouh = (const struct udphdr *)(((const u_char *)oip) + hlen);
ND_TCHECK(ouh->uh_dport);
dport = EXTRACT_16BITS(&ouh->uh_dport);
switch (oip->ip_p) {
case IPPROTO_TCP:
(void)snprintf(buf, sizeof(buf),
"%s tcp port %s unreachable",
ipaddr_string(ndo, &oip->ip_dst),
tcpport_string(ndo, dport));
break;
case IPPROTO_UDP:
(void)snprintf(buf, sizeof(buf),
"%s udp port %s unreachable",
ipaddr_string(ndo, &oip->ip_dst),
udpport_string(ndo, dport));
break;
default:
(void)snprintf(buf, sizeof(buf),
"%s protocol %d port %d unreachable",
ipaddr_string(ndo, &oip->ip_dst),
oip->ip_p, dport);
break;
}
break;
case ICMP_UNREACH_NEEDFRAG:
{
register const struct mtu_discovery *mp;
mp = (const struct mtu_discovery *)(const u_char *)&dp->icmp_void;
mtu = EXTRACT_16BITS(&mp->nexthopmtu);
if (mtu) {
(void)snprintf(buf, sizeof(buf),
"%s unreachable - need to frag (mtu %d)",
ipaddr_string(ndo, &dp->icmp_ip.ip_dst), mtu);
} else {
(void)snprintf(buf, sizeof(buf),
"%s unreachable - need to frag",
ipaddr_string(ndo, &dp->icmp_ip.ip_dst));
}
}
break;
default:
fmt = tok2str(unreach2str, "#%d %%s unreachable",
dp->icmp_code);
(void)snprintf(buf, sizeof(buf), fmt,
ipaddr_string(ndo, &dp->icmp_ip.ip_dst));
break;
}
break;
case ICMP_REDIRECT:
ND_TCHECK(dp->icmp_ip.ip_dst);
fmt = tok2str(type2str, "redirect-#%d %%s to net %%s",
dp->icmp_code);
(void)snprintf(buf, sizeof(buf), fmt,
ipaddr_string(ndo, &dp->icmp_ip.ip_dst),
ipaddr_string(ndo, &dp->icmp_gwaddr));
break;
case ICMP_ROUTERADVERT:
{
register const struct ih_rdiscovery *ihp;
register const struct id_rdiscovery *idp;
u_int lifetime, num, size;
(void)snprintf(buf, sizeof(buf), "router advertisement");
cp = buf + strlen(buf);
ihp = (const struct ih_rdiscovery *)&dp->icmp_void;
ND_TCHECK(*ihp);
(void)strncpy(cp, " lifetime ", sizeof(buf) - (cp - buf));
cp = buf + strlen(buf);
lifetime = EXTRACT_16BITS(&ihp->ird_lifetime);
if (lifetime < 60) {
(void)snprintf(cp, sizeof(buf) - (cp - buf), "%u",
lifetime);
} else if (lifetime < 60 * 60) {
(void)snprintf(cp, sizeof(buf) - (cp - buf), "%u:%02u",
lifetime / 60, lifetime % 60);
} else {
(void)snprintf(cp, sizeof(buf) - (cp - buf),
"%u:%02u:%02u",
lifetime / 3600,
(lifetime % 3600) / 60,
lifetime % 60);
}
cp = buf + strlen(buf);
num = ihp->ird_addrnum;
(void)snprintf(cp, sizeof(buf) - (cp - buf), " %d:", num);
cp = buf + strlen(buf);
size = ihp->ird_addrsiz;
if (size != 2) {
(void)snprintf(cp, sizeof(buf) - (cp - buf),
" [size %d]", size);
break;
}
idp = (const struct id_rdiscovery *)&dp->icmp_data;
while (num-- > 0) {
ND_TCHECK(*idp);
(void)snprintf(cp, sizeof(buf) - (cp - buf), " {%s %u}",
ipaddr_string(ndo, &idp->ird_addr),
EXTRACT_32BITS(&idp->ird_pref));
cp = buf + strlen(buf);
++idp;
}
}
break;
case ICMP_TIMXCEED:
ND_TCHECK(dp->icmp_ip.ip_dst);
switch (dp->icmp_code) {
case ICMP_TIMXCEED_INTRANS:
str = "time exceeded in-transit";
break;
case ICMP_TIMXCEED_REASS:
str = "ip reassembly time exceeded";
break;
default:
(void)snprintf(buf, sizeof(buf), "time exceeded-#%d",
dp->icmp_code);
break;
}
break;
case ICMP_PARAMPROB:
if (dp->icmp_code)
(void)snprintf(buf, sizeof(buf),
"parameter problem - code %d", dp->icmp_code);
else {
ND_TCHECK(dp->icmp_pptr);
(void)snprintf(buf, sizeof(buf),
"parameter problem - octet %d", dp->icmp_pptr);
}
break;
case ICMP_MASKREPLY:
ND_TCHECK(dp->icmp_mask);
(void)snprintf(buf, sizeof(buf), "address mask is 0x%08x",
EXTRACT_32BITS(&dp->icmp_mask));
break;
case ICMP_TSTAMP:
ND_TCHECK(dp->icmp_seq);
(void)snprintf(buf, sizeof(buf),
"time stamp query id %u seq %u",
EXTRACT_16BITS(&dp->icmp_id),
EXTRACT_16BITS(&dp->icmp_seq));
break;
case ICMP_TSTAMPREPLY:
ND_TCHECK(dp->icmp_ttime);
(void)snprintf(buf, sizeof(buf),
"time stamp reply id %u seq %u: org %s",
EXTRACT_16BITS(&dp->icmp_id),
EXTRACT_16BITS(&dp->icmp_seq),
icmp_tstamp_print(EXTRACT_32BITS(&dp->icmp_otime)));
(void)snprintf(buf+strlen(buf),sizeof(buf)-strlen(buf),", recv %s",
icmp_tstamp_print(EXTRACT_32BITS(&dp->icmp_rtime)));
(void)snprintf(buf+strlen(buf),sizeof(buf)-strlen(buf),", xmit %s",
icmp_tstamp_print(EXTRACT_32BITS(&dp->icmp_ttime)));
break;
default:
str = tok2str(icmp2str, "type-#%d", dp->icmp_type);
break;
}
ND_PRINT((ndo, "ICMP %s, length %u", str, plen));
if (ndo->ndo_vflag && !fragmented) { /* don't attempt checksumming if this is a frag */
uint16_t sum, icmp_sum;
if (ND_TTEST2(*bp, plen)) {
vec[0].ptr = (const uint8_t *)(const void *)dp;
vec[0].len = plen;
sum = in_cksum(vec, 1);
if (sum != 0) {
icmp_sum = EXTRACT_16BITS(&dp->icmp_cksum);
ND_PRINT((ndo, " (wrong icmp cksum %x (->%x)!)",
icmp_sum,
in_cksum_shouldbe(icmp_sum, sum)));
}
}
}
/*
* print the remnants of the IP packet.
* save the snaplength as this may get overidden in the IP printer.
*/
if (ndo->ndo_vflag >= 1 && ICMP_ERRTYPE(dp->icmp_type)) {
bp += 8;
ND_PRINT((ndo, "\n\t"));
ip = (const struct ip *)bp;
snapend_save = ndo->ndo_snapend;
ip_print(ndo, bp, EXTRACT_16BITS(&ip->ip_len));
ndo->ndo_snapend = snapend_save;
}
/*
* Attempt to decode the MPLS extensions only for some ICMP types.
*/
if (ndo->ndo_vflag >= 1 && plen > ICMP_EXTD_MINLEN && ICMP_MPLS_EXT_TYPE(dp->icmp_type)) {
ND_TCHECK(*ext_dp);
/*
* Check first if the mpls extension header shows a non-zero length.
* If the length field is not set then silently verify the checksum
* to check if an extension header is present. This is expedient,
* however not all implementations set the length field proper.
*/
if (!ext_dp->icmp_length &&
ND_TTEST2(ext_dp->icmp_ext_version_res, plen - ICMP_EXTD_MINLEN)) {
vec[0].ptr = (const uint8_t *)(const void *)&ext_dp->icmp_ext_version_res;
vec[0].len = plen - ICMP_EXTD_MINLEN;
if (in_cksum(vec, 1)) {
return;
}
}
ND_PRINT((ndo, "\n\tMPLS extension v%u",
ICMP_MPLS_EXT_EXTRACT_VERSION(*(ext_dp->icmp_ext_version_res))));
/*
* Sanity checking of the header.
*/
if (ICMP_MPLS_EXT_EXTRACT_VERSION(*(ext_dp->icmp_ext_version_res)) !=
ICMP_MPLS_EXT_VERSION) {
ND_PRINT((ndo, " packet not supported"));
return;
}
hlen = plen - ICMP_EXTD_MINLEN;
if (ND_TTEST2(ext_dp->icmp_ext_version_res, hlen)) {
vec[0].ptr = (const uint8_t *)(const void *)&ext_dp->icmp_ext_version_res;
vec[0].len = hlen;
ND_PRINT((ndo, ", checksum 0x%04x (%scorrect), length %u",
EXTRACT_16BITS(ext_dp->icmp_ext_checksum),
in_cksum(vec, 1) ? "in" : "",
hlen));
}
hlen -= 4; /* subtract common header size */
obj_tptr = (const uint8_t *)ext_dp->icmp_ext_data;
while (hlen > sizeof(struct icmp_mpls_ext_object_header_t)) {
icmp_mpls_ext_object_header = (const struct icmp_mpls_ext_object_header_t *)obj_tptr;
ND_TCHECK(*icmp_mpls_ext_object_header);
obj_tlen = EXTRACT_16BITS(icmp_mpls_ext_object_header->length);
obj_class_num = icmp_mpls_ext_object_header->class_num;
obj_ctype = icmp_mpls_ext_object_header->ctype;
obj_tptr += sizeof(struct icmp_mpls_ext_object_header_t);
ND_PRINT((ndo, "\n\t %s Object (%u), Class-Type: %u, length %u",
tok2str(icmp_mpls_ext_obj_values,"unknown",obj_class_num),
obj_class_num,
obj_ctype,
obj_tlen));
hlen-=sizeof(struct icmp_mpls_ext_object_header_t); /* length field includes tlv header */
/* infinite loop protection */
if ((obj_class_num == 0) ||
(obj_tlen < sizeof(struct icmp_mpls_ext_object_header_t))) {
return;
}
obj_tlen-=sizeof(struct icmp_mpls_ext_object_header_t);
switch (obj_class_num) {
case 1:
switch(obj_ctype) {
case 1:
ND_TCHECK2(*obj_tptr, 4);
raw_label = EXTRACT_32BITS(obj_tptr);
ND_PRINT((ndo, "\n\t label %u, exp %u", MPLS_LABEL(raw_label), MPLS_EXP(raw_label)));
if (MPLS_STACK(raw_label))
ND_PRINT((ndo, ", [S]"));
ND_PRINT((ndo, ", ttl %u", MPLS_TTL(raw_label)));
break;
default:
print_unknown_data(ndo, obj_tptr, "\n\t ", obj_tlen);
}
break;
/*
* FIXME those are the defined objects that lack a decoder
* you are welcome to contribute code ;-)
*/
case 2:
default:
print_unknown_data(ndo, obj_tptr, "\n\t ", obj_tlen);
break;
}
if (hlen < obj_tlen)
break;
hlen -= obj_tlen;
obj_tptr += obj_tlen;
}
}
return;
trunc:
ND_PRINT((ndo, "[|icmp]"));
}
| 18,218 |
80,883 | 0 | GF_Err trgt_dump(GF_Box *a, FILE * trace)
{
GF_TrackGroupTypeBox *ptr = (GF_TrackGroupTypeBox *) a;
a->type = ptr->group_type;
gf_isom_box_dump_start(a, "TrackGroupTypeBox", trace);
a->type = GF_ISOM_BOX_TYPE_TRGT;
fprintf(trace, "track_group_id=\"%d\">\n", ptr->track_group_id);
gf_isom_box_dump_done("TrackGroupTypeBox", a, trace);
return GF_OK;
}
| 18,219 |
177,505 | 0 | struct arg arg_init(char **argv) {
struct arg a;
a.argv = argv;
a.argv_step = 1;
a.name = NULL;
a.val = NULL;
a.def = NULL;
return a;
}
| 18,220 |
70,323 | 0 | TIFFInitOJPEG(TIFF* tif, int scheme)
{
static const char module[]="TIFFInitOJPEG";
OJPEGState* sp;
assert(scheme==COMPRESSION_OJPEG);
/*
* Merge codec-specific tag information.
*/
if (!_TIFFMergeFields(tif, ojpegFields, TIFFArrayCount(ojpegFields))) {
TIFFErrorExt(tif->tif_clientdata, module,
"Merging Old JPEG codec-specific tags failed");
return 0;
}
/* state block */
sp=_TIFFmalloc(sizeof(OJPEGState));
if (sp==NULL)
{
TIFFErrorExt(tif->tif_clientdata,module,"No space for OJPEG state block");
return(0);
}
_TIFFmemset(sp,0,sizeof(OJPEGState));
sp->tif=tif;
sp->jpeg_proc=1;
sp->subsampling_hor=2;
sp->subsampling_ver=2;
TIFFSetField(tif,TIFFTAG_YCBCRSUBSAMPLING,2,2);
/* tif codec methods */
tif->tif_fixuptags=OJPEGFixupTags;
tif->tif_setupdecode=OJPEGSetupDecode;
tif->tif_predecode=OJPEGPreDecode;
tif->tif_postdecode=OJPEGPostDecode;
tif->tif_decoderow=OJPEGDecode;
tif->tif_decodestrip=OJPEGDecode;
tif->tif_decodetile=OJPEGDecode;
tif->tif_setupencode=OJPEGSetupEncode;
tif->tif_preencode=OJPEGPreEncode;
tif->tif_postencode=OJPEGPostEncode;
tif->tif_encoderow=OJPEGEncode;
tif->tif_encodestrip=OJPEGEncode;
tif->tif_encodetile=OJPEGEncode;
tif->tif_cleanup=OJPEGCleanup;
tif->tif_data=(uint8*)sp;
/* tif tag methods */
sp->vgetparent=tif->tif_tagmethods.vgetfield;
tif->tif_tagmethods.vgetfield=OJPEGVGetField;
sp->vsetparent=tif->tif_tagmethods.vsetfield;
tif->tif_tagmethods.vsetfield=OJPEGVSetField;
sp->printdir=tif->tif_tagmethods.printdir;
tif->tif_tagmethods.printdir=OJPEGPrintDir;
/* Some OJPEG files don't have strip or tile offsets or bytecounts tags.
Some others do, but have totally meaningless or corrupt values
in these tags. In these cases, the JpegInterchangeFormat stream is
reliable. In any case, this decoder reads the compressed data itself,
from the most reliable locations, and we need to notify encapsulating
LibTiff not to read raw strips or tiles for us. */
tif->tif_flags|=TIFF_NOREADRAW;
return(1);
}
| 18,221 |
89,768 | 0 | void start_application(int no_sandbox, FILE *fp) {
if (no_sandbox == 0) {
env_defaults();
env_apply();
}
umask(orig_umask);
if (arg_debug) {
printf("starting application\n");
printf("LD_PRELOAD=%s\n", getenv("LD_PRELOAD"));
}
if (arg_audit) {
assert(arg_audit_prog);
if (fp) {
fprintf(fp, "ready\n");
fclose(fp);
}
#ifdef HAVE_GCOV
__gcov_dump();
#endif
#ifdef HAVE_SECCOMP
seccomp_install_filters();
#endif
execl(arg_audit_prog, arg_audit_prog, NULL);
perror("execl");
exit(1);
}
else if (arg_shell_none) {
if (arg_debug) {
int i;
for (i = cfg.original_program_index; i < cfg.original_argc; i++) {
if (cfg.original_argv[i] == NULL)
break;
printf("execvp argument %d: %s\n", i - cfg.original_program_index, cfg.original_argv[i]);
}
}
if (cfg.original_program_index == 0) {
fprintf(stderr, "Error: --shell=none configured, but no program specified\n");
exit(1);
}
if (!arg_command && !arg_quiet)
print_time();
int rv = ok_to_run(cfg.original_argv[cfg.original_program_index]);
if (fp) {
fprintf(fp, "ready\n");
fclose(fp);
}
#ifdef HAVE_GCOV
__gcov_dump();
#endif
#ifdef HAVE_SECCOMP
seccomp_install_filters();
#endif
if (rv)
execvp(cfg.original_argv[cfg.original_program_index], &cfg.original_argv[cfg.original_program_index]);
else
fprintf(stderr, "Error: no suitable %s executable found\n", cfg.original_argv[cfg.original_program_index]);
exit(1);
}
else {
assert(cfg.shell);
assert(cfg.command_line);
char *arg[5];
int index = 0;
arg[index++] = cfg.shell;
if (login_shell) {
arg[index++] = "-l";
if (arg_debug)
printf("Starting %s login shell\n", cfg.shell);
} else {
arg[index++] = "-c";
if (arg_debug)
printf("Running %s command through %s\n", cfg.command_line, cfg.shell);
if (arg_doubledash)
arg[index++] = "--";
arg[index++] = cfg.command_line;
}
arg[index] = NULL;
assert(index < 5);
if (arg_debug) {
char *msg;
if (asprintf(&msg, "sandbox %d, execvp into %s", sandbox_pid, cfg.command_line) == -1)
errExit("asprintf");
logmsg(msg);
free(msg);
}
if (arg_debug) {
int i;
for (i = 0; i < 5; i++) {
if (arg[i] == NULL)
break;
printf("execvp argument %d: %s\n", i, arg[i]);
}
}
if (!arg_command && !arg_quiet)
print_time();
if (fp) {
fprintf(fp, "ready\n");
fclose(fp);
}
#ifdef HAVE_GCOV
__gcov_dump();
#endif
#ifdef HAVE_SECCOMP
seccomp_install_filters();
#endif
execvp(arg[0], arg);
}
perror("execvp");
exit(1); // it should never get here!!!
}
| 18,222 |
65,429 | 0 | static bool clp_used_exchangeid(struct nfs4_client *clp)
{
return clp->cl_exchange_flags != 0;
}
| 18,223 |
40,592 | 0 | void rawsock_exit(void)
{
nfc_proto_unregister(&rawsock_nfc_proto);
}
| 18,224 |
20,989 | 0 | static int pagemap_hugetlb_range(pte_t *pte, unsigned long hmask,
unsigned long addr, unsigned long end,
struct mm_walk *walk)
{
struct pagemapread *pm = walk->private;
int err = 0;
u64 pfn;
for (; addr != end; addr += PAGE_SIZE) {
int offset = (addr & ~hmask) >> PAGE_SHIFT;
pfn = huge_pte_to_pagemap_entry(*pte, offset);
err = add_to_pagemap(addr, pfn, pm);
if (err)
return err;
}
cond_resched();
return err;
}
| 18,225 |
158,156 | 0 | void Wait() {
message_loop_runner_->Run();
}
| 18,226 |
32,250 | 0 | dx_probe(const struct qstr *d_name, struct inode *dir,
struct dx_hash_info *hinfo, struct dx_frame *frame_in, int *err)
{
unsigned count, indirect;
struct dx_entry *at, *entries, *p, *q, *m;
struct dx_root *root;
struct buffer_head *bh;
struct dx_frame *frame = frame_in;
u32 hash;
frame->bh = NULL;
if (!(bh = ext4_bread(NULL, dir, 0, 0, err))) {
if (*err == 0)
*err = ERR_BAD_DX_DIR;
goto fail;
}
root = (struct dx_root *) bh->b_data;
if (root->info.hash_version != DX_HASH_TEA &&
root->info.hash_version != DX_HASH_HALF_MD4 &&
root->info.hash_version != DX_HASH_LEGACY) {
ext4_warning(dir->i_sb, "Unrecognised inode hash code %d",
root->info.hash_version);
brelse(bh);
*err = ERR_BAD_DX_DIR;
goto fail;
}
hinfo->hash_version = root->info.hash_version;
if (hinfo->hash_version <= DX_HASH_TEA)
hinfo->hash_version += EXT4_SB(dir->i_sb)->s_hash_unsigned;
hinfo->seed = EXT4_SB(dir->i_sb)->s_hash_seed;
if (d_name)
ext4fs_dirhash(d_name->name, d_name->len, hinfo);
hash = hinfo->hash;
if (root->info.unused_flags & 1) {
ext4_warning(dir->i_sb, "Unimplemented inode hash flags: %#06x",
root->info.unused_flags);
brelse(bh);
*err = ERR_BAD_DX_DIR;
goto fail;
}
if ((indirect = root->info.indirect_levels) > 1) {
ext4_warning(dir->i_sb, "Unimplemented inode hash depth: %#06x",
root->info.indirect_levels);
brelse(bh);
*err = ERR_BAD_DX_DIR;
goto fail;
}
if (!buffer_verified(bh) &&
!ext4_dx_csum_verify(dir, (struct ext4_dir_entry *)bh->b_data)) {
ext4_warning(dir->i_sb, "Root failed checksum");
brelse(bh);
*err = ERR_BAD_DX_DIR;
goto fail;
}
set_buffer_verified(bh);
entries = (struct dx_entry *) (((char *)&root->info) +
root->info.info_length);
if (dx_get_limit(entries) != dx_root_limit(dir,
root->info.info_length)) {
ext4_warning(dir->i_sb, "dx entry: limit != root limit");
brelse(bh);
*err = ERR_BAD_DX_DIR;
goto fail;
}
dxtrace(printk("Look up %x", hash));
while (1)
{
count = dx_get_count(entries);
if (!count || count > dx_get_limit(entries)) {
ext4_warning(dir->i_sb,
"dx entry: no count or count > limit");
brelse(bh);
*err = ERR_BAD_DX_DIR;
goto fail2;
}
p = entries + 1;
q = entries + count - 1;
while (p <= q)
{
m = p + (q - p)/2;
dxtrace(printk("."));
if (dx_get_hash(m) > hash)
q = m - 1;
else
p = m + 1;
}
if (0) // linear search cross check
{
unsigned n = count - 1;
at = entries;
while (n--)
{
dxtrace(printk(","));
if (dx_get_hash(++at) > hash)
{
at--;
break;
}
}
assert (at == p - 1);
}
at = p - 1;
dxtrace(printk(" %x->%u\n", at == entries? 0: dx_get_hash(at), dx_get_block(at)));
frame->bh = bh;
frame->entries = entries;
frame->at = at;
if (!indirect--) return frame;
if (!(bh = ext4_bread(NULL, dir, dx_get_block(at), 0, err))) {
if (!(*err))
*err = ERR_BAD_DX_DIR;
goto fail2;
}
at = entries = ((struct dx_node *) bh->b_data)->entries;
if (!buffer_verified(bh) &&
!ext4_dx_csum_verify(dir,
(struct ext4_dir_entry *)bh->b_data)) {
ext4_warning(dir->i_sb, "Node failed checksum");
brelse(bh);
*err = ERR_BAD_DX_DIR;
goto fail;
}
set_buffer_verified(bh);
if (dx_get_limit(entries) != dx_node_limit (dir)) {
ext4_warning(dir->i_sb,
"dx entry: limit != node limit");
brelse(bh);
*err = ERR_BAD_DX_DIR;
goto fail2;
}
frame++;
frame->bh = NULL;
}
fail2:
while (frame >= frame_in) {
brelse(frame->bh);
frame--;
}
fail:
if (*err == ERR_BAD_DX_DIR)
ext4_warning(dir->i_sb,
"Corrupt dir inode %lu, running e2fsck is "
"recommended.", dir->i_ino);
return NULL;
}
| 18,227 |
188,250 | 1 | status_t ACodec::setupAACCodec(
bool encoder, int32_t numChannels, int32_t sampleRate,
int32_t bitRate, int32_t aacProfile, bool isADTS, int32_t sbrMode,
int32_t maxOutputChannelCount, const drcParams_t& drc,
int32_t pcmLimiterEnable) {
if (encoder && isADTS) {
return -EINVAL;
}
status_t err = setupRawAudioFormat(
encoder ? kPortIndexInput : kPortIndexOutput,
sampleRate,
numChannels);
if (err != OK) {
return err;
}
if (encoder) {
err = selectAudioPortFormat(kPortIndexOutput, OMX_AUDIO_CodingAAC);
if (err != OK) {
return err;
}
OMX_PARAM_PORTDEFINITIONTYPE def;
InitOMXParams(&def);
def.nPortIndex = kPortIndexOutput;
err = mOMX->getParameter(
mNode, OMX_IndexParamPortDefinition, &def, sizeof(def));
if (err != OK) {
return err;
}
def.format.audio.bFlagErrorConcealment = OMX_TRUE;
def.format.audio.eEncoding = OMX_AUDIO_CodingAAC;
err = mOMX->setParameter(
mNode, OMX_IndexParamPortDefinition, &def, sizeof(def));
if (err != OK) {
return err;
}
OMX_AUDIO_PARAM_AACPROFILETYPE profile;
InitOMXParams(&profile);
profile.nPortIndex = kPortIndexOutput;
err = mOMX->getParameter(
mNode, OMX_IndexParamAudioAac, &profile, sizeof(profile));
if (err != OK) {
return err;
}
profile.nChannels = numChannels;
profile.eChannelMode =
(numChannels == 1)
? OMX_AUDIO_ChannelModeMono: OMX_AUDIO_ChannelModeStereo;
profile.nSampleRate = sampleRate;
profile.nBitRate = bitRate;
profile.nAudioBandWidth = 0;
profile.nFrameLength = 0;
profile.nAACtools = OMX_AUDIO_AACToolAll;
profile.nAACERtools = OMX_AUDIO_AACERNone;
profile.eAACProfile = (OMX_AUDIO_AACPROFILETYPE) aacProfile;
profile.eAACStreamFormat = OMX_AUDIO_AACStreamFormatMP4FF;
switch (sbrMode) {
case 0:
profile.nAACtools &= ~OMX_AUDIO_AACToolAndroidSSBR;
profile.nAACtools &= ~OMX_AUDIO_AACToolAndroidDSBR;
break;
case 1:
profile.nAACtools |= OMX_AUDIO_AACToolAndroidSSBR;
profile.nAACtools &= ~OMX_AUDIO_AACToolAndroidDSBR;
break;
case 2:
profile.nAACtools &= ~OMX_AUDIO_AACToolAndroidSSBR;
profile.nAACtools |= OMX_AUDIO_AACToolAndroidDSBR;
break;
case -1:
profile.nAACtools |= OMX_AUDIO_AACToolAndroidSSBR;
profile.nAACtools |= OMX_AUDIO_AACToolAndroidDSBR;
break;
default:
return BAD_VALUE;
}
err = mOMX->setParameter(
mNode, OMX_IndexParamAudioAac, &profile, sizeof(profile));
if (err != OK) {
return err;
}
return err;
}
OMX_AUDIO_PARAM_AACPROFILETYPE profile;
InitOMXParams(&profile);
profile.nPortIndex = kPortIndexInput;
err = mOMX->getParameter(
mNode, OMX_IndexParamAudioAac, &profile, sizeof(profile));
if (err != OK) {
return err;
}
profile.nChannels = numChannels;
profile.nSampleRate = sampleRate;
profile.eAACStreamFormat =
isADTS
? OMX_AUDIO_AACStreamFormatMP4ADTS
: OMX_AUDIO_AACStreamFormatMP4FF;
OMX_AUDIO_PARAM_ANDROID_AACPRESENTATIONTYPE presentation;
presentation.nMaxOutputChannels = maxOutputChannelCount;
presentation.nDrcCut = drc.drcCut;
presentation.nDrcBoost = drc.drcBoost;
presentation.nHeavyCompression = drc.heavyCompression;
presentation.nTargetReferenceLevel = drc.targetRefLevel;
presentation.nEncodedTargetLevel = drc.encodedTargetLevel;
presentation.nPCMLimiterEnable = pcmLimiterEnable;
status_t res = mOMX->setParameter(mNode, OMX_IndexParamAudioAac, &profile, sizeof(profile));
if (res == OK) {
mOMX->setParameter(mNode, (OMX_INDEXTYPE)OMX_IndexParamAudioAndroidAacPresentation,
&presentation, sizeof(presentation));
} else {
ALOGW("did not set AudioAndroidAacPresentation due to error %d when setting AudioAac", res);
}
return res;
}
| 18,228 |
15,983 | 0 | ImportTIFF_DSDTable ( const TIFF_Manager & tiff, const TIFF_Manager::TagInfo & tagInfo,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
const XMP_Uns8 * bytePtr = (XMP_Uns8*)tagInfo.dataPtr;
const XMP_Uns8 * byteEnd = bytePtr + tagInfo.dataLen;
XMP_Uns16 columns = *((XMP_Uns16*)bytePtr);
XMP_Uns16 rows = *((XMP_Uns16*)(bytePtr+2));
if ( ! tiff.IsNativeEndian() ) {
columns = Flip2 ( columns );
rows = Flip2 ( rows );
}
char buffer[20];
snprintf ( buffer, sizeof(buffer), "%d", columns ); // AUDIT: Use of sizeof(buffer) is safe.
xmp->SetStructField ( xmpNS, xmpProp, kXMP_NS_EXIF, "Columns", buffer );
snprintf ( buffer, sizeof(buffer), "%d", rows ); // AUDIT: Use of sizeof(buffer) is safe.
xmp->SetStructField ( xmpNS, xmpProp, kXMP_NS_EXIF, "Rows", buffer );
std::string arrayPath;
SXMPUtils::ComposeStructFieldPath ( xmpNS, xmpProp, kXMP_NS_EXIF, "Settings", &arrayPath );
bytePtr += 4; // Move to the list of settings.
UTF16Unit * utf16Ptr = (UTF16Unit*)bytePtr;
UTF16Unit * utf16End = (UTF16Unit*)byteEnd;
std::string utf8;
while ( utf16Ptr < utf16End ) {
size_t nameLen = 0;
while ( utf16Ptr[nameLen] != 0 ) ++nameLen;
++nameLen; // ! Include the terminating nul.
if ( (utf16Ptr + nameLen) > utf16End ) goto BadExif;
try {
FromUTF16 ( utf16Ptr, nameLen, &utf8, tiff.IsBigEndian() );
} catch ( ... ) {
goto BadExif; // Ignore the tag if there are conversion errors.
}
xmp->AppendArrayItem ( xmpNS, arrayPath.c_str(), kXMP_PropArrayIsOrdered, utf8.c_str() );
utf16Ptr += nameLen;
}
return;
BadExif: // Ignore the tag if the table is ill-formed.
xmp->DeleteProperty ( xmpNS, xmpProp );
return;
} catch ( ... ) {
}
} // ImportTIFF_DSDTable
| 18,229 |
31,814 | 0 | bool task_set_jobctl_pending(struct task_struct *task, unsigned int mask)
{
BUG_ON(mask & ~(JOBCTL_PENDING_MASK | JOBCTL_STOP_CONSUME |
JOBCTL_STOP_SIGMASK | JOBCTL_TRAPPING));
BUG_ON((mask & JOBCTL_TRAPPING) && !(mask & JOBCTL_PENDING_MASK));
if (unlikely(fatal_signal_pending(task) || (task->flags & PF_EXITING)))
return false;
if (mask & JOBCTL_STOP_SIGMASK)
task->jobctl &= ~JOBCTL_STOP_SIGMASK;
task->jobctl |= mask;
return true;
}
| 18,230 |
143,157 | 0 | Event* Document::createEvent(ExecutionContext* executionContext, const String& eventType, ExceptionState& exceptionState)
{
Event* event = nullptr;
for (const auto& factory : eventFactories()) {
event = factory->create(executionContext, eventType);
if (event)
return event;
}
exceptionState.throwDOMException(NotSupportedError, "The provided event type ('" + eventType + "') is invalid.");
return nullptr;
}
| 18,231 |
125,941 | 0 | ExtensionsUpdatedObserver::ExtensionsUpdatedObserver(
ExtensionProcessManager* manager, AutomationProvider* automation,
IPC::Message* reply_message)
: manager_(manager), automation_(automation->AsWeakPtr()),
reply_message_(reply_message), updater_finished_(false) {
registrar_.Add(this, content::NOTIFICATION_LOAD_STOP,
content::NotificationService::AllSources());
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR,
content::NotificationService::AllSources());
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALL_NOT_ALLOWED,
content::NotificationService::AllSources());
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED,
content::NotificationService::AllSources());
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED,
content::NotificationService::AllSources());
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND,
content::NotificationService::AllSources());
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UPDATING_FINISHED,
content::NotificationService::AllSources());
}
| 18,232 |
158,392 | 0 | void ClearState() {
context_menu_request_received_ = false;
context_menu_params_.source_type = ui::MENU_SOURCE_NONE;
}
| 18,233 |
168,775 | 0 | void RenderWidgetHostImpl::RequestCompositorFrameSink(
viz::mojom::CompositorFrameSinkRequest compositor_frame_sink_request,
viz::mojom::CompositorFrameSinkClientPtr compositor_frame_sink_client,
mojom::RenderFrameMetadataObserverClientRequest
render_frame_metadata_observer_client_request,
mojom::RenderFrameMetadataObserverPtr render_frame_metadata_observer) {
render_frame_metadata_provider_.Bind(
std::move(render_frame_metadata_observer_client_request),
std::move(render_frame_metadata_observer));
if (enable_viz_) {
auto callback = base::BindOnce(
[](viz::HostFrameSinkManager* manager,
viz::mojom::CompositorFrameSinkRequest request,
viz::mojom::CompositorFrameSinkClientPtr client,
const viz::FrameSinkId& frame_sink_id) {
manager->CreateCompositorFrameSink(
frame_sink_id, std::move(request), std::move(client));
},
base::Unretained(GetHostFrameSinkManager()),
std::move(compositor_frame_sink_request),
std::move(compositor_frame_sink_client));
if (view_)
std::move(callback).Run(view_->GetFrameSinkId());
else
create_frame_sink_callback_ = std::move(callback);
return;
}
if (compositor_frame_sink_binding_.is_bound())
compositor_frame_sink_binding_.Close();
compositor_frame_sink_binding_.Bind(
std::move(compositor_frame_sink_request),
BrowserMainLoop::GetInstance()->GetResizeTaskRunner());
if (view_)
view_->DidCreateNewRendererCompositorFrameSink(
compositor_frame_sink_client.get());
renderer_compositor_frame_sink_ = std::move(compositor_frame_sink_client);
}
| 18,234 |
149,994 | 0 | LayerTreeHostImpl::ProcessLayerTreeMutations() {
std::unique_ptr<BeginFrameCallbackList> callbacks(new BeginFrameCallbackList);
if (mutator_) {
const base::Closure& callback = mutator_->TakeMutations();
if (!callback.is_null())
callbacks->push_back(callback);
}
return callbacks;
}
| 18,235 |
121,162 | 0 | HTMLElement* HTMLInputElement::innerBlockElement() const
{
return m_inputType->innerBlockElement();
}
| 18,236 |
45,123 | 0 | static const char *req_content_encoding_field(request_rec *r)
{
return r->content_encoding;
}
| 18,237 |
149,814 | 0 | bool LayerTreeHost::PaintContent(const LayerList& update_layer_list,
bool* content_is_suitable_for_gpu) {
base::AutoReset<bool> painting(&in_paint_layer_contents_, true);
bool did_paint_content = false;
for (const auto& layer : update_layer_list) {
did_paint_content |= layer->Update();
*content_is_suitable_for_gpu &= layer->IsSuitableForGpuRasterization();
}
return did_paint_content;
}
| 18,238 |
63,945 | 0 | int check_dc_pred8x8_mode(int mode, int mb_x, int mb_y)
{
if (!mb_x)
return mb_y ? TOP_DC_PRED8x8 : DC_128_PRED8x8;
else
return mb_y ? mode : LEFT_DC_PRED8x8;
}
| 18,239 |
154,168 | 0 | base::StringPiece GLES2Decoder::GetLogPrefix() {
return GetLogger()->GetLogPrefix();
}
| 18,240 |
169,352 | 0 | TestNavigationManagerThrottle(NavigationHandle* handle,
base::Closure on_will_start_request_closure,
base::Closure on_will_process_response_closure)
: NavigationThrottle(handle),
on_will_start_request_closure_(on_will_start_request_closure),
on_will_process_response_closure_(on_will_process_response_closure) {}
| 18,241 |
169,104 | 0 | void StubOfflinePageModel::DeleteCachedPagesByURLPredicate(
const UrlPredicate& predicate,
const DeletePageCallback& callback) {}
| 18,242 |
16,227 | 0 | GahpClient::setDelegProxy( Proxy *proxy )
{
if ( !server->can_cache_proxies ) {
return;
}
if ( deleg_proxy != NULL && proxy == deleg_proxy->proxy ) {
return;
}
if ( deleg_proxy != NULL ) {
server->UnregisterProxy( deleg_proxy->proxy );
}
GahpProxyInfo *gahp_proxy = server->RegisterProxy( proxy );
ASSERT(gahp_proxy);
deleg_proxy = gahp_proxy;
}
| 18,243 |
93,718 | 0 | void cJSON_Minify(char *json)
{
char *into=json;
while (*json)
{
if (*json==' ') json++;
else if (*json=='\t') json++; /* Whitespace characters. */
else if (*json=='\r') json++;
else if (*json=='\n') json++;
else if (*json=='/' && json[1]=='/') while (*json && *json!='\n') json++; /* double-slash comments, to end of line. */
else if (*json=='/' && json[1]=='*') {while (*json && !(*json=='*' && json[1]=='/')) json++;json+=2;} /* multiline comments. */
else if (*json=='\"'){*into++=*json++;while (*json && *json!='\"'){if (*json=='\\') *into++=*json++;*into++=*json++;}*into++=*json++;} /* string literals, which are \" sensitive. */
else *into++=*json++; /* All other characters. */
}
*into=0; /* and null-terminate. */
}
| 18,244 |
91,520 | 0 | void skip_input_data (j_decompress_ptr cinfo, long num_bytes)
{
my_src_ptr src = (my_src_ptr) cinfo->src;
/* Just a dumb implementation for now. Not clear that being smart is worth
* any trouble anyway --- large skips are infrequent.
*/
if (num_bytes > 0) {
while (num_bytes > (long) src->pub.bytes_in_buffer) {
num_bytes -= (long) src->pub.bytes_in_buffer;
(void) fill_input_buffer (cinfo);
/* note we assume that fill_input_buffer will never return FALSE,
* so suspension need not be handled.
*/
}
src->pub.next_input_byte += (size_t) num_bytes;
src->pub.bytes_in_buffer -= (size_t) num_bytes;
}
}
| 18,245 |
72,924 | 0 | void jpc_quantize(jas_matrix_t *data, jpc_fix_t stepsize)
{
int i;
int j;
jpc_fix_t t;
if (stepsize == jpc_inttofix(1)) {
return;
}
for (i = 0; i < jas_matrix_numrows(data); ++i) {
for (j = 0; j < jas_matrix_numcols(data); ++j) {
t = jas_matrix_get(data, i, j);
{
if (t < 0) {
t = jpc_fix_neg(jpc_fix_div(jpc_fix_neg(t), stepsize));
} else {
t = jpc_fix_div(t, stepsize);
}
}
jas_matrix_set(data, i, j, t);
}
}
}
| 18,246 |
185,122 | 1 | void LocalFileSystem::deleteFileSystem(ExecutionContext* context, FileSystemType type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
{
RefPtrWillBeRawPtr<ExecutionContext> contextPtr(context);
ASSERT(context);
ASSERT_WITH_SECURITY_IMPLICATION(context->isDocument());
RefPtr<CallbackWrapper> wrapper = adoptRef(new CallbackWrapper(callbacks));
requestFileSystemAccessInternal(context,
bind(&LocalFileSystem::deleteFileSystemInternal, this, contextPtr, type, wrapper),
bind(&LocalFileSystem::fileSystemNotAllowedInternal, this, contextPtr, wrapper));
}
| 18,247 |
166,407 | 0 | size_t GLES2Util::RenderbufferBytesPerPixel(int format) {
switch (format) {
case GL_STENCIL_INDEX8:
return 1;
case GL_RGBA4:
case GL_RGB565:
case GL_RGB5_A1:
case GL_DEPTH_COMPONENT16:
return 2;
case GL_RGB:
case GL_RGBA:
case GL_DEPTH24_STENCIL8_OES:
case GL_RGB8_OES:
case GL_RGBA8_OES:
case GL_DEPTH_COMPONENT24_OES:
return 4;
default:
return 0;
}
}
| 18,248 |
123,319 | 0 | static gboolean OnButtonPressReleaseEvent(
GtkWidget* widget,
GdkEventButton* event,
RenderWidgetHostViewGtk* host_view) {
TRACE_EVENT0("browser",
"RenderWidgetHostViewGtkWidget::OnButtonPressReleaseEvent");
if (event->type != GDK_BUTTON_RELEASE)
host_view->set_last_mouse_down(event);
if (!(event->button == 1 || event->button == 2 || event->button == 3))
return FALSE; // We do not forward any other buttons to the renderer.
if (event->type == GDK_2BUTTON_PRESS || event->type == GDK_3BUTTON_PRESS)
return FALSE;
if (!gtk_widget_is_focus(widget))
host_view->host_->OnPointerEventActivate();
if (event->type != GDK_BUTTON_RELEASE)
host_view->im_context_->ConfirmComposition();
GtkWidget* event_widget = gtk_get_event_widget(
reinterpret_cast<GdkEvent*>(event));
if (event_widget != widget) {
int x = 0;
int y = 0;
gtk_widget_get_pointer(widget, &x, &y);
GtkAllocation allocation;
gtk_widget_get_allocation(widget, &allocation);
bool click_in_popup = x >= 0 && y >= 0 && x < allocation.width &&
y < allocation.height;
if (event->type != GDK_BUTTON_RELEASE && host_view->IsPopup() &&
!host_view->is_popup_first_mouse_release_ && !click_in_popup) {
host_view->host_->Shutdown();
return FALSE;
}
event->x = x;
event->y = y;
}
if (event->type == GDK_BUTTON_PRESS && !gtk_widget_has_focus(widget))
gtk_widget_grab_focus(widget);
host_view->is_popup_first_mouse_release_ = false;
RenderWidgetHostImpl* widget_host =
RenderWidgetHostImpl::From(host_view->GetRenderWidgetHost());
if (widget_host)
widget_host->ForwardMouseEvent(WebInputEventFactory::mouseEvent(event));
return FALSE;
}
| 18,249 |
143,111 | 0 | DEFINE_TRACE_WRAPPERS(Document)
{
visitor->traceWrappers(m_importsController);
visitor->traceWrappers(m_implementation);
visitor->traceWrappers(m_styleSheetList);
visitor->traceWrappers(m_styleEngine);
visitor->traceWrappers(
Supplementable<Document>::m_supplements.get(
FontFaceSet::supplementName()));
for (int i = 0; i < numNodeListInvalidationTypes; ++i) {
for (auto list : m_nodeLists[i]) {
visitor->traceWrappers(list);
}
}
ContainerNode::traceWrappers(visitor);
}
| 18,250 |
72,736 | 0 | static int jas_icctxt_getsize(jas_iccattrval_t *attrval)
{
jas_icctxt_t *txt = &attrval->data.txt;
return JAS_CAST(int, strlen(txt->string) + 1);
}
| 18,251 |
44,809 | 0 | local void log_free(void)
{
struct log *me;
if (log_tail != NULL) {
#ifndef NOTHREAD
possess(log_lock);
#endif
while ((me = log_head) != NULL) {
log_head = me->next;
FREE(me->msg);
FREE(me);
}
#ifndef NOTHREAD
twist(log_lock, TO, 0);
free_lock(log_lock);
log_lock = NULL;
yarn_mem(malloc, free);
free_lock(mem_track.lock);
#endif
log_tail = NULL;
}
}
| 18,252 |
138,389 | 0 | std::unique_ptr<media::CdmAllocator> CreateCdmAllocator() {
return base::MakeUnique<media::MojoCdmAllocator>();
}
| 18,253 |
117,769 | 0 | v8::Handle<v8::Object> V8TestNamedConstructor::wrapSlow(PassRefPtr<TestNamedConstructor> impl, v8::Isolate* isolate)
{
v8::Handle<v8::Object> wrapper;
V8Proxy* proxy = 0;
wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl.get());
if (UNLIKELY(wrapper.IsEmpty()))
return wrapper;
v8::Persistent<v8::Object> wrapperHandle = v8::Persistent<v8::Object>::New(wrapper);
if (!hasDependentLifetime)
wrapperHandle.MarkIndependent();
V8DOMWrapper::setJSWrapperForActiveDOMObject(impl, wrapperHandle, isolate);
return wrapper;
}
| 18,254 |
125,809 | 0 | bool ParamTraits<base::PlatformFileInfo>::Read(const Message* m,
PickleIterator* iter,
param_type* p) {
double last_modified;
double last_accessed;
double creation_time;
bool result =
ReadParam(m, iter, &p->size) &&
ReadParam(m, iter, &p->is_directory) &&
ReadParam(m, iter, &last_modified) &&
ReadParam(m, iter, &last_accessed) &&
ReadParam(m, iter, &creation_time);
if (result) {
p->last_modified = base::Time::FromDoubleT(last_modified);
p->last_accessed = base::Time::FromDoubleT(last_accessed);
p->creation_time = base::Time::FromDoubleT(creation_time);
}
return result;
}
| 18,255 |
135,192 | 0 | PassRefPtrWillBeRawPtr<Text> Document::createTextNode(const String& data)
{
return Text::create(*this, data);
}
| 18,256 |
46,935 | 0 | static int crc32c_intel_digest(struct shash_desc *desc, const u8 *data,
unsigned int len, u8 *out)
{
return __crc32c_intel_finup(crypto_shash_ctx(desc->tfm), data, len,
out);
}
| 18,257 |
75,985 | 0 | static_track_group_handler(vector_t *strvec)
{
element e;
static_track_group_t *tg;
char* gname;
if (!strvec)
return;
if (vector_count(strvec) != 2) {
report_config_error(CONFIG_GENERAL_ERROR, "track_group must have a name - skipping");
skip_block(true);
return;
}
gname = strvec_slot(strvec, 1);
/* check group doesn't already exist */
LIST_FOREACH(vrrp_data->static_track_groups, tg, e) {
if (!strcmp(gname,tg->gname)) {
report_config_error(CONFIG_GENERAL_ERROR, "track_group %s already defined", gname);
skip_block(true);
return;
}
}
alloc_static_track_group(gname);
}
| 18,258 |
177,739 | 1 | long ssl_get_algorithm2(SSL *s)
{
long alg2 = s->s3->tmp.new_cipher->algorithm2;
if (TLS1_get_version(s) >= TLS1_2_VERSION &&
alg2 == (SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF))
return SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256;
return alg2;
}
| 18,259 |
184,249 | 1 | Blob::Blob(PassOwnPtr<BlobData> blobData, long long size)
: m_type(blobData->contentType())
, m_size(size)
{
ASSERT(blobData);
ScriptWrappable::init(this);
// Create a new internal URL and register it with the provided blob data.
m_internalURL = BlobURL::createInternalURL();
ThreadableBlobRegistry::registerBlobURL(m_internalURL, blobData);
}
| 18,260 |
173,759 | 0 | static struct node* lookup_node_and_path_by_id_locked(struct fuse* fuse, __u64 nid,
char* buf, size_t bufsize)
{
struct node* node = lookup_node_by_id_locked(fuse, nid);
if (node && get_node_path_locked(node, buf, bufsize) < 0) {
node = NULL;
}
return node;
}
| 18,261 |
23,631 | 0 | static __inline__ void isdn_net_dec_frame_cnt(isdn_net_local *lp)
{
atomic_dec(&lp->frame_cnt);
if (!(isdn_net_device_busy(lp))) {
if (!skb_queue_empty(&lp->super_tx_queue)) {
schedule_work(&lp->tqueue);
} else {
isdn_net_device_wake_queue(lp);
}
}
}
| 18,262 |
155,342 | 0 | ChromeContentBrowserClient::GetExtraServiceManifests() {
return std::vector<service_manager::Manifest> {
GetChromeRendererManifest(),
#if BUILDFLAG(ENABLE_NACL)
GetNaClLoaderManifest(),
#if defined(OS_WIN) && defined(ARCH_CPU_X86)
GetNaClBrokerManifest(),
#endif // defined(OS_WIN)
#endif // BUILDFLAG(ENABLE_NACL)
};
}
| 18,263 |
108,445 | 0 | ChromeRenderMessageFilter::~ChromeRenderMessageFilter() {
}
| 18,264 |
37,752 | 0 | static void enable_irq_window(struct kvm_vcpu *vcpu)
{
struct vcpu_svm *svm = to_svm(vcpu);
/*
* In case GIF=0 we can't rely on the CPU to tell us when GIF becomes
* 1, because that's a separate STGI/VMRUN intercept. The next time we
* get that intercept, this function will be called again though and
* we'll get the vintr intercept.
*/
if (gif_set(svm) && nested_svm_intr(svm)) {
svm_set_vintr(svm);
svm_inject_irq(svm, 0x0);
}
}
| 18,265 |
34,562 | 0 | static void macvtap_exit(void)
{
rtnl_link_unregister(&macvtap_link_ops);
unregister_netdevice_notifier(&macvtap_notifier_block);
class_unregister(macvtap_class);
cdev_del(&macvtap_cdev);
unregister_chrdev_region(macvtap_major, MACVTAP_NUM_DEVS);
}
| 18,266 |
156,930 | 0 | std::unique_ptr<NavigationRequest> NavigationRequest::CreateBrowserInitiated(
FrameTreeNode* frame_tree_node,
const GURL& dest_url,
const Referrer& dest_referrer,
const FrameNavigationEntry& frame_entry,
const NavigationEntryImpl& entry,
FrameMsg_Navigate_Type::Value navigation_type,
PreviewsState previews_state,
bool is_same_document_history_load,
bool is_history_navigation_in_new_child,
const scoped_refptr<network::ResourceRequestBody>& post_body,
const base::TimeTicks& navigation_start,
NavigationControllerImpl* controller,
std::unique_ptr<NavigationUIData> navigation_ui_data) {
scoped_refptr<network::ResourceRequestBody> request_body;
std::string post_content_type;
if (post_body) {
request_body = post_body;
} else if (frame_entry.method() == "POST") {
request_body = frame_entry.GetPostData(&post_content_type);
post_content_type =
base::TrimWhitespaceASCII(post_content_type, base::TRIM_ALL)
.as_string();
}
bool is_form_submission = !!request_body;
base::Optional<url::Origin> initiator =
frame_tree_node->IsMainFrame()
? base::Optional<url::Origin>()
: base::Optional<url::Origin>(
frame_tree_node->frame_tree()->root()->current_origin());
bool browser_initiated = !entry.is_renderer_initiated();
CommonNavigationParams common_params = entry.ConstructCommonNavigationParams(
frame_entry, request_body, dest_url, dest_referrer, navigation_type,
previews_state, navigation_start);
RequestNavigationParams request_params =
entry.ConstructRequestNavigationParams(
frame_entry, common_params.url, common_params.method,
is_history_navigation_in_new_child,
entry.GetSubframeUniqueNames(frame_tree_node),
controller->GetPendingEntryIndex() == -1,
controller->GetIndexOfEntry(&entry),
controller->GetLastCommittedEntryIndex(),
controller->GetEntryCount());
request_params.post_content_type = post_content_type;
std::unique_ptr<NavigationRequest> navigation_request(new NavigationRequest(
frame_tree_node, common_params,
mojom::BeginNavigationParams::New(
entry.extra_headers(), net::LOAD_NORMAL,
false /* skip_service_worker */, REQUEST_CONTEXT_TYPE_LOCATION,
blink::WebMixedContentContextType::kBlockable, is_form_submission,
GURL() /* searchable_form_url */,
std::string() /* searchable_form_encoding */, initiator,
GURL() /* client_side_redirect_url */,
base::nullopt /* devtools_initiator_info */),
request_params, browser_initiated, false /* from_begin_navigation */,
&frame_entry, &entry, std::move(navigation_ui_data)));
return navigation_request;
}
| 18,267 |
6,942 | 0 | FT_GetFilePath_From_Mac_ATS_Name( const char* fontName,
UInt8* path,
UInt32 maxPathSize,
FT_Long* face_index )
{
FSRef ref;
FT_Error err;
err = FT_GetFileRef_From_Mac_ATS_Name( fontName, &ref, face_index );
if ( err )
return err;
if ( noErr != FSRefMakePath( &ref, path, maxPathSize ) )
return FT_THROW( Unknown_File_Format );
return FT_Err_Ok;
}
| 18,268 |
163,945 | 0 | PaymentHandlerWebFlowViewController::GetHeaderBackground() {
auto default_header_background =
PaymentRequestSheetController::GetHeaderBackground();
if (web_contents()) {
return views::CreateSolidBackground(color_utils::GetResultingPaintColor(
web_contents()->GetThemeColor().value_or(SK_ColorTRANSPARENT),
default_header_background->get_color()));
}
return default_header_background;
}
| 18,269 |
14,548 | 0 | void BN_init(BIGNUM *a)
{
memset(a,0,sizeof(BIGNUM));
bn_check_top(a);
}
| 18,270 |
177,662 | 0 | ResizeTest() : EncoderTest(GET_PARAM(0)) {}
| 18,271 |
124,453 | 0 | void WebRuntimeFeatures::enableTargetedStyleRecalc(bool enable)
{
RuntimeEnabledFeatures::setTargetedStyleRecalcEnabled(enable);
}
| 18,272 |
83,902 | 0 | vips_foreign_load_dispose( GObject *gobject )
{
VipsForeignLoad *load = VIPS_FOREIGN_LOAD( gobject );
VIPS_UNREF( load->real );
G_OBJECT_CLASS( vips_foreign_load_parent_class )->dispose( gobject );
}
| 18,273 |
92,110 | 0 | static int first_med_bfreg(struct mlx5_ib_dev *dev,
struct mlx5_bfreg_info *bfregi)
{
return num_med_bfreg(dev, bfregi) ? 1 : -ENOMEM;
}
| 18,274 |
123,882 | 0 | void RenderViewImpl::OnCopy() {
if (!webview())
return;
base::AutoReset<bool> handling_select_range(&handling_select_range_, true);
webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Copy"),
context_menu_node_);
}
| 18,275 |
59,022 | 0 | static void change_paragraph_style(HTStructured * me, HTStyle *style)
{
if (me->new_style != style) {
me->style_change = YES;
me->new_style = style;
}
me->in_word = NO;
}
| 18,276 |
130,326 | 0 | InvalidationData& RuleFeatureSet::ensureAttributeInvalidationData(const AtomicString& attributeName)
{
return ensureInvalidationData(m_attributeInvalidationSets, attributeName);
}
| 18,277 |
16,644 | 0 | ReadUserLogState::SetScoreFactor( enum ScoreFactors which, int factor )
{
switch ( which )
{
case SCORE_CTIME:
m_score_fact_ctime = factor;
break;
case SCORE_INODE:
m_score_fact_inode = factor;
break;
case SCORE_SAME_SIZE:
m_score_fact_same_size = factor;
break;
case SCORE_GROWN:
m_score_fact_grown = factor;
break;
case SCORE_SHRUNK:
m_score_fact_shrunk = factor;
break;
default:
break;
}
Update();
}
| 18,278 |
172,795 | 0 | static int cancel_bond(const bt_bdaddr_t *bd_addr)
{
/* sanity check */
if (interface_ready() == FALSE)
return BT_STATUS_NOT_READY;
return btif_dm_cancel_bond(bd_addr);
}
| 18,279 |
77,534 | 0 | ofputil_decode_queue_get_config_request(const struct ofp_header *oh,
ofp_port_t *port, uint32_t *queue)
{
const struct ofp10_queue_get_config_request *qgcr10;
const struct ofp11_queue_get_config_request *qgcr11;
const struct ofp14_queue_desc_request *qdr14;
struct ofpbuf b = ofpbuf_const_initializer(oh, ntohs(oh->length));
enum ofpraw raw = ofpraw_pull_assert(&b);
switch ((int) raw) {
case OFPRAW_OFPT10_QUEUE_GET_CONFIG_REQUEST:
qgcr10 = b.data;
*port = u16_to_ofp(ntohs(qgcr10->port));
*queue = OFPQ_ALL;
break;
case OFPRAW_OFPT11_QUEUE_GET_CONFIG_REQUEST:
qgcr11 = b.data;
*queue = OFPQ_ALL;
enum ofperr error = ofputil_port_from_ofp11(qgcr11->port, port);
if (error || *port == OFPP_ANY) {
return error;
}
break;
case OFPRAW_OFPST14_QUEUE_DESC_REQUEST:
qdr14 = b.data;
*queue = ntohl(qdr14->queue);
return ofputil_port_from_ofp11(qdr14->port, port);
default:
OVS_NOT_REACHED();
}
return (ofp_to_u16(*port) < ofp_to_u16(OFPP_MAX)
? 0
: OFPERR_OFPQOFC_BAD_PORT);
}
| 18,280 |
60,709 | 0 | static void sctp_wfree(struct sk_buff *skb)
{
struct sctp_chunk *chunk = skb_shinfo(skb)->destructor_arg;
struct sctp_association *asoc = chunk->asoc;
struct sock *sk = asoc->base.sk;
asoc->sndbuf_used -= SCTP_DATA_SNDSIZE(chunk) +
sizeof(struct sk_buff) +
sizeof(struct sctp_chunk);
WARN_ON(refcount_sub_and_test(sizeof(struct sctp_chunk), &sk->sk_wmem_alloc));
/*
* This undoes what is done via sctp_set_owner_w and sk_mem_charge
*/
sk->sk_wmem_queued -= skb->truesize;
sk_mem_uncharge(sk, skb->truesize);
sock_wfree(skb);
sctp_wake_up_waiters(sk, asoc);
sctp_association_put(asoc);
}
| 18,281 |
110,367 | 0 | scoped_refptr< ::ppapi::CallbackTracker> PluginModule::GetCallbackTracker() {
return callback_tracker_;
}
| 18,282 |
72,182 | 0 | mm_answer_term(int sock, Buffer *req)
{
extern struct monitor *pmonitor;
int res, status;
debug3("%s: tearing down sessions", __func__);
/* The child is terminating */
session_destroy_all(&mm_session_close);
while (waitpid(pmonitor->m_pid, &status, 0) == -1)
if (errno != EINTR)
exit(1);
res = WIFEXITED(status) ? WEXITSTATUS(status) : 1;
/* Terminate process */
exit(res);
}
| 18,283 |
85,174 | 0 | int f2fs_release_page(struct page *page, gfp_t wait)
{
/* If this is dirty page, keep PagePrivate */
if (PageDirty(page))
return 0;
/* This is atomic written page, keep Private */
if (IS_ATOMIC_WRITTEN_PAGE(page))
return 0;
set_page_private(page, 0);
ClearPagePrivate(page);
return 1;
}
| 18,284 |
160,354 | 0 | void NormalPage::checkAndMarkPointer(Visitor* visitor, Address address) {
#if DCHECK_IS_ON()
DCHECK(contains(address));
#endif
HeapObjectHeader* header = findHeaderFromAddress(address);
if (!header)
return;
markPointer(visitor, header);
}
| 18,285 |
78,161 | 0 | static int asepcos_get_default_key(sc_card_t *card,
struct sc_cardctl_default_key *data)
{
static const u8 asepcos_def_key[] = {0x41,0x53,0x45,0x43,0x41,0x52,0x44,0x2b};
if (data->method != SC_AC_CHV && data->method != SC_AC_AUT)
return SC_ERROR_NO_DEFAULT_KEY;
if (data->key_data == NULL || data->len < sizeof(asepcos_def_key))
return SC_ERROR_BUFFER_TOO_SMALL;
memcpy(data->key_data, asepcos_def_key, sizeof(asepcos_def_key));
data->len = sizeof(asepcos_def_key);
return SC_SUCCESS;
}
| 18,286 |
85,712 | 0 | static bool hns_nic_rx_fini_pro_v2(struct hns_nic_ring_data *ring_data)
{
struct hnae_ring *ring = ring_data->ring;
int num;
num = readl_relaxed(ring->io_base + RCB_REG_FBDNUM);
if (!num)
return true;
else
return false;
}
| 18,287 |
80,512 | 0 | GF_Err tfdt_Read(GF_Box *s,GF_BitStream *bs)
{
GF_TFBaseMediaDecodeTimeBox *ptr = (GF_TFBaseMediaDecodeTimeBox *)s;
if (ptr->version==1) {
ptr->baseMediaDecodeTime = gf_bs_read_u64(bs);
ISOM_DECREASE_SIZE(ptr, 8);
} else {
ptr->baseMediaDecodeTime = (u32) gf_bs_read_u32(bs);
ISOM_DECREASE_SIZE(ptr, 4);
}
return GF_OK;
}
| 18,288 |
187,220 | 1 | static int auto_claim(struct libusb_transfer *transfer, int *interface_number, int api_type)
{
struct libusb_context *ctx = DEVICE_CTX(transfer->dev_handle->dev);
struct windows_device_handle_priv *handle_priv = _device_handle_priv(
transfer->dev_handle);
struct windows_device_priv *priv = _device_priv(transfer->dev_handle->dev);
int current_interface = *interface_number;
int r = LIBUSB_SUCCESS;
switch(api_type) {
case USB_API_WINUSBX:
case USB_API_HID:
break;
default:
return LIBUSB_ERROR_INVALID_PARAM;
}
usbi_mutex_lock(&autoclaim_lock);
if (current_interface < 0) // No serviceable interface was found
{
for (current_interface=0; current_interface<USB_MAXINTERFACES; current_interface++) {
// Must claim an interface of the same API type
if ( (priv->usb_interface[current_interface].apib->id == api_type)
&& (libusb_claim_interface(transfer->dev_handle, current_interface) == LIBUSB_SUCCESS) ) {
usbi_dbg("auto-claimed interface %d for control request", current_interface);
if (handle_priv->autoclaim_count[current_interface] != 0) {
usbi_warn(ctx, "program assertion failed - autoclaim_count was nonzero");
}
handle_priv->autoclaim_count[current_interface]++;
break;
}
}
if (current_interface == USB_MAXINTERFACES) {
usbi_err(ctx, "could not auto-claim any interface");
r = LIBUSB_ERROR_NOT_FOUND;
}
} else {
// If we have a valid interface that was autoclaimed, we must increment
// its autoclaim count so that we can prevent an early release.
if (handle_priv->autoclaim_count[current_interface] != 0) {
handle_priv->autoclaim_count[current_interface]++;
}
}
usbi_mutex_unlock(&autoclaim_lock);
*interface_number = current_interface;
return r;
}
| 18,289 |
23,620 | 0 | isdn_net_autohup(void)
{
isdn_net_dev *p = dev->netdev;
int anymore;
anymore = 0;
while (p) {
isdn_net_local *l = p->local;
if (jiffies == last_jiffies)
l->cps = l->transcount;
else
l->cps = (l->transcount * HZ) / (jiffies - last_jiffies);
l->transcount = 0;
if (dev->net_verbose > 3)
printk(KERN_DEBUG "%s: %d bogocps\n", p->dev->name, l->cps);
if ((l->flags & ISDN_NET_CONNECTED) && (!l->dialstate)) {
anymore = 1;
l->huptimer++;
/*
* if there is some dialmode where timeout-hangup
* should _not_ be done, check for that here
*/
if ((l->onhtime) &&
(l->huptimer > l->onhtime))
{
if (l->hupflags & ISDN_MANCHARGE &&
l->hupflags & ISDN_CHARGEHUP) {
while (time_after(jiffies, l->chargetime + l->chargeint))
l->chargetime += l->chargeint;
if (time_after(jiffies, l->chargetime + l->chargeint - 2 * HZ))
if (l->outgoing || l->hupflags & ISDN_INHUP)
isdn_net_hangup(p->dev);
} else if (l->outgoing) {
if (l->hupflags & ISDN_CHARGEHUP) {
if (l->hupflags & ISDN_WAITCHARGE) {
printk(KERN_DEBUG "isdn_net: Hupflags of %s are %X\n",
p->dev->name, l->hupflags);
isdn_net_hangup(p->dev);
} else if (time_after(jiffies, l->chargetime + l->chargeint)) {
printk(KERN_DEBUG
"isdn_net: %s: chtime = %lu, chint = %d\n",
p->dev->name, l->chargetime, l->chargeint);
isdn_net_hangup(p->dev);
}
} else
isdn_net_hangup(p->dev);
} else if (l->hupflags & ISDN_INHUP)
isdn_net_hangup(p->dev);
}
if(dev->global_flags & ISDN_GLOBAL_STOPPED || (ISDN_NET_DIALMODE(*l) == ISDN_NET_DM_OFF)) {
isdn_net_hangup(p->dev);
break;
}
}
p = (isdn_net_dev *) p->next;
}
last_jiffies = jiffies;
isdn_timer_ctrl(ISDN_TIMER_NETHANGUP, anymore);
}
| 18,290 |
96,895 | 0 | static long vmsplice_to_user(struct file *file, struct iov_iter *iter,
unsigned int flags)
{
struct pipe_inode_info *pipe = get_pipe_info(file);
struct splice_desc sd = {
.total_len = iov_iter_count(iter),
.flags = flags,
.u.data = iter
};
long ret = 0;
if (!pipe)
return -EBADF;
if (sd.total_len) {
pipe_lock(pipe);
ret = __splice_from_pipe(pipe, &sd, pipe_to_user);
pipe_unlock(pipe);
}
return ret;
}
| 18,291 |
93,860 | 0 | virDomainMigrateGetCompressionCache(virDomainPtr domain,
unsigned long long *cacheSize,
unsigned int flags)
{
virConnectPtr conn;
VIR_DOMAIN_DEBUG(domain, "cacheSize=%p, flags=%x", cacheSize, flags);
virResetLastError();
virCheckDomainReturn(domain, -1);
conn = domain->conn;
virCheckNonNullArgGoto(cacheSize, error);
if (conn->driver->domainMigrateGetCompressionCache) {
if (conn->driver->domainMigrateGetCompressionCache(domain, cacheSize,
flags) < 0)
goto error;
return 0;
}
virReportUnsupportedError();
error:
virDispatchError(conn);
return -1;
}
| 18,292 |
61,101 | 0 | nautilus_file_operations_compress (GList *files,
GFile *output,
AutoarFormat format,
AutoarFilter filter,
GtkWindow *parent_window,
NautilusCreateCallback done_callback,
gpointer done_callback_data)
{
g_autoptr (GTask) task = NULL;
CompressJob *compress_job;
compress_job = op_job_new (CompressJob, parent_window);
compress_job->source_files = g_list_copy_deep (files,
(GCopyFunc) g_object_ref,
NULL);
compress_job->output_file = g_object_ref (output);
compress_job->format = format;
compress_job->filter = filter;
compress_job->done_callback = done_callback;
compress_job->done_callback_data = done_callback_data;
inhibit_power_manager ((CommonJob *) compress_job, _("Compressing Files"));
if (!nautilus_file_undo_manager_is_operating ())
{
compress_job->common.undo_info = nautilus_file_undo_info_compress_new (files,
output,
format,
filter);
}
task = g_task_new (NULL, compress_job->common.cancellable,
compress_task_done, compress_job);
g_task_set_task_data (task, compress_job, NULL);
g_task_run_in_thread (task, compress_task_thread_func);
}
| 18,293 |
136,981 | 0 | bool HTMLInputElement::StepMismatch() const {
return willValidate() && input_type_->StepMismatch(value());
}
| 18,294 |
26,017 | 0 | list_add_event(struct perf_event *event, struct perf_event_context *ctx)
{
WARN_ON_ONCE(event->attach_state & PERF_ATTACH_CONTEXT);
event->attach_state |= PERF_ATTACH_CONTEXT;
/*
* If we're a stand alone event or group leader, we go to the context
* list, group events are kept attached to the group so that
* perf_group_detach can, at all times, locate all siblings.
*/
if (event->group_leader == event) {
struct list_head *list;
if (is_software_event(event))
event->group_flags |= PERF_GROUP_SOFTWARE;
list = ctx_group_list(event, ctx);
list_add_tail(&event->group_entry, list);
}
if (is_cgroup_event(event))
ctx->nr_cgroups++;
list_add_rcu(&event->event_entry, &ctx->event_list);
if (!ctx->nr_events)
perf_pmu_rotate_start(ctx->pmu);
ctx->nr_events++;
if (event->attr.inherit_stat)
ctx->nr_stat++;
}
| 18,295 |
77,707 | 0 | ofputil_queue_stats_to_ofp14(const struct ofputil_queue_stats *oqs,
struct ofp14_queue_stats *qs14)
{
qs14->length = htons(sizeof *qs14);
memset(qs14->pad, 0, sizeof qs14->pad);
ofputil_queue_stats_to_ofp13(oqs, &qs14->qs);
}
| 18,296 |
147,982 | 0 | static void UnsignedLongLongAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Local<v8::Object> holder = info.Holder();
TestObject* impl = V8TestObject::ToImpl(holder);
V8SetReturnValue(info, static_cast<double>(impl->unsignedLongLongAttribute()));
}
| 18,297 |
62,699 | 0 | static void ClosestColor(const Image *image,CubeInfo *cube_info,
const NodeInfo *node_info)
{
register ssize_t
i;
size_t
number_children;
/*
Traverse any children.
*/
number_children=cube_info->associate_alpha == MagickFalse ? 8UL : 16UL;
for (i=0; i < (ssize_t) number_children; i++)
if (node_info->child[i] != (NodeInfo *) NULL)
ClosestColor(image,cube_info,node_info->child[i]);
if (node_info->number_unique != 0)
{
MagickRealType
pixel;
register DoublePixelPacket
*magick_restrict q;
register MagickRealType
alpha,
beta,
distance;
register PixelPacket
*magick_restrict p;
/*
Determine if this color is "closest".
*/
p=image->colormap+node_info->color_number;
q=(&cube_info->target);
alpha=1.0;
beta=1.0;
if (cube_info->associate_alpha != MagickFalse)
{
alpha=(MagickRealType) (QuantumScale*GetPixelAlpha(p));
beta=(MagickRealType) (QuantumScale*GetPixelAlpha(q));
}
pixel=alpha*GetPixelRed(p)-beta*GetPixelRed(q);
distance=pixel*pixel;
if (distance <= cube_info->distance)
{
pixel=alpha*GetPixelGreen(p)-beta*GetPixelGreen(q);
distance+=pixel*pixel;
if (distance <= cube_info->distance)
{
pixel=alpha*GetPixelBlue(p)-beta*GetPixelBlue(q);
distance+=pixel*pixel;
if (distance <= cube_info->distance)
{
if (cube_info->associate_alpha != MagickFalse)
{
pixel=GetPixelAlpha(p)-GetPixelAlpha(q);
distance+=pixel*pixel;
}
if (distance <= cube_info->distance)
{
cube_info->distance=distance;
cube_info->color_number=node_info->color_number;
}
}
}
}
}
}
| 18,298 |
178,525 | 1 | ssh_session(void)
{
int type;
int interactive = 0;
int have_tty = 0;
struct winsize ws;
char *cp;
const char *display;
/* Enable compression if requested. */
if (options.compression) {
options.compression_level);
if (options.compression_level < 1 ||
options.compression_level > 9)
fatal("Compression level must be from 1 (fast) to "
"9 (slow, best).");
/* Send the request. */
packet_start(SSH_CMSG_REQUEST_COMPRESSION);
packet_put_int(options.compression_level);
packet_send();
packet_write_wait();
type = packet_read();
if (type == SSH_SMSG_SUCCESS)
packet_start_compression(options.compression_level);
else if (type == SSH_SMSG_FAILURE)
logit("Warning: Remote host refused compression.");
else
packet_disconnect("Protocol error waiting for "
"compression response.");
}
/* Allocate a pseudo tty if appropriate. */
if (tty_flag) {
debug("Requesting pty.");
/* Start the packet. */
packet_start(SSH_CMSG_REQUEST_PTY);
/* Store TERM in the packet. There is no limit on the
length of the string. */
cp = getenv("TERM");
if (!cp)
cp = "";
packet_put_cstring(cp);
/* Store window size in the packet. */
if (ioctl(fileno(stdin), TIOCGWINSZ, &ws) < 0)
memset(&ws, 0, sizeof(ws));
packet_put_int((u_int)ws.ws_row);
packet_put_int((u_int)ws.ws_col);
packet_put_int((u_int)ws.ws_xpixel);
packet_put_int((u_int)ws.ws_ypixel);
/* Store tty modes in the packet. */
tty_make_modes(fileno(stdin), NULL);
/* Send the packet, and wait for it to leave. */
packet_send();
packet_write_wait();
/* Read response from the server. */
type = packet_read();
if (type == SSH_SMSG_SUCCESS) {
interactive = 1;
have_tty = 1;
} else if (type == SSH_SMSG_FAILURE)
logit("Warning: Remote host failed or refused to "
"allocate a pseudo tty.");
else
packet_disconnect("Protocol error waiting for pty "
"request response.");
}
/* Request X11 forwarding if enabled and DISPLAY is set. */
display = getenv("DISPLAY");
display = getenv("DISPLAY");
if (display == NULL && options.forward_x11)
debug("X11 forwarding requested but DISPLAY not set");
if (options.forward_x11 && display != NULL) {
char *proto, *data;
/* Get reasonable local authentication information. *
client_x11_get_proto(display, options.xauth_location,
options.forward_x11_trusted,
options.forward_x11_timeout,
&proto, &data);
/* Request forwarding with authentication spoofing. */
debug("Requesting X11 forwarding with authentication "
"spoofing.");
/* Request forwarding with authentication spoofing. */
debug("Requesting X11 forwarding with authentication "
"spoofing.");
x11_request_forwarding_with_spoofing(0, display, proto,
data, 0);
/* Read response from the server. */
type = packet_read();
if (type == SSH_SMSG_SUCCESS) {
interactive = 1;
} else if (type == SSH_SMSG_FAILURE) {
logit("Warning: Remote host denied X11 forwarding.");
} else {
packet_disconnect("Protocol error waiting for X11 "
"forwarding");
}
}
/* Tell the packet module whether this is an interactive session. */
packet_set_interactive(interactive,
options.ip_qos_interactive, options.ip_qos_bulk);
/* Request authentication agent forwarding if appropriate. */
check_agent_present();
if (options.forward_agent) {
debug("Requesting authentication agent forwarding.");
auth_request_forwarding();
/* Read response from the server. */
type = packet_read();
packet_check_eom();
if (type != SSH_SMSG_SUCCESS)
logit("Warning: Remote host denied authentication agent forwarding.");
}
/* Initiate port forwardings. */
ssh_init_stdio_forwarding();
ssh_init_forwarding();
/* Execute a local command */
if (options.local_command != NULL &&
options.permit_local_command)
ssh_local_cmd(options.local_command);
/*
* If requested and we are not interested in replies to remote
* forwarding requests, then let ssh continue in the background.
*/
if (fork_after_authentication_flag) {
if (options.exit_on_forward_failure &&
options.num_remote_forwards > 0) {
debug("deferring postauth fork until remote forward "
"confirmation received");
} else
fork_postauth();
}
/*
* If a command was specified on the command line, execute the
* command now. Otherwise request the server to start a shell.
*/
if (buffer_len(&command) > 0) {
int len = buffer_len(&command);
if (len > 900)
len = 900;
debug("Sending command: %.*s", len,
(u_char *)buffer_ptr(&command));
packet_start(SSH_CMSG_EXEC_CMD);
packet_put_string(buffer_ptr(&command), buffer_len(&command));
packet_send();
packet_write_wait();
} else {
debug("Requesting shell.");
packet_start(SSH_CMSG_EXEC_SHELL);
packet_send();
packet_write_wait();
}
/* Enter the interactive session. */
return client_loop(have_tty, tty_flag ?
options.escape_char : SSH_ESCAPECHAR_NONE, 0);
}
| 18,299 |
Subsets and Splits