idx
int64 | func
string | target
int64 |
|---|---|---|
193,147
|
void LockContentsView::Layout() {
View::Layout();
LayoutTopHeader();
LayoutPublicSessionView();
if (users_list_)
users_list_->Layout();
}
| 0
|
493,693
|
static void fuse_lib_release(fuse_req_t req, fuse_ino_t ino,
struct fuse_file_info *fi)
{
struct fuse *f = req_fuse_prepare(req);
struct fuse_intr_data d;
char *path;
int err = 0;
pthread_rwlock_rdlock(&f->tree_lock);
path = get_path(f, ino);
if (f->conf.debug)
fprintf(stderr, "RELEASE%s[%llu] flags: 0x%x\n",
fi->flush ? "+FLUSH" : "",
(unsigned long long) fi->fh, fi->flags);
if (fi->flush) {
err = fuse_flush_common(f, req, ino, path, fi);
if (err == -ENOSYS)
err = 0;
}
fuse_prepare_interrupt(f, req, &d);
fuse_do_release(f, ino, path, fi);
fuse_finish_interrupt(f, req, &d);
free(path);
pthread_rwlock_unlock(&f->tree_lock);
reply_err(req, err);
}
| 0
|
18,174
|
TSReturnCode TSMgmtIntCreate ( TSRecordType rec_type , const char * name , TSMgmtInt data_default , TSRecordUpdateType update_type , TSRecordCheckType check_type , const char * check_regex , TSRecordAccessType access_type ) {
if ( check_regex == nullptr && check_type != TS_RECORDCHECK_NULL ) {
return TS_ERROR ;
}
if ( REC_ERR_OKAY != RecRegisterConfigInt ( ( enum RecT ) rec_type , name , ( RecInt ) data_default , ( enum RecUpdateT ) update_type , ( enum RecCheckT ) check_type , check_regex , REC_SOURCE_PLUGIN , ( enum RecAccessT ) access_type ) ) {
return TS_ERROR ;
}
return TS_SUCCESS ;
}
| 0
|
363,486
|
on_saved_language_name_read (GdmSessionWorker *worker)
{
char *language_name;
language_name = gdm_session_settings_get_language_name (worker->priv->user_settings);
send_dbus_string_method (worker->priv->connection,
"SavedLanguageNameRead",
language_name);
g_free (language_name);
}
| 0
|
144,960
|
int generic_readlink(struct dentry *dentry, char __user *buffer, int buflen)
{
struct nameidata nd;
void *cookie;
int res;
nd.depth = 0;
cookie = dentry->d_inode->i_op->follow_link(dentry, &nd);
if (IS_ERR(cookie))
return PTR_ERR(cookie);
res = readlink_copy(buffer, buflen, nd_get_link(&nd));
if (dentry->d_inode->i_op->put_link)
dentry->d_inode->i_op->put_link(dentry, &nd, cookie);
return res;
}
| 0
|
469,047
|
set_session_enable(cmd_parms * parms, void *dconf, int flag)
{
session_dir_conf *conf = dconf;
conf->enabled = flag;
conf->enabled_set = 1;
return NULL;
}
| 0
|
112,932
|
static atomic_t *load_sipi_vector(struct mp_params *mp_params)
{
struct rmodule sipi_mod;
int module_size;
int num_msrs;
struct sipi_params *sp;
char *mod_loc = (void *)sipi_vector_location;
const int loc_size = sipi_vector_location_size;
atomic_t *ap_count = NULL;
if (rmodule_parse(&_binary_sipi_vector_start, &sipi_mod)) {
printk(BIOS_CRIT, "Unable to parse sipi module.\n");
return ap_count;
}
if (rmodule_entry_offset(&sipi_mod) != 0) {
printk(BIOS_CRIT, "SIPI module entry offset is not 0!\n");
return ap_count;
}
if (rmodule_load_alignment(&sipi_mod) != 4096) {
printk(BIOS_CRIT, "SIPI module load alignment(%d) != 4096.\n",
rmodule_load_alignment(&sipi_mod));
return ap_count;
}
module_size = rmodule_memory_size(&sipi_mod);
/* Align to 4 bytes. */
module_size = ALIGN_UP(module_size, 4);
if (module_size > loc_size) {
printk(BIOS_CRIT, "SIPI module size (%d) > region size (%d).\n",
module_size, loc_size);
return ap_count;
}
num_msrs = save_bsp_msrs(&mod_loc[module_size], loc_size - module_size);
if (num_msrs < 0) {
printk(BIOS_CRIT, "Error mirroring BSP's msrs.\n");
return ap_count;
}
if (rmodule_load(mod_loc, &sipi_mod)) {
printk(BIOS_CRIT, "Unable to load SIPI module.\n");
return ap_count;
}
sp = rmodule_parameters(&sipi_mod);
if (sp == NULL) {
printk(BIOS_CRIT, "SIPI module has no parameters.\n");
return ap_count;
}
setup_default_sipi_vector_params(sp);
/* Setup MSR table. */
sp->msr_table_ptr = (uint32_t)&mod_loc[module_size];
sp->msr_count = num_msrs;
/* Provide pointer to microcode patch. */
sp->microcode_ptr = (uint32_t)mp_params->microcode_pointer;
/* Pass on ability to load microcode in parallel. */
if (mp_params->parallel_microcode_load)
sp->microcode_lock = 0;
else
sp->microcode_lock = ~0;
sp->c_handler = (uint32_t)&ap_init;
ap_count = &sp->ap_count;
atomic_set(ap_count, 0);
return ap_count;
}
| 0
|
80,395
|
db_dict_field_find(const char *data, void *context,
const char **value_r,
const char **error_r ATTR_UNUSED)
{
struct db_dict_value_iter *iter = context;
struct db_dict_iter_key *key;
const char *name, *value, *dotname = strchr(data, '.');
string_t *tmpstr;
*value_r = NULL;
if (dotname != NULL)
data = t_strdup_until(data, dotname++);
key = db_dict_iter_find_key(iter, data);
if (key == NULL)
return 1;
switch (key->key->parsed_format) {
case DB_DICT_VALUE_FORMAT_VALUE:
*value_r = dotname != NULL ? NULL :
(key->value == NULL ? "" : key->value);
return 1;
case DB_DICT_VALUE_FORMAT_JSON:
if (dotname == NULL)
return 1;
db_dict_value_iter_json_init(iter, key->value);
*value_r = "";
tmpstr = t_str_new(64);
while (db_dict_value_iter_json_next(iter, tmpstr, &name, &value)) {
if (strcmp(name, dotname) == 0) {
*value_r = t_strdup(value);
break;
}
}
(void)json_parser_deinit(&iter->json_parser, &iter->error);
return 1;
}
i_unreached();
}
| 0
|
120,914
|
void __weak module_arch_cleanup(struct module *mod)
{
}
| 0
|
212,590
|
bool BackendImpl::CreateBackingStore(disk_cache::File* file) {
AdjustMaxCacheSize(0);
IndexHeader header;
header.table_len = DesiredIndexTableLen(max_size_);
if (new_eviction_)
header.version = 0x20001;
header.create_time = Time::Now().ToInternalValue();
if (!file->Write(&header, sizeof(header), 0))
return false;
return file->SetLength(GetIndexSize(header.table_len));
}
| 0
|
283,233
|
void WebPageProxy::countStringMatches(const String& string, FindOptions options, unsigned maxMatchCount)
{
process()->send(Messages::WebPage::CountStringMatches(string, options, maxMatchCount), m_pageID);
}
| 0
|
68,942
|
int udpv6_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
int noblock, int flags, int *addr_len)
{
struct ipv6_pinfo *np = inet6_sk(sk);
struct inet_sock *inet = inet_sk(sk);
struct sk_buff *skb;
unsigned int ulen, copied;
int peeked, off = 0;
int err;
int is_udplite = IS_UDPLITE(sk);
bool checksum_valid = false;
int is_udp4;
bool slow;
if (flags & MSG_ERRQUEUE)
return ipv6_recv_error(sk, msg, len, addr_len);
if (np->rxpmtu && np->rxopt.bits.rxpmtu)
return ipv6_recv_rxpmtu(sk, msg, len, addr_len);
try_again:
skb = __skb_recv_datagram(sk, flags | (noblock ? MSG_DONTWAIT : 0),
&peeked, &off, &err);
if (!skb)
goto out;
ulen = skb->len - sizeof(struct udphdr);
copied = len;
if (copied > ulen)
copied = ulen;
else if (copied < ulen)
msg->msg_flags |= MSG_TRUNC;
is_udp4 = (skb->protocol == htons(ETH_P_IP));
/*
* If checksum is needed at all, try to do it while copying the
* data. If the data is truncated, or if we only want a partial
* coverage checksum (UDP-Lite), do it before the copy.
*/
if (copied < ulen || UDP_SKB_CB(skb)->partial_cov) {
checksum_valid = !udp_lib_checksum_complete(skb);
if (!checksum_valid)
goto csum_copy_err;
}
if (checksum_valid || skb_csum_unnecessary(skb))
err = skb_copy_datagram_msg(skb, sizeof(struct udphdr),
msg, copied);
else {
err = skb_copy_and_csum_datagram_msg(skb, sizeof(struct udphdr), msg);
if (err == -EINVAL)
goto csum_copy_err;
}
if (unlikely(err)) {
trace_kfree_skb(skb, udpv6_recvmsg);
if (!peeked) {
atomic_inc(&sk->sk_drops);
if (is_udp4)
UDP_INC_STATS_USER(sock_net(sk),
UDP_MIB_INERRORS,
is_udplite);
else
UDP6_INC_STATS_USER(sock_net(sk),
UDP_MIB_INERRORS,
is_udplite);
}
goto out_free;
}
if (!peeked) {
if (is_udp4)
UDP_INC_STATS_USER(sock_net(sk),
UDP_MIB_INDATAGRAMS, is_udplite);
else
UDP6_INC_STATS_USER(sock_net(sk),
UDP_MIB_INDATAGRAMS, is_udplite);
}
sock_recv_ts_and_drops(msg, sk, skb);
/* Copy the address. */
if (msg->msg_name) {
DECLARE_SOCKADDR(struct sockaddr_in6 *, sin6, msg->msg_name);
sin6->sin6_family = AF_INET6;
sin6->sin6_port = udp_hdr(skb)->source;
sin6->sin6_flowinfo = 0;
if (is_udp4) {
ipv6_addr_set_v4mapped(ip_hdr(skb)->saddr,
&sin6->sin6_addr);
sin6->sin6_scope_id = 0;
} else {
sin6->sin6_addr = ipv6_hdr(skb)->saddr;
sin6->sin6_scope_id =
ipv6_iface_scope_id(&sin6->sin6_addr,
inet6_iif(skb));
}
*addr_len = sizeof(*sin6);
}
if (np->rxopt.all)
ip6_datagram_recv_common_ctl(sk, msg, skb);
if (is_udp4) {
if (inet->cmsg_flags)
ip_cmsg_recv(msg, skb);
} else {
if (np->rxopt.all)
ip6_datagram_recv_specific_ctl(sk, msg, skb);
}
err = copied;
if (flags & MSG_TRUNC)
err = ulen;
out_free:
skb_free_datagram_locked(sk, skb);
out:
return err;
csum_copy_err:
slow = lock_sock_fast(sk);
if (!skb_kill_datagram(sk, skb, flags)) {
if (is_udp4) {
UDP_INC_STATS_USER(sock_net(sk),
UDP_MIB_CSUMERRORS, is_udplite);
UDP_INC_STATS_USER(sock_net(sk),
UDP_MIB_INERRORS, is_udplite);
} else {
UDP6_INC_STATS_USER(sock_net(sk),
UDP_MIB_CSUMERRORS, is_udplite);
UDP6_INC_STATS_USER(sock_net(sk),
UDP_MIB_INERRORS, is_udplite);
}
}
unlock_sock_fast(sk, slow);
/* starting over for a new packet, but check if we need to yield */
cond_resched();
msg->msg_flags &= ~MSG_TRUNC;
goto try_again;
}
| 0
|
217,910
|
gst_qtdemux_do_seek (GstQTDemux * qtdemux, GstPad * pad, GstEvent * event)
{
gdouble rate;
GstFormat format;
GstSeekFlags flags;
GstSeekType cur_type, stop_type;
gint64 cur, stop;
gboolean flush;
gboolean res;
gboolean update;
GstSegment seeksegment;
int i;
if (event) {
GST_DEBUG_OBJECT (qtdemux, "doing seek with event");
gst_event_parse_seek (event, &rate, &format, &flags,
&cur_type, &cur, &stop_type, &stop);
/* we have to have a format as the segment format. Try to convert
* if not. */
if (format != GST_FORMAT_TIME) {
GstFormat fmt;
fmt = GST_FORMAT_TIME;
res = TRUE;
if (cur_type != GST_SEEK_TYPE_NONE)
res = gst_pad_query_convert (pad, format, cur, &fmt, &cur);
if (res && stop_type != GST_SEEK_TYPE_NONE)
res = gst_pad_query_convert (pad, format, stop, &fmt, &stop);
if (!res)
goto no_format;
format = fmt;
}
} else {
GST_DEBUG_OBJECT (qtdemux, "doing seek without event");
flags = 0;
}
flush = flags & GST_SEEK_FLAG_FLUSH;
GST_DEBUG_OBJECT (qtdemux, "seek format %d", format);
/* stop streaming, either by flushing or by pausing the task */
if (flush) {
/* unlock upstream pull_range */
gst_pad_push_event (qtdemux->sinkpad, gst_event_new_flush_start ());
/* make sure out loop function exits */
gst_qtdemux_push_event (qtdemux, gst_event_new_flush_start ());
} else {
/* non flushing seek, pause the task */
gst_pad_pause_task (qtdemux->sinkpad);
}
/* wait for streaming to finish */
GST_PAD_STREAM_LOCK (qtdemux->sinkpad);
/* copy segment, we need this because we still need the old
* segment when we close the current segment. */
memcpy (&seeksegment, &qtdemux->segment, sizeof (GstSegment));
if (event) {
/* configure the segment with the seek variables */
GST_DEBUG_OBJECT (qtdemux, "configuring seek");
gst_segment_set_seek (&seeksegment, rate, format, flags,
cur_type, cur, stop_type, stop, &update);
}
/* now do the seek, this actually never returns FALSE */
res = gst_qtdemux_perform_seek (qtdemux, &seeksegment);
/* prepare for streaming again */
if (flush) {
gst_pad_push_event (qtdemux->sinkpad, gst_event_new_flush_stop ());
gst_qtdemux_push_event (qtdemux, gst_event_new_flush_stop ());
} else if (qtdemux->segment_running) {
/* we are running the current segment and doing a non-flushing seek,
* close the segment first based on the last_stop. */
GST_DEBUG_OBJECT (qtdemux, "closing running segment %" G_GINT64_FORMAT
" to %" G_GINT64_FORMAT, qtdemux->segment.start,
qtdemux->segment.last_stop);
if (qtdemux->segment.rate >= 0) {
/* FIXME, rate is the product of the global rate and the (quicktime)
* segment rate. */
qtdemux->pending_newsegment = gst_event_new_new_segment (TRUE,
qtdemux->segment.rate, qtdemux->segment.format,
qtdemux->segment.start, qtdemux->segment.last_stop,
qtdemux->segment.time);
} else { /* For Reverse Playback */
guint64 stop;
if ((stop = qtdemux->segment.stop) == -1)
stop = qtdemux->segment.duration;
/* for reverse playback, we played from stop to last_stop. */
qtdemux->pending_newsegment = gst_event_new_new_segment (TRUE,
qtdemux->segment.rate, qtdemux->segment.format,
qtdemux->segment.last_stop, stop, qtdemux->segment.last_stop);
}
}
/* commit the new segment */
memcpy (&qtdemux->segment, &seeksegment, sizeof (GstSegment));
if (qtdemux->segment.flags & GST_SEEK_FLAG_SEGMENT) {
gst_element_post_message (GST_ELEMENT_CAST (qtdemux),
gst_message_new_segment_start (GST_OBJECT_CAST (qtdemux),
qtdemux->segment.format, qtdemux->segment.last_stop));
}
/* restart streaming, NEWSEGMENT will be sent from the streaming
* thread. */
qtdemux->segment_running = TRUE;
for (i = 0; i < qtdemux->n_streams; i++)
qtdemux->streams[i]->last_ret = GST_FLOW_OK;
gst_pad_start_task (qtdemux->sinkpad, (GstTaskFunction) gst_qtdemux_loop,
qtdemux->sinkpad);
GST_PAD_STREAM_UNLOCK (qtdemux->sinkpad);
return TRUE;
/* ERRORS */
no_format:
{
GST_DEBUG_OBJECT (qtdemux, "unsupported format given, seek aborted.");
return FALSE;
}
}
| 0
|
194,838
|
int FileTransfer::InvokeFileTransferPlugin(CondorError &e, const char* source, const char* dest, const char* proxy_filename) {
if (plugin_table == NULL) {
dprintf(D_FULLDEBUG, "FILETRANSFER: No plugin table defined! (request was %s)\n", source);
e.pushf("FILETRANSFER", 1, "No plugin table defined (request was %s)", source);
return GET_FILE_PLUGIN_FAILED;
}
char *URL = NULL;
if(IsUrl(dest)) {
URL = const_cast<char*>(dest);
dprintf(D_FULLDEBUG, "FILETRANSFER: using destination to determine plugin type: %s\n", dest);
} else {
URL = const_cast<char*>(source);
dprintf(D_FULLDEBUG, "FILETRANSFER: using source to determine plugin type: %s\n", source);
}
const char* colon = strchr(URL, ':');
if (!colon) {
e.pushf("FILETRANSFER", 1, "Specified URL does not contain a ':' (%s)", URL);
return GET_FILE_PLUGIN_FAILED;
}
char* method = (char*) malloc(1 + (colon-URL));
strncpy(method, URL, (colon-URL));
method[(colon-URL)] = '\0';
MyString plugin;
if (plugin_table->lookup((MyString)method, plugin)) {
e.pushf("FILETRANSFER", 1, "FILETRANSFER: plugin for type %s not found!", method);
dprintf (D_FULLDEBUG, "FILETRANSFER: plugin for type %s not found!\n", method);
free(method);
return GET_FILE_PLUGIN_FAILED;
}
/*
if (absolute_path_check() ) {
dprintf(D_ALWAYS, "FILETRANSFER: NOT invoking malformed plugin named \"%s\"\n", plugin.Value());
FAIL();
}
*/
Env plugin_env;
plugin_env.Import();
if (proxy_filename && *proxy_filename) {
plugin_env.SetEnv("X509_USER_PROXY",proxy_filename);
dprintf(D_FULLDEBUG, "FILETRANSFER: setting X509_USER_PROXY env to %s\n", proxy_filename);
}
ArgList plugin_args;
plugin_args.AppendArg(plugin.Value());
plugin_args.AppendArg(source);
plugin_args.AppendArg(dest);
dprintf(D_FULLDEBUG, "FILETRANSFER: invoking: %s %s %s\n", plugin.Value(), source, dest);
FILE* plugin_pipe = my_popen(plugin_args, "r", FALSE, &plugin_env);
int plugin_status = my_pclose(plugin_pipe);
dprintf (D_ALWAYS, "FILETRANSFER: plugin returned %i\n", plugin_status);
free(method);
if (plugin_status != 0) {
e.pushf("FILETRANSFER", 1, "non-zero exit(%i) from %s\n", plugin_status, plugin.Value());
return GET_FILE_PLUGIN_FAILED;
}
return 0;
}
| 0
|
125,820
|
static int _recursive_rmdir(char *dirname, dev_t pdev,
const char *exclude, int level, bool onedev)
{
struct dirent dirent, *direntp;
DIR *dir;
int ret, failed=0;
char pathname[MAXPATHLEN];
bool hadexclude = false;
dir = opendir(dirname);
if (!dir) {
ERROR("%s: failed to open %s", __func__, dirname);
return -1;
}
while (!readdir_r(dir, &dirent, &direntp)) {
struct stat mystat;
int rc;
if (!direntp)
break;
if (!strcmp(direntp->d_name, ".") ||
!strcmp(direntp->d_name, ".."))
continue;
rc = snprintf(pathname, MAXPATHLEN, "%s/%s", dirname, direntp->d_name);
if (rc < 0 || rc >= MAXPATHLEN) {
ERROR("pathname too long");
failed=1;
continue;
}
if (!level && exclude && !strcmp(direntp->d_name, exclude)) {
ret = rmdir(pathname);
if (ret < 0) {
switch(errno) {
case ENOTEMPTY:
INFO("Not deleting snapshot %s", pathname);
hadexclude = true;
break;
case ENOTDIR:
ret = unlink(pathname);
if (ret)
INFO("%s: failed to remove %s", __func__, pathname);
break;
default:
SYSERROR("%s: failed to rmdir %s", __func__, pathname);
failed = 1;
break;
}
}
continue;
}
ret = lstat(pathname, &mystat);
if (ret) {
ERROR("%s: failed to stat %s", __func__, pathname);
failed = 1;
continue;
}
if (onedev && mystat.st_dev != pdev) {
/* TODO should we be checking /proc/self/mountinfo for
* pathname and not doing this if found? */
if (btrfs_try_remove_subvol(pathname))
INFO("Removed btrfs subvolume at %s\n", pathname);
continue;
}
if (S_ISDIR(mystat.st_mode)) {
if (_recursive_rmdir(pathname, pdev, exclude, level+1, onedev) < 0)
failed=1;
} else {
if (unlink(pathname) < 0) {
SYSERROR("%s: failed to delete %s", __func__, pathname);
failed=1;
}
}
}
if (rmdir(dirname) < 0 && !btrfs_try_remove_subvol(dirname) && !hadexclude) {
ERROR("%s: failed to delete %s", __func__, dirname);
failed=1;
}
ret = closedir(dir);
if (ret) {
ERROR("%s: failed to close directory %s", __func__, dirname);
failed=1;
}
return failed ? -1 : 0;
}
| 0
|
42,611
|
static void explainIndexRange(StrAccum *pStr, WhereLoop *pLoop){
Index *pIndex = pLoop->u.btree.pIndex;
u16 nEq = pLoop->u.btree.nEq;
u16 nSkip = pLoop->nSkip;
int i, j;
if( nEq==0 && (pLoop->wsFlags&(WHERE_BTM_LIMIT|WHERE_TOP_LIMIT))==0 ) return;
sqlite3_str_append(pStr, " (", 2);
for(i=0; i<nEq; i++){
const char *z = explainIndexColumnName(pIndex, i);
if( i ) sqlite3_str_append(pStr, " AND ", 5);
sqlite3_str_appendf(pStr, i>=nSkip ? "%s=?" : "ANY(%s)", z);
}
j = i;
if( pLoop->wsFlags&WHERE_BTM_LIMIT ){
explainAppendTerm(pStr, pIndex, pLoop->u.btree.nBtm, j, i, ">");
i = 1;
}
if( pLoop->wsFlags&WHERE_TOP_LIMIT ){
explainAppendTerm(pStr, pIndex, pLoop->u.btree.nTop, j, i, "<");
}
sqlite3_str_append(pStr, ")", 1);
}
| 0
|
431,210
|
bool isAuthzCollection(StringData coll) {
return (coll == AuthorizationManager::rolesCollectionNamespace.coll() ||
coll == AuthorizationManager::usersCollectionNamespace.coll() ||
coll == AuthorizationManager::versionCollectionNamespace.coll());
}
| 0
|
414,099
|
func_exists (struct _ESExp *f,
gint argc,
struct _ESExpResult **argv,
gpointer data)
{
EBookBackendLDAPSExpData *ldap_data = data;
ESExpResult *r;
if (argc == 1
&& argv[0]->type == ESEXP_RES_STRING) {
gchar *propname = argv[0]->value.string;
if (!strcmp (propname, "x-evolution-any-field")) {
gint i;
GString *big_query;
gchar *match_str;
match_str = g_strdup ("=*)");
big_query = g_string_sized_new (G_N_ELEMENTS (prop_info) * 7);
g_string_append (big_query, "(|");
for (i = 0; i < G_N_ELEMENTS (prop_info); i++) {
if (!(prop_info[i].prop_type & PROP_WRITE_ONLY) &&
(ldap_data->bl->priv->evolutionPersonSupported ||
!(prop_info[i].prop_type & PROP_EVOLVE)) &&
(ldap_data->bl->priv->calEntrySupported ||
!(prop_info[i].prop_type & PROP_CALENTRY))) {
g_string_append (big_query, "(");
g_string_append (big_query, prop_info[i].ldap_attr);
g_string_append (big_query, match_str);
}
}
g_string_append (big_query, ")");
ldap_data->list = g_list_prepend (ldap_data->list, g_string_free (big_query, FALSE));
g_free (match_str);
}
else {
const gchar *ldap_attr = query_prop_to_ldap (propname, ldap_data->bl->priv->evolutionPersonSupported, ldap_data->bl->priv->calEntrySupported);
if (ldap_attr)
ldap_data->list = g_list_prepend (
ldap_data->list,
g_strdup_printf (
"(%s=*)", ldap_attr));
}
}
r = e_sexp_result_new (f, ESEXP_RES_BOOL);
r->value.boolean = FALSE;
return r;
}
| 0
|
347,885
|
nf_ct_frag6_reasm(struct frag_queue *fq, struct sk_buff *prev, struct net_device *dev)
{
struct sk_buff *fp, *head = fq->q.fragments;
int payload_len;
u8 ecn;
inet_frag_kill(&fq->q);
WARN_ON(head == NULL);
WARN_ON(head->ip_defrag_offset != 0);
ecn = ip_frag_ecn_table[fq->ecn];
if (unlikely(ecn == 0xff))
return false;
/* Unfragmented part is taken from the first segment. */
payload_len = ((head->data - skb_network_header(head)) -
sizeof(struct ipv6hdr) + fq->q.len -
sizeof(struct frag_hdr));
if (payload_len > IPV6_MAXPLEN) {
net_dbg_ratelimited("nf_ct_frag6_reasm: payload len = %d\n",
payload_len);
return false;
}
/* Head of list must not be cloned. */
if (skb_unclone(head, GFP_ATOMIC))
return false;
/* If the first fragment is fragmented itself, we split
* it to two chunks: the first with data and paged part
* and the second, holding only fragments. */
if (skb_has_frag_list(head)) {
struct sk_buff *clone;
int i, plen = 0;
clone = alloc_skb(0, GFP_ATOMIC);
if (clone == NULL)
return false;
clone->next = head->next;
head->next = clone;
skb_shinfo(clone)->frag_list = skb_shinfo(head)->frag_list;
skb_frag_list_init(head);
for (i = 0; i < skb_shinfo(head)->nr_frags; i++)
plen += skb_frag_size(&skb_shinfo(head)->frags[i]);
clone->len = clone->data_len = head->data_len - plen;
head->data_len -= clone->len;
head->len -= clone->len;
clone->csum = 0;
clone->ip_summed = head->ip_summed;
add_frag_mem_limit(fq->q.net, clone->truesize);
}
/* morph head into last received skb: prev.
*
* This allows callers of ipv6 conntrack defrag to continue
* to use the last skb(frag) passed into the reasm engine.
* The last skb frag 'silently' turns into the full reassembled skb.
*
* Since prev is also part of q->fragments we have to clone it first.
*/
if (head != prev) {
struct sk_buff *iter;
fp = skb_clone(prev, GFP_ATOMIC);
if (!fp)
return false;
fp->next = prev->next;
iter = head;
while (iter) {
if (iter->next == prev) {
iter->next = fp;
break;
}
iter = iter->next;
}
skb_morph(prev, head);
prev->next = head->next;
consume_skb(head);
head = prev;
}
/* We have to remove fragment header from datagram and to relocate
* header in order to calculate ICV correctly. */
skb_network_header(head)[fq->nhoffset] = skb_transport_header(head)[0];
memmove(head->head + sizeof(struct frag_hdr), head->head,
(head->data - head->head) - sizeof(struct frag_hdr));
head->mac_header += sizeof(struct frag_hdr);
head->network_header += sizeof(struct frag_hdr);
skb_shinfo(head)->frag_list = head->next;
skb_reset_transport_header(head);
skb_push(head, head->data - skb_network_header(head));
for (fp = head->next; fp; fp = fp->next) {
head->data_len += fp->len;
head->len += fp->len;
if (head->ip_summed != fp->ip_summed)
head->ip_summed = CHECKSUM_NONE;
else if (head->ip_summed == CHECKSUM_COMPLETE)
head->csum = csum_add(head->csum, fp->csum);
head->truesize += fp->truesize;
}
sub_frag_mem_limit(fq->q.net, head->truesize);
head->ignore_df = 1;
head->next = NULL;
head->dev = dev;
head->tstamp = fq->q.stamp;
ipv6_hdr(head)->payload_len = htons(payload_len);
ipv6_change_dsfield(ipv6_hdr(head), 0xff, ecn);
IP6CB(head)->frag_max_size = sizeof(struct ipv6hdr) + fq->q.max_size;
/* Yes, and fold redundant checksum back. 8) */
if (head->ip_summed == CHECKSUM_COMPLETE)
head->csum = csum_partial(skb_network_header(head),
skb_network_header_len(head),
head->csum);
fq->q.fragments = NULL;
fq->q.rb_fragments = RB_ROOT;
fq->q.fragments_tail = NULL;
return true;
}
| 1
|
218,844
|
AccessibilityRole AXNodeObject::nativeAccessibilityRoleIgnoringAria() const {
if (!getNode())
return UnknownRole;
if (getNode()->isLink())
return LinkRole;
if (isHTMLAnchorElement(*getNode())) {
if (isClickable())
return LinkRole;
return AnchorRole;
}
if (isHTMLButtonElement(*getNode()))
return buttonRoleType();
if (isHTMLDetailsElement(*getNode()))
return DetailsRole;
if (isHTMLSummaryElement(*getNode())) {
ContainerNode* parent = FlatTreeTraversal::parent(*getNode());
if (parent && isHTMLDetailsElement(parent))
return DisclosureTriangleRole;
return UnknownRole;
}
if (isHTMLInputElement(*getNode())) {
HTMLInputElement& input = toHTMLInputElement(*getNode());
const AtomicString& type = input.type();
if (input.dataList())
return ComboBoxRole;
if (type == InputTypeNames::button) {
if ((getNode()->parentNode() &&
isHTMLMenuElement(getNode()->parentNode())) ||
(parentObject() && parentObject()->roleValue() == MenuRole))
return MenuItemRole;
return buttonRoleType();
}
if (type == InputTypeNames::checkbox) {
if ((getNode()->parentNode() &&
isHTMLMenuElement(getNode()->parentNode())) ||
(parentObject() && parentObject()->roleValue() == MenuRole))
return MenuItemCheckBoxRole;
return CheckBoxRole;
}
if (type == InputTypeNames::date)
return DateRole;
if (type == InputTypeNames::datetime ||
type == InputTypeNames::datetime_local ||
type == InputTypeNames::month || type == InputTypeNames::week)
return DateTimeRole;
if (type == InputTypeNames::file)
return ButtonRole;
if (type == InputTypeNames::radio) {
if ((getNode()->parentNode() &&
isHTMLMenuElement(getNode()->parentNode())) ||
(parentObject() && parentObject()->roleValue() == MenuRole))
return MenuItemRadioRole;
return RadioButtonRole;
}
if (type == InputTypeNames::number)
return SpinButtonRole;
if (input.isTextButton())
return buttonRoleType();
if (type == InputTypeNames::range)
return SliderRole;
if (type == InputTypeNames::color)
return ColorWellRole;
if (type == InputTypeNames::time)
return InputTimeRole;
return TextFieldRole;
}
if (isHTMLSelectElement(*getNode())) {
HTMLSelectElement& selectElement = toHTMLSelectElement(*getNode());
return selectElement.isMultiple() ? ListBoxRole : PopUpButtonRole;
}
if (isHTMLTextAreaElement(*getNode()))
return TextFieldRole;
if (headingLevel())
return HeadingRole;
if (isHTMLDivElement(*getNode()))
return DivRole;
if (isHTMLMeterElement(*getNode()))
return MeterRole;
if (isHTMLOutputElement(*getNode()))
return StatusRole;
if (isHTMLParagraphElement(*getNode()))
return ParagraphRole;
if (isHTMLLabelElement(*getNode()))
return LabelRole;
if (isHTMLLegendElement(*getNode()))
return LegendRole;
if (isHTMLRubyElement(*getNode()))
return RubyRole;
if (isHTMLDListElement(*getNode()))
return DescriptionListRole;
if (isHTMLAudioElement(*getNode()))
return AudioRole;
if (isHTMLVideoElement(*getNode()))
return VideoRole;
if (getNode()->hasTagName(ddTag))
return DescriptionListDetailRole;
if (getNode()->hasTagName(dtTag))
return DescriptionListTermRole;
if (getNode()->nodeName() == "math")
return MathRole;
if (getNode()->hasTagName(rpTag) || getNode()->hasTagName(rtTag))
return AnnotationRole;
if (isHTMLFormElement(*getNode()))
return FormRole;
if (getNode()->hasTagName(abbrTag))
return AbbrRole;
if (getNode()->hasTagName(articleTag))
return ArticleRole;
if (getNode()->hasTagName(mainTag))
return MainRole;
if (getNode()->hasTagName(markTag))
return MarkRole;
if (getNode()->hasTagName(navTag))
return NavigationRole;
if (getNode()->hasTagName(asideTag))
return ComplementaryRole;
if (getNode()->hasTagName(preTag))
return PreRole;
if (getNode()->hasTagName(sectionTag))
return RegionRole;
if (getNode()->hasTagName(addressTag))
return ContentInfoRole;
if (isHTMLDialogElement(*getNode()))
return DialogRole;
if (isHTMLHtmlElement(*getNode()))
return IgnoredRole;
if (isHTMLIFrameElement(*getNode())) {
const AtomicString& ariaRole =
getAOMPropertyOrARIAAttribute(AOMStringProperty::kRole);
if (ariaRole == "none" || ariaRole == "presentation")
return IframePresentationalRole;
return IframeRole;
}
if (getNode()->hasTagName(headerTag)) {
if (isDescendantOfElementType(getLandmarkRolesNotAllowed()))
return GroupRole;
return BannerRole;
}
if (getNode()->hasTagName(footerTag)) {
if (isDescendantOfElementType(getLandmarkRolesNotAllowed()))
return GroupRole;
return FooterRole;
}
if (getNode()->hasTagName(blockquoteTag))
return BlockquoteRole;
if (getNode()->hasTagName(captionTag))
return CaptionRole;
if (getNode()->hasTagName(figcaptionTag))
return FigcaptionRole;
if (getNode()->hasTagName(figureTag))
return FigureRole;
if (getNode()->nodeName() == "TIME")
return TimeRole;
if (isEmbeddedObject())
return EmbeddedObjectRole;
if (isHTMLHRElement(*getNode()))
return SplitterRole;
if (isFieldset())
return GroupRole;
return UnknownRole;
}
| 0
|
160,106
|
ssize_t vb2_fop_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
struct video_device *vdev = video_devdata(file);
struct mutex *lock = vdev->queue->lock ? vdev->queue->lock : vdev->lock;
int err = -EBUSY;
if (!(vdev->queue->io_modes & VB2_WRITE))
return -EINVAL;
if (lock && mutex_lock_interruptible(lock))
return -ERESTARTSYS;
if (vb2_queue_is_busy(vdev, file))
goto exit;
err = vb2_write(vdev->queue, buf, count, ppos,
file->f_flags & O_NONBLOCK);
if (vdev->queue->fileio)
vdev->queue->owner = file->private_data;
exit:
if (lock)
mutex_unlock(lock);
return err;
}
| 0
|
236,987
|
void RenderFrameHostManager::CommitPending() {
TRACE_EVENT1("navigation", "RenderFrameHostManager::CommitPending",
"FrameTreeNode id", frame_tree_node_->frame_tree_node_id());
DCHECK(pending_render_frame_host_ || speculative_render_frame_host_);
bool is_main_frame = frame_tree_node_->IsMainFrame();
bool will_focus_location_bar =
is_main_frame && delegate_->FocusLocationBarByDefault();
bool focus_render_view = !will_focus_location_bar &&
render_frame_host_->GetView() &&
render_frame_host_->GetView()->HasFocus();
frame_tree_node_->ResetForNewProcess();
std::unique_ptr<RenderFrameHostImpl> old_render_frame_host;
if (!IsBrowserSideNavigationEnabled()) {
DCHECK(!speculative_render_frame_host_);
old_render_frame_host =
SetRenderFrameHost(std::move(pending_render_frame_host_));
} else {
DCHECK(speculative_render_frame_host_);
old_render_frame_host =
SetRenderFrameHost(std::move(speculative_render_frame_host_));
}
SkColor old_background_color = SK_ColorWHITE;
bool has_old_background_color = false;
if (old_render_frame_host->GetView()) {
has_old_background_color = true;
old_background_color = old_render_frame_host->GetView()->background_color();
}
bool new_rfh_has_view = !!render_frame_host_->GetView();
if (!delegate_->IsHidden() && new_rfh_has_view) {
render_frame_host_->GetView()->Show();
}
render_frame_host_->GetProcess()->RemovePendingView();
if (!new_rfh_has_view) {
DCHECK(!render_frame_host_->IsRenderFrameLive());
DCHECK(!render_frame_host_->render_view_host()->IsRenderViewLive());
render_frame_host_->ResetLoadingState();
delegate_->RenderProcessGoneFromRenderManager(
render_frame_host_->render_view_host());
}
if (is_main_frame &&
old_render_frame_host->render_view_host()->GetWidget()->GetView()) {
old_render_frame_host->render_view_host()->GetWidget()->GetView()->Hide();
}
delegate_->UpdateRenderViewSizeForRenderManager();
if (will_focus_location_bar) {
delegate_->SetFocusToLocationBar(false);
} else if (focus_render_view && render_frame_host_->GetView()) {
if (is_main_frame) {
render_frame_host_->GetView()->Focus();
} else {
frame_tree_node_->frame_tree()->SetPageFocus(
render_frame_host_->GetSiteInstance(), true);
}
}
delegate_->NotifySwappedFromRenderManager(
old_render_frame_host.get(), render_frame_host_.get(), is_main_frame);
if (has_old_background_color && render_frame_host_->GetView())
render_frame_host_->GetView()->SetBackgroundColor(old_background_color);
if (is_main_frame) {
RenderViewHostImpl* rvh = render_frame_host_->render_view_host();
rvh->set_main_frame_routing_id(render_frame_host_->routing_id());
if (!rvh->is_active())
rvh->PostRenderViewReady();
rvh->set_is_active(true);
rvh->set_is_swapped_out(false);
old_render_frame_host->render_view_host()->set_main_frame_routing_id(
MSG_ROUTING_NONE);
}
SwapOutOldFrame(std::move(old_render_frame_host));
DeleteRenderFrameProxyHost(render_frame_host_->GetSiteInstance());
RenderFrameProxyHost* proxy_to_parent = GetProxyToParent();
if (proxy_to_parent) {
CHECK(SiteIsolationPolicy::AreCrossProcessFramesPossible());
proxy_to_parent->SetChildRWHView(render_frame_host_->GetView());
}
CHECK(!GetRenderFrameProxyHost(render_frame_host_->GetSiteInstance()));
}
| 0
|
68,304
|
int scan_dir_tree(LOGBOOK *lbs, const char *dir, char **file_list, int *n) {
int index, n_files;
char str[MAX_PATH_LENGTH];
char *fl, *p;
fl = NULL;
n_files = ss_file_find(dir, "*", &fl);
if (n_files == 0) {
if (fl)
xfree(fl);
return 0;
}
if (*file_list == NULL)
*file_list = (char *) xmalloc(n_files * MAX_PATH_LENGTH);
else
*file_list = (char *) xrealloc(*file_list, ((*n) + n_files) * MAX_PATH_LENGTH);
/* go through all files */
for (index = 0; index < n_files; index++) {
if (fnmatch1("??????a.log", &fl[index * MAX_PATH_LENGTH]) == 0) {
p = *file_list + ((*n) * MAX_PATH_LENGTH);
strlcpy(p, dir, MAX_PATH_LENGTH);
if (p[strlen(p) - 1] != DIR_SEPARATOR)
strlcat(p, DIR_SEPARATOR_STR, MAX_PATH_LENGTH);
strlcat(p, fl + index * MAX_PATH_LENGTH, MAX_PATH_LENGTH);
(*n)++;
}
}
/* go through all sub-directories */
for (index = 0; index < n_files; index++) {
if (fnmatch1("????", &fl[index * MAX_PATH_LENGTH]) == 0 ||
fnmatch1("??", &fl[index * MAX_PATH_LENGTH]) == 0) {
if (strieq(fl + index * MAX_PATH_LENGTH, ".."))
continue;
strlcpy(str, dir, sizeof(str));
if (str[strlen(str) - 1] != DIR_SEPARATOR)
strlcat(str, DIR_SEPARATOR_STR, sizeof(str));
strlcat(str, fl + index * MAX_PATH_LENGTH, sizeof(str));
scan_dir_tree(lbs, str, file_list, n);
}
}
if (fl)
xfree(fl);
return *n;
}
| 0
|
39,856
|
static int linear_ioctl(struct dm_target *ti, unsigned int cmd,
unsigned long arg)
{
struct linear_c *lc = (struct linear_c *) ti->private;
struct dm_dev *dev = lc->dev;
int r = 0;
/*
* Only pass ioctls through if the device sizes match exactly.
*/
if (lc->start ||
ti->len != i_size_read(dev->bdev->bd_inode) >> SECTOR_SHIFT)
r = scsi_verify_blk_ioctl(NULL, cmd);
return r ? : __blkdev_driver_ioctl(dev->bdev, dev->mode, cmd, arg);
}
| 0
|
190,858
|
void ForwardRequestStatus(
RequestStatus status, net::URLRequest* request, void* profile_id) {
const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request);
if (!info)
return;
int process_id, render_view_id;
if (info->GetAssociatedRenderView(&process_id, &render_view_id)) {
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
base::Bind(&NotifyEPMRequestStatus,
status, profile_id, process_id, render_view_id));
}
}
| 0
|
43,255
|
static int compand_drain(AVFilterLink *outlink)
{
AVFilterContext *ctx = outlink->src;
CompandContext *s = ctx->priv;
const int channels = outlink->channels;
AVFrame *frame = NULL;
int chan, i, dindex;
/* 2048 is to limit output frame size during drain */
frame = ff_get_audio_buffer(outlink, FFMIN(2048, s->delay_count));
if (!frame)
return AVERROR(ENOMEM);
frame->pts = s->pts;
s->pts += av_rescale_q(frame->nb_samples,
(AVRational){ 1, outlink->sample_rate }, outlink->time_base);
for (chan = 0; chan < channels; chan++) {
AVFrame *delay_frame = s->delay_frame;
double *dbuf = (double *)delay_frame->extended_data[chan];
double *dst = (double *)frame->extended_data[chan];
ChanParam *cp = &s->channels[chan];
dindex = s->delay_index;
for (i = 0; i < frame->nb_samples; i++) {
dst[i] = av_clipd(dbuf[dindex] * get_volume(s, cp->volume),
-1, 1);
dindex = MOD(dindex + 1, s->delay_samples);
}
}
s->delay_count -= frame->nb_samples;
s->delay_index = dindex;
return ff_filter_frame(outlink, frame);
}
| 1
|
450,142
|
static inline size_t ctnetlink_timestamp_size(const struct nf_conn *ct)
{
#ifdef CONFIG_NF_CONNTRACK_TIMESTAMP
if (!nf_ct_ext_exist(ct, NF_CT_EXT_TSTAMP))
return 0;
return nla_total_size(0) + 2 * nla_total_size_64bit(sizeof(uint64_t));
#else
return 0;
#endif
}
| 0
|
215,967
|
static TriState StateStrikethrough(LocalFrame& frame, Event*) {
return StateStyle(frame, CSSPropertyWebkitTextDecorationsInEffect,
"line-through");
}
| 0
|
234,572
|
static void mptsas_interrupt_status_write(MPTSASState *s)
{
switch (s->doorbell_state) {
case DOORBELL_NONE:
case DOORBELL_WRITE:
s->intr_status &= ~MPI_HIS_DOORBELL_INTERRUPT;
break;
case DOORBELL_READ:
/* The reply can be read continuously, so leave the interrupt up. */
assert(s->intr_status & MPI_HIS_DOORBELL_INTERRUPT);
if (s->doorbell_reply_idx == s->doorbell_reply_size) {
s->doorbell_state = DOORBELL_NONE;
}
break;
default:
abort();
}
mptsas_update_interrupt(s);
}
| 0
|
68,484
|
armpmu_release_hardware(struct arm_pmu *armpmu)
{
int irq;
unsigned int i, irqs;
struct platform_device *pmu_device = armpmu->plat_device;
irqs = min(pmu_device->num_resources, num_possible_cpus());
if (!irqs)
return;
irq = platform_get_irq(pmu_device, 0);
if (irq <= 0)
return;
if (irq_is_percpu(irq)) {
on_each_cpu(armpmu_disable_percpu_irq, &irq, 1);
free_percpu_irq(irq, &cpu_hw_events);
} else {
for (i = 0; i < irqs; ++i) {
if (!cpumask_test_and_clear_cpu(i, &armpmu->active_irqs))
continue;
irq = platform_get_irq(pmu_device, i);
if (irq > 0)
free_irq(irq, armpmu);
}
}
}
| 0
|
311,282
|
static CompositeOperator PSDBlendModeToCompositeOperator(const char *mode)
{
if (mode == (const char *) NULL)
return(OverCompositeOp);
if (LocaleNCompare(mode,"norm",4) == 0)
return(OverCompositeOp);
if (LocaleNCompare(mode,"mul ",4) == 0)
return(MultiplyCompositeOp);
if (LocaleNCompare(mode,"diss",4) == 0)
return(DissolveCompositeOp);
if (LocaleNCompare(mode,"diff",4) == 0)
return(DifferenceCompositeOp);
if (LocaleNCompare(mode,"dark",4) == 0)
return(DarkenCompositeOp);
if (LocaleNCompare(mode,"lite",4) == 0)
return(LightenCompositeOp);
if (LocaleNCompare(mode,"hue ",4) == 0)
return(HueCompositeOp);
if (LocaleNCompare(mode,"sat ",4) == 0)
return(SaturateCompositeOp);
if (LocaleNCompare(mode,"colr",4) == 0)
return(ColorizeCompositeOp);
if (LocaleNCompare(mode,"lum ",4) == 0)
return(LuminizeCompositeOp);
if (LocaleNCompare(mode,"scrn",4) == 0)
return(ScreenCompositeOp);
if (LocaleNCompare(mode,"over",4) == 0)
return(OverlayCompositeOp);
if (LocaleNCompare(mode,"hLit",4) == 0)
return(HardLightCompositeOp);
if (LocaleNCompare(mode,"sLit",4) == 0)
return(SoftLightCompositeOp);
if (LocaleNCompare(mode,"smud",4) == 0)
return(ExclusionCompositeOp);
if (LocaleNCompare(mode,"div ",4) == 0)
return(ColorDodgeCompositeOp);
if (LocaleNCompare(mode,"idiv",4) == 0)
return(ColorBurnCompositeOp);
if (LocaleNCompare(mode,"lbrn",4) == 0)
return(LinearBurnCompositeOp);
if (LocaleNCompare(mode,"lddg",4) == 0)
return(LinearDodgeCompositeOp);
if (LocaleNCompare(mode,"lLit",4) == 0)
return(LinearLightCompositeOp);
if (LocaleNCompare(mode,"vLit",4) == 0)
return(VividLightCompositeOp);
if (LocaleNCompare(mode,"pLit",4) == 0)
return(PinLightCompositeOp);
if (LocaleNCompare(mode,"hMix",4) == 0)
return(HardMixCompositeOp);
return(OverCompositeOp);
}
| 0
|
196,746
|
tracing_saved_cmdlines_size_write(struct file *filp, const char __user *ubuf,
size_t cnt, loff_t *ppos)
{
unsigned long val;
int ret;
ret = kstrtoul_from_user(ubuf, cnt, 10, &val);
if (ret)
return ret;
/* must have at least 1 entry or less than PID_MAX_DEFAULT */
if (!val || val > PID_MAX_DEFAULT)
return -EINVAL;
ret = tracing_resize_saved_cmdlines((unsigned int)val);
if (ret < 0)
return ret;
*ppos += cnt;
return cnt;
}
| 0
|
516,180
|
int ssl_verify_cert_chain(SSL *s, STACK_OF(X509) *sk)
{
X509 *x;
int i = 0;
X509_STORE *verify_store;
X509_STORE_CTX *ctx = NULL;
X509_VERIFY_PARAM *param;
if ((sk == NULL) || (sk_X509_num(sk) == 0))
return 0;
if (s->cert->verify_store)
verify_store = s->cert->verify_store;
else
verify_store = s->ctx->cert_store;
ctx = X509_STORE_CTX_new_ex(s->ctx->libctx, s->ctx->propq);
if (ctx == NULL) {
ERR_raise(ERR_LIB_SSL, ERR_R_MALLOC_FAILURE);
return 0;
}
x = sk_X509_value(sk, 0);
if (!X509_STORE_CTX_init(ctx, verify_store, x, sk)) {
ERR_raise(ERR_LIB_SSL, ERR_R_X509_LIB);
goto end;
}
param = X509_STORE_CTX_get0_param(ctx);
/*
* XXX: Separate @AUTHSECLEVEL and @TLSSECLEVEL would be useful at some
* point, for now a single @SECLEVEL sets the same policy for TLS crypto
* and PKI authentication.
*/
X509_VERIFY_PARAM_set_auth_level(param, SSL_get_security_level(s));
/* Set suite B flags if needed */
X509_STORE_CTX_set_flags(ctx, tls1_suiteb(s));
if (!X509_STORE_CTX_set_ex_data
(ctx, SSL_get_ex_data_X509_STORE_CTX_idx(), s)) {
goto end;
}
/* Verify via DANE if enabled */
if (DANETLS_ENABLED(&s->dane))
X509_STORE_CTX_set0_dane(ctx, &s->dane);
/*
* We need to inherit the verify parameters. These can be determined by
* the context: if its a server it will verify SSL client certificates or
* vice versa.
*/
X509_STORE_CTX_set_default(ctx, s->server ? "ssl_client" : "ssl_server");
/*
* Anything non-default in "s->param" should overwrite anything in the ctx.
*/
X509_VERIFY_PARAM_set1(param, s->param);
if (s->verify_callback)
X509_STORE_CTX_set_verify_cb(ctx, s->verify_callback);
if (s->ctx->app_verify_callback != NULL) {
i = s->ctx->app_verify_callback(ctx, s->ctx->app_verify_arg);
} else {
i = X509_verify_cert(ctx);
/* We treat an error in the same way as a failure to verify */
if (i < 0)
i = 0;
}
s->verify_result = X509_STORE_CTX_get_error(ctx);
sk_X509_pop_free(s->verified_chain, X509_free);
s->verified_chain = NULL;
if (X509_STORE_CTX_get0_chain(ctx) != NULL) {
s->verified_chain = X509_STORE_CTX_get1_chain(ctx);
if (s->verified_chain == NULL) {
ERR_raise(ERR_LIB_SSL, ERR_R_MALLOC_FAILURE);
i = 0;
}
}
/* Move peername from the store context params to the SSL handle's */
X509_VERIFY_PARAM_move_peername(s->param, param);
end:
X509_STORE_CTX_free(ctx);
return i;
}
| 0
|
227,226
|
bool Textfield::Paste() {
if (!read_only() && model_->Paste()) {
if (controller_)
controller_->OnAfterPaste();
return true;
}
return false;
}
| 0
|
359,307
|
struct tc_action *tcf_action_init_1(struct rtattr *rta, struct rtattr *est,
char *name, int ovr, int bind, int *err)
{
struct tc_action *a;
struct tc_action_ops *a_o;
char act_name[IFNAMSIZ];
struct rtattr *tb[TCA_ACT_MAX+1];
struct rtattr *kind;
*err = -EINVAL;
if (name == NULL) {
if (rtattr_parse_nested(tb, TCA_ACT_MAX, rta) < 0)
goto err_out;
kind = tb[TCA_ACT_KIND-1];
if (kind == NULL)
goto err_out;
if (rtattr_strlcpy(act_name, kind, IFNAMSIZ) >= IFNAMSIZ)
goto err_out;
} else {
if (strlcpy(act_name, name, IFNAMSIZ) >= IFNAMSIZ)
goto err_out;
}
a_o = tc_lookup_action_n(act_name);
if (a_o == NULL) {
#ifdef CONFIG_KMOD
rtnl_unlock();
request_module(act_name);
rtnl_lock();
a_o = tc_lookup_action_n(act_name);
/* We dropped the RTNL semaphore in order to
* perform the module load. So, even if we
* succeeded in loading the module we have to
* tell the caller to replay the request. We
* indicate this using -EAGAIN.
*/
if (a_o != NULL) {
*err = -EAGAIN;
goto err_mod;
}
#endif
goto err_out;
}
*err = -ENOMEM;
a = kmalloc(sizeof(*a), GFP_KERNEL);
if (a == NULL)
goto err_mod;
memset(a, 0, sizeof(*a));
/* backward compatibility for policer */
if (name == NULL)
*err = a_o->init(tb[TCA_ACT_OPTIONS-1], est, a, ovr, bind);
else
*err = a_o->init(rta, est, a, ovr, bind);
if (*err < 0)
goto err_free;
/* module count goes up only when brand new policy is created
if it exists and is only bound to in a_o->init() then
ACT_P_CREATED is not returned (a zero is).
*/
if (*err != ACT_P_CREATED)
module_put(a_o->owner);
a->ops = a_o;
DPRINTK("tcf_action_init_1: successfull %s\n", act_name);
*err = 0;
return a;
err_free:
kfree(a);
err_mod:
module_put(a_o->owner);
err_out:
return NULL;
}
| 0
|
421,368
|
static inline bool eb_use_cmdparser(const struct i915_execbuffer *eb)
{
return intel_engine_needs_cmd_parser(eb->engine) && eb->batch_len;
}
| 0
|
17,029
|
static gint dissect_gatt_uuid ( proto_tree * tree , packet_info * pinfo , tvbuff_t * tvb , gint offset ) {
proto_item * sub_item ;
bluetooth_uuid_t sub_uuid ;
if ( tvb_reported_length_remaining ( tvb , offset ) == 2 ) {
proto_tree_add_item ( tree , hf_btatt_uuid16 , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
sub_uuid = get_uuid ( tvb , offset , 2 ) ;
offset += 2 ;
}
else if ( tvb_reported_length_remaining ( tvb , offset ) == 16 ) {
sub_item = proto_tree_add_item ( tree , hf_btatt_uuid128 , tvb , offset , 16 , ENC_NA ) ;
sub_uuid = get_uuid ( tvb , offset , 16 ) ;
proto_item_append_text ( sub_item , " (%s)" , print_uuid ( & sub_uuid ) ) ;
offset += 16 ;
}
else {
sub_item = proto_tree_add_item ( tree , hf_btatt_value , tvb , offset , - 1 , ENC_NA ) ;
expert_add_info ( pinfo , sub_item , & ei_btatt_bad_data ) ;
offset = tvb_captured_length ( tvb ) ;
}
return offset ;
}
| 0
|
319,483
|
static uint64_t qemu_rdma_make_wrid(uint64_t wr_id, uint64_t index,
uint64_t chunk)
{
uint64_t result = wr_id & RDMA_WRID_TYPE_MASK;
result |= (index << RDMA_WRID_BLOCK_SHIFT);
result |= (chunk << RDMA_WRID_CHUNK_SHIFT);
return result;
}
| 1
|
503,558
|
make_result(int16_t stream, messages::result_message& msg, const tracing::trace_state_ptr& tr_state,
cql_protocol_version_type version, bool skip_metadata) {
auto response = std::make_unique<cql_server::response>(stream, cql_binary_opcode::RESULT, tr_state);
if (__builtin_expect(!msg.warnings().empty() && version > 3, false)) {
response->set_frame_flag(cql_frame_flags::warning);
response->write_string_list(msg.warnings());
}
cql_server::fmt_visitor fmt{version, *response, skip_metadata};
msg.accept(fmt);
return response;
}
| 0
|
131,389
|
static int get_column_id(int num)
{
assert(num >= 0);
assert((size_t) num < ncolumns);
assert((size_t) columns[num] < ARRAY_SIZE(infos));
return columns[num];
}
| 0
|
80,379
|
ZipFile::ZipFile (InputSource* source) : inputSource (source)
{
init();
}
| 0
|
250,985
|
StateBase* serializeProperties(bool ignoreIndexed, Serializer& serializer)
{
while (m_index < m_propertyNames->Length()) {
if (!m_nameDone) {
v8::Local<v8::Value> propertyName = m_propertyNames->Get(m_index);
if (StateBase* newState = serializer.checkException(this))
return newState;
if (propertyName.IsEmpty())
return serializer.handleError(InputError, "Empty property names cannot be cloned.", this);
bool hasStringProperty = propertyName->IsString() && composite()->HasRealNamedProperty(propertyName.As<v8::String>());
if (StateBase* newState = serializer.checkException(this))
return newState;
bool hasIndexedProperty = !hasStringProperty && propertyName->IsUint32() && composite()->HasRealIndexedProperty(propertyName->Uint32Value());
if (StateBase* newState = serializer.checkException(this))
return newState;
if (hasStringProperty || (hasIndexedProperty && !ignoreIndexed)) {
m_propertyName = propertyName;
} else {
++m_index;
continue;
}
}
ASSERT(!m_propertyName.IsEmpty());
if (!m_nameDone) {
m_nameDone = true;
if (StateBase* newState = serializer.doSerialize(m_propertyName, this))
return newState;
}
v8::Local<v8::Value> value = composite()->Get(m_propertyName);
if (StateBase* newState = serializer.checkException(this))
return newState;
m_nameDone = false;
m_propertyName.Clear();
++m_index;
++m_numSerializedProperties;
if (StateBase* newState = serializer.doSerialize(value, this))
return newState;
}
return objectDone(m_numSerializedProperties, serializer);
}
| 0
|
57,987
|
_rdpdr_check_fds(fd_set * rfds, fd_set * wfds, RD_BOOL timed_out)
{
RD_NTSTATUS status;
uint32 result = 0;
DEVICE_FNS *fns;
struct async_iorequest *iorq;
struct async_iorequest *prev;
uint32 req_size = 0;
uint32 buffer_len;
struct stream out;
uint8 *buffer = NULL;
if (timed_out)
{
/* check serial iv_timeout */
iorq = g_iorequest;
prev = NULL;
while (iorq != NULL)
{
if (iorq->fd == g_min_timeout_fd)
{
if ((iorq->partial_len > 0) &&
(g_rdpdr_device[iorq->device].device_type ==
DEVICE_TYPE_SERIAL))
{
/* iv_timeout between 2 chars, send partial_len */
/*printf("RDPDR: IVT total %u bytes read of %u\n", iorq->partial_len, iorq->length); */
rdpdr_send_completion(iorq->device,
iorq->id, RD_STATUS_SUCCESS,
iorq->partial_len,
iorq->buffer, iorq->partial_len);
iorq = rdpdr_remove_iorequest(prev, iorq);
return;
}
else
{
break;
}
}
else
{
break;
}
prev = iorq;
if (iorq)
iorq = iorq->next;
}
rdpdr_abort_io(g_min_timeout_fd, 0, RD_STATUS_TIMEOUT);
return;
}
iorq = g_iorequest;
prev = NULL;
while (iorq != NULL)
{
if (iorq->fd != 0)
{
switch (iorq->major)
{
case IRP_MJ_READ:
if (FD_ISSET(iorq->fd, rfds))
{
/* Read the data */
fns = iorq->fns;
req_size =
(iorq->length - iorq->partial_len) >
8192 ? 8192 : (iorq->length -
iorq->partial_len);
/* never read larger chunks than 8k - chances are that it will block */
status = fns->read(iorq->fd,
iorq->buffer + iorq->partial_len,
req_size, iorq->offset, &result);
if ((long) result > 0)
{
iorq->partial_len += result;
iorq->offset += result;
}
logger(Protocol, Debug,
"_rdpdr_check_fds(), %d bytes of data read",
result);
/* only delete link if all data has been transfered */
/* or if result was 0 and status success - EOF */
if ((iorq->partial_len == iorq->length) ||
(result == 0))
{
logger(Protocol, Debug,
"_rdpdr_check_fds(), AIO total %u bytes read of %u",
iorq->partial_len, iorq->length);
rdpdr_send_completion(iorq->device,
iorq->id, status,
iorq->partial_len,
iorq->buffer,
iorq->partial_len);
iorq = rdpdr_remove_iorequest(prev, iorq);
}
}
break;
case IRP_MJ_WRITE:
if (FD_ISSET(iorq->fd, wfds))
{
/* Write data. */
fns = iorq->fns;
req_size =
(iorq->length - iorq->partial_len) >
8192 ? 8192 : (iorq->length -
iorq->partial_len);
/* never write larger chunks than 8k - chances are that it will block */
status = fns->write(iorq->fd,
iorq->buffer +
iorq->partial_len, req_size,
iorq->offset, &result);
if ((long) result > 0)
{
iorq->partial_len += result;
iorq->offset += result;
}
logger(Protocol, Debug,
"_rdpdr_check_fds(), %d bytes of data written",
result);
/* only delete link if all data has been transfered */
/* or we couldn't write */
if ((iorq->partial_len == iorq->length)
|| (result == 0))
{
logger(Protocol, Debug,
"_rdpdr_check_fds(), AIO total %u bytes written of %u",
iorq->partial_len, iorq->length);
rdpdr_send_completion(iorq->device,
iorq->id, status,
iorq->partial_len,
(uint8 *) "", 1);
iorq = rdpdr_remove_iorequest(prev, iorq);
}
}
break;
case IRP_MJ_DEVICE_CONTROL:
if (serial_get_event(iorq->fd, &result))
{
buffer = (uint8 *) xrealloc((void *) buffer, 0x14);
out.data = out.p = buffer;
out.size = sizeof(buffer);
out_uint32_le(&out, result);
result = buffer_len = out.p - out.data;
status = RD_STATUS_SUCCESS;
rdpdr_send_completion(iorq->device, iorq->id,
status, result, buffer,
buffer_len);
xfree(buffer);
iorq = rdpdr_remove_iorequest(prev, iorq);
}
break;
}
}
prev = iorq;
if (iorq)
iorq = iorq->next;
}
/* Check notify */
iorq = g_iorequest;
prev = NULL;
while (iorq != NULL)
{
if (iorq->fd != 0)
{
switch (iorq->major)
{
case IRP_MJ_DIRECTORY_CONTROL:
if (g_rdpdr_device[iorq->device].device_type ==
DEVICE_TYPE_DISK)
{
if (g_notify_stamp)
{
g_notify_stamp = False;
status = disk_check_notify(iorq->fd);
if (status != RD_STATUS_PENDING)
{
rdpdr_send_completion(iorq->device,
iorq->id,
status, 0,
NULL, 0);
iorq = rdpdr_remove_iorequest(prev,
iorq);
}
}
}
break;
}
}
prev = iorq;
if (iorq)
iorq = iorq->next;
}
}
| 0
|
71,766
|
void solo_lock_if_not_already() {
uint8_t buf[2048];
memmove(buf, (uint8_t*)ATTESTATION_PAGE_ADDR, 2048);
((flash_attestation_page *)buf)->device_settings |= SOLO_FLAG_LOCKED;
flash_erase_page(ATTESTATION_PAGE);
flash_write(ATTESTATION_PAGE_ADDR, buf, 2048);
}
| 0
|
452,172
|
int sc_pkcs15emu_gemsafeGPK_init_ex(sc_pkcs15_card_t *p15card, struct sc_aid *aid)
{
sc_card_t *card = p15card->card;
sc_context_t *ctx = card->ctx;
sc_log(ctx, "Entering %s", __FUNCTION__);
if (gemsafe_detect_card(p15card))
return SC_ERROR_WRONG_CARD;
return sc_pkcs15emu_gemsafeGPK_init(p15card);
}
| 0
|
422,699
|
convert_indexed_contact_property_to_updatexml_physical_address (ESoapMessage *message,
const gchar *name,
const gchar *uri_element,
const gchar *value,
const gchar *prefix,
const gchar *element_name,
const gchar *key)
{
gchar * fielduri = NULL;
gboolean delete_field = FALSE;
if (!value || g_strcmp0 (value, "") == 0)
delete_field = TRUE;
fielduri = g_strconcat (name, ":", uri_element, NULL);
e_ews_message_start_set_indexed_item_field (message, fielduri , prefix, "Contact", key, delete_field);
if (!delete_field)
{
e_soap_message_start_element (message, element_name, NULL, NULL);
e_soap_message_start_element (message, "Entry", NULL, NULL);
e_soap_message_add_attribute (message, "Key", key, NULL, NULL);
e_ews_message_write_string_parameter (message, uri_element, NULL, value);
e_soap_message_end_element (message);
e_soap_message_end_element (message);
}
e_ews_message_end_set_indexed_item_field (message, delete_field);
}
| 0
|
31,227
|
static int get_nick_length ( void * data ) {
return string_width ( ( ( NICK_REC * ) data ) -> nick , - 1 ) ;
}
| 0
|
133,655
|
void pipe_wait(struct pipe_inode_info *pipe)
{
DEFINE_WAIT(wait);
/*
* Pipes are system-local resources, so sleeping on them
* is considered a noninteractive wait:
*/
prepare_to_wait(&pipe->wait, &wait, TASK_INTERRUPTIBLE);
pipe_unlock(pipe);
schedule();
finish_wait(&pipe->wait, &wait);
pipe_lock(pipe);
}
| 0
|
112,475
|
PNET_BUFFER_LIST CNBL::DetachInternalObject()
{
// do it for both LsoV1 and LsoV2
if (IsLSO())
{
m_LsoInfo.LsoV1TransmitComplete.TcpPayload = m_TransferSize;
}
//Flush changes made in LSO structures
NET_BUFFER_LIST_INFO(m_NBL, TcpLargeSendNetBufferListInfo) = m_LsoInfo.Value;
auto Res = m_NBL;
m_NBL = nullptr;
return Res;
}
| 0
|
461,218
|
autoar_extractor_set_delete_after_extraction (AutoarExtractor *self,
gboolean delete_after_extraction)
{
g_return_if_fail (AUTOAR_IS_EXTRACTOR (self));
self->delete_after_extraction = delete_after_extraction;
}
| 0
|
295,045
|
int rsi_set_antenna(struct rsi_common *common, u8 antenna)
{
struct rsi_ant_sel_frame *ant_sel_frame;
struct sk_buff *skb;
skb = dev_alloc_skb(FRAME_DESC_SZ);
if (!skb) {
rsi_dbg(ERR_ZONE, "%s: Failed in allocation of skb\n",
__func__);
return -ENOMEM;
}
memset(skb->data, 0, FRAME_DESC_SZ);
ant_sel_frame = (struct rsi_ant_sel_frame *)skb->data;
ant_sel_frame->desc_dword0.frame_type = ANT_SEL_FRAME;
ant_sel_frame->sub_frame_type = ANTENNA_SEL_TYPE;
ant_sel_frame->ant_value = cpu_to_le16(antenna & ANTENNA_MASK_VALUE);
rsi_set_len_qno(&ant_sel_frame->desc_dword0.len_qno,
0, RSI_WIFI_MGMT_Q);
skb_put(skb, FRAME_DESC_SZ);
return rsi_send_internal_mgmt_frame(common, skb);
}
| 0
|
115,390
|
_dwarf_formsig8_internal(Dwarf_Attribute attr,
int formexpected,
Dwarf_Sig8 * returned_sig_bytes,
Dwarf_Error* error)
{
Dwarf_Debug dbg = 0;
Dwarf_CU_Context cu_context = 0;
Dwarf_Byte_Ptr field_end = 0;
Dwarf_Byte_Ptr section_end = 0;
int res = get_attr_dbg(&dbg,&cu_context,attr,error);
if (res != DW_DLV_OK) {
return res;
}
if (attr->ar_attribute_form != formexpected) {
return DW_DLV_NO_ENTRY;
}
section_end =
_dwarf_calculate_info_section_end_ptr(cu_context);
field_end = attr->ar_debug_ptr + sizeof(Dwarf_Sig8);
if (field_end > section_end) {
_dwarf_error(dbg, error, DW_DLE_ATTR_FORM_OFFSET_BAD);
return DW_DLV_ERROR;
}
memcpy(returned_sig_bytes, attr->ar_debug_ptr,
sizeof(*returned_sig_bytes));
return DW_DLV_OK;
}
| 0
|
479,746
|
CImg<T> get_blur_median(const unsigned int n, const float threshold=0) const {
if (is_empty() || n<=1) return +*this;
CImg<T> res(_width,_height,_depth,_spectrum);
T *ptrd = res._data;
cimg::unused(ptrd);
const int hr = (int)n/2, hl = n - hr - 1;
if (res._depth!=1) { // 3D
if (threshold>0)
cimg_pragma_openmp(parallel for cimg_openmp_collapse(3) cimg_openmp_if(_width>=(cimg_openmp_sizefactor)*16 &&
_height*_depth*_spectrum>=4))
cimg_forXYZC(*this,x,y,z,c) { // With threshold
const int
x0 = x - hl, y0 = y - hl, z0 = z - hl, x1 = x + hr, y1 = y + hr, z1 = z + hr,
nx0 = x0<0?0:x0, ny0 = y0<0?0:y0, nz0 = z0<0?0:z0,
nx1 = x1>=width()?width() - 1:x1, ny1 = y1>=height()?height() - 1:y1, nz1 = z1>=depth()?depth() - 1:z1;
const Tfloat val0 = (Tfloat)(*this)(x,y,z,c);
CImg<T> values(n*n*n);
unsigned int nb_values = 0;
T *_ptrd = values.data();
cimg_for_inXYZ(*this,nx0,ny0,nz0,nx1,ny1,nz1,p,q,r)
if (cimg::abs((*this)(p,q,r,c) - val0)<=threshold) { *(_ptrd++) = (*this)(p,q,r,c); ++nb_values; }
res(x,y,z,c) = nb_values?values.get_shared_points(0,nb_values - 1).median():(*this)(x,y,z,c);
}
else
cimg_pragma_openmp(parallel for cimg_openmp_collapse(3) cimg_openmp_if(_width>=(cimg_openmp_sizefactor)*16 &&
_height*_depth*_spectrum>=4))
cimg_forXYZC(*this,x,y,z,c) { // Without threshold
const int
x0 = x - hl, y0 = y - hl, z0 = z - hl, x1 = x + hr, y1 = y + hr, z1 = z + hr,
nx0 = x0<0?0:x0, ny0 = y0<0?0:y0, nz0 = z0<0?0:z0,
nx1 = x1>=width()?width() - 1:x1, ny1 = y1>=height()?height() - 1:y1, nz1 = z1>=depth()?depth() - 1:z1;
res(x,y,z,c) = get_crop(nx0,ny0,nz0,c,nx1,ny1,nz1,c).median();
}
} else {
if (threshold>0)
cimg_pragma_openmp(parallel for cimg_openmp_collapse(2) cimg_openmp_if(_width>=(cimg_openmp_sizefactor)*16 &&
_height*_spectrum>=4))
cimg_forXYC(*this,x,y,c) { // With threshold
const int
x0 = x - hl, y0 = y - hl, x1 = x + hr, y1 = y + hr,
nx0 = x0<0?0:x0, ny0 = y0<0?0:y0,
nx1 = x1>=width()?width() - 1:x1, ny1 = y1>=height()?height() - 1:y1;
const Tfloat val0 = (Tfloat)(*this)(x,y,c);
CImg<T> values(n*n);
unsigned int nb_values = 0;
T *_ptrd = values.data();
cimg_for_inXY(*this,nx0,ny0,nx1,ny1,p,q)
if (cimg::abs((*this)(p,q,c) - val0)<=threshold) { *(_ptrd++) = (*this)(p,q,c); ++nb_values; }
res(x,y,c) = nb_values?values.get_shared_points(0,nb_values - 1).median():(*this)(x,y,c);
}
else {
const int
w1 = width() - 1, h1 = height() - 1,
w2 = width() - 2, h2 = height() - 2,
w3 = width() - 3, h3 = height() - 3,
w4 = width() - 4, h4 = height() - 4;
switch (n) { // Without threshold
case 3 : {
cimg_pragma_openmp(parallel for cimg_openmp_if(_spectrum>=2))
cimg_forC(*this,c) {
CImg<T> I(9);
cimg_for_in3x3(*this,1,1,w2,h2,x,y,0,c,I,T)
res(x,y,c) = cimg::median(I[0],I[1],I[2],I[3],I[4],I[5],I[6],I[7],I[8]);
cimg_for_borderXY(*this,x,y,1)
res(x,y,c) = get_crop(std::max(0,x - 1),std::max(0,y - 1),0,c,
std::min(w1,x + 1),std::min(h1,y + 1),0,c).median();
}
} break;
case 5 : {
cimg_pragma_openmp(parallel for cimg_openmp_if(_spectrum>=2))
cimg_forC(*this,c) {
CImg<T> I(25);
cimg_for_in5x5(*this,2,2,w3,h3,x,y,0,c,I,T)
res(x,y,c) = cimg::median(I[0],I[1],I[2],I[3],I[4],
I[5],I[6],I[7],I[8],I[9],
I[10],I[11],I[12],I[13],I[14],
I[15],I[16],I[17],I[18],I[19],
I[20],I[21],I[22],I[23],I[24]);
cimg_for_borderXY(*this,x,y,2)
res(x,y,c) = get_crop(std::max(0,x - 2),std::max(0,y - 2),0,c,
std::min(w1,x + 2),std::min(h1,y + 2),0,c).median();
}
} break;
case 7 : {
cimg_pragma_openmp(parallel for cimg_openmp_if(_spectrum>=2))
cimg_forC(*this,c) {
CImg<T> I(49);
cimg_for_in7x7(*this,3,3,w4,h4,x,y,0,c,I,T)
res(x,y,c) = cimg::median(I[0],I[1],I[2],I[3],I[4],I[5],I[6],
I[7],I[8],I[9],I[10],I[11],I[12],I[13],
I[14],I[15],I[16],I[17],I[18],I[19],I[20],
I[21],I[22],I[23],I[24],I[25],I[26],I[27],
I[28],I[29],I[30],I[31],I[32],I[33],I[34],
I[35],I[36],I[37],I[38],I[39],I[40],I[41],
I[42],I[43],I[44],I[45],I[46],I[47],I[48]);
cimg_for_borderXY(*this,x,y,3)
res(x,y,c) = get_crop(std::max(0,x - 3),std::max(0,y - 3),0,c,
std::min(w1,x + 3),std::min(h1,y + 3),0,c).median();
}
} break;
default : {
cimg_pragma_openmp(parallel for cimg_openmp_collapse(2)
cimg_openmp_if(_width>=(cimg_openmp_sizefactor)*16 && _height*_spectrum>=4))
cimg_forXYC(*this,x,y,c) {
const int
x0 = x - hl, y0 = y - hl, x1 = x + hr, y1 = y + hr,
nx0 = x0<0?0:x0, ny0 = y0<0?0:y0,
nx1 = x1>=width()?width() - 1:x1, ny1 = y1>=height()?height() - 1:y1;
res(x,y,c) = get_crop(nx0,ny0,0,c,nx1,ny1,0,c).median();
}
}
}
}
}
return res;
}
| 0
|
497,026
|
static time_t debugtime(void *unused)
{
char *timestr = getenv("CURL_TIME");
(void)unused;
if(timestr) {
curl_off_t val;
(void)curlx_strtoofft(timestr, NULL, 10, &val);
val += (curl_off_t)deltatime;
return (time_t)val;
}
return time(NULL);
}
| 0
|
457,564
|
ring_buffer_commit_overrun_cpu(struct trace_buffer *buffer, int cpu)
{
struct ring_buffer_per_cpu *cpu_buffer;
unsigned long ret;
if (!cpumask_test_cpu(cpu, buffer->cpumask))
return 0;
cpu_buffer = buffer->buffers[cpu];
ret = local_read(&cpu_buffer->commit_overrun);
return ret;
}
| 0
|
281,476
|
static bool TypeNeedsSynchronousCacheHit(Resource::Type type) {
if (type == Resource::kCSSStyleSheet)
return true;
if (type == Resource::kScript)
return true;
if (type == Resource::kFont)
return true;
return false;
}
| 0
|
17,292
|
static inline void vc1_b_mc ( VC1Context * v , int dmv_x [ 2 ] , int dmv_y [ 2 ] , int direct , int mode ) {
if ( v -> use_ic ) {
v -> mv_mode2 = v -> mv_mode ;
v -> mv_mode = MV_PMODE_INTENSITY_COMP ;
}
if ( direct ) {
vc1_mc_1mv ( v , 0 ) ;
vc1_interp_mc ( v ) ;
if ( v -> use_ic ) v -> mv_mode = v -> mv_mode2 ;
return ;
}
if ( mode == BMV_TYPE_INTERPOLATED ) {
vc1_mc_1mv ( v , 0 ) ;
vc1_interp_mc ( v ) ;
if ( v -> use_ic ) v -> mv_mode = v -> mv_mode2 ;
return ;
}
if ( v -> use_ic && ( mode == BMV_TYPE_BACKWARD ) ) v -> mv_mode = v -> mv_mode2 ;
vc1_mc_1mv ( v , ( mode == BMV_TYPE_BACKWARD ) ) ;
if ( v -> use_ic ) v -> mv_mode = v -> mv_mode2 ;
}
| 0
|
20,500
|
static int add_array_entry ( const char * loc_name , zval * hash_arr , char * key_name TSRMLS_DC ) {
char * key_value = NULL ;
char * cur_key_name = NULL ;
char * token = NULL ;
char * last_ptr = NULL ;
int result = 0 ;
int cur_result = 0 ;
int cnt = 0 ;
if ( strcmp ( key_name , LOC_PRIVATE_TAG ) == 0 ) {
key_value = get_private_subtags ( loc_name ) ;
result = 1 ;
}
else {
key_value = get_icu_value_internal ( loc_name , key_name , & result , 1 ) ;
}
if ( ( strcmp ( key_name , LOC_PRIVATE_TAG ) == 0 ) || ( strcmp ( key_name , LOC_VARIANT_TAG ) == 0 ) ) {
if ( result > 0 && key_value ) {
token = php_strtok_r ( key_value , DELIMITER , & last_ptr ) ;
if ( cur_key_name ) {
efree ( cur_key_name ) ;
}
cur_key_name = ( char * ) ecalloc ( 25 , 25 ) ;
sprintf ( cur_key_name , "%s%d" , key_name , cnt ++ ) ;
add_assoc_string ( hash_arr , cur_key_name , token , TRUE ) ;
while ( ( token = php_strtok_r ( NULL , DELIMITER , & last_ptr ) ) && ( strlen ( token ) > 1 ) ) {
sprintf ( cur_key_name , "%s%d" , key_name , cnt ++ ) ;
add_assoc_string ( hash_arr , cur_key_name , token , TRUE ) ;
}
}
}
else {
if ( result == 1 ) {
add_assoc_string ( hash_arr , key_name , key_value , TRUE ) ;
cur_result = 1 ;
}
}
if ( cur_key_name ) {
efree ( cur_key_name ) ;
}
if ( key_value ) {
efree ( key_value ) ;
}
return cur_result ;
}
| 0
|
325,727
|
static void gem_init(NICInfo *nd, uint32_t base, qemu_irq irq)
{
DeviceState *dev;
SysBusDevice *s;
qemu_check_nic_model(nd, "cadence_gem");
dev = qdev_create(NULL, "cadence_gem");
qdev_set_nic_properties(dev, nd);
qdev_init_nofail(dev);
s = SYS_BUS_DEVICE(dev);
sysbus_mmio_map(s, 0, base);
sysbus_connect_irq(s, 0, irq);
}
| 0
|
135,295
|
void php_gd_error_ex(int type, const char *format, ...)
{
va_list args;
va_start(args, format);
std::string msg;
HPHP::string_vsnprintf(msg, format, args);
va_end(args);
if (type == E_ERROR) {
HPHP::raise_error(msg);
} else if (type == E_WARNING) {
HPHP::raise_warning(msg);
} else if (type == E_NOTICE) {
HPHP::raise_notice(msg);
}
}
| 0
|
323,747
|
static void prodsum(float *tgt, float *src, int len, int n)
{
unsigned int x;
float *p1, *p2;
double sum;
while (n >= 0) {
p1 = (p2 = src) - n;
for (sum=0, x=len; x--; sum += (*p1++) * (*p2++));
tgt[n--] = sum;
}
}
| 0
|
20,658
|
inline int32_t http_hdr_version_get ( HTTPHdrImpl * hh ) {
return ( hh -> m_version ) ;
}
| 0
|
385,687
|
ftp_mdtm(ftpbuf_t *ftp, const char *path)
{
time_t stamp;
struct tm *gmt, tmbuf;
struct tm tm;
char *ptr;
int n;
if (ftp == NULL) {
return -1;
}
if (!ftp_putcmd(ftp, "MDTM", path)) {
return -1;
}
if (!ftp_getresp(ftp) || ftp->resp != 213) {
return -1;
}
/* parse out the timestamp */
for (ptr = ftp->inbuf; *ptr && !isdigit(*ptr); ptr++);
n = sscanf(ptr, "%4u%2u%2u%2u%2u%2u", &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec);
if (n != 6) {
return -1;
}
tm.tm_year -= 1900;
tm.tm_mon--;
tm.tm_isdst = -1;
/* figure out the GMT offset */
stamp = time(NULL);
gmt = php_gmtime_r(&stamp, &tmbuf);
if (!gmt) {
return -1;
}
gmt->tm_isdst = -1;
/* apply the GMT offset */
tm.tm_sec += stamp - mktime(gmt);
tm.tm_isdst = gmt->tm_isdst;
stamp = mktime(&tm);
return stamp;
}
| 0
|
127,839
|
static int zipfileDeflate(
const u8 *aIn, int nIn, /* Input */
u8 **ppOut, int *pnOut, /* Output */
char **pzErr /* OUT: Error message */
){
int rc = SQLITE_OK;
sqlite3_int64 nAlloc;
z_stream str;
u8 *aOut;
memset(&str, 0, sizeof(str));
str.next_in = (Bytef*)aIn;
str.avail_in = nIn;
deflateInit2(&str, 9, Z_DEFLATED, -15, 8, Z_DEFAULT_STRATEGY);
nAlloc = deflateBound(&str, nIn);
aOut = (u8*)sqlite3_malloc64(nAlloc);
if( aOut==0 ){
rc = SQLITE_NOMEM;
}else{
int res;
str.next_out = aOut;
str.avail_out = nAlloc;
res = deflate(&str, Z_FINISH);
if( res==Z_STREAM_END ){
*ppOut = aOut;
*pnOut = (int)str.total_out;
}else{
sqlite3_free(aOut);
*pzErr = sqlite3_mprintf("zipfile: deflate() error");
rc = SQLITE_ERROR;
}
deflateEnd(&str);
}
return rc;
}
| 0
|
328,852
|
static void decouple_info(COOKContext *q, COOKSubpacket *p, int *decouple_tab)
{
int i;
int vlc = get_bits1(&q->gb);
int start = cplband[p->js_subband_start];
int end = cplband[p->subbands - 1];
int length = end - start + 1;
if (start > end)
return;
if (vlc)
for (i = 0; i < length; i++)
decouple_tab[start + i] = get_vlc2(&q->gb, p->ccpl.table, p->ccpl.bits, 2);
else
for (i = 0; i < length; i++)
decouple_tab[start + i] = get_bits(&q->gb, p->js_vlc_bits);
}
| 0
|
165,940
|
static bool ExecutePasteAndMatchStyle(LocalFrame& frame,
Event*,
EditorCommandSource source,
const String&) {
frame.GetEditor().PasteAsPlainText(source);
return true;
}
| 0
|
311,684
|
bool AutofillExternalDelegate::RemoveSuggestion(const base::string16& value,
int identifier) {
if (identifier > 0)
return manager_->RemoveAutofillProfileOrCreditCard(identifier);
if (identifier == POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY) {
manager_->RemoveAutocompleteEntry(query_field_.name, value);
return true;
}
return false;
}
| 0
|
347,162
|
static int jpc_dec_process_siz(jpc_dec_t *dec, jpc_ms_t *ms)
{
jpc_siz_t *siz = &ms->parms.siz;
int compno;
int tileno;
jpc_dec_tile_t *tile;
jpc_dec_tcomp_t *tcomp;
int htileno;
int vtileno;
jpc_dec_cmpt_t *cmpt;
size_t size;
size_t num_samples;
size_t num_samples_delta;
size_t tile_samples;
if (!jas_safe_size_mul(siz->tilewidth, siz->tileheight, &tile_samples) ||
(dec->max_samples > 0 && tile_samples > dec->max_samples)) {
jas_eprintf("tile too large\n");
return -1;
}
dec->xstart = siz->xoff;
dec->ystart = siz->yoff;
dec->xend = siz->width;
dec->yend = siz->height;
dec->tilewidth = siz->tilewidth;
dec->tileheight = siz->tileheight;
dec->tilexoff = siz->tilexoff;
dec->tileyoff = siz->tileyoff;
dec->numcomps = siz->numcomps;
if (!(dec->cp = jpc_dec_cp_create(dec->numcomps))) {
return -1;
}
if (!(dec->cmpts = jas_alloc2(dec->numcomps, sizeof(jpc_dec_cmpt_t)))) {
return -1;
}
num_samples = 0;
for (compno = 0, cmpt = dec->cmpts; compno < dec->numcomps; ++compno,
++cmpt) {
cmpt->prec = siz->comps[compno].prec;
cmpt->sgnd = siz->comps[compno].sgnd;
cmpt->hstep = siz->comps[compno].hsamp;
cmpt->vstep = siz->comps[compno].vsamp;
cmpt->width = JPC_CEILDIV(dec->xend, cmpt->hstep) -
JPC_CEILDIV(dec->xstart, cmpt->hstep);
cmpt->height = JPC_CEILDIV(dec->yend, cmpt->vstep) -
JPC_CEILDIV(dec->ystart, cmpt->vstep);
cmpt->hsubstep = 0;
cmpt->vsubstep = 0;
if (!jas_safe_size_mul(cmpt->width, cmpt->height, &num_samples_delta)) {
jas_eprintf("image too large\n");
return -1;
}
if (!jas_safe_size_add(num_samples, num_samples_delta, &num_samples)) {
jas_eprintf("image too large\n");
return -1;
}
}
if (dec->max_samples > 0 && num_samples > dec->max_samples) {
jas_eprintf("maximum number of samples exceeded (%zu > %zu)\n",
num_samples, dec->max_samples);
return -1;
}
dec->image = 0;
dec->numhtiles = JPC_CEILDIV(dec->xend - dec->tilexoff, dec->tilewidth);
dec->numvtiles = JPC_CEILDIV(dec->yend - dec->tileyoff, dec->tileheight);
assert(dec->numhtiles >= 0);
assert(dec->numvtiles >= 0);
if (!jas_safe_size_mul(dec->numhtiles, dec->numvtiles, &size) ||
size > INT_MAX) {
return -1;
}
if (dec->max_samples > 0 && size > dec->max_samples / 16 / 16) {
/* avoid Denial of Service by a malicious input file
with millions of tiny tiles; if max_samples is
configured, then assume the tiles are at least
16x16, and don't allow more than this number of
tiles */
return -1;
}
if (dec->max_samples > 0 && size > dec->max_samples / dec->numcomps / 16) {
/* another DoS check: since each tile allocates an
array of components, this check attempts to catch
excessive tile*component numbers */
return -1;
}
dec->numtiles = size;
JAS_DBGLOG(10, ("numtiles = %d; numhtiles = %d; numvtiles = %d;\n",
dec->numtiles, dec->numhtiles, dec->numvtiles));
if (!(dec->tiles = jas_alloc2(dec->numtiles, sizeof(jpc_dec_tile_t)))) {
return -1;
}
for (tileno = 0, tile = dec->tiles; tileno < dec->numtiles; ++tileno,
++tile) {
/* initialize all tiles with JPC_TILE_DONE so
jpc_dec_destroy() knows which ones need a
jpc_dec_tilefini() call; they are not actually
"done", of course */
tile->state = JPC_TILE_DONE;
}
for (tileno = 0, tile = dec->tiles; tileno < dec->numtiles; ++tileno,
++tile) {
htileno = tileno % dec->numhtiles;
vtileno = tileno / dec->numhtiles;
tile->realmode = 0;
tile->state = JPC_TILE_INIT;
tile->xstart = JAS_MAX(dec->tilexoff + htileno * dec->tilewidth,
dec->xstart);
tile->ystart = JAS_MAX(dec->tileyoff + vtileno * dec->tileheight,
dec->ystart);
tile->xend = JAS_MIN(dec->tilexoff + (htileno + 1) *
dec->tilewidth, dec->xend);
tile->yend = JAS_MIN(dec->tileyoff + (vtileno + 1) *
dec->tileheight, dec->yend);
tile->numparts = 0;
tile->partno = 0;
tile->pkthdrstream = 0;
tile->pkthdrstreampos = 0;
tile->pptstab = 0;
tile->cp = 0;
tile->pi = 0;
if (!(tile->tcomps = jas_alloc2(dec->numcomps,
sizeof(jpc_dec_tcomp_t)))) {
return -1;
}
for (compno = 0, cmpt = dec->cmpts, tcomp = tile->tcomps;
compno < dec->numcomps; ++compno, ++cmpt, ++tcomp) {
tcomp->rlvls = 0;
tcomp->numrlvls = 0;
tcomp->data = 0;
tcomp->xstart = JPC_CEILDIV(tile->xstart, cmpt->hstep);
tcomp->ystart = JPC_CEILDIV(tile->ystart, cmpt->vstep);
tcomp->xend = JPC_CEILDIV(tile->xend, cmpt->hstep);
tcomp->yend = JPC_CEILDIV(tile->yend, cmpt->vstep);
tcomp->tsfb = 0;
}
}
dec->pkthdrstreams = 0;
/* We should expect to encounter other main header marker segments
or an SOT marker segment next. */
dec->state = JPC_MH;
return 0;
}
| 1
|
464,837
|
static void emit_align(u8 **pprog, u32 align)
{
u8 *target, *prog = *pprog;
target = PTR_ALIGN(prog, align);
if (target != prog)
emit_nops(&prog, target - prog);
*pprog = prog;
}
| 0
|
99,339
|
static int __dev_close(struct net_device *dev)
{
int retval;
LIST_HEAD(single);
list_add(&dev->close_list, &single);
retval = __dev_close_many(&single);
list_del(&single);
return retval;
}
| 0
|
364,820
|
_parse_env_file(pam_handle_t *pamh, int ctrl, const char *file)
{
int retval=PAM_SUCCESS, i, t;
char buffer[BUF_SIZE], *key, *mark;
FILE *conf;
D(("Env file name is: %s", file));
if ((conf = fopen(file,"r")) == NULL) {
pam_syslog(pamh, LOG_ERR, "Unable to open env file: %s: %m", file);
return PAM_IGNORE;
}
while (_assemble_line(conf, buffer, BUF_SIZE) > 0) {
D(("Read line: %s", buffer));
key = buffer;
/* skip leading white space */
key += strspn(key, " \n\t");
/* skip blanks lines and comments */
if (key[0] == '#')
continue;
/* skip over "export " if present so we can be compat with
bash type declarations */
if (strncmp(key, "export ", (size_t) 7) == 0)
key += 7;
/* now find the end of value */
mark = key;
while(mark[0] != '\n' && mark[0] != '#' && mark[0] != '\0')
mark++;
if (mark[0] != '\0')
mark[0] = '\0';
/*
* sanity check, the key must be alpha-numeric
*/
for ( i = 0 ; key[i] != '=' && key[i] != '\0' ; i++ )
if (!isalnum(key[i]) && key[i] != '_') {
pam_syslog(pamh, LOG_ERR,
"non-alphanumeric key '%s' in %s', ignoring",
key, file);
break;
}
/* non-alphanumeric key, ignore this line */
if (key[i] != '=' && key[i] != '\0')
continue;
/* now we try to be smart about quotes around the value,
but not too smart, we can't get all fancy with escaped
values like bash */
if (key[i] == '=' && (key[++i] == '\"' || key[i] == '\'')) {
for ( t = i+1 ; key[t] != '\0' ; t++)
if (key[t] != '\"' && key[t] != '\'')
key[i++] = key[t];
else if (key[t+1] != '\0')
key[i++] = key[t];
key[i] = '\0';
}
/* if this is a request to delete a variable, check that it's
actually set first, so we don't get a vague error back from
pam_putenv() */
for (i = 0; key[i] != '=' && key[i] != '\0'; i++);
if (key[i] == '\0' && !pam_getenv(pamh,key))
continue;
/* set the env var, if it fails, we break out of the loop */
retval = pam_putenv(pamh, key);
if (retval != PAM_SUCCESS) {
D(("error setting env \"%s\"", key));
break;
} else if (ctrl & PAM_DEBUG_ARG) {
pam_syslog(pamh, LOG_DEBUG,
"pam_putenv(\"%s\")", key);
}
}
(void) fclose(conf);
/* tidy up */
D(("Exit."));
return retval;
}
| 0
|
312,595
|
void RenderFrameHostManager::OnEnforceInsecureRequestPolicy(
blink::WebInsecureRequestPolicy policy) {
if (!SiteIsolationPolicy::AreCrossProcessFramesPossible())
return;
for (const auto& pair : proxy_hosts_) {
pair.second->Send(new FrameMsg_EnforceInsecureRequestPolicy(
pair.second->GetRoutingID(), policy));
}
}
| 0
|
487,507
|
v8::Local<v8::Value> GetTop(v8::Isolate* isolate) {
content::RenderFrame* render_frame;
if (!MaybeGetRenderFrame(isolate, "top", &render_frame))
return v8::Null(isolate);
blink::WebFrame* frame = render_frame->GetWebFrame()->Top();
return CreateWebFrameRenderer(isolate, frame);
}
| 0
|
21,123
|
static void U_CALLCONV myMemFree ( const void * context , void * mem ) {
char * freePtr = ( char * ) mem ;
if ( freePtr != NULL ) {
freePtr -= sizeof ( ctest_AlignedMemory ) ;
}
free ( freePtr ) ;
}
| 0
|
164,112
|
void ExtensionUninstallObserver::Observe(
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
if (!automation_) {
delete this;
return;
}
switch (type) {
case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: {
if (id_ == content::Details<extensions::Extension>(details).ptr()->id()) {
scoped_ptr<DictionaryValue> return_value(new DictionaryValue);
return_value->SetBoolean("success", true);
AutomationJSONReply(automation_, reply_message_.release())
.SendSuccess(return_value.get());
delete this;
return;
}
break;
}
case chrome::NOTIFICATION_EXTENSION_UNINSTALL_NOT_ALLOWED: {
const extensions::Extension* extension =
content::Details<extensions::Extension>(details).ptr();
if (id_ == extension->id()) {
scoped_ptr<DictionaryValue> return_value(new DictionaryValue);
return_value->SetBoolean("success", false);
AutomationJSONReply(automation_, reply_message_.release())
.SendSuccess(return_value.get());
delete this;
return;
}
break;
}
default:
NOTREACHED();
}
}
| 0
|
95,214
|
TEST(BasicFlatBufferModel, TestWithNullVerifier) {
ASSERT_TRUE(FlatBufferModel::VerifyAndBuildFromFile(
"tensorflow/lite/testdata/test_model.bin", nullptr));
}
| 0
|
191,817
|
void DisplaySourceCustomBindings::OnCallCompleted(
int call_id,
bool success,
const std::string& error_message) {
v8::Isolate* isolate = context()->isolate();
ModuleSystem* module_system = context()->module_system();
v8::HandleScope handle_scope(isolate);
v8::Context::Scope context_scope(context()->v8_context());
v8::Local<v8::Value> callback_args[2];
callback_args[0] = v8::Integer::New(isolate, call_id);
if (success)
callback_args[1] = v8::Null(isolate);
else
callback_args[1] = v8::String::NewFromUtf8(isolate, error_message.c_str());
module_system->CallModuleMethod("displaySource", "callCompletionCallback", 2,
callback_args);
}
| 0
|
330,593
|
static AVIOContext * wtvfile_open2(AVFormatContext *s, const uint8_t *buf, int buf_size, const uint8_t *filename, int filename_size)
{
const uint8_t *buf_end = buf + buf_size;
while(buf + 48 <= buf_end) {
int dir_length, name_size, first_sector, depth;
uint64_t file_length;
const uint8_t *name;
if (ff_guidcmp(buf, dir_entry_guid)) {
av_log(s, AV_LOG_ERROR, "unknown guid "FF_PRI_GUID", expected dir_entry_guid; "
"remaining directory entries ignored\n", FF_ARG_GUID(buf));
break;
}
dir_length = AV_RL16(buf + 16);
file_length = AV_RL64(buf + 24);
name_size = 2 * AV_RL32(buf + 32);
if (buf + 48 + name_size > buf_end) {
av_log(s, AV_LOG_ERROR, "filename exceeds buffer size; remaining directory entries ignored\n");
break;
}
first_sector = AV_RL32(buf + 40 + name_size);
depth = AV_RL32(buf + 44 + name_size);
/* compare file name; test optional null terminator */
name = buf + 40;
if (name_size >= filename_size &&
!memcmp(name, filename, filename_size) &&
(name_size < filename_size + 2 || !AV_RN16(name + filename_size)))
return wtvfile_open_sector(first_sector, file_length, depth, s);
buf += dir_length;
}
return 0;
}
| 1
|
233,299
|
void Browser::ConfirmAddSearchProvider(TemplateURL* template_url,
Profile* profile) {
window()->ConfirmAddSearchProvider(template_url, profile);
}
| 0
|
444,731
|
TEST_F(Http1ServerConnectionImplTest, PostWithContentLengthFragmentedBuffer) {
initialize();
InSequence sequence;
MockRequestDecoder decoder;
EXPECT_CALL(callbacks_, newStream(_, _)).WillOnce(ReturnRef(decoder));
TestRequestHeaderMapImpl expected_headers{
{"content-length", "5"}, {":path", "/"}, {":method", "POST"}};
EXPECT_CALL(decoder, decodeHeaders_(HeaderMapEqual(&expected_headers), false));
Buffer::OwnedImpl expected_data1("12345");
EXPECT_CALL(decoder, decodeData(BufferEqual(&expected_data1), false));
Buffer::OwnedImpl expected_data2;
EXPECT_CALL(decoder, decodeData(BufferEqual(&expected_data2), true));
Buffer::OwnedImpl buffer =
createBufferWithNByteSlices("POST / HTTP/1.1\r\ncontent-length: 5\r\n\r\n12345", 1);
auto status = codec_->dispatch(buffer);
EXPECT_TRUE(status.ok());
EXPECT_EQ(0U, buffer.length());
}
| 0
|
145,992
|
GF_Err traf_box_size(GF_Box *s)
{
u32 pos=0;
GF_TrackFragmentBox *ptr = (GF_TrackFragmentBox *) s;
//Header first
gf_isom_check_position(s, (GF_Box *)ptr->tfhd, &pos);
gf_isom_check_position_list(s, ptr->sub_samples, &pos);
gf_isom_check_position(s, (GF_Box *)ptr->tfdt, &pos);
gf_isom_check_position_list(s, ptr->sampleGroupsDescription, &pos);
gf_isom_check_position_list(s, ptr->sampleGroups, &pos);
gf_isom_check_position_list(s, ptr->sai_sizes, &pos);
gf_isom_check_position_list(s, ptr->sai_offsets, &pos);
gf_isom_check_position(s, (GF_Box *)ptr->sample_encryption, &pos);
gf_isom_check_position_list(s, ptr->TrackRuns, &pos);
//when sdtp is present (smooth-like) write it after the trun box
gf_isom_check_position(s, (GF_Box *)ptr->sdtp, &pos);
//tfxd should be last ...
if (ptr->tfxd)
gf_isom_check_position(s, (GF_Box *)ptr->tfxd, &pos);
return GF_OK;
}
| 0
|
30,750
|
static void write_crash_report ( const char * err ) {
char * loc = git_pathdup ( "fast_import_crash_%" PRIuMAX , ( uintmax_t ) getpid ( ) ) ;
FILE * rpt = fopen ( loc , "w" ) ;
struct branch * b ;
unsigned long lu ;
struct recent_command * rc ;
if ( ! rpt ) {
error ( "can't write crash report %s: %s" , loc , strerror ( errno ) ) ;
free ( loc ) ;
return ;
}
fprintf ( stderr , "fast-import: dumping crash report to %s\n" , loc ) ;
fprintf ( rpt , "fast-import crash report:\n" ) ;
fprintf ( rpt , " fast-import process: %" PRIuMAX "\n" , ( uintmax_t ) getpid ( ) ) ;
fprintf ( rpt , " parent process : %" PRIuMAX "\n" , ( uintmax_t ) getppid ( ) ) ;
fprintf ( rpt , " at %s\n" , show_date ( time ( NULL ) , 0 , DATE_MODE ( LOCAL ) ) ) ;
fputc ( '\n' , rpt ) ;
fputs ( "fatal: " , rpt ) ;
fputs ( err , rpt ) ;
fputc ( '\n' , rpt ) ;
fputc ( '\n' , rpt ) ;
fputs ( "Most Recent Commands Before Crash\n" , rpt ) ;
fputs ( "---------------------------------\n" , rpt ) ;
for ( rc = cmd_hist . next ;
rc != & cmd_hist ;
rc = rc -> next ) {
if ( rc -> next == & cmd_hist ) fputs ( "* " , rpt ) ;
else fputs ( " " , rpt ) ;
fputs ( rc -> buf , rpt ) ;
fputc ( '\n' , rpt ) ;
}
fputc ( '\n' , rpt ) ;
fputs ( "Active Branch LRU\n" , rpt ) ;
fputs ( "-----------------\n" , rpt ) ;
fprintf ( rpt , " active_branches = %lu cur, %lu max\n" , cur_active_branches , max_active_branches ) ;
fputc ( '\n' , rpt ) ;
fputs ( " pos clock name\n" , rpt ) ;
fputs ( " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" , rpt ) ;
for ( b = active_branches , lu = 0 ;
b ;
b = b -> active_next_branch ) fprintf ( rpt , " %2lu) %6" PRIuMAX " %s\n" , ++ lu , b -> last_commit , b -> name ) ;
fputc ( '\n' , rpt ) ;
fputs ( "Inactive Branches\n" , rpt ) ;
fputs ( "-----------------\n" , rpt ) ;
for ( lu = 0 ;
lu < branch_table_sz ;
lu ++ ) {
for ( b = branch_table [ lu ] ;
b ;
b = b -> table_next_branch ) write_branch_report ( rpt , b ) ;
}
if ( first_tag ) {
struct tag * tg ;
fputc ( '\n' , rpt ) ;
fputs ( "Annotated Tags\n" , rpt ) ;
fputs ( "--------------\n" , rpt ) ;
for ( tg = first_tag ;
tg ;
tg = tg -> next_tag ) {
fputs ( sha1_to_hex ( tg -> sha1 ) , rpt ) ;
fputc ( ' ' , rpt ) ;
fputs ( tg -> name , rpt ) ;
fputc ( '\n' , rpt ) ;
}
}
fputc ( '\n' , rpt ) ;
fputs ( "Marks\n" , rpt ) ;
fputs ( "-----\n" , rpt ) ;
if ( export_marks_file ) fprintf ( rpt , " exported to %s\n" , export_marks_file ) ;
else dump_marks_helper ( rpt , 0 , marks ) ;
fputc ( '\n' , rpt ) ;
fputs ( "-------------------\n" , rpt ) ;
fputs ( "END OF CRASH REPORT\n" , rpt ) ;
fclose ( rpt ) ;
free ( loc ) ;
}
| 0
|
171,599
|
static void reflectBooleanAttributeAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
{
TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder());
V8TRYCATCH_VOID(bool, cppValue, jsValue->BooleanValue());
CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
imp->setBooleanAttribute(HTMLNames::reflectbooleanattributeAttr, cppValue);
}
| 0
|
407,977
|
(InitializerContext* context) {
auto& compressorRegistry = MessageCompressorRegistry::get();
compressorRegistry.registerImplementation(stdx::make_unique<SnappyMessageCompressor>());
return Status::OK();
}
| 0
|
240,673
|
scoped_refptr<EntryImpl> BackendImpl::ResurrectEntry(
scoped_refptr<EntryImpl> deleted_entry) {
if (ENTRY_NORMAL == deleted_entry->entry()->Data()->state) {
deleted_entry = nullptr;
stats_.OnEvent(Stats::CREATE_MISS);
Trace("create entry miss ");
return NULL;
}
eviction_.OnCreateEntry(deleted_entry.get());
entry_count_++;
stats_.OnEvent(Stats::RESURRECT_HIT);
Trace("Resurrect entry hit ");
return deleted_entry;
}
| 0
|
346,602
|
GC_INNER ptr_t GC_alloc_large(size_t lb, int k, unsigned flags)
{
struct hblk * h;
word n_blocks;
ptr_t result;
GC_bool retry = FALSE;
GC_ASSERT(I_HOLD_LOCK());
lb = ROUNDUP_GRANULE_SIZE(lb);
n_blocks = OBJ_SZ_TO_BLOCKS(lb);
if (!EXPECT(GC_is_initialized, TRUE)) {
DCL_LOCK_STATE;
UNLOCK(); /* just to unset GC_lock_holder */
GC_init();
LOCK();
}
/* Do our share of marking work */
if (GC_incremental && !GC_dont_gc)
GC_collect_a_little_inner((int)n_blocks);
h = GC_allochblk(lb, k, flags);
# ifdef USE_MUNMAP
if (0 == h) {
GC_merge_unmapped();
h = GC_allochblk(lb, k, flags);
}
# endif
while (0 == h && GC_collect_or_expand(n_blocks, flags != 0, retry)) {
h = GC_allochblk(lb, k, flags);
retry = TRUE;
}
if (h == 0) {
result = 0;
} else {
size_t total_bytes = n_blocks * HBLKSIZE;
if (n_blocks > 1) {
GC_large_allocd_bytes += total_bytes;
if (GC_large_allocd_bytes > GC_max_large_allocd_bytes)
GC_max_large_allocd_bytes = GC_large_allocd_bytes;
}
/* FIXME: Do we need some way to reset GC_max_large_allocd_bytes? */
result = h -> hb_body;
}
return result;
}
| 1
|
280,841
|
void RenderFrameHostImpl::JavaScriptDialogClosed(
IPC::Message* reply_msg,
bool success,
const base::string16& user_input) {
GetProcess()->SetIgnoreInputEvents(false);
SendJavaScriptDialogReply(reply_msg, success, user_input);
for (RenderFrameHostImpl* frame = this; frame; frame = frame->GetParent()) {
if (frame->is_waiting_for_beforeunload_ack_ &&
frame->beforeunload_timeout_) {
frame->beforeunload_timeout_->Start(
TimeDelta::FromMilliseconds(RenderViewHostImpl::kUnloadTimeoutMS));
}
}
}
| 0
|
165,443
|
DocumentInit& DocumentInit::WithPreviousDocumentCSP(
| 0
|
228,832
|
static bool isPointSkiaSafe(const SkMatrix& transform, const SkPoint& pt)
{
#ifdef ENSURE_VALUE_SAFETY_FOR_SKIA
SkPoint xPt;
transform.mapPoints(&xPt, &pt, 1);
return isCoordinateSkiaSafe(xPt.fX) && isCoordinateSkiaSafe(xPt.fY);
#else
return true;
#endif
}
| 0
|
379,146
|
long do_mount(const char *dev_name, const char *dir_name,
const char *type_page, unsigned long flags, void *data_page)
{
struct path path;
int retval = 0;
int mnt_flags = 0;
/* Discard magic */
if ((flags & MS_MGC_MSK) == MS_MGC_VAL)
flags &= ~MS_MGC_MSK;
/* Basic sanity checks */
if (!dir_name || !*dir_name || !memchr(dir_name, 0, PAGE_SIZE))
return -EINVAL;
if (data_page)
((char *)data_page)[PAGE_SIZE - 1] = 0;
/* ... and get the mountpoint */
retval = kern_path(dir_name, LOOKUP_FOLLOW, &path);
if (retval)
return retval;
retval = security_sb_mount(dev_name, &path,
type_page, flags, data_page);
if (!retval && !may_mount())
retval = -EPERM;
if (retval)
goto dput_out;
/* Default to relatime unless overriden */
if (!(flags & MS_NOATIME))
mnt_flags |= MNT_RELATIME;
/* Separate the per-mountpoint flags */
if (flags & MS_NOSUID)
mnt_flags |= MNT_NOSUID;
if (flags & MS_NODEV)
mnt_flags |= MNT_NODEV;
if (flags & MS_NOEXEC)
mnt_flags |= MNT_NOEXEC;
if (flags & MS_NOATIME)
mnt_flags |= MNT_NOATIME;
if (flags & MS_NODIRATIME)
mnt_flags |= MNT_NODIRATIME;
if (flags & MS_STRICTATIME)
mnt_flags &= ~(MNT_RELATIME | MNT_NOATIME);
if (flags & MS_RDONLY)
mnt_flags |= MNT_READONLY;
/* The default atime for remount is preservation */
if ((flags & MS_REMOUNT) &&
((flags & (MS_NOATIME | MS_NODIRATIME | MS_RELATIME |
MS_STRICTATIME)) == 0)) {
mnt_flags &= ~MNT_ATIME_MASK;
mnt_flags |= path.mnt->mnt_flags & MNT_ATIME_MASK;
}
flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE | MS_BORN |
MS_NOATIME | MS_NODIRATIME | MS_RELATIME| MS_KERNMOUNT |
MS_STRICTATIME);
if (flags & MS_REMOUNT)
retval = do_remount(&path, flags & ~MS_REMOUNT, mnt_flags,
data_page);
else if (flags & MS_BIND)
retval = do_loopback(&path, dev_name, flags & MS_REC);
else if (flags & (MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE))
retval = do_change_type(&path, flags);
else if (flags & MS_MOVE)
retval = do_move_mount(&path, dev_name);
else
retval = do_new_mount(&path, type_page, flags, mnt_flags,
dev_name, data_page);
dput_out:
path_put(&path);
return retval;
}
| 0
|
52,732
|
GF_Err saiz_dump(GF_Box *a, FILE * trace)
{
u32 i;
GF_SampleAuxiliaryInfoSizeBox *ptr = (GF_SampleAuxiliaryInfoSizeBox*) a;
if (!a) return GF_BAD_PARAM;
gf_isom_box_dump_start(a, "SampleAuxiliaryInfoSizeBox", trace);
fprintf(trace, "default_sample_info_size=\"%d\" sample_count=\"%d\"", ptr->default_sample_info_size, ptr->sample_count);
if (ptr->flags & 1) {
if (isalnum(ptr->aux_info_type>>24)) {
fprintf(trace, " aux_info_type=\"%s\" aux_info_type_parameter=\"%d\"", gf_4cc_to_str(ptr->aux_info_type), ptr->aux_info_type_parameter);
} else {
fprintf(trace, " aux_info_type=\"%d\" aux_info_type_parameter=\"%d\"", ptr->aux_info_type, ptr->aux_info_type_parameter);
}
}
fprintf(trace, ">\n");
if (ptr->default_sample_info_size==0) {
for (i=0; i<ptr->sample_count; i++) {
fprintf(trace, "<SAISize size=\"%d\" />\n", ptr->sample_info_size[i]);
}
}
if (!ptr->size) {
fprintf(trace, "<SAISize size=\"\" />\n");
}
gf_isom_box_dump_done("SampleAuxiliaryInfoSizeBox", a, trace);
return GF_OK;
}
| 0
|
365,704
|
xrdp_mm_chan_data_in(struct trans* trans)
{
struct xrdp_mm* self;
struct stream* s;
int id;
int size;
int error;
if (trans == 0)
{
return 1;
}
self = (struct xrdp_mm*)(trans->callback_data);
s = trans_get_in_s(trans);
if (s == 0)
{
return 1;
}
in_uint32_le(s, id);
in_uint32_le(s, size);
error = trans_force_read(trans, size - 8);
if (error == 0)
{
/* here, the entire message block is read in, process it */
error = xrdp_mm_chan_process_msg(self, trans, s);
}
return error;
}
| 0
|
316,662
|
String HTMLInputElement::resultForDialogSubmit()
{
return m_inputType->resultForDialogSubmit();
}
| 0
|
221,357
|
void GLManager::MakeCurrent() {
::gles2::SetGLContext(gles2_implementation_.get());
if (!decoder_->MakeCurrent())
command_buffer_->service()->SetParseError(error::kLostContext);
}
| 0
|
113,690
|
get_tty_part(term_T *term)
{
#ifdef UNIX
ch_part_T parts[3] = {PART_IN, PART_OUT, PART_ERR};
int i;
for (i = 0; i < 3; ++i)
{
int fd = term->tl_job->jv_channel->ch_part[parts[i]].ch_fd;
if (isatty(fd))
return parts[i];
}
#endif
return PART_IN;
}
| 0
|
378,555
|
static PyObject *Adapter_start_response(AdapterObject *self, PyObject *args)
{
const char *status = NULL;
PyObject *headers = NULL;
PyObject *exc_info = NULL;
PyObject *item = NULL;
PyObject *latin_item = NULL;
char* value = NULL;
if (!self->r) {
PyErr_SetString(PyExc_RuntimeError, "request object has expired");
return NULL;
}
if (!PyArg_ParseTuple(args, "OO|O:start_response",
&item, &headers, &exc_info)) {
return NULL;
}
#if PY_MAJOR_VERSION >= 3
if (PyUnicode_Check(item)) {
latin_item = PyUnicode_AsLatin1String(item);
if (!latin_item) {
PyErr_Format(PyExc_TypeError, "expected byte string object for "
"status, value containing non 'latin-1' characters "
"found");
return NULL;
}
item = latin_item;
}
#endif
if (!PyString_Check(item)) {
PyErr_Format(PyExc_TypeError, "expected byte string object for "
"status, value of type %.200s found",
item->ob_type->tp_name);
Py_XDECREF(latin_item);
return NULL;
}
status = PyString_AsString(item);
if (!PyList_Check(headers)) {
PyErr_SetString(PyExc_TypeError, "response headers must be a list");
Py_XDECREF(latin_item);
return NULL;
}
if (exc_info && exc_info != Py_None) {
if (self->status_line && !self->headers) {
PyObject *type = NULL;
PyObject *value = NULL;
PyObject *traceback = NULL;
if (!PyArg_ParseTuple(exc_info, "OOO", &type,
&value, &traceback)) {
Py_XDECREF(latin_item);
return NULL;
}
Py_INCREF(type);
Py_INCREF(value);
Py_INCREF(traceback);
PyErr_Restore(type, value, traceback);
Py_XDECREF(latin_item);
return NULL;
}
}
else if (self->status_line && !self->headers) {
PyErr_SetString(PyExc_RuntimeError, "headers have already been sent");
Py_XDECREF(latin_item);
return NULL;
}
self->status_line = apr_pstrdup(self->r->pool, status);
value = ap_getword(self->r->pool, &status, ' ');
errno = 0;
self->status = strtol(value, &value, 10);
if (*value || errno == ERANGE) {
PyErr_SetString(PyExc_TypeError, "status value is not an integer");
Py_XDECREF(latin_item);
return NULL;
}
if (!*status) {
PyErr_SetString(PyExc_ValueError, "status message was not supplied");
Py_XDECREF(latin_item);
return NULL;
}
Py_XDECREF(self->headers);
self->headers = headers;
Py_INCREF(self->headers);
Py_XDECREF(latin_item);
return PyObject_GetAttrString((PyObject *)self, "write");
}
| 0
|
205,167
|
int FAST_FUNC sprint_nip6(char *dest, /*const char *pre,*/ const uint8_t *ip)
{
char hexstrbuf[16 * 2];
bin2hex(hexstrbuf, (void*)ip, 16);
return sprintf(dest, /* "%s" */
"%.4s:%.4s:%.4s:%.4s:%.4s:%.4s:%.4s:%.4s",
/* pre, */
hexstrbuf + 0 * 4,
hexstrbuf + 1 * 4,
hexstrbuf + 2 * 4,
hexstrbuf + 3 * 4,
hexstrbuf + 4 * 4,
hexstrbuf + 5 * 4,
hexstrbuf + 6 * 4,
hexstrbuf + 7 * 4
);
}
| 0
|
173,043
|
parse_SET_ETH_DST(char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
return str_to_mac(arg, &ofpact_put_SET_ETH_DST(ofpacts)->mac);
}
| 0
|
197,948
|
ClientUsageTracker* UsageTracker::GetClientTracker(QuotaClient::ID client_id) {
ClientTrackerMap::iterator found = client_tracker_map_.find(client_id);
if (found != client_tracker_map_.end())
return found->second;
return NULL;
}
| 0
|
89,542
|
static void mntput_no_expire(struct mount *mnt)
{
put_again:
#ifdef CONFIG_SMP
br_read_lock(&vfsmount_lock);
if (likely(mnt->mnt_ns)) {
/* shouldn't be the last one */
mnt_add_count(mnt, -1);
br_read_unlock(&vfsmount_lock);
return;
}
br_read_unlock(&vfsmount_lock);
br_write_lock(&vfsmount_lock);
mnt_add_count(mnt, -1);
if (mnt_get_count(mnt)) {
br_write_unlock(&vfsmount_lock);
return;
}
#else
mnt_add_count(mnt, -1);
if (likely(mnt_get_count(mnt)))
return;
br_write_lock(&vfsmount_lock);
#endif
if (unlikely(mnt->mnt_pinned)) {
mnt_add_count(mnt, mnt->mnt_pinned + 1);
mnt->mnt_pinned = 0;
br_write_unlock(&vfsmount_lock);
acct_auto_close_mnt(&mnt->mnt);
goto put_again;
}
list_del(&mnt->mnt_instance);
br_write_unlock(&vfsmount_lock);
mntfree(mnt);
}
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.