idx
int64 | func
string | target
int64 |
|---|---|---|
374,047
|
static RBinSymbol *bin_symbol_from_symbol(RCoreSymCacheElement *element, RCoreSymCacheElementSymbol *s) {
if (!s->name && !s->mangled_name) {
return NULL;
}
RBinSymbol *sym = R_NEW0 (RBinSymbol);
if (sym) {
if (s->name && s->mangled_name) {
sym->dname = strdup (s->name);
sym->name = strdup (s->mangled_name);
} else if (s->name) {
sym->name = strdup (s->name);
} else if (s->mangled_name) {
sym->name = s->mangled_name;
}
sym->paddr = s->paddr;
sym->vaddr = r_coresym_cache_element_pa2va (element, s->paddr);
sym->size = s->size;
sym->type = R_BIN_TYPE_FUNC_STR;
sym->bind = "NONE";
}
return sym;
}
| 0
|
466,146
|
static int check_cr_write(struct x86_emulate_ctxt *ctxt)
{
u64 new_val = ctxt->src.val64;
int cr = ctxt->modrm_reg;
u64 efer = 0;
static u64 cr_reserved_bits[] = {
0xffffffff00000000ULL,
0, 0, 0, /* CR3 checked later */
CR4_RESERVED_BITS,
0, 0, 0,
CR8_RESERVED_BITS,
};
if (!valid_cr(cr))
return emulate_ud(ctxt);
if (new_val & cr_reserved_bits[cr])
return emulate_gp(ctxt, 0);
switch (cr) {
case 0: {
u64 cr4;
if (((new_val & X86_CR0_PG) && !(new_val & X86_CR0_PE)) ||
((new_val & X86_CR0_NW) && !(new_val & X86_CR0_CD)))
return emulate_gp(ctxt, 0);
cr4 = ctxt->ops->get_cr(ctxt, 4);
ctxt->ops->get_msr(ctxt, MSR_EFER, &efer);
if ((new_val & X86_CR0_PG) && (efer & EFER_LME) &&
!(cr4 & X86_CR4_PAE))
return emulate_gp(ctxt, 0);
break;
}
case 3: {
u64 rsvd = 0;
ctxt->ops->get_msr(ctxt, MSR_EFER, &efer);
if (efer & EFER_LMA)
rsvd = CR3_L_MODE_RESERVED_BITS;
else if (ctxt->ops->get_cr(ctxt, 4) & X86_CR4_PAE)
rsvd = CR3_PAE_RESERVED_BITS;
else if (ctxt->ops->get_cr(ctxt, 0) & X86_CR0_PG)
rsvd = CR3_NONPAE_RESERVED_BITS;
if (new_val & rsvd)
return emulate_gp(ctxt, 0);
break;
}
case 4: {
ctxt->ops->get_msr(ctxt, MSR_EFER, &efer);
if ((efer & EFER_LMA) && !(new_val & X86_CR4_PAE))
return emulate_gp(ctxt, 0);
break;
}
}
return X86EMUL_CONTINUE;
}
| 0
|
230,119
|
static json_t * get_assertion_from_session(struct config_module * config, json_t * j_params, const char * username, const char * session, int mock) {
json_t * j_query, * j_result, * j_return;
char * username_escaped, * mod_name_escaped, * username_clause, * expiration_clause;
char * session_hash;
int res;
time_t now;
if (o_strlen(session)) {
session_hash = generate_hash(config->hash_algorithm, session);
if (session_hash != NULL) {
time(&now);
username_escaped = h_escape_string_with_quotes(config->conn, username);
mod_name_escaped = h_escape_string_with_quotes(config->conn, json_string_value(json_object_get(j_params, "mod_name")));
username_clause = msprintf(" = (SELECT gswu_id FROM "G_TABLE_WEBAUTHN_USER" WHERE UPPER(gswu_username) = UPPER(%s) AND gswu_mod_name = %s)", username_escaped, mod_name_escaped);
if (config->conn->type==HOEL_DB_TYPE_MARIADB) {
expiration_clause = msprintf("> FROM_UNIXTIME(%u)", (now - (unsigned int)json_integer_value(json_object_get(j_params, "credential-assertion"))));
} else if (config->conn->type==HOEL_DB_TYPE_PGSQL) {
expiration_clause = msprintf("> TO_TIMESTAMP(%u)", (now - (unsigned int)json_integer_value(json_object_get(j_params, "credential-assertion"))));
} else { // HOEL_DB_TYPE_SQLITE
expiration_clause = msprintf("> %u", (now - (unsigned int)json_integer_value(json_object_get(j_params, "credential-assertion"))));
}
j_query = json_pack("{sss[ssss]s{sss{ssss}sis{ssss}si}}",
"table",
G_TABLE_WEBAUTHN_ASSERTION,
"columns",
"gswa_id",
"gswu_id",
"gswa_session_hash AS session_hash",
"gswa_challenge_hash AS challenge_hash",
"where",
"gswa_session_hash",
session_hash,
"gswu_id",
"operator",
"raw",
"value",
username_clause,
"gswa_status",
0,
"gswa_issued_at",
"operator",
"raw",
"value",
expiration_clause,
"gswa_mock",
mock);
o_free(username_clause);
o_free(username_escaped);
o_free(mod_name_escaped);
o_free(expiration_clause);
res = h_select(config->conn, j_query, &j_result, NULL);
json_decref(j_query);
if (res == H_OK) {
if (json_array_size(j_result)) {
j_return = json_pack("{sisO}", "result", G_OK, "assertion", json_array_get(j_result, 0));
} else {
j_return = json_pack("{si}", "result", G_ERROR_NOT_FOUND);
}
json_decref(j_result);
} else {
y_log_message(Y_LOG_LEVEL_ERROR, "get_assertion_from_session - Error executing j_query");
config->glewlwyd_module_callback_metrics_increment_counter(config, GLWD_METRICS_DATABSE_ERROR, 1, NULL);
j_return = json_pack("{si}", "result", G_ERROR_DB);
}
} else {
y_log_message(Y_LOG_LEVEL_ERROR, "get_assertion_from_session - Error generate_hash");
j_return = json_pack("{si}", "result", G_ERROR);
}
o_free(session_hash);
} else {
j_return = json_pack("{si}", "result", G_ERROR_PARAM);
}
return j_return;
}
| 0
|
436,050
|
static enum hrtimer_restart io_timeout_fn(struct hrtimer *timer)
{
struct io_timeout_data *data = container_of(timer,
struct io_timeout_data, timer);
struct io_kiocb *req = data->req;
struct io_ring_ctx *ctx = req->ctx;
unsigned long flags;
spin_lock_irqsave(&ctx->completion_lock, flags);
list_del_init(&req->timeout.list);
atomic_set(&req->ctx->cq_timeouts,
atomic_read(&req->ctx->cq_timeouts) + 1);
io_cqring_fill_event(ctx, req->user_data, -ETIME, 0);
io_commit_cqring(ctx);
spin_unlock_irqrestore(&ctx->completion_lock, flags);
io_cqring_ev_posted(ctx);
req_set_fail(req);
io_put_req(req);
return HRTIMER_NORESTART;
| 0
|
223,457
|
static SLJIT_INLINE void compile_then_trap_backtrackingpath(compiler_common *common, struct backtrack_common *current)
{
DEFINE_COMPILER;
struct sljit_jump *jump;
int size;
if (CURRENT_AS(then_trap_backtrack)->then_trap)
{
common->then_trap = CURRENT_AS(then_trap_backtrack)->then_trap;
return;
}
size = CURRENT_AS(then_trap_backtrack)->framesize;
size = 3 + (size < 0 ? 0 : size);
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(size - 3));
free_stack(common, size);
jump = JUMP(SLJIT_JUMP);
set_jumps(CURRENT_AS(then_trap_backtrack)->quit, LABEL());
/* STACK_TOP is set by THEN. */
if (CURRENT_AS(then_trap_backtrack)->framesize >= 0)
{
add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, (CURRENT_AS(then_trap_backtrack)->framesize - 1) * sizeof(sljit_sw));
}
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
free_stack(common, 3);
JUMPHERE(jump);
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, TMP1, 0);
}
| 0
|
366,316
|
static void mntput_no_expire(struct mount *mnt)
{
LIST_HEAD(list);
int count;
rcu_read_lock();
if (likely(READ_ONCE(mnt->mnt_ns))) {
/*
* Since we don't do lock_mount_hash() here,
* ->mnt_ns can change under us. However, if it's
* non-NULL, then there's a reference that won't
* be dropped until after an RCU delay done after
* turning ->mnt_ns NULL. So if we observe it
* non-NULL under rcu_read_lock(), the reference
* we are dropping is not the final one.
*/
mnt_add_count(mnt, -1);
rcu_read_unlock();
return;
}
lock_mount_hash();
/*
* make sure that if __legitimize_mnt() has not seen us grab
* mount_lock, we'll see their refcount increment here.
*/
smp_mb();
mnt_add_count(mnt, -1);
count = mnt_get_count(mnt);
if (count != 0) {
WARN_ON(count < 0);
rcu_read_unlock();
unlock_mount_hash();
return;
}
if (unlikely(mnt->mnt.mnt_flags & MNT_DOOMED)) {
rcu_read_unlock();
unlock_mount_hash();
return;
}
mnt->mnt.mnt_flags |= MNT_DOOMED;
rcu_read_unlock();
list_del(&mnt->mnt_instance);
if (unlikely(!list_empty(&mnt->mnt_mounts))) {
struct mount *p, *tmp;
list_for_each_entry_safe(p, tmp, &mnt->mnt_mounts, mnt_child) {
__put_mountpoint(unhash_mnt(p), &list);
hlist_add_head(&p->mnt_umount, &mnt->mnt_stuck_children);
}
}
unlock_mount_hash();
shrink_dentry_list(&list);
if (likely(!(mnt->mnt.mnt_flags & MNT_INTERNAL))) {
struct task_struct *task = current;
if (likely(!(task->flags & PF_KTHREAD))) {
init_task_work(&mnt->mnt_rcu, __cleanup_mnt);
if (!task_work_add(task, &mnt->mnt_rcu, TWA_RESUME))
return;
}
if (llist_add(&mnt->mnt_llist, &delayed_mntput_list))
schedule_delayed_work(&delayed_mntput_work, 1);
return;
}
cleanup_mnt(mnt);
}
| 0
|
343,133
|
static struct ip_esp_hdr *esp_output_udp_encap(struct sk_buff *skb,
int encap_type,
struct esp_info *esp,
__be16 sport,
__be16 dport)
{
struct udphdr *uh;
__be32 *udpdata32;
unsigned int len;
len = skb->len + esp->tailen - skb_transport_offset(skb);
if (len + sizeof(struct iphdr) > IP_MAX_MTU)
return ERR_PTR(-EMSGSIZE);
uh = (struct udphdr *)esp->esph;
uh->source = sport;
uh->dest = dport;
uh->len = htons(len);
uh->check = 0;
*skb_mac_header(skb) = IPPROTO_UDP;
if (encap_type == UDP_ENCAP_ESPINUDP_NON_IKE) {
udpdata32 = (__be32 *)(uh + 1);
udpdata32[0] = udpdata32[1] = 0;
return (struct ip_esp_hdr *)(udpdata32 + 2);
}
return (struct ip_esp_hdr *)(uh + 1);
}
| 0
|
359,283
|
DEFUN (clear_ip_bgp_as,
clear_ip_bgp_as_cmd,
"clear ip bgp <1-65535>",
CLEAR_STR
IP_STR
BGP_STR
"Clear peers with the AS number\n")
{
return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]);
}
| 0
|
310,323
|
real_uptime(routerinfo_t *router, time_t now)
{
if (now < router->cache_info.published_on)
return router->uptime;
else
return router->uptime + (now - router->cache_info.published_on);
}
| 0
|
513,229
|
static inline char plugin_var_bookmark_key(uint flags)
{
return (flags & PLUGIN_VAR_TYPEMASK) |
(flags & PLUGIN_VAR_MEMALLOC ? BOOKMARK_MEMALLOC : 0);
}
| 0
|
225,986
|
static void *sgpd_parse_entry(u32 grouping_type, GF_BitStream *bs, s32 bytes_in_box, u32 entry_size, u32 *total_bytes)
{
Bool null_size_ok = GF_FALSE;
GF_DefaultSampleGroupDescriptionEntry *def_ptr;
switch (grouping_type) {
case GF_ISOM_SAMPLE_GROUP_ROLL:
case GF_ISOM_SAMPLE_GROUP_PROL:
{
GF_RollRecoveryEntry *ptr;
GF_SAFEALLOC(ptr, GF_RollRecoveryEntry);
if (!ptr) return NULL;
ptr->roll_distance = gf_bs_read_int(bs, 16);
*total_bytes = 2;
return ptr;
}
case GF_ISOM_SAMPLE_GROUP_RAP:
{
GF_VisualRandomAccessEntry *ptr;
GF_SAFEALLOC(ptr, GF_VisualRandomAccessEntry);
if (!ptr) return NULL;
ptr->num_leading_samples_known = gf_bs_read_int(bs, 1);
ptr->num_leading_samples = gf_bs_read_int(bs, 7);
*total_bytes = 1;
return ptr;
}
case GF_ISOM_SAMPLE_GROUP_SAP:
{
GF_SAPEntry *ptr;
GF_SAFEALLOC(ptr, GF_SAPEntry);
if (!ptr) return NULL;
ptr->dependent_flag = gf_bs_read_int(bs, 1);
gf_bs_read_int(bs, 3);
ptr->SAP_type = gf_bs_read_int(bs, 4);
*total_bytes = 1;
return ptr;
}
case GF_ISOM_SAMPLE_GROUP_SYNC:
{
GF_SYNCEntry *ptr;
GF_SAFEALLOC(ptr, GF_SYNCEntry);
if (!ptr) return NULL;
gf_bs_read_int(bs, 2);
ptr->NALU_type = gf_bs_read_int(bs, 6);
*total_bytes = 1;
return ptr;
}
case GF_ISOM_SAMPLE_GROUP_TELE:
{
GF_TemporalLevelEntry *ptr;
GF_SAFEALLOC(ptr, GF_TemporalLevelEntry);
if (!ptr) return NULL;
ptr->level_independently_decodable = gf_bs_read_int(bs, 1);
gf_bs_read_int(bs, 7);
*total_bytes = 1;
return ptr;
}
case GF_ISOM_SAMPLE_GROUP_SEIG:
{
GF_CENCSampleEncryptionGroupEntry *ptr;
if (bytes_in_box<3) return NULL;
GF_SAFEALLOC(ptr, GF_CENCSampleEncryptionGroupEntry);
if (!ptr) return NULL;
Bool use_mkey = gf_bs_read_int(bs, 1);
gf_bs_read_int(bs, 7); //reserved
ptr->crypt_byte_block = gf_bs_read_int(bs, 4);
ptr->skip_byte_block = gf_bs_read_int(bs, 4);
ptr->IsProtected = gf_bs_read_u8(bs);
bytes_in_box -= 3;
if (use_mkey) {
u64 pos = gf_bs_get_position(bs);
u32 i, count = gf_bs_read_u16(bs);
bytes_in_box -= 2;
if (bytes_in_box<0) {
gf_free(ptr);
return NULL;
}
for (i=0; i<count; i++) {
u8 ivsize = gf_bs_read_u8(bs);
gf_bs_skip_bytes(bs, 16);
bytes_in_box -= 17;
if (!ivsize) {
//const IV
ivsize = gf_bs_read_u8(bs);
gf_bs_skip_bytes(bs, ivsize);
bytes_in_box -= 1 + ivsize;
}
if (bytes_in_box<0) {
gf_free(ptr);
return NULL;
}
}
ptr->key_info_size = 1 + (u32) (gf_bs_get_position(bs) - pos);
ptr->key_info = gf_malloc(sizeof(u8) * ptr->key_info_size);
if (!ptr->key_info) {
gf_free(ptr);
return NULL;
}
gf_bs_seek(bs, pos);
ptr->key_info[0] = 1;
gf_bs_read_data(bs, ptr->key_info + 1, ptr->key_info_size - 1);
*total_bytes = 3 + ptr->key_info_size - 1;
if (!gf_cenc_validate_key_info(ptr->key_info, ptr->key_info_size)) {
gf_free(ptr->key_info);
gf_free(ptr);
return NULL;
}
} else {
bin128 kid;
u8 const_iv_size = 0;
u8 iv_size = gf_bs_read_u8(bs);
gf_bs_read_data(bs, kid, 16);
bytes_in_box -= 17;
if (bytes_in_box<0) {
gf_free(ptr);
return NULL;
}
*total_bytes = 20;
if ((ptr->IsProtected == 1) && !iv_size) {
const_iv_size = gf_bs_read_u8(bs);
if ((const_iv_size != 8) && (const_iv_size != 16)) {
GF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, ("[iso file] seig sample group have invalid constant_IV size\n"));
gf_free(ptr);
return NULL;
}
}
ptr->key_info_size = 20;
if (!iv_size && ptr->IsProtected) {
ptr->key_info_size += 1 + const_iv_size;
}
ptr->key_info = gf_malloc(sizeof(u8) * ptr->key_info_size);
if (!ptr->key_info) {
gf_free(ptr);
return NULL;
}
ptr->key_info[0] = 0;
ptr->key_info[1] = 0;
ptr->key_info[2] = 0;
ptr->key_info[3] = iv_size;
memcpy(ptr->key_info+4, kid, 16);
if (!iv_size && ptr->IsProtected) {
ptr->key_info[20] = const_iv_size;
gf_bs_read_data(bs, (char *)ptr->key_info+21, const_iv_size);
*total_bytes += 1 + const_iv_size;
}
}
if (!entry_size) {
GF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, ("[iso file] seig sample group does not indicate entry size, deprecated in spec\n"));
}
return ptr;
}
case GF_ISOM_SAMPLE_GROUP_OINF:
{
GF_OperatingPointsInformation *ptr = gf_isom_oinf_new_entry();
u32 s = (u32) gf_bs_get_position(bs);
gf_isom_oinf_read_entry(ptr, bs);
*total_bytes = (u32) gf_bs_get_position(bs) - s;
if (!entry_size) {
GF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, ("[iso file] oinf sample group does not indicate entry size, deprecated in spec\n"));
}
return ptr;
}
case GF_ISOM_SAMPLE_GROUP_LINF:
{
GF_LHVCLayerInformation *ptr = gf_isom_linf_new_entry();
u32 s = (u32) gf_bs_get_position(bs);
gf_isom_linf_read_entry(ptr, bs);
*total_bytes = (u32) gf_bs_get_position(bs) - s;
if (!entry_size) {
GF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, ("[iso file] linf sample group does not indicate entry size, deprecated in spec\n"));
}
return ptr;
}
case GF_ISOM_SAMPLE_GROUP_TRIF:
if (! entry_size) {
u32 flags = gf_bs_peek_bits(bs, 24, 0);
if (flags & 0x10000) entry_size=3;
else {
if (flags & 0x80000) entry_size=7;
else entry_size=11;
//have dependency list
if (flags & 0x200000) {
u32 nb_entries = gf_bs_peek_bits(bs, 16, entry_size);
entry_size += 2 + 2*nb_entries;
}
}
GF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, ("[iso file] trif sample group does not indicate entry size, deprecated in spec\n"));
}
break;
case GF_ISOM_SAMPLE_GROUP_NALM:
if (! entry_size) {
u64 start = gf_bs_get_position(bs);
Bool rle, large_size;
u32 entry_count;
gf_bs_read_int(bs, 6);
large_size = gf_bs_read_int(bs, 1);
rle = gf_bs_read_int(bs, 1);
entry_count = gf_bs_read_int(bs, large_size ? 16 : 8);
gf_bs_seek(bs, start);
entry_size = 1 + (large_size ? 2 : 1);
entry_size += entry_count * 2;
if (rle) entry_size += entry_count * (large_size ? 2 : 1);
GF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, ("[iso file] nalm sample group does not indicate entry size, deprecated in spec\n"));
}
break;
case GF_ISOM_SAMPLE_GROUP_TSAS:
case GF_ISOM_SAMPLE_GROUP_STSA:
null_size_ok = GF_TRUE;
break;
//TODO, add support for these ones ?
case GF_ISOM_SAMPLE_GROUP_TSCL:
entry_size = 20;
break;
case GF_ISOM_SAMPLE_GROUP_LBLI:
entry_size = 2;
break;
case GF_ISOM_SAMPLE_GROUP_SPOR:
{
u32 i;
GF_SubpictureOrderEntry *ptr;
GF_SAFEALLOC(ptr, GF_SubpictureOrderEntry);
if (!ptr) return NULL;
ptr->subpic_id_info_flag = gf_bs_read_int(bs, 1);
ptr->num_subpic_ref_idx = gf_bs_read_int(bs, 15);
*total_bytes = 2;
ptr->subp_track_ref_idx = gf_malloc(sizeof(u16) * ptr->num_subpic_ref_idx);
if (!ptr->subp_track_ref_idx) {
gf_free(ptr);
return NULL;
}
for (i=0; i<ptr->num_subpic_ref_idx; i++) {
ptr->subp_track_ref_idx[i] = gf_bs_read_u16(bs);
*total_bytes += 2;
}
if (ptr->subpic_id_info_flag) {
ptr->spinfo.subpic_id_len_minus1 = gf_bs_read_int(bs, 4);
ptr->spinfo.subpic_id_bit_pos = gf_bs_read_int(bs, 12);
ptr->spinfo.start_code_emul_flag = gf_bs_read_int(bs, 1);
ptr->spinfo.pps_sps_subpic_id_flag = gf_bs_read_int(bs, 1);
if (ptr->spinfo.pps_sps_subpic_id_flag) {
ptr->spinfo.xps_id = gf_bs_read_int(bs, 6);
} else {
ptr->spinfo.xps_id = gf_bs_read_int(bs, 4);
gf_bs_read_int(bs, 2);
}
*total_bytes += 3;
}
return ptr;
}
case GF_ISOM_SAMPLE_GROUP_SULM:
{
u32 i;
GF_SubpictureLayoutMapEntry *ptr;
GF_SAFEALLOC(ptr, GF_SubpictureLayoutMapEntry);
if (!ptr) return NULL;
ptr->groupID_info_4cc = gf_bs_read_u32(bs);
ptr->nb_entries = 1 + gf_bs_read_u16(bs);
*total_bytes = 6;
ptr->groupIDs = gf_malloc(sizeof(u16) * ptr->nb_entries);
if (!ptr->groupIDs) {
gf_free(ptr);
return NULL;
}
for (i=0; i<ptr->nb_entries; i++) {
ptr->groupIDs[i] = gf_bs_read_u16(bs);
*total_bytes += 2;
}
return ptr;
}
default:
break;
}
if (!entry_size && !null_size_ok) {
GF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, ("[iso file] %s sample group does not indicate entry size and is not implemented, cannot parse!\n", gf_4cc_to_str( grouping_type) ));
return NULL;
}
GF_SAFEALLOC(def_ptr, GF_DefaultSampleGroupDescriptionEntry);
if (!def_ptr) return NULL;
if (entry_size) {
def_ptr->length = entry_size;
def_ptr->data = (u8 *) gf_malloc(sizeof(u8)*def_ptr->length);
if (!def_ptr->data) {
gf_free(def_ptr);
return NULL;
}
gf_bs_read_data(bs, (char *) def_ptr->data, def_ptr->length);
*total_bytes = entry_size;
}
return def_ptr;
| 0
|
508,327
|
bool No_such_table_error_handler::safely_trapped_errors()
{
/*
If m_unhandled_errors != 0, something else, unanticipated, happened,
so the error is not trapped but returned to the caller.
Multiple ER_NO_SUCH_TABLE can be raised in case of views.
*/
return ((m_handled_errors > 0) && (m_unhandled_errors == 0));
}
| 0
|
247,573
|
TEST_P(SslSocketTest, ClientSessionResumptionDisabledTls12) {
const std::string server_ctx_yaml = R"EOF(
common_tls_context:
tls_params:
tls_minimum_protocol_version: TLSv1_0
tls_maximum_protocol_version: TLSv1_2
tls_certificates:
certificate_chain:
filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/unittest_cert.pem"
private_key:
filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/unittest_key.pem"
)EOF";
const std::string client_ctx_yaml = R"EOF(
common_tls_context:
max_session_keys: 0
)EOF";
testClientSessionResumption(server_ctx_yaml, client_ctx_yaml, false, GetParam());
}
| 0
|
293,521
|
PJ_DEF(void) pj_scan_get_quote( pj_scanner *scanner,
int begin_quote, int end_quote,
pj_str_t *out)
{
char beg = (char)begin_quote;
char end = (char)end_quote;
pj_scan_get_quotes(scanner, &beg, &end, 1, out);
}
| 0
|
316,966
|
static void selinux_ipc_getsecid(struct kern_ipc_perm *ipcp, u32 *secid)
{
struct ipc_security_struct *isec = selinux_ipc(ipcp);
*secid = isec->sid;
}
| 0
|
383,369
|
gdImageColorAllocate (gdImagePtr im, int r, int g, int b)
{
return gdImageColorAllocateAlpha (im, r, g, b, gdAlphaOpaque);
}
| 0
|
200,695
|
static int fastrpc_dma_buf_attach(struct dma_buf *dmabuf,
struct dma_buf_attachment *attachment)
{
struct fastrpc_dma_buf_attachment *a;
struct fastrpc_buf *buffer = dmabuf->priv;
int ret;
a = kzalloc(sizeof(*a), GFP_KERNEL);
if (!a)
return -ENOMEM;
ret = dma_get_sgtable(buffer->dev, &a->sgt, buffer->virt,
FASTRPC_PHYS(buffer->phys), buffer->size);
if (ret < 0) {
dev_err(buffer->dev, "failed to get scatterlist from DMA API\n");
return -EINVAL;
}
a->dev = attachment->dev;
INIT_LIST_HEAD(&a->node);
attachment->priv = a;
mutex_lock(&buffer->lock);
list_add(&a->node, &buffer->attachments);
mutex_unlock(&buffer->lock);
return 0;
}
| 1
|
261,946
|
njs_reserved(const uint32_t *reserve, uint32_t byte)
{
return ((reserve[byte >> 5] & ((uint32_t) 1 << (byte & 0x1f))) != 0);
}
| 0
|
316,989
|
static int smack_inode_getsecurity(struct user_namespace *mnt_userns,
struct inode *inode, const char *name,
void **buffer, bool alloc)
{
struct socket_smack *ssp;
struct socket *sock;
struct super_block *sbp;
struct inode *ip = (struct inode *)inode;
struct smack_known *isp;
if (strcmp(name, XATTR_SMACK_SUFFIX) == 0)
isp = smk_of_inode(inode);
else {
/*
* The rest of the Smack xattrs are only on sockets.
*/
sbp = ip->i_sb;
if (sbp->s_magic != SOCKFS_MAGIC)
return -EOPNOTSUPP;
sock = SOCKET_I(ip);
if (sock == NULL || sock->sk == NULL)
return -EOPNOTSUPP;
ssp = sock->sk->sk_security;
if (strcmp(name, XATTR_SMACK_IPIN) == 0)
isp = ssp->smk_in;
else if (strcmp(name, XATTR_SMACK_IPOUT) == 0)
isp = ssp->smk_out;
else
return -EOPNOTSUPP;
}
if (alloc) {
*buffer = kstrdup(isp->smk_known, GFP_KERNEL);
if (*buffer == NULL)
return -ENOMEM;
}
return strlen(isp->smk_known);
}
| 0
|
262,013
|
Proto_FreeRequest(ProtoRequest *req)
{
if (NULL == req) {
return;
}
#if VGAUTH_PROTO_TRACE
g_free(req->rawData);
#endif
switch (req->reqType) {
case PROTO_REQUEST_UNKNOWN:
// partial/empty request -- no-op
break;
case PROTO_REQUEST_SESSION_REQ:
g_free(req->reqData.sessionReq.userName);
break;
case PROTO_REQUEST_CONN:
g_free(req->reqData.connect.pid);
break;
case PROTO_REQUEST_ADDALIAS:
g_free(req->reqData.addAlias.userName);
g_free(req->reqData.addAlias.pemCert);
// will be NULL if ANY, so should be safe
g_free(req->reqData.addAlias.aliasInfo.name);
g_free(req->reqData.addAlias.aliasInfo.comment);
break;
case PROTO_REQUEST_REMOVEALIAS:
g_free(req->reqData.removeAlias.userName);
g_free(req->reqData.removeAlias.pemCert);
// wll be NULL if ANY or unset, so should be safe
g_free(req->reqData.removeAlias.subject.name);
break;
case PROTO_REQUEST_QUERYALIASES:
g_free(req->reqData.queryAliases.userName);
break;
case PROTO_REQUEST_QUERYMAPPEDALIASES:
//empty
break;
case PROTO_REQUEST_CREATETICKET:
g_free(req->reqData.createTicket.userName);
g_free(req->reqData.createTicket.token);
ServiceAliasFreeAliasInfoContents(&(req->reqData.createTicket.samlData.aliasInfo));
g_free(req->reqData.createTicket.samlData.samlSubject);
break;
case PROTO_REQUEST_VALIDATETICKET:
g_free(req->reqData.validateTicket.ticket);
break;
case PROTO_REQUEST_REVOKETICKET:
g_free(req->reqData.revokeTicket.ticket);
break;
case PROTO_REQUEST_VALIDATE_SAML_BEARER_TOKEN:
g_free(req->reqData.validateSamlBToken.samlToken);
g_free(req->reqData.validateSamlBToken.userName);
break;
default:
Warning("%s: trying to free unknown request type %d\n",
__FUNCTION__, req->reqType);
}
g_free(req);
}
| 0
|
224,226
|
R_API RIOBank *r_io_bank_new(const char *name) {
r_return_val_if_fail (name, NULL);
RIOBank *bank = R_NEW0 (RIOBank);
if (!bank) {
return NULL;
}
bank->name = strdup (name);
bank->submaps = r_crbtree_new (free);
if (!bank->submaps) {
free (bank);
return NULL;
}
bank->maprefs = r_list_newf (free);
if (!bank->maprefs) {
r_crbtree_free (bank->submaps);
free (bank);
return NULL;
}
bank->todo = r_queue_new (8);
if (!bank->todo) {
r_list_free (bank->maprefs);
r_crbtree_free (bank->submaps);
free (bank);
return NULL;
}
return bank;
}
| 0
|
453,015
|
int nft_offload_init(void)
{
return register_netdevice_notifier(&nft_offload_netdev_notifier);
}
| 0
|
359,391
|
peer_timers_set_vty (struct vty *vty, const char *ip_str,
const char *keep_str, const char *hold_str)
{
int ret;
struct peer *peer;
u_int32_t keepalive;
u_int32_t holdtime;
peer = peer_and_group_lookup_vty (vty, ip_str);
if (! peer)
return CMD_WARNING;
VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535);
VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535);
ret = peer_timers_set (peer, keepalive, holdtime);
return bgp_vty_return (vty, ret);
}
| 0
|
264,212
|
static void vnc_dpy_switch(DisplayChangeListener *dcl,
DisplaySurface *surface)
{
VncDisplay *vd = container_of(dcl, VncDisplay, dcl);
VncState *vs;
vnc_abort_display_jobs(vd);
/* server surface */
qemu_pixman_image_unref(vd->server);
vd->ds = surface;
vd->server = pixman_image_create_bits(VNC_SERVER_FB_FORMAT,
surface_width(vd->ds),
surface_height(vd->ds),
NULL, 0);
/* guest surface */
#if 0 /* FIXME */
if (ds_get_bytes_per_pixel(ds) != vd->guest.ds->pf.bytes_per_pixel)
console_color_init(ds);
#endif
qemu_pixman_image_unref(vd->guest.fb);
vd->guest.fb = pixman_image_ref(surface->image);
vd->guest.format = surface->format;
VNC_SET_VISIBLE_PIXELS_DIRTY(vd->guest.dirty,
surface_width(vd->ds),
surface_height(vd->ds));
QTAILQ_FOREACH(vs, &vd->clients, next) {
vnc_colordepth(vs);
vnc_desktop_resize(vs);
if (vs->vd->cursor) {
vnc_cursor_define(vs);
}
VNC_SET_VISIBLE_PIXELS_DIRTY(vs->dirty,
surface_width(vd->ds),
surface_height(vd->ds));
}
}
| 0
|
318,964
|
f_assert_equal(typval_T *argvars, typval_T *rettv)
{
rettv->vval.v_number = assert_equal_common(argvars, ASSERT_EQUAL);
}
| 0
|
413,657
|
static bool printAnalPaths(RCoreAnalPaths *p, PJ *pj) {
RListIter *iter;
RAnalBlock *path;
if (pj) {
pj_a (pj);
} else {
r_cons_printf ("pdb @@= ");
}
r_list_foreach (p->path, iter, path) {
if (pj) {
pj_n (pj, path->addr);
} else {
r_cons_printf ("0x%08"PFMT64x" ", path->addr);
}
}
if(pj) {
pj_end (pj);
} else {
r_cons_printf ("\n");
}
return (p->count < 1 || --p->count > 0);
}
| 0
|
432,330
|
void flatview_unref(FlatView *view)
{
view->ref--;
if (view->ref <= 0) {
flatview_destroy(view);
}
}
| 0
|
300,737
|
int tipc_dump_start(struct netlink_callback *cb)
{
return __tipc_dump_start(cb, sock_net(cb->skb->sk));
}
| 0
|
369,170
|
static void io_apoll_task_func(struct io_kiocb *req, bool *locked)
{
struct io_ring_ctx *ctx = req->ctx;
int ret;
ret = io_poll_check_events(req, *locked);
if (ret > 0)
return;
io_poll_remove_entries(req);
spin_lock(&ctx->completion_lock);
hash_del(&req->hash_node);
spin_unlock(&ctx->completion_lock);
if (!ret)
io_req_task_submit(req, locked);
else
io_req_complete_failed(req, ret);
| 0
|
436,075
|
static bool __io_file_supports_async(struct file *file, int rw)
{
umode_t mode = file_inode(file)->i_mode;
if (S_ISBLK(mode)) {
if (IS_ENABLED(CONFIG_BLOCK) &&
io_bdev_nowait(I_BDEV(file->f_mapping->host)))
return true;
return false;
}
if (S_ISSOCK(mode))
return true;
if (S_ISREG(mode)) {
if (IS_ENABLED(CONFIG_BLOCK) &&
io_bdev_nowait(file->f_inode->i_sb->s_bdev) &&
file->f_op != &io_uring_fops)
return true;
return false;
}
/* any ->read/write should understand O_NONBLOCK */
if (file->f_flags & O_NONBLOCK)
return true;
if (!(file->f_mode & FMODE_NOWAIT))
return false;
if (rw == READ)
return file->f_op->read_iter != NULL;
return file->f_op->write_iter != NULL;
}
| 0
|
281,166
|
static void xfrm_bundle_flo_delete(struct flow_cache_object *flo)
{
struct xfrm_dst *xdst = container_of(flo, struct xfrm_dst, flo);
struct dst_entry *dst = &xdst->u.dst;
/* Mark DST_OBSOLETE_DEAD to fail the next xfrm_dst_check() */
dst->obsolete = DST_OBSOLETE_DEAD;
dst_release_immediate(dst);
}
| 0
|
424,517
|
static void PresentationContext_unref(PresentationContext* presentation)
{
VideoClientContextPriv* priv;
MAPPED_GEOMETRY* geometry;
if (!presentation)
return;
if (InterlockedDecrement(&presentation->refCounter) != 0)
return;
geometry = presentation->geometry;
if (geometry)
{
geometry->MappedGeometryUpdate = NULL;
geometry->MappedGeometryClear = NULL;
geometry->custom = NULL;
mappedGeometryUnref(geometry);
}
priv = presentation->video->priv;
h264_context_free(presentation->h264);
Stream_Free(presentation->currentSample, TRUE);
presentation->video->deleteSurface(presentation->video, presentation->surface);
BufferPool_Return(priv->surfacePool, presentation->surfaceData);
yuv_context_free(presentation->yuv);
free(presentation);
}
| 0
|
512,997
|
Item_direct_ref(THD *thd, TABLE_LIST *view_arg, Item **item,
const LEX_CSTRING *field_name_arg,
bool alias_name_used_arg= FALSE):
Item_ref(thd, view_arg, item, field_name_arg,
alias_name_used_arg)
{}
| 0
|
371,426
|
PHP_FUNCTION( msgfmt_format )
{
zval *args;
MSG_FORMAT_METHOD_INIT_VARS;
/* Parse parameters. */
if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oa",
&object, MessageFormatter_ce_ptr, &args ) == FAILURE )
{
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
"msgfmt_format: unable to parse input params", 0 TSRMLS_CC );
RETURN_FALSE;
}
/* Fetch the object. */
MSG_FORMAT_METHOD_FETCH_OBJECT;
msgfmt_do_format(mfo, args, return_value TSRMLS_CC);
}
| 0
|
413,643
|
static bool is_fcn_traced(RDebugTrace *traced, RAnalFunction *fcn) {
int tag = traced->tag;
RListIter *iter;
RDebugTracepoint *trace;
r_list_foreach (traced->traces, iter, trace) {
if (!trace->tag || (tag & trace->tag)) {
if (r_anal_function_contains (fcn, trace->addr)) {
r_cons_printf ("\ntraced: %d\n", trace->times);
return true;
}
}
}
return false;
}
| 0
|
242,612
|
void Compute(OpKernelContext* ctx) override {
Buffer* buf = nullptr;
OP_REQUIRES_OK(ctx, GetBuffer(ctx, def(), &buf));
core::ScopedUnref scope(buf);
buf->Clear();
}
| 0
|
309,923
|
npush(int x)
{
if (TPS(stack_ptr) < STACKSIZE) {
TPS(stack)[TPS(stack_ptr)].num_type = TRUE;
TPS(stack)[TPS(stack_ptr)].data.num = x;
TPS(stack_ptr)++;
} else {
DEBUG(2, ("npush: stack overflow: %s", _nc_visbuf(TPS(tparam_base))));
_nc_tparm_err++;
}
}
| 0
|
312,514
|
unload_dummy_buffer(buf_T *buf, char_u *dirname_start)
{
if (curbuf != buf) // safety check
{
close_buffer(NULL, buf, DOBUF_UNLOAD, FALSE, TRUE);
// When autocommands/'autochdir' option changed directory: go back.
restore_start_dir(dirname_start);
}
}
| 0
|
244,224
|
GF_Box *fdsa_box_new()
{
ISOM_DECL_BOX_ALLOC(GF_HintSample, GF_ISOM_BOX_TYPE_FDSA);
if (!tmp) return NULL;
tmp->packetTable = gf_list_new();
tmp->hint_subtype = GF_ISOM_BOX_TYPE_FDP_STSD;
return (GF_Box*)tmp;
}
| 0
|
255,934
|
Status ShapeRefiner::ConstantPartialShape(
InferenceContext* target_context, const Node* node, int dst_idx,
ShapeHandle* result, shape_inference::InferenceContext* outer_context) {
const Edge* input_edge;
TF_RETURN_IF_ERROR(node->input_edge(dst_idx, &input_edge));
InferenceContext* src_context = GetContext(input_edge->src());
if (src_context == nullptr) return errors::Internal("Missing src context");
ShapeHandle src_shape = src_context->output(input_edge->src_output());
if (src_context->Value(src_context->Rank(src_shape)) == 0) {
Tensor t;
bool evaluated = false;
TF_RETURN_IF_ERROR(EvaluateConstantTensorForEdge(node, dst_idx, &evaluated,
&t, outer_context));
if (!evaluated) {
return errors::InvalidArgument(
"Received a shape scalar with unknown static value. A static value "
"of '-1' is required to represent an unknown shape.");
}
if (t.dims() == 0) {
if (t.dtype() == DT_INT32 && t.scalar<int32>()() == -1) {
*result = target_context->UnknownShape();
return Status::OK();
} else if (t.dtype() == DT_INT64 && t.scalar<int64>()() == -1) {
*result = target_context->UnknownShape();
return Status::OK();
}
}
return errors::InvalidArgument(
"Received an invalid shape scalar with a static value that is not "
"'-1': ",
t.DebugString());
}
TF_RETURN_IF_ERROR(src_context->WithRank(src_shape, 1, &src_shape));
const string& src_op = input_edge->src()->type_string();
if (src_context->Value(src_context->Dim(src_shape, 0)) == 0) {
// Source tensor is a vector of length 0, so the shape it
// represents is as scalar.
*result = target_context->Scalar();
} else if (src_op == "Cast") {
// First try to evaluate the current tensor, as it might be a valid cast of
// a float.
Tensor t;
bool evaluated = false;
if (EvaluateConstantTensorForEdge(node, dst_idx, &evaluated, &t,
outer_context)
.ok()) {
if (evaluated &&
target_context->MakeShapeFromTensor(&t, src_shape, result).ok()) {
return Status::OK();
}
}
// Then try to infer partial shape from the input to the cast tensor.
ShapeHandle pre_cast_shape;
if (!ConstantPartialShape(target_context, input_edge->src(), 0,
&pre_cast_shape, outer_context)
.ok()) {
TF_RETURN_IF_ERROR(
target_context->MakeShapeFromTensor(nullptr, src_shape, result));
}
if (!target_context->RankKnown(pre_cast_shape)) {
// Failed to evaluate. Treat the output as completely unknown.
*result = target_context->UnknownShape();
return Status::OK();
}
auto* dest_type = input_edge->src()->attrs().Find("DstT");
if (dest_type == nullptr || dest_type->value_case() != AttrValue::kType ||
(dest_type->type() != DT_INT32 && dest_type->type() != DT_INT64)) {
// Casting to a weird type. Do not attempt to infer across it.
*result = target_context->MakeShape(std::vector<DimensionHandle>(
target_context->Rank(pre_cast_shape), target_context->UnknownDim()));
return Status::OK();
}
*result = pre_cast_shape;
} else if (src_op == "Shape") {
*result = src_context->input(0);
} else if (src_op == "ShapeN") {
*result = src_context->input(input_edge->src_output());
} else if (src_op == "Pack") {
std::vector<DimensionHandle> dims;
// Pack is concatenating its input scalars to form the shape tensor vector.
for (int i = 0; i < src_context->num_inputs(); ++i) {
int64 size;
bool evaluated;
TF_RETURN_IF_ERROR(EvaluateConstantIntScalarEdge(
input_edge->src(), i, &evaluated, &size, outer_context));
if (evaluated) {
dims.push_back(size < 0 ? target_context->UnknownDim()
: target_context->MakeDim(size));
} else {
dims.push_back(target_context->UnknownDim());
}
}
*result = target_context->MakeShape(dims);
} else if (src_op == "Concat" || src_op == "ConcatV2") {
*result = target_context->Scalar();
// For Concat, input 0 is concat dim; for V2 it is the last input.
const int concat_dim =
src_op == "Concat" ? 0 : src_context->num_inputs() - 1;
// Concat is concatenating its input shape vectors.
for (int i = 0; i < src_context->num_inputs(); ++i) {
// Concat dim is ignored (and will always be a scalar).
if (i == concat_dim) continue;
ShapeHandle sub_result;
TF_RETURN_IF_ERROR(ConstantPartialShape(target_context, input_edge->src(),
i, &sub_result, outer_context));
if (!target_context->RankKnown(sub_result)) {
// Failed to evaluate. Treat the output as completely unknown.
// TODO(cwhipkey): we could rely on all inputs being the same rank, so
// figure that rank out and append the right number of unknown dims.
*result = target_context->UnknownShape();
return Status::OK();
}
TF_RETURN_IF_ERROR(
target_context->Concatenate(*result, sub_result, result));
}
} else if (src_op == "StridedSlice") {
TF_RETURN_IF_ERROR(PartialStridedSliceShape(input_edge->src(), src_context,
result, outer_context));
} else if (src_op == "VariableShape") {
auto* handle_data = src_context->input_handle_shapes_and_types(0);
if (handle_data != nullptr && !handle_data->empty()) {
*result = handle_data->at(0).shape;
} else {
*result = target_context->UnknownShape();
}
} else {
Tensor t;
bool evaluated = false;
TF_RETURN_IF_ERROR(EvaluateConstantTensorForEdge(node, dst_idx, &evaluated,
&t, outer_context));
TF_RETURN_IF_ERROR(target_context->MakeShapeFromTensor(
evaluated ? &t : nullptr, src_shape, result));
}
return Status::OK();
}
| 0
|
244,006
|
GF_Err dfla_box_size(GF_Box *s)
{
GF_FLACConfigBox *ptr = (GF_FLACConfigBox *) s;
ptr->size += ptr->dataSize;
return GF_OK;
}
| 0
|
508,906
|
TABLE_LIST* st_select_lex_node::get_table_list() { return 0; }
| 0
|
300,833
|
int tipc_sk_dump(struct sock *sk, u16 dqueues, char *buf)
{
int i = 0;
size_t sz = (dqueues) ? SK_LMAX : SK_LMIN;
u32 conn_type, conn_instance;
struct tipc_sock *tsk;
struct publication *p;
bool tsk_connected;
if (!sk) {
i += scnprintf(buf, sz, "sk data: (null)\n");
return i;
}
tsk = tipc_sk(sk);
tsk_connected = !tipc_sk_type_connectionless(sk);
i += scnprintf(buf, sz, "sk data: %u", sk->sk_type);
i += scnprintf(buf + i, sz - i, " %d", sk->sk_state);
i += scnprintf(buf + i, sz - i, " %x", tsk_own_node(tsk));
i += scnprintf(buf + i, sz - i, " %u", tsk->portid);
i += scnprintf(buf + i, sz - i, " | %u", tsk_connected);
if (tsk_connected) {
i += scnprintf(buf + i, sz - i, " %x", tsk_peer_node(tsk));
i += scnprintf(buf + i, sz - i, " %u", tsk_peer_port(tsk));
conn_type = msg_nametype(&tsk->phdr);
conn_instance = msg_nameinst(&tsk->phdr);
i += scnprintf(buf + i, sz - i, " %u", conn_type);
i += scnprintf(buf + i, sz - i, " %u", conn_instance);
}
i += scnprintf(buf + i, sz - i, " | %u", tsk->published);
if (tsk->published) {
p = list_first_entry_or_null(&tsk->publications,
struct publication, binding_sock);
i += scnprintf(buf + i, sz - i, " %u", (p) ? p->sr.type : 0);
i += scnprintf(buf + i, sz - i, " %u", (p) ? p->sr.lower : 0);
i += scnprintf(buf + i, sz - i, " %u", (p) ? p->sr.upper : 0);
}
i += scnprintf(buf + i, sz - i, " | %u", tsk->snd_win);
i += scnprintf(buf + i, sz - i, " %u", tsk->rcv_win);
i += scnprintf(buf + i, sz - i, " %u", tsk->max_pkt);
i += scnprintf(buf + i, sz - i, " %x", tsk->peer_caps);
i += scnprintf(buf + i, sz - i, " %u", tsk->cong_link_cnt);
i += scnprintf(buf + i, sz - i, " %u", tsk->snt_unacked);
i += scnprintf(buf + i, sz - i, " %u", tsk->rcv_unacked);
i += scnprintf(buf + i, sz - i, " %u", atomic_read(&tsk->dupl_rcvcnt));
i += scnprintf(buf + i, sz - i, " %u", sk->sk_shutdown);
i += scnprintf(buf + i, sz - i, " | %d", sk_wmem_alloc_get(sk));
i += scnprintf(buf + i, sz - i, " %d", sk->sk_sndbuf);
i += scnprintf(buf + i, sz - i, " | %d", sk_rmem_alloc_get(sk));
i += scnprintf(buf + i, sz - i, " %d", sk->sk_rcvbuf);
i += scnprintf(buf + i, sz - i, " | %d\n", READ_ONCE(sk->sk_backlog.len));
if (dqueues & TIPC_DUMP_SK_SNDQ) {
i += scnprintf(buf + i, sz - i, "sk_write_queue: ");
i += tipc_list_dump(&sk->sk_write_queue, false, buf + i);
}
if (dqueues & TIPC_DUMP_SK_RCVQ) {
i += scnprintf(buf + i, sz - i, "sk_receive_queue: ");
i += tipc_list_dump(&sk->sk_receive_queue, false, buf + i);
}
if (dqueues & TIPC_DUMP_SK_BKLGQ) {
i += scnprintf(buf + i, sz - i, "sk_backlog:\n head ");
i += tipc_skb_dump(sk->sk_backlog.head, false, buf + i);
if (sk->sk_backlog.tail != sk->sk_backlog.head) {
i += scnprintf(buf + i, sz - i, " tail ");
i += tipc_skb_dump(sk->sk_backlog.tail, false,
buf + i);
}
}
return i;
}
| 0
|
512,968
|
Item_string(THD *thd, const char *name_par, const char *str, size_t length,
CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE)
:Item_literal(thd)
{
str_value.set_or_copy_aligned(str, length, cs);
fix_from_value(dv, Metadata(&str_value));
set_name(thd, name_par,safe_strlen(name_par), system_charset_info);
}
| 0
|
387,764
|
static void print_vtable(intptr_t* start, int len, outputStream* st) {
for (int i = 0; i < len; i++) {
intptr_t e = start[i];
st->print("%d : " INTPTR_FORMAT, i, e);
if (MetaspaceObj::is_valid((Metadata*)e)) {
st->print(" ");
((Metadata*)e)->print_value_on(st);
}
st->cr();
}
}
| 0
|
338,111
|
void WasmBinaryBuilder::readTags() {
BYN_TRACE("== readTags\n");
size_t numTags = getU32LEB();
BYN_TRACE("num: " << numTags << std::endl);
for (size_t i = 0; i < numTags; i++) {
BYN_TRACE("read one\n");
getInt8(); // Reserved 'attribute' field
auto typeIndex = getU32LEB();
wasm.addTag(Builder::makeTag("tag$" + std::to_string(i),
getSignatureByTypeIndex(typeIndex)));
}
}
| 0
|
196,578
|
yank_copy_line(struct block_def *bd, long y_idx, int exclude_trailing_space)
{
char_u *pnew;
if (exclude_trailing_space)
bd->endspaces = 0;
if ((pnew = alloc(bd->startspaces + bd->endspaces + bd->textlen + 1))
== NULL)
return FAIL;
y_current->y_array[y_idx] = pnew;
vim_memset(pnew, ' ', (size_t)bd->startspaces);
pnew += bd->startspaces;
mch_memmove(pnew, bd->textstart, (size_t)bd->textlen);
pnew += bd->textlen;
vim_memset(pnew, ' ', (size_t)bd->endspaces);
pnew += bd->endspaces;
if (exclude_trailing_space)
{
int s = bd->textlen + bd->endspaces;
while (VIM_ISWHITE(*(bd->textstart + s - 1)) && s > 0)
{
s = s - (*mb_head_off)(bd->textstart, bd->textstart + s - 1) - 1;
pnew--;
}
}
*pnew = NUL;
return OK;
}
| 1
|
511,472
|
bool open_table(THD *thd, TABLE_LIST *table_list, Open_table_context *ot_ctx)
{
TABLE *table;
const char *key;
uint key_length;
const char *alias= table_list->alias.str;
uint flags= ot_ctx->get_flags();
MDL_ticket *mdl_ticket;
TABLE_SHARE *share;
uint gts_flags;
bool from_share= false;
#ifdef WITH_PARTITION_STORAGE_ENGINE
int part_names_error=0;
#endif
DBUG_ENTER("open_table");
/*
The table must not be opened already. The table can be pre-opened for
some statements if it is a temporary table.
open_temporary_table() must be used to open temporary tables.
*/
DBUG_ASSERT(!table_list->table);
/* an open table operation needs a lot of the stack space */
if (check_stack_overrun(thd, STACK_MIN_SIZE_FOR_OPEN, (uchar *)&alias))
DBUG_RETURN(TRUE);
if (!(flags & MYSQL_OPEN_IGNORE_KILLED) && thd->killed)
{
thd->send_kill_message();
DBUG_RETURN(TRUE);
}
/*
Check if we're trying to take a write lock in a read only transaction.
Note that we allow write locks on log tables as otherwise logging
to general/slow log would be disabled in read only transactions.
*/
if (table_list->mdl_request.is_write_lock_request() &&
thd->tx_read_only &&
!(flags & (MYSQL_LOCK_LOG_TABLE | MYSQL_OPEN_HAS_MDL_LOCK)))
{
my_error(ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION, MYF(0));
DBUG_RETURN(true);
}
if (!table_list->db.str)
{
my_error(ER_NO_DB_ERROR, MYF(0));
DBUG_RETURN(true);
}
key_length= get_table_def_key(table_list, &key);
/*
If we're in pre-locked or LOCK TABLES mode, let's try to find the
requested table in the list of pre-opened and locked tables. If the
table is not there, return an error - we can't open not pre-opened
tables in pre-locked/LOCK TABLES mode.
TODO: move this block into a separate function.
*/
if (thd->locked_tables_mode &&
! (flags & MYSQL_OPEN_GET_NEW_TABLE))
{ // Using table locks
TABLE *best_table= 0;
int best_distance= INT_MIN;
for (table=thd->open_tables; table ; table=table->next)
{
if (table->s->table_cache_key.length == key_length &&
!memcmp(table->s->table_cache_key.str, key, key_length))
{
if (!my_strcasecmp(system_charset_info, table->alias.c_ptr(), alias) &&
table->query_id != thd->query_id && /* skip tables already used */
(thd->locked_tables_mode == LTM_LOCK_TABLES ||
table->query_id == 0))
{
int distance= ((int) table->reginfo.lock_type -
(int) table_list->lock_type);
/*
Find a table that either has the exact lock type requested,
or has the best suitable lock. In case there is no locked
table that has an equal or higher lock than requested,
we us the closest matching lock to be able to produce an error
message about wrong lock mode on the table. The best_table
is changed if bd < 0 <= d or bd < d < 0 or 0 <= d < bd.
distance < 0 - No suitable lock found
distance > 0 - we have lock mode higher then we require
distance == 0 - we have lock mode exactly which we need
*/
if ((best_distance < 0 && distance > best_distance) ||
(distance >= 0 && distance < best_distance))
{
best_distance= distance;
best_table= table;
if (best_distance == 0)
{
/*
We have found a perfect match and can finish iterating
through open tables list. Check for table use conflict
between calling statement and SP/trigger is done in
lock_tables().
*/
break;
}
}
}
}
}
if (best_table)
{
table= best_table;
table->query_id= thd->query_id;
table->init(thd, table_list);
DBUG_PRINT("info",("Using locked table"));
#ifdef WITH_PARTITION_STORAGE_ENGINE
part_names_error= set_partitions_as_used(table_list, table);
#endif
goto reset;
}
if (is_locked_view(thd, table_list))
{
if (table_list->sequence)
{
my_error(ER_NOT_SEQUENCE, MYF(0), table_list->db.str, table_list->alias.str);
DBUG_RETURN(true);
}
DBUG_RETURN(FALSE); // VIEW
}
/*
No table in the locked tables list. In case of explicit LOCK TABLES
this can happen if a user did not include the table into the list.
In case of pre-locked mode locked tables list is generated automatically,
so we may only end up here if the table did not exist when
locked tables list was created.
*/
if (thd->locked_tables_mode == LTM_PRELOCKED)
my_error(ER_NO_SUCH_TABLE, MYF(0), table_list->db.str, table_list->alias.str);
else
my_error(ER_TABLE_NOT_LOCKED, MYF(0), alias);
DBUG_RETURN(TRUE);
}
/*
Non pre-locked/LOCK TABLES mode, and the table is not temporary.
This is the normal use case.
*/
if (! (flags & MYSQL_OPEN_HAS_MDL_LOCK))
{
/*
We are not under LOCK TABLES and going to acquire write-lock/
modify the base table. We need to acquire protection against
global read lock until end of this statement in order to have
this statement blocked by active FLUSH TABLES WITH READ LOCK.
We don't need to acquire this protection under LOCK TABLES as
such protection already acquired at LOCK TABLES time and
not released until UNLOCK TABLES.
We don't block statements which modify only temporary tables
as these tables are not preserved by any form of
backup which uses FLUSH TABLES WITH READ LOCK.
TODO: The fact that we sometimes acquire protection against
GRL only when we encounter table to be write-locked
slightly increases probability of deadlock.
This problem will be solved once Alik pushes his
temporary table refactoring patch and we can start
pre-acquiring metadata locks at the beggining of
open_tables() call.
*/
if (table_list->mdl_request.is_write_lock_request() &&
! (flags & (MYSQL_OPEN_IGNORE_GLOBAL_READ_LOCK |
MYSQL_OPEN_FORCE_SHARED_MDL |
MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL |
MYSQL_OPEN_SKIP_SCOPED_MDL_LOCK)) &&
! ot_ctx->has_protection_against_grl())
{
MDL_request protection_request;
MDL_deadlock_handler mdl_deadlock_handler(ot_ctx);
if (thd->global_read_lock.can_acquire_protection())
DBUG_RETURN(TRUE);
protection_request.init(MDL_key::GLOBAL, "", "", MDL_INTENTION_EXCLUSIVE,
MDL_STATEMENT);
/*
Install error handler which if possible will convert deadlock error
into request to back-off and restart process of opening tables.
*/
thd->push_internal_handler(&mdl_deadlock_handler);
bool result= thd->mdl_context.acquire_lock(&protection_request,
ot_ctx->get_timeout());
thd->pop_internal_handler();
if (result)
DBUG_RETURN(TRUE);
ot_ctx->set_has_protection_against_grl();
}
if (open_table_get_mdl_lock(thd, ot_ctx, &table_list->mdl_request,
flags, &mdl_ticket) ||
mdl_ticket == NULL)
{
DEBUG_SYNC(thd, "before_open_table_wait_refresh");
DBUG_RETURN(TRUE);
}
DEBUG_SYNC(thd, "after_open_table_mdl_shared");
}
else
{
/*
Grab reference to the MDL lock ticket that was acquired
by the caller.
*/
mdl_ticket= table_list->mdl_request.ticket;
}
if (table_list->open_strategy == TABLE_LIST::OPEN_IF_EXISTS)
{
if (!ha_table_exists(thd, &table_list->db, &table_list->table_name))
DBUG_RETURN(FALSE);
}
else if (table_list->open_strategy == TABLE_LIST::OPEN_STUB)
DBUG_RETURN(FALSE);
/* Table exists. Let us try to open it. */
if (table_list->i_s_requested_object & OPEN_TABLE_ONLY)
gts_flags= GTS_TABLE;
else if (table_list->i_s_requested_object & OPEN_VIEW_ONLY)
gts_flags= GTS_VIEW;
else
gts_flags= GTS_TABLE | GTS_VIEW;
retry_share:
share= tdc_acquire_share(thd, table_list, gts_flags, &table);
if (unlikely(!share))
{
/*
Hide "Table doesn't exist" errors if the table belongs to a view.
The check for thd->is_error() is necessary to not push an
unwanted error in case the error was already silenced.
@todo Rework the alternative ways to deal with ER_NO_SUCH TABLE.
*/
if (thd->is_error())
{
if (table_list->parent_l)
{
thd->clear_error();
my_error(ER_WRONG_MRG_TABLE, MYF(0));
}
else if (table_list->belong_to_view)
{
TABLE_LIST *view= table_list->belong_to_view;
thd->clear_error();
my_error(ER_VIEW_INVALID, MYF(0),
view->view_db.str, view->view_name.str);
}
}
DBUG_RETURN(TRUE);
}
/*
Check if this TABLE_SHARE-object corresponds to a view. Note, that there is
no need to check TABLE_SHARE::tdc.flushed as we do for regular tables,
because view shares are always up to date.
*/
if (share->is_view)
{
/*
If parent_l of the table_list is non null then a merge table
has this view as child table, which is not supported.
*/
if (table_list->parent_l)
{
my_error(ER_WRONG_MRG_TABLE, MYF(0));
goto err_lock;
}
if (table_list->sequence)
{
my_error(ER_NOT_SEQUENCE, MYF(0), table_list->db.str,
table_list->alias.str);
goto err_lock;
}
/*
This table is a view. Validate its metadata version: in particular,
that it was a view when the statement was prepared.
*/
if (check_and_update_table_version(thd, table_list, share))
goto err_lock;
/* Open view */
if (mysql_make_view(thd, share, table_list, false))
goto err_lock;
/* TODO: Don't free this */
tdc_release_share(share);
DBUG_ASSERT(table_list->view);
DBUG_RETURN(FALSE);
}
#ifdef WITH_WSREP
if (!((flags & MYSQL_OPEN_IGNORE_FLUSH) ||
(thd->wsrep_applier)))
#else
if (!(flags & MYSQL_OPEN_IGNORE_FLUSH))
#endif
{
if (share->tdc->flushed)
{
DBUG_PRINT("info", ("Found old share version: %lld current: %lld",
share->tdc->version, tdc_refresh_version()));
/*
We already have an MDL lock. But we have encountered an old
version of table in the table definition cache which is possible
when someone changes the table version directly in the cache
without acquiring a metadata lock (e.g. this can happen during
"rolling" FLUSH TABLE(S)).
Release our reference to share, wait until old version of
share goes away and then try to get new version of table share.
*/
if (table)
tc_release_table(table);
else
tdc_release_share(share);
MDL_deadlock_handler mdl_deadlock_handler(ot_ctx);
bool wait_result;
thd->push_internal_handler(&mdl_deadlock_handler);
wait_result= tdc_wait_for_old_version(thd, table_list->db.str,
table_list->table_name.str,
ot_ctx->get_timeout(),
mdl_ticket->get_deadlock_weight());
thd->pop_internal_handler();
if (wait_result)
DBUG_RETURN(TRUE);
goto retry_share;
}
if (thd->open_tables && thd->open_tables->s->tdc->flushed)
{
/*
If the version changes while we're opening the tables,
we have to back off, close all the tables opened-so-far,
and try to reopen them. Note: refresh_version is currently
changed only during FLUSH TABLES.
*/
if (table)
tc_release_table(table);
else
tdc_release_share(share);
(void)ot_ctx->request_backoff_action(Open_table_context::OT_REOPEN_TABLES,
NULL);
DBUG_RETURN(TRUE);
}
}
if (table)
{
DBUG_ASSERT(table->file != NULL);
MYSQL_REBIND_TABLE(table->file);
#ifdef WITH_PARTITION_STORAGE_ENGINE
part_names_error= set_partitions_as_used(table_list, table);
#endif
}
else
{
enum open_frm_error error;
/* make a new table */
if (!(table=(TABLE*) my_malloc(sizeof(*table),MYF(MY_WME))))
goto err_lock;
error= open_table_from_share(thd, share, &table_list->alias,
HA_OPEN_KEYFILE | HA_TRY_READ_ONLY,
EXTRA_RECORD,
thd->open_options, table, FALSE,
IF_PARTITIONING(table_list->partition_names,0));
if (unlikely(error))
{
my_free(table);
if (error == OPEN_FRM_DISCOVER)
(void) ot_ctx->request_backoff_action(Open_table_context::OT_DISCOVER,
table_list);
else if (share->crashed)
{
if (!(flags & MYSQL_OPEN_IGNORE_REPAIR))
(void) ot_ctx->request_backoff_action(Open_table_context::OT_REPAIR,
table_list);
else
table_list->crashed= 1; /* Mark that table was crashed */
}
goto err_lock;
}
if (open_table_entry_fini(thd, share, table))
{
closefrm(table);
my_free(table);
goto err_lock;
}
/* Add table to the share's used tables list. */
tc_add_table(thd, table);
from_share= true;
}
table->mdl_ticket= mdl_ticket;
table->reginfo.lock_type=TL_READ; /* Assume read */
table->init(thd, table_list);
table->next= thd->open_tables; /* Link into simple list */
thd->set_open_tables(table);
reset:
/*
Check that there is no reference to a condition from an earlier query
(cf. Bug#58553).
*/
DBUG_ASSERT(table->file->pushed_cond == NULL);
table_list->updatable= 1; // It is not derived table nor non-updatable VIEW
table_list->table= table;
if (!from_share && table->vcol_fix_expr(thd))
DBUG_RETURN(true);
#ifdef WITH_PARTITION_STORAGE_ENGINE
if (unlikely(table->part_info))
{
/* Partitions specified were incorrect.*/
if (part_names_error)
{
table->file->print_error(part_names_error, MYF(0));
DBUG_RETURN(true);
}
}
else if (table_list->partition_names)
{
/* Don't allow PARTITION () clause on a nonpartitioned table */
my_error(ER_PARTITION_CLAUSE_ON_NONPARTITIONED, MYF(0));
DBUG_RETURN(true);
}
#endif
if (table_list->sequence && table->s->table_type != TABLE_TYPE_SEQUENCE)
{
my_error(ER_NOT_SEQUENCE, MYF(0), table_list->db.str, table_list->alias.str);
DBUG_RETURN(true);
}
DBUG_RETURN(FALSE);
err_lock:
tdc_release_share(share);
DBUG_PRINT("exit", ("failed"));
DBUG_RETURN(TRUE);
}
| 0
|
281,642
|
void CLASS kodak_radc_load_raw()
{
static const char src[] = {
1,1, 2,3, 3,4, 4,2, 5,7, 6,5, 7,6, 7,8,
1,0, 2,1, 3,3, 4,4, 5,2, 6,7, 7,6, 8,5, 8,8,
2,1, 2,3, 3,0, 3,2, 3,4, 4,6, 5,5, 6,7, 6,8,
2,0, 2,1, 2,3, 3,2, 4,4, 5,6, 6,7, 7,5, 7,8,
2,1, 2,4, 3,0, 3,2, 3,3, 4,7, 5,5, 6,6, 6,8,
2,3, 3,1, 3,2, 3,4, 3,5, 3,6, 4,7, 5,0, 5,8,
2,3, 2,6, 3,0, 3,1, 4,4, 4,5, 4,7, 5,2, 5,8,
2,4, 2,7, 3,3, 3,6, 4,1, 4,2, 4,5, 5,0, 5,8,
2,6, 3,1, 3,3, 3,5, 3,7, 3,8, 4,0, 5,2, 5,4,
2,0, 2,1, 3,2, 3,3, 4,4, 4,5, 5,6, 5,7, 4,8,
1,0, 2,2, 2,-2,
1,-3, 1,3,
2,-17, 2,-5, 2,5, 2,17,
2,-7, 2,2, 2,9, 2,18,
2,-18, 2,-9, 2,-2, 2,7,
2,-28, 2,28, 3,-49, 3,-9, 3,9, 4,49, 5,-79, 5,79,
2,-1, 2,13, 2,26, 3,39, 4,-16, 5,55, 6,-37, 6,76,
2,-26, 2,-13, 2,1, 3,-39, 4,16, 5,-55, 6,-76, 6,37
};
ushort huff[19][256];
int row, col, tree, nreps, rep, step, i, c, s, r, x, y, val;
short last[3] = { 16,16,16 }, mul[3], buf[3][3][386];
static const ushort pt[] =
{ 0,0, 1280,1344, 2320,3616, 3328,8000, 4095,16383, 65535,16383 };
for (i=2; i < 12; i+=2)
for (c=pt[i-2]; c <= pt[i]; c++)
curve[c] = (float)
(c-pt[i-2]) / (pt[i]-pt[i-2]) * (pt[i+1]-pt[i-1]) + pt[i-1] + 0.5;
for (s=i=0; i < sizeof src; i+=2)
FORC(256 >> src[i])
huff[0][s++] = src[i] << 8 | (uchar) src[i+1];
s = kodak_cbpp == 243 ? 2 : 3;
FORC(256) huff[18][c] = (8-s) << 8 | c >> s << s | 1 << (s-1);
getbits(-1);
for (i=0; i < sizeof(buf)/sizeof(short); i++)
buf[0][0][i] = 2048;
for (row=0; row < height; row+=4) {
#ifdef LIBRAW_LIBRARY_BUILD
checkCancel();
#endif
FORC3 mul[c] = getbits(6);
FORC3 {
val = ((0x1000000/last[c] + 0x7ff) >> 12) * mul[c];
s = val > 65564 ? 10:12;
x = ~((~0u) << (s-1));
val <<= 12-s;
for (i=0; i < sizeof(buf[0])/sizeof(short); i++)
buf[c][0][i] = (buf[c][0][i] * val + x) >> s;
last[c] = mul[c];
for (r=0; r <= !c; r++) {
buf[c][1][width/2] = buf[c][2][width/2] = mul[c] << 7;
for (tree=1, col=width/2; col > 0; ) {
if ((tree = radc_token(tree))) {
col -= 2;
if (tree == 8)
FORYX buf[c][y][x] = (uchar) radc_token(18) * mul[c];
else
FORYX buf[c][y][x] = radc_token(tree+10) * 16 + PREDICTOR;
} else
do {
nreps = (col > 2) ? radc_token(9) + 1 : 1;
for (rep=0; rep < 8 && rep < nreps && col > 0; rep++) {
col -= 2;
FORYX buf[c][y][x] = PREDICTOR;
if (rep & 1) {
step = radc_token(10) << 4;
FORYX buf[c][y][x] += step;
}
}
} while (nreps == 9);
}
for (y=0; y < 2; y++)
for (x=0; x < width/2; x++) {
val = (buf[c][y+1][x] << 4) / mul[c];
if (val < 0) val = 0;
if (c) RAW(row+y*2+c-1,x*2+2-c) = val;
else RAW(row+r*2+y,x*2+y) = val;
}
memcpy (buf[c][0]+!c, buf[c][2], sizeof buf[c][0]-2*!c);
}
}
for (y=row; y < row+4; y++)
for (x=0; x < width; x++)
if ((x+y) & 1) {
r = x ? x-1 : x+1;
s = x+1 < width ? x+1 : x-1;
val = (RAW(y,x)-2048)*2 + (RAW(y,r)+RAW(y,s))/2;
if (val < 0) val = 0;
RAW(y,x) = val;
}
}
for (i=0; i < height*width; i++)
raw_image[i] = curve[raw_image[i]];
maximum = 0x3fff;
}
| 0
|
265,053
|
promptpath(char *p, int npath, int tilde)
{
char *modp = p;
Nameddir nd;
if (tilde && ((nd = finddir(p))))
modp = tricat("~", nd->node.nam, p + strlen(nd->dir));
if (npath) {
char *sptr;
if (npath > 0) {
for (sptr = modp + strlen(modp); sptr > modp; sptr--) {
if (*sptr == '/' && !--npath) {
sptr++;
break;
}
}
if (*sptr == '/' && sptr[1] && sptr != modp)
sptr++;
stradd(sptr);
} else {
char cbu;
for (sptr = modp+1; *sptr; sptr++)
if (*sptr == '/' && !++npath)
break;
cbu = *sptr;
*sptr = 0;
stradd(modp);
*sptr = cbu;
}
} else
stradd(modp);
if (p != modp)
zsfree(modp);
}
| 0
|
432,704
|
static void ipa_draw_text(wmfAPI * API, wmfDrawText_t * draw_text)
{
double
angle = 0, /* text rotation angle */
bbox_height, /* bounding box height */
bbox_width, /* bounding box width */
pointsize = 0; /* pointsize to output font with desired height */
ExceptionInfo
*exception;
TypeMetric
metrics;
wmfD_Coord
BL, /* bottom left of bounding box */
BR, /* bottom right of bounding box */
TL, /* top left of bounding box */
TR; /* top right of bounding box */
wmfD_Coord
point; /* text placement point */
wmfFont
*font;
wmf_magick_t
* ddata = WMF_MAGICK_GetData(API);
point = draw_text->pt;
/* Choose bounding box and calculate its width and height */
{
double dx,
dy;
if ( draw_text->flags)
{
TL = draw_text->TL;
BR = draw_text->BR;
TR.x = draw_text->BR.x;
TR.y = draw_text->TL.y;
BL.x = draw_text->TL.x;
BL.y = draw_text->BR.y;
}
else
{
TL = draw_text->bbox.TL;
BR = draw_text->bbox.BR;
TR = draw_text->bbox.TR;
BL = draw_text->bbox.BL;
}
dx = ((TR.x - TL.x) + (BR.x - BL.x)) / 2;
dy = ((TR.y - TL.y) + (BR.y - BL.y)) / 2;
bbox_width = hypot(dx,dy);
dx = ((BL.x - TL.x) + (BR.x - TR.x)) / 2;
dy = ((BL.y - TL.y) + (BR.y - TR.y)) / 2;
bbox_height = hypot(dx,dy);
}
font = WMF_DC_FONT(draw_text->dc);
/* Convert font_height to equivalent pointsize */
exception=ddata->exception;
pointsize = util_pointsize( API, font, draw_text->str, draw_text->font_height, exception);
/* Save graphic wand */
(void) PushDrawingWand(WmfDrawingWand);
(void) bbox_width;
(void) bbox_height;
#if 0
printf("\nipa_draw_text\n");
printf("Text = \"%s\"\n", draw_text->str);
/* printf("WMF_FONT_NAME: = \"%s\"\n", WMF_FONT_NAME(font)); */
printf("WMF_FONT_PSNAME: = \"%s\"\n", WMF_FONT_PSNAME(font));
printf("Bounding box TL=%g,%g BR=%g,%g\n",
TL.x, TL.y, BR.x, BR.y );
/* printf("Text box = %gx%g\n", bbox_width, bbox_height); */
/* printf("WMF_FONT_HEIGHT = %i\n", (int)WMF_FONT_HEIGHT(font)); */
printf("Pointsize = %g\n", pointsize);
fflush(stdout);
#endif
/*
* Obtain font metrics if required
*
*/
if ((WMF_DC_TEXTALIGN(draw_text->dc) & TA_CENTER) ||
(WMF_TEXT_UNDERLINE(font)) || (WMF_TEXT_STRIKEOUT(font)))
{
Image
*image = ddata->image;
DrawInfo
*draw_info;
draw_info=ddata->draw_info;
draw_info->font=WMF_FONT_PSNAME(font);
draw_info->pointsize = pointsize;
draw_info->text=draw_text->str;
if (GetTypeMetrics(image, draw_info, &metrics, exception) != MagickFalse)
{
/* Center the text if it is not yet centered and should be */
if ((WMF_DC_TEXTALIGN(draw_text->dc) & TA_CENTER))
{
double
text_width = metrics.width * (ddata->scale_y / ddata->scale_x);
#if defined(MAGICKCORE_WMF_DELEGATE)
point.x -= text_width / 2;
#else
point.x += bbox_width / 2 - text_width / 2;
#endif
}
}
draw_info->font=NULL;
draw_info->text=NULL;
}
/* Set text background color */
if (draw_text->flags & ETO_OPAQUE)
{
/* Draw bounding-box background color (META_EXTTEXTOUT mode) */
draw_stroke_color_string(WmfDrawingWand,"none");
draw_fill_color_rgb(API,WMF_DC_BACKGROUND(draw_text->dc));
DrawRectangle(WmfDrawingWand,
XC(draw_text->TL.x),YC(draw_text->TL.y),
XC(draw_text->BR.x),YC(draw_text->BR.y));
draw_fill_color_string(WmfDrawingWand,"none");
}
else
{
/* Set text undercolor */
if (WMF_DC_OPAQUE(draw_text->dc))
{
wmfRGB
*box = WMF_DC_BACKGROUND(draw_text->dc);
PixelWand
*under_color;
under_color=NewPixelWand();
PixelSetRedQuantum(under_color,ScaleCharToQuantum(box->r));
PixelSetGreenQuantum(under_color,ScaleCharToQuantum(box->g));
PixelSetBlueQuantum(under_color,ScaleCharToQuantum(box->b));
PixelSetAlphaQuantum(under_color,OpaqueAlpha);
DrawSetTextUnderColor(WmfDrawingWand,under_color);
under_color=DestroyPixelWand(under_color);
}
else
draw_under_color_string(WmfDrawingWand,"none");
}
/* Set text clipping (META_EXTTEXTOUT mode) */
if ( draw_text->flags & ETO_CLIPPED)
{
}
/* Set stroke color */
draw_stroke_color_string(WmfDrawingWand,"none");
/* Set fill color */
draw_fill_color_rgb(API,WMF_DC_TEXTCOLOR(draw_text->dc));
/* Output font size */
(void) DrawSetFontSize(WmfDrawingWand,pointsize);
/* Output Postscript font name */
(void) DrawSetFont(WmfDrawingWand, WMF_FONT_PSNAME(font));
/* Translate coordinates so target is 0,0 */
DrawTranslate(WmfDrawingWand, XC(point.x), YC(point.y));
/* Transform horizontal scale to draw text at 1:1 ratio */
DrawScale(WmfDrawingWand, ddata->scale_y / ddata->scale_x, 1.0);
/* Apply rotation */
/* ImageMagick's drawing rotation is clockwise from horizontal
while WMF drawing rotation is counterclockwise from horizontal */
angle = fabs(RadiansToDegrees(2 * MagickPI - WMF_TEXT_ANGLE(font)));
if (angle == 360)
angle = 0;
if (angle != 0)
DrawRotate(WmfDrawingWand, angle);
/*
* Render text
*
*/
/* Output string */
DrawAnnotation(WmfDrawingWand, 0, 0, (unsigned char*)draw_text->str);
/* Underline text the Windows way (at the bottom) */
if (WMF_TEXT_UNDERLINE(font))
{
double
line_height;
wmfD_Coord
ulBR, /* bottom right of underline rectangle */
ulTL; /* top left of underline rectangle */
line_height = ((double)1/(ddata->scale_x))*metrics.underline_thickness;
if (metrics.underline_thickness < 1.5)
line_height *= 0.55;
ulTL.x = 0;
ulTL.y = fabs(metrics.descent) - line_height;
ulBR.x = metrics.width;
ulBR.y = fabs(metrics.descent);
DrawRectangle(WmfDrawingWand,
XC(ulTL.x), YC(ulTL.y), XC(ulBR.x), YC(ulBR.y));
}
/* Strikeout text the Windows way */
if (WMF_TEXT_STRIKEOUT(font))
{
double line_height;
wmfD_Coord
ulBR, /* bottom right of strikeout rectangle */
ulTL; /* top left of strikeout rectangle */
line_height = ((double)1/(ddata->scale_x))*metrics.underline_thickness;
if (metrics.underline_thickness < 2.0)
line_height *= 0.55;
ulTL.x = 0;
ulTL.y = -(((double) metrics.ascent) / 2 + line_height / 2);
ulBR.x = metrics.width;
ulBR.y = -(((double) metrics.ascent) / 2 - line_height / 2);
DrawRectangle(WmfDrawingWand,
XC(ulTL.x), YC(ulTL.y), XC(ulBR.x), YC(ulBR.y));
}
/* Restore graphic wand */
(void) PopDrawingWand(WmfDrawingWand);
#if 0
(void) PushDrawingWand(WmfDrawingWand);
draw_stroke_color_string(WmfDrawingWand,"red");
draw_fill_color_string(WmfDrawingWand,"none");
DrawRectangle(WmfDrawingWand,
XC(TL.x), YC(TL.y),
XC(BR.x), YC(BR.y));
draw_stroke_color_string(WmfDrawingWand,"none");
(void) PopDrawingWand(WmfDrawingWand);
#endif
}
| 0
|
383,319
|
gdLayerOverlay (int dst, int src)
{
int a1, a2;
a1 = gdAlphaMax - gdTrueColorGetAlpha(dst);
a2 = gdAlphaMax - gdTrueColorGetAlpha(src);
return ( ((gdAlphaMax - a1*a2/gdAlphaMax) << 24) +
(gdAlphaOverlayColor( gdTrueColorGetRed(src), gdTrueColorGetRed(dst), gdRedMax ) << 16) +
(gdAlphaOverlayColor( gdTrueColorGetGreen(src), gdTrueColorGetGreen(dst), gdGreenMax ) << 8) +
(gdAlphaOverlayColor( gdTrueColorGetBlue(src), gdTrueColorGetBlue(dst), gdBlueMax ))
);
}
| 0
|
508,892
|
bool st_select_lex::handle_derived(LEX *lex, uint phases)
{
return lex->handle_list_of_derived(table_list.first, phases);
}
| 0
|
384,680
|
send_newstyle_option_reply_info_str (uint32_t option, uint32_t reply,
uint16_t info, const char *str,
size_t len)
{
GET_CONN;
struct nbd_fixed_new_option_reply fixed_new_option_reply;
struct nbd_fixed_new_option_reply_info_name_or_desc name;
if (len == -1)
len = strlen (str);
assert (len <= NBD_MAX_STRING);
fixed_new_option_reply.magic = htobe64 (NBD_REP_MAGIC);
fixed_new_option_reply.option = htobe32 (option);
fixed_new_option_reply.reply = htobe32 (reply);
fixed_new_option_reply.replylen = htobe32 (sizeof info + len);
name.info = htobe16 (info);
if (conn->send (&fixed_new_option_reply,
sizeof fixed_new_option_reply, SEND_MORE) == -1 ||
conn->send (&name, sizeof name, SEND_MORE) == -1 ||
conn->send (str, len, 0) == -1) {
nbdkit_error ("write: %s: %m", name_of_nbd_opt (option));
return -1;
}
return 0;
}
| 0
|
276,983
|
virtual AP4_Result GetSize(AP4_LargeSize& size) { size = m_Size; return AP4_SUCCESS; }
| 0
|
369,415
|
static __cold int io_register_restrictions(struct io_ring_ctx *ctx,
void __user *arg, unsigned int nr_args)
{
struct io_uring_restriction *res;
size_t size;
int i, ret;
/* Restrictions allowed only if rings started disabled */
if (!(ctx->flags & IORING_SETUP_R_DISABLED))
return -EBADFD;
/* We allow only a single restrictions registration */
if (ctx->restrictions.registered)
return -EBUSY;
if (!arg || nr_args > IORING_MAX_RESTRICTIONS)
return -EINVAL;
size = array_size(nr_args, sizeof(*res));
if (size == SIZE_MAX)
return -EOVERFLOW;
res = memdup_user(arg, size);
if (IS_ERR(res))
return PTR_ERR(res);
ret = 0;
for (i = 0; i < nr_args; i++) {
switch (res[i].opcode) {
case IORING_RESTRICTION_REGISTER_OP:
if (res[i].register_op >= IORING_REGISTER_LAST) {
ret = -EINVAL;
goto out;
}
__set_bit(res[i].register_op,
ctx->restrictions.register_op);
break;
case IORING_RESTRICTION_SQE_OP:
if (res[i].sqe_op >= IORING_OP_LAST) {
ret = -EINVAL;
goto out;
}
__set_bit(res[i].sqe_op, ctx->restrictions.sqe_op);
break;
case IORING_RESTRICTION_SQE_FLAGS_ALLOWED:
ctx->restrictions.sqe_flags_allowed = res[i].sqe_flags;
break;
case IORING_RESTRICTION_SQE_FLAGS_REQUIRED:
ctx->restrictions.sqe_flags_required = res[i].sqe_flags;
break;
default:
ret = -EINVAL;
goto out;
}
}
out:
/* Reset all restrictions if an error happened */
if (ret != 0)
memset(&ctx->restrictions, 0, sizeof(ctx->restrictions));
else
ctx->restrictions.registered = true;
kfree(res);
return ret;
| 0
|
232,956
|
static CURLcode gzip_init_writer(struct Curl_easy *data,
struct contenc_writer *writer)
{
struct zlib_params *zp = (struct zlib_params *) &writer->params;
z_stream *z = &zp->z; /* zlib state structure */
if(!writer->downstream)
return CURLE_WRITE_ERROR;
/* Initialize zlib */
z->zalloc = (alloc_func) zalloc_cb;
z->zfree = (free_func) zfree_cb;
if(strcmp(zlibVersion(), "1.2.0.4") >= 0) {
/* zlib ver. >= 1.2.0.4 supports transparent gzip decompressing */
if(inflateInit2(z, MAX_WBITS + 32) != Z_OK) {
return process_zlib_error(data, z);
}
zp->zlib_init = ZLIB_INIT_GZIP; /* Transparent gzip decompress state */
}
else {
/* we must parse the gzip header and trailer ourselves */
if(inflateInit2(z, -MAX_WBITS) != Z_OK) {
return process_zlib_error(data, z);
}
zp->trailerlen = 8; /* A CRC-32 and a 32-bit input size (RFC 1952, 2.2) */
zp->zlib_init = ZLIB_INIT; /* Initial call state */
}
return CURLE_OK;
}
| 0
|
474,430
|
ObjectGetHierarchy(
OBJECT *object // IN :object
)
{
if(object->attributes.spsHierarchy)
{
return TPM_RH_OWNER;
}
else if(object->attributes.epsHierarchy)
{
return TPM_RH_ENDORSEMENT;
}
else if(object->attributes.ppsHierarchy)
{
return TPM_RH_PLATFORM;
}
else
{
return TPM_RH_NULL;
}
}
| 0
|
226,403
|
void traf_box_del(GF_Box *s)
{
GF_TrackFragmentBox *ptr = (GF_TrackFragmentBox *)s;
if (ptr == NULL) return;
if (ptr->sub_samples) gf_list_del(ptr->sub_samples);
gf_list_del(ptr->TrackRuns);
if (ptr->sampleGroups) gf_list_del(ptr->sampleGroups);
if (ptr->sampleGroupsDescription) gf_list_del(ptr->sampleGroupsDescription);
if (ptr->sai_sizes) gf_list_del(ptr->sai_sizes);
if (ptr->sai_offsets) gf_list_del(ptr->sai_offsets);
gf_free(ptr);
}
| 0
|
264,229
|
static void framebuffer_update_request(VncState *vs, int incremental,
int x_position, int y_position,
int w, int h)
{
int i;
const size_t width = surface_width(vs->vd->ds) / VNC_DIRTY_PIXELS_PER_BIT;
const size_t height = surface_height(vs->vd->ds);
if (y_position > height) {
y_position = height;
}
if (y_position + h >= height) {
h = height - y_position;
}
vs->need_update = 1;
if (!incremental) {
vs->force_update = 1;
for (i = 0; i < h; i++) {
bitmap_set(vs->dirty[y_position + i], 0, width);
bitmap_clear(vs->dirty[y_position + i], width,
VNC_DIRTY_BITS - width);
}
}
}
| 0
|
344,227
|
static void collectvalidlines (lua_State *L, Closure *f) {
if (noLuaClosure(f)) {
setnilvalue(s2v(L->top));
api_incr_top(L);
}
else {
int i;
TValue v;
const Proto *p = f->l.p;
int currentline = p->linedefined;
Table *t = luaH_new(L); /* new table to store active lines */
sethvalue2s(L, L->top, t); /* push it on stack */
api_incr_top(L);
setbtvalue(&v); /* boolean 'true' to be the value of all indices */
if (!p->is_vararg) /* regular function? */
i = 0; /* consider all instructions */
else { /* vararg function */
lua_assert(GET_OPCODE(p->code[0]) == OP_VARARGPREP);
currentline = nextline(p, currentline, 0);
i = 1; /* skip first instruction (OP_VARARGPREP) */
}
for (; i < p->sizelineinfo; i++) { /* for each instruction */
currentline = nextline(p, currentline, i); /* get its line */
luaH_setint(L, t, currentline, &v); /* table[line] = true */
}
}
}
| 0
|
220,226
|
Node* Graph::AddNode(NodeDef node_def, Status* status) {
const OpRegistrationData* op_reg_data;
status->Update(ops_.LookUp(node_def.op(), &op_reg_data));
if (!status->ok()) return nullptr;
DataTypeVector inputs;
DataTypeVector outputs;
status->Update(
InOutTypesForNode(node_def, op_reg_data->op_def, &inputs, &outputs));
if (!status->ok()) {
*status = AttachDef(*status, node_def);
return nullptr;
}
Node::NodeClass node_class = op_reg_data->is_function_op
? Node::NC_FUNCTION_OP
: Node::GetNodeClassForOp(node_def.op());
if (op_reg_data->type_ctor != nullptr) {
VLOG(3) << "AddNode: found type constructor for " << node_def.name();
const auto ctor_type =
full_type::SpecializeType(AttrSlice(node_def), op_reg_data->op_def);
if (!ctor_type.ok()) {
*status = errors::InvalidArgument("type error: ",
ctor_type.status().ToString());
return nullptr;
}
const FullTypeDef ctor_typedef = ctor_type.ValueOrDie();
if (ctor_typedef.type_id() != TFT_UNSET) {
*(node_def.mutable_experimental_type()) = ctor_typedef;
}
} else {
VLOG(3) << "AddNode: no type constructor for " << node_def.name();
}
Node* node = AllocateNode(std::make_shared<NodeProperties>(
&op_reg_data->op_def, std::move(node_def),
inputs, outputs, op_reg_data->fwd_type_fn),
nullptr, node_class);
return node;
}
| 0
|
226,096
|
GF_Box *mvhd_box_new()
{
ISOM_DECL_BOX_ALLOC(GF_MovieHeaderBox, GF_ISOM_BOX_TYPE_MVHD);
tmp->preferredRate = (1<<16);
tmp->preferredVolume = (1<<8);
tmp->matrixA = (1<<16);
tmp->matrixD = (1<<16);
tmp->matrixW = (1<<30);
tmp->nextTrackID = 1;
return (GF_Box *)tmp;
}
| 0
|
369,266
|
static __cold void io_sqd_update_thread_idle(struct io_sq_data *sqd)
{
struct io_ring_ctx *ctx;
unsigned sq_thread_idle = 0;
list_for_each_entry(ctx, &sqd->ctx_list, sqd_list)
sq_thread_idle = max(sq_thread_idle, ctx->sq_thread_idle);
sqd->sq_thread_idle = sq_thread_idle;
| 0
|
450,428
|
static bool vnc_check_pageflip(DisplaySurface *s1,
DisplaySurface *s2)
{
return (s1 != NULL &&
s2 != NULL &&
surface_width(s1) == surface_width(s2) &&
surface_height(s1) == surface_height(s2) &&
surface_format(s1) == surface_format(s2));
}
| 0
|
273,400
|
explicit LSTMBlockCellGradOp(OpKernelConstruction* ctx) : OpKernel(ctx) {
OP_REQUIRES_OK(ctx, ctx->GetAttr("use_peephole", &use_peephole_));
}
| 0
|
487,628
|
void groups_free(struct group_info *group_info)
{
if (group_info->blocks[0] != group_info->small_block) {
int i;
for (i = 0; i < group_info->nblocks; i++)
free_page((unsigned long)group_info->blocks[i]);
}
kfree(group_info);
}
| 0
|
90,234
|
~NetworkLibraryImpl() {
network_manager_observers_.Clear();
if (network_manager_monitor_)
DisconnectPropertyChangeMonitor(network_manager_monitor_);
data_plan_observers_.Clear();
if (data_plan_monitor_)
DisconnectDataPlanUpdateMonitor(data_plan_monitor_);
STLDeleteValues(&network_observers_);
ClearNetworks();
}
| 0
|
482,691
|
gst_flxdec_sink_event_handler (GstPad * pad, GstObject * parent,
GstEvent * event)
{
GstFlxDec *flxdec;
gboolean ret;
flxdec = GST_FLXDEC (parent);
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_SEGMENT:
{
GstSegment segment;
gst_event_copy_segment (event, &segment);
if (segment.format != GST_FORMAT_TIME) {
GST_DEBUG_OBJECT (flxdec, "generating TIME segment");
gst_segment_init (&segment, GST_FORMAT_TIME);
gst_event_unref (event);
event = gst_event_new_segment (&segment);
}
/* fall-through */
}
default:
ret = gst_pad_event_default (pad, parent, event);
break;
}
return ret;
}
| 0
|
202,943
|
l_noret luaG_runerror (lua_State *L, const char *fmt, ...) {
CallInfo *ci = L->ci;
const char *msg;
va_list argp;
luaC_checkGC(L); /* error message uses memory */
va_start(argp, fmt);
msg = luaO_pushvfstring(L, fmt, argp); /* format message */
va_end(argp);
if (isLua(ci)) /* if Lua function, add source:line information */
luaG_addinfo(L, msg, ci_func(ci)->p->source, getcurrentline(ci));
luaG_errormsg(L);
}
| 1
|
252,335
|
static void cpy4(float *dst_val, const float *src_val) {
unsigned char *dst = reinterpret_cast<unsigned char *>(dst_val);
const unsigned char *src = reinterpret_cast<const unsigned char *>(src_val);
dst[0] = src[0];
dst[1] = src[1];
dst[2] = src[2];
dst[3] = src[3];
}
| 0
|
265,056
|
putpromptchar(int doprint, int endchar, zattr *txtchangep)
{
char *ss, *hostnam;
int t0, arg, test, sep, j, numjobs, len;
zattr atr;
struct tm *tm;
struct timespec ts;
time_t timet;
Nameddir nd;
for (; *bv->fm && *bv->fm != endchar; bv->fm++) {
arg = 0;
if (*bv->fm == '%' && isset(PROMPTPERCENT)) {
int minus = 0;
bv->fm++;
if (*bv->fm == '-') {
minus = 1;
bv->fm++;
}
if (idigit(*bv->fm)) {
arg = zstrtol(bv->fm, &bv->fm, 10);
if (minus)
arg *= -1;
} else if (minus)
arg = -1;
if (*bv->fm == '(') {
int tc, otruncwidth;
if (idigit(*++bv->fm)) {
arg = zstrtol(bv->fm, &bv->fm, 10);
} else if (arg < 0) {
/* negative numbers don't make sense here */
arg *= -1;
}
test = 0;
ss = pwd;
switch (tc = *bv->fm) {
case 'c':
case '.':
case '~':
if ((nd = finddir(ss))) {
arg--;
ss += strlen(nd->dir);
} /*FALLTHROUGH*/
case '/':
case 'C':
/* `/' gives 0, `/any' gives 1, etc. */
if (*ss && *ss++ == '/' && *ss)
arg--;
for (; *ss; ss++)
if (*ss == '/')
arg--;
if (arg <= 0)
test = 1;
break;
case 't':
case 'T':
case 'd':
case 'D':
case 'w':
timet = time(NULL);
tm = localtime(&timet);
switch (tc) {
case 't':
test = (arg == tm->tm_min);
break;
case 'T':
test = (arg == tm->tm_hour);
break;
case 'd':
test = (arg == tm->tm_mday);
break;
case 'D':
test = (arg == tm->tm_mon);
break;
case 'w':
test = (arg == tm->tm_wday);
break;
}
break;
case '?':
if (lastval == arg)
test = 1;
break;
case '#':
if (geteuid() == (uid_t)arg)
test = 1;
break;
case 'g':
if (getegid() == (gid_t)arg)
test = 1;
break;
case 'j':
for (numjobs = 0, j = 1; j <= maxjob; j++)
if (jobtab[j].stat && jobtab[j].procs &&
!(jobtab[j].stat & STAT_NOPRINT)) numjobs++;
if (numjobs >= arg)
test = 1;
break;
case 'l':
*bv->bp = '\0';
countprompt(bv->bufline, &t0, 0, 0);
if (minus)
t0 = zterm_columns - t0;
if (t0 >= arg)
test = 1;
break;
case 'e':
{
Funcstack fsptr = funcstack;
test = arg;
while (fsptr && test > 0) {
test--;
fsptr = fsptr->prev;
}
test = !test;
}
break;
case 'L':
if (shlvl >= arg)
test = 1;
break;
case 'S':
if (time(NULL) - shtimer.tv_sec >= arg)
test = 1;
break;
case 'v':
if (arrlen_ge(psvar, arg))
test = 1;
break;
case 'V':
if (psvar && *psvar && arrlen_ge(psvar, arg)) {
if (*psvar[(arg ? arg : 1) - 1])
test = 1;
}
break;
case '_':
test = (cmdsp >= arg);
break;
case '!':
test = privasserted();
break;
default:
test = -1;
break;
}
if (!*bv->fm || !(sep = *++bv->fm))
return 0;
bv->fm++;
/* Don't do the current truncation until we get back */
otruncwidth = bv->truncwidth;
bv->truncwidth = 0;
if (!putpromptchar(test == 1 && doprint, sep,
txtchangep) || !*++bv->fm ||
!putpromptchar(test == 0 && doprint, ')',
txtchangep)) {
bv->truncwidth = otruncwidth;
return 0;
}
bv->truncwidth = otruncwidth;
continue;
}
if (!doprint)
switch(*bv->fm) {
case '[':
while(idigit(*++bv->fm));
while(*++bv->fm != ']');
continue;
case '<':
while(*++bv->fm != '<');
continue;
case '>':
while(*++bv->fm != '>');
continue;
case 'D':
if(bv->fm[1]=='{')
while(*++bv->fm != '}');
continue;
default:
continue;
}
switch (*bv->fm) {
case '~':
promptpath(pwd, arg, 1);
break;
case 'd':
case '/':
promptpath(pwd, arg, 0);
break;
case 'c':
case '.':
promptpath(pwd, arg ? arg : 1, 1);
break;
case 'C':
promptpath(pwd, arg ? arg : 1, 0);
break;
case 'N':
promptpath(scriptname ? scriptname : argzero, arg, 0);
break;
case 'h':
case '!':
addbufspc(DIGBUFSIZE);
convbase(bv->bp, curhist, 10);
bv->bp += strlen(bv->bp);
break;
case 'j':
for (numjobs = 0, j = 1; j <= maxjob; j++)
if (jobtab[j].stat && jobtab[j].procs &&
!(jobtab[j].stat & STAT_NOPRINT)) numjobs++;
addbufspc(DIGBUFSIZE);
sprintf(bv->bp, "%d", numjobs);
bv->bp += strlen(bv->bp);
break;
case 'M':
queue_signals();
if ((hostnam = getsparam("HOST")))
stradd(hostnam);
unqueue_signals();
break;
case 'm':
if (!arg)
arg++;
queue_signals();
if (!(hostnam = getsparam("HOST"))) {
unqueue_signals();
break;
}
if (arg < 0) {
for (ss = hostnam + strlen(hostnam); ss > hostnam; ss--)
if (ss[-1] == '.' && !++arg)
break;
stradd(ss);
} else {
for (ss = hostnam; *ss; ss++)
if (*ss == '.' && !--arg)
break;
stradd(*ss ? dupstrpfx(hostnam, ss - hostnam) : hostnam);
}
unqueue_signals();
break;
case 'S':
txtchangeset(txtchangep, TXTSTANDOUT, TXTNOSTANDOUT);
txtset(TXTSTANDOUT);
tsetcap(TCSTANDOUTBEG, TSC_PROMPT);
break;
case 's':
txtchangeset(txtchangep, TXTNOSTANDOUT, TXTSTANDOUT);
txtunset(TXTSTANDOUT);
tsetcap(TCSTANDOUTEND, TSC_PROMPT|TSC_DIRTY);
break;
case 'B':
txtchangeset(txtchangep, TXTBOLDFACE, TXTNOBOLDFACE);
txtset(TXTBOLDFACE);
tsetcap(TCBOLDFACEBEG, TSC_PROMPT|TSC_DIRTY);
break;
case 'b':
txtchangeset(txtchangep, TXTNOBOLDFACE, TXTBOLDFACE);
txtunset(TXTBOLDFACE);
tsetcap(TCALLATTRSOFF, TSC_PROMPT|TSC_DIRTY);
break;
case 'U':
txtchangeset(txtchangep, TXTUNDERLINE, TXTNOUNDERLINE);
txtset(TXTUNDERLINE);
tsetcap(TCUNDERLINEBEG, TSC_PROMPT);
break;
case 'u':
txtchangeset(txtchangep, TXTNOUNDERLINE, TXTUNDERLINE);
txtunset(TXTUNDERLINE);
tsetcap(TCUNDERLINEEND, TSC_PROMPT|TSC_DIRTY);
break;
case 'F':
atr = parsecolorchar(arg, 1);
if (!(atr & (TXT_ERROR | TXTNOFGCOLOUR))) {
txtchangeset(txtchangep, atr & TXT_ATTR_FG_ON_MASK,
TXTNOFGCOLOUR | TXT_ATTR_FG_COL_MASK);
txtunset(TXT_ATTR_FG_COL_MASK);
txtset(atr & TXT_ATTR_FG_ON_MASK);
set_colour_attribute(atr, COL_SEQ_FG, TSC_PROMPT);
break;
}
/* else FALLTHROUGH */
case 'f':
txtchangeset(txtchangep, TXTNOFGCOLOUR, TXT_ATTR_FG_ON_MASK);
txtunset(TXT_ATTR_FG_ON_MASK);
set_colour_attribute(TXTNOFGCOLOUR, COL_SEQ_FG, TSC_PROMPT);
break;
case 'K':
atr = parsecolorchar(arg, 0);
if (!(atr & (TXT_ERROR | TXTNOBGCOLOUR))) {
txtchangeset(txtchangep, atr & TXT_ATTR_BG_ON_MASK,
TXTNOBGCOLOUR | TXT_ATTR_BG_COL_MASK);
txtunset(TXT_ATTR_BG_COL_MASK);
txtset(atr & TXT_ATTR_BG_ON_MASK);
set_colour_attribute(atr, COL_SEQ_BG, TSC_PROMPT);
break;
}
/* else FALLTHROUGH */
case 'k':
txtchangeset(txtchangep, TXTNOBGCOLOUR, TXT_ATTR_BG_ON_MASK);
txtunset(TXT_ATTR_BG_ON_MASK);
set_colour_attribute(TXTNOBGCOLOUR, COL_SEQ_BG, TSC_PROMPT);
break;
case '[':
if (idigit(*++bv->fm))
arg = zstrtol(bv->fm, &bv->fm, 10);
if (!prompttrunc(arg, ']', doprint, endchar, txtchangep))
return *bv->fm;
break;
case '<':
case '>':
/* Test (minus) here so -0 means "at the right margin" */
if (minus) {
*bv->bp = '\0';
countprompt(bv->bufline, &t0, 0, 0);
arg = zterm_columns - t0 + arg;
if (arg <= 0)
arg = 1;
}
if (!prompttrunc(arg, *bv->fm, doprint, endchar, txtchangep))
return *bv->fm;
break;
case '{': /*}*/
if (!bv->dontcount++) {
addbufspc(1);
*bv->bp++ = Inpar;
}
if (arg <= 0)
break;
/* else */
/* FALLTHROUGH */
case 'G':
if (arg > 0) {
addbufspc(arg);
while (arg--)
*bv->bp++ = Nularg;
} else {
addbufspc(1);
*bv->bp++ = Nularg;
}
break;
case /*{*/ '}':
if (bv->trunccount && bv->trunccount >= bv->dontcount)
return *bv->fm;
if (bv->dontcount && !--bv->dontcount) {
addbufspc(1);
*bv->bp++ = Outpar;
}
break;
case 't':
case '@':
case 'T':
case '*':
case 'w':
case 'W':
case 'D':
{
char *tmfmt, *dd, *tmbuf = NULL;
switch (*bv->fm) {
case 'T':
tmfmt = "%K:%M";
break;
case '*':
tmfmt = "%K:%M:%S";
break;
case 'w':
tmfmt = "%a %f";
break;
case 'W':
tmfmt = "%m/%d/%y";
break;
case 'D':
if (bv->fm[1] == '{' /*}*/) {
for (ss = bv->fm + 2; *ss && *ss != /*{*/ '}'; ss++)
if(*ss == '\\' && ss[1])
ss++;
dd = tmfmt = tmbuf = zalloc(ss - bv->fm);
for (ss = bv->fm + 2; *ss && *ss != /*{*/ '}';
ss++) {
if(*ss == '\\' && ss[1])
ss++;
*dd++ = *ss;
}
*dd = 0;
bv->fm = ss - !*ss;
if (!*tmfmt) {
free(tmbuf);
continue;
}
} else
tmfmt = "%y-%m-%d";
break;
default:
tmfmt = "%l:%M%p";
break;
}
zgettime(&ts);
tm = localtime(&ts.tv_sec);
/*
* Hack because strftime won't say how
* much space it actually needs. Try to add it
* a few times until it works. Some formats don't
* actually have a length, so we could go on for
* ever.
*/
for(j = 0, t0 = strlen(tmfmt)*8; j < 3; j++, t0*=2) {
addbufspc(t0);
if ((len = ztrftime(bv->bp, t0, tmfmt, tm, ts.tv_nsec))
>= 0)
break;
}
/* There is enough room for this because addbufspc(t0)
* allocates room for t0 * 2 bytes. */
if (len >= 0)
metafy(bv->bp, len, META_NOALLOC);
bv->bp += strlen(bv->bp);
zsfree(tmbuf);
break;
}
case 'n':
stradd(get_username());
break;
case 'l':
if (*ttystrname) {
ss = (strncmp(ttystrname, "/dev/tty", 8) ?
ttystrname + 5 : ttystrname + 8);
stradd(ss);
} else
stradd("()");
break;
case 'y':
if (*ttystrname) {
ss = (strncmp(ttystrname, "/dev/", 5) ?
ttystrname : ttystrname + 5);
stradd(ss);
} else
stradd("()");
break;
case 'L':
addbufspc(DIGBUFSIZE);
#if defined(ZLONG_IS_LONG_LONG) && defined(PRINTF_HAS_LLD)
sprintf(bv->bp, "%lld", shlvl);
#else
sprintf(bv->bp, "%ld", (long)shlvl);
#endif
bv->bp += strlen(bv->bp);
break;
case '?':
addbufspc(DIGBUFSIZE);
#if defined(ZLONG_IS_LONG_LONG) && defined(PRINTF_HAS_LLD)
sprintf(bv->bp, "%lld", lastval);
#else
sprintf(bv->bp, "%ld", (long)lastval);
#endif
bv->bp += strlen(bv->bp);
break;
case '%':
case ')':
addbufspc(1);
*bv->bp++ = *bv->fm;
break;
case '#':
addbufspc(1);
*bv->bp++ = privasserted() ? '#' : '%';
break;
case 'v':
if (!arg)
arg = 1;
else if (arg < 0)
arg += arrlen(psvar) + 1;
if (arg > 0 && arrlen_ge(psvar, arg))
stradd(psvar[arg - 1]);
break;
case 'E':
tsetcap(TCCLEAREOL, TSC_PROMPT);
break;
case '^':
if (cmdsp) {
if (arg >= 0) {
if (arg > cmdsp || arg == 0)
arg = cmdsp;
for (t0 = cmdsp - 1; arg--; t0--) {
stradd(cmdnames[cmdstack[t0]]);
if (arg) {
addbufspc(1);
*bv->bp++=' ';
}
}
} else {
arg = -arg;
if (arg > cmdsp)
arg = cmdsp;
for (t0 = arg - 1; arg--; t0--) {
stradd(cmdnames[cmdstack[t0]]);
if (arg) {
addbufspc(1);
*bv->bp++=' ';
}
}
}
}
break;
case '_':
if (cmdsp) {
if (arg >= 0) {
if (arg > cmdsp || arg == 0)
arg = cmdsp;
for (t0 = cmdsp - arg; arg--; t0++) {
stradd(cmdnames[cmdstack[t0]]);
if (arg) {
addbufspc(1);
*bv->bp++=' ';
}
}
} else {
arg = -arg;
if (arg > cmdsp)
arg = cmdsp;
for (t0 = 0; arg--; t0++) {
stradd(cmdnames[cmdstack[t0]]);
if (arg) {
addbufspc(1);
*bv->bp++=' ';
}
}
}
}
break;
case 'r':
if(bv->rstring)
stradd(bv->rstring);
break;
case 'R':
if(bv->Rstring)
stradd(bv->Rstring);
break;
case 'e':
{
int depth = 0;
Funcstack fsptr = funcstack;
while (fsptr) {
depth++;
fsptr = fsptr->prev;
}
addbufspc(DIGBUFSIZE);
sprintf(bv->bp, "%d", depth);
bv->bp += strlen(bv->bp);
break;
}
case 'I':
if (funcstack && funcstack->tp != FS_SOURCE &&
!IN_EVAL_TRAP()) {
/*
* We're in a function or an eval with
* EVALLINENO. Calculate the line number in
* the file.
*/
zlong flineno = lineno + funcstack->flineno;
/* take account of eval line nos. starting at 1 */
if (funcstack->tp == FS_EVAL)
lineno--;
addbufspc(DIGBUFSIZE);
#if defined(ZLONG_IS_LONG_LONG) && defined(PRINTF_HAS_LLD)
sprintf(bv->bp, "%lld", flineno);
#else
sprintf(bv->bp, "%ld", (long)flineno);
#endif
bv->bp += strlen(bv->bp);
break;
}
/* else we're in a file and lineno is already correct */
/* FALLTHROUGH */
case 'i':
addbufspc(DIGBUFSIZE);
#if defined(ZLONG_IS_LONG_LONG) && defined(PRINTF_HAS_LLD)
sprintf(bv->bp, "%lld", lineno);
#else
sprintf(bv->bp, "%ld", (long)lineno);
#endif
bv->bp += strlen(bv->bp);
break;
case 'x':
if (funcstack && funcstack->tp != FS_SOURCE &&
!IN_EVAL_TRAP())
promptpath(funcstack->filename ? funcstack->filename : "",
arg, 0);
else
promptpath(scriptfilename ? scriptfilename : argzero,
arg, 0);
break;
case '\0':
return 0;
case Meta:
bv->fm++;
break;
}
} else if(*bv->fm == '!' && isset(PROMPTBANG)) {
if(doprint) {
if(bv->fm[1] == '!') {
bv->fm++;
addbufspc(1);
pputc('!');
} else {
addbufspc(DIGBUFSIZE);
convbase(bv->bp, curhist, 10);
bv->bp += strlen(bv->bp);
}
}
} else {
char c = *bv->fm == Meta ? *++bv->fm ^ 32 : *bv->fm;
if (doprint) {
addbufspc(1);
pputc(c);
}
}
}
return *bv->fm;
}
| 0
|
300,770
|
static int tipc_send_group_anycast(struct socket *sock, struct msghdr *m,
int dlen, long timeout)
{
struct tipc_uaddr *ua = (struct tipc_uaddr *)m->msg_name;
struct sock *sk = sock->sk;
struct tipc_sock *tsk = tipc_sk(sk);
struct list_head *cong_links = &tsk->cong_links;
int blks = tsk_blocks(GROUP_H_SIZE + dlen);
struct tipc_msg *hdr = &tsk->phdr;
struct tipc_member *first = NULL;
struct tipc_member *mbr = NULL;
struct net *net = sock_net(sk);
u32 node, port, exclude;
struct list_head dsts;
int lookups = 0;
int dstcnt, rc;
bool cong;
INIT_LIST_HEAD(&dsts);
ua->sa.type = msg_nametype(hdr);
ua->scope = msg_lookup_scope(hdr);
while (++lookups < 4) {
exclude = tipc_group_exclude(tsk->group);
first = NULL;
/* Look for a non-congested destination member, if any */
while (1) {
if (!tipc_nametbl_lookup_group(net, ua, &dsts, &dstcnt,
exclude, false))
return -EHOSTUNREACH;
tipc_dest_pop(&dsts, &node, &port);
cong = tipc_group_cong(tsk->group, node, port, blks,
&mbr);
if (!cong)
break;
if (mbr == first)
break;
if (!first)
first = mbr;
}
/* Start over if destination was not in member list */
if (unlikely(!mbr))
continue;
if (likely(!cong && !tipc_dest_find(cong_links, node, 0)))
break;
/* Block or return if destination link or member is congested */
rc = tipc_wait_for_cond(sock, &timeout,
!tipc_dest_find(cong_links, node, 0) &&
tsk->group &&
!tipc_group_cong(tsk->group, node, port,
blks, &mbr));
if (unlikely(rc))
return rc;
/* Send, unless destination disappeared while waiting */
if (likely(mbr))
break;
}
if (unlikely(lookups >= 4))
return -EHOSTUNREACH;
rc = tipc_send_group_msg(net, tsk, m, mbr, node, port, dlen);
return rc ? rc : dlen;
}
| 0
|
259,249
|
static void mov_free_encryption_index(MOVEncryptionIndex **index) {
int i;
if (!index || !*index) return;
for (i = 0; i < (*index)->nb_encrypted_samples; i++) {
av_encryption_info_free((*index)->encrypted_samples[i]);
}
av_freep(&(*index)->encrypted_samples);
av_freep(&(*index)->auxiliary_info_sizes);
av_freep(&(*index)->auxiliary_offsets);
av_freep(index);
}
| 0
|
462,562
|
std::string controller::write_temporary_item(std::shared_ptr<rss_item> item) {
char filename[_POSIX_PATH_MAX];
snprintf(filename, sizeof(filename), "/tmp/newsbeuter-article.XXXXXX");
int fd = mkstemp(filename);
if (fd != -1) {
write_item(item, filename);
close(fd);
return std::string(filename);
} else {
return "";
}
}
| 0
|
513,338
|
end_unique_update(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
bool end_of_records)
{
TABLE *table= join_tab->table;
int error;
DBUG_ENTER("end_unique_update");
if (end_of_records)
DBUG_RETURN(NESTED_LOOP_OK);
init_tmptable_sum_functions(join->sum_funcs);
copy_fields(join_tab->tmp_table_param); // Groups are copied twice.
if (copy_funcs(join_tab->tmp_table_param->items_to_copy, join->thd))
DBUG_RETURN(NESTED_LOOP_ERROR); /* purecov: inspected */
if (!(error= table->file->ha_write_tmp_row(table->record[0])))
join_tab->send_records++; // New group
else
{
if ((int) table->file->get_dup_key(error) < 0)
{
table->file->print_error(error,MYF(0)); /* purecov: inspected */
DBUG_RETURN(NESTED_LOOP_ERROR); /* purecov: inspected */
}
/* Prepare table for random positioning */
bool rnd_inited= (table->file->inited == handler::RND);
if (!rnd_inited &&
((error= table->file->ha_index_end()) ||
(error= table->file->ha_rnd_init(0))))
{
table->file->print_error(error, MYF(0));
DBUG_RETURN(NESTED_LOOP_ERROR);
}
if (table->file->ha_rnd_pos(table->record[1],table->file->dup_ref))
{
table->file->print_error(error,MYF(0)); /* purecov: inspected */
DBUG_RETURN(NESTED_LOOP_ERROR); /* purecov: inspected */
}
restore_record(table,record[1]);
update_tmptable_sum_func(join->sum_funcs,table);
if ((error= table->file->ha_update_tmp_row(table->record[1],
table->record[0])))
{
table->file->print_error(error,MYF(0)); /* purecov: inspected */
DBUG_RETURN(NESTED_LOOP_ERROR); /* purecov: inspected */
}
if (!rnd_inited &&
((error= table->file->ha_rnd_end()) ||
(error= table->file->ha_index_init(0, 0))))
{
table->file->print_error(error, MYF(0));
DBUG_RETURN(NESTED_LOOP_ERROR);
}
}
if (join->thd->check_killed())
{
join->thd->send_kill_message();
DBUG_RETURN(NESTED_LOOP_KILLED); /* purecov: inspected */
}
DBUG_RETURN(NESTED_LOOP_OK);
}
| 0
|
312,579
|
vgr_init_regmatch(regmmatch_T *regmatch, char_u *s)
{
// Get the search pattern: either white-separated or enclosed in //
regmatch->regprog = NULL;
if (s == NULL || *s == NUL)
{
// Pattern is empty, use last search pattern.
if (last_search_pat() == NULL)
{
emsg(_(e_no_previous_regular_expression));
return;
}
regmatch->regprog = vim_regcomp(last_search_pat(), RE_MAGIC);
}
else
regmatch->regprog = vim_regcomp(s, RE_MAGIC);
regmatch->rmm_ic = p_ic;
regmatch->rmm_maxcol = 0;
}
| 0
|
317,202
|
static int smack_add_opt(int token, const char *s, void **mnt_opts)
{
struct smack_mnt_opts *opts = *mnt_opts;
if (!opts) {
opts = kzalloc(sizeof(struct smack_mnt_opts), GFP_KERNEL);
if (!opts)
return -ENOMEM;
*mnt_opts = opts;
}
if (!s)
return -ENOMEM;
switch (token) {
case Opt_fsdefault:
if (opts->fsdefault)
goto out_opt_err;
opts->fsdefault = s;
break;
case Opt_fsfloor:
if (opts->fsfloor)
goto out_opt_err;
opts->fsfloor = s;
break;
case Opt_fshat:
if (opts->fshat)
goto out_opt_err;
opts->fshat = s;
break;
case Opt_fsroot:
if (opts->fsroot)
goto out_opt_err;
opts->fsroot = s;
break;
case Opt_fstransmute:
if (opts->fstransmute)
goto out_opt_err;
opts->fstransmute = s;
break;
}
return 0;
out_opt_err:
pr_warn("Smack: duplicate mount options\n");
return -EINVAL;
}
| 0
|
289,269
|
static int snd_pcm_oss_set_fragment(struct snd_pcm_oss_file *pcm_oss_file, unsigned int val)
{
int err = -EINVAL, idx;
for (idx = 1; idx >= 0; --idx) {
struct snd_pcm_substream *substream = pcm_oss_file->streams[idx];
struct snd_pcm_runtime *runtime;
if (substream == NULL)
continue;
runtime = substream->runtime;
err = lock_params(runtime);
if (err < 0)
return err;
err = snd_pcm_oss_set_fragment1(substream, val);
unlock_params(runtime);
if (err < 0)
return err;
}
return err;
}
| 0
|
175,698
|
WifiNetwork::WifiNetwork(const ServiceInfo* service)
: WirelessNetwork(service) {
encryption_ = service->security;
passphrase_ = SafeString(service->passphrase);
identity_ = SafeString(service->identity);
cert_path_ = SafeString(service->cert_path);
type_ = TYPE_WIFI;
}
| 0
|
310,331
|
directory_caches_dir_info(or_options_t *options)
{
if (options->BridgeRelay || options->DirPort)
return 1;
if (!server_mode(options) || !advertised_server_mode())
return 0;
/* We need an up-to-date view of network info if we're going to try to
* block exit attempts from unknown relays. */
return ! router_my_exit_policy_is_reject_star() &&
should_refuse_unknown_exits(options);
}
| 0
|
455,427
|
xfs_reclaim_inodes_nr(
struct xfs_mount *mp,
int nr_to_scan)
{
/* kick background reclaimer and push the AIL */
xfs_reclaim_work_queue(mp);
xfs_ail_push_all(mp->m_ail);
return xfs_reclaim_inodes_ag(mp, SYNC_TRYLOCK | SYNC_WAIT, &nr_to_scan);
}
| 0
|
512,616
|
longlong val_int()
{
DBUG_ASSERT(sane());
return null_value ? 0 :
m_value.to_datetime(current_thd).to_longlong();
}
| 0
|
175,690
|
virtual CellularNetwork* FindCellularNetworkByPath(
const std::string& path) {
return GetWirelessNetworkByPath(cellular_networks_, path);
}
| 0
|
90,819
|
int64 global_unlimited_usage() const { return global_unlimited_usage_; }
| 0
|
225,559
|
void TfLiteIntArrayFree(TfLiteIntArray* a) { free(a); }
| 0
|
385,877
|
SYSCALL_DEFINE4(openat, int, dfd, const char __user *, filename, int, flags,
umode_t, mode)
{
if (force_o_largefile())
flags |= O_LARGEFILE;
return do_sys_open(dfd, filename, flags, mode);
}
| 0
|
427,801
|
static void sev_flush_guest_memory(struct vcpu_svm *svm, void *va,
unsigned long len)
{
/*
* If hardware enforced cache coherency for encrypted mappings of the
* same physical page is supported, nothing to do.
*/
if (boot_cpu_has(X86_FEATURE_SME_COHERENT))
return;
/*
* If the VM Page Flush MSR is supported, use it to flush the page
* (using the page virtual address and the guest ASID).
*/
if (boot_cpu_has(X86_FEATURE_VM_PAGE_FLUSH)) {
struct kvm_sev_info *sev;
unsigned long va_start;
u64 start, stop;
/* Align start and stop to page boundaries. */
va_start = (unsigned long)va;
start = (u64)va_start & PAGE_MASK;
stop = PAGE_ALIGN((u64)va_start + len);
if (start < stop) {
sev = &to_kvm_svm(svm->vcpu.kvm)->sev_info;
while (start < stop) {
wrmsrl(MSR_AMD64_VM_PAGE_FLUSH,
start | sev->asid);
start += PAGE_SIZE;
}
return;
}
WARN(1, "Address overflow, using WBINVD\n");
}
/*
* Hardware should always have one of the above features,
* but if not, use WBINVD and issue a warning.
*/
WARN_ONCE(1, "Using WBINVD to flush guest memory\n");
wbinvd_on_all_cpus();
}
| 0
|
244,257
|
void segr_box_del(GF_Box *s)
{
u32 i;
FDSessionGroupBox *ptr = (FDSessionGroupBox *)s;
if (ptr == NULL) return;
for (i=0; i<ptr->num_session_groups; i++) {
if (ptr->session_groups[i].group_ids) gf_free(ptr->session_groups[i].group_ids);
if (ptr->session_groups[i].channels) gf_free(ptr->session_groups[i].channels);
}
if (ptr->session_groups) gf_free(ptr->session_groups);
gf_free(ptr);
}
| 0
|
226,014
|
GF_Box *mdia_box_new()
{
ISOM_DECL_BOX_ALLOC(GF_MediaBox, GF_ISOM_BOX_TYPE_MDIA);
return (GF_Box *)tmp;
}
| 0
|
261,739
|
size_t size() const override{
return _size;
}
| 0
|
221,682
|
void Socket::resetChunk() {
chunk_to_read = 0;
chunked_trailer = "";
ieof = false;
}
| 0
|
294,449
|
d_lite_rfc2822(VALUE self)
{
return strftimev("%a, %-d %b %Y %T %z", self, set_tmx);
}
| 0
|
512,462
|
Item *get_copy(THD *thd)
{ return get_item_copy<Item_ref_null_helper>(thd, this); }
| 0
|
391,630
|
int dlpar_sysfs_init(void)
{
int error;
dlpar_kobj = kobject_create_and_add(DLPAR_KOBJ_NAME,
&pci_slots_kset->kobj);
if (!dlpar_kobj)
return -EINVAL;
error = sysfs_create_group(dlpar_kobj, &dlpar_attr_group);
if (error)
kobject_put(dlpar_kobj);
return error;
}
| 0
|
272,352
|
generate_octet_string(cms_context *cms, SECItem *encoded, SECItem *original)
{
if (content_is_empty(original->data, original->len)) {
cms->log(cms, LOG_ERR, "content is empty, not encoding");
return -1;
}
if (SEC_ASN1EncodeItem(cms->arena, encoded, original,
SEC_OctetStringTemplate) == NULL)
cnreterr(-1, cms, "could not encode octet string");
return 0;
}
| 0
|
294,495
|
datetime_s_rfc3339(int argc, VALUE *argv, VALUE klass)
{
VALUE str, sg, opt;
rb_scan_args(argc, argv, "02:", &str, &sg, &opt);
if (!NIL_P(opt)) argc--;
switch (argc) {
case 0:
str = rb_str_new2("-4712-01-01T00:00:00+00:00");
case 1:
sg = INT2FIX(DEFAULT_SG);
}
{
int argc2 = 1;
VALUE argv2[2];
argv2[0] = str;
argv2[1] = opt;
if (!NIL_P(opt)) argc2++;
VALUE hash = date_s__rfc3339(argc2, argv2, klass);
return dt_new_by_frags(klass, hash, sg);
}
}
| 0
|
221,669
|
std::string Socket::getPeerIP() {
char res[INET_ADDRSTRLEN];
return inet_ntop(AF_INET,&peer_adr.sin_addr, res, sizeof(res));
}
| 0
|
286,721
|
SWTPM_NVRAM_GetDecryptedData(const encryptionkey *key,
unsigned char **decrypt_data,
uint32_t *decrypt_length,
const unsigned char *data,
uint32_t length,
uint16_t tag_encrypted_data,
uint16_t tag_data,
uint8_t hdrversion,
uint16_t tag_ivec,
uint16_t hdrflags,
uint16_t flag_256bitkey)
{
if (key && key->symkey.userKeyLength > 0) {
/* we assume the data are encrypted when there's a key given */
return SWTPM_NVRAM_DecryptData(key, decrypt_data, decrypt_length,
data, length, tag_encrypted_data,
hdrversion, tag_ivec, hdrflags,
flag_256bitkey);
}
return SWTPM_NVRAM_GetPlainData(decrypt_data, decrypt_length,
data, length, tag_data, hdrversion);
}
| 0
|
500,655
|
int sftp_closedir(sftp_dir dir){
int err = SSH_NO_ERROR;
SAFE_FREE(dir->name);
if (dir->handle) {
err = sftp_handle_close(dir->sftp, dir->handle);
ssh_string_free(dir->handle);
}
/* FIXME: check server response and implement errno */
ssh_buffer_free(dir->buffer);
SAFE_FREE(dir);
return err;
}
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.