idx
int64 | func
string | target
int64 |
|---|---|---|
389,682
|
tv_get_string_strict(typval_T *varp)
{
static char_u mybuf[NUMBUFLEN];
char_u *res = tv_get_string_buf_chk_strict(
varp, mybuf, in_vim9script());
return res != NULL ? res : (char_u *)"";
}
| 0
|
474,023
|
st_hash_start(st_index_t h)
{
return h;
}
| 0
|
430,390
|
static void update_range(struct sw_flow_match *match,
size_t offset, size_t size, bool is_mask)
{
struct sw_flow_key_range *range;
size_t start = rounddown(offset, sizeof(long));
size_t end = roundup(offset + size, sizeof(long));
if (!is_mask)
range = &match->range;
else
range = &match->mask->range;
if (range->start == range->end) {
range->start = start;
range->end = end;
return;
}
if (range->start > start)
range->start = start;
if (range->end < end)
range->end = end;
}
| 0
|
384,910
|
vim_isblankline(char_u *lbuf)
{
char_u *p;
p = skipwhite(lbuf);
return (*p == NUL || *p == '\r' || *p == '\n');
}
| 0
|
300,744
|
int tsk_set_importance(struct sock *sk, int imp)
{
if (imp > TIPC_CRITICAL_IMPORTANCE)
return -EINVAL;
msg_set_importance(&tipc_sk(sk)->phdr, (u32)imp);
return 0;
}
| 0
|
385,896
|
int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
struct inode *new_dir, struct dentry *new_dentry)
{
int error;
int is_dir = S_ISDIR(old_dentry->d_inode->i_mode);
const unsigned char *old_name;
if (old_dentry->d_inode == new_dentry->d_inode)
return 0;
error = may_delete(old_dir, old_dentry, is_dir);
if (error)
return error;
if (!new_dentry->d_inode)
error = may_create(new_dir, new_dentry);
else
error = may_delete(new_dir, new_dentry, is_dir);
if (error)
return error;
if (!old_dir->i_op->rename)
return -EPERM;
old_name = fsnotify_oldname_init(old_dentry->d_name.name);
if (is_dir)
error = vfs_rename_dir(old_dir,old_dentry,new_dir,new_dentry);
else
error = vfs_rename_other(old_dir,old_dentry,new_dir,new_dentry);
if (!error)
fsnotify_move(old_dir, new_dir, old_name, is_dir,
new_dentry->d_inode, old_dentry);
fsnotify_oldname_free(old_name);
return error;
}
| 0
|
359,412
|
DEFUN (show_ip_bgp_attr_info,
show_ip_bgp_attr_info_cmd,
"show ip bgp attribute-info",
SHOW_STR
IP_STR
BGP_STR
"List all bgp attribute information\n")
{
attr_show_all (vty);
return CMD_SUCCESS;
}
| 0
|
313,554
|
void rose_add_loopback_neigh(void)
{
struct rose_neigh *sn;
rose_loopback_neigh = kmalloc(sizeof(struct rose_neigh), GFP_KERNEL);
if (!rose_loopback_neigh)
return;
sn = rose_loopback_neigh;
sn->callsign = null_ax25_address;
sn->digipeat = NULL;
sn->ax25 = NULL;
sn->dev = NULL;
sn->count = 0;
sn->use = 0;
sn->dce_mode = 1;
sn->loopback = 1;
sn->number = rose_neigh_no++;
sn->restarted = 1;
skb_queue_head_init(&sn->queue);
timer_setup(&sn->ftimer, NULL, 0);
timer_setup(&sn->t0timer, NULL, 0);
spin_lock_bh(&rose_neigh_list_lock);
sn->next = rose_neigh_list;
rose_neigh_list = sn;
spin_unlock_bh(&rose_neigh_list_lock);
}
| 0
|
292,131
|
methodHandle LinkResolver::resolve_virtual_call_or_null(
Klass* receiver_klass,
const LinkInfo& link_info) {
EXCEPTION_MARK;
CallInfo info;
resolve_virtual_call(info, Handle(), receiver_klass, link_info, false, THREAD);
if (HAS_PENDING_EXCEPTION) {
CLEAR_PENDING_EXCEPTION;
return methodHandle();
}
return info.selected_method();
}
| 0
|
463,059
|
static void sungem_do_tx_csum(SunGEMState *s)
{
uint16_t start, off;
uint32_t csum;
start = (s->tx_first_ctl & TXDCTRL_CSTART) >> 15;
off = (s->tx_first_ctl & TXDCTRL_COFF) >> 21;
trace_sungem_tx_checksum(start, off);
if (start > (s->tx_size - 2) || off > (s->tx_size - 2)) {
trace_sungem_tx_checksum_oob();
return;
}
csum = net_raw_checksum(s->tx_data + start, s->tx_size - start);
stw_be_p(s->tx_data + off, csum);
}
| 0
|
226,265
|
void reftype_box_del(GF_Box *s)
{
GF_TrackReferenceTypeBox *ptr = (GF_TrackReferenceTypeBox *)s;
if (!ptr) return;
if (ptr->trackIDs) gf_free(ptr->trackIDs);
gf_free(ptr);
| 0
|
373,519
|
ipf_is_first_v4_frag(const struct dp_packet *pkt)
{
const struct ip_header *l3 = dp_packet_l3(pkt);
if (!(l3->ip_frag_off & htons(IP_FRAG_OFF_MASK)) &&
l3->ip_frag_off & htons(IP_MORE_FRAGMENTS)) {
return true;
}
return false;
}
| 0
|
489,161
|
static sctp_disposition_t __sctp_sf_do_9_1_abort(const struct sctp_endpoint *ep,
const struct sctp_association *asoc,
const sctp_subtype_t type,
void *arg,
sctp_cmd_seq_t *commands)
{
struct sctp_chunk *chunk = arg;
unsigned len;
__be16 error = SCTP_ERROR_NO_ERROR;
/* See if we have an error cause code in the chunk. */
len = ntohs(chunk->chunk_hdr->length);
if (len >= sizeof(struct sctp_chunkhdr) + sizeof(struct sctp_errhdr))
error = ((sctp_errhdr_t *)chunk->skb->data)->cause;
sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, SCTP_ERROR(ECONNRESET));
/* ASSOC_FAILED will DELETE_TCB. */
sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED, SCTP_PERR(error));
SCTP_INC_STATS(SCTP_MIB_ABORTEDS);
SCTP_DEC_STATS(SCTP_MIB_CURRESTAB);
return SCTP_DISPOSITION_ABORT;
}
| 0
|
294,394
|
get_limit(VALUE opt)
{
if (!NIL_P(opt)) {
VALUE limit = rb_hash_aref(opt, ID2SYM(rb_intern("limit")));
if (NIL_P(limit)) return SIZE_MAX;
return NUM2SIZET(limit);
}
return 128;
}
| 0
|
508,839
|
bool st_select_lex::save_prep_leaf_tables(THD *thd)
{
if (prep_leaf_list_state == SAVED)
return FALSE;
List_iterator_fast<TABLE_LIST> li(leaf_tables);
TABLE_LIST *table;
/*
Check that the SELECT_LEX was really prepared and so tables are setup.
It can be subquery in SET clause of UPDATE which was not prepared yet, so
its tables are not yet setup and ready for storing.
*/
if (prep_leaf_list_state != READY)
return FALSE;
while ((table= li++))
{
if (leaf_tables_prep.push_back(table))
return TRUE;
}
prep_leaf_list_state= SAVED;
for (SELECT_LEX_UNIT *u= first_inner_unit(); u; u= u->next_unit())
{
for (SELECT_LEX *sl= u->first_select(); sl; sl= sl->next_select())
{
if (sl->save_prep_leaf_tables(thd))
return TRUE;
}
}
return FALSE;
}
| 0
|
291,836
|
static void rtrs_clt_stop_and_destroy_conns(struct rtrs_clt_path *clt_path)
{
struct rtrs_clt_con *con;
unsigned int cid;
WARN_ON(READ_ONCE(clt_path->state) == RTRS_CLT_CONNECTED);
/*
* Possible race with rtrs_clt_open(), when DEVICE_REMOVAL comes
* exactly in between. Start destroying after it finishes.
*/
mutex_lock(&clt_path->init_mutex);
mutex_unlock(&clt_path->init_mutex);
/*
* All IO paths must observe !CONNECTED state before we
* free everything.
*/
synchronize_rcu();
rtrs_stop_hb(&clt_path->s);
/*
* The order it utterly crucial: firstly disconnect and complete all
* rdma requests with error (thus set in_use=false for requests),
* then fail outstanding requests checking in_use for each, and
* eventually notify upper layer about session disconnection.
*/
for (cid = 0; cid < clt_path->s.con_num; cid++) {
if (!clt_path->s.con[cid])
break;
con = to_clt_con(clt_path->s.con[cid]);
stop_cm(con);
}
fail_all_outstanding_reqs(clt_path);
free_path_reqs(clt_path);
rtrs_clt_path_down(clt_path);
/*
* Wait for graceful shutdown, namely when peer side invokes
* rdma_disconnect(). 'connected_cnt' is decremented only on
* CM events, thus if other side had crashed and hb has detected
* something is wrong, here we will stuck for exactly timeout ms,
* since CM does not fire anything. That is fine, we are not in
* hurry.
*/
wait_event_timeout(clt_path->state_wq,
!atomic_read(&clt_path->connected_cnt),
msecs_to_jiffies(RTRS_CONNECT_TIMEOUT_MS));
for (cid = 0; cid < clt_path->s.con_num; cid++) {
if (!clt_path->s.con[cid])
break;
con = to_clt_con(clt_path->s.con[cid]);
mutex_lock(&con->con_mutex);
destroy_con_cq_qp(con);
mutex_unlock(&con->con_mutex);
destroy_cm(con);
destroy_con(con);
}
}
| 0
|
400,102
|
int PipeSocketHandler::connect(const SocketEndpoint& endpoint) {
lock_guard<std::recursive_mutex> mutexGuard(globalMutex);
string pipePath = endpoint.name();
sockaddr_un remote;
int sockFd = ::socket(AF_UNIX, SOCK_STREAM, 0);
FATAL_FAIL(sockFd);
initSocket(sockFd);
remote.sun_family = AF_UNIX;
strncpy(remote.sun_path, pipePath.c_str(), sizeof(remote.sun_path));
VLOG(3) << "Connecting to " << endpoint << " with fd " << sockFd;
int result =
::connect(sockFd, (struct sockaddr*)&remote, sizeof(sockaddr_un));
auto localErrno = GetErrno();
if (result < 0 && localErrno != EINPROGRESS) {
VLOG(3) << "Connection result: " << result << " (" << strerror(localErrno)
<< ")";
#ifdef WIN32
::shutdown(sockFd, SD_BOTH);
#else
::shutdown(sockFd, SHUT_RDWR);
#endif
#ifdef _MSC_VER
FATAL_FAIL(::closesocket(sockFd));
#else
FATAL_FAIL(::close(sockFd));
#endif
sockFd = -1;
SetErrno(localErrno);
return sockFd;
}
fd_set fdset;
FD_ZERO(&fdset);
FD_SET(sockFd, &fdset);
timeval tv;
tv.tv_sec = 3; /* 3 second timeout */
tv.tv_usec = 0;
VLOG(4) << "Before selecting sockFd";
select(sockFd + 1, NULL, &fdset, NULL, &tv);
if (FD_ISSET(sockFd, &fdset)) {
VLOG(4) << "sockFd " << sockFd << " is selected";
int so_error;
socklen_t len = sizeof so_error;
FATAL_FAIL(
::getsockopt(sockFd, SOL_SOCKET, SO_ERROR, (char*)&so_error, &len));
if (so_error == 0) {
LOG(INFO) << "Connected to endpoint " << endpoint;
// Initialize the socket again once it's blocking to make sure timeouts
// are set
initSocket(sockFd);
// if we get here, we must have connected successfully
} else {
LOG(INFO) << "Error connecting to " << endpoint << ": " << so_error << " "
<< strerror(so_error);
#ifdef _MSC_VER
FATAL_FAIL(::closesocket(sockFd));
#else
FATAL_FAIL(::close(sockFd));
#endif
sockFd = -1;
}
} else {
auto localErrno = GetErrno();
LOG(INFO) << "Error connecting to " << endpoint << ": " << localErrno << " "
<< strerror(localErrno);
#ifdef _MSC_VER
FATAL_FAIL(::closesocket(sockFd));
#else
FATAL_FAIL(::close(sockFd));
#endif
sockFd = -1;
}
LOG(INFO) << sockFd << " is a good socket";
if (sockFd >= 0) {
addToActiveSockets(sockFd);
}
return sockFd;
}
| 0
|
508,806
|
bool st_select_lex::is_merged_child_of(st_select_lex *ancestor)
{
bool all_merged= TRUE;
for (SELECT_LEX *sl= this; sl && sl!=ancestor;
sl=sl->outer_select())
{
Item *subs= sl->master_unit()->item;
if (subs && subs->type() == Item::SUBSELECT_ITEM &&
((Item_subselect*)subs)->substype() == Item_subselect::IN_SUBS &&
((Item_in_subselect*)subs)->test_strategy(SUBS_SEMI_JOIN))
{
continue;
}
if (sl->master_unit()->derived &&
sl->master_unit()->derived->is_merged_derived())
{
continue;
}
all_merged= FALSE;
break;
}
return all_merged;
}
| 0
|
513,175
|
static size_t var_storage_size(int flags)
{
switch (flags & PLUGIN_VAR_TYPEMASK) {
case PLUGIN_VAR_BOOL: return sizeof(my_bool);
case PLUGIN_VAR_INT: return sizeof(int);
case PLUGIN_VAR_LONG: return sizeof(long);
case PLUGIN_VAR_ENUM: return sizeof(long);
case PLUGIN_VAR_LONGLONG: return sizeof(ulonglong);
case PLUGIN_VAR_SET: return sizeof(ulonglong);
case PLUGIN_VAR_STR: return sizeof(char*);
case PLUGIN_VAR_DOUBLE: return sizeof(double);
default: DBUG_ASSERT(0); return 0;
}
}
| 0
|
376,324
|
gpg_ctx_get_executable_name (void)
{
static gint index = -1;
const gchar *names[] = {
"gpg",
"gpg2",
NULL
};
if (index == -1) {
for (index = 0; names[index]; index++) {
gchar *path = g_find_program_in_path (names[index]);
if (path) {
g_free (path);
break;
}
}
if (!names[index])
index = 0;
}
return names[index];
}
| 0
|
253,563
|
void close_cached_dir_lease(struct cached_fid *cfid)
{
mutex_lock(&cfid->fid_mutex);
close_cached_dir_lease_locked(cfid);
mutex_unlock(&cfid->fid_mutex);
}
| 0
|
254,071
|
inline char * qs_k2v(const char * key, char * const * qs_kv, int qs_kv_size, int nth = 0)
{
int i;
size_t key_len, skip;
key_len = strlen(key);
#ifdef _qsSORTING
// TODO: binary search for key in the sorted qs_kv
#else // _qsSORTING
for(i=0; i<qs_kv_size; i++)
{
// we rely on the unambiguous '=' to find the value in our k/v pair
if ( qs_strncmp(key, qs_kv[i], key_len) == 0 )
{
skip = strcspn(qs_kv[i], "=");
if ( qs_kv[i][skip] == '=' )
skip++;
// return (zero-char value) ? ptr to trailing '\0' : ptr to value
if(nth == 0)
return qs_kv[i] + skip;
else
--nth;
}
}
#endif // _qsSORTING
return nullptr;
}
| 0
|
432,218
|
void *cpu_physical_memory_map(AddressSpace *as, hwaddr addr,
hwaddr *plen,
bool is_write)
{
return address_space_map(as, addr, plen, is_write,
MEMTXATTRS_UNSPECIFIED);
}
| 0
|
512,651
|
Item *get_copy(THD *thd)
{ return get_item_copy<Item_cache_int>(thd, this); }
| 0
|
438,655
|
static int rpmsg_remove_device(struct device *dev, void *data)
{
device_unregister(dev);
return 0;
}
| 0
|
395,077
|
update_prepare(void)
{
cursor_off();
updating_screen = TRUE;
#ifdef FEAT_GUI
// Remove the cursor before starting to do anything, because scrolling may
// make it difficult to redraw the text under it.
if (gui.in_use)
gui_undraw_cursor();
#endif
#ifdef FEAT_SEARCH_EXTRA
start_search_hl();
#endif
#ifdef FEAT_PROP_POPUP
// Update popup_mask if needed.
may_update_popup_mask(must_redraw);
#endif
}
| 0
|
477,356
|
R_API char *r_bin_java_print_methodtype_cp_stringify(RBinJavaCPTypeObj *obj) {
ut32 size = 255, consumed = 0;
char *value = malloc (size);
if (value) {
memset (value, 0, size);
consumed = snprintf (value, size, "%d.0x%04"PFMT64x ".%s.%d",
obj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,
obj->info.cp_method_type.descriptor_index);
if (consumed >= size - 1) {
free (value);
size += size >> 1;
value = malloc (size);
if (value) {
memset (value, 0, size);
(void)snprintf (value, size, "%d.0x%04"PFMT64x ".%s.%d",
obj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,
obj->info.cp_method_type.descriptor_index);
}
}
}
return value;
}
| 0
|
208,370
|
bracketed_paste(paste_mode_T mode, int drop, garray_T *gap)
{
int c;
char_u buf[NUMBUFLEN + MB_MAXBYTES];
int idx = 0;
char_u *end = find_termcode((char_u *)"PE");
int ret_char = -1;
int save_allow_keys = allow_keys;
int save_paste = p_paste;
// If the end code is too long we can't detect it, read everything.
if (end != NULL && STRLEN(end) >= NUMBUFLEN)
end = NULL;
++no_mapping;
allow_keys = 0;
if (!p_paste)
// Also have the side effects of setting 'paste' to make it work much
// faster.
set_option_value((char_u *)"paste", TRUE, NULL, 0);
for (;;)
{
// When the end is not defined read everything there is.
if (end == NULL && vpeekc() == NUL)
break;
do
c = vgetc();
while (c == K_IGNORE || c == K_VER_SCROLLBAR || c == K_HOR_SCROLLBAR);
if (c == NUL || got_int || (ex_normal_busy > 0 && c == Ctrl_C))
// When CTRL-C was encountered the typeahead will be flushed and we
// won't get the end sequence. Except when using ":normal".
break;
if (has_mbyte)
idx += (*mb_char2bytes)(c, buf + idx);
else
buf[idx++] = c;
buf[idx] = NUL;
if (end != NULL && STRNCMP(buf, end, idx) == 0)
{
if (end[idx] == NUL)
break; // Found the end of paste code.
continue;
}
if (!drop)
{
switch (mode)
{
case PASTE_CMDLINE:
put_on_cmdline(buf, idx, TRUE);
break;
case PASTE_EX:
if (gap != NULL && ga_grow(gap, idx) == OK)
{
mch_memmove((char *)gap->ga_data + gap->ga_len,
buf, (size_t)idx);
gap->ga_len += idx;
}
break;
case PASTE_INSERT:
if (stop_arrow() == OK)
{
c = buf[0];
if (idx == 1 && (c == CAR || c == K_KENTER || c == NL))
ins_eol(c);
else
{
ins_char_bytes(buf, idx);
AppendToRedobuffLit(buf, idx);
}
}
break;
case PASTE_ONE_CHAR:
if (ret_char == -1)
{
if (has_mbyte)
ret_char = (*mb_ptr2char)(buf);
else
ret_char = buf[0];
}
break;
}
}
idx = 0;
}
--no_mapping;
allow_keys = save_allow_keys;
if (!save_paste)
set_option_value((char_u *)"paste", FALSE, NULL, 0);
return ret_char;
}
| 1
|
224,492
|
static void gf_webvtt_flush_sample(void *user, GF_WebVTTSample *samp)
{
u64 start, end;
GF_TXTIn *ctx = (GF_TXTIn *)user;
GF_ISOSample *s;
start = gf_webvtt_sample_get_start(samp);
end = gf_webvtt_sample_get_end(samp);
if (ctx->seek_state==2) {
Double tsend = (Double) end;
tsend /= 1000;
if (tsend<ctx->start_range) return;
ctx->seek_state = 0;
}
s = gf_isom_webvtt_to_sample(samp);
if (s) {
GF_FilterPacket *pck;
u8 *pck_data;
pck = gf_filter_pck_new_alloc(ctx->opid, s->dataLength, &pck_data);
if (pck) {
memcpy(pck_data, s->data, s->dataLength);
gf_filter_pck_set_cts(pck, (u64) (ctx->timescale * start / 1000) );
gf_filter_pck_set_sap(pck, GF_FILTER_SAP_1);
if (end && (end>=start) ) {
gf_filter_pck_set_duration(pck, (u32) (ctx->timescale * (end-start) / 1000) );
}
gf_filter_pck_send(pck);
}
gf_isom_sample_del(&s);
}
gf_webvtt_sample_del(samp);
gf_filter_pid_set_info(ctx->opid, GF_PROP_PID_DOWN_BYTES, &PROP_LONGUINT( gf_ftell(ctx->src )) );
if (gf_filter_pid_would_block(ctx->opid))
gf_webvtt_parser_suspend(ctx->vttparser);
}
| 0
|
242,611
|
explicit UnstageOp(OpKernelConstruction* ctx) : OpKernel(ctx) {}
| 0
|
474,078
|
strhash(st_data_t arg)
{
register const char *string = (const char *)arg;
register st_index_t hval = FNV1_32A_INIT;
/*
* FNV-1a hash each octet in the buffer
*/
while (*string) {
/* xor the bottom with the current octet */
hval ^= (unsigned int)*string++;
/* multiply by the 32 bit FNV magic prime mod 2^32 */
hval *= FNV_32_PRIME;
}
return hval;
}
| 0
|
244,131
|
GF_Err subs_box_read(GF_Box *s, GF_BitStream *bs)
{
GF_SubSampleInformationBox *ptr = (GF_SubSampleInformationBox *)s;
u32 entry_count, i, j;
u16 subsample_count;
ISOM_DECREASE_SIZE(ptr, 4);
entry_count = gf_bs_read_u32(bs);
for (i=0; i<entry_count; i++) {
u32 subs_size=0;
GF_SubSampleInfoEntry *pSamp = (GF_SubSampleInfoEntry*) gf_malloc(sizeof(GF_SubSampleInfoEntry));
if (!pSamp) return GF_OUT_OF_MEM;
memset(pSamp, 0, sizeof(GF_SubSampleInfoEntry));
pSamp->SubSamples = gf_list_new();
pSamp->sample_delta = gf_bs_read_u32(bs);
subsample_count = gf_bs_read_u16(bs);
subs_size=6;
for (j=0; j<subsample_count; j++) {
GF_SubSampleEntry *pSubSamp = (GF_SubSampleEntry*) gf_malloc(sizeof(GF_SubSampleEntry));
if (!pSubSamp) return GF_OUT_OF_MEM;
memset(pSubSamp, 0, sizeof(GF_SubSampleEntry));
if (ptr->version==1) {
pSubSamp->subsample_size = gf_bs_read_u32(bs);
subs_size+=4;
} else {
pSubSamp->subsample_size = gf_bs_read_u16(bs);
subs_size+=2;
}
pSubSamp->subsample_priority = gf_bs_read_u8(bs);
pSubSamp->discardable = gf_bs_read_u8(bs);
pSubSamp->reserved = gf_bs_read_u32(bs);
subs_size+=6;
gf_list_add(pSamp->SubSamples, pSubSamp);
}
gf_list_add(ptr->Samples, pSamp);
ISOM_DECREASE_SIZE(ptr, subs_size);
}
return GF_OK;
}
| 0
|
244,032
|
GF_Err mhac_box_size(GF_Box *s)
{
GF_MHAConfigBox *ptr = (GF_MHAConfigBox *) s;
s->size += 5;
if (ptr->mha_config_size && ptr->mha_config) s->size += ptr->mha_config_size;
return GF_OK;
}
| 0
|
513,001
|
Item *Item_func_eq::negated_item(THD *thd) /* a = b -> a != b */
{
return new (thd->mem_root) Item_func_ne(thd, args[0], args[1]);
}
| 0
|
486,831
|
static inline unsigned rx_desc_get_wrap(uint32_t *desc)
{
return desc[0] & DESC_0_RX_WRAP ? 1 : 0;
}
| 0
|
393,501
|
static SQInteger table_map(HSQUIRRELVM v)
{
SQObject &o = stack_get(v, 1);
SQTable *tbl = _table(o);
SQInteger nitr, n = 0;
SQInteger nitems = tbl->CountUsed();
SQObjectPtr ret = SQArray::Create(_ss(v), nitems);
SQObjectPtr itr, key, val;
while ((nitr = tbl->Next(false, itr, key, val)) != -1) {
itr = (SQInteger)nitr;
v->Push(o);
v->Push(key);
v->Push(val);
if (SQ_FAILED(sq_call(v, 3, SQTrue, SQFalse))) {
return SQ_ERROR;
}
_array(ret)->Set(n, v->GetUp(-1));
v->Pop();
n++;
}
v->Push(ret);
return 1;
}
| 0
|
286,724
|
TPM_RESULT SWTPM_NVRAM_Init(void)
{
const char *backend_uri;
TPM_RESULT rc = 0;
TPM_DEBUG(" SWTPM_NVRAM_Init:\n");
backend_uri = tpmstate_get_backend_uri();
if (!backend_uri) {
logprintf(STDERR_FILENO,
"SWTPM_NVRAM_Init: Missing backend URI.\n");
rc = TPM_FAIL;
} else if (strncmp(backend_uri, "dir://", 6) == 0) {
g_nvram_backend_ops = &nvram_dir_ops;
} else if (strncmp(backend_uri, "file://", 7) == 0) {
g_nvram_backend_ops = &nvram_linear_ops;
} else {
logprintf(STDERR_FILENO,
"SWTPM_NVRAM_Init: Unsupported backend.\n");
rc = TPM_FAIL;
}
if (rc == 0)
rc = g_nvram_backend_ops->prepare(backend_uri);
return rc;
}
| 0
|
218,748
|
static MagickBooleanType CheckPSDChannels(const Image *image,
const PSDInfo *psd_info,LayerInfo *layer_info)
{
int
channel_type;
size_t
blob_size;
ssize_t
i;
if (layer_info->channels < psd_info->min_channels)
return(MagickFalse);
channel_type=RedChannel;
if (psd_info->min_channels >= 3)
channel_type|=(GreenChannel | BlueChannel);
if (psd_info->min_channels >= 4)
channel_type|=BlackChannel;
blob_size=(size_t) GetBlobSize(image);
for (i=0; i < (ssize_t) layer_info->channels; i++)
{
short
type;
if (layer_info->channel_info[i].size >= blob_size)
return(MagickFalse);
type=layer_info->channel_info[i].type;
if ((i == 0) && (psd_info->mode == IndexedMode) && (type != 0))
return(MagickFalse);
if (type == -1)
{
channel_type|=AlphaChannel;
continue;
}
if (type < -1)
continue;
if (type == 0)
channel_type&=~RedChannel;
else if (type == 1)
channel_type&=~GreenChannel;
else if (type == 2)
channel_type&=~BlueChannel;
else if (type == 3)
channel_type&=~BlackChannel;
}
if (channel_type == 0)
return(MagickTrue);
if ((channel_type == AlphaChannel) &&
(layer_info->channels >= psd_info->min_channels + 1))
return(MagickTrue);
return(MagickFalse);
}
| 0
|
225,968
|
GF_Err proj_type_box_write(GF_Box *s, GF_BitStream *bs)
{
GF_Err e;
GF_ProjectionTypeBox *ptr = (GF_ProjectionTypeBox *)s;
e = gf_isom_full_box_write(s, bs);
if (e) return e;
if (ptr->type==GF_ISOM_BOX_TYPE_CBMP) {
gf_bs_write_u32(bs, ptr->layout);
gf_bs_write_u32(bs, ptr->padding);
}
else if (ptr->type==GF_ISOM_BOX_TYPE_EQUI) {
gf_bs_write_u32(bs, ptr->bounds_top);
gf_bs_write_u32(bs, ptr->bounds_bottom);
gf_bs_write_u32(bs, ptr->bounds_left);
gf_bs_write_u32(bs, ptr->bounds_right);
} else {
gf_bs_write_u32(bs, ptr->crc);
gf_bs_write_u32(bs, ptr->encoding_4cc);
}
return GF_OK;
| 0
|
231,024
|
static UBaseType_t prvGetDisinheritPriorityAfterTimeout( const Queue_t * const pxQueue )
{
UBaseType_t uxHighestPriorityOfWaitingTasks;
/* If a task waiting for a mutex causes the mutex holder to inherit a
* priority, but the waiting task times out, then the holder should
* disinherit the priority - but only down to the highest priority of any
* other tasks that are waiting for the same mutex. For this purpose,
* return the priority of the highest priority task that is waiting for the
* mutex. */
if( listCURRENT_LIST_LENGTH( &( pxQueue->xTasksWaitingToReceive ) ) > 0U )
{
uxHighestPriorityOfWaitingTasks = ( UBaseType_t ) configMAX_PRIORITIES - ( UBaseType_t ) listGET_ITEM_VALUE_OF_HEAD_ENTRY( &( pxQueue->xTasksWaitingToReceive ) );
}
else
{
uxHighestPriorityOfWaitingTasks = tskIDLE_PRIORITY;
}
return uxHighestPriorityOfWaitingTasks;
}
| 0
|
226,432
|
const std::vector<PartialTensorShape>& output_shapes() const override {
return shapes_;
}
| 0
|
398,509
|
RZ_API const char *rz_bin_dwarf_get_tag_name(ut64 tag) {
if (tag >= DW_TAG_LAST) {
return NULL;
}
return dwarf_tag_name_encodings[tag];
}
| 0
|
486,812
|
static inline uint32_t gem_get_tx_queue_base_addr(CadenceGEMState *s, int q)
{
return gem_get_queue_base_addr(s, true, q);
}
| 0
|
405,380
|
int xfrm_migrate(const struct xfrm_selector *sel, u8 dir, u8 type,
struct xfrm_migrate *m, int num_migrate,
struct xfrm_kmaddress *k, struct net *net,
struct xfrm_encap_tmpl *encap, u32 if_id)
{
int i, err, nx_cur = 0, nx_new = 0;
struct xfrm_policy *pol = NULL;
struct xfrm_state *x, *xc;
struct xfrm_state *x_cur[XFRM_MAX_DEPTH];
struct xfrm_state *x_new[XFRM_MAX_DEPTH];
struct xfrm_migrate *mp;
/* Stage 0 - sanity checks */
if ((err = xfrm_migrate_check(m, num_migrate)) < 0)
goto out;
if (dir >= XFRM_POLICY_MAX) {
err = -EINVAL;
goto out;
}
/* Stage 1 - find policy */
if ((pol = xfrm_migrate_policy_find(sel, dir, type, net, if_id)) == NULL) {
err = -ENOENT;
goto out;
}
/* Stage 2 - find and update state(s) */
for (i = 0, mp = m; i < num_migrate; i++, mp++) {
if ((x = xfrm_migrate_state_find(mp, net, if_id))) {
x_cur[nx_cur] = x;
nx_cur++;
xc = xfrm_state_migrate(x, mp, encap);
if (xc) {
x_new[nx_new] = xc;
nx_new++;
} else {
err = -ENODATA;
goto restore_state;
}
}
}
/* Stage 3 - update policy */
if ((err = xfrm_policy_migrate(pol, m, num_migrate)) < 0)
goto restore_state;
/* Stage 4 - delete old state(s) */
if (nx_cur) {
xfrm_states_put(x_cur, nx_cur);
xfrm_states_delete(x_cur, nx_cur);
}
/* Stage 5 - announce */
km_migrate(sel, dir, type, m, num_migrate, k, encap);
xfrm_pol_put(pol);
return 0;
out:
return err;
restore_state:
if (pol)
xfrm_pol_put(pol);
if (nx_cur)
xfrm_states_put(x_cur, nx_cur);
if (nx_new)
xfrm_states_delete(x_new, nx_new);
return err;
}
| 0
|
459,204
|
static void tcf_block_flush_all_chains(struct tcf_block *block, bool rtnl_held)
{
struct tcf_chain *chain;
/* Last reference to block. At this point chains cannot be added or
* removed concurrently.
*/
for (chain = tcf_get_next_chain(block, NULL);
chain;
chain = tcf_get_next_chain(block, chain)) {
tcf_chain_put_explicitly_created(chain);
tcf_chain_flush(chain, rtnl_held);
}
}
| 0
|
450,353
|
static int send_sub_rect_nojpeg(VncState *vs, int x, int y, int w, int h,
int bg, int fg, int colors, VncPalette *palette)
{
int ret;
if (colors == 0) {
if (tight_detect_smooth_image(vs, w, h)) {
ret = send_gradient_rect(vs, x, y, w, h);
} else {
ret = send_full_color_rect(vs, x, y, w, h);
}
} else if (colors == 1) {
ret = send_solid_rect(vs);
} else if (colors == 2) {
ret = send_mono_rect(vs, x, y, w, h, bg, fg);
} else if (colors <= 256) {
ret = send_palette_rect(vs, x, y, w, h, palette);
} else {
ret = 0;
}
return ret;
}
| 0
|
90,121
|
virtual void ConnectToWifiNetwork(ConnectionSecurity security,
const std::string& ssid,
const std::string& password,
const std::string& identity,
const std::string& certpath,
bool auto_connect) {}
| 0
|
459,208
|
struct tcf_chain *tcf_chain_get_by_act(struct tcf_block *block, u32 chain_index)
{
return __tcf_chain_get(block, chain_index, true, true);
}
| 0
|
229,169
|
static void handle_input(VirtIODevice *vdev, VirtQueue *vq)
{
/*
* Users of virtio-serial would like to know when guest becomes
* writable again -- i.e. if a vq had stuff queued up and the
* guest wasn't reading at all, the host would not be able to
* write to the vq anymore. Once the guest reads off something,
* we can start queueing things up again. However, this call is
* made for each buffer addition by the guest -- even though free
* buffers existed prior to the current buffer addition. This is
* done so as not to maintain previous state, which will need
* additional live-migration-related changes.
*/
VirtIOSerial *vser;
VirtIOSerialPort *port;
VirtIOSerialPortClass *vsc;
vser = VIRTIO_SERIAL(vdev);
port = find_port_by_vq(vser, vq);
if (!port) {
return;
}
vsc = VIRTIO_SERIAL_PORT_GET_CLASS(port);
/*
* If guest_connected is false, this call is being made by the
* early-boot queueing up of descriptors, which is just noise for
* the host apps -- don't disturb them in that case.
*/
if (port->guest_connected && port->host_connected && vsc->guest_writable) {
vsc->guest_writable(port);
}
}
| 0
|
230,387
|
PJ_DEF(pj_xml_node*) pj_xml_find_node(const pj_xml_node *parent,
const pj_str_t *name)
{
const pj_xml_node *node = parent->node_head.next;
PJ_CHECK_STACK();
while (node != (void*)&parent->node_head) {
if (pj_stricmp(&node->name, name) == 0)
return (pj_xml_node*)node;
node = node->next;
}
return NULL;
}
| 0
|
264,654
|
GF_Err BM_ParseIndexDelete(GF_BifsDecoder *codec, GF_BitStream *bs, GF_List *com_list)
{
u32 NodeID, NumBits, ind, field_ind;
s32 pos;
GF_Command *com;
u8 type;
GF_Node *node;
GF_Err e;
GF_CommandField *inf;
GF_FieldInfo field;
NodeID = 1 + gf_bs_read_int(bs, codec->info->config.NodeIDBits);
node = gf_sg_find_node(codec->current_graph, NodeID);
if (!node) return GF_NON_COMPLIANT_BITSTREAM;
NumBits = gf_get_bit_size(gf_node_get_num_fields_in_mode(node, GF_SG_FIELD_CODING_IN) - 1);
ind = gf_bs_read_int(bs, NumBits);
type = gf_bs_read_int(bs, 2);
switch (type) {
case 0:
pos = (u32) gf_bs_read_int(bs, 16);
break;
case 2:
pos = 0;
break;
case 3:
pos = -1;
break;
default:
return GF_NON_COMPLIANT_BITSTREAM;
}
e = gf_bifs_get_field_index(node, ind, GF_SG_FIELD_CODING_IN, &field_ind);
if (e) return e;
e = gf_node_get_field(node, field_ind, &field);
if (e) return e;
if (gf_sg_vrml_is_sf_field(field.fieldType)) return GF_NON_COMPLIANT_BITSTREAM;
com = gf_sg_command_new(codec->current_graph, GF_SG_INDEXED_DELETE);
BM_SetCommandNode(com, node);
inf = gf_sg_command_field_new(com);
inf->pos = pos;
inf->fieldIndex = field.fieldIndex;
inf->fieldType = gf_sg_vrml_get_sf_type(field.fieldType);
gf_list_add(com_list, com);
return codec->LastError;
}
| 0
|
308,198
|
static void fastrpc_notify_users(struct fastrpc_user *user)
{
struct fastrpc_invoke_ctx *ctx;
spin_lock(&user->lock);
list_for_each_entry(ctx, &user->pending, node)
complete(&ctx->work);
spin_unlock(&user->lock);
}
| 0
|
512,784
|
Item_direct_ref_to_ident(THD *thd, Item_ident *item):
Item_direct_ref(thd, item->context, (Item**)&item, item->table_name,
&item->field_name, FALSE)
{
ident= item;
ref= (Item**)&ident;
}
| 0
|
210,814
|
ins_compl_add(
char_u *str,
int len,
char_u *fname,
char_u **cptext, // extra text for popup menu or NULL
typval_T *user_data UNUSED, // "user_data" entry or NULL
int cdir,
int flags_arg,
int adup) // accept duplicate match
{
compl_T *match;
int dir = (cdir == 0 ? compl_direction : cdir);
int flags = flags_arg;
if (flags & CP_FAST)
fast_breakcheck();
else
ui_breakcheck();
if (got_int)
return FAIL;
if (len < 0)
len = (int)STRLEN(str);
// If the same match is already present, don't add it.
if (compl_first_match != NULL && !adup)
{
match = compl_first_match;
do
{
if (!match_at_original_text(match)
&& STRNCMP(match->cp_str, str, len) == 0
&& match->cp_str[len] == NUL)
return NOTDONE;
match = match->cp_next;
} while (match != NULL && !is_first_match(match));
}
// Remove any popup menu before changing the list of matches.
ins_compl_del_pum();
// Allocate a new match structure.
// Copy the values to the new match structure.
match = ALLOC_CLEAR_ONE(compl_T);
if (match == NULL)
return FAIL;
match->cp_number = -1;
if (flags & CP_ORIGINAL_TEXT)
match->cp_number = 0;
if ((match->cp_str = vim_strnsave(str, len)) == NULL)
{
vim_free(match);
return FAIL;
}
// match-fname is:
// - compl_curr_match->cp_fname if it is a string equal to fname.
// - a copy of fname, CP_FREE_FNAME is set to free later THE allocated mem.
// - NULL otherwise. --Acevedo
if (fname != NULL
&& compl_curr_match != NULL
&& compl_curr_match->cp_fname != NULL
&& STRCMP(fname, compl_curr_match->cp_fname) == 0)
match->cp_fname = compl_curr_match->cp_fname;
else if (fname != NULL)
{
match->cp_fname = vim_strsave(fname);
flags |= CP_FREE_FNAME;
}
else
match->cp_fname = NULL;
match->cp_flags = flags;
if (cptext != NULL)
{
int i;
for (i = 0; i < CPT_COUNT; ++i)
if (cptext[i] != NULL && *cptext[i] != NUL)
match->cp_text[i] = vim_strsave(cptext[i]);
}
#ifdef FEAT_EVAL
if (user_data != NULL)
match->cp_user_data = *user_data;
#endif
// Link the new match structure after (FORWARD) or before (BACKWARD) the
// current match in the list of matches .
if (compl_first_match == NULL)
match->cp_next = match->cp_prev = NULL;
else if (dir == FORWARD)
{
match->cp_next = compl_curr_match->cp_next;
match->cp_prev = compl_curr_match;
}
else // BACKWARD
{
match->cp_next = compl_curr_match;
match->cp_prev = compl_curr_match->cp_prev;
}
if (match->cp_next)
match->cp_next->cp_prev = match;
if (match->cp_prev)
match->cp_prev->cp_next = match;
else // if there's nothing before, it is the first match
compl_first_match = match;
compl_curr_match = match;
// Find the longest common string if still doing that.
if (compl_get_longest && (flags & CP_ORIGINAL_TEXT) == 0)
ins_compl_longest_match(match);
return OK;
}
| 1
|
281,057
|
static bool xfrm_policy_mark_match(struct xfrm_policy *policy,
struct xfrm_policy *pol)
{
u32 mark = policy->mark.v & policy->mark.m;
if (policy->mark.v == pol->mark.v && policy->mark.m == pol->mark.m)
return true;
if ((mark & pol->mark.m) == pol->mark.v &&
policy->priority == pol->priority)
return true;
return false;
}
| 0
|
369,187
|
static inline unsigned int io_put_kbuf_comp(struct io_kiocb *req)
{
lockdep_assert_held(&req->ctx->completion_lock);
if (likely(!(req->flags & REQ_F_BUFFER_SELECTED)))
return 0;
return __io_put_kbuf(req, &req->ctx->io_buffers_comp);
}
| 0
|
439,145
|
ModuleExport size_t RegisterIPLImage(void)
{
MagickInfo
*entry;
entry=SetMagickInfo("IPL");
entry->decoder=(DecodeImageHandler *) ReadIPLImage;
entry->encoder=(EncodeImageHandler *) WriteIPLImage;
entry->magick=(IsImageFormatHandler *) IsIPL;
entry->adjoin=MagickTrue;
entry->description=ConstantString("IPL Image Sequence");
entry->module=ConstantString("IPL");
entry->endian_support=MagickTrue;
entry->seekable_stream=MagickTrue;
(void) RegisterMagickInfo(entry);
return(MagickImageCoderSignature);
}
| 0
|
369,160
|
static int io_sync_file_range(struct io_kiocb *req, unsigned int issue_flags)
{
int ret;
/* sync_file_range always requires a blocking context */
if (issue_flags & IO_URING_F_NONBLOCK)
return -EAGAIN;
ret = sync_file_range(req->file, req->sync.off, req->sync.len,
req->sync.flags);
if (ret < 0)
req_set_fail(req);
io_req_complete(req, ret);
return 0;
}
| 0
|
238,777
|
last_csearch(void)
{
return lastc_bytes;
}
| 0
|
242,121
|
int LuaSettings::l_set(lua_State* L)
{
NO_MAP_LOCK_REQUIRED;
LuaSettings* o = checkobject(L, 1);
std::string key = std::string(luaL_checkstring(L, 2));
const char* value = luaL_checkstring(L, 3);
CHECK_SETTING_SECURITY(L, key);
if (!o->m_settings->set(key, value))
throw LuaError("Invalid sequence found in setting parameters");
return 0;
}
| 0
|
276,955
|
SampleEncrypter::EncryptVideoSample(AP4_DataBuffer& sample, AP4_UI08 nalu_length_size)
{
AP4_DataBuffer encrypted;
AP4_UI08* nalu = sample.UseData();
AP4_Size bytes_remaining = sample.GetDataSize();
while (bytes_remaining > nalu_length_size) {
AP4_Size nalu_length = 0;
switch (nalu_length_size) {
case 1:
nalu_length = nalu[0];
break;
case 2:
nalu_length = AP4_BytesToUInt16BE(nalu);
break;
case 4:
nalu_length = AP4_BytesToUInt32BE(nalu);
break;
default:
break;
}
if (bytes_remaining < nalu_length_size+nalu_length) {
break;
}
AP4_UI08 nalu_type = nalu[nalu_length_size] & 0x1F;
if (nalu_length > 48 && (nalu_type == 1 || nalu_type == 5)) {
AP4_Size encrypted_size = 16*((nalu_length-32)/16);
if ((nalu_length%16) == 0) {
encrypted_size -= 16;
}
m_StreamCipher->SetIV(m_IV);
for (unsigned int i=0; i<encrypted_size; i += 10*16) {
AP4_Size one_block_size = 16;
m_StreamCipher->ProcessBuffer(nalu+nalu_length_size+32+i, one_block_size,
nalu+nalu_length_size+32+i, &one_block_size);
}
// perform startcode emulation prevention
AP4_DataBuffer escaped_nalu;
PreventStartCodeEmulation(nalu+nalu_length_size, nalu_length, escaped_nalu);
// the size may have changed
// TODO: this could overflow if nalu_length_size is too small
switch (nalu_length_size) {
case 1:
nalu[0] = (AP4_UI08)(escaped_nalu.GetDataSize()&0xFF);
break;
case 2:
AP4_BytesFromUInt16BE(nalu, escaped_nalu.GetDataSize());
break;
case 4:
AP4_BytesFromUInt32BE(nalu, escaped_nalu.GetDataSize());
break;
default:
break;
}
encrypted.AppendData(nalu, nalu_length_size);
encrypted.AppendData(escaped_nalu.GetData(), escaped_nalu.GetDataSize());
} else {
encrypted.AppendData(nalu, nalu_length_size);
encrypted.AppendData(nalu+nalu_length_size, nalu_length);
}
nalu += nalu_length_size+nalu_length;
bytes_remaining -= nalu_length_size+nalu_length;
}
sample.SetData(encrypted.GetData(), encrypted.GetDataSize());
return AP4_SUCCESS;
}
| 0
|
336,596
|
SPICE_GNUC_VISIBLE int spice_server_migrate_switch(SpiceServer *reds)
{
spice_debug("trace");
if (reds->clients.empty()) {
return 0;
}
reds->expect_migrate = FALSE;
if (!reds->config->mig_spice) {
spice_warning("spice_server_migrate_switch called without migrate_info set");
return 0;
}
reds->main_channel->migrate_switch(reds->config->mig_spice);
reds_mig_release(reds->config);
return 0;
}
| 0
|
346,461
|
ex_scriptnames(exarg_T *eap)
{
int i;
if (eap->addr_count > 0 || *eap->arg != NUL)
{
// :script {scriptId}: edit the script
if (eap->addr_count > 0 && !SCRIPT_ID_VALID(eap->line2))
emsg(_(e_invalid_argument));
else
{
if (eap->addr_count > 0)
eap->arg = SCRIPT_ITEM(eap->line2)->sn_name;
else
{
expand_env(eap->arg, NameBuff, MAXPATHL);
eap->arg = NameBuff;
}
do_exedit(eap, NULL);
}
return;
}
for (i = 1; i <= script_items.ga_len && !got_int; ++i)
{
scriptitem_T *si = SCRIPT_ITEM(i);
if (si->sn_name != NULL)
{
home_replace(NULL, si->sn_name, NameBuff, MAXPATHL, TRUE);
vim_snprintf((char *)IObuff, IOSIZE, "%3d%s: %s",
i,
si->sn_state == SN_STATE_NOT_LOADED ? " A" : "",
NameBuff);
if (!message_filtered(IObuff))
{
msg_putchar('\n');
msg_outtrans(IObuff);
out_flush(); // output one line at a time
ui_breakcheck();
}
}
}
}
| 0
|
318,962
|
ga_concat_shorten_esc(garray_T *gap, char_u *str)
{
char_u *p;
char_u *s;
int c;
int clen;
char_u buf[NUMBUFLEN];
int same_len;
if (str == NULL)
{
ga_concat(gap, (char_u *)"NULL");
return;
}
for (p = str; *p != NUL; ++p)
{
same_len = 1;
s = p;
c = mb_cptr2char_adv(&s);
clen = s - p;
while (*s != NUL && c == mb_ptr2char(s))
{
++same_len;
s += clen;
}
if (same_len > 20)
{
ga_concat(gap, (char_u *)"\\[");
ga_concat_esc(gap, p, clen);
ga_concat(gap, (char_u *)" occurs ");
vim_snprintf((char *)buf, NUMBUFLEN, "%d", same_len);
ga_concat(gap, buf);
ga_concat(gap, (char_u *)" times]");
p = s - 1;
}
else
ga_concat_esc(gap, p, clen);
}
}
| 0
|
483,515
|
int __init efi_config_init(efi_config_table_type_t *arch_tables)
{
void *config_tables;
int sz, ret;
if (efi.systab->nr_tables == 0)
return 0;
if (efi_enabled(EFI_64BIT))
sz = sizeof(efi_config_table_64_t);
else
sz = sizeof(efi_config_table_32_t);
/*
* Let's see what config tables the firmware passed to us.
*/
config_tables = early_memremap(efi.systab->tables,
efi.systab->nr_tables * sz);
if (config_tables == NULL) {
pr_err("Could not map Configuration table!\n");
return -ENOMEM;
}
ret = efi_config_parse_tables(config_tables, efi.systab->nr_tables, sz,
arch_tables);
early_memunmap(config_tables, efi.systab->nr_tables * sz);
return ret;
}
| 0
|
512,404
|
Item_string(THD *thd, const char *str, uint length, CHARSET_INFO *cs,
Derivation dv, uint repertoire)
:Item_literal(thd)
{
str_value.set_or_copy_aligned(str, length, cs);
fix_and_set_name_from_value(thd, dv, Metadata(&str_value, repertoire));
}
| 0
|
301,367
|
static struct tevent_req *vfswrap_fsync_send(struct vfs_handle_struct *handle,
TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct files_struct *fsp)
{
struct tevent_req *req;
struct vfswrap_asys_state *state;
int ret;
req = tevent_req_create(mem_ctx, &state, struct vfswrap_asys_state);
if (req == NULL) {
return NULL;
}
if (!vfswrap_init_asys_ctx(handle->conn->sconn->conn)) {
tevent_req_oom(req);
return tevent_req_post(req, ev);
}
state->asys_ctx = handle->conn->sconn->conn->asys_ctx;
state->req = req;
ret = asys_fsync(state->asys_ctx, fsp->fh->fd, req);
if (ret != 0) {
tevent_req_error(req, ret);
return tevent_req_post(req, ev);
}
talloc_set_destructor(state, vfswrap_asys_state_destructor);
return req;
}
| 0
|
432,223
|
static FlatRange *flatview_lookup(FlatView *view, AddrRange addr)
{
return bsearch(&addr, view->ranges, view->nr,
sizeof(FlatRange), cmp_flatrange_addr);
}
| 0
|
276,993
|
fiber_switch(mrb_state *mrb, mrb_value self, mrb_int len, const mrb_value *a, mrb_bool resume, mrb_bool vmexec)
{
struct mrb_context *c = fiber_check(mrb, self);
struct mrb_context *old_c = mrb->c;
enum mrb_fiber_state status;
mrb_value value;
fiber_check_cfunc(mrb, c);
status = c->status;
switch (status) {
case MRB_FIBER_TRANSFERRED:
if (resume) {
mrb_raise(mrb, E_FIBER_ERROR, "resuming transferred fiber");
}
break;
case MRB_FIBER_RUNNING:
case MRB_FIBER_RESUMED:
mrb_raise(mrb, E_FIBER_ERROR, "double resume");
break;
case MRB_FIBER_TERMINATED:
mrb_raise(mrb, E_FIBER_ERROR, "resuming dead fiber");
break;
default:
break;
}
old_c->status = resume ? MRB_FIBER_RESUMED : MRB_FIBER_TRANSFERRED;
c->prev = resume ? mrb->c : (c->prev ? c->prev : mrb->root_c);
fiber_switch_context(mrb, c);
if (status == MRB_FIBER_CREATED) {
mrb_value *b, *e;
if (!c->ci->proc) {
mrb_raise(mrb, E_FIBER_ERROR, "double resume (current)");
}
if (vmexec) {
c->ci--; /* pop dummy callinfo */
}
if (len >= 15) {
mrb_stack_extend(mrb, 3); /* for receiver, args and (optional) block */
c->stbase[1] = mrb_ary_new_from_values(mrb, len, a);
len = 15;
}
else {
mrb_stack_extend(mrb, len+2); /* for receiver and (optional) block */
b = c->stbase+1;
e = b + len;
while (b<e) {
*b++ = *a++;
}
}
c->cibase->n = len;
value = c->stbase[0] = MRB_PROC_ENV(c->cibase->proc)->stack[0];
}
else {
value = fiber_result(mrb, a, len);
if (vmexec) {
c->ci[1].stack[0] = value;
}
}
if (vmexec) {
c->vmexec = TRUE;
value = mrb_vm_exec(mrb, c->ci->proc, c->ci->pc);
mrb->c = old_c;
}
else {
MARK_CONTEXT_MODIFY(c);
}
return value;
}
| 0
|
512,715
|
Item_bool_rowready_func2::value_depends_on_sql_mode() const
{
if (compare_collation()->state & MY_CS_NOPAD)
return Item_func::value_depends_on_sql_mode();
return ((args[0]->value_depends_on_sql_mode() |
args[1]->value_depends_on_sql_mode()) &
Sql_mode_dependency(~0, ~MODE_PAD_CHAR_TO_FULL_LENGTH)).
soft_to_hard();
}
| 0
|
301,426
|
static int vfswrap_closedir(vfs_handle_struct *handle, DIR *dirp)
{
int result;
START_PROFILE(syscall_closedir);
result = closedir(dirp);
END_PROFILE(syscall_closedir);
return result;
}
| 0
|
402,602
|
handle_signing(context *ctx, struct pollfd *pollfd, socklen_t size,
int attached, bool with_file_type)
{
struct msghdr msg;
struct iovec iov;
ssize_t n;
char *buffer = malloc(size);
uint32_t file_format;
if (!buffer) {
oom:
ctx->cms->log(ctx->cms, ctx->priority|LOG_ERR,
"unable to allocate memory: %m");
exit(1);
}
memset(&msg, '\0', sizeof(msg));
iov.iov_base = buffer;
iov.iov_len = size;
msg.msg_iov = &iov;
msg.msg_iovlen = 1;
n = recvmsg(pollfd->fd, &msg, MSG_WAITALL);
if (with_file_type) {
file_format = *((uint32_t *) buffer);
n -= sizeof(uint32_t);
} else {
file_format = FORMAT_PE_BINARY;
}
pesignd_string *tn = (pesignd_string *)(buffer + sizeof(uint32_t));
if (n < (long long)sizeof(tn->size)) {
malformed:
ctx->cms->log(ctx->cms, ctx->priority|LOG_ERR,
"handle_signing: invalid data");
ctx->cms->log(ctx->cms, ctx->priority|LOG_ERR,
"possible exploit attempt. closing.");
close(pollfd->fd);
return;
}
n -= sizeof(tn->size);
if ((size_t)n < tn->size)
goto malformed;
n -= tn->size;
/* authenticating with nss frees these ... best API ever. */
ctx->cms->tokenname = PORT_ArenaStrdup(ctx->cms->arena,
(char *)tn->value);
if (!ctx->cms->tokenname)
goto oom;
if ((size_t)n < sizeof(tn->size))
goto malformed;
pesignd_string *cn = pesignd_string_next(tn);
n -= sizeof(cn->size);
if ((size_t)n < cn->size)
goto malformed;
ctx->cms->certname = PORT_ArenaStrdup(ctx->cms->arena,
(char *)cn->value);
if (!ctx->cms->certname)
goto oom;
n -= cn->size;
if (n != 0)
goto malformed;
int infd=-1;
socket_get_fd(ctx, pollfd->fd, &infd);
int outfd=-1;
socket_get_fd(ctx, pollfd->fd, &outfd);
ctx->cms->log(ctx->cms, ctx->priority|LOG_NOTICE,
"attempting to sign with key \"%s:%s\"",
tn->value, cn->value);
free(buffer);
int rc = find_certificate(ctx->cms, 1);
if (rc < 0) {
goto finish;
}
switch (file_format) {
case FORMAT_PE_BINARY:
rc = sign_pe(ctx, infd, outfd, attached);
break;
case FORMAT_KERNEL_MODULE:
rc = sign_kmod(ctx, infd, outfd, attached);
break;
default:
rc = -1;
break;
}
if (rc < 0)
ctx->cms->log(ctx->cms, ctx->priority|LOG_ERR,
"unrecognised format %d", file_format);
finish:
close(infd);
close(outfd);
send_response(ctx, ctx->cms, pollfd, rc);
teardown_digests(ctx->cms);
}
| 0
|
241,066
|
void list_peers(int fd)
{
char *data;
unsigned int olen;
struct boothc_hdr_msg hdr;
if (format_peers(&data, &olen) < 0)
goto out;
init_header(&hdr.header, CL_LIST, 0, 0, RLT_SUCCESS, 0, sizeof(hdr) + olen);
(void)send_header_plus(fd, &hdr, data, olen);
out:
if (data)
free(data);
}
| 0
|
366,254
|
static inline struct hlist_head *m_hash(struct vfsmount *mnt, struct dentry *dentry)
{
unsigned long tmp = ((unsigned long)mnt / L1_CACHE_BYTES);
tmp += ((unsigned long)dentry / L1_CACHE_BYTES);
tmp = tmp + (tmp >> m_hash_shift);
return &mount_hashtable[tmp & m_hash_mask];
}
| 0
|
283,742
|
static void zynq_slcr_compute_clocks(ZynqSLCRState *s)
{
uint64_t ps_clk = clock_get(s->ps_clk);
/* consider outputs clocks are disabled while in reset */
if (device_is_in_reset(DEVICE(s))) {
ps_clk = 0;
}
uint64_t io_pll = zynq_slcr_compute_pll(ps_clk, s->regs[R_IO_PLL_CTRL]);
uint64_t arm_pll = zynq_slcr_compute_pll(ps_clk, s->regs[R_ARM_PLL_CTRL]);
uint64_t ddr_pll = zynq_slcr_compute_pll(ps_clk, s->regs[R_DDR_PLL_CTRL]);
uint64_t uart_mux[4] = {io_pll, io_pll, arm_pll, ddr_pll};
/* compute uartX reference clocks */
clock_set(s->uart0_ref_clk,
ZYNQ_COMPUTE_CLK(s, uart_mux, R_UART_CLK_CTRL, CLKACT0));
clock_set(s->uart1_ref_clk,
ZYNQ_COMPUTE_CLK(s, uart_mux, R_UART_CLK_CTRL, CLKACT1));
}
| 0
|
386,538
|
bool DL_Dxf::checkVariable(const char* var, DL_Codes::version version) {
if (version>=DL_VERSION_2000) {
return true;
} else if (version==DL_VERSION_R12) {
// these are all the variables recognized by dxf r12:
if (!strcmp(var, "$ACADVER")) {
return true;
}
if (!strcmp(var, "$ACADVER")) {
return true;
}
if (!strcmp(var, "$ANGBASE")) {
return true;
}
if (!strcmp(var, "$ANGDIR")) {
return true;
}
if (!strcmp(var, "$ATTDIA")) {
return true;
}
if (!strcmp(var, "$ATTMODE")) {
return true;
}
if (!strcmp(var, "$ATTREQ")) {
return true;
}
if (!strcmp(var, "$AUNITS")) {
return true;
}
if (!strcmp(var, "$AUPREC")) {
return true;
}
if (!strcmp(var, "$AXISMODE")) {
return true;
}
if (!strcmp(var, "$AXISUNIT")) {
return true;
}
if (!strcmp(var, "$BLIPMODE")) {
return true;
}
if (!strcmp(var, "$CECOLOR")) {
return true;
}
if (!strcmp(var, "$CELTYPE")) {
return true;
}
if (!strcmp(var, "$CHAMFERA")) {
return true;
}
if (!strcmp(var, "$CHAMFERB")) {
return true;
}
if (!strcmp(var, "$CLAYER")) {
return true;
}
if (!strcmp(var, "$COORDS")) {
return true;
}
if (!strcmp(var, "$DIMALT")) {
return true;
}
if (!strcmp(var, "$DIMALTD")) {
return true;
}
if (!strcmp(var, "$DIMALTF")) {
return true;
}
if (!strcmp(var, "$DIMAPOST")) {
return true;
}
if (!strcmp(var, "$DIMASO")) {
return true;
}
if (!strcmp(var, "$DIMASZ")) {
return true;
}
if (!strcmp(var, "$DIMBLK")) {
return true;
}
if (!strcmp(var, "$DIMBLK1")) {
return true;
}
if (!strcmp(var, "$DIMBLK2")) {
return true;
}
if (!strcmp(var, "$DIMCEN")) {
return true;
}
if (!strcmp(var, "$DIMCLRD")) {
return true;
}
if (!strcmp(var, "$DIMCLRE")) {
return true;
}
if (!strcmp(var, "$DIMCLRT")) {
return true;
}
if (!strcmp(var, "$DIMDLE")) {
return true;
}
if (!strcmp(var, "$DIMDLI")) {
return true;
}
if (!strcmp(var, "$DIMEXE")) {
return true;
}
if (!strcmp(var, "$DIMEXO")) {
return true;
}
if (!strcmp(var, "$DIMGAP")) {
return true;
}
if (!strcmp(var, "$DIMLFAC")) {
return true;
}
if (!strcmp(var, "$DIMLIM")) {
return true;
}
if (!strcmp(var, "$DIMPOST")) {
return true;
}
if (!strcmp(var, "$DIMRND")) {
return true;
}
if (!strcmp(var, "$DIMSAH")) {
return true;
}
if (!strcmp(var, "$DIMSCALE")) {
return true;
}
if (!strcmp(var, "$DIMSE1")) {
return true;
}
if (!strcmp(var, "$DIMSE2")) {
return true;
}
if (!strcmp(var, "$DIMSHO")) {
return true;
}
if (!strcmp(var, "$DIMSOXD")) {
return true;
}
if (!strcmp(var, "$DIMSTYLE")) {
return true;
}
if (!strcmp(var, "$DIMTAD")) {
return true;
}
if (!strcmp(var, "$DIMTFAC")) {
return true;
}
if (!strcmp(var, "$DIMTIH")) {
return true;
}
if (!strcmp(var, "$DIMTIX")) {
return true;
}
if (!strcmp(var, "$DIMTM")) {
return true;
}
if (!strcmp(var, "$DIMTOFL")) {
return true;
}
if (!strcmp(var, "$DIMTOH")) {
return true;
}
if (!strcmp(var, "$DIMTOL")) {
return true;
}
if (!strcmp(var, "$DIMTP")) {
return true;
}
if (!strcmp(var, "$DIMTSZ")) {
return true;
}
if (!strcmp(var, "$DIMTVP")) {
return true;
}
if (!strcmp(var, "$DIMTXT")) {
return true;
}
if (!strcmp(var, "$DIMZIN")) {
return true;
}
if (!strcmp(var, "$DWGCODEPAGE")) {
return true;
}
if (!strcmp(var, "$DRAGMODE")) {
return true;
}
if (!strcmp(var, "$ELEVATION")) {
return true;
}
if (!strcmp(var, "$EXTMAX")) {
return true;
}
if (!strcmp(var, "$EXTMIN")) {
return true;
}
if (!strcmp(var, "$FILLETRAD")) {
return true;
}
if (!strcmp(var, "$FILLMODE")) {
return true;
}
if (!strcmp(var, "$HANDLING")) {
return true;
}
if (!strcmp(var, "$HANDSEED")) {
return true;
}
if (!strcmp(var, "$INSBASE")) {
return true;
}
if (!strcmp(var, "$LIMCHECK")) {
return true;
}
if (!strcmp(var, "$LIMMAX")) {
return true;
}
if (!strcmp(var, "$LIMMIN")) {
return true;
}
if (!strcmp(var, "$LTSCALE")) {
return true;
}
if (!strcmp(var, "$LUNITS")) {
return true;
}
if (!strcmp(var, "$LUPREC")) {
return true;
}
if (!strcmp(var, "$MAXACTVP")) {
return true;
}
if (!strcmp(var, "$MENU")) {
return true;
}
if (!strcmp(var, "$MIRRTEXT")) {
return true;
}
if (!strcmp(var, "$ORTHOMODE")) {
return true;
}
if (!strcmp(var, "$OSMODE")) {
return true;
}
if (!strcmp(var, "$PDMODE")) {
return true;
}
if (!strcmp(var, "$PDSIZE")) {
return true;
}
if (!strcmp(var, "$PELEVATION")) {
return true;
}
if (!strcmp(var, "$PEXTMAX")) {
return true;
}
if (!strcmp(var, "$PEXTMIN")) {
return true;
}
if (!strcmp(var, "$PLIMCHECK")) {
return true;
}
if (!strcmp(var, "$PLIMMAX")) {
return true;
}
if (!strcmp(var, "$PLIMMIN")) {
return true;
}
if (!strcmp(var, "$PLINEGEN")) {
return true;
}
if (!strcmp(var, "$PLINEWID")) {
return true;
}
if (!strcmp(var, "$PSLTSCALE")) {
return true;
}
if (!strcmp(var, "$PUCSNAME")) {
return true;
}
if (!strcmp(var, "$PUCSORG")) {
return true;
}
if (!strcmp(var, "$PUCSXDIR")) {
return true;
}
if (!strcmp(var, "$PUCSYDIR")) {
return true;
}
if (!strcmp(var, "$QTEXTMODE")) {
return true;
}
if (!strcmp(var, "$REGENMODE")) {
return true;
}
if (!strcmp(var, "$SHADEDGE")) {
return true;
}
if (!strcmp(var, "$SHADEDIF")) {
return true;
}
if (!strcmp(var, "$SKETCHINC")) {
return true;
}
if (!strcmp(var, "$SKPOLY")) {
return true;
}
if (!strcmp(var, "$SPLFRAME")) {
return true;
}
if (!strcmp(var, "$SPLINESEGS")) {
return true;
}
if (!strcmp(var, "$SPLINETYPE")) {
return true;
}
if (!strcmp(var, "$SURFTAB1")) {
return true;
}
if (!strcmp(var, "$SURFTAB2")) {
return true;
}
if (!strcmp(var, "$SURFTYPE")) {
return true;
}
if (!strcmp(var, "$SURFU")) {
return true;
}
if (!strcmp(var, "$SURFV")) {
return true;
}
if (!strcmp(var, "$TDCREATE")) {
return true;
}
if (!strcmp(var, "$TDINDWG")) {
return true;
}
if (!strcmp(var, "$TDUPDATE")) {
return true;
}
if (!strcmp(var, "$TDUSRTIMER")) {
return true;
}
if (!strcmp(var, "$TEXTSIZE")) {
return true;
}
if (!strcmp(var, "$TEXTSTYLE")) {
return true;
}
if (!strcmp(var, "$THICKNESS")) {
return true;
}
if (!strcmp(var, "$TILEMODE")) {
return true;
}
if (!strcmp(var, "$TRACEWID")) {
return true;
}
if (!strcmp(var, "$UCSNAME")) {
return true;
}
if (!strcmp(var, "$UCSORG")) {
return true;
}
if (!strcmp(var, "$UCSXDIR")) {
return true;
}
if (!strcmp(var, "$UCSYDIR")) {
return true;
}
if (!strcmp(var, "$UNITMODE")) {
return true;
}
if (!strcmp(var, "$USERI1")) {
return true;
}
if (!strcmp(var, "$USERR1")) {
return true;
}
if (!strcmp(var, "$USRTIMER")) {
return true;
}
if (!strcmp(var, "$VISRETAIN")) {
return true;
}
if (!strcmp(var, "$WORLDVIEW")) {
return true;
}
if (!strcmp(var, "$FASTZOOM")) {
return true;
}
if (!strcmp(var, "$GRIDMODE")) {
return true;
}
if (!strcmp(var, "$GRIDUNIT")) {
return true;
}
if (!strcmp(var, "$SNAPANG")) {
return true;
}
if (!strcmp(var, "$SNAPBASE")) {
return true;
}
if (!strcmp(var, "$SNAPISOPAIR")) {
return true;
}
if (!strcmp(var, "$SNAPMODE")) {
return true;
}
if (!strcmp(var, "$SNAPSTYLE")) {
return true;
}
if (!strcmp(var, "$SNAPUNIT")) {
return true;
}
if (!strcmp(var, "$VIEWCTR")) {
return true;
}
if (!strcmp(var, "$VIEWDIR")) {
return true;
}
if (!strcmp(var, "$VIEWSIZE")) {
return true;
}
return false;
}
return false;
}
| 0
|
344,748
|
argv_next(int *argcp, char ***argvp)
{
char *ret = (*argvp)[0];
if (*argcp > 0 && ret != NULL) {
(*argcp)--;
(*argvp)++;
}
return ret;
}
| 0
|
244,148
|
GF_Err udta_box_write(GF_Box *s, GF_BitStream *bs)
{
GF_Err e;
u32 i;
GF_UserDataMap *map;
GF_UserDataBox *ptr = (GF_UserDataBox *)s;
e = gf_isom_box_write_header(s, bs);
if (e) return e;
i=0;
while ((map = (GF_UserDataMap *)gf_list_enum(ptr->recordList, &i))) {
//warning: here we are not passing the actual "parent" of the list
//but the UDTA box. The parent itself is not an box, we don't care about it
e = gf_isom_box_array_write(s, map->boxes, bs);
if (e) return e;
}
return GF_OK;
}
| 0
|
244,297
|
GF_Err mvcg_box_read(GF_Box *s,GF_BitStream *bs)
{
u32 i;
GF_MultiviewGroupBox *ptr = (GF_MultiviewGroupBox *) s;
ISOM_DECREASE_SIZE(s, 7)
ptr->multiview_group_id = gf_bs_read_u32(bs);
ptr->num_entries = gf_bs_read_u16(bs);
gf_bs_read_u8(bs);
ptr->entries = gf_malloc(ptr->num_entries * sizeof(MVCIEntry));
memset(ptr->entries, 0, ptr->num_entries * sizeof(MVCIEntry));
for (i=0; i<ptr->num_entries; i++) {
ISOM_DECREASE_SIZE(s, 1)
ptr->entries[i].entry_type = gf_bs_read_u8(bs);
switch (ptr->entries[i].entry_type) {
case 0:
ISOM_DECREASE_SIZE(s, 4)
ptr->entries[i].trackID = gf_bs_read_u32(bs);
break;
case 1:
ISOM_DECREASE_SIZE(s, 6)
ptr->entries[i].trackID = gf_bs_read_u32(bs);
ptr->entries[i].tierID = gf_bs_read_u16(bs);
break;
case 2:
ISOM_DECREASE_SIZE(s, 2)
gf_bs_read_int(bs, 6);
ptr->entries[i].output_view_id = gf_bs_read_int(bs, 10);
break;
case 3:
ISOM_DECREASE_SIZE(s, 4)
gf_bs_read_int(bs, 6) ;
ptr->entries[i].start_view_id = gf_bs_read_int(bs, 10);
ptr->entries[i].view_count = gf_bs_read_u16(bs);
break;
}
}
return gf_isom_box_array_read(s, bs);
}
| 0
|
225,925
|
GF_Err vwid_box_write(GF_Box *s, GF_BitStream *bs)
{
GF_Err e;
u32 i, j;
GF_ViewIdentifierBox *ptr = (GF_ViewIdentifierBox *) s;
e = gf_isom_full_box_write(s, bs);
if (e) return e;
gf_bs_write_int(bs, 0, 2);
gf_bs_write_int(bs, ptr->min_temporal_id, 3);
gf_bs_write_int(bs, ptr->max_temporal_id, 3);
gf_bs_write_u16(bs, ptr->num_views);
for (i=0; i<ptr->num_views; i++) {
gf_bs_write_int(bs, 0, 6);
gf_bs_write_int(bs, ptr->views[i].view_id, 10);
gf_bs_write_int(bs, 0, 6);
gf_bs_write_int(bs, ptr->views[i].view_order_index, 10);
gf_bs_write_int(bs, ptr->views[i].texture_in_stream, 1);
gf_bs_write_int(bs, ptr->views[i].texture_in_track, 1);
gf_bs_write_int(bs, ptr->views[i].depth_in_stream, 1);
gf_bs_write_int(bs, ptr->views[i].depth_in_track, 1);
gf_bs_write_int(bs, ptr->views[i].base_view_type, 2);
gf_bs_write_int(bs, ptr->views[i].num_ref_views, 10);
for (j=0; j<ptr->views[i].num_ref_views; j++) {
gf_bs_write_int(bs, 0, 4);
gf_bs_write_int(bs, ptr->views[i].view_refs[j].dep_comp_idc, 2);
gf_bs_write_int(bs, ptr->views[i].view_refs[j].ref_view_id, 10);
}
}
return GF_OK;
| 0
|
369,221
|
static int io_openat2_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
{
struct open_how __user *how;
size_t len;
int ret;
how = u64_to_user_ptr(READ_ONCE(sqe->addr2));
len = READ_ONCE(sqe->len);
if (len < OPEN_HOW_SIZE_VER0)
return -EINVAL;
ret = copy_struct_from_user(&req->open.how, sizeof(req->open.how), how,
len);
if (ret)
return ret;
return __io_openat_prep(req, sqe);
}
| 0
|
90,868
|
void SetPersistentHostQuota(const std::string& host, int64 new_quota) {
quota_status_ = kQuotaStatusUnknown;
host_.clear();
type_ = kStorageTypeUnknown;
quota_ = -1;
quota_manager_->SetPersistentHostQuota(host, new_quota,
callback_factory_.NewCallback(
&QuotaManagerTest::DidGetHostQuota));
}
| 0
|
313,810
|
nv_operator(cmdarg_T *cap)
{
int op_type;
op_type = get_op_type(cap->cmdchar, cap->nchar);
#ifdef FEAT_JOB_CHANNEL
if (bt_prompt(curbuf) && op_is_change(op_type) && !prompt_curpos_editable())
{
clearopbeep(cap->oap);
return;
}
#endif
if (op_type == cap->oap->op_type) // double operator works on lines
nv_lineop(cap);
else if (!checkclearop(cap->oap))
{
cap->oap->start = curwin->w_cursor;
cap->oap->op_type = op_type;
#ifdef FEAT_EVAL
set_op_var(op_type);
#endif
}
}
| 0
|
225,987
|
GF_Err stsd_box_size(GF_Box *s)
{
GF_SampleDescriptionBox *ptr = (GF_SampleDescriptionBox *)s;
ptr->size += 4;
return GF_OK;
}
| 0
|
218,965
|
ConstantFolding::ConstantFolding(DeviceBase* cpu_device,
bool disable_compressed_tensor_optimization,
bool fold_quantization_ops)
: ConstantFolding(RewriterConfig::ON, cpu_device,
disable_compressed_tensor_optimization,
fold_quantization_ops) {}
| 0
|
398,522
|
static int init_comp_unit(RzBinDwarfCompUnit *cu) {
if (!cu) {
return -EINVAL;
}
cu->dies = calloc(sizeof(RzBinDwarfDie), COMP_UNIT_CAPACITY);
if (!cu->dies) {
return -ENOMEM;
}
cu->capacity = COMP_UNIT_CAPACITY;
cu->count = 0;
return 0;
}
| 0
|
212,407
|
http_isfiltered(const struct http *fm, unsigned u, unsigned how)
{
const char *e;
const struct http_hdrflg *f;
if (fm->hdf[u] & HDF_FILTER)
return (1);
e = strchr(fm->hd[u].b, ':');
if (e == NULL)
return (0);
f = http_hdr_flags(fm->hd[u].b, e);
return (f != NULL && f->flag & how);
}
| 1
|
427,729
|
cdf_unpack_catalog(const cdf_header_t *h, const cdf_stream_t *sst,
cdf_catalog_t **cat)
{
size_t ss = cdf_check_stream(sst, h);
const char *b = CAST(const char *, sst->sst_tab);
const char *nb, *eb = b + ss * sst->sst_len;
size_t nr, i, j, k;
cdf_catalog_entry_t *ce;
uint16_t reclen;
const uint16_t *np;
for (nr = 0;; nr++) {
memcpy(&reclen, b, sizeof(reclen));
reclen = CDF_TOLE2(reclen);
if (reclen == 0)
break;
b += reclen;
if (b > eb)
break;
}
if (nr == 0)
return -1;
nr--;
*cat = CAST(cdf_catalog_t *,
CDF_MALLOC(sizeof(cdf_catalog_t) + nr * sizeof(*ce)));
if (*cat == NULL)
return -1;
ce = (*cat)->cat_e;
memset(ce, 0, nr * sizeof(*ce));
b = CAST(const char *, sst->sst_tab);
for (j = i = 0; i < nr; b += reclen) {
cdf_catalog_entry_t *cep = &ce[j];
uint16_t rlen;
extract_catalog_field(uint16_t, ce_namlen, 0);
extract_catalog_field(uint16_t, ce_num, 4);
extract_catalog_field(uint64_t, ce_timestamp, 8);
reclen = cep->ce_namlen;
if (reclen < 14) {
cep->ce_namlen = 0;
continue;
}
cep->ce_namlen = __arraycount(cep->ce_name) - 1;
rlen = reclen - 14;
if (cep->ce_namlen > rlen)
cep->ce_namlen = rlen;
np = CAST(const uint16_t *, CAST(const void *, (b + 16)));
nb = CAST(const char *, CAST(const void *,
(np + cep->ce_namlen)));
if (nb > eb) {
cep->ce_namlen = 0;
break;
}
for (k = 0; k < cep->ce_namlen; k++)
cep->ce_name[k] = np[k]; /* XXX: CDF_TOLE2? */
cep->ce_name[cep->ce_namlen] = 0;
j = i;
i++;
}
(*cat)->cat_num = j;
return 0;
}
| 0
|
317,060
|
static int selinux_socket_post_create(struct socket *sock, int family,
int type, int protocol, int kern)
{
const struct task_security_struct *tsec = selinux_cred(current_cred());
struct inode_security_struct *isec = inode_security_novalidate(SOCK_INODE(sock));
struct sk_security_struct *sksec;
u16 sclass = socket_type_to_security_class(family, type, protocol);
u32 sid = SECINITSID_KERNEL;
int err = 0;
if (!kern) {
err = socket_sockcreate_sid(tsec, sclass, &sid);
if (err)
return err;
}
isec->sclass = sclass;
isec->sid = sid;
isec->initialized = LABEL_INITIALIZED;
if (sock->sk) {
sksec = sock->sk->sk_security;
sksec->sclass = sclass;
sksec->sid = sid;
/* Allows detection of the first association on this socket */
if (sksec->sclass == SECCLASS_SCTP_SOCKET)
sksec->sctp_assoc_state = SCTP_ASSOC_UNSET;
err = selinux_netlbl_socket_post_create(sock->sk, family);
}
return err;
}
| 0
|
229,247
|
static inline cql_server::result_with_foreign_response_ptr convert_error_message_to_coordinator_result(messages::result_message* msg) {
return std::move(*dynamic_cast<messages::result_message::exception*>(msg)).get_exception();
}
| 0
|
224,464
|
static GF_Err txtin_process(GF_Filter *filter)
{
GF_TXTIn *ctx = gf_filter_get_udta(filter);
GF_FilterPacket *pck;
GF_Err e;
Bool start, end;
pck = gf_filter_pid_get_packet(ctx->ipid);
if (!pck) {
return GF_OK;
}
gf_filter_pck_get_framing(pck, &start, &end);
if (!end) {
gf_filter_pid_drop_packet(ctx->ipid);
return GF_OK;
}
//file is loaded
e = ctx->text_process(filter, ctx);
if (e==GF_EOS) {
//keep input alive until end of stream, so that we keep getting called
gf_filter_pid_drop_packet(ctx->ipid);
if (gf_filter_pid_is_eos(ctx->ipid))
gf_filter_pid_set_eos(ctx->opid);
}
return e;
}
| 0
|
359,597
|
peer_weight_unset_vty (struct vty *vty, const char *ip_str)
{
struct peer *peer;
peer = peer_and_group_lookup_vty (vty, ip_str);
if (! peer)
return CMD_WARNING;
peer_weight_unset (peer);
return CMD_SUCCESS;
}
| 0
|
245,143
|
void Examples::RandomShuffle() {
std::iota(sampled_index_.begin(), sampled_index_.end(), 0);
std::random_device rd;
std::mt19937 rng(rd());
std::shuffle(sampled_index_.begin(), sampled_index_.end(), rng);
}
| 0
|
247,112
|
GF_Filter *gf_fs_load_destination(GF_FilterSession *fsess, const char *url, const char *args, const char *parent_url, GF_Err *err)
{
return gf_fs_load_source_dest_internal(fsess, url, args, parent_url, err, NULL, NULL, GF_FALSE, GF_FALSE, NULL);
}
| 0
|
210,050
|
static void singlevar (LexState *ls, expdesc *var) {
TString *varname = str_checkname(ls);
FuncState *fs = ls->fs;
singlevaraux(fs, varname, var, 1);
if (var->k == VVOID) { /* global name? */
expdesc key;
singlevaraux(fs, ls->envn, var, 1); /* get environment variable */
lua_assert(var->k != VVOID); /* this one must exist */
codestring(&key, varname); /* key is variable name */
luaK_indexed(fs, var, &key); /* env[varname] */
}
}
| 1
|
318,965
|
assert_equal_common(typval_T *argvars, assert_type_T atype)
{
garray_T ga;
if (tv_equal(&argvars[0], &argvars[1], FALSE, FALSE)
!= (atype == ASSERT_EQUAL))
{
prepare_assert_error(&ga);
fill_assert_error(&ga, &argvars[2], NULL, &argvars[0], &argvars[1],
atype);
assert_error(&ga);
ga_clear(&ga);
return 1;
}
return 0;
}
| 0
|
240,615
|
explicit ResourceGatherOp(OpKernelConstruction* c) : OpKernel(c) {
OP_REQUIRES_OK(c, c->GetAttr("batch_dims", &batch_dims_));
}
| 0
|
503,881
|
is_file_name_separator (SCM c)
{
if (scm_is_eq (c, SCM_MAKE_CHAR ('/')))
return 1;
#ifdef __MINGW32__
if (scm_is_eq (c, SCM_MAKE_CHAR ('\\')))
return 1;
#endif
return 0;
}
| 0
|
390,550
|
_GetCountedString(char **wire_inout,Bool swap)
{
char * wire,*str;
CARD16 len,*plen;
wire= *wire_inout;
plen= (CARD16 *)wire;
if (swap) {
register int n;
swaps(plen,n);
}
len= *plen;
str= (char *)_XkbAlloc(len+1);
if (str) {
memcpy(str,&wire[2],len);
str[len]= '\0';
}
wire+= XkbPaddedSize(len+2);
*wire_inout= wire;
return str;
}
| 0
|
273,875
|
static void mlsd_printf(ctrl_t *ctrl, char *buf, size_t len, char *path, char *name, struct stat *st)
{
char perms[10] = "";
int ro = !access(path, R_OK);
int rw = !access(path, W_OK);
if (S_ISDIR(st->st_mode)) {
/* XXX: Verify 'e' by checking that we can CD to the 'name' */
if (ro)
strlcat(perms, "le", sizeof(perms));
if (rw)
strlcat(perms, "pc", sizeof(perms)); /* 'd' RMD, 'm' MKD */
} else {
if (ro)
strlcat(perms, "r", sizeof(perms));
if (rw)
strlcat(perms, "w", sizeof(perms)); /* 'f' RNFR, 'd' DELE */
}
memset(buf, 0, len);
if (ctrl->d_num == -1 && (ctrl->list_mode & 0x0F) == 2)
strlcat(buf, " ", len);
for (int i = 0; ctrl->facts[i]; i++)
mlsd_fact(ctrl->facts[i], buf, len, name, perms, st);
strlcat(buf, " ", len);
strlcat(buf, name, len);
strlcat(buf, "\r\n", len);
}
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.