idx
int64 | func
string | target
int64 |
|---|---|---|
513,010
|
Item *get_copy(THD *thd)
{ return get_item_copy<Item_uint>(thd, this); }
| 0
|
247,155
|
u32 gf_fs_get_http_rate(GF_FilterSession *fs)
{
if (!fs->download_manager) {
gf_fs_get_download_manager(fs);
if (!fs->download_manager) return 0;
}
return gf_dm_get_global_rate(fs->download_manager);
}
| 0
|
209,106
|
static int ax25_release(struct socket *sock)
{
struct sock *sk = sock->sk;
ax25_cb *ax25;
ax25_dev *ax25_dev;
if (sk == NULL)
return 0;
sock_hold(sk);
lock_sock(sk);
sock_orphan(sk);
ax25 = sk_to_ax25(sk);
ax25_dev = ax25->ax25_dev;
if (ax25_dev) {
dev_put_track(ax25_dev->dev, &ax25_dev->dev_tracker);
ax25_dev_put(ax25_dev);
}
if (sk->sk_type == SOCK_SEQPACKET) {
switch (ax25->state) {
case AX25_STATE_0:
release_sock(sk);
ax25_disconnect(ax25, 0);
lock_sock(sk);
ax25_destroy_socket(ax25);
break;
case AX25_STATE_1:
case AX25_STATE_2:
ax25_send_control(ax25, AX25_DISC, AX25_POLLON, AX25_COMMAND);
release_sock(sk);
ax25_disconnect(ax25, 0);
lock_sock(sk);
if (!sock_flag(ax25->sk, SOCK_DESTROY))
ax25_destroy_socket(ax25);
break;
case AX25_STATE_3:
case AX25_STATE_4:
ax25_clear_queues(ax25);
ax25->n2count = 0;
switch (ax25->ax25_dev->values[AX25_VALUES_PROTOCOL]) {
case AX25_PROTO_STD_SIMPLEX:
case AX25_PROTO_STD_DUPLEX:
ax25_send_control(ax25,
AX25_DISC,
AX25_POLLON,
AX25_COMMAND);
ax25_stop_t2timer(ax25);
ax25_stop_t3timer(ax25);
ax25_stop_idletimer(ax25);
break;
#ifdef CONFIG_AX25_DAMA_SLAVE
case AX25_PROTO_DAMA_SLAVE:
ax25_stop_t3timer(ax25);
ax25_stop_idletimer(ax25);
break;
#endif
}
ax25_calculate_t1(ax25);
ax25_start_t1timer(ax25);
ax25->state = AX25_STATE_2;
sk->sk_state = TCP_CLOSE;
sk->sk_shutdown |= SEND_SHUTDOWN;
sk->sk_state_change(sk);
sock_set_flag(sk, SOCK_DESTROY);
break;
default:
break;
}
} else {
sk->sk_state = TCP_CLOSE;
sk->sk_shutdown |= SEND_SHUTDOWN;
sk->sk_state_change(sk);
ax25_destroy_socket(ax25);
}
sock->sk = NULL;
release_sock(sk);
sock_put(sk);
return 0;
}
| 1
|
224,540
|
Status GetWindowedOutputSizeFromDims(
shape_inference::InferenceContext* c,
shape_inference::DimensionHandle input_size,
shape_inference::DimensionOrConstant filter_size, int64_t stride,
Padding padding_type, shape_inference::DimensionHandle* output_size) {
if (padding_type == Padding::EXPLICIT) {
return errors::Internal(
"GetWindowedOutputSizeFromDims does not handle EXPLICIT padding; call "
"GetWindowedOutputSizeFromDimsV2 instead");
}
return GetWindowedOutputSizeFromDimsV2(c, input_size, filter_size,
/*dilation_rate=*/1, stride,
padding_type,
// Give dummy values of -1 to
// padding_before and padding_after,
// since explicit padding is not used.
-1, -1, output_size);
}
| 0
|
473,958
|
onigenc_minimum_property_name_to_ctype(OnigEncoding enc, UChar* p, UChar* end)
{
static const PosixBracketEntryType PBS[] = {
PosixBracketEntryInit("Alnum", ONIGENC_CTYPE_ALNUM),
PosixBracketEntryInit("Alpha", ONIGENC_CTYPE_ALPHA),
PosixBracketEntryInit("Blank", ONIGENC_CTYPE_BLANK),
PosixBracketEntryInit("Cntrl", ONIGENC_CTYPE_CNTRL),
PosixBracketEntryInit("Digit", ONIGENC_CTYPE_DIGIT),
PosixBracketEntryInit("Graph", ONIGENC_CTYPE_GRAPH),
PosixBracketEntryInit("Lower", ONIGENC_CTYPE_LOWER),
PosixBracketEntryInit("Print", ONIGENC_CTYPE_PRINT),
PosixBracketEntryInit("Punct", ONIGENC_CTYPE_PUNCT),
PosixBracketEntryInit("Space", ONIGENC_CTYPE_SPACE),
PosixBracketEntryInit("Upper", ONIGENC_CTYPE_UPPER),
PosixBracketEntryInit("XDigit", ONIGENC_CTYPE_XDIGIT),
PosixBracketEntryInit("ASCII", ONIGENC_CTYPE_ASCII),
PosixBracketEntryInit("Word", ONIGENC_CTYPE_WORD),
};
const PosixBracketEntryType *pb, *pbe;
int len;
len = onigenc_strlen(enc, p, end);
for (pbe = (pb = PBS) + sizeof(PBS)/sizeof(PBS[0]); pb < pbe; ++pb) {
if (len == pb->len &&
STRNCASECMP((char *)p, (char *)pb->name, len) == 0)
return pb->ctype;
}
return ONIGERR_INVALID_CHAR_PROPERTY_NAME;
}
| 0
|
512,860
|
virtual void update_null_value ()
{
return type_handler()->Item_update_null_value(this);
}
| 0
|
231,634
|
TEST_F(QuicServerTransportTest, RecvNewConnectionIdValid) {
auto& conn = server->getNonConstConn();
conn.transportSettings.selfActiveConnectionIdLimit = 2;
ShortHeader header(ProtectionType::KeyPhaseZero, *conn.clientConnectionId, 1);
RegularQuicPacketBuilder builder(
conn.udpSendPacketLen, std::move(header), 0 /* largestAcked */);
builder.encodePacketHeader();
ASSERT_TRUE(builder.canBuildPacket());
NewConnectionIdFrame newConnId(
1, 0, ConnectionId({2, 4, 2, 3}), StatelessResetToken{9, 8, 7, 6});
writeSimpleFrame(QuicSimpleFrame(newConnId), builder);
auto packet = std::move(builder).buildPacket();
EXPECT_EQ(conn.peerConnectionIds.size(), 1);
deliverData(packetToBuf(packet), false);
EXPECT_EQ(conn.peerConnectionIds.size(), 2);
EXPECT_EQ(conn.peerConnectionIds[1].connId, newConnId.connectionId);
EXPECT_EQ(conn.peerConnectionIds[1].sequenceNumber, newConnId.sequenceNumber);
EXPECT_EQ(conn.peerConnectionIds[1].token, newConnId.token);
}
| 0
|
225,811
|
GF_Box *stss_box_new()
{
ISOM_DECL_BOX_ALLOC(GF_SyncSampleBox, GF_ISOM_BOX_TYPE_STSS);
return (GF_Box*)tmp;
}
| 0
|
398,552
|
static size_t std_opcode_args_count(const RzBinDwarfLineHeader *hdr, ut8 opcode) {
if (!opcode || opcode > hdr->opcode_base - 1 || !hdr->std_opcode_lengths) {
return 0;
}
return hdr->std_opcode_lengths[opcode - 1];
}
| 0
|
463,204
|
EXPORTED int specialuse_validate(const char *mboxname, const char *userid,
const char *src, struct buf *dest)
{
const char *specialuse_extra_opt = config_getstring(IMAPOPT_SPECIALUSE_EXTRA);
char *strval = NULL;
strarray_t *valid = NULL;
strarray_t *new_attribs = NULL;
strarray_t *cur_attribs = NULL;
struct buf mbattribs = BUF_INITIALIZER;
int i, j;
int r = 0;
if (!src) {
buf_reset(dest);
return 0;
}
/* If there is a valid mboxname, we get the current specialuse annotations.
*/
if (mboxname) {
annotatemore_lookup(mboxname, "/specialuse", userid, &mbattribs);
if (mbattribs.len) {
cur_attribs = strarray_split(buf_cstring(&mbattribs), NULL, 0);
}
}
/* check specialuse_extra option if set */
if (specialuse_extra_opt)
valid = strarray_split(specialuse_extra_opt, NULL, 0);
else
valid = strarray_new();
/* strarray_add(valid, "\\All"); -- we don't support virtual folders right now */
strarray_add(valid, "\\Archive");
strarray_add(valid, "\\Drafts");
/* strarray_add(valid, "\\Flagged"); -- we don't support virtual folders right now */
strarray_add(valid, "\\Important"); // draft-ietf-specialuse-important
strarray_add(valid, "\\Junk");
strarray_add(valid, "\\Sent");
strarray_add(valid, "\\Trash");
strarray_add(valid, "\\Snoozed"); // JMAP
new_attribs = strarray_split(src, NULL, 0);
for (i = 0; i < new_attribs->count; i++) {
int skip_mbcheck = 0;
const char *item = strarray_nth(new_attribs, i);
for (j = 0; j < valid->count; j++) { /* can't use find here */
if (!strcasecmp(strarray_nth(valid, j), item))
break;
/* or without the leading '\' */
if (!strcasecmp(strarray_nth(valid, j) + 1, item))
break;
}
if (j >= valid->count) {
r = IMAP_ANNOTATION_BADENTRY;
goto done;
}
if (cur_attribs &&
(strarray_find_case(cur_attribs, strarray_nth(valid, j), 0) >= 0)) {
/* The mailbox has this specialuse attribute set already */
skip_mbcheck = 1;
}
/* don't allow names that are already in use */
if (!skip_mbcheck) {
char *mbname = mboxlist_find_specialuse(strarray_nth(valid, j),
userid);
if (mbname) {
free(mbname);
r = IMAP_MAILBOX_SPECIALUSE;
goto done;
}
}
/* normalise the value */
strarray_set(new_attribs, i, strarray_nth(valid, j));
}
strval = strarray_join(new_attribs, " ");
buf_setcstr(dest, strval);
done:
free(strval);
strarray_free(valid);
strarray_free(new_attribs);
strarray_free(cur_attribs);
buf_free(&mbattribs);
return r;
}
| 0
|
482,526
|
getNextAttribute(TranslationTableHeader *table) {
/* Get the next attribute value, or 0 if there is no more space in the table. */
TranslationTableCharacterAttributes next = table->nextCharacterClassAttribute;
if (next) {
if (next == CTC_LitDigit)
table->nextCharacterClassAttribute = CTC_UserDefined9;
else
table->nextCharacterClassAttribute <<= 1;
return next;
} else
return getNextNumberedAttribute(table);
}
| 0
|
344,232
|
static int lessthanothers (lua_State *L, const TValue *l, const TValue *r) {
lua_assert(!ttisnumber(l) || !ttisnumber(r));
if (ttisstring(l) && ttisstring(r)) /* both are strings? */
return l_strcmp(tsvalue(l), tsvalue(r)) < 0;
else
return luaT_callorderTM(L, l, r, TM_LT);
}
| 0
|
247,568
|
TEST_P(SslSocketTest, ClientCertificateHashListVerificationNoCA) {
envoy::config::listener::v3::Listener listener;
envoy::config::listener::v3::FilterChain* filter_chain = listener.add_filter_chains();
envoy::extensions::transport_sockets::tls::v3::DownstreamTlsContext tls_context;
envoy::extensions::transport_sockets::tls::v3::TlsCertificate* server_cert =
tls_context.mutable_common_tls_context()->add_tls_certificates();
server_cert->mutable_certificate_chain()->set_filename(TestEnvironment::substitute(
"{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_dns_cert.pem"));
server_cert->mutable_private_key()->set_filename(TestEnvironment::substitute(
"{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_dns_key.pem"));
envoy::extensions::transport_sockets::tls::v3::CertificateValidationContext*
server_validation_ctx =
tls_context.mutable_common_tls_context()->mutable_validation_context();
server_validation_ctx->add_verify_certificate_hash(
"0000000000000000000000000000000000000000000000000000000000000000");
server_validation_ctx->add_verify_certificate_hash(TEST_SAN_URI_CERT_256_HASH);
updateFilterChain(tls_context, *filter_chain);
envoy::extensions::transport_sockets::tls::v3::UpstreamTlsContext client;
envoy::extensions::transport_sockets::tls::v3::TlsCertificate* client_cert =
client.mutable_common_tls_context()->add_tls_certificates();
client_cert->mutable_certificate_chain()->set_filename(TestEnvironment::substitute(
"{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_uri_cert.pem"));
client_cert->mutable_private_key()->set_filename(TestEnvironment::substitute(
"{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_uri_key.pem"));
TestUtilOptionsV2 test_options(listener, client, true, GetParam());
testUtilV2(test_options.setExpectedClientCertUri("spiffe://lyft.com/test-team")
.setExpectedServerCertDigest(TEST_SAN_DNS_CERT_256_HASH));
// Works even with client renegotiation.
client.set_allow_renegotiation(true);
testUtilV2(test_options);
}
| 0
|
404,749
|
static void copy_fd_bitmaps(struct fdtable *nfdt, struct fdtable *ofdt,
unsigned int count)
{
unsigned int cpy, set;
cpy = count / BITS_PER_BYTE;
set = (nfdt->max_fds - count) / BITS_PER_BYTE;
memcpy(nfdt->open_fds, ofdt->open_fds, cpy);
memset((char *)nfdt->open_fds + cpy, 0, set);
memcpy(nfdt->close_on_exec, ofdt->close_on_exec, cpy);
memset((char *)nfdt->close_on_exec + cpy, 0, set);
cpy = BITBIT_SIZE(count);
set = BITBIT_SIZE(nfdt->max_fds) - cpy;
memcpy(nfdt->full_fds_bits, ofdt->full_fds_bits, cpy);
memset((char *)nfdt->full_fds_bits + cpy, 0, set);
}
| 0
|
90,227
|
virtual bool wifi_connecting() const {
return wifi_ ? wifi_->connecting() : false;
}
| 0
|
387,592
|
static int snd_ctl_dev_disconnect(struct snd_device *device)
{
struct snd_card *card = device->device_data;
struct snd_ctl_file *ctl;
struct snd_ctl_layer_ops *lops;
unsigned long flags;
read_lock_irqsave(&card->ctl_files_rwlock, flags);
list_for_each_entry(ctl, &card->ctl_files, list) {
wake_up(&ctl->change_sleep);
snd_kill_fasync(ctl->fasync, SIGIO, POLL_ERR);
}
read_unlock_irqrestore(&card->ctl_files_rwlock, flags);
down_read(&card->controls_rwsem);
down_read(&snd_ctl_layer_rwsem);
for (lops = snd_ctl_layer; lops; lops = lops->next)
lops->ldisconnect(card);
up_read(&snd_ctl_layer_rwsem);
up_read(&card->controls_rwsem);
return snd_unregister_device(&card->ctl_dev);
}
| 0
|
513,248
|
static bool check_simple_equality(THD *thd, const Item::Context &ctx,
Item *left_item, Item *right_item,
COND_EQUAL *cond_equal)
{
Item *orig_left_item= left_item;
Item *orig_right_item= right_item;
if (left_item->type() == Item::REF_ITEM &&
((Item_ref*)left_item)->ref_type() == Item_ref::VIEW_REF)
{
if (((Item_ref*)left_item)->get_depended_from())
return FALSE;
if (((Item_direct_view_ref*)left_item)->get_null_ref_table() !=
NO_NULL_TABLE && !left_item->real_item()->used_tables())
return FALSE;
left_item= left_item->real_item();
}
if (right_item->type() == Item::REF_ITEM &&
((Item_ref*)right_item)->ref_type() == Item_ref::VIEW_REF)
{
if (((Item_ref*)right_item)->get_depended_from())
return FALSE;
if (((Item_direct_view_ref*)right_item)->get_null_ref_table() !=
NO_NULL_TABLE && !right_item->real_item()->used_tables())
return FALSE;
right_item= right_item->real_item();
}
if (left_item->type() == Item::FIELD_ITEM &&
right_item->type() == Item::FIELD_ITEM &&
!((Item_field*)left_item)->get_depended_from() &&
!((Item_field*)right_item)->get_depended_from())
{
/* The predicate the form field1=field2 is processed */
Field *left_field= ((Item_field*) left_item)->field;
Field *right_field= ((Item_field*) right_item)->field;
if (!left_field->eq_def(right_field))
return FALSE;
/* Search for multiple equalities containing field1 and/or field2 */
bool left_copyfl, right_copyfl;
Item_equal *left_item_equal=
find_item_equal(cond_equal, left_field, &left_copyfl);
Item_equal *right_item_equal=
find_item_equal(cond_equal, right_field, &right_copyfl);
/* As (NULL=NULL) != TRUE we can't just remove the predicate f=f */
if (left_field->eq(right_field)) /* f = f */
return (!(left_field->maybe_null() && !left_item_equal));
if (left_item_equal && left_item_equal == right_item_equal)
{
/*
The equality predicate is inference of one of the existing
multiple equalities, i.e the condition is already covered
by upper level equalities
*/
return TRUE;
}
/* Copy the found multiple equalities at the current level if needed */
if (left_copyfl)
{
/* left_item_equal of an upper level contains left_item */
left_item_equal= new (thd->mem_root) Item_equal(thd, left_item_equal);
left_item_equal->set_context_field(((Item_field*) left_item));
cond_equal->current_level.push_back(left_item_equal, thd->mem_root);
}
if (right_copyfl)
{
/* right_item_equal of an upper level contains right_item */
right_item_equal= new (thd->mem_root) Item_equal(thd, right_item_equal);
right_item_equal->set_context_field(((Item_field*) right_item));
cond_equal->current_level.push_back(right_item_equal, thd->mem_root);
}
if (left_item_equal)
{
/* left item was found in the current or one of the upper levels */
if (! right_item_equal)
left_item_equal->add(orig_right_item, thd->mem_root);
else
{
/* Merge two multiple equalities forming a new one */
left_item_equal->merge(thd, right_item_equal);
/* Remove the merged multiple equality from the list */
List_iterator<Item_equal> li(cond_equal->current_level);
while ((li++) != right_item_equal) ;
li.remove();
}
}
else
{
/* left item was not found neither the current nor in upper levels */
if (right_item_equal)
right_item_equal->add(orig_left_item, thd->mem_root);
else
{
/* None of the fields was found in multiple equalities */
Item_equal *item_equal= new (thd->mem_root) Item_equal(thd,
orig_left_item,
orig_right_item,
FALSE);
item_equal->set_context_field((Item_field*)left_item);
cond_equal->current_level.push_back(item_equal, thd->mem_root);
}
}
return TRUE;
}
{
/* The predicate of the form field=const/const=field is processed */
Item *const_item= 0;
Item_field *field_item= 0;
Item *orig_field_item= 0;
if (left_item->type() == Item::FIELD_ITEM &&
!((Item_field*)left_item)->get_depended_from() &&
right_item->const_item() && !right_item->is_expensive())
{
orig_field_item= orig_left_item;
field_item= (Item_field *) left_item;
const_item= right_item;
}
else if (right_item->type() == Item::FIELD_ITEM &&
!((Item_field*)right_item)->get_depended_from() &&
left_item->const_item() && !left_item->is_expensive())
{
orig_field_item= orig_right_item;
field_item= (Item_field *) right_item;
const_item= left_item;
}
if (const_item &&
field_item->field->test_if_equality_guarantees_uniqueness(const_item))
{
/*
field_item and const_item are arguments of a scalar or a row
comparison function:
WHERE column=constant
WHERE (column, ...) = (constant, ...)
The owner comparison function has previously called fix_fields(),
so field_item and const_item should be directly comparable items,
field_item->cmp_context and const_item->cmp_context should be set.
In case of string comparison, charsets and collations of
field_item and const_item should have already be aggregated
for comparison, all necessary character set converters installed
and fixed.
In case of string comparison, const_item can be either:
- a weaker constant that does not need to be converted to field_item:
WHERE latin1_field = 'latin1_const'
WHERE varbinary_field = 'latin1_const'
WHERE latin1_bin_field = 'latin1_general_ci_const'
- a stronger constant that does not need to be converted to field_item:
WHERE latin1_field = binary 0xDF
WHERE latin1_field = 'a' COLLATE latin1_bin
- a result of conversion (e.g. from the session character set)
to the character set of field_item:
WHERE latin1_field = 'utf8_string_with_latin1_repertoire'
*/
bool copyfl;
Item_equal *item_equal = find_item_equal(cond_equal,
field_item->field, ©fl);
if (copyfl)
{
item_equal= new (thd->mem_root) Item_equal(thd, item_equal);
cond_equal->current_level.push_back(item_equal, thd->mem_root);
item_equal->set_context_field(field_item);
}
Item *const_item2= field_item->field->get_equal_const_item(thd, ctx,
const_item);
if (!const_item2)
return false;
if (item_equal)
{
/*
The flag cond_false will be set to 1 after this, if item_equal
already contains a constant and its value is not equal to
the value of const_item.
*/
item_equal->add_const(thd, const_item2);
}
else
{
item_equal= new (thd->mem_root) Item_equal(thd, const_item2,
orig_field_item, TRUE);
item_equal->set_context_field(field_item);
cond_equal->current_level.push_back(item_equal, thd->mem_root);
}
return TRUE;
}
}
return FALSE;
}
| 0
|
477,306
|
static void tipc_crypto_do_cmd(struct net *net, int cmd)
{
struct tipc_net *tn = tipc_net(net);
struct tipc_crypto *tx = tn->crypto_tx, *rx;
struct list_head *p;
unsigned int stat;
int i, j, cpu;
char buf[200];
/* Currently only one command is supported */
switch (cmd) {
case 0xfff1:
goto print_stats;
default:
return;
}
print_stats:
/* Print a header */
pr_info("\n=============== TIPC Crypto Statistics ===============\n\n");
/* Print key status */
pr_info("Key status:\n");
pr_info("TX(%7.7s)\n%s", tipc_own_id_string(net),
tipc_crypto_key_dump(tx, buf));
rcu_read_lock();
for (p = tn->node_list.next; p != &tn->node_list; p = p->next) {
rx = tipc_node_crypto_rx_by_list(p);
pr_info("RX(%7.7s)\n%s", tipc_node_get_id_str(rx->node),
tipc_crypto_key_dump(rx, buf));
}
rcu_read_unlock();
/* Print crypto statistics */
for (i = 0, j = 0; i < MAX_STATS; i++)
j += scnprintf(buf + j, 200 - j, "|%11s ", hstats[i]);
pr_info("Counter %s", buf);
memset(buf, '-', 115);
buf[115] = '\0';
pr_info("%s\n", buf);
j = scnprintf(buf, 200, "TX(%7.7s) ", tipc_own_id_string(net));
for_each_possible_cpu(cpu) {
for (i = 0; i < MAX_STATS; i++) {
stat = per_cpu_ptr(tx->stats, cpu)->stat[i];
j += scnprintf(buf + j, 200 - j, "|%11d ", stat);
}
pr_info("%s", buf);
j = scnprintf(buf, 200, "%12s", " ");
}
rcu_read_lock();
for (p = tn->node_list.next; p != &tn->node_list; p = p->next) {
rx = tipc_node_crypto_rx_by_list(p);
j = scnprintf(buf, 200, "RX(%7.7s) ",
tipc_node_get_id_str(rx->node));
for_each_possible_cpu(cpu) {
for (i = 0; i < MAX_STATS; i++) {
stat = per_cpu_ptr(rx->stats, cpu)->stat[i];
j += scnprintf(buf + j, 200 - j, "|%11d ",
stat);
}
pr_info("%s", buf);
j = scnprintf(buf, 200, "%12s", " ");
}
}
rcu_read_unlock();
pr_info("\n======================== Done ========================\n");
}
| 0
|
506,687
|
static int check_message(const struct set_name_fn *fn, const char *op,
const char *nameincert, int match, const char *name)
{
char msg[1024];
if (match < 0)
return 1;
BIO_snprintf(msg, sizeof(msg), "%s: %s: [%s] %s [%s]",
fn->name, op, nameincert,
match ? "matches" : "does not match", name);
if (is_exception(msg))
return 1;
TEST_error("%s", msg);
return 0;
}
| 0
|
343,172
|
static int __init esp6_init(void)
{
if (xfrm_register_type(&esp6_type, AF_INET6) < 0) {
pr_info("%s: can't add xfrm type\n", __func__);
return -EAGAIN;
}
if (xfrm6_protocol_register(&esp6_protocol, IPPROTO_ESP) < 0) {
pr_info("%s: can't add protocol\n", __func__);
xfrm_unregister_type(&esp6_type, AF_INET6);
return -EAGAIN;
}
return 0;
}
| 0
|
213,075
|
void nfcmrvl_nci_unregister_dev(struct nfcmrvl_private *priv)
{
struct nci_dev *ndev = priv->ndev;
if (priv->ndev->nfc_dev->fw_download_in_progress)
nfcmrvl_fw_dnld_abort(priv);
nfcmrvl_fw_dnld_deinit(priv);
if (gpio_is_valid(priv->config.reset_n_io))
gpio_free(priv->config.reset_n_io);
nci_unregister_device(ndev);
nci_free_device(ndev);
kfree(priv);
}
| 1
|
220,033
|
~SparseTensorAccessingOp() override {
if (sparse_tensors_map_) sparse_tensors_map_->Unref();
}
| 0
|
328,842
|
R_API RBinJavaStackMapFrame *r_bin_java_default_stack_frame(void) {
RBinJavaStackMapFrame *sf = R_NEW0 (RBinJavaStackMapFrame);
if (!sf) {
return NULL;
}
sf->metas = R_NEW0 (RBinJavaMetaInfo);
if (!sf->metas) {
free (sf);
return NULL;
}
sf->metas->type_info = (void *) &R_BIN_JAVA_STACK_MAP_FRAME_METAS[R_BIN_JAVA_STACK_FRAME_IMPLICIT];
sf->type = ((RBinJavaStackMapFrameMetas *) sf->metas->type_info)->type;
sf->local_items = r_list_newf (r_bin_java_verification_info_free);
sf->stack_items = r_list_newf (r_bin_java_verification_info_free);
sf->number_of_stack_items = 0;
sf->number_of_locals = 0;
return sf;
}
| 0
|
329,924
|
_inplace_src_opacity_spans (void *abstract_renderer, int y, int h,
const cairo_half_open_span_t *spans,
unsigned num_spans)
{
cairo_image_span_renderer_t *r = abstract_renderer;
uint8_t *mask;
int x0;
if (num_spans == 0)
return CAIRO_STATUS_SUCCESS;
x0 = spans[0].x;
mask = (uint8_t *)pixman_image_get_data (r->mask);
do {
int len = spans[1].x - spans[0].x;
uint8_t m = mul8_8(spans[0].coverage, r->bpp);
if (m == 0) {
if (spans[0].x != x0) {
#if PIXMAN_HAS_OP_LERP
pixman_image_composite32 (PIXMAN_OP_LERP_SRC,
r->src, r->mask, r->u.composite.dst,
x0 + r->u.composite.src_x,
y + r->u.composite.src_y,
0, 0,
x0, y,
spans[0].x - x0, h);
#else
pixman_image_composite32 (PIXMAN_OP_OUT_REVERSE,
r->mask, NULL, r->u.composite.dst,
0, 0,
0, 0,
x0, y,
spans[0].x - x0, h);
pixman_image_composite32 (PIXMAN_OP_ADD,
r->src, r->mask, r->u.composite.dst,
x0 + r->u.composite.src_x,
y + r->u.composite.src_y,
0, 0,
x0, y,
spans[0].x - x0, h);
#endif
}
mask = (uint8_t *)pixman_image_get_data (r->mask);
x0 = spans[1].x;
} else {
*mask++ = m;
if (len > 1) {
memset (mask, m, --len);
mask += len;
}
}
spans++;
} while (--num_spans > 1);
if (spans[0].x != x0) {
#if PIXMAN_HAS_OP_LERP
pixman_image_composite32 (PIXMAN_OP_LERP_SRC,
r->src, r->mask, r->u.composite.dst,
x0 + r->u.composite.src_x,
y + r->u.composite.src_y,
0, 0,
x0, y,
spans[0].x - x0, h);
#else
pixman_image_composite32 (PIXMAN_OP_OUT_REVERSE,
r->mask, NULL, r->u.composite.dst,
0, 0,
0, 0,
x0, y,
spans[0].x - x0, h);
pixman_image_composite32 (PIXMAN_OP_ADD,
r->src, r->mask, r->u.composite.dst,
x0 + r->u.composite.src_x,
y + r->u.composite.src_y,
0, 0,
x0, y,
spans[0].x - x0, h);
#endif
}
return CAIRO_STATUS_SUCCESS;
}
| 0
|
230,287
|
njs_array_compare(const void *a, const void *b, void *c)
{
double num;
njs_int_t ret;
njs_value_t arguments[3], retval;
njs_array_sort_ctx_t *ctx;
njs_array_sort_slot_t *aslot, *bslot;
ctx = c;
if (ctx->exception) {
return 0;
}
aslot = (njs_array_sort_slot_t *) a;
bslot = (njs_array_sort_slot_t *) b;
if (ctx->function != NULL) {
njs_set_undefined(&arguments[0]);
arguments[1] = aslot->value;
arguments[2] = bslot->value;
ret = njs_function_apply(ctx->vm, ctx->function, arguments, 3, &retval);
if (njs_slow_path(ret != NJS_OK)) {
goto exception;
}
ret = njs_value_to_number(ctx->vm, &retval, &num);
if (njs_slow_path(ret != NJS_OK)) {
goto exception;
}
if (njs_slow_path(isnan(num))) {
return 0;
}
if (num != 0) {
return (num > 0) - (num < 0);
}
goto compare_same;
}
if (aslot->str == NULL) {
aslot->str = njs_arr_add(&ctx->strings);
ret = njs_value_to_string(ctx->vm, aslot->str, &aslot->value);
if (njs_slow_path(ret != NJS_OK)) {
goto exception;
}
}
if (bslot->str == NULL) {
bslot->str = njs_arr_add(&ctx->strings);
ret = njs_value_to_string(ctx->vm, bslot->str, &bslot->value);
if (njs_slow_path(ret != NJS_OK)) {
goto exception;
}
}
ret = njs_string_cmp(aslot->str, bslot->str);
if (ret != 0) {
return ret;
}
compare_same:
/* Ensures stable sorting. */
return (aslot->pos > bslot->pos) - (aslot->pos < bslot->pos);
exception:
ctx->exception = 1;
return 0;
}
| 0
|
513,075
|
String *val_str(String *to)
{
return m_value.to_datetime(current_thd).to_string(to, decimals);
}
| 0
|
222,898
|
Status UpdateOutputShapesAndValues(const NodeDef& node, NodeContext* c) {
InferenceContext* ic = c->inference_context.get();
// Input to EvaluateNode()
TensorVector inputs;
// Container for temporarily created tensor object.
std::vector<Tensor> input_tensor_vector(ic->num_inputs());
CreateInputTensors(c, &input_tensor_vector, &inputs);
// Output for EvaluateNode() and output tensor clean up object.
TensorVector outputs;
auto outputs_cleanup = gtl::MakeCleanup([&outputs] {
for (const auto& output : outputs) {
if (output.tensor) {
delete output.tensor;
}
}
});
TF_RETURN_IF_ERROR(EvaluateNode(node, inputs, /*cpu_device=*/nullptr,
&resource_mgr_, &outputs));
c->output_tensors_as_shapes.resize(outputs.size());
c->output_tensor_protos.resize(outputs.size(), nullptr);
for (int k = 0, outputs_size = outputs.size(); k < outputs_size; k++) {
const auto& t = outputs[k];
// Override output shape.
ShapeHandle output_shape;
TF_RETURN_IF_ERROR(
ic->MakeShapeFromTensorShape(t->shape(), &output_shape));
if (ic->FullyDefined(ic->output(k)) &&
!EquivalentShapes(ic->output(k), output_shape)) {
LOG(WARNING) << "UpdateOutputShapesAndValues() -- node: " << node.name()
<< ", inferred output shape "
<< "doesn't match for k=" << k << ": "
<< "ic->output(k): " << ic->DebugString(ic->output(k))
<< ", output_shape: " << ic->DebugString(output_shape)
<< " -- " << node.DebugString();
}
ic->set_output(k, output_shape);
// Set output_tensors_as_shape.
MaybeTensorValueToShape(ic, *t.tensor, &c->output_tensors_as_shapes[k]);
// Set output_tensor_protos.
TensorProto tensor_proto;
t->AsProtoTensorContent(&tensor_proto);
const_tensors_to_propagate_.push_back(tensor_proto);
c->output_tensor_protos[k] = &const_tensors_to_propagate_.back();
}
return Status::OK();
}
| 0
|
247,147
|
static Bool fsess_on_event(void *cbk, GF_Event *evt)
{
return GF_TRUE;
}
| 0
|
294,457
|
date_s_valid_nth_kday_p(int argc, VALUE *argv, VALUE klass)
{
VALUE vy, vm, vn, vk, vsg;
VALUE argv2[5];
rb_scan_args(argc, argv, "41", &vy, &vm, &vn, &vk, &vsg);
argv2[0] = vy;
argv2[1] = vm;
argv2[2] = vn;
argv2[3] = vk;
if (argc < 5)
argv2[4] = INT2FIX(DEFAULT_SG);
else
argv2[4] = vsg;
if (NIL_P(valid_nth_kday_sub(5, argv2, klass, 0)))
return Qfalse;
return Qtrue;
}
| 0
|
267,987
|
R_API bool r_bin_file_delete(RBin *bin, ut32 bin_id) {
r_return_val_if_fail (bin, false);
RListIter *iter;
RBinFile *bf, *cur = r_bin_cur (bin);
r_list_foreach (bin->binfiles, iter, bf) {
if (bf && bf->id == bin_id) {
if (cur && cur->id == bin_id) {
// avoiding UaF due to dead reference
bin->cur = NULL;
}
r_list_delete (bin->binfiles, iter);
return true;
}
}
return false;
}
| 0
|
328,954
|
R_API RBinJavaAttrInfo *r_bin_java_signature_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {
if (sz < 8) {
return NULL;
}
RBinJavaAttrInfo *attr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);
if (!attr) {
return NULL;
}
ut64 offset = 6;
attr->type = R_BIN_JAVA_ATTR_TYPE_SIGNATURE_ATTR;
// attr->info.source_file_attr.sourcefile_idx = R_BIN_JAVA_USHORT (buffer, offset);
// offset += 2;
attr->info.signature_attr.signature_idx = R_BIN_JAVA_USHORT (buffer, offset);
offset += 2;
attr->info.signature_attr.signature = r_bin_java_get_utf8_from_bin_cp_list (
R_BIN_JAVA_GLOBAL_BIN, attr->info.signature_attr.signature_idx);
if (!attr->info.signature_attr.signature) {
eprintf ("r_bin_java_signature_attr_new: Unable to resolve the "
"Signature UTF8 String Index: 0x%02x\n", attr->info.signature_attr.signature_idx);
}
attr->size = offset;
// IFDBG r_bin_java_print_source_code_file_attr_summary(attr);
return attr;
}
| 0
|
448,552
|
static int bgp_notify_receive(struct peer *peer, bgp_size_t size)
{
struct bgp_notify outer = {};
struct bgp_notify inner = {};
bool hard_reset = false;
if (peer->notify.data) {
XFREE(MTYPE_BGP_NOTIFICATION, peer->notify.data);
peer->notify.length = 0;
peer->notify.hard_reset = false;
}
outer.code = stream_getc(peer->curr);
outer.subcode = stream_getc(peer->curr);
outer.length = size - 2;
outer.data = NULL;
outer.raw_data = NULL;
if (outer.length) {
outer.raw_data = XMALLOC(MTYPE_BGP_NOTIFICATION, outer.length);
memcpy(outer.raw_data, stream_pnt(peer->curr), outer.length);
}
hard_reset =
bgp_notify_received_hard_reset(peer, outer.code, outer.subcode);
if (hard_reset && outer.length) {
inner = bgp_notify_decapsulate_hard_reset(&outer);
peer->notify.hard_reset = true;
} else {
inner = outer;
}
/* Preserv notify code and sub code. */
peer->notify.code = inner.code;
peer->notify.subcode = inner.subcode;
/* For further diagnostic record returned Data. */
if (inner.length) {
peer->notify.length = inner.length;
peer->notify.data =
XMALLOC(MTYPE_BGP_NOTIFICATION, inner.length);
memcpy(peer->notify.data, inner.raw_data, inner.length);
}
/* For debug */
{
int i;
int first = 0;
char c[4];
if (inner.length) {
inner.data = XMALLOC(MTYPE_BGP_NOTIFICATION,
inner.length * 3);
for (i = 0; i < inner.length; i++)
if (first) {
snprintf(c, sizeof(c), " %02x",
stream_getc(peer->curr));
strlcat(inner.data, c,
inner.length * 3);
} else {
first = 1;
snprintf(c, sizeof(c), "%02x",
stream_getc(peer->curr));
strlcpy(inner.data, c,
inner.length * 3);
}
}
bgp_notify_print(peer, &inner, "received", hard_reset);
if (inner.length) {
XFREE(MTYPE_BGP_NOTIFICATION, inner.data);
inner.length = 0;
}
if (outer.length) {
XFREE(MTYPE_BGP_NOTIFICATION, outer.data);
XFREE(MTYPE_BGP_NOTIFICATION, outer.raw_data);
/* If this is a Hard Reset notification, we MUST free
* the inner (encapsulated) notification too.
*/
if (hard_reset)
XFREE(MTYPE_BGP_NOTIFICATION, inner.raw_data);
outer.length = 0;
}
}
/* peer count update */
atomic_fetch_add_explicit(&peer->notify_in, 1, memory_order_relaxed);
peer->last_reset = PEER_DOWN_NOTIFY_RECEIVED;
/* We have to check for Notify with Unsupported Optional Parameter.
in that case we fallback to open without the capability option.
But this done in bgp_stop. We just mark it here to avoid changing
the fsm tables. */
if (inner.code == BGP_NOTIFY_OPEN_ERR &&
inner.subcode == BGP_NOTIFY_OPEN_UNSUP_PARAM)
UNSET_FLAG(peer->sflags, PEER_STATUS_CAPABILITY_OPEN);
/* If Graceful-Restart N-bit (Notification) is exchanged,
* and it's not a Hard Reset, let's retain the routes.
*/
if (bgp_has_graceful_restart_notification(peer) && !hard_reset &&
CHECK_FLAG(peer->sflags, PEER_STATUS_NSF_MODE))
SET_FLAG(peer->sflags, PEER_STATUS_NSF_WAIT);
bgp_peer_gr_flags_update(peer);
BGP_GR_ROUTER_DETECT_AND_SEND_CAPABILITY_TO_ZEBRA(peer->bgp,
peer->bgp->peer);
return Receive_NOTIFICATION_message;
}
| 0
|
310,085
|
write_tabs(int *tab_list)
{
int stop;
while ((stop = *tab_list++) > 0 && stop <= max_cols) {
fputs((stop == 1) ? "*" : "\t*", stdout);
};
/* also show a tab _past_ the stops */
if (stop < max_cols)
fputs("\t+", stdout);
putchar('\n');
}
| 0
|
366,203
|
static void shrink_submounts(struct mount *mnt)
{
LIST_HEAD(graveyard);
struct mount *m;
/* extract submounts of 'mountpoint' from the expiration list */
while (select_submounts(mnt, &graveyard)) {
while (!list_empty(&graveyard)) {
m = list_first_entry(&graveyard, struct mount,
mnt_expire);
touch_mnt_namespace(m->mnt_ns);
umount_tree(m, UMOUNT_PROPAGATE|UMOUNT_SYNC);
}
}
}
| 0
|
318,984
|
assert_inrange(typval_T *argvars)
{
garray_T ga;
int error = FALSE;
char_u *tofree;
char msg[200];
char_u numbuf[NUMBUFLEN];
#ifdef FEAT_FLOAT
if (argvars[0].v_type == VAR_FLOAT
|| argvars[1].v_type == VAR_FLOAT
|| argvars[2].v_type == VAR_FLOAT)
{
float_T flower = tv_get_float(&argvars[0]);
float_T fupper = tv_get_float(&argvars[1]);
float_T factual = tv_get_float(&argvars[2]);
if (factual < flower || factual > fupper)
{
prepare_assert_error(&ga);
if (argvars[3].v_type != VAR_UNKNOWN)
{
ga_concat(&ga, tv2string(&argvars[3], &tofree, numbuf, 0));
vim_free(tofree);
}
else
{
vim_snprintf(msg, 200, "Expected range %g - %g, but got %g",
flower, fupper, factual);
ga_concat(&ga, (char_u *)msg);
}
assert_error(&ga);
ga_clear(&ga);
return 1;
}
}
else
#endif
{
varnumber_T lower = tv_get_number_chk(&argvars[0], &error);
varnumber_T upper = tv_get_number_chk(&argvars[1], &error);
varnumber_T actual = tv_get_number_chk(&argvars[2], &error);
if (error)
return 0;
if (actual < lower || actual > upper)
{
prepare_assert_error(&ga);
if (argvars[3].v_type != VAR_UNKNOWN)
{
ga_concat(&ga, tv2string(&argvars[3], &tofree, numbuf, 0));
vim_free(tofree);
}
else
{
vim_snprintf(msg, 200, "Expected range %ld - %ld, but got %ld",
(long)lower, (long)upper, (long)actual);
ga_concat(&ga, (char_u *)msg);
}
assert_error(&ga);
ga_clear(&ga);
return 1;
}
}
return 0;
}
| 0
|
238,473
|
static void scalar_min_max_rsh(struct bpf_reg_state *dst_reg,
struct bpf_reg_state *src_reg)
{
u64 umax_val = src_reg->umax_value;
u64 umin_val = src_reg->umin_value;
/* BPF_RSH is an unsigned shift. If the value in dst_reg might
* be negative, then either:
* 1) src_reg might be zero, so the sign bit of the result is
* unknown, so we lose our signed bounds
* 2) it's known negative, thus the unsigned bounds capture the
* signed bounds
* 3) the signed bounds cross zero, so they tell us nothing
* about the result
* If the value in dst_reg is known nonnegative, then again the
* unsigned bounds capture the signed bounds.
* Thus, in all cases it suffices to blow away our signed bounds
* and rely on inferring new ones from the unsigned bounds and
* var_off of the result.
*/
dst_reg->smin_value = S64_MIN;
dst_reg->smax_value = S64_MAX;
dst_reg->var_off = tnum_rshift(dst_reg->var_off, umin_val);
dst_reg->umin_value >>= umax_val;
dst_reg->umax_value >>= umin_val;
/* Its not easy to operate on alu32 bounds here because it depends
* on bits being shifted in. Take easy way out and mark unbounded
* so we can recalculate later from tnum.
*/
__mark_reg32_unbounded(dst_reg);
__update_reg_bounds(dst_reg);
}
| 0
|
176,404
|
void AddQuickEnableWorkItems(const InstallerState& installer_state,
const InstallationState& machine_state,
const FilePath* setup_path,
const Version* new_version,
WorkItemList* work_item_list) {
DCHECK(setup_path ||
installer_state.operation() == InstallerState::UNINSTALL);
DCHECK(new_version ||
installer_state.operation() == InstallerState::UNINSTALL);
DCHECK(work_item_list);
const bool system_install = installer_state.system_install();
bool have_multi_chrome = false;
bool have_chrome_frame = false;
const ProductState* product_state = NULL;
product_state =
machine_state.GetProductState(system_install,
BrowserDistribution::CHROME_BROWSER);
if (product_state != NULL && product_state->is_multi_install())
have_multi_chrome = true;
product_state =
machine_state.GetProductState(system_install,
BrowserDistribution::CHROME_FRAME);
if (product_state != NULL &&
!product_state->uninstall_command().HasSwitch(
switches::kChromeFrameReadyMode))
have_chrome_frame = true;
const Product* product = NULL;
if (installer_state.operation() == InstallerState::UNINSTALL) {
product =
installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER);
if (product != NULL && installer_state.is_multi_install())
have_multi_chrome = false;
if (installer_state.FindProduct(BrowserDistribution::CHROME_FRAME) != NULL)
have_chrome_frame = false;
} else {
product =
installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER);
if (product != NULL && installer_state.is_multi_install())
have_multi_chrome = true;
product = installer_state.FindProduct(BrowserDistribution::CHROME_FRAME);
if (product != NULL && !product->HasOption(kOptionReadyMode))
have_chrome_frame = true;
}
enum QuickEnableOperation {
DO_NOTHING,
ADD_COMMAND,
REMOVE_COMMAND
} operation = DO_NOTHING;
FilePath binaries_setup_path;
if (have_chrome_frame) {
operation = REMOVE_COMMAND;
} else if (have_multi_chrome) {
operation = ADD_COMMAND;
if (installer_state.operation() == InstallerState::UNINSTALL) {
product_state =
machine_state.GetProductState(system_install,
BrowserDistribution::CHROME_BROWSER);
DCHECK(product_state);
binaries_setup_path = product_state->uninstall_command().GetProgram();
} else {
DCHECK(installer_state.is_multi_install());
binaries_setup_path =
installer_state.GetInstallerDirectory(*new_version).Append(
setup_path->BaseName());
}
}
if (operation != DO_NOTHING) {
BrowserDistribution* binaries =
BrowserDistribution::GetSpecificDistribution(
BrowserDistribution::CHROME_BINARIES);
std::wstring cmd_key(binaries->GetVersionKey());
cmd_key.append(1, L'\\').append(google_update::kRegCommandsKey)
.append(1, L'\\').append(kCmdQuickEnableCf);
if (operation == ADD_COMMAND) {
DCHECK(!binaries_setup_path.empty());
CommandLine cmd_line(binaries_setup_path);
cmd_line.AppendSwitch(switches::kMultiInstall);
if (installer_state.system_install())
cmd_line.AppendSwitch(switches::kSystemLevel);
if (installer_state.verbose_logging())
cmd_line.AppendSwitch(switches::kVerboseLogging);
cmd_line.AppendSwitch(switches::kChromeFrameQuickEnable);
AppCommand cmd(cmd_line.command_line_string(), true, true);
cmd.AddWorkItems(installer_state.root_key(), cmd_key, work_item_list);
} else {
DCHECK(operation == REMOVE_COMMAND);
work_item_list->AddDeleteRegKeyWorkItem(installer_state.root_key(),
cmd_key)->set_log_message(
"removing quick-enable-cf command");
}
}
}
| 0
|
232,946
|
static CURLcode brotli_unencode_write(struct Curl_easy *data,
struct contenc_writer *writer,
const char *buf, size_t nbytes)
{
struct brotli_params *bp = (struct brotli_params *) &writer->params;
const uint8_t *src = (const uint8_t *) buf;
char *decomp;
uint8_t *dst;
size_t dstleft;
CURLcode result = CURLE_OK;
BrotliDecoderResult r = BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT;
if(!bp->br)
return CURLE_WRITE_ERROR; /* Stream already ended. */
decomp = malloc(DSIZ);
if(!decomp)
return CURLE_OUT_OF_MEMORY;
while((nbytes || r == BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT) &&
result == CURLE_OK) {
dst = (uint8_t *) decomp;
dstleft = DSIZ;
r = BrotliDecoderDecompressStream(bp->br,
&nbytes, &src, &dstleft, &dst, NULL);
result = Curl_unencode_write(data, writer->downstream,
decomp, DSIZ - dstleft);
if(result)
break;
switch(r) {
case BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:
case BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:
break;
case BROTLI_DECODER_RESULT_SUCCESS:
BrotliDecoderDestroyInstance(bp->br);
bp->br = NULL;
if(nbytes)
result = CURLE_WRITE_ERROR;
break;
default:
result = brotli_map_error(BrotliDecoderGetErrorCode(bp->br));
break;
}
}
free(decomp);
return result;
}
| 0
|
291,823
|
static void rtrs_clt_init_hb(struct rtrs_clt_path *clt_path)
{
rtrs_init_hb(&clt_path->s, &io_comp_cqe,
RTRS_HB_INTERVAL_MS,
RTRS_HB_MISSED_MAX,
rtrs_clt_hb_err_handler,
rtrs_wq);
}
| 0
|
265,447
|
static char *sqfs_basename(char *path)
{
char *fname;
fname = path + strlen(path) - 1;
while (fname >= path) {
if (*fname == '/') {
fname++;
break;
}
fname--;
}
return fname;
}
| 0
|
204,243
|
eval7(
char_u **arg,
typval_T *rettv,
evalarg_T *evalarg,
int want_string) // after "." operator
{
int evaluate = evalarg != NULL
&& (evalarg->eval_flags & EVAL_EVALUATE);
int len;
char_u *s;
char_u *name_start = NULL;
char_u *start_leader, *end_leader;
int ret = OK;
char_u *alias;
/*
* Initialise variable so that clear_tv() can't mistake this for a
* string and free a string that isn't there.
*/
rettv->v_type = VAR_UNKNOWN;
/*
* Skip '!', '-' and '+' characters. They are handled later.
*/
start_leader = *arg;
if (eval_leader(arg, in_vim9script()) == FAIL)
return FAIL;
end_leader = *arg;
if (**arg == '.' && (!isdigit(*(*arg + 1))
#ifdef FEAT_FLOAT
|| in_old_script(2)
#endif
))
{
semsg(_(e_invalid_expression_str), *arg);
++*arg;
return FAIL;
}
switch (**arg)
{
/*
* Number constant.
*/
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
case '.': ret = eval_number(arg, rettv, evaluate, want_string);
// Apply prefixed "-" and "+" now. Matters especially when
// "->" follows.
if (ret == OK && evaluate && end_leader > start_leader
&& rettv->v_type != VAR_BLOB)
ret = eval7_leader(rettv, TRUE, start_leader, &end_leader);
break;
/*
* String constant: "string".
*/
case '"': ret = eval_string(arg, rettv, evaluate);
break;
/*
* Literal string constant: 'str''ing'.
*/
case '\'': ret = eval_lit_string(arg, rettv, evaluate);
break;
/*
* List: [expr, expr]
*/
case '[': ret = eval_list(arg, rettv, evalarg, TRUE);
break;
/*
* Dictionary: #{key: val, key: val}
*/
case '#': if (in_vim9script())
{
ret = vim9_bad_comment(*arg) ? FAIL : NOTDONE;
}
else if ((*arg)[1] == '{')
{
++*arg;
ret = eval_dict(arg, rettv, evalarg, TRUE);
}
else
ret = NOTDONE;
break;
/*
* Lambda: {arg, arg -> expr}
* Dictionary: {'key': val, 'key': val}
*/
case '{': if (in_vim9script())
ret = NOTDONE;
else
ret = get_lambda_tv(arg, rettv, in_vim9script(), evalarg);
if (ret == NOTDONE)
ret = eval_dict(arg, rettv, evalarg, FALSE);
break;
/*
* Option value: &name
*/
case '&': ret = eval_option(arg, rettv, evaluate);
break;
/*
* Environment variable: $VAR.
*/
case '$': ret = eval_env_var(arg, rettv, evaluate);
break;
/*
* Register contents: @r.
*/
case '@': ++*arg;
if (evaluate)
{
if (in_vim9script() && IS_WHITE_OR_NUL(**arg))
semsg(_(e_syntax_error_at_str), *arg);
else if (in_vim9script() && !valid_yank_reg(**arg, FALSE))
emsg_invreg(**arg);
else
{
rettv->v_type = VAR_STRING;
rettv->vval.v_string = get_reg_contents(**arg,
GREG_EXPR_SRC);
}
}
if (**arg != NUL)
++*arg;
break;
/*
* nested expression: (expression).
* or lambda: (arg) => expr
*/
case '(': ret = NOTDONE;
if (in_vim9script())
{
ret = get_lambda_tv(arg, rettv, TRUE, evalarg);
if (ret == OK && evaluate)
{
ufunc_T *ufunc = rettv->vval.v_partial->pt_func;
// Compile it here to get the return type. The return
// type is optional, when it's missing use t_unknown.
// This is recognized in compile_return().
if (ufunc->uf_ret_type->tt_type == VAR_VOID)
ufunc->uf_ret_type = &t_unknown;
if (compile_def_function(ufunc,
FALSE, COMPILE_TYPE(ufunc), NULL) == FAIL)
{
clear_tv(rettv);
ret = FAIL;
}
}
}
if (ret == NOTDONE)
{
*arg = skipwhite_and_linebreak(*arg + 1, evalarg);
ret = eval1(arg, rettv, evalarg); // recursive!
*arg = skipwhite_and_linebreak(*arg, evalarg);
if (**arg == ')')
++*arg;
else if (ret == OK)
{
emsg(_(e_missing_closing_paren));
clear_tv(rettv);
ret = FAIL;
}
}
break;
default: ret = NOTDONE;
break;
}
if (ret == NOTDONE)
{
/*
* Must be a variable or function name.
* Can also be a curly-braces kind of name: {expr}.
*/
s = *arg;
len = get_name_len(arg, &alias, evaluate, TRUE);
if (alias != NULL)
s = alias;
if (len <= 0)
ret = FAIL;
else
{
int flags = evalarg == NULL ? 0 : evalarg->eval_flags;
if (evaluate && in_vim9script() && len == 1 && *s == '_')
{
emsg(_(e_cannot_use_underscore_here));
ret = FAIL;
}
else if ((in_vim9script() ? **arg : *skipwhite(*arg)) == '(')
{
// "name(..." recursive!
*arg = skipwhite(*arg);
ret = eval_func(arg, evalarg, s, len, rettv, flags, NULL);
}
else if (flags & EVAL_CONSTANT)
ret = FAIL;
else if (evaluate)
{
// get the value of "true", "false" or a variable
if (len == 4 && in_vim9script() && STRNCMP(s, "true", 4) == 0)
{
rettv->v_type = VAR_BOOL;
rettv->vval.v_number = VVAL_TRUE;
ret = OK;
}
else if (len == 5 && in_vim9script()
&& STRNCMP(s, "false", 5) == 0)
{
rettv->v_type = VAR_BOOL;
rettv->vval.v_number = VVAL_FALSE;
ret = OK;
}
else if (len == 4 && in_vim9script()
&& STRNCMP(s, "null", 4) == 0)
{
rettv->v_type = VAR_SPECIAL;
rettv->vval.v_number = VVAL_NULL;
ret = OK;
}
else
{
name_start = s;
ret = eval_variable(s, len, 0, rettv, NULL,
EVAL_VAR_VERBOSE + EVAL_VAR_IMPORT);
}
}
else
{
// skip the name
check_vars(s, len);
ret = OK;
}
}
vim_free(alias);
}
// Handle following '[', '(' and '.' for expr[expr], expr.name,
// expr(expr), expr->name(expr)
if (ret == OK)
ret = handle_subscript(arg, name_start, rettv, evalarg, TRUE);
/*
* Apply logical NOT and unary '-', from right to left, ignore '+'.
*/
if (ret == OK && evaluate && end_leader > start_leader)
ret = eval7_leader(rettv, FALSE, start_leader, &end_leader);
return ret;
}
| 1
|
379,656
|
R_API char *r_anal_var_get_constraints_readable(RAnalVar *var) {
size_t n = var->constraints.len;
if (!n) {
return NULL;
}
bool low = false, high = false;
RStrBuf sb;
r_strbuf_init (&sb);
size_t i;
for (i = 0; i < n; i += 1) {
RAnalVarConstraint *constr = r_vector_index_ptr (&var->constraints, i);
switch (constr->cond) {
case R_ANAL_COND_LE:
if (high) {
r_strbuf_append (&sb, " && ");
}
r_strbuf_appendf (&sb, "<= 0x%"PFMT64x "", constr->val);
low = true;
break;
case R_ANAL_COND_LT:
if (high) {
r_strbuf_append (&sb, " && ");
}
r_strbuf_appendf (&sb, "< 0x%"PFMT64x "", constr->val);
low = true;
break;
case R_ANAL_COND_GE:
r_strbuf_appendf (&sb, ">= 0x%"PFMT64x "", constr->val);
high = true;
break;
case R_ANAL_COND_GT:
r_strbuf_appendf (&sb, "> 0x%"PFMT64x "", constr->val);
high = true;
break;
default:
break;
}
if (low && high && i != n - 1) {
r_strbuf_append (&sb, " || ");
low = false;
high = false;
}
}
return r_strbuf_drain_nofree (&sb);
}
| 0
|
259,200
|
static int mov_read_sidx(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
int64_t stream_size = avio_size(pb);
int64_t offset = av_sat_add64(avio_tell(pb), atom.size), pts, timestamp;
uint8_t version, is_complete;
int64_t offadd;
unsigned i, j, track_id, item_count;
AVStream *st = NULL;
AVStream *ref_st = NULL;
MOVStreamContext *sc, *ref_sc = NULL;
AVRational timescale;
version = avio_r8(pb);
if (version > 1) {
avpriv_request_sample(c->fc, "sidx version %u", version);
return 0;
}
avio_rb24(pb); // flags
track_id = avio_rb32(pb); // Reference ID
for (i = 0; i < c->fc->nb_streams; i++) {
if (c->fc->streams[i]->id == track_id) {
st = c->fc->streams[i];
break;
}
}
if (!st) {
av_log(c->fc, AV_LOG_WARNING, "could not find corresponding track id %d\n", track_id);
return 0;
}
sc = st->priv_data;
timescale = av_make_q(1, avio_rb32(pb));
if (timescale.den <= 0) {
av_log(c->fc, AV_LOG_ERROR, "Invalid sidx timescale 1/%d\n", timescale.den);
return AVERROR_INVALIDDATA;
}
if (version == 0) {
pts = avio_rb32(pb);
offadd= avio_rb32(pb);
} else {
pts = avio_rb64(pb);
offadd= avio_rb64(pb);
}
if (av_sat_add64(offset, offadd) != offset + (uint64_t)offadd)
return AVERROR_INVALIDDATA;
offset += (uint64_t)offadd;
avio_rb16(pb); // reserved
item_count = avio_rb16(pb);
if (item_count == 0)
return AVERROR_INVALIDDATA;
for (i = 0; i < item_count; i++) {
int index;
MOVFragmentStreamInfo * frag_stream_info;
uint32_t size = avio_rb32(pb);
uint32_t duration = avio_rb32(pb);
if (size & 0x80000000) {
avpriv_request_sample(c->fc, "sidx reference_type 1");
return AVERROR_PATCHWELCOME;
}
avio_rb32(pb); // sap_flags
timestamp = av_rescale_q(pts, timescale, st->time_base);
index = update_frag_index(c, offset);
frag_stream_info = get_frag_stream_info(&c->frag_index, index, track_id);
if (frag_stream_info)
frag_stream_info->sidx_pts = timestamp;
if (av_sat_add64(offset, size) != offset + (uint64_t)size ||
av_sat_add64(pts, duration) != pts + (uint64_t)duration
)
return AVERROR_INVALIDDATA;
offset += size;
pts += duration;
}
st->duration = sc->track_end = pts;
sc->has_sidx = 1;
// See if the remaining bytes are just an mfra which we can ignore.
is_complete = offset == stream_size;
if (!is_complete && (pb->seekable & AVIO_SEEKABLE_NORMAL) && stream_size > 0 ) {
int64_t ret;
int64_t original_pos = avio_tell(pb);
if (!c->have_read_mfra_size) {
if ((ret = avio_seek(pb, stream_size - 4, SEEK_SET)) < 0)
return ret;
c->mfra_size = avio_rb32(pb);
c->have_read_mfra_size = 1;
if ((ret = avio_seek(pb, original_pos, SEEK_SET)) < 0)
return ret;
}
if (offset == stream_size - c->mfra_size)
is_complete = 1;
}
if (is_complete) {
// Find first entry in fragment index that came from an sidx.
// This will pretty much always be the first entry.
for (i = 0; i < c->frag_index.nb_items; i++) {
MOVFragmentIndexItem * item = &c->frag_index.item[i];
for (j = 0; ref_st == NULL && j < item->nb_stream_info; j++) {
MOVFragmentStreamInfo * si;
si = &item->stream_info[j];
if (si->sidx_pts != AV_NOPTS_VALUE) {
ref_st = c->fc->streams[j];
ref_sc = ref_st->priv_data;
break;
}
}
}
if (ref_st) for (i = 0; i < c->fc->nb_streams; i++) {
st = c->fc->streams[i];
sc = st->priv_data;
if (!sc->has_sidx) {
st->duration = sc->track_end = av_rescale(ref_st->duration, sc->time_scale, ref_sc->time_scale);
}
}
c->frag_index.complete = 1;
}
return 0;
}
| 0
|
313,761
|
clearopbeep(oparg_T *oap)
{
clearop(oap);
beep_flush();
}
| 0
|
273,405
|
void LSTMBlockCellBpropWithEigen(
const LSTMBlockCell& cell, OpKernelContext* ctx, const Device& d,
bool use_peephole, typename TTypes<T>::ConstMatrix x,
typename TTypes<T>::ConstMatrix cs_prev,
typename TTypes<T>::ConstMatrix h_prev, typename TTypes<T>::ConstMatrix w,
typename TTypes<T>::ConstVec wci, typename TTypes<T>::ConstVec wcf,
typename TTypes<T>::ConstVec wco, typename TTypes<T>::ConstVec b,
typename TTypes<T>::ConstMatrix i, typename TTypes<T>::ConstMatrix cs,
typename TTypes<T>::ConstMatrix f, typename TTypes<T>::ConstMatrix o,
typename TTypes<T>::ConstMatrix ci, typename TTypes<T>::ConstMatrix co,
typename TTypes<T>::ConstMatrix cs_grad,
typename TTypes<T>::ConstMatrix h_grad, typename TTypes<T>::Matrix do_,
typename TTypes<T>::Matrix dcs, typename TTypes<T>::Matrix dci,
typename TTypes<T>::Matrix df, typename TTypes<T>::Matrix di,
typename TTypes<T>::Matrix dgates, typename TTypes<T>::Matrix cs_prev_grad,
typename TTypes<T>::Vec wci_grad, typename TTypes<T>::Vec wcf_grad,
typename TTypes<T>::Vec wco_grad) {
// do[t] = sigm'(o[t]) .* dh[t] .* co[t]
do_.device(d) = o * (o.constant(T(1)) - o) * h_grad * co;
// dcs[t] += tanh'(cs[t]) .* dh[t] .* o[t] + dcs[t + 1] .* f[t + 1]
dcs.device(d) = (co.constant(T(1)) - co * co) * h_grad * o + cs_grad;
Eigen::array<Eigen::DenseIndex, 2> p_shape({1, cell.cell_size()});
Eigen::array<Eigen::DenseIndex, 2> p_broadcast_shape({cell.batch_size(), 1});
if (use_peephole) {
dcs.device(d) =
dcs + do_ * wco.reshape(p_shape).broadcast(p_broadcast_shape);
}
// dci[t] = tanh'(ci[t]) dcs[t] i[t]
dci.device(d) = (ci.constant(T(1)) - ci * ci) * dcs * i;
// df[t] = sigm'(f[t]) dcs[t] cs[t - 1]
df.device(d) = f * (f.constant(T(1)) - f) * dcs * cs_prev;
// di[t] = sigm'(i[t]) dcs[t] ci[t]
di.device(d) = i * (i.constant(T(1)) - i) * dcs * ci;
dgates.slice(cell.gates_i_offsets(), cell.cell_extents()).device(d) = di;
dgates.slice(cell.gates_c_offsets(gate_layout), cell.cell_extents())
.device(d) = dci;
dgates.slice(cell.gates_f_offsets(gate_layout), cell.cell_extents())
.device(d) = df;
dgates.slice(cell.gates_o_offsets(), cell.cell_extents()).device(d) = do_;
cs_prev_grad.device(d) = dcs * f;
if (use_peephole) {
cs_prev_grad.device(d) =
cs_prev_grad + di * wci.reshape(p_shape).broadcast(p_broadcast_shape) +
df * wcf.reshape(p_shape).broadcast(p_broadcast_shape);
wci_grad.device(d) = (di * cs_prev).sum(Eigen::array<int, 1>({0}));
wcf_grad.device(d) = (df * cs_prev).sum(Eigen::array<int, 1>({0}));
wco_grad.device(d) = (do_ * cs).sum(Eigen::array<int, 1>({0}));
}
}
| 0
|
448,581
|
gdk_pixbuf__xbm_image_load (FILE *f,
GError **error)
{
return gdk_pixbuf__xbm_image_load_real (f, NULL, error);
}
| 0
|
361,752
|
static inline void em28xx_set_model(struct em28xx *dev)
{
dev->board = em28xx_boards[dev->model];
dev->has_msp34xx = dev->board.has_msp34xx;
dev->is_webcam = dev->board.is_webcam;
em28xx_set_xclk_i2c_speed(dev);
/* Should be initialized early, for I2C to work */
dev->def_i2c_bus = dev->board.def_i2c_bus;
}
| 0
|
246,726
|
void PrintEncodeUsage()
{
u32 i=0;
gf_sys_format_help(helpout, help_flags, "# MPEG-4 Scene Encoding Options\n"
"## General considerations\n"
"MP4Box supports encoding and decoding of of BT, XMT, VRML and (partially) X3D formats int MPEG-4 BIFS, and encoding and decoding of XSR and SVG into MPEG-4 LASeR\n"
"Any media track specified through a `MuxInfo` element will be imported in the resulting MP4 file.\n"
"See https://wiki.gpac.io/MPEG-4-BIFS-Textual-Format and related pages.\n"
"## Scene Random Access\n"
"MP4Box can encode BIFS or LASeR streams and insert random access points at a given frequency. This is useful when packaging content for broadcast, where users will not turn in the scene at the same time. In MPEG-4 terminology, this is called the __scene carousel__."
"## BIFS Chunk Processing\n"
"The BIFS chunk encoding mode alows encoding single BIFS access units from an initial context and a set of commands.\n"
"The generated AUs are raw BIFS (not SL-packetized), in files called FILE-ESID-AUIDX.bifs, with FILE the basename of the input file.\n"
"Commands with a timing of 0 in the input will modify the carousel version only (i.e. output context).\n"
"Commands with a timing different from 0 in the input will generate new AUs.\n"
" \n"
"Options:\n"
);
while (m4b_senc_args[i].name) {
GF_GPACArg *arg = (GF_GPACArg *) &m4b_senc_args[i];
i++;
gf_sys_print_arg(helpout, help_flags, arg, "mp4box-senc");
}
}
| 0
|
90,807
|
void QuotaManager::SetPersistentHostQuota(const std::string& host,
int64 new_quota,
HostQuotaCallback* callback_ptr) {
scoped_ptr<HostQuotaCallback> callback(callback_ptr);
LazyInitialize();
if (host.empty()) {
callback->Run(kQuotaErrorNotSupported, host, kStorageTypePersistent, 0);
return;
}
if (new_quota < 0) {
callback->Run(kQuotaErrorInvalidModification,
host, kStorageTypePersistent, -1);
return;
}
if (!db_disabled_) {
scoped_refptr<UpdatePersistentHostQuotaTask> task(
new UpdatePersistentHostQuotaTask(
this, host, new_quota, callback.release()));
task->Start();
} else {
callback->Run(kQuotaErrorInvalidAccess,
host, kStorageTypePersistent, -1);
}
}
| 0
|
318,109
|
static void rsi_deinit_usb_interface(struct rsi_hw *adapter)
{
struct rsi_91x_usbdev *dev = (struct rsi_91x_usbdev *)adapter->rsi_dev;
rsi_kill_thread(&dev->rx_thread);
usb_free_urb(dev->rx_cb[0].rx_urb);
if (adapter->priv->coex_mode > 1)
usb_free_urb(dev->rx_cb[1].rx_urb);
kfree(dev->tx_buffer);
}
| 0
|
390,601
|
ProcXkbGetNames(ClientPtr client)
{
DeviceIntPtr dev;
XkbDescPtr xkb;
xkbGetNamesReply rep;
REQUEST(xkbGetNamesReq);
REQUEST_SIZE_MATCH(xkbGetNamesReq);
if (!(client->xkbClientFlags&_XkbClientInitialized))
return BadAccess;
CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess);
CHK_MASK_LEGAL(0x01,stuff->which,XkbAllNamesMask);
xkb = dev->key->xkbInfo->desc;
rep.type= X_Reply;
rep.sequenceNumber= client->sequence;
rep.length = 0;
rep.deviceID = dev->id;
rep.which = stuff->which;
rep.nTypes = xkb->map->num_types;
rep.firstKey = xkb->min_key_code;
rep.nKeys = XkbNumKeys(xkb);
if (xkb->names!=NULL) {
rep.nKeyAliases= xkb->names->num_key_aliases;
rep.nRadioGroups = xkb->names->num_rg;
}
else {
rep.nKeyAliases= rep.nRadioGroups= 0;
}
XkbComputeGetNamesReplySize(xkb,&rep);
return XkbSendNames(client,xkb,&rep);
}
| 0
|
220,214
|
void Graph::ToGraphDef(GraphDef* graph_def) const {
ToGraphDefSubRange(graph_def, 0);
}
| 0
|
369,308
|
static bool req_need_defer(struct io_kiocb *req, u32 seq)
{
if (unlikely(req->flags & REQ_F_IO_DRAIN)) {
struct io_ring_ctx *ctx = req->ctx;
return seq + READ_ONCE(ctx->cq_extra) != ctx->cached_cq_tail;
}
return false;
}
| 0
|
229,274
|
void cql_server::response::write(const cql3::prepared_metadata& m, uint8_t version)
{
bool global_tables_spec = m.flags().contains<cql3::prepared_metadata::flag::GLOBAL_TABLES_SPEC>();
write_int(m.flags().mask());
write_int(m.names().size());
if (version >= 4) {
if (!global_tables_spec) {
write_int(0);
} else {
write_int(m.partition_key_bind_indices().size());
for (uint16_t bind_index : m.partition_key_bind_indices()) {
write_short(bind_index);
}
}
}
if (global_tables_spec) {
write_string(m.names()[0]->ks_name);
write_string(m.names()[0]->cf_name);
}
for (auto const& name : m.names()) {
if (!global_tables_spec) {
write_string(name->ks_name);
write_string(name->cf_name);
}
write_string(name->name->text());
type_codec::encode(*this, name->type);
}
}
| 0
|
508,837
|
void LEX::cleanup_after_one_table_open()
{
/*
thd->lex->derived_tables & additional units may be set if we open
a view. It is necessary to clear thd->lex->derived_tables flag
to prevent processing of derived tables during next open_and_lock_tables
if next table is a real table and cleanup & remove underlying units
NOTE: all units will be connected to thd->lex->select_lex, because we
have not UNION on most upper level.
*/
if (all_selects_list != &select_lex)
{
derived_tables= 0;
select_lex.exclude_from_table_unique_test= false;
/* cleunup underlying units (units of VIEW) */
for (SELECT_LEX_UNIT *un= select_lex.first_inner_unit();
un;
un= un->next_unit())
un->cleanup();
/* reduce all selects list to default state */
all_selects_list= &select_lex;
/* remove underlying units (units of VIEW) subtree */
select_lex.cut_subtree();
}
}
| 0
|
225,788
|
GF_Box *stco_box_new()
{
ISOM_DECL_BOX_ALLOC(GF_ChunkOffsetBox, GF_ISOM_BOX_TYPE_STCO);
return (GF_Box *)tmp;
}
| 0
|
274,886
|
TEST(ComparisonsTest, QuantizedUInt8NotEqualWithBroadcast) {
const float kMin = -1.f;
const float kMax = 128.f;
std::vector<std::vector<int>> test_shapes = {
{6}, {2, 3}, {2, 1, 3}, {1, 3, 1, 2}};
for (int i = 0; i < test_shapes.size(); ++i) {
ComparisonOpModel model({TensorType_UINT8, test_shapes[i], kMin, kMax},
{TensorType_UINT8, {}, kMin, kMax},
TensorType_UINT8, BuiltinOperator_NOT_EQUAL);
model.QuantizeAndPopulate<uint8_t>(model.input1(), {20, 2, 7, 8, 11, 20});
model.QuantizeAndPopulate<uint8_t>(model.input2(), {2});
model.Invoke();
EXPECT_THAT(model.GetOutput(),
ElementsAre(true, false, true, true, true, true))
<< "With shape number " << i;
}
}
| 0
|
379,706
|
R_API const char *r_anal_function_get_var_reg_at(RAnalFunction *fcn, st64 delta, ut64 addr) {
st64 offset = addr - fcn->addr;
RPVector *inst_accesses = ht_up_find (fcn->inst_vars, offset, NULL);
if (!inst_accesses) {
return NULL;
}
RAnalVar *var = NULL;
void **it;
r_pvector_foreach (inst_accesses, it) {
RAnalVar *v = *it;
if (v->delta == delta) {
var = v;
break;
}
}
if (!var) {
return NULL;
}
size_t index;
r_vector_lower_bound (&var->accesses, offset, index, ACCESS_CMP);
RAnalVarAccess *acc = NULL;
if (index < var->accesses.len) {
acc = r_vector_index_ptr (&var->accesses, index);
}
if (!acc || acc->offset != offset) {
return NULL;
}
return acc->reg;
}
| 0
|
259,164
|
int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
{
AVStream *st;
MOVStreamContext *sc;
int pseudo_stream_id;
av_assert0 (c->fc->nb_streams >= 1);
st = c->fc->streams[c->fc->nb_streams-1];
sc = st->priv_data;
for (pseudo_stream_id = 0;
pseudo_stream_id < entries && !pb->eof_reached;
pseudo_stream_id++) {
//Parsing Sample description table
enum AVCodecID id;
int ret, dref_id = 1;
MOVAtom a = { AV_RL32("stsd") };
int64_t start_pos = avio_tell(pb);
int64_t size = avio_rb32(pb); /* size */
uint32_t format = avio_rl32(pb); /* data format */
if (size >= 16) {
avio_rb32(pb); /* reserved */
avio_rb16(pb); /* reserved */
dref_id = avio_rb16(pb);
} else if (size <= 7) {
av_log(c->fc, AV_LOG_ERROR,
"invalid size %"PRId64" in stsd\n", size);
return AVERROR_INVALIDDATA;
}
if (mov_skip_multiple_stsd(c, pb, st->codecpar->codec_tag, format,
size - (avio_tell(pb) - start_pos))) {
sc->stsd_count++;
continue;
}
sc->pseudo_stream_id = st->codecpar->codec_tag ? -1 : pseudo_stream_id;
sc->dref_id= dref_id;
sc->format = format;
id = mov_codec_id(st, format);
av_log(c->fc, AV_LOG_TRACE,
"size=%"PRId64" 4CC=%s codec_type=%d\n", size,
av_fourcc2str(format), st->codecpar->codec_type);
st->codecpar->codec_id = id;
if (st->codecpar->codec_type==AVMEDIA_TYPE_VIDEO) {
mov_parse_stsd_video(c, pb, st, sc);
} else if (st->codecpar->codec_type==AVMEDIA_TYPE_AUDIO) {
mov_parse_stsd_audio(c, pb, st, sc);
if (st->codecpar->sample_rate < 0) {
av_log(c->fc, AV_LOG_ERROR, "Invalid sample rate %d\n", st->codecpar->sample_rate);
return AVERROR_INVALIDDATA;
}
if (st->codecpar->ch_layout.nb_channels < 0) {
av_log(c->fc, AV_LOG_ERROR, "Invalid channels %d\n", st->codecpar->ch_layout.nb_channels);
return AVERROR_INVALIDDATA;
}
} else if (st->codecpar->codec_type==AVMEDIA_TYPE_SUBTITLE){
mov_parse_stsd_subtitle(c, pb, st, sc,
size - (avio_tell(pb) - start_pos));
} else {
ret = mov_parse_stsd_data(c, pb, st, sc,
size - (avio_tell(pb) - start_pos));
if (ret < 0)
return ret;
}
/* this will read extra atoms at the end (wave, alac, damr, avcC, hvcC, SMI ...) */
a.size = size - (avio_tell(pb) - start_pos);
if (a.size > 8) {
if ((ret = mov_read_default(c, pb, a)) < 0)
return ret;
} else if (a.size > 0)
avio_skip(pb, a.size);
if (sc->extradata && st->codecpar->extradata) {
int extra_size = st->codecpar->extradata_size;
/* Move the current stream extradata to the stream context one. */
sc->extradata_size[pseudo_stream_id] = extra_size;
sc->extradata[pseudo_stream_id] = st->codecpar->extradata;
st->codecpar->extradata = NULL;
st->codecpar->extradata_size = 0;
}
sc->stsd_count++;
}
if (pb->eof_reached) {
av_log(c->fc, AV_LOG_WARNING, "reached eof, corrupted STSD atom\n");
return AVERROR_EOF;
}
return 0;
}
| 0
|
198,449
|
PJ_DEF(pj_status_t) pjstun_parse_msg( void *buf, pj_size_t buf_len,
pjstun_msg *msg)
{
pj_uint16_t msg_type, msg_len;
char *p_attr;
PJ_CHECK_STACK();
msg->hdr = (pjstun_msg_hdr*)buf;
msg_type = pj_ntohs(msg->hdr->type);
switch (msg_type) {
case PJSTUN_BINDING_REQUEST:
case PJSTUN_BINDING_RESPONSE:
case PJSTUN_BINDING_ERROR_RESPONSE:
case PJSTUN_SHARED_SECRET_REQUEST:
case PJSTUN_SHARED_SECRET_RESPONSE:
case PJSTUN_SHARED_SECRET_ERROR_RESPONSE:
break;
default:
PJ_LOG(4,(THIS_FILE, "Error: unknown msg type %d", msg_type));
return PJLIB_UTIL_ESTUNINMSGTYPE;
}
msg_len = pj_ntohs(msg->hdr->length);
if (msg_len != buf_len - sizeof(pjstun_msg_hdr)) {
PJ_LOG(4,(THIS_FILE, "Error: invalid msg_len %d (expecting %d)",
msg_len, buf_len - sizeof(pjstun_msg_hdr)));
return PJLIB_UTIL_ESTUNINMSGLEN;
}
msg->attr_count = 0;
p_attr = (char*)buf + sizeof(pjstun_msg_hdr);
while (msg_len > 0) {
pjstun_attr_hdr **attr = &msg->attr[msg->attr_count];
pj_uint32_t len;
pj_uint16_t attr_type;
*attr = (pjstun_attr_hdr*)p_attr;
len = pj_ntohs((pj_uint16_t) ((*attr)->length)) + sizeof(pjstun_attr_hdr);
len = (len + 3) & ~3;
if (msg_len < len) {
PJ_LOG(4,(THIS_FILE, "Error: length mismatch in attr %d",
msg->attr_count));
return PJLIB_UTIL_ESTUNINATTRLEN;
}
attr_type = pj_ntohs((*attr)->type);
if (attr_type > PJSTUN_ATTR_REFLECTED_FROM &&
attr_type != PJSTUN_ATTR_XOR_MAPPED_ADDR)
{
PJ_LOG(5,(THIS_FILE, "Warning: unknown attr type %x in attr %d. "
"Attribute was ignored.",
attr_type, msg->attr_count));
}
msg_len = (pj_uint16_t)(msg_len - len);
p_attr += len;
++msg->attr_count;
}
return PJ_SUCCESS;
}
| 1
|
294,535
|
c_julian_leap_p(int y)
{
return MOD(y, 4) == 0;
}
| 0
|
512,255
|
double val_real()
{
return m_value.to_datetime(current_thd).to_double();
}
| 0
|
432,247
|
void qemu_ram_free(struct uc_struct *uc, RAMBlock *block)
{
if (!block) {
return;
}
//if (block->host) {
// ram_block_notify_remove(block->host, block->max_length);
//}
QLIST_REMOVE_RCU(block, next);
uc->ram_list.mru_block = NULL;
/* Write list before version */
//smp_wmb();
// call_rcu(block, reclaim_ramblock, rcu);
reclaim_ramblock(uc, block);
}
| 0
|
220,433
|
mrb_ary_join_m(mrb_state *mrb, mrb_value ary)
{
mrb_value sep = mrb_nil_value();
mrb_get_args(mrb, "|S!", &sep);
return mrb_ary_join(mrb, ary, sep);
}
| 0
|
220,440
|
mrb_ary_new_from_values(mrb_state *mrb, mrb_int size, const mrb_value *vals)
{
struct RArray *a = ary_new_from_values(mrb, size, vals);
return mrb_obj_value(a);
}
| 0
|
424,893
|
static void iwl_trans_pcie_set_pmi(struct iwl_trans *trans, bool state)
{
if (state)
set_bit(STATUS_TPOWER_PMI, &trans->status);
else
clear_bit(STATUS_TPOWER_PMI, &trans->status);
}
| 0
|
224,469
|
static char *ttxt_parse_string(char *str, Bool strip_lines)
{
u32 i=0;
u32 k=0;
u32 len = (u32) strlen(str);
u32 state = 0;
if (!strip_lines) {
for (i=0; i<len; i++) {
if ((str[i] == '\r') && (str[i+1] == '\n')) {
i++;
}
str[k] = str[i];
k++;
}
str[k]=0;
return str;
}
if (str[0]!='\'') return str;
for (i=0; i<len; i++) {
if (str[i] == '\'') {
if (!state) {
if (k) {
str[k]='\n';
k++;
}
state = 1; //!state;
} else {
if ( (i+1==len) ||
((str[i+1]==' ') || (str[i+1]=='\n') || (str[i+1]=='\r') || (str[i+1]=='\t') || (str[i+1]=='\''))
) {
state = !state;
} else {
str[k] = str[i];
k++;
}
}
} else if (state) {
str[k] = str[i];
k++;
}
}
str[k]=0;
return str;
}
| 0
|
219,024
|
Status ConstantFolding::MaterializeConstantValuedNode(
NodeDef* node, const GraphProperties& properties) {
if (disable_compressed_tensor_optimization_) {
return Status::OK();
}
// Nodes that generate constant-valued outputs can be represented compactly in
// compressed format, regardless of their shape.
const std::vector<OpInfo::TensorProperties>& output_props =
properties.GetOutputProperties(node->name());
if (output_props.size() != 1) return Status::OK();
const auto& output_shape = output_props[0].shape();
if (!PartialTensorShape(output_shape).IsFullyDefined()) {
return Status::OK();
}
if (IsFill(*node)) {
const auto output_dtype = output_props[0].dtype();
NodeDef* input_node = nullptr;
for (int i = 0; i < 2; ++i) {
input_node = node_map_->GetNode(NodeName(node->input(i)));
if (input_node == nullptr || !IsReallyConstant(*input_node)) {
return Status::OK();
}
}
TF_RETURN_IF_ERROR(CheckAttrExists(*input_node, "value"));
// Copy the input tensor to the fill node, set the output shape and data
// type, and change the node type to Const.
TensorProto* tensor = (*node->mutable_attr())["value"].mutable_tensor();
const TensorProto& input_tensor = input_node->attr().at("value").tensor();
if (!input_tensor.tensor_content().empty()) {
// Convert the value to repeated field format, so we can use the
// decompression mechanism to store only a single value in the constant
// node, even if the shape specified in the original Fill is large.
Tensor t;
if (!t.FromProto(input_tensor)) {
return errors::InvalidArgument(
"Could not construct Tensor form TensorProto in node: ",
input_node->name());
}
tensor->clear_tensor_content();
t.AsProtoField(tensor);
} else {
*tensor = input_tensor;
}
*(tensor->mutable_tensor_shape()) = output_shape;
(*node->mutable_attr())["dtype"].set_type(output_dtype);
node->mutable_attr()->erase("T");
node->mutable_attr()->erase("index_type");
node->set_op("Const");
for (int i = 0; i < 2; i++) {
// Change inputs to a control inputs.
const string ctrl_dep = AsControlDependency(node->input(i));
node_map_->UpdateInput(node->name(), node->input(i), ctrl_dep);
node->set_input(i, ctrl_dep);
}
graph_modified_ = true;
} else {
double value =
(IsZerosLike(*node) ? 0.0 : (IsOnesLike(*node) ? 1.0 : -1.0));
if (value >= 0) {
TF_RETURN_IF_ERROR(ReplaceOperationWithConstant(
value, properties, output_shape, node, graph_));
}
}
return Status::OK();
}
| 0
|
205,747
|
static void sixpack_close(struct tty_struct *tty)
{
struct sixpack *sp;
write_lock_irq(&disc_data_lock);
sp = tty->disc_data;
tty->disc_data = NULL;
write_unlock_irq(&disc_data_lock);
if (!sp)
return;
/*
* We have now ensured that nobody can start using ap from now on, but
* we have to wait for all existing users to finish.
*/
if (!refcount_dec_and_test(&sp->refcnt))
wait_for_completion(&sp->dead);
/* We must stop the queue to avoid potentially scribbling
* on the free buffers. The sp->dead completion is not sufficient
* to protect us from sp->xbuff access.
*/
netif_stop_queue(sp->dev);
del_timer_sync(&sp->tx_t);
del_timer_sync(&sp->resync_t);
/* Free all 6pack frame buffers. */
kfree(sp->rbuff);
kfree(sp->xbuff);
unregister_netdev(sp->dev);
}
| 1
|
211,695
|
reg_match_visual(void)
{
pos_T top, bot;
linenr_T lnum;
colnr_T col;
win_T *wp = rex.reg_win == NULL ? curwin : rex.reg_win;
int mode;
colnr_T start, end;
colnr_T start2, end2;
colnr_T cols;
colnr_T curswant;
// Check if the buffer is the current buffer.
if (rex.reg_buf != curbuf || VIsual.lnum == 0)
return FALSE;
if (VIsual_active)
{
if (LT_POS(VIsual, wp->w_cursor))
{
top = VIsual;
bot = wp->w_cursor;
}
else
{
top = wp->w_cursor;
bot = VIsual;
}
mode = VIsual_mode;
curswant = wp->w_curswant;
}
else
{
if (LT_POS(curbuf->b_visual.vi_start, curbuf->b_visual.vi_end))
{
top = curbuf->b_visual.vi_start;
bot = curbuf->b_visual.vi_end;
}
else
{
top = curbuf->b_visual.vi_end;
bot = curbuf->b_visual.vi_start;
}
mode = curbuf->b_visual.vi_mode;
curswant = curbuf->b_visual.vi_curswant;
}
lnum = rex.lnum + rex.reg_firstlnum;
if (lnum < top.lnum || lnum > bot.lnum)
return FALSE;
if (mode == 'v')
{
col = (colnr_T)(rex.input - rex.line);
if ((lnum == top.lnum && col < top.col)
|| (lnum == bot.lnum && col >= bot.col + (*p_sel != 'e')))
return FALSE;
}
else if (mode == Ctrl_V)
{
getvvcol(wp, &top, &start, NULL, &end);
getvvcol(wp, &bot, &start2, NULL, &end2);
if (start2 < start)
start = start2;
if (end2 > end)
end = end2;
if (top.col == MAXCOL || bot.col == MAXCOL || curswant == MAXCOL)
end = MAXCOL;
cols = win_linetabsize(wp, rex.line, (colnr_T)(rex.input - rex.line));
if (cols < start || cols > end - (*p_sel == 'e'))
return FALSE;
}
return TRUE;
}
| 1
|
331,779
|
QRectF QVectorPath::controlPointRect() const
{
if (m_hints & ControlPointRect)
return QRectF(QPointF(m_cp_rect.x1, m_cp_rect.y1), QPointF(m_cp_rect.x2, m_cp_rect.y2));
if (m_count == 0) {
m_cp_rect.x1 = m_cp_rect.x2 = m_cp_rect.y1 = m_cp_rect.y2 = 0;
m_hints |= ControlPointRect;
return QRectF(QPointF(m_cp_rect.x1, m_cp_rect.y1), QPointF(m_cp_rect.x2, m_cp_rect.y2));
}
Q_ASSERT(m_points && m_count > 0);
const qreal *pts = m_points;
m_cp_rect.x1 = m_cp_rect.x2 = *pts;
++pts;
m_cp_rect.y1 = m_cp_rect.y2 = *pts;
++pts;
const qreal *epts = m_points + (m_count << 1);
while (pts < epts) {
qreal x = *pts;
if (x < m_cp_rect.x1) m_cp_rect.x1 = x;
else if (x > m_cp_rect.x2) m_cp_rect.x2 = x;
++pts;
qreal y = *pts;
if (y < m_cp_rect.y1) m_cp_rect.y1 = y;
else if (y > m_cp_rect.y2) m_cp_rect.y2 = y;
++pts;
}
m_hints |= ControlPointRect;
return QRectF(QPointF(m_cp_rect.x1, m_cp_rect.y1), QPointF(m_cp_rect.x2, m_cp_rect.y2));
}
| 0
|
365,615
|
_asn1_find_up (asn1_node node)
{
asn1_node p;
if (node == NULL)
return NULL;
p = node;
while ((p->left != NULL) && (p->left->right == p))
p = p->left;
return p->left;
}
| 0
|
312,413
|
qf_init_ext(
qf_info_T *qi,
int qf_idx,
char_u *efile,
buf_T *buf,
typval_T *tv,
char_u *errorformat,
int newlist, // TRUE: start a new error list
linenr_T lnumfirst, // first line number to use
linenr_T lnumlast, // last line number to use
char_u *qf_title,
char_u *enc)
{
qf_list_T *qfl;
qfstate_T state;
qffields_T fields;
qfline_T *old_last = NULL;
int adding = FALSE;
static efm_T *fmt_first = NULL;
char_u *efm;
static char_u *last_efm = NULL;
int retval = -1; // default: return error flag
int status;
// Do not used the cached buffer, it may have been wiped out.
VIM_CLEAR(qf_last_bufname);
CLEAR_FIELD(state);
CLEAR_FIELD(fields);
if ((qf_alloc_fields(&fields) == FAIL) ||
(qf_setup_state(&state, enc, efile, tv, buf,
lnumfirst, lnumlast) == FAIL))
goto qf_init_end;
if (newlist || qf_idx == qi->qf_listcount)
{
// make place for a new list
qf_new_list(qi, qf_title);
qf_idx = qi->qf_curlist;
qfl = qf_get_list(qi, qf_idx);
}
else
{
// Adding to existing list, use last entry.
adding = TRUE;
qfl = qf_get_list(qi, qf_idx);
if (!qf_list_empty(qfl))
old_last = qfl->qf_last;
}
// Use the local value of 'errorformat' if it's set.
if (errorformat == p_efm && tv == NULL && *buf->b_p_efm != NUL)
efm = buf->b_p_efm;
else
efm = errorformat;
// If the errorformat didn't change between calls, then reuse the
// previously parsed values.
if (last_efm == NULL || (STRCMP(last_efm, efm) != 0))
{
// free the previously parsed data
VIM_CLEAR(last_efm);
free_efm_list(&fmt_first);
// parse the current 'efm'
fmt_first = parse_efm_option(efm);
if (fmt_first != NULL)
last_efm = vim_strsave(efm);
}
if (fmt_first == NULL) // nothing found
goto error2;
// got_int is reset here, because it was probably set when killing the
// ":make" command, but we still want to read the errorfile then.
got_int = FALSE;
// Read the lines in the error file one by one.
// Try to recognize one of the error formats in each line.
while (!got_int)
{
status = qf_init_process_nextline(qfl, fmt_first, &state, &fields);
if (status == QF_NOMEM) // memory alloc failure
goto qf_init_end;
if (status == QF_END_OF_INPUT) // end of input
break;
if (status == QF_FAIL)
goto error2;
line_breakcheck();
}
if (state.fd == NULL || !ferror(state.fd))
{
if (qfl->qf_index == 0)
{
// no valid entry found
qfl->qf_ptr = qfl->qf_start;
qfl->qf_index = 1;
qfl->qf_nonevalid = TRUE;
}
else
{
qfl->qf_nonevalid = FALSE;
if (qfl->qf_ptr == NULL)
qfl->qf_ptr = qfl->qf_start;
}
// return number of matches
retval = qfl->qf_count;
goto qf_init_end;
}
emsg(_(e_error_while_reading_errorfile));
error2:
if (!adding)
{
// Error when creating a new list. Free the new list
qf_free(qfl);
qi->qf_listcount--;
if (qi->qf_curlist > 0)
--qi->qf_curlist;
}
qf_init_end:
if (qf_idx == qi->qf_curlist)
qf_update_buffer(qi, old_last);
qf_cleanup_state(&state);
qf_free_fields(&fields);
return retval;
}
| 0
|
409,423
|
settmode(tmode_T tmode)
{
#ifdef FEAT_GUI
// don't set the term where gvim was started to any mode
if (gui.in_use)
return;
#endif
if (full_screen)
{
/*
* When returning after calling a shell cur_tmode is TMODE_UNKNOWN,
* set the terminal to raw mode, even though we think it already is,
* because the shell program may have reset the terminal mode.
* When we think the terminal is normal, don't try to set it to
* normal again, because that causes problems (logout!) on some
* machines.
*/
if (tmode != cur_tmode)
{
#ifdef FEAT_TERMRESPONSE
# ifdef FEAT_GUI
if (!gui.in_use && !gui.starting)
# endif
{
// May need to check for T_CRV response and termcodes, it
// doesn't work in Cooked mode, an external program may get
// them.
if (tmode != TMODE_RAW && termrequest_any_pending())
(void)vpeekc_nomap();
check_for_codes_from_term();
}
#endif
if (tmode != TMODE_RAW)
mch_setmouse(FALSE); // switch mouse off
// Disable bracketed paste and modifyOtherKeys in cooked mode.
// Avoid doing this too often, on some terminals the codes are not
// handled properly.
if (termcap_active && tmode != TMODE_SLEEP
&& cur_tmode != TMODE_SLEEP)
{
MAY_WANT_TO_LOG_THIS;
if (tmode != TMODE_RAW)
{
out_str(T_BD); // disable bracketed paste mode
out_str(T_CTE); // possibly disables modifyOtherKeys
}
else
{
out_str(T_BE); // enable bracketed paste mode (should
// be before mch_settmode().
out_str(T_CTI); // possibly enables modifyOtherKeys
}
}
out_flush();
mch_settmode(tmode); // machine specific function
cur_tmode = tmode;
if (tmode == TMODE_RAW)
setmouse(); // may switch mouse on
out_flush();
}
#ifdef FEAT_TERMRESPONSE
may_req_termresponse();
#endif
}
}
| 0
|
246,492
|
RList *r_bin_wasm_get_sections(RBinWasmObj *bin) {
RList *ret = NULL;
RBinWasmSection *ptr = NULL;
if (!bin) {
return NULL;
}
if (bin->g_sections) {
return bin->g_sections;
}
if (!(ret = r_list_newf ((RListFree)wasm_sec_free))) {
return NULL;
}
RBuffer *b = bin->buf;
ut64 bound = r_buf_size (b) - 1;
r_buf_seek (b, 8, R_BUF_SET);
while (r_buf_tell (b) <= bound) {
if (!(ptr = R_NEW0 (RBinWasmSection))) {
return ret;
}
if (!consume_u7_r (b, bound, &ptr->id)) {
goto beach;
}
if (!consume_u32_r (b, bound, &ptr->size)) {
goto beach;
}
// against spec. TODO: choose criteria for parsing
if (ptr->size < 1) {
goto beach;
// free (ptr);
// continue;
}
ptr->offset = r_buf_tell (b);
switch (ptr->id) {
case R_BIN_WASM_SECTION_CUSTOM:
// eprintf("custom section: 0x%x, ", (ut32)b->cur);
if (!consume_encoded_name_new (b, bound, &ptr->name_len, &ptr->name)) {
goto beach;
}
break;
case R_BIN_WASM_SECTION_TYPE:
// eprintf("section type: 0x%x, ", (ut32)b->cur);
ptr->name = strdup ("type");
ptr->name_len = 4;
break;
case R_BIN_WASM_SECTION_IMPORT:
// eprintf("section import: 0x%x, ", (ut32)b->cur);
ptr->name = strdup ("import");
ptr->name_len = 6;
break;
case R_BIN_WASM_SECTION_FUNCTION:
// eprintf("section function: 0x%x, ", (ut32)b->cur);
ptr->name = strdup ("function");
ptr->name_len = 8;
break;
case R_BIN_WASM_SECTION_TABLE:
// eprintf("section table: 0x%x, ", (ut32)b->cur);
ptr->name = strdup ("table");
ptr->name_len = 5;
break;
case R_BIN_WASM_SECTION_MEMORY:
// eprintf("section memory: 0x%x, ", (ut32)b->cur);
ptr->name = strdup ("memory");
ptr->name_len = 6;
break;
case R_BIN_WASM_SECTION_GLOBAL:
// eprintf("section global: 0x%x, ", (ut32)b->cur);
ptr->name = strdup ("global");
ptr->name_len = 6;
break;
case R_BIN_WASM_SECTION_EXPORT:
// eprintf("section export: 0x%x, ", (ut32)b->cur);
ptr->name = strdup ("export");
ptr->name_len = 6;
break;
case R_BIN_WASM_SECTION_START:
// eprintf("section start: 0x%x\n", (ut32)b->cur);
ptr->name = strdup ("start");
ptr->name_len = 5;
break;
case R_BIN_WASM_SECTION_ELEMENT:
// eprintf("section element: 0x%x, ", (ut32)b->cur);
ptr->name = strdup ("element");
ptr->name_len = 7;
break;
case R_BIN_WASM_SECTION_CODE:
// eprintf("section code: 0x%x, ", (ut32)b->cur);
ptr->name = strdup ("code");
ptr->name_len = 4;
break;
case R_BIN_WASM_SECTION_DATA:
// eprintf("section data: 0x%x, ", (ut32)b->cur);
ptr->name = strdup ("data");
ptr->name_len = 4;
break;
default:
eprintf ("[wasm] error: unkown section id: %d\n", ptr->id);
r_buf_seek (b, ptr->size - 1, R_BUF_CUR);
continue;
}
if (ptr->offset + (ut64)ptr->size - 1 > bound) {
// TODO: Better error handling here
ut32 diff = ptr->size - (bound + 1 - ptr->offset);
eprintf ("[wasm] Artificially reducing size of section %s by 0x%x bytes so it fits in the file\n", ptr->name, diff);
ptr->size -= diff;
}
ptr->payload_data = r_buf_tell (b);
ptr->payload_len = ptr->size - (ptr->payload_data - ptr->offset);
if (ptr->payload_len > ptr->size) {
goto beach;
}
r_buf_seek (b, ptr->payload_len, R_BUF_CUR);
if (!r_list_append (ret, ptr)) {
free (ptr);
// should it jump to beach?
}
ptr = NULL;
}
bin->g_sections = ret;
return ret;
beach:
eprintf ("[wasm] error: beach sections\n");
free (ptr);
return ret;
}
| 0
|
229,143
|
static bool use_multiport(VirtIOSerial *vser)
{
VirtIODevice *vdev = VIRTIO_DEVICE(vser);
return virtio_has_feature(vdev, VIRTIO_CONSOLE_F_MULTIPORT);
}
| 0
|
487,651
|
asmlinkage long sys_getpgrp(void)
{
/* SMP - assuming writes are word atomic this is fine */
return process_group(current);
}
| 0
|
404,743
|
static struct file *pick_file(struct files_struct *files, unsigned fd)
{
struct file *file;
struct fdtable *fdt;
spin_lock(&files->file_lock);
fdt = files_fdtable(files);
if (fd >= fdt->max_fds) {
file = ERR_PTR(-EINVAL);
goto out_unlock;
}
file = fdt->fd[fd];
if (!file) {
file = ERR_PTR(-EBADF);
goto out_unlock;
}
rcu_assign_pointer(fdt->fd[fd], NULL);
__put_unused_fd(files, fd);
out_unlock:
spin_unlock(&files->file_lock);
return file;
}
| 0
|
310,319
|
should_generate_v2_networkstatus(void)
{
return authdir_mode_v2(get_options()) &&
the_v2_networkstatus_is_dirty &&
the_v2_networkstatus_is_dirty + DIR_REGEN_SLACK_TIME < time(NULL);
}
| 0
|
276,912
|
static int do_i2c_bus_num(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
int ret = 0;
int bus_no;
if (argc == 1) {
/* querying current setting */
#if CONFIG_IS_ENABLED(DM_I2C)
struct udevice *bus;
if (!i2c_get_cur_bus(&bus))
bus_no = dev_seq(bus);
else
bus_no = -1;
#else
bus_no = i2c_get_bus_num();
#endif
printf("Current bus is %d\n", bus_no);
} else {
bus_no = dectoul(argv[1], NULL);
#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY)
if (bus_no >= CONFIG_SYS_NUM_I2C_BUSES) {
printf("Invalid bus %d\n", bus_no);
return -1;
}
#endif
printf("Setting bus to %d\n", bus_no);
#if CONFIG_IS_ENABLED(DM_I2C)
ret = cmd_i2c_set_bus_num(bus_no);
#else
ret = i2c_set_bus_num(bus_no);
#endif
if (ret)
printf("Failure changing bus number (%d)\n", ret);
}
return ret ? CMD_RET_FAILURE : 0;
}
| 0
|
246,485
|
static inline RBinWasmTypeVec *parse_type_vector(RBuffer *b, ut64 bound) {
RBinWasmTypeVec *vec = R_NEW0 (RBinWasmTypeVec);
// types are all ut8, so leb128 shouldn't be needed, we can reuse consume_str_new
if (vec && !consume_str_new (b, bound, &vec->count, (char **)&vec->types)) {
free_type_vec (vec);
return NULL;
}
return vec;
}
| 0
|
359,375
|
DEFUN (bgp_bestpath_aspath_ignore,
bgp_bestpath_aspath_ignore_cmd,
"bgp bestpath as-path ignore",
"BGP specific commands\n"
"Change the default bestpath selection\n"
"AS-path attribute\n"
"Ignore as-path length in selecting a route\n")
{
struct bgp *bgp;
bgp = vty->index;
bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE);
return CMD_SUCCESS;
}
| 0
|
254,748
|
njs_typed_array_compare_u8(const void *a, const void *b, void *c)
{
return *((const uint8_t *) a) - *((const uint8_t *) b);
}
| 0
|
230,275
|
njs_array_handler_filter(njs_vm_t *vm, njs_iterator_args_t *args,
njs_value_t *entry, int64_t n)
{
njs_int_t ret;
njs_value_t copy;
if (njs_is_valid(entry)) {
copy = *entry;
ret = njs_array_iterator_call(vm, args, ©, n);
if (njs_slow_path(ret != NJS_OK)) {
return ret;
}
if (njs_is_true(&vm->retval)) {
ret = njs_array_add(vm, args->data, ©);
if (njs_slow_path(ret != NJS_OK)) {
return ret;
}
}
}
return NJS_OK;
}
| 0
|
206,771
|
bool DL_Dxf::handleLWPolylineData(DL_CreationInterface* /*creationInterface*/) {
// Allocate LWPolyline vertices (group code 90):
if (groupCode==90) {
maxVertices = toInt(groupValue);
if (maxVertices>0) {
if (vertices!=NULL) {
delete[] vertices;
}
vertices = new double[4*maxVertices];
for (int i=0; i<maxVertices; ++i) {
vertices[i*4] = 0.0;
vertices[i*4+1] = 0.0;
vertices[i*4+2] = 0.0;
vertices[i*4+3] = 0.0;
}
}
vertexIndex=-1;
return true;
}
// Process LWPolylines vertices (group codes 10/20/30/42):
else if (groupCode==10 || groupCode==20 ||
groupCode==30 || groupCode==42) {
if (vertexIndex<maxVertices-1 && groupCode==10) {
vertexIndex++;
}
if (groupCode<=30) {
if (vertexIndex>=0 && vertexIndex<maxVertices) {
vertices[4*vertexIndex + (groupCode/10-1)] = toReal(groupValue);
}
} else if (groupCode==42 && vertexIndex<maxVertices) {
vertices[4*vertexIndex + 3] = toReal(groupValue);
}
return true;
}
return false;
}
| 1
|
512,348
|
void Regexp_processor_pcre::set_recursion_limit(THD *thd)
{
long stack_used;
DBUG_ASSERT(thd == current_thd);
stack_used= available_stack_size(thd->thread_stack, &stack_used);
m_pcre_extra.match_limit_recursion=
(ulong)((my_thread_stack_size - STACK_MIN_SIZE - stack_used)/my_pcre_frame_size);
}
| 0
|
309,852
|
_nc_retrace_char(int code)
{
T((T_RETURN("%c"), code));
return (char) code;
}
| 0
|
317,255
|
static int selinux_sb_eat_lsm_opts(char *options, void **mnt_opts)
{
char *from = options;
char *to = options;
bool first = true;
int rc;
while (1) {
int len = opt_len(from);
int token;
char *arg = NULL;
token = match_opt_prefix(from, len, &arg);
if (token != Opt_error) {
char *p, *q;
/* strip quotes */
if (arg) {
for (p = q = arg; p < from + len; p++) {
char c = *p;
if (c != '"')
*q++ = c;
}
arg = kmemdup_nul(arg, q - arg, GFP_KERNEL);
if (!arg) {
rc = -ENOMEM;
goto free_opt;
}
}
rc = selinux_add_opt(token, arg, mnt_opts);
if (unlikely(rc)) {
kfree(arg);
goto free_opt;
}
} else {
if (!first) { // copy with preceding comma
from--;
len++;
}
if (to != from)
memmove(to, from, len);
to += len;
first = false;
}
if (!from[len])
break;
from += len + 1;
}
*to = '\0';
return 0;
free_opt:
if (*mnt_opts) {
selinux_free_mnt_opts(*mnt_opts);
*mnt_opts = NULL;
}
return rc;
}
| 0
|
484,736
|
uint16_t mobi_buffer_get16(MOBIBuffer *buf) {
if (buf->offset + 2 > buf->maxlen) {
debug_print("%s", "End of buffer\n");
buf->error = MOBI_BUFFER_END;
return 0;
}
uint16_t val;
val = (uint16_t)((uint16_t) buf->data[buf->offset] << 8 | (uint16_t) buf->data[buf->offset + 1]);
buf->offset += 2;
return val;
}
| 0
|
513,322
|
bool Virtual_tmp_table::add(List<Column_definition> &field_list)
{
/* Create all fields and calculate the total length of record */
Column_definition *cdef; /* column definition */
List_iterator_fast<Column_definition> it(field_list);
for ( ; (cdef= it++); )
{
Field *tmp;
if (!(tmp= cdef->make_field(s, in_use->mem_root, 0,
(uchar*) (f_maybe_null(cdef->pack_flag) ? "" : 0),
f_maybe_null(cdef->pack_flag) ? 1 : 0,
cdef->field_name)))
return true;
add(tmp);
}
return false;
}
| 0
|
220,420
|
mrb_assoc_new(mrb_state *mrb, mrb_value car, mrb_value cdr)
{
struct RArray *a;
a = ary_new_capa(mrb, 2);
ARY_PTR(a)[0] = car;
ARY_PTR(a)[1] = cdr;
ARY_SET_LEN(a, 2);
return mrb_obj_value(a);
}
| 0
|
405,703
|
static int xemaclite_set_mac_address(struct net_device *dev, void *address)
{
struct net_local *lp = netdev_priv(dev);
struct sockaddr *addr = address;
if (netif_running(dev))
return -EBUSY;
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
xemaclite_update_address(lp, dev->dev_addr);
return 0;
}
| 0
|
90,194
|
WifiNetwork::WifiNetwork(const WifiNetwork& network)
: WirelessNetwork(network) {
encryption_ = network.encryption();
passphrase_ = network.passphrase();
identity_ = network.identity();
cert_path_ = network.cert_path();
}
| 0
|
482,650
|
static inline const char *xt_outname(const struct xt_action_param *par)
{
return par->state->out->name;
}
| 0
|
269,312
|
static inline void put_symbol(RangeCoder *c, uint8_t *state, int v, int is_signed){
int i;
if(v){
const int a= FFABS(v);
const int e= av_log2(a);
const int el= FFMIN(e, 10);
put_rac(c, state+0, 0);
for(i=0; i<el; i++){
put_rac(c, state+1+i, 1); //1..10
}
for(; i<e; i++){
put_rac(c, state+1+9, 1); //1..10
}
put_rac(c, state+1+FFMIN(i,9), 0);
for(i=e-1; i>=el; i--){
put_rac(c, state+22+9, (a>>i)&1); //22..31
}
for(; i>=0; i--){
put_rac(c, state+22+i, (a>>i)&1); //22..31
}
if(is_signed)
put_rac(c, state+11 + el, v < 0); //11..21
}else{
put_rac(c, state+0, 1);
}
}
| 0
|
491,957
|
static void fuse_write_update_size(struct inode *inode, loff_t pos)
{
struct fuse_conn *fc = get_fuse_conn(inode);
struct fuse_inode *fi = get_fuse_inode(inode);
spin_lock(&fc->lock);
fi->attr_version = ++fc->attr_version;
if (pos > inode->i_size)
i_size_write(inode, pos);
spin_unlock(&fc->lock);
}
| 0
|
432,229
|
void cpu_exec_initfn(CPUState *cpu)
{
cpu->num_ases = 1;
cpu->as = &(cpu->uc->address_space_memory);
cpu->memory = cpu->uc->system_memory;
}
| 0
|
253,583
|
static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon,
loff_t offset, loff_t len, bool keep_size)
{
struct cifs_ses *ses = tcon->ses;
struct inode *inode;
struct cifsInodeInfo *cifsi;
struct cifsFileInfo *cfile = file->private_data;
struct file_zero_data_information fsctl_buf;
long rc;
unsigned int xid;
__le64 eof;
xid = get_xid();
inode = d_inode(cfile->dentry);
cifsi = CIFS_I(inode);
trace_smb3_zero_enter(xid, cfile->fid.persistent_fid, tcon->tid,
ses->Suid, offset, len);
/*
* We zero the range through ioctl, so we need remove the page caches
* first, otherwise the data may be inconsistent with the server.
*/
truncate_pagecache_range(inode, offset, offset + len - 1);
/* if file not oplocked can't be sure whether asking to extend size */
if (!CIFS_CACHE_READ(cifsi))
if (keep_size == false) {
rc = -EOPNOTSUPP;
trace_smb3_zero_err(xid, cfile->fid.persistent_fid,
tcon->tid, ses->Suid, offset, len, rc);
free_xid(xid);
return rc;
}
cifs_dbg(FYI, "Offset %lld len %lld\n", offset, len);
fsctl_buf.FileOffset = cpu_to_le64(offset);
fsctl_buf.BeyondFinalZero = cpu_to_le64(offset + len);
rc = SMB2_ioctl(xid, tcon, cfile->fid.persistent_fid,
cfile->fid.volatile_fid, FSCTL_SET_ZERO_DATA, true,
(char *)&fsctl_buf,
sizeof(struct file_zero_data_information),
0, NULL, NULL);
if (rc)
goto zero_range_exit;
/*
* do we also need to change the size of the file?
*/
if (keep_size == false && i_size_read(inode) < offset + len) {
eof = cpu_to_le64(offset + len);
rc = SMB2_set_eof(xid, tcon, cfile->fid.persistent_fid,
cfile->fid.volatile_fid, cfile->pid, &eof);
}
zero_range_exit:
free_xid(xid);
if (rc)
trace_smb3_zero_err(xid, cfile->fid.persistent_fid, tcon->tid,
ses->Suid, offset, len, rc);
else
trace_smb3_zero_done(xid, cfile->fid.persistent_fid, tcon->tid,
ses->Suid, offset, len);
return rc;
}
| 0
|
226,034
|
GF_Err fiin_box_write(GF_Box *s, GF_BitStream *bs)
{
GF_Err e;
FDItemInformationBox *ptr = (FDItemInformationBox *) s;
if (!s) return GF_BAD_PARAM;
e = gf_isom_full_box_write(s, bs);
if (e) return e;
gf_bs_write_u16(bs, gf_list_count(ptr->partition_entries) );
return GF_OK;
| 0
|
300,799
|
void tipc_sk_reinit(struct net *net)
{
struct tipc_net *tn = net_generic(net, tipc_net_id);
struct rhashtable_iter iter;
struct tipc_sock *tsk;
struct tipc_msg *msg;
rhashtable_walk_enter(&tn->sk_rht, &iter);
do {
rhashtable_walk_start(&iter);
while ((tsk = rhashtable_walk_next(&iter)) && !IS_ERR(tsk)) {
sock_hold(&tsk->sk);
rhashtable_walk_stop(&iter);
lock_sock(&tsk->sk);
msg = &tsk->phdr;
msg_set_prevnode(msg, tipc_own_addr(net));
msg_set_orignode(msg, tipc_own_addr(net));
release_sock(&tsk->sk);
rhashtable_walk_start(&iter);
sock_put(&tsk->sk);
}
rhashtable_walk_stop(&iter);
} while (tsk == ERR_PTR(-EAGAIN));
rhashtable_walk_exit(&iter);
}
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.