idx
int64 | func
string | target
int64 |
|---|---|---|
417,203
|
format_SET_VLAN_VID(const struct ofpact_vlan_vid *a, struct ds *s)
{
ds_put_format(s, "%s%s:%s%"PRIu16, colors.param,
a->push_vlan_if_needed ? "mod_vlan_vid" : "set_vlan_vid",
colors.end, a->vlan_vid);
}
| 0
|
255,036
|
Status GetDeviceForInput(const EagerOperation& op, const EagerContext& ctx,
TensorHandle* tensor_handle, Device** result) {
Device* cpu_device = ctx.HostCPU();
string device_name;
if (tensor_handle->Type() != TensorHandle::LOCAL) {
Device* device = tensor_handle->device();
device_name = device != nullptr ? device->name() : cpu_device->name();
*result = (device == nullptr ? cpu_device : device);
} else if (tensor_handle->dtype == DT_RESOURCE) {
// Use the resource's actual device because it is the device that will
// influence partitioning the multi-device function.
const Tensor* tensor;
// TODO(fishx): Avoid blocking here.
TF_RETURN_IF_ERROR(tensor_handle->Tensor(&tensor));
const ResourceHandle& handle = tensor->flat<ResourceHandle>()(0);
device_name = handle.device();
Device* input_device;
TF_RETURN_IF_ERROR(
ctx.FindDeviceFromName(device_name.c_str(), &input_device));
*result = input_device;
} else {
Device* device = tensor_handle->device();
const bool is_tpu = device != nullptr && device->device_type() == "TPU";
// int32 return values can be placed on TPUs.
const bool use_host_memory =
is_tpu ? MTypeFromDTypeIntsOnDevice(tensor_handle->dtype)
: MTypeFromDType(tensor_handle->dtype);
if (use_host_memory) {
*result = cpu_device;
} else {
// Eager ops executing as functions should have their preferred inputs set
// to the op's device. This allows us to avoid expensive D2H copies if a
// mirror of the tensor already exists on the op's device.
if (!op.is_function() && device != nullptr && device != cpu_device) {
device = absl::get<Device*>(op.Device());
}
*result = (device == nullptr ? cpu_device : device);
}
}
return Status::OK();
}
| 1
|
464,977
|
static inline void *ResizeBlock(void *block,size_t size)
{
void
*memory;
if (block == (void *) NULL)
return(AcquireBlock(size));
memory=AcquireBlock(size);
if (memory == (void *) NULL)
return((void *) NULL);
if (size <= (SizeOfBlock(block)-sizeof(size_t)))
(void) memcpy(memory,block,size);
else
(void) memcpy(memory,block,SizeOfBlock(block)-sizeof(size_t));
memory_pool.allocation+=size;
return(memory);
}
| 0
|
416,909
|
static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
{
struct net *net = sock_net(skb->sk);
struct net *tgt_net = net;
int h, s_h;
int idx = 0, s_idx;
struct net_device *dev;
struct hlist_head *head;
struct nlattr *tb[IFLA_MAX+1];
u32 ext_filter_mask = 0;
const struct rtnl_link_ops *kind_ops = NULL;
unsigned int flags = NLM_F_MULTI;
int master_idx = 0;
int netnsid = -1;
int err;
int hdrlen;
s_h = cb->args[0];
s_idx = cb->args[1];
/* A hack to preserve kernel<->userspace interface.
* The correct header is ifinfomsg. It is consistent with rtnl_getlink.
* However, before Linux v3.9 the code here assumed rtgenmsg and that's
* what iproute2 < v3.9.0 used.
* We can detect the old iproute2. Even including the IFLA_EXT_MASK
* attribute, its netlink message is shorter than struct ifinfomsg.
*/
hdrlen = nlmsg_len(cb->nlh) < sizeof(struct ifinfomsg) ?
sizeof(struct rtgenmsg) : sizeof(struct ifinfomsg);
if (nlmsg_parse(cb->nlh, hdrlen, tb, IFLA_MAX,
ifla_policy, NULL) >= 0) {
if (tb[IFLA_IF_NETNSID]) {
netnsid = nla_get_s32(tb[IFLA_IF_NETNSID]);
tgt_net = get_target_net(skb->sk, netnsid);
if (IS_ERR(tgt_net)) {
tgt_net = net;
netnsid = -1;
}
}
if (tb[IFLA_EXT_MASK])
ext_filter_mask = nla_get_u32(tb[IFLA_EXT_MASK]);
if (tb[IFLA_MASTER])
master_idx = nla_get_u32(tb[IFLA_MASTER]);
if (tb[IFLA_LINKINFO])
kind_ops = linkinfo_to_kind_ops(tb[IFLA_LINKINFO]);
if (master_idx || kind_ops)
flags |= NLM_F_DUMP_FILTERED;
}
for (h = s_h; h < NETDEV_HASHENTRIES; h++, s_idx = 0) {
idx = 0;
head = &tgt_net->dev_index_head[h];
hlist_for_each_entry(dev, head, index_hlist) {
if (link_dump_filtered(dev, master_idx, kind_ops))
goto cont;
if (idx < s_idx)
goto cont;
err = rtnl_fill_ifinfo(skb, dev, net,
RTM_NEWLINK,
NETLINK_CB(cb->skb).portid,
cb->nlh->nlmsg_seq, 0,
flags,
ext_filter_mask, 0, NULL,
netnsid);
if (err < 0) {
if (likely(skb->len))
goto out;
goto out_err;
}
cont:
idx++;
}
}
out:
err = skb->len;
out_err:
cb->args[1] = idx;
cb->args[0] = h;
cb->seq = net->dev_base_seq;
nl_dump_check_consistent(cb, nlmsg_hdr(skb));
if (netnsid >= 0)
put_net(tgt_net);
return err;
}
| 0
|
125,029
|
static i40e_status i40e_del_macvlan_filter(struct i40e_hw *hw, u16 seid,
const u8 *macaddr, int *aq_err)
{
struct i40e_aqc_remove_macvlan_element_data element;
i40e_status status;
memset(&element, 0, sizeof(element));
ether_addr_copy(element.mac_addr, macaddr);
element.vlan_tag = 0;
element.flags = I40E_AQC_MACVLAN_DEL_PERFECT_MATCH;
status = i40e_aq_remove_macvlan(hw, seid, &element, 1, NULL);
*aq_err = hw->aq.asq_last_status;
return status;
}
| 0
|
295,381
|
static long sock_do_ioctl(struct net *net, struct socket *sock,
unsigned int cmd, unsigned long arg)
{
int err;
void __user *argp = (void __user *)arg;
err = sock->ops->ioctl(sock, cmd, arg);
/*
* If this ioctl is unknown try to hand it down
* to the NIC driver.
*/
if (err != -ENOIOCTLCMD)
return err;
if (cmd == SIOCGIFCONF) {
struct ifconf ifc;
if (copy_from_user(&ifc, argp, sizeof(struct ifconf)))
return -EFAULT;
rtnl_lock();
err = dev_ifconf(net, &ifc, sizeof(struct ifreq));
rtnl_unlock();
if (!err && copy_to_user(argp, &ifc, sizeof(struct ifconf)))
err = -EFAULT;
} else {
struct ifreq ifr;
bool need_copyout;
if (copy_from_user(&ifr, argp, sizeof(struct ifreq)))
return -EFAULT;
err = dev_ioctl(net, cmd, &ifr, &need_copyout);
if (!err && need_copyout)
if (copy_to_user(argp, &ifr, sizeof(struct ifreq)))
return -EFAULT;
}
return err;
}
| 0
|
151,389
|
static void __exit ecryptfs_exit(void)
{
int rc;
rc = ecryptfs_destroy_crypto();
if (rc)
printk(KERN_ERR "Failure whilst attempting to destroy crypto; "
"rc = [%d]\n", rc);
ecryptfs_release_messaging();
ecryptfs_destroy_kthread();
do_sysfs_unregistration();
unregister_filesystem(&ecryptfs_fs_type);
ecryptfs_free_kmem_caches();
}
| 0
|
181,030
|
void ChromePasswordManagerClient::ShowPasswordGenerationPopup(
password_manager::ContentPasswordManagerDriver* driver,
const autofill::password_generation::PasswordGenerationUIData& ui_data,
bool is_manually_triggered) {
DCHECK(driver);
gfx::RectF element_bounds_in_top_frame_space =
TransformToRootCoordinates(driver->render_frame_host(), ui_data.bounds);
if (!is_manually_triggered &&
driver->GetPasswordAutofillManager()
->MaybeShowPasswordSuggestionsWithGeneration(
element_bounds_in_top_frame_space, ui_data.text_direction)) {
return;
}
gfx::RectF element_bounds_in_screen_space =
GetBoundsInScreenSpace(element_bounds_in_top_frame_space);
password_manager_.SetGenerationElementAndReasonForForm(
driver, ui_data.password_form, ui_data.generation_element,
is_manually_triggered);
popup_controller_ = PasswordGenerationPopupControllerImpl::GetOrCreate(
popup_controller_, element_bounds_in_screen_space, ui_data.password_form,
ui_data.generation_element, ui_data.max_length, &password_manager_,
driver->AsWeakPtr(), observer_, web_contents(),
web_contents()->GetNativeView());
popup_controller_->Show(PasswordGenerationPopupController::kOfferGeneration);
}
| 0
|
205,227
|
base::TimeDelta GetWakeUpDuration() {
int duration_ms;
if (!base::StringToInt(base::GetFieldTrialParamValue(kWakeUpThrottlingTrial,
kWakeUpDurationParam),
&duration_ms))
return kDefaultWakeUpDuration;
return base::TimeDelta::FromMilliseconds(duration_ms);
}
| 0
|
489,453
|
static JSValue js_sys_crc32(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
{
const u8 *data;
size_t data_size;
if (!argc) return GF_JS_EXCEPTION(ctx);
if (JS_IsString(argv[0])) {
u32 crc=0;
const char *str = JS_ToCString(ctx, argv[0]);
if (str) {
crc = gf_crc_32(str, (u32) strlen(str) );
JS_FreeCString(ctx, str);
}
return JS_NewInt32(ctx, crc );
} else {
data = JS_GetArrayBuffer(ctx, &data_size, argv[0] );
if (!data) return GF_JS_EXCEPTION(ctx);
return JS_NewInt32(ctx, gf_crc_32(data, (u32) data_size) );
}
return GF_JS_EXCEPTION(ctx);
}
| 0
|
430,505
|
httpRead2(http_t *http, /* I - HTTP connection */
char *buffer, /* I - Buffer for data */
size_t length) /* I - Maximum number of bytes */
{
ssize_t bytes; /* Bytes read */
#ifdef HAVE_LIBZ
DEBUG_printf(("httpRead2(http=%p, buffer=%p, length=" CUPS_LLFMT ") coding=%d data_encoding=%d data_remaining=" CUPS_LLFMT, (void *)http, (void *)buffer, CUPS_LLCAST length, http->coding, http->data_encoding, CUPS_LLCAST http->data_remaining));
#else
DEBUG_printf(("httpRead2(http=%p, buffer=%p, length=" CUPS_LLFMT ") data_encoding=%d data_remaining=" CUPS_LLFMT, (void *)http, (void *)buffer, CUPS_LLCAST length, http->data_encoding, CUPS_LLCAST http->data_remaining));
#endif /* HAVE_LIBZ */
if (http == NULL || buffer == NULL)
return (-1);
http->activity = time(NULL);
http->error = 0;
if (length <= 0)
return (0);
#ifdef HAVE_LIBZ
if (http->coding >= _HTTP_CODING_GUNZIP)
{
do
{
if (((z_stream *)http->stream)->avail_in > 0)
{
int zerr; /* Decompressor error */
DEBUG_printf(("2httpRead2: avail_in=%d, avail_out=%d",
(int)((z_stream *)http->stream)->avail_in, (int)length));
((z_stream *)http->stream)->next_out = (Bytef *)buffer;
((z_stream *)http->stream)->avail_out = (uInt)length;
if ((zerr = inflate((z_stream *)http->stream, Z_SYNC_FLUSH)) < Z_OK)
{
DEBUG_printf(("2httpRead2: zerr=%d", zerr));
#ifdef DEBUG
http_debug_hex("2httpRead2", (char *)http->sbuffer, (int)((z_stream *)http->stream)->avail_in);
#endif /* DEBUG */
http->error = EIO;
return (-1);
}
bytes = (ssize_t)(length - ((z_stream *)http->stream)->avail_out);
DEBUG_printf(("2httpRead2: avail_in=%d, avail_out=%d, bytes=%d",
((z_stream *)http->stream)->avail_in, ((z_stream *)http->stream)->avail_out,
(int)bytes));
}
else
bytes = 0;
if (bytes == 0)
{
ssize_t buflen = HTTP_MAX_BUFFER - (ssize_t)((z_stream *)http->stream)->avail_in;
/* Additional bytes for buffer */
if (buflen > 0)
{
if (((z_stream *)http->stream)->avail_in > 0 &&
((z_stream *)http->stream)->next_in > http->sbuffer)
memmove(http->sbuffer, ((z_stream *)http->stream)->next_in, ((z_stream *)http->stream)->avail_in);
((z_stream *)http->stream)->next_in = http->sbuffer;
DEBUG_printf(("1httpRead2: Reading up to %d more bytes of data into "
"decompression buffer.", (int)buflen));
if (http->data_remaining > 0)
{
if (buflen > http->data_remaining)
buflen = (ssize_t)http->data_remaining;
bytes = http_read_buffered(http, (char *)http->sbuffer + ((z_stream *)http->stream)->avail_in, (size_t)buflen);
}
else if (http->data_encoding == HTTP_ENCODING_CHUNKED)
bytes = http_read_chunk(http, (char *)http->sbuffer + ((z_stream *)http->stream)->avail_in, (size_t)buflen);
else
bytes = 0;
if (bytes < 0)
return (bytes);
else if (bytes == 0)
break;
DEBUG_printf(("1httpRead2: Adding " CUPS_LLFMT " bytes to "
"decompression buffer.", CUPS_LLCAST bytes));
http->data_remaining -= bytes;
((z_stream *)http->stream)->avail_in += (uInt)bytes;
if (http->data_remaining <= 0 &&
http->data_encoding == HTTP_ENCODING_CHUNKED)
{
/*
* Read the trailing blank line now...
*/
char len[32]; /* Length string */
httpGets(len, sizeof(len), http);
}
bytes = 0;
}
else
return (0);
}
}
while (bytes == 0);
}
else
#endif /* HAVE_LIBZ */
if (http->data_remaining == 0 && http->data_encoding == HTTP_ENCODING_CHUNKED)
{
if ((bytes = http_read_chunk(http, buffer, length)) > 0)
{
http->data_remaining -= bytes;
if (http->data_remaining <= 0)
{
/*
* Read the trailing blank line now...
*/
char len[32]; /* Length string */
httpGets(len, sizeof(len), http);
}
}
}
else if (http->data_remaining <= 0)
{
/*
* No more data to read...
*/
return (0);
}
else
{
DEBUG_printf(("1httpRead2: Reading up to %d bytes into buffer.",
(int)length));
if (length > (size_t)http->data_remaining)
length = (size_t)http->data_remaining;
if ((bytes = http_read_buffered(http, buffer, length)) > 0)
{
http->data_remaining -= bytes;
if (http->data_remaining <= 0 &&
http->data_encoding == HTTP_ENCODING_CHUNKED)
{
/*
* Read the trailing blank line now...
*/
char len[32]; /* Length string */
httpGets(len, sizeof(len), http);
}
}
}
if (
#ifdef HAVE_LIBZ
(http->coding == _HTTP_CODING_IDENTITY ||
(http->coding >= _HTTP_CODING_GUNZIP && ((z_stream *)http->stream)->avail_in == 0)) &&
#endif /* HAVE_LIBZ */
((http->data_remaining <= 0 &&
http->data_encoding == HTTP_ENCODING_LENGTH) ||
(http->data_encoding == HTTP_ENCODING_CHUNKED && bytes == 0)))
{
#ifdef HAVE_LIBZ
if (http->coding >= _HTTP_CODING_GUNZIP)
http_content_coding_finish(http);
#endif /* HAVE_LIBZ */
if (http->state == HTTP_STATE_POST_RECV)
http->state ++;
else if (http->state == HTTP_STATE_GET_SEND ||
http->state == HTTP_STATE_POST_SEND)
http->state = HTTP_STATE_WAITING;
else
http->state = HTTP_STATE_STATUS;
DEBUG_printf(("1httpRead2: End of content, set state to %s.",
httpStateString(http->state)));
}
return (bytes);
}
| 0
|
412,627
|
pk_transaction_remove_packages (PkTransaction *transaction,
GVariant *params,
GDBusMethodInvocation *context)
{
gboolean ret;
guint length;
gchar **package_ids;
gboolean allow_deps;
gboolean autoremove;
PkBitfield transaction_flags;
_cleanup_error_free_ GError *error = NULL;
_cleanup_free_ gchar *package_ids_temp = NULL;
_cleanup_free_ gchar *transaction_flags_temp = NULL;
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
g_variant_get (params, "(t^a&sbb)",
&transaction_flags,
&package_ids,
&allow_deps,
&autoremove);
package_ids_temp = pk_package_ids_to_string (package_ids);
transaction_flags_temp = pk_transaction_flag_bitfield_to_string (transaction_flags);
g_debug ("RemovePackages method called: %s, %i, %i (transaction_flags: %s)",
package_ids_temp, allow_deps, autoremove, transaction_flags_temp);
/* not implemented yet */
if (!pk_backend_is_implemented (transaction->priv->backend,
PK_ROLE_ENUM_REMOVE_PACKAGES)) {
g_set_error (&error,
PK_TRANSACTION_ERROR,
PK_TRANSACTION_ERROR_NOT_SUPPORTED,
"RemovePackages not supported by backend");
pk_transaction_set_state (transaction, PK_TRANSACTION_STATE_ERROR);
goto out;
}
/* check for length sanity */
length = g_strv_length (package_ids);
if (length > PK_TRANSACTION_MAX_PACKAGES_TO_PROCESS) {
g_set_error (&error,
PK_TRANSACTION_ERROR,
PK_TRANSACTION_ERROR_NUMBER_OF_PACKAGES_INVALID,
"Too many packages to process (%i/%i)",
length, PK_TRANSACTION_MAX_PACKAGES_TO_PROCESS);
pk_transaction_set_state (transaction, PK_TRANSACTION_STATE_ERROR);
goto out;
}
/* check package_ids */
ret = pk_package_ids_check (package_ids);
if (!ret) {
g_set_error (&error,
PK_TRANSACTION_ERROR,
PK_TRANSACTION_ERROR_PACKAGE_ID_INVALID,
"The package id's '%s' are not valid", package_ids_temp);
pk_transaction_set_state (transaction, PK_TRANSACTION_STATE_ERROR);
goto out;
}
/* save so we can run later */
transaction->priv->cached_transaction_flags = transaction_flags;
transaction->priv->cached_package_ids = g_strdupv (package_ids);
transaction->priv->cached_allow_deps = allow_deps;
transaction->priv->cached_autoremove = autoremove;
pk_transaction_set_role (transaction, PK_ROLE_ENUM_REMOVE_PACKAGES);
/* this changed */
pk_transaction_emit_property_changed (transaction,
"TransactionFlags",
g_variant_new_uint64 (transaction_flags));
/* try to get authorization */
ret = pk_transaction_obtain_authorization (transaction,
PK_ROLE_ENUM_REMOVE_PACKAGES,
&error);
if (!ret) {
pk_transaction_set_state (transaction, PK_TRANSACTION_STATE_ERROR);
goto out;
}
out:
pk_transaction_dbus_return (context, error);
}
| 0
|
120,769
|
OpContext(TfLiteContext* context, TfLiteNode* node) {
input = GetInput(context, node, 0);
ref = GetInput(context, node, 1);
}
| 0
|
227,466
|
copy_xml(xmlNode * src)
{
xmlDoc *doc = xmlNewDoc((const xmlChar *)"1.0");
xmlNode *copy = xmlDocCopyNode(src, doc, 1);
xmlDocSetRootElement(doc, copy);
xmlSetTreeDoc(copy, doc);
return copy;
}
| 0
|
511,315
|
getpattern (value, quoted, expandpat)
char *value;
int quoted, expandpat;
{
char *pat, *tword;
WORD_LIST *l;
#if 0
int i;
#endif
/* There is a problem here: how to handle single or double quotes in the
pattern string when the whole expression is between double quotes?
POSIX.2 says that enclosing double quotes do not cause the pattern to
be quoted, but does that leave us a problem with @ and array[@] and their
expansions inside a pattern? */
#if 0
if (expandpat && (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && *tword)
{
i = 0;
pat = string_extract_double_quoted (tword, &i, SX_STRIPDQ);
free (tword);
tword = pat;
}
#endif
/* expand_string_for_rhs () leaves WORD quoted and does not perform
word splitting. */
l = *value ? expand_string_for_rhs (value,
(quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) ? Q_PATQUOTE : quoted,
(int *)NULL, (int *)NULL)
: (WORD_LIST *)0;
pat = string_list (l);
dispose_words (l);
if (pat)
{
tword = quote_string_for_globbing (pat, QGLOB_CVTNULL);
free (pat);
pat = tword;
}
return (pat);
}
| 0
|
326,383
|
static int pick_formats(AVFilterGraph *graph)
{
int i, j, ret;
int change;
do{
change = 0;
for (i = 0; i < graph->filter_count; i++) {
AVFilterContext *filter = graph->filters[i];
if (filter->nb_inputs){
for (j = 0; j < filter->nb_inputs; j++){
if(filter->inputs[j]->in_formats && filter->inputs[j]->in_formats->format_count == 1) {
pick_format(filter->inputs[j], NULL);
change = 1;
}
}
}
if (filter->nb_outputs){
for (j = 0; j < filter->nb_outputs; j++){
if(filter->outputs[j]->in_formats && filter->outputs[j]->in_formats->format_count == 1) {
pick_format(filter->outputs[j], NULL);
change = 1;
}
}
}
if (filter->nb_inputs && filter->nb_outputs && filter->inputs[0]->format>=0) {
for (j = 0; j < filter->nb_outputs; j++) {
if(filter->outputs[j]->format<0) {
pick_format(filter->outputs[j], filter->inputs[0]);
change = 1;
}
}
}
}
}while(change);
for (i = 0; i < graph->filter_count; i++) {
AVFilterContext *filter = graph->filters[i];
for (j = 0; j < filter->nb_inputs; j++)
if ((ret = pick_format(filter->inputs[j], NULL)) < 0)
return ret;
for (j = 0; j < filter->nb_outputs; j++)
if ((ret = pick_format(filter->outputs[j], NULL)) < 0)
return ret;
}
return 0;
}
| 0
|
77,143
|
int IniSection::setValue (const YCPPath&p,const YCPValue&in,int what, int depth)
{
string k = ip->changeCase (p->component_str (depth));
// Find the matching sections.
// If we need to recurse, choose one, creating if necessary
// Otherwise set all the matching values
// creating and deleting if the number of them does not match
if (depth + 1 < p->length())
{
// recurse
pair <IniSectionIdxIterator, IniSectionIdxIterator> r =
isections.equal_range (k);
IniSectionIdxIterator xi = r.first, xe = r.second;
IniIterator si;
if (xi == xe)
{
// not found, need to add it;
y2debug ("Write: adding recursively %s to %s", k.c_str (), p->toString().c_str());
IniSection s (ip, k);
container.push_back (IniContainerElement (s));
isections.insert (IniSectionIndex::value_type (k, --container.end ()));
si = --container.end ();
}
else
{
// there's something, choose last
si = (--xe)->second;
}
return si->s ().setValue (p, in, what, depth+1);
}
else
{
// bottom level
return setMyValue (p, in, what, depth);
}
}
| 0
|
337,937
|
static void cris_alu(DisasContext *dc, int op,
TCGv d, TCGv op_a, TCGv op_b, int size)
{
TCGv tmp;
int writeback;
writeback = 1;
if (op == CC_OP_BOUND || op == CC_OP_BTST)
tmp = tcg_temp_local_new(TCG_TYPE_TL);
else
tmp = tcg_temp_new(TCG_TYPE_TL);
if (op == CC_OP_CMP) {
writeback = 0;
} else if (size == 4) {
tmp = d;
writeback = 0;
}
cris_pre_alu_update_cc(dc, op, op_a, op_b, size);
cris_alu_op_exec(dc, op, tmp, op_a, op_b, size);
cris_update_result(dc, tmp);
/* Writeback. */
if (writeback) {
if (size == 1)
tcg_gen_andi_tl(d, d, ~0xff);
else
tcg_gen_andi_tl(d, d, ~0xffff);
tcg_gen_or_tl(d, d, tmp);
}
if (tmp != d)
tcg_temp_free(tmp);
}
| 1
|
229,181
|
void IPCThreadState::decWeakHandle(int32_t handle)
{
LOG_REMOTEREFS("IPCThreadState::decWeakHandle(%d)\n", handle);
mOut.writeInt32(BC_DECREFS);
mOut.writeInt32(handle);
}
| 0
|
162,165
|
default_class_from_mono_type (MonoType *type)
{
switch (type->type) {
case MONO_TYPE_OBJECT:
return mono_defaults.object_class;
case MONO_TYPE_VOID:
return mono_defaults.void_class;
case MONO_TYPE_BOOLEAN:
return mono_defaults.boolean_class;
case MONO_TYPE_CHAR:
return mono_defaults.char_class;
case MONO_TYPE_I1:
return mono_defaults.sbyte_class;
case MONO_TYPE_U1:
return mono_defaults.byte_class;
case MONO_TYPE_I2:
return mono_defaults.int16_class;
case MONO_TYPE_U2:
return mono_defaults.uint16_class;
case MONO_TYPE_I4:
return mono_defaults.int32_class;
case MONO_TYPE_U4:
return mono_defaults.uint32_class;
case MONO_TYPE_I:
return mono_defaults.int_class;
case MONO_TYPE_U:
return mono_defaults.uint_class;
case MONO_TYPE_I8:
return mono_defaults.int64_class;
case MONO_TYPE_U8:
return mono_defaults.uint64_class;
case MONO_TYPE_R4:
return mono_defaults.single_class;
case MONO_TYPE_R8:
return mono_defaults.double_class;
case MONO_TYPE_STRING:
return mono_defaults.string_class;
default:
g_warning ("default_class_from_mono_type: implement me 0x%02x\n", type->type);
g_assert_not_reached ();
}
return NULL;
}
| 0
|
384,162
|
Status readCString( StringData* out ) {
const void* x = memchr( _buffer + _position, 0, _maxLength - _position );
if ( !x )
return makeError("no end of c-string", _idElem);
uint64_t len = static_cast<uint64_t>( static_cast<const char*>(x) - ( _buffer + _position ) );
StringData data( _buffer + _position, len );
_position += len + 1;
if ( out ) {
*out = data;
}
return Status::OK();
}
| 0
|
311,728
|
const char *sc_get_version(void)
{
return sc_version;
}
| 0
|
436,366
|
euckr_mbc_to_code(const UChar* p, const UChar* end)
{
return onigenc_mbn_mbc_to_code(ONIG_ENCODING_EUC_KR, p, end);
}
| 0
|
398,640
|
gst_aac_parse_check_adts_frame (GstAacParse * aacparse,
const guint8 * data, const guint avail, gboolean drain,
guint * framesize, guint * needed_data)
{
guint crc_size;
*needed_data = 0;
/* Absolute minimum to perform the ADTS syncword,
layer and sampling frequency tests */
if (G_UNLIKELY (avail < 3)) {
*needed_data = 3;
return FALSE;
}
/* Syncword and layer tests */
if ((data[0] == 0xff) && ((data[1] & 0xf6) == 0xf0)) {
/* Sampling frequency test */
if (G_UNLIKELY ((data[2] & 0x3C) >> 2 == 15))
return FALSE;
/* This looks like an ADTS frame header but
we need at least 6 bytes to proceed */
if (G_UNLIKELY (avail < 6)) {
*needed_data = 6;
return FALSE;
}
*framesize = gst_aac_parse_adts_get_frame_len (data);
/* If frame has CRC, it needs 2 bytes
for it at the end of the header */
crc_size = (data[1] & 0x01) ? 0 : 2;
/* CRC size test */
if (*framesize < 7 + crc_size) {
*needed_data = 7 + crc_size;
return FALSE;
}
/* In EOS mode this is enough. No need to examine the data further.
We also relax the check when we have sync, on the assumption that
if we're not looking at random data, we have a much higher chance
to get the correct sync, and this avoids losing two frames when
a single bit corruption happens. */
if (drain || !GST_BASE_PARSE_LOST_SYNC (aacparse)) {
return TRUE;
}
if (*framesize + ADTS_MAX_SIZE > avail) {
/* We have found a possible frame header candidate, but can't be
sure since we don't have enough data to check the next frame */
GST_DEBUG ("NEED MORE DATA: we need %d, available %d",
*framesize + ADTS_MAX_SIZE, avail);
*needed_data = *framesize + ADTS_MAX_SIZE;
gst_base_parse_set_min_frame_size (GST_BASE_PARSE (aacparse),
*framesize + ADTS_MAX_SIZE);
return FALSE;
}
if ((data[*framesize] == 0xff) && ((data[*framesize + 1] & 0xf6) == 0xf0)) {
guint nextlen = gst_aac_parse_adts_get_frame_len (data + (*framesize));
GST_LOG ("ADTS frame found, len: %d bytes", *framesize);
gst_base_parse_set_min_frame_size (GST_BASE_PARSE (aacparse),
nextlen + ADTS_MAX_SIZE);
return TRUE;
}
}
return FALSE;
}
| 0
|
195,934
|
void OnSyntheticGestureCompleted(SyntheticGesture::Result result) {
EXPECT_EQ(SyntheticGesture::GESTURE_FINISHED, result);
gesture_run_loop_->Quit();
}
| 0
|
328,486
|
static AVIOContext * wtvfile_open_sector(int first_sector, uint64_t length, int depth, AVFormatContext *s)
{
AVIOContext *pb;
WtvFile *wf;
uint8_t *buffer;
if (seek_by_sector(s->pb, first_sector, 0) < 0)
return NULL;
wf = av_mallocz(sizeof(WtvFile));
if (!wf)
return NULL;
if (depth == 0) {
wf->sectors = av_malloc(sizeof(uint32_t));
if (!wf->sectors) {
av_free(wf);
return NULL;
}
wf->sectors[0] = first_sector;
wf->nb_sectors = 1;
} else if (depth == 1) {
wf->sectors = av_malloc(WTV_SECTOR_SIZE);
if (!wf->sectors) {
av_free(wf);
return NULL;
}
wf->nb_sectors = read_ints(s->pb, wf->sectors, WTV_SECTOR_SIZE / 4);
} else if (depth == 2) {
uint32_t sectors1[WTV_SECTOR_SIZE / 4];
int nb_sectors1 = read_ints(s->pb, sectors1, WTV_SECTOR_SIZE / 4);
int i;
wf->sectors = av_malloc_array(nb_sectors1, 1 << WTV_SECTOR_BITS);
if (!wf->sectors) {
av_free(wf);
return NULL;
}
wf->nb_sectors = 0;
for (i = 0; i < nb_sectors1; i++) {
if (seek_by_sector(s->pb, sectors1[i], 0) < 0)
break;
wf->nb_sectors += read_ints(s->pb, wf->sectors + i * WTV_SECTOR_SIZE / 4, WTV_SECTOR_SIZE / 4);
}
} else {
av_log(s, AV_LOG_ERROR, "unsupported file allocation table depth (0x%x)\n", depth);
av_free(wf);
return NULL;
}
wf->sector_bits = length & (1ULL<<63) ? WTV_SECTOR_BITS : WTV_BIGSECTOR_BITS;
if (!wf->nb_sectors) {
av_free(wf->sectors);
av_free(wf);
return NULL;
}
if ((int64_t)wf->sectors[wf->nb_sectors - 1] << WTV_SECTOR_BITS > avio_tell(s->pb))
av_log(s, AV_LOG_WARNING, "truncated file\n");
/* check length */
length &= 0xFFFFFFFFFFFF;
if (length > ((int64_t)wf->nb_sectors << wf->sector_bits)) {
av_log(s, AV_LOG_WARNING, "reported file length (0x%"PRIx64") exceeds number of available sectors (0x%"PRIx64")\n", length, (int64_t)wf->nb_sectors << wf->sector_bits);
length = (int64_t)wf->nb_sectors << wf->sector_bits;
}
wf->length = length;
/* seek to initial sector */
wf->position = 0;
if (seek_by_sector(s->pb, wf->sectors[0], 0) < 0) {
av_free(wf->sectors);
av_free(wf);
return NULL;
}
wf->pb_filesystem = s->pb;
buffer = av_malloc(1 << wf->sector_bits);
if (!buffer) {
av_free(wf->sectors);
av_free(wf);
return NULL;
}
pb = avio_alloc_context(buffer, 1 << wf->sector_bits, 0, wf,
wtvfile_read_packet, NULL, wtvfile_seek);
if (!pb) {
av_free(buffer);
av_free(wf->sectors);
av_free(wf);
}
return pb;
}
| 0
|
39,741
|
static struct kwajd_stream *lzh_init(struct mspack_system *sys,
struct mspack_file *in, struct mspack_file *out)
{
struct kwajd_stream *lzh;
if (!sys || !in || !out) return NULL;
if (!(lzh = (struct kwajd_stream *) sys->alloc(sys, sizeof(struct kwajd_stream)))) return NULL;
lzh->sys = sys;
lzh->input = in;
lzh->output = out;
return lzh;
}
| 0
|
302,515
|
bool ethereum_getStandardERC20Amount(const EthereumSignTx *msg,
void **tx_out_amount) {
const ExchangeType *exchange = &msg->exchange_type;
size_t size =
exchange->signed_exchange_response.responseV2.deposit_amount.size;
if (32 < size) return false;
// Make sure the value in data_initial_chunk contains the correct number of
// leading zeroes (as compared to what the exchange contract wants).
char *value = (char *)msg->data_initial_chunk.bytes + 36;
if (memcmp(value,
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
32 - size) != 0)
return false;
*tx_out_amount = value + (32 - size);
return true;
}
| 0
|
307,081
|
PDFiumEngine::SelectionChangeInvalidator::SelectionChangeInvalidator(
PDFiumEngine* engine)
: engine_(engine),
previous_origin_(engine_->GetVisibleRect().point()),
old_selections_(GetVisibleSelections()) {}
| 0
|
142,380
|
static GF_ISOSAPType sap_type_from_nal_type(u8 nal_type) {
switch (nal_type) {
case GF_HEVC_NALU_SLICE_CRA:
return SAP_TYPE_3;
case GF_HEVC_NALU_SLICE_IDR_N_LP:
case GF_HEVC_NALU_SLICE_BLA_N_LP:
return SAP_TYPE_1;
case GF_HEVC_NALU_SLICE_IDR_W_DLP:
case GF_HEVC_NALU_SLICE_BLA_W_DLP:
case GF_HEVC_NALU_SLICE_BLA_W_LP:
return SAP_TYPE_2;
default:
return RAP_NO;
}
}
| 0
|
167,101
|
ZEND_API int zend_update_static_property_double(zend_class_entry *scope, const char *name, int name_length, double value TSRMLS_DC) /* {{{ */
{
zval *tmp;
ALLOC_ZVAL(tmp);
Z_UNSET_ISREF_P(tmp);
Z_SET_REFCOUNT_P(tmp, 0);
ZVAL_DOUBLE(tmp, value);
return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC);
}
/* }}} */
| 0
|
8,488
|
psf_fwrite (const void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf)
{ sf_count_t total = 0 ;
ssize_t count ;
if (psf->virtual_io)
return psf->vio.write (ptr, bytes*items, psf->vio_user_data) / bytes ;
items *= bytes ;
/* Do this check after the multiplication above. */
if (items <= 0)
return 0 ;
while (items > 0)
{ /* Break the writes down to a sensible size. */
count = (items > SENSIBLE_SIZE) ? SENSIBLE_SIZE : items ;
count = write (psf->file.filedes, ((const char*) ptr) + total, count) ;
if (count == -1)
{ if (errno == EINTR)
continue ;
psf_log_syserr (psf, errno) ;
break ;
} ;
if (count == 0)
break ;
total += count ;
items -= count ;
} ;
return total / bytes ;
} /* psf_fwrite */
| 1
|
347,556
|
static Token *tokenize(char *line)
{
char c, *p = line;
enum pp_token_type type;
Token *list = NULL;
Token *t, **tail = &list;
while (*line) {
p = line;
if (*p == '%') {
p++;
if (*p == '+' && !nasm_isdigit(p[1])) {
p++;
type = TOK_PASTE;
} else if (nasm_isdigit(*p) ||
((*p == '-' || *p == '+') && nasm_isdigit(p[1]))) {
do {
p++;
}
while (nasm_isdigit(*p));
type = TOK_PREPROC_ID;
} else if (*p == '{') {
p++;
while (*p) {
if (*p == '}')
break;
p[-1] = *p;
p++;
}
if (*p != '}')
nasm_error(ERR_WARNING | ERR_PASS1,
"unterminated %%{ construct");
p[-1] = '\0';
if (*p)
p++;
type = TOK_PREPROC_ID;
} else if (*p == '[') {
int lvl = 1;
line += 2; /* Skip the leading %[ */
p++;
while (lvl && (c = *p++)) {
switch (c) {
case ']':
lvl--;
break;
case '%':
if (*p == '[')
lvl++;
break;
case '\'':
case '\"':
case '`':
p = nasm_skip_string(p - 1) + 1;
break;
default:
break;
}
}
p--;
if (*p)
*p++ = '\0';
if (lvl)
nasm_error(ERR_NONFATAL|ERR_PASS1,
"unterminated %%[ construct");
type = TOK_INDIRECT;
} else if (*p == '?') {
type = TOK_PREPROC_Q; /* %? */
p++;
if (*p == '?') {
type = TOK_PREPROC_QQ; /* %?? */
p++;
}
} else if (*p == '!') {
type = TOK_PREPROC_ID;
p++;
if (isidchar(*p)) {
do {
p++;
}
while (isidchar(*p));
} else if (*p == '\'' || *p == '\"' || *p == '`') {
p = nasm_skip_string(p);
if (*p)
p++;
else
nasm_error(ERR_NONFATAL|ERR_PASS1,
"unterminated %%! string");
} else {
/* %! without string or identifier */
type = TOK_OTHER; /* Legacy behavior... */
}
} else if (isidchar(*p) ||
((*p == '!' || *p == '%' || *p == '$') &&
isidchar(p[1]))) {
do {
p++;
}
while (isidchar(*p));
type = TOK_PREPROC_ID;
} else {
type = TOK_OTHER;
if (*p == '%')
p++;
}
} else if (isidstart(*p) || (*p == '$' && isidstart(p[1]))) {
type = TOK_ID;
p++;
while (*p && isidchar(*p))
p++;
} else if (*p == '\'' || *p == '"' || *p == '`') {
/*
* A string token.
*/
type = TOK_STRING;
p = nasm_skip_string(p);
if (*p) {
p++;
} else {
nasm_error(ERR_WARNING|ERR_PASS1, "unterminated string");
/* Handling unterminated strings by UNV */
/* type = -1; */
}
} else if (p[0] == '$' && p[1] == '$') {
type = TOK_OTHER; /* TOKEN_BASE */
p += 2;
} else if (isnumstart(*p)) {
bool is_hex = false;
bool is_float = false;
bool has_e = false;
char c, *r;
/*
* A numeric token.
*/
if (*p == '$') {
p++;
is_hex = true;
}
for (;;) {
c = *p++;
if (!is_hex && (c == 'e' || c == 'E')) {
has_e = true;
if (*p == '+' || *p == '-') {
/*
* e can only be followed by +/- if it is either a
* prefixed hex number or a floating-point number
*/
p++;
is_float = true;
}
} else if (c == 'H' || c == 'h' || c == 'X' || c == 'x') {
is_hex = true;
} else if (c == 'P' || c == 'p') {
is_float = true;
if (*p == '+' || *p == '-')
p++;
} else if (isnumchar(c))
; /* just advance */
else if (c == '.') {
/*
* we need to deal with consequences of the legacy
* parser, like "1.nolist" being two tokens
* (TOK_NUMBER, TOK_ID) here; at least give it
* a shot for now. In the future, we probably need
* a flex-based scanner with proper pattern matching
* to do it as well as it can be done. Nothing in
* the world is going to help the person who wants
* 0x123.p16 interpreted as two tokens, though.
*/
r = p;
while (*r == '_')
r++;
if (nasm_isdigit(*r) || (is_hex && nasm_isxdigit(*r)) ||
(!is_hex && (*r == 'e' || *r == 'E')) ||
(*r == 'p' || *r == 'P')) {
p = r;
is_float = true;
} else
break; /* Terminate the token */
} else
break;
}
p--; /* Point to first character beyond number */
if (p == line+1 && *line == '$') {
type = TOK_OTHER; /* TOKEN_HERE */
} else {
if (has_e && !is_hex) {
/* 1e13 is floating-point, but 1e13h is not */
is_float = true;
}
type = is_float ? TOK_FLOAT : TOK_NUMBER;
}
} else if (nasm_isspace(*p)) {
type = TOK_WHITESPACE;
p = nasm_skip_spaces(p);
/*
* Whitespace just before end-of-line is discarded by
* pretending it's a comment; whitespace just before a
* comment gets lumped into the comment.
*/
if (!*p || *p == ';') {
type = TOK_COMMENT;
while (*p)
p++;
}
} else if (*p == ';') {
type = TOK_COMMENT;
while (*p)
p++;
} else {
/*
* Anything else is an operator of some kind. We check
* for all the double-character operators (>>, <<, //,
* %%, <=, >=, ==, !=, <>, &&, ||, ^^), but anything
* else is a single-character operator.
*/
type = TOK_OTHER;
if ((p[0] == '>' && p[1] == '>') ||
(p[0] == '<' && p[1] == '<') ||
(p[0] == '/' && p[1] == '/') ||
(p[0] == '<' && p[1] == '=') ||
(p[0] == '>' && p[1] == '=') ||
(p[0] == '=' && p[1] == '=') ||
(p[0] == '!' && p[1] == '=') ||
(p[0] == '<' && p[1] == '>') ||
(p[0] == '&' && p[1] == '&') ||
(p[0] == '|' && p[1] == '|') ||
(p[0] == '^' && p[1] == '^')) {
p++;
}
p++;
}
/* Handling unterminated string by UNV */
/*if (type == -1)
{
*tail = t = new_Token(NULL, TOK_STRING, line, p-line+1);
t->text[p-line] = *line;
tail = &t->next;
}
else */
if (type != TOK_COMMENT) {
*tail = t = new_Token(NULL, type, line, p - line);
tail = &t->next;
}
line = p;
}
return list;
}
| 1
|
322,582
|
int nbd_client_session_co_readv(NbdClientSession *client, int64_t sector_num,
int nb_sectors, QEMUIOVector *qiov)
{
int offset = 0;
int ret;
while (nb_sectors > NBD_MAX_SECTORS) {
ret = nbd_co_readv_1(client, sector_num,
NBD_MAX_SECTORS, qiov, offset);
if (ret < 0) {
return ret;
}
offset += NBD_MAX_SECTORS * 512;
sector_num += NBD_MAX_SECTORS;
nb_sectors -= NBD_MAX_SECTORS;
}
return nbd_co_readv_1(client, sector_num, nb_sectors, qiov, offset);
}
| 0
|
496,515
|
std::string index(Vertex_iterator v) const
{ return VI(v,verbose); }
| 0
|
38,439
|
static boolean ReadComment(j_decompress_ptr jpeg_info)
{
ErrorManager
*error_manager;
ExceptionInfo
*exception;
Image
*image;
register unsigned char
*p;
register ssize_t
i;
size_t
length;
StringInfo
*comment;
/*
Determine length of comment.
*/
error_manager=(ErrorManager *) jpeg_info->client_data;
exception=error_manager->exception;
image=error_manager->image;
length=(size_t) ((size_t) GetCharacter(jpeg_info) << 8);
length+=GetCharacter(jpeg_info);
if (length <= 2)
return(TRUE);
length-=2;
comment=BlobToStringInfo((const void *) NULL,length);
if (comment == (StringInfo *) NULL)
{
(void) ThrowMagickException(exception,GetMagickModule(),
ResourceLimitError,"MemoryAllocationFailed","`%s'",image->filename);
return(FALSE);
}
/*
Read comment.
*/
error_manager->profile=comment;
p=GetStringInfoDatum(comment);
for (i=0; i < (ssize_t) GetStringInfoLength(comment); i++)
*p++=(unsigned char) GetCharacter(jpeg_info);
*p='\0';
error_manager->profile=NULL;
p=GetStringInfoDatum(comment);
(void) SetImageProperty(image,"comment",(const char *) p,exception);
comment=DestroyStringInfo(comment);
return(TRUE);
}
| 0
|
462,757
|
TEST_F(QueryPlannerTest, NoMutationsForCollscan) {
params.options = QueryPlannerParams::KEEP_MUTATIONS;
runQuery(fromjson(""));
assertSolutionExists("{cscan: {dir: 1}}");
}
| 0
|
479,384
|
CImg<Tuchar> get_RGBtoCMY() const {
return CImg<Tfloat>(*this,false).RGBtoCMY();
}
| 0
|
91,695
|
void MainWindow::setPreviewScale(int scale)
{
LOG_DEBUG() << scale;
switch (scale) {
case 360:
ui->actionPreview360->setChecked(true);
break;
case 540:
ui->actionPreview540->setChecked(true);
break;
case 720:
ui->actionPreview720->setChecked(true);
break;
default:
ui->actionPreviewNone->setChecked(true);
break;
}
MLT.setPreviewScale(scale);
MLT.refreshConsumer();
}
| 0
|
38,041
|
void mg_unhex(const char *buf, size_t len, unsigned char *to) {
size_t i;
for (i = 0; i < len; i += 2) {
to[i >> 1] = (unsigned char) mg_unhexn(&buf[i], 2);
}
}
| 0
|
47,980
|
static void xfrm_byidx_resize(struct net *net, int total)
{
unsigned int hmask = net->xfrm.policy_idx_hmask;
unsigned int nhashmask = xfrm_new_hash_mask(hmask);
unsigned int nsize = (nhashmask + 1) * sizeof(struct hlist_head);
struct hlist_head *oidx = net->xfrm.policy_byidx;
struct hlist_head *nidx = xfrm_hash_alloc(nsize);
int i;
if (!nidx)
return;
spin_lock_bh(&net->xfrm.xfrm_policy_lock);
for (i = hmask; i >= 0; i--)
xfrm_idx_hash_transfer(oidx + i, nidx, nhashmask);
net->xfrm.policy_byidx = nidx;
net->xfrm.policy_idx_hmask = nhashmask;
spin_unlock_bh(&net->xfrm.xfrm_policy_lock);
xfrm_hash_free(oidx, (hmask + 1) * sizeof(struct hlist_head));
}
| 0
|
298,733
|
sockaddr_getport(struct sockaddr *sa)
{
if (sa->sa_family == AF_INET) {
return ntohs(((struct sockaddr_in *)sa)->sin_port);
} else if (sa->sa_family == AF_INET6) {
return ntohs(((struct sockaddr_in6 *)sa)->sin6_port);
} else {
return 0;
}
}
| 0
|
311,031
|
jsonb_to_recordset(PG_FUNCTION_ARGS)
{
return populate_recordset_worker(fcinfo, "jsonb_to_recordset", false);
}
| 0
|
410,906
|
static int bufsize_v4l2_create(struct v4l2_create_buffers32 __user *up,
u32 *size)
{
if (!access_ok(VERIFY_READ, up, sizeof(*up)))
return -EFAULT;
return __bufsize_v4l2_format(&up->format, size);
}
| 0
|
447,297
|
struct stats dx_show_entries(struct dx_hash_info *hinfo, struct inode *dir,
struct dx_entry *entries, int levels)
{
unsigned blocksize = dir->i_sb->s_blocksize;
unsigned count = dx_get_count(entries), names = 0, space = 0, i;
unsigned bcount = 0;
struct buffer_head *bh;
printk("%i indexed blocks...\n", count);
for (i = 0; i < count; i++, entries++)
{
ext4_lblk_t block = dx_get_block(entries);
ext4_lblk_t hash = i ? dx_get_hash(entries): 0;
u32 range = i < count - 1? (dx_get_hash(entries + 1) - hash): ~hash;
struct stats stats;
printk("%s%3u:%03u hash %8x/%8x ",levels?"":" ", i, block, hash, range);
bh = ext4_bread(NULL,dir, block, 0);
if (!bh || IS_ERR(bh))
continue;
stats = levels?
dx_show_entries(hinfo, dir, ((struct dx_node *) bh->b_data)->entries, levels - 1):
dx_show_leaf(dir, hinfo, (struct ext4_dir_entry_2 *)
bh->b_data, blocksize, 0);
names += stats.names;
space += stats.space;
bcount += stats.bcount;
brelse(bh);
}
if (bcount)
printk(KERN_DEBUG "%snames %u, fullness %u (%u%%)\n",
levels ? "" : " ", names, space/bcount,
(space/bcount)*100/blocksize);
return (struct stats) { names, space, bcount};
}
| 0
|
19,650
|
static void send_version_response ( int fd , version_ack_t ack , uint32_t payload , int userid , struct query * q ) {
char out [ 9 ] ;
switch ( ack ) {
case VERSION_ACK : strncpy ( out , "VACK" , sizeof ( out ) ) ;
break ;
case VERSION_NACK : strncpy ( out , "VNAK" , sizeof ( out ) ) ;
break ;
case VERSION_FULL : strncpy ( out , "VFUL" , sizeof ( out ) ) ;
break ;
}
out [ 4 ] = ( ( payload >> 24 ) & 0xff ) ;
out [ 5 ] = ( ( payload >> 16 ) & 0xff ) ;
out [ 6 ] = ( ( payload >> 8 ) & 0xff ) ;
out [ 7 ] = ( ( payload ) & 0xff ) ;
out [ 8 ] = userid & 0xff ;
write_dns ( fd , q , out , sizeof ( out ) , users [ userid ] . downenc ) ;
}
| 0
|
208,843
|
void InputMethodIMM32::OnDidChangeFocusedClient(TextInputClient* focused_before,
TextInputClient* focused) {
if (IsWindowFocused(focused)) {
OnTextInputTypeChanged(focused);
UpdateIMEState();
OnCaretBoundsChanged(focused);
}
}
| 0
|
30,771
|
static gboolean gtkui_connections_scroll ( gpointer data ) {
gint * type = data ;
if ( type == NULL ) return FALSE ;
if ( * type == 1 && textview1 && endmark1 && textview2 && endmark2 ) {
gtk_text_view_scroll_to_mark ( GTK_TEXT_VIEW ( textview1 ) , endmark1 , 0 , FALSE , 0 , 0 ) ;
gtk_text_view_scroll_to_mark ( GTK_TEXT_VIEW ( textview2 ) , endmark2 , 0 , FALSE , 0 , 0 ) ;
}
else if ( textview3 && endmark3 ) {
gtk_text_view_scroll_to_mark ( GTK_TEXT_VIEW ( textview3 ) , endmark3 , 0 , FALSE , 0 , 0 ) ;
}
return ( FALSE ) ;
}
| 0
|
498,765
|
smb2_queryfs(const unsigned int xid, struct cifs_tcon *tcon,
struct cifs_sb_info *cifs_sb, struct kstatfs *buf)
{
struct smb2_query_info_rsp *rsp;
struct smb2_fs_full_size_info *info = NULL;
struct kvec rsp_iov = {NULL, 0};
int buftype = CIFS_NO_BUFFER;
int rc;
rc = smb2_query_info_compound(xid, tcon, "",
FILE_READ_ATTRIBUTES,
FS_FULL_SIZE_INFORMATION,
SMB2_O_INFO_FILESYSTEM,
sizeof(struct smb2_fs_full_size_info),
&rsp_iov, &buftype, cifs_sb);
if (rc)
goto qfs_exit;
rsp = (struct smb2_query_info_rsp *)rsp_iov.iov_base;
buf->f_type = SMB2_SUPER_MAGIC;
info = (struct smb2_fs_full_size_info *)(
le16_to_cpu(rsp->OutputBufferOffset) + (char *)rsp);
rc = smb2_validate_iov(le16_to_cpu(rsp->OutputBufferOffset),
le32_to_cpu(rsp->OutputBufferLength),
&rsp_iov,
sizeof(struct smb2_fs_full_size_info));
if (!rc)
smb2_copy_fs_info_to_kstatfs(info, buf);
qfs_exit:
free_rsp_buf(buftype, rsp_iov.iov_base);
return rc;
}
| 0
|
350,820
|
read_yin_list(struct lys_module *module, struct lys_node *parent, struct lyxml_elem *yin, int options,
struct unres_schema *unres)
{
struct ly_ctx *ctx = module->ctx;
struct lys_node *retval, *node;
struct lys_node_list *list;
struct lyxml_elem *sub, *next, root, uniq;
int r;
int c_tpdf = 0, c_must = 0, c_uniq = 0, c_ftrs = 0, c_ext = 0;
int f_ordr = 0, f_max = 0, f_min = 0;
const char *value;
char *auxs;
unsigned long val;
void *reallocated;
/* init */
memset(&root, 0, sizeof root);
memset(&uniq, 0, sizeof uniq);
list = calloc(1, sizeof *list);
LY_CHECK_ERR_RETURN(!list, LOGMEM(ctx), NULL);
list->nodetype = LYS_LIST;
list->prev = (struct lys_node *)list;
retval = (struct lys_node *)list;
if (read_yin_common(module, parent, retval, LYEXT_PAR_NODE, yin,
OPT_IDENT | OPT_MODULE | ((options & LYS_PARSE_OPT_CFG_IGNORE) ? OPT_CFG_IGNORE :
(options & LYS_PARSE_OPT_CFG_NOINHERIT) ? OPT_CFG_PARSE : OPT_CFG_PARSE | OPT_CFG_INHERIT),
unres)) {
goto error;
}
LOGDBG(LY_LDGYIN, "parsing %s statement \"%s\"", yin->name, retval->name);
/* insert the node into the schema tree */
if (lys_node_addchild(parent, lys_main_module(module), retval, options)) {
goto error;
}
/* process list's specific children */
LY_TREE_FOR_SAFE(yin->child, next, sub) {
if (strcmp(sub->ns->value, LY_NSYIN)) {
/* extension */
YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ext, retval->ext_size, "extensions", "list", error);
c_ext++;
continue;
/* data statements */
} else if (!strcmp(sub->name, "container") ||
!strcmp(sub->name, "leaf-list") ||
!strcmp(sub->name, "leaf") ||
!strcmp(sub->name, "list") ||
!strcmp(sub->name, "choice") ||
!strcmp(sub->name, "uses") ||
!strcmp(sub->name, "grouping") ||
!strcmp(sub->name, "anyxml") ||
!strcmp(sub->name, "anydata") ||
!strcmp(sub->name, "action") ||
!strcmp(sub->name, "notification")) {
lyxml_unlink_elem(ctx, sub, 2);
lyxml_add_child(ctx, &root, sub);
/* array counters */
} else if (!strcmp(sub->name, "key")) {
/* check cardinality 0..1 */
if (list->keys_size) {
LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_LYS, retval, sub->name, list->name);
goto error;
}
/* count the number of keys */
GETVAL(ctx, value, sub, "value");
list->keys_str = lydict_insert(ctx, value, 0);
while ((value = strpbrk(value, " \t\n"))) {
list->keys_size++;
while (isspace(*value)) {
value++;
}
}
list->keys_size++;
list->keys = calloc(list->keys_size, sizeof *list->keys);
LY_CHECK_ERR_GOTO(!list->keys, LOGMEM(ctx), error);
if (lyp_yin_parse_subnode_ext(module, retval, LYEXT_PAR_NODE, sub, LYEXT_SUBSTMT_KEY, 0, unres)) {
goto error;
}
lyxml_free(ctx, sub);
} else if (!strcmp(sub->name, "unique")) {
YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_uniq, list->unique_size, "uniques", "list", error);
c_uniq++;
lyxml_unlink_elem(ctx, sub, 2);
lyxml_add_child(ctx, &uniq, sub);
} else if (!strcmp(sub->name, "typedef")) {
YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_tpdf, list->tpdf_size, "typedefs", "list", error);
c_tpdf++;
} else if (!strcmp(sub->name, "must")) {
YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_must, list->must_size, "musts", "list", error);
c_must++;
} else if (!strcmp(sub->name, "if-feature")) {
YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ftrs, retval->iffeature_size, "if-features", "list", error);
c_ftrs++;
/* optional stetments */
} else if (!strcmp(sub->name, "ordered-by")) {
if (f_ordr) {
LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_LYS, retval, sub->name, yin->name);
goto error;
}
/* just checking the flags in llist is not sufficient, we would
* allow multiple ordered-by statements with the "system" value
*/
f_ordr = 1;
if (list->flags & LYS_CONFIG_R) {
/* RFC 6020, 7.7.5 - ignore ordering when the list represents
* state data
*/
lyxml_free(ctx, sub);
continue;
}
GETVAL(ctx, value, sub, "value");
if (!strcmp(value, "user")) {
list->flags |= LYS_USERORDERED;
} else if (strcmp(value, "system")) {
LOGVAL(ctx, LYE_INARG, LY_VLOG_LYS, retval, value, sub->name);
goto error;
} /* else system is the default value, so we can ignore it */
if (lyp_yin_parse_subnode_ext(module, retval, LYEXT_PAR_NODE, sub, LYEXT_SUBSTMT_ORDEREDBY, 0, unres)) {
goto error;
}
lyxml_free(ctx, sub);
} else if (!strcmp(sub->name, "min-elements")) {
if (f_min) {
LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_LYS, retval, sub->name, yin->name);
goto error;
}
f_min = 1;
GETVAL(ctx, value, sub, "value");
while (isspace(value[0])) {
value++;
}
/* convert it to uint32_t */
errno = 0;
auxs = NULL;
val = strtoul(value, &auxs, 10);
if (*auxs || value[0] == '-' || errno || val > UINT32_MAX) {
LOGVAL(ctx, LYE_INARG, LY_VLOG_LYS, retval, value, sub->name);
goto error;
}
list->min = (uint32_t) val;
if (list->max && (list->min > list->max)) {
LOGVAL(ctx, LYE_INARG, LY_VLOG_LYS, retval, value, sub->name);
LOGVAL(ctx, LYE_SPEC, LY_VLOG_PREV, NULL, "\"min-elements\" is bigger than \"max-elements\".");
lyxml_free(ctx, sub);
goto error;
}
if (lyp_yin_parse_subnode_ext(module, retval, LYEXT_PAR_NODE, sub, LYEXT_SUBSTMT_MIN, 0, unres)) {
goto error;
}
lyxml_free(ctx, sub);
} else if (!strcmp(sub->name, "max-elements")) {
if (f_max) {
LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_LYS, retval, sub->name, yin->name);
goto error;
}
f_max = 1;
GETVAL(ctx, value, sub, "value");
while (isspace(value[0])) {
value++;
}
if (!strcmp(value, "unbounded")) {
list->max = 0;;
} else {
/* convert it to uint32_t */
errno = 0;
auxs = NULL;
val = strtoul(value, &auxs, 10);
if (*auxs || value[0] == '-' || errno || val == 0 || val > UINT32_MAX) {
LOGVAL(ctx, LYE_INARG, LY_VLOG_LYS, retval, value, sub->name);
goto error;
}
list->max = (uint32_t) val;
if (list->min > list->max) {
LOGVAL(ctx, LYE_INARG, LY_VLOG_LYS, retval, value, sub->name);
LOGVAL(ctx, LYE_SPEC, LY_VLOG_PREV, NULL, "\"max-elements\" is smaller than \"min-elements\".");
goto error;
}
}
if (lyp_yin_parse_subnode_ext(module, retval, LYEXT_PAR_NODE, sub, LYEXT_SUBSTMT_MAX, 0, unres)) {
goto error;
}
lyxml_free(ctx, sub);
} else if (!strcmp(sub->name, "when")) {
if (list->when) {
LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_LYS, retval, sub->name, yin->name);
goto error;
}
list->when = read_yin_when(module, sub, unres);
if (!list->when) {
lyxml_free(ctx, sub);
goto error;
}
lyxml_free(ctx, sub);
} else {
LOGVAL(ctx, LYE_INSTMT, LY_VLOG_LYS, retval, sub->name);
goto error;
}
}
/* check - if list is configuration, key statement is mandatory
* (but only if we are not in a grouping or augment, then the check is deferred) */
for (node = retval; node && !(node->nodetype & (LYS_GROUPING | LYS_AUGMENT | LYS_EXT)); node = node->parent);
if (!node && (list->flags & LYS_CONFIG_W) && !list->keys_str) {
LOGVAL(ctx, LYE_MISSCHILDSTMT, LY_VLOG_LYS, retval, "key", "list");
goto error;
}
/* middle part - process nodes with cardinality of 0..n except the data nodes */
if (c_tpdf) {
list->tpdf = calloc(c_tpdf, sizeof *list->tpdf);
LY_CHECK_ERR_GOTO(!list->tpdf, LOGMEM(ctx), error);
}
if (c_must) {
list->must = calloc(c_must, sizeof *list->must);
LY_CHECK_ERR_GOTO(!list->must, LOGMEM(ctx), error);
}
if (c_ftrs) {
list->iffeature = calloc(c_ftrs, sizeof *list->iffeature);
LY_CHECK_ERR_GOTO(!list->iffeature, LOGMEM(ctx), error);
}
if (c_ext) {
/* some extensions may be already present from the substatements */
reallocated = realloc(retval->ext, (c_ext + retval->ext_size) * sizeof *retval->ext);
LY_CHECK_ERR_GOTO(!reallocated, LOGMEM(ctx), error);
retval->ext = reallocated;
/* init memory */
memset(&retval->ext[retval->ext_size], 0, c_ext * sizeof *retval->ext);
}
LY_TREE_FOR_SAFE(yin->child, next, sub) {
if (strcmp(sub->ns->value, LY_NSYIN)) {
/* extension */
r = lyp_yin_fill_ext(retval, LYEXT_PAR_NODE, 0, 0, module, sub, &retval->ext, &retval->ext_size, unres);
if (r) {
goto error;
}
} else if (!strcmp(sub->name, "typedef")) {
r = fill_yin_typedef(module, retval, sub, &list->tpdf[list->tpdf_size], unres);
list->tpdf_size++;
if (r) {
goto error;
}
} else if (!strcmp(sub->name, "if-feature")) {
r = fill_yin_iffeature(retval, 0, sub, &list->iffeature[list->iffeature_size], unres);
list->iffeature_size++;
if (r) {
goto error;
}
} else if (!strcmp(sub->name, "must")) {
r = fill_yin_must(module, sub, &list->must[list->must_size], unres);
list->must_size++;
if (r) {
goto error;
}
}
}
lyp_reduce_ext_list(&retval->ext, retval->ext_size, c_ext + retval->ext_size);
/* last part - process data nodes */
LY_TREE_FOR_SAFE(root.child, next, sub) {
if (!strcmp(sub->name, "container")) {
node = read_yin_container(module, retval, sub, options, unres);
} else if (!strcmp(sub->name, "leaf-list")) {
node = read_yin_leaflist(module, retval, sub, options, unres);
} else if (!strcmp(sub->name, "leaf")) {
node = read_yin_leaf(module, retval, sub, options, unres);
} else if (!strcmp(sub->name, "list")) {
node = read_yin_list(module, retval, sub, options, unres);
} else if (!strcmp(sub->name, "choice")) {
node = read_yin_choice(module, retval, sub, options, unres);
} else if (!strcmp(sub->name, "uses")) {
node = read_yin_uses(module, retval, sub, options, unres);
} else if (!strcmp(sub->name, "grouping")) {
node = read_yin_grouping(module, retval, sub, options, unres);
} else if (!strcmp(sub->name, "anyxml")) {
node = read_yin_anydata(module, retval, sub, LYS_ANYXML, options, unres);
} else if (!strcmp(sub->name, "anydata")) {
node = read_yin_anydata(module, retval, sub, LYS_ANYDATA, options, unres);
} else if (!strcmp(sub->name, "action")) {
node = read_yin_rpc_action(module, retval, sub, options, unres);
} else if (!strcmp(sub->name, "notification")) {
node = read_yin_notif(module, retval, sub, options, unres);
} else {
LOGINT(ctx);
goto error;
}
if (!node) {
goto error;
}
lyxml_free(ctx, sub);
}
if (list->keys_str) {
if (unres_schema_add_node(module, unres, list, UNRES_LIST_KEYS, NULL) == -1) {
goto error;
}
} /* else config false list without a key, key_str presence in case of config true is checked earlier */
/* process unique statements */
if (c_uniq) {
list->unique = calloc(c_uniq, sizeof *list->unique);
LY_CHECK_ERR_GOTO(!list->unique, LOGMEM(ctx), error);
LY_TREE_FOR_SAFE(uniq.child, next, sub) {
r = fill_yin_unique(module, retval, sub, &list->unique[list->unique_size], unres);
list->unique_size++;
if (r) {
goto error;
}
if (lyp_yin_parse_subnode_ext(module, retval, LYEXT_PAR_NODE, sub,
LYEXT_SUBSTMT_UNIQUE, list->unique_size - 1, unres)) {
goto error;
}
lyxml_free(ctx, sub);
}
}
/* check XPath dependencies */
if (!(ctx->models.flags & LY_CTX_TRUSTED) && (list->when || list->must)) {
if (options & LYS_PARSE_OPT_INGRP) {
if (lyxp_node_check_syntax(retval)) {
goto error;
}
} else {
if (unres_schema_add_node(module, unres, retval, UNRES_XPATH, NULL) == -1) {
goto error;
}
}
}
for (r = 0; r < retval->ext_size; ++r) {
/* set flag, which represent LYEXT_OPT_VALID */
if (retval->ext[r]->flags & LYEXT_OPT_VALID) {
retval->flags |= LYS_VALID_EXT;
if (retval->ext[r]->flags & LYEXT_OPT_VALID_SUBTREE) {
retval->flags |= LYS_VALID_EXT_SUBTREE;
break;
}
}
}
return retval;
error:
lys_node_free(ctx, retval, NULL, 0);
while (root.child) {
lyxml_free(ctx, root.child);
}
while (uniq.child) {
lyxml_free(ctx, uniq.child);
}
return NULL;
}
| 1
|
64,297
|
GF_Err cslg_box_size(GF_Box *s)
{
GF_CompositionToDecodeBox *ptr = (GF_CompositionToDecodeBox *)s;
ptr->size += 20;
return GF_OK;
}
| 0
|
177,817
|
void Wait(size_t number_of_messages) {
while (intercepted_messages_.size() < number_of_messages) {
loop_.reset(new base::RunLoop);
loop_->Run();
}
}
| 0
|
47,642
|
gid_t enc_untrusted_getgid() {
return EnsureInitializedAndDispatchSyscall(asylo::system_call::kSYS_getgid);
}
| 0
|
273,332
|
free_global ()
{
xfree(clamd_local);
xfree(clamd_ip);
xfree(clamd_port);
xfree(clamd_curr_ip);
xfree(redirect_url);
if (patterns != NULL) {
while (pattc > 0) {
pattc--;
regfree(&patterns[pattc].regexv);
xfree(patterns[pattc].pattern);
}
free(patterns);
patterns = NULL;
}
}
| 0
|
187,732
|
static int wifi_get_multicast_id(wifi_handle handle, const char *name, const char *group)
{
GetMulticastIdCommand cmd(handle, name, group);
int res = cmd.requestResponse();
if (res < 0)
return res;
else
return cmd.getId();
}
| 0
|
217,191
|
void WebGLRenderingContextBase::Reshape(int width, int height) {
if (isContextLost())
return;
GLint buffer = 0;
if (IsWebGL2OrHigher()) {
ContextGL()->GetIntegerv(GL_PIXEL_UNPACK_BUFFER_BINDING, &buffer);
if (buffer) {
ContextGL()->BindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
}
}
GLint max_size = std::min(max_texture_size_, max_renderbuffer_size_);
GLint max_width = std::min(max_size, max_viewport_dims_[0]);
GLint max_height = std::min(max_size, max_viewport_dims_[1]);
width = Clamp(width, 1, max_width);
height = Clamp(height, 1, max_height);
const int kMaxArea = 4096 * 4096;
int current_area = width * height;
if (current_area > kMaxArea) {
float scale_factor =
sqrtf(static_cast<float>(kMaxArea) / static_cast<float>(current_area));
width = std::max(1, static_cast<int>(width * scale_factor));
height = std::max(1, static_cast<int>(height * scale_factor));
}
GetDrawingBuffer()->Resize(IntSize(width, height));
if (buffer) {
ContextGL()->BindBuffer(GL_PIXEL_UNPACK_BUFFER,
static_cast<GLuint>(buffer));
}
}
| 0
|
72,992
|
SCTP_STATIC int sctp_bind(struct sock *sk, struct sockaddr *addr, int addr_len)
{
int retval = 0;
sctp_lock_sock(sk);
SCTP_DEBUG_PRINTK("sctp_bind(sk: %p, addr: %p, addr_len: %d)\n",
sk, addr, addr_len);
/* Disallow binding twice. */
if (!sctp_sk(sk)->ep->base.bind_addr.port)
retval = sctp_do_bind(sk, (union sctp_addr *)addr,
addr_len);
else
retval = -EINVAL;
sctp_release_sock(sk);
return retval;
}
| 0
|
114,330
|
static void claim_allocations(int cpu, struct sched_domain *sd)
{
struct sd_data *sdd = sd->private;
WARN_ON_ONCE(*per_cpu_ptr(sdd->sd, cpu) != sd);
*per_cpu_ptr(sdd->sd, cpu) = NULL;
if (atomic_read(&(*per_cpu_ptr(sdd->sg, cpu))->ref))
*per_cpu_ptr(sdd->sg, cpu) = NULL;
if (atomic_read(&(*per_cpu_ptr(sdd->sgp, cpu))->ref))
*per_cpu_ptr(sdd->sgp, cpu) = NULL;
}
| 0
|
293,045
|
bool Socket::writeChunk( char *buffout, int len, int timeout){
std::stringstream stm;
stm << std::hex << len;
std::string hexs (stm.str());
//int lw;
hexs += "\r\n";
#ifdef NETDEBUG
std::cerr << thread_id << "writeChunk size=" << hexs << std::endl;
#endif
if(writeString(hexs.c_str()) && writeToSocket(buffout,len,0,timeout) && writeString("\r\n"))
return true;
return false;
};
| 0
|
20,337
|
static int dissect_h225_Endpoint ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h225_Endpoint , Endpoint_sequence ) ;
return offset ;
}
| 0
|
99,582
|
build_history_completion_array ()
{
register int i, j;
HIST_ENTRY **hlist;
char **tokens;
/* First, clear out the current dynamic history completion list. */
if (harry_size)
{
strvec_dispose (history_completion_array);
history_completion_array = (char **)NULL;
harry_size = 0;
harry_len = 0;
}
/* Next, grovel each line of history, making each shell-sized token
a separate entry in the history_completion_array. */
hlist = history_list ();
if (hlist)
{
for (i = 0; hlist[i]; i++)
;
for ( --i; i >= 0; i--)
{
/* Separate each token, and place into an array. */
tokens = history_tokenize (hlist[i]->line);
for (j = 0; tokens && tokens[j]; j++)
{
if (harry_len + 2 > harry_size)
history_completion_array = strvec_resize (history_completion_array, harry_size += 10);
history_completion_array[harry_len++] = tokens[j];
history_completion_array[harry_len] = (char *)NULL;
}
free (tokens);
}
/* Sort the complete list of tokens. */
if (dabbrev_expand_active == 0)
qsort (history_completion_array, harry_len, sizeof (char *), (QSFUNC *)strvec_strcmp);
}
}
| 0
|
149,036
|
static int __init set_init_cxt(void)
{
struct cred *cred = (struct cred *)current->real_cred;
struct aa_task_cxt *cxt;
cxt = aa_alloc_task_context(GFP_KERNEL);
if (!cxt)
return -ENOMEM;
cxt->profile = aa_get_profile(root_ns->unconfined);
cred_cxt(cred) = cxt;
return 0;
}
| 0
|
450,472
|
static void nfs4_setclientid_done(struct rpc_task *task, void *calldata)
{
struct nfs4_setclientid *sc = calldata;
if (task->tk_status == 0)
sc->sc_cred = get_rpccred(task->tk_rqstp->rq_cred);
}
| 0
|
422,618
|
ews_backend_child_added (ECollectionBackend *backend,
ESource *child_source)
{
ESource *collection_source;
const gchar *extension_name;
gboolean is_mail = FALSE;
collection_source = e_backend_get_source (E_BACKEND (backend));
extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
is_mail |= e_source_has_extension (child_source, extension_name);
extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY;
is_mail |= e_source_has_extension (child_source, extension_name);
extension_name = E_SOURCE_EXTENSION_MAIL_TRANSPORT;
is_mail |= e_source_has_extension (child_source, extension_name);
/* Synchronize mail-related user with the collection identity. */
extension_name = E_SOURCE_EXTENSION_AUTHENTICATION;
if (is_mail && e_source_has_extension (child_source, extension_name)) {
ESourceAuthentication *auth_child_extension;
ESourceCollection *collection_extension;
extension_name = E_SOURCE_EXTENSION_COLLECTION;
collection_extension = e_source_get_extension (
collection_source, extension_name);
extension_name = E_SOURCE_EXTENSION_AUTHENTICATION;
auth_child_extension = e_source_get_extension (
child_source, extension_name);
e_binding_bind_property (
collection_extension, "identity",
auth_child_extension, "user",
G_BINDING_SYNC_CREATE);
}
/* We track EWS folders in a hash table by folder ID. */
extension_name = E_SOURCE_EXTENSION_EWS_FOLDER;
if (e_source_has_extension (child_source, extension_name)) {
ESourceEwsFolder *extension;
gchar *folder_id;
extension = e_source_get_extension (
child_source, extension_name);
folder_id = e_source_ews_folder_dup_id (extension);
if (folder_id != NULL) {
ews_backend_folders_insert (
E_EWS_BACKEND (backend),
folder_id, child_source);
g_free (folder_id);
}
}
/* Chain up to parent's child_added() method. */
E_COLLECTION_BACKEND_CLASS (e_ews_backend_parent_class)->
child_added (backend, child_source);
}
| 0
|
503,887
|
Http::Status ConnectionImpl::dispatch(Buffer::Instance& data) {
// Add self to the Dispatcher's tracked object stack.
ScopeTrackerScopeState scope(this, connection_.dispatcher());
ENVOY_CONN_LOG(trace, "parsing {} bytes", connection_, data.length());
// Make sure that dispatching_ is set to false after dispatching, even when
// http_parser exits early with an error code.
Cleanup cleanup([this]() { dispatching_ = false; });
ASSERT(!dispatching_);
ASSERT(codec_status_.ok());
ASSERT(buffered_body_.length() == 0);
dispatching_ = true;
onDispatch(data);
if (maybeDirectDispatch(data)) {
return Http::okStatus();
}
// Always resume before dispatch.
parser_->resume();
ssize_t total_parsed = 0;
if (data.length() > 0) {
current_dispatching_buffer_ = &data;
while (data.length() > 0) {
auto slice = data.frontSlice();
dispatching_slice_already_drained_ = false;
auto statusor_parsed = dispatchSlice(static_cast<const char*>(slice.mem_), slice.len_);
if (!statusor_parsed.ok()) {
return statusor_parsed.status();
}
if (!dispatching_slice_already_drained_) {
ASSERT(statusor_parsed.value() <= slice.len_);
data.drain(statusor_parsed.value());
}
total_parsed += statusor_parsed.value();
if (parser_->getStatus() != ParserStatus::Success) {
// Parse errors trigger an exception in dispatchSlice so we are guaranteed to be paused at
// this point.
ASSERT(parser_->getStatus() == ParserStatus::Paused);
break;
}
}
current_dispatching_buffer_ = nullptr;
dispatchBufferedBody();
} else {
auto result = dispatchSlice(nullptr, 0);
if (!result.ok()) {
return result.status();
}
}
ASSERT(buffered_body_.length() == 0);
ENVOY_CONN_LOG(trace, "parsed {} bytes", connection_, total_parsed);
// If an upgrade has been handled and there is body data or early upgrade
// payload to send on, send it on.
maybeDirectDispatch(data);
return Http::okStatus();
}
| 0
|
166,705
|
static char** Sys_ConcatenateFileLists( char **list0, char **list1 )
{
int totalLength = 0;
char** cat = NULL, **dst, **src;
totalLength += Sys_CountFileList(list0);
totalLength += Sys_CountFileList(list1);
/* Create new list. */
dst = cat = Z_Malloc( ( totalLength + 1 ) * sizeof( char* ) );
/* Copy over lists. */
if (list0)
{
for (src = list0; *src; src++, dst++)
*dst = *src;
}
if (list1)
{
for (src = list1; *src; src++, dst++)
*dst = *src;
}
*dst = NULL;
if (list0) Z_Free( list0 );
if (list1) Z_Free( list1 );
return cat;
}
| 0
|
480,178
|
static void sortGlobResult(glob_t *result, size_t prefix_len, const char *dformat) {
/* TODO */
}
| 0
|
12,103
|
PHP_METHOD(Phar, addFromString)
{
char *localname, *cont_str;
size_t localname_len, cont_len;
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &localname, &localname_len, &cont_str, &cont_len) == FAILURE) {
return;
}
phar_add_file(&(phar_obj->archive), localname, localname_len, cont_str, cont_len, NULL);
}
| 1
|
62,334
|
xfs_da_grow_inode_int(
struct xfs_da_args *args,
xfs_fileoff_t *bno,
int count)
{
struct xfs_trans *tp = args->trans;
struct xfs_inode *dp = args->dp;
int w = args->whichfork;
xfs_drfsbno_t nblks = dp->i_d.di_nblocks;
struct xfs_bmbt_irec map, *mapp;
int nmap, error, got, i, mapi;
/*
* Find a spot in the file space to put the new block.
*/
error = xfs_bmap_first_unused(tp, dp, count, bno, w);
if (error)
return error;
/*
* Try mapping it in one filesystem block.
*/
nmap = 1;
ASSERT(args->firstblock != NULL);
error = xfs_bmapi_write(tp, dp, *bno, count,
xfs_bmapi_aflag(w)|XFS_BMAPI_METADATA|XFS_BMAPI_CONTIG,
args->firstblock, args->total, &map, &nmap,
args->flist);
if (error)
return error;
ASSERT(nmap <= 1);
if (nmap == 1) {
mapp = ↦
mapi = 1;
} else if (nmap == 0 && count > 1) {
xfs_fileoff_t b;
int c;
/*
* If we didn't get it and the block might work if fragmented,
* try without the CONTIG flag. Loop until we get it all.
*/
mapp = kmem_alloc(sizeof(*mapp) * count, KM_SLEEP);
for (b = *bno, mapi = 0; b < *bno + count; ) {
nmap = MIN(XFS_BMAP_MAX_NMAP, count);
c = (int)(*bno + count - b);
error = xfs_bmapi_write(tp, dp, b, c,
xfs_bmapi_aflag(w)|XFS_BMAPI_METADATA,
args->firstblock, args->total,
&mapp[mapi], &nmap, args->flist);
if (error)
goto out_free_map;
if (nmap < 1)
break;
mapi += nmap;
b = mapp[mapi - 1].br_startoff +
mapp[mapi - 1].br_blockcount;
}
} else {
mapi = 0;
mapp = NULL;
}
/*
* Count the blocks we got, make sure it matches the total.
*/
for (i = 0, got = 0; i < mapi; i++)
got += mapp[i].br_blockcount;
if (got != count || mapp[0].br_startoff != *bno ||
mapp[mapi - 1].br_startoff + mapp[mapi - 1].br_blockcount !=
*bno + count) {
error = XFS_ERROR(ENOSPC);
goto out_free_map;
}
/* account for newly allocated blocks in reserved blocks total */
args->total -= dp->i_d.di_nblocks - nblks;
out_free_map:
if (mapp != &map)
kmem_free(mapp);
return error;
}
| 0
|
213,991
|
static int share_access_to_flags(u32 share_access)
{
return share_access == NFS4_SHARE_ACCESS_READ ? RD_STATE : WR_STATE;
}
| 0
|
400,013
|
void
launch_descriptor_downloads(int purpose,
smartlist_t *downloadable,
const routerstatus_t *source, time_t now)
{
const or_options_t *options = get_options();
const char *descname;
const int fetch_microdesc = (purpose == DIR_PURPOSE_FETCH_MICRODESC);
int n_downloadable = smartlist_len(downloadable);
int i, n_per_request, max_dl_per_req;
const char *req_plural = "", *rtr_plural = "";
int pds_flags = PDS_RETRY_IF_NO_SERVERS;
tor_assert(fetch_microdesc || purpose == DIR_PURPOSE_FETCH_SERVERDESC);
descname = fetch_microdesc ? "microdesc" : "routerdesc";
if (!n_downloadable)
return;
if (!directory_fetches_dir_info_early(options)) {
if (n_downloadable >= MAX_DL_TO_DELAY) {
log_debug(LD_DIR,
"There are enough downloadable %ss to launch requests.",
descname);
} else {
/* should delay */
if ((last_descriptor_download_attempted +
options->TestingClientMaxIntervalWithoutRequest) > now)
return;
if (last_descriptor_download_attempted) {
log_info(LD_DIR,
"There are not many downloadable %ss, but we've "
"been waiting long enough (%d seconds). Downloading.",
descname,
(int)(now-last_descriptor_download_attempted));
} else {
log_info(LD_DIR,
"There are not many downloadable %ss, but we haven't "
"tried downloading descriptors recently. Downloading.",
descname);
}
}
}
if (!authdir_mode_any_nonhidserv(options)) {
/* If we wind up going to the authorities, we want to only open one
* connection to each authority at a time, so that we don't overload
* them. We do this by setting PDS_NO_EXISTING_SERVERDESC_FETCH
* regardless of whether we're a cache or not.
*
* Setting this flag can make initiate_descriptor_downloads() ignore
* requests. We need to make sure that we do in fact call
* update_router_descriptor_downloads() later on, once the connections
* have succeeded or failed.
*/
pds_flags |= fetch_microdesc ?
PDS_NO_EXISTING_MICRODESC_FETCH :
PDS_NO_EXISTING_SERVERDESC_FETCH;
}
n_per_request = CEIL_DIV(n_downloadable, MIN_REQUESTS);
max_dl_per_req = max_dl_per_request(options, purpose);
if (n_per_request > max_dl_per_req)
n_per_request = max_dl_per_req;
if (n_per_request < MIN_DL_PER_REQUEST)
n_per_request = MIN_DL_PER_REQUEST;
if (n_downloadable > n_per_request)
req_plural = rtr_plural = "s";
else if (n_downloadable > 1)
rtr_plural = "s";
log_info(LD_DIR,
"Launching %d request%s for %d %s%s, %d at a time",
CEIL_DIV(n_downloadable, n_per_request), req_plural,
n_downloadable, descname, rtr_plural, n_per_request);
smartlist_sort_digests(downloadable);
for (i=0; i < n_downloadable; i += n_per_request) {
initiate_descriptor_downloads(source, purpose,
downloadable, i, i+n_per_request,
pds_flags);
}
last_descriptor_download_attempted = now;
| 0
|
104,609
|
MONGO_EXPORT void bson_iterator_code_scope( const bson_iterator *i, bson *scope ) {
if ( bson_iterator_type( i ) == BSON_CODEWSCOPE ) {
int code_len;
bson_little_endian32( &code_len, bson_iterator_value( i )+4 );
bson_init_data( scope, ( void * )( bson_iterator_value( i )+8+code_len ) );
_bson_reset( scope );
scope->finished = 1;
}
else {
bson_empty( scope );
}
}
| 0
|
338,387
|
int check_intra_pred8x8_mode_emuedge(int mode, int mb_x, int mb_y)
{
switch (mode) {
case DC_PRED8x8:
return check_dc_pred8x8_mode(mode, mb_x, mb_y);
case VERT_PRED8x8:
return !mb_y ? DC_127_PRED8x8 : mode;
case HOR_PRED8x8:
return !mb_x ? DC_129_PRED8x8 : mode;
case PLANE_PRED8x8: /* TM */
return check_tm_pred8x8_mode(mode, mb_x, mb_y);
}
return mode;
}
| 1
|
334,047
|
rdt_parse_packet (AVFormatContext *ctx, PayloadContext *rdt, AVStream *st,
AVPacket *pkt, uint32_t *timestamp,
const uint8_t *buf, int len, uint16_t rtp_seq, int flags)
{
int seq = 1, res;
AVIOContext pb;
if (!rdt->rmctx)
return AVERROR(EINVAL);
if (rdt->audio_pkt_cnt == 0) {
int pos;
ffio_init_context(&pb, buf, len, 0, NULL, NULL, NULL, NULL);
flags = (flags & RTP_FLAG_KEY) ? 2 : 0;
res = ff_rm_parse_packet (rdt->rmctx, &pb, st, rdt->rmst[st->index], len, pkt,
&seq, flags, *timestamp);
pos = avio_tell(&pb);
if (res < 0)
return res;
if (res > 0) {
if (st->codec->codec_id == AV_CODEC_ID_AAC) {
memcpy (rdt->buffer, buf + pos, len - pos);
rdt->rmctx->pb = avio_alloc_context (rdt->buffer, len - pos, 0,
NULL, NULL, NULL, NULL);
}
goto get_cache;
}
} else {
get_cache:
rdt->audio_pkt_cnt =
ff_rm_retrieve_cache (rdt->rmctx, rdt->rmctx->pb,
st, rdt->rmst[st->index], pkt);
if (rdt->audio_pkt_cnt == 0 &&
st->codec->codec_id == AV_CODEC_ID_AAC)
av_freep(&rdt->rmctx->pb);
}
pkt->stream_index = st->index;
pkt->pts = *timestamp;
return rdt->audio_pkt_cnt > 0;
}
| 1
|
381,430
|
cmd_getattr (assuan_context_t ctx, char *line)
{
ctrl_t ctrl = assuan_get_pointer (ctx);
int rc;
const char *keyword;
if ((rc = open_card (ctrl, NULL)))
return rc;
keyword = line;
for (; *line && !spacep (line); line++)
;
if (*line)
*line++ = 0;
/* (We ignore any garbage for now.) */
/* FIXME: Applications should not return sensitive data if the card
is locked. */
rc = app_getattr (ctrl->app_ctx, ctrl, keyword);
TEST_CARD_REMOVAL (ctrl, rc);
return rc;
}
| 0
|
379,531
|
static int ZEND_FASTCALL ZEND_SEND_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
if ((opline->extended_value == ZEND_DO_FCALL_BY_NAME)
&& ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->op2.u.opline_num)) {
return ZEND_SEND_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
return zend_send_by_var_helper_SPEC_VAR(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
| 0
|
244,788
|
static void reflectedTreatNullAsNullStringTreatUndefinedAsNullStringURLAttrAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
TestObjectV8Internal::reflectedTreatNullAsNullStringTreatUndefinedAsNullStringURLAttrAttributeGetter(info);
TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
}
| 0
|
48,483
|
int update_dataps()
{
struct timeval tv;
struct AP_info *ap_cur;
struct NA_info *na_cur;
int sec, usec, diff, ps;
float pause;
gettimeofday(&tv, NULL);
ap_cur = G.ap_end;
while( ap_cur != NULL )
{
sec = (tv.tv_sec - ap_cur->tv.tv_sec);
usec = (tv.tv_usec - ap_cur->tv.tv_usec);
pause = (((float)(sec*1000000.0f + usec))/(1000000.0f));
if( pause > 2.0f )
{
diff = ap_cur->nb_data - ap_cur->nb_data_old;
ps = (int)(((float)diff)/pause);
ap_cur->nb_dataps = ps;
ap_cur->nb_data_old = ap_cur->nb_data;
gettimeofday(&(ap_cur->tv), NULL);
}
ap_cur = ap_cur->prev;
}
na_cur = G.na_1st;
while( na_cur != NULL )
{
sec = (tv.tv_sec - na_cur->tv.tv_sec);
usec = (tv.tv_usec - na_cur->tv.tv_usec);
pause = (((float)(sec*1000000.0f + usec))/(1000000.0f));
if( pause > 2.0f )
{
diff = na_cur->ack - na_cur->ack_old;
ps = (int)(((float)diff)/pause);
na_cur->ackps = ps;
na_cur->ack_old = na_cur->ack;
gettimeofday(&(na_cur->tv), NULL);
}
na_cur = na_cur->next;
}
return(0);
}
| 0
|
290,269
|
int ff_h263_decode_mba ( MpegEncContext * s ) {
int i , mb_pos ;
for ( i = 0 ;
i < 6 ;
i ++ ) {
if ( s -> mb_num - 1 <= ff_mba_max [ i ] ) break ;
}
mb_pos = get_bits ( & s -> gb , ff_mba_length [ i ] ) ;
s -> mb_x = mb_pos % s -> mb_width ;
s -> mb_y = mb_pos / s -> mb_width ;
return mb_pos ;
}
| 0
|
494,020
|
TinyGLTF() : bin_data_(nullptr), bin_size_(0), is_binary_(false) {}
| 0
|
138,266
|
netsnmp_init_mib_internals(void)
{
register struct tok *tp;
register int b, i;
int max_modc;
if (tree_head)
return;
/*
* Set up hash list of pre-defined tokens
*/
memset(buckets, 0, sizeof(buckets));
for (tp = tokens; tp->name; tp++) {
tp->hash = name_hash(tp->name);
b = BUCKET(tp->hash);
if (buckets[b])
tp->next = buckets[b]; /* BUG ??? */
buckets[b] = tp;
}
/*
* Initialise other internal structures
*/
max_modc = sizeof(module_map) / sizeof(module_map[0]) - 1;
for (i = 0; i < max_modc; ++i)
module_map[i].next = &(module_map[i + 1]);
module_map[max_modc].next = NULL;
module_map_head = module_map;
memset(nbuckets, 0, sizeof(nbuckets));
memset(tbuckets, 0, sizeof(tbuckets));
memset(tclist, 0, MAXTC * sizeof(struct tc));
build_translation_table();
init_tree_roots(); /* Set up initial roots */
/*
* Relies on 'add_mibdir' having set up the modules
*/
}
| 0
|
465,837
|
static void fuse_sb_defaults(struct super_block *sb)
{
sb->s_magic = FUSE_SUPER_MAGIC;
sb->s_op = &fuse_super_operations;
sb->s_xattr = fuse_xattr_handlers;
sb->s_maxbytes = MAX_LFS_FILESIZE;
sb->s_time_gran = 1;
sb->s_export_op = &fuse_export_operations;
sb->s_iflags |= SB_I_IMA_UNVERIFIABLE_SIGNATURE;
if (sb->s_user_ns != &init_user_ns)
sb->s_iflags |= SB_I_UNTRUSTED_MOUNTER;
sb->s_flags &= ~(SB_NOSEC | SB_I_VERSION);
/*
* If we are not in the initial user namespace posix
* acls must be translated.
*/
if (sb->s_user_ns != &init_user_ns)
sb->s_xattr = fuse_no_acl_xattr_handlers;
}
| 0
|
304,207
|
void _single_copy_from_wide( SQLCHAR *out, LPCWSTR in, int len )
{
while ( len >= 0 )
{
*out = *in;
out++;
in++;
len --;
}
}
| 0
|
480,514
|
void DL_Dxf::addLayer(DL_CreationInterface* creationInterface) {
// correct some invalid attributes for layers:
attrib = creationInterface->getAttributes();
if (attrib.getColor()==256 || attrib.getColor()==0) {
attrib.setColor(7);
}
if (attrib.getWidth()<0) {
attrib.setWidth(1);
}
std::string linetype = attrib.getLinetype();
std::transform(linetype.begin(), linetype.end(), linetype.begin(), ::toupper);
if (linetype=="BYLAYER" || linetype=="BYBLOCK") {
attrib.setLinetype("CONTINUOUS");
}
// add layer
std::string name = getStringValue(2, "");
if (name.length()==0) {
return;
}
creationInterface->addLayer(DL_LayerData(name, getIntValue(70, 0)));
}
| 0
|
226,659
|
void GetLocalFileSizeOnBlockingPool(const FilePath& local_file,
GDataFileError* error,
int64* file_size) {
DCHECK(error);
DCHECK(file_size);
*file_size = 0;
*error = file_util::GetFileSize(local_file, file_size) ?
GDATA_FILE_OK :
GDATA_FILE_ERROR_NOT_FOUND;
}
| 0
|
249,602
|
int main(int argc, char **argv) {
testing::InitGoogleTest(&argc, argv); // Removes gtest-specific args.
CommandLine::Init(argc, argv);
CommandLine* cmd_line = CommandLine::ForCurrentProcess();
DCHECK(cmd_line);
CommandLine::SwitchMap switches = cmd_line->GetSwitches();
for (CommandLine::SwitchMap::const_iterator it = switches.begin();
it != switches.end(); ++it) {
if (it->first == "test_video_data") {
test_video_data = it->second.c_str();
continue;
}
LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second;
}
#if defined(OS_WIN)
base::ShadowingAtExitManager at_exit_manager;
gfx::InitializeGLBindings(gfx::kGLImplementationEGLGLES2);
gfx::GLSurface::InitializeOneOff();
{
scoped_refptr<gfx::GLSurface> surface(
gfx::GLSurface::CreateOffscreenGLSurface(false, gfx::Size(1, 1)));
scoped_refptr<gfx::GLContext> context(
gfx::GLContext::CreateGLContext(NULL, surface.get(),
gfx::PreferIntegratedGpu));
context->MakeCurrent(surface.get());
}
DXVAVideoDecodeAccelerator::PreSandboxInitialization();
#endif // OS_WIN
return RUN_ALL_TESTS();
}
| 0
|
302,569
|
**/
static const CImg<Tuchar>& flag_LUT256() {
static CImg<Tuchar> colormap;
cimg::mutex(8);
if (!colormap) {
colormap.assign(1,4,1,3,(T)0);
colormap[0] = colormap[1] = colormap[5] = colormap[9] = colormap[10] = 255;
colormap.resize(1,256,1,3,0,2);
}
cimg::mutex(8,0);
return colormap;
| 0
|
361,013
|
is_user_switch_enabled (GSWindow *window)
{
return window->priv->user_switch_enabled;
}
| 0
|
263,735
|
static inline void write_gdt_entry(struct desc_struct *dt, int entry,
void *desc, int type)
{
PVOP_VCALL4(cpu.write_gdt_entry, dt, entry, desc, type);
}
| 0
|
27,746
|
static inline uint32_t vmsvga_fifo_read ( struct vmsvga_state_s * s ) {
return le32_to_cpu ( vmsvga_fifo_read_raw ( s ) ) ;
}
| 0
|
211,589
|
static int __gup_device_huge(unsigned long pfn, unsigned long addr,
unsigned long end, struct page **pages, int *nr)
{
int nr_start = *nr;
struct dev_pagemap *pgmap = NULL;
do {
struct page *page = pfn_to_page(pfn);
pgmap = get_dev_pagemap(pfn, pgmap);
if (unlikely(!pgmap)) {
undo_dev_pagemap(nr, nr_start, pages);
return 0;
}
SetPageReferenced(page);
pages[*nr] = page;
get_page(page);
(*nr)++;
pfn++;
} while (addr += PAGE_SIZE, addr != end);
if (pgmap)
put_dev_pagemap(pgmap);
return 1;
}
| 0
|
371,297
|
uint8_t* ZRtp::getSasHash() {
return sasHash;
}
| 0
|
177,068
|
int equalizer_get_center_frequency(equalizer_context_t *context __unused, int32_t band)
{
ALOGV("%s: band: %d", __func__, band);
return (equalizer_band_freq_range[band][0] +
equalizer_band_freq_range[band][1]) / 2;
}
| 0
|
16,884
|
static TRBCCode xhci_disable_ep ( XHCIState * xhci , unsigned int slotid , unsigned int epid ) {
XHCISlot * slot ;
XHCIEPContext * epctx ;
trace_usb_xhci_ep_disable ( slotid , epid ) ;
assert ( slotid >= 1 && slotid <= xhci -> numslots ) ;
assert ( epid >= 1 && epid <= 31 ) ;
slot = & xhci -> slots [ slotid - 1 ] ;
if ( ! slot -> eps [ epid - 1 ] ) {
DPRINTF ( "xhci: slot %d ep %d already disabled\n" , slotid , epid ) ;
return CC_SUCCESS ;
}
xhci_ep_nuke_xfers ( xhci , slotid , epid , 0 ) ;
epctx = slot -> eps [ epid - 1 ] ;
if ( epctx -> nr_pstreams ) {
xhci_free_streams ( epctx ) ;
}
if ( xhci -> dcbaap_low || xhci -> dcbaap_high ) {
xhci_set_ep_state ( xhci , epctx , NULL , EP_DISABLED ) ;
}
timer_free ( epctx -> kick_timer ) ;
g_free ( epctx ) ;
slot -> eps [ epid - 1 ] = NULL ;
return CC_SUCCESS ;
}
| 0
|
510,728
|
bool ha_partition::setup_engine_array(MEM_ROOT *mem_root)
{
uint i;
uchar *buff;
handlerton **engine_array;
DBUG_ASSERT(!m_file);
DBUG_ENTER("ha_partition::setup_engine_array");
engine_array= (handlerton **) my_alloca(m_tot_parts * sizeof(handlerton*));
if (!engine_array)
DBUG_RETURN(true);
buff= (uchar *) (m_file_buffer + PAR_ENGINES_OFFSET);
for (i= 0; i < m_tot_parts; i++)
{
engine_array[i]= ha_resolve_by_legacy_type(ha_thd(),
(enum legacy_db_type)
*(buff + i));
if (!engine_array[i])
goto err;
}
if (!(m_engine_array= (plugin_ref*)
alloc_root(&m_mem_root, m_tot_parts * sizeof(plugin_ref))))
goto err;
for (i= 0; i < m_tot_parts; i++)
m_engine_array[i]= ha_lock_engine(NULL, engine_array[i]);
my_afree(engine_array);
if (create_handlers(mem_root))
{
clear_handler_file();
DBUG_RETURN(true);
}
DBUG_RETURN(false);
err:
my_afree(engine_array);
DBUG_RETURN(true);
}
| 0
|
457,007
|
static int io_fadvise(struct io_kiocb *req, struct io_kiocb **nxt,
bool force_nonblock)
{
struct io_fadvise *fa = &req->fadvise;
int ret;
if (force_nonblock) {
switch (fa->advice) {
case POSIX_FADV_NORMAL:
case POSIX_FADV_RANDOM:
case POSIX_FADV_SEQUENTIAL:
break;
default:
return -EAGAIN;
}
}
ret = vfs_fadvise(req->file, fa->offset, fa->len, fa->advice);
if (ret < 0)
req_set_fail_links(req);
io_cqring_add_event(req, ret);
io_put_req_find_next(req, nxt);
return 0;
}
| 0
|
403,718
|
PHP_FUNCTION( msgfmt_parse )
{
char *source;
size_t source_len;
MSG_FORMAT_METHOD_INIT_VARS;
/* Parse parameters. */
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Os",
&object, MessageFormatter_ce_ptr, &source, &source_len ) == FAILURE )
{
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
"msgfmt_parse: unable to parse input params", 0 );
RETURN_FALSE;
}
/* Fetch the object. */
MSG_FORMAT_METHOD_FETCH_OBJECT;
msgfmt_do_parse(mfo, source, source_len, return_value);
}
| 0
|
148,496
|
PJ_DEF(int) pj_scan_stricmp( pj_scanner *scanner, const char *s, int len)
{
if (scanner->curptr + len > scanner->end) {
pj_scan_syntax_err(scanner);
return -1;
}
return pj_ansi_strnicmp(scanner->curptr, s, len);
}
| 0
|
426,707
|
int main(int argc, char **argv) {
const char *host = (argc > 1) ? argv[1] : "";
const char *port = (argc > 2) ? argv[2] : "amqp";
int err;
broker_t b = {0};
b.proactor = pn_proactor();
queues_init(&b.queues);
b.container_id = argv[0];
b.threads = 4;
b.ssl_domain = pn_ssl_domain(PN_SSL_MODE_SERVER);
err = SET_CREDENTIALS(b.ssl_domain, "tserver");
if (err) {
printf("Failed to set up server certificate: %s, private key: %s\n", CERTIFICATE("tserver"), SSL_FILE("tserver-private-key.pem"));
}
{
/* Listen on addr */
char addr[PN_MAX_ADDR];
pn_proactor_addr(addr, sizeof(addr), host, port);
pn_proactor_listen(b.proactor, pn_listener(), addr, 16);
}
{
/* Start n-1 threads */
pthread_t* threads = (pthread_t*)calloc(sizeof(pthread_t), b.threads);
size_t i;
for (i = 0; i < b.threads-1; ++i) {
pthread_create(&threads[i], NULL, broker_thread, &b);
}
broker_thread(&b); /* Use the main thread too. */
/* Join the other threads */
for (i = 0; i < b.threads-1; ++i) {
pthread_join(threads[i], NULL);
}
pn_proactor_free(b.proactor);
free(threads);
pn_ssl_domain_free(b.ssl_domain);
return 0;
}
| 0
|
78,645
|
static void load_vmcs12_host_state(struct kvm_vcpu *vcpu,
struct vmcs12 *vmcs12)
{
struct kvm_segment seg;
u32 entry_failure_code;
if (vmcs12->vm_exit_controls & VM_EXIT_LOAD_IA32_EFER)
vcpu->arch.efer = vmcs12->host_ia32_efer;
else if (vmcs12->vm_exit_controls & VM_EXIT_HOST_ADDR_SPACE_SIZE)
vcpu->arch.efer |= (EFER_LMA | EFER_LME);
else
vcpu->arch.efer &= ~(EFER_LMA | EFER_LME);
vmx_set_efer(vcpu, vcpu->arch.efer);
kvm_register_write(vcpu, VCPU_REGS_RSP, vmcs12->host_rsp);
kvm_register_write(vcpu, VCPU_REGS_RIP, vmcs12->host_rip);
vmx_set_rflags(vcpu, X86_EFLAGS_FIXED);
/*
* Note that calling vmx_set_cr0 is important, even if cr0 hasn't
* actually changed, because vmx_set_cr0 refers to efer set above.
*
* CR0_GUEST_HOST_MASK is already set in the original vmcs01
* (KVM doesn't change it);
*/
vcpu->arch.cr0_guest_owned_bits = X86_CR0_TS;
vmx_set_cr0(vcpu, vmcs12->host_cr0);
/* Same as above - no reason to call set_cr4_guest_host_mask(). */
vcpu->arch.cr4_guest_owned_bits = ~vmcs_readl(CR4_GUEST_HOST_MASK);
kvm_set_cr4(vcpu, vmcs12->host_cr4);
nested_ept_uninit_mmu_context(vcpu);
/*
* Only PDPTE load can fail as the value of cr3 was checked on entry and
* couldn't have changed.
*/
if (nested_vmx_load_cr3(vcpu, vmcs12->host_cr3, false, &entry_failure_code))
nested_vmx_abort(vcpu, VMX_ABORT_LOAD_HOST_PDPTE_FAIL);
if (!enable_ept)
vcpu->arch.walk_mmu->inject_page_fault = kvm_inject_page_fault;
if (enable_vpid) {
/*
* Trivially support vpid by letting L2s share their parent
* L1's vpid. TODO: move to a more elaborate solution, giving
* each L2 its own vpid and exposing the vpid feature to L1.
*/
vmx_flush_tlb(vcpu);
}
/* Restore posted intr vector. */
if (nested_cpu_has_posted_intr(vmcs12))
vmcs_write16(POSTED_INTR_NV, POSTED_INTR_VECTOR);
vmcs_write32(GUEST_SYSENTER_CS, vmcs12->host_ia32_sysenter_cs);
vmcs_writel(GUEST_SYSENTER_ESP, vmcs12->host_ia32_sysenter_esp);
vmcs_writel(GUEST_SYSENTER_EIP, vmcs12->host_ia32_sysenter_eip);
vmcs_writel(GUEST_IDTR_BASE, vmcs12->host_idtr_base);
vmcs_writel(GUEST_GDTR_BASE, vmcs12->host_gdtr_base);
/* If not VM_EXIT_CLEAR_BNDCFGS, the L2 value propagates to L1. */
if (vmcs12->vm_exit_controls & VM_EXIT_CLEAR_BNDCFGS)
vmcs_write64(GUEST_BNDCFGS, 0);
if (vmcs12->vm_exit_controls & VM_EXIT_LOAD_IA32_PAT) {
vmcs_write64(GUEST_IA32_PAT, vmcs12->host_ia32_pat);
vcpu->arch.pat = vmcs12->host_ia32_pat;
}
if (vmcs12->vm_exit_controls & VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL)
vmcs_write64(GUEST_IA32_PERF_GLOBAL_CTRL,
vmcs12->host_ia32_perf_global_ctrl);
/* Set L1 segment info according to Intel SDM
27.5.2 Loading Host Segment and Descriptor-Table Registers */
seg = (struct kvm_segment) {
.base = 0,
.limit = 0xFFFFFFFF,
.selector = vmcs12->host_cs_selector,
.type = 11,
.present = 1,
.s = 1,
.g = 1
};
if (vmcs12->vm_exit_controls & VM_EXIT_HOST_ADDR_SPACE_SIZE)
seg.l = 1;
else
seg.db = 1;
vmx_set_segment(vcpu, &seg, VCPU_SREG_CS);
seg = (struct kvm_segment) {
.base = 0,
.limit = 0xFFFFFFFF,
.type = 3,
.present = 1,
.s = 1,
.db = 1,
.g = 1
};
seg.selector = vmcs12->host_ds_selector;
vmx_set_segment(vcpu, &seg, VCPU_SREG_DS);
seg.selector = vmcs12->host_es_selector;
vmx_set_segment(vcpu, &seg, VCPU_SREG_ES);
seg.selector = vmcs12->host_ss_selector;
vmx_set_segment(vcpu, &seg, VCPU_SREG_SS);
seg.selector = vmcs12->host_fs_selector;
seg.base = vmcs12->host_fs_base;
vmx_set_segment(vcpu, &seg, VCPU_SREG_FS);
seg.selector = vmcs12->host_gs_selector;
seg.base = vmcs12->host_gs_base;
vmx_set_segment(vcpu, &seg, VCPU_SREG_GS);
seg = (struct kvm_segment) {
.base = vmcs12->host_tr_base,
.limit = 0x67,
.selector = vmcs12->host_tr_selector,
.type = 11,
.present = 1
};
vmx_set_segment(vcpu, &seg, VCPU_SREG_TR);
kvm_set_dr(vcpu, 7, 0x400);
vmcs_write64(GUEST_IA32_DEBUGCTL, 0);
if (cpu_has_vmx_msr_bitmap())
vmx_set_msr_bitmap(vcpu);
if (nested_vmx_load_msr(vcpu, vmcs12->vm_exit_msr_load_addr,
vmcs12->vm_exit_msr_load_count))
nested_vmx_abort(vcpu, VMX_ABORT_LOAD_HOST_MSR_FAIL);
}
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.